@marimo-team/frontend 0.24.1-dev115 → 0.24.1-dev119

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 (140) hide show
  1. package/dist/assets/{CellStatus-DJBTB8Tm.js → CellStatus-LoTwk7fR.js} +1 -1
  2. package/dist/assets/{ConnectedDataExplorerComponent-C22y7sbC.js → ConnectedDataExplorerComponent-DW6cJ-Lr.js} +1 -1
  3. package/dist/assets/{JsonOutput-COWoYBdx.js → JsonOutput-Bgxc9G7d.js} +10 -10
  4. package/dist/assets/{LazyAnyLanguageCodeMirror-nhd5JrSb.js → LazyAnyLanguageCodeMirror-LboTfNDv.js} +2 -2
  5. package/dist/assets/{MarimoErrorOutput-Cpp7YwEl.js → MarimoErrorOutput-DqpoYOvw.js} +1 -1
  6. package/dist/assets/{RenderHTML-DlIzJTPL.js → RenderHTML-DwhMAd9l.js} +1 -1
  7. package/dist/assets/{RunButton-CT16Dkr4.js → RunButton-BlpbweyH.js} +1 -1
  8. package/dist/assets/{VisuallyHidden-wlQyxf8y.js → VisuallyHidden-CBMDmozt.js} +1 -1
  9. package/dist/assets/{add-cell-with-ai-DSjyPknP.js → add-cell-with-ai-R-3DS79K.js} +1 -1
  10. package/dist/assets/{add-connection-dialog-DO478_EL.js → add-connection-dialog-BGfpw5lC.js} +1 -1
  11. package/dist/assets/{agent-panel-DIvPSTyY.js → agent-panel-B03P2qSx.js} +1 -1
  12. package/dist/assets/ai-model-dropdown-DCmiuk7x.js +3 -0
  13. package/dist/assets/alert-dialog-CA-2mBs3.js +11 -0
  14. package/dist/assets/{any-language-editor-kw0XJFxM.js → any-language-editor-DflLjPSQ.js} +1 -1
  15. package/dist/assets/{app-config-button-CAZWYP6R.js → app-config-button-DUJC6b6x.js} +1 -1
  16. package/dist/assets/{blob-B82D3b64.js → blob-B2d_dHwI.js} +1 -1
  17. package/dist/assets/{cache-panel-iphovHma.js → cache-panel-DqgtC98s.js} +1 -1
  18. package/dist/assets/{cell-editor-CL59E8W0.js → cell-editor-QmA8u1Ay.js} +1 -1
  19. package/dist/assets/{cell-link-DOeJzvRH.js → cell-link-6burT2XF.js} +1 -1
  20. package/dist/assets/{cells-BgH2MZS9.js → cells-Cp-G34Rz.js} +3 -3
  21. package/dist/assets/{chat-display-kzxea9r-.js → chat-display-Bu405iyc.js} +1 -1
  22. package/dist/assets/{chat-panel-BVsbI9bp.js → chat-panel-BlUwNY5j.js} +1 -1
  23. package/dist/assets/{chat-ui-BIaqeCtJ.js → chat-ui-DGiVDzNh.js} +1 -1
  24. package/dist/assets/{circle-BiW8b6Xq.js → circle-ByJdIf5p.js} +1 -1
  25. package/dist/assets/{column-preview-BWoK0ZFU.js → column-preview-DHe0-7z4.js} +1 -1
  26. package/dist/assets/{command-palette-CcLmXXVs.js → command-palette-D-kPO0tm.js} +1 -1
  27. package/dist/assets/{common-DeDcgYdz.js → common-CHR7w7aQ.js} +1 -1
  28. package/dist/assets/{components-CtHLnRet.js → components-C7mWrmXr.js} +1 -1
  29. package/dist/assets/{components-DAhqHptJ.js → components-DUYCXngU.js} +1 -1
  30. package/dist/assets/config-B-r81uZ6.js +1 -0
  31. package/dist/assets/{config-BRRSKtP3.js → config-BlNM0caL.js} +1 -1
  32. package/dist/assets/{copy-icon-D522mvZL.js → copy-icon-z8fuTE3w.js} +1 -1
  33. package/dist/assets/{datasource-HG_yVRxq.js → datasource-DrODSIs0.js} +1 -1
  34. package/dist/assets/{dependency-graph-panel-CVsva03Q.js → dependency-graph-panel-AY5BEVH2.js} +1 -1
  35. package/dist/assets/{dist-ConG15vZ.js → dist-DzCQtGkt.js} +1 -1
  36. package/dist/assets/{documentation-panel-BSiOFIpg.js → documentation-panel-CaJF7e-j.js} +1 -1
  37. package/dist/assets/{download-C4umhthc.js → download-DMxOzI7b.js} +1 -1
  38. package/dist/assets/dropdown-menu-C40jM9o4.js +1 -0
  39. package/dist/assets/{edit-page-DCOdX3sJ.js → edit-page-CdCPUPqZ.js} +4 -4
  40. package/dist/assets/{error-banner-C5aiAh3q.js → error-banner-Dw5YY9wq.js} +1 -1
  41. package/dist/assets/{error-entries-Yh2iX13J.js → error-entries-Cv2m1yhc.js} +1 -1
  42. package/dist/assets/{error-panel-CGUFTbfd.js → error-panel-Bhlvt6_H.js} +1 -1
  43. package/dist/assets/{es-DP79Qs0u.js → es-CrFhA96G.js} +1 -1
  44. package/dist/assets/file-explorer-panel-DMKcHVIX.js +1 -0
  45. package/dist/assets/{file-icons-C0Mf_Axb.js → file-icons-DdGYuADJ.js} +1 -1
  46. package/dist/assets/file-name-input-K4MKESI_.js +3 -0
  47. package/dist/assets/{floating-outline-8Uo6Qp8W.js → floating-outline-DaUHnl_e.js} +1 -1
  48. package/dist/assets/{fullscreen-BFfuaW3H.js → fullscreen-BH2jz-F4.js} +5 -5
  49. package/dist/assets/{gallery-page-BpxbCG1a.js → gallery-page-C3pBpHlY.js} +1 -1
  50. package/dist/assets/{glide-data-editor-k7azNhFM.js → glide-data-editor-sICUMEhk.js} +1 -1
  51. package/dist/assets/{home-page-CEzr9Hhn.js → home-page-Cir7n_EF.js} +1 -1
  52. package/dist/assets/index-BGT7have.css +2 -0
  53. package/dist/assets/{index-kkDJK6-j.js → index-ClZGC-u9.js} +6 -6
  54. package/dist/assets/{input-D4qvzBWu.js → input-DEbY281O.js} +1 -1
  55. package/dist/assets/{kiosk-mode-BqYH0GIF.js → kiosk-mode-mxgb5lWf.js} +1 -1
  56. package/dist/assets/{layout-D5ovQPUb.js → layout-CC2AHMrW.js} +3 -3
  57. package/dist/assets/{logs-panel-Cqxpxz5Z.js → logs-panel-BGS2v3ba.js} +1 -1
  58. package/dist/assets/{markdown-renderer-zZh3O1Hm.js → markdown-renderer-BZKlbm2Q.js} +1 -1
  59. package/dist/assets/{menu-items-CsV3aDPH.js → menu-items-BSRA2YI9.js} +1 -1
  60. package/dist/assets/{mermaid-BovZosCC.js → mermaid-l6lQkCib.js} +1 -1
  61. package/dist/assets/{name-cell-input-DXP1MqrH.js → name-cell-input-BMCdK-el.js} +1 -1
  62. package/dist/assets/{outline-panel-CMMPf-P7.js → outline-panel-Dr5u73V6.js} +1 -1
  63. package/dist/assets/{packages-panel-BHZOSh3s.js → packages-panel-BdpRg9tX.js} +1 -1
  64. package/dist/assets/{pair-with-agent-modal-DgckrViE.js → pair-with-agent-modal-CbUFKJHP.js} +1 -1
  65. package/dist/assets/{panel-accordion-state-9kdNootf.js → panel-accordion-state-DjUTN7i5.js} +1 -1
  66. package/dist/assets/{panels-Ca-tbb7P.js → panels-BsXw4GTa.js} +1 -1
  67. package/dist/assets/{process-output-Bi9pDe1a.js → process-output-Ck7-P_xp.js} +1 -1
  68. package/dist/assets/{readonly-code-display-ilZfA3ua.js → readonly-code-display--S2daDa6.js} +1 -1
  69. package/dist/assets/{readonly-python-code-Bqk6NhSW.js → readonly-python-code-DpIyjHqY.js} +1 -1
  70. package/dist/assets/{renderShortcut-BnBOGXqJ.js → renderShortcut-X-CJUSM8.js} +1 -1
  71. package/dist/assets/{reveal-component-DpoL_y06.js → reveal-component-BuI7t0JO.js} +1 -1
  72. package/dist/assets/{run-page-rnCMzZmN.js → run-page-DZNsqz9H.js} +1 -1
  73. package/dist/assets/{scratchpad-panel-BBd8n8wh.js → scratchpad-panel-CARmXIqQ.js} +1 -1
  74. package/dist/assets/{secrets-panel-C5D_CNW2.js → secrets-panel-D3BpDIgg.js} +1 -1
  75. package/dist/assets/select-nLt2y0Sw.js +1 -0
  76. package/dist/assets/{session-panel-C3kmYD9D.js → session-panel-CB5EvmZs.js} +1 -1
  77. package/dist/assets/{skeleton-xsRIwsVr.js → skeleton-idYPIMw_.js} +1 -1
  78. package/dist/assets/{snippets-panel-C1fCmhNQ.js → snippets-panel-D5yy7kj0.js} +1 -1
  79. package/dist/assets/{state-DJSqAVnx.js → state-B6AklCzD.js} +1 -1
  80. package/dist/assets/{state-CsL-gymg.js → state-Di9TbuV9.js} +1 -1
  81. package/dist/assets/{switch-CYJ2u4G9.js → switch-DjXr9Y9D.js} +1 -1
  82. package/dist/assets/{tabs-DxfkQ6UI.js → tabs-Cy1qXLzH.js} +1 -1
  83. package/dist/assets/{terminal-CfkxQQwT.js → terminal-CQAFGBfN.js} +1 -1
  84. package/dist/assets/{tooltip-BO5vfMvm.js → tooltip-BUtPzKB4.js} +1 -1
  85. package/dist/assets/{tracing-BHb672Fd.js → tracing-DNk3gmWv.js} +1 -1
  86. package/dist/assets/{tracing-panel-3JaAnsDw.js → tracing-panel-Yqazr6w_.js} +2 -2
  87. package/dist/assets/{tree-actions-CzmLf39g.js → tree-actions-CG5g7aUQ.js} +1 -1
  88. package/dist/assets/{useAddCell-DuzEVBJj.js → useAddCell-DdB_uBif.js} +1 -1
  89. package/dist/assets/{useBoolean-Dh6ALPsT.js → useBoolean-BXC4CItZ.js} +1 -1
  90. package/dist/assets/{useCellActionButton-B3Ve1KW5.js → useCellActionButton-B31neI3m.js} +1 -1
  91. package/dist/assets/{useDebounce-Dulm61-t.js → useDebounce-DgpSQhrP.js} +1 -1
  92. package/dist/assets/{useDeleteCell-CEtU0g91.js → useDeleteCell-Bz49_cFj.js} +1 -1
  93. package/dist/assets/{useDependencyPanelTab-BpSWTQLC.js → useDependencyPanelTab-C_ps0r--.js} +1 -1
  94. package/dist/assets/{useNotebookActions-C3LAhEgG.js → useNotebookActions-Br4AVVRg.js} +1 -1
  95. package/dist/assets/{useRunCells-omrTl5XU.js → useRunCells-CX7oW5zy.js} +1 -1
  96. package/dist/assets/{useSplitCell-CgXD2Gcw.js → useSplitCell-Dy2_DmJR.js} +1 -1
  97. package/dist/assets/{useTheme-OSyXt1jZ.js → useTheme-C-ri8BtY.js} +1 -1
  98. package/dist/assets/utils-D5Ywm7-q.js +1 -0
  99. package/dist/assets/{vega-component-CwdVpUdb.js → vega-component-C7TCzyaU.js} +1 -1
  100. package/dist/assets/write-secret-modal-D6zoZgLY.js +2 -0
  101. package/dist/index.html +44 -44
  102. package/package.json +1 -1
  103. package/src/components/ai/ai-provider-icon.tsx +2 -2
  104. package/src/components/ai/ai-utils.ts +1 -1
  105. package/src/components/app-config/ai-config.tsx +33 -37
  106. package/src/components/app-config/user-config-form.tsx +1 -1
  107. package/src/components/data-table/renderers.tsx +2 -6
  108. package/src/components/editor/Output.tsx +40 -0
  109. package/src/components/editor/__tests__/Output.test.tsx +85 -2
  110. package/src/components/editor/file-tree/__tests__/file-explorer-navigation.test.tsx +832 -0
  111. package/src/components/editor/file-tree/__tests__/file-viewer.test.tsx +27 -0
  112. package/src/components/editor/file-tree/__tests__/requesting-tree.test.ts +130 -0
  113. package/src/components/editor/file-tree/file-browser-row.tsx +82 -0
  114. package/src/components/editor/file-tree/file-explorer.tsx +377 -159
  115. package/src/components/editor/file-tree/file-operations.tsx +1 -1
  116. package/src/components/editor/file-tree/file-search-results.tsx +142 -0
  117. package/src/components/editor/file-tree/file-tree-row.tsx +40 -0
  118. package/src/components/editor/file-tree/file-viewer.tsx +2 -1
  119. package/src/components/editor/file-tree/requesting-tree.tsx +162 -32
  120. package/src/components/editor/file-tree/use-file-search.ts +142 -0
  121. package/src/components/editor/file-tree/use-hover-expand.ts +34 -0
  122. package/src/components/ui/__tests__/fullscreen.test.tsx +88 -0
  123. package/src/components/ui/fullscreen.tsx +43 -1
  124. package/src/components/ui/links.tsx +2 -1
  125. package/src/core/ai/ids/__tests__/ids.test.ts +0 -8
  126. package/src/core/ai/ids/ids.ts +1 -1
  127. package/src/core/config/config-schema.ts +1 -0
  128. package/src/core/network/__tests__/requests-toasting.test.tsx +14 -0
  129. package/src/core/network/requests-toasting.tsx +1 -1
  130. package/src/hooks/useEventListener.ts +1 -1
  131. package/dist/assets/ai-model-dropdown-BxqpRM7R.js +0 -3
  132. package/dist/assets/alert-dialog-BnNhUpVP.js +0 -11
  133. package/dist/assets/config-DnyziF11.js +0 -1
  134. package/dist/assets/dropdown-menu-B-ZAV5lw.js +0 -1
  135. package/dist/assets/file-explorer-panel-Db-8C8fm.js +0 -1
  136. package/dist/assets/file-name-input-DmwIfRLx.js +0 -3
  137. package/dist/assets/index-DuY6Lm00.css +0 -2
  138. package/dist/assets/select-BJKJFWHk.js +0 -1
  139. package/dist/assets/utils-B-_Wem_I.js +0 -1
  140. package/dist/assets/write-secret-modal-GHpJRc36.js +0 -2
