@sekyro/web 0.1.0-rc.18 → 0.1.0-rc.19

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.
Files changed (55) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +1 -2
  3. package/dist/{capture-session-doc-IE5VPYWC.js → capture-session-doc-VXWWQEP4.js} +1 -1
  4. package/dist/{capture-session-v3-Dxus1Se9.d.ts → capture-session-v3-CFSVWYzi.d.ts} +13 -2
  5. package/dist/{capture-session-v3-DyUA2uCL.d.cts → capture-session-v3-Cs4yV3HJ.d.cts} +13 -2
  6. package/dist/chunk-4GJXUVZK.js +1 -0
  7. package/dist/chunk-5Y3UST3W.js +1 -0
  8. package/dist/{chunk-JDTZK3A7.js → chunk-64V55KD7.js} +1 -1
  9. package/dist/chunk-6K4D3U6Q.js +1 -0
  10. package/dist/chunk-CQ7SKLMC.js +1 -0
  11. package/dist/{chunk-DNB3R4PI.js → chunk-JUEOHNVW.js} +1 -1
  12. package/dist/chunk-L45YTRJJ.js +1 -0
  13. package/dist/chunk-PLH6ZR6J.js +1 -0
  14. package/dist/chunk-RNJA5GDF.js +1 -0
  15. package/dist/chunk-ZO6IHP2I.js +1 -0
  16. package/dist/chunk-ZPXL26BF.js +1 -0
  17. package/dist/client/index.cjs +1 -1
  18. package/dist/client/index.d.cts +4 -4
  19. package/dist/client/index.d.ts +4 -4
  20. package/dist/client/index.js +1 -1
  21. package/dist/core/index.cjs +1 -1
  22. package/dist/core/index.d.cts +3 -3
  23. package/dist/core/index.d.ts +3 -3
  24. package/dist/core/index.js +1 -1
  25. package/dist/create-document-capture-FVSQPUF6.js +1 -0
  26. package/dist/create-portrait-capture-INDCF65X.js +1 -0
  27. package/dist/{create-verification-DiH7QRdv.d.cts → create-verification-1BrMZqPJ.d.cts} +67 -15
  28. package/dist/{create-verification-C_fx3n4A.d.ts → create-verification-CuoYJ3kj.d.ts} +67 -15
  29. package/dist/{icao-gate-5FzqyitT.d.ts → icao-gate-BSbyqLUh.d.ts} +25 -9
  30. package/dist/{icao-gate-C-lfjEpH.d.cts → icao-gate-D-wePfoV.d.cts} +25 -9
  31. package/dist/index.cjs +1 -1
  32. package/dist/index.d.cts +6 -6
  33. package/dist/index.d.ts +6 -6
  34. package/dist/index.js +1 -1
  35. package/dist/internal/index.cjs +1 -1
  36. package/dist/internal/index.d.cts +6 -6
  37. package/dist/internal/index.d.ts +6 -6
  38. package/dist/internal/index.js +1 -1
  39. package/dist/plan-runner-WEUIMCYU.js +1 -0
  40. package/dist/{types-CKgMWVnP.d.cts → types-DPl0hsmI.d.cts} +29 -5
  41. package/dist/{types-CKgMWVnP.d.ts → types-DPl0hsmI.d.ts} +29 -5
  42. package/package.json +1 -1
  43. package/sbom.cdx.json +7 -7
  44. package/dist/chunk-2BFYVMUU.js +0 -1
  45. package/dist/chunk-D42NBRSV.js +0 -1
  46. package/dist/chunk-G2HL2ZWH.js +0 -1
  47. package/dist/chunk-G6MU3B5V.js +0 -1
  48. package/dist/chunk-KBKCYDZQ.js +0 -1
  49. package/dist/chunk-OG4QAJ3M.js +0 -1
  50. package/dist/chunk-SVNAHPQU.js +0 -1
  51. package/dist/chunk-VCUOPQFA.js +0 -1
  52. package/dist/chunk-ZMO2ZQAS.js +0 -1
  53. package/dist/create-document-capture-35HFVNC3.js +0 -1
  54. package/dist/create-portrait-capture-53XBURNT.js +0 -1
  55. package/dist/plan-runner-YXTOSPDP.js +0 -1
@@ -1,11 +1,11 @@
1
- import { a_ as DocCatalogEntry, a$ as LiveMrzTuning, b0 as TextLockTuning, b1 as OcrEngineClient, b2 as DocAssistReport, b3 as ReadyInfo, b4 as LoadFailure, b5 as OcrEngineOptions, b6 as SubmitRuntime, a1 as LivenessCaptureOptions, a0 as LivenessCaptureHandle, aJ as VerificationStep, aH as VerificationResult, ay as StepSnapshot, Y as LivePhotoGateUpdate, b7 as HostedClientLike } from '../create-verification-DiH7QRdv.cjs';
2
- export { b8 as ANALYSIS_LONG_EDGE, b9 as ASPECT_BANDS, ba as AttestationError, bb as BLUR_REFUSE_SHARPNESS_MAX, bc as BlurStatus, bd as CAPTURE_CANDIDATE_SPACING_MS, be as CAPTURE_EXTRA_CANDIDATES, bf as CLIP_MIME_ALLOWLIST, bg as CaptureEngine, bh as CaptureSessionDoc, bi as CaptureSessionDocEvents, bj as CaptureSessionDocOptions, bk as DOC_ANALYSIS_DEFAULTS, bl as DOC_BLACK_FRAME_LUMA, bm as DOC_BLACK_FRAME_TICKS, bn as DOC_CADENCE_HZ, bo as DOC_CAMERA_TUNING_DEFAULTS, bp as DOC_CATALOG, bq as DOC_DETECT_WIDTH, br as DOC_FEEDBACK_STATES, bs as DOC_FIRST_FRAME_MS, bt as DOC_GATE_V1_DEFAULTS, bu as DOC_SHUTTER_DEFAULTS, bv as DeviceReadHint, bw as DocArtifacts, bx as DocAssist, by as DocAssistEngine, bz as DocAssistTick, bA as DocCameraTuning, bB as DocCaptureReport, bC as DocCaptureVia, bD as DocChecksPayload, bE as DocEngineLike, bF as DocFeedbackAggregator, bG as DocFeedbackKey, bH as DocFeedbackState, bI as DocFormat, bJ as DocFrameAnalysis, bK as DocFrameMeasures, bL as DocGateQuality, bM as DocGateThresholds, bN as DocGateTick, bO as DocGateTickInput, bP as DocGateV1, bQ as DocQuad, bR as DocQuadPoint, bS as DocShutterReason, bT as DocShutterTuning, bU as DocSide, bV as DocumentCaptureController, bW as DocumentCaptureInternals, bX as EMPTY_GUIDE_METRICS, bY as EncodedDocument, bZ as FLIP_FILL_MIN, b_ as FLIP_GAP_MS, b$ as FLIP_TIMEOUT_MS, c0 as FocusCaps, c1 as FramingStatus, c2 as GUIDE_LOCK_DEFAULTS, c3 as GlareStatus, c4 as GrabbedFrame, c5 as GuideBlocker, c6 as GuideLock, c7 as GuideLockTick, c8 as GuideLockTuning, c9 as GuideMetrics, ca as GuideRect, cb as INFERENCE_RETRY_ATTEMPTS, cc as INFERENCE_RETRY_DEFAULT_S, U as ISSUER_CODES, cd as LANDMARKER_MODEL, ce as LENS_STORAGE_KEY, cf as LENS_TRY_MAX, cg as LIVE_MRZ_DEFAULTS, ch as LIVE_PHOTO_IDLE_MS, ci as LIVE_PHOTO_MAX_HZ, cj as LandmarkedFace, ck as LandmarkerLike, cl as LensKind, cm as LensSource, cn as LightingStatus, co as LiveMrzCapture, cp as LiveMrzState, cq as LivePhotoGate, cr as LivePhotoKit, cs as LivePhotoKitInternals, ct as LivePhotoKitOptions, cu as LivePhotoStill, cv as LivenessCaptureInternalHandle, cw as LivenessCaptureInternals, cx as LivenessFlowDeps, cy as LivenessFlowOutcome, cz as MANUAL_SHUTTER_MS, cA as MR_DOC_CATALOG, cB as NO_REPORT_MS, cC as OpenDocCameraDeps, cD as PORTRAIT_JPEG_QUALITY, cE as PRELOAD_BLAZE_INIT_TIMEOUT_MS, cF as PRELOAD_BUDGET_MS, cG as PROCESSING_POLL_DELAY_MS, cH as PROCESSING_POLL_MAX, cI as PortraitCaptureController, cJ as PortraitCaptureInternals, cK as REGISTRY_RETRY_DELAY_MS, cL as ReticleType, cM as SAME_FACE_MAX_DROPS, cN as ScanEvent, cO as ScanLayout, cP as ScanNotice, cQ as ScanPhase, cR as ScanReport, cS as ScanSide, cT as ScanState, cU as SubmitExecutor, cV as TEXT_LOCK_DEFAULTS, cW as TRANSPORT_REPLAY_ATTEMPTS, cX as TRANSPORT_REPLAY_DELAY_MS, cY as VerificationInternals, cZ as analyzeDocFrame, c_ as analyzeGuide, c$ as aspectBand, d0 as aspectFits, d1 as buildDeviceReadHint, d2 as coverPointToVideo, d3 as createDocumentCaptureInternal, d4 as createFaceLandmarker, d5 as createLivePhotoKit, d6 as createLivenessCaptureInternal, d7 as createPortraitCaptureInternal, d8 as createVerificationInternal, d9 as docZoomFor, da as encodeDocumentImage, db as facesOf, dc as feedbackVoteOf, dd as focusOk, de as guideQuad, df as guideRegionInFrame, dg as initialScanState, dh as lensKindOf, di as mapEngineState, dj as mapErrorKind, dk as mapGuidanceHint, dl as nextScanState, dm as observePortraitFrame, dn as openDocCamera, dp as passportBandOf, dq as portraitMatchStep, dr as preloadedDetectorFactory, ds as quadAreaFrac, dt as quadBounds, du as quadIou, dv as quadTiltRatio, dw as randomUuid, dx as rankBackCameras, dy as readStoredLens, dz as resetLivenessAssetsForTests, dA as resolveDocCameraTuning, dB as resolveDocShutterTuning, dC as resolveGuideLockTuning, dD as runLivenessFlow, dE as runSubmission, dF as scannerFormatFor, dG as setPreloadLoaderForTests, dH as settledHint, dI as singleShotFocusAt, dJ as specularFraction, dK as supportsFocusMode, dL as warmDocDetector, dM as writeStoredLens } from '../create-verification-DiH7QRdv.cjs';
1
+ import { b0 as DocCatalogEntry, b1 as LiveMrzTuning, b2 as TextLockTuning, b3 as OcrEngineClient, b4 as DocAssistReport, b5 as ReadyInfo, b6 as LoadFailure, b7 as OcrEngineOptions, b8 as SubmitRuntime, a3 as LivenessCaptureOptions, a2 as LivenessCaptureHandle, aL as VerificationStep, aJ as VerificationResult, aA as StepSnapshot, _ as LivePhotoGateUpdate, b9 as HostedClientLike } from '../create-verification-1BrMZqPJ.cjs';
2
+ export { ba as ANALYSIS_LONG_EDGE, bb as ASPECT_BANDS, bc as AttestationError, bd as BLUR_REFUSE_SHARPNESS_MAX, be as BlurStatus, bf as CAPTURE_CANDIDATE_SPACING_MS, bg as CAPTURE_EXTRA_CANDIDATES, bh as CLIP_MIME_ALLOWLIST, bi as CaptureEngine, bj as CaptureSessionDoc, bk as CaptureSessionDocEvents, bl as CaptureSessionDocOptions, bm as DOC_ANALYSIS_DEFAULTS, bn as DOC_BLACK_FRAME_LUMA, bo as DOC_BLACK_FRAME_TICKS, bp as DOC_CADENCE_HZ, bq as DOC_CAMERA_TUNING_DEFAULTS, br as DOC_CATALOG, bs as DOC_DETECT_WIDTH, bt as DOC_FEEDBACK_STATES, bu as DOC_FIRST_FRAME_MS, bv as DOC_GATE_V1_DEFAULTS, bw as DOC_SHUTTER_DEFAULTS, bx as DeviceReadHint, by as DocArtifacts, bz as DocAssist, bA as DocAssistEngine, bB as DocAssistTick, bC as DocCameraTuning, bD as DocCaptureReport, bE as DocCaptureVia, bF as DocChecksPayload, bG as DocEngineLike, bH as DocFeedbackAggregator, bI as DocFeedbackKey, bJ as DocFeedbackState, bK as DocFormat, bL as DocFrameAnalysis, bM as DocFrameMeasures, bN as DocGateQuality, bO as DocGateThresholds, bP as DocGateTick, bQ as DocGateTickInput, bR as DocGateV1, bS as DocQuad, bT as DocQuadPoint, bU as DocShutterReason, bV as DocShutterTuning, bW as DocSide, bX as DocumentCaptureController, bY as DocumentCaptureInternals, bZ as EMPTY_GUIDE_METRICS, b_ as EncodedDocument, b$ as FLIP_FILL_MIN, c0 as FLIP_GAP_MS, c1 as FLIP_TIMEOUT_MS, c2 as FocusCaps, c3 as FramingStatus, c4 as GUIDE_LOCK_DEFAULTS, c5 as GlareStatus, c6 as GrabbedFrame, c7 as GuideBlocker, c8 as GuideLock, c9 as GuideLockTick, ca as GuideLockTuning, cb as GuideMetrics, cc as GuideRect, cd as INFERENCE_RETRY_ATTEMPTS, ce as INFERENCE_RETRY_DEFAULT_S, W as ISSUER_CODES, cf as LANDMARKER_MODEL, cg as LENS_STORAGE_KEY, ch as LENS_TRY_MAX, ci as LIVE_MRZ_DEFAULTS, cj as LIVE_PHOTO_IDLE_MS, ck as LIVE_PHOTO_MAX_HZ, cl as LandmarkedFace, cm as LandmarkerLike, cn as LensKind, co as LensSource, cp as LightingStatus, cq as LiveMrzCapture, cr as LiveMrzState, cs as LivePhotoGate, ct as LivePhotoKit, cu as LivePhotoKitInternals, cv as LivePhotoKitOptions, cw as LivePhotoStill, cx as LivenessCaptureInternalHandle, cy as LivenessCaptureInternals, cz as LivenessFlowDeps, cA as LivenessFlowOutcome, cB as MANUAL_SHUTTER_MS, cC as MR_DOC_CATALOG, cD as NO_REPORT_MS, cE as OpenDocCameraDeps, cF as PORTRAIT_JPEG_QUALITY, cG as PRELOAD_BLAZE_INIT_TIMEOUT_MS, cH as PRELOAD_BUDGET_MS, cI as PROCESSING_POLL_DELAY_MS, cJ as PROCESSING_POLL_MAX, cK as PortraitCaptureController, cL as PortraitCaptureInternals, cM as REGISTRY_RETRY_DELAY_MS, cN as ReticleType, cO as SAME_FACE_MAX_DROPS, cP as ScanEvent, cQ as ScanLayout, cR as ScanNotice, cS as ScanPhase, cT as ScanReport, cU as ScanSide, cV as ScanState, cW as SubmitExecutor, cX as TEXT_LOCK_DEFAULTS, cY as TRANSPORT_REPLAY_ATTEMPTS, cZ as TRANSPORT_REPLAY_DELAY_MS, c_ as VerificationInternals, c$ as analyzeDocFrame, d0 as analyzeGuide, d1 as aspectBand, d2 as aspectFits, d3 as buildDeviceReadHint, d4 as coverPointToVideo, d5 as createDocumentCaptureInternal, d6 as createFaceLandmarker, d7 as createLivePhotoKit, d8 as createLivenessCaptureInternal, d9 as createPortraitCaptureInternal, da as createVerificationInternal, db as docZoomFor, dc as encodeDocumentImage, dd as facesOf, de as feedbackVoteOf, df as focusOk, dg as guideQuad, dh as guideRegionInFrame, di as initialScanState, dj as lensKindOf, dk as mapEngineState, dl as mapErrorKind, dm as mapGuidanceHint, dn as nextScanState, dp as observePortraitFrame, dq as openDocCamera, dr as passportBandOf, ds as portraitMatchStep, dt as preloadedDetectorFactory, du as quadAreaFrac, dv as quadBounds, dw as quadIou, dx as quadTiltRatio, dy as randomUuid, dz as rankBackCameras, dA as readStoredLens, dB as resetLivenessAssetsForTests, dC as resolveDocCameraTuning, dD as resolveDocShutterTuning, dE as resolveGuideLockTuning, dF as runLivenessFlow, dG as runSubmission, dH as scannerFormatFor, dI as setPreloadLoaderForTests, dJ as settledHint, dK as singleShotFocusAt, dL as specularFraction, dM as supportsFocusMode, dN as warmDocDetector, dO as writeStoredLens } from '../create-verification-1BrMZqPJ.cjs';
3
3
  export { C as CENTERED_FACTOR, a as CIRCLE_RADIUS_FACTOR, F as FormFactor, I as IN_CIRCLE_FACTOR, d as detectFormFactor, c as detectIsMobile } from '../capture-constraints-B5omafmk.cjs';
4
- import { H as HostedSessionView, e as CheckType, k as CheckReason, ag as PlanStepView } from '../types-CKgMWVnP.cjs';
5
- export { av as ICAO_FALLBACK, Y as IcaoCaptureTuning, aw as IcaoProfile, R as ResolvedIcaoTuning, ax as resolveIcaoTuning } from '../types-CKgMWVnP.cjs';
6
- export { B as BackgroundStats, e as Box, C as CLIPPED_LUMA, F as FaceGeometry, f as FaceLighting, H as HeadPose, g as ICAO_CANVAS, h as ICAO_GATE_CRITERIA, i as ICAO_SHARP_REF, I as IcaoCoachKey, a as IcaoCriterionState, j as IcaoFrameObservation, k as IcaoGate, b as IcaoGateCriterion, l as IcaoGateOptions, c as IcaoGateSummary, d as IcaoGateUpdate, m as IcaoJudgedCriterion, n as IcaoMeasures, o as IcaoPixelStats, L as LumaPlane, P as Point, R as RegionStats, p as backgroundStats, q as createIcaoGate, r as eyeLineRoll, s as eyeOpenness, t as eyeSpecular, u as faceGeometry, v as faceLighting, w as faceSharpness, x as icaoPixelStats, y as icaoWindow, z as judgeIcao, A as lumaPlane, D as percentile, E as portraitCropRegion, G as poseFromMatrix, J as regionStats, K as scoreFrame, M as windowOverflow } from '../icao-gate-C-lfjEpH.cjs';
4
+ import { H as HostedSessionView, f as CheckType, l as CheckReason, ah as PlanStepView } from '../types-DPl0hsmI.cjs';
5
+ export { ax as ICAO_FALLBACK, Z as IcaoCaptureTuning, ay as IcaoProfile, R as ResolvedIcaoTuning, az as resolveIcaoTuning } from '../types-DPl0hsmI.cjs';
6
+ export { B as BackgroundStats, e as Box, C as CLIPPED_LUMA, F as FaceGeometry, f as FaceLighting, H as HeadPose, g as ICAO_CANVAS, h as ICAO_GATE_CRITERIA, i as ICAO_SHARP_REF, I as IcaoCoachKey, a as IcaoCriterionState, j as IcaoFrameObservation, k as IcaoGate, b as IcaoGateCriterion, l as IcaoGateOptions, c as IcaoGateSummary, d as IcaoGateUpdate, m as IcaoJudgedCriterion, n as IcaoMeasures, o as IcaoPixelStats, L as LumaPlane, P as Point, R as RegionStats, p as backgroundStats, q as createIcaoGate, r as eyeLineRoll, s as eyeOpenness, t as eyeSpecular, u as faceGeometry, v as faceLighting, w as faceSharpness, x as icaoPixelStats, y as icaoWindow, z as judgeIcao, A as lumaPlane, D as percentile, E as portraitCropRegion, G as poseFromMatrix, J as regionStats, K as scoreFrame, M as windowOverflow } from '../icao-gate-D-wePfoV.cjs';
7
7
  import '../detect-worker-DclNxkZT.cjs';
8
- import '../capture-session-v3-DyUA2uCL.cjs';
8
+ import '../capture-session-v3-Cs4yV3HJ.cjs';
9
9
 
10
10
  type DocumentTypeId = DocCatalogEntry["docType"];
11
11
  /** Same shape as the hosted view's `acceptedDocuments`. */
