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

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 (54) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +8 -0
  3. package/dist/camera-trait-45MJTW4K.js +1 -0
  4. package/dist/{capture-session-doc-VXWWQEP4.js → capture-session-doc-QA4DOFRF.js} +1 -1
  5. package/dist/{capture-session-v3-Cs4yV3HJ.d.cts → capture-session-v3-CNL-GX11.d.cts} +1 -1
  6. package/dist/{capture-session-v3-CFSVWYzi.d.ts → capture-session-v3-DaBqN8fO.d.ts} +1 -1
  7. package/dist/chunk-5ZKQHFFW.js +1 -0
  8. package/dist/{chunk-ZPXL26BF.js → chunk-FGOVIGGL.js} +1 -1
  9. package/dist/{chunk-RNJA5GDF.js → chunk-IG466TOP.js} +1 -1
  10. package/dist/{chunk-4GJXUVZK.js → chunk-KHR4U2SZ.js} +1 -1
  11. package/dist/chunk-KZBBB5B2.js +1 -0
  12. package/dist/chunk-NJML6FMD.js +1 -0
  13. package/dist/chunk-TQB3URP2.js +1 -0
  14. package/dist/{chunk-ZO6IHP2I.js → chunk-U6S7SCBY.js} +1 -1
  15. package/dist/{chunk-6K4D3U6Q.js → chunk-W2WD7PR2.js} +1 -1
  16. package/dist/chunk-XCKE2MJL.js +1 -0
  17. package/dist/chunk-ZLWH4RBO.js +1 -0
  18. package/dist/client/index.cjs +1 -1
  19. package/dist/client/index.d.cts +6 -71
  20. package/dist/client/index.d.ts +6 -71
  21. package/dist/client/index.js +1 -1
  22. package/dist/core/index.cjs +1 -1
  23. package/dist/core/index.d.cts +3 -3
  24. package/dist/core/index.d.ts +3 -3
  25. package/dist/core/index.js +1 -1
  26. package/dist/{create-document-capture-FVSQPUF6.js → create-document-capture-GJXBQMTC.js} +1 -1
  27. package/dist/{create-portrait-capture-INDCF65X.js → create-portrait-capture-MOS2D7CL.js} +1 -1
  28. package/dist/{create-verification-1BrMZqPJ.d.cts → create-verification-BBOUYpga.d.cts} +113 -22
  29. package/dist/{create-verification-CuoYJ3kj.d.ts → create-verification-COpe2hxf.d.ts} +113 -22
  30. package/dist/{icao-gate-BSbyqLUh.d.ts → icao-gate-CEGvJR3q.d.ts} +19 -9
  31. package/dist/{icao-gate-D-wePfoV.d.cts → icao-gate-l40OU6x1.d.cts} +19 -9
  32. package/dist/icao-policy-BgI1Y870.d.ts +71 -0
  33. package/dist/icao-policy-C7fIdRzo.d.cts +71 -0
  34. package/dist/index.cjs +1 -1
  35. package/dist/index.d.cts +7 -7
  36. package/dist/index.d.ts +7 -7
  37. package/dist/index.js +1 -1
  38. package/dist/internal/index.cjs +1 -1
  39. package/dist/internal/index.d.cts +6 -6
  40. package/dist/internal/index.d.ts +6 -6
  41. package/dist/internal/index.js +1 -1
  42. package/dist/plan-runner-35655N4Z.js +1 -0
  43. package/dist/print-AYSCRSZB.js +1 -0
  44. package/dist/{types-DPl0hsmI.d.cts → types-Dpfg2cO8.d.cts} +149 -11
  45. package/dist/{types-DPl0hsmI.d.ts → types-Dpfg2cO8.d.ts} +149 -11
  46. package/dist/upload-file-UYXOHCRG.js +1 -0
  47. package/package.json +3 -2
  48. package/sbom.cdx.json +46 -7
  49. package/dist/chunk-5Y3UST3W.js +0 -1
  50. package/dist/chunk-64V55KD7.js +0 -1
  51. package/dist/chunk-JUEOHNVW.js +0 -1
  52. package/dist/chunk-L45YTRJJ.js +0 -1
  53. package/dist/chunk-PLH6ZR6J.js +0 -1
  54. package/dist/plan-runner-WEUIMCYU.js +0 -1
@@ -291,14 +291,14 @@ type DecisionReason = "liveness_inconclusive" | "match_inconclusive" | "document
291
291
  * `otp_expired` (code lapsed or no active send), `otp_send_failed` (the OTP
292
292
  * service was unreachable / a send returned no token).
293
293
  */
294
- type PhoneOtpReason = "otp_mismatch" | "otp_expired" | "otp_send_failed" | "otp_channel_unavailable" | "otp_destination_not_allowed" | "otp_rate_limited" | "otp_destination_unknown" | "otp_number_invalid" | "otp_number_not_mobile" | "otp_daily_cap_reached" | "payment_method_required" | "spend_cap_reached" | "insufficient_balance";
294
+ type PhoneOtpReason = "otp_mismatch" | "otp_expired" | "otp_send_failed" | "otp_channel_unavailable" | "otp_destination_not_allowed" | "otp_rate_limited" | "otp_resend_limit" | "otp_destination_unknown" | "otp_number_invalid" | "otp_number_not_mobile" | "otp_daily_cap_reached" | "payment_method_required" | "spend_cap_reached" | "insufficient_balance";
295
295
  /**
296
296
  * email_otp reasons (Plan 8, profile v2 §4.6.5). All transient: a wrong or
297
297
  * expired code, a send outage, too many sends, an address that cannot receive
298
298
  * mail (`email_invalid`), or a disposable address the app blocks
299
299
  * (`email_disposable`) — the person enters another address or resends.
300
300
  */
301
- type EmailOtpReason = "otp_mismatch" | "otp_expired" | "otp_send_failed" | "otp_rate_limited" | "email_invalid" | "email_disposable" | "otp_daily_cap_reached";
301
+ type EmailOtpReason = "otp_mismatch" | "otp_expired" | "otp_send_failed" | "otp_rate_limited" | "otp_resend_limit" | "email_invalid" | "email_disposable" | "otp_daily_cap_reached";
302
302
  /**
303
303
  * nfc_chip reasons (M-nfc, SDK spec §4.3). Native SDKs read the chip; the web
304
304
  * never does — on web the step arrives `skipped` (`platform_unsupported`) or
@@ -358,9 +358,10 @@ type CheckReason = LivenessReason | PopulationReason | FaceMatchReason | DocReas
358
358
  * - `device_cooldown` (step 4): this device had too many rejected sessions —
359
359
  * {@link HostedSessionView.retryAfter} says when it may try again;
360
360
  * - `platform_unsupported` (M-nfc): a chip read is required and this client
361
- * can't read one (web); the session stays open for a native app.
361
+ * can't read one (web); the session stays open for a native app;
362
+ * - `blocked_by_org`: one of the organization's blocks stopped the session.
362
363
  */
363
- type SessionFailureReason = "location_not_allowed" | "anonymizer_blocked" | "capture_tampered" | "device_velocity_exceeded" | "device_cooldown" | "platform_unsupported" | "starter_credit_claimed";
364
+ type SessionFailureReason = "location_not_allowed" | "anonymizer_blocked" | "capture_tampered" | "device_velocity_exceeded" | "device_cooldown" | "platform_unsupported" | "blocked_by_org" | "starter_credit_claimed";
364
365
  /**
365
366
  * The profile-v2 policy reasons a session can end on: the two session-level
366
367
  * reasons plus the failed check's policy reasons (`document_type_not_accepted`,
@@ -379,7 +380,8 @@ type CameraUnavailableCause = "denied" | "no_camera";
379
380
  * error's `name` (letters only, at most 40 characters).
380
381
  */
