{"version":3,"sources":["../../../../src/elements/useDropZone/index.ts"],"sourcesContent":["\"use client\";\nimport { useScope, toObs, type DeepMaybeObservable } from \"@usels/core\";\nimport { createDropZone, type UseDropZoneOptions, type UseDropZoneReturn } from \"./core\";\nimport type { MaybeEventTarget } from \"../../types\";\n\nexport { createDropZone } from \"./core\";\nexport type { UseDropZoneOptions, UseDropZoneReturn } from \"./core\";\n\n/**\n * Hook-level type alias for `useDropZone`. Mirrors the `createDropZone` core\n * signature (target + options); the hook additionally accepts an `onDrop`\n * callback shorthand at runtime.\n */\nexport type UseDropZone = typeof createDropZone;\n\n/**\n * Turns any element into a file drop zone. Tracks drag-over state and validates\n * file types before accepting drops.\n *\n * Accepts either an options object (supports `DeepMaybeObservable`) or a plain\n * `onDrop` callback shorthand.\n */\nexport function useDropZone(\n  target: MaybeEventTarget,\n  options?: DeepMaybeObservable<UseDropZoneOptions> | UseDropZoneOptions[\"onDrop\"]\n): UseDropZoneReturn {\n  // Shorthand: a bare function is treated as onDrop.\n  const normalized: DeepMaybeObservable<UseDropZoneOptions> =\n    typeof options === \"function\"\n      ? ({ onDrop: options } as UseDropZoneOptions)\n      : (options ?? ({} as UseDropZoneOptions));\n\n  return useScope(\n    (opts) => {\n      const opts$ = toObs(opts, { dataTypes: \"plain\" });\n      return createDropZone(target, opts$);\n    },\n    normalized as Record<string, unknown>\n  );\n}\n"],"mappings":";AACA,SAAS,UAAU,aAAuC;AAC1D,SAAS,sBAAuE;AAGhF,SAAS,kBAAAA,uBAAsB;AAiBxB,SAAS,YACd,QACA,SACmB;AAEnB,QAAM,aACJ,OAAO,YAAY,aACd,EAAE,QAAQ,QAAQ,IAClB,WAAY,CAAC;AAEpB,SAAO;AAAA,IACL,CAAC,SAAS;AACR,YAAM,QAAQ,MAAM,MAAM,EAAE,WAAW,QAAQ,CAAC;AAChD,aAAO,eAAe,QAAQ,KAAK;AAAA,IACrC;AAAA,IACA;AAAA,EACF;AACF;","names":["createDropZone"]}