import { A as StateMachine, i as ActorRefFrom, l as AnyStateMachine } from "./spawn-D9jgw9pW.js"; import "./StateMachine-EDpYWy0i.js"; import { t as Manager } from "./Manager-CQQ99QOI.js"; import "./Actor-iTq7YY48.js"; import { t as IVisibilityObserverCapability } from "./IVisibilityObserverCapability-D4tvIB5v.js"; import "./index-B8weJxmL.js"; import { t as CameraStream } from "./camera-9wWD-pwg.js"; import { o as IncodeCanvas } from "./IStorageCapability-ORkQfK3F.js"; import { i as FaceData, r as FaceCoordinates, t as FaceDetectionProvider } from "./FaceDetectionProvider-Mh6q3EbA.js"; import { t as AvatarId } from "./createFaceAvatar-BEj18KXi.js"; import { i as FlowModuleConfig } from "./types-KPvmag_B.js"; import { a as FaceCapturedImageData, i as FaceCaptureOnlyResponse, n as DetectionStatus, o as FaceErrorCode, r as FaceCaptureDependencies, t as BaseFaceCaptureConfig } from "./types-Hmd7U0JA.js"; import { n as PermissionStatus, t as PermissionResult } from "./types-BEwVKkLJ.js"; import { t as AuthenticationConfig } from "./types-EELWyWpd.js"; import { n as StreamCanvasCapture, t as DeepsightService } from "./deepsightService-DLVQS_RH.js"; //#region src/modules/authentication/authenticationStateMachine.d.ts declare const _authenticationMachine: AnyStateMachine; type AuthenticationMachine = typeof _authenticationMachine; declare const authenticationMachine: AnyStateMachine; //#endregion //#region ../infra/src/avatar/faceFeed.d.ts /** * A tiny per-frame pub/sub channel for the Incode WASM pipeline's `FaceData`. * * The parked `incode-2d` avatar drives the cosmetic avatar from the **existing** Incode face-detection * pipeline (no second MediaPipe model). The detection pipeline lives in core's * detection actor, while the avatar lives in the avatar actor — so the avatar is * *fed* `FaceData` through this channel rather than running its own model. * * Deliberately NOT routed through XState events/context: the pipeline emits * ~10×/s, and assigning that into context would re-run `mapState` and notify all * manager subscribers 10×/s — needless churn that could itself regress UI perf. * The feed is a plain emitter passed as input to both actors (detection * publishes, the avatar source subscribes); nothing else observes it. * * Strictly read-only w.r.t. the authoritative pipeline — the feed only forwards * data the pipeline already computed; it never influences detection/autocapture. */ interface FaceFeedReader { /** Subscribe to per-frame faces. Returns an unsubscribe function. */ subscribe(listener: (face: FaceData) => void): () => void; /** The most recently published face, or null if none yet. */ getLatest(): FaceData | null; /** * Subscribe to the coarse "eyes closed" pulse — the only real eye signal the * Incode pipeline exposes (a threshold event, both eyes, fired only when the * closed-eyes check is enabled via `validateClosedEyes`). The avatar uses it * to drive a real blink. Returns an unsubscribe function. */ onEyesClosed(listener: () => void): () => void; } interface FaceFeed extends FaceFeedReader { publish(face: FaceData): void; /** Fire the eyes-closed pulse (from the detection pipeline's threshold event). */ signalEyesClosed(): void; } //#endregion //#region src/modules/authentication/authenticationActor.d.ts type CreateAuthenticationActorOptions = { config: AuthenticationConfig; dependencies?: FaceCaptureDependencies; authHint?: string; }; type AuthenticationActor = ActorRefFrom; declare function createAuthenticationActor(options: CreateAuthenticationActorOptions): AuthenticationActor; //#endregion //#region src/modules/selfie/types.d.ts /** * Public selfie configuration. * * For the captureOnly flow (delivering the captured image locally instead of * uploading to Incode), use `createSelfieCaptureOnlyManager` with * `SelfieCaptureOnlyConfig`. */ type SelfieConfig = FlowModuleConfig['SELFIE'] & BaseFaceCaptureConfig; /** * Public selfie configuration for the captureOnly flow. * * captureOnly bypasses the Incode upload/processing pipeline, so this config * intentionally exposes ONLY the options that affect the on-device capture * experience: the tutorial/preview UX, attempts, timeout, and the on-device * face validations. Backend-coupled flags of {@link SelfieConfig} (face * recording, assisted onboarding, on-device results submission, …) don't apply * here and are omitted. * * `onCapture` is the one required field — it receives the captured image * locally (compile-time enforced so you can't ship a captureOnly flow with no * destination for the payload). Everything else is optional and defaulted by * the factory (see `DEFAULT_SELFIE_CAPTURE_ONLY_CONFIG`); set only what you care * about, e.g. `{ onCapture, captureAttempts: 5, validateBrightness: true }`. */ type SelfieCaptureOnlyConfig = Partial> & { onCapture: (response: FaceCaptureOnlyResponse) => void | Promise; }; type SelfieDependencies = FaceCaptureDependencies; type SendFaceImageResponse = { age: number; confidence: number; hasClosedEyes: boolean; hasFaceMask: boolean; hasHeadCover: boolean; hasLenses: boolean; isBright: boolean; liveness: boolean; imageBase64: string; sessionStatus: string; }; //#endregion //#region src/internal/faceCapture/recordingService.d.ts type RecordingService = { start(stream: MediaStream): Promise; stop(): Promise<{ recordingId: string | null; }>; /** * Stops the recorder and returns the raw (un-encrypted, not uploaded) * video as base64. Used by the captureOnly flow, which hands video bytes * to the integrator via `onCapture` instead of uploading to Incode. * * Returns `{ videoBase64: undefined }` when video is not available for * any reason, including: * - the recorder was never started or is already stopped, * - the provider is server-side (e.g. OpenVidu) and the client never * holds the bytes, * - video assembly fails. */ stopAndGetVideo(): Promise<{ videoBase64: string | undefined; }>; cleanup(): void; }; //#endregion //#region src/internal/faceCapture/faceCaptureSetup.d.ts type FaceCaptureConfig = BaseFaceCaptureConfig; type FaceCaptureInput = { config: FaceCaptureConfig; dependencies: FaceCaptureDependencies; authHint?: string; }; type FaceErrorObject = { type: string; message: string; /** * Stable machine-readable error code (a `FaceErrorCode`, e.g. * `NONEXISTENT_CUSTOMER`) when known, in addition to the human-readable * `message`. Lets hosts react to a specific terminal error without parsing * the (server-/locale-dependent) message string. */ moduleErrorCode?: string; }; type FaceCaptureContext = { config: FaceCaptureConfig; dependencies: FaceCaptureDependencies; authHint: string | undefined; stream: CameraStream | undefined; provider: FaceDetectionProvider | undefined; frameCapturer: StreamCanvasCapture | undefined; usingBackCamera: boolean; error: string | FaceErrorObject | undefined; detectionStatus: DetectionStatus; capturedImage: IncodeCanvas | undefined; faceCoordinates: FaceCoordinates | undefined; uploadResponse: Record | undefined; processResponse: Record | undefined; recordingService: RecordingService | undefined; attemptsRemaining: number; uploadError: FaceErrorCode | undefined; permissionResult: PermissionResult | 'refresh' | undefined; resetDetection: (() => void) | undefined; deepsightService: DeepsightService | undefined; encryptedBase64Image: string | undefined; uploadRecordingId: string | null | undefined; manualCaptureTriggered: boolean; /** * Canvas the cosmetic AR avatar renders into, created by `Avatar3DProvider` * and forwarded to the UI for mounting. Only populated while `capture` is * active and `obfuscateWithAvatar` is on; otherwise `undefined`. Display-only * — never read by the capture/upload pipeline. */ avatarCanvas: HTMLCanvasElement | undefined; /** * Per-frame `FaceData` channel shared between the detection actor (publisher) * and the avatar actor (subscriber) for the **parked** Incode-data avatar * (`incode-2d`). Currently always `undefined` (no shipped avatar consumes it); * a plain emitter, deliberately NOT routed through XState events to avoid * per-frame subscriber churn. Display-only — never read by the capture/upload * pipeline. Kept as revival plumbing for `incode-2d`. */ faceFeed: FaceFeed | undefined; /** * Rich capture payload used only by the captureOnly variant. Populated by * the variant's `.provide()` override of `setUploadResponseFromEvent`, * which writes the `uploadFace` actor's output here instead of the loose * `uploadResponse` channel. Consumed by the captureOnly manager on * transition into `finished`. Remains `undefined` in the regular upload * flow (the base action writes to `uploadResponse` and never touches this * field). */ captureOnlyResult: FaceCapturedImageData | undefined; }; type FaceCaptureEvent = { type: 'LOAD'; } | { type: 'NEXT_STEP'; } | { type: 'REQUEST_PERMISSION'; } | { type: 'GO_TO_LEARN_MORE'; } | { type: 'BACK'; } | { type: 'QUIT'; } | { type: 'RESET'; } | { type: 'MANUAL_CAPTURE'; } | { type: 'DETECTION_UPDATE'; status: DetectionStatus; } | { type: 'DETECTION_SUCCESS'; canvas: IncodeCanvas; faceCoordinates?: FaceCoordinates; } | { type: 'DETECTION_RESET_READY'; reset: () => void; } | { type: 'AVATAR_READY'; canvas: HTMLCanvasElement; } | { type: 'RETRY_CAPTURE'; }; declare const faceCaptureMachine: AnyStateMachine; //#endregion //#region src/modules/selfie/selfieStateMachine.d.ts type SelfieContext = FaceCaptureContext; type SelfieEvent = FaceCaptureEvent; type SelfieInput = FaceCaptureInput; /** * The selfie capture state machine. * * Note: Uses AnyStateMachine type for declaration file portability. * Type safety is ensured via the machine configuration. */ declare const selfieMachine: AnyStateMachine; /** * Type representing the selfie machine. * For advanced use cases requiring specific machine types. */ type SelfieMachine = StateMachine; //#endregion //#region src/modules/selfie/selfieActor.d.ts type CreateSelfieActorOptions = { config: SelfieConfig; dependencies?: SelfieDependencies; authHint?: string; }; type SelfieActor = ActorRefFrom; //#endregion //#region src/modules/selfie/selfieCaptureOnlyStateMachine.d.ts type SelfieCaptureOnlyContext = FaceCaptureContext; type SelfieCaptureOnlyEvent = FaceCaptureEvent; type SelfieCaptureOnlyInput = FaceCaptureInput; /** * Selfie state machine variant for the captureOnly flow. Shares the full base * face-capture state tree; only the upload/process step is local instead of * remote. */ declare const selfieCaptureOnlyMachine: AnyStateMachine; type SelfieCaptureOnlyMachine = StateMachine; //#endregion //#region src/modules/selfie/selfieCaptureOnlyActor.d.ts type CreateSelfieCaptureOnlyActorOptions = { config: SelfieCaptureOnlyConfig; dependencies?: SelfieDependencies; }; type SelfieCaptureOnlyActor = ActorRefFrom; //#endregion //#region src/internal/faceCapture/faceCaptureManagerFactory.d.ts type FaceCaptureActor = SelfieActor | AuthenticationActor | SelfieCaptureOnlyActor; type CaptureStatus = 'initializing' | 'detecting' | 'capturing' | 'uploading' | 'uploadError' | 'success'; /** Face capture manager is waiting to be started */ type FaceCaptureIdleState = { status: 'idle'; }; /** Checking camera permissions (when no tutorial) */ type FaceCaptureLoadingState = { status: 'loading'; }; /** Showing face capture tutorial */ type FaceCaptureTutorialState = { status: 'tutorial'; ageAssurance?: boolean; }; /** Handling camera permissions */ type FaceCapturePermissionsState = { status: 'permissions'; /** Current permission sub-state: initial, requesting, denied, or learnMore */ permissionStatus: PermissionStatus; }; /** Camera is ready for face capture */ type FaceCaptureCaptureState = { status: 'capture'; /** Current capture sub-state */ captureStatus: CaptureStatus; /** The active camera stream */ stream: CameraStream | undefined; /** Current face detection status */ detectionStatus: DetectionStatus; /** Number of capture attempts remaining */ attemptsRemaining: number; /** Error message from failed upload */ uploadError: string | undefined; /** * The requested config flag only — it does NOT say which camera is in use, * since devices without a rear camera fall back to the front one. Use * {@link usingBackCamera} for camera-dependent concerns like mirroring. */ assistedOnboarding: boolean; /** * Whether the active `stream` really came from a rear camera. Mirror the * preview when this is `false` (selfie view), leave it as-is when `true`. */ usingBackCamera: boolean; ageAssurance?: boolean; /** * Whether on-device face-results submission is enabled * (`onDeviceFaceResultsSubmissionEnabled`). When true, WASM autocapture * never falls back to manual capture and the UI must not show the manual * capture button. */ onDeviceMode: boolean; /** Whether the cosmetic AR-avatar overlay is enabled (`obfuscateWithAvatar`). */ obfuscateWithAvatar: boolean; /** * Canvas the avatar renders into, for the UI to mount in place of the live * video. `undefined` until the avatar provider has started (or when * `obfuscateWithAvatar` is off). Display-only. */ avatarCanvas?: HTMLCanvasElement; /** * Which avatar variant is active, derived from `selfieConcealmentOption` * (`undefined` when no concealing avatar is selected). Display-only — the UI * keeps the face outline for `privacy-lens` (a lens over the real video) but * hides it for the full 2D/3D avatars. */ avatarVariant?: AvatarId; }; /** Processing the captured face */ type FaceCaptureProcessingState = { status: 'processing'; }; /** Face capture completed successfully */ type FaceCaptureFinishedState = { status: 'finished'; /** Face processing result (face match, confidence, existing user) */ processResponse: Record | undefined; }; /** User closed the face capture flow */ type FaceCaptureClosedState = { status: 'closed'; }; /** An error occurred during the flow */ type FaceCaptureErrorState = { status: 'error'; /** The error message */ error: string; /** * Stable machine-readable error code (a `FaceErrorCode`, e.g. * `NONEXISTENT_CUSTOMER`) when known. Use this — not the `error` message — * to branch on a specific terminal error. */ moduleErrorCode?: string; }; /** Union of all possible face capture states */ type FaceCaptureManagerState = FaceCaptureIdleState | FaceCaptureLoadingState | FaceCaptureTutorialState | FaceCapturePermissionsState | FaceCaptureCaptureState | FaceCaptureProcessingState | FaceCaptureFinishedState | FaceCaptureClosedState | FaceCaptureErrorState; /** * Builds a face capture manager (selfie / authentication / captureOnly) from an * already-created actor. * * `visibilityObserver` defaults to the browser `document.visibilitychange` * provider so first-party and BYO-actor callers get foreground/background * events without extra wiring. Construction lives here — a documented, narrow * deviation from "never `new` a provider inside Core" (see * `docs/patterns/CAPABILITY.md`). Pass a fake/no-op to override (tests do). */ declare function createFaceCaptureManagerFromActor(actor: FaceCaptureActor, moduleName: string, visibilityObserver?: IVisibilityObserverCapability): Manager & { /** * Starts the face capture flow. * Goes to `tutorial` if showTutorial is true, otherwise to `loading`. * Requires setup() to have been called with a token first. */ load(): void; /** * Advances to the next step. * From `tutorial` → permissions or capture (based on permission status). * From `capture` → finished. */ nextStep(): Promise; /** * Requests camera permission via getUserMedia. * Only effective when in `permissions.idle` or `permissions.learnMore` state. */ requestPermission(): void; /** * Navigates to the "learn more" permission screen. * Only effective when in `permissions.idle` state. */ goToLearnMore(): void; /** * Goes back from "learn more" to the initial permission screen. * Only effective when in `permissions.learnMore` state. */ back(): void; /** * Closes the face capture flow and transitions to `closed` state. * Can be called from any state. */ close(): void; /** * Resets the face capture manager to its initial `idle` state. * Can be called from `error` state. Not available from `finished` (final state). */ reset(): void; /** * Retries the capture after an upload error. * Only effective when in `capture.uploadError` state and `attemptsRemaining > 0`. * If no attempts remaining, the transition is blocked. */ retryCapture(): void; /** * Captures a face in manual capture mode. * Only effective when in `capture.detecting` state and `detectionStatus === 'manualCapture'`. */ capture(): void; }; type FaceCaptureManager = ReturnType; //#endregion export { SendFaceImageResponse as _, SelfieCaptureOnlyMachine as a, createAuthenticationActor as b, SelfieActor as c, FaceCaptureContext as d, FaceCaptureEvent as f, SelfieConfig as g, SelfieCaptureOnlyConfig as h, SelfieCaptureOnlyActor as i, SelfieMachine as l, faceCaptureMachine as m, FaceCaptureManagerState as n, selfieCaptureOnlyMachine as o, FaceCaptureInput as p, CreateSelfieCaptureOnlyActorOptions as r, CreateSelfieActorOptions as s, FaceCaptureManager as t, selfieMachine as u, AuthenticationActor as v, authenticationMachine as x, CreateAuthenticationActorOptions as y };