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