@scandit/web-datacapture-id 7.0.0-beta.1

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 (87) hide show
  1. package/LICENSE +4 -0
  2. package/README.md +3 -0
  3. package/THIRD-PARTY.txt +73 -0
  4. package/build/js/AamvaBarcodeVerifier.d.ts +9 -0
  5. package/build/js/AamvaBarcodeVerifierResult.d.ts +6 -0
  6. package/build/js/Defaults.d.ts +51 -0
  7. package/build/js/Enums.d.ts +59 -0
  8. package/build/js/IdCapture.d.ts +104 -0
  9. package/build/js/IdCaptureError.d.ts +15 -0
  10. package/build/js/IdCaptureFeedback.d.ts +15 -0
  11. package/build/js/IdCaptureOverlay.d.ts +85 -0
  12. package/build/js/IdCaptureSettings.d.ts +33 -0
  13. package/build/js/Listener.d.ts +9 -0
  14. package/build/js/Region.d.ts +254 -0
  15. package/build/js/RejectionReason.d.ts +7 -0
  16. package/build/js/SerializedTypes.d.ts +263 -0
  17. package/build/js/assets/idCaptureAssets.d.ts +1 -0
  18. package/build/js/captured-id/BarcodeResult.d.ts +94 -0
  19. package/build/js/captured-id/CapturedId.d.ts +50 -0
  20. package/build/js/captured-id/DateResult.d.ts +10 -0
  21. package/build/js/captured-id/DrivingLicenseCategory.d.ts +11 -0
  22. package/build/js/captured-id/DrivingLicenseDetails.d.ts +11 -0
  23. package/build/js/captured-id/IdImages.d.ts +14 -0
  24. package/build/js/captured-id/LocalizedOnlyId.d.ts +9 -0
  25. package/build/js/captured-id/MRZResult.d.ts +22 -0
  26. package/build/js/captured-id/ProfessionalDrivingPermit.d.ts +10 -0
  27. package/build/js/captured-id/VIZResult.d.ts +36 -0
  28. package/build/js/captured-id/VehicleRestriction.d.ts +11 -0
  29. package/build/js/document/DriverLicense.d.ts +11 -0
  30. package/build/js/document/HealthInsuranceCard.d.ts +11 -0
  31. package/build/js/document/IdCaptureDocument.d.ts +28 -0
  32. package/build/js/document/IdCard.d.ts +11 -0
  33. package/build/js/document/Passport.d.ts +11 -0
  34. package/build/js/document/RegionSpecific.d.ts +14 -0
  35. package/build/js/document/RegionSpecificSubtype.d.ts +66 -0
  36. package/build/js/document/ResidencePermit.d.ts +11 -0
  37. package/build/js/document/VisaIcao.d.ts +11 -0
  38. package/build/js/index.d.ts +51 -0
  39. package/build/js/index.js +12 -0
  40. package/build/js/scandit-web-datacapture-id-private.d.ts +5 -0
  41. package/build/js/scanner/FullDocumentScanner.d.ts +14 -0
  42. package/build/js/scanner/Scanner.d.ts +9 -0
  43. package/build/js/scanner/SingleSideScanner.d.ts +20 -0
  44. package/build/js/translations.d.ts +10 -0
  45. package/build/js/worker/IdCaptureWorkerManager.d.ts +20 -0
  46. package/build/js/worker/WorkerMain.d.ts +9 -0
  47. package/build/js/worker/dataCapture.inlineWorker.d.ts +3 -0
  48. package/build/js/worker/dataCaptureEngine.d.ts +86 -0
  49. package/build/js/worker/dataCaptureWorkerRelated.d.ts +305 -0
  50. package/build/js/worker/index.d.ts +1 -0
  51. package/package.json +116 -0
  52. package/sdc-lib/idcapture/Centaurus.worker.min.js +1 -0
  53. package/sdc-lib/idcapture/lightweight/advanced/Centaurus.data +0 -0
  54. package/sdc-lib/idcapture/lightweight/advanced/Centaurus.js +1 -0
  55. package/sdc-lib/idcapture/lightweight/advanced/Centaurus.wasm +0 -0
  56. package/sdc-lib/idcapture/lightweight/advanced-threads/Centaurus.data +0 -0
  57. package/sdc-lib/idcapture/lightweight/advanced-threads/Centaurus.js +1 -0
  58. package/sdc-lib/idcapture/lightweight/advanced-threads/Centaurus.wasm +0 -0
  59. package/sdc-lib/idcapture/lightweight/advanced-threads/Centaurus.worker.js +1 -0
  60. package/sdc-lib/idcapture/lightweight/basic/Centaurus.data +0 -0
  61. package/sdc-lib/idcapture/lightweight/basic/Centaurus.js +1 -0
  62. package/sdc-lib/idcapture/lightweight/basic/Centaurus.wasm +0 -0
  63. package/sdc-lib/resources/models/barcode_classification_default_model.5ed1ecfaacbd108767a80013d11d9af73b8e1d5e.model +0 -0
  64. package/sdc-lib/resources/models/barcode_localization_default_model.f88251f1bff0c68526d9898ef4c8f3b411c3c59e.model +0 -0
  65. package/sdc-lib/resources/models/barcode_localization_dpm_default_model.acd01c12893d98af3a7e472200dbce4afd57631d.model +0 -0
  66. package/sdc-lib/resources/models/barcode_localization_french_post_default_model.e1d7ffb4d1fb636b1c267d2da0ad6003584e668d.model +0 -0
  67. package/sdc-lib/resources/models/barcode_localization_generic_postal_code_default_model.7852c9b58cc2d253466ca3ea60bbd02ca09533ca.model +0 -0
  68. package/sdc-lib/resources/models/barcode_localization_oned_default_model.058a356e6c57475ec928de2f95440aefa46ed5fe.model +0 -0
  69. package/sdc-lib/resources/models/barcode_localization_twod_default_model.54c8ddfd8620c8b508f4108fcba6529ce45f8440.model +0 -0
  70. package/sdc-lib/resources/models/barcode_localization_upu_enhanced_orange.656bffc22efe3137515d791184b1aa471d439310.model +0 -0
  71. package/sdc-lib/resources/models/eu_dl_localization_model.579be0f8cae6c931b93e199d1afec3b61542474c.model +0 -0
  72. package/sdc-lib/resources/models/id_ocr_model.f5b3ffba2d21fa97fa4945f0bb0c1cff9651c677.model +0 -0
  73. package/sdc-lib/resources/models/invalidated_id_classification_default.1f8f6e0345ece7d50a7126f2e5d15aa6b2e2a9bf.model +0 -0
  74. package/sdc-lib/resources/models/mrz_line_localization_model.98a5b38e889546c69f1d43beeda91071ad132340.model +0 -0
  75. package/sdc-lib/resources/models/mrz_localization_model.87d7e0dacb3845548449cc8ccb78526d93212cff.model +0 -0
  76. package/sdc-lib/resources/models/ocr_mrz_default_model.e0dd4c48916ff4ee266439f87cc68eb1793093c3.model +0 -0
  77. package/sdc-lib/resources/models/uk_dl_code_localization_model.579be0f8cae6c931b93e199d1afec3b61542474c.model +0 -0
  78. package/sdc-lib/scandit-datacapture-sdk-id-pthreads.js +1 -0
  79. package/sdc-lib/scandit-datacapture-sdk-id-pthreads.wasm +0 -0
  80. package/sdc-lib/scandit-datacapture-sdk-id-pthreads.worker.js +1 -0
  81. package/sdc-lib/scandit-datacapture-sdk-id-simd-pthreads.js +1 -0
  82. package/sdc-lib/scandit-datacapture-sdk-id-simd-pthreads.wasm +0 -0
  83. package/sdc-lib/scandit-datacapture-sdk-id-simd-pthreads.worker.js +1 -0
  84. package/sdc-lib/scandit-datacapture-sdk-id-simd.js +1 -0
  85. package/sdc-lib/scandit-datacapture-sdk-id-simd.wasm +0 -0
  86. package/sdc-lib/scandit-datacapture-sdk-id.js +1 -0
  87. package/sdc-lib/scandit-datacapture-sdk-id.wasm +0 -0