@@ -1,11 +0,0 @@
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{i as r,o as i,r as a}from"./useEventListener-92uWqz-P.js";import{t as o}from"./cn-ldLVeaqm.js";import{t as s}from"./jsx-runtime-B74pBk57.js";import{C as c,S as l,_ as u,c as d,d as ee,f as te,m as ne,o as re,r as ie,s as ae,u as oe,v as f,w as p,x as m,y as se}from"./fullscreen-BFfuaW3H.js";import{n as h}from"./button-Dh8EwhsF.js";var g=e(t(),1),_=s(),v=`Dialog`,[y,b]=c(v),[ce,x]=y(v),le=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=g.useRef(null),c=g.useRef(null),[l,d]=se({prop:r,defaultProp:i??!1,onChange:a,caller:v});return(0,_.jsx)(ce,{scope:t,triggerRef:s,contentRef:c,contentId:u(),titleId:u(),descriptionId:u(),open:l,onOpenChange:d,onOpenToggle:g.useCallback(()=>d(e=>!e),[d]),modal:o,children:n})};le.displayName=v;var ue=`DialogTrigger`,S=g.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,a=x(ue,n),o=i(t,a.triggerRef);return(0,_.jsx)(p.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":a.open,"aria-controls":a.contentId,"data-state":L(a.open),...r,ref:o,onClick:m(e.onClick,a.onOpenToggle)})});S.displayName=ue;var C=`DialogPortal`,[de,w]=y(C,{forceMount:void 0}),T=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=x(C,t);return(0,_.jsx)(de,{scope:t,forceMount:n,children:g.Children.map(r,e=>(0,_.jsx)(f,{present:n||a.open,children:(0,_.jsx)(ee,{asChild:!0,container:i,children:e})}))})};T.displayName=C;var E=`DialogOverlay`,D=g.forwardRef((e,t)=>{let n=w(E,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=x(E,e.__scopeDialog);return a.modal?(0,_.jsx)(f,{present:r||a.open,children:(0,_.jsx)(pe,{...i,ref:t})}):null});D.displayName=E;var fe=a(`DialogOverlay.RemoveScroll`),pe=g.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=x(E,n);return(0,_.jsx)(d,{as:fe,allowPinchZoom:!0,shards:[i.contentRef],children:(0,_.jsx)(p.div,{"data-state":L(i.open),...r,ref:t,style:{pointerEvents:`auto`,...r.style}})})}),O=`DialogContent`,k=g.forwardRef((e,t)=>{let n=w(O,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=x(O,e.__scopeDialog);return(0,_.jsx)(f,{present:r||a.open,children:a.modal?(0,_.jsx)(me,{...i,ref:t}):(0,_.jsx)(he,{...i,ref:t})})});k.displayName=O;var me=g.forwardRef((e,t)=>{let n=x(O,e.__scopeDialog),r=g.useRef(null),a=i(t,n.contentRef,r);return g.useEffect(()=>{let e=r.current;if(e)return ae(e)},[]),(0,_.jsx)(A,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:m(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:m(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:m(e.onFocusOutside,e=>e.preventDefault())})}),he=g.forwardRef((e,t)=>{let n=x(O,e.__scopeDialog),r=g.useRef(!1),i=g.useRef(!1);return(0,_.jsx)(A,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),A=g.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:o,...s}=e,c=x(O,n),l=g.useRef(null),u=i(t,l);return oe(),(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(te,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:o,children:(0,_.jsx)(ne,{role:`dialog`,id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":L(c.open),...s,ref:u,onDismiss:()=>c.onOpenChange(!1)})}),(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(_e,{titleId:c.titleId}),(0,_.jsx)(ye,{contentRef:l,descriptionId:c.descriptionId})]})]})}),j=`DialogTitle`,M=g.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=x(j,n);return(0,_.jsx)(p.h2,{id:i.titleId,...r,ref:t})});M.displayName=j;var N=`DialogDescription`,P=g.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=x(N,n);return(0,_.jsx)(p.p,{id:i.descriptionId,...r,ref:t})});P.displayName=N;var F=`DialogClose`,I=g.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=x(F,n);return(0,_.jsx)(p.button,{type:`button`,...r,ref:t,onClick:m(e.onClick,()=>i.onOpenChange(!1))})});I.displayName=F;function L(e){return e?`open`:`closed`}var R=`DialogTitleWarning`,[ge,z]=l(R,{contentName:O,titleName:j,docsSlug:`dialog`}),_e=({titleId:e})=>{let t=z(R),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
2
-
3
- If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
4
-
5
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return g.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},ve=`DialogDescriptionWarning`,ye=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${z(ve).contentName}}.`;return g.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},B=le,V=S,H=T,U=D,W=k,G=M,K=P,q=I,J=`AlertDialog`,[be,xe]=c(J,[b]),Y=b(),X=e=>{let{__scopeAlertDialog:t,...n}=e,r=Y(t);return(0,_.jsx)(B,{...r,...n,modal:!0})};X.displayName=J;var Se=`AlertDialogTrigger`,Ce=g.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Y(n);return(0,_.jsx)(V,{...i,...r,ref:t})});Ce.displayName=Se;var we=`AlertDialogPortal`,Te=e=>{let{__scopeAlertDialog:t,...n}=e,r=Y(t);return(0,_.jsx)(H,{...r,...n})};Te.displayName=we;var Ee=`AlertDialogOverlay`,De=g.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Y(n);return(0,_.jsx)(U,{...i,...r,ref:t})});De.displayName=Ee;var Z=`AlertDialogContent`,[Oe,ke]=be(Z),Ae=r(`AlertDialogContent`),je=g.forwardRef((e,t)=>{let{__scopeAlertDialog:n,children:r,...a}=e,o=Y(n),s=g.useRef(null),c=i(t,s),l=g.useRef(null);return(0,_.jsx)(ge,{contentName:Z,titleName:Me,docsSlug:`alert-dialog`,children:(0,_.jsx)(Oe,{scope:n,cancelRef:l,children:(0,_.jsxs)(W,{role:`alertdialog`,...o,...a,ref:c,onOpenAutoFocus:m(a.onOpenAutoFocus,e=>{e.preventDefault(),l.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,_.jsx)(Ae,{children:r}),(0,_.jsx)(Be,{contentRef:s})]})})})});je.displayName=Z;var Me=`AlertDialogTitle`,Ne=g.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Y(n);return(0,_.jsx)(G,{...i,...r,ref:t})});Ne.displayName=Me;var Pe=`AlertDialogDescription`,Fe=g.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Y(n);return(0,_.jsx)(K,{...i,...r,ref:t})});Fe.displayName=Pe;var Ie=`AlertDialogAction`,Le=g.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Y(n);return(0,_.jsx)(q,{...i,...r,ref:t})});Le.displayName=Ie;var Re=`AlertDialogCancel`,ze=g.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,{cancelRef:a}=ke(Re,n),o=Y(n),s=i(t,a);return(0,_.jsx)(q,{...o,...r,ref:s})});ze.displayName=Re;var Be=({contentRef:e})=>{let t=`\`${Z}\` requires a description for the component to be accessible for screen reader users.
6
-
7
- You can add a description to the \`${Z}\` by passing a \`${Pe}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
8
-
9
- Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Z}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
10
-
11
- For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return g.useEffect(()=>{document.getElementById(e.current?.getAttribute(`aria-describedby`))||console.warn(t)},[t,e]),null},Ve=X,He=Ce,Ue=Te,We=De,Ge=je,Q=Le,Ke=ze,qe=Ne,Je=Fe,$=n();function Ye(){let e=(0,$.c)(3),[t,n]=(0,g.useState)(null),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{n(document.activeElement)},e[0]=r):r=e[0];let i=r,a;return e[1]===t?a=e[2]:(a={onOpenAutoFocus:i,onCloseAutoFocus:e=>{document.activeElement===document.body&&(t instanceof HTMLElement&&t.focus(),e.preventDefault())}},e[1]=t,e[2]=a),a}var Xe=Ve,Ze=He,Qe=ie(({children:e,...t})=>(0,_.jsx)(Ue,{...t,children:(0,_.jsx)(re,{children:(0,_.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-end justify-center sm:items-start sm:top-[15%]`,children:e})})}));Qe.displayName=Ue.displayName;var $e=g.forwardRef((e,t)=>{let n=(0,$.c)(9),r,i;if(n[0]!==e){let{className:t,children:a,...o}=e;r=t,i=o,n[0]=e,n[1]=r,n[2]=i}else r=n[1],i=n[2];let a;n[3]===r?a=n[4]:(a=o(`fixed inset-0 z-50 bg-background/80 backdrop-blur-xs transition-opacity animate-in fade-in`,r),n[3]=r,n[4]=a);let s;return n[5]!==i||n[6]!==t||n[7]!==a?(s=(0,_.jsx)(We,{className:a,...i,ref:t}),n[5]=i,n[6]=t,n[7]=a,n[8]=s):s=n[8],s});$e.displayName=We.displayName;var et=g.forwardRef((e,t)=>{let n=(0,$.c)(11),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a=Ye(),s;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,_.jsx)($e,{}),n[3]=s):s=n[3];let c;n[4]===r?c=n[5]:(c=o(`fixed z-50 grid w-full max-w-2xl scale-100 gap-4 border bg-background p-6 opacity-100 shadow-sm animate-in fade-in-90 slide-in-from-bottom-10 sm:rounded-lg sm:zoom-in-90 sm:slide-in-from-bottom-0 md:w-full`,r),n[4]=r,n[5]=c);let l;return n[6]!==i||n[7]!==t||n[8]!==a||n[9]!==c?(l=(0,_.jsxs)(Qe,{children:[s,(0,_.jsx)(Ge,{ref:t,className:c,...a,...i})]}),n[6]=i,n[7]=t,n[8]=a,n[9]=c,n[10]=l):l=n[10],l});et.displayName=Ge.displayName;var tt=e=>{let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=o(`flex flex-col space-y-2 text-center sm:text-left`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,_.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};tt.displayName=`AlertDialogHeader`;var nt=e=>{let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=o(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,_.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};nt.displayName=`AlertDialogFooter`;var rt=g.forwardRef((e,t)=>{let n=(0,$.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=o(`text-lg font-semibold`,r),n[3]=r,n[4]=a);let s;return n[5]!==i||n[6]!==t||n[7]!==a?(s=(0,_.jsx)(qe,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=s):s=n[8],s});rt.displayName=qe.displayName;var it=g.forwardRef((e,t)=>{let n=(0,$.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=o(`text-muted-foreground`,r),n[3]=r,n[4]=a);let s;return n[5]!==i||n[6]!==t||n[7]!==a?(s=(0,_.jsx)(Je,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=s):s=n[8],s});it.displayName=Je.displayName;var at=g.forwardRef((e,t)=>{let n=(0,$.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=o(h(),r),n[3]=r,n[4]=a);let s;return n[5]!==i||n[6]!==t||n[7]!==a?(s=(0,_.jsx)(Q,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=s):s=n[8],s});at.displayName=Q.displayName;var ot=g.forwardRef((e,t)=>{let n=(0,$.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=o(h({variant:`destructive`}),r),n[3]=r,n[4]=a);let s;return n[5]!==i||n[6]!==t||n[7]!==a?(s=(0,_.jsx)(Q,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=s):s=n[8],s});ot.displayName=`AlertDialogDestructiveAction`;var st=g.forwardRef((e,t)=>{let n=(0,$.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=o(h({variant:`secondary`}),`mt-2 sm:mt-0`,r),n[3]=r,n[4]=a);let s;return n[5]!==i||n[6]!==t||n[7]!==a?(s=(0,_.jsx)(Ke,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=s):s=n[8],s});st.displayName=Ke.displayName;export{B as _,it as a,tt as c,Ye as d,q as f,H as g,U as h,et as i,rt as l,K as m,at as n,ot as o,W as p,st as r,nt as s,Xe as t,Ze as u,G as v,V as y};
@@ -1 +0,0 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{u as t}from"./useEvent-xfs0Sn4r.js";import{t as n}from"./react-CBDbhulC.js";import{t as r}from"./compiler-runtime-CYIjoINj.js";import{D as i,b as a}from"./utils-B-_Wem_I.js";import{o}from"./useEventListener-92uWqz-P.js";import{t as s}from"./cn-ldLVeaqm.js";import{t as c}from"./jsx-runtime-B74pBk57.js";import{C as l,_ as u,b as d,v as f,w as p,x as m,y as h}from"./fullscreen-BFfuaW3H.js";import{d as g,u as _}from"./menu-items-CsV3aDPH.js";import{r as v}from"./requests-C6_IaFh7.js";import{a as y}from"./useNumberFormatter-DHJ9s6Vk.js";var b=e(n(),1),x=c(),S=`Collapsible`,[ee,C]=l(S),[te,w]=ee(S),T=b.forwardRef((e,t)=>{let{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:a,onOpenChange:o,...s}=e,[c,l]=h({prop:r,defaultProp:i??!1,onChange:o,caller:S});return(0,x.jsx)(te,{scope:n,disabled:a,contentId:u(),open:c,onOpenToggle:b.useCallback(()=>l(e=>!e),[l]),children:(0,x.jsx)(p.div,{"data-state":A(c),"data-disabled":a?``:void 0,...s,ref:t})})});T.displayName=S;var E=`CollapsibleTrigger`,D=b.forwardRef((e,t)=>{let{__scopeCollapsible:n,...r}=e,i=w(E,n);return(0,x.jsx)(p.button,{type:`button`,"aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":A(i.open),"data-disabled":i.disabled?``:void 0,disabled:i.disabled,...r,ref:t,onClick:m(e.onClick,i.onOpenToggle)})});D.displayName=E;var O=`CollapsibleContent`,k=b.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=w(O,e.__scopeCollapsible);return(0,x.jsx)(f,{present:n||i.open,children:({present:e})=>(0,x.jsx)(ne,{...r,ref:t,present:e})})});k.displayName=O;var ne=b.forwardRef((e,t)=>{let{__scopeCollapsible:n,present:r,children:i,...a}=e,s=w(O,n),[c,l]=b.useState(r),u=b.useRef(null),f=o(t,u),m=b.useRef(0),h=m.current,g=b.useRef(0),_=g.current,v=s.open||c,y=b.useRef(v),S=b.useRef(void 0);return b.useEffect(()=>{let e=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(e)},[]),d(()=>{let e=u.current;if(e){S.current=S.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();m.current=t.height,g.current=t.width,y.current||(e.style.transitionDuration=S.current.transitionDuration,e.style.animationName=S.current.animationName),l(r)}},[s.open,r]),(0,x.jsx)(p.div,{"data-state":A(s.open),"data-disabled":s.disabled?``:void 0,id:s.contentId,hidden:!v,...a,ref:f,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":_?`${_}px`:void 0,...e.style},children:v&&i})});function A(e){return e?`open`:`closed`}var re=T,ie=D,ae=k,j=`Accordion`,oe=[`Home`,`End`,`ArrowDown`,`ArrowUp`,`ArrowLeft`,`ArrowRight`],[M,se,ce]=g(j),[N,le]=l(j,[ce,C]),P=C(),F=b.forwardRef((e,t)=>{let{type:n,...r}=e,i=r,a=r;return(0,x.jsx)(M.Provider,{scope:e.__scopeAccordion,children:n===`multiple`?(0,x.jsx)(pe,{...a,ref:t}):(0,x.jsx)(fe,{...i,ref:t})})});F.displayName=j;var[I,ue]=N(j),[L,de]=N(j,{collapsible:!1}),fe=b.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},collapsible:a=!1,...o}=e,[s,c]=h({prop:n,defaultProp:r??``,onChange:i,caller:j});return(0,x.jsx)(I,{scope:e.__scopeAccordion,value:b.useMemo(()=>s?[s]:[],[s]),onItemOpen:c,onItemClose:b.useCallback(()=>a&&c(``),[a,c]),children:(0,x.jsx)(L,{scope:e.__scopeAccordion,collapsible:a,children:(0,x.jsx)(z,{...o,ref:t})})})}),pe=b.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=h({prop:n,defaultProp:r??[],onChange:i,caller:j}),c=b.useCallback(e=>s((t=[])=>[...t,e]),[s]),l=b.useCallback(e=>s((t=[])=>t.filter(t=>t!==e)),[s]);return(0,x.jsx)(I,{scope:e.__scopeAccordion,value:o,onItemOpen:c,onItemClose:l,children:(0,x.jsx)(L,{scope:e.__scopeAccordion,collapsible:!0,children:(0,x.jsx)(z,{...a,ref:t})})})}),[me,R]=N(j),z=b.forwardRef((e,t)=>{let{__scopeAccordion:n,disabled:r,dir:i,orientation:a=`vertical`,...s}=e,c=b.useRef(null),l=o(c,t),u=se(n),d=_(i)===`ltr`,f=m(e.onKeyDown,e=>{if(!oe.includes(e.key))return;let t=e.target,n=u().filter(e=>!e.ref.current?.disabled),r=n.findIndex(e=>e.ref.current===t),i=n.length;if(r===-1)return;e.preventDefault();let o=r,s=i-1,c=()=>{o=r+1,o>s&&(o=0)},l=()=>{o=r-1,o<0&&(o=s)};switch(e.key){case`Home`:o=0;break;case`End`:o=s;break;case`ArrowRight`:a===`horizontal`&&(d?c():l());break;case`ArrowDown`:a===`vertical`&&c();break;case`ArrowLeft`:a===`horizontal`&&(d?l():c());break;case`ArrowUp`:a===`vertical`&&l()}n[o%i].ref.current?.focus()});return(0,x.jsx)(me,{scope:n,disabled:r,direction:i,orientation:a,children:(0,x.jsx)(M.Slot,{scope:n,children:(0,x.jsx)(p.div,{...s,"data-orientation":a,ref:l,onKeyDown:r?void 0:f})})})}),B=`AccordionItem`,[he,V]=N(B),ge=b.forwardRef((e,t)=>{let{__scopeAccordion:n,value:r,...i}=e,a=R(B,n),o=ue(B,n),s=P(n),c=u(),l=r&&o.value.includes(r)||!1,d=a.disabled||e.disabled;return(0,x.jsx)(he,{scope:n,open:l,disabled:d,triggerId:c,children:(0,x.jsx)(re,{"data-orientation":a.orientation,"data-state":J(l),...s,...i,ref:t,disabled:d,open:l,onOpenChange:e=>{e?o.onItemOpen(r):o.onItemClose(r)}})})});ge.displayName=B;var H=`AccordionHeader`,U=b.forwardRef((e,t)=>{let{__scopeAccordion:n,...r}=e,i=R(j,n),a=V(H,n);return(0,x.jsx)(p.h3,{"data-orientation":i.orientation,"data-state":J(a.open),"data-disabled":a.disabled?``:void 0,...r,ref:t})});U.displayName=H;var W=`AccordionTrigger`,G=b.forwardRef((e,t)=>{let{__scopeAccordion:n,...r}=e,i=R(j,n),a=V(W,n),o=de(W,n),s=P(n);return(0,x.jsx)(M.ItemSlot,{scope:n,children:(0,x.jsx)(ie,{"aria-disabled":a.open&&!o.collapsible||void 0,"data-orientation":i.orientation,id:a.triggerId,...s,...r,ref:t})})});G.displayName=W;var K=`AccordionContent`,q=b.forwardRef((e,t)=>{let{__scopeAccordion:n,...r}=e,i=R(j,n),a=V(K,n),o=P(n);return(0,x.jsx)(ae,{role:`region`,"aria-labelledby":a.triggerId,"data-orientation":i.orientation,...o,...r,ref:t,style:{"--radix-accordion-content-height":`var(--radix-collapsible-content-height)`,"--radix-accordion-content-width":`var(--radix-collapsible-content-width)`,...e.style}})});q.displayName=K;function J(e){return e?`open`:`closed`}var Y=F,X=ge,_e=U,Z=G,Q=q,$=r(),ve=Y,ye=b.forwardRef((e,t)=>{let n=(0,$.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=s(`border-b`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,x.jsx)(X,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ye.displayName=`AccordionItem`;var be=b.forwardRef((e,t)=>{let n=(0,$.c)(12),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:i,children:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o;n[4]===i?o=n[5]:(o=s(`flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180 text-start`,i),n[4]=i,n[5]=o);let c;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,x.jsx)(y,{className:`h-4 w-4 transition-transform duration-200`}),n[6]=c):c=n[6];let l;return n[7]!==r||n[8]!==a||n[9]!==t||n[10]!==o?(l=(0,x.jsx)(_e,{className:`flex`,children:(0,x.jsxs)(Z,{ref:t,className:o,...a,children:[r,c]})}),n[7]=r,n[8]=a,n[9]=t,n[10]=o,n[11]=l):l=n[11],l});be.displayName=Z.displayName;var xe=b.forwardRef((e,t)=>{let n=(0,$.c)(17),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({className:i,children:r,wrapperClassName:o,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let c;n[5]===i?c=n[6]:(c=s(`overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down`,i),n[5]=i,n[6]=c);let l;n[7]===o?l=n[8]:(l=s(`pb-4 pt-0`,o),n[7]=o,n[8]=l);let u;n[9]!==r||n[10]!==l?(u=(0,x.jsx)(`div`,{className:l,children:r}),n[9]=r,n[10]=l,n[11]=u):u=n[11];let d;return n[12]!==a||n[13]!==t||n[14]!==c||n[15]!==u?(d=(0,x.jsx)(Q,{ref:t,className:c,...a,children:u}),n[12]=a,n[13]=t,n[14]=c,n[15]=u,n[16]=d):d=n[16],d});xe.displayName=Q.displayName;var Se=class{map=new Map;get(e){return this.map.get(e)??[]}set(e,t){this.map.set(e,t)}add(e,t){this.map.has(e)?this.map.get(e).push(t):this.map.set(e,[t])}has(e){return this.map.has(e)}delete(e){return this.map.delete(e)}clear(){this.map.clear()}keys(){return this.map.keys()}values(){return this.map.values()}entries(){return this.map.entries()}forEach(e){this.map.forEach(e)}flatValues(){let e=[];for(let t of this.map.values())e.push(...t);return e}get size(){return this.map.size}},Ce=e=>{switch(e){case`chat`:return`chat_model`;case`autocomplete`:return`autocomplete_model`;case`edit`:return`edit_model`}},we=()=>{let e=(0,$.c)(10),n=t(i),{saveUserConfig:r}=v(),o;e[0]!==r||e[1]!==n?(o=async e=>{let t={ai:e};await r({config:t}).then(()=>{n(e=>a(e,t))})},e[0]=r,e[1]=n,e[2]=o):o=e[2];let s=o,c;e[3]===s?c=e[4]:(c=async(e,t)=>{let n=Ce(t);n&&await s({models:{[n]:e}})},e[3]=s,e[4]=c);let l=c,u;e[5]===s?u=e[6]:(u=async e=>{await s({mode:e})},e[5]=s,e[6]=u);let d=u,f;return e[7]!==d||e[8]!==l?(f={saveModelChange:l,saveModeChange:d},e[7]=d,e[8]=l,e[9]=f):f=e[9],f};export{ye as a,X as c,xe as i,Y as l,Se as n,be as o,ve as r,Q as s,we as t,Z as u};
@@ -1 +0,0 @@
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{a as r,o as i,r as a}from"./useEventListener-92uWqz-P.js";import{t as o}from"./cn-ldLVeaqm.js";import{t as s}from"./jsx-runtime-B74pBk57.js";import{C as c,T as l,_ as u,c as d,d as f,f as p,g as m,i as h,m as ee,o as te,r as ne,s as g,t as re,u as ie,v as _,w as v,x as y,y as ae}from"./fullscreen-BFfuaW3H.js";import{a as b,i as oe,n as x,r as se,t as S}from"./dist-ConG15vZ.js";import{a as C,c as w,d as T,i as ce,l as E,n as le,o as D,r as O,s as ue,u as de}from"./menu-items-CsV3aDPH.js";import{i as k,n as fe,r as pe,t as me}from"./circle-BiW8b6Xq.js";import{t as he}from"./check-BoA6XBpj.js";import{t as ge}from"./chevron-right-CKA5zVsM.js";var A=e(t(),1),j=s(),_e=[`Enter`,` `],ve=[`ArrowDown`,`PageUp`,`Home`],ye=[`ArrowUp`,`PageDown`,`End`],be=[...ve,...ye],xe={ltr:[..._e,`ArrowRight`],rtl:[..._e,`ArrowLeft`]},Se={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},M=`Menu`,[N,Ce,we]=T(M),[P,Te]=c(M,[we,b,k]),F=b(),Ee=k(),[De,I]=P(M),[Oe,L]=P(M),ke=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=F(t),[c,l]=A.useState(null),u=A.useRef(!1),d=m(a),f=de(i);return A.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,j.jsx)(oe,{...s,children:(0,j.jsx)(De,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,j.jsx)(Oe,{scope:t,onClose:A.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};ke.displayName=M;var Ae=`MenuAnchor`,R=A.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=F(n);return(0,j.jsx)(S,{...i,...r,ref:t})});R.displayName=Ae;var z=`MenuPortal`,[je,Me]=P(z,{forceMount:void 0}),Ne=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=I(z,t);return(0,j.jsx)(je,{scope:t,forceMount:n,children:(0,j.jsx)(_,{present:n||a.open,children:(0,j.jsx)(f,{asChild:!0,container:i,children:r})})})};Ne.displayName=z;var B=`MenuContent`,[Pe,V]=P(B),Fe=A.forwardRef((e,t)=>{let n=Me(B,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=I(B,e.__scopeMenu),o=L(B,e.__scopeMenu);return(0,j.jsx)(N.Provider,{scope:e.__scopeMenu,children:(0,j.jsx)(_,{present:r||a.open,children:(0,j.jsx)(N.Slot,{scope:e.__scopeMenu,children:o.modal?(0,j.jsx)(Ie,{...i,ref:t}):(0,j.jsx)(Le,{...i,ref:t})})})})}),Ie=A.forwardRef((e,t)=>{let n=I(B,e.__scopeMenu),r=A.useRef(null),a=i(t,r);return A.useEffect(()=>{let e=r.current;if(e)return g(e)},[]),(0,j.jsx)(H,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:y(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Le=A.forwardRef((e,t)=>{let n=I(B,e.__scopeMenu);return(0,j.jsx)(H,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Re=a(`MenuContent.ScrollLock`),H=A.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:c,onEntryFocus:l,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:m,onInteractOutside:h,onDismiss:te,disableOutsideScroll:ne,...g}=e,re=I(B,n),_=L(B,n),v=F(n),ae=Ee(n),b=Ce(n),[oe,x]=A.useState(null),S=A.useRef(null),C=i(t,S,re.onContentChange),w=A.useRef(0),T=A.useRef(``),ce=A.useRef(0),E=A.useRef(null),le=A.useRef(`right`),D=A.useRef(0),O=ne?d:A.Fragment,ue=ne?{as:Re,allowPinchZoom:!0}:void 0,de=e=>{let t=T.current+e,n=b().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=ht(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){T.current=t,window.clearTimeout(w.current),t!==``&&(w.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};A.useEffect(()=>()=>window.clearTimeout(w.current),[]),ie();let k=A.useCallback(e=>le.current===E.current?.side&&_t(e,E.current?.area),[]);return(0,j.jsx)(Pe,{scope:n,searchRef:T,onItemEnter:A.useCallback(e=>{k(e)&&e.preventDefault()},[k]),onItemLeave:A.useCallback(e=>{k(e)||(S.current?.focus(),x(null))},[k]),onTriggerLeave:A.useCallback(e=>{k(e)&&e.preventDefault()},[k]),pointerGraceTimerRef:ce,onPointerGraceIntentChange:A.useCallback(e=>{E.current=e},[]),children:(0,j.jsx)(O,{...ue,children:(0,j.jsx)(p,{asChild:!0,trapped:a,onMountAutoFocus:y(o,e=>{e.preventDefault(),S.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:(0,j.jsx)(ee,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:m,onInteractOutside:h,onDismiss:te,children:(0,j.jsx)(pe,{asChild:!0,...ae,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:oe,onCurrentTabStopIdChange:x,onEntryFocus:y(l,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,j.jsx)(se,{role:`menu`,"aria-orientation":`vertical`,"data-state":dt(re.open),"data-radix-menu-content":``,dir:_.dir,...v,...g,ref:C,style:{outline:`none`,...g.style},onKeyDown:y(g.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&de(e.key));let i=S.current;if(e.target!==i||!be.includes(e.key))return;e.preventDefault();let a=b().filter(e=>!e.disabled).map(e=>e.ref.current);ye.includes(e.key)&&a.reverse(),pt(a)}),onBlur:y(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(w.current),T.current=``)}),onPointerMove:y(e.onPointerMove,X(e=>{let t=e.target,n=D.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>D.current?`right`:`left`;le.current=t,D.current=e.clientX}}))})})})})})})});Fe.displayName=B;var ze=`MenuGroup`,U=A.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,j.jsx)(v.div,{role:`group`,...r,ref:t})});U.displayName=ze;var Be=`MenuLabel`,Ve=A.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,j.jsx)(v.div,{...r,ref:t})});Ve.displayName=Be;var W=`MenuItem`,He=`menu.itemSelect`,G=A.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...a}=e,o=A.useRef(null),s=L(W,e.__scopeMenu),c=V(W,e.__scopeMenu),u=i(t,o),d=A.useRef(!1),f=()=>{let e=o.current;if(!n&&e){let t=new CustomEvent(He,{bubbles:!0,cancelable:!0});e.addEventListener(He,e=>r?.(e),{once:!0}),l(e,t),t.defaultPrevented?d.current=!1:s.onClose()}};return(0,j.jsx)(Ue,{...a,ref:u,disabled:n,onClick:y(e.onClick,f),onPointerDown:t=>{e.onPointerDown?.(t),d.current=!0},onPointerUp:y(e.onPointerUp,e=>{d.current||e.currentTarget?.click()}),onKeyDown:y(e.onKeyDown,e=>{let t=c.searchRef.current!==``;n||t&&e.key===` `||_e.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});G.displayName=W;var Ue=A.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:a,...o}=e,s=V(W,n),c=Ee(n),l=A.useRef(null),u=i(t,l),[d,f]=A.useState(!1),[p,m]=A.useState(``);return A.useEffect(()=>{let e=l.current;e&&m((e.textContent??``).trim())},[o.children]),(0,j.jsx)(N.ItemSlot,{scope:n,disabled:r,textValue:a??p,children:(0,j.jsx)(fe,{asChild:!0,...c,focusable:!r,children:(0,j.jsx)(v.div,{role:`menuitem`,"data-highlighted":d?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...o,ref:u,onPointerMove:y(e.onPointerMove,X(e=>{r?s.onItemLeave(e):(s.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:y(e.onPointerLeave,X(e=>s.onItemLeave(e))),onFocus:y(e.onFocus,()=>f(!0)),onBlur:y(e.onBlur,()=>f(!1))})})})}),We=`MenuCheckboxItem`,Ge=A.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,j.jsx)(Qe,{scope:e.__scopeMenu,checked:n,children:(0,j.jsx)(G,{role:`menuitemcheckbox`,"aria-checked":Y(n)?`mixed`:n,...i,ref:t,"data-state":ft(n),onSelect:y(i.onSelect,()=>r?.(Y(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Ge.displayName=We;var Ke=`MenuRadioGroup`,[qe,Je]=P(Ke,{value:void 0,onValueChange:()=>{}}),Ye=A.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=m(r);return(0,j.jsx)(qe,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,j.jsx)(U,{...i,ref:t})})});Ye.displayName=Ke;var Xe=`MenuRadioItem`,Ze=A.forwardRef((e,t)=>{let{value:n,...r}=e,i=Je(Xe,e.__scopeMenu),a=n===i.value;return(0,j.jsx)(Qe,{scope:e.__scopeMenu,checked:a,children:(0,j.jsx)(G,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":ft(a),onSelect:y(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});Ze.displayName=Xe;var K=`MenuItemIndicator`,[Qe,$e]=P(K,{checked:!1}),et=A.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=$e(K,n);return(0,j.jsx)(_,{present:r||Y(a.checked)||a.checked===!0,children:(0,j.jsx)(v.span,{...i,ref:t,"data-state":ft(a.checked)})})});et.displayName=K;var tt=`MenuSeparator`,nt=A.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,j.jsx)(v.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});nt.displayName=tt;var rt=`MenuArrow`,it=A.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=F(n);return(0,j.jsx)(x,{...i,...r,ref:t})});it.displayName=rt;var q=`MenuSub`,[at,ot]=P(q),st=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=I(q,t),o=F(t),[s,c]=A.useState(null),[l,d]=A.useState(null),f=m(i);return A.useEffect(()=>(a.open===!1&&f(!1),()=>f(!1)),[a.open,f]),(0,j.jsx)(oe,{...o,children:(0,j.jsx)(De,{scope:t,open:r,onOpenChange:f,content:l,onContentChange:d,children:(0,j.jsx)(at,{scope:t,contentId:u(),triggerId:u(),trigger:s,onTriggerChange:c,children:n})})})};st.displayName=q;var J=`MenuSubTrigger`,ct=A.forwardRef((e,t)=>{let n=I(J,e.__scopeMenu),i=L(J,e.__scopeMenu),a=ot(J,e.__scopeMenu),o=V(J,e.__scopeMenu),s=A.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:l}=o,u={__scopeMenu:e.__scopeMenu},d=A.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return A.useEffect(()=>d,[d]),A.useEffect(()=>{let e=c.current;return()=>{window.clearTimeout(e),l(null)}},[c,l]),(0,j.jsx)(R,{asChild:!0,...u,children:(0,j.jsx)(Ue,{id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":a.contentId,"data-state":dt(n.open),...e,ref:r(t,a.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:y(e.onPointerMove,X(t=>{o.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!s.current&&(o.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:y(e.onPointerLeave,X(e=>{d();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,a=i?-5:5,s=t[i?`left`:`right`],l=t[i?`right`:`left`];o.onPointerGraceIntentChange({area:[{x:e.clientX+a,y:e.clientY},{x:s,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:s,y:t.bottom}],side:r}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(e),e.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:y(e.onKeyDown,t=>{let r=o.searchRef.current!==``;e.disabled||r&&t.key===` `||xe[i.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});ct.displayName=J;var lt=`MenuSubContent`,ut=A.forwardRef((e,t)=>{let n=Me(B,e.__scopeMenu),{forceMount:r=n.forceMount,...a}=e,o=I(B,e.__scopeMenu),s=L(B,e.__scopeMenu),c=ot(lt,e.__scopeMenu),l=A.useRef(null),u=i(t,l);return(0,j.jsx)(N.Provider,{scope:e.__scopeMenu,children:(0,j.jsx)(_,{present:r||o.open,children:(0,j.jsx)(N.Slot,{scope:e.__scopeMenu,children:(0,j.jsx)(H,{id:c.contentId,"aria-labelledby":c.triggerId,...a,ref:u,align:`start`,side:s.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{s.isUsingKeyboardRef.current&&l.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:y(e.onFocusOutside,e=>{e.target!==c.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:y(e.onEscapeKeyDown,e=>{s.onClose(),e.preventDefault()}),onKeyDown:y(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=Se[s.dir].includes(e.key);t&&n&&(o.onOpenChange(!1),c.trigger?.focus(),e.preventDefault())})})})})})});ut.displayName=lt;function dt(e){return e?`open`:`closed`}function Y(e){return e===`indeterminate`}function ft(e){return Y(e)?`indeterminate`:e?`checked`:`unchecked`}function pt(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function mt(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function ht(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=mt(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function gt(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function _t(e,t){return t?gt({x:e.clientX,y:e.clientY},t):!1}function X(e){return t=>t.pointerType===`mouse`?e(t):void 0}var vt=ke,yt=R,bt=Ne,xt=Fe,St=U,Ct=Ve,wt=G,Tt=Ge,Et=Ye,Dt=Ze,Ot=et,kt=nt,At=it,jt=st,Mt=ct,Nt=ut,Z=`DropdownMenu`,[Pt,Ft]=c(Z,[Te]),Q=Te(),[It,Lt]=Pt(Z),Rt=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=Q(t),l=A.useRef(null),[d,f]=ae({prop:i,defaultProp:a??!1,onChange:o,caller:Z});return(0,j.jsx)(It,{scope:t,triggerId:u(),triggerRef:l,contentId:u(),open:d,onOpenChange:f,onOpenToggle:A.useCallback(()=>f(e=>!e),[f]),modal:s,children:(0,j.jsx)(vt,{...c,open:d,onOpenChange:f,dir:r,modal:s,children:n})})};Rt.displayName=Z;var zt=`DropdownMenuTrigger`,Bt=A.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:i=!1,...a}=e,o=Lt(zt,n),s=Q(n);return(0,j.jsx)(yt,{asChild:!0,...s,children:(0,j.jsx)(v.button,{type:`button`,id:o.triggerId,"aria-haspopup":`menu`,"aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?`open`:`closed`,"data-disabled":i?``:void 0,disabled:i,...a,ref:r(t,o.triggerRef),onPointerDown:y(e.onPointerDown,e=>{!i&&e.button===0&&e.ctrlKey===!1&&(o.onOpenToggle(),o.open||e.preventDefault())}),onKeyDown:y(e.onKeyDown,e=>{i||([`Enter`,` `].includes(e.key)&&o.onOpenToggle(),e.key===`ArrowDown`&&o.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});Bt.displayName=zt;var Vt=`DropdownMenuPortal`,Ht=e=>{let{__scopeDropdownMenu:t,...n}=e,r=Q(t);return(0,j.jsx)(bt,{...r,...n})};Ht.displayName=Vt;var Ut=`DropdownMenuContent`,Wt=A.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Lt(Ut,n),a=Q(n),o=A.useRef(!1);return(0,j.jsx)(xt,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:y(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:y(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Wt.displayName=Ut;var Gt=`DropdownMenuGroup`,Kt=A.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Q(n);return(0,j.jsx)(St,{...i,...r,ref:t})});Kt.displayName=Gt;var qt=`DropdownMenuLabel`,Jt=A.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Q(n);return(0,j.jsx)(Ct,{...i,...r,ref:t})});Jt.displayName=qt;var Yt=`DropdownMenuItem`,Xt=A.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Q(n);return(0,j.jsx)(wt,{...i,...r,ref:t})});Xt.displayName=Yt;var Zt=`DropdownMenuCheckboxItem`,Qt=A.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Q(n);return(0,j.jsx)(Tt,{...i,...r,ref:t})});Qt.displayName=Zt;var $t=`DropdownMenuRadioGroup`,en=A.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Q(n);return(0,j.jsx)(Et,{...i,...r,ref:t})});en.displayName=$t;var tn=`DropdownMenuRadioItem`,nn=A.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Q(n);return(0,j.jsx)(Dt,{...i,...r,ref:t})});nn.displayName=tn;var rn=`DropdownMenuItemIndicator`,an=A.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Q(n);return(0,j.jsx)(Ot,{...i,...r,ref:t})});an.displayName=rn;var on=`DropdownMenuSeparator`,sn=A.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Q(n);return(0,j.jsx)(kt,{...i,...r,ref:t})});sn.displayName=on;var cn=`DropdownMenuArrow`,ln=A.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Q(n);return(0,j.jsx)(At,{...i,...r,ref:t})});ln.displayName=cn;var un=e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:a}=e,o=Q(t),[s,c]=ae({prop:r,defaultProp:a??!1,onChange:i,caller:`DropdownMenuSub`});return(0,j.jsx)(jt,{...o,open:s,onOpenChange:c,children:n})},dn=`DropdownMenuSubTrigger`,fn=A.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Q(n);return(0,j.jsx)(Mt,{...i,...r,ref:t})});fn.displayName=dn;var pn=`DropdownMenuSubContent`,mn=A.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Q(n);return(0,j.jsx)(Nt,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});mn.displayName=pn;var hn=Rt,gn=Bt,_n=Ht,vn=Wt,yn=Kt,bn=Jt,xn=Xt,Sn=Qt,Cn=nn,wn=an,Tn=sn,En=un,Dn=fn,On=mn,$=n(),kn=hn,An=gn,jn=yn,Mn=ne(_n),Nn=h(vn),Pn=h(On),Fn=En,In=A.forwardRef((e,t)=>{let n=(0,$.c)(17),r,i,a,o,s;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4],s=n[5]):({className:i,inset:a,showChevron:s,children:r,...o}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o,n[5]=s);let c=s===void 0||s,l;n[6]!==i||n[7]!==a?(l=E({className:i,inset:a}),n[6]=i,n[7]=a,n[8]=l):l=n[8];let u;n[9]===c?u=n[10]:(u=c&&(0,j.jsx)(ge,{className:`ml-auto h-4 w-4`}),n[9]=c,n[10]=u);let d;return n[11]!==r||n[12]!==o||n[13]!==t||n[14]!==l||n[15]!==u?(d=(0,j.jsxs)(Dn,{ref:t,className:l,...o,children:[r,u]}),n[11]=r,n[12]=o,n[13]=t,n[14]=l,n[15]=u,n[16]=d):d=n[16],d});In.displayName=Dn.displayName;var Ln=A.forwardRef((e,t)=>{let n=(0,$.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=o(O({subcontent:!0}),`animate-in data-[side=bottom]:slide-in-from-top-1 data-[side=left]:slide-in-from-right-1 data-[side=right]:slide-in-from-left-1 data-[side=top]:slide-in-from-bottom-1`,r),n[3]=r,n[4]=a);let s;return n[5]!==i||n[6]!==t||n[7]!==a?(s=(0,j.jsx)(Pn,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=s):s=n[8],s});Ln.displayName=On.displayName;var Rn=A.forwardRef((e,t)=>{let n=(0,$.c)(17),r,i,a,s;n[0]===e?(r=n[1],i=n[2],a=n[3],s=n[4]):({className:r,scrollable:a,sideOffset:s,...i}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=s);let c=a===void 0||a,l=s===void 0?4:s,u;n[5]!==r||n[6]!==c?(u=o(O(),`animate-in data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 print:hidden`,c&&`overflow-auto`,r),n[5]=r,n[6]=c,n[7]=u):u=n[7];let d=c?`calc(var(--radix-dropdown-menu-content-available-height) - ${re}px)`:void 0,f;n[8]!==i.style||n[9]!==d?(f={...i.style,maxHeight:d},n[8]=i.style,n[9]=d,n[10]=f):f=n[10];let p;return n[11]!==i||n[12]!==t||n[13]!==l||n[14]!==u||n[15]!==f?(p=(0,j.jsx)(Mn,{children:(0,j.jsx)(te,{children:(0,j.jsx)(Nn,{ref:t,sideOffset:l,className:u,style:f,...i})})}),n[11]=i,n[12]=t,n[13]=l,n[14]=u,n[15]=f,n[16]=p):p=n[16],p});Rn.displayName=vn.displayName;var zn=A.forwardRef((e,t)=>{let n=(0,$.c)(13),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({className:r,inset:i,variant:o,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let s;n[5]!==r||n[6]!==i||n[7]!==o?(s=D({className:r,inset:i,variant:o}),n[5]=r,n[6]=i,n[7]=o,n[8]=s):s=n[8];let c;return n[9]!==a||n[10]!==t||n[11]!==s?(c=(0,j.jsx)(xn,{ref:t,className:s,...a}),n[9]=a,n[10]=t,n[11]=s,n[12]=c):c=n[12],c});zn.displayName=xn.displayName;var Bn=A.forwardRef((e,t)=>{let n=(0,$.c)(15),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({className:a,children:i,checked:r,...o}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let s;n[5]===a?s=n[6]:(s=C({className:a}),n[5]=a,n[6]=s);let c;n[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=ce(),n[7]=c):c=n[7];let l;n[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,j.jsx)(`span`,{className:c,children:(0,j.jsx)(wn,{children:(0,j.jsx)(he,{className:`h-4 w-4`})})}),n[8]=l):l=n[8];let u;return n[9]!==r||n[10]!==i||n[11]!==o||n[12]!==t||n[13]!==s?(u=(0,j.jsxs)(Sn,{ref:t,className:s,checked:r,...o,children:[l,i]}),n[9]=r,n[10]=i,n[11]=o,n[12]=t,n[13]=s,n[14]=u):u=n[14],u});Bn.displayName=Sn.displayName;var Vn=A.forwardRef((e,t)=>{let n=(0,$.c)(13),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:i,children:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o;n[4]===i?o=n[5]:(o=C({className:i}),n[4]=i,n[5]=o);let s;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=ce(),n[6]=s):s=n[6];let c;n[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,j.jsx)(`span`,{className:s,children:(0,j.jsx)(wn,{children:(0,j.jsx)(me,{className:`h-2 w-2 fill-current`})})}),n[7]=c):c=n[7];let l;return n[8]!==r||n[9]!==a||n[10]!==t||n[11]!==o?(l=(0,j.jsxs)(Cn,{ref:t,className:o,...a,children:[c,r]}),n[8]=r,n[9]=a,n[10]=t,n[11]=o,n[12]=l):l=n[12],l});Vn.displayName=Cn.displayName;var Hn=A.forwardRef((e,t)=>{let n=(0,$.c)(11),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:r,inset:i,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o;n[4]!==r||n[5]!==i?(o=ue({className:r,inset:i}),n[4]=r,n[5]=i,n[6]=o):o=n[6];let s;return n[7]!==a||n[8]!==t||n[9]!==o?(s=(0,j.jsx)(bn,{ref:t,className:o,...a}),n[7]=a,n[8]=t,n[9]=o,n[10]=s):s=n[10],s});Hn.displayName=bn.displayName;var Un=A.forwardRef((e,t)=>{let n=(0,$.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=w({className:r}),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,j.jsx)(Tn,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Un.displayName=Tn.displayName;var Wn=le;export{Te as A,Et as C,jt as D,kt as E,Nt as O,bt as S,vt as T,xt as _,zn as a,Ot as b,Un as c,Ln as d,In as f,Tt as g,At as h,jn as i,Mt as k,Wn as l,yt as m,Bn as n,Hn as o,An as p,Rn as r,Mn as s,kn as t,Fn as u,St as v,Dt as w,Ct as x,wt as y};
@@ -1 +0,0 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,f as n,l as r,t as i}from"./useEvent-xfs0Sn4r.js";import{t as a}from"./react-CBDbhulC.js";import{At as o,Cn as s,Co as c,D as l,Dt as u,Et as d,Mt as f,Ot as p,Sn as m,Tt as h,Wt as g,ii as _,jt as v,kn as y,kt as b,oa as x,vn as S,yo as C}from"./cells-BgH2MZS9.js";import{t as w}from"./compiler-runtime-CYIjoINj.js";import{g as T,p as E}from"./utils-B-_Wem_I.js";import{g as D}from"./useEventListener-92uWqz-P.js";import{t as O}from"./invariant-Ci2dTZ72.js";import{N as k,r as A}from"./config-BRRSKtP3.js";import{t as j}from"./cn-ldLVeaqm.js";import{t as M}from"./jsx-runtime-B74pBk57.js";import{r as N}from"./config-DnyziF11.js";import{o as P}from"./alert-dialog-BnNhUpVP.js";import{a as F,c as I,p as L,r as R,t as z}from"./dropdown-menu-B-ZAV5lw.js";import{Lt as B,a as V,g as H,i as U,o as W,s as G}from"./JsonOutput-COWoYBdx.js";import{c as K,n as q,r as ee}from"./download-C4umhthc.js";import{t as J}from"./tooltip-BO5vfMvm.js";import{t as Y}from"./button-Dh8EwhsF.js";import{Tt as te}from"./dist-BtC9ym6k.js";import{n as X,r as ne,t as re}from"./requests-C6_IaFh7.js";import{t as Z}from"./createLucideIcon-B7HeEoG2.js";import{t as ie}from"./arrow-left-DrqK6gPp.js";import{n as ae}from"./LazyAnyLanguageCodeMirror-nhd5JrSb.js";import{r as oe}from"./useNumberFormatter-DHJ9s6Vk.js";import{a as se,i as ce,n as le,r as ue,t as de}from"./tree-actions-CzmLf39g.js";import{a as fe}from"./markdown-renderer-zZh3O1Hm.js";import{u as pe}from"./toDate-hGYJX0Ha.js";import{t as me}from"./copy-BMXKNElG.js";import{t as he}from"./external-link-Bp3BxyRA.js";import{a as ge,i as _e,n as ve,r as ye,t as be}from"./file-icons-C0Mf_Axb.js";import{t as xe}from"./file-DF8n85RA.js";import{n as Se,t as Ce}from"./components-DAhqHptJ.js";import{b as we}from"./write-secret-modal-GHpJRc36.js";import{n as Te,t as Ee}from"./spinner-Ck-Hgfvj.js";import{a as De,c as Oe,d as ke,f as Ae,i as je,l as Me,n as Ne,r as Pe,t as Fe,u as Ie}from"./file-name-input-DmwIfRLx.js";import{t as Le}from"./refresh-cw-Bf-rx_aV.js";import{t as Re}from"./save-BybsbOKz.js";import{t as ze}from"./triangle-alert-MihykDYG.js";import{n as Be,t as Ve}from"./es-DP79Qs0u.js";import{t as He}from"./use-toast-DpWHUGuF.js";import{n as Ue,t as We}from"./paths-zcL04qUW.js";import{t as Ge}from"./context-Do8M9TDF.js";import{n as Ke}from"./useAsyncData-Buhk-UgR.js";import{n as qe}from"./copy-DlEomWzI.js";import{t as Je}from"./copy-icon-D522mvZL.js";import{t as Ye}from"./blob-B82D3b64.js";import{a as Xe}from"./errors-DzO-nXy-.js";import{n as Ze,t as Qe}from"./alert-dmKwNsrp.js";import{n as $e}from"./error-banner-C5aiAh3q.js";import{a as et}from"./renderShortcut-BnBOGXqJ.js";import{t as tt}from"./bundle.esm-DzY74mzC.js";import{t as nt}from"./useAddCell-DuzEVBJj.js";import{n as rt}from"./pathUtils-Cryrlpma.js";import{n as it}from"./semaphore-BjoL5P0h.js";import{t as at}from"./empty-state-kWyb5dCS.js";import{t as ot}from"./formatting-BWZH2nBg.js";import{a as st,i as ct,n as lt,o as ut,r as dt,s as ft,t as pt}from"./components-CtHLnRet.js";import{n as mt,t as ht}from"./marimo-icons-C3KxMV9A.js";import{t as gt}from"./links-DLvOXyO_.js";import{n as _t}from"./panel-accordion-state-9kdNootf.js";var vt=Z(`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`}]]),yt=Z(`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`}]]),bt=Z(`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`}]]),xt=Z(`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`}]]),St=Z(`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`}]]),Ct=Z(`folder-root`,[[`path`,{d:`M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z`,key:`1fr9dc`}],[`circle`,{cx:`12`,cy:`13`,r:`2`,key:`1c1ljs`}],[`path`,{d:`M12 15v5`,key:`11xva1`}]]),wt=Z(`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=Z(`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=Z(`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`}]]),Q=e(a(),1),Dt=w(),$=M(),Ot=e=>{let t=(0,Dt.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)(ie,{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)(Le,{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)(B,{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},kt=new Set([`http`,`file`,`in-memory`]);function At(e){return JSON.stringify(e).slice(1,-1)}var jt=new Set([`datasets`,`spaces`,`buckets`]);function Mt(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&&!jt.has(t[0])?{repoType:`model`,repoId:`${t[0]}/${t[1]}`,filename:t.slice(2).join(`/`)}:null}function Nt(e){return`from huggingface_hub import hf_hub_download\n\nlocal_path = hf_hub_download(\n repo_id="${At(e.repoId)}",\n filename="${At(e.filename)}",\n repo_type="${At(e.repoType)}",\n)`}var Pt=[{id:`read-file`,label:`Insert read snippet`,icon:vt,getCode:e=>{if(e.entry.kind===`directory`)return null;let t=At(e.entry.path);if(e.backendType===`huggingface`){let t=Mt(e.entry.path);return t?`${Nt(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:xt,getCode:e=>{if(e.entry.kind===`directory`)return null;let t=At(e.entry.path);if(e.backendType===`huggingface`){let t=Mt(e.entry.path);return t?`${Nt(t)}\nlocal_path`:null}if(e.backendType===`obstore`)return kt.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=At(e.entry.path.split(`/`).pop()||`download`);return`${e.variableName}.get("${t}", "${n}")`}}],Ft=104857600;function It(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.split(`/`);return n[n.length-1]||t}var Lt=e=>{let t=(0,Dt.c)(83),{entry:n,namespace:r,protocol:i,backendType:a,onBack:o}=e,{locale:s}=Ge(),c=nt(),l;t[0]===n.path?l=t[1]:(l=It(n.path),t[0]=n.path,t[1]=l);let u=l,d=n.mimeType||`text/plain`,p;t[2]===d?p=t[3]:(p=G(d),t[2]=d,t[3]=p);let m=p,h=m&&n.size>Ft&&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 f.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}=Ke(g,_),S;t[10]!==n.path||t[11]!==u||t[12]!==r?(S=async()=>{try{let e=await f.request({namespace:r,path:n.path});if(e.error){He({title:`Download failed`,description:e.error,variant:`danger`});return}e.url&&ee(e.url,e.filename??u)}catch(e){let t=e;D.error(`Failed to download storage entry`,t),He({title:`Download failed`,description:String(t),variant:`danger`})}},t[10]=n.path,t[11]=u,t[12]=r,t[13]=S):S=t[13];let C=S,w;t[14]!==c||t[15]!==a||t[16]!==n||t[17]!==r||t[18]!==i?(w=Pt.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:()=>c(t),"aria-label":e.label,children:(0,$.jsx)(o,{className:`h-3.5 w-3.5`})})},e.id)}),t[14]=c,t[15]=a,t[16]=n,t[17]=r,t[18]=i,t[19]=w):w=t[19];let T=w,E;t[20]===u?E=t[21]:(E=_e(u),t[20]=u,t[21]=E);let O;t[22]!==C||t[23]!==u||t[24]!==o||t[25]!==T||t[26]!==E?(O=(0,$.jsx)(Ot,{filename:u,filenameIcon:E,onBack:o,onDownload:C,actions:T}),t[22]=C,t[23]=u,t[24]=o,t[25]=T,t[26]=E,t[27]=O):O=t[27];let k=O,A;t[28]!==n.lastModified||t[29]!==n.path||t[30]!==n.size||t[31]!==s||t[32]!==d?(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)(Je,{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:d}),n.size>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`text-muted-foreground font-medium`,children:`Size`}),(0,$.jsx)(`span`,{children:ot(n.size,s)})]}),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]=s,t[32]=d,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]!==s?(r=ot(n.size,s),t[36]=n.size,t[37]=s,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)(Te,{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)(Le,{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]!==d||t[69]!==u||t[70]!==n||t[71]!==r?(i=(0,$.jsx)(U,{mimeType:d,filename:u,contents:n,mediaSource:r}),t[68]=d,t[69]=u,t[70]=n,t[71]=r,t[72]=i):i=t[72];let a;return t[73]!==k||t[74]!==e||t[75]!==i?(a=(0,$.jsxs)(`div`,{className:`flex flex-col h-full`,children:[k,e,i]}),t[73]=k,t[74]=e,t[75]=i,t[76]=a):a=t[76],a}let M;t[77]===j?M=t[78]:(M=j({includeMime:!0}),t[77]=j,t[78]=M);let N;t[79]===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)(xe,{className:`h-4 w-4`}),`Preview not available for this file type.`]}),t[79]=N):N=t[79];let P;return t[80]!==k||t[81]!==M?(P=(0,$.jsxs)(`div`,{className:`flex flex-col h-full`,children:[k,M,N]}),t[80]=k,t[81]=M,t[82]=P):P=t[82],P},Rt=16;function zt(e){return{paddingLeft:e*Rt}}function Bt(e,t){return new Date(e*1e3).toLocaleDateString(t,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function Vt(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.split(`/`);return n[n.length-1]||t}function Ht(e){return e.endsWith(`/`)?e:`${e}/`}function Ut(e,t){let n=e.metadata?.id;return typeof n==`string`&&n.length>0?n:`${e.path}::${t}`}function Wt(e,{namespace:t,searchValue:n,entriesByPath:r}){let i=n.trim().toLowerCase(),a=e.path.toLowerCase();if(Vt(e.path).toLowerCase().includes(i)||a.includes(i))return!0;if(e.kind===`directory`){let i=r.get(v(t,Ht(e.path)));if(i)return i.some(e=>Wt(e,{namespace:t,searchValue:n,entriesByPath:r}))}return!1}function Gt(e,t){return t.searchValue.trim()?e.filter(e=>Wt(e,t)):e}var Kt=5;function qt(e){return{query:e,status:`idle`}}function Jt(e){return e.status===`idle`||e.status===`error`||e.status===`capped`}function Yt(e,t,n){return t.get(e)===void 0||n.get(e)?.nextPageToken!=null}function Xt({hasSearch:e,hasLoadedMatches:t,isPending:n,remoteSearch:r,searchKey:i,entriesByPath:a,pageMetadataByPath:o}){return!e||t||n||!Jt(r)?!1:Yt(i,a,o)}function Zt(e){let t=e.trim(),n=t.lastIndexOf(`/`);return n===-1?``:t.slice(0,n+1)}function Qt(e,t){let n=t.trim().toLowerCase();return!n||e.path.toLowerCase().includes(n)||Vt(e.path).toLowerCase().includes(n)}var $t=e=>{let t=(0,Dt.c)(15),{depth:n,isLoading:r,error:i,onLoadMore:a}=e,o;t[0]===n?o=t[1]:(o=zt(n),t[0]=n,t[1]=o);let s;t[2]===r?s=t[3]:(s=r&&(0,$.jsx)(Te,{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},en=e=>{let t=(0,Dt.c)(44),{namespace:n,protocol:r,rootPath:i,backendType:a,prefix:o,depth:s,locale:c,searchValue:l,onOpenFile:d}=e,{entriesByPath:f}=u(),{entries:p,isPending:m,error:h,hasMore:g,loadMore:_,isLoadingMore:v,loadMoreError:y}=b(n,o);if(m){let e;t[0]===s?e=t[1]:(e=zt(s),t[0]=s,t[1]=e);let n;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(Te,{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(h){let e;t[5]===s?e=t[6]:(e=zt(s),t[5]=s,t[6]=e);let n;return t[7]!==h.message||t[8]!==e?(n=(0,$.jsxs)(`div`,{className:`py-1 text-xs text-destructive`,style:e,children:[`Failed to load: `,h.message]}),t[7]=h.message,t[8]=e,t[9]=n):n=t[9],n}if(p.length===0){let e;t[10]===s?e=t[11]:(e=zt(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=Gt(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=Ut(e,p.indexOf(e));return(0,$.jsx)(tn,{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]!==g||t[37]!==v||t[38]!==_||t[39]!==y?(S=g&&(0,$.jsx)($t,{depth:s,isLoading:v,error:y,onLoadMore:_}),t[35]=s,t[36]=g,t[37]=v,t[38]=_,t[39]=y,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},tn=e=>{let t=(0,Dt.c)(115),{entry:n,rowKey:r,namespace:i,protocol:a,rootPath:o,backendType:c,depth:l,locale:d,searchValue:p,onOpenFile:m}=e,[h,g]=(0,Q.useState)(!1),{entriesByPath:_}=u(),y=nt(),b=n.kind===`directory`,x,S,C,w,T,E,O,k,A,M,N;if(t[0]!==c||t[1]!==l||t[2]!==_||t[3]!==n||t[4]!==b||t[5]!==h||t[6]!==i||t[7]!==m||t[8]!==a||t[9]!==r||t[10]!==p){w=Vt(n.path);let e;t[22]===p?e=t[23]:(e=p.trim(),t[22]=p,t[23]=e);let o=!!e;T=b&&o&&w.toLowerCase().includes(p.trim().toLowerCase());let u;t[24]!==_||t[25]!==n.path||t[26]!==o||t[27]!==b||t[28]!==i||t[29]!==p?(u=b&&o&&!!_.get(v(i,Ht(n.path)))?.some(e=>Wt(e,{namespace:i,searchValue:p,entriesByPath:_})),t[24]=_,t[25]=n.path,t[26]=o,t[27]=b,t[28]=i,t[29]=p,t[30]=u):u=t[30],S=h||u;let d;t[31]!==n.path||t[32]!==i?(d=async()=>{try{let e=await f.request({namespace:i,path:n.path});if(e.error){He({title:`Download failed`,description:e.error,variant:`danger`});return}e.url&&ee(e.url,e.filename??`download`)}catch(e){let t=e;D.error(`Failed to download storage entry`,t),He({title:`Download failed`,description:String(t),variant:`danger`})}},t[31]=n.path,t[32]=i,t[33]=d):d=t[33],C=d,x=s;let y=b&&`font-medium`;t[34]===y?E=t[35]:(E=j(`text-xs flex items-center gap-1.5 cursor-pointer rounded-none group h-6.5`,y),t[34]=y,t[35]=E),t[36]===l?O=t[37]:(O=zt(l),t[36]=l,t[37]=O),k=`${i}:${r}`,t[38]!==c||t[39]!==S||t[40]!==n||t[41]!==b||t[42]!==i||t[43]!==m||t[44]!==a?(A=()=>{b?g(!S):m({entry:n,namespace:i,protocol:a,backendType:c})},t[38]=c,t[39]=S,t[40]=n,t[41]=b,t[42]=i,t[43]=m,t[44]=a,t[45]=A):A=t[45],t[46]!==S||t[47]!==b?(M=b?(0,$.jsx)(ce,{isExpanded:S,className:`h-3 w-3`}):(0,$.jsx)(`span`,{className:`w-3 shrink-0`}),t[46]=S,t[47]=b,t[48]=M):M=t[48],N=b?(0,$.jsx)(ge,{className:j(`h-3.5 w-3.5 shrink-0`,ve.directory)}):_e(w),t[0]=c,t[1]=l,t[2]=_,t[3]=n,t[4]=b,t[5]=h,t[6]=i,t[7]=m,t[8]=a,t[9]=r,t[10]=p,t[11]=x,t[12]=S,t[13]=C,t[14]=w,t[15]=T,t[16]=E,t[17]=O,t[18]=k,t[19]=A,t[20]=M,t[21]=N}else x=t[11],S=t[12],C=t[13],w=t[14],T=t[15],E=t[16],O=t[17],k=t[18],A=t[19],M=t[20],N=t[21];let P;t[49]===w?P=t[50]:(P=(0,$.jsx)(`span`,{className:`truncate flex-1 text-left`,children:w}),t[49]=w,t[50]=P);let V;t[51]!==n.size||t[52]!==d?(V=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:ot(n.size,d)}),t[51]=n.size,t[52]=d,t[53]=V):V=t[53];let H;t[54]!==n.lastModified||t[55]!==d?(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:Bt(n.lastModified,d)})}),t[54]=n.lastModified,t[55]=d,t[56]=H):H=t[56];let U;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,$.jsx)(L,{asChild:!0,children:(0,$.jsx)(le,{iconClassName:`h-3 w-3`,onClick:an})}),t[57]=U):U=t[57];let W;t[58]!==c||t[59]!==n||t[60]!==b||t[61]!==i||t[62]!==m||t[63]!==a?(W=!b&&(0,$.jsxs)(F,{onSelect:()=>m({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]=b,t[61]=i,t[62]=m,t[63]=a,t[64]=W):W=t[64];let G;t[65]===n.path?G=t[66]:(G=async()=>{await qe(n.path),He({title:`Copied to clipboard`})},t[65]=n.path,t[66]=G);let K;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,$.jsx)(me,{className:de}),t[67]=K):K=t[67];let q;t[68]===G?q=t[69]:(q=(0,$.jsxs)(F,{onSelect:G,children:[K,`Copy path`]}),t[68]=G,t[69]=q);let Y;t[70]!==C||t[71]!==b?(Y=!b&&(0,$.jsxs)(F,{onSelect:()=>C(),children:[(0,$.jsx)(B,{className:`h-3.5 w-3.5 mr-2`}),`Download`]}),t[70]=C,t[71]=b,t[72]=Y):Y=t[72];let te;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,$.jsx)(I,{}),t[73]=te):te=t[73];let X;t[74]!==y||t[75]!==c||t[76]!==n||t[77]!==i||t[78]!==a?(X=Pt.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)(F,{onSelect:()=>y(t),children:[(0,$.jsx)(r,{className:de}),e.label]},e.id)}),t[74]=y,t[75]=c,t[76]=n,t[77]=i,t[78]=a,t[79]=X):X=t[79];let ne;t[80]!==W||t[81]!==q||t[82]!==Y||t[83]!==X?(ne=(0,$.jsxs)(z,{children:[U,(0,$.jsxs)(R,{align:`end`,onClick:on,onCloseAutoFocus:sn,children:[W,q,Y,te,X]})]}),t[80]=W,t[81]=q,t[82]=Y,t[83]=X,t[84]=ne):ne=t[84];let re;t[85]!==ne||t[86]!==V||t[87]!==H?(re=(0,$.jsxs)(`div`,{className:`flex items-center`,children:[V,H,ne]}),t[85]=ne,t[86]=V,t[87]=H,t[88]=re):re=t[88];let Z;t[89]!==x||t[90]!==E||t[91]!==re||t[92]!==O||t[93]!==k||t[94]!==A||t[95]!==M||t[96]!==N||t[97]!==P?(Z=(0,$.jsxs)(x,{className:E,style:O,value:k,onSelect:A,children:[M,N,P,re]}),t[89]=x,t[90]=E,t[91]=re,t[92]=O,t[93]=k,t[94]=A,t[95]=M,t[96]=N,t[97]=P,t[98]=Z):Z=t[98];let ie;t[99]!==c||t[100]!==l||t[101]!==S||t[102]!==n.path||t[103]!==b||t[104]!==d||t[105]!==i||t[106]!==m||t[107]!==a||t[108]!==o||t[109]!==p||t[110]!==T?(ie=b&&S&&(0,$.jsx)(en,{namespace:i,protocol:a,rootPath:o,backendType:c,prefix:Ht(n.path),depth:l+1,locale:d,searchValue:T?``:p,onOpenFile:m}),t[99]=c,t[100]=l,t[101]=S,t[102]=n.path,t[103]=b,t[104]=d,t[105]=i,t[106]=m,t[107]=a,t[108]=o,t[109]=p,t[110]=T,t[111]=ie):ie=t[111];let ae;return t[112]!==Z||t[113]!==ie?(ae=(0,$.jsxs)($.Fragment,{children:[Z,ie]}),t[112]=Z,t[113]=ie,t[114]=ae):ae=t[114],ae},nn=e=>{let t=(0,Dt.c)(66),{namespace:n,locale:r,searchValue:i,remoteSearch:a,onContinueRemoteSearch:o,onOpenFile:c}=e,[l,d]=(0,Q.useState)(!0),{entriesByPath:f,pageMetadataByPath:m}=u(),{clearNamespaceCache:h}=p(),g=n.name??n.displayName,{entries:_,isPending:y,error:x,hasMore:S,loadMore:C,isLoadingMore:w,loadMoreError:T,refetch:E}=b(g),D;t[0]!==h||t[1]!==g||t[2]!==E?(D=e=>{e.stopPropagation(),h(g),E()},t[0]=h,t[1]=g,t[2]=E,t[3]=D):D=t[3];let O=D,k=y?n.storageEntries:_,A;if(t[4]!==k||t[5]!==f||t[6]!==x||t[7]!==O||t[8]!==S||t[9]!==l||t[10]!==w||t[11]!==y||t[12]!==C||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]!==c||t[23]!==m||t[24]!==a||t[25]!==i){let e=Gt(k,{namespace:g,searchValue:i,entriesByPath:f}),u=Zt(i),p=v(g,u),h=u===``?[]:f.get(p)??[],_=Gt(h,{namespace:g,searchValue:i,entriesByPath:f}),b;t[27]===i?b=t[28]:(b=i.trim(),t[27]=i,t[28]=b);let E=!!b,D=e.length>0||_.length>0,j=u!==``&&Xt({hasSearch:E,hasLoadedMatches:D,isPending:y,remoteSearch:a,searchKey:p,entriesByPath:f,pageMetadataByPath:m}),M=E&&e.length===0,N;bb0:{if(y&&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)(Te,{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)(Te,{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&&!y&&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]===l?F=t[44]:(F=()=>d(!l),t[43]=l,t[44]=F);let I;t[45]===l?I=t[46]:(I=(0,$.jsx)(ce,{isExpanded:l,className:`h-3 w-3`}),t[45]=l,t[46]=I);let L;t[47]===n.protocol?L=t[48]:(L=(0,$.jsx)(Ce,{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)(ft,{variableName:n.name}),`)`]}),t[51]=n.name,t[52]=z);let B;t[53]===O?B=t[54]:(B=(0,$.jsx)(ue,{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)`,U;t[55]===V?U=t[56]:(U=(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground font-normal tabular-nums ml-auto`,children:V}),t[55]=V,t[56]=U);let W;t[57]!==n.name||t[58]!==B||t[59]!==U||t[60]!==F||t[61]!==I||t[62]!==L||t[63]!==R||t[64]!==z?(W=(0,$.jsxs)(s,{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,U]}),t[57]=n.name,t[58]=B,t[59]=U,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,l&&(0,$.jsxs)($.Fragment,{children:[x&&k.length===0&&(0,$.jsx)(H,{error:x,style:zt(1),className:`py-1 text-xs h-auto overflow-auto max-h-32 items-start`,showIcon:!1}),!x&&P&&(0,$.jsx)(`div`,{className:`py-1 text-xs text-muted-foreground italic`,style:zt(1),children:P}),e.map(e=>{let t=Ut(e,k.indexOf(e));return(0,$.jsx)(tn,{rowKey:t,entry:e,namespace:g,protocol:n.protocol,rootPath:n.rootPath,backendType:n.backendType,depth:1,locale:r,searchValue:i,onOpenFile:c},t)}),M&&_.map(e=>{let t=Ut(e,h.indexOf(e));return(0,$.jsx)(tn,{rowKey:`remote-search:${t}`,entry:e,namespace:g,protocol:n.protocol,rootPath:n.rootPath,backendType:n.backendType,depth:1,locale:r,searchValue:i,onOpenFile:c},`remote-search:${t}`)}),S&&!j&&(0,$.jsx)($t,{depth:1,isLoading:w,error:T,onLoadMore:C})]})]}),t[4]=k,t[5]=f,t[6]=x,t[7]=O,t[8]=S,t[9]=l,t[10]=w,t[11]=y,t[12]=C,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]=c,t[23]=m,t[24]=a,t[25]=i,t[26]=A}else A=t[26];return A},rn=()=>{let e=(0,Dt.c)(63),{namespaces:t,entriesByPath:n,pageMetadataByPath:r}=u(),{locale:i}=Ge(),[a,s]=(0,Q.useState)(``),c;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(c={},e[0]=c):c=e[0];let[l,d]=(0,Q.useState)(c),[f,p]=(0,Q.useState)(null),h=o(),g;e[1]===a?g=e[2]:(g=a.trim(),e[1]=a,e[2]=g);let _=!!g,b;e[3]===a?b=e[4]:(b=a.trim(),e[3]=a,e[4]=b);let x=b,C;e[5]!==x||e[6]!==l?(C=e=>{let t=l[e];return t?.query===x?t:qt(x)},e[5]=x,e[6]=l,e[7]=C):C=e[7];let w=C,T;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(T=(e,t)=>{d(n=>({...n,[e]:t}))},e[8]=T):T=e[8];let E=T,D;e[9]!==x||e[10]!==n||e[11]!==r||e[12]!==w?(D=e=>{if(!x)return!1;let t=e.name??e.displayName,i=Zt(x);if(i===``||!Jt(w(t))||Gt(n.get(v(t,``))??e.storageEntries,{namespace:t,searchValue:x,entriesByPath:n}).length>0)return!1;let a=v(t,i);return Gt(n.get(a)??[],{namespace:t,searchValue:x,entriesByPath:n}).length>0?!1:Yt(a,n,r)},e[9]=x,e[10]=n,e[11]=r,e[12]=w,e[13]=D):D=e[13];let O=D,k;e[14]!==O||e[15]!==x||e[16]!==n||e[17]!==h||e[18]!==r?(k=async e=>{if(!O(e))return;let t=x,i=e.name??e.displayName,a=Zt(t),o=v(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<Kt;e++){let e=!l||c!==null,n=[];if(e){let e=await h({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=>Qt(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]=x,e[16]=n,e[17]=h,e[18]=r,e[19]=k):k=e[19];let A=k,M;e[20]!==O||e[21]!==A||e[22]!==t?(M=()=>{let e=t.filter(O);for(let t of e)A(t)},e[20]=O,e[21]=A,e[22]=t,e[23]=M):M=e[23];let N=M;if(t.length===0){let t;return e[24]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(at,{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)(ut,{group:`storage`,label:`Add remote storage`,variant:`outline`,size:`sm`}),icon:(0,$.jsx)(Se,{className:`h-8 w-8`})}),e[24]=t):t=e[24],t}let P;e[25]===f?P=e[26]:(P=f&&(0,$.jsx)(Lt,{entry:f.entry,namespace:f.namespace,protocol:f.protocol,backendType:f.backendType,onBack:()=>p(null)}),e[25]=f,e[26]=P);let F=f&&`hidden`,I;e[27]===F?I=e[28]:(I=j(`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)(m,{placeholder:`Search entries...`,className:`h-6 m-1`,value:a,onValueChange:s,onKeyDown:L,rootClassName:`flex-1 border-b-0`}),e[33]=a,e[34]=L,e[35]=R):R=e[35];let z;e[36]===_?z=e[37]:(z=_&&(0,$.jsx)(Y,{variant:`text`,size:`xs`,className:`float-right border-none px-2 m-0 h-full`,onClick:()=>s(``),children:(0,$.jsx)(oe,{className:`h-4 w-4`})}),e[36]=_,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)(pe,{className:`h-3.5 w-3.5 shrink-0 cursor-help text-muted-foreground hover:text-foreground mr-2`})}),V=(0,$.jsx)(ut,{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)(nn,{namespace:e,locale:i,searchValue:a,remoteSearch:w(t),onContinueRemoteSearch:()=>void A(e),onOpenFile:p},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)(y,{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)(S,{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 an(e){return e.stopPropagation()}function on(e){return e.stopPropagation()}function sn(e){return e.preventDefault()}var cn=(0,Q.createContext)(null);function ln(){return(0,Q.useContext)(cn)??void 0}var un=e=>{let t=(0,Dt.c)(3),{children:n}=e,r=ke(),i;return t[0]!==n||t[1]!==r?(i=(0,$.jsx)(cn.Provider,{value:r,children:n}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i},dn=e=>{let t=(0,Dt.c)(5),{children:n}=e,[r,i]=(0,Q.useState)(null),a;t[0]!==n||t[1]!==r?(a=r&&(0,$.jsx)(Ae,{backend:Ie,options:{rootElement:r},children:(0,$.jsx)(un,{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 fn(e,t){if(!k()){let n=A().formatNavigableHttpURL(`api/files/download`,new URLSearchParams({path:e}));ee(n.toString(),t);return}let n=await re().sendFileDetails({path:e});if(n.isBase64&&n.contents){let e=Ye(fe(n.contents,n.mimeType||`application/octet-stream`));q(e,t)}else q(new Blob([n.contents||``],{type:n.mimeType||`application/octet-stream`}),t)}var pn=e=>{let t=(0,Dt.c)(21),{file:n,mimeType:r,message:i,onDownload:a}=e,{locale:o}=Ge(),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:ot(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)(B,{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 mn(e,t){let n=e||`text/plain`;return G(n)?`media`:t?`unsupported`:n===`text/csv`?`csv`:n.startsWith(`text/`)||n!=="default"&&n in V||e==null?`text`:`unsupported`}var hn=10485760,gn=new Map,_n=({file:e,onOpenNotebook:t})=>{let{sendFileDetails:n,sendUpdateFile:i}=ne(),a=r(T),o=r(E),s=r(C),[c,l]=(0,Q.useState)(``),{data:u,isPending:d,error:f,setData:p,refetch:m}=Ke(async()=>{let t=await n({path:e.path,maxBytes:hn}),r=mn(t.mimeType,t.isBase64);if(!t.isTooLarge&&r===`text`){let n=t.contents||``;l(gn.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,Q.useRef)(c);if(g.current=c,(0,Q.useEffect)(()=>()=>{if(u?.contents==null||u.isTooLarge||mn(u.mimeType,u.isBase64)!==`text`)return;let t=g.current;t===u.contents?gn.delete(e.path):gn.set(e.path,t)},[e.path,u?.contents,u?.isTooLarge,u?.mimeType,u?.isBase64]),f)return(0,$.jsx)($e,{error:f});if(d||!u)return null;let _=u.mimeType||`text/plain`,v=mn(u.mimeType,u.isBase64),y=v===`text`,b=v===`csv`,x=v===`media`,S=s&&u.file.isMarimoFile&&(e.path===s||e.path.endsWith(`/${s}`)),w=async()=>{await fn(e.path,u.file.name)},D=te.of([{key:a.getHotkey(`global.save`).key,stopPropagation:!0,run:()=>c!==u.contents&&(h(),!0)}]),O=(0,$.jsx)(Ot,{filename:u.file.name,onRefresh:m,onDownload:o?void 0:w,actions:(0,$.jsxs)($.Fragment,{children:[e.isMarimoFile&&t&&!k()&&(0,$.jsx)(J,{content:`Open notebook`,children:(0,$.jsx)(Y,{variant:`text`,size:`xs`,onClick:e=>t(e),children:(0,$.jsx)(he,{className:`h-3.5 w-3.5`})})}),y&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{content:`Copy contents to clipboard`,children:(0,$.jsx)(Y,{variant:`text`,size:`xs`,onClick:async()=>{await qe(c)},children:(0,$.jsx)(me,{className:`h-3.5 w-3.5`})})}),(0,$.jsx)(J,{content:et(`global.save`),children:(0,$.jsx)(Y,{variant:`text`,size:`xs`,onClick:h,disabled:c===u.contents,children:(0,$.jsx)(Re,{className:`h-3.5 w-3.5`})})})]})]})});if(u.isTooLarge||v===`unsupported`)return(0,$.jsxs)($.Fragment,{children:[O,(0,$.jsx)(pn,{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 A=y&&S&&(0,$.jsxs)(Qe,{variant:`warning`,className:`rounded-none`,children:[(0,$.jsx)(ze,{className:`h-4 w-4`}),(0,$.jsx)(Ze,{children:`Editing the notebook file directly while running in marimo's editor may cause unintended changes. Please use with caution.`})]}),j=x&&u.contents?W({contents:u.contents,mimeType:_,isBase64:u.isBase64??!1}):void 0;return(0,$.jsxs)($.Fragment,{children:[O,A,(0,$.jsx)(U,{mimeType:_,filename:u.file.name,contents:y?c:b?u.contents??void 0:void 0,mediaSource:j,readOnly:!y,onChange:y?l:void 0,extensions:y?[D]:[]})]})},vn=n(e=>{let t=e(X);return O(t,`no requestClientAtom set`),new Oe({getRoots:t.getFileRoots,listFiles:t.sendListFiles,createFileOrFolder:t.sendCreateFileOrFolder,deleteFileOrFolder:t.sendDeleteFileOrFolder,copyFileOrFolder:t.sendCopyFileOrFolder,renameFileOrFolder:t.sendRenameFileOrFolder})}),yn=n({}),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,wn=`data-file-explorer-directory-path`;function Tn(e){let{destinationPath:t,getDestinationLabel:n=e=>e,onUploadStart:r,refreshDestination:i,...a}=e,{sendCreateFileOrFolder:o}=ne();return Ve({multiple:!0,maxSize:Sn,...a,onError:e=>{D.error(e),He({title:`File upload failed`,description:e.message,variant:`danger`})},onDropRejected:e=>{He({title:`File upload failed`,description:(0,$.jsx)(`div`,{className:`flex flex-col gap-1`,children:e.map(e=>(0,$.jsxs)(`div`,{children:[e.file.name,` (`,e.errors.map(e=>e.message).join(`, `),`)`]},e.file.name))}),variant:`danger`})},onDrop:async(e,a,s)=>{if(e.length===0)return;let c=typeof t==`function`?t(s):t,l=n(c),u=e.length===1?`Uploading file to ${l}...`:`Uploading files to ${l}...`;r?.(c,e);let d;try{d=await K(u,async t=>(t.addTotal(e.length),En({files:e,destinationPath:c,createFile:o,onFileProcessed:()=>t.increment(1)})))}catch{await i(c);return}await i(c),kn(d,l)}})}async function En({files:e,destinationPath:t,createFile:n,onFileProcessed:r}){let i=await it(e,Cn,async e=>{try{return{file:e,response:await n({path:Dn({destinationPath:t,filePath:jn(An(e))}),type:`file`,name:e.name,file:e})}}catch(t){return{file:e,response:{success:!1,message:Xe(t)}}}finally{r?.()}});return{successful:i.filter(({response:e})=>e.success),failed:i.filter(({response:e})=>!e.success)}}function Dn({destinationPath:e,filePath:t}){if(!t)return e;if(Ue.isAbsolute(t))throw Error(`Upload path must be relative: ${t}`);let n=t.split(/[\\/]+/).slice(0,-1).filter(Boolean);if(n.includes(`..`))throw Error(`Upload path cannot contain parent traversal: ${t}`);let r=n.filter(e=>e!==`.`);if(r.length===0)return e;let i=We.guessDeliminator(e),a=r.join(i.deliminator);return i.join(e,a)}function On(e,t){return e instanceof Element&&e.closest(`[${wn}]`)?.getAttribute(wn)||t}function kn(e,t){let n=e.successful.length+e.failed.length;if(e.failed.length>0){let r;r=e.successful.length===0?n===1?`File upload failed`:`Files failed to upload`:`${e.successful.length} of ${n} files uploaded`,He({title:r,description:(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsxs)(`div`,{children:[`Destination: `,t,`.`]}),e.failed.map(({file:e,response:t},n)=>(0,$.jsxs)(`div`,{children:[e.name,`:`,` `,t.message||`The server rejected the upload.`]},`${e.name}-${n}`))]}),variant:`danger`});return}let r=e.successful.filter(({file:e,response:t})=>t.info?.name&&t.info.name!==e.name);He({title:n===1?`File uploaded`:`${n} files uploaded`,description:r.length===0?`Uploaded to ${t}.`:(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsxs)(`div`,{children:[`Uploaded to `,t,`.`]}),r.map(({file:e,response:t},n)=>(0,$.jsxs)(`div`,{children:[e.name,` was saved as `,t.info?.name,`.`]},`${e.name}-${n}`))]})})}function An(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 jn(e){if(e)return e.replace(/^\/+/,``)}var Mn=c(`marimo:showHiddenFiles`,!0,_,{getOnInit:!0}),Nn=Q.createContext(null),Pn=e=>{let n=(0,Dt.c)(110),{height:r,externalDropDestinationPath:a}=e,o=a===void 0?null:a,s=(0,Q.useRef)(null),c=ln(),[l]=t(vn),u;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=[],n[0]=u):u=n[0];let[d,f]=(0,Q.useState)(u),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(null),[_,v]=t(Mn),[y,b]=t(yn),x;n[1]===l?x=n[2]:(x=e=>l.refreshPath(e),n[1]=l,n[2]=x);let S=i(x),C=(0,Q.useRef)(``),w;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(w=()=>C.current,n[3]=w):w=n[3];let T;n[4]===l?T=n[5]:(T=e=>Vn(l,e),n[4]=l,n[5]=T);let E;n[6]!==S||n[7]!==T?(E={noClick:!0,noDrag:!0,noKeyboard:!0,destinationPath:w,getDestinationLabel:T,refreshDestination:S},n[6]=S,n[7]=T,n[8]=E):E=n[8];let{getInputProps:D,open:O}=Tn(E),k;n[9]===O?k=n[10]:(k=e=>{C.current=e,O()},n[9]=O,n[10]=k);let A=i(k),{openPrompt:j}=we(),M;n[11]===l?M=n[12]:(M=()=>l.initialize(f),n[11]=l,n[12]=M);let N;n[13]===Symbol.for(`react.memo_cache_sentinel`)?(N=[],n[13]=N):N=n[13];let{isPending:P,error:F}=Ke(M,N),I;n[14]!==y||n[15]!==l?(I=()=>l.refreshAll(Object.keys(y).filter(e=>y[e])),n[14]=y,n[15]=l,n[16]=I):I=n[16];let L=i(I),R;n[17]!==v||n[18]!==_?(R=()=>{v(!_)},n[17]=v,n[18]=_,n[19]=R):R=n[19];let z=i(R),B;n[20]!==j||n[21]!==h?.id||n[22]!==l?(B=async()=>{j({title:`Folder name`,onConfirm:async e=>{l.createFolder(e,h?.id??null)}})},n[20]=j,n[21]=h?.id,n[22]=l,n[23]=B):B=n[23];let V=i(B),H;n[24]!==j||n[25]!==h?.id||n[26]!==l?(H=async()=>{j({title:`File name`,onConfirm:async e=>{l.createFile({name:e,parentId:h?.id??null})}})},n[24]=j,n[25]=h?.id,n[26]=l,n[27]=H):H=n[27];let U=i(H),W;n[28]!==j||n[29]!==h?.id||n[30]!==l?(W=async()=>{j({title:`Notebook name`,onConfirm:async e=>{l.createFile({name:e,parentId:h?.id??null,type:`notebook`})}})},n[28]=j,n[29]=h?.id,n[30]=l,n[31]=W):W=n[31];let G=i(W),K;n[32]===b?K=n[33]:(K=()=>{s.current?.closeAll(),b({})},n[32]=b,n[33]=K);let q=i(K),ee;n[34]!==d||n[35]!==_?(ee=Hn(d,_),n[34]=d,n[35]=_,n[36]=ee):ee=n[36];let J=ee,te,X;n[37]!==h||n[38]!==J?(te=()=>{h&&!Wn(J,h.id)&&g(null)},X=[h,J],n[37]=h,n[38]=J,n[39]=te,n[40]=X):(te=n[39],X=n[40]),Q.useEffect(te,X);let ne;n[41]!==o||n[42]!==A||n[43]!==l?(ne={tree:l,uploadFiles:A,externalDropDestinationPath:o},n[41]=o,n[42]=A,n[43]=l,n[44]=ne):ne=n[44];let re=ne;if(P){let e;return n[45]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Ee,{size:`medium`,centered:!0}),n[45]=e):e=n[45],e}if(F){let e;return n[46]===F?e=n[47]:(e=(0,$.jsx)($e,{error:F}),n[46]=F,n[47]=e),e}if(p){let e;n[48]===Symbol.for(`react.memo_cache_sentinel`)?(e=()=>m(null),n[48]=e):e=n[48];let t;n[49]===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)(ie,{size:16})}),n[49]=t):t=n[49];let r;n[50]===p.name?r=n[51]:(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:p.name})]}),n[50]=p.name,n[51]=r);let i;n[52]!==p||n[53]!==l?(i=l.isPrimaryNode(p)?e=>{let t=l.getPrimaryRelativePath(p.path);t!==null&&Bn(e,t)}:void 0,n[52]=p,n[53]=l,n[54]=i):i=n[54];let a;n[55]!==p||n[56]!==i?(a=(0,$.jsx)(Q.Suspense,{children:(0,$.jsx)(_n,{onOpenNotebook:i,file:p})}),n[55]=p,n[56]=i,n[57]=a):a=n[57];let o;return n[58]!==r||n[59]!==a?(o=(0,$.jsxs)($.Fragment,{children:[r,a]}),n[58]=r,n[59]=a,n[60]=o):o=n[60],o}let Z;n[61]===D?Z=n[62]:(Z=D(),n[61]=D,n[62]=Z);let ae;n[63]===Z?ae=n[64]:(ae=(0,$.jsx)(`input`,{"data-testid":`file-explorer-upload-input`,...Z}),n[63]=Z,n[64]=ae);let oe;n[65]!==h?.path||n[66]!==l?(oe=h?.path??l.getPrimaryRootPath(),n[65]=h?.path,n[66]=l,n[67]=oe):oe=n[67];let se;n[68]!==h?.path||n[69]!==l?(se=h?.path??l.getPrimaryRootPath(),n[68]=h?.path,n[69]=l,n[70]=se):se=n[70];let ce;n[71]!==se||n[72]!==l?(ce=Vn(l,se),n[71]=se,n[72]=l,n[73]=ce):ce=n[73];let le;n[74]!==q||n[75]!==U||n[76]!==V||n[77]!==G||n[78]!==z||n[79]!==L||n[80]!==A||n[81]!==_||n[82]!==oe||n[83]!==ce?(le=(0,$.jsx)(In,{onRefresh:L,onHidden:z,showHiddenFiles:_,onCreateFile:U,onCreateNotebook:G,onCreateFolder:V,onCollapseAll:q,uploadDestinationPath:oe,uploadDestinationLabel:ce,onUpload:A}),n[74]=q,n[75]=U,n[76]=V,n[77]=G,n[78]=z,n[79]=L,n[80]=A,n[81]=_,n[82]=oe,n[83]=ce,n[84]=le):le=n[84];let ue=r-33,de,fe,pe;n[85]===l?(de=n[86],fe=n[87],pe=n[88]):(de=async e=>{let{ids:t}=e;for(let e of t)await l.delete(e)},fe=async e=>{let{id:t,name:n}=e;await l.rename(t,n)},pe=async e=>{let{dragIds:t,parentId:n}=e;await l.move(t,n)},n[85]=l,n[86]=de,n[87]=fe,n[88]=pe);let me;n[89]===Symbol.for(`react.memo_cache_sentinel`)?(me=e=>{let t=e[0];if(!t){g(null);return}if(t.data.isDirectory){g({id:t.id,path:t.data.path});return}g(null),m(t.data)},n[89]=me):me=n[89];let he;n[90]!==y||n[91]!==b||n[92]!==l?(he=async e=>{if(await l.expand(e)){let t=y[e]??!1;b({...y,[e]:!t})}},n[90]=y,n[91]=b,n[92]=l,n[93]=he):he=n[93];let ge;n[94]!==c||n[95]!==y||n[96]!==ue||n[97]!==de||n[98]!==fe||n[99]!==pe||n[100]!==he||n[101]!==J?(ge=(0,$.jsx)(Me,{width:`100%`,ref:s,height:ue,className:`h-full`,data:J,initialOpenState:y,openByDefault:!1,dndManager:c,renderCursor:Gn,disableDrag:Kn,disableDrop:Jn,onDelete:de,onRename:fe,onMove:pe,onSelect:me,onToggle:he,padding:15,rowHeight:30,indent:Fn,overscanCount:1e3,disableMultiSelection:!0,children:Rn}),n[94]=c,n[95]=y,n[96]=ue,n[97]=de,n[98]=fe,n[99]=pe,n[100]=he,n[101]=J,n[102]=ge):ge=n[102];let _e;n[103]!==re||n[104]!==ge?(_e=(0,$.jsx)(Nn,{value:re,children:ge}),n[103]=re,n[104]=ge,n[105]=_e):_e=n[105];let ve;return n[106]!==ae||n[107]!==le||n[108]!==_e?(ve=(0,$.jsxs)($.Fragment,{children:[ae,le,_e]}),n[106]=ae,n[107]=le,n[108]=_e,n[109]=ve):ve=n[109],ve},Fn=15,In=e=>{let t=(0,Dt.c)(35),{onRefresh:n,onHidden:r,showHiddenFiles:i,onCreateFile:a,onCreateNotebook:o,onCreateFolder:s,onCollapseAll:c,uploadDestinationPath:l,uploadDestinationLabel:u,onUpload:d}=e,f=`Upload files to ${u}`,p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(mt,{size:16}),t[0]=p):p=t[0];let m;t[1]===o?m=t[2]:(m=(0,$.jsx)(J,{content:`Add notebook`,children:(0,$.jsx)(Y,{"data-testid":`file-explorer-add-notebook-button`,onClick:o,variant:`text`,size:`xs`,children:p})}),t[1]=o,t[2]=m);let h;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(bt,{size:16}),t[3]=h):h=t[3];let g;t[4]===a?g=t[5]:(g=(0,$.jsx)(J,{content:`Add file`,children:(0,$.jsx)(Y,{"data-testid":`file-explorer-add-file-button`,onClick:a,variant:`text`,size:`xs`,children:h})}),t[4]=a,t[5]=g);let _;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(St,{size:16}),t[6]=_):_=t[6];let v;t[7]===s?v=t[8]:(v=(0,$.jsx)(J,{content:`Add folder`,children:(0,$.jsx)(Y,{"data-testid":`file-explorer-add-folder-button`,onClick:s,variant:`text`,size:`xs`,children:_})}),t[7]=s,t[8]=v);let y;t[9]!==d||t[10]!==l?(y=()=>d(l),t[9]=d,t[10]=l,t[11]=y):y=t[11];let b;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(Be,{size:16}),t[12]=b):b=t[12];let x;t[13]!==y||t[14]!==f?(x=(0,$.jsx)(Y,{"data-testid":`file-explorer-upload-button`,"aria-label":f,onClick:y,variant:`text`,size:`xs`,children:b}),t[13]=y,t[14]=f,t[15]=x):x=t[15];let S;t[16]!==x||t[17]!==f?(S=(0,$.jsx)(J,{content:f,children:x}),t[16]=x,t[17]=f,t[18]=S):S=t[18];let C;t[19]===n?C=t[20]:(C=(0,$.jsx)(ue,{"data-testid":`file-explorer-refresh-button`,onClick:n}),t[19]=n,t[20]=C);let w;t[21]!==r||t[22]!==i?(w=(0,$.jsx)(se,{"data-testid":`file-explorer-hidden-files-button`,isVisible:i,onToggle:r,showTooltip:`Show hidden files`,hideTooltip:`Hide hidden files`}),t[21]=r,t[22]=i,t[23]=w):w=t[23];let T;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(yt,{size:16}),t[24]=T):T=t[24];let E;t[25]===c?E=t[26]:(E=(0,$.jsx)(J,{content:`Collapse all folders`,children:(0,$.jsx)(Y,{"data-testid":`file-explorer-collapse-button`,onClick:c,variant:`text`,size:`xs`,children:T})}),t[25]=c,t[26]=E);let D;return t[27]!==S||t[28]!==C||t[29]!==w||t[30]!==E||t[31]!==m||t[32]!==g||t[33]!==v?(D=(0,$.jsxs)(`div`,{className:`flex items-center justify-end px-2 shrink-0 border-b`,children:[m,g,v,S,C,w,E]}),t[27]=S,t[28]=C,t[29]=w,t[30]=E,t[31]=m,t[32]=g,t[33]=v,t[34]=D):D=t[34],D},Ln=e=>{let t=(0,Dt.c)(14),{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]!==n.data.isPrimaryRoot||t[4]!==r?(a=n.data.isMarimoFile&&n.data.isPrimaryRoot&&!k()&&(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)(he,{className:`inline ml-1`,size:12})]}),t[2]=n.data.isMarimoFile,t[3]=n.data.isPrimaryRoot,t[4]=r,t[5]=a):a=t[5];let o;t[6]!==n.data.name||t[7]!==i||t[8]!==a?(o=(0,$.jsxs)(`span`,{className:`flex-1 overflow-hidden text-ellipsis`,onClick:i,children:[n.data.name,a]}),t[6]=n.data.name,t[7]=i,t[8]=a,t[9]=o):o=t[9];let s=o,c;return t[10]!==s||t[11]!==n.data.isRoot||t[12]!==n.data.path?(c=n.data.isRoot?(0,$.jsx)(J,{content:n.data.path,children:s}):s,t[10]=s,t[11]=n.data.isRoot,t[12]=n.data.path,t[13]=c):c=t[13],c},Rn=e=>{let t=(0,Dt.c)(115),{node:n,style:a,dragHandle:o}=e,{openFile:s}=ne(),c=r(E),u;t[0]!==n.data.isDirectory||t[1]!==n.data.name?(u=n.data.isDirectory?`directory`:ye(n.data.name),t[0]=n.data.isDirectory,t[1]=n.data.name,t[2]=u):u=t[2];let d=u,f=be[d],{openConfirm:p,openPrompt:m}=we(),{createNewCell:h}=l(),_=g(),v;t[3]!==h||t[4]!==_?(v=e=>{h({code:e,before:!1,cellId:_??`__end__`})},t[3]=h,t[4]=_,t[5]=v):v=t[5];let y=v,b=(0,Q.use)(Nn),S=b?.tree,C=n.data.isDirectory&&b?.externalDropDestinationPath===n.data.path,w;t[6]!==n.data.path||t[7]!==S?(w=async e=>{let t=S?.getPrimaryRelativePath(n.data.path);t!=null&&Bn(e,t)},t[6]=n.data.path,t[7]=S,t[8]=w):w=t[8];let T=w,D;t[9]!==n.data.name||t[10]!==n.id||t[11]!==n.tree||t[12]!==p?(D=async e=>{e.stopPropagation(),e.preventDefault(),p({title:`Delete file`,description:`Are you sure you want to delete ${n.data.name}?`,confirmAction:(0,$.jsx)(P,{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]=p,t[13]=D):D=t[13];let O=D,A;t[14]!==n||t[15]!==m||t[16]!==S?(A=async()=>{n.open(),m({title:`Folder name`,onConfirm:async e=>{S?.createFolder(e,n.id)}})},t[14]=n,t[15]=m,t[16]=S,t[17]=A):A=t[17];let M=i(A),N;t[18]!==n||t[19]!==m||t[20]!==S?(N=async()=>{n.open(),m({title:`File name`,onConfirm:async e=>{S?.createFile({name:e,parentId:n.id})}})},t[18]=n,t[19]=m,t[20]=S,t[21]=N):N=t[21];let L=i(N),R;t[22]!==n||t[23]!==m||t[24]!==S?(R=async()=>{n.open(),m({title:`Notebook name`,onConfirm:async e=>{S?.createFile({name:e,parentId:n.id,type:`notebook`})}})},t[22]=n,t[23]=m,t[24]=S,t[25]=R):R=t[25];let z=i(R),V;t[26]!==n.data.name||t[27]!==n.id||t[28]!==S?(V=async()=>{S&&await S.copy(n.id,rt(n.data.name))},t[26]=n.data.name,t[27]=n.id,t[28]=S,t[29]=V):V=t[29];let H=i(V),U;t[30]!==n.data.isDirectory||t[31]!==n.data.path?(U=n.data.isDirectory?{[wn]:n.data.path}:{},t[30]=n.data.isDirectory,t[31]=n.data.path,t[32]=U):U=t[32];let W;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(W=j(`flex items-center cursor-pointer ml-1 text-muted-foreground whitespace-nowrap group`),t[33]=W):W=t[33];let G=!n.data.isRoot,K,q;t[34]===n?(K=t[35],q=t[36]):(K=e=>{e.stopPropagation(),n.data.isDirectory&&(n.select(),n.toggle())},q=(0,$.jsx)(zn,{node:n}),t[34]=n,t[35]=K,t[36]=q);let ee=n.willReceiveDrop&&n.data.isDirectory&&`bg-accent/80 hover:bg-accent/80 text-accent-foreground`,J=n.isSelected&&`bg-accent/60 hover:bg-accent/60 text-accent-foreground`,Y=C&&`bg-primary/15 hover:bg-primary/15 text-accent-foreground ring-1 ring-inset ring-primary`,te;t[37]!==ee||t[38]!==J||t[39]!==Y?(te=j(`flex items-center pl-1 py-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden group`,ee,J,Y),t[37]=ee,t[38]=J,t[39]=Y,t[40]=te):te=t[40];let X;t[41]!==f||t[42]!==d||t[43]!==n.data.isMarimoFile||t[44]!==n.data.isRoot?(X=n.data.isRoot?(0,$.jsx)(Ct,{className:`w-5 h-5 shrink-0 mr-2 text-primary`,strokeWidth:1.5}):n.data.isMarimoFile?(0,$.jsx)(ht,{className:`w-5 h-5 shrink-0 mr-2`,strokeWidth:1.5}):(0,$.jsx)(f,{className:j(`w-5 h-5 shrink-0 mr-2`,ve[d]),strokeWidth:1.5}),t[41]=f,t[42]=d,t[43]=n.data.isMarimoFile,t[44]=n.data.isRoot,t[45]=X):X=t[45];let re;t[46]!==T||t[47]!==n?(re=n.isEditing?(0,$.jsx)(Fe,{node:n}):(0,$.jsx)(Ln,{node:n,onOpenMarimoFile:T}),t[46]=T,t[47]=n,t[48]=re):re=t[48];let Z;t[49]===n?Z=t[50]:(Z=!n.data.isDirectory&&(0,$.jsxs)(F,{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[49]=n,t[50]=Z);let ie;t[51]!==n.data.isDirectory||t[52]!==n.data.path||t[53]!==s?(ie=!n.data.isDirectory&&!k()&&(0,$.jsxs)(F,{onSelect:()=>{s({path:n.data.path})},"data-testid":`file-explorer-open-external-menu-item`,children:[(0,$.jsx)(he,{className:`h-3.5 w-3.5 mr-2`}),`Open file in external editor`]}),t[51]=n.data.isDirectory,t[52]=n.data.path,t[53]=s,t[54]=ie):ie=t[54];let oe;t[55]!==b||t[56]!==L||t[57]!==M||t[58]!==z||t[59]!==n.data.isDirectory||t[60]!==n.data.path?(oe=n.data.isDirectory&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(F,{onSelect:()=>z(),"data-testid":`file-explorer-create-notebook-menu-item`,children:[(0,$.jsx)(mt,{className:`h-3.5 w-3.5 mr-2`}),`Create notebook`]}),(0,$.jsxs)(F,{onSelect:()=>L(),"data-testid":`file-explorer-create-file-menu-item`,children:[(0,$.jsx)(bt,{className:`h-3.5 w-3.5 mr-2`}),`Create file`]}),(0,$.jsxs)(F,{onSelect:()=>M(),"data-testid":`file-explorer-create-folder-menu-item`,children:[(0,$.jsx)(St,{className:`h-3.5 w-3.5 mr-2`}),`Create folder`]}),(0,$.jsxs)(F,{onSelect:()=>b?.uploadFiles(n.data.path),"data-testid":`file-explorer-upload-files-menu-item`,children:[(0,$.jsx)(Be,{className:`h-3.5 w-3.5 mr-2`}),`Upload files here`]}),(0,$.jsx)(I,{})]}),t[55]=b,t[56]=L,t[57]=M,t[58]=z,t[59]=n.data.isDirectory,t[60]=n.data.path,t[61]=oe):oe=t[61];let se;t[62]!==H||t[63]!==n?(se=!n.data.isRoot&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(De,{onSelect:()=>n.edit(),testId:`file-explorer-rename-menu-item`}),(0,$.jsx)(Pe,{onSelect:H,testId:`file-explorer-duplicate-menu-item`})]}),t[62]=H,t[63]=n,t[64]=se):se=t[64];let ce;t[65]===n.data.path?ce=t[66]:(ce=async()=>{await qe(n.data.path),He({title:`Copied to clipboard`})},t[65]=n.data.path,t[66]=ce);let le;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,$.jsx)(wt,{className:de}),t[67]=le):le=t[67];let ue;t[68]===ce?ue=t[69]:(ue=(0,$.jsxs)(F,{onSelect:ce,"data-testid":`file-explorer-copy-path-menu-item`,children:[le,`Copy path`]}),t[68]=ce,t[69]=ue);let fe;t[70]!==n.data.isPrimaryRoot||t[71]!==n.data.isRoot||t[72]!==n.data.path||t[73]!==S?(fe=S&&n.data.isPrimaryRoot&&!n.data.isRoot&&(0,$.jsxs)(F,{onSelect:async()=>{let e=S.getPrimaryRelativePath(n.data.path);e!==null&&(await qe(e),He({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[70]=n.data.isPrimaryRoot,t[71]=n.data.isRoot,t[72]=n.data.path,t[73]=S,t[74]=fe):fe=t[74];let pe;t[75]!==d||t[76]!==y||t[77]!==n.data?(pe=!n.data.isRoot&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(I,{}),(0,$.jsxs)(F,{onSelect:()=>{let{path:e}=n.data,t=xn[d](e);y(t)},"data-testid":`file-explorer-insert-snippet-menu-item`,children:[(0,$.jsx)(ae,{className:`h-3.5 w-3.5 mr-2`}),`Insert snippet for reading file`]}),(0,$.jsxs)(F,{onSelect:async()=>{He({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[d](e);await qe(t)},"data-testid":`file-explorer-copy-snippet-menu-item`,children:[(0,$.jsx)(x,{className:`h-3.5 w-3.5 mr-2`}),`Copy snippet for reading file`]})]}),t[75]=d,t[76]=y,t[77]=n.data,t[78]=pe):pe=t[78];let me;t[79]!==T||t[80]!==n.data.isMarimoFile||t[81]!==n.data.isPrimaryRoot?(me=n.data.isMarimoFile&&n.data.isPrimaryRoot&&!k()&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(I,{}),(0,$.jsxs)(F,{onSelect:T,"data-testid":`file-explorer-open-notebook-menu-item`,children:[(0,$.jsx)(Tt,{className:`h-3.5 w-3.5 mr-2`}),`Open notebook`]})]}),t[79]=T,t[80]=n.data.isMarimoFile,t[81]=n.data.isPrimaryRoot,t[82]=me):me=t[82];let ge;t[83]!==c||t[84]!==n.data.isDirectory||t[85]!==n.data.name||t[86]!==n.data.path?(ge=!n.data.isDirectory&&!c&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(I,{}),(0,$.jsxs)(F,{onSelect:async()=>{await fn(n.data.path,n.data.name)},"data-testid":`file-explorer-download-menu-item`,children:[(0,$.jsx)(B,{className:`h-3.5 w-3.5 mr-2`}),`Download`]})]}),t[83]=c,t[84]=n.data.isDirectory,t[85]=n.data.name,t[86]=n.data.path,t[87]=ge):ge=t[87];let _e;t[88]!==O||t[89]!==n.data.isRoot?(_e=!n.data.isRoot&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(I,{}),(0,$.jsx)(Ne,{onSelect:O,testId:`file-explorer-delete-menu-item`})]}),t[88]=O,t[89]=n.data.isRoot,t[90]=_e):_e=t[90];let xe;t[91]!==Z||t[92]!==ie||t[93]!==oe||t[94]!==se||t[95]!==ue||t[96]!==fe||t[97]!==pe||t[98]!==me||t[99]!==ge||t[100]!==_e?(xe=(0,$.jsxs)(je,{testId:`file-explorer-more-button`,iconClassName:`w-5 h-5`,children:[Z,ie,oe,se,ue,fe,pe,me,ge,_e]}),t[91]=Z,t[92]=ie,t[93]=oe,t[94]=se,t[95]=ue,t[96]=fe,t[97]=pe,t[98]=me,t[99]=ge,t[100]=_e,t[101]=xe):xe=t[101];let Se;t[102]!==te||t[103]!==X||t[104]!==re||t[105]!==xe?(Se=(0,$.jsxs)(`span`,{className:te,children:[X,re,xe]}),t[102]=te,t[103]=X,t[104]=re,t[105]=xe,t[106]=Se):Se=t[106];let Ce;return t[107]!==o||t[108]!==a||t[109]!==G||t[110]!==K||t[111]!==q||t[112]!==Se||t[113]!==U?(Ce=(0,$.jsxs)(`div`,{style:a,ref:o,...U,className:W,draggable:G,onClick:K,children:[q,Se]}),t[107]=o,t[108]=a,t[109]=G,t[110]=K,t[111]=q,t[112]=Se,t[113]=U,t[114]=Ce):Ce=t[114],Ce},zn=e=>{let t=(0,Dt.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)(ce,{isExpanded:n.isOpen,className:`w-4 h-4`}),t[1]=n.isOpen,t[2]=r),r};function Bn(e,t){e.stopPropagation(),e.preventDefault(),gt(t)}function Vn(e,t){return e.getDisplayPath(t)}function Hn(e,t){if(t)return e;let n=[];for(let r of e){if(!r.isRoot&&Un(r.name))continue;let e=r;if(r.children){let n=Hn(r.children,t);n!==r.children&&(e={...r,children:n})}n.push(e)}return n}function Un(e){return!!e.startsWith(`.`)}function Wn(e,t){return e.some(e=>e.id===t||(e.children?Wn(e.children,t):!1))}function Gn(){return null}function Kn(e){return e.isRoot}function qn(e){return e.data.isRoot}function Jn(e){let{parentNode:t,dragNodes:n}=e;return n.some(qn)||(t?!t.data.isDirectory:!1)}var Yn=e=>{let t=(0,Dt.c)(44),{height:n}=e,i=r(vn),[a,o]=(0,Q.useState)(null),s;t[0]===i?s=t[1]:(s=e=>Xn(e,i.getPrimaryRootPath()),t[0]=i,t[1]=s);let c=s,l;t[2]===i?l=t[3]:(l=e=>i.refreshPath(e),t[2]=i,t[3]=l);let u=l,d;t[4]===i?d=t[5]:(d=e=>Vn(i,e),t[4]=i,t[5]=d);let f,p;t[6]===c?(f=t[7],p=t[8]):(f=e=>o(c(e)),p=e=>o(c(e)),t[6]=c,t[7]=f,t[8]=p);let m,h;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>o(null),h=()=>o(null),t[9]=m,t[10]=h):(m=t[9],h=t[10]);let g;t[11]!==c||t[12]!==u||t[13]!==d||t[14]!==f||t[15]!==p?(g={noClick:!0,noKeyboard:!0,destinationPath:c,getDestinationLabel:d,refreshDestination:u,onDragEnter:f,onDragOver:p,onDragLeave:m,onUploadStart:h},t[11]=c,t[12]=u,t[13]=d,t[14]=f,t[15]=p,t[16]=g):g=t[16];let{getRootProps:_,getInputProps:v,isDragActive:y}=Tn(g),b;t[17]!==a||t[18]!==i?(b=a??i.getPrimaryRootPath(),t[17]=a,t[18]=i,t[19]=b):b=t[19];let x=b,S;t[20]!==x||t[21]!==i?(S=Vn(i,x),t[20]=x,t[21]=i,t[22]=S):S=t[22];let C=S,w;t[23]===_?w=t[24]:(w=_(),t[23]=_,t[24]=w);let T;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(T=j(`flex flex-col overflow-hidden relative`),t[25]=T):T=t[25];let E;t[26]===n?E=t[27]:(E={height:n},t[26]=n,t[27]=E);let D;t[28]===v?D=t[29]:(D=v(),t[28]=v,t[29]=D);let O;t[30]===D?O=t[31]:(O=(0,$.jsx)(`input`,{...D}),t[30]=D,t[31]=O);let k;t[32]!==C||t[33]!==y?(k=y&&(0,$.jsx)(`div`,{className:`absolute inset-0 flex items-start justify-center pt-3 bg-accent/20 z-10 border-2 border-dashed border-primary/90 rounded-lg pointer-events-none`,children:(0,$.jsxs)(`span`,{className:`px-3 py-1.5 rounded-md bg-background/95 border shadow-sm text-sm font-semibold text-primary`,children:[`Drop files into `,C]})}),t[32]=C,t[33]=y,t[34]=k):k=t[34];let A=y?x:null,M;t[35]!==n||t[36]!==A?(M=(0,$.jsx)(Pn,{height:n,externalDropDestinationPath:A}),t[35]=n,t[36]=A,t[37]=M):M=t[37];let N;return t[38]!==w||t[39]!==E||t[40]!==O||t[41]!==k||t[42]!==M?(N=(0,$.jsx)(dn,{children:(0,$.jsxs)(`div`,{...w,className:T,style:E,children:[O,k,M]})}),t[38]=w,t[39]=E,t[40]=O,t[41]=k,t[42]=M,t[43]=N):N=t[43],N};function Xn(e,t){return Array.isArray(e)?t:On(e.target,t)}var Zn=()=>{let e=(0,Dt.c)(40),{ref:n,height:i}=tt(),a=i===void 0?500:i,[o,s]=t(_t),c=r(d).length,l=h(`storage`),u;bb0:{if(!o.hasUserInteracted&&c>0){if(o.openSections.includes(`remote-storage`)){u=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),u=t;break bb0}u=o.openSections}let f=u,p;e[2]===s?p=e[3]:(p=e=>{s({openSections:e,hasUserInteracted:!0})},e[2]=s,e[3]=p);let m=p,g=a-66,_;e[4]===f?_=e[5]:(_=f.includes(`remote-storage`),e[4]=f,e[5]=_);let v=_,y=l.length>0,b;e[6]!==f||e[7]!==v?(b=v&&f.includes(`files`),e[6]=f,e[7]=v,e[8]=b):b=e[8];let x=b,S;e[9]!==g||e[10]!==x?(S=x?Math.round(g*.4):g,e[9]=g,e[10]=x,e[11]=S):S=e[11];let C=S,w=Math.max(200,x?g-C:g),T;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(Se,{className:`w-4 h-4`}),e[12]=T):T=e[12];let E;e[13]===c?E=e[14]:(E=c>0&&(0,$.jsx)(st,{children:c}),e[13]=c,e[14]=E);let D;e[15]!==l.length||e[16]!==y?(D=y&&(0,$.jsx)(pt,{count:l.length,type:`storage`}),e[15]=l.length,e[16]=y,e[17]=D):D=e[17];let O;e[18]!==E||e[19]!==D?(O=(0,$.jsxs)(ct,{children:[T,` Remote storage`,E,D]}),e[18]=E,e[19]=D,e[20]=O):O=e[20];let k;e[21]===C?k=e[22]:(k={maxHeight:C},e[21]=C,e[22]=k);let A;e[23]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(rn,{}),e[23]=A):A=e[23];let j;e[24]===k?j=e[25]:(j=(0,$.jsx)(lt,{className:`overflow-auto`,style:k,children:A}),e[24]=k,e[25]=j);let M;e[26]!==j||e[27]!==O?(M=(0,$.jsxs)(dt,{value:`remote-storage`,children:[O,j]}),e[26]=j,e[27]=O,e[28]=M):M=e[28];let P;e[29]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,$.jsxs)(ct,{children:[(0,$.jsx)(xe,{className:`w-4 h-4`}),`Files`]}),e[29]=P):P=e[29];let F;e[30]===w?F=e[31]:(F=(0,$.jsxs)(dt,{value:`files`,children:[P,(0,$.jsx)(lt,{children:(0,$.jsx)(Yn,{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)(N,{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{Zn as default,Xn as getUploadDestinationForEvent};
@@ -1,3 +0,0 @@
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-92uWqz-P.js";import{t as s}from"./jsx-runtime-B74pBk57.js";import{o as c}from"./alert-dialog-BnNhUpVP.js";import{a as l}from"./tabs-DxfkQ6UI.js";import{a as u,p as d,r as f,t as p}from"./dropdown-menu-B-ZAV5lw.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-CzmLf39g.js";import{t as v}from"./copy-BMXKNElG.js";import{b as ee}from"./write-secret-modal-GHpJRc36.js";import{t as y}from"./trash-2-D_HX-0qx.js";import{t as b}from"./use-toast-DpWHUGuF.js";import{t as x}from"./paths-zcL04qUW.js";import{a as te}from"./errors-DzO-nXy-.js";import{t as ne}from"./extends-CvVTau-c.js";import{i as re,n as ie,r as S}from"./pathUtils-Cryrlpma.js";import{n as ae}from"./semaphore-BjoL5P0h.js";var oe=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`}]]),C=e(i(),1),w=s(),se=l();function ce(e,t){return ce=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ce(e,t)}function le(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,ce(e,t)}function ue(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}var de=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}})),fe=(0,C.createContext)({dragDropManager:void 0});function T(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 pe=(function(){return typeof Symbol==`function`&&Symbol.observable||`@@observable`})(),me=function(){return Math.random().toString(36).substring(7).split(``).join(`.`)},he={INIT:`@@redux/INIT`+me(),REPLACE:`@@redux/REPLACE`+me(),PROBE_UNKNOWN_ACTION:function(){return`@@redux/PROBE_UNKNOWN_ACTION`+me()}};function ge(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 _e(e,t,n){var r;if(typeof t==`function`&&typeof n==`function`||typeof n==`function`&&typeof arguments[3]==`function`)throw Error(T(0));if(typeof t==`function`&&n===void 0&&(n=t,t=void 0),n!==void 0){if(typeof n!=`function`)throw Error(T(1));return n(_e)(e,t)}if(typeof e!=`function`)throw Error(T(2));var i=e,a=t,o=[],s=o,c=!1;function l(){s===o&&(s=o.slice())}function u(){if(c)throw Error(T(3));return a}function d(e){if(typeof e!=`function`)throw Error(T(4));if(c)throw Error(T(5));var t=!0;return l(),s.push(e),function(){if(t){if(c)throw Error(T(6));t=!1,l();var n=s.indexOf(e);s.splice(n,1),o=null}}}function f(e){if(!ge(e))throw Error(T(7));if(e.type===void 0)throw Error(T(8));if(c)throw Error(T(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(T(10));i=e,f({type:he.REPLACE})}function m(){var e,t=d;return e={subscribe:function(e){if(typeof e!=`object`||!e)throw Error(T(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}},e[pe]=function(){return this},e}return f({type:he.INIT}),r={dispatch:f,subscribe:d,getState:u,replaceReducer:p},r[pe]=m,r}function E(e,t,...n){if(ve()&&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 ve(){return typeof process<`u`&&!0}function ye(e,t,n){return t.split(`.`).reduce((e,t)=>e&&e[t]?e[t]:n||null,e)}function be(e,t){return e.filter(e=>e!==t)}function xe(e){return typeof e==`object`}function Se(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 Ce(e,t){return e.filter(e=>t.indexOf(e)>-1)}var we=`dnd-core/INIT_COORDS`,D=`dnd-core/BEGIN_DRAG`,Te=`dnd-core/PUBLISH_DRAG_SOURCE`,Ee=`dnd-core/HOVER`,De=`dnd-core/DROP`,Oe=`dnd-core/END_DRAG`;function ke(e,t){return{type:we,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}var Ae={type:we,payload:{clientOffset:null,sourceClientOffset:null}};function je(e){return function(t=[],n={publishSource:!0}){let{publishSource:r=!0,clientOffset:i,getSourceClientOffset:a}=n,o=e.getMonitor(),s=e.getRegistry();e.dispatch(ke(i)),Me(t,o,s);let c=Fe(t,o);if(c==null){e.dispatch(Ae);return}let l=null;if(i){if(!a)throw Error(`getSourceClientOffset must be defined`);Ne(a),l=a(c)}e.dispatch(ke(i,l));let u=s.getSource(c).beginDrag(o,c);return u==null?void 0:(Pe(u),s.pinSource(c),{type:D,payload:{itemType:s.getSourceType(c),item:u,sourceId:c,clientOffset:i||null,sourceClientOffset:l||null,isSourcePublic:!!r}})}}function Me(e,t,n){E(!t.isDragging(),`Cannot call beginDrag while dragging.`),e.forEach(function(e){E(n.getSource(e),`Expected sourceIds to be registered.`)})}function Ne(e){E(typeof e==`function`,`When clientOffset is provided, getSourceClientOffset must be a function.`)}function Pe(e){E(xe(e),`Item must be an object.`)}function Fe(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 Ie(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Le(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){Ie(e,t,n[t])})}return e}function Re(e){return function(t={}){let n=e.getMonitor(),r=e.getRegistry();ze(n),He(n).forEach((i,a)=>{let o={type:De,payload:{dropResult:Le({},t,Be(i,a,r,n))}};e.dispatch(o)})}}function ze(e){E(e.isDragging(),`Cannot call drop while not dragging.`),E(!e.didDrop(),`Cannot call drop twice during one drag operation.`)}function Be(e,t,n,r){let i=n.getTarget(e),a=i?i.drop(r,e):void 0;return Ve(a),a===void 0&&(a=t===0?{}:r.getDropResult()),a}function Ve(e){E(e===void 0||xe(e),`Drop result must either be an object or undefined.`)}function He(e){let t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function Ue(e){return function(){let t=e.getMonitor(),n=e.getRegistry();We(t);let r=t.getSourceId();return r!=null&&(n.getSource(r,!0).endDrag(t,r),n.unpinSource()),{type:Oe}}}function We(e){E(e.isDragging(),`Cannot call endDrag while not dragging.`)}function Ge(e,t){return t===null?e===null:Array.isArray(e)?e.some(e=>e===t):e===t}function Ke(e){return function(t,{clientOffset:n}={}){qe(t);let r=t.slice(0),i=e.getMonitor(),a=e.getRegistry();return Ye(r,a,i.getItemType()),Je(r,i,a),Xe(r,i,a),{type:Ee,payload:{targetIds:r,clientOffset:n||null}}}}function qe(e){E(Array.isArray(e),`Expected targetIds to be an array.`)}function Je(e,t,n){E(t.isDragging(),`Cannot call hover while not dragging.`),E(!t.didDrop(),`Cannot call hover after drop.`);for(let t=0;t<e.length;t++){let r=e[t];E(e.lastIndexOf(r)===t,`Expected targetIds to be unique in the passed array.`),E(n.getTarget(r),`Expected targetIds to be registered.`)}}function Ye(e,t,n){for(let r=e.length-1;r>=0;r--){let i=e[r];Ge(t.getTargetType(i),n)||e.splice(r,1)}}function Xe(e,t,n){e.forEach(function(e){n.getTarget(e).hover(t,e)})}function Ze(e){return function(){if(e.getMonitor().isDragging())return{type:Te}}}function Qe(e){return{beginDrag:je(e),publishDragSource:Ze(e),hover:Ke(e),drop:Re(e),endDrag:Ue(e)}}var $e=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=Qe(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 et(e,t){return{x:e.x+t.x,y:e.y+t.y}}function tt(e,t){return{x:e.x-t.x,y:e.y-t.y}}function nt(e){let{clientOffset:t,initialClientOffset:n,initialSourceClientOffset:r}=e;return!t||!n||!r?null:tt(et(t,r),n)}function rt(e){let{clientOffset:t,initialClientOffset:n}=e;return!t||!n?null:tt(t,n)}var O=[],it=[];O.__IS_NONE__=!0,it.__IS_ALL__=!0;function at(e,t){return e===O?!1:e===it||t===void 0||Ce(t,e).length>0}var ot=class{subscribeToStateChange(e,t={}){let{handlerIds:n}=t;E(typeof e==`function`,`listener must be a function.`),E(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&&!at(t.dirtyHandlerIds,n)||e()}finally{r=i}})}subscribeToOffsetChange(e){E(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 E(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 E(t,`Expected to find a valid target. targetId=${e}`),!this.isDragging()||this.didDrop()?!1:Ge(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 E(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&&!Ge(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 nt(this.store.getState().dragOffset)}getDifferenceFromInitialOffset(){return rt(this.store.getState().dragOffset)}constructor(e,t){this.store=e,this.registry=t}},st=typeof global<`u`?global:self,ct=st.MutationObserver||st.WebKitMutationObserver;function lt(e){return function(){let t=setTimeout(r,0),n=setInterval(r,50);function r(){clearTimeout(t),clearInterval(n),e()}}}function ut(e){let t=1,n=new ct(e),r=document.createTextNode(``);return n.observe(r,{characterData:!0}),function(){t=-t,r.data=t}}var dt=typeof ct==`function`?ut:lt,ft=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=dt(this.flush),this.requestErrorThrow=lt(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}},pt=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}},mt=class{create(e){let t=this.freeTasks,n=t.length?t.pop():new pt(this.onError,e=>t[t.length]=e);return n.task=e,n}constructor(e){this.onError=e,this.freeTasks=[]}},ht=new ft,gt=new mt(ht.registerPendingError);function _t(e){ht.enqueueTask(gt.create(e))}var vt=`dnd-core/ADD_SOURCE`,yt=`dnd-core/ADD_TARGET`,bt=`dnd-core/REMOVE_SOURCE`,xt=`dnd-core/REMOVE_TARGET`;function St(e){return{type:vt,payload:{sourceId:e}}}function Ct(e){return{type:yt,payload:{targetId:e}}}function wt(e){return{type:bt,payload:{sourceId:e}}}function Tt(e){return{type:xt,payload:{targetId:e}}}function Et(e){E(typeof e.canDrag==`function`,`Expected canDrag to be a function.`),E(typeof e.beginDrag==`function`,`Expected beginDrag to be a function.`),E(typeof e.endDrag==`function`,`Expected endDrag to be a function.`)}function Dt(e){E(typeof e.canDrop==`function`,`Expected canDrop to be a function.`),E(typeof e.hover==`function`,`Expected hover to be a function.`),E(typeof e.drop==`function`,`Expected beginDrag to be a function.`)}function Ot(e,t){if(t&&Array.isArray(e)){e.forEach(e=>Ot(e,!1));return}E(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 k;(function(e){e.SOURCE=`SOURCE`,e.TARGET=`TARGET`})(k||={});var kt=0;function At(){return kt++}function jt(e){let t=At().toString();switch(e){case k.SOURCE:return`S${t}`;case k.TARGET:return`T${t}`;default:throw Error(`Unknown Handler Role: ${e}`)}}function Mt(e){switch(e[0]){case`S`:return k.SOURCE;case`T`:return k.TARGET;default:throw Error(`Cannot parse handler ID: ${e}`)}}function Nt(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 Pt=class{addSource(e,t){Ot(e),Et(t);let n=this.addHandler(k.SOURCE,e,t);return this.store.dispatch(St(n)),n}addTarget(e,t){Ot(e,!0),Dt(t);let n=this.addHandler(k.TARGET,e,t);return this.store.dispatch(Ct(n)),n}containsHandler(e){return Nt(this.dragSources,e)||Nt(this.dropTargets,e)}getSource(e,t=!1){return E(this.isSourceId(e),`Expected a valid source ID.`),t&&e===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(e)}getTarget(e){return E(this.isTargetId(e),`Expected a valid target ID.`),this.dropTargets.get(e)}getSourceType(e){return E(this.isSourceId(e),`Expected a valid source ID.`),this.types.get(e)}getTargetType(e){return E(this.isTargetId(e),`Expected a valid target ID.`),this.types.get(e)}isSourceId(e){return Mt(e)===k.SOURCE}isTargetId(e){return Mt(e)===k.TARGET}removeSource(e){E(this.getSource(e),`Expected an existing source.`),this.store.dispatch(wt(e)),_t(()=>{this.dragSources.delete(e),this.types.delete(e)})}removeTarget(e){E(this.getTarget(e),`Expected an existing target.`),this.store.dispatch(Tt(e)),this.dropTargets.delete(e),this.types.delete(e)}pinSource(e){let t=this.getSource(e);E(t,`Expected an existing source.`),this.pinnedSourceId=e,this.pinnedSource=t}unpinSource(){E(this.pinnedSource,`No source is pinned at the time.`),this.pinnedSourceId=null,this.pinnedSource=null}addHandler(e,t,n){let r=jt(e);return this.types.set(r,t),e===k.SOURCE?this.dragSources.set(r,n):e===k.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}},Ft=(e,t)=>e===t;function It(e,t){return!e&&!t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function Lt(e,t,n=Ft){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 Rt(e=O,t){switch(t.type){case Ee:break;case vt:case yt:case xt:case bt:return O;case D:case Te:case Oe:case De:default:return it}let{targetIds:n=[],prevTargetIds:r=[]}=t.payload,i=Se(n,r);if(!(i.length>0||!Lt(n,r)))return O;let a=r[r.length-1],o=n[n.length-1];return a!==o&&(a&&i.push(a),o&&i.push(o)),i}function zt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Bt(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){zt(e,t,n[t])})}return e}var Vt={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function Ht(e=Vt,t){let{payload:n}=t;switch(t.type){case we:case D:return{initialSourceClientOffset:n.sourceClientOffset,initialClientOffset:n.clientOffset,clientOffset:n.clientOffset};case Ee:return It(e.clientOffset,n.clientOffset)?e:Bt({},e,{clientOffset:n.clientOffset});case Oe:case De:return Vt;default:return e}}function Ut(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function A(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){Ut(e,t,n[t])})}return e}var Wt={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function Gt(e=Wt,t){let{payload:n}=t;switch(t.type){case D:return A({},e,{itemType:n.itemType,item:n.item,sourceId:n.sourceId,isSourcePublic:n.isSourcePublic,dropResult:null,didDrop:!1});case Te:return A({},e,{isSourcePublic:!0});case Ee:return A({},e,{targetIds:n.targetIds});case xt:return e.targetIds.indexOf(n.targetId)===-1?e:A({},e,{targetIds:be(e.targetIds,n.targetId)});case De:return A({},e,{dropResult:n.dropResult,didDrop:!0,targetIds:[]});case Oe:return A({},e,{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}}function Kt(e=0,t){switch(t.type){case vt:case yt:return e+1;case bt:case xt:return e-1;default:return e}}function qt(e=0){return e+1}function Jt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Yt(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){Jt(e,t,n[t])})}return e}function Xt(e={},t){return{dirtyHandlerIds:Rt(e.dirtyHandlerIds,{type:t.type,payload:Yt({},t.payload,{prevTargetIds:ye(e,`dragOperation.targetIds`,[])})}),dragOffset:Ht(e.dragOffset,t),refCount:Kt(e.refCount,t),dragOperation:Gt(e.dragOperation,t),stateId:qt(e.stateId)}}function Zt(e,t=void 0,n={},r=!1){let i=Qt(r),a=new $e(i,new ot(i,new Pt(i))),o=e(a,t,n);return a.receiveBackend(o),a}function Qt(e){let t=typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION__;return _e(Xt,e&&t&&t({name:`dnd-core`,instanceId:`dnd-core`}))}function $t(e,t){if(e==null)return{};var n=en(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 en(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 tn=0,j=Symbol.for(`__REACT_DND_CONTEXT_INSTANCE__`),nn=(0,C.memo)(function(e){var{children:t}=e;let[n,r]=rn($t(e,[`children`]));return(0,C.useEffect)(()=>{if(r){let e=on();return++tn,()=>{--tn===0&&(e[j]=null)}}},[]),(0,w.jsx)(fe.Provider,{value:n,children:t})});function rn(e){return`manager`in e?[{dragDropManager:e.manager},!1]:[an(e.backend,e.context,e.options,e.debugMode),!e.context]}function an(e,t=on(),n,r){let i=t;return i[j]||(i[j]={dragDropManager:Zt(e,t,n,r)}),i[j]}function on(){return typeof global<`u`?global:window}var sn=e(de(),1),M=typeof window<`u`?C.useLayoutEffect:C.useEffect;function cn(e,t,n){let[r,i]=(0,C.useState)(()=>t(e)),a=(0,C.useCallback)(()=>{let a=t(e);(0,sn.default)(r,a)||(i(a),n&&n())},[r,e,n]);return M(a),[r,a]}function ln(e,t,n){let[r,i]=cn(e,t,n);return M(function(){let t=e.getHandlerId();if(t!=null)return e.subscribeToStateChange(i,{handlerIds:[t]})},[e,i]),r}function un(e,t,n){return ln(t,e||(()=>({})),()=>n.reconnect())}function dn(e,t){let n=[...t||[]];return t==null&&typeof e!=`function`&&n.push(e),(0,C.useMemo)(()=>typeof e==`function`?e():e,n)}function fn(e){return(0,C.useMemo)(()=>e.hooks.dragSource(),[e])}function pn(e){return(0,C.useMemo)(()=>e.hooks.dragPreview(),[e])}var mn=!1,hn=!1,gn=class{receiveHandlerId(e){this.sourceId=e}getHandlerId(){return this.sourceId}canDrag(){E(!mn,`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 mn=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{mn=!1}}isDragging(){if(!this.sourceId)return!1;E(!hn,`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 hn=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{hn=!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()}},_n=!1,vn=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;E(!_n,`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 _n=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{_n=!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 yn(e,t,n){let r=n.getRegistry(),i=r.addTarget(e,t);return[i,()=>r.removeTarget(i)]}function bn(e,t,n){let r=n.getRegistry(),i=r.addSource(e,t);return[i,()=>r.removeSource(i)]}function xn(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 Sn(e){return typeof e==`object`&&!!e&&Object.prototype.hasOwnProperty.call(e,`current`)}function Cn(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 wn(e){return(t=null,n=null)=>{if(!(0,C.isValidElement)(t)){let r=t;return e(r,n),r}let r=t;return Cn(r),Dn(r,n?t=>e(t,n):e)}}function Tn(e){let t={};return Object.keys(e).forEach(n=>{let r=e[n];if(n.endsWith(`Ref`))t[n]=e[n];else{let e=wn(r);t[n]=()=>e}}),t}function En(e,t){typeof e==`function`?e(t):e.current=t}function Dn(e,t){let n=e.ref;return E(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,C.cloneElement)(e,{ref:e=>{En(n,e),En(t,e)}}):(0,C.cloneElement)(e,{ref:t})}var On=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!xn(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}didDragPreviewOptionsChange(){return!xn(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=Tn({dragSource:(e,t)=>{this.clearDragSource(),this.dragSourceOptions=t||null,Sn(e)?this.dragSourceRef=e:this.dragSourceNode=e,this.reconnectDragSource()},dragPreview:(e,t)=>{this.clearDragPreview(),this.dragPreviewOptions=t||null,Sn(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}},kn=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!xn(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=Tn({dropTarget:(e,t)=>{this.clearDropTarget(),this.dropTargetOptions=t,Sn(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 N(){let{dragDropManager:e}=(0,C.useContext)(fe);return E(e!=null,`Expected drag drop context`),e}function An(e,t){let n=N(),r=(0,C.useMemo)(()=>new On(n.getBackend()),[n]);return M(()=>(r.dragSourceOptions=e||null,r.reconnect(),()=>r.disconnectDragSource()),[r,e]),M(()=>(r.dragPreviewOptions=t||null,r.reconnect(),()=>r.disconnectDragPreview()),[r,t]),r}function jn(){let e=N();return(0,C.useMemo)(()=>new gn(e),[e])}var Mn=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 Nn(e,t,n){let r=(0,C.useMemo)(()=>new Mn(e,t,n),[t,n]);return(0,C.useEffect)(()=>{r.spec=e},[e]),r}function Pn(e){return(0,C.useMemo)(()=>{let t=e.type;return E(t!=null,`spec.type must be defined`),t},[e])}function Fn(e,t,n){let r=N(),i=Nn(e,t,n),a=Pn(e);M(function(){if(a!=null){let[e,o]=bn(a,i,r);return t.receiveHandlerId(e),n.receiveHandlerId(e),o}},[r,t,n,i,a])}function In(e,t){let n=dn(e,t);E(!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=jn(),i=An(n.options,n.previewOptions);return Fn(n,r,i),[un(n.collect,r,i),fn(i),pn(i)]}function Ln(e){let t=N().getMonitor(),[n,r]=cn(t,e);return(0,C.useEffect)(()=>t.subscribeToOffsetChange(r)),(0,C.useEffect)(()=>t.subscribeToStateChange(r)),n}function Rn(e){return(0,C.useMemo)(()=>e.hooks.dropTarget(),[e])}function zn(e){let t=N(),n=(0,C.useMemo)(()=>new kn(t.getBackend()),[t]);return M(()=>(n.dropTargetOptions=e||null,n.reconnect(),()=>n.disconnectDropTarget()),[e]),n}function Bn(){let e=N();return(0,C.useMemo)(()=>new vn(e),[e])}function Vn(e){let{accept:t}=e;return(0,C.useMemo)(()=>(E(e.accept!=null,`accept must be defined`),Array.isArray(t)?t:[t]),[t])}var Hn=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 Un(e,t){let n=(0,C.useMemo)(()=>new Hn(e,t),[t]);return(0,C.useEffect)(()=>{n.spec=e},[e]),n}function Wn(e,t,n){let r=N(),i=Un(e,t),a=Vn(e);M(function(){let[e,o]=yn(a,i,r);return t.receiveHandlerId(e),n.receiveHandlerId(e),o},[r,t,i,n,a.map(e=>e.toString()).join(`|`)])}function Gn(e,t){let n=dn(e,t),r=Bn(),i=zn(n.options);return Wn(n,r,i),[un(n.collect,r,i),Rn(i)]}function Kn(e){let t=null;return()=>(t??=e(),t)}function qn(e,t){return e.filter(e=>e!==t)}function Jn(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 Yn=class{enter(e){let t=this.entered.length,n=t=>this.isNodeInDocument(t)&&(!t.contains||t.contains(e));return this.entered=Jn(this.entered.filter(n),[e]),t===0&&this.entered.length>0}leave(e){let t=this.entered.length;return this.entered=qn(this.entered.filter(this.isNodeInDocument),e),t>0&&this.entered.length===0}reset(){this.entered=[]}constructor(e){this.entered=[],this.isNodeInDocument=e}},Xn=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()}},Zn=t({FILE:()=>Qn,HTML:()=>tr,TEXT:()=>er,URL:()=>$n}),Qn=`__NATIVE_FILE__`,$n=`__NATIVE_URL__`,er=`__NATIVE_TEXT__`,tr=`__NATIVE_HTML__`;function nr(e,t,n){return t.reduce((t,n)=>t||e.getData(n),``)??n}var rr={[Qn]:{exposeProperties:{files:e=>Array.prototype.slice.call(e.files),items:e=>e.items,dataTransfer:e=>e},matchesTypes:[`Files`]},[tr]:{exposeProperties:{html:(e,t)=>nr(e,t,``),dataTransfer:e=>e},matchesTypes:[`Html`,`text/html`]},[$n]:{exposeProperties:{urls:(e,t)=>nr(e,t,``).split(`
2
- `),dataTransfer:e=>e},matchesTypes:[`Url`,`text/uri-list`]},[er]:{exposeProperties:{text:(e,t)=>nr(e,t,``),dataTransfer:e=>e},matchesTypes:[`Text`,`text/plain`]}};function ir(e,t){let n=rr[e];if(!n)throw Error(`native type ${e} has no configuration`);let r=new Xn(n);return r.loadDataTransfer(t),r}function ar(e){if(!e)return null;let t=Array.prototype.slice.call(e.types||[]);return Object.keys(rr).filter(e=>{let n=rr[e];return n?.matchesTypes?n.matchesTypes.some(e=>t.indexOf(e)>-1):!1})[0]||null}var or=Kn(()=>/firefox/i.test(navigator.userAgent)),sr=Kn(()=>!!window.safari),cr=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}},lr=1;function ur(e){let t=e.nodeType===lr?e:e.parentElement;if(!t)return null;let{top:n,left:r}=t.getBoundingClientRect();return{x:r,y:n}}function P(e){return{x:e.clientX,y:e.clientY}}function dr(e){return e.nodeName===`IMG`&&(or()||!document.documentElement?.contains(e))}function fr(e,t,n,r){let i=e?t.width:n,a=e?t.height:r;return sr()&&e&&(a/=window.devicePixelRatio,i/=window.devicePixelRatio),{dragPreviewWidth:i,dragPreviewHeight:a}}function pr(e,t,n,r,i){let a=dr(t),o=ur(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}=fr(a,t,c,l),m=()=>{let e=new cr([0,.5,1],[s.y,s.y/l*p,s.y+p-l]).interpolate(d);return sr()&&a&&(e+=(window.devicePixelRatio-1)*p),e},h=()=>new cr([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 mr=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 hr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function gr(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){hr(e,t,n[t])})}return e}var _r=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 gr({dropEffect:this.altKeyPressed?`copy`:`move`},t||{})}getCurrentDropEffect(){return this.isDraggingNativeItem()?`copy`:this.getCurrentSourceNodeOptions().dropEffect}getCurrentSourcePreviewNodeOptions(){let e=this.monitor.getSourceId();return gr({anchorX:.5,anchorY:.5,captureDraggingState:!1},this.sourcePreviewNodeOptions.get(e)||{})}isDraggingNativeItem(){let e=this.monitor.getItemType();return Object.keys(Zn).some(t=>Zn[t]===e)}beginDragNativeItem(e,t){this.clearCurrentDragSourceNode(),this.currentNativeSource=ir(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&&ur(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=P(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=ar(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=pr(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=ar(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:P(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=P(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 ar(e.dataTransfer)&&e.preventDefault();this.enterLeaveCounter.reset()},this.handleTopDrop=e=>{let{dropTargetIds:t}=this;this.dropTargetIds=[],this.actions.hover(t,{clientOffset:P(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 mr(t,n),this.actions=e.getActions(),this.monitor=e.getMonitor(),this.registry=e.getRegistry(),this.enterLeaveCounter=new Yn(this.isNodeInDocument)}},F;function vr(){return F||(F=new Image,F.src=`data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==`),F}var yr=function(e,t,n){return new _r(e,t,n)},br=(0,C.createContext)(null);function I(){let e=(0,C.useContext)(br);if(e===null)throw Error(`No Tree Api Provided`);return e}var xr=(0,C.createContext)(null);function Sr(){let e=(0,C.useContext)(xr);if(e===null)throw Error(`Provide a NodesContext`);return e}var Cr=(0,C.createContext)(null);function wr(){let e=(0,C.useContext)(Cr);if(e===null)throw Error(`Provide a DnDContext`);return e}var Tr=(0,C.createContext)(0);function Er(){(0,C.useContext)(Tr)}var Dr=t({access:()=>z,bound:()=>L,dfs:()=>Pr,focusNextElement:()=>Fr,focusPrevElement:()=>Ir,getInsertIndex:()=>Wr,getInsertParentId:()=>Gr,identify:()=>B,identifyNull:()=>Br,indexOf:()=>Mr,isClosed:()=>kr,isDescendant:()=>jr,isItem:()=>Or,isOpenWithEmptyChildren:()=>Ar,mergeRefs:()=>Vr,noop:()=>Nr,safeRun:()=>Hr,waitFor:()=>Ur,walk:()=>R});function L(e,t,n){return Math.max(Math.min(e,n),t)}function Or(e){return e&&e.isLeaf}function kr(e){return e&&e.isInternal&&!e.isOpen}function Ar(e){return e&&e.isOpen&&!e.children?.length}var jr=(e,t)=>{let n=e;for(;n;){if(n.id===t.id)return!0;n=n.parent}return!1},Mr=e=>{if(!e.parent)throw Error(`Node does not have a parent`);return e.parent.children.findIndex(t=>t.id===e.id)};function Nr(){}function Pr(e,t){if(!e)return null;if(e.id===t)return e;if(e.children)for(let n of e.children){let e=Pr(n,t);if(e)return e}return null}function R(e,t){if(t(e),e.children)for(let n of e.children)R(n,t)}function Fr(e){let t=zr(e),n;for(let r=0;r<t.length;++r)if(t[r]===e){n=Lr(t,r);break}n?.focus()}function Ir(e){let t=zr(e),n;for(let r=0;r<t.length;++r)if(t[r]===e){n=Rr(t,r);break}n?.focus()}function Lr(e,t){return t+1<e.length?e[t+1]:e[0]}function Rr(e,t){return t-1>=0?e[t-1]:e[e.length-1]}function zr(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 z(e,t){return typeof t==`boolean`?t:typeof t==`string`?e[t]:t(e)}function Br(e){return e===null?null:B(e)}function B(e){return typeof e==`string`?e:e.id}function Vr(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}function Hr(e,...t){if(e)return e(...t)}function Ur(e){return new Promise((t,n)=>{let r=0;function i(){r+=1,r===100&&n(),e()?t():setTimeout(i,10)}i()})}function Wr(e){let t=e.focusedNode;return t?t.isOpen?0:t.parent?t.childIndex+1:0:e.root.children?.length??0}function Gr(e){let t=e.focusedNode;return t?t.isOpen?t.id:t.parent&&!t.parent.isRoot?t.parent.id:null:null}var Kr={display:`flex`,alignItems:`center`,zIndex:1},qr={flex:1,height:`2px`,background:`#4B91E2`,borderRadius:`1px`},Jr={width:`4px`,height:`4px`,boxShadow:`0 0 0 3px #4B91E2`,borderRadius:`50%`},Yr=C.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,w.jsxs)(`div`,{style:Object.assign(Object.assign({},Kr),r),children:[(0,w.jsx)(`div`,{style:Object.assign({},Jr)}),(0,w.jsx)(`div`,{style:Object.assign({},qr)})]})});function Xr({node:e,attrs:t,innerRef:n,children:r}){return(0,w.jsx)(`div`,Object.assign({},t,{ref:n,onFocus:e=>e.stopPropagation(),onClick:e.handleClick,children:r}))}function Zr(e){return(0,w.jsxs)(`div`,{ref:e.dragHandle,style:e.style,children:[(0,w.jsx)(`span`,{onClick:t=>{t.stopPropagation(),e.node.toggle()},children:e.node.isLeaf?`🌳`:e.node.isOpen?`🗁`:`🗀`}),` `,e.node.isEditing?(0,w.jsx)($r,Object.assign({},e)):(0,w.jsx)(Qr,Object.assign({},e))]})}function Qr(e){return(0,w.jsx)(w.Fragment,{children:(0,w.jsx)(`span`,{children:e.node.data.name})})}function $r({node:e}){let t=(0,C.useRef)();return(0,C.useEffect)(()=>{var e,n;(e=t.current)==null||e.focus(),(n=t.current)==null||n.select()},[]),(0,w.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 ei(e){return{type:`EDIT`,id:e}}function ti(e={id:null},t){return t.type===`EDIT`?Object.assign(Object.assign({},e),{id:t.id}):e}function V(e){return{type:`FOCUS`,id:e}}function ni(){return{type:`TREE_BLUR`}}function ri(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 ii=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===ai}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)}},ai=`__REACT_ARBORIST_INTERNAL_ROOT__`;function oi(e){function t(n,r,i){let a=new ii({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 ii({tree:e,id:ai,data:{id:ai},level:-1,parent:null,children:null,isDraggable:!0,rowIndex:null});return n.children=(e.props.data??[]).map(e=>t(e,0,n)),n}var si={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 ci(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 li(e={filtered:{},unfiltered:{}},t){return t.type.startsWith(`VISIBILITY`)?t.filtered?Object.assign(Object.assign({},e),{filtered:ci(e.filtered,t)}):Object.assign(Object.assign({},e),{unfiltered:ci(e.unfiltered,t)}):e}var H=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}}),U={clear:()=>({type:`SELECTION_CLEAR`}),only:e=>({type:`SELECTION_ONLY`,id:B(e)}),add:e=>({type:`SELECTION_ADD`,ids:(Array.isArray(e)?e:[e]).map(B)}),remove:e=>({type:`SELECTION_REMOVE`,ids:(Array.isArray(e)?e:[e]).map(B)}),set:e=>Object.assign({type:`SELECTION_SET`},e),mostRecent:e=>({type:`SELECTION_MOST_RECENT`,id:e===null?null:B(e)}),anchor:e=>({type:`SELECTION_ANCHOR`,id:e===null?null:B(e)})};function ui(e=H().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 W={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 di(e=H().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 H().dnd;case`DND_HOVERING`:return Object.assign(Object.assign({},e),{parentId:t.parentId,index:t.index});default:return e}}var fi={position:`fixed`,pointerEvents:`none`,zIndex:100,left:0,top:0,width:`100%`,height:`100%`},pi=e=>{if(!e)return{display:`none`};let{x:t,y:n}=e;return{transform:`translate(${t}px, ${n}px)`}},mi=e=>{if(!e)return{display:`none`};let{x:t,y:n}=e;return{transform:`translate(${t+10}px, ${n+10}px)`}};function hi({offset:e,mouse:t,id:n,dragIds:r,isDragging:i}){return(0,w.jsxs)(gi,{isDragging:i,children:[(0,w.jsx)(_i,{offset:e,children:(0,w.jsx)(yi,{id:n,dragIds:r})}),(0,w.jsx)(vi,{mouse:t,count:r.length})]})}var gi=(0,C.memo)(function(e){return e.isDragging?(0,w.jsx)(`div`,{style:fi,children:e.children}):null});function _i(e){return(0,w.jsx)(`div`,{className:`row preview`,style:pi(e.offset),children:e.children})}function vi(e){let{count:t,mouse:n}=e;return t>1?(0,w.jsx)(`div`,{className:`selected-count`,style:mi(n),children:t}):null}var yi=(0,C.memo)(function(e){let t=I(),n=t.get(e.id);return n?(0,w.jsx)(t.renderNode,{preview:!0,node:n,style:{paddingLeft:n.level*t.indent,opacity:.2,background:`transparent`},tree:t}):null}),bi=Number.isNaN||function(e){return typeof e==`number`&&e!==e};function xi(e,t){return!!(e===t||bi(e)&&bi(t))}function Si(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(!xi(e[n],t[n]))return!1;return!0}function Ci(e,t){t===void 0&&(t=Si);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 wi=typeof performance==`object`&&typeof performance.now==`function`?function(){return performance.now()}:function(){return Date.now()};function Ti(e){cancelAnimationFrame(e.id)}function Ei(e,t){var n=wi();function r(){wi()-n>=t?e.call(null):i.id=requestAnimationFrame(r)}var i={id:requestAnimationFrame(r)};return i}var Di=-1;function Oi(e){if(e===void 0&&(e=!1),Di===-1||e){var t=document.createElement(`div`),n=t.style;n.width=`50px`,n.height=`50px`,n.overflow=`scroll`,document.body.appendChild(t),Di=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return Di}var G=null;function ki(e){if(e===void 0&&(e=!1),G===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?G=`positive-descending`:(t.scrollLeft=1,G=t.scrollLeft===0?`negative`:`positive-ascending`),document.body.removeChild(t),G}return G}var Ai=150,ji=function(e,t){return e};function Mi(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){le(t,e);function t(t){var r=e.call(this,t)||this;return r._instanceProps=c(r.props,ue(r)),r._outerRef=void 0,r._resetIsScrollingTimeoutId=null,r.state={instance:ue(r),isScrolling:!1,scrollDirection:`forward`,scrollOffset:typeof r.props.initialScrollOffset==`number`?r.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},r._callOnItemsRendered=void 0,r._callOnItemsRendered=Ci(function(e,t,n,i){return r.props.onItemsRendered({overscanStartIndex:e,overscanStopIndex:t,visibleStartIndex:n,visibleStopIndex:i})}),r._callOnScroll=void 0,r._callOnScroll=Ci(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=Ci(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(ki()){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&&Ti(r._resetIsScrollingTimeoutId),r._resetIsScrollingTimeoutId=Ei(r._resetIsScrolling,Ai)},r._resetIsScrolling=function(){r._resetIsScrollingTimeoutId=null,r.setState({isScrolling:!1},function(){r._getItemStyleCache(-1,null)})},r}t.getDerivedStateFromProps=function(e,t){return Ni(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?Oi():0:c.scrollHeight>c.clientHeight?Oi():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(ki()){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&&Ti(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?ji:d,p=e.layout,m=e.outerElementType,h=e.outerTagName,g=e.style,_=e.useIsScrolling,v=e.width,ee=this.state.isScrolling,y=i===`horizontal`||p===`horizontal`,b=y?this._onScrollHorizontal:this._onScrollVertical,x=this._getRangeToRender(),te=x[0],re=x[1],ie=[];if(l>0)for(var S=te;S<=re;S++)ie.push((0,C.createElement)(t,{data:u,key:f(S,u),index:S,isScrolling:_?ee:void 0,style:this._getItemStyle(S)}));var ae=r(this.props,this._instanceProps);return(0,C.createElement)(m||h||`div`,{className:n,onScroll:b,ref:this._outerRefSetter,style:ne({position:`relative`,height:a,width:v,overflow:`auto`,WebkitOverflowScrolling:`touch`,willChange:`transform`,direction:i},g)},(0,C.createElement)(s||c||`div`,{children:ie,ref:o,style:{height:y?`100%`:ae,pointerEvents:ee?`none`:void 0,width:y?ae:`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}(C.PureComponent),t.defaultProps={direction:`ltr`,itemData:void 0,layout:`vertical`,overscanCount:2,useIsScrolling:!1},t}var Ni=function(e,t){e.children,e.direction,e.height,e.layout,e.innerTagName,e.outerTagName,e.width,t.instance},Pi=Mi({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 Fi(){let e=I(),t=wr().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,w.jsx)(a,{top:r,left:i,indent:n})}var Ii=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},Li=(0,C.forwardRef)(function(e,t){let{children:n}=e,r=Ii(e,[`children`]),i=I();return(0,w.jsxs)(`div`,Object.assign({ref:t},r,{onClick:e=>{e.currentTarget===e.target&&i.deselectAll()},children:[(0,w.jsx)(Ri,{}),n]}))}),Ri=()=>{let e=I();return(0,w.jsx)(`div`,{style:{height:e.visibleNodes.length*e.rowHeight,width:`100%`,position:`absolute`,left:`0`,right:`0`},children:(0,w.jsx)(Fi,{})})},zi=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},Bi=(0,C.forwardRef)(function(e,t){var{style:n}=e,r=zi(e,[`style`]);let i=I(),a=i.props.padding??i.props.paddingTop??0,o=i.props.padding??i.props.paddingBottom??0;return(0,w.jsx)(`div`,Object.assign({ref:t,style:Object.assign(Object.assign({},n),{height:`${parseFloat(n.height)+a+o}px`})},r))});function Vi(e){let t=I(),n=t.selectedIds,[r,i,a]=In(()=>({canDrag:()=>e.isDraggable,type:`NODE`,item:()=>{let r=t.isSelected(e.id)?Array.from(n):[e.id];return t.dispatch(W.dragStart(e.id,r)),{id:e.id,dragIds:r}},end:()=>{t.hideCursor(),t.dispatch(W.dragEnd())}}),[n,e]);return(0,C.useEffect)(()=>{a(vr())},[a]),i}function Hi(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 Ui(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 Wi(e,t){return{parentId:e||null,index:t}}function K(e,t){return{type:`line`,index:e,level:t}}function Gi(e){return{type:`highlight`,id:e}}function Ki(e,t){let n=e;for(;n.parent&&n.level>t;)n=n.parent;return{parentId:n.parent?.id||null,index:Mr(n)+1}}function qi(e){let t=Hi(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]=Ui(i,o,a,t);if(i&&i.isInternal&&t.inMiddle)return{drop:Wi(i.id,null),cursor:Gi(i.id)};if(!s)return{drop:Wi(c?.parent?.id,0),cursor:K(0,0)};if(Or(s)){let e=L(r,c?.level||0,s.level);return{drop:Ki(s,e),cursor:K(s.rowIndex+1,e)}}if(kr(s)){let e=L(r,c?.level||0,s.level);return{drop:Ki(s,e),cursor:K(s.rowIndex+1,e)}}if(Ar(s)){let e=L(r,0,s.level+1);return e>s.level?{drop:Wi(s.id,0),cursor:K(s.rowIndex+1,e)}:{drop:Ki(s,e),cursor:K(s.rowIndex+1,e)}}return{drop:Wi(s?.id,0),cursor:K(s.rowIndex+1,s.level+1)}}function Ji(e,t){let n=I(),[r,i]=Gn(()=>({accept:`NODE`,canDrop:()=>n.canDrop(),hover:(r,i)=>{let a=i.getClientOffset();if(!e.current||!a)return;let{cursor:o,drop:s}=qi({element:e.current,offset:a,indent:n.indent,node:t,prevNode:t.prev,nextNode:t.next});s&&n.dispatch(W.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;Hr(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 Yi(e){let t=I(),n=t.at(e);if(!n)throw Error(`Could not find node for index: ${e}`);return(0,C.useMemo)(()=>{let r=n.clone();return t.visibleNodes[e]=r,r},[...Object.values(n.state),n])}var Xi=C.memo(function({index:e,style:t}){Er(),Sr();let n=I(),r=Yi(e),i=(0,C.useRef)(null),a=Vi(r),o=Ji(i,r),s=(0,C.useCallback)(e=>{i.current=e,o(e)},[o]),c=n.indent*r.level,l=(0,C.useMemo)(()=>({paddingLeft:c}),[c]),u=(0,C.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,C.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,w.jsx)(p,{node:r,innerRef:s,attrs:d,children:(0,w.jsx)(f,{node:r,tree:n,style:l,dragHandle:a})})}),Zi=``,Qi=null;function $i(){Er();let e=I();return(0,w.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(),Fr(t.currentTarget);return}if(t.key===`Tab`&&t.shiftKey){t.preventDefault(),Ir(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(Qi),Zi+=t.key,Qi=setTimeout(()=>{Zi=``},600);let n=e.visibleNodes.find(e=>{let t=e.data.name;return typeof t==`string`&&t.toLowerCase().startsWith(Zi)});n&&e.focus(n.id)},children:(0,w.jsx)(Pi,{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:Li,innerElementType:Bi,onScroll:e.props.onScroll,onItemsRendered:e.onItemsRendered.bind(e),ref:e.list,children:Xi})})}function ea(e){return e.isFiltered?na(e.root,e.isMatch.bind(e)):ta(e.root)}function ta(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(ra),t}function na(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(ra),r}function ra(e,t){e.rowIndex=t}var ia=e=>e.reduce((e,t,n)=>(e[t.id]=n,e),{}),aa=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:q,identify:J,identifyNull:Y}=Dr,oa=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=oi(this),this.visibleNodes=ea(this),this.idToIndex=ia(this.visibleNodes)}update(e){this.props=e,this.root=oi(this),this.visibleNodes=ea(this),this.idToIndex=ia(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 z(e,this.props.childrenAccessor||`children`)??null}accessId(e){let t=z(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=Br(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 aa(this,arguments,void 0,function*(e={}){let t=e.parentId===void 0?Gr(this):e.parentId,n=e.index??Wr(this),r=e.type??`leaf`,i=yield q(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 aa(this,void 0,void 0,function*(){if(!e)return;let t=(Array.isArray(e)?e:[e]).map(J),n=t.map(e=>this.get(e)).filter(e=>!!e);yield q(this.props.onDelete,{nodes:n,ids:t})})}edit(t){let n=J(t);return this.resolveEdit({cancelled:!0}),this.scrollTo(n),this.dispatch(ei(n)),new Promise(t=>{e.editPromise=t})}submit(e,t){return aa(this,void 0,void 0,function*(){if(!e)return;let n=J(e);yield q(this.props.onRename,{id:n,name:t,node:this.get(n)}),this.dispatch(ei(null)),this.resolveEdit({cancelled:!1,value:t}),setTimeout(()=>this.onFocus())})}reset(){this.dispatch(ei(null)),this.resolveEdit({cancelled:!0}),setTimeout(()=>this.onFocus())}activate(e){let t=this.get(Y(e));t&&q(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(V(J(e))),t.scroll!==!1&&this.scrollTo(e),this.focusedNode&&q(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=J(e);n&&this.dispatch(V(r)),this.dispatch(U.only(r)),this.dispatch(U.anchor(r)),this.dispatch(U.mostRecent(r)),this.scrollTo(r,t.align),this.focusedNode&&n&&q(this.props.onFocus,this.focusedNode),q(this.props.onSelect,this.selectedNodes)}deselect(e){if(!e)return;let t=J(e);this.dispatch(U.remove(t)),q(this.props.onSelect,this.selectedNodes)}selectMulti(e){let t=this.get(Y(e));t&&(this.dispatch(V(t.id)),this.dispatch(U.add(t.id)),this.dispatch(U.anchor(t.id)),this.dispatch(U.mostRecent(t.id)),this.scrollTo(t),this.focusedNode&&q(this.props.onFocus,this.focusedNode),q(this.props.onSelect,this.selectedNodes))}selectContiguous(e){if(!e)return;let t=J(e),{anchor:n,mostRecent:r}=this.state.nodes.selection;this.dispatch(V(t)),this.dispatch(U.remove(this.nodesBetween(n,r))),this.dispatch(U.add(this.nodesBetween(n,Y(t)))),this.dispatch(U.mostRecent(t)),this.scrollTo(t),this.focusedNode&&q(this.props.onFocus,this.focusedNode),q(this.props.onSelect,this.selectedNodes)}deselectAll(){this.setSelection({ids:[],anchor:null,mostRecent:null}),q(this.props.onSelect,this.selectedNodes)}selectAll(){this.setSelection({ids:Object.keys(this.idToIndex),anchor:this.firstNode,mostRecent:this.lastNode}),this.dispatch(V(this.lastNode?.id)),this.focusedNode&&q(this.props.onFocus,this.focusedNode),q(this.props.onSelect,this.selectedNodes)}setSelection(e){let t=new Set(e.ids?.map(J)),n=Y(e.anchor),r=Y(e.mostRecent);this.dispatch(U.set({ids:t,anchor:n,mostRecent:r})),q(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&&jr(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(W.cursor({type:`none`}))}showCursor(e){this.dispatch(W.cursor(e))}open(e){let t=Y(e);t&&(this.isOpen(t)||(this.dispatch(si.open(t,this.isFiltered)),q(this.props.onToggle,t)))}close(e){let t=Y(e);t&&this.isOpen(t)&&(this.dispatch(si.close(t,this.isFiltered)),q(this.props.onToggle,t))}toggle(e){let t=Y(e);if(t)return this.isOpen(t)?this.close(t):this.open(t)}openParents(e){let t=Y(e);if(!t)return;let n=Pr(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(){R(this.root,e=>{e.isInternal&&e.open()})}closeAll(){R(this.root,e=>{e.isInternal&&e.close()})}scrollTo(e,t=`smart`){if(!e)return;let n=J(e);return this.openParents(n),Ur(()=>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!z(e,this.props.disableEdit||(()=>!1))}isDraggable(e){return!z(e,this.props.disableDrag||(()=>!1))}isDragging(e){let t=Y(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=Y(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(V(e.id))}onBlur(){this.dispatch(ni())}onItemsRendered(e){this.visibleStartIndex=e.visibleStartIndex,this.visibleStopIndex=e.visibleStopIndex}get renderContainer(){return this.props.renderContainer||$i}get renderRow(){return this.props.renderRow||Xr}get renderNode(){return this.props.children||Zr}get renderDragPreview(){return this.props.renderDragPreview||hi}get renderCursor(){return this.props.renderCursor||Yr}};function X(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 sa=typeof Symbol==`function`&&Symbol.observable||`@@observable`,ca=()=>Math.random().toString(36).substring(7).split(``).join(`.`),la={INIT:`@@redux/INIT${ca()}`,REPLACE:`@@redux/REPLACE${ca()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${ca()}`};function ua(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 da(e,t,n){if(typeof e!=`function`)throw Error(X(2));if(typeof t==`function`&&typeof n==`function`||typeof n==`function`&&typeof arguments[3]==`function`)throw Error(X(0));if(typeof t==`function`&&n===void 0&&(n=t,t=void 0),n!==void 0){if(typeof n!=`function`)throw Error(X(1));return n(da)(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(X(3));return i}function d(e){if(typeof e!=`function`)throw Error(X(4));if(c)throw Error(X(5));let t=!0;l();let n=s++;return o.set(n,e),function(){if(t){if(c)throw Error(X(6));t=!1,l(),o.delete(n),a=null}}}function f(e){if(!ua(e))throw Error(X(7));if(e.type===void 0)throw Error(X(8));if(typeof e.type!=`string`)throw Error(X(17));if(c)throw Error(X(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(X(10));r=e,f({type:la.REPLACE})}function m(){let e=d;return{subscribe(t){if(typeof t!=`object`||!t)throw Error(X(11));function n(){let e=t;e.next&&e.next(u())}return n(),{unsubscribe:e(n)}},[sa](){return this}}}return f({type:la.INIT}),{dispatch:f,subscribe:d,getState:u,replaceReducer:p,[sa]:m}}function fa(e){Object.keys(e).forEach(t=>{let n=e[t];if(n(void 0,{type:la.INIT})===void 0)throw Error(X(12));if(n(void 0,{type:la.PROBE_UNKNOWN_ACTION()})===void 0)throw Error(X(13))})}function pa(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{fa(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(X(14));o[s]=u,a||=u!==l}return a||=r.length!==Object.keys(e).length,a?o:e}}function ma(e=H().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 ha=pa({nodes:pa({focus:ri,edit:ti,open:li,selection:ui,drag:ma}),dnd:di}),ga=H();function _a({treeProps:e,imperativeHandle:t,children:n}){let r=(0,C.useRef)(null),i=(0,C.useRef)(null),a=(0,C.useRef)(da(ha,H(e))),o=(0,se.useSyncExternalStore)(a.current.subscribe,a.current.getState,()=>ga),s=(0,C.useMemo)(()=>new oa(a.current,e,r,i),[]),c=(0,C.useRef)(0);return(0,C.useMemo)(()=>{c.current+=1,s.update(e)},[...Object.values(e),o.nodes.open]),(0,C.useImperativeHandle)(t,()=>s),(0,C.useEffect)(()=>{s.props.selection?s.select(s.props.selection,{focus:!1}):s.deselectAll()},[s.props.selection]),(0,C.useEffect)(()=>{s.props.searchTerm||a.current.dispatch(si.clear(!0))},[s.props.searchTerm]),(0,w.jsx)(br.Provider,{value:s,children:(0,w.jsx)(Tr.Provider,{value:c.current,children:(0,w.jsx)(xr.Provider,{value:o.nodes,children:(0,w.jsx)(Cr.Provider,{value:o.dnd,children:(0,w.jsx)(nn,Object.assign({backend:yr,options:{rootElement:s.props.dndRootElement||void 0}},e.dndManager&&{manager:e.dndManager},{children:n}))})})})})}function va(){let e=I(),[,t]=Gn(()=>({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}=qi({element:e.listEl.current,offset:r,indent:e.indent,node:null,prevNode:e.visibleNodes[e.visibleNodes.length-1],nextNode:null});a&&e.dispatch(W.hovering(a.parentId,a.index)),n.canDrop()?i&&e.showCursor(i):e.hideCursor()}}),[e]);t(e.listEl)}function ya(e){return va(),e.children}function ba(){let e=I().props.renderContainer||$i;return(0,w.jsx)(w.Fragment,{children:(0,w.jsx)(e,{})})}function xa(){let e=I(),{offset:t,mouse:n,item:r,isDragging:i}=Ln(e=>({offset:e.getSourceClientOffset(),mouse:e.getClientOffset(),item:e.getItem(),isDragging:e.isDragging()})),a=e.props.renderDragPreview||hi;return(0,w.jsx)(a,{offset:t,mouse:n,id:r?.id||null,dragIds:r?.dragIds||[],isDragging:i})}var Sa=class{constructor(e){this.root=Ca(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 Ca(e){let t=new Ta({id:`ROOT`},null);return t.children=e.map(e=>wa(e,t)),t}function wa(e,t){let n=new Ta(e,t);return e.children&&(n.children=e.children.map(e=>wa(e,n))),n}var Ta=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=wa(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)}},Ea=0;function Da(e){let[t,n]=(0,C.useState)(e),r=(0,C.useMemo)(()=>new Sa(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-${Ea++}`,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 Oa(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]=Da(e.initialData);return Object.assign(Object.assign(Object.assign({},e),n),{data:t})}return e}function ka(e,t){let n=Oa(e);return(0,w.jsxs)(_a,{treeProps:n,imperativeHandle:t,children:[(0,w.jsx)(ya,{children:(0,w.jsx)(ba,{})}),(0,w.jsx)(xa,{})]})}var Aa=(0,C.forwardRef)(ka),Z=a(),ja=5,Ma=/^[A-Za-z]:[/\\]/,Na=/^\\\\/;function Q(e){return e.success?e:(b({title:`Failed`,description:e.message}),null)}var Pa=class{delegate=new Sa([]);callbacks;constructor(e){this.callbacks=e}roots=[];onChange=o.NOOP;path=new x(`/`);initialize=async e=>{if(this.onChange=e,this.delegate.data.length===0)try{let{roots:e}=await this.callbacks.getRoots(),t=e.find(e=>e.isPrimary);if(!t)throw Error(`File browser response is missing a primary root`);if(this.roots=e,this.path=x.guessDeliminator(t.path),this.delegate=new Sa(e.map(Fa)),e.length===1){let e=await this.callbacks.listFiles({path:t.path});this.delegate.update({id:this.getPrimaryRootId(),changes:{children:$(e.files,t)}})}}catch(e){b({title:`Failed`,description:te(e)})}this.emitChange()};async expand(e){let t=this.delegate.find(e);if(!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.getRootForNode(t.data))}}),this.emitChange(),!0}async copy(e,t){let n=this.getMutableNode(e);if(!n)return;let r=n.data.path,i=this.getParentPath(n.data),a=za(i,t);await this.callbacks.copyFileOrFolder({path:r,newPath:a}).then(Q)&&await this.refreshPath(i)}async rename(e,t){let n=this.getMutableNode(e);if(!n)return;let r=n.data.path,i=this.getParentPath(n.data),a=za(i,t);await this.callbacks.renameFileOrFolder({path:r,newPath:a}).then(Q)&&await this.refreshPath(i)}async move(e,t){let n=t??this.getPrimaryRootId(),r=this.delegate.find(n);if(!r?.data.isDirectory)return;let i=new Set;await ae(e,ja,async e=>{let t=this.getMutableNode(e,!1);if(!t)return;let n=t.data.path,a=this.getParentPath(t.data),o=za(r.data.path,this.path.basename(n));await this.callbacks.renameFileOrFolder({path:n,newPath:o}).then(Q)&&(i.add(r.data.path),i.add(a))}),await this.refreshPaths([...i])}async createFile({name:e,parentId:t,type:n=`file`}){let r=this.getParentNode(t);r&&await this.callbacks.createFileOrFolder({path:r.data.path,type:n,name:e}).then(Q)&&await this.refreshPath(r.data.path)}async createFolder(e,t){let n=this.getParentNode(t);n&&await this.callbacks.createFileOrFolder({path:n.data.path,type:`directory`,name:e}).then(Q)&&await this.refreshPath(n.data.path)}async delete(e){let t=this.getMutableNode(e);if(!t)return;let n=this.getParentPath(t.data);await this.callbacks.deleteFileOrFolder({path:t.data.path}).then(Q)&&await this.refreshPath(n)}refreshAll=async e=>{let t=[...this.roots.map(e=>e.path),...e.map(e=>this.delegate.find(e)?.data.path).filter(e=>!!e)];await this.refreshPaths(t)};refreshPath=async e=>{await this.refreshPaths([e])};getPrimaryRelativePath=e=>{let t=this.getPrimaryRoot();return t?La(e,t.path):null};getPrimaryRootPath=()=>this.getPrimaryRoot()?.path??``;getPrimaryRootId=()=>{let e=this.getPrimaryRoot()?.path??``;return Ia(e,e)};isPrimaryNode=e=>e.isPrimaryRoot;getDisplayPath=e=>{let t=this.getRootForPath(e);if(!t)return e;let n=La(e,t.path);return n?t.isPrimary?n:`${t.name}/${n}`:t.name};isRootPath=e=>this.roots.some(t=>Ra(e,t.path));getPrimaryRoot(){return this.roots.find(e=>e.isPrimary)}getRootForNode(e){return this.roots.find(t=>Ra(t.path,e.rootPath))??this.getPrimaryRoot()??{path:e.rootPath,name:e.rootPath,isPrimary:e.isPrimaryRoot}}getRootForPath(e){return this.roots.filter(t=>La(e,t.path)!==null).toSorted((e,t)=>t.path.length-e.path.length)[0]}getParentNode(e){let t=e??this.getPrimaryRootId(),n=this.delegate.find(t);return n?.data.isDirectory?n:null}getParentPath(e){return(this.delegate.find(e.id)?.parent)?.data.path??e.rootPath}getMutableNode(e,t=!0){let n=this.delegate.find(e);return!n||n.data.isRoot?(t&&b({title:`Failed`,description:n?`File browser roots cannot be modified`:`Node with id ${e} not found in the tree`}),null):n}refreshPaths=async e=>{let t=[...new Set(e)];if(t.length===0)return;let n=await ae(t,ja,e=>this.callbacks.listFiles({path:e}).catch(()=>null));for(let[e,r]of t.entries()){let t=n[e];if(t)for(let e of this.roots){let n=this.delegate.find(Ia(e.path,r));n?.data.isDirectory&&this.delegate.update({id:n.id,changes:{children:$(t.files,e)}})}}this.emitChange()};emitChange(){let e=this.delegate.data;this.onChange(this.roots.length===1?e[0]?.children??[]:e)}};function Fa(e){return{id:Ia(e.path,e.path),path:e.path,name:e.name,isDirectory:!0,isMarimoFile:!1,children:[],isRoot:!0,rootPath:e.path,isPrimaryRoot:e.isPrimary}}function $(e,t){return e.map(e=>({...e,id:Ia(t.path,e.path),children:$(e.children??[],t),isRoot:!1,rootPath:t.path,isPrimaryRoot:t.isPrimary}))}function Ia(e,t){return`${encodeURIComponent(e)}:${encodeURIComponent(t)}`}function La(e,t){let n=Ba(t),r=e=>n?e.toLowerCase():e,i=r(e);if(i===r(t))return``;let a=Va(t),o=t.endsWith(a)?t:`${t}${a}`,s=r(o);return i.startsWith(s)?e.slice(o.length):null}function Ra(e,t){return La(e,t)===``}function za(e,t){let n=Va(e);return`${e}${e.endsWith(n)?``:n}${t}`}function Ba(e){return Ma.test(e)||Na.test(e)}function Va(e){return Na.test(e)||/^[A-Za-z]:\\/.test(e)?`\\`:`/`}function Ha(e){let t=(0,Z.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}=S({path:e.path,name:t,root:n});return Q(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}=S({path:e.path,name:ie(e.name),root:n});return Q(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=>Q(await a({path:re(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 Ua={file:`Delete file`,folder:`Delete folder`,notebook:`Delete notebook`};function Wa(){let e=(0,Z.c)(2),{openConfirm:t}=ee(),n;return e[0]===t?n=e[1]:(n=(e,n)=>{let r=e.kind??`file`;t({title:Ua[r],description:`Are you sure you want to delete ${e.name}?`,confirmAction:(0,w.jsx)(c,{onClick:async()=>{await n()},"aria-label":`Confirm`,children:`Delete`})})},e[0]=t,e[1]=n),n}function Ga(e){let t=(0,Z.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}=Ha(o),l=Wa(),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 Ka=e=>{let t=(0,Z.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,w.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,w.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,w.jsx)(f,{align:`end`,className:h,onClick:Xa,onCloseAutoFocus:Za,children:s}),t[9]=s,t[10]=h,t[11]=_):_=t[11];let v;return t[12]!==m||t[13]!==_?(v=(0,w.jsxs)(p,{modal:!1,children:[m,_]}),t[12]=m,t[13]=_,t[14]=v):v=t[14],v},qa=e=>{let t=(0,Z.c)(6),{onSelect:n,disabled:r,title:i,testId:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,w.jsx)(oe,{className:_}),t[0]=o):o=t[0];let s;return t[1]!==r||t[2]!==n||t[3]!==a||t[4]!==i?(s=(0,w.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},Ja=e=>{let t=(0,Z.c)(6),{onSelect:n,disabled:r,title:i,testId:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,w.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,w.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},Ya=e=>{let t=(0,Z.c)(6),{onSelect:n,disabled:r,title:i,testId:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,w.jsx)(y,{className:_}),t[0]=o):o=t[0];let s;return t[1]!==r||t[2]!==n||t[3]!==a||t[4]!==i?(s=(0,w.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 Xa(e){return e.stopPropagation()}function Za(e){return e.preventDefault()}var Qa=e=>{let t=(0,Z.c)(10),{node:n}=e,r=(0,C.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,C.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,w.jsx)(`input`,{ref:r,className:`flex-1 bg-transparent border border-border text-muted-foreground`,defaultValue:n.data.name,onClick:$a,onBlur:o,onKeyDown:s}),t[6]=n.data.name,t[7]=o,t[8]=s,t[9]=c):c=t[9],c};function $a(e){return e.stopPropagation()}export{qa as a,Pa as c,N as d,nn as f,Ka as i,Aa as l,Ya as n,Ha as o,Ja as r,Ga as s,Qa as t,yr as u};