import{r as t,a,j as r}from"./router.chunk.YsRm4bSN.js";import{u as s,a as n,P as e,D as o,r as i,b as c,c as d,d as l,S as u,v as m,e as f,f as b,g,C as h}from"./dnd-kit.chunk.zD1taGvv.js";import{r as p}from"./ui-radix.chunk.Xzokq_Gv.js";import{i as j,c as x}from"./main.chunk.N-eZ2ybB.js";const y=({items:a,children:g,onSortCompleted:h,overlay:x,disabled:y,...v})=>{const[S,k]=t.useState(null),C=s(n(e,{activationConstraint:{distance:10}})),D=[i,c,d];return r.jsxs(o,{sensors:C,collisionDetection:l,onDragStart:t=>{const{active:r}=t,s=r.data.current?.sortable,n=s?.index;j(n)&&k(a[n]??null)},onDragEnd:t=>{const{active:r,over:s}=t;if(s&&r.id!==s.id){const t=r.data.current?.sortable,n=s.data.current?.sortable,e=t?.index,o=n?.index;j(e)&&j(o)&&h?.(b(a,e,o))}k(null)},modifiers:D,...v,children:[r.jsx(u,{items:a,strategy:m,disabled:y,children:g}),p.createPortal(r.jsx(f,{dropAnimation:null,children:S?x?.(S):null}),document.getElementById("growfund-root")??document.body)]})};y.displayName="SortableContainer";const v=a.forwardRef(({children:a,className:s,id:n,...e},o)=>{const{attributes:i,listeners:c,setNodeRef:d,transition:l,transform:u,isDragging:m}=g({id:n}),f={transform:h.Transform.toString(u),transition:l,opacity:m?.2:void 0},b=function(...a){return t.useCallback(t=>{a.forEach(a=>{a&&("function"==typeof a?a(t):j(a)&&"current"in a&&(a.current=t))})},[a])}(o,d);return r.jsx("div",{ref:b,style:f,className:x(s),...i,...c,...e,children:a})});v.displayName="SortableItem";export{y as S,v as a};
