@exige/web-scanner-sdk 0.2.36 → 0.2.37

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.
@@ -179,12 +179,12 @@ function C() {
179
179
  inflight: /* @__PURE__ */ new Map()
180
180
  }), e[S];
181
181
  }
182
- var w = C().active, T = C().listeners, E = C().cache, D = C().inflight;
183
- function ee(e) {
182
+ var w = C().active, T = C().listeners, ee = C().cache, E = C().inflight;
183
+ function te(e) {
184
184
  let t = Number(e.headers.get("content-length"));
185
185
  return Number.isFinite(t) && t > 0 ? t : null;
186
186
  }
187
- function te() {
187
+ function ne() {
188
188
  if (w.size === 0) return {
189
189
  downloading: !1,
190
190
  loaded: 0,
@@ -198,23 +198,23 @@ function te() {
198
198
  total: n ? t : null
199
199
  };
200
200
  }
201
- function ne() {
202
- let e = te();
201
+ function re() {
202
+ let e = ne();
203
203
  for (let t of T) t(e);
204
204
  }
205
- function re(e) {
206
- return e(te()), T.add(e), () => {
205
+ function ie(e) {
206
+ return e(ne()), T.add(e), () => {
207
207
  T.delete(e);
208
208
  };
209
209
  }
210
- function O(e, t) {
210
+ function ae(e, t) {
211
211
  t.done ? w.delete(e) : w.set(e, {
212
212
  loaded: t.loaded,
213
213
  total: t.total
214
- }), ne();
214
+ }), re();
215
215
  }
216
- async function ie(e, t) {
217
- let n = ee(e);
216
+ async function oe(e, t) {
217
+ let n = te(e);
218
218
  if (!e.body) {
219
219
  let r = await e.arrayBuffer();
220
220
  return t?.({
@@ -238,31 +238,31 @@ async function ie(e, t) {
238
238
  total: n
239
239
  }), o.buffer;
240
240
  }
241
- async function ae(t, n) {
242
- let r = E.get(t);
241
+ async function se(t, n) {
242
+ let r = ee.get(t);
243
243
  if (r) return r.slice(0);
244
- let i = D.get(t);
244
+ let i = E.get(t);
245
245
  if (i) return i.then((e) => e.slice(0));
246
246
  let a = (async () => {
247
- O(t, {
247
+ ae(t, {
248
248
  loaded: 0,
249
249
  total: null
250
250
  });
251
251
  let r = await fetch(t, { cache: n?.cache });
252
252
  if (!r.ok) throw new e("model-http", `Model request failed with HTTP ${r.status}.`);
253
- return ie(r, (e) => O(t, e));
253
+ return oe(r, (e) => ae(t, e));
254
254
  })();
255
- D.set(t, a);
255
+ E.set(t, a);
256
256
  try {
257
257
  let e = await a;
258
- return E.set(t, e), e.slice(0);
258
+ return ee.set(t, e), e.slice(0);
259
259
  } finally {
260
- D.delete(t), w.has(t) && (w.delete(t), ne());
260
+ E.delete(t), w.has(t) && (w.delete(t), re());
261
261
  }
262
262
  }
263
263
  //#endregion
264
264
  //#region src/sdk/camera.ts
265
- function oe(e, t) {
265
+ function ce(e, t) {
266
266
  let { engine: n } = t;
267
267
  return [
268
268
  `${e}:`,
@@ -277,9 +277,9 @@ function oe(e, t) {
277
277
  ` torch: ${t.torch.mode} supported=${t.torch.supported} on=${t.torch.on}`
278
278
  ].join("\n");
279
279
  }
280
- function se(e) {
280
+ function le(e) {
281
281
  let t = ["Exige scanner capture report", `time: ${e.capturedAt ?? (/* @__PURE__ */ new Date()).toISOString()}`];
282
- if (e.error && t.push(`error: ${e.error}`), e.captureMethod && t.push(`method: ${e.captureMethod}`), e.luminance !== void 0 && t.push(`luminance: ${e.luminance.toFixed(1)}`), e.fallbackReason && t.push(`fallback: ${e.fallbackReason}`), e.shutter && t.push(oe("shutter", e.shutter)), e.live && t.push(oe("live", e.live)), e.finder) {
282
+ if (e.error && t.push(`error: ${e.error}`), e.captureMethod && t.push(`method: ${e.captureMethod}`), e.luminance !== void 0 && t.push(`luminance: ${e.luminance.toFixed(1)}`), e.fallbackReason && t.push(`fallback: ${e.fallbackReason}`), e.shutter && t.push(ce("shutter", e.shutter)), e.live && t.push(ce("live", e.live)), e.finder) {
283
283
  let n = e.finder;
284
284
  t.push([
285
285
  "finder:",
@@ -296,7 +296,7 @@ function se(e) {
296
296
  }
297
297
  return `${t.join("\n")}\n`;
298
298
  }
299
- function k(e = typeof navigator > "u" ? "" : navigator.userAgent, t = typeof navigator > "u" ? 0 : navigator.maxTouchPoints) {
299
+ function D(e = typeof navigator > "u" ? "" : navigator.userAgent, t = typeof navigator > "u" ? 0 : navigator.maxTouchPoints) {
300
300
  let n = /CriOS|Chrome/i.test(e) ? "chrome" : /EdgiOS|Edg/i.test(e) ? "edge" : /FxiOS|Firefox/i.test(e) ? "firefox" : /Safari/i.test(e) ? "safari" : "unknown", r = /iPhone|iPad|iPod/i.test(e) || /Macintosh/i.test(e) && t > 1, i = /CriOS|EdgiOS|FxiOS|OPiOS|Mercury/i.test(e), a = r || i;
301
301
  return {
302
302
  engine: a || /AppleWebKit/i.test(e) && !/Chrome|Chromium|Edg/i.test(e) ? "webkit" : /Chrome|Chromium|Edg/i.test(e) ? "blink" : /Gecko\//i.test(e) ? "gecko" : "unknown",
@@ -305,40 +305,40 @@ function k(e = typeof navigator > "u" ? "" : navigator.userAgent, t = typeof nav
305
305
  userAgent: e
306
306
  };
307
307
  }
308
- function ce(e) {
308
+ function ue(e) {
309
309
  return /Android/i.test(e.userAgent) && !e.iosWebKit;
310
310
  }
311
- function le(e = k()) {
312
- return e.engine === "webkit" && !ce(e);
311
+ function de(e = D()) {
312
+ return e.engine === "webkit" && !ue(e);
313
313
  }
314
- function ue(e = "auto", t = k()) {
315
- return e === "system-camera" || e !== "live" && ce(t);
314
+ function fe(e = "auto", t = D()) {
315
+ return e === "system-camera" || e !== "live" && ue(t);
316
316
  }
317
- function de(e, t) {
317
+ function pe(e, t) {
318
318
  return t && !e.iosWebKit;
319
319
  }
320
- function fe(e, t) {
320
+ function me(e, t) {
321
321
  if (!e || !Number.isFinite(e)) return;
322
322
  let n = t?.max;
323
323
  if (!n || !Number.isFinite(n)) return Math.round(e);
324
324
  let r = t?.min && Number.isFinite(t.min) ? t.min : 1, i = t?.step && t.step > 0 ? t.step : 1, a = r + Math.round((Math.min(n, Math.max(r, e)) - r) / i) * i;
325
325
  return Math.round(Math.min(n, Math.max(r, a)));
326
326
  }
327
- function pe(e) {
328
- let t = fe(e?.imageWidth?.max ?? 0, e?.imageWidth), n = fe(e?.imageHeight?.max ?? 0, e?.imageHeight);
327
+ function he(e) {
328
+ let t = me(e?.imageWidth?.max ?? 0, e?.imageWidth), n = me(e?.imageHeight?.max ?? 0, e?.imageHeight);
329
329
  if (t && n) return t >= n ? { imageWidth: t } : { imageHeight: n };
330
330
  if (t) return { imageWidth: t };
331
331
  if (n) return { imageHeight: n };
332
332
  }
333
- function me(e, t) {
333
+ function ge(e, t) {
334
334
  return !e.width || !e.height || !t.width || !t.height ? !1 : e.width * e.height > t.width * t.height * 1.15;
335
335
  }
336
- function he(e, t) {
336
+ function _e(e, t) {
337
337
  if (!e.width || !e.height || !t.width || !t.height) return !1;
338
338
  let n = e.width / e.height / (t.width / t.height);
339
339
  return n > .97 && n < 1.03;
340
340
  }
341
- var ge = 10, _e = class {
341
+ var ve = 10, ye = class {
342
342
  on = !1;
343
343
  darkCount = 0;
344
344
  brightCount = 0;
@@ -361,7 +361,7 @@ var ge = 10, _e = class {
361
361
  return this.on;
362
362
  }
363
363
  };
364
- function ve(e, t) {
364
+ function be(e, t) {
365
365
  return t ? e === "alwaysOn" || e === "alwaysOff" ? {
366
366
  mode: e,
367
367
  supported: !0,
@@ -385,37 +385,40 @@ function ve(e, t) {
385
385
  automatic: e === "auto"
386
386
  };
387
387
  }
388
- function ye(e) {
388
+ function O(e) {
389
389
  let t = Math.floor(e.length / 4);
390
390
  if (!t) return 0;
391
391
  let n = 0;
392
392
  for (let r = 0; r < t * 4; r += 4) n += e[r] * .299 + e[r + 1] * .587 + e[r + 2] * .114;
393
393
  return n / t;
394
394
  }
395
- function be(e, t = 10) {
395
+ function k(e) {
396
+ return !e.width || !e.height || Se(e, e.width, e.height) <= 10;
397
+ }
398
+ function xe(e, t = 10) {
396
399
  if (e.length < 4) return !0;
397
400
  let n = Math.floor(e.length / 4), r = 0;
398
401
  for (let i = 0; i < n * 4; i += 4) e[i] * .299 + e[i + 1] * .587 + e[i + 2] * .114 > t * 2 && (r += 1);
399
- return ye(e) <= t && r / n < .01;
402
+ return O(e) <= t && r / n < .01;
400
403
  }
401
- function xe(e, t, n) {
404
+ function Se(e, t, n) {
402
405
  if (!t || !n) return 0;
403
406
  let r = document.createElement("canvas");
404
407
  r.width = Math.min(32, t), r.height = Math.min(32, n);
405
408
  let i = r.getContext("2d", { willReadFrequently: !0 });
406
- return i ? (i.drawImage(e, 0, 0, r.width, r.height), ye(i.getImageData(0, 0, r.width, r.height).data)) : 0;
409
+ return i ? (i.drawImage(e, 0, 0, r.width, r.height), O(i.getImageData(0, 0, r.width, r.height).data)) : 0;
407
410
  }
408
- function Se(e) {
409
- return xe(e, e.width, e.height);
411
+ function Ce(e) {
412
+ return Se(e, e.width, e.height);
410
413
  }
411
- function Ce(e, t = 120) {
414
+ function we(e, t = 120) {
412
415
  let n = document.createElement("canvas"), r = n.getContext("2d"), i = typeof e.requestVideoFrameCallback == "function", a = !0, o = 0, s = 0, c = 0, l = 0, u = 0, d = () => {
413
416
  a && (o = i ? e.requestVideoFrameCallback(f) : requestAnimationFrame(f));
414
417
  };
415
418
  function f() {
416
419
  if (!a) return;
417
420
  let { videoWidth: i, videoHeight: o } = e, f = performance.now();
418
- r && i && o && f - s >= t && (s = f, l = xe(e, i, o), l > 10 && ((n.width !== i || n.height !== o) && (n.width = i, n.height = o), r.drawImage(e, 0, 0, i, o), u = l, c = f)), d();
421
+ r && i && o && f - s >= t && (s = f, l = Se(e, i, o), l > 10 && ((n.width !== i || n.height !== o) && (n.width = i, n.height = o), r.drawImage(e, 0, 0, i, o), u = l, c = f)), d();
419
422
  }
420
423
  return d(), {
421
424
  stop() {
@@ -427,14 +430,34 @@ function Ce(e, t = 120) {
427
430
  getMirrorAgeMs: () => c ? performance.now() - c : Infinity
428
431
  };
429
432
  }
430
- function we(e) {
433
+ function Te(e) {
431
434
  let t = document.createElement("canvas");
432
435
  return t.width = e.width, t.height = e.height, t.getContext("2d")?.drawImage(e, 0, 0), t;
433
436
  }
434
- function Te(e) {
437
+ function Ee(e, n) {
438
+ let r = j(e.width, e.height, n);
439
+ if (r.width === e.width && r.height === e.height) return Te(e);
440
+ let i = document.createElement("canvas");
441
+ i.width = r.width, i.height = r.height;
442
+ let a = i.getContext("2d");
443
+ if (!a) throw t();
444
+ return a.imageSmoothingEnabled = !0, "imageSmoothingQuality" in a && (a.imageSmoothingQuality = "high"), a.drawImage(e, 0, 0, i.width, i.height), i;
445
+ }
446
+ function De(e, t, n) {
447
+ try {
448
+ let t = M(e, n);
449
+ if (!k(t)) return t;
450
+ } catch {}
451
+ let r = t.getFrame();
452
+ if (!r) throw Error("The camera is not ready to capture a frame.");
453
+ let i = Ee(r, n);
454
+ if (k(i)) throw Error("The camera preview produced no visible pixels.");
455
+ return i;
456
+ }
457
+ function Oe(e) {
435
458
  return e.engine === "blink";
436
459
  }
437
- function A(e = {}, t = k()) {
460
+ function A(e = {}, t = D()) {
438
461
  let n = { ideal: e.idealWidth ?? 3840 }, r = { ideal: e.idealHeight ?? 2160 };
439
462
  e.maxWidth && (n.max = e.maxWidth), e.maxHeight && (r.max = e.maxHeight);
440
463
  let i = {
@@ -446,20 +469,20 @@ function A(e = {}, t = k()) {
446
469
  max: e.maxFrameRate ?? 30
447
470
  }
448
471
  };
449
- return Te(t) && (i.resizeMode = { ideal: "none" }), {
472
+ return Oe(t) && (i.resizeMode = { ideal: "none" }), {
450
473
  audio: !1,
451
474
  video: i
452
475
  };
453
476
  }
454
- function Ee(e, t, n) {
477
+ function j(e, t, n) {
455
478
  let r = n ? Math.min(1, n / Math.max(e, t)) : 1;
456
479
  return {
457
480
  width: Math.max(1, Math.round(e * r)),
458
481
  height: Math.max(1, Math.round(t * r))
459
482
  };
460
483
  }
461
- var De = 4096;
462
- function Oe(e, t) {
484
+ var ke = 4096;
485
+ function Ae(e, t) {
463
486
  let n = e.width, r = e.height, i = t?.width?.max, a = t?.height?.max;
464
487
  if (!n || !r || !i || !a) return;
465
488
  let o = Math.min(i / n, a / r);
@@ -468,13 +491,13 @@ function Oe(e, t) {
468
491
  height: { ideal: Math.round(r * o) }
469
492
  };
470
493
  }
471
- async function ke(e) {
472
- let t = Oe(e.getSettings(), typeof e.getCapabilities == "function" ? e.getCapabilities() : void 0);
494
+ async function je(e) {
495
+ let t = Ae(e.getSettings(), typeof e.getCapabilities == "function" ? e.getCapabilities() : void 0);
473
496
  if (t) try {
474
497
  await e.applyConstraints(t);
475
498
  } catch {}
476
499
  }
477
- async function Ae(e) {
500
+ async function Me(e) {
478
501
  try {
479
502
  return await createImageBitmap(e, {
480
503
  imageOrientation: "from-image",
@@ -484,7 +507,7 @@ async function Ae(e) {
484
507
  return await createImageBitmap(e);
485
508
  }
486
509
  }
487
- async function je(e) {
510
+ async function Ne(e) {
488
511
  try {
489
512
  await e.applyConstraints({ advanced: [{ pointsOfInterest: [{
490
513
  x: .5,
@@ -492,25 +515,25 @@ async function je(e) {
492
515
  }] }] }), await new Promise((e) => window.setTimeout(e, 180));
493
516
  } catch {}
494
517
  }
495
- async function Me(e) {
496
- let n = await Ae(e), r = Ee(n.width, n.height, De), i = document.createElement("canvas");
518
+ async function Pe(e) {
519
+ let n = await Me(e), r = j(n.width, n.height, ke), i = document.createElement("canvas");
497
520
  i.width = r.width, i.height = r.height;
498
521
  let a = i.getContext("2d");
499
522
  if (!a) throw n.close?.(), t();
500
523
  return a.imageSmoothingEnabled = r.width !== n.width || r.height !== n.height, a.imageSmoothingQuality = "high", a.drawImage(n, 0, 0, i.width, i.height), n.close?.(), i;
501
524
  }
502
- async function Ne(e) {
525
+ async function Fe(e) {
503
526
  let t = globalThis.ImageCapture;
504
527
  if (!t) return;
505
- await je(e);
506
- let n = new t(e), r = n.getPhotoCapabilities ? await n.getPhotoCapabilities() : void 0, i = pe(r), a;
528
+ await Ne(e);
529
+ let n = new t(e), r = n.getPhotoCapabilities ? await n.getPhotoCapabilities() : void 0, i = he(r), a;
507
530
  try {
508
531
  a = await n.takePhoto(i);
509
532
  } catch {
510
533
  a = await n.takePhoto();
511
534
  }
512
535
  return {
513
- frame: await Me(a),
536
+ frame: await Pe(a),
514
537
  requested: i,
515
538
  photoMax: {
516
539
  width: r?.imageWidth?.max,
@@ -518,16 +541,16 @@ async function Ne(e) {
518
541
  }
519
542
  };
520
543
  }
521
- function j(e, n) {
544
+ function M(e, n) {
522
545
  if (!e.videoWidth || !e.videoHeight) throw Error("The camera is not ready to capture a frame.");
523
- let r = Ee(e.videoWidth, e.videoHeight, n), i = document.createElement("canvas");
546
+ let r = j(e.videoWidth, e.videoHeight, n), i = document.createElement("canvas");
524
547
  i.width = r.width, i.height = r.height;
525
548
  let a = i.getContext("2d");
526
549
  if (!a) throw t();
527
550
  return a.drawImage(e, 0, 0, i.width, i.height), i;
528
551
  }
529
- function Pe(e) {
530
- let t = k();
552
+ function Ie(e) {
553
+ let t = D();
531
554
  return e.idealWidth || e.idealHeight || e.maxWidth || e.maxHeight ? [A(e, t)] : [
532
555
  A({
533
556
  ...e,
@@ -546,14 +569,14 @@ function Pe(e) {
546
569
  }, t)
547
570
  ];
548
571
  }
549
- async function Fe(t, n = {}) {
572
+ async function Le(t, n = {}) {
550
573
  await x("scan");
551
574
  let r = n.torch ?? "alwaysOff";
552
575
  if (r !== "alwaysOff" && await x("torch"), !window.isSecureContext && location.hostname !== "localhost") throw new e("secure-context", "Camera access requires HTTPS.");
553
576
  if (!navigator.mediaDevices?.getUserMedia) throw Error("Live camera access is unavailable. Use the native camera picker instead.");
554
577
  t.muted = !0, t.autoplay = !0, t.playsInline = !0, t.setAttribute("playsinline", "");
555
578
  let i, a;
556
- for (let e of Pe(n)) try {
579
+ for (let e of Ie(n)) try {
557
580
  i = await navigator.mediaDevices.getUserMedia(e);
558
581
  break;
559
582
  } catch (e) {
@@ -566,8 +589,8 @@ async function Fe(t, n = {}) {
566
589
  for (let e of i.getTracks()) e.stop();
567
590
  throw Error("The camera did not provide a video track.");
568
591
  }
569
- await ke(o);
570
- let s = Ce(t), c = "ImageCapture" in globalThis, l = ve(r, (typeof o.getCapabilities == "function" ? o.getCapabilities() : void 0)?.torch === !0), u = !1, d = async (e) => {
592
+ await je(o);
593
+ let s = we(t), c = "ImageCapture" in globalThis, l = be(r, (typeof o.getCapabilities == "function" ? o.getCapabilities() : void 0)?.torch === !0), u = !1, d = async (e) => {
571
594
  if (!l.supported || o.readyState !== "live") return !1;
572
595
  try {
573
596
  return await o.applyConstraints({ advanced: [{ torch: e }] }), l = {
@@ -585,7 +608,7 @@ async function Fe(t, n = {}) {
585
608
  }
586
609
  };
587
610
  l.on && await d(!0);
588
- let f = r === "auto" && l.supported ? new _e() : void 0, p = f ? window.setInterval(() => {
611
+ let f = r === "auto" && l.supported ? new ye() : void 0, p = f ? window.setInterval(() => {
589
612
  if (u || !l.supported) return;
590
613
  let e = f.update(s.getLiveLuminance());
591
614
  e !== void 0 && e !== l.on && (u = !0, d(e).finally(() => {
@@ -611,7 +634,7 @@ async function Fe(t, n = {}) {
611
634
  torchSupported: l.supported,
612
635
  torchOn: l.on,
613
636
  torch: { ...l },
614
- engine: k()
637
+ engine: D()
615
638
  };
616
639
  };
617
640
  return {
@@ -625,17 +648,34 @@ async function Fe(t, n = {}) {
625
648
  get torchOn() {
626
649
  return l.on;
627
650
  },
628
- capture: (e) => j(t, e),
651
+ capture: (e) => De(t, s, e),
652
+ async captureLiveFrame(e) {
653
+ let n = globalThis.ImageCapture;
654
+ if (n) try {
655
+ let t = await new n(o).grabFrame?.();
656
+ if (t) {
657
+ let n = j(t.width, t.height, e), r = document.createElement("canvas");
658
+ r.width = n.width, r.height = n.height;
659
+ let i = r.getContext("2d");
660
+ if (i && (i.imageSmoothingEnabled = !0, "imageSmoothingQuality" in i && (i.imageSmoothingQuality = "high"), i.drawImage(t, 0, 0, r.width, r.height)), t.close?.(), r.width && !k(r)) return r;
661
+ }
662
+ } catch {}
663
+ try {
664
+ return De(t, s, e);
665
+ } catch {
666
+ return;
667
+ }
668
+ },
629
669
  async capturePhoto() {
630
670
  let e, n = 0;
631
671
  try {
632
- e = j(t), n = Se(e);
672
+ e = M(t), n = Ce(e);
633
673
  } catch {
634
674
  e = void 0;
635
675
  }
636
676
  let r = s.getFrame(), i, a = !1, l = !1, u, d;
637
- if (de(k(), c)) try {
638
- let e = await Ne(o);
677
+ if (pe(D(), c)) try {
678
+ let e = await Fe(o);
639
679
  i = e?.frame, u = e?.requested, d = e?.photoMax;
640
680
  } catch {
641
681
  a = !0, i = void 0;
@@ -643,14 +683,14 @@ async function Fe(t, n = {}) {
643
683
  let f = {
644
684
  width: t.videoWidth,
645
685
  height: t.videoHeight
646
- }, p = i ? Se(i) : 0, h = !!(i && p > 10 && me(i, f));
686
+ }, p = i ? Ce(i) : 0, h = !!(i && p > 10 && ge(i, f));
647
687
  if (i && p > 10 && !h && (l = !0), h && i) return console.info("[exige-scanner] capture", {
648
688
  method: "image-capture",
649
689
  frame: `${i.width}×${i.height}`,
650
690
  video: `${t.videoWidth}×${t.videoHeight}`,
651
691
  photoMax: d ? `${d.width ?? "—"}×${d.height ?? "—"}` : void 0,
652
692
  photoRequest: u,
653
- aspectMatch: he(i, f)
693
+ aspectMatch: _e(i, f)
654
694
  }), {
655
695
  frame: i,
656
696
  method: "image-capture",
@@ -658,7 +698,7 @@ async function Fe(t, n = {}) {
658
698
  luminance: p,
659
699
  diagnostics: m()
660
700
  };
661
- let g = e && n > 10 ? e : void 0, _ = g ?? (r ? we(r) : void 0);
701
+ let g = e && n > 10 ? e : void 0, _ = g ?? (r ? Te(r) : void 0);
662
702
  if (!_) throw Error("The camera preview produced no visible pixels. Keep the scanner on screen, wait for the preview, and retake.");
663
703
  let v = l ? "image-capture-preview-size" : i ? "image-capture-empty" : a ? "image-capture-failed" : g ? void 0 : "video-frame-empty";
664
704
  return console.info("[exige-scanner] capture", {
@@ -690,13 +730,13 @@ async function Fe(t, n = {}) {
690
730
  }
691
731
  };
692
732
  }
693
- function Ie() {
733
+ function Re() {
694
734
  let e = typeof navigator > "u" ? void 0 : navigator.userActivation;
695
735
  return !e || e.isActive;
696
736
  }
697
- async function Le() {
737
+ async function ze() {
698
738
  let e = document.createElement("input");
699
- return e.type = "file", e.accept = "image/*", e.capture = "environment", e.setAttribute("capture", "environment"), Me(await new Promise((t, n) => {
739
+ return e.type = "file", e.accept = "image/*", e.capture = "environment", e.setAttribute("capture", "environment"), Pe(await new Promise((t, n) => {
700
740
  e.addEventListener("change", () => {
701
741
  let r = e.files?.[0];
702
742
  r ? t(r) : n(/* @__PURE__ */ Error("No photo was selected."));
@@ -707,20 +747,20 @@ async function Le() {
707
747
  }
708
748
  //#endregion
709
749
  //#region src/sdk/ort-cdn.ts
710
- var Re = "1.30.0";
711
- `${Re}`, `${Re}`;
712
- function ze(e) {
750
+ var Be = "1.30.0";
751
+ `${Be}`, `${Be}`;
752
+ function Ve(e) {
713
753
  return !e.ok && e.status !== 206 ? !1 : !(e.headers.get("content-type") ?? "").toLowerCase().includes("text/html");
714
754
  }
715
- async function Be(e, t = fetch) {
755
+ async function He(e, t = fetch) {
716
756
  if (!e) return !1;
717
757
  try {
718
758
  let n = await t(e, { method: "HEAD" });
719
- if (ze(n)) return !0;
759
+ if (Ve(n)) return !0;
720
760
  if (n.status === 404 || n.status === 410) return !1;
721
761
  } catch {}
722
762
  try {
723
- return ze(await t(e, {
763
+ return Ve(await t(e, {
724
764
  method: "GET",
725
765
  headers: { Range: "bytes=0-63" }
726
766
  }));
@@ -730,29 +770,29 @@ async function Be(e, t = fetch) {
730
770
  }
731
771
  //#endregion
732
772
  //#region src/sdk/ort-runtime.ts
733
- var Ve = new URL("./assets/ort-wasm-simd-threaded.jsep.wasm", import.meta.url), He = new URL("./assets/ort-wasm-simd-threaded.jsep.mjs", import.meta.url);
734
- function Ue() {
773
+ var Ue = new URL("./assets/ort-wasm-simd-threaded.jsep.wasm", import.meta.url), We = new URL("./assets/ort-wasm-simd-threaded.jsep.mjs", import.meta.url);
774
+ function Ge() {
735
775
  return {
736
- wasm: Ve.href,
737
- mjs: He.href
776
+ wasm: Ue.href,
777
+ mjs: We.href
738
778
  };
739
779
  }
740
- function We(e) {
741
- return typeof e == "string" ? e.trim() || Ue() : e?.wasm.trim() && e.mjs.trim() ? {
780
+ function Ke(e) {
781
+ return typeof e == "string" ? e.trim() || Ge() : e?.wasm.trim() && e.mjs.trim() ? {
742
782
  wasm: e.wasm.trim(),
743
783
  mjs: e.mjs.trim()
744
- } : Ue();
784
+ } : Ge();
745
785
  }
746
786
  //#endregion
747
787
  //#region src/sdk/image.ts
748
- function Ge(e, t, n) {
788
+ function qe(e, t, n) {
749
789
  let r = n ? Math.min(1, n / Math.max(e, t)) : 1;
750
790
  return {
751
791
  width: Math.max(1, Math.round(e * r)),
752
792
  height: Math.max(1, Math.round(t * r))
753
793
  };
754
794
  }
755
- async function Ke(e) {
795
+ async function Je(e) {
756
796
  let t = URL.createObjectURL(e);
757
797
  try {
758
798
  let e = new Image();
@@ -761,26 +801,26 @@ async function Ke(e) {
761
801
  URL.revokeObjectURL(t);
762
802
  }
763
803
  }
764
- async function M(e, n = {}) {
804
+ async function N(e, n = {}) {
765
805
  if (e instanceof HTMLCanvasElement && n.cloneCanvas === !1 && !n.maxDimension) return e;
766
806
  let r = document.createElement("canvas"), i = r.getContext("2d", { willReadFrequently: !0 });
767
807
  if (!i) throw t();
768
808
  if (e instanceof Blob) {
769
809
  if ("createImageBitmap" in window) try {
770
- let t = await createImageBitmap(e), a = Ge(t.width, t.height, n.maxDimension);
810
+ let t = await createImageBitmap(e), a = qe(t.width, t.height, n.maxDimension);
771
811
  return r.width = a.width, r.height = a.height, i.drawImage(t, 0, 0, a.width, a.height), t.close(), r;
772
812
  } catch {}
773
- e = await Ke(e);
813
+ e = await Je(e);
774
814
  }
775
815
  let a = e instanceof HTMLImageElement ? e.naturalWidth : e.width, o = e instanceof HTMLImageElement ? e.naturalHeight : e.height;
776
816
  if (!a || !o) throw Error("The image has no readable dimensions.");
777
- let s = Ge(a, o, n.maxDimension);
817
+ let s = qe(a, o, n.maxDimension);
778
818
  return r.width = s.width, r.height = s.height, i.drawImage(e, 0, 0, s.width, s.height), r;
779
819
  }
780
- function qe(e, t = "image/png", n = .92) {
820
+ function Ye(e, t = "image/png", n = .92) {
781
821
  return new Promise((r, i) => e.toBlob((e) => e ? r(e) : i(/* @__PURE__ */ Error("Could not encode the image.")), t, n));
782
822
  }
783
- function Je(e, t, n) {
823
+ function Xe(e, t, n) {
784
824
  let r = Math.max(0, Math.min(t, e.x)), i = Math.max(0, Math.min(n, e.y));
785
825
  return {
786
826
  x: r,
@@ -791,20 +831,20 @@ function Je(e, t, n) {
791
831
  }
792
832
  //#endregion
793
833
  //#region src/sdk/scan.ts
794
- var Ye = "https://exige-scanner-sdk.vercel.app/models/docaligner-lcnet100-f4117b78.onnx", Xe = 1280;
795
- function Ze(e, t, n) {
834
+ var Ze = "https://exige-scanner-sdk.vercel.app/models/docaligner-lcnet100-f4117b78.onnx", Qe = 1280;
835
+ function $e(e, t, n) {
796
836
  if (n) return n;
797
- let r = Math.max(e, t), i = r / Math.max(1, Math.min(e, t)), a = rt() ? 560 : 900;
798
- return i >= 1.6 ? Math.min(r, Math.max(a, Xe)) : a;
837
+ let r = Math.max(e, t), i = r / Math.max(1, Math.min(e, t)), a = at() ? 560 : 900;
838
+ return i >= 1.6 ? Math.min(r, Math.max(a, Qe)) : a;
799
839
  }
800
- function Qe(e) {
840
+ function et(e) {
801
841
  return e?.trim() || "https://exige-scanner-sdk.vercel.app/models/docaligner-lcnet100-f4117b78.onnx";
802
842
  }
803
- var $e = 3, N, et = 0, P = /* @__PURE__ */ new Map();
804
- function F(e, t) {
843
+ var tt = 3, P, nt = 0, F = /* @__PURE__ */ new Map();
844
+ function I(e, t) {
805
845
  return Math.hypot(e.x - t.x, e.y - t.y);
806
846
  }
807
- function tt(e) {
847
+ function rt(e) {
808
848
  return {
809
849
  ...e,
810
850
  edges: {
@@ -827,7 +867,7 @@ function tt(e) {
827
867
  }
828
868
  };
829
869
  }
830
- function nt(e, t) {
870
+ function it(e, t) {
831
871
  let n = (e) => ({
832
872
  x: e.x / t,
833
873
  y: e.y / t
@@ -839,43 +879,43 @@ function nt(e, t) {
839
879
  bottomLeft: n(e.bottomLeft)
840
880
  };
841
881
  }
842
- function rt() {
882
+ function at() {
843
883
  return typeof navigator > "u" ? !1 : navigator.maxTouchPoints > 0 || navigator.hardwareConcurrency <= 4 || typeof matchMedia == "function" && matchMedia("(pointer: coarse)").matches;
844
884
  }
845
- function it(t, n, r, i) {
885
+ function ot(t, n, r, i) {
846
886
  return new Promise((a, o) => {
847
- N || (N = new Worker(new URL("./assets/document-worker.js", import.meta.url), { type: "module" }), N.onmessage = (t) => {
887
+ P || (P = new Worker(new URL("./assets/document-worker.js", import.meta.url), { type: "module" }), P.onmessage = (t) => {
848
888
  if (t.data.download?.url) {
849
- O(t.data.download.url, t.data.download);
889
+ ae(t.data.download.url, t.data.download);
850
890
  return;
851
891
  }
852
- let n = P.get(t.data.id);
853
- n && (P.delete(t.data.id), t.data.error ? n.reject(t.data.errorCode ? new e(t.data.errorCode, t.data.error) : Error(t.data.error)) : t.data.result ? n.resolve(t.data.result) : n.reject(/* @__PURE__ */ Error("The document worker returned no result.")));
854
- }, N.onerror = () => {
892
+ let n = F.get(t.data.id);
893
+ n && (F.delete(t.data.id), t.data.error ? n.reject(t.data.errorCode ? new e(t.data.errorCode, t.data.error) : Error(t.data.error)) : t.data.result ? n.resolve(t.data.result) : n.reject(/* @__PURE__ */ Error("The document worker returned no result.")));
894
+ }, P.onerror = () => {
855
895
  let t = new e("worker", "The document worker could not start.");
856
- for (let e of P.values()) e.reject(t);
857
- P.clear(), N?.terminate(), N = void 0;
896
+ for (let e of F.values()) e.reject(t);
897
+ F.clear(), P?.terminate(), P = void 0;
858
898
  });
859
- let s = ++et;
860
- P.set(s, {
899
+ let s = ++nt;
900
+ F.set(s, {
861
901
  resolve: a,
862
902
  reject: o
863
903
  });
864
904
  let c = t.slice().buffer;
865
- N.postMessage({
905
+ P.postMessage({
866
906
  id: s,
867
907
  pixels: c,
868
908
  width: n,
869
909
  height: r,
870
- modelUrl: Qe(i.modelUrl),
910
+ modelUrl: et(i.modelUrl),
871
911
  heatmapThreshold: i.heatmapThreshold,
872
912
  cacheModel: i.cacheModel,
873
- ortWasmPaths: We(i.ortWasmPaths),
874
- preferWebGpu: i.preferWebGpu ?? le()
913
+ ortWasmPaths: Ke(i.ortWasmPaths),
914
+ preferWebGpu: i.preferWebGpu ?? de()
875
915
  }, [c]);
876
916
  });
877
917
  }
878
- async function at(n, r) {
918
+ async function st(n, r) {
879
919
  let { width: i, height: a } = n, o = r.minDimension ?? 360;
880
920
  if (Math.min(i, a) < o) return {
881
921
  status: "low-quality",
@@ -884,7 +924,7 @@ async function at(n, r) {
884
924
  sourceWidth: i,
885
925
  sourceHeight: a
886
926
  };
887
- let s = Ze(i, a, r.maxAnalysisDimension), c = Math.min(1, s / Math.max(i, a)), l = Math.max(1, Math.round(i * c)), u = Math.max(1, Math.round(a * c)), d;
927
+ let s = $e(i, a, r.maxAnalysisDimension), c = Math.min(1, s / Math.max(i, a)), l = Math.max(1, Math.round(i * c)), u = Math.max(1, Math.round(a * c)), d;
888
928
  if (c === 1) {
889
929
  let e = n.getContext("2d", { willReadFrequently: !0 });
890
930
  if (!e) throw t();
@@ -898,7 +938,7 @@ async function at(n, r) {
898
938
  }
899
939
  let f;
900
940
  if (r.useWorker !== !1 && typeof Worker < "u") try {
901
- f = await it(d, l, u, r);
941
+ f = await ot(d, l, u, r);
902
942
  } catch (t) {
903
943
  if (t instanceof e && (t.code === "worker" || t.code === "model-http")) throw t;
904
944
  f = {
@@ -922,7 +962,7 @@ async function at(n, r) {
922
962
  modelNote: y,
923
963
  inferenceMs: b
924
964
  };
925
- if (p < $e) return {
965
+ if (p < tt) return {
926
966
  status: "low-quality",
927
967
  confidence: Math.min(.3, p / 18),
928
968
  message: "The image is too soft or dark to resolve four document edges.",
@@ -938,7 +978,7 @@ async function at(n, r) {
938
978
  sourceHeight: a,
939
979
  ...x
940
980
  };
941
- let S = nt(m.corners, c), C = tt(S), w = r.minConfidence ?? .58;
981
+ let S = it(m.corners, c), C = rt(S), w = r.minConfidence ?? .58;
942
982
  return m.confidence < w ? {
943
983
  status: "low-confidence",
944
984
  quad: C,
@@ -959,14 +999,14 @@ async function at(n, r) {
959
999
  ...x
960
1000
  };
961
1001
  }
962
- function ot(e, t) {
963
- let n = Math.max(1, Math.round(Math.max(F(e.topLeft, e.topRight), F(e.bottomLeft, e.bottomRight)))), r = Math.max(1, Math.round(Math.max(F(e.topLeft, e.bottomLeft), F(e.topRight, e.bottomRight)))), i = Math.min(1, t / Math.max(n, r));
1002
+ function ct(e, t) {
1003
+ let n = Math.max(1, Math.round(Math.max(I(e.topLeft, e.topRight), I(e.bottomLeft, e.bottomRight)))), r = Math.max(1, Math.round(Math.max(I(e.topLeft, e.bottomLeft), I(e.topRight, e.bottomRight)))), i = Math.min(1, t / Math.max(n, r));
964
1004
  return {
965
1005
  width: Math.max(1, Math.round(n * i)),
966
1006
  height: Math.max(1, Math.round(r * i))
967
1007
  };
968
1008
  }
969
- function st(e, t, n, r, i) {
1009
+ function lt(e, t, n, r, i) {
970
1010
  let a = Math.max(0, Math.min(t - 1, r)), o = Math.max(0, Math.min(n - 1, i)), s = Math.floor(a), c = Math.floor(o), l = Math.min(t - 1, s + 1), u = Math.min(n - 1, c + 1), d = a - s, f = o - c, p = c * t, m = u * t, h = (t) => {
971
1011
  let n = e[(p + s) * 4 + t] * (1 - d) + e[(p + l) * 4 + t] * d, r = e[(m + s) * 4 + t] * (1 - d) + e[(m + l) * 4 + t] * d;
972
1012
  return Math.round(n * (1 - f) + r * f);
@@ -978,69 +1018,69 @@ function st(e, t, n, r, i) {
978
1018
  255
979
1019
  ];
980
1020
  }
981
- function ct(e, n, r) {
982
- let { width: i, height: a } = ot(n, r), o = e.getContext("2d", { willReadFrequently: !0 });
1021
+ function ut(e, n, r) {
1022
+ let { width: i, height: a } = ct(n, r), o = e.getContext("2d", { willReadFrequently: !0 });
983
1023
  if (!o) throw t();
984
1024
  let s = o.getImageData(0, 0, e.width, e.height), c = document.createElement("canvas");
985
1025
  c.width = i, c.height = a;
986
1026
  let l = c.getContext("2d");
987
1027
  if (!l) throw t();
988
- let u = l.createImageData(i, a), { topLeft: d, topRight: f, bottomRight: p, bottomLeft: m } = n, h = f.x - p.x, g = m.x - p.x, _ = f.y - p.y, v = m.y - p.y, y = d.x - f.x + p.x - m.x, b = d.y - f.y + p.y - m.y, x = h * v - g * _, S = Math.abs(x) < 1e-4 ? 0 : (y * v - g * b) / x, C = Math.abs(x) < 1e-4 ? 0 : (h * b - y * _) / x, w = f.x - d.x + S * f.x, T = m.x - d.x + C * m.x, E = f.y - d.y + S * f.y, D = m.y - d.y + C * m.y;
1028
+ let u = l.createImageData(i, a), { topLeft: d, topRight: f, bottomRight: p, bottomLeft: m } = n, h = f.x - p.x, g = m.x - p.x, _ = f.y - p.y, v = m.y - p.y, y = d.x - f.x + p.x - m.x, b = d.y - f.y + p.y - m.y, x = h * v - g * _, S = Math.abs(x) < 1e-4 ? 0 : (y * v - g * b) / x, C = Math.abs(x) < 1e-4 ? 0 : (h * b - y * _) / x, w = f.x - d.x + S * f.x, T = m.x - d.x + C * m.x, ee = f.y - d.y + S * f.y, E = m.y - d.y + C * m.y;
989
1029
  for (let t = 0; t < a; t += 1) {
990
1030
  let n = t / Math.max(1, a - 1);
991
1031
  for (let r = 0; r < i; r += 1) {
992
- let a = r / Math.max(1, i - 1), o = S * a + C * n + 1, c = (w * a + T * n + d.x) / o, l = (E * a + D * n + d.y) / o, [f, p, m, h] = st(s.data, e.width, e.height, c, l), g = (t * i + r) * 4;
1032
+ let a = r / Math.max(1, i - 1), o = S * a + C * n + 1, c = (w * a + T * n + d.x) / o, l = (ee * a + E * n + d.y) / o, [f, p, m, h] = lt(s.data, e.width, e.height, c, l), g = (t * i + r) * 4;
993
1033
  u.data[g] = f, u.data[g + 1] = p, u.data[g + 2] = m, u.data[g + 3] = h;
994
1034
  }
995
1035
  }
996
1036
  return l.putImageData(u, 0, 0), c;
997
1037
  }
998
- async function lt(e, t = {}) {
999
- return await x("scan"), at(await M(e, { cloneCanvas: !1 }), t);
1038
+ async function dt(e, t = {}) {
1039
+ return await x("scan"), st(await N(e, { cloneCanvas: !1 }), t);
1000
1040
  }
1001
- async function ut(e, t, n = {}) {
1041
+ async function ft(e, t, n = {}) {
1002
1042
  await x("scan");
1003
- let r = await M(e, { cloneCanvas: !1 }), i = n.maxOutputDimension ?? 4096;
1043
+ let r = await N(e, { cloneCanvas: !1 }), i = n.maxOutputDimension ?? 4096;
1004
1044
  return {
1005
1045
  status: "success",
1006
1046
  corners: t,
1007
- quad: tt(t),
1047
+ quad: rt(t),
1008
1048
  confidence: 1,
1009
1049
  message: "Captured with the document edges shown in the finder.",
1010
1050
  sourceWidth: r.width,
1011
1051
  sourceHeight: r.height,
1012
- canvas: ct(r, t, i)
1052
+ canvas: ut(r, t, i)
1013
1053
  };
1014
1054
  }
1015
- async function I(e, t = {}) {
1055
+ async function L(e, t = {}) {
1016
1056
  await x("scan");
1017
- let n = await M(e, { cloneCanvas: !1 }), r = await at(n, t);
1057
+ let n = await N(e, { cloneCanvas: !1 }), r = await st(n, t);
1018
1058
  if (r.status !== "success" || !r.corners) return r;
1019
1059
  let i = t.maxOutputDimension ?? 4096;
1020
1060
  return {
1021
1061
  ...r,
1022
- canvas: ct(n, r.corners, i),
1062
+ canvas: ut(n, r.corners, i),
1023
1063
  message: "Four document edges detected and perspective-corrected."
1024
1064
  };
1025
1065
  }
1026
- function dt(e) {
1066
+ function pt(e) {
1027
1067
  return e.status === "success" ? e.message : e.status === "low-quality" ? e.message.includes("shortest side") ? `${e.message} Take another photo.` : "That photo is too soft or dark to find a document. Take another photo in better light." : e.status === "low-confidence" ? "The page edges were not clear enough to crop. Take another photo with the whole page in frame." : `No document was found in that photo. Take another photo with the whole page in frame.${e.modelStatus === "failed" && e.modelError ? ` (${e.modelError})` : ""}`;
1028
1068
  }
1029
- async function ft(e, t = {}) {
1030
- let n = await I(e, t);
1069
+ async function mt(e, t = {}) {
1070
+ let n = await L(e, t);
1031
1071
  return n.status === "success" ? n : {
1032
1072
  ...n,
1033
- message: dt(n)
1073
+ message: pt(n)
1034
1074
  };
1035
1075
  }
1036
1076
  //#endregion
1037
1077
  //#region src/sdk/lighting.ts
1038
- function pt(e, t) {
1078
+ function ht(e, t) {
1039
1079
  if (!e.length) return 0;
1040
1080
  let n = [...e].sort((e, t) => e - t);
1041
1081
  return n[Math.min(n.length - 1, Math.floor(n.length * t))];
1042
1082
  }
1043
- function mt(e, t, n, r = 12) {
1083
+ function gt(e, t, n, r = 12) {
1044
1084
  if (!t || !n || e.length < t * n) return {
1045
1085
  strong: !1,
1046
1086
  strength: 0,
@@ -1063,7 +1103,7 @@ function mt(e, t, n, r = 12) {
1063
1103
  });
1064
1104
  }
1065
1105
  }
1066
- let s = pt(o.map((e) => e.mean), .8), c = o.map((e) => s - e.mean >= 24 && e.mean >= 35), l = new Uint8Array(o.length), u = [];
1106
+ let s = ht(o.map((e) => e.mean), .8), c = o.map((e) => s - e.mean >= 24 && e.mean >= 35), l = new Uint8Array(o.length), u = [];
1067
1107
  for (let e = 0; e < o.length; e += 1) {
1068
1108
  if (!c[e] || l[e]) continue;
1069
1109
  let t = [], n = [e];
@@ -1111,11 +1151,11 @@ function mt(e, t, n, r = 12) {
1111
1151
  }
1112
1152
  return d;
1113
1153
  }
1114
- function ht(e, t, n, r, i, a, o) {
1154
+ function _t(e, t, n, r, i, a, o) {
1115
1155
  let s = Math.max(0, a - o), c = Math.min(r, a + o + 1), l = Math.max(0, i - o), u = Math.min(n, i + o + 1), d = Math.max(1, (u - l) * (c - s));
1116
1156
  return (e[c * t + u] - e[s * t + u] - e[c * t + l] + e[s * t + l]) / d;
1117
1157
  }
1118
- function gt(e, t, n) {
1158
+ function vt(e, t, n) {
1119
1159
  let r = t + 1, i = new Uint32Array((t + 1) * (n + 1));
1120
1160
  for (let a = 1; a <= n; a += 1) {
1121
1161
  let n = 0;
@@ -1126,23 +1166,23 @@ function gt(e, t, n) {
1126
1166
  stride: r
1127
1167
  };
1128
1168
  }
1129
- function _t(e, t, n, r = Math.max(12, Math.round(Math.max(t, n) / 32))) {
1130
- let { integral: i, stride: a } = gt(e, t, n), o = new Uint8Array(e.length);
1169
+ function yt(e, t, n, r = Math.max(12, Math.round(Math.max(t, n) / 32))) {
1170
+ let { integral: i, stride: a } = vt(e, t, n), o = new Uint8Array(e.length);
1131
1171
  for (let s = 0; s < n; s += 1) for (let c = 0; c < t; c += 1) {
1132
- let l = ht(i, a, t, n, c, s, r);
1172
+ let l = _t(i, a, t, n, c, s, r);
1133
1173
  o[s * t + c] = Math.max(0, Math.min(255, Math.round(e[s * t + c] * 235 / Math.max(24, l))));
1134
1174
  }
1135
1175
  return o;
1136
1176
  }
1137
- function vt(e, t, n, r = Math.max(8, Math.round(Math.max(t, n) / 64)), i = .12) {
1138
- let { integral: a, stride: o } = gt(e, t, n), s = new Uint8Array(e.length), c = 1 - i;
1177
+ function bt(e, t, n, r = Math.max(8, Math.round(Math.max(t, n) / 64)), i = .12) {
1178
+ let { integral: a, stride: o } = vt(e, t, n), s = new Uint8Array(e.length), c = 1 - i;
1139
1179
  for (let i = 0; i < n; i += 1) for (let l = 0; l < t; l += 1) {
1140
- let u = ht(a, o, t, n, l, i, r);
1180
+ let u = _t(a, o, t, n, l, i, r);
1141
1181
  s[i * t + l] = e[i * t + l] < u * c ? 0 : 255;
1142
1182
  }
1143
1183
  return s;
1144
1184
  }
1145
- function yt(e, t, n) {
1185
+ function xt(e, t, n) {
1146
1186
  let r = [
1147
1187
  e.topLeft,
1148
1188
  e.topRight,
@@ -1156,8 +1196,8 @@ function yt(e, t, n) {
1156
1196
  height: s - a
1157
1197
  };
1158
1198
  }
1159
- function bt(e, t) {
1160
- let n = yt(t, e.width, e.height);
1199
+ function St(e, t) {
1200
+ let n = xt(t, e.width, e.height);
1161
1201
  if (n.width <= 0 || n.height <= 0) return {
1162
1202
  strong: !1,
1163
1203
  strength: 0,
@@ -1176,26 +1216,26 @@ function bt(e, t) {
1176
1216
  i.drawImage(e, n.left, n.top, n.width, n.height, 0, 0, r.width, r.height);
1177
1217
  let a = i.getImageData(0, 0, r.width, r.height).data, o = new Uint8Array(r.width * r.height);
1178
1218
  for (let e = 0, t = 0; e < o.length; e += 1, t += 4) o[e] = Math.round(a[t] * .299 + a[t + 1] * .587 + a[t + 2] * .114);
1179
- return mt(o, r.width, r.height);
1219
+ return gt(o, r.width, r.height);
1180
1220
  }
1181
1221
  //#endregion
1182
1222
  //#region src/sdk/finder.ts
1183
- function xt(e, t) {
1223
+ function Ct(e, t) {
1184
1224
  return t.castShadow && (e.reason === "hold-still" || e.reason === "ready") ? t.hint ?? e.hint : e.hint;
1185
1225
  }
1186
- function St(e, t, n) {
1226
+ function wt(e, t, n) {
1187
1227
  if (n <= 0) return 0;
1188
1228
  let r = n - (t - e);
1189
1229
  return r <= 0 ? 0 : Math.max(1, Math.ceil(r / 1e3));
1190
1230
  }
1191
- function Ct(e) {
1231
+ function Tt(e) {
1192
1232
  return `Hold still for ${e}…`;
1193
1233
  }
1194
- async function wt(e, t) {
1234
+ async function Et(e, t) {
1195
1235
  let n = await e();
1196
1236
  return t(), n;
1197
1237
  }
1198
- function Tt(e) {
1238
+ function Dt(e) {
1199
1239
  return e === "alwaysOn" || e === "only" ? {
1200
1240
  visible: !1,
1201
1241
  checked: !0,
@@ -1210,7 +1250,7 @@ function Tt(e) {
1210
1250
  mutable: !0
1211
1251
  };
1212
1252
  }
1213
- function L(e) {
1253
+ function R(e) {
1214
1254
  return [
1215
1255
  e.topLeft,
1216
1256
  e.topRight,
@@ -1218,19 +1258,19 @@ function L(e) {
1218
1258
  e.bottomLeft
1219
1259
  ];
1220
1260
  }
1221
- var Et = 3e3, Dt = 1600;
1222
- function Ot(e = k()) {
1261
+ var Ot = 3e3, kt = 1600;
1262
+ function At(e = D()) {
1223
1263
  return e.iosWebKit ? {
1224
1264
  intervalMs: 70,
1225
1265
  maxFrameDimension: 720,
1226
1266
  maxAnalysisDimension: 720
1227
1267
  } : {
1228
1268
  intervalMs: 140,
1229
- maxFrameDimension: Dt,
1269
+ maxFrameDimension: kt,
1230
1270
  maxAnalysisDimension: 520
1231
1271
  };
1232
1272
  }
1233
- function kt(e, t) {
1273
+ function jt(e, t) {
1234
1274
  let n = e.status === "success" && e.modelStatus !== "failed", r = {
1235
1275
  status: e.status,
1236
1276
  confidence: Number(e.confidence.toFixed(3)),
@@ -1253,7 +1293,7 @@ function kt(e, t) {
1253
1293
  detail: r
1254
1294
  };
1255
1295
  }
1256
- function At(e) {
1296
+ function Mt(e) {
1257
1297
  let t = 0;
1258
1298
  for (let n = 0; n < e.length; n += 1) {
1259
1299
  let r = e[n], i = e[(n + 1) % e.length];
@@ -1261,42 +1301,42 @@ function At(e) {
1261
1301
  }
1262
1302
  return Math.abs(t) / 2;
1263
1303
  }
1264
- function R(e, t) {
1304
+ function z(e, t) {
1265
1305
  return Math.hypot(e.x - t.x, e.y - t.y);
1266
1306
  }
1267
- var z = {
1307
+ var B = {
1268
1308
  widthFill: 0,
1269
1309
  heightFill: 0,
1270
1310
  limitingFill: 0,
1271
1311
  areaFill: 0,
1272
1312
  aspectRatio: 1
1273
1313
  };
1274
- function jt(e, t, n) {
1275
- let r = L(e), i = r.map(({ x: e }) => e), a = r.map(({ y: e }) => e), o = (Math.max(...i) - Math.min(...i)) / Math.max(1, t), s = (Math.max(...a) - Math.min(...a)) / Math.max(1, n), [c, l, u, d] = r, f = Math.max(R(c, l), R(d, u)), p = Math.max(R(c, d), R(l, u));
1314
+ function Nt(e, t, n) {
1315
+ let r = R(e), i = r.map(({ x: e }) => e), a = r.map(({ y: e }) => e), o = (Math.max(...i) - Math.min(...i)) / Math.max(1, t), s = (Math.max(...a) - Math.min(...a)) / Math.max(1, n), [c, l, u, d] = r, f = Math.max(z(c, l), z(d, u)), p = Math.max(z(c, d), z(l, u));
1276
1316
  return {
1277
1317
  widthFill: o,
1278
1318
  heightFill: s,
1279
1319
  limitingFill: Math.max(o, s),
1280
- areaFill: At(r) / Math.max(1, t * n),
1320
+ areaFill: Mt(r) / Math.max(1, t * n),
1281
1321
  aspectRatio: Math.max(f, p) / Math.max(1, Math.min(f, p))
1282
1322
  };
1283
1323
  }
1284
- function Mt(e, t, n, r = {}) {
1324
+ function Pt(e, t, n, r = {}) {
1285
1325
  let i = t ? r.exitFillRatio ?? .64 : r.minFillRatio ?? .72, a = r.highAspectRatio ?? 2.2;
1286
1326
  if (e.aspectRatio < a) return i;
1287
1327
  let o = t ? r.highAspectExitFillRatio : r.highAspectFillRatio;
1288
1328
  return Math.min(o ?? i + .08, 1 - n * 2);
1289
1329
  }
1290
- function Nt(e, t, n = {}) {
1330
+ function Ft(e, t, n = {}) {
1291
1331
  let r = n.confidenceThreshold ?? .72;
1292
1332
  if (e.status !== "success" || !e.quad || e.confidence < r || !e.sourceWidth || !e.sourceHeight) return {
1293
1333
  hint: "Place the document in the frame",
1294
1334
  reason: "place-document",
1295
1335
  fillRatio: 0,
1296
- fill: z,
1336
+ fill: B,
1297
1337
  readyForAutoCapture: !1
1298
1338
  };
1299
- let i = L(e.quad), a = jt(e.quad, e.sourceWidth, e.sourceHeight), o = a.limitingFill, s = t.previouslyReady ? n.exitEdgeMarginRatio ?? .005 : n.edgeMarginRatio ?? .015, c = e.sourceWidth * s, l = e.sourceHeight * s;
1339
+ let i = R(e.quad), a = Nt(e.quad, e.sourceWidth, e.sourceHeight), o = a.limitingFill, s = t.previouslyReady ? n.exitEdgeMarginRatio ?? .005 : n.edgeMarginRatio ?? .015, c = e.sourceWidth * s, l = e.sourceHeight * s;
1300
1340
  if (i.some(({ x: t, y: n }) => t <= c || t >= e.sourceWidth - c || n <= l || n >= e.sourceHeight - l)) return {
1301
1341
  hint: "Move farther away",
1302
1342
  reason: "move-farther-away",
@@ -1304,14 +1344,14 @@ function Nt(e, t, n = {}) {
1304
1344
  fill: a,
1305
1345
  readyForAutoCapture: !1
1306
1346
  };
1307
- let [u, d, f, p] = i, m = R(u, d), h = R(d, f), g = R(f, p), _ = R(p, u);
1347
+ let [u, d, f, p] = i, m = z(u, d), h = z(d, f), g = z(f, p), _ = z(p, u);
1308
1348
  return Math.min(Math.min(m, g) / Math.max(1, Math.max(m, g)), Math.min(_, h) / Math.max(1, Math.max(_, h))) < (t.previouslyReady ? n.exitMinPerspectiveRatio ?? .4 : n.minPerspectiveRatio ?? .48) ? {
1309
1349
  hint: "Hold the camera straight",
1310
1350
  reason: "straighten-camera",
1311
1351
  fillRatio: o,
1312
1352
  fill: a,
1313
1353
  readyForAutoCapture: !1
1314
- } : o < Mt(a, t.previouslyReady === !0, s, n) ? {
1354
+ } : o < Pt(a, t.previouslyReady === !0, s, n) ? {
1315
1355
  hint: "Move closer",
1316
1356
  reason: "move-closer",
1317
1357
  fillRatio: o,
@@ -1325,7 +1365,7 @@ function Nt(e, t, n = {}) {
1325
1365
  readyForAutoCapture: t.ready
1326
1366
  };
1327
1367
  }
1328
- var Pt = class {
1368
+ var It = class {
1329
1369
  previous;
1330
1370
  count = 0;
1331
1371
  ready = !1;
@@ -1342,8 +1382,8 @@ var Pt = class {
1342
1382
  ready: !1,
1343
1383
  movement: Infinity
1344
1384
  };
1345
- let t = Math.hypot(e.sourceWidth, e.sourceHeight), n = this.previous ? Math.max(...L(e.quad).map((e, n) => {
1346
- let r = L(this.previous)[n];
1385
+ let t = Math.hypot(e.sourceWidth, e.sourceHeight), n = this.previous ? Math.max(...R(e.quad).map((e, n) => {
1386
+ let r = R(this.previous)[n];
1347
1387
  return Math.hypot(e.x - r.x, e.y - r.y) / Math.max(1, t);
1348
1388
  })) : Infinity, r = this.options.exitCornerTolerance ?? Math.max(this.options.cornerTolerance, .036);
1349
1389
  return this.ready && this.previous && n <= r ? this.count = Math.max(this.options.stableFrames, this.count + 1) : (this.ready = !1, this.count = this.previous && n <= this.options.cornerTolerance ? this.count + 1 : 1, this.count >= this.options.stableFrames && (this.ready = !0)), this.previous = e.quad, {
@@ -1353,14 +1393,14 @@ var Pt = class {
1353
1393
  };
1354
1394
  }
1355
1395
  };
1356
- function Ft(e, n) {
1396
+ function Lt(e, n) {
1357
1397
  let r = Math.min(1, n / Math.max(e.width, e.height)), i = document.createElement("canvas");
1358
1398
  i.width = Math.max(1, Math.round(e.width * r)), i.height = Math.max(1, Math.round(e.height * r));
1359
1399
  let a = i.getContext("2d");
1360
1400
  if (!a) throw t();
1361
1401
  return a.drawImage(e, 0, 0, i.width, i.height), i;
1362
1402
  }
1363
- function It() {
1403
+ function Rt() {
1364
1404
  let e = window.AudioContext ?? window.webkitAudioContext;
1365
1405
  if (!e) return;
1366
1406
  let t = new e(), n = Math.round(t.sampleRate * .09), r = t.createBuffer(1, n, t.sampleRate), i = r.getChannelData(0);
@@ -1371,29 +1411,29 @@ function It() {
1371
1411
  let a = t.createBufferSource(), o = t.createBiquadFilter(), s = t.createGain();
1372
1412
  o.type = "bandpass", o.frequency.value = 1400, s.gain.value = .42, a.buffer = r, a.connect(o).connect(s).connect(t.destination), a.start(), a.onended = () => void t.close();
1373
1413
  }
1374
- async function Lt(e) {
1414
+ async function zt(e) {
1375
1415
  let t = document.createElement("video");
1376
1416
  return t.muted = !0, t.autoplay = !0, t.playsInline = !0, t.srcObject = e, await t.play(), t;
1377
1417
  }
1378
- async function Rt(t) {
1418
+ async function Bt(t) {
1379
1419
  await x("scan");
1380
- let n = Tt(t.autoCapture), r = t.holdStillMs ?? 3e3, i = new Pt({
1420
+ let n = Dt(t.autoCapture), r = t.holdStillMs ?? 3e3, i = new It({
1381
1421
  stableFrames: t.stableFrames ?? 4,
1382
1422
  confidenceThreshold: t.confidenceThreshold ?? .72,
1383
1423
  cornerTolerance: t.cornerTolerance ?? .024,
1384
1424
  exitCornerTolerance: t.exitCornerTolerance ?? .036
1385
- }), a = Ot(), o = t.maxFrameDimension ?? a.maxFrameDimension, s = t.intervalMs ?? a.intervalMs, c = {
1425
+ }), a = At(), o = t.maxFrameDimension ?? a.maxFrameDimension, s = t.intervalMs ?? a.intervalMs, c = {
1386
1426
  minDimension: 220,
1387
1427
  maxAnalysisDimension: a.maxAnalysisDimension,
1388
1428
  ...t.detection
1389
- }, l = typeof MediaStream < "u" && t.source instanceof MediaStream ? await Lt(t.source) : t.source, u = !0, d = !1, f = !1, p, m = 0, h, g = "", _ = 0, v = {
1429
+ }, l = typeof MediaStream < "u" && t.source instanceof MediaStream ? await zt(t.source) : t.source, u = !0, d = !1, f = !1, p, m = 0, h, g = "", _ = 0, v = {
1390
1430
  state: "detecting",
1391
1431
  confidence: 0,
1392
1432
  guidance: {
1393
1433
  hint: "Place the document in the frame",
1394
1434
  reason: "place-document",
1395
1435
  fillRatio: 0,
1396
- fill: z,
1436
+ fill: B,
1397
1437
  readyForAutoCapture: !1
1398
1438
  },
1399
1439
  lighting: {
@@ -1403,10 +1443,10 @@ async function Rt(t) {
1403
1443
  stableFrames: 0,
1404
1444
  requiredStableFrames: t.stableFrames ?? 4,
1405
1445
  autoCapture: { ...n }
1406
- }, y = () => l instanceof HTMLCanvasElement ? Ft(l, o) : j(l, o), b = (e) => {
1446
+ }, y = () => l instanceof HTMLCanvasElement ? Lt(l, o) : M(l, o), b = (e) => {
1407
1447
  v = e, t.onStatus?.(e);
1408
1448
  }, S = (e) => {
1409
- let t = kt(e, l instanceof HTMLVideoElement ? {
1449
+ let t = jt(e, l instanceof HTMLVideoElement ? {
1410
1450
  width: l.videoWidth,
1411
1451
  height: l.videoHeight
1412
1452
  } : {
@@ -1421,11 +1461,11 @@ async function Rt(t) {
1421
1461
  d = !0;
1422
1462
  let n;
1423
1463
  try {
1424
- n = await wt(t.captureFrame ?? y, () => {
1464
+ n = await Et(t.captureFrame ?? y, () => {
1425
1465
  b({
1426
1466
  ...v,
1427
1467
  state: "captured"
1428
- }), t.playShutterSound !== !1 && It(), C();
1468
+ }), t.playShutterSound !== !1 && Rt(), C();
1429
1469
  });
1430
1470
  } catch (e) {
1431
1471
  throw d = !1, e instanceof Error ? e : /* @__PURE__ */ Error("The camera frame could not be captured.");
@@ -1439,9 +1479,9 @@ async function Rt(t) {
1439
1479
  }, T = async () => {
1440
1480
  if (u && !d) {
1441
1481
  try {
1442
- let e = y(), a = await lt(e, c);
1482
+ let e = y(), a = await dt(e, c);
1443
1483
  h = a, S(a);
1444
- let o = a.quad ? bt(e, a.quad) : {
1484
+ let o = a.quad ? St(e, a.quad) : {
1445
1485
  strong: !1,
1446
1486
  strength: 0
1447
1487
  }, s = o.strong ? {
@@ -1451,7 +1491,7 @@ async function Rt(t) {
1451
1491
  } : {
1452
1492
  castShadow: !1,
1453
1493
  strength: o.strength
1454
- }, l = i.update(a), u = Nt(a, {
1494
+ }, l = i.update(a), u = Ft(a, {
1455
1495
  ...l,
1456
1496
  previouslyReady: f
1457
1497
  }, {
@@ -1461,7 +1501,7 @@ async function Rt(t) {
1461
1501
  f = u.readyForAutoCapture;
1462
1502
  let d = performance.now();
1463
1503
  u.readyForAutoCapture && n.checked ? p ??= d : p = void 0;
1464
- let m = p === void 0 ? void 0 : St(p, d, r), g = a.status !== "success" || u.reason === "place-document" ? "seeking" : u.readyForAutoCapture ? "ready" : "unstable";
1504
+ let m = p === void 0 ? void 0 : wt(p, d, r), g = a.status !== "success" || u.reason === "place-document" ? "seeking" : u.readyForAutoCapture ? "ready" : "unstable";
1465
1505
  if (b({
1466
1506
  state: g,
1467
1507
  confidence: a.confidence,
@@ -1507,7 +1547,7 @@ async function Rt(t) {
1507
1547
  hint: "Place the document in the frame",
1508
1548
  reason: "place-document",
1509
1549
  fillRatio: 0,
1510
- fill: z,
1550
+ fill: B,
1511
1551
  readyForAutoCapture: !1
1512
1552
  },
1513
1553
  lighting: {
@@ -1538,24 +1578,24 @@ async function Rt(t) {
1538
1578
  }
1539
1579
  //#endregion
1540
1580
  //#region src/sdk/ocr-runtime.ts
1541
- var zt = new URL("./assets/tesseract/worker.min.js", import.meta.url), Bt = new URL("./assets/tesseract/tesseract-core-lstm.wasm.js", import.meta.url), Vt = new URL("./assets/tesseract/tesseract-core-simd-lstm.wasm.js", import.meta.url), Ht = new URL("./assets/tesseract/tesseract-core-relaxedsimd-lstm.wasm.js", import.meta.url), Ut = new URL("./assets/tesseract/eng.traineddata.gz", import.meta.url), Wt = Uint8Array.of(0, 97, 115, 109, 1, 0, 0, 0, 1, 5, 1, 96, 0, 1, 123, 3, 2, 1, 0, 10, 15, 1, 13, 0, 65, 1, 253, 15, 65, 2, 253, 15, 253, 128, 2, 11), Gt = Uint8Array.of(0, 97, 115, 109, 1, 0, 0, 0, 1, 5, 1, 96, 0, 1, 123, 3, 2, 1, 0, 10, 10, 1, 8, 0, 65, 0, 253, 15, 253, 98, 11);
1542
- function Kt(e) {
1581
+ var Vt = new URL("./assets/tesseract/worker.min.js", import.meta.url), Ht = new URL("./assets/tesseract/tesseract-core-lstm.wasm.js", import.meta.url), Ut = new URL("./assets/tesseract/tesseract-core-simd-lstm.wasm.js", import.meta.url), Wt = new URL("./assets/tesseract/tesseract-core-relaxedsimd-lstm.wasm.js", import.meta.url), Gt = new URL("./assets/tesseract/eng.traineddata.gz", import.meta.url), Kt = Uint8Array.of(0, 97, 115, 109, 1, 0, 0, 0, 1, 5, 1, 96, 0, 1, 123, 3, 2, 1, 0, 10, 15, 1, 13, 0, 65, 1, 253, 15, 65, 2, 253, 15, 253, 128, 2, 11), qt = Uint8Array.of(0, 97, 115, 109, 1, 0, 0, 0, 1, 5, 1, 96, 0, 1, 123, 3, 2, 1, 0, 10, 10, 1, 8, 0, 65, 0, 253, 15, 253, 98, 11);
1582
+ function Jt(e) {
1543
1583
  try {
1544
1584
  return typeof WebAssembly < "u" && WebAssembly.validate(e);
1545
1585
  } catch {
1546
1586
  return !1;
1547
1587
  }
1548
1588
  }
1549
- function qt() {
1589
+ function Yt() {
1550
1590
  return {
1551
- relaxedSimd: Kt(Wt),
1552
- simd: Kt(Gt)
1591
+ relaxedSimd: Jt(Kt),
1592
+ simd: Jt(qt)
1553
1593
  };
1554
1594
  }
1555
- function Jt(e) {
1556
- return e.relaxedSimd ? Ht : e.simd ? Vt : Bt;
1595
+ function Xt(e) {
1596
+ return e.relaxedSimd ? Wt : e.simd ? Ut : Ht;
1557
1597
  }
1558
- function Yt(t, n) {
1598
+ function Zt(t, n) {
1559
1599
  let r = t?.trim() || "eng", i = n?.trim() || "";
1560
1600
  if (i) return {
1561
1601
  kind: "lang-path",
@@ -1568,14 +1608,14 @@ function Yt(t, n) {
1568
1608
  };
1569
1609
  throw new e("language", `OCR language "${r}" is not packaged. Pass langPath, a directory URL that contains ${r}.traineddata.gz.`);
1570
1610
  }
1571
- function Xt(e = Ut) {
1611
+ function Qt(e = Gt) {
1572
1612
  let t = e.href, n = t.lastIndexOf("/");
1573
1613
  return n === -1 ? t : t.slice(0, n);
1574
1614
  }
1575
- function Zt(e) {
1576
- return e.kind === "bundled-eng" ? Xt() : e.langPath;
1615
+ function $t(e) {
1616
+ return e.kind === "bundled-eng" ? Qt() : e.langPath;
1577
1617
  }
1578
- async function Qt(t, n, r) {
1618
+ async function en(t, n, r) {
1579
1619
  return new Promise((i, a) => {
1580
1620
  let o = !1, s = (t) => {
1581
1621
  o || (o = !0, a(new e("worker", `OCR worker failed to start (${t instanceof Error ? t.message : String(t)}).`)));
@@ -1598,7 +1638,7 @@ async function Qt(t, n, r) {
1598
1638
  }
1599
1639
  //#endregion
1600
1640
  //#region src/sdk/ocr.ts
1601
- function $t(e, t = 1, n = 1, r = 0, i = 0) {
1641
+ function tn(e, t = 1, n = 1, r = 0, i = 0) {
1602
1642
  return {
1603
1643
  text: e.text,
1604
1644
  confidence: Math.max(0, Math.min(1, e.confidence / 100)),
@@ -1610,20 +1650,20 @@ function $t(e, t = 1, n = 1, r = 0, i = 0) {
1610
1650
  }
1611
1651
  };
1612
1652
  }
1613
- function en(e = .5) {
1653
+ function nn(e = .5) {
1614
1654
  if (!Number.isFinite(e) || e < 0 || e > 1) throw RangeError("OCR minConfidence must be between 0 and 1.");
1615
1655
  return e;
1616
1656
  }
1617
- function tn(e, t) {
1657
+ function rn(e, t) {
1618
1658
  let n = Math.max(e.bbox.x, t.bbox.x), r = Math.max(e.bbox.y, t.bbox.y), i = Math.min(e.bbox.x + e.bbox.width, t.bbox.x + t.bbox.width), a = Math.min(e.bbox.y + e.bbox.height, t.bbox.y + t.bbox.height), o = Math.max(0, i - n) * Math.max(0, a - r), s = Math.min(e.bbox.width * e.bbox.height, t.bbox.width * t.bbox.height);
1619
1659
  return s > 0 ? o / s : 0;
1620
1660
  }
1621
- function nn(e) {
1661
+ function an(e) {
1622
1662
  let t = [...e].sort((e, t) => t.confidence - e.confidence || e.bbox.y - t.bbox.y || e.bbox.x - t.bbox.x || e.text.localeCompare(t.text)), n = [];
1623
- for (let e of t) n.some((t) => tn(t, e) >= .65) || n.push(e);
1663
+ for (let e of t) n.some((t) => rn(t, e) >= .65) || n.push(e);
1624
1664
  return n;
1625
1665
  }
1626
- function rn(e, t, n, r, i) {
1666
+ function on(e, t, n, r, i) {
1627
1667
  let a = e.text.trim();
1628
1668
  if (!a || !/[\p{L}\p{N}]/u.test(a)) return !1;
1629
1669
  let o = e.bbox.width * e.bbox.height / Math.max(1, n * r), s = e.bbox.width / Math.max(1, e.bbox.height);
@@ -1634,7 +1674,7 @@ function rn(e, t, n, r, i) {
1634
1674
  }
1635
1675
  return !0;
1636
1676
  }
1637
- function an(e) {
1677
+ function sn(e) {
1638
1678
  let t = [...e].sort((e, t) => e.bbox.y + e.bbox.height / 2 - (t.bbox.y + t.bbox.height / 2) || e.bbox.x - t.bbox.x), n = [];
1639
1679
  for (let e of t) {
1640
1680
  let t = e.bbox.y + e.bbox.height / 2, r = n.find((n) => Math.abs(n.centerY - t) <= Math.max(n.height, e.bbox.height) * .6);
@@ -1650,28 +1690,28 @@ function an(e) {
1650
1690
  }
1651
1691
  return n.sort((e, t) => e.centerY - t.centerY).map((e) => e.words.sort((e, t) => e.bbox.x - t.bbox.x).map((e) => e.text.trim()).join(" ")).join("\n");
1652
1692
  }
1653
- function on(e, t, n, r) {
1654
- let i = en(t.minConfidence), a = [], o = [], s = 1, c = 1;
1693
+ function cn(e, t, n, r) {
1694
+ let i = nn(t.minConfidence), a = [], o = [], s = 1, c = 1;
1655
1695
  for (let t of e) {
1656
1696
  let e = t.scaleX ?? 1, n = t.scaleY ?? 1, r = t.offsetX ?? 0, l = t.offsetY ?? 0;
1657
1697
  for (let u of t.blocks ?? []) for (let t of u.paragraphs) for (let u of t.lines) for (let t of u.words) {
1658
- let u = $t(t, e, n, r, l);
1698
+ let u = tn(t, e, n, r, l);
1659
1699
  s = Math.max(s, u.bbox.x + u.bbox.width), c = Math.max(c, u.bbox.y + u.bbox.height), u.confidence >= i && a.push(u);
1660
1700
  for (let a of t.symbols) {
1661
- let t = $t(a, e, n, r, l);
1701
+ let t = tn(a, e, n, r, l);
1662
1702
  t.confidence >= i && o.push(t);
1663
1703
  }
1664
1704
  }
1665
1705
  }
1666
- let l = n?.width ?? s, u = n?.height ?? c, d = nn(a).filter((e) => rn(e, "word", l, u, r)), f = nn(o).filter((e) => rn(e, "character", l, u, r));
1706
+ let l = n?.width ?? s, u = n?.height ?? c, d = an(a).filter((e) => on(e, "word", l, u, r)), f = an(o).filter((e) => on(e, "character", l, u, r));
1667
1707
  return {
1668
- text: an(d),
1708
+ text: sn(d),
1669
1709
  confidence: d.length ? d.reduce((e, t) => e + t.confidence, 0) / d.length : 0,
1670
1710
  words: t.includeWords ? d : [],
1671
1711
  characters: t.includeCharacters ? f : []
1672
1712
  };
1673
1713
  }
1674
- function sn(e) {
1714
+ function ln(e) {
1675
1715
  let n = e.getContext("2d", { willReadFrequently: !0 });
1676
1716
  if (!n) throw t();
1677
1717
  let r = n.getImageData(0, 0, e.width, e.height), i = new Uint8Array(e.width * e.height);
@@ -1682,7 +1722,7 @@ function sn(e) {
1682
1722
  luminance: i
1683
1723
  };
1684
1724
  }
1685
- function cn(e) {
1725
+ function un(e) {
1686
1726
  let t = document.createElement("canvas");
1687
1727
  t.width = 72, t.height = 72;
1688
1728
  let n = t.getContext("2d", { willReadFrequently: !0 });
@@ -1693,27 +1733,27 @@ function cn(e) {
1693
1733
  areaRatio: 0
1694
1734
  };
1695
1735
  n.drawImage(e, 0, 0, t.width, t.height);
1696
- let { luminance: r } = sn(t);
1697
- return mt(r, t.width, t.height);
1736
+ let { luminance: r } = ln(t);
1737
+ return gt(r, t.width, t.height);
1698
1738
  }
1699
- function ln(e, t, n, r) {
1739
+ function dn(e, t, n, r) {
1700
1740
  let i = (e.bbox.x + e.bbox.width / 2) / n, a = (e.bbox.y + e.bbox.height / 2) / r;
1701
1741
  return i >= t.x && i <= t.x + t.width && a >= t.y && a <= t.y + t.height;
1702
1742
  }
1703
- var un = .58;
1704
- function dn(e) {
1743
+ var fn = .58;
1744
+ function pn(e) {
1705
1745
  let t = e.trim();
1706
1746
  if (!t || !/[\p{L}\p{N}]/u.test(t)) return 0;
1707
1747
  if (/^\$?\d{1,5}([.,]\d{2})?$/.test(t)) return 1;
1708
1748
  let n = t.replace(/[^\p{L}]/gu, "");
1709
1749
  return n.length >= 3 && /[aeiouy]/i.test(n) ? .9 : n.length >= 4 ? .7 : t.length <= 2 ? .35 : /[^\p{L}\p{N}.,'’$/-]/u.test(t) ? .25 : .5;
1710
1750
  }
1711
- function fn(e, t, n) {
1751
+ function mn(e, t, n) {
1712
1752
  let r = Math.max(0, Math.min(1, (1 - e.darkness / 80) * (1 - e.strength / 24)));
1713
1753
  if (!t.length) return r * .35;
1714
1754
  let i = 0;
1715
1755
  for (let e of t) {
1716
- let t = dn(e.text);
1756
+ let t = pn(e.text);
1717
1757
  if (n) {
1718
1758
  let r = n(e.bbox);
1719
1759
  (r < .04 || r > .62) && (t *= .4);
@@ -1722,10 +1762,10 @@ function fn(e, t, n) {
1722
1762
  }
1723
1763
  return r * .7 + i / t.length * .3;
1724
1764
  }
1725
- function pn(e, t, n, r) {
1726
- return !e.strong || !e.region ? !1 : fn(e, t.filter((t) => ln(t, e.region, n.width, n.height)), r) < un;
1765
+ function hn(e, t, n, r) {
1766
+ return !e.strong || !e.region ? !1 : mn(e, t.filter((t) => dn(t, e.region, n.width, n.height)), r) < fn;
1727
1767
  }
1728
- function mn(e, t, n, r) {
1768
+ function gn(e, t, n, r) {
1729
1769
  let i = Math.max(0, Math.floor(t.x * e.width)), a = Math.max(0, Math.floor(t.y * e.height)), o = Math.min(e.width, Math.ceil((t.x + t.width) * e.width)), s = Math.min(e.height, Math.ceil((t.y + t.height) * e.height)), c = document.createElement("canvas");
1730
1770
  c.width = Math.max(1, o - i), c.height = Math.max(1, s - a), c.getContext("2d")?.drawImage(e, i, a, c.width, c.height, 0, 0, c.width, c.height);
1731
1771
  let l = n / e.width, u = r / e.height;
@@ -1739,26 +1779,26 @@ function mn(e, t, n, r) {
1739
1779
  }
1740
1780
  };
1741
1781
  }
1742
- function hn(e, t) {
1782
+ function _n(e, t) {
1743
1783
  for (let n = 0, r = 0; n < t.length; n += 1, r += 4) e.data[r] = t[n], e.data[r + 1] = t[n], e.data[r + 2] = t[n], e.data[r + 3] = 255;
1744
1784
  }
1745
- function gn(e) {
1785
+ function vn(e) {
1746
1786
  let n = 2200, r = Math.max(e.width, e.height), i = r > n ? n / r : Math.min(1.5, n / Math.max(1, r)), a = document.createElement("canvas");
1747
1787
  a.width = Math.max(1, Math.round(e.width * i)), a.height = Math.max(1, Math.round(e.height * i));
1748
1788
  let o = a.getContext("2d", { willReadFrequently: !0 });
1749
1789
  if (!o) throw t();
1750
1790
  o.drawImage(e, 0, 0, a.width, a.height);
1751
- let { image: s, luminance: c } = sn(a), l = _t(c, a.width, a.height), u = vt(l, a.width, a.height), d = document.createElement("canvas");
1791
+ let { image: s, luminance: c } = ln(a), l = yt(c, a.width, a.height), u = bt(l, a.width, a.height), d = document.createElement("canvas");
1752
1792
  d.width = a.width, d.height = a.height;
1753
1793
  let f = d.getContext("2d", { willReadFrequently: !0 });
1754
1794
  if (!f) throw t();
1755
1795
  let p = f.createImageData(d.width, d.height);
1756
- return hn(p, l), f.putImageData(p, 0, 0), hn(s, u), o.putImageData(s, 0, 0), {
1796
+ return _n(p, l), f.putImageData(p, 0, 0), _n(s, u), o.putImageData(s, 0, 0), {
1757
1797
  sparseCanvas: a,
1758
1798
  flattenedCanvas: d
1759
1799
  };
1760
1800
  }
1761
- function _n(e) {
1801
+ function yn(e) {
1762
1802
  let t = document.createElement("canvas");
1763
1803
  t.width = 24, t.height = 24;
1764
1804
  let n = t.getContext("2d", { willReadFrequently: !0 });
@@ -1776,19 +1816,19 @@ function _n(e) {
1776
1816
  return l / s.length;
1777
1817
  };
1778
1818
  }
1779
- async function B(e, t = {}) {
1819
+ async function bn(e, t = {}) {
1780
1820
  await x("ocr");
1781
- let n = Yt(t.language, t.langPath), r = n.language;
1782
- en(t.minConfidence);
1783
- let i = await M(e, { cloneCanvas: !1 }), { sparseCanvas: a, flattenedCanvas: o } = gn(i), s = t.shadowPass === !1 ? {
1821
+ let n = Zt(t.language, t.langPath), r = n.language;
1822
+ nn(t.minConfidence);
1823
+ let i = await N(e, { cloneCanvas: !1 }), { sparseCanvas: a, flattenedCanvas: o } = vn(i), s = t.shadowPass === !1 ? {
1784
1824
  strong: !1,
1785
1825
  strength: 0,
1786
1826
  darkness: 0,
1787
1827
  areaRatio: 0
1788
- } : cn(i), { createWorker: c, PSM: l } = await import("tesseract.js"), u = 0, d = s.strong ? 3 : 2, f = await Qt(c, r, {
1789
- workerPath: zt.href,
1790
- corePath: Jt(qt()).href,
1791
- langPath: Zt(n),
1828
+ } : un(i), { createWorker: c, PSM: l } = await import("tesseract.js"), u = 0, d = s.strong ? 3 : 2, f = await en(c, r, {
1829
+ workerPath: Vt.href,
1830
+ corePath: Xt(Yt()).href,
1831
+ langPath: $t(n),
1792
1832
  logger(e) {
1793
1833
  typeof e.progress == "number" && t.onProgress?.(Math.min(1, (u + e.progress) / d), e.status ?? "recognizing text");
1794
1834
  }
@@ -1813,16 +1853,16 @@ async function B(e, t = {}) {
1813
1853
  }], d = {
1814
1854
  ...t,
1815
1855
  includeWords: !0
1816
- }, p = _n(i), m = on(c, d, {
1856
+ }, p = yn(i), m = cn(c, d, {
1817
1857
  width: i.width,
1818
1858
  height: i.height
1819
- }, p), h = t.shadowPass !== !1 && pn(s, m.words, {
1859
+ }, p), h = t.shadowPass !== !1 && hn(s, m.words, {
1820
1860
  width: i.width,
1821
1861
  height: i.height
1822
1862
  }, p);
1823
1863
  if (h && s.region) {
1824
1864
  u = 2;
1825
- let { tile: e, passMapping: t } = mn(o, s.region, i.width, i.height);
1865
+ let { tile: e, passMapping: t } = gn(o, s.region, i.width, i.height);
1826
1866
  await f.setParameters({
1827
1867
  tessedit_pageseg_mode: l.SPARSE_TEXT,
1828
1868
  preserve_interword_spaces: "1"
@@ -1836,7 +1876,7 @@ async function B(e, t = {}) {
1836
1876
  ...t
1837
1877
  });
1838
1878
  }
1839
- let g = c.length === 2 ? m : on(c, d, {
1879
+ let g = c.length === 2 ? m : cn(c, d, {
1840
1880
  width: i.width,
1841
1881
  height: i.height
1842
1882
  }, p);
@@ -1865,55 +1905,68 @@ async function B(e, t = {}) {
1865
1905
  }
1866
1906
  //#endregion
1867
1907
  //#region src/sdk/zxing-runtime.ts
1868
- var vn = new URL("./assets/zxing_reader.wasm", import.meta.url), yn = "3.1.6", bn = "zxing_reader.wasm", xn = `https://exige-scanner-sdk.vercel.app/zxing/${yn}/`, Sn = `https://cdn.jsdelivr.net/npm/zxing-wasm@${yn}/dist/reader/`;
1869
- function Cn(e, t) {
1908
+ var xn = new URL("./assets/zxing_reader.wasm", import.meta.url), Sn = "3.1.6", Cn = "zxing_reader.wasm", wn = `https://exige-scanner-sdk.vercel.app/zxing/${Sn}/`, Tn = `https://cdn.jsdelivr.net/npm/zxing-wasm@${Sn}/dist/reader/`;
1909
+ function En(e, t) {
1870
1910
  return `${e.endsWith("/") ? e : `${e}/`}${t}`;
1871
1911
  }
1872
- function wn(e = xn) {
1873
- return Cn(e, bn);
1874
- }
1875
- function Tn() {
1876
- return vn.href;
1912
+ function Dn(e = wn) {
1913
+ return En(e, Cn);
1877
1914
  }
1878
- var En, Dn;
1879
1915
  function On() {
1916
+ return xn.href;
1917
+ }
1918
+ var kn, An;
1919
+ function jn() {
1880
1920
  return {
1881
- binary: En,
1882
- url: Dn
1921
+ binary: kn,
1922
+ url: An
1883
1923
  };
1884
1924
  }
1885
- async function kn(e = fetch) {
1886
- let t = Tn();
1887
- if (await Be(t, e)) return t;
1888
- let n = wn(xn);
1889
- return await Be(n, e) ? n : wn(Sn);
1925
+ async function Mn(e = fetch) {
1926
+ let t = On();
1927
+ if (await He(t, e)) return t;
1928
+ let n = Dn(wn);
1929
+ return await He(n, e) ? n : Dn(Tn);
1930
+ }
1931
+ async function Nn(e = fetch) {
1932
+ let t = jn();
1933
+ if (t.binary) return t.binary.slice(0);
1934
+ let n = await e(await Mn(e));
1935
+ if (!n.ok) throw Error(`Could not download zxing-wasm (${n.status}).`);
1936
+ return await n.arrayBuffer();
1890
1937
  }
1891
1938
  //#endregion
1892
1939
  //#region src/sdk/barcode.ts
1893
- var V = 1600, An = [
1940
+ var Pn = 1600, Fn = [
1894
1941
  1600,
1895
1942
  1280,
1896
1943
  960,
1897
1944
  720,
1898
1945
  480
1899
- ], jn = [
1946
+ ], In = [
1900
1947
  [.2, .8],
1901
1948
  [.32, .72],
1902
1949
  [.4, .86]
1903
1950
  ];
1904
- function Mn(e, t) {
1951
+ function Ln(e, t) {
1905
1952
  let n = Math.max(e, t);
1906
1953
  if (!Number.isFinite(n) || n < 1) return [];
1907
- let r = Math.min(n, V), i = [r];
1908
- for (let e of An) e <= r - 16 && i.push(e);
1954
+ let r = Math.min(n, Pn), i = [r];
1955
+ for (let e of Fn) e <= r - 16 && i.push(e);
1909
1956
  return i;
1910
1957
  }
1911
- function Nn() {
1958
+ var V = class extends Error {
1959
+ code = "zxing-wasm-load";
1960
+ constructor(e) {
1961
+ super("The barcode decoder failed to load."), this.name = "Pdf417DecoderError", e !== void 0 && (this.cause = e);
1962
+ }
1963
+ };
1964
+ function Rn() {
1912
1965
  let e = globalThis.BarcodeDetector;
1913
1966
  return typeof e == "function" ? e : void 0;
1914
1967
  }
1915
- async function Pn() {
1916
- let e = Nn();
1968
+ async function zn() {
1969
+ let e = Rn();
1917
1970
  if (!e?.getSupportedFormats) return !1;
1918
1971
  try {
1919
1972
  return (await e.getSupportedFormats()).some((e) => e.toLowerCase() === "pdf417");
@@ -1921,42 +1974,45 @@ async function Pn() {
1921
1974
  return !1;
1922
1975
  }
1923
1976
  }
1924
- function Fn(e) {
1977
+ function Bn(e) {
1925
1978
  try {
1926
1979
  return e.getContext("2d", { willReadFrequently: !0 })?.getImageData(0, 0, e.width, e.height);
1927
1980
  } catch {
1928
1981
  return;
1929
1982
  }
1930
1983
  }
1931
- async function In(e) {
1984
+ async function Vn(e) {
1932
1985
  let t = [];
1933
1986
  if (e instanceof Blob && t.push(e), e instanceof HTMLCanvasElement) {
1934
- let n = Fn(e);
1987
+ let n = Bn(e);
1935
1988
  n && t.push(n);
1936
1989
  try {
1937
- t.push(await qe(e, "image/png"));
1990
+ t.push(await Ye(e, "image/png"));
1938
1991
  } catch {}
1939
1992
  } else if (!(e instanceof Blob)) try {
1940
- let n = Fn(await M(e, { cloneCanvas: !1 }));
1993
+ let n = Bn(await N(e, { cloneCanvas: !1 }));
1941
1994
  n && t.push(n);
1942
1995
  } catch {}
1943
1996
  return t;
1944
1997
  }
1945
1998
  var H;
1946
- async function Ln() {
1999
+ async function Hn() {
1947
2000
  return H ||= (async () => {
1948
- let e = await import("zxing-wasm/reader"), t = On(), n = t.binary ? void 0 : await kn();
2001
+ let [e, t] = await Promise.all([import("zxing-wasm/reader"), Nn()]);
1949
2002
  return await e.prepareZXingModule({
1950
- overrides: t.binary ? { wasmBinary: t.binary } : { locateFile: (e, t) => e.endsWith(".wasm") ? n ?? t + e : t + e },
2003
+ overrides: { wasmBinary: t },
1951
2004
  fireImmediately: !0
1952
2005
  }), e;
1953
2006
  })().catch((e) => {
1954
- throw H = void 0, console.error("[exige-scanner] zxing-wasm failed to load", e), e;
2007
+ throw H = void 0, e instanceof Error && e.message, console.error("[exige-scanner] zxing-wasm failed to load", e), new V(e);
1955
2008
  }), H;
1956
2009
  }
1957
- async function Rn(e) {
1958
- let { readBarcodes: t } = await Ln();
1959
- for (let n of await In(e)) {
2010
+ async function Un() {
2011
+ await Hn();
2012
+ }
2013
+ async function Wn(e) {
2014
+ let { readBarcodes: t } = await Hn();
2015
+ for (let n of await Vn(e)) {
1960
2016
  let e = (await t(n, {
1961
2017
  formats: ["PDF417"],
1962
2018
  tryHarder: !0,
@@ -1978,29 +2034,29 @@ function U(e, t) {
1978
2034
  let a = i.getContext("2d", { willReadFrequently: !0 }) ?? i.getContext("2d");
1979
2035
  return a && (a.imageSmoothingEnabled = !0, "imageSmoothingQuality" in a && (a.imageSmoothingQuality = "high"), a.drawImage(e, 0, 0, i.width, i.height)), i;
1980
2036
  }
1981
- function zn(e, t, n) {
2037
+ function Gn(e, t, n) {
1982
2038
  let r = Math.max(0, Math.round(e.height * t)), i = Math.max(1, Math.round(e.height * n) - r), a = document.createElement("canvas");
1983
2039
  a.width = e.width, a.height = i;
1984
2040
  let o = a.getContext("2d", { willReadFrequently: !0 }) ?? a.getContext("2d");
1985
2041
  return o && o.drawImage(e, 0, r, e.width, i, 0, 0, e.width, i), a;
1986
2042
  }
1987
- function Bn(e) {
1988
- return Mn(e.width, e.height).map((t) => U(e, t));
2043
+ function Kn(e) {
2044
+ return Ln(e.width, e.height).map((t) => U(e, t));
1989
2045
  }
1990
- function Vn(e) {
2046
+ function qn(e) {
1991
2047
  if (e.height < e.width * 1.15 || e.height < 120) return [];
1992
2048
  let t = [];
1993
- for (let [n, r] of jn) {
1994
- let i = zn(e, n, r);
1995
- t.push(U(i, V));
1996
- let a = Mn(i.width, i.height).find((e) => e <= 960);
2049
+ for (let [n, r] of In) {
2050
+ let i = Gn(e, n, r);
2051
+ t.push(U(i, Pn));
2052
+ let a = Ln(i.width, i.height).find((e) => e <= 960);
1997
2053
  a && t.push(U(i, a));
1998
2054
  }
1999
2055
  return t;
2000
2056
  }
2001
- function Hn(e) {
2057
+ function Jn(e) {
2002
2058
  let t = /* @__PURE__ */ new Set(), n = [];
2003
- for (let r of [...Vn(e), ...Bn(e)]) {
2059
+ for (let r of [...qn(e), ...Kn(e)]) {
2004
2060
  let e = `${r.width}x${r.height}`;
2005
2061
  t.has(e) || (t.add(e), n.push(r));
2006
2062
  }
@@ -2009,33 +2065,36 @@ function Hn(e) {
2009
2065
  async function W(e) {
2010
2066
  let t;
2011
2067
  try {
2012
- t = await M(e, { cloneCanvas: !1 });
2068
+ t = await N(e, { cloneCanvas: !1 });
2013
2069
  } catch {
2014
2070
  t = e instanceof HTMLCanvasElement ? e : document.createElement("canvas");
2015
2071
  }
2016
- let n = t.width && t.height ? Hn(t) : [];
2072
+ let n = t.width && t.height ? Jn(t) : [];
2017
2073
  for (let e of n) try {
2018
- let t = await Rn(e);
2074
+ let t = await Wn(e);
2019
2075
  if (t) return {
2020
2076
  text: t,
2021
2077
  source: "zxing-wasm"
2022
2078
  };
2023
- } catch {}
2079
+ } catch (e) {
2080
+ if (e instanceof V) throw e;
2081
+ }
2024
2082
  if (e instanceof Blob) try {
2025
- let t = await Rn(e);
2083
+ let t = await Wn(e);
2026
2084
  return t ? {
2027
2085
  text: t,
2028
2086
  source: "zxing-wasm"
2029
2087
  } : void 0;
2030
- } catch {
2088
+ } catch (e) {
2089
+ if (e instanceof V) throw e;
2031
2090
  return;
2032
2091
  }
2033
2092
  }
2034
- var G = new Set(/* @__PURE__ */ "DCA.DCB.DCD.DBA.DCS.DAC.DAD.DBD.DBB.DBC.DAY.DAU.DAG.DAI.DAJ.DAK.DAQ.DCF.DCG.DDE.DDF.DDG.DAH.DAZ.DCI.DCJ.DCK.DBN.DBG.DBS.DCU.DCE.DCL.DCM.DCN.DCO.DCP.DCQ.DCR.DDA.DDB.DDC.DDD.DAW.DAX.DDH.DDI.DDJ.DDK.DDL.DCT.DAL.DAM.DAN.DAO.DAR.DAS.DAT.DAV.DBH.DBI.DBJ.DBK.DBL.DBM.DCH".split(".")), Un = /* @__PURE__ */ "issuerJurisdiction.expirationDate.documentNumber.firstName.middleName.lastName.dateOfBirth.sex.eyeColor.height.addressStreet.addressCity.addressPostalCode.issueDate.country.addressStreet2.hairColor.nameSuffix.vehicleClass.restrictionCodes.endorsementCodes.documentDiscriminator.inventoryControlNumber.raceEthnicity.organDonor.veteran.weight".split("."), Wn = /* @__PURE__ */ new Set([
2093
+ var G = new Set(/* @__PURE__ */ "DCA.DCB.DCD.DBA.DCS.DAC.DAD.DBD.DBB.DBC.DAY.DAU.DAG.DAI.DAJ.DAK.DAQ.DCF.DCG.DDE.DDF.DDG.DAH.DAZ.DCI.DCJ.DCK.DBN.DBG.DBS.DCU.DCE.DCL.DCM.DCN.DCO.DCP.DCQ.DCR.DDA.DDB.DDC.DDD.DAW.DAX.DDH.DDI.DDJ.DDK.DDL.DCT.DAL.DAM.DAN.DAO.DAR.DAS.DAT.DAV.DBH.DBI.DBJ.DBK.DBL.DBM.DCH".split(".")), Yn = /* @__PURE__ */ "issuerJurisdiction.expirationDate.documentNumber.firstName.middleName.lastName.dateOfBirth.sex.eyeColor.height.addressStreet.addressCity.addressPostalCode.issueDate.country.addressStreet2.hairColor.nameSuffix.vehicleClass.restrictionCodes.endorsementCodes.documentDiscriminator.inventoryControlNumber.raceEthnicity.organDonor.veteran.weight".split("."), Xn = /* @__PURE__ */ new Set([
2035
2094
  "expirationDate",
2036
2095
  "dateOfBirth",
2037
2096
  "issueDate"
2038
- ]), Gn = {
2097
+ ]), Zn = {
2039
2098
  DAJ: "issuerJurisdiction",
2040
2099
  DBA: "expirationDate",
2041
2100
  DAQ: "documentNumber",
@@ -2071,7 +2130,7 @@ function K(e, t, n) {
2071
2130
  let r = Number(e), i = Number(t), a = Number(n);
2072
2131
  if (Number.isInteger(r) && Number.isInteger(i) && Number.isInteger(a) && !(r < 1900 || r > 2100 || i < 1 || i > 12 || a < 1 || a > 31)) return `${String(r).padStart(4, "0")}-${String(i).padStart(2, "0")}-${String(a).padStart(2, "0")}`;
2073
2132
  }
2074
- function Kn(e, t) {
2133
+ function Qn(e, t) {
2075
2134
  return t ? e >= 30 ? 1900 + e : 2e3 + e : e >= 50 ? 1900 + e : 2e3 + e;
2076
2135
  }
2077
2136
  function q(e, t = !1) {
@@ -2080,7 +2139,7 @@ function q(e, t = !1) {
2080
2139
  let r = /^(\d{1,2})[/-](\d{1,2})[/-](\d{2,4})$/.exec(n);
2081
2140
  if (r) {
2082
2141
  let e = r[1], n = r[2], i = r[3];
2083
- return i.length === 2 && (i = String(Kn(Number(i), t))), K(i, e.padStart(2, "0"), n.padStart(2, "0"));
2142
+ return i.length === 2 && (i = String(Qn(Number(i), t))), K(i, e.padStart(2, "0"), n.padStart(2, "0"));
2084
2143
  }
2085
2144
  let i = /^(\d{4})-(\d{2})-(\d{2})$/.exec(n);
2086
2145
  if (i) return K(i[1], i[2], i[3]);
@@ -2090,11 +2149,11 @@ function q(e, t = !1) {
2090
2149
  return e >= 1900 && e <= 2100 ? K(a.slice(0, 4), a.slice(4, 6), a.slice(6, 8)) : K(a.slice(4, 8), a.slice(0, 2), a.slice(2, 4));
2091
2150
  }
2092
2151
  if (a.length === 6) {
2093
- let e = Kn(Number(a.slice(4, 6)), t);
2152
+ let e = Qn(Number(a.slice(4, 6)), t);
2094
2153
  return K(String(e), a.slice(0, 2), a.slice(2, 4));
2095
2154
  }
2096
2155
  }
2097
- function qn(e) {
2156
+ function $n(e) {
2098
2157
  let t = e.trim();
2099
2158
  if (!t || t === "@") return "";
2100
2159
  if (/^(ANSI|AAMVA)\b/.test(t)) {
@@ -2103,10 +2162,10 @@ function qn(e) {
2103
2162
  }
2104
2163
  return t;
2105
2164
  }
2106
- function Jn(e) {
2165
+ function er(e) {
2107
2166
  return (e.startsWith("DL") || e.startsWith("ID") || e.startsWith("ZV")) && e.length >= 5 && G.has(e.slice(2, 5)) ? e.slice(2) : e;
2108
2167
  }
2109
- function Yn(e, t) {
2168
+ function tr(e, t) {
2110
2169
  let n = 0;
2111
2170
  for (; n < e.length;) {
2112
2171
  let r = e.slice(n, n + 3);
@@ -2125,7 +2184,7 @@ function Yn(e, t) {
2125
2184
  (!(r in t) || a) && (t[r] = a), n = i, (e[n] === "\n" || e[n] === "\r" || e[n] === "") && (n += 1);
2126
2185
  }
2127
2186
  }
2128
- function Xn(e) {
2187
+ function nr(e) {
2129
2188
  let t = /(?:ANSI|AAMVA)\s?(\d{6})(\d{2})(\d{2})(\d{2})/.exec(e);
2130
2189
  if (t) return {
2131
2190
  iin: t[1],
@@ -2133,22 +2192,22 @@ function Xn(e) {
2133
2192
  jurisdictionVersion: t[3]
2134
2193
  };
2135
2194
  }
2136
- function Zn(e) {
2195
+ function rr(e) {
2137
2196
  let t = e.replace(/\r\n/g, "\n").replace(/\r/g, "\n"), n = {}, r = t.split("\n").flatMap((e) => e.split(""));
2138
2197
  if (r.some((e) => {
2139
- let t = Jn(qn(e));
2198
+ let t = er($n(e));
2140
2199
  return G.has(t.slice(0, 3));
2141
2200
  })) {
2142
2201
  for (let e of r) {
2143
- let t = Jn(qn(e));
2144
- t && Yn(t, n);
2202
+ let t = er($n(e));
2203
+ t && tr(t, n);
2145
2204
  }
2146
2205
  return n;
2147
2206
  }
2148
- return Yn(t, n), n;
2207
+ return tr(t, n), n;
2149
2208
  }
2150
- function Qn(e, t) {
2151
- if (Wn.has(t)) return q(e, t === "dateOfBirth") ?? e.trim();
2209
+ function ir(e, t) {
2210
+ if (Xn.has(t)) return q(e, t === "dateOfBirth") ?? e.trim();
2152
2211
  if (t === "issuerJurisdiction" || t === "country") return e.trim().toUpperCase();
2153
2212
  if (t === "addressPostalCode") {
2154
2213
  let t = e.trim();
@@ -2156,11 +2215,11 @@ function Qn(e, t) {
2156
2215
  }
2157
2216
  return e.trim();
2158
2217
  }
2159
- function $n(e) {
2218
+ function ar(e) {
2160
2219
  let t = {};
2161
2220
  for (let [n, r] of Object.entries(e)) {
2162
- let e = Gn[n];
2163
- e && r.trim() && (t[e] || (t[e] = Qn(r, e)));
2221
+ let e = Zn[n];
2222
+ e && r.trim() && (t[e] || (t[e] = ir(r, e)));
2164
2223
  }
2165
2224
  if (!t.firstName && e.DCT?.trim()) {
2166
2225
  let n = e.DCT.trim().split(/\s+/);
@@ -2168,29 +2227,29 @@ function $n(e) {
2168
2227
  }
2169
2228
  return t;
2170
2229
  }
2171
- function er(e) {
2172
- let t = Zn(e);
2230
+ function or(e) {
2231
+ let t = rr(e);
2173
2232
  return {
2174
2233
  rawElements: t,
2175
- fields: $n(t),
2176
- header: Xn(e)
2234
+ fields: ar(t),
2235
+ header: nr(e)
2177
2236
  };
2178
2237
  }
2179
- function tr() {
2238
+ function sr() {
2180
2239
  return {};
2181
2240
  }
2182
- function nr(e, t, n) {
2183
- for (let r of Un) t[r] && (e[r] = n);
2241
+ function cr(e, t, n) {
2242
+ for (let r of Yn) t[r] && (e[r] = n);
2184
2243
  return e;
2185
2244
  }
2186
2245
  //#endregion
2187
2246
  //#region src/sdk/face-model.ts
2188
- var rr = /* @__PURE__ */ new Map(), ir = 8400;
2189
- function ar(e, t) {
2247
+ var lr = /* @__PURE__ */ new Map(), ur = 8400;
2248
+ function dr(e, t) {
2190
2249
  let n = Math.max(0, Math.min(e.x + e.width, t.x + t.width) - Math.max(e.x, t.x)) * Math.max(0, Math.min(e.y + e.height, t.y + t.height) - Math.max(e.y, t.y));
2191
2250
  return n / Math.max(1, e.width * e.height + t.width * t.height - n);
2192
2251
  }
2193
- function or(e, t, n, r, i, a, o) {
2252
+ function fr(e, t, n, r, i, a, o) {
2194
2253
  return {
2195
2254
  x: (e - n / 2) / i * a,
2196
2255
  y: (t - r / 2) / i * o,
@@ -2198,39 +2257,39 @@ function or(e, t, n, r, i, a, o) {
2198
2257
  height: r / i * o
2199
2258
  };
2200
2259
  }
2201
- function sr(e, t, n) {
2260
+ function pr(e, t, n) {
2202
2261
  let r = t.length === 3 ? t[1] : t[0], i = t.length === 3 ? t[2] : t[1];
2203
- if (i !== 6 || r < 1) throw Error(`Face model expects [1, anchors, 6]. A 640 YOLOX-Nano face export is [1, ${ir}, 6].`);
2262
+ if (i !== 6 || r < 1) throw Error(`Face model expects [1, anchors, 6]. A 640 YOLOX-Nano face export is [1, ${ur}, 6].`);
2204
2263
  let a = n.confidence ?? .35, o = n.inputSize ?? 640, s = [];
2205
2264
  for (let t = 0; t < r; t += 1) {
2206
2265
  let r = t * i, c = e[r + 4] * e[r + 5];
2207
2266
  c < a || s.push({
2208
2267
  confidence: c,
2209
- bbox: or(e[r], e[r + 1], e[r + 2], e[r + 3], o, n.imageWidth, n.imageHeight)
2268
+ bbox: fr(e[r], e[r + 1], e[r + 2], e[r + 3], o, n.imageWidth, n.imageHeight)
2210
2269
  });
2211
2270
  }
2212
- return s.sort((e, t) => t.confidence - e.confidence).filter((e, t, n) => n.slice(0, t).every((t) => ar(e.bbox, t.bbox) < .45)).slice(0, 8);
2271
+ return s.sort((e, t) => t.confidence - e.confidence).filter((e, t, n) => n.slice(0, t).every((t) => dr(e.bbox, t.bbox) < .45)).slice(0, 8);
2213
2272
  }
2214
- async function cr(e, n, r = .35) {
2215
- let i = await M(e, { cloneCanvas: !1 }), a = await import("onnxruntime-web"), o = document.createElement("canvas");
2273
+ async function mr(e, n, r = .35) {
2274
+ let i = await N(e, { cloneCanvas: !1 }), a = await import("onnxruntime-web"), o = document.createElement("canvas");
2216
2275
  o.width = 640, o.height = 640;
2217
2276
  let s = o.getContext("2d", { willReadFrequently: !0 });
2218
2277
  if (!s) throw t();
2219
2278
  s.drawImage(i, 0, 0, 640, 640);
2220
2279
  let c = s.getImageData(0, 0, 640, 640).data, l = 409600, u = new Float32Array(l * 3);
2221
2280
  for (let e = 0; e < l; e += 1) u[e] = c[e * 4] / 255, u[l + e] = c[e * 4 + 1] / 255, u[l * 2 + e] = c[e * 4 + 2] / 255;
2222
- let d = rr.get(n);
2281
+ let d = lr.get(n);
2223
2282
  d || (d = a.InferenceSession.create(n, {
2224
2283
  executionProviders: ["wasm"],
2225
2284
  graphOptimizationLevel: "all"
2226
- }), rr.set(n, d));
2285
+ }), lr.set(n, d));
2227
2286
  let f = await d, p = (await f.run({ [f.inputNames[0]]: new a.Tensor("float32", u, [
2228
2287
  1,
2229
2288
  3,
2230
2289
  640,
2231
2290
  640
2232
2291
  ]) }))[f.outputNames[0]];
2233
- return sr(p.data, p.dims.map(Number), {
2292
+ return pr(p.data, p.dims.map(Number), {
2234
2293
  confidence: r,
2235
2294
  imageWidth: i.width,
2236
2295
  imageHeight: i.height,
@@ -2239,7 +2298,7 @@ async function cr(e, n, r = .35) {
2239
2298
  }
2240
2299
  //#endregion
2241
2300
  //#region src/sdk/field-model.ts
2242
- var lr = /* @__PURE__ */ new Map(), ur = [
2301
+ var hr = /* @__PURE__ */ new Map(), gr = [
2243
2302
  "person_name",
2244
2303
  "date_of_birth",
2245
2304
  "address",
@@ -2247,19 +2306,19 @@ var lr = /* @__PURE__ */ new Map(), ur = [
2247
2306
  "expiration_date",
2248
2307
  "postal_code",
2249
2308
  "state"
2250
- ], dr = 8400;
2251
- function fr(e) {
2309
+ ], _r = 8400;
2310
+ function vr(e) {
2252
2311
  return 5 + e;
2253
2312
  }
2254
- var pr = 640;
2255
- function mr(e, t) {
2313
+ var yr = 640;
2314
+ function br(e, t) {
2256
2315
  let n = Math.max(0, Math.min(e.bbox.x + e.bbox.width, t.bbox.x + t.bbox.width) - Math.max(e.bbox.x, t.bbox.x)) * Math.max(0, Math.min(e.bbox.y + e.bbox.height, t.bbox.y + t.bbox.height) - Math.max(e.bbox.y, t.bbox.y));
2257
2316
  return n / Math.max(1, e.bbox.width * e.bbox.height + t.bbox.width * t.bbox.height - n);
2258
2317
  }
2259
- function hr(e) {
2260
- return e.sort((e, t) => t.confidence - e.confidence).filter((e, t, n) => n.slice(0, t).every((t) => t.field !== e.field || mr(e, t) < .45)).slice(0, 30);
2318
+ function xr(e) {
2319
+ return e.sort((e, t) => t.confidence - e.confidence).filter((e, t, n) => n.slice(0, t).every((t) => t.field !== e.field || br(e, t) < .45)).slice(0, 30);
2261
2320
  }
2262
- function gr(e, t, n, r, i, a, o) {
2321
+ function Sr(e, t, n, r, i, a, o) {
2263
2322
  return {
2264
2323
  x: (e - n / 2) / i * a,
2265
2324
  y: (t - r / 2) / i * o,
@@ -2267,8 +2326,8 @@ function gr(e, t, n, r, i, a, o) {
2267
2326
  height: r / i * o
2268
2327
  };
2269
2328
  }
2270
- function _r(e, t) {
2271
- let n = fr(t);
2329
+ function Cr(e, t) {
2330
+ let n = vr(t);
2272
2331
  return e.length === 3 && e[0] === 1 && e[2] === n && e[1] > e[2] ? {
2273
2332
  anchors: e[1],
2274
2333
  features: n
@@ -2277,15 +2336,15 @@ function _r(e, t) {
2277
2336
  features: n
2278
2337
  } : null;
2279
2338
  }
2280
- function vr(e) {
2339
+ function wr(e) {
2281
2340
  return e.length === 3 && e[1] >= 5 && e[2] >= 1;
2282
2341
  }
2283
- function yr(e) {
2284
- let t = fr(e);
2285
- return /* @__PURE__ */ Error(`YOLOX field layout expects [1, anchors, ${t}] (cx, cy, w, h, objectness, ${e} class scores). A 640 YOLOX-Nano export with decode baked in is [1, ${dr}, ${t}].`);
2342
+ function Tr(e) {
2343
+ let t = vr(e);
2344
+ return /* @__PURE__ */ Error(`YOLOX field layout expects [1, anchors, ${t}] (cx, cy, w, h, objectness, ${e} class scores). A 640 YOLOX-Nano export with decode baked in is [1, ${_r}, ${t}].`);
2286
2345
  }
2287
- function br(e, t, n, r, i, a, o) {
2288
- if (!vr(t)) throw Error("Unsupported field-model YOLO output shape.");
2346
+ function Er(e, t, n, r, i, a, o) {
2347
+ if (!wr(t)) throw Error("Unsupported field-model YOLO output shape.");
2289
2348
  let s = t[1], c = t[2], l = [];
2290
2349
  for (let t = 0; t < c; t += 1) {
2291
2350
  let u = 0, d = 0;
@@ -2297,14 +2356,14 @@ function br(e, t, n, r, i, a, o) {
2297
2356
  !f || u < r || l.push({
2298
2357
  field: f,
2299
2358
  confidence: u,
2300
- bbox: gr(e[t], e[c + t], e[c * 2 + t], e[c * 3 + t], i, a, o)
2359
+ bbox: Sr(e[t], e[c + t], e[c * 2 + t], e[c * 3 + t], i, a, o)
2301
2360
  });
2302
2361
  }
2303
- return hr(l);
2362
+ return xr(l);
2304
2363
  }
2305
- function xr(e, t, n, r, i, a, o) {
2306
- let s = _r(t, n.length);
2307
- if (!s) throw yr(n.length);
2364
+ function Dr(e, t, n, r, i, a, o) {
2365
+ let s = Cr(t, n.length);
2366
+ if (!s) throw Tr(n.length);
2308
2367
  let c = [];
2309
2368
  for (let t = 0; t < s.anchors; t += 1) {
2310
2369
  let l = t * s.features, u = e[l + 4], d = 0, f = 0;
@@ -2316,43 +2375,43 @@ function xr(e, t, n, r, i, a, o) {
2316
2375
  !p || m < r || c.push({
2317
2376
  field: p,
2318
2377
  confidence: m,
2319
- bbox: gr(e[l], e[l + 1], e[l + 2], e[l + 3], i, a, o)
2378
+ bbox: Sr(e[l], e[l + 1], e[l + 2], e[l + 3], i, a, o)
2320
2379
  });
2321
2380
  }
2322
- return hr(c);
2381
+ return xr(c);
2323
2382
  }
2324
- function Sr(e, t, n) {
2325
- let r = n.classes ?? ur, i = n.confidence ?? .35, a = n.inputSize ?? pr, o = _r(t, r.length);
2383
+ function Or(e, t, n) {
2384
+ let r = n.classes ?? gr, i = n.confidence ?? .35, a = n.inputSize ?? yr, o = Cr(t, r.length);
2326
2385
  if (n.layout === "yolov8" && o) throw Error("This tensor is YOLOX [1, anchors, 5+classes]. Pass fieldLayout: 'yolox', or omit fieldLayout to detect it from the shape.");
2327
- return (n.layout ?? (o ? "yolox" : "yolov8")) === "yolox" ? xr(e, t, r, i, a, n.imageWidth, n.imageHeight) : br(e, t, r, i, a, n.imageWidth, n.imageHeight);
2386
+ return (n.layout ?? (o ? "yolox" : "yolov8")) === "yolox" ? Dr(e, t, r, i, a, n.imageWidth, n.imageHeight) : Er(e, t, r, i, a, n.imageWidth, n.imageHeight);
2328
2387
  }
2329
- async function Cr(e, n, r = ur, i = .35, a) {
2330
- let o = await M(e, { cloneCanvas: !1 }), s = import("onnxruntime-web"), c = pr, l = document.createElement("canvas");
2388
+ async function kr(e, n, r = gr, i = .35, a) {
2389
+ let o = await N(e, { cloneCanvas: !1 }), s = import("onnxruntime-web"), c = yr, l = document.createElement("canvas");
2331
2390
  l.width = c, l.height = c;
2332
2391
  let u = l.getContext("2d", { willReadFrequently: !0 });
2333
2392
  if (!u) throw t();
2334
2393
  u.drawImage(o, 0, 0, c, c);
2335
2394
  let d = u.getImageData(0, 0, c, c).data, f = c * c, p = new Float32Array(f * 3);
2336
2395
  for (let e = 0; e < f; e += 1) p[e] = d[e * 4] / 255, p[f + e] = d[e * 4 + 1] / 255, p[f * 2 + e] = d[e * 4 + 2] / 255;
2337
- let m = lr.get(n);
2396
+ let m = hr.get(n);
2338
2397
  m || (m = (async () => {
2339
2398
  try {
2340
- let [e, t] = await Promise.all([s, ae(n)]);
2399
+ let [e, t] = await Promise.all([s, se(n)]);
2341
2400
  return await e.InferenceSession.create(t, {
2342
2401
  executionProviders: ["wasm"],
2343
2402
  graphOptimizationLevel: "all"
2344
2403
  });
2345
2404
  } catch (e) {
2346
- throw lr.delete(n), e;
2405
+ throw hr.delete(n), e;
2347
2406
  }
2348
- })(), lr.set(n, m));
2407
+ })(), hr.set(n, m));
2349
2408
  let [h, g] = await Promise.all([s, m]), _ = (await g.run({ [g.inputNames[0]]: new h.Tensor("float32", p, [
2350
2409
  1,
2351
2410
  3,
2352
2411
  c,
2353
2412
  c
2354
2413
  ]) }))[g.outputNames[0]];
2355
- return Sr(_.data, _.dims.map(Number), {
2414
+ return Or(_.data, _.dims.map(Number), {
2356
2415
  classes: r,
2357
2416
  confidence: i,
2358
2417
  layout: a,
@@ -2363,12 +2422,12 @@ async function Cr(e, n, r = ur, i = .35, a) {
2363
2422
  }
2364
2423
  //#endregion
2365
2424
  //#region src/sdk/redact.ts
2366
- async function wr(e, n, r = {}) {
2425
+ async function Ar(e, n, r = {}) {
2367
2426
  await x("redaction");
2368
- let i = await M(e), a = i.getContext("2d");
2427
+ let i = await N(e), a = i.getContext("2d");
2369
2428
  if (!a) throw t();
2370
2429
  for (let e of n) {
2371
- let t = Je(e, i.width, i.height);
2430
+ let t = Xe(e, i.width, i.height);
2372
2431
  if (t.width < 1 || t.height < 1) continue;
2373
2432
  if ((e.mode ?? r.mode ?? "blackout") === "blackout") {
2374
2433
  a.fillStyle = "#050706", a.fillRect(t.x, t.y, t.width, t.height);
@@ -2384,7 +2443,7 @@ async function wr(e, n, r = {}) {
2384
2443
  }
2385
2444
  return {
2386
2445
  canvas: i,
2387
- blob: await qe(i, r.mimeType ?? "image/png", r.quality)
2446
+ blob: await Ye(i, r.mimeType ?? "image/png", r.quality)
2388
2447
  };
2389
2448
  }
2390
2449
  //#endregion
@@ -2398,7 +2457,7 @@ function J(e) {
2398
2457
  height: i - n
2399
2458
  };
2400
2459
  }
2401
- function Tr(e) {
2460
+ function jr(e) {
2402
2461
  let t = [], n = [...e].sort((e, t) => e.bbox.y + e.bbox.height / 2 - (t.bbox.y + t.bbox.height / 2) || e.bbox.x - t.bbox.x);
2403
2462
  for (let e of n) {
2404
2463
  let n = e.bbox.y + e.bbox.height / 2, r = t.find((t) => {
@@ -2420,7 +2479,7 @@ function Y(e, t, n = !1) {
2420
2479
  function X(e) {
2421
2480
  return e.reduce((e, t) => e + t.confidence, 0) / Math.max(1, e.length);
2422
2481
  }
2423
- function Er(e, t) {
2482
+ function Mr(e, t) {
2424
2483
  let n = e.mode, r = n === "case-insensitive", i = e.scope ?? "line", a;
2425
2484
  if (n === "regex") {
2426
2485
  let t = e.pattern ?? e.values?.[0];
@@ -2457,22 +2516,22 @@ function Er(e, t) {
2457
2516
  }
2458
2517
  return s;
2459
2518
  }
2460
- function Dr(e, t) {
2519
+ function Nr(e, t) {
2461
2520
  let n = e.labelMode !== "exact", r = Y(e.label, n, !0).split(" ");
2462
2521
  for (let e of t) for (let t = 0; t <= e.words.length - r.length; t += 1) {
2463
2522
  let i = e.words.slice(t, t + r.length);
2464
2523
  if (i.every((e, t) => Y(e.text, n, !0) === r[t])) return i;
2465
2524
  }
2466
2525
  }
2467
- function Or(e, t, n, r, i, a) {
2526
+ function Pr(e, t, n, r, i, a) {
2468
2527
  let o = a.window?.distance ?? .28, s = a.window?.crossAxis ?? .12, c = t.x + t.width / 2, l = t.y + t.height / 2;
2469
2528
  return e.filter((e) => {
2470
2529
  let a = e.bbox.x + e.bbox.width / 2, u = e.bbox.y + e.bbox.height / 2;
2471
2530
  return n === "right" ? e.bbox.x >= t.x + t.width && e.bbox.x - t.x - t.width <= r * o && Math.abs(u - l) <= i * s : n === "left" ? e.bbox.x + e.bbox.width <= t.x && t.x - e.bbox.x - e.bbox.width <= r * o && Math.abs(u - l) <= i * s : n === "below" ? e.bbox.y >= t.y + t.height && e.bbox.y - t.y - t.height <= i * o && Math.abs(a - c) <= r * s : e.bbox.y + e.bbox.height <= t.y && t.y - e.bbox.y - e.bbox.height <= i * o && Math.abs(a - c) <= r * s;
2472
2531
  });
2473
2532
  }
2474
- function kr(e, t, n, r, i, a = "label") {
2475
- let o = Dr(e, n);
2533
+ function Fr(e, t, n, r, i, a = "label") {
2534
+ let o = Nr(e, n);
2476
2535
  if (!o) return [];
2477
2536
  let s = J(o), c = new Set(o), l = t.filter((e) => !c.has(e)), u = e.direction === "any" ? [
2478
2537
  "right",
@@ -2481,7 +2540,7 @@ function kr(e, t, n, r, i, a = "label") {
2481
2540
  "above"
2482
2541
  ] : [e.direction], d;
2483
2542
  for (let t of u) {
2484
- let n = Tr(Or(l, s, t, r, i, e));
2543
+ let n = jr(Pr(l, s, t, r, i, e));
2485
2544
  for (let t of n) {
2486
2545
  if (e.valuePattern && !new RegExp(e.valuePattern, e.patternFlags).test(t.text)) continue;
2487
2546
  let n = t.bbox.x + t.bbox.width / 2, a = t.bbox.y + t.bbox.height / 2, o = s.x + s.width / 2, c = s.y + s.height / 2, l = Math.hypot((n - o) / r, (a - c) / i);
@@ -2502,7 +2561,7 @@ function kr(e, t, n, r, i, a = "label") {
2502
2561
  confidence: Math.max(0, X(d.words) * (1 - Math.min(.5, d.distance)))
2503
2562
  }];
2504
2563
  }
2505
- var Ar = {
2564
+ var Ir = {
2506
2565
  person_name: [
2507
2566
  "LN",
2508
2567
  "FN",
@@ -2539,10 +2598,10 @@ var Ar = {
2539
2598
  "POSTAL"
2540
2599
  ],
2541
2600
  state: ["STATE", "DAJ"]
2542
- }, jr = new Set(Object.values(Ar).flat()), Mr = /^(?:\d{2}[/-]\d{2}[/-]\d{2,4}|\d{4}[/-]\d{2}[/-]\d{2}|\d{6}|\d{8})$/, Nr = /\b(?:ST|STREET|AVE|AVENUE|RD|ROAD|BLVD|BOULEVARD|LN|LANE|DR|DRIVE|WAY|CT|COURT)\b/i, Pr = /\b(?:DRIVER|LICENSE|IDENTIFICATION|CARD|CLASS|SEX|EYES|HEIGHT|RESTRICTIONS)\b/i;
2601
+ }, Lr = new Set(Object.values(Ir).flat()), Rr = /^(?:\d{2}[/-]\d{2}[/-]\d{2,4}|\d{4}[/-]\d{2}[/-]\d{2}|\d{6}|\d{8})$/, zr = /\b(?:ST|STREET|AVE|AVENUE|RD|ROAD|BLVD|BOULEVARD|LN|LANE|DR|DRIVE|WAY|CT|COURT)\b/i, Br = /\b(?:DRIVER|LICENSE|IDENTIFICATION|CARD|CLASS|SEX|EYES|HEIGHT|RESTRICTIONS)\b/i;
2543
2602
  function Z(e, t) {
2544
2603
  let n = t.trim();
2545
- return n ? e === "date_of_birth" || e === "expiration_date" ? Mr.test(n.replace(/\s/g, "")) : e === "postal_code" ? /^(?:\d{5}(?:-\d{4})?|[A-Z]\d[A-Z]\s?\d[A-Z]\d)$/i.test(n) : e === "state" ? /^[A-Z]{2}$/i.test(n) : e === "document_number" ? /^(?=.*\d)[A-Z0-9-]{5,20}$/i.test(n) : e === "person_name" ? !/\d/.test(n) && /^[A-ZÀ-ÖØ-öø-ÿ' -]{3,}$/i.test(n) && !Pr.test(n) : /\d/.test(n) && /[A-Z]/i.test(n) : !1;
2604
+ return n ? e === "date_of_birth" || e === "expiration_date" ? Rr.test(n.replace(/\s/g, "")) : e === "postal_code" ? /^(?:\d{5}(?:-\d{4})?|[A-Z]\d[A-Z]\s?\d[A-Z]\d)$/i.test(n) : e === "state" ? /^[A-Z]{2}$/i.test(n) : e === "document_number" ? /^(?=.*\d)[A-Z0-9-]{5,20}$/i.test(n) : e === "person_name" ? !/\d/.test(n) && /^[A-ZÀ-ÖØ-öø-ÿ' -]{3,}$/i.test(n) && !Br.test(n) : /\d/.test(n) && /[A-Z]/i.test(n) : !1;
2546
2605
  }
2547
2606
  function Q(e, t, n, r, i = 1) {
2548
2607
  return {
@@ -2554,17 +2613,17 @@ function Q(e, t, n, r, i = 1) {
2554
2613
  confidence: Math.max(0, Math.min(1, X(n) * i))
2555
2614
  };
2556
2615
  }
2557
- function Fr(e, t, n) {
2558
- let r = Ar[e], i = [];
2616
+ function Vr(e, t, n) {
2617
+ let r = Ir[e], i = [];
2559
2618
  for (let a of n) for (let n = 0; n < a.words.length; n += 1) {
2560
2619
  let o = a.words[n].text.toUpperCase().replace(/[^A-Z0-9]/g, ""), s = r.find((e) => o === e || o.startsWith(e));
2561
2620
  if (!s) continue;
2562
2621
  let c, l;
2563
- o === s ? (c = a.words.slice(n + 1).filter((e) => !jr.has(e.text.toUpperCase().replace(/[^A-Z0-9]/g, ""))), l = c.map((e) => e.text).join(" ")) : (c = [a.words[n]], l = a.words[n].text.replace(RegExp(`^${s}[:\\s-]*`, "i"), "")), c.length && Z(e, l) && i.push(Q(t, "alias", c, l, .98));
2622
+ o === s ? (c = a.words.slice(n + 1).filter((e) => !Lr.has(e.text.toUpperCase().replace(/[^A-Z0-9]/g, ""))), l = c.map((e) => e.text).join(" ")) : (c = [a.words[n]], l = a.words[n].text.replace(RegExp(`^${s}[:\\s-]*`, "i"), "")), c.length && Z(e, l) && i.push(Q(t, "alias", c, l, .98));
2564
2623
  }
2565
2624
  return i;
2566
2625
  }
2567
- function Ir(e, t, n) {
2626
+ function Hr(e, t, n) {
2568
2627
  let r = n.filter((e) => {
2569
2628
  let t = e.text.replace(/\s/g, "");
2570
2629
  return t.includes("<<") || /^[A-Z0-9<]{25,}$/.test(t);
@@ -2586,7 +2645,7 @@ function Ir(e, t, n) {
2586
2645
  }
2587
2646
  return [];
2588
2647
  }
2589
- function Lr(e) {
2648
+ function Ur(e) {
2590
2649
  let t = e.replace(/\s/g, ""), n = t.match(/\d{4}/)?.[0];
2591
2650
  if (n) return Number(n);
2592
2651
  let r = t.match(/^\d{2}/)?.[0];
@@ -2594,16 +2653,16 @@ function Lr(e) {
2594
2653
  let i = Number(r);
2595
2654
  return i > (/* @__PURE__ */ new Date()).getFullYear() % 100 ? 1900 + i : 2e3 + i;
2596
2655
  }
2597
- function Rr(e, t, n, r, i) {
2656
+ function Wr(e, t, n, r, i) {
2598
2657
  if (e === "address") {
2599
- let e = r.findIndex((e) => /\d/.test(e.text) && Nr.test(e.text));
2658
+ let e = r.findIndex((e) => /\d/.test(e.text) && zr.test(e.text));
2600
2659
  if (e < 0) return [];
2601
2660
  let n = [...r[e].words], i = r[e + 1];
2602
2661
  return i && /(?:\b[A-Z]{2}\b.*\d{5}|\d{5})/i.test(i.text) && n.push(...i.words), [Q(t, "layout", n, void 0, .76)];
2603
2662
  }
2604
2663
  if (e === "person_name") {
2605
2664
  let e = r.map((e) => {
2606
- let t = e.words.filter((e) => /^[A-ZÀ-ÖØ-öø-ÿ'-]+$/i.test(e.text)), n = e.bbox.y / Math.max(1, i), r = t.length >= 2 && t.length <= 5 && t.length === e.words.length && !Pr.test(e.text) && !Nr.test(e.text) && !e.text.includes("<"), a = e.text.replace(/[^A-Z]/g, "").length / Math.max(1, e.text.replace(/[^A-Za-z]/g, "").length);
2665
+ let t = e.words.filter((e) => /^[A-ZÀ-ÖØ-öø-ÿ'-]+$/i.test(e.text)), n = e.bbox.y / Math.max(1, i), r = t.length >= 2 && t.length <= 5 && t.length === e.words.length && !Br.test(e.text) && !zr.test(e.text) && !e.text.includes("<"), a = e.text.replace(/[^A-Z]/g, "").length / Math.max(1, e.text.replace(/[^A-Za-z]/g, "").length);
2607
2666
  return {
2608
2667
  line: e,
2609
2668
  score: r ? .45 + X(e.words) * .3 + a * .15 + (n < .65 ? .1 : 0) : 0
@@ -2612,9 +2671,9 @@ function Rr(e, t, n, r, i) {
2612
2671
  return !e.length || e[1] && e[0].score - e[1].score < .04 ? [] : [Q(t, "layout", e[0].line.words, void 0, e[0].score)];
2613
2672
  }
2614
2673
  if (e === "date_of_birth" || e === "expiration_date") {
2615
- let r = (/* @__PURE__ */ new Date()).getFullYear(), i = n.filter((e) => Mr.test(e.text.replace(/\s/g, ""))).map((e) => ({
2674
+ let r = (/* @__PURE__ */ new Date()).getFullYear(), i = n.filter((e) => Rr.test(e.text.replace(/\s/g, ""))).map((e) => ({
2616
2675
  word: e,
2617
- year: Lr(e.text)
2676
+ year: Ur(e.text)
2618
2677
  })).filter((e) => e.year !== void 0), a = e === "date_of_birth" ? i.filter((e) => e.year <= r - 14 && e.year >= r - 120) : i.filter((e) => e.year >= r - 1);
2619
2678
  return a.sort((t, n) => e === "date_of_birth" ? t.year - n.year : n.year - t.year), a.length ? [Q(t, "layout", [a[0].word], void 0, .72)] : [];
2620
2679
  }
@@ -2632,29 +2691,29 @@ function Rr(e, t, n, r, i) {
2632
2691
  }
2633
2692
  return [];
2634
2693
  }
2635
- function zr(e, t) {
2694
+ function Gr(e, t) {
2636
2695
  return Math.max(0, Math.min(e.x + e.width, t.x + t.width) - Math.max(e.x, t.x)) * Math.max(0, Math.min(e.y + e.height, t.y + t.height) - Math.max(e.y, t.y)) / Math.max(1, t.width * t.height);
2637
2696
  }
2638
- function Br(e, t, n, r) {
2639
- let i = Fr(e.field, e.id, n), a = Ir(e.field, e.id, n);
2640
- return i.length || a.length ? [...i, ...a] : Rr(e.field, e.id, t, n, r);
2697
+ function Kr(e, t, n, r) {
2698
+ let i = Vr(e.field, e.id, n), a = Hr(e.field, e.id, n);
2699
+ return i.length || a.length ? [...i, ...a] : Wr(e.field, e.id, t, n, r);
2641
2700
  }
2642
- function Vr(e, t, n) {
2701
+ function qr(e, t, n) {
2643
2702
  let r = (n ?? []).filter((t) => t.field === e.field).sort((e, t) => t.confidence - e.confidence);
2644
2703
  for (let n of r) {
2645
- let r = t.filter((e) => zr(n.bbox, e.bbox) >= .3);
2704
+ let r = t.filter((e) => Gr(n.bbox, e.bbox) >= .3);
2646
2705
  if (!r.length) continue;
2647
2706
  let i = r.map((e) => e.text).join(" ");
2648
2707
  if (Z(e.field, i)) return Q(e.id, "model", r, i, n.confidence);
2649
2708
  }
2650
2709
  }
2651
- function Hr(e, t, n, r, i, a) {
2652
- let o = Br(e, t, n, r);
2710
+ function Jr(e, t, n, r, i, a) {
2711
+ let o = Kr(e, t, n, r);
2653
2712
  if (e.detector !== "model" || !a) return o;
2654
- let s = Vr(e, t, i);
2713
+ let s = qr(e, t, i);
2655
2714
  return s ? [s] : [];
2656
2715
  }
2657
- function Ur(e, t, n, r) {
2716
+ function Yr(e, t, n, r) {
2658
2717
  let i = (e) => Math.max(0, Math.min(1, e)), a = i(e.rect.x), o = i(e.rect.y);
2659
2718
  return {
2660
2719
  ruleId: `${t}.${e.id}`,
@@ -2669,19 +2728,19 @@ function Ur(e, t, n, r) {
2669
2728
  confidence: 1
2670
2729
  };
2671
2730
  }
2672
- function Wr(e, t) {
2673
- let n = t.imageWidth ?? e?.imageWidth ?? 0, r = t.imageHeight ?? e?.imageHeight ?? 0, i = e?.words ?? [], a = Tr(i), o = [], s = [];
2731
+ function Xr(e, t) {
2732
+ let n = t.imageWidth ?? e?.imageWidth ?? 0, r = t.imageHeight ?? e?.imageHeight ?? 0, i = e?.words ?? [], a = jr(i), o = [], s = [];
2674
2733
  for (let e of t.rules) {
2675
- let c = e.strategy === "string" ? Er(e, a) : e.strategy === "label" ? kr(e, i, a, n, r) : Hr(e, i, a, r, t.semanticDetections, t.modelRequested === !0);
2734
+ let c = e.strategy === "string" ? Mr(e, a) : e.strategy === "label" ? Fr(e, i, a, n, r) : Jr(e, i, a, r, t.semanticDetections, t.modelRequested === !0);
2676
2735
  c.length ? o.push(...c) : s.push(e.id);
2677
2736
  }
2678
2737
  for (let e of t.template?.fields ?? []) {
2679
2738
  let c = `${t.template.id}.${e.id}`;
2680
2739
  if (e.strategy === "rect") {
2681
- n && r ? o.push(Ur(e, t.template.id, n, r)) : s.push(c);
2740
+ n && r ? o.push(Yr(e, t.template.id, n, r)) : s.push(c);
2682
2741
  continue;
2683
2742
  }
2684
- let l = kr({
2743
+ let l = Fr({
2685
2744
  ...e,
2686
2745
  id: c,
2687
2746
  strategy: "label"
@@ -2699,34 +2758,34 @@ function Wr(e, t) {
2699
2758
  confidence: u
2700
2759
  };
2701
2760
  }
2702
- function Gr(e) {
2761
+ function Zr(e) {
2703
2762
  return e.rules.length > 0 || e.template?.fields.some((e) => e.strategy === "anchor") === !0;
2704
2763
  }
2705
- function Kr(e, t = !1) {
2764
+ function Qr(e, t = !1) {
2706
2765
  return t && !e.complete ? "unmatched" : e.complete ? "success" : "partial";
2707
2766
  }
2708
- async function qr(e, t) {
2767
+ async function $r(e, t) {
2709
2768
  await x("redaction");
2710
- let n = await M(e, { cloneCanvas: !1 }), r = t.ocr;
2711
- Gr(t) && !r && (r = await B(n, { includeWords: !0 }));
2769
+ let n = await N(e, { cloneCanvas: !1 }), r = t.ocr;
2770
+ Zr(t) && !r && (r = await bn(n, { includeWords: !0 }));
2712
2771
  let i = t.semanticDetections, a = t.modelRequested === !0, o = "not-requested", s;
2713
2772
  if (t.models?.fields) try {
2714
- i = await Cr(n, t.models.fields, t.models.fieldClasses, t.models.confidence, t.models.fieldLayout), a = !0, o = "loaded";
2773
+ i = await kr(n, t.models.fields, t.models.fieldClasses, t.models.confidence, t.models.fieldLayout), a = !0, o = "loaded";
2715
2774
  } catch (e) {
2716
2775
  s = e instanceof Error ? e.message : "The field model could not load.";
2717
2776
  let n = t.models.allowHeuristicFallback !== !1;
2718
2777
  a = !n, o = n ? "fallback" : "failed";
2719
2778
  }
2720
- let c = Wr(r, {
2779
+ let c = Xr(r, {
2721
2780
  rules: t.rules,
2722
2781
  template: t.template,
2723
2782
  imageWidth: n.width,
2724
2783
  imageHeight: n.height,
2725
2784
  semanticDetections: i,
2726
2785
  modelRequested: a
2727
- }), l = Kr(c, t.requireAll), u = [], d = "not-requested", f;
2786
+ }), l = Qr(c, t.requireAll), u = [], d = "not-requested", f;
2728
2787
  if (t.models?.face) try {
2729
- u = await cr(n, t.models.face, t.models.faceConfidence), d = "loaded";
2788
+ u = await mr(n, t.models.face, t.models.faceConfidence), d = "loaded";
2730
2789
  } catch (e) {
2731
2790
  f = e instanceof Error ? e.message : "The face model could not load.", d = "failed";
2732
2791
  }
@@ -2740,7 +2799,7 @@ async function qr(e, t) {
2740
2799
  faceStatus: d,
2741
2800
  faceError: f
2742
2801
  };
2743
- let p = await wr(n, [...c.matches.map((e) => ({
2802
+ let p = await Ar(n, [...c.matches.map((e) => ({
2744
2803
  ...e.bbox,
2745
2804
  mode: t.style?.mode
2746
2805
  })), ...u.map((e) => ({
@@ -2762,7 +2821,7 @@ async function qr(e, t) {
2762
2821
  }
2763
2822
  //#endregion
2764
2823
  //#region src/sdk/driver-license.ts
2765
- var Jr = [
2824
+ var ei = [
2766
2825
  {
2767
2826
  id: "issuerJurisdiction",
2768
2827
  strategy: "semantic",
@@ -2799,7 +2858,7 @@ var Jr = [
2799
2858
  field: "person_name"
2800
2859
  }
2801
2860
  ];
2802
- function Yr(e, t, n) {
2861
+ function ti(e, t, n) {
2803
2862
  let r = n.trim();
2804
2863
  if (r) {
2805
2864
  if (t === "expirationDate" || t === "dateOfBirth" || t === "issueDate") {
@@ -2813,8 +2872,8 @@ function Yr(e, t, n) {
2813
2872
  e[t] = r;
2814
2873
  }
2815
2874
  }
2816
- function Xr(e) {
2817
- let t = {}, n = Wr(e, { rules: Jr });
2875
+ function ni(e) {
2876
+ let t = {}, n = Xr(e, { rules: ei });
2818
2877
  for (let e of n.matches) {
2819
2878
  let n = e.text?.trim();
2820
2879
  if (n) {
@@ -2823,29 +2882,29 @@ function Xr(e) {
2823
2882
  !t.firstName && e[0] && (t.firstName = e[0]), !t.lastName && e.length > 1 && (t.lastName = e[e.length - 1]), !t.middleName && e.length > 2 && (t.middleName = e.slice(1, -1).join(" "));
2824
2883
  continue;
2825
2884
  }
2826
- Yr(t, e.ruleId, n);
2885
+ ti(t, e.ruleId, n);
2827
2886
  }
2828
2887
  }
2829
2888
  return t;
2830
2889
  }
2831
- function Zr(e, t) {
2832
- let n = { ...e }, r = nr(tr(), e, "barcode");
2890
+ function ri(e, t) {
2891
+ let n = { ...e }, r = cr(sr(), e, "barcode");
2833
2892
  for (let [e, i] of Object.entries(t)) i && (n[e] || (n[e] = i, r[e] = "ocr"));
2834
2893
  return {
2835
2894
  fields: n,
2836
2895
  sources: r
2837
2896
  };
2838
2897
  }
2839
- async function Qr(e, t, n) {
2840
- return t?.status === "success" && t.corners ? ut(e, t.corners, { maxOutputDimension: n?.maxOutputDimension }) : I(e, n);
2898
+ async function ii(e, t, n) {
2899
+ return t?.status === "success" && t.corners ? ft(e, t.corners, { maxOutputDimension: n?.maxOutputDimension }) : L(e, n);
2841
2900
  }
2842
- async function $r(e, t, n) {
2901
+ async function ai(e, t, n) {
2843
2902
  if (!e.width || !e.height) return {
2844
2903
  kind: "retry",
2845
2904
  status: "frontFailed",
2846
2905
  message: "The front photo was empty. Try again."
2847
2906
  };
2848
- let r = await Qr(e, t, n);
2907
+ let r = await ii(e, t, n);
2849
2908
  if (r.status !== "success" || !r.canvas) return {
2850
2909
  kind: "retry",
2851
2910
  status: "frontFailed",
@@ -2853,7 +2912,7 @@ async function $r(e, t, n) {
2853
2912
  };
2854
2913
  let i;
2855
2914
  try {
2856
- i = await B(r.canvas, { includeWords: !0 });
2915
+ i = await bn(r.canvas, { includeWords: !0 });
2857
2916
  } catch {
2858
2917
  i = void 0;
2859
2918
  }
@@ -2869,7 +2928,7 @@ async function $r(e, t, n) {
2869
2928
  function $() {
2870
2929
  return new DOMException("The barcode scan was cancelled.", "AbortError");
2871
2930
  }
2872
- function ei(e, t) {
2931
+ function oi(e, t) {
2873
2932
  return new Promise((n, r) => {
2874
2933
  if (t?.aborted) {
2875
2934
  r($());
@@ -2883,21 +2942,21 @@ function ei(e, t) {
2883
2942
  t?.addEventListener("abort", a, { once: !0 });
2884
2943
  });
2885
2944
  }
2886
- async function ti(e, t = {}) {
2945
+ async function si(e, t = {}) {
2887
2946
  let n = t.intervalMs ?? 140;
2888
- for (;;) {
2947
+ for (await Un();;) {
2889
2948
  if (t.signal?.aborted) throw $();
2890
2949
  try {
2891
2950
  let t = await e();
2892
2951
  if (t?.width && t.height && (await W(t))?.text) return t;
2893
2952
  } catch (e) {
2894
2953
  if (t.signal?.aborted) throw $();
2895
- if (e instanceof DOMException && e.name === "AbortError") throw e;
2954
+ if (e instanceof DOMException && e.name === "AbortError" || e instanceof V) throw e;
2896
2955
  }
2897
- await ei(n, t.signal);
2956
+ await oi(n, t.signal);
2898
2957
  }
2899
2958
  }
2900
- async function ni(e, t) {
2959
+ async function ci(e, t) {
2901
2960
  if (!e.width || !e.height) return {
2902
2961
  status: "backFailed",
2903
2962
  fields: {},
@@ -2912,18 +2971,18 @@ async function ni(e, t) {
2912
2971
  barcodeText: n
2913
2972
  };
2914
2973
  if (!n) {
2915
- let e = t.ocr ? Xr(t.ocr) : {};
2974
+ let e = t.ocr ? ni(t.ocr) : {};
2916
2975
  return {
2917
2976
  status: "barcodeUnreadable",
2918
2977
  fields: e,
2919
2978
  rawElements: {},
2920
- sources: nr(tr(), e, "ocr"),
2979
+ sources: cr(sr(), e, "ocr"),
2921
2980
  front: t,
2922
2981
  back: r,
2923
2982
  message: "The PDF417 barcode on the back could not be read. Try again."
2924
2983
  };
2925
2984
  }
2926
- let i = er(n), a = t.ocr ? Xr(t.ocr) : {}, o = Zr(i.fields, a);
2985
+ let i = or(n), a = t.ocr ? ni(t.ocr) : {}, o = ri(i.fields, a);
2927
2986
  return {
2928
2987
  status: "success",
2929
2988
  fields: o.fields,
@@ -2933,10 +2992,10 @@ async function ni(e, t) {
2933
2992
  back: r
2934
2993
  };
2935
2994
  }
2936
- function ri(e) {
2995
+ function li(e) {
2937
2996
  return e === "back" ? 0 : void 0;
2938
2997
  }
2939
- function ii(e, t) {
2998
+ function ui(e, t) {
2940
2999
  return e === "front" ? {
2941
3000
  title: "Scan a driver’s license",
2942
3001
  headline: "Show the front of the license.",
@@ -2947,7 +3006,7 @@ function ii(e, t) {
2947
3006
  detail: t ? "Take a photo of the entire PDF417 barcode. There is no document outline." : "Keep the entire PDF417 in the preview. Closer is fine if the whole code is visible."
2948
3007
  };
2949
3008
  }
2950
- async function ai(e = {}) {
3009
+ async function di(e = {}) {
2951
3010
  await x("scan"), await x("ocr");
2952
3011
  let t = "front", n, r = !1;
2953
3012
  return {
@@ -2961,10 +3020,10 @@ async function ai(e = {}) {
2961
3020
  message: "This license scan was cancelled."
2962
3021
  };
2963
3022
  if (t === "front") {
2964
- let r = await $r(i, a, e.scan);
3023
+ let r = await ai(i, a, e.scan);
2965
3024
  return r.kind === "need-back" && (n = r.front, t = "back"), r;
2966
3025
  }
2967
- let o = await ni(i, n ?? {});
3026
+ let o = await ci(i, n ?? {});
2968
3027
  return o.status === "backFailed" ? {
2969
3028
  kind: "retry",
2970
3029
  status: "backFailed",
@@ -2980,6 +3039,6 @@ async function ai(e = {}) {
2980
3039
  };
2981
3040
  }
2982
3041
  //#endregion
2983
- export { b as $, I as A, ce as B, Nt as C, ut as D, Ye as E, De as F, le as G, ye as H, j as I, ve as J, ue as K, k as L, dt as M, _e as N, lt as O, ge as P, x as Q, se as R, jt as S, Rt as T, A as U, be as V, Le as W, a as X, re as Y, o as Z, Pt as _, ai as a, St as b, qr as c, er as d, y as et, V as f, Et as g, B as h, Zr as i, ft as j, Qe as k, wr as l, Pn as m, ri as n, t as nt, ti as o, W as p, Fe as q, ii as r, Wr as s, Xr as t, e as tt, q as u, Tt as v, xt as w, Mt as x, Ct as y, Ie as z };
3042
+ export { x as $, L as A, ue as B, Ft as C, ft as D, Ze as E, ke as F, de as G, O as H, M as I, Le as J, pe as K, D as L, pt as M, ye as N, dt as O, ve as P, o as Q, le as R, Nt as S, Bt as T, A as U, xe as V, ze as W, ie as X, be as Y, a as Z, It as _, di as a, wt as b, $r as c, or as d, b as et, Pn as f, Ot as g, bn as h, ri as i, mt as j, et as k, Ar as l, zn as m, li as n, e as nt, si as o, W as p, fe as q, ui as r, t as rt, Xr as s, ni as t, y as tt, q as u, Dt as v, Ct as w, Pt as x, Tt as y, Re as z };
2984
3043
 
2985
- //# sourceMappingURL=driver-license-CBDCGp14.js.map
3044
+ //# sourceMappingURL=driver-license-DWQiITx8.js.map