@sekyro/react 0.1.0-rc.3 → 0.1.0-rc.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +570 -0
- package/LICENSE +25 -16
- package/README.md +189 -39
- package/dist/chunk-23GZ62S2.js +2 -0
- package/dist/chunk-2KED7D2Q.js +2 -0
- package/dist/chunk-55NNQK5P.js +2 -0
- package/dist/chunk-5EPFSWU5.js +2 -0
- package/dist/chunk-5WLMXBCT.js +2 -0
- package/dist/chunk-7MMT5M4E.js +2 -0
- package/dist/chunk-FE6AS435.js +2 -0
- package/dist/chunk-FJ3AON46.js +2 -0
- package/dist/chunk-GUTF3SPK.js +2 -0
- package/dist/chunk-KJT5NUFX.js +2 -0
- package/dist/chunk-KK5O6LP4.js +2 -0
- package/dist/chunk-OXGWLJ5D.js +2 -0
- package/dist/chunk-QL2NK7GA.js +2 -0
- package/dist/chunk-TCSAUR2Y.js +2 -0
- package/dist/chunk-U4KOMPUR.js +2 -0
- package/dist/chunk-VRDPGOXM.js +2 -0
- package/dist/chunk-VXMOKB43.js +2 -0
- package/dist/chunk-XQFVLRIY.js +2 -0
- package/dist/chunk-ZARKJW2C.js +2 -0
- package/dist/chunk-ZOE5QUGI.js +2 -0
- package/dist/document-capture-view-2NFKF44N.js +2 -0
- package/dist/eid-view-UGYVZ5NM.js +2 -0
- package/dist/email-otp-view-ENQVRS66.js +2 -0
- package/dist/flow-views-HNJPDQ63.js +2 -0
- package/dist/fonts/Cairo-OFL.txt +93 -0
- package/dist/fonts/Geist-OFL.txt +93 -0
- package/dist/fonts/Inter-OFL.txt +93 -0
- package/dist/fonts/SekyroCairo-Bold.woff2 +0 -0
- package/dist/fonts/SekyroCairo-Regular.woff2 +0 -0
- package/dist/fonts/SekyroCairo-SemiBold.woff2 +0 -0
- package/dist/fonts/SekyroGeist-Bold.woff2 +0 -0
- package/dist/fonts/SekyroGeist-SemiBold.woff2 +0 -0
- package/dist/fonts/SekyroInter-Medium.woff2 +0 -0
- package/dist/fonts/SekyroInter-Regular.woff2 +0 -0
- package/dist/fonts/SekyroInter-SemiBold.woff2 +0 -0
- package/dist/form-view-6ERKUFVD.js +2 -0
- package/dist/index.cjs +1 -2
- package/dist/index.d.cts +7 -380
- package/dist/index.d.ts +7 -380
- package/dist/index.js +1 -2
- package/dist/overlay-de-2DL4MNC7.js +2 -0
- package/dist/overlay-es-FMHWRKQW.js +2 -0
- package/dist/overlay-pt-OGIELLCM.js +2 -0
- package/dist/portrait-capture-view-ARRN3JW6.js +2 -0
- package/dist/portrait-review-view-JF6TYNBU.js +2 -0
- package/dist/proof-of-address-view-46Q6F7H5.js +2 -0
- package/dist/styles.css +35 -11
- package/dist/theme-DbHOQCyE.d.cts +547 -0
- package/dist/theme-DbHOQCyE.d.ts +547 -0
- package/dist/verification/index.cjs +2 -0
- package/dist/verification/index.d.cts +871 -0
- package/dist/verification/index.d.ts +871 -0
- package/dist/verification/index.js +2 -0
- package/dist/verification.css +848 -0
- package/package.json +27 -16
- package/sbom.cdx.json +153 -0
- package/assets/audio/v1/README.md +0 -60
- package/assets/audio/v1/manifest.json +0 -7
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/liveness-capture.tsx","../src/button.tsx","../src/capture-arc.tsx","../src/use-strings.ts","../src/strings/en.ts","../src/strings/ar.ts","../src/strings/fr.ts","../src/strings/index.ts","../src/capture-stage.tsx","../src/captured-panel.tsx","../src/dev.ts","../src/intro/pre-capture-screen.tsx","../src/notice.tsx","../src/intro/facing-picker.tsx","../src/intro/icons.tsx","../src/intro/permission-row.tsx","../src/intro/tips.tsx","../src/intro/voice-switch.tsx","../src/use-camera-status.ts","../src/use-focus-on-mount.ts","../src/use-liveness-assets.ts","../src/use-liveness-handle.ts","../src/voice-chip.tsx","../src/voice/clip-manifest.ts","../src/voice/keys.ts","../src/voice/clips.ts","../src/voice/use-voice-guidance.ts","../src/voice/player.ts","../src/voice/preference.ts","../src/theme.tsx"],"sourcesContent":["// <LivenessCapture /> — the hosted liveness step's capture UI, extracted onto\n// the public @sekyro/web API (spec §3.2). Two modes:\n// - verification mode (`verification` prop): the handle comes from\n// `verification.liveness()`; after `captured` the SDK uploads, attests and\n// submits, and the verdict arrives through `onResult`;\n// - capture-only mode (no `verification`): `createLivenessCapture()`; the\n// component emits `onCaptured` and stops there.\n// Before the attempt it renders the built-in pre-capture screen (tips,\n// permission row, front/back choice, voice switch, a Start gated on the\n// detector preload) and, during it, speaks the guidance (clips + TTS).\nimport type {\n CameraFacing,\n CameraPermissionState,\n CaptureError,\n CapturedArtifacts,\n CaptureState,\n GateHint,\n Verification,\n VerificationResult,\n} from \"@sekyro/web\";\nimport {\n isValidElement,\n type ReactNode,\n type RefObject,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { Button } from \"./button\";\nimport type { CapturePhase } from \"./capture-arc\";\nimport { CaptureStage } from \"./capture-stage\";\nimport { CapturedPanel } from \"./captured-panel\";\nimport { isDevBuild } from \"./dev\";\nimport { PreCaptureScreen } from \"./intro/pre-capture-screen\";\nimport { type BuiltInTipId, DEFAULT_TIPS, type IntroTip } from \"./intro/tips\";\nimport { Notice } from \"./notice\";\nimport {\n attemptsRemainingText,\n captureErrorStringKey,\n hintStringKey,\n reasonStringKey,\n type SekyroLocale,\n type StringKey,\n type Strings,\n} from \"./strings/index\";\nimport { useCameraStatus } from \"./use-camera-status\";\nimport { useFocusOnMount } from \"./use-focus-on-mount\";\nimport { useLivenessAssets } from \"./use-liveness-assets\";\nimport { useLivenessHandle } from \"./use-liveness-handle\";\nimport { resolveStrings, StringsProvider } from \"./use-strings\";\nimport { VoiceChip } from \"./voice-chip\";\nimport {\n isVoiceKey,\n useSpeakGuidance,\n useVoiceGuidance,\n type VoiceControl,\n type VoiceOptions,\n} from \"./voice/index\";\n\n/**\n * Display debounce before the no-face copy replaces another hint: detector\n * blips flash \"we can't see your face\" while the face is clearly visible, so\n * switching TO no-face must persist this long first. Any other hint renders\n * immediately and cancels a pending no-face. Chrome only — never gate input.\n */\nexport const NO_FACE_DEBOUNCE_MS = 800;\n\n/** A host message shown above the pre-capture screen (`notice` prop). */\nexport interface LivenessNotice {\n /** `info` is a polite status; `warning` / `danger` are announced as alerts. */\n tone: \"info\" | \"warning\" | \"danger\";\n text: ReactNode;\n}\n\n/** What `slots.intro` gets besides `start`: the state the built-in screen renders from. */\nexport interface IntroContext {\n /**\n * Detector preload gate: Start should wait for `ready`; `failed` offers `retryAssets`.\n * Also `loading` while `autoStart=\"when-permitted\"` waits for the first camera-permission answer.\n */\n assets: \"loading\" | \"ready\" | \"failed\";\n retryAssets: () => void;\n permission: CameraPermissionState;\n /** The camera `start` opens (and the in-stage switch flips). */\n facing: CameraFacing;\n setFacing: (facing: CameraFacing) => void;\n /** A front/back choice makes sense on this device. */\n canChooseFacing: boolean;\n voice: VoiceControl;\n}\n\n/** Render slots — partners inject their own chrome around and inside the stage. */\nexport interface LivenessCaptureSlots {\n /** Above the stage (title, step indicator). */\n header?: ReactNode;\n /** Below everything (security note, help link). */\n footer?: ReactNode;\n /**\n * Replaces the built-in pre-capture screen while the capture is idle.\n * `start` begins the attempt with `context.facing` and unlocks audio — call\n * it from the click handler (iOS needs the user gesture). `context` carries\n * the preload gate, permission, facing and voice state the built-in screen\n * renders from.\n */\n intro?: (start: () => void, context: IntroContext) => ReactNode;\n /**\n * Rendered inside the stage box above the ring (measurement overlays,\n * watermarks); receives the ref of the component-owned `<video>`.\n */\n stageOverlay?: (videoRef: RefObject<HTMLVideoElement | null>) => ReactNode;\n /**\n * Replaces the built-in voice chip in the stage's start corner; receives the\n * current hint code, the on-screen text, the string key behind it and the\n * shared voice state. The component keeps speaking the guidance itself —\n * pass `voice={false}` if this slot plays its own audio (a development build\n * warns when this slot is set and `voice` is left undefined).\n */\n voicePrompt?: (hint: GateHint | null, text: string, key: StringKey | null, voice: VoiceControl) => ReactNode;\n /** Replaces the default camera-error notice. `retry` starts a fresh attempt. */\n errorPanel?: (error: CaptureError, retry: () => void) => ReactNode;\n}\n\n/** Props of {@link LivenessCapture}. */\nexport interface LivenessCaptureProps {\n /** From `createVerification()`. Absent → capture-only mode. */\n verification?: Verification;\n /** Built-in dictionary to use (`ar` | `fr` | `en`). */\n locale: SekyroLocale;\n /** Text direction; defaults to `rtl` for `ar`, `ltr` otherwise. */\n dir?: \"ltr\" | \"rtl\";\n /** Copy overrides merged on top of the built-in dictionary for `locale`. */\n strings?: Partial<Strings>;\n /** Render slots around / inside the stage. */\n slots?: LivenessCaptureSlots;\n /**\n * Start the camera instead of showing the pre-capture screen — at most once\n * per mount, once the detector preload is ready. `true` arms it (a host may\n * flip it later, once its own preconditions are met); `\"when-permitted\"`\n * arms it only while the camera permission is already `granted`. While armed\n * but not ready the screen shows its loader (or the retry on failure).\n *\n * An auto-start has no user gesture, so iOS keeps audio locked until the\n * person's first activating touch (`touchend`), click or key press (not\n * Escape) anywhere inside the component; the voice unlocks then (clips that\n * were due before stay silent).\n */\n autoStart?: boolean | \"when-permitted\";\n /** Host message above the pre-capture screen (or `slots.intro`); hidden once capture starts. */\n notice?: ReactNode | LivenessNotice;\n /**\n * Disable the built-in Start (e.g. a busy cooldown); pair with `startLabel`.\n * Gates only the pre-capture Start — not the error Retry, \"record again\" or\n * the retake button (gate those flows yourself, e.g. via `slots.errorPanel`).\n */\n startDisabled?: boolean;\n /** Built-in Start label; default `capture.start`. */\n startLabel?: ReactNode;\n /** Tips on the pre-capture screen; default {@link DEFAULT_TIPS}; `false` hides the card. */\n tips?: false | ReadonlyArray<BuiltInTipId | IntroTip>;\n /** Camera the attempt opens with; default `\"user\"` (front). */\n defaultFacing?: CameraFacing;\n /**\n * Voice guidance (on by default: bundled clips, device-voice fallback).\n * `false` = no speech, no voice switch, no stage chip.\n */\n voice?: false | VoiceOptions;\n /** Telemetry: once per change of the displayed, spoken-able (`fcv3.*`) guidance key. */\n onGuidance?: (key: StringKey) => void;\n /** Fires BEFORE any upload, with the engine's artifacts. */\n onCaptured?: (artifacts: CapturedArtifacts) => void;\n /** Verification mode only: the verdict for this session / capture. */\n onResult?: (result: VerificationResult) => void;\n /** Camera / engine failure. */\n onError?: (error: CaptureError) => void;\n /** Every capture-state transition (`starting` … `done`), for host chrome. */\n onStateChange?: (state: CaptureState) => void;\n /** Base URL of the detector assets (tasks-vision wasm + tflite); default `/models-v3`. */\n assetBaseUrl?: string;\n /** Extra class on the root element. */\n className?: string;\n}\n\n/** Whether `event` carries a user activation (iOS audio unlock); Escape never does. */\nfunction carriesActivation(event: Event): boolean {\n if (event.type === \"keydown\" && (event as KeyboardEvent).key === \"Escape\") return false;\n const activation = (globalThis.navigator as { userActivation?: { isActive: boolean } } | undefined)?.userActivation;\n // No UserActivation API (iOS < 16.4): a touch `pointerup` is NOT an\n // activation on WebKit — leave the unlock to the `touchend` that follows.\n if (activation === undefined) return !(event.type === \"pointerup\" && (event as PointerEvent).pointerType === \"touch\");\n return activation.isActive;\n}\n\nfunction isNoticeObject(value: unknown): value is LivenessNotice {\n return typeof value === \"object\" && value !== null && !isValidElement(value) && \"tone\" in value && \"text\" in value;\n}\n\nfunction isCapturing(state: CaptureState): boolean {\n return state === \"starting\" || state === \"gating\" || state === \"recording\";\n}\n\nfunction isPostCapture(state: CaptureState): boolean {\n return state === \"captured\" || state === \"uploading\" || state === \"checking\";\n}\n\n/**\n * Liveness capture UI over `@sekyro/web`: the mirrored camera stage with the\n * circular guide / progress ring / guidance line, the Start intro, the frozen\n * still + \"checking\" state, and the retry / error surfaces. Wrap in\n * {@link SekyroThemeProvider} (or set the `--sekyro-*` variables yourself) and\n * import `@sekyro/react/styles.css` once.\n */\nexport function LivenessCapture({\n verification,\n locale,\n dir,\n strings,\n slots,\n autoStart = false,\n notice,\n startDisabled = false,\n startLabel,\n tips,\n defaultFacing,\n voice: voiceOption,\n onGuidance,\n onCaptured,\n onResult,\n onError,\n onStateChange,\n assetBaseUrl,\n className,\n}: LivenessCaptureProps) {\n const dictionary = useMemo(() => resolveStrings(locale, strings), [locale, strings]);\n // Only the optional plural-category keys can be absent; they are read via\n // attemptsRemainingText (with its `other` fallback), never through `t`.\n const t = useMemo(() => (key: StringKey) => dictionary[key] ?? \"\", [dictionary]);\n const direction = dir ?? (locale === \"ar\" ? \"rtl\" : \"ltr\");\n\n const videoRef = useRef<HTMLVideoElement | null>(null);\n const capture = useLivenessHandle({\n verification,\n videoRef,\n assetBaseUrl,\n onCaptured,\n onResult,\n onError,\n onStateChange,\n });\n\n const assets = useLivenessAssets(assetBaseUrl, capture.state === \"idle\" && capture.error === null);\n const camera = useCameraStatus();\n const voice = useVoiceGuidance({ locale, assetBaseUrl, options: voiceOption });\n const [facing, setFacing] = useState<CameraFacing>(defaultFacing ?? \"user\");\n\n // iOS audio unlock (+ the clip prefetch, which rides on it). A Start tap\n // unlocks inside its gesture (begin); an auto-start has none, so the FIRST\n // activating event inside the root unlocks instead (once — later taps must\n // not interrupt a playing clip). WebKit grants activation on `touchend` /\n // `click` / `keydown` (and a non-touch `pointerup`), NOT on a touch\n // `pointerdown`; an event that carries no activation leaves the listeners\n // armed for the next one.\n const rootRef = useRef<HTMLDivElement | null>(null);\n const unlockedRef = useRef(false);\n const unlockRef = useRef(voice.unlock);\n unlockRef.current = voice.unlock;\n useEffect(() => {\n const root = rootRef.current;\n if (root === null) return;\n const events = [\"pointerup\", \"touchend\", \"click\", \"keydown\"] as const;\n const disarm = (): void => {\n for (const type of events) root.removeEventListener(type, onGesture, true);\n };\n function onGesture(event: Event): void {\n if (unlockedRef.current) {\n disarm(); // a Start tap already unlocked\n return;\n }\n if (!carriesActivation(event)) return;\n unlockedRef.current = true;\n disarm();\n unlockRef.current();\n }\n for (const type of events) root.addEventListener(type, onGesture, { capture: true, passive: true });\n return disarm;\n }, []);\n\n const begin = useCallback(() => {\n // Inside the Start gesture — iOS audio unlock (unless the root listener\n // already did it earlier in this very gesture: pointerup / touchend fire before click).\n if (!unlockedRef.current) {\n unlockedRef.current = true;\n voice.unlock();\n }\n capture.start({ facing });\n }, [voice.unlock, capture.start, facing]);\n // No gesture here: unlocking would be refused on iOS, so the root listener\n // stays armed for the first touch (desktop / Android play without one).\n const autoBegin = useCallback(() => capture.start({ facing }), [capture.start, facing]);\n\n // Auto-start at most once per mount, the first time it is armed while idle\n // AND the detector preload is ready (a later error keeps the normal error surface).\n const autoStartedRef = useRef(false);\n const preCaptureIdle = capture.state === \"idle\" && capture.error === null;\n const autoArmed = autoStart === true || (autoStart === \"when-permitted\" && camera.permission === \"granted\");\n // \"when-permitted\" before the first permission answer: it may still arm →\n // show the loader, never a ready Start that flashes away a tick later.\n const permissionPending = autoStart === \"when-permitted\" && !camera.permissionSettled && !autoStartedRef.current;\n // Armed and not yet fired: the auto-start is imminent → never a ready Start\n // (it would paint, then vanish). The ref flips inside the effect, whose\n // capture.start moves the state off `idle` → that state change re-renders;\n // a start failure sets `capture.error` (not idle) → the error surface shows;\n // an attempt that later ends back on `idle` gets the normal ready Start.\n const autoPending = autoArmed && preCaptureIdle && !autoStartedRef.current;\n const screenGate = (permissionPending || autoPending) && assets.gate === \"ready\" ? \"loading\" : assets.gate;\n useEffect(() => {\n if (!autoArmed || !preCaptureIdle || assets.gate !== \"ready\" || autoStartedRef.current) return;\n autoStartedRef.current = true;\n autoBegin();\n }, [autoArmed, preCaptureIdle, assets.gate, autoBegin]);\n const showIntro = preCaptureIdle && !(autoPending && assets.gate === \"ready\");\n\n // The in-stage switch: the tracked facing follows, so a later start/retry\n // and the intro context stay truthful.\n const switchCamera = useCallback(() => {\n setFacing((f) => (f === \"user\" ? \"environment\" : \"user\"));\n capture.switchCamera();\n }, [capture.switchCamera]);\n\n // The captured still: the frozen preview (available at recording-stop, the\n // same keyframe) stays put into checking; without one, an object URL of the\n // keyframe blob, revoked when it changes.\n const objectUrl = useMemo(\n () =>\n capture.artifacts !== null && typeof URL.createObjectURL === \"function\"\n ? URL.createObjectURL(capture.artifacts.keyframe)\n : null,\n [capture.artifacts],\n );\n useEffect(() => {\n if (objectUrl === null) return;\n return () => URL.revokeObjectURL(objectUrl);\n }, [objectUrl]);\n const stillUrl = capture.frozenPreview ?? objectUrl;\n\n const verificationMode = verification !== undefined;\n const capturing = isCapturing(capture.state);\n const postCapture = isPostCapture(capture.state);\n const stageVisible = capturing || postCapture;\n const result = capture.result;\n const done = capture.state === \"done\" && result !== null;\n // Recording stopped (frozen still arrived) but the clip is still finalizing.\n const frozen = capture.state === \"recording\" && capture.frozenPreview !== null;\n\n const phase: CapturePhase = postCapture\n ? \"checking\"\n : frozen\n ? \"frozen\"\n : capture.state === \"recording\"\n ? \"recording\"\n : capture.gateLocked || capture.gate.progress >= 1\n ? \"locked\"\n : capture.gate.faceDetected\n ? \"aligning\"\n : \"seeking\";\n\n // ── guidance line (hint → string key, with the no-face display debounce) ──\n const guidanceHint = capturing ? capture.gate.hint : null;\n const rawKey: StringKey | null =\n capture.state === \"starting\"\n ? \"capture.preparing.title\"\n : guidanceHint === null\n ? null\n : guidanceHint === \"center\" && !capture.gate.faceDetected\n ? \"fcv3.no_face\"\n : hintStringKey(guidanceHint);\n const [displayKey, setDisplayKey] = useState<StringKey | null>(null);\n useEffect(() => {\n if (rawKey !== \"fcv3.no_face\") {\n setDisplayKey(rawKey);\n return;\n }\n // Schedule ONLY while the camera is driving: a state exit cancels the\n // timer so no-face never surfaces over an error surface.\n if (!capturing) return;\n const timer = setTimeout(() => setDisplayKey(rawKey), NO_FACE_DEBOUNCE_MS);\n return () => clearTimeout(timer);\n }, [rawKey, capturing]);\n const guidanceKey = capturing ? displayKey : null;\n const guidanceText = guidanceKey === null ? \"\" : t(guidanceKey);\n\n // Speak the DISPLAYED (debounced) key; stops (and resets) outside capture.\n useSpeakGuidance(voice, guidanceKey, guidanceText, capturing);\n // Through a ref: an inline callback never re-fires the effect. A throwing\n // partner callback must not take the capture down.\n const onGuidanceRef = useRef(onGuidance);\n onGuidanceRef.current = onGuidance;\n useEffect(() => {\n if (!isVoiceKey(guidanceKey)) return;\n try {\n onGuidanceRef.current?.(guidanceKey);\n } catch (err) {\n console.error(\"[@sekyro/react] onGuidance threw:\", err);\n }\n }, [guidanceKey]);\n\n // What slots see: the public VoiceControl only (no unlock / speakKey / stop).\n const voiceControl: VoiceControl = useMemo(\n () => ({ supported: voice.supported, enabled: voice.enabled, setEnabled: voice.setEnabled, toggle: voice.toggle }),\n [voice.supported, voice.enabled, voice.setEnabled, voice.toggle],\n );\n const voicePromptSlot = slots?.voicePrompt;\n const hasVoicePromptSlot = voicePromptSlot !== undefined;\n const voiceUnset = voiceOption === undefined;\n const warnedVoicePromptRef = useRef(false);\n useEffect(() => {\n if (!hasVoicePromptSlot || !voiceUnset || warnedVoicePromptRef.current || !isDevBuild()) return;\n warnedVoicePromptRef.current = true;\n console.warn(\n \"[@sekyro/react] <LivenessCapture>: `slots.voicePrompt` is set and `voice` is undefined, so the \" +\n \"component speaks the guidance itself. If your slot plays audio, pass voice={false} or the person \" +\n \"hears every hint twice; pass voice={{}} to keep the built-in voice and silence this warning.\",\n );\n }, [hasVoicePromptSlot, voiceUnset]);\n const voicePrompt =\n voicePromptSlot !== undefined\n ? (hint: GateHint | null, text: string, key: StringKey | null) => voicePromptSlot(hint, text, key, voiceControl)\n : voice.supported\n ? () => <VoiceChip voice={voiceControl} />\n : undefined;\n\n const introContext: IntroContext = useMemo(\n () => ({\n assets: screenGate,\n retryAssets: assets.retry,\n permission: camera.permission,\n facing,\n setFacing,\n canChooseFacing: camera.canChooseFacing,\n voice: voiceControl,\n }),\n [screenGate, assets.retry, camera.permission, camera.canChooseFacing, facing, voiceControl],\n );\n const noticeNode = isNoticeObject(notice) ? (\n <Notice tone={notice.tone} testId=\"sekyro-host-notice\">\n <span>{notice.text}</span>\n </Notice>\n ) : (\n (notice ?? null)\n );\n\n // A retryable verdict: with the SDK's auto re-arm the reason + coaching stay\n // up while the new attempt runs; with a manual re-arm (`rearm: 'manual'`)\n // the handle settles at `done` and the retake button starts the next one.\n const retryVerdict = result !== null && result.status === \"retry\" ? result : null;\n const unavailable = done && result.status === \"unavailable\" ? result : null;\n const terminal =\n done && (result.status === \"approved\" || result.status === \"rejected\" || result.status === \"review\")\n ? result\n : null;\n const reasonText = (reason: VerificationResult[\"reason\"]): string | null => {\n if (reason === undefined) return null;\n const key = reasonStringKey(reason);\n return key === null ? null : t(key);\n };\n // A missing MediaRecorder will not appear on retry; an off-allowlist\n // container (a recorder exists) may — a switched camera can negotiate another.\n // An expired session (no reason) and an unbound NNI are terminal: a new attempt\n // cannot succeed on this session — the host must start a new one.\n const unavailableRetryable =\n unavailable !== null &&\n unavailable.reason !== undefined &&\n unavailable.reason !== \"nni_unbound\" &&\n !(unavailable.reason === \"no_recorder\" && capture.artifacts?.degraded === \"NO_RECORDER\");\n const focusRetry = useFocusOnMount();\n\n return (\n <StringsProvider value={t}>\n <div\n ref={rootRef}\n className={className === undefined ? \"sekyro-capture\" : `sekyro-capture ${className}`}\n dir={direction}\n lang={locale}\n data-testid=\"sekyro-liveness-capture\"\n data-state={capture.state}\n >\n {slots?.header}\n\n {/* Polite: the SDK already re-armed the camera — coaching, not an interruption (M4). */}\n {retryVerdict !== null && reasonText(retryVerdict.reason) !== null ? (\n <Notice tone=\"warning\" role=\"status\" testId=\"sekyro-retry-notice\">\n <span>{reasonText(retryVerdict.reason)}</span>\n </Notice>\n ) : null}\n\n {capture.error !== null ? (\n slots?.errorPanel !== undefined ? (\n slots.errorPanel(capture.error, capture.retry)\n ) : (\n <Notice tone=\"danger\" testId=\"sekyro-error-notice\">\n <span>{t(captureErrorStringKey(capture.error.kind))}</span>\n {capture.error.retryable ? (\n <Button ref={focusRetry} kind=\"ghost\" className=\"sekyro-btn--start\" onClick={capture.retry}>\n {t(\"common.retry\")}\n </Button>\n ) : null}\n </Notice>\n )\n ) : null}\n\n {unavailable !== null ? (\n <Notice tone=\"danger\" testId=\"sekyro-unavailable-notice\">\n {/* No reason at all = the session itself is no longer usable (expired /\n terminal without a verdict for this capture) — not a network fault (M6). */}\n <span>\n {reasonText(unavailable.reason) ??\n t(unavailable.reason === undefined ? \"errors.session_expired\" : \"errors.network_error\")}\n </span>\n {unavailableRetryable ? (\n <Button ref={focusRetry} kind=\"ghost\" className=\"sekyro-btn--start\" onClick={capture.retry}>\n {t(\"capture.recordAgain\")}\n </Button>\n ) : null}\n </Notice>\n ) : null}\n\n {terminal !== null && reasonText(terminal.reason) !== null ? (\n <Notice tone={terminal.status === \"rejected\" ? \"danger\" : \"info\"} testId=\"sekyro-result-notice\">\n <span>{reasonText(terminal.reason)}</span>\n </Notice>\n ) : null}\n\n {/* The stage stays MOUNTED from mount (the engine binds the <video>\n element once) and is hidden until capture is live. */}\n <div className={stageVisible ? undefined : \"sekyro-hidden\"} data-capture-live={stageVisible ? \"\" : undefined}>\n <CaptureStage\n videoRef={videoRef}\n guidanceText={guidanceText}\n guidanceHint={guidanceHint}\n guidanceKey={guidanceKey}\n progress={capture.gate.progress}\n phase={phase}\n draining={capture.draining}\n stillUrl={stillUrl}\n showChecking={verificationMode}\n onSwitchCamera={switchCamera}\n canSwitchCamera={capturing && capture.state !== \"recording\"}\n voicePrompt={voicePrompt}\n overlay={slots?.stageOverlay}\n reduceMotion={capture.reduceMotion}\n />\n </div>\n\n {showIntro ? (\n <>\n {noticeNode}\n {slots?.intro !== undefined ? (\n slots.intro(begin, introContext)\n ) : (\n <PreCaptureScreen\n assets={screenGate}\n onRetryAssets={assets.retry}\n permission={camera.permission}\n canChooseFacing={camera.canChooseFacing}\n facing={facing}\n onFacingChange={setFacing}\n voice={voiceControl}\n tips={tips ?? DEFAULT_TIPS}\n {...(startLabel !== undefined ? { startLabel } : {})}\n startDisabled={startDisabled}\n onStart={begin}\n />\n )}\n </>\n ) : null}\n\n <CapturedPanel\n showCoaching={retryVerdict !== null}\n attemptsText={\n retryVerdict?.attemptsRemaining !== undefined\n ? attemptsRemainingText(dictionary, locale, retryVerdict.attemptsRemaining)\n : null\n }\n showRetake={\n (retryVerdict !== null && !capturing && !postCapture) ||\n (!verificationMode && capture.state === \"captured\")\n }\n onRetake={capture.retry}\n />\n\n {slots?.footer}\n </div>\n </StringsProvider>\n );\n}\n","// Local button (replaces the private design-system Button): native <button>,\n// ≥48px target, visible 3px focus ring from the theme (styles.css .sekyro-btn).\n// forwardRef keeps the React 18 peer range working (ref-as-prop is React 19 only).\nimport { type ButtonHTMLAttributes, forwardRef } from \"react\";\n\nexport type ButtonKind = \"primary\" | \"ghost\" | \"chip\";\n\nexport interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n kind?: ButtonKind;\n /** Stretch to the container width (the intro's Start button). */\n full?: boolean;\n}\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button(\n { kind = \"primary\", full = false, className, type, ...rest },\n ref,\n) {\n const classes = [\"sekyro-btn\", `sekyro-btn--${kind}`];\n if (full) classes.push(\"sekyro-btn--full\");\n if (className !== undefined) classes.push(className);\n return <button ref={ref} type={type ?? \"button\"} className={classes.join(\" \")} {...rest} />;\n});\n","// Circular face guide + radial-tick progress ring + scrim — ported from\n// identity-hosted/components/capture-arc.tsx (Capture Stage v2.1), tokens\n// `--ds-color-*` → `--sekyro-color-*`, Tailwind utilities → styles.css classes.\n//\n// CRITICAL: rendered CHROME ONLY. The engine's gate (inside @sekyro/web) is the\n// only gating geometry; nothing drawn here feeds gate input. Fill is the gate\n// integrator progress from the handle's `gate` event.\n//\n// GUIDE RADIUS — fixed r=100 (owner ruling 2026-07-06): the gate is a centering\n// test; the engine's hints handle face size and distance. Never above 104 — the\n// guide must stay inside the tick ring (R_IN 108).\n//\n// The scrim is ONE even-odd path, effectively solid (96% live / 100% once the\n// still is shown): the stage box is always 3:4 under `meet`, so the letterbox\n// bands are exactly 50 viewBox units top and bottom and the oversized rect\n// (svg overflow visible) covers everything. The video is visible only through\n// the circular hole.\n//\n// Colors: the scrim is the theme `fg`, the guide circle the theme `surface`\n// (same pairing as text on surface → inherits the theme's AAA ratio); the ticks\n// are decorative (aria-hidden, redundant with the guidance text).\nimport type { CSSProperties } from \"react\";\n\n/** Radial tick marks around the guide (donor ARC_TICKS). */\nexport const ARC_TICKS = 56;\n\n/**\n * Stage phase — derived in LivenessCapture from the handle's state + gate.\n * `recording`: the ring HOLDS its earned full/success state and the guide\n * borrows the checking state's dashed spin. `frozen`: recording ended and the\n * keyframe still is shown while the clip finalizes (reads like checking\n * WITHOUT the camera-off claim). `checking`: the still is shown, tracks stopped.\n */\nexport type CapturePhase = \"seeking\" | \"aligning\" | \"locked\" | \"recording\" | \"frozen\" | \"checking\";\n\nconst VIEW = 300;\nconst CX = 150;\nconst CY = 150;\n/** Guide / scrim-hole center — concentric with the tick ring (v3 gates on the eye midpoint). */\nconst CY_GUIDE = 150;\n/** Fixed guide radius (viewBox units). MUST stay below R_IN (108). */\nconst GUIDE_R = 100;\nconst R_IN = 108;\nconst R_OUT = 138;\nconst TICK_W = 3;\n\nconst TICKS = Array.from({ length: ARC_TICKS }, (_, i) => {\n const angle = (i / ARC_TICKS) * 2 * Math.PI - Math.PI / 2; // start top, clockwise\n const cos = Math.cos(angle);\n const sin = Math.sin(angle);\n return {\n id: `tick-${i}`,\n frac: i / (ARC_TICKS - 1),\n x1: CX + R_IN * cos,\n y1: CY + R_IN * sin,\n x2: CX + R_OUT * cos,\n y2: CY + R_OUT * sin,\n // Ignition cascade: constant per-tick stagger so fills and the success\n // flip sweep clockwise (~340 ms) instead of snapping.\n style: { transitionDelay: `${i * 6}ms` } as CSSProperties,\n };\n});\n\n/** Tick color: neutral until reached, progressively stronger brand by ring\n * position, success everywhere once the gate is ready; warning while the\n * integrator DRAINS so \"not advancing\" is visible the moment it starts. */\nfunction tickColor(reached: boolean, frac: number, complete: boolean, draining: boolean): string {\n if (complete) return \"var(--sekyro-color-success)\";\n if (!reached) return \"color-mix(in srgb, var(--sekyro-color-surface) 32%, transparent)\";\n if (draining) return \"color-mix(in srgb, var(--sekyro-color-warning) 75%, transparent)\";\n if (frac < 0.33) return \"color-mix(in srgb, var(--sekyro-color-brand) 55%, transparent)\";\n if (frac < 0.66) return \"color-mix(in srgb, var(--sekyro-color-brand) 80%, transparent)\";\n return \"var(--sekyro-color-brand)\";\n}\n\nconst SCRIM_PATH = `M0 -50 H${VIEW} V${VIEW + 50} H0 Z M${CX - GUIDE_R} ${CY_GUIDE} a${GUIDE_R},${GUIDE_R} 0 1 0 ${2 * GUIDE_R},0 a${GUIDE_R},${GUIDE_R} 0 1 0 ${-2 * GUIDE_R},0 Z`;\n\n/**\n * Decorative guide + progress halo over the capture stage (`progress` 0..1).\n * Guidance text is announced via the stage's aria-live region, so this is\n * aria-hidden.\n */\nexport function CaptureArc({\n progress,\n phase,\n draining = false,\n}: {\n progress: number;\n phase: CapturePhase;\n /** Gate integrator falling — warning-tint the earned ticks (chrome only). */\n draining?: boolean;\n}) {\n const clamped = Math.min(1, Math.max(0, progress));\n const filled = Math.round(clamped * ARC_TICKS);\n const checking = phase === \"checking\";\n const recording = phase === \"recording\";\n const frozen = phase === \"frozen\";\n // The still is on screen for BOTH frozen and checking — dim the earned\n // ticks and deepen the scrim for both; live recording keeps the earned ring.\n const stillShown = checking || frozen;\n // All three post-fire phases spin the guide.\n const spinning = checking || recording || frozen;\n const complete = phase === \"locked\" || spinning;\n const drainingVisible = draining && !complete;\n\n return (\n <svg\n aria-hidden=\"true\"\n viewBox={`0 0 ${VIEW} ${VIEW}`}\n preserveAspectRatio=\"xMidYMid meet\"\n className=\"sekyro-stage__arc\"\n data-testid=\"sekyro-capture-arc\"\n data-phase={phase}\n data-filled={filled}\n data-recording={recording ? \"\" : undefined}\n data-draining={drainingVisible ? \"\" : undefined}\n >\n <path\n fillRule=\"evenodd\"\n d={SCRIM_PATH}\n fill=\"color-mix(in srgb, var(--sekyro-color-fg) var(--sekyro-scrim, 96%), transparent)\"\n style={{ \"--sekyro-scrim\": stillShown ? \"100%\" : \"96%\" } as CSSProperties}\n className=\"sekyro-arc__scrim sekyro-capture-fade-in\"\n data-testid=\"sekyro-capture-scrim\"\n />\n {/* Ring group: one-shot settle beat on entering locked. */}\n <g className={phase === \"locked\" ? \"sekyro-capture-settle\" : undefined}>\n <g className={stillShown ? \"sekyro-arc__ring sekyro-arc__ring--dim\" : \"sekyro-arc__ring\"}>\n {TICKS.map((tick, i) => (\n <line\n key={tick.id}\n x1={tick.x1}\n y1={tick.y1}\n x2={tick.x2}\n y2={tick.y2}\n stroke={tickColor(i < filled, tick.frac, complete, drainingVisible)}\n strokeWidth={TICK_W}\n strokeLinecap=\"round\"\n style={tick.style}\n className=\"sekyro-arc__tick\"\n />\n ))}\n </g>\n {/* Inward breathe while seeking — never expands past the gate. */}\n <g className={phase === \"seeking\" ? \"sekyro-capture-breathe\" : undefined}>\n <circle\n cx={CX}\n cy={CY_GUIDE}\n r={GUIDE_R}\n fill=\"none\"\n stroke={complete ? \"var(--sekyro-color-success)\" : \"var(--sekyro-color-surface)\"}\n strokeWidth={complete ? 3.5 : 2.5}\n className={\n spinning\n ? // Recording + checking spinner: dashed success circle, the\n // dashes crawl one lap ≈ 2s. Reduced motion → static solid circle.\n \"sekyro-arc__guide sekyro-arc__guide--spin sekyro-capture-ring-spin\"\n : \"sekyro-arc__guide sekyro-capture-fade-in\"\n }\n data-testid=\"sekyro-capture-guide\"\n />\n </g>\n </g>\n </svg>\n );\n}\n","// Locale + overrides → a `t(key)` lookup, provided by LivenessCapture to the\n// ported sub-components (replaces next-intl's useTranslations()).\nimport { createContext, useContext } from \"react\";\nimport { ar, en, fr, type SekyroLocale, type StringKey, type Strings } from \"./strings/index\";\n\nconst BUILT_IN: Record<SekyroLocale, Strings> = { ar, fr, en };\n\n/** The complete dictionary for `locale` with `overrides` merged on top. */\nexport function resolveStrings(locale: SekyroLocale, overrides?: Partial<Strings>): Strings {\n const base = BUILT_IN[locale];\n if (overrides === undefined) return base;\n const merged: Strings = { ...base };\n for (const key of Object.keys(overrides) as StringKey[]) {\n const value = overrides[key];\n if (typeof value === \"string\") merged[key] = value;\n }\n return merged;\n}\n\nexport type Translate = (key: StringKey) => string;\n\nconst StringsContext = createContext<Translate>((key) => en[key] ?? \"\");\n\nexport const StringsProvider = StringsContext.Provider;\n\nexport function useStrings(): Translate {\n return useContext(StringsContext);\n}\n","// Built-in English copy — the hosted keys the capture surface uses, copied\n// verbatim from identity-hosted/messages/en.json (the source of truth for the\n// wording; partners override per key via the `strings` prop).\n\n/**\n * Every string the component renders, keyed like the hosted message catalog\n * (`capture.*`, `fcv2.err.*`, `fcv3.*`, `reasons.*`, `errors.*`, `common.*`).\n * The built-in ar/fr/en dictionaries are complete; `strings` overrides are\n * `Partial<Strings>`.\n */\nexport interface Strings {\n \"capture.start\": string;\n \"capture.recordAgain\": string;\n \"capture.switchCamera\": string;\n \"capture.preparing.title\": string;\n \"capture.checking\": string;\n \"capture.checkingHint\": string;\n \"capture.securityNote\": string;\n \"capture.cameraOff\": string;\n \"capture.previewAlt\": string;\n \"capture.retryCoaching.title\": string;\n \"capture.retryCoaching.light\": string;\n \"capture.retryCoaching.eyeLevel\": string;\n \"capture.retryCoaching.head\": string;\n /**\n * Remaining-attempts line per CLDR plural category (`Intl.PluralRules`),\n * `{count}` = the locale-formatted number. `one`/`other` are required; the\n * other categories fall back to `other` where the locale never selects them.\n */\n \"capture.attemptsRemaining.one\": string;\n \"capture.attemptsRemaining.other\": string;\n \"capture.attemptsRemaining.zero\"?: string;\n \"capture.attemptsRemaining.two\"?: string;\n \"capture.attemptsRemaining.few\"?: string;\n \"capture.attemptsRemaining.many\"?: string;\n \"common.retry\": string;\n \"fcv2.err.permission\": string;\n \"fcv2.err.notfound\": string;\n \"fcv2.err.inuse\": string;\n \"fcv2.err.insecure\": string;\n \"fcv2.err.unsupported\": string;\n \"fcv2.err.generic\": string;\n \"fcv3.no_face\": string;\n \"fcv3.come_closer\": string;\n \"fcv3.move_back\": string;\n \"fcv3.center_face\": string;\n \"fcv3.straighten\": string;\n \"fcv3.more_light\": string;\n \"fcv3.too_bright\": string;\n \"fcv3.hold_still\": string;\n \"fcv3.steady_camera\": string;\n \"reasons.no_face\": string;\n \"reasons.media_unreadable\": string;\n \"reasons.clip_too_short\": string;\n \"reasons.spoof_detected\": string;\n \"reasons.review_band\": string;\n \"reasons.nni_not_found\": string;\n \"reasons.nni_invalid\": string;\n \"reasons.registry_unavailable\": string;\n \"reasons.result_from_cache\": string;\n \"reasons.no_face_source\": string;\n \"reasons.no_face_reference\": string;\n \"reasons.low_quality_reference\": string;\n \"reasons.below_threshold\": string;\n \"reasons.side_missing\": string;\n \"reasons.mrz_checksum_failed\": string;\n \"reasons.unreadable\": string;\n \"reasons.expired_document\": string;\n \"reasons.authenticity_review\": string;\n \"reasons.registry_mismatch\": string;\n \"reasons.otp_mismatch\": string;\n \"reasons.otp_expired\": string;\n \"reasons.otp_send_failed\": string;\n \"reasons.uncalibrated_capture_channel\": string;\n \"errors.attestation_invalid\": string;\n \"errors.network_error\": string;\n \"errors.session_expired\": string;\n \"errors.nni_unbound\": string;\n // pre-capture screen + voice (2026-10-18)\n \"capture.tips.title\": string;\n \"capture.tips.light\": string;\n \"capture.tips.uncover\": string;\n \"capture.tips.eyeLevel\": string;\n \"capture.tips.straight\": string;\n \"capture.permission.granted\": string;\n \"capture.permission.prompt\": string;\n \"capture.permission.denied\": string;\n \"capture.permission.unknown\": string;\n \"capture.cameraLabel\": string;\n \"capture.facing.user\": string;\n \"capture.facing.environment\": string;\n \"capture.voiceGuidance\": string;\n \"capture.preparing.hint\": string;\n \"capture.ready\": string;\n \"fcv2.err.models\": string;\n}\n\n/** Every string key the component renders. */\nexport type StringKey = keyof Strings;\n\nexport const en: Strings = {\n \"capture.start\": \"Start camera\",\n \"capture.recordAgain\": \"Start a new attempt\",\n \"capture.switchCamera\": \"Switch camera\",\n \"capture.preparing.title\": \"Preparing secure capture…\",\n \"capture.checking\": \"We're checking your identity…\",\n \"capture.checkingHint\": \"This usually takes a few seconds — keep this page open\",\n \"capture.securityNote\": \"Your images are encrypted and used only for this verification\",\n \"capture.cameraOff\": \"Camera off\",\n \"capture.previewAlt\": \"Preview of the captured image of your face\",\n \"capture.retryCoaching.title\": \"That attempt didn't work — a few adjustments will help:\",\n \"capture.retryCoaching.light\": \"Find good lighting — light on your face, not behind you\",\n \"capture.retryCoaching.eyeLevel\": \"Hold your phone at eye level\",\n \"capture.retryCoaching.head\": \"Look straight at the camera and keep your head upright\",\n \"capture.attemptsRemaining.one\": \"{count} attempt remaining\",\n \"capture.attemptsRemaining.other\": \"{count} attempts remaining\",\n \"common.retry\": \"Try again\",\n \"fcv2.err.permission\":\n \"Allow camera access in your browser settings (the camera icon in the address bar), then try again\",\n \"fcv2.err.notfound\": \"No camera detected — connect or enable a camera, then try again\",\n \"fcv2.err.inuse\": \"Another app is using the camera — close it, then try again\",\n \"fcv2.err.insecure\": \"The camera needs a secure connection (HTTPS) — reopen this page over HTTPS\",\n \"fcv2.err.unsupported\":\n \"Your browser cannot capture in a supported format — open this page in a recent browser such as Chrome or Safari\",\n \"fcv2.err.generic\": \"The camera is unavailable — try again, or contact support if it keeps failing\",\n \"fcv3.no_face\": \"We can't see your face — hold the phone in front of you\",\n \"fcv3.come_closer\": \"Bring the phone a little closer\",\n \"fcv3.move_back\": \"Move the phone a little farther away\",\n \"fcv3.center_face\": \"Center your face in the circle\",\n \"fcv3.straighten\": \"Hold your head straight\",\n \"fcv3.more_light\": \"Find a brighter spot — light your face\",\n \"fcv3.too_bright\": \"Too much light — turn away from the light source\",\n \"fcv3.hold_still\": \"Perfect — hold still\",\n \"fcv3.steady_camera\": \"Hold the phone steady\",\n \"reasons.no_face\": \"No face could be detected during the check\",\n \"reasons.media_unreadable\": \"The submitted capture could not be read\",\n \"reasons.clip_too_short\": \"The capture was too short\",\n \"reasons.spoof_detected\": \"The liveness check could not confirm a live person in front of the camera\",\n \"reasons.review_band\": \"The automatic check was not conclusive, so it was sent to human review\",\n \"reasons.nni_not_found\": \"The national identification number was not found in the civil registry\",\n \"reasons.nni_invalid\": \"The national identification number is not a valid 10-digit NNI\",\n \"reasons.registry_unavailable\": \"The civil registry could not be reached to confirm the NNI\",\n \"reasons.result_from_cache\": \"The registry check was confirmed from a recent copy of the registry\",\n \"reasons.no_face_source\": \"No face could be detected in the selfie photo\",\n \"reasons.no_face_reference\":\n \"No reference photo was available to compare your selfie against — the requester needs to resolve this, so retaking your selfie will not help\",\n \"reasons.low_quality_reference\": \"The reference photo on file was not clear enough to compare against\",\n \"reasons.below_threshold\": \"The selfie did not match the photo on the identity document closely enough\",\n \"reasons.side_missing\": \"One side of the identity document was not submitted\",\n \"reasons.mrz_checksum_failed\": \"The machine-readable zone of the document could not be validated\",\n \"reasons.unreadable\": \"The document photo was not clear enough to read\",\n \"reasons.expired_document\": \"The identity document has expired\",\n \"reasons.authenticity_review\": \"The document was sent to human review to confirm its authenticity\",\n \"reasons.registry_mismatch\": \"The document's details did not match the civil registry — a reviewer will check\",\n \"reasons.otp_mismatch\": \"The verification code did not match the one we sent\",\n \"reasons.otp_expired\": \"The verification code expired before it was entered\",\n \"reasons.otp_send_failed\": \"We could not send a verification code to your phone\",\n \"reasons.uncalibrated_capture_channel\":\n \"Desktop/webcam captures are not yet auto-decided — your verification went to human review\",\n \"errors.attestation_invalid\":\n \"We could not confirm this browser session is genuine — reload the page and try again\",\n \"errors.network_error\":\n \"We could not reach the verification service — check your internet connection and try again\",\n \"errors.session_expired\":\n \"This verification session has expired — ask the organisation that sent you here for a new link\",\n \"errors.nni_unbound\":\n \"This link was created without your national ID number — ask the requester for a new link\",\n // pre-capture screen + voice (2026-10-18)\n \"capture.tips.title\": \"For a successful check:\",\n \"capture.tips.light\": \"Face a light source — avoid strong light behind you\",\n \"capture.tips.uncover\": \"Uncover your face — no glasses, mask or hand in front of it\",\n \"capture.tips.eyeLevel\": \"Hold your phone at eye level\",\n \"capture.tips.straight\": \"Look straight at the camera and keep still\",\n \"capture.permission.granted\": \"Camera access allowed\",\n \"capture.permission.prompt\": \"Your browser will ask to use the camera — choose Allow\",\n \"capture.permission.denied\":\n \"Camera access is blocked — allow it in your browser settings (the camera icon in the address bar), then reload this page\",\n \"capture.permission.unknown\": \"We'll ask to use your camera when you start\",\n \"capture.cameraLabel\": \"Camera\",\n \"capture.facing.user\": \"Front camera\",\n \"capture.facing.environment\": \"Back camera\",\n \"capture.voiceGuidance\": \"Voice guidance\",\n \"capture.preparing.hint\":\n \"Setting up on-device face detection — this can take a moment on a slow connection\",\n \"capture.ready\": \"Ready — start when you are\",\n \"fcv2.err.models\": \"The face-detection models could not be loaded — check your connection and try again\",\n};\n","// Built-in Arabic copy — copied verbatim from identity-hosted/messages/ar.json.\nimport type { Strings } from \"./en\";\n\nexport const ar: Strings = {\n \"capture.start\": \"تشغيل الكاميرا\",\n \"capture.recordAgain\": \"ابدأ محاولة جديدة\",\n \"capture.switchCamera\": \"تبديل الكاميرا\",\n \"capture.preparing.title\": \"جارٍ تجهيز الالتقاط الآمن…\",\n \"capture.checking\": \"نتحقق من هويتك…\",\n \"capture.checkingHint\": \"يستغرق هذا عادةً بضع ثوانٍ — أبقِ هذه الصفحة مفتوحة\",\n \"capture.securityNote\": \"تُشفَّر لقطاتك وتُستخدم فقط لهذا التحقق\",\n \"capture.cameraOff\": \"الكاميرا مطفأة\",\n \"capture.previewAlt\": \"معاينة الصورة الملتقطة لوجهك\",\n \"capture.retryCoaching.title\": \"لم تنجح هذه المحاولة — بعض التعديلات ستساعد:\",\n \"capture.retryCoaching.light\": \"اختر مكانًا جيد الإضاءة — الضوء على وجهك لا خلفك\",\n \"capture.retryCoaching.eyeLevel\": \"أمسك هاتفك بمستوى العينين\",\n \"capture.retryCoaching.head\": \"انظر مباشرة إلى الكاميرا وأبقِ رأسك مستقيمًا\",\n \"capture.attemptsRemaining.zero\": \"لم تتبقَّ أي محاولة\",\n \"capture.attemptsRemaining.one\": \"تبقّت محاولة واحدة\",\n \"capture.attemptsRemaining.two\": \"تبقّت محاولتان\",\n \"capture.attemptsRemaining.few\": \"تبقّت {count} محاولات\",\n \"capture.attemptsRemaining.many\": \"تبقّت {count} محاولة\",\n \"capture.attemptsRemaining.other\": \"تبقّت {count} محاولة\",\n \"common.retry\": \"أعد المحاولة\",\n \"fcv2.err.permission\":\n \"اسمح بالوصول إلى الكاميرا من إعدادات المتصفح (أيقونة الكاميرا في شريط العنوان) ثم أعد المحاولة\",\n \"fcv2.err.notfound\": \"لم يتم العثور على كاميرا — وصِّل كاميرا أو فعِّلها ثم أعد المحاولة\",\n \"fcv2.err.inuse\": \"تطبيق آخر يستخدم الكاميرا — أغلقه ثم أعد المحاولة\",\n \"fcv2.err.insecure\": \"تتطلب الكاميرا اتصالًا آمنًا (HTTPS) — افتح هذه الصفحة عبر HTTPS\",\n \"fcv2.err.unsupported\":\n \"متصفحك لا يستطيع الالتقاط بصيغة مدعومة — افتح هذه الصفحة في متصفح حديث مثل كروم أو سفاري\",\n \"fcv2.err.generic\": \"الكاميرا غير متاحة — أعد المحاولة، وتواصل مع الدعم إذا استمرت المشكلة\",\n \"fcv3.no_face\": \"لا نرى وجهك — أمسك الهاتف أمامك\",\n \"fcv3.come_closer\": \"قرّب الهاتف قليلًا\",\n \"fcv3.move_back\": \"أبعد الهاتف قليلًا\",\n \"fcv3.center_face\": \"ضع وجهك في منتصف الدائرة\",\n \"fcv3.straighten\": \"أبقِ رأسك مستقيمًا\",\n \"fcv3.more_light\": \"انتقل إلى مكان أكثر إضاءة — أضئ وجهك\",\n \"fcv3.too_bright\": \"الإضاءة قوية جدًا — ابتعد عن مصدر الضوء\",\n \"fcv3.hold_still\": \"ممتاز — لا تتحرك\",\n \"fcv3.steady_camera\": \"أمسك الهاتف بثبات\",\n \"reasons.no_face\": \"تعذّر اكتشاف أي وجه أثناء التحقق\",\n \"reasons.media_unreadable\": \"تعذّرت قراءة اللقطة المُرسلة\",\n \"reasons.clip_too_short\": \"كانت اللقطة أقصر من اللازم\",\n \"reasons.spoof_detected\": \"لم يتمكن فحص الحضور الحي من تأكيد وجود شخص حقيقي أمام الكاميرا\",\n \"reasons.review_band\": \"لم يكن الفحص التلقائي حاسمًا، لذا أُحيل إلى مراجعة بشرية\",\n \"reasons.nni_not_found\": \"لم يُعثر على الرقم الوطني في سجل الحالة المدنية\",\n \"reasons.nni_invalid\": \"الرقم الوطني ليس رقمًا صالحًا مكوّنًا من 10 أرقام\",\n \"reasons.registry_unavailable\": \"تعذّر الوصول إلى سجل الحالة المدنية لتأكيد الرقم الوطني\",\n \"reasons.result_from_cache\": \"أُكِّد فحص السجل استنادًا إلى نسخة حديثة من السجل\",\n \"reasons.no_face_source\": \"تعذّر اكتشاف وجه في الصورة الذاتية\",\n \"reasons.no_face_reference\":\n \"لم تتوفّر صورة مرجعية لمقارنة صورتك الذاتية بها — على الجهة الطالبة معالجة ذلك، وإعادة التقاط صورتك الذاتية لن تُجدي\",\n \"reasons.low_quality_reference\": \"الصورة المرجعية المحفوظة لم تكن واضحة بما يكفي للمقارنة\",\n \"reasons.below_threshold\": \"الصورة الذاتية لم تطابق صورة وثيقة الهوية بدرجة كافية\",\n \"reasons.side_missing\": \"أحد وجهي وثيقة الهوية لم يُرسل\",\n \"reasons.mrz_checksum_failed\": \"تعذّر التحقق من منطقة القراءة الآلية في الوثيقة\",\n \"reasons.unreadable\": \"صورة الوثيقة لم تكن واضحة بما يكفي للقراءة\",\n \"reasons.expired_document\": \"انتهت صلاحية وثيقة الهوية\",\n \"reasons.authenticity_review\": \"أُحيلت الوثيقة إلى مراجعة بشرية للتأكد من صحتها\",\n \"reasons.registry_mismatch\": \"بيانات الوثيقة لا تطابق السجل المدني — سيتحقق منها مراجع\",\n \"reasons.otp_mismatch\": \"رمز التحقّق لا يطابق الرمز الذي أرسلناه\",\n \"reasons.otp_expired\": \"انتهت صلاحية رمز التحقّق قبل إدخاله\",\n \"reasons.otp_send_failed\": \"تعذّر إرسال رمز التحقّق إلى هاتفك\",\n \"reasons.uncalibrated_capture_channel\":\n \"جودة الكاميرا المكتبية غير معايَرة بعد — أُحيل تحققك إلى مراجعة بشرية\",\n \"errors.attestation_invalid\": \"تعذّر التأكد من سلامة جلسة المتصفح — أعد تحميل الصفحة وحاول مجددًا\",\n \"errors.network_error\": \"تعذّر الوصول إلى خدمة التحقق — تحقق من اتصالك بالإنترنت وأعد المحاولة\",\n \"errors.session_expired\": \"انتهت صلاحية جلسة التحقق هذه — اطلب رابطًا جديدًا من الجهة التي أرسلتك إلى هنا\",\n \"errors.nni_unbound\": \"أُنشئ هذا الرابط دون رقمك الوطني للتعريف — اطلب رابطًا جديدًا من الجهة الطالبة\",\n // pre-capture screen + voice (2026-10-18)\n \"capture.tips.title\": \"لتحقق ناجح:\",\n \"capture.tips.light\": \"اجعل الضوء أمام وجهك — تجنّب الإضاءة القوية خلفك\",\n \"capture.tips.uncover\": \"اكشف وجهك — بلا نظارات أو كمامة أو يد أمامه\",\n \"capture.tips.eyeLevel\": \"أمسك هاتفك بمستوى العينين\",\n \"capture.tips.straight\": \"انظر مباشرة إلى الكاميرا وابقَ ثابتًا\",\n \"capture.permission.granted\": \"تم السماح بالوصول إلى الكاميرا\",\n \"capture.permission.prompt\": \"سيطلب متصفحك استخدام الكاميرا — اختر «السماح»\",\n \"capture.permission.denied\":\n \"الوصول إلى الكاميرا محظور — اسمح به من إعدادات المتصفح (رمز الكاميرا في شريط العنوان)، ثم أعد تحميل الصفحة\",\n \"capture.permission.unknown\": \"سنطلب استخدام الكاميرا عند البدء\",\n \"capture.cameraLabel\": \"الكاميرا\",\n \"capture.facing.user\": \"الكاميرا الأمامية\",\n \"capture.facing.environment\": \"الكاميرا الخلفية\",\n \"capture.voiceGuidance\": \"الإرشاد الصوتي\",\n \"capture.preparing.hint\": \"يجري إعداد كشف الوجه على جهازك — قد يستغرق ذلك لحظة على اتصال بطيء\",\n \"capture.ready\": \"جاهز — ابدأ عندما تكون مستعدًا\",\n \"fcv2.err.models\": \"تعذّر تحميل نماذج التعرف على الوجه — تحقق من اتصالك ثم أعد المحاولة\",\n};\n","// Built-in French copy — copied verbatim from identity-hosted/messages/fr.json.\nimport type { Strings } from \"./en\";\n\nexport const fr: Strings = {\n \"capture.start\": \"Démarrer la caméra\",\n \"capture.recordAgain\": \"Commencer une nouvelle tentative\",\n \"capture.switchCamera\": \"Changer de caméra\",\n \"capture.preparing.title\": \"Préparation de la capture sécurisée…\",\n \"capture.checking\": \"Nous vérifions votre identité…\",\n \"capture.checkingHint\": \"Cela prend généralement quelques secondes — gardez cette page ouverte\",\n \"capture.securityNote\":\n \"Vos images sont chiffrées et utilisées uniquement pour cette vérification\",\n \"capture.cameraOff\": \"Caméra éteinte\",\n \"capture.previewAlt\": \"Aperçu de l’image capturée de votre visage\",\n \"capture.retryCoaching.title\":\n \"Cette tentative n'a pas abouti — quelques ajustements vous aideront :\",\n \"capture.retryCoaching.light\":\n \"Placez-vous dans un endroit bien éclairé — lumière sur le visage, pas derrière vous\",\n \"capture.retryCoaching.eyeLevel\": \"Tenez votre téléphone à hauteur des yeux\",\n \"capture.retryCoaching.head\": \"Regardez droit vers la caméra, la tête bien droite\",\n \"capture.attemptsRemaining.one\": \"{count} tentative restante\",\n \"capture.attemptsRemaining.other\": \"{count} tentatives restantes\",\n \"common.retry\": \"Réessayer\",\n \"fcv2.err.permission\":\n \"Autorisez la caméra dans les réglages du navigateur (icône caméra dans la barre d’adresse), puis réessayez\",\n \"fcv2.err.notfound\": \"Aucune caméra détectée — branchez ou activez une caméra, puis réessayez\",\n \"fcv2.err.inuse\": \"La caméra est utilisée par une autre application — fermez-la, puis réessayez\",\n \"fcv2.err.insecure\":\n \"La caméra nécessite une connexion sécurisée (HTTPS) — rouvrez cette page en HTTPS\",\n \"fcv2.err.unsupported\":\n \"Votre navigateur ne prend pas en charge un format de capture compatible — ouvrez cette page dans un navigateur récent comme Chrome ou Safari\",\n \"fcv2.err.generic\":\n \"Caméra indisponible — réessayez, ou contactez le support si le problème persiste\",\n \"fcv3.no_face\": \"Nous ne voyons pas votre visage — tenez le téléphone devant vous\",\n \"fcv3.come_closer\": \"Rapprochez un peu le téléphone\",\n \"fcv3.move_back\": \"Éloignez un peu le téléphone\",\n \"fcv3.center_face\": \"Centrez votre visage dans le cercle\",\n \"fcv3.straighten\": \"Tenez la tête droite\",\n \"fcv3.more_light\": \"Cherchez un endroit plus lumineux — éclairez votre visage\",\n \"fcv3.too_bright\": \"Trop de lumière — tournez-vous dos à la source de lumière\",\n \"fcv3.hold_still\": \"Parfait — ne bougez plus\",\n \"fcv3.steady_camera\": \"Tenez le téléphone stable\",\n \"reasons.no_face\": \"Aucun visage n’a pu être détecté pendant la vérification\",\n \"reasons.media_unreadable\": \"La capture envoyée n’a pas pu être lue\",\n \"reasons.clip_too_short\": \"La capture était trop courte\",\n \"reasons.spoof_detected\":\n \"Le contrôle de présence n'a pas pu confirmer la présence d'une personne réelle devant la caméra\",\n \"reasons.review_band\":\n \"Le contrôle automatique n'a pas été concluant, il a donc été transmis à un examen humain\",\n \"reasons.nni_not_found\":\n \"Le numéro national d'identification n'a pas été trouvé dans le registre d'état civil\",\n \"reasons.nni_invalid\": \"Le numéro national d'identification n'est pas un NNI valide à 10 chiffres\",\n \"reasons.registry_unavailable\":\n \"Le registre d'état civil n'a pas pu être joint pour confirmer le NNI\",\n \"reasons.result_from_cache\":\n \"Le contrôle du registre a été confirmé à partir d'une copie récente du registre\",\n \"reasons.no_face_source\": \"Aucun visage n'a pu être détecté sur la photo selfie\",\n \"reasons.no_face_reference\":\n \"Aucune photo de référence n'était disponible pour comparer votre selfie — c'est au demandeur de le résoudre, reprendre votre selfie n'y changera rien\",\n \"reasons.low_quality_reference\":\n \"La photo de référence enregistrée n'était pas assez nette pour la comparaison\",\n \"reasons.below_threshold\":\n \"Le selfie ne correspondait pas suffisamment à la photo de la pièce d'identité\",\n \"reasons.side_missing\": \"Un côté de la pièce d'identité n'a pas été envoyé\",\n \"reasons.mrz_checksum_failed\":\n \"La zone de lecture automatique du document n'a pas pu être validée\",\n \"reasons.unreadable\": \"La photo du document n'était pas assez nette pour être lue\",\n \"reasons.expired_document\": \"La pièce d'identité a expiré\",\n \"reasons.authenticity_review\":\n \"Le document a été transmis à un examen humain pour confirmer son authenticité\",\n \"reasons.registry_mismatch\":\n \"Les informations du document ne correspondent pas au registre civil — un examinateur va vérifier\",\n \"reasons.otp_mismatch\": \"Le code de vérification ne correspond pas à celui que nous avons envoyé\",\n \"reasons.otp_expired\": \"Le code de vérification a expiré avant d'être saisi\",\n \"reasons.otp_send_failed\": \"Nous n'avons pas pu envoyer de code de vérification à votre téléphone\",\n \"reasons.uncalibrated_capture_channel\":\n \"Les captures webcam ne sont pas encore décidées automatiquement — votre vérification part en revue humaine\",\n \"errors.attestation_invalid\":\n \"Nous n'avons pas pu confirmer l'authenticité de cette session de navigateur — rechargez la page et réessayez\",\n \"errors.network_error\":\n \"Nous n'avons pas pu joindre le service de vérification — vérifiez votre connexion internet et réessayez\",\n \"errors.session_expired\":\n \"Cette session de vérification a expiré — demandez un nouveau lien à l'organisme qui vous a envoyé ici\",\n \"errors.nni_unbound\":\n \"Ce lien a été créé sans votre numéro national d'identification — demandez un nouveau lien à l'organisme demandeur\",\n // pre-capture screen + voice (2026-10-18)\n \"capture.tips.title\": \"Pour une vérification réussie :\",\n \"capture.tips.light\": \"Placez-vous face à la lumière — évitez une forte lumière derrière vous\",\n \"capture.tips.uncover\": \"Dégagez votre visage — ni lunettes, ni masque, ni main devant\",\n \"capture.tips.eyeLevel\": \"Tenez votre téléphone à hauteur des yeux\",\n \"capture.tips.straight\": \"Regardez droit vers la caméra et restez immobile\",\n \"capture.permission.granted\": \"Accès à la caméra autorisé\",\n \"capture.permission.prompt\": \"Votre navigateur va demander l’accès à la caméra — choisissez « Autoriser »\",\n \"capture.permission.denied\":\n \"L’accès à la caméra est bloqué — autorisez-le dans les réglages du navigateur (icône caméra dans la barre d’adresse), puis rechargez la page\",\n \"capture.permission.unknown\": \"Nous demanderons l’accès à la caméra au démarrage\",\n \"capture.cameraLabel\": \"Caméra\",\n \"capture.facing.user\": \"Caméra avant\",\n \"capture.facing.environment\": \"Caméra arrière\",\n \"capture.voiceGuidance\": \"Guidage vocal\",\n \"capture.preparing.hint\":\n \"Mise en place de la détection du visage sur l’appareil — cela peut prendre un instant sur une connexion lente\",\n \"capture.ready\": \"Prêt — commencez quand vous voulez\",\n \"fcv2.err.models\":\n \"Impossible de charger les modèles de détection du visage — vérifiez votre connexion puis réessayez\",\n};\n","// Built-in copy + the hint-code → string-key mapping. Keys are the hosted\n// message keys the capture surface uses (`capture.*`, `fcv2.err.*`, `fcv3.*`,\n// `reasons.*`, `errors.*`, `common.retry`) so Sekyro's hosted page can hand its\n// own next-intl catalog straight in through `strings`.\nimport type { CaptureErrorKind, GateHint, ReasonCode } from \"@sekyro/web\";\nimport { en, type StringKey, type Strings } from \"./en\";\n\n/** Locales with a built-in dictionary. */\nexport type SekyroLocale = \"ar\" | \"fr\" | \"en\";\n\nexport { en, type StringKey, type Strings };\nexport { ar } from \"./ar\";\nexport { fr } from \"./fr\";\n\n/** Gate hint code → the guidance line's string key. */\nexport function hintStringKey(hint: GateHint): StringKey {\n switch (hint) {\n case \"center\":\n return \"fcv3.center_face\";\n case \"closer\":\n return \"fcv3.come_closer\";\n case \"farther\":\n return \"fcv3.move_back\";\n case \"light\":\n return \"fcv3.more_light\";\n case \"still\":\n case \"hold\":\n return \"fcv3.hold_still\";\n default: {\n const unhandled: never = hint;\n throw new Error(`hintStringKey: unhandled hint ${unhandled as string}`);\n }\n }\n}\n\n/** Camera / engine failure kind → its copy key. */\nexport function captureErrorStringKey(kind: CaptureErrorKind): StringKey {\n return `fcv2.err.${kind}`;\n}\n\n/**\n * Result reason → copy key. SDK-side failure reasons map onto the existing\n * error copy (`no_recorder` is the browser's missing recorder = unsupported;\n * `attestation` / `network` reuse the hosted error copy); backend reasons use\n * `reasons.*`. Returns `null` for a reason without built-in copy.\n */\nexport function reasonStringKey(reason: ReasonCode): StringKey | null {\n switch (reason) {\n case \"no_recorder\":\n return \"fcv2.err.unsupported\";\n case \"attestation\":\n return \"errors.attestation_invalid\";\n case \"network\":\n return \"errors.network_error\";\n case \"nni_unbound\":\n return \"errors.nni_unbound\";\n default: {\n const key = `reasons.${reason}`;\n return Object.hasOwn(en, key) ? (key as StringKey) : null;\n }\n }\n}\n\n/**\n * The remaining-attempts line for `count`, pluralized with the locale's CLDR\n * rules (`Intl.PluralRules`) and the locale's digits (`Intl.NumberFormat`) —\n * the same rendering an ICU `{count, plural, …}` message produces.\n */\nexport function attemptsRemainingText(dictionary: Strings, locale: SekyroLocale, count: number): string {\n const category = new Intl.PluralRules(locale).select(count);\n const template =\n (category === \"other\" ? undefined : dictionary[`capture.attemptsRemaining.${category}`]) ??\n dictionary[\"capture.attemptsRemaining.other\"];\n return template.replace(\"{count}\", new Intl.NumberFormat(locale).format(count));\n}\n","// Capture stage — ported from identity-hosted/components/capture-stage.tsx\n// (Capture Stage v2): mirrored <video> + circular guide/scrim/tick ring + ONE\n// guidance line + in-stage icon controls + the captured still with the\n// \"checking\" state. Everything the user needs during the act lives INSIDE this\n// 3:4 box, so the whole stage fits one phone viewport.\n//\n// A11y capture contract:\n// - ONE always-mounted aria-live=\"polite\" region is the sole announcement\n// channel: hint copy during capture, capture.checking once the still is up.\n// - overlay text + icon chips sit on the fg scrim in the surface color;\n// - non-color status: stroke width + dashes + text carry every phase change.\n//\n// iOS engine contract: the <video> carries playsInline + muted — the engine\n// attaches the stream and calls play() itself. The element is NEVER unmounted\n// or display:none'd while captured — the still overlays it opaquely. In clip\n// mode the still lands at `frozen` (recording just ended; the tracks are still\n// finalizing the clip, hence NO camera-off pill yet) and stays through\n// `checking` (tracks stopped → the pill appears). The mirror transform is\n// direction-independent (RTL-safe); the still is NOT flipped (the keyframe is\n// pre-mirrored by the engine).\nimport type { GateHint } from \"@sekyro/web\";\nimport type { ReactNode, RefObject } from \"react\";\nimport { Button } from \"./button\";\nimport { CaptureArc, type CapturePhase } from \"./capture-arc\";\nimport type { StringKey } from \"./strings/index\";\nimport { useStrings } from \"./use-strings\";\n\nexport function CaptureStage({\n videoRef,\n guidanceText,\n guidanceHint,\n guidanceKey,\n progress,\n phase,\n draining = false,\n stillUrl,\n showChecking,\n onSwitchCamera,\n canSwitchCamera,\n voicePrompt,\n overlay,\n reduceMotion = false,\n}: {\n videoRef: RefObject<HTMLVideoElement | null>;\n /** Already-translated guidance line. */\n guidanceText: string;\n /** The hint code behind `guidanceText` (handed to the voice slot). */\n guidanceHint: GateHint | null;\n /** The string key behind `guidanceText` (the voice slot's clip selector). */\n guidanceKey: StringKey | null;\n /** Gate integrator 0..1 — chrome only, never gate input. */\n progress: number;\n phase: CapturePhase;\n draining?: boolean;\n /** The captured keyframe (frozen preview or object URL) — shown inside the stage from `frozen` on. */\n stillUrl: string | null;\n /** Verification mode: the umbrella \"checking\" copy + camera-off pill. */\n showChecking: boolean;\n onSwitchCamera: () => void;\n canSwitchCamera: boolean;\n /** Partner slot rendered in the start corner (audio / TTS controls). */\n voicePrompt?: ((hint: GateHint | null, text: string, key: StringKey | null) => ReactNode) | undefined;\n /** Partner slot rendered inside the stage box above the ring (overlays). */\n overlay?: ((videoRef: RefObject<HTMLVideoElement | null>) => ReactNode) | undefined;\n /** Force the reduced-motion variants (host hint) — prefers-reduced-motion is honoured by CSS regardless. */\n reduceMotion?: boolean;\n}) {\n const t = useStrings();\n const checking = phase === \"checking\";\n const frozen = phase === \"frozen\";\n // `settled` = recording is over and the still is on screen (frozen: clip\n // still finalizing; checking: blob landed, uploading). The still freezes the\n // stage the instant recording ends — no live feed left running while the\n // clip flushes. `checking` alone gates the camera-off pill: at `frozen` the\n // tracks are NOT stopped yet, so claiming \"camera off\" would be a trust bug.\n const settled = checking || frozen;\n // One umbrella line covers finish + upload + attestation + submit + verdict\n // wait — no \"uploading\"/\"sending\" leakage.\n const displayText = settled && showChecking ? t(\"capture.checking\") : guidanceText;\n const voice = voicePrompt?.(guidanceHint, displayText, guidanceKey);\n\n return (\n <div\n className={reduceMotion ? \"sekyro-stage sekyro-capture-reduce\" : \"sekyro-stage\"}\n data-testid=\"sekyro-capture-stage\"\n >\n {/* Live camera preview — no caption track exists; guidance is announced\n via the aria-live region below. Kept mounted through captured. */}\n <video ref={videoRef} playsInline muted className=\"sekyro-stage__video\" data-testid=\"sekyro-capture-video\" />\n {stillUrl !== null && settled ? (\n // \"Photo develops\": fade + settle-scale while the scrim deepens — NOT\n // flipped (the keyframe is pre-mirrored).\n <img\n src={stillUrl}\n alt={t(\"capture.previewAlt\")}\n className=\"sekyro-stage__still sekyro-capture-develop\"\n data-testid=\"sekyro-capture-still\"\n />\n ) : null}\n <CaptureArc progress={progress} phase={phase} draining={draining} />\n {overlay?.(videoRef)}\n\n {/* Controls: DOM order after the video/still, before and OUTSIDE the live\n region (label churn is never re-announced). Start corner = voice slot,\n end corner = flip camera; both hide once the still is up. */}\n {voice !== undefined && voice !== null && !settled ? (\n <div className=\"sekyro-stage__corner-start\" data-testid=\"sekyro-voice-slot\">\n {voice}\n </div>\n ) : null}\n {canSwitchCamera ? (\n <Button\n kind=\"chip\"\n onClick={onSwitchCamera}\n aria-label={t(\"capture.switchCamera\")}\n className=\"sekyro-stage__corner-end\"\n data-testid=\"sekyro-switch-camera\"\n >\n <FlipCameraIcon />\n </Button>\n ) : null}\n {checking && showChecking ? (\n /* Camera-off trust pill — where the flip control was. Truthful: the\n engine stopped the tracks the moment the artifacts landed. */\n <span\n className=\"sekyro-stage__corner-end sekyro-stage__pill sekyro-capture-pill-in\"\n data-testid=\"sekyro-camera-off-pill\"\n >\n <CameraOffIcon />\n {t(\"capture.cameraOff\")}\n </span>\n ) : null}\n\n {/* Always-mounted polite live region — the SOLE announcement channel\n (stable element identity; the inner span crossfades on text change). */}\n <p aria-live=\"polite\" className=\"sekyro-stage__guidance\" data-testid=\"sekyro-capture-guidance\">\n <span key={displayText} className=\"sekyro-stage__guidance-text sekyro-capture-text-in\">\n {displayText}\n </span>\n {settled && showChecking ? (\n <span className=\"sekyro-stage__guidance-hint\">{t(\"capture.checkingHint\")}</span>\n ) : null}\n </p>\n </div>\n );\n}\n\n/** Camera outline + two chasing arrows — the universal flip glyph. */\nfunction FlipCameraIcon() {\n return (\n <svg\n aria-hidden=\"true\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.8\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className=\"sekyro-icon\"\n >\n <path d=\"M4 7.5h2.2l1.4-1.9h8.8l1.4 1.9H20a1.6 1.6 0 0 1 1.6 1.6v8.3A1.6 1.6 0 0 1 20 19H4a1.6 1.6 0 0 1-1.6-1.6V9.1A1.6 1.6 0 0 1 4 7.5Z\" />\n <path d=\"M15.4 11.9a3.5 3.5 0 0 0-6.1-1.4M15.4 11.9h-2.1m2.1 0V9.8\" />\n <path d=\"M8.6 13.4a3.5 3.5 0 0 0 6.1 1.4M8.6 13.4h2.1m-2.1 0v2.1\" />\n </svg>\n );\n}\n\n/** Slashed camera — the trust pill's glyph. */\nfunction CameraOffIcon() {\n return (\n <svg\n aria-hidden=\"true\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.8\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className=\"sekyro-icon sekyro-icon--sm\"\n >\n <path d=\"M4 7.5h2.2l1.4-1.9h8.8l1.4 1.9H20a1.6 1.6 0 0 1 1.6 1.6v8.3A1.6 1.6 0 0 1 20 19H4a1.6 1.6 0 0 1-1.6-1.6V9.1A1.6 1.6 0 0 1 4 7.5Z\" />\n <path d=\"M3 3l18 18\" />\n </svg>\n );\n}\n","// Post-capture failure / retake surfaces, ported from\n// identity-hosted/components/steps/captured-panel.tsx: the retry coaching\n// (environment first, then framing) after a retryable verdict, and the\n// fresh-capture retake affordance. The happy path renders NOTHING here — the\n// still + the \"checking\" umbrella live inside the stage.\nimport { useEffect, useRef } from \"react\";\nimport { Button } from \"./button\";\nimport { useStrings } from \"./use-strings\";\n\nexport function CapturedPanel({\n showCoaching,\n attemptsText,\n showRetake,\n onRetake,\n}: {\n /** A retryable verdict came back: teach the fix. */\n showCoaching: boolean;\n /** Localized remaining-attempts line (null hides it — never claim \"0 attempts\"). */\n attemptsText: string | null;\n /** Offer a fresh attempt (the SDK did not re-arm by itself). */\n showRetake: boolean;\n onRetake: () => void;\n}) {\n const t = useStrings();\n const retakeRef = useRef<HTMLButtonElement | null>(null);\n // Focus the retake action when it appears (the user is being asked to act).\n useEffect(() => {\n if (showRetake) retakeRef.current?.focus();\n }, [showRetake]);\n if (!showCoaching && !showRetake) return null;\n return (\n <div className=\"sekyro-stack sekyro-stack--3\" data-testid=\"sekyro-captured-panel\">\n {showCoaching ? (\n <div className=\"sekyro-stack sekyro-stack--1\">\n <p className=\"sekyro-text-body\">{t(\"capture.retryCoaching.title\")}</p>\n {/* Coaching is essential guidance → fg, not fg-muted. */}\n <ul className=\"sekyro-coaching\">\n <li>{t(\"capture.retryCoaching.light\")}</li>\n <li>{t(\"capture.retryCoaching.eyeLevel\")}</li>\n <li>{t(\"capture.retryCoaching.head\")}</li>\n </ul>\n {attemptsText !== null ? (\n <p className=\"sekyro-text-muted\" data-testid=\"sekyro-attempts-remaining\">\n {attemptsText}\n </p>\n ) : null}\n </div>\n ) : null}\n {showRetake ? (\n <Button ref={retakeRef} className=\"sekyro-btn--start\" onClick={onRetake}>\n {t(\"capture.recordAgain\")}\n </Button>\n ) : null}\n </div>\n );\n}\n","// Dev-only diagnostics. The published bundle keeps `process.env.NODE_ENV` as a\n// live expression (tsup.config.ts `define`), so the HOST's bundler inlines it:\n// warnings run in a partner's dev build and are dropped from its production\n// build. No `typeof process` guard: after the host inlines the expression it\n// is a plain string compare (a guard would stay false in the browser and\n// silence dev builds); a bare browser without a bundler throws → production.\nexport function isDevBuild(): boolean {\n try {\n return process.env.NODE_ENV !== \"production\";\n } catch {\n return false;\n }\n}\n","// The built-in \"get ready\" screen (spec §5): tips, the camera-permission row,\n// the front/back choice, the voice switch, the security note and ONE Start area\n// gated on the detector preload (loading → spinner Start, ready → Start,\n// failed → danger notice + Retry). Pure presentation: every value comes in as a\n// prop (LivenessCapture feeds it from useLivenessAssets / useCameraStatus /\n// useVoiceGuidance), so it renders on the server and in isolation.\nimport type { CameraFacing, CameraPermissionState } from \"@sekyro/web\";\nimport { type ReactNode, useCallback, useEffect, useRef } from \"react\";\nimport { Button } from \"../button\";\nimport { Notice } from \"../notice\";\nimport type { AssetsGate } from \"../use-liveness-assets\";\nimport { useStrings } from \"../use-strings\";\nimport type { VoiceControl } from \"../voice/index\";\nimport { FacingPicker } from \"./facing-picker\";\nimport { SpinnerIcon } from \"./icons\";\nimport { PermissionRow } from \"./permission-row\";\nimport { type BuiltInTipId, type IntroTip, TipList } from \"./tips\";\nimport { VoiceSwitch } from \"./voice-switch\";\n\nexport interface PreCaptureScreenProps {\n assets: AssetsGate;\n onRetryAssets(): void;\n permission: CameraPermissionState;\n canChooseFacing: boolean;\n facing: CameraFacing;\n onFacingChange(facing: CameraFacing): void;\n voice: VoiceControl;\n tips: false | ReadonlyArray<BuiltInTipId | IntroTip>;\n startLabel?: ReactNode;\n startDisabled: boolean;\n onStart(): void;\n}\n\nexport function PreCaptureScreen({\n assets,\n onRetryAssets,\n permission,\n canChooseFacing,\n facing,\n onFacingChange,\n voice,\n tips,\n startLabel,\n startDisabled,\n onStart,\n}: PreCaptureScreenProps) {\n const t = useStrings();\n // Focus moves only on a status TRANSITION seen after mount (never on the\n // first mount — a page that opens already-failed keeps the host's focus —\n // and StrictMode's effect replay sees no transition), and only while focus\n // is on <body> or inside this screen: a late preload result (up to 120 s)\n // never pulls focus out of the host page.\n // - a failure appearing → Retry;\n // - Retry pressed → the loading Start (aria-disabled, so focusable) — the\n // same element turns into the ready Start, so focus never drops to body;\n // - that retry landing ready → Start (only if focus was lost meanwhile).\n const rootRef = useRef<HTMLDivElement | null>(null);\n const startRef = useRef<HTMLButtonElement | null>(null);\n const retryRef = useRef<HTMLButtonElement | null>(null);\n const prevAssetsRef = useRef(assets);\n const retriedRef = useRef(false);\n useEffect(() => {\n const prev = prevAssetsRef.current;\n prevAssetsRef.current = assets;\n if (prev === assets) return;\n const retried = retriedRef.current;\n if (assets !== \"loading\") retriedRef.current = false; // a retry ends once it settles\n if (!focusIsOurs(rootRef.current)) return;\n if (assets === \"failed\") retryRef.current?.focus();\n else if (retried) startRef.current?.focus();\n }, [assets]);\n const retry = useCallback(() => {\n retriedRef.current = true;\n onRetryAssets();\n }, [onRetryAssets]);\n\n const loading = assets === \"loading\";\n const inert = loading || startDisabled;\n const start = useCallback(() => {\n if (!inert) onStart();\n }, [inert, onStart]);\n\n let startArea: ReactNode;\n if (assets === \"failed\") {\n startArea = (\n <Notice tone=\"danger\" testId=\"sekyro-assets-error\">\n <p className=\"sekyro-text-body\">{t(\"fcv2.err.models\")}</p>\n <Button kind=\"ghost\" ref={retryRef} className=\"sekyro-btn--start\" onClick={retry} data-testid=\"sekyro-assets-retry\">\n {t(\"common.retry\")}\n </Button>\n </Notice>\n );\n } else {\n // ONE Start element for loading and ready (same tree position), so a\n // focused loading Start is still focused once it becomes ready. Disabled\n // via aria-disabled (not native `disabled`): it stays focusable and in the\n // tab order, and the click is ignored here.\n startArea = (\n <div className=\"sekyro-stack sekyro-stack--1\">\n <Button\n ref={startRef}\n full\n data-testid=\"sekyro-start\"\n aria-disabled={inert ? \"true\" : undefined}\n aria-busy={loading ? \"true\" : undefined}\n onClick={start}\n >\n {loading ? (\n <>\n <SpinnerIcon />\n {t(\"capture.preparing.title\")}\n </>\n ) : (\n (startLabel ?? t(\"capture.start\"))\n )}\n </Button>\n {loading ? <p className=\"sekyro-text-muted\">{t(\"capture.preparing.hint\")}</p> : null}\n </div>\n );\n }\n\n return (\n <div ref={rootRef} className=\"sekyro-stack sekyro-stack--4\" data-testid=\"sekyro-intro\" data-assets={assets}>\n {tips !== false ? <TipList tips={tips} /> : null}\n <PermissionRow state={permission} />\n {canChooseFacing ? <FacingPicker value={facing} onChange={onFacingChange} /> : null}\n <VoiceSwitch voice={voice} />\n <p className=\"sekyro-text-muted\">{t(\"capture.securityNote\")}</p>\n {startArea}\n {/* The announcement — the Start label change itself is not a live region. */}\n <p role=\"status\" className=\"sekyro-visually-hidden\" data-testid=\"sekyro-intro-status\">\n {assets === \"loading\" ? t(\"capture.preparing.title\") : assets === \"ready\" ? t(\"capture.ready\") : \"\"}\n </p>\n </div>\n );\n}\n\n/** Focus may be moved only when it is nowhere in particular (body) or already inside the intro. */\nfunction focusIsOurs(root: HTMLElement | null): boolean {\n if (typeof document === \"undefined\") return false;\n const active = document.activeElement;\n return active === null || active === document.body || (root !== null && root.contains(active));\n}\n","// Inline notice (ported from identity-hosted/components/steps/notice.tsx):\n// info renders as a polite status, warning/danger interrupt via role=\"alert\"\n// unless `role` overrides it (the retry notice is warning-toned but polite —\n// the engine is already re-arming, nothing interrupts the person).\n// Tone paints the border + a tint of the surface; the text stays `fg` so the\n// copy keeps the theme's AAA fg/surface contrast on every tone.\nimport type { ReactNode } from \"react\";\n\nexport type NoticeTone = \"info\" | \"warning\" | \"danger\";\n\nexport function Notice({\n tone,\n role,\n children,\n testId,\n}: {\n tone: NoticeTone;\n /** Live-region role; defaults from the tone (`info` → status, else alert). */\n role?: \"status\" | \"alert\";\n children: ReactNode;\n testId?: string;\n}) {\n return (\n <div\n role={role ?? (tone === \"info\" ? \"status\" : \"alert\")}\n className={`sekyro-notice sekyro-notice--${tone}`}\n data-testid={testId}\n >\n {children}\n </div>\n );\n}\n","// Front/back camera choice: a fieldset of two NATIVE radios (arrow keys, form\n// semantics and screen-reader \"1 of 2\" for free) drawn as ≥ 48 px segments.\n// The visible face is the input's next sibling, so the checked / focus styles\n// need no `:has()` support.\nimport type { CameraFacing } from \"@sekyro/web\";\nimport { useId } from \"react\";\nimport { useStrings } from \"../use-strings\";\n\nconst OPTIONS: readonly CameraFacing[] = [\"user\", \"environment\"];\n\nexport function FacingPicker({\n value,\n onChange,\n}: {\n value: CameraFacing;\n onChange: (facing: CameraFacing) => void;\n}) {\n const t = useStrings();\n const name = useId();\n return (\n <fieldset className=\"sekyro-segmented\" data-testid=\"sekyro-facing\">\n <legend className=\"sekyro-segmented__legend\">{t(\"capture.cameraLabel\")}</legend>\n <div className=\"sekyro-segmented__options\">\n {OPTIONS.map((option) => (\n <label key={option} className=\"sekyro-segmented__option\">\n <input\n type=\"radio\"\n className=\"sekyro-segmented__input\"\n name={name}\n value={option}\n checked={value === option}\n onChange={() => onChange(option)}\n />\n <span className=\"sekyro-segmented__face\">\n <span className=\"sekyro-segmented__dot\" aria-hidden=\"true\" />\n {t(`capture.facing.${option}`)}\n </span>\n </label>\n ))}\n </div>\n </fieldset>\n );\n}\n","// Inline 24×24 stroke icons of the pre-capture screen (no icon-font / DS\n// dependency). Decorative only: every icon is aria-hidden and paints through\n// `currentColor`, so it inherits the token color of its container.\nimport type { ReactNode } from \"react\";\n\ninterface IconProps {\n /** Default `sekyro-icon sekyro-icon--sm` (1rem, inline). */\n className?: string;\n}\n\nfunction Svg({ className, children }: IconProps & { children: ReactNode }) {\n return (\n <svg\n aria-hidden=\"true\"\n focusable=\"false\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.8\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={className ?? \"sekyro-icon sekyro-icon--sm\"}\n >\n {children}\n </svg>\n );\n}\n\nconst CAMERA_BODY =\n \"M4 7.5h2.2l1.4-1.9h8.8l1.4 1.9H20a1.6 1.6 0 0 1 1.6 1.6v8.3A1.6 1.6 0 0 1 20 19H4a1.6 1.6 0 0 1-1.6-1.6V9.1A1.6 1.6 0 0 1 4 7.5Z\";\n\n/** Light source — \"face a light\". */\nexport function SunIcon(props: IconProps) {\n return (\n <Svg {...props}>\n <circle cx=\"12\" cy=\"12\" r=\"4\" />\n <path d=\"M12 2.5v2M12 19.5v2M2.5 12h2M19.5 12h2M5.3 5.3l1.4 1.4M17.3 17.3l1.4 1.4M5.3 18.7l1.4-1.4M17.3 6.7l1.4-1.4\" />\n </Svg>\n );\n}\n\n/** An uncovered face — \"no glasses, mask or hand\". */\nexport function FaceUncoveredIcon(props: IconProps) {\n return (\n <Svg {...props}>\n <circle cx=\"12\" cy=\"12\" r=\"9\" />\n <path d=\"M9 10h.01M15 10h.01M8.8 14.6a4.2 4.2 0 0 0 6.4 0\" />\n </Svg>\n );\n}\n\n/** A phone held at eye level. */\nexport function PhoneEyeLevelIcon(props: IconProps) {\n return (\n <Svg {...props}>\n <rect x=\"7\" y=\"2.5\" width=\"10\" height=\"19\" rx=\"2\" />\n <path d=\"M10.5 18.5h3M2.5 9.5h2.5M19 9.5h2.5\" />\n <circle cx=\"12\" cy=\"9.5\" r=\"1.6\" />\n </Svg>\n );\n}\n\n/** An eye looking straight ahead. */\nexport function LookStraightIcon(props: IconProps) {\n return (\n <Svg {...props}>\n <path d=\"M2.5 12S6 5.5 12 5.5 21.5 12 21.5 12 18 18.5 12 18.5 2.5 12 2.5 12Z\" />\n <circle cx=\"12\" cy=\"12\" r=\"2.8\" />\n </Svg>\n );\n}\n\n/** Camera with a check — permission granted. */\nexport function CameraCheckIcon(props: IconProps) {\n return (\n <Svg {...props}>\n <path d={CAMERA_BODY} />\n <path d=\"M9 13l2 2 4-4\" />\n </Svg>\n );\n}\n\n/** Camera with a question mark — the browser will ask / state unknown. */\nexport function CameraAskIcon(props: IconProps) {\n return (\n <Svg {...props}>\n <path d={CAMERA_BODY} />\n <path d=\"M10.2 11.2a1.9 1.9 0 1 1 2.6 1.8c-.5.2-.8.6-.8 1.1v.3M12 16.4h.01\" />\n </Svg>\n );\n}\n\n/** Slashed camera — permission blocked. */\nexport function CameraBlockedIcon(props: IconProps) {\n return (\n <Svg {...props}>\n <path d={CAMERA_BODY} />\n <path d=\"M3 3l18 18\" />\n </Svg>\n );\n}\n\n/** Speaker (identity-hosted's VoiceChip glyph); `off` draws the mute slash. */\nexport function SpeakerIcon({ off, className }: IconProps & { off: boolean }) {\n return (\n <Svg {...(className !== undefined ? { className } : {})}>\n <path d=\"M4.5 9.5v5H8l4 3.5v-12L8 9.5H4.5Z\" />\n {off ? (\n <path d=\"M4 4l16 16\" />\n ) : (\n <>\n <path d=\"M15.5 9.7a3.6 3.6 0 0 1 0 4.6\" />\n <path d=\"M18 7.6a6.6 6.6 0 0 1 0 8.8\" />\n </>\n )}\n </Svg>\n );\n}\n\n/** Check glyph — the switch thumb's non-color \"on\" state. */\nexport function CheckIcon(props: IconProps) {\n return (\n <Svg {...props}>\n <path d=\"M5 12.5l4.5 4.5L19 7.5\" />\n </Svg>\n );\n}\n\n/** Busy spinner (rotation lives in `.sekyro-spinner`; stopped under reduced motion). */\nexport function SpinnerIcon(props: IconProps) {\n return (\n <Svg className={props.className ?? \"sekyro-spinner\"}>\n <circle cx=\"12\" cy=\"12\" r=\"9\" opacity=\"0.25\" />\n <path d=\"M21 12a9 9 0 0 0-9-9\" />\n </Svg>\n );\n}\n","// Camera-permission row: what the browser will do when the person starts.\n// A polite live region — the state can change while the screen is open (the\n// person flips the site setting), and that change is worth hearing. Not on\n// mount: the row becomes a live region only after a resolved (non-'unknown')\n// value has been rendered, so the first value is read as plain content and\n// only later changes are announced.\nimport type { CameraPermissionState } from \"@sekyro/web\";\nimport { useEffect, useState } from \"react\";\nimport { useStrings } from \"../use-strings\";\nimport { CameraAskIcon, CameraBlockedIcon, CameraCheckIcon } from \"./icons\";\n\nexport function PermissionRow({ state }: { state: CameraPermissionState }) {\n const t = useStrings();\n const [live, setLive] = useState(false);\n useEffect(() => {\n if (state !== \"unknown\") setLive(true);\n }, [state]);\n const icon =\n state === \"granted\" ? <CameraCheckIcon /> : state === \"denied\" ? <CameraBlockedIcon /> : <CameraAskIcon />;\n return (\n <div\n role={live ? \"status\" : undefined}\n className={`sekyro-permission sekyro-permission--${state}`}\n data-testid=\"sekyro-permission\"\n data-state={state}\n >\n <span className=\"sekyro-permission__icon\" aria-hidden=\"true\">\n {icon}\n </span>\n <span>{t(`capture.permission.${state}`)}</span>\n </div>\n );\n}\n","// Tips card of the pre-capture screen: a `section` labelled by its title, one\n// list item per tip with a decorative inline-SVG icon. Built-in ids resolve to\n// `capture.tips.*` copy + a built-in icon; hosts pass their own `IntroTip`s.\nimport { type ReactNode, useId } from \"react\";\nimport type { StringKey } from \"../strings/index\";\nimport { useStrings } from \"../use-strings\";\nimport { FaceUncoveredIcon, LookStraightIcon, PhoneEyeLevelIcon, SunIcon } from \"./icons\";\n\n/** A built-in tip (copy `capture.tips.<id>`, built-in icon). */\nexport type BuiltInTipId = \"light\" | \"uncover\" | \"eyeLevel\" | \"straight\";\n\n/** A host-provided tip. `id` is the React key; `icon` is decorative (rendered aria-hidden). */\nexport interface IntroTip {\n id: string;\n text: ReactNode;\n icon?: ReactNode;\n}\n\n/** The tips shown when the host passes none. */\nexport const DEFAULT_TIPS: readonly BuiltInTipId[] = [\"light\", \"uncover\", \"eyeLevel\", \"straight\"];\n\nconst BUILT_IN: Record<BuiltInTipId, { key: StringKey; icon: () => ReactNode }> = {\n light: { key: \"capture.tips.light\", icon: () => <SunIcon /> },\n uncover: { key: \"capture.tips.uncover\", icon: () => <FaceUncoveredIcon /> },\n eyeLevel: { key: \"capture.tips.eyeLevel\", icon: () => <PhoneEyeLevelIcon /> },\n straight: { key: \"capture.tips.straight\", icon: () => <LookStraightIcon /> },\n};\n\nexport function TipList({ tips }: { tips: ReadonlyArray<BuiltInTipId | IntroTip> }) {\n const t = useStrings();\n const titleId = useId();\n if (tips.length === 0) return null;\n return (\n <section className=\"sekyro-tips\" aria-labelledby={titleId} data-testid=\"sekyro-tips\">\n <p className=\"sekyro-tips__title\" id={titleId}>\n {t(\"capture.tips.title\")}\n </p>\n <ul className=\"sekyro-tips__list\">\n {tips.map((tip) => {\n const builtIn = typeof tip === \"string\" ? BUILT_IN[tip] : undefined;\n const id = typeof tip === \"string\" ? tip : tip.id;\n const icon = builtIn !== undefined ? builtIn.icon() : typeof tip === \"string\" ? undefined : tip.icon;\n const text = builtIn !== undefined ? t(builtIn.key) : typeof tip === \"string\" ? tip : tip.text;\n return (\n <li key={id} className=\"sekyro-tips__item\">\n {icon !== undefined && icon !== null ? (\n <span className=\"sekyro-tips__icon\" aria-hidden=\"true\">\n {icon}\n </span>\n ) : null}\n <span>{text}</span>\n </li>\n );\n })}\n </ul>\n </section>\n );\n}\n","// Voice-guidance switch: a `button role=\"switch\"` whose visible text is its\n// name. The state never relies on color alone — the thumb moves AND carries a\n// check glyph when on; the speaker glyph is slashed when off.\nimport type { VoiceControl } from \"../voice/index\";\nimport { useStrings } from \"../use-strings\";\nimport { CheckIcon, SpeakerIcon } from \"./icons\";\n\nexport function VoiceSwitch({ voice }: { voice: VoiceControl }) {\n const t = useStrings();\n if (!voice.supported) return null;\n const on = voice.enabled;\n return (\n <button\n type=\"button\"\n role=\"switch\"\n aria-checked={on}\n className=\"sekyro-switch\"\n data-testid=\"sekyro-voice-switch\"\n onClick={() => voice.toggle()}\n >\n <span className=\"sekyro-switch__label\">\n <SpeakerIcon off={!on} />\n {t(\"capture.voiceGuidance\")}\n </span>\n <span className=\"sekyro-switch__track\" aria-hidden=\"true\">\n <span className=\"sekyro-switch__thumb\">{on ? <CheckIcon className=\"sekyro-switch__check\" /> : null}</span>\n </span>\n </button>\n );\n}\n","// Camera facts for the pre-capture screen: the live permission state and\n// whether a front/back choice makes sense. Both probes run in effects (never on\n// the server, never during render) and never throw; the initial values are the\n// SSR-safe `'unknown'` / `false`.\nimport { type CameraPermissionState, hasMultipleCameras, subscribeCameraPermission } from \"@sekyro/web\";\nimport { useEffect, useState } from \"react\";\n\nexport interface CameraStatus {\n permission: CameraPermissionState;\n /** The probe answered at least once (`permission` is no longer the initial placeholder). */\n permissionSettled: boolean;\n canChooseFacing: boolean;\n}\n\nexport function useCameraStatus(): CameraStatus {\n const [permission, setPermission] = useState<{ state: CameraPermissionState; settled: boolean }>({\n state: \"unknown\",\n settled: false,\n });\n const [canChooseFacing, setCanChooseFacing] = useState(false);\n useEffect(() => subscribeCameraPermission((state) => setPermission({ state, settled: true })), []);\n useEffect(() => {\n let live = true;\n void hasMultipleCameras().then((multiple) => {\n if (live) setCanChooseFacing(multiple);\n });\n return () => {\n live = false;\n };\n }, []);\n return { permission: permission.state, permissionSettled: permission.settled, canChooseFacing };\n}\n","// Focus an element the moment it mounts — the failure-surface actions (retry,\n// retake) appear in response to something going wrong, so keyboard and\n// screen-reader users land on the action instead of hunting for it.\nimport { useCallback } from \"react\";\n\n/** A callback ref: focuses the element when it attaches. */\nexport function useFocusOnMount(): (element: HTMLElement | null) => void {\n return useCallback((element: HTMLElement | null) => {\n element?.focus();\n }, []);\n}\n","// The pre-capture Start gate: @sekyro/web's detector preload as a React value.\n// Kicks the (idempotent, never-rejecting) preload on mount (and again if the\n// store is released back to 'idle' while the pre-capture screen is `active`)\n// and mirrors its status store. A preload that was skipped (`'idle'`: SSR, no camera API) is\n// treated as ready — the capture then loads its detector the normal way.\nimport {\n getLivenessAssetsStatus,\n type LivenessAssetsStatus,\n preloadLivenessAssets,\n subscribeLivenessAssets,\n} from \"@sekyro/web\";\nimport { useCallback, useEffect, useRef, useState, useSyncExternalStore } from \"react\";\n\n/** What the Start control waits on. */\nexport type AssetsGate = \"loading\" | \"ready\" | \"failed\";\n\n/** Server snapshot = `'idle'` → the first render shows the loading Start and hydrates without a mismatch. */\nconst serverSnapshot = (): LivenessAssetsStatus => \"idle\";\n\nfunction preload(assetBaseUrl: string | undefined): Promise<LivenessAssetsStatus> {\n return preloadLivenessAssets(assetBaseUrl !== undefined ? { assetBaseUrl } : {});\n}\n\n/**\n * `active` = the pre-capture screen is up (capture idle). A release seen while\n * inactive (mid-capture, post-capture) is re-kicked only once active again —\n * never behind a running capture's back.\n */\nexport function useLivenessAssets(\n assetBaseUrl: string | undefined,\n active = true,\n): { gate: AssetsGate; retry: () => void } {\n const status = useSyncExternalStore(\n useCallback((listener: () => void) => subscribeLivenessAssets(listener, assetBaseUrl), [assetBaseUrl]),\n () => getLivenessAssetsStatus(assetBaseUrl),\n serverSnapshot,\n );\n // The base URL whose preload settled `'idle'` (skipped). Keyed by base so a\n // changed `assetBaseUrl` never inherits the previous base's skip.\n const [skipped, setSkipped] = useState<{ base: string | undefined } | null>(null);\n const mountedRef = useRef(false);\n const kick = useCallback(() => {\n void preload(assetBaseUrl).then((settled) => {\n if (mountedRef.current && settled === \"idle\") setSkipped({ base: assetBaseUrl });\n });\n }, [assetBaseUrl]);\n useEffect(() => {\n mountedRef.current = true;\n kick();\n return () => {\n mountedRef.current = false;\n };\n }, [kick]);\n // A store that falls back to `'idle'` AFTER a load (another component called\n // releaseLivenessAssets) is re-kicked while this screen is active — otherwise\n // the gate would read the stale skip/idle and Start would cold-load. Keyed by\n // base; a skip (idle without ever loading) never re-kicks.\n const loadedBaseRef = useRef<{ base: string | undefined } | null>(null);\n useEffect(() => {\n if (status !== \"idle\") {\n loadedBaseRef.current = { base: assetBaseUrl };\n return;\n }\n if (!active || loadedBaseRef.current === null || loadedBaseRef.current.base !== assetBaseUrl) return;\n loadedBaseRef.current = null;\n kick();\n }, [status, assetBaseUrl, kick, active]);\n const retry = useCallback(() => {\n void preload(assetBaseUrl);\n }, [assetBaseUrl]);\n // A skip only counts while the store is still idle: a later real load\n // (another caller, a retry) reports its own status.\n const skip = skipped !== null && skipped.base === assetBaseUrl && status === \"idle\";\n const gate: AssetsGate = skip || status === \"ready\" ? \"ready\" : status === \"failed\" ? \"failed\" : \"loading\";\n return { gate, retry };\n}\n","// React binding for a @sekyro/web LivenessCaptureHandle (replaces the hosted\n// useCapture + useCaptureSubmission pair): constructs the handle ONCE per\n// mount from the PUBLIC API — `verification.liveness({video})` or the\n// standalone `createLivenessCapture({video})` — mirrors its events into React\n// state and destroys it on unmount (camera tracks stopped — privacy).\n//\n// Retry delegates to the handle's own retry() (full engine reset + camera\n// restart); the mirror clears itself on the `starting` transition so stale\n// artifacts / errors / stills never leak into the new attempt.\n//\n// The `verification` is bound ONCE per mount (M3): a parent that re-creates it\n// (an unmemoised `createVerification()` in render) must not tear the camera\n// down and rebuild the engine — the first instance stays bound and a dev-only\n// warning names the mistake.\nimport {\n type CapturedArtifacts,\n type CaptureError,\n type CaptureState,\n createLivenessCapture,\n type GateUpdate,\n type LivenessCaptureHandle,\n type LivenessCaptureOptions,\n type LivenessStartOptions,\n type Verification,\n type VerificationResult,\n} from \"@sekyro/web\";\nimport { type RefObject, useCallback, useEffect, useRef, useState } from \"react\";\nimport { isDevBuild } from \"./dev\";\n\nexport interface UseLivenessHandleOptions {\n verification: Verification | undefined;\n videoRef: RefObject<HTMLVideoElement | null>;\n assetBaseUrl: string | undefined;\n onCaptured: ((artifacts: CapturedArtifacts) => void) | undefined;\n onResult: ((result: VerificationResult) => void) | undefined;\n onError: ((error: CaptureError) => void) | undefined;\n onStateChange: ((state: CaptureState) => void) | undefined;\n}\n\nexport interface UseLivenessHandleResult {\n state: CaptureState;\n gate: GateUpdate;\n /** True while the gate integrator is FALLING (latest tick lowered progress). */\n draining: boolean;\n /** Chrome latch: once the fill completes within an attempt the ring stays locked. */\n gateLocked: boolean;\n /**\n * The keyframe preview the moment RECORDING ends (the handle's `frozen`\n * event) — ahead of `artifacts`, which only land once the clip finalizes.\n * Null until frozen; cleared on a fresh attempt.\n */\n frozenPreview: string | null;\n /** Device-profile hint: drop the decorative animations (LOW device class). */\n reduceMotion: boolean;\n artifacts: CapturedArtifacts | null;\n error: CaptureError | null;\n /** The latest verification result; cleared when the next capture lands. */\n result: VerificationResult | null;\n /** Begin an attempt; `options.facing` picks the camera for it (forwarded to `handle.start`). */\n start: (options?: LivenessStartOptions) => void;\n retry: () => void;\n switchCamera: () => void;\n}\n\nconst IDLE_GATE: GateUpdate = { progress: 0, hint: null, faceDetected: false };\n\nexport function useLivenessHandle(options: UseLivenessHandleOptions): UseLivenessHandleResult {\n const { videoRef, assetBaseUrl } = options;\n // Bound once: the FIRST verification instance owns the handle for this mount.\n const verificationRef = useRef<Verification | undefined>(options.verification);\n const verification = verificationRef.current;\n const warnedRef = useRef(false);\n if (options.verification !== verification && !warnedRef.current && isDevBuild()) {\n warnedRef.current = true;\n console.warn(\n \"[@sekyro/react] <LivenessCapture>: the `verification` prop changed identity after mount. \" +\n \"The first instance stays bound (the camera is not rebuilt); create the verification once \" +\n \"(useMemo / useState / outside render) instead of on every render.\",\n );\n }\n const handleRef = useRef<LivenessCaptureHandle | null>(null);\n const [state, setState] = useState<CaptureState>(\"idle\");\n const [gate, setGate] = useState<GateUpdate>(IDLE_GATE);\n const [draining, setDraining] = useState(false);\n const [gateLocked, setGateLocked] = useState(false);\n const [frozenPreview, setFrozenPreview] = useState<string | null>(null);\n const [reduceMotion, setReduceMotion] = useState(false);\n const [artifacts, setArtifacts] = useState<CapturedArtifacts | null>(null);\n const [error, setError] = useState<CaptureError | null>(null);\n const [result, setResult] = useState<VerificationResult | null>(null);\n const lastProgressRef = useRef<number | null>(null);\n\n // Latest callbacks via a ref so the mount effect never re-runs for a new\n // inline handler (rebuilding the engine on every render would be a bug).\n const callbacksRef = useRef(options);\n callbacksRef.current = options;\n\n useEffect(() => {\n const video = videoRef.current;\n if (video === null) return;\n const captureOptions: LivenessCaptureOptions = {\n video,\n ...(assetBaseUrl !== undefined ? { assetBaseUrl } : {}),\n };\n const handle =\n verification !== undefined\n ? verification.liveness(captureOptions)\n : createLivenessCapture(captureOptions);\n handleRef.current = handle;\n\n const unsubscribes = [\n handle.on(\"state\", (next) => {\n if (next === \"starting\") {\n // Fresh attempt: the mirror resets with the engine's gate.\n setArtifacts(null);\n setError(null);\n setGate(IDLE_GATE);\n setGateLocked(false);\n setDraining(false);\n setFrozenPreview(null);\n lastProgressRef.current = null;\n }\n setState(next);\n callbacksRef.current.onStateChange?.(next);\n }),\n handle.on(\"gate\", (update) => {\n const previous = lastProgressRef.current;\n lastProgressRef.current = update.progress;\n // Draining = the integrator moved DOWN this tick; mid-fill only.\n setDraining(\n previous !== null &&\n update.progress < previous - 0.001 &&\n update.progress > 0 &&\n update.progress < 1,\n );\n if (update.progress >= 1) setGateLocked(true);\n setGate(update);\n }),\n handle.on(\"frozen\", ({ previewDataUrl }) => setFrozenPreview(previewDataUrl)),\n handle.on(\"profile\", ({ animations }) => setReduceMotion(animations === \"reduced\")),\n handle.on(\"captured\", (captured) => {\n setArtifacts(captured);\n setResult(null);\n callbacksRef.current.onCaptured?.(captured);\n }),\n handle.on(\"error\", (err) => {\n setError(err);\n callbacksRef.current.onError?.(err);\n }),\n verification?.on(\"result\", (next) => {\n setResult(next);\n callbacksRef.current.onResult?.(next);\n }),\n ];\n return () => {\n for (const unsubscribe of unsubscribes) unsubscribe?.();\n handleRef.current = null;\n handle.destroy();\n };\n }, [verification, videoRef, assetBaseUrl]);\n\n const start = useCallback((options?: LivenessStartOptions) => {\n void handleRef.current?.start(options);\n }, []);\n const retry = useCallback(() => {\n handleRef.current?.retry();\n }, []);\n const switchCamera = useCallback(() => {\n // The engine resets its gate on switch: the chrome latch must drop with it\n // (and any frozen still — a switch always precedes a fresh capture).\n setGateLocked(false);\n setDraining(false);\n setFrozenPreview(null);\n lastProgressRef.current = null;\n handleRef.current?.switchCamera();\n }, []);\n\n return {\n state,\n gate,\n draining,\n gateLocked,\n frozenPreview,\n reduceMotion,\n artifacts,\n error,\n result,\n start,\n retry,\n switchCamera,\n };\n}\n","// The built-in in-stage voice toggle (spec D13): a 48 px icon chip in the\n// stage's start corner. Its name is constant (\"Voice guidance\") and the state\n// is `aria-pressed`, so a screen reader hears \"Voice guidance, toggle button,\n// pressed\"; visually the speaker glyph is slashed when off (not color alone).\n// The press is a user gesture → turning voice ON also unlocks audio (iOS).\nimport { Button } from \"./button\";\nimport { SpeakerIcon } from \"./intro/icons\";\nimport { useStrings } from \"./use-strings\";\nimport type { VoiceControl } from \"./voice/index\";\n\nexport function VoiceChip({ voice }: { voice: VoiceControl }) {\n const t = useStrings();\n return (\n <Button\n kind=\"chip\"\n aria-pressed={voice.enabled}\n aria-label={t(\"capture.voiceGuidance\")}\n data-testid=\"sekyro-voice-toggle\"\n onClick={() => voice.toggle()}\n >\n <SpeakerIcon off={!voice.enabled} className=\"sekyro-icon\" />\n </Button>\n );\n}\n","// GENERATED by scripts/generate-voice-clips.mts — do not edit.\nimport type { VoiceClipManifest } from \"./clips\";\n/**\n * The clip set bundled under `assets/audio/<set>/` — same shape as its\n * manifest.json, trimmed to what resolution needs (sha256/text stay in the JSON).\n * An empty table per locale means the package ships TTS-only.\n */\nexport const BUNDLED_CLIP_MANIFEST: VoiceClipManifest = {\n set: \"v1\",\n clips: {\n ar: {},\n fr: {},\n },\n};\n","import type { StringKey } from \"../strings/index\";\n\n/** Guidance keys that can be spoken (the engine's fcv3.* gate hints). */\nexport type VoiceKey =\n | \"fcv3.no_face\"\n | \"fcv3.come_closer\"\n | \"fcv3.move_back\"\n | \"fcv3.center_face\"\n | \"fcv3.straighten\"\n | \"fcv3.more_light\"\n | \"fcv3.too_bright\"\n | \"fcv3.hold_still\"\n | \"fcv3.steady_camera\";\n\n/** Every {@link VoiceKey}, in a stable order (e.g. to build a clip map). */\nexport const VOICE_KEYS: readonly VoiceKey[] = [\n \"fcv3.no_face\",\n \"fcv3.come_closer\",\n \"fcv3.move_back\",\n \"fcv3.center_face\",\n \"fcv3.straighten\",\n \"fcv3.more_light\",\n \"fcv3.too_bright\",\n \"fcv3.hold_still\",\n \"fcv3.steady_camera\",\n];\n\nexport function isVoiceKey(key: StringKey | null): key is VoiceKey {\n return key !== null && (VOICE_KEYS as readonly string[]).includes(key);\n}\n\n/** Clip basename = the key's last segment (`fcv3.center_face` → `center_face`). */\nexport function clipName(key: VoiceKey): string {\n return key.slice(key.lastIndexOf(\".\") + 1);\n}\n","import type { SekyroLocale } from \"../strings/index\";\nimport { BUNDLED_CLIP_MANIFEST } from \"./clip-manifest\";\nimport { clipName, type VoiceKey } from \"./keys\";\n\n/** Resolve a voice clip URL; `null`/`undefined` = no clip (speech fallback applies). */\nexport type VoiceClipResolver = (key: VoiceKey, locale: SekyroLocale) => string | null | undefined;\n\n/**\n * Clip URLs per locale and key — e.g. the map a backend hands the SDK in the\n * session view. A new object identity is the change signal.\n */\nexport type VoiceClipMap = {\n readonly [L in SekyroLocale]?: { readonly [K in VoiceKey]?: string | null | undefined } | undefined;\n};\n\n/** `voice.clips`: a resolver function or a `{ [locale]: { [voiceKey]: url } }` map. */\nexport type VoiceClipSource = VoiceClipResolver | VoiceClipMap;\n\n/**\n * A clip-set manifest (the `assets/audio/<set>/manifest.json` shape): per\n * locale, one entry per shipped clip, keyed by clip name (`center_face` for\n * `fcv3.center_face`). Entry contents (sha256, text, bytes) are not needed to resolve.\n */\nexport interface VoiceClipManifest {\n readonly set: string;\n readonly clips: { readonly [L in SekyroLocale]?: Readonly<Record<string, unknown>> | undefined };\n}\n\nconst own = (o: object, k: string): boolean => Object.prototype.hasOwnProperty.call(o, k);\n\n/**\n * Resolver over a manifest: a listed key resolves to `<baseUrl>/<locale>/<name>.mp3`\n * (`baseUrl` = the set's directory, where its manifest.json lives); anything\n * else resolves to `null`, so a missing clip costs no 404 round-trip.\n */\nexport function createManifestResolver(manifest: VoiceClipManifest, baseUrl: string): VoiceClipResolver {\n const base = baseUrl.replace(/\\/+$/, \"\");\n return (key, locale) => {\n const table = manifest.clips[locale];\n const name = clipName(key);\n return table !== undefined && own(table, name) ? `${base}/${locale}/${name}.mp3` : null;\n };\n}\n\n/** Base URL of the bundled clip set: `${assetBaseUrl ?? \"/models-v3\"}/audio/<set>`. */\nexport function defaultClipBaseUrl(assetBaseUrl: string | undefined): string {\n return `${(assetBaseUrl ?? \"/models-v3\").replace(/\\/+$/, \"\")}/audio/${BUNDLED_CLIP_MANIFEST.set}`;\n}\n\n/** The default clip source: the bundled manifest served from `clipBaseUrl`. */\nexport function bundledClipResolver(clipBaseUrl: string): VoiceClipResolver {\n return createManifestResolver(BUNDLED_CLIP_MANIFEST, clipBaseUrl);\n}\n\n/**\n * The clip URL for `key` in `locale`, or `null`. Never throws: a throwing\n * partner resolver, a non-string or an empty string all mean \"no clip\".\n */\nexport function resolveClip(source: VoiceClipSource, key: VoiceKey, locale: SekyroLocale): string | null {\n let url: unknown;\n try {\n if (typeof source === \"function\") url = source(key, locale);\n else {\n const table = source[locale];\n url = table !== undefined && table !== null && own(table, key) ? table[key] : null;\n }\n } catch {\n return null;\n }\n return typeof url === \"string\" && url !== \"\" ? url : null;\n}\n","import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from \"react\";\nimport type { SekyroLocale, StringKey } from \"../strings/index\";\nimport { bundledClipResolver, defaultClipBaseUrl, resolveClip, type VoiceClipSource } from \"./clips\";\nimport { isVoiceKey, VOICE_KEYS, type VoiceKey } from \"./keys\";\nimport {\n clipIdentity,\n createVoicePlayer,\n SPEECH_LANG,\n speechUsable,\n subscribeVoices,\n type VoicePlayer,\n} from \"./player\";\nimport { DEFAULT_VOICE_STORAGE_KEY, readVoicePreference, writeVoicePreference } from \"./preference\";\n\n/** Voice-guidance options of `<LivenessCapture voice>`. */\nexport interface VoiceOptions {\n /** Initial state when the viewer has no stored preference. Default `true`. */\n defaultEnabled?: boolean;\n /**\n * Clip source; replaces the bundled set. Either a resolver `(key, locale) → url | null`\n * or a map `{ [locale]: { [voiceKey]: url } }` (e.g. delivered by the backend;\n * pass a new object to change it). A key without a URL — or a resolver that\n * throws — means \"no clip\" (speech fallback applies).\n */\n clips?: VoiceClipSource;\n /** Base of the bundled clip set; default `${assetBaseUrl ?? \"/models-v3\"}/audio/v1`. */\n clipBaseUrl?: string;\n /** Locales where the device voice (speechSynthesis) may speak when no clip plays. Default `true` (all). */\n speechFallback?: boolean | readonly SekyroLocale[];\n /** localStorage key of the viewer's preference; `null` = do not persist. Default `\"sekyro.voiceGuidance\"`. */\n storageKey?: string | null;\n}\n\n/** The shared voice state the intro switch, the stage chip and the slots read. */\nexport interface VoiceControl {\n /** Something can speak for this locale (a resolvable clip, or a usable device voice). `false` on the server and with `voice={false}`. */\n readonly supported: boolean;\n /** The viewer's choice (persisted under `storageKey`). */\n readonly enabled: boolean;\n /** Turn voice on / off; call it from a click (turning on unlocks audio on iOS). */\n setEnabled(next: boolean): void;\n /** Flip `enabled` (same gesture rule as `setEnabled`). */\n toggle(): void;\n}\n\n/** @internal VoiceControl + the component-only operations. */\nexport interface VoiceGuidance extends VoiceControl {\n /** MUST run inside a user gesture (the Start tap) — unlocks audio/TTS on iOS; prefetches the clips only while enabled. */\n unlock(): void;\n speakKey(key: VoiceKey, text: string): void;\n stop(): void;\n}\n\n// useLayoutEffect warns / is pointless on the server; the browser needs it to\n// sync refs before any passive effect (useSpeakGuidance) reads them.\nconst useIsomorphicLayoutEffect = typeof window !== \"undefined\" ? useLayoutEffect : useEffect;\n\n/** Distinct clip URLs `source` resolves for `locale` (≤ one per VoiceKey). */\nfunction resolvedClipUrls(source: VoiceClipSource, locale: SekyroLocale): string[] {\n const seen = new Set<string>();\n const urls: string[] = [];\n for (const key of VOICE_KEYS) {\n const url = resolveClip(source, key, locale);\n if (url === null || seen.has(clipIdentity(url))) continue;\n seen.add(clipIdentity(url));\n urls.push(url);\n }\n return urls;\n}\n\nexport function useVoiceGuidance({\n locale,\n assetBaseUrl,\n options,\n}: {\n locale: SekyroLocale;\n assetBaseUrl: string | undefined;\n options: VoiceOptions | false | undefined;\n}): VoiceGuidance {\n const off = options === false;\n const opts: VoiceOptions = off ? {} : (options ?? {});\n const storageKey = opts.storageKey === undefined ? DEFAULT_VOICE_STORAGE_KEY : opts.storageKey;\n const [enabled, setEnabledState] = useState(opts.defaultEnabled ?? true);\n // Mirrors `enabled` synchronously so back-to-back toggles in one event see\n // each other (a closure over `enabled` would read the stale render value).\n const enabledRef = useRef(enabled);\n const [supported, setSupported] = useState(false);\n // Bumped on `voiceschanged` → re-evaluates `supported` against the loaded voices.\n const [voicesVersion, setVoicesVersion] = useState(0);\n const playerRef = useRef<VoicePlayer | null>(null);\n // Lazily created on first gesture / utterance — never during render or on the server.\n const player = useCallback((): VoicePlayer => {\n playerRef.current ??= createVoicePlayer();\n return playerRef.current;\n }, []);\n const lang = SPEECH_LANG[locale];\n const fallback = opts.speechFallback;\n const speechAllowed =\n fallback === undefined || fallback === true ? true : fallback === false ? false : fallback.includes(locale);\n const clipBase = opts.clipBaseUrl ?? defaultClipBaseUrl(assetBaseUrl);\n const custom = opts.clips;\n const source = useMemo<VoiceClipSource>(() => custom ?? bundledClipResolver(clipBase), [custom, clipBase]);\n // Partners often pass an inline `clips` function: speakKey reads the latest\n // source from a ref (synced after commit, never written during render) so its\n // identity never changes `speakKey`.\n const sourceRef = useRef(source);\n useIsomorphicLayoutEffect(() => {\n sourceRef.current = source;\n enabledRef.current = enabled;\n });\n\n // The stored preference is read after mount (SSR markup = the default).\n useEffect(() => {\n if (off || storageKey === null) return;\n const stored = readVoicePreference(storageKey);\n if (stored !== null) {\n enabledRef.current = stored;\n setEnabledState(stored);\n }\n }, [off, storageKey]);\n\n useEffect(() => {\n if (off || !speechAllowed) return;\n return subscribeVoices(() => setVoicesVersion((v) => v + 1));\n }, [off, speechAllowed]);\n\n // `supported` depends on browser APIs → computed after mount too. It reflects\n // what actually resolves for THIS locale (a partial map with nothing for it\n // does not count), else a usable device voice where speech is allowed.\n useEffect(() => {\n if (off) return;\n setSupported(resolvedClipUrls(source, locale).length > 0 || (speechAllowed && speechUsable(lang)));\n }, [off, source, locale, speechAllowed, lang, voicesVersion]);\n\n useEffect(\n () => () => {\n playerRef.current?.dispose();\n playerRef.current = null; // a StrictMode re-mount gets a fresh player\n },\n [],\n );\n\n // `prefetch`: warm this locale's clips inside the gesture (bounded: ≤ one per\n // VoiceKey) — only when voice will actually speak; a muted viewer downloads none.\n const unlockAudio = useCallback(\n (prefetch: boolean) => {\n if (off) return;\n player().unlock({\n lang,\n speech: speechAllowed,\n ...(prefetch ? { prefetch: resolvedClipUrls(sourceRef.current, locale) } : {}),\n });\n },\n [off, player, lang, speechAllowed, locale],\n );\n const unlock = useCallback(() => unlockAudio(enabledRef.current), [unlockAudio]);\n\n const stop = useCallback(() => playerRef.current?.stop(), []);\n\n const setEnabled = useCallback(\n (next: boolean) => {\n if (off) return;\n if (next) unlockAudio(true); // the switch / chip press IS a gesture (iOS)\n else stop();\n if (storageKey !== null) writeVoicePreference(storageKey, next);\n enabledRef.current = next;\n setEnabledState(next);\n },\n [off, unlockAudio, stop, storageKey],\n );\n\n // Reads the latest value (ref), not the render's closure: two toggles in one\n // batch end where they started. The side effects (unlock in the gesture,\n // persistence) need the next value synchronously, so no updater function.\n const toggle = useCallback(() => setEnabled(!enabledRef.current), [setEnabled]);\n\n const speakKey = useCallback(\n (key: VoiceKey, text: string) => {\n if (off || !enabled) return;\n const url = resolveClip(sourceRef.current, key, locale);\n player().say({ url, text, lang, speech: speechAllowed });\n },\n [off, enabled, locale, player, lang, speechAllowed],\n );\n\n return useMemo(\n () => ({\n supported: !off && supported,\n enabled: !off && enabled,\n setEnabled,\n toggle,\n unlock,\n speakKey,\n stop,\n }),\n [off, supported, enabled, setEnabled, toggle, unlock, speakKey, stop],\n );\n}\n\n/** Speak `key` (the DISPLAYED, debounced guidance key) once per change while `active`. */\nexport function useSpeakGuidance(voice: VoiceGuidance, key: StringKey | null, text: string, active: boolean): void {\n const { speakKey, stop, enabled } = voice;\n useEffect(() => {\n if (!active || !enabled) {\n // Also resets the player's dedupe → the next attempt speaks again.\n stop();\n return;\n }\n if (isVoiceKey(key) && text !== \"\") speakKey(key, text);\n }, [active, enabled, key, text, speakKey, stop]);\n}\n","// One <audio> element + speechSynthesis (spec D8, D9). Created lazily on first\n// use (never during render / on the server). Every utterance cancels the\n// previous one; a generation counter makes sure a superseded play() rejection\n// never speaks stale text.\n//\n// Device voice policy: when the voice list is loaded and none speaks the\n// language, stay silent — a wrong-language voice reading Arabic is worse than\n// no voice. An empty list means \"not loaded yet\" (Chrome fills it async) → speak\n// with the default voice for `lang`.\n\n// 44-byte silent PCM WAV. Played from a blob: URL (not a data: URI) so hosts\n// need no `media-src data:` in their CSP.\nconst SILENT_WAV_BASE64 = \"UklGRiQAAABXQVZFZm10IBAAAAABAAEAESsAACJWAAACABAAZGF0YQAAAAA=\";\n\n/** BCP-47 tag the device voice speaks per SDK locale. */\nexport const SPEECH_LANG = { ar: \"ar-SA\", fr: \"fr-FR\", en: \"en-US\" } as const;\n\nexport interface Utterance {\n /** Clip URL, or `null` for speech only. */\n url: string | null;\n text: string;\n lang: string;\n /** speechSynthesis may be used (no clip, or a clip failed). */\n speech: boolean;\n}\n\nexport interface VoicePlayer {\n say(utterance: Utterance): void;\n /**\n * MUST run inside a user gesture (iOS autoplay policy). `prefetch` = the clip\n * URLs of the current locale, warmed once each (bounded by the caller's set).\n */\n unlock(options: { lang: string; speech: boolean; prefetch?: readonly string[] }): void;\n stop(): void;\n dispose(): void;\n}\n\nfunction synth(): SpeechSynthesis | null {\n return typeof window !== \"undefined\" && \"speechSynthesis\" in window ? window.speechSynthesis : null;\n}\n\n/** speechSynthesis + SpeechSynthesisUtterance both exist (false on the server). */\nexport function speechAvailable(): boolean {\n return synth() !== null && typeof SpeechSynthesisUtterance === \"function\";\n}\n\n/** Primary language subtag, lower-cased (`ar-SA` / `ar_SA` → `ar`). */\nfunction baseLang(lang: string): string {\n return (lang.split(/[-_]/)[0] ?? lang).toLowerCase();\n}\n\n/** Exact BCP-47 match, else the first voice of the same primary language. */\nexport function pickVoice<V extends { lang: string }>(voices: readonly V[], lang: string): V | undefined {\n const norm = (l: string): string => l.replace(/_/g, \"-\").toLowerCase();\n const base = baseLang(lang);\n return voices.find((v) => norm(v.lang) === norm(lang)) ?? voices.find((v) => baseLang(v.lang) === base);\n}\n\n/**\n * The device voice can speak `lang`: speechSynthesis exists, and the voice list\n * is either not loaded yet (empty) or has a voice for the language.\n */\nexport function speechUsable(lang: string): boolean {\n if (!speechAvailable()) return false;\n let voices: SpeechSynthesisVoice[] = [];\n try {\n voices = synth()?.getVoices() ?? [];\n } catch {\n return true;\n }\n return voices.length === 0 || pickVoice(voices, lang) !== undefined;\n}\n\n/** Calls `onChange` on every `voiceschanged`; returns the unsubscribe. No-op on the server. */\nexport function subscribeVoices(onChange: () => void): () => void {\n const s = synth();\n if (s === null || typeof s.addEventListener !== \"function\") return () => undefined;\n s.addEventListener(\"voiceschanged\", onChange);\n return () => s.removeEventListener?.(\"voiceschanged\", onChange);\n}\n\n/**\n * Dedupe identity of a clip URL: origin + pathname, so rotating query strings\n * (presigned / signed CDN URLs) never defeat \"two keys, same clip → spoken once\".\n */\nexport function clipIdentity(url: string): string {\n try {\n const base = typeof location !== \"undefined\" ? location.href : \"http://localhost/\";\n const u = new URL(url, base);\n return `clip:${u.origin}${u.pathname}`;\n } catch {\n return `clip:${url}`;\n }\n}\n\n/** Release an element's media resources (and any in-flight download). */\nfunction release(a: HTMLAudioElement): void {\n a.pause();\n a.removeAttribute(\"src\");\n a.load();\n}\n\nexport function createVoicePlayer(): VoicePlayer {\n let audio: HTMLAudioElement | null = null;\n let unlockUrl: string | null = null;\n let generation = 0;\n let lastId: string | null = null;\n let voices: SpeechSynthesisVoice[] = [];\n // Warm-up elements by clip identity (never played; released on dispose).\n const warm = new Map<string, HTMLAudioElement>();\n const loadVoices = (): void => {\n voices = synth()?.getVoices() ?? [];\n };\n let voicesBound = false;\n const bindVoices = (): void => {\n const s = synth();\n if (voicesBound || s === null) return;\n voicesBound = true;\n loadVoices();\n s.addEventListener?.(\"voiceschanged\", loadVoices);\n };\n const element = (): HTMLAudioElement => {\n audio ??= new Audio();\n return audio;\n };\n const speak = (text: string, lang: string): void => {\n const s = synth();\n if (s === null || text === \"\" || typeof SpeechSynthesisUtterance !== \"function\") return;\n bindVoices();\n const voice = pickVoice(voices, lang);\n // Voices loaded and none speaks `lang` → silence beats a wrong-language voice.\n if (voices.length > 0 && voice === undefined) return;\n s.cancel();\n const u = new SpeechSynthesisUtterance(text);\n u.lang = lang;\n if (voice !== undefined) u.voice = voice;\n u.rate = 0.95;\n s.speak(u);\n };\n const stop = (): void => {\n generation += 1;\n lastId = null;\n if (audio !== null) {\n audio.pause();\n audio.currentTime = 0;\n }\n synth()?.cancel();\n };\n return {\n say(utterance) {\n const id = utterance.url !== null ? clipIdentity(utterance.url) : `tts:${utterance.lang}:${utterance.text}`;\n if (id === lastId) return;\n lastId = id;\n generation += 1;\n const current = generation;\n synth()?.cancel();\n if (utterance.url !== null) {\n const a = element();\n a.pause(); // rejects a pending previous play() with AbortError\n a.muted = false;\n a.src = utterance.url;\n a.currentTime = 0;\n // The play() rejection is the ONE fallback path (no onerror handler —\n // a 404 can fire both, which would speak twice).\n a.play()?.catch((err: unknown) => {\n if (current !== generation) return; // superseded / stopped\n if ((err as { name?: string } | null)?.name === \"AbortError\") return;\n if (utterance.speech) speak(utterance.text, utterance.lang);\n });\n return;\n }\n if (utterance.speech) speak(utterance.text, utterance.lang);\n },\n unlock({ lang, speech, prefetch }) {\n const a = element();\n if (unlockUrl === null && typeof Blob === \"function\" && typeof URL.createObjectURL === \"function\") {\n const bytes = Uint8Array.from(atob(SILENT_WAV_BASE64), (c) => c.charCodeAt(0));\n unlockUrl = URL.createObjectURL(new Blob([bytes], { type: \"audio/wav\" }));\n }\n // A clip already playing proves the element is unlocked — re-pointing it\n // at the silent WAV would cut that clip off (a late first-touch unlock\n // during an auto-started capture).\n const playingClip = a.paused === false && unlockUrl !== null && a.src !== unlockUrl;\n if (unlockUrl !== null && !playingClip) {\n a.muted = true;\n a.src = unlockUrl;\n a.play()?.catch(() => undefined);\n }\n const s = synth();\n if (speech && s !== null && typeof SpeechSynthesisUtterance === \"function\") {\n bindVoices();\n const u = new SpeechSynthesisUtterance(\" \");\n u.volume = 0;\n u.lang = lang;\n s.speak(u);\n }\n // Warm the locale's clips (in the gesture, so iOS honours preload). A\n // media element needs no CORS (no-cors media request) and uses the same\n // request type as playback, so the later play() is served from the HTTP\n // cache instead of downloading again — unlike fetch(), which needs CORS on\n // the clip host and may be cached under a different request mode.\n for (const url of prefetch ?? []) {\n const id = clipIdentity(url);\n if (warm.has(id)) continue;\n const w = new Audio();\n w.preload = \"auto\";\n w.src = url;\n warm.set(id, w);\n }\n },\n stop,\n dispose() {\n stop();\n if (voicesBound) synth()?.removeEventListener?.(\"voiceschanged\", loadVoices);\n voicesBound = false;\n if (unlockUrl !== null) URL.revokeObjectURL(unlockUrl);\n unlockUrl = null;\n if (audio !== null) release(audio);\n audio = null;\n for (const w of warm.values()) release(w);\n warm.clear();\n },\n };\n}\n","// The viewer's voice-guidance preference ('1' on / '0' off) in localStorage.\n// Every access is guarded: storage can be blocked (private mode, sandboxed\n// iframes, cookie policies) or absent (SSR) — callers then keep the default.\n\n/** Default localStorage key of the voice-guidance preference. */\nexport const DEFAULT_VOICE_STORAGE_KEY = \"sekyro.voiceGuidance\";\n\n/** Stored preference, or `null` when none is stored or storage is unavailable. */\nexport function readVoicePreference(key: string): boolean | null {\n try {\n if (typeof window === \"undefined\") return null;\n const value = window.localStorage.getItem(key);\n if (value === \"1\") return true;\n if (value === \"0\") return false;\n return null;\n } catch {\n return null;\n }\n}\n\n/** Persist the preference; a blocked storage is ignored (in-memory state still applies). */\nexport function writeVoicePreference(key: string, enabled: boolean): void {\n try {\n if (typeof window === \"undefined\") return;\n window.localStorage.setItem(key, enabled ? \"1\" : \"0\");\n } catch {\n // storage blocked — nothing to do\n }\n}\n","// SekyroThemeProvider — the theme is a set of CSS custom properties written on\n// ONE wrapper element (`.sekyro-root`); every component paints through them\n// (`var(--sekyro-color-*)`), never through a literal color. Without a provider\n// the stylesheet's `:root` defaults apply (same values as DEFAULT_THEME).\nimport type { CSSProperties, ReactNode } from \"react\";\n\n/** Color tokens. Every value is any valid CSS `<color>`. */\nexport interface SekyroThemeColors {\n /** Primary action surface (buttons, filled ring ticks). */\n brand: string;\n /** Text on `brand`. */\n brandFg: string;\n /** Primary text; also the capture-stage scrim. */\n fg: string;\n /** Secondary text (hints, notes) — never essential instructions. */\n fgMuted: string;\n /** Page background behind the component. */\n bg: string;\n /** Card / panel surface the component sits on; also the text on the scrim. */\n surface: string;\n /** Focus ring. */\n ring: string;\n /** Error accents (notice border / tint). */\n danger: string;\n /** Gate-locked ring + success accents. */\n success: string;\n /** Draining-ring and retry-notice accents. */\n warning: string;\n}\n\n/** Theme shape accepted by {@link SekyroThemeProvider}. Partial: unset tokens keep the defaults. */\nexport interface SekyroTheme {\n /** Color tokens to override. */\n colors?: Partial<SekyroThemeColors>;\n /** Corner radius of panels and buttons (CSS length). */\n radius?: string;\n /** Font stack for all component text. */\n fontFamily?: string;\n}\n\n/**\n * Default theme. Every text pairing passes WCAG AAA (7:1) — fg/surface,\n * fg/bg, fgMuted/surface, brandFg/brand, surface/fg (the on-scrim guidance) —\n * and every UI accent passes 3:1 on surface (see test/contrast.test.ts).\n */\nexport const DEFAULT_THEME: Required<SekyroTheme> & { colors: SekyroThemeColors } = {\n colors: {\n brand: \"#1e40af\",\n brandFg: \"#ffffff\",\n fg: \"#111827\",\n fgMuted: \"#4b5563\",\n bg: \"#f8fafc\",\n surface: \"#ffffff\",\n ring: \"#1e40af\",\n danger: \"#b91c1c\",\n success: \"#15803d\",\n warning: \"#a16207\",\n },\n radius: \"12px\",\n fontFamily:\n 'system-ui, -apple-system, \"Segoe UI\", Roboto, \"Noto Sans Arabic\", \"Noto Sans\", sans-serif',\n};\n\nconst COLOR_VAR: Record<keyof SekyroThemeColors, string> = {\n brand: \"--sekyro-color-brand\",\n brandFg: \"--sekyro-color-brand-fg\",\n fg: \"--sekyro-color-fg\",\n fgMuted: \"--sekyro-color-fg-muted\",\n bg: \"--sekyro-color-bg\",\n surface: \"--sekyro-color-surface\",\n ring: \"--sekyro-color-ring\",\n danger: \"--sekyro-color-danger\",\n success: \"--sekyro-color-success\",\n warning: \"--sekyro-color-warning\",\n};\n\n/** The CSS custom properties a theme resolves to (defaults filled in). */\nexport function themeToCssVars(theme: SekyroTheme = {}): Record<string, string> {\n const vars: Record<string, string> = {};\n for (const key of Object.keys(COLOR_VAR) as (keyof SekyroThemeColors)[]) {\n vars[COLOR_VAR[key]] = theme.colors?.[key] ?? DEFAULT_THEME.colors[key];\n }\n vars[\"--sekyro-radius\"] = theme.radius ?? DEFAULT_THEME.radius;\n vars[\"--sekyro-font\"] = theme.fontFamily ?? DEFAULT_THEME.fontFamily;\n return vars;\n}\n\n/** Props of {@link SekyroThemeProvider}. */\nexport interface SekyroThemeProviderProps {\n /** Partial theme; unset tokens keep the {@link DEFAULT_THEME} values. */\n theme?: SekyroTheme;\n /** The subtree that reads the tokens. */\n children: ReactNode;\n /** Extra class on the wrapper (layout hooks for the host). */\n className?: string;\n}\n\n/**\n * Writes the theme's CSS variables on a wrapper `<div class=\"sekyro-root\">`.\n * Nest inside your own layout; import `@sekyro/react/styles.css` once.\n */\nexport function SekyroThemeProvider({ theme, children, className }: SekyroThemeProviderProps) {\n const style = themeToCssVars(theme) as CSSProperties;\n return (\n <div className={className === undefined ? \"sekyro-root\" : `sekyro-root ${className}`} style={style}>\n {children}\n </div>\n );\n}\n"],"mappings":";gHAoBA,OACE,eAGA,eAAAA,aACA,aAAAC,WACA,WAAAC,SACA,UAAAC,QACA,YAAAC,cACK,QC1BP,OAAoC,eAAkB,QAiB7C,mCAPF,IAAM,OAAS,WAA2C,gBAC/D,CAAE,KAAO,UAAW,KAAO,GAAO,UAAW,KAAM,GAAG,IAAK,EAC3D,IACA,CACA,IAAM,QAAU,CAAC,aAAc,eAAe,IAAI,EAAE,EACpD,OAAI,MAAM,QAAQ,KAAK,kBAAkB,EACrC,YAAc,QAAW,QAAQ,KAAK,SAAS,EAC5C,IAAC,UAAO,IAAU,KAAM,MAAQ,SAAU,UAAW,QAAQ,KAAK,GAAG,EAAI,GAAG,KAAM,CAC3F,EARiE,SAQhE,ECgGK,cAAAC,KASA,SATA,oBAvEN,IAAM,MAAQ,MAAM,KAAK,CAAE,OAAQ,EAAU,EAAG,CAAC,EAAG,IAAM,CACxD,IAAM,MAAS,EAAI,GAAa,EAAI,KAAK,GAAK,KAAK,GAAK,EAClD,IAAM,KAAK,IAAI,KAAK,EACpB,IAAM,KAAK,IAAI,KAAK,EAC1B,MAAO,CACL,GAAI,QAAQ,C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AAI,UACJ,QAAS,UACT,KAAM,UACN,OAAQ,UACR,QAAS,UACT,QAAS,SACX,EACA,OAAQ,OACR,WACE,2FACJ,EAEM,UAAqD,CACzD,MAAO,uBACP,QAAS,0BACT,GAAI,oBACJ,QAAS,0BACT,GAAI,oBACJ,QAAS,yBACT,KAAM,sBACN,OAAQ,wBACR,QAAS,yBACT,QAAS,wBACX,EAGO,SAAS,eAAe,MAAqB,CAAC,EAA2B,CAC9E,IAAM,KAA+B,CAAC,EACtC,QAAW,OAAO,OAAO,KAAK,SAAS,EACrC,KAAK,UAAU,GAAG,CAAC,EAAI,MAAM,SAAS,GAAG,GAAK,cAAc,OAAO,GAAG,EAExE,YAAK,iBAAiB,EAAI,MAAM,QAAU,cAAc,OACxD,KAAK,eAAe,EAAI,MAAM,YAAc,cAAc,WACnD,IACT,CARgB,wCAwBT,SAAS,oBAAoB,CAAE,MAAO,SAAU,SAAU,EAA6B,CAC5F,IAAM,MAAQ,eAAe,KAAK,EAClC,OACEA,MAAC,OAAI,UAAW,YAAc,OAAY,cAAgB,eAAe,SAAS,GAAI,MACnF,SACH,CAEJ,CAPgB","names":["useCallback","useEffect","useMemo","useRef","useState","jsx","jsx","jsx","jsxs","jsx","jsxs","useEffect","useRef","jsx","jsx","jsxs","jsx","jsxs","useEffect","jsx","jsxs","useEffect","useId","jsx","jsxs","BUILT_IN","useId","jsx","jsxs","Fragment","jsx","jsxs","useRef","useEffect","useEffect","useState","useState","useEffect","useCallback","useCallback","useCallback","useEffect","useRef","useState","useCallback","useState","useRef","useEffect","useCallback","useEffect","useRef","useState","useRef","useState","useEffect","useCallback","options","jsx","useCallback","useEffect","useRef","useState","useEffect","useState","useRef","useCallback","Fragment","jsx","jsxs","useMemo","useRef","useState","useEffect","useCallback","jsx"]}
|