import{O as a,b as r,S as n,A as t,n as e,o,q as g,r as s,s as l,C as d,y as c,z as f,g as i}from"../../vendor.js";import{forwardRef as u,useState as v,Children as m,cloneElement as D}from"react";var b=["className","children","disabled","data","dragImage","dragImageOffset","onDrag","onBeforeDragStart","onDragStart","onDragEnd"];function p(a,r){var n=c(a);if(f){var t=f(a);r&&(t=i(t).call(t,(function(r){return l(a,r).enumerable}))),n.push.apply(n,t)}return n}function h(a){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?p(Object(n),!0).forEach((function(r){e(a,r,n[r])})):o?g(a,o(n)):p(Object(n)).forEach((function(r){s(a,r,l(n,r))}))}return a}var y=u((function(e,o){var g=e.className,s=e.children,l=e.disabled,c=void 0!==l&&l,f=e.data,i=void 0===f?{}:f,u=e.dragImage,p=e.dragImageOffset,y=void 0===p?{x:0,y:0}:p,S=e.onDrag,E=e.onBeforeDragStart,I=e.onDragStart,O=e.onDragEnd,x=a(e,b),N=v(!1),j=r(N,2),B=j[0],T=j[1],C=v(!1),q=r(C,2),z=q[0],A=q[1];n((function(){z&&(T(!0),A(!1))}),0,[z]);var R=m.only(s);return D(R,h(h({},x),{},{ref:o,className:t(g,R.props.className,{dragging:!c&&z,dragged:!c&&B,draggable:!c}),draggable:!c,onDragStart:function(a){if(!c){null==E||E(a);var r=a.currentTarget.getBoundingClientRect();try{var n,t;null===(n=(t=a.dataTransfer).setData)||void 0===n||n.call(t,"text",d(i)),u&&a.dataTransfer.setDragImage(u,y.x,y.y)}catch(a){}A(!0),null==I||I(a,r)}},onDrag:function(a){c||null==S||S(a)},onDragEnd:function(a){c||(T(!1),null==O||O(a))}}))}));export{y as D};
//# sourceMappingURL=index.js.map