@@ -1,11 +1,11 @@
1
- import { a_ as DocCatalogEntry, a$ as LiveMrzTuning, b0 as TextLockTuning, b1 as OcrEngineClient, b2 as DocAssistReport, b3 as ReadyInfo, b4 as LoadFailure, b5 as OcrEngineOptions, b6 as SubmitRuntime, a1 as LivenessCaptureOptions, a0 as LivenessCaptureHandle, aJ as VerificationStep, aH as VerificationResult, ay as StepSnapshot, Y as LivePhotoGateUpdate, b7 as HostedClientLike } from '../create-verification-C_fx3n4A.js';
2
- export { b8 as ANALYSIS_LONG_EDGE, b9 as ASPECT_BANDS, ba as AttestationError, bb as BLUR_REFUSE_SHARPNESS_MAX, bc as BlurStatus, bd as CAPTURE_CANDIDATE_SPACING_MS, be as CAPTURE_EXTRA_CANDIDATES, bf as CLIP_MIME_ALLOWLIST, bg as CaptureEngine, bh as CaptureSessionDoc, bi as CaptureSessionDocEvents, bj as CaptureSessionDocOptions, bk as DOC_ANALYSIS_DEFAULTS, bl as DOC_BLACK_FRAME_LUMA, bm as DOC_BLACK_FRAME_TICKS, bn as DOC_CADENCE_HZ, bo as DOC_CAMERA_TUNING_DEFAULTS, bp as DOC_CATALOG, bq as DOC_DETECT_WIDTH, br as DOC_FEEDBACK_STATES, bs as DOC_FIRST_FRAME_MS, bt as DOC_GATE_V1_DEFAULTS, bu as DOC_SHUTTER_DEFAULTS, bv as DeviceReadHint, bw as DocArtifacts, bx as DocAssist, by as DocAssistEngine, bz as DocAssistTick, bA as DocCameraTuning, bB as DocCaptureReport, bC as DocCaptureVia, bD as DocChecksPayload, bE as DocEngineLike, bF as DocFeedbackAggregator, bG as DocFeedbackKey, bH as DocFeedbackState, bI as DocFormat, bJ as DocFrameAnalysis, bK as DocFrameMeasures, bL as DocGateQuality, bM as DocGateThresholds, bN as DocGateTick, bO as DocGateTickInput, bP as DocGateV1, bQ as DocQuad, bR as DocQuadPoint, bS as DocShutterReason, bT as DocShutterTuning, bU as DocSide, bV as DocumentCaptureController, bW as DocumentCaptureInternals, bX as EMPTY_GUIDE_METRICS, bY as EncodedDocument, bZ as FLIP_FILL_MIN, b_ as FLIP_GAP_MS, b$ as FLIP_TIMEOUT_MS, c0 as FocusCaps, c1 as FramingStatus, c2 as GUIDE_LOCK_DEFAULTS, c3 as GlareStatus, c4 as GrabbedFrame, c5 as GuideBlocker, c6 as GuideLock, c7 as GuideLockTick, c8 as GuideLockTuning, c9 as GuideMetrics, ca as GuideRect, cb as INFERENCE_RETRY_ATTEMPTS, cc as INFERENCE_RETRY_DEFAULT_S, U as ISSUER_CODES, cd as LANDMARKER_MODEL, ce as LENS_STORAGE_KEY, cf as LENS_TRY_MAX, cg as LIVE_MRZ_DEFAULTS, ch as LIVE_PHOTO_IDLE_MS, ci as LIVE_PHOTO_MAX_HZ, cj as LandmarkedFace, ck as LandmarkerLike, cl as LensKind, cm as LensSource, cn as LightingStatus, co as LiveMrzCapture, cp as LiveMrzState, cq as LivePhotoGate, cr as LivePhotoKit, cs as LivePhotoKitInternals, ct as LivePhotoKitOptions, cu as LivePhotoStill, cv as LivenessCaptureInternalHandle, cw as LivenessCaptureInternals, cx as LivenessFlowDeps, cy as LivenessFlowOutcome, cz as MANUAL_SHUTTER_MS, cA as MR_DOC_CATALOG, cB as NO_REPORT_MS, cC as OpenDocCameraDeps, cD as PORTRAIT_JPEG_QUALITY, cE as PRELOAD_BLAZE_INIT_TIMEOUT_MS, cF as PRELOAD_BUDGET_MS, cG as PROCESSING_POLL_DELAY_MS, cH as PROCESSING_POLL_MAX, cI as PortraitCaptureController, cJ as PortraitCaptureInternals, cK as REGISTRY_RETRY_DELAY_MS, cL as ReticleType, cM as SAME_FACE_MAX_DROPS, cN as ScanEvent, cO as ScanLayout, cP as ScanNotice, cQ as ScanPhase, cR as ScanReport, cS as ScanSide, cT as ScanState, cU as SubmitExecutor, cV as TEXT_LOCK_DEFAULTS, cW as TRANSPORT_REPLAY_ATTEMPTS, cX as TRANSPORT_REPLAY_DELAY_MS, cY as VerificationInternals, cZ as analyzeDocFrame, c_ as analyzeGuide, c$ as aspectBand, d0 as aspectFits, d1 as buildDeviceReadHint, d2 as coverPointToVideo, d3 as createDocumentCaptureInternal, d4 as createFaceLandmarker, d5 as createLivePhotoKit, d6 as createLivenessCaptureInternal, d7 as createPortraitCaptureInternal, d8 as createVerificationInternal, d9 as docZoomFor, da as encodeDocumentImage, db as facesOf, dc as feedbackVoteOf, dd as focusOk, de as guideQuad, df as guideRegionInFrame, dg as initialScanState, dh as lensKindOf, di as mapEngineState, dj as mapErrorKind, dk as mapGuidanceHint, dl as nextScanState, dm as observePortraitFrame, dn as openDocCamera, dp as passportBandOf, dq as portraitMatchStep, dr as preloadedDetectorFactory, ds as quadAreaFrac, dt as quadBounds, du as quadIou, dv as quadTiltRatio, dw as randomUuid, dx as rankBackCameras, dy as readStoredLens, dz as resetLivenessAssetsForTests, dA as resolveDocCameraTuning, dB as resolveDocShutterTuning, dC as resolveGuideLockTuning, dD as runLivenessFlow, dE as runSubmission, dF as scannerFormatFor, dG as setPreloadLoaderForTests, dH as settledHint, dI as singleShotFocusAt, dJ as specularFraction, dK as supportsFocusMode, dL as warmDocDetector, dM as writeStoredLens } from '../create-verification-C_fx3n4A.js';
1
+ import { b0 as DocCatalogEntry, b1 as LiveMrzTuning, b2 as TextLockTuning, b3 as OcrEngineClient, b4 as DocAssistReport, b5 as ReadyInfo, b6 as LoadFailure, b7 as OcrEngineOptions, b8 as SubmitRuntime, a3 as LivenessCaptureOptions, a2 as LivenessCaptureHandle, aL as VerificationStep, aJ as VerificationResult, aA as StepSnapshot, _ as LivePhotoGateUpdate, b9 as HostedClientLike } from '../create-verification-CuoYJ3kj.js';
2
+ export { ba as ANALYSIS_LONG_EDGE, bb as ASPECT_BANDS, bc as AttestationError, bd as BLUR_REFUSE_SHARPNESS_MAX, be as BlurStatus, bf as CAPTURE_CANDIDATE_SPACING_MS, bg as CAPTURE_EXTRA_CANDIDATES, bh as CLIP_MIME_ALLOWLIST, bi as CaptureEngine, bj as CaptureSessionDoc, bk as CaptureSessionDocEvents, bl as CaptureSessionDocOptions, bm as DOC_ANALYSIS_DEFAULTS, bn as DOC_BLACK_FRAME_LUMA, bo as DOC_BLACK_FRAME_TICKS, bp as DOC_CADENCE_HZ, bq as DOC_CAMERA_TUNING_DEFAULTS, br as DOC_CATALOG, bs as DOC_DETECT_WIDTH, bt as DOC_FEEDBACK_STATES, bu as DOC_FIRST_FRAME_MS, bv as DOC_GATE_V1_DEFAULTS, bw as DOC_SHUTTER_DEFAULTS, bx as DeviceReadHint, by as DocArtifacts, bz as DocAssist, bA as DocAssistEngine, bB as DocAssistTick, bC as DocCameraTuning, bD as DocCaptureReport, bE as DocCaptureVia, bF as DocChecksPayload, bG as DocEngineLike, bH as DocFeedbackAggregator, bI as DocFeedbackKey, bJ as DocFeedbackState, bK as DocFormat, bL as DocFrameAnalysis, bM as DocFrameMeasures, bN as DocGateQuality, bO as DocGateThresholds, bP as DocGateTick, bQ as DocGateTickInput, bR as DocGateV1, bS as DocQuad, bT as DocQuadPoint, bU as DocShutterReason, bV as DocShutterTuning, bW as DocSide, bX as DocumentCaptureController, bY as DocumentCaptureInternals, bZ as EMPTY_GUIDE_METRICS, b_ as EncodedDocument, b$ as FLIP_FILL_MIN, c0 as FLIP_GAP_MS, c1 as FLIP_TIMEOUT_MS, c2 as FocusCaps, c3 as FramingStatus, c4 as GUIDE_LOCK_DEFAULTS, c5 as GlareStatus, c6 as GrabbedFrame, c7 as GuideBlocker, c8 as GuideLock, c9 as GuideLockTick, ca as GuideLockTuning, cb as GuideMetrics, cc as GuideRect, cd as INFERENCE_RETRY_ATTEMPTS, ce as INFERENCE_RETRY_DEFAULT_S, W as ISSUER_CODES, cf as LANDMARKER_MODEL, cg as LENS_STORAGE_KEY, ch as LENS_TRY_MAX, ci as LIVE_MRZ_DEFAULTS, cj as LIVE_PHOTO_IDLE_MS, ck as LIVE_PHOTO_MAX_HZ, cl as LandmarkedFace, cm as LandmarkerLike, cn as LensKind, co as LensSource, cp as LightingStatus, cq as LiveMrzCapture, cr as LiveMrzState, cs as LivePhotoGate, ct as LivePhotoKit, cu as LivePhotoKitInternals, cv as LivePhotoKitOptions, cw as LivePhotoStill, cx as LivenessCaptureInternalHandle, cy as LivenessCaptureInternals, cz as LivenessFlowDeps, cA as LivenessFlowOutcome, cB as MANUAL_SHUTTER_MS, cC as MR_DOC_CATALOG, cD as NO_REPORT_MS, cE as OpenDocCameraDeps, cF as PORTRAIT_JPEG_QUALITY, cG as PRELOAD_BLAZE_INIT_TIMEOUT_MS, cH as PRELOAD_BUDGET_MS, cI as PROCESSING_POLL_DELAY_MS, cJ as PROCESSING_POLL_MAX, cK as PortraitCaptureController, cL as PortraitCaptureInternals, cM as REGISTRY_RETRY_DELAY_MS, cN as ReticleType, cO as SAME_FACE_MAX_DROPS, cP as ScanEvent, cQ as ScanLayout, cR as ScanNotice, cS as ScanPhase, cT as ScanReport, cU as ScanSide, cV as ScanState, cW as SubmitExecutor, cX as TEXT_LOCK_DEFAULTS, cY as TRANSPORT_REPLAY_ATTEMPTS, cZ as TRANSPORT_REPLAY_DELAY_MS, c_ as VerificationInternals, c$ as analyzeDocFrame, d0 as analyzeGuide, d1 as aspectBand, d2 as aspectFits, d3 as buildDeviceReadHint, d4 as coverPointToVideo, d5 as createDocumentCaptureInternal, d6 as createFaceLandmarker, d7 as createLivePhotoKit, d8 as createLivenessCaptureInternal, d9 as createPortraitCaptureInternal, da as createVerificationInternal, db as docZoomFor, dc as encodeDocumentImage, dd as facesOf, de as feedbackVoteOf, df as focusOk, dg as guideQuad, dh as guideRegionInFrame, di as initialScanState, dj as lensKindOf, dk as mapEngineState, dl as mapErrorKind, dm as mapGuidanceHint, dn as nextScanState, dp as observePortraitFrame, dq as openDocCamera, dr as passportBandOf, ds as portraitMatchStep, dt as preloadedDetectorFactory, du as quadAreaFrac, dv as quadBounds, dw as quadIou, dx as quadTiltRatio, dy as randomUuid, dz as rankBackCameras, dA as readStoredLens, dB as resetLivenessAssetsForTests, dC as resolveDocCameraTuning, dD as resolveDocShutterTuning, dE as resolveGuideLockTuning, dF as runLivenessFlow, dG as runSubmission, dH as scannerFormatFor, dI as setPreloadLoaderForTests, dJ as settledHint, dK as singleShotFocusAt, dL as specularFraction, dM as supportsFocusMode, dN as warmDocDetector, dO as writeStoredLens } from '../create-verification-CuoYJ3kj.js';
3
3
  export { C as CENTERED_FACTOR, a as CIRCLE_RADIUS_FACTOR, F as FormFactor, I as IN_CIRCLE_FACTOR, d as detectFormFactor, c as detectIsMobile } from '../capture-constraints-B5omafmk.js';
4
- import { H as HostedSessionView, e as CheckType, k as CheckReason, ag as PlanStepView } from '../types-CKgMWVnP.js';
5
- export { av as ICAO_FALLBACK, Y as IcaoCaptureTuning, aw as IcaoProfile, R as ResolvedIcaoTuning, ax as resolveIcaoTuning } from '../types-CKgMWVnP.js';
6
- export { B as BackgroundStats, e as Box, C as CLIPPED_LUMA, F as FaceGeometry, f as FaceLighting, H as HeadPose, g as ICAO_CANVAS, h as ICAO_GATE_CRITERIA, i as ICAO_SHARP_REF, I as IcaoCoachKey, a as IcaoCriterionState, j as IcaoFrameObservation, k as IcaoGate, b as IcaoGateCriterion, l as IcaoGateOptions, c as IcaoGateSummary, d as IcaoGateUpdate, m as IcaoJudgedCriterion, n as IcaoMeasures, o as IcaoPixelStats, L as LumaPlane, P as Point, R as RegionStats, p as backgroundStats, q as createIcaoGate, r as eyeLineRoll, s as eyeOpenness, t as eyeSpecular, u as faceGeometry, v as faceLighting, w as faceSharpness, x as icaoPixelStats, y as icaoWindow, z as judgeIcao, A as lumaPlane, D as percentile, E as portraitCropRegion, G as poseFromMatrix, J as regionStats, K as scoreFrame, M as windowOverflow } from '../icao-gate-5FzqyitT.js';
4
+ import { H as HostedSessionView, f as CheckType, l as CheckReason, ah as PlanStepView } from '../types-DPl0hsmI.js';
5
+ export { ax as ICAO_FALLBACK, Z as IcaoCaptureTuning, ay as IcaoProfile, R as ResolvedIcaoTuning, az as resolveIcaoTuning } from '../types-DPl0hsmI.js';
6
+ export { B as BackgroundStats, e as Box, C as CLIPPED_LUMA, F as FaceGeometry, f as FaceLighting, H as HeadPose, g as ICAO_CANVAS, h as ICAO_GATE_CRITERIA, i as ICAO_SHARP_REF, I as IcaoCoachKey, a as IcaoCriterionState, j as IcaoFrameObservation, k as IcaoGate, b as IcaoGateCriterion, l as IcaoGateOptions, c as IcaoGateSummary, d as IcaoGateUpdate, m as IcaoJudgedCriterion, n as IcaoMeasures, o as IcaoPixelStats, L as LumaPlane, P as Point, R as RegionStats, p as backgroundStats, q as createIcaoGate, r as eyeLineRoll, s as eyeOpenness, t as eyeSpecular, u as faceGeometry, v as faceLighting, w as faceSharpness, x as icaoPixelStats, y as icaoWindow, z as judgeIcao, A as lumaPlane, D as percentile, E as portraitCropRegion, G as poseFromMatrix, J as regionStats, K as scoreFrame, M as windowOverflow } from '../icao-gate-BSbyqLUh.js';
7
7
  import '../detect-worker-DclNxkZT.js';
8
- import '../capture-session-v3-Dxus1Se9.js';
8
+ import '../capture-session-v3-CFSVWYzi.js';
9
9
 
10
10
  type DocumentTypeId = DocCatalogEntry["docType"];
11
11
  /** Same shape as the hosted view's `acceptedDocuments`. */
