bb-app 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/dist/assets/AppSettingsView-DH1waGrt.js +1 -0
- package/app/dist/assets/{InternalReplayListView-BMzOdu0K.js → InternalReplayListView-DjsfJLJv.js} +1 -1
- package/app/dist/assets/{ProjectArchivedThreadsView-DzbW3kSk.js → ProjectArchivedThreadsView-Bj8oRQmq.js} +1 -1
- package/app/dist/assets/ProjectSettingsView-B5yhhmEc.js +1 -0
- package/app/dist/assets/ThreadDetailRoute-DKYxhL5B.js +2680 -0
- package/app/dist/assets/ThreadUnarchiveButton-CdRo7M97.js +1 -0
- package/app/dist/assets/{angular-html-CM7ZtmlE.js → angular-html-CoYv0XJY.js} +1 -1
- package/app/dist/assets/{angular-ts-B4aAwutb.js → angular-ts--oE0vL6J.js} +1 -1
- package/app/dist/assets/{apl-Db6aaGYX.js → apl-mu0Mp6u1.js} +1 -1
- package/app/dist/assets/{astro-CXkhV095.js → astro-DGoqbRGX.js} +1 -1
- package/app/dist/assets/{blade-CfLZY3kt.js → blade-DQujc1A5.js} +1 -1
- package/app/dist/assets/{c-CwV4mx9Z.js → c-2jbVFmuV.js} +1 -1
- package/app/dist/assets/{chunk-JZWAC4HX-CrzST-zS.js → chunk-JZWAC4HX-C_-VEW9Q.js} +1 -1
- package/app/dist/assets/{cobol-Bx9V6w-A.js → cobol-Dk2pgWM3.js} +1 -1
- package/app/dist/assets/{coffee-4vexivp2.js → coffee-6v78fbbf.js} +1 -1
- package/app/dist/assets/{cpp-B9JgHtmn.js → cpp-QzZpOrzC.js} +1 -1
- package/app/dist/assets/{crystal-CV6ainQY.js → crystal-CvexRWdz.js} +1 -1
- package/app/dist/assets/{css-BahFL25I.js → css-OM3bJ3_6.js} +1 -1
- package/app/dist/assets/dialog-BjpdbSmZ.js +1 -0
- package/app/dist/assets/{edge-Dbi7IqBU.js → edge-C3m71CuX.js} +1 -1
- package/app/dist/assets/effective-hosts-D-vDT9_r.js +68 -0
- package/app/dist/assets/{elixir-Bcybagr3.js → elixir-BhRXZTvD.js} +1 -1
- package/app/dist/assets/{elm-Cg7kNsW7.js → elm-DYE0yZFL.js} +1 -1
- package/app/dist/assets/{erb-CUdWoCwh.js → erb-SSD9uhMe.js} +1 -1
- package/app/dist/assets/{git-rebase-CebuXWOz.js → git-rebase-D0Fw5_xo.js} +1 -1
- package/app/dist/assets/{glimmer-js-DHD_iF4f.js → glimmer-js-Jn4VQcUP.js} +1 -1
- package/app/dist/assets/{glimmer-ts-x8YwQhtI.js → glimmer-ts-BNZNfWU-.js} +1 -1
- package/app/dist/assets/{glsl-DTvpjV5x.js → glsl-DGR2Z9QX.js} +1 -1
- package/app/dist/assets/{graphql-BABFRhpo.js → graphql-DQM3uC9O.js} +1 -1
- package/app/dist/assets/{hack-BTa_6UF4.js → hack-D9UfM1Cn.js} +1 -1
- package/app/dist/assets/{haml-DwZg9pb5.js → haml-BB_Vekn8.js} +1 -1
- package/app/dist/assets/{handlebars-Bkp0I46S.js → handlebars-Dttle2Wb.js} +1 -1
- package/app/dist/assets/{html-BrFG164I.js → html-Df_qp_V9.js} +1 -1
- package/app/dist/assets/{html-derivative-Dm50cCgO.js → html-derivative-rl3w8zDj.js} +1 -1
- package/app/dist/assets/{http-DHs85vmZ.js → http-CgnYHPQJ.js} +1 -1
- package/app/dist/assets/{hurl-Dh07B-Ro.js → hurl-CUdIfmn9.js} +1 -1
- package/app/dist/assets/index-CCJm8W3d.css +2 -0
- package/app/dist/assets/index-D2Ze5muL.js +1360 -0
- package/app/dist/assets/{java-CyElhBLV.js → java-CNjohX-o.js} +1 -1
- package/app/dist/assets/{javascript-Iw1B_HiK.js → javascript-Bmzu-1YP.js} +1 -1
- package/app/dist/assets/{jinja-CwNzTCBn.js → jinja-DXX545BW.js} +1 -1
- package/app/dist/assets/{jison-DmnCmBdi.js → jison-BFsONSRA.js} +1 -1
- package/app/dist/assets/{json-2cvnIy7t.js → json-D3Qqjr3g.js} +1 -1
- package/app/dist/assets/{jsx-CUP6THJt.js → jsx-tZzot0X9.js} +1 -1
- package/app/dist/assets/{julia-C5QkPIf6.js → julia-BwzvM27y.js} +1 -1
- package/app/dist/assets/{just-DKTy3QCk.js → just-6CfdIddw.js} +1 -1
- package/app/dist/assets/{latex-D6EezuXB.js → latex-DNTJjbTj.js} +1 -1
- package/app/dist/assets/{liquid-CIoyldIJ.js → liquid-DjUlzYiW.js} +1 -1
- package/app/dist/assets/localhost-badge-C8-uvmR_.js +22 -0
- package/app/dist/assets/{lua-DdZ7KAyq.js → lua-LZQVLoh_.js} +1 -1
- package/app/dist/assets/{marko-DzUNPeS3.js → marko-Dclxmh1h.js} +1 -1
- package/app/dist/assets/{mdc-D5459Kci.js → mdc-BpaMcHe8.js} +1 -1
- package/app/dist/assets/{mutation-cache-effects-DiCFYnTh.js → mutation-cache-effects-BAn11UmS.js} +1 -1
- package/app/dist/assets/{nginx-0z5C7Rx2.js → nginx-CYoL5nkY.js} +1 -1
- package/app/dist/assets/{nim-DqH405Ip.js → nim-CxULhr2M.js} +1 -1
- package/app/dist/assets/page-shell-BYLrlYTH.js +39 -0
- package/app/dist/assets/{perl-DFMDl6Q7.js → perl-5LAV6neX.js} +1 -1
- package/app/dist/assets/{php-CnLHesuB.js → php-D8BcRHFY.js} +1 -1
- package/app/dist/assets/{pill-BNIxU09I.js → pill-C-0inATv.js} +1 -1
- package/app/dist/assets/{pug-Bd_9REL_.js → pug-C9t1Hjhu.js} +1 -1
- package/app/dist/assets/{qml-Lr6hdC-5.js → qml-DGkLNN9v.js} +1 -1
- package/app/dist/assets/{r-Ce3-ySeQ.js → r-CeMfeXpy.js} +1 -1
- package/app/dist/assets/{razor-FG0QpIgS.js → razor-DRG-JA5B.js} +1 -1
- package/app/dist/assets/{regexp-CIUvMYKc.js → regexp-C6eJQVWV.js} +1 -1
- package/app/dist/assets/{rst-Dz7v6x4B.js → rst-_TSRDHac.js} +1 -1
- package/app/dist/assets/{ruby-C-FBX9Yb.js → ruby-dQqgg9kc.js} +1 -1
- package/app/dist/assets/{sas-C9h-w7MI.js → sas-C4F5TLRE.js} +1 -1
- package/app/dist/assets/{scss-D6OzIOrm.js → scss-CmYsLoFC.js} +1 -1
- package/app/dist/assets/{settings-section-BKzVpY8V.js → settings-section-DrGaArro.js} +1 -1
- package/app/dist/assets/{shellscript-D87RcbyJ.js → shellscript-WXnX1Mec.js} +1 -1
- package/app/dist/assets/{shellsession-TIQjKTe8.js → shellsession-Bn3Xgpma.js} +1 -1
- package/app/dist/assets/{soy-B-dmhoWy.js → soy-c3pX5x_S.js} +1 -1
- package/app/dist/assets/split-button-BVu8nD9J.js +1 -0
- package/app/dist/assets/{sql-CbBIAEKN.js → sql-D6zVwCTB.js} +1 -1
- package/app/dist/assets/{stata-BQ_FGGIg.js → stata-CVENOXDm.js} +1 -1
- package/app/dist/assets/{surrealql-B5__VBgQ.js → surrealql-BT_Ybe_U.js} +1 -1
- package/app/dist/assets/{svelte-CgBSZjLG.js → svelte-C_ktJHww.js} +1 -1
- package/app/dist/assets/{templ-_lWYjbQF.js → templ-BWI48nlj.js} +1 -1
- package/app/dist/assets/{tex-BYUs5HV3.js → tex-BCbKiW8N.js} +1 -1
- package/app/dist/assets/thread-queries-VdTjp5RH.js +1 -0
- package/app/dist/assets/{ts-tags-hjuJ4isf.js → ts-tags--q5Co27x.js} +1 -1
- package/app/dist/assets/{tsx-DlvScFgB.js → tsx-D9Tu2qDP.js} +1 -1
- package/app/dist/assets/{twig-DgkARV1o.js → twig-0tBvYCLy.js} +1 -1
- package/app/dist/assets/{typescript-BE5MgbU9.js → typescript-usoJ9tbx.js} +1 -1
- package/app/dist/assets/{vue-C6mGC-Xh.js → vue-BQb85j8g.js} +1 -1
- package/app/dist/assets/{vue-html-BcBAJPrV.js → vue-html-gWLUM0tZ.js} +1 -1
- package/app/dist/assets/{vue-vine-DsdYqYVB.js → vue-vine-B47td4pS.js} +1 -1
- package/app/dist/assets/{xml-CMIrlqCw.js → xml-BHrSCP44.js} +1 -1
- package/app/dist/assets/{xsl-BL_g6M4v.js → xsl-D48ooQoQ.js} +1 -1
- package/app/dist/assets/{yaml-D4rIwiAS.js → yaml-DyYbpBBV.js} +1 -1
- package/app/dist/index.html +9 -9
- package/dist/bb-app.js +19 -1
- package/dist/bb-host-daemon.js +16 -1
- package/dist/bb-server.js +16 -1
- package/dist/bb.js +16 -1
- package/host-daemon/dist/bb +226 -81
- package/host-daemon/dist/bb-claude-code-bridge.mjs +35 -35
- package/host-daemon/dist/daemon-bundle.mjs +389 -386
- package/package.json +1 -1
- package/server/dist/drizzle/0003_thread_dynamic_context_file_states.sql +12 -0
- package/server/dist/drizzle/meta/0003_snapshot.json +3178 -0
- package/server/dist/drizzle/meta/_journal.json +7 -0
- package/server/dist/index.js +13190 -8111
- package/app/dist/assets/AppSettingsView-Dmjbm_4y.js +0 -1
- package/app/dist/assets/ProjectSettingsView-BCVVMJFB.js +0 -1
- package/app/dist/assets/ThreadDetailRoute-BI3VVE99.js +0 -2535
- package/app/dist/assets/ThreadUnarchiveButton-BJStGY8f.js +0 -1
- package/app/dist/assets/dialog-sqh89xvD.js +0 -1
- package/app/dist/assets/effective-hosts-Dc1pzW51.js +0 -68
- package/app/dist/assets/index-8oyVoqEg.js +0 -1360
- package/app/dist/assets/index-Cdqw3W2G.css +0 -2
- package/app/dist/assets/localhost-badge-DMyU8aEl.js +0 -22
- package/app/dist/assets/page-shell-DBPkwDcw.js +0 -39
- package/app/dist/assets/split-button-DqIwadhH.js +0 -1
- package/app/dist/assets/thread-queries-BX-3vM7I.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{$i as e,At as t,Bt as n,Ci as r,Ft as i,In as a,Kn as o,Nt as s,ci as c,li as l,qi as u,t as d,ti as f,ui as p,wi as m}from"./page-shell-DBPkwDcw.js";import{c as h,d as g,i as _,n as v,o as y,xt as b}from"./effective-hosts-Dc1pzW51.js";import{a as x,g as S,i as C,o as w,r as T,s as E,t as D}from"./dialog-sqh89xvD.js";import{Ht as O,Vt as k,Zt as ee,in as A,rn as j,zt as M}from"./index-8oyVoqEg.js";import{i as N,n as P,r as F,t as I}from"./settings-section-BKzVpY8V.js";var L=e(u(),1),R=`size-2 shrink-0 rounded-full ring-1 ring-inset transition-all bg-success ring-success/25 shadow-[0_0_0_4px_color-mix(in_oklch,var(--color-success)_16%,transparent)]`,z=m();function B({target:e,pending:t,onOpenChange:n,onDelete:r}){return(0,z.jsx)(D,{open:e!==null,onOpenChange:n,children:(0,z.jsx)(T,{children:e?(0,z.jsx)(V,{target:e,pending:t,onDelete:r}):null})})}function V({target:e,pending:t,onDelete:n}){return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(w,{children:[(0,z.jsx)(E,{children:`Remove host?`}),(0,z.jsx)(C,{children:`Remove "${e.name}" and all of its project sources? This cannot be undone.`})]}),(0,z.jsx)(x,{children:(0,z.jsx)(f,{type:`button`,variant:`destructive`,disabled:t,onClick:()=>n(e.id),children:`Remove host`})})]})}function H({target:e,pending:t,onOpenChange:n,onRename:r}){return(0,z.jsx)(D,{open:e!==null,onOpenChange:n,children:(0,z.jsx)(T,{children:e?(0,z.jsx)(U,{target:e,pending:t,onRename:r},e.id):null})})}function U({target:e,pending:t,onRename:n}){let r=(0,L.useId)(),[i,a]=(0,L.useState)(e.currentName),[o,s]=(0,L.useState)(null);return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(w,{children:[(0,z.jsx)(E,{children:`Rename host`}),(0,z.jsx)(C,{children:`Choose a new name for this host.`})]}),(0,z.jsxs)(`form`,{className:`space-y-4`,onSubmit:r=>{if(r.preventDefault(),t)return;let a=i.trim();if(!a){s(`Host name cannot be empty.`);return}n(e.id,a)},children:[(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(S,{id:r,"aria-label":`Host name`,value:i,autoFocus:!0,disabled:t,onChange:e=>{a(e.target.value),o&&s(null)}}),o?(0,z.jsx)(`p`,{className:`text-sm text-destructive`,children:o}):null]}),(0,z.jsx)(x,{children:(0,z.jsx)(f,{type:`submit`,disabled:t,children:`Rename host`})})]})]})}function W({open:e,onOpenChange:t}){return(0,z.jsx)(D,{open:e,onOpenChange:t,children:(0,z.jsx)(T,{className:`sm:max-w-2xl`,children:(0,z.jsx)(G,{})})})}function G(){return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(w,{children:[(0,z.jsx)(E,{children:`Unable to add new host`}),(0,z.jsx)(C,{children:`You need to specify the URL that allows the new host to talk to the server.`})]}),(0,z.jsxs)(`div`,{className:`min-w-0 space-y-2 text-sm text-foreground`,children:[(0,z.jsx)(`p`,{children:`Run this on the server machine, then restart bb:`}),(0,z.jsx)(`pre`,{className:`min-w-0 overflow-x-auto rounded-md border border-border bg-surface-recessed px-3 py-2 font-mono text-xs leading-5`,children:(0,z.jsx)(`code`,{children:`npx bb-app config BB_APP_URL http://<your-machine>.<tailnet>.ts.net:38886`})})]})]})}function K(e){return new Date(e).toLocaleTimeString(void 0,{hour:`numeric`,minute:`2-digit`})}function q({host:e,open:t,target:n,onOpenChange:r}){let i=t&&n!==null;return(0,z.jsx)(D,{open:i,onOpenChange:r,children:(0,z.jsx)(T,{className:`sm:max-w-2xl`,children:i&&n?(0,z.jsx)(J,{host:e,target:n}):null})})}function J({host:e,target:t}){let[n,r]=(0,L.useState)(()=>t.expiresAt<=Date.now()),i=e?.status===`connected`,a=!i&&!n,o=i?`Host connected`:n?`Join command expired`:`Waiting for host`;return(0,L.useEffect)(()=>{let e=t.expiresAt-Date.now();if(e<=0){r(!0);return}r(!1);let n=window.setTimeout(()=>r(!0),e);return()=>window.clearTimeout(n)},[t.expiresAt]),(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(w,{children:[(0,z.jsx)(E,{children:`New host`}),(0,z.jsx)(C,{children:`Run this command from the new host.`})]}),(0,z.jsxs)(`div`,{className:`min-w-0 space-y-3`,children:[(0,z.jsxs)(`div`,{className:`relative min-w-0 rounded-md border border-border bg-surface-recessed`,children:[(0,z.jsx)(`pre`,{className:`max-h-56 min-w-0 overflow-y-auto whitespace-pre-wrap break-all px-3 py-2.5 pr-10 text-xs leading-5`,children:(0,z.jsx)(`code`,{children:t.joinCommand})}),(0,z.jsx)(O,{text:t.joinCommand,label:`Copy host command`,className:`absolute right-2 top-2`})]}),(0,z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-xs text-muted-foreground`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,children:[i?(0,z.jsx)(c,{name:`CircleCheck`,className:`size-4 text-success`,"aria-hidden":`true`}):n?(0,z.jsx)(c,{name:`AlertCircle`,className:`size-4 text-destructive`,"aria-hidden":`true`}):null,(0,z.jsx)(`span`,{className:a?`animate-shine font-medium`:`font-medium text-foreground`,children:o}),a?(0,z.jsxs)(`span`,{children:[`· Expires at `,K(t.expiresAt)]}):null]})]})]})}var Y=[{label:`System`,value:`system`},{label:`Light`,value:`light`},{label:`Dark`,value:`dark`}],X={dark:`Dark`,light:`Light`,system:`System`};function Z(){let e=k(),{data:u=[],isLoading:m}=v(),x=r(),[S,C]=(0,L.useState)(null),[w,T]=(0,L.useState)(null),[E,D]=(0,L.useState)(null),[O,V]=(0,L.useState)(!1),[U,G]=(0,L.useState)(!1),K=p({meta:{errorMessage:`Failed to rename host.`},mutationFn:({id:e,name:t})=>a(e,{name:t}),onSuccess:()=>{j({queryClient:x}),C(null)}}),J=p({meta:{errorMessage:`Failed to remove host.`},mutationFn:({id:e})=>n(e),onSuccess:()=>{A({queryClient:x}),T(null)}}),Z=p({meta:{errorMessage:`Failed to create host join command.`,showErrorToast:!1},mutationFn:()=>i(),onSuccess:e=>{j({queryClient:x}),D(e),V(!0)},onError:e=>{if(e instanceof t&&e.code===`app_url_required`){G(!0);return}ee({error:e,fallbackMessage:`Failed to create host join command.`})}}),Q=p({meta:{errorMessage:`Failed to cancel host join.`},mutationFn:({id:e})=>s(e),onSuccess:(e,t)=>{j({queryClient:x}),D(e=>e?.hostId===t.id?null:e),V(!1)}}),$=E===null?null:u.find(e=>e.id===E.hostId)??null,te=Z.isPending||Q.isPending;async function ne(){if(E!==null&&E.expiresAt>Date.now()&&$?.status!==`connected`){V(!0);return}if(E!==null&&$?.status!==`connected`)try{await Q.mutateAsync({id:E.hostId})}catch{return}Z.mutate()}(0,L.useEffect)(()=>{if(!O||$?.status!==`connected`)return;let e=window.setTimeout(()=>{D(null),V(!1)},1500);return()=>window.clearTimeout(e)},[O,$?.status]);function re(e){if(e){V(!0);return}E!==null&&$?.status!==`connected`&&Q.mutate({id:E.hostId}),D(null),V(!1)}return(0,z.jsxs)(d,{contentClassName:`pt-4 md:pt-5`,children:[(0,z.jsxs)(`div`,{className:`mx-auto w-full max-w-3xl space-y-6`,children:[(0,z.jsx)(F,{title:`Appearance`,children:(0,z.jsx)(N,{label:`Theme`,children:(0,z.jsxs)(_,{children:[(0,z.jsx)(g,{asChild:!0,children:(0,z.jsxs)(f,{variant:`outline`,size:`sm`,className:`w-full justify-between sm:w-48`,"aria-label":`Theme`,children:[X[e],(0,z.jsx)(c,{name:`ChevronDown`,className:`size-3.5 text-muted-foreground`})]})}),(0,z.jsx)(y,{align:`end`,className:`w-48`,children:Y.map(t=>(0,z.jsxs)(h,{onSelect:()=>M(t.value),children:[t.label,(0,z.jsx)(c,{name:`Check`,className:l(`ml-auto`,e!==t.value&&`opacity-0`,b)})]},t.value))})]})})}),(0,z.jsx)(F,{title:`Hosts`,action:(0,z.jsxs)(f,{type:`button`,size:`sm`,variant:`ghost`,disabled:te,onClick:()=>{ne()},children:[(0,z.jsx)(c,{name:`Plus`,className:`size-3.5`}),`New host`]}),children:m?(0,z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading…`}):u.length===0?(0,z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No registered hosts.`}):(0,z.jsx)(P,{children:u.map(e=>{let t=e.status===`connected`;return(0,z.jsxs)(I,{children:[(0,z.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[e.name,(0,z.jsx)(`span`,{className:`ml-1.5 text-xs text-muted-foreground`,children:e.id})]}),t?(0,z.jsx)(`span`,{className:R,title:`Connected`}):e.lastSeenAt===null?(0,z.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:`Never connected`}):(0,z.jsxs)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:[`Offline · `,o(e.lastSeenAt)]}),(0,z.jsxs)(_,{children:[(0,z.jsx)(g,{asChild:!0,children:(0,z.jsx)(f,{variant:`ghost`,size:`icon`,className:`h-7 w-7 shrink-0`,"aria-label":`Host actions`,children:(0,z.jsx)(c,{name:`MoreHorizontal`,className:`size-4`})})}),(0,z.jsxs)(y,{align:`end`,className:`w-40`,children:[(0,z.jsx)(h,{onSelect:()=>C({id:e.id,currentName:e.name}),children:`Rename`}),(0,z.jsx)(h,{className:`text-destructive focus:text-destructive`,onSelect:()=>T({id:e.id,name:e.name}),children:`Remove`})]})]})]},e.id)})})})]}),(0,z.jsx)(H,{target:S,pending:K.isPending,onOpenChange:e=>{e||C(null)},onRename:(e,t)=>K.mutate({id:e,name:t})}),(0,z.jsx)(B,{target:w,pending:J.isPending,onOpenChange:e=>{e||T(null)},onDelete:e=>J.mutate({id:e})}),(0,z.jsx)(q,{open:O,target:E,host:$,onOpenChange:re}),(0,z.jsx)(W,{open:U,onOpenChange:G})]})}export{Z as AppSettingsView};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{$i as e,Ci as t,_r as n,ci as r,gr as i,qi as a,t as o,ti as s,ui as c,wi as l,wn as u}from"./page-shell-DBPkwDcw.js";import{c as d,d as f,i as p,n as m,o as h}from"./effective-hosts-Dc1pzW51.js";import{d as g}from"./chunk-JZWAC4HX-CrzST-zS.js";import{a as _,i as v,o as y,r as b,s as x,t as S}from"./dialog-sqh89xvD.js";import{D as C,E as w,d as T,r as E,s as D,t as O}from"./localhost-badge-DMyU8aEl.js";import{a as k}from"./mutation-cache-effects-DiCFYnTh.js";import{cn as A,ln as j,nn as M,tn as N}from"./index-8oyVoqEg.js";import{n as P,r as F,t as I}from"./settings-section-BKzVpY8V.js";import{t as L}from"./pill-BNIxU09I.js";var R=e(a(),1),z=l();function B({target:e,pending:t,onOpenChange:n,onDelete:r}){return(0,z.jsx)(S,{open:e!==null,onOpenChange:n,children:(0,z.jsx)(b,{children:e?(0,z.jsx)(V,{target:e,pending:t,onDelete:r}):null})})}function V({target:e,pending:t,onDelete:n}){return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(y,{children:[(0,z.jsx)(x,{children:`Remove source?`}),(0,z.jsx)(v,{children:`Remove "${e.label}" from this project? This cannot be undone.`})]}),(0,z.jsx)(_,{children:(0,z.jsx)(s,{type:`button`,variant:`destructive`,disabled:t,onClick:()=>n(e.id),children:`Remove source`})})]})}function H({source:e,isLocalhostSource:t,isLocalPathInvalid:n,hostName:i,isEditPending:a,isOnlySource:o,onEditLocalPath:c,onRemove:l}){return(0,z.jsxs)(I,{children:[(0,z.jsx)(r,{name:E,className:`size-4 shrink-0 text-muted-foreground`}),(0,z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,z.jsx)(`span`,{className:`min-w-0 flex-shrink truncate`,children:e.path}),(0,z.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:i}),t?(0,z.jsx)(`span`,{className:`self-center`,children:(0,z.jsx)(O,{})}):null,n?(0,z.jsx)(L,{variant:`destructive`,children:`Invalid local path`}):null]}),(0,z.jsxs)(p,{children:[(0,z.jsx)(f,{asChild:!0,children:(0,z.jsx)(s,{variant:`ghost`,size:`icon`,className:`h-7 w-7 shrink-0`,"aria-label":`Source actions`,children:(0,z.jsx)(r,{name:`MoreHorizontal`,className:`size-4`})})}),(0,z.jsxs)(h,{align:`end`,className:`w-40`,children:[t?(0,z.jsx)(d,{disabled:a,onSelect:t=>{t.preventDefault(),c(e)},children:`Edit local path`}):null,(0,z.jsx)(d,{className:`text-destructive focus:text-destructive`,disabled:o,onSelect:()=>l(e),children:`Remove`})]})]})]})}function U(e,t){return t.get(e.hostId)??e.hostId}function W(){let{projectId:e}=g(),r=C(),a=w({enabled:r.isSuccess||r.isError}),l=a.data,d=r.isFetching||a.isLoading,{data:f=[]}=m(),p=t(),[h,_]=(0,R.useState)(null),v=c({meta:{errorMessage:`Failed to remove source.`},mutationFn:({sourceId:t})=>e?u(e,t):Promise.resolve(),onSuccess:()=>{k({projectId:e,queryClient:p}),_(null)}}),y=D(),b=T(),x=l?.find(t=>t.id===e),S=x?.sources,E=(0,R.useMemo)(()=>S??[],[S]),O=(0,R.useMemo)(()=>new Map(f.map(e=>[e.id,e.name])),[f]),I=x?.name??``,L=y.isPending||b.isPending,V=M({isPending:L,submit:(0,R.useCallback)(({path:t,hostId:r,target:i,closeDialog:a})=>{if(e){if(i.kind===`add-source`)y.mutate({projectId:e,path:t,hostId:r},{onSuccess:a});else if(i.kind===`update`){let i=E.find(e=>n(e)&&e.hostId===r);if(!i)return;b.mutate({projectId:e,sourceId:i.id,path:t},{onSuccess:a})}}},[y,e,E,b])}),W=(0,R.useCallback)(()=>{e&&V.openPicker({kind:`add-source`,projectId:e,projectName:I})},[V,e,I]),G=(0,R.useCallback)(t=>{e&&V.openPicker({kind:`update`,projectId:e,projectName:I,currentPath:t.path})},[V,e,I]),K=V.localHostId,q=j((0,R.useMemo)(()=>K?E.filter(e=>n(e)&&e.hostId===K).map(e=>e.path):[],[K,E])),J=K!=null&&!i(E,K)?(0,z.jsx)(`div`,{className:`mt-2 flex gap-2`,children:(0,z.jsx)(s,{size:`sm`,variant:`outline`,disabled:y.isPending,onClick:W,children:`Add local path`})}):null;return(0,z.jsxs)(o,{contentClassName:`pt-4 md:pt-5`,children:[(0,z.jsx)(`div`,{className:`mx-auto w-full max-w-3xl space-y-6`,children:(0,z.jsx)(F,{title:`Project Sources`,children:d?(0,z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading…`}):E.length===0?(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No sources configured.`}),J]}):(0,z.jsxs)(`div`,{children:[(0,z.jsx)(P,{children:E.map(e=>{let t=n(e)&&K!=null&&e.hostId===K;return(0,z.jsx)(H,{source:e,isLocalhostSource:t,isLocalPathInvalid:t&&A(q,e.path),hostName:n(e)?O.get(e.hostId)??e.hostId:``,isEditPending:L,isOnlySource:E.length<=1,onEditLocalPath:G,onRemove:e=>_({id:e.id,label:U(e,O)})},e.id)})}),J]})})}),(0,z.jsx)(N,{target:V.projectPathDialog.target,pending:L,platform:V.platform,onOpenChange:V.projectPathDialog.onOpenChange,onSubmit:V.submitProjectPath}),(0,z.jsx)(B,{target:h,pending:v.isPending,onOpenChange:e=>{e||_(null)},onDelete:e=>v.mutate({sourceId:e})})]})}export{W as ProjectSettingsView};
|