@puddle-code/cli 0.2.21 → 0.2.24

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 (138) hide show
  1. package/CHANGELOG.md +2 -3
  2. package/dist/host-control.mjs +55 -22
  3. package/dist/index.js +61 -25
  4. package/dist/public/assets/App-BYidYCu7.js +2 -0
  5. package/dist/public/assets/{Dashboard-BhAek_r4.js → Dashboard-Dzjf0zET.js} +1 -1
  6. package/dist/public/assets/{EditorTabClose-CSKAGWsA.js → EditorTabClose-DKA1_wod.js} +1 -1
  7. package/dist/public/assets/{FindWidget-B6dVpkKr.js → FindWidget-AH805XK9.js} +1 -1
  8. package/dist/public/assets/LazyTerminal-Bqg0V2V8.js +2 -0
  9. package/dist/public/assets/{ModelRefcount-CrpDNwTn.js → ModelRefcount-5wOQD9So.js} +1 -1
  10. package/dist/public/assets/{NewProjectDialog-D-hVQlA4.js → NewProjectDialog-B6E4_Y_p.js} +1 -1
  11. package/dist/public/assets/{PaneEditorBody--h9jLt1e.js → PaneEditorBody-LVZ3_6WO.js} +3 -3
  12. package/dist/public/assets/{PdfViewer-CNzO040W.js → PdfViewer-BGVCeFGN.js} +2 -2
  13. package/dist/public/assets/{SettingsDialog-DaxYdggs.js → SettingsDialog-DKCK1la1.js} +2 -2
  14. package/dist/public/assets/{Terminal-DQL8GETy.js → Terminal-BSDLWpgK.js} +5 -5
  15. package/dist/public/assets/{Workspace-BDDSmIKE.js → Workspace-CR8tLiD8.js} +4 -4
  16. package/dist/public/assets/{abnfDiagram-VCTEODGH-Dj6CI3Nv.js → abnfDiagram-VCTEODGH-FgX2dXui.js} +1 -1
  17. package/dist/public/assets/architecture-7GRP2DOG-BtJFkJAN.js +1 -0
  18. package/dist/public/assets/{architectureDiagram-5GKGNRK7-7n7HJQxV.js → architectureDiagram-5GKGNRK7-CdJkD_Pz.js} +1 -1
  19. package/dist/public/assets/{blockDiagram-I7D4REHJ-Cmsxv8OS.js → blockDiagram-I7D4REHJ-DNbmvisu.js} +1 -1
  20. package/dist/public/assets/{buffer-store-NeRSjzSg.js → buffer-store-BvXwuYnu.js} +2 -2
  21. package/dist/public/assets/{button-hdghxls7.js → button-CHEvj8hX.js} +1 -1
  22. package/dist/public/assets/{c4Diagram-7LVT6UL2-D23ryIme.js → c4Diagram-7LVT6UL2-CjD9lD8i.js} +1 -1
  23. package/dist/public/assets/channel-Cdoqj1v0.js +1 -0
  24. package/dist/public/assets/{chunk-2E4U76K2-usroR3SM.js → chunk-2E4U76K2-SJhD4HB_.js} +1 -1
  25. package/dist/public/assets/{chunk-4HAMMTFA-B4mxD8f1.js → chunk-4HAMMTFA-C_eKRFh0.js} +1 -1
  26. package/dist/public/assets/{chunk-75Z2AOVW-BSDNHsOk.js → chunk-75Z2AOVW-DRIbOeZi.js} +1 -1
  27. package/dist/public/assets/{chunk-CLGD4ZFX-DpUm0L6C.js → chunk-CLGD4ZFX-CMf2IZk2.js} +1 -1
  28. package/dist/public/assets/{chunk-DU6HZSFF-Cin9bFEJ.js → chunk-DU6HZSFF-PwbPwYnk.js} +1 -1
  29. package/dist/public/assets/{chunk-F27PBJKO-BWPIZmRh.js → chunk-F27PBJKO-Oq_sdoh3.js} +1 -1
  30. package/dist/public/assets/{chunk-GMAD6QVW-eS27qQYi.js → chunk-GMAD6QVW-Ck8EGVZC.js} +1 -1
  31. package/dist/public/assets/{chunk-GVQU2GXP-DvZzuy44.js → chunk-GVQU2GXP-Ny1aeY0A.js} +1 -1
  32. package/dist/public/assets/{chunk-IMKFNOWR-CKfEqBn8.js → chunk-IMKFNOWR-fHImnlSZ.js} +1 -1
  33. package/dist/public/assets/{chunk-L3NEJ4N5-Gq2sL0Oq.js → chunk-L3NEJ4N5-BbUIctlf.js} +1 -1
  34. package/dist/public/assets/{chunk-OSK3NFVY-DSHFDm2K.js → chunk-OSK3NFVY-hqM-ZrkL.js} +1 -1
  35. package/dist/public/assets/{chunk-P2QGCYS3-B0b6PsO0.js → chunk-P2QGCYS3-B23zjSSj.js} +1 -1
  36. package/dist/public/assets/{chunk-POPQ4Y6H-B_whPWNN.js → chunk-POPQ4Y6H-GEEn3V5D.js} +1 -1
  37. package/dist/public/assets/{chunk-PWAF6VOD-DfdxoQ_F.js → chunk-PWAF6VOD-DW1kCowt.js} +1 -1
  38. package/dist/public/assets/{chunk-SHT3W25Y-CHrnqlvt.js → chunk-SHT3W25Y-DmDCmUrG.js} +1 -1
  39. package/dist/public/assets/{chunk-SVP7TREG-keTkvLck.js → chunk-SVP7TREG-DwlrYDnP.js} +1 -1
  40. package/dist/public/assets/{chunk-TICWLB2K-ZF0XdA5t.js → chunk-TICWLB2K-C5NBrDW2.js} +1 -1
  41. package/dist/public/assets/{chunk-TLUHSLCS-B3xiw07r.js → chunk-TLUHSLCS-COQ_6Xv5.js} +2 -2
  42. package/dist/public/assets/classDiagram-ZZMXUADV-BgnwaWPy.js +1 -0
  43. package/dist/public/assets/classDiagram-v2-VYDZK3BY-BgnwaWPy.js +1 -0
  44. package/dist/public/assets/{context-menu-fGutCa7q.js → context-menu-DofF0Gza.js} +1 -1
  45. package/dist/public/assets/{copy-B38GDFbv.js → copy-BW2fd4uA.js} +1 -1
  46. package/dist/public/assets/{cssMode-BBPxRrZH.js → cssMode-B4htuRa7.js} +1 -1
  47. package/dist/public/assets/{cynefin-OW5HDTMX-BKwXHhp6.js → cynefin-OW5HDTMX-DypMTjQw.js} +1 -1
  48. package/dist/public/assets/{cynefinDiagram-5FMLGOSQ-B59dmX8D.js → cynefinDiagram-5FMLGOSQ-WLacyiJj.js} +1 -1
  49. package/dist/public/assets/{dagre-GXQ25YYZ-BysK_yGg.js → dagre-GXQ25YYZ-DaKOhMFv.js} +1 -1
  50. package/dist/public/assets/{diagram-S7CK7UJ4-BTvgOprS.js → diagram-S7CK7UJ4-DIwi33o4.js} +1 -1
  51. package/dist/public/assets/{diagram-UQ7AKVKN-C1FXQfFT.js → diagram-UQ7AKVKN-x_QCuDjf.js} +1 -1
  52. package/dist/public/assets/{diagram-VSXAHHWV-CTub3LLw.js → diagram-VSXAHHWV-Bjr6LKcx.js} +1 -1
  53. package/dist/public/assets/{diagram-VX7I27RA-C8YSQsst.js → diagram-VX7I27RA-BQ1d8ghu.js} +1 -1
  54. package/dist/public/assets/{diagram-Z3DM3KII-zBY2ZT-7.js → diagram-Z3DM3KII-CN1JdLeI.js} +1 -1
  55. package/dist/public/assets/dialog-DPE0j1Ok.js +41 -0
  56. package/dist/public/assets/disclosure-BmYZGR3p.js +1 -0
  57. package/dist/public/assets/{dist-1iWQMdtt.js → dist-B1jh4y60.js} +1 -1
  58. package/dist/public/assets/{dist-DWt3BCrg.js → dist-BROMyZLV.js} +1 -1
  59. package/dist/public/assets/{ebnfDiagram-PWID7BFC-DZbYMMq9.js → ebnfDiagram-PWID7BFC-BWTV2Lw8.js} +1 -1
  60. package/dist/public/assets/{erDiagram-RLTQ6QDP-BufFqh6K.js → erDiagram-RLTQ6QDP-DiYZY7fZ.js} +1 -1
  61. package/dist/public/assets/{errors-0CwhraNS.js → errors-CZ1Lhnki.js} +1 -1
  62. package/dist/public/assets/eventmodeling-NTZA5JFV-RcT3PESX.js +1 -0
  63. package/dist/public/assets/flowDiagram-HODETNUW-DwQ7P0aM.js +1 -0
  64. package/dist/public/assets/{ganttDiagram-EL5Y4UJY-CzBnAVfV.js → ganttDiagram-EL5Y4UJY-ChyMBO-e.js} +1 -1
  65. package/dist/public/assets/{gitGraph-4MIJSDKK-DzkiKDz3.js → gitGraph-4MIJSDKK-qX2_zEiU.js} +1 -1
  66. package/dist/public/assets/{gitGraphDiagram-WWUBYQGX-Cg5zqV71.js → gitGraphDiagram-WWUBYQGX-DJb4bV4o.js} +1 -1
  67. package/dist/public/assets/{htmlMode-HP2zLptL.js → htmlMode-BaQBKHvn.js} +1 -1
  68. package/dist/public/assets/index-CAvJOpdz.css +2 -0
  69. package/dist/public/assets/{index-W9vnFL1i.js → index-yGQSODPf.js} +5 -5
  70. package/dist/public/assets/{info-A6RAGUB7-DrzRcVCp.js → info-A6RAGUB7-t5cYX1fg.js} +1 -1
  71. package/dist/public/assets/{infoDiagram-27XIBGKW-DKhhQ6Mi.js → infoDiagram-27XIBGKW-CoS-Nsq6.js} +1 -1
  72. package/dist/public/assets/{ishikawaDiagram-5VMMS53U-Sxvy6BP4.js → ishikawaDiagram-5VMMS53U-DaKttTut.js} +1 -1
  73. package/dist/public/assets/{journeyDiagram-3NMN7TZE-DLCDGlAt.js → journeyDiagram-3NMN7TZE-kLaNVwdB.js} +1 -1
  74. package/dist/public/assets/{jsonMode-3cqCCYan.js → jsonMode-DhacIbdT.js} +1 -1
  75. package/dist/public/assets/{kanban-definition-UXKFOSKX-BBHezsUK.js → kanban-definition-UXKFOSKX-sBx71npp.js} +1 -1
  76. package/dist/public/assets/{line-CXD0KIW6.js → line-B6tFaQMh.js} +1 -1
  77. package/dist/public/assets/{markdown-mermaid-gr78oRak.js → markdown-mermaid-C56AFLzi.js} +2 -2
  78. package/dist/public/assets/{math-DD0qgOf_.js → math-S65D25xf.js} +1 -1
  79. package/dist/public/assets/{media-refresh-store-DTLvGgrw.js → media-refresh-store-BhfM9D0i.js} +1 -1
  80. package/dist/public/assets/{mermaid-parser.core-CQpv25sY.js → mermaid-parser.core-D4kJBS6w.js} +3 -3
  81. package/dist/public/assets/{mermaid.core-CO3okgIG.js → mermaid.core-Cne_RySy.js} +3 -3
  82. package/dist/public/assets/{mindmap-definition-YA3MSWOX-DnuqRR1y.js → mindmap-definition-YA3MSWOX-BEhzKX0Z.js} +1 -1
  83. package/dist/public/assets/notification-delivery-BNxj08z5.js +1 -0
  84. package/dist/public/assets/{packet-AYTQ26CC--9UnHksn.js → packet-AYTQ26CC-BzfZcYUP.js} +1 -1
  85. package/dist/public/assets/{pdf-DFR5TvGJ.js → pdf-Cg-HiUjy.js} +1 -1
  86. package/dist/public/assets/{pegDiagram-XKGWAZYB-m8JdNNtC.js → pegDiagram-XKGWAZYB-DzpbUJ7d.js} +1 -1
  87. package/dist/public/assets/{pie-WAS4IAKB-GnDinOP5.js → pie-WAS4IAKB-DNKuxanW.js} +1 -1
  88. package/dist/public/assets/{pieDiagram-E7YTZNPT-u-NA8MFl.js → pieDiagram-E7YTZNPT-BeOnYivs.js} +1 -1
  89. package/dist/public/assets/{project-abbrev-Ce2YQx3q.js → project-abbrev-CKBTuDt5.js} +1 -1
  90. package/dist/public/assets/{protocol-support-DM3D3Owq.js → protocol-support-B-0f1eJ3.js} +1 -1
  91. package/dist/public/assets/{quadrantDiagram-AXDQQJYC-si_KhMBB.js → quadrantDiagram-AXDQQJYC-D5RU0BZ9.js} +1 -1
  92. package/dist/public/assets/{radar-RG4KPBEZ-CnJwODJt.js → radar-RG4KPBEZ-C-7t5hsN.js} +1 -1
  93. package/dist/public/assets/{railroad-74A4TZTK-Cgg0LWTI.js → railroad-74A4TZTK-CaVM2B69.js} +1 -1
  94. package/dist/public/assets/railroad-abnf-HS5TGJTU-BU_CVJO3.js +1 -0
  95. package/dist/public/assets/railroad-ebnf-LZEXJU2U-DfYF2tn-.js +1 -0
  96. package/dist/public/assets/railroad-peg-WCYAUIDC-DjlDlAsc.js +1 -0
  97. package/dist/public/assets/{railroadDiagram-O6MQD6OU-DuQX8qaE.js → railroadDiagram-O6MQD6OU-DxkTp-H6.js} +1 -1
  98. package/dist/public/assets/{requirementDiagram-BXWQKSXE-Chwrn5Tf.js → requirementDiagram-BXWQKSXE-DXsUjGlL.js} +1 -1
  99. package/dist/public/assets/{sankeyDiagram-P5KCCOFB-FpJ30BIQ.js → sankeyDiagram-P5KCCOFB-CjlMAu4N.js} +1 -1
  100. package/dist/public/assets/{scroll-restoration-B3J09_am.js → scroll-restoration-BMX0q1d6.js} +1 -1
  101. package/dist/public/assets/{selection-actions-awCJJCSe.js → selection-actions-BnvTzlOF.js} +1 -1
  102. package/dist/public/assets/{sequenceDiagram-WJ2MYXX4-DVw87Ucm.js → sequenceDiagram-WJ2MYXX4-B8pW_U2s.js} +1 -1
  103. package/dist/public/assets/{stateDiagram-D77RDMKH-qmBcs9VH.js → stateDiagram-D77RDMKH-C4649vJ_.js} +1 -1
  104. package/dist/public/assets/stateDiagram-v2-MP3YSRHH-z1utsNYA.js +1 -0
  105. package/dist/public/assets/{swimlanes-42K2YHIH-ts5KQGMt.js → swimlanes-42K2YHIH-D2bi0IkJ.js} +1 -1
  106. package/dist/public/assets/swimlanesDiagram-VR7AAH4N-RcujV43_.js +8 -0
  107. package/dist/public/assets/{switch-DMkSxGf3.js → switch-CEs7mmdu.js} +1 -1
  108. package/dist/public/assets/{timeline-definition-24CTP7MA-BDL_pzrt.js → timeline-definition-24CTP7MA-D55uisDI.js} +1 -1
  109. package/dist/public/assets/{treeView-Q6P3EWNA-B1vMOTkl.js → treeView-Q6P3EWNA-BTfpSxF_.js} +1 -1
  110. package/dist/public/assets/{treemap-WGGIJYW6-wi5T0FIb.js → treemap-WGGIJYW6-Ck20fjtW.js} +1 -1
  111. package/dist/public/assets/{tsMode-CsaS5imR.js → tsMode-BiJ1tmbK.js} +1 -1
  112. package/dist/public/assets/{use-ui-state-2VprViGF.js → use-ui-state-DMXseT3q.js} +1 -1
  113. package/dist/public/assets/{vennDiagram-4TSXK5OY-Djvp5-2_.js → vennDiagram-4TSXK5OY-BKNs6Vhx.js} +1 -1
  114. package/dist/public/assets/{view-state-store-rOwEBYKn.js → view-state-store-B64Y8syO.js} +1 -1
  115. package/dist/public/assets/{wardley-WFR3VGLG-Di-PFH_i.js → wardley-WFR3VGLG-sC7irUb3.js} +1 -1
  116. package/dist/public/assets/{wardleyDiagram-VM6X3IG4-B5Y8UZiL.js → wardleyDiagram-VM6X3IG4-BwmBuIAi.js} +1 -1
  117. package/dist/public/assets/{ws-DsytGlkr.js → ws-Djpdj45w.js} +1 -1
  118. package/dist/public/assets/{xychartDiagram-S5SC5T6Z-d-pvxFe2.js → xychartDiagram-S5SC5T6Z-IfkSgCyl.js} +1 -1
  119. package/dist/public/index.html +2 -2
  120. package/dist/public/notification-worker.js +104 -6
  121. package/package.json +1 -1
  122. package/dist/public/assets/App-NrJUEV9p.js +0 -2
  123. package/dist/public/assets/LazyTerminal-fxF4IO4o.js +0 -2
  124. package/dist/public/assets/architecture-7GRP2DOG-CDcS1iVd.js +0 -1
  125. package/dist/public/assets/channel-B98_B4F2.js +0 -1
  126. package/dist/public/assets/classDiagram-ZZMXUADV-CalLaxUD.js +0 -1
  127. package/dist/public/assets/classDiagram-v2-VYDZK3BY-CalLaxUD.js +0 -1
  128. package/dist/public/assets/dialog-CVAp0B_q.js +0 -41
  129. package/dist/public/assets/disclosure-CWTUvRKU.js +0 -1
  130. package/dist/public/assets/eventmodeling-NTZA5JFV-CC5F0fZk.js +0 -1
  131. package/dist/public/assets/flowDiagram-HODETNUW-Dmt2DAB8.js +0 -1
  132. package/dist/public/assets/index-Bwl8S5Du.css +0 -2
  133. package/dist/public/assets/notification-delivery-rQp5tkM8.js +0 -1
  134. package/dist/public/assets/railroad-abnf-HS5TGJTU-DPqD3hz7.js +0 -1
  135. package/dist/public/assets/railroad-ebnf-LZEXJU2U-9Jxyrh7e.js +0 -1
  136. package/dist/public/assets/railroad-peg-WCYAUIDC-gr2ZokSI.js +0 -1
  137. package/dist/public/assets/stateDiagram-v2-MP3YSRHH-TK5UygAI.js +0 -1
  138. package/dist/public/assets/swimlanesDiagram-VR7AAH4N-BUMN0oZf.js +0 -8
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Terminal-BSDLWpgK.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-CZI7_Jkm.js","assets/index-yGQSODPf.js","assets/index-CAvJOpdz.css","assets/dist-B1jh4y60.js","assets/protocol-support-B-0f1eJ3.js","assets/copy-BW2fd4uA.js","assets/createLucideIcon-DyMAgLa3.js","assets/x-CZCUod6A.js","assets/selection-actions-BnvTzlOF.js","assets/button-CHEvj8hX.js","assets/ws-Djpdj45w.js","assets/FindWidget-AH805XK9.js","assets/chevron-down--sjpQEHH.js","assets/code-DRWf9a5s.js","assets/errors-CZ1Lhnki.js","assets/Terminal-BrP-ENHg.css"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{n,ot as r,t as i}from"./index-yGQSODPf.js";import{S as a,w as o,x as s,y as c}from"./dialog-DPE0j1Ok.js";import{a as l}from"./button-CHEvj8hX.js";import{n as u}from"./x-CZCUod6A.js";import{t as d}from"./createLucideIcon-DyMAgLa3.js";var f=e(t(),1),p=[`top`,`right`,`bottom`,`left`],m=Math.min,h=Math.max,g=Math.round,_=Math.floor,v=e=>({x:e,y:e}),y={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function b(e,t,n){return h(e,m(t,n))}function x(e,t){return typeof e==`function`?e(t):e}function S(e){return e.split(`-`)[0]}function C(e){return e.split(`-`)[1]}function w(e){return e===`x`?`y`:`x`}function T(e){return e===`y`?`height`:`width`}function E(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function D(e){return w(E(e))}function O(e,t,n){n===void 0&&(n=!1);let r=C(e),i=D(e),a=T(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=L(o)),[o,L(o)]}function k(e){let t=L(e);return[A(e),t,A(t)]}function A(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var j=[`left`,`right`],M=[`right`,`left`],N=[`top`,`bottom`],P=[`bottom`,`top`];function F(e,t,n){switch(e){case`top`:case`bottom`:return n?t?M:j:t?j:M;case`left`:case`right`:return t?N:P;default:return[]}}function I(e,t,n,r){let i=C(e),a=F(S(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(A)))),a}function L(e){let t=S(e);return y[t]+e.slice(t.length)}function R(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function z(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:R(e)}function B(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function ee(e,t,n){let{reference:r,floating:i}=e,a=E(t),o=D(t),s=T(o),c=S(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=C(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function te(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=x(t,e),p=z(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=B(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=B(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var ne=50,re=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:te},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=ee(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<ne&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=ee(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},ie=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=x(e,t)||{};if(l==null)return{};let d=z(u),f={x:n,y:r},p=D(i),h=T(p),g=await o.getDimensions(l),_=p===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,S=_?`clientHeight`:`clientWidth`,w=a.reference[h]+a.reference[p]-f[p]-a.floating[h],E=f[p]-a.reference[p],O=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),k=O?O[S]:0;(!k||!await(o.isElement==null?void 0:o.isElement(O)))&&(k=s.floating[S]||a.floating[h]);let A=w/2-E/2,j=k/2-g[h]/2-1,M=m(d[v],j),N=m(d[y],j),P=k-g[h]-N,F=k/2-g[h]/2+A,I=b(M,F,P),L=!c.arrow&&C(i)!=null&&F!==I&&a.reference[h]/2-(F<M?M:N)-g[h]/2<0,R=L?F<M?F-M:F-P:0;return{[p]:f[p]+R,data:{[p]:I,centerOffset:F-I-R,...L&&{alignmentOffset:R}},reset:L}}}),ae=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=x(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=S(r),_=E(o),v=S(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[L(o)]:k(o)),C=p!==`none`;!d&&C&&b.push(...I(o,m,p,y));let w=[o,...b],T=await s.detectOverflow(t,h),D=[],A=i.flip?.overflows||[];if(l&&D.push(T[g]),u){let e=O(r,a,y);D.push(T[e[0]],T[e[1]])}if(A=[...A,{placement:r,overflows:D}],!D.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=w[e];if(t&&(!(u===`alignment`&&_!==E(t))||A.every(e=>E(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:A},reset:{placement:t}};let n=A.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=A.filter(e=>{if(C){let t=E(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function oe(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function se(e){return p.some(t=>e[t]>=0)}var ce=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=x(e,t);switch(i){case`referenceHidden`:{let e=oe(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:se(e)}}}case`escaped`:{let e=oe(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:se(e)}}}default:return{}}}}},le=new Set([`left`,`top`]);async function ue(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=S(n),s=C(n),c=E(n)===`y`,l=le.has(o)?-1:1,u=a&&c?-1:1,d=x(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var de=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await ue(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},fe=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=x(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=E(i),p=w(f),m=u[p],h=u[f],g=(e,t)=>b(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},pe=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=x(e,t),u={x:n,y:r},d=E(i),f=w(d),p=u[f],m=u[d],h=x(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=le.has(S(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},me=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=x(e,t),c=await i.detectOverflow(t,s),l=S(n),u=C(n),d=E(n)===`y`,{width:f,height:p}=r.floating,g,_;l===`top`||l===`bottom`?(g=l,_=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(_=l,g=u===`end`?`top`:`bottom`);let v=p-c.top-c.bottom,y=f-c.left-c.right,b=m(p-c[g],v),w=m(f-c[_],y),T=t.middlewareData.shift,D=!T,O=b,k=w;T!=null&&T.enabled.x&&(k=y),T!=null&&T.enabled.y&&(O=v),D&&!u&&(d?k=f-2*h(c.left,c.right):O=p-2*h(c.top,c.bottom)),await o({...t,availableWidth:k,availableHeight:O});let A=await i.getDimensions(a.floating);return f!==A.width||p!==A.height?{reset:{rects:!0}}:{}}}};function he(){return typeof window<`u`}function V(e){return ge(e)?(e.nodeName||``).toLowerCase():`#document`}function H(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function U(e){return((ge(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function ge(e){return he()?e instanceof Node||e instanceof H(e).Node:!1}function W(e){return he()?e instanceof Element||e instanceof H(e).Element:!1}function G(e){return he()?e instanceof HTMLElement||e instanceof H(e).HTMLElement:!1}function _e(e){return!he()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof H(e).ShadowRoot}function ve(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=J(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function ye(e){return/^(table|td|th)$/.test(V(e))}function be(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var xe=/transform|translate|scale|rotate|perspective|filter/,Se=/paint|layout|strict|content/,K=e=>!!e&&e!==`none`,Ce;function we(e){let t=W(e)?J(e):e;return K(t.transform)||K(t.translate)||K(t.scale)||K(t.rotate)||K(t.perspective)||!Ee()&&(K(t.backdropFilter)||K(t.filter))||xe.test(t.willChange||``)||Se.test(t.contain||``)}function Te(e){let t=Y(e);for(;G(t)&&!q(t);){if(we(t))return t;if(be(t))return null;t=Y(t)}return null}function Ee(){return Ce??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Ce}function q(e){return/^(html|body|#document)$/.test(V(e))}function J(e){return H(e).getComputedStyle(e)}function De(e){return W(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Y(e){if(V(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||_e(e)&&e.host||U(e);return _e(t)?t.host:t}function Oe(e){let t=Y(e);return q(t)?(e.ownerDocument||e).body:G(t)&&ve(t)?t:Oe(t)}function X(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Oe(e),i=r===e.ownerDocument?.body,a=H(r);if(i){let e=ke(a);return t.concat(a,a.visualViewport||[],ve(r)?r:[],e&&n?X(e):[])}else return t.concat(r,X(r,[],n))}function ke(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ae(e){let t=J(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=G(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=g(n)!==a||g(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function je(e){return W(e)?e:e.contextElement}function Z(e){let t=je(e);if(!G(t))return v(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Ae(t),o=(a?g(n.width):n.width)/r,s=(a?g(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Me=v(0);function Ne(e){let t=H(e);return!Ee()||!t.visualViewport?Me:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Pe(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===H(e)}function Q(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=je(e),o=v(1);t&&(r?W(r)&&(o=Z(r)):o=Z(e));let s=Pe(a,n,r)?Ne(a):v(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=H(a),t=W(r)?H(r):r,n=e,i=ke(n);for(;i&&t!==n;){let e=Z(i),t=i.getBoundingClientRect(),r=J(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=H(i),i=ke(n)}}return B({width:u,height:d,x:c,y:l})}function Fe(e,t){let n=De(e).scrollLeft;return t?t.left+n:Q(U(e)).left+n}function Ie(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Fe(e,n),y:n.top+t.scrollTop}}function Le(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=U(r),s=t?be(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=v(1),u=v(0),d=G(r);if((d||!a)&&((V(r)!==`body`||ve(o))&&(c=De(r)),d)){let e=Q(r);l=Z(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Ie(o,c):v(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Re(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function ze(e){let t=De(e),n=e.ownerDocument.body,r=h(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=h(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+Fe(e),o=-t.scrollTop;return J(n).direction===`rtl`&&(a+=h(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var Be=25;function Ve(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=H(e),a=U(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Ee()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(Fe(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=Be&&(s-=o)}return{width:s,height:c,x:l,y:u}}function He(e,t){let n=Q(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Z(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Ue(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Ve(e,n,t);else if(t===`document`)r=ze(U(e));else if(W(t))r=He(t,n);else{let n=Ne(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return B(r)}function We(e,t){let n=t.get(e);if(n)return n;let r=X(e,[],!1).filter(e=>W(e)&&V(e)!==`body`),i=null,a=J(e).position===`fixed`,o=a?Y(e):e;for(;W(o)&&!q(o);){let e=J(o),t=we(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=Y(o)}return t.set(e,r),r}function Ge(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?be(t)?[]:We(t,this._c):[].concat(n),r],o=Ue(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Ue(t,a[e],i);s=h(n.top,s),c=m(n.right,c),l=m(n.bottom,l),u=h(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Ke(e){let{width:t,height:n}=Ae(e);return{width:t,height:n}}function qe(e,t,n){let r=G(t),i=U(t),a=n===`fixed`,o=Q(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=v(0);if((r||!a)&&((V(t)!==`body`||ve(i))&&(s=De(t)),r)){let e=Q(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=Fe(i));let l=i&&!r&&!a?Ie(i,s):v(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function Je(e){return J(e).position===`static`}function Ye(e,t){if(!G(e)||J(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return U(e)===n&&(n=n.ownerDocument.body),n}function Xe(e,t){let n=H(e);if(be(e))return n;if(!G(e)){let t=Y(e);for(;t&&!q(t);){if(W(t)&&!Je(t))return t;t=Y(t)}return n}let r=Ye(e,t);for(;r&&ye(r)&&Je(r);)r=Ye(r,t);return r&&q(r)&&Je(r)&&!we(r)?n:r||Te(e)||n}var Ze=async function(e){let t=this.getOffsetParent||Xe,n=this.getDimensions,r=await n(e.floating);return{reference:qe(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Qe(e){return J(e).direction===`rtl`}var $e={convertOffsetParentRelativeRectToViewportRelativeRect:Le,getDocumentElement:U,getClippingRect:Ge,getOffsetParent:Xe,getElementRects:Ze,getClientRects:Re,getDimensions:Ke,getScale:Z,isElement:W,isRTL:Qe};function et(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function tt(e,t,n){let r=null,i,a=U(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let g=_(d),v=_(a.clientWidth-(u+f)),y=_(a.clientHeight-(d+p)),b=_(u),x={rootMargin:-g+`px `+-v+`px `+-y+`px `+-b+`px`,threshold:h(0,m(1,c))||1},S=!0;function C(t){let n=t[0].intersectionRatio;if(!et(l,e.getBoundingClientRect()))return s();if(n!==c){if(!S)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}S=!1}try{r=new IntersectionObserver(C,{...x,root:a.ownerDocument})}catch{r=new IntersectionObserver(C,x)}r.observe(e)}let c=H(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function nt(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=je(e),u=i||a?[...l?X(l):[],...t?X(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?tt(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Q(e):null;c&&g();function g(){let t=Q(e);h&&!et(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var rt=de,it=fe,at=ae,ot=me,st=ce,ct=ie,lt=pe,ut=(e,t,n)=>{let r=new Map,i=n??{},a={...$e,...i.platform,_c:r};return re(e,t,{...i,platform:a})},dt=e(r(),1),ft=typeof document<`u`?f.useLayoutEffect:function(){};function pt(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!pt(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!pt(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function mt(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ht(e,t){let n=mt(e);return Math.round(t*n)/n}function gt(e){let t=f.useRef(e);return ft(()=>{t.current=e}),t}function _t(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=f.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=f.useState(r);pt(p,r)||m(r);let[h,g]=f.useState(null),[_,v]=f.useState(null),y=f.useCallback(e=>{e!==C.current&&(C.current=e,g(e))},[]),b=f.useCallback(e=>{e!==w.current&&(w.current=e,v(e))},[]),x=a||h,S=o||_,C=f.useRef(null),w=f.useRef(null),T=f.useRef(u),E=c!=null,D=gt(c),O=gt(i),k=gt(l),A=f.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:p};O.current&&(e.platform=O.current),ut(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!pt(T.current,t)&&(T.current=t,dt.flushSync(()=>{d(t)}))})},[p,t,n,O,k]);ft(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=f.useRef(!1);ft(()=>(j.current=!0,()=>{j.current=!1}),[]),ft(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,A);A()}},[x,S,A,D,E]);let M=f.useMemo(()=>({reference:C,floating:w,setReference:y,setFloating:b}),[y,b]),N=f.useMemo(()=>({reference:x,floating:S}),[x,S]),P=f.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=ht(N.floating,u.x),r=ht(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...mt(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return f.useMemo(()=>({...u,update:A,refs:M,elements:N,floatingStyles:P}),[u,A,M,N,P])}var vt=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:ct({element:r.current,padding:i}).fn(n):r?ct({element:r,padding:i}).fn(n):{}}}},yt=(e,t)=>{let n=rt(e);return{name:n.name,fn:n.fn,options:[e,t]}},bt=(e,t)=>{let n=it(e);return{name:n.name,fn:n.fn,options:[e,t]}},xt=(e,t)=>({fn:lt(e).fn,options:[e,t]}),St=(e,t)=>{let n=at(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ct=(e,t)=>{let n=ot(e);return{name:n.name,fn:n.fn,options:[e,t]}},wt=(e,t)=>{let n=st(e);return{name:n.name,fn:n.fn,options:[e,t]}},Tt=(e,t)=>{let n=vt(e);return{name:n.name,fn:n.fn,options:[e,t]}},$=n(),Et=`Arrow`,Dt=f.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...o}=e;return(0,$.jsx)(a.svg,{...o,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,$.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});Dt.displayName=Et;var Ot=Dt;function kt(e){let[t,n]=f.useState(void 0);return c(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var At=`Popper`,[jt,Mt]=o(At),[Nt,Pt]=jt(At),Ft=e=>{let{__scopePopper:t,children:n}=e,[r,i]=f.useState(null),[a,o]=f.useState(void 0);return(0,$.jsx)(Nt,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})};Ft.displayName=At;var It=`PopperAnchor`,Lt=f.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,o=Pt(It,n),s=f.useRef(null),c=o.onAnchorChange,u=l(t,f.useCallback(e=>{s.current=e,e&&c(e)},[c])),d=f.useRef(null);f.useEffect(()=>{if(!r)return;let e=d.current;d.current=r.current,e!==d.current&&c(d.current)});let p=o.placementState&&qt(o.placementState),m=p?.[0],h=p?.[1];return r?null:(0,$.jsx)(a.div,{"data-radix-popper-side":m,"data-radix-popper-align":h,...i,ref:u})});Lt.displayName=It;var Rt=`PopperContent`,[zt,Bt]=jt(Rt),Vt=f.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:o=`center`,alignOffset:u=0,arrowPadding:d=0,avoidCollisions:p=!0,collisionBoundary:m=[],collisionPadding:h=0,sticky:g=`partial`,hideWhenDetached:_=!1,updatePositionStrategy:v=`optimized`,onPlaced:y,...b}=e,x=Pt(Rt,n),[S,C]=f.useState(null),w=l(t,C),[T,E]=f.useState(null),D=kt(T),O=D?.width??0,k=D?.height??0,A=r+(o===`center`?``:`-`+o),j=typeof h==`number`?h:{top:0,right:0,bottom:0,left:0,...h},M=Array.isArray(m)?m:[m],N=M.length>0,P={padding:j,boundary:M.filter(Gt),altBoundary:N},{refs:F,floatingStyles:I,placement:L,isPositioned:R,middlewareData:z}=_t({strategy:`fixed`,placement:A,whileElementsMounted:(...e)=>nt(...e,{animationFrame:v===`always`}),elements:{reference:x.anchor},middleware:[yt({mainAxis:i+k,alignmentAxis:u}),p&&bt({mainAxis:!0,crossAxis:!1,limiter:g===`partial`?xt():void 0,...P}),p&&St({...P}),Ct({...P,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),T&&Tt({element:T,padding:d}),Kt({arrowWidth:O,arrowHeight:k}),_&&wt({strategy:`referenceHidden`,...P,boundary:N?P.boundary:void 0})]}),B=x.setPlacementState;c(()=>(B(L),()=>{B(void 0)}),[L,B]);let[ee,te]=qt(L),ne=s(y);c(()=>{R&&ne?.()},[R,ne]);let re=z.arrow?.x,ie=z.arrow?.y,ae=z.arrow?.centerOffset!==0,[oe,se]=f.useState();return c(()=>{S&&se(window.getComputedStyle(S).zIndex)},[S]),(0,$.jsx)(`div`,{ref:F.setFloating,"data-radix-popper-content-wrapper":``,style:{...I,transform:R?I.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:oe,"--radix-popper-transform-origin":[z.transformOrigin?.x,z.transformOrigin?.y].join(` `),...z.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,$.jsx)(zt,{scope:n,placedSide:ee,placedAlign:te,onArrowChange:E,arrowX:re,arrowY:ie,shouldHideArrow:ae,children:(0,$.jsx)(a.div,{"data-side":ee,"data-align":te,...b,ref:w,style:{...b.style,animation:R?void 0:`none`}})})})});Vt.displayName=Rt;var Ht=`PopperArrow`,Ut={top:`bottom`,right:`left`,bottom:`top`,left:`right`},Wt=f.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=Bt(Ht,n),a=Ut[i.placedSide];return(0,$.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,$.jsx)(Ot,{...r,ref:t,style:{...r.style,display:`block`}})})});Wt.displayName=Ht;function Gt(e){return e!==null}var Kt=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=qt(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function qt(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var Jt=Ft,Yt=Lt,Xt=Vt,Zt=Wt,Qt=`rounded-md bg-border/50 text-sm text-fg placeholder:text-fg-muted transition-colors hover:bg-border/80 focus:bg-border/80 disabled:cursor-not-allowed disabled:opacity-50`,$t=`relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm text-fg outline-none transition-colors`,en=`data-[highlighted]:bg-action data-[highlighted]:text-action-ink data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,tn=`data-[selected=true]:bg-action data-[selected=true]:text-action-ink data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50`;function nn({className:e,type:t,...n}){return(0,$.jsx)(`input`,{type:t,className:u(`flex h-8 w-full px-2.5`,Qt,e),...n})}function rn({className:e,...t}){return(0,$.jsx)(`textarea`,{className:u(`flex min-h-16 w-full px-2.5 py-2`,Qt,e),...t})}var an=`Label`,on=f.forwardRef((e,t)=>(0,$.jsx)(a.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));on.displayName=an;var sn=on;function cn({className:e,...t}){return(0,$.jsx)(sn,{className:u(`text-xs font-medium text-fg-secondary peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}var ln=d(`folder-git-2`,[[`path`,{d:`M18 19a5 5 0 0 1-5-5v8`,key:`sz5oeg`}],[`path`,{d:`M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5`,key:`1w6njk`}],[`circle`,{cx:`13`,cy:`12`,r:`2`,key:`1j92g6`}],[`circle`,{cx:`20`,cy:`19`,r:`2`,key:`1obnsp`}]]),un=d(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]);function dn({id:e,value:t,onValueChange:n,onChoose:r,hints:i,placeholder:a,className:o,hintsClassName:s,autoFocus:c}){let[l,d]=(0,f.useState)(!1),[p,m]=(0,f.useState)(0),h=e=>{n(e.value),r?.(e),d(!1)};return(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(nn,{id:e,value:t,onChange:e=>{n(e.target.value),d(!0),m(0)},onFocus:()=>d(!0),onBlur:()=>d(!1),onKeyDown:e=>{if(!(!l||i.length===0))if(e.key===`ArrowDown`)e.preventDefault(),m(e=>(e+1)%i.length);else if(e.key===`ArrowUp`)e.preventDefault(),m(e=>(e-1+i.length)%i.length);else if(e.key===`Enter`||e.key===`Tab`){let t=i[p]??i[0];t&&(e.preventDefault(),h(t))}else e.key===`Escape`&&(e.stopPropagation(),d(!1))},placeholder:a,className:o,autoComplete:`off`,spellCheck:!1,autoFocus:c}),l&&i.length>0&&(0,$.jsx)(`ul`,{className:u(`absolute top-full z-10 mt-1 max-h-56 overflow-y-auto rounded-md bg-elevated p-1 shadow-xl`,s??`w-full`),children:i.map((e,t)=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,onMouseDown:t=>{t.preventDefault(),h(e)},onMouseEnter:()=>m(t),className:u(`relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm text-fg outline-none transition-colors`,`data-[selected=true]:bg-action data-[selected=true]:text-action-ink data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50`,`w-full text-xs`),"data-selected":t===p,children:[(0,$.jsx)(`span`,{className:`truncate`,children:e.label??e.value}),e.badge&&(0,$.jsx)(`span`,{className:`ml-auto shrink-0 text-2xs opacity-70`,children:e.badge})]})},e.value))})]})}var fn=(0,f.lazy)(()=>i(()=>import(`./Terminal-BSDLWpgK.js`).then(e=>({default:e.Terminal})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]))),pn=null;async function mn(){pn=(await i(()=>import(`./Terminal-BSDLWpgK.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]))).Terminal}function hn(e){return pn?(0,$.jsx)(pn,{...e}):(0,$.jsx)(f.Suspense,{fallback:(0,$.jsx)(`div`,{className:`size-full bg-ground`}),children:(0,$.jsx)(fn,{...e})})}export{Mt as _,ln as a,rn as c,en as d,$t as f,Jt as g,Xt as h,un as i,Qt as l,Zt as m,mn as n,cn as o,Yt as p,dn as r,nn as s,hn as t,tn as u,kt as v};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{c as n,o as r,t as i}from"./buffer-store-NeRSjzSg.js";var a=e(t(),1);function o({buffers:e}){let t=(0,a.useRef)(new Set);return(0,a.useEffect)(()=>{let a=new Set(e.map(e=>i(e.session,e.path,e.root))),o=t.current;for(let e of a)o.has(e)||(n(e),o.add(e));for(let e of[...o])a.has(e)||(r(e),o.delete(e))},[e]),(0,a.useEffect)(()=>()=>{for(let e of t.current)r(e);t.current.clear()},[]),null}export{o as ModelRefcount};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{c as n,o as r,t as i}from"./buffer-store-BvXwuYnu.js";var a=e(t(),1);function o({buffers:e}){let t=(0,a.useRef)(new Set);return(0,a.useEffect)(()=>{let a=new Set(e.map(e=>i(e.session,e.path,e.root))),o=t.current;for(let e of a)o.has(e)||(n(e),o.add(e));for(let e of[...o])a.has(e)||(r(e),o.delete(e))},[e]),(0,a.useEffect)(()=>()=>{for(let e of t.current)r(e);t.current.clear()},[]),null}export{o as ModelRefcount};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{n}from"./index-W9vnFL1i.js";import{H as r,K as i,Q as a,U as o,s,tt as c,xt as l}from"./protocol-support-DM3D3Owq.js";import{n as u,o as d,p as f,t as p}from"./project-abbrev-Ce2YQx3q.js";import{a as m,i as h,n as ee,o as te,r as g,t as _}from"./dialog-CVAp0B_q.js";import{t as v}from"./button-hdghxls7.js";import{a as y,o as b,r as x,s as S}from"./LazyTerminal-fxF4IO4o.js";import{t as C}from"./createLucideIcon-DyMAgLa3.js";import{t as w}from"./use-debounced-value-C86N-mOK.js";var T=C(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),E=e(t(),1),D=n();function O(e){let t=e.trim().replace(/\/+$/,``);return t===``?`/`:t}function k(e){return e.startsWith(`/`)||e.startsWith(`~`)}function A(e){let t=e.replace(/\/+$/,``),n=t.lastIndexOf(`/`);return n<=0?`/`:t.slice(0,n)}function j({dir:e,onNavigate:t,onChoose:n}){let r=a(e.endsWith(`/`)?e:`${e}/`);return(0,D.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,D.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,D.jsxs)(`button`,{type:`button`,onClick:()=>t(A(e)),disabled:e===`/`,title:`Parent directory`,className:`shrink-0 rounded-sm p-1 text-fg-gold transition-colors hover:bg-elevated hover:text-fg disabled:pointer-events-none disabled:opacity-40`,children:[(0,D.jsx)(d,{className:`size-3.5`}),(0,D.jsx)(`span`,{className:`sr-only`,children:`Parent directory`})]}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>n(e),className:`ml-auto shrink-0 text-2xs text-fg-muted transition-colors hover:text-fg`,children:`choose this folder`})]}),(0,D.jsxs)(`div`,{className:`max-h-48 overflow-y-auto`,children:[(r.data?.entries??[]).map(e=>(0,D.jsxs)(`div`,{className:`flex items-center rounded-md transition-colors hover:bg-elevated`,children:[(0,D.jsxs)(`button`,{type:`button`,onClick:()=>t(e.path),className:`flex min-w-0 flex-1 items-center gap-2 px-2 py-1 text-left`,children:[e.is_git?(0,D.jsx)(y,{className:`size-3.5 shrink-0 text-success`}):(0,D.jsx)(T,{className:`size-3.5 shrink-0 text-fg-gold`}),(0,D.jsx)(`span`,{className:`truncate text-xs text-fg`,children:e.name})]}),e.is_git&&(0,D.jsx)(`button`,{type:`button`,onClick:()=>n(e.path),className:`shrink-0 px-2 py-1 text-2xs text-fg-muted transition-colors hover:text-fg`,children:`choose`})]},e.path)),r.data!==void 0&&r.data.entries.length===0&&(0,D.jsx)(`p`,{className:`px-2 py-1 text-xs text-fg-muted`,children:`No subdirectories.`})]})]})}function M({profileId:e,open:t,onOpenChange:n}){let d=l(),y=s(i().data?.protocol),C=o(),T=r(),A=f(),M=c(),[N,P]=(0,E.useState)(``),[F,I]=(0,E.useState)(``),[L,R]=(0,E.useState)(!1),[z,B]=(0,E.useState)(``),[V,H]=(0,E.useState)(!1),[U,W]=(0,E.useState)(null),[G,K]=(0,E.useState)(null),q=M.data?.home,J=()=>{let e=N.trim(),t=k(e)&&q!==void 0?O(e.replace(/^~(?=\/|$)/,q)):k(e)&&e.startsWith(`/`)?O(e):q??`/`;X(t)},Y=e=>{I(e),V||B(p(e))},X=e=>{K(e),P(e)},Z=e=>{P(e),K(null),Y(e.split(`/`).filter(Boolean).pop()??``),R(!0)},Q=a(w(N,150)),ne=(0,E.useMemo)(()=>{if(!k(N))return(d.data??[]).map(e=>({value:e.path,badge:`registered`,is_git:!0}));let e=new Set((d.data??[]).map(e=>e.path));return(Q.data?.entries??[]).map(t=>({value:t.path,label:t.name,badge:e.has(t.path)?`registered`:t.is_git?`git`:void 0,is_git:t.is_git}))},[N,d.data,Q.data]),re=async()=>{W(null);try{let t=O(N),r=d.data?.find(e=>e.path===t)?.id??(await C.mutateAsync({path:t,...y?{default_base_branch:``}:{}})).id,i=await T.mutateAsync({profile_id:e,repo_id:r,name:F.trim(),...u(z)?{abbrev:u(z)}:{}});n(!1),A(`/project/${i.id}`)}catch(e){W(e instanceof Error?e.message:String(e))}},$=F.trim()!==``&&k(N.trim());return(0,D.jsx)(_,{open:t,onOpenChange:n,children:(0,D.jsxs)(ee,{children:[(0,D.jsxs)(m,{children:[(0,D.jsx)(te,{children:`New project`}),(0,D.jsx)(g,{children:`Point at a git repository on the daemon host — known repositories are reused.`})]}),(0,D.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),$&&re()},children:[(0,D.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,D.jsx)(b,{htmlFor:`repo-path`,children:`Repository path`}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>G===null?J():K(null),className:`text-2xs text-fg-muted transition-colors hover:text-fg`,children:G===null?`browse…`:`hide browser`})]}),(0,D.jsx)(x,{id:`repo-path`,placeholder:`~/src/my-repo`,value:N,onValueChange:P,onChoose:e=>{!L&&e.is_git&&Y(e.value.split(`/`).filter(Boolean).pop()??``)},hints:ne}),G!==null&&(0,D.jsx)(j,{dir:G,onNavigate:X,onChoose:Z})]}),(0,D.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,D.jsx)(b,{htmlFor:`project-name`,children:`Project name`}),(0,D.jsx)(S,{id:`project-name`,placeholder:`e.g. checkout-rework`,value:F,onChange:e=>{Y(e.target.value),R(!0)}})]}),(0,D.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,D.jsx)(b,{htmlFor:`project-abbrev`,children:`Abbreviation`}),(0,D.jsx)(S,{id:`project-abbrev`,placeholder:F.trim()?p(F):`ABBRV`,maxLength:5,value:z,onChange:e=>{B(u(e.target.value)),H(!0)},className:`w-24 uppercase`}),(0,D.jsxs)(`p`,{className:`text-2xs text-fg-muted`,children:[`Up to `,5,` characters — the project's label on the collapsed sidebar rail.`]})]}),U&&(0,D.jsx)(`p`,{className:`text-xs text-danger`,children:U}),(0,D.jsxs)(h,{children:[(0,D.jsx)(v,{type:`button`,variant:`ghost`,onClick:()=>n(!1),children:`Cancel`}),(0,D.jsx)(v,{type:`submit`,disabled:!$||C.isPending||T.isPending,children:`Create project`})]})]})]})})}export{M as t};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{n}from"./index-yGQSODPf.js";import{H as r,K as i,Q as a,U as o,s,tt as c,xt as l}from"./protocol-support-B-0f1eJ3.js";import{n as u,o as d,p as f,t as p}from"./project-abbrev-CKBTuDt5.js";import{a as m,i as h,n as ee,o as te,r as g,t as _}from"./dialog-DPE0j1Ok.js";import{t as v}from"./button-CHEvj8hX.js";import{a as y,o as b,r as x,s as S}from"./LazyTerminal-Bqg0V2V8.js";import{t as C}from"./createLucideIcon-DyMAgLa3.js";import{t as w}from"./use-debounced-value-C86N-mOK.js";var T=C(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),E=e(t(),1),D=n();function O(e){let t=e.trim().replace(/\/+$/,``);return t===``?`/`:t}function k(e){return e.startsWith(`/`)||e.startsWith(`~`)}function A(e){let t=e.replace(/\/+$/,``),n=t.lastIndexOf(`/`);return n<=0?`/`:t.slice(0,n)}function j({dir:e,onNavigate:t,onChoose:n}){let r=a(e.endsWith(`/`)?e:`${e}/`);return(0,D.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,D.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,D.jsxs)(`button`,{type:`button`,onClick:()=>t(A(e)),disabled:e===`/`,title:`Parent directory`,className:`shrink-0 rounded-sm p-1 text-fg-gold transition-colors hover:bg-elevated hover:text-fg disabled:pointer-events-none disabled:opacity-40`,children:[(0,D.jsx)(d,{className:`size-3.5`}),(0,D.jsx)(`span`,{className:`sr-only`,children:`Parent directory`})]}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>n(e),className:`ml-auto shrink-0 text-2xs text-fg-muted transition-colors hover:text-fg`,children:`choose this folder`})]}),(0,D.jsxs)(`div`,{className:`max-h-48 overflow-y-auto`,children:[(r.data?.entries??[]).map(e=>(0,D.jsxs)(`div`,{className:`flex items-center rounded-md transition-colors hover:bg-elevated`,children:[(0,D.jsxs)(`button`,{type:`button`,onClick:()=>t(e.path),className:`flex min-w-0 flex-1 items-center gap-2 px-2 py-1 text-left`,children:[e.is_git?(0,D.jsx)(y,{className:`size-3.5 shrink-0 text-success`}):(0,D.jsx)(T,{className:`size-3.5 shrink-0 text-fg-gold`}),(0,D.jsx)(`span`,{className:`truncate text-xs text-fg`,children:e.name})]}),e.is_git&&(0,D.jsx)(`button`,{type:`button`,onClick:()=>n(e.path),className:`shrink-0 px-2 py-1 text-2xs text-fg-muted transition-colors hover:text-fg`,children:`choose`})]},e.path)),r.data!==void 0&&r.data.entries.length===0&&(0,D.jsx)(`p`,{className:`px-2 py-1 text-xs text-fg-muted`,children:`No subdirectories.`})]})]})}function M({profileId:e,open:t,onOpenChange:n}){let d=l(),y=s(i().data?.protocol),C=o(),T=r(),A=f(),M=c(),[N,P]=(0,E.useState)(``),[F,I]=(0,E.useState)(``),[L,R]=(0,E.useState)(!1),[z,B]=(0,E.useState)(``),[V,H]=(0,E.useState)(!1),[U,W]=(0,E.useState)(null),[G,K]=(0,E.useState)(null),q=M.data?.home,J=()=>{let e=N.trim(),t=k(e)&&q!==void 0?O(e.replace(/^~(?=\/|$)/,q)):k(e)&&e.startsWith(`/`)?O(e):q??`/`;X(t)},Y=e=>{I(e),V||B(p(e))},X=e=>{K(e),P(e)},Z=e=>{P(e),K(null),Y(e.split(`/`).filter(Boolean).pop()??``),R(!0)},Q=a(w(N,150)),ne=(0,E.useMemo)(()=>{if(!k(N))return(d.data??[]).map(e=>({value:e.path,badge:`registered`,is_git:!0}));let e=new Set((d.data??[]).map(e=>e.path));return(Q.data?.entries??[]).map(t=>({value:t.path,label:t.name,badge:e.has(t.path)?`registered`:t.is_git?`git`:void 0,is_git:t.is_git}))},[N,d.data,Q.data]),re=async()=>{W(null);try{let t=O(N),r=d.data?.find(e=>e.path===t)?.id??(await C.mutateAsync({path:t,...y?{default_base_branch:``}:{}})).id,i=await T.mutateAsync({profile_id:e,repo_id:r,name:F.trim(),...u(z)?{abbrev:u(z)}:{}});n(!1),A(`/project/${i.id}`)}catch(e){W(e instanceof Error?e.message:String(e))}},$=F.trim()!==``&&k(N.trim());return(0,D.jsx)(_,{open:t,onOpenChange:n,children:(0,D.jsxs)(ee,{children:[(0,D.jsxs)(m,{children:[(0,D.jsx)(te,{children:`New project`}),(0,D.jsx)(g,{children:`Point at a git repository on the daemon host — known repositories are reused.`})]}),(0,D.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),$&&re()},children:[(0,D.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,D.jsx)(b,{htmlFor:`repo-path`,children:`Repository path`}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>G===null?J():K(null),className:`text-2xs text-fg-muted transition-colors hover:text-fg`,children:G===null?`browse…`:`hide browser`})]}),(0,D.jsx)(x,{id:`repo-path`,placeholder:`~/src/my-repo`,value:N,onValueChange:P,onChoose:e=>{!L&&e.is_git&&Y(e.value.split(`/`).filter(Boolean).pop()??``)},hints:ne}),G!==null&&(0,D.jsx)(j,{dir:G,onNavigate:X,onChoose:Z})]}),(0,D.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,D.jsx)(b,{htmlFor:`project-name`,children:`Project name`}),(0,D.jsx)(S,{id:`project-name`,placeholder:`e.g. checkout-rework`,value:F,onChange:e=>{Y(e.target.value),R(!0)}})]}),(0,D.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,D.jsx)(b,{htmlFor:`project-abbrev`,children:`Abbreviation`}),(0,D.jsx)(S,{id:`project-abbrev`,placeholder:F.trim()?p(F):`ABBRV`,maxLength:5,value:z,onChange:e=>{B(u(e.target.value)),H(!0)},className:`w-24 uppercase`}),(0,D.jsxs)(`p`,{className:`text-2xs text-fg-muted`,children:[`Up to `,5,` characters — the project's label on the collapsed sidebar rail.`]})]}),U&&(0,D.jsx)(`p`,{className:`text-xs text-danger`,children:U}),(0,D.jsxs)(h,{children:[(0,D.jsx)(v,{type:`button`,variant:`ghost`,onClick:()=>n(!1),children:`Cancel`}),(0,D.jsx)(v,{type:`submit`,disabled:!$||C.isPending||T.isPending,children:`Create project`})]})]})]})})}export{M as t};