"use client";

// src/components/ui/input-mask.tsx
import * as React2 from "react";
import {
  useMaskInput,
  withMask,
  useHookFormMask,
  withHookFormMask,
  useTanStackFormMask,
  withTanStackFormMask
} from "use-mask-input";

// src/lib/compose-refs.ts
function composeRefs(...refs) {
  return (node) => {
    for (const ref of refs) {
      if (ref == null) continue;
      if (typeof ref === "function") {
        ref(node);
      } else {
        ;
        ref.current = node;
      }
    }
  };
}

// src/lib/utils.ts
import { clsx } from "clsx";
import { twMerge } from "tailwind-merge";
function cn(...inputs) {
  return twMerge(clsx(inputs));
}

// src/components/ui/input.tsx
import * as React from "react";
import { jsx } from "react/jsx-runtime";
var Input = React.forwardRef(
  function Input2({ className, type, ...props }, ref) {
    return /* @__PURE__ */ jsx(
      "input",
      {
        ref,
        type,
        "data-slot": "input",
        className: cn(
          "h-8 w-full min-w-0 rounded-md border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
          className
        ),
        ...props
      }
    );
  }
);

// src/components/ui/input-mask.tsx
import { jsx as jsx2 } from "react/jsx-runtime";
var exxatInputMaskDefaults = {
  placeholder: "_",
  showMaskOnHover: false
};
var exxatMaskPatterns = {
  /** US NANP 10-digit display */
  phoneUS: "(999) 999-9999",
  /** US ZIP or ZIP+4 */
  zipUS: "99999[-9999]",
  /** Calendar-style date (validate separately). */
  dateMDY: "99/99/9999",
  /** Studio input-mask-01 style — UK-style plate-ish token; adjust per product. */
  customReference: "AA99 AAA"
};
function exxatTimeMaskOptions() {
  return {
    ...exxatInputMaskDefaults,
    inputFormat: "HH:MM:ss",
    outputFormat: "HH:MM:ss"
  };
}
function useExxatPhoneMask(options) {
  return useMaskInput({
    mask: exxatMaskPatterns.phoneUS,
    options: { ...exxatInputMaskDefaults, ...options }
  });
}
function useExxatZipMask(options) {
  return useMaskInput({
    mask: exxatMaskPatterns.zipUS,
    options: { ...exxatInputMaskDefaults, ...options }
  });
}
function useExxatDateMDYMask(options) {
  return useMaskInput({
    mask: exxatMaskPatterns.dateMDY,
    options: { ...exxatInputMaskDefaults, ...options }
  });
}
function useExxatTimeMask(options) {
  return useMaskInput({
    mask: "datetime",
    options: { ...exxatTimeMaskOptions(), ...options }
  });
}
function useExxatCustomMask(mask, options) {
  return useMaskInput({
    mask,
    options: { ...exxatInputMaskDefaults, ...options }
  });
}
function useExxatMaskedFieldRef(fieldRef, mask, options) {
  const maskRef = useMaskInput({
    mask,
    options: { ...exxatInputMaskDefaults, ...options }
  });
  return React2.useMemo(() => composeRefs(fieldRef, maskRef), [fieldRef, maskRef]);
}
var MaskedInput = React2.forwardRef(function MaskedInput2({ mask, maskOptions, className, type = "text", ...props }, ref) {
  const maskRef = useMaskInput({
    mask,
    options: { ...exxatInputMaskDefaults, ...maskOptions }
  });
  return /* @__PURE__ */ jsx2(
    Input,
    {
      ref: composeRefs(ref, maskRef),
      type,
      className: cn(className),
      ...props
    }
  );
});
export {
  MaskedInput,
  composeRefs,
  exxatInputMaskDefaults,
  exxatMaskPatterns,
  exxatTimeMaskOptions,
  useExxatCustomMask,
  useExxatDateMDYMask,
  useExxatMaskedFieldRef,
  useExxatPhoneMask,
  useExxatTimeMask,
  useExxatZipMask,
  useHookFormMask,
  useMaskInput,
  useTanStackFormMask,
  withHookFormMask,
  withMask,
  withTanStackFormMask
};
//# sourceMappingURL=input-mask.js.map