idmission-web-sdk 2.2.34 → 2.2.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/dist/components/CompositeWizard.d.ts +1 -2
  2. package/dist/components/CompositeWizard.d.ts.map +1 -1
  3. package/dist/components/camera/CameraAccessDeniedOverlay.d.ts.map +1 -1
  4. package/dist/components/camera/CameraVideoTag.d.ts +2 -4
  5. package/dist/components/camera/CameraVideoTag.d.ts.map +1 -1
  6. package/dist/components/camera/MicrophoneAccessDeniedOverlay.d.ts.map +1 -1
  7. package/dist/components/common/debug.d.ts.map +1 -1
  8. package/dist/components/customer_flows/CustomerBiometricsEnrollment.d.ts.map +1 -1
  9. package/dist/components/customer_flows/CustomerIdAndBiometricsEnrollment.d.ts.map +1 -1
  10. package/dist/components/customer_flows/CustomerIdentification.d.ts.map +1 -1
  11. package/dist/components/customer_flows/CustomerVerification.d.ts.map +1 -1
  12. package/dist/components/customer_flows/DocumentCapture.d.ts.map +1 -1
  13. package/dist/components/customer_flows/FaceValidation.d.ts.map +1 -1
  14. package/dist/components/customer_flows/IdAndFaceValidation.d.ts.map +1 -1
  15. package/dist/components/customer_flows/IdValidation.d.ts.map +1 -1
  16. package/dist/components/customer_flows/VideoIdValidation.d.ts.map +1 -1
  17. package/dist/components/customer_identification/CustomerIdentificationWizard.d.ts +1 -1
  18. package/dist/components/customer_identification/CustomerIdentificationWizard.d.ts.map +1 -1
  19. package/dist/components/customer_verification/CustomerVerificationWizard.d.ts.map +1 -1
  20. package/dist/components/document_capture/DocumentCaptureScreen.d.ts.map +1 -1
  21. package/dist/components/document_capture/DocumentCaptureStateProvider.d.ts.map +1 -1
  22. package/dist/components/face_liveness/FaceLivenessWizard.d.ts.map +1 -1
  23. package/dist/components/id_capture/DocumentDetectionModelProvider.d.ts.map +1 -1
  24. package/dist/components/id_capture/FocusModelProvider.d.ts.map +1 -1
  25. package/dist/components/id_capture/IdCapture.d.ts.map +1 -1
  26. package/dist/components/id_capture/IdCaptureGuideOverlay.d.ts.map +1 -1
  27. package/dist/components/id_capture/IdCaptureGuides.d.ts.map +1 -1
  28. package/dist/components/id_capture/IdCaptureGuidesCommon.d.ts.map +1 -1
  29. package/dist/components/id_capture/IdCaptureLoadingGraphic.d.ts.map +1 -1
  30. package/dist/components/id_capture/IdCaptureLoadingOverlayDefault.d.ts.map +1 -1
  31. package/dist/components/id_capture/IdCaptureLoadingOverlayLegacy.d.ts.map +1 -1
  32. package/dist/components/id_capture/IdCaptureWizard.d.ts.map +1 -1
  33. package/dist/components/selfie_capture/SelfieCapture.d.ts.map +1 -1
  34. package/dist/components/selfie_capture/SelfieCaptureLoadingGraphic.d.ts.map +1 -1
  35. package/dist/components/selfie_capture/SelfieCaptureLoadingOverlayDefault.d.ts.map +1 -1
  36. package/dist/components/selfie_capture/SelfieCaptureLoadingOverlayLegacy.d.ts.map +1 -1
  37. package/dist/components/selfie_capture/SelfieGuidanceModelsProvider.d.ts.map +1 -1
  38. package/dist/components/video_id/IdVideoCapture.d.ts +1 -1
  39. package/dist/components/video_id/IdVideoCapture.d.ts.map +1 -1
  40. package/dist/components/video_id/IdVideoCaptureFlipIdPrompt.d.ts.map +1 -1
  41. package/dist/components/video_id/IdVideoCaptureGuides.d.ts.map +1 -1
  42. package/dist/components/video_id/IdVideoCaptureWizard.d.ts.map +1 -1
  43. package/dist/components/video_signature_capture/VideoSignatureCapture.d.ts.map +1 -1
  44. package/dist/components/video_signature_capture/VideoSignatureWizard.d.ts.map +1 -1
  45. package/dist/lib/camera/Camera.d.ts +4 -0
  46. package/dist/lib/camera/Camera.d.ts.map +1 -1
  47. package/dist/lib/camera/cameraStore.d.ts +52 -0
  48. package/dist/lib/camera/cameraStore.d.ts.map +1 -0
  49. package/dist/lib/camera/videoRefStack.d.ts +6 -0
  50. package/dist/lib/camera/videoRefStack.d.ts.map +1 -0
  51. package/dist/lib/models/DocumentDetection.d.ts +3 -1
  52. package/dist/lib/models/DocumentDetection.d.ts.map +1 -1
  53. package/dist/lib/models/FaceDetection.d.ts +3 -1
  54. package/dist/lib/models/FaceDetection.d.ts.map +1 -1
  55. package/dist/lib/models/Focus.d.ts +3 -1
  56. package/dist/lib/models/Focus.d.ts.map +1 -1
  57. package/dist/sdk2.cjs.development.js +1277 -1169
  58. package/dist/sdk2.cjs.development.js.map +1 -1
  59. package/dist/sdk2.cjs.production.js +1 -1
  60. package/dist/sdk2.cjs.production.js.map +1 -1
  61. package/dist/sdk2.esm.js +1277 -1169
  62. package/dist/sdk2.esm.js.map +1 -1
  63. package/dist/sdk2.umd.development.js +1675 -1450
  64. package/dist/sdk2.umd.development.js.map +1 -1
  65. package/dist/sdk2.umd.production.js +1 -1
  66. package/dist/sdk2.umd.production.js.map +1 -1
  67. package/dist/version.d.ts +1 -1
  68. package/package.json +5 -4
  69. package/dist/components/camera/CameraProvider.d.ts +0 -17
  70. package/dist/components/camera/CameraProvider.d.ts.map +0 -1
@@ -211,7 +211,7 @@
211
211
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
212
212
  };
213
213
 
214
- var webSdkVersion = '2.2.34';
214
+ var webSdkVersion = '2.2.36';
215
215
 
216
216
  function getPlatform() {
217
217
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -372,7 +372,7 @@
372
372
  });
373
373
  }
374
374
 
375
- var PageContainerDiv = styled.div(templateObject_1$J || (templateObject_1$J = __makeTemplateObject(["\n ", "\n\n ", "\n\n &.flex {\n display: flex;\n }\n\n &.padded {\n box-sizing: border-box;\n padding: 16px 24px;\n }\n"], ["\n ", "\n\n ", "\n\n &.flex {\n display: flex;\n }\n\n &.padded {\n box-sizing: border-box;\n padding: 16px 24px;\n }\n"])), function (props) {
375
+ var PageContainerDiv = styled.div(templateObject_1$L || (templateObject_1$L = __makeTemplateObject(["\n ", "\n\n ", "\n\n &.flex {\n display: flex;\n }\n\n &.padded {\n box-sizing: border-box;\n padding: 16px 24px;\n }\n"], ["\n ", "\n\n ", "\n\n &.flex {\n display: flex;\n }\n\n &.padded {\n box-sizing: border-box;\n padding: 16px 24px;\n }\n"])), function (props) {
376
376
  var _a;
377
377
  return props.theme.isFullscreen === false ? "" : "\n position: fixed;\n top: 0;\n left: 0;\n width: var(--app-width);\n height: calc(\n var(--app-height) - ".concat((_a = props.$heightOffset) !== null && _a !== void 0 ? _a : 0, "px\n );\n overflow-x: hidden;\n overflow-y: auto;\n ");
378
378
  }, function (props) {
@@ -412,7 +412,7 @@
412
412
  }, dimensionsCalculated && children);
413
413
  });
414
414
  PageContainer.displayName = 'PageContainer';
415
- var templateObject_1$J;
415
+ var templateObject_1$L;
416
416
 
417
417
  var LoaderButton = function LoaderButton(_a) {
418
418
  var children = _a.children,
@@ -471,30 +471,30 @@
471
471
  className: "ladda-label"
472
472
  }, children));
473
473
  };
474
- var StyledButton = styled.button(templateObject_1$I || (templateObject_1$I = __makeTemplateObject(["\n ", "\n\n /*!\n * Ladda\n * http://lab.hakim.se/ladda\n * MIT licensed\n *\n * Copyright (C) 2018 Hakim El Hattab, http://hakim.se\n */\n\n position: relative;\n\n .ladda-spinner {\n position: absolute;\n z-index: 2;\n display: inline-block;\n width: 32px;\n top: 50%;\n margin-top: 0;\n opacity: 0;\n pointer-events: none;\n }\n .ladda-label {\n position: relative;\n z-index: 3;\n }\n .ladda-progress {\n position: absolute;\n width: 0;\n height: 100%;\n left: 0;\n top: 0;\n background: rgba(0, 0, 0, 0.2);\n display: none;\n transition: 0.1s linear all !important;\n }\n &[data-loading] .ladda-progress {\n display: block;\n }\n\n transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important;\n\n .ladda-spinner,\n .ladda-label {\n transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important;\n }\n &[data-style='zoom-in'],\n &[data-style='zoom-in'] .ladda-spinner,\n &[data-style='zoom-in'] .ladda-label,\n &[data-style='zoom-out'],\n &[data-style='zoom-out'] .ladda-spinner,\n &[data-style='zoom-out'] .ladda-label {\n transition: 0.3s ease all !important;\n }\n &[data-style='expand-right'] .ladda-spinner {\n right: -6px;\n }\n &[data-style='expand-right'][data-size='s'] .ladda-spinner,\n &[data-style='expand-right'][data-size='xs'] .ladda-spinner {\n right: -12px;\n }\n &[data-style='expand-right'][data-loading] {\n padding-right: 56px;\n }\n &[data-style='expand-right'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n &[data-style='expand-right'][data-loading][data-size='s'],\n &[data-style='expand-right'][data-loading][data-size='xs'] {\n padding-right: 40px;\n }\n &[data-style='expand-left'] .ladda-spinner {\n left: 26px;\n }\n &[data-style='expand-left'][data-size='s'] .ladda-spinner,\n &[data-style='expand-left'][data-size='xs'] .ladda-spinner {\n left: 4px;\n }\n &[data-style='expand-left'][data-loading] {\n padding-left: 56px;\n }\n &[data-style='expand-left'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n &[data-style='expand-left'][data-loading][data-size='s'],\n &[data-style='expand-left'][data-loading][data-size='xs'] {\n padding-left: 40px;\n }\n &[data-style='expand-up'] {\n overflow: hidden;\n }\n &[data-style='expand-up'] .ladda-spinner {\n top: -32px;\n left: 50%;\n margin-left: 0;\n }\n &[data-style='expand-up'][data-loading] {\n padding-top: 54px;\n }\n &[data-style='expand-up'][data-loading] .ladda-spinner {\n opacity: 1;\n top: 26px;\n margin-top: 0;\n }\n &[data-style='expand-up'][data-loading][data-size='s'],\n &[data-style='expand-up'][data-loading][data-size='xs'] {\n padding-top: 32px;\n }\n &[data-style='expand-up'][data-loading][data-size='s'] .ladda-spinner,\n &[data-style='expand-up'][data-loading][data-size='xs'] .ladda-spinner {\n top: 4px;\n }\n &[data-style='expand-down'] {\n overflow: hidden;\n }\n &[data-style='expand-down'] .ladda-spinner {\n top: 62px;\n left: 50%;\n margin-left: 0;\n }\n &[data-style='expand-down'][data-size='s'] .ladda-spinner,\n &[data-style='expand-down'][data-size='xs'] .ladda-spinner {\n top: 40px;\n }\n &[data-style='expand-down'][data-loading] {\n padding-bottom: 54px;\n }\n &[data-style='expand-down'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n &[data-style='expand-down'][data-loading][data-size='s'],\n &[data-style='expand-down'][data-loading][data-size='xs'] {\n padding-bottom: 32px;\n }\n &[data-style='slide-left'] {\n overflow: hidden;\n }\n &[data-style='slide-left'] .ladda-label {\n position: relative;\n }\n &[data-style='slide-left'] .ladda-spinner {\n left: 100%;\n margin-left: 0;\n }\n &[data-style='slide-left'][data-loading] .ladda-label {\n opacity: 0;\n left: -100%;\n }\n &[data-style='slide-left'][data-loading] .ladda-spinner {\n opacity: 1;\n left: 50%;\n }\n &[data-style='slide-right'] {\n overflow: hidden;\n }\n &[data-style='slide-right'] .ladda-label {\n position: relative;\n }\n &[data-style='slide-right'] .ladda-spinner {\n right: 100%;\n margin-left: 0;\n left: 16px;\n }\n [dir='rtl'] &[data-style='slide-right'] .ladda-spinner {\n right: auto;\n }\n &[data-style='slide-right'][data-loading] .ladda-label {\n opacity: 0;\n left: 100%;\n }\n &[data-style='slide-right'][data-loading] .ladda-spinner {\n opacity: 1;\n left: 50%;\n }\n &[data-style='slide-up'] {\n overflow: hidden;\n }\n &[data-style='slide-up'] .ladda-label {\n position: relative;\n }\n &[data-style='slide-up'] .ladda-spinner {\n left: 50%;\n margin-left: 0;\n margin-top: 1em;\n }\n &[data-style='slide-up'][data-loading] .ladda-label {\n opacity: 0;\n top: -1em;\n }\n &[data-style='slide-up'][data-loading] .ladda-spinner {\n opacity: 1;\n margin-top: 0;\n }\n &[data-style='slide-down'] {\n overflow: hidden;\n }\n &[data-style='slide-down'] .ladda-label {\n position: relative;\n }\n &[data-style='slide-down'] .ladda-spinner {\n left: 50%;\n margin-left: 0;\n margin-top: -2em;\n }\n &[data-style='slide-down'][data-loading] .ladda-label {\n opacity: 0;\n top: 1em;\n }\n &[data-style='slide-down'][data-loading] .ladda-spinner {\n opacity: 1;\n margin-top: 0;\n }\n &[data-style='zoom-out'] {\n overflow: hidden;\n }\n &[data-style='zoom-out'] .ladda-spinner {\n left: 50%;\n margin-left: 32px;\n transform: scale(2.5);\n }\n &[data-style='zoom-out'] .ladda-label {\n position: relative;\n display: inline-block;\n }\n &[data-style='zoom-out'][data-loading] .ladda-label {\n opacity: 0;\n transform: scale(0.5);\n }\n &[data-style='zoom-out'][data-loading] .ladda-spinner {\n opacity: 1;\n margin-left: 0;\n transform: none;\n }\n &[data-style='zoom-in'] {\n overflow: hidden;\n }\n &[data-style='zoom-in'] .ladda-spinner {\n left: 50%;\n margin-left: -16px;\n transform: scale(0.2);\n }\n &[data-style='zoom-in'] .ladda-label {\n position: relative;\n display: inline-block;\n }\n &[data-style='zoom-in'][data-loading] .ladda-label {\n opacity: 0;\n transform: scale(2.2);\n }\n &[data-style='zoom-in'][data-loading] .ladda-spinner {\n opacity: 1;\n margin-left: 0;\n transform: none;\n }\n &[data-style='contract'] {\n overflow: hidden;\n width: 100px;\n }\n &[data-style='contract'] .ladda-spinner {\n left: 50%;\n margin-left: 0;\n }\n &[data-style='contract'][data-loading] {\n border-radius: 50%;\n width: 52px;\n }\n &[data-style='contract'][data-loading] .ladda-label {\n opacity: 0;\n }\n &[data-style='contract'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n &[data-style='contract-overlay'] {\n overflow: hidden;\n width: 100px;\n box-shadow: 0px 0px 0px 2000px rgba(0, 0, 0, 0);\n }\n &[data-style='contract-overlay'] .ladda-spinner {\n left: 50%;\n margin-left: 0;\n }\n &[data-style='contract-overlay'][data-loading] {\n border-radius: 50%;\n width: 52px;\n box-shadow: 0px 0px 0px 2000px rgba(0, 0, 0, 0.8);\n }\n &[data-style='contract-overlay'][data-loading] .ladda-label {\n opacity: 0;\n }\n &[data-style='contract-overlay'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n [dir='rtl'] .ladda-spinner > div {\n left: 25% !important;\n }\n"], ["\n ", "\n\n /*!\n * Ladda\n * http://lab.hakim.se/ladda\n * MIT licensed\n *\n * Copyright (C) 2018 Hakim El Hattab, http://hakim.se\n */\n\n position: relative;\n\n .ladda-spinner {\n position: absolute;\n z-index: 2;\n display: inline-block;\n width: 32px;\n top: 50%;\n margin-top: 0;\n opacity: 0;\n pointer-events: none;\n }\n .ladda-label {\n position: relative;\n z-index: 3;\n }\n .ladda-progress {\n position: absolute;\n width: 0;\n height: 100%;\n left: 0;\n top: 0;\n background: rgba(0, 0, 0, 0.2);\n display: none;\n transition: 0.1s linear all !important;\n }\n &[data-loading] .ladda-progress {\n display: block;\n }\n\n transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important;\n\n .ladda-spinner,\n .ladda-label {\n transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important;\n }\n &[data-style='zoom-in'],\n &[data-style='zoom-in'] .ladda-spinner,\n &[data-style='zoom-in'] .ladda-label,\n &[data-style='zoom-out'],\n &[data-style='zoom-out'] .ladda-spinner,\n &[data-style='zoom-out'] .ladda-label {\n transition: 0.3s ease all !important;\n }\n &[data-style='expand-right'] .ladda-spinner {\n right: -6px;\n }\n &[data-style='expand-right'][data-size='s'] .ladda-spinner,\n &[data-style='expand-right'][data-size='xs'] .ladda-spinner {\n right: -12px;\n }\n &[data-style='expand-right'][data-loading] {\n padding-right: 56px;\n }\n &[data-style='expand-right'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n &[data-style='expand-right'][data-loading][data-size='s'],\n &[data-style='expand-right'][data-loading][data-size='xs'] {\n padding-right: 40px;\n }\n &[data-style='expand-left'] .ladda-spinner {\n left: 26px;\n }\n &[data-style='expand-left'][data-size='s'] .ladda-spinner,\n &[data-style='expand-left'][data-size='xs'] .ladda-spinner {\n left: 4px;\n }\n &[data-style='expand-left'][data-loading] {\n padding-left: 56px;\n }\n &[data-style='expand-left'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n &[data-style='expand-left'][data-loading][data-size='s'],\n &[data-style='expand-left'][data-loading][data-size='xs'] {\n padding-left: 40px;\n }\n &[data-style='expand-up'] {\n overflow: hidden;\n }\n &[data-style='expand-up'] .ladda-spinner {\n top: -32px;\n left: 50%;\n margin-left: 0;\n }\n &[data-style='expand-up'][data-loading] {\n padding-top: 54px;\n }\n &[data-style='expand-up'][data-loading] .ladda-spinner {\n opacity: 1;\n top: 26px;\n margin-top: 0;\n }\n &[data-style='expand-up'][data-loading][data-size='s'],\n &[data-style='expand-up'][data-loading][data-size='xs'] {\n padding-top: 32px;\n }\n &[data-style='expand-up'][data-loading][data-size='s'] .ladda-spinner,\n &[data-style='expand-up'][data-loading][data-size='xs'] .ladda-spinner {\n top: 4px;\n }\n &[data-style='expand-down'] {\n overflow: hidden;\n }\n &[data-style='expand-down'] .ladda-spinner {\n top: 62px;\n left: 50%;\n margin-left: 0;\n }\n &[data-style='expand-down'][data-size='s'] .ladda-spinner,\n &[data-style='expand-down'][data-size='xs'] .ladda-spinner {\n top: 40px;\n }\n &[data-style='expand-down'][data-loading] {\n padding-bottom: 54px;\n }\n &[data-style='expand-down'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n &[data-style='expand-down'][data-loading][data-size='s'],\n &[data-style='expand-down'][data-loading][data-size='xs'] {\n padding-bottom: 32px;\n }\n &[data-style='slide-left'] {\n overflow: hidden;\n }\n &[data-style='slide-left'] .ladda-label {\n position: relative;\n }\n &[data-style='slide-left'] .ladda-spinner {\n left: 100%;\n margin-left: 0;\n }\n &[data-style='slide-left'][data-loading] .ladda-label {\n opacity: 0;\n left: -100%;\n }\n &[data-style='slide-left'][data-loading] .ladda-spinner {\n opacity: 1;\n left: 50%;\n }\n &[data-style='slide-right'] {\n overflow: hidden;\n }\n &[data-style='slide-right'] .ladda-label {\n position: relative;\n }\n &[data-style='slide-right'] .ladda-spinner {\n right: 100%;\n margin-left: 0;\n left: 16px;\n }\n [dir='rtl'] &[data-style='slide-right'] .ladda-spinner {\n right: auto;\n }\n &[data-style='slide-right'][data-loading] .ladda-label {\n opacity: 0;\n left: 100%;\n }\n &[data-style='slide-right'][data-loading] .ladda-spinner {\n opacity: 1;\n left: 50%;\n }\n &[data-style='slide-up'] {\n overflow: hidden;\n }\n &[data-style='slide-up'] .ladda-label {\n position: relative;\n }\n &[data-style='slide-up'] .ladda-spinner {\n left: 50%;\n margin-left: 0;\n margin-top: 1em;\n }\n &[data-style='slide-up'][data-loading] .ladda-label {\n opacity: 0;\n top: -1em;\n }\n &[data-style='slide-up'][data-loading] .ladda-spinner {\n opacity: 1;\n margin-top: 0;\n }\n &[data-style='slide-down'] {\n overflow: hidden;\n }\n &[data-style='slide-down'] .ladda-label {\n position: relative;\n }\n &[data-style='slide-down'] .ladda-spinner {\n left: 50%;\n margin-left: 0;\n margin-top: -2em;\n }\n &[data-style='slide-down'][data-loading] .ladda-label {\n opacity: 0;\n top: 1em;\n }\n &[data-style='slide-down'][data-loading] .ladda-spinner {\n opacity: 1;\n margin-top: 0;\n }\n &[data-style='zoom-out'] {\n overflow: hidden;\n }\n &[data-style='zoom-out'] .ladda-spinner {\n left: 50%;\n margin-left: 32px;\n transform: scale(2.5);\n }\n &[data-style='zoom-out'] .ladda-label {\n position: relative;\n display: inline-block;\n }\n &[data-style='zoom-out'][data-loading] .ladda-label {\n opacity: 0;\n transform: scale(0.5);\n }\n &[data-style='zoom-out'][data-loading] .ladda-spinner {\n opacity: 1;\n margin-left: 0;\n transform: none;\n }\n &[data-style='zoom-in'] {\n overflow: hidden;\n }\n &[data-style='zoom-in'] .ladda-spinner {\n left: 50%;\n margin-left: -16px;\n transform: scale(0.2);\n }\n &[data-style='zoom-in'] .ladda-label {\n position: relative;\n display: inline-block;\n }\n &[data-style='zoom-in'][data-loading] .ladda-label {\n opacity: 0;\n transform: scale(2.2);\n }\n &[data-style='zoom-in'][data-loading] .ladda-spinner {\n opacity: 1;\n margin-left: 0;\n transform: none;\n }\n &[data-style='contract'] {\n overflow: hidden;\n width: 100px;\n }\n &[data-style='contract'] .ladda-spinner {\n left: 50%;\n margin-left: 0;\n }\n &[data-style='contract'][data-loading] {\n border-radius: 50%;\n width: 52px;\n }\n &[data-style='contract'][data-loading] .ladda-label {\n opacity: 0;\n }\n &[data-style='contract'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n &[data-style='contract-overlay'] {\n overflow: hidden;\n width: 100px;\n box-shadow: 0px 0px 0px 2000px rgba(0, 0, 0, 0);\n }\n &[data-style='contract-overlay'] .ladda-spinner {\n left: 50%;\n margin-left: 0;\n }\n &[data-style='contract-overlay'][data-loading] {\n border-radius: 50%;\n width: 52px;\n box-shadow: 0px 0px 0px 2000px rgba(0, 0, 0, 0.8);\n }\n &[data-style='contract-overlay'][data-loading] .ladda-label {\n opacity: 0;\n }\n &[data-style='contract-overlay'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n [dir='rtl'] .ladda-spinner > div {\n left: 25% !important;\n }\n"])), function (props) {
474
+ var StyledButton = styled.button(templateObject_1$K || (templateObject_1$K = __makeTemplateObject(["\n ", "\n\n /*!\n * Ladda\n * http://lab.hakim.se/ladda\n * MIT licensed\n *\n * Copyright (C) 2018 Hakim El Hattab, http://hakim.se\n */\n\n position: relative;\n\n .ladda-spinner {\n position: absolute;\n z-index: 2;\n display: inline-block;\n width: 32px;\n top: 50%;\n margin-top: 0;\n opacity: 0;\n pointer-events: none;\n }\n .ladda-label {\n position: relative;\n z-index: 3;\n }\n .ladda-progress {\n position: absolute;\n width: 0;\n height: 100%;\n left: 0;\n top: 0;\n background: rgba(0, 0, 0, 0.2);\n display: none;\n transition: 0.1s linear all !important;\n }\n &[data-loading] .ladda-progress {\n display: block;\n }\n\n transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important;\n\n .ladda-spinner,\n .ladda-label {\n transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important;\n }\n &[data-style='zoom-in'],\n &[data-style='zoom-in'] .ladda-spinner,\n &[data-style='zoom-in'] .ladda-label,\n &[data-style='zoom-out'],\n &[data-style='zoom-out'] .ladda-spinner,\n &[data-style='zoom-out'] .ladda-label {\n transition: 0.3s ease all !important;\n }\n &[data-style='expand-right'] .ladda-spinner {\n right: -6px;\n }\n &[data-style='expand-right'][data-size='s'] .ladda-spinner,\n &[data-style='expand-right'][data-size='xs'] .ladda-spinner {\n right: -12px;\n }\n &[data-style='expand-right'][data-loading] {\n padding-right: 56px;\n }\n &[data-style='expand-right'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n &[data-style='expand-right'][data-loading][data-size='s'],\n &[data-style='expand-right'][data-loading][data-size='xs'] {\n padding-right: 40px;\n }\n &[data-style='expand-left'] .ladda-spinner {\n left: 26px;\n }\n &[data-style='expand-left'][data-size='s'] .ladda-spinner,\n &[data-style='expand-left'][data-size='xs'] .ladda-spinner {\n left: 4px;\n }\n &[data-style='expand-left'][data-loading] {\n padding-left: 56px;\n }\n &[data-style='expand-left'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n &[data-style='expand-left'][data-loading][data-size='s'],\n &[data-style='expand-left'][data-loading][data-size='xs'] {\n padding-left: 40px;\n }\n &[data-style='expand-up'] {\n overflow: hidden;\n }\n &[data-style='expand-up'] .ladda-spinner {\n top: -32px;\n left: 50%;\n margin-left: 0;\n }\n &[data-style='expand-up'][data-loading] {\n padding-top: 54px;\n }\n &[data-style='expand-up'][data-loading] .ladda-spinner {\n opacity: 1;\n top: 26px;\n margin-top: 0;\n }\n &[data-style='expand-up'][data-loading][data-size='s'],\n &[data-style='expand-up'][data-loading][data-size='xs'] {\n padding-top: 32px;\n }\n &[data-style='expand-up'][data-loading][data-size='s'] .ladda-spinner,\n &[data-style='expand-up'][data-loading][data-size='xs'] .ladda-spinner {\n top: 4px;\n }\n &[data-style='expand-down'] {\n overflow: hidden;\n }\n &[data-style='expand-down'] .ladda-spinner {\n top: 62px;\n left: 50%;\n margin-left: 0;\n }\n &[data-style='expand-down'][data-size='s'] .ladda-spinner,\n &[data-style='expand-down'][data-size='xs'] .ladda-spinner {\n top: 40px;\n }\n &[data-style='expand-down'][data-loading] {\n padding-bottom: 54px;\n }\n &[data-style='expand-down'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n &[data-style='expand-down'][data-loading][data-size='s'],\n &[data-style='expand-down'][data-loading][data-size='xs'] {\n padding-bottom: 32px;\n }\n &[data-style='slide-left'] {\n overflow: hidden;\n }\n &[data-style='slide-left'] .ladda-label {\n position: relative;\n }\n &[data-style='slide-left'] .ladda-spinner {\n left: 100%;\n margin-left: 0;\n }\n &[data-style='slide-left'][data-loading] .ladda-label {\n opacity: 0;\n left: -100%;\n }\n &[data-style='slide-left'][data-loading] .ladda-spinner {\n opacity: 1;\n left: 50%;\n }\n &[data-style='slide-right'] {\n overflow: hidden;\n }\n &[data-style='slide-right'] .ladda-label {\n position: relative;\n }\n &[data-style='slide-right'] .ladda-spinner {\n right: 100%;\n margin-left: 0;\n left: 16px;\n }\n [dir='rtl'] &[data-style='slide-right'] .ladda-spinner {\n right: auto;\n }\n &[data-style='slide-right'][data-loading] .ladda-label {\n opacity: 0;\n left: 100%;\n }\n &[data-style='slide-right'][data-loading] .ladda-spinner {\n opacity: 1;\n left: 50%;\n }\n &[data-style='slide-up'] {\n overflow: hidden;\n }\n &[data-style='slide-up'] .ladda-label {\n position: relative;\n }\n &[data-style='slide-up'] .ladda-spinner {\n left: 50%;\n margin-left: 0;\n margin-top: 1em;\n }\n &[data-style='slide-up'][data-loading] .ladda-label {\n opacity: 0;\n top: -1em;\n }\n &[data-style='slide-up'][data-loading] .ladda-spinner {\n opacity: 1;\n margin-top: 0;\n }\n &[data-style='slide-down'] {\n overflow: hidden;\n }\n &[data-style='slide-down'] .ladda-label {\n position: relative;\n }\n &[data-style='slide-down'] .ladda-spinner {\n left: 50%;\n margin-left: 0;\n margin-top: -2em;\n }\n &[data-style='slide-down'][data-loading] .ladda-label {\n opacity: 0;\n top: 1em;\n }\n &[data-style='slide-down'][data-loading] .ladda-spinner {\n opacity: 1;\n margin-top: 0;\n }\n &[data-style='zoom-out'] {\n overflow: hidden;\n }\n &[data-style='zoom-out'] .ladda-spinner {\n left: 50%;\n margin-left: 32px;\n transform: scale(2.5);\n }\n &[data-style='zoom-out'] .ladda-label {\n position: relative;\n display: inline-block;\n }\n &[data-style='zoom-out'][data-loading] .ladda-label {\n opacity: 0;\n transform: scale(0.5);\n }\n &[data-style='zoom-out'][data-loading] .ladda-spinner {\n opacity: 1;\n margin-left: 0;\n transform: none;\n }\n &[data-style='zoom-in'] {\n overflow: hidden;\n }\n &[data-style='zoom-in'] .ladda-spinner {\n left: 50%;\n margin-left: -16px;\n transform: scale(0.2);\n }\n &[data-style='zoom-in'] .ladda-label {\n position: relative;\n display: inline-block;\n }\n &[data-style='zoom-in'][data-loading] .ladda-label {\n opacity: 0;\n transform: scale(2.2);\n }\n &[data-style='zoom-in'][data-loading] .ladda-spinner {\n opacity: 1;\n margin-left: 0;\n transform: none;\n }\n &[data-style='contract'] {\n overflow: hidden;\n width: 100px;\n }\n &[data-style='contract'] .ladda-spinner {\n left: 50%;\n margin-left: 0;\n }\n &[data-style='contract'][data-loading] {\n border-radius: 50%;\n width: 52px;\n }\n &[data-style='contract'][data-loading] .ladda-label {\n opacity: 0;\n }\n &[data-style='contract'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n &[data-style='contract-overlay'] {\n overflow: hidden;\n width: 100px;\n box-shadow: 0px 0px 0px 2000px rgba(0, 0, 0, 0);\n }\n &[data-style='contract-overlay'] .ladda-spinner {\n left: 50%;\n margin-left: 0;\n }\n &[data-style='contract-overlay'][data-loading] {\n border-radius: 50%;\n width: 52px;\n box-shadow: 0px 0px 0px 2000px rgba(0, 0, 0, 0.8);\n }\n &[data-style='contract-overlay'][data-loading] .ladda-label {\n opacity: 0;\n }\n &[data-style='contract-overlay'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n [dir='rtl'] .ladda-spinner > div {\n left: 25% !important;\n }\n"], ["\n ", "\n\n /*!\n * Ladda\n * http://lab.hakim.se/ladda\n * MIT licensed\n *\n * Copyright (C) 2018 Hakim El Hattab, http://hakim.se\n */\n\n position: relative;\n\n .ladda-spinner {\n position: absolute;\n z-index: 2;\n display: inline-block;\n width: 32px;\n top: 50%;\n margin-top: 0;\n opacity: 0;\n pointer-events: none;\n }\n .ladda-label {\n position: relative;\n z-index: 3;\n }\n .ladda-progress {\n position: absolute;\n width: 0;\n height: 100%;\n left: 0;\n top: 0;\n background: rgba(0, 0, 0, 0.2);\n display: none;\n transition: 0.1s linear all !important;\n }\n &[data-loading] .ladda-progress {\n display: block;\n }\n\n transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important;\n\n .ladda-spinner,\n .ladda-label {\n transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important;\n }\n &[data-style='zoom-in'],\n &[data-style='zoom-in'] .ladda-spinner,\n &[data-style='zoom-in'] .ladda-label,\n &[data-style='zoom-out'],\n &[data-style='zoom-out'] .ladda-spinner,\n &[data-style='zoom-out'] .ladda-label {\n transition: 0.3s ease all !important;\n }\n &[data-style='expand-right'] .ladda-spinner {\n right: -6px;\n }\n &[data-style='expand-right'][data-size='s'] .ladda-spinner,\n &[data-style='expand-right'][data-size='xs'] .ladda-spinner {\n right: -12px;\n }\n &[data-style='expand-right'][data-loading] {\n padding-right: 56px;\n }\n &[data-style='expand-right'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n &[data-style='expand-right'][data-loading][data-size='s'],\n &[data-style='expand-right'][data-loading][data-size='xs'] {\n padding-right: 40px;\n }\n &[data-style='expand-left'] .ladda-spinner {\n left: 26px;\n }\n &[data-style='expand-left'][data-size='s'] .ladda-spinner,\n &[data-style='expand-left'][data-size='xs'] .ladda-spinner {\n left: 4px;\n }\n &[data-style='expand-left'][data-loading] {\n padding-left: 56px;\n }\n &[data-style='expand-left'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n &[data-style='expand-left'][data-loading][data-size='s'],\n &[data-style='expand-left'][data-loading][data-size='xs'] {\n padding-left: 40px;\n }\n &[data-style='expand-up'] {\n overflow: hidden;\n }\n &[data-style='expand-up'] .ladda-spinner {\n top: -32px;\n left: 50%;\n margin-left: 0;\n }\n &[data-style='expand-up'][data-loading] {\n padding-top: 54px;\n }\n &[data-style='expand-up'][data-loading] .ladda-spinner {\n opacity: 1;\n top: 26px;\n margin-top: 0;\n }\n &[data-style='expand-up'][data-loading][data-size='s'],\n &[data-style='expand-up'][data-loading][data-size='xs'] {\n padding-top: 32px;\n }\n &[data-style='expand-up'][data-loading][data-size='s'] .ladda-spinner,\n &[data-style='expand-up'][data-loading][data-size='xs'] .ladda-spinner {\n top: 4px;\n }\n &[data-style='expand-down'] {\n overflow: hidden;\n }\n &[data-style='expand-down'] .ladda-spinner {\n top: 62px;\n left: 50%;\n margin-left: 0;\n }\n &[data-style='expand-down'][data-size='s'] .ladda-spinner,\n &[data-style='expand-down'][data-size='xs'] .ladda-spinner {\n top: 40px;\n }\n &[data-style='expand-down'][data-loading] {\n padding-bottom: 54px;\n }\n &[data-style='expand-down'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n &[data-style='expand-down'][data-loading][data-size='s'],\n &[data-style='expand-down'][data-loading][data-size='xs'] {\n padding-bottom: 32px;\n }\n &[data-style='slide-left'] {\n overflow: hidden;\n }\n &[data-style='slide-left'] .ladda-label {\n position: relative;\n }\n &[data-style='slide-left'] .ladda-spinner {\n left: 100%;\n margin-left: 0;\n }\n &[data-style='slide-left'][data-loading] .ladda-label {\n opacity: 0;\n left: -100%;\n }\n &[data-style='slide-left'][data-loading] .ladda-spinner {\n opacity: 1;\n left: 50%;\n }\n &[data-style='slide-right'] {\n overflow: hidden;\n }\n &[data-style='slide-right'] .ladda-label {\n position: relative;\n }\n &[data-style='slide-right'] .ladda-spinner {\n right: 100%;\n margin-left: 0;\n left: 16px;\n }\n [dir='rtl'] &[data-style='slide-right'] .ladda-spinner {\n right: auto;\n }\n &[data-style='slide-right'][data-loading] .ladda-label {\n opacity: 0;\n left: 100%;\n }\n &[data-style='slide-right'][data-loading] .ladda-spinner {\n opacity: 1;\n left: 50%;\n }\n &[data-style='slide-up'] {\n overflow: hidden;\n }\n &[data-style='slide-up'] .ladda-label {\n position: relative;\n }\n &[data-style='slide-up'] .ladda-spinner {\n left: 50%;\n margin-left: 0;\n margin-top: 1em;\n }\n &[data-style='slide-up'][data-loading] .ladda-label {\n opacity: 0;\n top: -1em;\n }\n &[data-style='slide-up'][data-loading] .ladda-spinner {\n opacity: 1;\n margin-top: 0;\n }\n &[data-style='slide-down'] {\n overflow: hidden;\n }\n &[data-style='slide-down'] .ladda-label {\n position: relative;\n }\n &[data-style='slide-down'] .ladda-spinner {\n left: 50%;\n margin-left: 0;\n margin-top: -2em;\n }\n &[data-style='slide-down'][data-loading] .ladda-label {\n opacity: 0;\n top: 1em;\n }\n &[data-style='slide-down'][data-loading] .ladda-spinner {\n opacity: 1;\n margin-top: 0;\n }\n &[data-style='zoom-out'] {\n overflow: hidden;\n }\n &[data-style='zoom-out'] .ladda-spinner {\n left: 50%;\n margin-left: 32px;\n transform: scale(2.5);\n }\n &[data-style='zoom-out'] .ladda-label {\n position: relative;\n display: inline-block;\n }\n &[data-style='zoom-out'][data-loading] .ladda-label {\n opacity: 0;\n transform: scale(0.5);\n }\n &[data-style='zoom-out'][data-loading] .ladda-spinner {\n opacity: 1;\n margin-left: 0;\n transform: none;\n }\n &[data-style='zoom-in'] {\n overflow: hidden;\n }\n &[data-style='zoom-in'] .ladda-spinner {\n left: 50%;\n margin-left: -16px;\n transform: scale(0.2);\n }\n &[data-style='zoom-in'] .ladda-label {\n position: relative;\n display: inline-block;\n }\n &[data-style='zoom-in'][data-loading] .ladda-label {\n opacity: 0;\n transform: scale(2.2);\n }\n &[data-style='zoom-in'][data-loading] .ladda-spinner {\n opacity: 1;\n margin-left: 0;\n transform: none;\n }\n &[data-style='contract'] {\n overflow: hidden;\n width: 100px;\n }\n &[data-style='contract'] .ladda-spinner {\n left: 50%;\n margin-left: 0;\n }\n &[data-style='contract'][data-loading] {\n border-radius: 50%;\n width: 52px;\n }\n &[data-style='contract'][data-loading] .ladda-label {\n opacity: 0;\n }\n &[data-style='contract'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n &[data-style='contract-overlay'] {\n overflow: hidden;\n width: 100px;\n box-shadow: 0px 0px 0px 2000px rgba(0, 0, 0, 0);\n }\n &[data-style='contract-overlay'] .ladda-spinner {\n left: 50%;\n margin-left: 0;\n }\n &[data-style='contract-overlay'][data-loading] {\n border-radius: 50%;\n width: 52px;\n box-shadow: 0px 0px 0px 2000px rgba(0, 0, 0, 0.8);\n }\n &[data-style='contract-overlay'][data-loading] .ladda-label {\n opacity: 0;\n }\n &[data-style='contract-overlay'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n [dir='rtl'] .ladda-spinner > div {\n left: 25% !important;\n }\n"])), function (props) {
475
475
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
476
476
  return ((_a = props.theme.buttons) === null || _a === void 0 ? void 0 : _a.style) === 'bootstrap' && "\n border-radius: 0;\n font-family: inherit;\n font-size: inherit;\n line-height: inherit;\n text-transform: none;\n -webkit-appearance: button;\n \n &:not(:disabled),\n &[type='button']:not(:disabled),\n &[type='reset']:not(:disabled),\n &[type='submit']:not(:disabled) {\n cursor: pointer;\n }\n \n &:focus:not(:focus-visible) {\n outline: 0;\n }\n \n --bs-btn-padding-x: 0.75rem;\n --bs-btn-padding-y: 0.375rem;\n --bs-btn-font-family: ;\n --bs-btn-font-size: 1rem;\n --bs-btn-font-weight: 400;\n --bs-btn-line-height: 1.5;\n --bs-btn-color: var(--bs-body-color);\n --bs-btn-bg: transparent;\n --bs-btn-border-width: var(--bs-border-width);\n --bs-btn-border-color: transparent;\n --bs-btn-border-radius: var(--bs-border-radius);\n --bs-btn-hover-border-color: transparent;\n --bs-btn-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15),\n 0 1px 1px rgba(0, 0, 0, 0.075);\n --bs-btn-disabled-opacity: 0.65;\n --bs-btn-focus-box-shadow: 0 0 0 0.25rem\n rgba(var(--bs-btn-focus-shadow-rgb), 0.5);\n display: inline-block;\n padding: var(--bs-btn-padding-y) var(--bs-btn-padding-x);\n font-family: var(--bs-btn-font-family);\n font-size: var(--bs-btn-font-size);\n font-weight: var(--bs-btn-font-weight);\n line-height: var(--bs-btn-line-height);\n color: var(--bs-btn-color);\n text-align: center;\n text-decoration: none;\n vertical-align: middle;\n cursor: pointer;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n border: var(--bs-btn-border-width) solid var(--bs-btn-border-color);\n border-radius: var(--bs-btn-border-radius);\n background-color: var(--bs-btn-bg);\n //transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out,\n // border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;\n \n @media (prefers-reduced-motion: reduce) {\n transition: none;\n }\n \n &:hover {\n filter: brightness(1.15);\n }\n \n &:focus-visible {\n color: var(--bs-btn-hover-color);\n background-color: var(--bs-btn-hover-bg);\n border-color: var(--bs-btn-hover-border-color);\n outline: 0;\n box-shadow: var(--bs-btn-focus-box-shadow);\n }\n \n &:disabled,\n &.disabled,\n fieldset:disabled & {\n color: var(--bs-btn-disabled-color);\n pointer-events: none;\n background-color: var(--bs-btn-disabled-bg);\n border-color: var(--bs-btn-disabled-border-color);\n opacity: var(--bs-btn-disabled-opacity);\n }\n \n --bs-btn-color: ".concat((_f = (_b = props.$textColor) !== null && _b !== void 0 ? _b : (_e = (_c = props.theme.buttons) === null || _c === void 0 ? void 0 : _c[(_d = props.$variant) !== null && _d !== void 0 ? _d : 'primary']) === null || _e === void 0 ? void 0 : _e.textColor) !== null && _f !== void 0 ? _f : '#fff', ";\n --bs-btn-bg: ").concat((_l = (_g = props.$backgroundColor) !== null && _g !== void 0 ? _g : (_k = (_h = props.theme.buttons) === null || _h === void 0 ? void 0 : _h[(_j = props.$variant) !== null && _j !== void 0 ? _j : 'primary']) === null || _k === void 0 ? void 0 : _k.backgroundColor) !== null && _l !== void 0 ? _l : '#0d6efd', ";\n --bs-btn-border-color: var(--bs-btn-bg);\n --bs-btn-focus-shadow-rgb: 49, 132, 253;\n --bs-btn-active-color: #fff;\n --bs-btn-active-bg: #0a58ca;\n --bs-btn-active-border-color: #0a53be;\n --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);\n --bs-btn-disabled-color: ").concat((_q = (_m = props.$disabledTextColor) !== null && _m !== void 0 ? _m : (_p = (_o = props.theme.buttons) === null || _o === void 0 ? void 0 : _o.loading) === null || _p === void 0 ? void 0 : _p.textColor) !== null && _q !== void 0 ? _q : '#fff', ";\n --bs-btn-disabled-bg: ").concat((_u = (_r = props.$disabledBackgroundColor) !== null && _r !== void 0 ? _r : (_t = (_s = props.theme.buttons) === null || _s === void 0 ? void 0 : _s.loading) === null || _t === void 0 ? void 0 : _t.backgroundColor) !== null && _u !== void 0 ? _u : 'gray', ";\n --bs-btn-disabled-border-color: ").concat((_v = props.$disabledBackgroundColor) !== null && _v !== void 0 ? _v : '#0d6efd', ";\n \n --bs-btn-padding-y: 14px;\n --bs-btn-padding-x: 1rem;\n --bs-btn-font-size: 18px;\n --bs-btn-border-radius: 4px;\n ");
477
477
  });
478
- var templateObject_1$I;
478
+ var templateObject_1$K;
479
479
 
480
- var OverlayContainer = styled(PageContainer)(templateObject_1$H || (templateObject_1$H = __makeTemplateObject(["\n background: ", ";\n ", "\n z-index: 10000;\n"], ["\n background: ", ";\n ", "\n z-index: 10000;\n"])), function (props) {
480
+ var OverlayContainer = styled(PageContainer)(templateObject_1$J || (templateObject_1$J = __makeTemplateObject(["\n background: ", ";\n ", "\n z-index: 10000;\n"], ["\n background: ", ";\n ", "\n z-index: 10000;\n"])), function (props) {
481
481
  return props.theme.background ? "".concat(props.theme.background) : "white";
482
482
  }, function (props) {
483
483
  return props.theme.textColor ? "color: ".concat(props.theme.textColor, ";") : "";
484
484
  });
485
- var OverlayInner$2 = styled.div(templateObject_2$y || (templateObject_2$y = __makeTemplateObject(["\n text-align: ", ";\n display: flex;\n flex-direction: column;\n flex-wrap: nowrap;\n max-width: 100dvw;\n max-height: 100dvh;\n width: 100%;\n height: 100%;\n ", "\n"], ["\n text-align: ", ";\n display: flex;\n flex-direction: column;\n flex-wrap: nowrap;\n max-width: 100dvw;\n max-height: 100dvh;\n width: 100%;\n height: 100%;\n ", "\n"])), function (props) {
485
+ var OverlayInner$2 = styled.div(templateObject_2$A || (templateObject_2$A = __makeTemplateObject(["\n text-align: ", ";\n display: flex;\n flex-direction: column;\n flex-wrap: nowrap;\n max-width: 100dvw;\n max-height: 100dvh;\n width: 100%;\n height: 100%;\n ", "\n"], ["\n text-align: ", ";\n display: flex;\n flex-direction: column;\n flex-wrap: nowrap;\n max-width: 100dvw;\n max-height: 100dvh;\n width: 100%;\n height: 100%;\n ", "\n"])), function (props) {
486
486
  var _a;
487
487
  return (_a = props.theme.textAlign) !== null && _a !== void 0 ? _a : 'center';
488
488
  }, function (props) {
489
489
  return props.theme.padding ? "box-sizing: border-box; padding: ".concat(props.theme.padding, ";") : "";
490
490
  });
491
- var OverlayImageContainer = styled.div(templateObject_3$p || (templateObject_3$p = __makeTemplateObject(["\n position: relative;\n display: flex;\n flex-grow: 1;\n padding-bottom: 25px;\n max-width: 100dvw;\n max-height: 100dvh;\n overflow: hidden;\n\n & > img,\n & > svg {\n margin: 0 auto;\n width: max-content;\n max-width: 100%;\n max-height: 100%;\n aspect-ratio: initial;\n object-fit: contain;\n display: block;\n }\n"], ["\n position: relative;\n display: flex;\n flex-grow: 1;\n padding-bottom: 25px;\n max-width: 100dvw;\n max-height: 100dvh;\n overflow: hidden;\n\n & > img,\n & > svg {\n margin: 0 auto;\n width: max-content;\n max-width: 100%;\n max-height: 100%;\n aspect-ratio: initial;\n object-fit: contain;\n display: block;\n }\n"])));
492
- var OverlayImageRow = styled.div(templateObject_4$j || (templateObject_4$j = __makeTemplateObject(["\n display: flex;\n margin: auto;\n\n & > div {\n max-height: calc(100vh - 320px);\n\n & > img {\n width: 100%;\n max-height: 100%;\n height: auto;\n object-fit: contain;\n }\n }\n"], ["\n display: flex;\n margin: auto;\n\n & > div {\n max-height: calc(100vh - 320px);\n\n & > img {\n width: 100%;\n max-height: 100%;\n height: auto;\n object-fit: contain;\n }\n }\n"])));
493
- var GrayOverlayContainer = styled(OverlayContainer)(templateObject_5$b || (templateObject_5$b = __makeTemplateObject(["\n background: #f7f6fb;\n"], ["\n background: #f7f6fb;\n"])));
494
- var ButtonsColumn = styled.div(templateObject_6$8 || (templateObject_6$8 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n gap: 15px 0;\n justify-content: center;\n margin-top: 24px;\n"], ["\n display: flex;\n flex-direction: column;\n gap: 15px 0;\n justify-content: center;\n margin-top: 24px;\n"])));
495
- var WideButton = styled(LoaderButton)(templateObject_7$5 || (templateObject_7$5 = __makeTemplateObject(["\n width: 100%;\n border-radius: 30px;\n"], ["\n width: 100%;\n border-radius: 30px;\n"])));
491
+ var OverlayImageContainer = styled.div(templateObject_3$r || (templateObject_3$r = __makeTemplateObject(["\n position: relative;\n display: flex;\n flex-grow: 1;\n padding-bottom: 25px;\n max-width: 100dvw;\n max-height: 100dvh;\n overflow: hidden;\n\n & > img,\n & > svg {\n margin: 0 auto;\n width: max-content;\n max-width: 100%;\n max-height: 100%;\n aspect-ratio: initial;\n object-fit: contain;\n display: block;\n }\n"], ["\n position: relative;\n display: flex;\n flex-grow: 1;\n padding-bottom: 25px;\n max-width: 100dvw;\n max-height: 100dvh;\n overflow: hidden;\n\n & > img,\n & > svg {\n margin: 0 auto;\n width: max-content;\n max-width: 100%;\n max-height: 100%;\n aspect-ratio: initial;\n object-fit: contain;\n display: block;\n }\n"])));
492
+ var OverlayImageRow = styled.div(templateObject_4$l || (templateObject_4$l = __makeTemplateObject(["\n display: flex;\n margin: auto;\n\n & > div {\n max-height: calc(100vh - 320px);\n\n & > img {\n width: 100%;\n max-height: 100%;\n height: auto;\n object-fit: contain;\n }\n }\n"], ["\n display: flex;\n margin: auto;\n\n & > div {\n max-height: calc(100vh - 320px);\n\n & > img {\n width: 100%;\n max-height: 100%;\n height: auto;\n object-fit: contain;\n }\n }\n"])));
493
+ var GrayOverlayContainer = styled(OverlayContainer)(templateObject_5$c || (templateObject_5$c = __makeTemplateObject(["\n background: #f7f6fb;\n"], ["\n background: #f7f6fb;\n"])));
494
+ var ButtonsColumn = styled.div(templateObject_6$9 || (templateObject_6$9 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n gap: 15px 0;\n justify-content: center;\n margin-top: 24px;\n"], ["\n display: flex;\n flex-direction: column;\n gap: 15px 0;\n justify-content: center;\n margin-top: 24px;\n"])));
495
+ var WideButton = styled(LoaderButton)(templateObject_7$6 || (templateObject_7$6 = __makeTemplateObject(["\n width: 100%;\n border-radius: 30px;\n"], ["\n width: 100%;\n border-radius: 30px;\n"])));
496
496
  var WideBorderButton = styled(WideButton)(templateObject_8$3 || (templateObject_8$3 = __makeTemplateObject(["\n color: black;\n background: white;\n border: 1px solid var(--idm-color-secondary-500);\n box-sizing: border-box;\n"], ["\n color: black;\n background: white;\n border: 1px solid var(--idm-color-secondary-500);\n box-sizing: border-box;\n"])));
497
- var templateObject_1$H, templateObject_2$y, templateObject_3$p, templateObject_4$j, templateObject_5$b, templateObject_6$8, templateObject_7$5, templateObject_8$3;
497
+ var templateObject_1$J, templateObject_2$A, templateObject_3$r, templateObject_4$l, templateObject_5$c, templateObject_6$9, templateObject_7$6, templateObject_8$3;
498
498
 
499
499
  function _extends() {
500
500
  return _extends = Object.assign ? Object.assign.bind() : function (n) {
@@ -1049,13 +1049,13 @@
1049
1049
  }, retryText)))));
1050
1050
  };
1051
1051
 
1052
- var wavesAnimation = styled.keyframes(templateObject_1$G || (templateObject_1$G = __makeTemplateObject(["\n 0% {\n opacity: 0;\n transform: scale3d(1, 1, 1);\n }\n 80% {\n opacity: 1;\n }\n 100% {\n transform: scale3d(2, 2, 1);\n opacity: 0;\n }\n"], ["\n 0% {\n opacity: 0;\n transform: scale3d(1, 1, 1);\n }\n 80% {\n opacity: 1;\n }\n 100% {\n transform: scale3d(2, 2, 1);\n opacity: 0;\n }\n"])));
1053
- var progressBarAnimation = styled.keyframes(templateObject_2$x || (templateObject_2$x = __makeTemplateObject(["\n 0% {\n width: 0;\n }\n 100% {\n width: 100%;\n }\n"], ["\n 0% {\n width: 0;\n }\n 100% {\n width: 100%;\n }\n"])));
1054
- var dualRingSpinnerAnimation = styled.keyframes(templateObject_3$o || (templateObject_3$o = __makeTemplateObject(["\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n"], ["\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n"])));
1055
- var progressBorderAnimation = styled.keyframes(templateObject_4$i || (templateObject_4$i = __makeTemplateObject(["\n to {\n stroke-dashoffset: 0;\n }\n"], ["\n to {\n stroke-dashoffset: 0;\n }\n"])));
1056
- var templateObject_1$G, templateObject_2$x, templateObject_3$o, templateObject_4$i;
1052
+ var wavesAnimation = styled.keyframes(templateObject_1$I || (templateObject_1$I = __makeTemplateObject(["\n 0% {\n opacity: 0;\n transform: scale3d(1, 1, 1);\n }\n 80% {\n opacity: 1;\n }\n 100% {\n transform: scale3d(2, 2, 1);\n opacity: 0;\n }\n"], ["\n 0% {\n opacity: 0;\n transform: scale3d(1, 1, 1);\n }\n 80% {\n opacity: 1;\n }\n 100% {\n transform: scale3d(2, 2, 1);\n opacity: 0;\n }\n"])));
1053
+ var progressBarAnimation = styled.keyframes(templateObject_2$z || (templateObject_2$z = __makeTemplateObject(["\n 0% {\n width: 0;\n }\n 100% {\n width: 100%;\n }\n"], ["\n 0% {\n width: 0;\n }\n 100% {\n width: 100%;\n }\n"])));
1054
+ var dualRingSpinnerAnimation = styled.keyframes(templateObject_3$q || (templateObject_3$q = __makeTemplateObject(["\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n"], ["\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n"])));
1055
+ var progressBorderAnimation = styled.keyframes(templateObject_4$k || (templateObject_4$k = __makeTemplateObject(["\n to {\n stroke-dashoffset: 0;\n }\n"], ["\n to {\n stroke-dashoffset: 0;\n }\n"])));
1056
+ var templateObject_1$I, templateObject_2$z, templateObject_3$q, templateObject_4$k;
1057
1057
 
1058
- var Spinner$1 = styled.div(templateObject_1$F || (templateObject_1$F = __makeTemplateObject(["\n display: inline-block;\n width: ", "px;\n height: ", "px;\n margin: auto;\n\n &:after {\n content: ' ';\n display: block;\n width: ", "px;\n height: ", "px;\n margin: 8px;\n border-radius: 50%;\n border: ", "px solid\n ", ";\n border-color: ", " transparent\n ", " transparent;\n animation: ", " 1.2s linear infinite;\n box-sizing: content-box;\n }\n"], ["\n display: inline-block;\n width: ", "px;\n height: ", "px;\n margin: auto;\n\n &:after {\n content: ' ';\n display: block;\n width: ", "px;\n height: ", "px;\n margin: 8px;\n border-radius: 50%;\n border: ", "px solid\n ", ";\n border-color: ", " transparent\n ", " transparent;\n animation: ", " 1.2s linear infinite;\n box-sizing: content-box;\n }\n"])), function (_a) {
1058
+ var Spinner$1 = styled.div(templateObject_1$H || (templateObject_1$H = __makeTemplateObject(["\n display: inline-block;\n width: ", "px;\n height: ", "px;\n margin: auto;\n\n &:after {\n content: ' ';\n display: block;\n width: ", "px;\n height: ", "px;\n margin: 8px;\n border-radius: 50%;\n border: ", "px solid\n ", ";\n border-color: ", " transparent\n ", " transparent;\n animation: ", " 1.2s linear infinite;\n box-sizing: content-box;\n }\n"], ["\n display: inline-block;\n width: ", "px;\n height: ", "px;\n margin: auto;\n\n &:after {\n content: ' ';\n display: block;\n width: ", "px;\n height: ", "px;\n margin: 8px;\n border-radius: 50%;\n border: ", "px solid\n ", ";\n border-color: ", " transparent\n ", " transparent;\n animation: ", " 1.2s linear infinite;\n box-sizing: content-box;\n }\n"])), function (_a) {
1059
1059
  var $size = _a.$size;
1060
1060
  return $size !== null && $size !== void 0 ? $size : 80;
1061
1061
  }, function (_a) {
@@ -1080,7 +1080,7 @@
1080
1080
  var $color = _a.$color;
1081
1081
  return $color !== null && $color !== void 0 ? $color : '#888';
1082
1082
  }, dualRingSpinnerAnimation);
1083
- var templateObject_1$F;
1083
+ var templateObject_1$H;
1084
1084
 
1085
1085
  exports.defaultAuthUrl = 'https://portal-api.idmission.com';
1086
1086
  var allowedAuthUrls = ['https://portal-api.idmission.com', 'https://portal-api-uat.idmission.com', 'https://portal-api-demo.idmission.com', 'https://portal-api-dev.idmission.com', 'http://localhost:10000'];
@@ -1088,11 +1088,11 @@
1088
1088
  if (!allowedAuthUrls.includes(url)) throw new Error('invalid auth url');
1089
1089
  exports.defaultAuthUrl = url;
1090
1090
  }
1091
- var initialState$5 = {
1091
+ var initialState$6 = {
1092
1092
  authUrl: exports.defaultAuthUrl,
1093
1093
  sessionCheckState: 'READY'
1094
1094
  };
1095
- var AuthStateContext = /*#__PURE__*/React.createContext(initialState$5);
1095
+ var AuthStateContext = /*#__PURE__*/React.createContext(initialState$6);
1096
1096
  var AuthDispatchContext = /*#__PURE__*/React.createContext(function () {});
1097
1097
  var reducer$4 = function reducer(state, action) {
1098
1098
  switch (action.type) {
@@ -1124,7 +1124,7 @@
1124
1124
  if (authUrl === void 0) {
1125
1125
  authUrl = exports.defaultAuthUrl;
1126
1126
  }
1127
- var _a = React.useReducer(reducer$4, _assign(_assign({}, initialState$5), {
1127
+ var _a = React.useReducer(reducer$4, _assign(_assign({}, initialState$6), {
1128
1128
  authUrl: authUrl
1129
1129
  })),
1130
1130
  state = _a[0],
@@ -3037,721 +3037,119 @@
3037
3037
  }, [refCallback, size.width, size.height]);
3038
3038
  }
3039
3039
 
3040
- function getFrameDimensions(frame) {
3041
- var frameWidth = frame.width,
3042
- frameHeight = frame.height;
3043
- if (frame instanceof HTMLImageElement) {
3044
- frameWidth = frame.naturalWidth;
3045
- frameHeight = frame.naturalHeight;
3046
- }
3047
- if (frame instanceof HTMLVideoElement) {
3048
- frameWidth = frame.videoWidth;
3049
- frameHeight = frame.videoHeight;
3040
+ function _typeof$1(o) {
3041
+ "@babel/helpers - typeof";
3042
+
3043
+ return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
3044
+ return typeof o;
3045
+ } : function (o) {
3046
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
3047
+ }, _typeof$1(o);
3048
+ }
3049
+
3050
+ function toPrimitive(t, r) {
3051
+ if ("object" != _typeof$1(t) || !t) return t;
3052
+ var e = t[Symbol.toPrimitive];
3053
+ if (void 0 !== e) {
3054
+ var i = e.call(t, r);
3055
+ if ("object" != _typeof$1(i)) return i;
3056
+ throw new TypeError("@@toPrimitive must return a primitive value.");
3050
3057
  }
3051
- return [frameWidth, frameHeight];
3058
+ return (String )(t);
3052
3059
  }
3053
3060
 
3054
- var InvisibleCanvas = styled.canvas(templateObject_1$E || (templateObject_1$E = __makeTemplateObject(["\n display: none;\n"], ["\n display: none;\n"])));
3055
- function drawToCanvas(canvas, frame, width, height) {
3056
- if (!canvas) return;
3057
- var ctx = canvas.getContext('2d');
3058
- if (!ctx) return;
3059
- if (!width || !height) {
3060
- var _a = getFrameDimensions(frame),
3061
- frameWidth = _a[0],
3062
- frameHeight = _a[1];
3063
- width || (width = frameWidth);
3064
- height || (height = frameHeight);
3061
+ function toPropertyKey(t) {
3062
+ var i = toPrimitive(t, "string");
3063
+ return "symbol" == _typeof$1(i) ? i : i + "";
3064
+ }
3065
+
3066
+ function _defineProperties(e, r) {
3067
+ for (var t = 0; t < r.length; t++) {
3068
+ var o = r[t];
3069
+ o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey(o.key), o);
3065
3070
  }
3066
- canvas.width = width;
3067
- canvas.height = height;
3068
- ctx.drawImage(frame, 0, 0, width, height);
3069
3071
  }
3070
- function clearCanvas(canvas) {
3071
- var _a;
3072
- (_a = canvas === null || canvas === void 0 ? void 0 : canvas.getContext('2d')) === null || _a === void 0 ? void 0 : _a.clearRect(0, 0, canvas === null || canvas === void 0 ? void 0 : canvas.width, canvas === null || canvas === void 0 ? void 0 : canvas.height);
3072
+ function _createClass(e, r, t) {
3073
+ return r && _defineProperties(e.prototype, r), Object.defineProperty(e, "prototype", {
3074
+ writable: !1
3075
+ }), e;
3073
3076
  }
3074
- var templateObject_1$E;
3075
3077
 
3076
- function listAvailableCameras(facingMode_1) {
3077
- return __awaiter(this, arguments, void 0, function (facingMode, requestMicAccess) {
3078
- var cameraEnumerationStream, videoDevices;
3079
- if (requestMicAccess === void 0) {
3080
- requestMicAccess = false;
3081
- }
3082
- return __generator(this, function (_a) {
3083
- switch (_a.label) {
3084
- case 0:
3085
- return [4 /*yield*/, navigator.mediaDevices.getUserMedia({
3086
- video: {
3087
- facingMode: {
3088
- exact: facingMode
3089
- }
3090
- },
3091
- audio: requestMicAccess
3092
- })
3093
- // This lists all available cameras attached to the user's device.
3094
- ];
3095
- case 1:
3096
- cameraEnumerationStream = _a.sent();
3097
- return [4 /*yield*/, navigator.mediaDevices.enumerateDevices()];
3098
- case 2:
3099
- videoDevices = _a.sent().filter(function (_a) {
3100
- var kind = _a.kind;
3101
- return kind === 'videoinput';
3102
- });
3103
- // Release the access to the user's camera that we obtained for enumeration purposes.
3104
- cameraEnumerationStream.getVideoTracks().forEach(function (track) {
3105
- track.enabled = false;
3106
- track.stop();
3107
- });
3108
- cameraEnumerationStream = null;
3109
- return [2 /*return*/, videoDevices];
3110
- }
3111
- });
3112
- });
3078
+ function asyncGeneratorStep(n, t, e, r, o, a, c) {
3079
+ try {
3080
+ var i = n[a](c),
3081
+ u = i.value;
3082
+ } catch (n) {
3083
+ return void e(n);
3084
+ }
3085
+ i.done ? t(u) : Promise.resolve(u).then(r, o);
3113
3086
  }
3114
- var frontLabels = ['front', 'avant', 'anteriore', 'cameraaanvoorzijde', 'kamerapåframsidan', 'forsidekamera', 'kamerapåforsiden', 'aparatprzedni', 'etukamera', 'kameradepan', 'ÖnKamera', 'cameramặttrước', 'camerăfață', 'prednákamera', 'prednjakamera', 'előlapikamera', 'přednífotoaparát', 'μπροστινήκάμερα', 'переднякамера', 'передняякамера', 'преднакамера', 'алдыңғыкамера', 'מצלמה קדמית', 'الكاميرا الأمامية', 'फ़्रंटकैमरा', '前置相机', '前置鏡頭', '前面カメラ', '전면카메라', 'กล้องด้านหน้า'].map(function (s) {
3115
- return s.toLocaleLowerCase().split(' ').join('');
3116
- });
3117
- var rearLabels = ['back', 'rear', 'posterior', 'trasera', 'traseira', 'arrière', 'rückkamera', 'fotocamera(posteriore)', 'cameraaanachterzijde', 'kamerapåbaksidan', 'kamerapåbaksiden', 'bagsidekamera', 'aparattylny', 'takakamera', 'arkakamera', 'kamerabelakang', 'cameramặtsau', 'camerăspate', 'stražnjakamera', 'zadnákamera', 'hátoldalikamera', 'zadnífotoaparát', 'πίσωκάμερα', 'заднякамера', 'Задняякамера', 'заднакамера', 'артқыкамера', 'מצלמה אחורית', 'الكاميرا الخلفية', 'बैककैमरा', '后置相机', '後置鏡頭', '背面カメラ', '후면카메라', 'กล้องด้านหลัง'].map(function (s) {
3118
- return s.toLocaleLowerCase().split(' ').join('');
3119
- });
3120
- var backUltraWideLabels = ['backdualwidecamera', 'backultrawidecamera', 'ultraampliaposterior', 'ultra-angulartraseira', 'ultragrandeangulartraseira', 'ultragrandangle', 'ultragranangular', 'ultra-weitwinkelkamera', 'ultra-grandangolo', 'ultrabredecameraaanachterzijde', 'ultravidvinkelkamerapåbaksidan', 'ultravidvinkelkameraetpåbagsiden', 'ultravidvinkelkamerabak', 'ultragenişkameraarkayüzü', 'ultralaajakulmainentakakamera', 'tylnyaparatultraszerokokątny', 'cameracựcrộngmặtsau', 'camerăcuobiectivultra‑superangularspate', 'ultraszéleslátószögűkamera', 'kameraultralebarbelakang', 'stražnjaultraširokakamera', 'zadníultraširokoúhlýfotoaparát', 'ultraširokouhlá', 'πίσωυπερευρείακάμερα', 'заднянадширококутнакамера', 'Задняясверхширокоугольнаякамера', 'Задна свръх широкоъгълна камера', 'артқыультракеңбұрыштыкамера', 'מצלמה אולטרה רחבה אחורית', 'كاميرا خلفية عريضة جدًا', 'बैकअल्ट्रावाइडकैमरा', '后置超广角相机', '後置超廣角鏡頭相機', '背面超広角カメラ', '후면울트라와이드카메라', 'กล้องด้านหลังอัลตร้าไวด์'].map(function (s) {
3121
- return s.toLocaleLowerCase().split(' ').join('');
3122
- });
3123
- var labelMatches = function labelMatches(labelOrDevice, labelSetOrLabel) {
3124
- var label = labelOrDevice instanceof MediaDeviceInfo ? getDeviceLabel(labelOrDevice) : labelOrDevice;
3125
- var labelSet = typeof labelSetOrLabel === 'string' ? [labelSetOrLabel] : labelSetOrLabel;
3126
- return labelSet.some(function (l) {
3127
- return label.includes(l);
3128
- });
3129
- };
3130
- var getDeviceLabel = function getDeviceLabel(deviceInfo) {
3131
- return deviceInfo.label.toLocaleLowerCase().split(' ').join('');
3132
- };
3133
- var currentCamera;
3134
- var currentAudioStream;
3135
- function obtainCameraAccess(stream, deviceLabel, video) {
3136
- releaseCameraAccess();
3137
- log('obtaining camera access...');
3138
- var _a = stream.getVideoTracks()[0].getSettings(),
3139
- width = _a.width,
3140
- height = _a.height;
3141
- var label = deviceLabel.toLocaleLowerCase().split(' ').join('');
3142
- var isRearFacing = labelMatches(label, __spreadArray(__spreadArray(__spreadArray([], rearLabels, true), backUltraWideLabels, true), ['iphone'], false));
3143
- var release = function release() {
3144
- stream.getTracks().forEach(function (track) {
3145
- track.enabled = false;
3146
- track.stop();
3087
+ function _asyncToGenerator(n) {
3088
+ return function () {
3089
+ var t = this,
3090
+ e = arguments;
3091
+ return new Promise(function (r, o) {
3092
+ var a = n.apply(t, e);
3093
+ function _next(n) {
3094
+ asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
3095
+ }
3096
+ function _throw(n) {
3097
+ asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
3098
+ }
3099
+ _next(void 0);
3147
3100
  });
3148
- if (video) {
3149
- video.pause();
3150
- video.srcObject = null;
3151
- video.src = '';
3152
- }
3153
- };
3154
- width || (width = 0);
3155
- height || (height = 0);
3156
- currentCamera = {
3157
- label: deviceLabel,
3158
- stream: stream,
3159
- width: width,
3160
- height: height,
3161
- isRearFacing: isRearFacing,
3162
- release: release
3163
3101
  };
3164
- if (video) video.srcObject = stream;
3165
- return currentCamera;
3166
3102
  }
3167
- function releaseCameraAccess() {
3168
- if (!currentCamera) return;
3169
- log('releasing camera access...');
3170
- currentCamera.release();
3171
- currentCamera = undefined;
3103
+
3104
+ function _setPrototypeOf(t, e) {
3105
+ return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
3106
+ return t.__proto__ = e, t;
3107
+ }, _setPrototypeOf(t, e);
3172
3108
  }
3173
- function releaseMicrophoneAccess() {
3174
- var _a;
3175
- if (!currentAudioStream) return;
3176
- log('releasing microphone access...');
3177
- (_a = currentAudioStream.stop) === null || _a === void 0 ? void 0 : _a.call(currentAudioStream);
3178
- currentAudioStream.getAudioTracks().forEach(function (t) {
3179
- var _a;
3180
- (_a = t.stop) === null || _a === void 0 ? void 0 : _a.call(t);
3181
- });
3182
- currentAudioStream = undefined;
3109
+
3110
+ function _inheritsLoose(t, o) {
3111
+ t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
3183
3112
  }
3184
- function usePreferredCaptureDevice(_a) {
3185
- var _b = _a === void 0 ? {} : _a,
3186
- _c = _b.requestAccessAutomatically,
3187
- requestAccessAutomatically = _c === void 0 ? true : _c,
3188
- _d = _b.preferFrontFacingCamera,
3189
- preferFrontFacingCamera = _d === void 0 ? false : _d,
3190
- _e = _b.preferContinuityCamera,
3191
- preferContinuityCamera = _e === void 0 ? true : _e,
3192
- _f = _b.requireMicrophoneAccess,
3193
- requireMicrophoneAccess = _f === void 0 ? false : _f,
3194
- _g = _b.maxVideoWidth,
3195
- maxVideoWidth = _g === void 0 ? 1920 : _g,
3196
- maxFps = _b.maxFps,
3197
- _h = _b.debugMode,
3198
- debugMode = _h === void 0 ? false : _h;
3199
- var videoRef = React.useRef(null);
3200
- var videoRefStack = React.useRef([]);
3201
- var cameraRef = React.useRef(null);
3202
- var _j = React.useState(false),
3203
- cameraReady = _j[0],
3204
- setCameraReady = _j[1];
3205
- var _k = React.useState(false),
3206
- microphoneReady = _k[0],
3207
- setMicrophoneReady = _k[1];
3208
- var _l = React.useState(null),
3209
- videoDevice = _l[0],
3210
- setVideoDevice = _l[1];
3211
- var _m = React.useState(null),
3212
- audioStream = _m[0],
3213
- setAudioStream = _m[1];
3214
- var _o = React.useState(false),
3215
- videoLoaded = _o[0],
3216
- setVideoLoaded = _o[1];
3217
- var _p = React.useState(false),
3218
- iphoneContinuityCameraAvailable = _p[0],
3219
- setIphoneContinuityCameraAvailable = _p[1];
3220
- var _q = React.useState(preferContinuityCamera),
3221
- iphoneContinuityCameraAllowed = _q[0],
3222
- setIphoneContinuityCameraAllowed = _q[1];
3223
- var _r = React.useState(false),
3224
- iphoneContinuityCameraDenied = _r[0],
3225
- setIphoneContinuityCameraDenied = _r[1];
3226
- var _s = React.useState(false),
3227
- cameraAccessDenied = _s[0],
3228
- setCameraAccessDenied = _s[1];
3229
- var _t = React.useState(false),
3230
- microphoneAccessDenied = _t[0],
3231
- setMicrophoneAccessDenied = _t[1];
3232
- var videoRefElement = videoRef.current;
3233
- React.useEffect(function pushVideoRefToStackWhenChanged() {
3234
- // proceed if the video element being mounted is not already at the top of the videoRefStack.
3235
- var topOfStack = videoRefStack.current.slice(-1)[0];
3236
- if (videoRefElement && videoRefElement !== topOfStack) {
3237
- log('adding video to stack', videoRefElement);
3238
- videoRefStack.current.push(videoRefElement);
3239
- }
3240
- }, [videoRefElement]);
3241
- var onVideoUnmounted = React.useCallback(function (videoElement) {
3242
- log('removing video from stack', videoElement);
3243
- videoRefStack.current = videoRefStack.current.filter(function (v) {
3244
- return v !== videoElement;
3245
- });
3246
- videoRef.current = videoRefStack.current.slice(-1)[0]; // top of stack.
3247
- log('new videoRef is', videoRef.current);
3248
- }, []);
3249
- React.useEffect(function resetCameraOnContinuityPreferenceChanged() {
3250
- if (debugMode) {
3251
- log('iphone continuity camera allowed changed', iphoneContinuityCameraAllowed);
3252
- }
3253
- releaseCameraAccess();
3254
- cameraRef.current = null;
3255
- setVideoLoaded(false);
3256
- }, [debugMode, iphoneContinuityCameraAllowed]);
3257
- // NOTE: the bound callback function here is called requestCameraAccess, because
3258
- // it initiates the useEffect chain that results in camera access being requested
3259
- // (requestCameraAccessAutomatically -> chooseFromAvailableCameras -> accessChosenCamera).
3260
- //
3261
- // We chose to title the inner function "chooseFromAvailableCameras" because
3262
- // that's all it literally does -- the available cameras are enumerated, and then
3263
- // the result is parsed to decide which one we like best, which is then passed to
3264
- // setVideoDevice, which causes accessChosenCamera to trigger.
3265
- //
3266
- // I am not a huge fan of getUserMedia's design -- you need to call it twice in order
3267
- // to select the "best" camera for your application's purposes.
3268
- var requestCameraAccess = React.useCallback(function chooseFromAvailableCameras() {
3269
- return __awaiter(this, void 0, void 0, function () {
3270
- var availableCameras, selectedCamera, platform_1, iphoneContinuityCamera, e_1;
3271
- var _a, _b;
3272
- return __generator(this, function (_c) {
3273
- switch (_c.label) {
3274
- case 0:
3275
- setCameraReady(false);
3276
- setCameraAccessDenied(false);
3277
- _c.label = 1;
3278
- case 1:
3279
- _c.trys.push([1, 3,, 4]);
3280
- return [4 /*yield*/, listAvailableCameras()];
3281
- case 2:
3282
- availableCameras = _c.sent();
3283
- selectedCamera = void 0;
3284
- if (debugMode) {
3285
- log('availableCameras', availableCameras);
3286
- }
3287
- platform_1 = getPlatform();
3288
- if (debugMode) {
3289
- log('platformDetails', platform_1);
3290
- }
3291
- if (!iphoneContinuityCameraDenied && (!(platform_1 === null || platform_1 === void 0 ? void 0 : platform_1.os) || platform_1.os.family === 'OS X')) {
3292
- iphoneContinuityCamera = availableCameras.find(function (deviceInfo) {
3293
- return labelMatches(deviceInfo, 'iphone');
3294
- });
3295
- setIphoneContinuityCameraAvailable(!!iphoneContinuityCamera);
3296
- if (iphoneContinuityCamera && iphoneContinuityCameraAllowed) {
3297
- selectedCamera = iphoneContinuityCamera;
3298
- }
3299
- } else if (((_a = platform_1 === null || platform_1 === void 0 ? void 0 : platform_1.os) === null || _a === void 0 ? void 0 : _a.family) === 'Android' || availableCameras.every(function (c) {
3300
- return c.label.startsWith('camera2 ');
3301
- })) {
3302
- availableCameras = availableCameras.sort(function (a, b) {
3303
- return a.label.toLowerCase().localeCompare(b.label.toLowerCase());
3304
- });
3305
- if (debugMode) {
3306
- log('cameras have been sorted', availableCameras);
3307
- }
3308
- }
3309
- if (preferFrontFacingCamera) {
3310
- selectedCamera = availableCameras.find(function (deviceInfo) {
3311
- return labelMatches(deviceInfo, frontLabels);
3312
- });
3313
- }
3314
- selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
3315
- return labelMatches(deviceInfo, 'backtriplecamera');
3316
- }));
3317
- selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
3318
- return labelMatches(deviceInfo, 'backdualcamera');
3319
- }));
3320
- selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
3321
- return labelMatches(deviceInfo, rearLabels) && !labelMatches(deviceInfo, backUltraWideLabels);
3322
- }));
3323
- selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
3324
- return labelMatches(deviceInfo, rearLabels);
3325
- }));
3326
- // on iOS, the front facing camera always is at the first position in the list, so we skip it if all else fails.
3327
- if (!preferFrontFacingCamera && ((_b = platform_1 === null || platform_1 === void 0 ? void 0 : platform_1.os) === null || _b === void 0 ? void 0 : _b.family) === 'iOS' && availableCameras.length > 0) {
3328
- selectedCamera || (selectedCamera = availableCameras[1]);
3329
- }
3330
- selectedCamera || (selectedCamera = availableCameras[0]);
3331
- if (debugMode) log('selectedCamera', selectedCamera);
3332
- setVideoDevice(selectedCamera);
3333
- return [3 /*break*/, 4];
3334
- case 3:
3335
- e_1 = _c.sent();
3336
- if (e_1.name === 'NotAllowedError') {
3337
- error('camera access has been blocked by the user', e_1);
3338
- setCameraAccessDenied(true);
3339
- } else {
3340
- error('camera access encountered some other error', e_1);
3341
- throw e_1;
3342
- }
3343
- return [3 /*break*/, 4];
3344
- case 4:
3345
- return [2 /*return*/];
3346
- }
3347
- });
3348
- });
3349
- }, [debugMode, iphoneContinuityCameraAllowed, iphoneContinuityCameraDenied, preferFrontFacingCamera]);
3350
- React.useEffect(function requestCameraAccessAutomatically() {
3351
- if (requestAccessAutomatically && !cameraAccessDenied) {
3352
- requestCameraAccess()["catch"](error);
3353
- }
3354
- }, [cameraAccessDenied, requestAccessAutomatically, requestCameraAccess]);
3355
- React.useEffect(function accessChosenCamera() {
3356
- var _this = this;
3357
- var _a;
3358
- if (!videoDevice) return;
3359
- var cleanup = function cleanup() {
3360
- releaseCameraAccess();
3361
- cameraRef.current = null;
3362
- setVideoLoaded(false);
3363
- };
3364
- if (!((_a = navigator.mediaDevices) === null || _a === void 0 ? void 0 : _a.getUserMedia)) return cleanup;
3365
- (function () {
3366
- return __awaiter(_this, void 0, void 0, function () {
3367
- var constraints, stream, e_2, handleStreamEnded;
3368
- var _a;
3369
- return __generator(this, function (_b) {
3370
- switch (_b.label) {
3371
- case 0:
3372
- constraints = {
3373
- audio: false,
3374
- video: {
3375
- deviceId: {
3376
- exact: videoDevice.deviceId
3377
- },
3378
- width: {
3379
- ideal: maxVideoWidth
3380
- },
3381
- aspectRatio: 1.777777778,
3382
- frameRate: {}
3383
- }
3384
- };
3385
- if (maxFps) {
3386
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
3387
- // @ts-ignore
3388
- constraints.video.frameRate = {
3389
- max: maxFps
3390
- };
3391
- }
3392
- stream = null;
3393
- _b.label = 1;
3394
- case 1:
3395
- _b.trys.push([1, 3,, 4]);
3396
- return [4 /*yield*/, navigator.mediaDevices.getUserMedia(constraints)];
3397
- case 2:
3398
- stream = _b.sent();
3399
- return [3 /*break*/, 4];
3400
- case 3:
3401
- e_2 = _b.sent();
3402
- if (e_2.name === 'NotAllowedError') {
3403
- if (iphoneContinuityCameraAllowed) {
3404
- setIphoneContinuityCameraAvailable(false);
3405
- setIphoneContinuityCameraDenied(true);
3406
- } else {
3407
- setCameraAccessDenied(true);
3408
- }
3409
- return [2 /*return*/];
3410
- }
3411
- return [3 /*break*/, 4];
3412
- case 4:
3413
- if (!!stream) return [3 /*break*/, 8];
3414
- _b.label = 5;
3415
- case 5:
3416
- _b.trys.push([5, 7,, 8]);
3417
- return [4 /*yield*/, navigator.mediaDevices.getUserMedia({
3418
- audio: false,
3419
- video: true
3420
- })];
3421
- case 6:
3422
- stream = _b.sent();
3423
- log('opened stream with no width and height constraints');
3424
- return [3 /*break*/, 8];
3425
- case 7:
3426
- _b.sent();
3427
- log('cannot open stream at all');
3428
- return [3 /*break*/, 8];
3429
- case 8:
3430
- if (!stream) {
3431
- throw new Error('failed to open camera');
3432
- }
3433
- handleStreamEnded = function handleStreamEnded() {
3434
- if (iphoneContinuityCameraAvailable && iphoneContinuityCameraAllowed) {
3435
- log('someone unplugged the continuity camera');
3436
- releaseCameraAccess();
3437
- cameraRef.current = null;
3438
- setIphoneContinuityCameraAvailable(false);
3439
- setIphoneContinuityCameraDenied(true);
3440
- setVideoDevice(null);
3441
- } else {
3442
- log('someone unplugged the webcam');
3443
- releaseCameraAccess();
3444
- cameraRef.current = null;
3445
- setVideoLoaded(false);
3446
- setCameraAccessDenied(true);
3447
- }
3448
- };
3449
- (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('ended', handleStreamEnded);
3450
- stream.getVideoTracks().forEach(function (track) {
3451
- track.onended = handleStreamEnded;
3452
- });
3453
- cameraRef.current = obtainCameraAccess(stream, videoDevice.label, videoRef.current);
3454
- return [2 /*return*/];
3455
- }
3456
- });
3457
- });
3458
- })();
3459
- return cleanup;
3460
- }, [iphoneContinuityCameraAllowed, iphoneContinuityCameraAvailable, maxFps, maxVideoWidth, videoDevice]);
3461
- React.useEffect(function triggerCameraReady() {
3462
- // TODO: in the future let's evaluate whether we can simplify this to just
3463
- // setCameraReady(!!videoDevice && videoLoaded) -- we are wondering whether
3464
- // we somehow depend on this being set twice.
3465
- setCameraReady(false);
3466
- if (videoDevice && videoLoaded) {
3467
- setCameraReady(videoDevice && videoLoaded);
3468
- }
3469
- }, [videoLoaded, videoDevice]);
3470
- var requestMicrophoneAccess = React.useCallback(function _requestMicrophoneAccess() {
3471
- return __awaiter(this, void 0, void 0, function () {
3472
- var stream;
3473
- return __generator(this, function (_a) {
3474
- switch (_a.label) {
3475
- case 0:
3476
- setMicrophoneReady(false);
3477
- setMicrophoneAccessDenied(false);
3478
- _a.label = 1;
3479
- case 1:
3480
- _a.trys.push([1, 3,, 4]);
3481
- return [4 /*yield*/, navigator.mediaDevices.getUserMedia({
3482
- audio: true,
3483
- video: false
3484
- })];
3485
- case 2:
3486
- stream = _a.sent();
3487
- currentAudioStream = stream;
3488
- setAudioStream(stream);
3489
- setMicrophoneReady(true);
3490
- stream.getAudioTracks().forEach(function (track) {
3491
- track.onended = function () {
3492
- setMicrophoneAccessDenied(true);
3493
- };
3494
- });
3495
- return [3 /*break*/, 4];
3496
- case 3:
3497
- _a.sent();
3498
- setMicrophoneAccessDenied(true);
3499
- return [3 /*break*/, 4];
3500
- case 4:
3501
- return [2 /*return*/];
3502
- }
3503
- });
3504
- });
3505
- }, []);
3506
- React.useEffect(function requestMicrophoneAccessIfNeeded() {
3507
- if (!requireMicrophoneAccess || microphoneAccessDenied) return;
3508
- requestMicrophoneAccess()["catch"](error);
3509
- return function () {
3510
- releaseMicrophoneAccess();
3511
- setAudioStream(null);
3512
- setMicrophoneReady(false);
3513
- };
3514
- }, [microphoneAccessDenied, requestMicrophoneAccess, requireMicrophoneAccess]);
3515
- var takePhoto = React.useCallback(function _takePhoto() {
3516
- return __awaiter(this, void 0, void 0, function () {
3517
- var canvas;
3518
- return __generator(this, function (_a) {
3519
- switch (_a.label) {
3520
- case 0:
3521
- if (!cameraRef.current) return [2 /*return*/, null];
3522
- if (!(typeof ImageCapture !== 'undefined')) return [3 /*break*/, 2];
3523
- return [4 /*yield*/, new ImageCapture(cameraRef.current.stream.getTracks()[0]).takePhoto()];
3524
- case 1:
3525
- return [2 /*return*/, _a.sent()];
3526
- case 2:
3527
- if (!videoRef.current) return [2 /*return*/, null];
3528
- canvas = document.createElement('canvas');
3529
- drawToCanvas(canvas, videoRef.current);
3530
- return [2 /*return*/, new Promise(function (resolve) {
3531
- return canvas.toBlob(resolve);
3532
- })];
3533
- }
3534
- });
3535
- });
3536
- }, []);
3537
- return React.useMemo(function () {
3538
- return {
3539
- videoRef: videoRef,
3540
- videoDevice: videoDevice,
3541
- videoLoaded: videoLoaded,
3542
- setVideoLoaded: setVideoLoaded,
3543
- onVideoUnmounted: onVideoUnmounted,
3544
- cameraRef: cameraRef,
3545
- cameraReady: cameraReady,
3546
- cameraAccessDenied: cameraAccessDenied,
3547
- requestCameraAccess: requestCameraAccess,
3548
- releaseCameraAccess: releaseCameraAccess,
3549
- iphoneContinuityCameraAvailable: iphoneContinuityCameraAvailable,
3550
- iphoneContinuityCameraAllowed: iphoneContinuityCameraAllowed,
3551
- setIphoneContinuityCameraAllowed: setIphoneContinuityCameraAllowed,
3552
- takePhoto: takePhoto,
3553
- audioStream: audioStream,
3554
- microphoneReady: microphoneReady,
3555
- microphoneAccessDenied: microphoneAccessDenied,
3556
- requestMicrophoneAccess: requestMicrophoneAccess
3557
- };
3558
- }, [audioStream, cameraAccessDenied, cameraReady, iphoneContinuityCameraAllowed, iphoneContinuityCameraAvailable, microphoneAccessDenied, microphoneReady, onVideoUnmounted, requestCameraAccess, requestMicrophoneAccess, takePhoto, videoDevice, videoLoaded]);
3559
- }
3560
-
3561
- var CameraStateContext = /*#__PURE__*/React.createContext({
3562
- videoRef: {
3563
- current: null
3564
- },
3565
- videoDevice: null,
3566
- videoLoaded: false,
3567
- cameraRef: {
3568
- current: null
3569
- },
3570
- cameraReady: false,
3571
- cameraAccessDenied: false,
3572
- requestCameraAccess: function requestCameraAccess() {
3573
- return null;
3574
- },
3575
- releaseCameraAccess: function releaseCameraAccess() {
3576
- return null;
3577
- },
3578
- iphoneContinuityCameraAvailable: false,
3579
- iphoneContinuityCameraAllowed: true,
3580
- setIphoneContinuityCameraAllowed: function setIphoneContinuityCameraAllowed() {
3581
- return null;
3582
- },
3583
- takePhoto: function takePhoto() {
3584
- return Promise.resolve(null);
3585
- },
3586
- setVideoLoaded: function setVideoLoaded() {
3587
- return null;
3588
- },
3589
- onVideoUnmounted: function onVideoUnmounted() {
3590
- return null;
3591
- },
3592
- audioStream: null,
3593
- microphoneReady: false,
3594
- microphoneAccessDenied: false,
3595
- requestMicrophoneAccess: function requestMicrophoneAccess() {
3596
- return null;
3597
- }
3598
- });
3599
- var CameraProvider = function CameraProvider(_a) {
3600
- var children = _a.children,
3601
- _b = _a.requestAccessAutomatically,
3602
- requestAccessAutomatically = _b === void 0 ? true : _b,
3603
- _c = _a.preferFrontFacingCamera,
3604
- preferFrontFacingCamera = _c === void 0 ? false : _c,
3605
- _d = _a.preferContinuityCamera,
3606
- preferContinuityCamera = _d === void 0 ? true : _d,
3607
- _e = _a.requireMicrophoneAccess,
3608
- requireMicrophoneAccess = _e === void 0 ? false : _e,
3609
- _f = _a.maxVideoWidth,
3610
- maxVideoWidth = _f === void 0 ? 1920 : _f,
3611
- maxFps = _a.maxFps,
3612
- onCameraAccessDenied = _a.onCameraAccessDenied,
3613
- onMicrophoneAccessDenied = _a.onMicrophoneAccessDenied,
3614
- _g = _a.debugMode,
3615
- debugMode = _g === void 0 ? false : _g;
3616
- var captureDevice = usePreferredCaptureDevice({
3617
- requestAccessAutomatically: requestAccessAutomatically,
3618
- preferFrontFacingCamera: preferFrontFacingCamera,
3619
- preferContinuityCamera: preferContinuityCamera,
3620
- requireMicrophoneAccess: requireMicrophoneAccess,
3621
- maxVideoWidth: maxVideoWidth,
3622
- maxFps: maxFps,
3623
- debugMode: debugMode
3624
- });
3625
- React.useEffect(function () {
3626
- if (captureDevice.cameraAccessDenied) onCameraAccessDenied === null || onCameraAccessDenied === void 0 ? void 0 : onCameraAccessDenied();
3627
- }, [captureDevice.cameraAccessDenied, onCameraAccessDenied]);
3628
- React.useEffect(function () {
3629
- if (captureDevice.microphoneAccessDenied) onMicrophoneAccessDenied === null || onMicrophoneAccessDenied === void 0 ? void 0 : onMicrophoneAccessDenied();
3630
- }, [captureDevice.microphoneAccessDenied, onMicrophoneAccessDenied]);
3631
- var releaseCameraAccess = captureDevice.releaseCameraAccess;
3632
- React.useEffect(function () {
3633
- return function () {
3634
- releaseCameraAccess();
3635
- };
3636
- }, [releaseCameraAccess]);
3637
- return /*#__PURE__*/React.createElement(CameraStateContext.Provider, {
3638
- value: captureDevice
3639
- }, children);
3640
- };
3641
-
3642
- function _typeof$1(o) {
3643
- "@babel/helpers - typeof";
3644
-
3645
- return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
3646
- return typeof o;
3647
- } : function (o) {
3648
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
3649
- }, _typeof$1(o);
3650
- }
3651
-
3652
- function toPrimitive(t, r) {
3653
- if ("object" != _typeof$1(t) || !t) return t;
3654
- var e = t[Symbol.toPrimitive];
3655
- if (void 0 !== e) {
3656
- var i = e.call(t, r);
3657
- if ("object" != _typeof$1(i)) return i;
3658
- throw new TypeError("@@toPrimitive must return a primitive value.");
3659
- }
3660
- return (String )(t);
3661
- }
3662
-
3663
- function toPropertyKey(t) {
3664
- var i = toPrimitive(t, "string");
3665
- return "symbol" == _typeof$1(i) ? i : i + "";
3666
- }
3667
-
3668
- function _defineProperties(e, r) {
3669
- for (var t = 0; t < r.length; t++) {
3670
- var o = r[t];
3671
- o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey(o.key), o);
3672
- }
3673
- }
3674
- function _createClass(e, r, t) {
3675
- return r && _defineProperties(e.prototype, r), Object.defineProperty(e, "prototype", {
3676
- writable: !1
3677
- }), e;
3678
- }
3679
-
3680
- function asyncGeneratorStep(n, t, e, r, o, a, c) {
3681
- try {
3682
- var i = n[a](c),
3683
- u = i.value;
3684
- } catch (n) {
3685
- return void e(n);
3686
- }
3687
- i.done ? t(u) : Promise.resolve(u).then(r, o);
3688
- }
3689
- function _asyncToGenerator(n) {
3690
- return function () {
3691
- var t = this,
3692
- e = arguments;
3693
- return new Promise(function (r, o) {
3694
- var a = n.apply(t, e);
3695
- function _next(n) {
3696
- asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
3697
- }
3698
- function _throw(n) {
3699
- asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
3700
- }
3701
- _next(void 0);
3702
- });
3703
- };
3704
- }
3705
-
3706
- function _setPrototypeOf(t, e) {
3707
- return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
3708
- return t.__proto__ = e, t;
3709
- }, _setPrototypeOf(t, e);
3710
- }
3711
-
3712
- function _inheritsLoose(t, o) {
3713
- t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
3714
- }
3715
-
3716
- function _getPrototypeOf(t) {
3717
- return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
3718
- return t.__proto__ || Object.getPrototypeOf(t);
3719
- }, _getPrototypeOf(t);
3720
- }
3721
-
3722
- function _isNativeFunction(t) {
3723
- try {
3724
- return -1 !== Function.toString.call(t).indexOf("[native code]");
3725
- } catch (n) {
3726
- return "function" == typeof t;
3727
- }
3728
- }
3729
-
3730
- function _isNativeReflectConstruct() {
3731
- try {
3732
- var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
3733
- } catch (t) {}
3734
- return (_isNativeReflectConstruct = function _isNativeReflectConstruct() {
3735
- return !!t;
3736
- })();
3737
- }
3738
-
3739
- function _construct(t, e, r) {
3740
- if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
3741
- var o = [null];
3742
- o.push.apply(o, e);
3743
- var p = new (t.bind.apply(t, o))();
3744
- return r && _setPrototypeOf(p, r.prototype), p;
3745
- }
3746
-
3747
- function _wrapNativeSuper(t) {
3748
- var r = "function" == typeof Map ? new Map() : void 0;
3749
- return _wrapNativeSuper = function _wrapNativeSuper(t) {
3750
- if (null === t || !_isNativeFunction(t)) return t;
3751
- if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function");
3752
- if (void 0 !== r) {
3753
- if (r.has(t)) return r.get(t);
3754
- r.set(t, Wrapper);
3113
+
3114
+ function _getPrototypeOf(t) {
3115
+ return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
3116
+ return t.__proto__ || Object.getPrototypeOf(t);
3117
+ }, _getPrototypeOf(t);
3118
+ }
3119
+
3120
+ function _isNativeFunction(t) {
3121
+ try {
3122
+ return -1 !== Function.toString.call(t).indexOf("[native code]");
3123
+ } catch (n) {
3124
+ return "function" == typeof t;
3125
+ }
3126
+ }
3127
+
3128
+ function _isNativeReflectConstruct() {
3129
+ try {
3130
+ var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
3131
+ } catch (t) {}
3132
+ return (_isNativeReflectConstruct = function _isNativeReflectConstruct() {
3133
+ return !!t;
3134
+ })();
3135
+ }
3136
+
3137
+ function _construct(t, e, r) {
3138
+ if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
3139
+ var o = [null];
3140
+ o.push.apply(o, e);
3141
+ var p = new (t.bind.apply(t, o))();
3142
+ return r && _setPrototypeOf(p, r.prototype), p;
3143
+ }
3144
+
3145
+ function _wrapNativeSuper(t) {
3146
+ var r = "function" == typeof Map ? new Map() : void 0;
3147
+ return _wrapNativeSuper = function _wrapNativeSuper(t) {
3148
+ if (null === t || !_isNativeFunction(t)) return t;
3149
+ if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function");
3150
+ if (void 0 !== r) {
3151
+ if (r.has(t)) return r.get(t);
3152
+ r.set(t, Wrapper);
3755
3153
  }
3756
3154
  function Wrapper() {
3757
3155
  return _construct(t, arguments, _getPrototypeOf(this).constructor);
@@ -4111,9 +3509,9 @@
4111
3509
  }
4112
3510
  var _regeneratorRuntime = /*@__PURE__*/getDefaultExportFromCjs(regenerator);
4113
3511
 
4114
- function _createForOfIteratorHelperLoose$1(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray$1(r)) || e) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: !0 } : { done: !1, value: r[o++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4115
- function _unsupportedIterableToArray$1(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$1(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$1(r, a) : void 0; } }
4116
- function _arrayLikeToArray$1(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
3512
+ function _createForOfIteratorHelperLoose$2(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray$2(r)) || e) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: !0 } : { done: !1, value: r[o++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3513
+ function _unsupportedIterableToArray$2(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$2(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$2(r, a) : void 0; } }
3514
+ function _arrayLikeToArray$2(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
4117
3515
  var t = self;
4118
3516
  function e() {
4119
3517
  throw Error("Invalid UTF8");
@@ -6340,7 +5738,7 @@
6340
5738
  height: (_hn4 = hn(e, 4)) != null ? _hn4 : 0,
6341
5739
  angle: 0
6342
5740
  }), (_en2 = en(t, ws, 4)) != null && _en2.g().length) {
6343
- for (var _iterator = _createForOfIteratorHelperLoose$1(en(t, ws, 4).g()), _step; !(_step = _iterator()).done;) {
5741
+ for (var _iterator = _createForOfIteratorHelperLoose$2(en(t, ws, 4).g()), _step; !(_step = _iterator()).done;) {
6344
5742
  var _We, _We2, _We3, _un3;
6345
5743
  var _e16 = _step.value;
6346
5744
  i.keypoints.push({
@@ -6355,7 +5753,7 @@
6355
5753
  }
6356
5754
  function Qi(t) {
6357
5755
  var e = [];
6358
- for (var _iterator2 = _createForOfIteratorHelperLoose$1(rn(t, Fs, 1)), _step2; !(_step2 = _iterator2()).done;) {
5756
+ for (var _iterator2 = _createForOfIteratorHelperLoose$2(rn(t, Fs, 1)), _step2; !(_step2 = _iterator2()).done;) {
6359
5757
  var _fn2, _fn3, _fn4;
6360
5758
  var _n14 = _step2.value;
6361
5759
  e.push({
@@ -6368,7 +5766,7 @@
6368
5766
  }
6369
5767
  function to(t) {
6370
5768
  var e = [];
6371
- for (var _iterator3 = _createForOfIteratorHelperLoose$1(rn(t, Ts, 1)), _step3; !(_step3 = _iterator3()).done;) {
5769
+ for (var _iterator3 = _createForOfIteratorHelperLoose$2(rn(t, Ts, 1)), _step3; !(_step3 = _iterator3()).done;) {
6372
5770
  var _fn5, _fn6, _fn7;
6373
5771
  var _n15 = _step3.value;
6374
5772
  e.push({
@@ -6516,7 +5914,7 @@
6516
5914
  var r = new Uint32Array(e.length);
6517
5915
  for (var _n16 = 0; _n16 < e.length; _n16++) r[_n16] = t.i.stringToNewUTF8(e[_n16]);
6518
5916
  e = t.i._malloc(4 * r.length), t.i.HEAPU32.set(r, e >> 2), n(e);
6519
- for (var _iterator4 = _createForOfIteratorHelperLoose$1(r), _step4; !(_step4 = _iterator4()).done;) {
5917
+ for (var _iterator4 = _createForOfIteratorHelperLoose$2(r), _step4; !(_step4 = _iterator4()).done;) {
6520
5918
  var _e17 = _step4.value;
6521
5919
  t.i._free(_e17);
6522
5920
  }
@@ -6882,7 +6280,7 @@
6882
6280
  }
6883
6281
  t.push(n);
6884
6282
  };
6885
- for (var _iterator7 = _createForOfIteratorHelperLoose$1(this.g), _step7; !(_step7 = _iterator7()).done;) {
6283
+ for (var _iterator7 = _createForOfIteratorHelperLoose$2(this.g), _step7; !(_step7 = _iterator7()).done;) {
6886
6284
  _loop();
6887
6285
  }
6888
6286
  return new _Yo(t, this.ba(), this.K(), this.canvas, this.l, this.width, this.height);
@@ -7014,7 +6412,7 @@
7014
6412
  }
7015
6413
  t.push(n);
7016
6414
  };
7017
- for (var _iterator8 = _createForOfIteratorHelperLoose$1(this.g), _step8; !(_step8 = _iterator8()).done;) {
6415
+ for (var _iterator8 = _createForOfIteratorHelperLoose$2(this.g), _step8; !(_step8 = _iterator8()).done;) {
7018
6416
  _loop2();
7019
6417
  }
7020
6418
  return new _ia(t, this.K(), this.canvas, this.l, this.width, this.height);
@@ -7494,7 +6892,7 @@
7494
6892
  yn(e, si, this.h);
7495
6893
  var n = new qr();
7496
6894
  Hr(n, "mediapipe.tasks.vision.face_detector.FaceDetectorGraph"), Yr(n, "IMAGE:image_in"), Yr(n, "NORM_RECT:norm_rect_in"), $r(n, "DETECTIONS:detections"), n.o(e), es(t, n), this.g.attachProtoVectorListener("detections", function (t, e) {
7497
- for (var _iterator9 = _createForOfIteratorHelperLoose$1(t), _step9; !(_step9 = _iterator9()).done;) {
6895
+ for (var _iterator9 = _createForOfIteratorHelperLoose$2(t), _step9; !(_step9 = _iterator9()).done;) {
7498
6896
  var _e23 = _step9.value;
7499
6897
  t = Es(_e23), _this43.j.detections.push(Zi(t));
7500
6898
  }
@@ -7588,7 +6986,7 @@
7588
6986
  yn(e, di, this.h);
7589
6987
  var n = new qr();
7590
6988
  Hr(n, "mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"), Yr(n, "IMAGE:image_in"), Yr(n, "NORM_RECT:norm_rect"), $r(n, "NORM_LANDMARKS:face_landmarks"), n.o(e), es(t, n), this.g.attachProtoVectorListener("face_landmarks", function (t, e) {
7591
- for (var _iterator10 = _createForOfIteratorHelperLoose$1(t), _step10; !(_step10 = _iterator10()).done;) {
6989
+ for (var _iterator10 = _createForOfIteratorHelperLoose$2(t), _step10; !(_step10 = _iterator10()).done;) {
7592
6990
  var _e24 = _step10.value;
7593
6991
  t = Ms(_e24), _this45.j.faceLandmarks.push(Qi(t));
7594
6992
  }
@@ -7597,7 +6995,7 @@
7597
6995
  _o(_this45, t);
7598
6996
  }), this.outputFaceBlendshapes && (rs(t, "blendshapes"), $r(n, "BLENDSHAPES:blendshapes"), this.g.attachProtoVectorListener("blendshapes", function (t, e) {
7599
6997
  if (_this45.outputFaceBlendshapes) {
7600
- for (var _iterator11 = _createForOfIteratorHelperLoose$1(t), _step11; !(_step11 = _iterator11()).done;) {
6998
+ for (var _iterator11 = _createForOfIteratorHelperLoose$2(t), _step11; !(_step11 = _iterator11()).done;) {
7601
6999
  var _t$g;
7602
7000
  var _e25 = _step11.value;
7603
7001
  t = fs(_e25), _this45.j.faceBlendshapes.push(Ji((_t$g = t.g()) != null ? _t$g : []));
@@ -7608,7 +7006,7 @@
7608
7006
  _o(_this45, t);
7609
7007
  })), this.outputFacialTransformationMatrixes && (rs(t, "face_geometry"), $r(n, "FACE_GEOMETRY:face_geometry"), this.g.attachProtoVectorListener("face_geometry", function (t, e) {
7610
7008
  if (_this45.outputFacialTransformationMatrixes) {
7611
- for (var _iterator12 = _createForOfIteratorHelperLoose$1(t), _step12; !(_step12 = _iterator12()).done;) {
7009
+ for (var _iterator12 = _createForOfIteratorHelperLoose$2(t), _step12; !(_step12 = _iterator12()).done;) {
7612
7010
  var _ln2, _ln3, _He;
7613
7011
  var _e26 = _step12.value;
7614
7012
  (t = en(ai(_e26), Ps, 2)) && _this45.j.facialTransformationMatrixes.push({
@@ -7739,11 +7137,11 @@
7739
7137
  e = !0;
7740
7138
  }
7741
7139
  var n = [];
7742
- for (var _iterator13 = _createForOfIteratorHelperLoose$1(t), _step13; !(_step13 = _iterator13()).done;) {
7140
+ for (var _iterator13 = _createForOfIteratorHelperLoose$2(t), _step13; !(_step13 = _iterator13()).done;) {
7743
7141
  var _s9 = _step13.value;
7744
7142
  var r = fs(_s9);
7745
7143
  t = [];
7746
- for (var _iterator14 = _createForOfIteratorHelperLoose$1(r.g()), _step14; !(_step14 = _iterator14()).done;) {
7144
+ for (var _iterator14 = _createForOfIteratorHelperLoose$2(r.g()), _step14; !(_step14 = _iterator14()).done;) {
7747
7145
  var _fn8, _ref9, _un4, _ref10, _un5;
7748
7146
  var _n24 = _step14.value;
7749
7147
  r = e && null != hn(_n24, 1) ? ln(hn(_n24, 1)) : -1, t.push({
@@ -7789,11 +7187,11 @@
7789
7187
  yn(e, Oi, this.v);
7790
7188
  var n = new qr();
7791
7189
  Hr(n, "mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"), Yr(n, "IMAGE:image_in"), Yr(n, "NORM_RECT:norm_rect"), $r(n, "HAND_GESTURES:hand_gestures"), $r(n, "LANDMARKS:hand_landmarks"), $r(n, "WORLD_LANDMARKS:world_hand_landmarks"), $r(n, "HANDEDNESS:handedness"), n.o(e), es(t, n), this.g.attachProtoVectorListener("hand_landmarks", function (t, e) {
7792
- for (var _iterator15 = _createForOfIteratorHelperLoose$1(t), _step15; !(_step15 = _iterator15()).done;) {
7190
+ for (var _iterator15 = _createForOfIteratorHelperLoose$2(t), _step15; !(_step15 = _iterator15()).done;) {
7793
7191
  var _e28 = _step15.value;
7794
7192
  t = Ms(_e28);
7795
7193
  var _n25 = [];
7796
- for (var _iterator16 = _createForOfIteratorHelperLoose$1(rn(t, Fs, 1)), _step16; !(_step16 = _iterator16()).done;) {
7194
+ for (var _iterator16 = _createForOfIteratorHelperLoose$2(rn(t, Fs, 1)), _step16; !(_step16 = _iterator16()).done;) {
7797
7195
  var _fn9, _fn10, _fn11;
7798
7196
  var _e29 = _step16.value;
7799
7197
  _n25.push({
@@ -7808,11 +7206,11 @@
7808
7206
  }), this.g.attachEmptyPacketListener("hand_landmarks", function (t) {
7809
7207
  _o(_this49, t);
7810
7208
  }), this.g.attachProtoVectorListener("world_hand_landmarks", function (t, e) {
7811
- for (var _iterator17 = _createForOfIteratorHelperLoose$1(t), _step17; !(_step17 = _iterator17()).done;) {
7209
+ for (var _iterator17 = _createForOfIteratorHelperLoose$2(t), _step17; !(_step17 = _iterator17()).done;) {
7812
7210
  var _e30 = _step17.value;
7813
7211
  t = Ls(_e30);
7814
7212
  var _n26 = [];
7815
- for (var _iterator18 = _createForOfIteratorHelperLoose$1(rn(t, Ts, 1)), _step18; !(_step18 = _iterator18()).done;) {
7213
+ for (var _iterator18 = _createForOfIteratorHelperLoose$2(rn(t, Ts, 1)), _step18; !(_step18 = _iterator18()).done;) {
7816
7214
  var _fn12, _fn13, _fn14;
7817
7215
  var _e31 = _step18.value;
7818
7216
  _n26.push({
@@ -7897,7 +7295,7 @@
7897
7295
  yn(e, Si, this.j);
7898
7296
  var n = new qr();
7899
7297
  Hr(n, "mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"), Yr(n, "IMAGE:image_in"), Yr(n, "NORM_RECT:norm_rect"), $r(n, "LANDMARKS:hand_landmarks"), $r(n, "WORLD_LANDMARKS:world_hand_landmarks"), $r(n, "HANDEDNESS:handedness"), n.o(e), es(t, n), this.g.attachProtoVectorListener("hand_landmarks", function (t, e) {
7900
- for (var _iterator19 = _createForOfIteratorHelperLoose$1(t), _step19; !(_step19 = _iterator19()).done;) {
7298
+ for (var _iterator19 = _createForOfIteratorHelperLoose$2(t), _step19; !(_step19 = _iterator19()).done;) {
7901
7299
  var _e32 = _step19.value;
7902
7300
  t = Ms(_e32), _this51.landmarks.push(Qi(t));
7903
7301
  }
@@ -7905,7 +7303,7 @@
7905
7303
  }), this.g.attachEmptyPacketListener("hand_landmarks", function (t) {
7906
7304
  _o(_this51, t);
7907
7305
  }), this.g.attachProtoVectorListener("world_hand_landmarks", function (t, e) {
7908
- for (var _iterator20 = _createForOfIteratorHelperLoose$1(t), _step20; !(_step20 = _iterator20()).done;) {
7306
+ for (var _iterator20 = _createForOfIteratorHelperLoose$2(t), _step20; !(_step20 = _iterator20()).done;) {
7909
7307
  var _e33 = _step20.value;
7910
7308
  t = Ls(_e33), _this51.worldLandmarks.push(to(t));
7911
7309
  }
@@ -7916,11 +7314,11 @@
7916
7314
  var n = _this51.handedness,
7917
7315
  r = n.push;
7918
7316
  var s = [];
7919
- for (var _iterator21 = _createForOfIteratorHelperLoose$1(t), _step21; !(_step21 = _iterator21()).done;) {
7317
+ for (var _iterator21 = _createForOfIteratorHelperLoose$2(t), _step21; !(_step21 = _iterator21()).done;) {
7920
7318
  var _e34 = _step21.value;
7921
7319
  t = fs(_e34);
7922
7320
  var _n27 = [];
7923
- for (var _iterator22 = _createForOfIteratorHelperLoose$1(t.g()), _step22; !(_step22 = _iterator22()).done;) {
7321
+ for (var _iterator22 = _createForOfIteratorHelperLoose$2(t.g()), _step22; !(_step22 = _iterator22()).done;) {
7924
7322
  var _fn15, _ln4, _ref11, _un6, _ref12, _un7;
7925
7323
  var _e35 = _step22.value;
7926
7324
  _n27.push({
@@ -8312,7 +7710,7 @@
8312
7710
  dn(a, 3, !0), gn(a, 1, e.keypoint.x), gn(a, 2, e.keypoint.y), on(i, 5, oh, a);
8313
7711
  } else {
8314
7712
  if (!e.scribble) throw Error("Must provide either a keypoint or a scribble.");
8315
- for (var _iterator23 = _createForOfIteratorHelperLoose$1((o = new sh(), e.scribble)), _step23; !(_step23 = _iterator23()).done;) {
7713
+ for (var _iterator23 = _createForOfIteratorHelperLoose$2((o = new sh(), e.scribble)), _step23; !(_step23 = _iterator23()).done;) {
8316
7714
  a = _step23.value;
8317
7715
  dn(e = new nh(), 3, !0), gn(e, 1, a.x), gn(e, 2, a.y), an(o, nh, e);
8318
7716
  }
@@ -8413,7 +7811,7 @@
8413
7811
  yn(e, Vi, this.h);
8414
7812
  var n = new qr();
8415
7813
  Hr(n, "mediapipe.tasks.vision.ObjectDetectorGraph"), Yr(n, "IMAGE:input_frame_gpu"), Yr(n, "NORM_RECT:norm_rect"), $r(n, "DETECTIONS:detections"), n.o(e), es(t, n), this.g.attachProtoVectorListener("detections", function (t, e) {
8416
- for (var _iterator24 = _createForOfIteratorHelperLoose$1(t), _step24; !(_step24 = _iterator24()).done;) {
7814
+ for (var _iterator24 = _createForOfIteratorHelperLoose$2(t), _step24; !(_step24 = _iterator24()).done;) {
8417
7815
  var _e37 = _step24.value;
8418
7816
  t = Es(_e37), _this61.j.detections.push(Zi(t));
8419
7817
  }
@@ -8513,7 +7911,7 @@
8513
7911
  var n = new qr();
8514
7912
  Hr(n, "mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"), Yr(n, "IMAGE:image_in"), Yr(n, "NORM_RECT:norm_rect"), $r(n, "NORM_LANDMARKS:normalized_landmarks"), $r(n, "WORLD_LANDMARKS:world_landmarks"), n.o(e), es(t, n), wo(this, t), this.g.attachProtoVectorListener("normalized_landmarks", function (t, e) {
8515
7913
  _this63.landmarks = [];
8516
- for (var _iterator25 = _createForOfIteratorHelperLoose$1(t), _step25; !(_step25 = _iterator25()).done;) {
7914
+ for (var _iterator25 = _createForOfIteratorHelperLoose$2(t), _step25; !(_step25 = _iterator25()).done;) {
8517
7915
  var _e39 = _step25.value;
8518
7916
  t = Ms(_e39), _this63.landmarks.push(Qi(t));
8519
7917
  }
@@ -8522,7 +7920,7 @@
8522
7920
  _this63.landmarks = [], _o(_this63, t);
8523
7921
  }), this.g.attachProtoVectorListener("world_landmarks", function (t, e) {
8524
7922
  _this63.worldLandmarks = [];
8525
- for (var _iterator26 = _createForOfIteratorHelperLoose$1(t), _step26; !(_step26 = _iterator26()).done;) {
7923
+ for (var _iterator26 = _createForOfIteratorHelperLoose$2(t), _step26; !(_step26 = _iterator26()).done;) {
8526
7924
  var _e40 = _step26.value;
8527
7925
  t = Ls(_e40), _this63.worldLandmarks.push(to(t));
8528
7926
  }
@@ -8605,17 +8003,53 @@
8605
8003
  });
8606
8004
  }
8607
8005
 
8608
- function cropToShoulders(rawCanvas, cropCanvas, resizeCanvas, frame, face, quality, maxHeight) {
8609
- if (quality === void 0) {
8610
- quality = 0.92;
8006
+ function getFrameDimensions(frame) {
8007
+ var frameWidth = frame.width,
8008
+ frameHeight = frame.height;
8009
+ if (frame instanceof HTMLImageElement) {
8010
+ frameWidth = frame.naturalWidth;
8011
+ frameHeight = frame.naturalHeight;
8611
8012
  }
8612
- if (!rawCanvas || !cropCanvas || !resizeCanvas) return '';
8613
- var rawCtx = rawCanvas.getContext('2d');
8614
- var cropCtx = cropCanvas.getContext('2d');
8615
- var resizeCtx = resizeCanvas.getContext('2d');
8616
- if (!rawCtx || !cropCtx || !resizeCtx) throw new Error('could not get 2d context');
8617
- rawCanvas.width = frame.width;
8618
- rawCanvas.height = frame.height;
8013
+ if (frame instanceof HTMLVideoElement) {
8014
+ frameWidth = frame.videoWidth;
8015
+ frameHeight = frame.videoHeight;
8016
+ }
8017
+ return [frameWidth, frameHeight];
8018
+ }
8019
+
8020
+ var InvisibleCanvas = styled.canvas(templateObject_1$G || (templateObject_1$G = __makeTemplateObject(["\n display: none;\n"], ["\n display: none;\n"])));
8021
+ function drawToCanvas(canvas, frame, width, height) {
8022
+ if (!canvas) return;
8023
+ var ctx = canvas.getContext('2d');
8024
+ if (!ctx) return;
8025
+ if (!width || !height) {
8026
+ var _a = getFrameDimensions(frame),
8027
+ frameWidth = _a[0],
8028
+ frameHeight = _a[1];
8029
+ width || (width = frameWidth);
8030
+ height || (height = frameHeight);
8031
+ }
8032
+ canvas.width = width;
8033
+ canvas.height = height;
8034
+ ctx.drawImage(frame, 0, 0, width, height);
8035
+ }
8036
+ function clearCanvas(canvas) {
8037
+ var _a;
8038
+ (_a = canvas === null || canvas === void 0 ? void 0 : canvas.getContext('2d')) === null || _a === void 0 ? void 0 : _a.clearRect(0, 0, canvas === null || canvas === void 0 ? void 0 : canvas.width, canvas === null || canvas === void 0 ? void 0 : canvas.height);
8039
+ }
8040
+ var templateObject_1$G;
8041
+
8042
+ function cropToShoulders(rawCanvas, cropCanvas, resizeCanvas, frame, face, quality, maxHeight) {
8043
+ if (quality === void 0) {
8044
+ quality = 0.92;
8045
+ }
8046
+ if (!rawCanvas || !cropCanvas || !resizeCanvas) return '';
8047
+ var rawCtx = rawCanvas.getContext('2d');
8048
+ var cropCtx = cropCanvas.getContext('2d');
8049
+ var resizeCtx = resizeCanvas.getContext('2d');
8050
+ if (!rawCtx || !cropCtx || !resizeCtx) throw new Error('could not get 2d context');
8051
+ rawCanvas.width = frame.width;
8052
+ rawCanvas.height = frame.height;
8619
8053
  rawCtx.putImageData(frame, 0, 0);
8620
8054
  if (frame.height > frame.width) {
8621
8055
  cropCanvas.width = frame.width;
@@ -8908,7 +8342,8 @@
8908
8342
  modelPath = _b === void 0 ? defaultFocusModelPath : _b,
8909
8343
  _c = _a.modelLoadTimeoutMs,
8910
8344
  modelLoadTimeoutMs = _c === void 0 ? defaultFocusModelLoadTimeoutMs : _c,
8911
- onModelError = _a.onModelError;
8345
+ onModelError = _a.onModelError,
8346
+ videoRef = _a.videoRef;
8912
8347
  var _d = React.useState(false),
8913
8348
  ready = _d[0],
8914
8349
  setReady = _d[1];
@@ -8918,7 +8353,6 @@
8918
8353
  var _f = React.useState(null),
8919
8354
  modelError = _f[0],
8920
8355
  setModelError = _f[1];
8921
- var videoRef = React.useContext(CameraStateContext).videoRef;
8922
8356
  React.useEffect(function loadModel() {
8923
8357
  var _this = this;
8924
8358
  setReady(false);
@@ -9056,7 +8490,8 @@
9056
8490
  function useLoadFaceDetector(_a) {
9057
8491
  var onModelError = _a.onModelError,
9058
8492
  _b = _a.modelLoadTimeoutMs,
9059
- modelLoadTimeoutMs = _b === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _b;
8493
+ modelLoadTimeoutMs = _b === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _b,
8494
+ videoRef = _a.videoRef;
9060
8495
  var _c = React.useState(false),
9061
8496
  ready = _c[0],
9062
8497
  setReady = _c[1];
@@ -9066,7 +8501,6 @@
9066
8501
  var _e = React.useState(null),
9067
8502
  modelError = _e[0],
9068
8503
  setModelError = _e[1];
9069
- var videoRef = React.useContext(CameraStateContext).videoRef;
9070
8504
  React.useEffect(function loadModel() {
9071
8505
  var _this = this;
9072
8506
  setReady(false);
@@ -9547,7 +8981,8 @@
9547
8981
  modelLoadTimeoutMs = _c === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _c,
9548
8982
  _d = _a.scoreThreshold,
9549
8983
  scoreThreshold = _d === void 0 ? defaultDocumentDetectionScoreThreshold : _d,
9550
- onModelError = _a.onModelError;
8984
+ onModelError = _a.onModelError,
8985
+ videoRef = _a.videoRef;
9551
8986
  var _e = React.useState(false),
9552
8987
  ready = _e[0],
9553
8988
  setReady = _e[1];
@@ -9557,7 +8992,6 @@
9557
8992
  var _g = React.useState(null),
9558
8993
  modelError = _g[0],
9559
8994
  setModelError = _g[1];
9560
- var videoRef = React.useContext(CameraStateContext).videoRef;
9561
8995
  React.useEffect(function loadModel() {
9562
8996
  var _this = this;
9563
8997
  setReady(false);
@@ -9715,155 +9149,673 @@
9715
9149
  return n > 0;
9716
9150
  });
9717
9151
  });
9718
- var bestIdCardFront = detectedObjects.find(function (obj) {
9719
- return obj.label === 'Document';
9720
- });
9721
- var bestIdCardBack = detectedObjects.find(function (obj) {
9722
- return obj.label === 'Document back';
9723
- });
9724
- var bestPassportPage = detectedObjects.find(function (obj) {
9725
- return obj.label === 'Passport page';
9726
- });
9727
- var idCardFrontDetectionScore = (_e = bestIdCardFront === null || bestIdCardFront === void 0 ? void 0 : bestIdCardFront.score) !== null && _e !== void 0 ? _e : 0;
9728
- var idCardBackDetectionScore = (_f = bestIdCardBack === null || bestIdCardBack === void 0 ? void 0 : bestIdCardBack.score) !== null && _f !== void 0 ? _f : 0;
9729
- var passportDetectionScore = (_g = bestPassportPage === null || bestPassportPage === void 0 ? void 0 : bestPassportPage.score) !== null && _g !== void 0 ? _g : 0;
9730
- var idCardFrontDetectionThresholdMet = idCardFrontDetectionScore >= ((_h = thresholds.idCardFront) !== null && _h !== void 0 ? _h : 0);
9731
- var idCardBackDetectionThresholdMet = idCardBackDetectionScore >= ((_j = thresholds.idCardBack) !== null && _j !== void 0 ? _j : 0);
9732
- var passportDetectionThresholdMet = passportDetectionScore >= ((_k = thresholds.passport) !== null && _k !== void 0 ? _k : 0);
9733
- var bestDocument = passportDetectionThresholdMet ? bestPassportPage : idCardBackDetectionThresholdMet ? bestIdCardBack : bestIdCardFront;
9734
- var detectionThreshold = passportDetectionThresholdMet ? thresholds.passport : idCardBackDetectionThresholdMet ? thresholds.idCardBack : thresholds.idCardFront;
9735
- var detectionScore = (_l = bestDocument === null || bestDocument === void 0 ? void 0 : bestDocument.score) !== null && _l !== void 0 ? _l : 0;
9736
- var detectionThresholdMet = detectionScore >= (detectionThreshold !== null && detectionThreshold !== void 0 ? detectionThreshold : 0);
9737
- var detectedDocumentType = 'none';
9738
- if (passportDetectionThresholdMet) {
9739
- detectedDocumentType = 'passport';
9740
- } else if (idCardBackDetectionThresholdMet) {
9741
- detectedDocumentType = 'idCardBack';
9742
- } else if (detectionThresholdMet) {
9743
- detectedDocumentType = 'idCardFront';
9744
- }
9745
- var documentInBounds = !!bestDocument;
9746
- if (lastDetectionTime > 0) {
9747
- trackFramesNeeded(1000 / lastDetectionTime);
9152
+ var bestIdCardFront = detectedObjects.find(function (obj) {
9153
+ return obj.label === 'Document';
9154
+ });
9155
+ var bestIdCardBack = detectedObjects.find(function (obj) {
9156
+ return obj.label === 'Document back';
9157
+ });
9158
+ var bestPassportPage = detectedObjects.find(function (obj) {
9159
+ return obj.label === 'Passport page';
9160
+ });
9161
+ var idCardFrontDetectionScore = (_e = bestIdCardFront === null || bestIdCardFront === void 0 ? void 0 : bestIdCardFront.score) !== null && _e !== void 0 ? _e : 0;
9162
+ var idCardBackDetectionScore = (_f = bestIdCardBack === null || bestIdCardBack === void 0 ? void 0 : bestIdCardBack.score) !== null && _f !== void 0 ? _f : 0;
9163
+ var passportDetectionScore = (_g = bestPassportPage === null || bestPassportPage === void 0 ? void 0 : bestPassportPage.score) !== null && _g !== void 0 ? _g : 0;
9164
+ var idCardFrontDetectionThresholdMet = idCardFrontDetectionScore >= ((_h = thresholds.idCardFront) !== null && _h !== void 0 ? _h : 0);
9165
+ var idCardBackDetectionThresholdMet = idCardBackDetectionScore >= ((_j = thresholds.idCardBack) !== null && _j !== void 0 ? _j : 0);
9166
+ var passportDetectionThresholdMet = passportDetectionScore >= ((_k = thresholds.passport) !== null && _k !== void 0 ? _k : 0);
9167
+ var bestDocument = passportDetectionThresholdMet ? bestPassportPage : idCardBackDetectionThresholdMet ? bestIdCardBack : bestIdCardFront;
9168
+ var detectionThreshold = passportDetectionThresholdMet ? thresholds.passport : idCardBackDetectionThresholdMet ? thresholds.idCardBack : thresholds.idCardFront;
9169
+ var detectionScore = (_l = bestDocument === null || bestDocument === void 0 ? void 0 : bestDocument.score) !== null && _l !== void 0 ? _l : 0;
9170
+ var detectionThresholdMet = detectionScore >= (detectionThreshold !== null && detectionThreshold !== void 0 ? detectionThreshold : 0);
9171
+ var detectedDocumentType = 'none';
9172
+ if (passportDetectionThresholdMet) {
9173
+ detectedDocumentType = 'passport';
9174
+ } else if (idCardBackDetectionThresholdMet) {
9175
+ detectedDocumentType = 'idCardBack';
9176
+ } else if (detectionThresholdMet) {
9177
+ detectedDocumentType = 'idCardFront';
9178
+ }
9179
+ var documentInBounds = !!bestDocument;
9180
+ if (lastDetectionTime > 0) {
9181
+ trackFramesNeeded(1000 / lastDetectionTime);
9182
+ }
9183
+ var documentIsStable = false;
9184
+ var documentTooClose = false;
9185
+ if (bestDocument) {
9186
+ var _o = [bestDocument.box.width / frameWidth, bestDocument.box.height / frameHeight],
9187
+ docWidth = _o[0],
9188
+ docHeight = _o[1];
9189
+ documentTooClose = docWidth > 0.85 || docHeight > 0.85;
9190
+ if (detectionThresholdMet && documentInBounds && !documentTooClose) {
9191
+ var thresholdSet = (_m = thresholds.stability) !== null && _m !== void 0 ? _m : defaultDocumentDetectionThresholds.stability;
9192
+ var threshold_1 = thresholdSet[detectedDocumentType];
9193
+ var framesNeeded = Math.ceil(average(framesNeededSamples));
9194
+ trackBox(bestDocument.box, framesNeeded);
9195
+ documentIsStable = lastNBoxes.length >= framesNeeded && !lastNPairs.some(function (pair) {
9196
+ return pair.iou < threshold_1;
9197
+ });
9198
+ }
9199
+ }
9200
+ return {
9201
+ prediction: prediction,
9202
+ detectedObjects: detectedObjects,
9203
+ detectionScore: detectionScore,
9204
+ detectionTime: time,
9205
+ detectionThresholdMet: detectionThresholdMet,
9206
+ detectedDocumentType: detectedDocumentType,
9207
+ idCardFrontDetectionScore: idCardFrontDetectionScore,
9208
+ idCardFrontDetectionThresholdMet: idCardFrontDetectionThresholdMet,
9209
+ idCardBackDetectionScore: idCardBackDetectionScore,
9210
+ idCardBackDetectionThresholdMet: idCardBackDetectionThresholdMet,
9211
+ passportDetectionScore: passportDetectionScore,
9212
+ passportDetectionThresholdMet: passportDetectionThresholdMet,
9213
+ bestDocument: bestDocument,
9214
+ documentInBounds: documentInBounds,
9215
+ documentTooClose: documentTooClose,
9216
+ documentIsStable: documentIsStable,
9217
+ frameWidth: frameWidth,
9218
+ frameHeight: frameHeight,
9219
+ allZero: allZero
9220
+ };
9221
+ }
9222
+ function applyNonMaxSuppression(detectedObjects, isGoodBox) {
9223
+ var maxes = {};
9224
+ detectedObjects.forEach(function (obj, i) {
9225
+ if (obj) {
9226
+ if (!maxes[obj.label]) maxes[obj.label] = [0, -1];
9227
+ if (obj.score > maxes[obj.label][0] && (isGoodBox === null || isGoodBox === void 0 ? void 0 : isGoodBox(obj))) maxes[obj.label] = [obj.score, i];
9228
+ }
9229
+ });
9230
+ return Object.keys(maxes).map(function (label) {
9231
+ return detectedObjects[maxes[label][1]];
9232
+ }).filter(function (obj) {
9233
+ return !!obj;
9234
+ });
9235
+ }
9236
+
9237
+ function useFrameLoop(fn, _a) {
9238
+ var _b = _a.throttleMs,
9239
+ throttleMs = _b === void 0 ? 0 : _b,
9240
+ _c = _a.autoStart,
9241
+ autoStart = _c === void 0 ? false : _c;
9242
+ var _d = React.useState(false),
9243
+ running = _d[0],
9244
+ setRunning = _d[1];
9245
+ var startedAtRef = React.useRef(null);
9246
+ var loopId = React.useRef(0);
9247
+ var frameId = React.useRef(0);
9248
+ React.useEffect(function runFrameLoop() {
9249
+ if (!running) return;
9250
+ var timer;
9251
+ var currentLoopId = loopId.current;
9252
+ function renderPrediction() {
9253
+ return __awaiter(this, void 0, void 0, function () {
9254
+ var start, timeRunning, took, amountToThrottle;
9255
+ var _a, _b;
9256
+ return __generator(this, function (_c) {
9257
+ switch (_c.label) {
9258
+ case 0:
9259
+ if (currentLoopId !== loopId.current) return [2 /*return*/];
9260
+ start = new Date().getTime();
9261
+ timeRunning = start - ((_b = (_a = startedAtRef.current) === null || _a === void 0 ? void 0 : _a.getTime()) !== null && _b !== void 0 ? _b : 0);
9262
+ return [4 /*yield*/, fn(frameId.current, timeRunning)];
9263
+ case 1:
9264
+ _c.sent();
9265
+ took = new Date().getTime() - start;
9266
+ amountToThrottle = Math.max((throttleMs !== null && throttleMs !== void 0 ? throttleMs : 0) - took, 0);
9267
+ timer = setTimeout(function () {
9268
+ frameId.current = requestAnimationFrame(renderPrediction);
9269
+ }, amountToThrottle);
9270
+ return [2 /*return*/];
9271
+ }
9272
+ });
9273
+ });
9274
+ }
9275
+ renderPrediction().then();
9276
+ return function () {
9277
+ loopId.current += 1;
9278
+ frameId.current && cancelAnimationFrame(frameId.current);
9279
+ timer && clearTimeout(timer);
9280
+ };
9281
+ }, [fn, running, throttleMs]);
9282
+ var start = React.useCallback(function () {
9283
+ startedAtRef.current = new Date();
9284
+ setRunning(true);
9285
+ }, []);
9286
+ var stop = React.useCallback(function () {
9287
+ loopId.current += 1; // force the loop to stop immediately.
9288
+ setRunning(false);
9289
+ startedAtRef.current = null;
9290
+ }, []);
9291
+ React.useEffect(function startAutomatically() {
9292
+ if (autoStart) start();
9293
+ return function () {
9294
+ stop();
9295
+ };
9296
+ }, [autoStart, start, stop]);
9297
+ return {
9298
+ start: start,
9299
+ stop: stop
9300
+ };
9301
+ }
9302
+
9303
+ var createStoreImpl = function createStoreImpl(createState) {
9304
+ var state;
9305
+ var listeners = /* @__PURE__ */new Set();
9306
+ var setState = function setState(partial, replace) {
9307
+ var nextState = typeof partial === "function" ? partial(state) : partial;
9308
+ if (!Object.is(nextState, state)) {
9309
+ var previousState = state;
9310
+ state = (replace != null ? replace : typeof nextState !== "object" || nextState === null) ? nextState : Object.assign({}, state, nextState);
9311
+ listeners.forEach(function (listener) {
9312
+ return listener(state, previousState);
9313
+ });
9314
+ }
9315
+ };
9316
+ var getState = function getState() {
9317
+ return state;
9318
+ };
9319
+ var getInitialState = function getInitialState() {
9320
+ return initialState;
9321
+ };
9322
+ var subscribe = function subscribe(listener) {
9323
+ listeners.add(listener);
9324
+ return function () {
9325
+ return listeners["delete"](listener);
9326
+ };
9327
+ };
9328
+ var api = {
9329
+ setState: setState,
9330
+ getState: getState,
9331
+ getInitialState: getInitialState,
9332
+ subscribe: subscribe
9333
+ };
9334
+ var initialState = state = createState(setState, getState, api);
9335
+ return api;
9336
+ };
9337
+ var createStore = function createStore(createState) {
9338
+ return createState ? createStoreImpl(createState) : createStoreImpl;
9339
+ };
9340
+
9341
+ var identity = function identity(arg) {
9342
+ return arg;
9343
+ };
9344
+ function useStore(api, selector) {
9345
+ if (selector === void 0) {
9346
+ selector = identity;
9347
+ }
9348
+ var slice = React.useSyncExternalStore(api.subscribe, function () {
9349
+ return selector(api.getState());
9350
+ }, function () {
9351
+ return selector(api.getInitialState());
9352
+ });
9353
+ React.useDebugValue(slice);
9354
+ return slice;
9355
+ }
9356
+
9357
+ function listAvailableCameras(facingMode_1) {
9358
+ return __awaiter(this, arguments, void 0, function (facingMode, requestMicAccess) {
9359
+ var cameraEnumerationStream, videoDevices;
9360
+ if (requestMicAccess === void 0) {
9361
+ requestMicAccess = false;
9362
+ }
9363
+ return __generator(this, function (_a) {
9364
+ switch (_a.label) {
9365
+ case 0:
9366
+ return [4 /*yield*/, navigator.mediaDevices.getUserMedia({
9367
+ video: {
9368
+ facingMode: {
9369
+ exact: facingMode
9370
+ }
9371
+ },
9372
+ audio: requestMicAccess
9373
+ })
9374
+ // This lists all available cameras attached to the user's device.
9375
+ ];
9376
+ case 1:
9377
+ cameraEnumerationStream = _a.sent();
9378
+ return [4 /*yield*/, navigator.mediaDevices.enumerateDevices()];
9379
+ case 2:
9380
+ videoDevices = _a.sent().filter(function (_a) {
9381
+ var kind = _a.kind;
9382
+ return kind === 'videoinput';
9383
+ });
9384
+ // Release the access to the user's camera that we obtained for enumeration purposes.
9385
+ cameraEnumerationStream.getVideoTracks().forEach(function (track) {
9386
+ track.enabled = false;
9387
+ track.stop();
9388
+ });
9389
+ cameraEnumerationStream = null;
9390
+ return [2 /*return*/, videoDevices];
9391
+ }
9392
+ });
9393
+ });
9394
+ }
9395
+ var frontCameraLabels = ['front', 'avant', 'anteriore', 'cameraaanvoorzijde', 'kamerapåframsidan', 'forsidekamera', 'kamerapåforsiden', 'aparatprzedni', 'etukamera', 'kameradepan', 'ÖnKamera', 'cameramặttrước', 'camerăfață', 'prednákamera', 'prednjakamera', 'előlapikamera', 'přednífotoaparát', 'μπροστινήκάμερα', 'переднякамера', 'передняякамера', 'преднакамера', 'алдыңғыкамера', 'מצלמה קדמית', 'الكاميرا الأمامية', 'फ़्रंटकैमरा', '前置相机', '前置鏡頭', '前面カメラ', '전면카메라', 'กล้องด้านหน้า'].map(function (s) {
9396
+ return s.toLocaleLowerCase().split(' ').join('');
9397
+ });
9398
+ var rearCameraLabels = ['back', 'rear', 'posterior', 'trasera', 'traseira', 'arrière', 'rückkamera', 'fotocamera(posteriore)', 'cameraaanachterzijde', 'kamerapåbaksidan', 'kamerapåbaksiden', 'bagsidekamera', 'aparattylny', 'takakamera', 'arkakamera', 'kamerabelakang', 'cameramặtsau', 'camerăspate', 'stražnjakamera', 'zadnákamera', 'hátoldalikamera', 'zadnífotoaparát', 'πίσωκάμερα', 'заднякамера', 'Задняякамера', 'заднакамера', 'артқыкамера', 'מצלמה אחורית', 'الكاميرا الخلفية', 'बैककैमरा', '后置相机', '後置鏡頭', '背面カメラ', '후면카메라', 'กล้องด้านหลัง'].map(function (s) {
9399
+ return s.toLocaleLowerCase().split(' ').join('');
9400
+ });
9401
+ var backUltraWideCameraLabels = ['backdualwidecamera', 'backultrawidecamera', 'ultraampliaposterior', 'ultra-angulartraseira', 'ultragrandeangulartraseira', 'ultragrandangle', 'ultragranangular', 'ultra-weitwinkelkamera', 'ultra-grandangolo', 'ultrabredecameraaanachterzijde', 'ultravidvinkelkamerapåbaksidan', 'ultravidvinkelkameraetpåbagsiden', 'ultravidvinkelkamerabak', 'ultragenişkameraarkayüzü', 'ultralaajakulmainentakakamera', 'tylnyaparatultraszerokokątny', 'cameracựcrộngmặtsau', 'camerăcuobiectivultra‑superangularspate', 'ultraszéleslátószögűkamera', 'kameraultralebarbelakang', 'stražnjaultraširokakamera', 'zadníultraširokoúhlýfotoaparát', 'ultraširokouhlá', 'πίσωυπερευρείακάμερα', 'заднянадширококутнакамера', 'Задняясверхширокоугольнаякамера', 'Задна свръх широкоъгълна камера', 'артқыультракеңбұрыштыкамера', 'מצלמה אולטרה רחבה אחורית', 'كاميرا خلفية عريضة جدًا', 'बैकअल्ट्रावाइडकैमरा', '后置超广角相机', '後置超廣角鏡頭相機', '背面超広角カメラ', '후면울트라와이드카메라', 'กล้องด้านหลังอัลตร้าไวด์'].map(function (s) {
9402
+ return s.toLocaleLowerCase().split(' ').join('');
9403
+ });
9404
+ var cameraLabelMatches = function cameraLabelMatches(labelOrDevice, labelSetOrLabel) {
9405
+ var label = labelOrDevice instanceof MediaDeviceInfo ? getDeviceLabel(labelOrDevice) : labelOrDevice;
9406
+ var labelSet = typeof labelSetOrLabel === 'string' ? [labelSetOrLabel] : labelSetOrLabel;
9407
+ return labelSet.some(function (l) {
9408
+ return label.includes(l);
9409
+ });
9410
+ };
9411
+ var getDeviceLabel = function getDeviceLabel(deviceInfo) {
9412
+ return deviceInfo.label.toLocaleLowerCase().split(' ').join('');
9413
+ };
9414
+ var currentCamera;
9415
+ function obtainCameraAccess(stream, deviceLabel, video) {
9416
+ releaseCameraAccess();
9417
+ log('obtaining camera access...');
9418
+ var _a = stream.getVideoTracks()[0].getSettings(),
9419
+ width = _a.width,
9420
+ height = _a.height;
9421
+ log('camera dimensions', width, height);
9422
+ var label = deviceLabel.toLocaleLowerCase().split(' ').join('');
9423
+ log('camera label', label);
9424
+ var isRearFacing = cameraLabelMatches(label, __spreadArray(__spreadArray(__spreadArray([], rearCameraLabels, true), backUltraWideCameraLabels, true), ['iphone'], false));
9425
+ log('is rear facing?', isRearFacing);
9426
+ var release = function release() {
9427
+ stream.getTracks().forEach(function (track) {
9428
+ track.enabled = false;
9429
+ track.stop();
9430
+ });
9431
+ if (video) {
9432
+ video.pause();
9433
+ video.srcObject = null;
9434
+ video.src = '';
9435
+ }
9436
+ };
9437
+ width || (width = 0);
9438
+ height || (height = 0);
9439
+ currentCamera = {
9440
+ label: deviceLabel,
9441
+ stream: stream,
9442
+ width: width,
9443
+ height: height,
9444
+ isRearFacing: isRearFacing,
9445
+ release: release
9446
+ };
9447
+ log('camera access granted');
9448
+ if (video) video.srcObject = stream;
9449
+ log('video source initialized');
9450
+ return currentCamera;
9451
+ }
9452
+ function releaseCameraAccess() {
9453
+ if (!currentCamera) return;
9454
+ log('releasing camera access...');
9455
+ currentCamera.release();
9456
+ currentCamera = undefined;
9457
+ }
9458
+
9459
+ var initialState$5 = {
9460
+ videoRef: {
9461
+ current: null
9462
+ },
9463
+ videoLoaded: false,
9464
+ videoStream: null,
9465
+ videoDevice: null,
9466
+ isRearFacing: false,
9467
+ camera: null,
9468
+ cameraReady: false,
9469
+ cameraAccessDenied: false,
9470
+ iphoneContinuityCameraAvailable: false,
9471
+ iphoneContinuityCameraDenied: false,
9472
+ preferIphoneContinuityCamera: true,
9473
+ audioStream: null,
9474
+ microphoneReady: false,
9475
+ microphoneAccessDenied: false
9476
+ };
9477
+ var createCameraStore = function createCameraStore(config) {
9478
+ var store = createStore(function (set, get) {
9479
+ return _assign(_assign(_assign({}, initialState$5), config), {
9480
+ reset: function reset() {
9481
+ return set(_assign(_assign({}, initialState$5), config));
9482
+ },
9483
+ setConfig: function setConfig(config) {
9484
+ return set(config);
9485
+ },
9486
+ onVideoMounted: function onVideoMounted() {
9487
+ return set({
9488
+ videoLoaded: true
9489
+ });
9490
+ },
9491
+ setIphoneContinuityCameraAllowed: function setIphoneContinuityCameraAllowed(value) {
9492
+ return set({
9493
+ preferIphoneContinuityCamera: value
9494
+ });
9495
+ },
9496
+ requestCameraAccess: function requestCameraAccess() {
9497
+ return __awaiter(this, void 0, void 0, function () {
9498
+ var _a, releaseCameraAccess, preferIphoneContinuityCamera, iphoneContinuityCameraDenied, availableCameras, selectedCamera, platform_1, iphoneContinuityCamera, constraints, stream, e_1, iphoneContinuityCameraAvailable_1, handleStreamEnded_1, camera, e_3;
9499
+ var _b, _c, _d;
9500
+ return __generator(this, function (_e) {
9501
+ switch (_e.label) {
9502
+ case 0:
9503
+ _a = get(), releaseCameraAccess = _a.releaseCameraAccess, preferIphoneContinuityCamera = _a.preferIphoneContinuityCamera, iphoneContinuityCameraDenied = _a.iphoneContinuityCameraDenied;
9504
+ releaseCameraAccess();
9505
+ _e.label = 1;
9506
+ case 1:
9507
+ _e.trys.push([1, 11,, 12]);
9508
+ return [4 /*yield*/, listAvailableCameras()];
9509
+ case 2:
9510
+ availableCameras = _e.sent();
9511
+ selectedCamera = void 0;
9512
+ debug('availableCameras', availableCameras);
9513
+ platform_1 = getPlatform();
9514
+ debug('platformDetails', platform_1);
9515
+ if (!iphoneContinuityCameraDenied && (!(platform_1 === null || platform_1 === void 0 ? void 0 : platform_1.os) || platform_1.os.family === 'OS X')) {
9516
+ iphoneContinuityCamera = availableCameras.find(function (deviceInfo) {
9517
+ return cameraLabelMatches(deviceInfo, 'iphone');
9518
+ });
9519
+ set({
9520
+ iphoneContinuityCameraAvailable: !!iphoneContinuityCamera
9521
+ });
9522
+ if (iphoneContinuityCamera && preferIphoneContinuityCamera) {
9523
+ selectedCamera = iphoneContinuityCamera;
9524
+ }
9525
+ } else if (((_b = platform_1 === null || platform_1 === void 0 ? void 0 : platform_1.os) === null || _b === void 0 ? void 0 : _b.family) === 'Android' || availableCameras.every(function (c) {
9526
+ return c.label.startsWith('camera2 ');
9527
+ })) {
9528
+ availableCameras = availableCameras.sort(function (a, b) {
9529
+ return a.label.toLowerCase().localeCompare(b.label.toLowerCase());
9530
+ });
9531
+ debug('cameras have been sorted', availableCameras);
9532
+ }
9533
+ if (config.preferFrontFacingCamera) {
9534
+ selectedCamera = availableCameras.find(function (deviceInfo) {
9535
+ return cameraLabelMatches(deviceInfo, frontCameraLabels);
9536
+ });
9537
+ }
9538
+ selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
9539
+ return cameraLabelMatches(deviceInfo, 'backtriplecamera');
9540
+ }));
9541
+ selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
9542
+ return cameraLabelMatches(deviceInfo, 'backdualcamera');
9543
+ }));
9544
+ selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
9545
+ return cameraLabelMatches(deviceInfo, rearCameraLabels) && !cameraLabelMatches(deviceInfo, backUltraWideCameraLabels);
9546
+ }));
9547
+ selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
9548
+ return cameraLabelMatches(deviceInfo, rearCameraLabels);
9549
+ }));
9550
+ // on iOS, the front facing camera always is at the first position in the list, so we skip it if all else fails.
9551
+ if (!config.preferFrontFacingCamera && ((_c = platform_1 === null || platform_1 === void 0 ? void 0 : platform_1.os) === null || _c === void 0 ? void 0 : _c.family) === 'iOS' && availableCameras.length > 0) {
9552
+ selectedCamera || (selectedCamera = availableCameras[1]);
9553
+ }
9554
+ selectedCamera || (selectedCamera = availableCameras[0]);
9555
+ debug('selectedCamera', selectedCamera);
9556
+ set({
9557
+ videoDevice: selectedCamera
9558
+ });
9559
+ constraints = {
9560
+ audio: false,
9561
+ video: {
9562
+ deviceId: {
9563
+ exact: selectedCamera.deviceId
9564
+ },
9565
+ width: {
9566
+ ideal: config.maxVideoWidth
9567
+ },
9568
+ aspectRatio: 1.777777778,
9569
+ frameRate: {}
9570
+ }
9571
+ };
9572
+ if (config.maxFps) {
9573
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
9574
+ // @ts-ignore
9575
+ constraints.video.frameRate = {
9576
+ max: config.maxFps
9577
+ };
9578
+ }
9579
+ stream = null;
9580
+ _e.label = 3;
9581
+ case 3:
9582
+ _e.trys.push([3, 5,, 6]);
9583
+ debug('obtaining camera access with constraints', constraints);
9584
+ return [4 /*yield*/, navigator.mediaDevices.getUserMedia(constraints)];
9585
+ case 4:
9586
+ stream = _e.sent();
9587
+ return [3 /*break*/, 6];
9588
+ case 5:
9589
+ e_1 = _e.sent();
9590
+ if (e_1.name === 'NotAllowedError') {
9591
+ if (preferIphoneContinuityCamera) {
9592
+ set({
9593
+ iphoneContinuityCameraAvailable: false,
9594
+ iphoneContinuityCameraDenied: true
9595
+ });
9596
+ } else {
9597
+ set({
9598
+ cameraAccessDenied: true
9599
+ });
9600
+ }
9601
+ return [2 /*return*/];
9602
+ }
9603
+ return [3 /*break*/, 6];
9604
+ case 6:
9605
+ if (!!stream) return [3 /*break*/, 10];
9606
+ _e.label = 7;
9607
+ case 7:
9608
+ _e.trys.push([7, 9,, 10]);
9609
+ return [4 /*yield*/, navigator.mediaDevices.getUserMedia({
9610
+ audio: false,
9611
+ video: true
9612
+ })];
9613
+ case 8:
9614
+ stream = _e.sent();
9615
+ debug('opened stream with no width and height constraints');
9616
+ return [3 /*break*/, 10];
9617
+ case 9:
9618
+ _e.sent();
9619
+ debug('cannot open stream at all');
9620
+ return [3 /*break*/, 10];
9621
+ case 10:
9622
+ if (!stream) {
9623
+ error('failed to open camera');
9624
+ throw new Error('failed to open camera');
9625
+ }
9626
+ debug('camera access granted with constraints', constraints);
9627
+ iphoneContinuityCameraAvailable_1 = get().iphoneContinuityCameraAvailable;
9628
+ handleStreamEnded_1 = function handleStreamEnded_1() {
9629
+ if (iphoneContinuityCameraAvailable_1 && preferIphoneContinuityCamera) {
9630
+ debug('someone unplugged the continuity camera');
9631
+ releaseCameraAccess();
9632
+ set({
9633
+ videoStream: null,
9634
+ videoDevice: null,
9635
+ iphoneContinuityCameraAvailable: false,
9636
+ iphoneContinuityCameraDenied: true
9637
+ });
9638
+ } else {
9639
+ debug('someone unplugged the webcam');
9640
+ releaseCameraAccess();
9641
+ set({
9642
+ videoStream: null,
9643
+ videoDevice: null,
9644
+ videoLoaded: false,
9645
+ cameraAccessDenied: true
9646
+ });
9647
+ }
9648
+ };
9649
+ (_d = config.videoRef.current) === null || _d === void 0 ? void 0 : _d.addEventListener('ended', handleStreamEnded_1);
9650
+ stream.getVideoTracks().forEach(function (track) {
9651
+ track.onended = handleStreamEnded_1;
9652
+ });
9653
+ camera = obtainCameraAccess(stream, selectedCamera.label, config.videoRef.current);
9654
+ set({
9655
+ camera: camera,
9656
+ cameraReady: true,
9657
+ isRearFacing: camera.isRearFacing,
9658
+ videoStream: stream
9659
+ });
9660
+ return [3 /*break*/, 12];
9661
+ case 11:
9662
+ e_3 = _e.sent();
9663
+ if (e_3.name === 'NotAllowedError') {
9664
+ error('camera access has been blocked by the user', e_3);
9665
+ set({
9666
+ cameraAccessDenied: true
9667
+ });
9668
+ } else {
9669
+ error('camera access encountered some other error', e_3);
9670
+ throw e_3;
9671
+ }
9672
+ return [3 /*break*/, 12];
9673
+ case 12:
9674
+ return [2 /*return*/];
9675
+ }
9676
+ });
9677
+ });
9678
+ },
9679
+ releaseCameraAccess: function releaseCameraAccess() {
9680
+ return __awaiter(this, void 0, void 0, function () {
9681
+ var camera;
9682
+ return __generator(this, function (_a) {
9683
+ camera = get().camera;
9684
+ if (!camera) return [2 /*return*/];
9685
+ camera.release();
9686
+ set({
9687
+ camera: null,
9688
+ cameraReady: false,
9689
+ cameraAccessDenied: false
9690
+ });
9691
+ return [2 /*return*/];
9692
+ });
9693
+ });
9694
+ },
9695
+ requestMicrophoneAccess: function requestMicrophoneAccess() {
9696
+ return __awaiter(this, void 0, void 0, function () {
9697
+ var stream;
9698
+ return __generator(this, function (_a) {
9699
+ switch (_a.label) {
9700
+ case 0:
9701
+ get().releaseMicrophoneAccess();
9702
+ _a.label = 1;
9703
+ case 1:
9704
+ _a.trys.push([1, 3,, 4]);
9705
+ return [4 /*yield*/, navigator.mediaDevices.getUserMedia({
9706
+ audio: true,
9707
+ video: false
9708
+ })];
9709
+ case 2:
9710
+ stream = _a.sent();
9711
+ set({
9712
+ audioStream: stream,
9713
+ microphoneReady: true
9714
+ });
9715
+ stream.getAudioTracks().forEach(function (track) {
9716
+ track.onended = function () {
9717
+ set({
9718
+ microphoneAccessDenied: true
9719
+ });
9720
+ };
9721
+ });
9722
+ return [3 /*break*/, 4];
9723
+ case 3:
9724
+ _a.sent();
9725
+ set({
9726
+ microphoneAccessDenied: true
9727
+ });
9728
+ return [3 /*break*/, 4];
9729
+ case 4:
9730
+ return [2 /*return*/];
9731
+ }
9732
+ });
9733
+ });
9734
+ },
9735
+ releaseMicrophoneAccess: function releaseMicrophoneAccess() {
9736
+ var _a;
9737
+ var audioStream = get().audioStream;
9738
+ (_a = audioStream === null || audioStream === void 0 ? void 0 : audioStream.stop) === null || _a === void 0 ? void 0 : _a.call(audioStream);
9739
+ audioStream === null || audioStream === void 0 ? void 0 : audioStream.getAudioTracks().forEach(function (track) {
9740
+ var _a;
9741
+ (_a = track.stop) === null || _a === void 0 ? void 0 : _a.call(track);
9742
+ });
9743
+ set({
9744
+ audioStream: null,
9745
+ microphoneReady: false,
9746
+ microphoneAccessDenied: false
9747
+ });
9748
+ }
9749
+ });
9750
+ });
9751
+ if (config.requestAccessAutomatically) {
9752
+ store.getState().requestCameraAccess();
9748
9753
  }
9749
- var documentIsStable = false;
9750
- var documentTooClose = false;
9751
- if (bestDocument) {
9752
- var _o = [bestDocument.box.width / frameWidth, bestDocument.box.height / frameHeight],
9753
- docWidth = _o[0],
9754
- docHeight = _o[1];
9755
- documentTooClose = docWidth > 0.85 || docHeight > 0.85;
9756
- if (detectionThresholdMet && documentInBounds && !documentTooClose) {
9757
- var thresholdSet = (_m = thresholds.stability) !== null && _m !== void 0 ? _m : defaultDocumentDetectionThresholds.stability;
9758
- var threshold_1 = thresholdSet[detectedDocumentType];
9759
- var framesNeeded = Math.ceil(average(framesNeededSamples));
9760
- trackBox(bestDocument.box, framesNeeded);
9761
- documentIsStable = lastNBoxes.length >= framesNeeded && !lastNPairs.some(function (pair) {
9762
- return pair.iou < threshold_1;
9763
- });
9764
- }
9754
+ if (config.requireMicrophoneAccess) {
9755
+ store.getState().requestMicrophoneAccess();
9765
9756
  }
9766
- return {
9767
- prediction: prediction,
9768
- detectedObjects: detectedObjects,
9769
- detectionScore: detectionScore,
9770
- detectionTime: time,
9771
- detectionThresholdMet: detectionThresholdMet,
9772
- detectedDocumentType: detectedDocumentType,
9773
- idCardFrontDetectionScore: idCardFrontDetectionScore,
9774
- idCardFrontDetectionThresholdMet: idCardFrontDetectionThresholdMet,
9775
- idCardBackDetectionScore: idCardBackDetectionScore,
9776
- idCardBackDetectionThresholdMet: idCardBackDetectionThresholdMet,
9777
- passportDetectionScore: passportDetectionScore,
9778
- passportDetectionThresholdMet: passportDetectionThresholdMet,
9779
- bestDocument: bestDocument,
9780
- documentInBounds: documentInBounds,
9781
- documentTooClose: documentTooClose,
9782
- documentIsStable: documentIsStable,
9783
- frameWidth: frameWidth,
9784
- frameHeight: frameHeight,
9785
- allZero: allZero
9786
- };
9787
- }
9788
- function applyNonMaxSuppression(detectedObjects, isGoodBox) {
9789
- var maxes = {};
9790
- detectedObjects.forEach(function (obj, i) {
9791
- if (obj) {
9792
- if (!maxes[obj.label]) maxes[obj.label] = [0, -1];
9793
- if (obj.score > maxes[obj.label][0] && (isGoodBox === null || isGoodBox === void 0 ? void 0 : isGoodBox(obj))) maxes[obj.label] = [obj.score, i];
9757
+ return _assign(_assign({}, store), {
9758
+ destroy: function destroy() {
9759
+ store.getState().releaseCameraAccess();
9760
+ store.getState().releaseMicrophoneAccess();
9794
9761
  }
9795
9762
  });
9796
- return Object.keys(maxes).map(function (label) {
9797
- return detectedObjects[maxes[label][1]];
9798
- }).filter(function (obj) {
9799
- return !!obj;
9800
- });
9801
- }
9802
-
9803
- function useFrameLoop(fn, _a) {
9804
- var _b = _a.throttleMs,
9805
- throttleMs = _b === void 0 ? 0 : _b,
9806
- _c = _a.autoStart,
9807
- autoStart = _c === void 0 ? false : _c;
9808
- var _d = React.useState(false),
9809
- running = _d[0],
9810
- setRunning = _d[1];
9811
- var startedAtRef = React.useRef(null);
9812
- var loopId = React.useRef(0);
9813
- var frameId = React.useRef(0);
9814
- React.useEffect(function runFrameLoop() {
9815
- if (!running) return;
9816
- var timer;
9817
- var currentLoopId = loopId.current;
9818
- function renderPrediction() {
9819
- return __awaiter(this, void 0, void 0, function () {
9820
- var start, timeRunning, took, amountToThrottle;
9821
- var _a, _b;
9822
- return __generator(this, function (_c) {
9823
- switch (_c.label) {
9824
- case 0:
9825
- if (currentLoopId !== loopId.current) return [2 /*return*/];
9826
- start = new Date().getTime();
9827
- timeRunning = start - ((_b = (_a = startedAtRef.current) === null || _a === void 0 ? void 0 : _a.getTime()) !== null && _b !== void 0 ? _b : 0);
9828
- return [4 /*yield*/, fn(frameId.current, timeRunning)];
9829
- case 1:
9830
- _c.sent();
9831
- took = new Date().getTime() - start;
9832
- amountToThrottle = Math.max((throttleMs !== null && throttleMs !== void 0 ? throttleMs : 0) - took, 0);
9833
- timer = setTimeout(function () {
9834
- frameId.current = requestAnimationFrame(renderPrediction);
9835
- }, amountToThrottle);
9836
- return [2 /*return*/];
9837
- }
9838
- });
9763
+ };
9764
+ var CameraStoreContext = /*#__PURE__*/React.createContext(undefined);
9765
+ function CameraStoreProvider(_a) {
9766
+ var children = _a.children,
9767
+ _b = _a.requestAccessAutomatically,
9768
+ requestAccessAutomatically = _b === void 0 ? true : _b,
9769
+ _c = _a.preferIphoneContinuityCamera,
9770
+ preferIphoneContinuityCamera = _c === void 0 ? true : _c,
9771
+ _d = _a.preferFrontFacingCamera,
9772
+ preferFrontFacingCamera = _d === void 0 ? false : _d,
9773
+ _e = _a.maxVideoWidth,
9774
+ maxVideoWidth = _e === void 0 ? 1920 : _e,
9775
+ maxFps = _a.maxFps,
9776
+ onCameraAccessDenied = _a.onCameraAccessDenied,
9777
+ onMicrophoneAccessDenied = _a.onMicrophoneAccessDenied,
9778
+ _f = _a.requireMicrophoneAccess,
9779
+ requireMicrophoneAccess = _f === void 0 ? false : _f;
9780
+ var videoRef = React.useRef(null);
9781
+ var store = React.useRef();
9782
+ store.current || (store.current = createCameraStore({
9783
+ videoRef: videoRef,
9784
+ requestAccessAutomatically: requestAccessAutomatically,
9785
+ preferIphoneContinuityCamera: preferIphoneContinuityCamera,
9786
+ preferFrontFacingCamera: preferFrontFacingCamera,
9787
+ maxVideoWidth: maxVideoWidth,
9788
+ maxFps: maxFps,
9789
+ onCameraAccessDenied: onCameraAccessDenied,
9790
+ onMicrophoneAccessDenied: onMicrophoneAccessDenied,
9791
+ requireMicrophoneAccess: requireMicrophoneAccess
9792
+ }));
9793
+ React.useEffect(function () {
9794
+ var _a, _b, _c;
9795
+ var state = (_a = store.current) === null || _a === void 0 ? void 0 : _a.getState();
9796
+ if (!state) return;
9797
+ if (preferIphoneContinuityCamera !== (state === null || state === void 0 ? void 0 : state.preferIphoneContinuityCamera) || preferFrontFacingCamera !== (state === null || state === void 0 ? void 0 : state.preferFrontFacingCamera)) {
9798
+ (_b = store.current) === null || _b === void 0 ? void 0 : _b.setState({
9799
+ preferIphoneContinuityCamera: preferIphoneContinuityCamera,
9800
+ preferFrontFacingCamera: preferFrontFacingCamera
9839
9801
  });
9802
+ (_c = store.current) === null || _c === void 0 ? void 0 : _c.getState().requestCameraAccess();
9840
9803
  }
9841
- renderPrediction().then();
9804
+ }, [preferFrontFacingCamera, preferIphoneContinuityCamera]);
9805
+ React.useEffect(function () {
9842
9806
  return function () {
9843
- loopId.current += 1;
9844
- frameId.current && cancelAnimationFrame(frameId.current);
9845
- timer && clearTimeout(timer);
9807
+ var _a;
9808
+ return (_a = store.current) === null || _a === void 0 ? void 0 : _a.destroy();
9846
9809
  };
9847
- }, [fn, running, throttleMs]);
9848
- var start = React.useCallback(function () {
9849
- startedAtRef.current = new Date();
9850
- setRunning(true);
9851
- }, []);
9852
- var stop = React.useCallback(function () {
9853
- loopId.current += 1; // force the loop to stop immediately.
9854
- setRunning(false);
9855
- startedAtRef.current = null;
9856
9810
  }, []);
9857
- React.useEffect(function startAutomatically() {
9858
- if (autoStart) start();
9859
- return function () {
9860
- stop();
9861
- };
9862
- }, [autoStart, start, stop]);
9863
- return {
9864
- start: start,
9865
- stop: stop
9866
- };
9811
+ return /*#__PURE__*/React.createElement(CameraStoreContext.Provider, {
9812
+ value: store.current
9813
+ }, children);
9814
+ }
9815
+ function useCameraStore(selector) {
9816
+ var store = React.useContext(CameraStoreContext);
9817
+ if (!store) throw new Error('useCameraStore cannot be used without Provider');
9818
+ return useStore(store, selector);
9867
9819
  }
9868
9820
 
9869
9821
  var DocumentDetectionModelContext = /*#__PURE__*/React.createContext({
@@ -9911,7 +9863,7 @@
9911
9863
  _g = _a.documentDetectionModelLoadTimeoutMs,
9912
9864
  documentDetectionModelLoadTimeoutMs = _g === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _g,
9913
9865
  onDocumentDetectionModelError = _a.onDocumentDetectionModelError;
9914
- var _h = React.useContext(CameraStateContext),
9866
+ var _h = useCameraStore(),
9915
9867
  videoRef = _h.videoRef,
9916
9868
  videoLoaded = _h.videoLoaded,
9917
9869
  cameraReady = _h.cameraReady;
@@ -9934,7 +9886,8 @@
9934
9886
  modelPath: documentDetectionModelPath,
9935
9887
  modelLoadTimeoutMs: documentDetectionModelLoadTimeoutMs,
9936
9888
  scoreThreshold: documentDetectionModelScoreThreshold,
9937
- onModelError: onDocumentDetectionModelError
9889
+ onModelError: onDocumentDetectionModelError,
9890
+ videoRef: videoRef
9938
9891
  }),
9939
9892
  ready = _o.ready,
9940
9893
  modelDownloadProgress = _o.modelDownloadProgress,
@@ -10051,10 +10004,12 @@
10051
10004
  var _e = React.useState({}),
10052
10005
  focusThresholds = _e[0],
10053
10006
  setFocusThresholds = _e[1];
10007
+ var videoRef = useCameraStore().videoRef;
10054
10008
  var _f = useLoadFocusModel({
10055
10009
  modelPath: focusModelPath,
10056
10010
  modelLoadTimeoutMs: focusModelLoadTimeoutMs,
10057
- onModelError: onFocusModelError
10011
+ onModelError: onFocusModelError,
10012
+ videoRef: videoRef
10058
10013
  }),
10059
10014
  ready = _f.ready,
10060
10015
  modelDownloadProgress = _f.modelDownloadProgress,
@@ -10809,12 +10764,12 @@
10809
10764
  if (!portalLocation) return element;
10810
10765
  return /*#__PURE__*/reactDom.createPortal(element, portalLocation);
10811
10766
  }
10812
- var DebugStatsPaneDiv = styled.span(templateObject_1$D || (templateObject_1$D = __makeTemplateObject(["\n font-size: 16px;\n font-family: monospace;\n position: absolute;\n left: 20px;\n bottom: 20px;\n margin-right: 20px;\n padding: 8px;\n color: limegreen;\n background: rgba(0, 0, 0, 0.5);\n z-index: 10002;\n"], ["\n font-size: 16px;\n font-family: monospace;\n position: absolute;\n left: 20px;\n bottom: 20px;\n margin-right: 20px;\n padding: 8px;\n color: limegreen;\n background: rgba(0, 0, 0, 0.5);\n z-index: 10002;\n"])));
10813
- var ObjectDetectionDebugOverlayDiv = styled.div(templateObject_2$w || (templateObject_2$w = __makeTemplateObject(["\n position: absolute;\n z-index: 1001;\n width: 100%;\n height: 100%;\n max-width: 100%;\n max-height: 100%;\n overflow: hidden;\n ", "\n"], ["\n position: absolute;\n z-index: 1001;\n width: 100%;\n height: 100%;\n max-width: 100%;\n max-height: 100%;\n overflow: hidden;\n ", "\n"])), function (_a) {
10767
+ var DebugStatsPaneDiv = styled.span(templateObject_1$F || (templateObject_1$F = __makeTemplateObject(["\n font-size: 16px;\n font-family: monospace;\n position: absolute;\n left: 20px;\n bottom: 20px;\n margin-right: 20px;\n padding: 8px;\n color: limegreen;\n background: rgba(0, 0, 0, 0.5);\n z-index: 10002;\n"], ["\n font-size: 16px;\n font-family: monospace;\n position: absolute;\n left: 20px;\n bottom: 20px;\n margin-right: 20px;\n padding: 8px;\n color: limegreen;\n background: rgba(0, 0, 0, 0.5);\n z-index: 10002;\n"])));
10768
+ var ObjectDetectionDebugOverlayDiv = styled.div(templateObject_2$y || (templateObject_2$y = __makeTemplateObject(["\n position: absolute;\n z-index: 1001;\n width: 100%;\n height: 100%;\n max-width: 100%;\n max-height: 100%;\n overflow: hidden;\n ", "\n transform-style: preserve-3d;\n"], ["\n position: absolute;\n z-index: 1001;\n width: 100%;\n height: 100%;\n max-width: 100%;\n max-height: 100%;\n overflow: hidden;\n ", "\n transform-style: preserve-3d;\n"])), function (_a) {
10814
10769
  var $flipX = _a.$flipX;
10815
10770
  return $flipX ? 'transform: scaleX(-1);' : '';
10816
10771
  });
10817
- var ObjectDetectionDebugBox = styled.div(templateObject_3$n || (templateObject_3$n = __makeTemplateObject(["\n font: 10px monospace;\n position: absolute;\n border: 3px solid ", ";\n color: ", ";\n ", "\n"], ["\n font: 10px monospace;\n position: absolute;\n border: 3px solid ", ";\n color: ", ";\n ", "\n"])), function (_a) {
10772
+ var ObjectDetectionDebugBox = styled.div(templateObject_3$p || (templateObject_3$p = __makeTemplateObject(["\n font: 10px monospace;\n position: absolute;\n border: 3px solid ", ";\n color: ", ";\n ", "\n transform-style: preserve-3d;\n"], ["\n font: 10px monospace;\n position: absolute;\n border: 3px solid ", ";\n color: ", ";\n ", "\n transform-style: preserve-3d;\n"])), function (_a) {
10818
10773
  var $color = _a.$color;
10819
10774
  return $color !== null && $color !== void 0 ? $color : 'green';
10820
10775
  }, function (_a) {
@@ -10824,7 +10779,7 @@
10824
10779
  var $flipX = _a.$flipX;
10825
10780
  return $flipX ? 'transform: scaleX(-1);' : '';
10826
10781
  });
10827
- var FaceDetectionKeypointMarker = styled.div(templateObject_4$h || (templateObject_4$h = __makeTemplateObject(["\n position: absolute;\n width: 4px;\n height: 4px;\n border: 2px solid ", ";\n font: 10px monospace;\n color: ", ";\n border-radius: 50%;\n ", "\n"], ["\n position: absolute;\n width: 4px;\n height: 4px;\n border: 2px solid ", ";\n font: 10px monospace;\n color: ", ";\n border-radius: 50%;\n ", "\n"])), function (_a) {
10782
+ var FaceDetectionKeypointMarker = styled.div(templateObject_4$j || (templateObject_4$j = __makeTemplateObject(["\n position: absolute;\n width: 4px;\n height: 4px;\n border: 2px solid ", ";\n font: 10px monospace;\n color: ", ";\n border-radius: 50%;\n ", "\n transform-style: preserve-3d;\n"], ["\n position: absolute;\n width: 4px;\n height: 4px;\n border: 2px solid ", ";\n font: 10px monospace;\n color: ", ";\n border-radius: 50%;\n ", "\n transform-style: preserve-3d;\n"])), function (_a) {
10828
10783
  var $color = _a.$color;
10829
10784
  return $color !== null && $color !== void 0 ? $color : 'red';
10830
10785
  }, function (_a) {
@@ -11015,7 +10970,7 @@
11015
10970
  }
11016
10971
  });
11017
10972
  }
11018
- var templateObject_1$D, templateObject_2$w, templateObject_3$n, templateObject_4$h;
10973
+ var templateObject_1$F, templateObject_2$y, templateObject_3$p, templateObject_4$j;
11019
10974
 
11020
10975
  var enTranslation = {};
11021
10976
 
@@ -11494,9 +11449,9 @@
11494
11449
  return e;
11495
11450
  }
11496
11451
 
11497
- function _createForOfIteratorHelperLoose(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: !0 } : { done: !1, value: r[o++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
11498
- function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
11499
- function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
11452
+ function _createForOfIteratorHelperLoose$1(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray$1(r)) || e) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: !0 } : { done: !1, value: r[o++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
11453
+ function _unsupportedIterableToArray$1(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$1(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$1(r, a) : void 0; } }
11454
+ function _arrayLikeToArray$1(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
11500
11455
  var consoleLogger = {
11501
11456
  type: 'logger',
11502
11457
  log: function log(args) {
@@ -12343,7 +12298,7 @@
12343
12298
  }
12344
12299
  if (!useOptionsReplaceForData) {
12345
12300
  data = _extends({}, data);
12346
- for (var _iterator = _createForOfIteratorHelperLoose(optionsKeys), _step; !(_step = _iterator()).done;) {
12301
+ for (var _iterator = _createForOfIteratorHelperLoose$1(optionsKeys), _step; !(_step = _iterator()).done;) {
12347
12302
  var key = _step.value;
12348
12303
  delete data[key];
12349
12304
  }
@@ -13982,7 +13937,7 @@
13982
13937
  }, [fallbacks, i18n.language, t, verbiage]);
13983
13938
  }
13984
13939
 
13985
- var GuidanceMessageContainerDiv = styled.div(templateObject_1$C || (templateObject_1$C = __makeTemplateObject(["\n position: absolute;\n top: calc(", ");\n ", "\n font-weight: bold;\n width: 100%;\n display: flex;\n"], ["\n position: absolute;\n top: calc(", ");\n ", "\n font-weight: bold;\n width: 100%;\n display: flex;\n"])), function (_a) {
13940
+ var GuidanceMessageContainerDiv = styled.div(templateObject_1$E || (templateObject_1$E = __makeTemplateObject(["\n position: absolute;\n top: calc(", ");\n ", "\n font-weight: bold;\n width: 100%;\n display: flex;\n"], ["\n position: absolute;\n top: calc(", ");\n ", "\n font-weight: bold;\n width: 100%;\n display: flex;\n"])), function (_a) {
13986
13941
  var $top = _a.$top;
13987
13942
  return $top !== null && $top !== void 0 ? $top : '10vh';
13988
13943
  }, function (_a) {
@@ -13995,14 +13950,14 @@
13995
13950
  if (!portalLocation) return element;
13996
13951
  return /*#__PURE__*/reactDom.createPortal(element, portalLocation);
13997
13952
  };
13998
- var GuidanceMessage = styled.div(templateObject_2$v || (templateObject_2$v = __makeTemplateObject(["\n margin-left: auto;\n margin-right: auto;\n background: ", ";\n color: ", ";\n padding: 10px 12px 8px;\n border-radius: 8px;\n z-index: 10001;\n"], ["\n margin-left: auto;\n margin-right: auto;\n background: ", ";\n color: ", ";\n padding: 10px 12px 8px;\n border-radius: 8px;\n z-index: 10001;\n"])), function (props) {
13953
+ var GuidanceMessage = styled.div(templateObject_2$x || (templateObject_2$x = __makeTemplateObject(["\n margin-left: auto;\n margin-right: auto;\n background: ", ";\n color: ", ";\n padding: 10px 12px 8px;\n border-radius: 8px;\n z-index: 10001;\n"], ["\n margin-left: auto;\n margin-right: auto;\n background: ", ";\n color: ", ";\n padding: 10px 12px 8px;\n border-radius: 8px;\n z-index: 10001;\n"])), function (props) {
13999
13954
  var _a, _b, _c, _d, _e, _f;
14000
13955
  return (_f = (_a = props.$background) !== null && _a !== void 0 ? _a : (_e = (_c = (_b = props.theme) === null || _b === void 0 ? void 0 : _b.guidanceMessages) === null || _c === void 0 ? void 0 : _c[(_d = props.$variant) !== null && _d !== void 0 ? _d : 'default']) === null || _e === void 0 ? void 0 : _e.backgroundColor) !== null && _f !== void 0 ? _f : '#ccc';
14001
13956
  }, function (props) {
14002
13957
  var _a, _b, _c, _d, _e, _f;
14003
13958
  return (_f = (_a = props.$textColor) !== null && _a !== void 0 ? _a : (_e = (_c = (_b = props.theme) === null || _b === void 0 ? void 0 : _b.guidanceMessages) === null || _c === void 0 ? void 0 : _c[(_d = props.$variant) !== null && _d !== void 0 ? _d : 'default']) === null || _e === void 0 ? void 0 : _e.textColor) !== null && _f !== void 0 ? _f : 'black';
14004
13959
  });
14005
- var templateObject_1$C, templateObject_2$v;
13960
+ var templateObject_1$E, templateObject_2$x;
14006
13961
 
14007
13962
  function OverrideWrongDocumentTypeGuidanceDialog(_a) {
14008
13963
  var _b = _a.classNames,
@@ -14017,7 +13972,7 @@
14017
13972
  buttonText: 'OK'
14018
13973
  });
14019
13974
  if (!state.allowOverrideWrongDocumentTypeGuidance) return null;
14020
- return /*#__PURE__*/React.createElement(Container$1, {
13975
+ return /*#__PURE__*/React.createElement(Container$2, {
14021
13976
  className: classNames.container
14022
13977
  }, /*#__PURE__*/React.createElement(InnerContainer, {
14023
13978
  className: classNames.inner
@@ -14035,45 +13990,47 @@
14035
13990
  }
14036
13991
  }, verbiage.buttonText))));
14037
13992
  }
14038
- var Container$1 = styled.div(templateObject_1$B || (templateObject_1$B = __makeTemplateObject(["\n position: fixed;\n left: 0;\n bottom: 0;\n width: 100dvw;\n background: ", ";\n color: ", ";\n display: flex;\n z-index: 100001;\n"], ["\n position: fixed;\n left: 0;\n bottom: 0;\n width: 100dvw;\n background: ", ";\n color: ", ";\n display: flex;\n z-index: 100001;\n"])), function (props) {
13993
+ var Container$2 = styled.div(templateObject_1$D || (templateObject_1$D = __makeTemplateObject(["\n position: fixed;\n left: 0;\n bottom: 0;\n width: 100dvw;\n background: ", ";\n color: ", ";\n display: flex;\n z-index: 100001;\n"], ["\n position: fixed;\n left: 0;\n bottom: 0;\n width: 100dvw;\n background: ", ";\n color: ", ";\n display: flex;\n z-index: 100001;\n"])), function (props) {
14039
13994
  var _a, _b, _c;
14040
13995
  return (_c = (_b = (_a = props.theme.idCapture) === null || _a === void 0 ? void 0 : _a.overrideWrongDocumentTypeGuidance) === null || _b === void 0 ? void 0 : _b.backgroundColor) !== null && _c !== void 0 ? _c : '#eed202';
14041
13996
  }, function (props) {
14042
13997
  var _a, _b, _c;
14043
13998
  return (_c = (_b = (_a = props.theme.idCapture) === null || _a === void 0 ? void 0 : _a.overrideWrongDocumentTypeGuidance) === null || _b === void 0 ? void 0 : _b.textColor) !== null && _c !== void 0 ? _c : 'black';
14044
13999
  });
14045
- var InnerContainer = styled.div(templateObject_2$u || (templateObject_2$u = __makeTemplateObject(["\n display: flex;\n flex-direction: row;\n padding: 16px 24px;\n margin: auto 0;\n width: 100%;\n"], ["\n display: flex;\n flex-direction: row;\n padding: 16px 24px;\n margin: auto 0;\n width: 100%;\n"])));
14046
- var Message = styled.span(templateObject_3$m || (templateObject_3$m = __makeTemplateObject(["\n display: block;\n margin: auto 12px auto 0;\n"], ["\n display: block;\n margin: auto 12px auto 0;\n"])));
14047
- var ButtonContainer = styled.div(templateObject_4$g || (templateObject_4$g = __makeTemplateObject(["\n display: flex;\n margin-left: auto;\n"], ["\n display: flex;\n margin-left: auto;\n"])));
14048
- var Button = styled(LoaderButton)(templateObject_5$a || (templateObject_5$a = __makeTemplateObject(["\n white-space: nowrap;\n margin: auto;\n"], ["\n white-space: nowrap;\n margin: auto;\n"])));
14049
- var templateObject_1$B, templateObject_2$u, templateObject_3$m, templateObject_4$g, templateObject_5$a;
14000
+ var InnerContainer = styled.div(templateObject_2$w || (templateObject_2$w = __makeTemplateObject(["\n display: flex;\n flex-direction: row;\n padding: 16px 24px;\n margin: auto 0;\n width: 100%;\n"], ["\n display: flex;\n flex-direction: row;\n padding: 16px 24px;\n margin: auto 0;\n width: 100%;\n"])));
14001
+ var Message = styled.span(templateObject_3$o || (templateObject_3$o = __makeTemplateObject(["\n display: block;\n margin: auto 12px auto 0;\n"], ["\n display: block;\n margin: auto 12px auto 0;\n"])));
14002
+ var ButtonContainer = styled.div(templateObject_4$i || (templateObject_4$i = __makeTemplateObject(["\n display: flex;\n margin-left: auto;\n"], ["\n display: flex;\n margin-left: auto;\n"])));
14003
+ var Button = styled(LoaderButton)(templateObject_5$b || (templateObject_5$b = __makeTemplateObject(["\n white-space: nowrap;\n margin: auto;\n"], ["\n white-space: nowrap;\n margin: auto;\n"])));
14004
+ var templateObject_1$D, templateObject_2$w, templateObject_3$o, templateObject_4$i, templateObject_5$b;
14050
14005
 
14051
14006
  var IdCapture = function IdCapture(_a) {
14052
- var _b, _c, _d, _e, _f, _g, _h, _j;
14007
+ var _b, _c, _d, _e, _f, _g, _h;
14053
14008
  var requiredDocumentType = _a.requiredDocumentType,
14054
- _k = _a.thresholds,
14055
- thresholds = _k === void 0 ? defaultIdCaptureThresholds : _k,
14009
+ _j = _a.thresholds,
14010
+ thresholds = _j === void 0 ? defaultIdCaptureThresholds : _j,
14056
14011
  guidanceMessage = _a.guidanceMessage,
14057
14012
  guidanceSatisfied = _a.guidanceSatisfied,
14058
14013
  onCapture = _a.onCapture,
14059
- _l = _a.classNames,
14060
- classNames = _l === void 0 ? {} : _l,
14061
- _m = _a.colors,
14062
- colors = _m === void 0 ? {} : _m,
14063
- _o = _a.verbiage,
14064
- rawVerbiage = _o === void 0 ? {} : _o,
14065
- _p = _a.debugMode,
14066
- debugMode = _p === void 0 ? false : _p;
14067
- var _q = useResizeObserver(),
14068
- ref = _q.ref,
14069
- _r = _q.width,
14070
- width = _r === void 0 ? 1 : _r,
14071
- _s = _q.height,
14072
- height = _s === void 0 ? 1 : _s;
14073
- var _t = useIdCaptureState(),
14074
- state = _t[0],
14075
- dispatch = _t[1];
14076
- var cameraRef = React.useContext(CameraStateContext).cameraRef;
14014
+ _k = _a.classNames,
14015
+ classNames = _k === void 0 ? {} : _k,
14016
+ _l = _a.colors,
14017
+ colors = _l === void 0 ? {} : _l,
14018
+ _m = _a.verbiage,
14019
+ rawVerbiage = _m === void 0 ? {} : _m,
14020
+ _o = _a.debugMode,
14021
+ debugMode = _o === void 0 ? false : _o;
14022
+ var _p = useResizeObserver(),
14023
+ ref = _p.ref,
14024
+ _q = _p.width,
14025
+ width = _q === void 0 ? 1 : _q,
14026
+ _r = _p.height,
14027
+ height = _r === void 0 ? 1 : _r;
14028
+ var _s = useIdCaptureState(),
14029
+ state = _s[0],
14030
+ dispatch = _s[1];
14031
+ var _t = useCameraStore(),
14032
+ camera = _t.camera,
14033
+ isRearFacing = _t.isRearFacing;
14077
14034
  var _u = React.useContext(IdCaptureModelsContext),
14078
14035
  modelsReady = _u.ready,
14079
14036
  setThresholds = _u.setThresholds,
@@ -14185,17 +14142,16 @@
14185
14142
  classNames: classNames.overrideWrongDocumentTypeGuidanceDialog,
14186
14143
  verbiage: rawVerbiage.overrideWrongDocumentTypeGuidanceDialog
14187
14144
  }))), debugMode && ( /*#__PURE__*/React.createElement(DebugBoundingBoxOverlay, {
14188
- "$flipX": !((_j = cameraRef.current) === null || _j === void 0 ? void 0 : _j.isRearFacing),
14145
+ "$flipX": !isRearFacing,
14189
14146
  scaling: debugScalingDetails
14190
14147
  }, state.detectedObjects.map(function (obj, i) {
14191
- var _a;
14192
14148
  return /*#__PURE__*/React.createElement(IdCaptureDetectedObjectDebugBox, {
14193
14149
  key: i,
14194
14150
  obj: obj,
14195
14151
  scaling: debugScalingDetails,
14196
- flipX: !((_a = cameraRef.current) === null || _a === void 0 ? void 0 : _a.isRearFacing)
14152
+ flipX: !isRearFacing
14197
14153
  });
14198
- }))), debugMode && ( /*#__PURE__*/React.createElement(DebugStatsPane, null, cameraRef.current ? ( /*#__PURE__*/React.createElement(React.Fragment, null, "\u2705 Camera: ", cameraRef.current.label, " (", cameraRef.current.width, "x", cameraRef.current.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React.createElement("br", null), state.frameCaptureRate > 0.75 ? '✅' : '👎', " Frame Rate:", ' ', Math.round((state.frameCaptureRate + Number.EPSILON) * 1000) / 1000, ' ', "fps (", detectionTime, "ms doc detect, ", focusPredictionTime, "ms focus)", /*#__PURE__*/React.createElement("br", null), modelsReady ? ( /*#__PURE__*/React.createElement(React.Fragment, null, state.detectionThresholdMet ? '✅' : '❌', " Detected Document Type: ", state.detectedDocumentType, /*#__PURE__*/React.createElement("br", null), state.idCardFrontDetectionThresholdMet ? '✅' : '❌', " ID Card Front Score: ", state.idCardFrontDetectionScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), state.idCardBackDetectionThresholdMet ? '✅' : '❌', " ID Card Back Score: ", state.idCardBackDetectionScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), state.passportDetectionThresholdMet ? '✅' : '❌', " Passport Score: ", state.passportDetectionScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), state.focusThresholdMet ? '✅' : '❌', " Focus Score:", ' ', state.focusScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), state.documentInBounds ? '✅' : '❌', " Document In Bounds", /*#__PURE__*/React.createElement("br", null), state.documentIsStable ? '✅' : '❌', " Document Is Stable", /*#__PURE__*/React.createElement("br", null), state.goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', state.goodFramesCount, "/", state.goodFramesThreshold)) : ( /*#__PURE__*/React.createElement(React.Fragment, null, "\u274C Models not ready")))));
14154
+ }))), debugMode && ( /*#__PURE__*/React.createElement(DebugStatsPane, null, camera ? ( /*#__PURE__*/React.createElement(React.Fragment, null, "\u2705 Camera: ", camera.label, " (", camera.width, "x", camera.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React.createElement("br", null), state.frameCaptureRate > 0.75 ? '✅' : '👎', " Frame Rate:", ' ', Math.round((state.frameCaptureRate + Number.EPSILON) * 1000) / 1000, ' ', "fps (", detectionTime, "ms doc detect, ", focusPredictionTime, "ms focus)", /*#__PURE__*/React.createElement("br", null), modelsReady ? ( /*#__PURE__*/React.createElement(React.Fragment, null, state.detectionThresholdMet ? '✅' : '❌', " Detected Document Type: ", state.detectedDocumentType, /*#__PURE__*/React.createElement("br", null), state.idCardFrontDetectionThresholdMet ? '✅' : '❌', " ID Card Front Score: ", state.idCardFrontDetectionScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), state.idCardBackDetectionThresholdMet ? '✅' : '❌', " ID Card Back Score: ", state.idCardBackDetectionScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), state.passportDetectionThresholdMet ? '✅' : '❌', " Passport Score: ", state.passportDetectionScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), state.focusThresholdMet ? '✅' : '❌', " Focus Score:", ' ', state.focusScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), state.documentInBounds ? '✅' : '❌', " Document In Bounds", /*#__PURE__*/React.createElement("br", null), state.documentIsStable ? '✅' : '❌', " Document Is Stable", /*#__PURE__*/React.createElement("br", null), state.goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', state.goodFramesCount, "/", state.goodFramesThreshold)) : ( /*#__PURE__*/React.createElement(React.Fragment, null, "\u274C Models not ready")))));
14199
14155
  };
14200
14156
  var timeSince = function timeSince(t) {
14201
14157
  if (!t) return 0;
@@ -14212,7 +14168,9 @@
14212
14168
  colors = _e === void 0 ? {} : _e,
14213
14169
  _f = _a.verbiage,
14214
14170
  rawVerbiage = _f === void 0 ? {} : _f;
14215
- var requestCameraAccess = React.useContext(CameraStateContext).requestCameraAccess;
14171
+ var requestCameraAccess = useCameraStore(function (state) {
14172
+ return state.requestCameraAccess;
14173
+ });
14216
14174
  assets.imageUrl || (assets.imageUrl = DEFAULT_CDN_URL + '/camera-disable-icon.png');
14217
14175
  var verbiage = useTranslations(rawVerbiage, {
14218
14176
  headingText: 'Your camera permission is disabled',
@@ -14241,13 +14199,13 @@
14241
14199
  finished: true
14242
14200
  }, verbiage.retryBtnText)));
14243
14201
  };
14244
- var StyledOverlayInner$3 = styled(OverlayInner$2)(templateObject_1$A || (templateObject_1$A = __makeTemplateObject(["\n max-width: 500px;\n height: auto;\n margin: auto;\n"], ["\n max-width: 500px;\n height: auto;\n margin: auto;\n"])));
14245
- var StyledOverlayImageContainer$3 = styled(OverlayImageContainer)(templateObject_2$t || (templateObject_2$t = __makeTemplateObject(["\n flex-grow: 0;\n"], ["\n flex-grow: 0;\n"])));
14246
- var Description$4 = styled.p(templateObject_3$l || (templateObject_3$l = __makeTemplateObject(["\n line-height: 1.5;\n margin-bottom: 50px;\n"], ["\n line-height: 1.5;\n margin-bottom: 50px;\n"])));
14247
- var RetryButton$1 = styled(LoaderButton)(templateObject_4$f || (templateObject_4$f = __makeTemplateObject(["\n width: 200px;\n margin: 0 auto;\n"], ["\n width: 200px;\n margin: 0 auto;\n"])));
14248
- var templateObject_1$A, templateObject_2$t, templateObject_3$l, templateObject_4$f;
14202
+ var StyledOverlayInner$3 = styled(OverlayInner$2)(templateObject_1$C || (templateObject_1$C = __makeTemplateObject(["\n max-width: 500px;\n height: auto;\n margin: auto;\n"], ["\n max-width: 500px;\n height: auto;\n margin: auto;\n"])));
14203
+ var StyledOverlayImageContainer$3 = styled(OverlayImageContainer)(templateObject_2$v || (templateObject_2$v = __makeTemplateObject(["\n flex-grow: 0;\n"], ["\n flex-grow: 0;\n"])));
14204
+ var Description$4 = styled.p(templateObject_3$n || (templateObject_3$n = __makeTemplateObject(["\n line-height: 1.5;\n margin-bottom: 50px;\n"], ["\n line-height: 1.5;\n margin-bottom: 50px;\n"])));
14205
+ var RetryButton$1 = styled(LoaderButton)(templateObject_4$h || (templateObject_4$h = __makeTemplateObject(["\n width: 200px;\n margin: 0 auto;\n"], ["\n width: 200px;\n margin: 0 auto;\n"])));
14206
+ var templateObject_1$C, templateObject_2$v, templateObject_3$n, templateObject_4$h;
14249
14207
 
14250
- var ExitCaptureStyledButton = styled.button(templateObject_1$z || (templateObject_1$z = __makeTemplateObject(["\n position: absolute;\n top: 12px;\n right: 12px;\n font-size: 20px;\n width: 32px;\n height: 32px;\n font-family: monospace;\n z-index: 1002;\n border: none;\n border-radius: 4px;\n background: #ccc;\n cursor: pointer;\n padding: 8px;\n box-sizing: border-box;\n display: flex;\n\n &:hover {\n background: #ddd;\n }\n\n & > svg {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n }\n"], ["\n position: absolute;\n top: 12px;\n right: 12px;\n font-size: 20px;\n width: 32px;\n height: 32px;\n font-family: monospace;\n z-index: 1002;\n border: none;\n border-radius: 4px;\n background: #ccc;\n cursor: pointer;\n padding: 8px;\n box-sizing: border-box;\n display: flex;\n\n &:hover {\n background: #ddd;\n }\n\n & > svg {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n }\n"])));
14208
+ var ExitCaptureStyledButton = styled.button(templateObject_1$B || (templateObject_1$B = __makeTemplateObject(["\n position: absolute;\n top: 12px;\n right: 12px;\n font-size: 20px;\n width: 32px;\n height: 32px;\n font-family: monospace;\n z-index: 1002;\n border: none;\n border-radius: 4px;\n background: #ccc;\n cursor: pointer;\n padding: 8px;\n box-sizing: border-box;\n display: flex;\n\n &:hover {\n background: #ddd;\n }\n\n & > svg {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n }\n"], ["\n position: absolute;\n top: 12px;\n right: 12px;\n font-size: 20px;\n width: 32px;\n height: 32px;\n font-family: monospace;\n z-index: 1002;\n border: none;\n border-radius: 4px;\n background: #ccc;\n cursor: pointer;\n padding: 8px;\n box-sizing: border-box;\n display: flex;\n\n &:hover {\n background: #ddd;\n }\n\n & > svg {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n }\n"])));
14251
14209
  var ExitCaptureButton = function ExitCaptureButton(_a) {
14252
14210
  var onClick = _a.onClick,
14253
14211
  className = _a.className;
@@ -14291,10 +14249,10 @@
14291
14249
  y2: "19.75"
14292
14250
  }))));
14293
14251
  };
14294
- var templateObject_1$z;
14252
+ var templateObject_1$B;
14295
14253
 
14296
- var ButtonsRow = styled.div(templateObject_1$y || (templateObject_1$y = __makeTemplateObject(["\n display: flex;\n gap: 0 15px;\n justify-content: center;\n"], ["\n display: flex;\n gap: 0 15px;\n justify-content: center;\n"])));
14297
- var templateObject_1$y;
14254
+ var ButtonsRow = styled.div(templateObject_1$A || (templateObject_1$A = __makeTemplateObject(["\n display: flex;\n gap: 0 15px;\n justify-content: center;\n"], ["\n display: flex;\n gap: 0 15px;\n justify-content: center;\n"])));
14255
+ var templateObject_1$A;
14298
14256
 
14299
14257
  function IdCaptureLoadingGraphic(props) {
14300
14258
  var isMobile = window.innerHeight > window.innerWidth;
@@ -14323,25 +14281,15 @@
14323
14281
  var theme = styled.useTheme();
14324
14282
  var accentColor = (_d = (_c = (_b = theme.idCapture) === null || _b === void 0 ? void 0 : _b.loadingOverlay) === null || _c === void 0 ? void 0 : _c.loadingGraphicAccentColor) !== null && _d !== void 0 ? _d : 'var(--idm-color-positive-600)';
14325
14283
  var accentOpacity = (_g = (_f = (_e = theme.idCapture) === null || _e === void 0 ? void 0 : _e.loadingOverlay) === null || _f === void 0 ? void 0 : _f.loadingGraphicAccentOpacity) !== null && _g !== void 0 ? _g : 0.2;
14326
- return /*#__PURE__*/React.createElement("div", {
14327
- style: {
14328
- display: 'flex',
14329
- width: '100%',
14330
- height: '100%'
14331
- }
14332
- }, /*#__PURE__*/React.createElement("svg", {
14284
+ return /*#__PURE__*/React.createElement(LoadingGraphicWrapper, null, /*#__PURE__*/React.createElement(LoadingGraphicSvg, {
14333
14285
  className: className,
14334
14286
  width: width,
14335
14287
  height: height,
14288
+ "$frame": frame,
14289
+ "$borderColor": accentColor,
14336
14290
  viewBox: "0 0 698 452",
14337
14291
  fill: "none",
14338
- xmlns: "http://www.w3.org/2000/svg",
14339
- style: {
14340
- margin: 'auto',
14341
- transform: "scale(".concat(frame > 1 ? 1 : frame === 1 ? 1.25 : 0.75, ")"),
14342
- transition: 'transform 0.2s linear, border-width 0.2s linear',
14343
- border: "".concat(frame >= 5 ? 10 : 0, "px solid ").concat(accentColor)
14344
- }
14292
+ xmlns: "http://www.w3.org/2000/svg"
14345
14293
  }, /*#__PURE__*/React.createElement("g", {
14346
14294
  filter: frame === 1 ? 'url(#filter0_f_91_884)' : undefined
14347
14295
  }, /*#__PURE__*/React.createElement("path", {
@@ -14569,12 +14517,9 @@
14569
14517
  viewBox: "0 0 428 747",
14570
14518
  fill: "none",
14571
14519
  xmlns: "http://www.w3.org/2000/svg"
14572
- }, /*#__PURE__*/React.createElement("g", {
14520
+ }, /*#__PURE__*/React.createElement(LoadingGraphicCardGroup, {
14573
14521
  id: "card",
14574
- style: {
14575
- transform: "translate(".concat(frame < 1 ? '-500px' : '0', ", 0)"),
14576
- transition: 'transform 0.3s linear'
14577
- }
14522
+ "$offScreen": frame < 1
14578
14523
  }, /*#__PURE__*/React.createElement("path", {
14579
14524
  d: "M76.5001 181.274C76.5001 176.027 80.7534 171.774 86.0001 171.774L342 171.774C347.247 171.774 351.5 176.027 351.5 181.274L351.5 586C351.5 591.247 347.247 595.5 342 595.5L86.0001 595.5C80.7534 595.5 76.5001 591.247 76.5001 586L76.5001 181.274Z",
14580
14525
  fill: "#F3F3F3",
@@ -14757,13 +14702,10 @@
14757
14702
  strokeWidth: "5",
14758
14703
  strokeLinecap: "round",
14759
14704
  strokeLinejoin: "round"
14760
- }))), /*#__PURE__*/React.createElement("g", {
14705
+ }))), /*#__PURE__*/React.createElement(LoadingGraphicPhoneGroup, {
14761
14706
  id: "phone",
14762
14707
  clipPath: "url(#clip0_29_1778)",
14763
- style: {
14764
- transform: "translate(".concat(frame < 1 ? '40px' : '0', ", 0)"),
14765
- transition: 'transform 0.3s linear'
14766
- }
14708
+ "$offScreen": frame < 1
14767
14709
  }, /*#__PURE__*/React.createElement("rect", {
14768
14710
  x: "154",
14769
14711
  y: "693",
@@ -14791,6 +14733,21 @@
14791
14733
  fill: "white"
14792
14734
  }))));
14793
14735
  }
14736
+ var LoadingGraphicWrapper = styled.div(templateObject_1$z || (templateObject_1$z = __makeTemplateObject(["\n display: flex;\n width: 100%;\n height: 100%;\n"], ["\n display: flex;\n width: 100%;\n height: 100%;\n"])));
14737
+ var LoadingGraphicSvg = styled.svg(templateObject_2$u || (templateObject_2$u = __makeTemplateObject(["\n margin: auto;\n transform: scale(\n ", "\n );\n transform-style: preserve-3d;\n transition:\n transform 0.2s linear,\n border-width 0.2s linear;\n border: ", "px solid\n ", ";\n"], ["\n margin: auto;\n transform: scale(\n ", "\n );\n transform-style: preserve-3d;\n transition:\n transform 0.2s linear,\n border-width 0.2s linear;\n border: ", "px solid\n ", ";\n"])), function (props) {
14738
+ return props.$frame > 1 ? 1 : props.$frame === 1 ? 1.25 : 0.75;
14739
+ }, function (props) {
14740
+ return props.$frame >= 5 ? 10 : 0;
14741
+ }, function (props) {
14742
+ return props.$borderColor;
14743
+ });
14744
+ var LoadingGraphicCardGroup = styled.g(templateObject_3$m || (templateObject_3$m = __makeTemplateObject(["\n transform: translate(", ", 0);\n transform-style: preserve-3d;\n transition: transform 0.3s linear;\n"], ["\n transform: translate(", ", 0);\n transform-style: preserve-3d;\n transition: transform 0.3s linear;\n"])), function (props) {
14745
+ return props.$offScreen ? '-500px' : '0';
14746
+ });
14747
+ var LoadingGraphicPhoneGroup = styled.g(templateObject_4$g || (templateObject_4$g = __makeTemplateObject(["\n transform: translate(", ", 0);\n transform-style: preserve-3d;\n transition: transform 0.3s linear;\n"], ["\n transform: translate(", ", 0);\n transform-style: preserve-3d;\n transition: transform 0.3s linear;\n"])), function (props) {
14748
+ return props.$offScreen ? '40px' : '0';
14749
+ });
14750
+ var templateObject_1$z, templateObject_2$u, templateObject_3$m, templateObject_4$g;
14794
14751
 
14795
14752
  function LoadingListItemIndicator(_a) {
14796
14753
  var _b = _a.state,
@@ -14861,7 +14818,7 @@
14861
14818
  var _o = React.useContext(IdCaptureModelsContext),
14862
14819
  modelsReady = _o.ready,
14863
14820
  modelDownloadProgress = _o.modelDownloadProgress;
14864
- var _p = React.useContext(CameraStateContext),
14821
+ var _p = useCameraStore(),
14865
14822
  cameraReady = _p.cameraReady,
14866
14823
  cameraAccessDenied = _p.cameraAccessDenied,
14867
14824
  iphoneContinuityCameraAvailable = _p.iphoneContinuityCameraAvailable,
@@ -14985,24 +14942,24 @@
14985
14942
  }
14986
14943
  }, verbiage.continueText))))));
14987
14944
  };
14988
- var OverlayInner$1 = styled.div(templateObject_1$x || (templateObject_1$x = __makeTemplateObject(["\n height: 100dvh;\n display: flex;\n flex-direction: column;\n background: ", ";\n color: ", ";\n"], ["\n height: 100dvh;\n display: flex;\n flex-direction: column;\n background: ", ";\n color: ", ";\n"])), function (props) {
14945
+ var OverlayInner$1 = styled.div(templateObject_1$y || (templateObject_1$y = __makeTemplateObject(["\n height: 100dvh;\n display: flex;\n flex-direction: column;\n background: ", ";\n color: ", ";\n"], ["\n height: 100dvh;\n display: flex;\n flex-direction: column;\n background: ", ";\n color: ", ";\n"])), function (props) {
14989
14946
  var _a, _b, _c, _d;
14990
14947
  return (_d = (_c = (_b = (_a = props.theme) === null || _a === void 0 ? void 0 : _a.idCapture) === null || _b === void 0 ? void 0 : _b.loadingOverlay) === null || _c === void 0 ? void 0 : _c.backgroundColor) !== null && _d !== void 0 ? _d : '#ecedf3';
14991
14948
  }, function (props) {
14992
14949
  var _a, _b, _c, _d;
14993
14950
  return (_d = (_c = (_b = (_a = props.theme) === null || _a === void 0 ? void 0 : _a.idCapture) === null || _b === void 0 ? void 0 : _b.loadingOverlay) === null || _c === void 0 ? void 0 : _c.textColor) !== null && _d !== void 0 ? _d : 'black';
14994
14951
  });
14995
- var OverlayHeader$1 = styled.div(templateObject_2$s || (templateObject_2$s = __makeTemplateObject(["\n text-align: ", ";\n display: flex;\n flex-direction: column;\n flex-wrap: nowrap;\n ", "\n padding-bottom: 0;\n"], ["\n text-align: ", ";\n display: flex;\n flex-direction: column;\n flex-wrap: nowrap;\n ", "\n padding-bottom: 0;\n"])), function (props) {
14952
+ var OverlayHeader$1 = styled.div(templateObject_2$t || (templateObject_2$t = __makeTemplateObject(["\n text-align: ", ";\n display: flex;\n flex-direction: column;\n flex-wrap: nowrap;\n ", "\n padding-bottom: 0;\n"], ["\n text-align: ", ";\n display: flex;\n flex-direction: column;\n flex-wrap: nowrap;\n ", "\n padding-bottom: 0;\n"])), function (props) {
14996
14953
  var _a;
14997
14954
  return (_a = props.theme.textAlign) !== null && _a !== void 0 ? _a : 'center';
14998
14955
  }, function (props) {
14999
14956
  return props.theme.padding ? "box-sizing: border-box; padding: ".concat(props.theme.padding, ";") : "";
15000
14957
  });
15001
- var StyledGuidanceMessage$2 = styled(GuidanceMessage)(templateObject_3$k || (templateObject_3$k = __makeTemplateObject(["\n padding: 16px 24px;\n margin-top: 16px;\n font-size: 18px;\n font-weight: bold;\n background: white;\n box-shadow:\n 0 1px 3px 0 rgb(0 0 0 / 0.1),\n 0 1px 2px -1px rgb(0 0 0 / 0.1);\n"], ["\n padding: 16px 24px;\n margin-top: 16px;\n font-size: 18px;\n font-weight: bold;\n background: white;\n box-shadow:\n 0 1px 3px 0 rgb(0 0 0 / 0.1),\n 0 1px 2px -1px rgb(0 0 0 / 0.1);\n"])));
15002
- var StyledOverlayImageContainer$2 = styled(OverlayImageContainer)(templateObject_4$e || (templateObject_4$e = __makeTemplateObject(["\n padding: 0 0 100px;\n\n & > svg {\n height: 100%;\n }\n"], ["\n padding: 0 0 100px;\n\n & > svg {\n height: 100%;\n }\n"])));
15003
- var ContinuityCameraCheckboxContainer$1 = styled.div(templateObject_5$9 || (templateObject_5$9 = __makeTemplateObject(["\n position: fixed;\n bottom: 120px;\n width: 100dvw;\n display: flex;\n"], ["\n position: fixed;\n bottom: 120px;\n width: 100dvw;\n display: flex;\n"])));
15004
- var ContinuityCameraCheckboxInner = styled(GuidanceMessage)(templateObject_6$7 || (templateObject_6$7 = __makeTemplateObject(["\n padding: 12px 18px;\n margin: 0 auto;\n font-size: 14px;\n font-weight: bold;\n background: white;\n box-shadow:\n 0 1px 3px 0 rgb(0 0 0 / 0.1),\n 0 1px 2px -1px rgb(0 0 0 / 0.1);\n"], ["\n padding: 12px 18px;\n margin: 0 auto;\n font-size: 14px;\n font-weight: bold;\n background: white;\n box-shadow:\n 0 1px 3px 0 rgb(0 0 0 / 0.1),\n 0 1px 2px -1px rgb(0 0 0 / 0.1);\n"])));
15005
- var ContinuityCameraCheckbox$1 = styled.input(templateObject_7$4 || (templateObject_7$4 = __makeTemplateObject(["\n margin-right: 8px;\n"], ["\n margin-right: 8px;\n"])));
14958
+ var StyledGuidanceMessage$2 = styled(GuidanceMessage)(templateObject_3$l || (templateObject_3$l = __makeTemplateObject(["\n padding: 16px 24px;\n margin-top: 16px;\n font-size: 18px;\n font-weight: bold;\n background: white;\n box-shadow:\n 0 1px 3px 0 rgb(0 0 0 / 0.1),\n 0 1px 2px -1px rgb(0 0 0 / 0.1);\n"], ["\n padding: 16px 24px;\n margin-top: 16px;\n font-size: 18px;\n font-weight: bold;\n background: white;\n box-shadow:\n 0 1px 3px 0 rgb(0 0 0 / 0.1),\n 0 1px 2px -1px rgb(0 0 0 / 0.1);\n"])));
14959
+ var StyledOverlayImageContainer$2 = styled(OverlayImageContainer)(templateObject_4$f || (templateObject_4$f = __makeTemplateObject(["\n padding: 0 0 100px;\n\n & > svg {\n height: 100%;\n }\n"], ["\n padding: 0 0 100px;\n\n & > svg {\n height: 100%;\n }\n"])));
14960
+ var ContinuityCameraCheckboxContainer$1 = styled.div(templateObject_5$a || (templateObject_5$a = __makeTemplateObject(["\n position: fixed;\n bottom: 120px;\n width: 100dvw;\n display: flex;\n"], ["\n position: fixed;\n bottom: 120px;\n width: 100dvw;\n display: flex;\n"])));
14961
+ var ContinuityCameraCheckboxInner = styled(GuidanceMessage)(templateObject_6$8 || (templateObject_6$8 = __makeTemplateObject(["\n padding: 12px 18px;\n margin: 0 auto;\n font-size: 14px;\n font-weight: bold;\n background: white;\n box-shadow:\n 0 1px 3px 0 rgb(0 0 0 / 0.1),\n 0 1px 2px -1px rgb(0 0 0 / 0.1);\n"], ["\n padding: 12px 18px;\n margin: 0 auto;\n font-size: 14px;\n font-weight: bold;\n background: white;\n box-shadow:\n 0 1px 3px 0 rgb(0 0 0 / 0.1),\n 0 1px 2px -1px rgb(0 0 0 / 0.1);\n"])));
14962
+ var ContinuityCameraCheckbox$1 = styled.input(templateObject_7$5 || (templateObject_7$5 = __makeTemplateObject(["\n margin-right: 8px;\n"], ["\n margin-right: 8px;\n"])));
15006
14963
  var StyledButtonsRow$a = styled(ButtonsRow)(templateObject_8$2 || (templateObject_8$2 = __makeTemplateObject(["\n display: flex;\n flex-direction: row;\n padding: 15px 25px;\n height: 100px;\n color: ", ";\n ", "\n position: fixed;\n bottom: 0;\n left: 0;\n width: 100dvw;\n box-sizing: border-box;\n"], ["\n display: flex;\n flex-direction: row;\n padding: 15px 25px;\n height: 100px;\n color: ", ";\n ", "\n position: fixed;\n bottom: 0;\n left: 0;\n width: 100dvw;\n box-sizing: border-box;\n"])), function (props) {
15007
14964
  var _a, _b, _c, _d;
15008
14965
  return (_d = (_c = (_b = (_a = props.theme) === null || _a === void 0 ? void 0 : _a.idCapture) === null || _b === void 0 ? void 0 : _b.loadingOverlay) === null || _c === void 0 ? void 0 : _c.progressBarTextColor) !== null && _d !== void 0 ? _d : 'white';
@@ -15028,7 +14985,7 @@
15028
14985
  var _a, _b, _c, _d;
15029
14986
  return (_d = (_c = (_b = (_a = props.theme) === null || _a === void 0 ? void 0 : _a.idCapture) === null || _b === void 0 ? void 0 : _b.loadingOverlay) === null || _c === void 0 ? void 0 : _c.progressBarIndicatorColor) !== null && _d !== void 0 ? _d : 'var(--idm-color-positive-600)';
15030
14987
  }, progressBarAnimation);
15031
- var CustomLoadingGraphic$1 = styled.img(templateObject_16 || (templateObject_16 = __makeTemplateObject([""], [""])));
14988
+ var CustomLoadingGraphic$1 = styled.img(templateObject_16 || (templateObject_16 = __makeTemplateObject(["\n transform-style: preserve-3d;\n"], ["\n transform-style: preserve-3d;\n"])));
15032
14989
  var ContinueButtonContainer$1 = styled.div(templateObject_17 || (templateObject_17 = __makeTemplateObject(["\n display: flex;\n"], ["\n display: flex;\n"])));
15033
14990
  var ContinueButton$1 = styled(LoaderButton)(templateObject_18 || (templateObject_18 = __makeTemplateObject(["\n margin: auto;\n white-space: nowrap;\n ", "\n ", "\n"], ["\n margin: auto;\n white-space: nowrap;\n ", "\n ", "\n"])), function (props) {
15034
14991
  var _a, _b, _c, _d, _e, _f;
@@ -15037,10 +14994,75 @@
15037
14994
  var _a, _b, _c, _d, _e, _f;
15038
14995
  return ((_c = (_b = (_a = props.theme) === null || _a === void 0 ? void 0 : _a.idCapture) === null || _b === void 0 ? void 0 : _b.loadingOverlay) === null || _c === void 0 ? void 0 : _c.continueBtnBorder) ? "border: ".concat((_f = (_e = (_d = props.theme) === null || _d === void 0 ? void 0 : _d.idCapture) === null || _e === void 0 ? void 0 : _e.loadingOverlay) === null || _f === void 0 ? void 0 : _f.continueBtnBorder, ";") : '';
15039
14996
  });
15040
- var templateObject_1$x, templateObject_2$s, templateObject_3$k, templateObject_4$e, templateObject_5$9, templateObject_6$7, templateObject_7$4, templateObject_8$2, templateObject_9$2, templateObject_10$1, templateObject_11$1, templateObject_12$1, templateObject_13$1, templateObject_14$1, templateObject_15$1, templateObject_16, templateObject_17, templateObject_18;
14997
+ var templateObject_1$y, templateObject_2$t, templateObject_3$l, templateObject_4$f, templateObject_5$a, templateObject_6$8, templateObject_7$5, templateObject_8$2, templateObject_9$2, templateObject_10$1, templateObject_11$1, templateObject_12$1, templateObject_13$1, templateObject_14$1, templateObject_15$1, templateObject_16, templateObject_17, templateObject_18;
14998
+
14999
+ function _createForOfIteratorHelperLoose(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: !0 } : { done: !1, value: r[o++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
15000
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
15001
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
15002
+ var isIterable = function isIterable(obj) {
15003
+ return Symbol.iterator in obj;
15004
+ };
15005
+ var compareMapLike = function compareMapLike(iterableA, iterableB) {
15006
+ var mapA = iterableA instanceof Map ? iterableA : new Map(iterableA);
15007
+ var mapB = iterableB instanceof Map ? iterableB : new Map(iterableB);
15008
+ if (mapA.size !== mapB.size) return false;
15009
+ for (var _iterator = _createForOfIteratorHelperLoose(mapA), _step; !(_step = _iterator()).done;) {
15010
+ var _step$value = _step.value,
15011
+ key = _step$value[0],
15012
+ value = _step$value[1];
15013
+ if (!Object.is(value, mapB.get(key))) {
15014
+ return false;
15015
+ }
15016
+ }
15017
+ return true;
15018
+ };
15019
+ function shallow(objA, objB) {
15020
+ if (Object.is(objA, objB)) {
15021
+ return true;
15022
+ }
15023
+ if (typeof objA !== "object" || objA === null || typeof objB !== "object" || objB === null) {
15024
+ return false;
15025
+ }
15026
+ if (isIterable(objA) && isIterable(objB)) {
15027
+ var iteratorA = objA[Symbol.iterator]();
15028
+ var iteratorB = objB[Symbol.iterator]();
15029
+ var nextA = iteratorA.next();
15030
+ var nextB = iteratorB.next();
15031
+ if (Array.isArray(nextA.value) && Array.isArray(nextB.value) && nextA.value.length === 2 && nextB.value.length === 2) {
15032
+ return compareMapLike(objA, objB);
15033
+ }
15034
+ while (!nextA.done && !nextB.done) {
15035
+ if (!Object.is(nextA.value, nextB.value)) {
15036
+ return false;
15037
+ }
15038
+ nextA = iteratorA.next();
15039
+ nextB = iteratorB.next();
15040
+ }
15041
+ return !!nextA.done && !!nextB.done;
15042
+ }
15043
+ var keysA = Object.keys(objA);
15044
+ if (keysA.length !== Object.keys(objB).length) {
15045
+ return false;
15046
+ }
15047
+ for (var _i = 0, _keysA = keysA; _i < _keysA.length; _i++) {
15048
+ var keyA = _keysA[_i];
15049
+ if (!Object.hasOwn(objB, keyA) || !Object.is(objA[keyA], objB[keyA])) {
15050
+ return false;
15051
+ }
15052
+ }
15053
+ return true;
15054
+ }
15055
+
15056
+ function useShallow(selector) {
15057
+ var prev = React.useRef();
15058
+ return function (state) {
15059
+ var next = selector(state);
15060
+ return shallow(prev.current, next) ? prev.current : prev.current = next;
15061
+ };
15062
+ }
15041
15063
 
15042
- var ContinuityCameraCheckboxContainer = styled.div(templateObject_1$w || (templateObject_1$w = __makeTemplateObject(["\n margin-top: 15px;\n margin-bottom: 15px;\n"], ["\n margin-top: 15px;\n margin-bottom: 15px;\n"])));
15043
- var ContinuityCameraCheckbox = styled.input(templateObject_2$r || (templateObject_2$r = __makeTemplateObject(["\n margin-right: 8px;\n"], ["\n margin-right: 8px;\n"])));
15064
+ var ContinuityCameraCheckboxContainer = styled.div(templateObject_1$x || (templateObject_1$x = __makeTemplateObject(["\n margin-top: 15px;\n margin-bottom: 15px;\n"], ["\n margin-top: 15px;\n margin-bottom: 15px;\n"])));
15065
+ var ContinuityCameraCheckbox = styled.input(templateObject_2$s || (templateObject_2$s = __makeTemplateObject(["\n margin-right: 8px;\n"], ["\n margin-right: 8px;\n"])));
15044
15066
  var IdCaptureLoadingOverlayLegacy = function IdCaptureLoadingOverlayLegacy(_a) {
15045
15067
  var _b, _c, _d, _e;
15046
15068
  var onDismissed = _a.onDismissed,
@@ -15059,7 +15081,14 @@
15059
15081
  var _l = React.useContext(IdCaptureModelsContext),
15060
15082
  modelsReady = _l.ready,
15061
15083
  modelDownloadProgress = _l.modelDownloadProgress;
15062
- var _m = React.useContext(CameraStateContext),
15084
+ var _m = useCameraStore(useShallow(function (state) {
15085
+ return {
15086
+ cameraReady: state.cameraReady,
15087
+ cameraAccessDenied: state.cameraAccessDenied,
15088
+ iphoneContinuityCameraAvailable: state.iphoneContinuityCameraAvailable,
15089
+ setIphoneContinuityCameraAllowed: state.setIphoneContinuityCameraAllowed
15090
+ };
15091
+ })),
15063
15092
  cameraReady = _m.cameraReady,
15064
15093
  cameraAccessDenied = _m.cameraAccessDenied,
15065
15094
  iphoneContinuityCameraAvailable = _m.iphoneContinuityCameraAvailable,
@@ -15151,7 +15180,7 @@
15151
15180
  }
15152
15181
  }, cameraReady && modelsReady ? verbiage.continueText : modelsReady ? verbiage.cameraInitializingText : modelDownloadProgress >= 100 ? verbiage.modelsWarmingUpText : "".concat(verbiage.downloadingText, " (").concat(modelDownloadProgress, "%)"))));
15153
15182
  };
15154
- var templateObject_1$w, templateObject_2$r;
15183
+ var templateObject_1$x, templateObject_2$s;
15155
15184
 
15156
15185
  var components$1 = {
15157
15186
  "default": IdCaptureLoadingOverlayDefault,
@@ -15209,9 +15238,9 @@
15209
15238
  });
15210
15239
  };
15211
15240
 
15212
- var Card = styled.div(templateObject_1$v || (templateObject_1$v = __makeTemplateObject(["\n background: white;\n border-radius: 8px;\n padding: 24px;\n box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);\n margin: auto;\n max-width: min(500px, 100dvw - 48px);\n max-height: 100%;\n overflow: auto;\n box-sizing: border-box;\n"], ["\n background: white;\n border-radius: 8px;\n padding: 24px;\n box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);\n margin: auto;\n max-width: min(500px, 100dvw - 48px);\n max-height: 100%;\n overflow: auto;\n box-sizing: border-box;\n"])));
15213
- var FlexCard = styled(Card)(templateObject_2$q || (templateObject_2$q = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n"], ["\n display: flex;\n flex-direction: column;\n"])));
15214
- var templateObject_1$v, templateObject_2$q;
15241
+ var Card = styled.div(templateObject_1$w || (templateObject_1$w = __makeTemplateObject(["\n background: white;\n border-radius: 8px;\n padding: 24px;\n box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);\n margin: auto;\n max-width: min(500px, 100dvw - 48px);\n max-height: 100%;\n overflow: auto;\n box-sizing: border-box;\n"], ["\n background: white;\n border-radius: 8px;\n padding: 24px;\n box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);\n margin: auto;\n max-width: min(500px, 100dvw - 48px);\n max-height: 100%;\n overflow: auto;\n box-sizing: border-box;\n"])));
15242
+ var FlexCard = styled(Card)(templateObject_2$r || (templateObject_2$r = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n"], ["\n display: flex;\n flex-direction: column;\n"])));
15243
+ var templateObject_1$w, templateObject_2$r;
15215
15244
 
15216
15245
  var IdCaptureSuccess = function IdCaptureSuccess(_a) {
15217
15246
  var capturedDocuments = _a.capturedDocuments,
@@ -15286,13 +15315,13 @@
15286
15315
  finished: true
15287
15316
  }, verbiage.retryText)))));
15288
15317
  };
15289
- var Heading$a = styled.h1(templateObject_1$u || (templateObject_1$u = __makeTemplateObject(["\n font-size: 1.5rem;\n margin-top: 0;\n margin-bottom: 1.5rem;\n"], ["\n font-size: 1.5rem;\n margin-top: 0;\n margin-bottom: 1.5rem;\n"])));
15290
- var ImagesContainer = styled(OverlayImageContainer)(templateObject_2$p || (templateObject_2$p = __makeTemplateObject(["\n flex-grow: 1;\n overflow-y: auto;\n padding-bottom: 0;\n max-width: 100%;\n"], ["\n flex-grow: 1;\n overflow-y: auto;\n padding-bottom: 0;\n max-width: 100%;\n"])));
15291
- var ImageRow = styled(OverlayImageRow)(templateObject_3$j || (templateObject_3$j = __makeTemplateObject(["\n max-width: 100%;\n flex-direction: column;\n display: grid;\n grid-gap: 12px;\n //grid-template-columns: 1fr 1fr;\n"], ["\n max-width: 100%;\n flex-direction: column;\n display: grid;\n grid-gap: 12px;\n //grid-template-columns: 1fr 1fr;\n"])));
15292
- var ImageCol$1 = styled.div(templateObject_4$d || (templateObject_4$d = __makeTemplateObject(["\n width: 100%;\n max-height: none !important;\n"], ["\n width: 100%;\n max-height: none !important;\n"])));
15293
- var StyledImage = styled(CapturedDocumentImg)(templateObject_5$8 || (templateObject_5$8 = __makeTemplateObject(["\n width: 100%;\n border-radius: 12px;\n"], ["\n width: 100%;\n border-radius: 12px;\n"])));
15294
- var DebugPre = styled.pre(templateObject_6$6 || (templateObject_6$6 = __makeTemplateObject(["\n text-align: left;\n max-width: min(450px, 100dvw - 100px);\n overflow-x: auto;\n"], ["\n text-align: left;\n max-width: min(450px, 100dvw - 100px);\n overflow-x: auto;\n"])));
15295
- var templateObject_1$u, templateObject_2$p, templateObject_3$j, templateObject_4$d, templateObject_5$8, templateObject_6$6;
15318
+ var Heading$a = styled.h1(templateObject_1$v || (templateObject_1$v = __makeTemplateObject(["\n font-size: 1.5rem;\n margin-top: 0;\n margin-bottom: 1.5rem;\n"], ["\n font-size: 1.5rem;\n margin-top: 0;\n margin-bottom: 1.5rem;\n"])));
15319
+ var ImagesContainer = styled(OverlayImageContainer)(templateObject_2$q || (templateObject_2$q = __makeTemplateObject(["\n flex-grow: 1;\n overflow-y: auto;\n padding-bottom: 0;\n max-width: 100%;\n"], ["\n flex-grow: 1;\n overflow-y: auto;\n padding-bottom: 0;\n max-width: 100%;\n"])));
15320
+ var ImageRow = styled(OverlayImageRow)(templateObject_3$k || (templateObject_3$k = __makeTemplateObject(["\n max-width: 100%;\n flex-direction: column;\n display: grid;\n grid-gap: 12px;\n //grid-template-columns: 1fr 1fr;\n"], ["\n max-width: 100%;\n flex-direction: column;\n display: grid;\n grid-gap: 12px;\n //grid-template-columns: 1fr 1fr;\n"])));
15321
+ var ImageCol$1 = styled.div(templateObject_4$e || (templateObject_4$e = __makeTemplateObject(["\n width: 100%;\n max-height: none !important;\n"], ["\n width: 100%;\n max-height: none !important;\n"])));
15322
+ var StyledImage = styled(CapturedDocumentImg)(templateObject_5$9 || (templateObject_5$9 = __makeTemplateObject(["\n width: 100%;\n border-radius: 12px;\n"], ["\n width: 100%;\n border-radius: 12px;\n"])));
15323
+ var DebugPre = styled.pre(templateObject_6$7 || (templateObject_6$7 = __makeTemplateObject(["\n text-align: left;\n max-width: min(450px, 100dvw - 100px);\n overflow-x: auto;\n"], ["\n text-align: left;\n max-width: min(450px, 100dvw - 100px);\n overflow-x: auto;\n"])));
15324
+ var templateObject_1$v, templateObject_2$q, templateObject_3$k, templateObject_4$e, templateObject_5$9, templateObject_6$7;
15296
15325
 
15297
15326
  function useShowSuccessScreen(skipSuccessScreen, successScreenReady, onDoneCallback) {
15298
15327
  var _this = this;
@@ -15344,10 +15373,10 @@
15344
15373
  canvas.style.height = '0';
15345
15374
  }
15346
15375
 
15347
- var IdCardGuideImageContainer = styled(IdCardBorder)(templateObject_1$t || (templateObject_1$t = __makeTemplateObject(["\n position: relative;\n ", "\n box-sizing: border-box;\n"], ["\n position: relative;\n ", "\n box-sizing: border-box;\n"])), function (props) {
15376
+ var IdCardGuideImageContainer = styled(IdCardBorder)(templateObject_1$u || (templateObject_1$u = __makeTemplateObject(["\n position: relative;\n ", "\n box-sizing: border-box;\n"], ["\n position: relative;\n ", "\n box-sizing: border-box;\n"])), function (props) {
15348
15377
  return props.$isVisible ? '' : 'opacity: 0;';
15349
15378
  });
15350
- var IdCardGuideImage = styled.img(templateObject_2$o || (templateObject_2$o = __makeTemplateObject(["\n ", "\n ", "\n"], ["\n ", "\n ", "\n"])), function (props) {
15379
+ var IdCardGuideImage = styled.img(templateObject_2$p || (templateObject_2$p = __makeTemplateObject(["\n transform-style: preserve-3d;\n ", "\n ", "\n"], ["\n transform-style: preserve-3d;\n ", "\n ", "\n"])), function (props) {
15351
15380
  return props.$isMirrored ? 'transform: scaleX(-1);' : '';
15352
15381
  }, function (props) {
15353
15382
  return props.$isInvisible ? 'opacity: 0;' : '';
@@ -15489,16 +15518,16 @@
15489
15518
  className: isProgressBar ? "idmSdkProgressBorder ".concat(progressPaused ? 'idmSdkProgressPaused' : '') : ''
15490
15519
  }));
15491
15520
  }
15492
- var IdCardBorderContainer = styled.div(templateObject_3$i || (templateObject_3$i = __makeTemplateObject(["\n & > .idmSdkWaves {\n position: absolute;\n animation: ", " 2s ease-out infinite;\n\n &:nth-child(2) {\n animation-delay: 0.66s;\n }\n\n &:nth-child(3) {\n animation-delay: 1.33s;\n }\n }\n"], ["\n & > .idmSdkWaves {\n position: absolute;\n animation: ", " 2s ease-out infinite;\n\n &:nth-child(2) {\n animation-delay: 0.66s;\n }\n\n &:nth-child(3) {\n animation-delay: 1.33s;\n }\n }\n"])), wavesAnimation);
15493
- var SvgOverlay = styled.svg(templateObject_4$c || (templateObject_4$c = __makeTemplateObject(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n"], ["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n"])));
15494
- var IdCardBorderRect = styled.rect(templateObject_5$7 || (templateObject_5$7 = __makeTemplateObject(["\n &.idmSdkProgressBorder {\n animation: ", " ", "\n ", ";\n }\n\n &.idmSdkProgressPaused {\n animation-play-state: paused;\n }\n"], ["\n &.idmSdkProgressBorder {\n animation: ", " ", "\n ", ";\n }\n\n &.idmSdkProgressPaused {\n animation-play-state: paused;\n }\n"])), progressBorderAnimation, function (props) {
15521
+ var IdCardBorderContainer = styled.div(templateObject_3$j || (templateObject_3$j = __makeTemplateObject(["\n & > .idmSdkWaves {\n position: absolute;\n animation: ", " 2s ease-out infinite;\n transform-style: preserve-3d;\n\n &:nth-child(2) {\n animation-delay: 0.66s;\n }\n\n &:nth-child(3) {\n animation-delay: 1.33s;\n }\n }\n"], ["\n & > .idmSdkWaves {\n position: absolute;\n animation: ", " 2s ease-out infinite;\n transform-style: preserve-3d;\n\n &:nth-child(2) {\n animation-delay: 0.66s;\n }\n\n &:nth-child(3) {\n animation-delay: 1.33s;\n }\n }\n"])), wavesAnimation);
15522
+ var SvgOverlay = styled.svg(templateObject_4$d || (templateObject_4$d = __makeTemplateObject(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n"], ["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n"])));
15523
+ var IdCardBorderRect = styled.rect(templateObject_5$8 || (templateObject_5$8 = __makeTemplateObject(["\n &.idmSdkProgressBorder {\n animation: ", " ", "\n ", ";\n }\n\n &.idmSdkProgressPaused {\n animation-play-state: paused;\n }\n"], ["\n &.idmSdkProgressBorder {\n animation: ", " ", "\n ", ";\n }\n\n &.idmSdkProgressPaused {\n animation-play-state: paused;\n }\n"])), progressBorderAnimation, function (props) {
15495
15524
  var _a;
15496
15525
  return (_a = props.$speed) !== null && _a !== void 0 ? _a : '3s';
15497
15526
  }, function (props) {
15498
15527
  var _a;
15499
15528
  return (_a = props.$fillMode) !== null && _a !== void 0 ? _a : 'forwards';
15500
15529
  });
15501
- var templateObject_1$t, templateObject_2$o, templateObject_3$i, templateObject_4$c, templateObject_5$7;
15530
+ var templateObject_1$u, templateObject_2$p, templateObject_3$j, templateObject_4$d, templateObject_5$8;
15502
15531
 
15503
15532
  var defaultIdCaptureGuideImages = {
15504
15533
  portrait: {
@@ -15604,12 +15633,82 @@
15604
15633
  return allowPortraitOnMobile && window.innerWidth < window.innerHeight ? 'portrait' : 'landscape';
15605
15634
  }
15606
15635
 
15607
- var FlipImageContainer = styled(IdCardGuideImageContainer)(templateObject_1$s || (templateObject_1$s = __makeTemplateObject(["\n backface-visibility: hidden;\n transition: transform ", "s;\n transform: ", ";\n transform-style: preserve-3d;\n position: absolute;\n display: block;\n top: 0;\n width: 100%;\n max-height: 100%;\n"], ["\n backface-visibility: hidden;\n transition: transform ", "s;\n transform: ", ";\n transform-style: preserve-3d;\n position: absolute;\n display: block;\n top: 0;\n width: 100%;\n max-height: 100%;\n"])), function (props) {
15636
+ var IdVideoCaptureFlipIdPrompt = function IdVideoCaptureFlipIdPrompt(_a) {
15637
+ var _b = _a.idCaptureGuideImages,
15638
+ idCaptureGuideImages = _b === void 0 ? defaultIdCaptureGuideImages : _b,
15639
+ _c = _a.classNames,
15640
+ classNames = _c === void 0 ? {} : _c,
15641
+ borderWidth = _a.borderWidth,
15642
+ borderColor = _a.borderColor,
15643
+ borderRadius = _a.borderRadius,
15644
+ imageStyle = _a.imageStyle;
15645
+ var isRearFacing = useCameraStore(function (state) {
15646
+ return state.isRearFacing;
15647
+ });
15648
+ var isMirrored = !isRearFacing;
15649
+ var _d = React.useState(1),
15650
+ transitionTime = _d[0],
15651
+ setTransitionTime = _d[1];
15652
+ var _e = React.useState(0),
15653
+ rotationAngle = _e[0],
15654
+ setRotationAngle = _e[1];
15655
+ var frontTransforms = ["rotateY(".concat(rotationAngle, "deg)")];
15656
+ if (isMirrored) frontTransforms.push('scaleX(-1)');
15657
+ var backTransforms = ["rotateY(".concat(180 - rotationAngle, "deg)")];
15658
+ if (isMirrored) backTransforms.push('scaleX(-1)');
15659
+ React.useEffect(function () {
15660
+ var timeout;
15661
+ function doFlip() {
15662
+ setTransitionTime(1);
15663
+ setRotationAngle(180);
15664
+ timeout = setTimeout(function () {
15665
+ setTransitionTime(0);
15666
+ setRotationAngle(0);
15667
+ }, 1500);
15668
+ }
15669
+ var interval = setInterval(doFlip, 2500);
15670
+ timeout = setTimeout(doFlip, 250);
15671
+ return function () {
15672
+ clearInterval(interval);
15673
+ clearTimeout(timeout);
15674
+ };
15675
+ }, []);
15676
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FlipImageContainer, {
15677
+ className: classNames.frontImageContainer,
15678
+ status: "disabled",
15679
+ borderWidth: borderWidth,
15680
+ borderColor: borderColor,
15681
+ borderRadius: borderRadius,
15682
+ "$transforms": frontTransforms.join(' '),
15683
+ "$transitionTime": transitionTime,
15684
+ "$isVisible": true
15685
+ }, /*#__PURE__*/React.createElement(IdCardGuideImage, {
15686
+ src: idCaptureGuideImages.landscape.SHOW_ID_FRONT.url,
15687
+ className: classNames.frontImage,
15688
+ alt: "",
15689
+ style: imageStyle
15690
+ })), /*#__PURE__*/React.createElement(FlipImageContainer, {
15691
+ className: classNames.backImageContainer,
15692
+ status: "disabled",
15693
+ borderWidth: borderWidth,
15694
+ borderColor: borderColor,
15695
+ borderRadius: borderRadius,
15696
+ "$transforms": backTransforms.join(' '),
15697
+ "$transitionTime": transitionTime,
15698
+ "$isVisible": true
15699
+ }, /*#__PURE__*/React.createElement(IdCardGuideImage, {
15700
+ src: idCaptureGuideImages.landscape.SHOW_ID_BACK.url,
15701
+ className: classNames.backImage,
15702
+ alt: "",
15703
+ style: imageStyle
15704
+ })));
15705
+ };
15706
+ var FlipImageContainer = styled(IdCardGuideImageContainer)(templateObject_1$t || (templateObject_1$t = __makeTemplateObject(["\n backface-visibility: hidden;\n transition: transform ", "s;\n transform: ", ";\n transform-style: preserve-3d;\n position: absolute;\n display: block;\n top: 0;\n width: 100%;\n max-height: 100%;\n"], ["\n backface-visibility: hidden;\n transition: transform ", "s;\n transform: ", ";\n transform-style: preserve-3d;\n position: absolute;\n display: block;\n top: 0;\n width: 100%;\n max-height: 100%;\n"])), function (props) {
15608
15707
  return props.$transitionTime;
15609
15708
  }, function (props) {
15610
15709
  return props.$transforms;
15611
15710
  });
15612
- var templateObject_1$s;
15711
+ var templateObject_1$t;
15613
15712
 
15614
15713
  var GuideOrientationContext = /*#__PURE__*/React.createContext({
15615
15714
  orientation: 'landscape',
@@ -15898,10 +15997,10 @@
15898
15997
  return v;
15899
15998
  }).join(' ');
15900
15999
  };
15901
- var StyledPageContainer = styled(PageContainerDiv)(templateObject_1$r || (templateObject_1$r = __makeTemplateObject(["\n z-index: 1000;\n overflow-y: hidden;\n"], ["\n z-index: 1000;\n overflow-y: hidden;\n"])));
15902
- var GuidesContainer = styled.div(templateObject_2$n || (templateObject_2$n = __makeTemplateObject(["\n display: flex;\n flex-flow: column nowrap;\n width: 100dvw;\n height: 100dvh;\n"], ["\n display: flex;\n flex-flow: column nowrap;\n width: 100dvw;\n height: 100dvh;\n"])));
15903
- var GuideCenterRow = styled.div(templateObject_3$h || (templateObject_3$h = __makeTemplateObject(["\n position: relative;\n display: flex;\n flex-flow: row nowrap;\n align-items: center;\n justify-items: center;\n box-sizing: border-box;\n max-width: 100%;\n max-height: 100%;\n min-height: 0;\n flex: 1;\n"], ["\n position: relative;\n display: flex;\n flex-flow: row nowrap;\n align-items: center;\n justify-items: center;\n box-sizing: border-box;\n max-width: 100%;\n max-height: 100%;\n min-height: 0;\n flex: 1;\n"])));
15904
- var GuideRegion = styled.div(templateObject_4$b || (templateObject_4$b = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n justify-content: end;\n width: 100%;\n position: relative;\n z-index: 1000;\n background: ", ";\n color: ", ";\n text-align: center;\n ", "\n ", "\n"], ["\n display: flex;\n flex-direction: column;\n justify-content: end;\n width: 100%;\n position: relative;\n z-index: 1000;\n background: ", ";\n color: ", ";\n text-align: center;\n ", "\n ", "\n"])), function (props) {
16000
+ var StyledPageContainer = styled(PageContainerDiv)(templateObject_1$s || (templateObject_1$s = __makeTemplateObject(["\n z-index: 1000;\n overflow-y: hidden;\n"], ["\n z-index: 1000;\n overflow-y: hidden;\n"])));
16001
+ var GuidesContainer = styled.div(templateObject_2$o || (templateObject_2$o = __makeTemplateObject(["\n display: flex;\n flex-flow: column nowrap;\n width: 100dvw;\n height: 100dvh;\n"], ["\n display: flex;\n flex-flow: column nowrap;\n width: 100dvw;\n height: 100dvh;\n"])));
16002
+ var GuideCenterRow = styled.div(templateObject_3$i || (templateObject_3$i = __makeTemplateObject(["\n position: relative;\n display: flex;\n flex-flow: row nowrap;\n align-items: center;\n justify-items: center;\n box-sizing: border-box;\n max-width: 100%;\n max-height: 100%;\n min-height: 0;\n flex: 1;\n"], ["\n position: relative;\n display: flex;\n flex-flow: row nowrap;\n align-items: center;\n justify-items: center;\n box-sizing: border-box;\n max-width: 100%;\n max-height: 100%;\n min-height: 0;\n flex: 1;\n"])));
16003
+ var GuideRegion = styled.div(templateObject_4$c || (templateObject_4$c = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n justify-content: end;\n width: 100%;\n position: relative;\n z-index: 1000;\n background: ", ";\n color: ", ";\n text-align: center;\n ", "\n ", "\n"], ["\n display: flex;\n flex-direction: column;\n justify-content: end;\n width: 100%;\n position: relative;\n z-index: 1000;\n background: ", ";\n color: ", ";\n text-align: center;\n ", "\n ", "\n"])), function (props) {
15905
16004
  var _a, _b, _c, _d, _e;
15906
16005
  return (_e = (_a = props.$maskColor) !== null && _a !== void 0 ? _a : (_d = (_c = (_b = props.theme) === null || _b === void 0 ? void 0 : _b.idCapture) === null || _c === void 0 ? void 0 : _c.guideOverlay) === null || _d === void 0 ? void 0 : _d.backgroundColor) !== null && _e !== void 0 ? _e : 'rgba(0, 0, 0, 0.5)';
15907
16006
  }, function (props) {
@@ -15912,13 +16011,13 @@
15912
16011
  }, function (props) {
15913
16012
  return props.$minHeight ? "min-height: ".concat(props.$minHeight, "px;") : "";
15914
16013
  });
15915
- var Spacer = styled(GuideRegion)(templateObject_5$6 || (templateObject_5$6 = __makeTemplateObject(["\n display: block;\n width: auto;\n"], ["\n display: block;\n width: auto;\n"])));
15916
- var GuideCenterRegion = styled.div(templateObject_6$5 || (templateObject_6$5 = __makeTemplateObject(["\n ", "\n ", "\n box-sizing: border-box;\n display: flex;\n flex: 1;\n max-height: 100%;\n height: 100%;\n"], ["\n ", "\n ", "\n box-sizing: border-box;\n display: flex;\n flex: 1;\n max-height: 100%;\n height: 100%;\n"])), function (props) {
16014
+ var Spacer = styled(GuideRegion)(templateObject_5$7 || (templateObject_5$7 = __makeTemplateObject(["\n display: block;\n width: auto;\n"], ["\n display: block;\n width: auto;\n"])));
16015
+ var GuideCenterRegion = styled.div(templateObject_6$6 || (templateObject_6$6 = __makeTemplateObject(["\n ", "\n ", "\n transform-style: preserve-3d;\n box-sizing: border-box;\n display: flex;\n flex: 1;\n max-height: 100%;\n height: 100%;\n"], ["\n ", "\n ", "\n transform-style: preserve-3d;\n box-sizing: border-box;\n display: flex;\n flex: 1;\n max-height: 100%;\n height: 100%;\n"])), function (props) {
15917
16016
  return props.$minWidth ? "min-width: ".concat(props.$minWidth, "px;") : "";
15918
16017
  }, function (props) {
15919
16018
  return props.$isMirrored ? 'transform: scaleX(-1);' : '';
15920
16019
  });
15921
- var GuideCenterBorder = styled.div(templateObject_7$3 || (templateObject_7$3 = __makeTemplateObject(["\n box-sizing: border-box;\n border: ", ";\n display: flex;\n flex: 1;\n justify-content: center;\n max-height: 100%;\n min-height: 0;\n position: relative;\n ", "\n"], ["\n box-sizing: border-box;\n border: ", ";\n display: flex;\n flex: 1;\n justify-content: center;\n max-height: 100%;\n min-height: 0;\n position: relative;\n ", "\n"])), function (props) {
16020
+ var GuideCenterBorder = styled.div(templateObject_7$4 || (templateObject_7$4 = __makeTemplateObject(["\n box-sizing: border-box;\n border: ", ";\n display: flex;\n flex: 1;\n justify-content: center;\n max-height: 100%;\n min-height: 0;\n position: relative;\n ", "\n"], ["\n box-sizing: border-box;\n border: ", ";\n display: flex;\n flex: 1;\n justify-content: center;\n max-height: 100%;\n min-height: 0;\n position: relative;\n ", "\n"])), function (props) {
15922
16021
  var _a, _b;
15923
16022
  return "".concat((_a = props.$borderWidth) !== null && _a !== void 0 ? _a : 4, "px solid ").concat((_b = props.$borderColor) !== null && _b !== void 0 ? _b : 'white');
15924
16023
  }, function (props) {
@@ -15926,7 +16025,7 @@
15926
16025
  });
15927
16026
  var GuideText = styled.span(templateObject_8$1 || (templateObject_8$1 = __makeTemplateObject(["\n align-content: center;\n margin-top: 12px;\n margin-bottom: 12px;\n"], ["\n align-content: center;\n margin-top: 12px;\n margin-bottom: 12px;\n"])));
15928
16027
  var GuideCenterInner = styled.div(templateObject_9$1 || (templateObject_9$1 = __makeTemplateObject(["\n position: relative;\n margin: auto;\n"], ["\n position: relative;\n margin: auto;\n"])));
15929
- var templateObject_1$r, templateObject_2$n, templateObject_3$h, templateObject_4$b, templateObject_5$6, templateObject_6$5, templateObject_7$3, templateObject_8$1, templateObject_9$1;
16028
+ var templateObject_1$s, templateObject_2$o, templateObject_3$i, templateObject_4$c, templateObject_5$7, templateObject_6$6, templateObject_7$4, templateObject_8$1, templateObject_9$1;
15930
16029
 
15931
16030
  var IdCaptureFitGuide = function IdCaptureFitGuide(_a) {
15932
16031
  var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
@@ -16069,36 +16168,37 @@
16069
16168
  progress: progress
16070
16169
  }));
16071
16170
  };
16072
- var CanvasWrapper$1 = styled.div(templateObject_1$q || (templateObject_1$q = __makeTemplateObject(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n flex-grow: 1;\n background-clip: padding-box;\n box-shadow: inset 0 0 0 2px ", ";\n z-index: -1;\n"], ["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n flex-grow: 1;\n background-clip: padding-box;\n box-shadow: inset 0 0 0 2px ", ";\n z-index: -1;\n"])), function (props) {
16171
+ var CanvasWrapper$1 = styled.div(templateObject_1$r || (templateObject_1$r = __makeTemplateObject(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n flex-grow: 1;\n background-clip: padding-box;\n box-shadow: inset 0 0 0 2px ", ";\n z-index: -1;\n"], ["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n flex-grow: 1;\n background-clip: padding-box;\n box-shadow: inset 0 0 0 2px ", ";\n z-index: -1;\n"])), function (props) {
16073
16172
  return props.$maskColor;
16074
16173
  });
16075
- var Canvas$1 = styled.canvas(templateObject_2$m || (templateObject_2$m = __makeTemplateObject(["\n display: block;\n"], ["\n display: block;\n"])));
16076
- var templateObject_1$q, templateObject_2$m;
16174
+ var Canvas$1 = styled.canvas(templateObject_2$n || (templateObject_2$n = __makeTemplateObject(["\n display: block;\n"], ["\n display: block;\n"])));
16175
+ var templateObject_1$r, templateObject_2$n;
16077
16176
 
16078
16177
  function IdCaptureGuides(_a) {
16079
- var _b, _c;
16080
- var _d = _a.guideType,
16081
- guideType = _d === void 0 ? 'fit' : _d,
16082
- _e = _a.status,
16083
- status = _e === void 0 ? 'ready' : _e,
16084
- _f = _a.progress,
16085
- progress = _f === void 0 ? 0 : _f,
16086
- _g = _a.portraitGuidesOnMobile,
16087
- portraitGuidesOnMobile = _g === void 0 ? true : _g,
16088
- _h = _a.requestedAction,
16089
- requestedAction = _h === void 0 ? 'SHOW_ID_FRONT' : _h,
16090
- _j = _a.isBackToFront,
16091
- isBackToFront = _j === void 0 ? false : _j,
16092
- _k = _a.images,
16093
- images = _k === void 0 ? defaultIdCaptureGuideImages : _k,
16094
- _l = _a.classNames,
16095
- classNames = _l === void 0 ? {} : _l,
16096
- _m = _a.colors,
16097
- colors = _m === void 0 ? {} : _m,
16098
- _o = _a.verbiage,
16099
- rawVerbiage = _o === void 0 ? {} : _o;
16178
+ var _b = _a.guideType,
16179
+ guideType = _b === void 0 ? 'fit' : _b,
16180
+ _c = _a.status,
16181
+ status = _c === void 0 ? 'ready' : _c,
16182
+ _d = _a.progress,
16183
+ progress = _d === void 0 ? 0 : _d,
16184
+ _e = _a.portraitGuidesOnMobile,
16185
+ portraitGuidesOnMobile = _e === void 0 ? true : _e,
16186
+ _f = _a.requestedAction,
16187
+ requestedAction = _f === void 0 ? 'SHOW_ID_FRONT' : _f,
16188
+ _g = _a.isBackToFront,
16189
+ isBackToFront = _g === void 0 ? false : _g,
16190
+ _h = _a.images,
16191
+ images = _h === void 0 ? defaultIdCaptureGuideImages : _h,
16192
+ _j = _a.classNames,
16193
+ classNames = _j === void 0 ? {} : _j,
16194
+ _k = _a.colors,
16195
+ colors = _k === void 0 ? {} : _k,
16196
+ _l = _a.verbiage,
16197
+ rawVerbiage = _l === void 0 ? {} : _l;
16100
16198
  var state = useIdCaptureState()[0];
16101
- var cameraRef = React.useContext(CameraStateContext).cameraRef;
16199
+ var isRearFacing = useCameraStore(function (state) {
16200
+ return state.isRearFacing;
16201
+ });
16102
16202
  var verbiage = useTranslations(rawVerbiage, {
16103
16203
  instructionText: 'Scan the front of ID',
16104
16204
  capturingText: 'Capturing...',
@@ -16110,7 +16210,7 @@
16110
16210
  status: status,
16111
16211
  progress: progress,
16112
16212
  instruction: state.captureFailed ? verbiage.captureFailedText : state.capturing ? verbiage === null || verbiage === void 0 ? void 0 : verbiage.capturingText : verbiage.instructionText,
16113
- isMirrored: !((_b = cameraRef.current) === null || _b === void 0 ? void 0 : _b.isRearFacing),
16213
+ isMirrored: !isRearFacing,
16114
16214
  borderColor: state.isGoodFrame ? colors.guideBoxSatisfiedColor : colors.guideBoxUnsatisfiedColor,
16115
16215
  imageVisible: requestedAction === 'FLIP_ID' || !state.idCardFrontDetectionThresholdMet || !state.documentInBounds || state.documentTooClose
16116
16216
  })), guideType === 'fit' && ( /*#__PURE__*/React.createElement(IdCaptureFitGuide, {
@@ -16120,7 +16220,7 @@
16120
16220
  status: status,
16121
16221
  progress: progress,
16122
16222
  instruction: state.captureFailed ? verbiage.captureFailedText : state.capturing ? verbiage === null || verbiage === void 0 ? void 0 : verbiage.capturingText : verbiage.instructionText,
16123
- isMirrored: !((_c = cameraRef.current) === null || _c === void 0 ? void 0 : _c.isRearFacing),
16223
+ isMirrored: !isRearFacing,
16124
16224
  isBackToFront: isBackToFront,
16125
16225
  portraitGuidesOnMobile: portraitGuidesOnMobile,
16126
16226
  borderColor: state.isGoodFrame ? colors.guideBoxSatisfiedColor : colors.guideBoxUnsatisfiedColor,
@@ -16213,53 +16313,11 @@
16213
16313
  onError: onError
16214
16314
  })));
16215
16315
  };
16216
- var StyledSpinner = styled(Spinner$1)(templateObject_1$p || (templateObject_1$p = __makeTemplateObject(["\n position: relative;\n top: 4px;\n left: -3px;\n margin: 0 3px 0 -12px;\n"], ["\n position: relative;\n top: 4px;\n left: -3px;\n margin: 0 3px 0 -12px;\n"])));
16217
- var ImagePreviewWrapper = styled.div(templateObject_2$l || (templateObject_2$l = __makeTemplateObject(["\n position: absolute;\n display: flex;\n flex-direction: column;\n height: 33%;\n bottom: 12px;\n right: 12px;\n"], ["\n position: absolute;\n display: flex;\n flex-direction: column;\n height: 33%;\n bottom: 12px;\n right: 12px;\n"])));
16218
- var ImagePreviewText = styled.div(templateObject_3$g || (templateObject_3$g = __makeTemplateObject(["\n display: block;\n position: absolute;\n top: -32px;\n font:\n 14px -apple-system,\n BlinkMacSystemFont,\n 'Segoe UI',\n Roboto,\n Helvetica,\n Arial,\n sans-serif,\n 'Apple Color Emoji',\n 'Segoe UI Emoji',\n 'Segoe UI Symbol';\n color: white;\n text-align: center;\n margin: 0 auto;\n width: 100%;\n"], ["\n display: block;\n position: absolute;\n top: -32px;\n font:\n 14px -apple-system,\n BlinkMacSystemFont,\n 'Segoe UI',\n Roboto,\n Helvetica,\n Arial,\n sans-serif,\n 'Apple Color Emoji',\n 'Segoe UI Emoji',\n 'Segoe UI Symbol';\n color: white;\n text-align: center;\n margin: 0 auto;\n width: 100%;\n"])));
16219
- var ImagePreviewImageWrapper = styled.div(templateObject_4$a || (templateObject_4$a = __makeTemplateObject(["\n position: relative;\n height: calc(100% - 8px);\n padding: 4px;\n border-radius: 4px;\n background: white;\n\n & > img {\n border-radius: 4px;\n width: auto;\n max-height: 100%;\n }\n"], ["\n position: relative;\n height: calc(100% - 8px);\n padding: 4px;\n border-radius: 4px;\n background: white;\n\n & > img {\n border-radius: 4px;\n width: auto;\n max-height: 100%;\n }\n"])));
16220
- var templateObject_1$p, templateObject_2$l, templateObject_3$g, templateObject_4$a;
16221
-
16222
- var CameraVideoTag = function CameraVideoTag(_a) {
16223
- var _b;
16224
- var className = _a.className;
16225
- var _c = React.useContext(CameraStateContext),
16226
- videoRef = _c.videoRef,
16227
- setVideoLoaded = _c.setVideoLoaded,
16228
- onVideoUnmounted = _c.onVideoUnmounted,
16229
- cameraRef = _c.cameraRef;
16230
- React.useEffect(function notifyCameraProviderOfUnmount() {
16231
- var videoElement = videoRef.current;
16232
- if (!videoElement) return;
16233
- return function () {
16234
- onVideoUnmounted(videoElement);
16235
- };
16236
- }, [onVideoUnmounted, videoRef]);
16237
- React.useEffect(function setVideoLoadedToFalseOnMount() {
16238
- setVideoLoaded(false);
16239
- }, [setVideoLoaded]);
16240
- React.useEffect(function attachCameraStreamToVideoTagWhenReady() {
16241
- var _a;
16242
- if (videoRef.current && ((_a = cameraRef.current) === null || _a === void 0 ? void 0 : _a.stream)) {
16243
- videoRef.current.srcObject = cameraRef.current.stream;
16244
- }
16245
- }, [cameraRef, videoRef]);
16246
- var onLoadedData = React.useCallback(function () {
16247
- setVideoLoaded(true);
16248
- }, [setVideoLoaded]);
16249
- return /*#__PURE__*/React.createElement(FullscreenVideoTag, {
16250
- className: className,
16251
- autoPlay: true,
16252
- playsInline: true,
16253
- muted: true,
16254
- ref: videoRef,
16255
- onLoadedData: onLoadedData,
16256
- "$isRearFacing": (_b = cameraRef.current) === null || _b === void 0 ? void 0 : _b.isRearFacing
16257
- });
16258
- };
16259
- var FullscreenVideoTag = styled.video(templateObject_1$o || (templateObject_1$o = __makeTemplateObject(["\n transform: ", ";\n min-width: 100%;\n min-height: 100%;\n width: auto;\n height: auto;\n max-width: 100%;\n max-height: 100%;\n object-fit: cover;\n background: black;\n z-index: -2;\n"], ["\n transform: ", ";\n min-width: 100%;\n min-height: 100%;\n width: auto;\n height: auto;\n max-width: 100%;\n max-height: 100%;\n object-fit: cover;\n background: black;\n z-index: -2;\n"])), function (props) {
16260
- return props.$isRearFacing ? '' : 'scaleX(-1)';
16261
- });
16262
- var templateObject_1$o;
16316
+ var StyledSpinner = styled(Spinner$1)(templateObject_1$q || (templateObject_1$q = __makeTemplateObject(["\n position: relative;\n top: 4px;\n left: -3px;\n margin: 0 3px 0 -12px;\n"], ["\n position: relative;\n top: 4px;\n left: -3px;\n margin: 0 3px 0 -12px;\n"])));
16317
+ var ImagePreviewWrapper = styled.div(templateObject_2$m || (templateObject_2$m = __makeTemplateObject(["\n position: absolute;\n display: flex;\n flex-direction: column;\n height: 33%;\n bottom: 12px;\n right: 12px;\n"], ["\n position: absolute;\n display: flex;\n flex-direction: column;\n height: 33%;\n bottom: 12px;\n right: 12px;\n"])));
16318
+ var ImagePreviewText = styled.div(templateObject_3$h || (templateObject_3$h = __makeTemplateObject(["\n display: block;\n position: absolute;\n top: -32px;\n font:\n 14px -apple-system,\n BlinkMacSystemFont,\n 'Segoe UI',\n Roboto,\n Helvetica,\n Arial,\n sans-serif,\n 'Apple Color Emoji',\n 'Segoe UI Emoji',\n 'Segoe UI Symbol';\n color: white;\n text-align: center;\n margin: 0 auto;\n width: 100%;\n"], ["\n display: block;\n position: absolute;\n top: -32px;\n font:\n 14px -apple-system,\n BlinkMacSystemFont,\n 'Segoe UI',\n Roboto,\n Helvetica,\n Arial,\n sans-serif,\n 'Apple Color Emoji',\n 'Segoe UI Emoji',\n 'Segoe UI Symbol';\n color: white;\n text-align: center;\n margin: 0 auto;\n width: 100%;\n"])));
16319
+ var ImagePreviewImageWrapper = styled.div(templateObject_4$b || (templateObject_4$b = __makeTemplateObject(["\n position: relative;\n height: calc(100% - 8px);\n padding: 4px;\n border-radius: 4px;\n background: white;\n\n & > img {\n border-radius: 4px;\n width: auto;\n max-height: 100%;\n }\n"], ["\n position: relative;\n height: calc(100% - 8px);\n padding: 4px;\n border-radius: 4px;\n background: white;\n\n & > img {\n border-radius: 4px;\n width: auto;\n max-height: 100%;\n }\n"])));
16320
+ var templateObject_1$q, templateObject_2$m, templateObject_3$h, templateObject_4$b;
16263
16321
 
16264
16322
  var documentCaptureInitialState = {
16265
16323
  documents: [],
@@ -16379,8 +16437,8 @@
16379
16437
  var _c = React.useReducer(documentCaptureStateReducer, documentCaptureInitialState),
16380
16438
  state = _c[0],
16381
16439
  dispatch = _c[1];
16382
- var _d = React.useContext(CameraStateContext),
16383
- cameraRef = _d.cameraRef,
16440
+ var _d = useCameraStore(),
16441
+ videoStream = _d.videoStream,
16384
16442
  videoRef = _d.videoRef;
16385
16443
  var uploadDocument = React.useContext(SubmissionContext).uploadDocument;
16386
16444
  var uploadCapturedDocument = React.useCallback(function (content, filetype) {
@@ -16471,8 +16529,7 @@
16471
16529
  }, [onResize]);
16472
16530
  var videoTag = videoRef.current;
16473
16531
  React.useEffect(function () {
16474
- if (!state.capturing) return;
16475
- if (!cameraRef.current) return;
16532
+ if (!state.capturing || !(videoStream === null || videoStream === void 0 ? void 0 : videoStream.active)) return;
16476
16533
  function onComplete(content) {
16477
16534
  if (!content) return;
16478
16535
  var contentUrl = URL.createObjectURL(content);
@@ -16485,7 +16542,7 @@
16485
16542
  });
16486
16543
  }
16487
16544
  if (typeof ImageCapture !== 'undefined') {
16488
- var tracks = cameraRef.current.stream.getTracks();
16545
+ var tracks = videoStream.getTracks();
16489
16546
  var videoCameraTrack = tracks.find(function (track) {
16490
16547
  return track.kind === 'video';
16491
16548
  });
@@ -16500,7 +16557,7 @@
16500
16557
  drawToCanvas(canvas, videoTag);
16501
16558
  canvas.toBlob(onComplete);
16502
16559
  }
16503
- }, [cameraRef, state.capturing, videoTag]);
16560
+ }, [state.capturing, videoStream, videoTag]);
16504
16561
  var stateWithActions = React.useMemo(function () {
16505
16562
  return _assign(_assign({}, state), {
16506
16563
  uploadCapturedDocument: uploadCapturedDocument
@@ -16615,52 +16672,85 @@
16615
16672
  ref: canvasRef
16616
16673
  }));
16617
16674
  };
16618
- var CanvasWrapper = styled.div(templateObject_1$n || (templateObject_1$n = __makeTemplateObject(["\n flex-grow: 1;\n background-clip: padding-box;\n box-shadow: inset 0 0 0 2px ", ";\n"], ["\n flex-grow: 1;\n background-clip: padding-box;\n box-shadow: inset 0 0 0 2px ", ";\n"])), function (props) {
16675
+ var CanvasWrapper = styled.div(templateObject_1$p || (templateObject_1$p = __makeTemplateObject(["\n flex-grow: 1;\n background-clip: padding-box;\n box-shadow: inset 0 0 0 2px ", ";\n"], ["\n flex-grow: 1;\n background-clip: padding-box;\n box-shadow: inset 0 0 0 2px ", ";\n"])), function (props) {
16619
16676
  return props.$maskColor;
16620
16677
  });
16621
- var Canvas = styled.canvas(templateObject_2$k || (templateObject_2$k = __makeTemplateObject(["\n display: block;\n"], ["\n display: block;\n"])));
16622
- var templateObject_1$n, templateObject_2$k;
16678
+ var Canvas = styled.canvas(templateObject_2$l || (templateObject_2$l = __makeTemplateObject(["\n display: block;\n"], ["\n display: block;\n"])));
16679
+ var templateObject_1$p, templateObject_2$l;
16623
16680
 
16624
- var CameraFeedWrapper = styled.div(templateObject_1$m || (templateObject_1$m = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (props) {
16681
+ var CameraFeedWrapper = styled.div(templateObject_1$o || (templateObject_1$o = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (props) {
16625
16682
  return props.$mode === 'snapToGuides' ? "display: flex;\n position: absolute;\n left: ".concat(props.$x, "px;\n top: ").concat(props.$y, "px;\n width: ").concat(props.$w, "px;\n height: ").concat(props.$h, "px;") : "";
16626
16683
  });
16627
- var templateObject_1$m;
16684
+ var templateObject_1$o;
16685
+
16686
+ var CameraVideoTag = function CameraVideoTag(props) {
16687
+ var _a = useCameraStore(useShallow(function (store) {
16688
+ return {
16689
+ videoRef: store.videoRef,
16690
+ videoStream: store.videoStream,
16691
+ onVideoMounted: store.onVideoMounted,
16692
+ isRearFacing: store.isRearFacing
16693
+ };
16694
+ })),
16695
+ videoRef = _a.videoRef,
16696
+ videoStream = _a.videoStream,
16697
+ onVideoMounted = _a.onVideoMounted,
16698
+ isRearFacing = _a.isRearFacing;
16699
+ React.useEffect(function attachCameraStreamToVideoTagWhenReady() {
16700
+ if (videoRef.current && videoStream) {
16701
+ debug('attaching camera stream to video tag');
16702
+ videoRef.current.srcObject = videoStream;
16703
+ }
16704
+ }, [videoStream, videoRef]);
16705
+ return /*#__PURE__*/React.createElement(FullscreenVideoTag, _assign({
16706
+ autoPlay: true,
16707
+ playsInline: true,
16708
+ muted: true,
16709
+ ref: videoRef,
16710
+ onLoadedData: onVideoMounted,
16711
+ "$isRearFacing": isRearFacing
16712
+ }, props));
16713
+ };
16714
+ var FullscreenVideoTag = styled.video(templateObject_1$n || (templateObject_1$n = __makeTemplateObject(["\n transform: ", ";\n transform-style: preserve-3d;\n min-width: 100%;\n min-height: 100%;\n width: auto;\n height: auto;\n max-width: 100%;\n max-height: 100%;\n object-fit: cover;\n background: black;\n z-index: -2;\n"], ["\n transform: ", ";\n transform-style: preserve-3d;\n min-width: 100%;\n min-height: 100%;\n width: auto;\n height: auto;\n max-width: 100%;\n max-height: 100%;\n object-fit: cover;\n background: black;\n z-index: -2;\n"])), function (props) {
16715
+ return props.$isRearFacing ? '' : 'scaleX(-1)';
16716
+ });
16717
+ var templateObject_1$n;
16628
16718
 
16629
16719
  var DocumentCaptureScreen = function DocumentCaptureScreen(_a) {
16630
- var _b, _c, _d, _e, _f, _g, _h;
16720
+ var _b, _c, _d, _e, _f;
16631
16721
  var onCaptureClicked = _a.onCaptureClicked,
16632
- _j = _a.classNames,
16633
- classNames = _j === void 0 ? {} : _j,
16634
- _k = _a.verbiage,
16635
- rawVerbiage = _k === void 0 ? {} : _k;
16636
- var _l = useDocumentCaptureState(),
16637
- _m = _l[0],
16638
- documents = _m.documents,
16639
- currentDocumentIndex = _m.currentDocumentIndex,
16640
- rectX = _m.rectX,
16641
- rectY = _m.rectY,
16642
- rectWidth = _m.rectWidth,
16643
- rectHeight = _m.rectHeight,
16644
- rectOffsetTop = _m.rectOffsetTop,
16645
- capturing = _m.capturing,
16646
- uploadCapturedDocument = _m.uploadCapturedDocument,
16647
- dispatch = _l[1];
16648
- var _o = (_b = documents[currentDocumentIndex]) !== null && _b !== void 0 ? _b : {},
16649
- title = _o.title,
16650
- aspectRatio = _o.aspectRatio,
16651
- cameraFeedMode = _o.cameraFeedMode,
16652
- instructions = _o.instructions,
16653
- contentUrl = _o.contentUrl,
16654
- content = _o.content,
16655
- uploadState = _o.uploadState;
16656
- var _p = React.useContext(CameraStateContext),
16657
- cameraRef = _p.cameraRef,
16658
- cameraReady = _p.cameraReady,
16659
- cameraAccessDenied = _p.cameraAccessDenied,
16660
- requestCameraAccess = _p.requestCameraAccess;
16661
- var _q = React.useState(false),
16662
- cameraAccessRequested = _q[0],
16663
- setCameraAccessRequested = _q[1];
16722
+ _g = _a.classNames,
16723
+ classNames = _g === void 0 ? {} : _g,
16724
+ _h = _a.verbiage,
16725
+ rawVerbiage = _h === void 0 ? {} : _h;
16726
+ var _j = useDocumentCaptureState(),
16727
+ _k = _j[0],
16728
+ documents = _k.documents,
16729
+ currentDocumentIndex = _k.currentDocumentIndex,
16730
+ rectX = _k.rectX,
16731
+ rectY = _k.rectY,
16732
+ rectWidth = _k.rectWidth,
16733
+ rectHeight = _k.rectHeight,
16734
+ rectOffsetTop = _k.rectOffsetTop,
16735
+ capturing = _k.capturing,
16736
+ uploadCapturedDocument = _k.uploadCapturedDocument,
16737
+ dispatch = _j[1];
16738
+ var _l = (_b = documents[currentDocumentIndex]) !== null && _b !== void 0 ? _b : {},
16739
+ title = _l.title,
16740
+ aspectRatio = _l.aspectRatio,
16741
+ cameraFeedMode = _l.cameraFeedMode,
16742
+ instructions = _l.instructions,
16743
+ contentUrl = _l.contentUrl,
16744
+ content = _l.content,
16745
+ uploadState = _l.uploadState;
16746
+ var _m = useCameraStore(),
16747
+ videoStream = _m.videoStream,
16748
+ cameraReady = _m.cameraReady,
16749
+ cameraAccessDenied = _m.cameraAccessDenied,
16750
+ requestCameraAccess = _m.requestCameraAccess;
16751
+ var _o = React.useState(false),
16752
+ cameraAccessRequested = _o[0],
16753
+ setCameraAccessRequested = _o[1];
16664
16754
  var cameraAccessNeeded =
16665
16755
  // we should force the browser to ask for camera access if...
16666
16756
  uploadState === 'not_started' &&
@@ -16669,14 +16759,14 @@
16669
16759
  // and the user hasn't passed a media blob for the current document...
16670
16760
  !cameraAccessRequested &&
16671
16761
  // and we haven't already tried to force a camera request...
16672
- !((_d = (_c = cameraRef.current) === null || _c === void 0 ? void 0 : _c.stream) === null || _d === void 0 ? void 0 : _d.active); // and we don't already have camera access.
16762
+ !(videoStream === null || videoStream === void 0 ? void 0 : videoStream.active); // and we don't already have camera access.
16673
16763
  React.useEffect(function requestCameraAccessIfNeeded() {
16674
16764
  if (!cameraAccessNeeded) return;
16675
16765
  setCameraAccessRequested(true);
16676
16766
  requestCameraAccess();
16677
16767
  }, [cameraAccessNeeded, requestCameraAccess]);
16678
16768
  var theme = styled.useTheme();
16679
- var maskColor = (_g = (_f = (_e = theme.documentCapture) === null || _e === void 0 ? void 0 : _e.guideBox) === null || _f === void 0 ? void 0 : _f.maskColor) !== null && _g !== void 0 ? _g : cameraFeedMode === 'snapToGuides' ? '#708090' : "rgba(0, 0, 0, 0.5)";
16769
+ var maskColor = (_e = (_d = (_c = theme.documentCapture) === null || _c === void 0 ? void 0 : _c.guideBox) === null || _d === void 0 ? void 0 : _d.maskColor) !== null && _e !== void 0 ? _e : cameraFeedMode === 'snapToGuides' ? '#708090' : "rgba(0, 0, 0, 0.5)";
16680
16770
  var verbiage = useTranslations(rawVerbiage, {
16681
16771
  headingText: title,
16682
16772
  loadingBtnText: 'Camera initializing...',
@@ -16709,7 +16799,7 @@
16709
16799
  });
16710
16800
  }
16711
16801
  return /*#__PURE__*/React.createElement(PageContainer, {
16712
- className: "flex ".concat((_h = classNames.container) !== null && _h !== void 0 ? _h : '')
16802
+ className: "flex ".concat((_f = classNames.container) !== null && _f !== void 0 ? _f : '')
16713
16803
  }, /*#__PURE__*/React.createElement(CameraFeedWrapper, {
16714
16804
  className: classNames.cameraFeedWrapper,
16715
16805
  "$mode": cameraFeedMode !== null && cameraFeedMode !== void 0 ? cameraFeedMode : 'snapToGuides',
@@ -16774,21 +16864,21 @@
16774
16864
  disabled: !cameraReady || capturing
16775
16865
  }, !cameraReady ? verbiage.loadingBtnText : capturing ? verbiage.capturingBtnText : verbiage.captureBtnText))))));
16776
16866
  };
16777
- var CaptureContainer = styled.div(templateObject_1$l || (templateObject_1$l = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: var(--app-height);\n"], ["\n display: flex;\n flex-direction: column;\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: var(--app-height);\n"])));
16778
- var HeadingRow = styled.div(templateObject_2$j || (templateObject_2$j = __makeTemplateObject(["\n background: ", ";\n text-align: center;\n color: white;\n"], ["\n background: ", ";\n text-align: center;\n color: white;\n"])), function (props) {
16867
+ var CaptureContainer = styled.div(templateObject_1$m || (templateObject_1$m = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: var(--app-height);\n"], ["\n display: flex;\n flex-direction: column;\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: var(--app-height);\n"])));
16868
+ var HeadingRow = styled.div(templateObject_2$k || (templateObject_2$k = __makeTemplateObject(["\n background: ", ";\n text-align: center;\n color: white;\n"], ["\n background: ", ";\n text-align: center;\n color: white;\n"])), function (props) {
16779
16869
  return props.$maskColor;
16780
16870
  });
16781
- var Heading$9 = styled.h1(templateObject_3$f || (templateObject_3$f = __makeTemplateObject(["\n font-size: 22px;\n"], ["\n font-size: 22px;\n"])));
16782
- var FooterRow = styled.div(templateObject_4$9 || (templateObject_4$9 = __makeTemplateObject(["\n background: ", ";\n display: flex;\n flex-direction: column;\n justify-content: center;\n padding: 0 20px 20px;\n height: auto;\n color: white;\n"], ["\n background: ", ";\n display: flex;\n flex-direction: column;\n justify-content: center;\n padding: 0 20px 20px;\n height: auto;\n color: white;\n"])), function (props) {
16871
+ var Heading$9 = styled.h1(templateObject_3$g || (templateObject_3$g = __makeTemplateObject(["\n font-size: 22px;\n"], ["\n font-size: 22px;\n"])));
16872
+ var FooterRow = styled.div(templateObject_4$a || (templateObject_4$a = __makeTemplateObject(["\n background: ", ";\n display: flex;\n flex-direction: column;\n justify-content: center;\n padding: 0 20px 20px;\n height: auto;\n color: white;\n"], ["\n background: ", ";\n display: flex;\n flex-direction: column;\n justify-content: center;\n padding: 0 20px 20px;\n height: auto;\n color: white;\n"])), function (props) {
16783
16873
  return props.$maskColor;
16784
16874
  });
16785
- var Instructions = styled.div(templateObject_5$5 || (templateObject_5$5 = __makeTemplateObject(["\n max-height: ", ";\n overflow-y: auto;\n"], ["\n max-height: ", ";\n overflow-y: auto;\n"])), function (props) {
16875
+ var Instructions = styled.div(templateObject_5$6 || (templateObject_5$6 = __makeTemplateObject(["\n max-height: ", ";\n overflow-y: auto;\n"], ["\n max-height: ", ";\n overflow-y: auto;\n"])), function (props) {
16786
16876
  var _a, _b, _c;
16787
16877
  return (_c = (_b = (_a = props.theme.documentCapture) === null || _a === void 0 ? void 0 : _a.instructions) === null || _b === void 0 ? void 0 : _b.maxHeight) !== null && _c !== void 0 ? _c : '8rem';
16788
16878
  });
16789
- var StyledButtonsRow$9 = styled(ButtonsRow)(templateObject_6$4 || (templateObject_6$4 = __makeTemplateObject(["\n padding-top: 20px;\n"], ["\n padding-top: 20px;\n"])));
16790
- var PreviewImage = styled.img(templateObject_7$2 || (templateObject_7$2 = __makeTemplateObject(["\n width: 100%;\n height: 100%;\n object-fit: cover;\n"], ["\n width: 100%;\n height: 100%;\n object-fit: cover;\n"])));
16791
- var templateObject_1$l, templateObject_2$j, templateObject_3$f, templateObject_4$9, templateObject_5$5, templateObject_6$4, templateObject_7$2;
16879
+ var StyledButtonsRow$9 = styled(ButtonsRow)(templateObject_6$5 || (templateObject_6$5 = __makeTemplateObject(["\n padding-top: 20px;\n"], ["\n padding-top: 20px;\n"])));
16880
+ var PreviewImage = styled.img(templateObject_7$3 || (templateObject_7$3 = __makeTemplateObject(["\n width: 100%;\n height: 100%;\n object-fit: cover;\n"], ["\n width: 100%;\n height: 100%;\n object-fit: cover;\n"])));
16881
+ var templateObject_1$m, templateObject_2$k, templateObject_3$g, templateObject_4$a, templateObject_5$6, templateObject_6$5, templateObject_7$3;
16792
16882
 
16793
16883
  var DocumentCaptureWizard = function DocumentCaptureWizard(_a) {
16794
16884
  var onSuccess = _a.onSuccess,
@@ -17057,13 +17147,13 @@
17057
17147
  }
17058
17148
  }, verbiage.doneBtnText))))));
17059
17149
  };
17060
- var StyledOverlayInner$2 = styled(OverlayInner$2)(templateObject_1$k || (templateObject_1$k = __makeTemplateObject(["\n justify-content: center;\n"], ["\n justify-content: center;\n"])));
17061
- var Heading$8 = styled.h3(templateObject_2$i || (templateObject_2$i = __makeTemplateObject(["\n margin-bottom: 8px;\n"], ["\n margin-bottom: 8px;\n"])));
17062
- var Description$3 = styled.p(templateObject_3$e || (templateObject_3$e = __makeTemplateObject(["\n margin-bottom: 8px;\n"], ["\n margin-bottom: 8px;\n"])));
17063
- var Instruction = styled.p(templateObject_4$8 || (templateObject_4$8 = __makeTemplateObject(["\n font-weight: bold;\n"], ["\n font-weight: bold;\n"])));
17064
- var ImageCol = styled.div(templateObject_5$4 || (templateObject_5$4 = __makeTemplateObject(["\n display: flex;\n justify-content: center;\n flex-grow: 1;\n flex-basis: 0;\n"], ["\n display: flex;\n justify-content: center;\n flex-grow: 1;\n flex-basis: 0;\n"])));
17065
- var StyledButtonsRow$8 = styled(ButtonsRow)(templateObject_6$3 || (templateObject_6$3 = __makeTemplateObject(["\n margin-top: 32px;\n"], ["\n margin-top: 32px;\n"])));
17066
- var templateObject_1$k, templateObject_2$i, templateObject_3$e, templateObject_4$8, templateObject_5$4, templateObject_6$3;
17150
+ var StyledOverlayInner$2 = styled(OverlayInner$2)(templateObject_1$l || (templateObject_1$l = __makeTemplateObject(["\n justify-content: center;\n"], ["\n justify-content: center;\n"])));
17151
+ var Heading$8 = styled.h3(templateObject_2$j || (templateObject_2$j = __makeTemplateObject(["\n margin-bottom: 8px;\n"], ["\n margin-bottom: 8px;\n"])));
17152
+ var Description$3 = styled.p(templateObject_3$f || (templateObject_3$f = __makeTemplateObject(["\n margin-bottom: 8px;\n"], ["\n margin-bottom: 8px;\n"])));
17153
+ var Instruction = styled.p(templateObject_4$9 || (templateObject_4$9 = __makeTemplateObject(["\n font-weight: bold;\n"], ["\n font-weight: bold;\n"])));
17154
+ var ImageCol = styled.div(templateObject_5$5 || (templateObject_5$5 = __makeTemplateObject(["\n display: flex;\n justify-content: center;\n flex-grow: 1;\n flex-basis: 0;\n"], ["\n display: flex;\n justify-content: center;\n flex-grow: 1;\n flex-basis: 0;\n"])));
17155
+ var StyledButtonsRow$8 = styled(ButtonsRow)(templateObject_6$4 || (templateObject_6$4 = __makeTemplateObject(["\n margin-top: 32px;\n"], ["\n margin-top: 32px;\n"])));
17156
+ var templateObject_1$l, templateObject_2$j, templateObject_3$f, templateObject_4$9, templateObject_5$5, templateObject_6$4;
17067
17157
 
17068
17158
  function ScalingCameraFeed() {
17069
17159
  var _a = React.useContext(IdCaptureStateContext),
@@ -17134,7 +17224,7 @@
17134
17224
  var _3 = useIdCaptureState(),
17135
17225
  state = _3[0],
17136
17226
  dispatch = _3[1];
17137
- var _4 = React.useContext(CameraStateContext),
17227
+ var _4 = useCameraStore(),
17138
17228
  cameraAccessDenied = _4.cameraAccessDenied,
17139
17229
  requestCameraAccess = _4.requestCameraAccess,
17140
17230
  releaseCameraAccess = _4.releaseCameraAccess;
@@ -17749,7 +17839,7 @@
17749
17839
  }))));
17750
17840
  });
17751
17841
  HeadGuideSvg.displayName = 'HeadGuideSvg';
17752
- var PulsingHeadGuideContainer = styled.div(templateObject_1$j || (templateObject_1$j = __makeTemplateObject(["\n display: flex;\n position: relative;\n height: 100%;\n max-height: 100%;\n\n & > .idmSdkWaves {\n position: absolute;\n animation: ", " 2s ease-out infinite;\n\n &:nth-child(2) {\n animation-delay: 0.66s;\n }\n\n &:nth-child(3) {\n animation-delay: 1.33s;\n }\n }\n\n & > .idmSdkWavesOrigin {\n position: relative;\n }\n"], ["\n display: flex;\n position: relative;\n height: 100%;\n max-height: 100%;\n\n & > .idmSdkWaves {\n position: absolute;\n animation: ", " 2s ease-out infinite;\n\n &:nth-child(2) {\n animation-delay: 0.66s;\n }\n\n &:nth-child(3) {\n animation-delay: 1.33s;\n }\n }\n\n & > .idmSdkWavesOrigin {\n position: relative;\n }\n"])), wavesAnimation);
17842
+ var PulsingHeadGuideContainer = styled.div(templateObject_1$k || (templateObject_1$k = __makeTemplateObject(["\n display: flex;\n position: relative;\n height: 100%;\n max-height: 100%;\n\n & > .idmSdkWaves {\n position: absolute;\n animation: ", " 2s ease-out infinite;\n transform-style: preserve-3d;\n\n &:nth-child(2) {\n animation-delay: 0.66s;\n }\n\n &:nth-child(3) {\n animation-delay: 1.33s;\n }\n }\n\n & > .idmSdkWavesOrigin {\n position: relative;\n }\n"], ["\n display: flex;\n position: relative;\n height: 100%;\n max-height: 100%;\n\n & > .idmSdkWaves {\n position: absolute;\n animation: ", " 2s ease-out infinite;\n transform-style: preserve-3d;\n\n &:nth-child(2) {\n animation-delay: 0.66s;\n }\n\n &:nth-child(3) {\n animation-delay: 1.33s;\n }\n }\n\n & > .idmSdkWavesOrigin {\n position: relative;\n }\n"])), wavesAnimation);
17753
17843
  function HeadGuide(_a) {
17754
17844
  var _b;
17755
17845
  var _c = _a.status,
@@ -17799,8 +17889,8 @@
17799
17889
  height: parentHeight
17800
17890
  })));
17801
17891
  }
17802
- var AbsoluteSvg = styled.svg(templateObject_2$h || (templateObject_2$h = __makeTemplateObject(["\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n"], ["\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n"])));
17803
- var RelativeSvgContainer = styled.div(templateObject_3$d || (templateObject_3$d = __makeTemplateObject(["\n position: relative;\n height: 100%;\n display: flex;\n align-items: ", ";\n"], ["\n position: relative;\n height: 100%;\n display: flex;\n align-items: ", ";\n"])), function (props) {
17892
+ var AbsoluteSvg = styled.svg(templateObject_2$i || (templateObject_2$i = __makeTemplateObject(["\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n"], ["\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n"])));
17893
+ var RelativeSvgContainer = styled.div(templateObject_3$e || (templateObject_3$e = __makeTemplateObject(["\n position: relative;\n height: 100%;\n display: flex;\n align-items: ", ";\n"], ["\n position: relative;\n height: 100%;\n display: flex;\n align-items: ", ";\n"])), function (props) {
17804
17894
  return props.$verticalAlign === 'bottom' ? 'flex-end' : 'center';
17805
17895
  });
17806
17896
  function SelfieCaptureAnimatedMask(_a) {
@@ -18027,10 +18117,10 @@
18027
18117
  status: status
18028
18118
  }));
18029
18119
  }
18030
- var templateObject_1$j, templateObject_2$h, templateObject_3$d;
18120
+ var templateObject_1$k, templateObject_2$i, templateObject_3$e;
18031
18121
 
18032
- var FaceCaptureGuideContainer = styled.div(templateObject_1$i || (templateObject_1$i = __makeTemplateObject(["\n position: fixed;\n z-index: 1000;\n width: 100dvw;\n height: 100dvh;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n padding: 40px;\n box-sizing: border-box;\n"], ["\n position: fixed;\n z-index: 1000;\n width: 100dvw;\n height: 100dvh;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n padding: 40px;\n box-sizing: border-box;\n"])));
18033
- var FaceCaptureGuideInner = styled.div(templateObject_2$g || (templateObject_2$g = __makeTemplateObject(["\n position: relative;\n height: 60%;\n"], ["\n position: relative;\n height: 60%;\n"])));
18122
+ var FaceCaptureGuideContainer = styled.div(templateObject_1$j || (templateObject_1$j = __makeTemplateObject(["\n position: fixed;\n z-index: 1000;\n width: 100dvw;\n height: 100dvh;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n padding: 40px;\n box-sizing: border-box;\n"], ["\n position: fixed;\n z-index: 1000;\n width: 100dvw;\n height: 100dvh;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n padding: 40px;\n box-sizing: border-box;\n"])));
18123
+ var FaceCaptureGuideInner = styled.div(templateObject_2$h || (templateObject_2$h = __makeTemplateObject(["\n position: relative;\n height: 60%;\n"], ["\n position: relative;\n height: 60%;\n"])));
18034
18124
  var FaceCaptureGuideOverlay = function FaceCaptureGuideOverlay(_a) {
18035
18125
  var _b = _a.classNames,
18036
18126
  classNames = _b === void 0 ? {} : _b,
@@ -18052,7 +18142,7 @@
18052
18142
  verticalAlign: "center"
18053
18143
  })));
18054
18144
  };
18055
- var templateObject_1$i, templateObject_2$g;
18145
+ var templateObject_1$j, templateObject_2$h;
18056
18146
 
18057
18147
  var SelfieGuidanceModelsContext = /*#__PURE__*/React.createContext({
18058
18148
  start: function start() {
@@ -18082,7 +18172,13 @@
18082
18172
  modelLoadTimeoutMs = _c === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _c,
18083
18173
  _d = _a.requireVerticalFaceCentering,
18084
18174
  requireVerticalFaceCentering = _d === void 0 ? true : _d;
18085
- var _e = React.useContext(CameraStateContext),
18175
+ var _e = useCameraStore(useShallow(function (state) {
18176
+ return {
18177
+ videoRef: state.videoRef,
18178
+ videoLoaded: state.videoLoaded,
18179
+ cameraReady: state.cameraReady
18180
+ };
18181
+ })),
18086
18182
  videoRef = _e.videoRef,
18087
18183
  videoLoaded = _e.videoLoaded,
18088
18184
  cameraReady = _e.cameraReady;
@@ -18090,7 +18186,8 @@
18090
18186
  var onPredictionHandler = React.useRef();
18091
18187
  var _f = useLoadFaceDetector({
18092
18188
  onModelError: onModelError,
18093
- modelLoadTimeoutMs: modelLoadTimeoutMs
18189
+ modelLoadTimeoutMs: modelLoadTimeoutMs,
18190
+ videoRef: videoRef
18094
18191
  }),
18095
18192
  ready = _f.ready,
18096
18193
  modelDownloadProgress = _f.modelDownloadProgress,
@@ -18356,12 +18453,12 @@
18356
18453
  }
18357
18454
  }, !image ? invalidSelfie ? verbiage.retryButtonText : verbiage.captureBtnText : loading ? verbiage.doneBtnLoadingText : verbiage.doneBtnText)))));
18358
18455
  };
18359
- var StyledOverlayInner$1 = styled(OverlayInner$2)(templateObject_1$h || (templateObject_1$h = __makeTemplateObject(["\n justify-content: center;\n"], ["\n justify-content: center;\n"])));
18360
- var Heading$7 = styled.h3(templateObject_2$f || (templateObject_2$f = __makeTemplateObject(["\n margin-bottom: 8px;\n"], ["\n margin-bottom: 8px;\n"])));
18361
- var Description$2 = styled.p(templateObject_3$c || (templateObject_3$c = __makeTemplateObject(["\n margin-bottom: 8px;\n"], ["\n margin-bottom: 8px;\n"])));
18362
- var ImageContainer$6 = styled(OverlayImageContainer)(templateObject_4$7 || (templateObject_4$7 = __makeTemplateObject(["\n margin-top: 32px;\n"], ["\n margin-top: 32px;\n"])));
18363
- var StyledButtonsRow$7 = styled(ButtonsRow)(templateObject_5$3 || (templateObject_5$3 = __makeTemplateObject(["\n margin-top: 32px;\n"], ["\n margin-top: 32px;\n"])));
18364
- var templateObject_1$h, templateObject_2$f, templateObject_3$c, templateObject_4$7, templateObject_5$3;
18456
+ var StyledOverlayInner$1 = styled(OverlayInner$2)(templateObject_1$i || (templateObject_1$i = __makeTemplateObject(["\n justify-content: center;\n"], ["\n justify-content: center;\n"])));
18457
+ var Heading$7 = styled.h3(templateObject_2$g || (templateObject_2$g = __makeTemplateObject(["\n margin-bottom: 8px;\n"], ["\n margin-bottom: 8px;\n"])));
18458
+ var Description$2 = styled.p(templateObject_3$d || (templateObject_3$d = __makeTemplateObject(["\n margin-bottom: 8px;\n"], ["\n margin-bottom: 8px;\n"])));
18459
+ var ImageContainer$6 = styled(OverlayImageContainer)(templateObject_4$8 || (templateObject_4$8 = __makeTemplateObject(["\n margin-top: 32px;\n"], ["\n margin-top: 32px;\n"])));
18460
+ var StyledButtonsRow$7 = styled(ButtonsRow)(templateObject_5$4 || (templateObject_5$4 = __makeTemplateObject(["\n margin-top: 32px;\n"], ["\n margin-top: 32px;\n"])));
18461
+ var templateObject_1$i, templateObject_2$g, templateObject_3$d, templateObject_4$8, templateObject_5$4;
18365
18462
 
18366
18463
  var initialState$3 = {
18367
18464
  busy: false,
@@ -18423,8 +18520,14 @@
18423
18520
  prediction = _t.prediction,
18424
18521
  dispatch = _s[1];
18425
18522
  var lastPredictionCanvas = React.useRef(null);
18426
- var _u = React.useContext(CameraStateContext),
18427
- cameraRef = _u.cameraRef,
18523
+ var _u = useCameraStore(useShallow(function (state) {
18524
+ return {
18525
+ camera: state.camera,
18526
+ cameraReady: state.cameraReady,
18527
+ videoRef: state.videoRef
18528
+ };
18529
+ })),
18530
+ camera = _u.camera,
18428
18531
  videoRef = _u.videoRef;
18429
18532
  var _v = React.useContext(SelfieGuidanceModelsContext),
18430
18533
  onPredictionMade = _v.onPredictionMade,
@@ -18514,7 +18617,7 @@
18514
18617
  face: prediction.face,
18515
18618
  scaling: debugScalingDetails,
18516
18619
  color: satisfied ? 'green' : 'red'
18517
- }))), debugMode && ( /*#__PURE__*/React.createElement(DebugStatsPane, null, cameraRef.current ? ( /*#__PURE__*/React.createElement(React.Fragment, null, "\u2705 Camera: ", cameraRef.current.label, " (", cameraRef.current.width, "x", cameraRef.current.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React.createElement("br", null), !(prediction === null || prediction === void 0 ? void 0 : prediction.faceNotCentered) ? '✅' : '❌', " Face Centered", /*#__PURE__*/React.createElement("br", null), !(prediction === null || prediction === void 0 ? void 0 : prediction.faceTooClose) && !(prediction === null || prediction === void 0 ? void 0 : prediction.faceTooFar) ? '✅' : '❌', ' ', "Face", ' ', (prediction === null || prediction === void 0 ? void 0 : prediction.faceTooClose) ? 'Too Close' : (prediction === null || prediction === void 0 ? void 0 : prediction.faceTooFar) ? 'Too Far' : 'Distance Correct', /*#__PURE__*/React.createElement("br", null), !(prediction === null || prediction === void 0 ? void 0 : prediction.faceLookingAway) ? '✅' : '❌', " Face Looking Forward", /*#__PURE__*/React.createElement("br", null), !(prediction === null || prediction === void 0 ? void 0 : prediction.faceIsStable) ? '✅' : '❌', " Face Is Stable", /*#__PURE__*/React.createElement("br", null), !timedOut ? '✅' : '❌', " Time Remaining:", ' ', Math.max(0, timeoutDurationMs - (new Date().getTime() - (timeoutStartedAt !== null && timeoutStartedAt !== void 0 ? timeoutStartedAt : new Date()).getTime())), "ms")), /*#__PURE__*/React.createElement(ExitCaptureButton, {
18620
+ }))), debugMode && ( /*#__PURE__*/React.createElement(DebugStatsPane, null, camera ? ( /*#__PURE__*/React.createElement(React.Fragment, null, "\u2705 Camera: ", camera.label, " (", camera.width, "x", camera.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React.createElement("br", null), !(prediction === null || prediction === void 0 ? void 0 : prediction.faceNotCentered) ? '✅' : '❌', " Face Centered", /*#__PURE__*/React.createElement("br", null), !(prediction === null || prediction === void 0 ? void 0 : prediction.faceTooClose) && !(prediction === null || prediction === void 0 ? void 0 : prediction.faceTooFar) ? '✅' : '❌', ' ', "Face", ' ', (prediction === null || prediction === void 0 ? void 0 : prediction.faceTooClose) ? 'Too Close' : (prediction === null || prediction === void 0 ? void 0 : prediction.faceTooFar) ? 'Too Far' : 'Distance Correct', /*#__PURE__*/React.createElement("br", null), !(prediction === null || prediction === void 0 ? void 0 : prediction.faceLookingAway) ? '✅' : '❌', " Face Looking Forward", /*#__PURE__*/React.createElement("br", null), !(prediction === null || prediction === void 0 ? void 0 : prediction.faceIsStable) ? '✅' : '❌', " Face Is Stable", /*#__PURE__*/React.createElement("br", null), !timedOut ? '✅' : '❌', " Time Remaining:", ' ', Math.max(0, timeoutDurationMs - (new Date().getTime() - (timeoutStartedAt !== null && timeoutStartedAt !== void 0 ? timeoutStartedAt : new Date()).getTime())), "ms")), /*#__PURE__*/React.createElement(ExitCaptureButton, {
18518
18621
  onClick: onExit,
18519
18622
  className: classNames.exitCaptureBtn
18520
18623
  }));
@@ -18905,9 +19008,9 @@
18905
19008
  finished: true
18906
19009
  }, verbiage.retryBtnText)))));
18907
19010
  };
18908
- var ImageContainer$5 = styled.div(templateObject_1$g || (templateObject_1$g = __makeTemplateObject(["\n position: relative;\n flex-grow: 1;\n margin-bottom: 25px;\n max-width: 100dvw;\n max-height: 100dvh;\n overflow-y: auto;\n border-radius: 12px;\n\n & > img,\n & > svg {\n width: 100%;\n max-width: 100%;\n margin: 0 auto;\n display: block;\n border-radius: 12px;\n }\n"], ["\n position: relative;\n flex-grow: 1;\n margin-bottom: 25px;\n max-width: 100dvw;\n max-height: 100dvh;\n overflow-y: auto;\n border-radius: 12px;\n\n & > img,\n & > svg {\n width: 100%;\n max-width: 100%;\n margin: 0 auto;\n display: block;\n border-radius: 12px;\n }\n"])));
18909
- var Heading$6 = styled.h3(templateObject_2$e || (templateObject_2$e = __makeTemplateObject(["\n font-size: 1.2rem;\n margin: 0;\n"], ["\n font-size: 1.2rem;\n margin: 0;\n"])));
18910
- var templateObject_1$g, templateObject_2$e;
19011
+ var ImageContainer$5 = styled.div(templateObject_1$h || (templateObject_1$h = __makeTemplateObject(["\n position: relative;\n flex-grow: 1;\n margin-bottom: 25px;\n max-width: 100dvw;\n max-height: 100dvh;\n overflow-y: auto;\n border-radius: 12px;\n\n & > img,\n & > svg {\n width: 100%;\n max-width: 100%;\n margin: 0 auto;\n display: block;\n border-radius: 12px;\n }\n"], ["\n position: relative;\n flex-grow: 1;\n margin-bottom: 25px;\n max-width: 100dvw;\n max-height: 100dvh;\n overflow-y: auto;\n border-radius: 12px;\n\n & > img,\n & > svg {\n width: 100%;\n max-width: 100%;\n margin: 0 auto;\n display: block;\n border-radius: 12px;\n }\n"])));
19012
+ var Heading$6 = styled.h3(templateObject_2$f || (templateObject_2$f = __makeTemplateObject(["\n font-size: 1.2rem;\n margin: 0;\n"], ["\n font-size: 1.2rem;\n margin: 0;\n"])));
19013
+ var templateObject_1$h, templateObject_2$f;
18911
19014
 
18912
19015
  var FaceLivenessFailure = function FaceLivenessFailure(_a) {
18913
19016
  var _b = _a.canRetry,
@@ -18956,9 +19059,9 @@
18956
19059
  finished: true
18957
19060
  }, verbiage.exitBtnText)))));
18958
19061
  };
18959
- var ImageContainer$4 = styled(OverlayImageContainer)(templateObject_1$f || (templateObject_1$f = __makeTemplateObject(["\n max-height: calc(100vh - 185px);\n"], ["\n max-height: calc(100vh - 185px);\n"])));
18960
- var Heading$5 = styled.h3(templateObject_2$d || (templateObject_2$d = __makeTemplateObject(["\n margin-bottom: 36px;\n"], ["\n margin-bottom: 36px;\n"])));
18961
- var templateObject_1$f, templateObject_2$d;
19062
+ var ImageContainer$4 = styled(OverlayImageContainer)(templateObject_1$g || (templateObject_1$g = __makeTemplateObject(["\n max-height: calc(100vh - 185px);\n"], ["\n max-height: calc(100vh - 185px);\n"])));
19063
+ var Heading$5 = styled.h3(templateObject_2$e || (templateObject_2$e = __makeTemplateObject(["\n margin-bottom: 36px;\n"], ["\n margin-bottom: 36px;\n"])));
19064
+ var templateObject_1$g, templateObject_2$e;
18962
19065
 
18963
19066
  var MicrophoneAccessDeniedOverlay = function MicrophoneAccessDeniedOverlay(_a) {
18964
19067
  var _b;
@@ -18970,7 +19073,9 @@
18970
19073
  colors = _e === void 0 ? {} : _e,
18971
19074
  _f = _a.verbiage,
18972
19075
  rawVerbiage = _f === void 0 ? {} : _f;
18973
- var requestMicrophoneAccess = React.useContext(CameraStateContext).requestMicrophoneAccess;
19076
+ var requestMicrophoneAccess = useCameraStore(function (state) {
19077
+ return state.requestMicrophoneAccess;
19078
+ });
18974
19079
  assets.imageUrl || (assets.imageUrl = DEFAULT_CDN_URL + '/microphone-disable-icon.svg');
18975
19080
  var verbiage = useTranslations(rawVerbiage, {
18976
19081
  headingText: 'Your microphone permission is disabled',
@@ -18999,11 +19104,11 @@
18999
19104
  finished: true
19000
19105
  }, verbiage.retryBtnText)));
19001
19106
  };
19002
- var StyledOverlayInner = styled(OverlayInner$2)(templateObject_1$e || (templateObject_1$e = __makeTemplateObject(["\n max-width: 500px;\n height: auto;\n margin: auto;\n"], ["\n max-width: 500px;\n height: auto;\n margin: auto;\n"])));
19003
- var StyledOverlayImageContainer$1 = styled(OverlayImageContainer)(templateObject_2$c || (templateObject_2$c = __makeTemplateObject(["\n flex-grow: 0;\n"], ["\n flex-grow: 0;\n"])));
19004
- var Description$1 = styled.p(templateObject_3$b || (templateObject_3$b = __makeTemplateObject(["\n line-height: 1.5;\n margin-bottom: 50px;\n"], ["\n line-height: 1.5;\n margin-bottom: 50px;\n"])));
19005
- var RetryButton = styled(LoaderButton)(templateObject_4$6 || (templateObject_4$6 = __makeTemplateObject(["\n width: 200px;\n margin: 0 auto;\n"], ["\n width: 200px;\n margin: 0 auto;\n"])));
19006
- var templateObject_1$e, templateObject_2$c, templateObject_3$b, templateObject_4$6;
19107
+ var StyledOverlayInner = styled(OverlayInner$2)(templateObject_1$f || (templateObject_1$f = __makeTemplateObject(["\n max-width: 500px;\n height: auto;\n margin: auto;\n"], ["\n max-width: 500px;\n height: auto;\n margin: auto;\n"])));
19108
+ var StyledOverlayImageContainer$1 = styled(OverlayImageContainer)(templateObject_2$d || (templateObject_2$d = __makeTemplateObject(["\n flex-grow: 0;\n"], ["\n flex-grow: 0;\n"])));
19109
+ var Description$1 = styled.p(templateObject_3$c || (templateObject_3$c = __makeTemplateObject(["\n line-height: 1.5;\n margin-bottom: 50px;\n"], ["\n line-height: 1.5;\n margin-bottom: 50px;\n"])));
19110
+ var RetryButton = styled(LoaderButton)(templateObject_4$7 || (templateObject_4$7 = __makeTemplateObject(["\n width: 200px;\n margin: 0 auto;\n"], ["\n width: 200px;\n margin: 0 auto;\n"])));
19111
+ var templateObject_1$f, templateObject_2$d, templateObject_3$c, templateObject_4$7;
19007
19112
 
19008
19113
  var SelfieCaptureLoadingOverlayLegacy = function SelfieCaptureLoadingOverlayLegacy(_a) {
19009
19114
  var onDismissed = _a.onDismissed,
@@ -19018,7 +19123,13 @@
19018
19123
  colors = _e === void 0 ? {} : _e,
19019
19124
  _f = _a.verbiage,
19020
19125
  rawVerbiage = _f === void 0 ? {} : _f;
19021
- var _g = React.useContext(CameraStateContext),
19126
+ var _g = useCameraStore(useShallow(function (state) {
19127
+ return {
19128
+ cameraReady: state.cameraReady,
19129
+ cameraAccessDenied: state.cameraAccessDenied,
19130
+ microphoneAccessDenied: state.microphoneAccessDenied
19131
+ };
19132
+ })),
19022
19133
  cameraReady = _g.cameraReady,
19023
19134
  cameraAccessDenied = _g.cameraAccessDenied,
19024
19135
  microphoneAccessDenied = _g.microphoneAccessDenied;
@@ -19086,9 +19197,9 @@
19086
19197
  }
19087
19198
  }, cameraReady && allModelsReady ? verbiage.continueText : allModelsReady ? verbiage.cameraInitializingText : modelDownloadProgress >= 100 ? "".concat(verbiage.modelsWarmingUpText) : "".concat(verbiage.downloadingText, " (").concat(modelDownloadProgress, "%)")))));
19088
19199
  };
19089
- var StyledGuidanceMessage$1 = styled(GuidanceMessage)(templateObject_1$d || (templateObject_1$d = __makeTemplateObject(["\n padding: 12px 24px;\n font-weight: normal;\n line-height: 1.5;\n margin-bottom: -30px;\n"], ["\n padding: 12px 24px;\n font-weight: normal;\n line-height: 1.5;\n margin-bottom: -30px;\n"])));
19090
- var StyledButtonsRow$6 = styled(ButtonsRow)(templateObject_2$b || (templateObject_2$b = __makeTemplateObject(["\n flex-direction: column;\n padding-top: 25px;\n"], ["\n flex-direction: column;\n padding-top: 25px;\n"])));
19091
- var templateObject_1$d, templateObject_2$b;
19200
+ var StyledGuidanceMessage$1 = styled(GuidanceMessage)(templateObject_1$e || (templateObject_1$e = __makeTemplateObject(["\n padding: 12px 24px;\n font-weight: normal;\n line-height: 1.5;\n margin-bottom: -30px;\n"], ["\n padding: 12px 24px;\n font-weight: normal;\n line-height: 1.5;\n margin-bottom: -30px;\n"])));
19201
+ var StyledButtonsRow$6 = styled(ButtonsRow)(templateObject_2$c || (templateObject_2$c = __makeTemplateObject(["\n flex-direction: column;\n padding-top: 25px;\n"], ["\n flex-direction: column;\n padding-top: 25px;\n"])));
19202
+ var templateObject_1$e, templateObject_2$c;
19092
19203
 
19093
19204
  var legacyInstructionImageUrl = "".concat(DEFAULT_CDN_URL, "/Selfie-Image-1.png");
19094
19205
  var SelfieCaptureLoadingOverlayDefault = function SelfieCaptureLoadingOverlayDefault(_a) {
@@ -19105,7 +19216,13 @@
19105
19216
  colors = _e === void 0 ? {} : _e,
19106
19217
  _f = _a.verbiage,
19107
19218
  rawVerbiage = _f === void 0 ? {} : _f;
19108
- var _g = React.useContext(CameraStateContext),
19219
+ var _g = useCameraStore(useShallow(function (state) {
19220
+ return {
19221
+ cameraReady: state.cameraReady,
19222
+ cameraAccessDenied: state.cameraAccessDenied,
19223
+ microphoneAccessDenied: state.microphoneAccessDenied
19224
+ };
19225
+ })),
19109
19226
  cameraReady = _g.cameraReady,
19110
19227
  cameraAccessDenied = _g.cameraAccessDenied,
19111
19228
  microphoneAccessDenied = _g.microphoneAccessDenied;
@@ -19213,30 +19330,30 @@
19213
19330
  }
19214
19331
  }, verbiage.continueText))))));
19215
19332
  };
19216
- var OverlayInner = styled.div(templateObject_1$c || (templateObject_1$c = __makeTemplateObject(["\n height: 100dvh;\n display: flex;\n flex-direction: column;\n background: ", ";\n color: ", ";\n"], ["\n height: 100dvh;\n display: flex;\n flex-direction: column;\n background: ", ";\n color: ", ";\n"])), function (props) {
19333
+ var OverlayInner = styled.div(templateObject_1$d || (templateObject_1$d = __makeTemplateObject(["\n height: 100dvh;\n display: flex;\n flex-direction: column;\n background: ", ";\n color: ", ";\n"], ["\n height: 100dvh;\n display: flex;\n flex-direction: column;\n background: ", ";\n color: ", ";\n"])), function (props) {
19217
19334
  var _a, _b, _c, _d;
19218
19335
  return (_d = (_c = (_b = (_a = props.theme) === null || _a === void 0 ? void 0 : _a.selfieCapture) === null || _b === void 0 ? void 0 : _b.loadingOverlay) === null || _c === void 0 ? void 0 : _c.backgroundColor) !== null && _d !== void 0 ? _d : '#ecedf3';
19219
19336
  }, function (props) {
19220
19337
  var _a, _b, _c, _d;
19221
19338
  return (_d = (_c = (_b = (_a = props.theme) === null || _a === void 0 ? void 0 : _a.selfieCapture) === null || _b === void 0 ? void 0 : _b.loadingOverlay) === null || _c === void 0 ? void 0 : _c.textColor) !== null && _d !== void 0 ? _d : 'black';
19222
19339
  });
19223
- var OverlayHeader = styled.div(templateObject_2$a || (templateObject_2$a = __makeTemplateObject(["\n text-align: ", ";\n display: flex;\n flex-direction: column;\n flex-wrap: nowrap;\n ", "\n padding-bottom: 0;\n"], ["\n text-align: ", ";\n display: flex;\n flex-direction: column;\n flex-wrap: nowrap;\n ", "\n padding-bottom: 0;\n"])), function (props) {
19340
+ var OverlayHeader = styled.div(templateObject_2$b || (templateObject_2$b = __makeTemplateObject(["\n text-align: ", ";\n display: flex;\n flex-direction: column;\n flex-wrap: nowrap;\n ", "\n padding-bottom: 0;\n"], ["\n text-align: ", ";\n display: flex;\n flex-direction: column;\n flex-wrap: nowrap;\n ", "\n padding-bottom: 0;\n"])), function (props) {
19224
19341
  var _a;
19225
19342
  return (_a = props.theme.textAlign) !== null && _a !== void 0 ? _a : 'center';
19226
19343
  }, function (props) {
19227
19344
  return props.theme.padding ? "box-sizing: border-box; padding: ".concat(props.theme.padding, ";") : "";
19228
19345
  });
19229
- var StyledGuidanceMessage = styled(GuidanceMessage)(templateObject_3$a || (templateObject_3$a = __makeTemplateObject(["\n padding: 16px 24px;\n margin-top: 16px;\n font-size: 18px;\n font-weight: bold;\n background: white;\n box-shadow:\n 0 1px 3px 0 rgb(0 0 0 / 0.1),\n 0 1px 2px -1px rgb(0 0 0 / 0.1);\n"], ["\n padding: 16px 24px;\n margin-top: 16px;\n font-size: 18px;\n font-weight: bold;\n background: white;\n box-shadow:\n 0 1px 3px 0 rgb(0 0 0 / 0.1),\n 0 1px 2px -1px rgb(0 0 0 / 0.1);\n"])));
19230
- var StyledButtonsRow$5 = styled(ButtonsRow)(templateObject_4$5 || (templateObject_4$5 = __makeTemplateObject(["\n display: flex;\n flex-direction: row;\n padding: 15px 25px;\n height: 100px;\n color: ", ";\n ", "\n position: fixed;\n bottom: 0;\n left: 0;\n width: 100dvw;\n box-sizing: border-box;\n"], ["\n display: flex;\n flex-direction: row;\n padding: 15px 25px;\n height: 100px;\n color: ", ";\n ", "\n position: fixed;\n bottom: 0;\n left: 0;\n width: 100dvw;\n box-sizing: border-box;\n"])), function (props) {
19346
+ var StyledGuidanceMessage = styled(GuidanceMessage)(templateObject_3$b || (templateObject_3$b = __makeTemplateObject(["\n padding: 16px 24px;\n margin-top: 16px;\n font-size: 18px;\n font-weight: bold;\n background: white;\n box-shadow:\n 0 1px 3px 0 rgb(0 0 0 / 0.1),\n 0 1px 2px -1px rgb(0 0 0 / 0.1);\n"], ["\n padding: 16px 24px;\n margin-top: 16px;\n font-size: 18px;\n font-weight: bold;\n background: white;\n box-shadow:\n 0 1px 3px 0 rgb(0 0 0 / 0.1),\n 0 1px 2px -1px rgb(0 0 0 / 0.1);\n"])));
19347
+ var StyledButtonsRow$5 = styled(ButtonsRow)(templateObject_4$6 || (templateObject_4$6 = __makeTemplateObject(["\n display: flex;\n flex-direction: row;\n padding: 15px 25px;\n height: 100px;\n color: ", ";\n ", "\n position: fixed;\n bottom: 0;\n left: 0;\n width: 100dvw;\n box-sizing: border-box;\n"], ["\n display: flex;\n flex-direction: row;\n padding: 15px 25px;\n height: 100px;\n color: ", ";\n ", "\n position: fixed;\n bottom: 0;\n left: 0;\n width: 100dvw;\n box-sizing: border-box;\n"])), function (props) {
19231
19348
  var _a, _b, _c, _d;
19232
19349
  return (_d = (_c = (_b = (_a = props.theme) === null || _a === void 0 ? void 0 : _a.selfieCapture) === null || _b === void 0 ? void 0 : _b.loadingOverlay) === null || _c === void 0 ? void 0 : _c.progressBarTextColor) !== null && _d !== void 0 ? _d : 'white';
19233
19350
  }, function (props) {
19234
19351
  var _a, _b, _c, _d, _e, _f;
19235
19352
  return ((_c = (_b = (_a = props.theme) === null || _a === void 0 ? void 0 : _a.selfieCapture) === null || _b === void 0 ? void 0 : _b.loadingOverlay) === null || _c === void 0 ? void 0 : _c.progressBarFontSize) ? "font-size: ".concat((_f = (_e = (_d = props.theme) === null || _d === void 0 ? void 0 : _d.selfieCapture) === null || _e === void 0 ? void 0 : _e.loadingOverlay) === null || _f === void 0 ? void 0 : _f.progressBarFontSize, ";") : '';
19236
19353
  });
19237
- var StyledOverlayImageContainer = styled(OverlayImageContainer)(templateObject_5$2 || (templateObject_5$2 = __makeTemplateObject(["\n padding: 0;\n\n & > svg {\n height: 100%;\n }\n"], ["\n padding: 0;\n\n & > svg {\n height: 100%;\n }\n"])));
19238
- var LoadingListContainer = styled.div(templateObject_6$2 || (templateObject_6$2 = __makeTemplateObject(["\n display: flex;\n position: relative;\n z-index: 2;\n"], ["\n display: flex;\n position: relative;\n z-index: 2;\n"])));
19239
- var LoadingList = styled.ul(templateObject_7$1 || (templateObject_7$1 = __makeTemplateObject(["\n display: block;\n margin: auto;\n list-style: none;\n padding: 0;\n"], ["\n display: block;\n margin: auto;\n list-style: none;\n padding: 0;\n"])));
19354
+ var StyledOverlayImageContainer = styled(OverlayImageContainer)(templateObject_5$3 || (templateObject_5$3 = __makeTemplateObject(["\n padding: 0;\n\n & > svg {\n height: 100%;\n }\n"], ["\n padding: 0;\n\n & > svg {\n height: 100%;\n }\n"])));
19355
+ var LoadingListContainer = styled.div(templateObject_6$3 || (templateObject_6$3 = __makeTemplateObject(["\n display: flex;\n position: relative;\n z-index: 2;\n"], ["\n display: flex;\n position: relative;\n z-index: 2;\n"])));
19356
+ var LoadingList = styled.ul(templateObject_7$2 || (templateObject_7$2 = __makeTemplateObject(["\n display: block;\n margin: auto;\n list-style: none;\n padding: 0;\n"], ["\n display: block;\n margin: auto;\n list-style: none;\n padding: 0;\n"])));
19240
19357
  var LoadingListItem = styled.li(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n display: inline-flex;\n justify-content: center;\n align-items: center;\n padding: 2px 1.25rem 2px 0;\n line-height: 1rem;\n"], ["\n display: inline-flex;\n justify-content: center;\n align-items: center;\n padding: 2px 1.25rem 2px 0;\n line-height: 1rem;\n"])));
19241
19358
  var ProgressContainer = styled.div(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n"], ["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n"])));
19242
19359
  var ProgressBarBackground = styled.div(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: ", ";\n opacity: ", ";\n"], ["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: ", ";\n opacity: ", ";\n"])), function (props) {
@@ -19262,7 +19379,7 @@
19262
19379
  var _a, _b, _c, _d, _e, _f;
19263
19380
  return ((_c = (_b = (_a = props.theme) === null || _a === void 0 ? void 0 : _a.selfieCapture) === null || _b === void 0 ? void 0 : _b.loadingOverlay) === null || _c === void 0 ? void 0 : _c.continueBtnBorder) ? "border: ".concat((_f = (_e = (_d = props.theme) === null || _d === void 0 ? void 0 : _d.selfieCapture) === null || _e === void 0 ? void 0 : _e.loadingOverlay) === null || _f === void 0 ? void 0 : _f.continueBtnBorder, ";") : '';
19264
19381
  });
19265
- var templateObject_1$c, templateObject_2$a, templateObject_3$a, templateObject_4$5, templateObject_5$2, templateObject_6$2, templateObject_7$1, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15;
19382
+ var templateObject_1$d, templateObject_2$b, templateObject_3$b, templateObject_4$6, templateObject_5$3, templateObject_6$3, templateObject_7$2, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15;
19266
19383
 
19267
19384
  var components = {
19268
19385
  "default": SelfieCaptureLoadingOverlayDefault,
@@ -19322,7 +19439,13 @@
19322
19439
  livenessCheckRequest = _t.livenessCheckRequest,
19323
19440
  setSelfieImage = _t.setSelfieImage,
19324
19441
  logSelfieCaptureAttempt = _t.logSelfieCaptureAttempt;
19325
- var _u = React.useContext(CameraStateContext),
19442
+ var _u = useCameraStore(useShallow(function (state) {
19443
+ return {
19444
+ cameraAccessDenied: state.cameraAccessDenied,
19445
+ requestCameraAccess: state.requestCameraAccess,
19446
+ releaseCameraAccess: state.releaseCameraAccess
19447
+ };
19448
+ })),
19326
19449
  cameraAccessDenied = _u.cameraAccessDenied,
19327
19450
  requestCameraAccess = _u.requestCameraAccess,
19328
19451
  releaseCameraAccess = _u.releaseCameraAccess;
@@ -19591,7 +19714,7 @@
19591
19714
  }
19592
19715
  return /*#__PURE__*/React.createElement(OverlayContainer, {
19593
19716
  className: classNames.container
19594
- }, /*#__PURE__*/React.createElement(Inner$1, {
19717
+ }, /*#__PURE__*/React.createElement(Inner$2, {
19595
19718
  className: classNames.inner
19596
19719
  }, /*#__PURE__*/React.createElement(Heading$4, {
19597
19720
  className: classNames.heading
@@ -19621,11 +19744,11 @@
19621
19744
  }
19622
19745
  }, verbiage.captureBtnText)))));
19623
19746
  };
19624
- var Inner$1 = styled(OverlayInner$2)(templateObject_1$b || (templateObject_1$b = __makeTemplateObject(["\n justify-content: center;\n"], ["\n justify-content: center;\n"])));
19625
- var Heading$4 = styled.h3(templateObject_2$9 || (templateObject_2$9 = __makeTemplateObject(["\n margin-bottom: 8px;\n"], ["\n margin-bottom: 8px;\n"])));
19626
- var Description = styled.p(templateObject_3$9 || (templateObject_3$9 = __makeTemplateObject(["\n margin-bottom: 8px;\n"], ["\n margin-bottom: 8px;\n"])));
19627
- var StyledButtonsRow$4 = styled(ButtonsRow)(templateObject_4$4 || (templateObject_4$4 = __makeTemplateObject(["\n margin-top: 32px;\n"], ["\n margin-top: 32px;\n"])));
19628
- var templateObject_1$b, templateObject_2$9, templateObject_3$9, templateObject_4$4;
19747
+ var Inner$2 = styled(OverlayInner$2)(templateObject_1$c || (templateObject_1$c = __makeTemplateObject(["\n justify-content: center;\n"], ["\n justify-content: center;\n"])));
19748
+ var Heading$4 = styled.h3(templateObject_2$a || (templateObject_2$a = __makeTemplateObject(["\n margin-bottom: 8px;\n"], ["\n margin-bottom: 8px;\n"])));
19749
+ var Description = styled.p(templateObject_3$a || (templateObject_3$a = __makeTemplateObject(["\n margin-bottom: 8px;\n"], ["\n margin-bottom: 8px;\n"])));
19750
+ var StyledButtonsRow$4 = styled(ButtonsRow)(templateObject_4$5 || (templateObject_4$5 = __makeTemplateObject(["\n margin-top: 32px;\n"], ["\n margin-top: 32px;\n"])));
19751
+ var templateObject_1$c, templateObject_2$a, templateObject_3$a, templateObject_4$5;
19629
19752
 
19630
19753
  var AdditionalDocumentCaptureWizard = function AdditionalDocumentCaptureWizard(_a) {
19631
19754
  var documents = _a.documents,
@@ -20537,7 +20660,7 @@
20537
20660
  });
20538
20661
  }
20539
20662
 
20540
- var SignaturePaperBacking = styled.div(templateObject_1$a || (templateObject_1$a = __makeTemplateObject(["\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n ", "\n ", "\n ", "\n"], ["\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n ", "\n ", "\n ", "\n"])), function (props) {
20663
+ var SignaturePaperBacking = styled.div(templateObject_1$b || (templateObject_1$b = __makeTemplateObject(["\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n ", "\n ", "\n ", "\n"], ["\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n ", "\n ", "\n ", "\n"])), function (props) {
20541
20664
  var _a, _b;
20542
20665
  return ((_a = props.theme.signatureCapture) === null || _a === void 0 ? void 0 : _a.background) ? "background: ".concat((_b = props.theme.signatureCapture) === null || _b === void 0 ? void 0 : _b.background, ";") : "";
20543
20666
  }, function (props) {
@@ -20547,8 +20670,8 @@
20547
20670
  var _a, _b;
20548
20671
  return ((_a = props.theme.signatureCapture) === null || _a === void 0 ? void 0 : _a.backgroundPosition) ? "background-position: ".concat((_b = props.theme.signatureCapture) === null || _b === void 0 ? void 0 : _b.backgroundPosition, ";") : "";
20549
20672
  });
20550
- var SignatureCanvasContainer$1 = styled.div(templateObject_2$8 || (templateObject_2$8 = __makeTemplateObject(["\n position: absolute;\n top: 25%;\n left: 15%;\n width: 70%;\n height: 50%;\n\n @media (max-width: 800px) {\n top: 15%;\n left: 2%;\n width: 96%;\n height: 70%;\n }\n"], ["\n position: absolute;\n top: 25%;\n left: 15%;\n width: 70%;\n height: 50%;\n\n @media (max-width: 800px) {\n top: 15%;\n left: 2%;\n width: 96%;\n height: 70%;\n }\n"])));
20551
- var SignaturePad = styled.div(templateObject_3$8 || (templateObject_3$8 = __makeTemplateObject(["\n position: relative;\n background: ", ";\n border: ", ";\n border-radius: ", ";\n flex-grow: 1;\n z-index: 100;\n height: 100%;\n"], ["\n position: relative;\n background: ", ";\n border: ", ";\n border-radius: ", ";\n flex-grow: 1;\n z-index: 100;\n height: 100%;\n"])), function (props) {
20673
+ var SignatureCanvasContainer$1 = styled.div(templateObject_2$9 || (templateObject_2$9 = __makeTemplateObject(["\n position: absolute;\n top: 25%;\n left: 15%;\n width: 70%;\n height: 50%;\n\n @media (max-width: 800px) {\n top: 15%;\n left: 2%;\n width: 96%;\n height: 70%;\n }\n"], ["\n position: absolute;\n top: 25%;\n left: 15%;\n width: 70%;\n height: 50%;\n\n @media (max-width: 800px) {\n top: 15%;\n left: 2%;\n width: 96%;\n height: 70%;\n }\n"])));
20674
+ var SignaturePad = styled.div(templateObject_3$9 || (templateObject_3$9 = __makeTemplateObject(["\n position: relative;\n background: ", ";\n border: ", ";\n border-radius: ", ";\n flex-grow: 1;\n z-index: 100;\n height: 100%;\n"], ["\n position: relative;\n background: ", ";\n border: ", ";\n border-radius: ", ";\n flex-grow: 1;\n z-index: 100;\n height: 100%;\n"])), function (props) {
20552
20675
  var _a, _b, _c;
20553
20676
  return (_c = (_b = (_a = props.theme.signatureCapture) === null || _a === void 0 ? void 0 : _a.canvas) === null || _b === void 0 ? void 0 : _b.background) !== null && _c !== void 0 ? _c : 'rgba(255, 255, 255, 0.5)';
20554
20677
  }, function (props) {
@@ -20558,8 +20681,8 @@
20558
20681
  var _a, _b, _c;
20559
20682
  return (_c = (_b = (_a = props.theme.signatureCapture) === null || _a === void 0 ? void 0 : _a.canvas) === null || _b === void 0 ? void 0 : _b.borderRadius) !== null && _c !== void 0 ? _c : '16px';
20560
20683
  });
20561
- var SignatureButtonsContainer = styled(ButtonsRow)(templateObject_4$3 || (templateObject_4$3 = __makeTemplateObject(["\n flex-grow: 0;\n padding-top: 12px;\n display: flex;\n z-index: 1000;\n position: relative;\n"], ["\n flex-grow: 0;\n padding-top: 12px;\n display: flex;\n z-index: 1000;\n position: relative;\n"])));
20562
- var templateObject_1$a, templateObject_2$8, templateObject_3$8, templateObject_4$3;
20684
+ var SignatureButtonsContainer = styled(ButtonsRow)(templateObject_4$4 || (templateObject_4$4 = __makeTemplateObject(["\n flex-grow: 0;\n padding-top: 12px;\n display: flex;\n z-index: 1000;\n position: relative;\n"], ["\n flex-grow: 0;\n padding-top: 12px;\n display: flex;\n z-index: 1000;\n position: relative;\n"])));
20685
+ var templateObject_1$b, templateObject_2$9, templateObject_3$9, templateObject_4$4;
20563
20686
 
20564
20687
  var SignatureCapture = function SignatureCapture(_a) {
20565
20688
  var _b;
@@ -20630,8 +20753,8 @@
20630
20753
  finished: true
20631
20754
  }, verbiage.acceptBtnText)))));
20632
20755
  };
20633
- var AcceptBtn$1 = styled(LoaderButton)(templateObject_1$9 || (templateObject_1$9 = __makeTemplateObject(["\n margin-left: auto;\n"], ["\n margin-left: auto;\n"])));
20634
- var templateObject_1$9;
20756
+ var AcceptBtn$1 = styled(LoaderButton)(templateObject_1$a || (templateObject_1$a = __makeTemplateObject(["\n margin-left: auto;\n"], ["\n margin-left: auto;\n"])));
20757
+ var templateObject_1$a;
20635
20758
 
20636
20759
  var useVideoRecorder = function useVideoRecorder(camera, audioStream, mergeAVStreams) {
20637
20760
  if (mergeAVStreams === void 0) {
@@ -20811,10 +20934,10 @@
20811
20934
  setSignatureVideoUrl = _e[1];
20812
20935
  var signatureRecorder = React.useRef(null);
20813
20936
  var recordedChunks = React.useRef([]);
20814
- var _f = React.useContext(CameraStateContext),
20815
- cameraRef = _f.cameraRef,
20937
+ var _f = useCameraStore(),
20938
+ camera = _f.camera,
20816
20939
  videoRef = _f.videoRef;
20817
- var _g = useVideoRecorder(cameraRef.current),
20940
+ var _g = useVideoRecorder(camera),
20818
20941
  isRecordingVideo = _g.isRecordingVideo,
20819
20942
  startRecordingVideo = _g.startRecordingVideo,
20820
20943
  stopRecordingVideo = _g.stopRecordingVideo,
@@ -20882,8 +21005,8 @@
20882
21005
  var animationFrame = React.useRef(0);
20883
21006
  React.useEffect(function () {
20884
21007
  var _a;
20885
- if (!signaturePad.current || !videoRef.current || !outputCanvas.current || !cameraRef.current || !isRecording || !isRecordingVideo) return;
20886
- var _b = [cameraRef.current.width, cameraRef.current.height],
21008
+ if (!signaturePad.current || !videoRef.current || !outputCanvas.current || !camera || !isRecording || !isRecordingVideo) return;
21009
+ var _b = [camera.width, camera.height],
20887
21010
  w = _b[0],
20888
21011
  h = _b[1];
20889
21012
  var isPortrait = typeof window !== 'undefined' && window.innerWidth < window.innerHeight;
@@ -20916,7 +21039,7 @@
20916
21039
  return function () {
20917
21040
  cancelAnimationFrame(animationFrame.current);
20918
21041
  };
20919
- }, [cameraRef, isRecording, isRecordingVideo, videoRef]);
21042
+ }, [camera, isRecording, isRecordingVideo, videoRef]);
20920
21043
  var onAcceptClicked = React.useCallback(function () {
20921
21044
  return __awaiter(_this, void 0, void 0, function () {
20922
21045
  var imageUrl;
@@ -20991,11 +21114,11 @@
20991
21114
  className: classNames.signatureCanvas
20992
21115
  };
20993
21116
  }, [classNames.signatureCanvas, height, width]);
20994
- return /*#__PURE__*/React.createElement(Container, {
21117
+ return /*#__PURE__*/React.createElement(Container$1, {
20995
21118
  className: classNames.container
20996
- }, /*#__PURE__*/React.createElement(Inner, {
21119
+ }, /*#__PURE__*/React.createElement(Inner$1, {
20997
21120
  className: classNames.inner
20998
- }, /*#__PURE__*/React.createElement(FaceGuideContainer, {
21121
+ }, /*#__PURE__*/React.createElement(FaceGuideContainer$1, {
20999
21122
  className: classNames.faceGuideContainer
21000
21123
  }, /*#__PURE__*/React.createElement(StyledSelfieCaptureAnimatedMask, {
21001
21124
  className: classNames.faceGuide,
@@ -21030,42 +21153,44 @@
21030
21153
  finished: true
21031
21154
  }, verbiage.acceptSignatureBtnText))))));
21032
21155
  }
21033
- var Container = styled.div(templateObject_1$8 || (templateObject_1$8 = __makeTemplateObject(["\n display: flex;\n max-height: 100%;\n position: absolute;\n z-index: 1000;\n width: 100dvw;\n height: 100dvh;\n font-family: ", ";\n box-sizing: border-box;\n overflow: hidden;\n padding: 40px;\n"], ["\n display: flex;\n max-height: 100%;\n position: absolute;\n z-index: 1000;\n width: 100dvw;\n height: 100dvh;\n font-family: ", ";\n box-sizing: border-box;\n overflow: hidden;\n padding: 40px;\n"])), function (props) {
21156
+ var Container$1 = styled.div(templateObject_1$9 || (templateObject_1$9 = __makeTemplateObject(["\n display: flex;\n max-height: 100%;\n position: absolute;\n z-index: 1000;\n width: 100dvw;\n height: 100dvh;\n font-family: ", ";\n box-sizing: border-box;\n overflow: hidden;\n padding: 40px;\n"], ["\n display: flex;\n max-height: 100%;\n position: absolute;\n z-index: 1000;\n width: 100dvw;\n height: 100dvh;\n font-family: ", ";\n box-sizing: border-box;\n overflow: hidden;\n padding: 40px;\n"])), function (props) {
21034
21157
  var _a;
21035
21158
  return (_a = props.theme) === null || _a === void 0 ? void 0 : _a.fontFamily;
21036
21159
  });
21037
- var Inner = styled.div(templateObject_2$7 || (templateObject_2$7 = __makeTemplateObject(["\n width: 100%;\n height: 100%;\n max-height: 1280px;\n display: flex;\n margin: auto;\n align-items: center;\n flex-direction: column;\n"], ["\n width: 100%;\n height: 100%;\n max-height: 1280px;\n display: flex;\n margin: auto;\n align-items: center;\n flex-direction: column;\n"])));
21038
- var FaceGuideContainer = styled.div(templateObject_3$7 || (templateObject_3$7 = __makeTemplateObject(["\n position: relative;\n height: 50%;\n"], ["\n position: relative;\n height: 50%;\n"])));
21039
- var StyledSelfieCaptureAnimatedMask = styled(SelfieCaptureAnimatedMaskWithStatus)(templateObject_4$2 || (templateObject_4$2 = __makeTemplateObject(["\n max-width: 100%;\n height: 100%;\n"], ["\n max-width: 100%;\n height: 100%;\n"])));
21040
- var SignaturePadContainer = styled.div(templateObject_5$1 || (templateObject_5$1 = __makeTemplateObject(["\n position: relative;\n max-width: 100%;\n height: 50%;\n aspect-ratio: 2;\n"], ["\n position: relative;\n max-width: 100%;\n height: 50%;\n aspect-ratio: 2;\n"])));
21041
- var SignatureCanvasContainer = styled.div(templateObject_6$1 || (templateObject_6$1 = __makeTemplateObject(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: calc(100% - 67px);\n ", "\n"], ["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: calc(100% - 67px);\n ", "\n"])), function (props) {
21160
+ var Inner$1 = styled.div(templateObject_2$8 || (templateObject_2$8 = __makeTemplateObject(["\n width: 100%;\n height: 100%;\n max-height: 1280px;\n display: flex;\n margin: auto;\n align-items: center;\n flex-direction: column;\n"], ["\n width: 100%;\n height: 100%;\n max-height: 1280px;\n display: flex;\n margin: auto;\n align-items: center;\n flex-direction: column;\n"])));
21161
+ var FaceGuideContainer$1 = styled.div(templateObject_3$8 || (templateObject_3$8 = __makeTemplateObject(["\n position: relative;\n height: 50%;\n"], ["\n position: relative;\n height: 50%;\n"])));
21162
+ var StyledSelfieCaptureAnimatedMask = styled(SelfieCaptureAnimatedMaskWithStatus)(templateObject_4$3 || (templateObject_4$3 = __makeTemplateObject(["\n max-width: 100%;\n height: 100%;\n"], ["\n max-width: 100%;\n height: 100%;\n"])));
21163
+ var SignaturePadContainer = styled.div(templateObject_5$2 || (templateObject_5$2 = __makeTemplateObject(["\n position: relative;\n max-width: 100%;\n height: 50%;\n aspect-ratio: 2;\n"], ["\n position: relative;\n max-width: 100%;\n height: 50%;\n aspect-ratio: 2;\n"])));
21164
+ var SignatureCanvasContainer = styled.div(templateObject_6$2 || (templateObject_6$2 = __makeTemplateObject(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: calc(100% - 67px);\n ", "\n"], ["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: calc(100% - 67px);\n ", "\n"])), function (props) {
21042
21165
  return props.$disabled ? 'opacity: 0.5; pointer-events: none;' : '';
21043
21166
  });
21044
- var AcceptBtn = styled(LoaderButton)(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n margin-left: auto;\n"], ["\n margin-left: auto;\n"])));
21045
- var templateObject_1$8, templateObject_2$7, templateObject_3$7, templateObject_4$2, templateObject_5$1, templateObject_6$1, templateObject_7;
21167
+ var AcceptBtn = styled(LoaderButton)(templateObject_7$1 || (templateObject_7$1 = __makeTemplateObject(["\n margin-left: auto;\n"], ["\n margin-left: auto;\n"])));
21168
+ var templateObject_1$9, templateObject_2$8, templateObject_3$8, templateObject_4$3, templateObject_5$2, templateObject_6$2, templateObject_7$1;
21046
21169
 
21047
21170
  var VideoSignatureCapture = function VideoSignatureCapture(_a) {
21048
- var _b, _c, _d;
21171
+ var _b;
21049
21172
  var onVideoCaptured = _a.onVideoCaptured,
21050
21173
  onFaceNotDetected = _a.onFaceNotDetected,
21051
21174
  onExit = _a.onExit,
21052
21175
  guidesComponent = _a.guidesComponent,
21053
- _e = _a.classNames,
21054
- classNames = _e === void 0 ? {} : _e,
21055
- _f = _a.colors,
21056
- colors = _f === void 0 ? {} : _f,
21057
- _g = _a.verbiage,
21058
- rawVerbiage = _g === void 0 ? {} : _g,
21059
- _h = _a.debugMode,
21060
- debugMode = _h === void 0 ? false : _h;
21061
- var cameraRef = React.useContext(CameraStateContext).cameraRef;
21176
+ _c = _a.classNames,
21177
+ classNames = _c === void 0 ? {} : _c,
21178
+ _d = _a.colors,
21179
+ colors = _d === void 0 ? {} : _d,
21180
+ _e = _a.verbiage,
21181
+ rawVerbiage = _e === void 0 ? {} : _e,
21182
+ _f = _a.debugMode,
21183
+ debugMode = _f === void 0 ? false : _f;
21184
+ var camera = useCameraStore(function (state) {
21185
+ return state.camera;
21186
+ });
21062
21187
  var onPredictionMade = React.useContext(SelfieGuidanceModelsContext).onPredictionMade;
21063
- var _j = useVideoSignatureContext(),
21064
- signatureData = _j.signatureData,
21065
- signatureDataUrl = _j.signatureDataUrl,
21066
- signatureVideoData = _j.signatureVideoData,
21067
- startRecording = _j.startRecording,
21068
- stopRecording = _j.stopRecording;
21188
+ var _g = useVideoSignatureContext(),
21189
+ signatureData = _g.signatureData,
21190
+ signatureDataUrl = _g.signatureDataUrl,
21191
+ signatureVideoData = _g.signatureVideoData,
21192
+ startRecording = _g.startRecording,
21193
+ stopRecording = _g.stopRecording;
21069
21194
  React.useEffect(function () {
21070
21195
  startRecording();
21071
21196
  return function () {
@@ -21082,9 +21207,9 @@
21082
21207
  onVideoCaptured === null || onVideoCaptured === void 0 ? void 0 : onVideoCaptured(signatureVideoData, signatureData, signatureDataUrl);
21083
21208
  }
21084
21209
  }, [onVideoCaptured, signatureData, signatureDataUrl, signatureVideoData]);
21085
- var _k = React.useState(0),
21086
- numFramesWithoutFaces = _k[0],
21087
- setNumFramesWithoutFaces = _k[1];
21210
+ var _h = React.useState(0),
21211
+ numFramesWithoutFaces = _h[0],
21212
+ setNumFramesWithoutFaces = _h[1];
21088
21213
  React.useEffect(function () {
21089
21214
  onPredictionMade(function (_a) {
21090
21215
  var face = _a.face;
@@ -21111,7 +21236,7 @@
21111
21236
  }, verbiage.guidanceMessageText))), /*#__PURE__*/React.createElement(GuidesComponent, {
21112
21237
  classNames: classNames.videoSignatureGuidesClassNames,
21113
21238
  status: "success"
21114
- }), debugMode && ( /*#__PURE__*/React.createElement(DebugStatsPane, null, "Video: ", (_c = cameraRef.current) === null || _c === void 0 ? void 0 : _c.width, "x", (_d = cameraRef.current) === null || _d === void 0 ? void 0 : _d.height)), /*#__PURE__*/React.createElement(ExitCaptureButton, {
21239
+ }), debugMode && ( /*#__PURE__*/React.createElement(DebugStatsPane, null, "Video: ", camera === null || camera === void 0 ? void 0 : camera.width, "x", camera === null || camera === void 0 ? void 0 : camera.height)), /*#__PURE__*/React.createElement(ExitCaptureButton, {
21115
21240
  onClick: onExit,
21116
21241
  className: classNames.exitCaptureBtn
21117
21242
  }));
@@ -21170,8 +21295,8 @@
21170
21295
  finished: true
21171
21296
  }, verbiage.doneBtnText))));
21172
21297
  };
21173
- var StyledVideo$1 = styled.video(templateObject_1$7 || (templateObject_1$7 = __makeTemplateObject(["\n margin-left: auto;\n margin-right: auto;\n max-width: 100%;\n"], ["\n margin-left: auto;\n margin-right: auto;\n max-width: 100%;\n"])));
21174
- var templateObject_1$7;
21298
+ var StyledVideo$1 = styled.video(templateObject_1$8 || (templateObject_1$8 = __makeTemplateObject(["\n margin-left: auto;\n margin-right: auto;\n max-width: 100%;\n"], ["\n margin-left: auto;\n margin-right: auto;\n max-width: 100%;\n"])));
21299
+ var templateObject_1$8;
21175
21300
 
21176
21301
  var VideoSignatureWizard = function VideoSignatureWizard(_a) {
21177
21302
  var _b;
@@ -21205,7 +21330,13 @@
21205
21330
  setSignatureData = _l.setSignatureData,
21206
21331
  setSignatureVideoUrl = _l.setSignatureVideoUrl,
21207
21332
  logSelfieCaptureAttempt = _l.logSelfieCaptureAttempt;
21208
- var _m = React.useContext(CameraStateContext),
21333
+ var _m = useCameraStore(useShallow(function (state) {
21334
+ return {
21335
+ cameraAccessDenied: state.cameraAccessDenied,
21336
+ requestCameraAccess: state.requestCameraAccess,
21337
+ releaseCameraAccess: state.releaseCameraAccess
21338
+ };
21339
+ })),
21209
21340
  cameraAccessDenied = _m.cameraAccessDenied,
21210
21341
  requestCameraAccess = _m.requestCameraAccess,
21211
21342
  releaseCameraAccess = _m.releaseCameraAccess;
@@ -21364,6 +21495,129 @@
21364
21495
  }()));
21365
21496
  };
21366
21497
 
21498
+ var IdVideoCaptureGuides = function IdVideoCaptureGuides(_a) {
21499
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
21500
+ var _z = _a.requestedAction,
21501
+ requestedAction = _z === void 0 ? 'SHOW_ID_FRONT' : _z,
21502
+ _0 = _a.satisfied,
21503
+ satisfied = _0 === void 0 ? false : _0,
21504
+ _1 = _a.faceGuideStatus,
21505
+ faceGuideStatus = _1 === void 0 ? 'success' : _1,
21506
+ faceGuideBorderWidth = _a.faceGuideBorderWidth,
21507
+ faceGuideBorderColor = _a.faceGuideBorderColor,
21508
+ _2 = _a.idCardGuideStatus,
21509
+ idCardGuideStatus = _2 === void 0 ? 'ready' : _2,
21510
+ idCardGuideBorderWidth = _a.idCardGuideBorderWidth,
21511
+ idCardGuideBorderColor = _a.idCardGuideBorderColor,
21512
+ idCardCaptureProgress = _a.idCardCaptureProgress,
21513
+ _3 = _a.idCardCaptureGuideImages,
21514
+ userSuppliedImages = _3 === void 0 ? defaultIdCaptureGuideImages : _3,
21515
+ _4 = _a.classNames,
21516
+ classNames = _4 === void 0 ? {} : _4,
21517
+ _5 = _a.verbiage,
21518
+ rawVerbiage = _5 === void 0 ? {} : _5;
21519
+ var isRearFacing = useCameraStore(function (state) {
21520
+ return state.isRearFacing;
21521
+ });
21522
+ var verbiage = useTranslations(rawVerbiage, {
21523
+ idFrontInstructionText: 'Display the front of your ID card...',
21524
+ idBackInstructionText: 'Display the back of your ID card...',
21525
+ flipIdInstructionText: 'Please flip your ID card...',
21526
+ verifyLivenessInstructionText: 'Performing facial recognition, please hold still...'
21527
+ });
21528
+ var instructionText = requestedAction === 'VERIFY_LIVENESS' ? verbiage.verifyLivenessInstructionText : requestedAction === 'SHOW_ID_FRONT' ? verbiage.idFrontInstructionText : requestedAction === 'FLIP_ID' ? verbiage.flipIdInstructionText : verbiage.idBackInstructionText;
21529
+ var theme = styled.useTheme();
21530
+ if (faceGuideBorderWidth === undefined) faceGuideBorderWidth = (_d = (_c = (_b = theme.idVideoCapture) === null || _b === void 0 ? void 0 : _b.faceGuides) === null || _c === void 0 ? void 0 : _c.borderWidth) !== null && _d !== void 0 ? _d : 5;
21531
+ if (faceGuideBorderColor === undefined) faceGuideBorderColor = (_j = satisfied ? (_f = (_e = theme.idVideoCapture) === null || _e === void 0 ? void 0 : _e.faceGuides) === null || _f === void 0 ? void 0 : _f.satisfiedColor : (_h = (_g = theme.idVideoCapture) === null || _g === void 0 ? void 0 : _g.faceGuides) === null || _h === void 0 ? void 0 : _h.unsatisfiedColor) !== null && _j !== void 0 ? _j : '#D6DCE7';
21532
+ if (idCardGuideBorderWidth === undefined) idCardGuideBorderWidth = (_m = (_l = (_k = theme.idVideoCapture) === null || _k === void 0 ? void 0 : _k.idCardGuides) === null || _l === void 0 ? void 0 : _l.borderWidth) !== null && _m !== void 0 ? _m : 20;
21533
+ if (idCardGuideBorderColor === undefined) idCardGuideBorderColor = (_s = satisfied ? (_p = (_o = theme.idVideoCapture) === null || _o === void 0 ? void 0 : _o.idCardGuides) === null || _p === void 0 ? void 0 : _p.satisfiedColor : (_r = (_q = theme.idVideoCapture) === null || _q === void 0 ? void 0 : _q.idCardGuides) === null || _r === void 0 ? void 0 : _r.unsatisfiedColor) !== null && _s !== void 0 ? _s : '#D6DCE7';
21534
+ var _6 = useResizeObserver(),
21535
+ idCardGuideRef = _6.ref,
21536
+ _7 = _6.width,
21537
+ idCardGuideWidth = _7 === void 0 ? 0 : _7,
21538
+ _8 = _6.height,
21539
+ idCardGuideHeight = _8 === void 0 ? 0 : _8;
21540
+ var idCaptureGuideImages = useGuideImages(userSuppliedImages);
21541
+ var idCaptureGuideImagesByUrl = useGuideImagesByUrl(idCaptureGuideImages);
21542
+ var _9 = React.useState(undefined),
21543
+ aspectRatio = _9[0],
21544
+ setAspectRatio = _9[1];
21545
+ var onImageLoaded = React.useCallback(function (e) {
21546
+ var _a, _b, _c, _d;
21547
+ var img = e.currentTarget;
21548
+ var imageByUrl = idCaptureGuideImagesByUrl[img.src];
21549
+ var naturalWidth = (_b = (_a = imageByUrl === null || imageByUrl === void 0 ? void 0 : imageByUrl.width) !== null && _a !== void 0 ? _a : img.naturalWidth) !== null && _b !== void 0 ? _b : 0;
21550
+ var naturalHeight = (_d = (_c = imageByUrl === null || imageByUrl === void 0 ? void 0 : imageByUrl.height) !== null && _c !== void 0 ? _c : img.naturalHeight) !== null && _d !== void 0 ? _d : 0;
21551
+ setAspectRatio(naturalHeight > 0 ? naturalWidth / naturalHeight : undefined);
21552
+ }, [idCaptureGuideImagesByUrl]);
21553
+ var idCardImageStyle = React.useMemo(function () {
21554
+ return {
21555
+ maxWidth: idCardGuideWidth > idCardGuideHeight ? idCardGuideWidth : undefined,
21556
+ maxHeight: idCardGuideHeight > idCardGuideWidth ? idCardGuideHeight : undefined,
21557
+ height: '100%',
21558
+ aspectRatio: aspectRatio
21559
+ };
21560
+ }, [idCardGuideWidth, idCardGuideHeight, aspectRatio]);
21561
+ var disableIdGuides = ((_u = (_t = theme.idVideoCapture) === null || _t === void 0 ? void 0 : _t.idCardGuides) === null || _u === void 0 ? void 0 : _u.disableDuringLivenessCheck) && requestedAction === 'VERIFY_LIVENESS';
21562
+ return /*#__PURE__*/React.createElement(Container, {
21563
+ className: classNames.container
21564
+ }, /*#__PURE__*/React.createElement(Inner, null, /*#__PURE__*/React.createElement(FaceGuideContainer, {
21565
+ className: classNames.faceGuideContainer
21566
+ }, /*#__PURE__*/React.createElement(SelfieCaptureAnimatedMaskWithStatus, {
21567
+ className: classNames.faceGuide,
21568
+ status: requestedAction === 'VERIFY_LIVENESS' ? faceGuideStatus : 'success',
21569
+ borderWidth: faceGuideBorderWidth,
21570
+ borderColor: faceGuideBorderColor,
21571
+ verticalAlign: "bottom"
21572
+ })), !disableIdGuides && ( /*#__PURE__*/React.createElement(IdCardGuideContainer, {
21573
+ className: classNames.idCardGuideContainer,
21574
+ ref: idCardGuideRef
21575
+ }, /*#__PURE__*/React.createElement(IdCardGuideInner, {
21576
+ className: classNames.idCardGuideInner,
21577
+ style: {
21578
+ aspectRatio: aspectRatio
21579
+ }
21580
+ }, /*#__PURE__*/React.createElement(IdCardGuideImageContainer, {
21581
+ className: classNames.idCardGuideImageContainer,
21582
+ status: requestedAction === 'VERIFY_LIVENESS' ? 'disabled' : idCardGuideStatus,
21583
+ borderWidth: idCardGuideBorderWidth,
21584
+ borderColor: idCardGuideBorderColor,
21585
+ aspectRatio: aspectRatio,
21586
+ "$isVisible": requestedAction !== 'FLIP_ID',
21587
+ progress: requestedAction === 'VERIFY_LIVENESS' ? undefined : idCardCaptureProgress
21588
+ }, /*#__PURE__*/React.createElement(IdCardGuideImage, {
21589
+ alt: "",
21590
+ className: classNames.idCardGuideImage,
21591
+ "$isMirrored": !isRearFacing,
21592
+ style: idCardImageStyle,
21593
+ src: requestedAction === 'SHOW_ID_BACK' ? idCaptureGuideImages.landscape.SHOW_ID_BACK.url : idCaptureGuideImages.landscape.SHOW_ID_FRONT.url,
21594
+ onLoad: onImageLoaded
21595
+ })), requestedAction === 'FLIP_ID' && ( /*#__PURE__*/React.createElement(IdVideoCaptureFlipIdPrompt, {
21596
+ idCaptureGuideImages: idCaptureGuideImages,
21597
+ classNames: classNames.flipIdPrompt,
21598
+ borderWidth: idCardGuideBorderWidth,
21599
+ borderColor: idCardGuideBorderColor,
21600
+ imageStyle: idCardImageStyle
21601
+ }))), /*#__PURE__*/React.createElement(IdCardGuideInstructionsContainer, {
21602
+ className: classNames.idCardGuideInstructionsContainer
21603
+ }, /*#__PURE__*/React.createElement(IdCardGuideInstructions, {
21604
+ className: classNames.idCardGuideInstructions,
21605
+ "$textColor": (_w = (_v = theme.idVideoCapture) === null || _v === void 0 ? void 0 : _v.idCardGuides) === null || _w === void 0 ? void 0 : _w.instructionsTextColor,
21606
+ "$background": (_y = (_x = theme.idVideoCapture) === null || _x === void 0 ? void 0 : _x.idCardGuides) === null || _y === void 0 ? void 0 : _y.instructionsBackgroundColor
21607
+ }, instructionText))))));
21608
+ };
21609
+ var Container = styled.div(templateObject_1$7 || (templateObject_1$7 = __makeTemplateObject(["\n display: flex;\n max-height: 100%;\n position: absolute;\n z-index: 1000;\n width: 100dvw;\n height: 100dvh;\n font-family: ", ";\n box-sizing: border-box;\n overflow: hidden;\n padding: 40px;\n"], ["\n display: flex;\n max-height: 100%;\n position: absolute;\n z-index: 1000;\n width: 100dvw;\n height: 100dvh;\n font-family: ", ";\n box-sizing: border-box;\n overflow: hidden;\n padding: 40px;\n"])), function (props) {
21610
+ var _a;
21611
+ return (_a = props.theme) === null || _a === void 0 ? void 0 : _a.fontFamily;
21612
+ });
21613
+ var Inner = styled.div(templateObject_2$7 || (templateObject_2$7 = __makeTemplateObject(["\n width: 100%;\n height: 100%;\n max-height: 1280px;\n display: flex;\n margin: auto;\n align-items: center;\n flex-direction: column;\n justify-content: center;\n"], ["\n width: 100%;\n height: 100%;\n max-height: 1280px;\n display: flex;\n margin: auto;\n align-items: center;\n flex-direction: column;\n justify-content: center;\n"])));
21614
+ var FaceGuideContainer = styled.div(templateObject_3$7 || (templateObject_3$7 = __makeTemplateObject(["\n position: relative;\n height: 65%;\n"], ["\n position: relative;\n height: 65%;\n"])));
21615
+ var IdCardGuideContainer = styled.div(templateObject_4$2 || (templateObject_4$2 = __makeTemplateObject(["\n display: flex;\n flex-flow: column nowrap;\n margin: 0 auto;\n position: relative;\n max-width: 100%;\n height: 35%;\n"], ["\n display: flex;\n flex-flow: column nowrap;\n margin: 0 auto;\n position: relative;\n max-width: 100%;\n height: 35%;\n"])));
21616
+ var IdCardGuideInner = styled.div(templateObject_5$1 || (templateObject_5$1 = __makeTemplateObject(["\n position: relative;\n height: 100%;\n width: 100%;\n"], ["\n position: relative;\n height: 100%;\n width: 100%;\n"])));
21617
+ var IdCardGuideInstructionsContainer = styled.div(templateObject_6$1 || (templateObject_6$1 = __makeTemplateObject(["\n width: 100%;\n text-align: center;\n color: white;\n display: flex;\n flex-direction: column;\n justify-content: end;\n padding: 0 40px;\n position: fixed;\n bottom: 14px;\n left: 0;\n right: 0;\n box-sizing: border-box;\n"], ["\n width: 100%;\n text-align: center;\n color: white;\n display: flex;\n flex-direction: column;\n justify-content: end;\n padding: 0 40px;\n position: fixed;\n bottom: 14px;\n left: 0;\n right: 0;\n box-sizing: border-box;\n"])));
21618
+ var IdCardGuideInstructions = styled(GuidanceMessage)(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n align-content: center;\n margin: 12px auto;\n padding: 8px 12px;\n font-weight: bold;\n font-size: 18px;\n"], ["\n align-content: center;\n margin: 12px auto;\n padding: 8px 12px;\n font-weight: bold;\n font-size: 18px;\n"])));
21619
+ var templateObject_1$7, templateObject_2$7, templateObject_3$7, templateObject_4$2, templateObject_5$1, templateObject_6$1, templateObject_7;
21620
+
21367
21621
  var ReadTextPrompt = function ReadTextPrompt(_a) {
21368
21622
  var text = _a.text,
21369
21623
  onComplete = _a.onComplete,
@@ -21494,18 +21748,18 @@
21494
21748
  flipShortcutThreshold: 0.7
21495
21749
  };
21496
21750
  var IdVideoCapture = function IdVideoCapture(_a) {
21497
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
21751
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
21498
21752
  var onComplete = _a.onComplete,
21499
21753
  onIdFrontImageCaptured = _a.onIdFrontImageCaptured,
21500
21754
  onIdBackImageCaptured = _a.onIdBackImageCaptured,
21501
21755
  onFaceNotDetected = _a.onFaceNotDetected,
21502
21756
  onRecordingFailed = _a.onRecordingFailed,
21503
21757
  onExitCapture = _a.onExitCapture,
21504
- _x = _a.idCaptureModelsEnabled,
21505
- idCaptureModelsEnabled = _x === void 0 ? true : _x,
21506
- // idCardCaptureGuideImages = defaultIdCaptureGuideImages,
21758
+ _w = _a.idCaptureModelsEnabled,
21759
+ idCaptureModelsEnabled = _w === void 0 ? true : _w,
21760
+ _x = _a.idCardCaptureGuideImages,
21761
+ idCardCaptureGuideImages = _x === void 0 ? defaultIdCaptureGuideImages : _x,
21507
21762
  _y = _a.idCardFrontDelay,
21508
- // idCardCaptureGuideImages = defaultIdCaptureGuideImages,
21509
21763
  idCardFrontDelay = _y === void 0 ? 1000 : _y,
21510
21764
  _z = _a.videoIdCaptureThresholds,
21511
21765
  videoIdCaptureThresholds = _z === void 0 ? defaultVideoIdCaptureThresholds : _z,
@@ -21526,67 +21780,68 @@
21526
21780
  mergeAVStreams = _6 === void 0 ? false : _6,
21527
21781
  _7 = _a.classNames,
21528
21782
  classNames = _7 === void 0 ? {} : _7,
21529
- // colors = {},
21530
- _8 = _a.verbiage,
21531
- // colors = {},
21532
- rawVerbiage = _8 === void 0 ? {} : _8,
21533
- _9 = _a.debugMode,
21534
- debugMode = _9 === void 0 ? false : _9;
21535
- var _10 = useResizeObserver(),
21536
- ref = _10.ref,
21537
- _11 = _10.width,
21538
- width = _11 === void 0 ? 1 : _11,
21539
- _12 = _10.height,
21540
- height = _12 === void 0 ? 1 : _12;
21541
- var _13 = React.useContext(CameraStateContext),
21542
- cameraRef = _13.cameraRef,
21543
- videoRef = _13.videoRef,
21544
- videoLoaded = _13.videoLoaded,
21545
- cameraReady = _13.cameraReady,
21546
- microphoneReady = _13.microphoneReady,
21547
- audioStream = _13.audioStream,
21548
- setVideoLoaded = _13.setVideoLoaded;
21549
- var _14 = React.useState([]),
21550
- detectedObjects = _14[0],
21551
- setDetectedObjects = _14[1];
21552
- var _15 = React.useState(null),
21553
- face = _15[0],
21554
- setFace = _15[1];
21555
- var _16 = React.useContext(IdCaptureModelsContext),
21556
- idModelsReady = _16.ready,
21557
- startIdModels = _16.start,
21558
- stopIdModels = _16.stop,
21559
- onIdPredictionMade = _16.onPredictionMade,
21560
- setThresholds = _16.setThresholds,
21561
- setDocumentDetectionBoundaries = _16.setDocumentDetectionBoundaries,
21562
- bestFrameDetails = _16.bestFrameDetails,
21563
- resetBestFrame = _16.resetBestFrame,
21564
- idModelError = _16.modelError;
21565
- var _17 = React.useState(null),
21566
- videoStartsAt = _17[0],
21567
- setVideoStartsAt = _17[1];
21568
- var _18 = React.useContext(SubmissionContext),
21569
- setIdCaptureVideoAudioStartsAt = _18.setIdCaptureVideoAudioStartsAt,
21570
- setExpectedAudioText = _18.setExpectedAudioText;
21571
- var _19 = React.useContext(SelfieGuidanceModelsContext),
21572
- startSelfieGuidance = _19.start,
21573
- stopSelfieGuidance = _19.stop,
21574
- onSelfiePredictionMade = _19.onPredictionMade,
21575
- selfieModelError = _19.error;
21576
- var _20 = useVideoRecorder(cameraRef.current, audioStream, mergeAVStreams),
21577
- isRecordingVideo = _20.isRecordingVideo,
21578
- startRecordingVideo = _20.startRecordingVideo,
21579
- startRecordingAudio = _20.startRecordingAudio,
21580
- stopRecordingVideo = _20.stopRecordingVideo,
21581
- stopRecordingAudio = _20.stopRecordingAudio,
21582
- videoRecordingUnintentionallyStopped = _20.videoRecordingUnintentionallyStopped,
21583
- audioRecordingUnintentionallyStopped = _20.audioRecordingUnintentionallyStopped,
21584
- videoUrl = _20.videoUrl,
21585
- audioUrl = _20.audioUrl;
21783
+ _8 = _a.colors,
21784
+ colors = _8 === void 0 ? {} : _8,
21785
+ _9 = _a.verbiage,
21786
+ rawVerbiage = _9 === void 0 ? {} : _9,
21787
+ _10 = _a.debugMode,
21788
+ debugMode = _10 === void 0 ? false : _10;
21789
+ var _11 = useResizeObserver(),
21790
+ ref = _11.ref,
21791
+ _12 = _11.width,
21792
+ width = _12 === void 0 ? 1 : _12,
21793
+ _13 = _11.height,
21794
+ height = _13 === void 0 ? 1 : _13;
21795
+ var _14 = useCameraStore(),
21796
+ camera = _14.camera,
21797
+ videoRef = _14.videoRef,
21798
+ videoLoaded = _14.videoLoaded,
21799
+ cameraReady = _14.cameraReady,
21800
+ microphoneReady = _14.microphoneReady,
21801
+ audioStream = _14.audioStream,
21802
+ isRearFacing = _14.isRearFacing,
21803
+ releaseCameraAccess = _14.releaseCameraAccess;
21804
+ var _15 = React.useState([]),
21805
+ detectedObjects = _15[0],
21806
+ setDetectedObjects = _15[1];
21807
+ var _16 = React.useState(null),
21808
+ face = _16[0],
21809
+ setFace = _16[1];
21810
+ var _17 = React.useContext(IdCaptureModelsContext),
21811
+ idModelsReady = _17.ready,
21812
+ startIdModels = _17.start,
21813
+ stopIdModels = _17.stop,
21814
+ onIdPredictionMade = _17.onPredictionMade,
21815
+ setThresholds = _17.setThresholds,
21816
+ setDocumentDetectionBoundaries = _17.setDocumentDetectionBoundaries,
21817
+ bestFrameDetails = _17.bestFrameDetails,
21818
+ resetBestFrame = _17.resetBestFrame,
21819
+ idModelError = _17.modelError;
21820
+ var _18 = React.useState(null),
21821
+ videoStartsAt = _18[0],
21822
+ setVideoStartsAt = _18[1];
21823
+ var _19 = React.useContext(SubmissionContext),
21824
+ setIdCaptureVideoAudioStartsAt = _19.setIdCaptureVideoAudioStartsAt,
21825
+ setExpectedAudioText = _19.setExpectedAudioText;
21826
+ var _20 = React.useContext(SelfieGuidanceModelsContext),
21827
+ startSelfieGuidance = _20.start,
21828
+ stopSelfieGuidance = _20.stop,
21829
+ onSelfiePredictionMade = _20.onPredictionMade,
21830
+ selfieModelError = _20.error;
21831
+ var _21 = useVideoRecorder(camera, audioStream, mergeAVStreams),
21832
+ isRecordingVideo = _21.isRecordingVideo,
21833
+ startRecordingVideo = _21.startRecordingVideo,
21834
+ startRecordingAudio = _21.startRecordingAudio,
21835
+ stopRecordingVideo = _21.stopRecordingVideo,
21836
+ stopRecordingAudio = _21.stopRecordingAudio,
21837
+ videoRecordingUnintentionallyStopped = _21.videoRecordingUnintentionallyStopped,
21838
+ audioRecordingUnintentionallyStopped = _21.audioRecordingUnintentionallyStopped,
21839
+ videoUrl = _21.videoUrl,
21840
+ audioUrl = _21.audioUrl;
21586
21841
  var countdownTimeoutRef = React.useRef(undefined);
21587
- var _21 = React.useState(-1),
21588
- countdownRemaining = _21[0],
21589
- setCountdownRemaining = _21[1];
21842
+ var _22 = React.useState(-1),
21843
+ countdownRemaining = _22[0],
21844
+ setCountdownRemaining = _22[1];
21590
21845
  React.useEffect(function () {
21591
21846
  if (!isRecordingVideo && !videoUrl) {
21592
21847
  startRecordingVideo();
@@ -21597,18 +21852,18 @@
21597
21852
  var needsAudio = !!readTextPrompt && !mergeAVStreams;
21598
21853
  var audioReady = !needsAudio || audioUrl;
21599
21854
  if (videoUrl && audioReady) {
21600
- setVideoLoaded(false);
21855
+ releaseCameraAccess();
21601
21856
  onComplete === null || onComplete === void 0 ? void 0 : onComplete(videoUrl, audioUrl);
21602
21857
  }
21603
- }, [audioUrl, isRecordingVideo, mergeAVStreams, onComplete, readTextPrompt, setVideoLoaded, startRecordingVideo, videoUrl]);
21858
+ }, [audioUrl, isRecordingVideo, mergeAVStreams, onComplete, readTextPrompt, releaseCameraAccess, startRecordingVideo, videoUrl]);
21604
21859
  React.useEffect(function () {
21605
21860
  if (videoRecordingUnintentionallyStopped || audioRecordingUnintentionallyStopped) {
21606
21861
  onRecordingFailed === null || onRecordingFailed === void 0 ? void 0 : onRecordingFailed();
21607
21862
  }
21608
21863
  }, [audioRecordingUnintentionallyStopped, onRecordingFailed, videoRecordingUnintentionallyStopped]);
21609
- var _22 = React.useState('SHOW_ID_FRONT'),
21610
- requestedAction = _22[0],
21611
- setRequestedAction = _22[1];
21864
+ var _23 = React.useState('SHOW_ID_FRONT'),
21865
+ requestedAction = _23[0],
21866
+ setRequestedAction = _23[1];
21612
21867
  var shouldRunIdModels = idCaptureModelsEnabled && videoLoaded && cameraReady && idModelsReady && !idModelError && requestedAction !== 'READ_TEXT' && (!readTextPrompt || microphoneReady);
21613
21868
  React.useEffect(function startModelsWhenCapturing() {
21614
21869
  if (!shouldRunIdModels) return;
@@ -21628,18 +21883,18 @@
21628
21883
  bottom: 1
21629
21884
  });
21630
21885
  }, [setDocumentDetectionBoundaries]);
21631
- var _23 = React.useState(0),
21632
- currentDetectionScore = _23[0],
21633
- setCurrentDetectionScore = _23[1];
21634
- var _24 = React.useState('none'),
21635
- currentDetectedDocumentType = _24[0],
21636
- setCurrentDetectedDocumentType = _24[1];
21637
- var _25 = React.useState(0),
21638
- currentFocusScore = _25[0],
21639
- setCurrentFocusScore = _25[1];
21886
+ var _24 = React.useState(0),
21887
+ currentDetectionScore = _24[0],
21888
+ setCurrentDetectionScore = _24[1];
21889
+ var _25 = React.useState('none'),
21890
+ currentDetectedDocumentType = _25[0],
21891
+ setCurrentDetectedDocumentType = _25[1];
21640
21892
  var _26 = React.useState(0),
21641
- goodFramesCount = _26[0],
21642
- setGoodFramesCount = _26[1];
21893
+ currentFocusScore = _26[0],
21894
+ setCurrentFocusScore = _26[1];
21895
+ var _27 = React.useState(0),
21896
+ goodFramesCount = _27[0],
21897
+ setGoodFramesCount = _27[1];
21643
21898
  var goodFramesThreshold = requestedAction === 'SHOW_ID_FRONT' ? videoIdCaptureThresholds.goodFrames.idCardFront : videoIdCaptureThresholds.goodFrames.idCardBack;
21644
21899
  var goodFramesThresholdMet = goodFramesCount >= goodFramesThreshold;
21645
21900
  React.useEffect(function () {
@@ -21660,9 +21915,9 @@
21660
21915
  } : 0);
21661
21916
  });
21662
21917
  }, [idCaptureModelsEnabled, onIdPredictionMade, idModelError, requestedAction, videoIdCaptureThresholds.flipShortcutThreshold]);
21663
- var _27 = React.useState(null),
21664
- idFrontCaptureStartedAt = _27[0],
21665
- setFirstGoodFrameTime = _27[1];
21918
+ var _28 = React.useState(null),
21919
+ idFrontCaptureStartedAt = _28[0],
21920
+ setFirstGoodFrameTime = _28[1];
21666
21921
  React.useEffect(function () {
21667
21922
  if (goodFramesCount === 1) setFirstGoodFrameTime(new Date().getTime());
21668
21923
  }, [goodFramesCount]);
@@ -21683,9 +21938,9 @@
21683
21938
  var frameHeight = (_e = (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.videoHeight) !== null && _e !== void 0 ? _e : 0;
21684
21939
  var faceBox = face === null || face === void 0 ? void 0 : face.box;
21685
21940
  var faceCentered = !faceBox || !frameWidth || faceBox.xMin > frameWidth * edgeBoundary && faceBox.yMin > frameHeight * edgeBoundary && faceBox.xMax < frameWidth * (1 - edgeBoundary) && faceBox.yMax < frameHeight * (1 - edgeBoundary);
21686
- var _28 = React.useState(),
21687
- countdownStartedAt = _28[0],
21688
- setCountdownStartedAt = _28[1];
21941
+ var _29 = React.useState(),
21942
+ countdownStartedAt = _29[0],
21943
+ setCountdownStartedAt = _29[1];
21689
21944
  var photoCanvas = React.useRef(null);
21690
21945
  var frameLock = React.useRef(false);
21691
21946
  var captureFrame = React.useCallback(function () {
@@ -21808,9 +22063,9 @@
21808
22063
  stopSelfieGuidance();
21809
22064
  };
21810
22065
  }, [startSelfieGuidance, stopSelfieGuidance]);
21811
- var _29 = React.useState(0),
21812
- numFramesWithoutFaces = _29[0],
21813
- setNumFramesWithoutFaces = _29[1];
22066
+ var _30 = React.useState(0),
22067
+ numFramesWithoutFaces = _30[0],
22068
+ setNumFramesWithoutFaces = _30[1];
21814
22069
  onSelfiePredictionMade(f(React.useCallback(function (_a) {
21815
22070
  var face = _a.face;
21816
22071
  if (selfieModelError) return;
@@ -21826,12 +22081,12 @@
21826
22081
  }
21827
22082
  }, [disableFaceDetectionWhileAudioCapture, disableFaceDetectionWhileAudioCaptureMsDelay, numFramesWithoutFaces, onFaceNotDetected, timeoutStartedAt]);
21828
22083
  var theme = styled.useTheme();
21829
- var _30 = useTranslations(rawVerbiage, {
22084
+ var _31 = useTranslations(rawVerbiage, {
21830
22085
  faceNotCenteredText: 'Please move your face to the center...',
21831
22086
  captureBtnText: 'Capture'
21832
22087
  }),
21833
- captureBtnText = _30.captureBtnText,
21834
- faceNotCenteredText = _30.faceNotCenteredText;
22088
+ captureBtnText = _31.captureBtnText,
22089
+ faceNotCenteredText = _31.faceNotCenteredText;
21835
22090
  var debugScalingDetails = useDebugScalingDetails({
21836
22091
  enabled: debugMode,
21837
22092
  pageWidth: width,
@@ -21856,16 +22111,25 @@
21856
22111
  classNames: classNames.readTextPrompt,
21857
22112
  verbiage: rawVerbiage.readTextPrompt,
21858
22113
  onComplete: stopRecording
21859
- })) : ( /*#__PURE__*/React.createElement(React.Fragment, null, debugMode && capturingId && ( /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ObjectDetectionDebugOverlayDiv, {
21860
- "$flipX": !((_l = cameraRef.current) === null || _l === void 0 ? void 0 : _l.isRearFacing)
22114
+ })) : ( /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IdVideoCaptureGuides, {
22115
+ classNames: classNames.guides,
22116
+ verbiage: rawVerbiage.guides,
22117
+ requestedAction: requestedAction,
22118
+ satisfied: satisfied,
22119
+ idCardGuideStatus: countdownStartedAt ? 'capturing' : 'ready',
22120
+ idCardCaptureProgress: !!countdownStartedAt ? 1 : 0,
22121
+ idCardCaptureGuideImages: idCardCaptureGuideImages,
22122
+ faceGuideBorderColor: satisfied ? colors.guidesSatisfiedColor : colors.guidesUnsatisfiedColor,
22123
+ idCardGuideBorderColor: satisfied ? colors.guidesSatisfiedColor : colors.guidesUnsatisfiedColor
22124
+ }), debugMode && capturingId && ( /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ObjectDetectionDebugOverlayDiv, {
22125
+ "$flipX": !isRearFacing
21861
22126
  }, detectedObjects.map(function (obj, i) {
21862
- var _a;
21863
22127
  return /*#__PURE__*/React.createElement(IdCaptureDetectedObjectDebugBox, {
21864
22128
  key: i,
21865
22129
  obj: obj,
21866
22130
  scaling: debugScalingDetails,
21867
22131
  color: "blue",
21868
- flipX: !((_a = cameraRef.current) === null || _a === void 0 ? void 0 : _a.isRearFacing)
22132
+ flipX: !isRearFacing
21869
22133
  });
21870
22134
  })), /*#__PURE__*/React.createElement(DebugBoundingBoxOverlay, null, face && ( /*#__PURE__*/React.createElement(SelfieCaptureFaceDebugBox, {
21871
22135
  face: face,
@@ -21874,9 +22138,9 @@
21874
22138
  className: classNames.guidanceMessageContainer
21875
22139
  }, /*#__PURE__*/React.createElement(GuidanceMessage, {
21876
22140
  className: classNames.guidanceMessage,
21877
- "$background": (_p = (_o = (_m = theme.guidanceMessages) === null || _m === void 0 ? void 0 : _m.negative) === null || _o === void 0 ? void 0 : _o.backgroundColor) !== null && _p !== void 0 ? _p : 'red',
21878
- "$textColor": (_s = (_r = (_q = theme.guidanceMessages) === null || _q === void 0 ? void 0 : _q.negative) === null || _r === void 0 ? void 0 : _r.textColor) !== null && _s !== void 0 ? _s : 'white'
21879
- }, guidanceText))), debugMode && ( /*#__PURE__*/React.createElement(DebugStatsPane, null, cameraRef.current ? ( /*#__PURE__*/React.createElement(React.Fragment, null, "\u2705 Camera: ", cameraRef.current.label, " (", cameraRef.current.width, "x", cameraRef.current.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React.createElement("br", null), isRecordingVideo ? '✅ Recording' : '❌ Not recording', /*#__PURE__*/React.createElement("br", null), goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', goodFramesCount, "/", goodFramesThreshold, /*#__PURE__*/React.createElement("br", null), "Document Type: ", currentDetectedDocumentType, /*#__PURE__*/React.createElement("br", null), "Detection Score: ", currentDetectionScore, /*#__PURE__*/React.createElement("br", null), "Focus Score: ", currentFocusScore, /*#__PURE__*/React.createElement("br", null), "Best Frame Detection Score:", ' ', (_u = (_t = bestFrameDetails.current) === null || _t === void 0 ? void 0 : _t.detectionScore) !== null && _u !== void 0 ? _u : 0, /*#__PURE__*/React.createElement("br", null), "Best Frame Focus Score: ", (_w = (_v = bestFrameDetails.current) === null || _v === void 0 ? void 0 : _v.focusScore) !== null && _w !== void 0 ? _w : 0)), countdownRemaining > 0 && capturingId && ( /*#__PURE__*/React.createElement(CountdownContainer, {
22141
+ "$background": (_o = (_m = (_l = theme.guidanceMessages) === null || _l === void 0 ? void 0 : _l.negative) === null || _m === void 0 ? void 0 : _m.backgroundColor) !== null && _o !== void 0 ? _o : 'red',
22142
+ "$textColor": (_r = (_q = (_p = theme.guidanceMessages) === null || _p === void 0 ? void 0 : _p.negative) === null || _q === void 0 ? void 0 : _q.textColor) !== null && _r !== void 0 ? _r : 'white'
22143
+ }, guidanceText))), debugMode && ( /*#__PURE__*/React.createElement(DebugStatsPane, null, camera ? ( /*#__PURE__*/React.createElement(React.Fragment, null, "\u2705 Camera: ", camera.label, " (", camera.width, "x", camera.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React.createElement("br", null), isRecordingVideo ? '✅ Recording' : '❌ Not recording', /*#__PURE__*/React.createElement("br", null), goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', goodFramesCount, "/", goodFramesThreshold, /*#__PURE__*/React.createElement("br", null), "Document Type: ", currentDetectedDocumentType, /*#__PURE__*/React.createElement("br", null), "Detection Score: ", currentDetectionScore, /*#__PURE__*/React.createElement("br", null), "Focus Score: ", currentFocusScore, /*#__PURE__*/React.createElement("br", null), "Best Frame Detection Score:", ' ', (_t = (_s = bestFrameDetails.current) === null || _s === void 0 ? void 0 : _s.detectionScore) !== null && _t !== void 0 ? _t : 0, /*#__PURE__*/React.createElement("br", null), "Best Frame Focus Score: ", (_v = (_u = bestFrameDetails.current) === null || _u === void 0 ? void 0 : _u.focusScore) !== null && _v !== void 0 ? _v : 0)), countdownRemaining > 0 && capturingId && ( /*#__PURE__*/React.createElement(CountdownContainer, {
21880
22144
  className: classNames.countdownContainer
21881
22145
  }, /*#__PURE__*/React.createElement(Countdown, {
21882
22146
  className: classNames.countdown
@@ -22156,42 +22420,31 @@
22156
22420
  onExitCapture === null || onExitCapture === void 0 ? void 0 : onExitCapture();
22157
22421
  }, [onExitCapture]);
22158
22422
  var faceLivenessGuides = React.useCallback(function (_a) {
22159
- return null;
22160
- },
22161
- // <IdVideoCaptureGuides
22162
- // idCardCaptureGuideImages={idCaptureGuideImages}
22163
- // classNames={classNames.idVideoCapture?.guides}
22164
- // verbiage={verbiage.idVideoCapture?.guides}
22165
- // requestedAction="VERIFY_LIVENESS"
22166
- // faceGuideStatus={status}
22167
- // faceGuideBorderColor={
22168
- // status === 'success'
22169
- // ? colors.idVideoCapture?.guidesSatisfiedColor
22170
- // : colors.idVideoCapture?.guidesUnsatisfiedColor
22171
- // }
22172
- // idCardGuideStatus="disabled"
22173
- // // idCardGuideBorderColor={
22174
- // // status === 'success'
22175
- // // ? colors.idVideoCapture?.guidesSatisfiedColor
22176
- // // : colors.idVideoCapture?.guidesUnsatisfiedColor
22177
- // // }
22178
- // />
22179
- [(_b = classNames.idVideoCapture) === null || _b === void 0 ? void 0 : _b.guides, (_c = colors.idVideoCapture) === null || _c === void 0 ? void 0 : _c.guidesSatisfiedColor, (_d = colors.idVideoCapture) === null || _d === void 0 ? void 0 : _d.guidesUnsatisfiedColor, idCaptureGuideImages, (_e = verbiage.idVideoCapture) === null || _e === void 0 ? void 0 : _e.guides]);
22423
+ var _b, _c, _d, _e;
22424
+ var status = _a.status;
22425
+ return /*#__PURE__*/React.createElement(IdVideoCaptureGuides, {
22426
+ idCardCaptureGuideImages: idCaptureGuideImages,
22427
+ classNames: (_b = classNames.idVideoCapture) === null || _b === void 0 ? void 0 : _b.guides,
22428
+ verbiage: (_c = verbiage.idVideoCapture) === null || _c === void 0 ? void 0 : _c.guides,
22429
+ requestedAction: "VERIFY_LIVENESS",
22430
+ faceGuideStatus: status,
22431
+ faceGuideBorderColor: status === 'success' ? (_d = colors.idVideoCapture) === null || _d === void 0 ? void 0 : _d.guidesSatisfiedColor : (_e = colors.idVideoCapture) === null || _e === void 0 ? void 0 : _e.guidesUnsatisfiedColor,
22432
+ idCardGuideStatus: "disabled"
22433
+ });
22434
+ }, [(_b = classNames.idVideoCapture) === null || _b === void 0 ? void 0 : _b.guides, (_c = colors.idVideoCapture) === null || _c === void 0 ? void 0 : _c.guidesSatisfiedColor, (_d = colors.idVideoCapture) === null || _d === void 0 ? void 0 : _d.guidesUnsatisfiedColor, idCaptureGuideImages, (_e = verbiage.idVideoCapture) === null || _e === void 0 ? void 0 : _e.guides]);
22180
22435
  if (submissionStatus === SubmissionStatus.SUBMITTING) {
22181
22436
  return /*#__PURE__*/React.createElement(PageContainer, {
22182
22437
  className: "flex"
22183
22438
  }, /*#__PURE__*/React.createElement(Spinner$1, null));
22184
22439
  }
22185
- return /*#__PURE__*/React.createElement(CameraProvider, {
22186
- key: "".concat(isCapturingId ? 'id' : 'selfie', "-camera-").concat(attempt),
22187
- preferContinuityCamera: isCapturingId,
22440
+ return /*#__PURE__*/React.createElement(CameraStoreProvider, {
22441
+ preferIphoneContinuityCamera: isCapturingId,
22188
22442
  preferFrontFacingCamera: !isCapturingId,
22189
22443
  requireMicrophoneAccess: !isCapturingId && !!readTextPrompt,
22190
22444
  maxVideoWidth: isCapturingId ? 1920 : 1280,
22191
22445
  maxFps: isCapturingId ? 60 : 30,
22192
22446
  onCameraAccessDenied: onCameraAccessDenied,
22193
- onMicrophoneAccessDenied: onMicrophoneAccessDenied,
22194
- debugMode: debugMode
22447
+ onMicrophoneAccessDenied: onMicrophoneAccessDenied
22195
22448
  }, /*#__PURE__*/React.createElement(IdCaptureModelsProvider, {
22196
22449
  autoStart: false,
22197
22450
  documentDetectionModelUrl: (_g = (_f = idCaptureProps.assets) === null || _f === void 0 ? void 0 : _f.documentDetectionModelUrl) !== null && _g !== void 0 ? _g : '',
@@ -22317,17 +22570,15 @@
22317
22570
  _o = _a.captureSignatureVideo,
22318
22571
  captureSignatureVideo = _o === void 0 ? false : _o,
22319
22572
  onCameraAccessDenied = _a.onCameraAccessDenied,
22320
- onMicrophoneAccessDenied = _a.onMicrophoneAccessDenied,
22321
- _p = _a.debugMode,
22322
- debugMode = _p === void 0 ? false : _p;
22323
- var _q = React.useContext(SubmissionContext),
22324
- submit = _q.submit,
22325
- submissionStatus = _q.submissionStatus,
22326
- setSignatureData = _q.setSignatureData,
22327
- setAdditionalDocuments = _q.setAdditionalDocuments;
22328
- var _r = React.useState(0),
22329
- checkIndex = _r[0],
22330
- setCheckIndex = _r[1];
22573
+ onMicrophoneAccessDenied = _a.onMicrophoneAccessDenied;
22574
+ var _p = React.useContext(SubmissionContext),
22575
+ submit = _p.submit,
22576
+ submissionStatus = _p.submissionStatus,
22577
+ setSignatureData = _p.setSignatureData,
22578
+ setAdditionalDocuments = _p.setAdditionalDocuments;
22579
+ var _q = React.useState(0),
22580
+ checkIndex = _q[0],
22581
+ setCheckIndex = _q[1];
22331
22582
  var checks = React.useMemo(function () {
22332
22583
  var _a, _b;
22333
22584
  var checks = __spreadArray([], userChecks, true);
@@ -22405,16 +22656,6 @@
22405
22656
  return i + 1;
22406
22657
  });
22407
22658
  }, [onVideoSignatureCompleteProp]);
22408
- var _s = React.useState(0),
22409
- videoSignatureAttempts = _s[0],
22410
- setVideoSignatureAttempts = _s[1];
22411
- var onVideoSignatureRetryProp = videoSignatureCaptureProps.onRetryClicked;
22412
- var onVideoSignatureRetry = React.useCallback(function () {
22413
- onVideoSignatureRetryProp === null || onVideoSignatureRetryProp === void 0 ? void 0 : onVideoSignatureRetryProp();
22414
- setVideoSignatureAttempts(function (n) {
22415
- return n + 1;
22416
- });
22417
- }, [onVideoSignatureRetryProp]);
22418
22659
  var onAdditionalDocumentCaptureCompleteProp = additionalDocumentCaptureProps === null || additionalDocumentCaptureProps === void 0 ? void 0 : additionalDocumentCaptureProps.onComplete;
22419
22660
  var onAdditionalDocumentCaptureComplete = React.useCallback(function (uploadedDocuments) {
22420
22661
  setAdditionalDocuments(uploadedDocuments);
@@ -22443,11 +22684,9 @@
22443
22684
  }
22444
22685
  switch (checks[checkIndex]) {
22445
22686
  case 'IdCapture':
22446
- return /*#__PURE__*/React.createElement(CameraProvider, {
22447
- key: "IdCaptureCamera",
22687
+ return /*#__PURE__*/React.createElement(CameraStoreProvider, {
22448
22688
  onCameraAccessDenied: onCameraAccessDenied,
22449
- onMicrophoneAccessDenied: onMicrophoneAccessDenied,
22450
- debugMode: debugMode
22689
+ onMicrophoneAccessDenied: onMicrophoneAccessDenied
22451
22690
  }, /*#__PURE__*/React.createElement(IdCaptureModelsProvider, {
22452
22691
  autoStart: false,
22453
22692
  documentDetectionModelUrl: (_d = (_c = idCaptureProps.assets) === null || _c === void 0 ? void 0 : _c.documentDetectionModelUrl) !== null && _d !== void 0 ? _d : '',
@@ -22464,13 +22703,11 @@
22464
22703
  onMicrophoneAccessDenied: onMicrophoneAccessDenied
22465
22704
  }));
22466
22705
  case 'FaceLiveness':
22467
- return /*#__PURE__*/React.createElement(CameraProvider, {
22468
- key: "FaceLivenessCamera",
22706
+ return /*#__PURE__*/React.createElement(CameraStoreProvider, {
22469
22707
  preferFrontFacingCamera: true,
22470
- preferContinuityCamera: false,
22708
+ preferIphoneContinuityCamera: false,
22471
22709
  onCameraAccessDenied: onCameraAccessDenied,
22472
- onMicrophoneAccessDenied: onMicrophoneAccessDenied,
22473
- debugMode: debugMode
22710
+ onMicrophoneAccessDenied: onMicrophoneAccessDenied
22474
22711
  }, /*#__PURE__*/React.createElement(SelfieGuidanceModelsProvider, {
22475
22712
  autoStart: false,
22476
22713
  onModelError: faceLivenessProps.onModelError,
@@ -22483,15 +22720,13 @@
22483
22720
  onAccept: onSignatureCaptureSuccess
22484
22721
  }));
22485
22722
  case 'VideoSignatureCapture':
22486
- return /*#__PURE__*/React.createElement(CameraProvider, {
22487
- key: "SignatureKycCamera-".concat(videoSignatureAttempts),
22488
- preferContinuityCamera: false,
22723
+ return /*#__PURE__*/React.createElement(CameraStoreProvider, {
22724
+ preferIphoneContinuityCamera: false,
22489
22725
  preferFrontFacingCamera: true,
22490
22726
  maxVideoWidth: 1280,
22491
22727
  maxFps: 30,
22492
22728
  onCameraAccessDenied: onCameraAccessDenied,
22493
- onMicrophoneAccessDenied: onMicrophoneAccessDenied,
22494
- debugMode: debugMode
22729
+ onMicrophoneAccessDenied: onMicrophoneAccessDenied
22495
22730
  }, /*#__PURE__*/React.createElement(SelfieGuidanceModelsProvider, {
22496
22731
  autoStart: false,
22497
22732
  throttleMs: 250,
@@ -22499,8 +22734,7 @@
22499
22734
  modelLoadTimeoutMs: videoSignatureCaptureProps.modelLoadTimeoutMs,
22500
22735
  requireVerticalFaceCentering: false
22501
22736
  }, /*#__PURE__*/React.createElement(VideoSignatureWizard, _assign({}, videoSignatureCaptureProps, {
22502
- onComplete: onVideoSignatureComplete,
22503
- onRetryClicked: onVideoSignatureRetry
22737
+ onComplete: onVideoSignatureComplete
22504
22738
  }))));
22505
22739
  case 'AdditionalDocumentCapture':
22506
22740
  return /*#__PURE__*/React.createElement(AdditionalDocumentCaptureWizard, _assign({}, additionalDocumentCaptureProps, {
@@ -22951,8 +23185,7 @@
22951
23185
  videoSignatureCaptureProps: videoSignatureCaptureProps,
22952
23186
  captureSignature: captureSignature,
22953
23187
  captureSignatureVideo: captureSignatureVideo,
22954
- onCameraAccessDenied: onCameraAccessDenied,
22955
- debugMode: debugMode
23188
+ onCameraAccessDenied: onCameraAccessDenied
22956
23189
  }))));
22957
23190
  };
22958
23191
 
@@ -23058,8 +23291,7 @@
23058
23291
  return ['FaceLiveness'];
23059
23292
  }, []),
23060
23293
  faceLivenessProps: faceLivenessProps,
23061
- onCameraAccessDenied: onCameraAccessDenied,
23062
- debugMode: debugMode
23294
+ onCameraAccessDenied: onCameraAccessDenied
23063
23295
  }))));
23064
23296
  };
23065
23297
 
@@ -23292,8 +23524,7 @@
23292
23524
  additionalDocumentCaptureProps: additionalDocumentCaptureProps,
23293
23525
  captureSignature: captureSignature,
23294
23526
  captureSignatureVideo: captureSignatureVideo,
23295
- onCameraAccessDenied: onCameraAccessDenied,
23296
- debugMode: debugMode
23527
+ onCameraAccessDenied: onCameraAccessDenied
23297
23528
  }))));
23298
23529
  };
23299
23530
 
@@ -23548,8 +23779,7 @@
23548
23779
  videoSignatureCaptureProps: videoSignatureCaptureProps,
23549
23780
  captureSignature: captureSignature,
23550
23781
  captureSignatureVideo: captureSignatureVideo,
23551
- onCameraAccessDenied: onCameraAccessDenied,
23552
- debugMode: debugMode
23782
+ onCameraAccessDenied: onCameraAccessDenied
23553
23783
  }))));
23554
23784
  };
23555
23785
 
@@ -23881,7 +24111,7 @@
23881
24111
  var _l = React.useState('LOADING'),
23882
24112
  captureState = _l[0],
23883
24113
  setCaptureState = _l[1];
23884
- var _m = React.useContext(CameraStateContext),
24114
+ var _m = useCameraStore(),
23885
24115
  cameraAccessDenied = _m.cameraAccessDenied,
23886
24116
  releaseCameraAccess = _m.releaseCameraAccess;
23887
24117
  var _o = React.useContext(SelfieGuidanceModelsContext),
@@ -24087,10 +24317,9 @@
24087
24317
  onSubmit: onSubmit,
24088
24318
  geolocationEnabled: geolocationEnabled,
24089
24319
  geolocationRequired: geolocationRequired
24090
- }, /*#__PURE__*/React.createElement(CameraProvider, {
24320
+ }, /*#__PURE__*/React.createElement(CameraStoreProvider, {
24091
24321
  preferFrontFacingCamera: true,
24092
- onCameraAccessDenied: onCameraAccessDenied,
24093
- debugMode: debugMode
24322
+ onCameraAccessDenied: onCameraAccessDenied
24094
24323
  }, /*#__PURE__*/React.createElement(SelfieGuidanceModelsProvider, {
24095
24324
  autoStart: false,
24096
24325
  onModelError: onModelError,
@@ -24439,7 +24668,7 @@
24439
24668
  var _l = React.useState('LOADING'),
24440
24669
  captureState = _l[0],
24441
24670
  setCaptureState = _l[1];
24442
- var _m = React.useContext(CameraStateContext),
24671
+ var _m = useCameraStore(),
24443
24672
  cameraAccessDenied = _m.cameraAccessDenied,
24444
24673
  releaseCameraAccess = _m.releaseCameraAccess;
24445
24674
  var _o = React.useContext(SelfieGuidanceModelsContext),
@@ -24643,10 +24872,9 @@
24643
24872
  onSubmit: onSubmit,
24644
24873
  geolocationEnabled: geolocationEnabled,
24645
24874
  geolocationRequired: geolocationRequired
24646
- }, /*#__PURE__*/React.createElement(CameraProvider, {
24875
+ }, /*#__PURE__*/React.createElement(CameraStoreProvider, {
24647
24876
  preferFrontFacingCamera: true,
24648
- onCameraAccessDenied: onCameraAccessDenied,
24649
- debugMode: debugMode
24877
+ onCameraAccessDenied: onCameraAccessDenied
24650
24878
  }, /*#__PURE__*/React.createElement(SelfieGuidanceModelsProvider, {
24651
24879
  autoStart: false,
24652
24880
  modelLoadTimeoutMs: modelLoadTimeoutMs,
@@ -24973,8 +25201,7 @@
24973
25201
  captureSignature: captureSignature,
24974
25202
  captureSignatureVideo: captureSignatureVideo,
24975
25203
  onCameraAccessDenied: onCameraAccessDenied,
24976
- onMicrophoneAccessDenied: onMicrophoneAccessDenied,
24977
- debugMode: debugMode
25204
+ onMicrophoneAccessDenied: onMicrophoneAccessDenied
24978
25205
  }))));
24979
25206
  };
24980
25207
 
@@ -25131,8 +25358,7 @@
25131
25358
  videoSignatureCaptureProps: videoSignatureCaptureProps,
25132
25359
  captureSignature: captureSignature,
25133
25360
  captureSignatureVideo: captureSignatureVideo,
25134
- onCameraAccessDenied: onCameraAccessDenied,
25135
- debugMode: debugMode
25361
+ onCameraAccessDenied: onCameraAccessDenied
25136
25362
  }))));
25137
25363
  };
25138
25364
 
@@ -25190,11 +25416,10 @@
25190
25416
  onDocumentUploadFailed: onDocumentUploadFailed,
25191
25417
  geolocationEnabled: geolocationEnabled,
25192
25418
  geolocationRequired: geolocationRequired
25193
- }, /*#__PURE__*/React.createElement(CameraProvider, {
25419
+ }, /*#__PURE__*/React.createElement(CameraStoreProvider, {
25194
25420
  requestAccessAutomatically: false,
25195
- preferContinuityCamera: true,
25196
- onCameraAccessDenied: onCameraAccessDenied,
25197
- debugMode: debugMode
25421
+ preferIphoneContinuityCamera: true,
25422
+ onCameraAccessDenied: onCameraAccessDenied
25198
25423
  }, /*#__PURE__*/React.createElement(DocumentCaptureWizard, {
25199
25424
  onSuccess: onComplete,
25200
25425
  onExitCapture: onExitCapture,