import { jsx as r } from "react/jsx-runtime";
import { phoneMasks as d } from "./index-phone-masks.js";
import { InputBase as h } from "./index-InputBase.js";
import { ComponentContainer as l } from "./index-ComponentContainer.js";
import { useState as i, useEffect as C } from "react";
import { PhoneNumberIMask as P } from "./index-PhoneNumberIMask.js";
const b = (o) => {
  const {
    className: m,
    type: f = "text",
    testId: p,
    formConfig: a,
    countryCode: n
  } = o, [g, t] = i(), [c, s] = i();
  return C(() => {
    const e = d.find((u) => u.iso === n);
    if (!e) {
      t(void 0), s(void 0);
      return;
    }
    t(e), s(e.mask.replaceAll("#", "0"));
  }, [n]), r(l, {
    className: m,
    children: r(h, {
      formconfig: a,
      testId: p,
      type: f,
      ...o,
      textFieldProps: {
        InputProps: {
          inputComponent: P
        },
        inputProps: {
          phoneMask: c
        }
      },
      className: void 0
    })
  });
};
export {
  b as PhoneNumberBase
};
