dorkos 0.88.0 → 0.89.0

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 (104) hide show
  1. package/core-extensions/linear-issues/index.ts +1 -1
  2. package/dist/bin/cli.js +610 -48
  3. package/dist/client/assets/{AboutPage-xqba6OSc.js → AboutPage-BXOwVTO0.js} +1 -1
  4. package/dist/client/assets/{AdapterIcon-BfxdKjYz.js → AdapterIcon-Bs0C7eSH.js} +1 -1
  5. package/dist/client/assets/{AppearancePage-MXRyK6j4.js → AppearancePage-C0FZ72U0.js} +1 -1
  6. package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-D6lj5D9_.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-BRr08I-_.js} +3 -3
  7. package/dist/client/assets/{BlintzCanvas-BmTo8WiT.js → BlintzCanvas-DCLSn9jx.js} +23 -23
  8. package/dist/client/assets/{CanvasCsvContent-C57uDWEL.js → CanvasCsvContent-CGQsl4FY.js} +1 -1
  9. package/dist/client/assets/{CanvasFileContent-1qt_NtYW.js → CanvasFileContent-CqLAG04I.js} +2 -2
  10. package/dist/client/assets/{CanvasModel3dContent-CJ2bwQjt.js → CanvasModel3dContent-DkPwdlTD.js} +2 -2
  11. package/dist/client/assets/{CodeMirrorDiff-6LU4OiJj.js → CodeMirrorDiff-BkTLxJoa.js} +1 -1
  12. package/dist/client/assets/{CodeMirrorEditor-Jq49Np0j.js → CodeMirrorEditor-CIgTB7Sa.js} +1 -1
  13. package/dist/client/assets/ConnectionAccessLists-BNgZnsD7.js +1 -0
  14. package/dist/client/assets/{ConnectionsPage-BAcGLK2V.js → ConnectionsPage-BlE8iku_.js} +2 -2
  15. package/dist/client/assets/{ConventionPage-DdKmGIcU.js → ConventionPage-DQZsWbi1.js} +3 -3
  16. package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-9LderCq4.js → FloatingTanStackRouterDevtools-CqogiFob-De2qH2l6.js} +1 -1
  17. package/dist/client/assets/HandlePage-BXDfRIy3.js +1 -0
  18. package/dist/client/assets/{LexicalField-DsPLNKLN.js → LexicalField-C_3WYQGQ.js} +1 -1
  19. package/dist/client/assets/{ManagesPage-C34dzjEv.js → ManagesPage-DFFt9mh7.js} +1 -1
  20. package/dist/client/assets/{Model3dViewer-PXpUR_oW.js → Model3dViewer-CqkgfgBg.js} +1 -1
  21. package/dist/client/assets/NamePage-Qtv820fs.js +1 -0
  22. package/dist/client/assets/{NotificationsPage-CTPdo_E9.js → NotificationsPage-CX4b6MCK.js} +1 -1
  23. package/dist/client/assets/{PermissionsPage-Ij8O_uFN.js → PermissionsPage-B7CCInRo.js} +1 -1
  24. package/dist/client/assets/{PersonalityPopover-D0pS2YVR.js → PersonalityPopover-BOphzXEY.js} +1 -1
  25. package/dist/client/assets/PhotoPage-DgXAydiI.js +1 -0
  26. package/dist/client/assets/{RoomsPage-C_jMQGJC.js → RoomsPage-_DIjKTpi.js} +1 -1
  27. package/dist/client/assets/RunsOnPopover-DOsGV_7l.js +1 -0
  28. package/dist/client/assets/SessionsPage-BOsRKUqZ.js +6 -0
  29. package/dist/client/assets/{SkillsPage-CSUclnmu.js → SkillsPage-seFT2etr.js} +1 -1
  30. package/dist/client/assets/{TasksPage-COCsTj5k.js → TasksPage-Imt9oPoi.js} +1 -1
  31. package/dist/client/assets/{ToolsPage-CIgwvhZM.js → ToolsPage-CGM0Jiil.js} +2 -2
  32. package/dist/client/assets/{TopologyGraph-BOcP_UPd.js → TopologyGraph-vhFyjSzJ.js} +1 -1
  33. package/dist/client/assets/{agent-browser-Cm6bXvCt.js → agent-browser-B6WqW-og.js} +1 -1
  34. package/dist/client/assets/airtable-B7_XMoPM.png +0 -0
  35. package/dist/client/assets/{highlighted-body-KPVGNVTW-CmLzbGDT.js → highlighted-body-KPVGNVTW-DkoFzbOS.js} +1 -1
  36. package/dist/client/assets/hubspot-BQJQ5DfV.png +0 -0
  37. package/dist/client/assets/{index-C7jBVjvK.js → index-BFoejqZA.js} +1 -1
  38. package/dist/client/assets/{index-BndjtRZA.js → index-BMUNBDCe.js} +1 -1
  39. package/dist/client/assets/index-BY3yxmfx.js +1 -0
  40. package/dist/client/assets/index-BiDsr32v.js +1 -0
  41. package/dist/client/assets/{index-Cd9I6lUD.js → index-BmbhktM1.js} +1 -1
  42. package/dist/client/assets/{index-CQzyikQJ.js → index-Br_-H83G.js} +1 -1
  43. package/dist/client/assets/{index-D1Y7OlGq.js → index-BsXXogDR.js} +2 -2
  44. package/dist/client/assets/{index-DArP7LVM.js → index-C55PP6X5.js} +1 -1
  45. package/dist/client/assets/{index-CLJKvTfN.js → index-C79__bWb.js} +1 -1
  46. package/dist/client/assets/{index-wIEie2VH.js → index-CCelL1vs.js} +1 -1
  47. package/dist/client/assets/{index-CRom-Nt5.js → index-CMh3FD3Q.js} +1 -1
  48. package/dist/client/assets/{index-B5b98af8.js → index-CbAiJmOw.js} +1 -1
  49. package/dist/client/assets/{index-r8MCK2Zn.js → index-Ciuu1JwG.js} +1 -1
  50. package/dist/client/assets/{index-D_3Gtukh.js → index-CmezFzDD.js} +1 -1
  51. package/dist/client/assets/{index-CqP01Nbn.js → index-D-IcFrZb.js} +1 -1
  52. package/dist/client/assets/{index-B9kyvuKW.js → index-D0Q-sDBn.js} +1 -1
  53. package/dist/client/assets/{index-DOZ6l8Os.js → index-D7L3s5xT.js} +1 -1
  54. package/dist/client/assets/{index-mHL0gmHU.js → index-D8qzXtVa.js} +3 -3
  55. package/dist/client/assets/{index-D6Noae7w.js → index-DA2x36Z1.js} +1 -1
  56. package/dist/client/assets/{index-DrRfKYSH.js → index-DAogWPwG.js} +1 -1
  57. package/dist/client/assets/{index-DIAn8UxO.js → index-DBI4lgHw.js} +1 -1
  58. package/dist/client/assets/index-DDftPKpL.js +1 -0
  59. package/dist/client/assets/{index-Gs10j_MB.js → index-D_qmPmef.js} +1 -1
  60. package/dist/client/assets/{index-wpJKx9Mi.js → index-DcrgiH5I.js} +1 -1
  61. package/dist/client/assets/{index-_1qDsPCM.js → index-DgM6zNKn.js} +426 -435
  62. package/dist/client/assets/{index-vlk24smC.js → index-Dj4UMRJj.js} +1 -1
  63. package/dist/client/assets/index-DmX9plz6.js +38 -0
  64. package/dist/client/assets/{index-BxfmjO0b.js → index-Dt1n757u.js} +1 -1
  65. package/dist/client/assets/{index-DpN4Unzc.js → index-DwX-1WZf.js} +1 -1
  66. package/dist/client/assets/{index-C4GR43mL.js → index-DxBAUxqG.js} +1 -1
  67. package/dist/client/assets/{index-noUdLKRN.js → index-Dzt17e2e.js} +1 -1
  68. package/dist/client/assets/{index-rEcs1cWl.js → index-GqFxPMLJ.js} +1 -1
  69. package/dist/client/assets/{index-DWOxbvGH.js → index-HGlT1rGv.js} +1 -1
  70. package/dist/client/assets/index-fh0Br4xv.js +17 -0
  71. package/dist/client/assets/{index-BvuOztsk.js → index-mnHv12yO.js} +1 -1
  72. package/dist/client/assets/index-ojjbEHz5.css +1 -0
  73. package/dist/client/assets/{index-20DQ0WIE.js → index-yQNEOaWT.js} +1 -1
  74. package/dist/client/assets/linear-BihyrT6v.svg +1 -0
  75. package/dist/client/assets/notion-egi6fb2a.png +0 -0
  76. package/dist/client/assets/room-files-source-Cyx8H6V6.js +6 -0
  77. package/dist/client/assets/{soul-file-BWnNRUqb.js → soul-file-DUY5SyDc.js} +1 -1
  78. package/dist/client/assets/{use-personality-commit-CKnXk3oQ.js → use-personality-commit-D1Go4jUE.js} +1 -1
  79. package/dist/client/index.html +2 -2
  80. package/dist/drizzle/0118_session_context.sql +6 -0
  81. package/dist/drizzle/0119_session_continue.sql +5 -0
  82. package/dist/drizzle/0120_session_limit_history.sql +24 -0
  83. package/dist/drizzle/0121_session_auto_resume.sql +1 -0
  84. package/dist/drizzle/meta/0118_snapshot.json +9264 -0
  85. package/dist/drizzle/meta/0119_snapshot.json +9299 -0
  86. package/dist/drizzle/meta/0120_snapshot.json +9430 -0
  87. package/dist/drizzle/meta/0121_snapshot.json +9437 -0
  88. package/dist/drizzle/meta/_journal.json +28 -0
  89. package/dist/server/index.js +181119 -172125
  90. package/dist/server/index.js.map +2 -2
  91. package/package.json +4 -4
  92. package/dist/client/assets/ConnectionAccessLists-uBJL31Ay.js +0 -1
  93. package/dist/client/assets/HandlePage-C6lAHsBo.js +0 -1
  94. package/dist/client/assets/NamePage-C0Mhnk4v.js +0 -1
  95. package/dist/client/assets/PhotoPage-DK8jrI66.js +0 -1
  96. package/dist/client/assets/RunsOnPopover-Dj0c45ua.js +0 -1
  97. package/dist/client/assets/SessionsPage-BMABy-lt.js +0 -6
  98. package/dist/client/assets/index-CV_tZl11.js +0 -1
  99. package/dist/client/assets/index-D5zhwLA1.js +0 -1
  100. package/dist/client/assets/index-DBrS_qK1.js +0 -1
  101. package/dist/client/assets/index-DtWF2VPM.css +0 -1
  102. package/dist/client/assets/index-GxKQ7usg.js +0 -33
  103. package/dist/client/assets/index-irBM12M1.js +0 -17
  104. package/dist/client/assets/room-files-source-Tt08gsJM.js +0 -6