@@ -1 +1 @@
1
- import{c as _e,d as Le,e as Re,g as Se,h as Te,i as ce}from"../chunk-G2HL2ZWH.js";import{a as Vt,b as Xt,c as Zt,d as Jt,e as Qt,f as jt,g as qt,h as $t,i as er,j as ae,l as se,n as Ee,o as me}from"../chunk-G6MU3B5V.js";import{b as pe,c as ie,d as ne}from"../chunk-CJHMFPL6.js";import"../chunk-RI3E7GBN.js";import{a as d,b as M,c as F,d as N,e as v}from"../chunk-O5WKNZ2C.js";import{A as yt,B as ft,C as ut,D as Ot,E as At,F as It,G as xt,H as Ct,I as Pt,J as Dt,K as dt,L as Mt,M as Ft,a as We,b as ke,c as Ke,d as Je,e as Qe,f as je,g as qe,h as $e,i as et,j as tt,k as rt,l as ot,m as pt,n as it,o as nt,p as at,q as st,r as Et,s as mt,t as _t,u as Lt,v as Rt,w as St,x as Tt,y as ct,z as lt}from"../chunk-D42NBRSV.js";import{a as Ye,b as He}from"../chunk-SMKCBUJL.js";import{a as Be,b as we,c as ze,d as Ve,e as Xe,f as Ze}from"../chunk-MXWLCDFX.js";import{a as k,b as Fe,c as Ne,d as ve,e as ge,f as be,g as Ge,h as he,i as Ue,j as K,k as B,l as w,m as Z,n as J,o as Q,p as j,q,r as $,s as ee,t as te,u as re,x as oe}from"../chunk-KBKCYDZQ.js";import{a as g,b,c as G,d as h,e as U,f as Y,g as H,h as W,i as z,j as V,l as X}from"../chunk-G6LKLN4U.js";import{a as xe,b as Ce,c as Pe,d as De,e as de,f as Me}from"../chunk-TDLIXFDT.js";import{a as Nt,b as vt,c as gt,d as bt,e as Gt,f as ht,g as Ut,h as Yt,i as Ht,j as Wt,k as kt,l as Kt,m as Bt}from"../chunk-7ZCZY3ZP.js";import{a as wt,b as zt}from"../chunk-BPE5NSQ2.js";import"../chunk-GI3UFGRQ.js";import{b as ye,c as fe,d as ue,e as Oe,g as Ae,h as tr,i as rr,j as or,k as pr,l as ir,m as nr,s as Ie}from"../chunk-SVNAHPQU.js";import{c as S,i as T,j as c,k as l,l as y,o as f,q as u,r as O,s as A,t as I,u as x,v as C,w as P,x as D}from"../chunk-JDTZK3A7.js";import{a as i,b as n,c as a,d as s,i as E,j as m,k as _,l as L,m as R}from"../chunk-VCUOPQFA.js";import"../chunk-GT2ZLGF7.js";import"../chunk-OG4QAJ3M.js";import{c as e,d as t,f as r,g as o,h as p}from"../chunk-FUHDOEBP.js";import"../chunk-POIQGEZM.js";import"../chunk-2BFYVMUU.js";import"../chunk-FPXL63KZ.js";import"../chunk-ZMO2ZQAS.js";import"../chunk-DNB3R4PI.js";import"../chunk-OKWG3PVH.js";import{a as le}from"../chunk-DFTCAWMP.js";import"../chunk-DK5YPBDQ.js";export{ae as ANALYSIS_LONG_EDGE,xe as ASPECT_BANDS,C as AttestationError,Ge as BLUR_REFUSE_SHARPNESS_MAX,Ft as CAPTURE_CANDIDATE_SPACING_MS,Mt as CAPTURE_EXTRA_CANDIDATES,p as CENTERED_FACTOR,r as CIRCLE_RADIUS_FACTOR,Vt as CLIPPED_LUMA,u as CLIP_MIME_ALLOWLIST,Dt as CaptureSessionDoc,rr as DOCUMENT_TYPE_ORDER,Je as DOC_ANALYSIS_DEFAULTS,At as DOC_BLACK_FRAME_LUMA,It as DOC_BLACK_FRAME_TICKS,xt as DOC_CADENCE_HZ,$e as DOC_CAMERA_TUNING_DEFAULTS,de as DOC_CATALOG,Be as DOC_DETECT_WIDTH,We as DOC_FEEDBACK_STATES,Ot as DOC_FIRST_FRAME_MS,we as DOC_GATE_V1_DEFAULTS,Ct as DOC_SHUTTER_DEFAULTS,X as DocAssist,Ke as DocFeedbackAggregator,Ze as DocGateV1,Rt as EMPTY_GUIDE_METRICS,Ne as FLIP_FILL_MIN,Fe as FLIP_GAP_MS,ve as FLIP_TIMEOUT_MS,lt as GUIDE_LOCK_DEFAULTS,ft as GuideLock,bt as ICAO_CANVAS,wt as ICAO_FALLBACK,Yt as ICAO_GATE_CRITERIA,Xt as ICAO_SHARP_REF,I as INFERENCE_RETRY_ATTEMPTS,x as INFERENCE_RETRY_DEFAULT_S,o as IN_CIRCLE_FACTOR,tr as ISSUER_CODES,pe as LANDMARKER_MODEL,ot as LENS_STORAGE_KEY,_t as LENS_TRY_MAX,V as LIVE_MRZ_DEFAULTS,Le as LIVE_PHOTO_IDLE_MS,_e as LIVE_PHOTO_MAX_HZ,ge as MANUAL_SHUTTER_MS,Ye as MRZ_BAND_DEFAULTS,De as MR_DOC_CATALOG,be as NO_REPORT_MS,le as OCR_ASSET_SET,Te as OTP_RESEND_COOLDOWN_MS,se as PORTRAIT_JPEG_QUALITY,i as PRELOAD_BLAZE_INIT_TIMEOUT_MS,n as PRELOAD_BUDGET_MS,Se as PROCESSING_BACKOFF_MS,fe as PROCESSING_POLL_DELAY_MS,ue as PROCESSING_POLL_MAX,G as REGION_PAD,ye as REGISTRY_RETRY_DELAY_MS,S as RETRYABLE_REASONS,re as SAME_FACE_MAX_DROPS,g as SHARPNESS_LONG_EDGE,z as TEXT_LOCK_DEFAULTS,O as TRANSPORT_REPLAY_ATTEMPTS,A as TRANSPORT_REPLAY_DELAY_MS,M as TURNSTILE_EXECUTE_TIMEOUT_MS,d as TURNSTILE_SCRIPT_SRC,Q as WEB_OCR_ENGINE,pr as acceptedIssuers,or as acceptedTypesFor,qe as analyzeDocFrame,Tt as analyzeGuide,Ce as aspectBand,Pe as aspectFits,qt as backgroundStats,$ as browserFamily,Z as buildDeviceReadHint,B as classifyCardSide,K as classifyCardSideWith,st as coverPointToVideo,oe as createDocumentCaptureInternal,ne as createFaceLandmarker,Bt as createIcaoGate,Re as createLivePhotoKit,R as createLivenessCaptureInternal,me as createPortraitCaptureInternal,ce as createStepRunner,Ae as createVerificationInternal,U as cropImage,e as detectFormFactor,t as detectIsMobile,He as detectMrzBand,Et as docZoomFor,k as encodeDocumentImage,v as executeTurnstile,gt as eyeLineRoll,Wt as eyeOpenness,jt as eyeSpecular,Nt as faceGeometry,Qt as faceLighting,$t as faceSharpness,ie as facesOf,ke as feedbackVoteOf,nr as flagOf,mt as focusOk,te as formatMismatch,l as frontierStep,ct as guideQuad,St as guideRegionInFrame,er as icaoPixelStats,Gt as icaoWindow,he as initialScanState,T as isExecutable,c as isTerminalView,Ht as judgeIcao,tt as lensKindOf,ee as liveMrzWireReport,N as loadTurnstile,Zt as lumaPlane,_ as mapEngineState,L as mapErrorKind,m as mapGuidanceHint,f as mapSessionResult,W as measureBitmapSharpness,H as measureRegionSharpness,Ue as nextScanState,Ee as observePortraitFrame,Lt as openDocCamera,dt as passportBandOf,kt as percentile,b as photoSharpness,Ut as portraitCropRegion,Ie as portraitMatchStep,vt as poseFromMatrix,E as preloadedDetectorFactory,ze as quadAreaFrac,Xe as quadBounds,Ve as quadIou,je as quadTiltRatio,Oe as randomUuid,rt as rankBackCameras,pt as readStoredLens,Jt as regionStats,s as resetLivenessAssetsForTests,F as resetTurnstileForTests,Y as resizeLongEdge,ir as resolveAcceptedDocuments,et as resolveDocCameraTuning,Pt as resolveDocShutterTuning,yt as resolveGuideLockTuning,zt as resolveIcaoTuning,j as resolveWebOcrPlan,D as runLivenessFlow,P as runSubmission,Me as scannerFormatFor,Kt as scoreFrame,a as setPreloadLoaderForTests,J as settledHint,at as singleShotFocusAt,Qe as specularFraction,q as startWebOcr,y as stepOf,h as stillRegionOf,w as stillToImageData,nt as supportsFocusMode,ut as warmDocDetector,ht as windowOverflow,it as writeStoredLens};
1
+ import{c as _e,d as Le,e as Re,g as Se,h as Te,i as ce}from"../chunk-PLH6ZR6J.js";import{a as Vt,b as Xt,c as Zt,d as Jt,e as Qt,f as jt,g as qt,h as $t,i as er,j as ae,k as se,m as Ee,n as me}from"../chunk-4GJXUVZK.js";import{b as pe,c as ie,d as ne}from"../chunk-CJHMFPL6.js";import"../chunk-RI3E7GBN.js";import{a as d,b as M,c as F,d as N,e as v}from"../chunk-O5WKNZ2C.js";import{A as yt,B as ft,C as ut,D as Ot,E as At,F as It,G as xt,H as Ct,I as Pt,J as Dt,K as dt,L as Mt,M as Ft,a as We,b as ke,c as Ke,d as Je,e as Qe,f as je,g as qe,h as $e,i as et,j as tt,k as rt,l as ot,m as pt,n as it,o as nt,p as at,q as st,r as Et,s as mt,t as _t,u as Lt,v as Rt,w as St,x as Tt,y as ct,z as lt}from"../chunk-ZO6IHP2I.js";import{a as Ye,b as He}from"../chunk-SMKCBUJL.js";import{a as Be,b as we,c as ze,d as Ve,e as Xe,f as Ze}from"../chunk-MXWLCDFX.js";import{a as k,b as Fe,c as Ne,d as ve,e as ge,f as be,g as Ge,h as he,i as Ue,j as K,k as B,l as w,m as Z,n as J,o as Q,p as j,q,r as $,s as ee,t as te,u as re,x as oe}from"../chunk-RNJA5GDF.js";import{a as g,b,c as G,d as h,e as U,f as Y,g as H,h as W,i as z,j as V,l as X}from"../chunk-G6LKLN4U.js";import{a as xe,b as Ce,c as Pe,d as De,e as de,f as Me}from"../chunk-TDLIXFDT.js";import{a as Nt,b as vt,c as gt,d as bt,e as Gt,f as ht,g as Ut,h as Yt,i as Ht,j as Wt,k as kt,l as Kt,m as Bt}from"../chunk-7ZCZY3ZP.js";import{a as wt,b as zt}from"../chunk-BPE5NSQ2.js";import"../chunk-GI3UFGRQ.js";import{b as ye,c as fe,d as ue,e as Oe,g as Ae,h as tr,i as rr,j as or,k as pr,l as ir,m as nr,s as Ie}from"../chunk-L45YTRJJ.js";import{d as S,j as T,k as c,l,m as y,p as f,r as u,s as O,t as A,u as I,v as x,w as C,x as P,y as D}from"../chunk-64V55KD7.js";import{a as i,b as n,c as a,d as s,i as E,j as m,k as _,l as L,n as R}from"../chunk-6K4D3U6Q.js";import"../chunk-GT2ZLGF7.js";import"../chunk-ZPXL26BF.js";import{c as e,d as t,f as r,g as o,h as p}from"../chunk-FUHDOEBP.js";import"../chunk-POIQGEZM.js";import"../chunk-CQ7SKLMC.js";import"../chunk-FPXL63KZ.js";import"../chunk-5Y3UST3W.js";import"../chunk-JUEOHNVW.js";import"../chunk-OKWG3PVH.js";import{a as le}from"../chunk-DFTCAWMP.js";import"../chunk-DK5YPBDQ.js";export{ae as ANALYSIS_LONG_EDGE,xe as ASPECT_BANDS,C as AttestationError,Ge as BLUR_REFUSE_SHARPNESS_MAX,Ft as CAPTURE_CANDIDATE_SPACING_MS,Mt as CAPTURE_EXTRA_CANDIDATES,p as CENTERED_FACTOR,r as CIRCLE_RADIUS_FACTOR,Vt as CLIPPED_LUMA,u as CLIP_MIME_ALLOWLIST,Dt as CaptureSessionDoc,rr as DOCUMENT_TYPE_ORDER,Je as DOC_ANALYSIS_DEFAULTS,At as DOC_BLACK_FRAME_LUMA,It as DOC_BLACK_FRAME_TICKS,xt as DOC_CADENCE_HZ,$e as DOC_CAMERA_TUNING_DEFAULTS,de as DOC_CATALOG,Be as DOC_DETECT_WIDTH,We as DOC_FEEDBACK_STATES,Ot as DOC_FIRST_FRAME_MS,we as DOC_GATE_V1_DEFAULTS,Ct as DOC_SHUTTER_DEFAULTS,X as DocAssist,Ke as DocFeedbackAggregator,Ze as DocGateV1,Rt as EMPTY_GUIDE_METRICS,Ne as FLIP_FILL_MIN,Fe as FLIP_GAP_MS,ve as FLIP_TIMEOUT_MS,lt as GUIDE_LOCK_DEFAULTS,ft as GuideLock,bt as ICAO_CANVAS,wt as ICAO_FALLBACK,Yt as ICAO_GATE_CRITERIA,Xt as ICAO_SHARP_REF,I as INFERENCE_RETRY_ATTEMPTS,x as INFERENCE_RETRY_DEFAULT_S,o as IN_CIRCLE_FACTOR,tr as ISSUER_CODES,pe as LANDMARKER_MODEL,ot as LENS_STORAGE_KEY,_t as LENS_TRY_MAX,V as LIVE_MRZ_DEFAULTS,Le as LIVE_PHOTO_IDLE_MS,_e as LIVE_PHOTO_MAX_HZ,ge as MANUAL_SHUTTER_MS,Ye as MRZ_BAND_DEFAULTS,De as MR_DOC_CATALOG,be as NO_REPORT_MS,le as OCR_ASSET_SET,Te as OTP_RESEND_COOLDOWN_MS,se as PORTRAIT_JPEG_QUALITY,i as PRELOAD_BLAZE_INIT_TIMEOUT_MS,n as PRELOAD_BUDGET_MS,Se as PROCESSING_BACKOFF_MS,fe as PROCESSING_POLL_DELAY_MS,ue as PROCESSING_POLL_MAX,G as REGION_PAD,ye as REGISTRY_RETRY_DELAY_MS,S as RETRYABLE_REASONS,re as SAME_FACE_MAX_DROPS,g as SHARPNESS_LONG_EDGE,z as TEXT_LOCK_DEFAULTS,O as TRANSPORT_REPLAY_ATTEMPTS,A as TRANSPORT_REPLAY_DELAY_MS,M as TURNSTILE_EXECUTE_TIMEOUT_MS,d as TURNSTILE_SCRIPT_SRC,Q as WEB_OCR_ENGINE,pr as acceptedIssuers,or as acceptedTypesFor,qe as analyzeDocFrame,Tt as analyzeGuide,Ce as aspectBand,Pe as aspectFits,qt as backgroundStats,$ as browserFamily,Z as buildDeviceReadHint,B as classifyCardSide,K as classifyCardSideWith,st as coverPointToVideo,oe as createDocumentCaptureInternal,ne as createFaceLandmarker,Bt as createIcaoGate,Re as createLivePhotoKit,R as createLivenessCaptureInternal,me as createPortraitCaptureInternal,ce as createStepRunner,Ae as createVerificationInternal,U as cropImage,e as detectFormFactor,t as detectIsMobile,He as detectMrzBand,Et as docZoomFor,k as encodeDocumentImage,v as executeTurnstile,gt as eyeLineRoll,Wt as eyeOpenness,jt as eyeSpecular,Nt as faceGeometry,Qt as faceLighting,$t as faceSharpness,ie as facesOf,ke as feedbackVoteOf,nr as flagOf,mt as focusOk,te as formatMismatch,l as frontierStep,ct as guideQuad,St as guideRegionInFrame,er as icaoPixelStats,Gt as icaoWindow,he as initialScanState,T as isExecutable,c as isTerminalView,Ht as judgeIcao,tt as lensKindOf,ee as liveMrzWireReport,N as loadTurnstile,Zt as lumaPlane,_ as mapEngineState,L as mapErrorKind,m as mapGuidanceHint,f as mapSessionResult,W as measureBitmapSharpness,H as measureRegionSharpness,Ue as nextScanState,Ee as observePortraitFrame,Lt as openDocCamera,dt as passportBandOf,kt as percentile,b as photoSharpness,Ut as portraitCropRegion,Ie as portraitMatchStep,vt as poseFromMatrix,E as preloadedDetectorFactory,ze as quadAreaFrac,Xe as quadBounds,Ve as quadIou,je as quadTiltRatio,Oe as randomUuid,rt as rankBackCameras,pt as readStoredLens,Jt as regionStats,s as resetLivenessAssetsForTests,F as resetTurnstileForTests,Y as resizeLongEdge,ir as resolveAcceptedDocuments,et as resolveDocCameraTuning,Pt as resolveDocShutterTuning,yt as resolveGuideLockTuning,zt as resolveIcaoTuning,j as resolveWebOcrPlan,D as runLivenessFlow,P as runSubmission,Me as scannerFormatFor,Kt as scoreFrame,a as setPreloadLoaderForTests,J as settledHint,at as singleShotFocusAt,Qe as specularFraction,q as startWebOcr,y as stepOf,h as stillRegionOf,w as stillToImageData,nt as supportsFocusMode,ut as warmDocDetector,ht as windowOverflow,it as writeStoredLens};
@@ -0,0 +1 @@
1
+ import{e as z}from"./chunk-A3FUGHAH.js";import{a as H,b as _,e as U,f as w,i as K}from"./chunk-PLH6ZR6J.js";import{n as F}from"./chunk-4GJXUVZK.js";import"./chunk-CJHMFPL6.js";import"./chunk-RI3E7GBN.js";import{A as V,I as O,i as T}from"./chunk-ZO6IHP2I.js";import"./chunk-SMKCBUJL.js";import"./chunk-MXWLCDFX.js";import{x as B}from"./chunk-RNJA5GDF.js";import"./chunk-G6LKLN4U.js";import"./chunk-TDLIXFDT.js";import"./chunk-7ZCZY3ZP.js";import"./chunk-BPE5NSQ2.js";import"./chunk-GI3UFGRQ.js";import{a as L,b as x,q as I}from"./chunk-64V55KD7.js";import"./chunk-6K4D3U6Q.js";import"./chunk-GT2ZLGF7.js";import"./chunk-ZPXL26BF.js";import"./chunk-FUHDOEBP.js";import"./chunk-POIQGEZM.js";import"./chunk-CQ7SKLMC.js";import"./chunk-FPXL63KZ.js";import{h as A}from"./chunk-5Y3UST3W.js";import{a as R}from"./chunk-JUEOHNVW.js";import"./chunk-OKWG3PVH.js";import"./chunk-DFTCAWMP.js";import"./chunk-DK5YPBDQ.js";function E(e){let a=null,c=Promise.resolve(),u=!1,g=null,y=null,C=null,k=!1,m=()=>{a?.controller.handle.destroy(),a=null},h=()=>{let i=e.currentView(),s=i===null?null:w(i,{isMobile:e.isMobile()});return s?.kind==="portrait"?s:null},P=async(i,s)=>{if(e.destroyed())return;s.setFlowState("uploading"),u=!1;let d=null;try{await e.runner().submit("portrait_icao",async(n,r)=>{if(d===null){let p=await I(n,"image","image/jpeg",i.image.size,{engine:"portrait"});await n.uploadToSpaces(p.uploadUrl,i.image,"image/jpeg"),d=(await n.completeMedia(p.key)).key}s.setFlowState("checking");let l={media:{portrait:d},gate:A(i.gate),...i.tuningVersion!==void 0?{tuningVersion:i.tuningVersion}:{}};return n.submitCheck("portrait_icao",l,{idempotencyKey:r})},()=>{g=d})}catch{u=!0}if(s.setFlowState("done"),e.destroyed())return;let t=h();(t===null||t.phase!=="capture")&&a?.controller===s&&m(),e.runner().republish()},b=i=>e.runner().submit("face_match",(s,d)=>s.submitCheck("face_match",g!==null?{imageKey:g}:{},{idempotencyKey:d})).then(()=>{},()=>{u=!0,i()});return{bind:(i,s)=>{if(i.phase==="match")return m(),y!==i.attemptsRemaining&&!u&&(y=i.attemptsRemaining,b(s)),{...i,uploadFailed:u,resubmit:()=>(u=!1,y=i.attemptsRemaining,s(),b(s)),capture:()=>{throw new Error("the portrait was already accepted")}};y=null;let d=e.keptPortraitInput?.()??null;return d!==null&&(k||d!==C&&i.report===null&&i.reason===void 0&&!i.retakeOnly)?(k||(C=d,k=!0,e.runner().submit("portrait_icao",(t,n)=>t.submitCheck("portrait_icao",d,{idempotencyKey:n}),()=>{g=d.media.portrait}).catch(()=>{}).finally(()=>{k=!1,s()})),{kind:"processing",key:"processing",context:i.context,section:i.section,stalled:!1,refresh:()=>Promise.resolve()}):{...i,uploadFailed:u,resubmit:()=>Promise.resolve(),capture:t=>{if(a!==null&&a.video===t.video)return a.controller.handle;m(),u=!1;let n=F({video:t.video,tuning:i.tuning,tuningVersion:i.tuningVersion,...i.icao!=null?{policy:i.icao.policy}:{},...t.keepScreenAwake!==void 0?{keepScreenAwake:t.keepScreenAwake}:{},...t.assetBaseUrl!==void 0?{assetBaseUrl:t.assetBaseUrl}:{}},e.internals,()=>e.destroyed()?"self":e.cameraMode?.()??x(L(e.currentView()),null));return a={video:t.video,controller:n},n.handle.on("captured",r=>{c=c.then(()=>P(r,n)).catch(()=>{})}),n.handle}}},destroy:m}}function G(e){let a=e;if(typeof a.apiOrigin!="string"||typeof a.sessionToken!="string")return;let c=`${a.apiOrigin}/api/v2/hosted/capture-reports`,u=a.sessionToken;return g=>{try{fetch(c,{method:"POST",headers:{"content-type":"application/json","x-session-token":u,"x-sekyro-sdk":`@sekyro/web/${R}`},body:JSON.stringify({reports:g}),keepalive:!0}).catch(()=>{})}catch{}}}function $(e){let a=e.apiOrigin;return z("sdk",typeof a=="string"&&/staging|sandbox|localhost/.test(a)?"sandbox":"live")}function ce(e){let a=null,c=null,u=null,g=Promise.resolve(),y=()=>{u?.flow.handle.destroy(),u=null},C=async(t,n)=>{if(e.destroyed())return;n.setFlowState("uploading");let r=null,l,p=!1;try{await a.submit("doc_ocr",async(S,j)=>{if(r===null){let D=await I(S,"image","image/jpeg",t.image.size,{engine:"document"});await S.uploadToSpaces(D.uploadUrl,t.image,"image/jpeg"),r=(await S.completeMedia(D.key)).key}return n.setFlowState("checking"),l===void 0&&(l=n.takeDeviceRead(t)),S.submitCheck("doc_ocr",{imageKey:r,side:t.side,...l!==null?{deviceRead:l}:{}},{idempotencyKey:j})})}catch{p=!0}finally{n.setFlowState("done")}if(e.destroyed())return;if(p){n.settle(t.side,{ok:!1,issue:"technical"});return}let v=e.currentView(),o=v===null?null:w(v,{isMobile:e.isMobile()});if(o?.kind!=="document"){n.settle(t.side,{ok:!0}),u?.flow===n?y():n.handle.destroy();return}if(o.reason==="document_type_not_accepted"){c=null,u?.flow===n&&y(),a.republish();return}t.side==="single"||o.acceptedSides.includes(t.side)||o.reason==="side_missing"?(n.settle(t.side,{ok:!0}),c?.documentType!=="passport"&&n.handle.setSide(o.side)):n.settle(t.side,{ok:!1,issue:"reread"})},k=(t,n)=>({...t,issuer:c?.issuer??null,documentType:c?.documentType??null,captureSide:c===null?null:c.documentType==="passport"?"single":t.side,selectDocument:(r,l)=>{if(!_(t.documents).includes(r)||!H(t.documents,r).includes(l))throw new RangeError(`${l} from ${r} is not accepted`);(c?.issuer!==r||c.documentType!==l)&&y(),c={issuer:r,documentType:l},n()},capture:r=>{if(c===null)throw new Error("selectDocument() first");if(u!==null&&u.video===r.video)return u.flow.handle;y();let l=c,p=l.documentType==="passport"?"single":t.acceptedSides.length>0?t.side:void 0,v=B({video:r.video,documentType:l.documentType,issuer:l.issuer,...p!==void 0?{side:p}:{},...r.keepScreenAwake!==void 0?{keepScreenAwake:r.keepScreenAwake}:{},...r.liveMrz!==void 0?{liveMrz:r.liveMrz}:{}},{...e.documentInternals??{},...(()=>{let o=e.currentView()?.capture?.document,f=e.documentInternals?.blurRefuseSharpnessMax??o?.scan?.blurRefuseSharpnessMax;return{engineOptions:{camera:T(o?.camera),shutter:O(o?.scan),guideLock:V(o?.guide),...e.documentInternals?.engineOptions??{}},...typeof f=="number"&&Number.isFinite(f)&&f>=0&&f<=1?{blurRefuseSharpnessMax:f}:{}}})(),deferRead:!0,...(()=>{let o=e.currentView();if(o===null||e.documentInternals?.webOcr!==void 0)return{};let f=G(e.runtime.client);return{webOcr:{captureDocument:o.capture?.document,salt:o.sessionId,baseUrl:$(e.runtime.client),...f!==void 0?{reports:f}:{}}}})()});return u={video:r.video,flow:v},v.handle.on("captured",o=>{g=g.then(()=>C(o,v)).catch(()=>{})}),v.handle}}),m=null,h=null,P=new Set,b=e.runtime.client;e.runtime.client=new Proxy(b,{get(t,n){if(n==="submitCheck")return(h??t).submitCheck.bind(h??t);let r=Reflect.get(t,n);return typeof r=="function"?r.bind(t):r}});let M=()=>{m?.destroy(),m=null,h=null},i=t=>{let n=e.currentView(),r=n===null?null:w(n,{isMobile:e.isMobile()});if(n===null||r?.kind!=="liveness"||r.livePhoto?.icao!==!0)return;if(m===null){let o=U({tuning:n.capture?.icao??null,tuningVersion:n.capture?.tuningVersion??null,...r.icao!=null?{policy:r.icao.policy}:{},still:r.livePhoto.still,...t.assetBaseUrl!==void 0?{assetBaseUrl:t.assetBaseUrl}:{}},e.livePhotoInternals);m=o,h=o.decorate(b),o.onGate(f=>{for(let S of P)S(f)})}let l=m,p=e.baseCapture??{},v=p.engineOptions?.telemetry;return{...p,engineOptions:{...p.engineOptions??{},measureQuality:l.engineOptions.measureQuality,telemetry:o=>{v?.(o),l.engineOptions.telemetry(o)}}}},s=E({keptPortraitInput:()=>m?.lastPortraitInput()??null,runner:()=>a,currentView:e.currentView,...e.cameraMode!==void 0?{cameraMode:e.cameraMode}:{},destroyed:e.destroyed,isMobile:e.isMobile,...e.portraitInternals!==void 0?{internals:e.portraitInternals}:{}}),d=K({...e,bindDocument:k,bindPortrait:s.bind,onLivePhoto:t=>(P.add(t),()=>P.delete(t))});return a=d,{...d,captureInternals:i,destroy:()=>{y(),s.destroy(),M(),P.clear()}}}export{ce as createPlanRunner,G as reportSink,$ as sdkAssetBase};
@@ -360,7 +360,7 @@ type CheckReason = LivenessReason | PopulationReason | FaceMatchReason | DocReas
360
360
  * - `platform_unsupported` (M-nfc): a chip read is required and this client
361
361
  * can't read one (web); the session stays open for a native app.
362
362
  */
363
- type SessionFailureReason = "location_not_allowed" | "anonymizer_blocked" | "capture_tampered" | "device_velocity_exceeded" | "device_cooldown" | "platform_unsupported";
363
+ type SessionFailureReason = "location_not_allowed" | "anonymizer_blocked" | "capture_tampered" | "device_velocity_exceeded" | "device_cooldown" | "platform_unsupported" | "starter_credit_claimed";
364
364
  /**
365
365
  * The profile-v2 policy reasons a session can end on: the two session-level
366
366
  * reasons plus the failed check's policy reasons (`document_type_not_accepted`,
@@ -373,6 +373,23 @@ type PolicyFailureReason = SessionFailureReason | "document_type_not_accepted" |
373
373
  * `no_camera` when there is no usable camera (none found, an insecure page or a browser that cannot capture).
374
374
  */
375
375
  type CameraUnavailableCause = "denied" | "no_camera";
376
+ /**
377
+ * A capture failure the page showed (`POST /hosted/capture-issue`, 2026-11-04): a diagnostic record on the session that
378
+ * never changes it, never bills and never counts as an attempt. No personal data, no free text: `name` is a thrown
379
+ * error's `name` (letters only, at most 40 characters).
380
+ */
381
+ interface CaptureIssueReport {
382
+ check: "liveness" | "document";
383
+ /** The public capture error kind shown, or `unavailable` (the SDK reason then rides in `engineKind`). */
384
+ kind: "permission" | "notfound" | "inuse" | "insecure" | "unsupported" | "generic" | "unavailable";
385
+ name?: string;
386
+ phase?: "preflight" | "acquiring" | "models" | "recording" | "keyframes" | "upload";
387
+ /** The engine kind before the public collapse, or the `unavailable` reason code (lower case, at most 32 characters). */
388
+ engineKind?: string;
389
+ /** Which capture attempt of the page failed (0 = the first). The client reports one issue per attempt and cause. */
390
+ attempt?: number;
391
+ formFactor?: "phone" | "tablet" | "desktop";
392
+ }
376
393
  /**
377
394
  * How the person proves their identity when the app makes the document
378
395
  * optional for registry nationals (profile v2 step 3): type their national
@@ -868,9 +885,13 @@ interface HostedCaptureTuning {
868
885
  }
869
886
  /**
870
887
  * Who films the face (`HostedSessionView.capture.mode`, a flow setting):
871
- * `self` (the person, front camera) or `assisted` (an agent, back camera).
888
+ * `self` (the person, front camera), `assisted` (an agent, back camera) or
889
+ * `choice` (the person picks `self` or `assisted` on the first camera step,
890
+ * once for the session: {@link ResolvedCaptureMode}).
872
891
  */
873
- type CaptureMode = "self" | "assisted";
892
+ type CaptureMode = "self" | "assisted" | "choice";
893
+ /** The mode a camera runs in: the session's {@link CaptureMode}, or the person's pick under `choice`. */
894
+ type ResolvedCaptureMode = "self" | "assisted";
874
895
  /** `capture.livePhoto` (flow model 2026-10-23, Step 3). */
