
/**
 *   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 I, k as M, a4 as f, j as o, P as z, g as n, u as d, F as i, a5 as P, D as R, n as b, v as m, m as T, Y as k, V as D, f as O } from "../sheerid.js";
import { u as L } from "./useCollectFieldsEndpoint-BWiMsGJn.js";
import { i as V } from "./FormFieldText-CPwStdCx.js";
import { F as B, L as W, B as q, P as w, a as H, M as K, C as A } from "./CaptchaComponent-CAmFHBQZ.js";
import { E as Y, P as G } from "./PersonalInfoStepSubmitButton-BNyfPfz1.js";
import { S as J } from "./StatusComponent-3TC4ZCSc.js";
import { F as Q } from "./FirstResponderOrganizationComponent-BFa3a4D2.js";
import { P as U } from "./PostalCodeComponent-BCYXpkvf.js";
import { C as X } from "./CountryComponentWrapper-D4Oa_2ti.js";
import { C as Z } from "./ChangeLocaleComponent-D317H5S8.js";
import { P as _ } from "./PersonalInfoStepWrapper-BCVAx0W6.js";
const $ = ({
  intl: C,
  verificationService: a
}) => {
  const e = a.viewModel, { fieldValidationErrors: t } = a, p = a.verificationResponse, h = M(p), x = O(), E = e.localeChoice.value, { availableStatuses: j } = L({
    verificationId: p.verificationId,
    currentStep: p.currentStep,
    viewModel: e
  }), N = e.countryChoice?.value, g = V(
    a.programTheme,
    N
  ), F = f(
    C,
    j ?? p.availableStatuses
  ), l = (s, u) => {
    const r = b(
      e,
      (y) => {
        y[s] = u;
      }
    );
    a.updateViewModel(r);
  };
  return /* @__PURE__ */ o.jsxs(
    _,
    {
      verificationService: a,
      step: p.currentStep,
      children: [
        /* @__PURE__ */ o.jsx(
          z,
          {
            verificationService: a,
            classNameIdentifier: "first-responder"
          }
        ),
        /* @__PURE__ */ o.jsx(Z, { verificationService: a }),
        /* @__PURE__ */ o.jsx(
          X,
          {
            verificationService: a,
            disabled: n("country")?.disabled
          }
        ),
        /* @__PURE__ */ o.jsx(
          J,
          {
            segmentId: "first-responder",
            value: {
              value: e.status,
              label: P(C, e.status)
            },
            isErrored: !!t.status,
            errorId: "invalidFirstResponderStatus",
            disabled: g || n("status")?.disabled,
            explanation: g ? /* @__PURE__ */ o.jsx(i, { id: "chooseCountry", defaultMessage: "Choose a country first" }) : void 0,
            options: F,
            onChange: (s) => {
              l("status", s ? s.value : ""), d(
                "status",
                s ? s.value : "",
                a
              );
            }
          }
        ),
        /* @__PURE__ */ o.jsx(
          Q,
          {
            isErrored: !!t.organization,
            onChange: (s = R.organization) => {
              const u = b(e, (r) => {
                r.organization = {
                  id: s.id,
                  idExtended: s.idExtended,
                  name: s.name,
                  source: s.source
                }, e.organization && e.organization.source !== void 0 && (r.organization.source = e.organization.source), m(() => a.programTheme.openOrgSearchEnabled) && m(() => s.id) === 0 && m(() => s.name, "").length > 0 ? r.postalCode = e.postalCode ? e.postalCode : "" : (e.postalCode || e.postalCode === "") && delete r.postalCode;
              });
              a.updateViewModel(u), d("organization", s, a);
            },
            value: a.viewModel.organization,
            verificationService: a,
            disabled: n("organization")?.disabled
          }
        ),
        /* @__PURE__ */ o.jsxs("div", { className: "sid-names", children: [
          /* @__PURE__ */ o.jsx(
            B,
            {
              value: e.firstName,
              isErrored: !!t.firstName,
              disabled: n("firstName")?.disabled,
              onChange: (s) => {
                l("firstName", s), d("firstName", s, a);
              }
            }
          ),
          /* @__PURE__ */ o.jsx(
            W,
            {
              value: e.lastName,
              isErrored: !!t.lastName,
              disabled: n("lastName")?.disabled,
              onChange: (s) => {
                l("lastName", s), d("lastName", s, a);
              }
            }
          )
        ] }),
        /* @__PURE__ */ o.jsx(
          q,
          {
            errorId: t.birthDate,
            locale: E,
            onChange: (s) => {
              l("birthDate", s), d("birthDate", s, a);
            },
            value: e.birthDate,
            disabled: n("birthDate")?.disabled
          }
        ),
        /* @__PURE__ */ o.jsx(
          Y,
          {
            value: e.email,
            isErrored: !!t.email,
            explanation: /* @__PURE__ */ o.jsx(
              i,
              {
                id: "emailExplanation",
                defaultMessage: "Needed to send you your unique code"
              }
            ),
            onChange: (s) => {
              l("email", s), d("email", s, a);
            },
            onKeyDown: (s) => T(s),
            disabled: n("email")?.disabled
          }
        ),
        a.programTheme.isSmsNotifierConfigured || a.programTheme.smsLoopEnabled ? /* @__PURE__ */ o.jsx(
          w,
          {
            isRequired: !!a.programTheme.smsLoopEnabled,
            value: e.phoneNumber,
            isErrored: !!t.phoneNumber,
            onChange: (s) => {
              l("phoneNumber", s), d("phoneNumber", s, a);
            },
            selectedCountryCode: e.countryChoice && e.countryChoice.value,
            disabled: n("phoneNumber")?.disabled
          }
        ) : null,
        m(() => a.programTheme.openOrgSearchEnabled) && m(() => e.organization.id) === 0 && m(() => e.organization.name, "").length > 0 && /* @__PURE__ */ o.jsx(
          U,
          {
            isErrored: !!t.postalCode,
            onChange: (s) => {
              l("postalCode", s), d("postalCode", s, a);
            },
            value: e.postalCode,
            disabled: n("postalCode")?.disabled
          }
        ),
        x.customFormFields.map((s) => /* @__PURE__ */ o.jsx(H, { config: s, verificationService: a })),
        /* @__PURE__ */ o.jsx(
          K,
          {
            verificationService: a,
            isErrored: !!t.marketConsentValue,
            onChange: (s) => {
              l("metadata", {
                ...a.viewModel.metadata,
                marketConsentValue: s
              }), d("marketConsentValue", s, a);
            },
            viewModel: e,
            disabled: n("marketConsentValue")?.disabled
          }
        ),
        /* @__PURE__ */ o.jsx(k, { verificationService: a, suffix: "CollectAboveSubmit" }),
        /* @__PURE__ */ o.jsx(
          A,
          {
            verificationService: a,
            isErrored: !!t.captchaToken
          }
        ),
        /* @__PURE__ */ o.jsx(
          G,
          {
            step: D.collectFirstResponderPersonalInfo,
            verificationService: a,
            viewModel: e,
            failedInstantMatch: h,
            buttonText: /* @__PURE__ */ o.jsx(
              i,
              {
                id: "step.personalInfo.submitButtonText",
                defaultMessage: "Verify My First Responder Status"
              }
            )
          }
        )
      ]
    }
  );
}, rs = I($);
export {
  rs as default
};
