import{r as c,W as y,a4 as n,a5 as D,u as g}from"./Bxv1kRJt.js";function T(o,p={isKey:!0}){const l=c(!1),d=y(null);let u=0,s=!0;const a=typeof p=="function"?{onDrop:p}:p,t=r=>{const e=Array.from(r.dataTransfer?.files??[]);return d.value=e.length===0?null:e};return n(o,"dragstart",r=>{s&&(r.stopPropagation(),a.onStart?.(t(r),r))}),n(o,"dragenter",r=>{if(a.dataTypes&&r.dataTransfer){const e=Array.from(r?.dataTransfer?.items||[]).map(i=>i.kind==="file"?i.type:null).filter(D),f=g(a.dataTypes);if(s=typeof f=="function"?f(e):f?f.some(i=>e.includes(i)):!0,!s)return}r.stopPropagation(),u+=1,l.value=!0,a.onEnter?.(t(r),r)}),n(o,"dragover",r=>{s&&(r.preventDefault(),a.onOver?.(t(r),r))}),n(o,"dragleave",r=>{s&&(r.stopPropagation(),u-=1,u===0&&(l.value=!1),a.onLeave?.(t(r),r))}),n(o,"drop",r=>{r.stopPropagation(),r.preventDefault(),u=0,l.value=!1,a.onDrop?.(t(r),r)}),{files:d,isOverDropZone:l}}export{T as u};
