"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const jsxRuntime = require("react/jsx-runtime");
const index = require("../../../../../react-dropzone-esm@15.2.0_react@18.3.1/node_modules/react-dropzone-esm/dist/esm/index.cjs");
const Dropzone_context = require("./Dropzone.context.cjs");
const DropzoneStatus = require("./DropzoneStatus.cjs");
const Dropzone_module_css = require("./Dropzone.module.css.cjs");
const factory = require("../../../../../@mantine_core@7.15.2_patch_hash_jclkxeaefn6uz54h34k3r3yjsq_@mantine_hooks@7.15.2_react@18.3.1_szqfuioo5damkjdixckhzmwycq/node_modules/@mantine/core/esm/core/factory/factory.cjs");
const useProps = require("../../../../../@mantine_core@7.15.2_patch_hash_jclkxeaefn6uz54h34k3r3yjsq_@mantine_hooks@7.15.2_react@18.3.1_szqfuioo5damkjdixckhzmwycq/node_modules/@mantine/core/esm/core/MantineProvider/use-props/use-props.cjs");
const useStyles = require("../../../../../@mantine_core@7.15.2_patch_hash_jclkxeaefn6uz54h34k3r3yjsq_@mantine_hooks@7.15.2_react@18.3.1_szqfuioo5damkjdixckhzmwycq/node_modules/@mantine/core/esm/core/styles-api/use-styles/use-styles.cjs");
const useMergedRef = require("../../../../../@mantine_hooks@7.15.2_react@18.3.1/node_modules/@mantine/hooks/esm/use-merged-ref/use-merged-ref.cjs");
const Box = require("../../../../../@mantine_core@7.15.2_patch_hash_jclkxeaefn6uz54h34k3r3yjsq_@mantine_hooks@7.15.2_react@18.3.1_szqfuioo5damkjdixckhzmwycq/node_modules/@mantine/core/esm/core/Box/Box.cjs");
const LoadingOverlay = require("../../../../../@mantine_core@7.15.2_patch_hash_jclkxeaefn6uz54h34k3r3yjsq_@mantine_hooks@7.15.2_react@18.3.1_szqfuioo5damkjdixckhzmwycq/node_modules/@mantine/core/esm/components/LoadingOverlay/LoadingOverlay.cjs");
const createVarsResolver = require("../../../../../@mantine_core@7.15.2_patch_hash_jclkxeaefn6uz54h34k3r3yjsq_@mantine_hooks@7.15.2_react@18.3.1_szqfuioo5damkjdixckhzmwycq/node_modules/@mantine/core/esm/core/styles-api/create-vars-resolver/create-vars-resolver.cjs");
const getSize = require("../../../../../@mantine_core@7.15.2_patch_hash_jclkxeaefn6uz54h34k3r3yjsq_@mantine_hooks@7.15.2_react@18.3.1_szqfuioo5damkjdixckhzmwycq/node_modules/@mantine/core/esm/core/utils/get-size/get-size.cjs");
const defaultProps = {
  loading: false,
  multiple: true,
  maxSize: Infinity,
  autoFocus: false,
  activateOnClick: true,
  activateOnDrag: true,
  dragEventsBubbling: true,
  activateOnKeyboard: true,
  useFsAccessApi: true,
  variant: "light",
  rejectColor: "red"
};
const varsResolver = createVarsResolver.createVarsResolver(
  (theme, { radius, variant, acceptColor, rejectColor }) => {
    const acceptColors = theme.variantColorResolver({
      color: acceptColor || theme.primaryColor,
      theme,
      variant
    });
    const rejectColors = theme.variantColorResolver({
      color: rejectColor || "red",
      theme,
      variant
    });
    return {
      root: {
        "--dropzone-radius": getSize.getRadius(radius),
        "--dropzone-accept-color": acceptColors.color,
        "--dropzone-accept-bg": acceptColors.background,
        "--dropzone-reject-color": rejectColors.color,
        "--dropzone-reject-bg": rejectColors.background
      }
    };
  }
);
const Dropzone = factory.factory((_props, ref) => {
  const props = useProps.useProps("Dropzone", defaultProps, _props);
  const {
    classNames,
    className,
    style,
    styles,
    unstyled,
    vars,
    radius,
    disabled,
    loading,
    multiple,
    maxSize,
    accept,
    children,
    onDropAny,
    onDrop,
    onReject,
    openRef,
    name,
    maxFiles,
    autoFocus,
    activateOnClick,
    activateOnDrag,
    dragEventsBubbling,
    activateOnKeyboard,
    onDragEnter,
    onDragLeave,
    onDragOver,
    onFileDialogCancel,
    onFileDialogOpen,
    preventDropOnDocument,
    useFsAccessApi,
    getFilesFromEvent,
    validator,
    rejectColor,
    acceptColor,
    enablePointerEvents,
    loaderProps,
    inputProps,
    mod,
    ...others
  } = props;
  const getStyles = useStyles.useStyles({
    name: "Dropzone",
    classes: Dropzone_module_css.default,
    props,
    className,
    style,
    classNames,
    styles,
    unstyled,
    vars,
    varsResolver
  });
  const { getRootProps, getInputProps, isDragAccept, isDragReject, open } = index.useDropzone({
    onDrop: onDropAny,
    onDropAccepted: onDrop,
    onDropRejected: onReject,
    disabled: disabled || loading,
    accept: Array.isArray(accept) ? accept.reduce((r, key) => ({ ...r, [key]: [] }), {}) : accept,
    multiple,
    maxSize,
    maxFiles,
    autoFocus,
    noClick: !activateOnClick,
    noDrag: !activateOnDrag,
    noDragEventsBubbling: !dragEventsBubbling,
    noKeyboard: !activateOnKeyboard,
    onDragEnter,
    onDragLeave,
    onDragOver,
    onFileDialogCancel,
    onFileDialogOpen,
    preventDropOnDocument,
    useFsAccessApi,
    validator,
    ...getFilesFromEvent ? { getFilesFromEvent } : null
  });
  useMergedRef.assignRef(openRef, open);
  const isIdle = !isDragAccept && !isDragReject;
  return /* @__PURE__ */ jsxRuntime.jsx(Dropzone_context.DropzoneProvider, { value: { accept: isDragAccept, reject: isDragReject, idle: isIdle }, children: /* @__PURE__ */ jsxRuntime.jsxs(
    Box.Box,
    {
      ...getRootProps(),
      ...getStyles("root", { focusable: true }),
      ...others,
      mod: [
        {
          accept: isDragAccept,
          reject: isDragReject,
          idle: isIdle,
          disabled,
          loading,
          "activate-on-click": activateOnClick
        },
        mod
      ],
      children: [
        /* @__PURE__ */ jsxRuntime.jsx(
          LoadingOverlay.LoadingOverlay,
          {
            visible: loading,
            overlayProps: { radius },
            unstyled,
            loaderProps
          }
        ),
        /* @__PURE__ */ jsxRuntime.jsx("input", { ...getInputProps(inputProps), name }),
        /* @__PURE__ */ jsxRuntime.jsx(
          "div",
          {
            ...getStyles("inner"),
            ref,
            "data-enable-pointer-events": enablePointerEvents || void 0,
            children
          }
        )
      ]
    }
  ) });
});
Dropzone.classes = Dropzone_module_css.default;
Dropzone.displayName = "@mantine/dropzone/Dropzone";
Dropzone.Accept = DropzoneStatus.DropzoneAccept;
Dropzone.Idle = DropzoneStatus.DropzoneIdle;
Dropzone.Reject = DropzoneStatus.DropzoneReject;
exports.Dropzone = Dropzone;
