@puddle-code/cli 0.4.8 → 0.4.9
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/CHANGELOG.md +60 -8
- package/README.md +19 -4
- package/dist/host-control.mjs +75 -17
- package/dist/index.js +640 -143
- package/dist/install.sh +28 -0
- package/dist/public/assets/App-UQXXCAJF.js +65 -0
- package/dist/public/assets/{CompilationCommandForm-Csg3VkC6.js → CompilationCommandForm-CipGdjjH.js} +1 -1
- package/dist/public/assets/Dashboard-6pSi_1fH.js +1 -0
- package/dist/public/assets/EditorTabClose-TixDVxvl.js +1 -0
- package/dist/public/assets/LazyTerminal-B88WIvyh.js +2 -0
- package/dist/public/assets/{ModelRefcount-CHKuXiJY.js → ModelRefcount-BeuZdwWp.js} +1 -1
- package/dist/public/assets/NewProjectDialog-C1TVzOvJ.js +1 -0
- package/dist/public/assets/{NotebookWidget-CCRsiBIE.js → NotebookWidget-Bcavj7Lb.js} +2 -2
- package/dist/public/assets/PaneEditorBody-DRA4WG0A.js +284 -0
- package/dist/public/assets/{PdfViewer-BX025YLW.js → PdfViewer-Cr5306nr.js} +1 -1
- package/dist/public/assets/SettingsDialog-BvaE3Ue8.js +8 -0
- package/dist/public/assets/Terminal-Bo8hyZj7.js +67 -0
- package/dist/public/assets/Workspace-Bf2zQC6v.js +20 -0
- package/dist/public/assets/{api-BOuyloUi.js → api-B90WKMKj.js} +1 -1
- package/dist/public/assets/{auth-olLlgxc3.js → auth-CdosKReE.js} +1 -1
- package/dist/public/assets/{buffer-store-DIOiWz9q.js → buffer-store-Bh2IilxW.js} +3 -3
- package/dist/public/assets/{context-CSOKgBuW.js → context-CG70lLa4.js} +1 -1
- package/dist/public/assets/control-tray-CG26TqqQ.css +1 -0
- package/dist/public/assets/control-tray-c9uXOo-i.js +1 -0
- package/dist/public/assets/{cssMode-CSjHtANE.js → cssMode-C63oO3vc.js} +1 -1
- package/dist/public/assets/{editor.api2-4X9Vh9Zw.js → editor.api2-DTL_SiN1.js} +2 -2
- package/dist/public/assets/errors-tuvbq1a_.js +1 -0
- package/dist/public/assets/forward-link-BspnTVuc.js +1 -0
- package/dist/public/assets/{freemarker2-DsOTa0Uq.js → freemarker2-DKWtaCtp.js} +1 -1
- package/dist/public/assets/{handlebars-DGS-lUwt.js → handlebars-uU1ujPOt.js} +1 -1
- package/dist/public/assets/{html-eVYoRhea.js → html-CrP_wDJ5.js} +1 -1
- package/dist/public/assets/{htmlMode-CIHMS93l.js → htmlMode-lNJ18wA0.js} +1 -1
- package/dist/public/assets/index-4XrK4Fes.css +2 -0
- package/dist/public/assets/index-Doe7MhnI.js +10 -0
- package/dist/public/assets/{javascript-Cq9FwqGi.js → javascript-WHxEzdgn.js} +1 -1
- package/dist/public/assets/{jsonMode-BijgXT6I.js → jsonMode-xHnT5kRj.js} +1 -1
- package/dist/public/assets/{liquid-BcLxSFu3.js → liquid-B1ddyofJ.js} +1 -1
- package/dist/public/assets/{lspLanguageFeatures-x2nWJpem.js → lspLanguageFeatures-CCO_e4_t.js} +1 -1
- package/dist/public/assets/markdown-mermaid-TizVRNLQ.js +2 -0
- package/dist/public/assets/{mdx-BDgbCiou.js → mdx-m1X3FtyX.js} +1 -1
- package/dist/public/assets/media-refresh-store-CiyvSvEu.js +1 -0
- package/dist/public/assets/{monaco.contribution-C0TYpF88.js → monaco.contribution-BXkMDWX9.js} +2 -2
- package/dist/public/assets/notification-delivery-BZzMYzIP.css +1 -0
- package/dist/public/assets/notification-delivery-CegOQxcZ.js +1 -0
- package/dist/public/assets/{protocol-support-BApsXw77.js → protocol-support-TSI4Ig6W.js} +1 -1
- package/dist/public/assets/{python-D5mUty3a.js → python-CRTN4ovU.js} +1 -1
- package/dist/public/assets/{razor-DAAn8j2s.js → razor-Cj7Cr6Fr.js} +1 -1
- package/dist/public/assets/{scroll-restoration-CwXbvZvT.js → scroll-restoration-6GVbekSz.js} +1 -1
- package/dist/public/assets/{selection-actions-Cm0Oytya.js → selection-actions-CvYaucrm.js} +1 -1
- package/dist/public/assets/{session-order-2oedrwDu.js → session-order-CiDVvIU5.js} +1 -1
- package/dist/public/assets/{switch-OMx-_DY7.js → switch-oBD5uCTu.js} +1 -1
- package/dist/public/assets/theme-swfNLod9.js +1 -0
- package/dist/public/assets/{tsMode-B7q3gz7a.js → tsMode-D0nEO9DL.js} +1 -1
- package/dist/public/assets/{typescript-DvKdOnR-.js → typescript-CQjjq4UE.js} +1 -1
- package/dist/public/assets/use-ui-state-D4FsRK2R.js +1 -0
- package/dist/public/assets/{view-state-store-Cy9sQJoZ.js → view-state-store-DbQ7YOPe.js} +1 -1
- package/dist/public/assets/{workers-Ck67TJT4.js → workers-m2qsiPbB.js} +1 -1
- package/dist/public/assets/ws-Cp1eCJaM.js +1 -0
- package/dist/public/assets/{xml-DDMTG7kD.js → xml-Ci2P6_gm.js} +1 -1
- package/dist/public/assets/{yaml-hCGJvPOb.js → yaml-76T3bIWj.js} +1 -1
- package/dist/public/index.html +4 -3
- package/dist/pudl.js +118 -75
- package/package.json +1 -1
- package/dist/public/assets/App-D-hMqX7b.js +0 -13
- package/dist/public/assets/Dashboard-C0AvtM5m.js +0 -1
- package/dist/public/assets/EditorTabClose-QgdaqA1X.js +0 -1
- package/dist/public/assets/LazyTerminal-Dp2CN0Y8.js +0 -2
- package/dist/public/assets/NewProjectDialog-DMixZDC_.js +0 -1
- package/dist/public/assets/PaneEditorBody-DD8UshBi.js +0 -284
- package/dist/public/assets/SettingsDialog-DgMm212x.js +0 -8
- package/dist/public/assets/Terminal-CYeh8_uU.js +0 -66
- package/dist/public/assets/Workspace-CrZkK55U.js +0 -20
- package/dist/public/assets/control-tray-CdoVaVhT.js +0 -1
- package/dist/public/assets/control-tray-DE2RhHP3.css +0 -1
- package/dist/public/assets/forward-link-DMvLf0Xw.js +0 -1
- package/dist/public/assets/hotkeys-Cu0t6sbz.js +0 -1
- package/dist/public/assets/index-BqOVeoIr.js +0 -10
- package/dist/public/assets/index-LpAqnBR3.css +0 -2
- package/dist/public/assets/markdown-mermaid-SyDYdSZz.js +0 -2
- package/dist/public/assets/media-refresh-store-NSkvkBxN.js +0 -1
- package/dist/public/assets/notification-delivery-BBt_CJ19.js +0 -1
- package/dist/public/assets/use-ui-state-DdnTFosh.js +0 -1
- package/dist/public/assets/ws-Dgc69_w8.js +0 -1
package/dist/install.sh
CHANGED
|
@@ -236,6 +236,14 @@ else
|
|
|
236
236
|
|| die "cannot reach github.com/$REPO to resolve the latest release"
|
|
237
237
|
VERSION=$(printf '%s' "$LATEST" | sed -n 's#.*/tag/v\{0,1\}##p')
|
|
238
238
|
[ -n "$VERSION" ] || die "could not resolve the latest release of $REPO; pass --version"
|
|
239
|
+
POINTER="$CACHE_DIR/$COMPONENT-version"
|
|
240
|
+
STATUS=$(curl --max-time 15 --max-filesize 128 -sSL -w '%{http_code}' -o "$POINTER" "https://github.com/$REPO/releases/download/v$VERSION/$COMPONENT-version") \
|
|
241
|
+
|| die "component release lookup failed"
|
|
242
|
+
case "$STATUS" in
|
|
243
|
+
200) VERSION=$(cat "$POINTER") ;;
|
|
244
|
+
404) : ;; # Legacy releases predate component pointers.
|
|
245
|
+
*) die "component release lookup failed (HTTP $STATUS)" ;;
|
|
246
|
+
esac
|
|
239
247
|
fi
|
|
240
248
|
valid_version
|
|
241
249
|
FILE="puddled-v$VERSION-$OS-$ARCH.tar.gz"
|
|
@@ -346,6 +354,18 @@ else
|
|
|
346
354
|
rm -f "$SMOKE_LOG"
|
|
347
355
|
fi
|
|
348
356
|
fi
|
|
357
|
+
# The archive may contain shared host executables, but only advertised components
|
|
358
|
+
# may be selected. Legacy archives have no manifest and retain their old meaning.
|
|
359
|
+
if [ -e "$DEST/release-manifest.json" ]; then
|
|
360
|
+
"$DEST/bin/node" --input-type=commonjs - "$DEST/release-manifest.json" "$COMPONENT" "$VERSION" <<'NODE'
|
|
361
|
+
const fs = require('node:fs');
|
|
362
|
+
const [file, component, version] = process.argv.slice(2);
|
|
363
|
+
if (fs.statSync(file).size > 16384) throw new Error('Release manifest too large');
|
|
364
|
+
const manifest = JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
365
|
+
if (manifest.format !== 1 || manifest.version !== version || manifest.components?.[component] !== version)
|
|
366
|
+
throw new Error(`No ${component} was published for v${version}`);
|
|
367
|
+
NODE
|
|
368
|
+
fi
|
|
349
369
|
CREATE_RECEIPT="$STAGE_ONLY"
|
|
350
370
|
if [ -n "$STAGE" ] && [ -z "$ACTIVATE" ] &&
|
|
351
371
|
{ [ -e "$DEST/PROTOCOL" ] || [ -L "$DEST/PROTOCOL" ] ||
|
|
@@ -478,6 +498,14 @@ if [ "$COMPONENT" = daemon ] && [ -z "$ACTIVATE" ] &&
|
|
|
478
498
|
die "initial runtime fails its own --version smoke test (details: $SMOKE_LOG)"
|
|
479
499
|
fi
|
|
480
500
|
rm -f "$SMOKE_LOG"
|
|
501
|
+
if [ -e "$DEST/release-manifest.json" ]; then
|
|
502
|
+
"$DEST/bin/node" --input-type=commonjs - "$DEST/release-manifest.json" "$VERSION" <<'NODE'
|
|
503
|
+
const fs = require('node:fs');
|
|
504
|
+
const manifest = JSON.parse(fs.readFileSync(process.argv[2], 'utf8'));
|
|
505
|
+
if (manifest.components.runtime !== process.argv[3])
|
|
506
|
+
throw new Error(`Install runtime ${manifest.components.runtime} before bootstrapping this daemon (use an updated cockpit)`);
|
|
507
|
+
NODE
|
|
508
|
+
fi
|
|
481
509
|
INITIAL_RUNTIME=1
|
|
482
510
|
fi
|
|
483
511
|
# Use the archive's Node as the standalone CLI installer does: rename replaces
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ReleaseNotesDialog-CbFYKoYM.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-CZI7_Jkm.js","assets/jsx-runtime-By8HlURe.js","assets/purify.es-D8QhFVkO.js","assets/dialog-D-Axqpzg.js","assets/react-dom-cJyBB_A4.js","assets/x-Dq6POV20.js","assets/createLucideIcon-C9A1vLE-.js","assets/dialog-BX0tebJL.css","assets/queue-BlrQxHDl.js","assets/markdown-it-CWoG9_Dn.js","assets/markdown-CMSzQtLp.js","assets/math-CSw6sgCC.js","assets/math-delimiters-BCnTi7Ii.js","assets/SettingsDialog-BvaE3Ue8.js","assets/protocol-support-TSI4Ig6W.js","assets/auth-CdosKReE.js","assets/api-B90WKMKj.js","assets/LazyTerminal-B88WIvyh.js","assets/preload-helper-Czpn1I53.js","assets/chevron-right-BEy-IXEZ.js","assets/notification-delivery-CegOQxcZ.js","assets/theme-swfNLod9.js","assets/ws-Cp1eCJaM.js","assets/dist-BOS6OKSE.js","assets/switch-oBD5uCTu.js","assets/dist-Dge3wHdO.js","assets/notification-delivery-BZzMYzIP.css","assets/client-settings-DhfHheKR.js","assets/index-Doe7MhnI.js","assets/index-4XrK4Fes.css","assets/button-C_Rvtcwg.js","assets/select-p5KTVHbg.js","assets/chevron-down-HQLVE6o5.js","assets/dist-Cq-O0n8n.js","assets/code-Cf4ftdOa.js","assets/rotate-ccw-BI2k_h3A.js","assets/control-tray-c9uXOo-i.js","assets/control-tray-CG26TqqQ.css","assets/errors-tuvbq1a_.js","assets/use-debounced-value-C86N-mOK.js","assets/popover-D-jcaKGN.js","assets/CompilationCommandForm-CipGdjjH.js","assets/SettingsDialog-CJX0gDhJ.css","assets/Dashboard-6pSi_1fH.js","assets/session-order-CiDVvIU5.js","assets/context-menu-D3ZhKA9s.js","assets/dist-BmSuHjIq.js","assets/NewProjectDialog-C1TVzOvJ.js","assets/Workspace-Bf2zQC6v.js","assets/forward-link-BspnTVuc.js","assets/media-refresh-store-CiyvSvEu.js","assets/use-ui-state-D4FsRK2R.js","assets/preview-kind-CPkO-rSz.js","assets/debounce-B9DrqirV.js","assets/motion-OSLfKoC0.js","assets/selection-actions-CvYaucrm.js","assets/copy-D0Theg4Q.js","assets/view-state-store-DbQ7YOPe.js","assets/drafts-B_tChlzR.js","assets/buffer-logic-BAkSBQT7.js","assets/scroll-restoration-6GVbekSz.js","assets/Workspace-Bf0VMnaa.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./react-dom-cJyBB_A4.js";import{$ as r,Bt as i,C as a,Ct as o,D as s,Dt as c,E as l,Et as u,Ft as d,Gt as f,H as p,Ht as m,It as h,J as g,L as _,Lt as v,Mt as y,N as b,Nt as x,O as S,P as C,Pt as ee,Rt as w,S as T,T as E,Tt as te,Ut as D,W as ne,Wt as re,X as ie,Y as ae,at as oe,b as se,ct as ce,et as le,ht as ue,kt as de,lt as fe,nt as pe,o as me,ot as he,st as ge,tt as _e,x as ve,yt as ye,z as be,zt as O}from"./protocol-support-TSI4Ig6W.js";import{$ as xe,F as Se,K as Ce,Q as we,T as Te,Y as Ee,o as k,p as De,r as Oe,z as ke}from"./auth-CdosKReE.js";import{a as A,c as Ae,o as je}from"./LazyTerminal-B88WIvyh.js";import{A as Me,C as Ne,E as Pe,M as Fe,N as Ie,O as Le,T as Re,_ as ze,a as Be,d as Ve,g as He,h as Ue,i as We,l as Ge,m as Ke,o as qe,p as Je,s as Ye,t as Xe,u as Ze,w as Qe}from"./notification-delivery-CegOQxcZ.js";import{i as $e,r as et,t as tt}from"./client-settings-DhfHheKR.js";import{c as nt,n as rt,r as it,s as at,t as j}from"./theme-swfNLod9.js";import{t as ot}from"./jsx-runtime-By8HlURe.js";import{t as M}from"./preload-helper-Czpn1I53.js";import{n as N}from"./api-B90WKMKj.js";import{_ as st,a as ct,b as lt,c as ut,d as P,f as dt,g as ft,h as pt,i as mt,m as ht,s as gt,t as F,u as _t,v as I,y as L}from"./ws-Cp1eCJaM.js";import{t as vt}from"./forward-link-BspnTVuc.js";import{a as yt,c as bt,d as xt,f as St,l as Ct,m as wt,p as Tt,r as Et,s as Dt,u as Ot}from"./session-order-CiDVvIU5.js";import{n as R,t as kt}from"./dist-BOS6OKSE.js";import"./dialog-D-Axqpzg.js";import{i as At,n as z,p as jt,r as Mt}from"./chevron-right-BEy-IXEZ.js";import{n as Nt,r as B}from"./dist-Dge3wHdO.js";import{$ as Pt,G as Ft,J as It,K as Lt,U as Rt,W as zt,X as Bt,Y as Vt,Z as Ht,at as V,d as Ut,et as Wt,f as Gt,h as H,i as Kt,it as U,m as qt,nt as Jt,ot as Yt,p as Xt,q as Zt,r as Qt,rt as $t,st as W,t as en,tt as tn}from"./use-ui-state-D4FsRK2R.js";import{n as G,t as K}from"./createLucideIcon-C9A1vLE-.js";import{n as nn,t as q}from"./button-C_Rvtcwg.js";import{c as rn,d as an,i as on,l as sn,o as cn,t as ln}from"./switch-oBD5uCTu.js";import{t as un}from"./copy-D0Theg4Q.js";import{n as dn,t as fn}from"./NewProjectDialog-C1TVzOvJ.js";import{t as pn}from"./control-tray-c9uXOo-i.js";import{n as J}from"./errors-tuvbq1a_.js";import{a as mn,c as hn,i as gn,n as _n,o as vn,r as yn,s as bn}from"./command-BV8ZEhQz.js";import{n as xn,r as Sn,t as Cn}from"./popover-D-jcaKGN.js";import{n as wn,r as Tn,t as En}from"./queue-BlrQxHDl.js";var Y=e(t(),1),X=ot();function Dn(){let[e,t]=(0,Y.useState)(`Opening forwarded application…`);return(0,Y.useEffect)(()=>{if(!/^\/forward\/([^/]+)\/(\d+)$/.exec(window.location.pathname)){t(`This forwarding link is invalid.`);return}let e=!0;return vt(new URL(window.location.href)).then(t=>{e&&window.location.replace(t)}).catch(()=>{e&&t(`The application is unavailable. Reconnect to Puddle and open this link again.`)}),()=>{e=!1}},[]),(0,X.jsx)(`p`,{className:`p-8 text-sm text-fg-secondary`,children:e})}var On=class extends f{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new c({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=kn(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=kn(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=kn(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=kn(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){x.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>v(t,e))}findAll(e={}){return this.getAll().filter(t=>v(e,t))}notify(e){x.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return x.batch(()=>Promise.all(e.map(e=>e.continue().catch(O))))}};function kn(e){return e.options.scope?.id}var An=class extends f{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??h(r,t),a=this.get(i);return a||(a=new de({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){x.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>w(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>w(e,t)):t}notify(e){x.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){x.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){x.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},jn=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new An,this.#t=e.mutationCache||new On,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=re.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=y.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(m(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=ee(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return x.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;x.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return x.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=x.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(O).catch(O)}invalidateQueries(e,t={}){return x.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=x.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(O)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(O)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(m(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(O).catch(O)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(O).catch(O)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return y.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(d(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{i(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(d(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{i(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=h(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===D&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Mn=class extends Y.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidUpdate(e){this.state.error!==null&&e.resetOn!==this.props.resetOn&&this.setState({error:null})}componentDidCatch(e,t){console.error(`Puddle: the ${this.props.scope} crashed`,e,t.componentStack)}render(){let{error:e}=this.state;return e===null?this.props.children:(0,X.jsxs)(`div`,{className:`flex h-full min-h-40 flex-col items-center justify-center gap-4 px-8 py-10 text-center`,children:[(0,X.jsxs)(`p`,{className:`text-sm text-fg`,children:[`The `,this.props.scope,` stopped rendering.`]}),(0,X.jsx)(`p`,{className:`max-w-lg font-mono text-2xs leading-relaxed text-interrupted`,children:e.message||String(e)}),(0,X.jsx)(`p`,{className:`max-w-sm text-2xs leading-relaxed text-fg-muted`,children:`Your sessions and their worktrees are on the daemon and untouched; the layout is saved. The console has the full stack.`}),(0,X.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,X.jsx)(`button`,{type:`button`,onClick:()=>this.setState({error:null}),className:`text-2xs font-medium text-fg-gold transition-colors hover:underline`,children:`Try again`}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),className:`text-2xs text-fg-muted transition-colors hover:text-fg`,children:`Reload`})]})]})}};function Nn(){return(0,X.jsx)(kt,{theme:(0,Y.useSyncExternalStore)(at,it),position:`bottom-right`,toastOptions:{style:{background:`var(--bg-elevated)`,border:`none`,boxShadow:`var(--ui-overlay-shadow)`,borderRadius:`var(--ui-surface-radius)`,outline:`1px solid var(--border)`,color:`var(--text-primary)`},classNames:{description:`whitespace-pre-wrap break-words font-mono text-2xs leading-snug max-h-40 overflow-y-auto`}}})}function Pn(){return(0,X.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-ground`,children:(0,X.jsxs)(`div`,{className:`flex w-full max-w-md flex-col gap-10 px-8 pb-24`,children:[(0,X.jsx)(`h1`,{className:`font-mono text-2xl font-semibold text-fg`,children:`Puddle`}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-3 text-sm leading-relaxed text-fg-secondary`,children:[(0,X.jsxs)(`p`,{children:[`Authorise this browser by running`,` `,(0,X.jsx)(`span`,{className:`font-mono text-accent`,children:`puddle launch`}),` in a terminal.`]}),(0,X.jsx)(`p`,{children:`Use the link it opens. Your sessions, drafts and layouts stay in place.`})]})]})})}var Fn=e(n(),1),In=`a, button, [role="button"], [role="slider"], input, select, textarea, summary, label, [onclick], .cursor-pointer`,Ln=`.monaco-editor`;function Rn(e,t){return e?.closest(Ln)&&!e.closest(t)?`text`:e?.closest(In)?`interactive`:`default`}function zn(e,t=`.no-custom-caret`){(0,Y.useEffect)(()=>{let n=e.current;if(!n)return;let r=window.matchMedia(`(pointer: fine)`),i=0,a=null,o=null,s=!0,c=!1,l=new MutationObserver(()=>d()),u=()=>{a&&!i&&(i=requestAnimationFrame(p))},d=()=>{s=!0,c=!0,u()},f=()=>{cancelAnimationFrame(i),i=0,a=null,o=null,s=!0,l.disconnect(),n.style.opacity=`0`},p=()=>{if(i=0,!a)return;let{x:e,y:u}=a,d=c?document.elementFromPoint(e,u):a.target;if(a.target=d,c=!1,d instanceof HTMLIFrameElement||!r.matches){f();return}if(n.style.transform=`translate3d(${e}px, ${u}px, 0) translate(-50%, -50%)`,n.style.opacity=`1`,!s&&d===o)return;if(s=!1,o=d,l.disconnect(),d&&d!==n&&!n.contains(d)){l.observe(d,{attributes:!0,childList:!0});for(let e of d.childNodes)e.nodeType===Node.TEXT_NODE&&l.observe(e,{characterData:!0});for(let e=d.parentElement;e;e=e.parentElement)l.observe(e,{attributes:!0,childList:!0})}l.observe(document.head,{attributes:!0,childList:!0,characterData:!0,subtree:!0});let p=d?.closest(Ln),m=Rn(d,t),h=m===`text`,g=m===`interactive`,_=h;if(h&&p){let e=getComputedStyle(p);n.style.setProperty(`--custom-cursor-caret-height`,`${Math.round(Number.parseFloat(e.fontSize)*1.3)}px`)}else if(!g&&d&&!d.closest(t)&&Array.from(d.childNodes).some(e=>e.nodeType===Node.TEXT_NODE&&e.textContent?.trim())){let e=getComputedStyle(d);e.userSelect!==`none`&&(_=!0,n.style.setProperty(`--custom-cursor-caret-height`,`${Math.round(Number.parseFloat(e.fontSize)*1.3)}px`))}n.classList.toggle(`is-interactive`,g),n.classList.toggle(`is-text`,_)},m=e=>{if(e.pointerType===`touch`||!r.matches){f();return}a={x:e.clientX,y:e.clientY,target:e.target instanceof Element?e.target:null},c=!1,u()},h=()=>{r.matches?d():f()};return window.addEventListener(`pointermove`,m,{passive:!0}),document.documentElement.addEventListener(`pointerleave`,f),window.addEventListener(`blur`,f),window.addEventListener(`resize`,d),document.addEventListener(`scroll`,d,!0),document.addEventListener(`focusin`,d),document.addEventListener(`focusout`,d),document.addEventListener(`pointerdown`,d),document.addEventListener(`pointerup`,d),r.addEventListener(`change`,h),document.fonts.addEventListener(`loadingdone`,d),()=>{window.removeEventListener(`pointermove`,m),document.documentElement.removeEventListener(`pointerleave`,f),window.removeEventListener(`blur`,f),window.removeEventListener(`resize`,d),document.removeEventListener(`scroll`,d,!0),document.removeEventListener(`focusin`,d),document.removeEventListener(`focusout`,d),document.removeEventListener(`pointerdown`,d),document.removeEventListener(`pointerup`,d),r.removeEventListener(`change`,h),document.fonts.removeEventListener(`loadingdone`,d),f()}},[t,e])}var Bn=[`top`,`right`,`bottom`,`left`];function Vn(){let e=(0,Y.useRef)(null);return zn(e),(0,X.jsx)(`div`,{ref:e,className:`custom-cursor drafting-cursor`,"aria-hidden":`true`,children:Bn.map(e=>(0,X.jsx)(`span`,{className:`drafting-cursor-tick`,"data-side":e},e))})}function Hn(){let e=(0,Y.useRef)(null);return zn(e),(0,X.jsx)(`div`,{ref:e,className:`custom-cursor invert-cursor`,"aria-hidden":`true`})}var Un=`h1, h2, h3, h4, h5, h6, .no-rangefinder-caret`,Z=40.5,Q=4.05,Wn=Q*Math.sqrt(3)/2;function Gn(){let e=[],t=[],n=Z/2,r=Math.ceil(n/Wn)+1,i=e=>Math.round(e*100)/100,a=e=>`M${e.map(([e,t])=>`${i(e)} ${i(t)}`).join(`L`)}Z`;for(let i=-r;i<r;i+=1){let o=n+i*Wn,s=o+Wn,c=(i%2+2)%2*(Q/2);for(let i=-r;i<r;i+=1){let r=n+i*Q+c,l=[[r+Q/2,o],[r,s],[r+Q,s]],u=[[r+Q/2,o],[r+3*Q/2,o],[r+Q,s]],d=e=>{let t=e.map(([e])=>e),n=e.map(([,e])=>e);return Math.max(...t)>0&&Math.min(...t)<Z&&Math.max(...n)>0&&Math.min(...n)<Z};d(l)&&e.push(a(l)),d(u)&&t.push(a(u))}}return{light:e.join(``),dark:t.join(``)}}var Kn=Gn();function qn(){let e=(0,Y.useRef)(null);return zn(e,Un),(0,X.jsx)(`div`,{ref:e,className:`custom-cursor rangefinder-cursor`,"aria-hidden":`true`,children:(0,X.jsxs)(`svg`,{className:`rangefinder-cursor-facets`,viewBox:`0 0 ${Z} ${Z}`,focusable:`false`,children:[(0,X.jsx)(`path`,{className:`rangefinder-cursor-facet-light`,d:Kn.light}),(0,X.jsx)(`path`,{className:`rangefinder-cursor-facet-dark`,d:Kn.dark})]})})}function Jn(){let{cursorPackage:e}=$e(),t=null;switch(e){case`rangefinder`:t=(0,X.jsx)(qn,{});break;case`drafting`:t=(0,X.jsx)(Vn,{});break;case`invert`:t=(0,X.jsx)(Hn,{});break;case`system`:return null}return(0,Fn.createPortal)(t,document.body)}var Yn=K(`corner-down-left`,[[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}],[`path`,{d:`m9 10-5 5 5 5`,key:`1kshq7`}]]),Xn=K(`layout-template`,[[`rect`,{width:`18`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`f1a2em`}],[`rect`,{width:`9`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`jqznyg`}],[`rect`,{width:`5`,height:`7`,x:`16`,y:`14`,rx:`1`,key:`q5h2i8`}]]),Zn=K(`monitor-cog`,[[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`m14.305 7.53.923-.382`,key:`1mlnsw`}],[`path`,{d:`m15.228 4.852-.923-.383`,key:`82mpwg`}],[`path`,{d:`m16.852 3.228-.383-.924`,key:`ln4sir`}],[`path`,{d:`m16.852 8.772-.383.923`,key:`1dejw0`}],[`path`,{d:`m19.148 3.228.383-.924`,key:`192kgf`}],[`path`,{d:`m19.53 9.696-.382-.924`,key:`fiavlr`}],[`path`,{d:`m20.772 4.852.924-.383`,key:`1j8mgp`}],[`path`,{d:`m20.772 7.148.924.383`,key:`zix9be`}],[`path`,{d:`M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7`,key:`1tnzv8`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}]]),Qn=K(`notebook-pen`,[[`path`,{d:`M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4`,key:`re6nr2`}],[`path`,{d:`M2 6h4`,key:`aawbzj`}],[`path`,{d:`M2 10h4`,key:`l0bgd4`}],[`path`,{d:`M2 14h4`,key:`1gsvsf`}],[`path`,{d:`M2 18h4`,key:`1bu2t1`}],[`path`,{d:`M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z`,key:`pqwjuv`}]]),$n=K(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),er=K(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),tr=K(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]);function nr(){let e=ge(),t=C(),[n,r]=(0,Y.useState)(``),[i,a]=(0,Y.useState)(ke),o=()=>{n.trim()&&t.mutate({name:n.trim(),branch_prefix:i.trim()},{onSuccess:e=>st(e.id)})},s=(e.data?.length??0)>0;return(0,X.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-ground`,children:(0,X.jsxs)(`div`,{className:`flex w-full max-w-md flex-col gap-10 px-8 pb-16`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(`h1`,{className:`font-mono text-2xl font-semibold text-fg`,children:`Puddle`}),(0,X.jsx)(`p`,{className:`text-sm text-fg-secondary`,children:`Who is working?`})]}),s&&(0,X.jsx)(`div`,{className:`flex flex-col`,children:e.data.map(e=>(0,X.jsxs)(`button`,{onClick:()=>st(e.id),className:`flex items-center gap-3 rounded-md px-3 py-2.5 text-left transition-colors hover:bg-elevated active:bg-border/70`,children:[(0,X.jsx)(Le,{icon:e.icon,colour:e.icon_colour,className:`size-5`}),(0,X.jsx)(`span`,{className:G(`text-base`,A(e.icon_colour)||`text-fg`),children:e.name}),e.branch_prefix&&(0,X.jsxs)(`span`,{className:`ml-auto text-2xs text-fg-muted`,children:[e.branch_prefix,`…`]})]},e.id))}),(0,X.jsxs)(`form`,{className:`flex flex-col gap-5`,onSubmit:e=>{e.preventDefault(),o()},children:[s&&(0,X.jsx)(`p`,{className:`text-2xs font-medium uppercase tracking-wide text-fg-muted`,children:`or create a profile`}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsx)(Ae,{htmlFor:`profile-name`,children:`Name`}),(0,X.jsx)(z,{id:`profile-name`,placeholder:`e.g. alice`,value:n,onChange:e=>r(e.target.value),className:`h-10`,autoFocus:!s})]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsx)(Ae,{htmlFor:`branch-prefix`,children:`Branch prefix`}),(0,X.jsx)(z,{id:`branch-prefix`,placeholder:`no prefix`,value:i,onChange:e=>a(e.target.value),className:`h-10`})]}),t.error&&(0,X.jsx)(`p`,{className:`text-xs text-danger`,children:t.error.message}),(0,X.jsx)(q,{type:`submit`,size:`lg`,className:`self-start px-6`,disabled:!n.trim()||t.isPending,children:`Create profile`})]})]})})}function rr(){let e=g(),{icon:t}=Pe(),n=I(),r=ht()[`host.peek`],[i,a]=(0,Y.useState)(!1),o=(0,Y.useRef)(!1);return(0,Y.useEffect)(()=>{let e=()=>{o.current=!1,a(!1)},t=r?.split(`+`)??[],n=t.at(-1),i=r=>{o.current&&(r.key===`Escape`&&(r.preventDefault(),r.stopPropagation()),(r.type===`keyup`&&r.code===n||r.key===`Escape`||t.includes(`meta`)&&!r.metaKey||t.includes(`ctrl`)&&!r.ctrlKey||t.includes(`alt`)&&!r.altKey||t.includes(`shift`)&&!r.shiftKey)&&e())},s=()=>{document.hidden&&e()},c=P(`host.peek`,()=>{o.current||document.hidden||(o.current=!0,a(!0))});return window.addEventListener(`keyup`,i,!0),window.addEventListener(`keydown`,i,!0),window.addEventListener(`blur`,e),window.addEventListener(`pagehide`,e),document.addEventListener(`visibilitychange`,s),()=>{c(),window.removeEventListener(`keyup`,i,!0),window.removeEventListener(`keydown`,i,!0),window.removeEventListener(`blur`,e),window.removeEventListener(`pagehide`,e),document.removeEventListener(`visibilitychange`,s),e()}},[r,n]),i?(0,Fn.createPortal)((0,X.jsx)(`div`,{"data-host-peek":!0,"data-state":`open`,className:`overlay-backdrop-motion fixed inset-0 z-[200] flex items-center justify-center p-8 text-fg backdrop-blur-[8px]`,onPointerDown:e=>e.preventDefault(),role:`status`,"aria-live":`polite`,children:(0,X.jsxs)(`div`,{className:`island-outline flex max-w-full flex-col items-center gap-8 rounded-[var(--ui-surface-radius)] px-12 py-10 text-center`,children:[(0,X.jsx)(Re,{icon:t,className:`size-[clamp(6rem,18vmin,14rem)] shrink-0`}),(0,X.jsx)(`span`,{className:`max-w-full break-words font-sans text-[clamp(0.8333rem,2.3333vw,2.3333rem)] leading-tight font-medium`,children:T(e.data)??`Host`})]})}),document.body):null}function ir(){let e=be().data?.protocol,t=e!==void 0&&(e.major>25||e.major===25&&e.minor>=5),{data:n}=o({queryKey:[`storage`],queryFn:()=>N(`GET`,`/api/storage`),enabled:t&&!k(),refetchInterval:1e4,retry:!1});if(!t||k()||!n)return null;let r=n.volumes.filter(e=>e.level!==`ok`);if(!n.logs_degraded&&!n.database_degraded&&r.length===0)return null;let i=r.some(e=>e.level===`critical`);return(0,X.jsxs)(`div`,{role:`status`,className:`flex shrink-0 items-start gap-2 px-3 py-2 text-xs text-warning`,children:[(0,X.jsx)($t,{className:`mt-0.5 size-3.5 shrink-0`,"aria-hidden":`true`}),(0,X.jsxs)(`div`,{className:`min-w-0`,children:[n.database_degraded&&(0,X.jsx)(`p`,{children:`Storage is full. Changes cannot be saved. Live session status may be unsaved.`}),n.logs_degraded&&(0,X.jsx)(`p`,{children:`Terminal history is temporarily not being saved. Live terminals remain connected.`}),i&&(0,X.jsx)(`p`,{children:`Storage is critically low. Free space or inodes before starting new sessions or worktrees.`}),r.length>0&&(0,X.jsx)(cn,{summary:`${r.length} storage ${r.length===1?`location needs`:`locations need`} attention`,children:(0,X.jsx)(`div`,{className:`max-h-32 overflow-y-auto pl-4`,children:r.map(e=>(0,X.jsxs)(`p`,{className:`break-all text-fg-secondary`,children:[e.level===`unknown`?`Could not check storage`:`Low storage`,` at`,` `,e.path,e.available_bytes!==null&&` · ${Math.round(e.available_bytes/1024**2).toLocaleString()} MiB available`,e.available_inodes!==null&&` · ${e.available_inodes.toLocaleString()} inodes available`]},e.path))})})]})]})}var ar=new class{transport;reload;pause;phase=`idle`;pending=null;constructor(e=fetch,t=()=>window.location.reload(),n=e=>new Promise(t=>setTimeout(t,e))){this.transport=e,this.reload=t,this.pause=n}refresh(e=12e4){return this.pending||=this.run(e).finally(()=>{this.pending=null}),this.pending}async run(e){this.phase=`requesting`;let t={authorization:`Bearer ${Oe.get()??``}`,"content-type":`application/json`};try{let n=await this.transport(`/cockpit/refresh`,{method:`POST`,headers:t,signal:AbortSignal.timeout(1e4),body:JSON.stringify({refreshId:crypto.randomUUID()})});if(n.status!==202)throw Error(`refresh rejected`);let r=Te.parse(await n.json());this.phase=`waiting`;let i=Date.now()+e;for(;Date.now()<i;){await this.pause(1e3);try{let e=await this.transport(`/cockpit/status`,{headers:t,cache:`no-store`,signal:AbortSignal.timeout(3e3)});if(!e.ok)continue;let n=De.parse(await e.json());if(n.instance===r.instance||n.refreshId!==r.refreshId||n.upstream!==`ready`)continue;return this.phase=`complete`,this.reload(),!0}catch{}}}catch{}return this.phase=`failed`,!1}},or=null;function sr(e){return or=e,()=>{or===e&&(or=null)}}function cr(){or?.()}var lr=new Set;function ur(){return[...lr].flatMap(e=>e())}function dr({onNewSession:e,onNewProject:t}){let[n,r]=(0,Y.useState)(!1),[i,a]=(0,Y.useState)(`commands`),[o,s]=(0,Y.useState)(``),[c,l]=(0,Y.useState)(null),[u,d]=(0,Y.useState)(!1),f=Tt(),p=wt(),m=I(),h=p.id,g=fe(m??void 0),_=he(m??void 0),v=ye(h),y=Bt();(0,Y.useEffect)(()=>P(`palette.toggle`,()=>r(e=>!e)),[]),(0,Y.useEffect)(()=>Wt(()=>r(!0)),[]),(0,Y.useEffect)(()=>{n||(a(`commands`),s(``),l(null),d(!1))},[n]);let b=(0,Y.useMemo)(()=>{let n=[],r=Et((g.data??[]).filter(e=>!e.archived),_.data?.projectOrder??[]);for(let e of r)n.push({id:`project-${e.id}`,group:`Projects`,label:e.name,icon:dn,keywords:`switch project open`,run:()=>void f(`/project/${e.id}`)});for(let e of v.data??[])e.status!==`archived`&&n.push({id:`session-${e.id}`,group:`Sessions`,label:y(e),icon:yt,keywords:`switch session ${e.branch}`,run:()=>void f(`/project/${e.project_id}/session/${e.id}`)});return h!==void 0&&e&&n.push({id:`new-agent`,group:`Actions`,label:`New agent`,icon:an,keywords:`new agent create start session`,run:()=>e()},{id:`new-terminal`,group:`Actions`,label:`New terminal`,icon:yt,keywords:`new terminal create start shell session`,run:()=>e({kind:`terminal`})}),h!==void 0&&n.push({id:`open-path`,group:`Actions`,label:`Open path`,icon:dn,keywords:`open path file directory folder editor tree browse absolute relative home`,closeOnRun:!1,run:()=>{s(``),l(null),a(`path`)}}),t&&n.push({id:`new-project`,group:`Actions`,label:`New project`,icon:B,keywords:`new project open create repository repo workspace`,run:t}),n.push({id:`theme-dark`,group:`Theme`,label:`Switch theme: dark`,icon:Fe,keywords:`switch theme dark appearance`,run:()=>void j(`dark`)},{id:`theme-light`,group:`Theme`,label:`Switch theme: light`,icon:Me,keywords:`switch theme light appearance`,run:()=>void j(`light`)},{id:`theme-system`,group:`Theme`,label:`Switch theme: system`,icon:Zn,keywords:`switch theme system appearance`,run:()=>void j(`system`)},{id:`open-settings`,group:`Actions`,label:`Settings`,icon:tr,keywords:`open settings preferences options configure`,run:()=>on()},{id:`switch-profile`,group:`Actions`,label:`Switch profile`,icon:rn,keywords:`switch profile identity user change`,run:()=>ft.set(null)},{id:`refresh-connection`,group:`Actions`,label:`Refresh connection`,icon:sn,keywords:`refresh connection reconnect restart cockpit tunnel ssh daemon`,run:()=>cr()}),[...n,...ur()]},[g.data,_.data?.projectOrder,v.data,h,f,e,t,y]),x=(0,Y.useMemo)(()=>{let e=new Map;for(let t of b){let n=e.get(t.group)??[];n.push(t),e.set(t.group,n)}return[...e.entries()]},[b]),S=async()=>{let e=o.trim();if(!(e===``||u)){d(!0),l(null);try{await Ht(e),r(!1)}catch(e){l(e instanceof Error?e.message:`Could not open that path.`)}finally{d(!1)}}};return(0,X.jsxs)(_n,{open:n,onOpenChange:r,children:[(0,X.jsx)(mn,{value:o,onValueChange:e=>{s(e),l(null)},placeholder:i===`path`?`Enter a path…`:`Type a command or search…`,onKeyDown:e=>{i===`path`&&(e.key===`Enter`?(e.preventDefault(),e.stopPropagation(),S()):e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),a(`commands`),s(``),l(null)))}}),i===`path`?(0,X.jsx)(bn,{children:(0,X.jsxs)(`div`,{className:`px-3 py-3 text-xs text-fg-muted`,children:[(0,X.jsx)(`p`,{children:`Relative paths start from the bound worktree or project. Absolute and ~ paths work too.`}),(0,X.jsx)(`p`,{className:c?`mt-2 text-danger`:`mt-2`,"aria-live":`polite`,children:c??(u?`Opening…`:`Press Enter to open.`)})]})}):(0,X.jsxs)(bn,{children:[(0,X.jsx)(yn,{children:`Nothing matches.`}),x.map(([e,t])=>(0,X.jsx)(gn,{heading:e,children:t.map(e=>{let t=e.icon;return(0,X.jsxs)(vn,{value:`${e.label} ${e.keywords??``}`,onSelect:()=>{e.closeOnRun!==!1&&r(!1),e.run()},children:[t&&(0,X.jsx)(t,{}),e.label,e.shortcut&&(0,X.jsx)(hn,{children:e.shortcut})]},e.id)})},e))]})]})}function fr(){let e=document.activeElement;return e instanceof Element&&e.closest(`.xterm`)!==null}function pr(){let e=document.activeElement;return e instanceof Element&&e.closest(`.monaco-editor`)!==null}function mr(){let e=he(I()??void 0).data?.hotkeys;return(0,Y.useEffect)(()=>{dt(e&&typeof e==`object`?e:void 0)},[e]),(0,Y.useEffect)(()=>P(`window.close`,()=>{let e=L();e?.closeWindow?e.closeWindow():window.close()}),[]),(0,Y.useEffect)(()=>{let e=e=>{if(e.target instanceof Element&&e.target.closest(`[data-hotkey-recording]`))return;let t=ct(e);if(!t)return;let n=mt(t);if(!n)return;let r=gt(n);if(!r||!_t(r,pr()))return;let i=ut(n);i&&(e.preventDefault(),e.stopPropagation(),(!r.hold||!e.repeat)&&i())},t=e=>{let t=ct(e);if(!t)return;let n=mt(t);if(!n)return;let r=gt(n);if(!r||r.editor&&pr()||r.deferInTerminal&&fr())return;let i=ut(n);i&&(e.preventDefault(),i())};return window.addEventListener(`keydown`,e,!0),window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`keydown`,e,!0),window.removeEventListener(`keydown`,t)}},[]),null}var hr=4e3;function gr(){let[e,t]=(0,Y.useState)(`hidden`),n=(0,Y.useRef)(e);n.current=e,(0,Y.useEffect)(()=>{let e=null,r=F.onConnectionChange(r=>{if(r){e!==null&&clearTimeout(e),e=null,n.current===`lost`&&t(`hidden`);return}e!==null||n.current!==`hidden`||(e=setTimeout(()=>{e=null,n.current===`hidden`&&t(`lost`)},hr))});return()=>{r(),e!==null&&clearTimeout(e)}},[]);let r=(0,Y.useCallback)(async()=>{n.current!==`refreshing`&&(t(`refreshing`),await ar.refresh()||(R.error(`The cockpit has not come back — it may need a terminal (ssh re-auth): puddle refresh`),t(F.isConnected()?`hidden`:`lost`)))},[]);return(0,Y.useEffect)(()=>sr(()=>void r()),[r]),e===`hidden`?null:(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3 bg-elevated px-3 py-2`,children:[(0,X.jsx)(`span`,{className:`text-xs text-fg-secondary`,children:e===`refreshing`?`Restarting the cockpit.`:`Connection to the daemon lost.`}),e===`lost`&&(0,X.jsxs)(q,{size:`sm`,className:`ml-auto`,onClick:()=>void r(),children:[(0,X.jsx)(sn,{}),`Refresh connection`]})]})}function _r({label:e,percentage:t,hint:n}){let r=Math.max(0,Math.min(100,t));return(0,X.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`w-24 shrink-0 truncate text-2xs text-fg-muted`,title:e,children:e}),(0,X.jsx)(`span`,{className:`relative h-1.5 min-w-0 flex-1 overflow-hidden rounded-full bg-border`,children:(0,X.jsx)(`span`,{className:`absolute inset-y-0 left-0 rounded-full ${r>=90?`bg-danger`:r>=75?`bg-warning`:`bg-action`}`,style:{width:`${r}%`}})}),(0,X.jsxs)(`span`,{className:`shrink-0 text-2xs tabular-nums text-fg-muted`,children:[Math.round(r),`%`,n?` · ${n}`:``]})]})}function vr(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function yr(e){if(e===null)return`never`;let t=new Date(e).getTime(),n=Math.max(0,Math.round((Date.now()-t)/1e3));if(n<60)return`just now`;let r=Math.round(n/60);if(r<60)return`${r}m ago`;let i=Math.round(r/60);return i<24?`${i}h ago`:`${Math.round(i/24)}d ago`}function br({account:e,onLogin:t,onStartSession:n,installed:r=!0}){let i=E(e.id),a=e.logged_in?n:r?t:null,o=i.data?.subscription;return(0,X.jsxs)(`div`,{className:`rounded-md px-2 py-2 transition-colors hover:bg-elevated`,children:[(0,X.jsxs)(`button`,{type:`button`,disabled:a===null,onClick:()=>a?.(),className:`flex w-full items-center gap-3 text-left disabled:cursor-default`,children:[(0,X.jsx)(`span`,{className:`size-2 shrink-0 rounded-full ${e.logged_in?`bg-success`:`bg-idle`}`,"aria-hidden":!0}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`span`,{className:`block truncate text-sm text-fg`,children:e.label}),(0,X.jsxs)(`span`,{className:`block text-2xs text-fg-muted`,children:[e.logged_in?`logged in`:`logged out`,i.data&&(0,X.jsxs)(X.Fragment,{children:[` · `,i.data.session_count,` session`,i.data.session_count===1?``:`s`,i.data.active_session_count>0&&` (${i.data.active_session_count} active)`,` · `,`last `,yr(i.data.last_activity_at)]})]}),i.data?.agent_usage&&(0,X.jsxs)(`span`,{className:`block text-2xs text-fg-muted`,children:[vr(i.data.agent_usage.input_tokens),` in ·`,` `,vr(i.data.agent_usage.output_tokens),` out ·`,` `,vr(i.data.agent_usage.cache_read_input_tokens),` cached ·`,` `,i.data.agent_usage.message_count,` msgs`]}),i.data?.live_usage?.context_used_percentage!=null&&(0,X.jsx)(`span`,{className:`mt-1 block`,children:(0,X.jsx)(_r,{label:`context`,percentage:i.data.live_usage.context_used_percentage})})]}),(0,X.jsx)(`span`,{className:`shrink-0 text-2xs text-fg-muted`,children:r?e.logged_in?n?`new agent`:``:(0,X.jsxs)(`span`,{className:`flex items-center gap-1 text-warning`,children:[(0,X.jsx)(Ie,{className:`size-3`}),`sign in`]}):`unavailable`})]}),o!=null&&o.windows.length>0&&(0,X.jsx)(`div`,{className:`mt-2 flex flex-col gap-1 pl-5`,children:o.windows.map(e=>(0,X.jsx)(_r,{label:e.label,percentage:e.used_percentage,hint:e.resets==null?void 0:`resets ${e.resets}`},e.key))})]})}function xr(){let[e,t]=(0,Y.useState)(!1),[n,r]=(0,Y.useState)(!1),i=I(),a=ge(),o=_e(),c=a.data?.find(e=>e.id===i),u=l(i??void 0),d=s(),f=ie(),{open:p,handler:m}=Vt(),[h,g]=(0,Y.useState)(null),_=e=>f.mutate(e.id,{onSuccess:t=>g({stream:t.stream,label:`${e.agent_type}/${e.label}`}),onError:e=>J(e)}),v=e=>{t(!1),p({accountId:e.id})},y=e=>{r(!1);let t=e.trim();!i||!t||t===c?.name||o.mutate({id:i,name:t},{onError:e=>J(e)})},b=`profile-trigger font-sans compact:h-7 compact:px-1.5`;return n&&c?(0,X.jsxs)(`div`,{className:nn({variant:`ghost`,size:`sm`,className:b}),children:[(0,X.jsx)(Le,{icon:c.icon,colour:c.icon_colour}),(0,X.jsx)(tn,{initial:c.name,maxLength:100,fitContent:!0,className:A(c.icon_colour),onCommit:y,onCancel:()=>r(!1)})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(Cn,{open:e,onOpenChange:t,children:[(0,X.jsxs)(U,{children:[(0,X.jsx)(W,{asChild:!0,children:(0,X.jsx)(Sn,{asChild:!0,children:(0,X.jsxs)(q,{variant:`ghost`,size:`sm`,className:b,children:[(0,X.jsx)(Le,{icon:c?.icon,colour:c?.icon_colour}),(0,X.jsx)(`span`,{className:A(c?.icon_colour),...Jt(()=>{t(!1),r(!0)}),children:c?.name??`…`})]})})}),(0,X.jsx)(V,{children:`Profile`})]}),(0,X.jsxs)(xn,{className:`w-[28rem] max-w-[calc(100vw-1rem)]`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(d.data??[]).map(e=>{let t=u.data?.filter(t=>t.agent_type===e.id)??[];if(t.length===0)return null;let n=e.available!==!1;return(0,X.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,X.jsxs)(`span`,{className:`px-2 text-2xs font-medium uppercase tracking-wide text-fg-muted`,children:[e.display_name,!n&&(0,X.jsxs)(`span`,{className:`ml-2 normal-case tracking-normal text-fg-muted`,children:[`not installed — no `,e.binary??e.id,` on PATH`]})]}),t.map(e=>(0,X.jsx)(br,{account:e,onLogin:()=>_(e),onStartSession:m&&n?()=>v(e):null,installed:n},e.id))]},e.id)}),u.data?.length===0&&(0,X.jsx)(`p`,{className:`px-2 text-sm text-fg-muted`,children:`No accounts yet — add one in settings.`})]}),(0,X.jsxs)(`div`,{className:`mt-4 flex items-center gap-2`,children:[(0,X.jsxs)(q,{variant:`ghost`,size:`sm`,onClick:()=>{t(!1),on(`accounts`)},children:[(0,X.jsx)(B,{}),`Add account`]}),(0,X.jsxs)(q,{variant:`ghost`,size:`sm`,className:`ml-auto`,onClick:()=>{t(!1),ft.set(null)},children:[(0,X.jsx)(er,{}),`Switch profile`]})]})]})]}),h&&(0,X.jsx)(Ne,{stream:h.stream,label:h.label,onClose:()=>g(null)})]})}var Sr=`desktop-update`;function Cr(){let e=(0,Y.useRef)(null);return(0,Y.useEffect)(()=>{let t=L();if(t?.updateReady===void 0||t.onUpdateReady===void 0)return;let n=t=>{e.current!==t&&(e.current=t,R(`Puddle ${t} is downloaded and ready.`,{id:Sr,duration:1/0,closeButton:!0,action:{label:`Restart to update`,onClick:()=>{L()?.installUpdate?.(),R.loading(`Restarting into Puddle ${t}…`,{id:`${Sr}-restarting`,duration:1/0})}}}))};return t.updateReady().then(e=>{e!==null&&n(e)}),t.onUpdateReady(n)},[]),null}var wr=new He;function Tr({onReview:e}={}){let t=Ke(),n=Ve(),r=T(g().data),i=Ue();return Je(),(0,Y.useEffect)(()=>{if(!(!n||!r||t.isError))for(let n of wr.take(i,ze(t.data))){let t=n.component===`daemon`?`Daemon`:`Runtime software`,a=`host-update-${i}-${n.component}-${n.version}`;R(`${r}: ${t} ${n.version} is available.`,{id:a,duration:1/0,closeButton:!0,action:{label:`Review update`,onClick:e??(()=>on(`host`))}})}},[t.data,t.isError,r,n,i,e]),null}function Er({hostKey:e,enabled:t=!0}){let n=o({queryKey:[`host`],queryFn:async({signal:e})=>Ce.parse(await N(`GET`,`/api/host`,void 0,e)),staleTime:1/0,enabled:t&&!e,retry:!1}),r=e??(n.data?En(n.data):void 0),i=k(),a=i?.generation,s=o({queryKey:[`release-notes`,r],queryFn:async({signal:e})=>{let t=Ee.parse(await N(`GET`,`/api/release-notes`,void 0,e));if(k()!==i||i?.generation!==a)throw Error(`Release notes connection changed`);return t},enabled:t&&!!r,staleTime:1/0,retry:!1});return(0,Y.useEffect)(()=>{t&&r&&s.data&&!s.isError&&Tn(r,s.data)},[t,r,s.data,s.isError]),null}var Dr=(0,Y.lazy)(()=>M(()=>import(`./ReleaseNotesDialog-CbFYKoYM.js`).then(e=>({default:e.ReleaseNotesDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14])));function Or({remote:e=!1}){let t=(0,Y.useSyncExternalStore)(wn.subscribe,wn.snapshot)[0];return(0,Y.useEffect)(()=>{let t=e?[`cockpit`,`remote`]:[`cockpit`];wn.enqueue(`browser`,t.map(e=>({component:e,version:`0.4.9`,markdown:`## [0.4.9] — 2026-11-05
|
|
3
|
+
|
|
4
|
+
### Cockpit
|
|
5
|
+
|
|
6
|
+
#### Added
|
|
7
|
+
|
|
8
|
+
- Hold ⌘⌥/ (Ctrl+Alt+/ on Windows/Linux) to blur the workspace and glance at the host icon and name; release to return immediately.
|
|
9
|
+
- Customise each host’s icon and accent per profile, independently of Settings Sync; choose from 63 host-specific icons and the shared colour palette, with a coherent accent palette across text, controls, surfaces, borders and selections.
|
|
10
|
+
|
|
11
|
+
#### Changed
|
|
12
|
+
|
|
13
|
+
- Coalesce custom cursor movement per frame and reuse hover-role/style checks while preserving theme, font and target changes.
|
|
14
|
+
- Reduce memory held by long-inactive terminals while preserving their local transcripts, scroll position and offline copy; keep recent switches and unsupported terminal states warm.
|
|
15
|
+
- Share session lifecycle eligibility across mobile and desktop; explain unavailable resumes on mobile while keeping live sessions stoppable.
|
|
16
|
+
- Support selective component releases and manifest-pinned bootstrap; notify only for newly published host components, and reject explicitly requested skipped versions.
|
|
17
|
+
- Skip unchanged terminal rich-output projections, resolve tab sessions once, and share delayed blob-download cleanup for worktree downloads.
|
|
18
|
+
- Bound memory retained while streaming local or SSH logs, preserving complete output delivery and normal command capture.
|
|
19
|
+
|
|
20
|
+
#### Fixed
|
|
21
|
+
|
|
22
|
+
- Keep the original and new terminal tabs open after native \`/fork\`, \`/new\` and \`/clear\`; resume the saved original in its own runtime without replaying a prompt.
|
|
23
|
+
- Give active sessions a deeper background than hover in both expanded and collapsed right sidebars.
|
|
24
|
+
|
|
25
|
+
- Describe supported coordinated data purge, its protocol requirement, runtime-stop consent and reboot continuation in CLI help and removal guidance.
|
|
26
|
+
- Keep explorer gestures, confirmations and late file-create replies scoped to their directory; recheck read-only state before committing edits or deletions.
|
|
27
|
+
- Avoid refreshing explorer header controls for selection and drag-state changes.
|
|
28
|
+
- Preserve draft text and original layout ownership when file renames, draft saves or archive replies finish after switching projects; discard stale path and draft-open completions.
|
|
29
|
+
|
|
30
|
+
- Handle cancelled word highlighting and diff replies for disposed editor models during workspace transitions.
|
|
31
|
+
|
|
32
|
+
- Fit collapsed project abbreviations to the rail at the largest readable size, without ellipses.
|
|
33
|
+
- Avoid full-screen terminal redraws for cursor-only synchronised updates while preserving buffered output and the terminal's refresh timeout.
|
|
34
|
+
- Improve compact project-rail label sizing and vertical spacing; align selection and hover fills during dialogue scaling, and dismiss tab actions after pointer exit without losing keyboard access.
|
|
35
|
+
- Keep PDF zoom controls over the visible document instead of below its viewport; allow overlay trays to override their default positioning.
|
|
36
|
+
|
|
37
|
+
### Daemon
|
|
38
|
+
|
|
39
|
+
#### Changed
|
|
40
|
+
|
|
41
|
+
- Share eager compilation dependency watches and bounded asynchronous stats across targets; verify missed events less often with healthy watches and retire unobserved targets sooner.
|
|
42
|
+
|
|
43
|
+
- Protocol 26.3: acknowledge unchanged notebook execution revisions without resending outputs; back off idle and unfocused observation while preserving cross-window discovery and full reconnect snapshots.
|
|
44
|
+
- Stream uploads through bounded private staging with actual-byte limits, enumerate file trees asynchronously, and stop bounded directory downloads on cancellation.
|
|
45
|
+
- Bound Claude reference discovery to transcript prefixes and stream asynchronous usage reads, preserving totals across file replacement, truncation and partial writes.
|
|
46
|
+
- Share pending terminal snapshots at the same input boundary, preserving per-reader memory admission, fresh replay and durable checkpoint behaviour.
|
|
47
|
+
- Batch native conversation ingestion, avoid rewriting unchanged metadata, and read Codex file timestamps asynchronously while retaining complete discovery and missing-file confirmation.
|
|
48
|
+
- Resolve daemon and runtime updates independently from a release manifest, preserving existing pins and legacy catalogue readers.
|
|
49
|
+
- Publish changed notebook cells without repeatedly serialising every completed cell; preserve shared display updates, output clearing and cancellation.
|
|
50
|
+
|
|
51
|
+
#### Fixed
|
|
52
|
+
|
|
53
|
+
- Avoid native Codex database lock waits blocking other agents, and connect new runtimes directly instead of waiting for unrelated unavailable owners.
|
|
54
|
+
- Share bounded CLI version observations across capability checks and refresh them after CLI upgrades.
|
|
55
|
+
- Ignore delayed end hooks from previous conversations and Claude subagent status hooks; bound hook input while preserving Gemini's JSON response contract.
|
|
56
|
+
- Keep OpenCode metadata updates and late replies from switching or completing another conversation; report OpenCode 2's unsupported V1 synchronisation bridge as fallback.
|
|
57
|
+
- Avoid writing conversation presence twice during one catalogue scan, preserving newer lifecycle observations and two-scan deletion confirmation.
|
|
58
|
+
- Avoid scanning the owning Git repository twice during repository discovery.
|
|
59
|
+
|
|
60
|
+
### Runtime
|
|
61
|
+
|
|
62
|
+
#### Fixed
|
|
63
|
+
|
|
64
|
+
- Release idle Codex 0.166+ thread ownership promptly after native conversation switches so the original can run independently of its fork.
|
|
65
|
+
`})))},[e]),t?(0,X.jsx)(Y.Suspense,{fallback:null,children:(0,X.jsx)(Dr,{current:t})}):null}function kr(){let e=I(),t=ge().data?.find(t=>t.id===e),n=he(e??void 0),r=ue(e??void 0,void 0),i=$e(),a=qe(),o=Ye(),s=pe(e??``),c=_e(),l=_(),[u,d]=(0,Y.useReducer)(e=>e+1,0);(0,Y.useEffect)(()=>at(()=>d()),[]);let f=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{f.current=null},[t?.name]);let p=a.data?.available===!0?a.data.file:void 0,m=t!==void 0&&e!==null&&n.data!==void 0&&r.data!==void 0&&p!==void 0,h=t&&p?Be(p,t.name):void 0,g=s.isPending||c.isPending||l.isPending||o.isPending||n.isFetching||r.isFetching;(0,Y.useEffect)(()=>{if(!m||!h?.enabled||g)return;let a={client:i,theme:nt(),profileSettings:n.data,profile:t,scratchpad:r.data},u={setClient:e=>et(e),setTheme:e=>{typeof e==`string`&&j(e)},patchProfileSettings:e=>s.mutate(e),patchProfileColumns:t=>c.mutate({id:e,...t}),createScratchpad:t=>{for(let n of t)l.mutate({profile_id:e,scope:`profile`,title:n.title??void 0,body:n.body,tags:n.tags,agent_type:n.agent_type??void 0})}},d=JSON.stringify(h.doc);if(f.current!==d){f.current=d,Ge(h.doc,u,a,h.groups);return}let p=Ze(h.groups,a),_=JSON.stringify(p);_!==d&&(f.current=_,o.mutate({profile:t.name,entry:{...h,doc:p,updatedAt:new Date().toISOString()}}))})}function Ar(e){let t=t=>{let n=xe.safeParse(t);n.success&&e(n.data)},n=L()?.onNotificationClick?.((e,n)=>t(n)),r=e=>{e.data?.t===`notification-click`&&t(e.data.target)};return navigator.serviceWorker?.addEventListener(`message`,r),()=>{n?.(),navigator.serviceWorker?.removeEventListener(`message`,r)}}var jr=5e3,Mr=`[data-notification-session]`;function Nr(e){let t=null,n=()=>{t=null},r=e=>e.target instanceof Element?e.target.closest(Mr):null,i=e=>{if(!e.isTrusted)return;let n=r(e),i=n?.dataset.notificationSession;t=n&&i?{element:n,session:i,at:performance.now()}:null},a=e=>{r(e)!==t?.element&&n()},o=[`pointerdown`,`keydown`,`input`,`paste`];for(let t of o)e.addEventListener(t,i,!0);return e.addEventListener(`focusin`,a,!0),e.addEventListener(`visibilitychange`,n),e.defaultView?.addEventListener(`blur`,n),{isInteracting(n){return t!==null&&t.session===n&&performance.now()-t.at<jr&&e.visibilityState===`visible`&&e.hasFocus()&&t.element.isConnected&&t.element.dataset.notificationSession===n&&t.element.getClientRects().length>0},dispose(){n();for(let t of o)e.removeEventListener(t,i,!0);e.removeEventListener(`focusin`,a,!0),e.removeEventListener(`visibilitychange`,n),e.defaultView?.removeEventListener(`blur`,n)}}}var Pr=new Set,Fr=e=>!!e&&Pr.has(e),Ir=we.parse({});function Lr(e){return e.prefs.muted_projects.includes(e.projectId)?{desktop:!1,sound:!1}:{desktop:e.prefs.desktop&&(e.permission===`granted`||e.permission===`unverified`)&&(e.prefs.when_focused||!e.sessionFocused),sound:e.prefs.sound}}function Rr(e,t){for(let[,n]of e.getQueriesData({queryKey:[`sessions`]})){let e=n?.find(e=>e.id===t);if(e)return e}for(let[,n]of e.getQueriesData({queryKey:[`project`]})){let e=n?.sessions.find(e=>e.id===t);if(e)return e}}function zr(e){return e.title??e.agent_title??e.osc_title??e.id.slice(0,8)}function Br(){try{let e=new AudioContext,t=e.createGain();t.gain.value=.04,t.connect(e.destination);for(let[n,r]of[[880,0],[1318.5,.09]]){let i=e.createOscillator();i.type=`sine`,i.frequency.value=n,i.connect(t),i.start(e.currentTime+r),i.stop(e.currentTime+r+.12)}setTimeout(()=>void e.close(),400)}catch{}}function Vr(){let e=Tt(),t=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{let e=Nr(document);return t.current=e,()=>{t.current=null,e.dispose()}},[]),(0,Y.useEffect)(()=>Ar(t=>{t.host||e(`/project/${t.project}/session/${t.session}`,{state:{notificationSession:t.session}})}),[e]),Hr(t=>{e(`/project/${t.project_id}/session/${t.id}`,{state:{notificationSession:t.id}})},e=>t.current?.isInteracting(e.id)??!1)}function Hr(e,t=()=>document.hasFocus()){let n=u(),r=(0,Y.useRef)(e);r.current=e;let i=(0,Y.useRef)(t);i.current=t;let a=T(g().data)??`Puddle`,o=(0,Y.useRef)(a);(0,Y.useEffect)(()=>{document.title===o.current&&(document.title=a),o.current=a},[a]),(0,Y.useEffect)(()=>{let e=new Set,t=()=>{document.title=e.size>0?`(${e.size}) ${o.current}`:o.current},a=!0,s=async e=>{let t=Rr(n,e.session);if(!t)try{t=(await se(n)).find(t=>t.id===e.session)}catch{return}if(!a||!t)return;let s=t,c,l;try{let e=await n.fetchQuery({queryKey:[`project`,s.project_id],queryFn:()=>N(`GET`,`/api/projects/${s.project_id}`),staleTime:1e4});if(!a)return;l=e.project;let t=l.profile_id,r=await n.fetchQuery({queryKey:[`profile-settings`,t],queryFn:()=>N(`GET`,`/api/profiles/${t}/settings`),staleTime:1e4});c=we.catch(Ir).parse(r.notifications??{})}catch{return}if(!a)return;let u=Lr({prefs:c,projectId:s.project_id,sessionFocused:i.current(s),permission:We()});u.sound&&Br(),u.desktop&&!Fr(k()?.scope)&&await Xe({id:e.id?`puddle-event-${e.id}`:`puddle-agent-${s.id}`,title:e.content?.title??zr(s).slice(0,160),body:e.content?.body??(e.reason===`exited`?`Agent finished running`:`Waiting for your input`),target:{project:s.project_id,session:s.id,...k()?.notificationHost?{host:k().notificationHost}:{}}},()=>{a&&r.current(s)},{host:o.current,project:l})},c=F.onAgentNotification(e=>{s(e)}),l=F.onStatus(r=>{let i=e.has(r.session);r.status===`waiting_input`?e.add(r.session):e.delete(r.session),t(),!(r.status!==`waiting_input`||i)&&n.fetchQuery({queryKey:[`version`],queryFn:()=>N(`GET`,`/api/version`),staleTime:1/0}).then(e=>{if(!(e.protocol.major>22||e.protocol.major===22&&e.protocol.minor>=3))return s({session:r.session,reason:`waiting_input`})}).catch(()=>{})});return()=>{a=!1,l(),c(),document.title=o.current}},[n])}function Ur({initial:e,defaultScope:t,allowProject:n=!0,agents:r,onSave:i,onCancel:a}){let[o,s]=(0,Y.useState)(e?.title??``),[c,l]=(0,Y.useState)(e?.body??``),[u,d]=(0,Y.useState)(n?e?.scope??t:`profile`),[f,p]=(0,Y.useState)((e?.tags??[]).join(`, `)),[m,h]=(0,Y.useState)(e?.agent_type??null),g=()=>{let e=c.trim();e&&i({title:o.trim()||null,body:e,scope:u,tags:f.split(`,`).map(e=>e.trim()).filter(Boolean),agent_type:m})};return(0,X.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,X.jsx)(z,{value:o,placeholder:`Title (optional)`,spellCheck:!1,onChange:e=>s(e.target.value),onKeyDown:e=>e.stopPropagation(),className:`h-9 text-sm font-medium`}),(0,X.jsx)(Mt,{autoFocus:!0,value:c,placeholder:`Prompt or note…`,spellCheck:!1,rows:10,onChange:e=>l(e.target.value),onKeyDown:e=>{e.stopPropagation(),e.key===`Escape`?a():e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&g()},className:`resize-y text-sm leading-relaxed`}),(0,X.jsx)(z,{value:f,placeholder:`tags, comma, separated`,spellCheck:!1,onChange:e=>p(e.target.value),onKeyDown:e=>e.stopPropagation(),className:`h-8 text-xs`}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[n&&(0,X.jsxs)(`label`,{className:`flex items-center gap-1.5 text-2xs text-fg-secondary`,children:[(0,X.jsx)(ln,{checked:u===`profile`,onCheckedChange:e=>d(e?`profile`:`project`)}),`Profile-wide`]}),(0,X.jsx)(`div`,{className:`ml-auto flex items-center gap-1`,children:r.map(e=>(0,X.jsxs)(`button`,{type:`button`,title:e.display_name,"aria-pressed":m===e.id,onClick:()=>h(t=>t===e.id?null:e.id),className:G(`rounded-md p-1 transition-colors`,m===e.id?`bg-surface text-fg`:`text-fg-gold hover:bg-surface hover:text-fg`),children:[(0,X.jsx)(Zt,{type:e.id,className:`size-3.5`}),(0,X.jsx)(`span`,{className:`sr-only`,children:e.display_name})]},e.id))})]}),(0,X.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5`,children:[(0,X.jsx)(q,{variant:`ghost`,size:`sm`,onClick:a,children:`Cancel`}),(0,X.jsx)(q,{size:`sm`,disabled:!c.trim(),onClick:g,children:`Save`})]})]})}function Wr(){let e=Lt(),t=I(),n=wt().id,r=ue(t??void 0,n).data??[],i=s().data??[],a=_(),o=oe(),c=ne(),l=Ft(),[u,d]=(0,Y.useState)(null),[f,p]=(0,Y.useState)(null),[m,h]=(0,Y.useState)(null),[g,v]=(0,Y.useState)(null),[y,b]=(0,Y.useState)(null);(0,Y.useEffect)(()=>P(`scratchpad.toggle`,zt),[]),(0,Y.useEffect)(()=>{e||(d(null),p(null),h(null))},[e]);let x=(0,Y.useMemo)(()=>[...new Set(r.flatMap(e=>e.tags))].sort((e,t)=>e.localeCompare(t)),[r]),S=(0,Y.useMemo)(()=>[...new Set(r.map(e=>e.agent_type).filter(e=>e!==null))],[r]),C=f!==null||m!==null,ee=r.filter(e=>(f===null||e.tags.includes(f))&&(m===null||e.agent_type===m)),w=C?ee:y??r,T=e=>{t&&(a.mutate({profile_id:t,scope:e.scope,project_id:e.scope===`project`?n:void 0,title:e.title??void 0,body:e.body,tags:e.tags,agent_type:e.agent_type??void 0}),d(null))},E=(e,t)=>{o.mutate({id:e,scope:t.scope,project_id:t.scope===`project`?n??null:null,title:t.title,body:t.body,tags:t.tags,agent_type:t.agent_type}),d(null)},te=(e,t)=>{let n=y??r,i=n.findIndex(t=>t.id===e),a=n.findIndex(e=>e.id===t);if(i===-1||a===-1||i===a)return;let o=n.slice(),[s]=o.splice(i,1);o.splice(a,0,s),b(o)},D=()=>{let e=g,t=y;if(v(null),b(null),e===null||!t)return;let n=t.findIndex(t=>t.id===e);if(n===-1)return;let r=t[n-1],i=t[n+1],a=r?i?(r.position+i.position)/2:r.position+1:(i?i.position:0)-1;o.mutate({id:e,position:a})},re=e=>{navigator.clipboard?.writeText(e.body),R.success(`Copied to clipboard`)};return(0,X.jsxs)(Cn,{open:e,onOpenChange:Rt,children:[(0,X.jsxs)(U,{children:[(0,X.jsx)(W,{asChild:!0,children:(0,X.jsx)(Sn,{asChild:!0,children:(0,X.jsxs)(q,{variant:`ghost`,size:`icon`,className:`compact:h-7 compact:w-7`,children:[(0,X.jsx)(Qn,{}),(0,X.jsx)(`span`,{className:`sr-only`,children:`Scratchpad`})]})})}),(0,X.jsx)(V,{children:`Scratchpad`})]}),(0,X.jsxs)(xn,{className:`w-[34rem] max-w-[calc(100vw-1rem)] p-0`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2 px-5 pb-2 pt-4`,children:[(0,X.jsx)(`span`,{className:`text-2xs font-medium uppercase tracking-wide text-fg-gold`,children:`Scratchpad`}),(0,X.jsxs)(`button`,{type:`button`,onClick:()=>d(u===`new`?null:`new`),className:G(At,`ml-auto`),children:[(0,X.jsx)(B,{className:`size-4`}),(0,X.jsx)(`span`,{className:`sr-only`,children:`New entry`})]})]}),(x.length>0||S.length>0)&&(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 px-5 pb-2`,children:[x.map(e=>(0,X.jsx)(`button`,{type:`button`,onClick:()=>p(t=>t===e?null:e),className:G(`rounded-full px-2 py-0.5 text-2xs transition-colors`,f===e?`bg-action text-action-ink`:`bg-surface text-fg-secondary hover:text-fg`),children:e},e)),S.map(e=>(0,X.jsx)(`button`,{type:`button`,"aria-pressed":m===e,onClick:()=>h(t=>t===e?null:e),className:G(`rounded-md p-1 transition-colors`,m===e?`bg-action text-action-ink`:`text-fg-gold hover:bg-surface`),children:(0,X.jsx)(Zt,{type:e,className:`size-3.5`})},e))]}),(0,X.jsxs)(`div`,{className:`no-scrollbar max-h-[65vh] overflow-y-auto px-2 pb-3`,children:[u===`new`&&(0,X.jsx)(`div`,{className:`px-3 py-2`,children:(0,X.jsx)(Ur,{defaultScope:n?`project`:`profile`,allowProject:n!==void 0,agents:i,onSave:T,onCancel:()=>d(null)})}),w.length===0&&u!==`new`&&(0,X.jsx)(`p`,{className:`px-3 py-3 text-sm text-fg-muted`,children:C?`Nothing matches this filter.`:`No entries yet — press + to add a reusable prompt or note.`}),(0,X.jsx)(`ul`,{className:`flex flex-col`,children:w.map(e=>u===e.id?(0,X.jsx)(`li`,{className:`px-3 py-2`,children:(0,X.jsx)(Ur,{initial:e,defaultScope:e.scope,allowProject:n!==void 0||e.scope===`project`,agents:i,onSave:t=>E(e.id,t),onCancel:()=>d(null)})},e.id):(0,X.jsx)(`li`,{draggable:!C&&u===null,onDragStart:t=>{t.dataTransfer.effectAllowed=`move`,v(e.id)},onDragOver:t=>{g!==null&&(t.preventDefault(),g!==e.id&&te(g,e.id))},onDragEnd:D,className:G(`transition-opacity`,g===e.id&&`opacity-50`),children:(0,X.jsx)(Gr,{entry:e,onInsert:l?()=>{l(e.body),Rt(!1)}:null,onCopy:()=>re(e),onEdit:()=>d(e.id),onDelete:()=>c.mutate(e.id)})},e.id))})]})]})]})}function Gr({entry:e,onInsert:t,onCopy:n,onEdit:r,onDelete:i}){let[a,o]=(0,Y.useState)(!1);return(0,X.jsxs)(`div`,{onClick:e=>{e.target.closest(`button`)||r()},className:`cursor-pointer rounded-md px-3 py-2.5 transition-colors hover:bg-surface`,children:[e.title&&(0,X.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:e.title}),(0,X.jsx)(`p`,{className:G(`line-clamp-3 whitespace-pre-wrap text-sm text-fg-secondary`,e.title&&`mt-0.5`),children:e.body}),a?(0,X.jsxs)(`div`,{className:`mt-2 flex items-center gap-3`,children:[(0,X.jsx)(`span`,{className:`text-2xs text-fg-muted`,children:`Delete this entry? This can’t be undone.`}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>{o(!1),i()},className:G(jt,`text-danger`),children:`Delete`}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>o(!1),className:jt,children:`Cancel`})]}):(0,X.jsxs)(`div`,{className:`mt-2 flex items-center gap-1.5`,children:[(0,X.jsx)(`span`,{className:`text-2xs uppercase tracking-wide text-fg-muted`,children:e.scope===`profile`?`Profile-wide`:`Project`}),e.agent_type&&(0,X.jsx)(Zt,{type:e.agent_type,className:`size-3 text-fg-gold`}),e.tags.map(e=>(0,X.jsx)(`span`,{className:`rounded-full bg-surface px-1.5 text-2xs text-fg-secondary`,children:e},e)),(0,X.jsxs)(pn,{label:`Scratchpad entry actions`,className:`ml-auto`,children:[t&&(0,X.jsx)(Kr,{icon:Yn,label:`Insert into focused terminal`,onClick:t}),(0,X.jsx)(Kr,{icon:un,label:`Copy`,onClick:n}),(0,X.jsx)(Kr,{icon:je,label:`Edit`,onClick:r}),(0,X.jsx)(Kr,{icon:Nt,label:`Delete`,onClick:()=>o(!0)})]})]})]})}function Kr({icon:e,label:t,onClick:n}){return(0,X.jsxs)(U,{children:[(0,X.jsx)(W,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,onClick:n,className:At,children:[(0,X.jsx)(e,{className:`size-3.5`}),(0,X.jsx)(`span`,{className:`sr-only`,children:t})]})}),(0,X.jsx)(V,{children:t})]})}var qr=Se.parse({});function Jr(e,t){let[n,r]=(0,Y.useState)(null),i=S(t).data,o=fe(e??void 0,t&&e!==null).data;return(0,Y.useEffect)(()=>{if(!t||e===null){r(null);return}let n=!1,i;try{i=en(sessionStorage.getItem(Qt(e)))}catch{i={kind:`absent`}}if(i.kind===`present`){r(i.snapshot);return}return ve(e).then(e=>{n||r(e?e.ui_state:qr)}).catch(()=>{n||r(qr)}),()=>{n=!0}},[t,e]),(0,Y.useMemo)(()=>{if(!t||e===null||n===null)return null;let s=t=>{if(!i||!o)return!1;let{patch:s,projectBased:c}=Kt(n,t,{alive:new Set(i.filter(e=>e.status!==`archived`).map(e=>e.id)),sessionProject:new Map(i.map(e=>[e.id,e.project_id])),projectIds:o.map(e=>e.id),currentProject:null}),l={...n,...s};r(l),a(e,l).catch(e=>console.warn(`ui-state save failed: ${e.message}`));try{sessionStorage.setItem(Qt(e),JSON.stringify(l))}catch(e){console.warn(`ui-state write failed: ${e.message}`)}return tt().projectBasedLayout!==c&&et({projectBasedLayout:c}),!0},c=Object.fromEntries(Object.entries(n.project_layouts).map(([e,t])=>[e,{layoutRef:t.layout_ref,signature:H(t.layout_tree)}]));return(n.layout_mode??`profile`)===`project`?{headless:!0,scope:`project`,projectId:``,layoutRef:null,signature:H(null),slices:c,capture:()=>({layout_tree:null,active_session:null}),apply:s}:{scope:`profile`,projectId:``,layoutRef:n.layout_ref,signature:H(n.layout_tree),slices:c,capture:()=>({layout_tree:n.layout_tree,active_session:n.active_session}),apply:s}},[t,e,n,i,o])}var Yr=H(null);function Xr(){let e=qt(),t=Tt(),n=I(),r=Xt(),i=Jr(n,e&&r===null),a=r??i,o=ae(n??void 0,void 0).data??[],s=fe(n??void 0,e&&n!==null).data??[],c=b(),l=le(),u=p(),[d,f]=(0,Y.useState)(``),[m,h]=(0,Y.useState)(!1),[g,_]=(0,Y.useState)(null);(0,Y.useEffect)(()=>P(`layouts.toggle`,Gt),[]),(0,Y.useEffect)(()=>{e||(f(``),h(!1),_(null))},[e]);let v=a?.headless===!0,y=a===null||v?null:o.find(e=>e.id===a.layoutRef)??null,x=a!==null&&!v&&(y===null?a.signature!==Yr:H(y.layout_tree)!==a.signature),S=e=>{let t=a?.slices?.[e];if(!t)return!1;let n=t.layoutRef===null?null:o.find(e=>e.id===t.layoutRef)??null;return n?H(n.layout_tree)!==t.signature:t.signature!==Yr},C=e=>a===null?!1:e.scope===`profile`?a.scope===`profile`&&x:e.project_id===null?!1:a.scope===`project`?!v&&e.project_id===a.projectId?x:S(e.project_id):x||S(e.project_id),ee=e=>y!==null&&e.id===y.id,w=e=>(e===null?void 0:s.find(t=>t.id===e)?.name)??`Project`,T=a!==null&&!v&&a.scope===`project`?o.filter(e=>e.scope===`profile`||e.project_id===a.projectId):o,E=[...T.some(e=>e.scope===`profile`)?[{key:`profile`,name:`Profile-wide`}]:[],...[...new Set(T.flatMap(e=>e.project_id===null?[]:[e.project_id]))].map(e=>({key:e,name:w(e)})).sort((e,t)=>e.name.localeCompare(t.name))],te=g===null?T:g===`profile`?T.filter(e=>e.scope===`profile`):T.filter(e=>e.project_id===g),D=e=>a!==null&&e.scope===a.scope&&(a.scope===`profile`||e.project_id===a.projectId),ne=(e,t,r)=>{!a||!n||c.mutate({profile_id:n,scope:a.scope,project_id:a.scope===`project`?a.projectId:void 0,name:e,...t},{onSuccess:e=>{r&&a.apply(e)},onError:e=>J(e)})},re=e=>{if(!a)return;let t=D(e)?e:o.find(t=>t.name===e.name&&D(t));if(!t){ne(e.name,a.capture(),!0);return}l.mutate({id:t.id,...a.capture()},{onSuccess:e=>a.apply(e),onError:e=>J(e)})},ie=(e,t)=>ne(t,{layout_tree:e.layout_tree,active_session:e.active_session},!1),oe=e=>{if(a){if(!a.apply(e)){R.error(`Workspace is still loading — try again in a moment`);return}e.project_id!==null&&e.project_id!==a.projectId&&t(`/project/${e.project_id}`),Ut(!1)}};return(0,X.jsxs)(Cn,{open:e,onOpenChange:Ut,children:[(0,X.jsxs)(U,{children:[(0,X.jsx)(W,{asChild:!0,children:(0,X.jsx)(Sn,{asChild:!0,children:(0,X.jsxs)(q,{variant:`ghost`,size:`icon`,className:`compact:h-7 compact:w-7`,children:[(0,X.jsx)(Xn,{}),(0,X.jsx)(`span`,{className:`sr-only`,children:`Layouts`})]})})}),(0,X.jsx)(V,{children:`Layouts`})]}),(0,X.jsxs)(xn,{className:`w-[26rem] max-w-[calc(100vw-1rem)] p-0`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2 px-5 pb-2 pt-4`,children:[(0,X.jsx)(`span`,{className:`text-2xs font-medium uppercase tracking-wide text-fg-gold`,children:`Layouts`}),a!==null&&!v&&(0,X.jsxs)(`button`,{type:`button`,onClick:()=>h(e=>!e),className:G(`inline-flex size-[var(--ui-control-height)] shrink-0 cursor-pointer items-center justify-center rounded-[var(--ui-radius)] text-fg transition-colors hover:bg-elevated disabled:pointer-events-none disabled:opacity-50`,`ml-auto`),children:[(0,X.jsx)(B,{className:`size-4`}),(0,X.jsx)(`span`,{className:`sr-only`,children:`Save the current layout as a new layout`})]})]}),a===null?(0,X.jsx)(`p`,{className:`px-5 pb-3 text-sm text-fg-muted`,children:`Loading the profile’s layout state…`}):v?(0,X.jsx)(`p`,{className:`px-5 pb-3 text-sm text-fg-muted`,children:`Project-based layout is on — every project keeps its own layout. Open a project to name or save it; loading works from here.`}):(y===null||m)&&(0,X.jsxs)(`div`,{className:`flex flex-col gap-2 px-5 pb-3`,children:[y===null&&(0,X.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,X.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:`Unnamed layout`}),(0,X.jsx)(`span`,{className:`text-2xs uppercase tracking-wide text-fg-muted`,children:a.scope===`profile`?`Profile-wide`:`Project`}),(0,X.jsx)(`span`,{className:`ml-auto text-2xs text-interrupted`,children:`Unsaved`})]}),(0,X.jsxs)(`form`,{className:`flex items-center gap-1.5`,onSubmit:e=>{e.preventDefault();let t=d.trim();t&&(ne(t,a.capture(),!0),f(``),h(!1))},children:[(0,X.jsx)(z,{autoFocus:m,value:d,placeholder:y===null?`Name this layout…`:`Save as a new layout…`,spellCheck:!1,onChange:e=>f(e.target.value),onKeyDown:e=>{e.stopPropagation(),e.key===`Escape`&&h(!1)},className:`h-8 flex-1 text-sm`}),(0,X.jsx)(q,{size:`sm`,type:`submit`,disabled:!d.trim(),children:`Save`}),y!==null&&(0,X.jsx)(q,{variant:`ghost`,size:`sm`,onClick:()=>h(!1),children:`Cancel`})]})]}),E.length>1&&(0,X.jsx)(`div`,{className:`flex flex-wrap items-center gap-1 px-5 pb-2`,children:E.map(e=>(0,X.jsx)($r,{active:g===e.key,onClick:()=>_(t=>t===e.key?null:e.key),children:e.name},e.key))}),(0,X.jsxs)(`div`,{className:`no-scrollbar max-h-[60vh] overflow-y-auto px-2 pb-3`,children:[te.length===0&&(0,X.jsx)(`p`,{className:`px-3 py-3 text-sm text-fg-muted`,children:g===null?`No layouts yet — name and save the current layout to keep it.`:`Nothing matches this filter.`}),(0,X.jsx)(`ul`,{className:`flex flex-col`,children:te.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsx)(Zr,{layout:e,projectLabel:e.scope===`profile`?null:w(e.project_id),isCurrent:ee(e),dirty:x,loadable:a!==null,savable:a!==null&&!v,confirmBeforeLoad:C(e),overwrites:D(e),onLoad:()=>oe(e),onRename:t=>l.mutate({id:e.id,name:t}),onDelete:()=>u.mutate(e.id),onSaveAs:()=>re(e),onDuplicate:t=>ie(e,t)})},e.id))})]})]})]})}function Zr({layout:e,projectLabel:t,isCurrent:n,dirty:r,loadable:i,savable:a,confirmBeforeLoad:o,overwrites:s,onLoad:c,onRename:l,onDelete:u,onSaveAs:d,onDuplicate:f}){let[p,m]=(0,Y.useState)(null),[h,g]=(0,Y.useState)(null),[_,v]=(0,Y.useState)(e.name),y=()=>{if(!(!i||h!==null)){if(o&&p!==`load`){m(`load`);return}m(null),c()}},b=t=>{m(null),v(t===`rename`?e.name:`${e.name} copy`),g(t)},x=()=>{if(n){d();return}m(`save`)},S=n?r?`unsaved`:`active`:null;return(0,X.jsxs)(`div`,{onClick:e=>{e.target.closest(`button, input`)||y()},className:G(`rounded-md px-3 py-2.5 transition-colors`,i&&`cursor-pointer hover:bg-surface`),children:[h===null?(0,X.jsxs)(`p`,{className:G(`flex items-baseline gap-2 text-sm font-medium`,S===`active`?`text-success`:S===`unsaved`?`text-interrupted`:`text-fg`),children:[e.name,S!==null&&(0,X.jsx)(`span`,{className:`text-2xs font-normal`,children:S===`active`?`Active`:`Unsaved`})]}):(0,X.jsxs)(`form`,{className:`flex items-center gap-1.5`,onSubmit:t=>{t.preventDefault();let n=_.trim();n&&(h===`rename`?n!==e.name&&l(n):f(n)),g(null)},children:[(0,X.jsx)(z,{autoFocus:!0,value:_,spellCheck:!1,onChange:e=>v(e.target.value),onKeyDown:e=>{e.stopPropagation(),e.key===`Escape`&&g(null)},className:`h-7 flex-1 text-sm`}),(0,X.jsx)(q,{size:`sm`,type:`submit`,disabled:!_.trim(),children:h===`rename`?`Rename`:`Save`})]}),p===`save`?(0,X.jsx)(Qr,{question:s?`Overwrite “${e.name}” with the current layout?`:`Save the current layout as “${e.name}” here?`,verb:s?`Overwrite`:`Save`,onConfirm:()=>{m(null),d()},onCancel:()=>m(null)}):p===`delete`?(0,X.jsx)(Qr,{question:`Delete this layout? This can’t be undone.`,verb:`Delete`,onConfirm:()=>{m(null),u()},onCancel:()=>m(null)}):p===`load`?(0,X.jsx)(Qr,{question:`Loading discards unsaved layout changes.`,verb:`Load`,onConfirm:y,onCancel:()=>m(null)}):(0,X.jsxs)(`div`,{className:`mt-2 flex items-center gap-1.5`,children:[t!==null&&(0,X.jsx)(`span`,{className:`text-2xs uppercase tracking-wide text-fg-muted`,children:t}),(0,X.jsxs)(pn,{label:`Layout actions`,className:`ml-auto`,children:[a&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ei,{icon:$n,label:n?`Save`:`Save the current layout as “${e.name}”`,onClick:x}),(0,X.jsx)(ei,{icon:un,label:`Duplicate`,onClick:()=>b(`duplicate`)})]}),(0,X.jsx)(ei,{icon:je,label:`Rename`,onClick:()=>b(`rename`)}),(0,X.jsx)(ei,{icon:Nt,label:`Delete`,onClick:()=>m(`delete`)})]})]})]})}function Qr({question:e,verb:t,onConfirm:n,onCancel:r}){return(0,X.jsxs)(`div`,{className:`mt-2 flex items-center gap-3`,children:[(0,X.jsx)(`span`,{className:`text-2xs text-fg-muted`,children:e}),(0,X.jsx)(`button`,{type:`button`,onClick:n,className:G(jt,`text-danger`),children:t}),(0,X.jsx)(`button`,{type:`button`,onClick:r,className:jt,children:`Cancel`})]})}function $r({active:e,onClick:t,children:n}){return(0,X.jsx)(`button`,{type:`button`,"aria-pressed":e,onClick:t,className:G(`rounded-full px-2 py-0.5 text-2xs transition-colors`,e?`bg-action text-action-ink`:`bg-surface text-fg-secondary hover:text-fg`),children:n})}function ei({icon:e,label:t,onClick:n}){return(0,X.jsxs)(U,{children:[(0,X.jsx)(W,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,onClick:n,className:At,children:[(0,X.jsx)(e,{className:`size-3.5`}),(0,X.jsx)(`span`,{className:`sr-only`,children:t})]})}),(0,X.jsx)(V,{children:t})]})}var $=L()!==void 0&&/Mac/.test(navigator.platform),ti=(0,Y.lazy)(()=>M(()=>import(`./SettingsDialog-BvaE3Ue8.js`).then(e=>({default:e.SettingsDialog})),__vite__mapDeps([15,1,2,16,17,3,18,19,20,5,6,7,8,9,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44])));function ni(){let e=u();(0,Y.useEffect)(()=>{let t=t=>{for(let[n,r]of e.getQueriesData({queryKey:[`sessions`]}))r&&e.setQueryData(n,r.map(t));for(let[n,r]of e.getQueriesData({queryKey:[`project`]}))r&&e.setQueryData(n,{...r,sessions:r.sessions.map(t)})},n=F.onStatus(e=>t(t=>t.id===e.session?{...t,status:e.status,last_activity_at:e.last_activity_at}:t)),r=F.onRenamed(e=>t(t=>t.id===e.session?{...t,title:e.title,agent_title:`agent_title`in e?e.agent_title:t.agent_title,osc_title:`osc_title`in e?e.osc_title:t.osc_title}:t)),i=F.onAccount(t=>{for(let[n,r]of e.getQueriesData({queryKey:[`accounts`]}))r&&e.setQueryData(n,r.map(e=>e.id===t.account_id?{...e,logged_in:t.logged_in}:e))}),a=t=>{e.invalidateQueries({queryKey:[`sessions`]});for(let n of t)e.invalidateQueries({queryKey:[`project`,n]})},o=F.onSessionsChanged(e=>a(e.project_ids)),s=F.onSessionSwitched(e=>a([e.target_project]));return()=>{n(),r(),i(),o(),s()}},[e])}function ri(){let e=Pe(),t=g(),n=r(),[i,a]=(0,Y.useState)(!1),o=T(t.data),s=e=>{a(!1);let r=e.trim();r!==o&&n.mutate({displayName:r===t.data?.hostname?``:r},{onError:e=>J(e)})},c=(0,X.jsx)(Re,{icon:e.icon}),l=G(`host-identity flex h-full shrink-0 items-center gap-2 px-4`,$&&`[-webkit-app-region:no-drag]`),u=`truncate font-sans text-xs font-normal`;return i&&o!==void 0?(0,X.jsxs)(`div`,{className:l,children:[c,(0,X.jsx)(tn,{initial:t.data?.displayName??o,maxLength:64,className:G(u,`w-40`),onCommit:s,onCancel:()=>a(!1)})]}):(0,X.jsxs)(bt,{to:`/`,className:G(l,`hover:bg-elevated focus-visible:bg-elevated`),title:`All projects`,children:[c,o!==void 0&&(0,X.jsx)(`span`,{className:u,...Jt(()=>a(!0)),children:o})]})}function ii(){let e=wt(),t=pt(`palette.toggle`),n=ce(e.id).data?.project,r=n!==void 0&&n.id===e.id?n.name:void 0;return(0,X.jsx)(`button`,{type:`button`,onClick:Pt,className:G(`flex h-full min-w-0 w-full cursor-pointer items-center justify-center gap-2 bg-transparent px-2 font-normal text-fg-muted transition-colors hover:bg-elevated focus-visible:bg-elevated`,$&&`[-webkit-app-region:no-drag]`),children:(0,X.jsxs)(`span`,{className:G(`pointer-events-none absolute left-1/2 top-1/2 flex max-w-[40%] -translate-x-1/2 -translate-y-1/2 items-center gap-2`,r&&A(n?.colour)),children:[(0,X.jsx)(`span`,{className:`truncate text-xs`,children:r??`Puddle`}),(0,X.jsx)(`span`,{className:`shrink-0 text-2xs`,children:t})]})})}function ai(){let e=Pe(),{fullScreen:t,animate:n}=lt(),r=$&&!t;return(0,X.jsxs)(`header`,{"data-host-colour":e.colour??void 0,onClick:e=>{let t=e.target;e.currentTarget.contains(t)&&(t.closest(`[data-header-section], [aria-label="Workspace controls"], button, a, input`)||Pt())},className:G(`host-header island-outline relative grid shrink-0 cursor-pointer grid-cols-[auto_1px_minmax(0,1fr)_1px_auto] items-center overflow-hidden rounded-[var(--ui-surface-radius)] bg-surface`,`h-9`,!$&&`mx-1.5 mt-1.5`,r&&`pl-[84px] [-webkit-app-region:drag]`,n&&`transition-[padding] duration-200 ease-out`),children:[r&&(0,X.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute left-[84px] top-1/2 h-5 w-px -translate-y-1/2 bg-border`}),(0,X.jsx)(`div`,{"data-header-section":!0,className:`flex h-full min-w-0 cursor-default items-center overflow-hidden`,children:(0,X.jsx)(ri,{})}),(0,X.jsx)(`div`,{"aria-hidden":`true`,className:`h-5 w-px bg-border`}),(0,X.jsx)(ii,{}),(0,X.jsx)(`div`,{"aria-hidden":`true`,className:`h-5 w-px bg-border`}),(0,X.jsxs)(pn,{label:`Workspace controls`,className:G(`shell-header-actions h-full justify-self-end rounded-none!`,$&&`[-webkit-app-region:no-drag]`),children:[(0,X.jsxs)(U,{children:[(0,X.jsx)(W,{asChild:!0,children:(0,X.jsxs)(q,{variant:`ghost`,size:`icon`,className:`compact:h-7 compact:w-7`,onClick:()=>on(),children:[(0,X.jsx)(tr,{}),(0,X.jsx)(`span`,{className:`sr-only`,children:`Settings`})]})}),(0,X.jsx)(V,{children:`Settings`})]}),(0,X.jsx)(Xr,{}),(0,X.jsx)(Wr,{}),(0,X.jsx)(xr,{})]})]})}function oi(){ni(),kr(),Vr();let{handler:e}=Vt(),t=I(),{pathname:n}=St(),[r,i]=(0,Y.useState)(!1),a=be(),o=a.data!==void 0&&me(a.data.protocol);return(0,Y.useEffect)(()=>{if(!o)return;let e=()=>{let e=rt();F.reportTheme(e(`--text-primary`),e(`--bg-base`))};return e(),at(e)},[o]),(0,X.jsxs)(`div`,{className:`flex h-screen flex-col overflow-hidden overscroll-y-none bg-ground`,children:[(0,X.jsx)(Qe,{}),(0,X.jsx)(rr,{}),(0,X.jsx)(ai,{}),(0,X.jsx)(`main`,{className:`min-h-0 flex-1`,children:(0,X.jsx)(Mn,{resetOn:n,scope:n.startsWith(`/project/`)?`workspace`:`view`,children:(0,X.jsx)(Ct,{})})}),(0,X.jsx)(ir,{}),(0,X.jsx)(gr,{}),(0,X.jsx)(Cr,{}),(0,X.jsx)(Tr,{}),(0,X.jsx)(Er,{}),(0,X.jsx)(Or,{}),(0,X.jsx)(dr,{onNewSession:e??void 0,onNewProject:()=>i(!0)}),t!==null&&(0,X.jsx)(fn,{profileId:t,open:r,onOpenChange:i}),(0,X.jsx)(Y.Suspense,{fallback:null,children:(0,X.jsx)(ti,{})}),(0,X.jsx)(mr,{})]})}function si(){return(0,X.jsx)(It,{children:(0,X.jsx)(oi,{})})}var ci=(0,Y.lazy)(()=>M(()=>import(`./Dashboard-6pSi_1fH.js`).then(e=>({default:e.Dashboard})),__vite__mapDeps([45,1,2,16,17,3,18,19,20,5,6,7,8,9,21,24,25,46,32,47,48,35,49,41,40]))),li=(0,Y.lazy)(()=>M(()=>import(`./Workspace-Bf2zQC6v.js`).then(e=>({default:e.Workspace})),__vite__mapDeps([50,1,2,6,16,17,3,18,19,20,5,7,8,9,21,29,30,23,31,24,25,51,52,48,35,46,27,53,26,54,55,32,47,56,33,34,57,58,38,39,40,59,60,61,62,43,63]))),ui=new jn({defaultOptions:{queries:{retry:1,staleTime:5e3}},mutationCache:new On({onError:e=>J(e)})});function di(){let e=I(),t=ge(),n=e!==null&&t.data!==void 0&&!t.data.some(t=>t.id===e);return e===null||n?(0,X.jsx)(nr,{}):(0,X.jsx)(Dt,{useTransitions:!1,children:(0,X.jsx)(Y.Suspense,{fallback:null,children:(0,X.jsx)(xt,{children:(0,X.jsxs)(Ot,{element:(0,X.jsx)(si,{}),children:[(0,X.jsx)(Ot,{path:`/`,element:(0,X.jsx)(ci,{})}),(0,X.jsx)(Ot,{path:`/project/:id`,element:(0,X.jsx)(li,{})}),(0,X.jsx)(Ot,{path:`/project/:id/session/:sid`,element:(0,X.jsx)(li,{})})]})})})})}function fi(){let e=(0,Y.useSyncExternalStore)(Oe.subscribe,Oe.get);return(0,X.jsx)(te,{client:ui,children:(0,X.jsxs)(Yt,{delayDuration:300,children:[(0,X.jsx)(Jn,{}),(0,X.jsx)(Mn,{scope:`app`,children:e?window.location.pathname.startsWith(`/forward/`)?(0,X.jsx)(Dn,{}):(0,X.jsx)(di,{}):(0,X.jsx)(Pn,{})}),(0,X.jsx)(Nn,{})]})})}export{fi as App};
|
package/dist/public/assets/{CompilationCommandForm-Csg3VkC6.js → CompilationCommandForm-CipGdjjH.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{Ct as n,St as r}from"./protocol-support-TSI4Ig6W.js";import{t as i}from"./jsx-runtime-By8HlURe.js";import{n as a}from"./api-B90WKMKj.js";import{t as o}from"./button-C_Rvtcwg.js";var s={agent:{baseBranch:``,separateBranch:!1,separateWorktree:!1},terminal:{baseBranch:``,separateBranch:!1,separateWorktree:!1}};function c(e,t){let n=t?.sessionDefaults?.[e],r=s[e],i=n?.separateBranch??r.separateBranch;return{baseBranch:n?.baseBranch??r.baseBranch,separateBranch:i,separateWorktree:i?!0:n?.separateWorktree??r.separateWorktree}}function l(e){return n({queryKey:[`compilation-capabilities`],queryFn:()=>a(`GET`,`/api/compilation/capabilities`),enabled:e,staleTime:3e4,refetchOnWindowFocus:!0})}function u(){return r({mutationFn:e=>a(`POST`,`/api/compilation/run`,e)})}function d(e){return a(`PUT`,`/api/compilation/mode`,e)}function f(e){return a(`POST`,`/api/compilation/status`,e)}function p(e,t){return n({queryKey:[`compilation-status`,e],queryFn:()=>f(e),enabled:t,refetchInterval:750,refetchIntervalInBackground:!1,retry:2})}function m(e){return n({queryKey:[`compilation-settings`,e],queryFn:()=>a(`POST`,`/api/compilation/settings`,e),enabled:e!==null,staleTime:3e4})}function h(e){return a(`PUT`,`/api/compilation/settings`,e)}function g(e){return n({queryKey:[`compilation-defaults`,e],queryFn:()=>a(`POST`,`/api/compilation/defaults`,e),enabled:e!==null,staleTime:3e4})}function _(e){return a(`PUT`,`/api/compilation/defaults`,e)}var v=e(t(),1);function y(e){return e.inherited_command??e.default_command}function b(e){return e.override_command??y(e)??``}function x(e,t){let n=t.trim();return n===``||n===y(e)?null:n}var S=i();function C({settings:e,onSave:t,onCancel:n}){let[r,i]=(0,v.useState)({}),[a,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(null),u=e.commands.flatMap(e=>{let t=r[e.mode];if(t===void 0)return[];let n=x(e,t);return n===e.override_command?[]:[{mode:e.mode,command:n}]}),d=async()=>{let n=e.commands.find(e=>(r[e.mode]??b(e)).trim()===``&&y(e)!==null);if(n){l(`${w(n.mode)} needs a command or its default.`);return}s(!0),l(null);try{await t(u),i({})}catch(e){l(e instanceof Error?e.message:`Couldn’t save compilation settings`)}finally{s(!1)}};return(0,S.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),a||d()},children:[e.commands.map(e=>{let t=r[e.mode]??b(e),n=y(e),o=t===(n??``);return(0,S.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,S.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,S.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:w(e.mode)}),(0,S.jsx)(`span`,{className:`text-xs leading-relaxed text-fg-muted`,children:e.mode===`on_demand`?`Runs when you click the play icon.`:`Runs when eager mode starts, then after the file or a discovered dependency changes on disk.`}),(0,S.jsx)(`textarea`,{rows:3,spellCheck:!1,disabled:a,value:t,onChange:t=>i(n=>({...n,[e.mode]:t.target.value})),className:`resize-y rounded-md bg-surface px-2.5 py-2 font-mono text-xs leading-relaxed text-fg outline-none transition-colors hover:bg-ground focus:bg-ground disabled:opacity-50`,"aria-label":`${w(e.mode)} command`})]}),(0,S.jsxs)(`div`,{className:`flex min-h-6 items-center justify-between gap-3 text-xs text-fg-muted`,children:[(0,S.jsx)(`span`,{children:o?e.inherited_command?`Using the language default`:n?`Using the provider default`:`No provider default available on this host`:`Custom command`}),(!o||e.override_command!==null)&&(0,S.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>i(t=>({...t,[e.mode]:n??``})),className:`cursor-pointer rounded-sm px-1.5 py-0.5 text-fg-secondary transition-colors hover:bg-surface hover:text-fg disabled:cursor-default disabled:opacity-50`,children:`Use default`})]})]},e.mode)}),e.variables.length>0&&(0,S.jsxs)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:[`Available values:`,` `,e.variables.map((e,t)=>(0,S.jsxs)(`span`,{title:e.description,children:[t>0&&` · `,(0,S.jsx)(`code`,{className:`font-mono text-fg-secondary`,children:e.placeholder})]},e.placeholder))]}),c&&(0,S.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:c}),(0,S.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[n&&(0,S.jsx)(o,{type:`button`,variant:`ghost`,disabled:a,onClick:n,children:`Cancel`}),(0,S.jsx)(o,{type:`submit`,disabled:a||!n&&Object.keys(r).length===0,children:a?`Saving…`:`Save`})]})]})}function w(e){return e===`on_demand`?`When clicked`:`Upon file change`}export{l as a,p as c,h as i,u as l,d as n,g as o,_ as r,m as s,C as t,c as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{g as n,lt as r,mt as i,nt as a,ot as o,rt as s,yt as c,z as l}from"./protocol-support-TSI4Ig6W.js";import{b as u}from"./auth-CdosKReE.js";import{a as d,c as f,d as p,i as m,o as h,s as g,t as _,u as v}from"./LazyTerminal-B88WIvyh.js";import{t as y}from"./jsx-runtime-By8HlURe.js";import{h as b,t as x,v as S}from"./ws-Cp1eCJaM.js";import{a as C,c as w,i as T,r as E}from"./session-order-CiDVvIU5.js";import{a as D,o as O,r as k,s as A,t as ee}from"./dialog-D-Axqpzg.js";import{n as j,t as M}from"./chevron-right-BEy-IXEZ.js";import{n as N}from"./createLucideIcon-C9A1vLE-.js";import{t as P}from"./button-C_Rvtcwg.js";import{c as F,d as I,n as L,r as R,t as z,u as B}from"./context-menu-D3ZhKA9s.js";import{n as V,t as H}from"./NewProjectDialog-C1TVzOvJ.js";import{n as U}from"./errors-tuvbq1a_.js";var W=e(t(),1),G=y(),K=!1;function q(){let[e,t]=(0,W.useState)(K),[n,r]=(0,W.useState)(null);(0,W.useEffect)(()=>{if(!e)return;let t=!1;return x.spawnShell(u).then(e=>{t||r(e)}),()=>{t=!0}},[e]);let i=()=>{K=!1,t(!1),r(null)};return{open:e,term:n,toggle:()=>{e?(n&&x.killShell(u,n),i()):(K=!0,t(!0))},onExit:i}}function J({term:e,onExit:t}){return(0,G.jsx)(`div`,{className:`h-72 shrink-0 pb-6`,children:(0,G.jsx)(`div`,{className:`mx-auto size-full max-w-4xl px-6`,children:(0,G.jsx)(`div`,{className:`workspace-surface island-outline size-full bg-surface p-1`,children:(0,G.jsx)(`div`,{className:`size-full overflow-hidden rounded-[var(--ui-radius)] bg-ground p-1`,children:e!==null&&(0,G.jsx)(_,{stream:`home`,term:e,onExit:t})})})})})}var Y=`group block w-full island-outline rounded-[var(--ui-surface-radius)] bg-surface p-4 text-left transition-colors hover:bg-elevated`,X=[{status:`running`,colour:`bg-running`},{status:`waiting_input`,colour:`bg-waiting`},{status:`interrupted`,colour:`bg-interrupted`}];function te({project:e,repoPath:t,sessions:n}){let r=n.filter(e=>e.status!==`archived`);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`h2`,{className:N(`truncate pr-16 text-base font-semibold`,d(e.colour)||`text-fg group-hover:text-accent`),children:e.name}),(0,G.jsx)(`p`,{className:`mt-1 truncate text-2xs text-fg-muted`,children:t??`…`}),(0,G.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-3 text-2xs text-fg-muted tabular-nums`,children:[(0,G.jsxs)(`span`,{children:[r.length,` session`,r.length===1?``:`s`]}),X.map(({status:e,colour:t})=>{let n=r.filter(t=>t.status===e).length;return n>0?(0,G.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(`span`,{className:`size-1.5 rounded-full ${t}`}),n,` `,e.replace(`_`,` `)]},e):null})]})]})}function Z({icon:e,label:t,onClick:n}){return(0,G.jsx)(`button`,{type:`button`,"aria-label":t,title:t,onClick:e=>{e.preventDefault(),e.stopPropagation(),n()},className:`flex items-center rounded-md p-1.5 text-fg-muted transition-colors hover:bg-ground hover:text-fg`,children:(0,G.jsx)(e,{className:`size-4`})})}function Q({project:e,repoPath:t,draggable:r,dragging:i,onDragStart:a,onDragEnd:o,onDragOver:u}){let g=s(),_=n(l().data?.protocol),y=c(e.id),[b,x]=(0,W.useState)(!1),[S,C]=(0,W.useState)(e.name),[T,E]=(0,W.useState)(p(e)),[M,V]=(0,W.useState)(e.colour??null),H=t=>g.mutate({id:e.id,archived:t},{onError:e=>U(e)}),K=()=>{C(e.name),V(e.colour??null),E(p(e)),x(!0)},q=()=>{let t=S.trim(),n=v(T);if(!t){x(!1);return}let r={...t===e.name?{}:{name:t},...n&&n!==p(e)?{abbrev:n}:{},..._&&M!==(e.colour??null)?{colour:M}:{}};if(Object.keys(r).length===0){x(!1);return}g.mutate({id:e.id,...r},{onSuccess:()=>x(!1),onError:e=>U(e)})};return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(z,{children:[(0,G.jsx)(F,{asChild:!0,children:(0,G.jsxs)(`div`,{draggable:r,onDragStart:a,onDragEnd:o,onDragOver:u,className:N(`group relative transition-opacity`,i&&`opacity-50`),children:[(0,G.jsx)(w,{draggable:!1,to:`/project/${e.id}`,className:Y,children:(0,G.jsx)(te,{project:e,repoPath:t,sessions:y.data??[]})}),(0,G.jsx)(`div`,{className:`absolute right-2 top-2 hidden gap-0.5 group-hover:flex has-[[data-state=open]]:flex pointer-coarse:flex`,children:e.archived?(0,G.jsx)(Z,{icon:I,label:`Reopen project`,onClick:()=>H(!1)}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Z,{icon:h,label:`Edit project`,onClick:K}),(0,G.jsx)(Z,{icon:B,label:`Archive project`,onClick:()=>H(!0)})]})})]})}),(0,G.jsx)(L,{children:e.archived?(0,G.jsxs)(R,{onSelect:()=>H(!1),children:[(0,G.jsx)(I,{}),` Reopen`]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(R,{onSelect:K,children:[(0,G.jsx)(h,{}),` Edit`]}),(0,G.jsxs)(R,{onSelect:()=>H(!0),children:[(0,G.jsx)(B,{}),` Archive`]})]})})]}),(0,G.jsx)(ee,{open:b,onOpenChange:x,children:(0,G.jsxs)(k,{children:[(0,G.jsx)(O,{children:(0,G.jsx)(A,{children:`Edit project`})}),(0,G.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),q()},children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,G.jsx)(f,{htmlFor:`project-name-${e.id}`,children:`Name`}),(0,G.jsx)(j,{id:`project-name-${e.id}`,value:S,className:d(M),onChange:e=>C(e.target.value),autoFocus:!0})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,G.jsx)(f,{htmlFor:`project-abbrev-${e.id}`,children:`Abbreviation`}),(0,G.jsx)(j,{id:`project-abbrev-${e.id}`,maxLength:5,value:T,onChange:e=>E(v(e.target.value)),className:`w-24 uppercase`}),(0,G.jsxs)(`p`,{className:`text-2xs text-fg-muted`,children:[`Up to `,5,` characters — the label on the collapsed sidebar rail.`]})]}),_&&(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,G.jsx)(`span`,{className:`text-xs text-fg-secondary`,children:`Colour`}),(0,G.jsx)(m,{value:M,onChange:V,label:`Project colour`})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(f,{className:`text-fg-muted`,children:`Path`}),(0,G.jsx)(`p`,{className:`truncate text-2xs text-fg-muted`,children:t??`…`})]}),(0,G.jsxs)(D,{children:[(0,G.jsx)(P,{type:`button`,variant:`ghost`,onClick:()=>x(!1),children:`Cancel`}),(0,G.jsx)(P,{type:`submit`,disabled:!S.trim()||g.isPending,children:`Save`})]})]})]})})]})}function $({icon:e,label:t,hint:n,onClick:r}){return(0,G.jsxs)(`button`,{type:`button`,onClick:r,className:`group flex flex-col island-outline rounded-[var(--ui-surface-radius)] bg-surface p-4 text-left transition-colors hover:bg-elevated`,children:[(0,G.jsxs)(`h2`,{className:`flex items-center gap-2 truncate text-base font-semibold text-fg group-hover:text-accent`,children:[(0,G.jsx)(e,{className:`size-4 shrink-0`}),t]}),(0,G.jsx)(`p`,{className:`mt-1 truncate text-2xs text-fg-muted`,children:n})]})}function ne(){let e=S(),t=r(e??void 0),n=i(),s=o(e??void 0),c=a(e??``),[l,u]=(0,W.useState)(!1),[d,f]=(0,W.useState)(null),[p,m]=(0,W.useState)(!1),h=q(),_=b(`palette.toggle`),v=e=>n.data?.find(t=>t.id===e)?.path,y=t.data??[],x=s.data?.projectOrder??[],w=E(y.filter(e=>!e.archived),x),D=y.filter(e=>e.archived),O=(e,t)=>{e!==t&&c.mutate({projectOrder:T(w.map(e=>e.id),e,t)})};return(0,G.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,G.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,G.jsxs)(`div`,{className:`mx-auto max-w-4xl p-6`,children:[y.length===0&&(0,G.jsxs)(`div`,{className:`mb-8 mt-16 flex flex-col items-center gap-3 text-center`,children:[(0,G.jsx)(g,{className:`size-8 text-fg-muted`}),(0,G.jsxs)(`p`,{className:`text-sm text-fg-secondary`,children:[`No projects yet — open one below, or press `,_,`.`]})]}),(0,G.jsxs)(`div`,{className:`grid auto-rows-fr grid-cols-1 gap-3 sm:grid-cols-2`,children:[w.map(e=>(0,G.jsx)(Q,{project:e,repoPath:v(e.repo_id),draggable:!0,dragging:d===e.id,onDragStart:()=>f(e.id),onDragEnd:()=>f(null),onDragOver:t=>{t.preventDefault(),d&&d!==e.id&&O(d,e.id)}},e.id)),(0,G.jsx)($,{icon:V,label:`Open project`,hint:`Point at a repository on this host`,onClick:()=>u(!0)}),(0,G.jsx)($,{icon:C,label:h.open?`Close terminal`:`Open terminal`,hint:h.open?`End the shell below`:`A shell at ~ for cloning repositories`,onClick:h.toggle})]}),D.length>0&&(0,G.jsxs)(`div`,{className:`mt-6`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>m(e=>!e),className:`flex items-center gap-1.5 px-1 py-1.5 text-2xs uppercase tracking-wide text-fg-muted transition-colors hover:text-fg`,children:[(0,G.jsx)(M,{className:N(`size-3 transition-transform`,p&&`rotate-90`)}),(0,G.jsx)(B,{className:`size-3`}),(0,G.jsx)(`span`,{children:`Archived`}),(0,G.jsx)(`span`,{className:`tabular-nums`,children:D.length})]}),p&&(0,G.jsx)(`div`,{className:`mt-2 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:D.map(e=>(0,G.jsx)(Q,{project:e,repoPath:v(e.repo_id),draggable:!1,dragging:!1,onDragStart:()=>{},onDragEnd:()=>{},onDragOver:()=>{}},e.id))})]})]})}),h.open&&(0,G.jsx)(J,{term:h.term,onExit:h.onExit}),e!==null&&(0,G.jsx)(H,{profileId:e,open:l,onOpenChange:u})]})}export{ne as Dashboard};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./jsx-runtime-By8HlURe.js";import{a as r,i,o as a,r as o,s,t as c}from"./dialog-D-Axqpzg.js";import{t as l}from"./x-Dq6POV20.js";import{t as u}from"./createLucideIcon-C9A1vLE-.js";import{t as d}from"./button-C_Rvtcwg.js";import{i as f,t as p,u as m}from"./buffer-store-Bh2IilxW.js";import{t as h}from"./drafts-B_tChlzR.js";import{t as g}from"./editor-sync-W1bamxAP.js";var _=u(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),v=e(t(),1),y=n();function b(e,t,n){let r=p(e,t,n);return(0,v.useSyncExternalStore)((0,v.useCallback)(e=>m(r,e),[r]),()=>f(r))}function x({session:e,path:t,kind:n,root:r}){return b(e,t,r)&&n!==`commit`?(0,y.jsx)(_,{"aria-hidden":!0,className:`size-2 shrink-0 fill-current text-fg-muted group-hover:invisible group-focus-visible:invisible group-has-[:focus-visible]:invisible`}):null}function S({session:e,path:t,kind:n,root:u,label:f,onClose:p}){let m=b(e,t,u)&&n!==`commit`,[_,x]=(0,v.useState)(!1),S=()=>m?x(!0):p();return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`button`,{onClick:e=>{e.stopPropagation(),S()},className:`flex size-4 items-center justify-center rounded-sm text-fg-muted transition-colors hover:text-fg`,"aria-label":`Close ${f}`,children:(0,y.jsx)(l,{className:`size-3`})}),(0,y.jsx)(c,{open:_,onOpenChange:e=>!e&&x(!1),children:(0,y.jsxs)(o,{children:[(0,y.jsxs)(a,{children:[(0,y.jsxs)(s,{children:[`Discard changes to `,f,`?`]}),(0,y.jsx)(i,{children:`This file has unsaved changes. Closing the tab will discard them.`})]}),(0,y.jsxs)(r,{children:[(0,y.jsx)(d,{variant:`ghost`,onClick:()=>x(!1),children:`Keep editing`}),(0,y.jsx)(d,{variant:`danger`,onClick:()=>{h(e,t,u),g(e,t,u),x(!1),p()},children:`Discard`})]})]})})]})}export{x as EditorDirtyDot,S as EditorTabClose};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Terminal-Bo8hyZj7.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-CZI7_Jkm.js","assets/react-dom-cJyBB_A4.js","assets/protocol-support-TSI4Ig6W.js","assets/auth-CdosKReE.js","assets/jsx-runtime-By8HlURe.js","assets/api-B90WKMKj.js","assets/client-settings-DhfHheKR.js","assets/theme-swfNLod9.js","assets/preload-helper-Czpn1I53.js","assets/ws-Cp1eCJaM.js","assets/dist-BOS6OKSE.js","assets/forward-link-BspnTVuc.js","assets/createLucideIcon-C9A1vLE-.js","assets/motion-OSLfKoC0.js","assets/FindWidget-DG1YP6Zx.js","assets/x-Dq6POV20.js","assets/chevron-down-HQLVE6o5.js","assets/selection-actions-CvYaucrm.js","assets/index-Doe7MhnI.js","assets/index-4XrK4Fes.css","assets/button-C_Rvtcwg.js","assets/copy-D0Theg4Q.js","assets/code-Cf4ftdOa.js","assets/errors-tuvbq1a_.js","assets/math-delimiters-BCnTi7Ii.js","assets/Terminal-BrP-ENHg.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{W as n}from"./auth-CdosKReE.js";import{t as r}from"./jsx-runtime-By8HlURe.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{C as a}from"./dialog-D-Axqpzg.js";import{n as o}from"./chevron-right-BEy-IXEZ.js";import{n as s,t as c}from"./createLucideIcon-C9A1vLE-.js";function l(e){return e.trim().slice(0,5).toUpperCase()}function u(e){return e.abbrev??l(e.name)}function d(e){return e.trim().toUpperCase().slice(0,5)}var f=e(t(),1),p=r(),m=`Label`,h=f.forwardRef((e,t)=>(0,p.jsx)(a.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));h.displayName=m;var g=h;function _({className:e,...t}){return(0,p.jsx)(g,{className:s(`text-xs font-medium text-fg-secondary peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}var v=c(`folder-git-2`,[[`path`,{d:`M18 19a5 5 0 0 1-5-5v8`,key:`sz5oeg`}],[`path`,{d:`M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5`,key:`1w6njk`}],[`circle`,{cx:`13`,cy:`12`,r:`2`,key:`1j92g6`}],[`circle`,{cx:`20`,cy:`19`,r:`2`,key:`1obnsp`}]]),y=c(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),b={navy:`text-identity-navy`,gold:`text-identity-gold`,blue:`text-icon-blue`,green:`text-icon-green`,amber:`text-icon-amber`,red:`text-icon-red`,violet:`text-icon-violet`,cyan:`text-icon-cyan`,accent:`text-accent`};function x(e){return e&&b[e]||``}function S({value:e,onChange:t,disabled:r=!1,label:i=`Colour`}){return(0,p.jsx)(`div`,{role:`group`,"aria-label":i,className:`flex flex-wrap items-center gap-1`,children:[null,...n].map(n=>(0,p.jsx)(`button`,{type:`button`,title:n??`Default`,"aria-label":n??`Default colour`,"aria-pressed":(e??null)===n,disabled:r,onClick:()=>t(n),className:s(`flex size-7 cursor-pointer items-center justify-center rounded-md transition-colors hover:bg-border/50 focus-visible:bg-border/50 disabled:cursor-default disabled:opacity-50`,(e??null)===n&&`bg-border/50`),children:(0,p.jsx)(`span`,{className:s(`size-3.5 rounded-full`,n?s(`bg-current`,x(n)):`bg-fg-muted`)})},n??`default`))})}function C({id:e,value:t,onValueChange:n,onChoose:r,hints:i,placeholder:a,className:c,hintsClassName:l,autoFocus:u}){let[d,m]=(0,f.useState)(!1),[h,g]=(0,f.useState)(0),_=e=>{n(e.value),r?.(e),m(!1)};return(0,p.jsxs)(`div`,{className:`relative`,children:[(0,p.jsx)(o,{id:e,value:t,onChange:e=>{n(e.target.value),m(!0),g(0)},onFocus:()=>m(!0),onBlur:()=>m(!1),onKeyDown:e=>{if(!(!d||i.length===0))if(e.key===`ArrowDown`)e.preventDefault(),g(e=>(e+1)%i.length);else if(e.key===`ArrowUp`)e.preventDefault(),g(e=>(e-1+i.length)%i.length);else if(e.key===`Enter`||e.key===`Tab`){let t=i[h]??i[0];t&&(e.preventDefault(),_(t))}else e.key===`Escape`&&(e.stopPropagation(),m(!1))},placeholder:a,className:c,autoComplete:`off`,spellCheck:!1,autoFocus:u}),d&&i.length>0&&(0,p.jsx)(`ul`,{className:s(`absolute top-full z-10 mt-1 max-h-56 overflow-y-auto rounded-md bg-elevated p-1 shadow-xl`,l??`w-full`),children:i.map((e,t)=>(0,p.jsx)(`li`,{children:(0,p.jsxs)(`button`,{type:`button`,onMouseDown:t=>{t.preventDefault(),_(e)},onMouseEnter:()=>g(t),className:s(`relative flex cursor-pointer select-none items-center gap-2 rounded-[var(--ui-menu-radius)] px-2 py-1.5 text-sm text-fg outline-none transition-colors`,`data-[selected=true]:bg-action data-[selected=true]:text-action-ink data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50`,`w-full text-xs`),"data-selected":t===h,children:[(0,p.jsx)(`span`,{className:`truncate`,children:e.label??e.value}),e.badge&&(0,p.jsx)(`span`,{className:`ml-auto shrink-0 text-2xs opacity-70`,children:e.badge})]})},e.value))})]})}var w=(0,f.lazy)(()=>i(()=>import(`./Terminal-Bo8hyZj7.js`).then(e=>({default:e.Terminal})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27]))),T=null;async function E(){T=(await i(()=>import(`./Terminal-Bo8hyZj7.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27]))).Terminal}function D(e){return T?(0,p.jsx)(T,{...e}):(0,p.jsx)(f.Suspense,{fallback:(0,p.jsx)(`div`,{className:`size-full bg-ground`}),children:(0,p.jsx)(w,{...e})})}export{x as a,_ as c,u as d,S as i,l,E as n,y as o,C as r,v as s,D as t,d as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{c as n,o as r,t as i}from"./buffer-store-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{c as n,o as r,t as i}from"./buffer-store-Bh2IilxW.js";var a=e(t(),1);function o({buffers:e}){let t=(0,a.useRef)(new Set);return(0,a.useEffect)(()=>{let a=new Set(e.map(e=>i(e.session,e.path,e.root))),o=t.current;for(let e of a)o.has(e)||(n(e),o.add(e));for(let e of[...o])a.has(e)||(r(e),o.delete(e))},[e]),(0,a.useEffect)(()=>()=>{for(let e of t.current)r(e);t.current.clear()},[]),null}export{o as ModelRefcount};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{F as n,G as r,I as i,J as ee,c as a,g as o,mt as te,z as ne}from"./protocol-support-TSI4Ig6W.js";import{a as s,c,i as re,l,r as u,s as d,u as f}from"./LazyTerminal-B88WIvyh.js";import{t as p}from"./jsx-runtime-By8HlURe.js";import{o as m,p as ie}from"./session-order-CiDVvIU5.js";import{a as h,i as g,o as _,r as v,s as y,t as b}from"./dialog-D-Axqpzg.js";import{n as x}from"./chevron-right-BEy-IXEZ.js";import{t as S}from"./createLucideIcon-C9A1vLE-.js";import{t as C}from"./button-C_Rvtcwg.js";import{t as w}from"./use-debounced-value-C86N-mOK.js";var T=S(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),E=S(`folder`,[[`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`}]]),D=e(t(),1),O=p();function k(e){let t=e.trim().replace(/\/+$/,``);return t===``?`/`:t}function A(e){return e.startsWith(`/`)||e.startsWith(`~`)}function j(e){let t=e.replace(/\/+$/,``),n=t.lastIndexOf(`/`);return n<=0?`/`:t.slice(0,n)}function ae({dir:e,onNavigate:t,onChoose:n}){let i=r(e.endsWith(`/`)?e:`${e}/`);return(0,O.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,O.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,O.jsxs)(`button`,{type:`button`,onClick:()=>t(j(e)),disabled:e===`/`,title:`Parent directory`,className:`shrink-0 rounded-sm p-1 text-fg-gold transition-colors hover:bg-elevated hover:text-fg disabled:pointer-events-none disabled:opacity-40`,children:[(0,O.jsx)(m,{className:`size-3.5`}),(0,O.jsx)(`span`,{className:`sr-only`,children:`Parent directory`})]}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>n(e),className:`ml-auto shrink-0 text-2xs text-fg-muted transition-colors hover:text-fg`,children:`choose this folder`})]}),(0,O.jsxs)(`div`,{className:`max-h-48 overflow-y-auto`,children:[(i.data?.entries??[]).map(e=>(0,O.jsxs)(`div`,{className:`flex items-center rounded-md transition-colors hover:bg-elevated`,children:[(0,O.jsxs)(`button`,{type:`button`,onClick:()=>t(e.path),className:`flex min-w-0 flex-1 items-center gap-2 px-2 py-1 text-left`,children:[e.is_git?(0,O.jsx)(d,{className:`size-3.5 shrink-0 text-success`}):(0,O.jsx)(E,{className:`size-3.5 shrink-0 text-fg-gold`}),(0,O.jsx)(`span`,{className:`truncate text-xs text-fg`,children:e.name})]}),e.is_git&&(0,O.jsx)(`button`,{type:`button`,onClick:()=>n(e.path),className:`shrink-0 px-2 py-1 text-2xs text-fg-muted transition-colors hover:text-fg`,children:`choose`})]},e.path)),i.data!==void 0&&i.data.entries.length===0&&(0,O.jsx)(`p`,{className:`px-2 py-1 text-xs text-fg-muted`,children:`No subdirectories.`})]})]})}function M({profileId:e,open:t,onOpenChange:d}){let p=te(),m=ne().data?.protocol,S=a(m),T=o(m),E=i(),j=n(),M=ie(),oe=ee(),[N,P]=(0,D.useState)(``),[F,I]=(0,D.useState)(``),[L,R]=(0,D.useState)(!1),[z,B]=(0,D.useState)(``),[V,H]=(0,D.useState)(null),[U,W]=(0,D.useState)(!1),[G,K]=(0,D.useState)(null),[q,J]=(0,D.useState)(null),Y=oe.data?.home,se=()=>{let e=N.trim(),t=A(e)&&Y!==void 0?k(e.replace(/^~(?=\/|$)/,Y)):A(e)&&e.startsWith(`/`)?k(e):Y??`/`;Z(t)},X=e=>{I(e),U||B(l(e))},Z=e=>{J(e),P(e)},ce=e=>{P(e),J(null),X(e.split(`/`).filter(Boolean).pop()??``),R(!0)},Q=r(w(N,150)),le=(0,D.useMemo)(()=>{if(!A(N))return(p.data??[]).map(e=>({value:e.path,badge:`registered`,is_git:!0}));let e=new Set((p.data??[]).map(e=>e.path));return(Q.data?.entries??[]).map(t=>({value:t.path,label:t.name,badge:e.has(t.path)?`registered`:t.is_git?`git`:void 0,is_git:t.is_git}))},[N,p.data,Q.data]),ue=async()=>{K(null);try{let t=k(N),n=p.data?.find(e=>e.path===t)?.id??(await E.mutateAsync({path:t,...S?{default_base_branch:``}:{}})).id,r=await j.mutateAsync({profile_id:e,repo_id:n,name:F.trim(),...T?{colour:V}:{},...f(z)?{abbrev:f(z)}:{}});d(!1),M(`/project/${r.id}`)}catch(e){K(e instanceof Error?e.message:String(e))}},$=F.trim()!==``&&A(N.trim());return(0,O.jsx)(b,{open:t,onOpenChange:d,children:(0,O.jsxs)(v,{children:[(0,O.jsxs)(_,{children:[(0,O.jsx)(y,{children:`New project`}),(0,O.jsx)(g,{children:`Point at a git repository on the daemon host — known repositories are reused.`})]}),(0,O.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),$&&ue()},children:[(0,O.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,O.jsx)(c,{htmlFor:`repo-path`,children:`Repository path`}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>q===null?se():J(null),className:`text-2xs text-fg-muted transition-colors hover:text-fg`,children:q===null?`browse…`:`hide browser`})]}),(0,O.jsx)(u,{id:`repo-path`,placeholder:`~/src/my-repo`,value:N,onValueChange:P,onChoose:e=>{!L&&e.is_git&&X(e.value.split(`/`).filter(Boolean).pop()??``)},hints:le}),q!==null&&(0,O.jsx)(ae,{dir:q,onNavigate:Z,onChoose:ce})]}),(0,O.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,O.jsx)(c,{htmlFor:`project-name`,children:`Project name`}),(0,O.jsx)(x,{id:`project-name`,placeholder:`e.g. checkout-rework`,value:F,className:s(V),onChange:e=>{X(e.target.value),R(!0)}})]}),(0,O.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,O.jsx)(c,{htmlFor:`project-abbrev`,children:`Abbreviation`}),(0,O.jsx)(x,{id:`project-abbrev`,placeholder:F.trim()?l(F):`ABBRV`,maxLength:5,value:z,onChange:e=>{B(f(e.target.value)),W(!0)},className:`w-24 uppercase`}),(0,O.jsxs)(`p`,{className:`text-2xs text-fg-muted`,children:[`Up to `,5,` characters — the project's label on the collapsed sidebar rail.`]})]}),T&&(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,O.jsx)(`span`,{className:`text-xs text-fg-secondary`,children:`Colour`}),(0,O.jsx)(re,{value:V,onChange:H,label:`Project colour`})]}),G&&(0,O.jsx)(`p`,{className:`text-xs text-danger`,children:G}),(0,O.jsxs)(h,{children:[(0,O.jsx)(C,{type:`button`,variant:`ghost`,onClick:()=>d(!1),children:`Cancel`}),(0,O.jsx)(C,{type:`submit`,disabled:!$||E.isPending||j.isPending,children:`Create project`})]})]})]})})}export{T as n,M as t};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{c as n}from"./auth-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{c as n}from"./auth-CdosKReE.js";import{t as r}from"./context-CG70lLa4.js";import{r as i,s as a}from"./theme-swfNLod9.js";import{t as o}from"./jsx-runtime-By8HlURe.js";import{t as s}from"./preload-helper-Czpn1I53.js";var c=e(t(),1),l=o(),u=()=>()=>{},d={generation:null,revision:0,events:[]},f=()=>d;function p({modelId:e,fallback:t}){let n=(0,c.useContext)(r),i=n?.session,a=(0,c.useSyncExternalStore)(i?.subscribe??u,i?.getSnapshot??f),o=!!i?.state.state[e]&&!!a.generation&&!a.error,s=o?i.state:n?.saved,[d,p]=(0,c.useState)(!1);return s?.state[e]?(0,l.jsx)(h,{modelId:e,snapshot:s,session:o?i:null,generation:o?a.generation:null,extensions:o||d,onLoadExtension:()=>p(!0)},`${o?a.generation:`saved`}:${e}:${d}`):(0,l.jsxs)(`div`,{className:`text-xs text-fg-muted`,children:[t&&(0,l.jsx)(`pre`,{className:`whitespace-pre-wrap font-mono text-sm text-fg-secondary`,children:t}),(0,l.jsx)(`p`,{children:a.error??(i?`Run this cell to create its widget.`:`Live Jupyter widgets require a local or SSH host with protocol 25.4 or newer.`)})]})}function m(){let e=getComputedStyle(document.documentElement),t=t=>e.getPropertyValue(t).trim();return{"--jp-layout-color0":t(`--bg-base`),"--jp-layout-color1":t(`--bg-surface`),"--jp-layout-color2":t(`--bg-elevated`),"--jp-layout-color3":t(`--bg-elevated`),"--jp-ui-font-color0":t(`--text-primary`),"--jp-ui-font-color1":t(`--text-primary`),"--jp-ui-font-color2":t(`--text-secondary`),"--jp-ui-font-color3":t(`--text-muted`),"--jp-content-font-color1":t(`--text-primary`),"--jp-border-color1":t(`--border`),"--jp-content-font-color0":t(`--text-primary`),"--jp-content-font-color2":t(`--text-secondary`),"--jp-content-font-color3":t(`--text-muted`),"--jp-content-font-family":t(`--font-sans`),"--jp-error-color1":t(`--danger`),"--jp-warn-color1":t(`--warning`),"--jp-success-color1":t(`--success`),"--jp-info-color1":t(`--accent`),"--jp-brand-color1":t(`--accent`),"--jp-ui-font-family":t(`--font-sans`),"--jp-code-font-family":t(`--font-mono`),"--danger":t(`--danger`)}}function h({modelId:e,snapshot:t,session:r,generation:o,extensions:u,onLoadExtension:d}){let f=(0,c.useRef)(null),p=(0,c.useRef)(null),h=(0,c.useRef)(t);h.current=t;let[g,_]=(0,c.useState)(),[v,y]=(0,c.useState)(0),[b,x]=(0,c.useState)(48),[S,C]=(0,c.useState)(),[w,T]=(0,c.useState)();return(0,c.useEffect)(()=>{p.current?.postMessage({type:`theme`,theme:m()})},[(0,c.useSyncExternalStore)(a,i,i)]),(0,c.useEffect)(()=>{let t=!1,i,a=a=>{if(a.source!==f.current?.contentWindow||a.data?.type!==`puddle-widget-ready`||p.current)return;let s=new MessageChannel;p.current=s.port1,s.port1.onmessage=e=>{if(t||!e.data||typeof e.data!=`object`)return;let i=e.data;if(i.type===`height`&&Number.isFinite(i.height)&&x(Math.max(24,Math.min(2e3,i.height))),i.type===`error`&&C(String(i.error).slice(0,1024)),i.type===`extension`&&T(String(i.name).slice(0,256)),i.type!==`comm`||!r||!o)return;let a=n.safeParse({source:r.source,generation:o,message:i.message});if(!a.success||JSON.stringify(a.data).length>2*1024*1024){C(`Widget action exceeds the supported message limits`);return}r.send(o,a.data.message).catch(e=>{t||s.port1.postMessage({type:`error`,msg_id:a.data.message.msg_id,error:e instanceof Error?e.message:`Widget action failed`})})},s.port1.start(),f.current.contentWindow.postMessage({type:`puddle-widget-connect`},`*`,[s.port2]),s.port1.postMessage({type:`init`,snapshot:structuredClone(r?.state??h.current),modelId:e,live:!!o,extensions:u,theme:m()}),i=r?.subscribe(e=>{e.generation!==o||e.error?s.port1.postMessage({type:`error`,error:e.error??`The kernel changed. Run the cell again.`}):e.snapshot?(p.current?.close(),p.current=null,i?.(),y(e=>e+1)):s.port1.postMessage({type:`events`,events:e.events})})};return window.addEventListener(`message`,a),(async()=>{let{default:e}=await s(async()=>{let{default:e}=await import(`./_virtual_notebook-widget-runtime-Dro422xS.js`);return{default:e}},[]);t||_(`<!doctype html><html><head><meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'unsafe-inline' 'unsafe-eval' blob: https:; style-src 'unsafe-inline' https:; img-src data: blob: https:; font-src data: https:; media-src data: blob: https:; connect-src https:; worker-src blob:; form-action 'none'; base-uri 'none'"><style>
|
|
2
2
|
html,body{margin:0;background:var(--jp-layout-color0)!important;color:var(--jp-ui-font-color1)!important;font-family:var(--jp-ui-font-family)!important}
|
|
3
3
|
.jupyter-widgets input,.jupyter-widgets select,.jupyter-widgets textarea,.jupyter-widgets button{border:0!important;color:var(--jp-ui-font-color1);background:var(--jp-layout-color1)}
|
|
4
4
|
.jupyter-widgets button,.jupyter-widgets select,.jupyter-widgets input[type=range]{cursor:pointer}
|
|
5
5
|
.jupyter-widgets button:hover{opacity:.8}.widget-label{color:var(--jp-ui-font-color2)}
|
|
6
6
|
.math-display{display:block}
|
|
7
|
-
</style></head><body><script>${e.replace(/<\/script/gi,`<\\/script`)}<\/script></body></html>`)})().catch(e=>C(String(e))),()=>{t=!0,
|
|
7
|
+
</style></head><body><script>${e.replace(/<\/script/gi,`<\\/script`)}<\/script></body></html>`)})().catch(e=>C(String(e))),()=>{t=!0,i?.(),window.removeEventListener(`message`,a),p.current?.close(),p.current=null}},[r,o,e,u]),(0,l.jsxs)(`div`,{children:[g&&(0,l.jsx)(`iframe`,{ref:f,title:`Jupyter widget`,loading:`lazy`,sandbox:`allow-scripts allow-downloads`,referrerPolicy:`no-referrer`,srcDoc:g,className:`block w-full border-0`,style:{height:b}},v),!o&&(0,l.jsx)(`p`,{className:`text-xs text-fg-muted`,children:`Saved widget · run the cell to reconnect`}),w&&!u?(0,l.jsxs)(`button`,{type:`button`,onClick:d,className:`cursor-pointer text-xs text-accent hover:opacity-80`,children:[`Load `,w,` widget extension`]}):S&&(0,l.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:S})]})}export{p as default};
|