import { j as e } from "../../node_modules/react/jsx-runtime.js";
import { forwardRef as i, useState as u } from "react";
import { cva as f } from "../../node_modules/class-variance-authority/dist/index.js";
import { cn as m } from "../../utils/index.js";
import { Icon as p } from "../Icon/index.js";
import x from "../../utils/human-readable-file-size.js";
import { Between as h } from "../Layout/Between/index.js";
import { Button as j } from "../Button/base.js";
import "../Button/split-button.js";
import "../Button/login-with-button.js";
import { Typography as c } from "../Typography/index.js";
const y = f(["w-full", "input"], {
  variants: {
    inputSize: {
      sm: "text-sm px-4 py-[10px]",
      md: "px-4 py-3"
    },
    variant: {
      default: "",
      error: "error",
      prefilled: "prefilled"
    }
  },
  defaultVariants: {
    inputSize: "md",
    variant: "default"
  }
}), U = i(
  ({ variant: n, inputSize: r, className: o, ...t }, a) => /* @__PURE__ */ e.jsx(
    "input",
    {
      ref: a,
      type: "text",
      autoComplete: "off",
      className: m(y({ inputSize: r, variant: n }), o),
      ...t
    }
  )
), g = i(
  ({ className: n, children: r, onDrop: o, ...t }, a) => /* @__PURE__ */ e.jsxs("label", { className: m("file-upload-container", n), children: [
    /* @__PURE__ */ e.jsx("input", { ref: a, type: "file", ...t }),
    /* @__PURE__ */ e.jsx(
      p,
      {
        name: "cloud-upload",
        className: "text-content-secondary !text-[2.5rem]"
      }
    ),
    r
  ] })
), v = i(({ file: n, onRemoveClick: r, ...o }, t) => /* @__PURE__ */ e.jsx("div", { ref: t, className: "file-uploaded-container", ...o, children: /* @__PURE__ */ e.jsxs(h, { children: [
  /* @__PURE__ */ e.jsxs("div", { children: [
    /* @__PURE__ */ e.jsx(c, { className: "text-content-secondary", children: n.name }),
    /* @__PURE__ */ e.jsx(c, { variant: "label", className: "text-content-secondary", children: x(n.size) })
  ] }),
  /* @__PURE__ */ e.jsx(
    j,
    {
      variant: "ghost",
      colorScheme: "black",
      onClick: r,
      disabled: !r,
      children: /* @__PURE__ */ e.jsx(p, { name: "trash", size: "sm", className: "text-content-secondary" })
    }
  )
] }) })), D = i(({ handleUpload: n, ...r }, o) => {
  const [t, a] = u(null), d = (s) => {
    if (s.target.files) {
      const l = s.target.files[0];
      a("loading"), n(l).then(() => a(l));
    }
  };
  return t ? t === "loading" ? /* @__PURE__ */ e.jsx("section", { className: "file-uploaded-container", children: "Uploading..." }) : /* @__PURE__ */ e.jsx(v, { file: t, onRemoveClick: () => a(null) }) : /* @__PURE__ */ e.jsx(g, { ...r, ref: o, onChange: d });
});
export {
  g as FileInput,
  U as Input,
  D as SmartFileInput,
  v as UploadedFile
};
