import{j as e}from"./reactflow-vendor-BDofclgK.js";import{c as p,S as h,a as o,F as f,I as u,B as j}from"./Stack-DW41pKK2.js";import{I as g,C as v}from"./TopMenu-342fNe3V.js";import{r}from"./react-vendor-4ldeB94U.js";import{w as y,f as N}from"./index-BXctaVea.js";/**
 * @license @tabler/icons-react v3.18.0 - MIT
 *
 * This source code is licensed under the MIT license.
 * See the LICENSE file in the root directory of this source tree.
 */var k=p("outline","box","IconBox",[["path",{d:"M12 3l8 4.5l0 9l-8 4.5l-8 -4.5l0 -9l8 -4.5",key:"svg-0"}],["path",{d:"M12 12l8 -4.5",key:"svg-1"}],["path",{d:"M12 12l0 9",key:"svg-2"}],["path",{d:"M12 12l-8 -4.5",key:"svg-3"}]]);/**
 * @license @tabler/icons-react v3.18.0 - MIT
 *
 * This source code is licensed under the MIT license.
 * See the LICENSE file in the root directory of this source tree.
 */var b=p("outline","brand-tabler","IconBrandTabler",[["path",{d:"M8 9l3 3l-3 3",key:"svg-0"}],["path",{d:"M13 15l3 0",key:"svg-1"}],["path",{d:"M4 4m0 4a4 4 0 0 1 4 -4h8a4 4 0 0 1 4 4v8a4 4 0 0 1 -4 4h-8a4 4 0 0 1 -4 -4z",key:"svg-2"}]]);function x({path:t}){const[a,n]=r.useState([]),{setDropingNode:d}=y(),[m,c]=r.useState(!1);return r.useEffect(()=>{c(!0),N("/list_package_children?path="+encodeURIComponent(t)).then(s=>s.json()).then(s=>{n(s)}).finally(()=>{c(!1)})},[]),e.jsx("div",{className:"flex flex-col",children:e.jsxs("div",{className:"flex flex-col",children:[m&&e.jsx(h,{}),a.map(s=>{var i;return s.type==="folder"?e.jsx(I,{node:s},s.path):e.jsxs(o,{onClick:()=>{},children:[e.jsx(f,{children:e.jsx("p",{className:"text-muted-foreground",children:s.name})}),(i=s.functions)==null?void 0:i.map(l=>e.jsxs("div",{draggable:!0,onDragStart:C=>{console.log(l),d(l)},className:"flex flex-row items-center ml-2 py-1 font-semibold gap-1 cursor-pointer hover:bg-secondary",children:[e.jsx(b,{size:18}),e.jsx("span",{children:l.name})]},s.path+"_"+l.name))]},s.type+"_"+s.name)})]})})}function I({node:t}){const[a,n]=r.useState(!1);return e.jsxs(o,{className:"",children:[e.jsxs("div",{className:"flex flex-row items-center cursor-pointer",onClick:()=>n(!a),children:[e.jsx(g,{size:8,className:a?"mr-1":"-rotate-90 mr-1"}),e.jsx(u,{className:"mr-1"}),t.name]}),a&&e.jsx("div",{className:"ml-3",children:e.jsx(x,{path:t.path})})]})}function D(){const[t,a]=r.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsx(j,{onClick:()=>a(!0),left:e.jsx(k,{size:18}),children:"Nodes"}),t&&e.jsx(v,{onClose:()=>a(!1),backdrop:null,children:e.jsxs(o,{className:"w-[400px] py-2 px-2 overflow-y-auto h-[100vh]",children:[e.jsx("h2",{className:"text-xl font-bold p-2",children:"Nodes"}),e.jsx(x,{path:""})]})})]})}export{D as default};
