@puddle-code/cli 0.3.13 → 0.3.14

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.
Files changed (34) hide show
  1. package/CHANGELOG.md +4 -8
  2. package/dist/host-control.mjs +25 -25
  3. package/dist/index.js +58 -57
  4. package/dist/public/assets/App-5QiKmUI_.js +2 -0
  5. package/dist/public/assets/{CompilationCommandForm-Bzt5OaiJ.js → CompilationCommandForm-8ipw9M-Z.js} +1 -1
  6. package/dist/public/assets/{Dashboard-D6cwjmKX.js → Dashboard-B9v8mQKk.js} +1 -1
  7. package/dist/public/assets/{EditorTabClose-xasqNn4b.js → EditorTabClose-o1L4BgTN.js} +1 -1
  8. package/dist/public/assets/{LazyTerminal-B2eXi-NW.js → LazyTerminal-Crwcrh-K.js} +2 -2
  9. package/dist/public/assets/{ModelRefcount-Dfulry9I.js → ModelRefcount-0o8MEOUT.js} +1 -1
  10. package/dist/public/assets/{NewProjectDialog-DTZfXXpH.js → NewProjectDialog-qFDLTphH.js} +1 -1
  11. package/dist/public/assets/{NotebookWidget-D2ddZny7.js → NotebookWidget-Ci7TAuWd.js} +1 -1
  12. package/dist/public/assets/{PaneEditorBody-DM3RxU9y.js → PaneEditorBody-C8uTV9yU.js} +29 -29
  13. package/dist/public/assets/PdfViewer-BoFsXAue.js +2 -0
  14. package/dist/public/assets/{SettingsDialog-DK_xpwwR.js → SettingsDialog-tW18Y_Wr.js} +1 -1
  15. package/dist/public/assets/{Terminal-C56yFFee.js → Terminal-B3Iw783s.js} +21 -21
  16. package/dist/public/assets/{Workspace-DJGOiast.js → Workspace-D2IYXJV2.js} +5 -5
  17. package/dist/public/assets/{buffer-store-JDgXuYJp.js → buffer-store-B2nYD11t.js} +1 -1
  18. package/dist/public/assets/{button-BgeBH2Uc.js → button-9AVMLaMQ.js} +1 -1
  19. package/dist/public/assets/{index-B_fYaxIG.js → index-B9DFgBft.js} +2 -2
  20. package/dist/public/assets/index-DwtrJj9v.css +2 -0
  21. package/dist/public/assets/{markdown-mermaid-BVt1aqNY.js → markdown-mermaid-CZnHoKN5.js} +1 -1
  22. package/dist/public/assets/{notification-delivery-DhFtFhEH.js → notification-delivery-DdTD40aA.js} +1 -1
  23. package/dist/public/assets/scroll-restoration-gKZDDamc.js +1 -0
  24. package/dist/public/assets/{selection-actions--OSfjvlG.js → selection-actions-BjVj7hXw.js} +1 -1
  25. package/dist/public/assets/use-ui-state-CQp93ZE4.js +1 -0
  26. package/dist/public/assets/view-state-store-CVAUWqnG.js +1 -0
  27. package/dist/public/index.html +2 -2
  28. package/dist/pudl.js +29 -29
  29. package/package.json +1 -1
  30. package/dist/public/assets/App-Dtn-lPJX.js +0 -2
  31. package/dist/public/assets/PdfViewer-BR_qnX0w.js +0 -2
  32. package/dist/public/assets/index-ChK3zzci.css +0 -2
  33. package/dist/public/assets/scroll-restoration-xYrqc2k4.js +0 -1
  34. package/dist/public/assets/use-ui-state-DEsKtleW.js +0 -1
