@baas-id/react 0.2.2

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 (129) hide show
  1. package/LICENSE.md +176 -0
  2. package/README.md +171 -0
  3. package/THIRD_PARTY_NOTICES.md +44 -0
  4. package/dist/esm/baas-id-react.css +1 -0
  5. package/dist/esm/chunks/ContinueFlow-YFSpSOio.js +7500 -0
  6. package/dist/esm/continue.js +10 -0
  7. package/dist/esm/index.js +218 -0
  8. package/dist/esm/preview.js +368 -0
  9. package/dist/esm/workers/detector.worker-DtuL8TFY.js +22435 -0
  10. package/dist/types/continue.d.ts +3 -0
  11. package/dist/types/index.d.ts +19 -0
  12. package/dist/types/preview.d.ts +5 -0
  13. package/dist/types/react/DocumentCapture.d.ts +27 -0
  14. package/dist/types/react/FaceCapture.d.ts +19 -0
  15. package/dist/types/react/capture/ProximityMeter.d.ts +9 -0
  16. package/dist/types/react/capture/TurnGauge.d.ts +12 -0
  17. package/dist/types/react/capture/YawDial.d.ts +6 -0
  18. package/dist/types/react/capture/api.d.ts +50 -0
  19. package/dist/types/react/capture/attestation.d.ts +32 -0
  20. package/dist/types/react/capture/binding.d.ts +51 -0
  21. package/dist/types/react/capture/camera.d.ts +4 -0
  22. package/dist/types/react/capture/chrome.d.ts +24 -0
  23. package/dist/types/react/capture/demo.d.ts +2 -0
  24. package/dist/types/react/capture/errors.d.ts +18 -0
  25. package/dist/types/react/capture/frames.d.ts +18 -0
  26. package/dist/types/react/capture/index.d.ts +15 -0
  27. package/dist/types/react/capture/integrity.d.ts +32 -0
  28. package/dist/types/react/capture/keyframes.d.ts +19 -0
  29. package/dist/types/react/capture/overlays.d.ts +10 -0
  30. package/dist/types/react/capture/run.d.ts +14 -0
  31. package/dist/types/react/capture/useCaptureRun.d.ts +4 -0
  32. package/dist/types/react/document/CardFrame.d.ts +10 -0
  33. package/dist/types/react/document/DocumentParts.d.ts +49 -0
  34. package/dist/types/react/document/advisory.d.ts +47 -0
  35. package/dist/types/react/document/bestFrames.d.ts +18 -0
  36. package/dist/types/react/document/cues.d.ts +28 -0
  37. package/dist/types/react/document/flow.d.ts +52 -0
  38. package/dist/types/react/document/gate.d.ts +114 -0
  39. package/dist/types/react/document/latch.d.ts +25 -0
  40. package/dist/types/react/document/mrz.d.ts +29 -0
  41. package/dist/types/react/document/overlay.d.ts +52 -0
  42. package/dist/types/react/document/quad.d.ts +5 -0
  43. package/dist/types/react/document/resolution.d.ts +42 -0
  44. package/dist/types/react/document/review.d.ts +50 -0
  45. package/dist/types/react/document/sideCheck.d.ts +32 -0
  46. package/dist/types/react/document/telemetry.d.ts +14 -0
  47. package/dist/types/react/document/track.d.ts +36 -0
  48. package/dist/types/react/document/useDocumentCapture.d.ts +78 -0
  49. package/dist/types/react/face/FaceGuide.d.ts +22 -0
  50. package/dist/types/react/face/FaceParts.d.ts +15 -0
  51. package/dist/types/react/face/faceMesh.d.ts +68 -0
  52. package/dist/types/react/face/faceRegion.d.ts +16 -0
  53. package/dist/types/react/face/faceView.d.ts +21 -0
  54. package/dist/types/react/face/meshBench.d.ts +7 -0
  55. package/dist/types/react/face/meshCanvas.d.ts +20 -0
  56. package/dist/types/react/face/qualityGate.d.ts +59 -0
  57. package/dist/types/react/face/runLiveness.d.ts +37 -0
  58. package/dist/types/react/face/scanState.d.ts +40 -0
  59. package/dist/types/react/face/upload.d.ts +14 -0
  60. package/dist/types/react/face/useFaceCapture.d.ts +45 -0
  61. package/dist/types/react/flows/ConsentStep.d.ts +8 -0
  62. package/dist/types/react/flows/EnrollmentFlow.d.ts +2 -0
  63. package/dist/types/react/flows/FlowResult.d.ts +13 -0
  64. package/dist/types/react/flows/FlowShell.d.ts +48 -0
  65. package/dist/types/react/flows/IdentifyFlow.d.ts +2 -0
  66. package/dist/types/react/flows/ReverificationFlow.d.ts +2 -0
  67. package/dist/types/react/flows/SignInFlow.d.ts +2 -0
  68. package/dist/types/react/flows/StepIntro.d.ts +10 -0
  69. package/dist/types/react/flows/VerificationFlow.d.ts +4 -0
  70. package/dist/types/react/flows/experience.d.ts +35 -0
  71. package/dist/types/react/flows/failureDetail.d.ts +12 -0
  72. package/dist/types/react/flows/index.d.ts +6 -0
  73. package/dist/types/react/flows/session.d.ts +5 -0
  74. package/dist/types/react/flows/state.d.ts +106 -0
  75. package/dist/types/react/flows/types.d.ts +255 -0
  76. package/dist/types/react/flows/useFlowSession.d.ts +21 -0
  77. package/dist/types/react/flows.d.ts +1 -0
  78. package/dist/types/react/handoff/ContinueFlow.d.ts +28 -0
  79. package/dist/types/react/handoff/ContinueOnPhone.d.ts +60 -0
  80. package/dist/types/react/handoff/api.d.ts +41 -0
  81. package/dist/types/react/handoff/qr.d.ts +9 -0
  82. package/dist/types/react/hooks.d.ts +7 -0
  83. package/dist/types/react/i18n/en.d.ts +3 -0
  84. package/dist/types/react/i18n/es-419.d.ts +3 -0
  85. package/dist/types/react/i18n/index.d.ts +10 -0
  86. package/dist/types/react/i18n/types.d.ts +250 -0
  87. package/dist/types/react/icons.d.ts +25 -0
  88. package/dist/types/react/liveness/challenges.d.ts +26 -0
  89. package/dist/types/react/liveness/framing.d.ts +33 -0
  90. package/dist/types/react/liveness/index.d.ts +8 -0
  91. package/dist/types/react/liveness/nod.d.ts +4 -0
  92. package/dist/types/react/liveness/scoring.d.ts +29 -0
  93. package/dist/types/react/liveness/script.d.ts +7 -0
  94. package/dist/types/react/liveness/signals.d.ts +38 -0
  95. package/dist/types/react/liveness/timing.d.ts +20 -0
  96. package/dist/types/react/liveness/turn.d.ts +18 -0
  97. package/dist/types/react/preview/FlowPreview.d.ts +34 -0
  98. package/dist/types/react/preview/contrast.d.ts +17 -0
  99. package/dist/types/react/preview/specimen.d.ts +35 -0
  100. package/dist/types/react/styles/index.d.ts +0 -0
  101. package/dist/types/react/telemetry/bus.d.ts +13 -0
  102. package/dist/types/react/telemetry/device.d.ts +66 -0
  103. package/dist/types/react/telemetry/reporter.d.ts +27 -0
  104. package/dist/types/react/theme/appearance.d.ts +22 -0
  105. package/dist/types/react/version.d.ts +1 -0
  106. package/dist/types/react/vision/authenticity.d.ts +43 -0
  107. package/dist/types/react/vision/authenticityPixels.d.ts +6 -0
  108. package/dist/types/react/vision/authenticitySpecular.d.ts +2 -0
  109. package/dist/types/react/vision/cardCorners.d.ts +21 -0
  110. package/dist/types/react/vision/cardDetector.d.ts +15 -0
  111. package/dist/types/react/vision/cornerGeometry.d.ts +10 -0
  112. package/dist/types/react/vision/cornerImage.d.ts +34 -0
  113. package/dist/types/react/vision/cornerLines.d.ts +12 -0
  114. package/dist/types/react/vision/cornerScore.d.ts +17 -0
  115. package/dist/types/react/vision/corners.d.ts +60 -0
  116. package/dist/types/react/vision/detector.worker.d.ts +1 -0
  117. package/dist/types/react/vision/document.d.ts +13 -0
  118. package/dist/types/react/vision/engine.d.ts +5 -0
  119. package/dist/types/react/vision/face.d.ts +17 -0
  120. package/dist/types/react/vision/index.d.ts +7 -0
  121. package/dist/types/react/vision/modelCache.d.ts +16 -0
  122. package/dist/types/react/vision/modelsCdn.d.ts +4 -0
  123. package/dist/types/react/vision/quality.d.ts +10 -0
  124. package/dist/types/react/vision/sideClassifier.d.ts +4 -0
  125. package/dist/types/react/vision/tinyCore.d.ts +21 -0
  126. package/dist/types/react/vision/tinyDetector.d.ts +36 -0
  127. package/dist/types/react/vision/types.d.ts +62 -0
  128. package/dist/types/react/vision/warp.d.ts +18 -0
  129. package/package.json +104 -0
