@exige/web-scanner-sdk 0.2.37 → 0.2.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{driver-license-DWQiITx8.js → driver-license-DC8Jb0DE.js} +616 -525
- package/dist/driver-license-DC8Jb0DE.js.map +1 -0
- package/dist/react/types.d.ts +8 -0
- package/dist/react.js +289 -267
- package/dist/react.js.map +1 -1
- package/dist/scanner-sdk.js +1 -1
- package/dist/sdk/barcode.d.ts +15 -1
- package/dist/sdk/driver-license.d.ts +7 -1
- package/package.json +1 -1
- package/dist/driver-license-DWQiITx8.js.map +0 -1
package/dist/react.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { H as e, J as t, K as n, L as r, R as i, T as a, W as o, X as s, a as c, f as l, j as u, o as d, p as f, q as p, r as m, w as ee, y as h, z as te } from "./driver-license-
|
|
2
|
+
import { H as e, J as t, K as n, L as r, R as i, T as a, W as o, X as s, a as c, f as l, j as u, o as d, p as f, q as p, r as m, w as ee, y as h, z as te } from "./driver-license-DC8Jb0DE.js";
|
|
3
3
|
import { createContext as g, useCallback as _, useContext as v, useEffect as y, useLayoutEffect as ne, useMemo as re, useRef as b, useState as x } from "react";
|
|
4
4
|
import { Fragment as ie, jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
5
5
|
//#region src/sdk/display-quad.ts
|
|
@@ -11,7 +11,7 @@ function w(e) {
|
|
|
11
11
|
e.bottomLeft
|
|
12
12
|
];
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function ae(e) {
|
|
15
15
|
let [t, n, r, i] = e;
|
|
16
16
|
return {
|
|
17
17
|
topLeft: t,
|
|
@@ -38,10 +38,10 @@ function T(e) {
|
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
|
-
function
|
|
42
|
-
return
|
|
41
|
+
function oe(e) {
|
|
42
|
+
return ae(w(e).map((e) => ({ ...e })));
|
|
43
43
|
}
|
|
44
|
-
var
|
|
44
|
+
var se = class {
|
|
45
45
|
current;
|
|
46
46
|
target;
|
|
47
47
|
response;
|
|
@@ -54,7 +54,7 @@ var ae = class {
|
|
|
54
54
|
let n = w(this.current)[t];
|
|
55
55
|
return Math.hypot(e.x - n.x, e.y - n.y) / r > this.snapDistance;
|
|
56
56
|
});
|
|
57
|
-
return this.target =
|
|
57
|
+
return this.target = oe(e), i && (this.current = oe(e)), {
|
|
58
58
|
quad: this.current,
|
|
59
59
|
snapped: i
|
|
60
60
|
};
|
|
@@ -62,7 +62,7 @@ var ae = class {
|
|
|
62
62
|
step(e) {
|
|
63
63
|
if (!this.current || !this.target) return this.current;
|
|
64
64
|
let t = 1 - Math.exp(-this.response * Math.max(0, e) / 1e3);
|
|
65
|
-
return this.current =
|
|
65
|
+
return this.current = ae(w(this.current).map((e, n) => {
|
|
66
66
|
let r = w(this.target)[n];
|
|
67
67
|
return {
|
|
68
68
|
x: e.x + (r.x - e.x) * t,
|
|
@@ -76,13 +76,22 @@ var ae = class {
|
|
|
76
76
|
getCurrent() {
|
|
77
77
|
return this.current;
|
|
78
78
|
}
|
|
79
|
-
},
|
|
79
|
+
}, ce = g(null);
|
|
80
80
|
//#endregion
|
|
81
81
|
//#region src/react/context.tsx
|
|
82
|
-
function
|
|
82
|
+
function le(e) {
|
|
83
83
|
e?.startsWith("blob:") && URL.revokeObjectURL(e);
|
|
84
84
|
}
|
|
85
|
-
function
|
|
85
|
+
function ue() {
|
|
86
|
+
return new Promise((e) => {
|
|
87
|
+
if (typeof requestAnimationFrame == "function") {
|
|
88
|
+
requestAnimationFrame(() => requestAnimationFrame(() => e()));
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
setTimeout(e, 0);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
function de(e) {
|
|
86
95
|
try {
|
|
87
96
|
let t = e.toDataURL("image/jpeg", .92);
|
|
88
97
|
return t.startsWith("data:image/") ? t : void 0;
|
|
@@ -90,117 +99,124 @@ function ce(e) {
|
|
|
90
99
|
return;
|
|
91
100
|
}
|
|
92
101
|
}
|
|
93
|
-
function
|
|
102
|
+
function fe(e, t) {
|
|
94
103
|
if (typeof e == "function") return e(t);
|
|
95
104
|
}
|
|
96
|
-
function
|
|
97
|
-
let
|
|
105
|
+
function pe({ open: m, useCase: h = "document", autoCapture: g = "defaultOn", captureMode: v = "auto", torch: ie = "defaultOff", onCapture: C, onDriverLicense: w, onCancel: ae, onError: oe, onSettings: pe, onFinderStatus: me, modelUrl: T, ortWasmPaths: E, detectionIntervalMs: he, apiRef: D, children: ge }) {
|
|
106
|
+
let O = p(v), k = b(void 0), A = b(void 0), j = b(void 0), M = b(void 0), N = b({}), P = b(new se()), F = b(!1), _e = b(!1), I = b({
|
|
98
107
|
onCapture: C,
|
|
99
108
|
onDriverLicense: w,
|
|
100
|
-
onCancel:
|
|
101
|
-
onError:
|
|
102
|
-
onSettings:
|
|
103
|
-
onFinderStatus:
|
|
109
|
+
onCancel: ae,
|
|
110
|
+
onError: oe,
|
|
111
|
+
onSettings: pe,
|
|
112
|
+
onFinderStatus: me,
|
|
104
113
|
useCase: h
|
|
105
|
-
}),
|
|
114
|
+
}), ve = b(void 0), ye = b(void 0), L = b(async () => void 0), R = b(!1), z = b(void 0), be = b(null), [B, xe] = x(null), [Se, V] = x(O && m ? "capturing" : O ? "ready" : "starting"), [H, U] = x(), [Ce, W] = x(), [we, G] = x(), [Te, Ee] = x({
|
|
106
115
|
width: 1,
|
|
107
116
|
height: 1
|
|
108
|
-
}), [
|
|
117
|
+
}), [De, Oe] = x(), [ke, K] = x(), [Ae, q] = x(""), [je, Me] = x(0), [Ne, J] = x(), [Pe, Y] = x(), [Fe, Ie] = x("idle"), [Le, Re] = x(), ze = b(void 0), [Be, Ve] = x("front"), He = b("front"), [Ue, We] = x(!1), [Ge, Ke] = x({
|
|
109
118
|
downloading: !1,
|
|
110
119
|
loaded: 0,
|
|
111
120
|
total: null
|
|
112
|
-
}),
|
|
113
|
-
|
|
114
|
-
}, []),
|
|
115
|
-
let n =
|
|
116
|
-
|
|
121
|
+
}), X = _(() => {
|
|
122
|
+
le(ze.current), ze.current = void 0, Re(void 0);
|
|
123
|
+
}, []), Z = _((e, t) => {
|
|
124
|
+
let n = de(e);
|
|
125
|
+
le(ze.current), ze.current = n, Re(n), t?.pause();
|
|
126
|
+
}, []), Q = _(async (e, t) => {
|
|
127
|
+
t && (G({
|
|
128
|
+
width: e.width,
|
|
129
|
+
height: e.height
|
|
130
|
+
}), W(t), await ue(), await new Promise((e) => {
|
|
131
|
+
window.setTimeout(e, 280);
|
|
132
|
+
}));
|
|
117
133
|
}, []);
|
|
118
134
|
ne(() => {
|
|
119
|
-
|
|
135
|
+
I.current = {
|
|
120
136
|
onCapture: C,
|
|
121
137
|
onDriverLicense: w,
|
|
122
|
-
onCancel:
|
|
123
|
-
onError:
|
|
124
|
-
onSettings:
|
|
125
|
-
onFinderStatus:
|
|
138
|
+
onCancel: ae,
|
|
139
|
+
onError: oe,
|
|
140
|
+
onSettings: pe,
|
|
141
|
+
onFinderStatus: me,
|
|
126
142
|
useCase: h
|
|
127
143
|
};
|
|
128
144
|
}, [
|
|
129
145
|
C,
|
|
130
146
|
w,
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
147
|
+
ae,
|
|
148
|
+
oe,
|
|
149
|
+
pe,
|
|
150
|
+
me,
|
|
135
151
|
h
|
|
136
|
-
]), y(() => s(
|
|
152
|
+
]), y(() => s(Ke), []), y(() => {
|
|
137
153
|
if (!m || h !== "drivers-license") {
|
|
138
|
-
|
|
154
|
+
ye.current = void 0, ve.current = void 0, R.current = !1, Ve("front"), We(!1);
|
|
139
155
|
return;
|
|
140
156
|
}
|
|
141
157
|
let e = c({ scan: {
|
|
142
|
-
modelUrl:
|
|
143
|
-
ortWasmPaths:
|
|
158
|
+
modelUrl: T,
|
|
159
|
+
ortWasmPaths: E
|
|
144
160
|
} });
|
|
145
|
-
return
|
|
146
|
-
|
|
161
|
+
return ye.current = e, e.then((e) => {
|
|
162
|
+
ve.current = e;
|
|
147
163
|
}), () => {
|
|
148
|
-
e.then((e) => e.cancel()),
|
|
164
|
+
e.then((e) => e.cancel()), ve.current &&= void 0, ye.current = void 0;
|
|
149
165
|
};
|
|
150
166
|
}, [
|
|
151
167
|
m,
|
|
152
168
|
h,
|
|
153
|
-
|
|
154
|
-
|
|
169
|
+
T,
|
|
170
|
+
E
|
|
155
171
|
]);
|
|
156
|
-
let
|
|
157
|
-
|
|
172
|
+
let qe = _((e) => {
|
|
173
|
+
xe(e);
|
|
158
174
|
}, []);
|
|
159
175
|
y(() => {
|
|
160
|
-
if (!m || !
|
|
176
|
+
if (!m || !B) return;
|
|
161
177
|
let e = () => {
|
|
162
|
-
let e =
|
|
163
|
-
|
|
178
|
+
let e = B.getBoundingClientRect();
|
|
179
|
+
Ee({
|
|
164
180
|
width: e.width,
|
|
165
181
|
height: e.height
|
|
166
182
|
});
|
|
167
183
|
};
|
|
168
184
|
if (e(), typeof ResizeObserver > "u") return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
169
185
|
let t = new ResizeObserver(e);
|
|
170
|
-
return t.observe(
|
|
171
|
-
}, [m,
|
|
186
|
+
return t.observe(B), () => t.disconnect();
|
|
187
|
+
}, [m, B]), y(() => {
|
|
172
188
|
if (!m) return;
|
|
173
189
|
let e = window.setInterval(() => {
|
|
174
|
-
let e =
|
|
175
|
-
e &&
|
|
190
|
+
let e = k.current?.getDiagnostics();
|
|
191
|
+
e && J(e);
|
|
176
192
|
}, 500);
|
|
177
193
|
return () => window.clearInterval(e);
|
|
178
|
-
}, [m,
|
|
194
|
+
}, [m, je]), y(() => {
|
|
179
195
|
if (!m) return;
|
|
180
196
|
let e = 0, t = performance.now(), n = (r) => {
|
|
181
|
-
let i =
|
|
182
|
-
t = r, i &&
|
|
197
|
+
let i = P.current.step(r - t);
|
|
198
|
+
t = r, i && W(i), e = requestAnimationFrame(n);
|
|
183
199
|
};
|
|
184
200
|
return e = requestAnimationFrame(n), () => cancelAnimationFrame(e);
|
|
185
201
|
}, [m]), y(() => {
|
|
186
|
-
if (!m ||
|
|
202
|
+
if (!m || O || !B) return;
|
|
187
203
|
let e = !1, i = new AbortController();
|
|
188
|
-
|
|
204
|
+
z.current = i;
|
|
189
205
|
let o = () => {
|
|
190
|
-
i.abort(),
|
|
206
|
+
i.abort(), z.current === i && (z.current = void 0), A.current?.stop(), A.current = void 0, k.current?.stop(), k.current = void 0, M.current = void 0, j.current = void 0, N.current = {}, X();
|
|
191
207
|
};
|
|
192
208
|
return (async () => {
|
|
193
|
-
o(), i = new AbortController(),
|
|
209
|
+
o(), i = new AbortController(), z.current = i, F.current = !1, V("starting"), q(""), U(void 0), K(void 0), Y(void 0), Ie("idle"), X();
|
|
194
210
|
try {
|
|
195
|
-
let o = await t(
|
|
211
|
+
let o = await t(B, { torch: ie });
|
|
196
212
|
if (e) {
|
|
197
213
|
o.stop();
|
|
198
214
|
return;
|
|
199
215
|
}
|
|
200
|
-
|
|
216
|
+
k.current = o;
|
|
201
217
|
let s = o.getSettings();
|
|
202
|
-
if (
|
|
203
|
-
|
|
218
|
+
if (Oe(s), I.current.onSettings?.(s), console.info("[ScannerProvider] camera settings", s), I.current.useCase === "drivers-license" && He.current === "back") {
|
|
219
|
+
U(void 0), W(void 0), G(void 0), P.current.clear(), V("ready"), (async () => {
|
|
204
220
|
try {
|
|
205
221
|
let t = 0, a = await d(async () => {
|
|
206
222
|
t += 1;
|
|
@@ -215,12 +231,12 @@ function ue({ open: m, useCase: h = "document", autoCapture: g = "defaultOn", ca
|
|
|
215
231
|
return;
|
|
216
232
|
}
|
|
217
233
|
}, {
|
|
218
|
-
intervalMs:
|
|
234
|
+
intervalMs: he ?? 140,
|
|
219
235
|
signal: i.signal
|
|
220
236
|
});
|
|
221
|
-
if (e || i.signal.aborted ||
|
|
222
|
-
|
|
223
|
-
frame: a,
|
|
237
|
+
if (e || i.signal.aborted || R.current || (R.current = !0, Z(a.frame, B), K("live-mirror"), V("captured"), await Q(a.frame, a.quad), e || i.signal.aborted)) return;
|
|
238
|
+
await L.current({
|
|
239
|
+
frame: a.frame,
|
|
224
240
|
reason: "auto",
|
|
225
241
|
method: "live-mirror",
|
|
226
242
|
settings: o.getSettings()
|
|
@@ -228,43 +244,43 @@ function ue({ open: m, useCase: h = "document", autoCapture: g = "defaultOn", ca
|
|
|
228
244
|
} catch (t) {
|
|
229
245
|
if (e || i.signal.aborted || t instanceof DOMException && t.name === "AbortError") return;
|
|
230
246
|
let n = t instanceof Error ? t : /* @__PURE__ */ Error("Could not read the barcode.");
|
|
231
|
-
|
|
247
|
+
F.current = !0, q(n.message), V("error"), I.current.onError?.(n);
|
|
232
248
|
}
|
|
233
249
|
})();
|
|
234
250
|
return;
|
|
235
251
|
}
|
|
236
|
-
|
|
237
|
-
source:
|
|
252
|
+
A.current = await a({
|
|
253
|
+
source: B,
|
|
238
254
|
autoCapture: g,
|
|
239
|
-
intervalMs:
|
|
255
|
+
intervalMs: he,
|
|
240
256
|
detection: {
|
|
241
|
-
modelUrl:
|
|
242
|
-
ortWasmPaths:
|
|
257
|
+
modelUrl: T,
|
|
258
|
+
ortWasmPaths: E
|
|
243
259
|
},
|
|
244
260
|
onStatus: (e) => {
|
|
245
|
-
if (
|
|
246
|
-
let t =
|
|
247
|
-
|
|
248
|
-
} else
|
|
249
|
-
e.state !== "captured" && !
|
|
261
|
+
if (j.current = e, U(e), I.current.onFinderStatus?.(e), e.quad && e.sourceWidth && e.sourceHeight) {
|
|
262
|
+
let t = P.current.setTarget(e.quad, e.sourceWidth, e.sourceHeight);
|
|
263
|
+
W(t.quad);
|
|
264
|
+
} else P.current.clear(), W(void 0);
|
|
265
|
+
e.state !== "captured" && !F.current && V("ready");
|
|
250
266
|
},
|
|
251
267
|
captureFrame: async () => {
|
|
252
|
-
|
|
253
|
-
quad:
|
|
254
|
-
sourceWidth:
|
|
255
|
-
sourceHeight:
|
|
268
|
+
V("capturing"), N.current = {
|
|
269
|
+
quad: P.current.getCurrent(),
|
|
270
|
+
sourceWidth: j.current?.sourceWidth,
|
|
271
|
+
sourceHeight: j.current?.sourceHeight
|
|
256
272
|
};
|
|
257
273
|
let e = await o.capturePhoto();
|
|
258
|
-
if (
|
|
259
|
-
return
|
|
274
|
+
if (M.current = e, K(e.method), Y(e.diagnostics), J(e.diagnostics), e.luminance <= 10) throw Error(`The captured frame was blank (luminance ${e.luminance.toFixed(1)} via ${e.method}). Keep the scanner visible while capturing and retake.`);
|
|
275
|
+
return Z(e.frame, B), V("captured"), e.frame;
|
|
260
276
|
},
|
|
261
277
|
onCaptureError: (e) => {
|
|
262
|
-
|
|
263
|
-
let t =
|
|
264
|
-
t &&
|
|
278
|
+
F.current = !0, V("error"), q(e.message);
|
|
279
|
+
let t = k.current?.getDiagnostics();
|
|
280
|
+
t && J(t), I.current.onError?.(e);
|
|
265
281
|
},
|
|
266
282
|
onCapture: async (e) => {
|
|
267
|
-
let t =
|
|
283
|
+
let t = M.current;
|
|
268
284
|
await new Promise((e) => window.setTimeout(e, 140));
|
|
269
285
|
let n = {
|
|
270
286
|
...e,
|
|
@@ -273,78 +289,80 @@ function ue({ open: m, useCase: h = "document", autoCapture: g = "defaultOn", ca
|
|
|
273
289
|
fallbackReason: t?.fallbackReason,
|
|
274
290
|
luminance: t?.luminance,
|
|
275
291
|
diagnostics: t?.diagnostics,
|
|
276
|
-
displayedQuad:
|
|
277
|
-
displaySourceWidth:
|
|
278
|
-
displaySourceHeight:
|
|
292
|
+
displayedQuad: N.current.quad,
|
|
293
|
+
displaySourceWidth: N.current.sourceWidth,
|
|
294
|
+
displaySourceHeight: N.current.sourceHeight
|
|
279
295
|
};
|
|
280
|
-
if (
|
|
281
|
-
await
|
|
296
|
+
if (I.current.useCase === "drivers-license") {
|
|
297
|
+
await L.current(n);
|
|
282
298
|
return;
|
|
283
299
|
}
|
|
284
|
-
await
|
|
300
|
+
await fe(I.current.onCapture, n);
|
|
285
301
|
}
|
|
286
302
|
});
|
|
287
303
|
} catch (t) {
|
|
288
304
|
if (e) return;
|
|
289
305
|
o();
|
|
290
306
|
let n = t instanceof Error ? t : /* @__PURE__ */ Error("Camera access failed.");
|
|
291
|
-
|
|
307
|
+
q(n.message), V("error"), I.current.onError?.(n);
|
|
292
308
|
}
|
|
293
309
|
})(), () => {
|
|
294
310
|
e = !0, o();
|
|
295
311
|
};
|
|
296
312
|
}, [
|
|
297
313
|
m,
|
|
298
|
-
|
|
299
|
-
|
|
314
|
+
B,
|
|
315
|
+
O,
|
|
300
316
|
g,
|
|
301
317
|
ie,
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
318
|
+
T,
|
|
319
|
+
E,
|
|
320
|
+
he,
|
|
321
|
+
je,
|
|
322
|
+
X,
|
|
306
323
|
Z,
|
|
307
324
|
Q
|
|
308
325
|
]);
|
|
309
|
-
let
|
|
326
|
+
let Je = {
|
|
310
327
|
open: m,
|
|
311
|
-
phase:
|
|
328
|
+
phase: Se,
|
|
312
329
|
autoCapture: g,
|
|
313
330
|
captureMode: v,
|
|
314
|
-
usingSystemCamera:
|
|
315
|
-
finderStatus:
|
|
316
|
-
displayQuad:
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
331
|
+
usingSystemCamera: O,
|
|
332
|
+
finderStatus: H,
|
|
333
|
+
displayQuad: Ce,
|
|
334
|
+
barcodeOverlay: we,
|
|
335
|
+
previewSize: Te,
|
|
336
|
+
settings: De,
|
|
337
|
+
captureMethod: ke,
|
|
338
|
+
error: Ae,
|
|
339
|
+
diagnostics: Ne,
|
|
340
|
+
shutterDiagnostics: Pe,
|
|
341
|
+
copyState: Fe,
|
|
342
|
+
guidanceHint: H ? ee(H.guidance, H.lighting) : void 0,
|
|
343
|
+
detectorStatus: h === "drivers-license" && Be === "back" && !O ? "zxing" : H?.modelStatus === "failed" ? `ML failed${H.modelError ? `: ${H.modelError}` : ""}` : H?.detector === "ml" ? `ML ${H.modelProvider ?? ""}`.trim() : "ML loading",
|
|
344
|
+
modelDownload: Ge,
|
|
345
|
+
frozenPreviewUrl: Le,
|
|
328
346
|
useCase: h,
|
|
329
|
-
licenseSide: h === "drivers-license" ?
|
|
330
|
-
licenseBusy: h === "drivers-license" ?
|
|
347
|
+
licenseSide: h === "drivers-license" ? Be : void 0,
|
|
348
|
+
licenseBusy: h === "drivers-license" ? Ue : void 0
|
|
331
349
|
};
|
|
332
350
|
y(() => {
|
|
333
|
-
|
|
351
|
+
be.current = Je;
|
|
334
352
|
});
|
|
335
|
-
let
|
|
336
|
-
|
|
353
|
+
let Ye = _(() => {
|
|
354
|
+
I.current.onCancel();
|
|
337
355
|
}, []), $ = _(async () => {
|
|
338
|
-
if (!
|
|
339
|
-
|
|
356
|
+
if (!_e.current) {
|
|
357
|
+
_e.current = !0, F.current = !1, q(""), W(void 0), G(void 0), P.current.clear(), V("capturing");
|
|
340
358
|
try {
|
|
341
359
|
let t = await o();
|
|
342
|
-
|
|
360
|
+
Z(t);
|
|
343
361
|
let n = {
|
|
344
362
|
width: t.width,
|
|
345
363
|
height: t.height
|
|
346
364
|
};
|
|
347
|
-
|
|
365
|
+
Oe(n), I.current.onSettings?.(n), K("system-camera");
|
|
348
366
|
let r;
|
|
349
367
|
try {
|
|
350
368
|
let n = t.getContext("2d", { willReadFrequently: !0 })?.getImageData(0, 0, t.width, t.height).data;
|
|
@@ -352,8 +370,10 @@ function ue({ open: m, useCase: h = "document", autoCapture: g = "defaultOn", ca
|
|
|
352
370
|
} catch {
|
|
353
371
|
r = void 0;
|
|
354
372
|
}
|
|
355
|
-
if (
|
|
356
|
-
|
|
373
|
+
if (I.current.useCase === "drivers-license" && He.current === "back") {
|
|
374
|
+
W(void 0), G(void 0), P.current.clear(), N.current = {}, V("captured");
|
|
375
|
+
let e = await f(t);
|
|
376
|
+
await Q(t, e?.quad), await L.current({
|
|
357
377
|
frame: t,
|
|
358
378
|
reason: "manual",
|
|
359
379
|
method: "system-camera",
|
|
@@ -363,18 +383,18 @@ function ue({ open: m, useCase: h = "document", autoCapture: g = "defaultOn", ca
|
|
|
363
383
|
return;
|
|
364
384
|
}
|
|
365
385
|
let i = await u(t, {
|
|
366
|
-
modelUrl:
|
|
367
|
-
ortWasmPaths:
|
|
386
|
+
modelUrl: T,
|
|
387
|
+
ortWasmPaths: E
|
|
368
388
|
});
|
|
369
389
|
if (i.status !== "success" || !i.corners || !i.quad) {
|
|
370
|
-
|
|
390
|
+
F.current = !0, V("error"), q(i.message), I.current.onError?.(Error(i.message));
|
|
371
391
|
return;
|
|
372
392
|
}
|
|
373
|
-
|
|
393
|
+
N.current = {
|
|
374
394
|
quad: i.quad,
|
|
375
395
|
sourceWidth: i.sourceWidth,
|
|
376
396
|
sourceHeight: i.sourceHeight
|
|
377
|
-
}, i.quad &&
|
|
397
|
+
}, i.quad && W(i.quad), V("captured");
|
|
378
398
|
let a = {
|
|
379
399
|
frame: t,
|
|
380
400
|
detection: i,
|
|
@@ -386,75 +406,76 @@ function ue({ open: m, useCase: h = "document", autoCapture: g = "defaultOn", ca
|
|
|
386
406
|
displaySourceWidth: i.sourceWidth,
|
|
387
407
|
displaySourceHeight: i.sourceHeight
|
|
388
408
|
};
|
|
389
|
-
if (
|
|
390
|
-
await
|
|
409
|
+
if (I.current.useCase === "drivers-license") {
|
|
410
|
+
await L.current(a);
|
|
391
411
|
return;
|
|
392
412
|
}
|
|
393
|
-
await
|
|
413
|
+
await fe(I.current.onCapture, a);
|
|
394
414
|
} catch (e) {
|
|
395
415
|
let t = e instanceof Error ? e : /* @__PURE__ */ Error("Could not take a photo.");
|
|
396
416
|
if (t.message === "No photo was selected.") {
|
|
397
|
-
if (
|
|
398
|
-
|
|
417
|
+
if (ze.current) {
|
|
418
|
+
V("error");
|
|
399
419
|
return;
|
|
400
420
|
}
|
|
401
|
-
|
|
421
|
+
I.current.onCancel();
|
|
402
422
|
return;
|
|
403
423
|
}
|
|
404
|
-
|
|
424
|
+
F.current = !0, q(t.message), V("error"), I.current.onError?.(t);
|
|
405
425
|
} finally {
|
|
406
|
-
|
|
426
|
+
_e.current = !1;
|
|
407
427
|
}
|
|
408
428
|
}
|
|
409
429
|
}, [
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
430
|
+
Z,
|
|
431
|
+
T,
|
|
432
|
+
E,
|
|
433
|
+
Q
|
|
434
|
+
]), Xe = _(async (e) => {
|
|
435
|
+
let t = await ye.current;
|
|
415
436
|
if (t) {
|
|
416
|
-
|
|
437
|
+
We(!0);
|
|
417
438
|
try {
|
|
418
439
|
let n = await t.submitStill(e.frame, e.detection);
|
|
419
440
|
if (n.kind === "need-back") {
|
|
420
|
-
if (
|
|
421
|
-
|
|
441
|
+
if (He.current = "back", R.current = !1, Ve("back"), F.current = !1, q(""), U(void 0), W(void 0), G(void 0), P.current.clear(), X(), O) {
|
|
442
|
+
V("ready");
|
|
422
443
|
return;
|
|
423
444
|
}
|
|
424
|
-
|
|
445
|
+
B?.paused && B.play(), V("starting"), Me((e) => e + 1);
|
|
425
446
|
return;
|
|
426
447
|
}
|
|
427
448
|
if (n.kind === "retry") {
|
|
428
|
-
|
|
449
|
+
F.current = !0, q(n.message), V("error");
|
|
429
450
|
return;
|
|
430
451
|
}
|
|
431
|
-
await
|
|
452
|
+
await fe(I.current.onDriverLicense, n.result);
|
|
432
453
|
} catch (e) {
|
|
433
454
|
let t = e instanceof Error ? e : /* @__PURE__ */ Error("Driver’s license scan failed.");
|
|
434
|
-
|
|
455
|
+
F.current = !0, q(t.message), V("error"), I.current.onError?.(t);
|
|
435
456
|
} finally {
|
|
436
|
-
|
|
457
|
+
We(!1);
|
|
437
458
|
}
|
|
438
459
|
}
|
|
439
460
|
}, [
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
461
|
+
X,
|
|
462
|
+
B,
|
|
463
|
+
O
|
|
443
464
|
]);
|
|
444
465
|
ne(() => {
|
|
445
|
-
|
|
446
|
-
}, [
|
|
447
|
-
let
|
|
448
|
-
if (
|
|
466
|
+
L.current = Xe;
|
|
467
|
+
}, [Xe]);
|
|
468
|
+
let Ze = _(async () => {
|
|
469
|
+
if (O) {
|
|
449
470
|
await $();
|
|
450
471
|
return;
|
|
451
472
|
}
|
|
452
|
-
let e =
|
|
453
|
-
if (e &&
|
|
473
|
+
let e = k.current;
|
|
474
|
+
if (e && I.current.useCase === "drivers-license" && He.current === "back") {
|
|
454
475
|
try {
|
|
455
|
-
let t = await e.capturePhoto();
|
|
456
|
-
if (!
|
|
457
|
-
|
|
476
|
+
let t = await e.capturePhoto(), n = await f(t.frame);
|
|
477
|
+
if (!n?.text || R.current) return;
|
|
478
|
+
R.current = !0, z.current?.abort(), M.current = t, K(t.method), Y(t.diagnostics), J(t.diagnostics), Z(t.frame, B), V("captured"), await Q(t.frame, n.quad), await L.current({
|
|
458
479
|
frame: t.frame,
|
|
459
480
|
reason: "manual",
|
|
460
481
|
method: t.method,
|
|
@@ -465,74 +486,75 @@ function ue({ open: m, useCase: h = "document", autoCapture: g = "defaultOn", ca
|
|
|
465
486
|
});
|
|
466
487
|
} catch (e) {
|
|
467
488
|
let t = e instanceof Error ? e : /* @__PURE__ */ Error("Could not capture the camera frame.");
|
|
468
|
-
|
|
469
|
-
let n =
|
|
470
|
-
n &&
|
|
489
|
+
F.current = !0, q(t.message);
|
|
490
|
+
let n = k.current?.getDiagnostics();
|
|
491
|
+
n && J(n), M.current?.diagnostics && Y(M.current.diagnostics), V("error"), I.current.onError?.(t);
|
|
471
492
|
}
|
|
472
493
|
return;
|
|
473
494
|
}
|
|
474
495
|
try {
|
|
475
|
-
await
|
|
496
|
+
await A.current?.capture();
|
|
476
497
|
} catch (e) {
|
|
477
498
|
let t = e instanceof Error ? e : /* @__PURE__ */ Error("Could not capture the camera frame.");
|
|
478
|
-
|
|
479
|
-
let n =
|
|
480
|
-
n &&
|
|
499
|
+
F.current = !0, q(t.message);
|
|
500
|
+
let n = k.current?.getDiagnostics();
|
|
501
|
+
n && J(n), M.current?.diagnostics && Y(M.current.diagnostics), V("error"), I.current.onError?.(t);
|
|
481
502
|
}
|
|
482
503
|
}, [
|
|
483
504
|
$,
|
|
505
|
+
Z,
|
|
506
|
+
B,
|
|
484
507
|
Q,
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
let Ye = b(!1);
|
|
508
|
+
O
|
|
509
|
+
]), Qe = b($);
|
|
510
|
+
Qe.current = $;
|
|
511
|
+
let $e = b(!1);
|
|
490
512
|
ne(() => {
|
|
491
|
-
if (!m || !
|
|
492
|
-
|
|
513
|
+
if (!m || !O) {
|
|
514
|
+
$e.current = !1;
|
|
493
515
|
return;
|
|
494
516
|
}
|
|
495
|
-
if (
|
|
496
|
-
if (
|
|
497
|
-
|
|
517
|
+
if (!$e.current) {
|
|
518
|
+
if ($e.current = !0, F.current = !1, q(""), U(void 0), K(void 0), Y(void 0), Ie("idle"), W(void 0), G(void 0), P.current.clear(), X(), !te()) {
|
|
519
|
+
V("ready");
|
|
498
520
|
return;
|
|
499
521
|
}
|
|
500
|
-
|
|
522
|
+
Qe.current();
|
|
501
523
|
}
|
|
502
524
|
}, [
|
|
503
525
|
m,
|
|
504
|
-
|
|
505
|
-
|
|
526
|
+
O,
|
|
527
|
+
X
|
|
506
528
|
]);
|
|
507
|
-
let
|
|
508
|
-
if (
|
|
529
|
+
let et = _(() => {
|
|
530
|
+
if (F.current = !1, R.current = !1, q(""), Y(void 0), Ie("idle"), U(void 0), W(void 0), G(void 0), P.current.clear(), O) {
|
|
509
531
|
$();
|
|
510
532
|
return;
|
|
511
533
|
}
|
|
512
|
-
if (
|
|
513
|
-
|
|
534
|
+
if (X(), h === "drivers-license") {
|
|
535
|
+
V("starting"), Me((e) => e + 1);
|
|
514
536
|
return;
|
|
515
537
|
}
|
|
516
|
-
let e =
|
|
517
|
-
|
|
538
|
+
let e = k.current;
|
|
539
|
+
B?.paused && B.play(), V(e ? "ready" : "starting"), e || Me((e) => e + 1);
|
|
518
540
|
}, [
|
|
519
541
|
$,
|
|
520
|
-
|
|
521
|
-
|
|
542
|
+
X,
|
|
543
|
+
B,
|
|
522
544
|
h,
|
|
523
|
-
|
|
524
|
-
]),
|
|
525
|
-
let t =
|
|
526
|
-
t && (await t.setTorch(e),
|
|
527
|
-
}, []),
|
|
528
|
-
|
|
529
|
-
}, []),
|
|
530
|
-
let e =
|
|
545
|
+
O
|
|
546
|
+
]), tt = _(async (e) => {
|
|
547
|
+
let t = k.current;
|
|
548
|
+
t && (await t.setTorch(e), J(t.getDiagnostics()));
|
|
549
|
+
}, []), nt = _((e) => {
|
|
550
|
+
A.current?.setAutoCapture(e);
|
|
551
|
+
}, []), rt = _(async () => {
|
|
552
|
+
let e = be.current, t = k.current?.getDiagnostics() ?? e.diagnostics, n = e.finderStatus, r = i({
|
|
531
553
|
error: e.error || void 0,
|
|
532
554
|
captureMethod: e.captureMethod,
|
|
533
|
-
luminance:
|
|
534
|
-
fallbackReason:
|
|
535
|
-
shutter: e.shutterDiagnostics ??
|
|
555
|
+
luminance: M.current?.luminance,
|
|
556
|
+
fallbackReason: M.current?.fallbackReason,
|
|
557
|
+
shutter: e.shutterDiagnostics ?? M.current?.diagnostics,
|
|
536
558
|
live: t,
|
|
537
559
|
finder: n ? {
|
|
538
560
|
state: n.state,
|
|
@@ -557,55 +579,55 @@ function ue({ open: m, useCase: h = "document", autoCapture: g = "defaultOn", ca
|
|
|
557
579
|
let t = document.execCommand("copy");
|
|
558
580
|
if (e.remove(), !t) throw Error("Clipboard copy is unavailable.");
|
|
559
581
|
}
|
|
560
|
-
|
|
582
|
+
Ie("copied");
|
|
561
583
|
} catch {
|
|
562
|
-
|
|
584
|
+
Ie("failed");
|
|
563
585
|
}
|
|
564
|
-
}, []),
|
|
565
|
-
capture:
|
|
566
|
-
cancel:
|
|
567
|
-
retry:
|
|
568
|
-
setTorch:
|
|
569
|
-
setAutoCapture:
|
|
570
|
-
copyReport:
|
|
571
|
-
getState:
|
|
586
|
+
}, []), it = _(() => be.current, []), at = re(() => ({
|
|
587
|
+
capture: Ze,
|
|
588
|
+
cancel: Ye,
|
|
589
|
+
retry: et,
|
|
590
|
+
setTorch: tt,
|
|
591
|
+
setAutoCapture: nt,
|
|
592
|
+
copyReport: rt,
|
|
593
|
+
getState: it
|
|
572
594
|
}), [
|
|
573
|
-
qe,
|
|
574
|
-
Ge,
|
|
575
|
-
Xe,
|
|
576
595
|
Ze,
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
596
|
+
Ye,
|
|
597
|
+
et,
|
|
598
|
+
tt,
|
|
599
|
+
nt,
|
|
600
|
+
rt,
|
|
601
|
+
it
|
|
580
602
|
]);
|
|
581
603
|
y(() => {
|
|
582
|
-
if (
|
|
583
|
-
|
|
604
|
+
if (D) return D.current = at, () => {
|
|
605
|
+
D.current = null;
|
|
584
606
|
};
|
|
585
|
-
}, [
|
|
586
|
-
let
|
|
587
|
-
...
|
|
588
|
-
...
|
|
589
|
-
bindPreview:
|
|
607
|
+
}, [at, D]);
|
|
608
|
+
let ot = {
|
|
609
|
+
...Je,
|
|
610
|
+
...at,
|
|
611
|
+
bindPreview: qe
|
|
590
612
|
};
|
|
591
|
-
return /* @__PURE__ */ S(
|
|
592
|
-
value:
|
|
593
|
-
children:
|
|
613
|
+
return /* @__PURE__ */ S(ce.Provider, {
|
|
614
|
+
value: ot,
|
|
615
|
+
children: ge
|
|
594
616
|
});
|
|
595
617
|
}
|
|
596
618
|
//#endregion
|
|
597
619
|
//#region src/react/hooks.ts
|
|
598
|
-
function
|
|
620
|
+
function me() {
|
|
599
621
|
return b(null);
|
|
600
622
|
}
|
|
601
|
-
function
|
|
602
|
-
let e = v(
|
|
623
|
+
function T() {
|
|
624
|
+
let e = v(ce);
|
|
603
625
|
if (!e) throw Error("useScanner must be used within ScannerProvider.");
|
|
604
626
|
return e;
|
|
605
627
|
}
|
|
606
628
|
//#endregion
|
|
607
629
|
//#region src/live-overlay-geometry.ts
|
|
608
|
-
function
|
|
630
|
+
function E(e, t, n, r, i) {
|
|
609
631
|
let a = Math.max(1, e), o = Math.max(1, t), s = Math.max(1, n), c = Math.max(1, r), l = s / a, u = c / o, d = i === "cover" ? Math.max(l, u) : Math.min(l, u), f = (s - a * d) / 2, p = (c - o * d) / 2;
|
|
610
632
|
if (i === "contain") return {
|
|
611
633
|
viewBox: `0 0 ${a} ${o}`,
|
|
@@ -625,7 +647,7 @@ function O(e, t, n, r, i) {
|
|
|
625
647
|
}
|
|
626
648
|
//#endregion
|
|
627
649
|
//#region src/components/ModelDownloadRing.tsx
|
|
628
|
-
function
|
|
650
|
+
function he({ snapshot: e }) {
|
|
629
651
|
if (!e.downloading) return null;
|
|
630
652
|
let t = e.total && e.total > 0 ? Math.min(1, e.loaded / e.total) : null, n = t === null ? null : Math.round(t * 100), r = 2 * Math.PI * 28;
|
|
631
653
|
return /* @__PURE__ */ C("div", {
|
|
@@ -661,12 +683,12 @@ function fe({ snapshot: e }) {
|
|
|
661
683
|
}
|
|
662
684
|
//#endregion
|
|
663
685
|
//#region src/react/guidance.ts
|
|
664
|
-
function
|
|
686
|
+
function D(e) {
|
|
665
687
|
if (!(e.usingSystemCamera || e.licenseBusy) && e.phase !== "error") return e.phase === "starting" ? e.licenseHeadline : e.phase === "capturing" ? "Capturing full resolution…" : e.phase === "captured" ? "Document captured" : e.holdStillSeconds && e.holdStillSeconds > 0 ? h(e.holdStillSeconds) : e.guidanceHint && e.guidanceReason && e.guidanceReason !== "place-document" ? e.guidanceHint : e.licenseHeadline ?? e.guidanceHint ?? "Place the document in the frame";
|
|
666
688
|
}
|
|
667
689
|
//#endregion
|
|
668
690
|
//#region src/react/parts.tsx
|
|
669
|
-
var
|
|
691
|
+
var ge = {
|
|
670
692
|
primaryColorHex: "--scanner-overlay-primary",
|
|
671
693
|
seekingColorHex: "--scanner-overlay-seeking",
|
|
672
694
|
detectingColorHex: "--scanner-overlay-detecting",
|
|
@@ -674,19 +696,19 @@ var pe = {
|
|
|
674
696
|
readyColorHex: "--scanner-overlay-ready",
|
|
675
697
|
capturedColorHex: "--scanner-overlay-captured"
|
|
676
698
|
};
|
|
677
|
-
function
|
|
699
|
+
function O(e) {
|
|
678
700
|
if (!e) return;
|
|
679
701
|
let t = {};
|
|
680
|
-
for (let [n, r] of Object.entries(
|
|
702
|
+
for (let [n, r] of Object.entries(ge)) {
|
|
681
703
|
let i = e[n]?.trim();
|
|
682
704
|
i && (t[r] = i);
|
|
683
705
|
}
|
|
684
706
|
return Object.keys(t).length > 0 ? t : void 0;
|
|
685
707
|
}
|
|
686
|
-
function
|
|
687
|
-
let i =
|
|
708
|
+
function k({ theme: e, style: t, title: n, children: r }) {
|
|
709
|
+
let i = T();
|
|
688
710
|
if (!i.open) return null;
|
|
689
|
-
let a = n ?? (i.useCase === "drivers-license" ? "Scan a driver’s license" : "Scan a document"), o =
|
|
711
|
+
let a = n ?? (i.useCase === "drivers-license" ? "Scan a driver’s license" : "Scan a document"), o = O(e), s = o ? {
|
|
690
712
|
...t,
|
|
691
713
|
...o
|
|
692
714
|
} : t;
|
|
@@ -696,11 +718,11 @@ function j({ theme: e, style: t, title: n, children: r }) {
|
|
|
696
718
|
role: "dialog",
|
|
697
719
|
"aria-modal": "true",
|
|
698
720
|
"aria-label": a,
|
|
699
|
-
children: [r, /* @__PURE__ */ S(
|
|
721
|
+
children: [r, /* @__PURE__ */ S(I, {})]
|
|
700
722
|
});
|
|
701
723
|
}
|
|
702
|
-
function
|
|
703
|
-
let { bindPreview: e, frozenPreviewUrl: t, usingSystemCamera: n } =
|
|
724
|
+
function A() {
|
|
725
|
+
let { bindPreview: e, frozenPreviewUrl: t, usingSystemCamera: n } = T(), r = b(null), i = _((t) => {
|
|
704
726
|
r.current = t, e(t);
|
|
705
727
|
}, [e]);
|
|
706
728
|
return y(() => {
|
|
@@ -729,20 +751,20 @@ function M() {
|
|
|
729
751
|
"aria-label": "Captured document"
|
|
730
752
|
}) : null] });
|
|
731
753
|
}
|
|
732
|
-
function
|
|
733
|
-
let { finderStatus: e, displayQuad: t, previewSize: n } =
|
|
734
|
-
if (!t || !
|
|
735
|
-
let
|
|
754
|
+
function j() {
|
|
755
|
+
let { finderStatus: e, displayQuad: t, previewSize: n, barcodeOverlay: r } = T(), i = e?.sourceWidth ?? r?.width, a = e?.sourceHeight ?? r?.height;
|
|
756
|
+
if (!t || !i || !a) return null;
|
|
757
|
+
let o = E(i, a, n.width, n.height, "cover"), s = r ? "ready" : e?.state;
|
|
736
758
|
return /* @__PURE__ */ S("svg", {
|
|
737
|
-
className: `scanner-camera-overlay__quad ${
|
|
738
|
-
viewBox:
|
|
739
|
-
preserveAspectRatio:
|
|
740
|
-
"aria-label": `${e
|
|
759
|
+
className: `scanner-camera-overlay__quad ${s ?? ""}`.trim(),
|
|
760
|
+
viewBox: o.viewBox,
|
|
761
|
+
preserveAspectRatio: o.preserveAspectRatio,
|
|
762
|
+
"aria-label": r ? "PDF417 barcode boundary" : `${e?.state ?? "document"} document boundary`,
|
|
741
763
|
children: /* @__PURE__ */ S("polygon", { points: `${t.topLeft.x},${t.topLeft.y} ${t.topRight.x},${t.topRight.y} ${t.bottomRight.x},${t.bottomRight.y} ${t.bottomLeft.x},${t.bottomLeft.y}` })
|
|
742
764
|
});
|
|
743
765
|
}
|
|
744
|
-
function
|
|
745
|
-
let { phase: t, cancel: n, usingSystemCamera: r, useCase: i, licenseSide: a, licenseBusy: o } =
|
|
766
|
+
function M({ title: e }) {
|
|
767
|
+
let { phase: t, cancel: n, usingSystemCamera: r, useCase: i, licenseSide: a, licenseBusy: o } = T(), s = i === "drivers-license" ? m(a ?? "front", r) : void 0, c = e ?? s?.title ?? "Scan a document";
|
|
746
768
|
return /* @__PURE__ */ C("div", {
|
|
747
769
|
className: "scanner-camera-overlay__topbar",
|
|
748
770
|
children: [/* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("strong", { children: c }), /* @__PURE__ */ C("span", {
|
|
@@ -767,8 +789,8 @@ function P({ title: e }) {
|
|
|
767
789
|
})]
|
|
768
790
|
});
|
|
769
791
|
}
|
|
770
|
-
function
|
|
771
|
-
let { phase: e, error: t, diagnostics: n, copyState: r, retry: i, copyReport: a, cancel: o, usingSystemCamera: s, frozenPreviewUrl: c, useCase: l, licenseSide: u, licenseBusy: d } =
|
|
792
|
+
function N() {
|
|
793
|
+
let { phase: e, error: t, diagnostics: n, copyState: r, retry: i, copyReport: a, cancel: o, usingSystemCamera: s, frozenPreviewUrl: c, useCase: l, licenseSide: u, licenseBusy: d } = T(), f = l === "drivers-license" ? m(u ?? "front", s) : void 0;
|
|
772
794
|
return e === "error" ? /* @__PURE__ */ C("div", {
|
|
773
795
|
className: "scanner-camera-overlay__message",
|
|
774
796
|
role: "alert",
|
|
@@ -823,8 +845,8 @@ function F() {
|
|
|
823
845
|
]
|
|
824
846
|
}) : null;
|
|
825
847
|
}
|
|
826
|
-
function
|
|
827
|
-
let { finderStatus: e, detectorStatus: t, settings: n, usingSystemCamera: r, captureMethod: i, phase: a, useCase: o, licenseSide: s } =
|
|
848
|
+
function P() {
|
|
849
|
+
let { finderStatus: e, detectorStatus: t, settings: n, usingSystemCamera: r, captureMethod: i, phase: a, useCase: o, licenseSide: s } = T(), c = n?.width, l = n?.height, u = o === "drivers-license" ? ` · ${s === "back" ? "back" : "front"}` : "";
|
|
828
850
|
if (r) return /* @__PURE__ */ S("div", {
|
|
829
851
|
className: "scanner-camera-overlay__status",
|
|
830
852
|
"aria-live": "polite",
|
|
@@ -856,8 +878,8 @@ function I() {
|
|
|
856
878
|
})
|
|
857
879
|
});
|
|
858
880
|
}
|
|
859
|
-
function
|
|
860
|
-
let { diagnostics: e, shutterDiagnostics: t, captureMethod: n, copyState: i, copyReport: a } =
|
|
881
|
+
function F() {
|
|
882
|
+
let { diagnostics: e, shutterDiagnostics: t, captureMethod: n, copyState: i, copyReport: a } = T(), o = e?.engine ?? r();
|
|
861
883
|
return /* @__PURE__ */ C("dl", {
|
|
862
884
|
className: "scanner-camera-overlay__diagnostics",
|
|
863
885
|
"aria-label": "Camera diagnostics",
|
|
@@ -883,8 +905,8 @@ function L() {
|
|
|
883
905
|
]
|
|
884
906
|
});
|
|
885
907
|
}
|
|
886
|
-
function
|
|
887
|
-
let { autoCapture: e, phase: t, finderStatus: n, diagnostics: r, captureMethod: i, settings: a, cancel: o, capture: s, setAutoCapture: c, setTorch: l, usingSystemCamera: u, licenseBusy: d, useCase: f, licenseSide: p, guidanceHint: ee } =
|
|
908
|
+
function _e() {
|
|
909
|
+
let { autoCapture: e, phase: t, finderStatus: n, diagnostics: r, captureMethod: i, settings: a, cancel: o, capture: s, setAutoCapture: c, setTorch: l, usingSystemCamera: u, licenseBusy: d, useCase: f, licenseSide: p, guidanceHint: ee } = T(), h = a?.width, te = a?.height, g = u ? t === "ready" : e !== "only", _ = f === "drivers-license" ? m(p ?? "front", u) : void 0, v = D({
|
|
888
910
|
usingSystemCamera: u,
|
|
889
911
|
phase: t,
|
|
890
912
|
licenseBusy: d,
|
|
@@ -943,11 +965,11 @@ function me() {
|
|
|
943
965
|
]
|
|
944
966
|
});
|
|
945
967
|
}
|
|
946
|
-
function
|
|
947
|
-
let { modelDownload: t } =
|
|
948
|
-
return /* @__PURE__ */ S(
|
|
968
|
+
function I({ snapshot: e }) {
|
|
969
|
+
let { modelDownload: t } = T();
|
|
970
|
+
return /* @__PURE__ */ S(he, { snapshot: e ?? t });
|
|
949
971
|
}
|
|
950
972
|
//#endregion
|
|
951
|
-
export {
|
|
973
|
+
export { _e as ScannerControls, F as ScannerDiagnostics, k as ScannerFrame, I as ScannerModelDownload, N as ScannerNotice, A as ScannerPreview, pe as ScannerProvider, j as ScannerQuad, P as ScannerStatus, M as ScannerTopBar, T as useScanner, me as useScannerRef };
|
|
952
974
|
|
|
953
975
|
//# sourceMappingURL=react.js.map
|