@xopcai/xopc 0.0.134 → 0.0.136
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/Combination-HAlzriaz.js +41 -0
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-mQ4lbZRf.js → agent-avatar-dicebear-CER17NHM.js} +1 -1
- package/dist/gateway/static/root/assets/agents-Bv5R-N8Q.js +2 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-Bj2YJiQe.js → app-management-settings-panel-B3Ap_wpX.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-B93olV5Z.js → appearance-settings-3kBO22Xd.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-BHYbGQcZ.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-D_yymKFJ.js → archive-plugin-D_vGeNB8.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-kfyH3HV-.js → attachment-load-hWV_8pHL.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-suggestion-card-DyGBB2WH.js → automation-suggestion-card-DVKmVTIo.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-BCTXpOBp.js +4 -0
- package/dist/gateway/static/root/assets/{binary-plugins-BX1AXf98.js → binary-plugins-BuXIeSPc.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-D-WEVNHU.js → block-editor-C1m0u-UU.js} +39 -39
- package/dist/gateway/static/root/assets/browser-settings-page-ChUF08V5.js +8 -0
- package/dist/gateway/static/root/assets/capability-presets-api-B7WWYaEh.js +1 -0
- package/dist/gateway/static/root/assets/{capability-presets-settings-panel-CHExb90z.js → capability-presets-settings-panel-D_Bh1PnA.js} +1 -1
- package/dist/gateway/static/root/assets/{channel-recipient-api-RANYrzfa.js → channel-recipient-api-sV06LCht.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-BI2ChQc7.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-MY4Xh4fM.js +1 -0
- package/dist/gateway/static/root/assets/connectors-page-qgvEp09M.js +2 -0
- package/dist/gateway/static/root/assets/desktop-pet-BxMJlvb-.js +1 -0
- package/dist/gateway/static/root/assets/{desktop-pet-settings-C3JDiXSu.js → desktop-pet-settings-DCvpDImn.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-MT71cjgl.js → directory-picker-path-field-D1nxs9PA.js} +1 -1
- package/dist/gateway/static/root/assets/dist-Mys7eFJ5.js +1 -0
- package/dist/gateway/static/root/assets/{dreaming-settings-Cfx_Qg4R.js → dreaming-settings-EAWkpOgw.js} +3 -3
- package/dist/gateway/static/root/assets/{extension-debug-page-Wp23cLkf.js → extension-debug-page-LUQ8dE8z.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-B5HRNtVY.js → extension-page-B_mnhoRd.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-zPfMpsYi.js → extension-settings-page-BWQsGmvW.js} +1 -1
- package/dist/gateway/static/root/assets/{fetch-6HXXdO77.js → fetch-BWXmBizE.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-CsS_3Ii6.js → gateway-config-api-M9bzPASf.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-DOxh0hei.js → gateway-settings-CbgtpprN.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-BE1M9fH_.js → gateway-startup-retry-BALL91S7.js} +1 -1
- package/dist/gateway/static/root/assets/goal-create-dialog-CbP4t9aM.js +1 -0
- package/dist/gateway/static/root/assets/goal-detail-page-DlwI-MZZ.js +4 -0
- package/dist/gateway/static/root/assets/{goals-config-api--3Vzceq-.js → goals-config-api-BBhFVzBS.js} +1 -1
- package/dist/gateway/static/root/assets/goals-page-D26r7knp.js +2 -0
- package/dist/gateway/static/root/assets/{goals-settings-Dg_hQNVC.js → goals-settings-DdmVG_TR.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-CecoDTZJ.js → heartbeat-settings-DZW2Xq-U.js} +1 -1
- package/dist/gateway/static/root/assets/index-CPwVzi9x.css +1 -0
- package/dist/gateway/static/root/assets/index-DZOm5_ex.js +262 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BWMLAFxf.js → keyboard-shortcuts-settings-1IWd88-T.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-DxoKJO7-.js +7 -0
- package/dist/gateway/static/root/assets/{markdown-split-5tvDwUMS.js → markdown-split-BtdBj32h.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-RSjPG4B0.js → media-plugins-CpoPj3s8.js} +1 -1
- package/dist/gateway/static/root/assets/messages-CQ_k8RHj.js +3 -0
- package/dist/gateway/static/root/assets/models-hub-panel-D1Rp__dV.js +2 -0
- package/dist/gateway/static/root/assets/notes-page-CgR1bO2W.js +1 -0
- package/dist/gateway/static/root/assets/notes-workbench-ozsnmDTV.js +2 -0
- package/dist/gateway/static/root/assets/{page-tabs-DYNWfN6S.js → page-tabs-CVLqCfQB.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-B50PdIc8.js → preview-open-alternatives-CKUXJk2t.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-B4dqFAQF.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-DlRGXv4a.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-rZEYQMZV.js +1 -0
- package/dist/gateway/static/root/assets/{save-bar-controls-DggNb0SF.js → save-bar-controls-BtGni268.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-T4ti2C8S.js → schedule-field-BDGzKVWn.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-D6wGEfEa.js → schema-form-DQJsKMCE.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-DxGoCGU8.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-4e8ZQwxr.js +1 -0
- package/dist/gateway/static/root/assets/{settings-collapsible-section-Cgd_aLBV.js → settings-collapsible-section-c8XGd4-8.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-form-section-DnDrLMWZ.js → settings-form-section-By0YiDWo.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-A2OshMK8.js → settings-loading-skeleton-SYCPY-WM.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-CXMK9Vb3.js → settings-page-D9NwvnBt.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-Da_LNPDS.js → settings-page-layout-CrICyGob.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-IjK-hDxf.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-BGZV-PCJ.js → share-preview-page-Dfnk9M_m.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-vQiRBra7.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-BIWv778A.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-CruV215G.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-D8uzXP0Y.js → system-settings-panel-BBVbSDFD.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-DQxv2BHa.js → typed-models-lib-CwFayhxu.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-BCBfSoHx.js → use-channel-catalog-BKtHOM50.js} +1 -1
- package/dist/gateway/static/root/assets/{user-profile-settings-panel-DkZSHsIs.js → user-profile-settings-panel-_KDWzagh.js} +1 -1
- package/dist/gateway/static/root/assets/{utils-ivGpUrZi.js → utils-BiUjIHb4.js} +1 -1
- package/dist/gateway/static/root/assets/voice-api-key-field-agJqlm4o.js +1 -0
- package/dist/gateway/static/root/assets/work-item-detail-page-Bdw4ATCb.js +1 -0
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-D-Dy6mTy.js +3 -0
- package/dist/gateway/static/root/assets/workflow-start-dialog-GammZ2GK.js +1 -0
- package/dist/gateway/static/root/assets/workflows-page-Cw5zrqti.js +18 -0
- package/dist/gateway/static/root/index.html +7 -8
- package/dist/package.js +1 -1
- package/dist/src/agent/image/inbound-image-handling.d.ts +1 -0
- package/dist/src/agent/image/inbound-image-handling.js +4 -1
- package/dist/src/agent/image/inbound-image-handling.js.map +1 -1
- package/dist/src/agent/image/tool-model-config.d.ts +18 -2
- package/dist/src/agent/image/tool-model-config.js +100 -14
- package/dist/src/agent/image/tool-model-config.js.map +1 -1
- package/dist/src/agent/image/vision-detection.js +4 -23
- package/dist/src/agent/image/vision-detection.js.map +1 -1
- package/dist/src/agent/inbound/attachment-pipeline.js +3 -0
- package/dist/src/agent/inbound/attachment-pipeline.js.map +1 -1
- package/dist/src/agent/messaging/command-handler.d.ts +5 -2
- package/dist/src/agent/messaging/command-handler.js +4 -3
- package/dist/src/agent/messaging/command-handler.js.map +1 -1
- package/dist/src/agent/service/btw-query.d.ts +2 -0
- package/dist/src/agent/service/btw-query.js +4 -2
- package/dist/src/agent/service/btw-query.js.map +1 -1
- package/dist/src/agent/service/direct-turn-helpers.d.ts +2 -0
- package/dist/src/agent/service/direct-turn-helpers.js +1 -1
- package/dist/src/agent/service/direct-turn-helpers.js.map +1 -1
- package/dist/src/agent/service/process-direct-streaming.js +58 -1
- package/dist/src/agent/service/process-direct-streaming.js.map +1 -1
- package/dist/src/agent/service.js +1 -1
- package/dist/src/agent/service.js.map +1 -1
- package/dist/src/agent/session/session-inspector.d.ts +2 -1
- package/dist/src/agent/session/session-inspector.js +5 -3
- package/dist/src/agent/session/session-inspector.js.map +1 -1
- package/dist/src/agent/tools/factory.js +2 -1
- package/dist/src/agent/tools/factory.js.map +1 -1
- package/dist/src/agent/tools/image-tool.d.ts +1 -0
- package/dist/src/agent/tools/image-tool.js +4 -1
- package/dist/src/agent/tools/image-tool.js.map +1 -1
- package/dist/src/chat-commands/builtins/review.js +94 -7
- package/dist/src/chat-commands/builtins/review.js.map +1 -1
- package/dist/src/chat-commands/context.d.ts +5 -3
- package/dist/src/chat-commands/context.js +5 -2
- package/dist/src/chat-commands/context.js.map +1 -1
- package/dist/src/chat-commands/index.d.ts +1 -1
- package/dist/src/chat-commands/index.js.map +1 -1
- package/dist/src/chat-commands/types.d.ts +12 -1
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/gateway/agents-admin.d.ts +5 -0
- package/dist/src/gateway/agents-admin.js +6 -1
- package/dist/src/gateway/agents-admin.js.map +1 -1
- package/dist/src/gateway/hono/routes/models.js +2 -1
- package/dist/src/gateway/hono/routes/models.js.map +1 -1
- package/dist/src/gateway/hono/routes/projects.js +88 -0
- package/dist/src/gateway/hono/routes/projects.js.map +1 -1
- package/dist/src/gateway/hono/routes/sessions.js +2 -1
- package/dist/src/gateway/hono/routes/sessions.js.map +1 -1
- package/dist/src/gateway/hono/routes/workflows.js +1 -0
- package/dist/src/gateway/hono/routes/workflows.js.map +1 -1
- package/dist/src/gateway/image-capabilities.d.ts +7 -1
- package/dist/src/gateway/image-capabilities.js +16 -3
- package/dist/src/gateway/image-capabilities.js.map +1 -1
- package/dist/src/gateway/service/sessions-api.d.ts +1 -0
- package/dist/src/gateway/service/sessions-api.js.map +1 -1
- package/dist/src/gateway/service.js +3 -3
- package/dist/src/projects/project-loop.js +2 -2
- package/dist/src/projects/project-loop.js.map +1 -1
- package/dist/src/review/review-types.js +2 -1
- package/dist/src/review/review-types.js.map +1 -1
- package/dist/src/session/client-history.d.ts +1 -0
- package/dist/src/session/client-history.js +56 -0
- package/dist/src/session/client-history.js.map +1 -1
- package/dist/src/session/index.js +1 -1
- package/dist/src/session/manager.d.ts +1 -0
- package/dist/src/session/manager.js.map +1 -1
- package/dist/src/session/store.d.ts +1 -0
- package/dist/src/session/store.js +30 -1
- package/dist/src/session/store.js.map +1 -1
- package/dist/src/tui/backends/embedded-backend.js +1 -1
- package/dist/src/tui/components/assistant-message.js +10 -3
- package/dist/src/tui/components/assistant-message.js.map +1 -1
- package/dist/src/tui/components/bash-execution.d.ts +4 -0
- package/dist/src/tui/components/bash-execution.js +15 -7
- package/dist/src/tui/components/bash-execution.js.map +1 -1
- package/dist/src/tui/tool-summary.js +9 -3
- package/dist/src/tui/tool-summary.js.map +1 -1
- package/dist/src/tui/tui-submit.d.ts +3 -0
- package/dist/src/tui/tui-submit.js +24 -1
- package/dist/src/tui/tui-submit.js.map +1 -1
- package/dist/src/tui/tui.js +29 -2
- package/dist/src/tui/tui.js.map +1 -1
- package/dist/src/work-items/index.d.ts +1 -0
- package/dist/src/work-items/index.js +2 -1
- package/dist/src/work-items/work-item-workflow-judge.d.ts +8 -0
- package/dist/src/work-items/work-item-workflow-judge.js +50 -0
- package/dist/src/work-items/work-item-workflow-judge.js.map +1 -0
- package/dist/src/workflows/domain/run.d.ts +17 -0
- package/dist/src/workflows/domain/run.js.map +1 -1
- package/dist/src/workflows/service/workflow-run-service.d.ts +3 -0
- package/dist/src/workflows/service/workflow-run-service.js +67 -0
- package/dist/src/workflows/service/workflow-run-service.js.map +1 -1
- package/dist/src/workflows/service/workflow-run-service.types.d.ts +4 -1
- package/dist/src/workflows/service/workflow-session-bridge.d.ts +1 -0
- package/dist/src/workflows/service/workflow-session-bridge.js +45 -0
- package/dist/src/workflows/service/workflow-session-bridge.js.map +1 -1
- package/package.json +1 -1
- package/dist/gateway/static/root/assets/Combination-BzaXOLd9.js +0 -41
- package/dist/gateway/static/root/assets/agents-BP0iRtiu.js +0 -2
- package/dist/gateway/static/root/assets/apps-page-12_2SDFq.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-V-tw6y1o.js +0 -4
- package/dist/gateway/static/root/assets/browser-settings-page-aMPnxWXi.js +0 -8
- package/dist/gateway/static/root/assets/capability-presets-api-CsaY2Z8B.js +0 -1
- package/dist/gateway/static/root/assets/channels-settings-N8NujD--.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-BG_j4Ci-.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-zBJbFgnK.js +0 -2
- package/dist/gateway/static/root/assets/desktop-pet-DfA-hVlt.js +0 -1
- package/dist/gateway/static/root/assets/dist-CkobR7mk.js +0 -1
- package/dist/gateway/static/root/assets/dist-DokQNVMQ.js +0 -1
- package/dist/gateway/static/root/assets/goal-create-dialog-BOWSTGB-.js +0 -1
- package/dist/gateway/static/root/assets/goal-detail-page-CCLgkqj1.js +0 -4
- package/dist/gateway/static/root/assets/goals-page-CsfIp8Vl.js +0 -2
- package/dist/gateway/static/root/assets/index-BOme955B.js +0 -262
- package/dist/gateway/static/root/assets/index-DXUkWmeK.css +0 -1
- package/dist/gateway/static/root/assets/logs-page-CW7AMYhN.js +0 -7
- package/dist/gateway/static/root/assets/messages-DR9ODkb8.js +0 -3
- package/dist/gateway/static/root/assets/models-hub-panel-mKfeyGVq.js +0 -2
- package/dist/gateway/static/root/assets/notes-page-DYw5zPeJ.js +0 -1
- package/dist/gateway/static/root/assets/notes-workbench-SPdKpvSN.js +0 -2
- package/dist/gateway/static/root/assets/project-detail-page-D3yP4K3k.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-B6EV45NR.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-9foX60FQ.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-BReBhxWd.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-DNDBN4nT.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-C8UtBMJ_.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-xXAMKlc7.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-CurjHfEM.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-BRR7NQkL.js +0 -2
- package/dist/gateway/static/root/assets/voice-api-key-field-DCiECZN1.js +0 -1
- package/dist/gateway/static/root/assets/work-item-detail-page-DAel5CHH.js +0 -1
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-2w0zj9eJ.js +0 -3
- package/dist/gateway/static/root/assets/workflow-start-dialog-B5xdDFV-.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-DRhiSwuU.js +0 -18
|
@@ -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"./cn-BQ_8x0bT.js";import{t as a}from"./messages-DR9ODkb8.js";import{a as o,t as s}from"./fetch-6HXXdO77.js";import{n as c}from"./locale-store-Ba72bFmP.js";import{$a as l,Ac as u,Ba as d,Bi as f,Cc as p,Dc as m,Do as h,Eo as g,Ga as _,Gi as v,Ha as y,Hi as b,Ji as x,L as S,Nc as C,Oc as w,Os as T,Qc as E,Qi as D,Ra as O,Sc as k,Ss as A,Tl as j,Ts as M,Ua as N,Ui as P,Uo as F,Va as I,Vi as L,Wa as R,Wi as z,Xc as B,Xi as V,Yi as H,Yo as ee,Ys as te,Zi as ne,_i as re,_n as ie,_t as ae,a as oe,aa as se,at as ce,bs as le,bt as ue,ca as de,ci as fe,co as pe,cs as me,d as he,di as ge,ds as _e,ea as ve,ec as ye,er as be,f as xe,fa as Se,fi as Ce,gi as we,ha as Te,hi as Ee,hl as De,ht as Oe,i as ke,ia as Ae,is as je,ks as Me,l as U,la as Ne,lc as Pe,li as Fe,lo as Ie,mi as Le,mo as Re,mt as ze,na as Be,nl as Ve,o as He,oo as Ue,p as We,pi as Ge,ps as W,qi as Ke,qn as qe,r as Je,ra as Ye,s as Xe,so as Ze,st as Qe,ta as $e,tl as et,to as tt,u as nt,ui as rt,vc as it,vi as at,vl as ot,vn as st,wl as ct,wo as G,ws as lt,xl as ut,y as dt,yc as ft,za as pt,zc as mt,zo as ht,zr as gt,zs as _t}from"./index-BOme955B.js";import{t as vt}from"./notes-workbench-SPdKpvSN.js";import{t as yt}from"./page-tabs-DYNWfN6S.js";import{t as bt}from"./directory-picker-path-field-MT71cjgl.js";import{t as xt}from"./goals-config-api--3Vzceq-.js";import{n as St,t as Ct}from"./goal-create-dialog-BOWSTGB-.js";import{t as wt}from"./workflow-start-dialog-B5xdDFV-.js";var K=n(),q=e(t(),1),J=r(),Tt=`application/x-xopc-work-item`,Et=[`backlog`,`todo`,`in_progress`,`blocked`,`needs_input`,`in_review`,`done`],Dt=[`low`,`normal`,`high`,`urgent`];function Ot(e){return e===`done`||e===`in_review`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`blocked`||e===`needs_input`?`bg-red-500/10 text-red-700 dark:text-red-300`:e===`in_progress`?`bg-accent-soft text-accent-fg`:e===`backlog`||e===`todo`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:`bg-surface-muted text-fg-subtle`}function kt(e){return e?new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(new Date(e)):``}function At(e){return!Number.isFinite(e)||e<=0?`0 B`:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(+(e<10*1024))} KB`:`${(e/(1024*1024)).toFixed(+(e<10*1024*1024))} MB`}function Y(e){return`${e.name}:${e.size}:${e.lastModified}`}function jt(e,t){return fe(e,t)!==`unsupported`}function Mt(e,t){return e.startsWith(`image/`)?`image`:e.startsWith(`audio/`)?`audio`:t===`image`||t===`audio`||t===`video`?t:`document`}function Nt(e,t){return{id:e.id,name:e.fileName,type:Mt(e.mimeType,e.type),mimeType:e.mimeType,size:e.size,...t?{content:t,preview:e.mimeType.startsWith(`image/`)?t:void 0}:{}}}async function Pt(e,t){let n=rt(e.name||`upload`,e.type||`application/octet-stream`),r=de(await e.arrayBuffer());return{id:t,name:e.name||`upload`,type:Mt(n),mimeType:n,size:e.size,content:r,preview:n.startsWith(`image/`)?r:void 0}}function Ft(e){let t=(0,K.c)(3),[n,r]=(0,q.useState)(``),i,a;return t[0]===e?(i=t[1],a=t[2]):(i=()=>{if(!e){r(``);return}let t=URL.createObjectURL(e);return r(t),()=>URL.revokeObjectURL(t)},a=[e],t[0]=e,t[1]=i,t[2]=a),(0,q.useEffect)(i,a),n}function It(e,t){let n=(0,K.c)(5),[r,i]=(0,q.useState)(``),a,o;return n[0]!==t.id||n[1]!==t.mimeType||n[2]!==e?(a=()=>{if(!e||!t.mimeType.startsWith(`image/`)){i(``);return}let n=!1,r=``;return(async()=>{let a=await s(We(e,t.id));if(!a.ok||n)return;let o=await a.blob();n||(r=URL.createObjectURL(o),i(r))})().catch(()=>{n||i(``)}),()=>{n=!0,r&&URL.revokeObjectURL(r)}},o=[t.id,t.mimeType,e],n[0]=t.id,n[1]=t.mimeType,n[2]=e,n[3]=a,n[4]=o):(a=n[3],o=n[4]),(0,q.useEffect)(a,o),r}function Lt(e){let t=(0,K.c)(11),{name:n,mimeType:r,thumbnailUrl:i,previewable:a,disabled:o,onOpen:s}=e,c;t[0]===r?c=t[1]:(c=r.startsWith(`image/`),t[0]=r,t[1]=c);let l=c,u;t[2]!==l||t[3]!==n||t[4]!==i?(u=l&&i?(0,J.jsx)(`img`,{src:i,alt:n,className:`size-10 rounded-md object-cover`}):(0,J.jsx)(`span`,{className:`inline-flex size-10 items-center justify-center rounded-md border border-edge bg-surface-muted`,children:(0,J.jsx)(p,{className:`size-4 text-fg-muted`,"aria-hidden":!0})}),t[2]=l,t[3]=n,t[4]=i,t[5]=u):u=t[5];let d=u;if(!a)return d;let f;return t[6]!==d||t[7]!==o||t[8]!==n||t[9]!==s?(f=(0,J.jsx)(`button`,{type:`button`,className:`shrink-0 rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel disabled:cursor-wait disabled:opacity-70`,title:n,"aria-label":n,disabled:o,onClick:s,children:d}),t[6]=d,t[7]=o,t[8]=n,t[9]=s,t[10]=f):f=t[10],f}function Rt(e){return e.kind===`chat`?`/chat/${encodeURIComponent(e.targetId)}`:e.kind===`goal`?`/goals/${encodeURIComponent(e.targetId)}`:e.kind===`workflow_run`?`/workflows?run=${encodeURIComponent(e.targetId)}`:e.kind===`automation`?`/automations?automationId=${encodeURIComponent(e.targetId)}`:`#`}function zt(e){return e instanceof Element?!!e.closest(`a,button,input,select,textarea,[contenteditable="true"],[draggable="true"],[data-board-pan-skip="true"]`):!0}function Bt(e,t){return e.nextAction||e.blockedReason||e.description||t.noNextAction}function Vt(e){let t=(0,K.c)(63),{item:n,dragging:r,onOpen:a,onToggleDone:o,onDragStart:s,onDragEnd:c,t:l}=e,u=n.status===`done`,d;t[0]!==n||t[1]!==s?(d=e=>s(n,e),t[0]=n,t[1]=s,t[2]=d):d=t[2];let f=l.dragToUpdate,p=r&&`opacity-50`,h;t[3]===p?h=t[4]:(h=i(`flex min-h-24 w-full min-w-0 max-w-full cursor-grab flex-col overflow-hidden rounded-lg bg-surface-panel px-3 py-3 shadow-surface transition-colors hover:bg-surface-hover active:cursor-grabbing`,p),t[3]=p,t[4]=h);let g=u?`border-success bg-success text-white`:`border-edge bg-surface-base hover:border-accent/50`,_;t[5]===g?_=t[6]:(_=i(`mt-0.5 inline-flex size-3.5 shrink-0 items-center justify-center rounded border transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,g),t[5]=g,t[6]=_);let v=u?l.markTodo:l.markDone,y=u?l.markTodo:l.markDone,b;t[7]!==n||t[8]!==o?(b=()=>o(n),t[7]=n,t[8]=o,t[9]=b):b=t[9];let x;t[10]===u?x=t[11]:(x=u?(0,J.jsx)(B,{className:`size-3`,"aria-hidden":!0}):null,t[10]=u,t[11]=x);let S;t[12]!==x||t[13]!==_||t[14]!==v||t[15]!==y||t[16]!==b?(S=(0,J.jsx)(`button`,{type:`button`,className:_,"aria-label":v,title:y,onClick:b,children:x}),t[12]=x,t[13]=_,t[14]=v,t[15]=y,t[16]=b,t[17]=S):S=t[17];let C;t[18]!==n||t[19]!==a?(C=()=>a(n),t[18]=n,t[19]=a,t[20]=C):C=t[20];let w;t[21]===n.title?w=t[22]:(w=(0,J.jsx)(`h4`,{className:`min-w-0 flex-1 basis-0 text-sm font-medium leading-5 text-fg line-clamp-2`,children:n.title}),t[21]=n.title,t[22]=w);let T;t[23]!==n||t[24]!==l?(T=Bt(n,l),t[23]=n,t[24]=l,t[25]=T):T=t[25];let E;t[26]===T?E=t[27]:(E=(0,J.jsx)(`p`,{className:`mt-2 max-w-full break-words text-xs leading-5 text-fg-muted line-clamp-1`,children:T}),t[26]=T,t[27]=E);let D;t[28]!==C||t[29]!==w||t[30]!==E?(D=(0,J.jsxs)(`button`,{type:`button`,className:`min-w-0 flex-1 text-left`,onClick:C,children:[w,E]}),t[28]=C,t[29]=w,t[30]=E,t[31]=D):D=t[31];let O;t[32]!==S||t[33]!==D?(O=(0,J.jsxs)(`div`,{className:`flex min-w-0 max-w-full items-start gap-2`,children:[S,D]}),t[32]=S,t[33]=D,t[34]=O):O=t[34];let k;t[35]===n.status?k=t[36]:(k=i(`rounded-full px-2 py-0.5 text-[11px] font-medium`,Ot(n.status)),t[35]=n.status,t[36]=k);let A=l.statuses[n.status],j;t[37]!==k||t[38]!==A?(j=(0,J.jsx)(`span`,{className:k,children:A}),t[37]=k,t[38]=A,t[39]=j):j=t[39];let M=l.priorities[n.priority],N;t[40]===M?N=t[41]:(N=(0,J.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-[11px] text-fg-muted`,children:M}),t[40]=M,t[41]=N);let P;t[42]===n.attachments?P=t[43]:(P=n.attachments?.length?(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-surface-muted px-2 py-0.5 text-[11px] text-fg-muted`,children:[(0,J.jsx)(Me,{className:`size-3`,"aria-hidden":!0}),n.attachments.length]}):null,t[42]=n.attachments,t[43]=P);let F;t[44]===n.links?F=t[45]:(F=n.links?.length?(0,J.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-[11px] text-fg-muted`,children:n.links.length}):null,t[44]=n.links,t[45]=F);let I=`/work-items/${encodeURIComponent(n.id)}`,L;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,J.jsx)(m,{className:`size-3`,"aria-hidden":!0}),t[46]=L):L=t[46];let R;t[47]!==l.detail.openItem||t[48]!==I?(R=(0,J.jsxs)(ut,{to:I,className:`ml-auto inline-flex shrink-0 items-center gap-1 rounded-full px-2 py-0.5 text-[11px] font-medium text-accent hover:bg-accent-soft hover:text-accent-fg`,children:[l.detail.openItem,L]}),t[47]=l.detail.openItem,t[48]=I,t[49]=R):R=t[49];let z;t[50]!==j||t[51]!==N||t[52]!==P||t[53]!==F||t[54]!==R?(z=(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5`,children:[j,N,P,F,R]}),t[50]=j,t[51]=N,t[52]=P,t[53]=F,t[54]=R,t[55]=z):z=t[55];let V;return t[56]!==c||t[57]!==l.dragToUpdate||t[58]!==d||t[59]!==O||t[60]!==z||t[61]!==h?(V=(0,J.jsxs)(`article`,{draggable:!0,onDragStart:d,onDragEnd:c,title:f,className:h,children:[O,z]}),t[56]=c,t[57]=l.dragToUpdate,t[58]=d,t[59]=O,t[60]=z,t[61]=h,t[62]=V):V=t[62],V}function Ht(){let e=(0,K.c)(3),t,n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`div`,{className:`size-3.5 shrink-0 rounded-full bg-surface-muted`}),(0,J.jsx)(`div`,{className:`h-3 w-36 rounded bg-surface-muted`})]}),n=(0,J.jsx)(`div`,{className:`mt-3 h-3 w-48 rounded bg-surface-muted`}),e[0]=t,e[1]=n):(t=e[0],n=e[1]);let r;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,J.jsxs)(`article`,{className:`flex h-24 w-full min-w-0 max-w-full flex-col overflow-hidden rounded-lg bg-surface-panel px-3 pt-3 pb-0 shadow-surface`,children:[t,n,(0,J.jsxs)(`div`,{className:`mt-3 flex gap-1.5`,children:[(0,J.jsx)(`div`,{className:`h-5 w-16 rounded-full bg-surface-muted`}),(0,J.jsx)(`div`,{className:`h-5 w-10 rounded-full bg-surface-muted`})]})]}),e[2]=r):r=e[2],r}function Ut(e){let t=(0,K.c)(44),{file:n,index:r,busy:a,previewBusy:o,t:s,onOpen:c,onRemove:l}=e,u,d,f,p;t[0]===n?(u=t[1],d=t[2],f=t[3],p=t[4]):(u=rt(n.name||`upload`,n.type||`application/octet-stream`),d=jt(n.name||`upload`,u),f=Ft,p=u.startsWith(`image/`)?n:null,t[0]=n,t[1]=u,t[2]=d,t[3]=f,t[4]=p);let m=f(p),g=n.name||`upload`,_=a||o,v;t[5]!==n||t[6]!==c?(v=()=>c(n),t[5]=n,t[6]=c,t[7]=v):v=t[7];let y;t[8]!==u||t[9]!==d||t[10]!==g||t[11]!==_||t[12]!==v||t[13]!==m?(y=(0,J.jsx)(Lt,{name:g,mimeType:u,thumbnailUrl:m,previewable:d,disabled:_,onOpen:v}),t[8]=u,t[9]=d,t[10]=g,t[11]=_,t[12]=v,t[13]=m,t[14]=y):y=t[14];let b=d?`rounded-md hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`:`cursor-default`,x;t[15]===b?x=t[16]:(x=i(`min-w-0 flex-1 text-left`,b),t[15]=b,t[16]=x);let S=!d||a||o,C;t[17]!==n||t[18]!==c?(C=()=>c(n),t[17]=n,t[18]=c,t[19]=C):C=t[19];let w=n.name||`upload`,T;t[20]===w?T=t[21]:(T=(0,J.jsx)(`div`,{className:`truncate font-medium text-fg`,children:w}),t[20]=w,t[21]=T);let E;t[22]===n.size?E=t[23]:(E=At(n.size),t[22]=n.size,t[23]=E);let D;t[24]===E?D=t[25]:(D=(0,J.jsx)(`div`,{className:`text-xs text-fg-subtle`,children:E}),t[24]=E,t[25]=D);let O;t[26]!==C||t[27]!==T||t[28]!==D||t[29]!==x||t[30]!==S?(O=(0,J.jsxs)(`button`,{type:`button`,className:x,disabled:S,onClick:C,children:[T,D]}),t[26]=C,t[27]=T,t[28]=D,t[29]=x,t[30]=S,t[31]=O):O=t[31];let k;t[32]!==r||t[33]!==l?(k=()=>l(r),t[32]=r,t[33]=l,t[34]=k):k=t[34];let A;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,J.jsx)(h,{className:`size-3.5`,"aria-hidden":!0}),t[35]=A):A=t[35];let j;t[36]!==a||t[37]!==s.attachments.remove||t[38]!==k?(j=(0,J.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,title:s.attachments.remove,"aria-label":s.attachments.remove,disabled:a,onClick:k,children:A}),t[36]=a,t[37]=s.attachments.remove,t[38]=k,t[39]=j):j=t[39];let M;return t[40]!==O||t[41]!==j||t[42]!==y?(M=(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-md border border-edge bg-surface-panel px-2 py-2 text-sm`,children:[y,O,j]}),t[40]=O,t[41]=j,t[42]=y,t[43]=M):M=t[43],M}function Wt(e){let t=(0,K.c)(56),{item:n,attachment:r,busy:a,previewBusy:o,t:s,onOpen:c,onDownload:l,onRemove:d}=e,f;t[0]!==r.fileName||t[1]!==r.mimeType?(f=jt(r.fileName,r.mimeType),t[0]=r.fileName,t[1]=r.mimeType,t[2]=f):f=t[2];let p=f,m=It(n.id,r),h=a||o,g;t[3]!==r||t[4]!==n||t[5]!==c?(g=()=>c(n,r),t[3]=r,t[4]=n,t[5]=c,t[6]=g):g=t[6];let _;t[7]!==r.fileName||t[8]!==r.mimeType||t[9]!==p||t[10]!==h||t[11]!==g||t[12]!==m?(_=(0,J.jsx)(Lt,{name:r.fileName,mimeType:r.mimeType,thumbnailUrl:m,previewable:p,disabled:h,onOpen:g}),t[7]=r.fileName,t[8]=r.mimeType,t[9]=p,t[10]=h,t[11]=g,t[12]=m,t[13]=_):_=t[13];let v=p?`rounded-md hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`:`cursor-default`,y;t[14]===v?y=t[15]:(y=i(`min-w-0 flex-1 text-left`,v),t[14]=v,t[15]=y);let b=!p||a||o,x;t[16]!==r||t[17]!==n||t[18]!==c?(x=()=>c(n,r),t[16]=r,t[17]=n,t[18]=c,t[19]=x):x=t[19];let S;t[20]===r.fileName?S=t[21]:(S=(0,J.jsx)(`div`,{className:`truncate font-medium text-fg`,children:r.fileName}),t[20]=r.fileName,t[21]=S);let C=r.mimeType,w;t[22]===r.size?w=t[23]:(w=At(r.size),t[22]=r.size,t[23]=w);let T;t[24]!==r.mimeType||t[25]!==w?(T=(0,J.jsxs)(`div`,{className:`truncate text-xs text-fg-subtle`,children:[C,` · `,w]}),t[24]=r.mimeType,t[25]=w,t[26]=T):T=t[26];let E;t[27]!==T||t[28]!==y||t[29]!==b||t[30]!==x||t[31]!==S?(E=(0,J.jsxs)(`button`,{type:`button`,className:y,disabled:b,onClick:x,children:[S,T]}),t[27]=T,t[28]=y,t[29]=b,t[30]=x,t[31]=S,t[32]=E):E=t[32];let D;t[33]!==r||t[34]!==n||t[35]!==l?(D=()=>l(n,r),t[33]=r,t[34]=n,t[35]=l,t[36]=D):D=t[36];let O;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,J.jsx)(u,{className:`size-3.5`,"aria-hidden":!0}),t[37]=O):O=t[37];let k;t[38]!==a||t[39]!==s.attachments.download||t[40]!==D?(k=(0,J.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,title:s.attachments.download,"aria-label":s.attachments.download,disabled:a,onClick:D,children:O}),t[38]=a,t[39]=s.attachments.download,t[40]=D,t[41]=k):k=t[41];let A;t[42]!==r||t[43]!==n||t[44]!==d?(A=()=>d(n,r),t[42]=r,t[43]=n,t[44]=d,t[45]=A):A=t[45];let j;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,J.jsx)(ht,{className:`size-3.5`,"aria-hidden":!0}),t[46]=j):j=t[46];let M;t[47]!==a||t[48]!==s.attachments.remove||t[49]!==A?(M=(0,J.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-danger`,title:s.attachments.remove,"aria-label":s.attachments.remove,disabled:a,onClick:A,children:j}),t[47]=a,t[48]=s.attachments.remove,t[49]=A,t[50]=M):M=t[50];let N;return t[51]!==E||t[52]!==k||t[53]!==M||t[54]!==_?(N=(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-md border border-edge bg-surface-panel px-2 py-2 text-sm`,children:[_,E,k,M]}),t[51]=E,t[52]=k,t[53]=M,t[54]=_,t[55]=N):N=t[55],N}function Gt({mode:e,item:t,pendingFiles:n,busy:r,t:a,onPendingFilesChange:c,onUpload:l,onRemove:u,onDownload:d,onPreviewError:f}){let p=(0,q.useRef)(null),[m,h]=(0,q.useState)(!1),[g,_]=(0,q.useState)(!1),[v,y]=(0,q.useState)(null),[b,x]=(0,q.useState)(null),S=o(e=>e.token),C=t?.attachments??[];function w(r){if(!r.length)return;if(e===`detail`&&t){l(t,r);return}let i=new Set(n.map(Y)),a=[...n];for(let e of r){let t=Y(e);i.has(t)||(i.add(t),a.push(e))}c(a)}function T(e){c(n.filter((t,n)=>n!==e))}async function E(e){let t=Y(e);x(`pending:${t}`);try{y(await Pt(e,`pending:${t}`)),_(!0)}catch(e){f(e instanceof Error?e.message:String(e))}finally{x(null)}}async function D(e,t){x(`saved:${t.id}`);try{let n=await s(We(e.id,t.id));if(!n.ok)throw Error(`HTTP ${n.status}`);y(Nt(t,de(await n.arrayBuffer()))),_(!0)}catch(e){f(e instanceof Error?e.message:String(e))}finally{x(null)}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`section`,{className:i(`grid gap-3 rounded-lg border border-edge bg-surface-base p-3`,m&&`border-accent bg-accent-soft/40`),onDragOver:e=>{e.preventDefault(),h(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||h(!1)},onDrop:e=>{e.preventDefault(),h(!1),w(Array.from(e.dataTransfer.files))},children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsxs)(`h3`,{className:`inline-flex min-w-0 items-center gap-2 text-sm font-semibold text-fg`,children:[(0,J.jsx)(Me,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`truncate`,children:a.attachments.title})]}),(0,J.jsxs)(G,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:r,onClick:()=>p.current?.click(),children:[(0,J.jsx)(le,{className:`size-3.5`,"aria-hidden":!0}),a.attachments.add]}),(0,J.jsx)(`input`,{ref:p,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{w(Array.from(e.target.files??[])),e.currentTarget.value=``}})]}),n.length?(0,J.jsx)(`div`,{className:`grid gap-2`,children:n.map((e,t)=>(0,J.jsx)(Ut,{file:e,index:t,busy:r,previewBusy:b===`pending:${Y(e)}`,t:a,onOpen:e=>void E(e),onRemove:T},Y(e)))}):null,t&&C.length?(0,J.jsx)(`div`,{className:`grid gap-2`,children:C.map(e=>(0,J.jsx)(Wt,{item:t,attachment:e,busy:r,previewBusy:b===`saved:${e.id}`,t:a,onOpen:(e,t)=>void D(e,t),onDownload:d,onRemove:u},e.id))}):null,!n.length&&!C.length?(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:a.attachments.empty}):null]}),(0,J.jsx)(ce,{open:g,attachment:v,authToken:S,layerClassName:`z-[100]`,onClose:()=>{_(!1),y(null)}})]})}function Kt(e){let t=(0,K.c)(170),{mode:n,item:r,initialStatus:a,events:o,busy:s,error:c,notice:u,t:f,onClose:p,onCreate:g,onSave:_,onStartChat:v,onCreateGoal:b,onAddAttachments:x,onRemoveAttachment:S,onDownloadAttachment:C,onPreviewError:w}=e,T=n!==null,[E,D]=(0,q.useState)(``),[k,A]=(0,q.useState)(``),[j,M]=(0,q.useState)(`todo`),[P,L]=(0,q.useState)(`normal`),[z,V]=(0,q.useState)(``),[H,ee]=(0,q.useState)(``),te;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(te=[],t[0]=te):te=t[0];let[ne,re]=(0,q.useState)(te),ie,ae;t[1]!==a||t[2]!==r||t[3]!==n?(ie=()=>{if(n===`create`){D(``),A(``),M(a),L(`normal`),V(``),ee(``),re([]);return}n===`detail`&&r&&(D(r.title),A(r.description??``),M(r.status),L(r.priority),V(r.nextAction??``),ee(r.blockedReason??``),re([]))},ae=[a,r,n],t[1]=a,t[2]=r,t[3]=n,t[4]=ie,t[5]=ae):(ie=t[4],ae=t[5]),(0,q.useEffect)(ie,ae);let oe;t[6]!==H||t[7]!==k||t[8]!==r||t[9]!==n||t[10]!==z||t[11]!==g||t[12]!==_||t[13]!==ne||t[14]!==P||t[15]!==j||t[16]!==E?(oe=function(e){e.preventDefault();let t=E.trim();if(t){if(n===`create`){g({title:t,description:k.trim()||void 0,priority:P,status:j,nextAction:z.trim()||void 0,blockedReason:H.trim()||void 0,attachments:ne});return}r&&_(r,{title:t,description:k.trim()||null,status:j,priority:P,nextAction:z.trim()||null,blockedReason:H.trim()||null})}},t[6]=H,t[7]=k,t[8]=r,t[9]=n,t[10]=z,t[11]=g,t[12]=_,t[13]=ne,t[14]=P,t[15]=j,t[16]=E,t[17]=oe):oe=t[17];let se=oe,ce;t[18]===p?ce=t[19]:(ce=e=>!e&&p(),t[18]=p,t[19]=ce);let ue;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,J.jsx)(I,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[20]=ue):ue=t[20];let de=n===`create`?f.create.title:r?.title||f.title,fe;t[21]===de?fe=t[22]:(fe=(0,J.jsx)(R,{className:`truncate text-base font-semibold text-fg`,children:de}),t[21]=de,t[22]=fe);let pe;t[23]===f.detail.description?pe=t[24]:(pe=(0,J.jsx)(d,{className:`mt-1 text-sm text-fg-muted`,children:f.detail.description}),t[23]=f.detail.description,t[24]=pe);let me;t[25]!==fe||t[26]!==pe?(me=(0,J.jsxs)(`div`,{className:`min-w-0`,children:[fe,pe]}),t[25]=fe,t[26]=pe,t[27]=me):me=t[27];let he;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,J.jsx)(h,{className:`size-4`,"aria-hidden":!0}),t[28]=he):he=t[28];let ge;t[29]===s?ge=t[30]:(ge=(0,J.jsx)(O,{asChild:!0,children:(0,J.jsx)(`button`,{type:`button`,className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,disabled:s,children:he})}),t[29]=s,t[30]=ge);let _e;t[31]!==me||t[32]!==ge?(_e=(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[me,ge]}),t[31]=me,t[32]=ge,t[33]=_e):_e=t[33];let ve;t[34]===c?ve=t[35]:(ve=c?(0,J.jsx)(`div`,{className:`rounded-lg border border-danger/30 bg-danger-soft px-3 py-2 text-sm text-danger`,children:c}):null,t[34]=c,t[35]=ve);let ye;t[36]!==c||t[37]!==u?(ye=!c&&u?(0,J.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-success/30 bg-success-soft px-3 py-2 text-sm text-fg`,role:`status`,"aria-live":`polite`,children:[(0,J.jsx)(B,{className:`mt-0.5 size-4 shrink-0 text-success`,"aria-hidden":!0}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`div`,{className:`font-medium text-success`,children:u.title}),(0,J.jsx)(`div`,{className:`mt-1 text-fg-muted`,children:u.message})]})]}):null,t[36]=c,t[37]=u,t[38]=ye):ye=t[38];let be;t[39]===f.create.titleLabel?be=t[40]:(be=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:f.create.titleLabel}),t[39]=f.create.titleLabel,t[40]=be);let xe;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(xe=e=>D(e.target.value),t[41]=xe):xe=t[41];let Se=n===`create`,Ce;t[42]!==Se||t[43]!==E?(Ce=(0,J.jsx)(`input`,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:E,onChange:xe,autoFocus:Se}),t[42]=Se,t[43]=E,t[44]=Ce):Ce=t[44];let we;t[45]!==be||t[46]!==Ce?(we=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[be,Ce]}),t[45]=be,t[46]=Ce,t[47]=we):we=t[47];let Te;t[48]===f.detail.status?Te=t[49]:(Te=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:f.detail.status}),t[48]=f.detail.status,t[49]=Te);let Ee;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=e=>M(e.target.value),t[50]=Ee):Ee=t[50];let De;t[51]===f.statuses?De=t[52]:(De=Et.map(e=>(0,J.jsx)(tt,{value:e,children:f.statuses[e]},e)),t[51]=f.statuses,t[52]=De);let Oe;t[53]!==j||t[54]!==De?(Oe=(0,J.jsx)(l,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:j,onChange:Ee,children:De}),t[53]=j,t[54]=De,t[55]=Oe):Oe=t[55];let ke;t[56]!==Te||t[57]!==Oe?(ke=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[Te,Oe]}),t[56]=Te,t[57]=Oe,t[58]=ke):ke=t[58];let Ae;t[59]===f.create.priorityLabel?Ae=t[60]:(Ae=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:f.create.priorityLabel}),t[59]=f.create.priorityLabel,t[60]=Ae);let je;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(je=e=>L(e.target.value),t[61]=je):je=t[61];let Me;t[62]===f.priorities?Me=t[63]:(Me=Dt.map(e=>(0,J.jsx)(tt,{value:e,children:f.priorities[e]},e)),t[62]=f.priorities,t[63]=Me);let U;t[64]!==P||t[65]!==Me?(U=(0,J.jsx)(l,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:P,onChange:je,children:Me}),t[64]=P,t[65]=Me,t[66]=U):U=t[66];let Ne;t[67]!==Ae||t[68]!==U?(Ne=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[Ae,U]}),t[67]=Ae,t[68]=U,t[69]=Ne):Ne=t[69];let Pe;t[70]!==ke||t[71]!==Ne?(Pe=(0,J.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[ke,Ne]}),t[70]=ke,t[71]=Ne,t[72]=Pe):Pe=t[72];let Fe;t[73]===f.create.descriptionLabel?Fe=t[74]:(Fe=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:f.create.descriptionLabel}),t[73]=f.create.descriptionLabel,t[74]=Fe);let Ie;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=e=>A(e.target.value),t[75]=Ie):Ie=t[75];let Le;t[76]===k?Le=t[77]:(Le=(0,J.jsx)(`textarea`,{className:`min-h-28 rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`,value:k,onChange:Ie}),t[76]=k,t[77]=Le);let Re;t[78]!==Fe||t[79]!==Le?(Re=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[Fe,Le]}),t[78]=Fe,t[79]=Le,t[80]=Re):Re=t[80];let ze;t[81]!==s||t[82]!==r||t[83]!==n||t[84]!==x||t[85]!==C||t[86]!==w||t[87]!==S||t[88]!==ne||t[89]!==f?(ze=(0,J.jsx)(Gt,{mode:n,item:r,pendingFiles:ne,busy:s,t:f,onPendingFilesChange:re,onUpload:x,onRemove:S,onDownload:C,onPreviewError:w}),t[81]=s,t[82]=r,t[83]=n,t[84]=x,t[85]=C,t[86]=w,t[87]=S,t[88]=ne,t[89]=f,t[90]=ze):ze=t[90];let Be;t[91]!==H||t[92]!==n||t[93]!==z||t[94]!==j||t[95]!==f.blockedReason||t[96]!==f.nextAction?(Be=n===`detail`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:f.nextAction}),(0,J.jsx)(`textarea`,{className:`min-h-20 rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`,value:z,onChange:e=>V(e.target.value)})]}),(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,J.jsx)(`span`,{className:i(`font-medium`,j===`blocked`||j===`needs_input`?`text-red-700 dark:text-red-300`:`text-fg-muted`),children:f.blockedReason}),(0,J.jsx)(`textarea`,{className:i(`min-h-20 rounded-lg border bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`,j===`blocked`||j===`needs_input`?`border-red-500/40`:`border-edge`),value:H,onChange:e=>ee(e.target.value)})]})]}):null,t[91]=H,t[92]=n,t[93]=z,t[94]=j,t[95]=f.blockedReason,t[96]=f.nextAction,t[97]=Be):Be=t[97];let Ve;t[98]!==ve||t[99]!==ye||t[100]!==we||t[101]!==Pe||t[102]!==Re||t[103]!==ze||t[104]!==Be?(Ve=(0,J.jsxs)(`div`,{className:`grid content-start gap-4`,children:[ve,ye,we,Pe,Re,ze,Be]}),t[98]=ve,t[99]=ye,t[100]=we,t[101]=Pe,t[102]=Re,t[103]=ze,t[104]=Be,t[105]=Ve):Ve=t[105];let He;t[106]!==s||t[107]!==r||t[108]!==n||t[109]!==b||t[110]!==v||t[111]!==f.detail.actions||t[112]!==f.detail.createGoal||t[113]!==f.detail.openItem||t[114]!==f.detail.startChat?(He=n===`detail`&&r?(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:f.detail.actions}),(0,J.jsxs)(`div`,{className:`mt-2 grid gap-2`,children:[(0,J.jsxs)(G,{type:`button`,variant:`secondary`,className:`justify-start rounded-lg`,disabled:s,onClick:()=>v(r),children:[(0,J.jsx)(_t,{className:`size-4`,"aria-hidden":!0}),f.detail.startChat]}),(0,J.jsxs)(G,{type:`button`,variant:`secondary`,className:`justify-start rounded-lg`,disabled:s,onClick:()=>b(r),children:[(0,J.jsx)(F,{className:`size-4`,"aria-hidden":!0}),f.detail.createGoal]}),(0,J.jsx)(G,{asChild:!0,variant:`secondary`,className:`justify-start rounded-lg`,children:(0,J.jsxs)(ut,{to:`/work-items/${encodeURIComponent(r.id)}`,children:[(0,J.jsx)(m,{className:`size-4`,"aria-hidden":!0}),f.detail.openItem]})})]})]}):null,t[106]=s,t[107]=r,t[108]=n,t[109]=b,t[110]=v,t[111]=f.detail.actions,t[112]=f.detail.createGoal,t[113]=f.detail.openItem,t[114]=f.detail.startChat,t[115]=He):He=t[115];let Ue;t[116]===f.detail.links?Ue=t[117]:(Ue=(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:f.detail.links}),t[116]=f.detail.links,t[117]=Ue);let We;t[118]!==r||t[119]!==f.detail.noLinks||t[120]!==f.linkKinds?(We=r?.links?.length?r.links.slice(0,6).map(e=>(0,J.jsxs)(ut,{to:Rt(e),className:`flex min-w-0 items-center justify-between gap-3 rounded-md px-2 py-1.5 hover:bg-surface-hover`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.title||e.targetId}),(0,J.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-xs text-fg-muted`,children:[f.linkKinds[e.kind],(0,J.jsx)(m,{className:`size-3.5`,"aria-hidden":!0})]})]},e.id)):(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:f.detail.noLinks}),t[118]=r,t[119]=f.detail.noLinks,t[120]=f.linkKinds,t[121]=We):We=t[121];let Ge;t[122]===We?Ge=t[123]:(Ge=(0,J.jsx)(`div`,{className:`mt-2 grid gap-2 text-sm`,children:We}),t[122]=We,t[123]=Ge);let W;t[124]!==Ue||t[125]!==Ge?(W=(0,J.jsxs)(`section`,{children:[Ue,Ge]}),t[124]=Ue,t[125]=Ge,t[126]=W):W=t[126];let Ke;t[127]===f.detail.activity?Ke=t[128]:(Ke=(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:f.detail.activity}),t[127]=f.detail.activity,t[128]=Ke);let qe;t[129]!==o||t[130]!==f.detail.noActivity||t[131]!==f.eventTypes?(qe=o.length?o.slice(0,5).map(e=>(0,J.jsxs)(`div`,{className:`text-sm`,children:[(0,J.jsx)(`div`,{className:`font-medium text-fg`,children:f.eventTypes[e.type]??e.type}),(0,J.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-subtle`,children:kt(e.createdAt)})]},e.id)):(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:f.detail.noActivity}),t[129]=o,t[130]=f.detail.noActivity,t[131]=f.eventTypes,t[132]=qe):qe=t[132];let Je;t[133]===qe?Je=t[134]:(Je=(0,J.jsx)(`div`,{className:`mt-2 grid gap-2`,children:qe}),t[133]=qe,t[134]=Je);let Ye;t[135]!==Ke||t[136]!==Je?(Ye=(0,J.jsxs)(`section`,{children:[Ke,Je]}),t[135]=Ke,t[136]=Je,t[137]=Ye):Ye=t[137];let Xe;t[138]!==He||t[139]!==W||t[140]!==Ye?(Xe=(0,J.jsxs)(`aside`,{className:`grid content-start gap-5`,children:[He,W,Ye]}),t[138]=He,t[139]=W,t[140]=Ye,t[141]=Xe):Xe=t[141];let Ze;t[142]!==Ve||t[143]!==Xe?(Ze=(0,J.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-6 overflow-y-auto px-5 py-4 lg:grid-cols-[minmax(0,1fr)_16rem]`,children:[Ve,Xe]}),t[142]=Ve,t[143]=Xe,t[144]=Ze):Ze=t[144];let Qe;t[145]!==s||t[146]!==p||t[147]!==f.create.cancel?(Qe=(0,J.jsx)(G,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:p,disabled:s,children:f.create.cancel}),t[145]=s,t[146]=p,t[147]=f.create.cancel,t[148]=Qe):Qe=t[148];let $e;t[149]!==s||t[150]!==E?($e=s||!E.trim(),t[149]=s,t[150]=E,t[151]=$e):$e=t[151];let et;t[152]===n?et=t[153]:(et=n===`create`?(0,J.jsx)(le,{className:`size-4`,"aria-hidden":!0}):null,t[152]=n,t[153]=et);let nt=n===`create`?f.create.submit:f.detail.save,rt;t[154]!==$e||t[155]!==et||t[156]!==nt?(rt=(0,J.jsxs)(G,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:$e,children:[et,nt]}),t[154]=$e,t[155]=et,t[156]=nt,t[157]=rt):rt=t[157];let it;t[158]!==Qe||t[159]!==rt?(it=(0,J.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[Qe,rt]}),t[158]=Qe,t[159]=rt,t[160]=it):it=t[160];let at;t[161]!==se||t[162]!==_e||t[163]!==Ze||t[164]!==it?(at=(0,J.jsxs)(y,{children:[ue,(0,J.jsx)(pt,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(86dvh,48rem)] w-[min(60rem,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,J.jsxs)(`form`,{onSubmit:se,className:`flex min-h-0 flex-1 flex-col`,children:[_e,Ze,it]})})]}),t[161]=se,t[162]=_e,t[163]=Ze,t[164]=it,t[165]=at):at=t[165];let ot;return t[166]!==T||t[167]!==ce||t[168]!==at?(ot=(0,J.jsx)(N,{open:T,onOpenChange:ce,children:at}),t[166]=T,t[167]=ce,t[168]=at,t[169]=ot):ot=t[169],ot}function qt({projectId:e,createRequestKey:t=0}){let n=ct(),r=a(c(e=>e.language)).projectDetailPage.workItems,o=(0,q.useRef)(null),s=(0,q.useRef)(null),[l,u]=(0,q.useState)([]),[d,f]=(0,q.useState)(!0),[p,m]=(0,q.useState)(null),[h,g]=(0,q.useState)(null),[_,v]=(0,q.useState)(!1),[y,b]=(0,q.useState)(null),[x,S]=(0,q.useState)(null),[C,T]=(0,q.useState)(!1),[E,D]=(0,q.useState)(!1),[O,k]=(0,q.useState)(!1),[A,j]=(0,q.useState)(`todo`),[M,N]=(0,q.useState)(null),[P,F]=(0,q.useState)([]),I=(0,q.useCallback)(async(t=`replace`,n=0)=>{f(!0),m(null);try{let r=await Xe(e,{limit:100,offset:n});u(e=>t===`append`?[...e,...r.items]:r.items),D(r.hasMore)}catch(e){m(e instanceof Error?e.message:String(e))}finally{f(!1)}},[e]);(0,q.useEffect)(()=>{I(`replace`,0)},[I]),(0,q.useEffect)(()=>{t&&(N(null),F([]),m(null),g(null),j(`todo`),k(!0))},[t]);let L=(0,q.useMemo)(()=>Et.map(e=>({status:e,title:r.statuses[e],items:l.filter(t=>t.status===e)})),[l,r.statuses]),R=(0,q.useCallback)(e=>{u(t=>t.map(t=>t.id===e.id?e:t)),N(t=>t?.id===e.id?e:t)},[]),z=(0,q.useCallback)(async(e,t)=>{v(!0),m(null),g(null);try{let n=await nt(e.id,t);n.item.archivedAt?(u(e=>e.filter(e=>e.id!==n.item.id)),N(null)):(R(n.item),g({title:r.feedback.savedTitle,message:r.feedback.savedNext}))}catch(e){m(e instanceof Error?e.message:String(e))}finally{v(!1)}},[r.feedback.savedNext,r.feedback.savedTitle,R]),B=(0,q.useCallback)(async e=>{N(e),F([]),m(null),g(null);let t=await U(e.id).catch(()=>null);t&&F(t.events)},[]),V=(0,q.useCallback)(async t=>{v(!0),m(null),g(null);try{let n=await Je(e,t);u(e=>[n.item,...e]),k(!1),N(n.item),F((await U(n.item.id).catch(()=>({events:[]}))).events),g({title:r.feedback.createdTitle,message:r.feedback.createdNext})}catch(e){m(e instanceof Error?e.message:String(e))}finally{v(!1)}},[e,r.feedback.createdNext,r.feedback.createdTitle]),H=(0,q.useCallback)(async(e,t)=>{if(t.length){v(!0),m(null),g(null);try{let n=await xe(e.id,t);R(n.item),F((await U(n.item.id).catch(()=>({events:[]}))).events)}catch(e){m(e instanceof Error?e.message:String(e))}finally{v(!1)}}},[R]),ee=(0,q.useCallback)(async(e,t)=>{v(!0),m(null),g(null);try{let n=await oe(e.id,t.id);R(n.item),F((await U(n.item.id).catch(()=>({events:[]}))).events)}catch(e){m(e instanceof Error?e.message:String(e))}finally{v(!1)}},[R]),te=(0,q.useCallback)(async(e,t)=>{m(null),g(null);try{await He(e.id,t)}catch(e){m(e instanceof Error?e.message:String(e))}},[]),ne=(0,q.useCallback)(async e=>{v(!0),m(null),g(null);try{let t=await he(e.id);R(t.item),await B(t.item),n(`/chat/${encodeURIComponent(t.session.key)}`)}catch(e){m(e instanceof Error?e.message:String(e))}finally{v(!1)}},[n,B,R]),re=(0,q.useCallback)(async e=>{v(!0),m(null),g(null);try{let t=await ke(e.id);R(t.item),await B(t.item),n(`/goals/${encodeURIComponent(t.goal.id)}`)}catch(e){m(e instanceof Error?e.message:String(e))}finally{v(!1)}},[n,B,R]),ie=(0,q.useCallback)((e,t)=>{t.dataTransfer.effectAllowed=`move`,t.dataTransfer.setData(Tt,e.id),b(e.id)},[]),ae=(0,q.useCallback)((e,t)=>{t.preventDefault();let n=t.dataTransfer.getData(Tt)||y;S(null),b(null);let r=l.find(e=>e.id===n);!r||r.status===e||z(r,{status:e})},[y,l,z]),se=(0,q.useCallback)(e=>{z(e,{status:e.status===`done`?`todo`:`done`})},[z]),ce=(0,q.useCallback)(e=>{N(null),F([]),m(null),g(null),j(e),k(!0)},[]),ue=(0,q.useCallback)(e=>{let t=s.current;!t||t.pointerId!==e.pointerId||(s.current=null,T(!1),e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},[]),de=(0,q.useCallback)(e=>{if(e.button!==0||y||zt(e.target))return;let t=o.current;t&&(s.current={pointerId:e.pointerId,startX:e.clientX,scrollLeft:t.scrollLeft,active:!1},e.currentTarget.setPointerCapture(e.pointerId))},[y]),fe=(0,q.useCallback)(e=>{let t=s.current,n=o.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,T(!0)),e.preventDefault(),n.scrollLeft=t.scrollLeft-r)},[]);return(0,J.jsxs)(`section`,{id:`project-panel-work-items`,role:`tabpanel`,"aria-labelledby":`project-tab-work-items`,className:`flex h-full min-h-0 flex-col`,children:[p?(0,J.jsx)(`div`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-3 text-sm text-red-700 dark:text-red-300`,children:p}):null,(0,J.jsx)(`section`,{ref:o,className:i(`min-h-0 flex-1 overflow-x-auto rounded-lg px-2 py-2 transition-opacity`,d&&`opacity-60`,C?`cursor-grabbing select-none`:`cursor-grab`),"aria-label":r.boardAria,"aria-busy":d,onPointerDown:de,onPointerMove:fe,onPointerUp:ue,onPointerCancel:ue,onLostPointerCapture:e=>{s.current?.pointerId===e.pointerId&&(s.current=null,T(!1))},children:(0,J.jsx)(`div`,{className:`flex min-h-full min-w-max items-start gap-3 pr-4`,children:L.map(e=>(0,J.jsxs)(`section`,{className:i(`flex max-h-full w-72 min-w-72 max-w-72 shrink-0 flex-col overflow-y-auto rounded-lg bg-surface-base shadow-surface`,x===e.status&&`bg-surface-active`),"aria-label":e.title,onDragOver:t=>{y&&(t.preventDefault(),t.dataTransfer.dropEffect=`move`,S(e.status))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||S(null)},onDrop:t=>ae(e.status,t),children:[(0,J.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-2 px-3 py-3`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,J.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:e.title}),(0,J.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:e.items.length})]}),(0,J.jsx)(w,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0})]}),(0,J.jsxs)(`div`,{className:`mx-2 mt-3 grid min-h-0 min-w-0 content-start gap-2 pb-2 pr-1 [scrollbar-gutter:stable]`,children:[e.items.length?e.items.map(e=>(0,J.jsx)(Vt,{item:e,dragging:y===e.id,onOpen:B,onToggleDone:se,onDragStart:ie,onDragEnd:()=>{b(null),S(null)},t:r},e.id)):d?(0,J.jsxs)(`div`,{className:`grid gap-2 animate-pulse motion-reduce:animate-none`,children:[(0,J.jsx)(Ht,{}),(0,J.jsx)(Ht,{})]}):(0,J.jsx)(`div`,{className:`rounded-lg bg-surface-panel/70 px-3 py-6 text-center text-xs text-fg-subtle`,children:r.emptyColumn}),d?null:(0,J.jsx)(`button`,{type:`button`,className:`inline-flex h-8 w-full items-center justify-center rounded-lg bg-surface-panel/85 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-muted`,"aria-label":r.create.addToColumn.replace(`{{status}}`,e.title),title:r.create.addToColumn.replace(`{{status}}`,e.title),onClick:()=>ce(e.status),children:(0,J.jsx)(le,{className:`size-4`,"aria-hidden":!0})})]})]},e.status))})}),!d&&E?(0,J.jsx)(G,{type:`button`,variant:`secondary`,className:`justify-self-center`,onClick:()=>void I(`append`,l.length),children:r.loadMore}):null,(0,J.jsx)(Kt,{mode:O?`create`:M?`detail`:null,item:M,initialStatus:A,events:P,busy:_,error:p,notice:h,t:r,onClose:()=>{k(!1),N(null),F([]),m(null),g(null)},onCreate:V,onSave:(e,t)=>void z(e,t),onStartChat:ne,onCreateGoal:re,onAddAttachments:(e,t)=>void H(e,t),onRemoveAttachment:(e,t)=>void ee(e,t),onDownloadAttachment:(e,t)=>void te(e,t),onPreviewError:e=>{g(null),m(e)}})]})}var Jt=[{id:`overview`,icon:ye},{id:`work-items`,icon:te},{id:`sessions`,icon:_t},{id:`goals`,icon:F},{id:`workflows`,icon:A},{id:`files`,icon:it},{id:`activity`,icon:Pe},{id:`automations`,icon:g},{id:`notes`,icon:k},{id:`settings`,icon:je}],Yt=Jt.map(e=>e.id),Xt=new Set(Jt.map(e=>e.id)),Zt=`xopc.projectTabs.`,Qt=`xopc.projectFiles.panelWidthPx`,$t=320,en=220,tn=560;function nn(e){return Math.min(tn,Math.max(en,Math.round(e)))}function rn(){try{let e=window.localStorage.getItem(Qt);if(e==null)return $t;let t=Number.parseInt(e,10);return Number.isFinite(t)?nn(t):$t}catch{return $t}}function an(e){try{window.localStorage.setItem(Qt,String(nn(e)))}catch{}}function on(e){return!!(e&&Xt.has(e))}function sn(e){return`${Zt}${e}`}function cn(e){let t=Array.isArray(e)?e:[],n=new Set,r=[];for(let e of t)!on(e)||n.has(e)||(n.add(e),r.push(e));for(let e of Yt)n.has(e)||r.push(e);return r}function ln(e){if(!e)return Yt;try{let t=window.localStorage.getItem(sn(e));return cn(t?JSON.parse(t):null)}catch{return Yt}}function un(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function dn(e,t=``){if(!e)return t;let n=new Date(e);return Number.isNaN(n.getTime())?String(e):new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(n)}function fn(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 pn(e){return e===`succeeded`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`failed`||e===`timeout`||e===`cancelled`?`bg-red-500/10 text-red-700 dark:text-red-300`:e===`running`||e===`queued`?`bg-accent-soft text-accent-fg`:`bg-surface-hover text-fg-muted`}function mn(e){let t=(0,K.c)(8),{label:n,hint:r,children:i}=e,a;t[0]===n?a=t[1]:(a=(0,J.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,J.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,J.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 hn(e=!1){return i(`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,K.c)(10),{label:n,value:r,mono:a}=e,o=a===void 0?!1:a,s;t[0]===n?s=t[1]:(s=(0,J.jsx)(`div`,{className:`text-xs font-medium text-fg-subtle`,children:n}),t[0]=n,t[1]=s);let c=o&&`font-mono text-xs`,l;t[2]===c?l=t[3]:(l=i(`mt-1 min-w-0 truncate text-sm text-fg`,c),t[2]=c,t[3]=l);let u;t[4]!==l||t[5]!==r?(u=(0,J.jsx)(`div`,{className:l,title:r,children:r}),t[4]=l,t[5]=r,t[6]=u):u=t[6];let d;return t[7]!==s||t[8]!==u?(d=(0,J.jsxs)(`div`,{className:`min-w-0 rounded-md bg-surface-base px-3 py-2`,children:[s,u]}),t[7]=s,t[8]=u,t[9]=d):d=t[9],d}function X(e){return[e.name,e.slug,e.workspaceRoot,e.description,e.brief].filter(Boolean).join(` `).toLowerCase()}function _n(e){let t=e.lastActiveAt??e.updatedAt??e.createdAt,n=t?new Date(t).getTime():0;return Number.isFinite(n)?n:0}function vn(e){return e.trim().replace(/[\\/]+$/,``).split(/[\\/]/).filter(Boolean).pop()??``}function yn(e){let t=e?.body;return t?.code===`workspace_root_missing`&&t.workspaceRoot?t.workspaceRoot:null}function bn(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 Sn(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 Cn(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 wn(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 Tn(e,t,n){return e.map(e=>e.path===t?{...e,children:n}:e.isDirectory&&e.children?.length?{...e,children:Tn(e.children,t,n)}:e)}function En({currentProject:e,pm:t,projectsText:n,wd:r}){let a=ct(),[o,s]=(0,q.useState)(!1),[c,l]=(0,q.useState)([e]),[u,f]=(0,q.useState)(``),[p,m]=(0,q.useState)(!1),[h,g]=(0,q.useState)(null),[_,v]=(0,q.useState)(!1),[b,x]=(0,q.useState)(`new`),[S,C]=(0,q.useState)(``),[w,T]=(0,q.useState)(``),[E,k]=(0,q.useState)(!1),[A,j]=(0,q.useState)(null),[M,P]=(0,q.useState)(null),F=(0,q.useCallback)(async()=>{m(!0),g(null);try{let t=await D({limit:100});l(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){g(e instanceof Error?e.message:String(e))}finally{m(!1)}},[e]);(0,q.useEffect)(()=>{l(t=>[e,...t.filter(t=>t.id!==e.id)])},[e]),(0,q.useEffect)(()=>{o&&F()},[F,o]);let z=(0,q.useMemo)(()=>{let t=u.trim().toLowerCase().split(/\s+/).filter(Boolean);return c.filter(t=>t.id!==e.id).filter(e=>{if(t.length===0)return!0;let n=X(e);return t.every(e=>n.includes(e))}).sort((e,t)=>_n(t)-_n(e))},[e.id,c,u]),B=e=>t.statuses[e.status]??e.status,V=e=>e.workspaceRoot||e.effectiveWorkspaceRoot||e.description||e.brief||t.common.defaultWorkspace,H=e=>{x(e),C(``),T(``),j(null),v(!0),s(!1)},ee=(0,q.useCallback)(async(e={})=>{let t=w.trim(),n=S.trim()||(b===`directory`?vn(t):``);if(n){k(!0),j(null),P(null);try{let r=await L({name:n,...t?{workspaceRoot:t}:{},...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});v(!1),C(``),T(``),l(e=>[r,...e.filter(e=>e.id!==r.id)]),a(`/projects/${encodeURIComponent(r.id)}`)}catch(e){let t=yn(e);t?(P(t),v(!1)):j(e instanceof Error?e.message:String(e))}finally{k(!1)}}},[b,S,a,w]),te=(0,q.useCallback)(e=>{e.preventDefault(),ee()},[ee]),ne=(0,q.useCallback)(()=>{ee({createWorkspaceRoot:!0})},[ee]),re=(0,q.useCallback)(()=>{P(null),v(!0)},[]),ie=e=>{T(e),b===`directory`&&!S.trim()&&C(vn(e))},ae=(e,t)=>(0,J.jsxs)(`button`,{type:`button`,className:i(`grid w-full grid-cols-[1rem_minmax(0,1fr)_auto] items-center gap-2 rounded-md px-2 py-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||a(`/projects/${encodeURIComponent(e.id)}`)},children:[(0,J.jsx)(Ve,{className:i(`size-4 text-accent-fg`,!t&&`invisible`),"aria-hidden":!0}),(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.name}),(0,J.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:V(e)})]}),(0,J.jsx)(`span`,{className:i(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,fn(e.status)),children:B(e)})]},e.id);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(pe,{open:o,onOpenChange:s,children:[(0,J.jsx)(Ie,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,className:`group -ml-2 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,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:e.name}),(0,J.jsx)(`span`,{className:i(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,fn(e.status)),children:B(e)})]}),(0,J.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:V(e)})]}),(0,J.jsx)(et,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-data-[state=open]:rotate-180`,"aria-hidden":!0})]})}),(0,J.jsx)(Ze,{children:(0,J.jsxs)(Ue,{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,J.jsxs)(`label`,{className:`relative block`,children:[(0,J.jsx)(me,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,J.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:u,onChange:e=>f(e.target.value),placeholder:t.projectSwitcher.searchPlaceholder,"aria-label":t.projectSwitcher.searchPlaceholder})]}),(0,J.jsxs)(`div`,{className:`mt-1 max-h-[min(54vh,24rem)] overflow-y-auto pr-0.5 [scrollbar-gutter:stable]`,children:[(0,J.jsx)(`div`,{className:`px-2 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.current}),ae(e,!0),(0,J.jsx)(`div`,{className:`px-2 pb-1 pt-3 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.recent}),h?(0,J.jsx)(`div`,{className:`px-2 py-2 text-xs text-red-600 dark:text-red-400`,children:h}):null,p&&z.length===0?(0,J.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.loading}):null,!p&&z.length===0?(0,J.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.noMatches}):null,z.map(e=>ae(e,!1))]}),(0,J.jsxs)(`div`,{className:`mt-1 border-t border-edge-subtle pt-1`,children:[(0,J.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:()=>H(`new`),children:[(0,J.jsx)(le,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.newProject})]}),(0,J.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:()=>H(`directory`),children:[(0,J.jsx)(it,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.openDirectory})]}),(0,J.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),a(`/projects`)},children:[(0,J.jsx)(je,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.manageProjects})]})]})]})})]}),(0,J.jsx)(N,{open:_,onOpenChange:e=>!E&&v(e),children:(0,J.jsxs)(y,{children:[(0,J.jsx)(I,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(pt,{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,J.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,J.jsx)(R,{className:`text-base font-semibold text-fg`,children:b===`directory`?t.projectSwitcher.createFromDirectoryTitle:n.createTitle}),(0,J.jsx)(d,{className:`mt-1 text-sm text-fg-muted`,children:b===`directory`?t.projectSwitcher.createFromDirectoryDescription:n.createDescription})]}),(0,J.jsxs)(`form`,{onSubmit:te,className:`flex min-h-0 flex-1 flex-col`,children:[(0,J.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[A?(0,J.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:A}):null,(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.projectName}),(0,J.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:S,onChange:e=>C(e.target.value),placeholder:`xopc`,autoFocus:!0})]}),(0,J.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.workspaceRoot}),(0,J.jsx)(bt,{value:w,onChange:ie,disabled:E,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,J.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.workspaceHint})]})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(O,{asChild:!0,children:(0,J.jsx)(G,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:E,children:n.cancel})}),(0,J.jsxs)(G,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:E||!(S.trim()||b===`directory`&&vn(w)),children:[(0,J.jsx)(le,{className:`size-4`,"aria-hidden":!0}),n.create]})]})]})]})]})}),(0,J.jsx)(N,{open:!!M,onOpenChange:e=>{e||P(null)},children:(0,J.jsxs)(y,{children:[(0,J.jsx)(I,{className:`fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(pt,{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,J.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,J.jsx)(R,{className:`text-base font-semibold text-fg`,children:n.workspaceMissingTitle}),(0,J.jsx)(d,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:M?un(n.workspaceMissingDescription,{workspace:M}):null})]}),M?(0,J.jsx)(`div`,{className:`px-5 py-4`,children:(0,J.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,J.jsx)(it,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:M})]})}):null,(0,J.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(G,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:re,disabled:E,children:n.workspaceMissingBack}),(0,J.jsxs)(G,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:ne,disabled:E,children:[(0,J.jsx)(ft,{className:`size-4`,"aria-hidden":!0}),n.workspaceMissingCreate]})]})]})]})})]})}function Dn(){let{projectId:e=``,tabId:t,noteId:n}=j(),r=ct(),o=c(e=>e.language),s=a(o),u=s.chat.workingDirectory,p=s.projectDetailPage,m=s.projectsPage,w=_(e=>e.setPageHeader),D=_(e=>e.clearPageHeader),[F,L]=(0,q.useState)(null),[B,te]=(0,q.useState)(null),[oe,ce]=(0,q.useState)([]),[de,pe]=(0,q.useState)(``),[he,ye]=(0,q.useState)([]),[xe,ke]=(0,q.useState)([]),[je,Me]=(0,q.useState)([]),[U,Pe]=(0,q.useState)([]),[Ie,Ve]=(0,q.useState)([]),[He,Ue]=(0,q.useState)(!1),[We,Je]=(0,q.useState)(null),[Xe,Ze]=(0,q.useState)([]),[et,nt]=(0,q.useState)(0),[rt,K]=(0,q.useState)(!1),[Tt,Et]=(0,q.useState)(!1),[Dt,Ot]=(0,q.useState)(!1),[kt,At]=(0,q.useState)([]),Y=(0,q.useRef)(new Set),[jt,Mt]=(0,q.useState)(null),[Nt,Pt]=(0,q.useState)(rn),[Ft,It]=(0,q.useState)(!1),[Lt,Rt]=(0,q.useState)(!1),[zt,Bt]=(0,q.useState)(``),[Vt,Ht]=(0,q.useState)([]),[Ut,Wt]=(0,q.useState)(!1),[Gt,Kt]=(0,q.useState)(null),[Xt,Zt]=(0,q.useState)(!1),[Qt,$t]=(0,q.useState)(null),[en,tn]=(0,q.useState)([]),[X,_n]=(0,q.useState)(``),[vn,Dn]=(0,q.useState)(!0),[On,kn]=(0,q.useState)(!1),[An,jn]=(0,q.useState)(!1),[Mn,Nn]=(0,q.useState)(null),[Pn,Fn]=(0,q.useState)(!1),[In,Ln]=(0,q.useState)(`fixed`),[Rn,zn]=(0,q.useState)(``),[Bn,Vn]=(0,q.useState)(null),[Hn,Un]=(0,q.useState)(!1),[Wn,Gn]=(0,q.useState)(!1),[Kn,qn]=(0,q.useState)(0),[Jn,Yn]=(0,q.useState)(!1),[Xn,Zn]=(0,q.useState)(!1),[Qn,$n]=(0,q.useState)(null),[er,tr]=(0,q.useState)(null),[nr,rr]=(0,q.useState)(!1),[ir,ar]=(0,q.useState)(!1),[or,sr]=(0,q.useState)(!1),[cr,Z]=(0,q.useState)(null),[lr,ur]=(0,q.useState)({defaultAgentId:``,agents:[],models:[],checklistDecomposePolicy:`empty_only`}),[dr,fr]=(0,q.useState)({title:``,reason:``}),[pr,mr]=(0,q.useState)(()=>ln(e)),[Q,hr]=(0,q.useState)({name:``,description:``,status:`active`,defaultAgentId:``,workspaceRoot:``,brief:``,instructions:``}),gr=pr[0]??Yt[0],$=n?`notes`:on(t)?t:gr,_r=(0,q.useCallback)(t=>{e&&r(`/projects/${encodeURIComponent(e)}/${t}`)},[r,e]),vr=(0,q.useCallback)(t=>e?`/projects/${encodeURIComponent(e)}/${t}`:`/projects`,[e]),yr=(0,q.useCallback)(e=>{let t=vr(`goals`);return`/goals/${encodeURIComponent(e)}?returnTo=${encodeURIComponent(t)}`},[vr]),br=(0,q.useCallback)(t=>{e&&r(vr(t),{replace:!0})},[r,e,vr]),xr=(0,q.useCallback)((e,t)=>{br(e),r(t)},[r,br]),Sr=(0,q.useCallback)(e=>t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||br(e)},[br]),Cr=(0,q.useCallback)(e=>e.startsWith(`/goals/`)?`goals`:e.startsWith(`/chat/`)?`sessions`:e.startsWith(`/workflows`)?`workflows`:e.startsWith(`/automations`)?`automations`:e.startsWith(`/notes`)?`notes`:$,[$]);(0,q.useEffect)(()=>{!e||!t||on(t)||r(`/projects/${encodeURIComponent(e)}/${gr}`,{replace:!0})},[gr,r,e,t]),(0,q.useEffect)(()=>{mr(ln(e))},[e]);let wr=(0,q.useCallback)((t,n,r=`before`)=>{t!==n&&mr(i=>{let a=cn(i),o=a.indexOf(t),s=a.indexOf(n);if(o<0||s<0)return a;let[c]=a.splice(o,1),l=a.indexOf(n);return l<0?cn(i):(a.splice(r===`after`?l+1:l,0,c),e&&window.localStorage.setItem(sn(e),JSON.stringify(a)),a)})},[e]);(0,q.useEffect)(()=>{if(!e)return;let t=!1;return Dn(!0),Z(null),Promise.all([V(e),ne(e),H(e),be().catch(()=>null)]).then(([e,n,r,i])=>{if(t)return;let a=e.project;L(a),te(e),ce(n),ye(r),tn(i?.agents??[]),_n(a.defaultAgentId??``),hr({name:a.name,description:a.description??``,status:a.status,defaultAgentId:a.defaultAgentId??``,workspaceRoot:a.workspaceRoot??``,brief:a.brief??``,instructions:a.instructions??``})}).catch(e=>{t||Z(e instanceof Error?e.message:String(e))}).finally(()=>{t||Dn(!1)}),()=>{t=!0}},[e]),(0,q.useEffect)(()=>{let e=!1;async function t(){let[t,n,r]=await Promise.allSettled([be(),ie(),Se()]);e||ur(e=>{let i=t.status===`fulfilled`?t.value.defaultId:e.defaultAgentId,a=F?.defaultAgentId||X||i,o=t.status===`fulfilled`?t.value.agents:e.agents,s=n.status===`fulfilled`?n.value:e.models,c=r.status===`fulfilled`?xt(r.value.payload?.config).checklistDecomposePolicy:e.checklistDecomposePolicy;return{defaultAgentId:a,agents:o.length?o:[{id:a||`main`,workspace:``,profileDir:``,typedModels:{defaultRole:`deep`,preset:[],effective:[]},extends:[],isDefault:!0,skills:{preset:[]},tools:{presetDenied:[],entryDisable:[],effectiveDisable:[]}}],models:s,checklistDecomposePolicy:c}})}return t(),()=>{e=!0}},[F?.defaultAgentId,X]);let Tr=(0,q.useCallback)(async()=>{if(F){Yn(!0),Z(null);try{let[e,t]=await Promise.all([ze(),Oe(100,{ownerAgentId:X||void 0,projectId:F.id})]);ke(e),Me(t)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Yn(!1)}}},[F,X]);(0,q.useEffect)(()=>{F&&Tr()},[F,Tr]);let Er=(0,q.useCallback)(async()=>{if(F){Ue(!0),Z(null);try{let[e,t]=await Promise.all([dt.list({projectId:F.id}),dt.runs(50,void 0,{projectId:F.id})]);Pe(e.automations),Ve(t.runs)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Ue(!1)}}},[F]);(0,q.useEffect)(()=>{$===`automations`&&Er()},[Er,$]);let Dr=(0,q.useCallback)(async()=>{if(F){K(!0),Z(null);try{let e=await Ke(F.id,{includeRelated:Tt,limit:100});Ze(e.items),nt(e.total)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{K(!1)}}},[F,Tt]);(0,q.useEffect)(()=>{$===`activity`&&Dr()},[Dr,$]);let Or=(0,q.useCallback)(async e=>{Je(`run:${e.id}`),Z(null);try{await dt.runNow(e.id),await Er()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Je(null)}},[Er]),kr=(0,q.useCallback)(async e=>{Je(`toggle:${e.id}`),Z(null);try{e.enabled?await dt.pause(e.id):await dt.resume(e.id),await Er()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Je(null)}},[Er]),Ar=(0,q.useCallback)(async()=>{if(!F?.effectiveWorkspaceRoot?.trim()){At([]),Y.current.clear(),$t(null);return}Zt(!0),$t(null),Y.current.clear();try{At(wn((await x(F.id,``)).entries)),Y.current.add(``)}catch(e){At([]),Y.current.clear(),$t(e instanceof Error?e.message:String(e))}finally{Zt(!1)}},[F]),jr=(0,q.useCallback)(async e=>{if(!(!F?.effectiveWorkspaceRoot?.trim()||Y.current.has(e))){Y.current.add(e),$t(null);try{let t=await x(F.id,e);At(n=>Tn(n,e,wn(t.entries)))}catch(t){Y.current.delete(e),$t(t instanceof Error?t.message:String(t))}}},[F]);(0,q.useEffect)(()=>{$===`files`&&Ar()},[Ar,$]);let Mr=zt.trim();(0,q.useEffect)(()=>{if($!==`files`||!F||!Lt||!Mr){Ht([]),Wt(!1),Kt(null);return}let e=!1;Wt(!0),Kt(null),Ht([]);let t=window.setTimeout(()=>{Ye(F.id,Mr,50).then(t=>{e||Ht(t)}).catch(t=>{e||Kt(t instanceof Error?t.message:String(t))}).finally(()=>{e||Wt(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[Mr,F,Lt,$]);let Nr=(0,q.useCallback)(async()=>{if(F){Gn(!0),Z(null);try{let e=await z(F.id);xr(`sessions`,`/chat/${encodeURIComponent(e.key)}`)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Gn(!1)}}},[xr,F]),Pr=(0,q.useCallback)(()=>{_r(`work-items`),qn(e=>e+1)},[_r]),Fr=(0,q.useCallback)(async()=>{if(!F)return;let[e,t]=await Promise.all([V(F.id),H(F.id)]);te(e),L(e.project),ye(t)},[F]),Ir=(0,q.useCallback)(async e=>{if(!F||!e.title.trim())return;let t=Number.parseInt(e.maxTurns,10),n=e.deadline?new Date(e.deadline).getTime():void 0;rr(!0),Z(null);try{await P(F.id,{title:e.title.trim(),description:e.description.trim()||void 0,attachments:e.attachments.length?e.attachments:void 0,priority:e.priority,deadlineAt:Number.isFinite(n)?n:void 0,maxTurns:Number.isFinite(t)?t:void 0,agentId:e.agentId.trim()||void 0,judgeModelRef:e.judgeModelRef.trim()||void 0,contract:{objective:e.objective.trim()||e.title.trim(),scopeBoundary:e.scopeBoundary.trim()||void 0,evidencePlan:St(e.evidencePlan),criteria:St(e.checklist)}}),sr(!1),_r(`goals`),await Fr()}catch(e){throw Z(e instanceof Error?e.message:String(e)),e}finally{rr(!1)}},[_r,F,Fr]),Lr=(0,q.useCallback)(async e=>{if(e.preventDefault(),!(!F||!dr.title.trim())){ar(!0),Z(null);try{await b(F.id,{title:dr.title.trim(),reason:dr.reason.trim()||void 0}),fr({title:``,reason:``}),await Fr()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{ar(!1)}}},[dr.reason,dr.title,F,Fr]),Rr=(0,q.useCallback)(async e=>{if(!(!F||!er)){Zn(!0),Z(null);try{let t=X||F.defaultAgentId||void 0,n=await ue({definitionId:er.id,projectId:F.id,agentId:t,goal:e.goal,input:e.input,concurrency:e.concurrency,maxSubagents:e.maxSubagents});tr(null),await Tr(),xr(`workflows`,S(n.runId,{ownerAgentId:t}))}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Zn(!1)}}},[xr,F,Tr,X,er]),zr=(0,q.useCallback)(async e=>{if(F){$n(`retry:${e.id}`),Z(null);try{let t=await ae(e.id,{ownerAgentId:X||e.metadata?.agentId,projectId:e.metadata?.projectId||F.id});await Tr(),xr(`workflows`,S(t.runId,{ownerAgentId:X||e.metadata?.agentId||F.defaultAgentId}))}catch(e){Z(e instanceof Error?e.message:String(e))}finally{$n(null)}}},[xr,F,Tr,X]),Br=(0,q.useCallback)(async e=>{$n(`cancel:${e.id}`),Z(null);try{await Qe(e.id,{ownerAgentId:X||e.metadata?.agentId}),await Tr()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{$n(null)}},[Tr,X]),Vr=(0,q.useMemo)(()=>(0,J.jsx)(ut,{to:`/projects`,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":p.backToProjects,children:(0,J.jsx)(De,{className:`size-4`,"aria-hidden":!0})}),[p.backToProjects]),Hr=(0,q.useMemo)(()=>F?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(G,{variant:`secondary`,className:`h-9 rounded-lg`,onClick:Pr,children:[(0,J.jsx)(le,{className:`size-4`,"aria-hidden":!0}),p.workItems.create.header]}),(0,J.jsxs)(G,{variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>void Nr(),disabled:Wn,children:[(0,J.jsx)(_t,{className:`size-4`,"aria-hidden":!0}),p.common.newChat]})]}):null,[Pr,p.common.newChat,p.workItems.create.header,F,Nr,Wn]);(0,q.useLayoutEffect)(()=>(w({startExtra:Vr,main:F?(0,J.jsx)(En,{currentProject:F,pm:p,projectsText:m,wd:u}):(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:p.fallbackTitle}),(0,J.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:p.fallbackContext})]}),end:Hr}),()=>D()),[D,Hr,Vr,p,F,m,w,u]);function Ur(e){L(t=>t?{...t,...e}:null),te(t=>t?{...t,project:{...t.project,...e}}:null),_n(e.defaultAgentId??``),hr(t=>({...t,name:e.name,description:e.description??``,status:e.status,defaultAgentId:e.defaultAgentId??``,workspaceRoot:e.workspaceRoot??``,brief:e.brief??``,instructions:e.instructions??``})),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}async function Wr(){if(!(!F||!Q.name.trim())){kn(!0),Z(null),Nn(null);try{Ur(await se(F.id,{name:Q.name.trim(),status:Q.status,description:Q.description,defaultAgentId:Q.defaultAgentId,brief:Q.brief,instructions:Q.instructions}))}catch(e){let t=yn(e);t?Nn(t):Z(e instanceof Error?e.message:String(e))}finally{kn(!1)}}}function Gr(e){e.preventDefault(),Wr()}let Kr=(0,q.useCallback)(()=>{if(!F)return;let e=F.workspaceRoot?.trim()??``;Ln(e?`fixed`:`follow`),zn(e||F.effectiveWorkspaceRoot||``),Fn(!0)},[F]);async function qr(e={}){if(!F)return;let t=In===`fixed`?Rn.trim():``;if(!(In===`fixed`&&!t)){kn(!0),Z(null),Nn(null);try{Ur(await se(F.id,{workspaceRoot:t,...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}})),Fn(!1),Nn(null)}catch(e){let t=yn(e);t?(Nn(t),Fn(!1)):Z(e instanceof Error?e.message:String(e))}finally{kn(!1)}}}async function Jr(){if(!(!F||Bn)){Vn(`pin`),Z(null);try{Ur(F.pinnedAt?await Ae(F.id):await ve(F.id))}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Vn(null)}}}async function Yr(){if(!(!F||Bn)){Vn(`archive`),Z(null);try{Ur(F.status===`archived`?await $e(F.id):await f(F.id))}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Vn(null)}}}async function Xr(){if(F){Un(!0),Z(null);try{await v(F.id),jn(!1),r(`/projects`)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Un(!1)}}}async function Zr(){if(!(!F||Dt)){Ot(!0),Z(null);try{await Be(F.id)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Ot(!1)}}}let Qr=(0,q.useCallback)(e=>{Mt(e)},[]),$r=(0,q.useCallback)((e,t)=>{t||Mt(e)},[]),ei=(0,q.useCallback)(async(e,t,n)=>{let r=F?.id;if(r)switch(e){case`preview`:t.isDirectory||Mt(t.path);break;case`download`:if(t.isDirectory)return;try{let e=Fe(t.path);if(ge(fe(e))!==`text`){let n=await Le(t.path,{projectId:r}),i=Ne(e)??`application/octet-stream`;Ce(e,await n.arrayBuffer(),i)}else{let{content:n}=await Ee(t.path,{projectId:r});Ge(e,n)}}catch(e){at(`warning`,e instanceof Error?e.message:String(e),void 0,{duration:4e3})}break;case`copyPath`:try{await Re(t.absolutePath??t.path)&&at(`success`,s.workspace.pathCopied,void 0,{duration:2500})}catch{at(`warning`,s.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}},[s.clipboard.copyFailed,s.workspace.pathCopied,F?.id]),ti=(0,q.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),It(!0);let r=e.clientX,i=Nt,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=nn(i+(e.clientX-r)),o===0&&(o=window.requestAnimationFrame(l))},d=()=>{o!==0&&(window.cancelAnimationFrame(o),l());try{t.releasePointerCapture(a)}catch{}It(!1),Pt(c),an(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)},[Nt]);if((0,q.useEffect)(()=>{$!==`files`&&Mt(null)},[e,$]),vn)return(0,J.jsx)(`main`,{className:`w-full flex-1 px-3 py-3 text-sm text-fg-muted sm:px-5 sm:py-4 xl:px-6`,children:p.loading});if(!F)return(0,J.jsxs)(`main`,{className:`w-full flex-1 px-3 py-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,J.jsxs)(ut,{to:`/projects`,className:`inline-flex items-center gap-2 text-sm text-accent-fg hover:underline`,children:[(0,J.jsx)(De,{className:`size-4`,"aria-hidden":!0}),p.backToProjects]}),(0,J.jsx)(`p`,{className:`mt-6 rounded-lg bg-surface-panel p-4 shadow-surface text-sm text-fg-muted`,children:cr||p.notFound})]});let ni=B?.recentSessions.length?B.recentSessions:F.recentSessions,ri=B?.attentionItems??[],ii=e=>p.statuses[e]??e,ai=e=>un(p.common.messages,{count:e}),oi=de.trim().toLowerCase(),si=oi?oe.filter(e=>{let t=dn(e.updatedAt),n=e.routing?.agentId||e.agentId||p.common.agent,r=e.name?.trim()||p.sessions.fallbackTitle,i=ai(e.messageCount??0);return[r,e.key,n,t,i].filter(Boolean).join(` `).toLowerCase().includes(oi)}):oe,ci=oe.length>0&&si.length===0,li=en.find(e=>e.id===Q.defaultAgentId)?.name||Q.defaultAgentId||p.settings.globalDefaultAgent,ui=en.find(e=>e.id===Q.defaultAgentId),di=F.workspaceRoot?.trim()||``,fi=F.status===`archived`,pi=!!F.pinnedAt,mi=!di,hi=di||ui?.workspace||F.effectiveWorkspaceRoot||p.common.defaultWorkspace,gi=In===`fixed`?Rn.trim()||p.settings.workspacePlaceholder:ui?.workspace||F.effectiveWorkspaceRoot||p.common.defaultWorkspace,_i=(In===`fixed`?Rn.trim():``)!==di&&(In===`follow`||!!Rn.trim()),vi=pr.map(e=>{let t=Jt.find(t=>t.id===e);return{...t,label:t.id===`work-items`?p.workItems.tab:p.tabs[t.id]}});async function yi(){if(!hi)return;let e=await Re(hi);at(e?`success`:`warning`,e?s.workspace.pathCopied:s.clipboard.copyFailed,void 0,{duration:e?2500:4e3})}function bi(){Nn(null),Fn(!0)}return(0,J.jsxs)(`main`,{className:`flex h-full min-h-0 w-full flex-1 flex-col overflow-hidden px-3 py-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,J.jsx)(yt,{items:vi,activeTab:$,onChange:_r,onReorder:wr,ariaLabel:p.navAria,tabIdPrefix:`project-tab`,panelIdPrefix:`project-panel`,className:`shrink-0`}),cr?(0,J.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:cr}):null,(0,J.jsxs)(`div`,{className:i(`mt-3 min-h-0 flex-1`,$===`work-items`?`-mx-3 -mb-3 overflow-hidden sm:-mx-5 sm:-mb-4 xl:-mx-6`:$===`overview`?`overflow-y-auto pr-1 [scrollbar-gutter:stable] xl:overflow-hidden xl:pr-0`:`overflow-y-auto pr-1 [scrollbar-gutter:stable]`),children:[$===`overview`?(0,J.jsxs)(`section`,{id:`project-panel-overview`,role:`tabpanel`,"aria-labelledby":`project-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,J.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,J.jsx)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel p-4 shadow-surface`,children:(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.directionTitle}),(0,J.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:B?.digest?.summary||B?.recommendedAction||F.description||F.brief||p.overview.directionFallback}),B?.digest?.nextAction?(0,J.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm font-medium leading-6 text-fg`,children:un(p.overview.recommendedNext,{action:B.digest.nextAction})}):null]}),(0,J.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:(0,J.jsxs)(G,{type:`button`,variant:`secondary`,onClick:()=>void Zr(),disabled:Dt,children:[(0,J.jsx)(_e,{className:`size-4`,"aria-hidden":!0}),Dt?p.overview.savingDigest:p.overview.saveDigest]})})]})}),(0,J.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.nextActions}),(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,onClick:()=>sr(!0),children:[(0,J.jsx)(le,{className:`size-4`,"aria-hidden":!0}),p.overview.goal]})]}),(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:B?.nextActions.length?B.nextActions.map(e=>(0,J.jsxs)(ut,{to:yr(e.goalId),onClick:Sr(`goals`),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,J.jsx)(`span`,{className:i(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,fn(e.status)),children:ii(e.status)})]}),(0,J.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:e.nextAction})]},e.goalId)):(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.overview.noNextActions})})]})]}),(0,J.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,J.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.attention}),ri.length?(0,J.jsx)(`div`,{className:`mt-3 grid gap-3`,children:ri.map(e=>{let t=(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(E,{className:`size-4 text-amber-600 dark:text-amber-300`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title})]}),(0,J.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?` · ${ii(e.status)}`:``]})]});return e.href?(0,J.jsx)(ut,{to:e.href,onClick:Sr(Cr(e.href)),className:`min-w-0 rounded-md bg-surface-base p-3 hover:bg-surface-hover`,children:t},e.id):(0,J.jsx)(`div`,{className:`min-w-0 rounded-md bg-surface-base p-3`,children:t},e.id)})}):(0,J.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:p.overview.noBlockedGoals}),(0,J.jsxs)(`form`,{onSubmit:Lr,className:`mt-4 flex gap-2 border-t border-edge pt-4`,children:[(0,J.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:dr.title,onChange:e=>fr(t=>({...t,title:e.target.value})),placeholder:p.overview.blockerTitlePlaceholder}),(0,J.jsx)(G,{type:`submit`,variant:`secondary`,className:`shrink-0 rounded-lg px-3`,disabled:ir||!dr.title.trim(),"aria-label":ir?p.overview.addingBlocker:p.overview.addBlocker,title:ir?p.overview.addingBlocker:p.overview.addBlocker,children:(0,J.jsx)(le,{className:`size-4`,"aria-hidden":!0})})]})]}),(0,J.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(mt,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`h2`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:p.overview.recentSessions})]}),(0,J.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,onClick:()=>_r(`sessions`),children:p.common.viewAll})]}),(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:ni.length?ni.map(e=>(0,J.jsxs)(ut,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:Sr(`sessions`),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.name||e.key}),(0,J.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:dn(e.updatedAt)})]}),(0,J.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:e.agentId||p.common.agent})]},e.key)):(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.overview.noSessions})})]})]})]}):null,$===`work-items`?(0,J.jsx)(qt,{projectId:F.id,createRequestKey:Kn}):null,$===`workflows`?(0,J.jsxs)(`section`,{id:`project-panel-workflows`,role:`tabpanel`,"aria-labelledby":`project-tab-workflows`,className:`grid h-full min-h-[28rem] gap-4 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,J.jsx)(`div`,{className:`min-h-0`,children:(0,J.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.workflows.runsTitle}),(0,J.jsx)(`p`,{className:`text-xs text-fg-muted`,children:p.workflows.runsHint})]}),(0,J.jsxs)(G,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg`,onClick:()=>void Tr(),disabled:Jn,children:[(0,J.jsx)(W,{className:`size-4`,"aria-hidden":!0}),p.common.refresh]})]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 divide-y divide-edge overflow-y-auto`,children:Jn&&je.length===0?(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.workflows.loadingRuns}):je.length?je.map(e=>{let t=e.status===`queued`||e.status===`running`,n=e.status===`failed`||e.status===`timeout`||e.status===`cancelled`;return(0,J.jsxs)(`div`,{className:`grid gap-2 px-4 py-3 hover:bg-surface-hover`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`button`,{type:`button`,className:`min-w-0 truncate text-left text-sm font-medium text-fg hover:text-accent-fg`,onClick:()=>xr(`workflows`,S(e.id,{ownerAgentId:X||e.metadata?.agentId||F.defaultAgentId})),children:e.title||e.definitionId}),(0,J.jsx)(`span`,{className:i(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,pn(e.status)),children:ii(e.status)})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,J.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:un(p.workflows.runMeta,{definitionId:e.definitionId,done:e.metrics.doneAgentCount,total:e.metrics.agentCount,time:dn(e.createdAtMs)})}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,J.jsx)(G,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,onClick:()=>xr(`workflows`,S(e.id,{ownerAgentId:X||e.metadata?.agentId||F.defaultAgentId})),children:p.common.open}),n?(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:Qn===`retry:${e.id}`,onClick:()=>void zr(e),children:[(0,J.jsx)(W,{className:`size-3.5`,"aria-hidden":!0}),p.common.retry]}):null,t?(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:Qn===`cancel:${e.id}`,onClick:()=>void Br(e),children:[(0,J.jsx)(ee,{className:`size-3.5`,"aria-hidden":!0}),p.common.cancel]}):null]})]})]},e.id)}):(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.workflows.emptyRuns})})]})}),(0,J.jsx)(`aside`,{className:`min-h-0`,children:(0,J.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-4 py-3`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.workflows.startTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:p.workflows.startHint})]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:(0,J.jsx)(`div`,{className:`grid gap-2`,children:xe.length?xe.map(e=>(0,J.jsxs)(`button`,{type:`button`,className:`grid gap-1 rounded-md bg-surface-base p-3 text-left hover:bg-surface-hover focus:outline-none focus:ring-2 focus:ring-accent/30`,onClick:()=>tr(e),children:[(0,J.jsxs)(`span`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,J.jsx)(A,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:e.title})]}),(0,J.jsx)(`span`,{className:`line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description||e.metadata.whenToUse||e.name})]},e.id)):(0,J.jsx)(`div`,{className:`px-1 py-3 text-sm text-fg-muted`,children:p.workflows.emptyDefinitions})})})]})})]}):null,$===`automations`?(0,J.jsxs)(`section`,{id:`project-panel-automations`,role:`tabpanel`,"aria-labelledby":`project-tab-automations`,className:`grid h-full min-h-[28rem] overflow-hidden gap-4 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,J.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.automations.title}),(0,J.jsx)(`p`,{className:`text-xs text-fg-muted`,children:p.automations.hint})]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsxs)(G,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg`,onClick:()=>void Er(),disabled:He,children:[(0,J.jsx)(W,{className:`size-4`,"aria-hidden":!0}),p.common.refresh]}),(0,J.jsxs)(G,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>xr(`automations`,`/automations?projectId=${encodeURIComponent(F.id)}&action=create`),children:[(0,J.jsx)(le,{className:`size-4`,"aria-hidden":!0}),p.common.new]})]})]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 divide-y divide-edge overflow-y-auto`,children:He&&U.length===0?(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.automations.loading}):U.length?U.map(e=>{let t=Ie.find(t=>t.automationId===e.id),n=e.state.runningRunId?Ie.find(t=>t.id===e.state.runningRunId):null;return(0,J.jsxs)(`div`,{className:`grid gap-2 px-4 py-3 hover:bg-surface-hover`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`button`,{type:`button`,className:`min-w-0 truncate text-left text-sm font-medium text-fg hover:text-accent-fg`,onClick:()=>xr(`automations`,`/automations?automation=${encodeURIComponent(e.id)}`),children:e.name}),(0,J.jsx)(`span`,{className:i(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,e.enabled?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-surface-hover text-fg-muted`),children:e.enabled?p.automations.enabled:p.automations.paused})]}),(0,J.jsx)(`p`,{className:`line-clamp-2 text-sm leading-5 text-fg-muted`,children:e.description||e.action.kind}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,J.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:un(p.common.lastRun,{trigger:e.trigger.kind,action:e.action.kind,time:t?dn(t.createdAtMs):p.common.never})}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:We===`run:${e.id}`||!!n,onClick:()=>void Or(e),children:[(0,J.jsx)(A,{className:`size-3.5`,"aria-hidden":!0}),p.automations.run]}),(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:We===`toggle:${e.id}`,onClick:()=>void kr(e),children:[e.enabled?(0,J.jsx)(T,{className:`size-3.5`,"aria-hidden":!0}):(0,J.jsx)(A,{className:`size-3.5`,"aria-hidden":!0}),e.enabled?p.automations.pause:p.automations.resume]})]})]})]},e.id)}):(0,J.jsxs)(`div`,{className:`grid gap-3 px-4 py-6 text-sm text-fg-muted`,children:[(0,J.jsx)(`p`,{children:p.automations.empty}),(0,J.jsx)(`div`,{children:(0,J.jsxs)(G,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>xr(`automations`,`/automations?projectId=${encodeURIComponent(F.id)}&action=create`),children:[(0,J.jsx)(g,{className:`size-4`,"aria-hidden":!0}),p.automations.create]})})]})})]}),(0,J.jsxs)(`aside`,{className:`grid min-h-0 min-w-0 content-start gap-4 overflow-y-auto pr-1 [scrollbar-gutter:stable]`,children:[(0,J.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.automations.recentRuns})}),(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:Ie.length?Ie.slice(0,8).map(e=>(0,J.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.automationName}),(0,J.jsx)(`span`,{className:i(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,pn(e.status)),children:ii(e.status)})]}),(0,J.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:dn(e.createdAtMs)})]},e.id)):(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.automations.emptyRuns})})]}),(0,J.jsxs)(`div`,{className:`rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.automations.contextTitle}),(0,J.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:p.automations.contextHint}),(0,J.jsx)(`p`,{className:`mt-3 break-all text-xs text-fg-subtle`,children:F.workspaceRoot||F.effectiveWorkspaceRoot||p.common.defaultWorkspace})]})]})]}):null,$===`notes`?(0,J.jsx)(`section`,{id:`project-panel-notes`,role:`tabpanel`,"aria-labelledby":`project-tab-notes`,className:`flex h-full min-h-[28rem] overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:(0,J.jsx)(vt,{selectedNoteId:n,basePath:`/projects/${encodeURIComponent(F.id)}/notes`,showLibrary:!1,allowMediaCapture:!1,listTag:`project:${F.id}`,captureTags:[`project:${F.id}`,F.slug],listTitle:p.notes.title,listDescription:p.notes.hint,emptyText:p.notes.emptyTitle,emptyDescription:p.notes.emptyDescription,listWidthStorageKey:`xopc.projectNotes.listWidth.${F.id}`})}):null,$===`files`?(0,J.jsx)(`section`,{id:`project-panel-files`,role:`tabpanel`,"aria-labelledby":`project-tab-files`,className:`h-full min-h-[28rem]`,children:(0,J.jsx)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:F.effectiveWorkspaceRoot?(0,J.jsxs)(`div`,{"data-project-files-grid":!0,className:i(`grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[var(--project-files-panel-width)_6px_minmax(0,1fr)]`,Ft&&`cursor-col-resize select-none`),style:{"--project-files-panel-width":`${Nt}px`},children:[(0,J.jsxs)(`aside`,{className:`flex min-h-0 flex-col border-b border-edge lg:border-b-0 lg:border-r`,children:[(0,J.jsxs)(`div`,{className:`flex h-11 items-center gap-1 border-b border-edge bg-surface-muted/50 px-3 text-sm`,children:[(0,J.jsx)(gt,{workspacePath:hi}),(0,J.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[(0,J.jsx)(`button`,{type:`button`,className:i(`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,Lt&&`bg-surface-hover text-fg`),onClick:()=>Rt(!0),"aria-label":p.files.search,title:p.files.search,"aria-pressed":Lt,children:(0,J.jsx)(me,{className:`size-3.5`,"aria-hidden":!0})}),(0,J.jsx)(re,{className:`size-7 shrink-0 rounded-md p-0`,loading:Xt,label:s.cron.refresh,onClick:()=>void Ar()})]})]}),Lt?(0,J.jsx)(`div`,{className:`shrink-0 border-b border-edge bg-surface-muted/40 px-3 py-2`,children:(0,J.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,J.jsx)(me,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`input`,{type:`text`,role:`searchbox`,value:zt,onChange:e=>Bt(e.target.value),placeholder:p.files.searchPlaceholder,"aria-label":p.files.searchPlaceholder,autoFocus:!0,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none placeholder:text-fg-subtle`}),(0,J.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:()=>{Bt(``),Rt(!1)},children:(0,J.jsx)(h,{className:`size-3.5`,"aria-hidden":!0})})]})}):null,Qt?(0,J.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:Qt}):null,Mr?(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-2`,children:Ut?(0,J.jsxs)(`div`,{className:`space-y-2 px-3 py-1`,children:[(0,J.jsx)(Te,{className:`h-11 w-full`}),(0,J.jsx)(Te,{className:`h-11 w-full`}),(0,J.jsx)(Te,{className:`h-11 w-full`})]}):Gt?(0,J.jsxs)(`p`,{className:`px-3 py-2 text-xs text-red-600 dark:text-red-400`,children:[s.workspace.loadError,`: `,Gt]}):Vt.length===0?(0,J.jsx)(`p`,{className:`px-3 py-2 text-xs text-fg-muted`,children:p.files.noSearchResults}):Vt.map(e=>(0,J.jsxs)(`button`,{type:`button`,className:i(`flex w-full min-w-0 items-center gap-2 px-3 py-2 text-left hover:bg-surface-hover`,jt===e.path&&`bg-accent-soft text-accent-fg`),onClick:()=>Mt(e.path),title:e.path,children:[(0,J.jsx)(k,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`span`,{className:`block truncate text-sm text-fg`,children:e.name}),(0,J.jsx)(`span`,{className:`block truncate text-xs text-fg-subtle`,children:e.path})]})]},e.path))}):Xt&&kt.length===0?(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.files.loading}):(0,J.jsx)(we,{tree:kt,selectedPath:jt,onSelectFile:Qr,onSelectEntry:$r,onExpandDir:e=>void jr(e),onAction:ei,actionLabels:{preview:s.workspace.preview,download:s.workspace.download,copyPath:s.workspace.copyPath,openDefault:s.workspace.openSystemApp,openWith:s.workspace.openWith,revealInFolder:s.workspace.revealInFolder,recommendedApps:s.workspace.recommendedApps},emptyHint:p.files.emptyDirectory})]}),(0,J.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":p.files.resizeHandle,className:i(`hidden cursor-col-resize touch-none items-stretch justify-center bg-surface-panel transition-colors hover:bg-surface-hover lg:flex`,Ft&&`bg-surface-hover`),onPointerDown:ti,children:(0,J.jsx)(`div`,{className:`my-3 w-px rounded-full bg-edge-strong/70`})}),(0,J.jsx)(`div`,{className:`min-h-0 min-w-0 overflow-hidden bg-surface-base`,children:jt?(0,J.jsx)(st,{filePath:jt,projectId:F.id,onClose:()=>Mt(null)}):(0,J.jsx)(`div`,{className:`flex h-full min-h-[18rem] items-center justify-center px-6 text-center`,children:(0,J.jsxs)(`div`,{className:`max-w-sm`,children:[(0,J.jsx)(it,{className:`mx-auto size-8 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:p.files.previewEmptyTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.files.previewEmptyDescription})]})})})]}):(0,J.jsxs)(`div`,{className:`grid gap-3 px-4 py-8 text-sm text-fg-muted`,children:[(0,J.jsx)(`p`,{children:p.files.needWorkspace}),(0,J.jsx)(`div`,{children:(0,J.jsx)(G,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>_r(`settings`),children:p.files.openSettings})})]})})}):null,$===`sessions`?(0,J.jsxs)(`section`,{id:`project-panel-sessions`,role:`tabpanel`,"aria-labelledby":`project-tab-sessions`,className:`grid min-h-full content-start gap-3`,children:[oe.length?(0,J.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,J.jsx)(me,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,"aria-hidden":!0}),(0,J.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:de,onChange:e=>pe(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`}),de?(0,J.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:()=>pe(``),children:(0,J.jsx)(h,{className:`size-3.5`,"aria-hidden":!0})}):null]}):null,si.length?(0,J.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:si.map(e=>{let t=dn(e.updatedAt),n=e.routing?.agentId||e.agentId||p.common.agent,r=e.name?.trim()||p.sessions.fallbackTitle,i=ai(e.messageCount??0);return(0,J.jsxs)(ut,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:Sr(`sessions`),className:`group flex min-h-[11rem] 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,J.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,J.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,J.jsx)(_t,{className:`size-4`,"aria-hidden":!0})}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:r}),(0,J.jsx)(`p`,{className:`mt-1 line-clamp-2 break-all font-mono text-xs leading-5 text-fg-muted`,title:e.key,children:e.key})]})]}),(0,J.jsxs)(`div`,{className:`mt-auto grid gap-2 pt-4 text-xs text-fg-muted`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,J.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,J.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:i})]}),t?(0,J.jsxs)(`span`,{className:`truncate rounded-md bg-surface-base px-2 py-1`,children:[p.sessions.updated,`: `,t]}):null]})]},e.key)})}):ci?(0,J.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:p.sessions.noMatches})}):(0,J.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:p.sessions.emptyTitle}),(0,J.jsx)(`p`,{className:`mx-auto mt-1 max-w-md text-sm leading-6 text-fg-muted`,children:p.sessions.emptyDescription})]})})]}):null,$===`goals`?(0,J.jsxs)(`section`,{id:`project-panel-goals`,role:`tabpanel`,"aria-labelledby":`project-tab-goals`,className:`grid min-h-full content-start gap-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`div`,{children:(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.goals.title})}),(0,J.jsxs)(G,{type:`button`,variant:`primary`,className:`h-9 rounded-lg px-3`,disabled:nr,onClick:()=>sr(!0),children:[(0,J.jsx)(le,{className:`size-4`,"aria-hidden":!0}),p.goals.new]})]}),(0,J.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:he.length?he.map(e=>(0,J.jsxs)(ut,{to:yr(e.id),onClick:Sr(`goals`),className:`grid gap-1 border-b border-edge px-4 py-3 last:border-b-0 hover:bg-surface-hover`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,J.jsx)(`span`,{className:i(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,fn(e.status)),children:ii(e.status)})]}),(0,J.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:e.nextAction||e.description||p.goals.noNextAction})]},e.id)):(0,J.jsx)(`p`,{className:`p-4 text-sm text-fg-muted`,children:p.goals.empty})})]}):null,$===`activity`?(0,J.jsxs)(`section`,{id:`project-panel-activity`,role:`tabpanel`,"aria-labelledby":`project-tab-activity`,className:`grid min-h-full content-start gap-3`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.activity.title}),(0,J.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:un(p.activity.count,{count:et})})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.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,J.jsx)(`input`,{type:`checkbox`,checked:Tt,onChange:e=>Et(e.currentTarget.checked),className:`size-4 rounded border-edge text-accent focus:ring-accent/30`}),p.activity.includeRelated]}),(0,J.jsxs)(G,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3`,onClick:()=>void Dr(),disabled:rt,children:[(0,J.jsx)(W,{className:i(`size-4`,rt&&`animate-spin`),"aria-hidden":!0}),p.common.refresh]})]})]}),(0,J.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:rt&&Xe.length===0?(0,J.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:p.activity.loading}):Xe.length?(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:Xe.map(e=>{let t=p.activity.types[e.type]??e.type,n=p.activity.objectKinds[e.primaryObject.kind]??e.primaryObject.kind,r=Cn(e),i=e.relatedProjects.length>0&&!e.scopes.some(e=>e.scopeKind===`project`&&e.scopeId===F.id);return(0,J.jsxs)(`article`,{className:`grid gap-2 px-4 py-3`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),i?(0,J.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:p.activity.related}):null]}),(0,J.jsxs)(`p`,{className:`mt-1 min-w-0 truncate text-sm text-fg-muted`,children:[n,`: `,xn(e)]})]}),(0,J.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,dateTime:new Date(e.createdAt).toISOString(),children:dn(e.createdAt)})]}),r?(0,J.jsx)(`p`,{className:`line-clamp-2 text-sm leading-5 text-fg-muted`,children:r}):null,(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[(0,J.jsxs)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:[p.activity.actor,`: `,bn(e)]}),(0,J.jsxs)(`span`,{className:`max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[p.activity.source,`: `,Sn(e)]})]})]},e.id)})}):(0,J.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:p.activity.empty})})]}):null,$===`settings`?(0,J.jsxs)(`form`,{id:`project-panel-settings`,role:`tabpanel`,"aria-labelledby":`project-tab-settings`,onSubmit:Gr,className:`grid min-h-full content-start gap-4`,children:[(0,J.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.contextTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.settings.contextHint})]}),(0,J.jsx)(`span`,{className:i(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,fn(Q.status)),children:p.settings.statuses[Q.status]})]}),(0,J.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-5`,children:[(0,J.jsx)(gn,{label:p.settings.workspaceRoot,value:hi,mono:!0}),(0,J.jsx)(gn,{label:p.settings.defaultAgent,value:li}),(0,J.jsx)(gn,{label:p.settings.pinState,value:pi?p.settings.pinned:p.settings.notPinned}),(0,J.jsx)(gn,{label:p.settings.createdAt,value:dn(F.createdAt)||p.common.never}),(0,J.jsx)(gn,{label:p.settings.updatedAt,value:dn(F.updatedAt)||p.common.never})]})]}),(0,J.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsx)(`div`,{children:(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.detailsTitle})}),(0,J.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,J.jsx)(mn,{label:p.settings.name,children:(0,J.jsx)(`input`,{className:hn(),value:Q.name,onChange:e=>hr(t=>({...t,name:e.target.value}))})}),(0,J.jsx)(mn,{label:p.settings.defaultAgent,children:(0,J.jsxs)(l,{className:hn(),value:Q.defaultAgentId,onChange:e=>hr(t=>({...t,defaultAgentId:e.target.value})),children:[(0,J.jsx)(tt,{value:``,children:p.settings.globalDefaultAgent}),en.map(e=>(0,J.jsx)(tt,{value:e.id,children:qe(e,s.agentsSettings)},e.id))]})}),(0,J.jsx)(mn,{label:p.settings.status,children:fi?(0,J.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,J.jsxs)(l,{className:hn(),value:Q.status===`archived`?`active`:Q.status,onChange:e=>hr(t=>({...t,status:e.target.value})),children:[(0,J.jsx)(tt,{value:`active`,children:p.settings.statuses.active}),(0,J.jsx)(tt,{value:`paused`,children:p.settings.statuses.paused})]})}),(0,J.jsx)(mn,{label:p.settings.description,hint:p.settings.descriptionHint,children:(0,J.jsx)(`textarea`,{className:hn(!0),value:Q.description,onChange:e=>hr(t=>({...t,description:e.target.value}))})})]})]}),(0,J.jsx)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:(0,J.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:p.settings.workspaceRoot}),(0,J.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base px-3 py-3`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3 md:flex-row md:items-start md:justify-between`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:(0,J.jsx)(`span`,{className:`rounded-md bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:mi?p.settings.workspaceModeFollow:p.settings.workspaceModeFixed})}),(0,J.jsx)(`div`,{className:`mt-2 break-all font-mono text-xs leading-5 text-fg`,title:hi,children:hi})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:()=>void yi(),children:[(0,J.jsx)(C,{className:`size-4`,"aria-hidden":!0}),p.settings.copyWorkspacePath]}),(0,J.jsx)(gt,{workspacePath:hi}),(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:Kr,children:[(0,J.jsx)(ft,{className:`size-4`,"aria-hidden":!0}),p.settings.migrateWorkspace]})]})]}),(0,J.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:p.settings.workspaceMigrationHint})]})]})}),(0,J.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.agentContextTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.settings.agentContextHint})]}),(0,J.jsx)(mn,{label:p.settings.brief,hint:p.settings.briefHint,children:(0,J.jsx)(`textarea`,{className:hn(!0),value:Q.brief,onChange:e=>hr(t=>({...t,brief:e.target.value}))})}),(0,J.jsx)(mn,{label:p.settings.instructions,hint:p.settings.instructionsHint,children:(0,J.jsx)(`textarea`,{className:hn(!0),value:Q.instructions,onChange:e=>hr(t=>({...t,instructions:e.target.value}))})})]}),(0,J.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.managementTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.settings.managementHint})]}),(0,J.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[(0,J.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base px-3 py-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:pi?p.settings.pinnedTitle:p.settings.pinTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:p.settings.pinHint})]}),(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`w-fit rounded-lg`,disabled:Bn===`pin`,onClick:()=>void Jr(),children:[pi?(0,J.jsx)(lt,{className:`size-4`,"aria-hidden":!0}):(0,J.jsx)(M,{className:`size-4`,"aria-hidden":!0}),pi?p.settings.unpinProject:p.settings.pinProject]})]}),(0,J.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base px-3 py-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:fi?p.settings.restoreTitle:p.settings.archiveTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:fi?p.settings.restoreHint:p.settings.archiveHint})]}),(0,J.jsxs)(G,{type:`button`,variant:fi?`primary`:`ghost`,className:`w-fit rounded-lg`,disabled:Bn===`archive`,onClick:()=>void Yr(),children:[fi?(0,J.jsx)(W,{className:`size-4`,"aria-hidden":!0}):(0,J.jsx)(ot,{className:`size-4`,"aria-hidden":!0}),fi?p.settings.restoreProject:p.settings.archiveProject]})]})]})]}),(0,J.jsxs)(`section`,{className:`grid gap-3 rounded-lg border border-red-500/20 bg-red-500/5 p-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-red-700 dark:text-red-300`,children:p.settings.dangerTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-red-700/80 dark:text-red-200/80`,children:p.settings.dangerHint})]}),(0,J.jsxs)(G,{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:()=>jn(!0),children:[(0,J.jsx)(ht,{className:`size-4`,"aria-hidden":!0}),p.settings.deleteConfirmAction]})]}),(0,J.jsx)(`div`,{className:`flex flex-wrap justify-end gap-2 border-t border-edge pt-4`,children:(0,J.jsxs)(G,{type:`submit`,variant:`primary`,disabled:On||!Q.name.trim(),children:[(0,J.jsx)(_e,{className:`size-4`,"aria-hidden":!0}),p.common.save]})})]}):null]}),(0,J.jsx)(N,{open:An,onOpenChange:e=>{Hn||jn(e)},children:(0,J.jsxs)(y,{children:[(0,J.jsx)(I,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(pt,{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,J.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,J.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,J.jsx)(E,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(R,{className:`text-base font-semibold text-fg`,children:p.settings.deleteConfirmTitle}),(0,J.jsx)(d,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:F?un(p.settings.deleteConfirm,{name:F.name}):p.settings.deleteConfirmFallback})]})]}),(0,J.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,J.jsx)(O,{asChild:!0,children:(0,J.jsx)(G,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:Hn,children:p.common.cancel})}),(0,J.jsxs)(G,{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:Hn||!F,onClick:()=>void Xr(),children:[(0,J.jsx)(ht,{className:`size-4`,"aria-hidden":!0}),p.settings.deleteConfirmAction]})]})]})]})}),(0,J.jsx)(N,{open:Pn,onOpenChange:e=>{On||Fn(e)},children:(0,J.jsxs)(y,{children:[(0,J.jsx)(I,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(pt,{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,J.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,J.jsx)(R,{className:`text-base font-semibold text-fg`,children:p.settings.workspaceMigrationTitle}),(0,J.jsx)(d,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.settings.workspaceMigrationDescription})]}),(0,J.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,J.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:p.settings.workspaceMode}),(0,J.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-2`,children:[(0,J.jsxs)(`label`,{className:i(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,In===`fixed`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,J.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:In===`fixed`,onChange:()=>Ln(`fixed`),disabled:On}),(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`span`,{className:`block font-medium`,children:p.settings.workspaceModeFixed}),(0,J.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:p.settings.workspaceMigrationFixedHint})]})]}),(0,J.jsxs)(`label`,{className:i(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,In===`follow`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,J.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:In===`follow`,onChange:()=>Ln(`follow`),disabled:On}),(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`span`,{className:`block font-medium`,children:p.settings.workspaceModeFollow}),(0,J.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:p.settings.workspaceHint})]})]})]})]}),In===`fixed`?(0,J.jsx)(bt,{value:Rn,onChange:zn,disabled:On,wd:u,placeholder:p.settings.workspacePlaceholder,inputClassName:hn(),autoFocus:!0}):null,(0,J.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,J.jsx)(`div`,{className:`rounded-lg bg-surface-muted px-3 py-2 text-xs leading-5 text-fg-subtle`,children:un(p.settings.workspaceCurrent,{workspace:gi})})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(O,{asChild:!0,children:(0,J.jsx)(G,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:On,children:p.common.cancel})}),(0,J.jsxs)(G,{type:`button`,variant:`primary`,className:`rounded-lg`,disabled:On||!_i,onClick:()=>void qr(),children:[(0,J.jsx)(ft,{className:`size-4`,"aria-hidden":!0}),p.settings.workspaceMigrationConfirm]})]})]})]})}),(0,J.jsx)(N,{open:!!Mn,onOpenChange:e=>{e||Nn(null)},children:(0,J.jsxs)(y,{children:[(0,J.jsx)(I,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(pt,{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,J.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,J.jsx)(R,{className:`text-base font-semibold text-fg`,children:p.settings.workspaceMissingTitle}),(0,J.jsx)(d,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:Mn?un(p.settings.workspaceMissingDescription,{workspace:Mn}):null})]}),Mn?(0,J.jsx)(`div`,{className:`px-5 py-4`,children:(0,J.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,J.jsx)(it,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:Mn})]})}):null,(0,J.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(G,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:bi,disabled:On,children:p.settings.workspaceMissingBack}),(0,J.jsxs)(G,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:()=>void qr({createWorkspaceRoot:!0}),disabled:On,children:[(0,J.jsx)(ft,{className:`size-4`,"aria-hidden":!0}),p.settings.workspaceMissingCreate]})]})]})]})}),(0,J.jsx)(Ct,{open:or,t:s.goalsPage,chat:s.chat,busy:nr,options:lr,onClose:()=>!nr&&sr(!1),onCreate:Ir}),(0,J.jsx)(wt,{open:!!er,definition:er,language:o,starting:Xn,onClose:()=>!Xn&&tr(null),onStart:e=>void Rr(e)})]})}export{Dn 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"./cn-BQ_8x0bT.js";import{t as a}from"./messages-DR9ODkb8.js";import{n as o}from"./locale-store-Ba72bFmP.js";import{$a as s,$i as c,Ba as l,Ga as u,Ha as d,Qi as f,Ra as p,Ua as m,Va as h,Vi as g,Wa as _,bs as v,cs as y,er as b,ml as x,qn as ee,to as S,wl as te,wo as C,xc as ne,xl as w,yc as re,za as T}from"./index-BOme955B.js";import{t as ie}from"./directory-picker-path-field-MT71cjgl.js";var E=n(),D=e(t(),1),O=r(),ae=[`all`,`active`,`paused`,`archived`],k=`__auto__`,A=`__global__`;function j(e){return e===`active`?`bg-accent-soft text-accent-fg`:e===`paused`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:`bg-surface-muted text-fg-subtle`}function M(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function oe(e){return e.trim().replace(/[\\/]+$/,``).split(/[\\/]/).filter(Boolean).pop()??``}function se(e){let t=e?.body;return t?.code===`workspace_already_bound`&&t.project?t.project:null}function ce(e){let t=e?.body;return t?.code===`workspace_root_missing`&&t.workspaceRoot?t.workspaceRoot:null}function N(e,t){if(!e)return t;let n=new Date(e);return Number.isNaN(n.getTime())?e:new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(n)}function le(e){let t=(0,E.c)(37),{project:n,t:r}=e,a=r.statuses[n.status],o=`/projects/${encodeURIComponent(n.id)}`,s;t[0]===n.name?s=t[1]:(s=(0,O.jsx)(`h2`,{className:`truncate text-base font-semibold text-fg`,children:n.name}),t[0]=n.name,t[1]=s);let c;t[2]===n.slug?c=t[3]:(c=(0,O.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.slug}),t[2]=n.slug,t[3]=c);let l;t[4]!==s||t[5]!==c?(l=(0,O.jsxs)(`div`,{className:`min-w-0`,children:[s,c]}),t[4]=s,t[5]=c,t[6]=l):l=t[6];let u;t[7]===n.status?u=t[8]:(u=i(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,j(n.status)),t[7]=n.status,t[8]=u);let d;t[9]!==a||t[10]!==u?(d=(0,O.jsx)(`span`,{className:u,children:a}),t[9]=a,t[10]=u,t[11]=d):d=t[11];let f;t[12]!==l||t[13]!==d?(f=(0,O.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[l,d]}),t[12]=l,t[13]=d,t[14]=f):f=t[14];let p=n.description||n.brief||r.noDescription,m;t[15]===p?m=t[16]:(m=(0,O.jsx)(`p`,{className:`mt-3 line-clamp-2 min-h-10 text-sm leading-5 text-fg-muted`,children:p}),t[15]=p,t[16]=m);let h=n.workspaceRoot||n.effectiveWorkspaceRoot||r.agentDefault,g;t[17]!==r.workspaceLabel||t[18]!==h?(g=M(r.workspaceLabel,{workspace:h}),t[17]=r.workspaceLabel,t[18]=h,t[19]=g):g=t[19];let _;t[20]===g?_=t[21]:(_=(0,O.jsx)(`div`,{className:`truncate`,children:g}),t[20]=g,t[21]=_);let v;t[22]!==n.lastActiveAt||t[23]!==n.updatedAt||t[24]!==r.lastActive||t[25]!==r.never?(v=M(r.lastActive,{time:N(n.lastActiveAt??n.updatedAt,r.never)}),t[22]=n.lastActiveAt,t[23]=n.updatedAt,t[24]=r.lastActive,t[25]=r.never,t[26]=v):v=t[26];let y;t[27]===v?y=t[28]:(y=(0,O.jsx)(`div`,{children:v}),t[27]=v,t[28]=y);let b;t[29]!==_||t[30]!==y?(b=(0,O.jsxs)(`div`,{className:`mt-auto grid gap-1 pt-4 text-xs text-fg-subtle`,children:[_,y]}),t[29]=_,t[30]=y,t[31]=b):b=t[31];let x;return t[32]!==o||t[33]!==b||t[34]!==f||t[35]!==m?(x=(0,O.jsxs)(w,{to:o,className:`group flex min-h-36 flex-col rounded-lg bg-surface-panel p-4 shadow-surface transition-colors hover:bg-surface-hover/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[f,m,b]}),t[32]=o,t[33]=b,t[34]=f,t[35]=m,t[36]=x):x=t[36],x}function P(){let e=te(),t=a(o(e=>e.language)),n=t.chat.workingDirectory,r=t.projectsPage,w=u(e=>e.setPageHeader),E=u(e=>e.clearPageHeader),[j,N]=(0,D.useState)([]),[P,ue]=(0,D.useState)(`all`),[F,de]=(0,D.useState)(``),[fe,pe]=(0,D.useState)(!0),[me,I]=(0,D.useState)(null),[L,he]=(0,D.useState)(``),[ge,_e]=(0,D.useState)(!1),[R,ve]=(0,D.useState)(``),[z,B]=(0,D.useState)(`fixed`),[V,ye]=(0,D.useState)(`auto`),[H,be]=(0,D.useState)(k),[U,xe]=(0,D.useState)([]),[W,Se]=(0,D.useState)(),[G,Ce]=(0,D.useState)(),[we,Te]=(0,D.useState)(`unknown`),[K,q]=(0,D.useState)(!1),[J,Ee]=(0,D.useState)(!1),[Y,X]=(0,D.useState)(null),[Z,Q]=(0,D.useState)(null),De=(0,D.useCallback)(e=>{he(e),_e(!!e.trim())},[]),Oe=(0,D.useCallback)(e=>{ve(e),ge||he(oe(e))},[ge]);(0,D.useEffect)(()=>{let e=!1;return pe(!0),I(null),f({...P===`all`?{}:{status:P},...F.trim()?{search:F}:{},limit:100}).then(t=>{e||N(t.items)}).catch(t=>{e||I(t instanceof Error?t.message:String(t))}).finally(()=>{e||pe(!1)}),()=>{e=!0}},[F,P]),(0,D.useEffect)(()=>{if(!K)return;let e=!1;return b().then(t=>{e||(xe(t.agents),Se(t.defaultId))}).catch(()=>{e||(xe([]),Se(void 0))}),()=>{e=!0}},[K]),(0,D.useEffect)(()=>{if(!K)return;let e=!1,t=window.setTimeout(()=>{c({...L.trim()?{name:L.trim()}:{},...z===`fixed`&&R.trim()?{workspaceRoot:R.trim()}:{},projectKind:V}).then(t=>{e||(Ce(t.defaultAgentId),Te(t.inference.kind))}).catch(()=>{e||(Ce(void 0),Te(`unknown`))})},250);return()=>{e=!0,window.clearTimeout(t)}},[K,L,V,z,R]);let ke=(0,D.useMemo)(()=>({active:j.filter(e=>e.status===`active`),paused:j.filter(e=>e.status===`paused`),archived:j.filter(e=>e.status===`archived`)}),[j]),$=(0,D.useCallback)(async(e={})=>{let t=L.trim(),n=z===`fixed`?R.trim():``;if(!(!t&&!n)){Ee(!0),I(null),Q(null);try{let r=await g({...t?{name:t}:{},...n?{workspaceRoot:n}:{},projectKind:V,...H===k?{}:{defaultAgentId:H===A?``:H},...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});N(e=>[r,...e]),he(``),_e(!1),ve(``),B(`fixed`),ye(`auto`),be(k),q(!1)}catch(e){let t=se(e);if(t)N(e=>[t,...e.filter(e=>e.id!==t.id)]),X(t),q(!1);else{let t=ce(e);t?(Q(t),q(!1)):I(e instanceof Error?e.message:String(e))}}finally{Ee(!1)}}},[H,L,V,z,R]),Ae=(0,D.useCallback)(e=>{e.preventDefault(),$()},[$]),je=(0,D.useCallback)(()=>{if(!Y)return;let t=Y.id;X(null),e(`/projects/${encodeURIComponent(t)}`)},[e,Y]),Me=(0,D.useCallback)(()=>{X(null),q(!0)},[]),Ne=(0,D.useCallback)(()=>{$({createWorkspaceRoot:!0})},[$]),Pe=(0,D.useCallback)(()=>{Q(null),q(!0)},[]),Fe=(0,D.useMemo)(()=>U.find(e=>e.id===G)?.name||G||``,[U,G]),Ie=(0,D.useMemo)(()=>H===A?W:H===k?G||W:H,[H,W,G]),Le=(0,D.useMemo)(()=>U.find(e=>e.id===Ie),[U,Ie]),Re=z===`fixed`?R.trim()||r.workspacePlaceholder:Le?.workspace||r.workspacePlaceholder,ze=(0,D.useMemo)(()=>{if(H===A)return r.agentHintGlobal;if(H!==k){let e=U.find(e=>e.id===H);return M(r.agentHintSelected,{agent:e?.name||H})}return G?M(r.agentHintCoding,{agent:Fe}):we===`coding`?r.agentHintCoderUnavailable:V===`general`||we===`general`?r.agentHintGeneral:r.agentHintAuto},[H,U,Fe,G,we,V,r]),Be=(0,D.useMemo)(()=>(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`label`,{className:`relative block min-w-0`,children:[(0,O.jsx)(y,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,O.jsx)(`input`,{className:`h-9 w-40 rounded-lg border border-edge bg-surface-muted pl-9 pr-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent sm:w-56 lg:w-72`,value:F,onChange:e=>de(e.target.value),placeholder:r.searchPlaceholder,"aria-label":r.searchPlaceholder})]}),(0,O.jsxs)(C,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>q(e=>!e),children:[(0,O.jsx)(v,{className:`size-4`,"aria-hidden":!0}),r.create]})]}),[F,r.create,r.searchPlaceholder]);(0,D.useLayoutEffect)(()=>(w({startExtra:null,main:(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:r.title}),(0,O.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:M(r.summary,{count:j.length})})]}),end:Be}),()=>E()),[E,Be,j.length,w,r.summary,r.title]);let Ve=P===`all`?[[r.statuses.active,ke.active],[r.statuses.paused,ke.paused],[r.statuses.archived,ke.archived]]:[[r.statuses[P],j]];return(0,O.jsxs)(`main`,{className:`flex w-full flex-1 flex-col gap-6 px-3 py-6 sm:px-5 xl:px-6`,children:[(0,O.jsx)(m,{open:K,onOpenChange:q,children:(0,O.jsxs)(d,{children:[(0,O.jsx)(h,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,O.jsxs)(T,{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,O.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,O.jsx)(_,{className:`text-base font-semibold text-fg`,children:r.createTitle}),(0,O.jsx)(l,{className:`mt-1 text-sm text-fg-muted`,children:r.createDescription})]}),(0,O.jsxs)(`form`,{onSubmit:Ae,className:`flex min-h-0 flex-1 flex-col`,children:[(0,O.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,O.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,O.jsx)(`span`,{className:`font-medium text-fg-muted`,children:r.workspaceRoot}),(0,O.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,O.jsxs)(`label`,{className:i(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2 text-sm`,z===`fixed`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,O.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:z===`fixed`,onChange:()=>B(`fixed`),disabled:J}),(0,O.jsxs)(`span`,{className:`min-w-0`,children:[(0,O.jsx)(`span`,{className:`block font-medium`,children:r.workspaceModeFixed}),(0,O.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:r.workspaceFixedHint})]})]}),(0,O.jsxs)(`label`,{className:i(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2 text-sm`,z===`follow`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,O.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:z===`follow`,onChange:()=>B(`follow`),disabled:J}),(0,O.jsxs)(`span`,{className:`min-w-0`,children:[(0,O.jsx)(`span`,{className:`block font-medium`,children:r.workspaceModeFollow}),(0,O.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:r.workspaceFollowHint})]})]})]}),z===`fixed`?(0,O.jsx)(ie,{value:R,onChange:Oe,disabled:J,wd:n,placeholder:r.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`,autoFocus:!0}):null,(0,O.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:M(r.workspaceCurrent,{workspace:Re})})]}),(0,O.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,O.jsx)(`span`,{className:`font-medium text-fg-muted`,children:r.projectName}),(0,O.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:L,onChange:e=>De(e.target.value),placeholder:R.trim()&&oe(R)||`xopc`})]}),(0,O.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,O.jsx)(`span`,{className:`font-medium text-fg-muted`,children:r.projectType}),(0,O.jsxs)(s,{className:`min-h-10 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:V,onChange:e=>ye(e.target.value),disabled:J,children:[(0,O.jsx)(S,{value:`auto`,children:r.projectTypes.auto}),(0,O.jsx)(S,{value:`coding`,children:r.projectTypes.coding}),(0,O.jsx)(S,{value:`general`,children:r.projectTypes.general})]})]}),(0,O.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,O.jsx)(`span`,{className:`font-medium text-fg-muted`,children:r.defaultAgent}),(0,O.jsxs)(s,{className:`min-h-10 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:H,onChange:e=>be(e.target.value),disabled:J,children:[(0,O.jsx)(S,{value:k,children:r.agentAuto}),(0,O.jsx)(S,{value:A,children:r.agentGlobalDefault}),U.map(e=>(0,O.jsx)(S,{value:e.id,children:ee(e,t.agentsSettings)},e.id))]}),(0,O.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:ze})]})]}),(0,O.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,O.jsx)(p,{asChild:!0,children:(0,O.jsx)(C,{type:`button`,variant:`ghost`,className:`rounded-lg`,children:r.cancel})}),(0,O.jsxs)(C,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:J||!L.trim()&&(z!==`fixed`||!R.trim()),children:[(0,O.jsx)(v,{className:`size-4`,"aria-hidden":!0}),r.create]})]})]})]})]})}),(0,O.jsx)(m,{open:!!Y,onOpenChange:e=>{e||X(null)},children:(0,O.jsxs)(d,{children:[(0,O.jsx)(h,{className:`fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,O.jsxs)(T,{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,O.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,O.jsx)(_,{className:`text-base font-semibold text-fg`,children:r.workspaceConflictTitle}),(0,O.jsx)(l,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:Y?M(r.workspaceConflictDescription,{projectName:Y.name}):null})]}),Y?(0,O.jsx)(`div`,{className:`space-y-3 px-5 py-4`,children:(0,O.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-edge bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,O.jsx)(ne,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,O.jsx)(`span`,{className:`min-w-0 truncate`,children:M(r.workspaceConflictPath,{workspace:Y.workspaceRoot||r.agentDefault})})]})}):null,(0,O.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,O.jsx)(C,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:Me,children:r.workspaceConflictBack}),(0,O.jsxs)(C,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:je,children:[(0,O.jsx)(x,{className:`size-4`,"aria-hidden":!0}),r.workspaceConflictOpen]})]})]})]})}),(0,O.jsx)(m,{open:!!Z,onOpenChange:e=>{e||Q(null)},children:(0,O.jsxs)(d,{children:[(0,O.jsx)(h,{className:`fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,O.jsxs)(T,{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,O.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,O.jsx)(_,{className:`text-base font-semibold text-fg`,children:r.workspaceMissingTitle}),(0,O.jsx)(l,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:Z?M(r.workspaceMissingDescription,{workspace:Z}):null})]}),Z?(0,O.jsx)(`div`,{className:`px-5 py-4`,children:(0,O.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-edge bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,O.jsx)(ne,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,O.jsx)(`span`,{className:`min-w-0 truncate`,children:Z})]})}):null,(0,O.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,O.jsx)(C,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:Pe,disabled:J,children:r.workspaceMissingBack}),(0,O.jsxs)(C,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:Ne,disabled:J,children:[(0,O.jsx)(re,{className:`size-4`,"aria-hidden":!0}),r.workspaceMissingCreate]})]})]})]})}),(0,O.jsxs)(`section`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,O.jsx)(`div`,{className:`flex flex-wrap gap-1 rounded-lg bg-surface-panel p-1 shadow-surface`,children:ae.map(e=>(0,O.jsx)(`button`,{type:`button`,onClick:()=>ue(e),className:i(`rounded-md px-3 py-1.5 text-sm font-medium transition-colors`,P===e?`bg-accent text-white`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:e===`all`?r.all:r.statuses[e]},e))}),(0,O.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-fg-muted`,children:[(0,O.jsx)(ne,{className:`size-4`,"aria-hidden":!0}),r.optionalContext]})]}),me?(0,O.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:me}):null,fe?(0,O.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.loading}):null,!fe&&j.length===0?(0,O.jsxs)(`div`,{className:`rounded-lg bg-surface-panel p-8 text-center shadow-surface`,children:[(0,O.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.emptyTitle}),(0,O.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.emptyHint})]}):null,Ve.map(([e,t])=>t.length?(0,O.jsxs)(`section`,{className:`space-y-3`,children:[(0,O.jsx)(`h2`,{className:`text-sm font-semibold uppercase tracking-wide text-fg-subtle`,children:e}),(0,O.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:t.map(e=>(0,O.jsx)(le,{project:e,t:r},e.id))})]},e):null)]})}export{P 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{t as i}from"./cn-BQ_8x0bT.js";import{t as a}from"./messages-DR9ODkb8.js";import{a as o,c as s,n as c,o as l,s as u,t as d}from"./fetch-6HXXdO77.js";import{n as f}from"./locale-store-Ba72bFmP.js";import{a as p,i as m}from"./vendor-swr-BIWyz7Rc.js";import{$c as h,$o as g,Ba as _,C as v,Co as y,Cr as b,Dc as x,Dr as S,El as C,Er as w,Ha as T,Ho as E,La as D,Nc as O,Ns as k,Or as A,Ro as j,Sr as M,Tr as N,Tt as P,Ua as F,Uc as I,Us as L,Va as R,Wa as z,Xa as B,Yr as V,_r as H,br as U,ha as W,io as ee,kr as G,ln as te,ma as ne,mc as K,mo as q,ms as re,nc as ie,nl as ae,os as J,pa as Y,po as oe,ro as se,ts as ce,vr as le,wo as X,wr as ue,xl as de,xr as fe,yr as pe,ys as me,za as he}from"./index-BOme955B.js";import{n as ge,r as _e,t as ve}from"./settings-page-layout-Da_LNPDS.js";import{t as ye}from"./settings-collapsible-section-Cgd_aLBV.js";import{n as be,r as xe,t as Se}from"./settings-form-section-DnDrLMWZ.js";import{t as Ce}from"./browser-BLJWD7WI.js";import{t as we}from"./page-tabs-DYNWfN6S.js";var Z=n(),Q=e(t(),1);function Te(e,t){let{mutate:n}=p(),[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`),Y()])},[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 fe();if(!n.ok)throw Error(`Failed to enable LAN pairing`);if(n.requiresRestart){let t=await H();if(!t.ok)throw Error(t.message??`Gateway restart failed`);if(!await le(e))throw Error(`Gateway did not come back online in time`)}let r=n.requiresRestart?await pe():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)}}var $=r();function Ee(){return i(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,y,`dark:border-edge`)}function De(e){let t=(0,Z.c)(122),{pairQr:n,gatewayToken:r,streamlined:o,lanOnly:s,onRefreshQr:c}=e,l=o===void 0?!1:o,u=s===void 0?!1:s,d=f(Ae),p;t[0]===d?p=t[1]:(p=a(d),t[0]=d,t[1]=p);let m=p,h=m.tunnelSettings,_=u?m.remoteAccess.lan:null,y;t[2]!==m.clipboard.copyFailed||t[3]!==h.pairCopied||t[4]!==h.pairCopyLink?(y={copy:h.pairCopyLink,copied:h.pairCopied,copyFailed:m.clipboard.copyFailed},t[2]=m.clipboard.copyFailed,t[3]=h.pairCopied,t[4]=h.pairCopyLink,t[5]=y):y=t[5];let b=y,{tunnelActive:x,tunnelStatus:S,tunnelQr:C,pairContext:w,pairBaseUrl:T,setPairBaseUrl:E,applySuggestedPairUrl:D,applyCandidateUrl:O,resetPairBaseFromContext:k,baseOk:A,localhostWarn:j,pairingBlocked:M,deepLink:N,qrPayload:P,qrDataUrl:F,qrGenFailed:I,encoding:R}=n,z;t[6]===k?z=t[7]:(z=e=>{k(e.recommended.url)},t[6]=k,t[7]=z);let B=Te(r,z),H,U,W,ee,G;if(t[8]!==O||t[9]!==D||t[10]!==A||t[11]!==B||t[12]!==r||t[13]!==_||t[14]!==u||t[15]!==j||t[16]!==c||t[17]!==T||t[18]!==w?.candidates||t[19]!==w?.recommended||t[20]!==M||t[21]!==E||t[22]!==l||t[23]!==h.pairBaseUrlHint||t[24]!==h.pairBaseUrlLabel||t[25]!==h.pairBaseUrlPlaceholder||t[26]!==h.pairBlockedLoopbackBody||t[27]!==h.pairBlockedNextSteps||t[28]!==h.pairBlockedTitle||t[29]!==h.pairCandidatesTitle||t[30]!==h.pairEnableLanButton||t[31]!==h.pairEnableLanEnabling||t[32]!==h.pairEnableLanSecurityAuditLink||t[33]!==h.pairInvalidBaseUrl||t[34]!==h.pairLocalhostWarning||t[35]!==h.pairSelectCandidateHint||t[36]!==h.pairSelectCandidateTitle||t[37]!==h.pairSubtitle||t[38]!==h.pairSuggestedLanLabel||t[39]!==h.pairTitle||t[40]!==h.pairTunnelActive||t[41]!==h.pairTunnelLanUrl||t[42]!==h.pairTunnelPublicUrl||t[43]!==h.pairUseSuggestedUrl||t[44]!==h.pairWaitingForTunnel||t[45]!==h.refreshQr||t[46]!==x||t[47]!==C||t[48]!==S?.publicUrl){G=Symbol.for(`react.early_return_sentinel`);bb0:{let e=w?.candidates.filter(ke)??[],n=u?(e.find(Oe)?.url??e[0]?.url??``).trim():w?.recommended.url?.trim()??``,a=(u||!x)&&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:i(`text-xs font-medium`,r),children:a?h.pairSelectCandidateTitle:h.pairCandidatesTitle}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1`,children:e.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,className:i(`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`,T.trim()===e.url&&`border-accent bg-accent/5`,n),onClick:()=>O(e.url),children:[e.label?`${e.label}: `:``,e.url]})},e.url))}),a?(0,$.jsx)(`p`,{className:i(`mt-1 text-[11px] leading-relaxed`,r),children:h.pairSelectCandidateHint}):null]})};if(H=l&&!u,H&&!x){let e;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(g,{className:`size-4 text-accent`,strokeWidth:1.75}),t[54]=e):e=t[54];let n;t[55]===h.pairTitle?n=t[56]:(n=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[e,h.pairTitle]}),t[55]=h.pairTitle,t[56]=n);let r;t[57]===h.pairWaitingForTunnel?r=t[58]:(r=(0,$.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:h.pairWaitingForTunnel}),t[57]=h.pairWaitingForTunnel,t[58]=r);let i;t[59]!==n||t[60]!==r?(i=(0,$.jsxs)(Se,{children:[n,r]}),t[59]=n,t[60]=r,t[61]=i):i=t[61],G=i;break bb0}let s=_?.pairTitle??h.pairTitle,d=u?_?.pairSubtitle??h.pairSubtitle:x?h.pairTunnelActive:h.pairSubtitle,f=!!(c&&(u||l&&x)),p=H?`mb-2`:`mb-3`,m;t[62]===p?m=t[63]:(m=i(`flex flex-wrap items-start justify-between gap-2`,p),t[62]=p,t[63]=m);let v;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(g,{className:`size-4 text-accent`,strokeWidth:1.75}),t[64]=v):v=t[64];let y;t[65]===s?y=t[66]:(y=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[v,s]}),t[65]=s,t[66]=y);let b;t[67]!==H||t[68]!==d||t[69]!==h.pairSubtitle?(b=H?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:h.pairSubtitle}):(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:d}),t[67]=H,t[68]=d,t[69]=h.pairSubtitle,t[70]=b):b=t[70];let k;t[71]!==y||t[72]!==b?(k=(0,$.jsxs)(`div`,{children:[y,b]}),t[71]=y,t[72]=b,t[73]=k):k=t[73];let N;t[74]!==c||t[75]!==f||t[76]!==h.refreshQr?(N=f?(0,$.jsxs)(X,{type:`button`,variant:`ghost`,className:`shrink-0`,onClick:()=>void c(),children:[(0,$.jsx)(re,{className:`size-4`}),h.refreshQr]}):null,t[74]=c,t[75]=f,t[76]=h.refreshQr,t[77]=N):N=t[77],t[78]!==m||t[79]!==k||t[80]!==N?(U=(0,$.jsxs)(`div`,{className:m,children:[k,N]}),t[78]=m,t[79]=k,t[80]=N,t[81]=U):U=t[81],W=M?(0,$.jsxs)(`div`,{className:`mb-3 space-y-3 rounded-lg border border-amber-200 bg-amber-50 px-3 py-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:h.pairBlockedTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-amber-900 dark:text-amber-200`,children:h.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:h.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)(X,{type:`button`,variant:`secondary`,className:`w-full sm:w-auto`,onClick:D,children:h.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)(X,{type:`button`,className:`w-full sm:w-auto`,disabled:B.busy||!r,onClick:()=>B.setConfirmOpen(!0),children:[B.busy?(0,$.jsx)(L,{className:`size-3.5 animate-spin`}):null,B.busy?h.pairEnableLanEnabling:h.pairEnableLanButton]})}),B.error?(0,$.jsx)(`p`,{className:`text-xs text-red-800 dark:text-red-200`,children:B.error}):null,(0,$.jsx)(`p`,{className:`text-xs leading-relaxed text-amber-900 dark:text-amber-200`,children:u?_?.pairBlockedNextSteps??h.pairBlockedNextSteps:h.pairBlockedNextSteps}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(de,{to:`/settings/gateway`,className:`inline-block text-xs font-medium text-accent hover:underline`,children:h.pairEnableLanSecurityAuditLink}),u&&_?.pairPublicTabLink?(0,$.jsx)(de,{to:`/settings/remote-access?tab=public`,className:`inline-block text-xs font-medium text-accent hover:underline`,children:_.pairPublicTabLink}):null]})]}):null,ee=x&&!u?H?null:(0,$.jsxs)(`div`,{className:`mb-3 space-y-2 rounded-lg bg-surface-panel/80 px-3 py-3 shadow-surface`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:h.pairTunnelPublicUrl}),(0,$.jsx)(`div`,{className:`mt-0.5 break-all font-mono text-xs text-fg`,children:S?.publicUrl})]}),C?.lanUrl?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:h.pairTunnelLanUrl}),(0,$.jsx)(`div`,{className:`mt-0.5 break-all font-mono text-xs text-fg`,children:C.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:h.pairBaseUrlLabel}),(0,$.jsx)(`input`,{id:`tunnel-mobile-pair-base`,className:i(Ee(),`font-mono text-xs`),type:`text`,autoComplete:`off`,spellCheck:!1,placeholder:n||h.pairBaseUrlPlaceholder,value:T,onChange:e=>E(e.target.value)}),(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:h.pairBaseUrlHint}),!A&&T.trim()?(0,$.jsx)(`p`,{className:`text-xs text-amber-800 dark:text-amber-200`,children:h.pairInvalidBaseUrl}):null,j?(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:h.pairLocalhostWarning}):null,a?o(`neutral`):null]})}t[8]=O,t[9]=D,t[10]=A,t[11]=B,t[12]=r,t[13]=_,t[14]=u,t[15]=j,t[16]=c,t[17]=T,t[18]=w?.candidates,t[19]=w?.recommended,t[20]=M,t[21]=E,t[22]=l,t[23]=h.pairBaseUrlHint,t[24]=h.pairBaseUrlLabel,t[25]=h.pairBaseUrlPlaceholder,t[26]=h.pairBlockedLoopbackBody,t[27]=h.pairBlockedNextSteps,t[28]=h.pairBlockedTitle,t[29]=h.pairCandidatesTitle,t[30]=h.pairEnableLanButton,t[31]=h.pairEnableLanEnabling,t[32]=h.pairEnableLanSecurityAuditLink,t[33]=h.pairInvalidBaseUrl,t[34]=h.pairLocalhostWarning,t[35]=h.pairSelectCandidateHint,t[36]=h.pairSelectCandidateTitle,t[37]=h.pairSubtitle,t[38]=h.pairSuggestedLanLabel,t[39]=h.pairTitle,t[40]=h.pairTunnelActive,t[41]=h.pairTunnelLanUrl,t[42]=h.pairTunnelPublicUrl,t[43]=h.pairUseSuggestedUrl,t[44]=h.pairWaitingForTunnel,t[45]=h.refreshQr,t[46]=x,t[47]=C,t[48]=S?.publicUrl,t[49]=H,t[50]=U,t[51]=W,t[52]=ee,t[53]=G}else H=t[49],U=t[50],W=t[51],ee=t[52],G=t[53];if(G!==Symbol.for(`react.early_return_sentinel`))return G;let te;t[82]===h.pairSecurityNote?te=t[83]:(te=(0,$.jsx)(`p`,{className:`mb-3 text-xs text-fg-subtle`,children:h.pairSecurityNote}),t[82]=h.pairSecurityNote,t[83]=te);let ne;t[84]!==b||t[85]!==N||t[86]!==R||t[87]!==M||t[88]!==F||t[89]!==I||t[90]!==h.pairEncoding||t[91]!==h.pairImageError||t[92]!==h.pairQrDisabled?(ne=N?(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-3 sm:items-start`,children:[F&&!I?(0,$.jsx)(`img`,{src:F,alt:``,className:`size-56 rounded-lg border border-edge-subtle bg-white object-contain p-3 dark:border-edge`}):null,R?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:h.pairEncoding}):null,I?(0,$.jsx)(`p`,{className:`text-center text-sm text-fg-muted sm:text-left`,children:h.pairImageError}):null,(0,$.jsx)(V,{text:N,labels:b})]}):M?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:h.pairQrDisabled}):null,t[84]=b,t[85]=N,t[86]=R,t[87]=M,t[88]=F,t[89]=I,t[90]=h.pairEncoding,t[91]=h.pairImageError,t[92]=h.pairQrDisabled,t[93]=ne):ne=t[93];let K;t[94]!==H||t[95]!==P||t[96]!==h.deeplinkTitle?(K=P&&!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:h.deeplinkTitle}),(0,$.jsx)(`p`,{className:`mt-2 break-all font-mono text-[10px] leading-relaxed text-fg-subtle`,children:P})]}):null,t[94]=H,t[95]=P,t[96]=h.deeplinkTitle,t[97]=K):K=t[97];let q;t[98]!==H||t[99]!==h.pairMobileProbeHint||t[100]!==h.pairSchemeHint?(q=H?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`mt-3 break-all font-mono text-[10px] leading-relaxed text-fg-subtle`,children:h.pairSchemeHint}),(0,$.jsx)(`p`,{className:`mt-1 text-[10px] leading-relaxed text-fg-subtle`,children:h.pairMobileProbeHint})]}),t[98]=H,t[99]=h.pairMobileProbeHint,t[100]=h.pairSchemeHint,t[101]=q):q=t[101];let ie,ae;t[102]===B?(ie=t[103],ae=t[104]):(ie=()=>void B.runEnableLanPairing(),ae=()=>{B.busy||B.setConfirmOpen(!1)},t[102]=B,t[103]=ie,t[104]=ae);let J;t[105]!==B.confirmOpen||t[106]!==h.consentCancel||t[107]!==h.pairEnableLanButton||t[108]!==h.pairEnableLanConfirmBody||t[109]!==h.pairEnableLanConfirmTitle||t[110]!==ie||t[111]!==ae?(J=(0,$.jsx)(v,{open:B.confirmOpen,title:h.pairEnableLanConfirmTitle,description:h.pairEnableLanConfirmBody,confirmLabel:h.pairEnableLanButton,cancelLabel:h.consentCancel,onConfirm:ie,onCancel:ae}),t[105]=B.confirmOpen,t[106]=h.consentCancel,t[107]=h.pairEnableLanButton,t[108]=h.pairEnableLanConfirmBody,t[109]=h.pairEnableLanConfirmTitle,t[110]=ie,t[111]=ae,t[112]=J):J=t[112];let Y;return t[113]!==te||t[114]!==ne||t[115]!==K||t[116]!==q||t[117]!==J||t[118]!==U||t[119]!==W||t[120]!==ee?(Y=(0,$.jsx)(Se,{children:(0,$.jsxs)($.Fragment,{children:[U,W,ee,te,ne,K,q,J]})}),t[113]=te,t[114]=ne,t[115]=K,t[116]=q,t[117]=J,t[118]=U,t[119]=W,t[120]=ee,t[121]=Y):Y=t[121],Y}function Oe(e){return e.reachable}function ke(e){return e.kind===`lan`}function Ae(e){return e.language}function je(e){let t=(0,Z.c)(40),{open:n,title:r,intro:a,bullets:o,checkboxLabel:s,confirmLabel:c,cancelLabel:l,onConfirm:u,onCancel:d}=e,[f,p]=(0,Q.useState)(!1),m;t[0]===d?m=t[1]:(m=e=>{e||(p(!1),d())},t[0]=d,t[1]=m);let h;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(R,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,ee)}),t[2]=h):h=t[2];let g;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(g=i(`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`,se),t[3]=g):g=t[3];let v;t[4]===r?v=t[5]:(v=(0,$.jsx)(z,{className:`text-base font-semibold text-fg`,children:r}),t[4]=r,t[5]=v);let y;t[6]===a?y=t[7]:(y=(0,$.jsx)(_,{className:`mt-2 text-sm text-fg-muted`,children:a}),t[6]=a,t[7]=y);let b;t[8]===o?b=t[9]:(b=o.map(Me),t[8]=o,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=>p(e.target.checked),t[12]=S):S=t[12];let C;t[13]===f?C=t[14]:(C=(0,$.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 size-4 shrink-0 rounded border-edge accent-accent`,checked:f,onChange:S}),t[13]=f,t[14]=C);let w;t[15]===s?w=t[16]:(w=(0,$.jsx)(`span`,{children:s}),t[15]=s,t[16]=w);let E;t[17]!==w||t[18]!==C?(E=(0,$.jsxs)(`label`,{className:`mt-5 flex cursor-pointer items-start gap-3 text-sm text-fg`,children:[C,w]}),t[17]=w,t[18]=C,t[19]=E):E=t[19];let D;t[20]!==l||t[21]!==d?(D=(0,$.jsx)(X,{type:`button`,variant:`secondary`,onClick:d,children:l}),t[20]=l,t[21]=d,t[22]=D):D=t[22];let O=!f,k;t[23]!==c||t[24]!==u||t[25]!==O?(k=(0,$.jsx)(X,{type:`button`,disabled:O,onClick:u,children:c}),t[23]=c,t[24]=u,t[25]=O,t[26]=k):k=t[26];let A;t[27]!==D||t[28]!==k?(A=(0,$.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[D,k]}),t[27]=D,t[28]=k,t[29]=A):A=t[29];let j;t[30]!==E||t[31]!==A||t[32]!==v||t[33]!==y||t[34]!==x?(j=(0,$.jsxs)(T,{children:[h,(0,$.jsxs)(he,{className:g,onOpenAutoFocus:Ne,children:[v,y,x,E,A]})]}),t[30]=E,t[31]=A,t[32]=v,t[33]=y,t[34]=x,t[35]=j):j=t[35];let M;return t[36]!==n||t[37]!==m||t[38]!==j?(M=(0,$.jsx)(F,{open:n,onOpenChange:m,children:j}),t[36]=n,t[37]=m,t[38]=j,t[39]=M):M=t[39],M}function Me(e){return(0,$.jsx)(`li`,{children:e},e)}function Ne(e){return e.preventDefault()}function Pe(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var Fe=[`preparing_frpc`,`registering`,`starting_frpc`];function Ie(e){return e?e===`reconnecting_frpc`?Fe.indexOf(`starting_frpc`):Fe.indexOf(e):-1}function Le(e,t){if(t.state===`connected`)return`done`;let n=t.startProgress?.phase,r=Fe.indexOf(e),i=Ie(n);return i<0?t.state===`connecting`||t.state===`reconnecting`?`active`:`pending`:r<i?`done`:r===i?`active`:`pending`}function Re(e,t,n){let r=n.startProgress;return Le(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 ze(e,t){switch(t){case`preparing_frpc`:return e.stepPrepareFrpc;case`registering`:return e.stepRegister;case`starting_frpc`:return e.stepFrpcLogin}}function Be(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 Ve(e){let t=(0,Z.c)(31),{status:n,t:r}=e,[,a]=(0,Q.useState)(0),o;t[0]!==a||t[1]!==n.state?(o=()=>{if(n.state!==`connecting`&&n.state!==`reconnecting`)return;let e=window.setInterval(()=>a(He),1e3);return()=>window.clearInterval(e)},t[0]=a,t[1]=n.state,t[2]=o):o=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)(o,c),!(n.state===`connecting`||n.state===`reconnecting`||n.state===`connected`&&n.startProgress))return null;let l,u,d,f,p;if(t[6]!==n||t[7]!==r){let e=Be(n.startProgress?.startedAt);l=!!n.publicUrl&&n.state!==`connected`&&n.startProgress?.phase!==`registering`,u=`mt-3 space-y-3 rounded-lg bg-surface-panel/80 px-3 py-3 shadow-surface`;let a;t[13]===r.startProgressTitle?a=t[14]:(a=(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:r.startProgressTitle}),t[13]=r.startProgressTitle,t[14]=a);let o;t[15]===r.startProgressHint?o=t[16]:(o=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:r.startProgressHint}),t[15]=r.startProgressHint,t[16]=o),t[17]!==a||t[18]!==o?(d=(0,$.jsxs)(`div`,{children:[a,o]}),t[17]=a,t[18]=o,t[19]=d):d=t[19];let s=Fe.map(e=>{let t=Le(e,n),a=Re(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)(ae,{className:`size-3.5 text-emerald-600 dark:text-emerald-400`}):t===`active`?(0,$.jsx)(L,{className:`size-3.5 animate-spin text-accent`}):(0,$.jsx)(I,{className:`size-3.5`})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:i(`font-medium`,t===`active`?`text-fg`:t===`done`?`text-fg-muted`:`text-fg-subtle`),children:ze(r,e)}),a?(0,$.jsx)(`div`,{className:`mt-0.5 text-fg-muted`,children:a}):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:i(`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:[Pe(n.frpcDownload.bytesReceived),` /`,` `,Pe(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?f=t[21]:(f=(0,$.jsx)(`ol`,{className:`space-y-2`,children:s}),t[20]=s,t[21]=f),p=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]=u,t[10]=d,t[11]=f,t[12]=p}else l=t[8],u=t[9],d=t[10],f=t[11],p=t[12];let m;t[22]!==l||t[23]!==r.publicUrlPendingNotice?(m=l?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.publicUrlPendingNotice}):null,t[22]=l,t[23]=r.publicUrlPendingNotice,t[24]=m):m=t[24];let h;return t[25]!==u||t[26]!==d||t[27]!==f||t[28]!==p||t[29]!==m?(h=(0,$.jsxs)(`div`,{className:u,children:[d,f,p,m]}),t[25]=u,t[26]=d,t[27]=f,t[28]=p,t[29]=m,t[30]=h):h=t[30],h}function He(e){return e+1}function Ue(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 We(e){return e.state===`connected`?`connected`:e.state===`error`?`error`:e.state===`connecting`||e.state===`reconnecting`||e.startProgress||e.frpcDownload?`progress`:`off`}function Ge(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 Ke(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 qe(e){let t=(0,Z.c)(61),{t:n,status:r,isLoading:a,statusErr:o,starting:s,stopping:c,showConsentExpired:l,copyLabels:u,startDisabled:d,startDisabledReason:f,stepLabel:p,onStart:m,onStop:h}=e,g=d===void 0?!1:d,_,v,y,b,x,S,C;t[0]!==r||t[1]!==s?(C=We(r),_=r.enabled||s,v=s||r.state===`connecting`||r.state===`reconnecting`||!!r.startProgress||!!r.frpcDownload,t[9]===Symbol.for(`react.memo_cache_sentinel`)?(S=i(xe(),`space-y-4`),t[9]=S):S=t[9],x=`flex flex-wrap items-start justify-between gap-3`,b=`flex items-center gap-2`,y=i(`inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-medium`,Ge(C)),t[0]=r,t[1]=s,t[2]=_,t[3]=v,t[4]=y,t[5]=b,t[6]=x,t[7]=S,t[8]=C):(_=t[2],v=t[3],y=t[4],b=t[5],x=t[6],S=t[7],C=t[8]);let w=C===`connected`&&`bg-emerald-500`,T=C===`progress`&&`bg-amber-500 animate-pulse`,E=C===`error`&&`bg-red-500`,D=C===`off`&&`bg-fg-subtle`,O;t[10]!==w||t[11]!==T||t[12]!==E||t[13]!==D?(O=i(`size-1.5 rounded-full`,w,T,E,D),t[10]=w,t[11]=T,t[12]=E,t[13]=D,t[14]=O):O=t[14];let k;t[15]===O?k=t[16]:(k=(0,$.jsx)(`span`,{className:O,"aria-hidden":!0}),t[15]=O,t[16]=k);let A;t[17]!==a||t[18]!==r||t[19]!==n?(A=a&&!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`}):Ue(n,r),t[17]=a,t[18]=r,t[19]=n,t[20]=A):A=t[20];let M;t[21]!==k||t[22]!==A||t[23]!==y?(M=(0,$.jsxs)(`span`,{className:y,children:[k,A]}),t[21]=k,t[22]=A,t[23]=y,t[24]=M):M=t[24];let N;t[25]!==r.connectedSince||t[26]!==r.state||t[27]!==n.uptime?(N=r.connectedSince&&r.state===`connected`?(0,$.jsxs)(`span`,{className:`text-xs text-fg-subtle`,children:[n.uptime,` `,Ke(r.connectedSince)]}):null,t[25]=r.connectedSince,t[26]=r.state,t[27]=n.uptime,t[28]=N):N=t[28];let P;t[29]!==M||t[30]!==N||t[31]!==b?(P=(0,$.jsxs)(`div`,{className:b,children:[M,N]}),t[29]=M,t[30]=N,t[31]=b,t[32]=P):P=t[32];let F;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,$.jsx)(K,{className:`size-4 text-fg-subtle`,strokeWidth:1.75,"aria-hidden":!0}),t[33]=F):F=t[33];let I;t[34]!==P||t[35]!==x?(I=(0,$.jsxs)(`div`,{className:x,children:[P,F]}),t[34]=P,t[35]=x,t[36]=I):I=t[36];let R;t[37]===o?R=t[38]:(R=o?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:o instanceof Error?o.message:String(o)}):null,t[37]=o,t[38]=R);let z;t[39]!==l||t[40]!==n.consentExpiredBanner?(z=l?(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]=l,t[40]=n.consentExpiredBanner,t[41]=z):z=t[41];let B;t[42]!==_||t[43]!==u||t[44]!==m||t[45]!==h||t[46]!==v||t[47]!==r||t[48]!==g||t[49]!==f||t[50]!==s||t[51]!==p||t[52]!==c||t[53]!==n?(B=_?(0,$.jsxs)(`div`,{className:`space-y-4`,children:[r.publicUrl?(0,$.jsx)(`div`,{className:`rounded-xl bg-surface-panel/80 px-3 py-3 shadow-surface`,children:(0,$.jsx)(V,{label:n.publicUrlLabel,text:r.publicUrl,labels:u})}):null,v?(0,$.jsx)(Ve,{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)(X,{type:`button`,variant:`secondary`,disabled:c,onClick:h,children:[c?(0,$.jsx)(L,{className:`size-4 animate-spin`}):null,n.stop]}):(0,$.jsxs)(X,{type:`button`,disabled:s,onClick:m,children:[s?(0,$.jsx)(L,{className:`size-4 animate-spin`}):(0,$.jsx)(me,{className:`size-4`}),n.start]})})]}):(0,$.jsxs)(`div`,{className:`space-y-4`,children:[p?(0,$.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:p}):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)(j,{className:`mt-0.5 size-4 shrink-0 text-amber-600 dark:text-amber-400`}),(0,$.jsx)(`p`,{children:n.riskBannerBody})]}),g&&f?(0,$.jsx)(`p`,{className:`text-sm text-amber-800 dark:text-amber-200`,children:f}):null,(0,$.jsxs)(X,{type:`button`,disabled:s||g,onClick:m,className:`w-full sm:w-auto`,children:[s?(0,$.jsx)(L,{className:`size-4 animate-spin`}):(0,$.jsx)(me,{className:`size-4`}),n.start]})]}),t[42]=_,t[43]=u,t[44]=m,t[45]=h,t[46]=v,t[47]=r,t[48]=g,t[49]=f,t[50]=s,t[51]=p,t[52]=c,t[53]=n,t[54]=B):B=t[54];let H;return t[55]!==I||t[56]!==R||t[57]!==z||t[58]!==B||t[59]!==S?(H=(0,$.jsxs)(`section`,{className:S,children:[I,R,z,B]}),t[55]=I,t[56]=R,t[57]=z,t[58]=B,t[59]=S,t[60]=H):H=t[60],H}var Je=`https://console.xopc.ai/keys/tunnel`,Ye={reconfiguring:!1};function Xe(e){let t=(0,Z.c)(84),{t:n,brokerSecretFromEnv:r,brokerSecretMissing:a,brokerSecretConfiguredInConfig:o,brokerSecretMaskedValue:s,brokerSecretDraft:c,savingBrokerSecret:l,brokerSecretNotice:u,copyFailedLabel:d,onDraftChange:f,onSave:p,onClear:m,sectionRef:h}=e,g=(0,Q.useId)(),_=a&&!r,v=!_,[y,b]=(0,Q.useReducer)(P,Ye),{reconfiguring:S}=y,C;t[0]!==o||t[1]!==c||t[2]!==r||t[3]!==S?(C=o&&!r&&!S&&!c.trim(),t[0]=o,t[1]=c,t[2]=r,t[3]=S,t[4]=C):C=t[4];let w=C,T;t[5]!==n.copied||t[6]!==n.copyKey||t[7]!==n.hideKey||t[8]!==n.showKey?(T={show:n.showKey,hide:n.hideKey,copy:n.copyKey,copied:n.copied},t[5]=n.copied,t[6]=n.copyKey,t[7]=n.hideKey,t[8]=n.showKey,t[9]=T):T=t[9];let E=T,D;t[10]===c?D=t[11]:(D=c.trim().length>0&&!te(c.trim()),t[10]=c,t[11]=D);let O=D,k;t[12]===f?k=t[13]:(k=()=>{b({type:`patch`,patch:{reconfiguring:!1}}),f(``)},t[12]=f,t[13]=k);let A=k,j=_&&`ring-1 ring-amber-500/30`,M;t[14]===j?M=t[15]:(M=i(j),t[14]=j,t[15]=M);let N=v?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`:_?`bg-amber-500/10 text-amber-700 dark:text-amber-400`:`bg-surface-hover text-fg-muted`,F;t[16]===N?F=t[17]:(F=i(`flex size-9 shrink-0 items-center justify-center rounded-lg`,N),t[16]=N,t[17]=F);let I;t[18]===v?I=t[19]:(I=v?(0,$.jsx)(ae,{className:`size-4`,strokeWidth:2,"aria-hidden":!0}):(0,$.jsx)(ie,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[18]=v,t[19]=I);let R;t[20]!==F||t[21]!==I?(R=(0,$.jsx)(`span`,{className:F,children:I}),t[20]=F,t[21]=I,t[22]=R):R=t[22];let z=v?n.brokerSecretReadyTitle:n.brokerSecretStepTitle,B;t[23]===z?B=t[24]:(B=(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:z}),t[23]=z,t[24]=B);let V=v?n.brokerSecretReadyHint:n.brokerSecretHint,H;t[25]===V?H=t[26]:(H=(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:V}),t[25]=V,t[26]=H);let U;t[27]!==_||t[28]!==n.brokerSecretMissingHint?(U=_?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-amber-800 dark:text-amber-200`,children:n.brokerSecretMissingHint}):null,t[27]=_,t[28]=n.brokerSecretMissingHint,t[29]=U):U=t[29];let W;t[30]!==B||t[31]!==H||t[32]!==U?(W=(0,$.jsxs)(`div`,{children:[B,H,U]}),t[30]=B,t[31]=H,t[32]=U,t[33]=W):W=t[33];let ee;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,$.jsx)(x,{className:`size-3`,"aria-hidden":!0}),t[34]=ee):ee=t[34];let G;t[35]===n.brokerSecretConsoleLink?G=t[36]:(G=(0,$.jsxs)(`a`,{href:Je,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,ee]}),t[35]=n.brokerSecretConsoleLink,t[36]=G);let ne;t[37]!==r||t[38]!==n.brokerSecretEnvHint?(ne=r?(0,$.jsx)(`p`,{className:`rounded-lg bg-surface-panel/80 px-3 py-2 text-xs text-fg-muted shadow-surface`,children:n.brokerSecretEnvHint}):null,t[37]=r,t[38]=n.brokerSecretEnvHint,t[39]=ne):ne=t[39];let K;t[40]!==o||t[41]!==c||t[42]!==r||t[43]!==s||t[44]!==O||t[45]!==A||t[46]!==d||t[47]!==g||t[48]!==_||t[49]!==m||t[50]!==f||t[51]!==p||t[52]!==S||t[53]!==l||t[54]!==E||t[55]!==w||t[56]!==n.brokerSecretCancelReconfigure||t[57]!==n.brokerSecretClear||t[58]!==n.brokerSecretMaskedHelp||t[59]!==n.brokerSecretNotInConfigFile||t[60]!==n.brokerSecretPlaceholder||t[61]!==n.brokerSecretReconfigure||t[62]!==n.brokerSecretRevealFailed||t[63]!==n.brokerSecretSave||t[64]!==n.brokerSecretSaveAndContinue||t[65]!==n.brokerSecretTitle?(K=w?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`sr-only`,htmlFor:g,children:n.brokerSecretTitle}),(0,$.jsx)(oe,{id:g,value:s,labels:E,reveal:Ze,loadFailedLabel:d||n.brokerSecretRevealFailed,maskedHelp:n.brokerSecretMaskedHelp,notInConfigFile:n.brokerSecretNotInConfigFile,readOnly:!0}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsx)(X,{type:`button`,variant:`secondary`,disabled:l,onClick:()=>{b({type:`patch`,patch:{reconfiguring:!0}})},children:n.brokerSecretReconfigure}),(0,$.jsx)(X,{type:`button`,variant:`ghost`,disabled:l,onClick:m,children:n.brokerSecretClear})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`sr-only`,htmlFor:g,children:n.brokerSecretTitle}),(0,$.jsx)(oe,{id:g,value:c,onChange:f,placeholder:n.brokerSecretPlaceholder,labels:E,disabled:l}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsxs)(X,{type:`button`,disabled:l||!O,onClick:p,children:[l?(0,$.jsx)(L,{className:`size-4 animate-spin`}):null,_?n.brokerSecretSaveAndContinue:n.brokerSecretSave]}),o||r?(0,$.jsx)(X,{type:`button`,variant:`ghost`,disabled:l,onClick:m,children:n.brokerSecretClear}):null,S?(0,$.jsx)(X,{type:`button`,variant:`ghost`,disabled:l,onClick:A,children:n.brokerSecretCancelReconfigure}):null]})]}),t[40]=o,t[41]=c,t[42]=r,t[43]=s,t[44]=O,t[45]=A,t[46]=d,t[47]=g,t[48]=_,t[49]=m,t[50]=f,t[51]=p,t[52]=S,t[53]=l,t[54]=E,t[55]=w,t[56]=n.brokerSecretCancelReconfigure,t[57]=n.brokerSecretClear,t[58]=n.brokerSecretMaskedHelp,t[59]=n.brokerSecretNotInConfigFile,t[60]=n.brokerSecretPlaceholder,t[61]=n.brokerSecretReconfigure,t[62]=n.brokerSecretRevealFailed,t[63]=n.brokerSecretSave,t[64]=n.brokerSecretSaveAndContinue,t[65]=n.brokerSecretTitle,t[66]=K):K=t[66];let q;t[67]===u?q=t[68]:(q=u?(0,$.jsx)(`p`,{className:`text-xs text-emerald-700 dark:text-emerald-400`,children:u}):null,t[67]=u,t[68]=q);let re;t[69]!==W||t[70]!==G||t[71]!==ne||t[72]!==K||t[73]!==q?(re=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-3`,children:[W,G,ne,K,q]}),t[69]=W,t[70]=G,t[71]=ne,t[72]=K,t[73]=q,t[74]=re):re=t[74];let J;t[75]!==R||t[76]!==re?(J=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[R,re]}),t[75]=R,t[76]=re,t[77]=J):J=t[77];let Y;t[78]!==J||t[79]!==M?(Y=(0,$.jsx)(Se,{className:M,children:J}),t[78]=J,t[79]=M,t[80]=Y):Y=t[80];let se;return t[81]!==h||t[82]!==Y?(se=(0,$.jsx)(`div`,{ref:h,id:`tunnel-broker-secret-setup`,children:Y}),t[81]=h,t[82]=Y,t[83]=se):se=t[83],se}function Ze(){return S().then(Qe)}function Qe(e){return e.registrationSecret??null}function $e(e){let t=(0,Z.c)(10),{language:n,label:r,section:a,className:o}=e,s;t[0]!==n||t[1]!==a?(s=B(n,a),t[0]=n,t[1]=a,t[2]=s):s=t[2];let c;t[3]===o?c=t[4]:(c=i(`inline-flex items-center gap-1 text-sm font-medium text-accent hover:underline`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,o),t[3]=o,t[4]=c);let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(x,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[5]=l):l=t[5];let u;return t[6]!==r||t[7]!==s||t[8]!==c?(u=(0,$.jsxs)(`a`,{href:s,target:`_blank`,rel:`noreferrer`,className:c,children:[r,l]}),t[6]=r,t[7]=s,t[8]=c,t[9]=u):u=t[9],u}var et=e(Ce(),1),tt={width:216,margin:2,errorCorrectionLevel:`M`,color:{dark:`#000000ff`,light:`#ffffffff`}};async function nt(e){return et.toDataURL(e,tt)}function rt(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 it(e,t){let n=t.trim();return!n||!e?!1:e.candidates.some(e=>e.kind===`tunnel`&&e.url.trim()===n)}function at(e,t){return e?t?rt(e)||e.recommended.url?.trim()||``:e.recommended.url?.trim()||``:``}function ot(e,t){let n=t?.preferLan===!0,r=!!e,{mutate:i}=p(),a=(0,Q.useRef)(!1),{data:o}=m(r?`tunnel-status`:null,ue,{refreshInterval:6e4}),{data:c,mutate:l}=m(r?`tunnel-pair-context`:null,M,{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 d=o?.state===`connected`&&!!o.publicUrl?.trim(),f=d&&!n,{data:h,mutate:g}=m(f&&r?`tunnel-qr`:null,b,{refreshInterval:4*6e4}),{data:_,mutate:v}=m(!f&&r&&c?.pairingReady?`tunnel-pair`:null,U,{refreshInterval:4*6e4}),[y,x]=(0,Q.useState)(``),[S,C]=(0,Q.useState)(``),[w,T]=(0,Q.useState)({pairContext:void 0,preferLan:n});if(!a.current&&(c!==w.pairContext||n!==w.preferLan)){T({pairContext:c,preferLan:n});let e=at(c,n);y!==e&&x(e)}let E=(0,Q.useCallback)(e=>{a.current=!0,x(e)},[]),O=(0,Q.useCallback)(()=>{let e=at(c,n);e&&(a.current=!0,x(e))},[c,n]),k=(0,Q.useCallback)(e=>{let t=e.trim();t&&(a.current=!0,x(t))},[]),A=(0,Q.useCallback)(e=>{a.current=!1,x(e?.trim()||at(c,n))},[c,n]),j=y.trim(),N=(0,Q.useMemo)(()=>{try{let e=new URL(j);return e.protocol===`http:`||e.protocol===`https:`}catch{return!1}},[j]),P=N&&s(j),F=!f&&!!(c&&!c.pairingReady&&c.blockReason===`GATEWAY_LOOPBACK_ONLY`),I=!f&&N&&!P&&!!_?.pairingSecret&&(c?.pairingReady===!0||!F),L=(0,Q.useMemo)(()=>{let e=rt(c);return n?e||(j&&!it(c,j)?j:``):j},[c,n,j]),R=(0,Q.useMemo)(()=>{if(!e)return``;if(S.trim())return S.trim();if(f&&h?.qrPayload?.trim())return h.qrPayload.trim();if(!I||!_?.pairingSecret)return``;let t=c?.candidates.find(e=>e.kind===`tunnel`&&e.reachable),r=c?.candidates.find(e=>e.kind===`lan`&&e.reachable),i=n?L:t?.url??j;return i?u({baseUrl:i,pairingSecret:_.pairingSecret,lanUrl:n?null:t&&r?r.url:null}):``},[e,L,_?.pairingSecret,I,S,n,j,f,h?.qrPayload,c?.candidates]),z=D(()=>nt(R),[R],{enabled:!!R,initial:null,errorData:null}),B=R?z.data:null,V=!!(R&&z.error!==null&&!z.loading);return{tunnelActive:d,tunnelStatus:o,tunnelQr:h,pairContext:c,pairBaseUrl:y,setPairBaseUrl:E,applySuggestedPairUrl:O,applyCandidateUrl:k,baseOk:N,localhostWarn:P,pairingBlocked:F,deepLink:R,qrPayload:R,qrDataUrl:B,qrGenFailed:V,encoding:!!(R&&!B&&!V),refreshQr:(0,Q.useCallback)(async e=>{if(e?.trim()){C(e.trim()),g({qrPayload:e.trim(),publicUrl:o?.publicUrl??``,lanUrl:h?.lanUrl??null},!1);return}C(``),await l(),f?await g():c?.pairingReady&&await v()},[v,l,g,c?.pairingReady,h?.lanUrl,o?.publicUrl,f]),resetPairBaseFromContext:A}}var st={actionError:null,starting:!1,stopping:!1,savingAutoStart:!1,consentOpen:!1,autoStartConfirmOpen:!1,releaseConfirmOpen:!1,releasing:!1,brokerSecretDraft:``,savingBrokerSecret:!1,brokerSecretNotice:null};function ct({embedded:e=!1}){let t=f(e=>e.language),n=a(t).tunnelSettings,r=o(e=>e.token),s=!!r,[c,l]=(0,Q.useReducer)(P,st),{actionError:u,starting:d,stopping:p,savingAutoStart:h,consentOpen:g,autoStartConfirmOpen:_,releaseConfirmOpen:y,releasing:b,brokerSecretDraft:x,savingBrokerSecret:S,brokerSecretNotice:C}=c,T=(0,Q.useRef)(null),E=ot(r??``),{data:D}=ne(s),{data:O,error:k,isLoading:j,mutate:M}=m(s?`tunnel-status`:null,ue,{refreshInterval:e=>d?1e3:e?.frpcDownload||e?.state===`connecting`||e?.state===`reconnecting`?2e3:6e4}),F=(0,Q.useMemo)(()=>{let e=D?.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 O?.config?.autoStart===!0},[D,O?.config?.autoStart]),I=(0,Q.useMemo)(()=>{let e=D?.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``},[D]),R=te(I),z=O?.registrationSecret?.source===`env`,B=O?.registrationSecret?.source===`missing`,V=O?.registrationSecret?.configured===!0;(0,Q.useEffect)(()=>{let e=()=>{M()};return window.addEventListener(`tunnel-status`,e),()=>window.removeEventListener(`tunnel-status`,e)},[M]);let H=(0,Q.useMemo)(()=>[n.consentBullet1,n.consentBullet2,n.consentBullet3],[n.consentBullet1,n.consentBullet2,n.consentBullet3]),U=(0,Q.useCallback)(async()=>{l({type:`patch`,patch:{actionError:null}}),l({type:`patch`,patch:{starting:!0}});try{let e=await A();await M(),Y(),await E.refreshQr(e.qrPayload)}catch(e){l({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{l({type:`patch`,patch:{starting:!1}})}},[M,E.refreshQr]),W=(0,Q.useCallback)(()=>{if(!V){l({type:`patch`,patch:{actionError:n.brokerSecretRequiredBeforeStart}}),T.current?.scrollIntoView({behavior:`smooth`,block:`start`});return}if(O?.consentRequired){l({type:`patch`,patch:{consentOpen:!0}});return}U()},[V,O?.consentRequired,U,n.brokerSecretRequiredBeforeStart]),ee=(0,Q.useCallback)(async()=>{l({type:`patch`,patch:{consentOpen:!1}}),l({type:`patch`,patch:{actionError:null}});try{await w(),await Promise.all([M(),U()])}catch(e){l({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}},[M,U]),q=(0,Q.useCallback)(async()=>{l({type:`patch`,patch:{actionError:null}}),l({type:`patch`,patch:{stopping:!0}});try{await G(),await Promise.all([E.refreshQr(),M()]),Y()}catch(e){l({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{l({type:`patch`,patch:{stopping:!1}})}},[M,E.refreshQr]),re=(0,Q.useCallback)(async e=>{l({type:`patch`,patch:{savingAutoStart:!0}}),l({type:`patch`,patch:{actionError:null}});try{await N({autoStart:e}),Y()}catch(e){l({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{l({type:`patch`,patch:{savingAutoStart:!1}})}},[]),ie=(0,Q.useCallback)(()=>{if(F){re(!1);return}if(O?.consentRequired){l({type:`patch`,patch:{actionError:n.consentExpiredBanner}});return}if(!O?.canAutoStart){l({type:`patch`,patch:{actionError:n.autoStartHint}});return}l({type:`patch`,patch:{autoStartConfirmOpen:!0}})},[re,O?.canAutoStart,O?.consentRequired,n,F]),ae=(0,Q.useCallback)(async()=>{let e=x.trim();if(e){l({type:`patch`,patch:{savingBrokerSecret:!0,actionError:null,brokerSecretNotice:null}});try{await N({registrationSecret:e}),l({type:`patch`,patch:{brokerSecretDraft:``,brokerSecretNotice:n.brokerSecretSaved}}),Y(),await M(),l({type:`patch`,patch:{actionError:null}})}catch(e){l({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{l({type:`patch`,patch:{savingBrokerSecret:!1}})}}},[x,M,n.brokerSecretSaved]),J=(0,Q.useCallback)(async()=>{l({type:`patch`,patch:{savingBrokerSecret:!0,actionError:null,brokerSecretNotice:null}});try{await N({registrationSecret:null}),l({type:`patch`,patch:{brokerSecretDraft:``,brokerSecretNotice:n.brokerSecretCleared}}),Y(),await M()}catch(e){l({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{l({type:`patch`,patch:{savingBrokerSecret:!1}})}},[M,n.brokerSecretCleared]),oe=(0,Q.useCallback)(async()=>{l({type:`patch`,patch:{releaseConfirmOpen:!1,actionError:null,releasing:!0}});try{await G({release:!0}),await Promise.all([E.refreshQr(),M()]),Y()}catch(e){l({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{l({type:`patch`,patch:{releasing:!1}})}},[M,E.refreshQr]),se=(0,Q.useMemo)(()=>({copy:n.copyUrl,copied:n.copied,copyFailed:a(t).clipboard.copyFailed}),[t,n.copyUrl,n.copied]);if(!s)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 ce=O??{enabled:!1,state:`disconnected`,subdomain:null,publicUrl:null,connectedSince:null,frpcPid:null,lastHeartbeatAt:null,lastError:null,consentRequired:!0,config:{autoStart:F,brokerUrl:`https://frp.xopc.ai/api`}},le=O?.consentRequired&&(ce.enabled||F||O?.consent?.acceptedAt),de=(0,$.jsx)(Xe,{t:n,brokerSecretFromEnv:z,brokerSecretMissing:B,brokerSecretConfiguredInConfig:R,brokerSecretMaskedValue:R?I:``,brokerSecretDraft:x,savingBrokerSecret:S,brokerSecretNotice:C,copyFailedLabel:a(t).clipboard.copyFailed,onDraftChange:e=>l({type:`patch`,patch:{brokerSecretDraft:e}}),onSave:()=>void ae(),onClear:()=>void J(),sectionRef:T}),fe=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(je,{open:g,title:n.consentTitle,intro:n.consentIntro,bullets:H,checkboxLabel:n.consentCheckbox,confirmLabel:le?n.consentReconfirm:n.consentConfirm,cancelLabel:n.consentCancel,onConfirm:()=>void ee(),onCancel:()=>l({type:`patch`,patch:{consentOpen:!1}})},g?`consent-open`:`consent-closed`),(0,$.jsx)(v,{open:_,title:n.autoStartConfirmTitle,description:n.autoStartConfirmBody,confirmLabel:n.autoStartConfirmLabel,cancelLabel:n.consentCancel,onConfirm:()=>{l({type:`patch`,patch:{autoStartConfirmOpen:!1}}),re(!0)},onCancel:()=>l({type:`patch`,patch:{autoStartConfirmOpen:!1}})}),(0,$.jsx)(v,{open:y,title:n.releaseConfirmTitle,description:n.releaseConfirmBody,confirmLabel:n.releaseConfirmLabel,cancelLabel:n.consentCancel,destructive:!0,onConfirm:()=>void oe(),onCancel:()=>l({type:`patch`,patch:{releaseConfirmOpen:!1}})})]});return e?(0,$.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[u?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:u}):null,de,(0,$.jsx)(qe,{t:n,status:ce,isLoading:j,statusErr:k,starting:d,stopping:p,showConsentExpired:!!le,copyLabels:se,startDisabled:!V,startDisabledReason:V?void 0:n.brokerSecretRequiredBeforeStart,stepLabel:n.flowStepStart,onStart:W,onStop:()=>void q()}),(0,$.jsx)(De,{pairQr:E,gatewayToken:r??``,streamlined:!0,onRefreshQr:()=>void E.refreshQr()}),(0,$.jsxs)(ye,{showLabel:n.showOptions,hideLabel:n.hideOptions,children:[(0,$.jsxs)(`label`,{className:i(`flex items-center gap-3 text-sm text-fg`,!F&&!O?.canAutoStart?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border-edge accent-accent`,checked:F,disabled:h||!F&&!O?.canAutoStart,onChange:ie}),n.autoStart]}),!O?.canAutoStart&&!F?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.autoStartHint}):null,ce.subdomain||ce.publicUrl?(0,$.jsxs)(`div`,{className:`space-y-2 border-t border-edge-subtle pt-4`,children:[(0,$.jsxs)(X,{type:`button`,variant:`secondary`,disabled:b||p,className:`border-danger/40 text-danger hover:bg-danger/10`,onClick:()=>l({type:`patch`,patch:{releaseConfirmOpen:!0}}),children:[b?(0,$.jsx)(L,{className:`size-4 animate-spin`}):null,n.release]}),(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.releaseHint})]}):null]}),(0,$.jsx)(ye,{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)(K,{className:`mt-0.5 size-4 shrink-0 text-accent`}),(0,$.jsx)(`span`,{children:n.brokerNote})]}),(0,$.jsx)($e,{language:t,label:n.brokerDocsLink,section:`public-tunnel`,className:`text-xs`})]})}),fe]}):(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})]}),u?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:u}):null,de,(0,$.jsx)(qe,{t:n,status:ce,isLoading:j,statusErr:k,starting:d,stopping:p,showConsentExpired:!!le,copyLabels:se,startDisabled:!V,startDisabledReason:V?void 0:n.brokerSecretRequiredBeforeStart,onStart:W,onStop:()=>void q()}),(0,$.jsx)(De,{pairQr:E,gatewayToken:r??``}),ce.subdomain||ce.publicUrl?(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,$.jsxs)(X,{type:`button`,variant:`secondary`,disabled:b||p,className:`border-danger/40 text-danger hover:bg-danger/10`,onClick:()=>l({type:`patch`,patch:{releaseConfirmOpen:!0}}),children:[b?(0,$.jsx)(L,{className:`size-4 animate-spin`}):null,n.release]})}):null,ce.subdomain||ce.publicUrl?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.releaseHint}):null,(0,$.jsxs)(Se,{children:[(0,$.jsx)(`h2`,{className:`mb-3 text-sm font-semibold text-fg`,children:n.optionsTitle}),(0,$.jsxs)(`label`,{className:i(`flex items-center gap-3 text-sm text-fg`,!F&&!O?.canAutoStart?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border-edge accent-accent`,checked:F,disabled:h||!F&&!O?.canAutoStart,onChange:ie}),n.autoStart]}),!O?.canAutoStart&&!F?(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)(K,{className:`mt-0.5 size-4 shrink-0 text-accent`}),(0,$.jsx)(`span`,{children:n.brokerNote})]}),(0,$.jsx)($e,{language:t,label:n.brokerDocsLink,section:`public-tunnel`,className:`text-xs`})]}),fe]})}async function lt(){let e=await d(`/api/exposure/status`);if(!e.ok)throw Error(`Failed to load exposure status (${e.status})`);return await e.json()}async function ut(e=`serve`){let t=await d(`/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 dt(){let e=await d(`/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 ft=`https://tailscale.com/download`;function pt(e){let t=(0,Z.c)(2),{label:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`a`,{href:ft,target:`_blank`,rel:`noreferrer`,className:`font-medium text-accent hover:underline`,children:n}),t[0]=n,t[1]=r),r}function mt({embedded:e=!1}){let t=f(e=>e.language),n=a(t).remoteAccess.tailscale,r=(0,Q.useMemo)(()=>({copy:n.copyUrl,copied:n.copied,copyFailed:a(t).clipboard.copyFailed}),[t,n.copyUrl,n.copied]),i=!!o(e=>e.token),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(null),{data:d,mutate:p,isLoading:h}=m(i?`exposure-status`:null,lt,{refreshInterval:3e4}),g=d?.tailscale.hostname,_=d?.tailscale.active===!0,v=d?.tailscale.cliAvailable!==!1,y=g?`https://${g}/`:null,b=(0,Q.useCallback)(async()=>{c(!0),u(null);try{await ut(`serve`),await p()}catch(e){u(e instanceof Error?e.message:String(e))}finally{c(!1)}},[p]),x=(0,Q.useCallback)(async()=>{c(!0),u(null);try{await dt(),await p()}catch(e){u(e instanceof Error?e.message:String(e))}finally{c(!1)}},[p]);if(!i)return null;let S=(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)(pt,{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)(pt,{label:n.cliMissingDownloadLink}),n.cliMissingSuffix]}):null,h&&!d?(0,$.jsxs)(`div`,{className:`grid gap-3`,"aria-busy":`true`,children:[(0,$.jsx)(W,{className:`h-20 rounded-lg`}),(0,$.jsx)(W,{className:`h-20 rounded-lg`})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(Se,{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}),y?(0,$.jsx)(`div`,{className:`mt-3`,children:(0,$.jsx)(V,{text:y,labels:r})}):null,l?(0,$.jsx)(`p`,{className:`mt-2 text-sm text-red-600 dark:text-red-400`,children:l}):null,(0,$.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:_?(0,$.jsxs)(X,{type:`button`,variant:`secondary`,disabled:s,onClick:()=>void x(),children:[s?(0,$.jsx)(L,{className:`mr-1 h-4 w-4 animate-spin`}):null,n.disableServe]}):(0,$.jsxs)(X,{type:`button`,disabled:s||!v,onClick:()=>void b(),children:[s?(0,$.jsx)(L,{className:`mr-1 h-4 w-4 animate-spin`}):(0,$.jsx)(me,{className:`mr-1 h-4 w-4`}),n.enableServe]})})]}),(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.hint}),(0,$.jsx)($e,{language:t,label:n.docsLink,section:`tailscale-serve`,className:`mt-2`})]})]});return e?S:(0,$.jsxs)(Se,{children:[(0,$.jsx)(be,{icon:K,title:n.title,subtitle:n.subtitle}),S]})}function ht(){let e=(0,Z.c)(26),t=f(_t),n=o(gt),r;e[0]===t?r=e[1]:(r=a(t),e[0]=t,e[1]=r);let i=r.remoteAccess.lan,s;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(s={preferLan:!0},e[2]=s):s=e[2];let c=ot(n??``,s),l;e[3]!==i.subtitle||e[4]!==i.title?(l=(0,$.jsx)(be,{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)(x,{className:`size-3.5`,"aria-hidden":!0}),e[8]=d):d=e[8];let p;e[9]===i.link?p=e[10]:(p=(0,$.jsxs)(de,{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]=p);let m;e[11]!==u||e[12]!==p?(m=(0,$.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[u,p]}),e[11]=u,e[12]=p,e[13]=m):m=e[13];let h;e[14]!==l||e[15]!==m?(h=(0,$.jsxs)(Se,{children:[l,m]}),e[14]=l,e[15]=m,e[16]=h):h=e[16];let g=n??``,_;e[17]===c?_=e[18]:(_=()=>void c.refreshQr(),e[17]=c,e[18]=_);let v;e[19]!==c||e[20]!==g||e[21]!==_?(v=(0,$.jsx)(De,{pairQr:c,gatewayToken:g,lanOnly:!0,onRefreshQr:_}),e[19]=c,e[20]=g,e[21]=_,e[22]=v):v=e[22];let y;return e[23]!==v||e[24]!==h?(y=(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[h,v]}),e[23]=v,e[24]=h,e[25]=y):y=e[25],y}function gt(e){return e.token}function _t(e){return e.language}function vt(e){let t=(0,Z.c)(30),{embedded:n}=e,r=n===void 0?!1:n,i=f(yt),o;t[0]===i?o=t[1]:(o=a(i),t[0]=i,t[1]=o);let s=o.remoteAccess.ssh,[c,l]=(0,Q.useState)(!1),u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=async()=>{await q(`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 m,h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>void d(),h=(0,$.jsx)(O,{className:`mr-1 h-4 w-4`}),t[4]=m,t[5]=h):(m=t[4],h=t[5]);let g=c?s.copied:s.copy,_;t[6]===g?_=t[7]:(_=(0,$.jsx)(`div`,{className:`mt-2`,children:(0,$.jsxs)(X,{type:`button`,variant:`ghost`,onClick:m,children:[h,g]})}),t[6]=g,t[7]=_);let v;t[8]!==r||t[9]!==s.hint?(v=r?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:s.hint}):null,t[8]=r,t[9]=s.hint,t[10]=v):v=t[10];let y;t[11]!==_||t[12]!==v?(y=(0,$.jsxs)($.Fragment,{children:[p,_,v]}),t[11]=_,t[12]=v,t[13]=y):y=t[13];let b=y;if(r){let e;t[14]!==s.subtitle||t[15]!==s.title?(e=(0,$.jsx)(be,{icon:E,title:s.title,subtitle:s.subtitle}),t[14]=s.subtitle,t[15]=s.title,t[16]=e):e=t[16];let n;t[17]===b?n=t[18]:(n=(0,$.jsx)(`div`,{className:`mt-4 space-y-2`,children:b}),t[17]=b,t[18]=n);let r;return t[19]!==e||t[20]!==n?(r=(0,$.jsxs)(Se,{children:[e,n]}),t[19]=e,t[20]=n,t[21]=r):r=t[21],r}let x;t[22]!==s.subtitle||t[23]!==s.title?(x=(0,$.jsx)(be,{icon:E,title:s.title,subtitle:s.subtitle}),t[22]=s.subtitle,t[23]=s.title,t[24]=x):x=t[24];let S;t[25]===b?S=t[26]:(S=(0,$.jsx)(`div`,{className:`mt-4`,children:b}),t[25]=b,t[26]=S);let C;return t[27]!==x||t[28]!==S?(C=(0,$.jsxs)(Se,{children:[x,S]}),t[27]=x,t[28]=S,t[29]=C):C=t[29],C}function yt(e){return e.language}function bt(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(vt,{embedded:!0}),e[0]=t):t=e[0],t}function xt(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 St(e){let t=(0,Z.c)(5),{label:n,kind:r}=e,a;t[0]===r?a=t[1]:(a=i(`rounded-full px-2 py-0.5 text-[11px] font-medium`,xt(r)),t[0]=r,t[1]=a);let o;return t[2]!==n||t[3]!==a?(o=(0,$.jsx)(`span`,{className:a,children:n}),t[2]=n,t[3]=a,t[4]=o):o=t[4],o}function Ct(e){let t=(0,Z.c)(32),{onOpenTab:n}=e,r=f(Et),s;t[0]===r?s=t[1]:(s=a(r),t[0]=r,t[1]=s);let c=s.remoteAccess.guide,l=!!o(Tt),u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u={refreshInterval:3e4},t[2]=u):u=t[2];let{data:d}=m(l?`exposure-status`:null,lt,u),p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p={refreshInterval:15e3},t[3]=p):p=t[3];let{data:h}=m(l?`tunnel-status`:null,ue,p),g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(g={refreshInterval:6e4},t[4]=g):g=t[4];let{data:_}=m(l?`tunnel-pair-context`:null,M,g);if(!l)return null;let v=d?.tailscale.active===!0,y=h?.state,b=h?.enabled&&y===`connected`,x=h?.enabled&&(y===`connecting`||y===`reconnecting`||!!h?.startProgress||!!h?.frpcDownload),S=(_?.candidates??[]).some(wt),C=v?`active`:`off`,w=v?c.statusActive:c.statusOff,T;t[5]!==c.tailscaleCardTitle||t[6]!==C||t[7]!==w?(T={tab:`tailscale`,icon:K,title:c.tailscaleCardTitle,kind:C,statusLabel:w},t[5]=c.tailscaleCardTitle,t[6]=C,t[7]=w,t[8]=T):T=t[8];let D=b?`active`:x?`connecting`:`off`,O=b?c.statusActive:x?c.statusConnecting:c.statusOff,A;t[9]!==c.publicCardTitle||t[10]!==D||t[11]!==O?(A={tab:`public`,icon:k,title:c.publicCardTitle,kind:D,statusLabel:O},t[9]=c.publicCardTitle,t[10]=D,t[11]=O,t[12]=A):A=t[12];let j=S?`active`:`off`,N=S?c.statusActive:c.statusOff,P;t[13]!==c.reverseProxyCardTitle||t[14]!==j||t[15]!==N?(P={tab:`reverse-proxy`,icon:ce,title:c.reverseProxyCardTitle,kind:j,statusLabel:N},t[13]=c.reverseProxyCardTitle,t[14]=j,t[15]=N,t[16]=P):P=t[16];let F;t[17]!==c.sshCardStatus||t[18]!==c.sshCardTitle?(F={tab:`ssh`,icon:E,title:c.sshCardTitle,kind:`off`,statusLabel:c.sshCardStatus},t[17]=c.sshCardStatus,t[18]=c.sshCardTitle,t[19]=F):F=t[19];let I;t[20]!==c.lanCardStatus||t[21]!==c.lanCardTitle?(I={tab:`lan`,icon:J,title:c.lanCardTitle,kind:`off`,statusLabel:c.lanCardStatus},t[20]=c.lanCardStatus,t[21]=c.lanCardTitle,t[22]=I):I=t[22];let L;t[23]!==A||t[24]!==P||t[25]!==F||t[26]!==I||t[27]!==T?(L=[T,A,P,F,I],t[23]=A,t[24]=P,t[25]=F,t[26]=I,t[27]=T,t[28]=L):L=t[28];let R=L,z;return t[29]!==R||t[30]!==n?(z=(0,$.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5`,children:R.map(e=>{let t=e.icon;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e.tab),className:i(`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)(St,{label:e.statusLabel,kind:e.kind})]})]},`${e.tab}-${e.title}`)})}),t[29]=R,t[30]=n,t[31]=z):z=t[31],z}function wt(e){return e.kind===`reverse-proxy`}function Tt(e){return e.token}function Et(e){return e.language}function Dt(e){let t=(0,Z.c)(26),{title:n,description:r,recommended:a,icon:o,onOpen:s,openLabel:c,recommendedLabel:l}=e,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=i(`group flex w-full flex-col rounded-2xl bg-surface-base px-4 py-4 text-left transition-colors`,`hover:bg-surface-hover/40`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),t[0]=u):u=t[0];let d;t[1]===o?d=t[2]:(d=(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)(o,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})}),t[1]=o,t[2]=d);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]!==a||t[6]!==l?(p=a&&l?(0,$.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,children:l}):null,t[5]=a,t[6]=l,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 g;t[11]===r?g=t[12]:(g=(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:r}),t[11]=r,t[12]=g);let _;t[13]!==m||t[14]!==g?(_=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[m,g]}),t[13]=m,t[14]=g,t[15]=_):_=t[15];let v;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(h,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`,"aria-hidden":!0}),t[16]=v):v=t[16];let y;t[17]!==d||t[18]!==_?(y=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[d,_,v]}),t[17]=d,t[18]=_,t[19]=y):y=t[19];let b;t[20]===c?b=t[21]:(b=(0,$.jsx)(`span`,{className:`mt-3 text-xs font-medium text-accent`,children:c}),t[20]=c,t[21]=b);let x;return t[22]!==s||t[23]!==b||t[24]!==y?(x=(0,$.jsxs)(`button`,{type:`button`,onClick:s,className:u,children:[y,b]}),t[22]=s,t[23]=b,t[24]=y,t[25]=x):x=t[25],x}function Ot(e){let t=(0,Z.c)(83),{onOpenTab:n}=e,r=f(jt),i;t[0]===r?i=t[1]:(i=a(r),t[0]=r,t[1]=i);let s=i.remoteAccess,c=s.guide,l=!!o(At),u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u={refreshInterval:3e4},t[2]=u):u=t[2];let{data:d}=m(l?`exposure-status`:null,lt,u),p;t[3]===d?.conflicts?p=t[4]:(p=d?.conflicts??[],t[3]=d?.conflicts,t[4]=p);let h=p;if(!l){let e;return t[5]===c.needToken?e=t[6]:(e=(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:c.needToken}),t[5]=c.needToken,t[6]=e),e}let g;t[7]===n?g=t[8]:(g=(0,$.jsx)(Ct,{onOpenTab:n}),t[7]=n,t[8]=g);let _;t[9]!==h||t[10]!==c.conflictsHint||t[11]!==c.conflictsTitle?(_=h.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:c.conflictsTitle}),(0,$.jsx)(`p`,{className:`mt-1`,children:c.conflictsHint}),(0,$.jsx)(`ul`,{className:`mt-2 list-inside list-disc text-xs`,children:h.map(kt)})]}):null,t[9]=h,t[10]=c.conflictsHint,t[11]=c.conflictsTitle,t[12]=_):_=t[12];let v;t[13]===c.pickMethod?v=t[14]:(v=(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:c.pickMethod}),t[13]=c.pickMethod,t[14]=v);let y;t[15]===n?y=t[16]:(y=()=>n(`tailscale`),t[15]=n,t[16]=y);let b;t[17]!==c.configure||t[18]!==c.recommended||t[19]!==c.tailscaleCardDesc||t[20]!==c.tailscaleCardTitle||t[21]!==y?(b=(0,$.jsx)(Dt,{icon:K,title:c.tailscaleCardTitle,description:c.tailscaleCardDesc,recommended:!0,recommendedLabel:c.recommended,openLabel:c.configure,onOpen:y}),t[17]=c.configure,t[18]=c.recommended,t[19]=c.tailscaleCardDesc,t[20]=c.tailscaleCardTitle,t[21]=y,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]!==c.configure||t[26]!==c.publicCardDesc||t[27]!==c.publicCardTitle||t[28]!==x?(S=(0,$.jsx)(Dt,{icon:k,title:c.publicCardTitle,description:c.publicCardDesc,openLabel:c.configure,onOpen:x}),t[25]=c.configure,t[26]=c.publicCardDesc,t[27]=c.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]!==c.configure||t[33]!==c.reverseProxyCardDesc||t[34]!==c.reverseProxyCardTitle||t[35]!==C?(w=(0,$.jsx)(Dt,{icon:ce,title:c.reverseProxyCardTitle,description:c.reverseProxyCardDesc,openLabel:c.configure,onOpen:C}),t[32]=c.configure,t[33]=c.reverseProxyCardDesc,t[34]=c.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 D;t[39]!==c.configure||t[40]!==c.sshCardDesc||t[41]!==c.sshCardTitle||t[42]!==T?(D=(0,$.jsx)(Dt,{icon:E,title:c.sshCardTitle,description:c.sshCardDesc,openLabel:c.configure,onOpen:T}),t[39]=c.configure,t[40]=c.sshCardDesc,t[41]=c.sshCardTitle,t[42]=T,t[43]=D):D=t[43];let O;t[44]===n?O=t[45]:(O=()=>n(`lan`),t[44]=n,t[45]=O);let A;t[46]!==c.configure||t[47]!==c.lanCardDesc||t[48]!==c.lanCardTitle||t[49]!==O?(A=(0,$.jsx)(Dt,{icon:J,title:c.lanCardTitle,description:c.lanCardDesc,openLabel:c.configure,onOpen:O}),t[46]=c.configure,t[47]=c.lanCardDesc,t[48]=c.lanCardTitle,t[49]=O,t[50]=A):A=t[50];let j;t[51]!==S||t[52]!==w||t[53]!==D||t[54]!==A||t[55]!==b?(j=(0,$.jsxs)(`div`,{className:`mt-3 grid gap-3 lg:grid-cols-2`,children:[b,S,w,D,A]}),t[51]=S,t[52]=w,t[53]=D,t[54]=A,t[55]=b,t[56]=j):j=t[56];let M;t[57]!==j||t[58]!==v?(M=(0,$.jsxs)(`div`,{children:[v,j]}),t[57]=j,t[58]=v,t[59]=M):M=t[59];let N;t[60]===c.oneAtATimeHint?N=t[61]:(N=(0,$.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-subtle`,children:c.oneAtATimeHint}),t[60]=c.oneAtATimeHint,t[61]=N);let P;t[62]===s.advanced.proxyTitle?P=t[63]:(P=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:s.advanced.proxyTitle}),t[62]=s.advanced.proxyTitle,t[63]=P);let F;t[64]===s.advanced.proxyBody?F=t[65]:(F=(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:s.advanced.proxyBody}),t[64]=s.advanced.proxyBody,t[65]=F);let I;t[66]!==r||t[67]!==s.advanced.proxyDocs?(I=(0,$.jsx)($e,{language:r,label:s.advanced.proxyDocs,section:`advanced`,className:`mt-2`}),t[66]=r,t[67]=s.advanced.proxyDocs,t[68]=I):I=t[68];let L;t[69]!==P||t[70]!==F||t[71]!==I?(L=(0,$.jsxs)(`div`,{className:`rounded-xl bg-surface-base px-4 py-3`,children:[P,F,I]}),t[69]=P,t[70]=F,t[71]=I,t[72]=L):L=t[72];let R;t[73]!==c.docsLink||t[74]!==r?(R=(0,$.jsx)($e,{language:r,label:c.docsLink}),t[73]=c.docsLink,t[74]=r,t[75]=R):R=t[75];let z;return t[76]!==M||t[77]!==N||t[78]!==L||t[79]!==R||t[80]!==g||t[81]!==_?(z=(0,$.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[g,_,M,N,L,R]}),t[76]=M,t[77]=N,t[78]=L,t[79]=R,t[80]=g,t[81]=_,t[82]=z):z=t[82],z}function kt(e){return(0,$.jsx)(`li`,{children:e.message},e.code)}function At(e){return e.token}function jt(e){return e.language}async function Mt(e){let t=await d(l(`/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 Nt(e){await c(l(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{publicUrl:e??null}})})}function Pt(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 Ft(){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`)||Pt(r)?null:n.toLowerCase().replace(/\/+$/,``)},[])}function It(){return i(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,y,`dark:border-edge`)}function Lt(e){return(e?.candidates.find(e=>e.kind===`reverse-proxy`))?.url?.trim()||null}function Rt(e){return(e?.candidates.find(e=>e.kind===`lan`&&e.reachable))?.url?.trim()||null}function zt(){let e=f(e=>e.language),t=a(e).remoteAccess.reverseProxy,n=!!o(e=>e.token),r=Ft(),{mutate:s}=p(),{data:c,mutate:l}=m(n?`tunnel-pair-context`:null,M,{refreshInterval:6e4}),d=Lt(c),[h,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)({busy:!1,result:null}),[y,b]=(0,Q.useState)({busy:!1,error:null});(0,Q.useEffect)(()=>{h||(d?g(d):r&&g(r))},[d,r,h]);let x=(0,Q.useMemo)(()=>h.trim()||(d??r??``),[d,r,h]),S=!d&&!!r&&x===r,C=Rt(c),{data:w,mutate:T}=m(n&&x?[`reverse-proxy-pair`,x]:null,()=>U(),{refreshInterval:4*6e4,revalidateOnFocus:!1}),E=(0,Q.useMemo)(()=>!x||!w?.pairingSecret?``:u({baseUrl:x,pairingSecret:w.pairingSecret,lanUrl:C}),[x,C,w?.pairingSecret]),O=D(()=>nt(E),[E],{enabled:!!E,initial:null,errorData:null}),k=(0,Q.useCallback)(async()=>{let e=h.trim()||x;if(e){v({busy:!0,result:null});try{v({busy:!1,result:await Mt(e)})}catch(e){v({busy:!1,result:{ok:!1,code:`NETWORK_ERROR`,message:e instanceof Error?e.message:String(e)}})}}},[h,x]),A=(0,Q.useCallback)(async()=>{let e=x.trim();if(e){b({busy:!0,error:null});try{await Nt(e),await l(),await s(`tunnel-pair-context`),b({busy:!1,error:null})}catch(e){b({busy:!1,error:e instanceof Error?e.message:String(e)})}}},[x,s,l]),j=(0,Q.useCallback)(async()=>{b({busy:!0,error:null});try{await Nt(null),await l(),await s(`tunnel-pair-context`),g(``),v({busy:!1,result:null}),b({busy:!1,error:null})}catch(e){b({busy:!1,error:e instanceof Error?e.message:String(e)})}},[s,l]),N=(0,Q.useCallback)(async()=>{await T()},[T]);return n?(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,$.jsxs)(Se,{children:[(0,$.jsx)(be,{icon:K,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:i(It(),`font-mono text-xs sm:flex-1 sm:min-w-0 sm:w-auto`),type:`text`,autoComplete:`off`,spellCheck:!1,placeholder:t.urlPlaceholder,value:h,onChange:e=>{g(e.target.value),v({busy:!1,result:null})}}),(0,$.jsxs)(X,{type:`button`,variant:`secondary`,className:`shrink-0 whitespace-nowrap`,onClick:()=>void k(),disabled:_.busy||!h.trim(),children:[_.busy?(0,$.jsx)(L,{className:`size-3.5 animate-spin`}):null,_.busy?t.probing:t.probeButton]})]}),(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:t.urlHint}),S&&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,_.result?(0,$.jsx)(Bt,{result:_.result,labels:t.probeStatus}):null,(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:flex-wrap`,children:[x&&d!==x?(0,$.jsxs)(X,{type:`button`,onClick:()=>void A(),disabled:y.busy,children:[y.busy?(0,$.jsx)(L,{className:`size-3.5 animate-spin`}):null,y.busy?t.saving:t.saveAsDefault]}):null,d?(0,$.jsx)(X,{type:`button`,variant:`ghost`,onClick:()=>void j(),disabled:y.busy,children:t.clear}):null]}),y.error?(0,$.jsx)(`p`,{className:`text-xs text-red-800 dark:text-red-200`,children:y.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)(Se,{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})]}),E?(0,$.jsxs)(X,{type:`button`,variant:`ghost`,className:`shrink-0`,onClick:()=>void N(),children:[(0,$.jsx)(re,{className:`size-4`}),t.refreshQr]}):null]}),x?w?.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:`}),` `,x,C?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`br`,{}),(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:`lanUrl:`}),` `,C]}):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)(V,{text:E,labels:{copy:t.copyLink,copied:t.copied,copyFailed:a(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 Bt(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 Vt=[`guide`,`tailscale`,`public`,`reverse-proxy`,`ssh`,`lan`];function Ht(e){return e&&Vt.includes(e)?e:`guide`}function Ut(e,t){return e.tabs[t]}function Wt(e,t){return e.tabIntro[t]}function Gt(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 Kt(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)(Ot,{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)(mt,{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)(ct,{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)(zt,{}),t[4]=e):e=t[4],e}case`ssh`:{let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(bt,{}),t[5]=e):e=t[5],e}case`lan`:{let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(ht,{}),t[6]=e):e=t[6],e}}}function qt(){let e=(0,Z.c)(2),t=f(Yt),n=a(t).remoteAccess,r=!!o(Jt),[i,s]=C(),c=Ht(i.get(`tab`)),l;e[0]===s?l=e[1]:(l=e=>{s(t=>{let n=new URLSearchParams(t);return e===`guide`?n.delete(`tab`):n.set(`tab`,e),n},{replace:!0})},e[0]=s,e[1]=l);let u=l,d=Wt(n,c),p=Vt.map(e=>({id:e,label:Ut(n,e)}));return(0,$.jsxs)(ve,{children:[(0,$.jsx)(ge,{title:n.pageTitle,subtitle:n.pageSubtitle,meta:(0,$.jsx)($e,{language:t,label:n.docsLink,section:Gt(c),className:`mt-1`})}),r?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(we,{items:p,activeTab:c,onChange:u,ariaLabel:n.tabsAria,tabIdPrefix:`remote-access-tab`,panelIdPrefix:`remote-access-panel`}),(0,$.jsx)(_e,{id:c,activeTab:c,tabIdPrefix:`remote-access-tab`,panelIdPrefix:`remote-access-panel`,title:Ut(n,c),hint:c===`public`?void 0:d,children:(0,$.jsx)(Kt,{tab:c,onOpenTab:u})})]}):(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.guide.needToken})]})}function Jt(e){return e.token}function Yt(e){return e.language}export{qt as RemoteAccessHub};
|
|
@@ -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"./cn-BQ_8x0bT.js";import{t as a}from"./messages-DR9ODkb8.js";import{a as o,n as s,o as c}from"./fetch-6HXXdO77.js";import{n as l}from"./locale-store-Ba72bFmP.js";import{i as u}from"./vendor-swr-BIWyz7Rc.js";import{$a as d,$s as f,Ac as ee,Ai as p,Ci as m,Co as h,Ct as g,Di as _,Do as v,El as te,Eo as ne,Ha as y,Oi as b,Qs as x,Ra as S,Rs as C,Si as w,Ti as T,Ts as E,Tt as D,Ua as re,Uc as O,Us as k,Va as A,Wa as ie,_o as j,bc as M,bi as N,cs as P,da as F,io as ae,is as I,jc as L,ji as R,ki as oe,ma as z,pa as B,ro as V,tc as se,to as H,vl as ce,vo as U,wi as W,wo as G,ws as le,wt as K,xi as ue,yi as de,yl as fe,za as q,zo as pe}from"./index-BOme955B.js";import{n as J,t as Y}from"./settings-form-section-DnDrLMWZ.js";import{t as X}from"./page-tabs-DYNWfN6S.js";import{n as me,r as he}from"./segmented-styles-BL8oLBEp.js";var Z=e(t(),1),ge=n(),Q=r();function _e(e){let t=new Date(e),n=Math.floor((new Date().getTime()-t.getTime())/(1e3*60*60*24));return n===0?t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):n===1?`Yesterday`:n<7?t.toLocaleDateString([],{weekday:`short`}):t.toLocaleDateString([],{month:`short`,day:`numeric`})}function ve(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function ye(e){let t=(0,ge.c)(105),{session:n,variant:r,labels:a,sessionAgentId:o,sessionAgentAvatar:s,onOpen:c,onAction:l}=e,u;t[0]!==a.unnamedSession||t[1]!==n.name?(u=n.name?.trim()||a.unnamedSession,t[0]=a.unnamedSession,t[1]=n.name,t[2]=u):u=t[2];let d=u,f;t[3]===n.name?f=t[4]:(f=n.name?.trim(),t[3]=n.name,t[4]=f);let p=!!f,m=n.status===`archived`,h=n.status===`pinned`,g=r===`list`&&`sm:flex-row sm:items-center sm:gap-4`,_;t[5]===g?_=t[6]:(_=i(`group flex min-w-0 w-full max-w-full cursor-pointer flex-col rounded-xl bg-surface-base text-left transition-colors duration-150 ease-out`,`hover:bg-surface-hover active:scale-[0.99]`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,g),t[5]=g,t[6]=_);let v;t[7]===c?v=t[8]:(v=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),c())},t[7]=c,t[8]=v);let te=r===`list`&&`sm:py-3`,y;t[9]===te?y=t[10]:(y=i(`flex min-w-0 items-start justify-between gap-2 bg-surface-hover/35 px-3 py-2 dark:bg-surface-hover/25`,te),t[9]=te,t[10]=y);let b;t[11]===n.sourceChannel?b=t[12]:(b=(0,Q.jsx)(`div`,{className:`flex min-w-0 items-center gap-2`,children:(0,Q.jsx)(`span`,{className:`truncate text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:n.sourceChannel})}),t[11]=n.sourceChannel,t[12]=b);let x;t[13]===h?x=t[14]:(x=h?(0,Q.jsx)(E,{className:`size-3.5 text-accent-fg`,strokeWidth:1.75,"aria-hidden":!0}):null,t[13]=h,t[14]=x);let S;t[15]===n.updatedAt?S=t[16]:(S=_e(n.updatedAt),t[15]=n.updatedAt,t[16]=S);let w;t[17]===S?w=t[18]:(w=(0,Q.jsx)(`span`,{children:S}),t[17]=S,t[18]=w);let T;t[19]!==w||t[20]!==x?(T=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 text-xs text-fg-muted`,children:[x,w]}),t[19]=w,t[20]=x,t[21]=T):T=t[21];let D;t[22]!==T||t[23]!==y||t[24]!==b?(D=(0,Q.jsxs)(`div`,{className:y,children:[b,T]}),t[22]=T,t[23]=y,t[24]=b,t[25]=D):D=t[25];let re=r===`list`&&`sm:py-3`,O;t[26]===re?O=t[27]:(O=i(`min-w-0 flex-1 px-3 py-2`,re),t[26]=re,t[27]=O);let k=r===`list`&&`sm:items-start`,A;t[28]===k?A=t[29]:(A=i(`flex gap-3`,k),t[28]=k,t[29]=A);let ie;t[30]!==s||t[31]!==o?(ie=(0,Q.jsx)(R,{agentId:o,avatar:s,size:40,className:`size-10 shrink-0 ring-1 ring-edge/60 dark:ring-edge`}),t[30]=s,t[31]=o,t[32]=ie):ie=t[32];let M;t[33]===d?M=t[34]:(M=(0,Q.jsx)(`div`,{className:`min-w-0 max-w-full truncate text-sm font-semibold text-fg`,title:d,children:d}),t[33]=d,t[34]=M);let N;t[35]!==n.key||t[36]!==p?(N=p?(0,Q.jsx)(`div`,{className:`mt-0.5 min-w-0 max-w-full truncate font-mono text-[11px] text-fg-subtle`,title:n.key,children:n.key}):null,t[35]=n.key,t[36]=p,t[37]=N):N=t[37];let P;t[38]!==M||t[39]!==N?(P=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[M,N]}),t[38]=M,t[39]=N,t[40]=P):P=t[40];let F;t[41]!==A||t[42]!==ie||t[43]!==P?(F=(0,Q.jsxs)(`div`,{className:A,children:[ie,P]}),t[41]=A,t[42]=ie,t[43]=P,t[44]=F):F=t[44];let ae;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,Q.jsx)(C,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[45]=ae):ae=t[45];let I;t[46]===n.messageCount?I=t[47]:(I=(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[ae,n.messageCount]}),t[46]=n.messageCount,t[47]=I);let L;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Q.jsx)(ne,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[48]=L):L=t[48];let oe;t[49]===n.estimatedTokens?oe=t[50]:(oe=ve(n.estimatedTokens),t[49]=n.estimatedTokens,t[50]=oe);let z;t[51]===oe?z=t[52]:(z=(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[L,oe]}),t[51]=oe,t[52]=z);let B;t[53]!==I||t[54]!==z?(B=(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-3 text-xs text-fg-muted`,children:[I,z]}),t[53]=I,t[54]=z,t[55]=B):B=t[55];let V;t[56]===n.tags?V=t[57]:(V=n.tags.length>0?(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[n.tags.slice(0,3).map(Se),n.tags.length>3?(0,Q.jsxs)(`span`,{className:`text-[11px] text-fg-disabled`,children:[`+`,n.tags.length-3]}):null]}):null,t[56]=n.tags,t[57]=V);let se;t[58]!==O||t[59]!==F||t[60]!==B||t[61]!==V?(se=(0,Q.jsxs)(`div`,{className:O,children:[F,B,V]}),t[58]=O,t[59]=F,t[60]=B,t[61]=V,t[62]=se):se=t[62];let H;t[63]===l?H=t[64]:(H=()=>l(`continue`),t[63]=l,t[64]=H);let U;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Q.jsx)(C,{className:`size-4`,strokeWidth:1.75}),t[65]=U):U=t[65];let W;t[66]!==a.continueChat||t[67]!==H?(W=(0,Q.jsx)(`button`,{type:`button`,className:j,title:a.continueChat,"aria-label":a.continueChat,onClick:H,children:U}),t[66]=a.continueChat,t[67]=H,t[68]=W):W=t[68];let G;t[69]!==m||t[70]!==a.archive||t[71]!==a.unarchive||t[72]!==l?(G=m?(0,Q.jsx)(`button`,{type:`button`,className:j,title:a.unarchive,"aria-label":a.unarchive,onClick:()=>l(`unarchive`),children:(0,Q.jsx)(fe,{className:`size-4`,strokeWidth:1.75})}):(0,Q.jsx)(`button`,{type:`button`,className:j,title:a.archive,"aria-label":a.archive,onClick:()=>l(`archive`),children:(0,Q.jsx)(ce,{className:`size-4`,strokeWidth:1.75})}),t[69]=m,t[70]=a.archive,t[71]=a.unarchive,t[72]=l,t[73]=G):G=t[73];let K;t[74]!==h||t[75]!==a.pin||t[76]!==a.unpin||t[77]!==l?(K=h?(0,Q.jsx)(`button`,{type:`button`,className:j,title:a.unpin,"aria-label":a.unpin,onClick:()=>l(`unpin`),children:(0,Q.jsx)(le,{className:`size-4`,strokeWidth:1.75})}):(0,Q.jsx)(`button`,{type:`button`,className:j,title:a.pin,"aria-label":a.pin,onClick:()=>l(`pin`),children:(0,Q.jsx)(E,{className:`size-4`,strokeWidth:1.75})}),t[74]=h,t[75]=a.pin,t[76]=a.unpin,t[77]=l,t[78]=K):K=t[78];let ue;t[79]===l?ue=t[80]:(ue=()=>l(`export`),t[79]=l,t[80]=ue);let de;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,Q.jsx)(ee,{className:`size-4`,strokeWidth:1.75}),t[81]=de):de=t[81];let q;t[82]!==a.export||t[83]!==ue?(q=(0,Q.jsx)(`button`,{type:`button`,className:j,title:a.export,"aria-label":a.export,onClick:ue,children:de}),t[82]=a.export,t[83]=ue,t[84]=q):q=t[84];let J;t[85]===Symbol.for(`react.memo_cache_sentinel`)?(J=i(j,`text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40`),t[85]=J):J=t[85];let Y;t[86]===l?Y=t[87]:(Y=()=>l(`delete`),t[86]=l,t[87]=Y);let X;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,Q.jsx)(pe,{className:`size-4`,strokeWidth:1.75}),t[88]=X):X=t[88];let me;t[89]!==a.delete||t[90]!==Y?(me=(0,Q.jsx)(`button`,{type:`button`,className:J,title:a.delete,"aria-label":a.delete,onClick:Y,children:X}),t[89]=a.delete,t[90]=Y,t[91]=me):me=t[91];let he;t[92]!==W||t[93]!==G||t[94]!==K||t[95]!==q||t[96]!==me?(he=(0,Q.jsxs)(`div`,{role:`group`,className:`flex flex-wrap items-center gap-0.5 border-t border-edge-subtle/80 bg-surface-hover/25 p-2 dark:border-edge-subtle`,onClick:xe,onKeyDown:be,children:[W,G,K,q,me]}),t[92]=W,t[93]=G,t[94]=K,t[95]=q,t[96]=me,t[97]=he):he=t[97];let Z;return t[98]!==c||t[99]!==D||t[100]!==se||t[101]!==_||t[102]!==he||t[103]!==v?(Z=(0,Q.jsxs)(`div`,{role:`button`,tabIndex:0,className:_,onClick:c,onKeyDown:v,children:[D,se,he]}),t[98]=c,t[99]=D,t[100]=se,t[101]=_,t[102]=he,t[103]=v,t[104]=Z):Z=t[104],Z}function be(e){return e.stopPropagation()}function xe(e){return e.stopPropagation()}function Se(e){return(0,Q.jsx)(`span`,{className:`max-w-full break-words rounded-md bg-surface-hover px-1.5 py-0.5 text-[11px] text-fg-muted`,children:e},e)}function $(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ce(e){return e===`main`||e===`per-peer`||e===`per-channel-peer`||e===`per-account-channel-peer`?e:`main`}function we(e){let t=$(e)?e:{},n=$(t.session)?t.session:{},r=$(n.storage)?n.storage:{},i=typeof r.pruneAfterDays==`number`&&Number.isFinite(r.pruneAfterDays)?Math.max(0,Math.floor(r.pruneAfterDays)):typeof r.pruneAfterMs==`number`&&Number.isFinite(r.pruneAfterMs)?Math.max(0,Math.round(r.pruneAfterMs/864e5)):null,a=typeof r.maxEntries==`number`&&Number.isFinite(r.maxEntries)?Math.max(1,Math.floor(r.maxEntries)):null;return{dmScope:Ce(n.dmScope),pruneAfterDays:i,maxEntries:a}}async function Te(e){await s(c(`/api/config`),{method:`PATCH`,body:JSON.stringify({session:{dmScope:e.dmScope,storage:{pruneAfterMs:e.pruneAfterDays===null?null:e.pruneAfterDays*864e5,maxEntries:e.maxEntries}}})}),B()}function Ee(){return i(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,h,`dark:border-edge`)}var De=g();function Oe({hasToken:e}){let t=a(l(e=>e.language)).sessions.config,{data:n,isLoading:r}=z(e),i=(0,Z.useMemo)(()=>n?.payload?.config===void 0?null:we(n.payload.config),[n]),[o,s]=(0,Z.useReducer)(De,{form:null,baseline:null}),c=o.form,u=o.baseline,[f,ee]=(0,Z.useState)(!1),[p,m]=(0,Z.useState)(null),h=(0,Z.useRef)(!1),g=(0,Z.useRef)(null);K({enabled:e,parsed:i,dirty:h.current,trackedParsedRef:g,dispatch:s,onResetDirty:()=>{h.current=!1}});let _=c&&u&&JSON.stringify(c)!==JSON.stringify(u),v=(0,Z.useCallback)(e=>{h.current=!0,s({type:`patch`,patch:e})},[]);return!e||!c?r?(0,Q.jsx)(Y,{children:(0,Q.jsx)(k,{className:`size-4 animate-spin text-fg-muted`})}):null:(0,Q.jsxs)(Y,{children:[(0,Q.jsx)(J,{icon:L,title:t.title,subtitle:t.hint}),(0,Q.jsxs)(`div`,{className:`mb-4 flex justify-end gap-2`,children:[(0,Q.jsx)(G,{type:`button`,variant:`secondary`,disabled:!_||f,onClick:()=>s({type:`discard`}),children:t.discard}),(0,Q.jsx)(G,{type:`button`,variant:`primary`,disabled:!_||f,onClick:()=>{(async()=>{ee(!0),m(null);try{await Te(c),h.current=!1,s({type:`saved`,value:c})}catch(e){m(e instanceof Error?e.message:t.saveError)}finally{ee(!1)}})()},children:f?t.saving:t.save})]}),p?(0,Q.jsx)(`p`,{className:`mb-3 text-sm text-red-600 dark:text-red-400`,children:p}):null,(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.dmScope}),(0,Q.jsxs)(d,{className:Ee(),value:c.dmScope,onChange:e=>v({dmScope:e.target.value}),children:[(0,Q.jsx)(H,{value:`main`,children:t.dmScopeMain}),(0,Q.jsx)(H,{value:`per-peer`,children:t.dmScopePerPeer}),(0,Q.jsx)(H,{value:`per-channel-peer`,children:t.dmScopePerChannelPeer}),(0,Q.jsx)(H,{value:`per-account-channel-peer`,children:t.dmScopePerAccountChannelPeer})]}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.dmScopeHint})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.pruneAfterDays}),(0,Q.jsx)(`input`,{type:`number`,min:0,className:Ee(),value:c.pruneAfterDays??``,placeholder:t.unsetPlaceholder,onChange:e=>{let t=e.target.value.trim();v({pruneAfterDays:t===``?null:Math.max(0,Math.floor(Number(t)||0))})}})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.maxEntries}),(0,Q.jsx)(`input`,{type:`number`,min:1,className:Ee(),value:c.maxEntries??``,placeholder:t.unsetPlaceholder,onChange:e=>{let t=e.target.value.trim();v({maxEntries:t===``?null:Math.max(1,Math.floor(Number(t)||1))})}})]})]})]})}function ke(e){if(typeof e==`string`)return e.length>2e3?`${e.slice(0,2e3)}…`:e;try{let t=JSON.stringify(e,null,2);return t.length>2e3?`${t.slice(0,2e3)}…`:t}catch{return String(e)}}function Ae(e){let t=(0,ge.c)(60),{open:n,loading:r,session:a,sessionAgentId:o,sessionAgentAvatar:s,labels:c,onClose:l,onArchive:u,onUnarchive:d,onPin:f,onUnpin:ee,onExport:p,onDelete:m}=e,h=a?.status===`archived`,g=a?.status===`pinned`,_;t[0]===l?_=t[1]:(_=e=>!e&&l(),t[0]=l,t[1]=_);let te;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Q.jsx)(A,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim`,ae)}),t[2]=te):te=t[2];let ne;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(ne=i(`xopc-drawer-right fixed right-0 top-0 flex size-full max-w-lg flex-col border-l border-edge bg-surface-panel shadow-popover outline-none`,V,`dark:border-edge`),t[3]=ne):ne=t[3];let b;t[4]!==a||t[5]!==s||t[6]!==o?(b=a&&o?(0,Q.jsx)(R,{agentId:o,avatar:s,size:40,className:`size-10 shrink-0 ring-1 ring-edge/60 dark:ring-edge`}):null,t[4]=a,t[5]=s,t[6]=o,t[7]=b):b=t[7];let x;t[8]!==c.unnamedSession||t[9]!==a?.name?(x=a?.name?.trim()||c.unnamedSession,t[8]=c.unnamedSession,t[9]=a?.name,t[10]=x):x=t[10];let C;t[11]===x?C=t[12]:(C=(0,Q.jsx)(ie,{className:`min-w-0 flex-1 truncate text-base font-semibold tracking-tight text-fg`,children:x}),t[11]=x,t[12]=C);let w;t[13]!==b||t[14]!==C?(w=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[b,C]}),t[13]=b,t[14]=C,t[15]=w):w=t[15];let T;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Q.jsx)(v,{className:`size-5`,strokeWidth:1.75}),t[16]=T):T=t[16];let E;t[17]===c.close?E=t[18]:(E=(0,Q.jsx)(S,{asChild:!0,children:(0,Q.jsx)(G,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":c.close,children:T})}),t[17]=c.close,t[18]=E);let D;t[19]!==w||t[20]!==E?(D=(0,Q.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3 dark:border-edge`,children:[w,E]}),t[19]=w,t[20]=E,t[21]=D):D=t[21];let O;t[22]!==c.detailLoading||t[23]!==c.detailMessages||t[24]!==r||t[25]!==a?(O=r?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:c.detailLoading}):a?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`dl`,{className:`mb-4 grid gap-2 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-fg-disabled`,children:`Key`}),(0,Q.jsx)(`dd`,{className:`mt-0.5 break-all font-mono text-fg`,children:a.key})]}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-4`,children:(0,Q.jsxs)(`span`,{children:[a.messageCount,` msgs · `,a.estimatedTokens,` tok`]})})]}),(0,Q.jsx)(`h3`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:c.detailMessages}),(0,Q.jsx)(`ul`,{className:`space-y-3`,children:a.messages.map(je)})]}):null,t[22]=c.detailLoading,t[23]=c.detailMessages,t[24]=r,t[25]=a,t[26]=O):O=t[26];let k;t[27]===O?k=t[28]:(k=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:O}),t[27]=O,t[28]=k);let j;t[29]!==c.detailExport||t[30]!==p?(j=(0,Q.jsx)(G,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:p,children:c.detailExport}),t[29]=c.detailExport,t[30]=p,t[31]=j):j=t[31];let M;t[32]!==h||t[33]!==c.archive||t[34]!==c.unarchive||t[35]!==u||t[36]!==d?(M=h?(0,Q.jsx)(G,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:d,children:c.unarchive}):(0,Q.jsx)(G,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:u,children:c.archive}),t[32]=h,t[33]=c.archive,t[34]=c.unarchive,t[35]=u,t[36]=d,t[37]=M):M=t[37];let N;t[38]!==g||t[39]!==c.pin||t[40]!==c.unpin||t[41]!==f||t[42]!==ee?(N=g?(0,Q.jsx)(G,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:ee,children:c.unpin}):(0,Q.jsx)(G,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:f,children:c.pin}),t[38]=g,t[39]=c.pin,t[40]=c.unpin,t[41]=f,t[42]=ee,t[43]=N):N=t[43];let P;t[44]!==c.delete||t[45]!==m?(P=(0,Q.jsx)(G,{type:`button`,variant:`secondary`,className:`text-sm text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40`,onClick:m,children:c.delete}),t[44]=c.delete,t[45]=m,t[46]=P):P=t[46];let F;t[47]!==j||t[48]!==M||t[49]!==N||t[50]!==P?(F=(0,Q.jsx)(`div`,{className:`shrink-0 border-t border-edge px-4 py-3 dark:border-edge`,children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[j,M,N,P]})}),t[47]=j,t[48]=M,t[49]=N,t[50]=P,t[51]=F):F=t[51];let I;t[52]!==D||t[53]!==k||t[54]!==F?(I=(0,Q.jsxs)(y,{children:[te,(0,Q.jsxs)(q,{className:ne,"aria-describedby":void 0,children:[D,k,F]})]}),t[52]=D,t[53]=k,t[54]=F,t[55]=I):I=t[55];let L;return t[56]!==n||t[57]!==_||t[58]!==I?(L=(0,Q.jsx)(re,{open:n,onOpenChange:_,children:I}),t[56]=n,t[57]=_,t[58]=I,t[59]=L):L=t[59],L}function je(e){return(0,Q.jsxs)(`li`,{className:`rounded-lg border border-edge-subtle bg-surface-hover/50 p-2 dark:border-edge`,children:[(0,Q.jsx)(`div`,{className:`mb-1 text-[10px] font-medium uppercase text-fg-subtle`,children:e.role}),(0,Q.jsx)(`pre`,{className:`max-h-40 overflow-auto whitespace-pre-wrap break-words font-mono text-[11px] leading-relaxed text-fg-muted`,children:ke(e.content)})]},`${e.timestamp??``}-${e.role}-${ke(e.content).slice(0,24)}`)}var Me=20;function Ne(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}var Pe=new Set([`all`,`active`,`pinned`,`archived`]),Fe=new Set([`grid`,`list`]),Ie=[`sessions`,`settings`];function Le(e){return e&&Ie.includes(e)?e:`sessions`}function Re(e,t){return t===`sessions`?e.tabsSessions:e.tabsSettings}function ze(e,t){return t===`sessions`?e.tabsSessionsHint:e.tabsSettingsHint}function Be(e){let t=(0,ge.c)(7),{s:n,activeTab:r,onChange:i}=e,a;t[0]===n?a=t[1]:(a=Ie.map(e=>({id:e,label:Re(n,e),icon:e===`sessions`?se:I})),t[0]=n,t[1]=a);let o=a,s;return t[2]!==r||t[3]!==o||t[4]!==i||t[5]!==n.tabsAriaLabel?(s=(0,Q.jsx)(X,{items:o,activeTab:r,onChange:i,ariaLabel:n.tabsAriaLabel,tabIdPrefix:`sessions-tab`,panelIdPrefix:`sessions-panel`}),t[2]=r,t[3]=o,t[4]=i,t[5]=n.tabsAriaLabel,t[6]=s):s=t[6],s}function Ve(e){let t=(0,ge.c)(10),{s:n,id:r,activeTab:i,plain:a,children:o}=e,s=a===void 0?!1:a;if(i!==r)return null;let c=`sessions-panel-${r}`,l=`sessions-tab-${r}`,u=s?`contents`:`rounded-2xl bg-surface-base px-4 py-5 sm:px-5`,d;t[0]!==o||t[1]!==r||t[2]!==s||t[3]!==n?(d=s?o:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`mb-5`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:Re(n,r)}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:ze(n,r)})]}),(0,Q.jsx)(`div`,{className:`space-y-4`,children:o})]}),t[0]=o,t[1]=r,t[2]=s,t[3]=n,t[4]=d):d=t[4];let f;return t[5]!==c||t[6]!==l||t[7]!==u||t[8]!==d?(f=(0,Q.jsx)(`section`,{id:c,role:`tabpanel`,"aria-labelledby":l,className:u,children:d}),t[5]=c,t[6]=l,t[7]=u,t[8]=d,t[9]=f):f=t[9],f}function He(e){let t=e.get(`status`),n=e.get(`view`);return{searchInput:e.get(`q`)??``,debouncedSearch:(e.get(`q`)??``).trim(),statusFilter:Pe.has(t)?t:`all`,viewMode:Fe.has(n)?n:`grid`,channelFilter:(e.get(`channel`)??``).trim(),sessions:[],loading:!1,error:null,hasMore:!1,stats:null,detailOpen:!1,detailLoading:!1,detailSession:null,confirmOpen:!1,confirmKey:null}}function Ue(){let e=a(l(e=>e.language)),t=e.sessions,n=o(e=>e.token),r=!!n,{data:s,mutate:c}=u(r?[`gateway-chat-agents`,n]:null,F,{revalidateOnFocus:!1}),d=s?.defaultId??`main`,ee=s?.items??[],[h,g]=te(),v=Le(h.get(`tab`)),ne=(0,Z.useCallback)(e=>{let t=new URLSearchParams(h);e===`sessions`?t.delete(`tab`):t.set(`tab`,e),g(t,{replace:!0})},[h,g]),[S,C]=(0,Z.useReducer)(D,h,He),{searchInput:k,debouncedSearch:j,statusFilter:I,viewMode:L,channelFilter:R,sessions:z,loading:B,error:H,hasMore:le,stats:K,detailOpen:fe,detailLoading:pe,detailSession:J,confirmOpen:Y,confirmKey:X}=S;(0,Z.useEffect)(()=>{let e=setTimeout(()=>{let e=k.trim();j!==e&&C({type:`patch`,patch:{debouncedSearch:e}})},300);return()=>clearTimeout(e)},[k,j]);let ge=h.toString(),_e=(0,Z.useRef)(ge);if(_e.current!==ge){_e.current=ge;let e=h.get(`q`)??``,t=h.get(`status`),n=h.get(`view`),r=(h.get(`channel`)??``).trim(),i=Pe.has(t)?t:`all`,a=Fe.has(n)?n:`grid`,o=e.trim();C({type:`patch`,patch:{...k===e?{}:{searchInput:e},...j===o?{}:{debouncedSearch:o},...I===i?{}:{statusFilter:i},...L===a?{}:{viewMode:a},...R===r?{}:{channelFilter:r}}})}(0,Z.useEffect)(()=>{let e=new URLSearchParams(h),t=j.trim();t?e.set(`q`,t):e.delete(`q`),I===`all`?e.delete(`status`):e.set(`status`,I),L===`grid`?e.delete(`view`):e.set(`view`,L),R?e.set(`channel`,R):e.delete(`channel`),e.toString()!==h.toString()&&g(e,{replace:!0})},[j,h,g,I,L,R]),(0,Z.useEffect)(()=>{if(!r||v!==`sessions`)return;let e=!1;return(async()=>{C({type:`patch`,patch:{loading:!0,error:null}});try{let t=await W({limit:Me,offset:0,...j?{search:j}:{},...I===`all`?{}:{status:I},...R?{channel:R}:{}});if(e)return;C({type:`patch`,patch:{sessions:t.items,hasMore:t.hasMore}})}catch(n){e||C({type:`patch`,patch:{error:n instanceof Error?n.message:t.loadError}})}finally{e||C({type:`patch`,patch:{loading:!1}})}})(),()=>{e=!0}},[r,v,j,I,R,t.loadError]),(0,Z.useEffect)(()=>{!r||v!==`sessions`||m().then(e=>C({type:`patch`,patch:{stats:e}})).catch(()=>{})},[r,v]),(0,Z.useEffect)(()=>{if(!r||v!==`sessions`)return;let e=()=>void c();return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},[r,v,c]),(0,Z.useEffect)(()=>{if(!r||v!==`sessions`)return;let e=e=>{let t=e.detail;!t?.key||t.name===void 0||C({type:`patch`,patch:{sessions:z.map(e=>e.key===t.key?{...e,name:t.name}:e),detailSession:J&&J.key===t.key?{...J,name:t.name}:J}})};return window.addEventListener(`session-updated`,e),()=>{window.removeEventListener(`session-updated`,e)}},[r,v,z,J]);let ve=(0,Z.useCallback)(async()=>{if(!(!r||B||!le)){C({type:`patch`,patch:{loading:!0,error:null}});try{let e=await W({limit:Me,offset:z.length,...j?{search:j}:{},...I===`all`?{}:{status:I},...R?{channel:R}:{}});C({type:`patch`,patch:{sessions:[...z,...e.items],hasMore:e.hasMore}})}catch(e){C({type:`patch`,patch:{error:e instanceof Error?e.message:t.loadError}})}finally{C({type:`patch`,patch:{loading:!1}})}}},[r,B,le,z.length,j,I,R,t.loadError]),be=(0,Z.useCallback)((e,t)=>{C({type:`patch`,patch:{sessions:z.map(n=>n.key===e?{...n,status:t}:n),detailSession:J&&J.key===e?{...J,status:t}:J}})},[z,J]),xe=(0,Z.useCallback)(async e=>{C({type:`patch`,patch:{detailOpen:!0,detailLoading:!0,detailSession:null}});try{C({type:`patch`,patch:{detailSession:await w(e)}})}catch{C({type:`patch`,patch:{detailOpen:!1}})}finally{C({type:`patch`,patch:{detailLoading:!1}})}},[]),Se=e=>{xe(e)},$=async(e,t)=>{if(t===`continue`){window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{sessionKey:e},bubbles:!0}));return}if(t===`delete`){C({type:`patch`,patch:{confirmKey:e,confirmOpen:!0}});return}try{switch(t){case`archive`:await de(e),be(e,`archived`);break;case`unarchive`:await _(e),be(e,`active`);break;case`pin`:await T(e),be(e,`pinned`);break;case`unpin`:await b(e),be(e,`active`);break;case`export`:{let t=await ue(e),n=new Blob([t],{type:`application/json`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`session-${e.replace(/[^a-z0-9]/gi,`_`)}.json`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r);break}default:break}m().then(e=>C({type:`patch`,patch:{stats:e}})).catch(()=>{})}catch{}},Ce=async e=>{try{await N(e),C({type:`patch`,patch:{sessions:z.filter(t=>t.key!==e),detailSession:J?.key===e?null:J,...J?.key===e?{detailOpen:!1}:{}}}),m().then(e=>C({type:`patch`,patch:{stats:e}})).catch(()=>{})}catch{}},we={continueChat:t.continueChat,archive:t.archive,unarchive:t.unarchive,pin:t.pin,unpin:t.unpin,export:t.export,delete:t.delete,unnamedSession:e.chat.newSession},Te={close:t.close,detailLoading:t.detailLoading,detailMessages:t.detailMessages,detailExport:t.detailExport,archive:t.archive,unarchive:t.unarchive,pin:t.pin,unpin:t.unpin,delete:t.delete,unnamedSession:e.chat.newSession},Ee=[{key:`all`,label:t.filterAll,icon:se},{key:`active`,label:t.filterActive,icon:O},{key:`pinned`,label:t.filterPinned,icon:E},{key:`archived`,label:t.filterArchived,icon:ce}],De=(()=>{let e=Object.entries(K?.byChannel??{}).sort((e,t)=>t[1]-e[1]).slice(0,6).map(([e])=>e),t=new Set(e);for(let n of[`telegram`,`weixin`,`feishu`])t.has(n)||(e.push(n),t.add(n));return e.slice(0,8)})();return r?(0,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-x-hidden bg-surface-panel`,children:[(0,Q.jsxs)(`div`,{className:`flex w-full flex-col gap-6 px-3 py-6 sm:px-5 xl:px-6`,children:[(0,Q.jsx)(`header`,{className:`flex flex-col gap-2`,children:(0,Q.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight text-fg`,children:t.title})}),(0,Q.jsx)(Be,{s:t,activeTab:v,onChange:ne}),(0,Q.jsx)(Ve,{s:t,id:`settings`,activeTab:v,plain:!0,children:(0,Q.jsx)(Oe,{hasToken:r})}),(0,Q.jsxs)(Ve,{s:t,id:`sessions`,activeTab:v,plain:!0,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between`,children:[(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Ee.map(({key:e,label:t,icon:n})=>(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":I===e,onClick:()=>C({type:`patch`,patch:{statusFilter:e}}),className:i(`inline-flex items-center gap-1.5 rounded-xl px-3 py-2 text-sm font-medium`,U.transition,U.focusRingPanel,I===e?`bg-accent-soft text-accent-fg`:`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`),children:[(0,Q.jsx)(n,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t]},e))}),(0,Q.jsxs)(`div`,{className:`flex w-full min-w-0 items-center gap-2 rounded-xl bg-surface-base px-3 py-2 transition-colors lg:max-w-md dark:bg-surface-hover/40`,children:[(0,Q.jsx)(P,{className:`size-4 shrink-0 text-fg-disabled`,strokeWidth:1.75,"aria-hidden":!0}),(0,Q.jsx)(`input`,{type:`search`,value:k,onChange:e=>C({type:`patch`,patch:{searchInput:e.target.value}}),placeholder:t.searchPlaceholder,"data-debounced-query":j||void 0,className:`min-w-0 flex-1 border-0 bg-transparent text-sm text-fg placeholder:text-fg-disabled focus:outline-none focus:ring-0`})]})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg-subtle`,children:t.filterChannelLabel}),(0,Q.jsx)(`button`,{type:`button`,"aria-pressed":!R,onClick:()=>C({type:`patch`,patch:{channelFilter:``}}),className:i(`inline-flex items-center rounded-xl px-3 py-2 text-sm font-medium`,U.transition,U.focusRingPanel,R?`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`:`bg-accent-soft text-accent-fg`),children:t.filterChannelAll}),De.map(e=>(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":R===e,onClick:()=>C({type:`patch`,patch:{channelFilter:e}}),className:i(`inline-flex items-center rounded-xl px-3 py-2 text-sm font-medium`,U.transition,U.focusRingPanel,R===e?`bg-accent-soft text-accent-fg`:`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`),children:[e,K?.byChannel?.[e]==null?null:(0,Q.jsx)(`span`,{className:`ml-2 rounded-full bg-surface-hover px-2 py-0.5 text-[11px] text-fg-subtle`,children:K.byChannel[e]})]},e))]}),K?(0,Q.jsx)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[[K.totalSessions,t.totalSessions],[K.activeSessions,t.activeSessions],[K.pinnedSessions,t.pinnedSessions],[K.archivedSessions,t.archivedSessions]].map(([e,t])=>(0,Q.jsxs)(`div`,{className:`rounded-xl bg-surface-base p-3 dark:bg-surface-hover/30`,children:[(0,Q.jsx)(`div`,{className:`text-lg font-semibold tabular-nums text-fg`,children:e}),(0,Q.jsx)(`div`,{className:`text-xs text-fg-muted`,children:t})]},t))}):null,H?(0,Q.jsx)(`div`,{className:`rounded-lg border border-edge bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-edge dark:bg-red-950/40 dark:text-red-300`,children:H}):null,(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:Ne(t.sessionCount,{count:z.length})}),(0,Q.jsxs)(`div`,{className:he,role:`group`,"aria-label":t.layoutToggleGroup,children:[(0,Q.jsx)(G,{type:`button`,variant:`segmented`,title:t.gridView,"aria-pressed":L===`grid`,onClick:()=>C({type:`patch`,patch:{viewMode:`grid`}}),className:i(me,`size-7 p-0`,L===`grid`&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,L===`grid`&&`text-accent-fg`),children:(0,Q.jsx)(f,{className:`size-3.5`,strokeWidth:1.5})}),(0,Q.jsx)(G,{type:`button`,variant:`segmented`,title:t.listView,"aria-pressed":L===`list`,onClick:()=>C({type:`patch`,patch:{viewMode:`list`}}),className:i(me,`size-9 p-0`,L===`list`&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,L===`list`&&`text-accent-fg`),children:(0,Q.jsx)(x,{className:`size-3.5`,strokeWidth:1.5})})]})]}),B&&z.length===0?(0,Q.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:Array.from({length:6}).map((e,t)=>(0,Q.jsx)(`div`,{className:`h-40 animate-pulse rounded-xl bg-surface-hover/60 dark:bg-surface-hover/40`},t))}):z.length===0?(0,Q.jsxs)(`div`,{className:`flex flex-col items-center justify-center rounded-2xl bg-surface-base py-16 text-center dark:bg-surface-hover/25`,children:[(0,Q.jsx)(M,{className:`mb-3 size-12 text-fg-disabled`,strokeWidth:1.25,"aria-hidden":!0}),(0,Q.jsx)(`p`,{className:`text-base font-semibold text-fg`,children:t.noSessions}),(0,Q.jsx)(`p`,{className:`mt-1 max-w-sm text-sm text-fg-muted`,children:t.noSessionsDescription}),(0,Q.jsx)(G,{variant:`primary`,className:`mt-6`,onClick:()=>{window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{sessionKey:``},bubbles:!0}))},children:t.startNewChat})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:i(`grid min-w-0 gap-3`,L===`grid`?`sm:grid-cols-2 lg:grid-cols-3`:`grid-cols-1`),"data-debounced-query":j||void 0,children:z.map(e=>{let t=p(e,d);return(0,Q.jsx)(ye,{session:e,variant:L,labels:we,sessionAgentId:t,sessionAgentAvatar:oe(t,ee),onOpen:()=>Se(e.key),onAction:t=>void $(e.key,t)},e.key)})}),le?(0,Q.jsx)(`div`,{className:`flex justify-center pt-2`,children:(0,Q.jsx)(G,{type:`button`,variant:`secondary`,disabled:B,onClick:()=>void ve(),children:t.loadMore})}):null]})]})]}),(0,Q.jsx)(Ae,{open:fe,loading:pe,session:J,sessionAgentId:J?p(J,d):void 0,sessionAgentAvatar:J?oe(p(J,d),ee):void 0,labels:Te,onClose:()=>{C({type:`patch`,patch:{detailOpen:!1,detailSession:null}})},onArchive:()=>J&&void $(J.key,`archive`),onUnarchive:()=>J&&void $(J.key,`unarchive`),onPin:()=>J&&void $(J.key,`pin`),onUnpin:()=>J&&void $(J.key,`unpin`),onExport:()=>J&&void $(J.key,`export`),onDelete:()=>J&&C({type:`patch`,patch:{confirmKey:J.key,confirmOpen:!0}})}),(0,Q.jsx)(re,{open:Y,onOpenChange:e=>C({type:`patch`,patch:{confirmOpen:e}}),children:(0,Q.jsxs)(y,{children:[(0,Q.jsx)(A,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim`,ae)}),(0,Q.jsxs)(q,{className:i(`xopc-dialog-content fixed left-1/2 top-1/2 w-[min(100%-2rem,24rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-panel p-4 shadow-popover dark:border-edge`,V),children:[(0,Q.jsx)(ie,{className:`text-base font-semibold text-fg`,children:t.deleteSessionTitle}),(0,Q.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:X?Ne(t.deleteSessionMessage,{name:z.find(e=>e.key===X)?.name?.trim()||e.chat.newSession}):``}),(0,Q.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,Q.jsx)(G,{type:`button`,variant:`secondary`,onClick:()=>C({type:`patch`,patch:{confirmOpen:!1}}),children:t.cancel}),(0,Q.jsx)(G,{type:`button`,variant:`primary`,className:`bg-red-600 hover:bg-red-700`,onClick:()=>{X&&Ce(X),C({type:`patch`,patch:{confirmOpen:!1,confirmKey:null}})},children:t.delete})]})]})]})})]}):(0,Q.jsx)(`div`,{className:`w-full px-3 py-16 text-center text-sm text-fg-muted sm:px-5 xl:px-6`,children:t.needToken})}export{Ue as SessionsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{pr as e}from"./index-BOme955B.js";function t(t){let{children:n,fallback:r}=t,i=r===void 0?null:r;return e()?n:i}export{t};
|