bb-app 0.0.8 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/app/dist/assets/{AppSettingsView-6Zzy6BfL.js → AppSettingsView-3xuBYGm-.js} +1 -1
  2. package/app/dist/assets/InternalReplayListView-D4BuZuhX.js +1 -0
  3. package/app/dist/assets/{ProjectArchivedThreadsView-65_OMZ83.js → ProjectArchivedThreadsView-CQ79aEPs.js} +1 -1
  4. package/app/dist/assets/ProjectSettingsView-D0t1s9Kc.js +1 -0
  5. package/app/dist/assets/ThreadDetailRoute-S7gHiq2R.js +2871 -0
  6. package/app/dist/assets/ThreadUnarchiveButton-ae8m78ng.js +1 -0
  7. package/app/dist/assets/{angular-html-BnZNhOVu.js → angular-html-CsQHuPoy.js} +1 -1
  8. package/app/dist/assets/{angular-ts-DErpwNhE.js → angular-ts-B9caFRUl.js} +1 -1
  9. package/app/dist/assets/{apl-jktjMWm9.js → apl-BaFDIJAy.js} +1 -1
  10. package/app/dist/assets/{astro-OyfDR1ll.js → astro-CB3F_OsY.js} +1 -1
  11. package/app/dist/assets/{blade-l0Ufqsdo.js → blade-CjgH6QoP.js} +1 -1
  12. package/app/dist/assets/{c-Zl_aQ3ky.js → c-Bknf8flU.js} +1 -1
  13. package/app/dist/assets/{chunk-JZWAC4HX-CIhf07b6.js → chunk-JZWAC4HX-C0wcTaAp.js} +1 -1
  14. package/app/dist/assets/{cobol-_uRe_arD.js → cobol-s_WYmRkb.js} +1 -1
  15. package/app/dist/assets/{coffee-CfM2Lk3K.js → coffee-B4wogQNr.js} +1 -1
  16. package/app/dist/assets/{cpp-BARm9yzN.js → cpp-DBcUjMMg.js} +1 -1
  17. package/app/dist/assets/{crystal-DPHSLUHj.js → crystal-BEUw9aly.js} +1 -1
  18. package/app/dist/assets/{css-CaJEL4gr.js → css-Tyi5cHoy.js} +1 -1
  19. package/app/dist/assets/{dialog-CuU6GHxh.js → dialog-yU2jYzlX.js} +1 -1
  20. package/app/dist/assets/{edge-Dv3pZ6l2.js → edge-DBVUn5K4.js} +1 -1
  21. package/app/dist/assets/{effective-hosts-DNH4ZZMO.js → effective-hosts-L1PAD_aI.js} +4 -4
  22. package/app/dist/assets/{elixir-5FXX4Nj9.js → elixir-DScCko2H.js} +1 -1
  23. package/app/dist/assets/{elm-Dt58k6O0.js → elm-C4qaS622.js} +1 -1
  24. package/app/dist/assets/{erb-CVKj_0yX.js → erb-CZnOXF4N.js} +1 -1
  25. package/app/dist/assets/{git-rebase-vj4pqTZR.js → git-rebase-QEKpMjJZ.js} +1 -1
  26. package/app/dist/assets/{glimmer-js-D-OzgliZ.js → glimmer-js-BNOZF2qI.js} +1 -1
  27. package/app/dist/assets/{glimmer-ts-DmVVrzIL.js → glimmer-ts-apIdP2bg.js} +1 -1
  28. package/app/dist/assets/{glsl-B1HRIf6W.js → glsl-Dg2m4Gqj.js} +1 -1
  29. package/app/dist/assets/{graphql-CRBPsUaz.js → graphql-DFhF_r-2.js} +1 -1
  30. package/app/dist/assets/{hack-BArcdkL7.js → hack-Bhx0ZE7U.js} +1 -1
  31. package/app/dist/assets/{haml-De5cSl4E.js → haml-DI6_Yg2F.js} +1 -1
  32. package/app/dist/assets/{handlebars-8Zy2Vs3a.js → handlebars-BnNY7a5K.js} +1 -1
  33. package/app/dist/assets/{html-YVJdK98d.js → html-BOXTZS1i.js} +1 -1
  34. package/app/dist/assets/{html-derivative-BT0t4I9A.js → html-derivative-v40-23QP.js} +1 -1
  35. package/app/dist/assets/{http-DC0GH0Bs.js → http-BjNdwlfX.js} +1 -1
  36. package/app/dist/assets/{hurl-D2fUFTSB.js → hurl-FLqiDEN1.js} +1 -1
  37. package/app/dist/assets/{index-BRo1YnbF.js → index-aLeXFWbZ.js} +27 -27
  38. package/app/dist/assets/{java-BQoJICeR.js → java-BK7M4QRN.js} +1 -1
  39. package/app/dist/assets/{javascript-Ct_DN1X8.js → javascript-CIysJabp.js} +1 -1
  40. package/app/dist/assets/{jinja-C1ngEoTP.js → jinja-D22cUMUY.js} +1 -1
  41. package/app/dist/assets/{jison-C5ZNVS2c.js → jison-D5ZXfQQd.js} +1 -1
  42. package/app/dist/assets/{json-DVa2wY6T.js → json-DEUxBxBS.js} +1 -1
  43. package/app/dist/assets/{jsx-BJqlX6qV.js → jsx-cxjRg4Z9.js} +1 -1
  44. package/app/dist/assets/{julia-Btw_zR3T.js → julia-DfQvji8F.js} +1 -1
  45. package/app/dist/assets/{just-CbiU0D8M.js → just-7mfnOEVc.js} +1 -1
  46. package/app/dist/assets/{latex-VgwkhkD-.js → latex-CmEGWjs7.js} +1 -1
  47. package/app/dist/assets/{liquid-D6T8WtC6.js → liquid-Cmbkwo5G.js} +1 -1
  48. package/app/dist/assets/localhost-badge-CmIXXpKJ.js +22 -0
  49. package/app/dist/assets/{lua-CuA24JSE.js → lua-DJijm0YV.js} +1 -1
  50. package/app/dist/assets/{marko-CdDxo3xN.js → marko-TMTUEuNL.js} +1 -1
  51. package/app/dist/assets/{mdc-BJBOg0pF.js → mdc-DT_H0tm2.js} +1 -1
  52. package/app/dist/assets/{mutation-cache-effects-xpqBLSkL.js → mutation-cache-effects-CDggZqqz.js} +1 -1
  53. package/app/dist/assets/{nginx-tsneJbc1.js → nginx-DfhY1ECI.js} +1 -1
  54. package/app/dist/assets/{nim-Uh4_TEhl.js → nim-CY6yBY6c.js} +1 -1
  55. package/app/dist/assets/{page-shell-BdV9dDbP.js → page-shell-BWng2QUG.js} +1 -1
  56. package/app/dist/assets/{perl-Cvf95oTY.js → perl-BRRcO43t.js} +1 -1
  57. package/app/dist/assets/{php-B83K9nvD.js → php-DoQeKnTv.js} +1 -1
  58. package/app/dist/assets/{pill-T3MuOnWq.js → pill-CoTRlxZ6.js} +1 -1
  59. package/app/dist/assets/{pug-DgUV-atw.js → pug-BusbjPKV.js} +1 -1
  60. package/app/dist/assets/{qml-DSVs6hjq.js → qml-D4hm6vUS.js} +1 -1
  61. package/app/dist/assets/{r-SJZNyiX3.js → r-C3JOt0ks.js} +1 -1
  62. package/app/dist/assets/{razor-CT_zg6et.js → razor-MHFIGhr-.js} +1 -1
  63. package/app/dist/assets/{regexp-CPrDWy5-.js → regexp-DmDmHqK0.js} +1 -1
  64. package/app/dist/assets/{rst-B9Z3vumO.js → rst-D5K5OvKu.js} +1 -1
  65. package/app/dist/assets/{ruby-C4G9wCRV.js → ruby-qXw_ViMa.js} +1 -1
  66. package/app/dist/assets/{sas-DtD9kPDC.js → sas-SiqJsOSW.js} +1 -1
  67. package/app/dist/assets/{scss-DcJY8Ckr.js → scss-B9bBsqJt.js} +1 -1
  68. package/app/dist/assets/{settings-section-CckkqJNV.js → settings-section-B0JkCbim.js} +1 -1
  69. package/app/dist/assets/{shellscript-CpA00qMx.js → shellscript-B0hF8Ck_.js} +1 -1
  70. package/app/dist/assets/{shellsession-DFkHMqry.js → shellsession-kbvqTqYV.js} +1 -1
  71. package/app/dist/assets/{soy-DEEx3Rib.js → soy-DED6zzHR.js} +1 -1
  72. package/app/dist/assets/split-button-D4kqBiFb.js +1 -0
  73. package/app/dist/assets/{sql-CnuL_wU6.js → sql-kJQbrAD6.js} +1 -1
  74. package/app/dist/assets/{stata-TDxB0qbw.js → stata-Bsjpyopz.js} +1 -1
  75. package/app/dist/assets/{surrealql-GfZLB7-R.js → surrealql-CV66KZgA.js} +1 -1
  76. package/app/dist/assets/{svelte-C1vkmr9X.js → svelte-DQTF70EG.js} +1 -1
  77. package/app/dist/assets/{templ-i1836R3s.js → templ-5jXq5O2y.js} +1 -1
  78. package/app/dist/assets/{tex-DHz9nFDC.js → tex-BKPWc06x.js} +1 -1
  79. package/app/dist/assets/thread-queries-fJ7WqAPD.js +1 -0
  80. package/app/dist/assets/{ts-tags-CsR619BC.js → ts-tags-DHR5Sjbn.js} +1 -1
  81. package/app/dist/assets/{tsx-CXRf_lPc.js → tsx-BikICA1y.js} +1 -1
  82. package/app/dist/assets/{twig-B_nSkJZb.js → twig-D00gH1GT.js} +1 -1
  83. package/app/dist/assets/{typescript-Cu2naiFK.js → typescript-B9SUz1Ri.js} +1 -1
  84. package/app/dist/assets/{vue-html-Dv_PI5xi.js → vue-html-CxTWudeN.js} +1 -1
  85. package/app/dist/assets/{vue-D3uT4E2F.js → vue-nmyY5t9g.js} +1 -1
  86. package/app/dist/assets/{vue-vine-CTHIuOTa.js → vue-vine-DKOrFY9Z.js} +1 -1
  87. package/app/dist/assets/{xml-CWWC84Is.js → xml-vPV5v5Ih.js} +1 -1
  88. package/app/dist/assets/{xsl-CXHXpU_z.js → xsl-FiPzBrgC.js} +1 -1
  89. package/app/dist/assets/{yaml-MdGg4yLc.js → yaml-CYAqjA7C.js} +1 -1
  90. package/app/dist/index.html +8 -8
  91. package/host-daemon/dist/daemon-bundle.mjs +215 -215
  92. package/package.json +1 -1
  93. package/server/dist/index.js +1886 -1666
  94. package/app/dist/assets/InternalReplayListView-Cxndg0Hg.js +0 -1
  95. package/app/dist/assets/ProjectSettingsView-GUrHZAv8.js +0 -1
  96. package/app/dist/assets/ThreadDetailRoute-DpnTShJQ.js +0 -2871
  97. package/app/dist/assets/ThreadUnarchiveButton-D_xRAhIX.js +0 -1
  98. package/app/dist/assets/localhost-badge-CSYdoqAD.js +0 -22
  99. package/app/dist/assets/split-button-CDmbOtUR.js +0 -1
  100. package/app/dist/assets/thread-queries-DBgy7tqz.js +0 -1
