import { i as ActorRefFrom } from "./spawn-D9jgw9pW.js"; import { t as Manager } from "./Manager-CQQ99QOI.js"; import "./Actor-iTq7YY48.js"; import { i as FlowModuleConfig } from "./types-KPvmag_B.js"; //#region src/modules/curp-validation/types.d.ts type CurpValidationConfig = FlowModuleConfig['CURP_VALIDATION'] & { /** Maximum validation retries before auto-advancing. @default 1 */ maxRetries?: number; /** Whether to attempt OCR pre-fill on load. @default true */ prefillFromOcr?: boolean; }; /** CURP generation form data */ type GenerateCurpForm = { name: string; firstLastName: string; secondLastName: string; gender: 'H' | 'M' | 'X' | ''; birthDate: string; birthState: string; }; type GenerateCurpFieldType = 'text' | 'date' | 'dropdown'; /** * Discriminated union of validation rules supported across both CURP screens. * `required` is used by Generate-CURP fields; `curpFormat` is used by the * single-field CURP entry. */ type CurpValidationRule = { type: 'required'; } | { type: 'curpFormat'; }; type GenerateCurpFieldDef = { key: keyof GenerateCurpForm; labelKey: string; type: GenerateCurpFieldType; required: boolean; autoComplete?: string; /** * Validation rules evaluated by the state machine on blur (per-field) and * on submit (full form). Required fields should include `{ type: 'required' }`. * Optional fields (e.g. `secondLastName`) omit this entirely. */ validation?: CurpValidationRule[]; }; /** * Configuration for the single CURP-entry field on the gateway screen. * Intentionally has no `required` rule: the user can leave it empty and * use the "I don't have my CURP" escape-hatch button instead. */ type EnterCurpFieldDef = { key: 'curp'; labelKey: string; validation?: CurpValidationRule[]; }; /** * Map of field-key → i18n error key currently displayed for that field. * Empty/undefined means no errors are currently shown. The state machine * is the single source of truth for which entries exist here — UI must * render this map as-is without further gating. */ type CurpValidationErrors = Partial>; //#endregion //#region src/modules/curp-validation/curpValidationStateMachine.d.ts declare const curpValidationMachine: any; type CurpValidationMachine = typeof curpValidationMachine; //#endregion //#region src/modules/curp-validation/curpValidationActor.d.ts type CreateCurpValidationActorOptions = { config: CurpValidationConfig; }; type CurpValidationActor = ActorRefFrom; //#endregion //#region src/modules/curp-validation/curpValidationManager.d.ts type CurpValidationIdleState = { status: 'idle'; }; type CurpValidationLoadingState = { status: 'loading'; }; /** * State exposed to UI for the CURP entry gateway screen. * * `isValid` is **derived** from `validationErrors`: it is `true` whenever * no errors are currently displayed (including the initial empty render). * The UI must not treat `isValid` as "the form would pass full validation * right now" — that was the old pessimistic semantic. Use the absence of * errors plus an additional `curp.length === 0` no-op guard on the submit * button instead. */ type CurpValidationEnterCurpState = { status: 'enterCurp'; curp: string; isValid: boolean; validationErrors?: CurpValidationErrors; }; type CurpValidationVerifyingState = { status: 'verifying'; }; type CurpValidationSuccessState = { status: 'success'; }; type CurpValidationFailureState = { status: 'failure'; retriesLeft: number; /** True for auto OCR-prefilled failures; UI shows "Verify manually". */ fromAutoVerify: boolean; }; /** * State exposed to UI for the multi-field Generate CURP form. * * `isValid` is derived: `true` when no errors are currently displayed. * Validation runs on blur (single field) and on submit (full form); * `validationErrors` reflects exactly what should be rendered next * to each input. */ type CurpValidationGenerateCurpState = { status: 'generateCurp'; form: GenerateCurpForm; isValid: boolean; validationErrors?: CurpValidationErrors; }; type CurpValidationGeneratingState = { status: 'generating'; }; type CurpValidationConfirmCurpState = { status: 'confirmCurp'; curp: string; }; type CurpValidationGenerateErrorState = { status: 'generateError'; retriesLeft: number; }; type CurpValidationFinishedState = { status: 'finished'; }; type CurpValidationClosedState = { status: 'closed'; }; type CurpValidationState = CurpValidationIdleState | CurpValidationLoadingState | CurpValidationEnterCurpState | CurpValidationVerifyingState | CurpValidationSuccessState | CurpValidationFailureState | CurpValidationGenerateCurpState | CurpValidationGeneratingState | CurpValidationConfirmCurpState | CurpValidationGenerateErrorState | CurpValidationFinishedState | CurpValidationClosedState; declare function createCurpValidationManager(options: CreateCurpValidationActorOptions): Manager & { load(): void; setCurp(curp: string): void; /** * Triggers single-field on-blur validation. The state machine routes * the event to the validator for the currently active screen and * updates the corresponding `validationErrors` map. Sending a field * key that does not belong to the active screen is a no-op. */ validateField(field: "curp" | keyof GenerateCurpForm): void; verify(): void; switchToGenerate(): void; setGenerateForm(form: Partial): void; generate(): void; confirmGenerated(): void; retry(): void; close(): void; }; /** * Creates a CURP-validation manager from a pre-built actor. * Use this when overriding the machine via `.provide()` for custom backends * or for story-isolation testing. */ declare function createCurpValidationManagerFromActor(actor: CurpValidationActor): Manager & { load(): void; setCurp(curp: string): void; /** * Triggers single-field on-blur validation. The state machine routes * the event to the validator for the currently active screen and * updates the corresponding `validationErrors` map. Sending a field * key that does not belong to the active screen is a no-op. */ validateField(field: "curp" | keyof GenerateCurpForm): void; verify(): void; switchToGenerate(): void; setGenerateForm(form: Partial): void; generate(): void; confirmGenerated(): void; retry(): void; close(): void; }; type CurpValidationManager = ReturnType; //#endregion export { CurpValidationActor as a, CurpValidationErrors as c, GenerateCurpFieldDef as d, GenerateCurpFieldType as f, createCurpValidationManagerFromActor as i, CurpValidationRule as l, CurpValidationState as n, curpValidationMachine as o, GenerateCurpForm as p, createCurpValidationManager as r, CurpValidationConfig as s, CurpValidationManager as t, EnterCurpFieldDef as u };