import { a as $458b0a5536c1a7cf$export$40bfa8c7b0832715, $ as $f645667febf57a63$export$4c014de7c8940b4c, x as $431fbd86ca7dc216$export$f21a1ffae260145a, w as $6179b936705e76d3$export$ae780daf29e6d456 } from "./useHover-LmGemtHE.js";
import { b as $3ef42575df84b30b$export$9d1611c77c2fe928, a as $64fa3d84918910a7$export$29f1550f4b0d4415, h as $64fa3d84918910a7$export$4d86445c2cf5e3 } from "./utils-cvK1vxO7.js";
import { $ as $65484d02dcb7eb3e$export$457c3d6518dd4c6f } from "./filterDOMProps-D2C6R0DK.js";
import { $ as $99facab73266f662$export$5add1d006293d136 } from "./useFormReset-yV9VVy9R.js";
import React__default, { useState, useEffect, forwardRef, createContext } from "react";
import { a as $2baaea4c71418dea$export$294aa081a6c6f55d } from "./FieldError-B8BgFmIQ.js";
import { $ as $e5be200c675c3b3a$export$fc1a364ae1f3ff10, a as $e93e671b31057976$export$b8473d3665f3a75a } from "./useFormValidation-CUtZcedF.js";
import { a as $f7dceffc5ad7768b$export$4e328f61c538687f } from "./useFocusRing-CUxgjvAY.js";
import { $ as $f39a9eba43920ace$export$86427a43e3e48ebb } from "./Hidden-rE6uR-lr.js";
function $2d73ec29415bd339$export$712718f7aec83d5(props, ref) {
  let { inputElementType = "input", isDisabled = false, isRequired = false, isReadOnly = false, type = "text", validationBehavior = "aria" } = props;
  let [value, setValue] = $458b0a5536c1a7cf$export$40bfa8c7b0832715(props.value, props.defaultValue || "", props.onChange);
  let { focusableProps } = $f645667febf57a63$export$4c014de7c8940b4c(props, ref);
  let validationState = $e5be200c675c3b3a$export$fc1a364ae1f3ff10({
    ...props,
    value
  });
  let { isInvalid, validationErrors, validationDetails } = validationState.displayValidation;
  let { labelProps, fieldProps, descriptionProps, errorMessageProps } = $2baaea4c71418dea$export$294aa081a6c6f55d({
    ...props,
    isInvalid,
    errorMessage: props.errorMessage || validationErrors
  });
  let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props, {
    labelable: true
  });
  const inputOnlyProps = {
    type,
    pattern: props.pattern
  };
  let [initialValue] = useState(value);
  var _props_defaultValue;
  $99facab73266f662$export$5add1d006293d136(ref, (_props_defaultValue = props.defaultValue) !== null && _props_defaultValue !== void 0 ? _props_defaultValue : initialValue, setValue);
  $e93e671b31057976$export$b8473d3665f3a75a(props, validationState, ref);
  useEffect(() => {
    if (ref.current instanceof $431fbd86ca7dc216$export$f21a1ffae260145a(ref.current).HTMLTextAreaElement) {
      let input = ref.current;
      Object.defineProperty(input, "defaultValue", {
        get: () => input.value,
        set: () => {
        },
        configurable: true
      });
    }
  }, [
    ref
  ]);
  return {
    labelProps,
    inputProps: $3ef42575df84b30b$export$9d1611c77c2fe928(domProps, inputElementType === "input" ? inputOnlyProps : void 0, {
      disabled: isDisabled,
      readOnly: isReadOnly,
      required: isRequired && validationBehavior === "native",
      "aria-required": isRequired && validationBehavior === "aria" || void 0,
      "aria-invalid": isInvalid || void 0,
      "aria-errormessage": props["aria-errormessage"],
      "aria-activedescendant": props["aria-activedescendant"],
      "aria-autocomplete": props["aria-autocomplete"],
      "aria-haspopup": props["aria-haspopup"],
      "aria-controls": props["aria-controls"],
      value,
      onChange: (e) => setValue(e.target.value),
      autoComplete: props.autoComplete,
      autoCapitalize: props.autoCapitalize,
      maxLength: props.maxLength,
      minLength: props.minLength,
      name: props.name,
      form: props.form,
      placeholder: props.placeholder,
      inputMode: props.inputMode,
      autoCorrect: props.autoCorrect,
      spellCheck: props.spellCheck,
      [parseInt(React__default.version, 10) >= 17 ? "enterKeyHint" : "enterkeyhint"]: props.enterKeyHint,
      // Clipboard events
      onCopy: props.onCopy,
      onCut: props.onCut,
      onPaste: props.onPaste,
      // Composition events
      onCompositionEnd: props.onCompositionEnd,
      onCompositionStart: props.onCompositionStart,
      onCompositionUpdate: props.onCompositionUpdate,
      // Selection events
      onSelect: props.onSelect,
      // Input events
      onBeforeInput: props.onBeforeInput,
      onInput: props.onInput,
      ...focusableProps,
      ...fieldProps
    }),
    descriptionProps,
    errorMessageProps,
    isInvalid,
    validationErrors,
    validationDetails
  };
}
const $a049562f99e7db0e$export$f9c6924e160136d1 = /* @__PURE__ */ createContext({});
const $a049562f99e7db0e$export$eb2fcfdbd7ba97d4 = /* @__PURE__ */ forwardRef(function Group(props, ref) {
  [props, ref] = $64fa3d84918910a7$export$29f1550f4b0d4415(props, ref, $a049562f99e7db0e$export$f9c6924e160136d1);
  let { isDisabled, isInvalid, onHoverStart, onHoverChange, onHoverEnd, ...otherProps } = props;
  let { hoverProps, isHovered } = $6179b936705e76d3$export$ae780daf29e6d456({
    onHoverStart,
    onHoverChange,
    onHoverEnd,
    isDisabled
  });
  let { isFocused, isFocusVisible, focusProps } = $f7dceffc5ad7768b$export$4e328f61c538687f({
    within: true
  });
  isDisabled !== null && isDisabled !== void 0 ? isDisabled : isDisabled = !!props["aria-disabled"] && props["aria-disabled"] !== "false";
  isInvalid !== null && isInvalid !== void 0 ? isInvalid : isInvalid = !!props["aria-invalid"] && props["aria-invalid"] !== "false";
  let renderProps = $64fa3d84918910a7$export$4d86445c2cf5e3({
    ...props,
    values: {
      isHovered,
      isFocusWithin: isFocused,
      isFocusVisible,
      isDisabled,
      isInvalid
    },
    defaultClassName: "react-aria-Group"
  });
  var _props_role, _props_slot;
  return /* @__PURE__ */ React__default.createElement("div", {
    ...$3ef42575df84b30b$export$9d1611c77c2fe928(otherProps, focusProps, hoverProps),
    ...renderProps,
    ref,
    role: (_props_role = props.role) !== null && _props_role !== void 0 ? _props_role : "group",
    slot: (_props_slot = props.slot) !== null && _props_slot !== void 0 ? _props_slot : void 0,
    "data-focus-within": isFocused || void 0,
    "data-hovered": isHovered || void 0,
    "data-focus-visible": isFocusVisible || void 0,
    "data-disabled": isDisabled || void 0,
    "data-invalid": isInvalid || void 0
  }, renderProps.children);
});
const $3985021b0ad6602f$export$37fb8590cf2c088c = /* @__PURE__ */ createContext({});
let $3985021b0ad6602f$var$filterHoverProps = (props) => {
  let { onHoverStart, onHoverChange, onHoverEnd, ...otherProps } = props;
  return otherProps;
};
const $3985021b0ad6602f$export$f5b8910cec6cf069 = /* @__PURE__ */ $f39a9eba43920ace$export$86427a43e3e48ebb(function Input(props, ref) {
  [props, ref] = $64fa3d84918910a7$export$29f1550f4b0d4415(props, ref, $3985021b0ad6602f$export$37fb8590cf2c088c);
  let { hoverProps, isHovered } = $6179b936705e76d3$export$ae780daf29e6d456(props);
  let { isFocused, isFocusVisible, focusProps } = $f7dceffc5ad7768b$export$4e328f61c538687f({
    isTextInput: true,
    autoFocus: props.autoFocus
  });
  let isInvalid = !!props["aria-invalid"] && props["aria-invalid"] !== "false";
  let renderProps = $64fa3d84918910a7$export$4d86445c2cf5e3({
    ...props,
    values: {
      isHovered,
      isFocused,
      isFocusVisible,
      isDisabled: props.disabled || false,
      isInvalid
    },
    defaultClassName: "react-aria-Input"
  });
  return /* @__PURE__ */ React__default.createElement("input", {
    ...$3ef42575df84b30b$export$9d1611c77c2fe928($3985021b0ad6602f$var$filterHoverProps(props), focusProps, hoverProps),
    ...renderProps,
    ref,
    "data-focused": isFocused || void 0,
    "data-disabled": props.disabled || void 0,
    "data-hovered": isHovered || void 0,
    "data-focus-visible": isFocusVisible || void 0,
    "data-invalid": isInvalid || void 0
  });
});
export {
  $3985021b0ad6602f$export$f5b8910cec6cf069 as $,
  $a049562f99e7db0e$export$f9c6924e160136d1 as a,
  $3985021b0ad6602f$export$37fb8590cf2c088c as b,
  $a049562f99e7db0e$export$eb2fcfdbd7ba97d4 as c,
  $2d73ec29415bd339$export$712718f7aec83d5 as d
};