875
896
  interface HostedLivePhotoTuning {
876
897
  oneCapture: boolean;
@@ -1345,7 +1366,10 @@ interface LivenessCaptureInput {
1345
1366
  captureMs?: number;
1346
1367
  /** The camera the clip was filmed with (`environment` = back). */
1347
1368
  facingMode?: 'user' | 'environment';
1348
- /** The capture mode the SDK applied (the session's `capture.mode`; the server's own value is the authority). */
1369
+ /**
1370
+ * The capture mode the SDK applied: the session's `capture.mode`, or under `choice` the person's pick
1371
+ * (`Verification.chooseCaptureMode`). The server checks the pick is one the session allows.
1372
+ */
1349
1373
  mode?: 'self' | 'assisted';
1350
1374
  /** The device kind. With `mode` set, the server applies the upright requirement (`capture_not_upright`) to `phone` only. */
1351
1375
  formFactor?: 'phone' | 'tablet' | 'desktop';
@@ -1534,4 +1558,4 @@ interface SubmitCheckBody {
1534
1558
  forceOutcome?: "pass" | "fail" | "age_over" | "age_uncertain" | "age_under" | "age_unavailable";
1535
1559
  }
1536
1560
 
1537
- export { type IdentitySummarySource as $, type AcceptedDocumentType as A, type BackgroundUniformity as B, type ConsentLocale as C, type DecisionReason as D, type EidAfterPass as E, type FaceMatchReason as F, type HostedIcaoPolicy as G, type HostedSessionView as H, type IdentityConfirmDecision as I, type HostedIntegrity as J, type HostedLivePhotoTuning as K, type HostedLivenessCaptureTuning as L, type MediaKind as M, type HostedNativeCaptureTuning as N, type HostedOcrTuning as O, type PresignUploadResult as P, type HostedOtpView as Q, type ResolvedIcaoTuning as R, type ScreenRampColour as S, type HostedPlanView as T, type HostedPortraitView as U, type HostedStepView as V, type HostedVoiceLocale as W, type HostedVoiceView as X, type IcaoCaptureTuning as Y, type IcaoReportEntry as Z, type IdentityMethod as _, type HostedConsentView as a, type IdentitySummaryView as a0, type LivenessReason as a1, type MatchReason as a2, type MethodChoiceView as a3, type NationalEidOption as a4, type NfcChipReason as a5, type NfcStepView as a6, type OtpChoiceView as a7, type PhoneCountryRule as a8, type PhoneFormat as a9, type CaptureNoncesResult as aA, type CaptureProof as aB, type DocDeviceRead as aC, type DocOcrInput as aD, type DocSide as aE, type EmailOtpInput as aF, type FaceMatchInput as aG, type LivenessCaptureInput as aH, type LivenessInput as aI, type PhoneOtpInput as aJ, type PopulationInput as aK, type PresignRequest as aL, type RecordConsentResult as aM, type SessionStepView as aN, type SessionView as aO, type SubmitCheckBody as aP, type PhoneOtpReason as aa, type PlanAttempts as ab, type PlanChoiceKind as ac, type PlanChoiceOption as ad, type PlanChoiceView as ae, type PlanSectionView as af, type PlanStepView as ag, type PolicyFailureReason as ah, type PopulationReason as ai, type PortraitIcaoInput as aj, type PortraitIcaoReason as ak, type RetakeHint as al, type ScreenRampChallenge as am, type ScreenRampRendered as an, type ScreenRampReport as ao, type SessionFailureReason as ap, type SessionOutcome as aq, type SessionStatus as ar, type StepSection as as, type VerificationAssurance as at, type VerificationLevel as au, ICAO_FALLBACK as av, type IcaoProfile as aw, resolveIcaoTuning as ax, type PersonMask as ay, type AttestationInput as az, type CameraUnavailableCause as b, type CaptureContext as c, type CompleteMediaResult as d, type CheckType as e, type CheckInputByType as f, type IcaoCriterion as g, type AgeEstimationReason as h, type CaptureMode as i, type CaptureProvenance as j, type CheckReason as k, type CheckState as l, type ContactChannel as m, type DocReason as n, type EidAuthInput as o, type EidReason as p, type EmailOtpReason as q, type HostedAcceptedDocuments as r, type HostedBranding as s, type HostedBrandingColorKey as t, type HostedCaptureTuning as u, type HostedDocumentCaptureTuning as v, type HostedDocumentScanTuning as w, type HostedEidView as x, type HostedEmailOtpView as y, type HostedFlowRef as z };
1561
+ export { type IdentityMethod as $, type AcceptedDocumentType as A, type BackgroundUniformity as B, type ConsentLocale as C, type DecisionReason as D, type EidAfterPass as E, type FaceMatchReason as F, type HostedFlowRef as G, type HostedSessionView as H, type IdentityConfirmDecision as I, type HostedIcaoPolicy as J, type HostedIntegrity as K, type HostedLivePhotoTuning as L, type MediaKind as M, type HostedLivenessCaptureTuning as N, type HostedNativeCaptureTuning as O, type PresignUploadResult as P, type HostedOcrTuning as Q, type ResolvedIcaoTuning as R, type ScreenRampColour as S, type HostedOtpView as T, type HostedPlanView as U, type HostedPortraitView as V, type HostedStepView as W, type HostedVoiceLocale as X, type HostedVoiceView as Y, type IcaoCaptureTuning as Z, type IcaoReportEntry as _, type HostedConsentView as a, type IdentitySummarySource as a0, type IdentitySummaryView as a1, type LivenessReason as a2, type MatchReason as a3, type MethodChoiceView as a4, type NationalEidOption as a5, type NfcChipReason as a6, type NfcStepView as a7, type OtpChoiceView as a8, type PhoneCountryRule as a9, type PersonMask as aA, type AttestationInput as aB, type CaptureNoncesResult as aC, type CaptureProof as aD, type DocDeviceRead as aE, type DocOcrInput as aF, type DocSide as aG, type EmailOtpInput as aH, type FaceMatchInput as aI, type LivenessCaptureInput as aJ, type LivenessInput as aK, type PhoneOtpInput as aL, type PopulationInput as aM, type PresignRequest as aN, type RecordConsentResult as aO, type SessionStepView as aP, type SessionView as aQ, type SubmitCheckBody as aR, type PhoneFormat as aa, type PhoneOtpReason as ab, type PlanAttempts as ac, type PlanChoiceKind as ad, type PlanChoiceOption as ae, type PlanChoiceView as af, type PlanSectionView as ag, type PlanStepView as ah, type PolicyFailureReason as ai, type PopulationReason as aj, type PortraitIcaoInput as ak, type PortraitIcaoReason as al, type ResolvedCaptureMode as am, type RetakeHint as an, type ScreenRampChallenge as ao, type ScreenRampRendered as ap, type ScreenRampReport as aq, type SessionFailureReason as ar, type SessionOutcome as as, type SessionStatus as at, type StepSection as au, type VerificationAssurance as av, type VerificationLevel as aw, ICAO_FALLBACK as ax, type IcaoProfile as ay, resolveIcaoTuning as az, type CameraUnavailableCause as b, type CaptureIssueReport as c, type CaptureContext as d, type CompleteMediaResult as e, type CheckType as f, type CheckInputByType as g, type IcaoCriterion as h, type AgeEstimationReason as i, type CaptureMode as j, type CaptureProvenance as k, type CheckReason as l, type CheckState as m, type ContactChannel as n, type DocReason as o, type EidAuthInput as p, type EidReason as q, type EmailOtpReason as r, type HostedAcceptedDocuments as s, type HostedBranding as t, type HostedBrandingColorKey as u, type HostedCaptureTuning as v, type HostedDocumentCaptureTuning as w, type HostedDocumentScanTuning as x, type HostedEidView as y, type HostedEmailOtpView as z };
@@ -360,7 +360,7 @@ type CheckReason = LivenessReason | PopulationReason | FaceMatchReason | DocReas
360
360
  * - `platform_unsupported` (M-nfc): a chip read is required and this client
361
361
  * can't read one (web); the session stays open for a native app.
362
362
  */
363
- type SessionFailureReason = "location_not_allowed" | "anonymizer_blocked" | "capture_tampered" | "device_velocity_exceeded" | "device_cooldown" | "platform_unsupported";
363
+ type SessionFailureReason = "location_not_allowed" | "anonymizer_blocked" | "capture_tampered" | "device_velocity_exceeded" | "device_cooldown" | "platform_unsupported" | "starter_credit_claimed";
364
364
  /**
365
365
  * The profile-v2 policy reasons a session can end on: the two session-level
366
366
  * reasons plus the failed check's policy reasons (`document_type_not_accepted`,
@@ -373,6 +373,23 @@ type PolicyFailureReason = SessionFailureReason | "document_type_not_accepted" |
373
373
  * `no_camera` when there is no usable camera (none found, an insecure page or a browser that cannot capture).
374
374
  */
375
375
  type CameraUnavailableCause = "denied" | "no_camera";
376
+ /**
377
+ * A capture failure the page showed (`POST /hosted/capture-issue`, 2026-11-04): a diagnostic record on the session that
378
+ * never changes it, never bills and never counts as an attempt. No personal data, no free text: `name` is a thrown
379
+ * error's `name` (letters only, at most 40 characters).
380
+ */
381
+ interface CaptureIssueReport {
382
+ check: "liveness" | "document";
383
+ /** The public capture error kind shown, or `unavailable` (the SDK reason then rides in `engineKind`). */
384
+ kind: "permission" | "notfound" | "inuse" | "insecure" | "unsupported" | "generic" | "unavailable";
385
+ name?: string;
386
+ phase?: "preflight" | "acquiring" | "models" | "recording" | "keyframes" | "upload";
387
+ /** The engine kind before the public collapse, or the `unavailable` reason code (lower case, at most 32 characters). */
388
+ engineKind?: string;
389
+ /** Which capture attempt of the page failed (0 = the first). The client reports one issue per attempt and cause. */
390
+ attempt?: number;
391
+ formFactor?: "phone" | "tablet" | "desktop";
392
+ }
376
393
  /**
377
394
  * How the person proves their identity when the app makes the document
378
395
  * optional for registry nationals (profile v2 step 3): type their national
@@ -868,9 +885,13 @@ interface HostedCaptureTuning {
868
885
  }
869
886
  /**
870
887
  * Who films the face (`HostedSessionView.capture.mode`, a flow setting):
871
- * `self` (the person, front camera) or `assisted` (an agent, back camera).
888
+ * `self` (the person, front camera), `assisted` (an agent, back camera) or
889
+ * `choice` (the person picks `self` or `assisted` on the first camera step,
890
+ * once for the session: {@link ResolvedCaptureMode}).
872
891
  */
873
- type CaptureMode = "self" | "assisted";
892
+ type CaptureMode = "self" | "assisted" | "choice";
893
+ /** The mode a camera runs in: the session's {@link CaptureMode}, or the person's pick under `choice`. */
894
+ type ResolvedCaptureMode = "self" | "assisted";
874
895
  /** `capture.livePhoto` (flow model 2026-10-23, Step 3). */
875
896
  interface HostedLivePhotoTuning {
876
897
  oneCapture: boolean;
@@ -1345,7 +1366,10 @@ interface LivenessCaptureInput {
1345
1366
  captureMs?: number;
1346
1367
  /** The camera the clip was filmed with (`environment` = back). */
1347
1368
  facingMode?: 'user' | 'environment';
1348
- /** The capture mode the SDK applied (the session's `capture.mode`; the server's own value is the authority). */
1369
+ /**
1370
+ * The capture mode the SDK applied: the session's `capture.mode`, or under `choice` the person's pick
1371
+ * (`Verification.chooseCaptureMode`). The server checks the pick is one the session allows.
1372
+ */
1349
1373
  mode?: 'self' | 'assisted';
1350
1374
  /** The device kind. With `mode` set, the server applies the upright requirement (`capture_not_upright`) to `phone` only. */
1351
1375
  formFactor?: 'phone' | 'tablet' | 'desktop';
@@ -1534,4 +1558,4 @@ interface SubmitCheckBody {
1534
1558
  forceOutcome?: "pass" | "fail" | "age_over" | "age_uncertain" | "age_under" | "age_unavailable";
1535
1559
  }
1536
1560
 
1537
- export { type IdentitySummarySource as $, type AcceptedDocumentType as A, type BackgroundUniformity as B, type ConsentLocale as C, type DecisionReason as D, type EidAfterPass as E, type FaceMatchReason as F, type HostedIcaoPolicy as G, type HostedSessionView as H, type IdentityConfirmDecision as I, type HostedIntegrity as J, type HostedLivePhotoTuning as K, type HostedLivenessCaptureTuning as L, type MediaKind as M, type HostedNativeCaptureTuning as N, type HostedOcrTuning as O, type PresignUploadResult as P, type HostedOtpView as Q, type ResolvedIcaoTuning as R, type ScreenRampColour as S, type HostedPlanView as T, type HostedPortraitView as U, type HostedStepView as V, type HostedVoiceLocale as W, type HostedVoiceView as X, type IcaoCaptureTuning as Y, type IcaoReportEntry as Z, type IdentityMethod as _, type HostedConsentView as a, type IdentitySummaryView as a0, type LivenessReason as a1, type MatchReason as a2, type MethodChoiceView as a3, type NationalEidOption as a4, type NfcChipReason as a5, type NfcStepView as a6, type OtpChoiceView as a7, type PhoneCountryRule as a8, type PhoneFormat as a9, type CaptureNoncesResult as aA, type CaptureProof as aB, type DocDeviceRead as aC, type DocOcrInput as aD, type DocSide as aE, type EmailOtpInput as aF, type FaceMatchInput as aG, type LivenessCaptureInput as aH, type LivenessInput as aI, type PhoneOtpInput as aJ, type PopulationInput as aK, type PresignRequest as aL, type RecordConsentResult as aM, type SessionStepView as aN, type SessionView as aO, type SubmitCheckBody as aP, type PhoneOtpReason as aa, type PlanAttempts as ab, type PlanChoiceKind as ac, type PlanChoiceOption as ad, type PlanChoiceView as ae, type PlanSectionView as af, type PlanStepView as ag, type PolicyFailureReason as ah, type PopulationReason as ai, type PortraitIcaoInput as aj, type PortraitIcaoReason as ak, type RetakeHint as al, type ScreenRampChallenge as am, type ScreenRampRendered as an, type ScreenRampReport as ao, type SessionFailureReason as ap, type SessionOutcome as aq, type SessionStatus as ar, type StepSection as as, type VerificationAssurance as at, type VerificationLevel as au, ICAO_FALLBACK as av, type IcaoProfile as aw, resolveIcaoTuning as ax, type PersonMask as ay, type AttestationInput as az, type CameraUnavailableCause as b, type CaptureContext as c, type CompleteMediaResult as d, type CheckType as e, type CheckInputByType as f, type IcaoCriterion as g, type AgeEstimationReason as h, type CaptureMode as i, type CaptureProvenance as j, type CheckReason as k, type CheckState as l, type ContactChannel as m, type DocReason as n, type EidAuthInput as o, type EidReason as p, type EmailOtpReason as q, type HostedAcceptedDocuments as r, type HostedBranding as s, type HostedBrandingColorKey as t, type HostedCaptureTuning as u, type HostedDocumentCaptureTuning as v, type HostedDocumentScanTuning as w, type HostedEidView as x, type HostedEmailOtpView as y, type HostedFlowRef as z };
1561
+ export { type IdentityMethod as $, type AcceptedDocumentType as A, type BackgroundUniformity as B, type ConsentLocale as C, type DecisionReason as D, type EidAfterPass as E, type FaceMatchReason as F, type HostedFlowRef as G, type HostedSessionView as H, type IdentityConfirmDecision as I, type HostedIcaoPolicy as J, type HostedIntegrity as K, type HostedLivePhotoTuning as L, type MediaKind as M, type HostedLivenessCaptureTuning as N, type HostedNativeCaptureTuning as O, type PresignUploadResult as P, type HostedOcrTuning as Q, type ResolvedIcaoTuning as R, type ScreenRampColour as S, type HostedOtpView as T, type HostedPlanView as U, type HostedPortraitView as V, type HostedStepView as W, type HostedVoiceLocale as X, type HostedVoiceView as Y, type IcaoCaptureTuning as Z, type IcaoReportEntry as _, type HostedConsentView as a, type IdentitySummarySource as a0, type IdentitySummaryView as a1, type LivenessReason as a2, type MatchReason as a3, type MethodChoiceView as a4, type NationalEidOption as a5, type NfcChipReason as a6, type NfcStepView as a7, type OtpChoiceView as a8, type PhoneCountryRule as a9, type PersonMask as aA, type AttestationInput as aB, type CaptureNoncesResult as aC, type CaptureProof as aD, type DocDeviceRead as aE, type DocOcrInput as aF, type DocSide as aG, type EmailOtpInput as aH, type FaceMatchInput as aI, type LivenessCaptureInput as aJ, type LivenessInput as aK, type PhoneOtpInput as aL, type PopulationInput as aM, type PresignRequest as aN, type RecordConsentResult as aO, type SessionStepView as aP, type SessionView as aQ, type SubmitCheckBody as aR, type PhoneFormat as aa, type PhoneOtpReason as ab, type PlanAttempts as ac, type PlanChoiceKind as ad, type PlanChoiceOption as ae, type PlanChoiceView as af, type PlanSectionView as ag, type PlanStepView as ah, type PolicyFailureReason as ai, type PopulationReason as aj, type PortraitIcaoInput as ak, type PortraitIcaoReason as al, type ResolvedCaptureMode as am, type RetakeHint as an, type ScreenRampChallenge as ao, type ScreenRampRendered as ap, type ScreenRampReport as aq, type SessionFailureReason as ar, type SessionOutcome as as, type SessionStatus as at, type StepSection as au, type VerificationAssurance as av, type VerificationLevel as aw, ICAO_FALLBACK as ax, type IcaoProfile as ay, resolveIcaoTuning as az, type CameraUnavailableCause as b, type CaptureIssueReport as c, type CaptureContext as d, type CompleteMediaResult as e, type CheckType as f, type CheckInputByType as g, type IcaoCriterion as h, type AgeEstimationReason as i, type CaptureMode as j, type CaptureProvenance as k, type CheckReason as l, type CheckState as m, type ContactChannel as n, type DocReason as o, type EidAuthInput as p, type EidReason as q, type EmailOtpReason as r, type HostedAcceptedDocuments as s, type HostedBranding as t, type HostedBrandingColorKey as u, type HostedCaptureTuning as v, type HostedDocumentCaptureTuning as w, type HostedDocumentScanTuning as x, type HostedEidView as y, type HostedEmailOtpView as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sekyro/web",
3
- "version": "0.1.0-rc.18",
3
+ "version": "0.1.0-rc.19",
4
4
  "description": "Sekyro AI web SDK \u2014 browser liveness capture, hosted-verification client and popup embed for Sekyro AI identity verification",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "repository": {
package/sbom.cdx.json CHANGED
@@ -97,8 +97,8 @@
97
97
  "type": "application",
98
98
  "name": "web",
99
99
  "group": "@sekyro",
100
- "version": "0.1.0-rc.18",
101
- "bom-ref": "@sekyro/web@0.1.0-rc.18",
100
+ "version": "0.1.0-rc.19",
101
+ "bom-ref": "@sekyro/web@0.1.0-rc.19",
102
102
  "description": "Sekyro AI web SDK — browser liveness capture, hosted-verification client and popup embed for Sekyro AI identity verification",
103
103
  "licenses": [
104
104
  {
@@ -108,7 +108,7 @@
108
108
  }
109
109
  }
110
110
  ],
111
- "purl": "pkg:npm/%40sekyro/web@0.1.0-rc.18?vcs_url=git%2Bhttps%3A%2F%2Fgithub.com%2FIBTIKAR-Technologies%2Fibtikar-identity.git%23packages%2Fsekyro-web",
111
+ "purl": "pkg:npm/%40sekyro/web@0.1.0-rc.19?vcs_url=git%2Bhttps%3A%2F%2Fgithub.com%2FIBTIKAR-Technologies%2Fibtikar-identity.git%23packages%2Fsekyro-web",
112
112
  "externalReferences": [
113
113
  {
114
114
  "url": "https://github.com/IBTIKAR-Technologies/ibtikar-identity/issues",
@@ -150,7 +150,7 @@
150
150
  "name": "tasks-vision",
151
151
  "group": "@mediapipe",
152
152
  "version": "0.10.35",
153
- "bom-ref": "@sekyro/web@0.1.0-rc.18|@mediapipe/tasks-vision@0.10.35",
153
+ "bom-ref": "@sekyro/web@0.1.0-rc.19|@mediapipe/tasks-vision@0.10.35",
154
154
  "licenses": [
155
155
  {
156
156
  "license": {
@@ -183,13 +183,13 @@
183
183
  ],
184
184
  "dependencies": [
185
185
  {
186
- "ref": "@sekyro/web@0.1.0-rc.18",
186
+ "ref": "@sekyro/web@0.1.0-rc.19",
187
187
  "dependsOn": [
188
- "@sekyro/web@0.1.0-rc.18|@mediapipe/tasks-vision@0.10.35"
188
+ "@sekyro/web@0.1.0-rc.19|@mediapipe/tasks-vision@0.10.35"
189
189
  ]
190
190
  },
191
191
  {
192
- "ref": "@sekyro/web@0.1.0-rc.18|@mediapipe/tasks-vision@0.10.35"
192
+ "ref": "@sekyro/web@0.1.0-rc.19|@mediapipe/tasks-vision@0.10.35"
193
193
  }
194
194
  ]
195
195
  }
@@ -1 +0,0 @@
1
- var m=["video/mp4;codecs=avc1.42E01E,mp4a.40.2","video/mp4;codecs=avc1.42E01E","video/mp4","video/webm;codecs=vp9,opus","video/webm;codecs=vp9","video/webm;codecs=vp8,opus","video/webm;codecs=vp8","video/webm"];function w(){let e=globalThis.MediaRecorder;return!e||typeof e.isTypeSupported!="function"?"":m.find(r=>e.isTypeSupported(r))??""}var f="video/webm";function y(e){if(e instanceof TypeError)return"insecure";switch(e?.name??""){case"NotAllowedError":case"PermissionDeniedError":return"permission";case"NotFoundError":case"DevicesNotFoundError":return"notfound";case"NotReadableError":case"TrackStartError":return"inuse";case"OverconstrainedError":case"ConstraintNotSatisfiedError":return"overconstrained";default:return"generic"}}function v(){let e=globalThis;if(typeof e.window<"u"&&e.window.isSecureContext===!1)return"INSECURE_CONTEXT";let r=e.navigator?.mediaDevices;return!r||typeof r.getUserMedia!="function"?"UNSUPPORTED":"OK"}function E(){let e=globalThis.MediaRecorder;return typeof e<"u"&&typeof e.isTypeSupported=="function"}var l=8*1024*1024;function S(e){return e.size>l}function u(e){let r=(e||"").toLowerCase();return r.startsWith("image/jpeg")?"jpg":r.startsWith("video/mp4")?"mp4":(r.startsWith("video/webm"),"webm")}function b(e){let{token:r,clip:o,keyframe:t}=e,c=e.ts??Date.now(),d=o.type||f,p=t.type||"image/jpeg",n=new FormData;return n.append("token",r),n.append("clip",new File([o],`liveness-${c}.${u(d)}`,{type:d})),n.append("keyframe",new File([t],`keyframe-${c}.${u(p)}`,{type:p})),n}var i=Symbol.for("sekyro.web.cameraStreams"),a=globalThis,s=a[i]??(a[i]=new Set);function g(e){try{s.add(e)}catch{}}function M(e){let r=0;for(let o of[...s])if(o!==e){s.delete(o);try{for(let t of o.getTracks())t.readyState!=="ended"&&(t.stop(),r+=1)}catch{}}return r}export{m as a,w as b,f as c,y as d,v as e,E as f,l as g,S as h,u as i,b as j,g as k,M as l};
@@ -1 +0,0 @@
1
- import{b as Zt}from"./chunk-SMKCBUJL.js";import{a as et,b as $t,c as qt,e as dt,f as te}from"./chunk-MXWLCDFX.js";import{d as jt,h as Yt,k as Jt}from"./chunk-G6LKLN4U.js";import{b as Vt,c as Xt}from"./chunk-TDLIXFDT.js";import{b as Wt,c as Ht}from"./chunk-POIQGEZM.js";import{d as Nt,k as Bt,l as Ut}from"./chunk-2BFYVMUU.js";import{b as ut,c as ht,d as j,e as Kt}from"./chunk-FPXL63KZ.js";import{c as Qt}from"./chunk-DNB3R4PI.js";var it=Object.freeze({sensing:{key:"sensing",reticle:"searching",minDurationMs:900},too_far:{key:"too_far",reticle:"coaching",minDurationMs:1400},too_close:{key:"too_close",reticle:"coaching",minDurationMs:1400},edge_clipped:{key:"edge_clipped",reticle:"coaching",minDurationMs:1400},wrong_shape:{key:"wrong_shape",reticle:"coaching",minDurationMs:1400},tilted:{key:"tilted",reticle:"coaching",minDurationMs:1400},too_dark:{key:"too_dark",reticle:"coaching",minDurationMs:1400},too_bright:{key:"too_bright",reticle:"coaching",minDurationMs:1400},blurry:{key:"blurry",reticle:"coaching",minDurationMs:1400},focus_far:{key:"focus_far",reticle:"coaching",minDurationMs:1600},glare:{key:"glare",reticle:"coaching",minDurationMs:1400},hold_still:{key:"hold_still",reticle:"locking",minDurationMs:900},processing:{key:"processing",reticle:"processing",minDurationMs:800},side_captured:{key:"side_captured",reticle:"flip",minDurationMs:2600},captured:{key:"captured",reticle:"done",minDurationMs:800}});function ee(i){return i.framing==="no_document"?"sensing":i.framing==="too_far"?"too_far":i.framing==="too_close"?"too_close":i.framing==="edge_clipped"?"edge_clipped":i.framing==="wrong_shape"?"wrong_shape":i.framing==="tilted"?"tilted":i.lighting==="too_dark"?"too_dark":i.lighting==="too_bright"?"too_bright":i.glare==="glare"?"glare":i.blur==="blurry"?"blurry":"hold_still"}var nt=class{constructor(t=2600,e=.35){this.windowMs=t;this.decayPerSecond=e;this.votes=[];this.current=it.sensing;this.currentSinceMs=null}reset(){this.votes=[],this.current=it.sensing,this.currentSinceMs=null}force(t,e){return this.votes=[],this.current=it[t],this.currentSinceMs=e,this.current}tick(t,e){if(this.currentSinceMs===null&&(this.currentSinceMs=e),this.votes.push({key:t,atMs:e}),this.votes=this.votes.filter(r=>e-r.atMs<=this.windowMs),e-this.currentSinceMs<this.current.minDurationMs)return this.current;let n=new Map;for(let r of this.votes){let c=(e-r.atMs)/1e3,a=this.decayPerSecond**c;n.set(r.key,(n.get(r.key)??0)+a)}let o=this.current.key,s=-1;for(let[r,c]of n)c>s&&(s=c,o=r);return o!==this.current.key&&(this.current=it[o],this.currentSinceMs=e),this.current}};var He=Object.freeze({MAX_AREA_FRAC:.92,TILT_MAX_SIDE_RATIO:1.3,GLARE_MAX_SPECULAR_FRAC:.025});function ne(i){let{data:t,width:e,height:n}=i,o=e*n;if(o===0)return 0;let s=0;for(let r=0;r<o;r++){let c=r*4;.299*(t[c]??0)+.587*(t[c+1]??0)+.114*(t[c+2]??0)>=252&&s++}return s/o}function Ke(i){let t=(a,l)=>Math.hypot(l.x-a.x,l.y-a.y),e=t(i.topLeft,i.topRight),n=t(i.bottomLeft,i.bottomRight),o=t(i.topLeft,i.bottomLeft),s=t(i.topRight,i.bottomRight),r=Math.max(e,n)/Math.max(1e-6,Math.min(e,n)),c=Math.max(o,s)/Math.max(1e-6,Math.min(o,s));return Math.max(r,c)}function oe(i){let t={...$t,...i.thresholds},e=He,{quad:n,frameWidth:o,frameHeight:s,measures:r}=i,c=i.format==="ID-3",a="ok";if(n===null)a="no_document";else if(c){let m=dt(n),h=o>0?m.width/o:0,f=m.height>0?m.width/m.height:0;h<t.ID3_BAND_MIN_WIDTH_FRAC?a="too_far":ie(n,o,s,t.EDGE_CLIP_MARGIN_PX)?a="edge_clipped":(f<t.ID3_BAND_ASPECT_MIN||f>t.ID3_BAND_ASPECT_MAX)&&(a="wrong_shape")}else{let m=qt(n,o,s),h=dt(n),f=Math.max(h.width,h.height)/Math.max(1e-6,Math.min(h.width,h.height));m<t.MIN_AREA_FRAC?a="too_far":m>e.MAX_AREA_FRAC?a="too_close":ie(n,o,s,t.EDGE_CLIP_MARGIN_PX)?a="edge_clipped":Xt(i.format,f)?Ke(n)>e.TILT_MAX_SIDE_RATIO&&(a="tilted"):a="wrong_shape"}let l=r.exposure>=t.GUIDE_EXPOSURE?"ok":r.meanLuma<(ut[0]+ut[1])/2?"too_dark":"too_bright",u=r.sharpness>=t.GUIDE_SHARPNESS?"ok":"blurry",d=r.specularFraction>=e.GLARE_MAX_SPECULAR_FRAC?"glare":"ok";return{framing:a,lighting:l,blur:u,glare:d,acceptable:a==="ok"&&l==="ok"&&u==="ok"&&d==="ok"}}function ie(i,t,e,n){return[i.topLeft,i.topRight,i.bottomRight,i.bottomLeft].some(s=>s.x<=n||s.y<=n||s.x>=t-n||s.y>=e-n)}var re=Object.freeze({width:1920,height:1080}),Ve=Object.freeze({width:3840,height:2160}),se=4096,Xe=2560,ae=640,ot=.15,Y=Object.freeze({side:.2,above:.9,below:.3});function E(i){let t=[i.topLeft.x,i.topRight.x,i.bottomRight.x,i.bottomLeft.x],e=[i.topLeft.y,i.topRight.y,i.bottomRight.y,i.bottomLeft.y],n=Math.min(...t),o=Math.min(...e);return{x:n,y:o,width:Math.max(...t)-n,height:Math.max(...e)-o}}function ce(i,t){let e=Math.max(0,Math.floor(i.x)),n=Math.max(0,Math.floor(i.y)),o=Math.min(t.width,Math.ceil(i.x+i.width)),s=Math.min(t.height,Math.ceil(i.y+i.height));return o-e<16||s-n<16?null:{x:e,y:n,width:o-e,height:s-n}}function je(i,t,e){if(i===null||t.width<=0||t.height<=0)return null;let n=E(i);if(n.width<=0||n.height<=0)return null;let o=e==="ID-3"?{x:n.x-n.width*Y.side,y:n.y-n.width*Y.above,width:n.width*(1+2*Y.side),height:n.height+n.width*(Y.above+Y.below)}:{x:n.x-n.width*ot,y:n.y-n.height*ot,width:n.width*(1+2*ot),height:n.height*(1+2*ot)};return ce(o,t)}function mt(i,t,e){let n=Math.max(i,t);return n>0?Math.min(1,e/n):1}function ft(i,t,e,n,o=Xe){let s=t.width>0?e.width/t.width:1,r=t.height>0?e.height/t.height:1,c=i===null?null:{topLeft:{x:i.topLeft.x*s,y:i.topLeft.y*r},topRight:{x:i.topRight.x*s,y:i.topRight.y*r},bottomRight:{x:i.bottomRight.x*s,y:i.bottomRight.y*r},bottomLeft:{x:i.bottomLeft.x*s,y:i.bottomLeft.y*r}},a=je(c,e,n)??{x:0,y:0,width:e.width,height:e.height},l=mt(a.width,a.height,o),u=Math.max(1,Math.round(a.width*l)),d=Math.max(1,Math.round(a.height*l)),m=null;if(c!==null){let h=E(c);m=ce({x:(h.x-a.x)*l,y:(h.y-a.y)*l,width:h.width*l,height:h.height*l},{width:u,height:d})}return{crop:a,width:u,height:d,docRegion:m}}function le(i,t,e,n=Ve){if(e==="LOW")return null;let o=i?.width?.max,s=i?.height?.max;if(typeof o!="number"||typeof s!="number"||o<=0||s<=0)return null;let r=Math.max(o,s),c=Math.min(o,s),a=Math.min(r,Math.max(n.width,n.height)),l=Math.min(c,Math.min(n.width,n.height));return a<=Math.max(t.width,t.height)?null:{width:{ideal:a},height:{ideal:l}}}function ue(i){let t={},e=i?.imageWidth,n=i?.imageHeight;if(typeof e?.max=="number"&&e.max>0){let o=typeof n?.max=="number"&&n.max>0?e.max/n.max:1.3333333333333333,s=o>=1?se:se*o,r=Math.min(e.max,Math.floor(s)),c=typeof e.step=="number"&&e.step>0?e.step:1,a=typeof e.min=="number"?e.min:0;r=Math.max(a,a+Math.floor((r-a)/c)*c),t.imageWidth=r}return i?.fillLightMode?.includes("off")===!0&&(t.fillLightMode="off"),t}function he(i,t){if(i.width<=0||i.height<=0||t.width<=0||t.height<=0)return!1;let e=i.width>i.height,n=t.width>t.height;return e!==n&&i.width!==i.height&&t.width!==t.height?!1:Math.max(i.width,i.height)>=1.2*Math.max(t.width,t.height)}function de(i,t,e,n){if(e===null)return!1;let o=E(i),s=E(e);if(t.width<=0||n.width<=0)return!1;let r=o.width/t.width,c=s.width/n.width;return c>0&&r>=.6*c&&r<=1.25*c}var me=3500,Ye=.92;function pe(){let i=globalThis.ImageCapture;return typeof i=="function"?i:null}function Ze(i){return/AppleWebKit\//.test(i)&&!/(Chrome|Chromium|Edg|OPR)\//.test(i)}function ge(i,t=typeof navigator>"u"?"":navigator.userAgent){return pe()!==null&&!Ze(t)&&i!=null&&i.kind==="video"&&i.readyState==="live"}function fe(i,t){return new Promise((e,n)=>{let o=setTimeout(()=>n(new Error("takePhoto timed out")),t);i.then(s=>{clearTimeout(o),e(s)},s=>{clearTimeout(o),n(s)})})}function pt(i,t){let e=document.createElement("canvas");return e.width=i,e.height=t,e}function Je(i,t){return new Promise((e,n)=>{i.toBlob(o=>o?e(o):n(new Error("toBlob failed")),"image/jpeg",t)})}async function be(i,t,e,n,o){let s=pt(e,n),r=pt(1,1);try{let c=s.getContext("2d");if(c===null)throw new Error("2d context unavailable");c.imageSmoothingQuality="high",c.drawImage(i,t.x,t.y,t.width,t.height,0,0,e,n);let a=await Je(s,Ye),l=o===null?null:jt({topLeft:{x:o.x,y:o.y},topRight:{x:o.x+o.width,y:o.y},bottomRight:{x:o.x+o.width,y:o.y+o.height},bottomLeft:{x:o.x,y:o.y+o.height}},{width:e,height:n},{width:e,height:n}),u=Yt(s,l),d=mt(e,n,ae);return r.width=Math.max(1,Math.round(e*d)),r.height=Math.max(1,Math.round(n*d)),r.getContext("2d")?.drawImage(s,0,0,r.width,r.height),{blob:a,previewDataUrl:r.toDataURL("image/jpeg",.85),sharpness:u}}finally{s.width=0,s.height=0,r.width=0,r.height=0}}function $e(i,t){let e=Math.min(1,t/i.width),n=pt(Math.max(1,Math.round(i.width*e)),Math.max(1,Math.round(i.height*e)));try{let o=n.getContext("2d",{willReadFrequently:!0});return o===null?null:(o.imageSmoothingQuality="high",o.drawImage(i,0,0,n.width,n.height),o.getImageData(0,0,n.width,n.height))}finally{n.width=0,n.height=0}}async function ye(i,t,e,n){let o={width:Math.max(1,i.videoWidth),height:Math.max(1,i.videoHeight)},s=ft(t,e,o,n);return{...await be(i,s.crop,s.width,s.height,s.docRegion),docRegion:s.docRegion,source:"video",width:s.width,height:s.height}}async function Me(i,t,e,n,o){let s=pe();if(s===null)return null;let r=null;try{let c=new s(o.track),a=await fe(c.getPhotoCapabilities?.()??Promise.resolve({}),me).catch(()=>({})),l=await fe(c.takePhoto(ue(a)),me);r=await createImageBitmap(l);let u={width:i.videoWidth,height:i.videoHeight};if(!he(r,u))return null;let d=$e(r,o.detectWidth),m=null;d!==null&&t!==null&&(m=await o.detect(d).catch(()=>null));let h=d??{width:r.width,height:r.height};m!==null&&!de(m,h,t,e)&&(m=null);let f=ft(m,h,r,n);return{...await be(r,f.crop,f.width,f.height,f.docRegion),docRegion:f.docRegion,source:"photo",width:f.width,height:f.height}}catch{return null}finally{r?.close()}}var st=Object.freeze({width:3840,height:2160,lensSelection:!0,continuousFocus:!0,refocusBeforePhotoMs:350,zoomMax:2,zoomNoFocusInfo:1.5,zoomMinSourcePx:2160,fillDistanceM:Object.freeze({id1:.11,id3:.15}),focusMarginFrac:.2,stillSharpnessMin:.16,stillRefusalsMax:2,focusFarFillFrac:.45,noDocFarHintMs:1500,zoomFallbackMs:8e3}),S=(i,t,e)=>typeof i=="number"&&Number.isFinite(i)&&i>=t&&i<=e?i:void 0;function Si(i){let t=st,e=i!==null&&typeof i=="object"?i:{},n=e.fillDistanceM!==null&&typeof e.fillDistanceM=="object"?e.fillDistanceM:{},o=(s,r)=>typeof s=="boolean"?s:r;return{width:S(e.width,640,7680)??t.width,height:S(e.height,480,4320)??t.height,lensSelection:o(e.lensSelection,t.lensSelection),continuousFocus:o(e.continuousFocus,t.continuousFocus),refocusBeforePhotoMs:S(e.refocusBeforePhotoMs,0,2e3)??t.refocusBeforePhotoMs,zoomMax:S(e.zoomMax,1,5)??t.zoomMax,zoomNoFocusInfo:S(e.zoomNoFocusInfo,1,5)??t.zoomNoFocusInfo,zoomMinSourcePx:S(e.zoomMinSourcePx,0,8e3)??t.zoomMinSourcePx,fillDistanceM:{id1:S(n.id1,.03,1)??t.fillDistanceM.id1,id3:S(n.id3,.03,1)??t.fillDistanceM.id3},focusMarginFrac:S(e.focusMarginFrac,0,2)??t.focusMarginFrac,stillSharpnessMin:S(e.stillSharpnessMin,0,10)??t.stillSharpnessMin,stillRefusalsMax:S(e.stillRefusalsMax,0,10)??t.stillRefusalsMax,focusFarFillFrac:S(e.focusFarFillFrac,0,1)??t.focusFarFillFrac,noDocFarHintMs:S(e.noDocFarHintMs,0,6e4)??t.noDocFarHintMs,zoomFallbackMs:S(e.zoomFallbackMs,0,12e4)??t.zoomFallbackMs}}function qe(i){let t=i.toLowerCase();return t===""?"unknown":/front|facing front|user|selfie|face ?time/.test(t)?"front":/ultra|0\.5x|wide angle/.test(t)?"ultra":/tele|zoom|periscope|[2-9]x/.test(t)?"tele":/depth|tof|infrared|\bir\b|truedepth|lidar|macro|monochrome|mono\b/.test(t)?"depth":/dual|triple/.test(t)?"virtual":/back|rear|environment|facing back|arrière|خلفية/.test(t)?"main":"unknown"}function ti(i){let t=/camera2?\s*(\d+)/i.exec(i);return t?Number(t[1]):Number.POSITIVE_INFINITY}function ei(i){let t={main:0,virtual:1,ultra:9,tele:9,depth:9,front:9,unknown:9};return i.filter(e=>(e.kind===void 0||e.kind==="videoinput")&&e.deviceId!=="").map((e,n)=>({id:e.deviceId,kind:qe(e.label),index:ti(e.label),i:n})).filter(e=>t[e.kind]<9).sort((e,n)=>t[e.kind]-t[n.kind]||e.index-n.index||e.i-n.i).map(e=>e.id)}var gt="sekyro.doc.camera";function ii(){try{let i=globalThis.localStorage?.getItem(gt);return typeof i=="string"&&i!==""?i:null}catch{return null}}function ke(i){try{i===null?globalThis.localStorage?.removeItem(gt):globalThis.localStorage?.setItem(gt,i)}catch{}}var rt=(i,t)=>Array.isArray(i?.focusMode)&&i.focusMode.includes(t);function yt(i,t,e){if(!rt(i,"single-shot"))return null;let n=o=>Math.min(1,Math.max(0,Number.isFinite(o)?o:.5));return{focusMode:"single-shot",pointsOfInterest:[{x:n(t),y:n(e)}]}}function Ti(i,t,e,n){if(!Number.isFinite(i)||!Number.isFinite(t)||e.width<=0||e.height<=0||n.width<=0||n.height<=0)return null;let o=Math.max(e.width/n.width,e.height/n.height),s=n.width*o,r=n.height*o,c=(i-e.left+(s-e.width)/2)/s,a=(t-e.top+(r-e.height)/2)/r;return{x:Math.min(1,Math.max(0,c)),y:Math.min(1,Math.max(0,a))}}function De(i,t,e,n=st){let o=i?.zoom?.min,s=i?.zoom?.max;if(typeof s!="number"||s<=1)return 1;let r=e==="ID-3"?n.fillDistanceM.id3:n.fillDistanceM.id1,c=i?.focusDistance?.min,a;if(typeof c=="number"&&c>0&&c<1){if(a=c*(1+n.focusMarginFrac)/r,a<=1.05)return 1}else{if(Math.min(t.width,t.height)<n.zoomMinSourcePx)return 1;a=n.zoomNoFocusInfo}let l=Math.min(a,n.zoomMax,s);typeof o=="number"&&(l=Math.max(l,o));let u=i?.zoom?.step;return typeof u=="number"&&u>0&&(l=Math.round(l/u)*u),l>1.01?Number(l.toFixed(2)):1}function bt(i){try{return i.getVideoTracks?.()[0]}catch{return}}function xe(i){if(i!==null)for(let t of i.getTracks())t.stop()}function ni(i){try{let t=bt(i)?.getCapabilities?.();return!Array.isArray(t?.focusMode)||t.focusMode.includes("continuous")}catch{return!0}}var oi=3;async function we(i){let t=s=>({audio:!1,video:{...s,width:{ideal:i.base.width},height:{ideal:i.base.height}}}),e=s=>i.getUserMedia(t({deviceId:{exact:s}})),n=()=>i.getUserMedia(t({facingMode:{ideal:"environment"}}));if(i.lensSelection){let s=ii();if(s!==null)try{return{stream:await e(s),lens:"stored"}}catch{ke(null)}}let o=await n();if(!i.lensSelection||i.enumerateDevices===void 0)return{stream:o,lens:"default"};try{let s=ei(await i.enumerateDevices()).slice(0,oi);if(s.length===0)return{stream:o,lens:"default"};let r=null;for(let c of s){let a=o!==null?bt(o)?.getSettings?.().deviceId:void 0;if(o===null||a!==c){xe(o),o=null;try{o=await e(c)}catch{continue}}if(r??(r=c),ni(o))return ke(c),{stream:o,lens:"selected"}}if(o!==null&&r!==null&&bt(o)?.getSettings?.().deviceId===r)return{stream:o,lens:"selected"};if(xe(o),o=null,r!==null)try{return{stream:await e(r),lens:"selected"}}catch{}return{stream:await n(),lens:"default"}}catch{return{stream:o??await n(),lens:"default"}}}var Z=Object.freeze({brightness:0,glare:0,cardGlare:0,sharpness:0,fill:0,shape:0,content:0,offsetX:0,offsetY:0,edgeConfidence:0,box:null}),L=i=>Math.min(1,Math.max(0,i));function Se(i,t,e,n=.06){let o=Math.max(i.width/e,i.height),s=o*e,r=(i.width-s)/2,c=(i.height-o)/2,a=L((t.x-t.width*n-r)/s),l=L((t.y-t.height*n-c)/o),u=L((t.x+t.width*(1+n)-r)/s),d=L((t.y+t.height*(1+n)-c)/o);return{x:a,y:l,width:u-a,height:d-l}}function Te(i,t,e={}){let n=e.edgePeakFrac??0,{width:o,height:s,data:r}=i;if(o<=0||s<=0)return Z;let c=L(t.x),a=L(t.y),l={x:c,y:a,width:Math.max(0,L(t.x+t.width)-c),height:Math.max(0,L(t.y+t.height)-a)};if(l.width<=0||l.height<=0)return Z;let u=l.x*o,d=l.y*s,m=(l.x+l.width)*o,h=(l.y+l.height)*s,f=(m-u)*.15,g=(h-d)*.15,y=(p,b,R)=>Math.min(R,Math.max(b,p)),x=y(Math.floor(u-f),0,o-1),w=y(Math.floor(d-g),0,s-1),I=y(Math.ceil(m+f),x+1,o),v=y(Math.ceil(h+g),w+1,s),D=Math.max(1,Math.ceil(Math.max(I-x,v-w)/320)),M=Math.floor((I-x+D-1)/D),T=Math.floor((v-w+D-1)/D);if(M<3||T<3)return Z;let k=new Int32Array(M*T);for(let p=0;p<T;p++){let b=w+p*D;for(let R=0;R<M;R++){let F=(b*o+x+R*D)*4;k[p*M+R]=(r[F]??0)*77+(r[F+1]??0)*150+(r[F+2]??0)*29>>8}}let C=(p,b)=>(p-b-.5)/D,_=C(u,x),A=C(m,x),B=C(d,w),U=C(h,w),kt=(m-u)/D,xt=(h-d)/D,Dt=y(Math.ceil(_),0,M-1),Le=y(Math.floor(A),Dt,M-1),wt=y(Math.ceil(B),0,T-1),Ie=y(Math.floor(U),wt,T-1),vt=0,St=0,W=0,Tt=0,_t=0,H=0;for(let p=wt;p<=Ie;p++)for(let b=Dt;b<=Le;b++){let R=k[p*M+b];if(vt+=R,R>=248&&St++,W++,b>=1&&b<M-1&&p>=1&&p<T-1){let F=k[p*M+b-1]+k[p*M+b+1]+k[(p-1)*M+b]+k[(p+1)*M+b]-4*R;Tt+=F,_t+=F*F,H++}}let Oe=W>0?vt/W:0,Rt=W>0?St/W:0,Ft=H>0?Tt/H:0,Pe=H>0?Math.max(0,_t/H-Ft*Ft):0,K=new Float64Array(M),V=new Float64Array(T);for(let p=0;p<T;p++)for(let b=1;b<M-1;b++)K[b]=K[b]+Math.abs(k[p*M+b+1]-k[p*M+b-1]);for(let p=1;p<T-1;p++)for(let b=0;b<M;b++)V[p]=V[p]+Math.abs(k[(p+1)*M+b]-k[(p-1)*M+b]);let O=at(K,!0,_,n),P=at(K,!1,A,n),G=at(V,!0,B,n),z=at(V,!1,U,n),Ct=(P.position-O.position)/kt,At=(z.position-G.position)/xt,Ge=At>0?Ct/At:0,ze=((O.position+P.position)/2-(_+A)/2)/kt,Ne=((G.position+z.position)/2-(B+U)/2)/xt,Et=ve(K),Lt=ve(V),Qe=Et<=0||Lt<=0?0:Math.min(Math.min(O.value,P.value)/Et,Math.min(G.value,z.value)/Lt),q=(p,b)=>b+(p+.5)*D,It=Rt,Ot=0;{let p=(P.position-O.position)*.06,b=(z.position-G.position)*.06,R=y(Math.ceil(O.position+p),0,M-1),F=y(Math.floor(P.position-p),0,M-1),Be=y(Math.ceil(G.position+b),0,T-1),Pt=y(Math.floor(z.position-b),0,T-1),Gt=0,tt=0,zt=0;for(let N=Be;N<=Pt;N++)for(let Q=R;Q<=F;Q++){tt++;let X=k[N*M+Q];X>=248&&Gt++;let Ue=Q+2<=F?k[N*M+Q+2]:X,We=N+2<=Pt?k[(N+2)*M+Q]:X;(Math.abs(Ue-X)>=24||Math.abs(We-X)>=24)&&zt++}tt>=16&&(It=Gt/tt,Ot=zt/tt)}return{brightness:Oe,glare:Rt,cardGlare:It,sharpness:Pe,fill:Ct,shape:Ge,content:Ot,offsetX:ze,offsetY:Ne,edgeConfidence:Qe,box:{left:q(O.position,x),right:q(P.position,x),top:q(G.position,w),bottom:q(z.position,w)}}}function at(i,t,e,n){let o=i.length,s=Math.max(1,Math.floor(o*.45)),r=t?1:Math.max(1,o-1-s),c=t?Math.min(o-2,s):o-2,a=r;for(let h=r;h<=c;h++)i[h]>i[a]&&(a=h);if(n>0&&n<1){let h=i[a]*n,f=a,g=Math.abs(a-e);for(let y=r;y<=c;y++){let x=i[y];if(x<h||x<(i[y-1]??0)||x<(i[y+1]??0))continue;let w=Math.abs(y-e);w<g&&(f=y,g=w)}a=f}let l=a>0?i[a-1]:0,u=i[a],d=a<o-1?i[a+1]:0,m=l+u+d;return{position:m>0?a+(d-l)/m:a,value:u}}function ve(i){if(i.length<3)return 0;let t=0;for(let e=1;e<i.length-1;e++)t+=i[e];return t/(i.length-2)}function _e(i){let t=i.box;return t===null||t.right-t.left<4||t.bottom-t.top<4?null:{topLeft:{x:t.left,y:t.top},topRight:{x:t.right,y:t.top},bottomRight:{x:t.right,y:t.bottom},bottomLeft:{x:t.left,y:t.bottom}}}var J=Object.freeze({fillMin:.82,fillMax:1.06,offsetMax:.06,glareMax:.025,sharpnessMin:180,edgeConfidenceMin:1.6,darkBrightness:70,lockMs:450,steadyMs:900,steadyFillMin:.45,steadyFillMax:1.3,steadyFillDelta:.06,steadyOffsetDelta:.04,steadyRefMs:100,edgePeakFrac:.4,shapeTolerance:.2,contentMin:.1});function Ri(i){let t=i!==null&&typeof i=="object"?i:{},e={...J};for(let n of Object.keys(J)){let o=t[n];typeof o=="number"&&Number.isFinite(o)&&o>=0&&o<=1e6&&(e[n]=o)}return e}var ct=class{constructor(t=J){this.t=t;this.goodSince=null;this.steadySince=null;this.last=null}reset(){this.goodSince=null,this.steadySince=null,this.last=null}tick(t,e){let n=this.t,o=n.shapeTolerance<=0||Math.abs(t.shape-1)<=n.shapeTolerance,s=t.edgeConfidence>=n.edgeConfidenceMin&&o&&t.content>=n.contentMin,r=t.fill>=n.fillMin&&t.fill<=n.fillMax,c=Math.abs(t.offsetX)<=n.offsetMax&&Math.abs(t.offsetY)<=n.offsetMax,a=t.cardGlare<=n.glareMax,l=t.sharpness>=n.sharpnessMin,u=this.last;this.last={fill:t.fill,offsetX:t.offsetX,offsetY:t.offsetY,at:e};let d=u!==null&&n.steadyRefMs>0?Math.min(3,Math.max(1,(e-u.at)/n.steadyRefMs)):1,m=s&&a&&l&&t.fill>=n.steadyFillMin&&t.fill<=n.steadyFillMax&&u!==null&&Math.abs(t.fill-u.fill)<=n.steadyFillDelta*d&&Math.abs(t.offsetX-u.offsetX)<=n.steadyOffsetDelta*d&&Math.abs(t.offsetY-u.offsetY)<=n.steadyOffsetDelta*d,h=s&&r&&c&&a&&l,f;if(s?a?t.fill<n.fillMin?f="too_small":t.fill>n.fillMax?f="too_big":l?c?f="locking":f="off_center":f="blurry":f="glare":f="no_card",h){if(m&&(this.steadySince??(this.steadySince=e)),this.goodSince??(this.goodSince=e),e-this.goodSince>=n.lockMs)return{detected:s,ready:!0,via:"good",blocker:"locking"};let g=this.steadySince!==null&&e-this.steadySince>=n.steadyMs;return{detected:s,ready:g,via:g?"steady":null,blocker:"locking"}}if(this.goodSince=null,m){this.steadySince??(this.steadySince=e);let g=e-this.steadySince>=n.steadyMs;return{detected:s,ready:g,via:g?"steady":null,blocker:g?"locking":"steadying"}}return this.steadySince=null,{detected:s,ready:!1,via:null,blocker:f}}};var $=null;async function si(i){return $===null&&($=(await import("./detector-scanic-YCDNLCGV.js")).detectQuad),$(i)}async function ri(i){let t=Zt(i);return t===null?null:{topLeft:{x:t.x,y:t.y},topRight:{x:t.x+t.width,y:t.y},bottomRight:{x:t.x+t.width,y:t.y+t.height},bottomLeft:{x:t.x,y:t.y+t.height}}}function Ki(){$===null&&import("./detector-scanic-YCDNLCGV.js").then(i=>{$=i.detectQuad}).catch(()=>{})}var Re=4e3,ai=2,Fe=3,ci=Object.freeze({LOW:3,MID:5,HIGH:6}),Mt=Object.freeze({manualShutterMs:6e3,detectedNoLockMs:1950});function Vi(i){let t=i!==null&&typeof i=="object"?i:{},e=(n,o,s)=>typeof n=="number"&&Number.isFinite(n)&&n>=o&&n<=s?n:void 0;return{manualShutterMs:e(t.manualShutterMs,1e3,6e4)??Mt.manualShutterMs,detectedNoLockMs:e(t.steadyMs,300,3e4)!==void 0?t.steadyMs+(e(t.lockMs,0,1e4)??450):Mt.detectedNoLockMs}}var Ce=class i{constructor(t){this.torchOn=!1;this.stillRefusals=0;this.zoom=1;this.positioningSince=null;this.detectedSince=null;this.lastSeenAt=null;this.lastGuideQuad=null;this.lastOcrReady=null;this.shutterOffered=!1;this.stats=i.freshStats();this.handlers=new Map;this.stream=null;this.timer=null;this.state="idle";this.lastGuidance=null;this.attempt=0;this.capturing=!1;this.feedback=new nt;this.lastFeedbackKey=null;this.lastQuad=null;this.lastDetect=null;this.frameWatch=null;this.reopened=!1;this.lit=!1;this.blackTicks=0;this.offEnded=null;this.opts=t,this.gate=new te(t.format??"ID-1",t.thresholds);let e=t.deviceClass??Ht(Wt());this.deviceClass=e,this.camera=t.camera??st,this.shutterTuning=t.shutter??Mt,this.guideTuning=t.guideLock??J,this.guideLock=new ct(this.guideTuning),this.cadenceMs=1e3/ci[e]}on(t,e){let n=this.handlers.get(t);return n||(n=new Set,this.handlers.set(t,n)),n.add(e),()=>n?.delete(e)}emit(t,e){for(let n of[...this.handlers.get(t)??[]])n(e)}async start(){let t=this.state==="error"?this.resumePlayback():null,e=++this.attempt;if(this.clearFrameWatch(),this.gate.reset(),this.resetSide(),this.feedback.reset(),this.lastFeedbackKey=null,this.lastGuidance=null,this.capturing=!1,this.lit=!1,this.blackTicks=0,t!==null&&await t&&e===this.attempt){this.setState("positioning"),this.scheduleTick(e),this.watchFrames(e);return}if(e===this.attempt){this.releaseStream(),Ut(),this.setState("preflight");try{let n=this.opts.getUserMedia??(r=>navigator.mediaDevices.getUserMedia(r));this.setState("acquiring");let o=this.opts.enumerateDevices??(this.opts.getUserMedia===void 0&&typeof navigator<"u"&&navigator.mediaDevices?.enumerateDevices?()=>navigator.mediaDevices.enumerateDevices():void 0),s=await we({getUserMedia:n,...o!==void 0?{enumerateDevices:o}:{},lensSelection:this.camera.lensSelection,base:re});if(e!==this.attempt){for(let r of s.stream.getTracks())r.stop();return}if(this.stream=s.stream,Qt(this.stream),Bt(this.stream),this.watchEnded(e),this.opts.upgradeResolution!==!1&&await this.upgradeResolution(),e!==this.attempt||(await this.applyFocusAndZoom(),e!==this.attempt)||(this.opts.video.srcObject=this.stream,await this.opts.video.play().catch(()=>{}),e!==this.attempt))return;this.setState("positioning"),this.scheduleTick(e),this.watchFrames(e)}catch(n){if(e!==this.attempt)return;let o=Nt(n);this.setState("error"),this.emit("error",{kind:o,retryable:!0})}}}resumePlayback(){let t=this.opts.video,e=this.videoTrack();if(this.stream===null||e===null||e.readyState!=="live"||t.srcObject!==this.stream)return null;try{return Promise.resolve(t.play()).then(()=>this.framesNow(),()=>!1)}catch{return null}}framesNow(){let t=this.opts.video;return this.opts.hasFrames!==void 0?this.opts.hasFrames(t):!t.paused&&t.readyState>=2&&t.videoWidth>0}watchFrames(t){let e=this.opts.firstFrameMs??Re;e<=0||(this.clearFrameWatch(),this.frameWatch=setTimeout(()=>{if(this.frameWatch=null,!(t!==this.attempt||this.state!=="positioning")){if(this.framesNow()&&this.blackTicks<Fe){this.reopened=!1;return}this.cameraDead(t)}},e))}clearFrameWatch(){this.frameWatch!==null&&clearTimeout(this.frameWatch),this.frameWatch=null}watchEnded(t){this.offEnded?.(),this.offEnded=null;let e=this.videoTrack();if(e===null||typeof e.addEventListener!="function")return;let n=()=>{t===this.attempt&&(this.state==="positioning"||this.state==="acquiring")&&this.cameraDead(t)};e.addEventListener("ended",n),this.offEnded=()=>e.removeEventListener?.("ended",n)}cameraDead(t){if(t!==this.attempt)return;let e=this.videoTrack(),n=e!==null&&e.readyState==="live"&&!e.muted&&this.opts.video.paused&&!this.framesNow();if(!n&&!this.reopened){this.reopened=!0,this.start();return}this.attempt+=1,this.timer!==null&&(this.opts.clearTimer??clearTimeout)(this.timer),this.timer=null,this.clearFrameWatch(),n||this.releaseStream(),this.reopened=!1,this.setState("error"),this.emit("error",{kind:"generic",retryable:!0})}releaseStream(){if(this.offEnded?.(),this.offEnded=null,this.stream)for(let t of this.stream.getTracks())t.stop();this.stream=null,this.opts.video.srcObject!==null&&this.opts.video.srcObject!==void 0&&(this.opts.video.srcObject=null)}rearm(t){t!==void 0&&(this.opts.side=t),this.gate.reset(),this.resetSide(),this.feedback.reset(),this.lastFeedbackKey=null,this.lastGuidance=null,this.capturing=!1,this.stillRefusals=0,this.state==="captured"&&(this.setState("positioning"),this.scheduleTick(this.attempt))}async captureNow(){if(this.state!=="positioning"||this.capturing)return;let t=this.opts.video,e=this.lastDetect?.width??Math.max(1,t.videoWidth),n=this.lastDetect?.height??Math.max(1,t.videoHeight),o=this.lastQuad??this.lastGuideQuad??{topLeft:{x:0,y:0},topRight:{x:e,y:0},bottomRight:{x:e,y:n},bottomLeft:{x:0,y:n}},s=(this.opts.now??(()=>performance.now()))(),r=this.feedback.force("processing",s);this.lastFeedbackKey=r.key,this.emit("feedback",r),await this.fire(this.attempt,this.lastOcrReady!==null?this.lastOcrReady.quad:o,{width:e,height:n,tickSharpness:this.lastDetect?.tickSharpness??0},this.lastOcrReady?.via??"manual")}captureReport(){let t=this.stats;return{...this.opts.side!==void 0?{side:this.opts.side}:{},format:this.opts.format??"ID-1",deviceClass:this.deviceClass,video:{width:this.opts.video.videoWidth||0,height:this.opts.video.videoHeight||0},zoom:this.zoom,...t.zoomFallbackAtMs!==void 0?{zoomFallbackAtMs:t.zoomFallbackAtMs}:{},...t.msToCapture!==void 0?{msToCapture:t.msToCapture}:{},...t.via!==void 0?{via:t.via}:{},...t.shutterAtMs!==void 0?{shutterAtMs:t.shutterAtMs}:{},...t.shutterReason!==void 0?{shutterReason:t.shutterReason}:{},ticks:t.ticks,quadFraming:{...t.quadFraming},qualityBlockers:{...t.qualityBlockers},guideBlockers:{...t.guideBlockers},stillRefusals:t.stillRefusals,...this.ocrReport()}}ocrReport(){let t=this.opts.ocr;if(t===void 0)return{};let e=(this.opts.format??"ID-1")==="ID-3"||this.opts.side==="single"?"single":this.opts.side==="verso"?"verso":"recto",n=t.report(e,this.stats.via,(this.opts.now??(()=>performance.now()))());return n===null?{}:{ocr:n}}static freshStats(){return{ticks:0,quadFraming:{},qualityBlockers:{},guideBlockers:{},stillRefusals:0}}setGuide(t){t===void 0?delete this.opts.guide:this.opts.guide=t,this.guideLock.reset()}guideRegion(t){let e=t.width/Math.max(1,t.height),n=this.opts.guide;if(n!==void 0&&n.viewAspect>0){let c={width:n.viewAspect,height:1},a={x:n.rect.x*n.viewAspect,y:n.rect.y,width:n.rect.width*n.viewAspect,height:n.rect.height};return Se(c,a,e,0)}let o=Vt(this.opts.format??"ID-1").center,s=.86,r=s*e/o;return r>.84&&(r=.84,s=r*o/e),{x:(1-s)/2,y:(1-r)/2,width:s,height:r}}resetSide(){this.positioningSince=null,this.detectedSince=null,this.lastSeenAt=null,this.guideLock.reset(),this.lastGuideQuad=null,this.lastOcrReady=null,this.opts.ocr?.reset(),this.stats=i.freshStats(),this.shutterOffered&&(this.shutterOffered=!1,this.emit("shutter",{available:!1}))}withdrawShutter(){this.shutterOffered&&(this.shutterOffered=!1,this.emit("shutter",{available:!1}))}zoomFallback(t){let e=this.videoTrack();if(e===null||this.zoom<=1)return;let n=this.focusCaps(),o=typeof n?.zoom?.min=="number"?Math.max(n.zoom.min,1):1;this.zoom=o,this.stats.zoomFallbackAtMs=Math.round(t-(this.positioningSince??t)),this.guideLock.reset(),this.gate.reset(),e.applyConstraints({advanced:[{zoom:o}]}).catch(()=>{})}offerShutter(t,e){this.shutterOffered||(this.shutterOffered=!0,this.stats.shutterAtMs=Math.round(e-(this.positioningSince??e)),this.stats.shutterReason=t,this.emit("shutter",{available:!0,reason:t}))}torchAvailable(){try{return this.stream?.getVideoTracks?.()[0]?.getCapabilities?.()?.torch===!0}catch{return!1}}async setTorch(t){this.torchOn=t;try{await this.stream?.getVideoTracks?.()[0]?.applyConstraints({advanced:[{torch:t}]})}catch{}}destroy(){if(this.attempt+=1,this.timer!==null&&(this.opts.clearTimer??clearTimeout)(this.timer),this.timer=null,this.clearFrameWatch(),this.offEnded?.(),this.offEnded=null,this.stream)for(let t of this.stream.getTracks())t.stop();this.stream=null,this.opts.video.srcObject=null}async upgradeResolution(){try{let t=this.stream?.getVideoTracks?.()[0];if(t===void 0)return;let e=t.getSettings?.()??{},n=le(t.getCapabilities?.(),{width:e.width??0,height:e.height??0},this.deviceClass,{width:this.camera.width,height:this.camera.height});n!==null&&await t.applyConstraints(n)}catch{}}focusCaps(){try{return this.videoTrack()?.getCapabilities?.()??null}catch{return null}}async applyFocusAndZoom(){let t=this.videoTrack();if(t===null)return;let e=this.focusCaps();this.camera.continuousFocus&&rt(e,"continuous")&&await t.applyConstraints({advanced:[{focusMode:"continuous"}]}).catch(()=>{});let n={width:0,height:0};try{let s=t.getSettings?.()??{};n={width:s.width??0,height:s.height??0}}catch{}let o=De(e,n,this.opts.format??"ID-1",this.camera);if(o>1)try{await t.applyConstraints({advanced:[{zoom:o}]}),this.zoom=o}catch{this.zoom=1}}async focusAt(t,e){let n=this.videoTrack(),o=yt(this.focusCaps(),t,e);if(!(n===null||o===null))try{await n.applyConstraints({advanced:[o]}),(this.opts.setTimer??setTimeout)(()=>{this.restoreContinuous()},1500)}catch{}}async restoreContinuous(){let t=this.videoTrack();t===null||!this.camera.continuousFocus||!rt(this.focusCaps(),"continuous")||await t.applyConstraints({advanced:[{focusMode:"continuous"}]}).catch(()=>{})}async refocusOn(t,e){let n=this.camera.refocusBeforePhotoMs,o=this.videoTrack();if(n<=0||o===null||e.width<=0||e.height<=0)return;let s=E(t),r=yt(this.focusCaps(),(s.x+s.width/2)/e.width,(s.y+s.height/2)/e.height);if(r!==null)try{await o.applyConstraints({advanced:[r]});let c=this.opts.setTimer??setTimeout;await new Promise(a=>{c(()=>a(),n)})}catch{}}videoTrack(){try{return this.stream?.getVideoTracks?.()[0]??null}catch{return null}}async takeStill(t,e,n){if(this.opts.captureStill!==void 0)return this.opts.captureStill(this.opts.video,t,e);let o=this.opts.format??"ID-1",s=this.videoTrack();if(n&&this.opts.photoCapture!==!1&&this.deviceClass!=="LOW"&&!this.torchOn&&s!==null&&ge(s)){await this.refocusOn(t,e);let r=await Me(this.opts.video,t,e,o,{track:s,detect:this.detector(),detectWidth:et});if(this.restoreContinuous(),r!==null)return r}return ye(this.opts.video,t,e,o)}detector(){return this.opts.detect??((this.opts.format??"ID-1")==="ID-3"?ri:si)}setState(t){this.state=t,this.emit("statechange",{state:t})}scheduleTick(t){let e=this.opts.setTimer??setTimeout;this.timer=e(()=>{this.tick(t)},this.cadenceMs)}async tick(t){if(t!==this.attempt||this.state!=="positioning"||this.capturing)return;let e=this.opts.now??(()=>performance.now()),n=this.opts.grabDetectFrame??Ee,o=this.detector(),s=n(this.opts.video,et);if(s===null){this.scheduleTick(t);return}if(!this.lit){if(ht(s)>ai)this.lit=!0,this.blackTicks=0;else if(++this.blackTicks>=Fe&&this.frameWatch===null&&(this.opts.firstFrameMs??Re)>0){this.cameraDead(t);return}}let r=null;try{r=await o(s)}catch{r=null}if(t!==this.attempt)return;let c=r!==null?lt(s,r):s,a=e(),l={sharpness:j(c),exposure:Kt(c),meanLuma:ht(c),specularFraction:ne(c)},u=oe({format:this.opts.format??"ID-1",quad:r,frameWidth:s.width,frameHeight:s.height,measures:l,...this.opts.thresholds!==void 0?{thresholds:this.opts.thresholds}:{}}),d=this.gate.tick({timestampMs:a,quad:r,quality:l,frameWidth:s.width,frameHeight:s.height}),h=(this.opts.format??"ID-1")!=="ID-3"?Te(s,this.guideRegion(s),{edgePeakFrac:this.guideTuning.edgePeakFrac}):Z,f=this.guideLock.tick(h,a);this.lastGuideQuad=f.detected?_e(h):null;let g=this.capturing?null:this.ocrTick(s,r,h,f.detected,u,a);this.positioningSince??(this.positioningSince=a);let y=this.stats;if(y.ticks+=1,y.quadFraming[u.framing]=(y.quadFraming[u.framing]??0)+1,u.framing==="ok"&&!d.ready){let _=u.lighting!=="ok"?u.lighting:u.glare!=="ok"?"glare":u.blur!=="ok"?"blurry":"steadying";y.qualityBlockers[_]=(y.qualityBlockers[_]??0)+1}y.guideBlockers[f.blocker]=(y.guideBlockers[f.blocker]??0)+1,r!==null||f.detected?(this.detectedSince??(this.detectedSince=a),this.lastSeenAt=a):this.detectedSince=null,this.lastSeenAt!==null&&a-this.lastSeenAt<=pi?a-this.positioningSince>=this.shutterTuning.manualShutterMs?this.offerShutter("timeout",a):g?.suspendQuality!==!0&&this.detectedSince!==null&&a-this.detectedSince>=this.shutterTuning.detectedNoLockMs&&this.offerShutter("detected_no_lock",a):this.withdrawShutter();let I=a-(this.lastSeenAt??this.positioningSince);this.zoom>1&&this.camera.zoomFallbackMs>0&&I>=this.camera.zoomFallbackMs&&this.zoomFallback(a),this.emit("checks",{engine:"docv1",p:d.p,plausible:d.plausible,stableTicks:d.stableTicks,quad:d.quad,frameWidth:s.width,frameHeight:s.height,analysis:u,ready:g?.suspendQuality!==!0&&(d.ready&&r!==null||f.ready&&this.lastGuideQuad!==null)||this.lastOcrReady!==null,guide:{detected:f.detected,blocker:f.blocker,fill:h.fill,shape:h.shape,content:h.content,offsetX:h.offsetX,offsetY:h.offsetY},...g!==null&&g.mode!=="off"?{ocr:{mode:g.mode,...g.mrz?{mrz:g.mrz}:{},...g.lock?{lock:g.lock}:{}}}:g?.mrz?{ocr:{mode:g.mode,mrz:g.mrz}}:{}}),this.lastQuad=d.plausible?r:null,this.lastDetect={width:s.width,height:s.height,tickSharpness:l.sharpness};let v=ee(u);u.framing!=="ok"&&f.detected&&(v=fi(f.blocker,h.brightness<this.guideTuning.darkBrightness)),v==="blurry"&&r!==null&&ui(r,s,this.opts.format??"ID-1")>=this.camera.focusFarFillFrac&&(v="focus_far"),v==="sensing"&&this.zoom>1&&this.camera.noDocFarHintMs>0&&I>=this.camera.noDocFarHintMs&&(v="focus_far");let D=this.feedback.tick(v,a);if(D.key!==this.lastFeedbackKey&&(this.lastFeedbackKey=D.key,this.emit("feedback",D)),d.guidanceKey!==this.lastGuidance&&(this.lastGuidance=d.guidanceKey,this.emit("guidance",{key:d.guidanceKey})),this.capturing)return;let M=g?.suspendQuality!==!0,T=M&&d.ready&&r!==null,k=M&&f.ready&&this.lastGuideQuad!==null,C=this.lastOcrReady;if(C!==null&&this.opts.autoCapture!==!1){let _=this.feedback.force("processing",a);this.lastFeedbackKey=_.key,this.emit("feedback",_);let A=j(lt(s,C.quad));await this.fire(t,C.quad,{width:s.width,height:s.height,tickSharpness:A},C.via);return}if((T||k)&&this.opts.autoCapture!==!1){let _=this.feedback.force("processing",a);this.lastFeedbackKey=_.key,this.emit("feedback",_);let A=k?this.lastGuideQuad:r,B=k?f.via==="steady"?"guide_steady":"guide_good":"quad",U=k?j(lt(s,A)):l.sharpness;await this.fire(t,A,{width:s.width,height:s.height,tickSharpness:U},B);return}this.scheduleTick(t)}async fire(t,e,n,o){this.capturing=!0;let s=this.opts.grabDetectFrame??Ee,r=this.opts.setTimer??setTimeout,c={width:n.width,height:n.height};try{let a={still:await this.takeStill(e,c,!0),sharpness:n.tickSharpness};if(t!==this.attempt)return;let l=a.still.source==="photo"?0:hi;for(let m=0;m<l;m++){if(await new Promise(g=>{r(()=>g(),di)}),t!==this.attempt)return;let h=s(this.opts.video,et);if(h===null)continue;let f=j(lt(h,e));if(f>a.sharpness*mi){let g=await this.takeStill(e,c,!1);if(t!==this.attempt)return;a={still:g,sharpness:f}}}if(t!==this.attempt)return;let u=a.still.sharpness;if(this.opts.autoCapture!==!1&&o!=="manual"&&typeof u=="number"&&u>=0&&u<this.camera.stillSharpnessMin&&this.stillRefusals<this.camera.stillRefusalsMax){this.stillRefusals+=1,this.stats.stillRefusals+=1,this.guideLock.reset(),this.lastOcrReady=null,(o==="text_lock"||o==="live_mrz")&&this.opts.ocr?.rearmFace();let m=(this.opts.now??(()=>performance.now()))(),h=this.feedback.force("focus_far",m);this.lastFeedbackKey=h.key,this.emit("feedback",h),this.capturing=!1,this.gate.reset(),this.scheduleTick(t);return}this.stillRefusals=0;let d=(this.opts.now??(()=>performance.now()))();this.stats.via=o,this.stats.msToCapture=Math.round(d-(this.positioningSince??d)),this.shutterOffered&&(this.shutterOffered=!1,this.emit("shutter",{available:!1})),this.setState("captured"),this.emit("artifacts",{keyframe:a.still.blob,previewDataUrl:a.still.previewDataUrl,...this.opts.side!==void 0?{side:this.opts.side}:{},...a.still.docRegion!==void 0?{docRegion:a.still.docRegion}:{},...(()=>{let m=o==="live_mrz"?this.opts.ocr?.liveCapture():null;return m?{liveMrz:m}:{}})()})}catch{if(t!==this.attempt)return;this.capturing=!1,this.gate.reset(),this.guideLock.reset(),this.lastOcrReady=null,(o==="text_lock"||o==="live_mrz")&&this.opts.ocr?.rearmFace(),this.scheduleTick(t)}}ocrTick(t,e,n,o,s,r){let c=this.opts.ocr,a=this.opts.video;if(c===void 0||!c.hasEngine)return this.lastOcrReady=null,null;let l=a.videoWidth,u=a.videoHeight;if(l<=0||u<=0||t.width<=0||t.height<=0)return null;let m=(this.opts.format??"ID-1")==="ID-3",h=this.guideRegion(t),f={x:h.x*l,y:h.y*u,w:h.width*l,h:h.height*u},g=l/t.width,y=u/t.height,x;m&&e!==null?x=li(E(e),g,y,l,u):x=Jt(f,c.bandTop,u);let w=m?s.glare==="ok":n.cardGlare<=this.guideTuning.glareMax,I=m?s.blur==="ok":n.sharpness>=this.guideTuning.sharpnessMin,v=c.tick({atMs:r,video:a,mrzFace:m||this.opts.side==="verso"||this.opts.side==="single",present:m||e!==null||o,card:f,band:x,portrait:u>l,glareOk:w,sharpOk:I});if(v.ready&&v.via!==void 0){let D=m?e??Ae(h,t):this.lastGuideQuad??Ae(h,t);this.lastOcrReady={quad:D,via:v.via}}else this.lastOcrReady=null;return v}};function li(i,t,e,n,o){let s=Math.min(n,i.width*1.06*t),r=Math.min(o,Math.max(i.height*1.6*e,s/5)),c=(i.y+i.height/2)*e,a=Math.max(0,Math.min(n-s,(i.x-i.width*.03)*t)),l=Math.max(0,Math.min(o-r,c-r/2));return{x:a,y:l,w:s,h:r}}function Ae(i,t){let e=i.x*t.width,n=i.y*t.height,o=(i.x+i.width)*t.width,s=(i.y+i.height)*t.height;return{topLeft:{x:e,y:n},topRight:{x:o,y:n},bottomRight:{x:o,y:s},bottomLeft:{x:e,y:s}}}function ui(i,t,e){let n=E(i);return t.width<=0||t.height<=0?0:e==="ID-3"?n.width/t.width:n.width*n.height/(t.width*t.height)}var hi=2,di=260,mi=1.08;function Ee(i,t){let e=i.videoWidth,n=i.videoHeight;if(e===0||n===0)return null;let o=Math.min(1,t/e),s=Math.round(e*o),r=Math.round(n*o),c=document.createElement("canvas");c.width=s,c.height=r;let a=c.getContext("2d",{willReadFrequently:!0});return a===null?null:(e/Math.max(1,s)>4&&(a.imageSmoothingQuality="high"),a.drawImage(i,0,0,s,r),a.getImageData(0,0,s,r))}function lt(i,t){let e=[t.topLeft.x,t.topRight.x,t.bottomRight.x,t.bottomLeft.x],n=[t.topLeft.y,t.topRight.y,t.bottomRight.y,t.bottomLeft.y],o=Math.max(0,Math.floor(Math.min(...e))),s=Math.max(0,Math.floor(Math.min(...n))),r=Math.min(i.width,Math.ceil(Math.max(...e))),c=Math.min(i.height,Math.ceil(Math.max(...n))),a=Math.max(1,r-o),l=Math.max(1,c-s),u=new Uint8ClampedArray(a*l*4);for(let d=0;d<l;d++){let m=((s+d)*i.width+o)*4;u.set(i.data.subarray(m,m+a*4),d*a*4)}return{data:u,width:a,height:l,colorSpace:i.colorSpace}}function fi(i,t){return i==="glare"?"glare":i==="too_small"?"too_far":i==="too_big"?"too_close":t?"too_dark":i==="blurry"?"blurry":i==="off_center"?"edge_clipped":i==="no_card"?"sensing":"hold_still"}var pi=1200;export{it as a,ee as b,nt as c,He as d,ne as e,Ke as f,oe as g,st as h,Si as i,qe as j,ei as k,gt as l,ii as m,ke as n,rt as o,yt as p,Ti as q,De as r,ni as s,oi as t,we as u,Z as v,Se as w,Te as x,_e as y,J as z,Ri as A,ct as B,Ki as C,Re as D,ai as E,Fe as F,ci as G,Mt as H,Vi as I,Ce as J,li as K,hi as L,di as M};
@@ -1 +0,0 @@
1
- import{d as K,e as me,f as fe,g as he,i as Se,j as X,l as Q,m as ee,o as ge,p as ye,w as be,y as O,z as Z}from"./chunk-JDTZK3A7.js";import{c as ue,d as le,e as pe}from"./chunk-FPXL63KZ.js";import{c as F,g as $,h as _e}from"./chunk-ZMO2ZQAS.js";var Ce=["AD","AE","AF","AG","AI","AL","AM","AO","AQ","AR","AS","AT","AU","AW","AX","AZ","BA","BB","BD","BE","BF","BG","BH","BI","BJ","BL","BM","BN","BO","BQ","BR","BS","BT","BV","BW","BY","BZ","CA","CC","CD","CF","CG","CH","CI","CK","CL","CM","CN","CO","CR","CU","CV","CW","CX","CY","CZ","DE","DJ","DK","DM","DO","DZ","EC","EE","EG","EH","ER","ES","ET","FI","FJ","FK","FM","FO","FR","GA","GB","GD","GE","GF","GG","GH","GI","GL","GM","GN","GP","GQ","GR","GS","GT","GU","GW","GY","HK","HM","HN","HR","HT","HU","ID","IE","IL","IM","IN","IO","IQ","IR","IS","IT","JE","JM","JO","JP","KE","KG","KH","KI","KM","KN","KP","KR","KW","KY","KZ","LA","LB","LC","LI","LK","LR","LS","LT","LU","LV","LY","MA","MC","MD","ME","MF","MG","MH","MK","ML","MM","MN","MO","MP","MQ","MR","MS","MT","MU","MV","MW","MX","MY","MZ","NA","NC","NE","NF","NG","NI","NL","NO","NP","NR","NU","NZ","OM","PA","PE","PF","PG","PH","PK","PL","PM","PN","PR","PS","PT","PW","PY","QA","RE","RO","RS","RU","RW","SA","SB","SC","SD","SE","SG","SH","SI","SJ","SK","SL","SM","SN","SO","SR","SS","ST","SV","SX","SY","SZ","TC","TD","TF","TG","TH","TJ","TK","TL","TM","TN","TO","TR","TT","TV","TW","TZ","UA","UG","UM","US","UY","UZ","VA","VC","VE","VG","VI","VN","VU","WF","WS","XK","YE","YT","ZA","ZM","ZW"];var Ke=["carte_identite","passport","residence_permit"];function Ze(e,t){let i=e.byIssuer?.[t]??e.default;return Ke.filter(s=>i==="*"||i.includes(s))}function Lt(e,t=Ce){return[...new Set([...t,...Object.keys(e.byIssuer??{})])].filter(s=>Ze(e,s).length>0).sort()}function Pe(e){if(e.acceptedDocuments)return e.acceptedDocuments;let t=e.acceptedDocumentTypes?.length?[...e.acceptedDocumentTypes]:["carte_identite","passport"];return{default:[],byIssuer:{MR:t}}}var Ye=640,je=new Set(["network_error","timeout","upload_failed","unknown_error","rate_limit_exceeded"]),ke=6,Re=1500,Me={sharpness:1,exposure:1,meanLuma:128},Ee=null;function We(e,t){try{Ee??(Ee=document.createElement("canvas"));let i=Ee,s=96/Math.max(1,t.width);i.width=Math.max(1,Math.round(t.width*s)),i.height=Math.max(1,Math.round(t.height*s));let r=i.getContext("2d");if(r===null)return Me;r.drawImage(e,t.x,t.y,t.width,t.height,0,0,i.width,i.height);let c=r.getImageData(0,0,i.width,i.height);return{sharpness:le(c),exposure:pe(c),meanLuma:ue(c)}}catch{return Me}}async function Qe(e,t){let i=e.source;return"convertToBlob"in i?i.convertToBlob({type:"image/jpeg",quality:t}):new Promise((s,r)=>{i.toBlob(c=>c===null?r(new Error("encode failed")):s(c),"image/jpeg",t)})}function Bt(e,t={}){let i=t.now??(()=>performance.now()),s=t.setTimer??((l,n)=>setTimeout(l,n)),r=t.clearTimer??(l=>clearTimeout(l)),c=t.encode??Qe,p=t.quality??We,d=e.tuningVersion??null,h=new Set,C=!1,b=e.video??null,S=null,y=t.grabFrame??null,k=null,A=1e3/ke,R=null,E=null,L=!1,w=!1,I=Number.NEGATIVE_INFINITY,M=null,H=0,x=null,V=null,D=Promise.all([import("./icao-gate-PWBMKRGC.js"),import("./icao-tuning-4GGVX6B4.js"),import("./create-portrait-capture-53XBURNT.js"),import("./landmarker-KB7LVXAU.js"),import("./background-monitor-A7FKJOAG.js")]).then(async([l,n,o,a,u])=>{let f=n.resolveIcaoTuning(e.tuning,e.tuningVersion??void 0);f.background.required&&(E=u.createBackgroundMonitor({tuning:f.backgroundCheck,assetBaseUrl:e.assetBaseUrl??"/models-v3",...t.createSegmenter!==void 0?{createSegmenter:t.createSegmenter}:{},now:i})),S=l.createIcaoGate(f,{policy:e.policy??"reject"}),y??(y=o.defaultGrabber()),k=o.observe,A=1e3/Math.min(ke,f.cadenceHz);let _=(t.createLandmarker??a.createFaceLandmarker)(e.assetBaseUrl??"/models-v3"),g=await new Promise((m,P)=>{let v=setTimeout(()=>{P(new Error("landmarker init timeout")),_.then(T=>T.close(),()=>{})},a.LANDMARKER_INIT_TIMEOUT_MS);_.then(T=>{clearTimeout(v),m(T)},T=>{clearTimeout(v),P(T)})});C?g.close():R=g}).catch(()=>{L=!0}),Y=l=>{for(let n of h)n({holding:w||L,update:l})},B=()=>{if(M=null,!(C||R===null||S===null||y===null||k===null||b===null)){if(i()-I>Re){Y(null);return}try{let l=y(b,Ye);if(l!==null){let n=Math.max(i(),H+1);H=n;let o=R.detect(l.source,n),a=b.videoWidth||l.width,u=b.videoHeight||l.height,f=k(o,l,a,u);f.geometry!==null&&E!==null&&(f.backgroundCheck=E.measure(l,f.geometry.box,a,u));let _=S.push(f,i());w=_.ready,Y(_)}}catch{}M=s(B,A)}},j=()=>{let l=i()-I>Re;I=i(),l&&(S?.reset(),w=!1,x=null,V=null),M===null&&R!==null&&!C&&(M=s(B,0))},J=()=>{let l=y===null||b===null?null:y(b,null);if(l===null||S===null||Math.max(l.width,l.height)<e.still.minLongSidePx)return Promise.resolve(null);let n=S.summary();return c(l,e.still.jpegQuality).then(o=>({image:o,width:l.width,height:l.height,gate:n}),()=>null)},W=null;return{engineOptions:{measureQuality:(l,n)=>{b=l,j();let o=p(l,n);return w||L?o:{...o,sharpness:0}},telemetry:l=>{if(l.type!=="fired"||C)return;x=J();let n=W;n!==null&&x.then(o=>o===null?void 0:n(o).catch(()=>{})),w=!1,M!==null&&r(M),M=null,I=Number.NEGATIVE_INFINITY}},decorate:l=>{let n=new WeakMap,o=new Map,a=g=>{let m=n.get(g);return m===void 0&&(m=(async()=>{let P=await ye(l,"image","image/jpeg",g.image.size,{engine:"portrait"});return await l.uploadToSpaces(P.uploadUrl,g.image,"image/jpeg"),(await l.completeMedia(P.key)).key})(),m.catch(()=>n.delete(g)),n.set(g,m)),m};W=a;let u=async g=>{let m;try{m=await a(g)}catch(P){let v=P?.code;if(typeof v=="string"&&je.has(v))throw P;return null}return{media:{portrait:m},gate:_e(g.gate),...d!==null?{tuningVersion:d}:{}}},f=l.submitCheck.bind(l),_=(async(g,m,P)=>{if(g!=="liveness")return f(g,m,P);let v=P?.idempotencyKey,T=v===void 0?void 0:o.get(v);if(T===void 0){let ce=x;T=ce===null?Promise.resolve(null):ce.then(de=>de===null?null:u(de)),v!==void 0&&(o.set(v,T),T.catch(()=>o.delete(v)))}let z=await T;if(z===null)return f("liveness",m,P);let Fe=await f("liveness",{...m,portraitIcao:z},P);return V=z,Fe});return new Proxy(l,{get(g,m){if(m==="submitCheck")return _;let P=Reflect.get(g,m);return typeof P=="function"?P.bind(g):P}})},onGate:l=>(h.add(l),()=>h.delete(l)),lastPortraitInput:()=>V,destroy:()=>{C=!0,x=null,V=null,M!==null&&r(M),M=null,h.clear(),D.then(()=>{R?.close(),R=null,E?.close(),E=null})}}}function Ae(e){return e.idNumberBound??e.nniBound}function Ie(e){return e===void 0?void 0:e.idNumberFromDocument??e.nniFromDocument}function ve(e){let t=e.idNumberMasked??e.nniMasked;return typeof t=="string"&&t!==""?t:void 0}var Te=Object.freeze({nni_invalid:"id_number_invalid",nni_not_found:"registry_record_not_found",nni_recheck:"id_number_recheck",document_nni_mismatch:"document_id_number_mismatch",nni_locked:"id_number_locked",nni_unbound:"id_number_unbound",sandbox_nni_not_seeded:"sandbox_id_number_not_seeded",missing_nni:"missing_id_number",registry_needs_nni_source:"registry_needs_id_number_source"}),$e=new Map(Object.entries(Te)),Kt=new Map(Object.entries(Te).map(([e,t])=>[t,e]));function Oe(e){return $e.get(e)??e}var qe=new Set(["phone_otp","email_otp","national_eid","document","nfc","population_registry","supplied_identity","summary_confirm","liveness","face_match","aml_screening","face_dedup","age_estimation"]),Je=new Set(["supplied_identity","aml_screening","face_dedup","age_estimation"]),ne=["document","population_registry","national_eid"],ie=["phone_otp","email_otp"],xe={identity_method:ne,contact:ie},ze=["population_registry","document"],Le="platform_unsupported",Xe=new Set(["prefilled","user_entered","prefilled_or_entered"]),et={phone_otp:"contact",email_otp:"contact",eid_auth:"identity",doc_ocr:"identity",nfc_chip:"identity",population_registry:"identity",liveness:"live_photo",portrait_icao:"live_photo",face_match:"live_photo"};function N(e){return e.section??et[e.checkType]??null}function oe(e,t){let i=e.plan?.choice;if(i===void 0||i.locked)return;let s=i.options.find(r=>r.id!==i.selected&&r.available!==!1&&t.includes(r.service));return s===void 0?void 0:{nodeId:i.nodeId,option:s}}function re(e){let t=e.plan,i=t?.choice;if(t===void 0||i===void 0||i.locked||t.current===null||t.current===i.nodeId||X(e))return null;let s=xe[i.kind]??[...ne,...ie],r=i.options.flatMap(d=>d.available===!1||!s.includes(d.service)?[]:[d.nationalEid!=null?{id:d.id,service:d.service,nationalEid:d.nationalEid}:{id:d.id,service:d.service}]),c=t.steps.find(d=>d.id===t.current)?.service,p=i.selected??r.find(d=>d.service===c)?.id??null;return r.some(d=>d.id!==p)?{nodeId:i.nodeId,kind:i.kind,current:p,options:r}:null}function Ve(e){return e==null?[]:e.options.filter(t=>t.id!==e.current)}function tt(e){let t=(e.plan?.sections??[]).map(r=>({id:r.id,state:r.state})),i={sessionId:ee(e.sessionId),orgName:e.orgName,returning:e.returning===!0,consentRecorded:e.consentRecorded,expiresAt:e.expiresAt,sections:t.map(r=>r.id),progress:t,purpose:e.purpose??"identity"};e.branding!==void 0&&(i.branding=e.branding),e.cameraUnavailableHandled===!0&&(i.cameraUnavailableHandled=!0);let s=re(e);return s!==null&&(i.switchable=s),i}function nt(e){let t={attemptsRemaining:fe(e),attemptsExhausted:e.attemptsExhausted===!0};return e.reason!==void 0&&(t.reason=e.reason),e.retakeHint!==void 0&&(t.retakeHint=e.retakeHint),t}var De={phone_otp:"phone",email_otp:"email"};function it(e,t){let i=oe(e,[t==="phone_otp"?"email_otp":"phone_otp"]);return i===void 0?void 0:De[i.option.service]}function ot(e,t,i,s){let r=t.checkType==="email_otp",c=(r?t.emailOtp:t.otp)??{},p=r?t.emailOtp?.emailSource:t.otp?.numberSource,d=p!==void 0&&Xe.has(p)?p:r?"prefilled_or_entered":"user_entered",h=typeof c.sentToMasked=="string"&&c.sentToMasked.length>0,C=it(e,r?"email_otp":"phone_otp"),b={key:t.checkType,context:i,section:N(t),phase:h?"verify":"send",canSwitch:C!==void 0,...s},S=r?{kind:"email_otp",...b,emailSource:d,needsEmail:d!=="prefilled"}:{kind:"phone_otp",...b,numberSource:d,needsPhone:d!=="prefilled",channels:(t.otp?.channels??[]).filter(y=>y==="whatsapp"||y==="sms")};if(C!==void 0&&(S.switchChannel=C),h&&(S.sentToMasked=c.sentToMasked),!r&&t.otp?.channel!==void 0&&(S.channel=t.otp.channel),!r&&Array.isArray(t.phoneCountries)&&(S.phoneCountries=t.phoneCountries.filter(y=>typeof y=="string"&&/^[A-Z]{2}$/.test(y))),!r&&Array.isArray(t.phoneRules)){let y=S.phoneCountries??[];S.phoneRules=t.phoneRules.flatMap(k=>{let A=at(k);return A!==void 0&&y.includes(A.code)?[A]:[]})}return!r&&t.phoneInternational===!0&&(S.phoneInternational=!0),c.expiresAt!==void 0&&(S.codeExpiresAt=c.expiresAt),c.resendAvailableAt!==void 0&&(S.resendAvailableAt=c.resendAvailableAt),S}var rt=/^[\d[\]\-|()?:^]{1,64}$/;function st(e){try{return typeof e=="string"&&rt.test(e)&&new RegExp(e)!==null}catch{return!1}}var we=e=>typeof e=="number"&&Number.isInteger(e)&&e>=1&&e<=15;function at(e){let{code:t,dial:i,trunk:s,lengths:r,formats:c}=e??{};if(typeof t!="string"||typeof i!="string"||!/^\d{1,3}$/.test(i)||s!==void 0&&(typeof s!="string"||!/^\d{1,3}$/.test(s))||!Array.isArray(r)||r.length===0||!r.every(we))return;let p={code:t,dial:i,lengths:[...r].sort((d,h)=>d-h)};if(s!==void 0&&(p.trunk=s),c!==void 0){if(!(Array.isArray(c)&&c.length<=8&&c.every(h=>st(h?.leading)&&Array.isArray(h.groups)&&h.groups.every(we)&&r.includes(h.groups.reduce((C,b)=>C+b,0)))))return;p.formats=c.map(h=>({leading:h.leading,groups:[...h.groups]}))}return p}function ct(e,t,i,s){let r=Ae(e)===!0?"bound":Ie(t)===!0?"document":"typed",c=r==="typed"&&t.state==="input_required"&&t.reason!==void 0&&Oe(t.reason)==="id_number_recheck",p=Ve(re(e)),d=!s.attemptsExhausted&&p.length===1&&p[0]?.service==="document";return{kind:"registry",key:"registry",context:i,section:N(t),state:t.state==="input_required"?"input_required":"pending",source:r,recheck:c,canUseDocument:d,...s}}function dt(e,t,i,s){let r=[...t.acceptedSides??[]];return{kind:"document",key:"document",context:i,section:N(t),side:r.includes("recto")?"verso":"recto",acceptedSides:r,documents:Pe(e),...s}}function ut(e){let t=Q(e,"liveness");return t?.state==="passed"||t?.state==="review"}function Ne(e,t,i,s,r){let c=t.icao?.report;return{kind:"portrait",key:`portrait:${r}`,context:i,section:N(t),phase:r,report:Array.isArray(c)?c:null,review:t.state==="review",tuning:e.capture?.icao??null,tuningVersion:e.capture?.tuningVersion??null,icao:$(e),retakeOnly:r==="capture"&&t.state==="input_required"&&e.capture?.livePhoto?.oneCapture===!0&&ut(e),...s}}var te={minLongSidePx:1280,jpegQuality:.95};function lt(e,t){let i=e.capture?.livePhoto;if(i?.oneCapture!==!0)return null;let s=Q(e,"portrait_icao"),r=i.still??te;return{icao:t==="liveness"&&$(e)!==null&&s!==void 0&&s.state==="pending"&&s.reason===void 0,still:{minLongSidePx:r.minLongSidePx??te.minLongSidePx,jpegQuality:r.jpegQuality??te.jpegQuality}}}function pt(e,t,i,s){let r=t.eid,c=N(t);if(r===void 0||r.challenge!=="app_code")return{kind:"unsupported",key:"unsupported:eid_auth",context:i,section:c,checkType:"eid_auth",reason:"update_required"};let p=Ve(re(e)),d=p.length===1&&ze.includes(p[0]?.service??"")?p[0]:void 0,h=d===void 0?void 0:K[d.service],C=h!==void 0,b={kind:"eid",key:"eid",context:i,section:c,provider:r.provider,providerName:r.providerName,country:r.country,challenge:"app_code",phase:r.awaiting==="code"?"code":"identifier",identifierBound:r.identifierBound===!0,canUseCamera:C,afterPass:r.afterPass==="continue"?"continue":"end",...s};return C&&(b.cameraMethod=h),r.expiresAt!==void 0&&(b.codeExpiresAt=r.expiresAt),r.resendAvailableAt!==void 0&&(b.resendAvailableAt=r.resendAvailableAt),r.resendsRemaining!==void 0&&(b.resendsRemaining=r.resendsRemaining),r.codeAttemptsRemaining!==void 0&&(b.codeAttemptsRemaining=r.codeAttemptsRemaining),b}function mt(e,t){if(t.checkType!=="face_match"||t.reason!==void 0)return null;let i=Q(e,"portrait_icao");return i!==void 0&&(i.state==="passed"||i.state==="review")?i:null}function ft(e){return me(e).filter(t=>t.state==="failed").pop()?.attemptsExhausted===!0}function ht(e,t){let i=e.failureReason,s;i===Le?s="platform_unsupported":e.status==="expired"?s="expired":e.status==="review_pending"?s="review":e.status==="completed"&&e.outcome==="approved"?s="approved":e.status==="completed"&&e.outcome==="review"?s="review":i==="device_cooldown"?s="cooldown":i!==void 0?s="policy_stop":ft(e)?s="attempts_exhausted":s="rejected";let r=s==="platform_unsupported"?{sessionId:ee(e.sessionId),status:"unavailable"}:ge(e,{autoRetry:!1}),c={kind:"result",key:"result",context:t,section:null,display:s,result:r};return i!==void 0&&(c.failureReason=i),e.retryAfter!==void 0&&(c.retryAfter=e.retryAfter),c}function St(e,t,i){let s=e.identitySummary;if(s==null)return null;let r={kind:"identity_summary",key:"identity_summary",context:t,section:i??"identity",summaryKind:s.kind==="partial"?"partial":s.kind??"full",source:s.source,portraitAvailable:s.portrait?.available===!0,retakeAvailable:s.retakeAvailable===!0};for(let p of gt){let d=s[p];typeof d=="string"&&d!==""&&(r[p]=d)}let c=ve(s);return c!==void 0&&(r.idNumberMasked=c,r.nniMasked=c),r}var gt=["fullName","birthDate","birthYear","nationality","documentType","documentNumberMasked","expiryDate","retakeTarget"];function G(e,t,i,s){return{kind:"unsupported",key:`unsupported:${i}`,context:e,section:t,checkType:i,reason:s}}function yt(e){return e.kind==="contact"?"contact":(e.kind==="identity_method","identity")}function bt(e,t){let i=xe[e.kind]??[...ne,...ie],s=yt(e),r=e.options.flatMap(p=>{if(p.available===!1||!i.includes(p.service))return[];let d={id:p.id,service:p.service};return p.nationalEid!=null&&(d.nationalEid=p.nationalEid),[d]});if(r.length===0){let p=e.options.length>0&&e.options.every(d=>d.service==="nfc");return G(t,s,"choice",p?"platform_unsupported":"update_required")}let c={nodeId:e.nodeId,kind:e.kind,selected:e.selected,options:r};if(e.kind==="identity_method"){let p={kind:"method",key:"method",context:t,section:s,options:r.map(h=>K[h.service]),choice:c},d=r.find(h=>h.nationalEid!==void 0)?.nationalEid;return d!==void 0&&(p.nationalEid=d),p}return e.kind==="contact"?{kind:"contact_choice",key:"contact_choice",context:t,section:s,options:r.map(p=>De[p.service]),selected:null,locked:!1,choice:c}:{kind:"choice",key:`choice:${e.nodeId}`,context:t,section:s,choice:c}}function q(e,t={}){let i=tt(e);if(X(e)||e.failureReason===Le)return ht(e,i);let s=e.plan;if(s===void 0||!Array.isArray(s.sections))return G(i,null,"plan","update_required");let r=he(e);if(r!==null)return bt(r,i);let c=s.current===null?void 0:s.steps.find(S=>S.id===s.current),p=S=>{let y={kind:"processing",key:"processing",context:i,section:S!==void 0?N(S):s.sections.find(k=>k.state==="current")?.id??null,stalled:!1};return typeof S?.service=="string"&&S.service!==""&&(y.service=S.service),y};if(s.current===null)return p(s.steps.find(S=>S.state==="processing"));if(c===void 0)return G(i,null,"step","update_required");if(!qe.has(c.service))return c.interaction==="server"?p(c):G(i,N(c),c.service,"update_required");if(Je.has(c.service)||!Se(c))return p(c);let d=c,h=nt(d),C=d.checkType,b=N(d);switch(C){case"phone_otp":case"email_otp":return ot(e,d,i,h);case"population_registry":return ct(e,d,i,h);case"eid_auth":return pt(e,d,i,h);case"doc_ocr":return dt(e,d,i,h);case"identity_confirm":return St(e,i,b)??p(d);case"portrait_icao":return Ne(e,d,i,h,"capture");case"liveness":case"face_match":{let S=mt(e,d);if(S!==null)return Ne(e,S,i,h,"match");let y=d.requiresMobile===!0,k=$(e);return y&&t.isMobile===!1?{kind:"mobile_required",key:"mobile_required",context:i,section:b,checkType:C}:{kind:"liveness",key:"biometric",context:i,section:b,mode:C==="face_match"?"selfie":"liveness",requiresMobile:y,instructions:k===null?"standard":"icao",icao:k,livePhoto:lt(e,C),...h}}case"nfc_chip":return G(i,b,C,"platform_unsupported");default:return G(i,b,C,"update_required")}}var _t=/^[A-Z0-9][A-Z0-9 -]{0,39}$/,Ct=Object.freeze({normalize:e=>e.trim().toUpperCase().replace(/\s+/g," "),check:e=>_t.test(e),registrySources:Object.freeze([]),describe:"number must be 1 to 40 letters, digits, spaces or hyphens"});function Pt(e){return typeof e=="string"&&/^\d{10}$/.test(e)&&Number(e)%97===1}var kt=Object.freeze({normalize:e=>e.trim(),check:e=>Pt(e),registrySources:Object.freeze(["MR.anrpts"]),describe:"number must be the 10-digit Mauritanian national ID number with a valid check digit"}),Rt=Object.freeze({"MR:national_id":kt});function se(e,t){return Rt[`${e.toUpperCase()}:${t}`]??Ct}var Mt=Object.freeze({MRT:"MR"});function Ge(e,t){let i=e.trim().toUpperCase();return se(Mt[i]??i,t)}function He(e){let t=Ge(e.issuingCountry,e.type);return t.check(t.normalize(e.number))}function Be(e){return se("MR","national_id").check(e)}function ae(e){let t="";for(let i of e){let s=i.codePointAt(0)??0;s>=1632&&s<=1641?t+=String(s-1632):s>=1776&&s<=1785?t+=String(s-1776):i!==" "&&i!=="-"&&i!==" "&&(t+=i)}return t}var Et=[1e3,2e3,4e3,8e3,15e3],At=3e4,It=/^\+[1-9]\d{6,14}$/,vt=/^\d{6}$/,Tt=/^\d{6}$/,Ot=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,Ue=new Set(["session_not_active","check_not_found","check_already_finalized","check_out_of_order","identity_confirm_required","identity_confirm_locked","choice_locked","choice_option_unavailable","choice_not_found","step_not_on_path","check_not_active"]),wt=new Set(["network_error","timeout","upload_failed","unknown_error","rate_limit_exceeded"]);function an(e){let t=!1,i=null,s="",r=!1,c=!1,p=!1,d={},h={},C=new Set,b=!1,S=null,y="idle",k=new Map,A=new Map,R=(n,o,a)=>{let u=`${n}.${o}`,f=k.get(u);if(f!==void 0)return f;let _=A.get(n),g=(_===void 0?a():_.then(a)).finally(()=>{k.delete(u)});k.set(u,g);let m=g.then(()=>{},()=>{});return A.set(n,m),m.then(()=>{A.get(n)===m&&A.delete(n)}),g},E=async(n,o,a)=>{await e.ensureConsent();let u;try{u=await be(e.runtime,o)}catch(_){if(_ instanceof F&&Ue.has(_.code)){await e.refreshView();return}throw _}if(a?.(),e.destroyed())return;let f=u;f.plan!==void 0&&e.setView!==void 0?e.setView(f):await e.refreshView()},L=async n=>{await e.ensureConsent();let o;try{try{o=await n(e.runtime.client)}catch(a){if(!(a instanceof F)||a.code!=="consent_required")throw a;await e.runtime.ensureConsent({force:!0}),o=await n(e.runtime.client)}}catch(a){if(a instanceof F&&Ue.has(a.code)){await e.refreshView();return}throw a}e.destroyed()||(o!==void 0&&e.setView!==void 0?e.setView(o):await e.refreshView())},w=(n,o)=>R("choice",`${n}:${o}`,()=>L(a=>a.choose(n,o))),I=(n,o)=>n.options.some(a=>a.id===o)?w(n.nodeId,o):Promise.reject(new RangeError(`option ${String(o)} is not offered`)),M=(n,o)=>{let a=e.currentView(),u=a===null?void 0:oe(a,n);return u===void 0?Promise.reject(new RangeError(`the ${o} is not offered`)):w(u.nodeId,u.option.id)},H=n=>R("identity",n,()=>L(o=>o.confirmIdentity===void 0?Promise.reject(new Error("identity confirmation is not available in this build")):o.confirmIdentity(n))),x=(n,o)=>{let a=n.kind,u=a==="phone_otp",f=u?"phone":"email",_={action:"send"};if(u?n.needsPhone:n.needsEmail){let g=o[f]??h[a],m=u?g?.replace(/[\s().-]/g,""):g?.trim();if(m===void 0||!(u?It:Ot).test(m))return Promise.reject(u?new O("phone","format"):new Z("email","format"));_[f]=m}if(u){let g=n.channels,m=o.channel??(g.length===1?g[0]:void 0);if(g.length>0){if(m===void 0)return Promise.reject(new Z("channel","required"));if(!g.includes(m))return Promise.reject(new Z("channel","unavailable"))}m!==void 0&&(_.channel=m),_.phoneRules=1}return R(a,"send",()=>E(a,(g,m)=>g.submitCheck(a,_,{idempotencyKey:m}),()=>{d[a]=e.now(),_[f]!==void 0&&(h[a]=_[f])}))},V=(n,o)=>vt.test(o)?R(n,"verify",()=>E(n,(a,u)=>a.submitCheck(n,{action:"verify",code:o},{idempotencyKey:u}))):Promise.reject(new O("code","format")),D=(n,o)=>R("eid_auth",n,()=>E("eid_auth",(a,u)=>a.submitCheck("eid_auth",o,{idempotencyKey:u}))),Y=(n,o)=>{if(n.identifierBound)return D("start",{action:"start"});let a=ae(o??"");if(n.country==="MR"){if(!/^\d{10}$/.test(a))return Promise.reject(new O("nni","format"));if(!Be(a))return Promise.reject(new O("nni","check_digit"))}else if(a==="")return Promise.reject(new O("nni","format"));return D("start",{action:"start",identifier:a})},B=(n,o,a)=>{if(n.source!=="typed")return Promise.reject(new RangeError("this session already holds the ID number"));let u=ae(o);return/^\d{10}$/.test(u)?He({type:"national_id",issuingCountry:"MR",number:u})?R("population_registry","submitIdNumber",()=>E("population_registry",(f,_)=>f.submitCheck("population_registry",{idNumber:u,nni:u},{idempotencyKey:_}),()=>{S=`\u2022\u2022\u2022\u2022\u2022\u2022${u.slice(-4)}`})):Promise.reject(new O(a,"check_digit")):Promise.reject(new O(a,"format"))},j=n=>{switch(n.kind){case"phone_otp":case"email_otp":{let o={...n,send:(u={})=>x(n,u),verify:u=>V(n.kind,u),switchTo:()=>n.canSwitch&&n.switchChannel!==void 0?M([n.switchChannel==="email"?"email_otp":"phone_otp"],"other contact option"):Promise.reject(new RangeError("this session has no other contact option"))},a=d[n.kind];return o.resendAvailableAt===void 0&&a!==void 0&&(o.resendAvailableAt=new Date(a+At).toISOString()),o}case"eid":return{...n,start:o=>Y(n,o),verify:o=>Tt.test(o)?D("verify",{action:"verify",code:o}):Promise.reject(new O("code","format")),resend:()=>n.resendsRemaining===0?Promise.reject(new RangeError("no new code can be sent for this session")):D("resend",{action:"resend"}),useCamera:()=>n.canUseCamera&&n.cameraMethod!==void 0?M(n.cameraMethod==="document_photo"?["document"]:["population_registry"],"camera path"):Promise.reject(new RangeError("the camera path is not offered"))};case"method":return{...n,select:o=>{let a=n.choice.options.find(u=>K[u.service]===o);return a!==void 0?I(n.choice,a.id):Promise.reject(new RangeError(`method ${String(o)} is not offered`))},choose:o=>I(n.choice,o)};case"choice":return{...n,choose:o=>I(n.choice,o)};case"registry":return{...n,submitIdNumber:o=>B(n,o,"idNumber"),submitNni:o=>B(n,o,"nni"),confirm:()=>R("population_registry","confirm",()=>E("population_registry",(o,a)=>o.submitCheck("population_registry",{},{idempotencyKey:a}))),useDocument:()=>n.canUseDocument?M(["document"],"document method"):Promise.reject(new RangeError("the document method is not offered"))};case"document":return e.bindDocument!==void 0?e.bindDocument(n,l):{...n,issuer:null,documentType:null,captureSide:null,selectDocument:()=>{throw new Error("document capture is not available in this build")},capture:()=>{throw new Error("document capture is not available in this build")}};case"portrait":return e.bindPortrait!==void 0?e.bindPortrait(n,l):{...n,uploadFailed:!1,resubmit:()=>Promise.resolve(),capture:()=>{throw new Error("portrait capture is not available in this build")}};case"contact_choice":return{...n,select:o=>{let a=o==="phone"?"phone_otp":o==="email"?"email_otp":void 0,u=n.choice.options.find(f=>f.service===a);return u!==void 0?I(n.choice,u.id):Promise.reject(new RangeError(`contact ${String(o)} is not offered`))},choose:o=>I(n.choice,o)};case"identity_summary":return{...n,...n.idNumberMasked===void 0&&n.summaryKind==="partial"&&S!==null?{idNumberMasked:S,nniMasked:S}:{},portrait:async()=>{let o=e.runtime.client;if(!n.portraitAvailable||o.identityPortrait===void 0)return null;try{return await o.identityPortrait()}catch{return null}},confirm:()=>H("confirm"),retake:()=>n.retakeAvailable?H("retake"):Promise.reject(new RangeError("no retake is left"))};case"liveness":return{...n,capture:o=>e.liveness(o),onLivePhoto:o=>n.livePhoto?.icao===!0&&e.onLivePhoto!==void 0?e.onLivePhoto(o):()=>{}};case"mobile_required":case"processing":return{...n,refresh:async()=>{r=!1,await e.refreshView()}};case"unsupported":case"result":return{...n};default:{let o=n;throw new Error(`runner: unhandled step ${JSON.stringify(o)}`)}}},J=async()=>{if(!c){c=!0;try{for(let n of Et){if(await e.sleep(n),!t||e.destroyed())return;let o=await e.refreshView().catch(()=>null);if(o!==null&&q(o,{isMobile:e.isMobile()}).kind!=="processing")return}r=!0,l()}finally{c=!1}}},W=n=>{if(n.kind!=="liveness"||n.mode!=="selfie")return null;let o={kind:"processing",key:"processing",context:n.context,section:n.section,stalled:!1};if(y==="inflight")return o;if(!b||y==="done")return null;let a=e.keptFaceKey?.()??null;return a===null?null:(y="inflight",E("face_match",(u,f)=>u.submitCheck("face_match",{imageKey:a},{idempotencyKey:f}),()=>{y="done"}).then(()=>{y==="inflight"&&(y="done",l())},()=>{y="done",l()}),o)},U=(n,o=!1)=>{if(!t||e.destroyed()||e.chainBusy())return;let a=q(n,{isMobile:e.isMobile()});a.kind==="registry"&&a.recheck&&(b=!0,y="idle"),a=W(a)??a,a.kind==="processing"?a.stalled=r:r=!1;let u=j(a),f=a.kind==="result"?void 0:a.context.switchable,_=f===void 0?u:{...u,chooseOption:m=>I({nodeId:f.nodeId,kind:f.kind,selected:f.current,options:f.options},m)},g=JSON.stringify(_);a.kind==="registry"&&a.source==="document"&&a.state==="pending"&&!C.has("registry")&&(C.add("registry"),_.confirm().catch(m=>{(!(m instanceof F)||wt.has(m.code))&&C.delete("registry")})),!(!o&&g===s)&&(s=g,i=_,e.emitStep(_),a.kind==="processing"&&!r&&y!=="inflight"&&J(),a.kind==="result"&&!p&&(p=!0,e.emitResult(a.result)))};function l(){let n=e.currentView();n!==null&&U(n,!0)}return{run:async()=>{if(e.destroyed())throw new Error("verification destroyed");t=!0;let n=await e.ensureView();return i===null&&U(n),i??j(q(n,{isMobile:e.isMobile()}))},current:()=>i,onView:n=>U(n),onChainIdle:()=>{let n=e.currentView();n!==null&&U(n)},republish:l,submit:E}}export{Ze as a,Lt as b,ke as c,Re as d,Bt as e,q as f,Et as g,At as h,an as i};