@@ -0,0 +1,10 @@
1
+ import "./baas-id-react.css";
2
+ import { C as L, D as o, L as e, M as r, g as E, r as S } from "./chunks/ContinueFlow-YFSpSOio.js";
3
+ export {
4
+ L as ContinueFlow,
5
+ o as DEFAULT_MODELS_URL,
6
+ e as LOCALES,
7
+ r as MODELS_VERSION,
8
+ E as getStrings,
9
+ S as readHandoffCode
10
+ };
@@ -0,0 +1,218 @@
1
+ import "./baas-id-react.css";
2
+ /* empty css */
3
+ import { Y, I as F, J as X, V as C, K as H, N as W } from "./chunks/ContinueFlow-YFSpSOio.js";
4
+ import { O as ta, Q as sa, C as na, R as ra, T as oa, U as ia, D as ca, W as la, X as ua, Z as da, _ as ha, $ as pa, a0 as ma, a1 as fa, a2 as Ma, H as Ca, L as Ea, M as ga, a3 as _a, a4 as Aa, a5 as Na, a6 as wa, a7 as Oa, a8 as va, a9 as ya, aa as Fa, ab as Sa, ac as xa, ad as La, ae as Ra, af as Ia, ag as Ta, ah as ba, ai as Da, aj as Pa, ak as ka, al as Ya, am as Xa, an as Ha, g as Wa, ao as Ua, ap as Ga, aq as Ba, ar as Va, as as Qa, at as ja, au as $a, av as qa, aw as za, ax as Ka, ay as Ja, az as Za, aA as ae, aB as ee, r as te, aC as se, aD as ne, aE as re, aF as oe, aG as ie, aH as ce, aI as le, aJ as ue, aK as de, aL as he, aM as pe } from "./chunks/ContinueFlow-YFSpSOio.js";
5
+ import { jsxs as m, jsx as s } from "react/jsx-runtime";
6
+ function Q({
7
+ direction: a,
8
+ progress: r,
9
+ wrongWay: e,
10
+ confidence: l = 1,
11
+ strings: t
12
+ }) {
13
+ const n = Math.round(Math.min(1, Math.max(0, r)) * 100), d = l < F, f = d ? "unreadable" : e ? "wrong" : n >= 100 ? "pass" : "active", i = d ? t.guide.turn_hold_steady : n >= 100 ? t.guide.turn_complete : n >= 65 ? t.guide.turn_almost : n >= 25 ? t.guide.turn_going_well : a === "left" ? t.turn.turningLeft : t.turn.turningRight;
14
+ return /* @__PURE__ */ m("div", { className: "rpid-turn", "data-dir": a, "data-state": f, children: [
15
+ /* @__PURE__ */ s("span", { className: "rpid-turn-arrows", "aria-hidden": "true", children: [0, 1, 2].map((h) => /* @__PURE__ */ s(U, { direction: a, lit: n > h * 30, delay: h * 90 }, h)) }),
16
+ /* @__PURE__ */ m("div", { className: "rpid-turn-body", children: [
17
+ /* @__PURE__ */ s("span", { className: "rpid-turn-label", children: e && !d ? a === "left" ? t.turn.towardLeft : t.turn.towardRight : i }),
18
+ /* @__PURE__ */ m(
19
+ "div",
20
+ {
21
+ className: "rpid-turn-track",
22
+ role: "progressbar",
23
+ "aria-valuemin": 0,
24
+ "aria-valuemax": 100,
25
+ "aria-valuenow": n,
26
+ "aria-label": t.turn.progressAria,
27
+ children: [
28
+ /* @__PURE__ */ s("i", { style: { width: `${n}%` } }),
29
+ /* @__PURE__ */ s("span", { className: "rpid-turn-mark", style: { left: "25%" } }),
30
+ /* @__PURE__ */ s("span", { className: "rpid-turn-mark", style: { left: "65%" } })
31
+ ]
32
+ }
33
+ )
34
+ ] }),
35
+ /* @__PURE__ */ m("span", { className: "rpid-turn-pct rpid-num", children: [
36
+ n,
37
+ "%"
38
+ ] })
39
+ ] });
40
+ }
41
+ function U({
42
+ direction: a,
43
+ lit: r,
44
+ delay: e
45
+ }) {
46
+ return /* @__PURE__ */ s(
47
+ "svg",
48
+ {
49
+ viewBox: "0 0 24 24",
50
+ width: "13",
51
+ height: "13",
52
+ fill: "none",
53
+ stroke: "currentColor",
54
+ strokeWidth: "2.4",
55
+ strokeLinecap: "round",
56
+ strokeLinejoin: "round",
57
+ className: `rpid-chevron${r ? " lit" : ""}`,
58
+ style: { animationDelay: `${e}ms` },
59
+ "aria-hidden": "true",
60
+ children: /* @__PURE__ */ s("path", { d: a === "left" ? "M15 5 8 12l7 7" : "M9 5l7 7-7 7" })
61
+ }
62
+ );
63
+ }
64
+ function j(a, r) {
65
+ const e = r === X ? a : -a;
66
+ return {
67
+ progress: Math.min(1, Math.max(0, e / Y)),
68
+ wrongWay: e < -0.12
69
+ };
70
+ }
71
+ function $({
72
+ yaw: a,
73
+ target: r,
74
+ reached: e,
75
+ confidence: l = 1
76
+ }) {
77
+ const p = Math.max(-1.35, Math.min(1.35, a / (r || 0.42))) * 66 * 1, g = l < F, _ = [];
78
+ for (let o = -78; o <= 78; o += 6) {
79
+ const A = o * Math.PI / 180, N = Math.sin(A), w = Math.cos(A), O = 1, v = o === 0 ? 1.13 : 1.08, I = 50 + 44 * O * N, T = 60 - 56 * O * w, b = 50 + 44 * v * N, D = 60 - 56 * v * w, y = o === 0 || Math.sign(o) === Math.sign(p) && Math.abs(o) <= Math.abs(p), P = Math.abs(Math.abs(o) - 66) < 6 / 2, k = e && y ? "done" : y ? "lit" : P ? "goal" : "idle";
80
+ _.push(
81
+ /* @__PURE__ */ s(
82
+ "line",
83
+ {
84
+ x1: I,
85
+ y1: T,
86
+ x2: b,
87
+ y2: D,
88
+ className: "rpid-dial-tick",
89
+ "data-state": k,
90
+ "data-axis": o === 0 ? "center" : void 0
91
+ },
92
+ o
93
+ )
94
+ );
95
+ }
96
+ const M = p * Math.PI / 180, S = 50 + 44 * 0.99 * Math.sin(M), x = 60 - 56 * 0.99 * Math.cos(M), L = 50 + 44 * 1.17 * Math.sin(M), R = 60 - 56 * 1.17 * Math.cos(M);
97
+ return /* @__PURE__ */ m(
98
+ "svg",
99
+ {
100
+ className: "rpid-dial",
101
+ viewBox: "0 0 100 125",
102
+ "aria-hidden": "true",
103
+ "data-state": g ? "unreadable" : e ? "done" : "active",
104
+ children: [
105
+ _,
106
+ !g && /* @__PURE__ */ s("line", { x1: S, y1: x, x2: L, y2: R, className: "rpid-dial-cursor" })
107
+ ]
108
+ }
109
+ );
110
+ }
111
+ function q(a) {
112
+ return /* @__PURE__ */ s(C, { ...a, purpose: "enrollment" });
113
+ }
114
+ function z(a) {
115
+ return /* @__PURE__ */ s(C, { ...a, purpose: "signin" });
116
+ }
117
+ function K(a) {
118
+ return /* @__PURE__ */ s(C, { ...a, purpose: "reverification" });
119
+ }
120
+ function J(a) {
121
+ return /* @__PURE__ */ s(C, { ...a, purpose: "identify" });
122
+ }
123
+ function Z(a = 300, r = 390, e = 690, l = 2) {
124
+ const t = document.createElement("canvas");
125
+ t.width = Math.round(r * l), t.height = Math.round(e * l);
126
+ const n = t.getContext("2d");
127
+ n.setTransform(l, 0, 0, l, 0, 0);
128
+ const d = H(), f = new W(d), i = [];
129
+ for (let c = 0; c < a; c++) {
130
+ const u = c / a, E = { cx: r / 2 + 6 * Math.sin(u * 20), cy: e * 0.45, rx: 110, ry: 150, roll: 0.05 * Math.sin(u * 9), yaw: 0.6 * Math.sin(u * 6) }, p = performance.now();
131
+ n.clearRect(0, 0, r, e), f.draw(n, E, { alpha: 0.8, tone: "#9fe3c9", reveal: 1, sweep: -1.1 + 2.2 * (c % 60 / 60), sweepFade: 0.8, contours: !0 }), i.push(performance.now() - p);
132
+ }
133
+ i.sort((c, u) => c - u);
134
+ const h = i.reduce((c, u) => c + u, 0) / i.length;
135
+ return {
136
+ msMean: Math.round(h * 100) / 100,
137
+ msP90: Math.round(i[Math.floor(0.9 * (i.length - 1))] * 100) / 100,
138
+ fps: Math.round(1e3 / Math.max(0.01, h)),
139
+ points: d.count
140
+ };
141
+ }
142
+ export {
143
+ ta as CENTER_MIN,
144
+ sa as CONTAIN_MIN,
145
+ na as ContinueFlow,
146
+ ra as ContinueOnPhone,
147
+ oa as DEFAULT_DETECTOR,
148
+ ia as DEFAULT_LOCALE,
149
+ ca as DEFAULT_MODELS_URL,
150
+ la as DocumentCapture,
151
+ ua as EngineLoading,
152
+ q as EnrollmentFlow,
153
+ da as FACE_W_COMFORT_MAX,
154
+ ha as FACE_W_COMFORT_MIN,
155
+ pa as FACE_W_MAX,
156
+ ma as FACE_W_MIN,
157
+ fa as FaceCapture,
158
+ Ma as HandoffPanel,
159
+ Ca as HandoffView,
160
+ J as IdentifyFlow,
161
+ Ea as LOCALES,
162
+ ga as MODELS_VERSION,
163
+ _a as ProcessingOverlay,
164
+ Aa as ProximityMeter,
165
+ K as ReverificationFlow,
166
+ Na as SDK_VERSION,
167
+ wa as SELFIE_QUALITY_DEFAULTS,
168
+ z as SignInFlow,
169
+ Q as TurnGauge,
170
+ Y as YAW_TARGET,
171
+ $ as YawDial,
172
+ Oa as browserLocale,
173
+ va as captureNonceOf,
174
+ ya as centerBlocker,
175
+ Fa as centeringFrom,
176
+ Sa as claimHandoff,
177
+ xa as collectSnapshot,
178
+ La as cornerRadius,
179
+ Ra as createHandoff,
180
+ Ia as cropQuality,
181
+ Ta as detectDevice,
182
+ ba as distanceHintOf,
183
+ Da as distanceTrackPos,
184
+ Pa as encodeQr,
185
+ ka as faceCropStats,
186
+ Ya as faceWidthOf,
187
+ Xa as finalizeSession,
188
+ Ha as floorsFrom,
189
+ Wa as getStrings,
190
+ Ua as gridPeriodicity,
191
+ Ga as handoffStatus,
192
+ Ba as inAppBrowser,
193
+ Va as loadDocumentEngine,
194
+ Qa as loadFaceEngine,
195
+ Z as meshBenchmark,
196
+ ja as modelsUrlOf,
197
+ $a as nativeAttestation,
198
+ qa as normalizeSession,
199
+ za as parseUserAgent,
200
+ Ka as peekHandoff,
201
+ Ja as preload,
202
+ Za as probeDocument,
203
+ ae as proximityOf,
204
+ ee as qrPath,
205
+ te as readHandoffCode,
206
+ se as reasonEntry,
207
+ ne as reportClient,
208
+ re as requestHash,
209
+ oe as resolveLocale,
210
+ ie as revokeHandoff,
211
+ ce as selfieQualityIssue,
212
+ le as sideOutcomeOf,
213
+ ue as specularSignature,
214
+ de as subscribeClient,
215
+ j as turnGaugeFrom,
216
+ he as uploadCapture,
217
+ pe as webAttestation
218
+ };
@@ -0,0 +1,368 @@
1
+ import "./baas-id-react.css";
2
+ /* empty css */
3
+ import { jsxs as k, jsx as f } from "react/jsx-runtime";
4
+ import { useMemo as b, useRef as F, useState as W, useEffect as U } from "react";
5
+ import { t as K, n as Q, a as Y, m as J, b as X, g as D, i as Z, c as ee, F as B, H as te, d as ne, e as oe, S as re, E as se, f as ie, h as ae, j as ce, k as le, l as O, o as de, p as G, q as ue, G as H, P as fe, s as pe, u as ye, v as he, w as me } from "./chunks/ContinueFlow-YFSpSOio.js";
6
+ import { x as Ne, L as Ue, y as Ge, z as He, A as $e, B as je } from "./chunks/ContinueFlow-YFSpSOio.js";
7
+ function ve(e) {
8
+ let s = e >>> 0;
9
+ return () => (s = s * 1664525 + 1013904223 >>> 0, s / 4294967296);
10
+ }
11
+ function $(e, s) {
12
+ const n = K(e, s, 0.8), r = 0.012;
13
+ return [
14
+ { x: n[0].x + r, y: n[0].y + r * 0.6 },
15
+ { x: n[1].x - r * 0.4, y: n[1].y },
16
+ { x: n[2].x, y: n[2].y - r * 0.3 },
17
+ { x: n[3].x + r * 0.5, y: n[3].y - r * 0.8 }
18
+ ];
19
+ }
20
+ function P(e, s, n, r, i, t) {
21
+ e.beginPath(), e.moveTo(s + t, n), e.arcTo(s + r, n, s + r, n + i, t), e.arcTo(s + r, n + i, s, n + i, t), e.arcTo(s, n + i, s, n, t), e.arcTo(s, n, s + r, n, t), e.closePath();
22
+ }
23
+ function j(e, s, n, r) {
24
+ const i = n * 0.037;
25
+ P(e, 0, 0, n, r, i), e.save(), e.clip();
26
+ const t = e.createLinearGradient(0, 0, n, r);
27
+ t.addColorStop(0, "#E8EEEC"), t.addColorStop(1, "#D5DFDC"), e.fillStyle = t, e.fillRect(0, 0, n, r), e.strokeStyle = "rgba(19, 94, 110, 0.13)", e.lineWidth = Math.max(0.6, n * 16e-4);
28
+ for (let o = 0; o < 26; o++)
29
+ e.beginPath(), e.ellipse(n * 0.72, r * 0.55, n * (0.08 + o * 0.012), r * (0.12 + o * 0.016), o * 0.11, 0, Math.PI * 2), e.stroke();
30
+ e.fillStyle = "#135E6E", e.fillRect(0, 0, n, r * 0.13), e.fillStyle = "rgba(255,255,255,0.9)", e.font = `600 ${Math.round(r * 0.06)}px system-ui, sans-serif`, e.textBaseline = "middle", e.fillText(s === "front" ? "IDENTITY CARD · SPECIMEN" : "SPECIMEN", n * 0.05, r * 0.066);
31
+ const c = "rgba(22, 35, 44, 0.55)";
32
+ if (s === "front") {
33
+ const o = n * 0.05, a = r * 0.2, l = n * 0.27, u = r * 0.62;
34
+ e.fillStyle = "#B9C7CE", P(e, o, a, l, u, n * 0.012), e.fill(), e.fillStyle = "#8EA2AC", e.beginPath(), e.ellipse(o + l / 2, a + u * 0.38, l * 0.22, u * 0.2, 0, 0, Math.PI * 2), e.fill(), e.beginPath(), e.ellipse(o + l / 2, a + u * 0.98, l * 0.42, u * 0.3, 0, Math.PI, 0), e.fill(), e.fillStyle = c;
35
+ const p = n * 0.37;
36
+ [[0.24, 0.3], [0.32, 0.45], [0.44, 0.2], [0.52, 0.38], [0.64, 0.22], [0.72, 0.42]].forEach(([g, S], d) => {
37
+ e.globalAlpha = d % 2 ? 1 : 0.55, e.fillRect(p, r * g, n * S, r * (d % 2 ? 0.045 : 0.03));
38
+ }), e.globalAlpha = 1;
39
+ } else {
40
+ const o = ve(41), a = n * 0.05, l = r * 0.2, u = n * 0.9, p = r * 0.3;
41
+ e.fillStyle = "#16232C";
42
+ const g = 64, S = 10;
43
+ for (let d = 0; d < g; d++) for (let y = 0; y < S; y++)
44
+ o() > 0.5 && e.fillRect(a + d * u / g, l + y * p / S, u / g + 0.4, p / S + 0.4);
45
+ e.fillStyle = c;
46
+ for (let d = 0; d < 3; d++) e.fillRect(n * 0.05, r * (0.62 + d * 0.11), n * 0.9, r * 0.055);
47
+ }
48
+ e.save(), e.translate(n / 2, r / 2), e.rotate(-0.2), e.fillStyle = "rgba(178, 67, 78, 0.22)", e.font = `800 ${Math.round(r * 0.2)}px system-ui, sans-serif`, e.textAlign = "center", e.textBaseline = "middle", e.fillText("SPECIMEN", 0, 0), e.restore(), e.restore();
49
+ }
50
+ function ge(e, s) {
51
+ const n = e.getBoundingClientRect(), r = Math.max(1, n.width || 390), i = Math.max(1, n.height || 300), t = Math.min(2, typeof devicePixelRatio == "number" ? devicePixelRatio : 1);
52
+ e.width = Math.round(r * t), e.height = Math.round(i * t);
53
+ const c = e.getContext("2d");
54
+ if (!c) return;
55
+ c.setTransform(t, 0, 0, t, 0, 0);
56
+ const o = c.createRadialGradient(r * 0.5, i * 0.2, 10, r * 0.5, i * 0.6, r);
57
+ o.addColorStop(0, "#2B3A44"), o.addColorStop(1, "#141D23"), c.fillStyle = o, c.fillRect(0, 0, r, i);
58
+ const a = $(r, i).map((p) => ({ x: p.x * r, y: p.y * i })), l = Math.hypot(a[1].x - a[0].x, a[1].y - a[0].y), u = Math.hypot(a[3].x - a[0].x, a[3].y - a[0].y);
59
+ c.save(), c.transform((a[1].x - a[0].x) / l, (a[1].y - a[0].y) / l, (a[3].x - a[0].x) / u, (a[3].y - a[0].y) / u, a[0].x, a[0].y), c.shadowColor = "rgba(0,0,0,0.45)", c.shadowBlur = 18, c.shadowOffsetY = 6, c.fillStyle = "#000", P(c, 0, 0, l, u, l * 0.037), c.fill(), c.shadowColor = "transparent", j(c, s, l, u), c.restore();
60
+ }
61
+ function L(e) {
62
+ if (typeof document > "u") return;
63
+ const s = document.createElement("canvas");
64
+ s.width = 254, s.height = 160;
65
+ const n = s.getContext("2d");
66
+ if (n) {
67
+ j(n, e, 254, 160);
68
+ try {
69
+ return s.toDataURL("image/png");
70
+ } catch {
71
+ return;
72
+ }
73
+ }
74
+ }
75
+ const C = { w: 720, h: 1280 };
76
+ function q(e = 0, s = 1) {
77
+ const { w: n, h: r } = C, i = n / 2 + e * 26, t = r * 0.44, c = 160 * s, o = 205 * s, a = e * c * 0.32;
78
+ return {
79
+ cx: i,
80
+ cy: t,
81
+ rx: c,
82
+ ry: o,
83
+ eyes: [{ x: i - c * 0.36 + a, y: t - o * 0.12 }, { x: i + c * 0.36 + a, y: t - o * 0.12 }],
84
+ nose: { x: i + a * 1.25, y: t + o * 0.12 },
85
+ mouth: { x: i + a * 1.1, y: t + o * 0.43 },
86
+ ears: [{ x: i - c * 0.98 + a * 0.3, y: t }, { x: i + c * 0.98 + a * 0.3, y: t }]
87
+ };
88
+ }
89
+ function Se(e = 0, s = 1) {
90
+ const n = q(e, s), r = (i) => ({ x: i.x / C.w, y: i.y / C.h });
91
+ return [
92
+ r({ x: n.cx - n.rx, y: n.cy - n.ry }),
93
+ r({ x: n.cx + n.rx, y: n.cy + n.ry }),
94
+ r(n.eyes[0]),
95
+ r(n.eyes[1]),
96
+ r(n.nose),
97
+ r(n.mouth),
98
+ r(n.ears[0]),
99
+ r(n.ears[1])
100
+ ];
101
+ }
102
+ function Ce(e, s = 0, n = 1) {
103
+ const { w: r, h: i } = C;
104
+ e.width = r, e.height = i;
105
+ const t = e.getContext("2d");
106
+ if (!t) return;
107
+ const c = t.createLinearGradient(0, 0, 0, i);
108
+ c.addColorStop(0, "#5D6E77"), c.addColorStop(1, "#2E3B43"), t.fillStyle = c, t.fillRect(0, 0, r, i);
109
+ const o = q(s, n);
110
+ t.fillStyle = "#24343E", t.beginPath(), t.ellipse(r / 2 + s * 10, i * 0.98, r * 0.56 * n, i * 0.28 * n, 0, Math.PI, 0), t.fill(), t.fillStyle = "#B88C73", t.fillRect(o.cx - o.rx * 0.36, o.cy + o.ry * 0.6, o.rx * 0.72, o.ry * 0.65);
111
+ const a = t.createRadialGradient(o.cx - o.rx * 0.3, o.cy - o.ry * 0.3, 10, o.cx, o.cy, o.ry * 1.1);
112
+ a.addColorStop(0, "#D8AE92"), a.addColorStop(1, "#B98A6E"), t.fillStyle = a, t.beginPath(), t.ellipse(o.cx, o.cy, o.rx, o.ry, 0, 0, Math.PI * 2), t.fill(), t.fillStyle = "#B4856A";
113
+ for (const l of o.ears)
114
+ t.beginPath(), t.ellipse(l.x, l.y, o.rx * 0.11, o.ry * 0.14, 0, 0, Math.PI * 2), t.fill();
115
+ t.fillStyle = "#2A211C", t.beginPath(), t.ellipse(o.cx, o.cy - o.ry * 0.42, o.rx * 1.04, o.ry * 0.62, 0, Math.PI * 1.02, Math.PI * 1.98), t.fill(), t.strokeStyle = "#3A2B22", t.lineWidth = 9, t.lineCap = "round";
116
+ for (const l of o.eyes)
117
+ t.beginPath(), t.moveTo(l.x - 30, l.y - 34), t.quadraticCurveTo(l.x, l.y - 46, l.x + 30, l.y - 34), t.stroke();
118
+ t.fillStyle = "#F4F1EC";
119
+ for (const l of o.eyes)
120
+ t.beginPath(), t.ellipse(l.x, l.y, 24, 13, 0, 0, Math.PI * 2), t.fill();
121
+ t.fillStyle = "#3B2A20";
122
+ for (const l of o.eyes)
123
+ t.beginPath(), t.arc(l.x + s * 6, l.y, 9, 0, Math.PI * 2), t.fill();
124
+ t.strokeStyle = "rgba(120, 78, 58, 0.7)", t.lineWidth = 6, t.beginPath(), t.moveTo(o.nose.x - 4, o.nose.y - 60), t.quadraticCurveTo(o.nose.x + 10, o.nose.y, o.nose.x - 12, o.nose.y + 6), t.stroke(), t.strokeStyle = "#8A4C42", t.lineWidth = 8, t.beginPath(), t.moveTo(o.mouth.x - 46, o.mouth.y), t.quadraticCurveTo(o.mouth.x, o.mouth.y + 22, o.mouth.x + 46, o.mouth.y), t.stroke();
125
+ }
126
+ const R = "k7qxm2dpa4vbn6tr3hsy5ecwz2";
127
+ function be(e) {
128
+ const s = e && typeof e == "object" ? e : null;
129
+ if (!s) return;
130
+ const n = s.reasons && typeof s.reasons == "object" ? s.reasons : null;
131
+ if (!n) return O(s);
132
+ const r = {};
133
+ for (const [i, t] of Object.entries(n))
134
+ for (const [c, o] of Object.entries(t ?? {})) (r[c] ?? (r[c] = {}))[i] = o;
135
+ return O(r);
136
+ }
137
+ const Ee = {
138
+ enrollment: { verdict: "VERIFIED", purpose: "enrollment", reason: null, score: 0.8412, assurance: "pilot", policy_version: "preview" },
139
+ signin: { verdict: "VERIFIED", purpose: "signin", reason: null, score: 0.8806, assurance: "pilot", policy_version: "preview" },
140
+ reverification: { verdict: "VERIFIED", purpose: "reverification", reason: null, score: 0.8517, assurance: "pilot", policy_version: "preview" },
141
+ identify: { verdict: "VERIFIED", purpose: "identify", reason: null, score: 0.8633, assurance: "pilot", policy_version: "preview" }
142
+ };
143
+ function _e(e) {
144
+ const {
145
+ screen: s,
146
+ step: n = "front",
147
+ challenge: r = "center",
148
+ purpose: i = "enrollment",
149
+ locale: t,
150
+ errorCode: c = "FACE_MISMATCH",
151
+ documentSides: o,
152
+ document: a = !0,
153
+ challenges: l = 2,
154
+ privacyNote: u
155
+ } = e, p = b(() => Q(e.appearance), [e.appearance]), g = b(() => Y(e.instructions), [e.instructions]), S = b(() => be(e.messages), [e.messages]), d = b(() => {
156
+ const v = J(X(S, t, D(t)));
157
+ return { t: D(t, v), overrides: v };
158
+ }, [S, t]), y = de(i, { document: a, documentSides: o }), h = y.includes(n) ? n : y[0], m = s === "success" ? { k: "done", result: Ee[i] } : s === "error" ? { k: "failed", reason: c } : h === "face" ? { k: "face" } : { k: "doc", side: h }, E = s === "intro" && Z(h, g), x = ee(h, t, d.t, g), I = m.k === "doc" || m.k === "face", A = y.length > 1, M = b(() => ({
159
+ front: h !== "front" && y.includes("front") ? L("front") : void 0,
160
+ back: h === "face" && y.includes("back") ? L("back") : void 0
161
+ }), [h, y.join()]);
162
+ if (s === "handoff" || s === "continue" || s === "continueDone") {
163
+ const v = e.handoff ?? {}, w = v.copy?.[t] ?? null, T = v.tenant || "Acme", _ = R.slice(-4).toUpperCase(), V = v.continueUrl ? v.continueUrl.includes("{code}") ? v.continueUrl.replace("{code}", R) : `${v.continueUrl}${v.continueUrl.includes("?") ? "&" : "?"}h=${R}` : `https://baaslatam.com/c/${R}`, z = s === "handoff" ? w?.title || d.t.handoff.title : s === "continue" ? d.t.handoff.phoneTitle : d.t.handoff.doneTitle;
164
+ return /* @__PURE__ */ k(
165
+ B,
166
+ {
167
+ step: { k: "opening" },
168
+ purpose: i,
169
+ t: d.t,
170
+ privacy: u,
171
+ appearance: p,
172
+ forceAppearance: !0,
173
+ manageFocus: !1,
174
+ screen: s === "handoff" ? "handoff" : s === "continue" ? "confirm" : "done",
175
+ title: z,
176
+ children: [
177
+ s === "handoff" && /* @__PURE__ */ f(
178
+ te,
179
+ {
180
+ t: d.t,
181
+ mode: v.mode ?? "suggest",
182
+ copy: w,
183
+ link: { url: V, codeHint: _, tenant: T },
184
+ leftMs: (v.ttlMinutes ?? 10) * 6e4 - 18e3,
185
+ expired: !1,
186
+ failed: !1,
187
+ phase: null,
188
+ device: null,
189
+ linkId: "rpid-preview-handoff-link",
190
+ onContinueHere: () => {
191
+ }
192
+ }
193
+ ),
194
+ s === "continue" && /* @__PURE__ */ f(ne, { t: d.t, tenant: T, codeHint: _ }),
195
+ s === "continueDone" && /* @__PURE__ */ f(oe, { t: d.t })
196
+ ]
197
+ }
198
+ );
199
+ }
200
+ return /* @__PURE__ */ k(
201
+ B,
202
+ {
203
+ step: m,
204
+ purpose: i,
205
+ t: d.t,
206
+ privacy: u,
207
+ appearance: p,
208
+ forceAppearance: !0,
209
+ manageFocus: !1,
210
+ screen: E ? "intro" : void 0,
211
+ title: E ? x.title : le(m, i, d.t),
212
+ children: [
213
+ I && A && /* @__PURE__ */ f(re, { step: m, t: d.t, plan: y }),
214
+ I && A && (M.front || M.back) && /* @__PURE__ */ f(se, { thumbs: M, t: d.t, plan: y }),
215
+ E && /* @__PURE__ */ f(
216
+ ie,
217
+ {
218
+ step: h,
219
+ body: x.body,
220
+ t: d.t,
221
+ movements: h === "face" ? l : void 0,
222
+ sessionMinutes: y.indexOf(h) === 0 ? 15 : null,
223
+ onStart: () => {
224
+ }
225
+ }
226
+ ),
227
+ !E && m.k === "doc" && /* @__PURE__ */ f(ke, { side: m.side, t: d.t }),
228
+ !E && m.k === "face" && /* @__PURE__ */ f(Fe, { challenge: r, count: l, t: d.t }),
229
+ m.k === "done" && /* @__PURE__ */ f(ae, { result: m.result, t: d.t }),
230
+ m.k === "failed" && /* @__PURE__ */ f(ce, { reason: c, locale: t, t: d.t, overrides: d.overrides, onRestart: () => {
231
+ }, takeFocus: !1 })
232
+ ]
233
+ }
234
+ );
235
+ }
236
+ function ke({ side: e, t: s }) {
237
+ const n = F(null), r = F(null), [i, t] = W({ w: 0, h: 0 });
238
+ U(() => {
239
+ const o = r.current;
240
+ if (!o) return;
241
+ const a = () => {
242
+ const u = o.getBoundingClientRect();
243
+ t((p) => Math.abs(p.w - u.width) < 0.5 && Math.abs(p.h - u.height) < 0.5 ? p : { w: u.width, h: u.height }), ge(o, e);
244
+ };
245
+ if (a(), typeof ResizeObserver > "u") return;
246
+ const l = new ResizeObserver(a);
247
+ return l.observe(o), () => l.disconnect();
248
+ }, [e]);
249
+ const c = b(() => {
250
+ const o = $(i.w || 4, i.h || 3);
251
+ return { at: () => o, info: () => ({ kind: "edges", locks: [!0, !0, !0, !0] }) };
252
+ }, [i.w, i.h]);
253
+ return /* @__PURE__ */ f("div", { className: "baas-id-scope rpid-doc-capture", "data-rpid-preview": !0, children: /* @__PURE__ */ k(
254
+ G,
255
+ {
256
+ className: "rpid-viewport rpid-doc rpid-locked",
257
+ attrs: { "data-rpid-side": e, "data-rpid-frame": "holding" },
258
+ source: "demo",
259
+ videoRef: n,
260
+ canvasRef: r,
261
+ children: [
262
+ /* @__PURE__ */ f(ue, { source: i.w ? c : null, pct: 0.62, state: "holding", t: s }),
263
+ /* @__PURE__ */ f(H, { tone: "ok", children: /* @__PURE__ */ f("span", { className: "rpid-guide-line", children: s.guide.steady }) })
264
+ ]
265
+ }
266
+ ) });
267
+ }
268
+ const Re = {
269
+ center: ["turn_left", "move_closer"],
270
+ turn_left: ["turn_left", "move_closer"],
271
+ turn_right: ["turn_right", "move_closer"],
272
+ move_closer: ["turn_left", "move_closer"]
273
+ };
274
+ function Fe({ challenge: e, count: s, t: n }) {
275
+ const r = F(null), i = F(null), t = Re[e].slice(0, Math.max(1, Math.min(3, s)));
276
+ e !== "center" && !t.includes(e) && (t[t.length - 1] = e);
277
+ const c = e === "center" ? -1 : t.indexOf(e), o = e === "turn_left" ? -0.55 : e === "turn_right" ? 0.55 : 0, a = e === "move_closer" ? 1.12 : 1, l = b(() => new fe(), []);
278
+ U(() => {
279
+ i.current && Ce(i.current, o, a);
280
+ const h = Se(o, a);
281
+ l.reset(), l.seen(h, performance.now());
282
+ const m = setInterval(() => l.seen(h, performance.now()), 300);
283
+ return () => clearInterval(m);
284
+ }, [o, a, l]);
285
+ const u = pe({ videoWidth: C.w, videoHeight: C.h }), p = e === "center" ? null : e, g = e === "center" ? "perfect" : e === "move_closer" ? "closer_more" : e, S = e === "center" ? 0 : 0.45, d = ye({ step: c, total: t.length, hold: 0.65, progress: S, done: !1 }), y = { "--rpid-video-ar": (C.w / C.h).toFixed(4) };
286
+ return /* @__PURE__ */ k("div", { className: "baas-id-scope", "data-rpid-preview": !0, children: [
287
+ /* @__PURE__ */ k(
288
+ G,
289
+ {
290
+ className: `rpid-viewport rpid-face rpid-${e === "center" ? "searching" : "locked"}`,
291
+ attrs: { "data-rpid-guide-state": e === "center" ? "aligned" : "capturing" },
292
+ style: y,
293
+ source: "demo",
294
+ videoRef: r,
295
+ canvasRef: i,
296
+ mirror: !0,
297
+ children: [
298
+ /* @__PURE__ */ f(
299
+ he,
300
+ {
301
+ src: C,
302
+ oval: u,
303
+ motion: l,
304
+ state: e === "center" ? "aligned" : "capturing",
305
+ scan: e === "center" ? "aligned" : "challenge",
306
+ fills: d,
307
+ progress: S,
308
+ cue: p,
309
+ guide: g,
310
+ t: n
311
+ }
312
+ ),
313
+ /* @__PURE__ */ f(H, { tone: "ok", marker: !0, children: e === "center" ? n.guide.perfect : n.guide[g] })
314
+ ]
315
+ }
316
+ ),
317
+ /* @__PURE__ */ f(me, { script: t, step: c, t: n })
318
+ ] });
319
+ }
320
+ const Me = {
321
+ primary: "#135E6E",
322
+ positive: "#177E54",
323
+ caution: "#99671C",
324
+ danger: "#B2434E",
325
+ surface: "#FFFFFF",
326
+ text: "#16232C",
327
+ overlay: "#080D11"
328
+ }, De = 12, Pe = [
329
+ { fg: "text", bg: "surface", min: 4.5 },
330
+ { fg: "primary", bg: "surface", min: 4.5 },
331
+ { fg: "danger", bg: "surface", min: 4.5 },
332
+ { fg: "positive", bg: "surface", min: 3 },
333
+ { fg: "caution", bg: "surface", min: 3 }
334
+ ];
335
+ function N(e) {
336
+ const s = (n) => {
337
+ const r = parseInt(e.slice(n, n + 2), 16) / 255;
338
+ return r <= 0.04045 ? r / 12.92 : ((r + 0.055) / 1.055) ** 2.4;
339
+ };
340
+ return 0.2126 * s(1) + 0.7152 * s(3) + 0.0722 * s(5);
341
+ }
342
+ function xe(e, s) {
343
+ const [n, r] = [N(e), N(s)].sort((i, t) => t - i);
344
+ return Math.round((n + 0.05) / (r + 0.05) * 100) / 100;
345
+ }
346
+ function Be(e) {
347
+ const s = { ...Me, ...e?.colors ?? {} };
348
+ return Pe.map(({ fg: n, bg: r, min: i }) => {
349
+ const t = /^#[0-9a-fA-F]{6}$/.test(s[n]) && /^#[0-9a-fA-F]{6}$/.test(s[r]) ? xe(s[n], s[r]) : 21;
350
+ return { fg: n, bg: r, ratio: t, min: i, pass: t >= i };
351
+ });
352
+ }
353
+ export {
354
+ Pe as CONTRAST_PAIRS,
355
+ Me as DEFAULT_COLORS,
356
+ De as DEFAULT_RADIUS,
357
+ Ne as FONT_STACKS,
358
+ _e as FlowPreview,
359
+ Ue as LOCALES,
360
+ Ge as SDK_DEFAULTS,
361
+ He as appearanceGroups,
362
+ $e as appearanceStyle,
363
+ Be as contrastChecks,
364
+ xe as contrastRatio,
365
+ D as getStrings,
366
+ ee as introFor,
367
+ je as parseIntroBody
368
+ };