"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const jsxRuntime = require("react/jsx-runtime");
const errorMessage = require("@hookform/error-message");
const reactHookForm = require("react-hook-form");
;/* empty css                                                                                                                                                                                        */
;/* empty css                                                                                                                                                                                         */
;/* empty css                                                                                                                                                                                                 */
;/* empty css                                                                                                                                                                                            */
;/* empty css                                                                                                                                                                                            */
const PasswordInput = require("../../node_modules/.pnpm/@mantine_core@7.17.8_patch_hash_3qirwkgu3wxhvd6hnr2gb24yzq_@mantine_hooks@7.17.8_react@18.3.1_e5yvlgwhmeykc75dkphi7jou6q/node_modules/@mantine/core/esm/components/PasswordInput/PasswordInput.cjs");
const FormPasswordInput = ({ name, rules, onChange, ...rest }) => {
  const { control, formState, getFieldState } = reactHookForm.useFormContext();
  const { error } = getFieldState(name, formState);
  return /* @__PURE__ */ jsxRuntime.jsx(
    reactHookForm.Controller,
    {
      control,
      name,
      rules,
      render: ({ field }) => {
        const { onChange: handleChange, ...restField } = field;
        return /* @__PURE__ */ jsxRuntime.jsx(
          PasswordInput.PasswordInput,
          {
            ...rest,
            onChange: (e) => {
              handleChange(e);
              onChange == null ? void 0 : onChange(e);
            },
            ...restField,
            error: error ? /* @__PURE__ */ jsxRuntime.jsx(errorMessage.ErrorMessage, { errors: formState.errors, name }) : void 0
          }
        );
      }
    }
  );
};
exports.FormPasswordInput = FormPasswordInput;
