@dubusoft/toodo-linux-arm64 1.3.3-dev.62 → 1.3.3-dev.64

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.
@@ -1 +0,0 @@
1
- import{i as e,n as t,r as n,s as r,t as i}from"./dist-ZmB2kPfR.js";import{I as a,It as o,K as s,Q as c,R as l,W as u,Zt as d,d as f,ft as p,kt as m,z as h}from"./status-styles-B50F--g1.js";import{f as g,g as _,h as v}from"./event-CwtUqkXR.js";var y={name:`ban`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}]]};y.node;var b=t(y),x={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};x.node;var S=t(x),C={name:`chevron-left`,size:24,node:[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]};C.node;var w=t(C),T={name:`laptop`,size:24,node:[[`path`,{d:`M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z`,key:`1pdavp`}],[`path`,{d:`M20.054 15.987H3.946`,key:`14rxg9`}]]};T.node;var E=t(T),D={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};D.node;var O=t(D),k={name:`server`,size:24,node:[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]};k.node;var A=t(k),j={name:`triangle-alert`,size:24,node:[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`alert-triangle`]};j.node;var M=t(j),N={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]};N.node;var P=t(N),F=r(e(),1),I=n();function ee(e,t){if(e===null)return;let n=[...e.querySelectorAll(`a[href], button, input, select, textarea, summary, [tabindex]`)].filter(e=>!e.matches(`:disabled, [tabindex='-1']`)&&e.getClientRects().length>0);if(n.length===0)return;let r=n[0],i=n[n.length-1],a=document.activeElement,o=a instanceof Node&&e.contains(a);(t.shiftKey?!o||a===r:!o||a===i)&&(t.preventDefault(),(t.shiftKey?i:r).focus())}function L(e){let t=/^[a-zA-Z]:/.test(e)||e.startsWith(`\\\\`)||e.includes(`\\`)&&!e.includes(`/`),n=t?`\\`:`/`,r=``,i=e,a=t?/^[\\/]{2}[^\\/]+[\\/]+[^\\/]+/.exec(e):null,o=t?/^[a-zA-Z]:([\\/]?)/.exec(e):null;a?(r=`${a[0].replace(/[\\/]+/g,`\\`).replace(/^\\/,`\\\\`)}\\`,i=e.slice(a[0].length)):o?(r=o[0].slice(0,2)+(o[1]?n:``),i=e.slice(o[0].length)):/^[\\/]/.test(e)&&(r=n,i=e.replace(/^[\\/]+/,``));let s=[];for(let e of i.split(t?/[\\/]+/:/\/+/))e!==``&&e!==`.`&&(e===`..`?s.length>0&&s[s.length-1]!==`..`?s.pop():r===``&&s.push(e):s.push(e));return{root:r,separator:n,segments:s}}function R(e){let{root:t,separator:n,segments:r}=L(e),i=t+r.join(n);return i===``?`.`:i}function z(e){return/^[a-zA-Z]:/.test(e)||e.startsWith(`\\\\`)}function B(e,t=2){let{separator:n,segments:r}=L(e);return r.length<=t?R(e):`…${n}${r.slice(-t).join(n)}`}var V=200;function H(e,t){let n=z(e)?`\\`:`/`;return/[\\/]$/.test(e)?`${e}${t}`:`${e}${n}${t}`}function te(e){return e.replace(/(?<=[^\\/:])[\\/]+$/,``)}function U(e,t){let[n,r]=(0,F.useState)(e);return(0,F.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function ne({id:e,machine:t,value:n,onChange:r,describedBy:a,required:o,autoFocus:s,className:c}){let[l,u]=(0,F.useState)(!1),[d,f]=(0,F.useState)(-1),p=Math.max(n.lastIndexOf(`/`),n.lastIndexOf(`\\`)),m=p<0?null:n.slice(0,p+1),g=n.slice(p+1).toLowerCase(),_=U(m,V),v=h(t,l?_:null),y=l&&m!==null&&_===m,b=y&&v.data?v.data.directories.filter(e=>e.toLowerCase().startsWith(g)):[],x=b.length>0,S=`${e}-folders`,C=t.kind===`local`?`the server`:t.label;function w(e){r(e),f(-1),u(!0)}function T(e){m!==null&&w(`${H(m,e)}${z(m)?`\\`:`/`}`)}function E(e){if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),!x){u(!0);return}let t=b.length,n=e.key===`ArrowDown`;f(e=>e<0?n?0:t-1:(e+(n?1:t-1))%t)}else if(e.key===`Enter`){if(!x||d<0)return;e.preventDefault(),T(b[d])}else if(e.key===`Tab`){if(!x||e.shiftKey||d<0&&g===``)return;e.preventDefault(),e.stopPropagation(),T(b[Math.max(d,0)])}else if(e.key===`Escape`){if(!x)return;e.preventDefault(),e.stopPropagation(),u(!1)}}return(0,I.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,I.jsx)(`input`,{id:e,role:`combobox`,"aria-expanded":x,"aria-controls":S,"aria-autocomplete":`list`,"aria-activedescendant":x&&d>=0?`${S}-${d}`:void 0,"aria-describedby":a,autoComplete:`off`,spellCheck:!1,className:c,value:n,onChange:e=>w(e.target.value),onFocus:()=>u(!0),onBlur:()=>u(!1),onKeyDown:E,required:o,autoFocus:s}),x&&(0,I.jsx)(`ul`,{id:S,role:`listbox`,"aria-label":`Folders in ${m}`,className:`absolute top-full right-0 left-0 z-10 mt-1 flex max-h-56 flex-col overflow-y-auto rounded-lg border bg-popover p-1 font-mono text-xs text-popover-foreground shadow-md`,children:b.map((e,t)=>(0,I.jsxs)(`li`,{id:`${S}-${t}`,role:`option`,"aria-selected":t===d,onMouseDown:e=>e.preventDefault(),onClick:()=>T(e),className:i(`cursor-pointer truncate rounded px-1.5 py-1 hover:bg-muted max-md:py-2`,t===d&&`bg-secondary hover:bg-secondary`),children:[e,z(m??``)?`\\`:`/`]},e))}),y&&v.isError&&(0,I.jsxs)(`p`,{role:`status`,className:`mt-1 text-xs break-words text-muted-foreground`,children:[`No suggestions: `,v.error.message,`. Type the path of a folder that exists on `,C,`, ending in a separator, to see its subfolders.`]})]})}var re=[`none`,`local_git`,`github`],ie=[`manual`,`local_merge`,`pr_merge`],ae=[`herdr`,`plain`,`tmux`,`none`],oe=[`open`,`init`,`clone`],W={none:`Plain folder`,local_git:`Local git`,github:`GitHub`},G={manual:`Manual`,local_merge:`Local merge`,pr_merge:`PR merge`},K={none:`No runner`,herdr:`herdr`,plain:`Plain`,tmux:`tmux`},se={open:`Open existing`,init:`New repository`,clone:`Clone URL`};function q(e){return e===`none`?`manual`:e===`local_git`?`local_merge`:`pr_merge`}function ce(e,t=!1){return e===`none`?`none`:t?`plain`:`herdr`}function le(e){return e===`none`?null:`open`}function ue(e,t){switch(t){case`manual`:return null;case`local_merge`:return e===`local_git`?null:e===`none`?`Needs a git repository; choose source Local git`:`GitHub tasks merge through pull requests; choose source Local git`;case`pr_merge`:return e===`github`?null:e===`none`?`Needs a git repository; choose source GitHub`:`Needs a GitHub origin remote; choose source GitHub`}}function de(e,t,n){return n!==`none`&&e===`none`?`Needs a git repository for task worktrees; choose source Local git or GitHub`:n===`none`&&t!==`manual`?`${G[t]} needs the task branch that herdr, ${K.plain}, or ${K.tmux} creates; choose completion Manual`:null}function fe(e,t){return e===`tmux`&&t.kind===`ssh`&&z(t.path)?`Needs a POSIX host; choose ${K.plain} or ${K.herdr} for a Windows SSH workspace, or choose a POSIX path for ${K.tmux}`:null}function pe(e,t){return e===`none`?`A plain folder has no repository; choose source Local git or GitHub`:e===`github`&&t===`init`?`A new repository has no GitHub origin; choose source Local git`:null}function me(e,t=!1){let{source:n}=e,r=e.repository!==null&&pe(n,e.repository)===null?e.repository:le(n),i=e.completion!==null&&ue(n,e.completion)===null?e.completion:q(n);return{source:n,repository:r,completion:i,runner:e.runner!==null&&de(n,i,e.runner)===null?e.runner:ce(n,t)}}function he(e,t,n=!1){let r={...e,...t},i=me(r,n);return{source:r.source,repository:r.repository===i.repository?r.repository:null,completion:r.completion===i.completion?r.completion:null,runner:r.runner===i.runner?r.runner:null}}var J=`h-8 w-full min-w-0 rounded-lg border border-input bg-background px-2.5 text-sm outline-none max-md:h-11 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50`,Y=`h-6 rounded-md border border-input bg-background px-1.5 text-xs outline-none max-md:h-11 max-md:px-2.5 max-md:text-sm focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:opacity-50`;function X(e){let t=R(e.path);return e.kind===`local`?t:`${e.machine}:${t}`}function ge(e){let t=B(e.path);return e.kind===`local`?t:`${e.machine}:${t}`}var _e={foreign:`Windows path, not on this server`,missing:`Folder not found on the server`};function ve({problem:e,className:t}){return(0,I.jsxs)(`span`,{className:i(`flex min-w-0 items-start gap-1 text-xs text-destructive`,t),title:`Toodo cannot run git in this repository until its path is corrected`,children:[(0,I.jsx)(M,{"aria-hidden":`true`,className:`mt-0.5 size-3 shrink-0`}),(0,I.jsx)(`span`,{children:_e[e]})]})}function ye({workspace:e}){let t=W[e.source],n=G[e.completion],r=K[e.runner];return(0,I.jsxs)(`span`,{className:`text-xs text-muted-foreground`,title:`Source ${t}, completion ${n}, runner ${r}; set when the workspace was added`,children:[(0,I.jsx)(`span`,{className:`whitespace-nowrap`,children:t}),` · `,(0,I.jsx)(`span`,{className:`whitespace-nowrap`,children:n}),` `,`· `,(0,I.jsx)(`span`,{className:`whitespace-nowrap`,children:r})]})}function be(e){return e.kind===`local`?null:e.machine}function xe(e,t){let n=t.filter(t=>t.target===e);return n.length===0?`Not saved in herdr`:n.some(e=>e.enabled)?null:`Disabled in herdr`}function Se(e){return/[\\/]$/.test(e)?e:H(e,``)}function Z({label:e,help:t,children:n}){let r=(0,F.useId)(),i=`${r}-help`;return(0,I.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,I.jsx)(`label`,{htmlFor:r,className:`text-xs text-muted-foreground`,children:e}),n({id:r,describedBy:t?i:void 0}),t&&(0,I.jsx)(`p`,{id:i,className:`text-xs text-muted-foreground`,children:t})]})}function Ce(e){return e.replace(/[\\/]+$/,``).split(/[\\/]/).pop()??``}function we(e){return Ce(e.trim().replace(/\.git$/,``)).split(`:`).pop()??``}function Te({selectedId:e,onSelect:t}){let n=o(),r=(0,F.useSyncExternalStore)(v,g),i=r===`unreachable`||r===`retrying`,a=u(),s=p().data?.herdr.installed===!1,[c,l]=(0,F.useState)(null),f=(0,F.useRef)(null),m=()=>{l(null),f.current?.focus()},[h,y]=(0,F.useState)(!1),b=a.data??[],x=[null,...new Set([...b.map(e=>e.target),...(n.data??[]).flatMap(e=>e.location.kind===`ssh`?[e.location.machine]:[])])];return(0,I.jsxs)(`section`,{"aria-labelledby":`workspaces-heading`,className:`flex shrink-0 flex-col gap-2`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,I.jsx)(`h2`,{id:`workspaces-heading`,className:`text-xs font-medium uppercase text-muted-foreground`,children:`Workspaces`}),(0,I.jsxs)(d,{variant:`ghost`,size:`xs`,onClick:()=>y(e=>!e),children:[!h&&(0,I.jsx)(O,{}),h?`Cancel`:`Add machine`]})]}),h&&(0,I.jsx)(Oe,{herdrMissing:s,onClose:()=>y(!1)}),a.isError&&(s?(0,I.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`herdr is not installed on this server, so there are no SSH machines; workspaces on Local can use runner`,` `,K.plain,`.`]}):(0,I.jsxs)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:[`Failed to list herdr machines: `,a.error.message]})),n.isPending&&!i&&(0,I.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading workspaces...`}),(n.isError||n.isPending&&i)&&(0,I.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-2 text-sm text-destructive`,children:[(0,I.jsxs)(`p`,{children:[`Failed to load workspaces:`,` `,n.error?.message??(_()||`The Toodo server does not answer.`)]}),(0,I.jsx)(d,{size:`xs`,variant:`outline`,onClick:()=>void n.refetch(),children:`Retry now`})]}),n.data?.length===0&&c===null&&(0,I.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No workspaces yet.`}),(0,I.jsx)(`div`,{className:`flex flex-col gap-3`,children:n.data&&x.map(r=>{let i=r??`Local`,o=n.data.filter(e=>be(e.location)===r),s=r!==null&&a.isSuccess?xe(r,b):null;return(0,I.jsxs)(`section`,{"aria-label":`Machine ${i}`,className:`flex flex-col gap-1`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,I.jsxs)(`h3`,{className:`flex min-w-0 flex-1 items-center gap-1.5 px-1 text-xs font-semibold`,children:[r===null?(0,I.jsx)(E,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground`}):(0,I.jsx)(A,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,I.jsx)(`span`,{className:`truncate`,children:i}),s&&(0,I.jsx)(`span`,{className:`ml-1.5 font-normal text-destructive`,children:s})]}),(0,I.jsxs)(d,{size:`xs`,variant:`outline`,"aria-label":`Add workspace on ${i}`,title:`Add a workspace on this machine`,"aria-haspopup":`dialog`,"aria-expanded":c!==null&&c.machine===r,onClick:e=>{f.current=e.currentTarget,l({machine:r})},children:[(0,I.jsx)(O,{}),`Add`]})]}),o.length>0&&(0,I.jsx)(`ul`,{className:`flex flex-col gap-1`,children:o.map(n=>(0,I.jsx)(Ee,{workspace:n,selected:n.id===e,onSelect:t},n.id))})]},i)})}),c&&(0,I.jsx)(Le,{machine:c.machine,onCreated:e=>{m(),t(e.id)},onClose:m})]})}function Ee({workspace:e,selected:t,onSelect:n}){let r=l(),[a,o]=(0,F.useState)(!1);return(0,I.jsxs)(`li`,{className:`flex flex-col gap-1`,children:[(0,I.jsxs)(`div`,{className:i(`group flex items-center rounded-lg hover:bg-sidebar-accent`,t&&`bg-sidebar-accent`),children:[(0,I.jsxs)(`button`,{type:`button`,"aria-current":t?`true`:void 0,onClick:()=>n(e.id),className:`flex min-w-0 flex-1 flex-col px-2.5 py-1.5 text-left`,children:[(0,I.jsx)(`span`,{className:`truncate text-sm font-medium`,children:e.name}),(0,I.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,title:X(e.location),children:B(e.location.path)}),(0,I.jsx)(ye,{workspace:e}),e.pathProblem&&(0,I.jsx)(ve,{problem:e.pathProblem})]}),!a&&(0,I.jsx)(d,{size:`icon-xs`,variant:`ghost`,"aria-label":`Remove ${e.name}`,title:`Remove the workspace and its tasks from Toodo`,className:`mr-1 shrink-0 opacity-0 group-hover:opacity-100 hover:text-destructive focus-visible:opacity-100 [@media(hover:none)]:opacity-100`,onClick:()=>{r.reset(),o(!0)},children:(0,I.jsx)(P,{})})]}),a&&(0,I.jsxs)(`div`,{role:`group`,"aria-label":`Remove ${e.name}`,className:`flex flex-col gap-1.5 rounded-lg border p-2`,onKeyDown:e=>{e.key===`Escape`&&!r.isPending&&(e.preventDefault(),o(!1))},children:[(0,I.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Remove `,e.name,` and its tasks from Toodo? The repository, worktrees, and herdr workspaces are kept.`]}),r.isError&&(0,I.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:r.error.message}),(0,I.jsxs)(`div`,{className:`flex gap-1`,children:[(0,I.jsx)(d,{changesData:!0,size:`xs`,variant:`destructive`,"aria-label":`Confirm remove ${e.name}`,disabled:r.isPending,onClick:()=>r.mutate(e.id),children:r.isPending?`Removing...`:`Remove`}),(0,I.jsx)(d,{size:`xs`,variant:`ghost`,autoFocus:!0,onClick:()=>o(!1),children:`Back`})]})]})]})}function Q(e,t=!1){return n=>{n.key===`Escape`&&!t&&!n.defaultPrevented&&(n.preventDefault(),e())}}function De({workspace:e,onClose:t}){let n=c(),r=u(),i=o(),[a,s]=(0,F.useState)(be(e.location)),[l,f]=(0,F.useState)(e.location.path),p=[...new Set([...(r.data??[]).map(e=>e.target),...(i.data??[]).flatMap(e=>e.location.kind===`ssh`?[e.location.machine]:[])])],m=te(l.trim());function h(r){r.preventDefault();let i=a===null?{kind:`local`,path:m}:{kind:`ssh`,machine:a,path:m};n.mutate({id:e.id,location:i},{onSuccess:t})}return(0,I.jsxs)(`form`,{onSubmit:h,"aria-label":`Move ${e.name}`,className:`flex flex-col gap-2 rounded-lg border p-2`,onKeyDown:Q(t,n.isPending),children:[(0,I.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Point the workspace at the same repository on another machine or in another folder. Its tasks stay. A repository on a Windows host takes a Windows path such as D:\\dev\\repo.`}),(0,I.jsx)(Z,{label:`Machine`,children:({id:e})=>(0,I.jsxs)(`select`,{id:e,className:J,value:a??``,onChange:e=>s(e.target.value===``?null:e.target.value),autoFocus:!0,children:[(0,I.jsx)(`option`,{value:``,children:`Local (this server)`}),p.map(e=>(0,I.jsx)(`option`,{value:e,children:e},e))]})}),(0,I.jsx)(Z,{label:`Folder`,help:`The repository's own folder on that machine.`,children:({id:e,describedBy:t})=>(0,I.jsx)(ne,{id:e,machine:a===null?{kind:`local`}:{kind:`ssh`,label:a},className:J,describedBy:t,value:l,onChange:f,required:!0})}),n.isError&&(0,I.jsx)(`p`,{role:`alert`,className:`text-xs break-words text-destructive`,children:n.error.message}),(0,I.jsxs)(`div`,{className:`flex gap-1`,children:[(0,I.jsx)(d,{type:`submit`,size:`sm`,disabled:n.isPending||m===``,children:n.isPending?`Moving...`:`Move workspace`}),(0,I.jsx)(d,{type:`button`,size:`sm`,variant:`ghost`,disabled:n.isPending,onClick:t,children:`Cancel`})]})]})}function Oe({herdrMissing:e,onClose:t}){let[n,r]=(0,F.useState)(null),[i,a]=(0,F.useState)(``),o=m(),s=(0,F.useId)(),c=`herdr machine add ${i.trim()||`<host>`}`;function l(e){e.preventDefault(),i.trim()!==``&&o.mutate(i.trim())}async function u(){try{await navigator.clipboard.writeText(c),r(`Copied the command.`)}catch(e){r(`Could not copy: ${String(e)}`)}}return(0,I.jsxs)(`section`,{"aria-label":`Add machine`,className:`flex flex-col gap-2 rounded-lg border p-2`,onKeyDown:Q(t),children:[(0,I.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e&&`Install herdr on the server first; SSH machines need it. `,`Enter an SSH host from the server's ~/.ssh/config and test the connection. herdr asks questions in a terminal, which the Toodo server cannot open, so then run the command below in a terminal on the server and reload the machine list here.`]}),(0,I.jsxs)(`form`,{"aria-label":`Test SSH connection`,className:`flex flex-col gap-1`,onSubmit:l,children:[(0,I.jsx)(`label`,{htmlFor:s,className:`text-xs font-medium`,children:`SSH host`}),(0,I.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,I.jsx)(`input`,{id:s,className:J,value:i,placeholder:`devbox`,autoComplete:`off`,spellCheck:!1,onChange:e=>{a(e.target.value),o.reset()}}),(0,I.jsx)(d,{type:`submit`,size:`sm`,variant:`outline`,disabled:i.trim()===``||o.isPending,children:o.isPending?`Testing...`:`Test connection`})]})]}),o.isError&&(0,I.jsxs)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:[`Could not test the connection: `,o.error.message]}),o.data?.problem&&(0,I.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:o.data.problem}),o.data?.gitVersion&&(0,I.jsxs)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:[`Connected to `,o.variables,` without a prompt and found `,o.data.gitVersion,`. Run the command below to save it in herdr.`]}),(0,I.jsxs)(`div`,{className:`flex flex-col items-start gap-1`,children:[(0,I.jsx)(`code`,{className:`max-w-full rounded bg-muted px-1.5 py-1 text-xs`,"aria-label":`Add machine command`,children:c}),(0,I.jsx)(d,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>void u(),children:`Copy command`})]}),n&&(0,I.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:n})]})}var ke=[`Source`,`Completion`,`Runner`,`Details`],Ae={none:`A folder without git. Tasks get no branch, worktree, or pull request.`,local_git:`A git repository without GitHub. Task branches merge locally.`,github:`A git repository with a GitHub origin. Tasks ship as pull requests.`},je={open:`The folder already holds the repository.`,init:`Make a folder a new git repository without a remote.`,clone:`Clone a repository URL into a new folder.`},Me={manual:`When its criteria are met; nothing is merged.`,local_merge:`Once its branch is merged into the base branch locally.`,pr_merge:`Once its pull request is merged into the base branch.`},Ne=`https://github.com/dev-bokdong/toodo/blob/main/docs/runners.md`,Pe={herdr:`Opens agents in herdr on a worktree and branch of the task.`,plain:`Runs Claude or Codex in the background in a worktree and branch of the task, without herdr.`,tmux:`Runs Claude or Codex in a tmux session in a worktree and branch of the task, without herdr.`,none:`Only marks the task in progress.`};function Fe(e){return e?`herdr is not running on this server; start it there before starting tasks, or choose ${K.plain}.`:`herdr is not running on this server since it is not installed there; install and start herdr before starting tasks, or choose ${K.plain}.`}var Ie={clone:{submit:`Clone workspace`,pending:`Cloning...`},open:{submit:`Open workspace`,pending:`Opening...`},init:{submit:`Init workspace`,pending:`Initializing...`},none:{submit:`Add workspace`,pending:`Adding...`}};function $({legend:e,value:t,choices:n,onChange:r,autoFocus:a=!1}){let o=(0,F.useId)();return(0,I.jsxs)(`fieldset`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,I.jsx)(`legend`,{className:`mb-1.5 text-sm font-medium`,children:e}),n.map(e=>{let n=e.value===t,s=e.problem!==null,c=s?null:e.note??null,l=`${o}-${e.value}`;return(0,I.jsxs)(`label`,{className:i(`flex items-start gap-2.5 rounded-lg border px-3 py-2 transition-colors has-focus-visible:border-ring has-focus-visible:ring-3 has-focus-visible:ring-ring/50`,s?`cursor-not-allowed border-dashed`:`cursor-pointer hover:bg-muted`,n&&`border-ring bg-secondary hover:bg-secondary`),children:[(0,I.jsx)(`input`,{type:`radio`,name:o,value:e.value,checked:n,disabled:s,autoFocus:a&&n,"aria-labelledby":l,"aria-describedby":c===null?`${l}-about`:`${l}-about ${l}-note`,onChange:()=>!s&&r(e.value),className:`mt-0.5 size-4 shrink-0 accent-primary`}),(0,I.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,I.jsx)(`span`,{id:l,className:i(`text-sm font-medium`,s&&`text-muted-foreground`),children:e.label}),(0,I.jsxs)(`span`,{id:`${l}-about`,className:`flex items-start gap-1 text-xs text-muted-foreground`,children:[s&&(0,I.jsx)(b,{"aria-hidden":!0,className:`mt-0.5 size-3 shrink-0`}),e.problem??e.description]}),c!==null&&(0,I.jsxs)(`span`,{id:`${l}-note`,className:i(`flex items-start gap-1 text-xs`,f.attention),children:[(0,I.jsx)(M,{"aria-hidden":!0,className:`mt-0.5 size-3 shrink-0`}),c]})]})]},e.value)})]})}function Le({machine:e,onCreated:t,onClose:n}){let r=a(),o=(0,F.useRef)(null),c=(0,F.useId)(),[l,u]=(0,F.useState)(0),[f,m]=(0,F.useState)({source:`github`,repository:null,completion:null,runner:null}),[h,g]=(0,F.useState)(``),[_,v]=(0,F.useState)(null),[y,b]=(0,F.useState)(null),[x,C]=(0,F.useState)(``),T=e??`Local`,E=e===null?{kind:`local`}:{kind:`ssh`,label:e},D=p().data?.herdr,O=e===null&&D!==void 0&&!D.running?Fe(D.installed):null,k=O!==null,A=me(f,k),j=A.repository===`clone`,M=s(E).data,N=M===void 0?``:j?M:Se(M),L=_??N,R=!j&&_===null,z=y??(j?we(h):R?``:Ce(L)),B=j&&L.trim()&&z.trim()?H(L.trim(),z.trim()):te(L.trim()),V=l===ke.length-1,U=r.isPending,q=Ie[A.repository??`none`],ce=[W[A.source],G[A.completion],K[A.runner],T],le=j?void 0:A.source===`none`?`The folder the tasks are about. Toodo runs no git or herdr there.`:`The repository's own folder.`;function J(e){let t=he(f,e,k);me(t,k).repository===`clone`!==j&&v(null),m(t)}function Y(e){u(e)}function X(){U||n()}function ge(n){if(n.preventDefault(),!V){Y(l+1);return}let i={name:z,location:e===null?{kind:`local`,path:B}:{kind:`ssh`,machine:e,path:B},repository:A.repository===null?null:A.repository===`clone`?{kind:`clone`,url:h}:{kind:A.repository},source:A.source,completion:A.completion,runner:A.runner,defaultBaseBranch:A.source===`none`?null:x.trim()||null};r.mutate(i,{onSuccess:t})}return(0,I.jsxs)(`div`,{className:`fixed inset-0 z-50`,children:[(0,I.jsx)(`div`,{"aria-hidden":!0,className:`absolute inset-0 bg-black/40 max-md:hidden`,onClick:X}),(0,I.jsx)(`div`,{ref:o,role:`dialog`,"aria-modal":!0,"aria-labelledby":c,onKeyDown:e=>{e.key===`Tab`?ee(o.current,e.nativeEvent):Q(n,U)(e)},className:i(`relative flex flex-col overflow-hidden bg-background text-foreground`,`max-md:h-full max-md:pt-[env(safe-area-inset-top)] max-md:pb-[env(safe-area-inset-bottom)]`,`md:absolute md:top-1/2 md:left-1/2 md:h-[min(40rem,calc(100dvh-4rem))] md:w-[min(36rem,calc(100vw-4rem))] md:-translate-x-1/2 md:-translate-y-1/2 md:rounded-2xl md:border md:shadow-xl`),children:(0,I.jsxs)(`form`,{onSubmit:ge,className:`flex min-h-0 flex-1 flex-col`,children:[(0,I.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 px-4 pt-3 pb-2 md:px-6 md:pt-4`,children:[(0,I.jsxs)(`h2`,{id:c,className:`min-w-0 flex-1 truncate text-base font-semibold`,children:[`New workspace on `,T]}),(0,I.jsx)(d,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Close new workspace`,title:`Close (Esc)`,disabled:U,onClick:X,children:(0,I.jsx)(P,{})})]}),(0,I.jsx)(`ol`,{"aria-label":`Steps`,className:`grid shrink-0 grid-cols-2 gap-1 px-4 pb-3 md:grid-cols-4 md:px-6`,children:ke.map((e,t)=>{let n=t===l;return(0,I.jsx)(`li`,{className:`min-w-0`,children:(0,I.jsxs)(`button`,{type:`button`,"aria-current":n?`step`:void 0,disabled:U,onClick:()=>Y(t),className:i(`flex w-full min-w-0 items-center gap-2 rounded-lg px-2 py-1.5 text-left outline-none hover:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none`,n&&`bg-secondary hover:bg-secondary`),children:[(0,I.jsx)(`span`,{"aria-hidden":!0,className:i(`flex size-5 shrink-0 items-center justify-center rounded-full border text-xs font-medium`,n?`border-primary bg-primary text-primary-foreground`:`text-muted-foreground`),children:t+1}),(0,I.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,I.jsx)(`span`,{className:`text-xs font-medium`,children:e}),(0,I.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:ce[t]})]})]})},e)})}),(0,I.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto overscroll-contain border-t px-4 py-4 md:px-6`,children:[l===0&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)($,{legend:`What does the workspace folder hold?`,value:A.source,autoFocus:!0,choices:re.map(e=>({value:e,label:W[e],description:Ae[e],problem:null})),onChange:e=>J({source:e})}),A.source!==`none`&&(0,I.jsx)($,{legend:`How does the repository get there?`,value:A.repository,choices:oe.map(e=>({value:e,label:se[e],description:je[e],problem:pe(A.source,e)})),onChange:e=>J({repository:e})})]}),l===1&&(0,I.jsx)($,{legend:`When is a task done?`,value:A.completion,autoFocus:!0,choices:ie.map(e=>({value:e,label:G[e],description:Me[e],problem:ue(A.source,e)})),onChange:e=>J({completion:e})}),l===2&&(0,I.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,I.jsx)($,{legend:`What does starting a task do?`,value:A.runner,autoFocus:!0,choices:ae.map(t=>({value:t,label:K[t],description:Pe[t],note:t===`herdr`?O:null,problem:fe(t,{kind:e===null?`local`:`ssh`,path:B})??de(A.source,A.completion,t)})),onChange:e=>J({runner:e})}),(0,I.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Which one fits?`,` `,(0,I.jsx)(`a`,{href:Ne,target:`_blank`,rel:`noopener noreferrer`,className:`text-primary underline underline-offset-2 hover:no-underline`,children:`Compare the runners`})]})]}),V&&(0,I.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[j&&(0,I.jsx)(Z,{label:`Repository URL`,children:({id:e})=>(0,I.jsx)(`input`,{id:e,className:`h-8 w-full min-w-0 rounded-lg border border-input bg-background px-2.5 text-sm outline-none max-md:h-11 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50`,value:h,onChange:e=>g(e.target.value),required:!0,autoFocus:!0})}),(0,I.jsx)(Z,{label:j?`Parent folder`:`Folder`,help:le,children:({id:e,describedBy:t})=>(0,I.jsx)(ne,{id:e,machine:E,className:`h-8 w-full min-w-0 rounded-lg border border-input bg-background px-2.5 text-sm outline-none max-md:h-11 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50`,describedBy:t,value:L,onChange:v,required:!0,autoFocus:!j})}),(0,I.jsx)(Z,{label:`Name`,children:({id:e})=>(0,I.jsx)(`input`,{id:e,className:`h-8 w-full min-w-0 rounded-lg border border-input bg-background px-2.5 text-sm outline-none max-md:h-11 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50`,value:z,onChange:e=>b(e.target.value),required:!0})}),j&&L.trim()&&z.trim()&&(0,I.jsxs)(`p`,{className:`truncate text-xs text-muted-foreground`,title:B,children:[`Clones into `,B]}),A.repository===`init`&&(0,I.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`The folder is created if it does not exist and becomes a git repository without a remote.`}),A.source!==`none`&&(0,I.jsx)(Z,{label:`Base branch`,help:A.repository===`init`?`Uses main if empty.`:`Detected from the repository if empty.`,children:({id:e,describedBy:t})=>(0,I.jsx)(`input`,{id:e,className:`h-8 w-full min-w-0 rounded-lg border border-input bg-background px-2.5 text-sm outline-none max-md:h-11 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50`,"aria-describedby":t,value:x,onChange:e=>C(e.target.value)})}),r.isError&&(0,I.jsx)(`p`,{role:`alert`,className:`text-xs break-words text-destructive`,children:r.error.message})]})]}),(0,I.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-t px-4 py-3 md:px-6`,children:[l===0?(0,I.jsx)(d,{type:`button`,variant:`ghost`,disabled:U,onClick:X,children:`Cancel`}):(0,I.jsxs)(d,{type:`button`,variant:`ghost`,disabled:U,onClick:()=>Y(l-1),children:[(0,I.jsx)(w,{"data-icon":`inline-start`}),`Back`]}),(0,I.jsx)(d,{type:`submit`,className:`ml-auto`,changesData:V,disabled:U||V&&R,children:V?U?q.pending:q.submit:(0,I.jsxs)(I.Fragment,{children:[`Next`,(0,I.jsx)(S,{"data-icon":`inline-end`})]})})]})]})})]})}export{S as _,Y as a,J as c,B as d,ee as f,w as g,O as h,Te as i,ge as l,M as m,Le as n,X as o,P as p,ve as r,Q as s,De as t,R as u};