
/**
 *   VERSION: 2.239.0-alpha.0
 *   BUILD_TIMESTAMP: 1780012993002
 *   BUILD_DATE: Fri May 29 2026 00:03:13 GMT+0000 (Coordinated Universal Time)
 *   BUILD_COMMIT: 3344b6c0fd9fa858907db310cfb1ef5e0d224da2
 */
import { i as B, R as h, k as _, a4 as W, aj as m, ak as V, Q as Y, V as F, j as s, P as H, g as d, u as n, F as E, a5 as $, m as K, h as U, $ as Q, Y as G, b as J, al as X, v as y, l as Z, n as S, I as v, a1 as b, f as ee, am as ae } from "../sheerid.js";
import { F as se, L as te, B as oe, P as de, a as ne, M as re, C as le } from "./CaptchaComponent-CAmFHBQZ.js";
import { C as me } from "./CollegeNameComponent-Q14srw1R.js";
import { E as ue, P as ie } from "./PersonalInfoStepSubmitButton-BNyfPfz1.js";
import { C as be } from "./CountryComponentWrapper-D4Oa_2ti.js";
import { C as pe } from "./City-Cfa2Pzsi.js";
import { S as Ce } from "./StateSelectComponent-Bm90RcsV.js";
import { P as ge } from "./PostalCodeComponent-BCYXpkvf.js";
import { A as he } from "./AddressComponent-DQhZnZaO.js";
import { D as Ee, A as Ne, B as Ie } from "./ActiveDutyStartDateComponent-CF_4_Ikd.js";
import { D as xe } from "./DriverLicenseNumberComponent-B0wi5GHG.js";
import { E as Me, L as ye } from "./EBTCardNumberComponent-DKMBzruA.js";
import { S as je } from "./StatusComponent-3TC4ZCSc.js";
import { F as De } from "./FirstResponderOrganizationComponent-BFa3a4D2.js";
import { L as ze } from "./LicensedProfessionalOrganizationComponent-D2KgfKCS.js";
import { M as Re } from "./MedicalProfessionalOrganizationComponent-C92j-Rj3.js";
import { M as Fe } from "./MemberIdComponent-OLftjHHc.js";
import { M as Le } from "./MembershipOrganizationComponent-WE5r3qry.js";
import { T as Oe } from "./TeacherSchoolComponent-SgmGFKtH.js";
import { S as Te } from "./SSN-BohEQwhn.js";
import { u as Pe } from "./useCollectFieldsEndpoint-BWiMsGJn.js";
import { i as qe } from "./FormFieldText-CPwStdCx.js";
const Ae = ({
  intl: N,
  verificationService: a
}) => {
  const t = a.viewModel, { updateViewModel: j, programTheme: D } = a, [C, L] = h.useState(void 0), l = (e) => C && C.some((i) => i.key === e), { fieldValidationErrors: o } = a, p = a.verificationResponse, O = _(p), r = (e, i) => {
    const g = S(
      t,
      (w) => {
        w[e] = i;
      }
    );
    j(g);
  }, T = (e) => {
    const i = ae(
      t,
      e
    );
    j(i);
  }, I = t.localeChoice.value, P = ee(), { segment: u, availableStatuses: x } = p, q = u.charAt(0).toUpperCase() + u.slice(1), z = () => x && (u === m.FIRST_RESPONDER || u === m.MEDICAL || u === m.LOW_INCOME || u === m.LICENSED_PROFESSIONAL || u === m.EMPLOYMENT || u === m.RECENT_MOVER || u === m.MILITARY), { availableStatuses: A } = Pe({
    verificationId: p.verificationId,
    currentStep: p.currentStep,
    viewModel: t
  }), f = t.countryChoice?.value, R = qe(D, f), c = W(N, A ?? x), M = (e) => (async () => {
    try {
      const i = await X(
        p.verificationId,
        p.currentStep,
        e
      ), g = y(() => i.fieldsToCollect.required, []);
      z() && g.push({ key: "status" }), T(g), L(g);
    } catch (i) {
      Z.error(`Failed to determine fields to collect: ${i}`);
    }
  })(), k = () => {
    switch (u) {
      case m.STUDENT:
        return /* @__PURE__ */ s.jsx(
          me,
          {
            value: a.viewModel.organization,
            verificationService: a,
            isErrored: !!o.organization,
            isRequired: !0,
            disabled: d("organization")?.disabled,
            onChange: (e) => {
              b(e, a), n("organization", e, a);
            }
          }
        );
      case m.TEACHER:
        return /* @__PURE__ */ s.jsx(
          Oe,
          {
            value: a.viewModel.organization,
            verificationService: a,
            isErrored: !!o.organization,
            disabled: d("organization")?.disabled,
            onChange: (e) => {
              b(e, a), n("organization", e, a);
            }
          }
        );
      case m.MEMBER:
        return /* @__PURE__ */ s.jsx(
          Le,
          {
            value: a.viewModel.organization,
            verificationService: a,
            isErrored: !!o.organization,
            disabled: d("organization")?.disabled,
            onChange: (e) => {
              b(e, a), n("organization", e, a);
            }
          }
        );
      case m.MILITARY:
        return /* @__PURE__ */ s.jsx(
          Ie,
          {
            isErrored: !!o.organization,
            onChange: (e) => {
              b(e, a), n("organization", e, a);
            },
            value: {
              value: y(
                () => a.viewModel.organization.id
              ),
              label: y(
                () => a.viewModel.organization.name
              )
            },
            verificationService: a,
            disabled: d("organization")?.disabled
          }
        );
      case m.FIRST_RESPONDER:
        return /* @__PURE__ */ s.jsx(
          De,
          {
            isErrored: !!o.organization,
            onChange: (e) => {
              b(e, a), n("organization", e, a);
            },
            value: a.viewModel.organization,
            verificationService: a,
            disabled: d("organization")?.disabled
          }
        );
      case m.MEDICAL:
        return /* @__PURE__ */ s.jsx(
          Re,
          {
            isErrored: !!o.organization,
            onChange: (e) => {
              b(e, a), n("organization", e, a);
            },
            value: a.viewModel.organization,
            verificationService: a,
            disabled: d("organization")?.disabled
          }
        );
      case m.LICENSED_PROFESSIONAL:
        return /* @__PURE__ */ s.jsx(
          ze,
          {
            isErrored: !!o.organization,
            onChange: (e) => {
              b(e, a), n("organization", e, a);
            },
            value: a.viewModel.organization,
            verificationService: a,
            disabled: d("organization")?.disabled
          }
        );
      case m.LOW_INCOME:
        return /* @__PURE__ */ s.jsx(
          ye,
          {
            isErrored: !!o.organization,
            onChange: (e) => {
              b(e, a), n("organization", e, a);
            },
            value: v(
              a.viewModel.organization
            ),
            verificationService: a,
            isRequired: !0,
            disabled: d("organization")?.disabled
          }
        );
      default:
        return null;
    }
  };
  return h.useEffect(() => {
    x && u === m.MILITARY ? M({ statuses: [] }) : M({});
  }, []), h.useEffect(() => {
    !V(D).enabled && C && C.length === 0 && Y(t, a, F.collectPersonalInfo);
  }, [C]), h.useEffect(() => {
    t.status && M({ statuses: [t.status] });
  }, [t.status]), /* @__PURE__ */ s.jsxs(
    "div",
    {
      id: "sid-step-personal-info-personal-info",
      className: "sid-personal-info-container sid-l-container",
      children: [
        /* @__PURE__ */ s.jsxs("div", { role: "main", children: [
          /* @__PURE__ */ s.jsx(
            H,
            {
              verificationService: a,
              classNameIdentifier: "personal-info"
            }
          ),
          /* @__PURE__ */ s.jsx(
            be,
            {
              verificationService: a,
              disabled: d("country")?.disabled
            }
          ),
          z() && /* @__PURE__ */ s.jsx(
            je,
            {
              segmentId: u,
              value: {
                value: t.status,
                label: $(N, t.status)
              },
              isErrored: !!o.status,
              errorId: `invalid${q}Status`,
              options: c,
              disabled: R || d("status")?.disabled,
              explanation: R ? /* @__PURE__ */ s.jsx(E, { id: "chooseCountry", defaultMessage: "Choose a country first" }) : void 0,
              onChange: (e) => {
                r("status", e ? e.value : ""), n(
                  "status",
                  e ? e.value : "",
                  a
                );
              }
            }
          ),
          l("organization") && k(),
          /* @__PURE__ */ s.jsxs("div", { className: "sid-names", children: [
            l("firstName") && /* @__PURE__ */ s.jsx(
              se,
              {
                value: t.firstName,
                isErrored: !!o.firstName,
                disabled: d("firstName")?.disabled,
                onChange: (e) => {
                  r("firstName", e), n("firstName", e, a);
                }
              }
            ),
            l("lastName") && /* @__PURE__ */ s.jsx(
              te,
              {
                value: t.lastName,
                isErrored: !!o.lastName,
                disabled: d("lastName")?.disabled,
                onChange: (e) => {
                  r("lastName", e), n("lastName", e, a);
                }
              }
            )
          ] }),
          l("birthDate") && /* @__PURE__ */ s.jsx(
            oe,
            {
              value: t.birthDate,
              errorId: o.birthDate,
              locale: I,
              isRequired: !0,
              disabled: d("birthDate")?.disabled,
              onChange: (e) => {
                r("birthDate", e), n("birthDate", e, a);
              }
            }
          ),
          l("email") && /* @__PURE__ */ s.jsx(
            ue,
            {
              value: t.email,
              isErrored: !!o.email,
              explanation: " ",
              onChange: (e) => {
                r("email", e), n("email", e, a);
              },
              onKeyDown: (e) => K(e),
              disabled: d("email")?.disabled
            }
          ),
          l("phoneNumber") && /* @__PURE__ */ s.jsx(
            de,
            {
              isRequired: !!a.programTheme.smsLoopEnabled,
              value: t.phoneNumber,
              isErrored: !!o.phoneNumber,
              onChange: (e) => {
                r("phoneNumber", e), n("phoneNumber", e, a);
              },
              selectedCountryCode: t.countryChoice && t.countryChoice.value,
              disabled: d("phoneNumber")?.disabled
            }
          ),
          l("address1") && /* @__PURE__ */ s.jsx(
            he,
            {
              value: t.address1,
              isRequired: !0,
              isErrored: !!o.address1,
              errorId: o.address1,
              disabled: d("address1")?.disabled,
              onChange: (e) => {
                r("address1", e), n("address1", e, a);
              }
            }
          ),
          l("city") && /* @__PURE__ */ s.jsx(
            pe,
            {
              value: t.city,
              isRequired: !0,
              isErrored: !!o.city,
              errorId: o.city,
              disabled: d("city")?.disabled,
              onChange: (e) => {
                r("city", e), n("city", e, a);
              }
            }
          ),
          l("dischargeDate") && /* @__PURE__ */ s.jsx(
            Ee,
            {
              errorId: o.dischargeDate,
              locale: I,
              onChange: (e) => {
                r("dischargeDate", e), n("dischargeDate", e, a);
              },
              value: t.dischargeDate,
              disabled: d("dischargeDate")?.disabled
            }
          ),
          l("driverLicenseNumber") && /* @__PURE__ */ s.jsx(
            xe,
            {
              value: t.driverLicenseNumber,
              isErrored: !!o.driverLicenseNumber,
              isRequired: !0,
              disabled: d("driverLicenseNumber")?.disabled,
              onChange: (e) => {
                r("driverLicenseNumber", e), n(
                  "driverLicenseNumber",
                  e,
                  a
                );
              }
            }
          ),
          l("ebtCardNumber") && /* @__PURE__ */ s.jsx(
            Me,
            {
              value: t.ebtCardNumber,
              isErrored: !!o.ebtCardNumber,
              disabled: d("ebtCardNumber")?.disabled,
              onChange: (e) => {
                r("ebtCardNumber", e), n("ebtCardNumber", e, a);
              }
            }
          ),
          l("memberId") && /* @__PURE__ */ s.jsx(
            Fe,
            {
              value: t.memberId,
              isErrored: !!o.memberId,
              isRequired: d("memberId")?.requireIfOptional,
              disabled: d("memberId")?.disabled,
              onChange: (e) => {
                r("memberId", e), n("memberId", e, a);
              },
              label: /* @__PURE__ */ s.jsx(
                E,
                {
                  id: "step.collectMedicalPersonalInfo.registrationNumberLabel",
                  defaultMessage: "Registration Number"
                }
              )
            }
          ),
          l("postalCode") && /* @__PURE__ */ s.jsx(
            ge,
            {
              isErrored: !!o.postalCode,
              onChange: (e) => {
                r("postalCode", e), n("postalCode", e, a);
              },
              value: t.postalCode,
              disabled: d("postalCode")?.disabled
            }
          ),
          l("socialSecurityNumber") && /* @__PURE__ */ s.jsx("div", { className: "sid-ssn-wrapper", children: /* @__PURE__ */ s.jsx(
            Te,
            {
              value: t.socialSecurityNumber,
              onChange: (e) => {
                r("socialSecurityNumber", e), n(
                  "socialSecurityNumber",
                  e,
                  a
                );
              },
              isErrored: !!o[U.socialSecurityNumber],
              placeholder: "000-00-0000",
              disabled: d("socialSecurityNumber")?.disabled
            }
          ) }),
          l("state") && /* @__PURE__ */ s.jsx(
            Ce,
            {
              isRequired: !0,
              options: Q(a.programTheme, N),
              value: t.state || void 0,
              isErrored: !!o.state,
              onChange: async (e) => {
                const i = e ? e.value : void 0;
                r("state", i), n("state", i, a);
              },
              label: /* @__PURE__ */ s.jsx(E, { id: "state", defaultMessage: "State" }),
              disabled: d("state")?.disabled
            }
          ),
          l("activeDutyStartDate") && a.programTheme.strictMilitaryValidationEnabled && /* @__PURE__ */ s.jsx(
            Ne,
            {
              errorId: o.activeDutyStartDate,
              locale: I,
              onChange: (e) => {
                r("activeDutyStartDate", e), n(
                  "activeDutyStartDate",
                  e,
                  a
                );
              },
              value: t.activeDutyStartDate,
              disabled: d("activeDutyStartDate")?.disabled
            }
          ),
          P.customFormFields?.map((e) => /* @__PURE__ */ s.jsx(ne, { config: e, verificationService: a })),
          /* @__PURE__ */ s.jsx(
            re,
            {
              verificationService: a,
              isErrored: !!o.marketConsentValue,
              onChange: (e) => {
                r("metadata", {
                  ...a.viewModel.metadata,
                  marketConsentValue: e
                }), n(
                  "marketConsentValue",
                  e,
                  a
                );
              },
              viewModel: t,
              disabled: d("marketConsentValue")?.disabled
            }
          ),
          /* @__PURE__ */ s.jsx(G, { verificationService: a, suffix: "CollectAboveSubmit" }),
          /* @__PURE__ */ s.jsx(
            le,
            {
              verificationService: a,
              isErrored: !!o.captchaToken
            }
          ),
          /* @__PURE__ */ s.jsx(
            ie,
            {
              step: F.collectPersonalInfo,
              verificationService: a,
              viewModel: t,
              failedInstantMatch: O,
              buttonText: /* @__PURE__ */ s.jsx(
                E,
                {
                  id: "step.personalInfo.submitButtonText",
                  defaultMessage: "Verify and continue"
                }
              )
            }
          )
        ] }),
        /* @__PURE__ */ s.jsx(J, { verificationService: a })
      ]
    }
  );
}, sa = B(Ae);
export {
  sa as default
};
