UNPKG

57.3 kBJavaScriptView Raw
1/*! ****************************************************************************
2Copyright (c) Microblink. All rights reserved.
3
4THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
5KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
6WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
7MERCHANTABLITY OR NON-INFRINGEMENT.
8***************************************************************************** */
9!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).BlinkIDImageCaptureSDK={})}(this,(function(e){"use strict";
10/*! *****************************************************************************
11Copyright (c) Microsoft Corporation.
12
13Permission to use, copy, modify, and/or distribute this software for any
14purpose with or without fee is hereby granted.
15
16THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
17REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
18AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
19INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
20LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
21OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
22PERFORMANCE OF THIS SOFTWARE.
23***************************************************************************** */function t(e,t,r,s){return new(r||(r=Promise))((function(o,i){function a(e){try{A(s.next(e))}catch(e){i(e)}}function n(e){try{A(s.throw(e))}catch(e){i(e)}}function A(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,n)}A((s=s.apply(e,t||[])).next())}))}let r=0;class s{constructor(e){this.action=e,this.messageID=function(){const e=r;return r+=1,e}()}}class o extends s{constructor(e,t){super(o.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.numberOfWorkers=e.numberOfWorkers}}var i,a,n;o.action="init",function(e){e[e.Any=0]="Any",e[e.Recognizer=1]="Recognizer",e[e.RecognizerSettings=2]="RecognizerSettings",e[e.Callback=3]="Callback"}(i||(i={}));class A extends s{constructor(e,t){super(A.action),this.className=e,this.params=t}}A.action="createNewNativeObject";class E extends s{constructor(e,t,r){super(E.action),this.recognizerHandles=e,this.allowMultipleResults=t,this.registeredMetadataCallbacks=r}}E.action="createRecognizerRunner";class R extends s{constructor(e,t){super(R.action),this.recognizerHandles=e,this.allowMultipleResults=t}}R.action="reconfigureRecognizerRunner";class I extends s{constructor(){super(I.action)}}I.action="deleteRecognizerRunner";class N extends s{constructor(e,t,r){super(N.action),this.objectHandle=e,this.methodName=t,this.params=r}}N.action="invokeObject";class c extends s{constructor(e){super(c.action),this.frame=e}getTransferrables(){return[this.frame.imageData.data.buffer]}}c.action="processImage";class _ extends s{constructor(e){super(_.action),this.hardReset=e}}_.action="resetRecognizers";class S{constructor(){this.onDebugText=!1,this.onDetectionFailed=!1,this.onQuadDetection=!1,this.onPointsDetection=!1,this.onFirstSideResult=!1,this.onGlare=!1}}class O extends s{constructor(e){super(O.action),this.registeredMetadataCallbacks=e}}O.action="registerMetadataCallbacks";class d extends s{constructor(e){super(d.action),this.detectionOnlyMode=e}}d.action="setDetectionOnly";class l extends s{constructor(e){super(l.action),this.callbackNonEmpty=e}}l.action="setClearTimeoutCallback";class C extends s{constructor(e){super(C.action),this.cameraPreviewMirrored=e}}C.action="setCameraPreviewMirrored";class T extends s{constructor(e){super(T.action),this.userId=e}}T.action="getProductIntegrationInfo",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.clearTimeoutCallback=5]="clearTimeoutCallback",e[e.onGlare=6]="onGlare",e[e.recognizerCallback=7]="recognizerCallback"}(a||(a={})),(n=e.WasmType||(e.WasmType={})).Basic="BASIC",n.Advanced="ADVANCED",n.AdvancedWithThreads="ADVANCED_WITH_THREADS";function D(e,t){return r=>{const s=r;s.success?e():t(s.error)}}function u(e,t){return r=>{const s=r;s.success?e(r):t(s.error)}}class L{constructor(e,t,r){this.wasmSDKWorker=e,this.objectHandle=r,this.recognizerName=t,this.callbacks=new Map}getRemoteObjectHandle(){return this.objectHandle}currentSettings(){return new Promise(((e,t)=>{if(0>this.objectHandle)return void t("Invalid object handle: "+this.objectHandle);const r=new N(this.objectHandle,"currentSettings",[]),s=u((t=>{e(t.result)}),t);this.wasmSDKWorker.postMessage(r,s)}))}toSignedJSON(){return Promise.resolve(null)}clearAllCallbacks(){this.callbacks.clear(),this.wasmSDKWorker.unregisterRecognizerCallbacks(this.objectHandle)}removeFunctions(e){this.clearAllCallbacks();const t=Object.keys(e);let r=!1;for(const s of t){const t=e[s];if("function"==typeof t){this.callbacks.set(s,t);e[s]={parameter:{recognizerHandle:this.objectHandle,callbackName:s},type:i.Callback},r=!0}}return r&&this.wasmSDKWorker.registerRecognizerCallbacks(this.objectHandle,this),e}updateSettings(e){return new Promise(((t,r)=>{if(0>this.objectHandle)return void r("Invalid object handle: "+this.objectHandle);const s=new N(this.objectHandle,"updateSettings",[{parameter:this.removeFunctions(e),type:i.RecognizerSettings}]),o=D(t,r);this.wasmSDKWorker.postMessage(s,o)}))}invokeCallback(e,t){const r=this.callbacks.get(e);void 0!==r?r(...t):console.warn("Cannot find callback",e)}getResult(){return new Promise(((e,t)=>{if(0>this.objectHandle)return void t("Invalid object handle: "+this.objectHandle);const r=new N(this.objectHandle,"getResult",[]),s=u((t=>{e(t.result)}),t);this.wasmSDKWorker.postMessage(r,s)}))}delete(){return new Promise(((e,t)=>{if(0>this.objectHandle)return void t("Invalid object handle: "+this.objectHandle);this.clearAllCallbacks();const r=new N(this.objectHandle,"delete",[]),s=D((()=>{this.objectHandle=-1,e()}),t);this.wasmSDKWorker.postMessage(r,s)}))}}function M(e){const t=new S;return t.onDebugText=!!e.onDebugText,t.onDetectionFailed=!!e.onDetectionFailed,t.onPointsDetection=!!e.onPointsDetection,t.onQuadDetection=!!e.onQuadDetection,t.onFirstSideResult=!!e.onFirstSideResult,t.onGlare=!!e.onGlare,t}class U{constructor(e){this.deleted=!1,this.wasmSDKWorker=e}processImage(e){return new Promise(((t,r)=>{if(this.deleted)return void r("Recognizer runner is deleted. It cannot be used anymore!");const s=new c(e),o=u((e=>{t(e.recognitionState)}),r);this.wasmSDKWorker.postTransferrableMessage(s,o)}))}reconfigureRecognizers(e,t){return new Promise(((r,s)=>{if(this.deleted)return void s("Recognizer runner is deleted. It cannot be used anymore!");const o=g(e),i=new R(o,t),a=D(r,s);this.wasmSDKWorker.postMessage(i,a)}))}setMetadataCallbacks(e){return new Promise(((t,r)=>{const s=new O(M(e)),o=D(t,r);this.wasmSDKWorker.postMessageAndRegisterCallbacks(s,e,o)}))}resetRecognizers(e){return new Promise(((t,r)=>{const s=new _(e),o=D(t,r);this.wasmSDKWorker.postMessage(s,o)}))}setDetectionOnlyMode(e){return new Promise(((t,r)=>{const s=new d(e),o=D(t,r);this.wasmSDKWorker.postMessage(s,o)}))}setClearTimeoutCallback(e){return new Promise(((t,r)=>{const s=new l(null!==e),o=D(t,r);this.wasmSDKWorker.registerClearTimeoutCallback(e),this.wasmSDKWorker.postMessage(s,o)}))}setCameraPreviewMirrored(e){return new Promise(((t,r)=>{const s=new C(e),o=D(t,r);this.wasmSDKWorker.postMessage(s,o)}))}delete(){return this.deleted?Promise.reject("Recognizer runner is already deleted."):new Promise(((e,t)=>{const r=new I,s=D((()=>{this.deleted=!0,e()}),t);this.wasmSDKWorker.postMessage(r,s)}))}}function g(e){const t=[];for(const r of e)t.push(r.getRemoteObjectHandle());return t}class m{constructor(e){this.wasmSDKWorker=e}createRecognizerRunner(e,t=!1,r={}){return new Promise(((s,o)=>{const i=g(e),a=new E(i,t,M(r)),n=D((()=>{s(new U(this.wasmSDKWorker))}),o);this.wasmSDKWorker.postMessageAndRegisterCallbacks(a,r,n)}))}newRecognizer(e,...t){return new Promise(((r,s)=>{const o=new A(e,function(e){const t=[];for(let r of e){let e=i.Any;r instanceof L&&(e=i.Recognizer,r=r.getRemoteObjectHandle()),t.push({parameter:r,type:e})}return t}(t)),a=u((t=>{const s=new L(this.wasmSDKWorker,e,t.objectHandle);r(s)}),s);this.wasmSDKWorker.postMessage(o,a)}))}}class h{constructor(t,r,s,o){this.eventHandlers={},this.metadataCallbacks={},this.clearTimeoutCallback=null,this.loadedWasmType=e.WasmType.Basic,this.mbWasmWorker=t,this.mbWasmWorker.onmessage=e=>{this.handleWorkerEvent(e)},this.mbWasmWorker.onerror=()=>{o("Problem during initialization of worker file!")},this.mbWasmModule=new m(this),this.loadCallback=r,this.recognizersWithCallbacks=new Map,this.userId=s,this.showOverlay=!1}postMessage(e,t){this.eventHandlers[e.messageID]=t,this.mbWasmWorker.postMessage(e)}postTransferrableMessage(e,t){this.eventHandlers[e.messageID]=t,this.mbWasmWorker.postMessage(e,e.getTransferrables())}postMessageAndRegisterCallbacks(e,t,r){this.eventHandlers[e.messageID]=r,this.metadataCallbacks=t,this.mbWasmWorker.postMessage(e)}registerClearTimeoutCallback(e){this.clearTimeoutCallback=e}registerRecognizerCallbacks(e,t){this.recognizersWithCallbacks.set(e,t)}unregisterRecognizerCallbacks(e){this.recognizersWithCallbacks.delete(e)}delete(){this.mbWasmWorker.terminate()}getProductIntegrationInfo(){return new Promise(((e,t)=>{const r=new T(this.userId),s=u((t=>{e(t.result)}),t);this.postMessage(r,s)}))}handleWorkerEvent(e){if("isCallbackMessage"in e.data){const t=e.data;switch(t.callbackType){case a.onDebugText:"function"==typeof this.metadataCallbacks.onDebugText&&this.metadataCallbacks.onDebugText(t.callbackParameters[0]);break;case a.onDetectionFailed:"function"==typeof this.metadataCallbacks.onDetectionFailed&&this.metadataCallbacks.onDetectionFailed();break;case a.onPointsDetection:"function"==typeof this.metadataCallbacks.onPointsDetection&&this.metadataCallbacks.onPointsDetection(t.callbackParameters[0]);break;case a.onQuadDetection:"function"==typeof this.metadataCallbacks.onQuadDetection&&this.metadataCallbacks.onQuadDetection(t.callbackParameters[0]);break;case a.onFirstSideResult:"function"==typeof this.metadataCallbacks.onFirstSideResult&&this.metadataCallbacks.onFirstSideResult();break;case a.clearTimeoutCallback:this.clearTimeoutCallback&&"function"==typeof this.clearTimeoutCallback.onClearTimeout&&this.clearTimeoutCallback.onClearTimeout();break;case a.onGlare:"function"==typeof this.metadataCallbacks.onGlare&&this.metadataCallbacks.onGlare(t.callbackParameters[0]);break;case a.recognizerCallback:{const e=t.callbackParameters.shift(),r=this.recognizersWithCallbacks.get(e.recognizerHandle);void 0!==r?r.invokeCallback(e.callbackName,t.callbackParameters):console.warn("Cannot find recognizer to deliver callback message. Maybe it's destroyed?",e);break}default:throw Error("Unknown callback type: "+a[t.callbackType])}}else if("isLoadProgressMessage"in e.data){const t=e.data;"function"==typeof this.loadCallback&&this.loadCallback(t.progress)}else{const t=e.data,r=this.eventHandlers[t.messageID];delete this.eventHandlers[t.messageID],r(t)}}static createWasmWorker(e,r,s){return t(this,void 0,void 0,(function*(){return new Promise(((t,i)=>{const a=new h(e,r.loadProgressCallback,s,i),n=new o(r,s),A=u((e=>{const r=e;a.showOverlay=r.showOverlay,a.loadedWasmType=r.wasmType,t(a)}),(e=>{a&&"function"==typeof a.delete&&a.delete(),i(e)}));a.postMessage(n,A)}))}))}}class P{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}}var G,F;(G=e.ErrorCodes||(e.ErrorCodes={})).WORKER_WASM_LOAD_FAILURE="WORKER_WASM_LOAD_FAILURE",G.WORKER_WASM_INIT_MISSING="WORKER_WASM_INIT_MISSING",G.WORKER_FUNCTION_INVOKE_FAILURE="WORKER_FUNCTION_INVOKE_FAILURE",G.WORKER_RECOGNIZER_CREATION_FAILURE="WORKER_RECOGNIZER_CREATION_FAILURE",G.WORKER_RUNNER_EXISTS="WORKER_RUNNER_EXISTS",G.WORKER_RUNNER_CREATION_FAILURE="WORKER_RUNNER_CREATION_FAILURE",G.WORKER_RUNNER_MISSING="WORKER_RUNNER_MISSING",G.WORKER_RUNNER_RECONFIGURE_FAILURE="WORKER_RUNNER_RECONFIGURE_FAILURE",G.WORKER_RUNNER_DELETED="WORKER_RUNNER_DELETED",G.WORKER_RUNNER_DELETE_FAILURE="WORKER_RUNNER_DELETE_FAILURE",G.WORKER_OBJECT_INVOKE_FAILURE="WORKER_OBJECT_INVOKE_FAILURE",G.WORKER_IMAGE_PROCESS_FAILURE="WORKER_IMAGE_PROCESS_FAILURE",G.WORKER_HANDLE_UNDEFINED="WORKER_HANDLE_UNDEFINED",G.WORKER_MESSAGE_ACTION_UNKNOWN="WORKER_MESSAGE_ACTION_UNKNOWN",G.WORKER_LICENSE_UNLOCK_ERROR="WORKER_LICENSE_UNLOCK_ERROR",G.WORKER_INTEGRATION_INFO_FAILURE="WORKER_INTEGRATION_INFO_FAILURE",G.LOCAL_SDK_RUNNER_MISSING="LOCAL_SDK_RUNNER_MISSING",G.LOCAL_SDK_RUNNER_EMPTY="LOCAL_SDK_RUNNER_EMPTY",G.LICENSE_UNLOCK_ERROR="LICENSE_UNLOCK_ERROR",G.FRAME_CAPTURE_SVG_UNSUPPORTED="FRAME_CAPTURE_SVG_UNSUPPORTED",G.FRAME_CAPTURE_CANVAS_MISSING="FRAME_CAPTURE_CANVAS_MISSING",G.SDK_WASM_SETTINGS_MISSING="SDK_WASM_SETTINGS_MISSING",G.SDK_LICENSE_KEY_MISSING="SDK_LICENSE_KEY_MISSING",G.SDK_WASM_MODULE_NAME_MISSING="SDK_WASM_MODULE_NAME_MISSING",G.SDK_ENGINE_LOCATION_INVALID="SDK_ENGINE_LOCATION_INVALID",G.SDK_WORKER_LOCATION_INVALID="SDK_WORKER_LOCATION_INVALID",G.SDK_MISSING="SDK_MISSING",G.SDK_RECOGNIZERS_MISSING="SDK_RECOGNIZERS_MISSING",G.VIDEO_RECOGNIZER_ELEMENT_MISSING="VIDEO_RECOGNIZER_ELEMENT_MISSING",G.VIDEO_RECOGNIZER_CAMERA_MISSING="VIDEO_RECOGNIZER_CAMERA_MISSING",G.VIDEO_RECOGNIZER_CAMERA_NOT_ALLOWED="VIDEO_RECOGNIZER_CAMERA_NOT_ALLOWED",G.VIDEO_RECOGNIZER_CAMERA_UNAVAILABLE="VIDEO_RECOGNIZER_CAMERA_UNAVAILABLE",G.VIDEO_RECOGNIZER_CAMERA_IN_USE="VIDEO_RECOGNIZER_CAMERA_IN_USE",G.VIDEO_RECOGNIZER_MEDIA_DEVICES_UNSUPPORTED="VIDEO_RECOGNIZER_MEDIA_DEVICES_UNSUPPORTED",G.VIDEO_RECOGNIZER_FEED_RELEASED="VIDEO_RECOGNIZER_FEED_RELEASED",G.VIDEO_RECOGNIZER_FEED_NOT_PAUSED="VIDEO_RECOGNIZER_FEED_NOT_PAUSED",G.VIDEO_RECOGNIZER_PLAY_REQUEST_INTERRUPTED="VIDEO_RECOGNIZER_PLAY_REQUEST_INTERRUPTED",G.VIDEO_RECOGNIZER_FEED_PAUSED="VIDEO_RECOGNIZER_FEED_PAUSED",G.VIDEO_RECOGNIZER_RECOGNIZERS_RESET_FAILURE="VIDEO_RECOGNIZER_RECOGNIZERS_RESET_FAILURE",G.VIDEO_RECOGNIZER_FEED_MISSING="VIDEO_RECOGNIZER_FEED_MISSING",(F=e.ErrorMessages||(e.ErrorMessages={})).WORKER_HANDLE_UNDEFINED="Cannot find object with handle: undefined",F.WORKER_WASM_LOAD_FAILURE="Failed to load WASM in web worker!",F.WORKER_WASM_INIT_MISSING="WASM module is not initialized!",F.WORKER_FUNCTION_INVOKE_FAILURE="Failed to invoke function!",F.WORKER_RECOGNIZER_CREATION_FAILURE="Failed to create new recognizer!",F.WORKER_RUNNER_EXISTS="Recognizer runner is already created! Multiple instances are not allowed!",F.WORKER_RUNNER_CREATION_FAILURE="Failed to create new recognizer runner!",F.WORKER_RUNNER_MISSING="Recognizer runner is not created! There is nothing to reconfigure!",F.WORKER_RUNNER_RECONFIGURE_FAILURE="Failed to reconfigure recognizer runner!",F.WORKER_RUNNER_DELETED="Recognizer runner is already deleted!",F.WORKER_RUNNER_DELETE_FAILURE="Failed to delete recognizer runner!",F.WORKER_OBJECT_INVOKE_FAILURE="Failed to invoke object!",F.WORKER_IMAGE_PROCESS_FAILURE="Recognizer runner is not initialized! Cannot process image!",F.WORKER_INTEGRATION_INFO_FAILURE="Failed to get product integration info!",F.LOCAL_SDK_RUNNER_MISSING="Property nativeRecognizerRunner is not available!",F.LOCAL_SDK_RUNNER_EMPTY="Native RecognizerRunner cannot be empty!",F.LICENSE_TOKEN_STATE_INCORRECT="Internal error (Incorrect token state)",F.LICENSE_PAYLOAD_VERIFICATION_FAILED="Failed to verify server permission's digital signature!",F.LICENSE_PAYLOAD_CORRUPTED="Server permission payload is corrupted!",F.LICENSE_PERMISSION_EXPIRED="Internal error (server permission expired)",F.LICENSE_REMOTE_LOCKED="Provided license key has been remotely locked. Please contact support for more information!",F.FRAME_CAPTURE_SVG_UNSUPPORTED="Recognition of SVG elements not supported!",F.FRAME_CAPTURE_CANVAS_MISSING="Could not get canvas 2d context!",F.SDK_WASM_SETTINGS_MISSING="Missing WASM load settings!",F.SDK_LICENSE_KEY_MISSING="Missing license key!",F.SDK_WASM_MODULE_NAME_MISSING="Missing WASM module name!",F.SDK_ENGINE_LOCATION_INVALID="Setting property 'engineLocation' must be a string!",F.SDK_WORKER_LOCATION_INVALID="Setting property 'workerLocation' must be a string!",F.SDK_MISSING="SDK is not provided!",F.SDK_RECOGNIZERS_MISSING="To create RecognizerRunner at least 1 recognizer is required.",F.VIDEO_RECOGNIZER_ELEMENT_MISSING="Video element, i.e. camera feed is not provided!",F.VIDEO_RECOGNIZER_CAMERA_MISSING="Camera not found!",F.VIDEO_RECOGNIZER_CAMERA_NOT_ALLOWED="Camera not allowed!",F.VIDEO_RECOGNIZER_CAMERA_UNAVAILABLE="Camera not available!",F.VIDEO_RECOGNIZER_CAMERA_IN_USE="Camera in use!",F.VIDEO_RECOGNIZER_MEDIA_DEVICES_UNSUPPORTED="Media devices not supported by browser.",F.VIDEO_RECOGNIZER_FEED_RELEASED="The associated video feed has been released!",F.VIDEO_RECOGNIZER_FEED_NOT_PAUSED="The associated video feed is not paused. Use resumeRecognition instead!",F.VIDEO_RECOGNIZER_PLAY_REQUEST_INTERRUPTED="The play() request was interrupted or prevented by browser security rules!",F.VIDEO_RECOGNIZER_FEED_PAUSED="Cannot resume recognition while video feed is paused! Use recognize or startRecognition",F.VIDEO_RECOGNIZER_RECOGNIZERS_RESET_FAILURE="Could not reset recognizers!",F.VIDEO_RECOGNIZER_FEED_MISSING="Missing video feed!";const p={feedMissing:{message:e.ErrorMessages.VIDEO_RECOGNIZER_FEED_MISSING,code:e.ErrorCodes.VIDEO_RECOGNIZER_FEED_MISSING},recognizersResetFailure:{message:e.ErrorMessages.VIDEO_RECOGNIZER_RECOGNIZERS_RESET_FAILURE,code:e.ErrorCodes.VIDEO_RECOGNIZER_RECOGNIZERS_RESET_FAILURE},feedPaused:{message:e.ErrorMessages.VIDEO_RECOGNIZER_FEED_PAUSED,code:e.ErrorCodes.VIDEO_RECOGNIZER_FEED_PAUSED},playRequestInterrupted:{message:e.ErrorMessages.VIDEO_RECOGNIZER_PLAY_REQUEST_INTERRUPTED,code:e.ErrorCodes.VIDEO_RECOGNIZER_PLAY_REQUEST_INTERRUPTED},videoFeedNotPaused:{message:e.ErrorMessages.VIDEO_RECOGNIZER_FEED_NOT_PAUSED,code:e.ErrorCodes.VIDEO_RECOGNIZER_FEED_NOT_PAUSED},videoFeedReleased:{message:e.ErrorMessages.VIDEO_RECOGNIZER_FEED_RELEASED,code:e.ErrorCodes.VIDEO_RECOGNIZER_FEED_RELEASED},mediaDevicesUnsupported:{code:e.ErrorCodes.VIDEO_RECOGNIZER_MEDIA_DEVICES_UNSUPPORTED,message:e.ErrorMessages.VIDEO_RECOGNIZER_MEDIA_DEVICES_UNSUPPORTED},cameraMissing:{code:e.ErrorCodes.VIDEO_RECOGNIZER_CAMERA_MISSING,message:e.ErrorMessages.VIDEO_RECOGNIZER_CAMERA_MISSING},elementMissing:{message:e.ErrorMessages.VIDEO_RECOGNIZER_ELEMENT_MISSING,code:e.ErrorCodes.VIDEO_RECOGNIZER_ELEMENT_MISSING}},K={wasmSettingsMissing:{message:e.ErrorMessages.SDK_WASM_SETTINGS_MISSING,code:e.ErrorCodes.SDK_WASM_SETTINGS_MISSING},licenseKeyMissing:{message:e.ErrorMessages.SDK_LICENSE_KEY_MISSING,code:e.ErrorCodes.SDK_LICENSE_KEY_MISSING},wasmModuleNameMissing:{message:e.ErrorMessages.SDK_WASM_MODULE_NAME_MISSING,code:e.ErrorCodes.SDK_WASM_MODULE_NAME_MISSING},engineLocationInvalid:{message:e.ErrorMessages.SDK_ENGINE_LOCATION_INVALID,code:e.ErrorCodes.SDK_ENGINE_LOCATION_INVALID},workerLocationInvalid:{message:e.ErrorMessages.SDK_WORKER_LOCATION_INVALID,code:e.ErrorCodes.SDK_WORKER_LOCATION_INVALID},missing:{message:e.ErrorMessages.SDK_MISSING,code:e.ErrorCodes.SDK_MISSING},recognizersMissing:{message:e.ErrorMessages.SDK_RECOGNIZERS_MISSING,code:e.ErrorCodes.SDK_RECOGNIZERS_MISSING}},v={svgUnsupported:{message:e.ErrorMessages.FRAME_CAPTURE_SVG_UNSUPPORTED,code:e.ErrorCodes.FRAME_CAPTURE_SVG_UNSUPPORTED},canvasMissing:{message:e.ErrorMessages.FRAME_CAPTURE_CANVAS_MISSING,code:e.ErrorCodes.FRAME_CAPTURE_CANVAS_MISSING}},W={licenseTokenStateIncorrect:{code:e.ErrorCodes.LICENSE_UNLOCK_ERROR,message:e.ErrorMessages.LICENSE_TOKEN_STATE_INCORRECT},licensePayloadVerificationFailed:{code:e.ErrorCodes.LICENSE_UNLOCK_ERROR,message:e.ErrorMessages.LICENSE_PAYLOAD_VERIFICATION_FAILED},licensePayloadCorrupted:{code:e.ErrorCodes.LICENSE_UNLOCK_ERROR,message:e.ErrorMessages.LICENSE_PAYLOAD_CORRUPTED},licensePermissionExpired:{code:e.ErrorCodes.LICENSE_UNLOCK_ERROR,message:e.ErrorMessages.LICENSE_PERMISSION_EXPIRED},licenseRemoteLocked:{code:e.ErrorCodes.LICENSE_UNLOCK_ERROR,message:e.ErrorMessages.LICENSE_REMOTE_LOCKED},licenseNetworkError:{code:e.ErrorCodes.LICENSE_UNLOCK_ERROR},licenseInvalid:{code:e.ErrorCodes.LICENSE_UNLOCK_ERROR}},b={runnerMissing:{message:e.ErrorMessages.LOCAL_SDK_RUNNER_MISSING,code:e.ErrorCodes.LOCAL_SDK_RUNNER_MISSING},runnerEmpty:{message:e.ErrorMessages.LOCAL_SDK_RUNNER_EMPTY,code:e.ErrorCodes.LOCAL_SDK_RUNNER_EMPTY}},f={imageProcessFailure:{message:e.ErrorMessages.WORKER_IMAGE_PROCESS_FAILURE,code:e.ErrorCodes.WORKER_IMAGE_PROCESS_FAILURE},objectInvokeFailure:{message:e.ErrorMessages.WORKER_OBJECT_INVOKE_FAILURE,code:e.ErrorCodes.WORKER_OBJECT_INVOKE_FAILURE},runnerDeleteFailure:{message:e.ErrorMessages.WORKER_RUNNER_DELETE_FAILURE,code:e.ErrorCodes.WORKER_RUNNER_DELETE_FAILURE},runnerDeleted:{message:e.ErrorMessages.WORKER_RUNNER_DELETED,code:e.ErrorCodes.WORKER_RUNNER_DELETED},runnerReconfigureFailure:{message:e.ErrorMessages.WORKER_RUNNER_RECONFIGURE_FAILURE,code:e.ErrorCodes.WORKER_RUNNER_RECONFIGURE_FAILURE},runnerMissing:{message:e.ErrorMessages.WORKER_RUNNER_MISSING,code:e.ErrorCodes.WORKER_RUNNER_MISSING},runnerCreationFailure:{message:e.ErrorMessages.WORKER_RUNNER_CREATION_FAILURE,code:e.ErrorCodes.WORKER_RUNNER_CREATION_FAILURE},runnerExists:{message:e.ErrorMessages.WORKER_RUNNER_EXISTS,code:e.ErrorCodes.WORKER_RUNNER_EXISTS},recognizerCreationFailure:{message:e.ErrorMessages.WORKER_RECOGNIZER_CREATION_FAILURE,code:e.ErrorCodes.WORKER_RECOGNIZER_CREATION_FAILURE},functionInvokeFailure:{message:e.ErrorMessages.WORKER_FUNCTION_INVOKE_FAILURE,code:e.ErrorCodes.WORKER_FUNCTION_INVOKE_FAILURE},wasmInitMissing:{message:e.ErrorMessages.WORKER_WASM_INIT_MISSING,code:e.ErrorCodes.WORKER_WASM_INIT_MISSING},wasmLoadFailure:{message:e.ErrorMessages.WORKER_WASM_LOAD_FAILURE,code:e.ErrorCodes.WORKER_WASM_LOAD_FAILURE},handleUndefined:{message:e.ErrorMessages.WORKER_HANDLE_UNDEFINED,code:e.ErrorCodes.WORKER_HANDLE_UNDEFINED},integrationInfoFailure:{message:e.ErrorMessages.WORKER_INTEGRATION_INFO_FAILURE,code:e.ErrorCodes.WORKER_INTEGRATION_INFO_FAILURE}};var w;(w=e.PreferredCameraType||(e.PreferredCameraType={}))[w.BackFacingCamera=0]="BackFacingCamera",w[w.FrontFacingCamera=1]="FrontFacingCamera";const y=["rear","back","rück","arrière","trasera","trás","traseira","posteriore","后面","後面","背面","后置","後置","背置","задней","الخلفية","후","arka","achterzijde","หลัง","baksidan","bagside","sau","bak","tylny","takakamera","belakang","אחורית","πίσω","spate","hátsó","zadní","darrere","zadná","задня","stražnja","belakang","बैक"];function k(e){const t=e.toLowerCase();return y.some((e=>t.includes(e)))}class V{constructor(e,t){this.deviceId=e.deviceId,this.facing=t,this.groupId=e.groupId,this.label=e.label}}function H(){return t(this,void 0,void 0,(function*(){const t=[],r=[];{let s=yield navigator.mediaDevices.enumerateDevices();if(s.filter((e=>"videoinput"===e.kind)).every((e=>""===e.label))){const e=yield navigator.mediaDevices.getUserMedia({video:{facingMode:{ideal:"environment"}},audio:!1});s=yield navigator.mediaDevices.enumerateDevices(),e.getTracks().forEach((e=>e.stop()))}const o=s.filter((e=>"videoinput"===e.kind));for(const s of o)k(s.label)?r.push(new V(s,e.PreferredCameraType.BackFacingCamera)):t.push(new V(s,e.PreferredCameraType.FrontFacingCamera))}return{frontCameras:t,backCameras:r}}))}function B(r,s){return t(this,void 0,void 0,(function*(){const{frontCameras:t,backCameras:o}=yield H();if(t.length>0||o.length>0){let i=o.length>0?o:t;s===e.PreferredCameraType.BackFacingCamera&&o.length>0&&(i=o),s===e.PreferredCameraType.FrontFacingCamera&&t.length>0&&(i=t),i=i.sort(((e,t)=>e.label.localeCompare(t.label)));{let e=0;const s=i.map((e=>{const t=RegExp(/\b([0-9]+)MP?\b/,"i").exec(e.label);return null!==t?parseInt(t[1],10):NaN}));if(s.some((e=>isNaN(e)))||(e=s.lastIndexOf(Math.max(...s))),r){let e=null;return e=t.filter((e=>e.deviceId===r))[0],e||(e=o.filter((e=>e.deviceId===r))[0]),e||null}return i[e]}}return null}))}function Y(r,s,o=e.PreferredCameraType.BackFacingCamera){return t(this,void 0,void 0,(function*(){const t={audio:!1,video:{width:{min:640,ideal:1920,max:1920},height:{min:480,ideal:1080,max:1080}}};if(""===r.deviceId){t.video.facingMode={ideal:o===e.PreferredCameraType.BackFacingCamera?"environment":"user"}}else t.video.deviceId={exact:r.deviceId};const i=yield navigator.mediaDevices.getUserMedia(t);s.controls=!1,s.srcObject=i;let a=!1;return r.facing===e.PreferredCameraType.FrontFacingCamera&&(s.style.transform="scaleX(-1)",a=!0),a}))}function Z(e){e&&null!==e.srcObject&&(e.srcObject.getTracks().forEach((e=>e.stop())),e.srcObject=null)}var z,j;let x;(z=e.ImageOrientation||(e.ImageOrientation={}))[z.RotatedLeft90=0]="RotatedLeft90",z[z.NoRotation=1]="NoRotation",z[z.RotatedRight90=2]="RotatedRight90",z[z.Rotated180=3]="Rotated180",(j=e.RecognizerResultState||(e.RecognizerResultState={}))[j.Empty=0]="Empty",j[j.Uncertain=1]="Uncertain",j[j.Valid=2]="Valid",j[j.StageValid=3]="StageValid";class J{constructor(e,t,r){this.imageData=e,this.orientation=t,this.videoFrame=r}}function Q(t){let r,s,o=!1;if(t instanceof HTMLVideoElement)r=t.videoWidth,s=t.videoHeight,o=!0;else if(t instanceof HTMLImageElement)r=t.naturalWidth,s=t.naturalHeight;else{if(t instanceof SVGImageElement)throw new P(v.svgUnsupported);r=t.width,s=t.height}x=x||document.createElement("canvas"),x.width=r,x.height=s;const i=x.getContext("2d");if(!i)throw new P(v.canvasMissing);i.drawImage(t,0,0,x.width,x.height);const a=i.getImageData(0,0,x.width,x.height);return new J(a,e.ImageOrientation.NoRotation,o)}var X,q;(X=e.LicenseTokenState||(e.LicenseTokenState={}))[X.Invalid=0]="Invalid",X[X.RequiresServerPermission=1]="RequiresServerPermission",X[X.Valid=2]="Valid",(q=e.LicenseErrorType||(e.LicenseErrorType={})).LicenseTokenStateInvalid="LICENSE_TOKEN_STATE_INVALID",q.NetworkError="NETWORK_ERROR",q.RemoteLock="REMOTE_LOCK",q.PermissionExpired="PERMISSION_EXPIRED",q.PayloadCorrupted="PAYLOAD_CORRUPTED",q.PayloadSignatureVerificationFailed="PAYLOAD_SIGNATURE_VERIFICATION_FAILED",q.IncorrectTokenState="INCORRECT_TOKEN_STATE";function $(e){return{licenseId:e.licenseId,licensee:e.licensee,packageName:e.packageName,platform:"Browser",sdkName:e.sdkName,sdkVersion:e.sdkVersion}}var ee,te,re,se;function oe(r,s){return t(this,void 0,void 0,(function*(){try{const t=yield fetch("https://baltazar.microblink.com/api/v1/status/check",{method:"POST",headers:{"Content-Type":"application/json"},cache:"no-cache",body:JSON.stringify($(r))});if(t.ok){const e=""+(yield t.text());return s.submitServerPermission(e)}return{status:e.ServerPermissionSubmitResultStatus.NetworkError,lease:0,networkErrorDescription:"Server responded with status "+t.status}}catch(t){return{status:e.ServerPermissionSubmitResultStatus.NetworkError,lease:0,networkErrorDescription:"Unexpected error: "+JSON.stringify(t)}}}))}(ee=e.ServerPermissionSubmitResultStatus||(e.ServerPermissionSubmitResultStatus={}))[ee.Ok=0]="Ok",ee[ee.NetworkError=1]="NetworkError",ee[ee.RemoteLock=2]="RemoteLock",ee[ee.PermissionExpired=3]="PermissionExpired",ee[ee.PayloadCorrupted=4]="PayloadCorrupted",ee[ee.PayloadSignatureVerificationFailed=5]="PayloadSignatureVerificationFailed",ee[ee.IncorrectTokenState=6]="IncorrectTokenState",(te=e.DetectionStatus||(e.DetectionStatus={}))[te.Fail=0]="Fail",te[te.Success=1]="Success",te[te.CameraTooHigh=2]="CameraTooHigh",te[te.FallbackSuccess=3]="FallbackSuccess",te[te.Partial=4]="Partial",te[te.CameraAtAngle=5]="CameraAtAngle",te[te.CameraTooNear=6]="CameraTooNear",te[te.DocumentTooCloseToEdge=7]="DocumentTooCloseToEdge",(re=e.NotSupportedReason||(e.NotSupportedReason={})).MediaDevicesNotSupported="MediaDevicesNotSupported",re.CameraNotFound="CameraNotFound",re.CameraNotAllowed="CameraNotAllowed",re.CameraInUse="CameraInUse",re.CameraNotAvailable="CameraNotAvailable",re.VideoElementNotProvided="VideoElementNotProvided",(se=e.VideoRecognitionMode||(e.VideoRecognitionMode={}))[se.Recognition=0]="Recognition",se[se.RecognitionTest=1]="RecognitionTest",se[se.DetectionTest=2]="DetectionTest";class ie{constructor(t,r,s=!1,o=!1,i=null){this.deviceId=null,this.videoFeed=null,this.cancelled=!1,this.timedOut=!1,this.recognitionPaused=!1,this.recognitionTimeoutMs=2e4,this.timeoutID=0,this.videoRecognitionMode=e.VideoRecognitionMode.Recognition,this.onScanningDone=null,this.allowManualVideoPlayout=!1,this.cameraFlipped=!1,this.shouldReleaseVideoFeed=!1,this.videoFeed=t,this.recognizerRunner=r,this.cameraFlipped=s,this.allowManualVideoPlayout=o,this.deviceId=i}static createVideoRecognizerFromCameraStream(r,s,o=null,i=e.PreferredCameraType.BackFacingCamera){return t(this,void 0,void 0,(function*(){return new Promise(((a,n)=>t(this,void 0,void 0,(function*(){if(r&&r instanceof Element)if(navigator.mediaDevices&&void 0!==navigator.mediaDevices.getUserMedia)try{const t=yield B(o,i);if(null===t)return void n(new P(p.cameraMissing,{reason:e.NotSupportedReason.CameraNotFound}));const A=yield Y(t,r,i);yield s.setCameraPreviewMirrored(A),a(new ie(r,s,A,!1,t.deviceId))}catch(t){let r=e.NotSupportedReason.CameraInUse,s=e.ErrorCodes.VIDEO_RECOGNIZER_CAMERA_IN_USE;switch(t.name){case"NotFoundError":case"OverconstrainedError":r=e.NotSupportedReason.CameraNotFound,s=e.ErrorCodes.VIDEO_RECOGNIZER_CAMERA_MISSING;break;case"NotAllowedError":case"SecurityError":r=e.NotSupportedReason.CameraNotAllowed,s=e.ErrorCodes.VIDEO_RECOGNIZER_CAMERA_NOT_ALLOWED;break;case"AbortError":case"NotReadableError":r=e.NotSupportedReason.CameraNotAvailable,s=e.ErrorCodes.VIDEO_RECOGNIZER_CAMERA_UNAVAILABLE;break;case"TypeError":throw t}n(new P({message:t.message,code:s},{reason:r}))}else n(new P(p.mediaDevicesUnsupported,{reason:e.NotSupportedReason.MediaDevicesNotSupported}));else n(new P(p.elementMissing,{reason:e.NotSupportedReason.VideoElementNotProvided}))}))))}))}static createVideoRecognizerFromVideoPath(e,r,s){return t(this,void 0,void 0,(function*(){return new Promise((t=>{r.src=e,r.currentTime=0,r.onended=()=>{o.cancelRecognition()};const o=new ie(r,s);t(o)}))}))}flipCamera(){return t(this,void 0,void 0,(function*(){this.videoFeed&&(this.cameraFlipped?(this.videoFeed.style.transform="scaleX(1)",this.cameraFlipped=!1):(this.videoFeed.style.transform="scaleX(-1)",this.cameraFlipped=!0),yield this.recognizerRunner.setCameraPreviewMirrored(this.cameraFlipped))}))}isCameraFlipped(){return this.cameraFlipped}setVideoRecognitionMode(r){return t(this,void 0,void 0,(function*(){this.videoRecognitionMode=r;const t=this.videoRecognitionMode===e.VideoRecognitionMode.DetectionTest;yield this.recognizerRunner.setDetectionOnlyMode(t)}))}startRecognition(e,t=2e4){return new Promise(((r,s)=>{null!==this.videoFeed?this.videoFeed.paused?(this.cancelled=!1,this.recognitionPaused=!1,this.clearTimeout(),this.recognitionTimeoutMs=t,this.onScanningDone=e,this.recognizerRunner.setClearTimeoutCallback({onClearTimeout:()=>this.clearTimeout()}),this.videoFeed.play().then((()=>this.playPauseEvent().then((()=>r())).catch((e=>s(e)))),(e=>{this.allowManualVideoPlayout?this.videoFeed&&(this.videoFeed.controls=!0,this.videoFeed.addEventListener("play",(()=>{this.playPauseEvent().then().catch((e=>s(e)))})),this.videoFeed.addEventListener("pause",(()=>{this.playPauseEvent().then().catch((e=>s(e)))}))):s(new P(p.playRequestInterrupted,e))}))):s(new P(p.videoFeedNotPaused)):s(new P(p.videoFeedReleased))}))}recognize(e=2e4){return new Promise(((t,r)=>{try{this.startRecognition((e=>{this.pauseVideoFeed(),t(e)}),e).then().catch((e=>r(e)))}catch(e){r(e)}}))}cancelRecognition(){this.cancelled=!0}pauseVideoFeed(){this.pauseRecognition(),this.videoFeed&&this.videoFeed.pause()}pauseRecognition(){this.recognitionPaused=!0}resetRecognizers(e){return t(this,void 0,void 0,(function*(){yield this.recognizerRunner.resetRecognizers(e)}))}getRecognizerRunner(){return this.recognizerRunner}resumeRecognition(e){return new Promise(((t,r)=>{this.cancelled=!1,this.timedOut=!1,this.recognitionPaused=!1,this.videoFeed&&this.videoFeed.paused?r(new P(p.feedPaused)):setTimeout((()=>{e?this.resetRecognizers(!0).then((()=>{this.recognitionLoop().then((()=>t())).catch((e=>r(e)))})).catch((()=>{r(new P(p.recognizersResetFailure))})):this.recognitionLoop().then((()=>t())).catch((e=>r(e)))}),1)}))}releaseVideoFeed(){var e,t;this.videoFeed&&(null===(e=this.videoFeed)||void 0===e?void 0:e.readyState)>=(null===(t=this.videoFeed)||void 0===t?void 0:t.HAVE_CURRENT_DATA)?(this.videoFeed.paused||this.cancelRecognition(),Z(this.videoFeed),this.videoFeed=null,this.shouldReleaseVideoFeed=!1):this.shouldReleaseVideoFeed=!0}changeCameraDevice(e){return new Promise(((t,r)=>{null!==this.videoFeed?(this.pauseRecognition(),Z(this.videoFeed),Y(e,this.videoFeed).then((()=>{null!==this.videoFeed?this.videoFeed.play().then((()=>{this.resumeRecognition(!0),t()}),(e=>{this.allowManualVideoPlayout?this.videoFeed?this.videoFeed.controls=!0:r(new P(p.feedMissing)):r(new P(p.playRequestInterrupted,e))})):r(new P(p.feedMissing))})).catch((e=>r(e)))):r(new P(p.feedMissing))}))}playPauseEvent(){return new Promise(((e,t)=>{if(this.videoFeed&&this.videoFeed.paused)return this.cancelRecognition(),void e();this.resumeRecognition(!0).then((()=>e())).catch((e=>t(e)))}))}recognitionLoop(){return new Promise(((t,r)=>{if(!this.videoFeed)return void r(new P(p.feedMissing));if(this.shouldReleaseVideoFeed&&this.videoFeed.readyState>this.videoFeed.HAVE_CURRENT_DATA)return this.releaseVideoFeed(),void t();const s=Q(this.videoFeed);this.recognizerRunner.processImage(s).then((s=>{const o=()=>{this.recognitionPaused?t():setTimeout((()=>{this.recognitionLoop().then((()=>t())).catch((e=>r(e)))}),1)};if(s===e.RecognizerResultState.Valid||this.cancelled||this.timedOut){if(this.videoRecognitionMode!==e.VideoRecognitionMode.Recognition&&!this.cancelled)return void this.recognizerRunner.resetRecognizers(!0).then((()=>{this.clearTimeout(),o()})).catch((e=>r(e)));this.clearTimeout(),this.onScanningDone&&this.onScanningDone(s)}else{if(s===e.RecognizerResultState.Uncertain)return 0===this.timeoutID&&(this.timeoutID=window.setTimeout((()=>{this.timedOut=!0}),this.recognitionTimeoutMs)),void o();if(s===e.RecognizerResultState.StageValid)return this.clearTimeout(),void o()}o()})).catch((e=>r(e)))}))}clearTimeout(){this.timeoutID>0&&(window.clearTimeout(this.timeoutID),this.timeoutID=0)}}function ae(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)))}class ne{constructor(){this.enableMrzId=!0,this.enableMrzPassport=!0,this.enableMrzVisa=!0,this.enablePhotoId=!0,this.enableBarcodeId=!0,this.enableFullDocumentRecognition=!0}}var Ae,Ee,Re,Ie,Ne,ce;(Ae=e.Country||(e.Country={}))[Ae.NONE=0]="NONE",Ae[Ae.ALBANIA=1]="ALBANIA",Ae[Ae.ALGERIA=2]="ALGERIA",Ae[Ae.ARGENTINA=3]="ARGENTINA",Ae[Ae.AUSTRALIA=4]="AUSTRALIA",Ae[Ae.AUSTRIA=5]="AUSTRIA",Ae[Ae.AZERBAIJAN=6]="AZERBAIJAN",Ae[Ae.BAHRAIN=7]="BAHRAIN",Ae[Ae.BANGLADESH=8]="BANGLADESH",Ae[Ae.BELGIUM=9]="BELGIUM",Ae[Ae.BOSNIA_AND_HERZEGOVINA=10]="BOSNIA_AND_HERZEGOVINA",Ae[Ae.BRUNEI=11]="BRUNEI",Ae[Ae.BULGARIA=12]="BULGARIA",Ae[Ae.CAMBODIA=13]="CAMBODIA",Ae[Ae.CANADA=14]="CANADA",Ae[Ae.CHILE=15]="CHILE",Ae[Ae.COLOMBIA=16]="COLOMBIA",Ae[Ae.COSTA_RICA=17]="COSTA_RICA",Ae[Ae.CROATIA=18]="CROATIA",Ae[Ae.CYPRUS=19]="CYPRUS",Ae[Ae.CZECHIA=20]="CZECHIA",Ae[Ae.DENMARK=21]="DENMARK",Ae[Ae.DOMINICAN_REPUBLIC=22]="DOMINICAN_REPUBLIC",Ae[Ae.EGYPT=23]="EGYPT",Ae[Ae.ESTONIA=24]="ESTONIA",Ae[Ae.FINLAND=25]="FINLAND",Ae[Ae.FRANCE=26]="FRANCE",Ae[Ae.GEORGIA=27]="GEORGIA",Ae[Ae.GERMANY=28]="GERMANY",Ae[Ae.GHANA=29]="GHANA",Ae[Ae.GREECE=30]="GREECE",Ae[Ae.GUATEMALA=31]="GUATEMALA",Ae[Ae.HONG_KONG=32]="HONG_KONG",Ae[Ae.HUNGARY=33]="HUNGARY",Ae[Ae.INDIA=34]="INDIA",Ae[Ae.INDONESIA=35]="INDONESIA",Ae[Ae.IRELAND=36]="IRELAND",Ae[Ae.ISRAEL=37]="ISRAEL",Ae[Ae.ITALY=38]="ITALY",Ae[Ae.JORDAN=39]="JORDAN",Ae[Ae.KAZAKHSTAN=40]="KAZAKHSTAN",Ae[Ae.KENYA=41]="KENYA",Ae[Ae.KOSOVO=42]="KOSOVO",Ae[Ae.KUWAIT=43]="KUWAIT",Ae[Ae.LATVIA=44]="LATVIA",Ae[Ae.LITHUANIA=45]="LITHUANIA",Ae[Ae.MALAYSIA=46]="MALAYSIA",Ae[Ae.MALDIVES=47]="MALDIVES",Ae[Ae.MALTA=48]="MALTA",Ae[Ae.MAURITIUS=49]="MAURITIUS",Ae[Ae.MEXICO=50]="MEXICO",Ae[Ae.MOROCCO=51]="MOROCCO",Ae[Ae.NETHERLANDS=52]="NETHERLANDS",Ae[Ae.NEW_ZEALAND=53]="NEW_ZEALAND",Ae[Ae.NIGERIA=54]="NIGERIA",Ae[Ae.PAKISTAN=55]="PAKISTAN",Ae[Ae.PANAMA=56]="PANAMA",Ae[Ae.PARAGUAY=57]="PARAGUAY",Ae[Ae.PHILIPPINES=58]="PHILIPPINES",Ae[Ae.POLAND=59]="POLAND",Ae[Ae.PORTUGAL=60]="PORTUGAL",Ae[Ae.PUERTO_RICO=61]="PUERTO_RICO",Ae[Ae.QATAR=62]="QATAR",Ae[Ae.ROMANIA=63]="ROMANIA",Ae[Ae.RUSSIA=64]="RUSSIA",Ae[Ae.SAUDI_ARABIA=65]="SAUDI_ARABIA",Ae[Ae.SERBIA=66]="SERBIA",Ae[Ae.SINGAPORE=67]="SINGAPORE",Ae[Ae.SLOVAKIA=68]="SLOVAKIA",Ae[Ae.SLOVENIA=69]="SLOVENIA",Ae[Ae.SOUTH_AFRICA=70]="SOUTH_AFRICA",Ae[Ae.SPAIN=71]="SPAIN",Ae[Ae.SWEDEN=72]="SWEDEN",Ae[Ae.SWITZERLAND=73]="SWITZERLAND",Ae[Ae.TAIWAN=74]="TAIWAN",Ae[Ae.THAILAND=75]="THAILAND",Ae[Ae.TUNISIA=76]="TUNISIA",Ae[Ae.TURKEY=77]="TURKEY",Ae[Ae.UAE=78]="UAE",Ae[Ae.UGANDA=79]="UGANDA",Ae[Ae.UK=80]="UK",Ae[Ae.UKRAINE=81]="UKRAINE",Ae[Ae.USA=82]="USA",Ae[Ae.VIETNAM=83]="VIETNAM",Ae[Ae.BRAZIL=84]="BRAZIL",Ae[Ae.NORWAY=85]="NORWAY",Ae[Ae.OMAN=86]="OMAN",Ae[Ae.ECUADOR=87]="ECUADOR",Ae[Ae.EL_SALVADOR=88]="EL_SALVADOR",Ae[Ae.SRI_LANKA=89]="SRI_LANKA",Ae[Ae.PERU=90]="PERU",Ae[Ae.URUGUAY=91]="URUGUAY",Ae[Ae.BAHAMAS=92]="BAHAMAS",Ae[Ae.BERMUDA=93]="BERMUDA",Ae[Ae.BOLIVIA=94]="BOLIVIA",Ae[Ae.CHINA=95]="CHINA",Ae[Ae.EUROPEAN_UNION=96]="EUROPEAN_UNION",Ae[Ae.HAITI=97]="HAITI",Ae[Ae.HONDURAS=98]="HONDURAS",Ae[Ae.ICELAND=99]="ICELAND",Ae[Ae.JAPAN=100]="JAPAN",Ae[Ae.LUXEMBOURG=101]="LUXEMBOURG",Ae[Ae.MONTENEGRO=102]="MONTENEGRO",Ae[Ae.NICARAGUA=103]="NICARAGUA",Ae[Ae.SOUTH_KOREA=104]="SOUTH_KOREA",Ae[Ae.VENEZUELA=105]="VENEZUELA",Ae[Ae.AFGHANISTAN=106]="AFGHANISTAN",Ae[Ae.ALAND_ISLANDS=107]="ALAND_ISLANDS",Ae[Ae.AMERICAN_SAMOA=108]="AMERICAN_SAMOA",Ae[Ae.ANDORRA=109]="ANDORRA",Ae[Ae.ANGOLA=110]="ANGOLA",Ae[Ae.ANGUILLA=111]="ANGUILLA",Ae[Ae.ANTARCTICA=112]="ANTARCTICA",Ae[Ae.ANTIGUA_AND_BARBUDA=113]="ANTIGUA_AND_BARBUDA",Ae[Ae.ARMENIA=114]="ARMENIA",Ae[Ae.ARUBA=115]="ARUBA",Ae[Ae.BAILIWICK_OF_GUERNSEY=116]="BAILIWICK_OF_GUERNSEY",Ae[Ae.BAILIWICK_OF_JERSEY=117]="BAILIWICK_OF_JERSEY",Ae[Ae.BARBADOS=118]="BARBADOS",Ae[Ae.BELARUS=119]="BELARUS",Ae[Ae.BELIZE=120]="BELIZE",Ae[Ae.BENIN=121]="BENIN",Ae[Ae.BHUTAN=122]="BHUTAN",Ae[Ae.BONAIRE_SAINT_EUSTATIUS_AND_SABA=123]="BONAIRE_SAINT_EUSTATIUS_AND_SABA",Ae[Ae.BOTSWANA=124]="BOTSWANA",Ae[Ae.BOUVET_ISLAND=125]="BOUVET_ISLAND",Ae[Ae.BRITISH_INDIAN_OCEAN_TERRITORY=126]="BRITISH_INDIAN_OCEAN_TERRITORY",Ae[Ae.BURKINA_FASO=127]="BURKINA_FASO",Ae[Ae.BURUNDI=128]="BURUNDI",Ae[Ae.CAMEROON=129]="CAMEROON",Ae[Ae.CAPE_VERDE=130]="CAPE_VERDE",Ae[Ae.CARIBBEAN_NETHERLANDS=131]="CARIBBEAN_NETHERLANDS",Ae[Ae.CAYMAN_ISLANDS=132]="CAYMAN_ISLANDS",Ae[Ae.CENTRAL_AFRICAN_REPUBLIC=133]="CENTRAL_AFRICAN_REPUBLIC",Ae[Ae.CHAD=134]="CHAD",Ae[Ae.CHRISTMAS_ISLAND=135]="CHRISTMAS_ISLAND",Ae[Ae.COCOS_ISLANDS=136]="COCOS_ISLANDS",Ae[Ae.COMOROS=137]="COMOROS",Ae[Ae.CONGO=138]="CONGO",Ae[Ae.COOK_ISLANDS=139]="COOK_ISLANDS",Ae[Ae.CUBA=140]="CUBA",Ae[Ae.CURACAO=141]="CURACAO",Ae[Ae.DEMOCRATIC_REPUBLIC_OF_THE_CONGO=142]="DEMOCRATIC_REPUBLIC_OF_THE_CONGO",Ae[Ae.DJIBOUTI=143]="DJIBOUTI",Ae[Ae.DOMINICA=144]="DOMINICA",Ae[Ae.EAST_TIMOR=145]="EAST_TIMOR",Ae[Ae.EQUATORIAL_GUINEA=146]="EQUATORIAL_GUINEA",Ae[Ae.ERITREA=147]="ERITREA",Ae[Ae.ETHIOPIA=148]="ETHIOPIA",Ae[Ae.FALKLAND_ISLANDS=149]="FALKLAND_ISLANDS",Ae[Ae.FAROE_ISLANDS=150]="FAROE_ISLANDS",Ae[Ae.FEDERATED_STATES_OF_MICRONESIA=151]="FEDERATED_STATES_OF_MICRONESIA",Ae[Ae.FIJI=152]="FIJI",Ae[Ae.FRENCH_GUIANA=153]="FRENCH_GUIANA",Ae[Ae.FRENCH_POLYNESIA=154]="FRENCH_POLYNESIA",Ae[Ae.FRENCH_SOUTHERN_TERRITORIES=155]="FRENCH_SOUTHERN_TERRITORIES",Ae[Ae.GABON=156]="GABON",Ae[Ae.GAMBIA=157]="GAMBIA",Ae[Ae.GIBRALTAR=158]="GIBRALTAR",Ae[Ae.GREENLAND=159]="GREENLAND",Ae[Ae.GRENADA=160]="GRENADA",Ae[Ae.GUADELOUPE=161]="GUADELOUPE",Ae[Ae.GUAM=162]="GUAM",Ae[Ae.GUINEA=163]="GUINEA",Ae[Ae.GUINEA_BISSAU=164]="GUINEA_BISSAU",Ae[Ae.GUYANA=165]="GUYANA",Ae[Ae.HEARD_ISLAND_AND_MCDONALD_ISLANDS=166]="HEARD_ISLAND_AND_MCDONALD_ISLANDS",Ae[Ae.IRAN=167]="IRAN",Ae[Ae.IRAQ=168]="IRAQ",Ae[Ae.ISLE_OF_MAN=169]="ISLE_OF_MAN",Ae[Ae.IVORY_COAST=170]="IVORY_COAST",Ae[Ae.JAMAICA=171]="JAMAICA",Ae[Ae.KIRIBATI=172]="KIRIBATI",Ae[Ae.KYRGYZSTAN=173]="KYRGYZSTAN",Ae[Ae.LAOS=174]="LAOS",Ae[Ae.LEBANON=175]="LEBANON",Ae[Ae.LESOTHO=176]="LESOTHO",Ae[Ae.LIBERIA=177]="LIBERIA",Ae[Ae.LIBYA=178]="LIBYA",Ae[Ae.LIECHTENSTEIN=179]="LIECHTENSTEIN",Ae[Ae.MACAU=180]="MACAU",Ae[Ae.MADAGASCAR=181]="MADAGASCAR",Ae[Ae.MALAWI=182]="MALAWI",Ae[Ae.MALI=183]="MALI",Ae[Ae.MARSHALL_ISLANDS=184]="MARSHALL_ISLANDS",Ae[Ae.MARTINIQUE=185]="MARTINIQUE",Ae[Ae.MAURITANIA=186]="MAURITANIA",Ae[Ae.MAYOTTE=187]="MAYOTTE",Ae[Ae.MOLDOVA=188]="MOLDOVA",Ae[Ae.MONACO=189]="MONACO",Ae[Ae.MONGOLIA=190]="MONGOLIA",Ae[Ae.MONTSERRAT=191]="MONTSERRAT",Ae[Ae.MOZAMBIQUE=192]="MOZAMBIQUE",Ae[Ae.MYANMAR=193]="MYANMAR",Ae[Ae.NAMIBIA=194]="NAMIBIA",Ae[Ae.NAURU=195]="NAURU",Ae[Ae.NEPAL=196]="NEPAL",Ae[Ae.NEW_CALEDONIA=197]="NEW_CALEDONIA",Ae[Ae.NIGER=198]="NIGER",Ae[Ae.NIUE=199]="NIUE",Ae[Ae.NORFOLK_ISLAND=200]="NORFOLK_ISLAND",Ae[Ae.NORTHERN_CYPRUS=201]="NORTHERN_CYPRUS",Ae[Ae.NORTHERN_MARIANA_ISLANDS=202]="NORTHERN_MARIANA_ISLANDS",Ae[Ae.NORTH_KOREA=203]="NORTH_KOREA",Ae[Ae.NORTH_MACEDONIA=204]="NORTH_MACEDONIA",Ae[Ae.PALAU=205]="PALAU",Ae[Ae.PALESTINE=206]="PALESTINE",Ae[Ae.PAPUA_NEW_GUINEA=207]="PAPUA_NEW_GUINEA",Ae[Ae.PITCAIRN=208]="PITCAIRN",Ae[Ae.REUNION=209]="REUNION",Ae[Ae.RWANDA=210]="RWANDA",Ae[Ae.SAINT_BARTHELEMY=211]="SAINT_BARTHELEMY",Ae[Ae.SAINT_HELENA_ASCENSION_AND_TRISTIAN_DA_CUNHA=212]="SAINT_HELENA_ASCENSION_AND_TRISTIAN_DA_CUNHA",Ae[Ae.SAINT_KITTS_AND_NEVIS=213]="SAINT_KITTS_AND_NEVIS",Ae[Ae.SAINT_LUCIA=214]="SAINT_LUCIA",Ae[Ae.SAINT_MARTIN=215]="SAINT_MARTIN",Ae[Ae.SAINT_PIERRE_AND_MIQUELON=216]="SAINT_PIERRE_AND_MIQUELON",Ae[Ae.SAINT_VINCENT_AND_THE_GRENADINES=217]="SAINT_VINCENT_AND_THE_GRENADINES",Ae[Ae.SAMOA=218]="SAMOA",Ae[Ae.SAN_MARINO=219]="SAN_MARINO",Ae[Ae.SAO_TOME_AND_PRINCIPE=220]="SAO_TOME_AND_PRINCIPE",Ae[Ae.SENEGAL=221]="SENEGAL",Ae[Ae.SEYCHELLES=222]="SEYCHELLES",Ae[Ae.SIERRA_LEONE=223]="SIERRA_LEONE",Ae[Ae.SINT_MAARTEN=224]="SINT_MAARTEN",Ae[Ae.SOLOMON_ISLANDS=225]="SOLOMON_ISLANDS",Ae[Ae.SOMALIA=226]="SOMALIA",Ae[Ae.SOUTH_GEORGIA_AND_THE_SOUTH_SANDWICH_ISLANDS=227]="SOUTH_GEORGIA_AND_THE_SOUTH_SANDWICH_ISLANDS",Ae[Ae.SOUTH_SUDAN=228]="SOUTH_SUDAN",Ae[Ae.SUDAN=229]="SUDAN",Ae[Ae.SURINAME=230]="SURINAME",Ae[Ae.SVALBARD_AND_JAN_MAYEN=231]="SVALBARD_AND_JAN_MAYEN",Ae[Ae.ESWATINI=232]="ESWATINI",Ae[Ae.SYRIA=233]="SYRIA",Ae[Ae.TAJIKISTAN=234]="TAJIKISTAN",Ae[Ae.TANZANIA=235]="TANZANIA",Ae[Ae.TOGO=236]="TOGO",Ae[Ae.TOKELAU=237]="TOKELAU",Ae[Ae.TONGA=238]="TONGA",Ae[Ae.TRINIDAD_AND_TOBAGO=239]="TRINIDAD_AND_TOBAGO",Ae[Ae.TURKMENISTAN=240]="TURKMENISTAN",Ae[Ae.TURKS_AND_CAICOS_ISLANDS=241]="TURKS_AND_CAICOS_ISLANDS",Ae[Ae.TUVALU=242]="TUVALU",Ae[Ae.UNITED_STATES_MINOR_OUTLYING_ISLANDS=243]="UNITED_STATES_MINOR_OUTLYING_ISLANDS",Ae[Ae.UZBEKISTAN=244]="UZBEKISTAN",Ae[Ae.VANUATU=245]="VANUATU",Ae[Ae.VATICAN_CITY=246]="VATICAN_CITY",Ae[Ae.VIRGIN_ISLANDS_BRITISH=247]="VIRGIN_ISLANDS_BRITISH",Ae[Ae.VIRGIN_ISLANDS_US=248]="VIRGIN_ISLANDS_US",Ae[Ae.WALLIS_AND_FUTUNA=249]="WALLIS_AND_FUTUNA",Ae[Ae.WESTERN_SAHARA=250]="WESTERN_SAHARA",Ae[Ae.YEMEN=251]="YEMEN",Ae[Ae.YUGOSLAVIA=252]="YUGOSLAVIA",Ae[Ae.ZAMBIA=253]="ZAMBIA",Ae[Ae.ZIMBABWE=254]="ZIMBABWE",Ae[Ae.COUNT=255]="COUNT",(Ee=e.Region||(e.Region={}))[Ee.NONE=0]="NONE",Ee[Ee.ALABAMA=1]="ALABAMA",Ee[Ee.ALASKA=2]="ALASKA",Ee[Ee.ALBERTA=3]="ALBERTA",Ee[Ee.ARIZONA=4]="ARIZONA",Ee[Ee.ARKANSAS=5]="ARKANSAS",Ee[Ee.AUSTRALIAN_CAPITAL_TERRITORY=6]="AUSTRALIAN_CAPITAL_TERRITORY",Ee[Ee.BRITISH_COLUMBIA=7]="BRITISH_COLUMBIA",Ee[Ee.CALIFORNIA=8]="CALIFORNIA",Ee[Ee.COLORADO=9]="COLORADO",Ee[Ee.CONNECTICUT=10]="CONNECTICUT",Ee[Ee.DELAWARE=11]="DELAWARE",Ee[Ee.DISTRICT_OF_COLUMBIA=12]="DISTRICT_OF_COLUMBIA",Ee[Ee.FLORIDA=13]="FLORIDA",Ee[Ee.GEORGIA=14]="GEORGIA",Ee[Ee.HAWAII=15]="HAWAII",Ee[Ee.IDAHO=16]="IDAHO",Ee[Ee.ILLINOIS=17]="ILLINOIS",Ee[Ee.INDIANA=18]="INDIANA",Ee[Ee.IOWA=19]="IOWA",Ee[Ee.KANSAS=20]="KANSAS",Ee[Ee.KENTUCKY=21]="KENTUCKY",Ee[Ee.LOUISIANA=22]="LOUISIANA",Ee[Ee.MAINE=23]="MAINE",Ee[Ee.MANITOBA=24]="MANITOBA",Ee[Ee.MARYLAND=25]="MARYLAND",Ee[Ee.MASSACHUSETTS=26]="MASSACHUSETTS",Ee[Ee.MICHIGAN=27]="MICHIGAN",Ee[Ee.MINNESOTA=28]="MINNESOTA",Ee[Ee.MISSISSIPPI=29]="MISSISSIPPI",Ee[Ee.MISSOURI=30]="MISSOURI",Ee[Ee.MONTANA=31]="MONTANA",Ee[Ee.NEBRASKA=32]="NEBRASKA",Ee[Ee.NEVADA=33]="NEVADA",Ee[Ee.NEW_BRUNSWICK=34]="NEW_BRUNSWICK",Ee[Ee.NEW_HAMPSHIRE=35]="NEW_HAMPSHIRE",Ee[Ee.NEW_JERSEY=36]="NEW_JERSEY",Ee[Ee.NEW_MEXICO=37]="NEW_MEXICO",Ee[Ee.NEW_SOUTH_WALES=38]="NEW_SOUTH_WALES",Ee[Ee.NEW_YORK=39]="NEW_YORK",Ee[Ee.NORTHERN_TERRITORY=40]="NORTHERN_TERRITORY",Ee[Ee.NORTH_CAROLINA=41]="NORTH_CAROLINA",Ee[Ee.NORTH_DAKOTA=42]="NORTH_DAKOTA",Ee[Ee.NOVA_SCOTIA=43]="NOVA_SCOTIA",Ee[Ee.OHIO=44]="OHIO",Ee[Ee.OKLAHOMA=45]="OKLAHOMA",Ee[Ee.ONTARIO=46]="ONTARIO",Ee[Ee.OREGON=47]="OREGON",Ee[Ee.PENNSYLVANIA=48]="PENNSYLVANIA",Ee[Ee.QUEBEC=49]="QUEBEC",Ee[Ee.QUEENSLAND=50]="QUEENSLAND",Ee[Ee.RHODE_ISLAND=51]="RHODE_ISLAND",Ee[Ee.SASKATCHEWAN=52]="SASKATCHEWAN",Ee[Ee.SOUTH_AUSTRALIA=53]="SOUTH_AUSTRALIA",Ee[Ee.SOUTH_CAROLINA=54]="SOUTH_CAROLINA",Ee[Ee.SOUTH_DAKOTA=55]="SOUTH_DAKOTA",Ee[Ee.TASMANIA=56]="TASMANIA",Ee[Ee.TENNESSEE=57]="TENNESSEE",Ee[Ee.TEXAS=58]="TEXAS",Ee[Ee.UTAH=59]="UTAH",Ee[Ee.VERMONT=60]="VERMONT",Ee[Ee.VICTORIA=61]="VICTORIA",Ee[Ee.VIRGINIA=62]="VIRGINIA",Ee[Ee.WASHINGTON=63]="WASHINGTON",Ee[Ee.WESTERN_AUSTRALIA=64]="WESTERN_AUSTRALIA",Ee[Ee.WEST_VIRGINIA=65]="WEST_VIRGINIA",Ee[Ee.WISCONSIN=66]="WISCONSIN",Ee[Ee.WYOMING=67]="WYOMING",Ee[Ee.YUKON=68]="YUKON",Ee[Ee.CIUDAD_DE_MEXICO=69]="CIUDAD_DE_MEXICO",Ee[Ee.JALISCO=70]="JALISCO",Ee[Ee.NEWFOUNDLAND_AND_LABRADOR=71]="NEWFOUNDLAND_AND_LABRADOR",Ee[Ee.NUEVO_LEON=72]="NUEVO_LEON",Ee[Ee.BAJA_CALIFORNIA=73]="BAJA_CALIFORNIA",Ee[Ee.CHIHUAHUA=74]="CHIHUAHUA",Ee[Ee.GUANAJUATO=75]="GUANAJUATO",Ee[Ee.GUERRERO=76]="GUERRERO",Ee[Ee.MEXICO=77]="MEXICO",Ee[Ee.MICHOACAN=78]="MICHOACAN",Ee[Ee.NEW_YORK_CITY=79]="NEW_YORK_CITY",Ee[Ee.TAMAULIPAS=80]="TAMAULIPAS",Ee[Ee.VERACRUZ=81]="VERACRUZ",Ee[Ee.CHIAPAS=82]="CHIAPAS",Ee[Ee.COAHUILA=83]="COAHUILA",Ee[Ee.DURANGO=84]="DURANGO",Ee[Ee.GUERRERO_COCULA=85]="GUERRERO_COCULA",Ee[Ee.GUERRERO_JUCHITAN=86]="GUERRERO_JUCHITAN",Ee[Ee.GUERRERO_TEPECOACUILCO=87]="GUERRERO_TEPECOACUILCO",Ee[Ee.GUERRERO_TLACOAPA=88]="GUERRERO_TLACOAPA",Ee[Ee.GUJARAT=89]="GUJARAT",Ee[Ee.HIDALGO=90]="HIDALGO",Ee[Ee.KARNATAKA=91]="KARNATAKA",Ee[Ee.KERALA=92]="KERALA",Ee[Ee.KHYBER_PAKHTUNKHWA=93]="KHYBER_PAKHTUNKHWA",Ee[Ee.MADHYA_PRADESH=94]="MADHYA_PRADESH",Ee[Ee.MAHARASHTRA=95]="MAHARASHTRA",Ee[Ee.MORELOS=96]="MORELOS",Ee[Ee.NAYARIT=97]="NAYARIT",Ee[Ee.OAXACA=98]="OAXACA",Ee[Ee.PUEBLA=99]="PUEBLA",Ee[Ee.PUNJAB=100]="PUNJAB",Ee[Ee.QUERETARO=101]="QUERETARO",Ee[Ee.SAN_LUIS_POTOSI=102]="SAN_LUIS_POTOSI",Ee[Ee.SINALOA=103]="SINALOA",Ee[Ee.SONORA=104]="SONORA",Ee[Ee.TABASCO=105]="TABASCO",Ee[Ee.TAMIL_NADU=106]="TAMIL_NADU",Ee[Ee.YUCATAN=107]="YUCATAN",Ee[Ee.ZACATECAS=108]="ZACATECAS",Ee[Ee.AGUASCALIENTES=109]="AGUASCALIENTES",Ee[Ee.BAJA_CALIFORNIA_SUR=110]="BAJA_CALIFORNIA_SUR",Ee[Ee.CAMPECHE=111]="CAMPECHE",Ee[Ee.COLIMA=112]="COLIMA",Ee[Ee.QUINTANA_ROO_BENITO_JUAREZ=113]="QUINTANA_ROO_BENITO_JUAREZ",Ee[Ee.UINTANA_ROO=114]="UINTANA_ROO",Ee[Ee.QUINTANA_ROO_SOLIDARIDAD=115]="QUINTANA_ROO_SOLIDARIDAD",Ee[Ee.TLAXCALA=116]="TLAXCALA",Ee[Ee.QUINTANA_ROO_COZUMEL=117]="QUINTANA_ROO_COZUMEL",Ee[Ee.COUNT=118]="COUNT",(Re=e.DocumentType||(e.DocumentType={}))[Re.NONE=0]="NONE",Re[Re.CONSULAR_ID=1]="CONSULAR_ID",Re[Re.DL=2]="DL",Re[Re.DL_PUBLIC_SERVICES_CARD=3]="DL_PUBLIC_SERVICES_CARD",Re[Re.EMPLOYMENT_PASS=4]="EMPLOYMENT_PASS",Re[Re.FIN_CARD=5]="FIN_CARD",Re[Re.ID=6]="ID",Re[Re.MULTIPURPOSE_ID=7]="MULTIPURPOSE_ID",Re[Re.MyKad=8]="MyKad",Re[Re.MyKid=9]="MyKid",Re[Re.MyPR=10]="MyPR",Re[Re.MyTentera=11]="MyTentera",Re[Re.PAN_CARD=12]="PAN_CARD",Re[Re.PROFESSIONAL_ID=13]="PROFESSIONAL_ID",Re[Re.PUBLIC_SERVICES_CARD=14]="PUBLIC_SERVICES_CARD",Re[Re.RESIDENCE_PERMIT=15]="RESIDENCE_PERMIT",Re[Re.RESIDENT_ID=16]="RESIDENT_ID",Re[Re.TEMPORARY_RESIDENCE_PERMIT=17]="TEMPORARY_RESIDENCE_PERMIT",Re[Re.VOTER_ID=18]="VOTER_ID",Re[Re.WORK_PERMIT=19]="WORK_PERMIT",Re[Re.iKAD=20]="iKAD",Re[Re.MILITARY_ID=21]="MILITARY_ID",Re[Re.MyKAS=22]="MyKAS",Re[Re.SOCIAL_SECURITY_CARD=23]="SOCIAL_SECURITY_CARD",Re[Re.HEALTH_INSURANCE_CARD=24]="HEALTH_INSURANCE_CARD",Re[Re.PASSPORT=25]="PASSPORT",Re[Re.S_PASS=26]="S_PASS",Re[Re.ADDRESS_CARD=27]="ADDRESS_CARD",Re[Re.ALIEN_ID=28]="ALIEN_ID",Re[Re.ALIEN_PASSPORT=29]="ALIEN_PASSPORT",Re[Re.GREEN_CARD=30]="GREEN_CARD",Re[Re.MINORS_ID=31]="MINORS_ID",Re[Re.POSTAL_ID=32]="POSTAL_ID",Re[Re.PROFESSIONAL_DL=33]="PROFESSIONAL_DL",Re[Re.TAX_ID=34]="TAX_ID",Re[Re.WEAPON_PERMIT=35]="WEAPON_PERMIT",Re[Re.VISA=36]="VISA",Re[Re.BORDER_CROSSING_CARD=37]="BORDER_CROSSING_CARD",Re[Re.DRIVER_CARD=38]="DRIVER_CARD",Re[Re.GLOBAL_ENTRY_CARD=39]="GLOBAL_ENTRY_CARD",Re[Re.MyPolis=40]="MyPolis",Re[Re.NEXUS_CARD=41]="NEXUS_CARD",Re[Re.PASSPORT_CARD=42]="PASSPORT_CARD",Re[Re.PROOF_OF_AGE_CARD=43]="PROOF_OF_AGE_CARD",Re[Re.REFUGEE_ID=44]="REFUGEE_ID",Re[Re.TRIBAL_ID=45]="TRIBAL_ID",Re[Re.VETERAN_ID=46]="VETERAN_ID",Re[Re.CITIZENSHIP_CERTIFICATE=47]="CITIZENSHIP_CERTIFICATE",Re[Re.MY_NUMBER_CARD=48]="MY_NUMBER_CARD",Re[Re.CONSULAR_PASSPORT=49]="CONSULAR_PASSPORT",Re[Re.MINORS_PASSPORT=50]="MINORS_PASSPORT",Re[Re.MINORS_PUBLIC_SERVICES_CARD=51]="MINORS_PUBLIC_SERVICES_CARD",Re[Re.COUNT=52]="COUNT",(Ie=e.DocumentImageColorStatus||(e.DocumentImageColorStatus={}))[Ie.NotAvailable=0]="NotAvailable",Ie[Ie.BlackAndWhite=1]="BlackAndWhite",Ie[Ie.Color=2]="Color",(Ne=e.ImageAnalysisDetectionStatus||(e.ImageAnalysisDetectionStatus={}))[Ne.NotAvailable=0]="NotAvailable",Ne[Ne.NotDetected=1]="NotDetected",Ne[Ne.Detected=2]="Detected",(ce=e.ProcessingStatus||(e.ProcessingStatus={}))[ce.Success=0]="Success",ce[ce.DetectionFailed=1]="DetectionFailed",ce[ce.ImagePreprocessingFailed=2]="ImagePreprocessingFailed",ce[ce.StabilityTestFailed=3]="StabilityTestFailed",ce[ce.ScanningWrongSide=4]="ScanningWrongSide",ce[ce.FieldIdentificationFailed=5]="FieldIdentificationFailed",ce[ce.MandatoryFieldMissing=6]="MandatoryFieldMissing",ce[ce.InvalidCharactersFound=7]="InvalidCharactersFound",ce[ce.ImageReturnFailed=8]="ImageReturnFailed",ce[ce.BarcodeRecognitionFailed=9]="BarcodeRecognitionFailed",ce[ce.MrzParsingFailed=10]="MrzParsingFailed",ce[ce.ClassFiltered=11]="ClassFiltered",ce[ce.UnsupportedClass=12]="UnsupportedClass",ce[ce.UnsupportedByLicense=13]="UnsupportedByLicense",ce[ce.AwaitingOtherSide=14]="AwaitingOtherSide",ce[ce.Count=15]="Count";e.BlinkIdImageCaptureRecognizerSettings=class{constructor(){this.captureBothDocumentSides=!1,this.barcodeCaptureStartedCallback=null,this.scanCroppedDocumentImage=!1,this.captureModeFilter=new ne}},e.CapturedFrame=J,e.RecognitionModeFilter=ne,e.SDKError=P,e.SelectedCamera=V,e.VideoRecognizer=ie,e.WasmSDKLoadSettings=class{constructor(e){if(this.allowHelloMessage=!0,this.engineLocation="",this.workerLocation="",this.wasmType=null,this.numberOfWorkers=null,this.loadProgressCallback=null,this.wasmModuleName="BlinkIDImageCaptureWasmSDK",!e)throw new P(K.licenseKeyMissing);this.licenseKey=e}},e.bindCameraToVideoFeed=Y,e.captureFrame=Q,e.clearVideoFeed=Z,e.createBlinkIdImageCaptureRecognizer=function(e){return t(this,void 0,void 0,(function*(){return e.mbWasmModule.newRecognizer("BlinkIdImageCaptureRecognizer")}))},e.createRecognizerRunner=function(e,r,s=!1,o={}){return t(this,void 0,void 0,(function*(){if("object"!=typeof e)throw new P(K.missing);if("object"!=typeof r||1>r.length)throw new P(K.recognizersMissing);return e.mbWasmModule.createRecognizerRunner(r,s,o)}))},e.createSuccessFrameGrabberRecognizer=function(e,r){return t(this,void 0,void 0,(function*(){const t=yield e.mbWasmModule.newRecognizer("SuccessFrameGrabberRecognizer",r);return t.wrappedRecognizer=r,t}))},e.detectWasmType=function(){return t(this,void 0,void 0,(function*(){const t=yield(async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,3,1,0,1,10,14,1,12,0,65,0,65,0,65,0,252,10,0,0,11])))(),r=yield(async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,12,1,10,0,67,0,0,0,0,252,0,26,11])))(),s=yield(async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,8,1,6,0,65,0,192,26,11])))(),o=yield(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])))(),i=yield(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 t&&r&&s&&o?i?e.WasmType.AdvancedWithThreads:e.WasmType.Advanced:e.WasmType.Basic}))},e.frameCaptureErrors=v,e.getCameraDevices=H,e.isBrowserSupported=function(){try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(e instanceof WebAssembly.Module)return new WebAssembly.Instance(e)instanceof WebAssembly.Instance}}catch(e){return!1}return!1},e.isInAppBrowser=function(){const e=navigator.userAgent||navigator.vendor;return!!/(instagram|fbav|linkedinapp|twitter|micromessenger|whatsapp|tiktok)[/\s]?([\w.]*)/i.exec(e)},e.licenseErrors=W,e.loadWasmModule=function(e){return t(this,void 0,void 0,(function*(){return new Promise(((t,r)=>{if(!e||"object"!=typeof e)return void r(new P(K.wasmSettingsMissing));if("string"!=typeof e.licenseKey)return void r(new P(K.licenseKeyMissing));if(!e.wasmModuleName)return void r(new P(K.wasmModuleNameMissing));if("string"!=typeof e.engineLocation)return void r(new P(K.engineLocationInvalid));if("string"!=typeof e.workerLocation)return void r(new P(K.workerLocationInvalid));const s=function(){try{let e=localStorage.getItem("mb-user-id");return null===e&&(e=ae(),localStorage.setItem("mb-user-id",e)),e}catch(e){return ae()}}();try{const o=`/resources/${e.wasmModuleName}.worker.min.js`,i=window.location.origin+o,a=e.workerLocation||i;e.allowHelloMessage&&console.log("Worker location is:",a);const n=new Worker(a);h.createWasmWorker(n,e,s).then((e=>{t(e)}),r)}catch(e){r(e)}}))}))},e.localSdkErrors=b,e.obtainNewServerPermission=oe,e.sdkErrors=K,e.selectCamera=B,e.unlockWasmSDK=function(r,s,o,i){return t(this,void 0,void 0,(function*(){const t=i.initializeWithLicenseKey(r,o,s);switch(t.unlockResult){case e.LicenseTokenState.Invalid:return{error:new P(Object.assign(Object.assign({},W.licenseInvalid),{message:t.licenseError}),{type:e.LicenseErrorType.LicenseTokenStateInvalid})};case e.LicenseTokenState.Valid:return{error:null,showOverlay:(a=t.isTrial,n=t.allowRemoveDemoOverlay,A=t.allowRemoveProductionOverlay,!(a&&n||!a&&A))};case e.LicenseTokenState.RequiresServerPermission:{const r=yield oe(t,i);switch(r.status){case e.ServerPermissionSubmitResultStatus.Ok:return{error:null,lease:r.lease};case e.ServerPermissionSubmitResultStatus.NetworkError:{let t="";return r.networkErrorDescription&&(t=" "+r.networkErrorDescription),{error:new P(Object.assign(Object.assign({},W.licenseNetworkError),{message:"There has been a network error while obtaining the server permission!"+t}),{type:e.LicenseErrorType.NetworkError})}}case e.ServerPermissionSubmitResultStatus.RemoteLock:return{error:new P(W.licenseRemoteLocked,{type:e.LicenseErrorType.RemoteLock}),lease:r.lease};case e.ServerPermissionSubmitResultStatus.PermissionExpired:return{error:new P(W.licensePermissionExpired,{type:e.LicenseErrorType.PermissionExpired}),lease:r.lease};case e.ServerPermissionSubmitResultStatus.PayloadCorrupted:return{error:new P(W.licensePayloadCorrupted,{type:e.LicenseErrorType.PayloadCorrupted}),lease:r.lease};case e.ServerPermissionSubmitResultStatus.PayloadSignatureVerificationFailed:return{error:new P(W.licensePayloadVerificationFailed,{type:e.LicenseErrorType.PayloadSignatureVerificationFailed}),lease:r.lease};case e.ServerPermissionSubmitResultStatus.IncorrectTokenState:return{error:new P(W.licenseTokenStateIncorrect,{type:e.LicenseErrorType.IncorrectTokenState}),lease:r.lease}}}}var a,n,A}))},e.videoRecognizerErrors=p,e.wasmFolder=function(t){switch(t){case e.WasmType.AdvancedWithThreads:return"advanced-threads";case e.WasmType.Advanced:return"advanced";case e.WasmType.Basic:return"basic"}},e.workerErrors=f,Object.defineProperty(e,"__esModule",{value:!0})}));