@@ -1,33 +0,0 @@
1
- var Ce=Object.defineProperty;var Ne=(t,n,s)=>n in t?Ce(t,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[n]=s;var U=(t,n,s)=>Ne(t,typeof n!="symbol"?n+"":n,s);import{dz as N,ad as $,f7 as Re,r as p,f8 as De,f9 as X,fa as Ie,em as ze,j as e,fb as _,fc as Me,fd as ne,fe as Te,ff as Se,fg as Fe,fh as se,b as B,fi as H,fj as V,aj as O,fk as Ae,fl as Oe,X as _e,fm as Ee,B as k,ak as Le,eC as Ue,J as T,fn as Pe,fo as $e,fp as Be,fq as He,fr as Ve,fs as Ye,ft as Ke,fu as Z,al as We,ah as qe,ae as y,fv as Ge,fw as Je,fx as Qe,fy as Xe,fz as Ze,aY as ee,fA as te,fB as et,fC as tt,fD as nt,fE as st,fF as ae,fG as at}from"./index-_1qDsPCM.js";import{fH as Ut,fI as Pt}from"./index-_1qDsPCM.js";import{c as ot,F as rt}from"./room-files-source-Tt08gsJM.js";/**
2
- * @license lucide-react v1.47.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const oe={name:"box",size:24,node:[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]};oe.node;const it=N(oe);/**
7
- * @license lucide-react v1.47.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */const re={name:"braces",size:24,node:[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]],aliases:["curly-braces"]};re.node;const ie=N(re);/**
12
- * @license lucide-react v1.47.0 - ISC
13
- *
14
- * This source code is licensed under the ISC license.
15
- * See the LICENSE file in the root directory of this source tree.
16
- */const le={name:"file-headphone",size:24,node:[["path",{d:"M4 6.835V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-.343",key:"1vfytu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M2 19a2 2 0 0 1 4 0v1a2 2 0 0 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 0 1-4 0v-1a2 2 0 0 1 4 0",key:"1etmh7"}]],aliases:["file-audio","file-audio-2"]};le.node;const lt=N(le);/**
17
- * @license lucide-react v1.47.0 - ISC
18
- *
19
- * This source code is licensed under the ISC license.
20
- * See the LICENSE file in the root directory of this source tree.
21
- */const ce={name:"file-play",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M15.033 13.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56v-4.704a.645.645 0 0 1 .967-.56z",key:"1tzo1f"}]],aliases:["file-video"]};ce.node;const ct=N(ce);/**
22
- * @license lucide-react v1.47.0 - ISC
23
- *
24
- * This source code is licensed under the ISC license.
25
- * See the LICENSE file in the root directory of this source tree.
26
- */const de={name:"git-compare",size:24,node:[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["path",{d:"M11 18H8a2 2 0 0 1-2-2V9",key:"19pyzm"}]]};de.node;const dt=N(de);/**
27
- * @license lucide-react v1.47.0 - ISC
28
- *
29
- * This source code is licensed under the ISC license.
30
- * See the LICENSE file in the root directory of this source tree.
31
- */const ue={name:"image",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]};ue.node;const ut=N(ue);function mt(t){const n=$(),{roomId:s,viewerAuthorId:r,documentId:i,url:f,readScrollY:u,subscribe:d}=t,a=Re(s,r),g=p.useRef({roomId:s,documentId:i,url:f,readScrollY:u});g.current={roomId:s,documentId:i,url:f,readScrollY:u};const m=p.useRef(null),x=p.useRef(0);p.useEffect(()=>{if(!a||s===null||i===null)return;const j=()=>{m.current=null,x.current=Date.now();const b=g.current;if(b.roomId===null||b.documentId===null)return;const F=b.roomId,E={documentId:b.documentId,...b.url!==void 0?{url:b.url}:{},...b.readScrollY?{scrollY:Math.max(0,Math.round(b.readScrollY()))}:{}};n.publishRoomView(F,E).then(L=>{!L.followed&&r!==null&&Ie.getState().noteNobodyFollowing(F,r)}).catch(()=>{})},c=()=>{if(m.current!==null)return;const b=Date.now()-x.current;if(b>=X){j();return}m.current=setTimeout(j,X-b)};c();const R=d==null?void 0:d(c),S=setInterval(c,De);return()=>{clearInterval(S),R==null||R()}},[n,a,s,r,i,f,d]),p.useEffect(()=>()=>{m.current!==null&&clearTimeout(m.current)},[])}const ft={url:_,markdown:se,json:ie,image:ut,pdf:Fe,widget:Se,mcp_app:Te,file:ne,model3d:it,audio:lt,video:ct,csv:Me,browser:_,diff:dt},ht="after:absolute after:inset-x-0 after:-inset-y-2 md:after:hidden";function Y(t){return t==="browser"?"browser-panel":"canvas-panel"}const pt={canvas:"Open canvas documents",browser:"Open browser pages"};function K(t){return`canvas-tab-${t}`}const xt=3;function yt(t){const n=t.map(r=>r.displayName);if(n.length===0)return null;if(n.length===1)return`${n[0]} is looking at this.`;if(n.length===2)return`${n[0]} and ${n[1]} are looking at this.`;const s=n.length-2;return`${n[0]}, ${n[1]} and ${s} ${s===1?"other":"others"} are looking at this.`}function vt({watchers:t}){const n=yt(t);if(n===null)return null;const s=t.slice(0,xt),r=t.length-s.length;return e.jsxs(e.Fragment,{children:[e.jsxs("span",{"data-slot":"canvas-tab-watchers","aria-hidden":!0,className:"flex shrink-0 -space-x-1",children:[s.map(i=>e.jsx(B,{size:"xs",className:"ring-background size-3.5 text-[8px] ring-1",kind:i.kind,color:i.color??V(i.id),emoji:i.emoji,imageUrl:i.imageUrl,badge:null,fallback:H(i.displayName)},i.id)),r>0&&e.jsxs("span",{className:"bg-muted text-muted-foreground ring-background flex size-3.5 shrink-0 items-center justify-center rounded-full text-[8px] ring-1",children:["+",r]})]}),e.jsx("span",{className:"sr-only",children:n})]})}function me({view:t,documents:n,activeDocumentId:s,onActivate:r,onClose:i,onPin:f}){const u=Y(t),{getTabProps:d}=ze({orderedIds:n.map(a=>a.id),activeId:s,onActivate:a=>r(a),onClose:a=>i(a),getFallbackFocus:()=>document.getElementById(u)});return n.length===0?null:e.jsx("div",{role:"tablist","aria-label":pt[t],className:"flex items-stretch gap-1 overflow-x-auto border-b px-2 py-1",children:n.map(a=>{const g=ft[a.contentType],m=a.id===s,x=a.author;return e.jsxs("div",{role:"presentation",className:"group relative flex shrink-0",children:[e.jsxs("button",{type:"button",role:"tab","aria-selected":m,id:K(a.id),"aria-controls":m?u:void 0,...d(a.id),className:O("focus-ring flex items-center gap-1.5 rounded-md py-3 pl-2 text-xs transition-colors md:py-1",f?"pr-12":"pr-7",m?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/60 hover:text-foreground"),children:[x&&e.jsx(B,{"aria-hidden":!0,size:"xs",className:"size-3.5 shrink-0 text-[8px]",kind:x.kind,color:x.color??V(x.id),emoji:x.emoji,imageUrl:x.imageUrl,badge:null,fallback:H(x.displayName)}),e.jsx(g,{className:"size-3.5 shrink-0"}),e.jsx("span",{className:"max-w-40 truncate font-medium",children:a.sourceLabel}),a.watchers&&a.watchers.length>0&&e.jsx(vt,{watchers:a.watchers}),a.unread&&e.jsx("span",{"data-slot":"canvas-tab-unread","aria-hidden":!0,className:"bg-primary size-1.5 shrink-0 rounded-full"})]}),f&&e.jsx("button",{type:"button",tabIndex:-1,onClick:()=>f(a.id,!a.pinned),"aria-label":a.pinned?`Unpin ${a.sourceLabel}`:`Pin ${a.sourceLabel}`,className:O("focus-ring hover:bg-background/80 absolute top-1/2 right-6 -translate-y-1/2 rounded-sm p-1.5 transition-opacity md:p-0.5",a.pinned?"opacity-100":"opacity-0 group-hover:opacity-60"),children:a.pinned?e.jsx(Ae,{className:"size-3"}):e.jsx(Oe,{className:"size-3"})}),e.jsx("button",{type:"button",tabIndex:-1,onClick:()=>i(a.id),"aria-label":`Close ${a.sourceLabel}`,className:O("focus-ring hover:bg-background/80 absolute top-1/2 right-1 -translate-y-1/2 rounded-sm p-1.5 opacity-60 transition-opacity group-hover:opacity-100 md:p-0.5",ht),children:e.jsx(_e,{className:"size-3"})})]},a.id)})})}function gt({error:t,onRetry:n}){const s=Ee(t);return e.jsxs("div",{className:"text-muted-foreground flex h-full flex-col items-center justify-center gap-3 p-8 text-center",children:[e.jsx("p",{children:"This tab hit a problem"}),s?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-sm",children:"The app may have updated since you opened this tab. Reloading usually fixes it."}),e.jsx(k,{type:"button",size:"sm",onClick:()=>window.location.reload(),children:"Reload DorkOS"})]}):e.jsxs(k,{type:"button",variant:"outline",size:"sm",onClick:n,children:[e.jsx(Le,{className:"size-4"}),"Try again"]})]})}class fe extends p.Component{constructor(){super(...arguments);U(this,"state",{error:null,retryKey:0});U(this,"handleRetry",()=>{this.setState(s=>({error:null,retryKey:s.retryKey+1}))})}static getDerivedStateFromError(s){return{error:s}}componentDidCatch(s,r){console.error(`[Canvas] Document viewer error (${this.props.documentId}):`,s,r)}render(){const{error:s,retryKey:r}=this.state;return s?e.jsx(gt,{error:s,onRetry:this.handleRetry}):e.jsx(p.Fragment,{children:this.props.children},r)}}function bt({onReload:t,onKeepMine:n}){return e.jsxs("div",{role:"status",className:"border-border/60 bg-muted/40 mx-2 mt-2 space-y-2 rounded-md border px-3 py-2 text-sm",children:[e.jsx("p",{children:"Your agent changed this while you were editing, so nothing here moved."}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(k,{type:"button",variant:"outline",size:"sm",onClick:t,children:"Reload"}),e.jsx(k,{type:"button",variant:"ghost",size:"sm",onClick:n,children:"Keep mine"})]}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Reload shows their version and ends your edit. Keep mine throws theirs away."})]})}const jt={canvas:{heading:"A blank canvas",blurb:"Your agent can render documents, data, and files here.",actions:[{icon:se,label:"Markdown",description:"Render a document",action:()=>({type:"markdown",content:`# Untitled
32
-
33
- Start writing…`,title:"Document"})},{icon:ie,label:"JSON",description:"Inspect structured data",action:()=>({type:"json",data:{message:"Your data here"},title:"JSON Data"})}]},browser:{heading:"No page open",blurb:"This tab shows web pages: a file you are building, a dev server you are running, or a site your agent wants you to see.",actions:[{icon:_,label:"Web Page",description:"Open a page, then type any address",action:()=>({type:"url",url:"https://dorkos.ai",title:"Web Page"})}]}};function P(t,n,s,r){return t.split("").reduce((f,u)=>f+u.charCodeAt(0),0)*(n+1)*7%(r-s)+s}function he({view:t,onAction:n}){const s=Ue(),r=p.useId(),i=jt[t],f=p.useMemo(()=>Array.from({length:6},(u,d)=>({x:P(r,d*3,10,90),y:P(r,d*3+1,10,80),size:P(r,d*3+2,24,56),delay:d*.4})),[r]);return e.jsxs("div",{className:"relative flex h-full flex-col items-center justify-center overflow-hidden px-6",children:[!s&&f.map((u,d)=>e.jsx(T.div,{className:"border-border/40 absolute rounded-lg border",style:{left:`${u.x}%`,top:`${u.y}%`,width:u.size,height:u.size},initial:{opacity:0,scale:.6,rotate:-10},animate:{opacity:[0,.15,.08,.15],scale:[.6,1,.9,1],rotate:[-10,0,5,0]},transition:{duration:8,delay:u.delay,repeat:1/0,repeatType:"reverse",ease:"easeInOut"}},d)),e.jsxs(T.div,{className:"relative z-10 flex max-w-sm flex-col items-center gap-6 text-center",initial:s?!1:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{duration:.4,ease:"easeOut"},children:[e.jsx(T.div,{className:"bg-muted/50 text-muted-foreground flex size-14 items-center justify-center rounded-2xl",initial:s?!1:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.3,delay:.1},children:t==="browser"?e.jsx(_,{className:"size-7"}):e.jsx(Pe,{className:"size-7"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h2",{className:"text-lg font-semibold tracking-tight",children:i.heading}),e.jsxs("p",{className:"text-muted-foreground text-sm leading-relaxed",children:[i.blurb,e.jsx("br",{}),"Or pick a starting point below."]})]}),e.jsx(T.div,{className:"mt-2 flex w-full flex-col gap-2",initial:"hidden",animate:"visible",variants:s?{}:{visible:{transition:{staggerChildren:.08,delayChildren:.25}}},children:i.actions.map(({icon:u,label:d,description:a,action:g})=>e.jsxs(T.button,{variants:s?{}:{hidden:{opacity:0,y:8},visible:{opacity:1,y:0}},transition:{duration:.25},className:"border-border hover:bg-accent/50 flex items-center gap-3 rounded-lg border px-4 py-3 text-left transition-colors",onClick:()=>n(g()),children:[e.jsx(u,{className:"text-muted-foreground size-4 shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"text-sm font-medium",children:d}),e.jsx("span",{className:"text-muted-foreground ml-2 text-xs",children:a})]})]},d))})]})]})}function wt({sourceLabel:t,people:n,following:s,onFollow:r,onStopFollowing:i,onDiscuss:f,discussing:u=!1}){const d=n.find(a=>a.id===s)??null;return t===void 0&&n.length===0&&f===void 0?null:e.jsxs("div",{className:"text-muted-foreground flex items-center gap-2 border-b px-3 py-1 text-xs",children:[t!==void 0&&e.jsx("span",{className:"min-w-0 flex-1 truncate",children:t}),t===void 0&&e.jsx("span",{className:"flex-1"}),f&&e.jsxs(k,{type:"button",variant:"ghost",size:"sm",className:"h-6 gap-1 px-1.5",disabled:u,onClick:f,children:[e.jsx($e,{className:"size-3.5"}),"Discuss"]}),n.length>0&&e.jsxs(Be,{children:[e.jsx(He,{asChild:!0,children:e.jsxs(k,{type:"button",variant:"ghost",size:"sm",className:O("h-6 gap-1 px-1.5",d&&"text-foreground"),children:[e.jsx(Ve,{className:"size-3.5"}),d?`Following ${d.displayName}`:"Follow"]})}),e.jsxs(Ye,{align:"end",children:[e.jsx(Ke,{children:"Follow somebody’s browser"}),n.map(a=>e.jsxs(Z,{onSelect:()=>a.id===s?i():r(a.id),children:[e.jsx(B,{"aria-hidden":!0,size:"xs",className:"size-4 shrink-0 text-[9px]",kind:a.kind,color:a.color??V(a.id),emoji:a.emoji,imageUrl:a.imageUrl,badge:null,fallback:H(a.displayName)}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:a.displayName}),a.id===s&&e.jsx(We,{className:"size-3.5 shrink-0"})]},a.id)),d&&e.jsx(Z,{onSelect:i,children:"Stop following"})]})]})]})}function kt({roomId:t,document:n,reading:s}){const r=$(),i=qe(),[f,u]=p.useState(null),d=p.useMemo(()=>ot({transport:r,queryClient:i,roomId:t}),[r,i,t]);return e.jsxs("div",{className:"flex h-full items-start justify-center p-6",children:[e.jsxs("div",{className:"bg-card shadow-soft w-full max-w-md space-y-3 rounded-lg border p-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{className:"text-muted-foreground size-4 shrink-0"}),e.jsx("span",{className:"truncate text-sm font-medium",children:n.title||s.sourcePath})]}),e.jsx("p",{className:"text-muted-foreground font-mono text-xs break-all",children:s.sourcePath}),s.kind==="elsewhere"?e.jsx("p",{className:"text-muted-foreground text-sm leading-relaxed",children:s.sentence}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-muted-foreground text-sm leading-relaxed",children:"This file is in the room’s files. Changes you save here become one commit with your name on it."}),e.jsx(k,{type:"button",size:"sm",onClick:()=>u(s.sourcePath),children:"Open file"})]})]}),s.kind==="room-file"&&e.jsx(rt,{source:d,path:f,onClose:()=>u(null)})]})}const Ct=["image","pdf","audio","video","csv","model3d"];function Nt(t){return/^(https?:|data:)/.test(t)}function Rt(t){if(t.type==="file"||t.type==="diff")return t.sourcePath;if(t.type==="markdown")return t.sourcePath??null;if(Ct.includes(t.type)){const n=t.src;return Nt(n)?null:n}return null}function Dt(t){return t.type==="file"||t.type==="diff"||t.type==="markdown"}function It(t){const n=/^(?:in )?(.+?)['’]s /.exec(t.sourceLabel??"");return(n==null?void 0:n[1])??"another member"}function zt(t){const n=Rt(t.content);return n===null?{kind:"inline"}:t.treeKind==="room-main"||t.treeKind===void 0?Dt(t.content)?{kind:"room-file",sourcePath:n}:{kind:"elsewhere",sourcePath:n,sentence:"This file is in the room’s own files. Open it from the Files section of the Room tab."}:t.content.type==="diff"&&t.treeKind==="worktree"&&typeof t.aheadOfMain=="number"&&t.aheadOfMain>0?{kind:"worktree-diff",sourcePath:n,content:t.content}:t.content.type==="markdown"?{kind:"inline"}:{kind:"elsewhere",sourcePath:n,sentence:`This file is in ${It(t)}’s project, which you can’t open from here. Ask them to share it, or open your own copy.`}}function Mt(t){return t.title||t.contentType}function Tt({roomId:t,document:n,onUpdate:s}){const r=zt(n);return r.kind==="worktree-diff"?e.jsx(nt,{roomId:t,content:r.content,documentId:n.id,authorId:n.authorId}):r.kind!=="inline"?e.jsx(kt,{roomId:t,document:n,reading:r}):n.content.type==="markdown"?e.jsx(st,{roomId:t,document:n,content:n.content,onSave:s}):e.jsx(ae,{documentId:n.id,content:n.content,onContentChange:()=>{}})}function pe({roomId:t,view:n}){var G;const s=y(o=>o.roomCanvasDocuments[t]),r=y(o=>{var l;return((l=o.roomCanvasActive[t])==null?void 0:l[n])??null}),i=y(o=>{var l;return(l=o.roomCanvasUnread[t])==null?void 0:l[n]}),f=y(o=>o.activateRoomCanvasDocument),u=y(o=>o.clearRoomCanvasUnread),d=y(o=>o.roomCanvasPresence[t]),a=Ge(t),g=Je(t),m=$(),x=((G=g.data)==null?void 0:G.viewerAuthorId)??null,j=y(o=>o.roomCanvasEditing[t]??null),c=Qe(o=>o.openThread),[R,S]=p.useState(!1),b=n==="browser"?t:null,{following:F,follow:E,stop:L}=Xe(b),w=Ze(b),D=p.useRef(null),A=p.useCallback(async(o,l)=>{try{return await l(),!0}catch(z){return ee.error(o,{description:te(z)}),!1}},[]),I=p.useMemo(()=>et(s??[],n),[s,n]),v=I.find(o=>o.id===r)??null,W=(i==null?void 0:i.length)??0;p.useEffect(()=>{W>0&&u(t,n)},[W,u,t,n]);const ye=p.useMemo(()=>{var J;const o=new Map(((J=g.data)==null?void 0:J.members.map(h=>[h.author.id,h.author]))??[]),l=h=>({id:h.id,displayName:h.displayName,kind:h.kind,...h.emoji?{emoji:h.emoji}:{},...h.color?{color:h.color}:{},...h.imageUrl?{imageUrl:h.imageUrl}:{}}),z=new Map;for(const[h,M]of Object.entries(d??{})){if(h===x)continue;const C=o.get(h);if(!C)continue;const Q=z.get(M);Q?Q.push(l(C)):z.set(M,[l(C)])}return I.map(h=>{const M=o.get(h.authorId),C=z.get(h.id);return{id:h.id,sourceLabel:Mt(h),contentType:h.content.type,pinned:h.pinned,unread:(i==null?void 0:i.includes(h.id))??!1,...M?{author:l(M)}:{},...C?{watchers:C}:{}}})},[I,g.data,i,d,x]);tt(t,(v==null?void 0:v.id)??null);const ve=p.useMemo(()=>{var o;return(((o=g.data)==null?void 0:o.members)??[]).map(l=>l.author).filter(l=>l.kind==="human"&&l.id!==x).map(l=>({id:l.id,displayName:l.displayName,kind:l.kind,emoji:l.emoji,color:l.color,imageUrl:l.imageUrl}))},[g.data,x]),ge=y(o=>{if(r===null)return;const l=o.browserHistories[r];return l?l.stack[l.cursor]:void 0}),be=p.useCallback(()=>{var o;return((o=D.current)==null?void 0:o.scrollTop)??0},[]),je=p.useCallback(o=>{const l=D.current;return l?(l.addEventListener("scroll",o,{passive:!0}),()=>l.removeEventListener("scroll",o)):()=>{}},[]);mt({roomId:b,viewerAuthorId:x,documentId:r,url:ge,readScrollY:be,subscribe:je});const q=p.useMemo(()=>I.map(o=>o.id).join("\0"),[I]);p.useEffect(()=>{if(!(w===null||j!==null)&&q.split("\0").includes(w.documentId)){if(w.documentId!==r){f(t,w.documentId);return}w.scrollY!==void 0&&D.current&&(D.current.scrollTop=w.scrollY)}},[w,j,r,q,f,t]);const we=p.useCallback(()=>{v!==null&&(S(!0),m.discussCanvasDocument(t,v.id).then(o=>c(t,o.threadRootEntryId,!1)).catch(o=>{ee.error("Couldn’t start a discussion.",{description:te(o)})}).finally(()=>S(!1)))},[v,m,t,c]),ke=Y(n);return e.jsxs(e.Fragment,{children:[e.jsx(me,{view:n,documents:ye,activeDocumentId:r,onActivate:o=>f(t,o),onClose:o=>void A("Couldn’t take that off the canvas.",()=>a.close(o)),onPin:(o,l)=>void A(l?"Couldn’t pin that.":"Couldn’t unpin that.",()=>a.pin(o,l))}),e.jsx(wt,{sourceLabel:v==null?void 0:v.sourceLabel,people:n==="browser"?ve:[],following:F,onFollow:E,onStopFollowing:L,onDiscuss:v===null?void 0:we,discussing:R}),e.jsx("div",{id:ke,ref:D,tabIndex:-1,className:"min-h-0 flex-1 overflow-auto focus-visible:outline-none",...v?{role:"tabpanel","aria-labelledby":K(v.id)}:{},children:v?e.jsx(fe,{documentId:v.id,children:e.jsx(Tt,{roomId:t,document:v,onUpdate:(o,l)=>A("Couldn’t save that for the room.",()=>a.update(o,l))})},v.id):e.jsx(he,{view:n,onAction:o=>void A("Couldn’t put that on the canvas.",()=>a.open(o))})})]})}function xe({view:t}){const n=y(c=>c.openDocuments),s=y(c=>t==="browser"?c.activeBrowserDocumentId:c.activeCanvasDocumentId),r=y(c=>c.activateCanvasDocument),i=y(c=>c.closeCanvasDocument),f=y(c=>c.setDocumentContent),u=y(c=>c.openCanvasDocument),d=y(c=>c.applyHeldUpdate),a=y(c=>c.discardHeldUpdate),g=at(n,t),m=g.find(c=>c.id===s)??null,x=g.map(c=>({id:c.id,sourceLabel:c.sourceLabel,contentType:c.content.type})),j=Y(t);return e.jsxs(e.Fragment,{children:[e.jsx(me,{view:t,documents:x,activeDocumentId:s,onActivate:r,onClose:i}),(m==null?void 0:m.heldUpdate)&&e.jsx(bt,{onReload:()=>d(m.id),onKeepMine:()=>a(m.id)}),e.jsx("div",{id:j,tabIndex:-1,className:"min-h-0 flex-1 overflow-auto focus-visible:outline-none",...m?{role:"tabpanel","aria-labelledby":K(m.id)}:{},children:m?e.jsx(fe,{documentId:m.id,children:e.jsx(ae,{documentId:m.id,content:m.content,onContentChange:c=>f(m.id,c)})},m.id):e.jsx(he,{view:t,onAction:u})})]})}function Ot(){const t=y(n=>n.roomCanvasLiveRoomId);return e.jsx("div",{"data-slot":"canvas",className:"flex h-full flex-col overflow-hidden",children:t?e.jsx(pe,{roomId:t,view:"canvas"}):e.jsx(xe,{view:"canvas"})})}function _t(){const t=y(n=>n.roomCanvasLiveRoomId);return e.jsx("div",{"data-slot":"browser",className:"flex h-full flex-col overflow-hidden",children:t?e.jsx(pe,{roomId:t,view:"browser"}):e.jsx(xe,{view:"browser"})})}export{_t as BrowserContent,Ot as CanvasContent,Ut as resetSessionCanvasImport,Pt as useSessionCanvas};
@@ -1,17 +0,0 @@
1
- import{dz as Se,fV as Me,ad as ne,r as a,fW as Ie,fX as Q,fY as G,fZ as I,dG as oe,f_ as Ce,aY as J,f$ as ee,c$ as rt,g0 as ot,bD as it,g1 as lt,ah as ae,g2 as ct,g3 as dt,ez as ut,g4 as ft,ae as Te,g5 as ht,j as t,aD as Fe,ak as Ke,aP as pt,C as He,g6 as mt,dg as be,g7 as xt,fg as Ue,fl as gt,aj as Oe,g8 as qe,g9 as Qe,ga as yt,eG as vt,eH as Ct,eI as bt,eJ as X,eK as ue,dw as wt,dZ as fe,d_ as he,d$ as pe,e0 as me,e1 as xe,e2 as ge,e3 as ye,e4 as ve,B,aE as kt,gb as _e,fr as jt,gc as Dt,ag as le,gd as Be,ge as Ye,aX as Et,gf as Rt,gg as Nt,gh as St,gi as Tt,dN as Ee,gj as We,cZ as Ft,dA as Ot,aN as Pt,gk as Mt,gl as _t,fw as At,gm as zt,dC as Lt,dD as $t,dE as It,dF as Kt,dH as Ht,dI as Ut,I as qt,dJ as Qt}from"./index-_1qDsPCM.js";import{t as se,g as Bt,C as Yt,n as Ge,r as Ve,p as Wt,F as Gt,w as Vt,c as Ze,a as Zt}from"./room-files-source-Tt08gsJM.js";import{N as Hn,R as Un}from"./room-files-source-Tt08gsJM.js";/**
2
- * @license lucide-react v1.47.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const Xe={name:"corner-left-up",size:24,node:[["path",{d:"M14 9 9 4 4 9",key:"1af5af"}],["path",{d:"M20 20h-7a4 4 0 0 1-4-4V4",key:"1blwi3"}]]};Xe.node;const Xt=Se(Xe);/**
7
- * @license lucide-react v1.47.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */const Je={name:"file-plus",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]};Je.node;const et=Se(Je);/**
12
- * @license lucide-react v1.47.0 - ISC
13
- *
14
- * This source code is licensed under the ISC license.
15
- * See the LICENSE file in the root directory of this source tree.
16
- */const tt={name:"upload",size:24,node:[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]};tt.node;const Jt=Se(tt);function ie(e,n,s){return["file-explorer","tree",e.scopeKey,n,e.filtersHidden?s:null]}function ke(e,n,s,m){return{queryKey:ie(e,n,s),queryFn:()=>e.list(n,{showHidden:s}),staleTime:Me.FILE_TREE_STALE_TIME_MS,gcTime:Me.FILE_TREE_GC_TIME_MS,placeholderData:p=>p??m.getQueryData(ie(e,n,!s))}}const en=[".git",".dork",".claude",".agents","node_modules"];function tn(e){return e.startsWith(".")||en.includes(e)}const Re=["ROOM.md","README.md"];function Ne(e){return Re.some(n=>n.toLowerCase()===e.toLowerCase())}function nt(e){return e.filter(n=>!tn(n.name))}function nn(e){if(e.reduce((p,l)=>l.type==="file"&&Ne(l.name)?p+1:p,0)===0)return e;const s=[],m=[];for(const p of e)p.type==="file"&&Ne(p.name)?s.push(p):m.push(p);return s.sort((p,l)=>Re.findIndex(o=>o.toLowerCase()===p.name.toLowerCase())-Re.findIndex(o=>o.toLowerCase()===l.name.toLowerCase())),[...s,...m]}const sn=/ copy(?: \d+)?$/;function Pe({name:e,isDir:n,taken:s}){const m=new Set(s);if(!m.has(e))return e;const p=n?-1:e.lastIndexOf("."),l=p>0,o=l?e.slice(p):"",g=(l?e.slice(0,p):e).replace(sn,"");for(let r=1;;r+=1){const f=r===1?`${g} copy${o}`:`${g} copy ${r}${o}`;if(!m.has(f))return f}}function Ae(e,n,s){return{name:n,path:e,type:s,size:0,mtime:Date.now(),isSymlink:!1}}function an(e){const n=ne(),{source:s,showHidden:m,queryClient:p,inFlightRef:l}=e,o=s.cwd??"",[g,r]=a.useState(null),f=a.useCallback(async h=>{l.current+=1;try{return await h()}finally{l.current-=1}},[l]),u=a.useMemo(()=>{const h=x=>ie(s,x,m);return{getChildren:x=>{var w;return((w=p.getQueryData(h(x)))==null?void 0:w.entries)??[]},isLoaded:x=>p.getQueryData(h(x))!==void 0,takenNames:async x=>(await n.readFileTree(o,{path:x===Q?void 0:x,showHidden:!0})).entries.map(k=>k.name),snapshot:x=>p.getQueryData(h(x)),setChildren:(x,w)=>{p.setQueryData(h(x),k=>({entries:Ie(w((k==null?void 0:k.entries)??[]))}))},restore:(x,w)=>{p.setQueryData(h(x),w)},invalidate:x=>{p.invalidateQueries({queryKey:h(x),exact:!0})}}},[p,n,o,s,m]),E=a.useCallback((h,x,w)=>f(async()=>{const k=ee(h,x),T=!u.getChildren(h).some(A=>A.path===k),O=u.snapshot(h);T&&u.setChildren(h,A=>[...A,Ae(k,x,w)]);try{return await n.createEntry(o,k,w),!0}catch(A){return T&&u.restore(h,O),se(A,`Couldn’t create ${w==="dir"?"folder":"file"}`),!1}finally{u.invalidate(h)}}),[n,o,u,f]),P=a.useCallback((h,x)=>f(async()=>{if(x===h.name||x.length===0)return!0;const w=G(h.path),k=ee(w,x),T=u.getChildren(w).some(L=>L.path===k),O=u.snapshot(w),A={...h,name:x,path:k};T||u.setChildren(w,L=>L.map(H=>H.path===h.path?A:H));try{return await n.renameEntry(o,h.path,k),I.getState().remapExpandedPaths(h.path,k),!0}catch(L){return T||u.restore(w,O),se(L,"Couldn’t rename"),!1}finally{u.invalidate(w)}}),[n,o,u,f]),N=a.useCallback(h=>f(async()=>{const x=G(h.path),w=u.snapshot(x);u.setChildren(x,k=>k.filter(T=>T.path!==h.path));try{await n.deleteEntry(o,h.path,{recursive:!0}),I.getState().dropExpandedPaths(h.path)}catch(k){u.restore(x,w),se(k,"Couldn’t delete")}finally{u.invalidate(x)}}),[n,o,u,f]),U=a.useCallback(h=>f(async()=>{const x=G(h.path);if(h.type==="file"){const w=u.snapshot(x);u.setChildren(x,k=>k.filter(T=>T.path!==h.path));try{await n.deleteEntry(o,h.path),I.getState().dropExpandedPaths(h.path)}catch(k){u.restore(x,w),se(k,"Couldn’t delete")}finally{u.invalidate(x)}return}try{await n.deleteEntry(o,h.path),u.setChildren(x,w=>w.filter(k=>k.path!==h.path)),I.getState().dropExpandedPaths(h.path),u.invalidate(x)}catch(w){if(Bt(w)==="DIR_NOT_EMPTY"){r(h);return}se(w,"Couldn’t delete")}}),[n,o,u,f]),b=a.useCallback(async()=>{const h=g;r(null),h&&await N(h)},[g,N]),K=a.useCallback(()=>r(null),[]),$=a.useCallback((h,x)=>f(async()=>{const w=G(h),k=oe(h),T=ee(x,k);if(x===w||T===h||Ce(x,h))return;const O=u.getChildren(w).find(y=>y.path===h);if(!O)return;const A=u.isLoaded(x),L=A&&u.getChildren(x).some(y=>y.path===T),H={...O,name:k,path:T},Y=u.snapshot(w),F=A?u.snapshot(x):void 0;u.setChildren(w,y=>y.filter(v=>v.path!==h)),A&&!L&&u.setChildren(x,y=>[...y,H]);try{await n.renameEntry(o,h,T),I.getState().remapExpandedPaths(h,T)}catch(y){u.restore(w,Y),A&&!L&&u.restore(x,F),se(y,"Couldn’t move")}finally{u.invalidate(w),A&&u.invalidate(x)}}),[n,o,u,f]),C=a.useCallback((h,x)=>f(async()=>{if(h.isDir&&Ce(x,h.path)){J.error(Yt);return}let w;try{w=await u.takenNames(x)}catch(L){se(L,"Couldn’t copy");return}const k=Pe({name:oe(h.path),isDir:h.isDir,taken:w}),T=ee(x,k),O=u.isLoaded(x),A=O?u.snapshot(x):void 0;if(O){const L=u.getChildren(G(h.path)).find(Y=>Y.path===h.path),H=L?{...L,name:k,path:T}:Ae(T,k,h.isDir?"dir":"file");u.setChildren(x,Y=>[...Y,H])}try{await n.copyEntry(o,h.path,T)}catch(L){O&&u.restore(x,A),se(L,"Couldn’t copy")}finally{u.invalidate(x)}}),[n,o,u,f]);return{createEntry:E,renameEntry:P,removeEntry:U,moveEntry:$,copyEntry:C,pendingRecursiveDelete:g,confirmRecursiveDelete:b,cancelRecursiveDelete:K}}function rn(e){return e!=null&&e.startsWith("darwin")?"Reveal in Finder":e!=null&&e.startsWith("win32")?"Reveal in File Explorer":"Show in File Manager"}function on(e,n){const s=e.includes("\\")&&!e.includes("/"),m=e.replace(/[\\/]+$/,""),p=s?n.split("/").join("\\"):n;return`${m}${s?"\\":"/"}${p}`}function ln(e){const n=ne(),{data:s}=rt(),m=a.useMemo(()=>n.supportsReveal?rn(s==null?void 0:s.platform):null,[n.supportsReveal,s==null?void 0:s.platform]),p=a.useCallback(async f=>{if(e)try{await n.revealEntry(e,f.path)}catch(u){se(u,"Couldn’t open the file manager")}},[n,e]),{copy:l}=ot(),o=a.useCallback(async(f,u)=>{const E=u==="absolute"&&e?on(e,f.path):f.path;await l(E)||J.error("Couldn’t copy to the clipboard")},[e,l]),g=a.useCallback(f=>{it(lt(f.path))||J.error("Open a chat first to add a file to it")},[]),r=a.useCallback(f=>{I.getState().setClipboard({path:f.path,isDir:f.type==="dir"});try{navigator.clipboard.writeText(f.path).catch(()=>{})}catch{}},[]);return{revealLabel:m,reveal:p,copyPath:o,addToChat:g,copyToClipboard:r}}const cn=1e3;function dn(e){const{source:n,showHidden:s,queryClient:m,inFlightRef:p}=e,l=n.changes,[o,g]=a.useState(null),[r,f]=a.useState(null),[u,E]=a.useState(null),[P,N]=a.useState(0),U=a.useCallback(async d=>{p.current+=1,N(c=>c+1);try{return await d()}finally{p.current-=1,N(c=>c-1)}},[p]),b=a.useMemo(()=>{const d=c=>ie(n,c,s);return{listing:c=>m.getQueryData(d(c)),isLoaded:c=>m.getQueryData(d(c))!==void 0,entries:c=>{var D;return((D=m.getQueryData(d(c)))==null?void 0:D.entries)??[]},setEntries:(c,D)=>m.setQueryData(d(c),j=>({...j,entries:Ie(D((j==null?void 0:j.entries)??[]))})),restore:(c,D)=>m.setQueryData(d(c),D),fetch:c=>n.list(c,{showHidden:!0}),refreshAll:()=>{m.invalidateQueries({queryKey:["file-explorer","tree",n.scopeKey]}),m.invalidateQueries({queryKey:["file-explorer","preview",n.scopeKey]})}}},[m,n,s]),K=a.useCallback(async d=>{const c=b.listing(d);return(c==null?void 0:c.commit)!==void 0?c.commit:(await b.fetch(d)).commit??null},[b]),$=a.useCallback((d,c,D,j)=>{switch(d.status){case"changed":return!0;case"conflict":return E({kind:c,path:d.path,lastCommit:d.lastCommit,retry:()=>D(d.commit)}),!1;case"exists":return J.error(j===void 0?d.reason:Ge(j)),!1;case"refused":return J.error(d.reason),!1}},[]),C=a.useCallback((d,c)=>{J.error(Ve(d)??c)},[]),h=a.useCallback((d,c,D)=>{const j=q=>U(async()=>{if(l===void 0)return!1;const S=G(d.path),z=G(c),R=oe(c),W=b.isLoaded(z),te=W&&b.entries(z).some(V=>V.path===c),i=b.listing(S),_=z===S?void 0:b.listing(z),ce={...d,name:R,path:c};te||(z===S?b.setEntries(S,V=>V.map(Z=>Z.path===d.path?ce:Z)):(b.setEntries(S,V=>V.filter(Z=>Z.path!==d.path)),W&&b.setEntries(z,V=>[...V,ce])));const re=()=>{b.restore(S,i),z!==S&&W&&b.restore(z,_)};try{const V=q??await K(S);if(V===null)return re(),J.error("There’s nothing in this room’s files to change yet."),!1;const Z=await l.move({from:d.path,to:c,baseCommit:V}),de=$(Z,D,async je=>{await j(je)},R);return de?I.getState().remapExpandedPaths(d.path,c):re(),de}catch(V){return re(),C(V,D==="rename"?"Couldn’t rename":"Couldn’t move"),!1}finally{b.refreshAll()}});return j(null)},[l,b,U,K,$,C]),x=a.useCallback(async(d,c)=>c===d.name||c.length===0?!0:h(d,ee(G(d.path),c),"rename"),[h]),w=a.useCallback(async(d,c)=>{const D=G(d),j=ee(c,oe(d));if(c===D||j===d||Ce(c,d))return;const q=b.entries(D).find(S=>S.path===d);q&&await h(q,j,"move")},[b,h]),k=a.useCallback(async d=>{let c=0;const D=[d];for(;D.length>0;){const j=D.shift(),q=await b.fetch(j);for(const S of q.entries)if(S.type==="dir"?D.push(S.path):c+=1,c>=cn)return{count:c,moreThan:!0}}return{count:c,moreThan:!1}},[b]),T=a.useCallback(d=>{if(d.type!=="dir"){g({entry:d,fileCount:1,moreThan:!1});return}g({entry:d,fileCount:null,moreThan:!1}),k(d.path).then(({count:c,moreThan:D})=>g(j=>(j==null?void 0:j.entry.path)===d.path?{entry:d,fileCount:c,moreThan:D}:j),()=>{})},[k]),O=a.useCallback(d=>{const c=D=>U(async()=>{if(l===void 0)return;const j=G(d.path),q=b.listing(j);b.setEntries(j,S=>S.filter(z=>z.path!==d.path));try{const S=D??await K(j);if(S===null){b.restore(j,q);return}const z=await l.remove({path:d.path,baseCommit:S});$(z,"delete",W=>c(W))?I.getState().dropExpandedPaths(d.path):b.restore(j,q)}catch(S){b.restore(j,q),C(S,"Couldn’t delete")}finally{b.refreshAll()}});return c(null)},[l,b,U,K,$,C]),A=a.useCallback(async()=>{const d=o;g(null),d&&await O(d.entry)},[o,O]),L=a.useCallback(()=>g(null),[]),H=a.useCallback((d,c,D,j)=>{const q=S=>U(async()=>{if(l===void 0)return;const z=b.isLoaded(d),R=z?b.listing(d):void 0;if(z){const W=new Set(b.entries(d).map(i=>i.name)),te=c.filter(i=>!W.has(i.name)).map(i=>({name:i.name,path:ee(d,i.name),type:"file",size:i.size}));te.length>0&&b.setEntries(d,i=>[...i,...te])}try{const W=await l.upload({dir:d,baseCommit:S,replace:D,files:c});!$(W,"upload",i=>q(i))&&z&&b.restore(d,R)}catch(W){z&&b.restore(d,R),C(W,"Couldn’t upload")}finally{b.refreshAll()}});return q(j)},[l,b,U,$,C]),Y=a.useCallback(async(d,c)=>{if(l===void 0||c.length===0)return;if(c.length>l.maxUploadFiles){J.error(`One upload can carry up to ${l.maxUploadFiles} files, so nothing was uploaded. Try again with fewer.`);return}let D;try{D=await b.fetch(d)}catch(R){C(R,"Couldn’t upload");return}const j=D.entries.map(R=>R.name),q=new Set(j),S=c.map(R=>R.name).filter(R=>q.has(R)),z=D.commit??null;if(S.length===0){await H(d,c,[],z);return}f({dir:d,files:c,names:S,taken:j,baseCommit:z})},[l,b,C,H]),F=a.useCallback(async d=>{const c=r;if(f(null),c===null)return;if(d==="replace"){await H(c.dir,c.files,c.names,c.baseCommit);return}const D=new Set([...c.taken,...c.files.map(S=>S.name)]),j=new Set(c.names),q=c.files.map(S=>{if(!j.has(S.name))return S;const z=Pe({name:S.name,isDir:!1,taken:D});return D.add(z),new File([S],z,{type:S.type,lastModified:S.lastModified})});await H(c.dir,q,[],c.baseCommit)},[r,H]),y=a.useCallback(()=>f(null),[]),v=a.useCallback(()=>E(null),[]),M=a.useMemo(()=>r===null?null:{dir:r.dir,names:r.names},[r]);return{renameEntry:x,moveEntry:w,requestDelete:T,pendingDelete:o,confirmDelete:A,cancelDelete:L,upload:Y,pendingClash:M,resolveClash:F,cancelClash:y,conflict:u,dismissConflict:v,busy:P>0}}const ze={scopeKey:"",cwd:null,writable:!1,provenance:!1,filtersHidden:!0,preview:"canvas",editable:!1,list:()=>Promise.resolve({entries:[]})};function un(e){var F,y;const n=ne(),s=ae(),{setTheme:m}=ct(),p=I(v=>v.showHidden),l=I(v=>v.expanded),o=I(v=>v.loadExplorerForCwd),g=I(v=>v.pruneMissing),r=(e==null?void 0:e.scopeKey)??null,f=(e==null?void 0:e.cwd)??null;a.useEffect(()=>{o(r)},[r,o]);const u=a.useMemo(()=>[Q,...dt(l)],[l]),E=ut({queries:e?u.map(v=>ke(e,v,p,s)):[]}),P=(e==null?void 0:e.filtersHidden)??!0,N=a.useMemo(()=>{const v={};return u.forEach((M,d)=>{var j;const c=E[d];let D=((j=c==null?void 0:c.data)==null?void 0:j.entries)??[];!p&&!P&&(D=nt(D)),M===Q&&(D=nn(D)),v[M]={entries:D,loading:(c==null?void 0:c.isLoading)??!1,error:(c==null?void 0:c.isError)??!1}}),v},[u,E,p,P]),U=a.useRef(0),b=a.useRef({});a.useEffect(()=>{U.current>0||u.forEach((v,M)=>{var c,D,j;const d=(D=(c=E[M])==null?void 0:c.data)==null?void 0:D.entries;!d||(j=E[M])!=null&&j.isError||b.current[v]!==d&&(b.current[v]=d,g(v,d.map(q=>q.name)))})},[u,E,g]);const K=a.useMemo(()=>ft(l,N),[l,N]),$=!!e&&!!((F=N[Q])!=null&&F.loading),C=!!e&&!!((y=N[Q])!=null&&y.error),h=a.useMemo(()=>{var M;const v=new Set;for(const d of u)d!==Q&&((M=N[d])!=null&&M.error)&&v.add(d);return v},[u,N]),x=a.useCallback(v=>{if(v.type!=="dir")return;const M=I.getState();M.setDirExpanded(v.path,!M.expanded[v.path])},[]),w=a.useCallback(v=>{if(v===Q)return;const M=I.getState();M.expanded[v]||M.setDirExpanded(v,!0)},[]),k=(e==null?void 0:e.preview)==="canvas",T=a.useCallback(v=>{if(v.type!=="file"||!k)return;const M={getStore:Te.getState,setTheme:m,supportsTerminal:n.supportsTerminal};ht(M,{action:"open_file",sourcePath:v.path},"user")},[k,m,n]),O=a.useCallback(()=>{r!==null&&s.invalidateQueries({queryKey:["file-explorer","tree",r]})},[s,r]),A=a.useCallback(v=>{e!==null&&s.invalidateQueries({queryKey:ie(e,v,p),exact:!0})},[s,e,p]);a.useEffect(()=>{if(e!=null&&e.events)return e.events(O)},[e,O]);const L=an({source:e??ze,showHidden:p,queryClient:s,inFlightRef:U}),H=dn({source:e??ze,showHidden:p,queryClient:s,inFlightRef:U}),Y=ln(f);return{rows:K,rootLoading:$,rootError:C,errorPaths:h,toggleExpand:x,ensureExpanded:w,openFile:T,reload:O,retryDir:A,changes:e!=null&&e.changes?H:null,...L,...Y}}function fn(e){const{transport:n,cwd:s}=e;return{scopeKey:s,cwd:s,writable:!0,provenance:!1,filtersHidden:!0,preview:"canvas",editable:!1,list(m,p){return n.readFileTree(s,{path:m===""?void 0:m,showHidden:p.showHidden})}}}function we(e){return Array.from(e).includes("Files")}function st(e){const n=Array.from(e.items??[]);if(!(n.length>0&&n.every(l=>"webkitGetAsEntry"in l)))return{files:Array.from(e.files??[]),folders:0};const m=[];let p=0;for(const l of n){if(l.kind!=="file")continue;const o=l.webkitGetAsEntry();if(o!=null&&o.isDirectory){p+=1;continue}const g=l.getAsFile();g&&m.push(g)}return{files:m,folders:p}}const hn=12;function pn({row:e,selected:n,renaming:s,error:m,onSelect:p,onActivate:l,onRetry:o,onSubmitRename:g,onCancelRename:r,onNewFile:f,onNewFolder:u,onStartRename:E,onDelete:P,onMove:N,onCopyInto:U,onCopy:b,onPaste:K,onDuplicate:$,canPasteInto:C,revealLabel:h,onReveal:x,onAddToChat:w,onCopyPath:k,readOnly:T=!1,provenance:O=!1,copyable:A=!0,onDisk:L=!0,onUpload:H,onPickUpload:Y}){const{entry:F,depth:y,expanded:v,loading:M}=e,d=F.type==="dir",c=d?F.path:G(F.path),[D,j]=a.useState(!1),q=!d&&y===0&&Ne(F.name),S=Wt(F.lastCommit),z=t.jsxs("div",{role:"treeitem","aria-label":F.name,"aria-expanded":d?v:void 0,"aria-selected":n,tabIndex:-1,onKeyDown:R=>{(R.key==="Enter"||R.key===" ")&&(R.preventDefault(),p(F),l(F))},draggable:!s&&!T,onDragStart:R=>{T||(R.dataTransfer.setData("text/plain",F.path),R.dataTransfer.setData(yt,F.path),R.dataTransfer.effectAllowed="copyMove")},onDragOver:R=>{if(R.stopPropagation(),!T&&H&&we(R.dataTransfer.types)){R.preventDefault(),R.dataTransfer.dropEffect="copy",j(!0);return}T||!d||!Qe(R.dataTransfer.types)||(R.preventDefault(),R.dataTransfer.dropEffect=R.altKey&&A?"copy":"move",j(!0))},onDragLeave:()=>j(!1),onDrop:R=>{if(R.stopPropagation(),T)return;if(j(!1),H&&we(R.dataTransfer.types)){R.preventDefault();const{files:te}=st(R.dataTransfer);H(c,te);return}if(!d)return;const W=qe(R.dataTransfer);W!==null&&(R.preventDefault(),R.altKey&&A?U(W,F.path):N(W,F.path))},onClick:()=>{p(F),l(F)},className:Oe("flex w-full cursor-pointer items-center gap-1 py-1 pr-2 text-sm transition-colors",n?"bg-accent text-foreground":"hover:bg-accent/50",D&&"ring-ring/60 bg-accent ring-1"),style:{paddingLeft:y*hn+8},children:[t.jsx("span",{className:"flex size-4 flex-shrink-0 items-center justify-center",children:d&&(M?t.jsx(Fe,{size:"xs",className:"text-muted-foreground"}):m?t.jsx("button",{type:"button","aria-label":"Retry loading",title:"Couldn’t load. Retry",onClick:R=>{R.stopPropagation(),o()},className:"flex items-center justify-center",children:t.jsx(Ke,{className:"text-destructive size-3.5"})}):v?t.jsx(pt,{className:"text-muted-foreground size-3.5"}):t.jsx(He,{className:"text-muted-foreground size-3.5"}))}),d?v?t.jsx(mt,{className:"size-(--size-icon-sm) flex-shrink-0 text-sky-500"}):t.jsx(be,{className:"size-(--size-icon-sm) flex-shrink-0 text-sky-500"}):F.isSymlink===!0?t.jsx(xt,{className:"text-muted-foreground size-(--size-icon-sm) flex-shrink-0"}):t.jsx(Ue,{className:"text-muted-foreground size-(--size-icon-sm) flex-shrink-0"}),s?t.jsx(mn,{initialName:F.name,onSubmit:R=>g(F,R),onCancel:r}):t.jsx("span",{className:"min-w-0 flex-1 truncate",children:F.name}),q&&!s&&t.jsx(gt,{"aria-label":"Pinned to the top",className:"text-muted-foreground/60 size-3 flex-shrink-0"}),O&&!s&&t.jsx("span",{className:"text-muted-foreground/70 text-2xs max-w-[45%] flex-shrink-0 truncate tabular-nums",title:S.title??void 0,children:S.label})]});return T?z:t.jsxs(vt,{children:[t.jsx(Ct,{asChild:!0,children:z}),t.jsxs(bt,{className:"w-52",children:[t.jsx(X,{movesFocus:!0,onClick:()=>f(c),children:"New file"}),t.jsx(X,{movesFocus:!0,onClick:()=>u(c),children:"New folder"}),Y&&t.jsx(X,{onClick:()=>Y(c),children:"Upload files…"}),L&&t.jsxs(t.Fragment,{children:[t.jsx(ue,{}),h&&t.jsx(X,{onClick:()=>x(F),children:h}),t.jsx(X,{movesFocus:!0,onClick:()=>w(F),children:"Add to chat"})]}),A&&t.jsxs(t.Fragment,{children:[t.jsx(ue,{}),t.jsx(X,{onClick:()=>b(F),children:"Copy"}),t.jsx(X,{disabled:!C(c),onClick:()=>K(c),children:"Paste"}),t.jsx(X,{onClick:()=>$(F),children:"Duplicate"})]}),t.jsx(ue,{}),L?t.jsxs(t.Fragment,{children:[t.jsx(X,{onClick:()=>k(F,"absolute"),children:"Copy path"}),t.jsx(X,{onClick:()=>k(F,"relative"),children:"Copy relative path"})]}):t.jsx(X,{onClick:()=>k(F,"relative"),children:"Copy path"}),t.jsx(ue,{}),t.jsx(X,{movesFocus:!0,onClick:()=>E(F),children:"Rename"}),t.jsx(X,{variant:"destructive",onClick:()=>P(F),children:"Delete"})]})]})}function mn({initialName:e,onSubmit:n,onCancel:s}){const m=a.useRef(null),[p,l]=a.useState(e);a.useEffect(()=>{const g=m.current;if(!g)return;g.focus();const r=e.lastIndexOf(".");g.setSelectionRange(0,r>0?r:e.length)},[e]);const o=()=>{const g=p.trim();g&&g!==e?n(g):s()};return t.jsx("input",{ref:m,type:"text",value:p,"aria-label":"New name",onChange:g=>l(g.target.value),onClick:g=>g.stopPropagation(),onBlur:o,onKeyDown:g=>{g.stopPropagation(),g.key==="Enter"?o():g.key==="Escape"&&s()},className:"border-border bg-background min-w-0 flex-1 rounded border px-1 py-0 text-sm outline-none"})}const xn=100,gn=28,yn=250;function vn(e){const{rows:n,selectedPath:s,renamingPath:m,errorPaths:p,onSelectPath:l,onRetryDir:o}=e,g=a.useRef(null),r=I(y=>y.setScrollTop),f=I(y=>y.scopeKey),u=a.useCallback(y=>y.type==="dir"?e.onToggle(y):e.onOpen(y),[e]),E=bn(e,u),P=n.length>xn,N=wt({count:n.length,getScrollElement:()=>g.current,estimateSize:()=>gn,overscan:12,enabled:P}),U=a.useRef({scope:void 0,done:!1}),b=a.useRef(null);a.useLayoutEffect(()=>{const y=U.current;if(y.scope!==f&&(y.scope=f,y.done=!1),y.done||n.length===0)return;const v=g.current;if(!v)return;const M=I.getState().scrollTop;if(M<=0){y.done=!0;return}P?N.scrollToOffset(M):v.scrollTop=M,b.current=v.scrollTop,v.scrollTop>=M&&(y.done=!0)},[n.length,f,P,N]);const K=a.useRef(null),$=a.useRef(null),C=a.useCallback(()=>{const y=g.current;y&&y.scrollTop!==b.current&&(U.current.done=!0,K.current=y.scrollTop,$.current&&clearTimeout($.current),$.current=setTimeout(()=>{$.current=null,K.current!==null&&r(K.current)},yn))},[r]);a.useEffect(()=>()=>{$.current&&clearTimeout($.current),K.current!==null&&r(K.current)},[r]);const h=a.useRef(void 0);a.useEffect(()=>{var d,c;const y=h.current;if(h.current=s,y===void 0||s===y||s===null)return;const v=n.findIndex(D=>D.entry.path===s);if(v<0)return;const M=g.current;M&&(P?N.scrollToIndex(v,{align:"auto"}):(c=(d=M.querySelector(`[data-row-index="${v}"]`))==null?void 0:d.scrollIntoView)==null||c.call(d,{block:"nearest"}),b.current=M.scrollTop)},[s,n,P,N]);const[x,w]=a.useState(!1),{onCopyInto:k,onMove:T}=e,O=e.readOnly===!0,A=e.copyable!==!1,L=a.useCallback(y=>{O||!Qe(y.dataTransfer.types)||(y.preventDefault(),y.dataTransfer.dropEffect=y.altKey&&A?"copy":"move",w(!0))},[O,A]),H=a.useCallback((y,v)=>{const M=n.find(d=>d.entry.path===y);M&&k({path:y,isDir:M.entry.type==="dir"},v)},[n,k]),Y=a.useCallback(y=>{if(w(!1),O)return;const v=qe(y.dataTransfer);v!==null&&(y.preventDefault(),y.altKey&&A?H(v,Q):T(v,Q))},[H,T,O,A]),F=y=>t.jsx(pn,{row:y,selected:y.entry.path===s,renaming:y.entry.path===m,error:y.entry.type==="dir"&&y.expanded&&p.has(y.entry.path),onSelect:v=>l(v.path),onActivate:u,onRetry:()=>o(y.entry.path),onSubmitRename:e.onSubmitRename,onCancelRename:e.onCancelRename,onStartRename:e.onStartRename,onNewFile:e.onNewFile,onNewFolder:e.onNewFolder,onDelete:e.onDelete,onMove:e.onMove,onCopyInto:H,onCopy:e.onCopy,onPaste:e.onPaste,onDuplicate:e.onDuplicate,canPasteInto:e.canPasteInto,revealLabel:e.revealLabel,onReveal:e.onReveal,onAddToChat:e.onAddToChat,onCopyPath:e.onCopyPath,readOnly:e.readOnly,provenance:e.provenance,copyable:e.copyable,onDisk:e.onDisk,onUpload:e.onUpload,onPickUpload:e.onPickUpload});return t.jsx("div",{ref:g,role:"tree","aria-label":"File explorer",tabIndex:0,onKeyDown:E,onScroll:C,onDragOver:L,onDragLeave:()=>w(!1),onDrop:Y,className:Oe("focus-visible:ring-ring/40 h-full overflow-auto outline-none focus-visible:ring-1 focus-visible:ring-inset",x&&"ring-ring/60 bg-accent/30 ring-1 ring-inset"),children:P?t.jsx("div",{style:{height:N.getTotalSize()},className:"relative w-full",children:N.getVirtualItems().map(y=>t.jsx("div",{"data-row-index":y.index,className:"absolute top-0 left-0 w-full",style:{transform:`translateY(${y.start}px)`},children:F(n[y.index])},n[y.index].entry.path))}):n.map((y,v)=>t.jsx("div",{"data-row-index":v,children:F(y)},y.entry.path))})}function Cn(e){return e?e.type==="dir"?e.path:G(e.path):Q}function bn(e,n){const{rows:s,selectedPath:m,renamingPath:p,onSelectPath:l}=e;return a.useCallback(o=>{var f,u,E,P;if(p!==null)return;const g=s.findIndex(N=>N.entry.path===m),r=g>=0?s[g]:void 0;if(o.metaKey||o.ctrlKey){if(e.readOnly===!0||e.copyable===!1)return;const N=o.key.toLowerCase();if(N==="c"&&r){o.preventDefault(),e.onCopy(r.entry);return}if(N==="v"){o.preventDefault(),e.onPaste(Cn(r==null?void 0:r.entry));return}return}switch(o.key){case"ArrowDown":o.preventDefault(),l(((f=s[Math.min(g+1,s.length-1)])==null?void 0:f.entry.path)??((u=s[0])==null?void 0:u.entry.path));break;case"ArrowUp":o.preventDefault(),l(((E=s[Math.max(g-1,0)])==null?void 0:E.entry.path)??((P=s[0])==null?void 0:P.entry.path));break;case"ArrowRight":(r==null?void 0:r.entry.type)==="dir"&&!r.expanded&&(o.preventDefault(),e.onToggle(r.entry));break;case"ArrowLeft":if(!r)break;if(o.preventDefault(),r.entry.type==="dir"&&r.expanded)e.onToggle(r.entry);else{const N=G(r.entry.path);N&&l(N)}break;case"Enter":r&&(o.preventDefault(),n(r.entry));break;case"F2":r&&e.readOnly!==!0&&(o.preventDefault(),e.onStartRename(r.entry));break;case"Delete":case"Backspace":r&&e.readOnly!==!0&&(o.preventDefault(),e.onDelete(r.entry));break}},[s,m,p,l,e,n])}const wn={rename:"Rename it anyway",move:"Move it anyway",delete:"Delete it anyway",upload:"Upload mine over it"},kn={rename:"nothing was renamed",move:"nothing was moved",delete:"nothing was deleted",upload:"nothing was uploaded"};function jn(e){const{entry:n,fileCount:s,moreThan:m}=e,p="The room’s history keeps a copy, so an agent or git can bring it back if you need it.";if(n.type!=="dir")return`“${n.name}” leaves the room’s files. ${p}`;const l=s===null?"everything in it":m?`the more than ${s.toLocaleString()} files in it`:s===1?"the 1 file in it":`the ${s.toLocaleString()} files in it`;return`“${n.name}” and ${l} leave the room’s files. ${p}`}function Dn({changes:e,onOpenTheirs:n,onReturnFocus:s}){var f;const m=u=>{u.preventDefault();const E=document.activeElement;E!==null&&E!==document.body||s()},{pendingDelete:p,pendingClash:l,conflict:o}=e,g=l===null?"":l.dir===Q?"The top folder":`“${l.dir}”`,r=(l==null?void 0:l.names.length)===1;return t.jsxs(t.Fragment,{children:[t.jsx(fe,{open:p!==null,onOpenChange:u=>!u&&e.cancelDelete(),children:t.jsxs(he,{onCloseAutoFocus:m,children:[t.jsxs(pe,{children:[t.jsx(me,{children:(p==null?void 0:p.entry.type)==="dir"?"Delete this folder?":"Delete this file?"}),t.jsx(xe,{children:p===null?"":jn(p)})]}),t.jsxs(ge,{children:[t.jsx(ye,{onClick:e.cancelDelete,children:"Cancel"}),t.jsx(ve,{onClick:()=>void e.confirmDelete(),className:"bg-destructive hover:bg-destructive/90 dark:bg-destructive/60 text-white",children:"Delete"})]})]})}),t.jsx(fe,{open:l!==null,onOpenChange:u=>!u&&e.cancelClash(),children:t.jsxs(he,{onCloseAutoFocus:m,children:[t.jsxs(pe,{children:[t.jsx(me,{children:r?`Replace “${l==null?void 0:l.names[0]}”?`:`Replace ${(l==null?void 0:l.names.length)??0} files?`}),t.jsx(xe,{children:r?`${g} already has a file with this name. Replace it with yours, or keep both and add yours under a new name.`:`${g} already has files with these names: ${(l==null?void 0:l.names.join(", "))??""}. Replace them with yours, or keep both and add yours under new names.`})]}),t.jsxs(ge,{children:[t.jsx(ye,{onClick:e.cancelClash,children:"Cancel"}),t.jsx(B,{variant:"outline",onClick:()=>void e.resolveClash("keep-both"),children:"Keep both"}),t.jsx(ve,{onClick:()=>void e.resolveClash("replace"),children:"Replace"})]})]})}),t.jsx(fe,{open:o!==null,onOpenChange:u=>!u&&e.dismissConflict(),children:t.jsxs(he,{onCloseAutoFocus:m,children:[t.jsxs(pe,{children:[t.jsx(me,{children:"Somebody changed this first"}),t.jsx(xe,{children:o===null?"":`${((f=o.lastCommit)==null?void 0:f.author)??"Somebody"} changed “${o.path}” after you opened it, so ${kn[o.kind]}.`})]}),(o==null?void 0:o.lastCommit)&&t.jsxs("p",{className:"text-muted-foreground text-xs",children:[o.lastCommit.subject," · ",kt(o.lastCommit.at)]}),t.jsxs(ge,{children:[t.jsx(ye,{onClick:e.dismissConflict,children:"Cancel"}),t.jsx(B,{variant:"outline",onClick:()=>{o!==null&&(e.dismissConflict(),n(o.path))},children:"Open their version"}),t.jsx(ve,{onClick:()=>{o!==null&&(e.dismissConflict(),o.retry())},className:"bg-destructive hover:bg-destructive/90 dark:bg-destructive/60 text-white",children:o===null?"":wn[o.kind]})]})]})})]})}function Le(e,n){return n.name===e?Ge(e):`There’s already “${n.name}” there, and a name that differs only in capital letters is the same ${n.type==="dir"?"folder":"file"} on some computers. Pick another name.`}const En="Folders can’t be uploaded whole. Open the folder and drop the files inside it.";function Rn({source:e,className:n,onCommands:s}={}){var te;const m=ne(),p=Te(i=>i.selectedCwd),l=a.useMemo(()=>p?fn({transport:m,cwd:p}):null,[m,p]),o=e===void 0?l:e,g=o!==null&&!o.writable,r=un(o),f=r.changes,u=ae(),E=I(i=>i.showHidden),{rows:P,rootLoading:N,rootError:U,errorPaths:b}=r,K=I(i=>i.setCommands),$=I(i=>i.selectedPath),C=I(i=>i.setSelectedPath),h=I(i=>i.clipboard),[x,w]=a.useState(null),[k,T]=a.useState(null),[O,A]=a.useState(null),L=a.useCallback(i=>A(i===null?null:{path:i,isNew:!1}),[]),H=a.useRef(null),Y=a.useRef(Q),[F,y]=a.useState(!1),v=a.useCallback((i,_)=>{if(f!==null){if(_.length===0){J.error(En);return}r.ensureExpanded(i),f.upload(i,_)}},[f,r]),M=a.useRef(null),d=a.useCallback(()=>{var i,_;(_=(i=M.current)==null?void 0:i.querySelector('[role="tree"]'))==null||_.focus()},[]),c=a.useCallback(i=>{var _;Y.current=i,(_=H.current)==null||_.click()},[]),D=a.useCallback(i=>h!==null&&!(h.isDir&&Ce(i,h.path)),[h]),j=a.useCallback((i,_)=>{r.ensureExpanded(i),_e.flushSync(()=>{T(null),w({parent:i,type:_})})},[r]),q=a.useCallback(i=>{_e.flushSync(()=>T(i.path))},[]),S=a.useRef({startCreate:j,reload:r.reload,pickUpload:c});a.useEffect(()=>{S.current={startCreate:j,reload:r.reload,pickUpload:c}});const z=f!==null;a.useEffect(()=>{if(g||s===void 0&&z)return;const i=s??K;return i({newFile:()=>S.current.startCreate(Q,"file"),newFolder:()=>S.current.startCreate(Q,"dir"),refresh:()=>S.current.reload(),...z&&{upload:()=>S.current.pickUpload(Q)}}),()=>i(null)},[K,s,g,z]);const R=a.useCallback(async i=>{var re;if(!x||o===null)return;const _=x;if(w(null),f!==null){const Z=(((re=u.getQueryData(ie(o,_.parent,E)))==null?void 0:re.entries)??[]).find(je=>je.name.toLowerCase()===i.toLowerCase());if(_.type==="dir"){if(Z!==void 0&&!(Z.type==="dir"&&Z.name===i)){J.error(Le(i,Z));return}w({parent:ee(_.parent,i),type:"file",firstInFolder:i});return}if(Z!==void 0){J.error(Le(i,Z));return}const de=ee(_.parent,i);A({path:de,isNew:!0});return}await r.createEntry(_.parent,i,_.type)&&C(ee(_.parent,i))},[x,o,f,u,E,r,C]),W=a.useCallback(async(i,_)=>{T(null),(f?await f.renameEntry(i,_):await r.renameEntry(i,_))&&C(ee(G(i.path),_))},[f,r,C]);return o===null?e!==void 0?null:t.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-6 text-center text-sm",children:"Select a working directory to browse its files."}):t.jsxs("div",{ref:M,className:Oe("flex h-full flex-col",F&&"ring-ring/60 bg-accent/30 ring-1 ring-inset",n),onDragOver:i=>{f===null||!we(i.dataTransfer.types)||(i.preventDefault(),i.dataTransfer.dropEffect="copy",y(!0))},onDragLeave:i=>{i.currentTarget.contains(i.relatedTarget)||y(!1)},onDrop:i=>{y(!1),!(f===null||!we(i.dataTransfer.types))&&(i.preventDefault(),v(Q,st(i.dataTransfer).files))},children:[f!==null&&t.jsx("input",{ref:H,type:"file",multiple:!0,hidden:!0,"aria-hidden":!0,tabIndex:-1,"data-testid":"room-files-upload-input",onChange:i=>{const _=Array.from(i.target.files??[]);i.target.value="",v(Y.current,_)}}),t.jsxs("div",{className:"min-h-0 flex-1",children:[x&&t.jsx(Nn,{type:x.type,firstInFolder:x.firstInFolder,onSubmit:i=>void R(i),onCancel:()=>w(null)},`${x.parent}:${x.type}:${x.firstInFolder??""}`),N&&P.length===0?t.jsx("div",{className:"flex h-20 items-center justify-center",children:t.jsx(Fe,{size:"md",className:"text-muted-foreground",label:"Loading files"})}):U&&P.length===0?t.jsxs("div",{className:"text-muted-foreground flex h-20 flex-col items-center justify-center gap-2 text-xs",children:[t.jsx("span",{children:"Couldn’t load files."}),t.jsxs(B,{variant:"outline",size:"xs",onClick:r.reload,children:[t.jsx(Ke,{}),"Retry"]})]}):P.length===0&&!x?t.jsx("div",{className:"text-muted-foreground/60 flex h-20 items-center justify-center px-4 text-center text-xs",children:f!==null?"No files yet. Drop files here, or use Upload.":"Empty directory"}):t.jsx(vn,{rows:P,selectedPath:$,renamingPath:k,errorPaths:b,onSelectPath:C,onToggle:r.toggleExpand,onOpen:i=>{o.preview==="inline"?L(i.path):r.openFile(i)},onRetryDir:r.retryDir,onSubmitRename:(i,_)=>void W(i,_),onCancelRename:()=>T(null),onStartRename:q,onNewFile:i=>j(i,"file"),onNewFolder:i=>j(i,"dir"),onDelete:i=>f?f.requestDelete(i):void r.removeEntry(i),onMove:(i,_)=>void(f?f.moveEntry(i,_):r.moveEntry(i,_)),onCopyInto:(i,_)=>void r.copyEntry(i,_),onCopy:r.copyToClipboard,onPaste:i=>{h&&r.copyEntry(h,i)},onDuplicate:i=>void r.copyEntry({path:i.path,isDir:i.type==="dir"},G(i.path)),canPasteInto:D,readOnly:g,provenance:o.provenance,copyable:f===null,onDisk:o.cwd!==null,onUpload:f?v:void 0,onPickUpload:f?c:void 0,revealLabel:r.revealLabel,onReveal:i=>void r.reveal(i),onAddToChat:r.addToChat,onCopyPath:(i,_)=>void r.copyPath(i,_)})]}),o.preview==="inline"&&t.jsx(Gt,{source:o,path:(O==null?void 0:O.path)??null,isNew:(O==null?void 0:O.isNew)??!1,onCreated:()=>{O!==null&&(A({path:O.path,isNew:!1}),C(O.path))},onClose:()=>A(null)}),f!==null&&t.jsx(Dn,{changes:f,onOpenTheirs:i=>L(i),onReturnFocus:d}),t.jsx(fe,{open:r.pendingRecursiveDelete!==null,onOpenChange:i=>!i&&r.cancelRecursiveDelete(),children:t.jsxs(he,{children:[t.jsxs(pe,{children:[t.jsx(me,{children:"Delete this folder?"}),t.jsxs(xe,{children:["“",(te=r.pendingRecursiveDelete)==null?void 0:te.name,"” isn’t empty. Deleting it removes everything inside. This can’t be undone."]})]}),t.jsxs(ge,{children:[t.jsx(ye,{onClick:r.cancelRecursiveDelete,children:"Cancel"}),t.jsx(ve,{onClick:()=>void r.confirmRecursiveDelete(),className:"bg-destructive hover:bg-destructive/90 dark:bg-destructive/60 text-white",children:"Delete"})]})]})})]})}function Nn({type:e,firstInFolder:n,onSubmit:s,onCancel:m}){const p=a.useRef(null),[l,o]=a.useState("");a.useEffect(()=>{var f;(f=p.current)==null||f.focus()},[]);const g=()=>{const f=l.trim();f?s(f):m()},r=t.jsxs("div",{className:"flex items-center gap-1",children:[e==="dir"?t.jsx(be,{className:"size-(--size-icon-sm) flex-shrink-0 text-sky-500"}):t.jsx(Ue,{className:"text-muted-foreground size-(--size-icon-sm) flex-shrink-0"}),t.jsx("input",{ref:p,type:"text",value:l,"aria-label":n!==void 0?`First file in ${n}`:e==="dir"?"New folder name":"New file name",placeholder:e==="dir"?"folder-name":"file-name",onChange:f=>o(f.target.value),onBlur:g,onKeyDown:f=>{f.key==="Enter"?g():f.key==="Escape"&&m()},className:"border-border bg-background min-w-0 flex-1 rounded border px-1 py-0 text-sm outline-none"})]});return n===void 0?t.jsx("div",{className:"px-3 py-1",children:r}):t.jsxs("div",{className:"space-y-1 px-3 py-1",children:[t.jsxs("p",{className:"text-muted-foreground flex min-w-0 items-center gap-1 text-xs",children:[t.jsx(be,{className:"size-(--size-icon-xs) flex-shrink-0 text-sky-500"}),t.jsx("span",{className:"truncate",children:n})]}),r,t.jsx("p",{className:"text-muted-foreground text-2xs",children:"Name its first file. The folder appears when you save it."})]})}function at(){const e=I(m=>m.showHidden),n=I(m=>m.setShowHidden),s=e?"Hide hidden files":"Show hidden files";return t.jsx(B,{variant:"ghost",size:"icon-xs","aria-label":s,title:s,onClick:()=>n(!e),children:e?t.jsx(jt,{className:"text-muted-foreground"}):t.jsx(Dt,{className:"text-muted-foreground"})})}function Sn({cwd:e}){const n=ne(),{data:s}=le({queryKey:["file-explorer","workspace",e],queryFn:()=>n.resolveWorkspace(e),staleTime:6e4});return s!=null&&s.branch?t.jsxs("span",{className:"text-muted-foreground bg-muted/50 text-2xs inline-flex min-w-0 items-center gap-1 rounded px-1.5 py-0.5",title:`Workspace ${s.key} on ${s.branch}`,children:[t.jsx(Be,{className:"size-3 flex-shrink-0"}),t.jsx("span",{className:"truncate",children:s.branch})]}):null}function zn(){const e=Te(s=>s.selectedCwd),n=I(s=>s.commands);return e?t.jsxs(t.Fragment,{children:[t.jsx(Sn,{cwd:e}),t.jsx(B,{variant:"ghost",size:"icon-xs","aria-label":"New file",title:"New file",onClick:()=>n==null?void 0:n.newFile(),children:t.jsx(et,{className:"text-muted-foreground"})}),t.jsx(B,{variant:"ghost",size:"icon-xs","aria-label":"New folder",title:"New folder",onClick:()=>n==null?void 0:n.newFolder(),children:t.jsx(Ye,{className:"text-muted-foreground"})}),t.jsx(at,{}),t.jsx(B,{variant:"ghost",size:"icon-xs","aria-label":"Refresh",title:"Refresh",onClick:()=>n==null?void 0:n.refresh(),children:t.jsx(Et,{className:"text-muted-foreground"})})]}):null}function Tn({roomId:e}){const n=ne(),s=ae(),m=le(We(n,e));a.useEffect(()=>Vt(s,e,()=>{s.invalidateQueries({queryKey:Ee.repoStatus(e)})}),[s,e]);const p=a.useMemo(()=>{var r;return((r=m.data)==null?void 0:r.kind)==="ok"?Rt(m.data.status):[]},[m.data]),l=Nt(p),o=St(p);if(!o)return null;const g=p.map((r,f)=>`${l[f]}: ${Tt(r)}`);return t.jsxs("span",{"data-slot":"pending-work-badge",title:g.join(`
17
- `),className:"text-muted-foreground bg-muted/50 text-2xs inline-flex min-w-0 items-center gap-1 rounded px-1.5 py-0.5",children:[t.jsx(Be,{className:"size-3 flex-shrink-0"}),t.jsxs("span",{className:"sr-only",children:["Not merged into the room yet. ",g.join(". "),"."]}),t.jsx("span",{"aria-hidden":"true",className:"truncate",children:o})]})}const Fn={added:"added",modified:"changed",deleted:"deleted",untracked:"new"},On=new Map([["OPERATOR_ONLY","Only the person who owns this DorkOS can decide what happens to those changes."],["ROOM_FILE_NOT_FOUND","One of those changes is not there any more, so nothing was discarded. The list below has been refreshed."],["MERGE_IN_FLIGHT","Something else is writing to this room’s files right now. Nothing was changed. Try again in a moment."],["MAIN_CHECKOUT_DIRTY","This room’s files are on another branch, which DorkOS will not move for you. Put them back on main yourself."],["ROOM_REPO_GIT_UNAVAILABLE","This computer doesn’t have git installed, and a room’s files are a git repository."],["ROOM_HAS_NO_REPO","This room does not have files of its own any more."],["ROOM_REPOS_DISABLED","Rooms cannot have files of their own on this install right now."]]);function Pn({roomId:e}){var K,$;const n=ne(),s=ae(),m=le(We(n,e)),[p,l]=a.useState([]),[o,g]=a.useState(!1),[r,f]=a.useState(null),u=Ft({mutationFn:C=>n.repairRoomMain(e,C),onSuccess:()=>{l([]),g(!1),f(null),s.invalidateQueries({queryKey:Ee.repoStatus(e)})},onError:C=>{g(!1);const h=On.get(Ot(C)??"");f(h??"That didn’t work. Try again in a moment."),s.invalidateQueries({queryKey:Ee.repoStatus(e)})}});if(((K=m.data)==null?void 0:K.kind)==="unavailable")return t.jsx("p",{role:"alert","data-slot":"room-main-warning",className:"border-border/60 text-muted-foreground rounded-lg border px-3 py-2.5 text-xs",children:"DorkOS couldn’t check whether this room’s files are in order. If saving here is refused, this is why. Try again in a moment."});const E=(($=m.data)==null?void 0:$.kind)==="ok"?m.data.status.main:void 0;if(E===void 0||!E.dirty)return null;const P=E.branch!=="main",N=p.filter(C=>E.strays.some(h=>h.path===C)),U=o&&N.length>0,b=C=>l(h=>h.includes(C)?h.filter(x=>x!==C):[...h,C]);return t.jsxs("div",{role:"alert","data-slot":"room-main-warning",className:"border-border/60 bg-muted/40 space-y-3 rounded-lg border px-3 py-2.5 text-sm",children:[t.jsxs("div",{className:"flex gap-2",children:[t.jsx(Pt,{className:"text-muted-foreground mt-0.5 size-(--size-icon-sm) flex-shrink-0"}),t.jsxs("div",{className:"min-w-0 space-y-1",children:[t.jsx("p",{className:"font-medium",children:"Somebody changed this room’s files outside DorkOS"}),t.jsx("p",{className:"text-muted-foreground text-xs",children:P?`This room’s files are on ${E.branch??"no branch"} instead of main. Nobody can save a file here and no agent can merge into it until they are back on main. DorkOS will not move a branch it did not move, in case there is work on it.`:"Nobody can save a file here, and no agent can merge its work in, until these are dealt with."})]})]}),!P&&t.jsxs(t.Fragment,{children:[t.jsx("ul",{className:"space-y-1.5",children:E.strays.map(C=>t.jsxs("li",{className:"flex items-center gap-2",children:[t.jsx(Mt,{id:`stray-${e}-${C.path}`,checked:N.includes(C.path),onCheckedChange:()=>b(C.path),disabled:u.isPending}),t.jsx("label",{htmlFor:`stray-${e}-${C.path}`,className:"min-w-0 flex-1 cursor-pointer truncate font-mono text-xs",title:C.path,children:C.path}),t.jsx("span",{className:"text-muted-foreground flex-shrink-0 text-xs",children:Fn[C.kind]})]},C.path))}),E.strayCount>E.strays.length&&t.jsxs("p",{className:"text-muted-foreground text-xs",children:["…and ",E.strayCount-E.strays.length," more, not listed here. Keeping them all still keeps every one."]}),U?t.jsxs("div",{className:"space-y-2",children:[t.jsx("p",{className:"text-xs",children:N.length===1?"Throw away that change? It cannot be brought back.":`Throw away those ${N.length} changes? They cannot be brought back.`}),t.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.jsx(B,{type:"button",variant:"ghost",size:"sm",disabled:u.isPending,onClick:()=>g(!1),children:"Cancel"}),t.jsx(B,{type:"button",variant:"destructive",size:"sm",disabled:u.isPending,onClick:()=>u.mutate({action:"discard",paths:[...N]}),children:"Yes, discard"})]})]}):t.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.jsx(B,{type:"button",variant:"outline",size:"sm",disabled:u.isPending,onClick:()=>u.mutate({action:"commit"}),children:"Keep them all"}),t.jsx(B,{type:"button",variant:"ghost",size:"sm",disabled:u.isPending||N.length===0,onClick:()=>g(!0),children:N.length===0?"Discard…":`Discard ${N.length}`})]})]}),r!==null&&t.jsx("p",{className:"text-destructive text-xs",children:r})]})}const De="pointer-coarse:size-11";function Ln({roomId:e,canChange:n}){const s=ne(),m=ae(),p=I(P=>P.showHidden),[l,o]=a.useState(null),g=a.useMemo(()=>Ze({transport:s,queryClient:m,roomId:e,canChange:n}),[s,m,e,n]),r=le(ke(g,Q,p,m)),f=r.isSuccess&&r.data.absent!==!0||r.isError,[u,E]=a.useState(null);return f&&u!==e&&E(e),!f&&u!==e?null:t.jsxs("section",{"aria-label":"Room files",className:"space-y-2",children:[t.jsxs("header",{className:"flex items-center gap-2",children:[t.jsx(_t,{className:"text-muted-foreground size-(--size-icon-sm) flex-shrink-0"}),t.jsx("h3",{className:"text-muted-foreground text-xs font-medium tracking-wide uppercase",children:"Files"}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx(Tn,{roomId:e})}),n&&t.jsxs(t.Fragment,{children:[t.jsx(B,{variant:"ghost",size:"icon-xs",className:De,"aria-label":"New file",title:"New file",disabled:l===null,onClick:()=>l==null?void 0:l.newFile(),children:t.jsx(et,{className:"text-muted-foreground"})}),t.jsx(B,{variant:"ghost",size:"icon-xs",className:De,"aria-label":"New folder",title:"New folder",disabled:l===null,onClick:()=>l==null?void 0:l.newFolder(),children:t.jsx(Ye,{className:"text-muted-foreground"})}),t.jsx(B,{variant:"ghost",size:"icon-xs",className:De,"aria-label":"Upload files",title:"Upload files",disabled:(l==null?void 0:l.upload)===void 0,onClick:()=>{var P;return(P=l==null?void 0:l.upload)==null?void 0:P.call(l)},children:t.jsx(Jt,{className:"text-muted-foreground"})})]}),t.jsx(at,{})]}),t.jsx(Pn,{roomId:e}),t.jsx("div",{"data-slot":"room-files-body",className:"border-border/60 h-72 overflow-hidden rounded-lg border",children:t.jsx(Rn,{source:g,onCommands:o})})]})}function $n({roomId:e,attachment:n}){var f;const s=ne(),m=ae(),p=a.useMemo(()=>Ze({transport:s,queryClient:m,roomId:e}),[s,m,e]),l=le(ke(p,Q,!1,m)),[o,g]=a.useState(!1),r=At(e);return!l.isSuccess||l.data.absent===!0||((f=r.data)==null?void 0:f.archived)!==!1?null:t.jsxs(t.Fragment,{children:[t.jsx(B,{type:"button",variant:"ghost",size:"icon-xs","aria-label":`Save ${n.name} to the room’s files`,title:"Save to room files",className:"text-muted-foreground hover:text-foreground mt-0.5 pointer-coarse:size-11",onClick:()=>g(!0),children:t.jsx(zt,{})}),o&&t.jsx(Mn,{roomId:e,source:p,attachment:n,onClose:()=>g(!1)})]})}function Mn({roomId:e,source:n,attachment:s,onClose:m}){const p=ne(),l=ae(),[o,g]=a.useState(Q),[r,f]=a.useState(s.name),[u,E]=a.useState(null),[P,N]=a.useState(!1),U=a.useId(),b=le(ke(n,o,!1,l)),K=a.useMemo(()=>{var C;return nt(((C=b.data)==null?void 0:C.entries)??[]).filter(h=>h.type==="dir")},[b.data]),$=async()=>{var h,x;const C=r.trim();if(C!==""){N(!0),E(null);try{await p.saveAttachmentToRoomFiles(e,{attachmentId:s.id,dir:o,name:C,baseCommit:((h=b.data)==null?void 0:h.commit)??null}),l.invalidateQueries({queryKey:["file-explorer","tree",n.scopeKey]}),J.success(`Saved ${C} to the room’s files`),m()}catch(w){let k;try{k=Zt(w,l,e)}catch{k={status:"refused",reason:Ve(w)??"That didn’t save. Try again in a moment."}}if(k.status==="exists"){const T=(((x=b.data)==null?void 0:x.entries)??[]).map(O=>O.name);E({reason:`This folder already has a file called “${C}”. Pick another name.`,suggestion:Pe({name:C,isDir:!1,taken:[...T,C]})})}else k.status==="conflict"?(E({reason:"Somebody changed this folder while you were choosing, so nothing was saved. Try again."}),b.refetch()):k.status==="refused"&&E({reason:k.reason})}finally{N(!1)}}};return t.jsx(Lt,{open:!0,onOpenChange:C=>!C&&m(),children:t.jsxs($t,{className:"sm:max-w-md",children:[t.jsxs(It,{children:[t.jsx(Kt,{children:"Save to room files"}),t.jsx(Ht,{children:"Keep this file with the room’s files, where everyone in the room and their agents can find it."})]}),t.jsxs(Ut,{className:"space-y-3",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsx("p",{className:"text-muted-foreground text-xs font-medium",children:"Folder"}),t.jsxs("div",{role:"group","aria-label":"Folders",className:"border-border/60 max-h-56 overflow-auto rounded-md border",children:[t.jsx("p",{className:"bg-muted/40 truncate px-3 py-1.5 font-mono text-xs",children:o===Q?"Top folder":`${o}/`}),o!==Q&&t.jsx($e,{label:"Up one folder",icon:t.jsx(Xt,{className:"text-muted-foreground size-(--size-icon-sm)"}),onClick:()=>g(G(o))}),b.isPending?t.jsx("div",{className:"flex h-12 items-center justify-center",children:t.jsx(Fe,{size:"sm",className:"text-muted-foreground",label:"Loading folders"})}):K.length===0?t.jsx("p",{className:"text-muted-foreground px-3 py-2 text-xs",children:"No folders in here."}):K.map(C=>t.jsx($e,{label:C.name,icon:t.jsx(be,{className:"size-(--size-icon-sm) text-sky-500"}),chevron:!0,onClick:()=>g(ee(o,oe(C.path)))},C.path))]})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx("label",{htmlFor:U,className:"text-muted-foreground text-xs font-medium",children:"Name"}),t.jsx(qt,{id:U,value:r,onChange:C=>{f(C.target.value),E(null)},spellCheck:!1,autoComplete:"off"})]}),u!==null&&t.jsxs("div",{role:"alert",className:"text-destructive space-y-1 text-xs",children:[t.jsx("p",{children:u.reason}),u.suggestion!==void 0&&t.jsxs(B,{type:"button",variant:"outline",size:"xs",onClick:()=>{f(u.suggestion),E(null)},children:["Use “",u.suggestion,"”"]})]})]}),t.jsxs(Qt,{className:"gap-2",children:[t.jsx(B,{type:"button",variant:"ghost",onClick:m,children:"Cancel"}),t.jsx(B,{type:"button",disabled:P||r.trim()===""||b.isPending,onClick:()=>void $(),children:P?"Saving…":o===Q?"Save to the top folder":`Save to ${oe(o)}`})]})]})})}function $e({label:e,icon:n,chevron:s=!1,onClick:m}){return t.jsxs("button",{type:"button",onClick:m,className:"hover:bg-accent/50 focus-visible:bg-accent flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm outline-none",children:[n,t.jsx("span",{className:"min-w-0 flex-1 truncate",children:e}),s&&t.jsx(He,{className:"text-muted-foreground size-3.5"})]})}export{Rn as FileExplorer,zn as FileExplorerActions,Gt as FilePreviewDialog,en as HIDDEN_ENTRY_NAMES,at as HiddenEntriesToggle,Hn as NO_PROVENANCE,Re as PINNED_ENTRY_NAMES,Un as ROOM_FILES_REFRESH_INTERVAL_MS,Ln as RoomFilesSection,$n as SaveToRoomFilesButton,Ze as createRoomFilesSource,fn as createSessionCwdSource,ie as explorerDirQueryKey,ke as explorerDirQueryOptions,tn as isHiddenEntryName,Ne as isPinnedEntryName,nn as pinnedFirst,Wt as provenanceLine,We as roomRepoStatusQueryOptions,nt as withoutHidden};
@@ -1,6 +0,0 @@
1
- import{dz as le,dA as O,aY as ce,dB as Y,aE as G,ah as de,ag as ue,r as d,cZ as me,j as s,dC as he,dD as fe,dE as ge,dF as ye,dG as $,dH as xe,B as x,am as Oe,dI as ve,aD as Ee,aj as _e,dJ as be,dK as Te,dL as pe,dM as Re,dN as I,dO as q,dP as we}from"./index-_1qDsPCM.js";/**
2
- * @license lucide-react v1.47.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const V={name:"share-2",size:24,node:[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]};V.node;const Ne=le(V),Ce=["CONFLICT","COPY_INTO_SELF","DIR_NOT_EMPTY","NOT_FOUND","REFUSE_ROOT","OUTSIDE_BOUNDARY"];function Se(e){const t=O(e);return t!==void 0&&Ce.includes(t)?t:void 0}const De="Can’t copy a folder into itself",Fe={CONFLICT:"That name already exists",COPY_INTO_SELF:De,DIR_NOT_EMPTY:"This folder isn’t empty",NOT_FOUND:"That item no longer exists",REFUSE_ROOT:"Can’t modify the working directory root",OUTSIDE_BOUNDARY:"That path is outside the working directory"};function We(e,t){const i=Se(e);ce.error(i?Fe[i]:t)}const Ae=new Map([["ROOM_UPLOAD_TOO_MANY_FILES",`One upload can carry up to ${Y} files, so nothing was uploaded. Try again with fewer.`],["FILE_TOO_LARGE","A file is bigger than this room allows, so nothing was changed."],["REPO_CAP_EXCEEDED","This room’s files are already as large as they are allowed to get, so nothing was changed. Delete something first."],["MAIN_CHECKOUT_DIRTY","Somebody changed this room’s files outside DorkOS, so changes are paused until that is sorted out. The warning above the files says how."],["MERGE_IN_FLIGHT","Somebody else is changing this room’s files right now, so nothing was changed. Try again in a moment."],["PEOPLE_ONLY","Only a person can change a room’s files this way. An agent brings its work in by merging."],["ROOM_FILE_PATH_INVALID","That name can’t be used in a room’s files, so nothing was changed."],["ROOM_FILE_NOT_READABLE","That isn’t something that can be changed here."],["ROOM_FILE_NOT_FOUND","That isn’t in the room’s files any more, so nothing was changed. The list has been refreshed."],["ATTACHMENT_NOT_FOUND","That file isn’t in this room’s chat any more."],["ROOM_HAS_NO_REPO","This room doesn’t have files of its own any more."],["ROOM_REPOS_DISABLED","Rooms can’t have files of their own on this install right now, so nothing was changed."],["ROOM_REPO_GIT_UNAVAILABLE","This computer doesn’t have git installed, and a room’s files are a git repository."],["ROOM_NOT_FOUND","This room isn’t there any more."],["ROOM_ARCHIVED","This room is archived, so its files can’t be changed."]]),Ie=new Set(["FILE_TOO_LARGE","ROOM_FILE_PATH_INVALID","ROOM_FILE_NOT_READABLE"]);function Le(e){return e.replace(/`([^`]*)`/g,"“$1”").trim()}function Me(e){const t=O(e);if(t===void 0)return;const i=Ae.get(t);if(i!==void 0)return Q(e)??i}function Q(e){const t=O(e);if(!(t===void 0||!Ie.has(t))&&!(!(e instanceof Error)||e.message.trim()===""))return Le(e.message)}function Ze(e){return`There’s already something called “${e}” there, so nothing was changed. Pick another name.`}const je="—";function ke(e){if(e==null)return{label:je,title:null};const t=G(e.at);return{label:`${e.author} · ${t}`,title:`${e.subject} · ${e.author}, ${t}`}}function Pe(e){return/\.(md|markdown|mdx)$/i.test(e)}function Ue(e){return e<1024?`${e} bytes`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function ze(e,t){return e.editable&&e.save!==void 0&&t!==void 0&&t.body.kind==="text"}function et({source:e,path:t,isNew:i=!1,onCreated:a,onClose:c}){const r=e.read,o=de(),n=["file-explorer","preview",e.scopeKey,t],m=ue({queryKey:n,queryFn:()=>r(t),enabled:t!==null&&r!==void 0&&!i}),h=i&&t!==null?{path:t,size:0,commit:null,lastCommit:null,body:{kind:"text",text:""}}:m.data,[v,L]=d.useState(!1),[M,j]=d.useState(null),F=e.showToEveryone,J=d.useCallback(async l=>{if(F!==void 0){L(!0),j(null);try{await F(l),c()}catch(u){j(u instanceof Error&&u.message.trim().length>0?u.message:"DorkOS couldn’t reach the server. Check your connection and try again.")}finally{L(!1)}}},[F,c]),[g,w]=d.useState(i),[b,T]=d.useState(""),[k,N]=d.useState({text:"",commit:null}),[E,y]=d.useState(null),[A,f]=d.useState(null),[P,p]=d.useState(!1),[W,C]=d.useState(!1),U=d.useRef(null),z=d.useRef(null),B=d.useRef(!1),_=g&&b!==k.text,Z=_||g&&i,H=W&&_,S=d.useCallback(()=>{w(!1),T(""),N({text:"",commit:null}),y(null),f(null),p(!1),C(!1)},[]),[ee,te]=d.useState(t);ee!==t&&(te(t),(g||b!==""||E!==null||A!==null||P)&&S(),i&&w(!0));const R=me({mutationFn:l=>e.save({path:t,baseCommit:l.baseCommit,text:l.text}),onSuccess:(l,u)=>{if(l.status==="saved"){N({text:u.text,commit:l.commit}),y(null),f(null),p(!0),i&&(a==null||a()),o.invalidateQueries({queryKey:n}),o.invalidateQueries({queryKey:["file-explorer","tree",e.scopeKey]});return}if(p(!1),l.status==="conflict"){y(re=>({commit:l.commit,lastCommit:l.lastCommit,again:re!==null})),f(null);return}y(null),f(l.reason)},onError:()=>{p(!1),y(null),f("That didn’t save. Try again in a moment.")}}),K=ze(e,h),se=()=>{h===void 0||h.body.kind!=="text"||(T(h.body.text),N({text:h.body.text,commit:h.commit??null}),y(null),f(null),p(!1),w(!0))},ne=()=>{if(i){S(),c();return}w(!1),T(""),y(null),f(null),C(!1)},ie=async()=>{const l=await m.refetch();if(l.isError||l.data===void 0){f("Their version couldn’t be fetched just now, so nothing here changed.");return}const u=l.data;if(u.body.kind!=="text"){f(u.body.kind==="not-readable"?`${u.body.reason} What you typed is still here. Save it over their change, or close this and copy it out first.`:"Their version isn’t something that can be shown here, so nothing here changed.");return}T(u.body.text),N({text:u.body.text,commit:u.commit??null}),y(null),f(null)},oe=()=>{E!==null&&R.mutate({text:b,baseCommit:E.commit})},ae=()=>{if(_){C(!0);return}S(),c()};return d.useEffect(()=>{var l,u;g?(l=U.current)==null||l.focus():B.current&&((u=z.current)==null||u.focus()),B.current=g},[g]),s.jsx(he,{open:t!==null,onOpenChange:l=>!l&&ae(),children:s.jsxs(fe,{className:"max-h-[80vh] sm:max-w-2xl",children:[s.jsxs(ge,{children:[s.jsx(ye,{className:"truncate font-mono text-sm",children:t===null?"":$(t)}),s.jsx(xe,{className:"truncate text-xs",children:i&&t!==null?`${t} · New file`:He(h,t)})]}),!g&&(e.showToEveryone!==void 0||K)&&s.jsxs("div",{className:"flex justify-end gap-1 px-4",children:[e.showToEveryone!==void 0&&t!==null&&s.jsxs(x,{type:"button",variant:"ghost",size:"sm",disabled:v,className:"text-muted-foreground hover:text-foreground gap-1.5",onClick:()=>void J(t),children:[s.jsx(Ne,{className:"size-(--size-icon-xs)"}),v?"Putting it there…":"Put on the canvas"]}),K&&s.jsxs(x,{ref:z,type:"button",variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-foreground gap-1.5",onClick:se,children:[s.jsx(Oe,{className:"size-(--size-icon-xs)"}),"Edit"]})]}),M!==null&&s.jsx("p",{role:"status",className:"text-destructive px-4 pb-1 text-xs",children:M}),E!==null&&s.jsx(Be,{conflict:E,onTakeTheirs:()=>void ie(),onKeepMine:oe,busy:R.isPending||m.isFetching}),A!==null&&s.jsx("p",{role:"alert",className:"bg-destructive/10 text-destructive mx-4 rounded-md px-3 py-2 text-sm",children:A}),s.jsx(ve,{className:"min-h-0 flex-1 overflow-auto",children:m.isPending&&!i?s.jsx("div",{className:"flex h-32 items-center justify-center",children:s.jsx(Ee,{size:"md",className:"text-muted-foreground",label:"Loading the file"})}):m.isError&&!i||h===void 0?s.jsx(D,{children:"This file couldn’t be read."}):g?s.jsx("textarea",{ref:U,"aria-label":`${t===null?"File":$(t)} contents`,value:b,onChange:l=>T(l.target.value),spellCheck:!1,autoComplete:"off",className:_e("text-foreground/90 border-border/60 bg-background field-sizing-content","focus-visible:border-ring focus-visible:ring-ring/50 min-h-64 w-full","resize-none rounded-md border px-3 py-2 font-mono text-xs","whitespace-pre-wrap focus-visible:ring-[3px] focus-visible:outline-none")}):s.jsx(Ke,{file:h})}),g&&s.jsxs(be,{className:"items-center gap-2 sm:justify-between",children:[s.jsx("span",{className:"text-muted-foreground text-xs","aria-live":"polite",children:R.isPending?"Saving…":H?"You haven’t saved your changes.":P&&!_?"Saved":_?"Not saved yet":""}),s.jsx("span",{className:"flex gap-2",children:H?s.jsxs(s.Fragment,{children:[s.jsx(x,{type:"button",variant:"ghost",size:"sm",onClick:()=>C(!1),children:"Keep editing"}),s.jsx(x,{type:"button",variant:"destructive",size:"sm",onClick:()=>{S(),c()},children:"Discard changes"})]}):s.jsxs(s.Fragment,{children:[s.jsx(x,{type:"button",variant:"ghost",size:"sm",onClick:ne,children:_?"Discard":i?"Cancel":"Done"}),s.jsx(x,{type:"button",size:"sm",disabled:!Z||R.isPending||E!==null,onClick:()=>R.mutate({text:b,baseCommit:k.commit}),children:"Save"})]})})]})]})})}function Be({conflict:e,onTakeTheirs:t,onKeepMine:i,busy:a}){const c=e.lastCommit,r=c===null?"Somebody":c.author;return s.jsxs("div",{role:"alert",className:"border-border/60 bg-muted/40 mx-4 space-y-2 rounded-md border px-3 py-2 text-sm",children:[s.jsx("p",{children:e.again?`${r} changed this file again while you were deciding, so it still isn’t saved.`:`${r} changed this file while you were editing it, so nothing was saved.`}),c!==null&&s.jsxs("p",{className:"text-muted-foreground text-xs",children:[c.subject," · ",G(c.at)]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsx(x,{type:"button",variant:"outline",size:"sm",disabled:a,onClick:t,children:"Open their version"}),s.jsx(x,{type:"button",variant:"destructive",size:"sm",disabled:a,onClick:i,children:"Save mine over it"})]}),s.jsx("p",{className:"text-muted-foreground text-xs",children:"Opening theirs replaces what you typed here."})]})}function He(e,t){if(t===null)return"";const i=e===void 0?null:ke(e.lastCommit);return i===null?t:`${t} · ${i.label}`}function Ke({file:e}){switch(e.body.kind){case"text":return Pe(e.path)?s.jsx(pe,{content:e.body.text,className:"text-sm",errorFallback:"This file couldn’t be displayed."}):s.jsx("pre",{className:"text-foreground/90 overflow-x-auto font-mono text-xs whitespace-pre",children:e.body.text});case"binary":return s.jsx(D,{children:"This isn’t a text file, so it can’t be shown or edited here."});case"too-large":return s.jsxs(D,{children:["This file is larger than ",Ue(e.body.maxBytes),", so it isn’t shown here."]});case"not-readable":return s.jsx(D,{children:e.body.reason})}}function D({children:e}){return s.jsxs("div",{className:"text-muted-foreground flex h-32 flex-col items-center justify-center gap-2 px-6 text-center text-sm",children:[s.jsx(Te,{className:"size-(--size-icon-md) opacity-60"}),s.jsx("span",{children:e})]})}const $e=new Map([["REQUEST_TOO_LARGE","That is too much text to send in one go, so nothing was saved. A room’s files are for documents people read. Anything this big belongs in the room’s attachments."],["FILE_TOO_LARGE","This file would be bigger than this room allows, so nothing was saved."],["REPO_CAP_EXCEEDED","This room’s files are already as large as they are allowed to get, so nothing was saved."],["MAIN_CHECKOUT_DIRTY","Somebody changed this room’s files outside DorkOS, so saving is paused until that is sorted out. The warning above the files says how."],["MERGE_IN_FLIGHT","Somebody else is writing to this room’s files right now. Nothing was saved. Try again in a moment."],["PEOPLE_ONLY","Only a person can save a room’s files this way. An agent brings its work in by merging."],["ROOM_FILE_NOT_TEXT","This file has something in it that is not text, so it cannot be saved from here."],["ROOM_FILE_PATH_INVALID","That file name could mean somewhere else, so nothing was saved."],["ROOM_FILE_NOT_FOUND","This file is not in the room’s files any more, so there was nothing to save over."],["ROOM_FILE_NOT_READABLE","This is not a file that can be edited here."],["ROOM_HAS_NO_REPO","This room does not have files of its own any more."],["ROOM_REPOS_DISABLED","Rooms cannot have files of their own on this install right now, so nothing was saved."],["ROOM_REPO_GIT_UNAVAILABLE","This computer doesn’t have git installed, and a room’s files are a git repository."],["ROOM_NOT_FOUND","This room is not there any more."],["ROOM_ARCHIVED","This room is archived, so its files cannot be changed."]]);function Ye(e){return e===void 0?void 0:$e.get(e)}function X(e){if(typeof e!="object"||e===null)return null;const t=Re.safeParse(e.body);return t.success?t.data.conflict:null}const Ge=15e3;function qe(e,t,i){const a=JSON.stringify(I.entries(t));let c=0,r=null;const o=e.getQueryCache().subscribe(n=>{if(n.type!=="updated"||JSON.stringify(n.query.queryKey)!==a||r!==null)return;const m=Math.max(0,Ge-(Date.now()-c));r=setTimeout(()=>{r=null,c=Date.now(),i()},m)});return()=>{r!==null&&clearTimeout(r),o()}}function Ve(e){return{name:e.name,path:e.path,type:e.kind==="dir"?"dir":"file",size:e.size,isSymlink:e.kind==="symlink",lastCommit:e.lastCommit}}const Qe=new Map([["ROOM_FILE_NOT_READABLE","This isn’t a file that can be shown here."],["ROOM_FILE_NOT_FOUND","This file isn’t in the room’s files any more."]]);function tt(e){const{transport:t,queryClient:i,roomId:a,canChange:c=!0}=e,r=async o=>{try{return{status:"changed",commit:(await o()).commit}}catch(n){return Xe(n,i,a)}};return{scopeKey:`room:${a}`,cwd:null,writable:c,provenance:!0,filtersHidden:!1,preview:"inline",async showToEveryone(o){await t.openRoomCanvasDocument(a,{type:"file",sourcePath:o})},editable:c,changes:c?{maxUploadFiles:Y,upload:o=>r(()=>t.uploadRoomFiles(a,{dir:o.dir,baseCommit:o.baseCommit,replace:o.replace,files:o.files})),move:o=>r(()=>t.moveRoomFile(a,o)),remove:o=>r(()=>t.deleteRoomFile(a,o))}:void 0,async list(o){try{const n=await t.readRoomFiles(a,o===""?void 0:o);return{entries:n.entries.map(Ve),commit:n.commit}}catch(n){if(O(n)!==we)throw n;return{entries:[],absent:!0}}},async read(o){try{const n=await t.readRoomFileContent(a,o);return{path:n.path,size:n.size,lastCommit:n.lastCommit,commit:n.commit,body:n.body.kind==="text"?{kind:"text",text:n.body.text}:n.body.kind==="binary"?{kind:"binary"}:{kind:"too-large",maxBytes:n.body.maxBytes}}}catch(n){const m=Qe.get(O(n)??"");if(m===void 0)throw n;return{path:o,size:0,lastCommit:null,commit:null,body:{kind:"not-readable",reason:m}}}},async save(o){try{const n=await t.saveRoomFile(a,{path:o.path,baseCommit:o.baseCommit,text:o.text});return{status:"saved",commit:n.commit,lastCommit:n.lastCommit,committed:n.committed}}catch(n){const m=O(n);if(m===q){const v=X(n);return v!==null?{status:"conflict",commit:v.commit,lastCommit:v.lastCommit}:{status:"refused",reason:"Somebody changed this file while you were editing it, so nothing was saved. Close this and open it again to see their version."}}m==="MAIN_CHECKOUT_DIRTY"&&i.invalidateQueries({queryKey:I.repoStatus(a)});const h=Q(n)??Ye(m);if(h===void 0)throw n;return{status:"refused",reason:h}}},events(o){return qe(i,a,o)}}}function Xe(e,t,i){const a=O(e);if(a===q){const r=X(e);return r!==null?{status:"conflict",path:r.path,commit:r.commit,lastCommit:r.lastCommit}:{status:"refused",reason:"Somebody changed these files after you opened them, so nothing was changed. Look at the new version, then try again."}}if(a==="ROOM_FILE_EXISTS"){const r=e instanceof Error?e.message.replace(/`([^`]*)`/g,"“$1”"):"";return{status:"exists",reason:r.trim()!==""?r:"Something with that name is already there."}}a==="MAIN_CHECKOUT_DIRTY"&&t.invalidateQueries({queryKey:I.repoStatus(i)});const c=Me(e);if(c===void 0)throw e;return{status:"refused",reason:c}}export{De as C,et as F,je as N,Ge as R,Xe as a,tt as c,Se as g,Ze as n,ke as p,Me as r,We as t,qe as w};