@marimo-team/frontend 0.24.1-dev42 → 0.24.1-dev43

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 (174) hide show
  1. package/dist/assets/{CellStatus-CfNQG_fZ.js → CellStatus-B6CWKORY.js} +1 -1
  2. package/dist/assets/ConnectedDataExplorerComponent-DZnvpjue.js +1 -0
  3. package/dist/assets/JsonOutput-BI2qFHVr.js +50 -0
  4. package/dist/assets/MarimoErrorOutput-BXh29HCp.js +6 -0
  5. package/dist/assets/RenderHTML-COTZYPO7.js +1 -0
  6. package/dist/assets/RunButton-DTUzITFm.js +1 -0
  7. package/dist/assets/VisuallyHidden-DurJ_JBW.js +1 -0
  8. package/dist/assets/{add-cell-with-ai-CGBEoX6T.js → add-cell-with-ai-B0RdHenk.js} +19 -19
  9. package/dist/assets/add-connection-dialog-CcnJ2LkX.js +166 -0
  10. package/dist/assets/agent-panel-PB0I1dIC.js +286 -0
  11. package/dist/assets/ai-model-dropdown-DjQy2bo-.js +3 -0
  12. package/dist/assets/app-config-button-COFLeJCU.js +1 -0
  13. package/dist/assets/{blob-ChElOQvm.js → blob-BBiZd3vX.js} +1 -1
  14. package/dist/assets/{cache-panel-CLfGxru6.js → cache-panel-MAXVmKkG.js} +1 -1
  15. package/dist/assets/cell-editor-5wcJHF0s.js +24 -0
  16. package/dist/assets/cell-link-BbAJokoX.js +1 -0
  17. package/dist/assets/cells-B1S_6FG3.js +227 -0
  18. package/dist/assets/chat-display-ClG9MRI_.js +1 -0
  19. package/dist/assets/chat-panel-BRoqCSCR.js +4 -0
  20. package/dist/assets/chat-ui-CNvkb287.js +4 -0
  21. package/dist/assets/circle--ysFeW9z.js +1 -0
  22. package/dist/assets/column-preview-D6cIOnWQ.js +1 -0
  23. package/dist/assets/command-palette-DtZy0Am-.js +1 -0
  24. package/dist/assets/common-BGLbVHCS.js +1 -0
  25. package/dist/assets/components-BAvTsivu.js +1 -0
  26. package/dist/assets/config-DcB2swfZ.js +1 -0
  27. package/dist/assets/context-Do8M9TDF.js +1 -0
  28. package/dist/assets/{datasource-C0_eJO-0.js → datasource-BrSYgi6C.js} +2 -2
  29. package/dist/assets/dependency-graph-panel-C13q-nga.js +5 -0
  30. package/dist/assets/{documentation-panel-CxjnCPq6.js → documentation-panel-CtQqNEQw.js} +1 -1
  31. package/dist/assets/{download-CxzOE8FX.js → download-CIdXYNHv.js} +1 -1
  32. package/dist/assets/dropdown-menu-CqNabM1f.js +1 -0
  33. package/dist/assets/edit-page-jAyDC21z.js +9 -0
  34. package/dist/assets/{error-entries-DCRQWi_N.js → error-entries-DEjvzkum.js} +1 -1
  35. package/dist/assets/{error-panel-Bx5cPw6N.js → error-panel-BvrDwUv8.js} +1 -1
  36. package/dist/assets/file-explorer-panel-DYujxxK-.js +1 -0
  37. package/dist/assets/{file-icons-DxXY84Jn.js → file-icons-Bo1Ewf1W.js} +1 -1
  38. package/dist/assets/file-name-input-BDGq0-ac.js +3 -0
  39. package/dist/assets/{floating-outline-gjfcwmyU.js → floating-outline-CNsG18LK.js} +1 -1
  40. package/dist/assets/{gallery-page-BI3aTl8u.js → gallery-page-4dZlIWMe.js} +1 -1
  41. package/dist/assets/{glide-data-editor-CrWGp7DP.js → glide-data-editor-BQNVc0zc.js} +2 -2
  42. package/dist/assets/home-page-CFAldshJ.js +4 -0
  43. package/dist/assets/html-to-image-DMn_7CCA.js +2 -0
  44. package/dist/assets/index-0VrRpta0.css +2 -0
  45. package/dist/assets/index-BBPHmHdW.js +29 -0
  46. package/dist/assets/input-DeyycFtq.js +7 -0
  47. package/dist/assets/{layout-BQjGHHu-.js → layout-Ddsz1eHh.js} +5 -5
  48. package/dist/assets/{logs-panel-D1RUMXL1.js → logs-panel-BSD1GETR.js} +1 -1
  49. package/dist/assets/markdown-renderer-DIXiKP4m.js +2 -0
  50. package/dist/assets/{mermaid-DtNubw9S.js → mermaid-CwvTqKGz.js} +2 -2
  51. package/dist/assets/{name-cell-input-DSKoNRk3.js → name-cell-input-zqypwqoZ.js} +1 -1
  52. package/dist/assets/{outline-panel-UIygpaO3.js → outline-panel-C5GAyqII.js} +1 -1
  53. package/dist/assets/packages-panel-CYLyGihe.js +1 -0
  54. package/dist/assets/{pair-with-agent-modal-Pl5cv7Gv.js → pair-with-agent-modal-CBIL9_6g.js} +2 -2
  55. package/dist/assets/panel-accordion-state-DmV3OgfX.js +1 -0
  56. package/dist/assets/panels-D53vWR00.js +4 -0
  57. package/dist/assets/{process-output-BWDSbk5d.js → process-output-DNhz9LLW.js} +1 -1
  58. package/dist/assets/{readonly-code-display-Bbnq-khe.js → readonly-code-display-CKT-gv1m.js} +1 -1
  59. package/dist/assets/readonly-python-code-De0vvuWh.js +1 -0
  60. package/dist/assets/{renderShortcut-Dj3NbkoC.js → renderShortcut-D9XYVNe3.js} +1 -1
  61. package/dist/assets/{reveal-component-Bgmfon3f.js → reveal-component-C0L5MU2W.js} +4 -4
  62. package/dist/assets/run-page-DXZapRtY.js +1 -0
  63. package/dist/assets/scratchpad-panel-ja6doGoa.js +1 -0
  64. package/dist/assets/secrets-panel-B7Rcwc2I.js +1 -0
  65. package/dist/assets/select-BUEX2Vfl.js +1 -0
  66. package/dist/assets/session-panel-ftyqfsYy.js +1 -0
  67. package/dist/assets/{skeleton-DGs-LrlZ.js → skeleton-CxFczTPo.js} +1 -1
  68. package/dist/assets/snippets-panel-BZ254lxN.js +1 -0
  69. package/dist/assets/{state-WVnIPIsw.js → state-MlBpc9qi.js} +3 -3
  70. package/dist/assets/{state-N_csMEH1.js → state-llVv0lIh.js} +1 -1
  71. package/dist/assets/switch-CBR-ykv3.js +1 -0
  72. package/dist/assets/tabs-c6mpccpH.js +1 -0
  73. package/dist/assets/{terminal-aLrVlOf6.js → terminal-OC_FnEas.js} +3 -3
  74. package/dist/assets/tracing-C0FGWieO.js +1 -0
  75. package/dist/assets/tracing-panel-LeIOi1Tv.js +2 -0
  76. package/dist/assets/{tree-actions-Ctf5W0DR.js → tree-actions-CrWpuExP.js} +1 -1
  77. package/dist/assets/useAddCell-DIdbaU70.js +1 -0
  78. package/dist/assets/useCellActionButton-DXyUqFdJ.js +1 -0
  79. package/dist/assets/{useDateFormatter-CfPcCT-J.js → useDateFormatter-BiqAQ-zI.js} +1 -1
  80. package/dist/assets/{useDeleteCell-6wcjnAMK.js → useDeleteCell-CSCMg7Up.js} +1 -1
  81. package/dist/assets/useDependencyPanelTab-Bt7aBDpS.js +1 -0
  82. package/dist/assets/useNotebookActions-ClT4GmnB.js +10 -0
  83. package/dist/assets/useNumberFormatter-DHJ9s6Vk.js +1 -0
  84. package/dist/assets/useRunCells-DHnbXALT.js +1 -0
  85. package/dist/assets/{useSplitCell-oIRu7Qlj.js → useSplitCell-CxlsGCB_.js} +1 -1
  86. package/dist/assets/{vega-component-D4OKyVdb.js → vega-component-CzgE5HEs.js} +1 -1
  87. package/dist/assets/write-secret-modal-BG_B6y1P.js +2 -0
  88. package/dist/index.html +57 -71
  89. package/package.json +1 -1
  90. package/src/components/datasources/datasources.tsx +16 -17
  91. package/src/components/editor/actions/useNotebookActions.tsx +50 -0
  92. package/src/components/editor/chrome/panels/components.tsx +1 -1
  93. package/src/components/editor/connections/__tests__/add-connection-button.test.tsx +129 -0
  94. package/src/components/editor/connections/add-connection-button.tsx +132 -0
  95. package/src/components/editor/connections/components.tsx +11 -0
  96. package/src/components/editor/connections/quick-add-data-sources.tsx +11 -11
  97. package/src/components/editor/controls/__tests__/notebook-menu-dropdown.test.tsx +109 -1
  98. package/src/components/storage/storage-inspector.tsx +15 -17
  99. package/src/core/codemirror/language/panel/sql.test.tsx +69 -0
  100. package/src/core/codemirror/language/panel/sql.tsx +81 -4
  101. package/dist/assets/ConnectedDataExplorerComponent-88Ojqyhx.js +0 -1
  102. package/dist/assets/DeferredRequestRegistry-C-SpvRCH.js +0 -1
  103. package/dist/assets/ImperativeModal-68zj0lxy.js +0 -1
  104. package/dist/assets/JsonOutput-pCdkYz4X.js +0 -50
  105. package/dist/assets/MarimoErrorOutput-b7bFhjgD.js +0 -6
  106. package/dist/assets/RSPContexts-D2JcYZo2.js +0 -1
  107. package/dist/assets/RenderHTML-BUuDW4yZ.js +0 -1
  108. package/dist/assets/RunButton-4MKgVYXU.js +0 -1
  109. package/dist/assets/SSRProvider-C_WMmqnS.js +0 -1
  110. package/dist/assets/add-connection-dialog-BcLKuMHt.js +0 -166
  111. package/dist/assets/agent-panel-BVyaNGyG.js +0 -286
  112. package/dist/assets/ai-model-dropdown-C_IoSmhR.js +0 -3
  113. package/dist/assets/app-config-button-BvpunAmJ.js +0 -1
  114. package/dist/assets/cell-editor-pKuytlrm.js +0 -24
  115. package/dist/assets/cell-link-D9d1y67_.js +0 -1
  116. package/dist/assets/cells-BdoPd1mK.js +0 -226
  117. package/dist/assets/chat-display-CbsB82vm.js +0 -1
  118. package/dist/assets/chat-panel-DCPKH1gP.js +0 -4
  119. package/dist/assets/chat-ui-BwLG6iSS.js +0 -4
  120. package/dist/assets/circle-plus-cm-FRu9O.js +0 -1
  121. package/dist/assets/column-preview-fku2dKeP.js +0 -1
  122. package/dist/assets/command-Cvmdzx0n.js +0 -1
  123. package/dist/assets/command-palette-BJFR8wKv.js +0 -1
  124. package/dist/assets/common-CQ9OqrFS.js +0 -1
  125. package/dist/assets/components-CaOG3LOY.js +0 -1
  126. package/dist/assets/config-xlrIxOZJ.js +0 -1
  127. package/dist/assets/context-Bf2wPdef.js +0 -1
  128. package/dist/assets/data-source-discovery-BsrDlL04.js +0 -1
  129. package/dist/assets/dependency-graph-panel-CxZJ5e7D.js +0 -5
  130. package/dist/assets/dialog-EjSc4yoH.js +0 -1
  131. package/dist/assets/dropdown-menu-BpI5klSq.js +0 -1
  132. package/dist/assets/edit-page-DwKN7vIP.js +0 -9
  133. package/dist/assets/field-YoG_gQAY.js +0 -1
  134. package/dist/assets/file-explorer-panel-CRrPqu3s.js +0 -1
  135. package/dist/assets/file-name-input-uFNWUWCc.js +0 -3
  136. package/dist/assets/focus-DgNLvj0o.js +0 -1
  137. package/dist/assets/form-CD2uATFu.js +0 -2
  138. package/dist/assets/form-GIq5QCAI.js +0 -1
  139. package/dist/assets/home-page-CYg3rQCB.js +0 -4
  140. package/dist/assets/html-to-image-Bt7Ld74W.js +0 -2
  141. package/dist/assets/index-CrsPwq0f.js +0 -29
  142. package/dist/assets/index-H2TMW127.css +0 -2
  143. package/dist/assets/input-BuOxQ3Wy.js +0 -1
  144. package/dist/assets/label-B67m1YH7.js +0 -1
  145. package/dist/assets/links-C7oaxPJK.js +0 -1
  146. package/dist/assets/markdown-renderer-C8IbrNw3.js +0 -2
  147. package/dist/assets/packages-panel-CIwyYf45.js +0 -1
  148. package/dist/assets/panel-accordion-state-DAAi8MPY.js +0 -1
  149. package/dist/assets/panels-DcguQKjE.js +0 -4
  150. package/dist/assets/popover-CgOo22ko.js +0 -1
  151. package/dist/assets/radio-group-DZoEgN7k.js +0 -1
  152. package/dist/assets/readonly-python-code-CyfabMFb.js +0 -1
  153. package/dist/assets/refresh-ccw-DrVG5f2L.js +0 -1
  154. package/dist/assets/request-registry-mNu7sXOU.js +0 -1
  155. package/dist/assets/run-page-Buh6gERG.js +0 -1
  156. package/dist/assets/scratchpad-panel-soCf5igY.js +0 -1
  157. package/dist/assets/secrets-panel-CCb8F6PC.js +0 -1
  158. package/dist/assets/select-DwqnFsyg.js +0 -1
  159. package/dist/assets/session-panel-BO4lOJc-.js +0 -1
  160. package/dist/assets/snippets-panel-CulFiQ0V.js +0 -1
  161. package/dist/assets/sparkles-30wHhAF5.js +0 -1
  162. package/dist/assets/state-B-K0k6lb.js +0 -1
  163. package/dist/assets/switch-VzdUoXkf.js +0 -1
  164. package/dist/assets/textarea-mD3C73jw.js +0 -1
  165. package/dist/assets/tracing-B_Qlv38-.js +0 -1
  166. package/dist/assets/tracing-panel--KVMPYqh.js +0 -2
  167. package/dist/assets/useCellActionButton-BDVM-sW-.js +0 -1
  168. package/dist/assets/useDependencyPanelTab-D4TnSeLa.js +0 -1
  169. package/dist/assets/useNotebookActions-gEpi1TfO.js +0 -10
  170. package/dist/assets/useNumberFormatter-BmUQe2Pf.js +0 -1
  171. package/dist/assets/usePress-CwOqeEX3.js +0 -7
  172. package/dist/assets/useRunCells-DP6cAHq0.js +0 -1
  173. package/dist/assets/write-secret-modal-dplU5PG8.js +0 -2
  174. package/dist/assets/x-BgkoSHM-.js +0 -1