381
382
  interface CaptureIssueReport {
382
- check: "liveness" | "document";
383
+ /** The step whose camera failed (`portrait`: the portrait step's own camera, 2026-11-05). */
384
+ check: "liveness" | "document" | "portrait";
383
385
  /** The public capture error kind shown, or `unavailable` (the SDK reason then rides in `engineKind`). */
384
386
  kind: "permission" | "notfound" | "inuse" | "insecure" | "unsupported" | "generic" | "unavailable";
385
387
  name?: string;
@@ -453,6 +455,11 @@ interface PlanChoiceOption {
453
455
  available: boolean;
454
456
  /** `national_eid` options: the provider ("Verify with Houwiyeti"); absent or `null` otherwise and on older APIs. */
455
457
  nationalEid?: NationalEidOption | null;
458
+ /**
459
+ * `phone_otp` options (flow UX refresh 2026-11-05): the step's channels in display order (informative: the contact
460
+ * choice stays Phone vs Email, the phone step offers the channels as equal buttons). Absent = SMS only or an older API.
461
+ */
462
+ channels?: ("whatsapp" | "sms")[];
456
463
  }
457
464
  /** `plan.choice`: the choice the person makes now (or may still switch, while `locked` is false). */
458
465
  interface PlanChoiceView {
@@ -603,8 +610,16 @@ interface HostedOtpView {
603
610
  * Absent on a session created before channel choice (no picker; SMS).
604
611
  */
605
612
  channels?: ("whatsapp" | "sms")[];
606
- /** ISO-8601 end of the server-side resend cooldown (after a send). */
613
+ /**
614
+ * ISO-8601 end of the server-side resend cooldown (after a send; 30 s since the flow UX refresh 2026-11-05). It
615
+ * holds a resend to the same number only: a changed number is sent at once.
616
+ */
607
617
  resendAvailableAt?: string;
618
+ /**
619
+ * Flow UX refresh 2026-11-05: the code goes to the number the partner supplied: show `otp.prefilledNotice` instead
620
+ * of the number field, and no "Change number". Absent otherwise.
621
+ */
622
+ prefilled?: true;
608
623
  }
609
624
  /**
610
625
  * email_otp DISPLAY-SAFE surface (Plan 8, profile v2 §4.6.5): never the
@@ -617,15 +632,17 @@ interface HostedEmailOtpView {
617
632
  sentToMasked?: string;
618
633
  /** ISO-8601 code expiry from the last send. */
619
634
  expiresAt?: string;
620
- /** ISO-8601 end of the server-side resend cooldown (after a send). */
635
+ /** ISO-8601 end of the server-side resend cooldown (after a send; holds a resend to the same address only). */
621
636
  resendAvailableAt?: string;
637
+ /** Flow UX refresh 2026-11-05: the code goes to the address the partner supplied (`emailOtp.prefilledNotice`). */
638
+ prefilled?: true;
622
639
  }
623
640
  /**
624
641
  * portrait_icao reasons (SDK spec §4.9, ID mode). The first failing ICAO
625
642
  * criterion; every one is retryable (re-run only the ICAO gate).
626
643
  * `media_unreadable` (no report) is shared with liveness.
627
644
  */
628
- type PortraitIcaoReason = "icao_pose" | "icao_eyes" | "icao_mouth" | "icao_occlusion" | "icao_lighting" | "icao_background" | "icao_resolution" | "portrait_not_from_liveness";
645
+ type PortraitIcaoReason = "icao_pose" | "icao_eyes" | "icao_mouth" | "icao_occlusion" | "icao_lighting" | "icao_background" | "icao_resolution" | "portrait_not_from_liveness" | "portrait_recaptured" | "portrait_morph_suspected" | "portrait_reference_mismatch" | "portrait_declined_fix" | "portrait_fix_review";
629
646
  /** One ICAO criterion of the server's portrait report (SDK spec §4.9). */
630
647
  type IcaoCriterion = "pose" | "eyes" | "mouth" | "occlusion" | "glare" | "lighting" | "background" | "resolution";
631
648
  /** The ICAO policy of a session's selfie (spec 2026-10-24 selfie ICAO policy §10). */
@@ -637,6 +654,36 @@ interface HostedIcaoPolicy {
637
654
  }
638
655
  /** `HostedSessionView.portrait`. */
639
656
  type HostedPortraitView = NonNullable<HostedSessionView["portrait"]>;
657
+ /**
658
+ * Where the photo of the ID document step or the portrait step may come from (2026-11-05): `camera` (the camera
659
+ * screen; an upload only once the server offers it, after the camera could not open), `upload` (the upload screen at
660
+ * once) or `choice` (the person picks "Take a photo" or "Upload a photo", unless they already did for this step).
661
+ */
662
+ type PhotoSource = "camera" | "upload" | "choice";
663
+ /** Where a submitted photo came from (2026-11-05): the camera, or a photo picked from the device. Also the person's pick under `choice`. */
664
+ type PhotoSourcePick = "camera" | "upload";
665
+ /**
666
+ * The delivered photo's format (design 2026-11-04 §6.2): `icao_9303` (the 480×640 token image), `photo_35x45_300dpi`
667
+ * or `square_600`.
668
+ */
669
+ type PortraitOutputFormat = "icao_9303" | "photo_35x45_300dpi" | "square_600";
670
+ /**
671
+ * A fix the server applied to a portrait (design 2026-11-04 §6.4 step 2): geometry (`crop`, `scale`, `straighten`)
672
+ * for every output, plus `background`, `exposure` and `white_balance` for the photo formats other than `icao_9303`.
673
+ * The face itself is never changed. A newer server may name others: show the names it sends.
674
+ */
675
+ type PortraitFix = "crop" | "scale" | "straighten" | "background" | "exposure" | "white_balance";
676
+ /**
677
+ * `HostedSessionView.portrait.pendingFix` (design 2026-11-04 §6.4 step 4): the server adjusted the photo and waits for
678
+ * the person to accept it (`fixReview: confirm`). Both URLs are short-lived presigned GETs (until `expiresAt`); `fixes`
679
+ * lists what was changed, in the server's words ({@link PortraitFix}).
680
+ */
681
+ interface HostedPortraitPendingFix {
682
+ originalUrl: string;
683
+ fixedUrl: string;
684
+ fixes: string[];
685
+ expiresAt: string;
686
+ }
640
687
  /** One row of the portrait_icao report: the server's measurement — coaching only. */
641
688
  interface IcaoReportEntry {
642
689
  criterion: IcaoCriterion;
@@ -1138,8 +1185,6 @@ interface HostedSessionView {
1138
1185
  level?: VerificationLevel | null;
1139
1186
  /** How the level was proved, once terminal; `null` while it runs. Absent on older APIs. */
1140
1187
  assurance?: VerificationAssurance | null;
1141
- /** The subject (person) the session is linked to, once that subject has passed a verification (absent before that). Absent on older APIs. */
1142
- subjectId?: string;
1143
1188
  /**
1144
1189
  * A returning-user session (profile v2 step 5): the person verified before
1145
1190
  * and this session only confirms it is still them — liveness and a face
@@ -1165,10 +1210,55 @@ interface HostedSessionView {
1165
1210
  purpose: "id_document";
1166
1211
  /** Present whenever a `portrait_icao` step runs (absent on older servers): `reject` / `id_document`. */
1167
1212
  icao?: HostedIcaoPolicy;
1213
+ /**
1214
+ * 2026-11-05: where the portrait step's photo may come from. Absent on older servers and on a portrait that
1215
+ * rides the liveness capture (= `camera`).
1216
+ */
1217
+ source?: PhotoSource;
1218
+ /** The person's pick under `choice`, once made for this step (do not ask again: a retry). */
1219
+ sourcePick?: PhotoSourcePick;
1220
+ /**
1221
+ * An upload would be accepted now (`upload`, or `choice` without a camera pick; never on a camera step).
1222
+ * Absent on older servers (= `false`).
1223
+ */
1224
+ uploadOffered?: boolean;
1225
+ /** The server adjusts a nearly compliant photo (crop, scale, straighten; more for the photo formats). */
1226
+ fixes?: boolean;
1227
+ /** `confirm`: the person accepts an adjusted photo before it is used ({@link HostedPortraitPendingFix}). */
1228
+ fixReview?: "confirm" | "silent";
1229
+ /** The delivered photo's format. */
1230
+ output?: PortraitOutputFormat;
1231
+ /** The adjusted photo waiting for the person's answer (`portrait_icao` with `{ fixReview: { accept } }`). */
1232
+ pendingFix?: HostedPortraitPendingFix;
1233
+ /**
1234
+ * Design 2026-11-04 §4, §6.3: the portrait step's own capture mode when it has its own screen (`self` /
1235
+ * `assisted`; under `choice` the person's pick once made, else `choice`: ask who takes the photo). Absent = the
1236
+ * still rides the liveness capture (one capture), whatever `capture.livePhoto.oneCapture` says.
1237
+ */
1238
+ captureMode?: CaptureMode;
1239
+ /**
1240
+ * Design 2026-11-04 §6.6: a returning person's earlier photo is waiting to be bound to today's liveness: submit
1241
+ * `portrait_icao` with `{}` (no photo). A dropped reuse clears it and the step asks for a photo.
1242
+ */
1243
+ reuse?: {
1244
+ pending: true;
1245
+ };
1168
1246
  } | {
1169
1247
  /** A verification selfie checked against the ICAO selfie rules (selfie ICAO policy). */
1170
1248
  purpose: "verification";
1171
1249
  icao: HostedIcaoPolicy;
1250
+ /** As on `id_document` (design 2026-11-04 §6.2): newer servers send the step's settings with either purpose. */
1251
+ source?: PhotoSource;
1252
+ sourcePick?: PhotoSourcePick;
1253
+ uploadOffered?: boolean;
1254
+ fixes?: boolean;
1255
+ fixReview?: "confirm" | "silent";
1256
+ output?: PortraitOutputFormat;
1257
+ pendingFix?: HostedPortraitPendingFix;
1258
+ captureMode?: CaptureMode;
1259
+ reuse?: {
1260
+ pending: true;
1261
+ };
1172
1262
  };
1173
1263
  /** The flow version the session runs (Sekyro flows §9.2). */
1174
1264
  flow?: HostedFlowRef;
@@ -1191,6 +1281,11 @@ interface HostedSessionView {
1191
1281
  * older APIs. Offer "continue without a camera" only then, or on a `human` session.
1192
1282
  */
1193
1283
  cameraUnavailableHandled?: true;
1284
+ /**
1285
+ * 2026-11-05: where the ID document step's photo may come from. Absent when the open document step is camera only
1286
+ * with no upload offered (and on older APIs): `{ source: "camera", uploadOffered: false }`.
1287
+ */
1288
+ documents?: HostedDocumentsView;
1194
1289
  /**
1195
1290
  * Spec 2026-10-29 D12: where the hosted completion screen sends the person (`returnUrl`, checked at session
1196
1291
  * create against the app's web origins or native scheme) and the partner's opaque `state`. Never the result.
@@ -1270,6 +1365,13 @@ interface PresignRequest {
1270
1365
  contentLength: number;
1271
1366
  /** D8: the live-camera capture proof (image / clip from the SDK capture flows only). */
1272
1367
  capture?: CaptureProof;
1368
+ /**
1369
+ * Design 2026-11-04 §5.2: `upload` = a photo of the document picked from the device (`image` only, no capture
1370
+ * proof). Accepted only while the session's document step accepts an upload (else 400 `document_upload_not_allowed`);
1371
+ * the promoted key can then only be submitted as `doc_ocr` with `source: "upload"` (else 400
1372
+ * `uploaded_media_not_allowed`).
1373
+ */
1374
+ source?: "upload";
1273
1375
  }
1274
1376
  /**
1275
1377
  * D8 — the proof a live-camera image / clip presign carries: a single-use nonce
@@ -1403,6 +1505,18 @@ interface FaceMatchInput {
1403
1505
  }
1404
1506
  /** Document side (docs.types.ts DocSide). */
1405
1507
  type DocSide = "recto" | "verso" | "single";
1508
+ /** The hosted view's `documents` block (2026-11-05): where the ID document step's photo may come from. */
1509
+ interface HostedDocumentsView {
1510
+ /** The step's setting ({@link PhotoSource}). */
1511
+ source: PhotoSource;
1512
+ /** The person's pick under `choice`, once made for this step (do not ask again: a retry, the back side). */
1513
+ sourcePick?: PhotoSourcePick;
1514
+ /**
1515
+ * An upload would be accepted now: `upload`, or `choice` without a camera pick. Never on a camera step, even when
1516
+ * the person's camera cannot open (the step's source is final).
1517
+ */
1518
+ uploadOffered: boolean;
1519
+ }
1406
1520
  /** doc_ocr executor input: a promoted `doc-images/…` key + which side it shows. */
1407
1521
  interface DocOcrInput {
1408
1522
  imageKey: string;
@@ -1413,6 +1527,11 @@ interface DocOcrInput {
1413
1527
  * only (never MRZ text); the server re-reads the pixels and decides. Omitted when not ready at POST time.
1414
1528
  */
1415
1529
  deviceRead?: DocDeviceRead;
1530
+ /**
1531
+ * 2026-11-05: `upload` when the photo was picked from the device instead of taken with the camera (only while the
1532
+ * view's `documents.uploadOffered`; else 400 `document_upload_not_allowed`). Absent = `camera`.
1533
+ */
1534
+ source?: PhotoSourcePick;
1416
1535
  }
1417
1536
  /** The `doc_ocr` device-read hint (identity-backend DeviceReadSchema; strict, text-free). */
1418
1537
  interface DocDeviceRead {
@@ -1515,6 +1634,15 @@ interface PortraitIcaoInput {
1515
1634
  backgroundCheck?: Record<string, unknown>;
1516
1635
  };
1517
1636
  tuningVersion?: string;
1637
+ /**
1638
+ * Design 2026-11-04 §6.2: `camera` for a photo the portrait camera took, `upload` for a photo picked from the device
1639
+ * (presigned as a declared upload, no capture proof). Absent = `camera`.
1640
+ */
1641
+ source?: PhotoSourcePick;
1642
+ /** The capture mode the portrait camera ran in (the step's, or the person's pick under `choice`). Camera only. */
1643
+ capture?: {
1644
+ mode: ResolvedCaptureMode;
1645
+ };
1518
1646
  }
1519
1647
  /**
1520
1648
  * eid_auth executor input (SDK spec §3.2): `start` asks the provider for a
@@ -1529,6 +1657,16 @@ interface EidAuthInput {
1529
1657
  /** `verify` only: the code shown in the provider's app. */
1530
1658
  code?: string;
1531
1659
  }
1660
+ /**
1661
+ * The person's answer to an adjusted portrait (design 2026-11-04 §6.4 step 4), submitted as `portrait_icao` while
1662
+ * `HostedSessionView.portrait.pendingFix` is present: `accept: true` uses the adjusted photo, `false` ends the attempt
1663
+ * (`portrait_declined_fix`, not billed).
1664
+ */
1665
+ interface PortraitFixReviewInput {
1666
+ fixReview: {
1667
+ accept: boolean;
1668
+ };
1669
+ }
1532
1670
  /** Per-check-type submission input shapes, keyed by the frozen vocabulary. */
1533
1671
  interface CheckInputByType {
1534
1672
  liveness: LivenessInput;
@@ -1558,4 +1696,4 @@ interface SubmitCheckBody {
1558
1696
  forceOutcome?: "pass" | "fail" | "age_over" | "age_uncertain" | "age_under" | "age_unavailable";
1559
1697
  }
1560
1698
 
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 };
1699
+ export { type LivenessCaptureInput as $, type AcceptedDocumentType as A, type HostedEmailOtpView as B, type CaptureContext as C, type DecisionReason as D, type EidAfterPass as E, type FaceMatchInput as F, type HostedFlowRef as G, type HostedAcceptedDocuments as H, type HostedIcaoPolicy as I, type HostedIntegrity as J, type HostedLivePhotoTuning as K, type HostedNativeCaptureTuning as L, type HostedOcrTuning as M, type HostedOtpView as N, type HostedPlanView as O, type HostedPortraitPendingFix as P, type HostedPortraitView as Q, type HostedSessionView as R, type HostedStepView as S, type HostedVoiceLocale as T, type HostedVoiceView as U, type IcaoCriterion as V, type IcaoReportEntry as W, type IdentityConfirmDecision as X, type IdentityMethod as Y, type IdentitySummarySource as Z, type IdentitySummaryView as _, type AttestationInput as a, type LivenessInput as a0, type LivenessReason as a1, type MatchReason as a2, type MediaKind 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 SessionStepView as aA, type SessionView as aB, type StepSection as aC, type SubmitCheckBody as aD, type VerificationAssurance as aE, type VerificationLevel as aF, type ScreenRampColour as aG, type AgeEstimationReason as aH, type CameraUnavailableCause as aI, type CaptureIssueReport as aJ, type CaptureProvenance as aK, type HostedBranding as aL, type HostedBrandingColorKey as aM, type HostedLivenessCaptureTuning as aN, type IcaoCaptureTuning as aO, type RetakeHint as aP, type ScreenRampChallenge as aQ, type ScreenRampRendered as aR, type ScreenRampReport as aS, ICAO_FALLBACK as aT, type IcaoProfile as aU, type ResolvedIcaoTuning as aV, resolveIcaoTuning as aW, type PersonMask as aX, type BackgroundUniformity as aY, type PhoneFormat as aa, type PhoneOtpInput as ab, type PhoneOtpReason as ac, type PhotoSource as ad, type PhotoSourcePick as ae, type PlanAttempts as af, type PlanChoiceKind as ag, type PlanChoiceOption as ah, type PlanChoiceView as ai, type PlanSectionView as aj, type PlanStepView as ak, type PolicyFailureReason as al, type PopulationInput as am, type PopulationReason as an, type PortraitFix as ao, type PortraitFixReviewInput as ap, type PortraitIcaoInput as aq, type PortraitIcaoReason as ar, type PortraitOutputFormat as as, type PresignRequest as at, type PresignUploadResult as au, type RecordConsentResult as av, type ResolvedCaptureMode as aw, type SessionFailureReason as ax, type SessionOutcome as ay, type SessionStatus as az, type CaptureMode as b, type CaptureNoncesResult as c, type CaptureProof as d, type CheckInputByType as e, type CheckReason as f, type CheckState as g, type CheckType as h, type CompleteMediaResult as i, type ConsentLocale as j, type ContactChannel as k, type DocDeviceRead as l, type DocOcrInput as m, type DocReason as n, type DocSide as o, type EidAuthInput as p, type EidReason as q, type EmailOtpInput as r, type EmailOtpReason as s, type FaceMatchReason as t, type HostedCaptureTuning as u, type HostedConsentView as v, type HostedDocumentCaptureTuning as w, type HostedDocumentScanTuning as x, type HostedDocumentsView as y, type HostedEidView as z };
@@ -0,0 +1 @@
1
+ var y=5242880,A=2560,m=[.92,.85,.75],g=new Set(["","image/jpeg","image/jpg","image/pjpeg","image/png","image/heic","image/heif","image/heic-sequence","image/heif-sequence"]),h=new Set(["heic","heix","hevc","hevx","heim","heis","mif1","msf1"]);function f(e){if(e.length>=3&&e[0]===255&&e[1]===216&&e[2]===255)return"jpeg";if(e.length>=8&&e[0]===137&&e[1]===80&&e[2]===78&&e[3]===71&&e[4]===13&&e[5]===10&&e[6]===26&&e[7]===10)return"png";if(e.length>=12&&e[4]===102&&e[5]===116&&e[6]===121&&e[7]===112){let t=String.fromCharCode(e[8],e[9],e[10],e[11]);return h.has(t)?"heif":null}return null}async function w(e){let t=e.slice(0,16);return typeof t.arrayBuffer=="function"?new Uint8Array(await t.arrayBuffer()):new Promise((i,n)=>{let r=new FileReader;r.onload=()=>i(new Uint8Array(r.result)),r.onerror=()=>n(r.error),r.readAsArrayBuffer(t)})}var x=async e=>{let t=await createImageBitmap(e,{imageOrientation:"from-image"});return{width:t.width,height:t.height,draw:(i,n,r)=>i.drawImage(t,0,0,n,r),close:()=>t.close()}},b=(e,t)=>{let i=document.createElement("canvas");i.width=e.width,i.height=e.height;let n=i.getContext("2d");return n===null?Promise.resolve(null):(e.draw(n,e.width,e.height),new Promise(r=>i.toBlob(r,"image/jpeg",t)))};async function U(e,t={}){let i=(e.type??"").toLowerCase();if(!g.has(i)||e.size===0)throw new TypeError("unsupported_file");let n;try{n=f(await w(e))}catch{n=null}if(n===null)throw new TypeError("unsupported_file");if(n!=="heif"&&e.size<=5242880)return{blob:e,contentType:n==="png"?"image/png":"image/jpeg",converted:!1};let r=t.decode??x,u=t.encode??b,o;try{o=await r(e)}catch{throw new TypeError("unsupported_file")}try{if(!(o.width>0&&o.height>0))throw new TypeError("unsupported_file");let l=Math.min(2560,Math.max(o.width,o.height));for(let c=0;c<2;c+=1){let s=l/Math.max(o.width,o.height),d={width:Math.max(1,Math.round(o.width*s)),height:Math.max(1,Math.round(o.height*s)),draw:o.draw};for(let p of m){let a=await u(d,p).catch(()=>null);if(a!==null&&a.size>0&&a.size<=5242880)return{blob:a,contentType:"image/jpeg",converted:!0}}l=Math.round(l*.75)}throw new TypeError("unsupported_file")}finally{o.close()}}export{y as UPLOAD_MAX_BYTES,A as UPLOAD_MAX_LONG_SIDE,U as prepareUploadFile,f as sniffUploadFormat};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sekyro/web",
3
- "version": "0.1.0-rc.19",
3
+ "version": "0.1.0-rc.20",
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": {
@@ -120,7 +120,8 @@
120
120
  "check:ocr-assets": "node scripts/gen-ocr-assets.mjs --check && node scripts/check-ocr-assets.mjs"
121
121
  },
122
122
  "dependencies": {
123
- "@mediapipe/tasks-vision": "0.10.35"
123
+ "@mediapipe/tasks-vision": "0.10.35",
124
+ "@thumbmarkjs/thumbmarkjs": "1.12.0"
124
125
  },
125
126
  "devDependencies": {
126
127
  "@microsoft/api-extractor": "^7.59.4",
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.19",
101
- "bom-ref": "@sekyro/web@0.1.0-rc.19",
100
+ "version": "0.1.0-rc.20",
101
+ "bom-ref": "@sekyro/web@0.1.0-rc.20",
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.19?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.20?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.19|@mediapipe/tasks-vision@0.10.35",
153
+ "bom-ref": "@sekyro/web@0.1.0-rc.20|@mediapipe/tasks-vision@0.10.35",
154
154
  "licenses": [
155
155
  {
156
156
  "license": {
@@ -179,17 +179,56 @@
179
179
  "value": "node_modules/@mediapipe/tasks-vision"
180
180
  }
181
181
  ]
182
+ },
183
+ {
184
+ "type": "library",
185
+ "name": "thumbmarkjs",
186
+ "group": "@thumbmarkjs",
187
+ "version": "1.12.0",
188
+ "bom-ref": "@sekyro/web@0.1.0-rc.20|@thumbmarkjs/thumbmarkjs@1.12.0",
189
+ "licenses": [
190
+ {
191
+ "license": {
192
+ "id": "MIT",
193
+ "acknowledgement": "declared"
194
+ }
195
+ }
196
+ ],
197
+ "purl": "pkg:npm/%40thumbmarkjs/thumbmarkjs@1.12.0",
198
+ "externalReferences": [
199
+ {
200
+ "url": "https://registry.npmjs.org/@thumbmarkjs/thumbmarkjs/-/thumbmarkjs-1.12.0.tgz",
201
+ "type": "distribution",
202
+ "hashes": [
203
+ {
204
+ "alg": "SHA-512",
205
+ "content": "a8620a9522a1b07ec2b5acd4f1d868c010cda359750de02bdf42bbf399c2b457734966a6fecc9bca388f9a62aefe352392e509f24afc572457896431426ffcd7"
206
+ }
207
+ ],
208
+ "comment": "as detected from npm-ls property \"resolved\" and property \"integrity\""
209
+ }
210
+ ],
211
+ "properties": [
212
+ {
213
+ "name": "cdx:npm:package:path",
214
+ "value": "node_modules/@thumbmarkjs/thumbmarkjs"
215
+ }
216
+ ]
182
217
  }
183
218
  ],
184
219
  "dependencies": [
185
220
  {
186
- "ref": "@sekyro/web@0.1.0-rc.19",
221
+ "ref": "@sekyro/web@0.1.0-rc.20",
187
222
  "dependsOn": [
188
- "@sekyro/web@0.1.0-rc.19|@mediapipe/tasks-vision@0.10.35"
223
+ "@sekyro/web@0.1.0-rc.20|@mediapipe/tasks-vision@0.10.35",
224
+ "@sekyro/web@0.1.0-rc.20|@thumbmarkjs/thumbmarkjs@1.12.0"
189
225
  ]
190
226
  },
191
227
  {
192
- "ref": "@sekyro/web@0.1.0-rc.19|@mediapipe/tasks-vision@0.10.35"
228
+ "ref": "@sekyro/web@0.1.0-rc.20|@mediapipe/tasks-vision@0.10.35"
229
+ },
230
+ {
231
+ "ref": "@sekyro/web@0.1.0-rc.20|@thumbmarkjs/thumbmarkjs@1.12.0"
193
232
  }
194
233
  ]
195
234
  }
