@hearsay-tools/squawk 0.19.0-dev.9155 → 0.19.0-dev.9162
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/ci-wait/controller.d.ts +7 -7
- package/dist/features/reports/routes.d.ts +2 -2
- package/dist/server/activity-routes.d.ts +23 -23
- package/dist/server/project-settings-routes.d.ts +107 -107
- package/dist/server/projects-routes.d.ts +41 -41
- package/dist/server/provider-sign-in-routes.d.ts +2 -2
- package/dist/server/runner-install-routes.d.ts +10 -10
- package/dist/server/runs-routes.d.ts +311 -311
- package/dist/server/server.d.ts +1170 -1170
- package/dist/server/workspace-identity-routes.d.ts +5 -5
- package/package.json +4 -4
- package/web/dist/assets/accounts-section-m_1ntZJh.js +1 -0
- package/web/dist/assets/activity-motion-DDqgr8eF.js +1 -0
- package/web/dist/assets/activity-route-BlEZZxyI.js +1 -0
- package/web/dist/assets/agent-accounts-D_ZKAmaW.js +1 -0
- package/web/dist/assets/{agent-config-section-D8pxNy2V.js → agent-config-section-wICtFVks.js} +2 -2
- package/web/dist/assets/agent-defaults-section-BC9Ypg0g.js +1 -0
- package/web/dist/assets/{appearance-D_t3wCjY.js → appearance-fkDdWPlG.js} +1 -1
- package/web/dist/assets/{archive-on-merge-field-C63xRNFZ.js → archive-on-merge-field-B6kX09p-.js} +1 -1
- package/web/dist/assets/{ask-card-kqWOqKIc.js → ask-card-Cue5EajQ.js} +5 -5
- package/web/dist/assets/attention-BI6592lk.js +1 -0
- package/web/dist/assets/{automation-format-DB34jUyF.js → automation-format-jKMOXcHS.js} +1 -1
- package/web/dist/assets/automations-route-BfOpJjLK.js +2 -0
- package/web/dist/assets/{badge-DVxxThpb.js → badge-DAnkqD7i.js} +1 -1
- package/web/dist/assets/{button-B22ANdCY.js → button-BV_AiLj2.js} +1 -1
- package/web/dist/assets/{centered-state-BgSV4e79.js → centered-state-N8vWM_Hw.js} +1 -1
- package/web/dist/assets/{cez-idle-CdswdDRd.js → cez-idle-C0drOeLs.js} +1 -1
- package/web/dist/assets/{change-counts-wqSYI3W8.js → change-counts-BLLRvt46.js} +1 -1
- package/web/dist/assets/chunk-KS7C4IRE-BdLLx37K.js +3 -0
- package/web/dist/assets/{code-editor-GfQChdgl.js → code-editor-DZMD1guX.js} +1 -1
- package/web/dist/assets/{code-workbench-CUkiQ1pF.js → code-workbench-B0GIezrD.js} +1 -1
- package/web/dist/assets/{collapsible-Bx2vViFx.js → collapsible-D5i3hm2L.js} +1 -1
- package/web/dist/assets/{command-B2Y0By1v.js → command-4D8sPZJy.js} +1 -1
- package/web/dist/assets/{commit-list-Bjc-pQxv.js → commit-list-StLehTiQ.js} +1 -1
- package/web/dist/assets/{dialog-rpNyAWGb.js → dialog-DKr-j9S6.js} +1 -1
- package/web/dist/assets/diff-DEw-tkVq.js +3 -0
- package/web/dist/assets/{diff-controls-CaCUSyxs.js → diff-controls-CSO8HgZ0.js} +1 -1
- package/web/dist/assets/{diff-stat-Dy4uLuyP.js → diff-stat-DCO_BkZB.js} +1 -1
- package/web/dist/assets/{diff-view-4wxDvYXE.js → diff-view-BcU4Rnuo.js} +3 -3
- package/web/dist/assets/discard-changes-dialog-BEsdWdyJ.js +1 -0
- package/web/dist/assets/{dist-BSUJIXeE.js → dist-B2_vvox1.js} +1 -1
- package/web/dist/assets/dist-CCX8mhHc.js +1 -0
- package/web/dist/assets/{dist-BuF3mvCA.js → dist-ClMNSUvT.js} +1 -1
- package/web/dist/assets/{dist--f2yFdPY.js → dist-CyFJ-9Ex.js} +1 -1
- package/web/dist/assets/{dist-DudPJH39.js → dist-Du6flkGD.js} +1 -1
- package/web/dist/assets/{dropdown-menu-DjtKUK8F.js → dropdown-menu-NJZfnQCU.js} +1 -1
- package/web/dist/assets/{es2015-CUEfzDjB.js → es2015-BHonSvOU.js} +1 -1
- package/web/dist/assets/file-preview-_4nAs_Ai.js +2 -0
- package/web/dist/assets/{folder-browser-Civftk0W.js → folder-browser-CFd1U5hn.js} +1 -1
- package/web/dist/assets/{git-toolbar-CepvG0Ng.js → git-toolbar-DXnIUFi1.js} +1 -1
- package/web/dist/assets/github-g-Ykk4uE.js +1 -0
- package/web/dist/assets/{global-activity-route-DhmrWj31.js → global-activity-route-OsAvUny-.js} +2 -2
- package/web/dist/assets/highlighter-Crq-WTmN.js +3 -0
- package/web/dist/assets/host-context-DDbYAKpm.js +1 -0
- package/web/dist/assets/host-storage-B72yoDU1.js +1 -0
- package/web/dist/assets/hosts-CpDMDiQW.js +1 -0
- package/web/dist/assets/{html-report-frame-Ck76gKfA.js → html-report-frame-Bk6UkqKa.js} +1 -1
- package/web/dist/assets/{image-preview-CeEKI2T5.js → image-preview-CdL9a1Zj.js} +1 -1
- package/web/dist/assets/index-D_WkVdwL.css +1 -0
- package/web/dist/assets/index-Dp7K74Jw.js +21 -0
- package/web/dist/assets/label-CgU9vxuM.js +1 -0
- package/web/dist/assets/{live-protocol-DMhTnCmf.js → live-protocol-CNUmr-VT.js} +1 -1
- package/web/dist/assets/markdown-BB-PN03o.js +2 -0
- package/web/dist/assets/{middle-truncated-name-D41ibfXD.js → middle-truncated-name-jUQS2QzL.js} +1 -1
- package/web/dist/assets/{nav-row-styles-CgP5uNp4.js → nav-row-styles-CIedRn3A.js} +1 -1
- package/web/dist/assets/{open-in-menu-CbQWVBD0.js → open-in-menu-BI7mnPPf.js} +1 -1
- package/web/dist/assets/{option-select-BwSkbCrQ.js → option-select-Bmm4ktgQ.js} +1 -1
- package/web/dist/assets/{page-shell-BgabWJ3w.js → page-shell-BdjH5hyc.js} +1 -1
- package/web/dist/assets/{popover-CvL6hQ5c.js → popover-BQolmvDR.js} +1 -1
- package/web/dist/assets/{preferences-section-Cvh644K0.js → preferences-section-dKDCZSWD.js} +1 -1
- package/web/dist/assets/preview-EtD19mg1.js +1 -0
- package/web/dist/assets/preview-pane-connected-DBbCXW1b.js +3 -0
- package/web/dist/assets/{project-location-DR8go8oL.js → project-location-DJjcFmsE.js} +1 -1
- package/web/dist/assets/project-router-Dc6KBQsv.js +1 -0
- package/web/dist/assets/projects-section-CVFyzORg.js +1 -0
- package/web/dist/assets/{prompt-templates-section-DcxD28iA.js → prompt-templates-section-Jj1YbCwG.js} +2 -2
- package/web/dist/assets/queries-IlC9MZgh.js +1 -0
- package/web/dist/assets/{read-state-c_RNJaXO.js → read-state-BeVNfGkB.js} +1 -1
- package/web/dist/assets/{reference-chip-z7dZJVH-.js → reference-chip-BjerVjzM.js} +1 -1
- package/web/dist/assets/{remote-settings-notice-Dtaa3ovl.js → remote-settings-notice-Czl9yS5W.js} +1 -1
- package/web/dist/assets/repo-git-C9N9wa5l.js +1 -0
- package/web/dist/assets/{report-reader-mbkd2DKt.js → report-reader-Ci4sWoe1.js} +1 -1
- package/web/dist/assets/report-selection-CZ8eb9QP.js +1 -0
- package/web/dist/assets/reports-CQPRtR5G.js +1 -0
- package/web/dist/assets/{resources-section-g5XRlefz.js → resources-section-lLpdP6MD.js} +1 -1
- package/web/dist/assets/{review-notes-drafts-BdBvLP6E.js → review-notes-drafts-BjXqp0gY.js} +1 -1
- package/web/dist/assets/{review-panel-Ba8yb8Fu.js → review-panel-B4dp-Rol.js} +1 -1
- package/web/dist/assets/{review-strip-CdlMeV2i.js → review-strip-BE71YjB6.js} +1 -1
- package/web/dist/assets/{run-detail-refresh-C5qmRdgD.js → run-detail-refresh-CE0vyYYA.js} +1 -1
- package/web/dist/assets/{run-diff-BDMdnSv7.js → run-diff-ClfLRsHF.js} +3 -3
- package/web/dist/assets/run-header-DvbVw3uo.js +2 -0
- package/web/dist/assets/{select-DdH25sWT.js → select-CYo1lo6a.js} +1 -1
- package/web/dist/assets/{session-context-section-BqEdLdTv.js → session-context-section-B_NEOGby.js} +2 -2
- package/web/dist/assets/{settings-agent-picker-b4M6fQ8m.js → settings-agent-picker-DeAST7qR.js} +1 -1
- package/web/dist/assets/{settings-field-Bhh8I9fJ.js → settings-field-AyinSFR_.js} +1 -1
- package/web/dist/assets/{settings-list-detail-D3ibaYUj.js → settings-list-detail-BlEEuyae.js} +1 -1
- package/web/dist/assets/settings-save-bar-Dd3bTznK.js +1 -0
- package/web/dist/assets/{settings-shell-BUwdvhI9.js → settings-shell-Bt7NYun7.js} +1 -1
- package/web/dist/assets/sidebar-section-DdrFJBTL.js +1 -0
- package/web/dist/assets/{skills-BLkPhZO8.js → skills-DNCuhhKf.js} +1 -1
- package/web/dist/assets/status-dot-Bmn4xhch.js +1 -0
- package/web/dist/assets/{switch-CAKeV99j.js → switch-B9OfOEzC.js} +1 -1
- package/web/dist/assets/{tab-link-BKlpD9sn.js → tab-link-6TltE1jl.js} +1 -1
- package/web/dist/assets/{task-changes-Drvnew5P.js → task-changes-CdAzeh9M.js} +2 -2
- package/web/dist/assets/{task-commits-1MJHuX1i.js → task-commits-CzZJZj2x.js} +1 -1
- package/web/dist/assets/{task-file-scope-CB3L3KQl.js → task-file-scope-BuFeMG6a.js} +1 -1
- package/web/dist/assets/task-files-BFdMVAb3.js +1 -0
- package/web/dist/assets/{task-github-item-CMNk7FxR.js → task-github-item-Dv0Uflz7.js} +1 -1
- package/web/dist/assets/{task-groups-CGCnVqHE.js → task-groups-DCg4iOB9.js} +1 -1
- package/web/dist/assets/task-thread-C98mqSie.js +2 -0
- package/web/dist/assets/{textarea-vEsJAUAV.js → textarea-BGp28xFr.js} +1 -1
- package/web/dist/assets/thread-state-DqBwIoCM.js +4 -0
- package/web/dist/assets/toaster-DNnL8v10.js +4 -0
- package/web/dist/assets/{tool-display-B9NN44oU.js → tool-display-CTbToGmi.js} +1 -1
- package/web/dist/assets/use-finish-run-CFEVvqeg.js +1 -0
- package/web/dist/assets/use-hand-to-agent-state-BYN578_s.js +1 -0
- package/web/dist/assets/use-path-bases-B238cLk1.js +1 -0
- package/web/dist/assets/{use-search-params-writer-ClMScnNe.js → use-search-params-writer-DD5PEEZw.js} +1 -1
- package/web/dist/assets/use-workspace-config-save-DScW6_8J.js +1 -0
- package/web/dist/assets/{workflows-BUcx-n8J.js → workflows-IT5WTfLr.js} +3 -3
- package/web/dist/assets/{workspace-tools-dbiR1fzO.js → workspace-tools-D_opTe6D.js} +1 -1
- package/web/dist/assets/{worktrees-section-Dyb_QkSd.js → worktrees-section-B8ycJMoK.js} +4 -4
- package/web/dist/assets/zoomable-image-CULOtYYp.js +1 -0
- package/web/dist/index.html +41 -37
- package/web/dist/live-worker.js +2 -2
- package/web/dist/assets/accounts-section-BsgnDmow.js +0 -1
- package/web/dist/assets/activity-motion-Ckq9kC3I.js +0 -1
- package/web/dist/assets/activity-route-5S9WhN9U.js +0 -1
- package/web/dist/assets/agent-accounts-D_7QcFSx.js +0 -1
- package/web/dist/assets/agent-defaults-section-et5LHv9W.js +0 -1
- package/web/dist/assets/attention-DnxGjw_R.js +0 -1
- package/web/dist/assets/automations-route-B5YBpGMc.js +0 -2
- package/web/dist/assets/chunk-KS7C4IRE-Cg8l-LDN.js +0 -3
- package/web/dist/assets/diff-lwWO-At7.js +0 -3
- package/web/dist/assets/discard-changes-dialog-B3gvm7lX.js +0 -1
- package/web/dist/assets/dist-C_rn70hE.js +0 -1
- package/web/dist/assets/file-preview-98pJhZJj.js +0 -2
- package/web/dist/assets/github-4Jhl7lLG.js +0 -1
- package/web/dist/assets/highlighter-Cfo7mLVB.js +0 -3
- package/web/dist/assets/index-BK1FcZrA.css +0 -1
- package/web/dist/assets/index-DJB0lid-.js +0 -21
- package/web/dist/assets/label-feCJ3WOT.js +0 -1
- package/web/dist/assets/markdown-BAPhDASs.js +0 -2
- package/web/dist/assets/preview-pane-connected-B08ZdGux.js +0 -3
- package/web/dist/assets/project-router-j0uBi7Ep.js +0 -1
- package/web/dist/assets/projects-section-XDboHBFP.js +0 -1
- package/web/dist/assets/queries-CchoEEzj.js +0 -1
- package/web/dist/assets/repo-git-Dp9R2TuI.js +0 -1
- package/web/dist/assets/report-selection-BdGxjISG.js +0 -1
- package/web/dist/assets/reports-ya2OW-iR.js +0 -1
- package/web/dist/assets/run-header-BTRXYB4W.js +0 -2
- package/web/dist/assets/settings-save-bar-DFY_Km4X.js +0 -1
- package/web/dist/assets/sidebar-section-CcucfASN.js +0 -1
- package/web/dist/assets/status-dot-Drd4-nfa.js +0 -1
- package/web/dist/assets/task-files-B9okW1TC.js +0 -1
- package/web/dist/assets/task-thread-_2ch8BRt.js +0 -2
- package/web/dist/assets/thread-state-qNczqxZQ.js +0 -4
- package/web/dist/assets/toaster-zMN8cNZQ.js +0 -4
- package/web/dist/assets/use-finish-run-Dvm4JnAH.js +0 -1
- package/web/dist/assets/use-hand-to-agent-state-CBJvP-US.js +0 -1
- package/web/dist/assets/use-path-bases-C9yvZF5B.js +0 -1
- package/web/dist/assets/use-workspace-config-save-9jm9qV6u.js +0 -1
- package/web/dist/assets/zoomable-image-BUTgYpld.js +0 -1
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{c as r}from"./host-context-DDbYAKpm.js";import{Mr as i,Nr as a,_n as o,jr as s,n as c}from"./toaster-DNnL8v10.js";import{o as l}from"./dist-CCX8mhHc.js";import{t as u}from"./createLucideIcon-BHp8sXmF.js";import{t as d}from"./arrow-right-Dh_Lx3um.js";import{t as f}from"./check-OP-CVgZG.js";import{t as p}from"./chevron-down-CHGyCDBH.js";import{n as m,t as h}from"./circle-x-7nTlobAF.js";import{n as g,t as _}from"./smartphone-Lr8Ug2z_.js";import{t as v}from"./info-DA1x_4bz.js";import{t as y}from"./loader-circle-CPBhhDbB.js";import{n as ee,t as te}from"./moon-CRE9nU5R.js";import{t as b}from"./play-CmVAj_fu.js";import{o as x}from"./tool-display-CTbToGmi.js";import{n as S,r as C,t as ne}from"./preview-EtD19mg1.js";import{t as w}from"./square-terminal-B6RYYieR.js";import{t as T}from"./button-BV_AiLj2.js";import{a as E,c as re,i as D,l as O,p as k,r as A,s as ie,t as j}from"./dropdown-menu-NJZfnQCU.js";import{s as ae}from"./project-router-Dc6KBQsv.js";import{t as M}from"./status-dot-Bmn4xhch.js";import{$n as oe,Qn as se,Sr as N,Xn as ce,Zn as le,_ as ue,d as de,f as P,fr as fe,hr as pe,p as me,s as he,u as ge,v as _e,wr as ve,xr as ye}from"./index-Dp7K74Jw.js";import{n as be,o as xe}from"./thread-state-DqBwIoCM.js";var F=u(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),Se=u(`circle-stop`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`,key:`1ssd4o`}]]),Ce=u(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),I=u(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),L=u(`flask-conical`,[[`path`,{d:`M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2`,key:`18mbvz`}],[`path`,{d:`M6.453 15h11.094`,key:`3shlmq`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}]]),we=u(`folder-x`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}],[`path`,{d:`m9.5 10.5 5 5`,key:`ra9qjz`}],[`path`,{d:`m14.5 10.5-5 5`,key:`l2rkpq`}]]),R=u(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),z=u(`hourglass`,[[`path`,{d:`M5 22h14`,key:`ehvnwv`}],[`path`,{d:`M5 2h14`,key:`pdyrp9`}],[`path`,{d:`M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22`,key:`1d314k`}],[`path`,{d:`M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2`,key:`1vvvr6`}]]),Te=u(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),Ee=u(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),B=u(`maximize`,[[`path`,{d:`M8 3H5a2 2 0 0 0-2 2v3`,key:`1dcmit`}],[`path`,{d:`M21 8V5a2 2 0 0 0-2-2h-3`,key:`1e4gt3`}],[`path`,{d:`M3 16v3a2 2 0 0 0 2 2h3`,key:`wsl5sc`}],[`path`,{d:`M16 21h3a2 2 0 0 0 2-2v-3`,key:`18trek`}]]),V=u(`monitor-smartphone`,[[`path`,{d:`M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8`,key:`10dyio`}],[`path`,{d:`M10 19v-3.96 3.15`,key:`1irgej`}],[`path`,{d:`M7 19h5`,key:`qswx4l`}],[`rect`,{width:`6`,height:`10`,x:`16`,y:`12`,rx:`2`,key:`1egngj`}]]),H=u(`plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]),U=u(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),W=u(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),G=u(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),K=u(`tablet`,[[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,ry:`2`,key:`76otgf`}],[`line`,{x1:`12`,x2:`12.01`,y1:`18`,y2:`18`,key:`1dp563`}]]),q=u(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),J=u(`unplug`,[[`path`,{d:`m19 5 3-3`,key:`yk6iyv`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z`,key:`1snsnr`}]]),De=u(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Y=e(t(),1),Oe=1e3,ke=[500,1e3,2e3,4e3,8e3],Ae=1;function je(e,t){if(r())return t.onTransport(`blocked`),{send(){},close(){}};let n=`/api/v1/p/${encodeURIComponent(e.projectId)}/runs/${encodeURIComponent(e.runId)}/preview/ws`,a=()=>`${location.protocol===`https:`?`wss:`:`ws:`}//${location.host}${n}`,c=null,l,u=!1,d=!1,f=0,p=0,m=()=>typeof document>`u`||s(),h=()=>{if(u||!m())return;let e=globalThis.WebSocket;if(typeof e!=`function`)return;let n=new e(a());n.binaryType=`blob`,c=n,n.addEventListener(`open`,()=>{n===c&&(d=!0,t.onTransport(`open`))}),n.addEventListener(`message`,e=>{if(n!==c)return;let r=e.data;if(typeof r==`string`){let e;try{e=JSON.parse(r)}catch{return}let n=o.safeParse(e);n.success&&t.onMessage(n.data);return}r instanceof Blob&&(p=0,t.onFrame(r))}),n.addEventListener(`error`,()=>void 0),n.addEventListener(`close`,()=>{if(n!==c||u)return;if(c=null,!d){if(f+=1,f>=2){u=!0,t.onTransport(`blocked`);return}t.onTransport(`reconnecting`,f),l=setTimeout(h,Oe);return}if(p>=5){u=!0,t.onTransport(`closed`);return}let e=ke[Math.min(p,ke.length-1)];p+=1,t.onTransport(`reconnecting`,p),l=setTimeout(h,e)})},g=i(e=>{if(!u)if(e)c||h();else{clearTimeout(l),l=void 0;let e=c;c=null,e?.close(),t.onTransport(`connecting`)}});return t.onTransport(`connecting`),h(),{send(e){c?.readyState===Ae&&c.send(JSON.stringify(e))},close(){u=!0,g(),clearTimeout(l),l=void 0;let e=c;c=null,e?.close()}}}var X=n();function Me({iconOnly:e=!1,responsive:t=!1,className:n}){return t?(0,X.jsx)(se,{children:(0,X.jsxs)(ce,{children:[(0,X.jsx)(oe,{asChild:!0,children:(0,X.jsxs)(`span`,{role:`img`,"aria-label":`Experimental`,tabIndex:0,"data-slot":`preview-experimental`,className:l(`inline-flex h-7 min-w-7 shrink-0 items-center justify-center gap-0 rounded-full bg-muted px-0 text-xs font-semibold text-muted-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none @min-[860px]:gap-1.5 @min-[860px]:px-2.5`,n),children:[(0,X.jsx)(L,{className:`size-3.5`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`hidden @min-[860px]:inline`,children:`Experimental`})]})}),(0,X.jsx)(le,{children:`Experimental`})]})}):e?(0,X.jsx)(se,{children:(0,X.jsxs)(ce,{children:[(0,X.jsx)(oe,{asChild:!0,children:(0,X.jsx)(`span`,{role:`img`,"aria-label":`Experimental`,tabIndex:0,"data-slot":`preview-experimental`,className:l(`inline-flex size-7 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,n),children:(0,X.jsx)(L,{className:`size-3.5`,"aria-hidden":`true`})})}),(0,X.jsx)(le,{children:`Experimental`})]})}):(0,X.jsxs)(`span`,{"data-slot":`preview-experimental`,className:l(`inline-flex h-7 shrink-0 items-center gap-1.5 rounded-full bg-muted px-2.5 text-xs font-semibold text-muted-foreground`,n),children:[(0,X.jsx)(L,{className:`size-3.5`,"aria-hidden":`true`}),`Experimental`]})}function Ne({text:e,source:t,onCopy:n,className:r}){let i=e.replace(/\s+$/,``).split(`
|
|
2
|
+
`);return(0,X.jsxs)(`div`,{"data-slot":`preview-log-tail`,className:l(`min-w-0 rounded-lg bg-muted px-3.5 py-3 font-mono text-xs`,r),children:[(0,X.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3 font-sans text-xs text-soft-foreground`,children:[(0,X.jsxs)(`span`,{className:`min-w-0 truncate`,children:[(0,X.jsx)(`span`,{className:`font-semibold tracking-wide uppercase`,children:`Log tail`}),` last ${i.length} ${i.length===1?`line`:`lines`} · ${t}`]}),(0,X.jsxs)(`button`,{type:`button`,className:`-m-2 inline-flex min-h-11 items-center gap-1.5 rounded-sm p-2 text-muted-foreground hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none md:m-0 md:min-h-0 md:p-0`,onClick:()=>n(e),children:[(0,X.jsx)(N,{className:`size-3.5`,"aria-hidden":`true`}),`Copy`]})]}),(0,X.jsx)(`pre`,{className:`max-h-48 overflow-auto break-words whitespace-pre-wrap text-foreground`,children:e.replace(/\s+$/,``)})]})}var Pe=/^([a-z][a-z0-9+.-]*):/i;function Fe(e,t){let n=e.trim();if(n===``)return{kind:`error`,message:`Type a URL or a port.`};if(/^\d{1,5}$/.test(n)){let e=Number(n);return e<1||e>65535?{kind:`error`,message:`A port is a number from 1 to 65535.`}:t.some(t=>t.port===e)?{kind:`server`,port:e}:{kind:`url`,url:`http://localhost:${e}`}}let r=Pe.exec(n)?.[1]?.toLowerCase();return r&&!/^[a-z0-9.-]+:\d/i.test(n)?r!==`http`&&r!==`https`?{kind:`error`,message:`Only http and https addresses open here.`}:Ie(n):Ie(`http://${n}`)}function Ie(e){let t={kind:`error`,message:`That is not a valid address.`};if(/\s/.test(e))return t;try{new URL(e)}catch{return t}return{kind:`url`,url:e}}function Le(e){return e.replace(/^https?:\/\//i,``)}var Re=`https://github.com/hearsay-tools/squawk#environment-variables`;function ze({state:e,actions:t,url:n,worktree:r}){switch(e.stage){case`chromium-missing`:return(0,X.jsx)(Ue,{state:e,actions:t});case`downloading`:return(0,X.jsx)(Ge,{state:e,actions:t});case`download-failed`:return(0,X.jsx)(Ke,{state:e,actions:t});case`sandbox-failed`:return(0,X.jsx)(qe,{state:e,actions:t});case`browser-exited`:return(0,X.jsx)(Je,{state:e,actions:t});case`needs-approval`:return(0,X.jsx)(Ze,{state:e,actions:t});case`port-held`:return(0,X.jsx)(Qe,{state:e,actions:t});case`server-starting`:return(0,X.jsx)($e,{state:e,actions:t});case`server-stalled`:return(0,X.jsx)(et,{state:e,actions:t});case`server-exited`:return(0,X.jsx)(tt,{state:e,actions:t});case`server-stopped`:return(0,X.jsx)(nt,{state:e,actions:t});case`loading`:return(0,X.jsx)(it,{step:e.step,url:n});case`worktree-removed`:return(0,X.jsx)(at,{state:e,actions:t,worktree:r});case`proxy-blocked`:return(0,X.jsx)(ot,{actions:t});case`taken-over`:return(0,X.jsx)(ct,{state:e,actions:t})}}function Z({icon:e,title:t,children:n,state:r}){return(0,X.jsxs)(`div`,{"data-slot":`preview-state`,"data-state":r,className:`mx-auto flex h-full w-full max-w-[560px] flex-col justify-center gap-4 px-6 py-8`,children:[(0,X.jsx)(`div`,{"aria-hidden":`true`,className:`flex size-9 items-center justify-center rounded-lg bg-muted text-foreground [&_svg]:size-[18px]`,children:e}),(0,X.jsx)(`h2`,{className:`text-xl leading-tight font-semibold text-foreground`,children:t}),n]})}var Q=({children:e})=>(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e}),$=({children:e})=>(0,X.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:e});function Be({server:e}){return(0,X.jsxs)(`p`,{className:`flex items-start gap-2 text-xs text-muted-foreground`,children:[(0,X.jsx)(w,{className:`mt-px size-3.5 shrink-0`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{children:`Runs ${P(e.command)} in this task's worktree, on the host.`})]})}function Ve({copy:e,command:t,label:n}){return(0,X.jsxs)(`div`,{"data-slot":`preview-install-command`,className:`min-w-0 rounded-lg bg-muted px-3.5 py-3`,children:[(0,X.jsxs)(`div`,{className:`mb-1.5 flex items-center justify-between gap-3 text-xs font-semibold tracking-wide text-soft-foreground uppercase`,children:[(0,X.jsx)(`span`,{children:n}),(0,X.jsx)(`button`,{type:`button`,"aria-label":`Copy command`,className:`-m-2 inline-flex size-11 items-center justify-center rounded-sm text-muted-foreground hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none md:m-0 md:size-6`,onClick:()=>e(t),children:(0,X.jsx)(N,{className:`size-4`,"aria-hidden":`true`})})]}),(0,X.jsx)(`code`,{className:`block font-mono text-sm break-words whitespace-pre-wrap text-foreground`,children:t})]})}function He({server:e,status:t}){return(0,X.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-border bg-card px-3.5 py-3 text-sm`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1`,children:[(0,X.jsx)(M,{tone:`neutral`,shape:`ring`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`font-semibold text-foreground`,children:e.label}),(0,X.jsxs)(`span`,{className:`font-mono text-muted-foreground`,children:[`:`,e.port]}),(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:t})]}),(0,X.jsxs)(`div`,{className:`mt-2.5 min-w-0 rounded-md bg-muted px-3 py-2 font-mono text-xs`,children:[(0,X.jsx)(`p`,{className:`break-words whitespace-pre-wrap text-foreground`,children:e.command}),e.cwd?(0,X.jsxs)(`p`,{className:`mt-1 flex gap-3 text-soft-foreground`,children:[(0,X.jsx)(`span`,{children:`cwd`}),(0,X.jsx)(`span`,{className:`break-all`,children:e.cwd})]}):null]}),(0,X.jsx)(`div`,{className:`mt-2.5`,children:(0,X.jsx)(Be,{server:e})})]})}function Ue({state:e,actions:t}){return(0,X.jsxs)(Z,{state:e.stage,icon:(0,X.jsx)(I,{}),title:`This host has no browser yet`,children:[(0,X.jsx)(Q,{children:e.canDownload?`Preview runs Chromium on the machine Squawk runs on. Squawk can download it into ~/.cache/cez/ (about 150 MB). Nothing else on the host changes.`:`Preview runs Chromium on the machine Squawk runs on. Squawk has no download for this platform, so install it with the system package manager.`}),e.canDownload?(0,X.jsx)($,{children:(0,X.jsxs)(T,{variant:`contrast`,onClick:t.download,children:[(0,X.jsx)(I,{"aria-hidden":`true`}),`Download Chromium`]})}):null,(0,X.jsx)(Ve,{command:e.installCommand,copy:t.copy,label:e.canDownload?`Or install it yourself`:`Install it yourself`})]})}function We(e){return Math.round(e/1e6)}function Ge({state:e,actions:t}){let n=(0,Y.useRef)(null);n.current??={at:Date.now(),received:e.received};let r=e.total>0?Math.min(100,Math.floor(e.received/e.total*100)):0,i=(Date.now()-n.current.at)/1e3,a=i>=1?(e.received-n.current.received)/i:0,o=a>0?Math.ceil((e.total-e.received)/a):void 0;return(0,X.jsxs)(Z,{state:e.stage,icon:(0,X.jsx)(I,{}),title:`Downloading Chromium`,children:[(0,X.jsx)(Q,{children:`Into ~/.cache/cez/, no root needed. Nothing else on the host changes.`}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsx)(`div`,{role:`progressbar`,"aria-label":`Chromium download`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":r,className:`h-1.5 overflow-hidden rounded-full bg-muted`,children:(0,X.jsx)(`div`,{className:`h-full rounded-full bg-success`,style:{width:`${r}%`}})}),(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-xs text-muted-foreground`,children:[(0,X.jsx)(`span`,{className:`font-mono`,children:`${We(e.received)} of ${We(e.total)} MB · ${r}%`}),o===void 0?null:(0,X.jsx)(`span`,{children:`about ${o} s left`})]})]}),(0,X.jsx)($,{children:(0,X.jsx)(T,{variant:`outline`,onClick:t.cancelDownload,children:`Cancel`})})]})}function Ke({state:e,actions:t}){return(0,X.jsxs)(Z,{state:e.stage,icon:(0,X.jsx)(q,{className:`text-danger`}),title:`Couldn't download Chromium`,children:[(0,X.jsx)(Q,{children:`${e.error.replace(/\.$/,``)}. Install Chromium with the system package manager, then retry.`}),(0,X.jsx)(Ve,{command:e.installCommand,copy:t.copy,label:`Install it yourself`}),(0,X.jsxs)($,{children:[(0,X.jsxs)(T,{variant:`contrast`,onClick:t.download,children:[(0,X.jsx)(x,{"aria-hidden":`true`}),`Retry download`]}),(0,X.jsxs)(T,{variant:`outline`,onClick:()=>t.copy(`Chromium download failed\n${e.error}\nInstall: ${e.installCommand}`),children:[(0,X.jsx)(N,{"aria-hidden":`true`}),`Copy diagnostics`]})]})]})}function qe({state:e,actions:t}){return(0,X.jsxs)(Z,{state:e.stage,icon:(0,X.jsx)(G,{className:`text-danger`}),title:`Chromium couldn't start its sandbox`,children:[(0,X.jsx)(Q,{children:`The host blocks the sandbox Chromium needs. This usually means Squawk runs as root, or inside a container without user namespaces.`}),(0,X.jsx)(Ne,{text:e.stderrTail,source:`chromium`,onCopy:t.copy}),(0,X.jsxs)($,{children:[(0,X.jsxs)(T,{variant:`contrast`,onClick:t.retryBrowser,children:[(0,X.jsx)(x,{"aria-hidden":`true`}),`Retry`]}),(0,X.jsxs)(T,{variant:`outline`,onClick:()=>t.copy(`Chromium failed to start its sandbox\n${e.stderrTail}`),children:[(0,X.jsx)(N,{"aria-hidden":`true`}),`Copy diagnostics`]})]}),(0,X.jsx)(`a`,{className:`text-sm font-medium text-accent-text underline-offset-2 hover:underline`,href:Re,target:`_blank`,rel:`noopener noreferrer`,children:`Docs: running without the sandbox (CEZ_PREVIEW_NO_SANDBOX=1)`})]})}function Je({state:e,actions:t}){let n=e.reason===`timeout`,r=e.signal?` (${e.signal})`:e.exitCode===void 0?``:` (code ${e.exitCode})`,i=e.serverUp?`The dev server is still up; only the browser needs a restart.`:`The browser needs a restart.`,a=n?`Chromium did not start in time`:`Chromium exited${r}`;return(0,X.jsxs)(Z,{state:e.stage,icon:(0,X.jsx)(h,{className:`text-danger`}),title:n?`The browser did not start`:`The browser stopped`,children:[(0,X.jsx)(Q,{children:n?`Chromium did not open its DevTools port in time. ${i}`:`Chromium exited unexpectedly${r}. ${i}`}),(0,X.jsx)(Ne,{text:e.stderrTail,source:`chromium`,onCopy:t.copy}),(0,X.jsxs)($,{children:[(0,X.jsxs)(T,{variant:`contrast`,onClick:t.retryBrowser,children:[(0,X.jsx)(x,{"aria-hidden":`true`}),`Retry`]}),(0,X.jsxs)(T,{variant:`outline`,onClick:()=>t.copy(`${a}\n${e.stderrTail}`),children:[(0,X.jsx)(N,{"aria-hidden":`true`}),`Copy diagnostics`]})]})]})}var Ye=2;function Xe(e){let[t,n]=(0,Y.useState)(()=>Date.now());return(0,Y.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}function Ze({state:e,actions:t}){let{server:n,wasRunning:r}=e;return(0,X.jsxs)(Z,{state:e.stage,icon:r?(0,X.jsx)(J,{className:`text-pending-strong`}):(0,X.jsx)(b,{}),title:r?`Nothing answers on :${n.port} anymore`:`${n.label} isn't running yet`,children:[(0,X.jsx)(Q,{children:r?`${n.label} was running when the agent registered it, likely inside the agent's own session, which has ended. Squawk can start it with the registered command.`:`The agent registered this server. Nothing runs until you approve it here.`}),(0,X.jsx)(He,{server:n,status:r?`was running when registered · silent now`:`registered · not started`}),(0,X.jsx)($,{children:(0,X.jsxs)(T,{variant:`contrast`,onClick:()=>t.run(n.port),children:[(0,X.jsx)(b,{"aria-hidden":`true`}),`Run and open`]})})]})}function Qe({state:e,actions:t}){let{server:n,ownerTitle:r}=e;return(0,X.jsxs)(Z,{state:e.stage,icon:(0,X.jsx)(q,{className:`text-pending-strong`}),title:`${n.label} :${n.port} is in use by another task`,children:[(0,X.jsx)(Q,{children:`Task "${r}" is running its own server on :${n.port}. Register a different port for this task, or stop that task's server.`}),(0,X.jsx)($,{children:(0,X.jsx)(T,{variant:`contrast`,onClick:t.close,children:`Close preview`})})]})}function $e({state:e,actions:t}){let{server:n}=e,r=Xe(1e3),i=Math.max(0,Math.floor((r-Date.parse(e.startedAt))/1e3)),[a,o]=(0,Y.useState)(()=>Date.now());(0,Y.useEffect)(()=>o(Date.now()),[e.attempt]);let s=Math.max(0,Math.ceil(Ye-(r-a)/1e3));return(0,X.jsxs)(Z,{state:e.stage,icon:(0,X.jsx)(b,{}),title:`Starting ${n.label}`,children:[(0,X.jsx)(Q,{children:`Squawk ran ${P(n.command)} in the worktree. The page opens as soon as :${n.port} answers.`}),(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg border border-border px-3.5 py-3 text-sm`,children:[(0,X.jsxs)(`span`,{className:`flex items-center gap-2.5 font-semibold text-foreground`,children:[(0,X.jsx)(y,{className:`size-4 animate-spin text-success motion-reduce:animate-none`,"aria-hidden":`true`}),s>0?`Attempt ${e.attempt} · next try in ${s} s`:`Attempt ${e.attempt}`]}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`started ${i} s ago`})]}),e.logTail.length>0?(0,X.jsx)(Ne,{text:e.logTail.join(`
|
|
3
|
+
`),source:P(n.command),onCopy:t.copy}):null,(0,X.jsx)($,{children:(0,X.jsx)(T,{variant:`outline`,onClick:()=>t.stop(n.port),children:`Stop server`})})]})}function et({state:e,actions:t}){let{server:n}=e;return(0,X.jsxs)(Z,{state:e.stage,icon:(0,X.jsx)(z,{className:`text-pending-strong`}),title:`${n.label} is running, but :${n.port} is silent`,children:[(0,X.jsx)(Q,{children:`The process has run for 2 min without opening the port. It may be waiting on another service, or listening somewhere else.`}),(0,X.jsx)(Ne,{text:e.logTail,source:P(n.command),onCopy:t.copy}),(0,X.jsxs)($,{children:[(0,X.jsx)(T,{variant:`contrast`,onClick:()=>t.keepWaiting(n.port),children:`Keep waiting`}),(0,X.jsx)(T,{variant:`outline`,onClick:()=>t.stop(n.port),children:`Stop server`})]})]})}function tt({state:e,actions:t}){let{server:n}=e;return(0,X.jsxs)(Z,{state:e.stage,icon:(0,X.jsx)(h,{className:`text-danger`}),title:e.exitCode===null?`${n.label} was stopped by a signal`:`${n.label} exited with code ${e.exitCode}`,children:[(0,X.jsx)(Q,{children:`${P(n.command)} stopped.`}),(0,X.jsx)(Ne,{text:e.logTail,source:P(n.command),onCopy:t.copy}),(0,X.jsx)($,{children:(0,X.jsxs)(T,{variant:`contrast`,onClick:()=>t.run(n.port),children:[(0,X.jsx)(x,{"aria-hidden":`true`}),`Start again`]})}),(0,X.jsx)(Be,{server:n})]})}function nt({state:e,actions:t}){let{server:n}=e,r=e.reason===`idle`;return(0,X.jsxs)(Z,{state:e.stage,icon:(0,X.jsx)(te,{}),title:r?`Stopped after 15 min idle`:`${n.label} stopped`,children:[(0,X.jsx)(Q,{children:r?`Nobody had this pane open for 15 min, so Squawk stopped ${n.label} :${n.port} and the browser to free memory. Start again reopens ${Le(e.lastUrl)}.`:`You stopped ${n.label} :${n.port}. Start again reopens ${Le(e.lastUrl)}.`}),(0,X.jsx)($,{children:(0,X.jsxs)(T,{variant:`contrast`,onClick:()=>t.run(n.port),children:[(0,X.jsx)(x,{"aria-hidden":`true`}),`Start again`]})}),(0,X.jsx)(Be,{server:n})]})}var rt=[`browser`,`page`,`frame`];function it({step:e,url:t}){let n=rt.indexOf(e),r=t?Le(t):`the page`;return(0,X.jsx)(`div`,{"data-slot":`preview-state`,"data-state":`loading`,className:`mx-auto flex h-full w-full max-w-[560px] flex-col justify-center px-6 py-8`,children:(0,X.jsx)(`ol`,{"aria-label":`Opening the page`,className:`mx-auto flex flex-col gap-4 text-sm`,children:[{done:`Browser started`,active:`Starting the browser`},{done:`Opened ${r}`,active:`Opening ${r}`},{done:`First frame`,active:`First frame`}].map((e,t)=>{let r=t<n,i=t===n;return(0,X.jsxs)(`li`,{"aria-current":i?`step`:void 0,className:l(`flex items-center gap-3`,i?`font-semibold text-foreground`:r?`text-foreground`:`text-soft-foreground`),children:[r?(0,X.jsx)(m,{className:`size-5 text-success`,"aria-hidden":`true`}):i?(0,X.jsx)(y,{className:`size-5 animate-spin text-success motion-reduce:animate-none`,"aria-hidden":`true`}):(0,X.jsx)(Ce,{className:`size-5 text-border`,"aria-hidden":`true`}),r?e.done:i?e.active:e.done]},t)})})})}function at({state:e,actions:t,worktree:n}){let r=n?/\.ai\/(?:cezar|squawk)\/worktrees\/[^/]+/.exec(n)?.[0]:void 0,i=e.server?.label;return(0,X.jsxs)(Z,{state:e.stage,icon:(0,X.jsx)(we,{}),title:`This task's worktree is gone`,children:[(0,X.jsx)(Q,{children:`${i??`The server`} ran in ${r??`this task's worktree`}, which has been removed. There is nothing left to start.`}),e.server?(0,X.jsx)(xe,{entry:{kind:`preview-server`,id:`preview-server:${e.server.port}`,server:e.server,state:`unavailable`},inPreview:!1}):null,(0,X.jsx)($,{children:(0,X.jsx)(T,{variant:`outline`,onClick:t.close,children:`Close preview`})})]})}function ot({actions:e}){return(0,X.jsxs)(`div`,{"data-slot":`preview-state`,"data-state":`proxy-blocked`,className:`mx-auto flex h-full w-full max-w-[560px] flex-col justify-center gap-4 px-6 py-8`,children:[(0,X.jsx)(`div`,{children:(0,X.jsx)(Me,{})}),(0,X.jsx)(`div`,{"aria-hidden":`true`,className:`flex size-9 items-center justify-center rounded-lg bg-muted text-foreground [&_svg]:size-[18px]`,children:(0,X.jsx)(H,{})}),(0,X.jsx)(`h2`,{className:`text-xl leading-tight font-semibold text-foreground`,children:`Preview doesn't work behind this proxy yet`}),(0,X.jsx)(Q,{children:`The proxy in front of Squawk didn't let the preview's WebSocket through. This is a known gap behind Basic Auth. Everything else in Squawk keeps working.`}),(0,X.jsxs)($,{children:[(0,X.jsx)(T,{variant:`outline`,onClick:e.close,children:`Close preview`}),(0,X.jsx)(`a`,{className:`inline-flex min-h-11 items-center text-sm font-medium text-accent-text underline-offset-2 hover:underline`,href:Re,target:`_blank`,rel:`noopener noreferrer`,children:`Which setups work`})]})]})}function st(e){let t=/iPhone/.test(e)?`iPhone`:/iPad/.test(e)?`iPad`:/Android/.test(e)?`Android`:/Windows/.test(e)?`Windows`:/Mac OS X|Macintosh/.test(e)?`Mac`:/Linux|X11/.test(e)?`Linux`:``,n=/Edg\//.test(e)?`Edge`:/Firefox\/|FxiOS/.test(e)?`Firefox`:/Chrome\/|CriOS/.test(e)?`Chrome`:/Safari\//.test(e)?`Safari`:``;return n&&t?`${n} on ${t}`:n||t}function ct({state:e,actions:t}){let n=st(e.by);return(0,X.jsxs)(Z,{state:e.stage,icon:(0,X.jsx)(V,{}),title:`Preview is open somewhere else`,children:[(0,X.jsx)(Q,{children:`Another tab took this browser${n?` (${n})`:``}. Only one tab can view and drive it at a time.`}),(0,X.jsxs)($,{children:[(0,X.jsxs)(T,{variant:`contrast`,onClick:t.useHere,children:[(0,X.jsx)(I,{"aria-hidden":`true`}),`Use it here`]}),(0,X.jsx)(T,{variant:`outline`,onClick:t.close,children:`Close preview`})]})]})}function lt({attempt:e,exhausted:t,onReconnect:n}){return(0,X.jsxs)(`div`,{"data-slot":`preview-connection-banner`,role:`status`,className:`absolute inset-x-3 top-3 z-10 flex flex-wrap items-center justify-between gap-x-3 gap-y-2 rounded-lg border border-border bg-card px-3.5 py-2.5 text-sm shadow-sm`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,X.jsx)(De,{className:`size-4 shrink-0 text-danger`,"aria-hidden":`true`}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`strong`,{className:`font-semibold text-foreground`,children:`Lost the connection to the host`}),t?null:(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:` · reconnecting (attempt ${e} of 5)`})]})]}),(0,X.jsx)(T,{variant:`outline`,onClick:n,children:t?`Reconnect`:`Reconnect now`})]})}function ut({servers:e,states:t,onOpen:n,agentLive:r=!1,agentIdle:i=!1,onOpenAgent:a}){return(0,X.jsxs)(`div`,{"data-slot":`preview-state`,"data-state":i?`agent-idle`:`empty`,className:`mx-auto flex h-full w-full max-w-[560px] flex-col justify-center gap-4 px-6 py-8`,children:[(0,X.jsx)(`h2`,{className:`text-xl leading-tight font-semibold text-foreground`,children:`Open a page in this task's browser`}),(0,X.jsx)(Q,{children:`The browser runs on the host, next to the worktree. Type a URL, a bare port such as 3000, or open a server the agent registered.`}),i?(0,X.jsxs)(`p`,{role:`status`,className:`flex items-start gap-2 text-sm text-foreground`,children:[(0,X.jsx)(J,{className:`mt-0.5 size-4 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{children:`The agent is not driving the browser now.`})]}):null,r&&a!==void 0?(0,X.jsxs)(`section`,{"aria-labelledby":`preview-agent`,className:`overflow-hidden rounded-lg border border-border bg-card`,children:[(0,X.jsx)(`h3`,{id:`preview-agent`,className:`border-b border-border px-3.5 py-2.5 text-xs font-semibold tracking-wide text-soft-foreground uppercase`,children:`Driven by the agent`}),(0,X.jsxs)(`div`,{"data-slot":`preview-agent-entry`,className:`flex items-center justify-between gap-3 px-3.5 py-2 text-sm`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-2.5 gap-y-0.5`,children:[(0,X.jsx)(M,{tone:`success`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`font-semibold text-foreground`,children:`Agent's page`}),(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`The agent drives this page through agent-browser.`})]}),(0,X.jsx)(T,{variant:`outline`,size:`sm`,"aria-label":`Open the agent's page`,onClick:a,children:`Open`})]})]}):null,e.length>0?(0,X.jsxs)(`section`,{"aria-labelledby":`preview-registered`,className:`overflow-hidden rounded-lg border border-border bg-card`,children:[(0,X.jsx)(`h3`,{id:`preview-registered`,className:`border-b border-border px-3.5 py-2.5 text-xs font-semibold tracking-wide text-soft-foreground uppercase`,children:`Registered in this task`}),(0,X.jsx)(`ul`,{children:e.map(e=>{let r=ge(e,t),i=me(r);return(0,X.jsxs)(`li`,{className:`flex items-center justify-between gap-3 border-b border-border px-3.5 py-2 text-sm last:border-b-0`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-2.5 gap-y-0.5`,children:[(0,X.jsx)(M,{tone:i.tone,shape:i.ring?`ring`:`filled`,pulse:i.pulse,"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`font-semibold text-foreground`,children:e.label}),(0,X.jsxs)(`span`,{className:`font-mono text-muted-foreground`,children:[`:`,e.port]}),(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:i.text})]}),(0,X.jsx)(T,{variant:`outline`,size:`sm`,onClick:()=>n(e.port),children:de(r)?`Open`:`Review`})]},e.port)})})]}):null,(0,X.jsxs)(`p`,{className:`flex items-start gap-2 text-xs text-muted-foreground`,children:[(0,X.jsx)(v,{className:`mt-px size-3.5 shrink-0`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{children:`Review opens a server's approval in this pane: its command, cwd and Run and open. Nothing runs from this list. Paste works; copying text out, file pickers and downloads don't yet.`})]})]})}function dt({dialog:e,onResult:t}){let[n,r]=(0,Y.useState)(e.defaultPrompt??``),i=e.type===`beforeunload`,a=(0,Y.useRef)(null),o=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{(e.type===`prompt`?o.current:a.current)?.focus()},[e.type]);let s=(0,Y.useRef)(t);s.current=t,(0,Y.useEffect)(()=>{let e=e=>{if(e.key!==`Escape`||e.defaultPrevented)return;let t=e.target instanceof Element?e.target:null;t&&t!==document.body&&!t.closest(`[data-slot="preview-pane-body"], [data-slot="preview-page-dialog"]`)||(e.stopPropagation(),s.current({accept:!1}))};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[]);let c=()=>t(e.type===`prompt`?{accept:!0,text:n}:{accept:!0});return(0,X.jsx)(`div`,{"data-slot":`preview-page-dialog`,className:`absolute inset-0 z-20 flex items-center justify-center bg-foreground/30 p-4`,children:(0,X.jsxs)(`div`,{role:`alertdialog`,"aria-modal":`true`,"aria-label":`${e.origin} says`,className:`w-full max-w-[380px] rounded-xl border border-card-edge bg-card p-4 shadow-modal`,children:[(0,X.jsx)(`p`,{className:`mb-3 truncate font-mono text-xs text-muted-foreground`,children:`${e.origin} says`}),(0,X.jsx)(`p`,{className:`mb-4 text-sm break-words whitespace-pre-wrap text-foreground`,children:e.message||(i?`Changes you made may not be saved.`:``)}),e.type===`prompt`?(0,X.jsx)(`input`,{ref:o,value:n,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&c()},className:`mb-4 h-11 w-full rounded-md border border-border bg-background px-3 text-sm outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`}):null,(0,X.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[e.type===`alert`?null:(0,X.jsx)(T,{variant:`outline`,onClick:()=>t({accept:!1}),children:i?`Stay`:`Cancel`}),(0,X.jsx)(T,{ref:a,variant:`contrast`,onClick:c,children:i?`Leave`:`OK`})]})]})})}var ft=10,pt=500,mt=500,ht=4,gt=16,_t=e=>!!e.altKey|(e.ctrlKey?2:0)|(e.metaKey?4:0)|(e.shiftKey?8:0);function vt(e,t,n,r){return{x:Math.round((e-n.left)/r),y:Math.round((t-n.top)/r)}}function yt(e,t){return{rect:e,scale:t,touches:new Map,multiTouch:!1,click:{at:-1/0,x:0,y:0,button:-1,count:1}}}var bt=[`left`,`middle`,`right`];function xt(e,t,n,r){let i=vt(n.clientX,n.clientY,t.rect,t.scale);return{t:`mouse`,type:e,x:i.x,y:i.y,button:bt[n.button]??`none`,buttons:n.buttons,clickCount:1,modifiers:_t(n),...r}}var St=e=>e===0?0:-e;function Ct(e,t,n,r,i){let a=vt(t,n,e.rect,e.scale);return{t:`mouse`,type:`mouseWheel`,x:a.x,y:a.y,button:`none`,buttons:0,deltaX:St(r/e.scale),deltaY:St(i/e.scale),modifiers:0}}function wt(e,t){let{touches:n}=t,r=n.get(e.pointerId),i=()=>{n.delete(e.pointerId),n.size===0&&(t.multiTouch=!1)};switch(e.type){case`pointerdown`:return n.set(e.pointerId,{startX:e.clientX,startY:e.clientY,startAt:e.timeStamp,lastX:e.clientX,lastY:e.clientY,scrolling:!1}),n.size>1&&(t.multiTouch=!0),[];case`pointermove`:{if(!r)return[];if(t.multiTouch)return r.lastX=e.clientX,r.lastY=e.clientY,[];if(!r.scrolling){if(Math.hypot(e.clientX-r.startX,e.clientY-r.startY)<=ft)return[];r.scrolling=!0}let n=e.clientX-r.lastX,i=e.clientY-r.lastY;return r.lastX=e.clientX,r.lastY=e.clientY,n===0&&i===0?[]:[Ct(t,e.clientX,e.clientY,n,i)]}case`pointerup`:{let n=r!==void 0&&!t.multiTouch&&!r.scrolling&&e.timeStamp-r.startAt<=pt;if(i(),!n||!r)return[];let a={...e,clientX:r.startX,clientY:r.startY};return[xt(`mouseMoved`,t,a,{button:`none`,buttons:0}),xt(`mousePressed`,t,a,{button:`left`,buttons:1}),xt(`mouseReleased`,t,a,{button:`left`,buttons:0})]}case`pointercancel`:return i(),[]}}function Tt(e,t){if(e.pointerType===`touch`)return wt(e,t);switch(e.type){case`pointerdown`:{let n=t.click,r=n.button===e.button&&e.timeStamp-n.at<=mt&&Math.hypot(e.clientX-n.x,e.clientY-n.y)<=ht;return t.click={at:e.timeStamp,x:e.clientX,y:e.clientY,button:e.button,count:r?n.count+1:1},[xt(`mousePressed`,t,e,{clickCount:t.click.count})]}case`pointermove`:return[xt(`mouseMoved`,t,e,{button:e.buttons&1?`left`:`none`})];case`pointerup`:return[xt(`mouseReleased`,t,e,{clickCount:t.click.count})];case`pointercancel`:return[]}}function Et(e,t,n){let r=vt(e.clientX,e.clientY,t,n),i=e.deltaMode===1?gt:1;return{t:`mouse`,type:`mouseWheel`,x:r.x,y:r.y,button:`none`,buttons:e.buttons??0,deltaX:e.deltaX*i/n,deltaY:e.deltaY*i/n,modifiers:_t(e)}}var Dt={a:`selectAll`,c:`copy`,x:`cut`,z:`undo`,y:`redo`};function Ot(e){let t=e.key.toLowerCase(),n=(e.ctrlKey||e.metaKey)&&!e.getModifierState?.(`AltGraph`);if(n&&(t===`v`||t===`k`))return;let r={t:`key`,key:e.key,code:e.code,modifiers:_t(e),vk:e.keyCode};if(e.type===`keyup`)return{...r,type:`keyUp`};let i=n?``:e.key.length===1?e.key:e.key===`Enter`?`\r`:e.key===`Tab`?` `:``,a=n?t===`z`&&e.shiftKey?`redo`:Dt[t]:void 0,o={t:`key`,type:i?`keyDown`:`rawKeyDown`,key:e.key,code:e.code,text:i,modifiers:_t(e),vk:e.keyCode};return a?{...o,commands:[a]}:o}function kt(e){return e?{t:`insertText`,text:e}:void 0}var At=e=>e,jt=e=>e.key===`Escape`&&e.shiftKey&&!e.ctrlKey&&!e.metaKey&&!e.altKey;function Mt({scale:e,send:t,onLeave:n}){let r=(0,Y.useRef)(null),i=(0,Y.useRef)(yt({left:0,top:0},e)),a=(0,Y.useRef)(e);a.current=e;let o=(0,Y.useRef)(t);o.current=t;let s=(0,Y.useRef)(void 0),c=()=>{let e=r.current;e&&(i.current.rect=e.getBoundingClientRect()),i.current.scale=a.current},l=e=>{c();for(let t of Tt(At(e),i.current))o.current(t)},u=()=>{let e=s.current;e&&(s.current=void 0,cancelAnimationFrame(e.frame),l(e.event))};(0,Y.useEffect)(()=>()=>{s.current&&cancelAnimationFrame(s.current.frame)},[]),(0,Y.useEffect)(()=>{document.activeElement===document.body&&r.current?.focus({preventScroll:!0})},[]),(0,Y.useEffect)(()=>{let e=r.current;if(!e)return;let t=e=>{e.preventDefault(),c(),o.current(Et(e,i.current.rect,i.current.scale))};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[]),(0,Y.useEffect)(()=>{let e=e=>{if(document.activeElement!==r.current)return;let t=kt(e.clipboardData?.getData(`text`)??``);t&&(e.preventDefault(),o.current(t))};return document.addEventListener(`paste`,e),()=>document.removeEventListener(`paste`,e)},[]);let d=e=>{u(),r.current?.focus({preventScroll:!0});try{r.current?.setPointerCapture(e.pointerId)}catch{}l(e.nativeEvent)},f=e=>{let t=e.nativeEvent;if(t.pointerType===`touch`)return l(t);let n=s.current;if(n){n.event=t;return}s.current={event:t,frame:requestAnimationFrame(()=>{let e=s.current;s.current=void 0,e&&l(e.event)})}},p=e=>{u(),l(e.nativeEvent)},m=e=>{if(jt(e)){e.preventDefault(),e.stopPropagation(),e.type===`keydown`&&(n?n():r.current?.blur());return}let i=Ot(e.nativeEvent);i&&(e.preventDefault(),e.stopPropagation(),t(i))};return(0,X.jsx)(`div`,{ref:r,"data-slot":`preview-input`,role:`application`,"aria-label":`Page preview, interactive`,"aria-description":`Keys go to the page, Tab included. Press Shift+Escape to return to the cockpit.`,tabIndex:0,onPointerDown:d,onPointerMove:f,onPointerUp:p,onPointerCancel:p,onContextMenu:e=>e.preventDefault(),onKeyDown:m,onKeyUp:m,className:`absolute inset-0 touch-none select-none outline-none focus-visible:ring-2 focus-visible:ring-ring/60 focus-visible:ring-inset`})}async function Nt(e){if(typeof createImageBitmap==`function`){let t=await createImageBitmap(e);return{source:t,width:t.width,height:t.height,release:()=>t.close()}}let t=URL.createObjectURL(e),n=new Image;return n.src=t,await n.decode(),{source:n,width:n.naturalWidth,height:n.naturalHeight,release:()=>URL.revokeObjectURL(t)}}function Pt({ref:e,viewport:t,dimmed:n=!1,cursor:r,onSize:i,renderInput:a,children:o}){let c=(0,Y.useRef)(0),u=(0,Y.useRef)(null),d=(0,Y.useRef)(null),[f,p]=(0,Y.useState)(null),m=(0,Y.useRef)(i);m.current=i,(0,Y.useImperativeHandle)(e,()=>({async draw(e){let t=++c.current,n=d.current,r=n?.getContext(`2d`);if(!(!n||!r||!s()))try{let i=await Nt(e);try{if(t!==c.current||!s()||d.current!==n)return;n.width!==i.width&&(n.width=i.width),n.height!==i.height&&(n.height=i.height),r.drawImage(i.source,0,0)}finally{i.release()}}catch{}}}),[]),(0,Y.useEffect)(()=>{let e=u.current;if(!e)return;let t=()=>{let t=Math.round(e.clientWidth),n=Math.round(e.clientHeight);t===0||n===0||(p(e=>e&&e.w===t&&e.h===n?e:{w:t,h:n}),m.current?.({w:t,h:n}))};if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let h=t===`fit`?f:t,g=t===`fit`||!f?1:Math.min(1,(f.w-24)/t.w,(f.h-24)/t.h),_=h?{width:Math.floor(h.w*g),height:Math.floor(h.h*g)}:void 0;return(0,X.jsxs)(`div`,{ref:u,"data-slot":`preview-stage`,"data-viewport":t===`fit`?`fit`:`${t.w}x${t.h}`,className:l(`relative min-h-0 flex-1 overflow-hidden bg-muted`,t!==`fit`&&`flex items-start justify-center overflow-auto p-3`),children:[h?(0,X.jsxs)(`div`,{"data-slot":`preview-surface`,"data-scale":g,style:{..._,cursor:r},className:l(`relative shrink-0 bg-card`,t!==`fit`&&`shadow-md`,n&&`opacity-60 saturate-50`),children:[(0,X.jsx)(`canvas`,{ref:d,"aria-label":`Page preview`,role:`img`,style:_,className:`block touch-none select-none`}),a?.({canvas:d.current,scale:g,viewport:h})]}):null,o]})}var Ft=`cez-preview-quality`,It=[{value:`normal`,label:`Normal`,detail:`The default. Lighter on CPU and network.`},{value:`high`,label:`High`,detail:`Sharper text and fine detail. Uses more CPU and network.`},{value:`ultra`,label:`Ultra`,detail:`High at your screen's pixel density, up to 2×. Uses the most CPU and network.`}];function Lt(e){return It.find(t=>t.value===e)?.value??`normal`}var Rt=e=>It.find(t=>t.value===e)?.label??`Normal`;function zt(){try{return Lt(localStorage.getItem(Ft))}catch{return`normal`}}function Bt(e){try{localStorage.setItem(Ft,e)}catch{}}var Vt=[{w:390,h:844,icon:_},{w:820,h:1180,icon:K},{w:1440,h:900,icon:ee}],Ht=`shrink-0`,Ut=e=>e===`fit`?`Fit`:`${e.w} × ${e.h}`;function Wt(e){let[t,n]=(0,Y.useState)(()=>Date.now());return(0,Y.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}var Gt=e=>`${e.fps} fps · ${e.kbps} KB/s${e.rttMs===void 0?``:` · ${e.rttMs} ms`}`;function Kt({stats:e,shrunk:t}){let n=Wt(250),r=e.lastFrameAt===void 0||n-e.lastFrameAt>=1e3;return t?(0,X.jsx)(M,{"data-slot":`preview-stats`,tone:r?`neutral`:`success`,"aria-label":`Preview is live`,role:`img`}):(0,X.jsxs)(`span`,{"data-slot":`preview-stats`,role:`img`,"aria-label":r?`idle`:Gt(e),className:`flex shrink-0 items-center gap-1.5 font-mono text-xs whitespace-nowrap text-muted-foreground`,children:[(0,X.jsx)(M,{tone:r?`neutral`:`success`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`hidden @min-[960px]:inline-block w-[28ch] overflow-hidden text-ellipsis`,children:r?`idle`:Gt(e)})]})}function qt({current:e,agentShown:t,...n}){let r=e?e.label:t?`Agent's page`:`Server`;return(0,X.jsxs)(T,{variant:`outline`,size:`sm`,className:`max-w-[9rem] min-w-0 gap-1.5 @min-[760px]:max-w-[11rem]`,"aria-label":e?`Server: ${e.label} :${e.port}`:t?`Server: ${r}`:`Server`,...n,children:[e||t?(0,X.jsx)(M,{tone:`neutral`,shape:`ring`,"aria-hidden":`true`}):(0,X.jsx)(C,{"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`truncate`,children:r}),e?(0,X.jsxs)(`span`,{className:`font-mono font-normal text-muted-foreground`,children:[`:`,e.port]}):null,(0,X.jsx)(p,{className:`size-3.5 text-muted-foreground`,"aria-hidden":`true`})]})}function Jt({shown:e,live:t,onSelect:n}){return(0,X.jsxs)(D,{className:`min-h-11 gap-2.5 md:min-h-0`,"aria-current":e||void 0,onSelect:n,children:[(0,X.jsx)(M,{tone:t?`success`:`neutral`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`font-semibold`,children:`Agent's page`}),(0,X.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground`,children:`agent-browser`}),e?(0,X.jsx)(f,{className:`size-4`,"aria-hidden":`true`}):null]})}function Yt(e,t){return e?`${e.label} :${e.port}`:t?`Agent's page`:`Preview`}function Xt(e){let t=e.onPickAgent!==void 0,n=e.agentLive===!0&&t,r=e.agentShown===!0;return{agentLive:n,agentShown:r,agentListed:n||r&&t}}function Zt(e){let{compact:t=!1,navEnabled:n,loading:r=!1}=e,i=(0,Y.useRef)(null),a=e.urlInputRef??i,o=(0,Y.useRef)(!1),[s,c]=(0,Y.useState)(null),[l,u]=(0,Y.useState)(!1),f=(0,X.jsx)(T,{variant:`ghost`,size:`icon-sm`,className:Ht,"aria-label":`Back`,disabled:!n,onClick:e.onBack,children:(0,X.jsx)(F,{"aria-hidden":`true`})}),p=(0,X.jsx)(T,{variant:`ghost`,size:`icon-sm`,className:Ht,"aria-label":`Forward`,disabled:!n,onClick:e.onForward,children:(0,X.jsx)(d,{"aria-hidden":`true`})}),m=(0,X.jsx)(T,{variant:`ghost`,size:`icon-sm`,className:Ht,"aria-label":`Reload`,"aria-busy":r||void 0,disabled:!n||r,onClick:()=>e.onReload(!1),children:(0,X.jsx)(W,{"aria-hidden":`true`})}),h=e.onSession?(0,X.jsxs)(T,{variant:`outline`,size:`sm`,className:`shrink-0 gap-1`,onClick:e.onSession,children:[(0,X.jsx)(ve,{"aria-hidden":`true`}),`Session`]}):null,g=r?(0,X.jsx)(`div`,{role:`progressbar`,"aria-label":`Loading the page`,className:`absolute inset-x-0 bottom-0 h-0.5 overflow-hidden bg-transparent`,children:(0,X.jsx)(`div`,{className:`preview-progress h-full w-2/5 bg-success`})}):null,_=(0,X.jsx)($t,{props:e,input:a,draft:s,setDraft:c,focused:l,setFocused:u}),{agentListed:v}=Xt(e),y=e.servers.length+ +!!v>=2,ee=y||e.adopted,te={back:f,forward:p,reload:m,address:_,more:(0,X.jsx)(an,{props:e,compact:t}),session:h,progress:g};return t?(0,X.jsx)(on,{props:e,elements:te}):(0,X.jsx)(sn,{props:e,elements:te,switcher:y,crowded:ee,input:a,focusUrlAfterMenu:o})}function Qt({props:e,input:t,focusUrlAfterMenu:n}){let{servers:r,current:i}=e,{agentLive:a,agentShown:o,agentListed:s}=Xt(e);return(0,X.jsxs)(j,{children:[(0,X.jsx)(k,{asChild:!0,children:(0,X.jsx)(qt,{current:i,agentShown:o})}),(0,X.jsxs)(A,{align:`start`,className:`min-w-64`,onCloseAutoFocus:e=>{n.current&&(n.current=!1,e.preventDefault(),t.current?.focus())},children:[s?(0,X.jsx)(Jt,{shown:o,live:a,onSelect:()=>e.onPickAgent?.()}):null,r.map(t=>{let n=me(ge(t,e.serverStates));return(0,X.jsxs)(D,{className:`min-h-11 gap-2.5 md:min-h-0`,"aria-current":i?.port===t.port||void 0,onSelect:()=>e.onPickServer(t.port),children:[(0,X.jsx)(M,{tone:n.tone,shape:n.ring?`ring`:`filled`,pulse:n.pulse,"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`font-semibold`,children:t.label}),(0,X.jsxs)(`span`,{className:`font-mono text-muted-foreground`,children:[`:`,t.port]}),(0,X.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground`,children:n.text}),i?.port===t.port?(0,X.jsx)(f,{className:`size-4`,"aria-hidden":`true`}):null]},t.port)}),(0,X.jsx)(O,{}),(0,X.jsxs)(D,{className:`min-h-11 gap-2.5 md:min-h-0`,onSelect:()=>{n.current=!0},children:[(0,X.jsx)(g,{"aria-hidden":`true`}),`Type a URL instead`]})]})]})}function $t({props:e,input:t,draft:n,setDraft:r,focused:i,setFocused:a}){let{url:o,adopted:s}=e;return(0,X.jsxs)(`div`,{className:`relative flex min-w-20 flex-1 items-center`,children:[(0,X.jsx)(g,{className:`pointer-events-none absolute left-2.5 size-4 text-muted-foreground`,"aria-hidden":`true`}),(0,X.jsx)(`input`,{ref:t,type:`text`,"aria-label":`Page address`,placeholder:`Type a URL or a port`,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,value:n??(i?o:Le(o)),title:o||void 0,className:l(`h-8 w-full min-w-0 truncate rounded-md border border-transparent bg-muted pl-8 font-mono text-[13px] text-foreground outline-none placeholder:text-soft-foreground focus-visible:border-ring focus-visible:bg-background focus-visible:ring-[3px] focus-visible:ring-ring/30 max-md:h-11`,s?`pr-40`:`pr-2.5`),onFocus:e=>{let t=e.currentTarget;a(!0),requestAnimationFrame(()=>{document.activeElement===t&&t.select()})},onBlur:()=>{a(!1),r(null)},onChange:e=>r(e.target.value),onKeyDown:t=>{t.key===`Enter`?(e.onNavigate(n??o),t.currentTarget.blur()):t.key===`Escape`&&t.currentTarget.blur()}}),s&&!i?(0,X.jsxs)(`span`,{className:`pointer-events-none absolute right-2 inline-flex h-6 items-center gap-1 rounded-full border border-border bg-card px-2 text-xs font-semibold text-muted-foreground`,children:[(0,X.jsx)(Te,{className:`size-3`,"aria-hidden":`true`}),`Not started by Squawk`]}):null]})}function en({props:e}){let{viewport:t}=e;return(0,X.jsxs)(j,{children:[(0,X.jsx)(k,{asChild:!0,children:(0,X.jsxs)(T,{variant:`outline`,size:`sm`,className:`shrink-0 gap-1.5`,"aria-label":`Viewport size: ${Ut(t)}`,children:[t===`fit`?(0,X.jsx)(B,{"aria-hidden":`true`}):(0,X.jsx)(ee,{"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:l(`hidden @min-[620px]:inline`,t!==`fit`&&`font-mono font-normal`),children:Ut(t)}),(0,X.jsx)(p,{className:`size-3.5 text-muted-foreground`,"aria-hidden":`true`})]})}),(0,X.jsxs)(A,{align:`start`,className:`min-w-56`,children:[(0,X.jsxs)(D,{className:`gap-2.5`,"aria-current":t===`fit`||void 0,onSelect:()=>e.onViewport(`fit`),children:[(0,X.jsx)(B,{"aria-hidden":`true`}),`Fit`,(0,X.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground`,children:`pane size`}),t===`fit`?(0,X.jsx)(f,{className:`size-4`,"aria-hidden":`true`}):null]}),Vt.map(({w:n,h:r,icon:i})=>(0,X.jsxs)(D,{className:`gap-2.5 font-mono`,"aria-current":t!==`fit`&&t.w===n&&t.h===r||void 0,onSelect:()=>e.onViewport({w:n,h:r}),children:[(0,X.jsx)(i,{"aria-hidden":`true`}),n,` × `,r,t!==`fit`&&t.w===n&&t.h===r?(0,X.jsx)(f,{className:`ml-auto size-4`,"aria-hidden":`true`}):null]},`${n}x${r}`))]})]})}function tn({quality:e,onQuality:t,compact:n}){return(0,X.jsx)(ie,{value:e,onValueChange:e=>t(Lt(e)),children:It.map(e=>(0,X.jsx)(re,{value:e.value,"data-quality":e.value,className:l(`items-start`,n&&`min-h-11`),children:(0,X.jsxs)(`span`,{className:`flex flex-col gap-0.5`,children:[(0,X.jsx)(`span`,{children:e.label}),(0,X.jsx)(`span`,{className:`text-xs whitespace-normal text-muted-foreground`,children:e.detail})]})},e.value))})}function nn({props:e}){let{quality:t}=e;return(0,X.jsxs)(j,{children:[(0,X.jsx)(k,{asChild:!0,children:(0,X.jsxs)(T,{variant:`outline`,size:`sm`,className:`shrink-0 gap-1.5`,"aria-label":`Stream quality: ${Rt(t)}`,children:[(0,X.jsx)(R,{"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`hidden @min-[680px]:inline`,children:Rt(t)}),(0,X.jsx)(p,{className:`size-3.5 text-muted-foreground`,"aria-hidden":`true`})]})}),(0,X.jsxs)(A,{align:`start`,className:`w-64`,children:[(0,X.jsx)(E,{className:`text-xs font-normal text-muted-foreground`,children:`Stream quality`}),(0,X.jsx)(tn,{quality:t,onQuality:e.onQuality,compact:!1})]})]})}function rn({stats:e,status:t,crowded:n}){return e?(0,X.jsx)(Kt,{stats:e,shrunk:n}):t?(0,X.jsxs)(`span`,{"data-slot":`preview-status`,role:`img`,"aria-label":t.label,title:t.label,className:`flex shrink-0 items-center gap-1.5 font-mono text-xs whitespace-nowrap text-muted-foreground`,children:[(0,X.jsx)(M,{tone:t.tone,"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`hidden @min-[760px]:inline`,children:t.label})]}):null}function an({props:e,compact:t}){let{stats:n,navEnabled:r,url:i,current:a,adopted:o}=e;return(0,X.jsxs)(j,{children:[(0,X.jsx)(k,{asChild:!0,children:(0,X.jsx)(T,{variant:`ghost`,size:`icon-sm`,className:Ht,"aria-label":`More`,children:(0,X.jsx)(ye,{"aria-hidden":`true`})})}),(0,X.jsxs)(A,{align:`end`,className:`min-w-64`,children:[n&&!t?(0,X.jsx)(E,{className:`font-mono text-xs font-normal text-muted-foreground`,children:Gt(n)}):null,(0,X.jsxs)(D,{className:`min-h-11 gap-2.5 md:min-h-0`,disabled:!r,onSelect:()=>e.onReload(!0),children:[(0,X.jsx)(U,{"aria-hidden":`true`}),`Reload without cache`]}),(0,X.jsxs)(D,{className:`min-h-11 gap-2.5 md:min-h-0`,disabled:i===``,onSelect:e.onCopyUrl,children:[(0,X.jsx)(pe,{"aria-hidden":`true`}),`Copy page URL`]}),a?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(O,{}),o?(0,X.jsxs)(D,{disabled:!0,className:`items-start gap-2.5 opacity-100 data-[disabled]:opacity-100`,children:[(0,X.jsx)(Ee,{className:`mt-0.5 text-muted-foreground`,"aria-hidden":`true`}),(0,X.jsxs)(`span`,{className:`flex flex-col gap-0.5`,children:[(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`Stop server · ${a.label} :${a.port}`}),(0,X.jsx)(`span`,{className:`text-xs whitespace-normal text-muted-foreground`,children:`Squawk didn't start this server, so it won't stop it. Stop it where it was started.`})]})]}):(0,X.jsxs)(D,{variant:`destructive`,className:`min-h-11 gap-2.5 md:min-h-0`,onSelect:()=>e.onStop(a.port),children:[(0,X.jsx)(Se,{"aria-hidden":`true`}),`Stop server · ${a.label} :${a.port}`]})]}):null,t?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(O,{}),(0,X.jsx)(E,{className:`text-xs font-normal text-muted-foreground`,children:`Stream quality`}),(0,X.jsx)(tn,{quality:e.quality,onQuality:e.onQuality,compact:!0}),(0,X.jsx)(O,{}),(0,X.jsxs)(D,{className:`min-h-11 gap-2.5`,onSelect:e.onClose,children:[(0,X.jsx)(fe,{"aria-hidden":`true`}),`Close preview`]})]}):null]})]})}function on({props:e,elements:t}){let{stats:n,current:r,badge:i=!0}=e,{agentShown:a}=Xt(e),{back:o,forward:s,reload:c,address:l,more:u,session:d,progress:f}=t;return(0,X.jsxs)(`div`,{"data-slot":`preview-toolbar`,"data-compact":``,className:`relative flex shrink-0 flex-col border-b border-border bg-background`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2 px-2 pt-[max(0.25rem,env(safe-area-inset-top))]`,children:[d,(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col items-center leading-tight`,children:[(0,X.jsxs)(`span`,{className:`flex max-w-full items-center gap-1.5 text-sm font-semibold text-foreground`,children:[n?(0,X.jsx)(M,{tone:`success`,"aria-hidden":`true`}):null,(0,X.jsx)(`span`,{className:`truncate`,children:Yt(r,a)})]}),i?(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Experimental`}):null]}),u]}),(0,X.jsxs)(`div`,{className:`flex items-center gap-1 px-2 py-1`,children:[o,s,c,l]}),f]})}function sn({props:e,elements:t,switcher:n,crowded:r,input:i,focusUrlAfterMenu:a}){let{badge:o=!0,stats:s,status:c}=e,{back:l,forward:u,reload:d,address:f,more:p,session:m,progress:h}=t;return(0,X.jsxs)(`div`,{"data-slot":`preview-toolbar`,className:`@container relative flex shrink-0 items-center gap-1 border-b border-border bg-background px-2 py-2 @min-[640px]:gap-1.5 @min-[640px]:px-2.5`,children:[m,l,u,d,n?(0,X.jsx)(Qt,{props:e,input:i,focusUrlAfterMenu:a}):null,f,(0,X.jsx)(en,{props:e}),(0,X.jsx)(nn,{props:e}),(0,X.jsx)(rn,{stats:s,status:c,crowded:r}),o?(0,X.jsx)(Me,{iconOnly:r,responsive:!r}):null,(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`mx-0.5 h-5 w-px shrink-0 bg-border`}),p,(0,X.jsx)(T,{variant:`ghost`,size:`icon-sm`,className:Ht,"aria-label":`Close preview`,onClick:e.onClose,children:(0,X.jsx)(fe,{"aria-hidden":`true`})}),h]})}function cn({transport:e,takenOver:t,empty:n,stage:r,hasFrame:i,lost:a,url:o,worktree:s}){let c=a||e!==`blocked`&&t!==void 0;return e===`blocked`?{content:{kind:`state`,state:{stage:`proxy-blocked`}},dim:c}:t===void 0?n||r?.stage===`agent-idle`?{content:{kind:`empty`,agentIdle:!n&&r?.stage===`agent-idle`},dim:c}:r?.stage===`streaming`||r?.stage===`loading`&&i?{content:{kind:`none`},dim:c}:r?{content:{kind:`state`,state:r,url:o,worktree:s},dim:c}:a?{content:{kind:`none`},dim:c}:{content:{kind:`state`,state:{t:`state`,stage:`loading`,step:`browser`},url:o},dim:c}:{content:{kind:`state`,state:{stage:`taken-over`,by:t}},dim:c}}function ln(e,{servers:t,serverStates:n,agentLive:r,openServer:i,openAgent:a,actions:o}){switch(e.kind){case`none`:return null;case`state`:{let{kind:t,...n}=e;return(0,X.jsx)(ze,{...n,actions:o})}case`empty`:return(0,X.jsx)(ut,{servers:t,states:n,onOpen:e=>i(e),agentLive:r===!0,agentIdle:e.agentIdle,onOpenAgent:a})}}function un(){let e=typeof window>`u`?void 0:window.devicePixelRatio;return typeof e==`number`&&e>0?e:1}function dn(){let[e,t]=(0,Y.useState)(un);return(0,Y.useEffect)(()=>{let n=window.matchMedia?.(`(resolution: ${e}dppx)`);if(!n)return;let r=()=>t(un());return n.addEventListener(`change`,r),()=>n.removeEventListener(`change`,r)},[e]),e}var fn=2e3,pn=500,mn=1e3;function hn(e,t){switch(e.stage){case`needs-approval`:case`port-held`:case`server-starting`:case`server-stalled`:case`server-exited`:case`server-stopped`:return e.server.port===t;case`loading`:case`streaming`:return!0;default:return!1}}function gn(e){navigator.clipboard?.writeText(e).then(()=>c(`Copied`),()=>c(`Couldn't copy to the clipboard`,{tone:`danger`}))}var _n=e=>`http://localhost:${e.port}${e.path&&e.path!==`/`?e.path:``}`;function vn(e,t){return e?.port===void 0?e?.agent===!0||e?.url!==void 0:e.restored!==!0||t.some(t=>t.port===e.port)}function yn(e){return`port`in e?{port:e.port}:`agent`in e?{agent:!0}:{url:e.url}}function bn({run:e,servers:t,request:n,onTarget:r,onLive:i,onClose:o}){let l=dn(),u=(0,Y.useRef)(l);u.current=l;let d=a(),f=(0,Y.useRef)(crypto.randomUUID()),p=(0,Y.useRef)(!1),m=ae(),h=_e(ue,!1),[g,_]=(0,Y.useState)(0),[v,y]=(0,Y.useState)({state:`connecting`,attempt:0}),[ee,te]=(0,Y.useState)(!1),[b,x]=(0,Y.useState)(void 0),[S,C]=(0,Y.useState)(void 0),[ne,w]=(0,Y.useState)(``),[T,E]=(0,Y.useState)(void 0),[re,D]=(0,Y.useState)(!1),[O,k]=(0,Y.useState)(void 0),[A,ie]=(0,Y.useState)(!1),[j,M]=(0,Y.useState)(!1),[oe,se]=(0,Y.useState)(void 0),[N,ce]=(0,Y.useState)(void 0),[le,de]=(0,Y.useState)(void 0),[P,fe]=(0,Y.useState)(`fit`),[pe,me]=(0,Y.useState)(zt),[he,ge]=(0,Y.useState)(null),[ve,ye]=(0,Y.useState)(void 0),[be,xe]=(0,Y.useState)(0),F=(0,Y.useRef)(void 0),Se=(0,Y.useRef)(null),Ce=(0,Y.useRef)(null),I=(0,Y.useRef)(void 0),L=(0,Y.useRef)(void 0),we=(0,Y.useRef)(pe);we.current=pe;let R=(0,Y.useRef)({port:T,stage:S,agent:re});R.current={port:T,stage:S,agent:re};let z=(0,Y.useRef)([]),Te=(0,Y.useRef)(void 0),Ee=(0,Y.useRef)(!1),B=(0,Y.useRef)(!1),V=(0,Y.useCallback)(e=>{B.current&&F.current?.send(e)},[]),H=(0,Y.useRef)([]),U=(0,Y.useCallback)(e=>{B.current?F.current?.send(e):H.current.push(e)},[]);(0,Y.useEffect)(()=>{let t;return t=je({projectId:m??`default`,runId:e.id},{onFrame(e){if(!s())return;let n=Date.now();z.current.push({at:n,bytes:e.size}),Ee.current||(Ee.current=!0,M(!0)),(Se.current?.draw(e)??Promise.resolve()).finally(()=>t?.send({t:`ack`}))},onMessage(e){switch(e.t){case`state`:if(C(e),(e.stage===`streaming`||e.stage===`loading`)&&xe(e=>e+1),L.current!==void 0&&hn(e,L.current)){let n=L.current;L.current=void 0,(e.stage===`needs-approval`||e.stage===`server-exited`||e.stage===`server-stopped`)&&t?.send({t:`run`,port:n})}return;case`url`:return w(e.url);case`cursor`:return se(e.cursor);case`dialog`:return ce(e);case`pong`:Te.current=Math.max(0,Date.now()-e.ts);return;case`downloadProgress`:C(t=>t?.stage===`downloading`?{...t,received:e.received,total:e.total}:t);return;case`replaced`:x(e.by),B.current=!1,H.current=[],t?.close();return}},onTransport(e,n){if(B.current=e===`open`,y({state:e,attempt:n??0}),(e===`blocked`||e===`closed`)&&(H.current=[]),e===`open`){te(!0),I.current&&(t?.send({t:`open`,target:I.current,viewerId:f.current,resume:p.current,quality:we.current,dpr:u.current}),p.current=!0);for(let e of H.current.splice(0))t?.send(e)}}}),F.current=t,()=>{B.current=!1,H.current=[],t?.close(),F.current===t&&(F.current=void 0)}},[m,e.id,g]);let W=d&&v.state===`open`&&b===void 0,G=h||P===`fit`?he:P;(0,Y.useEffect)(()=>{G&&W&&(S?.stage===`streaming`||S?.stage===`loading`)&&V({t:`resize`,w:G.w,h:G.h,...l===1?{}:{dpr:l}})},[G?.w,G?.h,l,W,S?.stage,be,V]),(0,Y.useEffect)(()=>{if(!W)return;let e=setInterval(()=>V({t:`ping`,ts:Date.now()}),fn);return()=>clearInterval(e)},[W,V]);let K=W&&S?.stage===`streaming`;(0,Y.useEffect)(()=>{if(!K){de(void 0);return}let e=setInterval(()=>{let e=Date.now();z.current=z.current.filter(t=>e-t.at<=mn);let t={fps:z.current.length,kbps:Math.round(z.current.reduce((e,t)=>e+t.bytes,0)/1024),...Te.current===void 0?{}:{rttMs:Te.current},...z.current.length>0?{lastFrameAt:z.current.at(-1).at}:{}};de(e=>{let n=t.lastFrameAt??e?.lastFrameAt,r={...t,...n===void 0?{}:{lastFrameAt:n}};return e&&e.fps===r.fps&&e.kbps===r.kbps&&e.rttMs===r.rttMs&&e.lastFrameAt===r.lastFrameAt?e:r})},pn);return()=>clearInterval(e)},[K]),(0,Y.useEffect)(()=>(i?.(K),()=>i?.(!1)),[K,i]),(0,Y.useEffect)(()=>{O&&r?.(O)},[O,r]);let q=(0,Y.useCallback)((e,t,n=!1)=>{I.current=e,L.current=n&&`port`in e?e.port:void 0,ie(!0),C(void 0),x(void 0),ye(void 0),w(t),E(`port`in e?e.port:void 0),D(`agent`in e),k(yn(e)),V({t:`open`,target:e,viewerId:f.current,quality:we.current,dpr:u.current}),p.current=B.current},[V]),J=(0,Y.useCallback)((e,n=!1)=>{let r=t.find(t=>t.port===e);q({port:e},r?_n(r):`http://localhost:${e}`,n)},[t,q]),De=(0,Y.useCallback)(()=>q({agent:!0},``),[q]);(0,Y.useEffect)(()=>{if(n?.agent){if(R.current.agent&&R.current.stage?.stage===`streaming`)return;De();return}if(n?.url!==void 0){let e=Fe(n.url,t);e.kind===`server`?J(e.port):e.kind===`url`&&q({url:e.url},e.url);return}n?.port!==void 0&&(n.restored&&!t.some(e=>e.port===n.port)||R.current.port===n.port&&R.current.stage?.stage===`streaming`&&n.run!==!0||J(n.port,n.run===!0))},[n]);let Oe=!A&&!b&&v.state!==`blocked`,ke=vn(n,t);(0,Y.useEffect)(()=>{Oe&&!ke&&Ce.current?.focus()},[Oe,ke]);let Ae=e=>{let n=Fe(e,t);if(n.kind===`error`)return ye(n.message);if(n.kind===`server`)return J(n.port);if(R.current.stage?.stage===`streaming`&&!R.current.agent)return I.current={url:n.url},L.current=void 0,E(void 0),k({url:n.url}),ye(void 0),w(n.url),V({t:`nav`,url:n.url});q({url:n.url},n.url)},X=(0,Y.useCallback)(e=>{we.current=e,me(e),Bt(e),V({t:`quality`,quality:e})},[V]),Me=()=>{p.current=!1,x(void 0),y({state:`connecting`,attempt:0}),Ee.current=!1,_(e=>e+1)};return{compact:h,transport:v,everOpened:ee,takenOver:b,stage:S,url:ne,port:T,agent:re,hasFrame:j,cursor:oe,dialog:N,setDialog:ce,stats:le,viewport:P,setViewport:fe,quality:pe,chooseQuality:X,setStageSize:ge,addressError:ve,stageHandle:Se,urlInput:Ce,send:V,connected:W,streaming:K,openServer:J,openAgent:De,empty:Oe,navigate:Ae,reconnect:Me,actions:(0,Y.useMemo)(()=>({download:()=>U({t:`download`}),cancelDownload:()=>U({t:`cancelDownload`}),retryBrowser:()=>U({t:`retryBrowser`}),run:e=>{B.current?V({t:`run`,port:e}):c(`The preview is reconnecting. Run the server again once it is back.`,{tone:`danger`})},stop:e=>U({t:`stop`,port:e}),keepWaiting:e=>U({t:`keepWaiting`,port:e}),close:o,useHere:Me,copy:gn}),[V,U,o])}}function xn(e){return(0,X.jsx)(S,{onClose:e.onClose,children:(0,X.jsx)(wn,{...e})})}function Sn(e,t,n,r){return e.state===`blocked`?{tone:`neutral`,label:`not supported`}:n?{tone:`neutral`,label:`paused`}:t&&(e.state===`reconnecting`||e.state===`closed`)?{tone:`danger`,label:`offline`}:e.state===`open`?r?Cn(r):void 0:{tone:`neutral`,label:`connecting…`}}function Cn(e){switch(e.stage){case`downloading`:return{tone:`pending`,label:`downloading`};case`download-failed`:return{tone:`danger`,label:`download failed`};case`sandbox-failed`:return{tone:`danger`,label:`browser failed`};case`browser-exited`:return{tone:`danger`,label:e.reason===`timeout`?`browser timed out`:`browser exited`};case`needs-approval`:return{tone:`neutral`,label:`not started`};case`port-held`:return{tone:`danger`,label:`port in use`};case`server-starting`:return{tone:`pending`,label:`waiting for :${e.server.port}`};case`server-stalled`:return{tone:`pending`,label:`waiting · 2 min`};case`server-exited`:return{tone:`danger`,label:`server exited`};case`server-stopped`:return{tone:`neutral`,label:`stopped`};case`agent-idle`:return{tone:`neutral`,label:`agent idle`};case`loading`:return{tone:`neutral`,label:`connecting…`};default:return}}function wn(e){let{run:t,servers:n,serverStates:r,agentLive:i,onSession:a,onClose:o}=e,s=bn(e),{compact:c,transport:l,everOpened:u,takenOver:d,stage:f,url:p,port:m,agent:h,hasFrame:g,stats:_,viewport:v,setViewport:y,quality:ee,chooseQuality:te,addressError:b,urlInput:x,send:S,streaming:C,openServer:ne,openAgent:w,empty:T,navigate:E,actions:re}=s,D=n.find(e=>e.port===m),O=f?.stage===`streaming`&&f.adopted,k=u&&(l.state===`reconnecting`||l.state===`closed`),{content:A,dim:ie}=cn({transport:l.state,takenOver:d,empty:T,stage:f,hasFrame:g,lost:k,url:p,worktree:t.worktreePath}),j=ln(A,{servers:n,serverStates:r,agentLive:i,openServer:ne,openAgent:w,actions:re});return(0,X.jsxs)(`section`,{"data-slot":`preview-pane-body`,"aria-label":`Live preview`,className:`flex h-full min-h-0 flex-col bg-background text-foreground`,children:[(0,X.jsx)(Zt,{url:p,servers:n,serverStates:r,badge:l.state!==`blocked`,current:D,agentLive:i===!0,agentShown:h,adopted:O,viewport:c?`fit`:v,quality:ee,compact:c,navEnabled:C,loading:f?.stage===`loading`,stats:C?_??{fps:0,kbps:0}:void 0,status:C?void 0:Sn(l,u,d!==void 0,f),urlInputRef:x,onSession:a,onNavigate:E,onBack:()=>S({t:`back`}),onForward:()=>S({t:`forward`}),onReload:e=>S({t:`reload`,...e?{ignoreCache:!0}:{}}),onPickServer:e=>ne(e),onPickAgent:w,onViewport:y,onQuality:te,onCopyUrl:()=>gn(p),onStop:re.stop,onClose:o}),b?(0,X.jsx)(`p`,{role:`alert`,className:`border-b border-border bg-card px-3 py-1.5 text-xs text-danger`,children:b}):null,(0,X.jsx)(Tn,{transportState:s,overlay:j,dim:ie,lost:k})]})}function Tn({transportState:e,overlay:t,dim:n,lost:r}){let{connected:i,dialog:a,hasFrame:o,stage:s,stageHandle:c,compact:l,viewport:u,cursor:d,setStageSize:f,send:p,urlInput:m,transport:h,reconnect:g,setDialog:_}=e,v=s?.stage,y=i&&t===null&&!a;return(0,X.jsxs)(Pt,{ref:c,viewport:l?`fit`:u,dimmed:n&&o&&(v===`streaming`||v===`loading`||n),cursor:d,onSize:f,renderInput:e=>y?(0,X.jsx)(Mt,{scale:e.scale,send:p,onLeave:()=>m.current?.focus()}):null,children:[r?(0,X.jsx)(lt,{attempt:h.attempt,exhausted:h.state===`closed`,onReconnect:g}):null,t?(0,X.jsx)(`div`,{"data-slot":`preview-overlay`,className:n&&o?`absolute inset-0 overflow-auto bg-background/85`:`absolute inset-0 overflow-auto bg-background`,children:t}):null,a?(0,X.jsx)(dt,{dialog:a,onResult:e=>{_(void 0),p({t:`dialogResult`,...e})}}):null]})}function En(e){let{visibleEvents:t}=ne(e);return(0,Y.useMemo)(()=>{let e=new Map;for(let n of be(t,{activeTurn:!1}).turns)for(let t of n.items)t.kind===`preview-server`&&e.set(t.server.port,t);return e},[t])}function Dn(e){let t=En(e.run.id),n=he(e.run.id);return(0,X.jsx)(xn,{...e,serverStates:t,agentLive:n})}export{Dn as ConnectedPreviewPane};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./react-runtime-CCIEwYL0.js";import{Ft as t,U as n,un as r,xt as i}from"./queries-
|
|
1
|
+
import{t as e}from"./react-runtime-CCIEwYL0.js";import{Ft as t,U as n,un as r,xt as i}from"./queries-IlC9MZgh.js";import{Lt as a,n as o}from"./toaster-DNnL8v10.js";import{y as s}from"./design-icons-QbNMZniQ.js";import{n as c,t as l}from"./open-in-menu-BI7mnPPf.js";import{s as u}from"./project-router-Dc6KBQsv.js";import{Rn as d}from"./index-Dp7K74Jw.js";import{n as f}from"./settings-field-AyinSFR_.js";var p=e();function m(){let e=u(),t=i().data;return e===null?null:t?.projects.find(t=>t.id===e)?.root??null}function h(e){navigator.clipboard.writeText(e).then(()=>o(`Project folder copied`)).catch(()=>o(e))}function g(){let e=m(),n=t().data?.homeDir??null;return e===null?null:(0,p.jsx)(f,{wide:!0,title:`Project folder`,hint:`Where this project lives on disk. Every task worktree, git command and agent run resolves against it.`,children:(0,p.jsxs)(`div`,{"data-slot":`project-location`,"data-variant":`field`,className:`flex flex-col gap-3`,children:[(0,p.jsx)(d,{"data-slot":`project-location-path`,value:e,bases:{home:n,root:null},wrap:!0,className:`w-full min-w-0 rounded-md border border-border bg-background p-3 text-[13px] text-foreground`}),(0,p.jsxs)(`div`,{className:`flex w-full flex-wrap items-center gap-2 border-t border-border pt-4`,children:[(0,p.jsxs)(`button`,{type:`button`,"data-action":`project-location-copy`,title:`Copy the project folder path`,onClick:()=>h(e),className:`inline-flex min-h-11 items-center gap-2 rounded-md border border-border bg-card px-3 text-xs text-foreground transition-colors hover:bg-muted`,children:[(0,p.jsx)(s,{"aria-hidden":`true`,className:`size-4`}),`Copy path`]}),(0,p.jsx)(_,{root:e})]})]})})}function _({root:e}){let t=n(),i=r({mutationFn:e=>a(e),onError:e=>o(e.message,{tone:`danger`})}),s=(t.data?.targets??[]).filter(e=>c(e.id)===void 0).map(e=>({target:e}));return s.length===0?null:(0,p.jsx)(l,{slot:`project-location-open`,label:`Open with`,triggerVariant:`outline`,title:e,disabled:i.isPending,choices:s,onPick:e=>i.mutate(e,{onSuccess:()=>o(`Opening the project folder in ${s.find(t=>t.target.id===e)?.target.label??e}`)})})}export{m as n,g as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{a as r}from"./toaster-DNnL8v10.js";import{i,l as a,m as o,n as s,p as c,r as l}from"./chunk-KS7C4IRE-BdLLx37K.js";var u=e(t(),1),d=n(),f=/^\/p\/([^/]+)(?=\/|$)/;function p(e){let t=f.exec(e)?.[1];return t===void 0?null:decodeURIComponent(t)}function m(e){let t=f.exec(e);if(!t)return e;let n=e.slice(t[0].length);return n===``?`/`:n}function h(e,t){return!t.startsWith(`/`)||t===`/p`||t.startsWith(`/p/`)?t:`/p/${encodeURIComponent(e)}${t}`}function g(e,t){return e===null?t:typeof t==`string`?h(e,t):t.pathname===void 0?t:{...t,pathname:h(e,t.pathname)}}function _(){let{projectId:e}=r(),{pathname:t}=c();return e??p(t)}function v(){let e=_();return(0,u.useCallback)(t=>g(e,t),[e])}function y(e){let{pathname:t}=c();return(0,u.useMemo)(()=>a(e,m(t)),[e,t])}function b({to:e,...t}){let n=v();return(0,d.jsx)(s,{...t,to:n(e)})}function x({to:e,...t}){let n=v();return(0,d.jsx)(l,{...t,to:n(e)})}function S({to:e,...t}){let n=v();return(0,d.jsx)(i,{...t,to:n(e)})}function C(){let e=o(),t=v();return(0,u.useMemo)(()=>((n,r)=>typeof n==`number`?e(n):e(t(n),r)),[e,t])}export{g as a,C as c,p as i,y as l,x as n,m as o,S as r,_ as s,b as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,r as t}from"./rolldown-runtime-QTnfLwEv.js";import{i as n,t as r}from"./react-runtime-CCIEwYL0.js";import{Dt as i,Ft as a,Ht as o,Nt as s,Rt as c,un as l,xt as u,zt as d}from"./queries-IlC9MZgh.js";import{Fi as f,In as p,n as m}from"./toaster-DNnL8v10.js";import{n as h}from"./chunk-KS7C4IRE-BdLLx37K.js";import{o as g}from"./dist-CCX8mhHc.js";import{k as _,mt as v}from"./design-icons-QbNMZniQ.js";import{t as y}from"./button-BV_AiLj2.js";import{n as b,r as x,t as S}from"./popover-BQolmvDR.js";import{t as C}from"./centered-state-N8vWM_Hw.js";import{$t as w,Rn as T,an as ee,en as te,in as E,nn as D,on as O,rn as k,tn as A,ur as j}from"./index-Dp7K74Jw.js";import{t as M}from"./option-select-Bmm4ktgQ.js";import{n as N,t as P}from"./save-cue-CpHgT93o.js";import{n as F,t as I}from"./settings-field-AyinSFR_.js";import{t as L}from"./use-path-bases-B238cLk1.js";import{r as R}from"./settings-save-bar-Dd3bTznK.js";import{n as z}from"./saved-draft-BwzBc-_Y.js";import{t as B}from"./settings-list-detail-BlEEuyae.js";var V=t(n(),1),H=r();function U(){let e=i();return{isPending:e.isPending,confirm:(t,n)=>e.mutate(t.id,{onSuccess:()=>{m(`${t.name} removed from the workspace — its files are untouched`),n?.()},onError:e=>m(e.message,{tone:`danger`})})}}function W({project:e,onOpenChange:t,onConfirm:n}){let r={home:a().data?.homeDir??null,root:null};return(0,H.jsx)(w,{open:e!==null,onOpenChange:t,children:(0,H.jsxs)(D,{children:[(0,H.jsxs)(ee,{children:[(0,H.jsxs)(O,{children:[`Remove `,e?.name,` from the workspace?`]}),(0,H.jsxs)(k,{children:[`This only unregisters the project — `,(0,H.jsx)(`strong`,{children:`nothing on disk is deleted`}),`. The folder, its git history and its task history all stay exactly where they are, and opening it again re-registers it with everything intact.`,e?(0,H.jsx)(T,{value:e.root,bases:r,className:`mt-1 text-xs text-foreground`}):null]})]}),(0,H.jsxs)(E,{children:[(0,H.jsx)(A,{children:`Keep it`}),(0,H.jsx)(te,{"data-action":`projects-confirm-remove`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:n,children:`Remove from list`})]})]})})}var G=e({MaxParallelSelect:()=>$,ProjectTagsEditor:()=>Q,ProjectsSection:()=>Y,STATUS_LABEL:()=>q}),K=1,q={ok:`ok`,"not-git":`no git repo`,missing:`folder not found`};function J(e){let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function Y(){let e=a(),t=u();return e.isPending||t.isPending?(0,H.jsx)(`p`,{"data-slot":`projects-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading projects…`}):e.isError||t.isError?(0,H.jsx)(C,{icon:(0,H.jsx)(_,{}),tone:`danger`,title:`Project settings did not load`,subtitle:(e.error??t.error)?.message,heading:`h2`}):(0,H.jsx)(X,{config:e.data,registry:t.data})}function X({config:e,registry:t}){let[n,r]=(0,V.useState)(!1);return(0,H.jsxs)(`div`,{"data-slot":`projects-section`,className:`flex w-full flex-col gap-7`,children:[(0,H.jsx)(Z,{configKey:`browseRoot`,value:e.browseRoot,title:`Default browse folder`,hint:`Where “Open local folder…” starts. The picker cannot navigate above this folder.`,placeholder:`~/`,slot:`browse`,footer:`Only affects folder browsing; GitHub checkouts use the separate checkout folder.`}),(0,H.jsx)(Z,{configKey:`projectsDir`,value:e.projectsDir,title:`Default checkout folder`,hint:`Where “Clone from GitHub” puts new projects: <folder>/<project name>.`,placeholder:`~/squawk/projects`,slot:`checkout`,footer:`Only affects new checkouts; projects already registered keep their location.`,refreshProjects:!0}),(0,H.jsx)(ne,{registry:t,workspaceMax:e.resources.maxParallel}),(0,H.jsx)(y,{className:`self-start`,onClick:()=>r(!0),children:`Add project`}),n?(0,H.jsx)(j,{open:!0,onOpenChange:r}):null]})}function Z({configKey:e,value:t,title:n,hint:r,placeholder:i,slot:a,footer:s,refreshProjects:c=!1}){let u=f(),d=l({mutationFn:t=>p(e===`browseRoot`?{browseRoot:t}:{projectsDir:t}),onSuccess:t=>{u.setQueryData(o.config,t),e===`browseRoot`?u.invalidateQueries({queryKey:o.fsBrowseRoot}):c&&u.invalidateQueries({queryKey:o.projects})}}),[m,h]=z(t),g=m.trim();R({dirty:g!==t,invalid:g===``,save:()=>d.mutateAsync(g),discard:()=>{h(t),d.reset()}});let _=d.isError?d.error.message:null;return(0,H.jsxs)(F,{title:n,hint:`${r} ${e===`browseRoot`?`Choose an existing folder; it is verified writable before saving.`:`The folder is created recursively if needed, then verified writable before saving.`}`,children:[(0,H.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,H.jsx)(`input`,{type:`text`,spellCheck:!1,"aria-label":n,"aria-invalid":_!==null,"data-slot":`projects-${a}-root`,value:m,disabled:d.isPending,placeholder:i,onChange:e=>{h(e.target.value),d.isError&&d.reset()},className:`block w-full max-w-sm rounded-md border border-input bg-card px-3 py-1.5 font-mono text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-danger disabled:opacity-50`})}),_===null?(0,H.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:s}):(0,H.jsxs)(`p`,{"data-slot":`projects-${a}-root-error`,role:`alert`,className:`text-xs text-danger`,children:[_,` — setting unchanged`]})]})}function ne({registry:e,workspaceMax:t}){let[n,r]=(0,V.useState)(null),[i,a]=(0,V.useState)(null),o=U(),s=(0,V.useMemo)(()=>c(e.projects),[e.projects]);return(0,H.jsxs)(F,{wide:!0,title:`Registered projects`,hint:`Connected repositories. Removing a project only unregisters it — no files on disk are deleted.`,children:[(0,H.jsx)(B,{slot:`project-list`,label:`Projects registered in this workspace`,items:e.projects,itemKey:e=>e.id,selectedKey:i,onSelect:a,empty:(0,H.jsx)(`p`,{"data-slot":`projects-empty`,className:`text-[13px] text-soft-foreground`,children:`No projects registered yet.`}),row:e=>(0,H.jsx)(ie,{project:e}),detail:n=>(0,H.jsx)(ae,{project:n,isBoot:n.id===e.bootProject,workspaceMax:t,vocabulary:s,disabled:o.isPending,onRemove:()=>r(n)})}),(0,H.jsx)(W,{project:n,onOpenChange:e=>!e&&r(null),onConfirm:()=>{if(!n)return;let e=n;r(null),o.confirm(e)}})]})}function re({project:e}){return(0,H.jsxs)(`span`,{"data-slot":`project-status-pill`,className:`inline-flex shrink-0 items-center gap-1.5 rounded-full border border-border bg-muted px-2.5 py-0.5 text-[12px] leading-5`,children:[(0,H.jsx)(`span`,{"data-slot":`project-status`,className:e.status===`missing`?`text-danger`:`text-foreground`,children:q[e.status]}),e.status===`missing`?null:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`text-soft-foreground`,children:`·`}),(0,H.jsx)(`span`,{className:`text-soft-foreground`,children:e.source})]})]})}function ie({project:e}){let t=L(),n=e.tags?.length??0;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`settings-list-row-title min-w-0 flex-1`,children:e.name}),(0,H.jsx)(`span`,{"data-slot":`project-row-status`,className:e.status===`missing`?`shrink-0 text-[12px] text-danger`:`shrink-0 text-[12px] text-soft-foreground`,children:q[e.status]})]}),(0,H.jsxs)(`span`,{className:`settings-list-row-meta`,children:[(0,H.jsx)(T,{value:e.root,bases:t,className:`text-[12px]`}),n>0?` · ${n} tag${n===1?``:`s`}`:``]})]})}function ae({project:e,isBoot:t,workspaceMax:n,vocabulary:r,disabled:i,onRemove:a}){let o=N(),s=N(),c=L();return(0,H.jsxs)(`div`,{"data-slot":`project-row`,"data-project":e.id,className:`flex min-w-0 flex-col gap-4`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(`h3`,{className:`min-w-0 break-words text-sm font-medium text-foreground`,children:e.name}),(0,H.jsx)(re,{project:e})]}),(0,H.jsx)(T,{value:e.root,bases:c,wrap:!0,className:`text-xs text-soft-foreground`}),(0,H.jsxs)(`span`,{className:`text-[12px] text-soft-foreground`,children:[`Added `,J(e.addedAt)]})]}),(0,H.jsxs)(`div`,{"data-slot":`project-tags-field`,className:`flex flex-col gap-1.5`,children:[(0,H.jsxs)(`span`,{className:I,children:[`Tags `,(0,H.jsx)(P,{saved:o.saved})]}),(0,H.jsx)(Q,{project:e,vocabulary:r,onSaved:o.flash})]}),(0,H.jsxs)(`label`,{"data-slot":`project-max-parallel-field`,className:`flex flex-col gap-1.5`,children:[(0,H.jsxs)(`span`,{className:I,children:[`Max parallel tasks `,(0,H.jsx)(P,{saved:s.saved})]}),(0,H.jsx)($,{project:e,workspaceMax:n,onSaved:s.flash})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-t border-border pt-3`,children:[e.status===`missing`?null:(0,H.jsx)(y,{asChild:!0,variant:`outline`,children:(0,H.jsx)(h,{to:`/p/${encodeURIComponent(e.id)}`,children:`Open`})}),(0,H.jsx)(y,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`project-remove`,"aria-label":`Remove ${e.name} from the workspace — unregisters it, no files are deleted`,title:t?`Squawk is serving this project — it re-registers itself at every start`:void 0,disabled:i||t,onClick:a,children:`Remove`})]})]})}function Q({project:e,vocabulary:t,onSaved:n}){let r=s(),[i,a]=(0,V.useState)(``),[o,c]=(0,V.useState)(!1),[l,u]=(0,V.useState)(-1),f=(0,V.useRef)(null),p=e.tags??[],h=d(t,p,i),_=o&&h.length>0,y=t=>{r.mutate({id:e.id,tags:t},{onSuccess:()=>n?.(),onError:e=>m(e.message,{tone:`danger`})})},C=t=>{let n=t.trim().slice(0,32);if(u(-1),n){if(p.some(e=>e.toLowerCase()===n.toLowerCase())){a(``);return}if(p.length>=20){m(`${e.name} already has the maximum of 20 tags`,{tone:`danger`});return}a(``),y([...p,n])}},w=e=>{y(p.filter(t=>t!==e))},T=`project-tag-suggestions-${e.id}`;return(0,H.jsxs)(`div`,{"data-slot":`project-tags`,className:`flex flex-wrap items-center gap-1`,children:[p.map(t=>(0,H.jsxs)(`span`,{"data-slot":`project-tag`,className:`inline-flex max-w-full items-center gap-1 rounded-full bg-accent-strong/15 py-px pr-1 pl-2 text-xs font-medium whitespace-nowrap text-accent-text`,children:[t,(0,H.jsx)(`button`,{type:`button`,"data-action":`project-tag-remove`,"aria-label":`Remove tag ${t} from ${e.name}`,disabled:r.isPending,onClick:()=>w(t),className:`rounded-full p-0.5 hover:bg-accent-strong/25 disabled:opacity-50`,children:(0,H.jsx)(v,{className:`size-3`,"aria-hidden":`true`})})]},t)),(0,H.jsxs)(S,{open:_,onOpenChange:c,children:[(0,H.jsx)(b,{asChild:!0,children:(0,H.jsx)(`input`,{ref:f,type:`text`,"data-slot":`project-tag-input`,"aria-label":`Add a tag to ${e.name}`,role:`combobox`,"aria-expanded":_,"aria-controls":_?T:void 0,"aria-autocomplete":`list`,"aria-activedescendant":_&&l>=0?`${T}-${l}`:void 0,placeholder:p.length===0?`Add tag…`:`+`,value:i,maxLength:32,disabled:r.isPending,onFocus:()=>c(!0),onBlur:()=>c(!1),onChange:e=>{if(c(!0),u(-1),e.target.value.includes(`,`)){a(e.target.value.replace(/,/g,``));return}a(e.target.value)},onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(h.length===0)return;e.preventDefault(),c(!0);let t=e.key===`ArrowDown`?1:-1,n=l+t;u(n>=h.length?-1:n<-1?h.length-1:n);return}if(e.key===`Escape`&&_){e.preventDefault(),c(!1),u(-1);return}if(e.key===`Enter`||e.key===`,`){e.preventDefault(),C(l>=0?h[l]??i:i);return}if(e.key===`Tab`){c(!1);return}if(e.key===`Backspace`&&i===``&&p.length>0){e.preventDefault();let t=p[p.length-1];t!==void 0&&w(t)}},className:`h-6 w-16 min-w-0 flex-1 rounded-md border border-input bg-card px-1.5 text-[12px] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`})}),(0,H.jsxs)(x,{align:`start`,sideOffset:4,id:T,role:`listbox`,"data-slot":`project-tag-suggestions`,className:`w-56 p-1`,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,H.jsx)(`p`,{className:`px-2 pt-1 pb-1.5 text-xs text-soft-foreground`,children:`Tags used in this workspace`}),h.map((e,t)=>(0,H.jsx)(`button`,{type:`button`,id:`${T}-${t}`,role:`option`,"aria-selected":t===l,"data-slot":`project-tag-suggestion`,onMouseDown:e=>e.preventDefault(),onClick:()=>{C(e),f.current?.focus()},onMouseEnter:()=>u(t),className:g(`flex w-full items-center rounded-sm px-2 py-1 text-left text-[12px] font-medium text-accent-text`,t===l&&`bg-muted`),children:e},e))]})]})]})}function $({project:e,workspaceMax:t,onSaved:n}){let r=s(),i=e.maxParallel===void 0?``:String(e.maxParallel);return(0,H.jsx)(M,{"aria-label":`Max parallel tasks for ${e.name}`,"data-slot":`project-max-parallel`,value:i,disabled:r.isPending,onValueChange:t=>{let i=t===``?null:Number(t);r.mutate({id:e.id,maxParallel:i},{onSuccess:()=>n?.(),onError:e=>m(e.message,{tone:`danger`})})},className:`settings-select w-full max-w-full bg-card`,options:[{value:``,label:`Inherit workspace (${t})`},...Array.from({length:16},(e,t)=>t+K).map(e=>({value:String(e),label:String(e)}))]})}export{U as a,W as i,q as n,G as r,$ as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{
|
|
2
|
-
`)[0]??``,n=e.skills?.length??0;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`settings-list-row-title`,children:e.label.trim()||`Untitled template`}),(0,K.jsxs)(`span`,{className:`settings-list-row-meta`,children:[t||`No instructions yet`,n>0?` · ${n} skill${n===1?``:`s`}`:``]})]})}function J(){let e=i();return e.isPending?(0,K.jsx)(`p`,{"data-slot":`prompt-templates-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading prompt templates…`}):e.isError?(0,K.jsx)(M,{icon:(0,K.jsx)(d,{}),tone:`danger`,title:`Prompt templates did not load`,subtitle:e.error.message,heading:`h2`}):(0,K.jsx)(Y,{initial:
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Gt as r,O as i,Vt as a,un as o}from"./queries-IlC9MZgh.js";import{Fi as s,R as c,n as l}from"./toaster-DNnL8v10.js";import{o as u}from"./dist-CCX8mhHc.js";import{K as d,X as f,l as p,mt as m,rt as h,st as g,u as _}from"./design-icons-QbNMZniQ.js";import{t as v}from"./button-BV_AiLj2.js";import{i as y,r as b,t as x}from"./popover-BQolmvDR.js";import{a as S,i as C,o as w,r as T,s as E,t as D}from"./command-4D8sPZJy.js";import{f as O,i as k,p as A,u as j}from"./skills-pM_PouEs.js";import{t as M}from"./centered-state-N8vWM_Hw.js";import{at as N,ct as P,ft as F,lr as I,lt as L}from"./index-Dp7K74Jw.js";import{t as R}from"./textarea-BGp28xFr.js";import{n as z,t as B}from"./settings-field-AyinSFR_.js";import{r as V}from"./settings-save-bar-Dd3bTznK.js";import{n as H,t as U}from"./saved-draft-BwzBc-_Y.js";import{t as W}from"./settings-list-detail-BlEEuyae.js";var G=e(t(),1),K=n();function q({template:e}){let t=e.text.trim().split(`
|
|
2
|
+
`)[0]??``,n=e.skills?.length??0;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`settings-list-row-title`,children:e.label.trim()||`Untitled template`}),(0,K.jsxs)(`span`,{className:`settings-list-row-meta`,children:[t||`No instructions yet`,n>0?` · ${n} skill${n===1?``:`s`}`:``]})]})}function J(){let e=i();return e.isPending?(0,K.jsx)(`p`,{"data-slot":`prompt-templates-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading prompt templates…`}):e.isError?(0,K.jsx)(M,{icon:(0,K.jsx)(d,{}),tone:`danger`,title:`Prompt templates did not load`,subtitle:e.error.message,heading:`h2`}):(0,K.jsx)(Y,{initial:L(e.data.promptTemplates)})}function Y({initial:e}){let t=s(),n=r(),u=i(),[d,p]=H(e,U),[h,_]=(0,G.useState)(null),y=o({mutationFn:e=>c({promptTemplates:e}),onSuccess:(e,n)=>{t.setQueryData(a.uiState,e),p(t=>U(t,n)?L(e.promptTemplates):t)},onError:e=>l(e.message,{tone:`danger`})}),b=JSON.stringify(d)!==JSON.stringify(e),x=d.some(e=>e.label.trim()===``||e.text.trim()===``);V({dirty:b,invalid:x,save:()=>y.mutateAsync(d),discard:()=>p(e)});let S=(e,t)=>p(n=>n.map(n=>n.id===e?{...n,...t}:n)),C=(e,t)=>p(n=>n.map(n=>{if(n.id!==e)return n;let r=n.skills??[],i=r.includes(t)?r.filter(e=>e!==t):[...r,t],{skills:a,...o}=n;return i.length>0?{...o,skills:i}:o})),w=e=>{let t=d.findIndex(t=>t.id===e),n=d.filter(t=>t.id!==e);p(n),_(n[Math.min(t,n.length-1)]?.id??null)};return(0,K.jsx)(`div`,{"data-slot":`prompt-templates-section`,"data-reports-dirty":``,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:(0,K.jsxs)(z,{wide:!0,title:`Reusable instructions`,hint:`Insert templates from task composers, or apply them automatically with selected skills when the prompt is empty.`,children:[(0,K.jsx)(W,{slot:`prompt-template-list`,label:`Prompt templates`,items:d,itemKey:e=>e.id,selectedKey:h,onSelect:_,empty:(0,K.jsx)(`p`,{"data-slot":`prompt-templates-empty`,className:`text-[13px] text-soft-foreground`,children:`No templates. Add one, or reset to the built-ins.`}),row:e=>(0,K.jsx)(q,{template:e}),detail:e=>(0,K.jsxs)(`div`,{"data-slot":`prompt-template-row`,"data-template":e.id,className:`flex flex-col gap-1.5`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,K.jsx)(`label`,{htmlFor:`template-label-${e.id}`,className:B,children:`Template label`}),(0,K.jsx)(I,{id:`template-label-${e.id}`,"aria-label":`Label for ${e.label||`this template`}`,"data-slot":`prompt-template-label-input`,value:e.label,maxLength:80,onChange:t=>S(e.id,{label:t.target.value}),className:`flex-1 border-border bg-background`})]}),(0,K.jsx)(`label`,{htmlFor:`template-text-${e.id}`,className:B,children:`Instructions`}),(0,K.jsx)(R,{id:`template-text-${e.id}`,"aria-label":`Text for ${e.label||`this template`}`,"data-slot":`prompt-template-text-input`,value:e.text,maxLength:2e3,onChange:t=>S(e.id,{text:t.target.value}),className:`min-h-14 rounded-md border border-border bg-background text-[13px]`}),(0,K.jsx)(`p`,{className:B,children:`Apply automatically with skills`}),(0,K.jsxs)(`div`,{className:`mt-0.5 flex flex-wrap items-center gap-1.5`,children:[(0,K.jsx)(X,{label:e.label,skills:n.data??[],skillUsage:u.data?.skillUsage,selected:e.skills??[],onToggle:t=>C(e.id,t)}),(e.skills??[]).map(t=>(0,K.jsxs)(`button`,{type:`button`,"data-slot":`prompt-template-skill-chip`,"data-skill":t,title:`Stop applying “${e.label}” automatically with ${t}`,onClick:()=>C(e.id,t),className:`inline-flex items-center gap-1 rounded-md border border-border bg-muted px-2 py-0.5 font-mono text-xs font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[t,(0,K.jsx)(m,{"aria-hidden":`true`,className:`size-3`})]},t))]}),(0,K.jsxs)(v,{type:`button`,className:`self-start`,variant:`danger-ghost`,size:`sm`,"data-action":`prompt-template-remove`,title:`Remove this template`,onClick:()=>w(e.id),children:[(0,K.jsx)(g,{"aria-hidden":`true`,className:`size-3`}),`Delete template`]})]})}),(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,K.jsxs)(v,{type:`button`,variant:`outline`,size:`sm`,"data-action":`prompt-template-add`,onClick:()=>{let e=P();p(t=>[...t,{id:e,label:``,text:``}]),_(e)},children:[(0,K.jsx)(f,{"aria-hidden":`true`,className:`size-3.5`}),`New template`]}),(0,K.jsx)(v,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`prompt-templates-reset`,disabled:y.isPending,onClick:()=>p(N.map(e=>({...e}))),children:`Reset to defaults`}),x?(0,K.jsx)(`p`,{"data-slot":`prompt-templates-invalid`,className:`text-xs text-danger`,children:`Every template needs both a label and text.`}):null]})]})})}function X({label:e,skills:t,skillUsage:n,selected:r,onToggle:i}){let[a,o]=(0,G.useState)(!1),[s,c]=(0,G.useState)(``),l=(0,G.useRef)(null),{mostUsed:d,project:f,global:m,ranked:g}=j(t,s,n),v=(e,t)=>{let n=r.includes(e.id);return(0,K.jsxs)(w,{value:O(e),keywords:A(e.name,e.description),"data-slot":`prompt-template-skill-option`,"data-skill":e.id,"data-selected":n?`true`:void 0,onSelect:()=>i(e.id),children:[(0,K.jsx)(F,{skill:e,emphasized:t}),n?(0,K.jsx)(p,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]},O(e))};return(0,K.jsxs)(x,{open:a,onOpenChange:e=>{o(e),e||c(``)},children:[(0,K.jsx)(y,{asChild:!0,children:(0,K.jsxs)(`button`,{type:`button`,"data-slot":`prompt-template-skills-trigger`,"aria-label":`Apply ${e||`this template`} automatically with a skill`,title:`Pick the skills this template applies itself to`,className:u(`inline-flex h-[26px] shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-50`,r.length>0&&`text-foreground`),children:[(0,K.jsx)(h,{"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),`Add skill`,(0,K.jsx)(_,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,K.jsx)(b,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,K.jsxs)(D,{shouldFilter:!1,children:[(0,K.jsx)(S,{placeholder:`search skills…`,value:s,onValueChange:c,onInput:()=>l.current?.scrollTo(0,0)}),(0,K.jsxs)(E,{ref:l,"data-slot":`prompt-template-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[s.trim()&&!t.some(e=>e.id===s.trim())?(0,K.jsx)(C,{children:(0,K.jsxs)(w,{value:`typed-skill`,onSelect:()=>i(s.trim()),children:[`Use skill id “`,s.trim(),`” (unchecked)`]})}):null,(g?g.length===0:d.length===0&&f.length===0&&m.length===0)?(0,K.jsx)(T,{children:`Nothing matches.`}):null,g?g.length>0?(0,K.jsx)(C,{children:g.map(e=>v(e,k(e)))}):null:(0,K.jsxs)(K.Fragment,{children:[d.length>0?(0,K.jsx)(C,{heading:`Most used`,children:d.map(e=>v(e,k(e)))}):null,f.length>0?(0,K.jsx)(C,{heading:`Project skills`,children:f.map(e=>v(e,!0))}):null,m.length>0?(0,K.jsx)(C,{heading:`Global`,children:m.map(e=>v(e,!1))}):null]})]})]})})]})}export{J as PromptTemplatesSection};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t}from"./react-runtime-CCIEwYL0.js";import{d as n,n as r,p as i}from"./host-context-DDbYAKpm.js";import{$ as a,$n as o,A as s,Ai as c,An as l,Bn as u,C as d,Ci as f,Cn as p,Cr as m,Ct as ee,D as h,Di as g,Dn as _,Dt as te,E as ne,Ei as re,En as ie,Et as ae,F as oe,Fi as v,Fn as se,G as ce,Gn as le,Hi as ue,Hn as de,Ht as fe,Ii as pe,It as me,J as he,Jn as ge,Jt as _e,K as ve,Kn as ye,Kt as be,L as xe,Mi as Se,Mn as Ce,Mt as we,N as Te,Nn as Ee,Nt as De,O as Oe,Oi as ke,On as Ae,Or as je,Ot as Me,Pn as Ne,Pt as Pe,Q as Fe,Qi as Ie,Ri as Le,Rn as Re,S as ze,Sn as Be,Sr as Ve,St as He,Ti as Ue,Tn as We,Un as Ge,Vn as Ke,Vt as qe,Wi as Je,Wt as Ye,X as Xe,Xn as Ze,Y as Qe,Yi as $e,Yn as et,Zi as tt,Zn as nt,_t as rt,a as it,b as at,bn as ot,br as st,bt as ct,ct as lt,er as ut,et as dt,gt as ft,h as pt,ir as mt,ji as ht,jn as gt,k as _t,ki as vt,kr as yt,kt as bt,m as xt,n as St,nr as Ct,pt as wt,q as Tt,qi as Et,qn as Dt,qt as Ot,ta as kt,tr as At,v as jt,vt as Mt,wi as y,wn as Nt,wt as Pt,x as Ft,xi as It,xn as Lt,xt as Rt,y as zt,yt as Bt,zi as Vt,zn as Ht}from"./toaster-DNnL8v10.js";import{A as Ut,B as b,F as x,H as S,I as C,N as w,P as T,W as E,Z as D,a as Wt,j as O,z as k}from"./live-protocol-CNUmr-VT.js";import{t as A}from"./host-storage-B72yoDU1.js";function Gt(e,t){return e??t}function Kt(e,t){let n=Gt(e,t);return n===`1`||n===`true`}function qt(e,t,n){return e?.trim()||Gt(t,n)||``}var Jt=class extends Le{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Yt(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=Vt({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),D.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Yt(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Xt=class extends kt{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),tt(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&ue(t.mutationKey)!==ue(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??Yt();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){D.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}};function Zt(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function Qt(e,t,n){let r=e.slice(0);return r[t]=n,r}var $t=class extends kt{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,D.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!tt(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(Zt(e,n).forEach(e=>{e.destroy()}),Zt(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(!this.#a||this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=$e(this.#a,t(e))),this.#a}return e}#f(){return this.#r?.combine!==void 0&&this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new pe(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=Qt(this.#t,n,t),this.#h())}#h(){if(this.hasListeners()){let e=this.#u(this.#t,this.#l),t=this.#f(),n=this.#a,r=t?n:this.#d(e,this.#r?.combine);(t||n!==r)&&D.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},j=e(t(),1);function M({queries:e,...t},n){let r=v(n),i=Se(),a=ht(),o=j.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{Ue(e);let t=r.getQueryCache().get(e.queryHash);ke(e,a,t)}),c(a);let[s]=j.useState(()=>new $t(r,o,t)),[l,u,d]=s.getOptimisticResult(o,t.combine),f=!i&&t.subscribed!==!1;j.useSyncExternalStore(j.useCallback(e=>f?s.subscribe(D.batchCalls(e)):Et,[s,f]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),j.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let p=l.some((e,t)=>g(o[t],e))?l.flatMap((e,t)=>{let n=o[t];return n&&g(n,e)?re(n,new pe(r,n),a):[]}):[];if(p.length>0)throw Promise.all(p);let m=l.find((e,t)=>{let n=o[t];return n&&vt({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(m?.error)throw m.error;return u(d())}function N(e,t){let n=v(t),[r]=j.useState(()=>new Xt(n,e));j.useEffect(()=>{r.setOptions(e)},[r,e]);let i=j.useSyncExternalStore(j.useCallback(e=>r.subscribe(D.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=j.useCallback((e,t)=>{r.mutate(e,t).catch(Et)},[r]);if(i.error&&Ie(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function P(e={}){let t=e.projectId??i();return{projectId:t,cacheScope:e.cacheScope??(e.boot?`default`:t)}}function F(e,t={}){return{...P(t),runId:e}}function en(){return Kt(void 0,void 0)}function I(e){return!en()&&e}function tn(e,t=!0,n=!1,r){return y({queryKey:[P({projectId:e,boot:n}).cacheScope,`runs`,`list`],queryFn:({signal:t})=>De(P({projectId:e,boot:n}),{signal:t}),enabled:t,...r?{select:r}:{},placeholderData:(t,r)=>n&&r?.queryKey[0]===e?t:void 0})}function L(e,t,n=`active`){return e.invalidateQueries({queryKey:t===void 0?[`workspace`,`models`]:K.models(t),refetchType:n})}function nn(e,t=!0,n){return y({...rn(e,n),enabled:t})}var rn=(e,t)=>({queryKey:K.models(e,t),queryFn:({signal:n})=>Ct(e,{signal:n},t),staleTime:300*1e3});function an(e,t=!0){let n=M({queries:e.map(e=>({...rn(e),enabled:t}))});return Object.fromEntries(e.map((e,t)=>[e,n[t]]))}function on(e,t){return JSON.stringify([e,t])}function sn(e){return e.type===`run`?e.run.id:e.id}function R(e,t){return{...e,runs:t}}function cn(e,t){let n=0;for(let r of e)r.projectId===t&&r.archived&&(n+=1);return n}var ln=class{runs;copied=!1;positions=new Map;constructor(e){this.runs=e,this.reindex()}reindex(){this.positions.clear(),this.runs.forEach((e,t)=>this.positions.set(on(e.projectId,e.id),t))}at(e,t){return this.positions.get(on(e,t))??-1}mutable(){return this.copied||=(this.runs=[...this.runs],!0),this.runs}replace(e,t){return this.mutable()[e]=t,this.runs}remove(e){return this.mutable().splice(e,1),this.reindex(),this.runs}insert(e){let t=this.runs.findIndex(t=>(t.createdAt??``).localeCompare(e.createdAt)<0);return this.mutable().splice(t<0?this.runs.length:t,0,e),this.reindex(),this.runs}};function un(e,t,n){let r=new ln(e.runs),i=e,a=!1;for(let e of t)if(e.type===`usage`)i=gn(i,e.project,e.usage,r);else{let t=pn(i,e.change,n,r);i=t.index,a||=t.reconcile}return{index:i,reconcile:a}}function dn(e,t,n){return n?n.has(t):e.runs.some(e=>e.projectId===t)}function fn(e,t,n){return pn(e,t,n,new ln(e.runs))}function pn(e,t,n,r){let{project:i}=t,a=r.at(i,sn(t)),o=a>=0?e.runs[a]:void 0,s=e.truncated.includes(i);if(t.type===`deleted`)return o?{index:R(e,r.remove(a)),reconcile:s&&o.archived}:{index:e,reconcile:!1};let{run:c}=t;if(c.delegation?.role===`worker`)return o?{index:R(e,r.remove(a)),reconcile:!1}:{index:e,reconcile:!1};if(!o&&!dn(e,i,n))return{index:e,reconcile:!0};let l=$e(o,{projectId:i,...c});if(o){if(l===o)return{index:e,reconcile:!1};let t=r.replace(a,l),n=o.archived!==l.archived&&(s||cn(t,i)>e.perProjectLimit);return{index:R(e,t),reconcile:n}}if(s)return hn(e,l,r);let u=r.insert(l);return{index:R(e,u),reconcile:l.archived&&cn(u,i)>e.perProjectLimit}}function mn(e,t){let n;for(let r of e)r.projectId===t&&r.archived&&(n===void 0||r.createdAt<n)&&(n=r.createdAt);return n}function hn(e,t,n){let r=mn(e.runs,t.projectId),i=r!==void 0&&t.createdAt>r;return t.archived&&!i?{index:e,reconcile:!1}:{index:R(e,n.insert(t)),reconcile:t.archived||r===void 0||t.createdAt<r}}function gn(e,t,n,r){let i=!1;return e.runs.forEach((e,a)=>{if(e.projectId!==t)return;let o=n[e.id];if(o){let t=$e(e.usage,o);if(t===e.usage)return;r.replace(a,{...e,usage:t})}else{if(e.usage===void 0)return;let{usage:t,...n}=e;r.replace(a,n)}i=!0}),i?R(e,r.runs):e}function _n(e,t){let n=e.runs.filter(e=>e.projectId!==t),r=e.truncated.filter(e=>e!==t),i=Object.prototype.hasOwnProperty.call(e.referenceStatuses,t);if(n.length===e.runs.length&&r.length===e.truncated.length&&!i)return e;let a={...e.referenceStatuses};return delete a[t],{...e,runs:n,truncated:r,referenceStatuses:a}}function vn(){return{stream:void 0,lastStream:void 0,mismatch:void 0,floor:void 0,changes:new Map}}function yn(e,t,n){if(e.lastStream===t)e.floor=Math.max(e.floor??n,n);else{for(let[n,r]of e.changes)r.generation!==t&&e.changes.delete(n);e.floor=n}e.stream=t,e.lastStream=t,e.mismatch=void 0}function bn(e){e.stream=void 0}function xn(e,t,n=!1){let r=e.stream;if(r===void 0)return!1;(e.floor===void 0||n)&&(e.floor=t.seq-1);let i=JSON.stringify([r,t.project,sn(t)]),a=e.changes.get(i);return(!a||a.seq<t.seq)&&e.changes.set(i,{...t,generation:r}),!0}function Sn(e,t){for(let[n,r]of e.changes)r.project===t&&e.changes.delete(n)}function Cn(e){return typeof e.generation==`string`&&typeof e.eventSeq==`number`}function wn(e,t,n){if(!Cn(t))return{index:t,reconcile:!1};let{generation:r,eventSeq:i}=t;if(e.stream!==void 0&&e.stream!==r){let n=e.mismatch!==r;return e.mismatch=r,{index:t,reconcile:n}}let a=e.lastStream===r&&e.floor!==void 0,o=a&&i<e.floor,s=t,c=o,l=[...e.changes.entries()].filter(([,e])=>e.generation===r),u=l.map(([,e])=>e).filter(e=>e.seq>i).sort((e,t)=>e.seq-t.seq);for(let e of u){let t=fn(s,e,n);s=t.index,c||=t.reconcile}for(let[t,n]of l)n.seq<=i&&e.changes.delete(t);return a&&!o&&(e.floor=i),{index:s,reconcile:c}}var z=[`workspace`,`runs-index`],Tn=[`workspace`,`projects`],En=6e4,Dn=100,On=new WeakMap;function kn(e){let t=On.get(e);return t||(t=Pn(e),On.set(e,t)),t}function An(e,t){return typeof e!=`object`||!e||!Array.isArray(e.runs)?e:kn(t).merge(e)}function jn(e){let t=e.getQueryData(Tn)?.projects;return t?new Set(t.map(e=>e.id)):void 0}function Mn(e,t,n){if(!(!e||typeof e.eventSeq!=`number`||typeof t.eventSeq!=`number`))return e.generation===t.generation?t.eventSeq<e.eventSeq?e:void 0:n!==void 0&&e.generation===n&&t.generation!==n?e:void 0}function Nn(e,t){return t.type===`run-summary`?{type:`run`,project:e,seq:t.seq,run:t.summary}:{type:`deleted`,project:e,seq:t.seq,id:t.id}}function Pn(e){let t=vn(),n=[],r,i,a,o,s=!1,c=-1/0,l=new Set,u=!1,d,f=!1,p=()=>{if(!u){if(u=!0,d?.()){f=!0;return}g({hold:!0})}},m=t=>{c=Date.now(),e.setQueryData(z,t)},ee=()=>e.getQueryData(z),h=()=>{clearTimeout(a),a=void 0;let t=e.getQueryCache().find({queryKey:z,exact:!0}),n=(t!==void 0&&t.state.data===void 0&&t.state.fetchStatus!==`idle`?e.cancelQueries({queryKey:z,exact:!0}).then(()=>e.invalidateQueries({queryKey:z})):e.invalidateQueries({queryKey:z})).catch(()=>void 0).finally(()=>{o===n&&(o=void 0,s&&(s=!1,h()))});return o=n,n},g=(e={})=>o?(s=!0,o):e.hold?(a??=setTimeout(()=>{h()},400),Promise.resolve()):h(),_=()=>{r!==void 0&&typeof cancelAnimationFrame==`function`&&cancelAnimationFrame(r),r=void 0,clearTimeout(i),i=void 0;let t=n;n=[];let a=ee();if(!a||t.length===0)return;let o=jn(e),{index:s,reconcile:c}=un(a,t.filter(e=>e.generation===a.generation?e.type===`usage`?!l.has(e.project):!l.has(e.change.project)&&e.change.seq>a.eventSeq:!1),o);s!==a&&m(s),c&&g({hold:!0})},te=()=>{if(i!==void 0)return;let e=c+250-Date.now();if(e>0){i=setTimeout(_,e);return}i=setTimeout(_,Dn),typeof requestAnimationFrame==`function`&&(r=requestAnimationFrame(_))};return{ready(e,n){yn(t,e,n),u=!1,f&&(f=!1,g({hold:!0}))},detach(){bn(t)},run(e,r,i=!1){if(l.has(e))return;let a=Nn(e,r);if(!xn(t,a,i)){p();return}n.push({type:`change`,change:a,generation:t.stream}),te()},usage(e,r){if(!l.has(e)){if(t.stream===void 0){p();return}n.push({type:`usage`,project:e,usage:r,generation:t.stream}),te()}},dropProject(e){l.add(e),Sn(t,e),n=n.filter(t=>(t.type===`change`?t.change.project:t.project)!==e);let r=ee();if(!r)return;let i=_n(r,e);i!==r&&m(i)},setUnknownGenerationHandler(e){d=e},restoreProject(e){l.delete(e)},merge(n){let r=ee(),i=wn(t,n,jn(e));for(let e of l)i.index=_n(i.index,e);return i.reconcile&&queueMicrotask(()=>{g({hold:!0})}),Mn(r,n,t.stream)??i.index},reconcile:g,flush:_,stop(){r!==void 0&&typeof cancelAnimationFrame==`function`&&cancelAnimationFrame(r),r=void 0,clearTimeout(i),i=void 0,clearTimeout(a),a=void 0,n=[],s=!1}}}var Fn=O([`own`,`provider-spanning`]),In=b({suggested:w(b({id:E(),label:E(),desc:E()})),retired:w(E())}),Ln=b({id:O([`settings`,`mcp`,`memory`]),label:E(),note:E().optional(),empty:E().optional(),showsUserMcp:C(!0).optional()}),Rn=b({label:E(),note:E().optional(),groups:w(Ln)}),zn=b({runners:w(b({id:It,displayName:E(),modelListName:E(),modelIdScope:Fn,pickerLabel:E(),pickerDescription:E(),icon:E(),installHint:E(),loginCommand:E(),terminalLogin:T().optional(),browserLogin:T().optional(),managedInstall:C(!0).optional(),accountFolderExample:E().optional(),models:In,agentConfig:Rn}))}),Bn=[`workspace`,`runners`];async function Vn(e){return At(await Ze.api.v1.runners.$get({},nt(e)),`/runners`,zn)}var Hn={queryKey:Bn,queryFn:({signal:e})=>Vn({signal:e}),staleTime:1/0};function Un(){return y(Hn)}function Wn(e){return e?.runners??[]}function Gn(e){return Wn(e).map(e=>e.id)}function Kn(e,t){if(e!==void 0)return t.includes(e)?e:t[0]}function qn(e){let t=Un();return{runner:t.isSuccess?Kn(e,Gn(t.data))??e:e,ready:!t.isPending}}function B(e,t){return e?.runners.find(e=>e.id===t)}function Jn(e,t){return B(e,t)?.displayName??t}function Yn(e,t){return B(e,t)?.pickerLabel??t}function Xn(e,t){return B(e,t)?.modelListName}function Zn(e,t,n=!0,r){let a=Bi(r,n),o=J(),{runner:s,ready:c}=qn(e??a.data?.defaultRunner??`claude`),l=o.data?.capabilities?.localHandoff===!1?null:t,u=r??i(),d=y({queryKey:G.runnerSkills(s,l,u),queryFn:({signal:e})=>ne(s,l,{signal:e,projectId:u}),enabled:n&&c&&(e!==void 0||!a.isPending)&&(!t||!o.isPending),retry:!1});return{...d,runner:s,account:l,data:d.data?.skills,list:d.data,unchecked:d.isError||!d.data||d.data.source===`unavailable`}}var Qn={draft:{label:`Draft`,hint:`the author has not marked it ready for review`,tone:`neutral`},"review-required":{label:`Waiting for review`,hint:`checks are fine, no one has reviewed it yet`,tone:`info`},"changes-requested":{label:`Changes requested`,hint:`a reviewer asked for edits before this can merge`,tone:`danger`},"checks-pending":{label:`Checks running`,hint:`CI has not finished on the latest commit`,tone:`pending`},"checks-failing":{label:`Checks failing`,hint:`CI is red on the latest commit`,tone:`danger`},ready:{label:`Ready to merge`,hint:`open, checks pass, nothing is waiting on a reviewer`,tone:`success`},merged:{label:`Merged`,hint:`this landed on its base branch`,tone:`merged`},closed:{label:`Closed`,hint:`closed without merging — the work did not land`,tone:`danger`},open:{label:`Open`,hint:`still open on the tracker`,tone:`success`},completed:{label:`Closed as completed`,hint:`the issue was resolved`,tone:`accent`},"not-planned":{label:`Closed as not planned`,hint:`the issue was declined — nothing shipped for it`,tone:`neutral`}},$n={label:`Merge conflicts`,hint:`this branch no longer merges cleanly into its base — rebase or merge the base in`,tone:`conflict`};function er(e){return typeof e==`string`&&Object.hasOwn(Qn,e)}function tr(e){return e!==void 0&&er(e)?Qn[e]:void 0}var nr=`cez.reference-statuses.v1`,rr=`cez.reference-conflicts.v1`,V=new Map(lr()),ir=1e3,H=new Set(ur()),ar=r()??`__local__`;function or(){let e=r()??`__local__`;if(ar!==e){ar=e,clearTimeout(U),U=void 0,V.clear();for(let[e,t]of lr())V.set(e,t);H.clear();for(let e of ur())H.add(e)}}function sr(e,t){if(or(),V.get(e)!==t){for(V.delete(e),V.set(e,t);V.size>ir;){let e=V.keys().next().value;if(e===void 0)break;V.delete(e)}dr()}}function cr(e,t){if(or(),H.has(e)!==t){if(t)for(H.add(e);H.size>ir;){let e=H.values().next().value;if(e===void 0)break;H.delete(e)}else H.delete(e);dr()}}function lr(){try{let e=globalThis.sessionStorage?.getItem(A(nr));if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>Array.isArray(e)&&e.length===2&&typeof e[0]==`string`&&er(e[1])):[]}catch{return[]}}function ur(){try{let e=globalThis.sessionStorage?.getItem(A(rr));if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}var U;function dr(){if(U!==void 0)return;let e=A(nr),t=A(rr);U=setTimeout(()=>{U=void 0;try{globalThis.sessionStorage?.setItem(e,JSON.stringify([...V])),globalThis.sessionStorage?.setItem(t,JSON.stringify([...H]))}catch{}},250)}var W=e=>`${e.projectId}\u0000${e.kind}#${e.number}`;function fr(e,t){return{...e?{status:e}:{},...t?{conflicting:!0}:{}}}function pr(e){return[...e.prs.map(t=>({projectId:e.projectId,kind:`PR`,number:t})),...e.issues.map(t=>({projectId:e.projectId,kind:`Issue`,number:t}))]}function mr(e,t,n,r,i,a){let o=r.prs[n.number]??r.issues[n.number];if(!o){e.set(t,{state:`unknown`,...i?{status:i}:{}});return}let s=r.conflicts?r.conflicts.includes(n.number):void 0;sr(t,o),s!==void 0&&cr(t,s),e.set(t,{state:`ready`,status:o,...s??a?{conflicting:!0}:{}})}function hr(e,t,n){or();let r=W(t),i=V.get(r),a=H.has(r)?!0:void 0,o=n.data;if(o?.available){mr(e,r,t,o,i,a);return}if(o){e.set(r,{state:`unavailable`,reason:o.reason,...fr(i,a)});return}if(n.isError){e.set(r,{state:`unavailable`,reason:n.error instanceof Error?n.error.message:void 0,...fr(i,a)});return}e.set(r,{state:`loading`,...fr(i,a)})}function gr(e,t){let n=new Map;return t.forEach((t,r)=>{let i=e[r];if(i)for(let e of pr(i))hr(n,e,t)}),n}var G={get health(){return[i(),`health`]},runs:{get all(){return[i(),`runs`]},relationships:e=>[i(),`runs`,`relationships`,e],list:(e=i())=>[e,`runs`,`list`],archived:e=>[i(),`runs`,`archived`,e],detail:(e,t=i())=>[t,`runs`,`detail`,e],diff:e=>[i(),`runs`,`diff`,e],changes:e=>[i(),`runs`,`changes`,e],file:(e,t)=>[i(),`runs`,`files`,e,t],handoff:e=>[i(),`runs`,`handoff`,e],commits:e=>[i(),`runs`,`commits`,e],commit:(e,t)=>[i(),`runs`,`commit`,e,t]},get workflows(){return[i(),`workflows`]},runnerSkills:(e,t,n=i())=>[n,`runner-skills`,e,t??null],get repo(){return[i(),`repo`]},get repoChanges(){return[i(),`repo`,`changes`]},repoCommit:e=>[i(),`repo`,`commit`,e],get repoBranches(){return[i(),`repo`,`branches`]},get uiState(){return[i(),`ui-state`]},get config(){return[i(),`config`]},get agentConfig(){return[i(),`agent-config`]},agentConfigFile:e=>[i(),`agent-config`,`file`,e],get sessionContext(){return[i(),`session-context`]},sessionContextPreview:(e,t,n=``)=>[i(),`session-context`,`preview`,t,e,n],get worktrees(){return[i(),`worktrees`]},github:(e={})=>[i(),`github`,e.limit??null],githubPages:e=>[i(),`github`,`pages`,e],githubPagesHead:e=>[i(),`github`,`pages-head`,e],githubCommentCounts:(e,t)=>[i(),`github`,`comment-counts`,e,[...t].sort((e,t)=>e-t).join(`,`)],githubChecks:e=>[i(),`github`,`checks`,[...e].sort((e,t)=>e-t).join(`,`)],githubSearch:(e,t)=>[i(),`github`,`search`,e,t],githubRefStatus:(e,t,n)=>[e,`github`,`ref-status`,[...t].sort((e,t)=>e-t).join(`,`),[...n].sort((e,t)=>e-t).join(`,`)],githubComments:(e,t)=>[i(),`github`,`comments`,e,t],githubItem:(e,t)=>[i(),`github`,`item`,e,t],githubRefStatusOf:e=>[e,`github`,`ref-status`],githubPrChanges:e=>[i(),`github`,`pr-changes`,e],githubMergeState:e=>[i(),`github`,`merge-state`,e],get openTargets(){return[i(),`open-targets`]}},K={models:(e,t)=>t&&t!=="default"?[`workspace`,`models`,e,t]:[`workspace`,`models`,e],providerStatus:[`workspace`,`providers`,`status`],projects:[`workspace`,`projects`],githubOwners:[`workspace`,`github-owners`],runsIndex:z,runsSearch:e=>[`workspace`,`runs-search`,e],uiState:[`workspace`,`ui-state`],config:[`workspace`,`config`],agentProfiles:[`workspace`,`agent-profiles`],agentAccountStatus:e=>[`workspace`,`agent-profiles`,`status`,e],fsBrowseRoot:[`workspace`,`fs-browse`],fsBrowse:(e,t=!1)=>[...K.fsBrowseRoot,e,t]};function _r(e){if(!e)return;let t=e.trim().replace(/\/+$/,``),n=/^(?:https?|ssh|git|git\+ssh):\/\/(?:[^@/]+@)?([^/:]+)(?::\d+)?\/(.+)$/.exec(t),r=n?null:/^(?:[^@/:]+@)?([^:/]+):(.+)$/.exec(t),i=n??r;if(!i)return;let[,a,o]=i;if(!o||a?.toLowerCase()!==`github.com`)return;let s=o.replace(/\.git$/i,``).split(`/`).filter(Boolean),c=s[s.length-2],l=s[s.length-1];return c&&l?`https://github.com/${c}/${l}`:void 0}function vr(e){let t=new Map;for(let n of e)for(let e of n.tags??[]){let n=e.toLowerCase();t.has(n)||t.set(n,e)}return[...t.values()].sort((e,t)=>e.localeCompare(t,void 0,{sensitivity:`base`}))}function yr(e,t,n,r=8){let i=n.trim().toLowerCase(),a=new Set(t.map(e=>e.toLowerCase())),o=e.filter(e=>{let t=e.toLowerCase();return a.has(t)?!1:i===``||t.includes(i)&&t!==i});return i===``?o.slice(0,r):o.sort((e,t)=>Number(t.toLowerCase().startsWith(i))-Number(e.toLowerCase().startsWith(i))||e.localeCompare(t,void 0,{sensitivity:`base`})).slice(0,r)}function br(e){let t=new Map;for(let n of e){let e=n.trim();if(!e)continue;let r=e.toLowerCase();t.has(r)||t.set(r,e)}return[...t.values()].sort((e,t)=>e.localeCompare(t,void 0,{sensitivity:`base`}))}function xr(e,t){return yt({kind:`topic`,topic:e},{value:t})}function Sr(){let e=v();return y({queryKey:K.providerStatus,queryFn:async({signal:t})=>{let n=e.getQueryData(K.providerStatus),r=await Ee(!1,{signal:t});return mt(n,e.getQueryData(K.providerStatus),r)},staleTime:5*6e4,refetchInterval:I(!1),refetchOnWindowFocus:!0})}function Cr(){let e=v();return N({mutationFn:()=>Ee(!0),onMutate:()=>e.getQueryData(K.providerStatus),onSuccess:(t,n,r)=>{e.setQueryData(K.providerStatus,e=>mt(r,e,t)),L(e)}})}function wr(){let e=v();return N({mutationFn:({provider:e,authFailureId:t})=>de(e,t),onMutate:()=>e.getQueryData(K.providerStatus),onSuccess:(t,n,r)=>{e.setQueryData(K.providerStatus,e=>mt(r,e,t,n.authFailureId)),L(e,n.provider)}})}function Tr(e={}){return y({queryKey:K.projects,queryFn:({signal:e})=>Ce({signal:e}),...e})}function Er(e,t=!1){return y({queryKey:K.fsBrowse(e,t),queryFn:({signal:n})=>Lt(e??void 0,{signal:n,showHidden:t}),retry:!1})}function Dr(){let e=v();return N({mutationFn:e=>Re(e),onSuccess:()=>e.invalidateQueries({queryKey:K.projects})})}function Or(){let e=v();return N({mutationFn:e=>u(e),retry:!1,onSuccess:(t,n)=>{e.setQueryData(K.projects,e=>e&&{...e,projects:e.projects.filter(e=>e.id!==n)}),e.invalidateQueries({queryKey:K.projects})}})}function kr(){let e=v();return N({mutationFn:e=>{let{id:t,...n}=e;return Dt(t,n)},retry:!1,onMutate:async({id:t,...n})=>{await e.cancelQueries({queryKey:K.projects});let r=e.getQueryData(K.projects);return e.setQueryData(K.projects,e=>e===void 0?e:{...e,projects:e.projects.map(e=>e.id===t?Ar(e,n):e)}),{previous:r}},onError:(t,n,r)=>{r?.previous&&e.setQueryData(K.projects,r.previous)},onSuccess:({project:t})=>{e.setQueryData(K.projects,e=>e===void 0?e:{...e,projects:e.projects.map(e=>e.id===t.id?t:e)})},onSettled:()=>e.invalidateQueries({queryKey:K.projects})})}function Ar(e,t){let{maxParallel:n,tags:r,...i}=e,a={...i},o=`maxParallel`in t?t.maxParallel:e.maxParallel;o!=null&&(a.maxParallel=o);let s=`tags`in t&&t.tags!==void 0?t.tags:e.tags,c=s==null?[]:br(s);if(c.length>0&&(a.tags=c),`webhook`in t&&t.webhook!==void 0)if(t.webhook===null)delete a.webhook;else{let n=t.webhook.token===void 0?e.webhook?.tokenSet??!1:t.webhook.token!==``;a.webhook={url:t.webhook.url,tokenSet:n}}return a}function jr(e){let t=v();return N({mutationFn:e,retry:!1,onSuccess:({project:e})=>{t.setQueryData(K.projects,t=>t===void 0?t:{...t,projects:t.projects.map(t=>t.id===e.id?e:t)})},onSettled:()=>t.invalidateQueries({queryKey:K.projects})})}function Mr(){return jr(e=>{let{projectId:t,...n}=e;return ie(t,n)})}function Nr(){return jr(e=>{let{projectId:t,webhookId:n,...r}=e;return ge(t,n,r)})}function Pr(){return jr(({projectId:e,webhookId:t})=>Ke(e,t))}function Fr(){return N({mutationFn:({projectId:e,webhookId:t})=>le(e,t),retry:!1})}function q(e){let t=v();return N({mutationFn:e,retry:!1,onSuccess:async()=>{await Promise.all([t.invalidateQueries({queryKey:K.agentProfiles}),t.invalidateQueries({queryKey:K.projects}),t.invalidateQueries({predicate:({queryKey:e})=>e[1]===`runner-skills`}),L(t)])},onError:()=>{t.invalidateQueries({queryKey:G.health}),t.invalidateQueries({queryKey:K.agentProfiles,exact:!0})}})}function Ir(){return q(e=>Nt(e))}function Lr(){return q(e=>{let{id:t,...n}=e;return ye(t,n)})}function Rr(){return q(e=>Ht(e))}function zr(){return q(e=>Ge(e))}function Br(e,t){return y({queryKey:K.agentAccountStatus(e),queryFn:({signal:t})=>_(e,{signal:t}),enabled:t,staleTime:6e4,retry:!1})}function Vr(){let e=v();return N({mutationFn:({provider:e,profileId:t})=>p(e,t),retry:!1,onSuccess:async(t,{provider:n})=>{await Promise.all([e.invalidateQueries({queryKey:K.agentProfiles}),e.invalidateQueries({queryKey:K.providerStatus}),L(e,n,`none`)])},onError:()=>{e.invalidateQueries({queryKey:G.health}),e.invalidateQueries({queryKey:K.agentProfiles,exact:!0})}})}function Hr(){let e=v();return N({mutationFn:e=>_(e,{refresh:!0}),retry:!1,onSuccess:(t,n)=>{e.setQueryData(K.agentAccountStatus(n),t),e.invalidateQueries({queryKey:K.agentProfiles}),L(e,t.status.provider)}})}function Ur(){let e=v();return N({mutationFn:e=>Be(e),retry:!1,onSuccess:()=>e.invalidateQueries({queryKey:K.projects})})}function Wr(){let e=v();return N({mutationFn:e=>We(e),retry:!1,onSuccess:()=>e.invalidateQueries({queryKey:K.projects})})}function Gr({enabled:e}){return y({queryKey:K.githubOwners,queryFn:({signal:e})=>l({signal:e}),enabled:e,staleTime:6e4,retry:!1})}function Kr(){let e=v();(0,j.useEffect)(()=>{let t,r=()=>{let r=e.getQueryData(G.health);r&&(Ve({bootProject:r.bootProject===void 0?`default`:r.bootProject,apiBase:n()}),t??=xr(`health`,t=>{e.setQueryData(G.health,t)}))};r();let i=e.getQueryCache().subscribe(r);return()=>{i(),t?.(),je()}},[e])}function J(){return y({queryKey:G.health,queryFn:({signal:e})=>gt({signal:e})})}function qr(e,t){let n=J().data,r=Tr(t).data?.projects,i=it(),a=e??i.projectId,o=a??n?.bootProject??void 0,s=o===void 0?void 0:r?.find(e=>e.id===o);return s?.repoUrl?s.repoUrl:n?.bootProject!==null&&(a===null||a===n?.bootProject)?_r(n?.repo?.remote):void 0}function Jr(e=!0){return y({queryKey:K.uiState,queryFn:({signal:e})=>se({signal:e}),enabled:e})}function Yr(){return y({queryKey:K.config,queryFn:({signal:e})=>Ne({signal:e})})}function Xr(){return y({queryKey:K.agentProfiles,queryFn:({signal:e})=>Ae({signal:e})})}var Y=[`workspace`,`runs-index`],X=e=>[e.cacheScope,`runs`,`list`],Z=e=>[e.cacheScope,`runs`,`detail`,e.runId],Q=e=>typeof e==`function`?e():e;function Zr(e){let{seenAt:t,...n}=e;return n}function Qr(e,t){let n=Zr(e);return t.seenAt===void 0?n:{...n,seenAt:t.seenAt}}function $r(e,t,n){return t?{...e,seenAt:n}:Zr(e)}function ei(e){let t=()=>{e.invalidateQueries({queryKey:Y})};function n(n,r){if(n===`index`)return t();let a=typeof r==`function`?r():r;if(n===`indexed`){t(),e.invalidateQueries({queryKey:[i(),`runs`]}),e.invalidateQueries({queryKey:[a.projectId,`runs`,`list`]});return}if(n===`runs`)return e.invalidateQueries({queryKey:[a.cacheScope,`runs`]});let o=m(),s=[a.projectId,a.cacheScope],c=o!==void 0&&s.some(e=>e===o||e==="default")?[o,`default`]:[],l=new Set([...s,...c,i()]);return Promise.all([...l].map(t=>e.invalidateQueries({queryKey:[t,`runs`]}))).then(()=>void 0)}async function r(n,r){await e.cancelQueries({queryKey:X(Q(n))}),await e.cancelQueries({queryKey:Z(Q(n))});let i=e.getQueryData(X(Q(n))),a=e.getQueryData(Z(Q(n))),o=Q(n).runId,s=new Date().toISOString();return e.setQueryData(X(Q(n)),e=>e?.map(e=>e.id===o?$r(e,r,s):e)),e.setQueryData(Z(Q(n)),e=>e&&$r(e,r,s)),{id:o,prevList:i,prevDetail:a,rollback(){if(!r){i&&e.setQueryData(X(Q(n)),i),a&&e.setQueryData(Z(Q(n)),a);return}let t=i?.find(e=>e.id===o);t&&e.setQueryData(X(Q(n)),e=>e?.map(e=>e.id===o?Qr(e,t):e)),a&&e.setQueryData(Z(Q(n)),e=>e&&Qr(e,a))},settle(i){let a=e=>e.id===(r?o:i.id)?$r(e,r,i.seenAt):e;e.setQueryData(X(Q(n)),e=>e?.map(a));let s={...Q(n),runId:r?o:i.id};e.setQueryData(Z(s),e=>e?a(e):i),t()}}}async function a(t,r){await e.cancelQueries({queryKey:Y});let i=e.getQueryData(Y),a=r();return e.setQueryData(Y,e=>e===void 0?e:{...e,runs:e.runs.map(e=>e.projectId===t.projectId&&e.id===t.runId?a(e):e)}),{previous:i,rollback(){i&&e.setQueryData(Y,i)},settle(){n(`indexed`,t)}}}return{patchRead:r,patchIndex:a,invalidateAfter:n}}function $(){let e=v();return(0,j.useMemo)(()=>ei(e),[e])}function ti(e,t){if(!Wt(e.path))throw Error(`unsupported shared read`);let n=new URL(e.path,`http://cezar.invalid`);return n.searchParams.sort(),yt({kind:`read`,path:`${n.pathname}${n.search}`,intervalMs:e.intervalMs},{value:t})}function ni(e,t,n,r){let i=v(),a=JSON.stringify(t),o=(0,j.useMemo)(()=>JSON.parse(a),[a]);(0,j.useEffect)(()=>{if(!e||n===!1)return;let t=!0,a=ti({path:e,intervalMs:n},(e,n)=>{n||i.cancelQueries({queryKey:o,exact:!0}).then(()=>{t&&i.setQueryData(o,r?r(e,i):e)})});return()=>{t=!1,a()}},[i,e,o,n,r])}async function ri(e,t=!1){return ut(await Ze.api.v1.p[`:projectId`].runs[`:id`][`worker-destroy`].$post({param:{projectId:i(),id:encodeURIComponent(e)},query:{},json:t?{discardWork:!0}:{}}),o(e,`/worker-destroy`))}function ii(){return y({queryKey:G.openTargets,queryFn:({signal:e})=>Rt({signal:e}),staleTime:5*6e4})}function ai(e=!0,t){return y({queryKey:t?G.runs.list(t):G.runs.list(),queryFn:({signal:e})=>De(P(t?{projectId:t}:void 0),{signal:e}),enabled:e})}function oi(e,t){return f({queryKey:G.runs.archived(e),enabled:t,initialPageParam:void 0,queryFn:({pageParam:t,signal:n})=>ft({before:t,limit:200,q:e},{signal:n}),getNextPageParam:e=>e.nextCursor??void 0,placeholderData:(e,t)=>t?.queryKey[0]===i()?e:void 0})}function si(e){let t=e.trim();return y({queryKey:K.runsSearch(t),queryFn:({signal:e})=>be(t,{signal:e}),enabled:t.length>=2,placeholderData:Je,staleTime:1e4})}function ci(e=!0,t=En,n){let r=kn(v());return ni(`/api/v1/workspace/runs-index`,K.runsIndex,I(e?t:!1),An),y({queryKey:K.runsIndex,queryFn:({signal:e})=>Pe({signal:e}).then(r.merge),enabled:e,...n?{select:n}:{},staleTime:3e4,refetchInterval:!1})}function li(e){let t=v();return N({mutationFn:({workerId:e,discardWork:t=!1})=>ri(e,t),onSettled:()=>t.invalidateQueries({queryKey:G.runs.relationships(e)})})}function ui(e,t={}){return y({queryKey:G.runs.relationships(e),queryFn:({signal:t})=>we(e,{signal:t}),enabled:t.enabled??!0})}function di(e){return y({queryKey:G.runs.detail(e??``),queryFn:({signal:t})=>He(F(e),{signal:t}),enabled:!!e})}function fi(e,t,n=!0,r){return y({queryKey:[e??`default`,`runs`,`detail`,t??``],queryFn:({signal:n})=>He(F(t,{projectId:e}),{signal:n}),enabled:n&&!!e&&!!t,...r?.staleTime===void 0?{}:{staleTime:r.staleTime},...r?.refetchOnMount===void 0?{}:{refetchOnMount:r.refetchOnMount}})}function pi(e,t){return y({queryKey:t?[t,`runs`,`diff`,e??``]:G.runs.diff(e??``),queryFn:({signal:n})=>te(e,{signal:n,...t?{projectId:t}:{}}),enabled:!!e})}function mi(e,t=!1){return ni(e?`/api/v1/p/${i()}/runs/${encodeURIComponent(e)}/changes`:void 0,G.runs.changes(e??``),I(t?4e3:!1)),y({queryKey:G.runs.changes(e??``),queryFn:({signal:t})=>ee(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:!1,refetchOnWindowFocus:!0,staleTime:0})}function hi(e,t){return y({queryKey:G.runs.file(e??``,t??``),queryFn:({signal:n})=>Me(e,t,{signal:n}),enabled:!!e&&t!==void 0,retry:!1})}function gi(e,t){return y({queryKey:[i(),`runs`,`file-link`,e,t],queryFn:({signal:n})=>ct(e,t,{signal:n}),enabled:t!==null,retry:!1})}function _i(e,t){return y({queryKey:[i(),`runs`,`artifact`,e,t],queryFn:({signal:n})=>rt(e,t,{signal:n}),enabled:t!==null,retry:!1})}function vi(e,t){return y({queryKey:[i(),`runs`,`artifact-metadata`,e,t],queryFn:({signal:n})=>Mt(e,t,{signal:n}),enabled:t!==null,retry:!1})}function yi(e){return y({queryKey:[i(),`runs`,`artifacts`,e],queryFn:({signal:t})=>Bt(e,{signal:t}),retry:!1,staleTime:0,refetchOnWindowFocus:!0})}function bi(e,t=!1){return ni(e?`/api/v1/p/${i()}/runs/${encodeURIComponent(e)}/commits`:void 0,G.runs.commits(e??``),I(t?5e3:!1)),y({queryKey:G.runs.commits(e??``),queryFn:({signal:t})=>ae(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:!1})}function xi(e,t){return y({queryKey:G.runs.commit(e??``,t??``),queryFn:({signal:n})=>Pt(e,t,{signal:n}),enabled:!!e&&!!t,retry:!1})}function Si(e,t=!0){return y({queryKey:G.runs.handoff(e??``),queryFn:({signal:t})=>bt(F(e),{signal:t}),enabled:!!e&&t})}function Ci(e,t,n){return y({queryKey:e===void 0?G.runs.handoff(t):[e,`runs`,`handoff`,t],queryFn:({signal:n})=>bt(F(t,{projectId:e}),{signal:n}),enabled:n,staleTime:15e3})}function wi(e,t){let n=[...new Set(e)],r=M({queries:n.map(e=>({queryKey:[e??i(),`automations`,`names`],queryFn:({signal:t})=>jt({signal:t,archived:`include`,...e===void 0?{}:{projectId:e}}),enabled:t,staleTime:6e4,retry:!1}))}),a=r.map(e=>e.data);return(0,j.useMemo)(()=>{let e=new Map;return a.forEach((t,r)=>{if(t?.available)for(let i of t.automations)e.set(JSON.stringify([n[r]??null,i.id]),i.name)}),(t,n)=>e.get(JSON.stringify([t??null,n]))},[JSON.stringify([n,r.map(e=>e.dataUpdatedAt)])])}function Ti(e){let t=v();return N({mutationFn:t=>me(e,t),retry:!1,onSuccess:()=>t.invalidateQueries({queryKey:G.runs.all})})}function Ei(e){let t=v();return N({mutationFn:t=>qe(e,t),onSuccess:()=>t.invalidateQueries({queryKey:G.runs.all})})}function Di(e){let t=$(),n=e?.projectId,r=e?.cacheScope,i=N({mutationFn:e=>_e(e,!0),onMutate:e=>t.patchRead(e,!0),onError:(e,t,n)=>n?.rollback(),onSuccess:(e,t,n)=>n?.settle(e)}),a=(0,j.useCallback)(e=>({...F(e,{projectId:n,cacheScope:r}),id:e}),[n,r]),o=(0,j.useCallback)(e=>({onSuccess:(t,n,r,i)=>e?.onSuccess?.(t,n.id,r,i),onError:(t,n,r,i)=>e?.onError?.(t,n.id,r,i),onSettled:(t,n,r,i,a)=>e?.onSettled?.(t,n,r.id,i,a)}),[]),{mutate:s,mutateAsync:c}=i,l=(0,j.useCallback)((e,t)=>s(a(e),o(t)),[s,a,o]),u=(0,j.useCallback)((e,t)=>c(a(e),o(t)),[c,a,o]);return{...i,variables:i.variables?.id,mutate:l,mutateAsync:u}}function Oi(){let e=$();return N({mutationFn:e=>_e(F(e),!1),onMutate:t=>e.patchRead(()=>F(t),!1),onError:(e,t,n)=>n?.rollback(),onSuccess:(e,t,n)=>n?.settle(e)})}function ki(e){let t=$();return N({mutationFn:({id:t,pinned:n})=>fe(F(t,e),n),onError:e=>St(`Could not update pin. ${e.message} Please retry.`,{tone:`danger`}),onMutate:()=>e??P(),onSuccess:(e,n,r)=>t.invalidateAfter(`runs`,r)})}function Ai(e,t){let n=$();return N({mutationFn:n=>Ot(F(e,{projectId:t}),n),onMutate:()=>P({projectId:t}),onSuccess:(e,t,r)=>n.invalidateAfter(`send`,r),onError:(e,t,r)=>{e instanceof et&&e.status===409&&r&&n.invalidateAfter(`send`,r)}})}function ji(e,t){let n=$();return N({mutationFn:(n={})=>lt(F(e,{projectId:t}),n),onMutate:()=>P({projectId:t}),onSuccess:(e,t,r)=>n.invalidateAfter(`continue`,r)})}function Mi(e){let t=v();return N({mutationFn:({msgId:t,message:n})=>wt(e,t,n),onSuccess:()=>t.invalidateQueries({queryKey:G.runs.all})})}function Ni(e){let t=v();return N({mutationFn:t=>Ye(e,t),onSuccess:()=>t.invalidateQueries({queryKey:G.runs.all})})}function Pi(){return y({queryKey:G.workflows,queryFn:({signal:e})=>_t({signal:e})})}function Fi(e){return y({queryKey:e?[e,`repo`]:G.repo,queryFn:({signal:t})=>at({signal:t},e)})}function Ii(e){return y({queryKey:[e,`repo`],queryFn:({signal:t})=>at({signal:t},e)})}function Li(){return y({queryKey:G.repoBranches,queryFn:({signal:e})=>Ft({signal:e})})}function Ri(){return y({queryKey:G.repoChanges,queryFn:({signal:e})=>ze({signal:e}),retry:!1})}function zi(e){return y({queryKey:G.repoCommit(e??``),queryFn:({signal:t})=>d(e,{signal:t}),enabled:!!e,retry:!1})}function Bi(e,t=!0){return y({queryKey:e?[e,`config`]:G.config,queryFn:({signal:t})=>zt({signal:t,...e?{projectId:e}:{}}),enabled:t})}function Vi(){return y({queryKey:G.worktrees,queryFn:({signal:e})=>s({signal:e})})}function Hi(e){return y({queryKey:[e,`worktrees`],queryFn:({signal:t})=>s({signal:t},e),staleTime:0})}function Ui(e,t=!0,n=!1){return y({queryKey:[P({projectId:e,boot:n}).cacheScope,`ui-state`],queryFn:({signal:t})=>Oe({signal:t},e),select:e=>e.sidebarLimits===void 0?e:{...e,sidebarLimits:st(e.sidebarLimits)},enabled:t})}function Wi(e=!0,t){return Ui(t??i(),e)}function Gi(){return y({queryKey:G.agentConfig,queryFn:({signal:e})=>xt({signal:e})})}function Ki(e){return y({queryKey:G.agentConfigFile(e??``),queryFn:({signal:t})=>pt(e,{signal:t}),enabled:e!==null})}function qi(){return y({queryKey:G.sessionContext,queryFn:({signal:e})=>h({signal:e})})}function Ji(e,t,n=``){return y({queryKey:G.sessionContextPreview(e,t,n),queryFn:({signal:n})=>Te({content:e,role:t},{signal:n}),placeholderData:Je,staleTime:0,retry:!1})}function Yi(){let e=v();return N({onMutate:()=>({fileKey:G.sessionContext}),mutationFn:e=>xe(e),onSuccess:(t,n,r)=>{r&&e.setQueryData(r.fileKey,t)}})}function Xi(e){let t=v(),n=G.agentConfig,r=G.agentConfigFile(e);return N({mutationFn:t=>oe(e,t),onSuccess:e=>{t.setQueryData(r,e),t.invalidateQueries({queryKey:n})}})}var Zi=O([`passing`,`failing`,`pending`]).nullable(),Qi=b({kind:O([`issue`,`pr`]),number:k(),title:E(),author:E(),createdAt:E(),labels:w(E()),body:E().optional(),url:E(),comments:k(),assignees:w(E()).optional(),projectIds:w(E()).optional(),isDraft:T().optional(),additions:k().optional(),deletions:k().optional(),checks:Zi.optional()});x(`available`,[b({available:C(!0),item:Qi.nullable(),labelColors:S(E(),E()).optional()}),b({available:C(!1),reason:E()})]),b({kind:O([`issue`,`pr`]),number:Ut().int().positive().safe()});var $i=b({id:E(),title:E(),url:E()});b({available:T(),reason:E().optional(),repo:E().optional(),syncedAt:E().optional(),issues:w(Qi),prs:w(Qi),labelColors:S(E(),E()).optional(),viewerLogin:E().optional(),projects:w($i).optional(),projectsReason:E().optional(),projectsState:O([`refreshing`,`ready`,`unavailable`]).optional(),projectsGeneration:E().optional(),issuesTotal:k().int().nonnegative().optional(),prsTotal:k().int().nonnegative().optional(),issuesNextCursor:E().nullable().optional(),prsNextCursor:E().nullable().optional(),commentsDeferred:C(!0).optional()});var ea=E().min(1).max(2e3).optional();b({limit:E().optional(),refresh:E().optional(),issuesCursor:ea,prsCursor:ea,issuesDone:C(`1`).optional(),prsDone:C(`1`).optional()}).superRefine((e,t)=>{e.issuesDone&&e.issuesCursor&&t.addIssue({code:`custom`,message:`issuesDone and issuesCursor are exclusive`}),e.prsDone&&e.prsCursor&&t.addIssue({code:`custom`,message:`prsDone and prsCursor are exclusive`}),e.issuesDone&&e.prsDone&&t.addIssue({code:`custom`,message:`both sides are done; there is no page to ask for`})}),b({kind:O([`issue`,`pr`]),numbers:E().regex(/^[1-9]\d{0,15}(,[1-9]\d{0,15})*$/).refine(e=>{let t=e.split(`,`);return t.length<=100&&t.every(e=>Number.isSafeInteger(Number(e)))},{message:`at most 100 safe positive integers`}),refresh:C(`1`).optional()}),x(`available`,[b({available:C(!0),counts:S(k(),k().int().nonnegative())}),b({available:C(!1),reason:E()})]),x(`available`,[b({available:C(!0),checks:S(k(),Zi)}),b({available:C(!1),reason:E()})]),b({kind:O([`issue`,`pr`]),q:E().trim().min(1).max(256),limit:Ut().int().positive().max(50).optional()}),b({available:T(),projectsReason:E().optional(),reason:E().optional(),items:w(Qi),truncated:T().optional(),labelColors:S(E(),E()).optional()});var ta=k().nullable();x(`available`,[b({available:C(!0),prs:S(k(),ot),issues:S(k(),ot),conflicts:w(k()).optional(),recheckAfterMs:ta}),b({available:C(!1),reason:E(),recheckAfterMs:ta})]);var na=b({id:k(),author:E(),avatarUrl:E().optional(),createdAt:E(),body:E(),kind:O([`comment`,`review`]),reviewState:O([`approved`,`changes_requested`,`commented`,`dismissed`]).optional(),url:E()}),ra=O([`committed`,`labeled`,`unlabeled`,`assigned`,`unassigned`,`merged`,`closed`,`reopened`,`head_ref_force_pushed`,`cross-referenced`,`renamed`]),ia=b({id:E(),kind:ra,actor:E(),avatarUrl:E().optional(),createdAt:E(),url:E().optional(),sha:E().optional(),message:E().optional(),checks:Zi.optional(),label:b({name:E(),color:E().optional()}).optional(),subject:E().optional(),refNumber:k().optional(),refTitle:E().optional(),refIsPr:T().optional()});b({available:T(),reason:E().optional(),comments:w(na),truncated:T().optional(),events:w(ia).optional(),detail:b({body:E(),additions:k().int().nonnegative().optional(),deletions:k().int().nonnegative().optional()}).optional()});var aa=O([`merge`,`squash`,`rebase`]),oa=b({name:E(),state:O([`passing`,`failing`,`pending`,`unknown`]),required:T().nullable(),url:E().optional()}),sa=b({number:k(),title:E(),url:E(),state:O([`open`,`closed`,`merged`]),isDraft:T(),headRef:E(),baseRef:E(),headSha:E(),mergeable:O([`mergeable`,`conflicting`,`unknown`]),reviewDecision:O([`approved`,`changes-requested`,`review-required`,`not-required`,`unknown`]),checks:w(oa),methods:w(aa),defaultMethod:aa.nullable(),eligibility:O([`ready`,`blocked`,`pending`,`unauthorized`,`terminal`,`unknown`]),blockers:w(b({code:E(),message:E()})),canMerge:T(),canOverride:T()});x(`available`,[b({available:C(!0),mergeState:sa}),b({available:C(!1),reason:E()})]),b({merged:C(!0),number:k(),url:E(),method:aa,mergeCommitSha:E().optional()});var ca=b({path:E(),previousPath:E().optional(),status:O([`added`,`modified`,`removed`,`renamed`,`copied`,`changed`]),additions:k(),deletions:k(),patch:E().optional(),patchUnavailableReason:O([`binary`,`too-large`,`not-provided`]).optional(),truncated:T().optional()});x(`available`,[b({available:C(!0),number:k(),headSha:E(),files:w(ca),additions:k(),deletions:k(),truncated:T(),reason:E().optional()}),b({available:C(!1),reason:E()})]),b({generation:E().uuid()}),x(`state`,[b({generation:E().uuid(),state:C(`ready`),projects:w($i),membership:S(E(),w(E()))}),b({generation:E().uuid(),state:C(`unavailable`),reason:E()})]);function la(e){if(!e.available)return;let t=e.issuesNextCursor,n=e.prsNextCursor;if(!(t===void 0&&n===void 0)&&!(!t&&!n))return{...t?{issuesCursor:t}:{issuesDone:!0},...n?{prsCursor:n}:{prsDone:!0}}}function ua(e,t){return e?(t===`issues`?e.issuesNextCursor:e.prsNextCursor)==null:!1}function da(e,t,n){for(let r of e)t.has(r.number)||(t.add(r.number),n.push(r))}function fa(e){let t=e[0];if(!t)return;let n=e[e.length-1],r=[],i=[],a=new Set,o=new Set,s={};for(let t of e){da(t.issues,a,r),da(t.prs,o,i);for(let[e,n]of Object.entries(t.labelColors??{}))s[e]??=n}let c=e.find(e=>e.projects)?.projects,l=e.map(e=>e.projectsState),u=e.find(e=>e.projectsState===`unavailable`),d=l.includes(`refreshing`)?`refreshing`:u?`unavailable`:l.some(e=>e===`ready`)?`ready`:void 0,{projectsGeneration:f,projectsReason:p,...m}=t;return{...m,issues:r,prs:i,...Object.keys(s).length>0?{labelColors:s}:{},...c?{projects:c}:{},...d?{projectsState:d}:{},...d===`unavailable`&&u?.projectsReason?{projectsReason:u.projectsReason}:{},...`issuesNextCursor`in n?{issuesNextCursor:n.issuesNextCursor}:{},...`prsNextCursor`in n?{prsNextCursor:n.prsNextCursor}:{}}}var pa=e=>e.map(e=>e.number).join(`,`);function ma(e,t){let n=e[0];if(e.length>1&&n&&(pa(n.issues)!==pa(t.issues)||pa(n.prs)!==pa(t.prs)||n.issuesTotal!==t.issuesTotal||n.prsTotal!==t.prsTotal))return`refetch`;let r=t;if(n&&t.available&&t.projectsState===`refreshing`&&n.repo===t.repo){let e=new Map(n.issues.map(e=>[e.number,e.projectIds]));r={...t,issues:t.issues.map(t=>{let n=e.get(t.number);return t.projectIds===void 0&&n!==void 0?{...t,projectIds:n}:t})}}return[r,...e.slice(1)]}var ha=class extends Error{};function ga(e,t,n){return{queryKey:e,initialPageParam:{},queryFn:async({pageParam:e,signal:r})=>{let i=await ce({limit:t,...e,...n?{projectId:n}:{}},{signal:r});if(!i.available&&Object.keys(e).length>0)throw new ha(i.reason??`GitHub is unavailable.`);return i},getNextPageParam:e=>la(e),retry:(e,t)=>!(t instanceof ha)&&!(t instanceof et&&t.status>=400&&t.status<500)&&e<1,staleTime:6e4,refetchOnWindowFocus:!0}}function _a(e=50,t=!0){let n=v(),r=G.githubPages(e),a=G.githubPagesHead(e);ni(`/api/v1/p/${i()}/github?limit=${e}`,a,I(t?6e4:!1));let o=f({...ga(r,e),enabled:t,refetchInterval:!1,refetchIntervalInBackground:!1}),s=y({queryKey:a,queryFn:({signal:t})=>ce({limit:e},{signal:t}),enabled:!1,staleTime:1/0}),{refetch:c}=o;(0,j.useEffect)(()=>{if(!s.data)return;let e=n.getQueryData(r);if(!e||e.pages.length===0)return;let t=ma(e.pages,s.data);t===`refetch`?c():n.setQueryData(r,{...e,pages:t})},[n,s.dataUpdatedAt,c]);let l=(o.data?.pages??[]).flatMap(e=>e.projectsState===`refreshing`&&e.projectsGeneration?[e.projectsGeneration]:[]),u=M({queries:l.map(e=>({queryKey:[...r,`projects`,e],queryFn:({signal:t})=>Fe(e,{signal:t}),enabled:t,staleTime:1/0,retry:!1}))});return(0,j.useEffect)(()=>{u.forEach((e,t)=>{let i=l[t];!i||!e.data&&!e.error||n.setQueryData(r,t=>{if(!t)return t;let n=!1,r=t.pages.map(t=>{if(t.projectsGeneration!==i||t.projectsState!==`refreshing`)return t;let r=e.data;return r?.generation&&r.generation!==i?t:(n=!0,r?.state===`ready`?{...t,projectsState:`ready`,projects:r.projects,issues:t.issues.map(e=>({...e,projectIds:r.membership?.[e.number]??[]}))}:{...t,projectsState:`unavailable`,projectsReason:r?.reason??`Project boards unavailable. Refresh to try again.`})});return n?{...t,pages:r}:t})})},[n,u.map((e,t)=>e.data||e.error?l[t]:``).join(`,`)]),{pages:o,data:(0,j.useMemo)(()=>fa(o.data?.pages??[]),[o.data])}}function va(e,t=50,n=!0){let r=f({...ga([e,`github`,`pages`,t],t,e),enabled:n});return{pages:r,data:(0,j.useMemo)(()=>fa(r.data?.pages??[]),[r.data])}}function ya(e,t,n=!0){let r=M({queries:t.filter(e=>e.length>0).map(t=>({queryKey:G.githubCommentCounts(e,t),queryFn:({signal:n})=>Tt(e,t,{},{signal:n}),enabled:n,staleTime:6e4}))});return(0,j.useMemo)(()=>{let e={};for(let t of r)t.data?.available&&Object.assign(e,t.data.counts);return e},[r.map(e=>e.dataUpdatedAt).join(`,`)])}function ba(e,t,n,r=!0){return y({queryKey:[e,`github`,`search`,t,n],queryFn:({signal:r})=>dt(t,n,{projectId:e},{signal:r}),enabled:r&&n.trim()!==``,staleTime:6e4})}function xa(e,t=!0){return y({queryKey:G.githubChecks(e),queryFn:({signal:t})=>ve(e,{signal:t}),enabled:t&&e.length>0,staleTime:6e4})}function Sa(e,t,n=!0){return y({queryKey:G.githubSearch(e,t),queryFn:({signal:n})=>dt(e,t,{},{signal:n}),enabled:n&&t.trim()!==``,staleTime:6e4})}var Ca=100;function wa(e){return[...e].sort((e,t)=>t-e).slice(0,Ca).sort((e,t)=>e-t)}function Ta(){let e=it(),t=J();return e.projectId??t.data?.bootProject??void 0}function Ea(e){for(let[t,n]of Object.entries(e)){for(let[e,r]of Object.entries(n.prs))sr(W({projectId:t,kind:`PR`,number:Number(e)}),r);for(let[e,r]of Object.entries(n.issues))sr(W({projectId:t,kind:`Issue`,number:Number(e)}),r)}}var Da=5*6e4;function Oa(e){return e?e.recheckAfterMs:Da}function ka(e,t=!0){let n=(0,j.useMemo)(()=>{let t=new Map;for(let n of e){let e=t.get(n.projectId)??{prs:new Set,issues:new Set};e[n.kind===`PR`?`prs`:`issues`].add(n.number),t.set(n.projectId,e)}return[...t.entries()].map(([e,t])=>({projectId:e,prs:wa(t.prs),issues:wa(t.issues)}))},[e.map(W).sort().join(`|`)]),r=M({queries:n.map(e=>({queryKey:G.githubRefStatus(e.projectId,e.prs,e.issues),queryFn:({signal:t})=>a(e.projectId,{prs:e.prs,issues:e.issues},{signal:t}),enabled:t&&e.prs.length+e.issues.length>0,staleTime:e=>Oa(e.state.data)??1/0,refetchInterval:!1,refetchOnWindowFocus:!0}))}),i=v(),o=JSON.stringify(n.map((e,t)=>({...e,interval:Oa(r[t]?.data)??!1})));(0,j.useEffect)(()=>{if(!t||en())return;let e=!0,n=JSON.parse(o).filter(e=>e.interval!==!1).map(t=>{let n=new URLSearchParams;t.prs.length&&n.set(`prs`,t.prs.join(`,`)),t.issues.length&&n.set(`issues`,t.issues.join(`,`));let r=G.githubRefStatus(t.projectId,t.prs,t.issues);return ti({path:`/api/v1/p/${t.projectId}/github/ref-status?${n}`,intervalMs:t.interval},(t,n)=>{n||i.cancelQueries({queryKey:r,exact:!0}).then(()=>{e&&i.setQueryData(r,t)})})});return()=>{e=!1;for(let e of n)e()}},[t,o,i]);let s=(0,j.useMemo)(()=>gr(n,r),[n,r.map(e=>`${e.dataUpdatedAt}:${e.status}`).join(`,`)]);return(0,j.useCallback)(e=>{let t=W(e),n=s.get(t);if(n)return n;let r=V.get(t);return{state:`idle`,...r?{status:r}:{},...H.has(t)?{conflicting:!0}:{}}},[s])}function Aa(e,t,n=!0){return y({queryKey:G.githubComments(e,t),queryFn:({signal:n})=>he(e,t,{},{signal:n}),enabled:n,staleTime:6e4})}function ja(e,t,n=!0){return y({queryKey:G.githubItem(e,t),queryFn:({signal:n})=>Qe(e,t,{},{signal:n}),enabled:n,staleTime:6e4})}function Ma(e){return y({queryKey:G.githubPrChanges(e??0),queryFn:({signal:t})=>Xe(e,{},{signal:t}),enabled:e!==void 0,staleTime:6e4,retry:!1})}export{hi as $,qn as $t,Vi as A,zr as At,Di as B,_r as Bt,Li as C,Hr as Ct,Ji as D,Or as Dt,qi as E,Rr as Et,wi as F,Yr as Ft,ki as G,Zn as Gt,Ti as H,K as Ht,ji as I,Jr as It,di as J,Wn as Jt,fi as K,Kn as Kt,li as L,xr as Lt,_i as M,Lr as Mt,vi as N,kr as Nt,Wi as O,Pr as Ot,yi as P,Nr as Pt,pi as Q,Yn as Qt,Mi as R,vr as Rt,Fi as S,Sr as St,zi as T,Dr as Tt,ii as U,$n as Ut,Oi as V,G as Vt,Ei as W,tr as Wt,xi as X,Gn as Xt,mi as Y,B as Yt,bi as Z,Xn as Zt,Ii as _,Gr as _t,ja as a,tn as an,Ai as at,Xi as b,qr as bt,Sa as c,P as cn,$ as ct,Ta as d,M as dn,Ur as dt,Un as en,Si as et,ka as f,Jt as fn,Vr as ft,Bi as g,Er as gt,Ki as h,Mr as ht,Aa as i,nn as in,si as it,oi as j,Fr as jt,Pi as k,wr as kt,va as l,F as ln,Br as lt,Gi as m,Wr as mt,xa as n,L as nn,ai as nt,_a as o,I as on,Ci as ot,ua as p,qt as pn,Ir as pt,Ni as q,Jn as qt,ya as r,an as rn,ci as rt,Ma as s,en as sn,ti as st,Ea as t,kn as tn,ui as tt,ba as u,N as un,Xr as ut,Ui as v,J as vt,Ri as w,Cr as wt,Yi as x,Tr as xt,Hi as y,Kr as yt,gi as z,yr as zt};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{mi as e}from"./toaster-DNnL8v10.js";import{o as t,w as n}from"./task-groups-DCg4iOB9.js";var r=[`done`,`failed`,`cancelled`];function i(e){return r.includes(e)}function a(t){return!e(t)&&i(t.status)&&!n(t)}function o(e){return e.reduce((e,r)=>t(r)||!n(r)?e:e+1,0)}function s(e){return e.status===`failed`?`danger`:`success`}export{o as n,s as r,a as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r,s as i}from"./dist-C_rn70hE.js";import{Gt as a,Kt as o,f as s}from"./queries-CchoEEzj.js";import{Gn as c,Nn as l,ir as u}from"./toaster-zMN8cNZQ.js";import{n as d}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{F as f,I as p,N as m,P as h,U as g,_,ct as v,g as y,h as b,m as x,p as S}from"./design-icons-QbNMZniQ.js";import{n as C,r as w,t as T}from"./popover-CvL6hQ5c.js";import"./attention-DnxGjw_R.js";import{C as E,a as D,f as O,o as k,s as A,u as j}from"./task-groups-CGCnVqHE.js";function ee(e){if(e.workflow===`(planned)`||e.workflow===`(inbox)`){let t=(e.steps??[]).find(e=>e.kind===`agent`);if(t?.name)return t.name}return e.workflow}var M=e(t(),1),te=[{value:`all`,label:`All`},{value:`direct`,label:`Direct`},{value:`automations`,label:`Automations`}];function ne(e){return e?te:te.filter(e=>e.value!==`automations`)}function re(e,t){return e===`automations`&&!t?`all`:e}function ie(e){return e===`direct`||e===`automations`?e:`all`}function ae(e,t){return t===`all`||c(e)===(t===`automations`)}function oe(e){return e===`all`?void 0:e===`automations`}function N(e,t){let n={all:0,direct:0,automations:0};for(let r of e)k(r)||r.archived!==(t===`archived`)||(n.all+=1,c(r)?n.automations+=1:n.direct+=1);return n}function se(e,t,n,r,i){let a=A(e).archived,o=a>=200;if(n===`all`)return i??(o?`200+`:a);let s=N(t,`archived`)[n];return o&&r!==!1?`${s}+`:s}function ce(e){return e.rows.map(e=>e.run)}function le(e,t){switch(e){case`Needs you`:return`pending`;case`Working`:return`running`;case`Archived`:return`neutral`;case`Finished`:return t.some(e=>l(e).bucket===`error`)?`danger`:`success`}}function ue(e,t,n){return D(e,t,j(n))}var P=(e,t)=>JSON.stringify([e,t]);function de(e,t,n){let r=new Map,i=e.map(e=>{let{run:t}=e,n=P(t.projectId,t.id);r.set(n,e);let i=t.delegation;return{...t,id:n,...i&&`parentRunId`in i?{delegation:{...i,parentRunId:P(t.projectId,i.parentRunId)}}:{}}}),a=new Map;for(let e of n){let t=a.get(e.projectId);t?t.push(e):a.set(e.projectId,[e])}let o=new Map;for(let[e,t]of a)for(let[n,r]of j(t))o.set(P(e,n),r);let s=e=>r.get(e.id);return D(i,t,o).map(e=>({label:e.label,rows:e.rows.map(e=>({kind:`run`,run:s(e.run),queuePosition:e.queuePosition}))}))}function F(e){return[e.run]}function fe(e){let t=/\/(\d+)\/?$/.exec(e.trim()),n=t?Number(t[1]):NaN;return Number.isInteger(n)&&n>0?n:null}function pe(e){let t=new Set;for(let n of[e.pullRequestUrl,e.referencedPullRequestUrl,e.referencedIssueUrl]){let e=n?fe(n):null;e!==null&&t.add(e)}for(let n of[e.prNumber,e.issueNumber,e.markerRefs?.pr,e.markerRefs?.issue])typeof n==`number`&&Number.isInteger(n)&&n>0&&t.add(n);for(let n of e.pullRequests??[])t.add(n.number);return[...t]}var me=[{id:`title`,kind:`text`,scopes:[`stored`],source:`summary`,texts:e=>[e.title]},{id:`titleSummary`,kind:`text`,scopes:[`stored`],source:`summary`,texts:e=>[e.titleSummary]},{id:`displayTitle`,kind:`text`,scopes:[`shown`],source:`reader`,texts:(e,t)=>[t.displayTitle]},{id:`branch`,kind:`text`,scopes:[`stored`,`shown`],source:`summary`,texts:e=>[e.branch]},{id:`workflow`,kind:`text`,scopes:[`stored`,`shown`],source:`summary`,texts:e=>[e.workflow]},{id:`workflowLabel`,kind:`text`,scopes:[`stored`,`shown`],source:`summary`,texts:e=>[e.workflowLabel]},{id:`automation`,kind:`text`,scopes:[`stored`,`shown`],source:`reader`,texts:(e,t)=>[t.automation],universe:e=>[...e.automationNames?.values()??[]]},{id:`projectName`,kind:`text`,scopes:[`shown`],source:`reader`,texts:(e,t)=>[t.projectName]},{id:`tags`,kind:`text`,scopes:[`shown`],source:`reader`,texts:(e,t)=>t.tags??[]},{id:`id`,kind:`identifier`,scopes:[`stored`],source:`summary`,texts:e=>[e.id]},{id:`urls`,kind:`link`,scopes:[`stored`],source:`summary`,texts:e=>[e.pullRequestUrl,e.referencedPullRequestUrl,e.referencedIssueUrl,...(e.pullRequests??[]).map(e=>e.url)]},{id:`heldReferences`,kind:`reference`,scopes:[`stored`],source:`summary`,numbers:pe},{id:`shownReferences`,kind:`reference`,scopes:[`shown`],source:`reader`,numbers:(e,t)=>t.references?.()??[]}];function he(e){return e.trim().toLowerCase().split(/\s+/).filter(e=>e!==``)}function ge(e,t){return t&&e.automationId!==void 0?t.get(e.automationId)??e.automationId:void 0}function _e(e,t){let n=t.scope??`stored`,r=t.scope===`shown`?t.extras:{automation:ge(e,t.automationNames)},i=[],a=[],o=[],s={text:i,identifier:a,link:o},c=[];for(let t of me)if(t.scopes.includes(n)){if(t.kind===`reference`){c.push(()=>t.numbers(e,r));continue}for(let n of t.texts(e,r))typeof n==`string`&&s[t.kind].push(n.toLowerCase())}let l;return{prose:i,ids:a,links:o,references:()=>l??=new Set(c.flatMap(e=>e().map(String)))}}function I(e,t,n={}){let r=he(t);if(r.length===0)return!1;let{prose:i,ids:a,links:o,references:s}=_e(e,n);return r.every(e=>{if(i.some(t=>t.includes(e)))return!0;let t=e.replace(/^#/,``);return/^\d+$/.test(t)?s().has(String(Number(t)))||a.some(e=>e.startsWith(t)):a.some(t=>t.includes(e))||o.some(t=>t.includes(e))})}var ve=new Set([`running`,`waiting`]);function L(e){return e?e>=1024**3?`${(e/1024**3).toFixed(1)} GB`:e>=1024**2?`${Math.round(e/1024**2)} MB`:`${Math.round(e/1024)} kB`:``}function ye(e){return e===void 0?``:`$${e>=10?e.toFixed(0):e.toFixed(2)}`}function be(e,t=new Date){if(!u(e))return;let n=new Date(e.autoResumeAt);if(!Number.isFinite(n.getTime()))return;let r=n.toDateString()===t.toDateString(),i=new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(n);return{label:r?i:`${new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`}).format(n)} ${i}`,title:`Resumes automatically at ${new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`long`}).format(n)}`}}function xe(e){return e.steps?ee({workflow:e.workflow,steps:e.steps}):e.workflowLabel??e.workflow}function Se(e,t,n=()=>``){let r=e.filter(e=>!k(e));return t.trim()?r.filter(e=>I(e,t,{scope:`shown`,extras:{displayTitle:O(e),automation:n(e),references:()=>R(e)}})):[...r]}function R(e){return U(e).map(e=>e.number)}function z(e,t){return e.filter(e=>E(e,t)).length}function Ce(e){return z(e)}function we(e){return B(e)[0]??e.pullRequests?.find(e=>e.url)?.url}function B(e){let t=[];return e.pullRequestUrl&&t.push(e.pullRequestUrl),!(e.markerRefs?.issue!==void 0&&e.markerRefs?.pr===void 0)&&e.referencedPullRequestUrl&&t.push(e.referencedPullRequestUrl),t}function V(e,t){if(e.referencedIssueUrl)return e.referencedIssueUrl;let n=e.issueNumber??e.markerRefs?.issue;if(!(!n||!t))return`${t}/issues/${n}`}function H(e){let t=`${e.kind}#${e.number}`;if(!e.url)return`${t}@project:${e.projectId??`default`}`;try{let n=new URL(e.url),r=n.pathname.split(`/`).filter(Boolean).slice(0,2).join(`/`);return`${t}@${n.host.toLowerCase()}/${r.toLowerCase()}`}catch{return`${t}@${e.url}`}}function U(e,t,n=e.projectId){let r=B(e),i=e.markerRefs?.pr,a=[...i===void 0||[...r,...(e.pullRequests??[]).flatMap(e=>e.url?[e.url]:[])].some(e=>q(e)===String(i))?[]:[{kind:`PR`,number:i}],...r.map(e=>({kind:`PR`,url:e})),{kind:`PR`,number:e.prNumber},...(e.pullRequests??[]).map(e=>({kind:`PR`,number:e.number,...e.url?{url:e.url}:{},authoritative:!0})),{kind:`Issue`,url:V(e,t)},{kind:`Issue`,number:e.issueNumber}],o=new Set,s=[];for(let e of a){let r=e.url?Number(q(e.url)):e.number;if(!r||!Number.isInteger(r)||!e.url&&!e.authoritative&&s.some(t=>t.url&&t.kind===e.kind&&t.number===r))continue;let i=e.url??Te(e.kind,r,t),a={kind:e.kind,number:r,...i?{url:i}:n===void 0?{}:{projectId:n}},c=H(a);o.has(c)||(o.add(c),s.push(a))}return s}function Te(e,t,n){if(n)return`${n}/${e===`PR`?`pull`:`issues`}/${t}`}function W(e){return U(e)[0]}function G(e,t){if(!e.url)return!0;if(!t)return!1;let n=K(t);return n!==void 0&&K(e.url)===n}function K(e){try{let t=new URL(e),[n,r]=t.pathname.split(`/`).filter(Boolean);return n&&r?`${t.host}/${n}/${r}`.toLowerCase():void 0}catch{return}}function Ee(e,t){let n=[];for(let r of U(e,t)){if(!G(r,t))continue;let e=r.kind===`PR`?`pr`:`issue`;n.some(t=>t.kind===e&&t.number===r.number)||n.push({kind:e,number:r.number})}return n}function De(e,t,n,r){if(G(n,r))return`/p/${e}/tasks/${t}/${n.kind===`PR`?`pr`:`issue`}/${n.number}`}function q(e){return/\/(\d+)\/?(?:[?#].*)?$/.exec(e)?.[1]??null}function Oe(e,t){let n=ve.has(e.status)?t:void 0;if(n)return{cpu:{text:`${n.cpuPct.toFixed(0)}%`,kind:`live`},mem:{text:L(n.rssBytes),kind:`live`}};let r=L(e.peakRssBytes);return{cpu:{text:``,kind:`none`},mem:r?{text:`peak ${r}`,kind:`peak`,title:`peak — run finished${e.peakProcCount?` · ${e.peakProcCount} procs`:``}`}:{text:``,kind:`none`}}}function ke(e,t,n=!1){return n||e.filter(e=>!t(e.label)).some(e=>e.rows.flatMap(F).some(e=>W(e)!==void 0))}var J=n(),Y=(0,M.createContext)(null);function Ae({children:e}){let[t,n]=(0,M.useState)(()=>new Map),r=(0,M.useCallback)((e,t)=>{n(n=>{let r=new Map(n);return r.set(e,t),r})},[]),i=(0,M.useCallback)(e=>{n(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),a=s((0,M.useMemo)(()=>[...t.values()].flat(),[t])),o=(0,M.useMemo)(()=>({publish:r,retract:i,lookup:a}),[r,i,a]);return(0,J.jsx)(Y.Provider,{value:o,children:e})}var X=(0,M.createContext)(null);function je({projectId:e,repoBase:t,requests:n,children:r}){let i=(0,M.useContext)(Y),a=(0,M.useContext)(X),o=(0,M.useId)();(0,M.useEffect)(()=>{if(i)return i.publish(o,n),()=>i.retract(o)},[i,o,n.map(e=>`${e.projectId} ${e.kind}#${e.number}`).sort().join(`|`)]);let c=s(i?Me:n),l=i?.lookup??c,u=t??(a&&a.projectId===e?a.repoBase:void 0),d=(0,M.useMemo)(()=>({lookup:l,projectId:e,repoBase:u}),[l,e,u]);return(0,J.jsx)(X.Provider,{value:d,children:r})}var Me=[];function Z(e,t,n){let r=(0,M.useContext)(X),i=n??r?.projectId;return!r||!i||t===void 0?Fe:r.lookup({projectId:i,kind:e,number:t})}function Ne(e,t){let n=(0,M.useContext)(X),r=t??n?.projectId;return!n||!r?[]:e.filter(e=>n.lookup({projectId:r,kind:`PR`,number:e}).conflicting===!0)}function Pe(){let e=(0,M.useContext)(X);return{projectId:e?.projectId,repoBase:e?.repoBase}}var Fe=Object.freeze({state:`idle`}),Ie={success:`border-success/40 text-semantic-green`,danger:`border-danger/40 text-semantic-red`,accent:`border-accent-strong/35 text-accent-text`,merged:`border-merged-strong/35 text-merged-text`,info:`border-info/40 text-semantic-info`,neutral:`border-border text-muted-foreground`,pending:`border-pending-strong/45 text-semantic-amber`,conflict:`border-conflict/45 text-semantic-conflict`},Le={success:`text-semantic-green`,danger:`text-semantic-red`,accent:`text-merged-text`,merged:`text-merged-text`,info:`text-semantic-info`,neutral:`text-soft-foreground`,pending:`text-semantic-amber`,conflict:`text-semantic-conflict`},Re={success:`hover:bg-success/10`,danger:`hover:bg-danger/10`,accent:`hover:bg-accent-strong/10`,merged:`hover:bg-merged-strong/10`,info:`hover:bg-info/10`,neutral:`hover:bg-muted`,pending:`hover:bg-pending-strong/10`,conflict:`hover:bg-conflict/10`},ze={draft:f,"review-required":p,"changes-requested":g,"checks-pending":null,"checks-failing":_,ready:S,merged:m,closed:h,open:x,completed:S,"not-planned":y};function Q(e){return e===`PR`?`pr-chip`:`issue-chip`}function $(e){return e?{"data-conflicting":`true`}:{}}function Be(e,t,n,r){return!n||r!==void 0&&G({kind:e,number:t??0,url:n},r)}function Ve(e,t,n){return e===`PR`&&(t??n)===!0}function He({plain:e,inert:t,conflicting:n,className:i,tone:a}){return e?r(`inline-flex items-center gap-1 rounded-[2px] text-inherit`,n&&`text-conflict font-medium`,!t&&`group/reference focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-link-foreground`,i):r(`inline-flex h-[22px] items-center gap-1 rounded-md border px-1.5 font-mono text-[12px] font-normal`,Ie[a],i)}function Ue(e,t,n,r){return n&&!r?t?`${e===`PR`?`PR `:``}#${t}`:e:t?`${!r&&e===`Issue`?`Issue `:``}#${t}`:e}function We(e){return e===`PR`?`pull request`:`issue`}function Ge(e,t,n,r){return`Open the ${e}${t?` #${t}`:``} for ${n}${r?` — ${r.label}`:``}`}function Ke(e,t){return e&&t?Le[t.tone]:void 0}function qe(e,t){return!e&&(!t||!i(t))}function Je({conflicting:e,presentation:t,status:n,plain:i,compact:a,inert:o,kind:s,label:c,glyphClass:l}){return(0,J.jsxs)(J.Fragment,{children:[e?(0,J.jsx)(v,{className:r(`size-2.5 shrink-0`,l),"aria-hidden":`true`}):(0,J.jsx)(st,{status:t?n:void 0,className:i?r(`size-2.5`,l):void 0}),i&&a?s===`PR`?(0,J.jsx)(p,{"data-slot":`reference-kind`,className:`size-2.5 shrink-0`,"aria-hidden":`true`}):(0,J.jsx)(x,{"data-slot":`reference-kind`,className:`size-2.5 shrink-0`,"aria-hidden":`true`}):null,i?(0,J.jsx)(`span`,{className:o?void 0:`underline-offset-2 group-hover/reference:underline group-focus-visible/reference:underline`,children:c}):c]})}function Ye({kind:e,status:t,conflicting:n,chipClass:r,body:i}){return(0,J.jsx)(`span`,{"data-slot":Q(e),"data-status":t,"data-inert":`true`,...$(n),className:r,children:i})}function Xe({kind:e,number:t,tooltip:n,url:r}){return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`span`,{className:`block font-medium`,children:[e===`PR`?`Pull request`:`Issue`,t?` #${t}`:``,` · `,n.headline]}),(0,J.jsx)(`span`,{className:`block`,children:n.detail}),n.also?(0,J.jsx)(`span`,{className:`block text-muted-foreground`,children:n.also}):null,r&&i(r)?(0,J.jsx)(`span`,{className:`block text-muted-foreground`,children:r.replace(/^https?:\/\//,``)}):null]})}function Ze({reference:e,taskTitle:t,status:n,conflicting:i,conflictAction:s,projectId:c,repoBase:l,to:u,className:d,compact:f=!1,plain:p=!1,inert:m=!1}){let{kind:h,number:g,url:_}=e,v=Pe(),y=Z(h,Be(h,g,_,l??v.repoBase)?g:void 0,c),b=n??y.status,x=o(b),S=Ve(h,i,y.conflicting),C=S?a:x,w=C?.tone??`accent`,T=He({plain:p,inert:m,conflicting:S,className:d,tone:w}),E=it(y,C,S?x:void 0),D=Ue(h,g,p,f),O=We(h),k=Ge(O,g,t,C),A=(0,J.jsx)(Je,{conflicting:S,presentation:C,status:b,plain:p,compact:f,inert:m,kind:h,label:D,glyphClass:Ke(p,C)});if(m)return(0,J.jsx)(Ye,{kind:h,status:b,conflicting:S,chipClass:T,body:A});let j=qe(u,_)?(0,J.jsx)(`span`,{"data-slot":Q(h),"data-status":b,...$(S),"aria-label":C?`${O} ${D} — ${C.label}`:void 0,className:T,children:A}):(0,J.jsx)(Qe,{to:u,url:_,"data-slot":Q(h),"data-status":b,...$(S),title:E?void 0:_,"aria-label":k,className:p?T:r(T,Re[w]),children:A});return E?(0,J.jsx)(rt,{chip:j,action:S?s:void 0,state:y.state,children:(0,J.jsx)(Xe,{kind:h,number:g,tooltip:E,url:_})}):j}function Qe({to:e,url:t,children:n,...r}){return e?(0,J.jsx)(d,{to:e,...r,children:n}):(0,J.jsx)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,...r,children:n})}var $e=(0,M.createContext)(()=>{});function et(){return(0,M.useContext)($e)}var tt=150,nt=120;function rt({chip:e,action:t,state:n,children:r}){let[i,a]=(0,M.useState)(!1),o=(0,M.useRef)(null),s=(0,M.useRef)(null),c=(0,M.useRef)(void 0),l=(0,M.useCallback)((e,t)=>{clearTimeout(c.current),c.current=setTimeout(()=>a(e),t)},[]),u=(0,M.useCallback)(()=>{clearTimeout(c.current),a(!1)},[]);(0,M.useEffect)(()=>()=>clearTimeout(c.current),[]);let d=e=>e instanceof Node&&(s.current?.contains(e)||o.current?.contains(e));return(0,J.jsxs)(T,{open:i,onOpenChange:e=>e?a(!0):u(),children:[(0,J.jsx)(C,{asChild:!0,ref:o,onPointerEnter:e=>{e.pointerType!==`touch`&&l(!0,tt)},onPointerLeave:e=>{e.pointerType!==`touch`&&l(!1,nt)},onFocus:()=>a(!0),onBlur:e=>{d(e.relatedTarget)||u()},onKeyDown:e=>{if(e.key===`Escape`)return u();if(e.key!==`Tab`||e.shiftKey||!t)return;let n=s.current?.querySelector(`button:not([disabled]), [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`);n&&(e.preventDefault(),n.focus())},...t?{"aria-haspopup":`dialog`,"aria-expanded":i}:{},children:e}),(0,J.jsxs)(w,{ref:s,side:`top`,role:t?`dialog`:`tooltip`,"data-slot":`reference-status-card`,"data-tooltip-state":n,className:`w-64 space-y-2 p-3 text-xs`,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>{e.preventDefault(),d(document.activeElement)&&o.current?.focus()},onPointerEnter:()=>clearTimeout(c.current),onPointerLeave:e=>{e.pointerType!==`touch`&&l(!1,nt)},children:[(0,J.jsx)(`div`,{className:`space-y-0.5`,children:r}),t?(0,J.jsx)($e.Provider,{value:u,children:t}):null]})]})}function it(e,t,n){if(t){let{label:r,hint:i}=t,a=n?`also ${at(n.label)} — ${n.hint}`:void 0;return e.state===`unavailable`?{headline:r,detail:`last known — GitHub is unreachable${e.reason?` (${e.reason})`:``}`,...a?{also:a}:{}}:{headline:r,detail:i,...a?{also:a}:{}}}switch(e.state){case`loading`:return{headline:`Checking GitHub…`,detail:`the status of this reference is on its way`};case`unavailable`:return{headline:`Status unavailable`,detail:e.reason??`GitHub could not be reached — the chip says nothing rather than guessing`};case`unknown`:return{headline:`Not found on this repository`,detail:`GitHub has no such number here — the reference may point at another repo`};default:return null}}function at(e){return e.charAt(0).toLowerCase()+e.slice(1)}function ot({kind:e,number:t,className:n}){let i=Z(e,t),s=o(i.status),c=e===`PR`&&i.conflicting===!0,l=c?a:s;if(!l)return null;let u=r(`size-2.5`,Le[l.tone]);return(0,J.jsx)(`span`,{"data-slot":`reference-status-glyph`,"data-status":i.status,...c?{"data-conflicting":`true`}:{},"aria-hidden":`true`,className:r(`inline-flex items-center`,n),children:c?(0,J.jsx)(v,{className:r(`shrink-0`,u),"aria-hidden":`true`}):(0,J.jsx)(st,{status:i.status,className:u})})}function st({status:e,className:t}){if(!e)return null;if(e===`checks-pending`)return(0,J.jsx)(b,{"data-slot":`status-dot`,"data-tone":`pending`,className:r(`size-3 animate-pulse motion-reduce:animate-none`,t),"aria-hidden":`true`});let n=ze[e];return n?(0,J.jsx)(n,{className:r(`size-2.5 shrink-0`,t),"aria-hidden":`true`}):null}export{re as A,ne as B,we as C,xe as D,Oe as E,ae as F,oe as I,N as L,ce as M,ue as N,I as O,le as P,ie as R,Ee as S,U as T,be as _,Ae as a,V as b,Z as c,ye as d,L as f,H as g,ke as h,je as i,de as j,se as k,Se as l,q as m,ot as n,Ne as o,G as p,et as r,Pe as s,Ze as t,Ce as u,R as v,W as w,De as x,z as y,F as z};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ut as r,Wt as i,f as a}from"./queries-IlC9MZgh.js";import{Yt as o,mi as s,oi as c}from"./toaster-DNnL8v10.js";import{n as l}from"./chunk-KS7C4IRE-BdLLx37K.js";import{o as u,s as d}from"./dist-CCX8mhHc.js";import{F as f,I as p,N as m,P as h,U as g,_,ct as v,g as y,h as b,m as x,p as S}from"./design-icons-QbNMZniQ.js";import{n as C,r as w,t as T}from"./popover-BQolmvDR.js";import"./attention-BI6592lk.js";import{C as E,a as D,f as O,o as k,s as A,u as j}from"./task-groups-DCg4iOB9.js";function ee(e){if(e.workflow===`(planned)`||e.workflow===`(inbox)`){let t=(e.steps??[]).find(e=>e.kind===`agent`);if(t?.name)return t.name}return e.workflow}var M=e(t(),1),te=[{value:`all`,label:`All`},{value:`direct`,label:`Direct`},{value:`automations`,label:`Automations`}];function ne(e){return e?te:te.filter(e=>e.value!==`automations`)}function re(e,t){return e===`automations`&&!t?`all`:e}function ie(e){return e===`direct`||e===`automations`?e:`all`}function ae(e,t){return t===`all`||o(e)===(t===`automations`)}function oe(e){return e===`all`?void 0:e===`automations`}function N(e,t){let n={all:0,direct:0,automations:0};for(let r of e)k(r)||r.archived!==(t===`archived`)||(n.all+=1,o(r)?n.automations+=1:n.direct+=1);return n}function se(e,t,n,r,i){let a=A(e).archived,o=a>=200;if(n===`all`)return i??(o?`200+`:a);let s=N(t,`archived`)[n];return o&&r!==!1?`${s}+`:s}function ce(e){return e.rows.map(e=>e.run)}function le(e,t){switch(e){case`Needs you`:return`pending`;case`Working`:return`running`;case`Archived`:return`neutral`;case`Finished`:return t.some(e=>c(e).bucket===`error`)?`danger`:`success`}}function ue(e,t,n){return D(e,t,j(n))}var P=(e,t)=>JSON.stringify([e,t]);function de(e,t,n){let r=new Map,i=e.map(e=>{let{run:t}=e,n=P(t.projectId,t.id);r.set(n,e);let i=t.delegation;return{...t,id:n,...i&&`parentRunId`in i?{delegation:{...i,parentRunId:P(t.projectId,i.parentRunId)}}:{}}}),a=new Map;for(let e of n){let t=a.get(e.projectId);t?t.push(e):a.set(e.projectId,[e])}let o=new Map;for(let[e,t]of a)for(let[n,r]of j(t))o.set(P(e,n),r);let s=e=>r.get(e.id);return D(i,t,o).map(e=>({label:e.label,rows:e.rows.map(e=>({kind:`run`,run:s(e.run),queuePosition:e.queuePosition}))}))}function F(e){return[e.run]}function fe(e){let t=/\/(\d+)\/?$/.exec(e.trim()),n=t?Number(t[1]):NaN;return Number.isInteger(n)&&n>0?n:null}function pe(e){let t=new Set;for(let n of[e.pullRequestUrl,e.referencedPullRequestUrl,e.referencedIssueUrl]){let e=n?fe(n):null;e!==null&&t.add(e)}for(let n of[e.prNumber,e.issueNumber,e.markerRefs?.pr,e.markerRefs?.issue])typeof n==`number`&&Number.isInteger(n)&&n>0&&t.add(n);for(let n of e.pullRequests??[])t.add(n.number);return[...t]}var me=[{id:`title`,kind:`text`,scopes:[`stored`],source:`summary`,texts:e=>[e.title]},{id:`titleSummary`,kind:`text`,scopes:[`stored`],source:`summary`,texts:e=>[e.titleSummary]},{id:`displayTitle`,kind:`text`,scopes:[`shown`],source:`reader`,texts:(e,t)=>[t.displayTitle]},{id:`branch`,kind:`text`,scopes:[`stored`,`shown`],source:`summary`,texts:e=>[e.branch]},{id:`workflow`,kind:`text`,scopes:[`stored`,`shown`],source:`summary`,texts:e=>[e.workflow]},{id:`workflowLabel`,kind:`text`,scopes:[`stored`,`shown`],source:`summary`,texts:e=>[e.workflowLabel]},{id:`automation`,kind:`text`,scopes:[`stored`,`shown`],source:`reader`,texts:(e,t)=>[t.automation],universe:e=>[...e.automationNames?.values()??[]]},{id:`projectName`,kind:`text`,scopes:[`shown`],source:`reader`,texts:(e,t)=>[t.projectName]},{id:`tags`,kind:`text`,scopes:[`shown`],source:`reader`,texts:(e,t)=>t.tags??[]},{id:`id`,kind:`identifier`,scopes:[`stored`],source:`summary`,texts:e=>[e.id]},{id:`urls`,kind:`link`,scopes:[`stored`],source:`summary`,texts:e=>[e.pullRequestUrl,e.referencedPullRequestUrl,e.referencedIssueUrl,...(e.pullRequests??[]).map(e=>e.url)]},{id:`heldReferences`,kind:`reference`,scopes:[`stored`],source:`summary`,numbers:pe},{id:`shownReferences`,kind:`reference`,scopes:[`shown`],source:`reader`,numbers:(e,t)=>t.references?.()??[]}];function he(e){return e.trim().toLowerCase().split(/\s+/).filter(e=>e!==``)}function ge(e,t){return t&&e.automationId!==void 0?t.get(e.automationId)??e.automationId:void 0}function _e(e,t){let n=t.scope??`stored`,r=t.scope===`shown`?t.extras:{automation:ge(e,t.automationNames)},i=[],a=[],o=[],s={text:i,identifier:a,link:o},c=[];for(let t of me)if(t.scopes.includes(n)){if(t.kind===`reference`){c.push(()=>t.numbers(e,r));continue}for(let n of t.texts(e,r))typeof n==`string`&&s[t.kind].push(n.toLowerCase())}let l;return{prose:i,ids:a,links:o,references:()=>l??=new Set(c.flatMap(e=>e().map(String)))}}function I(e,t,n={}){let r=he(t);if(r.length===0)return!1;let{prose:i,ids:a,links:o,references:s}=_e(e,n);return r.every(e=>{if(i.some(t=>t.includes(e)))return!0;let t=e.replace(/^#/,``);return/^\d+$/.test(t)?s().has(String(Number(t)))||a.some(e=>e.startsWith(t)):a.some(t=>t.includes(e))||o.some(t=>t.includes(e))})}var ve=new Set([`running`,`waiting`]);function L(e){return e?e>=1024**3?`${(e/1024**3).toFixed(1)} GB`:e>=1024**2?`${Math.round(e/1024**2)} MB`:`${Math.round(e/1024)} kB`:``}function ye(e){return e===void 0?``:`$${e>=10?e.toFixed(0):e.toFixed(2)}`}function be(e,t=new Date){if(!s(e))return;let n=new Date(e.autoResumeAt);if(!Number.isFinite(n.getTime()))return;let r=n.toDateString()===t.toDateString(),i=new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(n);return{label:r?i:`${new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`}).format(n)} ${i}`,title:`Resumes automatically at ${new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`long`}).format(n)}`}}function xe(e){return e.steps?ee({workflow:e.workflow,steps:e.steps}):e.workflowLabel??e.workflow}function Se(e,t,n=()=>``){let r=e.filter(e=>!k(e));return t.trim()?r.filter(e=>I(e,t,{scope:`shown`,extras:{displayTitle:O(e),automation:n(e),references:()=>R(e)}})):[...r]}function R(e){return U(e).map(e=>e.number)}function z(e,t){return e.filter(e=>E(e,t)).length}function Ce(e){return z(e)}function we(e){return B(e)[0]??e.pullRequests?.find(e=>e.url)?.url}function B(e){let t=[];return e.pullRequestUrl&&t.push(e.pullRequestUrl),!(e.markerRefs?.issue!==void 0&&e.markerRefs?.pr===void 0)&&e.referencedPullRequestUrl&&t.push(e.referencedPullRequestUrl),t}function V(e,t){if(e.referencedIssueUrl)return e.referencedIssueUrl;let n=e.issueNumber??e.markerRefs?.issue;if(!(!n||!t))return`${t}/issues/${n}`}function H(e){let t=`${e.kind}#${e.number}`;if(!e.url)return`${t}@project:${e.projectId??`default`}`;try{let n=new URL(e.url),r=n.pathname.split(`/`).filter(Boolean).slice(0,2).join(`/`);return`${t}@${n.host.toLowerCase()}/${r.toLowerCase()}`}catch{return`${t}@${e.url}`}}function U(e,t,n=e.projectId){let r=B(e),i=e.markerRefs?.pr,a=[...i===void 0||[...r,...(e.pullRequests??[]).flatMap(e=>e.url?[e.url]:[])].some(e=>q(e)===String(i))?[]:[{kind:`PR`,number:i}],...r.map(e=>({kind:`PR`,url:e})),{kind:`PR`,number:e.prNumber},...(e.pullRequests??[]).map(e=>({kind:`PR`,number:e.number,...e.url?{url:e.url}:{},authoritative:!0})),{kind:`Issue`,url:V(e,t)},{kind:`Issue`,number:e.issueNumber}],o=new Set,s=[];for(let e of a){let r=e.url?Number(q(e.url)):e.number;if(!r||!Number.isInteger(r)||!e.url&&!e.authoritative&&s.some(t=>t.url&&t.kind===e.kind&&t.number===r))continue;let i=e.url??Te(e.kind,r,t),a={kind:e.kind,number:r,...i?{url:i}:n===void 0?{}:{projectId:n}},c=H(a);o.has(c)||(o.add(c),s.push(a))}return s}function Te(e,t,n){if(n)return`${n}/${e===`PR`?`pull`:`issues`}/${t}`}function W(e){return U(e)[0]}function G(e,t){if(!e.url)return!0;if(!t)return!1;let n=K(t);return n!==void 0&&K(e.url)===n}function K(e){try{let t=new URL(e),[n,r]=t.pathname.split(`/`).filter(Boolean);return n&&r?`${t.host}/${n}/${r}`.toLowerCase():void 0}catch{return}}function Ee(e,t){let n=[];for(let r of U(e,t)){if(!G(r,t))continue;let e=r.kind===`PR`?`pr`:`issue`;n.some(t=>t.kind===e&&t.number===r.number)||n.push({kind:e,number:r.number})}return n}function De(e,t,n,r){if(G(n,r))return`/p/${e}/tasks/${t}/${n.kind===`PR`?`pr`:`issue`}/${n.number}`}function q(e){return/\/(\d+)\/?(?:[?#].*)?$/.exec(e)?.[1]??null}function Oe(e,t){let n=ve.has(e.status)?t:void 0;if(n)return{cpu:{text:`${n.cpuPct.toFixed(0)}%`,kind:`live`},mem:{text:L(n.rssBytes),kind:`live`}};let r=L(e.peakRssBytes);return{cpu:{text:``,kind:`none`},mem:r?{text:`peak ${r}`,kind:`peak`,title:`peak — run finished${e.peakProcCount?` · ${e.peakProcCount} procs`:``}`}:{text:``,kind:`none`}}}function ke(e,t,n=!1){return n||e.filter(e=>!t(e.label)).some(e=>e.rows.flatMap(F).some(e=>W(e)!==void 0))}var J=n(),Y=(0,M.createContext)(null);function Ae({children:e}){let[t,n]=(0,M.useState)(()=>new Map),r=(0,M.useCallback)((e,t)=>{n(n=>{let r=new Map(n);return r.set(e,t),r})},[]),i=(0,M.useCallback)(e=>{n(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),o=a((0,M.useMemo)(()=>[...t.values()].flat(),[t])),s=(0,M.useMemo)(()=>({publish:r,retract:i,lookup:o}),[r,i,o]);return(0,J.jsx)(Y.Provider,{value:s,children:e})}var X=(0,M.createContext)(null);function je({projectId:e,repoBase:t,requests:n,children:r}){let i=(0,M.useContext)(Y),o=(0,M.useContext)(X),s=(0,M.useId)();(0,M.useEffect)(()=>{if(i)return i.publish(s,n),()=>i.retract(s)},[i,s,n.map(e=>`${e.projectId} ${e.kind}#${e.number}`).sort().join(`|`)]);let c=a(i?Me:n),l=i?.lookup??c,u=t??(o&&o.projectId===e?o.repoBase:void 0),d=(0,M.useMemo)(()=>({lookup:l,projectId:e,repoBase:u}),[l,e,u]);return(0,J.jsx)(X.Provider,{value:d,children:r})}var Me=[];function Z(e,t,n){let r=(0,M.useContext)(X),i=n??r?.projectId;return!r||!i||t===void 0?Fe:r.lookup({projectId:i,kind:e,number:t})}function Ne(e,t){let n=(0,M.useContext)(X),r=t??n?.projectId;return!n||!r?[]:e.filter(e=>n.lookup({projectId:r,kind:`PR`,number:e}).conflicting===!0)}function Pe(){let e=(0,M.useContext)(X);return{projectId:e?.projectId,repoBase:e?.repoBase}}var Fe=Object.freeze({state:`idle`}),Ie={success:`border-success/40 text-semantic-green`,danger:`border-danger/40 text-semantic-red`,accent:`border-accent-strong/35 text-accent-text`,merged:`border-merged-strong/35 text-merged-text`,info:`border-info/40 text-semantic-info`,neutral:`border-border text-muted-foreground`,pending:`border-pending-strong/45 text-semantic-amber`,conflict:`border-conflict/45 text-semantic-conflict`},Le={success:`text-semantic-green`,danger:`text-semantic-red`,accent:`text-merged-text`,merged:`text-merged-text`,info:`text-semantic-info`,neutral:`text-soft-foreground`,pending:`text-semantic-amber`,conflict:`text-semantic-conflict`},Re={success:`hover:bg-success/10`,danger:`hover:bg-danger/10`,accent:`hover:bg-accent-strong/10`,merged:`hover:bg-merged-strong/10`,info:`hover:bg-info/10`,neutral:`hover:bg-muted`,pending:`hover:bg-pending-strong/10`,conflict:`hover:bg-conflict/10`},ze={draft:f,"review-required":p,"changes-requested":g,"checks-pending":null,"checks-failing":_,ready:S,merged:m,closed:h,open:x,completed:S,"not-planned":y};function Q(e){return e===`PR`?`pr-chip`:`issue-chip`}function $(e){return e?{"data-conflicting":`true`}:{}}function Be(e,t,n,r){return!n||r!==void 0&&G({kind:e,number:t??0,url:n},r)}function Ve(e,t,n){return e===`PR`&&(t??n)===!0}function He({plain:e,inert:t,conflicting:n,className:r,tone:i}){return e?u(`inline-flex items-center gap-1 rounded-[2px] text-inherit`,n&&`text-conflict font-medium`,!t&&`group/reference focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-link-foreground`,r):u(`inline-flex h-[22px] items-center gap-1 rounded-md border px-1.5 font-mono text-[12px] font-normal`,Ie[i],r)}function Ue(e,t,n,r){return n&&!r?t?`${e===`PR`?`PR `:``}#${t}`:e:t?`${!r&&e===`Issue`?`Issue `:``}#${t}`:e}function We(e){return e===`PR`?`pull request`:`issue`}function Ge(e,t,n,r){return`Open the ${e}${t?` #${t}`:``} for ${n}${r?` — ${r.label}`:``}`}function Ke(e,t){return e&&t?Le[t.tone]:void 0}function qe(e,t){return!e&&(!t||!d(t))}function Je({conflicting:e,presentation:t,status:n,plain:r,compact:i,inert:a,kind:o,label:s,glyphClass:c}){return(0,J.jsxs)(J.Fragment,{children:[e?(0,J.jsx)(v,{className:u(`size-2.5 shrink-0`,c),"aria-hidden":`true`}):(0,J.jsx)(st,{status:t?n:void 0,className:r?u(`size-2.5`,c):void 0}),r&&i?o===`PR`?(0,J.jsx)(p,{"data-slot":`reference-kind`,className:`size-2.5 shrink-0`,"aria-hidden":`true`}):(0,J.jsx)(x,{"data-slot":`reference-kind`,className:`size-2.5 shrink-0`,"aria-hidden":`true`}):null,r?(0,J.jsx)(`span`,{className:a?void 0:`underline-offset-2 group-hover/reference:underline group-focus-visible/reference:underline`,children:s}):s]})}function Ye({kind:e,status:t,conflicting:n,chipClass:r,body:i}){return(0,J.jsx)(`span`,{"data-slot":Q(e),"data-status":t,"data-inert":`true`,...$(n),className:r,children:i})}function Xe({kind:e,number:t,tooltip:n,url:r}){return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`span`,{className:`block font-medium`,children:[e===`PR`?`Pull request`:`Issue`,t?` #${t}`:``,` · `,n.headline]}),(0,J.jsx)(`span`,{className:`block`,children:n.detail}),n.also?(0,J.jsx)(`span`,{className:`block text-muted-foreground`,children:n.also}):null,r&&d(r)?(0,J.jsx)(`span`,{className:`block text-muted-foreground`,children:r.replace(/^https?:\/\//,``)}):null]})}function Ze({reference:e,taskTitle:t,status:n,conflicting:a,conflictAction:o,projectId:s,repoBase:c,to:l,className:d,compact:f=!1,plain:p=!1,inert:m=!1}){let{kind:h,number:g,url:_}=e,v=Pe(),y=Z(h,Be(h,g,_,c??v.repoBase)?g:void 0,s),b=n??y.status,x=i(b),S=Ve(h,a,y.conflicting),C=S?r:x,w=C?.tone??`accent`,T=He({plain:p,inert:m,conflicting:S,className:d,tone:w}),E=it(y,C,S?x:void 0),D=Ue(h,g,p,f),O=We(h),k=Ge(O,g,t,C),A=(0,J.jsx)(Je,{conflicting:S,presentation:C,status:b,plain:p,compact:f,inert:m,kind:h,label:D,glyphClass:Ke(p,C)});if(m)return(0,J.jsx)(Ye,{kind:h,status:b,conflicting:S,chipClass:T,body:A});let j=qe(l,_)?(0,J.jsx)(`span`,{"data-slot":Q(h),"data-status":b,...$(S),"aria-label":C?`${O} ${D} — ${C.label}`:void 0,className:T,children:A}):(0,J.jsx)(Qe,{to:l,url:_,"data-slot":Q(h),"data-status":b,...$(S),title:E?void 0:_,"aria-label":k,className:p?T:u(T,Re[w]),children:A});return E?(0,J.jsx)(rt,{chip:j,action:S?o:void 0,state:y.state,children:(0,J.jsx)(Xe,{kind:h,number:g,tooltip:E,url:_})}):j}function Qe({to:e,url:t,children:n,...r}){return e?(0,J.jsx)(l,{to:e,...r,children:n}):(0,J.jsx)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,...r,children:n})}var $e=(0,M.createContext)(()=>{});function et(){return(0,M.useContext)($e)}var tt=150,nt=120;function rt({chip:e,action:t,state:n,children:r}){let[i,a]=(0,M.useState)(!1),o=(0,M.useRef)(null),s=(0,M.useRef)(null),c=(0,M.useRef)(void 0),l=(0,M.useCallback)((e,t)=>{clearTimeout(c.current),c.current=setTimeout(()=>a(e),t)},[]),u=(0,M.useCallback)(()=>{clearTimeout(c.current),a(!1)},[]);(0,M.useEffect)(()=>()=>clearTimeout(c.current),[]);let d=e=>e instanceof Node&&(s.current?.contains(e)||o.current?.contains(e));return(0,J.jsxs)(T,{open:i,onOpenChange:e=>e?a(!0):u(),children:[(0,J.jsx)(C,{asChild:!0,ref:o,onPointerEnter:e=>{e.pointerType!==`touch`&&l(!0,tt)},onPointerLeave:e=>{e.pointerType!==`touch`&&l(!1,nt)},onFocus:()=>a(!0),onBlur:e=>{d(e.relatedTarget)||u()},onKeyDown:e=>{if(e.key===`Escape`)return u();if(e.key!==`Tab`||e.shiftKey||!t)return;let n=s.current?.querySelector(`button:not([disabled]), [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`);n&&(e.preventDefault(),n.focus())},...t?{"aria-haspopup":`dialog`,"aria-expanded":i}:{},children:e}),(0,J.jsxs)(w,{ref:s,side:`top`,role:t?`dialog`:`tooltip`,"data-slot":`reference-status-card`,"data-tooltip-state":n,className:`w-64 space-y-2 p-3 text-xs`,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>{e.preventDefault(),d(document.activeElement)&&o.current?.focus()},onPointerEnter:()=>clearTimeout(c.current),onPointerLeave:e=>{e.pointerType!==`touch`&&l(!1,nt)},children:[(0,J.jsx)(`div`,{className:`space-y-0.5`,children:r}),t?(0,J.jsx)($e.Provider,{value:u,children:t}):null]})]})}function it(e,t,n){if(t){let{label:r,hint:i}=t,a=n?`also ${at(n.label)} — ${n.hint}`:void 0;return e.state===`unavailable`?{headline:r,detail:`last known — GitHub is unreachable${e.reason?` (${e.reason})`:``}`,...a?{also:a}:{}}:{headline:r,detail:i,...a?{also:a}:{}}}switch(e.state){case`loading`:return{headline:`Checking GitHub…`,detail:`the status of this reference is on its way`};case`unavailable`:return{headline:`Status unavailable`,detail:e.reason??`GitHub could not be reached — the chip says nothing rather than guessing`};case`unknown`:return{headline:`Not found on this repository`,detail:`GitHub has no such number here — the reference may point at another repo`};default:return null}}function at(e){return e.charAt(0).toLowerCase()+e.slice(1)}function ot({kind:e,number:t,className:n}){let a=Z(e,t),o=i(a.status),s=e===`PR`&&a.conflicting===!0,c=s?r:o;if(!c)return null;let l=u(`size-2.5`,Le[c.tone]);return(0,J.jsx)(`span`,{"data-slot":`reference-status-glyph`,"data-status":a.status,...s?{"data-conflicting":`true`}:{},"aria-hidden":`true`,className:u(`inline-flex items-center`,n),children:s?(0,J.jsx)(v,{className:u(`shrink-0`,l),"aria-hidden":`true`}):(0,J.jsx)(st,{status:a.status,className:l})})}function st({status:e,className:t}){if(!e)return null;if(e===`checks-pending`)return(0,J.jsx)(b,{"data-slot":`status-dot`,"data-tone":`pending`,className:u(`size-3 animate-pulse motion-reduce:animate-none`,t),"aria-hidden":`true`});let n=ze[e];return n?(0,J.jsx)(n,{className:u(`size-2.5 shrink-0`,t),"aria-hidden":`true`}):null}export{re as A,ne as B,we as C,xe as D,Oe as E,ae as F,oe as I,N as L,ce as M,ue as N,I as O,le as P,ie as R,Ee as S,U as T,be as _,Ae as a,V as b,Z as c,ye as d,L as f,H as g,ke as h,je as i,de as j,se as k,Se as l,q as m,ot as n,Ne as o,G as p,et as r,Pe as s,Ze as t,Ce as u,R as v,W as w,De as x,z as y,F as z};
|
package/web/dist/assets/{remote-settings-notice-Dtaa3ovl.js → remote-settings-notice-Czl9yS5W.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ht as r,Vt as i,vt as a}from"./queries-IlC9MZgh.js";import{Fi as o}from"./toaster-DNnL8v10.js";import{Tn as s}from"./index-Dp7K74Jw.js";var c=e(t(),1),l=n();function u(){let e=o(),t=(0,c.useCallback)(async()=>{await Promise.all([e.invalidateQueries({queryKey:i.health}),e.invalidateQueries({queryKey:i.agentConfig,exact:!0}),e.invalidateQueries({queryKey:r.agentProfiles,exact:!0})])},[e]);return(0,c.useEffect)(()=>{t()},[t]),t}var d=`${s()} remote-settings enable`;function f({risk:e}){return a().data?.capabilities?.remoteSettingsAdmin===!0?(0,l.jsxs)(`p`,{role:`note`,"data-slot":`remote-settings-notice`,className:`rounded-md border border-pending-strong/40 bg-pending/10 px-3 py-2 text-[13px] text-foreground`,children:[`Remote settings administration is on. `,e,`, and anyone who can open this cockpit can change them. The host operator turns this off with`,` `,(0,l.jsxs)(`code`,{children:[s(),` remote-settings disable`]}),`.`]}):null}export{f as n,u as r,d as t};
|