@@ -1,4 +1,4 @@
1
- import{Ai as e,Oi as t,Ot as n,ki as r,rt as i,y as a}from"./cells-BdoPd1mK.js";import{i as o}from"./strings-CpYReX2Q.js";function s(t){if(r(t.mimetype)){if(!Array.isArray(t.data))return null;let e=t.data.filter(e=>!e.type.includes(`ancestor`));return e.length===0?null:{errorData:e}}return e(t.mimetype)?typeof t.data!=`string`||t.data.length===0?null:{errorData:[],tracebackHtml:t.data}:null}function c(e){return e.some(e=>`traceback`in e&&e.traceback)}function l(t){let n=t?.find(t=>e(t.mimetype));if(!(!n||typeof n.data!=`string`||n.data.length===0))return n.data}function u(e,t){if(e.tracebackHtml)return e.tracebackHtml;if(!c(e.errorData))return l(t)}function d(e){let{cellIds:r,cellRuntime:i,cellData:o}=e.get(a),c=[];for(let[e,a]of r.inOrderIds.entries()){let r=i[a],l=r.output;if(!l||!t(l.mimetype))continue;let d=s(l);if(!d)continue;let f=n(o[a].name,e),p=o[a].lastCodeRun??o[a].code;c.push({cellId:a,cellName:f,cellCode:p,errorData:d.errorData,tracebackHtml:u(d,r.consoleOutputs)})}return c}function f(e){return e.type===`setup-refs`?`The setup cell cannot have references`:e.type===`cycle`?`This cell is in a cycle`:e.type===`multiple-defs`?`The variable '${e.name}' was defined by another cell`:e.type===`import-star`||e.type===`ancestor-stopped`||e.type===`ancestor-prevented`||e.type===`exception`||e.type===`strict-exception`?e.msg:e.type===`interruption`?`This cell was interrupted and needs to be re-run`:e.type===`syntax`||e.type===`unknown`||e.type===`sql-error`?e.msg:e.type===`internal`?e.msg||`An internal error occurred`:(o(e),`Unknown error`)}function p(e){let t=f(e);return`traceback`in e&&e.traceback&&(t+=`\n\nTraceback:\n${i(e.traceback)}`),t}function m(e){let t=[e.cellName];return e.tracebackHtml&&t.push(i(e.tracebackHtml)),e.errorData.length>0&&t.push(e.errorData.map(p).join(`
1
+ import{Bn as e,Ga as t,Ka as n,Wa as r,rt as i,y as a}from"./cells-B1S_6FG3.js";import{i as o}from"./strings-CpYReX2Q.js";function s(e){if(t(e.mimetype)){if(!Array.isArray(e.data))return null;let t=e.data.filter(e=>!e.type.includes(`ancestor`));return t.length===0?null:{errorData:t}}return n(e.mimetype)?typeof e.data!=`string`||e.data.length===0?null:{errorData:[],tracebackHtml:e.data}:null}function c(e){return e.some(e=>`traceback`in e&&e.traceback)}function l(e){let t=e?.find(e=>n(e.mimetype));if(!(!t||typeof t.data!=`string`||t.data.length===0))return t.data}function u(e,t){if(e.tracebackHtml)return e.tracebackHtml;if(!c(e.errorData))return l(t)}function d(t){let{cellIds:n,cellRuntime:i,cellData:o}=t.get(a),c=[];for(let[t,a]of n.inOrderIds.entries()){let n=i[a],l=n.output;if(!l||!r(l.mimetype))continue;let d=s(l);if(!d)continue;let f=e(o[a].name,t),p=o[a].lastCodeRun??o[a].code;c.push({cellId:a,cellName:f,cellCode:p,errorData:d.errorData,tracebackHtml:u(d,n.consoleOutputs)})}return c}function f(e){return e.type===`setup-refs`?`The setup cell cannot have references`:e.type===`cycle`?`This cell is in a cycle`:e.type===`multiple-defs`?`The variable '${e.name}' was defined by another cell`:e.type===`import-star`||e.type===`ancestor-stopped`||e.type===`ancestor-prevented`||e.type===`exception`||e.type===`strict-exception`?e.msg:e.type===`interruption`?`This cell was interrupted and needs to be re-run`:e.type===`syntax`||e.type===`unknown`||e.type===`sql-error`?e.msg:e.type===`internal`?e.msg||`An internal error occurred`:(o(e),`Unknown error`)}function p(e){let t=f(e);return`traceback`in e&&e.traceback&&(t+=`\n\nTraceback:\n${i(e.traceback)}`),t}function m(e){let t=[e.cellName];return e.tracebackHtml&&t.push(i(e.tracebackHtml)),e.errorData.length>0&&t.push(e.errorData.map(p).join(`
2
2
 
3
3
  `)),t.join(`
4
4
 
@@ -1 +1 @@
1
- import"./rolldown-runtime-B0Z9INg1.js";import{t as e}from"./react-CBDbhulC.js";import{k as t}from"./cells-BdoPd1mK.js";import{t as n}from"./compiler-runtime-CYIjoINj.js";import{t as r}from"./jsx-runtime-B74pBk57.js";import{t as i}from"./createLucideIcon-B7HeEoG2.js";import{t as a}from"./MarimoErrorOutput-b7bFhjgD.js";import{n as o}from"./cell-link-D9d1y67_.js";import{t as s}from"./empty-state-kWyb5dCS.js";var c=i(`party-popper`,[[`path`,{d:`M5.8 11.3 2 22l10.7-3.79`,key:`gwxi1d`}],[`path`,{d:`M4 3h.01`,key:`1vcuye`}],[`path`,{d:`M22 8h.01`,key:`1mrtc2`}],[`path`,{d:`M15 2h.01`,key:`1cjtqr`}],[`path`,{d:`M22 20h.01`,key:`1mrys2`}],[`path`,{d:`m22 2-2.24.75a2.9 2.9 0 0 0-1.96 3.12c.1.86-.57 1.63-1.45 1.63h-.38c-.86 0-1.6.6-1.76 1.44L14 10`,key:`hbicv8`}],[`path`,{d:`m22 13-.82-.33c-.86-.34-1.82.2-1.98 1.11c-.11.7-.72 1.22-1.43 1.22H17`,key:`1i94pl`}],[`path`,{d:`m11 2 .33.82c.34.86-.2 1.82-1.11 1.98C9.52 4.9 9 5.52 9 6.23V7`,key:`1cofks`}],[`path`,{d:`M11 13c1.93 1.93 2.83 4.17 2 5-.83.83-3.07-.07-5-2-1.93-1.93-2.83-4.17-2-5 .83-.83 3.07.07 5 2Z`,key:`4kbmks`}]]),l=n();e();var u=r(),d=()=>{let e=(0,l.c)(5),n=t();if(n.length===0){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,u.jsx)(s,{title:`No errors!`,icon:(0,u.jsx)(c,{})}),e[0]=t):t=e[0],t}let r;e[1]===n?r=e[2]:(r=n.map(f),e[1]=n,e[2]=r);let i;return e[3]===r?i=e[4]:(i=(0,u.jsx)(`div`,{className:`flex flex-col h-full overflow-auto`,children:r}),e[3]=r,e[4]=i),i};function f(e){return(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`div`,{className:`text-xs font-mono font-semibold bg-muted border-y px-2 py-1`,children:(0,u.jsx)(o,{cellId:e.cellId})}),(0,u.jsx)(`div`,{className:`px-2`,children:(0,u.jsx)(a,{errors:e.output.data,cellId:e.cellId},e.cellId)},e.cellId)]},e.cellId)}export{d as default};
1
+ import"./rolldown-runtime-B0Z9INg1.js";import{t as e}from"./react-CBDbhulC.js";import{k as t}from"./cells-B1S_6FG3.js";import{t as n}from"./compiler-runtime-CYIjoINj.js";import{t as r}from"./jsx-runtime-B74pBk57.js";import{t as i}from"./createLucideIcon-B7HeEoG2.js";import{t as a}from"./MarimoErrorOutput-BXh29HCp.js";import{n as o}from"./cell-link-BbAJokoX.js";import{t as s}from"./empty-state-kWyb5dCS.js";var c=i(`party-popper`,[[`path`,{d:`M5.8 11.3 2 22l10.7-3.79`,key:`gwxi1d`}],[`path`,{d:`M4 3h.01`,key:`1vcuye`}],[`path`,{d:`M22 8h.01`,key:`1mrtc2`}],[`path`,{d:`M15 2h.01`,key:`1cjtqr`}],[`path`,{d:`M22 20h.01`,key:`1mrys2`}],[`path`,{d:`m22 2-2.24.75a2.9 2.9 0 0 0-1.96 3.12c.1.86-.57 1.63-1.45 1.63h-.38c-.86 0-1.6.6-1.76 1.44L14 10`,key:`hbicv8`}],[`path`,{d:`m22 13-.82-.33c-.86-.34-1.82.2-1.98 1.11c-.11.7-.72 1.22-1.43 1.22H17`,key:`1i94pl`}],[`path`,{d:`m11 2 .33.82c.34.86-.2 1.82-1.11 1.98C9.52 4.9 9 5.52 9 6.23V7`,key:`1cofks`}],[`path`,{d:`M11 13c1.93 1.93 2.83 4.17 2 5-.83.83-3.07-.07-5-2-1.93-1.93-2.83-4.17-2-5 .83-.83 3.07.07 5 2Z`,key:`4kbmks`}]]),l=n();e();var u=r(),d=()=>{let e=(0,l.c)(5),n=t();if(n.length===0){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,u.jsx)(s,{title:`No errors!`,icon:(0,u.jsx)(c,{})}),e[0]=t):t=e[0],t}let r;e[1]===n?r=e[2]:(r=n.map(f),e[1]=n,e[2]=r);let i;return e[3]===r?i=e[4]:(i=(0,u.jsx)(`div`,{className:`flex flex-col h-full overflow-auto`,children:r}),e[3]=r,e[4]=i),i};function f(e){return(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`div`,{className:`text-xs font-mono font-semibold bg-muted border-y px-2 py-1`,children:(0,u.jsx)(o,{cellId:e.cellId})}),(0,u.jsx)(`div`,{className:`px-2`,children:(0,u.jsx)(a,{errors:e.output.data,cellId:e.cellId},e.cellId)},e.cellId)]},e.cellId)}export{d as default};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,f as n,l as r,r as i,t as a}from"./useEvent-xfs0Sn4r.js";import{t as o}from"./react-CBDbhulC.js";import{At as s,Ct as c,Dn as l,Dt as u,E as d,Et as f,Ht as p,Ot as m,Tt as h,bn as g,bo as _,gn as v,go as y,ia as b,kt as x,ni as S,wt as C,xn as w}from"./cells-B1S_6FG3.js";import{t as T}from"./compiler-runtime-CYIjoINj.js";import{g as E}from"./useEventListener-D27Dii_l.js";import{t as D}from"./invariant-Ci2dTZ72.js";import{g as O,p as k}from"./utils-R_pHe-RB.js";import{N as A,r as j}from"./config-CUBl5qBg.js";import{t as M}from"./cn-ldLVeaqm.js";import{t as N}from"./jsx-runtime-B74pBk57.js";import{r as P}from"./config-DcB2swfZ.js";import{o as F}from"./alert-dialog-DBoy-FMx.js";import{a as I,c as L,p as R,r as z,t as B}from"./dropdown-menu-CqNabM1f.js";import{Pt as V,a as H,h as U,i as W,o as G,s as K}from"./JsonOutput-BI2qFHVr.js";import{c as ee,n as q,r as te}from"./download-CIdXYNHv.js";import{t as J}from"./tooltip-D7dq6bnc.js";import{n as ne,t as Y}from"./button-BMBznEru.js";import{Tt as re}from"./dist-PIe1xcZo.js";import{n as ie,r as ae,t as oe}from"./requests-C6_IaFh7.js";import{t as X}from"./createLucideIcon-B7HeEoG2.js";import{t as se}from"./arrow-left-DrqK6gPp.js";import{n as ce}from"./LazyAnyLanguageCodeMirror-YVX2AZaI.js";import{r as le}from"./useNumberFormatter-DHJ9s6Vk.js";import{a as ue,i as de,n as fe,r as pe,t as me}from"./tree-actions-CrWpuExP.js";import{a as he}from"./markdown-renderer-DIXiKP4m.js";import{u as ge}from"./toDate-hGYJX0Ha.js";import{t as _e}from"./copy-BMXKNElG.js";import{t as ve}from"./external-link-Bp3BxyRA.js";import{a as ye,i as be,n as xe,r as Se,t as Ce}from"./file-icons-Bo1Ewf1W.js";import{t as we}from"./file-DF8n85RA.js";import{n as Te,t as Ee}from"./components-DwH_Yb1N.js";import{b as De}from"./write-secret-modal-BG_B6y1P.js";import{n as Oe,t as ke}from"./spinner-Ck-Hgfvj.js";import{a as Ae,c as je,d as Me,f as Ne,i as Pe,l as Fe,n as Ie,r as Le,t as Re,u as ze}from"./file-name-input-BDGq0-ac.js";import{t as Be}from"./refresh-cw-Bf-rx_aV.js";import{t as Ve}from"./save-BybsbOKz.js";import{t as He}from"./triangle-alert-MihykDYG.js";import{n as Ue,t as We}from"./es-BuMFDpR4.js";import{t as Ge}from"./use-toast-DpWHUGuF.js";import{t as Ke}from"./paths-zcL04qUW.js";import{t as qe}from"./context-Do8M9TDF.js";import{n as Je}from"./useAsyncData-Buhk-UgR.js";import{n as Ye}from"./copy-Cg05mM3C.js";import{t as Xe}from"./copy-icon-LPQzn7_f.js";import{t as Ze}from"./blob-BBiZd3vX.js";import{n as Qe,t as $e}from"./alert-dmKwNsrp.js";import{n as et}from"./error-banner-B3KYUlCX.js";import{a as tt}from"./renderShortcut-D9XYVNe3.js";import{t as nt}from"./bundle.esm-DzY74mzC.js";import{t as rt}from"./useAddCell-DIdbaU70.js";import{n as it}from"./pathUtils-Cryrlpma.js";import{n as at}from"./semaphore-BjoL5P0h.js";import{t as ot}from"./empty-state-kWyb5dCS.js";import{t as st}from"./formatting-BJlT1s_3.js";import{a as ct,i as lt,n as ut,o as dt,r as ft,s as pt,t as mt}from"./components-BAvTsivu.js";import{n as ht,t as gt}from"./marimo-icons-C3KxMV9A.js";import{t as _t}from"./links-DPh7yoP-.js";import{n as vt}from"./panel-accordion-state-DmV3OgfX.js";var yt=X(`book-plus`,[[`path`,{d:`M12 7v6`,key:`lw1j43`}],[`path`,{d:`M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20`,key:`k3hazp`}],[`path`,{d:`M9 10h6`,key:`9gxzsh`}]]),bt=X(`copy-minus`,[[`line`,{x1:`12`,x2:`18`,y1:`15`,y2:`15`,key:`1nscbv`}],[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),xt=X(`file-plus-corner`,[[`path`,{d:`M11.35 22H6a2 2 0 0 1-2-2V4a2 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 8v5.35`,key:`17jvcc`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M14 19h6`,key:`bvotb8`}],[`path`,{d:`M17 16v6`,key:`18yu1i`}]]),St=X(`file-symlink`,[[`path`,{d:`M4 11V4a2 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 2H6a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h7`,key:`huwfnr`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m10 18 3-3-3-3`,key:`18f6ys`}]]),Ct=X(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`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`}]]),wt=X(`list-tree`,[[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`M3 10a2 2 0 0 0 2 2h3`,key:`1npucw`}],[`path`,{d:`M3 5v12a2 2 0 0 0 2 2h3`,key:`x1gjn2`}]]),Tt=X(`square-play`,[[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}],[`path`,{d:`M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z`,key:`kmsa83`}]]),Et=X(`view`,[[`path`,{d:`M21 17v2a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-2`,key:`mrq65r`}],[`path`,{d:`M21 7V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2`,key:`be3xqs`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`path`,{d:`M18.944 12.33a1 1 0 0 0 0-.66 7.5 7.5 0 0 0-13.888 0 1 1 0 0 0 0 .66 7.5 7.5 0 0 0 13.888 0`,key:`11ak4c`}]]),Z=e(o(),1),Q=T(),$=N(),Dt=e=>{let t=(0,Q.c)(17),{filename:n,filenameIcon:r,onBack:i,onRefresh:a,onDownload:o,actions:s}=e,c;t[0]===i?c=t[1]:(c=i&&(0,$.jsx)(J,{content:`Back to file list`,children:(0,$.jsx)(Y,{variant:`text`,size:`xs`,onClick:i,children:(0,$.jsx)(se,{className:`h-4 w-4`})})}),t[0]=i,t[1]=c);let l;t[2]!==n||t[3]!==r?(l=n?(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5 flex-1 min-w-0 text-xs font-semibold truncate`,children:[r,n]}):(0,$.jsx)(`span`,{className:`flex-1`}),t[2]=n,t[3]=r,t[4]=l):l=t[4];let u;t[5]===a?u=t[6]:(u=a&&(0,$.jsx)(J,{content:`Refresh`,children:(0,$.jsx)(Y,{variant:`text`,size:`xs`,onClick:a,children:(0,$.jsx)(Be,{className:`h-3.5 w-3.5`})})}),t[5]=a,t[6]=u);let d;t[7]===o?d=t[8]:(d=o&&(0,$.jsx)(J,{content:`Download`,children:(0,$.jsx)(Y,{variant:`text`,size:`xs`,onClick:o,children:(0,$.jsx)(V,{className:`h-3.5 w-3.5`})})}),t[7]=o,t[8]=d);let f;t[9]!==s||t[10]!==u||t[11]!==d?(f=(0,$.jsxs)(`div`,{className:`flex items-center gap-0.5 shrink-0`,children:[u,s,d]}),t[9]=s,t[10]=u,t[11]=d,t[12]=f):f=t[12];let p;return t[13]!==c||t[14]!==l||t[15]!==f?(p=(0,$.jsxs)(`div`,{className:`flex items-center shrink-0 border-b px-1 gap-1`,children:[c,l,f]}),t[13]=c,t[14]=l,t[15]=f,t[16]=p):p=t[16],p},Ot=new Set([`http`,`file`,`in-memory`]);function kt(e){return JSON.stringify(e).slice(1,-1)}var At=new Set([`datasets`,`spaces`,`buckets`]);function jt(e){let t=e.split(`/`).filter(Boolean);return t[0]===`datasets`&&t.length>=4?{repoType:`dataset`,repoId:`${t[1]}/${t[2]}`,filename:t.slice(3).join(`/`)}:t[0]===`spaces`&&t.length>=4?{repoType:`space`,repoId:`${t[1]}/${t[2]}`,filename:t.slice(3).join(`/`)}:t.length>=3&&!At.has(t[0])?{repoType:`model`,repoId:`${t[0]}/${t[1]}`,filename:t.slice(2).join(`/`)}:null}function Mt(e){return`from huggingface_hub import hf_hub_download\n\nlocal_path = hf_hub_download(\n repo_id="${kt(e.repoId)}",\n filename="${kt(e.filename)}",\n repo_type="${kt(e.repoType)}",\n)`}var Nt=[{id:`read-file`,label:`Insert read snippet`,icon:yt,getCode:e=>{if(e.entry.kind===`directory`)return null;let t=kt(e.entry.path);if(e.backendType===`huggingface`){let t=jt(e.entry.path);return t?`${Mt(t)}\n\nwith open(local_path, "rb") as f:\n _data = f.read()\n_data`:null}return e.backendType===`obstore`?`_data = ${e.variableName}.get("${t}").bytes()\n_data`:`_data = ${e.variableName}.cat_file("${t}")\n_data`}},{id:`download-file`,label:`Insert download snippet`,icon:St,getCode:e=>{if(e.entry.kind===`directory`)return null;let t=kt(e.entry.path);if(e.backendType===`huggingface`){let t=jt(e.entry.path);return t?`${Mt(t)}\nlocal_path`:null}if(e.backendType===`obstore`)return Ot.has(e.protocol)?null:`from datetime import timedelta\nfrom obstore import sign\n\nsigned_url = sign(\n ${e.variableName}, "GET", "${t}",\n expires_in=timedelta(hours=1),\n)\nsigned_url`;let n=kt(e.entry.path.split(`/`).pop()||`download`);return`${e.variableName}.get("${t}", "${n}")`}}],Pt=104857600;function Ft(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.split(`/`);return n[n.length-1]||t}var It=e=>{let t=(0,Q.c)(82),{entry:n,namespace:r,protocol:i,backendType:a,onBack:o}=e,{locale:c}=qe(),l=rt(),u;t[0]===n.path?u=t[1]:(u=Ft(n.path),t[0]=n.path,t[1]=u);let d=u,f=n.mimeType||`text/plain`,p;t[2]===f?p=t[3]:(p=K(f),t[2]=f,t[3]=p);let m=p,h=m&&n.size>Pt&&n.size>0,g,_;t[4]!==n.path||t[5]!==m||t[6]!==r||t[7]!==h?(g=async()=>{if(h)return null;let e=await s.request({namespace:r,path:n.path,preview:!m});if(e.error)throw Error(e.error);if(!e.url)throw Error(`No URL returned`);if(m)return{type:`media`,url:e.url};let t=await fetch(e.url);if(!t.ok)throw Error(`Failed to fetch preview: ${t.statusText}`);return{type:`text`,content:await t.text()}},_=[r,n.path,m,h],t[4]=n.path,t[5]=m,t[6]=r,t[7]=h,t[8]=g,t[9]=_):(g=t[8],_=t[9]);let{data:v,isPending:y,error:b,refetch:x}=Je(g,_),S;t[10]!==n.path||t[11]!==d||t[12]!==r?(S=async()=>{try{let e=await s.request({namespace:r,path:n.path});if(e.error){Ge({title:`Download failed`,description:e.error,variant:`danger`});return}e.url&&te(e.url,e.filename??d)}catch(e){let t=e;E.error(`Failed to download storage entry`,t),Ge({title:`Download failed`,description:String(t),variant:`danger`})}},t[10]=n.path,t[11]=d,t[12]=r,t[13]=S):S=t[13];let C=S,w;t[14]!==l||t[15]!==a||t[16]!==n||t[17]!==r||t[18]!==i?(w=Nt.map(e=>{let t=e.getCode({variableName:r,protocol:i,entry:n,backendType:a});if(t===null)return null;let o=e.icon;return(0,$.jsx)(J,{content:e.label,children:(0,$.jsx)(Y,{variant:`text`,size:`xs`,onClick:()=>l(t),"aria-label":e.label,children:(0,$.jsx)(o,{className:`h-3.5 w-3.5`})})},e.id)}),t[14]=l,t[15]=a,t[16]=n,t[17]=r,t[18]=i,t[19]=w):w=t[19];let T=w,D;t[20]===d?D=t[21]:(D=be(d),t[20]=d,t[21]=D);let O;t[22]!==C||t[23]!==d||t[24]!==o||t[25]!==T||t[26]!==D?(O=(0,$.jsx)(Dt,{filename:d,filenameIcon:D,onBack:o,onDownload:C,actions:T}),t[22]=C,t[23]=d,t[24]=o,t[25]=T,t[26]=D,t[27]=O):O=t[27];let k=O,A;t[28]!==n.lastModified||t[29]!==n.path||t[30]!==n.size||t[31]!==c||t[32]!==f?(A=e=>{let{includeMime:t}=e,r=t!==void 0&&t;return(0,$.jsxs)(`div`,{className:`grid grid-cols-[auto_1fr] gap-x-4 gap-y-1.5 p-4 text-xs`,children:[(0,$.jsx)(`span`,{className:`text-muted-foreground font-medium`,children:`Path`}),(0,$.jsxs)(`div`,{className:`truncate flex items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`font-mono text-[11px]`,children:n.path}),(0,$.jsx)(Xe,{value:n.path,className:`h-3 w-3`})]}),r&&(0,$.jsx)(`span`,{className:`text-muted-foreground font-medium`,children:`Type`}),r&&(0,$.jsx)(`span`,{children:f}),n.size>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`text-muted-foreground font-medium`,children:`Size`}),(0,$.jsx)(`span`,{children:st(n.size,c)})]}),n.lastModified!=null&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`text-muted-foreground font-medium`,children:`Modified`}),(0,$.jsx)(`span`,{children:new Date(n.lastModified*1e3).toLocaleString()})]})]})},t[28]=n.lastModified,t[29]=n.path,t[30]=n.size,t[31]=c,t[32]=f,t[33]=A):A=t[33];let j=A;if(h){let e;t[34]===j?e=t[35]:(e=j({includeMime:!0}),t[34]=j,t[35]=e);let r;t[36]!==n.size||t[37]!==c?(r=st(n.size,c),t[36]=n.size,t[37]=c,t[38]=r):r=t[38];let i;t[39]===r?i=t[40]:(i=(0,$.jsxs)(`div`,{className:`px-4 pb-4 text-xs text-muted-foreground italic`,children:[`File is too large to preview (`,r,`).`]}),t[39]=r,t[40]=i);let a;return t[41]!==k||t[42]!==e||t[43]!==i?(a=(0,$.jsxs)(`div`,{className:`flex flex-col h-full`,children:[k,e,i]}),t[41]=k,t[42]=e,t[43]=i,t[44]=a):a=t[44],a}if(y){let e;t[45]===j?e=t[46]:(e=j({}),t[45]=j,t[46]=e);let n;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsxs)(`div`,{className:`flex-1 flex items-center justify-center gap-2 text-xs text-muted-foreground min-h-24`,children:[(0,$.jsx)(Oe,{className:`h-4 w-4 animate-spin`}),`Loading preview...`]}),t[47]=n):n=t[47];let r;return t[48]!==k||t[49]!==e?(r=(0,$.jsxs)(`div`,{className:`flex flex-col h-full`,children:[k,e,n]}),t[48]=k,t[49]=e,t[50]=r):r=t[50],r}if(b){let e;t[51]===j?e=t[52]:(e=j({includeMime:!0}),t[51]=j,t[52]=e);let n;t[53]===b.message?n=t[54]:(n=(0,$.jsxs)(`div`,{className:`px-4 pb-4 text-xs text-destructive`,children:[`Failed to load preview: `,b.message]}),t[53]=b.message,t[54]=n);let r;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(Be,{className:`h-3 w-3 mr-1`}),t[55]=r):r=t[55];let i;t[56]===x?i=t[57]:(i=(0,$.jsx)(`div`,{className:`px-4 pb-4`,children:(0,$.jsxs)(Y,{variant:`secondary`,size:`xs`,onClick:x,children:[r,`Retry`]})}),t[56]=x,t[57]=i);let a;return t[58]!==k||t[59]!==e||t[60]!==n||t[61]!==i?(a=(0,$.jsxs)(`div`,{className:`flex flex-col h-full`,children:[k,e,n,i]}),t[58]=k,t[59]=e,t[60]=n,t[61]=i,t[62]=a):a=t[62],a}if(v){let e;t[63]===j?e=t[64]:(e=j({}),t[63]=j,t[64]=e);let n=v.type===`text`?v.content:void 0,r;t[65]!==v.type||t[66]!==v.url?(r=v.type===`media`?{url:v.url}:void 0,t[65]=v.type,t[66]=v.url,t[67]=r):r=t[67];let i;t[68]!==f||t[69]!==n||t[70]!==r?(i=(0,$.jsx)(W,{mimeType:f,contents:n,mediaSource:r}),t[68]=f,t[69]=n,t[70]=r,t[71]=i):i=t[71];let a;return t[72]!==k||t[73]!==e||t[74]!==i?(a=(0,$.jsxs)(`div`,{className:`flex flex-col h-full`,children:[k,e,i]}),t[72]=k,t[73]=e,t[74]=i,t[75]=a):a=t[75],a}let M;t[76]===j?M=t[77]:(M=j({includeMime:!0}),t[76]=j,t[77]=M);let N;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,$.jsxs)(`div`,{className:`p-4 flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsx)(we,{className:`h-4 w-4`}),`Preview not available for this file type.`]}),t[78]=N):N=t[78];let P;return t[79]!==k||t[80]!==M?(P=(0,$.jsxs)(`div`,{className:`flex flex-col h-full`,children:[k,M,N]}),t[79]=k,t[80]=M,t[81]=P):P=t[81],P},Lt=16;function Rt(e){return{paddingLeft:e*Lt}}function zt(e,t){return new Date(e*1e3).toLocaleDateString(t,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function Bt(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.split(`/`);return n[n.length-1]||t}function Vt(e){return e.endsWith(`/`)?e:`${e}/`}function Ht(e,t){let n=e.metadata?.id;return typeof n==`string`&&n.length>0?n:`${e.path}::${t}`}function Ut(e,{namespace:t,searchValue:n,entriesByPath:r}){let i=n.trim().toLowerCase(),a=e.path.toLowerCase();if(Bt(e.path).toLowerCase().includes(i)||a.includes(i))return!0;if(e.kind===`directory`){let i=r.get(x(t,Vt(e.path)));if(i)return i.some(e=>Ut(e,{namespace:t,searchValue:n,entriesByPath:r}))}return!1}function Wt(e,t){return t.searchValue.trim()?e.filter(e=>Ut(e,t)):e}var Gt=5;function Kt(e){return{query:e,status:`idle`}}function qt(e){return e.status===`idle`||e.status===`error`||e.status===`capped`}function Jt(e,t,n){return t.get(e)===void 0||n.get(e)?.nextPageToken!=null}function Yt({hasSearch:e,hasLoadedMatches:t,isPending:n,remoteSearch:r,searchKey:i,entriesByPath:a,pageMetadataByPath:o}){return!e||t||n||!qt(r)?!1:Jt(i,a,o)}function Xt(e){let t=e.trim(),n=t.lastIndexOf(`/`);return n===-1?``:t.slice(0,n+1)}function Zt(e,t){let n=t.trim().toLowerCase();return!n||e.path.toLowerCase().includes(n)||Bt(e.path).toLowerCase().includes(n)}var Qt=e=>{let t=(0,Q.c)(15),{depth:n,isLoading:r,error:i,onLoadMore:a}=e,o;t[0]===n?o=t[1]:(o=Rt(n),t[0]=n,t[1]=o);let s;t[2]===r?s=t[3]:(s=r&&(0,$.jsx)(Oe,{className:`h-3 w-3 mr-1 animate-spin`}),t[2]=r,t[3]=s);let c=r?`Loading...`:`Load more`,l;t[4]!==r||t[5]!==a||t[6]!==s||t[7]!==c?(l=(0,$.jsxs)(Y,{variant:`text`,size:`xs`,className:`h-6 px-0 hover:text-blue-600`,disabled:r,onClick:a,children:[s,c]}),t[4]=r,t[5]=a,t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]===i?u=t[10]:(u=i&&(0,$.jsxs)(`span`,{className:`ml-2 text-destructive`,children:[`Failed to load: `,i.message]}),t[9]=i,t[10]=u);let d;return t[11]!==o||t[12]!==l||t[13]!==u?(d=(0,$.jsxs)(`div`,{className:`py-px text-xs`,style:o,children:[l,u]}),t[11]=o,t[12]=l,t[13]=u,t[14]=d):d=t[14],d},$t=e=>{let t=(0,Q.c)(44),{namespace:n,protocol:r,rootPath:i,backendType:a,prefix:o,depth:s,locale:c,searchValue:l,onOpenFile:d}=e,{entriesByPath:f}=h(),{entries:p,isPending:m,error:g,hasMore:_,loadMore:v,isLoadingMore:y,loadMoreError:b}=u(n,o);if(m){let e;t[0]===s?e=t[1]:(e=Rt(s),t[0]=s,t[1]=e);let n;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(Oe,{className:`h-3 w-3 animate-spin`}),t[2]=n):n=t[2];let r;return t[3]===e?r=t[4]:(r=(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 py-1 text-xs text-muted-foreground`,style:e,children:[n,`Loading...`]}),t[3]=e,t[4]=r),r}if(g){let e;t[5]===s?e=t[6]:(e=Rt(s),t[5]=s,t[6]=e);let n;return t[7]!==g.message||t[8]!==e?(n=(0,$.jsxs)(`div`,{className:`py-1 text-xs text-destructive`,style:e,children:[`Failed to load: `,g.message]}),t[7]=g.message,t[8]=e,t[9]=n):n=t[9],n}if(p.length===0){let e;t[10]===s?e=t[11]:(e=Rt(s),t[10]=s,t[11]=e);let n;return t[12]===e?n=t[13]:(n=(0,$.jsx)(`div`,{className:`py-1 text-xs text-muted-foreground italic`,style:e,children:`Empty`}),t[12]=e,t[13]=n),n}let x;if(t[14]!==a||t[15]!==p||t[16]!==s||t[17]!==f||t[18]!==c||t[19]!==n||t[20]!==d||t[21]!==r||t[22]!==i||t[23]!==l){let e=Wt(p,{namespace:n,searchValue:l,entriesByPath:f}),o;t[25]!==a||t[26]!==p||t[27]!==s||t[28]!==c||t[29]!==n||t[30]!==d||t[31]!==r||t[32]!==i||t[33]!==l?(o=e=>{let t=Ht(e,p.indexOf(e));return(0,$.jsx)(en,{rowKey:t,entry:e,namespace:n,protocol:r,rootPath:i,backendType:a,depth:s,locale:c,searchValue:l,onOpenFile:d},t)},t[25]=a,t[26]=p,t[27]=s,t[28]=c,t[29]=n,t[30]=d,t[31]=r,t[32]=i,t[33]=l,t[34]=o):o=t[34],x=e.map(o),t[14]=a,t[15]=p,t[16]=s,t[17]=f,t[18]=c,t[19]=n,t[20]=d,t[21]=r,t[22]=i,t[23]=l,t[24]=x}else x=t[24];let S;t[35]!==s||t[36]!==_||t[37]!==y||t[38]!==v||t[39]!==b?(S=_&&(0,$.jsx)(Qt,{depth:s,isLoading:y,error:b,onLoadMore:v}),t[35]=s,t[36]=_,t[37]=y,t[38]=v,t[39]=b,t[40]=S):S=t[40];let C;return t[41]!==x||t[42]!==S?(C=(0,$.jsxs)($.Fragment,{children:[x,S]}),t[41]=x,t[42]=S,t[43]=C):C=t[43],C},en=e=>{let t=(0,Q.c)(115),{entry:n,rowKey:r,namespace:i,protocol:a,rootPath:o,backendType:c,depth:l,locale:u,searchValue:d,onOpenFile:f}=e,[p,m]=(0,Z.useState)(!1),{entriesByPath:g}=h(),_=rt(),v=n.kind===`directory`,y,b,S,C,T,D,O,k,A,j,N;if(t[0]!==c||t[1]!==l||t[2]!==g||t[3]!==n||t[4]!==v||t[5]!==p||t[6]!==i||t[7]!==f||t[8]!==a||t[9]!==r||t[10]!==d){C=Bt(n.path);let e;t[22]===d?e=t[23]:(e=d.trim(),t[22]=d,t[23]=e);let o=!!e;T=v&&o&&C.toLowerCase().includes(d.trim().toLowerCase());let u;t[24]!==g||t[25]!==n.path||t[26]!==o||t[27]!==v||t[28]!==i||t[29]!==d?(u=v&&o&&!!g.get(x(i,Vt(n.path)))?.some(e=>Ut(e,{namespace:i,searchValue:d,entriesByPath:g})),t[24]=g,t[25]=n.path,t[26]=o,t[27]=v,t[28]=i,t[29]=d,t[30]=u):u=t[30],b=p||u;let h;t[31]!==n.path||t[32]!==i?(h=async()=>{try{let e=await s.request({namespace:i,path:n.path});if(e.error){Ge({title:`Download failed`,description:e.error,variant:`danger`});return}e.url&&te(e.url,e.filename??`download`)}catch(e){let t=e;E.error(`Failed to download storage entry`,t),Ge({title:`Download failed`,description:String(t),variant:`danger`})}},t[31]=n.path,t[32]=i,t[33]=h):h=t[33],S=h,y=w;let _=v&&`font-medium`;t[34]===_?D=t[35]:(D=M(`text-xs flex items-center gap-1.5 cursor-pointer rounded-none group h-6.5`,_),t[34]=_,t[35]=D),t[36]===l?O=t[37]:(O=Rt(l),t[36]=l,t[37]=O),k=`${i}:${r}`,t[38]!==c||t[39]!==b||t[40]!==n||t[41]!==v||t[42]!==i||t[43]!==f||t[44]!==a?(A=()=>{v?m(!b):f({entry:n,namespace:i,protocol:a,backendType:c})},t[38]=c,t[39]=b,t[40]=n,t[41]=v,t[42]=i,t[43]=f,t[44]=a,t[45]=A):A=t[45],t[46]!==b||t[47]!==v?(j=v?(0,$.jsx)(de,{isExpanded:b,className:`h-3 w-3`}):(0,$.jsx)(`span`,{className:`w-3 shrink-0`}),t[46]=b,t[47]=v,t[48]=j):j=t[48],N=v?(0,$.jsx)(ye,{className:M(`h-3.5 w-3.5 shrink-0`,xe.directory)}):be(C),t[0]=c,t[1]=l,t[2]=g,t[3]=n,t[4]=v,t[5]=p,t[6]=i,t[7]=f,t[8]=a,t[9]=r,t[10]=d,t[11]=y,t[12]=b,t[13]=S,t[14]=C,t[15]=T,t[16]=D,t[17]=O,t[18]=k,t[19]=A,t[20]=j,t[21]=N}else y=t[11],b=t[12],S=t[13],C=t[14],T=t[15],D=t[16],O=t[17],k=t[18],A=t[19],j=t[20],N=t[21];let P;t[49]===C?P=t[50]:(P=(0,$.jsx)(`span`,{className:`truncate flex-1 text-left`,children:C}),t[49]=C,t[50]=P);let F;t[51]!==n.size||t[52]!==u?(F=n.size>0&&(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground pr-2 opacity-0 group-hover:opacity-100 transition-opacity tabular-nums`,children:st(n.size,u)}),t[51]=n.size,t[52]=u,t[53]=F):F=t[53];let H;t[54]!==n.lastModified||t[55]!==u?(H=n.lastModified!=null&&(0,$.jsx)(J,{content:`Last modified: ${new Date(n.lastModified*1e3).toLocaleString()}`,children:(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground pr-1 opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap`,children:zt(n.lastModified,u)})}),t[54]=n.lastModified,t[55]=u,t[56]=H):H=t[56];let U;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,$.jsx)(R,{asChild:!0,children:(0,$.jsx)(fe,{iconClassName:`h-3 w-3`,onClick:rn})}),t[57]=U):U=t[57];let W;t[58]!==c||t[59]!==n||t[60]!==v||t[61]!==i||t[62]!==f||t[63]!==a?(W=!v&&(0,$.jsxs)(I,{onSelect:()=>f({entry:n,namespace:i,protocol:a,backendType:c}),children:[(0,$.jsx)(Et,{className:`h-3.5 w-3.5 mr-2`}),`View`]}),t[58]=c,t[59]=n,t[60]=v,t[61]=i,t[62]=f,t[63]=a,t[64]=W):W=t[64];let G;t[65]===n.path?G=t[66]:(G=async()=>{await Ye(n.path),Ge({title:`Copied to clipboard`})},t[65]=n.path,t[66]=G);let K;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,$.jsx)(_e,{className:me}),t[67]=K):K=t[67];let ee;t[68]===G?ee=t[69]:(ee=(0,$.jsxs)(I,{onSelect:G,children:[K,`Copy path`]}),t[68]=G,t[69]=ee);let q;t[70]!==S||t[71]!==v?(q=!v&&(0,$.jsxs)(I,{onSelect:()=>S(),children:[(0,$.jsx)(V,{className:`h-3.5 w-3.5 mr-2`}),`Download`]}),t[70]=S,t[71]=v,t[72]=q):q=t[72];let ne;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,$.jsx)(L,{}),t[73]=ne):ne=t[73];let Y;t[74]!==_||t[75]!==c||t[76]!==n||t[77]!==i||t[78]!==a?(Y=Nt.map(e=>{let t=e.getCode({variableName:i,protocol:a,entry:n,backendType:c});if(t===null)return null;let r=e.icon;return(0,$.jsxs)(I,{onSelect:()=>_(t),children:[(0,$.jsx)(r,{className:me}),e.label]},e.id)}),t[74]=_,t[75]=c,t[76]=n,t[77]=i,t[78]=a,t[79]=Y):Y=t[79];let re;t[80]!==W||t[81]!==ee||t[82]!==q||t[83]!==Y?(re=(0,$.jsxs)(B,{children:[U,(0,$.jsxs)(z,{align:`end`,onClick:an,onCloseAutoFocus:on,children:[W,ee,q,ne,Y]})]}),t[80]=W,t[81]=ee,t[82]=q,t[83]=Y,t[84]=re):re=t[84];let ie;t[85]!==re||t[86]!==F||t[87]!==H?(ie=(0,$.jsxs)(`div`,{className:`flex items-center`,children:[F,H,re]}),t[85]=re,t[86]=F,t[87]=H,t[88]=ie):ie=t[88];let ae;t[89]!==y||t[90]!==D||t[91]!==ie||t[92]!==O||t[93]!==k||t[94]!==A||t[95]!==j||t[96]!==N||t[97]!==P?(ae=(0,$.jsxs)(y,{className:D,style:O,value:k,onSelect:A,children:[j,N,P,ie]}),t[89]=y,t[90]=D,t[91]=ie,t[92]=O,t[93]=k,t[94]=A,t[95]=j,t[96]=N,t[97]=P,t[98]=ae):ae=t[98];let oe;t[99]!==c||t[100]!==l||t[101]!==b||t[102]!==n.path||t[103]!==v||t[104]!==u||t[105]!==i||t[106]!==f||t[107]!==a||t[108]!==o||t[109]!==d||t[110]!==T?(oe=v&&b&&(0,$.jsx)($t,{namespace:i,protocol:a,rootPath:o,backendType:c,prefix:Vt(n.path),depth:l+1,locale:u,searchValue:T?``:d,onOpenFile:f}),t[99]=c,t[100]=l,t[101]=b,t[102]=n.path,t[103]=v,t[104]=u,t[105]=i,t[106]=f,t[107]=a,t[108]=o,t[109]=d,t[110]=T,t[111]=oe):oe=t[111];let X;return t[112]!==ae||t[113]!==oe?(X=(0,$.jsxs)($.Fragment,{children:[ae,oe]}),t[112]=ae,t[113]=oe,t[114]=X):X=t[114],X},tn=e=>{let t=(0,Q.c)(66),{namespace:n,locale:r,searchValue:i,remoteSearch:a,onContinueRemoteSearch:o,onOpenFile:s}=e,[c,l]=(0,Z.useState)(!0),{entriesByPath:d,pageMetadataByPath:p}=h(),{clearNamespaceCache:m}=f(),g=n.name??n.displayName,{entries:_,isPending:v,error:y,hasMore:b,loadMore:S,isLoadingMore:C,loadMoreError:T,refetch:E}=u(g),D;t[0]!==m||t[1]!==g||t[2]!==E?(D=e=>{e.stopPropagation(),m(g),E()},t[0]=m,t[1]=g,t[2]=E,t[3]=D):D=t[3];let O=D,k=v?n.storageEntries:_,A;if(t[4]!==k||t[5]!==d||t[6]!==y||t[7]!==O||t[8]!==b||t[9]!==c||t[10]!==C||t[11]!==v||t[12]!==S||t[13]!==T||t[14]!==r||t[15]!==n.backendType||t[16]!==n.displayName||t[17]!==n.name||t[18]!==n.protocol||t[19]!==n.rootPath||t[20]!==g||t[21]!==o||t[22]!==s||t[23]!==p||t[24]!==a||t[25]!==i){let e=Wt(k,{namespace:g,searchValue:i,entriesByPath:d}),u=Xt(i),f=x(g,u),m=u===``?[]:d.get(f)??[],h=Wt(m,{namespace:g,searchValue:i,entriesByPath:d}),_;t[27]===i?_=t[28]:(_=i.trim(),t[27]=i,t[28]=_);let E=!!_,D=e.length>0||h.length>0,j=u!==``&&Yt({hasSearch:E,hasLoadedMatches:D,isPending:v,remoteSearch:a,searchKey:f,entriesByPath:d,pageMetadataByPath:p}),M=E&&e.length===0,N;bb0:{if(v&&k.length===0){let e;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(Oe,{className:`h-3 w-3 animate-spin`}),`Loading...`]}),t[29]=e):e=t[29],N=e;break bb0}if(a.status===`searching`){let e;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(Oe,{className:`h-3 w-3 animate-spin`}),`Searching more entries...`]}),t[30]=e):e=t[30],N=e;break bb0}if(a.status===`error`){let e;t[31]===a.error.message?e=t[32]:(e=(0,$.jsxs)(`span`,{className:`text-destructive`,children:[`Search failed: `,a.error.message]}),t[31]=a.error.message,t[32]=e),N=e;break bb0}if(a.status===`capped`){let e;t[33]===o?e=t[34]:(e=(0,$.jsx)(Y,{variant:`text`,size:`xs`,className:`h-5 px-0 text-xs hover:text-blue-600`,onClick:o,children:`Continue searching`}),t[33]=o,t[34]=e);let n;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(`span`,{className:`text-[10px]`,children:`(or press Enter)`}),t[35]=n):n=t[35];let r;t[36]===e?r=t[37]:(r=(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[`Searched more entries.`,e,n]}),t[36]=e,t[37]=r),N=r;break bb0}if(a.status===`exhausted`&&!D){N=`No matches`;break bb0}if(!E&&!v&&k.length===0){N=`No entries`;break bb0}if(j){let e;t[38]===o?e=t[39]:(e=(0,$.jsx)(Y,{variant:`text`,size:`xs`,className:`h-5 px-0 text-xs hover:text-blue-600`,onClick:o,children:`Search more entries`}),t[38]=o,t[39]=e);let n;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(`span`,{className:`text-[10px]`,children:`(or press Enter)`}),t[40]=n):n=t[40];let r;t[41]===e?r=t[42]:(r=(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[`No loaded matches.`,e,n]}),t[41]=e,t[42]=r),N=r;break bb0}if(E&&!D&&k.length>0){N=`No matches`;break bb0}N=null}let P=N,F;t[43]===c?F=t[44]:(F=()=>l(!c),t[43]=c,t[44]=F);let I;t[45]===c?I=t[46]:(I=(0,$.jsx)(de,{isExpanded:c,className:`h-3 w-3`}),t[45]=c,t[46]=I);let L;t[47]===n.protocol?L=t[48]:(L=(0,$.jsx)(Ee,{protocol:n.protocol}),t[47]=n.protocol,t[48]=L);let R;t[49]===n.displayName?R=t[50]:(R=(0,$.jsx)(`span`,{children:n.displayName}),t[49]=n.displayName,t[50]=R);let z;t[51]===n.name?z=t[52]:(z=n.name&&(0,$.jsxs)(`span`,{className:`text-xs text-muted-foreground font-normal`,children:[`(`,(0,$.jsx)(pt,{variableName:n.name}),`)`]}),t[51]=n.name,t[52]=z);let B;t[53]===O?B=t[54]:(B=(0,$.jsx)(pe,{onClick:O,tooltip:`Refresh storage connection`,className:`p-0`,iconClassName:`h-3 w-3`}),t[53]=O,t[54]=B);let V=n.rootPath||`(root)`,H;t[55]===V?H=t[56]:(H=(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground font-normal tabular-nums ml-auto`,children:V}),t[55]=V,t[56]=H);let W;t[57]!==n.name||t[58]!==B||t[59]!==H||t[60]!==F||t[61]!==I||t[62]!==L||t[63]!==R||t[64]!==z?(W=(0,$.jsxs)(w,{value:n.name,onSelect:F,className:`flex flex-row font-semibold h-7 text-xs gap-1.5 bg-(--slate-2) text-muted-foreground rounded-none`,children:[I,L,R,z,B,H]}),t[57]=n.name,t[58]=B,t[59]=H,t[60]=F,t[61]=I,t[62]=L,t[63]=R,t[64]=z,t[65]=W):W=t[65],A=(0,$.jsxs)($.Fragment,{children:[W,c&&(0,$.jsxs)($.Fragment,{children:[y&&k.length===0&&(0,$.jsx)(U,{error:y,style:Rt(1),className:`py-1 text-xs h-auto overflow-auto max-h-32 items-start`,showIcon:!1}),!y&&P&&(0,$.jsx)(`div`,{className:`py-1 text-xs text-muted-foreground italic`,style:Rt(1),children:P}),e.map(e=>{let t=Ht(e,k.indexOf(e));return(0,$.jsx)(en,{rowKey:t,entry:e,namespace:g,protocol:n.protocol,rootPath:n.rootPath,backendType:n.backendType,depth:1,locale:r,searchValue:i,onOpenFile:s},t)}),M&&h.map(e=>{let t=Ht(e,m.indexOf(e));return(0,$.jsx)(en,{rowKey:`remote-search:${t}`,entry:e,namespace:g,protocol:n.protocol,rootPath:n.rootPath,backendType:n.backendType,depth:1,locale:r,searchValue:i,onOpenFile:s},`remote-search:${t}`)}),b&&!j&&(0,$.jsx)(Qt,{depth:1,isLoading:C,error:T,onLoadMore:S})]})]}),t[4]=k,t[5]=d,t[6]=y,t[7]=O,t[8]=b,t[9]=c,t[10]=C,t[11]=v,t[12]=S,t[13]=T,t[14]=r,t[15]=n.backendType,t[16]=n.displayName,t[17]=n.name,t[18]=n.protocol,t[19]=n.rootPath,t[20]=g,t[21]=o,t[22]=s,t[23]=p,t[24]=a,t[25]=i,t[26]=A}else A=t[26];return A},nn=()=>{let e=(0,Q.c)(63),{namespaces:t,entriesByPath:n,pageMetadataByPath:r}=h(),{locale:i}=qe(),[a,o]=(0,Z.useState)(``),s;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(s={},e[0]=s):s=e[0];let[c,u]=(0,Z.useState)(s),[d,f]=(0,Z.useState)(null),p=m(),_;e[1]===a?_=e[2]:(_=a.trim(),e[1]=a,e[2]=_);let y=!!_,b;e[3]===a?b=e[4]:(b=a.trim(),e[3]=a,e[4]=b);let S=b,C;e[5]!==S||e[6]!==c?(C=e=>{let t=c[e];return t?.query===S?t:Kt(S)},e[5]=S,e[6]=c,e[7]=C):C=e[7];let w=C,T;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(T=(e,t)=>{u(n=>({...n,[e]:t}))},e[8]=T):T=e[8];let E=T,D;e[9]!==S||e[10]!==n||e[11]!==r||e[12]!==w?(D=e=>{if(!S)return!1;let t=e.name??e.displayName,i=Xt(S);if(i===``||!qt(w(t))||Wt(n.get(x(t,``))??e.storageEntries,{namespace:t,searchValue:S,entriesByPath:n}).length>0)return!1;let a=x(t,i);return Wt(n.get(a)??[],{namespace:t,searchValue:S,entriesByPath:n}).length>0?!1:Jt(a,n,r)},e[9]=S,e[10]=n,e[11]=r,e[12]=w,e[13]=D):D=e[13];let O=D,k;e[14]!==O||e[15]!==S||e[16]!==n||e[17]!==p||e[18]!==r?(k=async e=>{if(!O(e))return;let t=S,i=e.name??e.displayName,a=Xt(t),o=x(i,a),s=n.get(o),c=r.get(o)?.nextPageToken??null,l=s!==void 0;E(i,{query:t,status:`searching`});try{for(let e=0;e<Gt;e++){let e=!l||c!==null,n=[];if(e){let e=await p({namespace:i,prefix:a,pageToken:c,append:l});n=e.entries,c=e.next_page_token??null,l=!0}if((e?n:s??[]).some(e=>Zt(e,t))){E(i,{query:t,status:`found`});return}if(c===null){E(i,{query:t,status:`exhausted`});return}}E(i,{query:t,status:`capped`})}catch(e){let n=e;E(i,{query:t,status:`error`,error:n instanceof Error?n:Error(String(n))})}},e[14]=O,e[15]=S,e[16]=n,e[17]=p,e[18]=r,e[19]=k):k=e[19];let A=k,j;e[20]!==O||e[21]!==A||e[22]!==t?(j=()=>{let e=t.filter(O);for(let t of e)A(t)},e[20]=O,e[21]=A,e[22]=t,e[23]=j):j=e[23];let N=j;if(t.length===0){let t;return e[24]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(ot,{title:`No storage connected`,description:(0,$.jsxs)(`span`,{children:[`Create an obstore or fsspec connection in your notebook. See the`,` `,(0,$.jsx)(`a`,{className:`text-link`,href:`https://docs.marimo.io/guides/working_with_data/remote_storage/#quick-start`,target:`_blank`,rel:`noopener noreferrer`,children:`docs`}),`.`]}),action:(0,$.jsx)(dt,{group:`storage`,label:`Add remote storage`,variant:`outline`,size:`sm`}),icon:(0,$.jsx)(Te,{className:`h-8 w-8`})}),e[24]=t):t=e[24],t}let P;e[25]===d?P=e[26]:(P=d&&(0,$.jsx)(It,{entry:d.entry,namespace:d.namespace,protocol:d.protocol,backendType:d.backendType,onBack:()=>f(null)}),e[25]=d,e[26]=P);let F=d&&`hidden`,I;e[27]===F?I=e[28]:(I=M(`border-b bg-background rounded-none h-full pb-10 overflow-auto outline-hidden scrollbar-thin`,F),e[27]=F,e[28]=I);let L;e[29]!==O||e[30]!==N||e[31]!==t?(L=e=>{e.key===`Enter`&&t.some(O)&&(e.preventDefault(),N())},e[29]=O,e[30]=N,e[31]=t,e[32]=L):L=e[32];let R;e[33]!==a||e[34]!==L?(R=(0,$.jsx)(g,{placeholder:`Search entries...`,className:`h-6 m-1`,value:a,onValueChange:o,onKeyDown:L,rootClassName:`flex-1 border-b-0`}),e[33]=a,e[34]=L,e[35]=R):R=e[35];let z;e[36]===y?z=e[37]:(z=y&&(0,$.jsx)(Y,{variant:`text`,size:`xs`,className:`float-right border-none px-2 m-0 h-full`,onClick:()=>o(``),children:(0,$.jsx)(le,{className:`h-4 w-4`})}),e[36]=y,e[37]=z);let B,V;e[38]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(J,{content:`Search by file name within loaded entries, or by prefix (e.g. 'folder/x') for backend search. Press Enter to fetch more results.`,delayDuration:200,children:(0,$.jsx)(ge,{className:`h-3.5 w-3.5 shrink-0 cursor-help text-muted-foreground hover:text-foreground mr-2`})}),V=(0,$.jsx)(dt,{group:`storage`,label:`Add remote storage`,compact:!0,variant:`ghost`,size:`sm`,className:`px-2 border-0 border-l border-muted-background rounded-none focus-visible:ring-0 focus-visible:ring-offset-0`}),e[38]=B,e[39]=V):(B=e[38],V=e[39]);let H;e[40]!==R||e[41]!==z?(H=(0,$.jsxs)(`div`,{className:`flex items-center w-full border-b`,children:[R,z,B,V]}),e[40]=R,e[41]=z,e[42]=H):H=e[42];let U;if(e[43]!==A||e[44]!==i||e[45]!==t||e[46]!==w||e[47]!==a){let n;e[49]!==A||e[50]!==i||e[51]!==w||e[52]!==a?(n=e=>{let t=e.name??e.displayName;return(0,$.jsx)(tn,{namespace:e,locale:i,searchValue:a,remoteSearch:w(t),onContinueRemoteSearch:()=>void A(e),onOpenFile:f},t)},e[49]=A,e[50]=i,e[51]=w,e[52]=a,e[53]=n):n=e[53],U=t.map(n),e[43]=A,e[44]=i,e[45]=t,e[46]=w,e[47]=a,e[48]=U}else U=e[48];let W;e[54]===U?W=e[55]:(W=(0,$.jsx)(l,{className:`flex flex-col`,children:U}),e[54]=U,e[55]=W);let G;e[56]!==I||e[57]!==H||e[58]!==W?(G=(0,$.jsxs)(v,{className:I,shouldFilter:!1,children:[H,W]}),e[56]=I,e[57]=H,e[58]=W,e[59]=G):G=e[59];let K;return e[60]!==G||e[61]!==P?(K=(0,$.jsxs)(`div`,{className:`h-full flex flex-col`,children:[P,G]}),e[60]=G,e[61]=P,e[62]=K):K=e[62],K};function rn(e){return e.stopPropagation()}function an(e){return e.stopPropagation()}function on(e){return e.preventDefault()}var sn=(0,Z.createContext)(null);function cn(){return(0,Z.useContext)(sn)??void 0}var ln=e=>{let t=(0,Q.c)(3),{children:n}=e,r=Me(),i;return t[0]!==n||t[1]!==r?(i=(0,$.jsx)(sn.Provider,{value:r,children:n}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i},un=e=>{let t=(0,Q.c)(5),{children:n}=e,[r,i]=(0,Z.useState)(null),a;t[0]!==n||t[1]!==r?(a=r&&(0,$.jsx)(Ne,{backend:ze,options:{rootElement:r},children:(0,$.jsx)(ln,{children:n})}),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o;return t[3]===a?o=t[4]:(o=(0,$.jsx)(`div`,{ref:i,className:`contents`,children:a}),t[3]=a,t[4]=o),o};async function dn(e,t){if(!A()){let n=j().formatNavigableHttpURL(`api/files/download`,new URLSearchParams({path:e}));te(n.toString(),t);return}let n=await oe().sendFileDetails({path:e});if(n.isBase64&&n.contents){let e=Ze(he(n.contents,n.mimeType||`application/octet-stream`));q(e,t)}else q(new Blob([n.contents||``],{type:n.mimeType||`application/octet-stream`}),t)}var fn=e=>{let t=(0,Q.c)(21),{file:n,mimeType:r,message:i,onDownload:a}=e,{locale:o}=qe(),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(`span`,{className:`text-muted-foreground font-medium`,children:`Path`}),t[0]=s):s=t[0];let c;t[1]===n.path?c=t[2]:(c=(0,$.jsx)(`span`,{className:`font-mono text-xs break-all`,children:n.path}),t[1]=n.path,t[2]=c);let l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(`span`,{className:`text-muted-foreground font-medium`,children:`Type`}),t[3]=l):l=t[3];let u;t[4]===r?u=t[5]:(u=(0,$.jsx)(`span`,{children:r}),t[4]=r,t[5]=u);let d;t[6]!==n.size||t[7]!==o?(d=n.size!=null&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`text-muted-foreground font-medium`,children:`Size`}),(0,$.jsx)(`span`,{children:st(n.size,o)})]}),t[6]=n.size,t[7]=o,t[8]=d):d=t[8];let f;t[9]!==c||t[10]!==u||t[11]!==d?(f=(0,$.jsxs)(`div`,{className:`grid grid-cols-[auto_1fr] gap-x-4 gap-y-2`,children:[s,c,l,u,d]}),t[9]=c,t[10]=u,t[11]=d,t[12]=f):f=t[12];let p;t[13]===i?p=t[14]:(p=(0,$.jsx)(`div`,{className:`mt-4 text-muted-foreground italic`,children:i}),t[13]=i,t[14]=p);let m;t[15]===a?m=t[16]:(m=a&&(0,$.jsxs)(Y,{variant:`outline`,size:`sm`,className:`mt-4`,onClick:a,children:[(0,$.jsx)(V,{className:`h-3.5 w-3.5 mr-2`}),`Download`]}),t[15]=a,t[16]=m);let h;return t[17]!==f||t[18]!==p||t[19]!==m?(h=(0,$.jsxs)(`div`,{className:`p-4 text-sm`,children:[f,p,m]}),t[17]=f,t[18]=p,t[19]=m,t[20]=h):h=t[20],h};function pn(e,t){let n=e||`text/plain`;return K(n)?`media`:t?`unsupported`:n===`text/csv`?`csv`:n.startsWith(`text/`)||n!=="default"&&n in H||e==null?`text`:`unsupported`}var mn=10485760,hn=new Map,gn=({file:e,onOpenNotebook:t})=>{let{sendFileDetails:n,sendUpdateFile:i}=ae(),a=r(O),o=r(k),s=r(y),[c,l]=(0,Z.useState)(``),{data:u,isPending:d,error:f,setData:p,refetch:m}=Je(async()=>{let t=await n({path:e.path,maxBytes:mn}),r=pn(t.mimeType,t.isBase64);if(!t.isTooLarge&&r===`text`){let n=t.contents||``;l(hn.get(e.path)??n)}return t},[e.path]),h=async()=>{c!==u?.contents&&await i({path:e.path,contents:c}).then(e=>{e.success&&(p(e=>({...e,contents:c})),l(c))})},g=(0,Z.useRef)(c);if(g.current=c,(0,Z.useEffect)(()=>()=>{if(u?.contents==null||u.isTooLarge||pn(u.mimeType,u.isBase64)!==`text`)return;let t=g.current;t===u.contents?hn.delete(e.path):hn.set(e.path,t)},[e.path,u?.contents,u?.isTooLarge,u?.mimeType,u?.isBase64]),f)return(0,$.jsx)(et,{error:f});if(d||!u)return null;let _=u.mimeType||`text/plain`,v=pn(u.mimeType,u.isBase64),b=v===`text`,x=v===`csv`,S=v===`media`,C=s&&u.file.isMarimoFile&&(e.path===s||e.path.endsWith(`/${s}`)),w=async()=>{await dn(e.path,u.file.name)},T=re.of([{key:a.getHotkey(`global.save`).key,stopPropagation:!0,run:()=>c!==u.contents&&(h(),!0)}]),E=(0,$.jsx)(Dt,{filename:u.file.name,onRefresh:m,onDownload:o?void 0:w,actions:(0,$.jsxs)($.Fragment,{children:[e.isMarimoFile&&!A()&&(0,$.jsx)(J,{content:`Open notebook`,children:(0,$.jsx)(Y,{variant:`text`,size:`xs`,onClick:e=>t(e),children:(0,$.jsx)(ve,{className:`h-3.5 w-3.5`})})}),b&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{content:`Copy contents to clipboard`,children:(0,$.jsx)(Y,{variant:`text`,size:`xs`,onClick:async()=>{await Ye(c)},children:(0,$.jsx)(_e,{className:`h-3.5 w-3.5`})})}),(0,$.jsx)(J,{content:tt(`global.save`),children:(0,$.jsx)(Y,{variant:`text`,size:`xs`,onClick:h,disabled:c===u.contents,children:(0,$.jsx)(Ve,{className:`h-3.5 w-3.5`})})})]})]})});if(u.isTooLarge||v===`unsupported`)return(0,$.jsxs)($.Fragment,{children:[E,(0,$.jsx)(fn,{file:u.file,mimeType:_,message:u.isTooLarge?`File is too large to preview.`:`This file type cannot be previewed.`,onDownload:o?void 0:w})]});let D=b&&C&&(0,$.jsxs)($e,{variant:`warning`,className:`rounded-none`,children:[(0,$.jsx)(He,{className:`h-4 w-4`}),(0,$.jsx)(Qe,{children:`Editing the notebook file directly while running in marimo's editor may cause unintended changes. Please use with caution.`})]}),j=S&&u.contents?G({contents:u.contents,mimeType:_,isBase64:u.isBase64??!1}):void 0;return(0,$.jsxs)($.Fragment,{children:[E,D,(0,$.jsx)(W,{mimeType:_,contents:b?c:x?u.contents??void 0:void 0,mediaSource:j,readOnly:!b,onChange:b?l:void 0,extensions:b?[T]:[]})]})},_n=n(e=>{let t=e(ie);return D(t,`no requestClientAtom set`),new je({listFiles:t.sendListFiles,createFileOrFolder:t.sendCreateFileOrFolder,deleteFileOrFolder:t.sendDeleteFileOrFolder,copyFileOrFolder:t.sendCopyFileOrFolder,renameFileOrFolder:t.sendRenameFileOrFolder})}),vn=n({});async function yn(){await i.get(_n).refreshAll([])}var bn=` `,xn={directory:e=>`os.listdir("${e}")`,python:e=>`with open("${e}", "r") as _f:\n${bn}...\n`,json:e=>`with open("${e}", "r") as _f:\n${bn}_data = json.load(_f)\n`,code:e=>`with open("${e}", "r") as _f:\n${bn}...\n`,text:e=>`with open("${e}", "r") as _f:\n${bn}...\n`,image:e=>`mo.image("${e}")`,audio:e=>`mo.audio("${e}")`,video:e=>`mo.video("${e}")`,pdf:e=>`with open("${e}", "rb") as _f:\n${bn}...\n`,zip:e=>`with open("${e}", "rb") as _f:\n${bn}...\n`,data:e=>`with open("${e}", "r") as _f:\n${bn}...\n`,unknown:e=>`with open("${e}", "r") as _f:\n${bn}...\n`},Sn=104857600,Cn=5;function wn(e){let t=(0,Q.c)(7),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let r=n,{sendCreateFileOrFolder:i}=ae(),a;t[2]===i?a=t[3]:(a=async e=>{if(e.length===0)return;let t=e.length===1,n=t?`Uploading file...`:`Uploading files...`,r={title:t?`File uploaded`:`${e.length} files uploaded`};await ee(n,async t=>{t.addTotal(e.length),await at(e,Cn,async e=>{let n=An(kn(e)),r=``;n&&(r=Ke.guessDeliminator(n).dirname(n)),await i({path:r,type:`file`,name:e.name,file:e}),t.increment(1)}),await yn()},r)},t[2]=i,t[3]=a);let o;return t[4]!==r||t[5]!==a?(o={multiple:!0,maxSize:Sn,onError:On,onDropRejected:Tn,onDrop:a,...r},t[4]=r,t[5]=a,t[6]=o):o=t[6],We(o)}function Tn(e){Ge({title:`File upload failed`,description:(0,$.jsx)(`div`,{className:`flex flex-col gap-1`,children:e.map(En)}),variant:`danger`})}function En(e){return(0,$.jsxs)(`div`,{children:[e.file.name,` (`,e.errors.map(Dn).join(`, `),`)`]},e.file.name)}function Dn(e){return e.message}function On(e){E.error(e),Ge({title:`File upload failed`,description:e.message,variant:`danger`})}function kn(e){if(e.webkitRelativePath)return e.webkitRelativePath;if(`path`in e&&typeof e.path==`string`)return e.path;if(`relativePath`in e&&typeof e.relativePath==`string`)return e.relativePath}function An(e){if(e)return e.replace(/^\/+/,``)}var jn=_(`marimo:showHiddenFiles`,!0,S,{getOnInit:!0}),Mn=Z.createContext(null),Nn=e=>{let n=(0,Q.c)(73),{height:r}=e,i=(0,Z.useRef)(null),o=cn(),[s]=t(_n),c;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=[],n[0]=c):c=n[0];let[l,u]=(0,Z.useState)(c),[d,f]=(0,Z.useState)(null),[p,m]=t(jn),{openPrompt:h}=De(),[g,_]=t(vn),v;n[1]===s?v=n[2]:(v=()=>s.initialize(u),n[1]=s,n[2]=v);let y;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(y=[],n[3]=y):y=n[3];let{isPending:b,error:x}=Je(v,y),S;n[4]!==g||n[5]!==s?(S=()=>s.refreshAll(Object.keys(g).filter(e=>g[e])),n[4]=g,n[5]=s,n[6]=S):S=n[6];let C=a(S),w;n[7]!==m||n[8]!==p?(w=()=>{m(!p)},n[7]=m,n[8]=p,n[9]=w):w=n[9];let T=a(w),E;n[10]!==h||n[11]!==s?(E=async()=>{h({title:`Folder name`,onConfirm:async e=>{s.createFolder(e,null)}})},n[10]=h,n[11]=s,n[12]=E):E=n[12];let D=a(E),O;n[13]!==h||n[14]!==s?(O=async()=>{h({title:`File name`,onConfirm:async e=>{s.createFile({name:e,parentId:null})}})},n[13]=h,n[14]=s,n[15]=O):O=n[15];let k=a(O),A;n[16]!==h||n[17]!==s?(A=async()=>{h({title:`Notebook name`,onConfirm:async e=>{s.createFile({name:e,parentId:null,type:`notebook`})}})},n[16]=h,n[17]=s,n[18]=A):A=n[18];let j=a(A),M;n[19]===_?M=n[20]:(M=()=>{i.current?.closeAll(),_({})},n[19]=_,n[20]=M);let N=a(M),P;n[21]!==l||n[22]!==p?(P=Bn(l,p),n[21]=l,n[22]=p,n[23]=P):P=n[23];let F=P;if(b){let e;return n[24]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(ke,{size:`medium`,centered:!0}),n[24]=e):e=n[24],e}if(x){let e;return n[25]===x?e=n[26]:(e=(0,$.jsx)(et,{error:x}),n[25]=x,n[26]=e),e}if(d){let e;n[27]===Symbol.for(`react.memo_cache_sentinel`)?(e=()=>f(null),n[27]=e):e=n[27];let t;n[28]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(Y,{onClick:e,"data-testid":`file-explorer-back-button`,variant:`text`,size:`xs`,className:`mb-0`,children:(0,$.jsx)(se,{size:16})}),n[28]=t):t=n[28];let r;n[29]===d.name?r=n[30]:(r=(0,$.jsxs)(`div`,{className:`flex items-center pl-1 pr-3 shrink-0 border-b justify-between`,children:[t,(0,$.jsx)(`span`,{className:`font-bold`,children:d.name})]}),n[29]=d.name,n[30]=r);let i;n[31]!==d.path||n[32]!==s?(i=e=>zn(e,s.relativeFromRoot(d.path)),n[31]=d.path,n[32]=s,n[33]=i):i=n[33];let a;n[34]!==d||n[35]!==i?(a=(0,$.jsx)(Z.Suspense,{children:(0,$.jsx)(gn,{onOpenNotebook:i,file:d})}),n[34]=d,n[35]=i,n[36]=a):a=n[36];let o;return n[37]!==r||n[38]!==a?(o=(0,$.jsxs)($.Fragment,{children:[r,a]}),n[37]=r,n[38]=a,n[39]=o):o=n[39],o}let I;n[40]!==N||n[41]!==k||n[42]!==D||n[43]!==j||n[44]!==T||n[45]!==C||n[46]!==p||n[47]!==s?(I=(0,$.jsx)(Fn,{onRefresh:C,onHidden:T,showHiddenFiles:p,onCreateFile:k,onCreateNotebook:j,onCreateFolder:D,onCollapseAll:N,tree:s}),n[40]=N,n[41]=k,n[42]=D,n[43]=j,n[44]=T,n[45]=C,n[46]=p,n[47]=s,n[48]=I):I=n[48];let L=r-33,R,z,B;n[49]===s?(R=n[50],z=n[51],B=n[52]):(R=async e=>{let{ids:t}=e;for(let e of t)await s.delete(e)},z=async e=>{let{id:t,name:n}=e;await s.rename(t,n)},B=async e=>{let{dragIds:t,parentId:n}=e;await s.move(t,n)},n[49]=s,n[50]=R,n[51]=z,n[52]=B);let V;n[53]===Symbol.for(`react.memo_cache_sentinel`)?(V=e=>{let t=e[0];t&&(t.data.isDirectory||f(t.data))},n[53]=V):V=n[53];let H;n[54]!==g||n[55]!==_||n[56]!==s?(H=async e=>{if(await s.expand(e)){let t=g[e]??!1;_({...g,[e]:!t})}},n[54]=g,n[55]=_,n[56]=s,n[57]=H):H=n[57];let U;n[58]!==o||n[59]!==g||n[60]!==L||n[61]!==R||n[62]!==z||n[63]!==B||n[64]!==H||n[65]!==F?(U=(0,$.jsx)(Fe,{width:`100%`,ref:i,height:L,className:`h-full`,data:F,initialOpenState:g,openByDefault:!1,dndManager:o,renderCursor:Hn,disableDrop:Un,onDelete:R,onRename:z,onMove:B,onSelect:V,onToggle:H,padding:15,rowHeight:30,indent:Pn,overscanCount:1e3,disableMultiSelection:!0,children:Ln}),n[58]=o,n[59]=g,n[60]=L,n[61]=R,n[62]=z,n[63]=B,n[64]=H,n[65]=F,n[66]=U):U=n[66];let W;n[67]!==U||n[68]!==s?(W=(0,$.jsx)(Mn,{value:s,children:U}),n[67]=U,n[68]=s,n[69]=W):W=n[69];let G;return n[70]!==I||n[71]!==W?(G=(0,$.jsxs)($.Fragment,{children:[I,W]}),n[70]=I,n[71]=W,n[72]=G):G=n[72],G},Pn=15,Fn=e=>{let t=(0,Q.c)(37),{onRefresh:n,onHidden:r,showHiddenFiles:i,onCreateFile:a,onCreateNotebook:o,onCreateFolder:s,onCollapseAll:c}=e,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l={noDrag:!0,noDragEventsBubbling:!0},t[0]=l):l=t[0];let{getRootProps:u,getInputProps:d}=wn(l),f;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(ht,{size:16}),t[1]=f):f=t[1];let p;t[2]===o?p=t[3]:(p=(0,$.jsx)(J,{content:`Add notebook`,children:(0,$.jsx)(Y,{"data-testid":`file-explorer-add-notebook-button`,onClick:o,variant:`text`,size:`xs`,children:f})}),t[2]=o,t[3]=p);let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(xt,{size:16}),t[4]=m):m=t[4];let h;t[5]===a?h=t[6]:(h=(0,$.jsx)(J,{content:`Add file`,children:(0,$.jsx)(Y,{"data-testid":`file-explorer-add-file-button`,onClick:a,variant:`text`,size:`xs`,children:m})}),t[5]=a,t[6]=h);let g;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(Ct,{size:16}),t[7]=g):g=t[7];let _;t[8]===s?_=t[9]:(_=(0,$.jsx)(J,{content:`Add folder`,children:(0,$.jsx)(Y,{"data-testid":`file-explorer-add-folder-button`,onClick:s,variant:`text`,size:`xs`,children:g})}),t[8]=s,t[9]=_);let v;t[10]===u?v=t[11]:(v=u({}),t[10]=u,t[11]=v);let y,b;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(b=ne({variant:`text`,size:`xs`}),y=(0,$.jsx)(Ue,{size:16}),t[12]=y,t[13]=b):(y=t[12],b=t[13]);let x;t[14]===v?x=t[15]:(x=(0,$.jsx)(J,{content:`Upload file`,children:(0,$.jsx)(`button`,{"data-testid":`file-explorer-upload-button`,...v,className:b,children:y})}),t[14]=v,t[15]=x);let S;t[16]===d?S=t[17]:(S=d({}),t[16]=d,t[17]=S);let C;t[18]===S?C=t[19]:(C=(0,$.jsx)(`input`,{...S,type:`file`}),t[18]=S,t[19]=C);let w;t[20]===n?w=t[21]:(w=(0,$.jsx)(pe,{"data-testid":`file-explorer-refresh-button`,onClick:n}),t[20]=n,t[21]=w);let T;t[22]!==r||t[23]!==i?(T=(0,$.jsx)(ue,{"data-testid":`file-explorer-hidden-files-button`,isVisible:i,onToggle:r,showTooltip:`Show hidden files`,hideTooltip:`Hide hidden files`}),t[22]=r,t[23]=i,t[24]=T):T=t[24];let E;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(bt,{size:16}),t[25]=E):E=t[25];let D;t[26]===c?D=t[27]:(D=(0,$.jsx)(J,{content:`Collapse all folders`,children:(0,$.jsx)(Y,{"data-testid":`file-explorer-collapse-button`,onClick:c,variant:`text`,size:`xs`,children:E})}),t[26]=c,t[27]=D);let O;return t[28]!==x||t[29]!==C||t[30]!==w||t[31]!==T||t[32]!==D||t[33]!==p||t[34]!==h||t[35]!==_?(O=(0,$.jsxs)(`div`,{className:`flex items-center justify-end px-2 shrink-0 border-b`,children:[p,h,_,x,C,w,T,D]}),t[28]=x,t[29]=C,t[30]=w,t[31]=T,t[32]=D,t[33]=p,t[34]=h,t[35]=_,t[36]=O):O=t[36],O},In=e=>{let t=(0,Q.c)(9),{node:n,onOpenMarimoFile:r}=e,i;t[0]===n?i=t[1]:(i=e=>{n.data.isDirectory||(e.stopPropagation(),n.select())},t[0]=n,t[1]=i);let a;t[2]!==n.data.isMarimoFile||t[3]!==r?(a=n.data.isMarimoFile&&!A()&&(0,$.jsxs)(`span`,{"data-testid":`file-explorer-open-marimo-button`,className:`shrink-0 ml-2 text-sm hidden group-hover:inline hover:underline`,onClick:r,children:[`open `,(0,$.jsx)(ve,{className:`inline ml-1`,size:12})]}),t[2]=n.data.isMarimoFile,t[3]=r,t[4]=a):a=t[4];let o;return t[5]!==n.data.name||t[6]!==i||t[7]!==a?(o=(0,$.jsxs)(`span`,{className:`flex-1 overflow-hidden text-ellipsis`,onClick:i,children:[n.data.name,a]}),t[5]=n.data.name,t[6]=i,t[7]=a,t[8]=o):o=t[8],o},Ln=e=>{let t=(0,Q.c)(115),{node:n,style:i,dragHandle:o}=e,{openFile:s}=ae(),c=r(k),l;t[0]!==n.data.isDirectory||t[1]!==n.data.name?(l=n.data.isDirectory?`directory`:Se(n.data.name),t[0]=n.data.isDirectory,t[1]=n.data.name,t[2]=l):l=t[2];let u=l,f=Ce[u],{openConfirm:m,openPrompt:h}=De(),{createNewCell:g}=d(),_=p(),v;t[3]!==g||t[4]!==_?(v=e=>{g({code:e,before:!1,cellId:_??`__end__`})},t[3]=g,t[4]=_,t[5]=v):v=t[5];let y=v,x=(0,Z.use)(Mn),S;t[6]!==n.data.path||t[7]!==x?(S=async e=>{zn(e,x?x.relativeFromRoot(n.data.path):n.data.path)},t[6]=n.data.path,t[7]=x,t[8]=S):S=t[8];let C=S,w;t[9]!==n.data.name||t[10]!==n.id||t[11]!==n.tree||t[12]!==m?(w=async e=>{e.stopPropagation(),e.preventDefault(),m({title:`Delete file`,description:`Are you sure you want to delete ${n.data.name}?`,confirmAction:(0,$.jsx)(F,{onClick:async()=>{await n.tree.delete(n.id)},"aria-label":`Confirm`,children:`Delete`})})},t[9]=n.data.name,t[10]=n.id,t[11]=n.tree,t[12]=m,t[13]=w):w=t[13];let T=w,E;t[14]!==n||t[15]!==h||t[16]!==x?(E=async()=>{n.open(),h({title:`Folder name`,onConfirm:async e=>{x?.createFolder(e,n.id)}})},t[14]=n,t[15]=h,t[16]=x,t[17]=E):E=t[17];let D=a(E),O;t[18]!==n||t[19]!==h||t[20]!==x?(O=async()=>{n.open(),h({title:`File name`,onConfirm:async e=>{x?.createFile({name:e,parentId:n.id})}})},t[18]=n,t[19]=h,t[20]=x,t[21]=O):O=t[21];let j=a(O),N;t[22]!==n||t[23]!==h||t[24]!==x?(N=async()=>{n.open(),h({title:`Notebook name`,onConfirm:async e=>{x?.createFile({name:e,parentId:n.id,type:`notebook`})}})},t[22]=n,t[23]=h,t[24]=x,t[25]=N):N=t[25];let P=a(N),R;t[26]!==n.data.name||t[27]!==n.id||t[28]!==x?(R=async()=>{x&&await x.copy(n.id,it(n.data.name))},t[26]=n.data.name,t[27]=n.id,t[28]=x,t[29]=R):R=t[29];let z=a(R),B;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(B=M(`flex items-center cursor-pointer ml-1 text-muted-foreground whitespace-nowrap group`),t[30]=B):B=t[30];let H,U;t[31]===n?(H=t[32],U=t[33]):(H=e=>{e.stopPropagation(),n.data.isDirectory&&n.toggle()},U=(0,$.jsx)(Rn,{node:n}),t[31]=n,t[32]=H,t[33]=U);let W=n.willReceiveDrop&&n.data.isDirectory&&`bg-accent/80 hover:bg-accent/80 text-accent-foreground`,G;t[34]===W?G=t[35]:(G=M(`flex items-center pl-1 py-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden group`,W),t[34]=W,t[35]=G);let K;t[36]!==f||t[37]!==u||t[38]!==n.data.isMarimoFile?(K=n.data.isMarimoFile?(0,$.jsx)(gt,{className:`w-5 h-5 shrink-0 mr-2`,strokeWidth:1.5}):(0,$.jsx)(f,{className:M(`w-5 h-5 shrink-0 mr-2`,xe[u]),strokeWidth:1.5}),t[36]=f,t[37]=u,t[38]=n.data.isMarimoFile,t[39]=K):K=t[39];let ee;t[40]!==C||t[41]!==n?(ee=n.isEditing?(0,$.jsx)(Re,{node:n}):(0,$.jsx)(In,{node:n,onOpenMarimoFile:C}),t[40]=C,t[41]=n,t[42]=ee):ee=t[42];let q;t[43]===n?q=t[44]:(q=!n.data.isDirectory&&(0,$.jsxs)(I,{onSelect:()=>n.select(),"data-testid":`file-explorer-open-file-menu-item`,children:[(0,$.jsx)(Et,{className:`h-3.5 w-3.5 mr-2`}),`Open file`]}),t[43]=n,t[44]=q);let te;t[45]!==n.data.isDirectory||t[46]!==n.data.path||t[47]!==s?(te=!n.data.isDirectory&&!A()&&(0,$.jsxs)(I,{onSelect:()=>{s({path:n.data.path})},"data-testid":`file-explorer-open-external-menu-item`,children:[(0,$.jsx)(ve,{className:`h-3.5 w-3.5 mr-2`}),`Open file in external editor`]}),t[45]=n.data.isDirectory,t[46]=n.data.path,t[47]=s,t[48]=te):te=t[48];let J;t[49]!==j||t[50]!==D||t[51]!==P||t[52]!==n.data.isDirectory?(J=n.data.isDirectory&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(I,{onSelect:()=>P(),"data-testid":`file-explorer-create-notebook-menu-item`,children:[(0,$.jsx)(ht,{className:`h-3.5 w-3.5 mr-2`}),`Create notebook`]}),(0,$.jsxs)(I,{onSelect:()=>j(),"data-testid":`file-explorer-create-file-menu-item`,children:[(0,$.jsx)(xt,{className:`h-3.5 w-3.5 mr-2`}),`Create file`]}),(0,$.jsxs)(I,{onSelect:()=>D(),"data-testid":`file-explorer-create-folder-menu-item`,children:[(0,$.jsx)(Ct,{className:`h-3.5 w-3.5 mr-2`}),`Create folder`]}),(0,$.jsx)(L,{})]}),t[49]=j,t[50]=D,t[51]=P,t[52]=n.data.isDirectory,t[53]=J):J=t[53];let ne;t[54]===n?ne=t[55]:(ne=(0,$.jsx)(Ae,{onSelect:()=>n.edit(),testId:`file-explorer-rename-menu-item`}),t[54]=n,t[55]=ne);let Y;t[56]===z?Y=t[57]:(Y=(0,$.jsx)(Le,{onSelect:z,testId:`file-explorer-duplicate-menu-item`}),t[56]=z,t[57]=Y);let re;t[58]===n.data.path?re=t[59]:(re=async()=>{await Ye(n.data.path),Ge({title:`Copied to clipboard`})},t[58]=n.data.path,t[59]=re);let ie;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,$.jsx)(wt,{className:me}),t[60]=ie):ie=t[60];let oe;t[61]===re?oe=t[62]:(oe=(0,$.jsxs)(I,{onSelect:re,"data-testid":`file-explorer-copy-path-menu-item`,children:[ie,`Copy path`]}),t[61]=re,t[62]=oe);let X;t[63]!==n.data.path||t[64]!==x?(X=x&&(0,$.jsxs)(I,{onSelect:async()=>{await Ye(x.relativeFromRoot(n.data.path)),Ge({title:`Copied to clipboard`})},"data-testid":`file-explorer-copy-relative-path-menu-item`,children:[(0,$.jsx)(wt,{className:`h-3.5 w-3.5 mr-2`}),`Copy relative path`]}),t[63]=n.data.path,t[64]=x,t[65]=X):X=t[65];let se;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,$.jsx)(L,{}),t[66]=se):se=t[66];let le;t[67]!==u||t[68]!==y||t[69]!==n.data?(le=()=>{let{path:e}=n.data,t=xn[u](e);y(t)},t[67]=u,t[68]=y,t[69]=n.data,t[70]=le):le=t[70];let ue;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,$.jsx)(ce,{className:me}),t[71]=ue):ue=t[71];let de;t[72]===le?de=t[73]:(de=(0,$.jsxs)(I,{onSelect:le,"data-testid":`file-explorer-insert-snippet-menu-item`,children:[ue,`Insert snippet for reading file`]}),t[72]=le,t[73]=de);let fe;t[74]!==u||t[75]!==n.data?(fe=async()=>{Ge({title:`Copied to clipboard`,description:`Code to open the file has been copied to your clipboard. You can also drag and drop this file into the editor`});let{path:e}=n.data,t=xn[u](e);await Ye(t)},t[74]=u,t[75]=n.data,t[76]=fe):fe=t[76];let pe;t[77]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,$.jsx)(b,{className:me}),t[77]=pe):pe=t[77];let he;t[78]===fe?he=t[79]:(he=(0,$.jsxs)(I,{onSelect:fe,"data-testid":`file-explorer-copy-snippet-menu-item`,children:[pe,`Copy snippet for reading file`]}),t[78]=fe,t[79]=he);let ge;t[80]!==C||t[81]!==n.data.isMarimoFile?(ge=n.data.isMarimoFile&&!A()&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(L,{}),(0,$.jsxs)(I,{onSelect:C,"data-testid":`file-explorer-open-notebook-menu-item`,children:[(0,$.jsx)(Tt,{className:`h-3.5 w-3.5 mr-2`}),`Open notebook`]})]}),t[80]=C,t[81]=n.data.isMarimoFile,t[82]=ge):ge=t[82];let _e;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,$.jsx)(L,{}),t[83]=_e):_e=t[83];let ye;t[84]!==c||t[85]!==n.data.isDirectory||t[86]!==n.data.name||t[87]!==n.data.path?(ye=!n.data.isDirectory&&!c&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(I,{onSelect:async()=>{await dn(n.data.path,n.data.name)},"data-testid":`file-explorer-download-menu-item`,children:[(0,$.jsx)(V,{className:`h-3.5 w-3.5 mr-2`}),`Download`]}),(0,$.jsx)(L,{})]}),t[84]=c,t[85]=n.data.isDirectory,t[86]=n.data.name,t[87]=n.data.path,t[88]=ye):ye=t[88];let be;t[89]===T?be=t[90]:(be=(0,$.jsx)(Ie,{onSelect:T,testId:`file-explorer-delete-menu-item`}),t[89]=T,t[90]=be);let we;t[91]!==q||t[92]!==te||t[93]!==J||t[94]!==ne||t[95]!==Y||t[96]!==oe||t[97]!==X||t[98]!==de||t[99]!==he||t[100]!==ge||t[101]!==ye||t[102]!==be?(we=(0,$.jsxs)(Pe,{testId:`file-explorer-more-button`,iconClassName:`w-5 h-5`,children:[q,te,J,ne,Y,oe,X,se,de,he,ge,_e,ye,be]}),t[91]=q,t[92]=te,t[93]=J,t[94]=ne,t[95]=Y,t[96]=oe,t[97]=X,t[98]=de,t[99]=he,t[100]=ge,t[101]=ye,t[102]=be,t[103]=we):we=t[103];let Te;t[104]!==G||t[105]!==K||t[106]!==ee||t[107]!==we?(Te=(0,$.jsxs)(`span`,{className:G,children:[K,ee,we]}),t[104]=G,t[105]=K,t[106]=ee,t[107]=we,t[108]=Te):Te=t[108];let Ee;return t[109]!==o||t[110]!==i||t[111]!==H||t[112]!==U||t[113]!==Te?(Ee=(0,$.jsxs)(`div`,{style:i,ref:o,className:B,draggable:!0,onClick:H,children:[U,Te]}),t[109]=o,t[110]=i,t[111]=H,t[112]=U,t[113]=Te,t[114]=Ee):Ee=t[114],Ee},Rn=e=>{let t=(0,Q.c)(3),{node:n}=e;if(!n.data.isDirectory){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`span`,{className:`w-4 h-4 shrink-0`}),t[0]=e):e=t[0],e}let r;return t[1]===n.isOpen?r=t[2]:(r=(0,$.jsx)(de,{isExpanded:n.isOpen,className:`w-4 h-4`}),t[1]=n.isOpen,t[2]=r),r};function zn(e,t){e.stopPropagation(),e.preventDefault(),_t(t)}function Bn(e,t){if(t)return e;let n=[];for(let r of e){if(Vn(r.name))continue;let e=r;if(r.children){let n=Bn(r.children,t);n!==r.children&&(e={...r,children:n})}n.push(e)}return n}function Vn(e){return!!e.startsWith(`.`)}function Hn(){return null}function Un(e){let{parentNode:t}=e;return!t.data.isDirectory}var Wn=e=>{let t=(0,Q.c)(20),{height:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={noClick:!0,noKeyboard:!0},t[0]=r):r=t[0];let{getRootProps:i,getInputProps:a,isDragActive:o}=wn(r),s;t[1]===i?s=t[2]:(s=i(),t[1]=i,t[2]=s);let c;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=M(`flex flex-col overflow-hidden relative`),t[3]=c):c=t[3];let l;t[4]===n?l=t[5]:(l={height:n},t[4]=n,t[5]=l);let u;t[6]===a?u=t[7]:(u=a(),t[6]=a,t[7]=u);let d;t[8]===u?d=t[9]:(d=(0,$.jsx)(`input`,{...u}),t[8]=u,t[9]=d);let f;t[10]===o?f=t[11]:(f=o&&(0,$.jsx)(`div`,{className:`absolute inset-0 flex items-center uppercase justify-center text-xl font-bold text-primary/90 bg-accent/85 z-10 border-2 border-dashed border-primary/90 rounded-lg pointer-events-none`,children:`Drop files here`}),t[10]=o,t[11]=f);let p;t[12]===n?p=t[13]:(p=(0,$.jsx)(Nn,{height:n}),t[12]=n,t[13]=p);let m;return t[14]!==s||t[15]!==l||t[16]!==d||t[17]!==f||t[18]!==p?(m=(0,$.jsx)(un,{children:(0,$.jsxs)(`div`,{...s,className:c,style:l,children:[d,f,p]})}),t[14]=s,t[15]=l,t[16]=d,t[17]=f,t[18]=p,t[19]=m):m=t[19],m},Gn=()=>{let e=(0,Q.c)(40),{ref:n,height:i}=nt(),a=i===void 0?500:i,[o,s]=t(vt),l=r(C).length,u=c(`storage`),d;bb0:{if(!o.hasUserInteracted&&l>0){if(o.openSections.includes(`remote-storage`)){d=o.openSections;break bb0}let t;e[0]===o.openSections?t=e[1]:(t=[...o.openSections,`remote-storage`],e[0]=o.openSections,e[1]=t),d=t;break bb0}d=o.openSections}let f=d,p;e[2]===s?p=e[3]:(p=e=>{s({openSections:e,hasUserInteracted:!0})},e[2]=s,e[3]=p);let m=p,h=a-66,g;e[4]===f?g=e[5]:(g=f.includes(`remote-storage`),e[4]=f,e[5]=g);let _=g,v=u.length>0,y;e[6]!==f||e[7]!==_?(y=_&&f.includes(`files`),e[6]=f,e[7]=_,e[8]=y):y=e[8];let b=y,x;e[9]!==h||e[10]!==b?(x=b?Math.round(h*.4):h,e[9]=h,e[10]=b,e[11]=x):x=e[11];let S=x,w=Math.max(200,b?h-S:h),T;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(Te,{className:`w-4 h-4`}),e[12]=T):T=e[12];let E;e[13]===l?E=e[14]:(E=l>0&&(0,$.jsx)(ct,{children:l}),e[13]=l,e[14]=E);let D;e[15]!==u.length||e[16]!==v?(D=v&&(0,$.jsx)(mt,{count:u.length,type:`storage`}),e[15]=u.length,e[16]=v,e[17]=D):D=e[17];let O;e[18]!==E||e[19]!==D?(O=(0,$.jsxs)(lt,{children:[T,` Remote storage`,E,D]}),e[18]=E,e[19]=D,e[20]=O):O=e[20];let k;e[21]===S?k=e[22]:(k={maxHeight:S},e[21]=S,e[22]=k);let A;e[23]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(nn,{}),e[23]=A):A=e[23];let j;e[24]===k?j=e[25]:(j=(0,$.jsx)(ut,{className:`overflow-auto`,style:k,children:A}),e[24]=k,e[25]=j);let M;e[26]!==j||e[27]!==O?(M=(0,$.jsxs)(ft,{value:`remote-storage`,children:[O,j]}),e[26]=j,e[27]=O,e[28]=M):M=e[28];let N;e[29]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,$.jsxs)(lt,{children:[(0,$.jsx)(we,{className:`w-4 h-4`}),`Files`]}),e[29]=N):N=e[29];let F;e[30]===w?F=e[31]:(F=(0,$.jsxs)(ft,{value:`files`,children:[N,(0,$.jsx)(ut,{children:(0,$.jsx)(Wn,{height:w})})]}),e[30]=w,e[31]=F);let I;e[32]!==m||e[33]!==f||e[34]!==M||e[35]!==F?(I=(0,$.jsxs)(P,{type:`multiple`,value:f,onValueChange:m,children:[M,F]}),e[32]=m,e[33]=f,e[34]=M,e[35]=F,e[36]=I):I=e[36];let L;return e[37]!==n||e[38]!==I?(L=(0,$.jsx)(`div`,{ref:n,className:`h-full overflow-auto`,children:I}),e[37]=n,e[38]=I,e[39]=L):L=e[39],L};export{Gn as default};
@@ -1 +1 @@
1
- import{Fr as e}from"./cells-BdoPd1mK.js";import{t}from"./cn-ldLVeaqm.js";import{t as n}from"./jsx-runtime-B74pBk57.js";import{t as r}from"./createLucideIcon-B7HeEoG2.js";import{n as i,t as a}from"./file-headphone-rFCxFRI8.js";import{t as o}from"./file-DF8n85RA.js";import{t as s}from"./image-ab13yGv4.js";var c=r(`file-code`,[[`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:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),l=r(`file-play`,[[`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`}]]),u=r(`file-spreadsheet`,[[`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:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]),d=r(`folder-archive`,[[`circle`,{cx:`15`,cy:`19`,r:`2`,key:`u2pros`}],[`path`,{d:`M20.9 19.8A2 2 0 0 0 22 18V8a2 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 2h5.1`,key:`1jj40k`}],[`path`,{d:`M15 11v-1`,key:`cntcp`}],[`path`,{d:`M15 17v-2`,key:`1279jj`}]]),f=r(`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`}]]),p=n(),m={py:`python`,txt:`text`,md:`text`,qmd:`text`,log:`text`,png:`image`,jpg:`image`,jpeg:`image`,gif:`image`,svg:`image`,webp:`image`,csv:`data`,parquet:`data`,arrow:`data`,xlsx:`data`,json:`json`,js:`code`,ts:`code`,tsx:`code`,html:`code`,css:`code`,toml:`code`,yaml:`code`,yml:`code`,wasm:`code`,mp3:`audio`,m4a:`audio`,ogg:`audio`,wav:`audio`,mp4:`video`,m4v:`video`,mpeg:`video`,webm:`video`,mkv:`video`,pdf:`pdf`,zip:`zip`,tar:`zip`,gz:`zip`};function h(e){let t=e.split(`.`).pop()?.toLowerCase();return t?m[t]??`unknown`:`unknown`}var g={directory:f,python:c,code:c,json:i,text:e,image:s,audio:a,video:l,data:u,pdf:e,zip:d,unknown:o},_={directory:`text-amber-500`,python:`text-blue-500`,code:`text-blue-500`,json:`text-blue-500`,text:`text-muted-foreground`,image:`text-purple-500`,audio:`text-orange-500`,video:`text-orange-500`,data:`text-green-500`,pdf:`text-red-500`,zip:`text-muted-foreground`,unknown:`text-muted-foreground`};function v(e,n){let r=h(e),i=g[r],a=_[r];return(0,p.jsx)(i,{className:t(`h-3.5 w-3.5 shrink-0`,a,n)})}export{f as a,v as i,_ as n,h as r,g as t};
1
+ import{Xi as e}from"./cells-B1S_6FG3.js";import{t}from"./cn-ldLVeaqm.js";import{t as n}from"./jsx-runtime-B74pBk57.js";import{t as r}from"./createLucideIcon-B7HeEoG2.js";import{n as i,t as a}from"./file-headphone-rFCxFRI8.js";import{t as o}from"./file-DF8n85RA.js";import{t as s}from"./image-ab13yGv4.js";var c=r(`file-code`,[[`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:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),l=r(`file-play`,[[`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`}]]),u=r(`file-spreadsheet`,[[`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:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]),d=r(`folder-archive`,[[`circle`,{cx:`15`,cy:`19`,r:`2`,key:`u2pros`}],[`path`,{d:`M20.9 19.8A2 2 0 0 0 22 18V8a2 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 2h5.1`,key:`1jj40k`}],[`path`,{d:`M15 11v-1`,key:`cntcp`}],[`path`,{d:`M15 17v-2`,key:`1279jj`}]]),f=r(`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`}]]),p=n(),m={py:`python`,txt:`text`,md:`text`,qmd:`text`,log:`text`,png:`image`,jpg:`image`,jpeg:`image`,gif:`image`,svg:`image`,webp:`image`,csv:`data`,parquet:`data`,arrow:`data`,xlsx:`data`,json:`json`,js:`code`,ts:`code`,tsx:`code`,html:`code`,css:`code`,toml:`code`,yaml:`code`,yml:`code`,wasm:`code`,mp3:`audio`,m4a:`audio`,ogg:`audio`,wav:`audio`,mp4:`video`,m4v:`video`,mpeg:`video`,webm:`video`,mkv:`video`,pdf:`pdf`,zip:`zip`,tar:`zip`,gz:`zip`};function h(e){let t=e.split(`.`).pop()?.toLowerCase();return t?m[t]??`unknown`:`unknown`}var g={directory:f,python:c,code:c,json:i,text:e,image:s,audio:a,video:l,data:u,pdf:e,zip:d,unknown:o},_={directory:`text-amber-500`,python:`text-blue-500`,code:`text-blue-500`,json:`text-blue-500`,text:`text-muted-foreground`,image:`text-purple-500`,audio:`text-orange-500`,video:`text-orange-500`,data:`text-green-500`,pdf:`text-red-500`,zip:`text-muted-foreground`,unknown:`text-muted-foreground`};function v(e,n){let r=h(e),i=g[r],a=_[r];return(0,p.jsx)(i,{className:t(`h-3.5 w-3.5 shrink-0`,a,n)})}export{f as a,v as i,_ as n,h as r,g as t};
@@ -0,0 +1,3 @@
1
+ import{a as e,r as t,t as n}from"./rolldown-runtime-B0Z9INg1.js";import{t as r}from"./useEvent-xfs0Sn4r.js";import{t as i}from"./react-CBDbhulC.js";import{t as a}from"./compiler-runtime-CYIjoINj.js";import{_ as o}from"./useEventListener-D27Dii_l.js";import{t as s}from"./jsx-runtime-B74pBk57.js";import{o as c}from"./alert-dialog-DBoy-FMx.js";import{a as l}from"./tabs-c6mpccpH.js";import{a as u,p as d,r as f,t as p}from"./dropdown-menu-CqNabM1f.js";import{r as m}from"./requests-C6_IaFh7.js";import{t as h}from"./createLucideIcon-B7HeEoG2.js";import{n as g,t as _}from"./tree-actions-CrWpuExP.js";import{t as v}from"./copy-BMXKNElG.js";import{b as ee}from"./write-secret-modal-BG_B6y1P.js";import{t as te}from"./trash-2-D_HX-0qx.js";import{t as y}from"./use-toast-DpWHUGuF.js";import{t as ne}from"./paths-zcL04qUW.js";import{a as re}from"./errors-DzO-nXy-.js";import{t as ie}from"./extends-CvVTau-c.js";import{i as ae,n as oe,r as b}from"./pathUtils-Cryrlpma.js";import{n as se}from"./semaphore-BjoL5P0h.js";var ce=h(`pen-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`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`}]]),x=e(i(),1),S=s(),le=l();function ue(e,t){return ue=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ue(e,t)}function de(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,ue(e,t)}function fe(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}var pe=n(((e,t)=>{t.exports=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t==`object`&&typeof n==`object`){if(t.constructor!==n.constructor)return!1;var r,i,a;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(a=Object.keys(t),r=a.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,a[i]))return!1;for(i=r;i--!==0;){var o=a[i];if(!e(t[o],n[o]))return!1}return!0}return t!==t&&n!==n}})),me=(0,x.createContext)({dragDropManager:void 0});function C(e){return`Minified Redux error #`+e+`; visit https://redux.js.org/Errors?code=`+e+` for the full message or use the non-minified dev environment for full errors. `}var he=(function(){return typeof Symbol==`function`&&Symbol.observable||`@@observable`})(),ge=function(){return Math.random().toString(36).substring(7).split(``).join(`.`)},_e={INIT:`@@redux/INIT`+ge(),REPLACE:`@@redux/REPLACE`+ge(),PROBE_UNKNOWN_ACTION:function(){return`@@redux/PROBE_UNKNOWN_ACTION`+ge()}};function ve(e){if(typeof e!=`object`||!e)return!1;for(var t=e;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function ye(e,t,n){var r;if(typeof t==`function`&&typeof n==`function`||typeof n==`function`&&typeof arguments[3]==`function`)throw Error(C(0));if(typeof t==`function`&&n===void 0&&(n=t,t=void 0),n!==void 0){if(typeof n!=`function`)throw Error(C(1));return n(ye)(e,t)}if(typeof e!=`function`)throw Error(C(2));var i=e,a=t,o=[],s=o,c=!1;function l(){s===o&&(s=o.slice())}function u(){if(c)throw Error(C(3));return a}function d(e){if(typeof e!=`function`)throw Error(C(4));if(c)throw Error(C(5));var t=!0;return l(),s.push(e),function(){if(t){if(c)throw Error(C(6));t=!1,l();var n=s.indexOf(e);s.splice(n,1),o=null}}}function f(e){if(!ve(e))throw Error(C(7));if(e.type===void 0)throw Error(C(8));if(c)throw Error(C(9));try{c=!0,a=i(a,e)}finally{c=!1}for(var t=o=s,n=0;n<t.length;n++){var r=t[n];r()}return e}function p(e){if(typeof e!=`function`)throw Error(C(10));i=e,f({type:_e.REPLACE})}function m(){var e,t=d;return e={subscribe:function(e){if(typeof e!=`object`||!e)throw Error(C(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}},e[he]=function(){return this},e}return f({type:_e.INIT}),r={dispatch:f,subscribe:d,getState:u,replaceReducer:p},r[he]=m,r}function w(e,t,...n){if(be()&&t===void 0)throw Error(`invariant requires an error message argument`);if(!e){let e;if(t===void 0)e=Error(`Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.`);else{let r=0;e=Error(t.replace(/%s/g,function(){return n[r++]})),e.name=`Invariant Violation`}throw e.framesToPop=1,e}}function be(){return typeof process<`u`&&!0}function xe(e,t,n){return t.split(`.`).reduce((e,t)=>e&&e[t]?e[t]:n||null,e)}function Se(e,t){return e.filter(e=>e!==t)}function Ce(e){return typeof e==`object`}function we(e,t){let n=new Map,r=e=>{n.set(e,n.has(e)?n.get(e)+1:1)};e.forEach(r),t.forEach(r);let i=[];return n.forEach((e,t)=>{e===1&&i.push(t)}),i}function Te(e,t){return e.filter(e=>t.indexOf(e)>-1)}var Ee=`dnd-core/INIT_COORDS`,T=`dnd-core/BEGIN_DRAG`,De=`dnd-core/PUBLISH_DRAG_SOURCE`,E=`dnd-core/HOVER`,D=`dnd-core/DROP`,O=`dnd-core/END_DRAG`;function Oe(e,t){return{type:Ee,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}var ke={type:Ee,payload:{clientOffset:null,sourceClientOffset:null}};function Ae(e){return function(t=[],n={publishSource:!0}){let{publishSource:r=!0,clientOffset:i,getSourceClientOffset:a}=n,o=e.getMonitor(),s=e.getRegistry();e.dispatch(Oe(i)),je(t,o,s);let c=Pe(t,o);if(c==null){e.dispatch(ke);return}let l=null;if(i){if(!a)throw Error(`getSourceClientOffset must be defined`);Me(a),l=a(c)}e.dispatch(Oe(i,l));let u=s.getSource(c).beginDrag(o,c);return u==null?void 0:(Ne(u),s.pinSource(c),{type:T,payload:{itemType:s.getSourceType(c),item:u,sourceId:c,clientOffset:i||null,sourceClientOffset:l||null,isSourcePublic:!!r}})}}function je(e,t,n){w(!t.isDragging(),`Cannot call beginDrag while dragging.`),e.forEach(function(e){w(n.getSource(e),`Expected sourceIds to be registered.`)})}function Me(e){w(typeof e==`function`,`When clientOffset is provided, getSourceClientOffset must be a function.`)}function Ne(e){w(Ce(e),`Item must be an object.`)}function Pe(e,t){let n=null;for(let r=e.length-1;r>=0;r--)if(t.canDragSource(e[r])){n=e[r];break}return n}function Fe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ie(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t],r=Object.keys(n);typeof Object.getOwnPropertySymbols==`function`&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){Fe(e,t,n[t])})}return e}function Le(e){return function(t={}){let n=e.getMonitor(),r=e.getRegistry();Re(n),Ve(n).forEach((i,a)=>{let o={type:D,payload:{dropResult:Ie({},t,ze(i,a,r,n))}};e.dispatch(o)})}}function Re(e){w(e.isDragging(),`Cannot call drop while not dragging.`),w(!e.didDrop(),`Cannot call drop twice during one drag operation.`)}function ze(e,t,n,r){let i=n.getTarget(e),a=i?i.drop(r,e):void 0;return Be(a),a===void 0&&(a=t===0?{}:r.getDropResult()),a}function Be(e){w(e===void 0||Ce(e),`Drop result must either be an object or undefined.`)}function Ve(e){let t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function He(e){return function(){let t=e.getMonitor(),n=e.getRegistry();Ue(t);let r=t.getSourceId();return r!=null&&(n.getSource(r,!0).endDrag(t,r),n.unpinSource()),{type:O}}}function Ue(e){w(e.isDragging(),`Cannot call endDrag while not dragging.`)}function We(e,t){return t===null?e===null:Array.isArray(e)?e.some(e=>e===t):e===t}function Ge(e){return function(t,{clientOffset:n}={}){Ke(t);let r=t.slice(0),i=e.getMonitor(),a=e.getRegistry();return Je(r,a,i.getItemType()),qe(r,i,a),Ye(r,i,a),{type:E,payload:{targetIds:r,clientOffset:n||null}}}}function Ke(e){w(Array.isArray(e),`Expected targetIds to be an array.`)}function qe(e,t,n){w(t.isDragging(),`Cannot call hover while not dragging.`),w(!t.didDrop(),`Cannot call hover after drop.`);for(let t=0;t<e.length;t++){let r=e[t];w(e.lastIndexOf(r)===t,`Expected targetIds to be unique in the passed array.`),w(n.getTarget(r),`Expected targetIds to be registered.`)}}function Je(e,t,n){for(let r=e.length-1;r>=0;r--){let i=e[r];We(t.getTargetType(i),n)||e.splice(r,1)}}function Ye(e,t,n){e.forEach(function(e){n.getTarget(e).hover(t,e)})}function Xe(e){return function(){if(e.getMonitor().isDragging())return{type:De}}}function Ze(e){return{beginDrag:Ae(e),publishDragSource:Xe(e),hover:Ge(e),drop:Le(e),endDrag:He(e)}}var Qe=class{receiveBackend(e){this.backend=e}getMonitor(){return this.monitor}getBackend(){return this.backend}getRegistry(){return this.monitor.registry}getActions(){let e=this,{dispatch:t}=this.store;function n(n){return(...r)=>{let i=n.apply(e,r);i!==void 0&&t(i)}}let r=Ze(this);return Object.keys(r).reduce((e,t)=>{let i=r[t];return e[t]=n(i),e},{})}dispatch(e){this.store.dispatch(e)}constructor(e,t){this.isSetUp=!1,this.handleRefCountChange=()=>{let e=this.store.getState().refCount>0;this.backend&&(e&&!this.isSetUp?(this.backend.setup(),this.isSetUp=!0):!e&&this.isSetUp&&(this.backend.teardown(),this.isSetUp=!1))},this.store=e,this.monitor=t,e.subscribe(this.handleRefCountChange)}};function $e(e,t){return{x:e.x+t.x,y:e.y+t.y}}function et(e,t){return{x:e.x-t.x,y:e.y-t.y}}function tt(e){let{clientOffset:t,initialClientOffset:n,initialSourceClientOffset:r}=e;return!t||!n||!r?null:et($e(t,r),n)}function nt(e){let{clientOffset:t,initialClientOffset:n}=e;return!t||!n?null:et(t,n)}var k=[],rt=[];k.__IS_NONE__=!0,rt.__IS_ALL__=!0;function it(e,t){return e===k?!1:e===rt||t===void 0||Te(t,e).length>0}var at=class{subscribeToStateChange(e,t={}){let{handlerIds:n}=t;w(typeof e==`function`,`listener must be a function.`),w(n===void 0||Array.isArray(n),`handlerIds, when specified, must be an array of strings.`);let r=this.store.getState().stateId;return this.store.subscribe(()=>{let t=this.store.getState(),i=t.stateId;try{i===r||i===r+1&&!it(t.dirtyHandlerIds,n)||e()}finally{r=i}})}subscribeToOffsetChange(e){w(typeof e==`function`,`listener must be a function.`);let t=this.store.getState().dragOffset;return this.store.subscribe(()=>{let n=this.store.getState().dragOffset;n!==t&&(t=n,e())})}canDragSource(e){if(!e)return!1;let t=this.registry.getSource(e);return w(t,`Expected to find a valid source. sourceId=${e}`),!this.isDragging()&&t.canDrag(this,e)}canDropOnTarget(e){if(!e)return!1;let t=this.registry.getTarget(e);return w(t,`Expected to find a valid target. targetId=${e}`),!this.isDragging()||this.didDrop()?!1:We(this.registry.getTargetType(e),this.getItemType())&&t.canDrop(this,e)}isDragging(){return!!this.getItemType()}isDraggingSource(e){if(!e)return!1;let t=this.registry.getSource(e,!0);return w(t,`Expected to find a valid source. sourceId=${e}`),!this.isDragging()||!this.isSourcePublic()||this.registry.getSourceType(e)!==this.getItemType()?!1:t.isDragging(this,e)}isOverTarget(e,t={shallow:!1}){if(!e)return!1;let{shallow:n}=t;if(!this.isDragging())return!1;let r=this.registry.getTargetType(e),i=this.getItemType();if(i&&!We(r,i))return!1;let a=this.getTargetIds();if(!a.length)return!1;let o=a.indexOf(e);return n?o===a.length-1:o>-1}getItemType(){return this.store.getState().dragOperation.itemType}getItem(){return this.store.getState().dragOperation.item}getSourceId(){return this.store.getState().dragOperation.sourceId}getTargetIds(){return this.store.getState().dragOperation.targetIds}getDropResult(){return this.store.getState().dragOperation.dropResult}didDrop(){return this.store.getState().dragOperation.didDrop}isSourcePublic(){return!!this.store.getState().dragOperation.isSourcePublic}getInitialClientOffset(){return this.store.getState().dragOffset.initialClientOffset}getInitialSourceClientOffset(){return this.store.getState().dragOffset.initialSourceClientOffset}getClientOffset(){return this.store.getState().dragOffset.clientOffset}getSourceClientOffset(){return tt(this.store.getState().dragOffset)}getDifferenceFromInitialOffset(){return nt(this.store.getState().dragOffset)}constructor(e,t){this.store=e,this.registry=t}},ot=typeof global<`u`?global:self,st=ot.MutationObserver||ot.WebKitMutationObserver;function ct(e){return function(){let t=setTimeout(r,0),n=setInterval(r,50);function r(){clearTimeout(t),clearInterval(n),e()}}}function lt(e){let t=1,n=new st(e),r=document.createTextNode(``);return n.observe(r,{characterData:!0}),function(){t=-t,r.data=t}}var ut=typeof st==`function`?lt:ct,dt=class{enqueueTask(e){let{queue:t,requestFlush:n}=this;t.length||(n(),this.flushing=!0),t[t.length]=e}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{let{queue:e}=this;for(;this.index<e.length;){let t=this.index;if(this.index++,e[t].call(),this.index>this.capacity){for(let t=0,n=e.length-this.index;t<n;t++)e[t]=e[t+this.index];e.length-=this.index,this.index=0}}e.length=0,this.index=0,this.flushing=!1},this.registerPendingError=e=>{this.pendingErrors.push(e),this.requestErrorThrow()},this.requestFlush=ut(this.flush),this.requestErrorThrow=ct(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}},ft=class{call(){try{this.task&&this.task()}catch(e){this.onError(e)}finally{this.task=null,this.release(this)}}constructor(e,t){this.onError=e,this.release=t,this.task=null}},pt=class{create(e){let t=this.freeTasks,n=t.length?t.pop():new ft(this.onError,e=>t[t.length]=e);return n.task=e,n}constructor(e){this.onError=e,this.freeTasks=[]}},mt=new dt,ht=new pt(mt.registerPendingError);function gt(e){mt.enqueueTask(ht.create(e))}var _t=`dnd-core/ADD_SOURCE`,vt=`dnd-core/ADD_TARGET`,yt=`dnd-core/REMOVE_SOURCE`,A=`dnd-core/REMOVE_TARGET`;function bt(e){return{type:_t,payload:{sourceId:e}}}function xt(e){return{type:vt,payload:{targetId:e}}}function St(e){return{type:yt,payload:{sourceId:e}}}function Ct(e){return{type:A,payload:{targetId:e}}}function wt(e){w(typeof e.canDrag==`function`,`Expected canDrag to be a function.`),w(typeof e.beginDrag==`function`,`Expected beginDrag to be a function.`),w(typeof e.endDrag==`function`,`Expected endDrag to be a function.`)}function Tt(e){w(typeof e.canDrop==`function`,`Expected canDrop to be a function.`),w(typeof e.hover==`function`,`Expected hover to be a function.`),w(typeof e.drop==`function`,`Expected beginDrag to be a function.`)}function Et(e,t){if(t&&Array.isArray(e)){e.forEach(e=>Et(e,!1));return}w(typeof e==`string`||typeof e==`symbol`,t?`Type can only be a string, a symbol, or an array of either.`:`Type can only be a string or a symbol.`)}var j;(function(e){e.SOURCE=`SOURCE`,e.TARGET=`TARGET`})(j||={});var Dt=0;function Ot(){return Dt++}function kt(e){let t=Ot().toString();switch(e){case j.SOURCE:return`S${t}`;case j.TARGET:return`T${t}`;default:throw Error(`Unknown Handler Role: ${e}`)}}function At(e){switch(e[0]){case`S`:return j.SOURCE;case`T`:return j.TARGET;default:throw Error(`Cannot parse handler ID: ${e}`)}}function jt(e,t){let n=e.entries(),r=!1;do{let{done:e,value:[,i]}=n.next();if(i===t)return!0;r=!!e}while(!r);return!1}var Mt=class{addSource(e,t){Et(e),wt(t);let n=this.addHandler(j.SOURCE,e,t);return this.store.dispatch(bt(n)),n}addTarget(e,t){Et(e,!0),Tt(t);let n=this.addHandler(j.TARGET,e,t);return this.store.dispatch(xt(n)),n}containsHandler(e){return jt(this.dragSources,e)||jt(this.dropTargets,e)}getSource(e,t=!1){return w(this.isSourceId(e),`Expected a valid source ID.`),t&&e===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(e)}getTarget(e){return w(this.isTargetId(e),`Expected a valid target ID.`),this.dropTargets.get(e)}getSourceType(e){return w(this.isSourceId(e),`Expected a valid source ID.`),this.types.get(e)}getTargetType(e){return w(this.isTargetId(e),`Expected a valid target ID.`),this.types.get(e)}isSourceId(e){return At(e)===j.SOURCE}isTargetId(e){return At(e)===j.TARGET}removeSource(e){w(this.getSource(e),`Expected an existing source.`),this.store.dispatch(St(e)),gt(()=>{this.dragSources.delete(e),this.types.delete(e)})}removeTarget(e){w(this.getTarget(e),`Expected an existing target.`),this.store.dispatch(Ct(e)),this.dropTargets.delete(e),this.types.delete(e)}pinSource(e){let t=this.getSource(e);w(t,`Expected an existing source.`),this.pinnedSourceId=e,this.pinnedSource=t}unpinSource(){w(this.pinnedSource,`No source is pinned at the time.`),this.pinnedSourceId=null,this.pinnedSource=null}addHandler(e,t,n){let r=kt(e);return this.types.set(r,t),e===j.SOURCE?this.dragSources.set(r,n):e===j.TARGET&&this.dropTargets.set(r,n),r}constructor(e){this.types=new Map,this.dragSources=new Map,this.dropTargets=new Map,this.pinnedSourceId=null,this.pinnedSource=null,this.store=e}},Nt=(e,t)=>e===t;function Pt(e,t){return!e&&!t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function Ft(e,t,n=Nt){if(e.length!==t.length)return!1;for(let r=0;r<e.length;++r)if(!n(e[r],t[r]))return!1;return!0}function It(e=k,t){switch(t.type){case E:break;case _t:case vt:case A:case yt:return k;case T:case De:case O:case D:default:return rt}let{targetIds:n=[],prevTargetIds:r=[]}=t.payload,i=we(n,r);if(!(i.length>0||!Ft(n,r)))return k;let a=r[r.length-1],o=n[n.length-1];return a!==o&&(a&&i.push(a),o&&i.push(o)),i}function Lt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Rt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t],r=Object.keys(n);typeof Object.getOwnPropertySymbols==`function`&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){Lt(e,t,n[t])})}return e}var zt={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function Bt(e=zt,t){let{payload:n}=t;switch(t.type){case Ee:case T:return{initialSourceClientOffset:n.sourceClientOffset,initialClientOffset:n.clientOffset,clientOffset:n.clientOffset};case E:return Pt(e.clientOffset,n.clientOffset)?e:Rt({},e,{clientOffset:n.clientOffset});case O:case D:return zt;default:return e}}function Vt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function M(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t],r=Object.keys(n);typeof Object.getOwnPropertySymbols==`function`&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){Vt(e,t,n[t])})}return e}var Ht={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function Ut(e=Ht,t){let{payload:n}=t;switch(t.type){case T:return M({},e,{itemType:n.itemType,item:n.item,sourceId:n.sourceId,isSourcePublic:n.isSourcePublic,dropResult:null,didDrop:!1});case De:return M({},e,{isSourcePublic:!0});case E:return M({},e,{targetIds:n.targetIds});case A:return e.targetIds.indexOf(n.targetId)===-1?e:M({},e,{targetIds:Se(e.targetIds,n.targetId)});case D:return M({},e,{dropResult:n.dropResult,didDrop:!0,targetIds:[]});case O:return M({},e,{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}}function Wt(e=0,t){switch(t.type){case _t:case vt:return e+1;case yt:case A:return e-1;default:return e}}function Gt(e=0){return e+1}function Kt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t],r=Object.keys(n);typeof Object.getOwnPropertySymbols==`function`&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){Kt(e,t,n[t])})}return e}function Jt(e={},t){return{dirtyHandlerIds:It(e.dirtyHandlerIds,{type:t.type,payload:qt({},t.payload,{prevTargetIds:xe(e,`dragOperation.targetIds`,[])})}),dragOffset:Bt(e.dragOffset,t),refCount:Wt(e.refCount,t),dragOperation:Ut(e.dragOperation,t),stateId:Gt(e.stateId)}}function Yt(e,t=void 0,n={},r=!1){let i=Xt(r),a=new Qe(i,new at(i,new Mt(i))),o=e(a,t,n);return a.receiveBackend(o),a}function Xt(e){let t=typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION__;return ye(Jt,e&&t&&t({name:`dnd-core`,instanceId:`dnd-core`}))}function Zt(e,t){if(e==null)return{};var n=Qt(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Qt(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var $t=0,en=Symbol.for(`__REACT_DND_CONTEXT_INSTANCE__`),tn=(0,x.memo)(function(e){var{children:t}=e;let[n,r]=nn(Zt(e,[`children`]));return(0,x.useEffect)(()=>{if(r){let e=an();return++$t,()=>{--$t===0&&(e[en]=null)}}},[]),(0,S.jsx)(me.Provider,{value:n,children:t})});function nn(e){return`manager`in e?[{dragDropManager:e.manager},!1]:[rn(e.backend,e.context,e.options,e.debugMode),!e.context]}function rn(e,t=an(),n,r){let i=t;return i[en]||(i[en]={dragDropManager:Yt(e,t,n,r)}),i[en]}function an(){return typeof global<`u`?global:window}var on=e(pe(),1),N=typeof window<`u`?x.useLayoutEffect:x.useEffect;function sn(e,t,n){let[r,i]=(0,x.useState)(()=>t(e)),a=(0,x.useCallback)(()=>{let a=t(e);(0,on.default)(r,a)||(i(a),n&&n())},[r,e,n]);return N(a),[r,a]}function cn(e,t,n){let[r,i]=sn(e,t,n);return N(function(){let t=e.getHandlerId();if(t!=null)return e.subscribeToStateChange(i,{handlerIds:[t]})},[e,i]),r}function ln(e,t,n){return cn(t,e||(()=>({})),()=>n.reconnect())}function un(e,t){let n=[...t||[]];return t==null&&typeof e!=`function`&&n.push(e),(0,x.useMemo)(()=>typeof e==`function`?e():e,n)}function dn(e){return(0,x.useMemo)(()=>e.hooks.dragSource(),[e])}function fn(e){return(0,x.useMemo)(()=>e.hooks.dragPreview(),[e])}var pn=!1,mn=!1,hn=class{receiveHandlerId(e){this.sourceId=e}getHandlerId(){return this.sourceId}canDrag(){w(!pn,`You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor`);try{return pn=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{pn=!1}}isDragging(){if(!this.sourceId)return!1;w(!mn,`You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor`);try{return mn=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{mn=!1}}subscribeToStateChange(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}isDraggingSource(e){return this.internalMonitor.isDraggingSource(e)}isOverTarget(e,t){return this.internalMonitor.isOverTarget(e,t)}getTargetIds(){return this.internalMonitor.getTargetIds()}isSourcePublic(){return this.internalMonitor.isSourcePublic()}getSourceId(){return this.internalMonitor.getSourceId()}subscribeToOffsetChange(e){return this.internalMonitor.subscribeToOffsetChange(e)}canDragSource(e){return this.internalMonitor.canDragSource(e)}canDropOnTarget(e){return this.internalMonitor.canDropOnTarget(e)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(e){this.sourceId=null,this.internalMonitor=e.getMonitor()}},gn=!1,_n=class{receiveHandlerId(e){this.targetId=e}getHandlerId(){return this.targetId}subscribeToStateChange(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}canDrop(){if(!this.targetId)return!1;w(!gn,`You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor`);try{return gn=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{gn=!1}}isOver(e){return this.targetId?this.internalMonitor.isOverTarget(this.targetId,e):!1}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(e){this.targetId=null,this.internalMonitor=e.getMonitor()}};function vn(e,t,n){let r=n.getRegistry(),i=r.addTarget(e,t);return[i,()=>r.removeTarget(i)]}function yn(e,t,n){let r=n.getRegistry(),i=r.addSource(e,t);return[i,()=>r.removeSource(i)]}function bn(e,t,n,r){let i=n?n.call(r,e,t):void 0;if(i!==void 0)return!!i;if(e===t)return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;let a=Object.keys(e),o=Object.keys(t);if(a.length!==o.length)return!1;let s=Object.prototype.hasOwnProperty.bind(t);for(let o=0;o<a.length;o++){let c=a[o];if(!s(c))return!1;let l=e[c],u=t[c];if(i=n?n.call(r,l,u,c):void 0,i===!1||i===void 0&&l!==u)return!1}return!0}function xn(e){return typeof e==`object`&&!!e&&Object.prototype.hasOwnProperty.call(e,`current`)}function Sn(e){if(typeof e.type==`string`)return;let t=e.type.displayName||e.type.name||`the component`;throw Error(`Only native element nodes can now be passed to React DnD connectors.You can either wrap ${t} into a <div>, or turn it into a drag source or a drop target itself.`)}function Cn(e){return(t=null,n=null)=>{if(!(0,x.isValidElement)(t)){let r=t;return e(r,n),r}let r=t;return Sn(r),En(r,n?t=>e(t,n):e)}}function wn(e){let t={};return Object.keys(e).forEach(n=>{let r=e[n];if(n.endsWith(`Ref`))t[n]=e[n];else{let e=Cn(r);t[n]=()=>e}}),t}function Tn(e,t){typeof e==`function`?e(t):e.current=t}function En(e,t){let n=e.ref;return w(typeof n!=`string`,`Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs`),n?(0,x.cloneElement)(e,{ref:e=>{Tn(n,e),Tn(t,e)}}):(0,x.cloneElement)(e,{ref:t})}var Dn=class{receiveHandlerId(e){this.handlerId!==e&&(this.handlerId=e,this.reconnect())}get connectTarget(){return this.dragSource}get dragSourceOptions(){return this.dragSourceOptionsInternal}set dragSourceOptions(e){this.dragSourceOptionsInternal=e}get dragPreviewOptions(){return this.dragPreviewOptionsInternal}set dragPreviewOptions(e){this.dragPreviewOptionsInternal=e}reconnect(){let e=this.reconnectDragSource();this.reconnectDragPreview(e)}reconnectDragSource(){let e=this.dragSource,t=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();return t&&this.disconnectDragSource(),this.handlerId?e?(t&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=e,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,e,this.dragSourceOptions)),t):(this.lastConnectedDragSource=e,t):t}reconnectDragPreview(e=!1){let t=this.dragPreview,n=e||this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();if(n&&this.disconnectDragPreview(),this.handlerId){if(!t){this.lastConnectedDragPreview=t;return}n&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=t,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,t,this.dragPreviewOptions))}}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didConnectedDragSourceChange(){return this.lastConnectedDragSource!==this.dragSource}didConnectedDragPreviewChange(){return this.lastConnectedDragPreview!==this.dragPreview}didDragSourceOptionsChange(){return!bn(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}didDragPreviewOptionsChange(){return!bn(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}disconnectDragSource(){this.dragSourceUnsubscribe&&=(this.dragSourceUnsubscribe(),void 0)}disconnectDragPreview(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}get dragSource(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}get dragPreview(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}clearDragSource(){this.dragSourceNode=null,this.dragSourceRef=null}clearDragPreview(){this.dragPreviewNode=null,this.dragPreviewRef=null}constructor(e){this.hooks=wn({dragSource:(e,t)=>{this.clearDragSource(),this.dragSourceOptions=t||null,xn(e)?this.dragSourceRef=e:this.dragSourceNode=e,this.reconnectDragSource()},dragPreview:(e,t)=>{this.clearDragPreview(),this.dragPreviewOptions=t||null,xn(e)?this.dragPreviewRef=e:this.dragPreviewNode=e,this.reconnectDragPreview()}}),this.handlerId=null,this.dragSourceRef=null,this.dragSourceOptionsInternal=null,this.dragPreviewRef=null,this.dragPreviewOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDragSource=null,this.lastConnectedDragSourceOptions=null,this.lastConnectedDragPreview=null,this.lastConnectedDragPreviewOptions=null,this.backend=e}},On=class{get connectTarget(){return this.dropTarget}reconnect(){let e=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();e&&this.disconnectDropTarget();let t=this.dropTarget;if(this.handlerId){if(!t){this.lastConnectedDropTarget=t;return}e&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=t,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,t,this.dropTargetOptions))}}receiveHandlerId(e){e!==this.handlerId&&(this.handlerId=e,this.reconnect())}get dropTargetOptions(){return this.dropTargetOptionsInternal}set dropTargetOptions(e){this.dropTargetOptionsInternal=e}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didDropTargetChange(){return this.lastConnectedDropTarget!==this.dropTarget}didOptionsChange(){return!bn(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}disconnectDropTarget(){this.unsubscribeDropTarget&&=(this.unsubscribeDropTarget(),void 0)}get dropTarget(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}clearDropTarget(){this.dropTargetRef=null,this.dropTargetNode=null}constructor(e){this.hooks=wn({dropTarget:(e,t)=>{this.clearDropTarget(),this.dropTargetOptions=t,xn(e)?this.dropTargetRef=e:this.dropTargetNode=e,this.reconnect()}}),this.handlerId=null,this.dropTargetRef=null,this.dropTargetOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDropTarget=null,this.lastConnectedDropTargetOptions=null,this.backend=e}};function P(){let{dragDropManager:e}=(0,x.useContext)(me);return w(e!=null,`Expected drag drop context`),e}function kn(e,t){let n=P(),r=(0,x.useMemo)(()=>new Dn(n.getBackend()),[n]);return N(()=>(r.dragSourceOptions=e||null,r.reconnect(),()=>r.disconnectDragSource()),[r,e]),N(()=>(r.dragPreviewOptions=t||null,r.reconnect(),()=>r.disconnectDragPreview()),[r,t]),r}function An(){let e=P();return(0,x.useMemo)(()=>new hn(e),[e])}var jn=class{beginDrag(){let e=this.spec,t=this.monitor,n=null;return n=typeof e.item==`object`?e.item:typeof e.item==`function`?e.item(t):{},n??null}canDrag(){let e=this.spec,t=this.monitor;return typeof e.canDrag==`boolean`?e.canDrag:typeof e.canDrag!=`function`||e.canDrag(t)}isDragging(e,t){let n=this.spec,r=this.monitor,{isDragging:i}=n;return i?i(r):t===e.getSourceId()}endDrag(){let e=this.spec,t=this.monitor,n=this.connector,{end:r}=e;r&&r(t.getItem(),t),n.reconnect()}constructor(e,t,n){this.spec=e,this.monitor=t,this.connector=n}};function Mn(e,t,n){let r=(0,x.useMemo)(()=>new jn(e,t,n),[t,n]);return(0,x.useEffect)(()=>{r.spec=e},[e]),r}function Nn(e){return(0,x.useMemo)(()=>{let t=e.type;return w(t!=null,`spec.type must be defined`),t},[e])}function Pn(e,t,n){let r=P(),i=Mn(e,t,n),a=Nn(e);N(function(){if(a!=null){let[e,o]=yn(a,i,r);return t.receiveHandlerId(e),n.receiveHandlerId(e),o}},[r,t,n,i,a])}function Fn(e,t){let n=un(e,t);w(!n.begin,`useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)`);let r=An(),i=kn(n.options,n.previewOptions);return Pn(n,r,i),[ln(n.collect,r,i),dn(i),fn(i)]}function In(e){let t=P().getMonitor(),[n,r]=sn(t,e);return(0,x.useEffect)(()=>t.subscribeToOffsetChange(r)),(0,x.useEffect)(()=>t.subscribeToStateChange(r)),n}function Ln(e){return(0,x.useMemo)(()=>e.hooks.dropTarget(),[e])}function Rn(e){let t=P(),n=(0,x.useMemo)(()=>new On(t.getBackend()),[t]);return N(()=>(n.dropTargetOptions=e||null,n.reconnect(),()=>n.disconnectDropTarget()),[e]),n}function zn(){let e=P();return(0,x.useMemo)(()=>new _n(e),[e])}function Bn(e){let{accept:t}=e;return(0,x.useMemo)(()=>(w(e.accept!=null,`accept must be defined`),Array.isArray(t)?t:[t]),[t])}var Vn=class{canDrop(){let e=this.spec,t=this.monitor;return!e.canDrop||e.canDrop(t.getItem(),t)}hover(){let e=this.spec,t=this.monitor;e.hover&&e.hover(t.getItem(),t)}drop(){let e=this.spec,t=this.monitor;if(e.drop)return e.drop(t.getItem(),t)}constructor(e,t){this.spec=e,this.monitor=t}};function Hn(e,t){let n=(0,x.useMemo)(()=>new Vn(e,t),[t]);return(0,x.useEffect)(()=>{n.spec=e},[e]),n}function Un(e,t,n){let r=P(),i=Hn(e,t),a=Bn(e);N(function(){let[e,o]=vn(a,i,r);return t.receiveHandlerId(e),n.receiveHandlerId(e),o},[r,t,i,n,a.map(e=>e.toString()).join(`|`)])}function Wn(e,t){let n=un(e,t),r=zn(),i=Rn(n.options);return Un(n,r,i),[ln(n.collect,r,i),Ln(i)]}function Gn(e){let t=null;return()=>(t??=e(),t)}function Kn(e,t){return e.filter(e=>e!==t)}function qn(e,t){let n=new Set,r=e=>n.add(e);e.forEach(r),t.forEach(r);let i=[];return n.forEach(e=>i.push(e)),i}var Jn=class{enter(e){let t=this.entered.length,n=t=>this.isNodeInDocument(t)&&(!t.contains||t.contains(e));return this.entered=qn(this.entered.filter(n),[e]),t===0&&this.entered.length>0}leave(e){let t=this.entered.length;return this.entered=Kn(this.entered.filter(this.isNodeInDocument),e),t>0&&this.entered.length===0}reset(){this.entered=[]}constructor(e){this.entered=[],this.isNodeInDocument=e}},Yn=class{initializeExposedProperties(){Object.keys(this.config.exposeProperties).forEach(e=>{Object.defineProperty(this.item,e,{configurable:!0,enumerable:!0,get(){return console.warn(`Browser doesn't allow reading "${e}" until the drop event.`),null}})})}loadDataTransfer(e){if(e){let t={};Object.keys(this.config.exposeProperties).forEach(n=>{let r=this.config.exposeProperties[n];r!=null&&(t[n]={value:r(e,this.config.matchesTypes),configurable:!0,enumerable:!0})}),Object.defineProperties(this.item,t)}}canDrag(){return!0}beginDrag(){return this.item}isDragging(e,t){return t===e.getSourceId()}endDrag(){}constructor(e){this.config=e,this.item={},this.initializeExposedProperties()}},Xn=t({FILE:()=>Zn,HTML:()=>er,TEXT:()=>$n,URL:()=>Qn}),Zn=`__NATIVE_FILE__`,Qn=`__NATIVE_URL__`,$n=`__NATIVE_TEXT__`,er=`__NATIVE_HTML__`;function tr(e,t,n){return t.reduce((t,n)=>t||e.getData(n),``)??n}var nr={[Zn]:{exposeProperties:{files:e=>Array.prototype.slice.call(e.files),items:e=>e.items,dataTransfer:e=>e},matchesTypes:[`Files`]},[er]:{exposeProperties:{html:(e,t)=>tr(e,t,``),dataTransfer:e=>e},matchesTypes:[`Html`,`text/html`]},[Qn]:{exposeProperties:{urls:(e,t)=>tr(e,t,``).split(`
2
+ `),dataTransfer:e=>e},matchesTypes:[`Url`,`text/uri-list`]},[$n]:{exposeProperties:{text:(e,t)=>tr(e,t,``),dataTransfer:e=>e},matchesTypes:[`Text`,`text/plain`]}};function rr(e,t){let n=nr[e];if(!n)throw Error(`native type ${e} has no configuration`);let r=new Yn(n);return r.loadDataTransfer(t),r}function ir(e){if(!e)return null;let t=Array.prototype.slice.call(e.types||[]);return Object.keys(nr).filter(e=>{let n=nr[e];return n?.matchesTypes?n.matchesTypes.some(e=>t.indexOf(e)>-1):!1})[0]||null}var ar=Gn(()=>/firefox/i.test(navigator.userAgent)),or=Gn(()=>!!window.safari),sr=class{interpolate(e){let{xs:t,ys:n,c1s:r,c2s:i,c3s:a}=this,o=t.length-1;if(e===t[o])return n[o];let s=0,c=a.length-1,l;for(;s<=c;){l=Math.floor(.5*(s+c));let r=t[l];if(r<e)s=l+1;else if(r>e)c=l-1;else return n[l]}o=Math.max(0,c);let u=e-t[o],d=u*u;return n[o]+r[o]*u+i[o]*d+a[o]*u*d}constructor(e,t){let{length:n}=e,r=[];for(let e=0;e<n;e++)r.push(e);r.sort((t,n)=>e[t]<e[n]?-1:1);let i=[],a=[],o=[],s,c;for(let r=0;r<n-1;r++)s=e[r+1]-e[r],c=t[r+1]-t[r],a.push(s),i.push(c),o.push(c/s);let l=[o[0]];for(let e=0;e<a.length-1;e++){let t=o[e],n=o[e+1];if(t*n<=0)l.push(0);else{s=a[e];let r=a[e+1],i=s+r;l.push(3*i/((i+r)/t+(i+s)/n))}}l.push(o[o.length-1]);let u=[],d=[],f;for(let e=0;e<l.length-1;e++){f=o[e];let t=l[e],n=1/a[e],r=t+l[e+1]-f-f;u.push((f-t-r)*n),d.push(r*n*n)}this.xs=e,this.ys=t,this.c1s=l,this.c2s=u,this.c3s=d}},cr=1;function lr(e){let t=e.nodeType===cr?e:e.parentElement;if(!t)return null;let{top:n,left:r}=t.getBoundingClientRect();return{x:r,y:n}}function F(e){return{x:e.clientX,y:e.clientY}}function ur(e){return e.nodeName===`IMG`&&(ar()||!document.documentElement?.contains(e))}function dr(e,t,n,r){let i=e?t.width:n,a=e?t.height:r;return or()&&e&&(a/=window.devicePixelRatio,i/=window.devicePixelRatio),{dragPreviewWidth:i,dragPreviewHeight:a}}function fr(e,t,n,r,i){let a=ur(t),o=lr(a?e:t),s={x:n.x-o.x,y:n.y-o.y},{offsetWidth:c,offsetHeight:l}=e,{anchorX:u,anchorY:d}=r,{dragPreviewWidth:f,dragPreviewHeight:p}=dr(a,t,c,l),m=()=>{let e=new sr([0,.5,1],[s.y,s.y/l*p,s.y+p-l]).interpolate(d);return or()&&a&&(e+=(window.devicePixelRatio-1)*p),e},h=()=>new sr([0,.5,1],[s.x,s.x/c*f,s.x+f-c]).interpolate(u),{offsetX:g,offsetY:_}=i,v=g===0||g,ee=_===0||_;return{x:v?g:h(),y:ee?_:m()}}var pr=class{get window(){if(this.globalContext)return this.globalContext;if(typeof window<`u`)return window}get document(){if(this.globalContext?.document)return this.globalContext.document;if(this.window)return this.window.document}get rootElement(){return this.optionsArgs?.rootElement||this.window}constructor(e,t){this.ownerDocument=null,this.globalContext=e,this.optionsArgs=t}};function mr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function hr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t],r=Object.keys(n);typeof Object.getOwnPropertySymbols==`function`&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){mr(e,t,n[t])})}return e}var gr=class{profile(){return{sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,sourceNodeOptions:this.sourceNodeOptions.size,sourceNodes:this.sourceNodes.size,dragStartSourceIds:this.dragStartSourceIds?.length||0,dropTargetIds:this.dropTargetIds.length,dragEnterTargetIds:this.dragEnterTargetIds.length,dragOverTargetIds:this.dragOverTargetIds?.length||0}}get window(){return this.options.window}get document(){return this.options.document}get rootElement(){return this.options.rootElement}setup(){let e=this.rootElement;if(e!==void 0){if(e.__isReactDndBackendSetUp)throw Error(`Cannot have two HTML5 backends at the same time.`);e.__isReactDndBackendSetUp=!0,this.addEventListeners(e)}}teardown(){let e=this.rootElement;if(e!==void 0&&(e.__isReactDndBackendSetUp=!1,this.removeEventListeners(this.rootElement),this.clearCurrentDragSourceNode(),this.asyncEndDragFrameId)){var t;(t=this.window)==null||t.cancelAnimationFrame(this.asyncEndDragFrameId)}}connectDragPreview(e,t,n){return this.sourcePreviewNodeOptions.set(e,n),this.sourcePreviewNodes.set(e,t),()=>{this.sourcePreviewNodes.delete(e),this.sourcePreviewNodeOptions.delete(e)}}connectDragSource(e,t,n){this.sourceNodes.set(e,t),this.sourceNodeOptions.set(e,n);let r=t=>this.handleDragStart(t,e),i=e=>this.handleSelectStart(e);return t.setAttribute(`draggable`,`true`),t.addEventListener(`dragstart`,r),t.addEventListener(`selectstart`,i),()=>{this.sourceNodes.delete(e),this.sourceNodeOptions.delete(e),t.removeEventListener(`dragstart`,r),t.removeEventListener(`selectstart`,i),t.setAttribute(`draggable`,`false`)}}connectDropTarget(e,t){let n=t=>this.handleDragEnter(t,e),r=t=>this.handleDragOver(t,e),i=t=>this.handleDrop(t,e);return t.addEventListener(`dragenter`,n),t.addEventListener(`dragover`,r),t.addEventListener(`drop`,i),()=>{t.removeEventListener(`dragenter`,n),t.removeEventListener(`dragover`,r),t.removeEventListener(`drop`,i)}}addEventListeners(e){e.addEventListener&&(e.addEventListener(`dragstart`,this.handleTopDragStart),e.addEventListener(`dragstart`,this.handleTopDragStartCapture,!0),e.addEventListener(`dragend`,this.handleTopDragEndCapture,!0),e.addEventListener(`dragenter`,this.handleTopDragEnter),e.addEventListener(`dragenter`,this.handleTopDragEnterCapture,!0),e.addEventListener(`dragleave`,this.handleTopDragLeaveCapture,!0),e.addEventListener(`dragover`,this.handleTopDragOver),e.addEventListener(`dragover`,this.handleTopDragOverCapture,!0),e.addEventListener(`drop`,this.handleTopDrop),e.addEventListener(`drop`,this.handleTopDropCapture,!0))}removeEventListeners(e){e.removeEventListener&&(e.removeEventListener(`dragstart`,this.handleTopDragStart),e.removeEventListener(`dragstart`,this.handleTopDragStartCapture,!0),e.removeEventListener(`dragend`,this.handleTopDragEndCapture,!0),e.removeEventListener(`dragenter`,this.handleTopDragEnter),e.removeEventListener(`dragenter`,this.handleTopDragEnterCapture,!0),e.removeEventListener(`dragleave`,this.handleTopDragLeaveCapture,!0),e.removeEventListener(`dragover`,this.handleTopDragOver),e.removeEventListener(`dragover`,this.handleTopDragOverCapture,!0),e.removeEventListener(`drop`,this.handleTopDrop),e.removeEventListener(`drop`,this.handleTopDropCapture,!0))}getCurrentSourceNodeOptions(){let e=this.monitor.getSourceId(),t=this.sourceNodeOptions.get(e);return hr({dropEffect:this.altKeyPressed?`copy`:`move`},t||{})}getCurrentDropEffect(){return this.isDraggingNativeItem()?`copy`:this.getCurrentSourceNodeOptions().dropEffect}getCurrentSourcePreviewNodeOptions(){let e=this.monitor.getSourceId();return hr({anchorX:.5,anchorY:.5,captureDraggingState:!1},this.sourcePreviewNodeOptions.get(e)||{})}isDraggingNativeItem(){let e=this.monitor.getItemType();return Object.keys(Xn).some(t=>Xn[t]===e)}beginDragNativeItem(e,t){this.clearCurrentDragSourceNode(),this.currentNativeSource=rr(e,t),this.currentNativeHandle=this.registry.addSource(e,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}setCurrentDragSourceNode(e){this.clearCurrentDragSourceNode(),this.currentDragSourceNode=e,this.mouseMoveTimeoutTimer=setTimeout(()=>this.rootElement?.addEventListener(`mousemove`,this.endDragIfSourceWasRemovedFromDOM,!0),1e3)}clearCurrentDragSourceNode(){if(this.currentDragSourceNode){if(this.currentDragSourceNode=null,this.rootElement){var e;(e=this.window)==null||e.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener(`mousemove`,this.endDragIfSourceWasRemovedFromDOM,!0)}return this.mouseMoveTimeoutTimer=null,!0}return!1}handleDragStart(e,t){e.defaultPrevented||(this.dragStartSourceIds||=[],this.dragStartSourceIds.unshift(t))}handleDragEnter(e,t){this.dragEnterTargetIds.unshift(t)}handleDragOver(e,t){this.dragOverTargetIds===null&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(t)}handleDrop(e,t){this.dropTargetIds.unshift(t)}constructor(e,t,n){this.sourcePreviewNodes=new Map,this.sourcePreviewNodeOptions=new Map,this.sourceNodes=new Map,this.sourceNodeOptions=new Map,this.dragStartSourceIds=null,this.dropTargetIds=[],this.dragEnterTargetIds=[],this.currentNativeSource=null,this.currentNativeHandle=null,this.currentDragSourceNode=null,this.altKeyPressed=!1,this.mouseMoveTimeoutTimer=null,this.asyncEndDragFrameId=null,this.dragOverTargetIds=null,this.lastClientOffset=null,this.hoverRafId=null,this.getSourceClientOffset=e=>{let t=this.sourceNodes.get(e);return t&&lr(t)||null},this.endDragNativeItem=()=>{this.isDraggingNativeItem()&&(this.actions.endDrag(),this.currentNativeHandle&&this.registry.removeSource(this.currentNativeHandle),this.currentNativeHandle=null,this.currentNativeSource=null)},this.isNodeInDocument=e=>!!(e&&this.document&&this.document.body&&this.document.body.contains(e)),this.endDragIfSourceWasRemovedFromDOM=()=>{let e=this.currentDragSourceNode;e==null||this.isNodeInDocument(e)||(this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover())},this.scheduleHover=e=>{this.hoverRafId===null&&typeof requestAnimationFrame<`u`&&(this.hoverRafId=requestAnimationFrame(()=>{this.monitor.isDragging()&&this.actions.hover(e||[],{clientOffset:this.lastClientOffset}),this.hoverRafId=null}))},this.cancelHover=()=>{this.hoverRafId!==null&&typeof cancelAnimationFrame<`u`&&(cancelAnimationFrame(this.hoverRafId),this.hoverRafId=null)},this.handleTopDragStartCapture=()=>{this.clearCurrentDragSourceNode(),this.dragStartSourceIds=[]},this.handleTopDragStart=e=>{if(e.defaultPrevented)return;let{dragStartSourceIds:t}=this;this.dragStartSourceIds=null;let n=F(e);this.monitor.isDragging()&&(this.actions.endDrag(),this.cancelHover()),this.actions.beginDrag(t||[],{publishSource:!1,getSourceClientOffset:this.getSourceClientOffset,clientOffset:n});let{dataTransfer:r}=e,i=ir(r);if(this.monitor.isDragging()){if(r&&typeof r.setDragImage==`function`){let e=this.monitor.getSourceId(),t=this.sourceNodes.get(e),i=this.sourcePreviewNodes.get(e)||t;if(i){let{anchorX:e,anchorY:a,offsetX:o,offsetY:s}=this.getCurrentSourcePreviewNodeOptions(),c=fr(t,i,n,{anchorX:e,anchorY:a},{offsetX:o,offsetY:s});r.setDragImage(i,c.x,c.y)}}try{r?.setData(`application/json`,{})}catch{}this.setCurrentDragSourceNode(e.target);let{captureDraggingState:t}=this.getCurrentSourcePreviewNodeOptions();t?this.actions.publishDragSource():setTimeout(()=>this.actions.publishDragSource(),0)}else if(i)this.beginDragNativeItem(i);else if(r&&!r.types&&(e.target&&!e.target.hasAttribute||!e.target.hasAttribute(`draggable`)))return;else e.preventDefault()},this.handleTopDragEndCapture=()=>{this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleTopDragEnterCapture=e=>{if(this.dragEnterTargetIds=[],this.isDraggingNativeItem()){var t;(t=this.currentNativeSource)==null||t.loadDataTransfer(e.dataTransfer)}if(!this.enterLeaveCounter.enter(e.target)||this.monitor.isDragging())return;let{dataTransfer:n}=e,r=ir(n);r&&this.beginDragNativeItem(r,n)},this.handleTopDragEnter=e=>{let{dragEnterTargetIds:t}=this;this.dragEnterTargetIds=[],this.monitor.isDragging()&&(this.altKeyPressed=e.altKey,t.length>0&&this.actions.hover(t,{clientOffset:F(e)}),t.some(e=>this.monitor.canDropOnTarget(e))&&(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=this.getCurrentDropEffect())))},this.handleTopDragOverCapture=e=>{if(this.dragOverTargetIds=[],this.isDraggingNativeItem()){var t;(t=this.currentNativeSource)==null||t.loadDataTransfer(e.dataTransfer)}},this.handleTopDragOver=e=>{let{dragOverTargetIds:t}=this;if(this.dragOverTargetIds=[],!this.monitor.isDragging()){e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=`none`);return}this.altKeyPressed=e.altKey,this.lastClientOffset=F(e),this.scheduleHover(t),(t||[]).some(e=>this.monitor.canDropOnTarget(e))?(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=this.getCurrentDropEffect())):this.isDraggingNativeItem()?e.preventDefault():(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=`none`))},this.handleTopDragLeaveCapture=e=>{this.isDraggingNativeItem()&&e.preventDefault(),this.enterLeaveCounter.leave(e.target)&&(this.isDraggingNativeItem()&&setTimeout(()=>this.endDragNativeItem(),0),this.cancelHover())},this.handleTopDropCapture=e=>{if(this.dropTargetIds=[],this.isDraggingNativeItem()){var t;e.preventDefault(),(t=this.currentNativeSource)==null||t.loadDataTransfer(e.dataTransfer)}else ir(e.dataTransfer)&&e.preventDefault();this.enterLeaveCounter.reset()},this.handleTopDrop=e=>{let{dropTargetIds:t}=this;this.dropTargetIds=[],this.actions.hover(t,{clientOffset:F(e)}),this.actions.drop({dropEffect:this.getCurrentDropEffect()}),this.isDraggingNativeItem()?this.endDragNativeItem():this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleSelectStart=e=>{let t=e.target;typeof t.dragDrop==`function`&&(t.tagName===`INPUT`||t.tagName===`SELECT`||t.tagName===`TEXTAREA`||t.isContentEditable||(e.preventDefault(),t.dragDrop()))},this.options=new pr(t,n),this.actions=e.getActions(),this.monitor=e.getMonitor(),this.registry=e.getRegistry(),this.enterLeaveCounter=new Jn(this.isNodeInDocument)}},I;function _r(){return I||(I=new Image,I.src=`data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==`),I}var vr=function(e,t,n){return new gr(e,t,n)},yr=(0,x.createContext)(null);function L(){let e=(0,x.useContext)(yr);if(e===null)throw Error(`No Tree Api Provided`);return e}var br=(0,x.createContext)(null);function xr(){let e=(0,x.useContext)(br);if(e===null)throw Error(`Provide a NodesContext`);return e}var Sr=(0,x.createContext)(null);function Cr(){let e=(0,x.useContext)(Sr);if(e===null)throw Error(`Provide a DnDContext`);return e}var wr=(0,x.createContext)(0);function Tr(){(0,x.useContext)(wr)}var Er=t({access:()=>B,bound:()=>R,dfs:()=>Nr,focusNextElement:()=>Pr,focusPrevElement:()=>Fr,getInsertIndex:()=>Ur,getInsertParentId:()=>Wr,identify:()=>V,identifyNull:()=>zr,indexOf:()=>jr,isClosed:()=>Or,isDescendant:()=>Ar,isItem:()=>Dr,isOpenWithEmptyChildren:()=>kr,mergeRefs:()=>Br,noop:()=>Mr,safeRun:()=>Vr,waitFor:()=>Hr,walk:()=>z});function R(e,t,n){return Math.max(Math.min(e,n),t)}function Dr(e){return e&&e.isLeaf}function Or(e){return e&&e.isInternal&&!e.isOpen}function kr(e){return e&&e.isOpen&&!e.children?.length}var Ar=(e,t)=>{let n=e;for(;n;){if(n.id===t.id)return!0;n=n.parent}return!1},jr=e=>{if(!e.parent)throw Error(`Node does not have a parent`);return e.parent.children.findIndex(t=>t.id===e.id)};function Mr(){}function Nr(e,t){if(!e)return null;if(e.id===t)return e;if(e.children)for(let n of e.children){let e=Nr(n,t);if(e)return e}return null}function z(e,t){if(t(e),e.children)for(let n of e.children)z(n,t)}function Pr(e){let t=Rr(e),n;for(let r=0;r<t.length;++r)if(t[r]===e){n=Ir(t,r);break}n?.focus()}function Fr(e){let t=Rr(e),n;for(let r=0;r<t.length;++r)if(t[r]===e){n=Lr(t,r);break}n?.focus()}function Ir(e,t){return t+1<e.length?e[t+1]:e[0]}function Lr(e,t){return t-1>=0?e[t-1]:e[e.length-1]}function Rr(e){return Array.from(document.querySelectorAll(`button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled]), details:not([disabled]), summary:not(:disabled)`)).filter(t=>t===e||!e.contains(t))}function B(e,t){return typeof t==`boolean`?t:typeof t==`string`?e[t]:t(e)}function zr(e){return e===null?null:V(e)}function V(e){return typeof e==`string`?e:e.id}function Br(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}function Vr(e,...t){if(e)return e(...t)}function Hr(e){return new Promise((t,n)=>{let r=0;function i(){r+=1,r===100&&n(),e()?t():setTimeout(i,10)}i()})}function Ur(e){let t=e.focusedNode;return t?t.isOpen?0:t.parent?t.childIndex+1:0:e.root.children?.length??0}function Wr(e){let t=e.focusedNode;return t?t.isOpen?t.id:t.parent&&!t.parent.isRoot?t.parent.id:null:null}var Gr={display:`flex`,alignItems:`center`,zIndex:1},Kr={flex:1,height:`2px`,background:`#4B91E2`,borderRadius:`1px`},qr={width:`4px`,height:`4px`,boxShadow:`0 0 0 3px #4B91E2`,borderRadius:`50%`},Jr=x.memo(function({top:e,left:t,indent:n}){let r={position:`absolute`,pointerEvents:`none`,top:e-2+`px`,left:t+`px`,right:n+`px`};return(0,S.jsxs)(`div`,{style:Object.assign(Object.assign({},Gr),r),children:[(0,S.jsx)(`div`,{style:Object.assign({},qr)}),(0,S.jsx)(`div`,{style:Object.assign({},Kr)})]})});function Yr({node:e,attrs:t,innerRef:n,children:r}){return(0,S.jsx)(`div`,Object.assign({},t,{ref:n,onFocus:e=>e.stopPropagation(),onClick:e.handleClick,children:r}))}function Xr(e){return(0,S.jsxs)(`div`,{ref:e.dragHandle,style:e.style,children:[(0,S.jsx)(`span`,{onClick:t=>{t.stopPropagation(),e.node.toggle()},children:e.node.isLeaf?`🌳`:e.node.isOpen?`🗁`:`🗀`}),` `,e.node.isEditing?(0,S.jsx)(Qr,Object.assign({},e)):(0,S.jsx)(Zr,Object.assign({},e))]})}function Zr(e){return(0,S.jsx)(S.Fragment,{children:(0,S.jsx)(`span`,{children:e.node.data.name})})}function Qr({node:e}){let t=(0,x.useRef)();return(0,x.useEffect)(()=>{var e,n;(e=t.current)==null||e.focus(),(n=t.current)==null||n.select()},[]),(0,S.jsx)(`input`,{ref:t,defaultValue:e.data.name,onBlur:()=>e.reset(),onKeyDown:n=>{n.key===`Escape`&&e.reset(),n.key===`Enter`&&e.submit(t.current?.value||``)}})}function $r(e){return{type:`EDIT`,id:e}}function ei(e={id:null},t){return t.type===`EDIT`?Object.assign(Object.assign({},e),{id:t.id}):e}function H(e){return{type:`FOCUS`,id:e}}function ti(){return{type:`TREE_BLUR`}}function ni(e={id:null,treeFocused:!1},t){return t.type===`FOCUS`?Object.assign(Object.assign({},e),{id:t.id,treeFocused:!0}):t.type===`TREE_BLUR`?Object.assign(Object.assign({},e),{treeFocused:!1}):e}var ri=class e{constructor(e){this.handleClick=e=>{e.metaKey&&!this.tree.props.disableMultiSelection?this.isSelected?this.deselect():this.selectMulti():e.shiftKey&&!this.tree.props.disableMultiSelection?this.selectContiguous():(this.select(),this.activate())},this.tree=e.tree,this.id=e.id,this.data=e.data,this.level=e.level,this.children=e.children,this.parent=e.parent,this.isDraggable=e.isDraggable,this.rowIndex=e.rowIndex}get isRoot(){return this.id===ii}get isLeaf(){return!Array.isArray(this.children)}get isInternal(){return!this.isLeaf}get isOpen(){return!this.isLeaf&&this.tree.isOpen(this.id)}get isClosed(){return!this.isLeaf&&!this.tree.isOpen(this.id)}get isEditable(){return this.tree.isEditable(this.data)}get isEditing(){return this.tree.editingId===this.id}get isSelected(){return this.tree.isSelected(this.id)}get isOnlySelection(){return this.isSelected&&this.tree.hasOneSelection}get isSelectedStart(){return this.isSelected&&!this.prev?.isSelected}get isSelectedEnd(){return this.isSelected&&!this.next?.isSelected}get isFocused(){return this.tree.isFocused(this.id)}get isDragging(){return this.tree.isDragging(this.id)}get willReceiveDrop(){return this.tree.willReceiveDrop(this.id)}get state(){return{isClosed:this.isClosed,isDragging:this.isDragging,isEditing:this.isEditing,isFocused:this.isFocused,isInternal:this.isInternal,isLeaf:this.isLeaf,isOpen:this.isOpen,isSelected:this.isSelected,isSelectedEnd:this.isSelectedEnd,isSelectedStart:this.isSelectedStart,willReceiveDrop:this.willReceiveDrop}}get childIndex(){return this.parent&&this.parent.children?this.parent.children.findIndex(e=>e.id===this.id):-1}get next(){return this.rowIndex===null?null:this.tree.at(this.rowIndex+1)}get prev(){return this.rowIndex===null?null:this.tree.at(this.rowIndex-1)}get nextSibling(){let e=this.childIndex;return this.parent?.children[e+1]??null}isAncestorOf(e){if(!e)return!1;let t=e;for(;t;){if(t.id===this.id)return!0;t=t.parent}return!1}select(){this.tree.select(this)}deselect(){this.tree.deselect(this)}selectMulti(){this.tree.selectMulti(this)}selectContiguous(){this.tree.selectContiguous(this)}activate(){this.tree.activate(this)}focus(){this.tree.focus(this)}toggle(){this.tree.toggle(this)}open(){this.tree.open(this)}openParents(){this.tree.openParents(this)}close(){this.tree.close(this)}submit(e){this.tree.submit(this,e)}reset(){this.tree.reset()}clone(){return new e(Object.assign({},this))}edit(){return this.tree.edit(this)}},ii=`__REACT_ARBORIST_INTERNAL_ROOT__`;function ai(e){function t(n,r,i){let a=new ri({tree:e,data:n,level:r,parent:i,id:e.accessId(n),children:null,isDraggable:e.isDraggable(n),rowIndex:null}),o=e.accessChildren(n);return o&&(a.children=o.map(e=>t(e,r+1,a))),a}let n=new ri({tree:e,id:ii,data:{id:ii},level:-1,parent:null,children:null,isDraggable:!0,rowIndex:null});return n.children=(e.props.data??[]).map(e=>t(e,0,n)),n}var oi={open(e,t){return{type:`VISIBILITY_OPEN`,id:e,filtered:t}},close(e,t){return{type:`VISIBILITY_CLOSE`,id:e,filtered:t}},toggle(e,t){return{type:`VISIBILITY_TOGGLE`,id:e,filtered:t}},clear(e){return{type:`VISIBILITY_CLEAR`,filtered:e}}};function si(e={},t){if(t.type===`VISIBILITY_OPEN`)return Object.assign(Object.assign({},e),{[t.id]:!0});if(t.type===`VISIBILITY_CLOSE`)return Object.assign(Object.assign({},e),{[t.id]:!1});if(t.type===`VISIBILITY_TOGGLE`){let n=e[t.id];return Object.assign(Object.assign({},e),{[t.id]:!n})}return t.type===`VISIBILITY_CLEAR`?{}:e}function ci(e={filtered:{},unfiltered:{}},t){return t.type.startsWith(`VISIBILITY`)?t.filtered?Object.assign(Object.assign({},e),{filtered:si(e.filtered,t)}):Object.assign(Object.assign({},e),{unfiltered:si(e.unfiltered,t)}):e}var U=e=>({nodes:{open:{filtered:{},unfiltered:e?.initialOpenState??{}},focus:{id:null,treeFocused:!1},edit:{id:null},drag:{id:null,selectedIds:[],destinationParentId:null,destinationIndex:null},selection:{ids:new Set,anchor:null,mostRecent:null}},dnd:{cursor:{type:`none`},dragId:null,dragIds:[],parentId:null,index:-1}}),W={clear:()=>({type:`SELECTION_CLEAR`}),only:e=>({type:`SELECTION_ONLY`,id:V(e)}),add:e=>({type:`SELECTION_ADD`,ids:(Array.isArray(e)?e:[e]).map(V)}),remove:e=>({type:`SELECTION_REMOVE`,ids:(Array.isArray(e)?e:[e]).map(V)}),set:e=>Object.assign({type:`SELECTION_SET`},e),mostRecent:e=>({type:`SELECTION_MOST_RECENT`,id:e===null?null:V(e)}),anchor:e=>({type:`SELECTION_ANCHOR`,id:e===null?null:V(e)})};function li(e=U().nodes.selection,t){let n=e.ids;switch(t.type){case`SELECTION_CLEAR`:return Object.assign(Object.assign({},e),{ids:new Set});case`SELECTION_ONLY`:return Object.assign(Object.assign({},e),{ids:new Set([t.id])});case`SELECTION_ADD`:return t.ids.length===0?e:(t.ids.forEach(e=>n.add(e)),Object.assign(Object.assign({},e),{ids:new Set(n)}));case`SELECTION_REMOVE`:return t.ids.length===0?e:(t.ids.forEach(e=>n.delete(e)),Object.assign(Object.assign({},e),{ids:new Set(n)}));case`SELECTION_SET`:return Object.assign(Object.assign({},e),{ids:t.ids,mostRecent:t.mostRecent,anchor:t.anchor});case`SELECTION_MOST_RECENT`:return Object.assign(Object.assign({},e),{mostRecent:t.id});case`SELECTION_ANCHOR`:return Object.assign(Object.assign({},e),{anchor:t.id});default:return e}}var G={cursor(e){return{type:`DND_CURSOR`,cursor:e}},dragStart(e,t){return{type:`DND_DRAG_START`,id:e,dragIds:t}},dragEnd(){return{type:`DND_DRAG_END`}},hovering(e,t){return{type:`DND_HOVERING`,parentId:e,index:t}}};function ui(e=U().dnd,t){switch(t.type){case`DND_CURSOR`:return Object.assign(Object.assign({},e),{cursor:t.cursor});case`DND_DRAG_START`:return Object.assign(Object.assign({},e),{dragId:t.id,dragIds:t.dragIds});case`DND_DRAG_END`:return U().dnd;case`DND_HOVERING`:return Object.assign(Object.assign({},e),{parentId:t.parentId,index:t.index});default:return e}}var di={position:`fixed`,pointerEvents:`none`,zIndex:100,left:0,top:0,width:`100%`,height:`100%`},fi=e=>{if(!e)return{display:`none`};let{x:t,y:n}=e;return{transform:`translate(${t}px, ${n}px)`}},pi=e=>{if(!e)return{display:`none`};let{x:t,y:n}=e;return{transform:`translate(${t+10}px, ${n+10}px)`}};function mi({offset:e,mouse:t,id:n,dragIds:r,isDragging:i}){return(0,S.jsxs)(hi,{isDragging:i,children:[(0,S.jsx)(gi,{offset:e,children:(0,S.jsx)(vi,{id:n,dragIds:r})}),(0,S.jsx)(_i,{mouse:t,count:r.length})]})}var hi=(0,x.memo)(function(e){return e.isDragging?(0,S.jsx)(`div`,{style:di,children:e.children}):null});function gi(e){return(0,S.jsx)(`div`,{className:`row preview`,style:fi(e.offset),children:e.children})}function _i(e){let{count:t,mouse:n}=e;return t>1?(0,S.jsx)(`div`,{className:`selected-count`,style:pi(n),children:t}):null}var vi=(0,x.memo)(function(e){let t=L(),n=t.get(e.id);return n?(0,S.jsx)(t.renderNode,{preview:!0,node:n,style:{paddingLeft:n.level*t.indent,opacity:.2,background:`transparent`},tree:t}):null}),yi=Number.isNaN||function(e){return typeof e==`number`&&e!==e};function bi(e,t){return!!(e===t||yi(e)&&yi(t))}function xi(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(!bi(e[n],t[n]))return!1;return!0}function Si(e,t){t===void 0&&(t=xi);var n,r=[],i,a=!1;function o(){var o=[...arguments];return a&&n===this&&t(o,r)?i:(i=e.apply(this,o),a=!0,n=this,r=o,i)}return o}var Ci=typeof performance==`object`&&typeof performance.now==`function`?function(){return performance.now()}:function(){return Date.now()};function wi(e){cancelAnimationFrame(e.id)}function Ti(e,t){var n=Ci();function r(){Ci()-n>=t?e.call(null):i.id=requestAnimationFrame(r)}var i={id:requestAnimationFrame(r)};return i}var Ei=-1;function Di(e){if(e===void 0&&(e=!1),Ei===-1||e){var t=document.createElement(`div`),n=t.style;n.width=`50px`,n.height=`50px`,n.overflow=`scroll`,document.body.appendChild(t),Ei=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return Ei}var K=null;function Oi(e){if(e===void 0&&(e=!1),K===null||e){var t=document.createElement(`div`),n=t.style;n.width=`50px`,n.height=`50px`,n.overflow=`scroll`,n.direction=`rtl`;var r=document.createElement(`div`),i=r.style;return i.width=`100px`,i.height=`100px`,t.appendChild(r),document.body.appendChild(t),t.scrollLeft>0?K=`positive-descending`:(t.scrollLeft=1,K=t.scrollLeft===0?`negative`:`positive-ascending`),document.body.removeChild(t),K}return K}var ki=150,Ai=function(e,t){return e};function ji(e){var t,n=e.getItemOffset,r=e.getEstimatedTotalSize,i=e.getItemSize,a=e.getOffsetForIndexAndAlignment,o=e.getStartIndexForOffset,s=e.getStopIndexForStartIndex,c=e.initInstanceProps,l=e.shouldResetStyleCacheOnItemSizeChange,u=e.validateProps;return t=function(e){de(t,e);function t(t){var r=e.call(this,t)||this;return r._instanceProps=c(r.props,fe(r)),r._outerRef=void 0,r._resetIsScrollingTimeoutId=null,r.state={instance:fe(r),isScrolling:!1,scrollDirection:`forward`,scrollOffset:typeof r.props.initialScrollOffset==`number`?r.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},r._callOnItemsRendered=void 0,r._callOnItemsRendered=Si(function(e,t,n,i){return r.props.onItemsRendered({overscanStartIndex:e,overscanStopIndex:t,visibleStartIndex:n,visibleStopIndex:i})}),r._callOnScroll=void 0,r._callOnScroll=Si(function(e,t,n){return r.props.onScroll({scrollDirection:e,scrollOffset:t,scrollUpdateWasRequested:n})}),r._getItemStyle=void 0,r._getItemStyle=function(e){var t=r.props,a=t.direction,o=t.itemSize,s=t.layout,c=r._getItemStyleCache(l&&o,l&&s,l&&a),u;if(c.hasOwnProperty(e))u=c[e];else{var d=n(r.props,e,r._instanceProps),f=i(r.props,e,r._instanceProps),p=a===`horizontal`||s===`horizontal`,m=a===`rtl`,h=p?d:0;c[e]=u={position:`absolute`,left:m?void 0:h,right:m?h:void 0,top:p?0:d,height:p?`100%`:f,width:p?f:`100%`}}return u},r._getItemStyleCache=void 0,r._getItemStyleCache=Si(function(e,t,n){return{}}),r._onScrollHorizontal=function(e){var t=e.currentTarget,n=t.clientWidth,i=t.scrollLeft,a=t.scrollWidth;r.setState(function(e){if(e.scrollOffset===i)return null;var t=r.props.direction,o=i;if(t===`rtl`)switch(Oi()){case`negative`:o=-i;break;case`positive-descending`:o=a-n-i}return o=Math.max(0,Math.min(o,a-n)),{isScrolling:!0,scrollDirection:e.scrollOffset<o?`forward`:`backward`,scrollOffset:o,scrollUpdateWasRequested:!1}},r._resetIsScrollingDebounced)},r._onScrollVertical=function(e){var t=e.currentTarget,n=t.clientHeight,i=t.scrollHeight,a=t.scrollTop;r.setState(function(e){if(e.scrollOffset===a)return null;var t=Math.max(0,Math.min(a,i-n));return{isScrolling:!0,scrollDirection:e.scrollOffset<t?`forward`:`backward`,scrollOffset:t,scrollUpdateWasRequested:!1}},r._resetIsScrollingDebounced)},r._outerRefSetter=function(e){var t=r.props.outerRef;r._outerRef=e,typeof t==`function`?t(e):typeof t==`object`&&t&&t.hasOwnProperty(`current`)&&(t.current=e)},r._resetIsScrollingDebounced=function(){r._resetIsScrollingTimeoutId!==null&&wi(r._resetIsScrollingTimeoutId),r._resetIsScrollingTimeoutId=Ti(r._resetIsScrolling,ki)},r._resetIsScrolling=function(){r._resetIsScrollingTimeoutId=null,r.setState({isScrolling:!1},function(){r._getItemStyleCache(-1,null)})},r}t.getDerivedStateFromProps=function(e,t){return Mi(e,t),u(e),null};var d=t.prototype;return d.scrollTo=function(e){e=Math.max(0,e),this.setState(function(t){return t.scrollOffset===e?null:{scrollDirection:t.scrollOffset<e?`forward`:`backward`,scrollOffset:e,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},d.scrollToItem=function(e,t){t===void 0&&(t=`auto`);var n=this.props,r=n.itemCount,i=n.layout,o=this.state.scrollOffset;e=Math.max(0,Math.min(e,r-1));var s=0;if(this._outerRef){var c=this._outerRef;s=i===`vertical`?c.scrollWidth>c.clientWidth?Di():0:c.scrollHeight>c.clientHeight?Di():0}this.scrollTo(a(this.props,e,t,o,this._instanceProps,s))},d.componentDidMount=function(){var e=this.props,t=e.direction,n=e.initialScrollOffset,r=e.layout;if(typeof n==`number`&&this._outerRef!=null){var i=this._outerRef;t===`horizontal`||r===`horizontal`?i.scrollLeft=n:i.scrollTop=n}this._callPropsCallbacks()},d.componentDidUpdate=function(){var e=this.props,t=e.direction,n=e.layout,r=this.state,i=r.scrollOffset;if(r.scrollUpdateWasRequested&&this._outerRef!=null){var a=this._outerRef;if(t===`horizontal`||n===`horizontal`){if(t===`rtl`)switch(Oi()){case`negative`:a.scrollLeft=-i;break;case`positive-ascending`:a.scrollLeft=i;break;default:var o=a.clientWidth;a.scrollLeft=a.scrollWidth-o-i}else a.scrollLeft=i}else a.scrollTop=i}this._callPropsCallbacks()},d.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&wi(this._resetIsScrollingTimeoutId)},d.render=function(){var e=this.props,t=e.children,n=e.className,i=e.direction,a=e.height,o=e.innerRef,s=e.innerElementType,c=e.innerTagName,l=e.itemCount,u=e.itemData,d=e.itemKey,f=d===void 0?Ai:d,p=e.layout,m=e.outerElementType,h=e.outerTagName,g=e.style,_=e.useIsScrolling,v=e.width,ee=this.state.isScrolling,te=i===`horizontal`||p===`horizontal`,y=te?this._onScrollHorizontal:this._onScrollVertical,ne=this._getRangeToRender(),re=ne[0],ae=ne[1],oe=[];if(l>0)for(var b=re;b<=ae;b++)oe.push((0,x.createElement)(t,{data:u,key:f(b,u),index:b,isScrolling:_?ee:void 0,style:this._getItemStyle(b)}));var se=r(this.props,this._instanceProps);return(0,x.createElement)(m||h||`div`,{className:n,onScroll:y,ref:this._outerRefSetter,style:ie({position:`relative`,height:a,width:v,overflow:`auto`,WebkitOverflowScrolling:`touch`,willChange:`transform`,direction:i},g)},(0,x.createElement)(s||c||`div`,{children:oe,ref:o,style:{height:te?`100%`:se,pointerEvents:ee?`none`:void 0,width:te?se:`100%`}}))},d._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered==`function`&&this.props.itemCount>0){var e=this._getRangeToRender(),t=e[0],n=e[1],r=e[2],i=e[3];this._callOnItemsRendered(t,n,r,i)}if(typeof this.props.onScroll==`function`){var a=this.state,o=a.scrollDirection,s=a.scrollOffset,c=a.scrollUpdateWasRequested;this._callOnScroll(o,s,c)}},d._getRangeToRender=function(){var e=this.props,t=e.itemCount,n=e.overscanCount,r=this.state,i=r.isScrolling,a=r.scrollDirection,c=r.scrollOffset;if(t===0)return[0,0,0,0];var l=o(this.props,c,this._instanceProps),u=s(this.props,l,c,this._instanceProps),d=!i||a===`backward`?Math.max(1,n):1,f=!i||a===`forward`?Math.max(1,n):1;return[Math.max(0,l-d),Math.max(0,Math.min(t-1,u+f)),l,u]},t}(x.PureComponent),t.defaultProps={direction:`ltr`,itemData:void 0,layout:`vertical`,overscanCount:2,useIsScrolling:!1},t}var Mi=function(e,t){e.children,e.direction,e.height,e.layout,e.innerTagName,e.outerTagName,e.width,t.instance},Ni=ji({getItemOffset:function(e,t){return t*e.itemSize},getItemSize:function(e,t){return e.itemSize},getEstimatedTotalSize:function(e){var t=e.itemCount;return e.itemSize*t},getOffsetForIndexAndAlignment:function(e,t,n,r,i,a){var o=e.direction,s=e.height,c=e.itemCount,l=e.itemSize,u=e.layout,d=e.width,f=o===`horizontal`||u===`horizontal`?d:s,p=Math.max(0,c*l-f),m=Math.min(p,t*l),h=Math.max(0,t*l-f+l+a);switch(n===`smart`&&(n=r>=h-f&&r<=m+f?`auto`:`center`),n){case`start`:return m;case`end`:return h;case`center`:var g=Math.round(h+(m-h)/2);return g<Math.ceil(f/2)?0:g>p+Math.floor(f/2)?p:g;default:return r>=h&&r<=m?r:r<h?h:m}},getStartIndexForOffset:function(e,t){var n=e.itemCount,r=e.itemSize;return Math.max(0,Math.min(n-1,Math.floor(t/r)))},getStopIndexForStartIndex:function(e,t,n){var r=e.direction,i=e.height,a=e.itemCount,o=e.itemSize,s=e.layout,c=e.width,l=r===`horizontal`||s===`horizontal`,u=t*o,d=Math.ceil(((l?c:i)+n-u)/o);return Math.max(0,Math.min(a-1,t+d-1))},initInstanceProps:function(e){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(e){e.itemSize}});function Pi(){let e=L(),t=Cr().cursor;if(!t||t.type!==`line`)return null;let n=e.indent,r=e.rowHeight*t.index+(e.props.padding??e.props.paddingTop??0),i=n*t.level,a=e.renderCursor;return(0,S.jsx)(a,{top:r,left:i,indent:n})}var Fi=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},Ii=(0,x.forwardRef)(function(e,t){let{children:n}=e,r=Fi(e,[`children`]),i=L();return(0,S.jsxs)(`div`,Object.assign({ref:t},r,{onClick:e=>{e.currentTarget===e.target&&i.deselectAll()},children:[(0,S.jsx)(Li,{}),n]}))}),Li=()=>{let e=L();return(0,S.jsx)(`div`,{style:{height:e.visibleNodes.length*e.rowHeight,width:`100%`,position:`absolute`,left:`0`,right:`0`},children:(0,S.jsx)(Pi,{})})},Ri=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},zi=(0,x.forwardRef)(function(e,t){var{style:n}=e,r=Ri(e,[`style`]);let i=L(),a=i.props.padding??i.props.paddingTop??0,o=i.props.padding??i.props.paddingBottom??0;return(0,S.jsx)(`div`,Object.assign({ref:t,style:Object.assign(Object.assign({},n),{height:`${parseFloat(n.height)+a+o}px`})},r))});function Bi(e){let t=L(),n=t.selectedIds,[r,i,a]=Fn(()=>({canDrag:()=>e.isDraggable,type:`NODE`,item:()=>{let r=t.isSelected(e.id)?Array.from(n):[e.id];return t.dispatch(G.dragStart(e.id,r)),{id:e.id,dragIds:r}},end:()=>{t.hideCursor(),t.dispatch(G.dragEnd())}}),[n,e]);return(0,x.useEffect)(()=>{a(_r())},[a]),i}function Vi(e,t){let n=e.getBoundingClientRect(),r=t.x-Math.round(n.x),i=t.y-Math.round(n.y),a=n.height,o=i<a/2,s=!o,c=a/4,l=i>c&&i<a-c;return{x:r,inTopHalf:o,inBottomHalf:s,inMiddle:l,atTop:!l&&o,atBottom:!l&&s}}function Hi(e,t,n,r){return e?e.isInternal?r.atTop?[t,e]:r.inMiddle?[e,e]:[e,n]:r.inTopHalf?[t,e]:[e,n]:[t,null]}function Ui(e,t){return{parentId:e||null,index:t}}function q(e,t){return{type:`line`,index:e,level:t}}function Wi(e){return{type:`highlight`,id:e}}function Gi(e,t){let n=e;for(;n.parent&&n.level>t;)n=n.parent;return{parentId:n.parent?.id||null,index:jr(n)+1}}function Ki(e){let t=Vi(e.element,e.offset),n=e.indent,r=Math.round(Math.max(0,t.x-n)/n),{node:i,nextNode:a,prevNode:o}=e,[s,c]=Hi(i,o,a,t);if(i&&i.isInternal&&t.inMiddle)return{drop:Ui(i.id,null),cursor:Wi(i.id)};if(!s)return{drop:Ui(c?.parent?.id,0),cursor:q(0,0)};if(Dr(s)){let e=R(r,c?.level||0,s.level);return{drop:Gi(s,e),cursor:q(s.rowIndex+1,e)}}if(Or(s)){let e=R(r,c?.level||0,s.level);return{drop:Gi(s,e),cursor:q(s.rowIndex+1,e)}}if(kr(s)){let e=R(r,0,s.level+1);return e>s.level?{drop:Ui(s.id,0),cursor:q(s.rowIndex+1,e)}:{drop:Gi(s,e),cursor:q(s.rowIndex+1,e)}}return{drop:Ui(s?.id,0),cursor:q(s.rowIndex+1,s.level+1)}}function qi(e,t){let n=L(),[r,i]=Wn(()=>({accept:`NODE`,canDrop:()=>n.canDrop(),hover:(r,i)=>{let a=i.getClientOffset();if(!e.current||!a)return;let{cursor:o,drop:s}=Ki({element:e.current,offset:a,indent:n.indent,node:t,prevNode:t.prev,nextNode:t.next});s&&n.dispatch(G.hovering(s.parentId,s.index)),i.canDrop()?o&&n.showCursor(o):n.hideCursor()},drop:(e,t)=>{if(!t.canDrop())return null;let{parentId:r,index:i,dragIds:a}=n.state.dnd;Vr(n.props.onMove,{dragIds:a,parentId:r===`__REACT_ARBORIST_INTERNAL_ROOT__`?null:r,index:i===null?0:i,dragNodes:n.dragNodes,parentNode:n.get(r)}),n.open(r)}}),[t,e.current,n.props]);return i}function Ji(e){let t=L(),n=t.at(e);if(!n)throw Error(`Could not find node for index: ${e}`);return(0,x.useMemo)(()=>{let r=n.clone();return t.visibleNodes[e]=r,r},[...Object.values(n.state),n])}var Yi=x.memo(function({index:e,style:t}){Tr(),xr();let n=L(),r=Ji(e),i=(0,x.useRef)(null),a=Bi(r),o=qi(i,r),s=(0,x.useCallback)(e=>{i.current=e,o(e)},[o]),c=n.indent*r.level,l=(0,x.useMemo)(()=>({paddingLeft:c}),[c]),u=(0,x.useMemo)(()=>Object.assign(Object.assign({},t),{top:parseFloat(t.top)+(n.props.padding??n.props.paddingTop??0)}),[t,n.props.padding,n.props.paddingTop]),d={role:`treeitem`,"aria-level":r.level+1,"aria-selected":r.isSelected,"aria-expanded":r.isOpen,style:u,tabIndex:-1,className:n.props.rowClassName};(0,x.useEffect)(()=>{var e;!r.isEditing&&r.isFocused&&((e=i.current)==null||e.focus({preventScroll:!0}))},[r.isEditing,r.isFocused,i.current]);let f=n.renderNode,p=n.renderRow;return(0,S.jsx)(p,{node:r,innerRef:s,attrs:d,children:(0,S.jsx)(f,{node:r,tree:n,style:l,dragHandle:a})})}),Xi=``,Zi=null;function Qi(){Tr();let e=L();return(0,S.jsx)(`div`,{role:`tree`,style:{height:e.height,width:e.width,minHeight:0,minWidth:0},onContextMenu:e.props.onContextMenu,onClick:e.props.onClick,tabIndex:0,onFocus:t=>{t.currentTarget.contains(t.relatedTarget)||e.onFocus()},onBlur:t=>{t.currentTarget.contains(t.relatedTarget)||e.onBlur()},onKeyDown:t=>{if(e.isEditing)return;if(t.key===`Backspace`){if(!e.props.onDelete)return;let t=Array.from(e.selectedIds);if(t.length>1){let n=e.mostRecentNode;for(;n&&n.isSelected;)n=n.nextSibling;n||=e.lastNode,e.focus(n,{scroll:!1}),e.delete(Array.from(t))}else{let t=e.focusedNode;if(t){let n=t.nextSibling,r=t.parent;e.focus(n||r,{scroll:!1}),e.delete(t)}}return}if(t.key===`Tab`&&!t.shiftKey){t.preventDefault(),Pr(t.currentTarget);return}if(t.key===`Tab`&&t.shiftKey){t.preventDefault(),Fr(t.currentTarget);return}if(t.key===`ArrowDown`){t.preventDefault();let n=e.nextNode;if(t.metaKey){e.select(e.focusedNode),e.activate(e.focusedNode);return}if(!t.shiftKey||e.props.disableMultiSelection){e.focus(n);return}{if(!n)return;let t=e.focusedNode;t?t.isSelected?e.selectContiguous(n):e.selectMulti(n):e.focus(e.firstNode);return}}if(t.key===`ArrowUp`){t.preventDefault();let n=e.prevNode;if(!t.shiftKey||e.props.disableMultiSelection){e.focus(n);return}{if(!n)return;let t=e.focusedNode;t?t.isSelected?e.selectContiguous(n):e.selectMulti(n):e.focus(e.lastNode);return}}if(t.key===`ArrowRight`){let t=e.focusedNode;if(!t)return;t.isInternal&&t.isOpen?e.focus(e.nextNode):t.isInternal&&e.open(t.id);return}if(t.key===`ArrowLeft`){let t=e.focusedNode;if(!t||t.isRoot)return;t.isInternal&&t.isOpen?e.close(t.id):t.parent?.isRoot||e.focus(t.parent);return}if(t.key===`a`&&t.metaKey&&!e.props.disableMultiSelection){t.preventDefault(),e.selectAll();return}if(t.key===`a`&&!t.metaKey&&e.props.onCreate){e.createLeaf();return}if(t.key===`A`&&!t.metaKey){if(!e.props.onCreate)return;e.createInternal();return}if(t.key===`Home`){t.preventDefault(),e.focus(e.firstNode);return}if(t.key===`End`){t.preventDefault(),e.focus(e.lastNode);return}if(t.key===`Enter`){let t=e.focusedNode;if(!t||!t.isEditable||!e.props.onRename)return;setTimeout(()=>{t&&e.edit(t)});return}if(t.key===` `){t.preventDefault();let n=e.focusedNode;if(!n)return;n.isLeaf?(n.select(),n.activate()):n.toggle();return}if(t.key===`*`){let t=e.focusedNode;if(!t)return;e.openSiblings(t);return}if(t.key===`PageUp`){t.preventDefault(),e.pageUp();return}t.key===`PageDown`&&(t.preventDefault(),e.pageDown()),clearTimeout(Zi),Xi+=t.key,Zi=setTimeout(()=>{Xi=``},600);let n=e.visibleNodes.find(e=>{let t=e.data.name;return typeof t==`string`&&t.toLowerCase().startsWith(Xi)});n&&e.focus(n.id)},children:(0,S.jsx)(Ni,{className:e.props.className,outerRef:e.listEl,itemCount:e.visibleNodes.length,height:e.height,width:e.width,itemSize:e.rowHeight,overscanCount:e.overscanCount,itemKey:t=>e.visibleNodes[t]?.id||t,outerElementType:Ii,innerElementType:zi,onScroll:e.props.onScroll,onItemsRendered:e.onItemsRendered.bind(e),ref:e.list,children:Yi})})}function $i(e){return e.isFiltered?ta(e.root,e.isMatch.bind(e)):ea(e.root)}function ea(e){let t=[];function n(e){var r;e.level>=0&&t.push(e),e.isOpen&&((r=e.children)==null||r.forEach(n))}return n(e),t.forEach(na),t}function ta(e,t){let n={},r=[];function i(e){if(!e.isRoot&&t(e)){n[e.id]=!0;let t=e.parent;for(;t;)n[t.id]=!0,t=t.parent}if(e.children)for(let t of e.children)i(t)}function a(e){var t;e.level>=0&&n[e.id]&&r.push(e),e.isOpen&&((t=e.children)==null||t.forEach(a))}return i(e),a(e),r.forEach(na),r}function na(e,t){e.rowIndex=t}var ra=e=>e.reduce((e,t,n)=>(e[t.id]=n,e),{}),ia=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},{safeRun:J,identify:Y,identifyNull:X}=Er,aa=class e{constructor(e,t,n,r){this.store=e,this.props=t,this.list=n,this.listEl=r,this.visibleStartIndex=0,this.visibleStopIndex=0,this.root=ai(this),this.visibleNodes=$i(this),this.idToIndex=ra(this.visibleNodes)}update(e){this.props=e,this.root=ai(this),this.visibleNodes=$i(this),this.idToIndex=ra(this.visibleNodes)}dispatch(e){return this.store.dispatch(e)}get state(){return this.store.getState()}get openState(){return this.state.nodes.open.unfiltered}get width(){return this.props.width??300}get height(){return this.props.height??500}get indent(){return this.props.indent??24}get rowHeight(){return this.props.rowHeight??24}get overscanCount(){return this.props.overscanCount??1}get searchTerm(){return(this.props.searchTerm||``).trim()}get matchFn(){let e=this.props.searchMatch??((e,t)=>JSON.stringify(Object.values(e.data)).toLocaleLowerCase().includes(t.toLocaleLowerCase()));return t=>e(t,this.searchTerm)}accessChildren(e){return B(e,this.props.childrenAccessor||`children`)??null}accessId(e){let t=B(e,this.props.idAccessor||`id`);if(!t)throw Error(`Data must contain an 'id' property or props.idAccessor must return a string`);return t}get firstNode(){return this.visibleNodes[0]??null}get lastNode(){return this.visibleNodes[this.visibleNodes.length-1]??null}get focusedNode(){return this.get(this.state.nodes.focus.id)??null}get mostRecentNode(){return this.get(this.state.nodes.selection.mostRecent)??null}get nextNode(){let e=this.indexOf(this.focusedNode);return e===null?null:this.at(e+1)}get prevNode(){let e=this.indexOf(this.focusedNode);return e===null?null:this.at(e-1)}get(e){return e&&e in this.idToIndex&&this.visibleNodes[this.idToIndex[e]]||null}at(e){return this.visibleNodes[e]||null}nodesBetween(e,t){if(e===null||t===null)return[];let n=this.indexOf(e)??0,r=this.indexOf(t);if(r===null)return[];let i=Math.min(n,r),a=Math.max(n,r);return this.visibleNodes.slice(i,a+1)}indexOf(e){let t=zr(e);return t?this.idToIndex[t]:null}get editingId(){return this.state.nodes.edit.id}createInternal(){return this.create({type:`internal`})}createLeaf(){return this.create({type:`leaf`})}create(){return ia(this,arguments,void 0,function*(e={}){let t=e.parentId===void 0?Wr(this):e.parentId,n=e.index??Ur(this),r=e.type??`leaf`,i=yield J(this.props.onCreate,{type:r,parentId:t,index:n,parentNode:this.get(t)});i&&(this.focus(i),setTimeout(()=>{this.edit(i).then(()=>{this.select(i),this.activate(i)})}))})}delete(e){return ia(this,void 0,void 0,function*(){if(!e)return;let t=(Array.isArray(e)?e:[e]).map(Y),n=t.map(e=>this.get(e)).filter(e=>!!e);yield J(this.props.onDelete,{nodes:n,ids:t})})}edit(t){let n=Y(t);return this.resolveEdit({cancelled:!0}),this.scrollTo(n),this.dispatch($r(n)),new Promise(t=>{e.editPromise=t})}submit(e,t){return ia(this,void 0,void 0,function*(){if(!e)return;let n=Y(e);yield J(this.props.onRename,{id:n,name:t,node:this.get(n)}),this.dispatch($r(null)),this.resolveEdit({cancelled:!1,value:t}),setTimeout(()=>this.onFocus())})}reset(){this.dispatch($r(null)),this.resolveEdit({cancelled:!0}),setTimeout(()=>this.onFocus())}activate(e){let t=this.get(X(e));t&&J(this.props.onActivate,t)}resolveEdit(t){let n=e.editPromise;n&&n(t),e.editPromise=null}get selectedIds(){return this.state.nodes.selection.ids}get selectedNodes(){let e=[];for(let t of Array.from(this.selectedIds)){let n=this.get(t);n&&e.push(n)}return e}focus(e,t={}){e&&(this.props.selectionFollowsFocus?this.select(e):(this.dispatch(H(Y(e))),t.scroll!==!1&&this.scrollTo(e),this.focusedNode&&J(this.props.onFocus,this.focusedNode)))}pageUp(){let e=this.visibleStartIndex,t=this.visibleStopIndex-e,n=this.focusedNode?.rowIndex??0;n=n>e?e:Math.max(e-t,0),this.focus(this.at(n))}pageDown(){let e=this.visibleStartIndex,t=this.visibleStopIndex,n=t-e,r=this.focusedNode?.rowIndex??0;r=r<t?t:Math.min(r+n,this.visibleNodes.length-1),this.focus(this.at(r))}select(e,t={}){if(!e)return;let n=t.focus!==!1,r=Y(e);n&&this.dispatch(H(r)),this.dispatch(W.only(r)),this.dispatch(W.anchor(r)),this.dispatch(W.mostRecent(r)),this.scrollTo(r,t.align),this.focusedNode&&n&&J(this.props.onFocus,this.focusedNode),J(this.props.onSelect,this.selectedNodes)}deselect(e){if(!e)return;let t=Y(e);this.dispatch(W.remove(t)),J(this.props.onSelect,this.selectedNodes)}selectMulti(e){let t=this.get(X(e));t&&(this.dispatch(H(t.id)),this.dispatch(W.add(t.id)),this.dispatch(W.anchor(t.id)),this.dispatch(W.mostRecent(t.id)),this.scrollTo(t),this.focusedNode&&J(this.props.onFocus,this.focusedNode),J(this.props.onSelect,this.selectedNodes))}selectContiguous(e){if(!e)return;let t=Y(e),{anchor:n,mostRecent:r}=this.state.nodes.selection;this.dispatch(H(t)),this.dispatch(W.remove(this.nodesBetween(n,r))),this.dispatch(W.add(this.nodesBetween(n,X(t)))),this.dispatch(W.mostRecent(t)),this.scrollTo(t),this.focusedNode&&J(this.props.onFocus,this.focusedNode),J(this.props.onSelect,this.selectedNodes)}deselectAll(){this.setSelection({ids:[],anchor:null,mostRecent:null}),J(this.props.onSelect,this.selectedNodes)}selectAll(){this.setSelection({ids:Object.keys(this.idToIndex),anchor:this.firstNode,mostRecent:this.lastNode}),this.dispatch(H(this.lastNode?.id)),this.focusedNode&&J(this.props.onFocus,this.focusedNode),J(this.props.onSelect,this.selectedNodes)}setSelection(e){let t=new Set(e.ids?.map(Y)),n=X(e.anchor),r=X(e.mostRecent);this.dispatch(W.set({ids:t,anchor:n,mostRecent:r})),J(this.props.onSelect,this.selectedNodes)}get cursorParentId(){let{cursor:e}=this.state.dnd;switch(e.type){case`highlight`:return e.id;default:return null}}get cursorOverFolder(){return this.state.dnd.cursor.type===`highlight`}get dragNodes(){return this.state.dnd.dragIds.map(e=>this.get(e)).filter(e=>!!e)}get dragNode(){return this.get(this.state.nodes.drag.id)}get dragDestinationParent(){return this.get(this.state.nodes.drag.destinationParentId)}get dragDestinationIndex(){return this.state.nodes.drag.destinationIndex}canDrop(){if(this.isFiltered)return!1;let e=this.get(this.state.dnd.parentId)??this.root,t=this.dragNodes,n=this.props.disableDrop;for(let n of t)if(!n||!e||n.isInternal&&Ar(e,n))return!1;return typeof n==`function`?!n({parentNode:e,dragNodes:this.dragNodes,index:this.state.dnd.index||0}):typeof n==`string`?!e.data[n]:typeof n!=`boolean`||!n}hideCursor(){this.dispatch(G.cursor({type:`none`}))}showCursor(e){this.dispatch(G.cursor(e))}open(e){let t=X(e);t&&(this.isOpen(t)||(this.dispatch(oi.open(t,this.isFiltered)),J(this.props.onToggle,t)))}close(e){let t=X(e);t&&this.isOpen(t)&&(this.dispatch(oi.close(t,this.isFiltered)),J(this.props.onToggle,t))}toggle(e){let t=X(e);if(t)return this.isOpen(t)?this.close(t):this.open(t)}openParents(e){let t=X(e);if(!t)return;let n=Nr(this.root,t)?.parent;for(;n;)this.open(n.id),n=n.parent}openSiblings(e){let t=e.parent;if(!t)this.toggle(e.id);else if(t.children){let n=e.isOpen;for(let e of t.children)e.isInternal&&(n?this.close(e.id):this.open(e.id));this.scrollTo(this.focusedNode)}}openAll(){z(this.root,e=>{e.isInternal&&e.open()})}closeAll(){z(this.root,e=>{e.isInternal&&e.close()})}scrollTo(e,t=`smart`){if(!e)return;let n=Y(e);return this.openParents(n),Hr(()=>n in this.idToIndex).then(()=>{var e;let r=this.idToIndex[n];r!==void 0&&((e=this.list.current)==null||e.scrollToItem(r,t))}).catch(()=>{})}get isEditing(){return this.state.nodes.edit.id!==null}get isFiltered(){return!!this.props.searchTerm?.trim()}get hasFocus(){return this.state.nodes.focus.treeFocused}get hasNoSelection(){return this.state.nodes.selection.ids.size===0}get hasOneSelection(){return this.state.nodes.selection.ids.size===1}get hasMultipleSelections(){return this.state.nodes.selection.ids.size>1}isSelected(e){return e?this.state.nodes.selection.ids.has(e):!1}isOpen(e){if(!e)return!1;if(e===`__REACT_ARBORIST_INTERNAL_ROOT__`)return!0;let t=this.props.openByDefault??!0;return this.isFiltered?this.state.nodes.open.filtered[e]??!0:this.state.nodes.open.unfiltered[e]??t}isEditable(e){return!B(e,this.props.disableEdit||(()=>!1))}isDraggable(e){return!B(e,this.props.disableDrag||(()=>!1))}isDragging(e){let t=X(e);return t?this.state.nodes.drag.id===t:!1}isFocused(e){return this.hasFocus&&this.state.nodes.focus.id===e}isMatch(e){return this.matchFn(e)}willReceiveDrop(e){let t=X(e);if(!t)return!1;let{destinationParentId:n,destinationIndex:r}=this.state.nodes.drag;return t===n&&r===null}onFocus(){let e=this.focusedNode||this.firstNode;e&&this.dispatch(H(e.id))}onBlur(){this.dispatch(ti())}onItemsRendered(e){this.visibleStartIndex=e.visibleStartIndex,this.visibleStopIndex=e.visibleStopIndex}get renderContainer(){return this.props.renderContainer||Qi}get renderRow(){return this.props.renderRow||Yr}get renderNode(){return this.props.children||Xr}get renderDragPreview(){return this.props.renderDragPreview||mi}get renderCursor(){return this.props.renderCursor||Jr}};function Z(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var oa=typeof Symbol==`function`&&Symbol.observable||`@@observable`,sa=()=>Math.random().toString(36).substring(7).split(``).join(`.`),ca={INIT:`@@redux/INIT${sa()}`,REPLACE:`@@redux/REPLACE${sa()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${sa()}`};function la(e){if(typeof e!=`object`||!e)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function ua(e,t,n){if(typeof e!=`function`)throw Error(Z(2));if(typeof t==`function`&&typeof n==`function`||typeof n==`function`&&typeof arguments[3]==`function`)throw Error(Z(0));if(typeof t==`function`&&n===void 0&&(n=t,t=void 0),n!==void 0){if(typeof n!=`function`)throw Error(Z(1));return n(ua)(e,t)}let r=e,i=t,a=new Map,o=a,s=0,c=!1;function l(){o===a&&(o=new Map,a.forEach((e,t)=>{o.set(t,e)}))}function u(){if(c)throw Error(Z(3));return i}function d(e){if(typeof e!=`function`)throw Error(Z(4));if(c)throw Error(Z(5));let t=!0;l();let n=s++;return o.set(n,e),function(){if(t){if(c)throw Error(Z(6));t=!1,l(),o.delete(n),a=null}}}function f(e){if(!la(e))throw Error(Z(7));if(e.type===void 0)throw Error(Z(8));if(typeof e.type!=`string`)throw Error(Z(17));if(c)throw Error(Z(9));try{c=!0,i=r(i,e)}finally{c=!1}return(a=o).forEach(e=>{e()}),e}function p(e){if(typeof e!=`function`)throw Error(Z(10));r=e,f({type:ca.REPLACE})}function m(){let e=d;return{subscribe(t){if(typeof t!=`object`||!t)throw Error(Z(11));function n(){let e=t;e.next&&e.next(u())}return n(),{unsubscribe:e(n)}},[oa](){return this}}}return f({type:ca.INIT}),{dispatch:f,subscribe:d,getState:u,replaceReducer:p,[oa]:m}}function da(e){Object.keys(e).forEach(t=>{let n=e[t];if(n(void 0,{type:ca.INIT})===void 0)throw Error(Z(12));if(n(void 0,{type:ca.PROBE_UNKNOWN_ACTION()})===void 0)throw Error(Z(13))})}function fa(e){let t=Object.keys(e),n={};for(let r=0;r<t.length;r++){let i=t[r];typeof e[i]==`function`&&(n[i]=e[i])}let r=Object.keys(n),i;try{da(n)}catch(e){i=e}return function(e={},t){if(i)throw i;let a=!1,o={};for(let i=0;i<r.length;i++){let s=r[i],c=n[s],l=e[s],u=c(l,t);if(u===void 0)throw t&&t.type,Error(Z(14));o[s]=u,a||=u!==l}return a||=r.length!==Object.keys(e).length,a?o:e}}function pa(e=U().nodes.drag,t){switch(t.type){case`DND_DRAG_START`:return Object.assign(Object.assign({},e),{id:t.id,selectedIds:t.dragIds});case`DND_DRAG_END`:return Object.assign(Object.assign({},e),{id:null,destinationParentId:null,destinationIndex:null,selectedIds:[]});case`DND_HOVERING`:return t.parentId!==e.destinationParentId||t.index!=e.destinationIndex?Object.assign(Object.assign({},e),{destinationParentId:t.parentId,destinationIndex:t.index}):e;default:return e}}var ma=fa({nodes:fa({focus:ni,edit:ei,open:ci,selection:li,drag:pa}),dnd:ui}),ha=U();function ga({treeProps:e,imperativeHandle:t,children:n}){let r=(0,x.useRef)(null),i=(0,x.useRef)(null),a=(0,x.useRef)(ua(ma,U(e))),o=(0,le.useSyncExternalStore)(a.current.subscribe,a.current.getState,()=>ha),s=(0,x.useMemo)(()=>new aa(a.current,e,r,i),[]),c=(0,x.useRef)(0);return(0,x.useMemo)(()=>{c.current+=1,s.update(e)},[...Object.values(e),o.nodes.open]),(0,x.useImperativeHandle)(t,()=>s),(0,x.useEffect)(()=>{s.props.selection?s.select(s.props.selection,{focus:!1}):s.deselectAll()},[s.props.selection]),(0,x.useEffect)(()=>{s.props.searchTerm||a.current.dispatch(oi.clear(!0))},[s.props.searchTerm]),(0,S.jsx)(yr.Provider,{value:s,children:(0,S.jsx)(wr.Provider,{value:c.current,children:(0,S.jsx)(br.Provider,{value:o.nodes,children:(0,S.jsx)(Sr.Provider,{value:o.dnd,children:(0,S.jsx)(tn,Object.assign({backend:vr,options:{rootElement:s.props.dndRootElement||void 0}},e.dndManager&&{manager:e.dndManager},{children:n}))})})})})}function _a(){let e=L(),[,t]=Wn(()=>({accept:`NODE`,canDrop:(t,n)=>n.isOver({shallow:!0})?e.canDrop():!1,hover:(t,n)=>{if(!n.isOver({shallow:!0}))return;let r=n.getClientOffset();if(!e.listEl.current||!r)return;let{cursor:i,drop:a}=Ki({element:e.listEl.current,offset:r,indent:e.indent,node:null,prevNode:e.visibleNodes[e.visibleNodes.length-1],nextNode:null});a&&e.dispatch(G.hovering(a.parentId,a.index)),n.canDrop()?i&&e.showCursor(i):e.hideCursor()}}),[e]);t(e.listEl)}function va(e){return _a(),e.children}function ya(){let e=L().props.renderContainer||Qi;return(0,S.jsx)(S.Fragment,{children:(0,S.jsx)(e,{})})}function ba(){let e=L(),{offset:t,mouse:n,item:r,isDragging:i}=In(e=>({offset:e.getSourceClientOffset(),mouse:e.getClientOffset(),item:e.getItem(),isDragging:e.isDragging()})),a=e.props.renderDragPreview||mi;return(0,S.jsx)(a,{offset:t,mouse:n,id:r?.id||null,dragIds:r?.dragIds||[],isDragging:i})}var xa=class{constructor(e){this.root=Sa(e)}get data(){return this.root.children?.map(e=>e.data)??[]}create(e){let t=e.parentId?this.find(e.parentId):this.root;if(!t)return null;t.addChild(e.data,e.index)}move(e){let t=this.find(e.id),n=e.parentId?this.find(e.parentId):this.root;!t||!n||(n.addChild(t.data,e.index),t.drop())}update(e){let t=this.find(e.id);t&&t.update(e.changes)}drop(e){let t=this.find(e.id);t&&t.drop()}find(e,t=this.root){if(!t)return null;if(t.id===e)return t;if(t.children){for(let n of t.children){let t=this.find(e,n);if(t)return t}return null}return null}};function Sa(e){let t=new wa({id:`ROOT`},null);return t.children=e.map(e=>Ca(e,t)),t}function Ca(e,t){let n=new wa(e,t);return e.children&&(n.children=e.children.map(e=>Ca(e,n))),n}var wa=class{constructor(e,t){this.data=e,this.parent=t,this.id=e.id}hasParent(){return!!this.parent}get childIndex(){return this.hasParent()?this.parent.children.indexOf(this):-1}addChild(e,t){let n=Ca(e,this);this.children=this.children??[],this.children.splice(t,0,n),this.data.children=this.data.children??[],this.data.children.splice(t,0,e)}removeChild(e){var t,n;(t=this.children)==null||t.splice(e,1),(n=this.data.children)==null||n.splice(e,1)}update(e){if(this.hasParent()){let t=this.childIndex;this.parent.addChild(Object.assign(Object.assign({},this.data),e),t),this.drop()}}drop(){this.hasParent()&&this.parent.removeChild(this.childIndex)}},Ta=0;function Ea(e){let[t,n]=(0,x.useState)(e),r=(0,x.useMemo)(()=>new xa(t),[t]);return[t,{onMove:e=>{for(let t of e.dragIds)r.move({id:t,parentId:e.parentId,index:e.index});n(r.data)},onRename:({name:e,id:t})=>{r.update({id:t,changes:{name:e}}),n(r.data)},onCreate:({parentId:e,index:t,type:i})=>{let a={id:`simple-tree-id-${Ta++}`,name:``};return i===`internal`&&(a.children=[]),r.create({parentId:e,index:t,data:a}),n(r.data),a},onDelete:e=>{e.ids.forEach(e=>r.drop({id:e})),n(r.data)}}]}function Da(e){if(e.initialData&&e.data)throw Error(`React Arborist Tree => Provide either a data or initialData prop, but not both.`);if(e.initialData&&(e.onCreate||e.onDelete||e.onMove||e.onRename))throw Error(`React Arborist Tree => You passed the initialData prop along with a data handler.
3
+ Use the data prop if you want to provide your own handlers.`);if(e.initialData){let[t,n]=Ea(e.initialData);return Object.assign(Object.assign(Object.assign({},e),n),{data:t})}return e}function Oa(e,t){let n=Da(e);return(0,S.jsxs)(ga,{treeProps:n,imperativeHandle:t,children:[(0,S.jsx)(va,{children:(0,S.jsx)(ya,{})}),(0,S.jsx)(ba,{})]})}var ka=(0,x.forwardRef)(Oa),Q=a(),Aa=5;function $(e){return e.success?e:(y({title:`Failed`,description:e.message}),null)}var ja=class{delegate=new xa([]);callbacks;constructor(e){this.callbacks=e}rootPath=``;onChange=o.NOOP;path=new ne(`/`);initialize=async e=>{if(this.onChange=e,this.delegate.data.length===0)try{let e=await this.callbacks.listFiles({path:this.rootPath});this.delegate=new xa(e.files),this.rootPath=e.root,this.path=ne.guessDeliminator(e.root)}catch(e){y({title:`Failed`,description:re(e)})}this.onChange(this.delegate.data)};async expand(e){let t=this.delegate.find(e);if(!t||!t.data.isDirectory)return!1;if(t.children&&t.children.length>0)return!0;let n=await this.callbacks.listFiles({path:t.data.path});return this.delegate.update({id:e,changes:{children:n.files}}),this.onChange(this.delegate.data),!0}async copy(e,t){let n=this.delegate.find(e);if(!n){y({title:`Failed`,description:`Node with id ${e} not found in the tree`});return}let{path:r,newPath:i}=b({path:n.data.path,name:t,root:this.rootPath}),a=this.path.dirname(r),o=await this.callbacks.copyFileOrFolder({path:r,newPath:i}).then($);o?.info&&(this.delegate.create({parentId:n.parent?.id??null,index:0,data:o.info}),this.onChange(this.delegate.data),await this.refreshAll([a]))}async rename(e,t){let n=this.delegate.find(e);if(!n){y({title:`Failed`,description:`Node with id ${e} not found in the tree`});return}let{path:r,newPath:i}=b({path:n.data.path,name:t,root:this.rootPath});await this.callbacks.renameFileOrFolder({path:r,newPath:i}).then($)&&(this.delegate.update({id:e,changes:{name:t,path:i}}),this.onChange(this.delegate.data),await this.refreshAll([i]))}async move(e,t){let n=t?this.delegate.find(t)?.data.path??t:this.rootPath;await se(e,Aa,async e=>{let r=this.delegate.find(e);if(!r)return;let i=r.data.path,a=this.path.join(n,this.path.basename(i));await this.callbacks.renameFileOrFolder({path:i,newPath:a}).then($)&&(this.delegate.move({id:e,parentId:t,index:0}),this.delegate.update({id:e,changes:{path:a}}))}),this.onChange(this.delegate.data),await this.refreshAll([n])}async createFile({name:e,parentId:t,type:n=`file`}){let r=t?this.delegate.find(t)?.data.path??t:this.rootPath,i=await this.callbacks.createFileOrFolder({path:r,type:n,name:e}).then($);i?.info&&(this.delegate.create({parentId:t,index:0,data:i.info}),this.onChange(this.delegate.data),await this.refreshAll([r]))}async createFolder(e,t){let n=t?this.delegate.find(t)?.data.path??t:this.rootPath,r=await this.callbacks.createFileOrFolder({path:n,type:`directory`,name:e}).then($);r?.info&&(this.delegate.create({parentId:t,index:0,data:r.info}),this.onChange(this.delegate.data),await this.refreshAll([n]))}async delete(e){let t=this.delegate.find(e);if(!t){y({title:`Failed`,description:`Node with id ${e} not found in the tree`});return}await this.callbacks.deleteFileOrFolder({path:t.data.path}).then($)&&(this.delegate.drop({id:e}),this.onChange(this.delegate.data))}refreshAll=async e=>{let t=[this.rootPath,...e.map(e=>this.delegate.find(e)?.data.path)].filter(Boolean),n=await se(t,Aa,e=>this.callbacks.listFiles({path:e}).catch(()=>({files:[]})));for(let[e,r]of t.entries()){let t=n[e];r===this.rootPath?this.delegate=new xa(t.files):this.delegate.update({id:r,changes:{children:t.files}})}this.onChange(this.delegate.data)};relativeFromRoot=e=>{let t=this.rootPath.endsWith(this.path.deliminator)?this.rootPath:`${this.rootPath}${this.path.deliminator}`;return e.startsWith(t)?e.slice(t.length):e}};function Ma(e){let t=(0,Q.c)(13),{root:n}=e,{sendRenameFileOrFolder:r,sendCopyFileOrFolder:i,sendDeleteFileOrFolder:a}=m(),o;t[0]!==n||t[1]!==r?(o=async(e,t)=>{let{path:i,newPath:a}=b({path:e.path,name:t,root:n});return $(await r({path:i,newPath:a}))},t[0]=n,t[1]=r,t[2]=o):o=t[2];let s=o,c;t[3]!==n||t[4]!==i?(c=async e=>{let{path:t,newPath:r}=b({path:e.path,name:oe(e.name),root:n});return $(await i({path:t,newPath:r}))},t[3]=n,t[4]=i,t[5]=c):c=t[5];let l=c,u;t[6]!==n||t[7]!==a?(u=async e=>$(await a({path:ae(e.path,n)})),t[6]=n,t[7]=a,t[8]=u):u=t[8];let d=u,f;return t[9]!==d||t[10]!==l||t[11]!==s?(f={renameFile:s,duplicateFile:l,deleteFile:d},t[9]=d,t[10]=l,t[11]=s,t[12]=f):f=t[12],f}var Na={file:`Delete file`,folder:`Delete folder`,notebook:`Delete notebook`};function Pa(){let e=(0,Q.c)(2),{openConfirm:t}=ee(),n;return e[0]===t?n=e[1]:(n=(e,n)=>{let r=e.kind??`file`;t({title:Na[r],description:`Are you sure you want to delete ${e.name}?`,confirmAction:(0,S.jsx)(c,{onClick:async()=>{await n()},"aria-label":`Confirm`,children:`Delete`})})},e[0]=t,e[1]=n),n}function Fa(e){let t=(0,Q.c)(17),{node:n,root:i,onAfterChange:a}=e,o;t[0]===i?o=t[1]:(o={root:i},t[0]=i,t[1]=o);let{duplicateFile:s,deleteFile:c}=Ma(o),l=Pa(),u;t[2]===n?u=t[3]:(u=()=>{n.edit()},t[2]=n,t[3]=u);let d=r(u),f;t[4]!==s||t[5]!==n.data||t[6]!==a?(f=async()=>{await s(n.data)&&a?.()},t[4]=s,t[5]=n.data,t[6]=a,t[7]=f):f=t[7];let p=r(f),m;t[8]!==l||t[9]!==c||t[10]!==n.data||t[11]!==a?(m=()=>{let e=n.data.isDirectory?`folder`:n.data.isMarimoFile?`notebook`:`file`;l({name:n.data.name,kind:e},async()=>{await c(n.data)&&a?.()})},t[8]=l,t[9]=c,t[10]=n.data,t[11]=a,t[12]=m):m=t[12];let h=r(m),g;return t[13]!==h||t[14]!==p||t[15]!==d?(g={handleRename:d,handleDuplicate:p,handleDelete:h},t[13]=h,t[14]=p,t[15]=d,t[16]=g):g=t[16],g}var Ia=e=>{let t=(0,Q.c)(15),{testId:n,buttonClassName:r,iconClassName:i,contentClassName:a,preventDefaultOnTrigger:o,children:s}=e,c=o!==void 0&&o,l;t[0]===c?l=t[1]:(l=e=>{e.stopPropagation(),c&&e.preventDefault()},t[0]=c,t[1]=l);let u;t[2]!==r||t[3]!==i||t[4]!==n?(u=(0,S.jsx)(g,{"data-testid":n,className:r,iconClassName:i}),t[2]=r,t[3]=i,t[4]=n,t[5]=u):u=t[5];let m;t[6]!==l||t[7]!==u?(m=(0,S.jsx)(d,{asChild:!0,tabIndex:-1,onClick:l,children:u}),t[6]=l,t[7]=u,t[8]=m):m=t[8];let h=a??`print:hidden w-[220px]`,_;t[9]!==s||t[10]!==h?(_=(0,S.jsx)(f,{align:`end`,className:h,onClick:Ba,onCloseAutoFocus:Va,children:s}),t[9]=s,t[10]=h,t[11]=_):_=t[11];let v;return t[12]!==m||t[13]!==_?(v=(0,S.jsxs)(p,{modal:!1,children:[m,_]}),t[12]=m,t[13]=_,t[14]=v):v=t[14],v},La=e=>{let t=(0,Q.c)(6),{onSelect:n,disabled:r,title:i,testId:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,S.jsx)(ce,{className:_}),t[0]=o):o=t[0];let s;return t[1]!==r||t[2]!==n||t[3]!==a||t[4]!==i?(s=(0,S.jsxs)(u,{onSelect:n,disabled:r,title:i,"data-testid":a,children:[o,`Rename`]}),t[1]=r,t[2]=n,t[3]=a,t[4]=i,t[5]=s):s=t[5],s},Ra=e=>{let t=(0,Q.c)(6),{onSelect:n,disabled:r,title:i,testId:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,S.jsx)(v,{className:_}),t[0]=o):o=t[0];let s;return t[1]!==r||t[2]!==n||t[3]!==a||t[4]!==i?(s=(0,S.jsxs)(u,{onSelect:n,disabled:r,title:i,"data-testid":a,children:[o,`Duplicate`]}),t[1]=r,t[2]=n,t[3]=a,t[4]=i,t[5]=s):s=t[5],s},za=e=>{let t=(0,Q.c)(6),{onSelect:n,disabled:r,title:i,testId:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,S.jsx)(te,{className:_}),t[0]=o):o=t[0];let s;return t[1]!==r||t[2]!==n||t[3]!==a||t[4]!==i?(s=(0,S.jsxs)(u,{onSelect:n,variant:`danger`,disabled:r,title:i,"data-testid":a,children:[o,`Delete`]}),t[1]=r,t[2]=n,t[3]=a,t[4]=i,t[5]=s):s=t[5],s};function Ba(e){return e.stopPropagation()}function Va(e){return e.preventDefault()}var Ha=e=>{let t=(0,Q.c)(10),{node:n}=e,r=(0,x.useRef)(null),i,a;t[0]===n.data.name?(i=t[1],a=t[2]):(i=()=>{r.current?.focus();let e=n.data.name,t=e.lastIndexOf(`.`),i=t>0?t:e.length;r.current?.setSelectionRange(0,i)},a=[n.data.name],t[0]=n.data.name,t[1]=i,t[2]=a),(0,x.useEffect)(i,a);let o,s;t[3]===n?(o=t[4],s=t[5]):(o=()=>n.reset(),s=e=>{e.key===`Escape`&&n.reset(),e.key===`Enter`&&n.submit(e.currentTarget.value)},t[3]=n,t[4]=o,t[5]=s);let c;return t[6]!==n.data.name||t[7]!==o||t[8]!==s?(c=(0,S.jsx)(`input`,{ref:r,className:`flex-1 bg-transparent border border-border text-muted-foreground`,defaultValue:n.data.name,onClick:Ua,onBlur:o,onKeyDown:s}),t[6]=n.data.name,t[7]=o,t[8]=s,t[9]=c):c=t[9],c};function Ua(e){return e.stopPropagation()}export{La as a,ja as c,P as d,tn as f,Ia as i,ka as l,za as n,Ma as o,Ra as r,Fa as s,Ha as t,vr as u};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{l as t}from"./useEvent-xfs0Sn4r.js";import{t as n}from"./react-CBDbhulC.js";import{ft as r,x as i}from"./cells-BdoPd1mK.js";import{t as a}from"./compiler-runtime-CYIjoINj.js";import{g as o}from"./useEventListener-D27Dii_l.js";import{E as s}from"./config-CUBl5qBg.js";import{t as c}from"./cn-ldLVeaqm.js";import{t as l}from"./jsx-runtime-B74pBk57.js";var u=a(),d=e(n(),1);function f(){return s()===`edit`?document.getElementById(`App`):void 0}function p(e){let t=(0,u.c)(7),[n,i]=(0,d.useState)(void 0),[a,o]=(0,d.useState)(void 0),s=(0,d.useRef)(null),c=(0,d.useRef)(null),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=new Map,t[0]=l):l=t[0];let p=(0,d.useRef)(l),h,g;t[1]===e?(h=t[2],g=t[3]):(h=()=>e.length===0?void 0:(s.current=new IntersectionObserver(e=>{let t=!1;if(e.forEach(e=>{let n=e.target;e.isIntersecting?(!c.current||n.getBoundingClientRect().top<c.current.getBoundingClientRect().top)&&(c.current=n,t=!0):n===c.current&&(c.current=null,t=!0)}),t&&c.current){let e=r(c.current),t=`id`in e?e.id:e.path;i(t),o(p.current.get(c.current))}},{root:f(),rootMargin:`0px`,threshold:0}),e.forEach(t=>{if(t){let n=r(t[0]),i=e.map(m).filter(e=>`id`in n?e.id===n.id:e.textContent===t[0].textContent).indexOf(t[0]);p.current.set(t[0],i),s.current?.observe(t[0])}}),()=>{s.current&&s.current.disconnect(),c.current=null}),g=[e],t[1]=e,t[2]=h,t[3]=g),(0,d.useEffect)(h,g);let _;return t[4]!==n||t[5]!==a?(_={activeHeaderId:n,activeOccurrences:a},t[4]=n,t[5]=a,t[6]=_):_=t[6],_}function m(e){let[t]=e;return t}function h(e){if(e.length===0)return[];let t=new Map;return e.map(e=>{let n=`id`in e.by?e.by.id:e.by.path,r=t.get(n)??0;t.set(n,r+1);let i=_(e,r);return i?[i,n]:null}).filter(Boolean)}function g(e,t){let n=_(e,t);if(!n){o.warn(`Could not find element for outline item`,e);return}n.scrollIntoView({behavior:`smooth`,block:`start`}),n.classList.add(`outline-item-highlight`),setTimeout(()=>{n.classList.remove(`outline-item-highlight`)},3e3)}function _(e,t){return`id`in e.by?document.querySelectorAll(`[id="${CSS.escape(e.by.id)}"]`)[t]:document.evaluate(e.by.path,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue}var v=l(),y=()=>{let e=(0,u.c)(19),{items:n}=t(i),r;e[0]===n?r=e[1]:(r=h(n),e[0]=n,e[1]=r);let{activeHeaderId:a,activeOccurrences:o}=p(r),[s,l]=d.useState(!1);if(n.length<2)return null;let f,m,g;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>l(!0),m=()=>l(!1),g=c(`fixed top-[25vh] right-8 z-10000 print:hidden`,`hidden md:block`),e[2]=f,e[3]=m,e[4]=g):(f=e[2],m=e[3],g=e[4]);let _=s?`left-[-280px] opacity-100`:`left-[300px] opacity-0`,y;e[5]===_?y=e[6]:(y=c(`-top-4 max-h-[70vh] bg-background rounded-lg shadow-lg absolute overflow-auto transition-all duration-300 w-[300px] border`,_),e[5]=_,e[6]=y);let S;e[7]!==a||e[8]!==o||e[9]!==n||e[10]!==y?(S=(0,v.jsx)(x,{className:y,items:n,activeHeaderId:a,activeOccurrences:o}),e[7]=a,e[8]=o,e[9]=n,e[10]=y,e[11]=S):S=e[11];let C;e[12]!==a||e[13]!==o||e[14]!==n?(C=(0,v.jsx)(b,{items:n,activeHeaderId:a,activeOccurrences:o}),e[12]=a,e[13]=o,e[14]=n,e[15]=C):C=e[15];let w;return e[16]!==S||e[17]!==C?(w=(0,v.jsxs)(`div`,{onMouseEnter:f,onMouseLeave:m,className:g,children:[S,C]}),e[16]=S,e[17]=C,e[18]=w):w=e[18],w},b=e=>{let t=(0,u.c)(8),{items:n,activeHeaderId:r,activeOccurrences:i}=e,a,o;if(t[0]!==r||t[1]!==i||t[2]!==n){let e=new Map;a=`flex flex-col gap-4 items-end max-h-[70vh] overflow-hidden`,o=n.map((t,n)=>{let a=`id`in t.by?t.by.id:t.by.path,o=e.get(a)??0;return e.set(a,o+1),(0,v.jsx)(`div`,{className:c(`h-[2px] bg-muted-foreground/60`,t.level===1&&`w-5`,t.level===2&&`w-4`,t.level===3&&`w-3`,t.level===4&&`w-2`,o===i&&r===a&&`bg-foreground`),onClick:()=>g(t,o)},`${a}-${n}`)}),t[0]=r,t[1]=i,t[2]=n,t[3]=a,t[4]=o}else a=t[3],o=t[4];let s;return t[5]!==a||t[6]!==o?(s=(0,v.jsx)(`div`,{className:a,children:o}),t[5]=a,t[6]=o,t[7]=s):s=t[7],s},x=e=>{let t=(0,u.c)(11),{items:n,activeHeaderId:r,activeOccurrences:i,className:a}=e,o,s;if(t[0]!==r||t[1]!==i||t[2]!==a||t[3]!==n){let e=new Map;t[6]===a?o=t[7]:(o=c(`flex flex-col overflow-auto py-4 pl-2`,a),t[6]=a,t[7]=o),s=n.map((t,n)=>{let a=`id`in t.by?t.by.id:t.by.path,o=e.get(a)??0;e.set(a,o+1);let s=`${a}-${n}`,l={className:c(`px-2 py-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l`,t.level===1&&`font-semibold`,t.level===2&&`ml-3`,t.level===3&&`ml-6`,t.level===4&&`ml-9`,o===i&&r===a&&`text-accent-foreground`),onClick:()=>g(t,o)};return t.html?(0,v.jsx)(`div`,{...l,dangerouslySetInnerHTML:{__html:t.html}},s):(0,v.jsx)(`div`,{...l,children:t.name},s)}),t[0]=r,t[1]=i,t[2]=a,t[3]=n,t[4]=o,t[5]=s}else o=t[4],s=t[5];let l;return t[8]!==o||t[9]!==s?(l=(0,v.jsx)(`div`,{className:o,children:s}),t[8]=o,t[9]=s,t[10]=l):l=t[10],l};export{p as i,x as n,h as r,y as t};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{l as t}from"./useEvent-xfs0Sn4r.js";import{t as n}from"./react-CBDbhulC.js";import{ft as r,x as i}from"./cells-B1S_6FG3.js";import{t as a}from"./compiler-runtime-CYIjoINj.js";import{g as o}from"./useEventListener-D27Dii_l.js";import{E as s}from"./config-CUBl5qBg.js";import{t as c}from"./cn-ldLVeaqm.js";import{t as l}from"./jsx-runtime-B74pBk57.js";var u=a(),d=e(n(),1);function f(){return s()===`edit`?document.getElementById(`App`):void 0}function p(e){let t=(0,u.c)(7),[n,i]=(0,d.useState)(void 0),[a,o]=(0,d.useState)(void 0),s=(0,d.useRef)(null),c=(0,d.useRef)(null),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=new Map,t[0]=l):l=t[0];let p=(0,d.useRef)(l),h,g;t[1]===e?(h=t[2],g=t[3]):(h=()=>e.length===0?void 0:(s.current=new IntersectionObserver(e=>{let t=!1;if(e.forEach(e=>{let n=e.target;e.isIntersecting?(!c.current||n.getBoundingClientRect().top<c.current.getBoundingClientRect().top)&&(c.current=n,t=!0):n===c.current&&(c.current=null,t=!0)}),t&&c.current){let e=r(c.current),t=`id`in e?e.id:e.path;i(t),o(p.current.get(c.current))}},{root:f(),rootMargin:`0px`,threshold:0}),e.forEach(t=>{if(t){let n=r(t[0]),i=e.map(m).filter(e=>`id`in n?e.id===n.id:e.textContent===t[0].textContent).indexOf(t[0]);p.current.set(t[0],i),s.current?.observe(t[0])}}),()=>{s.current&&s.current.disconnect(),c.current=null}),g=[e],t[1]=e,t[2]=h,t[3]=g),(0,d.useEffect)(h,g);let _;return t[4]!==n||t[5]!==a?(_={activeHeaderId:n,activeOccurrences:a},t[4]=n,t[5]=a,t[6]=_):_=t[6],_}function m(e){let[t]=e;return t}function h(e){if(e.length===0)return[];let t=new Map;return e.map(e=>{let n=`id`in e.by?e.by.id:e.by.path,r=t.get(n)??0;t.set(n,r+1);let i=_(e,r);return i?[i,n]:null}).filter(Boolean)}function g(e,t){let n=_(e,t);if(!n){o.warn(`Could not find element for outline item`,e);return}n.scrollIntoView({behavior:`smooth`,block:`start`}),n.classList.add(`outline-item-highlight`),setTimeout(()=>{n.classList.remove(`outline-item-highlight`)},3e3)}function _(e,t){return`id`in e.by?document.querySelectorAll(`[id="${CSS.escape(e.by.id)}"]`)[t]:document.evaluate(e.by.path,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue}var v=l(),y=()=>{let e=(0,u.c)(19),{items:n}=t(i),r;e[0]===n?r=e[1]:(r=h(n),e[0]=n,e[1]=r);let{activeHeaderId:a,activeOccurrences:o}=p(r),[s,l]=d.useState(!1);if(n.length<2)return null;let f,m,g;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>l(!0),m=()=>l(!1),g=c(`fixed top-[25vh] right-8 z-10000 print:hidden`,`hidden md:block`),e[2]=f,e[3]=m,e[4]=g):(f=e[2],m=e[3],g=e[4]);let _=s?`left-[-280px] opacity-100`:`left-[300px] opacity-0`,y;e[5]===_?y=e[6]:(y=c(`-top-4 max-h-[70vh] bg-background rounded-lg shadow-lg absolute overflow-auto transition-all duration-300 w-[300px] border`,_),e[5]=_,e[6]=y);let S;e[7]!==a||e[8]!==o||e[9]!==n||e[10]!==y?(S=(0,v.jsx)(x,{className:y,items:n,activeHeaderId:a,activeOccurrences:o}),e[7]=a,e[8]=o,e[9]=n,e[10]=y,e[11]=S):S=e[11];let C;e[12]!==a||e[13]!==o||e[14]!==n?(C=(0,v.jsx)(b,{items:n,activeHeaderId:a,activeOccurrences:o}),e[12]=a,e[13]=o,e[14]=n,e[15]=C):C=e[15];let w;return e[16]!==S||e[17]!==C?(w=(0,v.jsxs)(`div`,{onMouseEnter:f,onMouseLeave:m,className:g,children:[S,C]}),e[16]=S,e[17]=C,e[18]=w):w=e[18],w},b=e=>{let t=(0,u.c)(8),{items:n,activeHeaderId:r,activeOccurrences:i}=e,a,o;if(t[0]!==r||t[1]!==i||t[2]!==n){let e=new Map;a=`flex flex-col gap-4 items-end max-h-[70vh] overflow-hidden`,o=n.map((t,n)=>{let a=`id`in t.by?t.by.id:t.by.path,o=e.get(a)??0;return e.set(a,o+1),(0,v.jsx)(`div`,{className:c(`h-[2px] bg-muted-foreground/60`,t.level===1&&`w-5`,t.level===2&&`w-4`,t.level===3&&`w-3`,t.level===4&&`w-2`,o===i&&r===a&&`bg-foreground`),onClick:()=>g(t,o)},`${a}-${n}`)}),t[0]=r,t[1]=i,t[2]=n,t[3]=a,t[4]=o}else a=t[3],o=t[4];let s;return t[5]!==a||t[6]!==o?(s=(0,v.jsx)(`div`,{className:a,children:o}),t[5]=a,t[6]=o,t[7]=s):s=t[7],s},x=e=>{let t=(0,u.c)(11),{items:n,activeHeaderId:r,activeOccurrences:i,className:a}=e,o,s;if(t[0]!==r||t[1]!==i||t[2]!==a||t[3]!==n){let e=new Map;t[6]===a?o=t[7]:(o=c(`flex flex-col overflow-auto py-4 pl-2`,a),t[6]=a,t[7]=o),s=n.map((t,n)=>{let a=`id`in t.by?t.by.id:t.by.path,o=e.get(a)??0;e.set(a,o+1);let s=`${a}-${n}`,l={className:c(`px-2 py-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l`,t.level===1&&`font-semibold`,t.level===2&&`ml-3`,t.level===3&&`ml-6`,t.level===4&&`ml-9`,o===i&&r===a&&`text-accent-foreground`),onClick:()=>g(t,o)};return t.html?(0,v.jsx)(`div`,{...l,dangerouslySetInnerHTML:{__html:t.html}},s):(0,v.jsx)(`div`,{...l,children:t.name},s)}),t[0]=r,t[1]=i,t[2]=a,t[3]=n,t[4]=o,t[5]=s}else o=t[4],s=t[5];let l;return t[8]!==o||t[9]!==s?(l=(0,v.jsx)(`div`,{className:o,children:s}),t[8]=o,t[9]=s,t[10]=l):l=t[10],l};export{p as i,x as n,h as r,y as t};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{t}from"./react-CBDbhulC.js";import{t as n}from"./compiler-runtime-CYIjoINj.js";import{t as r}from"./ErrorBoundary-TUuUdxHz.js";import{t as i}from"./jsx-runtime-B74pBk57.js";import{r as a}from"./requests-C6_IaFh7.js";import{t as o}from"./spinner-Ck-Hgfvj.js";import{dt as s,r as c}from"./input-BuOxQ3Wy.js";import{n as l,t as u}from"./paths-zcL04qUW.js";import{c as d,t as f}from"./session-CEdta5_Q.js";import{a as p}from"./errors-DzO-nXy-.js";import{t as m}from"./error-banner-B3KYUlCX.js";import{n as h}from"./useAsyncData-Buhk-UgR.js";import{n as g,t as _}from"./card-dYXwy2mo.js";var v=n(),y=e(t(),1),b=i(),x=e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase(),S=e=>{let t=u.guessDeliminator(e).deliminator;return e.replace(/\.[^./]+$/,``).split(t).filter(Boolean).map(e=>e.split(/[_-]/).map(x).join(` `)).join(` > `)},C=e=>`${f()}-${encodeURIComponent(e)}`,w=e=>{try{return new URL(e).protocol===`https:`}catch{return!1}},T=10,E=()=>{let e=(0,v.c)(32),{getWorkspaceFiles:t}=a(),[n,i]=(0,y.useState)(``),u;e[0]===t?u=e[1]:(u=()=>t({includeMarkdown:!1}),e[0]=t,e[1]=u);let f;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=[],e[2]=f):f=e[2];let g=h(u,f),_=g.data;_?.files,_?.root;let x;e[3]===_?.files?x=e[4]:(x=_?.files??[],e[3]=_?.files,e[4]=x);let C=x,E=_?.root??``,A;if(e[5]!==C||e[6]!==E){let t;e[8]===E?t=e[9]:(t=e=>{let t=E&&l.isAbsolute(e.path)&&e.path.startsWith(E)?l.rest(e.path,E):e.path,n=e.opengraph?.title??S(l.basename(t)),r=S(l.dirname(t)),i=e.opengraph?.description??``,a=e.opengraph?.image,o=a&&w(a)?a:d(`og/thumbnail?file=${encodeURIComponent(t)}`).toString();return{...e,relativePath:t,title:n,subtitle:r,description:i,thumbnailUrl:o}},e[8]=E,e[9]=t),A=C.filter(D).map(t).toSorted(O),e[5]=C,e[6]=E,e[7]=A}else A=e[7];let j=A,M;bb0:{if(!n){M=j;break bb0}let t;if(e[10]!==j||e[11]!==n){let r=n.toLowerCase();t=j.filter(e=>e.title.toLowerCase().includes(r)),e[10]=j,e[11]=n,e[12]=t}else t=e[12];M=t}let N=M;if(g.isPending){let t;return e[13]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,b.jsx)(o,{centered:!0,size:`xlarge`,className:`mt-6`}),e[13]=t):t=e[13],t}if(g.error){let t;e[14]===g.error?t=e[15]:(t=p(g.error),e[14]=g.error,e[15]=t);let n;return e[16]===t?n=e[17]:(n=(0,b.jsx)(m,{kind:`danger`,className:`rounded p-4`,children:t}),e[16]=t,e[17]=n),n}if(!_){let t;return e[18]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,b.jsx)(o,{centered:!0,size:`xlarge`,className:`mt-6`}),e[18]=t):t=e[18],t}let P;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,b.jsx)(`img`,{src:`logo.png`,alt:`marimo logo`,className:`w-48 mb-2`}),e[19]=P):P=e[19];let F;e[20]!==_.fileCount||e[21]!==_.hasMore?(F=_.hasMore&&(0,b.jsxs)(m,{kind:`warn`,className:`rounded p-4`,children:[`Showing first `,_.fileCount,` files. Your workspace has more files.`]}),e[20]=_.fileCount,e[21]=_.hasMore,e[22]=F):F=e[22];let I;e[23]!==j.length||e[24]!==n?(I=j.length>T&&(0,b.jsx)(c,{id:`search`,value:n,icon:(0,b.jsx)(s,{className:`h-4 w-4`}),onChange:e=>i(e.target.value),placeholder:`Search`,rootClassName:`mb-3`,className:`mb-0 border-border`}),e[23]=j.length,e[24]=n,e[25]=I):I=e[25];let L;e[26]===N?L=e[27]:(L=N.length===0?(0,b.jsx)(m,{kind:`warn`,className:`rounded p-4`,children:`No marimo apps found.`}):(0,b.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4`,children:N.map(k)}),e[26]=N,e[27]=L);let R;return e[28]!==F||e[29]!==I||e[30]!==L?(R=(0,b.jsx)(y.Suspense,{children:(0,b.jsxs)(`div`,{className:`flex flex-col gap-6 max-w-6xl container pt-5 pb-20 z-10`,children:[P,(0,b.jsx)(r,{children:(0,b.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[F,I,L]})})]})}),e[28]=F,e[29]=I,e[30]=L,e[31]=R):R=e[31],R};function D(e){return!e.isDirectory}function O(e,t){return e.relativePath.localeCompare(t.relativePath)}function k(e){return(0,b.jsx)(`a`,{href:d(`?file=${encodeURIComponent(e.relativePath)}`).toString(),target:C(e.path),className:`no-underline`,children:(0,b.jsxs)(_,{className:`h-full overflow-hidden hover:bg-accent/20 transition-colors`,children:[(0,b.jsx)(`img`,{src:e.thumbnailUrl,alt:e.title,loading:`lazy`,className:`w-full aspect-1200/630 object-cover border-b border-border/60`}),(0,b.jsx)(g,{className:`p-6 pt-4`,children:(0,b.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e.subtitle&&(0,b.jsx)(`div`,{className:`text-sm font-semibold text-muted-foreground`,children:e.subtitle}),(0,b.jsx)(`div`,{className:`text-lg font-medium`,children:e.title}),e.description&&(0,b.jsx)(`div`,{className:`text-sm text-muted-foreground line-clamp-3 mt-1`,children:e.description})]})})]})},e.path)}export{E as default};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{t}from"./react-CBDbhulC.js";import{t as n}from"./compiler-runtime-CYIjoINj.js";import{t as r}from"./ErrorBoundary-TUuUdxHz.js";import{t as i}from"./jsx-runtime-B74pBk57.js";import{r as a}from"./requests-C6_IaFh7.js";import{t as o}from"./spinner-Ck-Hgfvj.js";import{Wt as s,r as c}from"./input-DeyycFtq.js";import{n as l,t as u}from"./paths-zcL04qUW.js";import{c as d,t as f}from"./session-CEdta5_Q.js";import{n as p}from"./useAsyncData-Buhk-UgR.js";import{a as m}from"./errors-DzO-nXy-.js";import{t as h}from"./error-banner-B3KYUlCX.js";import{n as g,t as _}from"./card-dYXwy2mo.js";var v=n(),y=e(t(),1),b=i(),x=e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase(),S=e=>{let t=u.guessDeliminator(e).deliminator;return e.replace(/\.[^./]+$/,``).split(t).filter(Boolean).map(e=>e.split(/[_-]/).map(x).join(` `)).join(` > `)},C=e=>`${f()}-${encodeURIComponent(e)}`,w=e=>{try{return new URL(e).protocol===`https:`}catch{return!1}},T=10,E=()=>{let e=(0,v.c)(32),{getWorkspaceFiles:t}=a(),[n,i]=(0,y.useState)(``),u;e[0]===t?u=e[1]:(u=()=>t({includeMarkdown:!1}),e[0]=t,e[1]=u);let f;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=[],e[2]=f):f=e[2];let g=p(u,f),_=g.data;_?.files,_?.root;let x;e[3]===_?.files?x=e[4]:(x=_?.files??[],e[3]=_?.files,e[4]=x);let C=x,E=_?.root??``,A;if(e[5]!==C||e[6]!==E){let t;e[8]===E?t=e[9]:(t=e=>{let t=E&&l.isAbsolute(e.path)&&e.path.startsWith(E)?l.rest(e.path,E):e.path,n=e.opengraph?.title??S(l.basename(t)),r=S(l.dirname(t)),i=e.opengraph?.description??``,a=e.opengraph?.image,o=a&&w(a)?a:d(`og/thumbnail?file=${encodeURIComponent(t)}`).toString();return{...e,relativePath:t,title:n,subtitle:r,description:i,thumbnailUrl:o}},e[8]=E,e[9]=t),A=C.filter(D).map(t).toSorted(O),e[5]=C,e[6]=E,e[7]=A}else A=e[7];let j=A,M;bb0:{if(!n){M=j;break bb0}let t;if(e[10]!==j||e[11]!==n){let r=n.toLowerCase();t=j.filter(e=>e.title.toLowerCase().includes(r)),e[10]=j,e[11]=n,e[12]=t}else t=e[12];M=t}let N=M;if(g.isPending){let t;return e[13]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,b.jsx)(o,{centered:!0,size:`xlarge`,className:`mt-6`}),e[13]=t):t=e[13],t}if(g.error){let t;e[14]===g.error?t=e[15]:(t=m(g.error),e[14]=g.error,e[15]=t);let n;return e[16]===t?n=e[17]:(n=(0,b.jsx)(h,{kind:`danger`,className:`rounded p-4`,children:t}),e[16]=t,e[17]=n),n}if(!_){let t;return e[18]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,b.jsx)(o,{centered:!0,size:`xlarge`,className:`mt-6`}),e[18]=t):t=e[18],t}let P;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,b.jsx)(`img`,{src:`logo.png`,alt:`marimo logo`,className:`w-48 mb-2`}),e[19]=P):P=e[19];let F;e[20]!==_.fileCount||e[21]!==_.hasMore?(F=_.hasMore&&(0,b.jsxs)(h,{kind:`warn`,className:`rounded p-4`,children:[`Showing first `,_.fileCount,` files. Your workspace has more files.`]}),e[20]=_.fileCount,e[21]=_.hasMore,e[22]=F):F=e[22];let I;e[23]!==j.length||e[24]!==n?(I=j.length>T&&(0,b.jsx)(c,{id:`search`,value:n,icon:(0,b.jsx)(s,{className:`h-4 w-4`}),onChange:e=>i(e.target.value),placeholder:`Search`,rootClassName:`mb-3`,className:`mb-0 border-border`}),e[23]=j.length,e[24]=n,e[25]=I):I=e[25];let L;e[26]===N?L=e[27]:(L=N.length===0?(0,b.jsx)(h,{kind:`warn`,className:`rounded p-4`,children:`No marimo apps found.`}):(0,b.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4`,children:N.map(k)}),e[26]=N,e[27]=L);let R;return e[28]!==F||e[29]!==I||e[30]!==L?(R=(0,b.jsx)(y.Suspense,{children:(0,b.jsxs)(`div`,{className:`flex flex-col gap-6 max-w-6xl container pt-5 pb-20 z-10`,children:[P,(0,b.jsx)(r,{children:(0,b.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[F,I,L]})})]})}),e[28]=F,e[29]=I,e[30]=L,e[31]=R):R=e[31],R};function D(e){return!e.isDirectory}function O(e,t){return e.relativePath.localeCompare(t.relativePath)}function k(e){return(0,b.jsx)(`a`,{href:d(`?file=${encodeURIComponent(e.relativePath)}`).toString(),target:C(e.path),className:`no-underline`,children:(0,b.jsxs)(_,{className:`h-full overflow-hidden hover:bg-accent/20 transition-colors`,children:[(0,b.jsx)(`img`,{src:e.thumbnailUrl,alt:e.title,loading:`lazy`,className:`w-full aspect-1200/630 object-cover border-b border-border/60`}),(0,b.jsx)(g,{className:`p-6 pt-4`,children:(0,b.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e.subtitle&&(0,b.jsx)(`div`,{className:`text-sm font-semibold text-muted-foreground`,children:e.subtitle}),(0,b.jsx)(`div`,{className:`text-lg font-medium`,children:e.title}),e.description&&(0,b.jsx)(`div`,{className:`text-sm text-muted-foreground line-clamp-3 mt-1`,children:e.description})]})})]})},e.path)}export{E as default};