@@ -1 +0,0 @@
1
- import{a as f,b as y}from"./chunk-JUEOHNVW.js";var T=["session_token_invalid","session_token_required","session_token_session_mismatch","session_not_found","rate_limit_exceeded","consent_required","session_not_active","check_not_found","check_already_finalized","check_out_of_order","check_type_unsupported","force_outcome_forbidden","attestation_invalid","platform_unregistered","app_attest_invalid","too_many_challenges","inference_unavailable","mobile_required","nni_locked","document_nni_mismatch","media_content_type_not_allowed","media_too_large","media_key_invalid","media_key_forbidden","media_not_found","media_unreadable","media_session_invalid","idempotency_key_collision","idempotency_in_progress","idempotency_key_required","validation_error","internal_error","unknown_error","upload_failed","network_error","timeout","nfc_outcome_not_accepted","identity_confirm_required","identity_confirm_locked","choice_not_found","choice_locked","choice_option_unavailable","step_not_on_path","check_not_active","sekyro_app_not_allowed","sekyro_app_unverified","id_number_locked","document_id_number_mismatch"];function H(s){return T.includes(s)}var c=class extends Error{constructor(e){super(e.message),this.name="HostedApiError",this.status=e.status,this.code=e.code,e.retryAfterSeconds!==void 0&&(this.retryAfterSeconds=e.retryAfterSeconds),e.details&&(this.details=e.details)}};var w=6e4,h=4,S=3e4,k=9e5,P=200,C=5,I=400,E=new Set(["server_busy","request_timeout"]),R=3e3;function l(s){return(s.split(";")[0]??"").trim()}var v={liveness:"clipKey",face_match:"imageKey",doc_ocr:"imageKey"},M=`@sekyro/web/${f}`,A=M,_=class{constructor(e){this.sessionId=null;this.bootstrap=null;this.captureNonces=[];this.captureFetch=null;this.reportedIssues=new Set;this.apiOrigin=e.apiOrigin.replace(/\/+$/,""),this.sessionToken=e.sessionToken;let n=e.fetch;this.fetchImpl=(t,i)=>(n??globalThis.fetch).call(globalThis,t,i),this.requestTimeoutMs=e.requestTimeoutMs??S,this.retryAttempts=e.inProgressRetry?.attempts??C,this.retryDelayMs=e.inProgressRetry?.delayMs??I}async getSession(){let e=await this.api("GET","/hosted/session");return this.sessionId=e.sessionId,e}async recordConsent(e){return this.api("POST","/hosted/consent",{body:{locale:e},busyRetry:!0})}async reportCameraUnavailable(e){return this.api("POST","/hosted/camera-unavailable",{body:{cause:e}})}async reportCaptureIssue(e){let n=typeof e.name=="string"?e.name.replace(/[^A-Za-z]/g,"").slice(0,40):"",t=typeof e.engineKind=="string"&&/^[a-z_]{1,32}$/.test(e.engineKind)?e.engineKind:void 0,i=typeof e.attempt=="number"&&Number.isInteger(e.attempt)&&e.attempt>=0&&e.attempt<=1e3?e.attempt:void 0,o=[e.check,i??"",e.kind,n,e.phase??""].join("|");if(this.reportedIssues.has(o))return;this.reportedIssues.add(o);let a={check:e.check,kind:e.kind,...n!==""?{name:n}:{},...e.phase!==void 0?{phase:e.phase}:{},...t!==void 0?{engineKind:t}:{},...i!==void 0?{attempt:i}:{},...e.formFactor!==void 0?{formFactor:e.formFactor}:{}};try{await this.api("POST","/hosted/capture-issue",{body:a,empty:!0})}catch{}}async choose(e,n){let t=await this.api("POST","/hosted/choice",{body:{nodeId:e,option:n},busyRetry:!0});return this.sessionId=t.sessionId,t}async confirmIdentity(e){return this.api("POST","/hosted/identity/confirm",{body:{decision:e}})}async identityPortrait(){return this.api("GET","/hosted/identity/portrait",{blob:!0})}async presign(e,n,t){let i=await this.ensureSessionId(),o={kind:e,contentType:l(n),contentLength:t};return this.api("POST",`/sessions/${i}/media`,{body:o})}armCapture(e=2){this.fillCaptureNonces(e)}async presignCapture(e,n,t,i={}){let o=await this.ensureSessionId(),a=await this.takeCaptureNonce(),d=a===void 0?void 0:{nonce:a,...i.engine!==void 0?{engine:i.engine.slice(0,32)}:{},...i.durationMs!==void 0&&Number.isFinite(i.durationMs)?{captureMs:Math.min(36e5,Math.max(0,Math.round(i.durationMs)))}:{}},r={kind:e,contentType:l(n),contentLength:t,capture:d};return this.api("POST",`/sessions/${o}/media`,{body:r})}async takeCaptureNonce(){let e=()=>{let n=Date.now();return this.captureNonces=this.captureNonces.filter(t=>t.expiresAt-w>n),this.captureNonces.shift()?.nonce};for(let n=0;n<2;n++){let t=e();if(t!==void 0)return t;await this.fillCaptureNonces(1)}return e()}fillCaptureNonces(e){return this.captureFetch??(this.captureFetch=(async()=>{try{let n=await this.ensureSessionId(),t=await this.api("POST",`/sessions/${n}/media/capture-nonces`,{body:{count:Math.min(h,Math.max(1,e))}}),i=Date.now()+Math.max(0,t.expiresIn)*1e3;for(let o of Array.isArray(t.nonces)?t.nonces:[])typeof o=="string"&&o.length>0&&this.captureNonces.push({nonce:o,expiresAt:i});this.captureNonces=this.captureNonces.slice(-h)}catch{}})().finally(()=>{this.captureFetch=null})),this.captureFetch}async uploadToSpaces(e,n,t){let i;try{i=await this.fetchImpl(e,{method:"PUT",headers:{"content-type":l(t)},body:n,signal:AbortSignal.timeout(k)})}catch(o){throw m(o)}if(!i.ok){let o=(await i.text().catch(()=>"")).slice(0,P);throw new c({status:i.status,code:"upload_failed",message:`media upload failed (HTTP ${i.status})${o?`: ${o}`:""}`})}}async completeMedia(e){let n=await this.ensureSessionId();return this.api("POST",`/sessions/${n}/media/complete`,{body:{key:e}})}async submitCheck(e,n,t={}){let i=await this.ensureSessionId(),o={input:n,forceOutcome:t.forceOutcome};return this.api("POST",`/sessions/${i}/checks/${e}`,{body:o,idempotencyKey:t.idempotencyKey,busyRetry:t.idempotencyKey!==void 0})}async uploadAndSubmit(e,n,t,i={}){let o=l(n.contentType),a=await this.presign(n.kind,o,n.blob.size);await this.uploadToSpaces(a.uploadUrl,n.blob,o);let d=await this.completeMedia(a.key),r={...t,[v[e]]:d.key};return this.submitCheck(e,r,i)}async ensureSessionId(){return this.sessionId!==null?this.sessionId:(this.bootstrap??(this.bootstrap=this.getSession().finally(()=>{this.bootstrap=null})),(await this.bootstrap).sessionId)}async api(e,n,t={}){let i=e==="GET"||t.busyRetry===!0,o=`${this.apiOrigin}/api/v2${n}`,a={"x-session-token":this.sessionToken,"x-sekyro-sdk":A};t.body!==void 0&&(a["content-type"]="application/json"),t.idempotencyKey!==void 0&&(a["x-idempotency-key"]=t.idempotencyKey);try{let d=y.timezone();d!==void 0&&(a["sekyro-client-timezone"]=d)}catch{}try{let d=await y.deviceHeader();d!==void 0&&(a["sekyro-client-device"]=d)}catch{}for(let d=0;;d++){let r;try{r=await this.fetchImpl(o,{method:e,headers:a,...t.body!==void 0?{body:JSON.stringify(t.body)}:{},cache:"no-store",signal:AbortSignal.timeout(this.requestTimeoutMs)})}catch(p){throw m(p)}if(r.ok){if(t.empty===!0)return;if(t.blob===!0)try{return await r.blob()}catch(b){throw m(b)}let p;try{p=await r.json()}catch{throw new c({status:r.status,code:"unknown_error",message:`response body was not valid JSON (HTTP ${r.status})`})}return O(p)}let u=await N(r);if(u.code==="idempotency_in_progress"&&d<this.retryAttempts){this.retryDelayMs>0&&await g(this.retryDelayMs);continue}if(i&&u.status===503&&E.has(u.code)){i=!1,await g(Math.min((u.retryAfterSeconds??2)*1e3,R));continue}throw u}}};function m(s){if((typeof s=="object"&&s!==null?s.name:void 0)==="TimeoutError")return new c({status:0,code:"timeout",message:"request timed out"});let n=s instanceof Error?s.message:String(s);return new c({status:0,code:"network_error",message:`network request failed: ${n}`})}function O(s){return s!==null&&typeof s=="object"&&"success"in s&&"data"in s?s.data:s}async function N(s){let e="unknown_error",n=`request failed (HTTP ${s.status})`,t=Number.NaN,i;try{let d=await s.json();if(d!==null&&typeof d=="object"){let r=d;typeof r.code=="string"&&r.code.length>0&&(e=r.code),typeof r.message=="string"&&r.message.length>0&&(n=r.message),typeof r.retryAfterSeconds=="number"&&(t=r.retryAfterSeconds),Array.isArray(r.details?.issues)&&(i=r.details)}}catch{}let o=s.headers.get("retry-after"),a=o===null?Math.floor(t):Number.parseInt(o,10);return new c({status:s.status,code:e,message:n,...Number.isFinite(a)&&a>=0?{retryAfterSeconds:a}:{},details:i})}function g(s){return new Promise(e=>setTimeout(e,s))}function q(s){let e=s?.portrait,n=e?.icao,t=e?.purpose==="id_document";return n==null?t?{policy:"reject",profile:"id_document"}:null:{policy:n.policy==="alert"&&!t?"alert":"reject",profile:t||n.profile==="id_document"?"id_document":"selfie"}}function $(s){return{...s.baselineEyeOpenness!==void 0?{baselineEyeOpenness:s.baselineEyeOpenness}:{},criteria:s.verdict??{},...s.backgroundCheck!==void 0?{backgroundCheck:s.backgroundCheck}:{}}}export{T as a,H as b,c,l as d,M as e,_ as f,q as g,$ as h};
@@ -1 +0,0 @@
1
- import{c as v,d as V}from"./chunk-5Y3UST3W.js";var A=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"}),I=new Map(Object.entries(A)),j=new Map(Object.entries(A).map(([e,n])=>[n,e]));function Re(e){return I.get(e)??e}function B(e){let n=I.get(e)??j.get(e);return n===void 0?[e]:[e,n]}function H(e){let n=[];for(let t of e)for(let i of B(t))n.includes(i)||n.push(i);return n}var $=new Set(H(["no_face","media_unreadable","clip_too_short","no_face_source","side_missing","unreadable","registry_unavailable","otp_mismatch","otp_expired","otp_send_failed","document_type_not_accepted","age_unverifiable","nationality_unreadable","liveness_inconclusive","match_inconclusive","document_authenticity","probe_not_from_liveness","capture_back_camera","capture_not_upright","chip_read_failed","chip_access_denied","chip_parse_failed","icao_pose","icao_eyes","icao_mouth","icao_occlusion","icao_lighting","icao_background","icao_resolution","portrait_not_from_liveness","nni_recheck","device_integrity_failed","eid_identifier_invalid","eid_code_invalid","eid_code_expired","eid_unavailable","eid_resend_too_soon"])),z={document:"document_photo",nfc:"document_chip",population_registry:"national_number",national_eid:"national_eid"};function f(e){return e.plan?.steps??[]}function T(e){return Math.max(0,e.attempts.max-e.attempts.used)}function W(e){let n=e.plan?.choice;return n!==void 0&&e.plan?.current===n.nodeId?n:null}function ke(e){let n=W(e);if(n?.kind!=="identity_method")return null;let t=n.options.map(o=>z[o.service]).filter(o=>o!==void 0),i=n.options.find(o=>o.nationalEid)?.nationalEid;return i?{available:!0,selected:null,options:t,nationalEid:i}:{available:!0,selected:null,options:t}}var X=new Set(["liveness","face_match"]);function E(e){return e!==void 0&&(e.state==="pending"||e.state==="input_required")}function O(e){return e.status!=="created"&&e.status!=="in_progress"}function x(e){let n=e.plan?.current,t=n==null?void 0:f(e).find(i=>i.id===n);return E(t)?t:void 0}function g(e,n){return f(e).find(t=>t.checkType===n)}function y(e){let n=f(e),t=n.findIndex(i=>i.checkType==="liveness");return n.find((i,o)=>o>t&&i.checkType==="face_match")}function L(e,n){let t=g(n,"liveness")?.state,i=y(n)?.state;return(y(e)?.state??"pending")==="pending"&&(t==="passed"||t==="review")&&i!==void 0&&i!=="pending"&&i!=="skipped"}function P(e,n){let t=new Map(f(e).map(i=>[i.id,i.state]));return f(n).filter(i=>i.checkType==="face_match"&&(t.get(i.id)??"pending")==="pending"&&i.state!=="pending"&&i.state!=="skipped").map(i=>i.id)}var G=/^[0-9a-f]{24}$/i;function w(e){return G.test(e)?`ses_${e}`:e}function b(e,n){let t=w(e);return n===void 0?{sessionId:t,status:"unavailable"}:{sessionId:t,status:"unavailable",reason:n}}function _(e,n,t){let i=w(e);return t===void 0?{sessionId:i,status:n}:{sessionId:i,status:n,reason:t}}function Ce(e,n){let{sessionId:t}=e;switch(e.status){case"completed":case"failed":case"review_pending":return Q(e,Z(e));case"expired":return b(t);case"created":case"in_progress":break;default:{let i=e.status;throw new Error(`mapSessionResult: unhandled status ${i}`)}}return ne(e,n)}var J=new Set([0,1,2,3]);function Q(e,n){if(J.has(e.level)&&(n.level=e.level),typeof e.assurance=="string"&&e.assurance.length>0&&(n.assurance=e.assurance),typeof e.subjectId=="string"&&e.subjectId.length>0){n.subjectId=e.subjectId;let t=/^([0-9a-f]{24})$/i.exec(e.subjectId)?.[1];t!==void 0&&(n.personId=`per_${t.toLowerCase()}`)}return n}function Z(e){let n=w(e.sessionId);switch(e.status){case"completed":return e.outcome==="approved"?{sessionId:n,status:"approved"}:e.outcome==="review"?_(n,"review",h(e,"review")):_(n,"rejected",h(e,"failed"));case"failed":{let t=_(n,"rejected",e.failureReason??h(e,"failed"));return e.failureReason==="device_cooldown"&&e.retryAfter!==void 0&&(t.retryAfter=e.retryAfter),t}default:return _(n,"review",h(e,"review"))}}function ee(e,n){if(n===void 0)return!1;let t=f(n).find(i=>i.id===e.id);return t!==void 0&&t.attempts.used===e.attempts.used}function ne(e,n){let t=w(e.sessionId),i=f(e).find(s=>X.has(s.checkType)&&s.state==="input_required"&&s.reason!==void 0);if(i?.reason==="mobile_required")return b(t,"mobile_required");if(i?.reason!==void 0){let s=n.autoRetry&&T(i)>0&&($.has(i.reason)||ee(i,n.previous)),c={sessionId:t,status:s?"retry":"rejected",reason:i.reason,attemptsRemaining:T(i)};return i.retakeHint!==void 0&&(c.retakeHint=i.retakeHint),c}let o=x(e);return o===void 0&&f(e).some(s=>s.state==="review")?_(t,"review",h(e,"review")):o?.checkType==="portrait_icao"?b(t,"portrait_required"):b(t)}function h(e,n){let t=f(e).filter(i=>i.state===n&&i.reason!==void 0);return t[n==="failed"?t.length-1:0]?.reason}function F(e,n,t,i,o){return e.presignCapture!==void 0?e.presignCapture(n,t,i,o):e.presign(n,t,i)}function K(e){return{engine:e?.engine,durationMs:e?.clipMs}}var te=["video/webm","video/mp4"],N="image/jpeg",ie=2,oe=1e3,se=1e4,re=3,ae=10,ce=30,de=3,ue=new Set(["network_error","timeout","upload_failed","unknown_error","rate_limit_exceeded"]),le=new Set(["session_not_active","check_not_found","check_already_finalized","check_out_of_order","identity_confirm_required","check_not_active","step_not_on_path"]),S=class extends Error{constructor(){super("verification destroyed"),this.name="FlowCancelledError"}};function fe(e){let n=y(e);return g(e,"portrait_icao")?.state!=="pending"&&(n!==void 0?E(n):e.capture?.livePhoto?.oneCapture===!0)}var R=class extends Error{constructor(n){super(n),this.name="AttestationError"}};async function q(e,n,t={}){let i=e.uuid(),o=!1,s=!1,c=0,d=0;for(;;)try{return await n(e.client,i)}catch(r){if(r instanceof R){if(s)throw r;s=!0,t.onAttestationInvalid?.(),i=e.uuid();continue}if(!(r instanceof v))throw r;if(r.code==="consent_required"&&!o){o=!0,await e.ensureConsent({force:!0}),i=e.uuid();continue}if(r.code==="attestation_invalid"&&!s){s=!0,t.onAttestationInvalid?.(),i=e.uuid();continue}if(r.code==="inference_unavailable"&&d<re){d+=1;let a=Math.min(r.retryAfterSeconds??ae,ce);e.onBusy?.({attempt:d,retryAfterSeconds:a}),await e.sleep(a*1e3),t.onAttestationInvalid?.(),i=e.uuid();continue}if(ue.has(r.code)&&c<ie){c+=1;let a=r.retryAfterSeconds!==void 0?r.retryAfterSeconds*1e3:void 0;await e.sleep(a!==void 0?Math.min(a,se):oe);continue}throw r}}var pe=new Set(["passed","review","processing","skipped"]);async function Me(e){let{artifacts:n}=e,t=n.clip,i=V(n.clipMime??"");if(n.degraded==="NO_RECORDER"||t===void 0||!te.includes(i))return{kind:"unavailable",reason:"no_recorder"};e.client.armCapture?.(2);let o=me(e,n.keyframe),s=_e(e,t,i,o),c=he(e,o),d=!1,r=new Set,a=!0,m=0;for(;;){if(e.isCancelled())return{kind:"cancelled"};let l=e.getView();if(O(l))return{kind:"settled"};let k=x(l),M=k?.checkType,C=M==="liveness"&&!d?"liveness":M==="face_match"&&!r.has(k?.id)&&r.size<2&&a?"face_match":null;if(C===null)return{kind:"settled"};if(C==="liveness"&&n.captureChannel==="desktop"&&g(l,"liveness")?.requiresMobile===!0)return{kind:"unavailable",reason:"mobile_required"};try{if(C==="liveness"){d=!0;let u=await s();if(e.isCancelled())return{kind:"cancelled"};L(l,u)&&r.add(y(u)?.id);for(let Y of P(l,u))r.add(Y);await e.applySubmit(u,"liveness");let p=g(e.getView(),"liveness")?.state;a=p===void 0||pe.has(p)}else{r.add(k?.id);let u=await c();if(e.isCancelled())return{kind:"cancelled"};for(let p of P(l,u))r.add(p);await e.applySubmit(u,"face_match")}}catch(u){if(e.isCancelled()||u instanceof S)return{kind:"cancelled"};let p=Se(u);if(p.kind!=="resync"||m>=de)return p;m+=1,await e.refreshView()}}}function me(e,n){let t=null,i=null,o=()=>t!==null?Promise.resolve(t):(i??(i=(async()=>{let s=await F(e.client,"image",N,n.size,K(e.artifacts));return await e.client.uploadToSpaces(s.uploadUrl,n,N),t=(await e.client.completeMedia(s.key)).key,e.onKeyframePromoted?.(t),t})().finally(()=>{i=null})),i);return{ensure:o,attempt:()=>o().catch(()=>null),current:()=>t}}function _e(e,n,t,i){let o=null,s,c=null;return()=>q(e,async(d,r)=>{if(o===null||s===void 0){if(e.isCancelled())throw new S;s===void 0&&!fe(e.getView())&&(s=null),e.onPhase("uploading");let[a,m]=await Promise.all([o!==null?Promise.resolve(o):(async()=>{let l=await F(d,"clip",t,n.size,K(e.artifacts));return await d.uploadToSpaces(l.uploadUrl,n,t),(await d.completeMedia(l.key)).key})(),s!==void 0?Promise.resolve(s===null?null:s.imageKey):i.attempt()]);o=a,s===void 0&&(s=m===null?null:{imageKey:m})}if(c===null)try{c=await e.getAttestation()}catch(a){throw new R(a instanceof Error?a.message:String(a))}return e.onPhase("checking"),d.submitCheck("liveness",{clipKey:o,attestation:c,captureChannel:e.artifacts.captureChannel,capture:ye(e.artifacts),...s!==null?{faceMatch:s}:{}},{idempotencyKey:r})},{onAttestationInvalid:()=>{c=null}})}function he(e,n){return()=>q(e,async(t,i)=>{if(n.current()===null){if(e.isCancelled())throw new S;e.onPhase("uploading")}let o=await n.ensure();return e.onPhase("checking"),t.submitCheck("face_match",{imageKey:o},{idempotencyKey:i})})}function ye(e){let n={width:e.width,height:e.height};for(let t of ge)e[t]!==void 0&&(n[t]=e[t]);return n}var ge=["engine","facingMode","mode","formFactor","clipMs","cameraReadyMs","faceAcquireMs","captureMs","screenRamp","provenance"];function Se(e){if(e instanceof R)return{kind:"unavailable",reason:"attestation"};if(e instanceof v){if(e.code==="attestation_invalid")return{kind:"unavailable",reason:"attestation"};if(e.code==="inference_unavailable")return{kind:"unavailable",reason:"inference_unavailable"};if(e.code==="mobile_required")return{kind:"unavailable",reason:"mobile_required"};if(le.has(e.code))return{kind:"resync"}}return{kind:"unavailable",reason:"network"}}var D=class extends Error{constructor(n,t){super(`invalid ${n} (${t})`),this.name="InvalidInputError",this.field=n,this.kind=t}},U=class extends Error{constructor(n,t){super(`invalid ${n} (${t})`),this.name="OtpInputError",this.field=n,this.kind=t}};function Ie(e){let n=e?.capture,t=n?.mode;return t==="assisted"||t==="self"||t==="choice"?t:n?.cameraSwitch===!0?"assisted":"self"}function He(e,n){return e==="choice"?n??"self":e}export{Ie as a,He as b,Re as c,$ as d,z as e,f,T as g,W as h,ke as i,E as j,O as k,x as l,g as m,w as n,b as o,Ce as p,F as q,te as r,ie as s,oe as t,re as u,ae as v,R as w,q as x,Me as y,D as z,U as A};
@@ -1 +0,0 @@
1
- var c="0.1.0-rc.19";var d="sekyro.did",l;function g(){let t=globalThis.crypto;try{if(typeof t?.randomUUID=="function")return t.randomUUID()}catch{}try{if(typeof t?.getRandomValues=="function"){let e=t.getRandomValues(new Uint8Array(16));return Array.from(e,r=>r.toString(16).padStart(2,"0")).join("")}}catch{}}function f(){try{let t=localStorage.getItem(d);if(t)return t;let e=g();return e!==void 0&&localStorage.setItem(d,e),e}catch{return l??(l=g()),l}}async function m(){let t=globalThis.crypto?.subtle;if(!t)return"";let e=navigator,r=JSON.stringify([e.userAgent,e.platform,e.hardwareConcurrency??null,e.deviceMemory??null,e.maxTouchPoints??0,screen.width,screen.height,screen.colorDepth,globalThis.devicePixelRatio??1,Intl.DateTimeFormat().resolvedOptions().timeZone,e.languages?.join(",")??e.language]),n=await t.digest("SHA-256",new TextEncoder().encode(r));return Array.from(new Uint8Array(n),i=>i.toString(16).padStart(2,"0")).join("").slice(0,32)}function p(t){let e=new TextEncoder().encode(t),r="";for(let n of e)r+=String.fromCharCode(n);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function y(t){let e,r;return{timezone(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone?.slice(0,64)||void 0}catch{return}},noteCameraLabel(n){n&&(e=n.slice(0,128))},async deviceHeader(){try{r??(r=m().catch(()=>""));let n=[];navigator.webdriver&&n.push("webdriver"),/HeadlessChrome/.test(navigator.userAgent)&&n.push("headless");let i=await r,s=f(),u={v:1,platform:"web",sdk:t.sdk.slice(0,64),ids:[...s?[{kind:"web_local",value:s.slice(0,128)}]:[],...i?[{kind:"web_fp",value:i}]:[]],screen:{w:screen.width,h:screen.height,dpr:globalThis.devicePixelRatio??1},...e?{cameraLabel:e}:{},...n.length?{signals:n}:{}};return p(JSON.stringify(u))}catch{return}}}}var o=Symbol.for("sekyro.web.clientContext"),a=globalThis,b=a[o]??(a[o]=y({sdk:`@sekyro/web@${c}`}));function C(t){try{let e=t.getVideoTracks?.()[0];e&&b.noteCameraLabel(e.label)}catch{}}export{c as a,b,C as c};
@@ -1 +0,0 @@
1
- import{a as z,b as xe,c as ve,e as V,f as D,g as B,h as Ie,i as E,j as F,k as b,l as G,m as R,n as ee,o as w,p as H,x as Ae,y as we}from"./chunk-64V55KD7.js";import{n as Pe}from"./chunk-6K4D3U6Q.js";import{a as be}from"./chunk-GT2ZLGF7.js";import{c as ke,d as j}from"./chunk-FUHDOEBP.js";import{c as X,f as Re,g as K}from"./chunk-5Y3UST3W.js";function q(e){return e.idNumberBound??e.nniBound}function N(e){return e===void 0?void 0:e.idNumberFromDocument??e.nniFromDocument}function Oe(e){let t=e.idNumberMasked??e.nniMasked;return typeof t=="string"&&t!==""?t:void 0}var Xe="https://api.sekyro.ai",ze=5e3,et=1500,tt=10;function nt(e){return new Promise(t=>setTimeout(t,e))}function it(){let e=globalThis.crypto;if(e!==void 0&&typeof e.randomUUID=="function")return e.randomUUID();let t=new Uint8Array(16);if(e!==void 0&&typeof e.getRandomValues=="function")e.getRandomValues(t);else for(let o=0;o<16;o+=1)t[o]=Math.floor(Math.random()*256);t[6]=(t[6]??0)&15|64,t[8]=(t[8]??0)&63|128;let i=[...t].map(o=>o.toString(16).padStart(2,"0")).join("");return`${i.slice(0,8)}-${i.slice(8,12)}-${i.slice(12,16)}-${i.slice(16,20)}-${i.slice(20)}`}function Kt(e){return ot(e,{})}function ot(e,t){let i=e.apiOrigin??Xe,o=e.autoRetry??!0,r=e.rearm??"auto",s=t.client??new Re({apiOrigin:i,sessionToken:e.clientToken,fetch:e.fetch}),u=t.sleep??nt,a=t.uuid??it,p=t.getTurnstileToken??((n,c)=>import("./turnstile-FATNZ4AG.js").then(l=>l.executeTurnstile(n,c))),S=be(),h=null,m=null,d=!1,P=new AbortController,f=null,Y=null,L=null,re=()=>xe(z(f),L),x=n=>{f=n,S.emit("view",n),h?.onView(n)},_=()=>f!==null?Promise.resolve(f):(Y??(Y=s.getSession().then(n=>(x(n),n)).finally(()=>{Y=null})),Y),v=async()=>{let n=await s.getSession();return x(n),n},Z=async(n,c)=>{n.plan!==void 0?x(n):await v()},W=null,se=async n=>{let c=await _();if(!n&&c.consentRecorded)return;let l=await s.recordConsent(e.locale);l.plan!==void 0?x(l):f!==null&&x({...f,consentRecorded:!0})},O=n=>n?.force===!0?se(!0):(W??(W=se(!1).finally(()=>{W=null})),W),$={client:s,ensureConsent:n=>O(n),sleep:u,uuid:a,onBusy:n=>{d||S.emit("busy",n)}},ae=!1,ce=null,J=n=>{if(n.status==="approved"||n.status==="rejected"||n.status==="review"){if(ae)return;ae=!0}ce=JSON.stringify(n),S.emit("result",n)},Ue=n=>{ce!==JSON.stringify(n)&&J(n)},ue=async n=>{let c=f;n&&(c=await v().catch(()=>f));let l=c===null?null:E(c);return l!==null&&!d&&S.emit("method",l),l!==null},de=null,le=!1,pe=!1,fe=()=>Ae($,(n,c)=>n.submitCheck("population_registry",{},{idempotencyKey:c})),me=n=>q(n)===!0||N(R(n,"population_registry"))===!0,Be=async()=>{try{let n=await _();if(b(n)||E(n)!==null||G(n)?.checkType!=="population_registry")return;if(!me(n)&&N(R(n,"population_registry"))===void 0&&(n=await v()),!me(n)){pe=!0;return}await O(),await Z(await fe(),"population_registry");let c=f===null?void 0:R(f,"population_registry");if(c?.state==="input_required"&&c.reason==="registry_unavailable"&&B(c)>0){if(await u(ze),d)return;await Z(await fe(),"population_registry")}}catch(n){if(n instanceof X&&(n.code==="check_not_active"||n.code==="step_not_on_path")){await v().catch(()=>{});return}le=!0;return}f!==null&&b(f)&&J(H(f,{autoRetry:o}))},he=()=>(de??(de=Be()),de),Fe=async()=>{let c=(await _()).turnstileSiteKey;return c===null?{sandbox:!0}:{channel:"hosted_web",siteKey:c,turnstileToken:await p(c,{signal:P.signal})}},k=null,Se=Promise.resolve(),T=0,Ge=async()=>{let n=await _();for(let c=0;c<tt&&!d&&!b(n)&&G(n)===void 0&&D(n).some(l=>l.state==="processing")&&(await u(et),!d);c+=1)n=await v();return n},Ke=async(n,c,l)=>{let{capture:g}=n,C=()=>d,U=()=>n.alive&&n.attempt===l,Ce=y=>{U()&&g.setFlowState(y)},A=y=>{if(!C()&&(J(y),!!U())){if(y.status==="retry"&&r==="auto"){g.handle.retry();return}g.setFlowState("done")}};if(c.degraded==="NO_RECORDER"){let y=f?.sessionId??(await _().catch(()=>null))?.sessionId??"";A(w(y,"no_recorder"));return}Ce("uploading");try{if(await he(),C())return;let y=await _(),_e;if(!b(y)&&E(y)!==null){await ue(!1),A(w(y.sessionId,"method_required"));return}if(!b(y)){if(G(y)?.checkType==="population_registry"){A(w(y.sessionId,pe?"nni_unbound":le?"network":"registry_unavailable"));return}if(await O(),C())return;_e=f??y;let Q=await we({...$,artifacts:c,getAttestation:Fe,getView:()=>f??y,refreshView:v,applySubmit:Z,onPhase:Ce,isCancelled:C,onKeyframePromoted:je=>{m=je}});if(C())return;if(Q.kind==="unavailable"){A(w(y.sessionId,Q.reason));return}if(Q.kind==="resync"&&await v(),f!==null&&E(f)!==null){await ue(!1),A(w(y.sessionId,"method_required"));return}y=await Ge()}A(H(y,{autoRetry:o,previous:_e}))}catch{if(C())return;A(w(f?.sessionId??"","network"))}},qe=(n,c)=>{let l=n.attempt;T>0&&n.alive&&n.capture.setFlowState("uploading"),T+=1,Se=Se.then(()=>Ke(n,c,l)).finally(()=>{T-=1,T===0&&h?.onChainIdle()}).catch(()=>{})},ye=n=>{k?.capture.handle.destroy(),k!==null&&(k.alive=!1);let c=Pe(n,h?.captureInternals?.(n)??t.capture,()=>f?.capture?.liveness?.keyframe?.rank===!0,re,()=>f?.capture?.liveness?.screenRamp),l={capture:c,alive:!0,attempt:0};k=l,c.handle.on("state",C=>{C==="starting"&&(l.attempt+=1)}),c.handle.on("captured",C=>{Promise.resolve().then(()=>qe(l,C))});let g=c.handle;return{get state(){return g.state},get captureMode(){return g.captureMode},get facingMode(){return g.facingMode},on:(C,U)=>g.on(C,U),start:async C=>{if(f===null&&await _().catch(()=>{}),!!l.alive)return g.start(C)},retry:()=>g.retry(),switchCamera:()=>g.switchCamera(),destroy:()=>{l.alive=!1,k===l&&(k=null),g.destroy()}}},Ye=async()=>{if(d)return null;try{let n=await _();return d?null:E(n)}catch{return null}},Ze=async()=>{if(d)return"self";try{let n=await _();if(d)return"self";let c=z(n);return c==="choice"?L??c:c}catch{return"self"}},We=async()=>{if(d)return!1;try{let n=await _();if(d||b(n))return!1;let c=R(n,"liveness");return F(c)&&c?.requiresMobile===!0&&!j()}catch{return!1}},$e=async()=>{if(d)return!1;try{let n=await _();return!d&&n.returning===!0}catch{return!1}},Je=async n=>{let c=(await _()).plan?.choice,l=c?.options.find(C=>V[C.service]===n);if(!l)throw new RangeError(`method ${String(n)} is not offered`);let g=await s.choose(c.nodeId,l.id);d||x(g)},ge=null,Qe=()=>(ge??(ge=import("./plan-runner-WEUIMCYU.js").then(n=>{let c=n.createPlanRunner({runtime:$,currentView:()=>f,cameraMode:re,ensureView:_,refreshView:v,ensureConsent:()=>O(),liveness:ye,chainBusy:()=>T>0,destroyed:()=>d,sleep:u,isMobile:j,now:t.now??Date.now,keptFaceKey:()=>m,setView:x,baseCapture:t.capture,emitStep:l=>{d||S.emit("step",l)},emitResult:Ue,documentInternals:t.document,portraitInternals:t.portrait,livePhotoInternals:t.livePhoto});return h=c,c})),ge);return{consent:()=>O(),startRegistry:he,methodChoice:Ye,selectMethod:Je,reportCameraUnavailable:async n=>{await O();let c=s.reportCameraUnavailable;if(c===void 0)throw new TypeError("this client cannot report a missing camera");let l=await c.call(s,n).catch(g=>{if(g instanceof X&&g.code==="check_out_of_order")return s.getSession();throw g});d||x(l)},reportCaptureIssue:n=>{if(d)return;let c=s.reportCaptureIssue;if(c===void 0)return;let l=n.formFactor;try{l??(l=ke())}catch{}c.call(s,{...n,...l!==void 0?{formFactor:l}:{}}).catch(()=>{})},mobileRequired:We,captureMode:Ze,chooseCaptureMode:n=>{L=n},get captureChoice(){return L},returning:$e,liveness:ye,run:async()=>{if(d)throw new Error("verification destroyed");return(await Qe()).run()},currentStep:()=>h?.current()??null,voiceClips:async()=>{if(d)return null;try{let n=await _();return d?null:n.voice??null}catch{return null}},on:(n,c)=>S.on(n,c),destroy:()=>{d=!0,P.abort(),h?.destroy(),k!==null&&(k.alive=!1,k.capture.handle.destroy(),k=null),S.clear()}}}var Ee=["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 rt=["carte_identite","passport","residence_permit"];function st(e,t){let i=e.byIssuer?.[t]??e.default;return rt.filter(o=>i==="*"||i.includes(o))}function Wt(e,t=Ee){return[...new Set([...t,...Object.keys(e.byIssuer??{})])].filter(o=>st(e,o).length>0).sort()}function Me(e){if(e.acceptedDocuments)return e.acceptedDocuments;let t=e.acceptedDocumentTypes?.length?[...e.acceptedDocumentTypes]:["carte_identite","passport"];return{default:[],byIssuer:{MR:t}}}function $t(e){return/^[A-Z]{2}$/.test(e)?String.fromCodePoint(...[...e].map(t=>127462+t.charCodeAt(0)-65)):""}var tn=["national_number","document_photo","national_eid"],at=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"]),ct=new Set(["supplied_identity","aml_screening","face_dedup","age_estimation"]),ne=["document","population_registry","national_eid"],ie=["phone_otp","email_otp"],De={identity_method:ne,contact:ie},ut=["population_registry","document"],He="platform_unsupported",dt=new Set(["prefilled","user_entered","prefilled_or_entered"]),lt={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 I(e){return e.section??lt[e.checkType]??null}function pt(e,t){let i=e.plan?.choice;if(i===void 0||i.locked)return;let o=i.options.find(r=>r.id!==i.selected&&r.available!==!1&&t.includes(r.service));return o===void 0?void 0:{nodeId:i.nodeId,option:o}}function oe(e){let t=e.plan,i=t?.choice;if(t===void 0||i===void 0||i.locked||t.current===null||t.current===i.nodeId||b(e))return null;let o=De[i.kind]??[...ne,...ie],r=i.options.flatMap(a=>a.available===!1||!o.includes(a.service)?[]:[a.nationalEid!=null?{id:a.id,service:a.service,nationalEid:a.nationalEid}:{id:a.id,service:a.service}]),s=t.steps.find(a=>a.id===t.current)?.service,u=i.selected??r.find(a=>a.service===s)?.id??null;return r.some(a=>a.id!==u)?{nodeId:i.nodeId,kind:i.kind,current:u,options:r}:null}function Ne(e){return e==null?[]:e.options.filter(t=>t.id!==e.current)}function ft(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 o=oe(e);return o!==null&&(i.switchable=o),i}function mt(e){let t={attemptsRemaining:B(e),attemptsExhausted:e.attemptsExhausted===!0};return e.reason!==void 0&&(t.reason=e.reason),e.retakeHint!==void 0&&(t.retakeHint=e.retakeHint),t}var Le={phone_otp:"phone",email_otp:"email"};function ht(e,t){let i=pt(e,[t==="phone_otp"?"email_otp":"phone_otp"]);return i===void 0?void 0:Le[i.option.service]}function St(e,t,i,o){let r=t.checkType==="email_otp",s=(r?t.emailOtp:t.otp)??{},u=r?t.emailOtp?.emailSource:t.otp?.numberSource,a=u!==void 0&&dt.has(u)?u:r?"prefilled_or_entered":"user_entered",p=typeof s.sentToMasked=="string"&&s.sentToMasked.length>0,S=ht(e,r?"email_otp":"phone_otp"),h={key:t.checkType,context:i,section:I(t),phase:p?"verify":"send",canSwitch:S!==void 0,...o},m=r?{kind:"email_otp",...h,emailSource:a,needsEmail:a!=="prefilled"}:{kind:"phone_otp",...h,numberSource:a,needsPhone:a!=="prefilled",channels:(t.otp?.channels??[]).filter(d=>d==="whatsapp"||d==="sms")};if(S!==void 0&&(m.switchChannel=S),p&&(m.sentToMasked=s.sentToMasked),!r&&t.otp?.channel!==void 0&&(m.channel=t.otp.channel),!r&&Array.isArray(t.phoneCountries)&&(m.phoneCountries=t.phoneCountries.filter(d=>typeof d=="string"&&/^[A-Z]{2}$/.test(d))),!r&&Array.isArray(t.phoneRules)){let d=m.phoneCountries??[];m.phoneRules=t.phoneRules.flatMap(P=>{let f=Ct(P);return f!==void 0&&d.includes(f.code)?[f]:[]})}return!r&&t.phoneInternational===!0&&(m.phoneInternational=!0),s.expiresAt!==void 0&&(m.codeExpiresAt=s.expiresAt),s.resendAvailableAt!==void 0&&(m.resendAvailableAt=s.resendAvailableAt),m}var yt=/^[\d[\]\-|()?:^]{1,64}$/;function gt(e){try{return typeof e=="string"&&yt.test(e)&&new RegExp(e)!==null}catch{return!1}}var Te=e=>typeof e=="number"&&Number.isInteger(e)&&e>=1&&e<=15;function Ct(e){let{code:t,dial:i,trunk:o,lengths:r,formats:s}=e??{};if(typeof t!="string"||typeof i!="string"||!/^\d{1,3}$/.test(i)||o!==void 0&&(typeof o!="string"||!/^\d{1,3}$/.test(o))||!Array.isArray(r)||r.length===0||!r.every(Te))return;let u={code:t,dial:i,lengths:[...r].sort((a,p)=>a-p)};if(o!==void 0&&(u.trunk=o),s!==void 0){if(!(Array.isArray(s)&&s.length<=8&&s.every(p=>gt(p?.leading)&&Array.isArray(p.groups)&&p.groups.every(Te)&&r.includes(p.groups.reduce((S,h)=>S+h,0)))))return;u.formats=s.map(p=>({leading:p.leading,groups:[...p.groups]}))}return u}function _t(e,t,i,o){let r=q(e)===!0?"bound":N(t)===!0?"document":"typed",s=r==="typed"&&t.state==="input_required"&&t.reason!==void 0&&ve(t.reason)==="id_number_recheck",u=Ne(oe(e)),a=!o.attemptsExhausted&&u.length===1&&u[0]?.service==="document";return{kind:"registry",key:"registry",context:i,section:I(t),state:t.state==="input_required"?"input_required":"pending",source:r,recheck:s,canUseDocument:a,...o}}function kt(e,t,i,o){let r=[...t.acceptedSides??[]],s={kind:"document",key:"document",context:i,section:I(t),side:r.includes("recto")?"verso":"recto",acceptedSides:r,documents:Me(e),...o};return bt(e)&&(s.ageStepUp=!0),s}function bt(e){let t=D(e).find(o=>o.checkType==="age_estimation"),i=t?.reason;return t?.state==="failed"&&(i==="age_uncertain"||i==="age_unavailable")}function Pt(e){let t=R(e,"liveness");return t?.state==="passed"||t?.state==="review"}function Ve(e,t,i,o,r){let s=t.icao?.report;return{kind:"portrait",key:`portrait:${r}`,context:i,section:I(t),phase:r,report:Array.isArray(s)?s:null,review:t.state==="review",tuning:e.capture?.icao??null,tuningVersion:e.capture?.tuningVersion??null,icao:K(e),retakeOnly:r==="capture"&&t.state==="input_required"&&e.capture?.livePhoto?.oneCapture===!0&&Pt(e),...o}}var te={minLongSidePx:1280,jpegQuality:.95};function Rt(e,t){let i=e.capture?.livePhoto;if(i?.oneCapture!==!0)return null;let o=R(e,"portrait_icao"),r=i.still??te;return{icao:t==="liveness"&&K(e)!==null&&o!==void 0&&o.state==="pending"&&o.reason===void 0,still:{minLongSidePx:r.minLongSidePx??te.minLongSidePx,jpegQuality:r.jpegQuality??te.jpegQuality}}}function xt(e,t,i,o){let r=t.eid,s=I(t);if(r===void 0||r.challenge!=="app_code")return{kind:"unsupported",key:"unsupported:eid_auth",context:i,section:s,checkType:"eid_auth",reason:"update_required"};let u=Ne(oe(e)),a=u.length===1&&ut.includes(u[0]?.service??"")?u[0]:void 0,p=a===void 0?void 0:V[a.service],S=p!==void 0,h={kind:"eid",key:"eid",context:i,section:s,provider:r.provider,providerName:r.providerName,country:r.country,challenge:"app_code",phase:r.awaiting==="code"?"code":"identifier",identifierBound:r.identifierBound===!0,canUseCamera:S,afterPass:r.afterPass==="continue"?"continue":"end",...o};return S&&(h.cameraMethod=p),r.expiresAt!==void 0&&(h.codeExpiresAt=r.expiresAt),r.resendAvailableAt!==void 0&&(h.resendAvailableAt=r.resendAvailableAt),r.resendsRemaining!==void 0&&(h.resendsRemaining=r.resendsRemaining),r.codeAttemptsRemaining!==void 0&&(h.codeAttemptsRemaining=r.codeAttemptsRemaining),h}function vt(e,t){if(t.checkType!=="face_match"||t.reason!==void 0)return null;let i=R(e,"portrait_icao");return i!==void 0&&(i.state==="passed"||i.state==="review")?i:null}function It(e){return D(e).filter(t=>t.state==="failed").pop()?.attemptsExhausted===!0}function At(e,t){let i=e.failureReason,o;i===He?o="platform_unsupported":e.status==="expired"?o="expired":e.status==="review_pending"?o="review":e.status==="completed"&&e.outcome==="approved"?o="approved":e.status==="completed"&&e.outcome==="review"?o="review":i==="device_cooldown"?o="cooldown":i!==void 0?o="policy_stop":It(e)?o="attempts_exhausted":o="rejected";let r=o==="platform_unsupported"?{sessionId:ee(e.sessionId),status:"unavailable"}:H(e,{autoRetry:!1}),s={kind:"result",key:"result",context:t,section:null,display:o,result:r};return i!==void 0&&(s.failureReason=i),e.retryAfter!==void 0&&(s.retryAfter=e.retryAfter),s}function wt(e,t,i){let o=e.identitySummary;if(o==null)return null;let r={kind:"identity_summary",key:"identity_summary",context:t,section:i??"identity",summaryKind:o.kind==="partial"?"partial":o.kind??"full",source:o.source,portraitAvailable:o.portrait?.available===!0,retakeAvailable:o.retakeAvailable===!0};for(let u of Ot){let a=o[u];typeof a=="string"&&a!==""&&(r[u]=a)}let s=Oe(o);return s!==void 0&&(r.idNumberMasked=s,r.nniMasked=s),r}var Ot=["fullName","birthDate","birthYear","nationality","documentType","documentNumberMasked","expiryDate","retakeTarget"];function M(e,t,i,o){return{kind:"unsupported",key:`unsupported:${i}`,context:e,section:t,checkType:i,reason:o}}function Et(e){return e.kind==="contact"?"contact":(e.kind==="identity_method","identity")}function Mt(e,t){let i=De[e.kind]??[...ne,...ie],o=Et(e),r=e.options.flatMap(u=>{if(u.available===!1||!i.includes(u.service))return[];let a={id:u.id,service:u.service};return u.nationalEid!=null&&(a.nationalEid=u.nationalEid),[a]});if(r.length===0){let u=e.options.length>0&&e.options.every(a=>a.service==="nfc");return M(t,o,"choice",u?"platform_unsupported":"update_required")}let s={nodeId:e.nodeId,kind:e.kind,selected:e.selected,options:r};if(e.kind==="identity_method"){let u={kind:"method",key:"method",context:t,section:o,options:r.map(p=>V[p.service]),choice:s},a=r.find(p=>p.nationalEid!==void 0)?.nationalEid;return a!==void 0&&(u.nationalEid=a),u}return e.kind==="contact"?{kind:"contact_choice",key:"contact_choice",context:t,section:o,options:r.map(u=>Le[u.service]),selected:null,locked:!1,choice:s}:{kind:"choice",key:`choice:${e.nodeId}`,context:t,section:o,choice:s}}function nn(e,t={}){let i=ft(e);if(b(e)||e.failureReason===He)return At(e,i);let o=e.plan;if(o===void 0||!Array.isArray(o.sections))return M(i,null,"plan","update_required");let r=Ie(e);if(r!==null)return Mt(r,i);let s=o.current===null?void 0:o.steps.find(m=>m.id===o.current),u=m=>{let d={kind:"processing",key:"processing",context:i,section:m!==void 0?I(m):o.sections.find(P=>P.state==="current")?.id??null,stalled:!1};return typeof m?.service=="string"&&m.service!==""&&(d.service=m.service),d};if(o.current===null)return u(o.steps.find(m=>m.state==="processing"));if(s===void 0)return M(i,null,"step","update_required");if(!at.has(s.service))return s.interaction==="server"?u(s):M(i,I(s),s.service,"update_required");if(ct.has(s.service)||!F(s))return u(s);let a=s,p=mt(a),S=a.checkType,h=I(a);switch(S){case"phone_otp":case"email_otp":return St(e,a,i,p);case"population_registry":return _t(e,a,i,p);case"eid_auth":return xt(e,a,i,p);case"doc_ocr":return kt(e,a,i,p);case"identity_confirm":return wt(e,i,h)??u(a);case"portrait_icao":return Ve(e,a,i,p,"capture");case"liveness":case"face_match":{let m=vt(e,a);if(m!==null)return Ve(e,m,i,p,"match");let d=a.requiresMobile===!0,P=K(e);return d&&t.isMobile===!1?{kind:"mobile_required",key:"mobile_required",context:i,section:h,checkType:S}:{kind:"liveness",key:"biometric",context:i,section:h,mode:S==="face_match"?"selfie":"liveness",requiresMobile:d,instructions:P===null?"standard":"icao",icao:P,livePhoto:Rt(e,S),...p}}case"nfc_chip":return M(i,h,S,"platform_unsupported");default:return M(i,h,S,"update_required")}}export{Xe as a,ze as b,et as c,tt as d,it as e,Kt as f,ot as g,Ee as h,rt as i,st as j,Wt as k,Me as l,$t as m,tn as n,He as o,I as p,oe as q,Ne as r,vt as s,nn as t};