@@ -1 +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{n as r}from"./api-CfmzEbQ_.js";import{bt as i,xt as a}from"./protocol-support-BGk73LFk.js";import{t as o}from"./button-BgeBH2Uc.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 a({queryKey:[`compilation-capabilities`],queryFn:()=>r(`GET`,`/api/compilation/capabilities`),enabled:e,staleTime:3e4,refetchOnWindowFocus:!0})}function u(){return i({mutationFn:e=>r(`POST`,`/api/compilation/run`,e)})}function d(e){return r(`PUT`,`/api/compilation/mode`,e)}function f(e){return r(`POST`,`/api/compilation/status`,e)}function p(e,t){return a({queryKey:[`compilation-status`,e],queryFn:()=>f(e),enabled:t,refetchInterval:750,refetchIntervalInBackground:!1,retry:2})}function m(e){return a({queryKey:[`compilation-settings`,e],queryFn:()=>r(`POST`,`/api/compilation/settings`,e),enabled:e!==null,staleTime:3e4})}function h(e){return r(`PUT`,`/api/compilation/settings`,e)}function g(e){return a({queryKey:[`compilation-defaults`,e],queryFn:()=>r(`POST`,`/api/compilation/defaults`,e),enabled:e!==null,staleTime:3e4})}function _(e){return r(`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=n();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};
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{n as r}from"./api-CfmzEbQ_.js";import{bt as i,xt as a}from"./protocol-support-BGk73LFk.js";import{t as o}from"./button-9AVMLaMQ.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 a({queryKey:[`compilation-capabilities`],queryFn:()=>r(`GET`,`/api/compilation/capabilities`),enabled:e,staleTime:3e4,refetchOnWindowFocus:!0})}function u(){return i({mutationFn:e=>r(`POST`,`/api/compilation/run`,e)})}function d(e){return r(`PUT`,`/api/compilation/mode`,e)}function f(e){return r(`POST`,`/api/compilation/status`,e)}function p(e,t){return a({queryKey:[`compilation-status`,e],queryFn:()=>f(e),enabled:t,refetchInterval:750,refetchIntervalInBackground:!1,retry:2})}function m(e){return a({queryKey:[`compilation-settings`,e],queryFn:()=>r(`POST`,`/api/compilation/settings`,e),enabled:e!==null,staleTime:3e4})}function h(e){return r(`PUT`,`/api/compilation/settings`,e)}function g(e){return a({queryKey:[`compilation-defaults`,e],queryFn:()=>r(`POST`,`/api/compilation/defaults`,e),enabled:e!==null,staleTime:3e4})}function _(e){return r(`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=n();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};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{y as n}from"./auth-CIb9G2C5.js";import{a as r,c as i,d as a,i as o,o as s,s as c,t as l,u}from"./LazyTerminal-B2eXi-NW.js";import{t as d}from"./jsx-runtime-By8HlURe.js";import{g as f,p}from"./hotkeys-DOpJ1a7g.js";import{L as m,_t as h,et as g,ft as _,h as v,it as y,st as b,tt as x}from"./protocol-support-BGk73LFk.js";import{a as S,i as C,l as w,o as T,r as E}from"./session-order-SN_zG4Us.js";import{a as D,i as O,n as k,o as A,t as j}from"./dialog-BMWRC2HO.js";import{n as M}from"./x-DCpy1q13.js";import{n as N,t as P}from"./chevron-right-BRjnLYaO.js";import{t as F}from"./button-BgeBH2Uc.js";import{c as I,d as L,n as R,r as z,t as B,u as V}from"./context-menu-D-5BvS0X.js";import{t as H}from"./NewProjectDialog-DTZfXXpH.js";import{n as U}from"./errors-DTaodZDR.js";import{t as W}from"./ws-CspBmo8M.js";var G=e(t(),1),K=d(),q=!1;function J(){let[e,t]=(0,G.useState)(q),[r,i]=(0,G.useState)(null);(0,G.useEffect)(()=>{if(!e)return;let t=!1;return W.spawnShell(n).then(e=>{t||i(e)}),()=>{t=!0}},[e]);let a=()=>{q=!1,t(!1),i(null)};return{open:e,term:r,toggle:()=>{e?(r&&W.killShell(n,r),a()):(q=!0,t(!0))},onExit:a}}function Y({term:e,onExit:t}){return(0,K.jsx)(`div`,{className:`h-72 shrink-0 pb-6`,children:(0,K.jsx)(`div`,{className:`mx-auto size-full max-w-4xl px-6`,children:e!==null&&(0,K.jsx)(l,{stream:`home`,term:e,onExit:t})})})}var X=`group block w-full rounded-lg bg-surface p-4 text-left transition-colors hover:bg-elevated`,ee=[{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 i=n.filter(e=>e.status!==`archived`);return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`h2`,{className:M(`truncate pr-16 text-base font-semibold`,r(e.colour)||`text-fg group-hover:text-accent`),children:e.name}),(0,K.jsx)(`p`,{className:`mt-1 truncate text-2xs text-fg-muted`,children:t??`…`}),(0,K.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-3 text-2xs text-fg-muted tabular-nums`,children:[(0,K.jsxs)(`span`,{children:[i.length,` session`,i.length===1?``:`s`]}),ee.map(({status:e,colour:t})=>{let n=i.filter(t=>t.status===e).length;return n>0?(0,K.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(`span`,{className:`size-1.5 rounded-full ${t}`}),n,` `,e.replace(`_`,` `)]},e):null})]})]})}function Z({icon:e,label:t,onClick:n}){return(0,K.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,K.jsx)(e,{className:`size-4`})})}function Q({project:e,repoPath:t,draggable:n,dragging:c,onDragStart:l,onDragEnd:d,onDragOver:f}){let p=x(),g=v(m().data?.protocol),_=h(e.id),[y,b]=(0,G.useState)(!1),[S,C]=(0,G.useState)(e.name),[T,E]=(0,G.useState)(a(e)),[P,H]=(0,G.useState)(e.colour??null),W=t=>p.mutate({id:e.id,archived:t},{onError:e=>U(e)}),q=()=>{C(e.name),H(e.colour??null),E(a(e)),b(!0)},J=()=>{let t=S.trim(),n=u(T);if(!t){b(!1);return}let r={...t===e.name?{}:{name:t},...n&&n!==a(e)?{abbrev:n}:{},...g&&P!==(e.colour??null)?{colour:P}:{}};if(Object.keys(r).length===0){b(!1);return}p.mutate({id:e.id,...r},{onSuccess:()=>b(!1),onError:e=>U(e)})};return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(B,{children:[(0,K.jsx)(I,{asChild:!0,children:(0,K.jsxs)(`div`,{draggable:n,onDragStart:l,onDragEnd:d,onDragOver:f,className:M(`group relative transition-opacity`,c&&`opacity-50`),children:[(0,K.jsx)(w,{draggable:!1,to:`/project/${e.id}`,className:X,children:(0,K.jsx)(te,{project:e,repoPath:t,sessions:_.data??[]})}),(0,K.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,K.jsx)(Z,{icon:L,label:`Reopen project`,onClick:()=>W(!1)}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Z,{icon:s,label:`Edit project`,onClick:q}),(0,K.jsx)(Z,{icon:V,label:`Archive project`,onClick:()=>W(!0)})]})})]})}),(0,K.jsx)(R,{children:e.archived?(0,K.jsxs)(z,{onSelect:()=>W(!1),children:[(0,K.jsx)(L,{}),` Reopen`]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(z,{onSelect:q,children:[(0,K.jsx)(s,{}),` Edit`]}),(0,K.jsxs)(z,{onSelect:()=>W(!0),children:[(0,K.jsx)(V,{}),` Archive`]})]})})]}),(0,K.jsx)(j,{open:y,onOpenChange:b,children:(0,K.jsxs)(k,{children:[(0,K.jsx)(D,{children:(0,K.jsx)(A,{children:`Edit project`})}),(0,K.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),J()},children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,K.jsx)(i,{htmlFor:`project-name-${e.id}`,children:`Name`}),(0,K.jsx)(N,{id:`project-name-${e.id}`,value:S,className:r(P),onChange:e=>C(e.target.value),autoFocus:!0})]}),(0,K.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,K.jsx)(i,{htmlFor:`project-abbrev-${e.id}`,children:`Abbreviation`}),(0,K.jsx)(N,{id:`project-abbrev-${e.id}`,maxLength:5,value:T,onChange:e=>E(u(e.target.value)),className:`w-24 uppercase`}),(0,K.jsxs)(`p`,{className:`text-2xs text-fg-muted`,children:[`Up to `,5,` characters — the label on the collapsed sidebar rail.`]})]}),g&&(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,K.jsx)(`span`,{className:`text-xs text-fg-secondary`,children:`Colour`}),(0,K.jsx)(o,{value:P,onChange:H,label:`Project colour`})]}),(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(i,{className:`text-fg-muted`,children:`Path`}),(0,K.jsx)(`p`,{className:`truncate text-2xs text-fg-muted`,children:t??`…`})]}),(0,K.jsxs)(O,{children:[(0,K.jsx)(F,{type:`button`,variant:`ghost`,onClick:()=>b(!1),children:`Cancel`}),(0,K.jsx)(F,{type:`submit`,disabled:!S.trim()||p.isPending,children:`Save`})]})]})]})})]})}function $({icon:e,label:t,hint:n,onClick:r}){return(0,K.jsxs)(`button`,{type:`button`,onClick:r,className:`group flex flex-col rounded-lg bg-surface p-4 text-left transition-colors hover:bg-elevated`,children:[(0,K.jsxs)(`h2`,{className:`flex items-center gap-2 truncate text-base font-semibold text-fg group-hover:text-accent`,children:[(0,K.jsx)(e,{className:`size-4 shrink-0`}),t]}),(0,K.jsx)(`p`,{className:`mt-1 truncate text-2xs text-fg-muted`,children:n})]})}function ne(){let e=f(),t=b(e??void 0),n=_(),r=y(e??void 0),i=g(e??``),[a,o]=(0,G.useState)(!1),[s,l]=(0,G.useState)(null),[u,d]=(0,G.useState)(!1),m=J(),h=p(`palette.toggle`),v=e=>n.data?.find(t=>t.id===e)?.path,x=t.data??[],w=r.data?.projectOrder??[],D=E(x.filter(e=>!e.archived),w),O=x.filter(e=>e.archived),k=(e,t)=>{e!==t&&i.mutate({projectOrder:C(D.map(e=>e.id),e,t)})};return(0,K.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,K.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,K.jsxs)(`div`,{className:`mx-auto max-w-4xl p-6`,children:[x.length===0&&(0,K.jsxs)(`div`,{className:`mb-8 mt-16 flex flex-col items-center gap-3 text-center`,children:[(0,K.jsx)(c,{className:`size-8 text-fg-muted`}),(0,K.jsxs)(`p`,{className:`text-sm text-fg-secondary`,children:[`No projects yet — open one below, or press `,h,`.`]})]}),(0,K.jsxs)(`div`,{className:`grid auto-rows-fr grid-cols-1 gap-3 sm:grid-cols-2`,children:[D.map(e=>(0,K.jsx)(Q,{project:e,repoPath:v(e.repo_id),draggable:!0,dragging:s===e.id,onDragStart:()=>l(e.id),onDragEnd:()=>l(null),onDragOver:t=>{t.preventDefault(),s&&s!==e.id&&k(s,e.id)}},e.id)),(0,K.jsx)($,{icon:T,label:`Open project`,hint:`Point at a repository on this host`,onClick:()=>o(!0)}),(0,K.jsx)($,{icon:S,label:m.open?`Close terminal`:`Open terminal`,hint:m.open?`End the shell below`:`A shell at ~ for cloning repositories`,onClick:m.toggle})]}),O.length>0&&(0,K.jsxs)(`div`,{className:`mt-6`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>d(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,K.jsx)(P,{className:M(`size-3 transition-transform`,u&&`rotate-90`)}),(0,K.jsx)(V,{className:`size-3`}),(0,K.jsx)(`span`,{children:`Archived`}),(0,K.jsx)(`span`,{className:`tabular-nums`,children:O.length})]}),u&&(0,K.jsx)(`div`,{className:`mt-2 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:O.map(e=>(0,K.jsx)(Q,{project:e,repoPath:v(e.repo_id),draggable:!1,dragging:!1,onDragStart:()=>{},onDragEnd:()=>{},onDragOver:()=>{}},e.id))})]})]})}),m.open&&(0,K.jsx)(Y,{term:m.term,onExit:m.onExit}),e!==null&&(0,K.jsx)(H,{profileId:e,open:a,onOpenChange:o})]})}export{ne as Dashboard};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{y as n}from"./auth-CIb9G2C5.js";import{a as r,c as i,d as a,i as o,o as s,s as c,t as l,u}from"./LazyTerminal-Crwcrh-K.js";import{t as d}from"./jsx-runtime-By8HlURe.js";import{g as f,p}from"./hotkeys-DOpJ1a7g.js";import{L as m,_t as h,et as g,ft as _,h as v,it as y,st as b,tt as x}from"./protocol-support-BGk73LFk.js";import{a as S,i as C,l as w,o as T,r as E}from"./session-order-SN_zG4Us.js";import{a as D,i as O,n as k,o as A,t as j}from"./dialog-BMWRC2HO.js";import{n as M}from"./x-DCpy1q13.js";import{n as N,t as P}from"./chevron-right-BRjnLYaO.js";import{t as F}from"./button-9AVMLaMQ.js";import{c as I,d as L,n as R,r as z,t as B,u as V}from"./context-menu-D-5BvS0X.js";import{t as H}from"./NewProjectDialog-qFDLTphH.js";import{n as U}from"./errors-DTaodZDR.js";import{t as W}from"./ws-CspBmo8M.js";var G=e(t(),1),K=d(),q=!1;function J(){let[e,t]=(0,G.useState)(q),[r,i]=(0,G.useState)(null);(0,G.useEffect)(()=>{if(!e)return;let t=!1;return W.spawnShell(n).then(e=>{t||i(e)}),()=>{t=!0}},[e]);let a=()=>{q=!1,t(!1),i(null)};return{open:e,term:r,toggle:()=>{e?(r&&W.killShell(n,r),a()):(q=!0,t(!0))},onExit:a}}function Y({term:e,onExit:t}){return(0,K.jsx)(`div`,{className:`h-72 shrink-0 pb-6`,children:(0,K.jsx)(`div`,{className:`mx-auto size-full max-w-4xl px-6`,children:e!==null&&(0,K.jsx)(l,{stream:`home`,term:e,onExit:t})})})}var X=`group block w-full rounded-lg bg-surface p-4 text-left transition-colors hover:bg-elevated`,ee=[{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 i=n.filter(e=>e.status!==`archived`);return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`h2`,{className:M(`truncate pr-16 text-base font-semibold`,r(e.colour)||`text-fg group-hover:text-accent`),children:e.name}),(0,K.jsx)(`p`,{className:`mt-1 truncate text-2xs text-fg-muted`,children:t??`…`}),(0,K.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-3 text-2xs text-fg-muted tabular-nums`,children:[(0,K.jsxs)(`span`,{children:[i.length,` session`,i.length===1?``:`s`]}),ee.map(({status:e,colour:t})=>{let n=i.filter(t=>t.status===e).length;return n>0?(0,K.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(`span`,{className:`size-1.5 rounded-full ${t}`}),n,` `,e.replace(`_`,` `)]},e):null})]})]})}function Z({icon:e,label:t,onClick:n}){return(0,K.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,K.jsx)(e,{className:`size-4`})})}function Q({project:e,repoPath:t,draggable:n,dragging:c,onDragStart:l,onDragEnd:d,onDragOver:f}){let p=x(),g=v(m().data?.protocol),_=h(e.id),[y,b]=(0,G.useState)(!1),[S,C]=(0,G.useState)(e.name),[T,E]=(0,G.useState)(a(e)),[P,H]=(0,G.useState)(e.colour??null),W=t=>p.mutate({id:e.id,archived:t},{onError:e=>U(e)}),q=()=>{C(e.name),H(e.colour??null),E(a(e)),b(!0)},J=()=>{let t=S.trim(),n=u(T);if(!t){b(!1);return}let r={...t===e.name?{}:{name:t},...n&&n!==a(e)?{abbrev:n}:{},...g&&P!==(e.colour??null)?{colour:P}:{}};if(Object.keys(r).length===0){b(!1);return}p.mutate({id:e.id,...r},{onSuccess:()=>b(!1),onError:e=>U(e)})};return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(B,{children:[(0,K.jsx)(I,{asChild:!0,children:(0,K.jsxs)(`div`,{draggable:n,onDragStart:l,onDragEnd:d,onDragOver:f,className:M(`group relative transition-opacity`,c&&`opacity-50`),children:[(0,K.jsx)(w,{draggable:!1,to:`/project/${e.id}`,className:X,children:(0,K.jsx)(te,{project:e,repoPath:t,sessions:_.data??[]})}),(0,K.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,K.jsx)(Z,{icon:L,label:`Reopen project`,onClick:()=>W(!1)}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Z,{icon:s,label:`Edit project`,onClick:q}),(0,K.jsx)(Z,{icon:V,label:`Archive project`,onClick:()=>W(!0)})]})})]})}),(0,K.jsx)(R,{children:e.archived?(0,K.jsxs)(z,{onSelect:()=>W(!1),children:[(0,K.jsx)(L,{}),` Reopen`]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(z,{onSelect:q,children:[(0,K.jsx)(s,{}),` Edit`]}),(0,K.jsxs)(z,{onSelect:()=>W(!0),children:[(0,K.jsx)(V,{}),` Archive`]})]})})]}),(0,K.jsx)(j,{open:y,onOpenChange:b,children:(0,K.jsxs)(k,{children:[(0,K.jsx)(D,{children:(0,K.jsx)(A,{children:`Edit project`})}),(0,K.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),J()},children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,K.jsx)(i,{htmlFor:`project-name-${e.id}`,children:`Name`}),(0,K.jsx)(N,{id:`project-name-${e.id}`,value:S,className:r(P),onChange:e=>C(e.target.value),autoFocus:!0})]}),(0,K.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,K.jsx)(i,{htmlFor:`project-abbrev-${e.id}`,children:`Abbreviation`}),(0,K.jsx)(N,{id:`project-abbrev-${e.id}`,maxLength:5,value:T,onChange:e=>E(u(e.target.value)),className:`w-24 uppercase`}),(0,K.jsxs)(`p`,{className:`text-2xs text-fg-muted`,children:[`Up to `,5,` characters — the label on the collapsed sidebar rail.`]})]}),g&&(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,K.jsx)(`span`,{className:`text-xs text-fg-secondary`,children:`Colour`}),(0,K.jsx)(o,{value:P,onChange:H,label:`Project colour`})]}),(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(i,{className:`text-fg-muted`,children:`Path`}),(0,K.jsx)(`p`,{className:`truncate text-2xs text-fg-muted`,children:t??`…`})]}),(0,K.jsxs)(O,{children:[(0,K.jsx)(F,{type:`button`,variant:`ghost`,onClick:()=>b(!1),children:`Cancel`}),(0,K.jsx)(F,{type:`submit`,disabled:!S.trim()||p.isPending,children:`Save`})]})]})]})})]})}function $({icon:e,label:t,hint:n,onClick:r}){return(0,K.jsxs)(`button`,{type:`button`,onClick:r,className:`group flex flex-col rounded-lg bg-surface p-4 text-left transition-colors hover:bg-elevated`,children:[(0,K.jsxs)(`h2`,{className:`flex items-center gap-2 truncate text-base font-semibold text-fg group-hover:text-accent`,children:[(0,K.jsx)(e,{className:`size-4 shrink-0`}),t]}),(0,K.jsx)(`p`,{className:`mt-1 truncate text-2xs text-fg-muted`,children:n})]})}function ne(){let e=f(),t=b(e??void 0),n=_(),r=y(e??void 0),i=g(e??``),[a,o]=(0,G.useState)(!1),[s,l]=(0,G.useState)(null),[u,d]=(0,G.useState)(!1),m=J(),h=p(`palette.toggle`),v=e=>n.data?.find(t=>t.id===e)?.path,x=t.data??[],w=r.data?.projectOrder??[],D=E(x.filter(e=>!e.archived),w),O=x.filter(e=>e.archived),k=(e,t)=>{e!==t&&i.mutate({projectOrder:C(D.map(e=>e.id),e,t)})};return(0,K.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,K.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,K.jsxs)(`div`,{className:`mx-auto max-w-4xl p-6`,children:[x.length===0&&(0,K.jsxs)(`div`,{className:`mb-8 mt-16 flex flex-col items-center gap-3 text-center`,children:[(0,K.jsx)(c,{className:`size-8 text-fg-muted`}),(0,K.jsxs)(`p`,{className:`text-sm text-fg-secondary`,children:[`No projects yet — open one below, or press `,h,`.`]})]}),(0,K.jsxs)(`div`,{className:`grid auto-rows-fr grid-cols-1 gap-3 sm:grid-cols-2`,children:[D.map(e=>(0,K.jsx)(Q,{project:e,repoPath:v(e.repo_id),draggable:!0,dragging:s===e.id,onDragStart:()=>l(e.id),onDragEnd:()=>l(null),onDragOver:t=>{t.preventDefault(),s&&s!==e.id&&k(s,e.id)}},e.id)),(0,K.jsx)($,{icon:T,label:`Open project`,hint:`Point at a repository on this host`,onClick:()=>o(!0)}),(0,K.jsx)($,{icon:S,label:m.open?`Close terminal`:`Open terminal`,hint:m.open?`End the shell below`:`A shell at ~ for cloning repositories`,onClick:m.toggle})]}),O.length>0&&(0,K.jsxs)(`div`,{className:`mt-6`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>d(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,K.jsx)(P,{className:M(`size-3 transition-transform`,u&&`rotate-90`)}),(0,K.jsx)(V,{className:`size-3`}),(0,K.jsx)(`span`,{children:`Archived`}),(0,K.jsx)(`span`,{className:`tabular-nums`,children:O.length})]}),u&&(0,K.jsx)(`div`,{className:`mt-2 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:O.map(e=>(0,K.jsx)(Q,{project:e,repoPath:v(e.repo_id),draggable:!1,dragging:!1,onDragStart:()=>{},onDragEnd:()=>{},onDragOver:()=>{}},e.id))})]})]})}),m.open&&(0,K.jsx)(Y,{term:m.term,onExit:m.onExit}),e!==null&&(0,K.jsx)(H,{profileId:e,open:a,onOpenChange:o})]})}export{ne as Dashboard};
@@ -1 +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,n as a,o,r as s,t as c}from"./dialog-BMWRC2HO.js";import{t as l}from"./x-DCpy1q13.js";import{t as u}from"./button-BgeBH2Uc.js";import{t as d}from"./createLucideIcon-DyMAgLa3.js";import{t as f}from"./drafts-B_tChlzR.js";import{i as p,t as m,u as h}from"./buffer-store-JDgXuYJp.js";import{t as g}from"./editor-sync-W1bamxAP.js";var _=d(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),v=e(t(),1),y=n();function b(e,t,n){let r=m(e,t,n);return(0,v.useSyncExternalStore)((0,v.useCallback)(e=>h(r,e),[r]),()=>p(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:hidden`}):null}function S({session:e,path:t,kind:n,root:d,label:p,onClose:m}){let h=b(e,t,d)&&n!==`commit`,[_,x]=(0,v.useState)(!1),S=()=>h?x(!0):m();return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`button`,{onClick:e=>{e.stopPropagation(),S()},className:`hidden size-4 items-center justify-center rounded-sm text-fg-muted transition-colors hover:text-fg group-hover:flex pointer-coarse:flex`,"aria-label":`Close ${p}`,children:(0,y.jsx)(l,{className:`size-3`})}),(0,y.jsx)(c,{open:_,onOpenChange:e=>!e&&x(!1),children:(0,y.jsxs)(a,{children:[(0,y.jsxs)(r,{children:[(0,y.jsxs)(o,{children:[`Discard changes to `,p,`?`]}),(0,y.jsx)(s,{children:`This file has unsaved changes. Closing the tab will discard them.`})]}),(0,y.jsxs)(i,{children:[(0,y.jsx)(u,{variant:`ghost`,onClick:()=>x(!1),children:`Keep editing`}),(0,y.jsx)(u,{variant:`danger`,onClick:()=>{f(e,t,d),g(e,t,d),x(!1),m()},children:`Discard`})]})]})})]})}export{x as EditorDirtyDot,S as EditorTabClose};
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,n as a,o,r as s,t as c}from"./dialog-BMWRC2HO.js";import{t as l}from"./x-DCpy1q13.js";import{t as u}from"./button-9AVMLaMQ.js";import{t as d}from"./createLucideIcon-DyMAgLa3.js";import{i as f,t as p,u as m}from"./buffer-store-B2nYD11t.js";import{t as h}from"./drafts-B_tChlzR.js";import{t as g}from"./editor-sync-W1bamxAP.js";var _=d(`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:hidden`}):null}function S({session:e,path:t,kind:n,root:d,label:f,onClose:p}){let m=b(e,t,d)&&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:`hidden size-4 items-center justify-center rounded-sm text-fg-muted transition-colors hover:text-fg group-hover:flex pointer-coarse:flex`,"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)(a,{children:[(0,y.jsxs)(r,{children:[(0,y.jsxs)(o,{children:[`Discard changes to `,f,`?`]}),(0,y.jsx)(s,{children:`This file has unsaved changes. Closing the tab will discard them.`})]}),(0,y.jsxs)(i,{children:[(0,y.jsx)(u,{variant:`ghost`,onClick:()=>x(!1),children:`Keep editing`}),(0,y.jsx)(u,{variant:`danger`,onClick:()=>{h(e,t,d),g(e,t,d),x(!1),p()},children:`Discard`})]})]})})]})}export{x as EditorDirtyDot,S as EditorTabClose};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Terminal-C56yFFee.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-CZI7_Jkm.js","assets/react-dom-cJyBB_A4.js","assets/auth-CIb9G2C5.js","assets/client-settings-CwqpIric.js","assets/jsx-runtime-By8HlURe.js","assets/preload-helper-Czpn1I53.js","assets/index-B_fYaxIG.js","assets/index-ChK3zzci.css","assets/hotkeys-DOpJ1a7g.js","assets/forward-link-C-8Xn8gf.js","assets/api-CfmzEbQ_.js","assets/protocol-support-BGk73LFk.js","assets/dist-BOS6OKSE.js","assets/x-DCpy1q13.js","assets/createLucideIcon-DyMAgLa3.js","assets/FindWidget-CVH9U-_P.js","assets/whole-word-2m2pmAFT.js","assets/chevron-down--sjpQEHH.js","assets/selection-actions--OSfjvlG.js","assets/button-BgeBH2Uc.js","assets/copy-CGsu8426.js","assets/ws-CspBmo8M.js","assets/code-DRWf9a5s.js","assets/errors-DTaodZDR.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{z as n}from"./auth-CIb9G2C5.js";import{t as r}from"./jsx-runtime-By8HlURe.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{S as a}from"./dialog-BMWRC2HO.js";import{n as o}from"./x-DCpy1q13.js";import{n as s}from"./chevron-right-BRjnLYaO.js";import{t as c}from"./createLucideIcon-DyMAgLa3.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:o(`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-fg`,gold:`text-fg-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:o(`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:o(`size-3.5 rounded-full`,n?o(`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)(s,{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:o(`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:o(`relative flex cursor-pointer select-none items-center gap-2 rounded-sm 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-C56yFFee.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-C56yFFee.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
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Terminal-B3Iw783s.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-CZI7_Jkm.js","assets/react-dom-cJyBB_A4.js","assets/auth-CIb9G2C5.js","assets/client-settings-CwqpIric.js","assets/jsx-runtime-By8HlURe.js","assets/preload-helper-Czpn1I53.js","assets/index-B9DFgBft.js","assets/index-DwtrJj9v.css","assets/hotkeys-DOpJ1a7g.js","assets/forward-link-C-8Xn8gf.js","assets/api-CfmzEbQ_.js","assets/protocol-support-BGk73LFk.js","assets/dist-BOS6OKSE.js","assets/x-DCpy1q13.js","assets/createLucideIcon-DyMAgLa3.js","assets/FindWidget-CVH9U-_P.js","assets/whole-word-2m2pmAFT.js","assets/chevron-down--sjpQEHH.js","assets/selection-actions-BjVj7hXw.js","assets/button-9AVMLaMQ.js","assets/copy-CGsu8426.js","assets/ws-CspBmo8M.js","assets/code-DRWf9a5s.js","assets/errors-DTaodZDR.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{z as n}from"./auth-CIb9G2C5.js";import{t as r}from"./jsx-runtime-By8HlURe.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{S as a}from"./dialog-BMWRC2HO.js";import{n as o}from"./x-DCpy1q13.js";import{n as s}from"./chevron-right-BRjnLYaO.js";import{t as c}from"./createLucideIcon-DyMAgLa3.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:o(`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-fg`,gold:`text-fg-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:o(`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:o(`size-3.5 rounded-full`,n?o(`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)(s,{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:o(`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:o(`relative flex cursor-pointer select-none items-center gap-2 rounded-sm 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-B3Iw783s.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-B3Iw783s.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-JDgXuYJp.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};
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-B2nYD11t.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};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{a as n,c as r,i,l as a,r as ee,s as o,u as s}from"./LazyTerminal-B2eXi-NW.js";import{t as c}from"./jsx-runtime-By8HlURe.js";import{K as l,L as u,N as d,P as te,U as f,c as ne,ft as re,h as ie}from"./protocol-support-BGk73LFk.js";import{m as ae,s as p}from"./session-order-SN_zG4Us.js";import{a as m,i as h,n as g,o as _,r as v,t as y}from"./dialog-BMWRC2HO.js";import{n as b}from"./chevron-right-BRjnLYaO.js";import{t as x}from"./button-BgeBH2Uc.js";import{t as S}from"./createLucideIcon-DyMAgLa3.js";import{t as oe}from"./use-debounced-value-C86N-mOK.js";var C=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`}]]),w=e(t(),1),T=c();function E(e){let t=e.trim().replace(/\/+$/,``);return t===``?`/`:t}function D(e){return e.startsWith(`/`)||e.startsWith(`~`)}function O(e){let t=e.replace(/\/+$/,``),n=t.lastIndexOf(`/`);return n<=0?`/`:t.slice(0,n)}function se({dir:e,onNavigate:t,onChoose:n}){let r=f(e.endsWith(`/`)?e:`${e}/`);return(0,T.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,T.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,T.jsxs)(`button`,{type:`button`,onClick:()=>t(O(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,T.jsx)(p,{className:`size-3.5`}),(0,T.jsx)(`span`,{className:`sr-only`,children:`Parent directory`})]}),(0,T.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,T.jsxs)(`div`,{className:`max-h-48 overflow-y-auto`,children:[(r.data?.entries??[]).map(e=>(0,T.jsxs)(`div`,{className:`flex items-center rounded-md transition-colors hover:bg-elevated`,children:[(0,T.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,T.jsx)(o,{className:`size-3.5 shrink-0 text-success`}):(0,T.jsx)(C,{className:`size-3.5 shrink-0 text-fg-gold`}),(0,T.jsx)(`span`,{className:`truncate text-xs text-fg`,children:e.name})]}),e.is_git&&(0,T.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)),r.data!==void 0&&r.data.entries.length===0&&(0,T.jsx)(`p`,{className:`px-2 py-1 text-xs text-fg-muted`,children:`No subdirectories.`})]})]})}function k({profileId:e,open:t,onOpenChange:o}){let c=re(),p=u().data?.protocol,S=ne(p),C=ie(p),O=te(),k=d(),A=ae(),j=l(),[M,N]=(0,w.useState)(``),[P,F]=(0,w.useState)(``),[I,L]=(0,w.useState)(!1),[R,z]=(0,w.useState)(``),[B,V]=(0,w.useState)(null),[H,U]=(0,w.useState)(!1),[W,G]=(0,w.useState)(null),[K,q]=(0,w.useState)(null),J=j.data?.home,ce=()=>{let e=M.trim(),t=D(e)&&J!==void 0?E(e.replace(/^~(?=\/|$)/,J)):D(e)&&e.startsWith(`/`)?E(e):J??`/`;X(t)},Y=e=>{F(e),H||z(a(e))},X=e=>{q(e),N(e)},le=e=>{N(e),q(null),Y(e.split(`/`).filter(Boolean).pop()??``),L(!0)},Z=f(oe(M,150)),ue=(0,w.useMemo)(()=>{if(!D(M))return(c.data??[]).map(e=>({value:e.path,badge:`registered`,is_git:!0}));let e=new Set((c.data??[]).map(e=>e.path));return(Z.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}))},[M,c.data,Z.data]),Q=async()=>{G(null);try{let t=E(M),n=c.data?.find(e=>e.path===t)?.id??(await O.mutateAsync({path:t,...S?{default_base_branch:``}:{}})).id,r=await k.mutateAsync({profile_id:e,repo_id:n,name:P.trim(),...C?{colour:B}:{},...s(R)?{abbrev:s(R)}:{}});o(!1),A(`/project/${r.id}`)}catch(e){G(e instanceof Error?e.message:String(e))}},$=P.trim()!==``&&D(M.trim());return(0,T.jsx)(y,{open:t,onOpenChange:o,children:(0,T.jsxs)(g,{children:[(0,T.jsxs)(m,{children:[(0,T.jsx)(_,{children:`New project`}),(0,T.jsx)(v,{children:`Point at a git repository on the daemon host — known repositories are reused.`})]}),(0,T.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),$&&Q()},children:[(0,T.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,T.jsx)(r,{htmlFor:`repo-path`,children:`Repository path`}),(0,T.jsx)(`button`,{type:`button`,onClick:()=>K===null?ce():q(null),className:`text-2xs text-fg-muted transition-colors hover:text-fg`,children:K===null?`browse…`:`hide browser`})]}),(0,T.jsx)(ee,{id:`repo-path`,placeholder:`~/src/my-repo`,value:M,onValueChange:N,onChoose:e=>{!I&&e.is_git&&Y(e.value.split(`/`).filter(Boolean).pop()??``)},hints:ue}),K!==null&&(0,T.jsx)(se,{dir:K,onNavigate:X,onChoose:le})]}),(0,T.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,T.jsx)(r,{htmlFor:`project-name`,children:`Project name`}),(0,T.jsx)(b,{id:`project-name`,placeholder:`e.g. checkout-rework`,value:P,className:n(B),onChange:e=>{Y(e.target.value),L(!0)}})]}),(0,T.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,T.jsx)(r,{htmlFor:`project-abbrev`,children:`Abbreviation`}),(0,T.jsx)(b,{id:`project-abbrev`,placeholder:P.trim()?a(P):`ABBRV`,maxLength:5,value:R,onChange:e=>{z(s(e.target.value)),U(!0)},className:`w-24 uppercase`}),(0,T.jsxs)(`p`,{className:`text-2xs text-fg-muted`,children:[`Up to `,5,` characters — the project's label on the collapsed sidebar rail.`]})]}),C&&(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,T.jsx)(`span`,{className:`text-xs text-fg-secondary`,children:`Colour`}),(0,T.jsx)(i,{value:B,onChange:V,label:`Project colour`})]}),W&&(0,T.jsx)(`p`,{className:`text-xs text-danger`,children:W}),(0,T.jsxs)(h,{children:[(0,T.jsx)(x,{type:`button`,variant:`ghost`,onClick:()=>o(!1),children:`Cancel`}),(0,T.jsx)(x,{type:`submit`,disabled:!$||O.isPending||k.isPending,children:`Create project`})]})]})]})})}export{k as t};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{a as n,c as r,i,l as a,r as ee,s as o,u as s}from"./LazyTerminal-Crwcrh-K.js";import{t as c}from"./jsx-runtime-By8HlURe.js";import{K as l,L as u,N as d,P as te,U as f,c as ne,ft as re,h as ie}from"./protocol-support-BGk73LFk.js";import{m as ae,s as p}from"./session-order-SN_zG4Us.js";import{a as m,i as h,n as g,o as _,r as v,t as y}from"./dialog-BMWRC2HO.js";import{n as b}from"./chevron-right-BRjnLYaO.js";import{t as x}from"./button-9AVMLaMQ.js";import{t as S}from"./createLucideIcon-DyMAgLa3.js";import{t as oe}from"./use-debounced-value-C86N-mOK.js";var C=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`}]]),w=e(t(),1),T=c();function E(e){let t=e.trim().replace(/\/+$/,``);return t===``?`/`:t}function D(e){return e.startsWith(`/`)||e.startsWith(`~`)}function O(e){let t=e.replace(/\/+$/,``),n=t.lastIndexOf(`/`);return n<=0?`/`:t.slice(0,n)}function se({dir:e,onNavigate:t,onChoose:n}){let r=f(e.endsWith(`/`)?e:`${e}/`);return(0,T.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,T.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,T.jsxs)(`button`,{type:`button`,onClick:()=>t(O(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,T.jsx)(p,{className:`size-3.5`}),(0,T.jsx)(`span`,{className:`sr-only`,children:`Parent directory`})]}),(0,T.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,T.jsxs)(`div`,{className:`max-h-48 overflow-y-auto`,children:[(r.data?.entries??[]).map(e=>(0,T.jsxs)(`div`,{className:`flex items-center rounded-md transition-colors hover:bg-elevated`,children:[(0,T.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,T.jsx)(o,{className:`size-3.5 shrink-0 text-success`}):(0,T.jsx)(C,{className:`size-3.5 shrink-0 text-fg-gold`}),(0,T.jsx)(`span`,{className:`truncate text-xs text-fg`,children:e.name})]}),e.is_git&&(0,T.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)),r.data!==void 0&&r.data.entries.length===0&&(0,T.jsx)(`p`,{className:`px-2 py-1 text-xs text-fg-muted`,children:`No subdirectories.`})]})]})}function k({profileId:e,open:t,onOpenChange:o}){let c=re(),p=u().data?.protocol,S=ne(p),C=ie(p),O=te(),k=d(),A=ae(),j=l(),[M,N]=(0,w.useState)(``),[P,F]=(0,w.useState)(``),[I,L]=(0,w.useState)(!1),[R,z]=(0,w.useState)(``),[B,V]=(0,w.useState)(null),[H,U]=(0,w.useState)(!1),[W,G]=(0,w.useState)(null),[K,q]=(0,w.useState)(null),J=j.data?.home,ce=()=>{let e=M.trim(),t=D(e)&&J!==void 0?E(e.replace(/^~(?=\/|$)/,J)):D(e)&&e.startsWith(`/`)?E(e):J??`/`;X(t)},Y=e=>{F(e),H||z(a(e))},X=e=>{q(e),N(e)},le=e=>{N(e),q(null),Y(e.split(`/`).filter(Boolean).pop()??``),L(!0)},Z=f(oe(M,150)),ue=(0,w.useMemo)(()=>{if(!D(M))return(c.data??[]).map(e=>({value:e.path,badge:`registered`,is_git:!0}));let e=new Set((c.data??[]).map(e=>e.path));return(Z.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}))},[M,c.data,Z.data]),Q=async()=>{G(null);try{let t=E(M),n=c.data?.find(e=>e.path===t)?.id??(await O.mutateAsync({path:t,...S?{default_base_branch:``}:{}})).id,r=await k.mutateAsync({profile_id:e,repo_id:n,name:P.trim(),...C?{colour:B}:{},...s(R)?{abbrev:s(R)}:{}});o(!1),A(`/project/${r.id}`)}catch(e){G(e instanceof Error?e.message:String(e))}},$=P.trim()!==``&&D(M.trim());return(0,T.jsx)(y,{open:t,onOpenChange:o,children:(0,T.jsxs)(g,{children:[(0,T.jsxs)(m,{children:[(0,T.jsx)(_,{children:`New project`}),(0,T.jsx)(v,{children:`Point at a git repository on the daemon host — known repositories are reused.`})]}),(0,T.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),$&&Q()},children:[(0,T.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,T.jsx)(r,{htmlFor:`repo-path`,children:`Repository path`}),(0,T.jsx)(`button`,{type:`button`,onClick:()=>K===null?ce():q(null),className:`text-2xs text-fg-muted transition-colors hover:text-fg`,children:K===null?`browse…`:`hide browser`})]}),(0,T.jsx)(ee,{id:`repo-path`,placeholder:`~/src/my-repo`,value:M,onValueChange:N,onChoose:e=>{!I&&e.is_git&&Y(e.value.split(`/`).filter(Boolean).pop()??``)},hints:ue}),K!==null&&(0,T.jsx)(se,{dir:K,onNavigate:X,onChoose:le})]}),(0,T.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,T.jsx)(r,{htmlFor:`project-name`,children:`Project name`}),(0,T.jsx)(b,{id:`project-name`,placeholder:`e.g. checkout-rework`,value:P,className:n(B),onChange:e=>{Y(e.target.value),L(!0)}})]}),(0,T.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,T.jsx)(r,{htmlFor:`project-abbrev`,children:`Abbreviation`}),(0,T.jsx)(b,{id:`project-abbrev`,placeholder:P.trim()?a(P):`ABBRV`,maxLength:5,value:R,onChange:e=>{z(s(e.target.value)),U(!0)},className:`w-24 uppercase`}),(0,T.jsxs)(`p`,{className:`text-2xs text-fg-muted`,children:[`Up to `,5,` characters — the project's label on the collapsed sidebar rail.`]})]}),C&&(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,T.jsx)(`span`,{className:`text-xs text-fg-secondary`,children:`Colour`}),(0,T.jsx)(i,{value:B,onChange:V,label:`Project colour`})]}),W&&(0,T.jsx)(`p`,{className:`text-xs text-danger`,children:W}),(0,T.jsxs)(h,{children:[(0,T.jsx)(x,{type:`button`,variant:`ghost`,onClick:()=>o(!1),children:`Cancel`}),(0,T.jsx)(x,{type:`submit`,disabled:!$||O.isPending||k.isPending,children:`Create project`})]})]})]})})}export{k as t};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{s as n}from"./auth-CIb9G2C5.js";import{t as r}from"./context-CwZ4epwz.js";import{t as i}from"./jsx-runtime-By8HlURe.js";import{t as a}from"./preload-helper-Czpn1I53.js";import{a as o,r as s}from"./index-B_fYaxIG.js";var c=e(t(),1),l=i(),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:i,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)(o,s,s)]),(0,c.useEffect)(()=>{let t=!1,o,s=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 a=e.data;if(a.type===`height`&&Number.isFinite(a.height)&&x(Math.max(24,Math.min(2e3,a.height))),a.type===`error`&&C(String(a.error).slice(0,1024)),a.type===`extension`&&T(String(a.name).slice(0,256)),a.type!==`comm`||!r||!i)return;let o=n.safeParse({source:r.source,generation:i,message:a.message});if(!o.success||JSON.stringify(o.data).length>2*1024*1024){C(`Widget action exceeds the supported message limits`);return}r.send(i,o.data.message).catch(e=>{t||s.port1.postMessage({type:`error`,msg_id:o.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:!!i,extensions:u,theme:m()}),o=r?.subscribe(e=>{e.generation!==i||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,o?.(),y(e=>e+1)):s.port1.postMessage({type:`events`,events:e.events})})};return window.addEventListener(`message`,s),(async()=>{let{default:e}=await a(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>
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{s as n}from"./auth-CIb9G2C5.js";import{t as r}from"./context-CwZ4epwz.js";import{t as i}from"./jsx-runtime-By8HlURe.js";import{t as a}from"./preload-helper-Czpn1I53.js";import{a as o,r as s}from"./index-B9DFgBft.js";var c=e(t(),1),l=i(),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:i,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)(o,s,s)]),(0,c.useEffect)(()=>{let t=!1,o,s=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 a=e.data;if(a.type===`height`&&Number.isFinite(a.height)&&x(Math.max(24,Math.min(2e3,a.height))),a.type===`error`&&C(String(a.error).slice(0,1024)),a.type===`extension`&&T(String(a.name).slice(0,256)),a.type!==`comm`||!r||!i)return;let o=n.safeParse({source:r.source,generation:i,message:a.message});if(!o.success||JSON.stringify(o.data).length>2*1024*1024){C(`Widget action exceeds the supported message limits`);return}r.send(i,o.data.message).catch(e=>{t||s.port1.postMessage({type:`error`,msg_id:o.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:!!i,extensions:u,theme:m()}),o=r?.subscribe(e=>{e.generation!==i||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,o?.(),y(e=>e+1)):s.port1.postMessage({type:`events`,events:e.events})})};return window.addEventListener(`message`,s),(async()=>{let{default:e}=await a(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}