@xopcai/xopc 0.0.230 → 0.0.231
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-Bp_wmuGW.js → agent-avatar-dicebear-CBqUnlvL.js} +1 -1
- package/dist/gateway/static/root/assets/agents-7YO6znTT.js +68 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-CwAPK4Jm.js → app-management-settings-panel-DP7YVRPn.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-DsGLvqTb.js → appearance-settings-CVQ5n7y6.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-Ee9qOQEx.js → apps-page-DSCia0DT.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-B4qqigAQ.js → attachment-load-mmr_mHRr.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-B8ImehSW.js → automations-page-DfY-T6Ga.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-BpvD54D6.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-DaJbyYc2.js → binary-plugins-CO9QMEh2.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-Kl25XWJc.js → block-editor-CE14CVOy.js} +3 -3
- package/dist/gateway/static/root/assets/browser-settings-page-CeESA4Oj.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflows-page-DjMxs33B.js → browser-workflows-page-1wgXyoSO.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-B_OXTojB.js +7 -0
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-D5nZecxV.js +3 -0
- package/dist/gateway/static/root/assets/channels-settings-BzmnWx6X.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-BiU_4Rq6.js → chat-terminal-dock-CdRW6Euc.js} +2 -2
- package/dist/gateway/static/root/assets/cloud-C4-yfnnk.js +1 -0
- package/dist/gateway/static/root/assets/connectors-page-DX6OkwFQ.js +2 -0
- package/dist/gateway/static/root/assets/{cron-expression-Cs_5pUPT.js → cron-expression-DYSMZsms.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-y1kWrFVU.js → date-picker-DGCfX4tK.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-skc62zrn.js → dependency-picker-DHDa4ht1.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-ux9DxchT.js → desktop-pet-CMO-J3cG.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-BVVCBgYK.js → desktop-pet-settings-MmOR4A3u.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-V8vZP0Dy.js → directory-picker-path-field-B9qoxDcn.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-Dh6DDuvQ.js → extension-debug-page-DdH0dG2_.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-8OKQDEat.js → extension-page-Clg-KktN.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-BgSV0Nny.js → extension-settings-page-eP3fJ2M6.js} +1 -1
- package/dist/gateway/static/root/assets/files-Dp8_uGTO.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-api-Dlc6eaTG.js → gateway-config-api-DEHnF4Wm.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-DqQgiAUv.js → gateway-settings-DKkEXXj9.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-Pxqk5GFH.js → heartbeat-settings-DlBPNubY.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-BnOrLRfs.js +1 -0
- package/dist/gateway/static/root/assets/index-0xQO5B_Q.js +70 -0
- package/dist/gateway/static/root/assets/index-CCyIdGuQ.css +2 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BSFNqxzY.js → keyboard-shortcuts-settings-BvpEeHnm.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-Ch1rdUo8.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-DzU6yZ9-.js → local-apps-page-Bzvn99eH.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-zxx2ExlY.js +2 -0
- package/dist/gateway/static/root/assets/{management-settings-B8hM56HS.js → management-settings-BQaeyOYm.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-DRbZjxMK.js → markdown-split-D9tmIiEm.js} +1 -1
- package/dist/gateway/static/root/assets/markdown-view-B1bGSQqt.css +1 -0
- package/dist/gateway/static/root/assets/{media-plugins-B8vMe5VX.js → media-plugins-D8I7OGnT.js} +1 -1
- package/dist/gateway/static/root/assets/models-hub-cache-0RjEwafI.js +1 -0
- package/dist/gateway/static/root/assets/{notes-api-BFsOGYkd.js → notes-api-EpgG-OQc.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-B-YZ7iuK.js → notes-page-CCvjGMhN.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-9cgh77VH.js +4 -0
- package/dist/gateway/static/root/assets/oauth-api-BwNLwbI8.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-DkWcyki5.js → product-open-page-MmMswmOU.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-hf6pmH4p.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-By2U-Wdh.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-CUcpp7CQ.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-Bq_ETeal.js → runtime-tools-settings-panel-Dx6o7sLu.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-BogTlrsP.js → schema-form-Cdd9c4vt.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-ByI82xS1.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-BCoI5IJ8.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-Coy1Cbp6.js → settings-form-section-D0YxMnhm.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-B5GU7iCG.js → settings-loading-skeleton-y53gEKsF.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-Dd-BRu12.js → settings-page-BoE_tToG.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-CwEFAVWx.js → setup-status-panel-BQmyb5KC.js} +1 -1
- package/dist/gateway/static/root/assets/share-preview-page-DiqBn-oE.js +2 -0
- package/dist/gateway/static/root/assets/shares-settings-Bf3VpZ-R.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-CXHlbuGS.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-Brxb6QnW.js → skills-page-CZwhWiRl.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-FB5LtEGm.js → skills-page.utils-kBGr8opZ.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-ChosWt8n.js → system-settings-panel-CPBs6lWi.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-Bo0KSZ2v.js +1 -0
- package/dist/gateway/static/root/assets/theme-store-Qgvo0Ga7.js +1 -0
- package/dist/gateway/static/root/assets/{use-autosave-2SqnmSKD.js → use-autosave-C4YcEiP9.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-Cnj7gMX2.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-DtTIF6M8.js → voice-api-key-field-BML8zCwZ.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-CK3aZDdE.js → work-discovery-overlay-CKIdPEen.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BjOuddkX.js → workflow-run-setup-panel-BK44Vm5W.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-CB98MTwG.js +5 -0
- package/dist/gateway/static/root/index.html +10 -6
- package/dist/package.js +1 -1
- package/dist/src/agent/service.d.ts +1 -0
- package/dist/src/agent/service.js +5 -2
- package/dist/src/agent/skills/skill-manage-ops.js +1 -1
- package/dist/src/agent/tools/write.js +9 -12
- package/dist/src/agent/tools/xopc-use-tool.js +2 -2
- package/dist/src/auth/oauth/index.js +2 -2
- package/dist/src/auth/oauth/registry.d.ts +1 -1
- package/dist/src/auth/oauth/registry.js +5 -1
- package/dist/src/auth/oauth/xopc-cloud.d.ts +1 -0
- package/dist/src/auth/oauth/xopc-cloud.js +8 -2
- package/dist/src/files/file-service.d.ts +36 -0
- package/dist/src/files/file-service.js +282 -0
- package/dist/src/gateway/heartbeat/service.js +1 -1
- package/dist/src/gateway/hono/app.js +2 -2
- package/dist/src/gateway/hono/routes/files.d.ts +3 -0
- package/dist/src/gateway/hono/routes/files.js +172 -0
- package/dist/src/gateway/hono/routes/lazy-bundles.js +8 -0
- package/dist/src/gateway/hono/routes/projects.js +0 -508
- package/dist/src/gateway/hono/routes/shares.js +410 -21
- package/dist/src/gateway/hono/routes/voice.js +1 -1
- package/dist/src/gateway/hono/routes/workspace.js +15 -974
- package/dist/src/gateway/service.js +9 -9
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/share/hosted-session-share.d.ts +104 -0
- package/dist/src/share/hosted-session-share.js +276 -0
- package/dist/src/share/note-share-service.js +4 -24
- package/dist/src/share/session-share-projector.d.ts +31 -0
- package/dist/src/share/session-share-projector.js +79 -0
- package/dist/src/share/session-share-service.d.ts +89 -0
- package/dist/src/share/session-share-service.js +325 -0
- package/dist/src/share/share-asset-ticket.d.ts +7 -0
- package/dist/src/share/share-asset-ticket.js +30 -0
- package/dist/src/share/share-landing.d.ts +4 -3
- package/dist/src/share/share-landing.js +5 -5
- package/dist/src/share/share-store.d.ts +27 -2
- package/dist/src/share/share-store.js +71 -8
- package/dist/src/share/share-types.d.ts +17 -2
- package/dist/src/tui/backends/embedded-backend.js +1 -1
- package/dist/src/tui/backends/gateway-realtime-backend.js +11 -3
- package/package.json +1 -1
- package/dist/gateway/static/root/assets/agents-CKG93dlc.js +0 -68
- package/dist/gateway/static/root/assets/automations-workspace-BNFAfNwC.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-Cg6NgwE_.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-NvJKgF1u.js +0 -7
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-C2uBdALe.js +0 -3
- package/dist/gateway/static/root/assets/channels-settings-CIcYKMEs.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-CEEcmUiP.js +0 -2
- package/dist/gateway/static/root/assets/home-page-1xjo6wE4.js +0 -1
- package/dist/gateway/static/root/assets/index-Bbd_dXui.js +0 -70
- package/dist/gateway/static/root/assets/index-D_hrEKXM.css +0 -2
- package/dist/gateway/static/root/assets/local-app-workbench-page-heQ4-PJ7.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-BblnS6Jy.js +0 -2
- package/dist/gateway/static/root/assets/markdown-view-CLzTdVLW.css +0 -1
- package/dist/gateway/static/root/assets/notes-workbench-CAM09C8b.js +0 -4
- package/dist/gateway/static/root/assets/project-detail-page-BIPIwgU2.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-B_kzTn1K.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CtD8DsD-.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-B8n9HI1y.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-xlhdRTME.js +0 -1
- package/dist/gateway/static/root/assets/share-preview-page-DzXw9UQJ.js +0 -2
- package/dist/gateway/static/root/assets/shares-settings-Bk6UQOwS.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-DrmQZ3Au.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-CW2sJbdc.js +0 -1
- package/dist/gateway/static/root/assets/theme-store-DOdCjyuw.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-Bq9KB-Oj.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-CcbGEQol.js +0 -5
- package/dist/src/gateway/file-path-classifier.d.ts +0 -30
- package/dist/src/gateway/file-path-classifier.js +0 -105
- package/dist/src/gateway/file-reference-errors.d.ts +0 -6
- package/dist/src/gateway/file-reference-errors.js +0 -21
- package/dist/src/gateway/file-reference-registry.d.ts +0 -34
- package/dist/src/gateway/file-reference-registry.js +0 -45
- /package/dist/gateway/static/root/assets/{markdown-view-DvM5PWEH.js → markdown-view-RxNHwlNo.js} +0 -0
|
@@ -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,p as o,t as s}from"./chunk-KS7C4IRE-BaASWQor.js";import{t as c}from"./check-DUBLcKHA.js";import{d as l,f as u,l as d,n as f,p,r as m,t as h,u as g}from"./popover-select-CccGri5Y.js";import{t as _}from"./circle-check-C23XjkUj.js";import{t as v}from"./copy-Dv6d4Dvw.js";import{t as y}from"./download-Dk-ZjtO6.js";import{t as b}from"./external-link-DjqjBmc3.js";import{d as x,p as S}from"./markdown-view-DvM5PWEH.js";import{t as C}from"./plus-Q2yW6OE7.js";import{t as w}from"./search-DA7gz22f.js";import{t as T}from"./x-B_N4OPjy.js";import{t as E}from"./cn-JdwAhgNB.js";import{t as D}from"./button-CSEbl4zT.js";import{t as O}from"./copy-to-clipboard-HOJ79TWv.js";import{t as k}from"./messages-BMdD0LWk.js";import{n as A,r as j,s as M}from"./locale-store-CXhjfe4q.js";import{a as N,c as P,i as F,n as I,o as L,r as R,s as z,t as ee}from"./dist-BPoKqzeH.js";import{$a as te,$c as B,Aa as V,Ai as H,Ba as U,Cs as ne,Da as re,Dc as W,Fa as ie,Gc as ae,Gl as oe,Ha as G,Hs as K,Ia as se,L as ce,La as q,Ma as le,Mc as ue,Ml as de,Na as fe,Oa as J,Ol as pe,Os as me,Pa as he,Ps as ge,Q as _e,R as ve,Ra as ye,U as be,Ua as xe,Ul as Se,Un as Ce,V as we,Va as Te,Vl as Ee,Vn as De,Wa as Oe,Wc as ke,Wi as Ae,Wl as je,Xs as Me,Z as Ne,Zs as Pe,_c as Fe,_o as Ie,bs as Le,cl as Re,cu as ze,da as Be,do as Ve,ec as He,el as Ue,fa as We,fc as Ge,fs as Ke,fu as qe,ga as Je,gr as Ye,gt as Xe,ha as Ze,hl as Qe,it as $e,ja as et,ka as tt,la as nt,ll as rt,lr as it,lu as at,ma as ot,ml as st,no as ct,oa as lt,ol as ut,pa as dt,pc as ft,ql as pt,qs as mt,sa as ht,tc as gt,ua as _t,uo as vt,wl as yt,wr as bt,za as xt,zc as St,zl as Ct}from"./index-Bbd_dXui.js";import{t as wt}from"./notes-workbench-CAM09C8b.js";import{n as Tt,t as Et}from"./use-autosave-2SqnmSKD.js";import{t as Dt}from"./page-tabs-BaEQMYm_.js";import{t as Ot}from"./directory-picker-path-field-V8vZP0Dy.js";import{t as kt}from"./date-picker-y1kWrFVU.js";import{t as At}from"./automations-workspace-BNFAfNwC.js";import{i as jt,p as Mt,s as Nt}from"./skills-page.utils-FB5LtEGm.js";import{t as Pt}from"./dependency-picker-skc62zrn.js";import{c as Ft,l as It,n as Lt,o as Rt,r as zt,t as Bt}from"./style-TIDOdKy0.js";var Y=e(t(),1),Vt=n();function Ht(e){return M(j(`/api/projects/${encodeURIComponent(e)}/skills`))}function Ut(e,t){return M(j(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`))}function Wt(e,t){return M(j(`/api/projects/${encodeURIComponent(e)}/workspace-trust`),{method:`PATCH`,body:JSON.stringify({trusted:t})})}function Gt(e,t){let n=new FormData;return n.set(`file`,t),M(j(`/api/projects/${encodeURIComponent(e)}/skills/upload`),{method:`POST`,body:n})}function Kt(e,t,n={}){return M(j(`/api/projects/${encodeURIComponent(e)}/skills/marketplace/install`),{method:`POST`,body:JSON.stringify({name:t,...n})})}function qt(e,t){return M(j(`/api/projects/${encodeURIComponent(e)}/skills/source/install`),{method:`POST`,body:JSON.stringify({source:t})})}function Jt(e,t){return M(j(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`),{method:`DELETE`})}var X=r();function Yt({projectId:e,copy:t}){let[n,r]=(0,Y.useState)([]),[i,a]=(0,Y.useState)([]),[o,s]=(0,Y.useState)([]),[c,d]=(0,Y.useState)([]),[f,m]=(0,Y.useState)([]),[_,v]=(0,Y.useState)(``),[b,x]=(0,Y.useState)(null),[S,O]=(0,Y.useState)(!1),[k,A]=(0,Y.useState)(!0),[j,M]=(0,Y.useState)(!1),[P,F]=(0,Y.useState)(null),[te,B]=(0,Y.useState)(``),[V,H]=(0,Y.useState)(null),[U,re]=(0,Y.useState)(null),[W,ie]=(0,Y.useState)(``),[ae,G]=(0,Y.useState)(1),[K,ce]=(0,Y.useState)(null),[q,le]=(0,Y.useState)(!1),[de,fe]=(0,Y.useState)(``),[J,pe]=(0,Y.useState)(``),me=(0,Y.useRef)(null),he=(0,Y.useCallback)(async()=>{A(!0),B(``);try{let t=await Ht(e);r(t.items),a(t.inheritedItems),s(t.sources),d(t.diagnostics)}catch(e){B(e instanceof Error?e.message:String(e))}finally{A(!1)}},[e]);(0,Y.useEffect)(()=>{he()},[he]),(0,Y.useEffect)(()=>{let t=!1;return se(e).then(e=>{t||m(e)}).catch(()=>{t||m([])}),()=>{t=!0}},[e]),(0,Y.useEffect)(()=>{if(!_){x(null);return}let e=f.find(e=>e.key===_),t=!1;return x(null),B(``),O(!0),bt(e?.agentId??e?.routing?.agentId,_,!0).then(e=>{t||x(e)}).catch(e=>{t||B(e instanceof Error?e.message:String(e))}).finally(()=>{t||O(!1)}),()=>{t=!0}},[_,f]),(0,Y.useEffect)(()=>{if(V!==`marketplace`)return;let e=new AbortController,t=window.setTimeout(()=>{le(!0),fe(``),Mt({q:W,page:ae,pageSize:8,sort:`downloads`,signal:e.signal}).then(ce).catch(t=>{e.signal.aborted||fe(t instanceof Error?t.message:String(t))}).finally(()=>{e.signal.aborted||le(!1)})},250);return()=>{window.clearTimeout(t),e.abort()}},[V,ae,W]);async function _e(e,t){M(!0),F(t??null),B(``);try{await e(),H(null),pe(``),await he()}catch(e){B(e instanceof Error?e.message:String(e))}finally{M(!1),F(null)}}async function ve(t){B(``);try{re((await Ut(e,t)).skill)}catch(e){B(e instanceof Error?e.message:String(e))}}async function ye(n){if(n.removable&&window.confirm(t.removeConfirm.replace(`{{name}}`,n.name))){M(!0);try{await Jt(e,n.directoryId),await he()}catch(e){B(e instanceof Error?e.message:String(e))}finally{M(!1)}}}async function be(){M(!0),B(``);try{await Wt(e,!0),await he()}catch(e){B(e instanceof Error?e.message:String(e))}finally{M(!1)}}let xe=o.find(e=>e.origin===`agents-workspace`),Ce=new Map(b?.skills.map(e=>[e.name,e]));return(0,X.jsxs)(`section`,{id:`project-panel-skills`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-skills`,className:`grid content-start gap-4`,children:[(0,X.jsxs)(`div`,{className:`rounded-lg bg-surface-panel p-4 shadow-surface`,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-sm font-semibold text-fg`,children:t.title}),(0,X.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.description})]}),(0,X.jsxs)(u,{children:[(0,X.jsx)(p,{asChild:!0,children:(0,X.jsxs)(D,{type:`button`,children:[(0,X.jsx)(C,{className:`size-4`,"aria-hidden":!0}),t.add,(0,X.jsx)(oe,{className:`size-3.5`,"aria-hidden":!0})]})}),(0,X.jsx)(l,{children:(0,X.jsxs)(g,{align:`end`,sideOffset:8,className:`z-50 w-72 rounded-lg border border-edge bg-surface-panel p-1.5 shadow-xl`,children:[(0,X.jsx)($t,{icon:ge,title:t.marketplace,hint:t.marketplaceHint,onClick:()=>H(`marketplace`)}),(0,X.jsx)($t,{icon:ut,title:t.source,hint:t.sourceHint,onClick:()=>H(`source`)}),(0,X.jsx)($t,{icon:ne,title:t.upload,hint:t.uploadHint,onClick:()=>me.current?.click()})]})})]}),(0,X.jsx)(`input`,{ref:me,type:`file`,accept:`.zip,application/zip`,className:`hidden`,onChange:t=>{let n=t.target.files?.[0];n&&_e(()=>Gt(e,n)),t.target.value=``}})]}),o.length?(0,X.jsx)(`div`,{className:`mt-3 grid gap-2 rounded-md border border-edge-subtle bg-surface-base p-3`,children:o.map(e=>(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-xs`,children:[(0,X.jsx)(`span`,{className:`font-medium text-fg`,children:e.origin===`xopc-workspace`?t.xopcSource:t.agentsSource}),e.writable?null:(0,X.jsx)(`span`,{className:`rounded bg-surface-hover px-1.5 py-0.5 text-fg-muted`,children:t.sourceReadOnly}),(0,X.jsx)(`span`,{className:`text-fg-subtle`,children:en(t,e.state)}),(0,X.jsxs)(`span`,{className:`min-w-0 break-all font-mono text-fg-subtle`,children:[t.path,`: `,e.rootDir]})]},e.origin))}):null]}),te?(0,X.jsx)(`p`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:te}):null,xe?.state===`untrusted`?(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-lg border border-amber-500/30 bg-amber-500/10 px-4 py-3`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,X.jsx)(ue,{className:`mt-0.5 size-4 shrink-0 text-amber-700 dark:text-amber-300`,"aria-hidden":!0}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.trustTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.trustHint})]})]}),(0,X.jsxs)(D,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>void be(),children:[(0,X.jsx)(mt,{className:`size-4`,"aria-hidden":!0}),j?t.trusting:t.trustAction]})]}):null,c.some(e=>e.type!==`skipped`)?(0,X.jsxs)(`div`,{className:`rounded-lg border border-amber-500/30 bg-amber-500/10 px-4 py-3`,children:[(0,X.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.diagnosticsTitle}),(0,X.jsx)(`ul`,{className:`mt-2 grid gap-1 text-xs leading-5 text-fg-muted`,children:c.filter(e=>e.type!==`skipped`).map((e,t)=>(0,X.jsx)(`li`,{children:e.message},`${e.type}:${e.path??``}:${t}`))})]}):null,f.length?(0,X.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-3 rounded-lg border border-edge bg-surface-panel p-4`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.sessionViewLabel}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:S?t.sessionLoading:_?b?.agentId:t.sessionViewAll})]}),(0,X.jsx)(h,{value:_,options:f.map(e=>({value:e.key,label:e.name?.trim()||`${t.sessionFallback} · ${e.key.slice(-12)}`})),placeholder:t.sessionViewAll,emptyLabel:t.sessionViewAll,triggerClassName:`w-[min(24rem,calc(100vw-3rem))]`,onChange:v})]}):null,k?(0,X.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:[0,1,2].map(e=>(0,X.jsx)(ct,{className:`h-36 rounded-lg`},e))}):n.length?(0,X.jsx)(Xt,{title:t.localTitle,items:n,copy:t,busy:j,availabilityByName:Ce,onPreview:ve,onRemove:ye}):(0,X.jsxs)(`div`,{className:`rounded-lg border border-dashed border-edge bg-surface-panel px-6 py-12 text-center`,children:[(0,X.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.empty}),(0,X.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:t.emptyHint})]}),!k&&i.length?(0,X.jsx)(Xt,{title:t.inheritedTitle,hint:t.inheritedHint,items:i,copy:t,busy:j,availabilityByName:Ce,onPreview:ve,onRemove:ye}):null,(0,X.jsx)(ee,{open:V!==null,onOpenChange:e=>{e||H(null)},children:(0,X.jsxs)(L,{children:[(0,X.jsx)(N,{className:`fixed inset-0 z-50 bg-black/45`}),(0,X.jsxs)(R,{className:E(`fixed left-1/2 top-1/2 z-50 flex -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-xl`,V===`marketplace`?`h-[min(46rem,calc(100vh-2rem))] w-[min(58rem,calc(100vw-2rem))]`:`h-[min(22rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))]`),children:[(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,X.jsx)(z,{className:`text-base font-semibold text-fg`,children:V===`marketplace`?t.marketplace:t.source}),(0,X.jsx)(I,{asChild:!0,children:(0,X.jsx)(D,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,X.jsx)(T,{className:`size-4`})})})]}),(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:V===`marketplace`?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.marketplace}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.marketplaceHint}),(0,X.jsxs)(`div`,{className:`relative mt-3`,children:[(0,X.jsx)(w,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,X.jsx)(`input`,{className:`h-10 w-full rounded-md border border-edge bg-surface-base pl-9 pr-3 text-sm outline-none focus:border-accent`,value:W,onChange:e=>{ie(e.target.value),G(1)},placeholder:t.marketplacePlaceholder,autoFocus:!0})]}),de?(0,X.jsx)(`p`,{className:`mt-3 text-sm text-red-600 dark:text-red-300`,children:de}):null,q&&!K?(0,X.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[0,1,2,3].map(e=>(0,X.jsx)(ct,{className:`h-32 rounded-lg`},e))}):K?.items.length?(0,X.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:K.items.map(r=>{let i=r.providerId??K.provider,a=jt(r,i),o=n.some(e=>e.origin===`xopc-workspace`&&(e.directoryId===r.id||e.directoryId===a||e.name===r.name)),s=P===a;return(0,X.jsxs)(`article`,{className:`group flex min-h-32 gap-3 rounded-lg border border-edge bg-surface-base p-3`,children:[(0,X.jsx)(Nt,{name:r.name,className:`size-10`}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,X.jsx)(`h4`,{className:`truncate text-sm font-semibold text-fg`,children:r.name}),(0,X.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:r.description||`—`}),(0,X.jsxs)(`div`,{className:`mt-auto flex items-end justify-between gap-2 pt-2`,children:[(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-fg-subtle`,children:[(0,X.jsx)(y,{className:`size-3.5`,"aria-hidden":!0}),t.marketplaceDownloads,` `,r.downloads]}),(0,X.jsx)(D,{type:`button`,className:`h-8 px-2.5 text-xs`,variant:o?`secondary`:`primary`,disabled:j||o,onClick:()=>void _e(()=>Kt(e,a,{provider:i}),a),children:o?t.marketplaceInstalled:s?t.installing:t.install})]})]})]},`${i??`default`}:${r.id}`)})}):q?null:(0,X.jsx)(`p`,{className:`mt-6 text-center text-sm text-fg-muted`,children:t.marketplaceEmpty}),K&&K.meta.totalPages>1?(0,X.jsxs)(`div`,{className:`mt-3 flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,X.jsx)(`span`,{className:`text-xs text-fg-muted`,children:t.marketplacePage.replace(`{{page}}`,String(K.meta.page)).replace(`{{total}}`,String(K.meta.totalPages))}),(0,X.jsxs)(`div`,{className:`flex gap-2`,children:[(0,X.jsxs)(D,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:q||ae<=1,onClick:()=>G(e=>Math.max(1,e-1)),children:[(0,X.jsx)(je,{className:`size-4`}),t.marketplacePrevious]}),(0,X.jsxs)(D,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:q||ae>=K.meta.totalPages,onClick:()=>G(e=>e+1),children:[t.marketplaceNext,(0,X.jsx)(Se,{className:`size-4`})]})]})]}):null]}):(0,X.jsxs)(`section`,{className:`flex h-full flex-col`,children:[(0,X.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:t.sourceHint}),(0,X.jsx)(`input`,{className:`mt-4 h-10 w-full rounded-md border border-edge bg-surface-base px-3 text-sm outline-none focus:border-accent`,value:J,onChange:e=>pe(e.target.value),placeholder:t.sourcePlaceholder,autoFocus:!0}),(0,X.jsxs)(`div`,{className:`mt-auto flex justify-end gap-2 border-t border-edge pt-4`,children:[(0,X.jsx)(I,{asChild:!0,children:(0,X.jsx)(D,{type:`button`,variant:`secondary`,children:t.close})}),(0,X.jsx)(D,{type:`button`,disabled:j||!J.trim(),onClick:()=>void _e(()=>qt(e,J.trim())),children:j?t.installing:t.install})]})]})})]})]})}),(0,X.jsx)(ee,{open:!!U,onOpenChange:e=>{e||re(null)},children:(0,X.jsxs)(L,{children:[(0,X.jsx)(N,{className:`fixed inset-0 z-50 bg-black/45`}),(0,X.jsxs)(R,{className:`fixed left-1/2 top-1/2 z-50 flex h-[min(42rem,calc(100vh-2rem))] w-[min(48rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-xl`,children:[(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,X.jsx)(z,{className:`text-base font-semibold text-fg`,children:U?.name}),(0,X.jsx)(I,{asChild:!0,children:(0,X.jsx)(D,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,X.jsx)(T,{className:`size-4`})})})]}),(0,X.jsx)(`pre`,{className:`min-h-0 flex-1 overflow-auto whitespace-pre-wrap p-5 text-sm leading-6 text-fg-muted`,children:U?.bodyMarkdown})]})]})})]})}function Xt(e){let t=(0,Vt.c)(25),{title:n,hint:r,items:i,copy:a,busy:o,availabilityByName:s,onPreview:c,onRemove:l}=e,u;t[0]===n?u=t[1]:(u=(0,X.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n}),t[0]=n,t[1]=u);let d;t[2]===r?d=t[3]:(d=r?(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:r}):null,t[2]=r,t[3]=d);let f;t[4]!==u||t[5]!==d?(f=(0,X.jsxs)(`div`,{children:[u,d]}),t[4]=u,t[5]=d,t[6]=f):f=t[6];let p;if(t[7]!==s||t[8]!==o||t[9]!==a||t[10]!==i||t[11]!==c||t[12]!==l){let e;t[14]!==s||t[15]!==o||t[16]!==a||t[17]!==c||t[18]!==l?(e=e=>{let t=e.effective?s.get(e.name):void 0;return(0,X.jsxs)(`article`,{className:E(`flex min-h-36 flex-col rounded-lg border border-edge bg-surface-panel p-4`,!e.effective&&`opacity-70`),children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(qe,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,X.jsx)(`h4`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:e.name})]}),(0,X.jsx)(`p`,{className:`mt-2 line-clamp-2 flex-1 text-sm leading-5 text-fg-muted`,children:e.description||e.directoryId}),(0,X.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5 text-[11px] text-fg-subtle`,children:[(0,X.jsx)(`span`,{className:`rounded-md bg-surface-hover/70 px-2 py-0.5`,children:Zt(a,e.origin)}),e.writable?null:(0,X.jsx)(`span`,{className:`rounded-md bg-surface-hover/70 px-2 py-0.5`,children:a.sourceReadOnly}),e.effective?null:(0,X.jsx)(`span`,{className:`rounded-md bg-amber-500/10 px-2 py-0.5 text-amber-800 dark:text-amber-200`,children:a.shadowed}),t?(0,X.jsx)(`span`,{className:E(`rounded-md px-2 py-0.5`,t.availableForCurrentAgent?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-amber-500/10 text-amber-800 dark:text-amber-200`),children:Qt(a,t)}):null]}),(0,X.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-2`,children:[(0,X.jsxs)(D,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>void c(e.key),children:[(0,X.jsx)(b,{className:`size-3.5`,"aria-hidden":!0}),a.view]}),e.removable?(0,X.jsxs)(D,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs text-red-600`,disabled:o,onClick:()=>void l(e),children:[(0,X.jsx)(me,{className:`size-3.5`,"aria-hidden":!0}),a.remove]}):null]})]},e.key)},t[14]=s,t[15]=o,t[16]=a,t[17]=c,t[18]=l,t[19]=e):e=t[19],p=i.map(e),t[7]=s,t[8]=o,t[9]=a,t[10]=i,t[11]=c,t[12]=l,t[13]=p}else p=t[13];let m;t[20]===p?m=t[21]:(m=(0,X.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:p}),t[20]=p,t[21]=m);let h;return t[22]!==f||t[23]!==m?(h=(0,X.jsxs)(`section`,{className:`grid gap-3`,children:[f,m]}),t[22]=f,t[23]=m,t[24]=h):h=t[24],h}function Zt(e,t){switch(t){case`xopc-workspace`:return e.xopcSource;case`agents-workspace`:return e.agentsSource;case`xopc-global`:case`custom-global`:return e.globalXopcSource;case`agents-global`:return e.globalAgentsSource;case`bundled`:return e.bundledSource;case`extra`:return e.extraSource}}function Qt(e,t){if(t.availableForCurrentAgent)return e.sessionAvailable;switch(t.unavailableReason){case`agent-denied`:return e.sessionUnavailableAgent;case`disabled`:return e.sessionUnavailableDisabled;case`requirements-unmet`:return e.sessionUnavailableRequirements;case`model-invocation-disabled`:return e.sessionUnavailableModel;case`tool-gated`:return e.sessionUnavailableTools;default:return e.sessionUnavailableAgent}}function $t(e){let t=(0,Vt.c)(13),{icon:n,title:r,hint:i,onClick:a}=e,o;t[0]===n?o=t[1]:(o=(0,X.jsx)(n,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`,"aria-hidden":!0}),t[0]=n,t[1]=o);let s;t[2]===r?s=t[3]:(s=(0,X.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:r}),t[2]=r,t[3]=s);let c;t[4]===i?c=t[5]:(c=(0,X.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-fg-muted`,children:i}),t[4]=i,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,X.jsxs)(`span`,{className:`min-w-0`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;return t[9]!==a||t[10]!==o||t[11]!==l?(u=(0,X.jsx)(d,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,className:`flex w-full items-start gap-3 rounded-md px-3 py-2.5 text-left hover:bg-surface-hover`,onClick:a,children:[o,l]})}),t[9]=a,t[10]=o,t[11]=l,t[12]=u):u=t[12],u}function en(e,t){switch(t){case`active`:return e.sourceStateActive;case`missing`:return e.sourceStateMissing;case`disabled`:return e.sourceStateDisabled;case`untrusted`:return e.sourceStateUntrusted;case`invalid`:return e.sourceStateInvalid}}var tn=[`backlog`,`ready`,`active`,`review`,`closed`];function nn(e){return{backlog:e.filter(e=>e.phase===`backlog`),ready:e.filter(e=>e.phase===`ready`),active:e.filter(e=>e.phase===`active`),review:e.filter(e=>e.phase===`review`),closed:e.filter(e=>e.phase===`closed`)}}function rn(e,t){if(e.phase!==t){if(e.phase===`closed`&&t!==`closed`&&e.allowedCommands.includes(`reopen`))return`reopen_${t}`;if(t===`closed`&&e.phase===`review`&&e.allowedCommands.includes(`close`))return`complete`;if(t!==`closed`&&e.allowedCommands.includes(`move`))return`move_${t}`}}function an(e){if(e.allowedCommands.includes(`resolve_wait`))return`resume`;if(e.allowedCommands.includes(`mark_ready`))return`ready`;if(e.allowedCommands.includes(`start`))return`run`;if(e.allowedCommands.includes(`request_review`))return`review`;if(e.phase===`review`&&e.allowedCommands.includes(`close`))return`complete`;if(e.allowedCommands.includes(`reopen`))return`reopen`;if(e.allowedCommands.includes(`add_wait`))return`pause`}function on(e){let t=new Map,n=new Map;for(let r of e)t.set(r.dependencyTaskId,[...t.get(r.dependencyTaskId)??[],r.dependentTaskId]),n.set(r.dependentTaskId,[...n.get(r.dependentTaskId)??[],r.dependencyTaskId]);return{outgoing:t,incoming:n}}function sn(e,t){let n=new Set(e.map(e=>e.id)),{outgoing:r,incoming:i}=on(t.filter(e=>n.has(e.dependencyTaskId)&&n.has(e.dependentTaskId))),a=new Map(e.map(e=>[e.id,i.get(e.id)?.length??0])),o=new Map(e.map(e=>[e.id,0])),s=e.filter(e=>a.get(e.id)===0).sort((e,t)=>t.updatedAt-e.updatedAt).map(e=>e.id);for(let e=0;e<s.length;e+=1){let t=s[e];for(let e of r.get(t)??[]){o.set(e,Math.max(o.get(e)??0,(o.get(t)??0)+1));let n=(a.get(e)??1)-1;a.set(e,n),n===0&&s.push(e)}}let c=new Map;for(let t of e){let e=o.get(t.id)??0;c.set(e,[...c.get(e)??[],t.id])}let l=new Map;for(let[e,t]of c)t.forEach((t,n)=>l.set(t,{x:e*300,y:n*136}));return l}function cn(e,t){let{incoming:n}=on(t),r=new Set(e.filter(e=>e.operationalState===`blocked`).map(e=>e.id)),i=[...r];for(let e=0;e<i.length;e+=1)for(let t of n.get(i[e])??[])r.has(t)||(r.add(t),i.push(t));return r}function ln(e,t){let{incoming:n,outgoing:r}=on(t),i=new Set([e]);for(let t of[n,r]){let n=[e],r=new Set(n);for(let e=0;e<n.length;e+=1)for(let a of t.get(n[e])??[])r.has(a)||(r.add(a),i.add(a),n.push(a))}return i}var un={backlog:`border-edge`,ready:`border-edge`,active:`border-accent ring-2 ring-accent/15`,review:`border-amber-400/80`,closed:`border-emerald-400/60`};function dn(e){let t=(0,Vt.c)(25),{data:n,selected:r}=e,i=n.task,a=i.operationalState===`waiting`||i.operationalState===`blocked`,o=un[i.phase],s=r&&`ring-2 ring-accent/30`,c=n.dimmed&&`opacity-30`,l;t[0]!==o||t[1]!==s||t[2]!==c?(l=E(`group w-56 rounded-xl border bg-surface-panel p-3 shadow-surface transition-opacity`,o,s,c),t[0]=o,t[1]=s,t[2]=c,t[3]=l):l=t[3];let u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,X.jsx)(zt,{type:`target`,position:It.Left,className:`!size-3 !border-2 !border-surface-panel !bg-accent opacity-60 transition-opacity group-hover:opacity-100`}),t[4]=u):u=t[4];let d;t[5]===i.title?d=t[6]:(d=(0,X.jsx)(`strong`,{className:`line-clamp-2 min-w-0 text-sm font-medium leading-5 text-fg`,children:i.title}),t[5]=i.title,t[6]=d);let f;t[7]===a?f=t[8]:(f=a?(0,X.jsx)(B,{className:`mt-0.5 size-3.5 shrink-0 text-violet-600 dark:text-violet-300`,"aria-hidden":!0}):null,t[7]=a,t[8]=f);let p;t[9]!==d||t[10]!==f?(p=(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[d,f]}),t[9]=d,t[10]=f,t[11]=p):p=t[11];let m;t[12]===n.phaseLabel?m=t[13]:(m=(0,X.jsx)(`span`,{children:n.phaseLabel}),t[12]=n.phaseLabel,t[13]=m);let h;t[14]!==a||t[15]!==i.blockedBy?(h=a&&i.blockedBy.length>0?(0,X.jsx)(`span`,{children:i.blockedBy.length}):null,t[14]=a,t[15]=i.blockedBy,t[16]=h):h=t[16];let g;t[17]!==h||t[18]!==m?(g=(0,X.jsxs)(`div`,{className:`mt-2 flex items-center justify-between gap-2 text-[11px] text-fg-subtle`,children:[m,h]}),t[17]=h,t[18]=m,t[19]=g):g=t[19];let _;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,X.jsx)(zt,{type:`source`,position:It.Right,className:`!size-3 !border-2 !border-surface-panel !bg-accent opacity-60 transition-opacity group-hover:opacity-100`}),t[20]=_):_=t[20];let v;return t[21]!==g||t[22]!==l||t[23]!==p?(v=(0,X.jsxs)(`div`,{className:l,children:[u,p,g,_]}),t[21]=g,t[22]=l,t[23]=p,t[24]=v):v=t[24],v}var fn={taskNode:dn};function pn(e){let t=(0,Vt.c)(90),{tasks:n,dependencyEdges:r,returnTo:i,copy:a,onDependenciesChange:o}=e,[c,l]=(0,Y.useState)(!1),[u,d]=(0,Y.useState)(!1),[f,p]=(0,Y.useState)(),[m,h]=(0,Y.useState)(),g=(0,Y.useRef)(null),_;t[0]!==r||t[1]!==n?(_=cn(n,r),t[0]=r,t[1]=n,t[2]=_):_=t[2];let v=_,y;t[3]!==v||t[4]!==u||t[5]!==c||t[6]!==n?(y=u?n.filter(e=>v.has(e.id)):c?n:n.filter(Z),t[3]=v,t[4]=u,t[5]=c,t[6]=n,t[7]=y):y=t[7];let x=y,S;t[8]===x?S=t[9]:(S=new Set(x.map(bn)),t[8]=x,t[9]=S);let C=S,w;if(t[10]!==r||t[11]!==C){let e;t[13]===C?e=t[14]:(e=e=>C.has(e.dependencyTaskId)&&C.has(e.dependentTaskId),t[13]=C,t[14]=e),w=r.filter(e),t[10]=r,t[11]=C,t[12]=w}else w=t[12];let T=w,O;t[15]!==T||t[16]!==x?(O=sn(x,T),t[15]=T,t[16]=x,t[17]=O):O=t[17];let k=O,A;t[18]!==f||t[19]!==T?(A=f?ln(f,T):void 0,t[18]=f,t[19]=T,t[20]=A):A=t[20];let j=A,M;t[21]===f?M=t[22]:(M=e=>e.id===f,t[21]=f,t[22]=M);let N=x.find(M),P;t[23]===x?P=t[24]:(P=new Map(x.map(yn)),t[23]=x,t[24]=P);let F=P,I;if(t[25]!==a.phases||t[26]!==k||t[27]!==j||t[28]!==x){let e;t[30]!==a.phases||t[31]!==k||t[32]!==j?(e=e=>({id:e.id,type:`taskNode`,position:k.get(e.id)??{x:0,y:0},data:{task:e,phaseLabel:a.phases[e.phase],dimmed:!!(j&&!j.has(e.id))}}),t[30]=a.phases,t[31]=k,t[32]=j,t[33]=e):e=t[33],I=x.map(e),t[25]=a.phases,t[26]=k,t[27]=j,t[28]=x,t[29]=I}else I=t[29];let L=I,R;if(t[34]!==j||t[35]!==F||t[36]!==T){let e;t[38]!==j||t[39]!==F?(e=e=>{let t=F.get(e.dependencyTaskId),n=t?.phase===`closed`&&t.resolution===`done`,r=!!(j&&(!j.has(e.dependencyTaskId)||!j.has(e.dependentTaskId)));return{id:`${e.dependencyTaskId}:${e.dependentTaskId}`,source:e.dependencyTaskId,target:e.dependentTaskId,markerEnd:{type:Ft.ArrowClosed},style:{stroke:n?`var(--color-edge-strong)`:`var(--color-accent)`,strokeWidth:n?1.25:1.75,opacity:r?.18:1,strokeDasharray:n?`5 5`:void 0}}},t[38]=j,t[39]=F,t[40]=e):e=t[40],R=T.map(e),t[34]=j,t[35]=F,t[36]=T,t[37]=R}else R=t[37];let z=R,ee,te;t[41]!==f||t[42]!==C?(ee=()=>{f&&!C.has(f)&&p(void 0)},te=[f,C],t[41]=f,t[42]=C,t[43]=ee,t[44]=te):(ee=t[43],te=t[44]),(0,Y.useEffect)(ee,te);let B,V;t[45]!==z||t[46]!==m?(B=()=>{m&&!z.some(e=>e.id===m)&&h(void 0)},V=[z,m],t[45]=z,t[46]=m,t[47]=B,t[48]=V):(B=t[47],V=t[48]),(0,Y.useEffect)(B,V);let H;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(H=()=>{let e=window.requestAnimationFrame(()=>{g.current?.fitView({padding:.2,minZoom:.35,maxZoom:1,duration:250})});return()=>window.cancelAnimationFrame(e)},t[49]=H):H=t[49];let U;t[50]!==u||t[51]!==c||t[52]!==x.length?(U=[u,c,x.length],t[50]=u,t[51]=c,t[52]=x.length,t[53]=U):U=t[53],(0,Y.useEffect)(H,U);let ne;t[54]===f?ne=t[55]:(ne=()=>{f&&g.current?.fitView({nodes:[{id:f}],padding:1.5,minZoom:.7,maxZoom:1,duration:250})},t[54]=f,t[55]=ne);let re=ne,W;t[56]!==r||t[57]!==o?(W=e=>{if(!e.source||!e.target||e.source===e.target)return;let t=r.filter(t=>t.dependentTaskId===e.target).map(vn);t.includes(e.source)||o(e.target,[...t,e.source])},t[56]=r,t[57]=o,t[58]=W):W=t[58];let ie=W,ae;t[59]!==r||t[60]!==o||t[61]!==m?(ae=()=>{if(!m)return;let e=r.find(e=>`${e.dependencyTaskId}:${e.dependentTaskId}`===m);e&&(h(void 0),o(e.dependentTaskId,r.filter(t=>t.dependentTaskId===e.dependentTaskId&&t.dependencyTaskId!==e.dependencyTaskId).map(_n)))},t[59]=r,t[60]=o,t[61]=m,t[62]=ae):ae=t[62];let oe=ae,G;t[63]===a.connectHint?G=t[64]:(G=(0,X.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.connectHint}),t[63]=a.connectHint,t[64]=G);let K=u?`secondary`:`ghost`,se;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(se=()=>d(gn),t[65]=se):se=t[65];let ce=u?a.allTasks:a.blockedChains,q;t[66]!==u||t[67]!==K||t[68]!==ce?(q=(0,X.jsx)(D,{type:`button`,variant:K,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":u,onClick:se,children:ce}),t[66]=u,t[67]=K,t[68]=ce,t[69]=q):q=t[69];let le;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(le=()=>l(hn),t[70]=le):le=t[70];let ue=c?a.hideCompleted:a.showCompleted,de;t[71]!==u||t[72]!==c||t[73]!==ue?(de=(0,X.jsx)(D,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":c,onClick:le,disabled:u,children:ue}),t[71]=u,t[72]=c,t[73]=ue,t[74]=de):de=t[74];let fe=N?(0,X.jsxs)(D,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,onClick:re,children:[(0,X.jsx)(st,{className:`size-3.5`,"aria-hidden":!0}),a.locateTask]}):null,J;t[75]!==a.removeDependency||t[76]!==oe||t[77]!==m?(J=m?(0,X.jsx)(D,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs text-danger`,onClick:oe,children:a.removeDependency}):null,t[75]=a.removeDependency,t[76]=oe,t[77]=m,t[78]=J):J=t[78];let pe;t[79]!==q||t[80]!==de||t[81]!==fe||t[82]!==J?(pe=(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[q,de,fe,J]}),t[79]=q,t[80]=de,t[81]=fe,t[82]=J,t[83]=pe):pe=t[83];let me;t[84]!==G||t[85]!==pe?(me=(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-b border-edge bg-surface-panel px-3 py-2.5`,children:[G,pe]}),t[84]=G,t[85]=pe,t[86]=me):me=t[86];let he=x.length>0?(0,X.jsxs)(`div`,{className:E(`grid h-[min(42rem,calc(100vh-14rem))] min-h-[28rem]`,N&&`lg:grid-cols-[minmax(0,1fr)_18rem]`),children:[(0,X.jsxs)(Rt,{nodes:L,edges:z,nodeTypes:fn,nodesDraggable:!1,nodesConnectable:!0,elementsSelectable:!0,onNodeClick:(e,t)=>p(t.id),onEdgeClick:(e,t)=>h(t.id),onConnect:ie,onPaneClick:()=>{p(void 0),h(void 0)},onInit:e=>{g.current=e},fitView:!0,minZoom:.25,maxZoom:1.25,panOnScroll:!0,zoomOnDoubleClick:!1,proOptions:{hideAttribution:!0},children:[(0,X.jsx)(Bt,{color:`var(--color-edge)`,gap:22,size:1}),(0,X.jsx)(Lt,{showInteractive:!1,className:`!border-edge !bg-surface-panel !shadow-surface`})]}),N?(0,X.jsxs)(`aside`,{className:`overflow-y-auto border-t border-edge bg-surface-panel p-4 lg:border-l lg:border-t-0`,children:[(0,X.jsx)(`p`,{className:`text-xs font-medium text-accent-fg`,children:a.phases[N.phase]}),(0,X.jsx)(`h3`,{className:`mt-2 text-sm font-semibold leading-6 text-fg`,children:N.title}),N.operationalState===`blocked`&&N.blockedBy.length>0?(0,X.jsxs)(`div`,{className:`mt-4 rounded-lg bg-violet-500/8 p-3`,children:[(0,X.jsx)(`p`,{className:`text-xs font-medium text-violet-700 dark:text-violet-300`,children:a.blockedBy.replace(`{{count}}`,String(N.blockedBy.length))}),(0,X.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs leading-5 text-fg-muted`,children:N.blockedBy.map(mn)})]}):null,(0,X.jsxs)(s,{to:De(i,N.id),className:`mt-4 inline-flex items-center gap-1.5 text-xs font-medium text-accent-fg hover:underline`,children:[(0,X.jsx)(b,{className:`size-3.5`,"aria-hidden":!0}),a.openTask]})]}):null]}):(0,X.jsx)(`div`,{className:`flex min-h-72 items-center justify-center px-6 text-center text-sm text-fg-muted`,children:a.empty}),ge;return t[87]!==me||t[88]!==he?(ge=(0,X.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-base/40`,children:[me,he]}),t[87]=me,t[88]=he,t[89]=ge):ge=t[89],ge}function mn(e){return(0,X.jsx)(`li`,{children:e.title},e.id)}function hn(e){return!e}function gn(e){return!e}function _n(e){return e.dependencyTaskId}function vn(e){return e.dependencyTaskId}function yn(e){return[e.id,e]}function bn(e){return e.id}function Z(e){return e.phase!==`closed`}function xn({policy:e,copy:t,onSave:n}){let[r,i]=(0,Y.useState)(!1),[a,o]=(0,Y.useState)(e.mode),[s,c]=(0,Y.useState)(Math.round(e.confidenceThreshold*100)),[l,u]=(0,Y.useState)(!!e.quietHours),[d,p]=(0,Y.useState)(e.quietHours?.startHour??22),[h,g]=(0,Y.useState)(e.quietHours?.endHour??8),[_,v]=(0,Y.useState)(e.quietHours?.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone),[y,b]=(0,Y.useState)(e.allowedActions.includes(`create_project_task`)),[x,S]=(0,Y.useState)(!1),[C,w]=(0,Y.useState)();(0,Y.useEffect)(()=>{o(e.mode),c(Math.round(e.confidenceThreshold*100)),u(!!e.quietHours),p(e.quietHours?.startHour??22),g(e.quietHours?.endHour??8),v(e.quietHours?.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone),b(e.allowedActions.includes(`create_project_task`))},[e]);let E=async()=>{S(!0),w(void 0);try{await n({mode:a,confidenceThreshold:s/100,quietHours:l?{startHour:d,endHour:h,timezone:_}:null,allowedActions:y?[`create_project_task`]:[]}),i(!1)}catch(e){w(e instanceof Error?e.message:t.saveFailed)}finally{S(!1)}};return(0,X.jsxs)(ee,{open:r,onOpenChange:e=>{x||i(e)},children:[(0,X.jsx)(P,{asChild:!0,children:(0,X.jsxs)(D,{type:`button`,variant:`ghost`,className:`h-9 gap-2 px-2.5 text-xs`,children:[(0,X.jsx)(Pe,{className:`size-3.5`,"aria-hidden":!0}),t.modes[e.mode]]})}),(0,X.jsxs)(L,{children:[(0,X.jsx)(N,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,X.jsxs)(R,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(36rem,calc(100vh-2rem))] w-[min(34rem,calc(100vw-2rem))] -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,X.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(z,{className:`text-base font-semibold text-fg`,children:t.title}),(0,X.jsx)(F,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.description})]}),(0,X.jsx)(I,{asChild:!0,children:(0,X.jsx)(D,{type:`button`,variant:`ghost`,className:`size-9 p-0`,disabled:x,children:(0,X.jsx)(T,{className:`size-4`,"aria-hidden":!0})})})]}),(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto px-5 py-4`,children:[(0,X.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,X.jsx)(`span`,{className:`font-medium text-fg-muted`,children:t.mode}),(0,X.jsx)(f,{value:a,onChange:e=>o(e.target.value),children:Object.entries(t.modes).map(([e,t])=>(0,X.jsx)(m,{value:e,children:t},e))})]}),(0,X.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,X.jsxs)(`span`,{className:`font-medium text-fg-muted`,children:[t.confidence,` · `,s,`%`]}),(0,X.jsx)(`input`,{type:`range`,min:`50`,max:`100`,step:`5`,value:s,onChange:e=>c(Number(e.target.value)),className:`accent-accent`})]}),(0,X.jsxs)(`div`,{className:`rounded-lg border border-edge p-3`,children:[(0,X.jsxs)(`label`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:l,onChange:e=>u(e.target.checked)}),t.quietHours]}),l?(0,X.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 gap-3`,children:[(0,X.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.quietStart,(0,X.jsx)(`input`,{type:`number`,min:`0`,max:`23`,value:d,onChange:e=>p(Number(e.target.value)),className:`rounded-lg border border-edge bg-surface-base px-3 py-2 text-fg`})]}),(0,X.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.quietEnd,(0,X.jsx)(`input`,{type:`number`,min:`0`,max:`23`,value:h,onChange:e=>g(Number(e.target.value)),className:`rounded-lg border border-edge bg-surface-base px-3 py-2 text-fg`})]}),(0,X.jsxs)(`label`,{className:`col-span-2 grid gap-1 text-xs text-fg-muted`,children:[t.timezone,(0,X.jsx)(`input`,{value:_,onChange:e=>v(e.target.value),className:`rounded-lg border border-edge bg-surface-base px-3 py-2 text-fg`})]})]}):null]}),(0,X.jsxs)(`label`,{className:`flex items-start gap-3 rounded-lg border border-edge p-3`,children:[(0,X.jsx)(`input`,{type:`checkbox`,className:`mt-1`,checked:y,onChange:e=>b(e.target.checked)}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:t.allowTaskCreation}),(0,X.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.allowTaskCreationDescription})]})]})]}),(0,X.jsxs)(`div`,{className:`shrink-0 border-t border-edge px-5 py-3`,children:[C?(0,X.jsx)(`p`,{className:`mb-2 text-xs text-danger`,children:C}):null,(0,X.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,X.jsx)(I,{asChild:!0,children:(0,X.jsx)(D,{type:`button`,variant:`ghost`,disabled:x,children:t.cancel})}),(0,X.jsx)(D,{type:`button`,variant:`primary`,disabled:x||!_.trim()||d<0||d>23||h<0||h>23,onClick:()=>void E(),children:x?t.saving:t.save})]})]})]})]})]})}function Sn(e){return e instanceof Element?!!e.closest(`a,button,input,select,textarea,[contenteditable="true"],[draggable="true"],[data-board-pan-skip="true"]`):!0}var Cn={backlog:Ct,ready:Ct,active:St,review:Le,closed:_},wn={backlog:`bg-surface-hover text-fg-muted`,ready:`bg-surface-panel text-fg-muted`,active:`bg-accent-soft text-accent-fg`,review:`bg-amber-500/10 text-amber-700 dark:text-amber-300`,closed:`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`};function Tn(e){return e===`running`||e===`queued`?`border-accent/20 bg-accent-soft text-accent-fg`:e===`verifying`?`border-emerald-500/20 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`waiting`?`border-amber-500/20 bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`blocked`?`border-violet-500/20 bg-violet-500/10 text-violet-700 dark:text-violet-300`:`border-edge-subtle bg-surface-hover text-fg-muted`}function En(e){return e===`passed`?`border-emerald-500/20 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`failed`?`border-red-500/20 bg-red-500/10 text-red-700 dark:text-red-300`:`border-edge-subtle bg-surface-hover text-fg-muted`}function Q(e){let t=(0,Vt.c)(83),{task:n,returnTo:r,copy:i,busy:a,onAction:o,onDragStart:c,onDropBefore:l}=e,u,d,f,p,m,h,g,v,y,b,x,S,C,w,T,D;t[0]!==c||t[1]!==l||t[2]!==r||t[3]!==n?(m=an(n),h=m!==`review`&&n.allowedCommands.includes(`request_review`)?`review`:void 0,f=n.phase===`closed`,p=!!(n.dueAt&&n.dueAt<Date.now()&&!f),d=f?_:de,v=n.priority!==`normal`,g=v||n.operationalState!==`idle`||!!n.latestVerification||n.acceptanceCriteriaCount>0||!!n.dueAt||!!n.nextCheckAt,x=!0,t[20]!==c||t[21]!==n.id?(S=e=>{e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,n.id),c(n.id)},t[20]=c,t[21]=n.id,t[22]=S):S=t[22],t[23]===c?C=t[24]:(C=()=>c(``),t[23]=c,t[24]=C),w=On,t[25]!==l||t[26]!==n.id?(T=e=>{e.preventDefault(),e.stopPropagation(),l(n.id)},t[25]=l,t[26]=n.id,t[27]=T):T=t[27],D=`group relative min-h-max min-w-0 shrink-0 overflow-hidden rounded-xl border border-edge-subtle bg-surface-base shadow-surface transition-[border-color,box-shadow] hover:border-edge focus-within:border-accent/40`,u=s,t[28]!==r||t[29]!==n.id?(y=De(r,n.id),t[28]=r,t[29]=n.id,t[30]=y):y=t[30],b=E(`block min-w-0 p-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,h?`pr-19`:m&&`pr-11`),t[0]=c,t[1]=l,t[2]=r,t[3]=n,t[4]=u,t[5]=d,t[6]=f,t[7]=p,t[8]=m,t[9]=h,t[10]=g,t[11]=v,t[12]=y,t[13]=b,t[14]=x,t[15]=S,t[16]=C,t[17]=w,t[18]=T,t[19]=D):(u=t[4],d=t[5],f=t[6],p=t[7],m=t[8],h=t[9],g=t[10],v=t[11],y=t[12],b=t[13],x=t[14],S=t[15],C=t[16],w=t[17],T=t[18],D=t[19]);let O=f?`text-emerald-600 dark:text-emerald-400`:`text-fg-subtle`,k;t[31]===O?k=t[32]:(k=E(`mt-0.5 size-4 shrink-0`,O),t[31]=O,t[32]=k);let A;t[33]!==d||t[34]!==k?(A=(0,X.jsx)(d,{className:k,"aria-hidden":!0}),t[33]=d,t[34]=k,t[35]=A):A=t[35];let j=f?`text-fg-subtle`:`text-fg`,M;t[36]===j?M=t[37]:(M=E(`min-w-0 break-words text-sm font-semibold leading-5`,j),t[36]=j,t[37]=M);let N;t[38]!==M||t[39]!==n.title?(N=(0,X.jsx)(`h3`,{className:M,children:n.title}),t[38]=M,t[39]=n.title,t[40]=N):N=t[40];let P;t[41]!==A||t[42]!==N?(P=(0,X.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[A,N]}),t[41]=A,t[42]=N,t[43]=P):P=t[43];let F;t[44]!==i||t[45]!==n.attention||t[46]!==n.blockedBy||t[47]!==n.operationalState?(F=n.operationalState===`blocked`&&n.blockedBy.length>0?(0,X.jsxs)(`div`,{className:`ml-6.5 mt-2.5 rounded-lg bg-violet-500/8 px-2.5 py-2 text-xs text-violet-700 dark:text-violet-300`,children:[(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 font-medium`,children:[(0,X.jsx)(B,{className:`size-3.5`,"aria-hidden":!0}),i.blockedBy.replace(`{{count}}`,String(n.blockedBy.length))]}),(0,X.jsx)(`p`,{className:`mt-1 line-clamp-2 leading-5 text-fg-muted`,children:n.blockedBy.map(Dn).join(`、`)})]}):n.attention[0]?(0,X.jsxs)(`p`,{className:`ml-6.5 mt-2.5 flex items-start gap-1.5 text-xs leading-5 text-fg-muted`,children:[(0,X.jsx)(Ee,{className:`mt-0.5 size-3.5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`line-clamp-2`,children:n.attention[0].summary})]}):null,t[44]=i,t[45]=n.attention,t[46]=n.blockedBy,t[47]=n.operationalState,t[48]=F):F=t[48];let I;t[49]!==i||t[50]!==p||t[51]!==g||t[52]!==v||t[53]!==n.acceptanceCriteriaCount||t[54]!==n.dueAt||t[55]!==n.latestVerification||t[56]!==n.nextCheckAt||t[57]!==n.operationalState||t[58]!==n.priority?(I=g?(0,X.jsxs)(`div`,{className:`ml-6.5 mt-2.5 flex flex-wrap items-center gap-1.5 text-[11px]`,children:[v?(0,X.jsx)(`span`,{className:E(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,n.priority===`critical`?`border-red-500/20 bg-red-500/10 text-red-700 dark:text-red-300`:n.priority===`high`?`border-amber-500/20 bg-amber-500/10 text-amber-700 dark:text-amber-300`:`border-edge-subtle bg-surface-hover text-fg-muted`),children:i.priorityOptions[n.priority]}):null,n.operationalState===`idle`?null:(0,X.jsx)(`span`,{className:E(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,Tn(n.operationalState)),children:i.operationalStates[n.operationalState]}),n.latestVerification?(0,X.jsx)(`span`,{className:E(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,En(n.latestVerification)),children:i.verification[n.latestVerification]}):null,n.acceptanceCriteriaCount>0?(0,X.jsxs)(`span`,{className:`inline-flex min-h-6 items-center gap-1 rounded-md border border-edge-subtle bg-surface-hover px-2 text-fg-muted`,children:[(0,X.jsx)(St,{className:`size-3`,"aria-hidden":!0}),i.acceptanceCriteria.replace(`{{count}}`,String(n.acceptanceCriteriaCount))]}):null,n.dueAt?(0,X.jsxs)(`span`,{className:E(`inline-flex min-h-6 items-center gap-1 rounded-md border px-2`,p?`border-red-500/20 bg-red-500/10 text-red-700 dark:text-red-300`:`border-edge-subtle bg-surface-hover text-fg-muted`),children:[(0,X.jsx)(pt,{className:`size-3`,"aria-hidden":!0}),H(new Date(n.dueAt))]}):null,n.nextCheckAt?(0,X.jsxs)(`span`,{className:`inline-flex min-h-6 items-center gap-1 rounded-md border border-accent/20 bg-accent-soft px-2 text-accent-fg`,children:[(0,X.jsx)(pt,{className:`size-3`,"aria-hidden":!0}),H(new Date(n.nextCheckAt))]}):null]}):null,t[49]=i,t[50]=p,t[51]=g,t[52]=v,t[53]=n.acceptanceCriteriaCount,t[54]=n.dueAt,t[55]=n.latestVerification,t[56]=n.nextCheckAt,t[57]=n.operationalState,t[58]=n.priority,t[59]=I):I=t[59];let L;t[60]!==u||t[61]!==y||t[62]!==P||t[63]!==F||t[64]!==I||t[65]!==b?(L=(0,X.jsxs)(u,{to:y,className:b,children:[P,F,I]}),t[60]=u,t[61]=y,t[62]=P,t[63]=F,t[64]=I,t[65]=b,t[66]=L):L=t[66];let R;t[67]!==a||t[68]!==i||t[69]!==o||t[70]!==m||t[71]!==h||t[72]!==n?(R=m?(0,X.jsxs)(`div`,{className:`absolute right-2.5 top-2.5 z-10 flex items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100 [@media(hover:none)]:opacity-100`,children:[h?(0,X.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>o(n,h),className:`inline-flex size-7 items-center justify-center rounded-md bg-surface-hover text-fg-muted hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-wait disabled:opacity-50`,"aria-label":i.actions[h],title:i.actions[h],children:(0,X.jsx)(Le,{className:`size-3.5`,"aria-hidden":!0})}):null,(0,X.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>o(n,m),className:`inline-flex size-7 items-center justify-center rounded-md bg-accent-soft text-accent-fg hover:bg-accent-soft/80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-wait disabled:opacity-50`,"aria-label":i.actions[m],title:i.actions[m],children:(0,X.jsx)(ze,{className:`size-3.5`,"aria-hidden":!0})})]}):null,t[67]=a,t[68]=i,t[69]=o,t[70]=m,t[71]=h,t[72]=n,t[73]=R):R=t[73];let z;return t[74]!==L||t[75]!==R||t[76]!==x||t[77]!==S||t[78]!==C||t[79]!==w||t[80]!==T||t[81]!==D?(z=(0,X.jsxs)(`article`,{draggable:x,onDragStart:S,onDragEnd:C,onDragOver:w,onDrop:T,className:D,children:[L,R]}),t[74]=L,t[75]=R,t[76]=x,t[77]=S,t[78]=C,t[79]=w,t[80]=T,t[81]=D,t[82]=z):z=t[82],z}function Dn(e){return e.title}function On(e){e.preventDefault(),e.stopPropagation()}function kn({tasks:e,dependencyEdges:t,monitoring:n,returnTo:r,copy:i,onAction:a,onReorder:o,onUndoMove:s,onDependenciesChange:c,onMonitoringChange:l,onCreate:u,actionBusyId:d,ref:p}){let h=(0,Y.useRef)(null),g=(0,Y.useRef)(null),[_,v]=(0,Y.useState)(null),[y,b]=(0,Y.useState)(!1),[x,S]=(0,Y.useState)(null),[C,w]=(0,Y.useState)(`board`),[T,O]=(0,Y.useState)(!1),[j,M]=(0,Y.useState)(()=>crypto.randomUUID()),[P,te]=(0,Y.useState)(``),[B,V]=(0,Y.useState)(`normal`),[H,U]=(0,Y.useState)(``),[ne,re]=(0,Y.useState)([]),[W,ie]=(0,Y.useState)(!1),[ae,oe]=(0,Y.useState)(null),G=$e({chat:k(A(e=>e.language)).chat}),K=nn(e),se=e.filter(e=>e.phase!==`closed`),ce=(e,t)=>void a(e,t),q=async(t,n)=>{let r=e.find(e=>e.id===_);if(v(null),!r||r.id===n)return;let i=K[r.phase],s=i.findIndex(e=>e.id===r.id),c=s>=0?i[s+1]?.id??null:null;if(r.phase===t&&c===n)return;let l=rn(r,t);r.phase!==t&&!l||l&&!await a(r,l)||await o(r.id,n)&&S({taskId:r.id,phase:r.phase,beforeTaskId:c})},le=async e=>{e.preventDefault();let t=P.trim();if(!(!t||W)){ie(!0),oe(null);try{let e=H?new Date(`${H}T23:59:59.999`).getTime():void 0;await u({requestId:j,objective:t,priority:B,dependsOnTaskIds:ne,attachments:G.wireAttachmentsPayload(),...e===void 0?{}:{dueAt:e}}),te(``),V(`normal`),U(``),re([]),G.clearAttachments(),M(crypto.randomUUID()),O(!1)}catch(e){oe(e instanceof Error?e.message:i.createFailed)}finally{ie(!1)}}},ue=()=>{M(crypto.randomUUID()),te(``),V(`normal`),U(``),re([]),G.clearAttachments(),oe(null),O(!0)};(0,Y.useImperativeHandle)(p,()=>({openCreate:ue})),(0,Y.useEffect)(()=>{if(!x)return;let e=window.setTimeout(()=>S(null),6e3);return()=>window.clearTimeout(e)},[x]);let de=(0,Y.useCallback)(e=>{let t=g.current;!t||t.pointerId!==e.pointerId||(g.current=null,b(!1),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},[]),fe=(0,Y.useCallback)(e=>{if(e.button!==0||Sn(e.target))return;let t=h.current;t&&(g.current={pointerId:e.pointerId,startX:e.clientX,scrollLeft:t.scrollLeft,active:!1},e.currentTarget.setPointerCapture(e.pointerId))},[]),J=(0,Y.useCallback)(e=>{let t=g.current,n=h.current;if(!t||!n||t.pointerId!==e.pointerId)return;let r=e.clientX-t.startX;!t.active&&Math.abs(r)<5||(t.active||(t.active=!0,b(!0)),e.preventDefault(),n.scrollLeft=t.scrollLeft-r)},[]);return(0,X.jsxs)(`section`,{id:`project-panel-board`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-board`,className:`flex h-full min-h-0 flex-col overflow-hidden`,children:[(0,X.jsxs)(`div`,{className:`mb-4 flex shrink-0 flex-wrap items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:i.title}),(0,X.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:i.description})]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,X.jsx)(xn,{policy:n,copy:i.monitoring,onSave:l}),(0,X.jsxs)(`div`,{className:`flex rounded-lg border border-edge bg-surface-panel p-0.5`,children:[(0,X.jsxs)(`button`,{type:`button`,"aria-pressed":C===`board`,onClick:()=>w(`board`),className:E(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium`,C===`board`?`bg-surface-hover text-fg`:`text-fg-muted hover:text-fg`),children:[(0,X.jsx)(ke,{className:`size-3.5`,"aria-hidden":!0}),i.views.board]}),(0,X.jsxs)(`button`,{type:`button`,"aria-pressed":C===`graph`,onClick:()=>w(`graph`),className:E(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium`,C===`graph`?`bg-surface-hover text-fg`:`text-fg-muted hover:text-fg`),children:[(0,X.jsx)(ut,{className:`size-3.5`,"aria-hidden":!0}),i.views.graph]})]})]})]}),C===`board`?(0,X.jsx)(`div`,{ref:h,className:E(`min-h-0 w-full min-w-0 flex-1 overflow-x-auto overflow-y-hidden overscroll-x-contain pb-2 [scrollbar-width:thin]`,y?`cursor-grabbing select-none`:`cursor-grab`),onPointerDown:fe,onPointerMove:J,onPointerUp:de,onPointerCancel:de,onLostPointerCapture:e=>{g.current?.pointerId===e.pointerId&&(g.current=null,b(!1))},children:(0,X.jsx)(`div`,{className:`grid h-full min-h-0 min-w-[103rem] grid-cols-5 gap-3`,children:tn.map(t=>{let n=Cn[t],a=K[t];return(0,X.jsxs)(`section`,{onDragOver:n=>{let r=e.find(e=>e.id===_);r&&(r.phase===t||rn(r,t))&&n.preventDefault()},onDrop:e=>{e.preventDefault(),q(t,null)},className:`flex min-h-0 min-w-0 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-muted/70 p-2.5`,children:[(0,X.jsxs)(`header`,{className:`mb-2.5 flex shrink-0 items-center gap-2 px-0.5`,children:[(0,X.jsxs)(`div`,{className:E(`flex items-center gap-1.5 rounded-md px-2 py-1`,wn[t]),children:[(0,X.jsx)(n,{className:`size-3.5`,"aria-hidden":!0}),(0,X.jsx)(`h3`,{className:`text-sm font-semibold`,children:i.phases[t]})]}),(0,X.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:a.length})]}),(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-y-contain pr-1 [scrollbar-gutter:stable] [scrollbar-width:thin]`,children:(0,X.jsx)(`div`,{className:`flex flex-col gap-2`,children:a.map(e=>(0,X.jsx)(Q,{task:e,returnTo:r,copy:i,busy:d===e.id,onAction:ce,onDragStart:v,onDropBefore:e=>void q(t,e)},e.id))})})]},t)})})}):(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,X.jsx)(pn,{tasks:e,dependencyEdges:t,returnTo:r,copy:{...i.graph,phases:i.phases},onDependenciesChange:c})}),(0,X.jsx)(ee,{open:T,onOpenChange:e=>{W||O(e)},children:(0,X.jsxs)(L,{children:[(0,X.jsx)(N,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,X.jsxs)(R,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(40rem,calc(100vh-2rem))] w-[min(38rem,calc(100vw-2rem))] -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,X.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,X.jsx)(z,{className:`text-base font-semibold text-fg`,children:i.createTitle}),(0,X.jsx)(F,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:i.createDescription})]}),(0,X.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:e=>void le(e),children:[(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,X.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,X.jsx)(`label`,{htmlFor:`project-task-objective`,className:`font-medium text-fg-muted`,children:i.objective}),(0,X.jsxs)(`div`,{className:E(`overflow-hidden rounded-lg border border-edge bg-surface-base transition-colors focus-within:border-accent`,G.isDragging&&`border-accent bg-accent-soft/30`),onDragOver:e=>{e.preventDefault(),W||G.setIsDragging(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||G.setIsDragging(!1)},onDrop:e=>{e.preventDefault(),G.setIsDragging(!1),W||G.processFiles(Array.from(e.dataTransfer.files))},children:[(0,X.jsx)(`textarea`,{id:`project-task-objective`,autoFocus:!0,className:`min-h-28 w-full resize-y bg-transparent px-3 py-3 text-sm leading-6 text-fg outline-none placeholder:text-fg-subtle`,value:P,onChange:e=>{te(e.target.value),oe(null)},placeholder:i.objectivePlaceholder,maxLength:12e3,disabled:W}),(0,X.jsx)(Xe,{attachments:G.attachments,topPadded:!1,onRemove:e=>{W||G.removeAttachment(e)}}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-t border-edge-subtle px-2.5 py-2`,children:[(0,X.jsxs)(D,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:W,onClick:()=>G.fileInputRef.current?.click(),children:[(0,X.jsx)(Fe,{className:`size-3.5`,"aria-hidden":!0}),i.addFiles]}),(0,X.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:i.attachmentsDescription}),(0,X.jsx)(`input`,{ref:G.fileInputRef,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{G.processFiles(Array.from(e.target.files??[])),e.currentTarget.value=``}})]})]})]}),(0,X.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,X.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,X.jsx)(`span`,{className:`font-medium text-fg-muted`,children:i.priority}),(0,X.jsx)(f,{value:B,onChange:e=>V(e.target.value),disabled:W,children:[`low`,`normal`,`high`,`critical`].map(e=>(0,X.jsx)(m,{value:e,children:i.priorityOptions[e]},e))})]}),(0,X.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,X.jsxs)(`span`,{className:`font-medium text-fg-muted`,children:[i.dueDate,` `,(0,X.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:i.optional})]}),(0,X.jsx)(kt,{className:`min-h-10 bg-surface-base`,value:H,onChange:U,disabled:W,ariaLabel:i.dueDate})]})]}),(0,X.jsxs)(`fieldset`,{className:`grid gap-2`,children:[(0,X.jsxs)(`legend`,{className:`text-sm font-medium text-fg-muted`,children:[i.dependencies,` `,(0,X.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:i.optional})]}),(0,X.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:i.dependenciesDescription}),(0,X.jsx)(Pt,{candidates:se,selectedIds:ne,disabled:W,onChange:re,labels:{link:i.linkDependencies,linked:i.linkedDependencies,searchPlaceholder:i.dependencySearchPlaceholder,noMatches:i.noDependencyMatches,noCandidates:i.noDependencyCandidates,remove:i.removeDependency}})]}),ae?(0,X.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:ae}):null]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,X.jsx)(I,{asChild:!0,children:(0,X.jsx)(D,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:W,children:i.cancel})}),(0,X.jsx)(D,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:W||!P.trim(),children:W?i.creating:i.create})]})]})]})]})}),x?(0,X.jsxs)(`div`,{role:`status`,className:`fixed bottom-5 left-1/2 z-50 flex -translate-x-1/2 items-center gap-4 rounded-lg border border-edge bg-surface-panel px-4 py-3 text-sm text-fg shadow-float`,children:[(0,X.jsx)(`span`,{children:i.moved}),(0,X.jsx)(`button`,{type:`button`,className:`font-medium text-accent-fg hover:underline`,onClick:()=>{let e=x;S(null),s(e.taskId,e.phase,e.beforeTaskId).then(t=>{t||S(e)})},children:i.undo})]}):null]})}var An=new Set([{id:`overview`,icon:ae},{id:`tasks`,icon:yt},{id:`automations`,icon:Ke},{id:`files`,icon:Re},{id:`notes`,icon:Qe},{id:`skills`,icon:K},{id:`sessions`,icon:W},{id:`progress`,icon:Ue},{id:`settings`,icon:Me}].map(e=>e.id)),jn=`xopc.projectFiles.panelWidthPx`,Mn=320,Nn=220,Pn=560;function Fn(e,t){return e.name!==t.name||e.description!==(t.description??``)||e.status!==t.status||e.defaultAgentId!==(t.defaultAgentId??``)||e.brief!==(t.brief??``)||e.instructions!==(t.instructions??``)}function In(e){return Math.min(Pn,Math.max(Nn,Math.round(e)))}function Ln(){try{let e=window.localStorage.getItem(jn);if(e==null)return Mn;let t=Number.parseInt(e,10);return Number.isFinite(t)?In(t):Mn}catch{return Mn}}function Rn(e){try{window.localStorage.setItem(jn,String(In(e)))}catch{}}function zn(e){return!!(e&&An.has(e))}function Bn(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function Vn(e,t=``){if(!e)return t;let n=new Date(e);return Number.isNaN(n.getTime())?String(e):H(n)}function Hn(e){return e===`active`?`bg-accent-soft text-accent-fg`:e===`done`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`paused`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`archived`?`bg-surface-muted text-fg-subtle`:`bg-surface-hover text-fg-muted`}function Un(e){let t=(0,Vt.c)(8),{label:n,hint:r,children:i}=e,a;t[0]===n?a=t[1]:(a=(0,X.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=r?(0,X.jsx)(`span`,{className:`text-xs leading-5 text-fg-subtle`,children:r}):null,t[2]=r,t[3]=o);let s;return t[4]!==i||t[5]!==a||t[6]!==o?(s=(0,X.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[a,i,o]}),t[4]=i,t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function Wn(e=!1){return E(`w-full rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,e?`min-h-24 py-2 leading-5`:`min-h-10`)}function Gn(e){let t=(0,Vt.c)(10),{label:n,value:r,mono:i}=e,a=i===void 0?!1:i,o;t[0]===n?o=t[1]:(o=(0,X.jsx)(`div`,{className:`text-xs font-medium text-fg-subtle`,children:n}),t[0]=n,t[1]=o);let s=a&&`font-mono text-xs`,c;t[2]===s?c=t[3]:(c=E(`mt-1 min-w-0 truncate text-sm text-fg`,s),t[2]=s,t[3]=c);let l;t[4]!==c||t[5]!==r?(l=(0,X.jsx)(`div`,{className:c,title:r,children:r}),t[4]=c,t[5]=r,t[6]=l):l=t[6];let u;return t[7]!==o||t[8]!==l?(u=(0,X.jsxs)(`div`,{className:`min-w-0 rounded-md bg-surface-base px-3 py-2`,children:[o,l]}),t[7]=o,t[8]=l,t[9]=u):u=t[9],u}function Kn(e){return[e.name,e.slug,e.workspaceRoot,e.description,e.brief].filter(Boolean).join(` `).toLowerCase()}function $(e){let t=e.lastActiveAt??e.updatedAt??e.createdAt,n=t?new Date(t).getTime():0;return Number.isFinite(n)?n:0}function qn(e){return e.trim().replace(/[\\/]+$/,``).split(/[\\/]/).filter(Boolean).pop()??``}function Jn(e){let t=e?.body;return t?.code===`workspace_root_missing`&&t.workspaceRoot?t.workspaceRoot:null}function Yn(e){let t=e.actor;return t.name?t.name:t.agentId?t.agentId:t.id?t.id:t.sessionKey?t.sessionKey:t.kind}function Xn(e){return e.primaryObject.title?.trim()||e.primaryObject.id}function Zn(e){let t=e.source;return t.toolCallId?`${t.kind} · ${t.toolCallId}`:t.runId?`${t.kind} · ${t.runId}`:t.requestId?`${t.kind} · ${t.requestId}`:t.kind}function Qn(e){let t=e.sourceChannel?.trim();if(t)return $n(t);let n=e.key.split(`:`).filter(Boolean),r=(n[0]?.toLowerCase()===`agent`?n.slice(2).join(`:`):e.key).split(`:`)[0]?.split(/[-_]/)[0]?.trim();return $n(r||``)}function $n(e){let t=e.trim().toLowerCase();return t?t===`tui`?`TUI`:t===`acp`?`ACP`:t===`webchat`?`Webchat`:t:``}function er(e){let t=e.payload.changes;if(Array.isArray(t)&&t.length)return t.filter(e=>typeof e==`string`).join(`, `);let n=e.payload.contentPreview;if(typeof n==`string`&&n.trim())return n.trim();let r=e.payload.title??e.payload.name;return typeof r==`string`&&r.trim()?r.trim():``}function tr(e){return e.map(e=>({name:e.name,path:e.path,absolutePath:e.absolutePath,isDirectory:e.type===`directory`,children:e.type===`directory`?[]:void 0}))}function nr(e,t,n){return e.map(e=>e.path===t?{...e,children:n}:e.isDirectory&&e.children?.length?{...e,children:nr(e.children,t,n)}:e)}function rr({currentProject:e,pm:t,projectsText:n,wd:r}){let i=a(),[o,s]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)([e]),[m,h]=(0,Y.useState)(``),[_,v]=(0,Y.useState)(!1),[y,b]=(0,Y.useState)(null),[x,S]=(0,Y.useState)(!1),[T,O]=(0,Y.useState)(`new`),[k,A]=(0,Y.useState)(``),[j,M]=(0,Y.useState)(``),[P,te]=(0,Y.useState)(!1),[B,V]=(0,Y.useState)(null),[H,U]=(0,Y.useState)(null),ne=(0,Y.useCallback)(async()=>{v(!0),b(null);try{let t=await q({limit:100});f(n=>{let r=new Map;r.set(e.id,e);for(let e of n)r.set(e.id,e);for(let e of t.items)r.set(e.id,e);return Array.from(r.values())})}catch(e){b(e instanceof Error?e.message:String(e))}finally{v(!1)}},[e]);(0,Y.useEffect)(()=>{f(t=>[e,...t.filter(t=>t.id!==e.id)])},[e]),(0,Y.useEffect)(()=>{o&&ne()},[ne,o]);let re=(0,Y.useMemo)(()=>{let t=m.trim().toLowerCase().split(/\s+/).filter(Boolean);return d.filter(t=>t.id!==e.id).filter(e=>{if(t.length===0)return!0;let n=Kn(e);return t.every(e=>n.includes(e))}).sort((e,t)=>$(t)-$(e))},[e.id,d,m]),W=e=>t.statuses[e.status]??e.status,ie=e=>e.workspaceRoot||e.effectiveWorkspaceRoot||e.description||e.brief||t.common.defaultWorkspace,ae=e=>{O(e),A(``),M(``),V(null),S(!0),s(!1)},G=(0,Y.useCallback)(async(e={})=>{let t=j.trim(),n=k.trim()||(T===`directory`?qn(t):``);if(n){te(!0),V(null),U(null);try{let r=await J({name:n,...t?{workspaceRoot:t}:{},...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});S(!1),A(``),M(``),f(e=>[r,...e.filter(e=>e.id!==r.id)]),i(`/projects/${encodeURIComponent(r.id)}`)}catch(e){let t=Jn(e);t?(U(t),S(!1)):V(e instanceof Error?e.message:String(e))}finally{te(!1)}}},[T,k,i,j]),K=(0,Y.useCallback)(e=>{e.preventDefault(),G()},[G]),se=(0,Y.useCallback)(()=>{G({createWorkspaceRoot:!0})},[G]),ce=(0,Y.useCallback)(()=>{U(null),S(!0)},[]),le=e=>{M(e),T===`directory`&&!k.trim()&&A(qn(e))},ue=(e,t)=>(0,X.jsxs)(`button`,{type:`button`,className:E(`grid w-full grid-cols-[1rem_minmax(0,1fr)_auto] items-center gap-2 rounded-md p-2 text-left hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,t&&`bg-accent-soft/55 hover:bg-accent-soft/70`),onClick:()=>{s(!1),t||i(`/projects/${encodeURIComponent(e.id)}`)},children:[(0,X.jsx)(c,{className:E(`size-4 text-accent-fg`,!t&&`invisible`),"aria-hidden":!0}),(0,X.jsxs)(`span`,{className:`min-w-0`,children:[(0,X.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.name}),(0,X.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:ie(e)})]}),(0,X.jsx)(`span`,{className:E(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,Hn(e.status)),children:W(e)})]},e.id);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(u,{open:o,onOpenChange:s,children:[(0,X.jsx)(p,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,className:`group flex max-w-full min-w-0 items-center gap-2 rounded-lg px-2 py-1 text-left hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":t.projectSwitcher.switchProject,title:t.projectSwitcher.switchProject,children:[(0,X.jsxs)(`span`,{className:`min-w-0`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:e.name}),(0,X.jsx)(`span`,{className:E(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,Hn(e.status)),children:W(e)})]}),(0,X.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:ie(e)})]}),(0,X.jsx)(oe,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-data-[state=open]:rotate-180`,"aria-hidden":!0})]})}),(0,X.jsx)(l,{children:(0,X.jsxs)(g,{side:`bottom`,align:`start`,sideOffset:6,className:`z-[70] w-[min(26rem,calc(100vw-2rem))] overflow-hidden rounded-xl border border-edge bg-surface-panel p-1.5 shadow-popover outline-none`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,X.jsxs)(`label`,{className:`relative block`,children:[(0,X.jsx)(w,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,X.jsx)(`input`,{type:`search`,className:`h-9 w-full rounded-lg border border-edge bg-surface-base pl-9 pr-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:m,onChange:e=>h(e.target.value),placeholder:t.projectSwitcher.searchPlaceholder,"aria-label":t.projectSwitcher.searchPlaceholder})]}),(0,X.jsxs)(`div`,{className:`mt-1 max-h-[min(54vh,24rem)] overflow-y-auto pr-0.5 [scrollbar-gutter:stable]`,children:[(0,X.jsx)(`div`,{className:`px-2 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.current}),ue(e,!0),(0,X.jsx)(`div`,{className:`px-2 pb-1 pt-3 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.recent}),y?(0,X.jsx)(`div`,{className:`p-2 text-xs text-red-600 dark:text-red-400`,children:y}):null,_&&re.length===0?(0,X.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.loading}):null,!_&&re.length===0?(0,X.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.noMatches}):null,re.map(e=>ue(e,!1))]}),(0,X.jsxs)(`div`,{className:`mt-1 border-t border-edge-subtle pt-1`,children:[(0,X.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>ae(`new`),children:[(0,X.jsx)(C,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.newProject})]}),(0,X.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>ae(`directory`),children:[(0,X.jsx)(Re,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.openDirectory})]}),(0,X.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>{s(!1),i(`/projects`)},children:[(0,X.jsx)(Me,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.manageProjects})]})]})]})})]}),(0,X.jsx)(ee,{open:x,onOpenChange:e=>!P&&S(e),children:(0,X.jsxs)(L,{children:[(0,X.jsx)(N,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,X.jsxs)(R,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(32rem,calc(100vh-2rem))] w-[min(40rem,calc(100vw-2rem))] -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,X.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,X.jsx)(z,{className:`text-base font-semibold text-fg`,children:T===`directory`?t.projectSwitcher.createFromDirectoryTitle:n.createTitle}),(0,X.jsx)(F,{className:`mt-1 text-sm text-fg-muted`,children:T===`directory`?t.projectSwitcher.createFromDirectoryDescription:n.createDescription})]}),(0,X.jsxs)(`form`,{onSubmit:K,className:`flex min-h-0 flex-1 flex-col`,children:[(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[B?(0,X.jsx)(`div`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:B}):null,(0,X.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,X.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.projectName}),(0,X.jsx)(`input`,{className:`min-h-10 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:k,onChange:e=>A(e.target.value),placeholder:`xopc`})]}),(0,X.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,X.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.workspaceRoot}),(0,X.jsx)(Ot,{value:j,onChange:le,disabled:P,wd:r,placeholder:n.workspacePlaceholder,inputClassName:`min-h-10 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`}),(0,X.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.workspaceHint})]})]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,X.jsx)(I,{asChild:!0,children:(0,X.jsx)(D,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:P,children:n.cancel})}),(0,X.jsxs)(D,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:P||!(k.trim()||T===`directory`&&qn(j)),children:[(0,X.jsx)(C,{className:`size-4`,"aria-hidden":!0}),n.create]})]})]})]})]})}),(0,X.jsx)(ee,{open:!!H,onOpenChange:e=>{e||U(null)},children:(0,X.jsxs)(L,{children:[(0,X.jsx)(N,{className:`fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,X.jsxs)(R,{className:`fixed left-1/2 top-1/2 z-[110] flex w-[min(30rem,calc(100vw-2rem))] -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,X.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,X.jsx)(z,{className:`text-base font-semibold text-fg`,children:n.workspaceMissingTitle}),(0,X.jsx)(F,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:H?Bn(n.workspaceMissingDescription,{workspace:H}):null})]}),H?(0,X.jsx)(`div`,{className:`px-5 py-4`,children:(0,X.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,X.jsx)(Re,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:H})]})}):null,(0,X.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,X.jsx)(D,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:ce,disabled:P,children:n.workspaceMissingBack}),(0,X.jsxs)(D,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:se,disabled:P,children:[(0,X.jsx)(rt,{className:`size-4`,"aria-hidden":!0}),n.workspaceMissingCreate]})]})]})]})})]})}function ir(){let{projectId:e=``,tabId:t,noteId:n}=i(),r=a(),[c]=o(),l=A(e=>e.language),u=k(l),d=u.chat.workingDirectory,p=u.projectDetailPage,h=u.projectsPage,g=Ie(e=>e.setPageHeader),_=Ie(e=>e.clearPageHeader),[y,b]=(0,Y.useState)(null),[j,M]=(0,Y.useState)(null),[P,B]=(0,Y.useState)([]),[H,ne]=(0,Y.useState)(``),[oe,q]=(0,Y.useState)([]),[ue,de]=(0,Y.useState)(0),[J,ge]=(0,Y.useState)(!1),[Se,ke]=(0,Y.useState)(!1),[je,Pe]=(0,Y.useState)(!1),[Fe,Le]=(0,Y.useState)([]),ze=(0,Y.useRef)(new Set),[Xe,$e]=(0,Y.useState)(null),[st,pt]=(0,Y.useState)(Ln),[mt,bt]=(0,Y.useState)(!1),[St,Ct]=(0,Y.useState)(!1),[kt,jt]=(0,Y.useState)(``),[Mt,Nt]=(0,Y.useState)([]),[Pt,Ft]=(0,Y.useState)(!1),[It,Lt]=(0,Y.useState)(null),[Rt,zt]=(0,Y.useState)(!1),[Bt,Vt]=(0,Y.useState)(null),[Ht,Ut]=(0,Y.useState)([]),[Wt,Gt]=(0,Y.useState)(``),[Kt,qt]=(0,Y.useState)(!0),[Jt,Xt]=(0,Y.useState)(!1),[Zt,Qt]=(0,Y.useState)(!1),[$t,en]=(0,Y.useState)(null),[tn,nn]=(0,Y.useState)(!1),[rn,an]=(0,Y.useState)(`fixed`),[on,sn]=(0,Y.useState)(``),[cn,ln]=(0,Y.useState)(null),[un,dn]=(0,Y.useState)(!1),[fn,pn]=(0,Y.useState)(!1),[mn,hn]=(0,Y.useState)(!1),[gn,_n]=(0,Y.useState)(null),vn=(0,Y.useRef)(null),yn=(0,Y.useRef)(!1),[bn,Z]=(0,Y.useState)(null),[xn,Sn]=(0,Y.useState)({title:``,reason:``}),[Cn,wn]=(0,Y.useState)({name:``,description:``,status:`active`,defaultAgentId:``,workspaceRoot:``,brief:``,instructions:``}),Tn=(0,Y.useRef)(Cn),En=`overview`,Q=n?`notes`:zn(t)?t:En,Dn=(0,Y.useMemo)(()=>x(c.get(`returnTo`),`/projects`,[`/chat`]),[c]),On=(0,Y.useCallback)(t=>{if(!e)return`/projects`;let n=`/projects/${encodeURIComponent(e)}/${t}`;return Dn===`/projects`?n:S(n,Dn)},[Dn,e]),An=(0,Y.useCallback)(t=>{e&&r(On(t))},[r,e,On]),jn=(0,Y.useCallback)(()=>{if(Q===`tasks`&&vn.current){vn.current.openCreate();return}yn.current=!0,An(`tasks`)},[An,Q]);(0,Y.useEffect)(()=>{Q!==`tasks`||!yn.current||(yn.current=!1,vn.current?.openCreate())},[Q]);let Mn=(0,Y.useCallback)(t=>{e&&r(On(t),{replace:!0})},[r,e,On]),Nn=(0,Y.useCallback)((e,t)=>{Mn(e),r(t)},[r,Mn]),Pn=(0,Y.useCallback)(e=>t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||Mn(e)},[Mn]),Kn=(0,Y.useCallback)(e=>e.startsWith(`/chat/`)?`sessions`:e.startsWith(`/notes`)?`notes`:Q,[Q]);(0,Y.useEffect)(()=>{!e||!t||zn(t)||r(On(En),{replace:!0})},[En,r,e,On,t]),(0,Y.useEffect)(()=>{if(!e)return;let t=!1;return qt(!0),Z(null),Promise.all([le(e),ie(e),se(e),Ye().catch(()=>null)]).then(([e,n,r,i])=>{if(t)return;b(e),M(n),B(r),Ut(i?.agents??[]),Gt(e.defaultAgentId??``);let a={name:e.name,description:e.description??``,status:e.status,defaultAgentId:e.defaultAgentId??``,workspaceRoot:e.workspaceRoot??``,brief:e.brief??``,instructions:e.instructions??``};Tn.current=a,wn(a)}).catch(e=>{t||Z(e instanceof Error?e.message:String(e))}).finally(()=>{t||qt(!1)}),()=>{t=!0}},[e]);let $=(0,Y.useCallback)(async()=>{e&&M(await ie(e))},[e]);(0,Y.useEffect)(()=>{let t,n=n=>{let r=vt.safeParse(n.detail);!r.success||r.data.projectId!==e||(window.clearTimeout(t),t=window.setTimeout(()=>void $(),120))},r=n=>{let r=Ve.safeParse(n.detail);!r.success||r.data.projectId!==e||(window.clearTimeout(t),t=window.setTimeout(()=>void $(),120))};return window.addEventListener(`task-changed-v2`,n),window.addEventListener(`task-deleted-v1`,r),()=>{window.clearTimeout(t),window.removeEventListener(`task-changed-v2`,n),window.removeEventListener(`task-deleted-v1`,r)}},[e,$]);let qn=(0,Y.useCallback)(async(e,t)=>{_n(e.id),Z(null);try{let n=await be(e.id),r=t.startsWith(`move_`)?{type:`move`,phase:t.slice(5)}:t.startsWith(`reopen_`)?{type:`reopen`,phase:t.slice(7)}:t===`ready`?{type:`mark_ready`}:t===`run`?{type:`start`,executor:{kind:`agent`,agentId:n.task.delegateAgentId??(await we(e.id)).agentId}}:t===`pause`?{type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}:t===`review`?{type:`request_review`}:t===`complete`?{type:`close`,resolution:`done`}:t===`reopen`?{type:`reopen`,phase:`ready`}:{type:`resolve_wait`,waitId:n.waits[0]?.id??``};if(r.type===`resolve_wait`&&!r.waitId)throw Error(`No active wait to resolve`);return await ce(e.id,r,n.task.version),await $(),!0}catch(e){return await $().catch(()=>void 0),Z(e instanceof Error?e.message:p.board.actionFailed),!1}finally{_n(null)}},[j,p.board.actionFailed,$]),$n=(0,Y.useCallback)(async t=>{e&&(Z(null),await ve({idempotencyKey:t.requestId,title:t.objective,projectId:e,priority:t.priority,dueAt:t.dueAt,locale:l,contract:{objective:t.objective,expectedOutputs:[],acceptanceCriteria:[],constraints:[],approvalRequired:[],assumptions:[],risks:[],acceptancePolicy:`manual`,outputDestinations:[]},dependencies:t.dependsOnTaskIds,context:t.attachments.map((e,t)=>({targetKind:`file`,targetId:e.uri??e.name??`attachment-${t+1}`,role:`input`,title:e.name,pinned:!0,retrievalPolicy:{},metadata:{mimeType:e.mimeType,size:e.size,data:e.data}})),authorityGrants:[],activation:{mode:`capture`,phase:`backlog`}}),await $())},[l,e,$]),ir=(0,Y.useCallback)(async(e,t)=>{_n(e),Z(null);try{return await Ne(e,t,(await be(e)).task.version),await $(),!0}catch(e){return await $().catch(()=>void 0),Z(e instanceof Error?e.message:p.board.actionFailed),!1}finally{_n(null)}},[p.board.actionFailed,$]),ar=(0,Y.useCallback)(async(e,t,n)=>{_n(e),Z(null);try{let r=await be(e);return r.task.phase!==t&&(r=await ce(e,r.task.phase===`closed`?{type:`reopen`,phase:t===`closed`?`ready`:t}:t===`closed`?{type:`close`,resolution:`done`}:{type:`move`,phase:t},r.task.version)),await Ne(e,n,r.task.version),await $(),!0}catch(e){return await $().catch(()=>void 0),Z(e instanceof Error?e.message:p.board.actionFailed),!1}finally{_n(null)}},[p.board.actionFailed,$]),or=(0,Y.useCallback)(async(e,t)=>{_n(e),Z(null);try{await _e(e,t,(await be(e)).task.version),await $()}catch(e){await $().catch(()=>void 0),Z(e instanceof Error?e.message:p.board.actionFailed)}finally{_n(null)}},[p.board.actionFailed,$]),sr=(0,Y.useCallback)(async t=>{if(e){Z(null);try{await Oe(e,t),await $()}catch(e){throw Z(e instanceof Error?e.message:p.board.actionFailed),e}}},[p.board.actionFailed,e,$]),cr=(0,Y.useCallback)(async()=>{if(y){ge(!0),Z(null);try{let e=await fe(y.id,{includeRelated:Se,limit:100});q(e.items),de(e.total)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{ge(!1)}}},[y,Se]);(0,Y.useEffect)(()=>{Q===`progress`&&cr()},[cr,Q]);let lr=(0,Y.useCallback)(async()=>{if(!y?.effectiveWorkspaceRoot?.trim()){Le([]),ze.current.clear(),Vt(null);return}zt(!0),Vt(null),ze.current.clear();try{Le(tr((await he(y.id,``)).entries)),ze.current.add(``)}catch(e){Le([]),ze.current.clear(),Vt(e instanceof Error?e.message:String(e))}finally{zt(!1)}},[y]),ur=(0,Y.useCallback)(async e=>{if(!(!y?.effectiveWorkspaceRoot?.trim()||ze.current.has(e))){ze.current.add(e),Vt(null);try{let t=await he(y.id,e);Le(n=>nr(n,e,tr(t.entries)))}catch(t){ze.current.delete(e),Vt(t instanceof Error?t.message:String(t))}}},[y]);(0,Y.useEffect)(()=>{Q===`files`&&lr()},[lr,Q]);let dr=kt.trim();(0,Y.useEffect)(()=>{if(Q!==`files`||!y||!St||!dr){Nt([]),Ft(!1),Lt(null);return}let e=!1;Ft(!0),Lt(null),Nt([]);let t=window.setTimeout(()=>{Te(y.id,dr,50).then(t=>{e||Nt(t)}).catch(t=>{e||Lt(t instanceof Error?t.message:String(t))}).finally(()=>{e||Ft(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[dr,y,St,Q]);let fr=(0,Y.useCallback)(async()=>{if(y){pn(!0),Z(null);try{let e=await V(y.id);Nn(`sessions`,`/chat/${encodeURIComponent(e.key)}`)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{pn(!1)}}},[Nn,y]),pr=(0,Y.useCallback)(async()=>{if(!y)return;let[e,t]=await Promise.all([le(y.id),ie(y.id)]);M(t),b(e)},[y]),mr=(0,Y.useCallback)(async e=>{if(e.preventDefault(),!(!y||!xn.title.trim())){hn(!0),Z(null);try{await tt(y.id,{title:xn.title.trim(),reason:xn.reason.trim()||void 0}),Sn({title:``,reason:``}),await pr()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{hn(!1)}}},[xn.reason,xn.title,y,pr]),hr=(0,Y.useMemo)(()=>(0,X.jsx)(s,{to:Dn,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":Dn===`/projects`?p.backToProjects:u.sidebar.back,children:(0,X.jsx)(at,{className:`size-4`,"aria-hidden":!0})}),[Dn,u.sidebar.back,p.backToProjects]),gr=(0,Y.useMemo)(()=>y?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(D,{asChild:!0,variant:`secondary`,className:`h-9 rounded-lg`,children:(0,X.jsxs)(s,{to:`/workflows?tab=library&projectId=${encodeURIComponent(y.id)}`,children:[(0,X.jsx)(ut,{className:`size-4`,"aria-hidden":!0}),p.common.runWorkflow]})}),(0,X.jsxs)(D,{variant:`secondary`,className:`h-9 rounded-lg`,onClick:jn,children:[(0,X.jsx)(C,{className:`size-4`,"aria-hidden":!0}),p.board.create]}),(0,X.jsxs)(D,{variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>void fr(),disabled:fn,children:[(0,X.jsx)(W,{className:`size-4`,"aria-hidden":!0}),p.common.newChat]})]}):null,[jn,p.board.create,p.common.newChat,p.common.runWorkflow,y,fr,fn]);(0,Y.useLayoutEffect)(()=>(g({startExtra:hr,main:y?(0,X.jsx)(rr,{currentProject:y,pm:p,projectsText:h,wd:d}):(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:p.fallbackTitle}),(0,X.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:p.fallbackContext})]}),end:gr}),()=>_()),[_,gr,hr,p,y,h,g,d]);function _r(e){b(t=>t?{...t,...e}:null),Gt(e.defaultAgentId??``),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}async function vr(e=Tn.current){if(!(!y||!Fn(e,y))){Z(null),en(null);try{let t=await xe(y.id,{name:e.name.trim(),status:e.status,description:e.description,defaultAgentId:e.defaultAgentId,brief:e.brief,instructions:e.instructions});_r(t);let n=Tn.current,r={...n,name:n.name===e.name?t.name:n.name,description:n.description===e.description?t.description??``:n.description,status:n.status===e.status?t.status:n.status,defaultAgentId:n.defaultAgentId===e.defaultAgentId?t.defaultAgentId??``:n.defaultAgentId,brief:n.brief===e.brief?t.brief??``:n.brief,instructions:n.instructions===e.instructions?t.instructions??``:n.instructions};Tn.current=r,wn(r)}catch(e){let t=Jn(e);throw t?en(t):Z(e instanceof Error?e.message:String(e)),e}}}function yr(e){e.preventDefault(),Mr.flush()}function br(e,t=!1){let n={...Tn.current,...e};Tn.current=n,wn(n),t&&Mr.saveNow(n)}let xr=(0,Y.useCallback)(()=>{if(!y)return;let e=y.workspaceRoot?.trim()??``;an(e?`fixed`:`follow`),sn(e||y.effectiveWorkspaceRoot||``),nn(!0)},[y]);async function Sr(e={}){if(!y)return;let t=rn===`fixed`?on.trim():``;if(!(rn===`fixed`&&!t)){Xt(!0),Z(null),en(null);try{let n=await xe(y.id,{workspaceRoot:t,...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});_r(n),br({workspaceRoot:n.workspaceRoot??``}),nn(!1),en(null)}catch(e){let t=Jn(e);t?(en(t),nn(!1)):Z(e instanceof Error?e.message:String(e))}finally{Xt(!1)}}}async function Cr(){if(!(!y||cn)){ln(`pin`),Z(null);try{_r(y.pinnedAt?await G(y.id):await ye(y.id))}catch(e){Z(e instanceof Error?e.message:String(e))}finally{ln(null)}}}async function wr(){if(!(!y||cn)){ln(`archive`),Z(null);try{let e=y.status===`archived`?await xt(y.id):await re(y.id);_r(e),br({status:e.status})}catch(e){Z(e instanceof Error?e.message:String(e))}finally{ln(null)}}}async function Tr(){if(y){dn(!0),Z(null);try{await et(y.id),Qt(!1),r(`/projects`)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{dn(!1)}}}async function Er(){if(!(!y||je)){Pe(!0),Z(null);try{await U(y.id)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Pe(!1)}}}let Dr=(0,Y.useCallback)(e=>{$e(e)},[]),Or=(0,Y.useCallback)((e,t)=>{t||$e(e)},[]),kr=(0,Y.useCallback)(async(e,t,n)=>{let r=y?.id;if(r)switch(e){case`preview`:t.isDirectory||$e(t.path);break;case`download`:if(t.isDirectory)return;try{let e=ht(t.path);if(nt(lt(e))!==`text`){let n=await We(t.path,{projectId:r}),i=te(e)??`application/octet-stream`;_t(e,await n.arrayBuffer(),i)}else{let{content:n}=await dt(t.path,{projectId:r});Be(e,n)}}catch(e){Je(`warning`,e instanceof Error?e.message:String(e),void 0,{duration:4e3})}break;case`copyPath`:try{await O(t.absolutePath??t.path)&&Je(`success`,u.workspace.pathCopied,void 0,{duration:2500})}catch{Je(`warning`,u.clipboard.copyFailed,void 0,{duration:4e3})}break;case`openDefault`:if(!t.absolutePath||!window.electronAPI?.shell?.openPath)return;await window.electronAPI.shell.openPath(t.absolutePath);break;case`openWith`:if(!t.absolutePath||!window.electronAPI?.shell?.chooseAppAndOpenPath)return;await window.electronAPI.shell.chooseAppAndOpenPath(t.absolutePath);break;case`openWithApp`:if(!t.absolutePath||!n||!window.electronAPI?.shell?.openPathWithApp)return;await window.electronAPI.shell.openPathWithApp(t.absolutePath,n);break;case`revealInFolder`:if(!t.absolutePath||!window.electronAPI?.shell?.showItemInFolder)return;await window.electronAPI.shell.showItemInFolder(t.absolutePath);break;default:break}},[u.clipboard.copyFailed,u.workspace.pathCopied,y?.id]),Ar=(0,Y.useCallback)(e=>{if(!window.matchMedia(`(min-width: 1024px)`).matches)return;e.preventDefault();let t=e.currentTarget,n=t.closest(`[data-project-files-grid]`);if(!n)return;t.setPointerCapture(e.pointerId),bt(!0);let r=e.clientX,i=st,a=e.pointerId,o=0,s=i,c=i,l=()=>{o=0,c=s,n.style.setProperty(`--project-files-panel-width`,`${c}px`)},u=e=>{s=In(i+(e.clientX-r)),o===0&&(o=window.requestAnimationFrame(l))},d=()=>{o!==0&&(window.cancelAnimationFrame(o),l());try{t.releasePointerCapture(a)}catch{}bt(!1),pt(c),Rn(c),window.removeEventListener(`pointermove`,u),window.removeEventListener(`pointerup`,d),window.removeEventListener(`pointercancel`,d)};window.addEventListener(`pointermove`,u),window.addEventListener(`pointerup`,d),window.addEventListener(`pointercancel`,d)},[st]);(0,Y.useEffect)(()=>{Q!==`files`&&$e(null)},[e,Q]);let jr=!!(y&&Fn(Cn,y)),Mr=Et({value:y?Cn:null,dirty:jr,onSave:vr,validate:e=>e.name.trim()?null:p.settings.nameRequired});if(Kt)return(0,X.jsx)(`main`,{className:`w-full flex-1 p-3 text-sm text-fg-muted sm:px-5 sm:py-4 xl:px-6`,children:p.loading});if(!y)return(0,X.jsxs)(`main`,{className:`w-full flex-1 p-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,X.jsxs)(s,{to:Dn,className:`inline-flex items-center gap-2 text-sm text-accent-fg hover:underline`,children:[(0,X.jsx)(at,{className:`size-4`,"aria-hidden":!0}),Dn===`/projects`?p.backToProjects:u.sidebar.back]}),(0,X.jsx)(`p`,{className:`mt-6 rounded-lg bg-surface-panel p-4 shadow-surface text-sm text-fg-muted`,children:bn||p.notFound})]});let Nr=P.slice(0,6),Pr=j?.blockers??[],Fr=j?.tasks.filter(e=>e.phase!==`closed`)??[],Ir=e=>p.statuses[e]??e,Lr=e=>Bn(p.common.messages,{count:e}),Rr=H.trim().toLowerCase(),zr=Rr?P.filter(e=>{let t=Vn(e.updatedAt),n=e.routing?.agentId||e.agentId||p.common.agent,r=e.name?.trim()||p.sessions.fallbackTitle,i=Lr(e.messageCount??0),a=Qn(e);return[r,e.key,n,a,t,i].filter(Boolean).join(` `).toLowerCase().includes(Rr)}):P,Br=P.length>0&&zr.length===0,Vr=Ht.find(e=>e.id===y.defaultAgentId)?.name||y.defaultAgentId||p.settings.globalDefaultAgent,Hr=Ht.find(e=>e.id===Cn.defaultAgentId),Ur=y.workspaceRoot?.trim()||``,Wr=y.status===`archived`,Gr=!!y.pinnedAt,Kr=!Ur,qr=Ur||Hr?.workspace||y.effectiveWorkspaceRoot||p.common.defaultWorkspace,Jr=rn===`fixed`?on.trim()||p.settings.workspacePlaceholder:Hr?.workspace||y.effectiveWorkspaceRoot||p.common.defaultWorkspace,Yr=(rn===`fixed`?on.trim():``)!==Ur&&(rn===`follow`||!!on.trim()),Xr=[{id:`overview`,icon:ae,label:p.tabs.overview},{id:`tasks`,icon:yt,label:p.tabs.tasks},{id:`automations`,icon:Ke,label:p.tabs.automations},{id:`files`,icon:Re,label:p.tabs.files},{id:`notes`,icon:Qe,label:p.tabs.notes},{id:`skills`,icon:K,label:p.tabs.skills},{id:`sessions`,icon:W,label:p.tabs.sessions},{id:`progress`,icon:Ue,label:p.tabs.progress}];async function Zr(){if(!qr)return;let e=await O(qr);Je(e?`success`:`warning`,e?u.workspace.pathCopied:u.clipboard.copyFailed,void 0,{duration:e?2500:4e3})}function Qr(){en(null),nn(!0)}return(0,X.jsxs)(`main`,{className:`flex h-full min-h-0 w-full flex-1 flex-col overflow-hidden p-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,X.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3`,children:[(0,X.jsx)(Dt,{items:Xr,activeTab:Q,onChange:An,ariaLabel:p.navAria,tabIdPrefix:`project-primary-tab`,className:`min-w-0 flex-1`}),(0,X.jsxs)(D,{id:`project-primary-tab-settings`,type:`button`,variant:Q===`settings`?`secondary`:`ghost`,className:`h-9 shrink-0 rounded-lg px-3`,"aria-current":Q===`settings`?`page`:void 0,onClick:()=>An(`settings`),children:[(0,X.jsx)(Me,{className:`size-4`,"aria-hidden":!0}),p.tabs.settings,jr?(0,X.jsx)(`span`,{className:`size-1.5 rounded-full bg-amber-500`,"aria-label":p.settings.unsavedChanges}):null]})]}),bn?(0,X.jsx)(`p`,{className:`mt-3 shrink-0 rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:bn}):null,(0,X.jsxs)(`div`,{className:E(`mt-3 min-h-0 flex-1`,Q===`overview`?`overflow-y-auto pr-1 [scrollbar-gutter:stable] xl:overflow-hidden xl:pr-0`:Q===`tasks`?`overflow-hidden`:`overflow-y-auto pr-1 [scrollbar-gutter:stable]`),children:[Q===`overview`?(0,X.jsxs)(`section`,{id:`project-panel-overview`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-overview`,className:`grid min-h-full gap-4 xl:h-full xl:min-h-0 xl:grid-cols-[minmax(0,1fr)_20rem] xl:overflow-hidden`,children:[(0,X.jsxs)(`div`,{className:`grid min-w-0 content-start gap-4 xl:min-h-0 xl:overflow-y-auto xl:pr-1 xl:[scrollbar-gutter:stable]`,children:[(0,X.jsx)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel p-4 shadow-surface`,children:(0,X.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.directionTitle}),(0,X.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:y.outcome||j?.digest.summary||y.description||y.brief||p.overview.directionFallback}),j?.digest.recommendedAction?(0,X.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm font-medium leading-6 text-fg`,children:Bn(p.overview.recommendedNext,{action:j.digest.recommendedAction})}):null]}),(0,X.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:(0,X.jsxs)(D,{type:`button`,variant:`secondary`,onClick:()=>void Er(),disabled:je,children:[(0,X.jsx)(He,{className:`size-4`,"aria-hidden":!0}),je?p.overview.savingDigest:p.overview.saveDigest]})})]})}),(0,X.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,X.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.nextActions})}),(0,X.jsx)(`div`,{className:`divide-y divide-edge`,children:Fr.length?Fr.map(e=>(0,X.jsxs)(s,{to:De(On(`overview`),e.id),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,X.jsxs)(`span`,{className:`shrink-0 rounded-full bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:[e.phase,` · `,e.operationalState]})]}),e.attention[0]?(0,X.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:e.attention[0].summary}):null]},e.id)):(0,X.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.overview.noNextActions})})]}),j?.recentResults.length?(0,X.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,X.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.recentResults})}),(0,X.jsx)(`div`,{className:`divide-y divide-edge`,children:j.recentResults.slice(0,5).map(({taskId:e,taskTitle:t,receipt:n})=>(0,X.jsxs)(s,{to:De(On(`overview`),e),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),(0,X.jsxs)(`span`,{className:`shrink-0 rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:[n.status,` · `,n.verification.status]})]}),(0,X.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:n.summary})]},n.runId))})]}):null,(0,X.jsxs)(`div`,{className:`grid min-w-0 gap-4 md:grid-cols-2`,children:[(0,X.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,X.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.milestones})}),(0,X.jsx)(`div`,{className:`divide-y divide-edge`,children:y.milestones.length?y.milestones.map(e=>(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-4 py-3`,children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,X.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:e.status})]},e.id)):(0,X.jsx)(`p`,{className:`px-4 py-5 text-sm text-fg-muted`,children:p.overview.noMilestones})})]}),(0,X.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,X.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.projectUpdates})}),(0,X.jsx)(`div`,{className:`divide-y divide-edge`,children:y.recentUpdates.length?y.recentUpdates.slice(0,3).map(e=>(0,X.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,X.jsx)(`p`,{className:`text-sm leading-5 text-fg`,children:e.summary}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.health})]},e.id)):(0,X.jsx)(`p`,{className:`px-4 py-5 text-sm text-fg-muted`,children:p.overview.noProjectUpdates})})]})]})]}),(0,X.jsxs)(`aside`,{className:`grid min-w-0 content-start gap-4 xl:min-h-0 xl:overflow-y-auto xl:pr-1 xl:[scrollbar-gutter:stable]`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.attention}),Pr.length?(0,X.jsx)(`div`,{className:`mt-3 grid gap-3`,children:Pr.map(e=>{let t=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(Ee,{className:`size-4 text-amber-600 dark:text-amber-300`,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title})]}),(0,X.jsxs)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:[p.overview.attentionKinds[e.kind]??e.kind,e.detail?` · ${e.detail}`:e.status?` · ${Ir(e.status)}`:``]})]});return e.href?(0,X.jsx)(s,{to:e.href,onClick:Pn(Kn(e.href)),className:`min-w-0 rounded-md bg-surface-base p-3 hover:bg-surface-hover`,children:t},e.id):(0,X.jsx)(`div`,{className:`min-w-0 rounded-md bg-surface-base p-3`,children:t},e.id)})}):(0,X.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:p.overview.noBlockedTasks}),(0,X.jsxs)(`form`,{onSubmit:mr,className:`mt-4 flex gap-2 border-t border-edge pt-4`,children:[(0,X.jsx)(`input`,{className:`min-h-9 min-w-0 flex-1 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:xn.title,onChange:e=>Sn(t=>({...t,title:e.target.value})),placeholder:p.overview.blockerTitlePlaceholder}),(0,X.jsx)(D,{type:`submit`,variant:`secondary`,className:`shrink-0 rounded-lg px-3`,disabled:mn||!xn.title.trim(),"aria-label":mn?p.overview.addingBlocker:p.overview.addBlocker,title:mn?p.overview.addingBlocker:p.overview.addBlocker,children:(0,X.jsx)(C,{className:`size-4`,"aria-hidden":!0})})]})]}),(0,X.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(pe,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,X.jsx)(`h2`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:p.overview.recentSessions})]}),(0,X.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,onClick:()=>An(`sessions`),children:p.common.viewAll})]}),(0,X.jsx)(`div`,{className:`divide-y divide-edge`,children:Nr.length?Nr.map(e=>(0,X.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:Pn(`sessions`),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.name||e.key}),(0,X.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:Vn(e.updatedAt)})]}),(0,X.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:e.agentId||p.common.agent})]},e.key)):(0,X.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.overview.noSessions})})]})]})]}):null,Q===`tasks`?(0,X.jsx)(kn,{ref:vn,tasks:j?.tasks??[],dependencyEdges:j?.dependencyEdges??[],monitoring:j?.monitoring??{projectId:e??``,mode:`observe`,allowedActions:[],confidenceThreshold:.75,scenarios:[],configured:!1},returnTo:On(`tasks`),copy:p.board,onAction:qn,onReorder:ir,onUndoMove:ar,onDependenciesChange:or,onMonitoringChange:sr,onCreate:$n,actionBusyId:gn}):null,Q===`automations`?(0,X.jsx)(`section`,{id:`project-panel-automations`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-automations`,className:`grid min-h-full content-start gap-4`,children:(0,X.jsx)(At,{projectId:y.id,embedded:!0,title:p.automations.title,subtitle:p.automations.hint})}):null,Q===`notes`?(0,X.jsx)(`section`,{id:`project-panel-notes`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-notes`,className:`flex h-full min-h-[28rem] overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:(0,X.jsx)(wt,{selectedNoteId:n,basePath:`/projects/${encodeURIComponent(y.id)}/notes`,showLibrary:!1,allowMediaCapture:!1,projectId:y.id,listTitle:p.notes.title,listDescription:p.notes.hint,emptyText:p.notes.emptyTitle,emptyDescription:p.notes.emptyDescription,listWidthStorageKey:`xopc.projectNotes.listWidth.${y.id}`})}):null,Q===`skills`?(0,X.jsx)(Yt,{projectId:y.id,copy:p.skills}):null,Q===`files`?(0,X.jsx)(`section`,{id:`project-panel-files`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-files`,className:`flex h-full min-h-[28rem] flex-col`,children:(0,X.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:y.effectiveWorkspaceRoot?(0,X.jsxs)(`div`,{"data-project-files-grid":!0,className:E(`grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[var(--project-files-panel-width)_6px_minmax(0,1fr)]`,mt&&`cursor-col-resize select-none`),style:{"--project-files-panel-width":`${st}px`},children:[(0,X.jsxs)(`aside`,{className:`flex min-h-0 flex-col border-b border-edge lg:border-b-0 lg:border-r`,children:[(0,X.jsxs)(`div`,{className:`flex h-11 items-center gap-1 border-b border-edge bg-surface-muted/50 px-3 text-sm`,children:[(0,X.jsx)(Ae,{workspacePath:qr}),(0,X.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[(0,X.jsx)(`button`,{type:`button`,className:E(`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,St&&`bg-surface-hover text-fg`),onClick:()=>Ct(!0),"aria-label":p.files.search,title:p.files.search,"aria-pressed":St,children:(0,X.jsx)(w,{className:`size-3.5`,"aria-hidden":!0})}),(0,X.jsx)(Ze,{className:`size-7 shrink-0 rounded-md p-0`,loading:Rt,label:u.cron.refresh,onClick:()=>void lr()})]})]}),St?(0,X.jsx)(`div`,{className:`shrink-0 border-b border-edge bg-surface-muted/40 px-3 py-2`,children:(0,X.jsxs)(`div`,{className:`flex h-8 items-center gap-2 rounded-md border border-edge bg-surface-panel px-2 focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/20`,children:[(0,X.jsx)(w,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,X.jsx)(`input`,{type:`text`,role:`searchbox`,value:kt,onChange:e=>jt(e.target.value),placeholder:p.files.searchPlaceholder,"aria-label":p.files.searchPlaceholder,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none placeholder:text-fg-subtle`}),(0,X.jsx)(`button`,{type:`button`,className:`flex size-6 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":p.files.clearSearch,title:p.files.clearSearch,onClick:()=>{jt(``),Ct(!1)},children:(0,X.jsx)(T,{className:`size-3.5`,"aria-hidden":!0})})]})}):null,Bt?(0,X.jsx)(`div`,{className:`border-b border-edge bg-red-500/10 px-4 py-3 text-sm text-red-700 dark:text-red-300`,children:Bt}):null,dr?(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-2`,children:Pt?(0,X.jsxs)(`div`,{className:`space-y-2 px-3 py-1`,children:[(0,X.jsx)(ct,{className:`h-11 w-full`}),(0,X.jsx)(ct,{className:`h-11 w-full`}),(0,X.jsx)(ct,{className:`h-11 w-full`})]}):It?(0,X.jsxs)(`p`,{className:`px-3 py-2 text-xs text-red-600 dark:text-red-400`,children:[u.workspace.loadError,`: `,It]}):Mt.length===0?(0,X.jsx)(`p`,{className:`px-3 py-2 text-xs text-fg-muted`,children:p.files.noSearchResults}):Mt.map(e=>(0,X.jsxs)(`button`,{type:`button`,className:E(`flex w-full min-w-0 items-center gap-2 px-3 py-2 text-left hover:bg-surface-hover`,Xe===e.path&&`bg-accent-soft text-accent-fg`),onClick:()=>$e(e.path),title:e.path,children:[(0,X.jsx)(Qe,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`span`,{className:`block truncate text-sm text-fg`,children:e.name}),(0,X.jsx)(`span`,{className:`block truncate text-xs text-fg-subtle`,children:e.path})]})]},e.path))}):Rt&&Fe.length===0?(0,X.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.files.loading}):(0,X.jsx)(ot,{tree:Fe,selectedPath:Xe,onSelectFile:Dr,onSelectEntry:Or,onExpandDir:e=>void ur(e),onAction:kr,actionLabels:{preview:u.workspace.preview,download:u.workspace.download,copyPath:u.workspace.copyPath,openDefault:u.workspace.openSystemApp,openWith:u.workspace.openWith,revealInFolder:u.workspace.revealInFolder,recommendedApps:u.workspace.recommendedApps},emptyHint:p.files.emptyDirectory})]}),(0,X.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":p.files.resizeHandle,className:E(`hidden cursor-col-resize touch-none items-stretch justify-center bg-surface-panel transition-colors hover:bg-surface-hover lg:flex`,mt&&`bg-surface-hover`),onPointerDown:Ar,children:(0,X.jsx)(`div`,{className:`my-3 w-px rounded-full bg-edge-strong/70`})}),(0,X.jsx)(`div`,{className:`min-h-0 min-w-0 overflow-hidden bg-surface-base`,children:Xe?(0,X.jsx)(Ce,{filePath:Xe,projectId:y.id,agentId:y.defaultAgentId||Wt||void 0,onClose:()=>$e(null)}):(0,X.jsx)(`div`,{className:`flex h-full min-h-[18rem] items-center justify-center px-6 text-center`,children:(0,X.jsxs)(`div`,{className:`max-w-sm`,children:[(0,X.jsx)(Re,{className:`mx-auto size-8 text-fg-subtle`,"aria-hidden":!0}),(0,X.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:p.files.previewEmptyTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.files.previewEmptyDescription})]})})})]}):(0,X.jsxs)(`div`,{className:`grid gap-3 px-4 py-8 text-sm text-fg-muted`,children:[(0,X.jsx)(`p`,{children:p.files.needWorkspace}),(0,X.jsx)(`div`,{children:(0,X.jsx)(D,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>An(`settings`),children:p.files.openSettings})})]})})}):null,Q===`sessions`?(0,X.jsxs)(`section`,{id:`project-panel-sessions`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-sessions`,className:`grid min-h-full content-start gap-3`,children:[P.length?(0,X.jsxs)(`label`,{className:`relative flex min-h-9 w-full max-w-lg cursor-text items-center rounded-lg bg-surface-panel py-1.5 pl-9 pr-9 shadow-surface`,children:[(0,X.jsx)(w,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,"aria-hidden":!0}),(0,X.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:H,onChange:e=>ne(e.currentTarget.value),placeholder:p.sessions.searchPlaceholder,"aria-label":p.sessions.searchPlaceholder,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`}),H?(0,X.jsx)(`button`,{type:`button`,className:`absolute right-2 top-1/2 inline-flex size-6 -translate-y-1/2 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":p.sessions.clearSearch,onClick:()=>ne(``),children:(0,X.jsx)(T,{className:`size-3.5`,"aria-hidden":!0})}):null]}):null,zr.length?(0,X.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:zr.map(e=>{let t=Vn(e.updatedAt),n=e.routing?.agentId||e.agentId||p.common.agent,r=Qn(e),i=e.name?.trim()||p.sessions.fallbackTitle,a=Lr(e.messageCount??0);return(0,X.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:Pn(`sessions`),className:`group flex min-h-[8.75rem] min-w-0 flex-col rounded-lg bg-surface-panel p-4 shadow-surface transition-colors hover:bg-surface-hover/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,X.jsx)(`span`,{className:`mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-base text-fg-muted`,children:(0,X.jsx)(W,{className:`size-4`,"aria-hidden":!0})}),(0,X.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-sm font-semibold text-fg`,children:i}),r?(0,X.jsx)(`span`,{className:`shrink-0 rounded-md bg-surface-base px-2 py-0.5 text-[11px] font-medium leading-5 text-fg-muted`,children:r}):null]})})]}),(0,X.jsxs)(`div`,{className:`mt-auto grid gap-2 pt-4 text-xs text-fg-muted`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,X.jsxs)(`span`,{className:`min-w-0 max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[p.sessions.agent,`: `,n]}),(0,X.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:a})]}),t?(0,X.jsxs)(`span`,{className:`truncate rounded-md bg-surface-base px-2 py-1`,children:[p.sessions.updated,`: `,t]}):null]})]},e.key)})}):Br?(0,X.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,X.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:p.sessions.noMatches})}):(0,X.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:p.sessions.emptyTitle}),(0,X.jsx)(`p`,{className:`mx-auto mt-1 max-w-md text-sm leading-6 text-fg-muted`,children:p.sessions.emptyDescription})]})})]}):null,Q===`progress`?(0,X.jsxs)(`section`,{id:`project-panel-progress`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-progress`,className:`grid min-h-full content-start gap-3`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.progress.title}),(0,X.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:Bn(p.progress.count,{count:ue})})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(`label`,{className:`inline-flex min-h-9 items-center gap-2 rounded-lg bg-surface-panel px-3 text-sm text-fg-muted shadow-surface`,children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:Se,onChange:e=>ke(e.currentTarget.checked),className:`size-4 rounded border-edge text-accent focus:ring-accent/30`}),p.progress.includeRelated]}),(0,X.jsxs)(D,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3`,onClick:()=>void cr(),disabled:J,children:[(0,X.jsx)(gt,{className:E(`size-4`,J&&`animate-spin`),"aria-hidden":!0}),p.common.refresh]})]})]}),(0,X.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:J&&oe.length===0?(0,X.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:p.progress.loading}):oe.length?(0,X.jsx)(`div`,{className:`divide-y divide-edge`,children:oe.map(e=>{let t=p.progress.types[e.type]??e.type,n=p.progress.objectKinds[e.primaryObject.kind]??e.primaryObject.kind,r=er(e),i=e.relatedProjects.length>0&&!e.scopes.some(e=>e.scopeKind===`project`&&e.scopeId===y.id);return(0,X.jsxs)(`article`,{className:`grid gap-2 px-4 py-3`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),i?(0,X.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:p.progress.related}):null]}),(0,X.jsxs)(`p`,{className:`mt-1 min-w-0 truncate text-sm text-fg-muted`,children:[n,`: `,Xn(e)]})]}),(0,X.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,dateTime:new Date(e.createdAt).toISOString(),children:Vn(e.createdAt)})]}),r?(0,X.jsx)(`p`,{className:`line-clamp-2 text-sm leading-5 text-fg-muted`,children:r}):null,(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[(0,X.jsxs)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:[p.progress.actor,`: `,Yn(e)]}),(0,X.jsxs)(`span`,{className:`max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[p.progress.source,`: `,Zn(e)]})]})]},e.id)})}):(0,X.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:p.progress.empty})})]}):null,Q===`settings`?(0,X.jsxs)(`form`,{id:`project-panel-settings`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-settings`,onSubmit:yr,onBlurCapture:Mr.onBlurCapture,className:`grid min-h-full content-start gap-4 pb-1`,children:[(0,X.jsxs)(`section`,{className:`flex min-w-0 items-start justify-between gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.summaryTitle}),(0,X.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:p.settings.summaryHint})]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-2`,children:[(0,X.jsx)(`span`,{className:E(`rounded-full px-2 py-0.5 text-xs font-medium`,Hn(Cn.status)),children:p.settings.statuses[Cn.status]}),(0,X.jsx)(Tt,{status:Mr.status,error:Mr.error})]})]}),(0,X.jsxs)(`div`,{className:`grid items-start gap-4 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,X.jsxs)(`div`,{className:`grid gap-4`,children:[(0,X.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.detailsTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.settings.detailsHint})]}),(0,X.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,X.jsx)(Un,{label:p.settings.name,children:(0,X.jsx)(`input`,{className:Wn(),value:Cn.name,onChange:e=>br({name:e.target.value})})}),(0,X.jsx)(Un,{label:p.settings.defaultAgent,children:(0,X.jsxs)(f,{className:Wn(),value:Cn.defaultAgentId,onChange:e=>br({defaultAgentId:e.target.value},!0),children:[(0,X.jsx)(m,{value:``,children:p.settings.globalDefaultAgent}),Ht.map(e=>(0,X.jsx)(m,{value:e.id,children:it(e,u.agentsSettings)},e.id))]})}),(0,X.jsx)(Un,{label:p.settings.status,children:Wr?(0,X.jsx)(`div`,{className:`grid min-h-10 content-center rounded-md border border-edge bg-surface-muted px-3 text-sm text-fg-muted`,children:p.settings.statuses.archived}):(0,X.jsxs)(f,{className:Wn(),value:Cn.status===`archived`?`active`:Cn.status,onChange:e=>br({status:e.target.value},!0),children:[(0,X.jsx)(m,{value:`active`,children:p.settings.statuses.active}),(0,X.jsx)(m,{value:`paused`,children:p.settings.statuses.paused})]})}),(0,X.jsx)(Un,{label:p.settings.description,hint:p.settings.descriptionHint,children:(0,X.jsx)(`textarea`,{className:Wn(!0),value:Cn.description,onChange:e=>br({description:e.target.value})})})]})]}),(0,X.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.projectGuidanceTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.settings.projectGuidanceHint})]}),(0,X.jsx)(Un,{label:p.settings.brief,hint:p.settings.briefHint,children:(0,X.jsx)(`textarea`,{className:Wn(!0),value:Cn.brief,onChange:e=>br({brief:e.target.value})})}),(0,X.jsx)(Un,{label:p.settings.instructions,hint:p.settings.instructionsHint,children:(0,X.jsx)(`textarea`,{className:Wn(!0),value:Cn.instructions,onChange:e=>br({instructions:e.target.value})})})]})]}),(0,X.jsxs)(`aside`,{className:`grid gap-4 xl:sticky xl:top-0`,children:[(0,X.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.workspaceRoot}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:p.settings.workspaceIndependentHint})]}),(0,X.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,X.jsx)(`span`,{className:`w-fit rounded-md bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:Kr?p.settings.workspaceModeFollow:p.settings.workspaceModeFixed}),(0,X.jsx)(`div`,{className:`break-all font-mono text-xs leading-5 text-fg`,title:qr,children:qr}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,X.jsxs)(D,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:()=>void Zr(),children:[(0,X.jsx)(v,{className:`size-4`,"aria-hidden":!0}),p.settings.copyWorkspacePath]}),(0,X.jsx)(Ae,{workspacePath:qr}),(0,X.jsxs)(D,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:xr,children:[(0,X.jsx)(rt,{className:`size-4`,"aria-hidden":!0}),p.settings.migrateWorkspace]})]})]})]}),(0,X.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.currentProjectTitle}),(0,X.jsxs)(`div`,{className:`grid gap-2`,children:[(0,X.jsx)(Gn,{label:p.settings.defaultAgent,value:Vr}),(0,X.jsx)(Gn,{label:p.settings.pinState,value:Gr?p.settings.pinned:p.settings.notPinned}),(0,X.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,X.jsx)(Gn,{label:p.settings.createdAt,value:Vn(y.createdAt)||p.common.never}),(0,X.jsx)(Gn,{label:p.settings.updatedAt,value:Vn(y.updatedAt)||p.common.never})]})]})]}),(0,X.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.managementTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:p.settings.managementHint})]}),(0,X.jsxs)(`div`,{className:`grid gap-3`,children:[(0,X.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:Gr?p.settings.pinnedTitle:p.settings.pinTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:p.settings.pinHint})]}),(0,X.jsxs)(D,{type:`button`,variant:`ghost`,className:`w-fit rounded-lg`,disabled:cn===`pin`,onClick:()=>void Cr(),children:[Gr?(0,X.jsx)(Ge,{className:`size-4`,"aria-hidden":!0}):(0,X.jsx)(ft,{className:`size-4`,"aria-hidden":!0}),Gr?p.settings.unpinProject:p.settings.pinProject]})]}),(0,X.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:Wr?p.settings.restoreTitle:p.settings.archiveTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:Wr?p.settings.restoreHint:p.settings.archiveHint})]}),(0,X.jsxs)(D,{type:`button`,variant:Wr?`primary`:`ghost`,className:`w-fit rounded-lg`,disabled:cn===`archive`,onClick:()=>void wr(),children:[Wr?(0,X.jsx)(gt,{className:`size-4`,"aria-hidden":!0}):(0,X.jsx)(qe,{className:`size-4`,"aria-hidden":!0}),Wr?p.settings.restoreProject:p.settings.archiveProject]})]})]})]}),(0,X.jsxs)(`section`,{className:`grid gap-3 rounded-lg border border-red-500/20 bg-red-500/5 p-4`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-red-700 dark:text-red-300`,children:p.settings.dangerTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-red-700/80 dark:text-red-200/80`,children:p.settings.dangerHint})]}),(0,X.jsxs)(D,{type:`button`,variant:`ghost`,className:`w-fit text-red-600 hover:bg-red-500/10 hover:text-red-700 focus-visible:ring-red-500 dark:text-red-400 dark:hover:text-red-300`,onClick:()=>Qt(!0),children:[(0,X.jsx)(me,{className:`size-4`,"aria-hidden":!0}),p.settings.deleteConfirmAction]})]})]})]})]}):null]}),(0,X.jsx)(ee,{open:Zt,onOpenChange:e=>{un||Qt(e)},children:(0,X.jsxs)(L,{children:[(0,X.jsx)(N,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,X.jsxs)(R,{className:`fixed left-1/2 top-1/2 z-[90] w-[min(28rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-panel p-5 shadow-float focus:outline-none`,children:[(0,X.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,X.jsx)(`span`,{className:`mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg bg-red-500/10 text-red-600 dark:text-red-400`,children:(0,X.jsx)(Ee,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(z,{className:`text-base font-semibold text-fg`,children:p.settings.deleteConfirmTitle}),(0,X.jsx)(F,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:y?Bn(p.settings.deleteConfirm,{name:y.name}):p.settings.deleteConfirmFallback})]})]}),(0,X.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,X.jsx)(I,{asChild:!0,children:(0,X.jsx)(D,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:un,children:p.common.cancel})}),(0,X.jsxs)(D,{type:`button`,variant:`ghost`,className:`rounded-lg text-red-600 hover:bg-red-500/10 hover:text-red-700 focus-visible:ring-red-500 dark:text-red-400 dark:hover:text-red-300`,disabled:un||!y,onClick:()=>void Tr(),children:[(0,X.jsx)(me,{className:`size-4`,"aria-hidden":!0}),p.settings.deleteConfirmAction]})]})]})]})}),(0,X.jsx)(ee,{open:tn,onOpenChange:e=>{Jt||nn(e)},children:(0,X.jsxs)(L,{children:[(0,X.jsx)(N,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,X.jsxs)(R,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(34rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))] -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,X.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,X.jsx)(z,{className:`text-base font-semibold text-fg`,children:p.settings.workspaceMigrationTitle}),(0,X.jsx)(F,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.settings.workspaceMigrationDescription})]}),(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,X.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,X.jsx)(`span`,{className:`font-medium text-fg-muted`,children:p.settings.workspaceMode}),(0,X.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-2`,children:[(0,X.jsxs)(`label`,{className:E(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,rn===`fixed`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,X.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:rn===`fixed`,onChange:()=>an(`fixed`),disabled:Jt}),(0,X.jsxs)(`span`,{className:`min-w-0`,children:[(0,X.jsx)(`span`,{className:`block font-medium`,children:p.settings.workspaceModeFixed}),(0,X.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:p.settings.workspaceMigrationFixedHint})]})]}),(0,X.jsxs)(`label`,{className:E(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,rn===`follow`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,X.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:rn===`follow`,onChange:()=>an(`follow`),disabled:Jt}),(0,X.jsxs)(`span`,{className:`min-w-0`,children:[(0,X.jsx)(`span`,{className:`block font-medium`,children:p.settings.workspaceModeFollow}),(0,X.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:p.settings.workspaceHint})]})]})]})]}),rn===`fixed`?(0,X.jsx)(Ot,{value:on,onChange:sn,disabled:Jt,wd:d,placeholder:p.settings.workspacePlaceholder,inputClassName:Wn(),autoFocus:!0}):null,(0,X.jsx)(`div`,{className:`rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm leading-6 text-amber-800 dark:text-amber-200`,children:p.settings.workspaceMigrationImpact}),(0,X.jsx)(`div`,{className:`rounded-lg bg-surface-muted px-3 py-2 text-xs leading-5 text-fg-subtle`,children:Bn(p.settings.workspaceCurrent,{workspace:Jr})})]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,X.jsx)(I,{asChild:!0,children:(0,X.jsx)(D,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:Jt,children:p.common.cancel})}),(0,X.jsxs)(D,{type:`button`,variant:`primary`,className:`rounded-lg`,disabled:Jt||!Yr,onClick:()=>void Sr(),children:[(0,X.jsx)(rt,{className:`size-4`,"aria-hidden":!0}),p.settings.workspaceMigrationConfirm]})]})]})]})}),(0,X.jsx)(ee,{open:!!$t,onOpenChange:e=>{e||en(null)},children:(0,X.jsxs)(L,{children:[(0,X.jsx)(N,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,X.jsxs)(R,{className:`fixed left-1/2 top-1/2 z-[90] flex w-[min(30rem,calc(100vw-2rem))] -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,X.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,X.jsx)(z,{className:`text-base font-semibold text-fg`,children:p.settings.workspaceMissingTitle}),(0,X.jsx)(F,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:$t?Bn(p.settings.workspaceMissingDescription,{workspace:$t}):null})]}),$t?(0,X.jsx)(`div`,{className:`px-5 py-4`,children:(0,X.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,X.jsx)(Re,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:$t})]})}):null,(0,X.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,X.jsx)(D,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:Qr,disabled:Jt,children:p.settings.workspaceMissingBack}),(0,X.jsxs)(D,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:()=>void Sr({createWorkspaceRoot:!0}),disabled:Jt,children:[(0,X.jsx)(rt,{className:`size-4`,"aria-hidden":!0}),p.settings.workspaceMissingCreate]})]})]})]})})]})}export{ir as ProjectDetailPage};
|
|
@@ -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{t as i}from"./chunk-KS7C4IRE-BaASWQor.js";import{n as a,r as o}from"./popover-select-CccGri5Y.js";import{t as s}from"./loader-circle-CifKLtgG.js";import{t as c}from"./plus-Q2yW6OE7.js";import{t as l}from"./search-DA7gz22f.js";import{t as u}from"./x-B_N4OPjy.js";import{t as d}from"./cn-JdwAhgNB.js";import{t as f}from"./button-CSEbl4zT.js";import{t as p}from"./messages-BMdD0LWk.js";import{n as m}from"./locale-store-CXhjfe4q.js";import{a as h,i as g,n as _,o as v,r as y,s as b,t as x}from"./dist-BPoKqzeH.js";import{Da as S,Ha as C,Ka as w,La as T,Oa as E,Ra as D,Xa as O,_o as k,cu as A,dl as ee,fc as j,fu as M,ki as N,no as P,pc as F,tc as I,ul as te,za as ne}from"./index-Bbd_dXui.js";var L=n(),R=e(t(),1),z=r();function B(e,t){if(e==null)return t;let n=new Date(e);return Number.isNaN(n.getTime())?t:N(n)}function re(e){return[...e].sort((e,t)=>{let n=Number(!!t.pinnedAt)-Number(!!e.pinnedAt);return n===0?new Date(t.lastActiveAt??t.updatedAt).getTime()-new Date(e.lastActiveAt??e.updatedAt).getTime():n})}function ie(){let e=(0,L.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,z.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,"aria-busy":!0,children:Array.from({length:6},V)}),e[0]=t):t=e[0],t}function V(e,t){return(0,z.jsx)(P,{className:`h-40 rounded-xl`},t)}function ae(e){let t=(0,L.c)(59),{project:n,busy:r,onTogglePin:a,onToggleArchive:o}=e,s=m(H),c,l,u,d,h,g,_,v;if(t[0]!==s||t[1]!==n.brief||t[2]!==n.description||t[3]!==n.id||t[4]!==n.lastActiveAt||t[5]!==n.name||t[6]!==n.status||t[7]!==n.updatedAt||t[8]!==n.workspaceRoot){let e=p(s).projectsPage;c=e.management,_=`flex h-full flex-col rounded-xl border border-edge-subtle bg-surface-base p-4`;let r;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,z.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-accent-soft text-accent`,children:(0,z.jsx)(ee,{className:`size-4`,"aria-hidden":!0})}),t[17]=r):r=t[17];let a;t[18]===n.name?a=t[19]:(a=(0,z.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:n.name}),t[18]=n.name,t[19]=a);let o=(0,z.jsxs)(`div`,{className:`min-w-0`,children:[a,(0,z.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:e.statuses[n.status]})]}),f;t[20]===o?f=t[21]:(f=(0,z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[r,o]}),t[20]=o,t[21]=f);let m;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,z.jsx)(A,{className:`mt-2 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`,"aria-hidden":!0}),t[22]=m):m=t[22];let y;t[23]===f?y=t[24]:(y=(0,z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[f,m]}),t[23]=f,t[24]=y),v=(0,z.jsxs)(i,{to:`/projects/${encodeURIComponent(n.id)}`,className:`group flex min-w-0 flex-1 flex-col rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[y,(0,z.jsx)(`p`,{className:`mt-3 line-clamp-2 min-h-10 text-xs leading-5 text-fg-muted`,children:n.description||n.brief||e.noDescription})]}),g=`mt-3 flex shrink-0 items-end justify-between gap-3 border-t border-edge-subtle pt-3`,d=`min-w-0 text-[11px] text-fg-subtle`,h=(0,z.jsx)(`p`,{className:`truncate`,children:n.workspaceRoot||e.agentDefault}),l=`mt-1`,u=B(n.lastActiveAt??n.updatedAt,e.never),t[0]=s,t[1]=n.brief,t[2]=n.description,t[3]=n.id,t[4]=n.lastActiveAt,t[5]=n.name,t[6]=n.status,t[7]=n.updatedAt,t[8]=n.workspaceRoot,t[9]=c,t[10]=l,t[11]=u,t[12]=d,t[13]=h,t[14]=g,t[15]=_,t[16]=v}else c=t[9],l=t[10],u=t[11],d=t[12],h=t[13],g=t[14],_=t[15],v=t[16];let y;t[25]!==l||t[26]!==u?(y=(0,z.jsx)(`p`,{className:l,children:u}),t[25]=l,t[26]=u,t[27]=y):y=t[27];let b;t[28]!==d||t[29]!==h||t[30]!==y?(b=(0,z.jsxs)(`div`,{className:d,children:[h,y]}),t[28]=d,t[29]=h,t[30]=y,t[31]=b):b=t[31];let x=n.pinnedAt?c.unpin:c.pin,S=n.pinnedAt?c.unpin:c.pin,C;t[32]===n.pinnedAt?C=t[33]:(C=n.pinnedAt?(0,z.jsx)(j,{className:`size-4`,"aria-hidden":!0}):(0,z.jsx)(F,{className:`size-4`,"aria-hidden":!0}),t[32]=n.pinnedAt,t[33]=C);let w;t[34]!==r||t[35]!==a||t[36]!==x||t[37]!==S||t[38]!==C?(w=(0,z.jsx)(f,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:a,"aria-label":x,title:S,children:C}),t[34]=r,t[35]=a,t[36]=x,t[37]=S,t[38]=C,t[39]=w):w=t[39];let T=n.status===`archived`?c.restore:c.archive,E=n.status===`archived`?c.restore:c.archive,D;t[40]===n.status?D=t[41]:(D=n.status===`archived`?(0,z.jsx)(I,{className:`size-4`,"aria-hidden":!0}):(0,z.jsx)(M,{className:`size-4`,"aria-hidden":!0}),t[40]=n.status,t[41]=D);let O;t[42]!==r||t[43]!==o||t[44]!==T||t[45]!==E||t[46]!==D?(O=(0,z.jsx)(f,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:o,"aria-label":T,title:E,children:D}),t[42]=r,t[43]=o,t[44]=T,t[45]=E,t[46]=D,t[47]=O):O=t[47];let k;t[48]!==w||t[49]!==O?(k=(0,z.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[w,O]}),t[48]=w,t[49]=O,t[50]=k):k=t[50];let N;t[51]!==k||t[52]!==g||t[53]!==b?(N=(0,z.jsxs)(`div`,{className:g,children:[b,k]}),t[51]=k,t[52]=g,t[53]=b,t[54]=N):N=t[54];let P;return t[55]!==N||t[56]!==_||t[57]!==v?(P=(0,z.jsxs)(`article`,{className:_,children:[v,N]}),t[55]=N,t[56]=_,t[57]=v,t[58]=P):P=t[58],P}function H(e){return e.language}function U(){let e=p(m(e=>e.language)),t=e.projectsPage,n=t.management,r=e.chat.workingDirectory,i=k(e=>e.setPageHeader),A=k(e=>e.clearPageHeader),[j,M]=(0,R.useState)([]),[N,P]=(0,R.useState)(!0),[F,I]=(0,R.useState)(null),[L,B]=(0,R.useState)(``),[V,H]=(0,R.useState)(!1),[U,oe]=(0,R.useState)(`active`),[se,W]=(0,R.useState)(null),[ce,G]=(0,R.useState)(!1),[le,K]=(0,R.useState)(null),[q,ue]=(0,R.useState)(!1),[J,de]=(0,R.useState)(``),[Y,fe]=(0,R.useState)(``),[X,pe]=(0,R.useState)(``),Z=O({initialPath:X,onPicked:pe}),Q=(0,R.useCallback)(async()=>{P(!0),I(null);try{M(re((await T({limit:100,sortBy:`updatedAt`,sortOrder:`desc`})).items))}catch(e){I(e instanceof Error?e.message:String(e))}finally{P(!1)}},[]);(0,R.useEffect)(()=>{Q()},[Q]);let $=(0,R.useMemo)(()=>{let e=L.trim().toLocaleLowerCase();return j.filter(e=>U===`all`||e.status===U).filter(t=>!e||[t.name,t.description,t.brief,t.workspaceRoot].filter(Boolean).some(t=>t.toLocaleLowerCase().includes(e)))},[U,j,L]),me=(0,R.useMemo)(()=>(0,z.jsxs)(f,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>G(!0),children:[(0,z.jsx)(c,{className:`size-4`,"aria-hidden":!0}),t.create]}),[t.create]);(0,R.useLayoutEffect)(()=>(i({startExtra:null,main:(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),(0,z.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:n.subtitle})]}),end:me}),()=>A()),[A,me,n.subtitle,n.title,i]);let he=(0,R.useCallback)(async e=>{e.preventDefault();let t=J.trim(),n=X.trim();if(!(!t||!n||q)){ue(!0),K(null);try{let e=await E({name:t,...Y.trim()?{description:Y.trim()}:{},workspaceRoot:n});M(t=>[e,...t.filter(t=>t.id!==e.id)]),de(``),fe(``),pe(``),G(!1),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}catch(e){K(e instanceof Error?e.message:String(e))}finally{ue(!1)}}},[q,Y,J,X]),ge=(0,R.useCallback)(async(e,t)=>{W(e.id),I(null);try{let n;n=t===`pin`?e.pinnedAt?await C(e.id):await D(e.id):e.status===`archived`?await ne(e.id):await S(e.id),M(e=>e.map(e=>e.id===n.id?n:e)),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}catch(e){I(e instanceof Error?e.message:String(e))}finally{W(null)}},[]),_e=[{id:`active`,label:t.statuses.active},{id:`paused`,label:t.statuses.paused},{id:`archived`,label:t.statuses.archived},{id:`all`,label:t.all}],ve=_e.find(e=>e.id===U)?.label??t.all,ye=n.resultCount.replace(`{{status}}`,ve).replace(`{{count}}`,String($.length));return(0,z.jsxs)(`main`,{className:`flex w-full flex-1 flex-col gap-5 px-3 py-6 sm:px-5 xl:px-6`,children:[(0,z.jsx)(x,{open:ce,onOpenChange:e=>{G(e),e||K(null)},children:(0,z.jsxs)(v,{children:[(0,z.jsx)(h,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,z.jsxs)(y,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(34rem,calc(100vh-2rem))] w-[min(38rem,calc(100vw-2rem))] -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,z.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,z.jsx)(b,{className:`text-base font-semibold text-fg`,children:t.createTitle}),(0,z.jsx)(g,{className:`mt-1 text-sm text-fg-muted`,children:t.createDescription})]}),(0,z.jsxs)(`form`,{onSubmit:he,className:`flex min-h-0 flex-1 flex-col`,children:[(0,z.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,z.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[t.projectName,(0,z.jsx)(`input`,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 font-normal outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`,value:J,onChange:e=>de(e.target.value),maxLength:160})]}),(0,z.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[n.descriptionLabel,(0,z.jsx)(`textarea`,{className:`min-h-28 resize-none rounded-lg border border-edge bg-surface-base px-3 py-2 font-normal leading-6 outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`,value:Y,onChange:e=>fe(e.target.value),maxLength:2e3,placeholder:n.descriptionPlaceholder})]}),(0,z.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,z.jsx)(`span`,{className:`font-medium text-fg`,children:t.workspaceRoot}),(0,z.jsxs)(`button`,{type:`button`,className:`flex min-h-12 w-full items-center gap-3 rounded-lg border border-edge bg-surface-base px-3 py-2 text-left outline-none transition-colors hover:bg-surface-hover focus-visible:border-accent focus-visible:ring-2 focus-visible:ring-accent/20 disabled:cursor-not-allowed disabled:opacity-60`,onClick:Z.pick,disabled:q||Z.picking,children:[Z.picking?(0,z.jsx)(s,{className:`size-5 shrink-0 animate-spin text-accent`,"aria-hidden":!0}):(0,z.jsx)(te,{className:`size-5 shrink-0 text-accent`,"aria-hidden":!0}),(0,z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:X?r.chooseFolder:r.selectWorkingDirectory}),(0,z.jsx)(`span`,{className:d(`mt-0.5 block truncate font-mono text-xs font-normal`,X?`text-fg-muted`:`text-fg-subtle`),title:X||void 0,children:X||t.workspaceSelectionPlaceholder})]})]}),(0,z.jsx)(`p`,{className:`text-xs font-normal text-fg-subtle`,children:t.workspaceSelectionHint})]}),le?(0,z.jsx)(`p`,{className:`rounded-lg bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:le}):null]}),(0,z.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,z.jsx)(_,{asChild:!0,children:(0,z.jsx)(f,{type:`button`,variant:`ghost`,children:t.cancel})}),(0,z.jsx)(f,{type:`submit`,variant:`primary`,disabled:q||!J.trim()||!X.trim(),children:q?t.home.creating:t.create})]})]})]})]})}),Z.hasNativePicker?null:(0,z.jsx)(w,{open:Z.modalOpen,onOpenChange:Z.setModalOpen,initialAbsolutePath:X||void 0,onConfirm:Z.confirmPick,wd:r}),(0,z.jsxs)(`section`,{className:`flex min-h-10 flex-wrap items-center justify-between gap-3`,"aria-label":n.filterLabel,children:[(0,z.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,"aria-live":`polite`,children:ye}),(0,z.jsxs)(`div`,{className:d(`ml-auto flex min-w-0 items-center justify-end gap-2`,V&&`w-full sm:w-auto`),children:[V?(0,z.jsxs)(`div`,{className:`relative min-w-0 flex-1 sm:w-64 sm:flex-none`,children:[(0,z.jsx)(l,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,z.jsx)(`input`,{autoFocus:!0,className:`h-9 w-full rounded-lg border border-edge bg-surface-panel pl-9 pr-9 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:L,onChange:e=>B(e.target.value),placeholder:t.searchPlaceholder,"aria-label":t.searchPlaceholder}),(0,z.jsx)(`button`,{type:`button`,className:`absolute right-1.5 top-1/2 flex size-6 -translate-y-1/2 items-center justify-center rounded-md text-fg-subtle transition-colors hover:bg-surface-hover hover:text-fg`,onClick:()=>{B(``),H(!1)},"aria-label":n.clearSearch,title:n.clearSearch,children:(0,z.jsx)(u,{className:`size-3.5`,"aria-hidden":!0})})]}):(0,z.jsx)(f,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,onClick:()=>H(!0),"aria-label":t.searchPlaceholder,title:t.searchPlaceholder,children:(0,z.jsx)(l,{className:`size-4`,"aria-hidden":!0})}),(0,z.jsx)(a,{className:`w-28 sm:w-32`,triggerClassName:`h-9 border-edge bg-surface-panel px-2.5 text-xs font-medium`,contentClassName:`min-w-36`,align:`end`,value:U,"aria-label":n.filterLabel,onChange:e=>oe(e.target.value),children:_e.map(e=>(0,z.jsx)(o,{value:e.id,children:e.label},e.id))})]})]}),F?(0,z.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`,role:`alert`,children:[(0,z.jsx)(`span`,{children:F}),(0,z.jsx)(f,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void Q(),children:t.home.retry})]}):null,N?(0,z.jsx)(ie,{}):$.length?(0,z.jsx)(`section`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:$.map(e=>(0,z.jsx)(ae,{project:e,busy:se===e.id,onTogglePin:()=>void ge(e,`pin`),onToggleArchive:()=>void ge(e,`archive`)},e.id))}):(0,z.jsxs)(`section`,{className:`rounded-xl border border-dashed border-edge p-10 text-center`,children:[(0,z.jsx)(ee,{className:`mx-auto size-7 text-fg-subtle`,"aria-hidden":!0}),(0,z.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-fg`,children:n.emptyTitle}),(0,z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:n.emptyHint})]})]})}export{U as ProjectsPage};
|
|
@@ -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{p as i,t as a}from"./chunk-KS7C4IRE-BaASWQor.js";import{t as o}from"./check-DUBLcKHA.js";import{t as s}from"./copy-Dv6d4Dvw.js";import{t as c}from"./external-link-DjqjBmc3.js";import{t as l}from"./globe-DSSGFWFn.js";import{t as u}from"./loader-circle-CifKLtgG.js";import{t as d}from"./cn-JdwAhgNB.js";import{t as f}from"./button-CSEbl4zT.js";import{s as p}from"./form-field-width-DJw_jULe.js";import{t as m}from"./copy-to-clipboard-HOJ79TWv.js";import{t as h}from"./messages-BMdD0LWk.js";import{a as g,i as _,l as v,n as y,o as b,r as x,s as S}from"./locale-store-CXhjfe4q.js";import{i as C,o as w}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{a as T,i as E,o as D,r as O,s as k,t as A}from"./dist-BPoKqzeH.js";import{a as j,i as M}from"./vendor-swr-BIWyz7Rc.js";import{n as N,r as P}from"./gateway-config-swr-BWGjnmDl.js";import{Bi as F,Br as I,Ds as L,Fr as R,Gl as z,Gr as B,Gs as V,Hr as H,Ir as U,Lr as W,Ml as G,Mr as K,Nr as q,On as ee,Pr as te,Qs as J,Rr as Y,Sn as ne,Ul as X,Ur as re,Us as ie,Vr as ae,Wr as oe,Ya as se,as as ce,ea as le,go as ue,js as de,nc as fe,no as pe,qc as me,sc as he,us as ge,wn as _e,xc as ve,xn as ye,zr as be}from"./index-Bbd_dXui.js";import{n as xe,r as Se,t as Ce}from"./settings-page-layout-BRQNel6r.js";import{t as we}from"./settings-advanced-gate-xlhdRTME.js";import{n as Te,r as Ee,t as De}from"./settings-form-section-Coy1Cbp6.js";import{n as Oe,r as ke,t as Ae}from"./oauth-authorization-window-Cdolr2wE.js";import{t as je}from"./tab-completion-input-D64VNmiA.js";import{t as Me}from"./browser-BLJWD7WI.js";import{t as Ne}from"./page-tabs-BaEQMYm_.js";var Z=n(),Q=e(t(),1),$=r();function Pe(e){let t=(0,Z.c)(26),{showLabel:n,hideLabel:r,icon:i,hint:a,children:o,className:s,defaultOpen:c,advancedOnly:l}=e,u=l===void 0?!1:l,[f,p]=(0,Q.useState)(c??!1),m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=e=>p(e.currentTarget.open),t[0]=m):m=t[0];let h;t[1]===s?h=t[2]:(h=d(`group rounded-2xl bg-surface-base open:pb-1`,s),t[1]=s,t[2]=h);let g;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(z,{className:`size-4 shrink-0 text-fg-muted transition-transform group-open:rotate-180`,"aria-hidden":!0}),t[3]=g):g=t[3];let _;t[4]===i?_=t[5]:(_=i?(0,$.jsx)(i,{className:`size-4 shrink-0 text-accent`,strokeWidth:1.75,"aria-hidden":!0}):null,t[4]=i,t[5]=_);let v;t[6]===n?v=t[7]:(v=(0,$.jsx)(`span`,{className:`group-open:hidden`,children:n}),t[6]=n,t[7]=v);let y;t[8]===r?y=t[9]:(y=(0,$.jsx)(`span`,{className:`hidden group-open:inline`,children:r}),t[8]=r,t[9]=y);let b;t[10]!==_||t[11]!==v||t[12]!==y?(b=(0,$.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 rounded-2xl px-4 py-3.5 text-sm font-medium text-fg transition-colors hover:text-fg group-open:rounded-b-none [&::-webkit-details-marker]:hidden`,children:[g,_,v,y]}),t[10]=_,t[11]=v,t[12]=y,t[13]=b):b=t[13];let x;t[14]===a?x=t[15]:(x=a?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:a}):null,t[14]=a,t[15]=x);let S;t[16]!==o||t[17]!==x?(S=(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 px-4 pb-4 pt-1`,children:[x,o]}),t[16]=o,t[17]=x,t[18]=S):S=t[18];let C;t[19]!==f||t[20]!==S||t[21]!==h||t[22]!==b?(C=(0,$.jsxs)(`details`,{open:f,onToggle:m,className:h,children:[b,S]}),t[19]=f,t[20]=S,t[21]=h,t[22]=b,t[23]=C):C=t[23];let w=C;if(u){let e;return t[24]===w?e=t[25]:(e=(0,$.jsx)(we,{children:w}),t[24]=w,t[25]=e),e}return w}function Fe(e,t){let{mutate:n}=j(),[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(!1),l=(0,Q.useCallback)(async()=>{await Promise.all([n(`tunnel-pair-context`),n(`tunnel-pair`),n(`tunnel-status`),N()])},[n]);return{busy:r,error:a,confirmOpen:s,setConfirmOpen:c,runEnableLanPairing:(0,Q.useCallback)(async()=>{if(!(!e||r)){i(!0),o(null);try{let n=await U();if(!n.ok)throw Error(`Failed to enable LAN pairing`);if(n.requiresRestart){let t=await K();if(!t.ok)throw Error(t.message??`Gateway restart failed`);if(!await q(e))throw Error(`Gateway did not come back online in time`)}let r=n.requiresRestart?await te():n.context;if(!r?.pairingReady)throw Error(`LAN pairing is still not ready after restart`);return await l(),t?.(r),c(!1),r}catch(e){return o(e instanceof Error?e.message:`Enable LAN pairing failed`),null}finally{i(!1)}}},[r,e,t,l]),clearError:()=>o(null)}}function Ie(){return d(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,p,`dark:border-edge`)}function Le(e){let t=(0,Z.c)(122),{pairQr:n,gatewayToken:r,streamlined:i,lanOnly:o,onRefreshQr:s}=e,c=i===void 0?!1:i,l=o===void 0?!1:o,p=y(Be),m;t[0]===p?m=t[1]:(m=h(p),t[0]=p,t[1]=m);let g=m,_=g.tunnelSettings,v=l?g.remoteAccess.lan:null,b;t[2]!==g.clipboard.copyFailed||t[3]!==_.pairCopied||t[4]!==_.pairCopyLink?(b={copy:_.pairCopyLink,copied:_.pairCopied,copyFailed:g.clipboard.copyFailed},t[2]=g.clipboard.copyFailed,t[3]=_.pairCopied,t[4]=_.pairCopyLink,t[5]=b):b=t[5];let x=b,{tunnelActive:S,tunnelStatus:C,tunnelQr:w,pairContext:T,pairBaseUrl:E,setPairBaseUrl:D,applySuggestedPairUrl:O,applyCandidateUrl:k,resetPairBaseFromContext:A,baseOk:j,localhostWarn:M,pairingBlocked:N,deepLink:P,qrPayload:I,qrDataUrl:L,qrGenFailed:R,encoding:z}=n,B;t[6]===A?B=t[7]:(B=e=>{A(e.recommended.url)},t[6]=A,t[7]=B);let V=Fe(r,B),H,U,W,G,K;if(t[8]!==k||t[9]!==O||t[10]!==j||t[11]!==V||t[12]!==r||t[13]!==v||t[14]!==l||t[15]!==M||t[16]!==s||t[17]!==E||t[18]!==T?.candidates||t[19]!==T?.recommended||t[20]!==N||t[21]!==D||t[22]!==c||t[23]!==_.pairBaseUrlHint||t[24]!==_.pairBaseUrlLabel||t[25]!==_.pairBaseUrlPlaceholder||t[26]!==_.pairBlockedLoopbackBody||t[27]!==_.pairBlockedNextSteps||t[28]!==_.pairBlockedTitle||t[29]!==_.pairCandidatesTitle||t[30]!==_.pairEnableLanButton||t[31]!==_.pairEnableLanEnabling||t[32]!==_.pairEnableLanSecurityAuditLink||t[33]!==_.pairInvalidBaseUrl||t[34]!==_.pairLocalhostWarning||t[35]!==_.pairSelectCandidateHint||t[36]!==_.pairSelectCandidateTitle||t[37]!==_.pairSubtitle||t[38]!==_.pairSuggestedLanLabel||t[39]!==_.pairTitle||t[40]!==_.pairTunnelActive||t[41]!==_.pairTunnelLanUrl||t[42]!==_.pairTunnelPublicUrl||t[43]!==_.pairUseSuggestedUrl||t[44]!==_.pairWaitingForTunnel||t[45]!==_.refreshQr||t[46]!==S||t[47]!==w||t[48]!==C?.publicUrl){K=Symbol.for(`react.early_return_sentinel`);bb0:{let e=T?.candidates.filter(ze)??[],n=l?(e.find(Re)?.url??e[0]?.url??``).trim():T?.recommended.url?.trim()??``,i=(l||!S)&&e.length>1,o=function(t){if(e.length===0)return null;let n=t===`amber`?`text-amber-950 dark:text-amber-100`:`text-fg`,r=t===`amber`?`text-amber-950/80 dark:text-amber-200/90`:`text-fg-muted`;return(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:d(`text-xs font-medium`,r),children:i?_.pairSelectCandidateTitle:_.pairCandidatesTitle}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1`,children:e.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,className:d(`w-full rounded-md border px-2 py-1.5 text-left font-mono text-[11px] transition-colors`,t===`amber`?`border-amber-300/70 hover:bg-amber-100/80 dark:border-amber-800 dark:hover:bg-amber-950/50`:`border-edge hover:bg-surface-panel`,E.trim()===e.url&&`border-accent bg-accent/5`,n),onClick:()=>k(e.url),children:[e.label?`${e.label}: `:``,e.url]})},e.url))}),i?(0,$.jsx)(`p`,{className:d(`mt-1 text-[11px] leading-relaxed`,r),children:_.pairSelectCandidateHint}):null]})};if(H=c&&!l,H&&!S){let e;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(ie,{className:`size-4 text-accent`,strokeWidth:1.75}),t[54]=e):e=t[54];let n;t[55]===_.pairTitle?n=t[56]:(n=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[e,_.pairTitle]}),t[55]=_.pairTitle,t[56]=n);let r;t[57]===_.pairWaitingForTunnel?r=t[58]:(r=(0,$.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:_.pairWaitingForTunnel}),t[57]=_.pairWaitingForTunnel,t[58]=r);let i;t[59]!==n||t[60]!==r?(i=(0,$.jsxs)(De,{children:[n,r]}),t[59]=n,t[60]=r,t[61]=i):i=t[61],K=i;break bb0}let p=v?.pairTitle??_.pairTitle,m=l?v?.pairSubtitle??_.pairSubtitle:S?_.pairTunnelActive:_.pairSubtitle,h=!!(s&&(l||c&&S)),g=H?`mb-2`:`mb-3`,y;t[62]===g?y=t[63]:(y=d(`flex flex-wrap items-start justify-between gap-2`,g),t[62]=g,t[63]=y);let b;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(ie,{className:`size-4 text-accent`,strokeWidth:1.75}),t[64]=b):b=t[64];let x;t[65]===p?x=t[66]:(x=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[b,p]}),t[65]=p,t[66]=x);let A;t[67]!==H||t[68]!==m||t[69]!==_.pairSubtitle?(A=H?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:_.pairSubtitle}):(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:m}),t[67]=H,t[68]=m,t[69]=_.pairSubtitle,t[70]=A):A=t[70];let P;t[71]!==x||t[72]!==A?(P=(0,$.jsxs)(`div`,{children:[x,A]}),t[71]=x,t[72]=A,t[73]=P):P=t[73];let F;t[74]!==s||t[75]!==h||t[76]!==_.refreshQr?(F=h?(0,$.jsxs)(f,{type:`button`,variant:`ghost`,className:`shrink-0`,onClick:()=>void s(),children:[(0,$.jsx)(fe,{className:`size-4`}),_.refreshQr]}):null,t[74]=s,t[75]=h,t[76]=_.refreshQr,t[77]=F):F=t[77],t[78]!==y||t[79]!==P||t[80]!==F?(U=(0,$.jsxs)(`div`,{className:y,children:[P,F]}),t[78]=y,t[79]=P,t[80]=F,t[81]=U):U=t[81],W=N?(0,$.jsxs)(`div`,{className:`mb-3 space-y-3 rounded-lg border border-amber-200 bg-amber-50 p-3 dark:border-amber-900/50 dark:bg-amber-950/30`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-sm font-medium text-amber-950 dark:text-amber-100`,children:_.pairBlockedTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-amber-900 dark:text-amber-200`,children:_.pairBlockedLoopbackBody})]}),n?(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-amber-950/80 dark:text-amber-200/90`,children:_.pairSuggestedLanLabel}),(0,$.jsx)(`div`,{className:`mt-0.5 break-all font-mono text-xs text-amber-950 dark:text-amber-100`,children:n})]}),(0,$.jsx)(f,{type:`button`,variant:`secondary`,className:`w-full sm:w-auto`,onClick:O,children:_.pairUseSuggestedUrl})]}):null,e.length>0?o(`amber`):null,(0,$.jsx)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:flex-wrap`,children:(0,$.jsxs)(f,{type:`button`,className:`w-full sm:w-auto`,disabled:V.busy||!r,onClick:()=>V.setConfirmOpen(!0),children:[V.busy?(0,$.jsx)(u,{className:`size-3.5 animate-spin`}):null,V.busy?_.pairEnableLanEnabling:_.pairEnableLanButton]})}),V.error?(0,$.jsx)(`p`,{className:`text-xs text-red-800 dark:text-red-200`,children:V.error}):null,(0,$.jsx)(`p`,{className:`text-xs leading-relaxed text-amber-900 dark:text-amber-200`,children:l?v?.pairBlockedNextSteps??_.pairBlockedNextSteps:_.pairBlockedNextSteps}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(a,{to:`/settings/gateway`,className:`inline-block text-xs font-medium text-accent hover:underline`,children:_.pairEnableLanSecurityAuditLink}),l&&v?.pairPublicTabLink?(0,$.jsx)(a,{to:`/settings/remote-access?tab=public`,className:`inline-block text-xs font-medium text-accent hover:underline`,children:v.pairPublicTabLink}):null]})]}):null,G=S&&!l?H?null:(0,$.jsxs)(`div`,{className:`mb-3 space-y-2 rounded-lg bg-surface-panel/80 p-3 shadow-surface`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:_.pairTunnelPublicUrl}),(0,$.jsx)(`div`,{className:`mt-0.5 break-all font-mono text-xs text-fg`,children:C?.publicUrl})]}),w?.lanUrl?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:_.pairTunnelLanUrl}),(0,$.jsx)(`div`,{className:`mt-0.5 break-all font-mono text-xs text-fg`,children:w.lanUrl})]}):null]}):(0,$.jsxs)(`div`,{className:`mb-3 space-y-1.5`,children:[(0,$.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`tunnel-mobile-pair-base`,children:_.pairBaseUrlLabel}),(0,$.jsx)(je,{id:`tunnel-mobile-pair-base`,className:d(Ie(),`font-mono text-xs`),type:`text`,autoComplete:`off`,spellCheck:!1,placeholder:n||_.pairBaseUrlPlaceholder,value:E,onChange:e=>D(e.target.value),suggestion:n||null,onAcceptSuggestion:D}),(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:_.pairBaseUrlHint}),!j&&E.trim()?(0,$.jsx)(`p`,{className:`text-xs text-amber-800 dark:text-amber-200`,children:_.pairInvalidBaseUrl}):null,M?(0,$.jsx)(`p`,{className:`rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:border-amber-800 dark:bg-amber-950/40 dark:text-amber-100`,children:_.pairLocalhostWarning}):null,i?o(`neutral`):null]})}t[8]=k,t[9]=O,t[10]=j,t[11]=V,t[12]=r,t[13]=v,t[14]=l,t[15]=M,t[16]=s,t[17]=E,t[18]=T?.candidates,t[19]=T?.recommended,t[20]=N,t[21]=D,t[22]=c,t[23]=_.pairBaseUrlHint,t[24]=_.pairBaseUrlLabel,t[25]=_.pairBaseUrlPlaceholder,t[26]=_.pairBlockedLoopbackBody,t[27]=_.pairBlockedNextSteps,t[28]=_.pairBlockedTitle,t[29]=_.pairCandidatesTitle,t[30]=_.pairEnableLanButton,t[31]=_.pairEnableLanEnabling,t[32]=_.pairEnableLanSecurityAuditLink,t[33]=_.pairInvalidBaseUrl,t[34]=_.pairLocalhostWarning,t[35]=_.pairSelectCandidateHint,t[36]=_.pairSelectCandidateTitle,t[37]=_.pairSubtitle,t[38]=_.pairSuggestedLanLabel,t[39]=_.pairTitle,t[40]=_.pairTunnelActive,t[41]=_.pairTunnelLanUrl,t[42]=_.pairTunnelPublicUrl,t[43]=_.pairUseSuggestedUrl,t[44]=_.pairWaitingForTunnel,t[45]=_.refreshQr,t[46]=S,t[47]=w,t[48]=C?.publicUrl,t[49]=H,t[50]=U,t[51]=W,t[52]=G,t[53]=K}else H=t[49],U=t[50],W=t[51],G=t[52],K=t[53];if(K!==Symbol.for(`react.early_return_sentinel`))return K;let q;t[82]===_.pairSecurityNote?q=t[83]:(q=(0,$.jsx)(`p`,{className:`mb-3 text-xs text-fg-subtle`,children:_.pairSecurityNote}),t[82]=_.pairSecurityNote,t[83]=q);let ee;t[84]!==x||t[85]!==P||t[86]!==z||t[87]!==N||t[88]!==L||t[89]!==R||t[90]!==_.pairEncoding||t[91]!==_.pairImageError||t[92]!==_.pairQrDisabled?(ee=P?(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-3 sm:items-start`,children:[L&&!R?(0,$.jsx)(`img`,{src:L,alt:``,className:`size-56 rounded-lg border border-edge-subtle bg-white object-contain p-3 dark:border-edge`}):null,z?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:_.pairEncoding}):null,R?(0,$.jsx)(`p`,{className:`text-center text-sm text-fg-muted sm:text-left`,children:_.pairImageError}):null,(0,$.jsx)(le,{text:P,labels:x})]}):N?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:_.pairQrDisabled}):null,t[84]=x,t[85]=P,t[86]=z,t[87]=N,t[88]=L,t[89]=R,t[90]=_.pairEncoding,t[91]=_.pairImageError,t[92]=_.pairQrDisabled,t[93]=ee):ee=t[93];let te;t[94]!==H||t[95]!==I||t[96]!==_.deeplinkTitle?(te=I&&!H?(0,$.jsxs)(`details`,{className:`mt-3 rounded-lg bg-surface-panel/80 px-3 py-2 shadow-surface`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-xs font-medium text-fg-muted`,children:_.deeplinkTitle}),(0,$.jsx)(`p`,{className:`mt-2 break-all font-mono text-[10px] leading-relaxed text-fg-subtle`,children:I})]}):null,t[94]=H,t[95]=I,t[96]=_.deeplinkTitle,t[97]=te):te=t[97];let J;t[98]!==H||t[99]!==_.pairMobileProbeHint||t[100]!==_.pairSchemeHint?(J=H?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`mt-3 break-all font-mono text-[10px] leading-relaxed text-fg-subtle`,children:_.pairSchemeHint}),(0,$.jsx)(`p`,{className:`mt-1 text-[10px] leading-relaxed text-fg-subtle`,children:_.pairMobileProbeHint})]}),t[98]=H,t[99]=_.pairMobileProbeHint,t[100]=_.pairSchemeHint,t[101]=J):J=t[101];let Y,ne;t[102]===V?(Y=t[103],ne=t[104]):(Y=()=>void V.runEnableLanPairing(),ne=()=>{V.busy||V.setConfirmOpen(!1)},t[102]=V,t[103]=Y,t[104]=ne);let X;t[105]!==V.confirmOpen||t[106]!==_.consentCancel||t[107]!==_.pairEnableLanButton||t[108]!==_.pairEnableLanConfirmBody||t[109]!==_.pairEnableLanConfirmTitle||t[110]!==Y||t[111]!==ne?(X=(0,$.jsx)(F,{open:V.confirmOpen,title:_.pairEnableLanConfirmTitle,description:_.pairEnableLanConfirmBody,confirmLabel:_.pairEnableLanButton,cancelLabel:_.consentCancel,onConfirm:Y,onCancel:ne}),t[105]=V.confirmOpen,t[106]=_.consentCancel,t[107]=_.pairEnableLanButton,t[108]=_.pairEnableLanConfirmBody,t[109]=_.pairEnableLanConfirmTitle,t[110]=Y,t[111]=ne,t[112]=X):X=t[112];let re;return t[113]!==q||t[114]!==ee||t[115]!==te||t[116]!==J||t[117]!==X||t[118]!==U||t[119]!==W||t[120]!==G?(re=(0,$.jsx)(De,{children:(0,$.jsxs)($.Fragment,{children:[U,W,G,q,ee,te,J,X]})}),t[113]=q,t[114]=ee,t[115]=te,t[116]=J,t[117]=X,t[118]=U,t[119]=W,t[120]=G,t[121]=re):re=t[121],re}function Re(e){return e.reachable}function ze(e){return e.kind===`lan`}function Be(e){return e.language}function Ve(e){let t=(0,Z.c)(40),{open:n,title:r,intro:i,bullets:a,checkboxLabel:o,confirmLabel:s,cancelLabel:c,onConfirm:l,onCancel:u}=e,[p,m]=(0,Q.useState)(!1),h;t[0]===u?h=t[1]:(h=e=>{e||(m(!1),u())},t[0]=u,t[1]=h);let g;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(T,{className:d(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,w)}),t[2]=g):g=t[2];let _;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(_=d(`fixed left-1/2 top-1/2 max-h-[min(90vh,40rem)] w-[min(100%-2rem,32rem)] -translate-x-1/2 -translate-y-1/2`,`overflow-y-auto rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`,C),t[3]=_):_=t[3];let v;t[4]===r?v=t[5]:(v=(0,$.jsx)(k,{className:`text-base font-semibold text-fg`,children:r}),t[4]=r,t[5]=v);let y;t[6]===i?y=t[7]:(y=(0,$.jsx)(E,{className:`mt-2 text-sm text-fg-muted`,children:i}),t[6]=i,t[7]=y);let b;t[8]===a?b=t[9]:(b=a.map(He),t[8]=a,t[9]=b);let x;t[10]===b?x=t[11]:(x=(0,$.jsx)(`ul`,{className:`mt-4 list-disc space-y-2 pl-5 text-sm text-fg-muted`,children:b}),t[10]=b,t[11]=x);let S;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>m(e.target.checked),t[12]=S):S=t[12];let j;t[13]===p?j=t[14]:(j=(0,$.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 size-4 shrink-0 rounded border-edge accent-accent`,checked:p,onChange:S}),t[13]=p,t[14]=j);let M;t[15]===o?M=t[16]:(M=(0,$.jsx)(`span`,{children:o}),t[15]=o,t[16]=M);let N;t[17]!==M||t[18]!==j?(N=(0,$.jsxs)(`label`,{className:`mt-5 flex cursor-pointer items-start gap-3 text-sm text-fg`,children:[j,M]}),t[17]=M,t[18]=j,t[19]=N):N=t[19];let P;t[20]!==c||t[21]!==u?(P=(0,$.jsx)(f,{type:`button`,variant:`secondary`,onClick:u,children:c}),t[20]=c,t[21]=u,t[22]=P):P=t[22];let F=!p,I;t[23]!==s||t[24]!==l||t[25]!==F?(I=(0,$.jsx)(f,{type:`button`,disabled:F,onClick:l,children:s}),t[23]=s,t[24]=l,t[25]=F,t[26]=I):I=t[26];let L;t[27]!==P||t[28]!==I?(L=(0,$.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[P,I]}),t[27]=P,t[28]=I,t[29]=L):L=t[29];let R;t[30]!==N||t[31]!==L||t[32]!==v||t[33]!==y||t[34]!==x?(R=(0,$.jsxs)(D,{children:[g,(0,$.jsxs)(O,{className:_,onOpenAutoFocus:Ue,children:[v,y,x,N,L]})]}),t[30]=N,t[31]=L,t[32]=v,t[33]=y,t[34]=x,t[35]=R):R=t[35];let z;return t[36]!==n||t[37]!==h||t[38]!==R?(z=(0,$.jsx)(A,{open:n,onOpenChange:h,children:R}),t[36]=n,t[37]=h,t[38]=R,t[39]=z):z=t[39],z}function He(e){return(0,$.jsx)(`li`,{children:e},e)}function Ue(e){return e.preventDefault()}function We(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var Ge=[`preparing_frpc`,`registering`,`starting_frpc`];function Ke(e){return e?e===`reconnecting_frpc`?Ge.indexOf(`starting_frpc`):Ge.indexOf(e):-1}function qe(e,t){if(t.state===`connected`)return`done`;let n=t.startProgress?.phase,r=Ge.indexOf(e),i=Ke(n);return i<0?t.state===`connecting`||t.state===`reconnecting`?`active`:`pending`:r<i?`done`:r===i?`active`:`pending`}function Je(e,t,n){let r=n.startProgress;return qe(t,n)===`active`?t===`preparing_frpc`&&n.frpcDownload?n.frpcDownload.phase===`extracting`?e.frpcExtracting:n.frpcDownload.percent==null?e.frpcDownloading:e.frpcDownloadingPercent.replace(`{{percent}}`,String(n.frpcDownload.percent)):t===`registering`&&r?.publicUrl?e.stepRegisterDetail:t===`starting_frpc`?r?.phase===`reconnecting_frpc`?e.stepReconnectDetail:e.stepFrpcDetail:null:null}function Ye(e,t){switch(t){case`preparing_frpc`:return e.stepPrepareFrpc;case`registering`:return e.stepRegister;case`starting_frpc`:return e.stepFrpcLogin}}function Xe(e){if(!e)return null;let t=Math.max(0,Math.floor((Date.now()-new Date(e).getTime())/1e3));return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function Ze(e){let t=(0,Z.c)(31),{status:n,t:r}=e,[,i]=(0,Q.useState)(0),a;t[0]!==i||t[1]!==n.state?(a=()=>{if(n.state!==`connecting`&&n.state!==`reconnecting`)return;let e=window.setInterval(()=>i(Qe),1e3);return()=>window.clearInterval(e)},t[0]=i,t[1]=n.state,t[2]=a):a=t[2];let s=n.startProgress?.startedAt,c;if(t[3]!==n.state||t[4]!==s?(c=[n.state,s],t[3]=n.state,t[4]=s,t[5]=c):c=t[5],(0,Q.useEffect)(a,c),!(n.state===`connecting`||n.state===`reconnecting`||n.state===`connected`&&n.startProgress))return null;let l,f,p,m,h;if(t[6]!==n||t[7]!==r){let e=Xe(n.startProgress?.startedAt);l=!!n.publicUrl&&n.state!==`connected`&&n.startProgress?.phase!==`registering`,f=`mt-3 space-y-3 rounded-lg bg-surface-panel/80 p-3 shadow-surface`;let i;t[13]===r.startProgressTitle?i=t[14]:(i=(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:r.startProgressTitle}),t[13]=r.startProgressTitle,t[14]=i);let a;t[15]===r.startProgressHint?a=t[16]:(a=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:r.startProgressHint}),t[15]=r.startProgressHint,t[16]=a),t[17]!==i||t[18]!==a?(p=(0,$.jsxs)(`div`,{children:[i,a]}),t[17]=i,t[18]=a,t[19]=p):p=t[19];let s=Ge.map(e=>{let t=qe(e,n),i=Je(r,e,n);return(0,$.jsxs)(`li`,{className:`flex gap-2 text-xs`,children:[(0,$.jsx)(`span`,{className:`mt-0.5 shrink-0 text-fg-subtle`,"aria-hidden":!0,children:t===`done`?(0,$.jsx)(o,{className:`size-3.5 text-emerald-600 dark:text-emerald-400`}):t===`active`?(0,$.jsx)(u,{className:`size-3.5 animate-spin text-accent`}):(0,$.jsx)(G,{className:`size-3.5`})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:d(`font-medium`,t===`active`?`text-fg`:t===`done`?`text-fg-muted`:`text-fg-subtle`),children:Ye(r,e)}),i?(0,$.jsx)(`div`,{className:`mt-0.5 text-fg-muted`,children:i}):null,e===`preparing_frpc`&&t===`active`&&n.frpcDownload&&n.frpcDownload.phase===`downloading`?(0,$.jsxs)(`div`,{className:`mt-2 space-y-1`,children:[(0,$.jsx)(`div`,{className:`h-1.5 w-full overflow-hidden rounded-full bg-surface-panel`,children:(0,$.jsx)(`div`,{className:d(`h-full rounded-full bg-accent transition-[width] duration-300`,n.frpcDownload.percent==null&&`w-1/3 animate-pulse`),style:n.frpcDownload.percent==null?void 0:{width:`${n.frpcDownload.percent}%`}})}),n.frpcDownload.bytesReceived!=null&&n.frpcDownload.totalBytes?(0,$.jsxs)(`p`,{className:`text-fg-subtle`,children:[We(n.frpcDownload.bytesReceived),` /`,` `,We(n.frpcDownload.totalBytes)]}):null]}):null,e===`preparing_frpc`&&t===`active`&&n.frpcDownload?.url?(0,$.jsxs)(`p`,{className:`mt-2 text-fg-subtle`,children:[(0,$.jsxs)(`span`,{className:`font-sans`,children:[r.frpcDownloadingUrlLabel,`: `]}),(0,$.jsx)(`a`,{href:n.frpcDownload.url,target:`_blank`,rel:`noopener noreferrer`,className:`break-all font-mono text-[11px] text-accent hover:underline`,children:n.frpcDownload.url})]}):null]})]},e)});t[20]===s?m=t[21]:(m=(0,$.jsx)(`ol`,{className:`space-y-2`,children:s}),t[20]=s,t[21]=m),h=e&&n.startProgress?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:r.startProgressElapsed.replace(`{{elapsed}}`,e)}):null,t[6]=n,t[7]=r,t[8]=l,t[9]=f,t[10]=p,t[11]=m,t[12]=h}else l=t[8],f=t[9],p=t[10],m=t[11],h=t[12];let g;t[22]!==l||t[23]!==r.publicUrlPendingNotice?(g=l?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.publicUrlPendingNotice}):null,t[22]=l,t[23]=r.publicUrlPendingNotice,t[24]=g):g=t[24];let _;return t[25]!==f||t[26]!==p||t[27]!==m||t[28]!==h||t[29]!==g?(_=(0,$.jsxs)(`div`,{className:f,children:[p,m,h,g]}),t[25]=f,t[26]=p,t[27]=m,t[28]=h,t[29]=g,t[30]=_):_=t[30],_}function Qe(e){return e+1}function $e(e,t){return t.state===`connected`?e.statusConnected:t.state===`error`?e.statusError:t.startProgress?.phase===`reconnecting_frpc`?e.statusReconnecting:t.startProgress?.phase===`starting_frpc`?e.statusStartingFrpc:t.startProgress?.phase===`registering`?e.statusRegistering:t.startProgress?.phase===`preparing_frpc`||t.frpcDownload?e.statusPreparingFrpc:t.state===`connecting`||t.state===`reconnecting`?e.statusConnecting:e.statusOff}function et(e){return e.state===`connected`?`connected`:e.state===`error`?`error`:e.state===`connecting`||e.state===`reconnecting`||e.startProgress||e.frpcDownload?`progress`:`off`}function tt(e){switch(e){case`connected`:return`bg-emerald-500/15 text-emerald-700 dark:text-emerald-400`;case`progress`:return`bg-amber-500/15 text-amber-700 dark:text-amber-400`;case`error`:return`bg-red-500/15 text-red-700 dark:text-red-400`;default:return`bg-surface-hover text-fg-muted`}}function nt(e){if(!e)return`—`;let t=Date.now()-new Date(e).getTime();if(t<0)return`—`;let n=Math.floor(t/6e4);return n<60?`${n}m`:`${Math.floor(n/60)}h ${n%60}m`}function rt(e){let t=(0,Z.c)(61),{t:n,status:r,isLoading:i,statusErr:a,starting:o,stopping:s,showConsentExpired:c,copyLabels:p,startDisabled:m,startDisabledReason:h,stepLabel:g,onStart:_,onStop:v}=e,y=m===void 0?!1:m,b,x,S,C,w,T,E;t[0]!==r||t[1]!==o?(E=et(r),b=r.enabled||o,x=o||r.state===`connecting`||r.state===`reconnecting`||!!r.startProgress||!!r.frpcDownload,t[9]===Symbol.for(`react.memo_cache_sentinel`)?(T=d(Ee(),`space-y-4`),t[9]=T):T=t[9],w=`flex flex-wrap items-start justify-between gap-3`,C=`flex items-center gap-2`,S=d(`inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-medium`,tt(E)),t[0]=r,t[1]=o,t[2]=b,t[3]=x,t[4]=S,t[5]=C,t[6]=w,t[7]=T,t[8]=E):(b=t[2],x=t[3],S=t[4],C=t[5],w=t[6],T=t[7],E=t[8]);let D=E===`connected`&&`bg-emerald-500`,O=E===`progress`&&`bg-amber-500 animate-pulse`,k=E===`error`&&`bg-red-500`,A=E===`off`&&`bg-fg-subtle`,j;t[10]!==D||t[11]!==O||t[12]!==k||t[13]!==A?(j=d(`size-1.5 rounded-full`,D,O,k,A),t[10]=D,t[11]=O,t[12]=k,t[13]=A,t[14]=j):j=t[14];let M;t[15]===j?M=t[16]:(M=(0,$.jsx)(`span`,{className:j,"aria-hidden":!0}),t[15]=j,t[16]=M);let N;t[17]!==i||t[18]!==r||t[19]!==n?(N=i&&!r.enabled?(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`inline-block h-3 w-16 animate-pulse rounded-full bg-surface-hover/70 motion-reduce:animate-none`}):$e(n,r),t[17]=i,t[18]=r,t[19]=n,t[20]=N):N=t[20];let P;t[21]!==M||t[22]!==N||t[23]!==S?(P=(0,$.jsxs)(`span`,{className:S,children:[M,N]}),t[21]=M,t[22]=N,t[23]=S,t[24]=P):P=t[24];let F;t[25]!==r.connectedSince||t[26]!==r.state||t[27]!==n.uptime?(F=r.connectedSince&&r.state===`connected`?(0,$.jsxs)(`span`,{className:`text-xs text-fg-subtle`,children:[n.uptime,` `,nt(r.connectedSince)]}):null,t[25]=r.connectedSince,t[26]=r.state,t[27]=n.uptime,t[28]=F):F=t[28];let I;t[29]!==P||t[30]!==F||t[31]!==C?(I=(0,$.jsxs)(`div`,{className:C,children:[P,F]}),t[29]=P,t[30]=F,t[31]=C,t[32]=I):I=t[32];let R;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,$.jsx)(l,{className:`size-4 text-fg-subtle`,strokeWidth:1.75,"aria-hidden":!0}),t[33]=R):R=t[33];let z;t[34]!==I||t[35]!==w?(z=(0,$.jsxs)(`div`,{className:w,children:[I,R]}),t[34]=I,t[35]=w,t[36]=z):z=t[36];let B;t[37]===a?B=t[38]:(B=a?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:a instanceof Error?a.message:String(a)}):null,t[37]=a,t[38]=B);let V;t[39]!==c||t[40]!==n.consentExpiredBanner?(V=c?(0,$.jsx)(`p`,{className:`rounded-lg border border-amber-500/25 bg-amber-500/5 px-3 py-2 text-xs text-fg-muted`,children:n.consentExpiredBanner}):null,t[39]=c,t[40]=n.consentExpiredBanner,t[41]=V):V=t[41];let H;t[42]!==b||t[43]!==p||t[44]!==_||t[45]!==v||t[46]!==x||t[47]!==r||t[48]!==y||t[49]!==h||t[50]!==o||t[51]!==g||t[52]!==s||t[53]!==n?(H=b?(0,$.jsxs)(`div`,{className:`space-y-4`,children:[r.publicUrl?(0,$.jsx)(`div`,{className:`rounded-xl bg-surface-panel/80 p-3 shadow-surface`,children:(0,$.jsx)(le,{label:n.publicUrlLabel,text:r.publicUrl,labels:p})}):null,x?(0,$.jsx)(Ze,{status:r,t:n}):null,r.lastError&&r.state===`error`?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:r.lastError}):null,(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:r.enabled?(0,$.jsxs)(f,{type:`button`,variant:`secondary`,disabled:s,onClick:v,children:[s?(0,$.jsx)(u,{className:`size-4 animate-spin`}):null,n.stop]}):(0,$.jsxs)(f,{type:`button`,disabled:o,onClick:_,children:[o?(0,$.jsx)(u,{className:`size-4 animate-spin`}):(0,$.jsx)(he,{className:`size-4`}),n.start]})})]}):(0,$.jsxs)(`div`,{className:`space-y-4`,children:[g?(0,$.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:g}):null,(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.emptyStateTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:n.emptyStateBody})]}),(0,$.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-amber-500/25 bg-amber-500/5 px-3 py-2.5 text-xs text-fg-muted`,children:[(0,$.jsx)(L,{className:`mt-0.5 size-4 shrink-0 text-amber-600 dark:text-amber-400`}),(0,$.jsx)(`p`,{children:n.riskBannerBody})]}),y&&h?(0,$.jsx)(`p`,{className:`text-sm text-amber-800 dark:text-amber-200`,children:h}):null,(0,$.jsxs)(f,{type:`button`,disabled:o||y,onClick:_,className:`w-full sm:w-auto`,children:[o?(0,$.jsx)(u,{className:`size-4 animate-spin`}):(0,$.jsx)(he,{className:`size-4`}),n.start]})]}),t[42]=b,t[43]=p,t[44]=_,t[45]=v,t[46]=x,t[47]=r,t[48]=y,t[49]=h,t[50]=o,t[51]=g,t[52]=s,t[53]=n,t[54]=H):H=t[54];let U;return t[55]!==z||t[56]!==B||t[57]!==V||t[58]!==H||t[59]!==T?(U=(0,$.jsxs)(`section`,{className:T,children:[z,B,V,H]}),t[55]=z,t[56]=B,t[57]=V,t[58]=H,t[59]=T,t[60]=U):U=t[60],U}var it=`https://console.xopc.ai/access/client`,at={reconfiguring:!1};function ot(e){let t=(0,Z.c)(89),{t:n,brokerSecretReady:r,brokerSecretConfiguredInConfig:i,brokerSecretMaskedValue:a,brokerSecretDraft:s,savingBrokerSecret:l,authorizingBrokerSecret:p,brokerSecretAuthorizationUrl:m,brokerSecretNotice:h,copyFailedLabel:g,onDraftChange:_,onSave:v,onAuthorize:y,onClear:b,sectionRef:x}=e,S=(0,Q.useId)(),C=r,w=!C,[T,E]=(0,Q.useReducer)(se,at),{reconfiguring:D}=T,O;t[0]!==i||t[1]!==s||t[2]!==D?(O=i&&!D&&!s.trim(),t[0]=i,t[1]=s,t[2]=D,t[3]=O):O=t[3];let k=O,A;t[4]!==n.copied||t[5]!==n.copyKey||t[6]!==n.hideKey||t[7]!==n.showKey?(A={show:n.showKey,hide:n.hideKey,copy:n.copyKey,copied:n.copied},t[4]=n.copied,t[5]=n.copyKey,t[6]=n.hideKey,t[7]=n.showKey,t[8]=A):A=t[8];let j=A,M;t[9]===s?M=t[10]:(M=s.trim().length>0&&!ee(s.trim()),t[9]=s,t[10]=M);let N=M,P;t[11]===_?P=t[12]:(P=()=>{E({type:`patch`,patch:{reconfiguring:!1}}),_(``)},t[11]=_,t[12]=P);let F=P,I=w&&`ring-1 ring-amber-500/30`,L;t[13]===I?L=t[14]:(L=d(I),t[13]=I,t[14]=L);let R=C?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`:w?`bg-amber-500/10 text-amber-700 dark:text-amber-400`:`bg-surface-hover text-fg-muted`,z;t[15]===R?z=t[16]:(z=d(`flex size-9 shrink-0 items-center justify-center rounded-lg`,R),t[15]=R,t[16]=z);let B;t[17]===C?B=t[18]:(B=C?(0,$.jsx)(o,{className:`size-4`,strokeWidth:2,"aria-hidden":!0}):(0,$.jsx)(me,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[17]=C,t[18]=B);let V;t[19]!==z||t[20]!==B?(V=(0,$.jsx)(`span`,{className:z,children:B}),t[19]=z,t[20]=B,t[21]=V):V=t[21];let H=C?n.brokerSecretReadyTitle:n.brokerSecretStepTitle,U;t[22]===H?U=t[23]:(U=(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:H}),t[22]=H,t[23]=U);let W=C?n.brokerSecretReadyHint:n.brokerSecretHint,G;t[24]===W?G=t[25]:(G=(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:W}),t[24]=W,t[25]=G);let K;t[26]!==w||t[27]!==n.brokerSecretMissingHint?(K=w?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-amber-800 dark:text-amber-200`,children:n.brokerSecretMissingHint}):null,t[26]=w,t[27]=n.brokerSecretMissingHint,t[28]=K):K=t[28];let q;t[29]!==U||t[30]!==G||t[31]!==K?(q=(0,$.jsxs)(`div`,{children:[U,G,K]}),t[29]=U,t[30]=G,t[31]=K,t[32]=q):q=t[32];let te;t[33]!==p||t[34]!==w||t[35]!==y||t[36]!==D||t[37]!==l||t[38]!==n.brokerSecretAuthorize||t[39]!==n.brokerSecretAuthorizing||t[40]!==n.brokerSecretConsoleLink?(te=w||D?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(f,{type:`button`,disabled:l||p,onClick:y,children:[p?(0,$.jsx)(u,{className:`size-4 animate-spin`}):null,p?n.brokerSecretAuthorizing:n.brokerSecretAuthorize]}),(0,$.jsxs)(`a`,{href:it,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex w-fit items-center gap-1 text-xs font-medium text-accent-fg hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[n.brokerSecretConsoleLink,(0,$.jsx)(c,{className:`size-3`,"aria-hidden":!0})]})]}):null,t[33]=p,t[34]=w,t[35]=y,t[36]=D,t[37]=l,t[38]=n.brokerSecretAuthorize,t[39]=n.brokerSecretAuthorizing,t[40]=n.brokerSecretConsoleLink,t[41]=te):te=t[41];let J;t[42]!==p||t[43]!==m||t[44]!==n.brokerSecretOpenAuthorization?(J=p&&m?(0,$.jsxs)(`a`,{href:m,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex w-fit items-center gap-1 text-xs font-medium text-accent-fg hover:underline`,children:[n.brokerSecretOpenAuthorization,(0,$.jsx)(c,{className:`size-3`,"aria-hidden":!0})]}):null,t[42]=p,t[43]=m,t[44]=n.brokerSecretOpenAuthorization,t[45]=J):J=t[45];let Y;t[46]!==i||t[47]!==s||t[48]!==a||t[49]!==N||t[50]!==F||t[51]!==g||t[52]!==S||t[53]!==w||t[54]!==b||t[55]!==_||t[56]!==v||t[57]!==D||t[58]!==l||t[59]!==j||t[60]!==k||t[61]!==n.brokerSecretCancelReconfigure||t[62]!==n.brokerSecretClear||t[63]!==n.brokerSecretMaskedHelp||t[64]!==n.brokerSecretNotInConfigFile||t[65]!==n.brokerSecretPlaceholder||t[66]!==n.brokerSecretReconfigure||t[67]!==n.brokerSecretRevealFailed||t[68]!==n.brokerSecretSave||t[69]!==n.brokerSecretSaveAndContinue||t[70]!==n.brokerSecretTitle?(Y=k?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`sr-only`,htmlFor:S,children:n.brokerSecretTitle}),(0,$.jsx)(ge,{id:S,value:a,labels:j,reveal:st,loadFailedLabel:g||n.brokerSecretRevealFailed,maskedHelp:n.brokerSecretMaskedHelp,notInConfigFile:n.brokerSecretNotInConfigFile,readOnly:!0}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsx)(f,{type:`button`,variant:`secondary`,disabled:l,onClick:()=>{E({type:`patch`,patch:{reconfiguring:!0}})},children:n.brokerSecretReconfigure}),(0,$.jsx)(f,{type:`button`,variant:`ghost`,disabled:l,onClick:b,children:n.brokerSecretClear})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`sr-only`,htmlFor:S,children:n.brokerSecretTitle}),(0,$.jsx)(ge,{id:S,value:s,onChange:_,placeholder:n.brokerSecretPlaceholder,labels:j,disabled:l}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsxs)(f,{type:`button`,disabled:l||!N,onClick:v,children:[l?(0,$.jsx)(u,{className:`size-4 animate-spin`}):null,w?n.brokerSecretSaveAndContinue:n.brokerSecretSave]}),i?(0,$.jsx)(f,{type:`button`,variant:`ghost`,disabled:l,onClick:b,children:n.brokerSecretClear}):null,D?(0,$.jsx)(f,{type:`button`,variant:`ghost`,disabled:l,onClick:F,children:n.brokerSecretCancelReconfigure}):null]})]}),t[46]=i,t[47]=s,t[48]=a,t[49]=N,t[50]=F,t[51]=g,t[52]=S,t[53]=w,t[54]=b,t[55]=_,t[56]=v,t[57]=D,t[58]=l,t[59]=j,t[60]=k,t[61]=n.brokerSecretCancelReconfigure,t[62]=n.brokerSecretClear,t[63]=n.brokerSecretMaskedHelp,t[64]=n.brokerSecretNotInConfigFile,t[65]=n.brokerSecretPlaceholder,t[66]=n.brokerSecretReconfigure,t[67]=n.brokerSecretRevealFailed,t[68]=n.brokerSecretSave,t[69]=n.brokerSecretSaveAndContinue,t[70]=n.brokerSecretTitle,t[71]=Y):Y=t[71];let ne;t[72]===h?ne=t[73]:(ne=h?(0,$.jsx)(`p`,{className:`text-xs text-emerald-700 dark:text-emerald-400`,children:h}):null,t[72]=h,t[73]=ne);let X;t[74]!==q||t[75]!==te||t[76]!==J||t[77]!==Y||t[78]!==ne?(X=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-3`,children:[q,te,J,Y,ne]}),t[74]=q,t[75]=te,t[76]=J,t[77]=Y,t[78]=ne,t[79]=X):X=t[79];let re;t[80]!==V||t[81]!==X?(re=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[V,X]}),t[80]=V,t[81]=X,t[82]=re):re=t[82];let ie;t[83]!==re||t[84]!==L?(ie=(0,$.jsx)(De,{className:L,children:re}),t[83]=re,t[84]=L,t[85]=ie):ie=t[85];let ae;return t[86]!==x||t[87]!==ie?(ae=(0,$.jsx)(`div`,{ref:x,id:`tunnel-broker-secret-setup`,children:ie}),t[86]=x,t[87]=ie,t[88]=ae):ae=t[88],ae}function st(){return re().then(ct)}function ct(e){return e.registrationSecret??null}function lt(e){let t=(0,Z.c)(10),{language:n,label:r,section:i,className:a}=e,o;t[0]!==n||t[1]!==i?(o=ce(n,i),t[0]=n,t[1]=i,t[2]=o):o=t[2];let s;t[3]===a?s=t[4]:(s=d(`inline-flex items-center gap-1 text-sm font-medium text-accent hover:underline`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,a),t[3]=a,t[4]=s);let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(c,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[5]=l):l=t[5];let u;return t[6]!==r||t[7]!==o||t[8]!==s?(u=(0,$.jsxs)(`a`,{href:o,target:`_blank`,rel:`noreferrer`,className:s,children:[r,l]}),t[6]=r,t[7]=o,t[8]=s,t[9]=u):u=t[9],u}var ut=e(Me(),1),dt={width:216,margin:2,errorCorrectionLevel:`M`,color:{dark:`#000000ff`,light:`#ffffffff`}};async function ft(e){return ut.toDataURL(e,dt)}function pt(e){let t=e?.candidates??[],n=t.find(e=>e.kind===`lan`&&e.reachable),r=t.find(e=>e.kind===`lan`);return(n??r)?.url?.trim()??``}function mt(e,t){let n=t.trim();return!n||!e?!1:e.candidates.some(e=>e.kind===`tunnel`&&e.url.trim()===n)}function ht(e,t){return e?t?pt(e)||e.recommended.url?.trim()||``:e.recommended.url?.trim()||``:``}function gt(e,t){let n=t?.preferLan===!0,r=!!e,{mutate:i}=j(),a=(0,Q.useRef)(!1),{data:o}=M(r?`tunnel-status`:null,be,{refreshInterval:6e4}),{data:s,mutate:c}=M(r?`tunnel-pair-context`:null,W,{refreshInterval:6e4});(0,Q.useEffect)(()=>{let e=()=>{i(`tunnel-status`),i(`tunnel-qr`),i(`tunnel-pair`),i(`tunnel-pair-context`)};return window.addEventListener(`tunnel-status`,e),()=>window.removeEventListener(`tunnel-status`,e)},[i]);let l=o?.state===`connected`&&!!o.publicUrl?.trim(),u=l&&!n,{data:d,mutate:f}=M(u&&r?`tunnel-qr`:null,Y,{refreshInterval:4*6e4}),{data:p,mutate:m}=M(!u&&r&&s?.pairingReady?`tunnel-pair`:null,R,{refreshInterval:4*6e4}),[h,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(``),[x,S]=(0,Q.useState)({pairContext:void 0,preferLan:n});if(!a.current&&(s!==x.pairContext||n!==x.preferLan)){S({pairContext:s,preferLan:n});let e=ht(s,n);h!==e&&v(e)}let C=(0,Q.useCallback)(e=>{a.current=!0,v(e)},[]),w=(0,Q.useCallback)(()=>{let e=ht(s,n);e&&(a.current=!0,v(e))},[s,n]),T=(0,Q.useCallback)(e=>{let t=e.trim();t&&(a.current=!0,v(t))},[]),E=(0,Q.useCallback)(e=>{a.current=!1,v(e?.trim()||ht(s,n))},[s,n]),D=h.trim(),O=(0,Q.useMemo)(()=>{try{let e=new URL(D);return e.protocol===`http:`||e.protocol===`https:`}catch{return!1}},[D]),k=O&&g(D),A=!u&&!!(s&&!s.pairingReady&&s.blockReason===`GATEWAY_LOOPBACK_ONLY`),N=!u&&O&&!k&&!!p?.pairingSecret&&(s?.pairingReady===!0||!A),P=(0,Q.useMemo)(()=>{let e=pt(s);return n?e||(D&&!mt(s,D)?D:``):D},[s,n,D]),F=(0,Q.useMemo)(()=>{if(!e)return``;if(y.trim())return y.trim();if(u&&d?.qrPayload?.trim())return d.qrPayload.trim();if(!N||!p?.pairingSecret)return``;let t=s?.candidates.find(e=>e.kind===`tunnel`&&e.reachable),r=s?.candidates.find(e=>e.kind===`lan`&&e.reachable),i=n?P:t?.url??D;return i?_({baseUrl:i,pairingSecret:p.pairingSecret,lanUrl:n?null:t&&r?r.url:null}):``},[e,P,p?.pairingSecret,N,y,n,D,u,d?.qrPayload,s?.candidates]),I=ue(()=>ft(F),[F],{enabled:!!F,initial:null,errorData:null}),L=F?I.data:null,z=!!(F&&I.error!==null&&!I.loading);return{tunnelActive:l,tunnelStatus:o,tunnelQr:d,pairContext:s,pairBaseUrl:h,setPairBaseUrl:C,applySuggestedPairUrl:w,applyCandidateUrl:T,baseOk:O,localhostWarn:k,pairingBlocked:A,deepLink:F,qrPayload:F,qrDataUrl:L,qrGenFailed:z,encoding:!!(F&&!L&&!z),refreshQr:(0,Q.useCallback)(async e=>{if(e?.trim()){b(e.trim()),f({qrPayload:e.trim(),publicUrl:o?.publicUrl??``,lanUrl:d?.lanUrl??null},!1);return}b(``),await c(),u?await f():s?.pairingReady&&await m()},[m,c,f,s?.pairingReady,d?.lanUrl,o?.publicUrl,u]),resetPairBaseFromContext:E}}var _t={actionError:null,starting:!1,stopping:!1,savingAutoStart:!1,consentOpen:!1,autoStartConfirmOpen:!1,releaseConfirmOpen:!1,releasing:!1,brokerSecretDraft:``,savingBrokerSecret:!1,authorizingBrokerSecret:!1,brokerSecretAuthorizationUrl:null,brokerSecretNotice:null};function vt({embedded:e=!1}){let t=y(e=>e.language),n=h(t).tunnelSettings,r=v(e=>e.token),i=!!r,[a,o]=(0,Q.useReducer)(se,_t),{actionError:s,starting:c,stopping:p,savingAutoStart:m,consentOpen:g,autoStartConfirmOpen:_,releaseConfirmOpen:b,releasing:x,brokerSecretDraft:S,savingBrokerSecret:C,authorizingBrokerSecret:w,brokerSecretAuthorizationUrl:T,brokerSecretNotice:E}=a,D=(0,Q.useRef)(null),O=gt(r??``),{data:k}=P(i),{data:A,error:j,isLoading:L,mutate:R}=M(i?`tunnel-status`:null,be,{refreshInterval:e=>c?1e3:e?.frpcDownload||e?.state===`connecting`||e?.state===`reconnecting`?2e3:6e4}),z=(0,Q.useMemo)(()=>{let e=k?.payload?.config;if(e&&typeof e==`object`&&!Array.isArray(e)){let t=e.tunnel;if(t&&typeof t==`object`&&!Array.isArray(t)&&t.autoStart===!0)return!0}return A?.config?.autoStart===!0},[k,A?.config?.autoStart]),V=(0,Q.useMemo)(()=>{let e=k?.payload?.config;if(e&&typeof e==`object`&&!Array.isArray(e)){let t=e.tunnel;if(t&&typeof t==`object`&&!Array.isArray(t)){let e=t.registrationSecret;if(typeof e==`string`)return e}}return``},[k]),U=ee(V),W=A?.registrationSecret?.configured??U;(0,Q.useEffect)(()=>{let e=()=>{R()};return window.addEventListener(`tunnel-status`,e),()=>window.removeEventListener(`tunnel-status`,e)},[R]);let G=(0,Q.useMemo)(()=>[n.consentBullet1,n.consentBullet2,n.consentBullet3],[n.consentBullet1,n.consentBullet2,n.consentBullet3]),K=(0,Q.useCallback)(async()=>{o({type:`patch`,patch:{actionError:null}}),o({type:`patch`,patch:{starting:!0}});try{let e=await oe();await R(),N(),await O.refreshQr(e.qrPayload)}catch(e){o({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{o({type:`patch`,patch:{starting:!1}})}},[R,O.refreshQr]),q=(0,Q.useCallback)(()=>{if(!W){o({type:`patch`,patch:{actionError:n.brokerSecretRequiredBeforeStart}}),D.current?.scrollIntoView({behavior:`smooth`,block:`start`});return}if(A?.consentRequired){o({type:`patch`,patch:{consentOpen:!0}});return}K()},[W,A?.consentRequired,K,n.brokerSecretRequiredBeforeStart]),te=(0,Q.useCallback)(async()=>{o({type:`patch`,patch:{consentOpen:!1}}),o({type:`patch`,patch:{actionError:null}});try{await H(),await Promise.all([R(),K()])}catch(e){o({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}},[R,K]),J=(0,Q.useCallback)(async()=>{o({type:`patch`,patch:{actionError:null}}),o({type:`patch`,patch:{stopping:!0}});try{await B(),await Promise.all([O.refreshQr(),R()]),N()}catch(e){o({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{o({type:`patch`,patch:{stopping:!1}})}},[R,O.refreshQr]),Y=(0,Q.useCallback)(async e=>{o({type:`patch`,patch:{savingAutoStart:!0}}),o({type:`patch`,patch:{actionError:null}});try{await I({autoStart:e}),N()}catch(e){o({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{o({type:`patch`,patch:{savingAutoStart:!1}})}},[]),X=(0,Q.useCallback)(()=>{if(z){Y(!1);return}if(A?.consentRequired){o({type:`patch`,patch:{actionError:n.consentExpiredBanner}});return}if(!A?.canAutoStart){o({type:`patch`,patch:{actionError:n.autoStartHint}});return}o({type:`patch`,patch:{autoStartConfirmOpen:!0}})},[Y,A?.canAutoStart,A?.consentRequired,n,z]),re=(0,Q.useCallback)(async()=>{let e=S.trim();if(e){o({type:`patch`,patch:{savingBrokerSecret:!0,actionError:null,brokerSecretNotice:null}});try{await I({registrationSecret:e}),o({type:`patch`,patch:{brokerSecretDraft:``,brokerSecretNotice:n.brokerSecretSaved}}),N(),await R(),o({type:`patch`,patch:{actionError:null}})}catch(e){o({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{o({type:`patch`,patch:{savingBrokerSecret:!1}})}}},[S,R,n.brokerSecretSaved]),ie=(0,Q.useCallback)(async()=>{o({type:`patch`,patch:{savingBrokerSecret:!0,actionError:null,brokerSecretNotice:null}});try{await I({registrationSecret:null}),o({type:`patch`,patch:{brokerSecretDraft:``,brokerSecretNotice:n.brokerSecretCleared}}),N(),await Promise.all([O.refreshQr(),R()])}catch(e){o({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{o({type:`patch`,patch:{savingBrokerSecret:!1}})}},[R,O.refreshQr,n.brokerSecretCleared]),ce=(0,Q.useCallback)(async()=>{let e=ke(),t=null,r=null;o({type:`patch`,patch:{authorizingBrokerSecret:!0,brokerSecretAuthorizationUrl:null,brokerSecretNotice:null,actionError:null}});try{for(t=(await _e(`xopc-tunnel`)).sessionId;;){await new Promise(e=>window.setTimeout(e,1e3));let i=await ne(t);if(i.authUrl&&i.authUrl!==r&&(r=i.authUrl,o({type:`patch`,patch:{brokerSecretAuthorizationUrl:i.authUrl}}),await Oe(i.authUrl,e)),i.status===`failed`||i.status===`cancelled`)throw Error(i.error??i.message??`OAuth authorization failed`);if(i.status===`completed`){await ae(),await Promise.all([R(),N()]),o({type:`patch`,patch:{brokerSecretNotice:n.brokerSecretSaved,brokerSecretDraft:``}});return}}}catch(e){o({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{Ae(e),t&&ye(t).catch(()=>void 0),o({type:`patch`,patch:{authorizingBrokerSecret:!1,brokerSecretAuthorizationUrl:null}})}},[R,n.brokerSecretSaved]),le=(0,Q.useCallback)(async()=>{o({type:`patch`,patch:{releaseConfirmOpen:!1,actionError:null,releasing:!0}});try{await B({release:!0}),await Promise.all([O.refreshQr(),R()]),N()}catch(e){o({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{o({type:`patch`,patch:{releasing:!1}})}},[R,O.refreshQr]),ue=(0,Q.useMemo)(()=>({copy:n.copyUrl,copied:n.copied,copyFailed:h(t).clipboard.copyFailed}),[t,n.copyUrl,n.copied]);if(!i)return(0,$.jsx)(`div`,{className:e?void 0:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.needToken})});let de=A??{enabled:!1,state:`disconnected`,subdomain:null,publicUrl:null,connectedSince:null,frpcPid:null,lastHeartbeatAt:null,lastError:null,consentRequired:!0,config:{autoStart:z,brokerUrl:`https://frp.xopc.ai/api`}},fe=A?.consentRequired&&(de.enabled||z||A?.consent?.acceptedAt),pe=(0,$.jsx)(ot,{t:n,brokerSecretReady:W,brokerSecretConfiguredInConfig:U,brokerSecretMaskedValue:U?V:``,brokerSecretDraft:S,savingBrokerSecret:C,authorizingBrokerSecret:w,brokerSecretAuthorizationUrl:T,brokerSecretNotice:E,copyFailedLabel:h(t).clipboard.copyFailed,onDraftChange:e=>o({type:`patch`,patch:{brokerSecretDraft:e}}),onSave:()=>void re(),onAuthorize:()=>void ce(),onClear:()=>void ie(),sectionRef:D}),me=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ve,{open:g,title:n.consentTitle,intro:n.consentIntro,bullets:G,checkboxLabel:n.consentCheckbox,confirmLabel:fe?n.consentReconfirm:n.consentConfirm,cancelLabel:n.consentCancel,onConfirm:()=>void te(),onCancel:()=>o({type:`patch`,patch:{consentOpen:!1}})},g?`consent-open`:`consent-closed`),(0,$.jsx)(F,{open:_,title:n.autoStartConfirmTitle,description:n.autoStartConfirmBody,confirmLabel:n.autoStartConfirmLabel,cancelLabel:n.consentCancel,onConfirm:()=>{o({type:`patch`,patch:{autoStartConfirmOpen:!1}}),Y(!0)},onCancel:()=>o({type:`patch`,patch:{autoStartConfirmOpen:!1}})}),(0,$.jsx)(F,{open:b,title:n.releaseConfirmTitle,description:n.releaseConfirmBody,confirmLabel:n.releaseConfirmLabel,cancelLabel:n.consentCancel,destructive:!0,onConfirm:()=>void le(),onCancel:()=>o({type:`patch`,patch:{releaseConfirmOpen:!1}})})]});return e?(0,$.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[s?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:s}):null,pe,(0,$.jsx)(rt,{t:n,status:de,isLoading:L,statusErr:j,starting:c,stopping:p,showConsentExpired:!!fe,copyLabels:ue,startDisabled:!W,startDisabledReason:W?void 0:n.brokerSecretRequiredBeforeStart,stepLabel:n.flowStepStart,onStart:q,onStop:()=>void J()}),(0,$.jsx)(Le,{pairQr:O,gatewayToken:r??``,streamlined:!0,onRefreshQr:()=>void O.refreshQr()}),(0,$.jsxs)(Pe,{showLabel:n.showOptions,hideLabel:n.hideOptions,children:[(0,$.jsxs)(`label`,{className:d(`flex items-center gap-3 text-sm text-fg`,!z&&!A?.canAutoStart?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border-edge accent-accent`,checked:z,disabled:m||!z&&!A?.canAutoStart,onChange:X}),n.autoStart]}),!A?.canAutoStart&&!z?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.autoStartHint}):null,de.subdomain||de.publicUrl?(0,$.jsxs)(`div`,{className:`space-y-2 border-t border-edge-subtle pt-4`,children:[(0,$.jsxs)(f,{type:`button`,variant:`secondary`,disabled:x||p,className:`border-danger/40 text-danger hover:bg-danger/10`,onClick:()=>o({type:`patch`,patch:{releaseConfirmOpen:!0}}),children:[x?(0,$.jsx)(u,{className:`size-4 animate-spin`}):null,n.release]}),(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.releaseHint})]}):null]}),(0,$.jsx)(Pe,{showLabel:n.showAdvanced,hideLabel:n.hideAdvanced,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-edge-subtle pt-4 text-xs text-fg-subtle`,children:[(0,$.jsxs)(`p`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(l,{className:`mt-0.5 size-4 shrink-0 text-accent`}),(0,$.jsx)(`span`,{children:n.brokerNote})]}),(0,$.jsx)(lt,{language:t,label:n.brokerDocsLink,section:`public-tunnel`,className:`text-xs`})]})}),me]}):(0,$.jsxs)(`div`,{className:e?`flex w-full flex-col gap-6`:`flex w-full flex-col gap-6 px-3 py-8 sm:px-5 xl:px-6`,children:[e?null:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:n.title}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:n.subtitle})]}),s?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:s}):null,pe,(0,$.jsx)(rt,{t:n,status:de,isLoading:L,statusErr:j,starting:c,stopping:p,showConsentExpired:!!fe,copyLabels:ue,startDisabled:!W,startDisabledReason:W?void 0:n.brokerSecretRequiredBeforeStart,onStart:q,onStop:()=>void J()}),(0,$.jsx)(Le,{pairQr:O,gatewayToken:r??``}),de.subdomain||de.publicUrl?(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,$.jsxs)(f,{type:`button`,variant:`secondary`,disabled:x||p,className:`border-danger/40 text-danger hover:bg-danger/10`,onClick:()=>o({type:`patch`,patch:{releaseConfirmOpen:!0}}),children:[x?(0,$.jsx)(u,{className:`size-4 animate-spin`}):null,n.release]})}):null,de.subdomain||de.publicUrl?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.releaseHint}):null,(0,$.jsxs)(De,{children:[(0,$.jsx)(`h2`,{className:`mb-3 text-sm font-semibold text-fg`,children:n.optionsTitle}),(0,$.jsxs)(`label`,{className:d(`flex items-center gap-3 text-sm text-fg`,!z&&!A?.canAutoStart?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border-edge accent-accent`,checked:z,disabled:m||!z&&!A?.canAutoStart,onChange:X}),n.autoStart]}),!A?.canAutoStart&&!z?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:n.autoStartHint}):null]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-panel/80 px-3 py-2 text-xs text-fg-subtle shadow-surface`,children:[(0,$.jsxs)(`p`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(l,{className:`mt-0.5 size-4 shrink-0 text-accent`}),(0,$.jsx)(`span`,{children:n.brokerNote})]}),(0,$.jsx)(lt,{language:t,label:n.brokerDocsLink,section:`public-tunnel`,className:`text-xs`})]}),me]})}async function yt(){let e=await b(`/api/exposure/status`);if(!e.ok)throw Error(`Failed to load exposure status (${e.status})`);return await e.json()}async function bt(e=`serve`){let t=await b(`/api/exposure/tailscale/start`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({mode:e})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error??`Start failed (${t.status})`)}return await t.json()}async function xt(){let e=await b(`/api/exposure/tailscale/stop`,{method:`POST`});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error??`Stop failed (${e.status})`)}return await e.json()}var St=`https://tailscale.com/download`;function Ct(e){let t=(0,Z.c)(2),{label:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`a`,{href:St,target:`_blank`,rel:`noreferrer`,className:`font-medium text-accent hover:underline`,children:n}),t[0]=n,t[1]=r),r}function wt({embedded:e=!1}){let t=y(e=>e.language),n=h(t).remoteAccess.tailscale,r=(0,Q.useMemo)(()=>({copy:n.copyUrl,copied:n.copied,copyFailed:h(t).clipboard.copyFailed}),[t,n.copyUrl,n.copied]),i=!!v(e=>e.token),[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(null),{data:d,mutate:p,isLoading:m}=M(i?`exposure-status`:null,yt,{refreshInterval:3e4}),g=d?.tailscale.hostname,_=d?.tailscale.active===!0,b=d?.tailscale.cliAvailable!==!1,x=g?`https://${g}/`:null,S=(0,Q.useCallback)(async()=>{o(!0),c(null);try{await bt(`serve`),await p()}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}},[p]),C=(0,Q.useCallback)(async()=>{o(!0),c(null);try{await xt(),await p()}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}},[p]);if(!i)return null;let w=(0,$.jsxs)(`div`,{className:e?`space-y-4`:`mt-4 space-y-3`,children:[e?(0,$.jsxs)(`ol`,{className:`space-y-3 text-sm text-fg-muted`,children:[(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs font-semibold text-fg`,children:`1`}),(0,$.jsxs)(`span`,{children:[n.stepInstallBefore,(0,$.jsx)(Ct,{label:n.stepInstallLink}),n.stepInstallAfter]})]}),(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs font-semibold text-fg`,children:`2`}),(0,$.jsx)(`span`,{children:n.stepEnable})]}),(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs font-semibold text-fg`,children:`3`}),(0,$.jsx)(`span`,{children:n.stepCopy})]})]}):null,e&&d?.tailscale.cliAvailable===!1?(0,$.jsxs)(`p`,{className:`rounded-lg border border-amber-500/25 bg-amber-500/5 px-3 py-2 text-sm text-fg-muted`,children:[n.cliMissingIntro,` `,(0,$.jsx)(Ct,{label:n.cliMissingDownloadLink}),n.cliMissingSuffix]}):null,m&&!d?(0,$.jsxs)(`div`,{className:`grid gap-3`,"aria-busy":`true`,children:[(0,$.jsx)(pe,{className:`h-20 rounded-lg`}),(0,$.jsx)(pe,{className:`h-20 rounded-lg`})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(De,{children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:n.statusLabel}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:_?n.statusActive:n.statusOff}),x?(0,$.jsx)(`div`,{className:`mt-3`,children:(0,$.jsx)(le,{text:x,labels:r})}):null,s?(0,$.jsx)(`p`,{className:`mt-2 text-sm text-red-600 dark:text-red-400`,children:s}):null,(0,$.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:_?(0,$.jsxs)(f,{type:`button`,variant:`secondary`,disabled:a,onClick:()=>void C(),children:[a?(0,$.jsx)(u,{className:`mr-1 size-4 animate-spin`}):null,n.disableServe]}):(0,$.jsxs)(f,{type:`button`,disabled:a||!b,onClick:()=>void S(),children:[a?(0,$.jsx)(u,{className:`mr-1 size-4 animate-spin`}):(0,$.jsx)(he,{className:`mr-1 size-4`}),n.enableServe]})})]}),(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.hint}),(0,$.jsx)(lt,{language:t,label:n.docsLink,section:`tailscale-serve`,className:`mt-2`})]})]});return e?w:(0,$.jsxs)(De,{children:[(0,$.jsx)(Te,{icon:l,title:n.title,subtitle:n.subtitle}),w]})}function Tt(){let e=(0,Z.c)(26),t=y(Dt),n=v(Et),r;e[0]===t?r=e[1]:(r=h(t),e[0]=t,e[1]=r);let i=r.remoteAccess.lan,o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o={preferLan:!0},e[2]=o):o=e[2];let s=gt(n??``,o),l;e[3]!==i.subtitle||e[4]!==i.title?(l=(0,$.jsx)(Te,{icon:J,title:i.title,subtitle:i.subtitle}),e[3]=i.subtitle,e[4]=i.title,e[5]=l):l=e[5];let u;e[6]===i.body?u=e[7]:(u=(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:i.body}),e[6]=i.body,e[7]=u);let d;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(c,{className:`size-3.5`,"aria-hidden":!0}),e[8]=d):d=e[8];let f;e[9]===i.link?f=e[10]:(f=(0,$.jsxs)(a,{to:`/settings/gateway`,className:`inline-flex items-center gap-1.5 text-sm font-medium text-accent hover:underline`,children:[i.link,d]}),e[9]=i.link,e[10]=f);let p;e[11]!==u||e[12]!==f?(p=(0,$.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[u,f]}),e[11]=u,e[12]=f,e[13]=p):p=e[13];let m;e[14]!==l||e[15]!==p?(m=(0,$.jsxs)(De,{children:[l,p]}),e[14]=l,e[15]=p,e[16]=m):m=e[16];let g=n??``,_;e[17]===s?_=e[18]:(_=()=>void s.refreshQr(),e[17]=s,e[18]=_);let b;e[19]!==s||e[20]!==g||e[21]!==_?(b=(0,$.jsx)(Le,{pairQr:s,gatewayToken:g,lanOnly:!0,onRefreshQr:_}),e[19]=s,e[20]=g,e[21]=_,e[22]=b):b=e[22];let x;return e[23]!==b||e[24]!==m?(x=(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[m,b]}),e[23]=b,e[24]=m,e[25]=x):x=e[25],x}function Et(e){return e.token}function Dt(e){return e.language}function Ot(e){let t=(0,Z.c)(30),{embedded:n}=e,r=n===void 0?!1:n,i=y(kt),a;t[0]===i?a=t[1]:(a=h(i),t[0]=i,t[1]=a);let o=a.remoteAccess.ssh,[c,l]=(0,Q.useState)(!1),u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=async()=>{await m(`xopc gateway ssh-tunnel --target user@your-host --local-port 18790 --remote-port 18790`)&&(l(!0),setTimeout(()=>l(!1),2e3))},t[2]=u):u=t[2];let d=u,p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(`pre`,{className:`overflow-x-auto rounded-lg border border-edge bg-surface px-3 py-2 text-xs text-fg-muted`,children:`xopc gateway ssh-tunnel --target user@your-host --local-port 18790 --remote-port 18790`}),t[3]=p):p=t[3];let g,_;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>void d(),_=(0,$.jsx)(s,{className:`mr-1 size-4`}),t[4]=g,t[5]=_):(g=t[4],_=t[5]);let v=c?o.copied:o.copy,b;t[6]===v?b=t[7]:(b=(0,$.jsx)(`div`,{className:`mt-2`,children:(0,$.jsxs)(f,{type:`button`,variant:`ghost`,onClick:g,children:[_,v]})}),t[6]=v,t[7]=b);let x;t[8]!==r||t[9]!==o.hint?(x=r?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:o.hint}):null,t[8]=r,t[9]=o.hint,t[10]=x):x=t[10];let S;t[11]!==b||t[12]!==x?(S=(0,$.jsxs)($.Fragment,{children:[p,b,x]}),t[11]=b,t[12]=x,t[13]=S):S=t[13];let C=S;if(r){let e;t[14]!==o.subtitle||t[15]!==o.title?(e=(0,$.jsx)(Te,{icon:de,title:o.title,subtitle:o.subtitle}),t[14]=o.subtitle,t[15]=o.title,t[16]=e):e=t[16];let n;t[17]===C?n=t[18]:(n=(0,$.jsx)(`div`,{className:`mt-4 space-y-2`,children:C}),t[17]=C,t[18]=n);let r;return t[19]!==e||t[20]!==n?(r=(0,$.jsxs)(De,{children:[e,n]}),t[19]=e,t[20]=n,t[21]=r):r=t[21],r}let w;t[22]!==o.subtitle||t[23]!==o.title?(w=(0,$.jsx)(Te,{icon:de,title:o.title,subtitle:o.subtitle}),t[22]=o.subtitle,t[23]=o.title,t[24]=w):w=t[24];let T;t[25]===C?T=t[26]:(T=(0,$.jsx)(`div`,{className:`mt-4`,children:C}),t[25]=C,t[26]=T);let E;return t[27]!==w||t[28]!==T?(E=(0,$.jsxs)(De,{children:[w,T]}),t[27]=w,t[28]=T,t[29]=E):E=t[29],E}function kt(e){return e.language}function At(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(Ot,{embedded:!0}),e[0]=t):t=e[0],t}function jt(e){switch(e){case`active`:return`bg-emerald-500/15 text-emerald-700 dark:text-emerald-400`;case`connecting`:return`bg-amber-500/15 text-amber-700 dark:text-amber-400`;default:return`bg-surface-hover text-fg-muted`}}function Mt(e){let t=(0,Z.c)(5),{label:n,kind:r}=e,i;t[0]===r?i=t[1]:(i=d(`rounded-full px-2 py-0.5 text-[11px] font-medium`,jt(r)),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,$.jsx)(`span`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function Nt(e){let t=(0,Z.c)(32),{onOpenTab:n}=e,r=y(It),i;t[0]===r?i=t[1]:(i=h(r),t[0]=r,t[1]=i);let a=i.remoteAccess.guide,o=!!v(Ft),s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s={refreshInterval:3e4},t[2]=s):s=t[2];let{data:c}=M(o?`exposure-status`:null,yt,s),u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u={refreshInterval:15e3},t[3]=u):u=t[3];let{data:f}=M(o?`tunnel-status`:null,be,u),p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p={refreshInterval:6e4},t[4]=p):p=t[4];let{data:m}=M(o?`tunnel-pair-context`:null,W,p);if(!o)return null;let g=c?.tailscale.active===!0,_=f?.state,b=f?.enabled&&_===`connected`,x=f?.enabled&&(_===`connecting`||_===`reconnecting`||!!f?.startProgress||!!f?.frpcDownload),S=(m?.candidates??[]).some(Pt),C=g?`active`:`off`,w=g?a.statusActive:a.statusOff,T;t[5]!==a.tailscaleCardTitle||t[6]!==C||t[7]!==w?(T={tab:`tailscale`,icon:l,title:a.tailscaleCardTitle,kind:C,statusLabel:w},t[5]=a.tailscaleCardTitle,t[6]=C,t[7]=w,t[8]=T):T=t[8];let E=b?`active`:x?`connecting`:`off`,D=b?a.statusActive:x?a.statusConnecting:a.statusOff,O;t[9]!==a.publicCardTitle||t[10]!==E||t[11]!==D?(O={tab:`public`,icon:ve,title:a.publicCardTitle,kind:E,statusLabel:D},t[9]=a.publicCardTitle,t[10]=E,t[11]=D,t[12]=O):O=t[12];let k=S?`active`:`off`,A=S?a.statusActive:a.statusOff,j;t[13]!==a.reverseProxyCardTitle||t[14]!==k||t[15]!==A?(j={tab:`reverse-proxy`,icon:V,title:a.reverseProxyCardTitle,kind:k,statusLabel:A},t[13]=a.reverseProxyCardTitle,t[14]=k,t[15]=A,t[16]=j):j=t[16];let N;t[17]!==a.sshCardStatus||t[18]!==a.sshCardTitle?(N={tab:`ssh`,icon:de,title:a.sshCardTitle,kind:`off`,statusLabel:a.sshCardStatus},t[17]=a.sshCardStatus,t[18]=a.sshCardTitle,t[19]=N):N=t[19];let P;t[20]!==a.lanCardStatus||t[21]!==a.lanCardTitle?(P={tab:`lan`,icon:J,title:a.lanCardTitle,kind:`off`,statusLabel:a.lanCardStatus},t[20]=a.lanCardStatus,t[21]=a.lanCardTitle,t[22]=P):P=t[22];let F;t[23]!==O||t[24]!==j||t[25]!==N||t[26]!==P||t[27]!==T?(F=[T,O,j,N,P],t[23]=O,t[24]=j,t[25]=N,t[26]=P,t[27]=T,t[28]=F):F=t[28];let I=F,L;return t[29]!==I||t[30]!==n?(L=(0,$.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5`,children:I.map(e=>{let t=e.icon;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e.tab),className:d(`flex items-start gap-3 rounded-xl bg-surface-base px-3 py-2.5 text-left shadow-surface transition-colors`,`hover:bg-surface-hover/50`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,$.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-lg bg-surface-hover/90 text-fg-muted`,children:(0,$.jsx)(t,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.title}),(0,$.jsx)(Mt,{label:e.statusLabel,kind:e.kind})]})]},`${e.tab}-${e.title}`)})}),t[29]=I,t[30]=n,t[31]=L):L=t[31],L}function Pt(e){return e.kind===`reverse-proxy`}function Ft(e){return e.token}function It(e){return e.language}function Lt(e){let t=(0,Z.c)(26),{title:n,description:r,recommended:i,icon:a,onOpen:o,openLabel:s,recommendedLabel:c}=e,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=d(`group flex w-full flex-col rounded-2xl bg-surface-base p-4 text-left transition-colors`,`hover:bg-surface-hover/40`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),t[0]=l):l=t[0];let u;t[1]===a?u=t[2]:(u=(0,$.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-hover/90 text-fg-muted`,children:(0,$.jsx)(a,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})}),t[1]=a,t[2]=u);let f;t[3]===n?f=t[4]:(f=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n}),t[3]=n,t[4]=f);let p;t[5]!==i||t[6]!==c?(p=i&&c?(0,$.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,children:c}):null,t[5]=i,t[6]=c,t[7]=p):p=t[7];let m;t[8]!==f||t[9]!==p?(m=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[f,p]}),t[8]=f,t[9]=p,t[10]=m):m=t[10];let h;t[11]===r?h=t[12]:(h=(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:r}),t[11]=r,t[12]=h);let g;t[13]!==m||t[14]!==h?(g=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[m,h]}),t[13]=m,t[14]=h,t[15]=g):g=t[15];let _;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(X,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`,"aria-hidden":!0}),t[16]=_):_=t[16];let v;t[17]!==u||t[18]!==g?(v=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[u,g,_]}),t[17]=u,t[18]=g,t[19]=v):v=t[19];let y;t[20]===s?y=t[21]:(y=(0,$.jsx)(`span`,{className:`mt-3 text-xs font-medium text-accent`,children:s}),t[20]=s,t[21]=y);let b;return t[22]!==o||t[23]!==y||t[24]!==v?(b=(0,$.jsxs)(`button`,{type:`button`,onClick:o,className:l,children:[v,y]}),t[22]=o,t[23]=y,t[24]=v,t[25]=b):b=t[25],b}function Rt(e){let t=(0,Z.c)(83),{onOpenTab:n}=e,r=y(Vt),i;t[0]===r?i=t[1]:(i=h(r),t[0]=r,t[1]=i);let a=i.remoteAccess,o=a.guide,s=!!v(Bt),c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c={refreshInterval:3e4},t[2]=c):c=t[2];let{data:u}=M(s?`exposure-status`:null,yt,c),d;t[3]===u?.conflicts?d=t[4]:(d=u?.conflicts??[],t[3]=u?.conflicts,t[4]=d);let f=d;if(!s){let e;return t[5]===o.needToken?e=t[6]:(e=(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:o.needToken}),t[5]=o.needToken,t[6]=e),e}let p;t[7]===n?p=t[8]:(p=(0,$.jsx)(Nt,{onOpenTab:n}),t[7]=n,t[8]=p);let m;t[9]!==f||t[10]!==o.conflictsHint||t[11]!==o.conflictsTitle?(m=f.length>0?(0,$.jsxs)(`div`,{className:`rounded-xl border border-amber-500/30 bg-amber-500/5 px-4 py-3 text-sm text-fg-muted`,children:[(0,$.jsx)(`p`,{className:`font-medium text-fg`,children:o.conflictsTitle}),(0,$.jsx)(`p`,{className:`mt-1`,children:o.conflictsHint}),(0,$.jsx)(`ul`,{className:`mt-2 list-inside list-disc text-xs`,children:f.map(zt)})]}):null,t[9]=f,t[10]=o.conflictsHint,t[11]=o.conflictsTitle,t[12]=m):m=t[12];let g;t[13]===o.pickMethod?g=t[14]:(g=(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:o.pickMethod}),t[13]=o.pickMethod,t[14]=g);let _;t[15]===n?_=t[16]:(_=()=>n(`tailscale`),t[15]=n,t[16]=_);let b;t[17]!==o.configure||t[18]!==o.recommended||t[19]!==o.tailscaleCardDesc||t[20]!==o.tailscaleCardTitle||t[21]!==_?(b=(0,$.jsx)(Lt,{icon:l,title:o.tailscaleCardTitle,description:o.tailscaleCardDesc,recommended:!0,recommendedLabel:o.recommended,openLabel:o.configure,onOpen:_}),t[17]=o.configure,t[18]=o.recommended,t[19]=o.tailscaleCardDesc,t[20]=o.tailscaleCardTitle,t[21]=_,t[22]=b):b=t[22];let x;t[23]===n?x=t[24]:(x=()=>n(`public`),t[23]=n,t[24]=x);let S;t[25]!==o.configure||t[26]!==o.publicCardDesc||t[27]!==o.publicCardTitle||t[28]!==x?(S=(0,$.jsx)(Lt,{icon:ve,title:o.publicCardTitle,description:o.publicCardDesc,openLabel:o.configure,onOpen:x}),t[25]=o.configure,t[26]=o.publicCardDesc,t[27]=o.publicCardTitle,t[28]=x,t[29]=S):S=t[29];let C;t[30]===n?C=t[31]:(C=()=>n(`reverse-proxy`),t[30]=n,t[31]=C);let w;t[32]!==o.configure||t[33]!==o.reverseProxyCardDesc||t[34]!==o.reverseProxyCardTitle||t[35]!==C?(w=(0,$.jsx)(Lt,{icon:V,title:o.reverseProxyCardTitle,description:o.reverseProxyCardDesc,openLabel:o.configure,onOpen:C}),t[32]=o.configure,t[33]=o.reverseProxyCardDesc,t[34]=o.reverseProxyCardTitle,t[35]=C,t[36]=w):w=t[36];let T;t[37]===n?T=t[38]:(T=()=>n(`ssh`),t[37]=n,t[38]=T);let E;t[39]!==o.configure||t[40]!==o.sshCardDesc||t[41]!==o.sshCardTitle||t[42]!==T?(E=(0,$.jsx)(Lt,{icon:de,title:o.sshCardTitle,description:o.sshCardDesc,openLabel:o.configure,onOpen:T}),t[39]=o.configure,t[40]=o.sshCardDesc,t[41]=o.sshCardTitle,t[42]=T,t[43]=E):E=t[43];let D;t[44]===n?D=t[45]:(D=()=>n(`lan`),t[44]=n,t[45]=D);let O;t[46]!==o.configure||t[47]!==o.lanCardDesc||t[48]!==o.lanCardTitle||t[49]!==D?(O=(0,$.jsx)(Lt,{icon:J,title:o.lanCardTitle,description:o.lanCardDesc,openLabel:o.configure,onOpen:D}),t[46]=o.configure,t[47]=o.lanCardDesc,t[48]=o.lanCardTitle,t[49]=D,t[50]=O):O=t[50];let k;t[51]!==S||t[52]!==w||t[53]!==E||t[54]!==O||t[55]!==b?(k=(0,$.jsxs)(`div`,{className:`mt-3 grid gap-3 lg:grid-cols-2`,children:[b,S,w,E,O]}),t[51]=S,t[52]=w,t[53]=E,t[54]=O,t[55]=b,t[56]=k):k=t[56];let A;t[57]!==k||t[58]!==g?(A=(0,$.jsxs)(`div`,{children:[g,k]}),t[57]=k,t[58]=g,t[59]=A):A=t[59];let j;t[60]===o.oneAtATimeHint?j=t[61]:(j=(0,$.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-subtle`,children:o.oneAtATimeHint}),t[60]=o.oneAtATimeHint,t[61]=j);let N;t[62]===a.advanced.proxyTitle?N=t[63]:(N=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.advanced.proxyTitle}),t[62]=a.advanced.proxyTitle,t[63]=N);let P;t[64]===a.advanced.proxyBody?P=t[65]:(P=(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:a.advanced.proxyBody}),t[64]=a.advanced.proxyBody,t[65]=P);let F;t[66]!==r||t[67]!==a.advanced.proxyDocs?(F=(0,$.jsx)(lt,{language:r,label:a.advanced.proxyDocs,section:`advanced`,className:`mt-2`}),t[66]=r,t[67]=a.advanced.proxyDocs,t[68]=F):F=t[68];let I;t[69]!==N||t[70]!==P||t[71]!==F?(I=(0,$.jsxs)(`div`,{className:`rounded-xl bg-surface-base px-4 py-3`,children:[N,P,F]}),t[69]=N,t[70]=P,t[71]=F,t[72]=I):I=t[72];let L;t[73]!==o.docsLink||t[74]!==r?(L=(0,$.jsx)(lt,{language:r,label:o.docsLink}),t[73]=o.docsLink,t[74]=r,t[75]=L):L=t[75];let R;return t[76]!==A||t[77]!==j||t[78]!==I||t[79]!==L||t[80]!==p||t[81]!==m?(R=(0,$.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[p,m,A,j,I,L]}),t[76]=A,t[77]=j,t[78]=I,t[79]=L,t[80]=p,t[81]=m,t[82]=R):R=t[82],R}function zt(e){return(0,$.jsx)(`li`,{children:e.message},e.code)}function Bt(e){return e.token}function Vt(e){return e.language}async function Ht(e){let t=await b(x(`/api/tunnel/pair/probe-public`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:e})});if(!t.ok&&t.status!==400)throw Error(`Probe failed (${t.status})`);return await t.json()}async function Ut(e){await S(x(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{publicUrl:e??null}})})}function Wt(e){let t=e.split(`.`).map(e=>Number.parseInt(e,10));if(t.length!==4||t.some(e=>!Number.isFinite(e)))return!1;let[n,r]=t;return n===10||n===127||n===169&&r===254||n===172&&r>=16&&r<=31||n===192&&r===168||n===100&&r>=64&&r<=127}function Gt(){return(0,Q.useMemo)(()=>{if(typeof window>`u`)return null;let{protocol:e,hostname:t,origin:n}=window.location;if(e!==`https:`&&e!==`http:`)return null;let r=t.toLowerCase();return!r||r===`localhost`||r===`127.0.0.1`||r===`::1`||r===`[::1]`||r.endsWith(`.local`)||r.endsWith(`.localhost`)||Wt(r)?null:n.toLowerCase().replace(/\/+$/,``)},[])}function Kt(){return d(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,p,`dark:border-edge`)}function qt(e){return(e?.candidates.find(e=>e.kind===`reverse-proxy`))?.url?.trim()||null}function Jt(e){return(e?.candidates.find(e=>e.kind===`lan`&&e.reachable))?.url?.trim()||null}function Yt(){let e=y(e=>e.language),t=h(e).remoteAccess.reverseProxy,n=!!v(e=>e.token),r=Gt(),{mutate:i}=j(),{data:a,mutate:o}=M(n?`tunnel-pair-context`:null,W,{refreshInterval:6e4}),s=qt(a),[c,p]=(0,Q.useState)(``),[m,g]=(0,Q.useState)({busy:!1,result:null}),[b,x]=(0,Q.useState)({busy:!1,error:null});(0,Q.useEffect)(()=>{c||(s?p(s):r&&p(r))},[s,r,c]);let S=(0,Q.useMemo)(()=>c.trim()||(s??r??``),[s,r,c]),C=!s&&!!r&&S===r,w=Jt(a),{data:T,mutate:E}=M(n&&S?[`reverse-proxy-pair`,S]:null,()=>R(),{refreshInterval:4*6e4,revalidateOnFocus:!1}),D=(0,Q.useMemo)(()=>!S||!T?.pairingSecret?``:_({baseUrl:S,pairingSecret:T.pairingSecret,lanUrl:w}),[S,w,T?.pairingSecret]),O=ue(()=>ft(D),[D],{enabled:!!D,initial:null,errorData:null}),k=(0,Q.useCallback)(async()=>{let e=c.trim()||S;if(e){g({busy:!0,result:null});try{g({busy:!1,result:await Ht(e)})}catch(e){g({busy:!1,result:{ok:!1,code:`NETWORK_ERROR`,message:e instanceof Error?e.message:String(e)}})}}},[c,S]),A=(0,Q.useCallback)(async()=>{let e=S.trim();if(e){x({busy:!0,error:null});try{await Ut(e),await o(),await i(`tunnel-pair-context`),x({busy:!1,error:null})}catch(e){x({busy:!1,error:e instanceof Error?e.message:String(e)})}}},[S,i,o]),N=(0,Q.useCallback)(async()=>{x({busy:!0,error:null});try{await Ut(null),await o(),await i(`tunnel-pair-context`),p(``),g({busy:!1,result:null}),x({busy:!1,error:null})}catch(e){x({busy:!1,error:e instanceof Error?e.message:String(e)})}},[i,o]),P=(0,Q.useCallback)(async()=>{await E()},[E]);return n?(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,$.jsxs)(De,{children:[(0,$.jsx)(Te,{icon:l,title:t.title,subtitle:t.subtitle}),(0,$.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,$.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`reverse-proxy-url`,children:t.urlLabel}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-stretch`,children:[(0,$.jsx)(`input`,{id:`reverse-proxy-url`,className:d(Kt(),`font-mono text-xs sm:flex-1 sm:min-w-0 sm:w-auto`),type:`text`,autoComplete:`off`,spellCheck:!1,placeholder:t.urlPlaceholder,value:c,onChange:e=>{p(e.target.value),g({busy:!1,result:null})}}),(0,$.jsxs)(f,{type:`button`,variant:`secondary`,className:`shrink-0 whitespace-nowrap`,onClick:()=>void k(),disabled:m.busy||!c.trim(),children:[m.busy?(0,$.jsx)(u,{className:`size-3.5 animate-spin`}):null,m.busy?t.probing:t.probeButton]})]}),(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:t.urlHint}),C&&r?(0,$.jsxs)(`div`,{className:`rounded-lg border border-accent/40 bg-accent-soft/50 px-3 py-2 text-xs leading-relaxed text-accent-fg`,children:[(0,$.jsx)(`div`,{className:`font-medium`,children:t.autoDetectedTitle}),(0,$.jsx)(`div`,{className:`mt-1 break-all font-mono text-[11px]`,children:r}),(0,$.jsx)(`p`,{className:`mt-1`,children:t.autoDetectedHint})]}):null,m.result?(0,$.jsx)(Xt,{result:m.result,labels:t.probeStatus}):null,(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:flex-wrap`,children:[S&&s!==S?(0,$.jsxs)(f,{type:`button`,onClick:()=>void A(),disabled:b.busy,children:[b.busy?(0,$.jsx)(u,{className:`size-3.5 animate-spin`}):null,b.busy?t.saving:t.saveAsDefault]}):null,s?(0,$.jsx)(f,{type:`button`,variant:`ghost`,onClick:()=>void N(),disabled:b.busy,children:t.clear}):null]}),b.error?(0,$.jsx)(`p`,{className:`text-xs text-red-800 dark:text-red-200`,children:b.error}):null,(0,$.jsx)(`div`,{className:`rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-xs leading-relaxed text-amber-950 dark:border-amber-800/60 dark:bg-amber-950/30 dark:text-amber-100`,children:t.certWarning})]})]}),(0,$.jsxs)(De,{children:[(0,$.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-start justify-between gap-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:t.qrTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.qrSubtitle})]}),D?(0,$.jsxs)(f,{type:`button`,variant:`ghost`,className:`shrink-0`,onClick:()=>void P(),children:[(0,$.jsx)(fe,{className:`size-4`}),t.refreshQr]}):null]}),S?T?.pairingSecret?(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-3 sm:items-start`,children:[(0,$.jsxs)(`div`,{className:`break-all font-mono text-[11px] text-fg-muted`,children:[(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:`baseUrl:`}),` `,S,w?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`br`,{}),(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:`lanUrl:`}),` `,w]}):null]}),O.data?(0,$.jsx)(`img`,{src:O.data,alt:``,className:`size-56 rounded-lg border border-edge-subtle bg-white object-contain p-3 dark:border-edge`}):O.loading?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.encoding}):null,(0,$.jsx)(le,{text:D,labels:{copy:t.copyLink,copied:t.copied,copyFailed:h(e).clipboard.copyFailed}})]}):(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.mintingSecret}):(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.noUrlYet})]})]}):null}function Xt(e){let t=(0,Z.c)(18),{result:n,labels:r}=e;if(n.ok){let e;t[0]===r.ok?e=t[1]:(e=(0,$.jsx)(`span`,{className:`font-medium`,children:r.ok}),t[0]=r.ok,t[1]=e);let i;t[2]===n.latencyMs?i=t[3]:(i=(0,$.jsxs)(`span`,{className:`font-mono`,children:[n.latencyMs,`ms`]}),t[2]=n.latencyMs,t[3]=i);let a;t[4]!==r.mobileReady||t[5]!==n.mobilePairing?(a=n.mobilePairing?(0,$.jsxs)($.Fragment,{children:[` · `,(0,$.jsx)(`span`,{children:r.mobileReady})]}):null,t[4]=r.mobileReady,t[5]=n.mobilePairing,t[6]=a):a=t[6];let o;return t[7]!==e||t[8]!==i||t[9]!==a?(o=(0,$.jsxs)(`div`,{className:`rounded-lg border border-emerald-200 bg-emerald-50 px-3 py-2 text-xs text-emerald-900 dark:border-emerald-800/60 dark:bg-emerald-950/30 dark:text-emerald-100`,children:[e,` · `,i,a]}),t[7]=e,t[8]=i,t[9]=a,t[10]=o):o=t[10],o}let i=r[`code_${n.code}`]??r.codeUnknown,a;t[11]===i?a=t[12]:(a=(0,$.jsx)(`span`,{className:`font-medium`,children:i}),t[11]=i,t[12]=a);let o;t[13]===n.message?o=t[14]:(o=n.message?(0,$.jsxs)($.Fragment,{children:[` — `,(0,$.jsx)(`span`,{className:`font-mono break-all`,children:n.message})]}):null,t[13]=n.message,t[14]=o);let s;return t[15]!==a||t[16]!==o?(s=(0,$.jsxs)(`div`,{className:`rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-900 dark:border-red-800/60 dark:bg-red-950/30 dark:text-red-100`,children:[a,o]}),t[15]=a,t[16]=o,t[17]=s):s=t[17],s}var Zt=[`guide`,`tailscale`,`public`,`reverse-proxy`,`ssh`,`lan`];function Qt(e){return e&&Zt.includes(e)?e:`guide`}function $t(e,t){return e.tabs[t]}function en(e,t){return e.tabIntro[t]}function tn(e){switch(e){case`tailscale`:return`tailscale-serve`;case`public`:return`public-tunnel`;case`reverse-proxy`:return`reverse-proxy`;case`ssh`:return`ssh-tunnel`;case`lan`:return`lan`;default:return}}function nn(e){let t=(0,Z.c)(7),{tab:n,onOpenTab:r}=e;switch(n){case`guide`:{let e;return t[0]===r?e=t[1]:(e=(0,$.jsx)(Rt,{onOpenTab:r}),t[0]=r,t[1]=e),e}case`tailscale`:{let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(wt,{embedded:!0}),t[2]=e):e=t[2],e}case`public`:{let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(vt,{embedded:!0}),t[3]=e):e=t[3],e}case`reverse-proxy`:{let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Yt,{}),t[4]=e):e=t[4],e}case`ssh`:{let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(At,{}),t[5]=e):e=t[5],e}case`lan`:{let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Tt,{}),t[6]=e):e=t[6],e}}}function rn(){let e=(0,Z.c)(2),t=y(on),n=h(t).remoteAccess,r=!!v(an),[a,o]=i(),s=Qt(a.get(`tab`)),c;e[0]===o?c=e[1]:(c=e=>{o(t=>{let n=new URLSearchParams(t);return e===`guide`?n.delete(`tab`):n.set(`tab`,e),n},{replace:!0})},e[0]=o,e[1]=c);let l=c,u=en(n,s),d=Zt.map(e=>({id:e,label:$t(n,e)}));return(0,$.jsxs)(Se,{children:[(0,$.jsx)(xe,{title:n.pageTitle,subtitle:n.pageSubtitle,meta:(0,$.jsx)(lt,{language:t,label:n.docsLink,section:tn(s),className:`mt-1`})}),r?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ne,{items:d,activeTab:s,onChange:l,ariaLabel:n.tabsAria,tabIdPrefix:`remote-access-tab`,panelIdPrefix:`remote-access-panel`}),(0,$.jsx)(Ce,{id:s,activeTab:s,tabIdPrefix:`remote-access-tab`,panelIdPrefix:`remote-access-panel`,title:$t(n,s),hint:s===`public`?void 0:u,children:(0,$.jsx)(nn,{tab:s,onOpenTab:l})})]}):(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.guide.needToken})]})}function an(e){return e.token}function on(e){return e.language}export{rn as RemoteAccessHub};
|