@@ -1 +1 @@
1
- import{Fi as e,Lt as t,Nt as n,Pi as r,Wn as i,Wt as a,bi as o,fi as s,ia as c,t as l,tr as u,ua as d,xi as f,yi as p,zt as m}from"./page-shell-BdV9dDbP.js";import{Ct as h,c as g,n as ee,o as _,p as v,u as y}from"./effective-hosts-DNH4ZZMO.js";import{a as b,g as x,i as S,o as C,r as w,s as T,t as E}from"./dialog-CuU6GHxh.js";import{P as D,Xt as O,Yt as k,cn as A,ln as j,qt as M}from"./index-BRo1YnbF.js";import{i as N,n as P,r as F,t as I}from"./settings-section-CckkqJNV.js";var L=d(c(),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=e();function B({target:e,pending:t,onOpenChange:n,onDelete:r}){return(0,z.jsx)(E,{open:e!==null,onOpenChange:n,children:(0,z.jsx)(w,{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)(C,{children:[(0,z.jsx)(T,{children:`Remove host?`}),(0,z.jsx)(S,{children:`Remove "${e.name}" and all of its project sources? This cannot be undone.`})]}),(0,z.jsx)(b,{children:(0,z.jsx)(s,{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)(E,{open:e!==null,onOpenChange:n,children:(0,z.jsx)(w,{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,c]=(0,L.useState)(null);return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(C,{children:[(0,z.jsx)(T,{children:`Rename host`}),(0,z.jsx)(S,{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){c(`Host name cannot be empty.`);return}n(e.id,a)},children:[(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(x,{id:r,"aria-label":`Host name`,value:i,autoFocus:!0,disabled:t,onChange:e=>{a(e.target.value),o&&c(null)}}),o?(0,z.jsx)(`p`,{className:`text-sm text-destructive`,children:o}):null]}),(0,z.jsx)(b,{children:(0,z.jsx)(s,{type:`submit`,disabled:t,children:`Rename host`})})]})]})}function W({open:e,onOpenChange:t}){return(0,z.jsx)(E,{open:e,onOpenChange:t,children:(0,z.jsx)(w,{className:`sm:max-w-2xl`,children:(0,z.jsx)(G,{})})})}function G(){return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(C,{children:[(0,z.jsx)(T,{children:`Unable to add new host`}),(0,z.jsx)(S,{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)(E,{open:i,onOpenChange:r,children:(0,z.jsx)(w,{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)(C,{children:[(0,z.jsx)(T,{children:`New host`}),(0,z.jsx)(S,{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)(p,{name:`CircleCheck`,className:`size-4 text-success`,"aria-hidden":`true`}):n?(0,z.jsx)(p,{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:c=[],isLoading:d}=ee(),b=r(),[x,S]=(0,L.useState)(null),[C,w]=(0,L.useState)(null),[T,E]=(0,L.useState)(null),[O,V]=(0,L.useState)(!1),[U,G]=(0,L.useState)(!1),K=f({meta:{errorMessage:`Failed to rename host.`},mutationFn:({id:e,name:t})=>i(e,{name:t}),onSuccess:()=>{A({queryClient:b}),S(null)}}),J=f({meta:{errorMessage:`Failed to remove host.`},mutationFn:({id:e})=>a(e),onSuccess:()=>{j({queryClient:b}),w(null)}}),Z=f({meta:{errorMessage:`Failed to create host join command.`,showErrorToast:!1},mutationFn:()=>m(),onSuccess:e=>{A({queryClient:b}),E(e),V(!0)},onError:e=>{if(e instanceof n&&e.code===`app_url_required`){G(!0);return}D({error:e,fallbackMessage:`Failed to create host join command.`})}}),Q=f({meta:{errorMessage:`Failed to cancel host join.`},mutationFn:({id:e})=>t(e),onSuccess:(e,t)=>{A({queryClient:b}),E(e=>e?.hostId===t.id?null:e),V(!1)}}),$=T===null?null:c.find(e=>e.id===T.hostId)??null,te=Z.isPending||Q.isPending;async function ne(){if(T!==null&&T.expiresAt>Date.now()&&$?.status!==`connected`){V(!0);return}if(T!==null&&$?.status!==`connected`)try{await Q.mutateAsync({id:T.hostId})}catch{return}Z.mutate()}(0,L.useEffect)(()=>{if(!O||$?.status!==`connected`)return;let e=window.setTimeout(()=>{E(null),V(!1)},1500);return()=>window.clearTimeout(e)},[O,$?.status]);function re(e){if(e){V(!0);return}T!==null&&$?.status!==`connected`&&Q.mutate({id:T.hostId}),E(null),V(!1)}return(0,z.jsxs)(l,{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)(v,{asChild:!0,children:(0,z.jsxs)(s,{variant:`outline`,size:`sm`,className:`w-full justify-between border-border/60 bg-card sm:w-48`,"aria-label":`Theme`,children:[X[e],(0,z.jsx)(p,{name:`ChevronDown`,className:`size-3.5 text-muted-foreground`})]})}),(0,z.jsx)(g,{align:`end`,className:`w-48`,children:Y.map(t=>(0,z.jsxs)(y,{onSelect:()=>M(t.value),children:[t.label,(0,z.jsx)(p,{name:`Check`,className:o(`ml-auto`,e!==t.value&&`opacity-0`,h)})]},t.value))})]})})}),(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{title:`Hosts`,children:d?(0,z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading…`}):(0,z.jsx)(P,{children:c.length===0?(0,z.jsx)(I,{children:(0,z.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`No registered hosts.`})}):c.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 · `,u(e.lastSeenAt)]}),(0,z.jsxs)(_,{children:[(0,z.jsx)(v,{asChild:!0,children:(0,z.jsx)(s,{variant:`ghost`,size:`icon`,className:`h-7 w-7 shrink-0`,"aria-label":`Host actions`,children:(0,z.jsx)(p,{name:`MoreHorizontal`,className:`size-4`})})}),(0,z.jsxs)(g,{align:`end`,className:`w-40`,children:[(0,z.jsx)(y,{onSelect:()=>S({id:e.id,currentName:e.name}),children:`Rename`}),(0,z.jsx)(y,{className:`text-destructive focus:text-destructive`,onSelect:()=>w({id:e.id,name:e.name}),children:`Remove`})]})]})]},e.id)})})}),d?null:(0,z.jsx)(`div`,{className:`flex justify-start`,children:(0,z.jsxs)(s,{type:`button`,size:`sm`,variant:`ghost`,className:`h-auto justify-start gap-1.5 px-2 py-1 text-muted-foreground`,disabled:te,onClick:()=>{ne()},children:[(0,z.jsx)(p,{name:`Plus`,className:`size-3.5`}),`Add another host`]})})]})]}),(0,z.jsx)(H,{target:x,pending:K.isPending,onOpenChange:e=>{e||S(null)},onRename:(e,t)=>K.mutate({id:e,name:t})}),(0,z.jsx)(B,{target:C,pending:J.isPending,onOpenChange:e=>{e||w(null)},onDelete:e=>J.mutate({id:e})}),(0,z.jsx)(q,{open:O,target:T,host:$,onOpenChange:re}),(0,z.jsx)(W,{open:U,onOpenChange:G})]})}export{Z as AppSettingsView};
1
+ import{Ci as e,Lt as t,Nt as n,Ri as r,Ti as i,Wn as a,Wt as o,ar as s,ca as c,gi as l,ma as u,t as d,wi as f,zi as p,zt as m}from"./page-shell-BWng2QUG.js";import{Ct as h,c as g,n as ee,o as _,p as v,u as y}from"./effective-hosts-L1PAD_aI.js";import{a as b,g as x,i as S,o as C,r as w,s as T,t as E}from"./dialog-yU2jYzlX.js";import{$t as D,R as O,Zt as k,en as A,fn as j,pn as M}from"./index-aLeXFWbZ.js";import{i as N,n as P,r as F,t as I}from"./settings-section-B0JkCbim.js";var L=u(c(),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=p();function B({target:e,pending:t,onOpenChange:n,onDelete:r}){return(0,z.jsx)(E,{open:e!==null,onOpenChange:n,children:(0,z.jsx)(w,{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)(C,{children:[(0,z.jsx)(T,{children:`Remove host?`}),(0,z.jsx)(S,{children:`Remove "${e.name}" and all of its project sources? This cannot be undone.`})]}),(0,z.jsx)(b,{children:(0,z.jsx)(l,{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)(E,{open:e!==null,onOpenChange:n,children:(0,z.jsx)(w,{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)(C,{children:[(0,z.jsx)(T,{children:`Rename host`}),(0,z.jsx)(S,{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)(x,{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)(b,{children:(0,z.jsx)(l,{type:`submit`,disabled:t,children:`Rename host`})})]})]})}function W({open:e,onOpenChange:t}){return(0,z.jsx)(E,{open:e,onOpenChange:t,children:(0,z.jsx)(w,{className:`sm:max-w-2xl`,children:(0,z.jsx)(G,{})})})}function G(){return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(C,{children:[(0,z.jsx)(T,{children:`Unable to add new host`}),(0,z.jsx)(S,{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)(E,{open:i,onOpenChange:r,children:(0,z.jsx)(w,{className:`sm:max-w-2xl`,children:i&&n?(0,z.jsx)(J,{host:e,target:n}):null})})}function J({host:t,target:n}){let[r,i]=(0,L.useState)(()=>n.expiresAt<=Date.now()),a=t?.status===`connected`,o=!a&&!r,s=a?`Host connected`:r?`Join command expired`:`Waiting for host`;return(0,L.useEffect)(()=>{let e=n.expiresAt-Date.now();if(e<=0){i(!0);return}i(!1);let t=window.setTimeout(()=>i(!0),e);return()=>window.clearTimeout(t)},[n.expiresAt]),(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(C,{children:[(0,z.jsx)(T,{children:`New host`}),(0,z.jsx)(S,{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:n.joinCommand})}),(0,z.jsx)(A,{text:n.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:[a?(0,z.jsx)(e,{name:`CircleCheck`,className:`size-4 text-success`,"aria-hidden":`true`}):r?(0,z.jsx)(e,{name:`AlertCircle`,className:`size-4 text-destructive`,"aria-hidden":`true`}):null,(0,z.jsx)(`span`,{className:o?`animate-shine font-medium`:`font-medium text-foreground`,children:s}),o?(0,z.jsxs)(`span`,{children:[`· Expires at `,K(n.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 c=D(),{data:u=[],isLoading:p}=ee(),b=r(),[x,S]=(0,L.useState)(null),[C,w]=(0,L.useState)(null),[T,E]=(0,L.useState)(null),[A,V]=(0,L.useState)(!1),[U,G]=(0,L.useState)(!1),K=i({meta:{errorMessage:`Failed to rename host.`},mutationFn:({id:e,name:t})=>a(e,{name:t}),onSuccess:()=>{j({queryClient:b}),S(null)}}),J=i({meta:{errorMessage:`Failed to remove host.`},mutationFn:({id:e})=>o(e),onSuccess:()=>{M({queryClient:b}),w(null)}}),Z=i({meta:{errorMessage:`Failed to create host join command.`,showErrorToast:!1},mutationFn:()=>m(),onSuccess:e=>{j({queryClient:b}),E(e),V(!0)},onError:e=>{if(e instanceof n&&e.code===`app_url_required`){G(!0);return}O({error:e,fallbackMessage:`Failed to create host join command.`})}}),Q=i({meta:{errorMessage:`Failed to cancel host join.`},mutationFn:({id:e})=>t(e),onSuccess:(e,t)=>{j({queryClient:b}),E(e=>e?.hostId===t.id?null:e),V(!1)}}),$=T===null?null:u.find(e=>e.id===T.hostId)??null,te=Z.isPending||Q.isPending;async function ne(){if(T!==null&&T.expiresAt>Date.now()&&$?.status!==`connected`){V(!0);return}if(T!==null&&$?.status!==`connected`)try{await Q.mutateAsync({id:T.hostId})}catch{return}Z.mutate()}(0,L.useEffect)(()=>{if(!A||$?.status!==`connected`)return;let e=window.setTimeout(()=>{E(null),V(!1)},1500);return()=>window.clearTimeout(e)},[A,$?.status]);function re(e){if(e){V(!0);return}T!==null&&$?.status!==`connected`&&Q.mutate({id:T.hostId}),E(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)(v,{asChild:!0,children:(0,z.jsxs)(l,{variant:`outline`,size:`sm`,className:`w-full justify-between border-border/60 bg-card sm:w-48`,"aria-label":`Theme`,children:[X[c],(0,z.jsx)(e,{name:`ChevronDown`,className:`size-3.5 text-muted-foreground`})]})}),(0,z.jsx)(g,{align:`end`,className:`w-48`,children:Y.map(t=>(0,z.jsxs)(y,{onSelect:()=>k(t.value),children:[t.label,(0,z.jsx)(e,{name:`Check`,className:f(`ml-auto`,c!==t.value&&`opacity-0`,h)})]},t.value))})]})})}),(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{title:`Hosts`,children:p?(0,z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading…`}):(0,z.jsx)(P,{children:u.length===0?(0,z.jsx)(I,{children:(0,z.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`No registered hosts.`})}):u.map(t=>{let n=t.status===`connected`;return(0,z.jsxs)(I,{children:[(0,z.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[t.name,(0,z.jsx)(`span`,{className:`ml-1.5 text-xs text-muted-foreground`,children:t.id})]}),n?(0,z.jsx)(`span`,{className:R,title:`Connected`}):t.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 · `,s(t.lastSeenAt)]}),(0,z.jsxs)(_,{children:[(0,z.jsx)(v,{asChild:!0,children:(0,z.jsx)(l,{variant:`ghost`,size:`icon`,className:`h-7 w-7 shrink-0`,"aria-label":`Host actions`,children:(0,z.jsx)(e,{name:`MoreHorizontal`,className:`size-4`})})}),(0,z.jsxs)(g,{align:`end`,className:`w-40`,children:[(0,z.jsx)(y,{onSelect:()=>S({id:t.id,currentName:t.name}),children:`Rename`}),(0,z.jsx)(y,{className:`text-destructive focus:text-destructive`,onSelect:()=>w({id:t.id,name:t.name}),children:`Remove`})]})]})]},t.id)})})}),p?null:(0,z.jsx)(`div`,{className:`flex justify-start`,children:(0,z.jsxs)(l,{type:`button`,size:`sm`,variant:`ghost`,className:`h-auto justify-start gap-1.5 px-2 py-1 text-muted-foreground`,disabled:te,onClick:()=>{ne()},children:[(0,z.jsx)(e,{name:`Plus`,className:`size-3.5`}),`Add another host`]})})]})]}),(0,z.jsx)(H,{target:x,pending:K.isPending,onOpenChange:e=>{e||S(null)},onRename:(e,t)=>K.mutate({id:e,name:t})}),(0,z.jsx)(B,{target:C,pending:J.isPending,onOpenChange:e=>{e||w(null)},onDelete:e=>J.mutate({id:e})}),(0,z.jsx)(q,{open:A,target:T,host:$,onOpenChange:re}),(0,z.jsx)(W,{open:U,onOpenChange:G})]})}export{Z as AppSettingsView};
@@ -0,0 +1 @@
1
+ import{Ci as e,Ei as t,Kt as n,Ri as r,Ti as i,ca as a,gi as o,it as s,ma as c,t as l,wi as u,xn as d,zi as f,zn as p}from"./page-shell-BWng2QUG.js";import{n as m}from"./effective-hosts-L1PAD_aI.js";import{n as h}from"./chunk-JZWAC4HX-C0wcTaAp.js";import{D as g,O as _,T as v,mn as y}from"./index-aLeXFWbZ.js";import{t as b}from"./pill-CoTRlxZ6.js";import{t as x}from"./split-button-D4kqBiFb.js";var S=c(a(),1),C=f(),w=1,T=[.5,1,2,5,10],E=`block min-w-0 truncate text-foreground underline underline-offset-2 transition-colors hover:text-foreground/80`;function D(e){return`${e}×`}function O(e){return new Date(e).toLocaleString()}function k(){let a=r(),[c,f]=(0,S.useState)(()=>new Set),k=e=>{f(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},A=t({queryKey:s(),queryFn:()=>d()}),{data:j=[]}=m(),M=(0,S.useMemo)(()=>new Map(j.map(e=>[e.id,e.name])),[j]),N=i({mutationFn:e=>n(e),onSuccess:()=>{y({queryClient:a})}}),P=i({mutationFn:({captureId:e,speed:t})=>p(e,{speed:t}),onSuccess:e=>{window.open(`/projects/${e.projectId}/threads/${e.replayThreadId}`,`_blank`,`noopener`)}}),F=A.data?.captures??[];return(0,C.jsx)(l,{contentClassName:`pt-4 md:pt-5`,children:(0,C.jsxs)(`div`,{className:`mx-auto w-full max-w-3xl space-y-4`,children:[(0,C.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-border bg-surface-recessed px-3 py-2 text-sm text-muted-foreground`,children:[(0,C.jsx)(e,{name:`Info`,className:`mt-0.5 size-4 shrink-0`}),(0,C.jsxs)(`p`,{className:`m-0`,children:[`Replay previously captured conversations in a fresh thread. To record new captures, create threads with`,` `,(0,C.jsx)(`code`,{className:`font-mono text-xs`,children:`BB_DEV_REPLAY_CAPTURE=true pnpm dev`}),`.`]})]}),A.isLoading?(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading…`}):A.isError?(0,C.jsx)(`p`,{className:`text-sm text-destructive`,children:`Failed to load replay captures.`}):F.length===0?(0,C.jsx)(`p`,{className:`rounded-md border border-dashed border-border px-3 py-4 text-sm text-muted-foreground`,children:`No replay captures found on any connected host.`}):(0,C.jsx)(`div`,{className:`space-y-1`,children:F.map(t=>{let n=t.userInputPreview||t.captureId,r=t.kind===`thread-start`,i=r?`new`:`follow-up`,a=v(t.providerId),s=a?.icon,l=c.has(t.captureId),d=N.isPending&&N.variables===t.captureId,f=P.isPending&&P.variables?.captureId===t.captureId,p=P.isError&&P.variables?.captureId===t.captureId,m=t.eventCounts.rawProviderEvents===0,y={label:`Start replay at ${D(w)}`,onSelect:()=>P.mutate({captureId:t.captureId,speed:w}),content:(0,C.jsxs)(C.Fragment,{children:[f?(0,C.jsx)(e,{name:`Spinner`,className:`size-3 animate-spin`}):null,`Replay`]})},S=T.map(e=>({label:`Start replay at ${D(e)}`,onSelect:()=>P.mutate({captureId:t.captureId,speed:e}),content:(0,C.jsx)(`span`,{children:D(e)})}));return(0,C.jsxs)(`div`,{children:[(0,C.jsxs)(`div`,{className:`flex h-9 items-center gap-3 text-sm`,children:[(0,C.jsxs)(`button`,{type:`button`,onClick:()=>k(t.captureId),"aria-expanded":l,className:`flex min-w-0 flex-1 items-center gap-2 text-left`,children:[(0,C.jsx)(e,{name:`ChevronRight`,className:u(`size-3 shrink-0 text-muted-foreground transition-transform`,l&&`rotate-90`)}),(0,C.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,C.jsx)(`span`,{className:`min-w-0 max-w-xs truncate`,children:n}),t.title?(0,C.jsx)(`span`,{className:`min-w-0 truncate text-muted-foreground`,children:t.title}):null,(0,C.jsx)(b,{variant:r?`secondary`:`outline`,className:`shrink-0`,children:i}),s?(0,C.jsx)(s,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-label":a?.ariaLabel}):(0,C.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:t.providerId})]})]}),(0,C.jsx)(x,{disabled:f||m,primaryAction:y,secondaryActions:S,triggerLabel:`Choose replay speed`,mobileTitle:`Replay speed`}),(0,C.jsx)(o,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":`Delete replay capture`,title:`Delete replay capture`,disabled:d,onClick:()=>N.mutate(t.captureId),className:`size-6`,children:d?(0,C.jsx)(e,{name:`Spinner`,className:`size-3 animate-spin`}):(0,C.jsx)(e,{name:`Trash2`,className:`size-3`})})]}),l?(0,C.jsxs)(`div`,{className:`space-y-2 pb-3 pt-2`,children:[(0,C.jsxs)(g,{children:[(0,C.jsx)(_,{label:`Capture`,valueClassName:`min-w-0 truncate font-mono`,children:t.captureId}),(0,C.jsx)(_,{label:`Host`,valueClassName:`min-w-0 truncate`,children:M.get(t.hostId)??t.hostId}),(0,C.jsx)(_,{label:`Provider`,valueClassName:`min-w-0 truncate`,children:t.providerId}),(0,C.jsx)(_,{label:`Project`,valueClassName:`min-w-0`,children:(0,C.jsx)(h,{to:`/projects/${t.projectId}`,className:E,children:t.projectName??t.projectId})}),(0,C.jsx)(_,{label:`Thread`,valueClassName:`min-w-0`,children:(0,C.jsx)(h,{to:`/projects/${t.projectId}/threads/${t.threadId}`,className:u(E,!t.title&&`font-mono`),children:t.title??t.threadId})}),(0,C.jsx)(_,{label:`Captured`,valueClassName:`min-w-0 truncate`,children:O(t.capturedAt)}),(0,C.jsx)(_,{label:`Raw events`,valueClassName:`min-w-0 truncate`,children:t.eventCounts.rawProviderEvents})]}),p?(0,C.jsx)(`p`,{className:`text-xs text-destructive`,children:`Failed to start replay.`}):null]}):null]},`${t.hostId}:${t.captureId}`)})})]})})}export{k as InternalReplayListView};
@@ -1 +1 @@
1
- import{Fi as e,di as t,fi as n,ia as r,t as i,ua as a}from"./page-shell-BdV9dDbP.js";import{E as o,n as s,w as c}from"./thread-queries-DBgy7tqz.js";import{d as l,n as u}from"./chunk-JZWAC4HX-CIhf07b6.js";import{t as d}from"./pill-T3MuOnWq.js";import{t as f}from"./ThreadUnarchiveButton-D_xRAhIX.js";var p=a(r(),1),m=e(),h=[{value:`all`,label:`All`},{value:`manager`,label:`Managers`},{value:`managed`,label:`Managed`},{value:`unmanaged`,label:`Unmanaged`}];function g(e){return e.type===`manager`?`manager`:e.parentThreadId===null?null:`managed`}function _(){let{projectId:e}=l(),[r,a]=(0,p.useState)(`all`),_=s({projectId:e,kind:r}),v=c(),y=(0,p.useMemo)(()=>(_.data?.pages??[]).flat().filter(e=>e.archivedAt!=null),[_.data]);if(!e)return(0,m.jsx)(i,{contentClassName:`min-h-full items-center justify-center`,children:(0,m.jsx)(`p`,{className:`py-12 text-center text-sm text-muted-foreground`,children:`Project not found`})});let b=_.isPending,x=!b&&y.length===0;return(0,m.jsx)(i,{contentClassName:`pt-0`,children:(0,m.jsxs)(`div`,{className:`mx-auto w-full max-w-3xl`,children:[(0,m.jsxs)(`div`,{className:`sticky top-0 z-10 -mx-4 bg-background px-4 pt-4 md:-mx-5 md:px-5 md:pt-5`,children:[(0,m.jsx)(t,{placement:`below`,tone:`background`}),(0,m.jsx)(`div`,{className:`inline-flex items-center gap-1 rounded-lg border border-border p-0.5`,role:`tablist`,"aria-label":`Filter archived threads`,children:h.map(e=>{let t=r===e.value;return(0,m.jsx)(n,{type:`button`,variant:`ghost`,size:`sm`,role:`tab`,"aria-selected":t,"aria-pressed":t,className:`h-7 rounded-md px-2 text-xs font-medium text-muted-foreground sm:px-3`,onClick:()=>a(e.value),children:e.label},e.value)})})]}),(0,m.jsxs)(`div`,{className:`space-y-3 pt-3`,children:[b?(0,m.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading archived threads…`}):x?(0,m.jsx)(`p`,{className:`rounded-md border border-dashed border-border px-3 py-4 text-sm text-muted-foreground`,children:`No archived threads yet.`}):(0,m.jsx)(`div`,{className:`space-y-1`,children:y.map(t=>{let n=g(t);return(0,m.jsxs)(`div`,{className:`group flex h-9 items-center gap-3 rounded-md px-3 text-sm transition-colors hover:bg-state-hover`,children:[(0,m.jsx)(u,{to:`/projects/${e}/threads/${t.id}`,className:`min-w-0 flex-1`,children:(0,m.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,m.jsx)(`span`,{className:`truncate`,children:o(t)}),n?(0,m.jsx)(d,{variant:`outline`,className:`shrink-0`,children:n}):null]})}),(0,m.jsx)(f,{isPending:v.isPending&&v.variables?.id===t.id,onUnarchive:()=>{v.mutate({id:t.id})},threadType:t.type,className:`hover:bg-accent-foreground/15`})]},t.id)})}),_.hasNextPage?(0,m.jsx)(n,{type:`button`,variant:`ghost`,onClick:()=>{_.fetchNextPage()},disabled:_.isFetchingNextPage,className:`h-9 w-full justify-center rounded-md px-3 text-sm font-normal text-muted-foreground`,children:_.isFetchingNextPage?`Loading…`:`Load more`}):null]})]})})}export{_ as ProjectArchivedThreadsView};
1
+ import{ca as e,gi as t,hi as n,ma as r,t as i,zi as a}from"./page-shell-BWng2QUG.js";import{E as o,n as s,w as c}from"./thread-queries-fJ7WqAPD.js";import{d as l,n as u}from"./chunk-JZWAC4HX-C0wcTaAp.js";import{t as d}from"./pill-CoTRlxZ6.js";import{t as f}from"./ThreadUnarchiveButton-ae8m78ng.js";var p=r(e(),1),m=a(),h=[{value:`all`,label:`All`},{value:`manager`,label:`Managers`},{value:`managed`,label:`Managed`},{value:`unmanaged`,label:`Unmanaged`}];function g(e){return e.type===`manager`?`manager`:e.parentThreadId===null?null:`managed`}function _(){let{projectId:e}=l(),[r,a]=(0,p.useState)(`all`),_=s({projectId:e,kind:r}),v=c(),y=(0,p.useMemo)(()=>(_.data?.pages??[]).flat().filter(e=>e.archivedAt!=null),[_.data]);if(!e)return(0,m.jsx)(i,{contentClassName:`min-h-full items-center justify-center`,children:(0,m.jsx)(`p`,{className:`py-12 text-center text-sm text-muted-foreground`,children:`Project not found`})});let b=_.isPending,x=!b&&y.length===0;return(0,m.jsx)(i,{contentClassName:`pt-0`,children:(0,m.jsxs)(`div`,{className:`mx-auto w-full max-w-3xl`,children:[(0,m.jsxs)(`div`,{className:`sticky top-0 z-10 -mx-4 bg-background px-4 pt-4 md:-mx-5 md:px-5 md:pt-5`,children:[(0,m.jsx)(n,{placement:`below`,tone:`background`}),(0,m.jsx)(`div`,{className:`inline-flex items-center gap-1 rounded-lg border border-border p-0.5`,role:`tablist`,"aria-label":`Filter archived threads`,children:h.map(e=>{let n=r===e.value;return(0,m.jsx)(t,{type:`button`,variant:`ghost`,size:`sm`,role:`tab`,"aria-selected":n,"aria-pressed":n,className:`h-7 rounded-md px-2 text-xs font-medium text-muted-foreground sm:px-3`,onClick:()=>a(e.value),children:e.label},e.value)})})]}),(0,m.jsxs)(`div`,{className:`space-y-3 pt-3`,children:[b?(0,m.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading archived threads…`}):x?(0,m.jsx)(`p`,{className:`rounded-md border border-dashed border-border px-3 py-4 text-sm text-muted-foreground`,children:`No archived threads yet.`}):(0,m.jsx)(`div`,{className:`space-y-1`,children:y.map(t=>{let n=g(t);return(0,m.jsxs)(`div`,{className:`group flex h-9 items-center gap-3 rounded-md px-3 text-sm transition-colors hover:bg-state-hover`,children:[(0,m.jsx)(u,{to:`/projects/${e}/threads/${t.id}`,className:`min-w-0 flex-1`,children:(0,m.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,m.jsx)(`span`,{className:`truncate`,children:o(t)}),n?(0,m.jsx)(d,{variant:`outline`,className:`shrink-0`,children:n}):null]})}),(0,m.jsx)(f,{isPending:v.isPending&&v.variables?.id===t.id,onUnarchive:()=>{v.mutate({id:t.id})},threadType:t.type,className:`hover:bg-accent-foreground/15`})]},t.id)})}),_.hasNextPage?(0,m.jsx)(t,{type:`button`,variant:`ghost`,onClick:()=>{_.fetchNextPage()},disabled:_.isFetchingNextPage,className:`h-9 w-full justify-center rounded-md px-3 text-sm font-normal text-muted-foreground`,children:_.isFetchingNextPage?`Loading…`:`Load more`}):null]})]})})}export{_ as ProjectArchivedThreadsView};
@@ -0,0 +1 @@
1
+ import{Ci as e,Or as t,Ri as n,Ti as r,ca as i,gi as a,jn as o,kr as s,ma as c,t as l,zi as u}from"./page-shell-BWng2QUG.js";import{c as d,n as f,o as p,p as m,u as h}from"./effective-hosts-L1PAD_aI.js";import{d as g}from"./chunk-JZWAC4HX-C0wcTaAp.js";import{a as _,i as v,o as y,r as b,s as x,t as S}from"./dialog-yU2jYzlX.js";import{D as C,E as w,d as T,r as E,s as D,t as O}from"./localhost-badge-CmIXXpKJ.js";import{a as k}from"./mutation-cache-effects-CDggZqqz.js";import{_n as A,cn as j,ln as M,vn as N}from"./index-aLeXFWbZ.js";import{n as P,r as F,t as I}from"./settings-section-B0JkCbim.js";import{t as L}from"./pill-CoTRlxZ6.js";var R=c(i(),1),z=u();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)(a,{type:`button`,variant:`destructive`,disabled:t,onClick:()=>n(e.id),children:`Remove source`})})]})}function H({source:t,isLocalhostSource:n,isLocalPathInvalid:r,hostName:i,isEditPending:o,isOnlySource:s,onEditLocalPath:c,onRemove:l}){return(0,z.jsxs)(I,{children:[(0,z.jsx)(e,{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:t.path}),(0,z.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:i}),n?(0,z.jsx)(`span`,{className:`self-center`,children:(0,z.jsx)(O,{})}):null,r?(0,z.jsx)(L,{variant:`destructive`,children:`Invalid local path`}):null]}),(0,z.jsxs)(p,{children:[(0,z.jsx)(m,{asChild:!0,children:(0,z.jsx)(a,{variant:`ghost`,size:`icon`,className:`h-7 w-7 shrink-0`,"aria-label":`Source actions`,children:(0,z.jsx)(e,{name:`MoreHorizontal`,className:`size-4`})})}),(0,z.jsxs)(d,{align:`end`,className:`w-40`,children:[n?(0,z.jsx)(h,{disabled:o,onSelect:e=>{e.preventDefault(),c(t)},children:`Edit local path`}):null,(0,z.jsx)(h,{className:`text-destructive focus:text-destructive`,disabled:s,onSelect:()=>l(t),children:`Remove`})]})]})]})}function U(e,t){return t.get(e.hostId)??e.hostId}function W(){let{projectId:e}=g(),i=C(),c=w({enabled:i.isSuccess||i.isError}),u=c.data,d=i.isFetching||c.isLoading,{data:p=[]}=f(),m=n(),[h,_]=(0,R.useState)(null),v=r({meta:{errorMessage:`Failed to remove source.`},mutationFn:({sourceId:t})=>e?o(e,t):Promise.resolve(),onSuccess:()=>{k({projectId:e,queryClient:m}),_(null)}}),y=D(),b=T(),x=u?.find(t=>t.id===e),S=x?.sources,E=(0,R.useMemo)(()=>S??[],[S]),O=(0,R.useMemo)(()=>new Map(p.map(e=>[e.id,e.name])),[p]),I=x?.name??``,L=y.isPending||b.isPending,V=M({isPending:L,submit:(0,R.useCallback)(({path:t,hostId:n,target:r,closeDialog:i})=>{if(e){if(r.kind===`add-source`)y.mutate({projectId:e,path:t,hostId:n},{onSuccess:i});else if(r.kind===`update`){let r=E.find(e=>s(e)&&e.hostId===n);if(!r)return;b.mutate({projectId:e,sourceId:r.id,path:t},{onSuccess:i})}}},[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=N((0,R.useMemo)(()=>K?E.filter(e=>s(e)&&e.hostId===K).map(e=>e.path):[],[K,E])),J=K!=null&&!t(E,K)?(0,z.jsx)(`div`,{className:`mt-2 flex gap-2`,children:(0,z.jsx)(a,{size:`sm`,variant:`outline`,disabled:y.isPending,onClick:W,children:`Add local path`})}):null;return(0,z.jsxs)(l,{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=s(e)&&K!=null&&e.hostId===K;return(0,z.jsx)(H,{source:e,isLocalhostSource:t,isLocalPathInvalid:t&&A(q,e.path),hostName:s(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)(j,{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};