@41devs/naya-id-js 0.1.0

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.
@@ -0,0 +1,280 @@
1
+ var NayaId=(function(exports){'use strict';var V=[{code:"BJ",label:"B\xE9nin"},{code:"CI",label:"C\xF4te d'Ivoire"},{code:"SN",label:"S\xE9n\xE9gal"},{code:"ML",label:"Mali"},{code:"BF",label:"Burkina Faso"},{code:"TG",label:"Togo"}],ee=["cni","passeport","permis"],te="#1A3A5C",ne="#F5A623",se="https://api.naya.41devs.com/v1";function Y(s={}){return {country:s.country,documentTypes:s.documentTypes??ee,countries:s.countries??V.map(e=>e.code),locale:s.locale??"fr",callbackUrl:s.callbackUrl,maxAttempts:s.maxAttempts??2,theme:{primaryColor:s.theme?.primaryColor??te,accentColor:s.theme?.accentColor??ne},clientLogoUrl:s.clientLogoUrl,baseUrl:s.baseUrl??se,livenessAssets:{esmUrl:s.livenessAssets?.esmUrl,wasmBaseUrl:s.livenessAssets?.wasmBaseUrl,modelUrl:s.livenessAssets?.modelUrl}}}function W(s){return V.find(e=>e.code===s)?.label??s}function K(s){return s==="cni"}var f={success:"#27AE60",error:"#E74C3C",warning:"#F39C12",background:"#F7F8FA",surface:"#FFFFFF",textPrimary:"#1A1A2E",textSecondary:"#6B7280",line:"#E5E7EB",dark:"#0E1C2C",radiusCard:"12px",radiusInput:"8px",radiusButton:"24px"};function ae(s){return {"--naya-primary":s.theme.primaryColor,"--naya-accent":s.theme.accentColor,"--naya-success":f.success,"--naya-error":f.error,"--naya-warning":f.warning,"--naya-bg":f.background,"--naya-surface":f.surface,"--naya-text":f.textPrimary,"--naya-text-2":f.textSecondary,"--naya-line":f.line,"--naya-dark":f.dark,"--naya-r-card":f.radiusCard,"--naya-r-input":f.radiusInput,"--naya-r-button":f.radiusButton}}var re=`
2
+ /* \u2500\u2500 H\xF4te + reset \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
3
+ .naya-host {
4
+ position: fixed; inset: 0; z-index: 2147483000; display: block;
5
+ background: var(--naya-bg); color: var(--naya-text);
6
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
7
+ -webkit-font-smoothing: antialiased; text-align: left; line-height: 1.4;
8
+ }
9
+ .naya-host, .naya-host * { box-sizing: border-box; }
10
+ .naya-host button { font-family: inherit; }
11
+ .naya-host h1, .naya-host p, .naya-host ul, .naya-host li { margin: 0; padding: 0; }
12
+ .naya-host img { max-width: 100%; }
13
+ .n-icon { display: inline-flex; line-height: 0; flex: 0 0 auto; }
14
+ @keyframes naya-spin { to { transform: rotate(360deg); } }
15
+
16
+ /* \u2500\u2500 Gabarit d'\xE9cran \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
17
+ .n-shell { display: flex; flex-direction: column; height: 100%; background: var(--naya-bg); color: var(--naya-text); }
18
+ .n-shell.n-dark { background: var(--naya-dark); color: #fff; }
19
+ .n-bar { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px 0; flex: 0 0 auto; }
20
+ .n-spacer { width: 40px; height: 40px; }
21
+ .n-round {
22
+ width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center;
23
+ border: none; border-radius: 50%; cursor: pointer; color: var(--naya-primary);
24
+ background: color-mix(in srgb, var(--naya-primary) 8%, transparent); transition: background .15s ease;
25
+ }
26
+ .n-dark .n-round { color: #fff; background: rgba(255,255,255,.16); }
27
+ .n-round:hover { background: color-mix(in srgb, var(--naya-primary) 16%, transparent); }
28
+ .n-round:focus-visible { outline: 2px solid var(--naya-accent); outline-offset: 2px; }
29
+ .n-content { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }
30
+ .n-powered { flex: 0 0 auto; text-align: center; padding: 6px 0 12px; font-size: 11px; font-weight: 600; color: #B3BAC4; }
31
+ .n-dark .n-powered { color: rgba(255,255,255,.38); }
32
+
33
+ /* \u2500\u2500 Composants partag\xE9s \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
34
+ .n-brand { display: inline-flex; align-items: center; gap: 7px; }
35
+ .n-mark {
36
+ width: 26px; height: 26px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
37
+ background: var(--naya-primary); color: var(--naya-accent);
38
+ }
39
+ .n-name { font-size: 17px; font-weight: 800; letter-spacing: -0.2px; color: var(--naya-primary); }
40
+
41
+ .n-btn { width: 100%; min-height: 52px; cursor: pointer; }
42
+ .n-btn-primary {
43
+ display: inline-flex; align-items: center; justify-content: center; gap: 8px;
44
+ border: none; border-radius: var(--naya-r-button); background: var(--naya-accent); color: var(--naya-primary);
45
+ font-size: 15px; font-weight: 800; transition: filter .15s ease;
46
+ }
47
+ .n-btn-primary:hover:not(:disabled) { filter: brightness(.96); }
48
+ .n-btn-primary:disabled { opacity: .5; cursor: not-allowed; }
49
+ .n-btn-primary:focus-visible { outline: 2px solid var(--naya-primary); outline-offset: 2px; }
50
+ .n-btn-secondary {
51
+ border: 1.5px solid var(--naya-primary); border-radius: var(--naya-r-button);
52
+ background: transparent; color: var(--naya-primary); font-size: 15px; font-weight: 800;
53
+ }
54
+ .n-btn-secondary:hover { background: color-mix(in srgb, var(--naya-primary) 6%, transparent); }
55
+ .n-btn-secondary:focus-visible { outline: 2px solid var(--naya-accent); outline-offset: 2px; }
56
+
57
+ .n-dots { display: flex; justify-content: center; gap: 22px; }
58
+ .n-step { display: flex; flex-direction: column; align-items: center; gap: 5px; }
59
+ .n-dot { width: 9px; height: 9px; border-radius: 50%; background: #D6DCE4; }
60
+ .n-dot.on { background: var(--naya-accent); }
61
+ .n-dotlbl { font-size: 11px; color: var(--naya-text-2); }
62
+
63
+ /* \u2500\u2500 1 \xB7 Bienvenue \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
64
+ .n-welcome .pad { display: flex; flex-direction: column; flex: 1; padding: 4px 24px 8px; }
65
+ .n-welcome .brandRow { display: flex; align-items: center; justify-content: center; gap: 14px; }
66
+ .n-welcome .sep { width: 1px; height: 22px; background: var(--naya-line); }
67
+ .n-welcome .clientLogo { height: 24px; width: auto; object-fit: contain; }
68
+ .n-welcome .spacer { flex: 1 1 auto; }
69
+ .n-welcome .hero {
70
+ align-self: center; width: 116px; height: 116px; border-radius: 32px;
71
+ display: flex; align-items: center; justify-content: center; background: var(--naya-primary); color: var(--naya-accent);
72
+ }
73
+ .n-welcome .title {
74
+ margin: 28px 0 10px; text-align: center; text-wrap: balance;
75
+ font-size: 23px; font-weight: 800; line-height: 1.25; letter-spacing: -0.2px; color: var(--naya-primary);
76
+ }
77
+ .n-welcome .body { margin: 0; text-align: center; white-space: pre-line; font-size: 15px; line-height: 1.5; color: var(--naya-text-2); }
78
+ .n-welcome .steps { margin-top: 26px; }
79
+ .n-welcome .secure { display: flex; align-items: center; justify-content: center; gap: 5px; margin-top: 12px; text-align: center; font-size: 11px; color: var(--naya-text-2); }
80
+
81
+ /* \u2500\u2500 2 \xB7 Choix du document \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
82
+ .n-select .pad { display: flex; flex-direction: column; flex: 1; padding: 8px 24px 16px; }
83
+ .n-select .title { margin: 0 0 8px; white-space: pre-line; text-wrap: balance; font-size: 23px; font-weight: 800; line-height: 1.25; letter-spacing: -0.2px; color: var(--naya-primary); }
84
+ .n-select .body { margin: 0 0 18px; font-size: 15px; line-height: 1.5; color: var(--naya-text-2); }
85
+ .n-select .chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 18px; }
86
+ .n-select .chip {
87
+ flex: 0 0 auto; padding: 8px 14px; border-radius: 999px; cursor: pointer;
88
+ background: var(--naya-surface); border: 1px solid var(--naya-line);
89
+ font-size: 13px; font-weight: 500; color: var(--naya-text); white-space: nowrap;
90
+ }
91
+ .n-select .chip.on { border: 1.6px solid var(--naya-accent); font-weight: 700; background: color-mix(in srgb, var(--naya-accent) 18%, transparent); }
92
+ .n-select .chip:focus-visible { outline: 2px solid var(--naya-accent); outline-offset: 2px; }
93
+ .n-select .cards { display: flex; flex-direction: column; gap: 10px; }
94
+ .n-select .card {
95
+ display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px; cursor: pointer; text-align: left;
96
+ background: var(--naya-surface); border: 1px solid var(--naya-line); border-radius: var(--naya-r-card);
97
+ }
98
+ .n-select .card.on { border: 1.8px solid var(--naya-accent); background: #FFF9EE; }
99
+ .n-select .card:focus-visible { outline: 2px solid var(--naya-accent); outline-offset: 2px; }
100
+ .n-select .ico { width: 36px; height: 36px; border-radius: 8px; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; background: #EDF3FA; color: var(--naya-primary); }
101
+ .n-select .lbl { flex: 1; font-size: 14px; font-weight: 700; color: var(--naya-text); }
102
+ .n-select .card > .n-icon { color: var(--naya-text-2); }
103
+ .n-select .spacer { flex: 1 1 auto; min-height: 16px; }
104
+
105
+ /* \u2500\u2500 3-4 \xB7 Capture du document \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
106
+ .n-capture .pad { display: flex; flex-direction: column; flex: 1; align-items: center; padding: 0 16px 16px; }
107
+ .n-capture .instruction { width: 100%; margin: 0 0 12px; padding: 12px 16px; text-align: center; background: rgba(0,0,0,.55); border-radius: 12px; color: #fff; font-size: 15.5px; line-height: 1.35; font-weight: 600; }
108
+ .n-capture .cardWrap { flex: 1 1 auto; display: flex; align-items: center; width: 100%; min-height: 0; }
109
+ .n-capture .card { position: relative; width: 100%; aspect-ratio: 1.586; border-radius: 10px; overflow: hidden; background: rgba(255,255,255,.06); }
110
+ .n-capture .preview { width: 100%; height: 100%; object-fit: cover; display: block; }
111
+ .n-capture .camMsg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; text-align: center; color: rgba(255,255,255,.7); font-size: 13px; }
112
+ .n-capture .corners { position: absolute; inset: 0; width: 100%; height: 100%; fill: none; stroke: var(--naya-accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: stroke .2s ease; pointer-events: none; }
113
+ .n-capture .card.ready .corners { stroke: var(--naya-success); }
114
+ .n-capture .pills { display: flex; gap: 8px; justify-content: center; margin: 14px 0; }
115
+ .n-capture .pill { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; background: color-mix(in srgb, var(--naya-warning) 92%, transparent); color: #fff; font-size: 12.5px; font-weight: 700; }
116
+ .n-capture .pill.ok { background: color-mix(in srgb, var(--naya-success) 92%, transparent); }
117
+ .n-capture .shutter { width: 72px; height: 72px; border-radius: 50%; cursor: pointer; border: 4.5px solid #fff; background: rgba(255,255,255,.3); display: inline-flex; align-items: center; justify-content: center; transition: border-color .2s ease, background .2s ease; }
118
+ .n-capture .shutter.ready { border-color: var(--naya-success); background: color-mix(in srgb, var(--naya-success) 30%, transparent); }
119
+ .n-capture .shutter:disabled { cursor: default; }
120
+ .n-capture .shutter:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
121
+ .n-capture .hint { margin: 12px 0 0; text-align: center; font-size: 13px; font-weight: 500; color: #9FB2C6; }
122
+ .n-capture .hint.ready { color: var(--naya-success); font-weight: 700; }
123
+ .n-capture .loader { width: 30px; height: 30px; border-radius: 50%; border: 3px solid rgba(255,255,255,.25); border-top-color: #fff; animation: naya-spin .8s linear infinite; }
124
+ .n-capture .loader.sm { width: 24px; height: 24px; border-width: 2.5px; }
125
+
126
+ /* \u2500\u2500 5 \xB7 Vivacit\xE9 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
127
+ .n-liveness .pad { display: flex; flex-direction: column; flex: 1; align-items: center; padding: 4px 24px 12px; }
128
+ .n-liveness .title { margin: 0; font-size: 23px; font-weight: 800; color: var(--naya-primary); text-align: center; }
129
+ .n-liveness .sub { margin: 6px 0 18px; font-size: 15px; color: var(--naya-text-2); text-align: center; }
130
+ .n-liveness .ovalWrap { position: relative; width: min(230px, 62vw); aspect-ratio: 210 / 270; margin: 4px 0; }
131
+ .n-liveness .oval { position: absolute; inset: 7px; border-radius: 50%; overflow: hidden; background: rgba(0,0,0,.04); display: flex; align-items: center; justify-content: center; }
132
+ .n-liveness .preview { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
133
+ .n-liveness .camMsg { padding: 20px; text-align: center; color: var(--naya-text-2); font-size: 12px; }
134
+ .n-liveness .ring { position: absolute; inset: 0; width: 100%; height: 100%; fill: none; overflow: visible; }
135
+ .n-liveness .ring .track { stroke: #D8DFE8; stroke-width: 4; }
136
+ .n-liveness .ring .prog { stroke: var(--naya-accent); stroke-width: 4; stroke-linecap: round; transition: stroke-dashoffset .35s ease; }
137
+ .n-liveness .instruction { display: inline-flex; align-items: center; gap: 10px; margin: 18px 0 14px; padding: 12px 16px; background: var(--naya-surface); border: 1px solid var(--naya-line); border-radius: var(--naya-r-card); color: var(--naya-primary); }
138
+ .n-liveness .instruction span { font-size: 16px; font-weight: 700; color: var(--naya-text); }
139
+ .n-liveness .steps { display: flex; gap: 20px; justify-content: center; }
140
+ .n-liveness .cstep { display: flex; flex-direction: column; align-items: center; gap: 5px; }
141
+ .n-liveness .cdot { width: 22px; height: 22px; border-radius: 50%; background: #D6DCE4; display: inline-flex; align-items: center; justify-content: center; color: #fff; }
142
+ .n-liveness .cdot.active { background: var(--naya-accent); }
143
+ .n-liveness .cdot.done { background: var(--naya-success); }
144
+ .n-liveness .clbl { font-size: 11px; color: var(--naya-text-2); }
145
+ .n-liveness .spacer { flex: 1 1 auto; min-height: 12px; }
146
+ .n-liveness .privacy { margin: 0; text-align: center; white-space: pre-line; font-size: 12.5px; color: var(--naya-text-2); }
147
+ .n-liveness .loader { width: 30px; height: 30px; border-radius: 50%; border: 3px solid rgba(0,0,0,.12); border-top-color: var(--naya-accent); animation: naya-spin .8s linear infinite; }
148
+
149
+ /* \u2500\u2500 6 \xB7 Traitement \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
150
+ .n-processing .pad { display: flex; flex-direction: column; flex: 1; align-items: center; padding: 8px 32px 16px; }
151
+ .n-processing .pad.center { justify-content: center; text-align: center; }
152
+ .n-processing .spacer { flex: 1 1 auto; }
153
+ .n-processing .title { margin: 16px 0 8px; font-size: 23px; font-weight: 800; color: var(--naya-primary); text-wrap: balance; }
154
+ .n-processing .body { margin: 0; font-size: 15px; line-height: 1.5; color: var(--naya-text-2); }
155
+ .n-processing .cta { width: 100%; margin-top: 24px; }
156
+ .n-processing .spin { width: 110px; height: 110px; border-radius: 50%; border: 7px solid #E1E6EC; border-top-color: var(--naya-primary); animation: naya-spin 1s linear infinite; }
157
+ .n-processing .steps { list-style: none; margin: 34px 0 0; padding: 0; align-self: flex-start; }
158
+ .n-processing .row { display: flex; align-items: center; gap: 10px; padding: 5px 0; }
159
+ .n-processing .dot { width: 20px; height: 20px; border-radius: 50%; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; }
160
+ .n-processing .dot.done { background: var(--naya-success); color: #fff; }
161
+ .n-processing .dot.idle { background: #D6DCE4; }
162
+ .n-processing .dot.active { border: 2.5px solid var(--naya-accent); border-top-color: transparent; animation: naya-spin .8s linear infinite; }
163
+ .n-processing .lbl { font-size: 15px; font-weight: 600; color: var(--naya-text); }
164
+ .n-processing .lbl.dim { color: var(--naya-text-2); font-weight: 500; }
165
+ .n-processing .wait { font-size: 13px; color: var(--naya-text-2); margin: 0; }
166
+
167
+ /* \u2500\u2500 7 \xB7 R\xE9sultat \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
168
+ .n-result .pad { display: flex; flex-direction: column; flex: 1; align-items: center; padding: 8px 24px 16px; }
169
+ .n-result .spacer { flex: 1 1 auto; }
170
+ .n-result .badge { width: 88px; height: 88px; border-radius: 50%; color: #fff; display: inline-flex; align-items: center; justify-content: center; }
171
+ .n-result .title { margin: 18px 0 8px; text-align: center; text-wrap: balance; font-size: 23px; font-weight: 800; color: var(--naya-primary); }
172
+ .n-result .body { margin: 0; text-align: center; font-size: 15px; line-height: 1.5; color: var(--naya-text-2); }
173
+ .n-result .summary { width: 100%; margin-top: 20px; padding: 14px; background: var(--naya-surface); border: 1px solid var(--naya-line); border-radius: var(--naya-r-card); }
174
+ .n-result .srow { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; gap: 12px; }
175
+ .n-result .k { font-size: 13px; color: var(--naya-text-2); }
176
+ .n-result .v { font-size: 13px; font-weight: 800; color: var(--naya-text); text-align: right; }
177
+ .n-result .v.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; }
178
+ .n-result .bullets { list-style: none; margin: 20px 0 0; padding: 0; align-self: stretch; }
179
+ .n-result .bullets li { display: flex; align-items: center; gap: 9px; padding: 4px 0; font-size: 13px; color: var(--naya-text); }
180
+ .n-result .pip { width: 6px; height: 6px; border-radius: 50%; background: var(--naya-warning); flex: 0 0 auto; }
181
+ .n-result .gap { height: 10px; }
182
+
183
+ @media (prefers-reduced-motion: reduce) {
184
+ .n-capture .loader, .n-liveness .loader { animation-duration: 1.6s; }
185
+ .n-liveness .ring .prog { transition: none; }
186
+ .n-processing .spin { animation-duration: 2s; }
187
+ .n-processing .dot.active { animation-duration: 1.6s; }
188
+ }
189
+ `;var ie=["lastName","firstName","dateOfBirth","placeOfBirth","nationality","expirationDate","documentNumber","npi","issuingCountry","issuingAuthority","gender"];function R(s){if(!s||typeof s!="object")return;let e=s,t={};for(let n of ie){let a=e[n];typeof a=="string"&&a.length>0&&(t[n]=a);}return Object.keys(t).length?t:void 0}function he(s){let e={};for(let t of ie){let n=s[t];n&&(e[t]=n);}return e}function ye(s){return {status:"cancelled",verificationId:s}}function G(s,e){return {status:"error",errorMessage:s,verificationId:e}}var S=class extends Error{constructor(e,t){super(e),this.name="NayaApiError",this.statusCode=t;}},A=1e3,D=class{constructor(e,t){this.auth=e;this.baseUrl=t;}headers(){let e={"Content-Type":"application/json"};return this.auth.sessionToken?e.Authorization=`Bearer ${this.auth.sessionToken}`:this.auth.apiKey&&(e["X-API-Key"]=this.auth.apiKey),e}async post(e,t,n=30*A){let a=new AbortController,r=setTimeout(()=>a.abort(),n),o;try{o=await fetch(`${this.baseUrl}${e}`,{method:"POST",headers:this.headers(),body:JSON.stringify(t),signal:a.signal});}catch(d){let l=d instanceof DOMException&&d.name==="AbortError";throw new S(l?"D\xE9lai d\xE9pass\xE9 \u2014 r\xE9essayez.":"R\xE9seau indisponible.")}finally{clearTimeout(r);}let c;try{c=await o.json();}catch{throw new S("R\xE9ponse illisible du serveur.",o.status)}if(o.status>=400||c?.success!==true){let d=(c?.error&&typeof c.error=="object"?c.error.message:void 0)??"Erreur inconnue.";throw new S(d,o.status)}return c.data??{}}async start(e){let t=await this.post("/verifications/start",{documentType:e.documentType,country:e.country,...e.callbackUrl?{callbackUrl:e.callbackUrl}:{},device:"Web"});return {verificationId:String(t.verificationId??""),sessionToken:String(t.sessionToken??"")}}async uploadDocument(e,t){let n=await this.post(`/verifications/${e}/document`,{imageBase64Recto:t.rectoBase64,...t.versoBase64?{imageBase64Verso:t.versoBase64}:{}},120*A);return R(n.ocrData)}async submitLiveness(e,t){await this.post(`/verifications/${e}/liveness`,{livenessScore:t.livenessScore,matchScore:0,selfieBase64:t.selfieBase64},60*A);}async submit(e,t){let n=await this.post(`/verifications/${e}/submit`,t&&Object.keys(t).length?{userDeclaredData:t}:{},180*A);return {status:String(n.status??"review"),riskScore:C(n.riskScore),matchScore:C(n.matchScore),authenticityScore:C(n.authenticityScore),livenessScore:C(n.livenessScore),ocrConfidence:C(n.ocrConfidence),ocrData:R(n.ocrData),note:typeof n.note=="string"?n.note:void 0}}};function C(s){return typeof s=="number"&&!Number.isNaN(s)?s:void 0}var H=class{constructor(e){this.locale=e;}t(e,t){return this.locale==="fr"?e:t}get poweredBy(){return this.t("Propuls\xE9 par Naya ID (41Devs)","Powered by Naya ID (41Devs)")}get continueLabel(){return this.t("Continuer","Continue")}get backToApp(){return this.t("Retourner \xE0 l'application","Back to the app")}get welcomeTitle(){return this.t("V\xE9rifiez votre identit\xE9","Verify your identity")}get welcomeSubtitle(){return this.t(`Pr\xEAt en moins de 60 secondes.
190
+ Munissez-vous de votre pi\xE8ce d'identit\xE9.`,`Ready in under 60 seconds.
191
+ Have your ID document at hand.`)}get welcomeCta(){return this.t("Commencer","Get started")}get welcomeSecurity(){return this.t("Vos donn\xE9es sont chiffr\xE9es et transmises de fa\xE7on s\xE9curis\xE9e","Your data is encrypted and transmitted securely")}get stepDocument(){return this.t("Document","Document")}get stepSelfie(){return this.t("Selfie","Selfie")}get stepResult(){return this.t("R\xE9sultat","Result")}get docSelectTitle(){return this.t(`Quel document
192
+ avez-vous ?`,`Which document
193
+ do you have?`)}get docSelectSubtitle(){return this.t("Choisissez votre pays et votre pi\xE8ce d'identit\xE9.","Choose your country and your ID document.")}docLabel(e){switch(e){case "cni":return this.t("Carte Nationale d'Identit\xE9","National Identity Card");case "passeport":return this.t("Passeport","Passport");case "permis":return this.t("Permis de conduire","Driving licence")}}get captureRectoInstruction(){return this.t("Cadrez le recto de votre document dans le rectangle","Frame the front of your document inside the rectangle")}get captureVersoInstruction(){return this.t("Retournez la carte \u2014 la bande MRZ doit \xEAtre lisible","Flip the card \u2014 the MRZ strip must be readable")}get captureHint(){return this.t("Appuyez sur le d\xE9clencheur quand le cadre est vert","Tap the shutter when the frame turns green")}get captureReady(){return this.t("Image nette \u2014 appuyez pour capturer","Sharp image \u2014 tap to capture")}get qualityLight(){return this.t("Luminosit\xE9","Lighting")}get qualitySharpness(){return this.t("Nettet\xE9","Sharpness")}get livenessTitle(){return this.t("Un selfie rapide","A quick selfie")}get livenessSubtitle(){return this.t("Placez votre visage dans l'ovale.","Place your face in the oval.")}get livenessLookStraight(){return this.t("Regardez droit vers la cam\xE9ra","Look straight at the camera")}get livenessBlink(){return this.t("Clignez des yeux","Blink your eyes")}get livenessTurnHead(){return this.t("Tournez lentement la t\xEAte","Slowly turn your head")}get livenessHold(){return this.t("Ne bougez plus\u2026","Hold still\u2026")}get livenessStepFace(){return this.t("Visage","Face")}get livenessStepBlink(){return this.t("Clignement","Blink")}get livenessStepTurn(){return this.t("Rotation","Turn")}get livenessPrivacy(){return this.t(`L'analyse s'effectue sur votre appareil \u2014
194
+ la photo n'est envoy\xE9e qu'\xE0 la fin du d\xE9fi`,`Analysis runs on your device \u2014
195
+ the photo is only sent once the challenge is done`)}get processingDocument(){return this.t("Document analys\xE9","Document analyzed")}get processingFace(){return this.t("Visage compar\xE9","Face compared")}get processingCompliance(){return this.t("Contr\xF4les de conformit\xE9","Compliance checks")}get processingDecision(){return this.t("D\xE9cision","Decision")}get processingWait(){return this.t("Ne fermez pas la fen\xEAtre","Don't close the window")}get resultApprovedTitle(){return this.t("Identit\xE9 v\xE9rifi\xE9e !","Identity verified!")}get resultApprovedSubtitle(){return this.t("Votre v\xE9rification a \xE9t\xE9 transmise avec succ\xE8s.","Your verification was submitted successfully.")}get resultReference(){return this.t("R\xE9f\xE9rence","Reference")}get resultName(){return this.t("Nom complet","Full name")}get resultReviewTitle(){return this.t("V\xE9rification en cours d'examen","Verification under review")}get resultReviewSubtitle(){return this.t("Un analyste examine votre dossier.","An analyst is reviewing your file.")}get resultReviewB1(){return this.t("R\xE9ponse g\xE9n\xE9ralement sous 24 h","Usually answered within 24 h")}get resultReviewB2(){return this.t("Vous serez notifi\xE9 par l'application","The app will notify you")}get resultReviewB3(){return this.t("Aucune action requise de votre part","No action needed from you")}get resultRejectedTitle(){return this.t("V\xE9rification non aboutie","Verification unsuccessful")}get resultRejectedReason(){return this.t("Motif","Reason")}get retry(){return this.t("R\xE9essayer","Try again")}get errorTitle(){return this.t("Une erreur est survenue","Something went wrong")}get errorNetwork(){return this.t("V\xE9rifiez votre connexion internet puis r\xE9essayez.","Check your internet connection and try again.")}get errorCamera(){return this.t("Impossible d'acc\xE9der \xE0 la cam\xE9ra. V\xE9rifiez les autorisations du navigateur.","Cannot access the camera. Check the browser permissions.")}};var B=class{constructor(e,t,n){this.onStep=()=>{};this.step="welcome";this.session=null;this.country=null;this.document=null;this.rectoBase64=null;this.versoBase64=null;this.livenessScore=0;this.selfieBase64=null;this.attemptsUsed=0;this.submitResponse=null;this.stepHistory=[];this.documentUpload=null;this.finished=false;this.config=t,this.finishCb=n,this.api=new D(e,t.baseUrl),this.strings=new H(t.locale),this.country=t.country??null;}go(e){this.stepHistory.push(this.step),this.setStep(e);}replace(e){this.setStep(e);}get canGoBack(){return this.stepHistory.length>0}back(){let e=this.stepHistory.pop();e&&this.setStep(e);}setStep(e){this.step=e,this.onStep(e);}get client(){return this.api}get needsVerso(){return this.document==="cni"}get canRetry(){return this.attemptsUsed<this.config.maxAttempts}async ensureSession(){if(this.session)return this.session;let e=await this.api.start({documentType:this.document,country:this.country,callbackUrl:this.config.callbackUrl});return this.session=e,e}startDocumentUpload(){if(this.documentUpload)return;let e=this.uploadDocument();this.documentUpload=e,e.catch(()=>{});}ensureDocumentUploaded(){return this.documentUpload??(this.documentUpload=this.uploadDocument())}async uploadDocument(){try{let e=await this.ensureSession();await this.api.uploadDocument(e.verificationId,{rectoBase64:this.rectoBase64,versoBase64:this.versoBase64??void 0});}catch(e){throw this.documentUpload=null,e}}resetForRetry(){this.attemptsUsed+=1,this.session=null,this.rectoBase64=null,this.versoBase64=null,this.livenessScore=0,this.selfieBase64=null,this.submitResponse=null,this.documentUpload=null,this.stepHistory=[];}documentTypeNeedsVerso(e){return K(e)}complete(e){this.finished||(this.finished=true,this.finishCb({...e,verificationId:e.verificationId??this.session?.verificationId}));}cancel(){this.complete({status:"cancelled"});}};function i(s){return s.replace(/[&<>"']/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[e])}var me={shield:'<path d="M12 3l7 3v5c0 4.5-3 8.3-7 10-4-1.7-7-5.5-7-10V6l7-3z"/><path d="M9 12l2 2 4-4"/>',lock:'<rect x="5" y="11" width="14" height="9" rx="2"/><path d="M8 11V8a4 4 0 0 1 8 0v3"/>',fingerprint:'<path d="M12 11a2 2 0 0 1 2 2v1a5 5 0 0 1-.5 2.2"/><path d="M8 13a4 4 0 0 1 8 0v1a8 8 0 0 1-.8 3.5"/><path d="M5.5 15A7 7 0 0 1 5 12a7 7 0 0 1 12-5"/><path d="M12 20v-7"/>',close:'<path d="M6 6l12 12M18 6L6 18"/>',back:'<path d="M15 5l-7 7 7 7"/>',chevron:'<path d="M9 6l6 6-6 6"/>',check:'<path d="M5 12l5 5L20 7"/>',clock:'<circle cx="12" cy="12" r="8"/><path d="M12 8v4l3 2"/>',"wifi-off":'<path d="M3 3l18 18"/><path d="M5 12a11 11 0 0 1 4-2.5"/><path d="M8.5 16.5A5 5 0 0 1 12 15a5 5 0 0 1 2 .4"/><path d="M12 20h.01"/>',refresh:'<path d="M4 12a8 8 0 0 1 13.7-5.7L20 8"/><path d="M20 4v4h-4"/><path d="M20 12a8 8 0 0 1-13.7 5.7L4 16"/><path d="M4 20v-4h4"/>',"id-card":'<rect x="3" y="5" width="18" height="14" rx="2"/><circle cx="8.5" cy="11" r="2"/><path d="M13 10h5M13 14h5M5.5 15a3 3 0 0 1 6 0"/>',passport:'<rect x="5" y="3" width="14" height="18" rx="2"/><circle cx="12" cy="10" r="3"/><path d="M9 16h6"/>',car:'<path d="M5 16l1.5-5A2 2 0 0 1 8.4 10h7.2a2 2 0 0 1 1.9 1l1.5 5"/><rect x="3" y="16" width="18" height="4" rx="1"/><circle cx="7.5" cy="20" r="1"/><circle cx="16.5" cy="20" r="1"/>',sun:'<circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M2 12h2M20 12h2M5 5l1.5 1.5M17.5 17.5L19 19M19 5l-1.5 1.5M6.5 17.5L5 19"/>',focus:'<path d="M4 8V6a2 2 0 0 1 2-2h2M16 4h2a2 2 0 0 1 2 2v2M20 16v2a2 2 0 0 1-2 2h-2M8 20H6a2 2 0 0 1-2-2v-2"/><circle cx="12" cy="12" r="2.5"/>',eye:'<path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7z"/><circle cx="12" cy="12" r="3"/>',rotate:'<path d="M12 4a8 8 0 1 1-7.5 5.3"/><path d="M4 4v5h5"/>',hourglass:'<path d="M7 3h10M7 21h10M8 3c0 4 8 5 8 9s-8 5-8 9M16 3c0 4-8 5-8 9s8 5 8 9"/>'};function p(s,e=20,t=2){return `<svg class="n-icon" width="${e}" height="${e}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${t}" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${me[s]}</svg>`}function F(){return `<span class="n-brand"><span class="n-mark">${p("fingerprint",17)}</span><span class="n-name">Naya ID</span></span>`}function oe(s,e){return `<div class="n-dots">${s.map((n,a)=>`<div class="n-step"><span class="n-dot${a<=e?" on":""}"></span><span class="n-dotlbl">${i(n)}</span></div>`).join("")}</div>`}function k(s,e={}){return `<button type="button" class="n-btn n-btn-primary" data-act="${e.act??"primary"}"${e.disabled?" disabled":""}>${e.icon?p(e.icon,18):""}<span>${i(s)}</span></button>`}function le(s,e="secondary"){return `<button type="button" class="n-btn n-btn-secondary" data-act="${e}">${i(s)}</button>`}function v(s){let e=s.canClose!==false,t=document.createElement("div");t.className="n-shell"+(s.dark?" n-dark":""),t.innerHTML='<header class="n-bar">'+(s.canBack?`<button type="button" class="n-round" data-nav="back" aria-label="Retour">${p("back",20)}</button>`:'<span class="n-spacer"></span>')+(e?`<button type="button" class="n-round" data-nav="close" aria-label="Fermer">${p("close",20)}</button>`:'<span class="n-spacer"></span>')+`</header><main class="n-content ${s.screenClass}"></main><footer class="n-powered">${i(s.poweredBy)}</footer>`,t.querySelector('[data-nav="back"]')?.addEventListener("click",()=>s.onBack?.()),t.querySelector('[data-nav="close"]')?.addEventListener("click",()=>s.onClose?.());let n=t.querySelector(".n-content");return {root:t,content:n}}var O=class{constructor(e){this.flow=e;let t=e.strings,n=e.config,{root:a,content:r}=v({poweredBy:t.poweredBy,screenClass:"n-welcome",onClose:()=>e.cancel()});this.el=a;let o=[t.stepDocument,t.stepSelfie,t.stepResult],c=n.clientLogoUrl?`<span class="sep"></span><img class="clientLogo" src="${i(n.clientLogoUrl)}" alt="">`:"";r.innerHTML=`
196
+ <div class="pad">
197
+ <div class="brandRow">${F()}${c}</div>
198
+ <div class="spacer"></div>
199
+ <div class="hero">${p("shield",56,1.6)}</div>
200
+ <h1 class="title">${i(t.welcomeTitle)}</h1>
201
+ <p class="body">${i(t.welcomeSubtitle)}</p>
202
+ <div class="steps">${oe(o,0)}</div>
203
+ <div class="spacer"></div>
204
+ ${k(t.welcomeCta,{act:"start"})}
205
+ <div class="secure">${p("lock",13,2)}<span>${i(t.welcomeSecurity)}</span></div>
206
+ </div>`,r.querySelector('[data-act="start"]')?.addEventListener("click",()=>this.start());}dispose(){}start(){let e=this.flow.config;!!e.country&&e.documentTypes.length===1?(this.flow.country=e.country,this.flow.document=e.documentTypes[0],this.flow.go("capture-recto")):this.flow.go("select");}};function ge(s){switch(s){case "cni":return "id-card";case "passeport":return "passport";case "permis":return "car"}}var $=class{constructor(e){this.flow=e;let t=e.strings,n=e.config,a=!!n.country;this.country=n.country??n.countries[0],this.document=n.documentTypes.length===1?n.documentTypes[0]:null;let{root:r,content:o}=v({poweredBy:t.poweredBy,screenClass:"n-select",canBack:e.canGoBack,onBack:()=>e.back(),onClose:()=>e.cancel()});this.el=r,this.content=o;let c=a?"":`<div class="chips" role="listbox" aria-label="Pays">${n.countries.map(l=>`<button type="button" class="chip${l===this.country?" on":""}" role="option" data-country="${l}" aria-selected="${l===this.country}">${i(W(l))}</button>`).join("")}</div>`,d=n.documentTypes.map(l=>`<button type="button" class="card${l===this.document?" on":""}" data-doc="${l}"><span class="ico">${p(ge(l),20)}</span><span class="lbl">${i(t.docLabel(l))}</span>${p("chevron",20,2)}</button>`).join("");o.innerHTML=`
207
+ <div class="pad">
208
+ <h1 class="title">${i(t.docSelectTitle)}</h1>
209
+ <p class="body">${i(t.docSelectSubtitle)}</p>
210
+ ${c}
211
+ <div class="cards">${d}</div>
212
+ <div class="spacer"></div>
213
+ ${k(t.continueLabel,{disabled:!this.document,act:"next"})}
214
+ </div>`,o.querySelectorAll("[data-country]").forEach(l=>l.addEventListener("click",()=>this.selectCountry(l))),o.querySelectorAll("[data-doc]").forEach(l=>l.addEventListener("click",()=>this.selectDoc(l))),o.querySelector('[data-act="next"]')?.addEventListener("click",()=>this.next());}dispose(){}selectCountry(e){this.country=e.getAttribute("data-country"),this.content.querySelectorAll(".chip").forEach(t=>{let n=t===e;t.classList.toggle("on",n),t.setAttribute("aria-selected",String(n));});}selectDoc(e){this.document=e.getAttribute("data-doc"),this.content.querySelectorAll(".card").forEach(n=>n.classList.toggle("on",n===e));let t=this.content.querySelector('[data-act="next"]');t&&(t.disabled=false);}next(){this.document&&(this.flow.country=this.country,this.flow.document=this.document,this.flow.go("capture-recto"));}};function U(s,e=1600,t=.85){let n=s instanceof HTMLVideoElement?s.videoWidth:s.width,a=s instanceof HTMLVideoElement?s.videoHeight:s.height,r=Math.min(1,e/Math.max(n,a)),o=Math.round(n*r),c=Math.round(a*r),d=document.createElement("canvas");d.width=o,d.height=c;let l=d.getContext("2d");return l?(l.drawImage(s,0,0,o,c),d.toDataURL("image/jpeg",t)):""}function ce(s,e,t={x:.25,y:.25,w:.5,h:.5},n=240){let a=s.videoWidth,r=s.videoHeight;if(a<8||r<8)return {luminance:0,sharpness:0,lightOk:false,sharpOk:false};let o=Math.floor(a*t.x),c=Math.floor(r*t.y),d=Math.floor(a*t.w),l=Math.floor(r*t.h),y=Math.min(1,n/d),u=Math.max(8,Math.round(d*y)),m=Math.max(8,Math.round(l*y));e.width=u,e.height=m;let g=e.getContext("2d",{willReadFrequently:true});if(!g)return {luminance:0,sharpness:0,lightOk:false,sharpOk:false};g.drawImage(s,o,c,d,l,0,0,u,m);let{data:x}=g.getImageData(0,0,u,m),h=new Float32Array(u*m),b=0;for(let w=0,N=0;w<x.length;w+=4,N++){let E=.299*x[w]+.587*x[w+1]+.114*x[w+2];h[N]=E,b+=E;}let T=b/(u*m),Q=0,J=0,L=0;for(let w=1;w<m-1;w++)for(let N=1;N<u-1;N++){let E=w*u+N,q=4*h[E]-h[E-1]-h[E+1]-h[E-u]-h[E+u];Q+=q,J+=q*q,L++;}let X=L?Q/L:0,Z=L?J/L-X*X:0;return {luminance:T,sharpness:Z,lightOk:T>=60&&T<=235,sharpOk:Z>=60}}var M=class{constructor(e,t){this.flow=e;this.side=t;this.scratch=document.createElement("canvas");this.video=null;this.stream=null;this.qualityTimer=null;this.streaming=false;this.capturing=false;this.lightOk=false;this.sharpOk=false;this.disposed=false;let n=e.strings,{root:a,content:r}=v({poweredBy:n.poweredBy,screenClass:"n-capture",dark:true,canBack:e.canGoBack,onBack:()=>e.back(),onClose:()=>e.cancel()});this.el=a,this.content=r;let o=t==="recto"?n.captureRectoInstruction:n.captureVersoInstruction;r.innerHTML=`
215
+ <div class="pad">
216
+ <p class="instruction">${i(o)}</p>
217
+ <div class="cardWrap">
218
+ <div class="card" data-card>
219
+ <video class="preview" playsinline muted autoplay></video>
220
+ <div class="camMsg" data-loading><span class="loader"></span></div>
221
+ <svg class="corners" viewBox="0 0 100 63" preserveAspectRatio="none" aria-hidden="true">
222
+ <path d="M2,14 L2,6 Q2,2 6,2 L16,2"/>
223
+ <path d="M84,2 L94,2 Q98,2 98,6 L98,14"/>
224
+ <path d="M98,49 L98,57 Q98,61 94,61 L84,61"/>
225
+ <path d="M16,61 L6,61 Q2,61 2,57 L2,49"/>
226
+ </svg>
227
+ </div>
228
+ </div>
229
+ <div class="pills">
230
+ <span class="pill" data-pill="light"><span class="pico" data-ico>${p("sun",15,2.4)}</span><span>${i(n.qualityLight)}</span></span>
231
+ <span class="pill" data-pill="sharp"><span class="pico" data-ico>${p("focus",15,2.4)}</span><span>${i(n.qualitySharpness)}</span></span>
232
+ </div>
233
+ <button type="button" class="shutter" data-act="capture" disabled aria-label="${i(n.captureHint)}"></button>
234
+ <p class="hint">${i(n.captureHint)}</p>
235
+ </div>`,this.video=r.querySelector(".preview"),this.cardEl=r.querySelector("[data-card]"),this.shutterEl=r.querySelector('[data-act="capture"]'),this.hintEl=r.querySelector(".hint"),this.loadingEl=r.querySelector("[data-loading]"),this.lightPill=r.querySelector('[data-pill="light"]'),this.sharpPill=r.querySelector('[data-pill="sharp"]'),this.shutterEl.addEventListener("click",()=>{this.capture();}),this.startCamera();}dispose(){this.disposed=true,this.stopCamera();}async startCamera(){if(!navigator.mediaDevices?.getUserMedia){this.showCameraError();return}try{let e=await navigator.mediaDevices.getUserMedia({video:{facingMode:{ideal:"environment"},width:{ideal:1920}},audio:!1});if(this.disposed||!this.video){e.getTracks().forEach(t=>t.stop());return}this.stream=e,this.video.srcObject=e,await this.video.play().catch(()=>{}),this.loadingEl.hidden=!0,this.streaming=!0,this.updateReady(),this.startQualityLoop();}catch{this.showCameraError();}}startQualityLoop(){this.qualityTimer=setInterval(()=>{if(this.capturing||!this.video||this.video.videoWidth<8)return;let e=ce(this.video,this.scratch);e.lightOk!==this.lightOk&&this.setLight(e.lightOk),e.sharpOk!==this.sharpOk&&this.setSharp(e.sharpOk);},350);}setLight(e){this.lightOk=e,this.lightPill.classList.toggle("ok",e),this.lightPill.querySelector("[data-ico]").innerHTML=p(e?"check":"sun",15,2.4),this.updateReady();}setSharp(e){this.sharpOk=e,this.sharpPill.classList.toggle("ok",e),this.sharpPill.querySelector("[data-ico]").innerHTML=p(e?"check":"focus",15,2.4),this.updateReady();}updateReady(){let e=this.flow.strings,t=this.lightOk&&this.sharpOk&&!this.capturing;this.cardEl.classList.toggle("ready",t),this.shutterEl.classList.toggle("ready",t),this.hintEl.classList.toggle("ready",t),this.hintEl.textContent=t?e.captureReady:e.captureHint,this.shutterEl.disabled=!this.streaming||this.capturing;}showCameraError(){this.disposed||(this.video&&(this.video.hidden=true),this.loadingEl.hidden=false,this.loadingEl.textContent=this.flow.strings.errorCamera);}async capture(){if(!(!this.video||this.capturing||!this.streaming)){this.capturing=true,this.shutterEl.innerHTML='<span class="loader sm"></span>',this.updateReady();try{let e=U(this.video);if(this.stopCamera(),this.side==="recto"){if(this.flow.rectoBase64=e,this.flow.needsVerso){this.flow.go("capture-verso");return}}else this.flow.versoBase64=e;this.flow.startDocumentUpload(),this.flow.go("liveness");}finally{this.capturing=false;}}}stopCamera(){this.qualityTimer&&clearInterval(this.qualityTimer),this.qualityTimer=null,this.stream?.getTracks().forEach(e=>e.stop()),this.stream=null,this.streaming=false;}};var I=class{constructor(){this.step="searching-face";this.framesWithFace=0;this.framesWithoutFace=0;this.eyesClosedSeen=false;this.blinkDone=false;this.turnDone=false;}get stepIndex(){return {"searching-face":0,blink:1,"turn-head":2,done:3}[this.step]}get isDone(){return this.step==="done"}onFrame(e){let t=this.step;if(e.faceCount!==1)return this.framesWithoutFace++,this.framesWithoutFace>12&&this.step!=="done"&&(this.step="searching-face",this.framesWithFace=0),this.step!==t;switch(this.framesWithoutFace=0,this.framesWithFace++,this.step){case "searching-face":this.framesWithFace>=6&&(this.step=this.blinkDone?"turn-head":"blink");break;case "blink":{let{leftEyeOpen:n,rightEyeOpen:a}=e;if(n==null||a==null)break;n<.25&&a<.25?this.eyesClosedSeen=true:this.eyesClosedSeen&&n>.65&&a>.65&&(this.blinkDone=true,this.step=this.turnDone?"done":"turn-head");break}case "turn-head":{let n=e.yawDegrees;n!=null&&Math.abs(n)>16&&(this.turnDone=true,this.step="done");break}}return this.step!==t}score(){if(!this.isDone){let t=20;return this.framesWithFace>=6&&(t+=15),this.blinkDone&&(t+=15),t}return 90+Math.min(8,Math.round(this.framesWithFace/30))}};var pe="1.0.1",fe=`https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@${pe}/vision_bundle.mjs`,ve=`https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@${pe}/wasm`,xe="https://storage.googleapis.com/mediapipe-models/face_landmarker/face_landmarker/float16/1/face_landmarker.task",be=1,we=234,Se=454,_=class{constructor(){this.landmarker=null;}async init(e={}){let n=await import(e.esmUrl??fe),{FaceLandmarker:a,FilesetResolver:r}=n,o=await r.forVisionTasks(e.wasmBaseUrl??ve);this.landmarker=await a.createFromOptions(o,{baseOptions:{modelAssetPath:e.modelUrl??xe,delegate:"GPU"},runningMode:"VIDEO",numFaces:1,outputFaceBlendshapes:true});}get ready(){return !!this.landmarker}detect(e,t){if(!this.landmarker||e.videoWidth<8)return {faceCount:0,leftEyeOpen:null,rightEyeOpen:null,yawDegrees:null};let n=this.landmarker.detectForVideo(e,t),a=n.faceLandmarks?.length??0;if(a!==1)return {faceCount:a,leftEyeOpen:null,rightEyeOpen:null,yawDegrees:null};let r=null,o=null,c=n.faceBlendshapes?.[0]?.categories;if(c)for(let g of c)g.categoryName==="eyeBlinkLeft"?r=1-g.score:g.categoryName==="eyeBlinkRight"&&(o=1-g.score);let d=null,l=n.faceLandmarks[0],y=l[be],u=l[we],m=l[Se];if(y&&u&&m){let g=m.x-u.x;Math.abs(g)>1e-4&&(d=((y.x-u.x)/g-.5)*160);}return {faceCount:1,leftEyeOpen:r,rightEyeOpen:o,yawDegrees:d}}close(){this.landmarker?.close?.(),this.landmarker=null;}};var de="M105,4 A101,131 0 0 1 105,266 A101,131 0 0 1 105,4 Z",ke={"searching-face":0,blink:1,"turn-head":2,done:3},P=class{constructor(e){this.flow=e;this.video=null;this.stepEls=[];this.challenge=new I;this.tracker=new _;this.stream=null;this.rafId=0;this.step="searching-face";this.streaming=false;this.finishing=false;this.disposed=false;this.loop=()=>{if(!(!this.video||this.finishing||this.disposed)){if(this.tracker.ready&&this.video.videoWidth>8)try{let e=this.tracker.detect(this.video,performance.now());if(this.challenge.onFrame(e),this.challenge.step!==this.step&&this.render(this.challenge.step),this.challenge.isDone){this.finish();return}}catch{}this.rafId=requestAnimationFrame(this.loop);}};let t=e.strings,{root:n,content:a}=v({poweredBy:t.poweredBy,screenClass:"n-liveness",onClose:()=>e.cancel()});this.el=n,this.content=a;let r=[t.livenessStepFace,t.livenessStepBlink,t.livenessStepTurn].map(o=>`<div class="cstep"><span class="cdot" data-cdot></span><span class="clbl">${i(o)}</span></div>`).join("");a.innerHTML=`
236
+ <div class="pad">
237
+ <h1 class="title">${i(t.livenessTitle)}</h1>
238
+ <p class="sub">${i(t.livenessSubtitle)}</p>
239
+ <div class="ovalWrap">
240
+ <div class="oval">
241
+ <video class="preview" playsinline muted autoplay></video>
242
+ <div class="camMsg" data-loading><span class="loader"></span></div>
243
+ </div>
244
+ <svg class="ring" viewBox="0 0 210 270" aria-hidden="true">
245
+ <path class="track" d="${de}"/>
246
+ <path class="prog" data-prog d="${de}" pathLength="100" stroke-dasharray="100" stroke-dashoffset="100"/>
247
+ </svg>
248
+ </div>
249
+ <div class="instruction">
250
+ <span data-instr-ico>${p("focus",22,2)}</span>
251
+ <span data-instr-text>${i(t.livenessLookStraight)}</span>
252
+ </div>
253
+ <div class="steps">${r}</div>
254
+ <div class="spacer"></div>
255
+ <p class="privacy">${i(t.livenessPrivacy)}</p>
256
+ </div>`,this.video=a.querySelector(".preview"),this.progEl=a.querySelector("[data-prog]"),this.instrIcon=a.querySelector("[data-instr-ico]"),this.instrText=a.querySelector("[data-instr-text]"),this.loadingEl=a.querySelector("[data-loading]"),this.stepEls=Array.from(a.querySelectorAll("[data-cdot]")),this.start();}dispose(){this.disposed=true,this.teardown();}async start(){let e=this.flow.strings;if(!navigator.mediaDevices?.getUserMedia){this.showError(e.errorCamera);return}try{await this.tracker.init(this.flow.config.livenessAssets);}catch{this.showError(e.errorNetwork);return}if(!this.disposed)try{let t=await navigator.mediaDevices.getUserMedia({video:{facingMode:{ideal:"user"},width:{ideal:1280}},audio:!1});if(this.disposed||!this.video){t.getTracks().forEach(n=>n.stop());return}this.stream=t,this.video.srcObject=t,await this.video.play().catch(()=>{}),this.loadingEl.hidden=!0,this.streaming=!0,this.loop();}catch{this.showError(e.errorCamera);}}render(e){this.step=e;let t=this.flow.strings,n=ke[e],a=Math.min(1,n/3);this.progEl.setAttribute("stroke-dashoffset",String(100*(1-a)));let r=e==="searching-face"?"focus":e==="blink"?"eye":e==="turn-head"?"rotate":"hourglass",o=e==="searching-face"?t.livenessLookStraight:e==="blink"?t.livenessBlink:e==="turn-head"?t.livenessTurnHead:t.livenessHold;this.instrIcon.innerHTML=p(r,22,2),this.instrText.textContent=o,this.stepEls.forEach((c,d)=>{let l=d+1,y=n>=l,u=n===l-1;c.classList.toggle("done",y),c.classList.toggle("active",u&&!y),c.innerHTML=y?p("check",13,3):"";});}async finish(){if(!this.finishing){this.finishing=true,cancelAnimationFrame(this.rafId),this.tracker.close();try{if(await this.waitFrames(3),await new Promise(e=>setTimeout(e,300)),this.disposed)return;this.video&&this.video.videoWidth>8&&(this.flow.livenessScore=this.challenge.score(),this.flow.selfieBase64=U(this.video,1080)),this.stopStream(),this.flow.replace("processing");}catch{this.finishing=false,this.stopStream(),this.showError(this.flow.strings.errorCamera);}}}waitFrames(e){return new Promise(t=>{let n=0,a=()=>++n>=e?t():requestAnimationFrame(a);requestAnimationFrame(a);})}showError(e){this.disposed||(this.video&&(this.video.hidden=true),this.loadingEl.hidden=false,this.loadingEl.textContent=e);}stopStream(){this.stream?.getTracks().forEach(e=>e.stop()),this.stream=null,this.streaming=false;}teardown(){cancelAnimationFrame(this.rafId),this.tracker.close(),this.stopStream();}};var z=class{constructor(e){this.flow=e;this.visualStep=0;this.timer=null;this.disposed=false;let t=e.strings,{root:n,content:a}=v({poweredBy:t.poweredBy,screenClass:"n-processing",onClose:()=>e.cancel()});this.el=n,this.content=a,this.closeBtn=n.querySelector('[data-nav="close"]'),this.closeBtn&&(this.closeBtn.hidden=true),this.steps=[{label:t.processingDocument,index:0},{label:t.processingFace,index:1},{label:t.processingCompliance,index:2},{label:t.processingDecision,index:3}],this.renderProgress(),this.startVisualProgress(),this.run();}dispose(){this.disposed=true,this.timer&&clearInterval(this.timer),this.timer=null;}renderProgress(){let e=this.flow.strings,t=this.steps.map(n=>`<li class="row" data-row="${n.index}"><span class="dot idle"></span><span class="lbl">${i(n.label)}</span></li>`).join("");this.content.innerHTML=`
257
+ <div class="pad">
258
+ ${F()}
259
+ <div class="spacer"></div>
260
+ <span class="spin" aria-hidden="true"></span>
261
+ <ul class="steps">${t}</ul>
262
+ <div class="spacer"></div>
263
+ <p class="wait">${i(e.processingWait)}</p>
264
+ </div>`,this.closeBtn&&(this.closeBtn.hidden=true),this.updateSteps();}updateSteps(){let e=this.visualStep;this.steps.forEach(t=>{let n=this.content.querySelector(`[data-row="${t.index}"]`);if(!n)return;let a=n.querySelector(".dot"),r=n.querySelector(".lbl");t.index<=e?(a.className="dot done",a.innerHTML=p("check",12,3)):t.index===e+1?(a.className="dot active",a.innerHTML=""):(a.className="dot idle",a.innerHTML=""),r.classList.toggle("dim",t.index>e+1);});}startVisualProgress(){this.timer=setInterval(()=>{this.visualStep<2&&(this.visualStep+=1,this.updateSteps());},9e3);}renderError(e){let t=this.flow.strings;this.timer&&clearInterval(this.timer),this.timer=null,this.closeBtn&&(this.closeBtn.hidden=false),this.content.innerHTML=`
265
+ <div class="pad center">
266
+ ${p("wifi-off",48,1.8)}
267
+ <h1 class="title">${i(t.errorTitle)}</h1>
268
+ <p class="body">${i(e)}</p>
269
+ <div class="cta">${k(t.retry,{act:"retry"})}</div>
270
+ </div>`,this.content.querySelector('[data-act="retry"]')?.addEventListener("click",()=>{this.renderProgress(),this.startVisualProgress(),this.run();});}async run(){this.visualStep=0,this.updateSteps();try{await this.flow.ensureDocumentUploaded();let e=this.flow.session;if(!e)throw new S("Session introuvable.");await this.flow.client.submitLiveness(e.verificationId,{livenessScore:this.flow.livenessScore,selfieBase64:this.flow.selfieBase64});let t=await this.flow.client.submit(e.verificationId);if(this.disposed)return;this.flow.submitResponse=t,this.flow.replace("result");}catch(e){if(this.disposed)return;let t=e instanceof S?e.message:this.flow.strings.errorNetwork;this.renderError(t);}}};var j=class{constructor(e){this.flow=e;let t=e.strings,n=e.submitResponse,a=n?.status==="approved"?"approved":n?.status==="rejected"?"rejected":"review",r=this.viewFor(a),o=[n?.ocrData?.firstName,n?.ocrData?.lastName].filter(b=>b&&b.length).join(" "),c=e.session?.verificationId,d=c?c.split("-")[0].toUpperCase():"\u2014",l="";a==="approved"?l=`<div class="summary">${o?`<div class="srow"><span class="k">${i(t.resultName)}</span><span class="v">${i(o)}</span></div>`:""}<div class="srow"><span class="k">${i(t.resultReference)}</span><span class="v mono">${i(d)}</span></div></div>`:a==="review"&&(l=`<ul class="bullets">${[t.resultReviewB1,t.resultReviewB2,t.resultReviewB3].map(T=>`<li><span class="pip"></span>${i(T)}</li>`).join("")}</ul>`);let y=a==="rejected"&&e.canRetry,u=n?.ocrData?t.continueLabel:t.backToApp,m=y?`${k(t.retry,{icon:"refresh",act:"retry"})}<div class="gap"></div>${le(t.backToApp,"done")}`:k(u,{act:"done"}),g=r.subtitle?`<p class="body">${i(r.subtitle)}</p>`:"",{root:x,content:h}=v({poweredBy:t.poweredBy,screenClass:"n-result",canClose:false});this.el=x,h.innerHTML=`
271
+ <div class="pad">
272
+ <div class="spacer"></div>
273
+ <span class="badge" style="background:${r.color}">${p(r.icon,44,3)}</span>
274
+ <h1 class="title">${i(r.title)}</h1>
275
+ ${g}
276
+ ${l}
277
+ <div class="spacer"></div>
278
+ ${m}
279
+ </div>`,h.querySelector('[data-act="retry"]')?.addEventListener("click",()=>this.retry()),h.querySelector('[data-act="done"]')?.addEventListener("click",()=>this.done(a));}dispose(){}viewFor(e){let t=this.flow.strings;switch(e){case "approved":return {icon:"check",color:"var(--naya-success)",title:t.resultApprovedTitle,subtitle:t.resultApprovedSubtitle};case "rejected":{let n=this.flow.submitResponse?.note;return {icon:"close",color:"var(--naya-error)",title:t.resultRejectedTitle,subtitle:n?`${t.resultRejectedReason} : ${n}`:""}}default:return {icon:"clock",color:"var(--naya-warning)",title:t.resultReviewTitle,subtitle:t.resultReviewSubtitle}}}retry(){this.flow.resetForRetry(),this.flow.replace("capture-recto");}done(e){let t=this.flow.submitResponse;this.flow.complete({status:e,verificationId:this.flow.session?.verificationId,riskScore:t?.riskScore,matchScore:t?.matchScore,authenticityScore:t?.authenticityScore,livenessScore:t?.livenessScore,ocrConfidence:t?.ocrConfidence,ocrData:t?.ocrData,note:t?.note});}};function Ee(s,e){switch(s){case "welcome":return new O(e);case "select":return new $(e);case "capture-recto":return new M(e,"recto");case "capture-verso":return new M(e,"verso");case "liveness":return new P(e);case "processing":return new z(e);case "result":return new j(e)}}function ue(s,e){return typeof document>"u"?Promise.resolve(G("Le SDK Naya n\xE9cessite un environnement navigateur.")):new Promise(t=>{let n=document.createElement("div");n.setAttribute("data-naya-id","");let a=n.attachShadow({mode:"open"}),r=document.createElement("style");r.textContent=re,a.appendChild(r);let o=document.createElement("div");o.className="naya-host";let c=ae(e);for(let[h,b]of Object.entries(c))o.style.setProperty(h,b);a.appendChild(o);let d=document.body.style.overflow,l=false,y=null,u=h=>{l||(l=true,y?.dispose(),document.removeEventListener("keydown",x),document.body.style.overflow=d,n.remove(),t(h));},m=new B(s,e,u),g=h=>{y?.dispose(),y=Ee(h,m),o.replaceChildren(y.el);};m.onStep=g;let x=h=>{h.key==="Escape"&&m.cancel();};document.addEventListener("keydown",x),document.body.appendChild(n),document.body.style.overflow="hidden",g(m.step);})}async function Ne(s){let e=s.auth??{apiKey:s.apiKey,sessionToken:s.sessionToken};if(!e.apiKey&&!e.sessionToken)return {status:"error",errorMessage:"Authentification manquante : fournissez apiKey ou sessionToken."};let t=Y(s.config);return ue(e,t)}var Te="0.1.0",Ft={startVerification:Ne,version:Te};exports.NAYA_COUNTRIES=V;exports.NAYA_DEFAULT_ACCENT=ne;exports.NAYA_DEFAULT_BASE_URL=se;exports.NAYA_DEFAULT_PRIMARY=te;exports.NAYA_DOCUMENT_TYPES=ee;exports.NayaApiError=S;exports.cancelledResult=ye;exports.countryLabel=W;exports.default=Ft;exports.documentNeedsVerso=K;exports.errorResult=G;exports.ocrToDeclaredData=he;exports.parseOcrData=R;exports.resolveConfig=Y;exports.startVerification=Ne;exports.version=Te;Object.defineProperty(exports,'__esModule',{value:true});return exports;})({});//# sourceMappingURL=naya-id.min.js.map
280
+ //# sourceMappingURL=naya-id.min.js.map