@@ -0,0 +1,86 @@
1
+ import type { UpdateContextParameters, CaptureModeDeserializerInstance, ModuleHandler, Vector, WorkerFunctions as BaseWorkerFunctions, ProcessFrameParameters } from "@scandit/web-datacapture-core/build/js/worker/index";
2
+ import { DataCaptureEngine as CoreDataCaptureEngine } from "@scandit/web-datacapture-core/build/js/worker/index.js";
3
+ import type { CapturedIdJSONWithoutCommonFieldsJSON, DataCaptureCallbackMessage, EngineWorkerResponse, IdCaptureSessionHolder, Module, ParseResult, WasmCaptureId } from "./dataCaptureWorkerRelated";
4
+ import type { IdCaptureSettingsJSON } from "../IdCaptureSettings";
5
+ import type { AamvaBarcodeVerificationResultJSON, CapturedIdJSON, CapturedIdJSONWithRawImageInfo, IdCaptureSessionJSON } from "../SerializedTypes";
6
+ export interface WorkerFunctions extends BaseWorkerFunctions {
7
+ postMessage: (message: DataCaptureCallbackMessage, transfer?: Transferable[]) => void;
8
+ }
9
+ /**
10
+ * DataCaptureEngine is an abstraction of the engine, it is created by the engine worker
11
+ * and should be used as a singleton. It calls the underlying engine methods directly.
12
+ */
13
+ export declare class DataCaptureEngine extends CoreDataCaptureEngine<Module> {
14
+ protected idCaptureMode: IdCaptureMode;
15
+ protected workerFunctions: WorkerFunctions;
16
+ protected lastIdCaptureModeSerializedSettings: string;
17
+ constructor(moduleHandler: ModuleHandler<Module>, workerFunctions: WorkerFunctions);
18
+ processFrame(parameters: ProcessFrameParameters): EngineWorkerResponse<"processFrame">;
19
+ updateContext(contextUpdateParameters: UpdateContextParameters): EngineWorkerResponse<"updateContext">;
20
+ idCaptureSetLastResult(result: string): void;
21
+ idCaptureSetLastError(error: string): void;
22
+ idCaptureSetLastLocalizedId(localizedId: string): void;
23
+ idCaptureSetLastDetectionIssue(issue: string): void;
24
+ idCaptureReset(): Promise<void>;
25
+ idCaptureApplySettings(settings: IdCaptureSettingsJSON): Promise<void>;
26
+ idCaptureParse(code: string): Promise<EngineWorkerResponse<"idCaptureParse">>;
27
+ idCaptureBarcodeVerifyAamvaCapture(capturedId: CapturedIdJSON): Promise<EngineWorkerResponse<"idCaptureBarcodeVerifyAamvaCapture">>;
28
+ idCaptureDrivingLicenseDetailsCreateWithBlinkIdData(vehicleClass: string, restrictions: string, endorsements: string): EngineWorkerResponse<"idCaptureDrivingLicenseDetailsCreateWithBlinkIdData">;
29
+ getIdOpenSourceSoftwareLicenseInfo(): EngineWorkerResponse<"getIdOpenSourceSoftwareLicenseInfo">;
30
+ getModeDeserializers(): Vector;
31
+ protected getWasmSideModuleFileName(): string;
32
+ protected getWasmCoreFileName(simdSupport: boolean, webassemblyMultithreadingSupport: boolean): string;
33
+ protected getWasmCoreExpectedHash(simdSupport: boolean, webassemblyMultithreadingSupport: boolean): string;
34
+ protected getWasmMetadata(): Record<string, {
35
+ bytes: number;
36
+ }>;
37
+ }
38
+ type IdCaptureModeState = "created" | "disposed" | "initial" | "started";
39
+ export declare class IdCaptureMode {
40
+ private idCaptureDeserializer;
41
+ private SDCIdCaptureMode;
42
+ private listenerSet;
43
+ private lastResult;
44
+ private lastError;
45
+ private lastLocalizedId;
46
+ private lastDetectionIssue;
47
+ private readonly coreEngine;
48
+ private readonly Module;
49
+ private readonly workerFunctions;
50
+ private _state;
51
+ constructor(coreEngine: DataCaptureEngine, Module: Module, workerFunctions: WorkerFunctions);
52
+ get state(): IdCaptureModeState;
53
+ private set state(value);
54
+ isReadyToProcessFrame(): boolean;
55
+ setLastResult(result: string): void;
56
+ setLastError(error: string): void;
57
+ setLastLocalizedId(localizedId: string): void;
58
+ setLastDetectionIssue(issue: string): void;
59
+ applySettings(settings: IdCaptureSettingsJSON): Promise<void>;
60
+ reset(): void;
61
+ parse(code: string): ParseResult | null;
62
+ idCaptureBarcodeVerifyAamvaCapture(capturedId: CapturedIdJSON): Promise<AamvaBarcodeVerificationResultJSON & {
63
+ error: string;
64
+ serverResponseJSON: string;
65
+ isSuccess: boolean;
66
+ }>;
67
+ start(): void;
68
+ onResetFromSDC(): void;
69
+ setDetectionOnlyMode(detectionOnlyMode: boolean): void;
70
+ onIdCapturedCallback(capturedId: WasmCaptureId): void;
71
+ onIdRejectedCallback(capturedId: WasmCaptureId, rejectionReason: string): void;
72
+ extractCaptureId(wasmCapturedId: WasmCaptureId | null): CapturedIdJSONWithRawImageInfo | null;
73
+ onShutterButtonPositionChangedCallback(position: string): void;
74
+ onShutterButtonStateChangedCallback(state: string): void;
75
+ /**
76
+ * The session holder contains everything except the common fields for the captured id, which have to be
77
+ * gathered manually.
78
+ */
79
+ parseIdCaptureSession(session: IdCaptureSessionHolder): Omit<IdCaptureSessionJSON, keyof CapturedIdJSONWithoutCommonFieldsJSON>;
80
+ getDeserializer(): CaptureModeDeserializerInstance;
81
+ dispose(): void;
82
+ restart(): void;
83
+ private isReadyToDisplayHints;
84
+ private initHintPresenterIfNotInitialized;
85
+ }
86
+ export {};
@@ -0,0 +1,305 @@
1
+ import type { Prettify, Rect } from "@scandit/web-datacapture-core";
2
+ import type { AnyDataCaptureActionMessage as CoreAnyDataCaptureActionMessage, CaptureModeDeserializerInstance, DataCaptureActionMessageKey as CoreDataCaptureActionMessageKey, DataCaptureCallbackMessage as CoreDataCaptureCallbackMessage, DataCaptureCallbackMessageKeys as CoreDataCaptureCallbackMessageKeys, EmscriptenClassHandle, Module as CoreModule, WorkerResponse as CoreWorkerResponse } from "@scandit/web-datacapture-core/build/js/worker/index";
3
+ import type { IdCaptureSettingsJSON } from "../IdCaptureSettings";
4
+ import type { CapturedIdCommonFieldsJSON, AamvaBarcodeVerificationResultJSON, CapturedIdJSON, DrivingLicenseDetailsJSON, CapturedIdJSONWithRawImageInfo } from "../SerializedTypes";
5
+ import type { ShutterButtonState } from "scandit-web-datacapture-id-private";
6
+ /**
7
+ * MESSAGES (ACTIONS) SENT TO THE WORKER
8
+ */
9
+ export type DataCaptureActionMessageKey = CoreDataCaptureActionMessageKey | "idCaptureApplySettings" | "idCaptureBarcodeVerifyAamvaCapture" | "idCaptureParse" | "idCaptureReset" | "idCaptureSetLastDetectionIssue" | "idCaptureSetLastError" | "idCaptureSetLastLocalizedId" | "idCaptureSetLastResult" | "idCaptureDrivingLicenseDetailsCreateWithBlinkIdData" | "getIdOpenSourceSoftwareLicenseInfo";
10
+ export interface IdCaptureParseResponse {
11
+ result: ParseResult | null;
12
+ }
13
+ export interface IdCaptureDrivingLicenseDetailsCreateWithBlinkIdDataResponse {
14
+ result: DrivingLicenseDetailsJSON;
15
+ }
16
+ export interface IdCaptureBarcodeVerifyAamvaCaptureResponse {
17
+ result: AamvaBarcodeVerificationResultJSON & {
18
+ error: string;
19
+ serverResponseJSON: string;
20
+ isSuccess: boolean;
21
+ };
22
+ }
23
+ export interface GetIdOpenSourceSoftwareLicenseInfoResponse {
24
+ licenseText: string;
25
+ }
26
+ export type WorkerResponse<C extends DataCaptureActionMessageKey> = C extends "idCaptureBarcodeVerifyAamvaCapture" ? IdCaptureBarcodeVerifyAamvaCaptureResponse : C extends "idCaptureParse" ? IdCaptureParseResponse : C extends "idCaptureDrivingLicenseDetailsCreateWithBlinkIdData" ? IdCaptureDrivingLicenseDetailsCreateWithBlinkIdDataResponse : C extends "getIdOpenSourceSoftwareLicenseInfo" ? GetIdOpenSourceSoftwareLicenseInfoResponse : CoreWorkerResponse<C>;
27
+ interface DataCaptureActionMessage {
28
+ command: DataCaptureActionMessageKey;
29
+ id: number;
30
+ }
31
+ export interface IdCaptureSetLastResultDataCaptureAction extends DataCaptureActionMessage {
32
+ command: "idCaptureSetLastResult";
33
+ result: string;
34
+ }
35
+ export interface IdCaptureSetLastErrorDataCaptureAction extends DataCaptureActionMessage {
36
+ command: "idCaptureSetLastError";
37
+ error: string;
38
+ }
39
+ export interface IdCaptureSetLastLocalizedIdDataCaptureAction extends DataCaptureActionMessage {
40
+ command: "idCaptureSetLastLocalizedId";
41
+ localizedId: string;
42
+ }
43
+ export interface IdCaptureSetLastDetectionIssueDataCaptureAction extends DataCaptureActionMessage {
44
+ command: "idCaptureSetLastDetectionIssue";
45
+ issue: string;
46
+ }
47
+ export interface IdCaptureResetDataCaptureAction extends DataCaptureActionMessage {
48
+ command: "idCaptureReset";
49
+ }
50
+ export interface IdCaptureApplySettingsDataCaptureAction extends DataCaptureActionMessage {
51
+ command: "idCaptureApplySettings";
52
+ settings: IdCaptureSettingsJSON;
53
+ }
54
+ export interface IdCaptureParseDataCaptureAction extends DataCaptureActionMessage {
55
+ command: "idCaptureParse";
56
+ code: string;
57
+ }
58
+ export interface IdCaptureBarcodeVerifyAamvaCaptureDataCaptureAction extends DataCaptureActionMessage {
59
+ command: "idCaptureBarcodeVerifyAamvaCapture";
60
+ capturedId: CapturedIdJSON;
61
+ }
62
+ export interface IdCaptureDrivingLicenseDetailsCreateWithBlinkIdDataDataCaptureAction extends DataCaptureActionMessage {
63
+ command: "idCaptureDrivingLicenseDetailsCreateWithBlinkIdData";
64
+ details: {
65
+ vehicleClass: string;
66
+ restrictions: string;
67
+ endorsements: string;
68
+ };
69
+ }
70
+ export interface GetIdOpenSourceSoftwareLicenseInfoAction extends DataCaptureActionMessage {
71
+ command: "getIdOpenSourceSoftwareLicenseInfo";
72
+ }
73
+ export type AnyDataCaptureActionMessage = CoreAnyDataCaptureActionMessage | IdCaptureApplySettingsDataCaptureAction | IdCaptureBarcodeVerifyAamvaCaptureDataCaptureAction | IdCaptureParseDataCaptureAction | IdCaptureResetDataCaptureAction | IdCaptureSetLastDetectionIssueDataCaptureAction | IdCaptureSetLastErrorDataCaptureAction | IdCaptureSetLastLocalizedIdDataCaptureAction | IdCaptureSetLastResultDataCaptureAction | IdCaptureDrivingLicenseDetailsCreateWithBlinkIdDataDataCaptureAction | GetIdOpenSourceSoftwareLicenseInfoAction;
74
+ export type MessagePayloadByCommand = {
75
+ [key in AnyDataCaptureActionMessage["command"]]: Prettify<Omit<Extract<AnyDataCaptureActionMessage, {
76
+ command: key;
77
+ }>, "command" | "id">>;
78
+ };
79
+ export type WorkerCall = <C extends keyof MessagePayloadByCommand>(command: C, payload: Prettify<MessagePayloadByCommand[C]>) => Promise<WorkerResponse<C>>;
80
+ /**
81
+ * MESSAGES EMITTED BY THE WORKER
82
+ */
83
+ type DataCaptureCallbackMessageKeys = CoreDataCaptureCallbackMessageKeys | "idCaptureBackendReset" | "idCaptureDetectionOnlyMode" | "idCaptureDidCaptureId" | "idCaptureDidLocalizeId" | "idCaptureDidRejectId" | "idCaptureDidShutterButtonPositionChanged" | "idCaptureDidShutterButtonStateChanged" | "idCaptureDidTimedOut" | "idCaptureDidUpdateSession" | "idCaptureIdCapturedFeedback" | "idCaptureIdRejectedFeedback" | "IdCaptureProcessFrameWithCentaurus";
84
+ interface BaseDataCaptureCallbackMessage {
85
+ type: DataCaptureCallbackMessageKeys;
86
+ }
87
+ interface IdCaptureDidCapture extends BaseDataCaptureCallbackMessage {
88
+ type: "idCaptureDidCaptureId";
89
+ payload: {
90
+ capturedId: CapturedIdJSONWithRawImageInfo;
91
+ };
92
+ }
93
+ interface IdCaptureDidReject extends BaseDataCaptureCallbackMessage {
94
+ type: "idCaptureDidRejectId";
95
+ payload: {
96
+ capturedId: CapturedIdJSONWithRawImageInfo | null;
97
+ rejectionReason: string;
98
+ };
99
+ }
100
+ interface IdCaptureDidShutterButtonPositionChanged extends BaseDataCaptureCallbackMessage {
101
+ type: "idCaptureDidShutterButtonPositionChanged";
102
+ payload: {
103
+ position: Rect;
104
+ };
105
+ }
106
+ interface IdCaptureDidShutterButtonStateChanged extends BaseDataCaptureCallbackMessage {
107
+ type: "idCaptureDidShutterButtonStateChanged";
108
+ payload: {
109
+ state: ShutterButtonState;
110
+ };
111
+ }
112
+ interface IdCaptureIdCapturedFeedback extends BaseDataCaptureCallbackMessage {
113
+ type: "idCaptureIdCapturedFeedback";
114
+ }
115
+ interface IdCaptureIdRejectedFeedback extends BaseDataCaptureCallbackMessage {
116
+ type: "idCaptureIdRejectedFeedback";
117
+ }
118
+ interface IdCaptureBackendReset extends BaseDataCaptureCallbackMessage {
119
+ type: "idCaptureBackendReset";
120
+ }
121
+ interface IdCaptureDetectionOnlyMode extends BaseDataCaptureCallbackMessage {
122
+ type: "idCaptureDetectionOnlyMode";
123
+ payload: {
124
+ detectionOnlyMode: boolean;
125
+ };
126
+ }
127
+ export type DataCaptureCallbackMessage = CoreDataCaptureCallbackMessage | IdCaptureBackendReset | IdCaptureDetectionOnlyMode | IdCaptureDidCapture | IdCaptureDidReject | IdCaptureDidShutterButtonPositionChanged | IdCaptureDidShutterButtonStateChanged | IdCaptureIdCapturedFeedback | IdCaptureIdRejectedFeedback;
128
+ export type CapturedIdJSONWithoutCommonFieldsJSON = Omit<CapturedIdJSON, keyof CapturedIdCommonFieldsJSON>;
129
+ export type ParseResult = {
130
+ status: "success";
131
+ capturedId: CapturedIdJSONWithRawImageInfo;
132
+ } | {
133
+ status: "error";
134
+ error: string;
135
+ };
136
+ /**
137
+ * OTHERS
138
+ */
139
+ export type PayloadForCommand<A, C> = A extends {
140
+ command: C;
141
+ } ? A : never;
142
+ export interface DataCaptureWorker extends Omit<Worker, "postMessage"> {
143
+ onmessage: ((this: Worker, event_: MessageEvent & {
144
+ data: unknown;
145
+ }) => void) | null;
146
+ postMessage: <C extends AnyDataCaptureActionMessage["command"]>(message: PayloadForCommand<AnyDataCaptureActionMessage, C>, transfer?: Transferable[]) => void;
147
+ }
148
+ export declare enum IdCaptureBackendErrorType {
149
+ Undefined = "Undefined",
150
+ InitializationError = "InitializationError",
151
+ ParsingError = "ParsingError"
152
+ }
153
+ export interface IdCaptureBackendError {
154
+ type: IdCaptureBackendErrorType;
155
+ message: string;
156
+ }
157
+ export interface CapturedIdCommonFieldsGetters extends Pick<EmscriptenClassHandle, "delete"> {
158
+ getFirstName: () => OptionalValueHolder<string>;
159
+ getLastName: () => OptionalValueHolder<string>;
160
+ getSecondaryLastName: () => OptionalValueHolder<string>;
161
+ getFullName: () => string;
162
+ getSex: () => OptionalValueHolder<string>;
163
+ getAge: () => OptionalValueHolder<number | null>;
164
+ isExpired: () => OptionalValueHolder<boolean | null>;
165
+ getNationality: () => OptionalValueHolder<string>;
166
+ getAddress: () => OptionalValueHolder<string>;
167
+ getIssuingCountry: () => OptionalValueHolder<string>;
168
+ getIssuingCountryIso: () => OptionalValueHolder<string>;
169
+ getDocumentNumber: () => OptionalValueHolder<string>;
170
+ getDocumentAdditionalNumber: () => OptionalValueHolder<string>;
171
+ getDateOfBirth: () => OptionalValueHolder<string>;
172
+ getDateOfExpiry: () => OptionalValueHolder<string>;
173
+ getDateOfIssue: () => OptionalValueHolder<string>;
174
+ getDocumentType: () => OptionalValueHolder<string>;
175
+ getDocumentSubtype: () => OptionalValueHolder<string>;
176
+ toJson: () => string;
177
+ }
178
+ interface CapturedIdImages extends EmscriptenClassHandle {
179
+ getFace: () => OptionalValueHolder<string | null>;
180
+ getFrameFront: () => WasmFrameData | null;
181
+ getFrameBack: () => WasmFrameData | null;
182
+ getCroppedDocumentFront: () => OptionalValueHolder<string | null>;
183
+ getCroppedDocumentBack: () => OptionalValueHolder<string | null>;
184
+ }
185
+ export interface WasmFrameData extends EmscriptenClassHandle {
186
+ getFrameData: () => Uint8Array;
187
+ getWidth: () => number;
188
+ getHeight: () => number;
189
+ getMirrorAxis: () => {
190
+ value: number;
191
+ };
192
+ getOrientation: () => number;
193
+ }
194
+ export interface WasmCaptureId extends CapturedIdCommonFieldsGetters {
195
+ toJson: () => string;
196
+ getImages: () => CapturedIdImages;
197
+ }
198
+ interface ResultOk<T> {
199
+ ok: () => true;
200
+ value: () => T;
201
+ }
202
+ interface ResultFail<E> {
203
+ ok: () => false;
204
+ error: () => E;
205
+ }
206
+ export type FailableResult<T, E> = ResultFail<E> | ResultOk<T>;
207
+ interface HasValueHolder<T> {
208
+ has_value: () => true;
209
+ value: () => T;
210
+ }
211
+ interface HasNoValueHolder {
212
+ has_value: () => false;
213
+ }
214
+ export type OptionalValueHolder<T> = HasNoValueHolder | HasValueHolder<T>;
215
+ export interface IdCaptureSessionHolder {
216
+ getCapturedId: () => OptionalValueHolder<CapturedIdCommonFieldsGetters>;
217
+ getLocalizedOnlyId: () => OptionalValueHolder<string>;
218
+ getNewlyRejectedId: () => OptionalValueHolder<string>;
219
+ toJson: () => string;
220
+ }
221
+ export interface CapturedIdHolder extends CapturedIdCommonFieldsGetters {
222
+ toJson: () => string;
223
+ }
224
+ export interface SDCIdCaptureMode extends EmscriptenClassHandle {
225
+ reset: () => void;
226
+ applySettings: (settings: string) => void;
227
+ addListener: (listener: unknown) => void;
228
+ setFeedbacks: (idCaptured: unknown, idRejected: unknown) => void;
229
+ parse: (code: string) => FailableResult<WasmCaptureId | null, string>;
230
+ }
231
+ interface BarcodeVerificationResponse {
232
+ isSuccess: boolean;
233
+ allChecksPassed: boolean;
234
+ error: string;
235
+ serverResponseJson: string;
236
+ }
237
+ interface IdCaptureModule {
238
+ IdCaptureDeserializer: new (helper: unknown) => CaptureModeDeserializerInstance;
239
+ IdCaptureListener: {
240
+ extend: (target: "IdCaptureListener", parameters: {
241
+ onSessionUpdated: () => void;
242
+ onIdCaptured: (idCapture: unknown, capturedId: WasmCaptureId) => void;
243
+ onIdRejected: (idCapture: unknown, capturedId: WasmCaptureId, rejectionReason: string) => void;
244
+ onShutterButtonPositionChanged: (position: string) => void;
245
+ onShutterButtonStateChanged: (state: string) => void;
246
+ }) => new () => EmscriptenClassHandle;
247
+ };
248
+ IdCaptureDeserializerListener: {
249
+ extend: (target: "IdCaptureDeserializerListener", parameters: {
250
+ onModeDeserializationStarted: (deserializer: unknown, mode: SDCIdCaptureMode, json: unknown) => void;
251
+ onModeDeserializationFinished: (deserializer: unknown, mode: SDCIdCaptureMode, json: unknown) => void;
252
+ onSettingsDeserializationStarted: (deserializer: unknown, settings: unknown, json: unknown) => void;
253
+ onSettingsDeserializationFinished: (deserializer: unknown, settings: unknown, json: unknown) => void;
254
+ }) => new () => EmscriptenClassHandle;
255
+ };
256
+ IdCaptureBackend: {
257
+ extend: (target: "IdCaptureBackend", parameters: {
258
+ getLastError: () => string;
259
+ getLastResult: () => string;
260
+ getLocalizedOnlyId: () => string;
261
+ getLastIssue: () => string;
262
+ processFrame: (data: Uint8ClampedArray, width: number, height: number, format: unknown) => void;
263
+ reset: () => void;
264
+ setDetectionOnlyMode: (detectionOnly: boolean) => void;
265
+ }) => new () => {
266
+ delete: () => void;
267
+ };
268
+ };
269
+ IdCaptureDeserializerHelper: {
270
+ extend: (target: "IdCaptureDeserializerHelper", parameters: {
271
+ createMode: (context: unknown, settings: unknown) => SDCIdCaptureMode;
272
+ }) => new () => EmscriptenClassHandle;
273
+ };
274
+ IdCapture: new (context: unknown, idCaptureBackend: unknown, settings: unknown, idCaptureImageHighlighter: unknown) => SDCIdCaptureMode;
275
+ AamvaBarcodeVerifier: {
276
+ extend: (target: "AamvaBarcodeVerifier", parameters: {
277
+ verificationEnded: () => void;
278
+ retriggerVerificationIn: (timeInMilliseconds: number) => void;
279
+ }) => new () => EmscriptenClassHandle & {
280
+ initialize: (context: unknown) => void;
281
+ startVerification: (capturedId: string) => void;
282
+ getBarcodeVerificationResponse: () => BarcodeVerificationResponse;
283
+ };
284
+ };
285
+ DrivingLicenseDetails: {
286
+ createWithBlinkIdData: (vehicleClass: string, restrictions: string, endorsements: string) => string;
287
+ };
288
+ IdOpenSourceSoftwareLicenseInfo: {
289
+ getLicenseText(): string;
290
+ };
291
+ }
292
+ export interface Module extends CoreModule, IdCaptureModule {
293
+ }
294
+ export declare function getValueFromFailable<T, E, U>(holder: FailableResult<T, E>, defaultValue: U): T | U;
295
+ export declare function getErrorFromFailable<T, E, U>(holder: FailableResult<T, E>, defaultValue: U): E | U;
296
+ export declare function getValueFromOptional<T, U>(holder: OptionalValueHolder<T>, defaultValue: U): T | U;
297
+ export type EngineWorkerResponse<C extends DataCaptureActionMessageKey> = WorkerResponse<C> extends Promise<void> | void ? Promise<void> | void : {
298
+ payload: WorkerResponse<C>;
299
+ transferables?: Transferable[];
300
+ };
301
+ export type AugmentedWorker = Worker & {
302
+ Module: Module;
303
+ OffscreenCanvas: new (w: number, h: number) => OffscreenCanvas;
304
+ };
305
+ export {};
@@ -0,0 +1 @@
1
+ export * from "./dataCaptureWorkerRelated";
package/package.json ADDED
@@ -0,0 +1,116 @@
1
+ {
2
+ "name": "@scandit/web-datacapture-id",
3
+ "version": "7.0.0-beta.1",
4
+ "description": "Scandit Data Capture SDK for the Web",
5
+ "license": "SEE LICENSE IN LICENSE",
6
+ "sideEffects": false,
7
+ "engines": {
8
+ "npm": ">=7.0.0",
9
+ "node": ">=16.0.0"
10
+ },
11
+ "private": false,
12
+ "types": "./build/js/index.d.ts",
13
+ "type": "module",
14
+ "main": "./build/js/index.js",
15
+ "module": "./build/js/index.js",
16
+ "browser": "./build/js/index.js",
17
+ "exports": {
18
+ "./package.json": "./package.json",
19
+ ".": {
20
+ "types": "./build/js/index.d.ts",
21
+ "import": "./build/js/index.js",
22
+ "default": "./build/js/index.js"
23
+ },
24
+ "./sdc-lib/*": {
25
+ "import": "./sdc-lib/*",
26
+ "default": "./sdc-lib/*"
27
+ }
28
+ },
29
+ "author": {
30
+ "name": "Scandit",
31
+ "email": "support@scandit.com"
32
+ },
33
+ "contributors": [
34
+ {
35
+ "name": "Pasquale Mangialavori",
36
+ "email": "pasquale@scandit.com"
37
+ },
38
+ {
39
+ "name": "Anthony Penna",
40
+ "email": "anthony@scandit.com"
41
+ },
42
+ {
43
+ "name": "S\u00e9bastien Roch",
44
+ "email": "sebastien@scandit.com"
45
+ },
46
+ {
47
+ "name": "Lorenzo W\u00f6lckner",
48
+ "email": "lorenzo@scandit.com"
49
+ }
50
+ ],
51
+ "homepage": "https://www.scandit.com/products/sdk-web/",
52
+ "bugs": {
53
+ "email": "support@scandit.com"
54
+ },
55
+ "repository": {
56
+ "type": "git",
57
+ "url": "https://github.com/scandit"
58
+ },
59
+ "keywords": [
60
+ "scandit",
61
+ "barcode",
62
+ "data capture",
63
+ "capture",
64
+ "qr",
65
+ "scan",
66
+ "scanner",
67
+ "scanning",
68
+ "code",
69
+ "webassembly",
70
+ "sdk",
71
+ "javascript",
72
+ "typescript",
73
+ "web component"
74
+ ],
75
+ "files": [
76
+ "package.json",
77
+ "README.md",
78
+ "README.txt",
79
+ "LICENSE",
80
+ "THIRD-PARTY.txt",
81
+ "build/",
82
+ "sdc-lib/"
83
+ ],
84
+ "prettier": "@shared/prettier-config",
85
+ "scripts": {
86
+ "dev": "NODE_ENV=debug concurrently -n build,tsc,http-server \"npm run build-watch\" \"npm run types-watch\" \"http-server build -m '{\"application/wasm\": [\"wasm\"]}'\"",
87
+ "types-watch": "tsc -p tsconfig.json -w --noEmit --preserveWatchOutput",
88
+ "types-check": "tsc -p tsconfig.json --noEmit",
89
+ "build": "npx tsup",
90
+ "build-coverage": "COVERAGE=true npx tsup",
91
+ "build-dev": "NODE_ENV=debug npx tsup",
92
+ "build-watch": "NODE_ENV=debug npx tsup --watch",
93
+ "postbuild": "node scripts/postbuild && npm run generate-typings",
94
+ "postbuild-dev": "node scripts/postbuild && npm run generate-typings",
95
+ "postbuild-coverage": "node scripts/postbuild && npm run generate-typings",
96
+ "clean": "rm -rf build/* coverage/* sdc-lib/idcapture/*",
97
+ "generate-typings": "node scripts/generate-typings.js",
98
+ "test": "jest",
99
+ "test-ci": "jest --ci",
100
+ "test-ci-coverage": "jest --ci --coverage",
101
+ "lint": "eslint --cache .",
102
+ "lint-fix": "eslint --cache --fix .",
103
+ "lint-diff": "eslint --config .eslintrc.diff.cjs --cache ."
104
+ },
105
+ "lint-staged": {
106
+ "*.{js,jsx,ts,tsx}": [
107
+ "eslint --config .eslintrc.diff.cjs --fix"
108
+ ]
109
+ },
110
+ "dependencies": {
111
+ "@types/emscripten": "^1.39.13"
112
+ },
113
+ "peerDependencies": {
114
+ "@scandit/web-datacapture-core": "7.0.0-beta.1"
115
+ }
116
+ }
@@ -0,0 +1 @@
1
+ !function proxyConsole(){const CentaurusWordsToSDC=new Map;CentaurusWordsToSDC.set([77,105,99,114,111,98,108,105,110,107],"Scandit");CentaurusWordsToSDC.set([66,108,105,110,107,73,68],"ID Capture");function fixCentaurusMentions(input){let output=input;if(typeof output==="string")return[...CentaurusWordsToSDC.entries()].reduce(((s,[word,replacement])=>{const realWord=word.map((char=>String.fromCodePoint(char))).join("");return s.replace(new RegExp(realWord,"gi"),replacement)}),output);return output}if(console){const functionNames=["debug","error","info","warn","log"];const originalFunctions=functionNames.reduce(((fnMaps,functionName)=>{fnMaps[functionName]=console[functionName];return fnMaps}),{});functionNames.forEach((functionName=>{console[functionName]=(...args)=>{const filteredArgs=args.map(fixCentaurusMentions);originalFunctions[functionName].apply(console,filteredArgs)}}))}}();!function(){"use strict";let e=0;class t{constructor(t){this.action=t,this.messageID=function(){const t=e;return e+=1,t}()}}class s extends t{constructor(e,t){super(s.action),this.wasmModuleName=e.wasmModuleName,this.licenseKey=e.licenseKey,this.userId=t,this.registerLoadCallback=null!==e.loadProgressCallback,this.allowHelloMessage=e.allowHelloMessage,this.engineLocation=e.engineLocation,this.wasmType=e.wasmType,this.initialMemory=e.initialMemory,this.blinkIDVariant=e.blinkIdVariant,this.numberOfWorkers=e.numberOfWorkers}}var n,r;s.action="init",function(e){e[e.Any=0]="Any",e[e.Recognizer=1]="Recognizer",e[e.RecognizerSettings=2]="RecognizerSettings",e[e.Callback=3]="Callback"}(n||(n={}));class i extends t{constructor(e,t){super(i.action),this.funcName=e,this.params=t}}i.action="invokeFunction";class a extends t{constructor(e,t){super(a.action),this.className=e,this.params=t}}a.action="createNewNativeObject";class o extends t{constructor(e,t,s){super(o.action),this.recognizerHandles=e,this.allowMultipleResults=t,this.registeredMetadataCallbacks=s}}o.action="createRecognizerRunner";class c extends t{constructor(e,t){super(c.action),this.recognizerHandles=e,this.allowMultipleResults=t}}c.action="reconfigureRecognizerRunner";class E extends t{constructor(){super(E.action)}}E.action="deleteRecognizerRunner";class R extends t{constructor(e,t,s){super(R.action),this.objectHandle=e,this.methodName=t,this.params=s}}R.action="invokeObject";class l extends t{constructor(e){super(l.action),this.frame=e}getTransferrables(){return[this.frame.imageData.data.buffer]}}l.action="processImage";class _ extends t{constructor(e){super(_.action),this.hardReset=e}}_.action="resetRecognizers";class I extends t{constructor(e){super(I.action),this.registeredMetadataCallbacks=e}}I.action="registerMetadataCallbacks";class u extends t{constructor(e){super(u.action),this.detectionOnlyMode=e}}u.action="setDetectionOnly";class N extends t{constructor(e){super(N.action),this.cameraPreviewMirrored=e}}N.action="setCameraPreviewMirrored";class d extends t{constructor(e){super(d.action),this.userId=e}}d.action="getProductIntegrationInfo";class O extends t{constructor(e){super(O.action),this.pingProxyUrl=e}}O.action="setPingProxyUrl";class h extends t{constructor(e){super(h.action),this.data=e}}h.action="setPingData";class g{constructor(e,t,s){this.success=!0,this.error=null,this.messageID=e,this.success=t,this.error=s}}class S{constructor(e,t,s,n){this.success=!0,this.showOverlay=!0,this.messageID=e,this.success=t,this.showOverlay=s,this.wasmType=n}}class A extends g{constructor(e,t){super(e,!0,null),this.result=t}}class D extends g{constructor(e,t){super(e,!0,null),this.objectHandle=t}}class m extends g{constructor(e,t){super(e,!0,null),this.recognitionState=t}}class C extends g{constructor(e,t){super(e,!0,null),this.result=t}}class f{constructor(e){this.isLoadProgressMessage=!0,this.progress=e}}!function(e){e[e.onDebugText=0]="onDebugText",e[e.onDetectionFailed=1]="onDetectionFailed",e[e.onQuadDetection=2]="onQuadDetection",e[e.onPointsDetection=3]="onPointsDetection",e[e.onFirstSideResult=4]="onFirstSideResult",e[e.recognizerCallback=5]="recognizerCallback"}(r||(r={}));class p{constructor(e,t){this.isCallbackMessage=!0,this.callbackType=e,this.callbackParameters=t}}function T(e,t){return t=t||"",""===(e=e||"")?t:e.endsWith("/")?t.startsWith("/")?e+t.substring(1):e+t:t.startsWith("/")?e+t:e+"/"+t}var L,M,w;async function y(){if(!await(async e=>{try{return"undefined"!=typeof MessageChannel&&(new MessageChannel).port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(e)}catch(e){return!1}})(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11])))return!1;if(!("importScripts"in self))throw Error("Not implemented");return!function(){const e=navigator.userAgent.toLowerCase();return e.includes("safari")&&!e.includes("chrome")}()&&"Worker"in self}async function U(){const e=await(async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])))(),t=await y();return e?t?L.AdvancedWithThreads:L.Advanced:L.Basic}!function(e){e.Basic="BASIC",e.Advanced="ADVANCED",e.AdvancedWithThreads="ADVANCED_WITH_THREADS"}(L||(L={}));class P extends Error{constructor(e,t){if(super(),!e.code||!e.message)throw Error("Instance of SDKError is required to have code and message.");if(this.message=e.message,this.code=e.code,"details"in e){if("message"in e.details){const t=Error(e.details.message);"stack"in e.details&&(t.stack=e.details.stack),this.details=t}}else this.details=t}}class b{constructor(e,t){if(!e.code||!e.message)throw Error("Instance of SDKError is required to have code and message.");this.message=e.message,this.code=e.code,this.details=t instanceof Error?new F(t):t}}class F{constructor(e){this.message=e.message,this.name=e.name,this.stack=e.stack}}!function(e){e.WORKER_WASM_LOAD_FAILURE="WORKER_WASM_LOAD_FAILURE",e.WORKER_WASM_INIT_MISSING="WORKER_WASM_INIT_MISSING",e.WORKER_FUNCTION_INVOKE_FAILURE="WORKER_FUNCTION_INVOKE_FAILURE",e.WORKER_RECOGNIZER_CREATION_FAILURE="WORKER_RECOGNIZER_CREATION_FAILURE",e.WORKER_RUNNER_EXISTS="WORKER_RUNNER_EXISTS",e.WORKER_RUNNER_CREATION_FAILURE="WORKER_RUNNER_CREATION_FAILURE",e.WORKER_RUNNER_MISSING="WORKER_RUNNER_MISSING",e.WORKER_RUNNER_RECONFIGURE_FAILURE="WORKER_RUNNER_RECONFIGURE_FAILURE",e.WORKER_RUNNER_DELETED="WORKER_RUNNER_DELETED",e.WORKER_RUNNER_DELETE_FAILURE="WORKER_RUNNER_DELETE_FAILURE",e.WORKER_OBJECT_INVOKE_FAILURE="WORKER_OBJECT_INVOKE_FAILURE",e.WORKER_IMAGE_PROCESS_FAILURE="WORKER_IMAGE_PROCESS_FAILURE",e.WORKER_HANDLE_UNDEFINED="WORKER_HANDLE_UNDEFINED",e.WORKER_MESSAGE_ACTION_UNKNOWN="WORKER_MESSAGE_ACTION_UNKNOWN",e.WORKER_LICENSE_UNLOCK_ERROR="WORKER_LICENSE_UNLOCK_ERROR",e.WORKER_INTEGRATION_INFO_FAILURE="WORKER_INTEGRATION_INFO_FAILURE",e.LOCAL_SDK_RUNNER_MISSING="LOCAL_SDK_RUNNER_MISSING",e.LOCAL_SDK_RUNNER_EMPTY="LOCAL_SDK_RUNNER_EMPTY",e.LICENSE_UNLOCK_ERROR="LICENSE_UNLOCK_ERROR",e.FRAME_CAPTURE_SVG_UNSUPPORTED="FRAME_CAPTURE_SVG_UNSUPPORTED",e.FRAME_CAPTURE_CANVAS_MISSING="FRAME_CAPTURE_CANVAS_MISSING",e.SDK_WASM_SETTINGS_MISSING="SDK_WASM_SETTINGS_MISSING",e.SDK_LICENSE_KEY_MISSING="SDK_LICENSE_KEY_MISSING",e.SDK_WASM_MODULE_NAME_MISSING="SDK_WASM_MODULE_NAME_MISSING",e.SDK_ENGINE_LOCATION_INVALID="SDK_ENGINE_LOCATION_INVALID",e.SDK_WORKER_LOCATION_INVALID="SDK_WORKER_LOCATION_INVALID",e.SDK_MISSING="SDK_MISSING",e.SDK_RECOGNIZERS_MISSING="SDK_RECOGNIZERS_MISSING",e.VIDEO_RECOGNIZER_ELEMENT_MISSING="VIDEO_RECOGNIZER_ELEMENT_MISSING",e.VIDEO_RECOGNIZER_CAMERA_MISSING="VIDEO_RECOGNIZER_CAMERA_MISSING",e.VIDEO_RECOGNIZER_CAMERA_NOT_ALLOWED="VIDEO_RECOGNIZER_CAMERA_NOT_ALLOWED",e.VIDEO_RECOGNIZER_CAMERA_UNAVAILABLE="VIDEO_RECOGNIZER_CAMERA_UNAVAILABLE",e.VIDEO_RECOGNIZER_CAMERA_IN_USE="VIDEO_RECOGNIZER_CAMERA_IN_USE",e.VIDEO_RECOGNIZER_MEDIA_DEVICES_UNSUPPORTED="VIDEO_RECOGNIZER_MEDIA_DEVICES_UNSUPPORTED",e.VIDEO_RECOGNIZER_FEED_RELEASED="VIDEO_RECOGNIZER_FEED_RELEASED",e.VIDEO_RECOGNIZER_FEED_NOT_PAUSED="VIDEO_RECOGNIZER_FEED_NOT_PAUSED",e.VIDEO_RECOGNIZER_PLAY_REQUEST_INTERRUPTED="VIDEO_RECOGNIZER_PLAY_REQUEST_INTERRUPTED",e.VIDEO_RECOGNIZER_FEED_PAUSED="VIDEO_RECOGNIZER_FEED_PAUSED",e.VIDEO_RECOGNIZER_RECOGNIZERS_RESET_FAILURE="VIDEO_RECOGNIZER_RECOGNIZERS_RESET_FAILURE",e.VIDEO_RECOGNIZER_FEED_MISSING="VIDEO_RECOGNIZER_FEED_MISSING",e.INVALID_PING_PROXY_URL="INVALID_PROXY_URL",e.PING_PROXY_PERMISSION_NOT_GRANTED="PING_PROXY_PERMISSION_NOT_GRANTED",e.PING_DATA_KEYS_AMOUNT_EXCEEDED="PING_DATA_KEYS_AMOUNT_EXCEEDED",e.PING_DATA_KEY_LENGTH_EXCEEDED="PING_DATA_KEY_LENGTH_EXCEEDED",e.PING_DATA_VALUE_LENGTH_EXCEEDED="PING_DATA_VALUE_LENGTH_EXCEEDED"}(M||(M={})),function(e){e.WORKER_HANDLE_UNDEFINED="Cannot find object with handle: undefined",e.WORKER_WASM_LOAD_FAILURE="Failed to load WASM in web worker!",e.WORKER_WASM_INIT_MISSING="WASM module is not initialized!",e.WORKER_FUNCTION_INVOKE_FAILURE="Failed to invoke function!",e.WORKER_RECOGNIZER_CREATION_FAILURE="Failed to create new recognizer!",e.WORKER_RUNNER_EXISTS="Recognizer runner is already created! Multiple instances are not allowed!",e.WORKER_RUNNER_CREATION_FAILURE="Failed to create new recognizer runner!",e.WORKER_RUNNER_MISSING="Recognizer runner is not created! There is nothing to reconfigure!",e.WORKER_RUNNER_RECONFIGURE_FAILURE="Failed to reconfigure recognizer runner!",e.WORKER_RUNNER_DELETED="Recognizer runner is already deleted!",e.WORKER_RUNNER_DELETE_FAILURE="Failed to delete recognizer runner!",e.WORKER_OBJECT_INVOKE_FAILURE="Failed to invoke object!",e.WORKER_IMAGE_PROCESS_FAILURE="Recognizer runner is not initialized! Cannot process image!",e.WORKER_INTEGRATION_INFO_FAILURE="Failed to get product integration info!",e.LOCAL_SDK_RUNNER_MISSING="Property nativeRecognizerRunner is not available!",e.LOCAL_SDK_RUNNER_EMPTY="Native RecognizerRunner cannot be empty!",e.LICENSE_TOKEN_STATE_INCORRECT="Internal error (Incorrect token state)",e.LICENSE_PAYLOAD_VERIFICATION_FAILED="Failed to verify server permission's digital signature!",e.LICENSE_PAYLOAD_CORRUPTED="Server permission payload is corrupted!",e.LICENSE_PERMISSION_EXPIRED="Internal error (server permission expired)",e.LICENSE_REMOTE_LOCKED="Provided license key has been remotely locked. Please contact support for more information!",e.FRAME_CAPTURE_SVG_UNSUPPORTED="Recognition of SVG elements not supported!",e.FRAME_CAPTURE_CANVAS_MISSING="Could not get canvas 2d context!",e.SDK_WASM_SETTINGS_MISSING="Missing WASM load settings!",e.SDK_LICENSE_KEY_MISSING="Missing license key!",e.SDK_WASM_MODULE_NAME_MISSING="Missing WASM module name!",e.SDK_ENGINE_LOCATION_INVALID="Setting property 'engineLocation' must be a string!",e.SDK_WORKER_LOCATION_INVALID="Setting property 'workerLocation' must be a string!",e.SDK_MISSING="SDK is not provided!",e.SDK_RECOGNIZERS_MISSING="To create RecognizerRunner at least 1 recognizer is required.",e.VIDEO_RECOGNIZER_ELEMENT_MISSING="Video element, i.e. camera feed is not provided!",e.VIDEO_RECOGNIZER_CAMERA_MISSING="Camera not found!",e.VIDEO_RECOGNIZER_CAMERA_NOT_ALLOWED="Camera not allowed!",e.VIDEO_RECOGNIZER_CAMERA_UNAVAILABLE="Camera not available!",e.VIDEO_RECOGNIZER_CAMERA_IN_USE="Camera in use!",e.VIDEO_RECOGNIZER_MEDIA_DEVICES_UNSUPPORTED="Media devices not supported by browser.",e.VIDEO_RECOGNIZER_FEED_RELEASED="The associated video feed has been released!",e.VIDEO_RECOGNIZER_FEED_NOT_PAUSED="The associated video feed is not paused. Use resumeRecognition instead!",e.VIDEO_RECOGNIZER_PLAY_REQUEST_INTERRUPTED="The play() request was interrupted or prevented by browser security rules!",e.VIDEO_RECOGNIZER_FEED_PAUSED="Cannot resume recognition while video feed is paused! Use recognize or startRecognition",e.VIDEO_RECOGNIZER_RECOGNIZERS_RESET_FAILURE="Could not reset recognizers!",e.VIDEO_RECOGNIZER_FEED_MISSING="Missing video feed!",e.INVALID_PING_PROXY_URL="Provided ping proxy URL is not a valid secure URL in format 'https://{host}:{port?}'.",e.PING_PROXY_PERMISSION_NOT_GRANTED="Allow ping proxy permission not found in license.",e.PING_DATA_KEYS_AMOUNT_EXCEEDED="Maximum number of ping data keys exceeded.",e.PING_DATA_KEY_LENGTH_EXCEEDED="Ping data key is too long.",e.PING_DATA_VALUE_LENGTH_EXCEEDED="Ping data value is too long."}(w||(w={}));const K={licenseTokenStateIncorrect:{code:M.LICENSE_UNLOCK_ERROR,message:w.LICENSE_TOKEN_STATE_INCORRECT},licensePayloadVerificationFailed:{code:M.LICENSE_UNLOCK_ERROR,message:w.LICENSE_PAYLOAD_VERIFICATION_FAILED},licensePayloadCorrupted:{code:M.LICENSE_UNLOCK_ERROR,message:w.LICENSE_PAYLOAD_CORRUPTED},licensePermissionExpired:{code:M.LICENSE_UNLOCK_ERROR,message:w.LICENSE_PERMISSION_EXPIRED},licenseRemoteLocked:{code:M.LICENSE_UNLOCK_ERROR,message:w.LICENSE_REMOTE_LOCKED},licenseNetworkError:{code:M.LICENSE_UNLOCK_ERROR},licenseInvalid:{code:M.LICENSE_UNLOCK_ERROR}},G={imageProcessFailure:{message:w.WORKER_IMAGE_PROCESS_FAILURE,code:M.WORKER_IMAGE_PROCESS_FAILURE},objectInvokeFailure:{message:w.WORKER_OBJECT_INVOKE_FAILURE,code:M.WORKER_OBJECT_INVOKE_FAILURE},runnerDeleteFailure:{message:w.WORKER_RUNNER_DELETE_FAILURE,code:M.WORKER_RUNNER_DELETE_FAILURE},runnerDeleted:{message:w.WORKER_RUNNER_DELETED,code:M.WORKER_RUNNER_DELETED},runnerReconfigureFailure:{message:w.WORKER_RUNNER_RECONFIGURE_FAILURE,code:M.WORKER_RUNNER_RECONFIGURE_FAILURE},runnerMissing:{message:w.WORKER_RUNNER_MISSING,code:M.WORKER_RUNNER_MISSING},runnerCreationFailure:{message:w.WORKER_RUNNER_CREATION_FAILURE,code:M.WORKER_RUNNER_CREATION_FAILURE},runnerExists:{message:w.WORKER_RUNNER_EXISTS,code:M.WORKER_RUNNER_EXISTS},recognizerCreationFailure:{message:w.WORKER_RECOGNIZER_CREATION_FAILURE,code:M.WORKER_RECOGNIZER_CREATION_FAILURE},functionInvokeFailure:{message:w.WORKER_FUNCTION_INVOKE_FAILURE,code:M.WORKER_FUNCTION_INVOKE_FAILURE},wasmInitMissing:{message:w.WORKER_WASM_INIT_MISSING,code:M.WORKER_WASM_INIT_MISSING},wasmLoadFailure:{message:w.WORKER_WASM_LOAD_FAILURE,code:M.WORKER_WASM_LOAD_FAILURE},handleUndefined:{message:w.WORKER_HANDLE_UNDEFINED,code:M.WORKER_HANDLE_UNDEFINED},integrationInfoFailure:{message:w.WORKER_INTEGRATION_INFO_FAILURE,code:M.WORKER_INTEGRATION_INFO_FAILURE}},k={invalidProxyUrl:{message:w.INVALID_PING_PROXY_URL,code:M.INVALID_PING_PROXY_URL},permissionNotGranted:{message:w.PING_PROXY_PERMISSION_NOT_GRANTED,code:M.PING_PROXY_PERMISSION_NOT_GRANTED},dataKeysAmountExceeded:{message:w.PING_DATA_KEYS_AMOUNT_EXCEEDED,code:M.PING_DATA_KEYS_AMOUNT_EXCEEDED},dataKeyLengthExceeded:{message:w.PING_DATA_KEY_LENGTH_EXCEEDED,code:M.PING_DATA_KEY_LENGTH_EXCEEDED},dataValueLengthExceeded:{message:w.PING_DATA_VALUE_LENGTH_EXCEEDED,code:M.PING_DATA_VALUE_LENGTH_EXCEEDED}};var v,W;!function(e){e[e.Invalid=0]="Invalid",e[e.RequiresServerPermission=1]="RequiresServerPermission",e[e.Valid=2]="Valid"}(v||(v={})),function(e){e.LicenseTokenStateInvalid="LICENSE_TOKEN_STATE_INVALID",e.NetworkError="NETWORK_ERROR",e.RemoteLock="REMOTE_LOCK",e.PermissionExpired="PERMISSION_EXPIRED",e.PayloadCorrupted="PAYLOAD_CORRUPTED",e.PayloadSignatureVerificationFailed="PAYLOAD_SIGNATURE_VERIFICATION_FAILED",e.IncorrectTokenState="INCORRECT_TOKEN_STATE"}(W||(W={}));function V(e){return{licenseId:e.licenseId,licensee:e.licensee,applicationIds:e.applicationIds,packageName:e.packageName,platform:"Browser",sdkName:e.sdkName,sdkVersion:e.sdkVersion}}var x;async function z(e,t){try{const s=await fetch("https://invalid.com/api/v2/status/check",{method:"POST",headers:{"Content-Type":"application/json"},cache:"no-cache",body:JSON.stringify(V(e))});if(s.ok){const e=""+await s.text();return t.submitServerPermission(e)}return{status:x.NetworkError,lease:0,networkErrorDescription:"Server responded with status "+s.status}}catch(e){return{status:x.NetworkError,lease:0,networkErrorDescription:"Unexpected error: "+JSON.stringify(e)}}}!function(e){e[e.Ok=0]="Ok",e[e.NetworkError=1]="NetworkError",e[e.RemoteLock=2]="RemoteLock",e[e.PermissionExpired=3]="PermissionExpired",e[e.PayloadCorrupted=4]="PayloadCorrupted",e[e.PayloadSignatureVerificationFailed=5]="PayloadSignatureVerificationFailed",e[e.IncorrectTokenState=6]="IncorrectTokenState"}(x||(x={}));var H=J,Z=J,Y=J;const X=/(android|bb\d+|meego).+mobile|armv7l|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|samsungbrowser.*mobile|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,j=/CrOS/,B=/android|ipad|playbook|silk/i;function J(e){e||(e={});let t=e.ua;if(t||"undefined"==typeof navigator||(t=navigator.userAgent),t&&t.headers&&"string"==typeof t.headers["user-agent"]&&(t=t.headers["user-agent"]),"string"!=typeof t)return!1;let s=X.test(t)&&!j.test(t)||!!e.tablet&&B.test(t);return!s&&e.tablet&&e.featureDetect&&navigator&&navigator.maxTouchPoints>1&&-1!==t.indexOf("Macintosh")&&-1!==t.indexOf("Safari")&&(s=!0),s}function Q(e){return Math.ceil(1024*e*1024/64/1024)}function q(){const e=self.navigator.userAgent.toLowerCase();return e.includes("safari")&&!e.includes("chrome")}H.isMobile=Z,H.default=Y;const{port1:$,port2:ee}=new MessageChannel;ee.close(),q()&&$.close();new class{constructor(){this.context=self,this.wasmModule=null,this.nativeRecognizerRunner=null,this.objects={},this.nextObjectHandle=0,this.metadataCallbacks={},this.context.onmessage=e=>{const t=e.data;switch(t.action){case s.action:this.processInitMessage(t);break;case i.action:this.processInvokeFunction(t);break;case a.action:this.processCreateNewRecognizer(t);break;case R.action:this.processInvokeObject(t);break;case o.action:this.processCreateRecognizerRunner(t);break;case c.action:this.processReconfigureRecognizerRunner(t);break;case E.action:this.processDeleteRecognizerRunner(t);break;case l.action:this.processImage(t);break;case _.action:this.resetRecognizers(t);break;case u.action:this.setDetectionOnly(t);break;case N.action:this.setCameraPreviewMirrored(t);break;case I.action:this.registerMetadataCallbacks(t);break;case d.action:this.processGetProductIntegrationInfo(t);break;case O.action:this.setPingProxyUrl(t);break;case h.action:this.setPingData(t);break;default:throw new P({code:M.WORKER_MESSAGE_ACTION_UNKNOWN,message:"Unknown message action: "+JSON.stringify(t.action)})}}}getNextObjectHandle(){const e=this.nextObjectHandle;return this.nextObjectHandle=this.nextObjectHandle+1,e}notifyError(e,t){this.context.postMessage(new g(e.messageID,!1,t))}notifySuccess(e){this.context.postMessage(new g(e.messageID,!0,null))}notifyInitSuccess(e,t,s){this.context.postMessage(new S(e.messageID,!0,t,s))}unwrapParameters(e){const t=[];for(const s of e.params){let r=s.parameter;s.type===n.Recognizer?(r=this.objects[r],void 0===r&&this.notifyError(e,new b(G.handleUndefined))):s.type===n.RecognizerSettings&&(r=this.restoreFunctions(r)),t.push(r)}return t}restoreFunctions(e){const t=Object.keys(e);for(const s of t){const t=e[s];"object"==typeof t&&null!==t&&"parameter"in t&&"type"in t&&t.type===n.Callback&&(e[s]=(...e)=>{const s=new p(r.recognizerCallback,[t.parameter].concat(e));this.context.postMessage(s)})}return e}scanForTransferrables(e){if("object"==typeof e){const t=Object.keys(e),s=[];for(const n of t){const t=e[n];t instanceof ImageData?s.push(t.data.buffer):t instanceof Uint8Array?s.push(t.buffer):null!==t&&"object"==typeof t&&s.push(...this.scanForTransferrables(t))}return s}return[]}registerHeartBeat(e){this.unregisterHeartBeat(),this.lease=e;let t=e-Math.floor(Date.now()/1e3);t>120?t-=120:t/=2,this.inFlightHeartBeatTimeoutId=setTimeout((()=>{this.obtainNewServerPermission(!0)}),1e3*t)}unregisterHeartBeat(){this.lease&&delete this.lease,this.inFlightHeartBeatTimeoutId&&(clearTimeout(this.inFlightHeartBeatTimeoutId),delete this.inFlightHeartBeatTimeoutId)}async obtainNewServerPermission(e){if(this.wasmModule){const t=this.wasmModule.getActiveLicenseTokenInfo(),s=await z(t,this.wasmModule);switch(s.status){case x.Ok:case x.RemoteLock:this.registerHeartBeat(s.lease);break;case x.NetworkError:case x.PayloadSignatureVerificationFailed:case x.PayloadCorrupted:e?(console.warn("Problem with obtaining server permission. Will attempt in 10 seconds "+x[s.status]),this.inFlightHeartBeatTimeoutId=setTimeout((()=>{this.obtainNewServerPermission(!1)}),1e4)):console.error("Problem with obtaining server permission. "+x[s.status]);break;case x.IncorrectTokenState:case x.PermissionExpired:console.error("Internal error: "+x[s.status])}return s.status}return console.error("Internal inconsistency! Wasm module not initialized where it's expected to be!"),x.IncorrectTokenState}willSoonExpire(){if(this.lease){if(this.wasmModule.getActiveLicenseTokenInfo().unlockResult===v.Valid){const e=Math.floor(Date.now()/1e3);return 30>this.lease-e}return!0}return!1}async calculateWasmBundle(e){const t=e.blinkIDVariant??(Z()?"lightweight":"full");return{wasmType:e.wasmType??await U(),blinkIDVariant:t}}calculateEngineLocationPrefix(e,t){const s=""===e.engineLocation?self.location.origin:e.engineLocation;console.log("Engine location is:",s);const n=T(s,function(e){let t="";return t=e.wasmType===L.AdvancedWithThreads?"advanced-threads":e.wasmType===L.Advanced?"advanced":"basic",`${e.blinkIDVariant}/${t}`}(t));return e.allowHelloMessage&&console.log("Engine location prefix is:",n),n}async processInitMessage(e){const t=await this.calculateWasmBundle(e),s=this.calculateEngineLocationPrefix(e,t);let n={locateFile:e=>T(s,e),noExitRuntime:!0},r=e.initialMemory;r||(r=/iOS|iPhone|iPad|iPod/i.test(navigator.userAgent)?700:200);const i=new WebAssembly.Memory({initial:Q(r),maximum:Q(2048),shared:t.wasmType===L.AdvancedWithThreads});n.wasmMemory=i,e.registerLoadCallback&&(n=Object.assign(n,{setStatus:e=>{const t=new f(function(e){if("Running..."===e)return 100;if(0===e.length)return 0;const t=RegExp(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/).exec(e);if(t)return 100*parseInt(t[2])/parseInt(t[4]);return NaN}(e));this.context.postMessage(t)}}));try{const r=T(s,e.wasmModuleName+".js");n.mainScriptUrlOrBlob=r,importScripts(r);(0,self[e.wasmModuleName])(n).then((async s=>{const n=await async function(e,t,s,n){const r=n.initializeWithLicenseKey(e,s,t);switch(r.unlockResult){case v.Invalid:return{error:new P({...K.licenseInvalid,message:r.licenseError},{type:W.LicenseTokenStateInvalid})};case v.Valid:return{error:null,showOverlay:(i=r.isTrial,a=r.allowRemoveDemoOverlay,o=r.allowRemoveProductionOverlay,!(i&&a||!i&&o))};case v.RequiresServerPermission:{const e=await z(r,n);switch(e.status){case x.Ok:return{error:null,lease:e.lease};case x.NetworkError:{let t="";return e.networkErrorDescription&&(t=" "+e.networkErrorDescription),{error:new P({...K.licenseNetworkError,message:"There has been a network error while obtaining the server permission!"+t},{type:W.NetworkError})}}case x.RemoteLock:return{error:new P(K.licenseRemoteLocked,{type:W.RemoteLock}),lease:e.lease};case x.PermissionExpired:return{error:new P(K.licensePermissionExpired,{type:W.PermissionExpired}),lease:e.lease};case x.PayloadCorrupted:return{error:new P(K.licensePayloadCorrupted,{type:W.PayloadCorrupted}),lease:e.lease};case x.PayloadSignatureVerificationFailed:return{error:new P(K.licensePayloadVerificationFailed,{type:W.PayloadSignatureVerificationFailed}),lease:e.lease};case x.IncorrectTokenState:return{error:new P(K.licenseTokenStateIncorrect,{type:W.IncorrectTokenState}),lease:e.lease}}}}var i,a,o}(e.licenseKey,e.allowHelloMessage,e.userId,s);null===n.error?(this.wasmModule=s,n.lease?this.registerHeartBeat(n.lease):this.unregisterHeartBeat(),this.notifyInitSuccess(e,!!n.showOverlay,t.wasmType)):this.notifyError(e,new b(n.error,n.error.details))}),(t=>{this.notifyError(e,new b(G.wasmLoadFailure,t))}))}catch(t){this.notifyError(e,new b(G.wasmLoadFailure,t))}}processInvokeFunction(e){if(null===this.wasmModule)return void this.notifyError(e,new b(G.wasmInitMissing));const t=e.funcName,s=this.unwrapParameters(e);try{const n=this.wasmModule[t](...s);this.context.postMessage(new A(e.messageID,n))}catch(t){this.notifyError(e,new b(G.functionInvokeFailure,t))}}processCreateNewRecognizer(e){if(null===this.wasmModule)return void this.notifyError(e,new b(G.wasmInitMissing));const t=e.className,s=this.unwrapParameters(e);try{const n=new this.wasmModule[t](...s),r=this.getNextObjectHandle();this.objects[r]=n,this.context.postMessage(new D(e.messageID,r))}catch(t){this.notifyError(e,new b(G.recognizerCreationFailure,t))}}getRecognizers(e){const t=[];for(const s of e)t.push(this.objects[s]);return t}async processCreateRecognizerRunner(e){if(null===this.wasmModule)this.notifyError(e,new b(G.wasmInitMissing));else if(null!==this.nativeRecognizerRunner)this.notifyError(e,new b(G.runnerExists));else{this.setupMetadataCallbacks(e.registeredMetadataCallbacks);try{if(this.willSoonExpire()){const t=await this.obtainNewServerPermission(!1);if(t!==x.Ok){const s=x[t];return void this.notifyError(e,new b({code:M.WORKER_LICENSE_UNLOCK_ERROR,message:"Cannot initialize recognizers because of invalid server permission:\n "+s},{type:W[s]}))}}const t=this.getRecognizers(e.recognizerHandles);this.nativeRecognizerRunner=new this.wasmModule.RecognizerRunner(t,e.allowMultipleResults,this.metadataCallbacks),this.notifySuccess(e)}catch(t){this.notifyError(e,new b(G.runnerCreationFailure,t))}}}processReconfigureRecognizerRunner(e){if(null===this.wasmModule)this.notifyError(e,new b(G.wasmInitMissing));else if(null===this.nativeRecognizerRunner)this.notifyError(e,new b(G.runnerMissing));else try{const t=this.getRecognizers(e.recognizerHandles);this.nativeRecognizerRunner.reconfigureRecognizers(t,e.allowMultipleResults),this.notifySuccess(e)}catch(t){this.notifyError(e,new b(G.runnerReconfigureFailure,t))}}processDeleteRecognizerRunner(e){if(null!==this.nativeRecognizerRunner)try{this.nativeRecognizerRunner.delete(),this.nativeRecognizerRunner=null,this.notifySuccess(e)}catch(t){this.notifyError(e,new b(G.runnerDeleteFailure,t))}else this.notifyError(e,new b(G.runnerDeleted))}wrapFunctions(e,t){if("object"!=typeof e)return e;const s={...e},r=Object.keys(s);for(const e of r)if("function"==typeof s[e])s[e]={parameter:{recognizerHandle:t,callbackName:e},type:n.Callback};return s}processInvokeObject(e){try{const t=e.objectHandle,s=e.methodName,n=this.unwrapParameters(e),r=this.objects[t];if(void 0===r)this.notifyError(e,new b({message:"Cannot find object with handle: "+t,code:M.WORKER_HANDLE_UNDEFINED}));else{const i=this.wrapFunctions(r[s](...n),t),a=this.scanForTransferrables(i);"delete"===s&&delete this.objects[t],this.context.postMessage(new A(e.messageID,i),a)}}catch(t){this.notifyError(e,new b(G.objectInvokeFailure,t))}}processImage(e){if(null!==this.nativeRecognizerRunner)try{const t=this.nativeRecognizerRunner.processImage(e.frame);q()||$.postMessage(e.frame.imageData.data,[e.frame.imageData.data.buffer]),this.context.postMessage(new m(e.messageID,t))}catch(t){this.notifyError(e,new b(G.imageProcessFailure,t))}else this.notifyError(e,new b(G.imageProcessFailure))}resetRecognizers(e){if(null!==this.nativeRecognizerRunner)try{this.nativeRecognizerRunner.resetRecognizers(e.hardReset),this.notifySuccess(e)}catch(t){this.notifyError(e,new b(G.imageProcessFailure,t))}else this.notifyError(e,new b(G.imageProcessFailure))}setPingProxyUrl(e){if(null!==this.nativeRecognizerRunner)try{this.nativeRecognizerRunner.setPingProxyUrl(e.pingProxyUrl),this.notifySuccess(e)}catch(t){this.notifyError(e,new b("cause"in t&&"PERMISSION_NOT_GRANTED"===t.cause?k.permissionNotGranted:G.runnerMissing,t))}else this.notifyError(e,new b(G.runnerMissing))}setPingData(e){if(null!==this.nativeRecognizerRunner)try{this.nativeRecognizerRunner.setPingData(e.data),this.notifySuccess(e)}catch(t){if("cause"in t)switch(console.log("there is cause in error",t.cause),t.cause){case"PING_EXTRAS_TOO_MANY_KEYS":this.notifyError(e,new b(k.dataKeysAmountExceeded,t));break;case"PING_EXTRAS_KEY_TOO_LONG":this.notifyError(e,new b(k.dataKeyLengthExceeded,t));break;case"PING_EXTRAS_VALUE_TOO_LONG":this.notifyError(e,new b(k.dataValueLengthExceeded,t));break;default:this.notifyError(e,new b(G.runnerMissing,t))}this.notifyError(e,new b(G.runnerMissing,t))}else this.notifyError(e,new b(G.runnerMissing))}setDetectionOnly(e){if(null!==this.nativeRecognizerRunner)try{this.nativeRecognizerRunner.setDetectionOnlyMode(e.detectionOnlyMode),this.notifySuccess(e)}catch(t){this.notifyError(e,new b(G.imageProcessFailure,t))}else this.notifyError(e,new b(G.imageProcessFailure))}setCameraPreviewMirrored(e){if(null!==this.nativeRecognizerRunner)try{this.nativeRecognizerRunner.setCameraPreviewMirrored(e.cameraPreviewMirrored),this.notifySuccess(e)}catch(t){this.notifyError(e,new b(G.imageProcessFailure,t))}else this.notifyError(e,new b(G.imageProcessFailure))}setupMetadataCallbacks(e){e.onDebugText?this.metadataCallbacks.onDebugText=e=>{const t=new p(r.onDebugText,[e]);this.context.postMessage(t)}:delete this.metadataCallbacks.onDebugText,e.onDetectionFailed?this.metadataCallbacks.onDetectionFailed=()=>{const e=new p(r.onDetectionFailed,[]);this.context.postMessage(e)}:delete this.metadataCallbacks.onDetectionFailed,e.onPointsDetection?this.metadataCallbacks.onPointsDetection=e=>{const t=new p(r.onPointsDetection,[e]);this.context.postMessage(t)}:delete this.metadataCallbacks.onPointsDetection,e.onQuadDetection?this.metadataCallbacks.onQuadDetection=e=>{const t=new p(r.onQuadDetection,[e]);this.context.postMessage(t)}:delete this.metadataCallbacks.onQuadDetection,e.onFirstSideResult?this.metadataCallbacks.onFirstSideResult=()=>{const e=new p(r.onFirstSideResult,[]);this.context.postMessage(e)}:delete this.metadataCallbacks.onFirstSideResult}registerMetadataCallbacks(e){if(null!==this.nativeRecognizerRunner){this.setupMetadataCallbacks(e.registeredMetadataCallbacks);try{this.nativeRecognizerRunner.setJSDelegate(this.metadataCallbacks),this.notifySuccess(e)}catch(t){this.notifyError(e,new b(G.imageProcessFailure,t))}}else this.notifyError(e,new b(G.imageProcessFailure))}processGetProductIntegrationInfo(e){if(null!==this.wasmModule)try{const t=this.wasmModule.getActiveLicenseTokenInfo(),s={userId:e.userId,licenseId:t.licenseId,licensee:t.licensee,productName:t.sdkName,productVersion:t.sdkVersion,platform:"Browser",device:self.navigator.userAgent,packageName:t.packageName};this.context.postMessage(new C(e.messageID,s))}catch(t){this.notifyError(e,new b(G.objectInvokeFailure,t))}else this.notifyError(e,new b(G.wasmInitMissing))}}}();