@scandit/web-datacapture-id
Version:
Scandit Data Capture SDK for the Web
1 lines • 163 kB
JavaScript
import {Color,CameraSettings,Feedback,Sound,Logger,Quadrilateral,DataCaptureError,Brush,Localization,OverrideState,DataCaptureContext,BrowserHelper,DataCaptureLoader,Point,assertUnreachable}from'@scandit/web-datacapture-core';import {isObject}from'@scandit/web-datacapture-core/build/js/private/utils/isObject.js';import {ViewClassNames}from'@scandit/web-datacapture-core/build/js/private/ViewClassNames.js';import {ShutterButton}from'@scandit/web-datacapture-core/build/js/private/ui/atoms/ShutterButton.js';var d={"scandit-datacapture-sdk-id-pthreads.wasm":{bytes:8789943},"scandit-datacapture-sdk-id-simd-pthreads.wasm":{bytes:8724515},"scandit-datacapture-sdk-id.wasm":{bytes:8681841},"scandit-datacapture-sdk-id-simd.wasm":{bytes:8615929}};var Fe=(s=>(s.Undefined="Undefined",s.RecoveredAfterFailure="RecoveredAfterFailure",s.InvalidLicenseKeyForVIZProcessing="InvalidLicenseKeyForVIZProcessing",s.InvalidSettingsForVIZProcessing="InvalidSettingsForVIZProcessing",s.InvalidLicenseKeyForParser="InvalidLicenseKeyForParser",s))(Fe||{}),v=class a extends Error{constructor(){super(...arguments);this._type="Undefined";this._message="";}get type(){return this._type}get message(){return this._message}static create(t){let r=new a;return t&&(r.name=t.type,r._type=t.type,r._message=t.message),r}static fromJSON(t){let r=new a;return r._type=t.type,r._message=t.message,r}};var ie=class{constructor(e){this.idCaptureWorkerManager=e;}get workerCommand(){return this.idCaptureWorkerManager.workerCommand.bind(this.idCaptureWorkerManager)}async getLicenseText(){return (await this.workerCommand("getIdOpenSourceSoftwareLicenseInfo",{})).licenseText}};var nt={"id.idCaptureOverlay.scanFrontSideHint":"","id.idCaptureOverlay.scanBackSideHint":"","id.idCaptureOverlay.moveCloseTextHint":"","id.idCaptureOverlay.moveFurtherAwayTextHint":"","id.idCaptureOverlay.tapShutterToScan":"","id.idCaptureOverlay.lookingForDocument":"","id.idCaptureOverlay.holdStill":""};function st(a){let e=URL.createObjectURL(new Blob(['"use strict";(()=>{var De=(r,e)=>()=>(r&&(e=r(r=0)),e);var C,n=De(()=>{C={"scandit-datacapture-sdk-id-pthreads.wasm":{bytes:8789943},"scandit-datacapture-sdk-id-simd-pthreads.wasm":{bytes:8724515},"scandit-datacapture-sdk-id.wasm":{bytes:8681841},"scandit-datacapture-sdk-id-simd.wasm":{bytes:8615929}}});n();n();n();n();var o;(r=>{(c=>(c.Debug="debug",c.Info="info",c.Warn="warn",c.Error="error",c.Quiet="quiet"))(r.Level||(r.Level={}));let e=new Map([["debug",1],["info",2],["warn",3],["error",4],["quiet",5]]),a="debug";function t(c){a=c}r.setLevel=t;function s(c,...h){if(!(e.get(a)>e.get(c)))switch(c){case"debug":{console.debug(...h);break}case"info":{console.log(...h);break}case"warn":{console.warn(...h);break}case"error":{console.error(...h);break}}}r.log=s;function i(...c){s("warn",...c)}r.warn=i;function d(...c){s("debug",...c)}r.debug=d;function l(...c){s("info",...c)}r.info=l;function g(...c){s("error",...c)}r.error=g})(o||(o={}));n();var Me=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])),ve=()=>(async r=>{try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(r)}catch{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]));function xe(){return typeof crossOriginIsolated>"u"?!1:crossOriginIsolated}function Re(){try{return new WebAssembly.Memory({initial:1,maximum:1,shared:!0}).buffer.constructor.name==="SharedArrayBuffer"}catch{return!1}}async function q(){return Me()}async function Le(){if(!await ve())return!1;let r=null;try{r=new Worker(URL.createObjectURL(new Blob([\'postMessage("Worker" in self);\'],{type:"text/javascript"})),{name:"nestedWorkerTest"})}catch{return!1}return new Promise(e=>{if(r==null){e(!1);return}r.onmessage=a=>{r==null||r.terminate(),e(a.data)}})}async function Z(){let r=await Le();return xe()&&Re()&&r}n();n();n();function ke(r){return/^https?:\\/\\/(?:[^./]*\\.)*cdn.jsdelivr.net\\//.test(r)?{result:!0,cdnBaseURL:"https://cdn.jsdelivr.net/npm/"}:/^https?:\\/\\/(?:[^./]*\\.)*unpkg.com\\//.test(r)?{result:!0,cdnBaseURL:"https://unpkg.com/"}:{result:!1,cdnBaseURL:""}}function Ae(r){let e=/@scandit\\/web-datacapture-[a-z]+/i.exec(r);return e?e[0]:null}function X(r,e,a){let t=e,s=ke(t);if(s.result){let d=Ae(t);d!=null&&(t=`${s.cdnBaseURL}${d}@${r}/sdc-lib/`)}let i=a.replace(".wasm","");return s.result?{jsURI:`${t}${i}.js`,wasmURI:`${t}${i}.wasm`}:{jsURI:`${t}${i}.js?v=${r}`,wasmURI:`${t}${i}.wasm?v=${r}`}}n();n();n();var Y={};function Oe(r){return[...new Uint8Array(r)].map(e=>{let a=e.toString(16);return a.length===1?`0${a}`:a}).join("")}async function*Ee(r){let e=r.getReader();try{for(;;){let{done:a,value:t}=await e.read();if(a)return;yield t}}finally{e.releaseLock()}}async function Pe(r){let e=[],a=0,t=0;for await(let i of Ee(r))e.push(i),a+=i.length;let s=new Uint8Array(a);for(let i of e)s.set(i,t),t+=i.length;return s.buffer}var We=(r=>(r.VALID="VALID",r.INVALID="INVALID",r.NOT_VERIFIABLE="NOT_VERIFIABLE",r))(We||{});async function Fe(r,e,a){if(typeof crypto.subtle.digest!="function")return o.log(o.Level.Warn,`Insecure context (see https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts): The hash of the Scandit Data Capture library WASM file found at ${a} could not be verified`),"NOT_VERIFIABLE";try{let t=r instanceof Promise?await r:r,s=await crypto.subtle.digest("SHA-256",t),i=Oe(s);return e==null?(o.log(o.Level.Warn,"The library hash is not defined or empty, cannot correctly verify integrity."),"NOT_VERIFIABLE"):i===e?(o.log(o.Level.Debug,`Data Capture library WASM integrity found at ${a} has been verified correctly.`),"VALID"):(o.log(o.Level.Warn,`The Scandit Data Capture library WASM file found at ${a} seems invalid: expected file hash doesn\'t match (received: ${i}, expected: ${e}). Please ensure the correct Scandit Data Capture file (with correct version) is retrieved.`),"INVALID")}catch(t){return o.log(o.Level.Warn,"Wasm response could not be verified",t),"NOT_VERIFIABLE"}}var B=new Map([["br",4.4],["gzip",2.9],["none",1]]);function Ne(r){var e;let a="content-encoding";if(r==null||r.get(a)==null)return B.get("none");let t=new Set(((e=r.get(a))!=null?e:"").split(",").map(s=>s.trim()));for(let[s,i]of B)if(t.has(s))return i;return B.get("none")}function Te(r){var e,a;if(r==null)return 0;let t=(e=Ne(r))!=null?e:1,s=Number.parseInt((a=r.get("content-length"))!=null?a:"0",10);return Number.isNaN(s)?0:Math.floor(s*t*100)/100}function He(r){let{pathname:e}=new URL(r);for(let[a,t]of Object.entries(Y))if(e.endsWith(a))return t.bytes;return 0}function Q(r){Y=r}var Be=(r,e)=>{let a=Te(e);return a===0?He(r):a};function Ve(r,e,a,{onProgress:t,onError:s,onComplete:i}){if(!e.body)return[e];let d=Be(r,e.headers),l=0,g=0;if(typeof TransformStream>"u")return o.warn("TransformStream is not supported in this environment. Progress tracking will be disabled."),[e];let[c,h]=a?e.body.tee():[e.body],p=c.pipeThrough(new TransformStream({async transform(m,y){try{l+=m.length,g=Number((l/d*100).toFixed(2)),d>0&&m.length>0&&g<100?t==null||t({percentage:g,loadedBytes:l,privateUri:r}):d===0&&m.length>0&&(t==null||t({percentage:null,loadedBytes:l,privateUri:r})),y.enqueue(m)}catch(S){y.error(S),s==null||s({error:S})}},flush(m){t==null||t({percentage:100,loadedBytes:l,privateUri:r}),i==null||i({percentage:100,loadedBytes:l,privateUri:r}),m.terminate()}}));return[new Response(p,{headers:new Headers(e.headers),status:e.status,statusText:e.statusText}),h]}async function V({wasmURI:r,expectedHash:e,verifyResponseHash:a,onProgress:t,onComplete:s,onError:i,referredOrigin:d}){let l=await fetch(r,{referrerPolicy:"origin",referrer:d!=null?d:""});if(!l.ok)throw new Error(`HTTP status code is not ok: ${l.status}, ${l.statusText}`);let[g,c]=Ve(r,l,a,{onProgress:t,onError:i,onComplete:s});return c!=null&&Fe(Pe(c),e,r),g}function ee({wasmURI:r,expectedHash:e,verifyResponseHash:a,progressCallback:t,successCallback:s,errorCallback:i,importObject:d,referredOrigin:l}){async function g(h){try{let p=await V({wasmURI:r,expectedHash:e,verifyResponseHash:a,onProgress:t,referredOrigin:l}),m=await(h!=null?h:p).arrayBuffer(),y=await self.WebAssembly.instantiate(m,d);s(y.instance,y.module)}catch(p){o.log(o.Level.Error,p),o.log(o.Level.Error,`Couldn\'t instantiate Scandit SDK DataCapture library at ${r}, did you configure the path for it correctly?`),i==null||i(p)}}async function c(){let h;try{h=await V({wasmURI:r,expectedHash:e,verifyResponseHash:a,onProgress:t,referredOrigin:l});let p=await self.WebAssembly.instantiateStreaming(h,d);s(p.instance,p.module)}catch(p){o.log(o.Level.Warn,p),o.log(o.Level.Warn,"WebAssembly streaming compile failed. Falling back to ArrayBuffer instantiation (this will make things slower)"),g((h==null?void 0:h.bodyUsed)===!0?void 0:h)}}typeof self.WebAssembly.instantiateStreaming=="function"?c():g()}async function J(r,e,a,t){return new Promise((s,i)=>{r().then(s).catch(d=>{let l=e*2;if(l>a){i(d);return}t(d),self.setTimeout(()=>{J(r,l,a,t).then(s).catch(i)},e)})})}function _(r){var e,a;let t="unknown";if((e=r.href)!=null&&e.startsWith("blob:null/"))t="localhost";else{let s=((a=r.pathname)==null?void 0:a.length)>1&&!r.pathname.startsWith("/");t=new URL(s?r.pathname:r.origin).hostname}return t.startsWith("[")&&t.endsWith("]")?(t=t.slice(1,-1),t):(/^(\\d{1,3}\\.){3}\\d{1,3}$/.test(t)&&(t=t.split(".").map(s=>Number.parseInt(s,10).toString()).join(".")),t)}async function te(r,e){async function a(){return importScripts(r)}try{await J(a,250,4e3,s=>{o.log(o.Level.Warn,s),o.log(o.Level.Warn,`Couldn\'t retrieve Scandit Data Capture library at ${r}, retrying...`)}),self.Module.mainScriptUrlOrBlob=r;let t=self.SDC_WASM_JS_VERSION;return t!==e&&o.log(o.Level.Warn,`The Scandit Data Capture library JS file found at ${r} seems invalid: expected version doesn\'t match (received: ${t}, expected: ${e}). Please ensure the correct Scandit Data Capture file (with correct version) is retrieved.`),!0}catch(t){return o.log(o.Level.Error,t),!1}}n();n();var E=class ae extends Error{constructor(e){super(e.message),Object.setPrototypeOf(this,ae.prototype),this.name=e.name}toString(){return`${this.name}: ${this.message}`}};var P=Promise.resolve(),$=!1,z=!1,M,U={writableDataPath:""};async function re(r){if(M==null)return;$=!0;let e=new Promise((a,t)=>{setTimeout(()=>{t(new E({name:"BlockedIndexedDB",message:"IndexedDB database is blocked"}))},1500)});try{await Promise.race([new Promise((a,t)=>{M==null||M(r,s=>{if(s!=null){t(s);return}a()})}),e])}finally{$=!1}}async function se(r){return z||($?(z=!0,P=P.then(async()=>(z=!1,re(r)))):P=re(r)),P}async function ie(r){U=r,M=FS.syncfs,FS.syncfs=(e,a)=>{let t=a,s=()=>{t()},i=d=>{t(d)};se(e).then(s).catch(i)};try{FS.mkdir(U.writableDataPath)}catch(e){if(e.code!=="EEXIST")throw M=void 0,e}return FS.mount(IDBFS,{},U.writableDataPath),se(!0)}n();var W;(r=>{function e(){return"7.6.9"}r.sdkVersion=e})(W||(W={}));n();var ne=class{constructor(){this.promise=new Promise((r,e)=>{this.reject=e,this.resolve=r})}};var oe=class de{constructor(e,a){this.hintPresenterV2=null,this.MAX_NUMBER_OF_IMAGES_IN_FRAME_DATA_POOL=10,this.redrawInterval=1e3/30,this.redrawRequests=[],this._isDrawLoopRunning=!1,this.frameDataPool=new Map,this.lastFrameCounter=-1,this.poorMansBenchmarkLogs=!1,this.writableDataPathStandard="/scandit_sync_folder",this.resourceFilesSubfolder="resources",this.performanceMetricsReporterTimer=void 0,this.performanceMetrics={frameDataPoolSize:0,processedFramesCount:0,redrawRequestsCount:0,actualRedrawsCount:0},this.gestureListener=null,this.webPlatformHintPresenter=null,this.moduleHandler=e,this.workerFunctions=a,this._loadProgressCallback=this._loadProgressCallback.bind(this),Q(this.getWasmMetadata())}get Module(){return this.moduleHandler.get()}set isDrawLoopRunning(e){this._isDrawLoopRunning=e,!e&&typeof this.loopTimeoutId=="number"&&(clearTimeout(this.loopTimeoutId),this.loopTimeoutId=void 0)}get isDrawLoopRunning(){return this._isDrawLoopRunning}convertToLoadableFrameData(e){let a=this.getNextFrameId();this.frameDataPool.set(a,new Uint8ClampedArray(e.getFrameData()));let t=this.lastUsedModuleMirrorAxis==null?!1:this.lastUsedModuleMirrorAxis!==this.Module.Axis.None;return{frameId:a,width:e.getWidth(),height:e.getHeight(),isFrameSourceMirrored:t}}createContext(e){var a,t,s,i,d;let l=this.getModeDeserializers(),g=_(location);(g==="localhost"||g==="127.0.0.1")&&navigator.userAgent.includes("Electron")&&e.appName!=null&&(g+=`-${e.appName}`),this.parentDomain=e.parentDomain,this.contextDeserializer=new this.Module.DataCaptureContextDeserializer(this.writableDataPath,e.deviceId,e.context.deviceModelName,g,this.parentDomain,l,e.delayedRegistration,e.highEndBlurryRecognition,this.resourcePath);let c=this.contextDeserializer.contextFromJson(JSON.stringify(e.context));if(c==null){let u=this.contextDeserializer.getLastError();throw new Error(`Could not create the context: ${u}`)}let h=c.getView();this.context=c.getContext(),c.delete();let p=this.Module.DataCaptureContextListener.extend("DataCaptureContextListener",{didChangeStatus:(u,I)=>{this.contextDidChangeStatus(JSON.parse(I.toJson())),u.delete()},didStartObservingContext:u=>{this.didStartObservingContext(),u.delete()},didStopObservingContext:u=>{u.delete()}}),m=this.Module.DataCaptureContextFrameListener.extend("DataCaptureContextFrameListener",{onObservationStarted:u=>{u.delete()},onObservationStopped:u=>{u.delete()},onFrameProcessingStarted:(u,I)=>{this.workerFunctions.postMessage({type:"onFrameProcessingStarted"}),I.delete(),u.delete()},onFrameProcessingFinished:(u,I)=>{this.workerFunctions.postMessage({type:"onFrameProcessingFinished"}),I.delete(),u.delete()},onFrameSkipped:(u,I)=>{this.workerFunctions.postMessage({type:"onFrameSkipped"}),I.delete(),u.delete()}}),y=this.Module.GestureRecognizer.extend("GestureRecognizer",{setGestureListener:(u,I)=>{var A;(A=this.gestureListener)==null||A.delete(),this.gestureListener=u.clone(),u.delete()}});(a=this.gestureRecognizer)==null||a.delete(),this.gestureRecognizer=new y;let S=new p;this.context.addListener(S),S.delete();let b=new m;this.context.addFrameListener(b),b.delete(),this.setView(h),(t=this.view)==null||t.setGestureRecognizer(this.gestureRecognizer);let w=this.Module.PlatformHintPresenter.extend("PlatformHintPresenter",{setHintPresenter:u=>{u.delete()},showToast:u=>{this.workerFunctions.postMessage({type:"showToast",payload:JSON.parse(u)})},hideToast:u=>{this.workerFunctions.postMessage({type:"hideToast",payload:JSON.parse(u)})},showGuidance:u=>{this.workerFunctions.postMessage({type:"showGuidance",payload:JSON.parse(u)})},hideGuidance:u=>{this.workerFunctions.postMessage({type:"hideGuidance",payload:JSON.parse(u)})},startUpdateTimer:u=>{this.workerFunctions.postMessage({type:"startUpdateTimer",payload:{duration:{unit:"ms",value:u}}})},stopUpdateTimer:()=>{this.workerFunctions.postMessage({type:"stopUpdateTimer"})}});(s=this.hintPresenterV2)==null||s.delete(),this.hintPresenterV2=null,(i=this.webPlatformHintPresenter)==null||i.delete(),this.webPlatformHintPresenter=null,this.webPlatformHintPresenter=new w,this.view&&(this.hintPresenterV2=new this.Module.HintPresenterV2(this.webPlatformHintPresenter),(d=this.view)==null||d.setHintPresenterV2(this.hintPresenterV2))}onTap(e){var a;(a=this.gestureListener)==null||a.onTap(JSON.stringify(e))}hintPresenterV2Update(){var e;(e=this.hintPresenterV2)==null||e.update()}startReportingPerformanceMetrics(){this.performanceMetricsReporterTimer==null&&(this.performanceMetricsReporterTimer=setInterval(()=>{this.reportPerformanceMetrics();for(let e of Object.keys(this.performanceMetrics))this.performanceMetrics[e]=0},1e3))}async reportPerformanceMetrics(){this.workerFunctions.postMessage({type:"performanceMetricsReport",payload:{...this.performanceMetrics}})}deleteFrameData(e){this.frameDataPool.delete(e)}dispose(){var e,a,t,s;this.context.dispose(),this.frameDataPool.clear(),this.isDrawLoopRunning=!1,this.lastFrameCounter=-1,(e=this.gestureRecognizer)==null||e.delete(),this.gestureRecognizer=null,(a=this.gestureListener)==null||a.delete(),this.gestureListener=null,(t=this.hintPresenterV2)==null||t.delete(),this.hintPresenterV2=null,(s=this.webPlatformHintPresenter)==null||s.delete(),this.webPlatformHintPresenter=null}flushAnalytics(){this.context.flushAnalytics()}extractCentaurusLicense(e){return{payload:{centaurus:{licenseKey:this.Module.LicenseUtils[de.get3dPartyLicenseKeyMethodName](e)}}}}getModeDeserializers(){return new this.Module.VectorDataCaptureModeDeserializer}loadLibrary(e){return this.libraryLoadingPromise!=null?this.libraryLoadingPromise:(this.libraryLoadingPromise=this.setup(e),this.libraryLoadingPromise)}processFrame(e){var a;if(this.context==null)return{payload:e,transferables:[e.data.buffer]};let t=e.data,s=e.colorType==="GRAYSCALE"?this.Module.ImageBufferFormat.Grayscale8:this.Module.ImageBufferFormat.Rgba8888,i=this.Module.allocateUint8Array(t.byteLength);return this.Module.HEAPU8.set(t,i),(a=this.imageFrameSource)==null||a.outputFrame(i,e.width,e.height,s),{payload:e,transferables:[e.data.buffer]}}reportCameraProperties(e){this.context.setCameraProperties(e.deviceId,e.isFrontFacing,e.hasAutofocus)}requestFrameData(e){let a=this.frameDataPool.get(e);return a==null?{payload:{data:null}}:{payload:{data:a},transferables:[a.buffer]}}scheduleRedraw(e,a){this.addRedrawRequest(a),this.isDrawLoopRunning||this.startDrawLoop(e)}sendViewRefreshCommands(e){this.workerFunctions.postMessage({type:"draw",payload:e},[e.buffer])}setFrameSource(e,a){var t;this.lastUsedModuleMirrorAxis=this.mapMirrorAxisOnModule(e),(t=this.imageFrameSource)==null||t.delete(),this.imageFrameSource=new this.Module.ImageBufferFrameSource(this.lastUsedModuleMirrorAxis,a,0),this.context.setFrameSource(this.imageFrameSource)}startDrawLoop(e){this.isDrawLoopRunning=!0;let a=i=>this.redrawRequests.length>0&&this.redrawRequests[0]<=i,t=i=>{for(;this.redrawRequests.length>0&&this.redrawRequests[0]<=i;)this.redrawRequests.shift()},s=()=>{this.loopTimeoutId=setTimeout(()=>{if(!this.isDrawLoopRunning)return;let i=performance.now();if(a(i)){t(i),e.draw();let d=e.getDrawCommands();this.sendViewRefreshCommands(new Uint8Array(d))}s()},this.redrawInterval)};s()}updateContext(e){if(this.context!=null&&this.contextDeserializer!=null){e.view!=null&&!e.view.visible&&this.context.flushAnalytics();let a=this.onBeforeUpdateContextHook(e),t=this.contextDeserializer.updateContextFromJson(this.context,this.view,JSON.stringify(a.context));if(t==null){let i=this.contextDeserializer.getLastError();throw new Error(`Could not update the context: ${i}`)}this.context.delete(),this.context=t.getContext();let s=t.getView();t.delete(),s!=null&&a.view!=null&&s.setViewSize(a.view.width,a.view.height,a.view.orientation),!this.hintPresenterV2&&this.webPlatformHintPresenter&&(this.hintPresenterV2=new this.Module.HintPresenterV2(this.webPlatformHintPresenter)),s!=null&&this.hintPresenterV2&&s.setHintPresenterV2(this.hintPresenterV2),this.gestureRecognizer!=null&&(s==null||s.setGestureRecognizer(this.gestureRecognizer)),this.setView(s),o.debug("context updated",a)}}onBeforeUpdateContextHook(e){return e}onDocumentVisibilityChange(e){e==="hidden"&&this.context.flushAnalytics()}isFeatureSupported(e){return{payload:{supported:this.context.isFeatureSupported(e)}}}getViewfinderInfo(){var e,a;return{payload:{isDisplayingViewfinder:(a=(e=this.view)==null?void 0:e.isDisplayingViewfinder())!=null?a:!1,rect:JSON.parse(this.view.getViewfinderRect())}}}getOpenSourceSoftwareLicenseInfo(){return{payload:{licenseText:this.Module.OpenSourceSoftwareLicenseInfo.getLicenseText()}}}getNextFrameId(){return this.lastFrameCounter++,this.lastFrameCounter>=this.MAX_NUMBER_OF_IMAGES_IN_FRAME_DATA_POOL&&(this.lastFrameCounter=0),this.lastFrameCounter}getWasmDynamicLibraries(e){return this.getWasmSideModuleFileName()==null?[]:[`${e.replace(/\\/[^/]*$/,"/")}${this.getWasmSideModuleFileName()}`]}getWasmCoreExpectedHash(e,a){return a?e?"092c77226bd59346d04c8b0bc6dbd524a7613f55611c2d4009342f3ff05996ef":"e82b98020dd95ec1a60c3294db9bbfaf28319ab9817d139abdf67f7af10f86f8":e?"b59ba3581456fad4261cf49f085f7bc69d067e41249457a125de66acb8485b8d":""}getWasmCoreFileName(e,a){return a?e?"scandit-datacapture-sdk-id-simd-pthreads.wasm":"scandit-datacapture-sdk-id-pthreads.wasm":e?"scandit-datacapture-sdk-id-simd.wasm":""}getWasmMetadata(){return C}getWasmSideModuleFileName(){return""}_loadProgressCallback(e){this.workerFunctions.postMessage({type:"loadLibraryProgress",payload:e})}addRedrawRequest(e){this.redrawRequests.push(Math.round(performance.now())+e),this.redrawRequests.sort((a,t)=>a-t)}contextDidChangeStatus(e){e.code===260?e.message=e.message.replace("domain name",`domain name (${_(location)})`):e.code===265&&(e.message=e.message.replace("domain name",`domain name (${this.parentDomain})`)),this.workerFunctions.postMessage({type:"contextDidChangeStatus",payload:e})}didStartObservingContext(){this.workerFunctions.postMessage({type:"didStartObservingContext"})}mapMirrorAxisOnModule(e){switch(e){case"None":return this.Module.Axis.None;case"X":return this.Module.Axis.X;case"Y":return this.Module.Axis.Y;default:return this.Module.Axis.None}}setView(e){this.view=e,this.setViewRefreshHandler(e),e==null&&(this.isDrawLoopRunning=!1,this.sendViewRefreshCommands(new Uint8Array([])))}addNativeOverlay(e){o.warn("addNativeOverlay has not been implemented for this module",e)}removeNativeOverlay(e){o.warn("removeNativeOverlay has not been implemented for this module",e)}setViewRefreshHandler(e){if(e==null||e.isViewRefreshHandlerSet)return;let a=this.Module.NeedsRedrawDelegate.extend("NeedsRedrawDelegate",{setNeedsRedrawIn:this.scheduleRedraw.bind(this,e)}),t=new a;e.setNeedsRedrawDelegate(t),e.isViewRefreshHandlerSet=!0}setupDataDecoding(){let e=this.moduleHandler.get(),a=e.DataDecoding.extend("DataDecoding",{decode(t,s){try{let i=JSON.parse(s),d=[];for(let l of i){let g=new TextDecoder(l.ianaName,{fatal:!0});d.push(g.decode(t.slice(l.startIndex,l.endIndex)))}return d.join("")}catch{return""}}});e.setDataDecoding(new a)}start(e,a,t){e&&a&&(this.setupDataDecoding(),this.moduleHandler.get().callMain(),this.moduleHandler.get().__emscripten_proxy_main!==void 0||t())}getWritableDataPath(e){return e!=null?(o.debug(`IndexedDB database name override in use to recover from blocked standard database: ${e}`),e):this.writableDataPathStandard}numOfMBToPages(e){return Math.ceil(1024*e*1024/64/1024)}async setup({libraryLocation:e,locationPath:a,writableDataPathOverride:t,overrideThreadsSupport:s,overrideSimdSupport:i,verifyResponseHash:d,referredOrigin:l,fixedWasmMemory:g}){var c;let h=!1,p=!1;this.writableDataPath=this.getWritableDataPath(t),this.resourcePath=`${e}${this.resourceFilesSubfolder}/`,self.path=a;let{resolve:m,reject:y,promise:S}=new ne,b=W.sdkVersion();if(b==="")throw new E({name:"Invalid library version",message:"Library version is not defined or empty, cannot generate proper path to library files."});let[w,u]=await Promise.all([q(),Z()]);s!=="auto"&&(u=s==="on"),i!=="auto"&&(w=i==="on");let I=this.getWasmCoreFileName(w,u),A=X(b,e,I),{jsURI:H,wasmURI:K}=A,Ie={instantiateWasm:(D,Se)=>(ee({importObject:D,wasmURI:K,expectedHash:this.getWasmCoreExpectedHash(w,u),verifyResponseHash:d,successCallback:Se,progressCallback:this._loadProgressCallback,errorCallback:be=>{y(be)},referredOrigin:l}),{})},O=g===null?null:new WebAssembly.Memory({initial:this.numOfMBToPages(g),maximum:this.numOfMBToPages(300),shared:u});return O!==null&&o.log(o.Level.Debug,"Fixed wasmMemory set",O),this.moduleHandler.set({...O?{wasmMemory:O}:{},mainScriptUrlOrBlob:H,canvas:(c=this.workerFunctions.getOffscreenCanvas())!=null?c:{getContext:()=>null},...Ie,dynamicLibraries:this.getWasmDynamicLibraries(K),locateFile:D=>e+D,noInitialRun:!0,preRun:[async()=>{try{await ie({writableDataPath:this.writableDataPath})}catch(D){if(D.name==="BlockedIndexedDB"){y(D.toString());return}o.log(o.Level.Debug,"No IndexedDB support, some data will not be persisted:",D)}p=!0,this.start(p,h,m)}],onMainComplete:()=>{if([h,p].includes(!1)){o.log(o.Level.Warn,{runtimeLoaded:h,fileSystemSynced:p},"Both runtimeLoaded and fileSystemSynced should be true when calling onMainComplete"),y("onMainComplete has been called but runtime or file system was not ready.");return}m()},onRuntimeInitialized:()=>{h=!0,this.start(p,h,m)},print:D=>{o.log(o.Level.Info,D)}}),await te(H,b)||y(`Couldn\'t retrieve Scandit Data Capture library at ${H}, did you configure the path for it correctly?`),S}};oe.get3dPartyLicenseKeyMethodName=atob("Z2V0QmxpbmtJZExpY2Vuc2VLZXk=");var v=oe;n();var Je=class{constructor(r){if(typeof r!="function")throw new TypeError("FinalizationRegistry callback must be a function")}register(r,e,a){}unregister(r){return!1}};function ue(r){typeof r.FinalizationRegistry>"u"&&(r.FinalizationRegistry=Je)}n();n();function x(r){return typeof r=="object"&&r!=null}function R(r){if(typeof r=="string")return r;if(x(r)){if(typeof r.message=="string")return r.message}else if(typeof(r==null?void 0:r.toString)=="function")return r.toString();return"unknown error"}n();function le(r){return typeof r=="object"&&r!=null&&r.document==null&&"addEventListener"in r&&typeof r.importScripts=="function"}n();function ce(r){console.warn("Reached unexpected case",r)}var j=class{constructor(r,e){this.onMessageListener=this.onMessage.bind(this),this.workerSelf=r,this.dataCaptureInstance=new v(e,{postMessage:this.postMessage.bind(this),getOffscreenCanvas:this.getOffscreenCanvas.bind(this)}),le(r)&&(ue(r),this.listenToMessages())}listenToMessages(){this.workerSelf.addEventListener("message",this.onMessageListener),this.workerSelf.addEventListener("error",r=>{o.log(o.Level.Error,r)}),this.workerSelf.addEventListener("messageerror",r=>{o.log(o.Level.Error,r)})}postMessage(r,e){this.workerSelf.postMessage(r,e!=null?e:[])}getOffscreenCanvas(){if(typeof this.workerSelf.OffscreenCanvas=="function")return new this.workerSelf.OffscreenCanvas(32,32)}hasPayload(r){return x(r)&&"payload"in r}hasTransferables(r){return x(r)&&Array.isArray(r.transferables)}async respondWith(r,e,a){let t=null,s;try{s=a(),s instanceof Promise&&(s=await s)}catch(d){s=void 0,t=R(d)}let i={type:"workerTaskId",command:r,id:e,payload:this.hasPayload(s)?s.payload:void 0};t!=null&&(i.error=t),this.postMessage(i,this.hasTransferables(s)?s.transferables:[])}onMessage(r){switch(r.data.command){case"loadLibrary":{{let{data:e}=r;this.respondWith(e.command,e.id,async()=>this.dataCaptureInstance.loadLibrary({libraryLocation:e.libraryLocation,locationPath:e.locationPath,referredOrigin:e.referredOrigin,writableDataPathOverride:e.writableDataPathOverride,overrideThreadsSupport:e.overrideThreadsSupport,overrideSimdSupport:e.overrideSimdSupport,verifyResponseHash:e.verifyResponseHash,fixedWasmMemory:e.fixedWasmMemory}))}break}case"onTap":{{let{data:e}=r;this.respondWith(e.command,e.id,async()=>{this.dataCaptureInstance.onTap(e.point)})}break}case"hintPresenterV2update":{{let{data:e}=r;this.respondWith(e.command,e.id,async()=>{this.dataCaptureInstance.hintPresenterV2Update()})}break}case"createContext":{{let{data:e}=r;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.createContext({context:e.context,deviceId:e.deviceId,delayedRegistration:e.delayedRegistration,highEndBlurryRecognition:e.highEndBlurryRecognition,appName:e.appName,parentDomain:e.parentDomain}))}break}case"setFrameSource":{{let{data:e}=r;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.setFrameSource(e.mirrorAxis,e.isCameraFrameSource))}break}case"processFrame":{{let{data:e}=r;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.processFrame({data:e.data,width:e.width,height:e.height,colorType:e.colorType}))}break}case"requestFrameData":{{let{data:e}=r;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.requestFrameData(e.frameId))}break}case"deleteFrameData":{{let{data:e}=r;this.respondWith(e.command,e.id,()=>{this.dataCaptureInstance.deleteFrameData(e.frameId)})}break}case"updateContext":{{let{data:e}=r;this.respondWith(e.command,e.id,async()=>this.dataCaptureInstance.updateContext(e))}break}case"dispose":{this.respondWith(r.data.command,r.data.id,()=>this.dataCaptureInstance.dispose());break}case"flushAnalytics":{this.respondWith(r.data.command,r.data.id,()=>{this.dataCaptureInstance.flushAnalytics()});break}case"reportCameraProperties":{{let{data:e}=r;this.respondWith(e.command,e.id,async()=>this.dataCaptureInstance.reportCameraProperties(e))}break}case"setLogLevel":{{let{data:e}=r;this.respondWith(e.command,e.id,()=>{o.setLevel(e.level)})}break}case"extractCentaurusLicense":{{let{data:e}=r;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.extractCentaurusLicense(e.licenseKey))}break}case"documentVisibility":{{let{data:e}=r;this.respondWith(e.command,e.id,()=>{this.dataCaptureInstance.onDocumentVisibilityChange(e.state)})}break}case"isFeatureSupported":{{let{data:e}=r;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.isFeatureSupported(e.feature))}break}case"getViewfinderInfo":{{let{data:e}=r;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.getViewfinderInfo())}break}case"getOpenSourceSoftwareLicenseInfo":{{let{data:e}=r;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.getOpenSourceSoftwareLicenseInfo())}break}case"addNativeOverlay":this.dataCaptureInstance.addNativeOverlay(r);break;case"removeNativeOverlay":this.dataCaptureInstance.removeNativeOverlay(r);break;default:return ce(r.data),!1}return!0}};n();var pe=class L{constructor(){this.subscribers=new Set}static getInstance(){return L.instance||(L.instance=new L),L.instance}subscribe(e){this.subscribers.add(e)}unsubscribe(e){this.subscribers.has(e)&&this.subscribers.delete(e)}notify(e){for(let a of this.subscribers)a(e)}};pe.instance=null;var me=pe;n();var Ce=class k extends EventTarget{constructor(){super(),this.userLicenseKey=null,this._configurePhase="unconfigured",this._configurePromise=null,this.userLicenseKey=null,this.mainDataCaptureLoader=void 0,this.dataCaptureLoaders=new Map,this.libraryLocation=void 0}static getInstance(){return k.instance||(k.instance=new k),k.instance}set configurePhase(e){this._configurePhase=e}get configurePhase(){return this._configurePhase}set configurePromise(e){this._configurePromise=e}get configurePromise(){return this._configurePromise}};Ce.instance=null;var ge=Ce;var sa=ge.getInstance(),ia=me.getInstance();n();n();n();n();n();function he(r){return r.ok()}function fe(r,e){return he(r)?r.value():e}function ye(r,e){return he(r)?e:r.error()}function f(r,e){return r===void 0?e:r}var F=class{constructor(e,a,t){this.SDCIdCaptureMode=null;this.lastResult="";this.lastError="";this.lastLocalizedId="";this.lastDetectionIssue="";this.coreEngine=e,this.Module=e.Module,this.workerFunctions=e.workerFunctions,this.start(a,t)}start(e,a){this.initHintPresenterIfNotInitialized();let t=this.Module.IdCaptureListener.extend("IdCaptureListener",{onSessionUpdated:(p,m)=>{p.delete(),m.delete()},onIdCaptured:(p,m)=>{this.onIdCapturedCallback(m),p.delete(),m.delete()},onIdPartiallyCaptured:(p,m)=>{this.onIdPartiallyCapturedCallback(m),p.delete(),m.delete()},onIdRejected:(p,m,y)=>{this.onIdRejectedCallback(m,y),p.delete(),m==null||m.delete()},onIdLocalized:(p,m)=>{this.onIdLocalizedCallback(m),p.delete()},onShutterButtonPositionChanged:p=>{this.onShutterButtonPositionChangedCallback(p)},onShutterButtonStateChanged:p=>{this.onShutterButtonStateChangedCallback(p)}}),s=this.Module.Feedback.extend("Feedback",{emit:()=>{this.workerFunctions.postMessage({type:"idCaptureIdCapturedFeedback"})}}),i=this.Module.Feedback.extend("Feedback",{emit:()=>{this.workerFunctions.postMessage({type:"idCaptureIdRejectedFeedback"})}}),d=this.Module.IdCaptureBackend.extend("IdCaptureBackend",{getLastError:()=>this.lastError,getLastResult:()=>this.backendGetLastResult(),getLocalizedOnlyId:()=>this.lastLocalizedId,getLastIssue:()=>this.lastDetectionIssue,processFrame:()=>{},reset:this.onResetFromSDC.bind(this),setDetectionOnlyMode:this.setDetectionOnlyMode.bind(this)}),l=new d;this.SDCIdCaptureMode=new this.Module.IdCapture(e,l,a,null),l.delete();let g=new t;this.SDCIdCaptureMode.addListener(g),g.delete();let c=new s,h=new i;this.SDCIdCaptureMode.setFeedbacks(c,h),c.delete(),h.delete()}getSDCIdCaptureMode(){if(!this.SDCIdCaptureMode)throw new Error("IdCaptureMode not initialized");return this.SDCIdCaptureMode}backendGetLastResult(){return this.lastResult}setLastResult(e){this.lastResult=e}setLastError(e){this.lastError=e}setLastLocalizedId(e){this.lastLocalizedId=e}setLastDetectionIssue(e){this.lastDetectionIssue=e}applySettings(e){var a;(a=this.SDCIdCaptureMode)==null||a.applySettings(JSON.stringify(e))}reset(){var e;(e=this.SDCIdCaptureMode)==null||e.reset()}setExternalTransactionId(e){var a;(a=this.SDCIdCaptureMode)==null||a.setExternalTransactionId(e)}getExternalTransactionId(){var e;return(e=this.SDCIdCaptureMode)==null?void 0:e.getExternalTransactionId()}parseCode(e){if(this.SDCIdCaptureMode){let a=this.SDCIdCaptureMode.parse(e);if(a.ok()){let t=fe(a,null);if(t!=null){let s=this.extractCaptureId(t);if(s!=null)return{status:"success",capturedId:s}}}else return{status:"error",error:ye(a,"Undefined error")}}return null}getCentaurusSettings(){let e=this.getSDCIdCaptureMode().getCentaurusSettings();return JSON.parse(e)}dataConsistencyVerifyCapture(e){let t=new this.Module.DataConsistencyVerifier(this.coreEngine.context).verify(JSON.stringify(e));if(t==null)return null;let s=JSON.parse(t.toJson());return t.delete(),s}async barcodeVerifyAamvaCapture(e,a){return new Promise(t=>{let s=this.Module.AamvaBarcodeVerifier.extend("AamvaBarcodeVerifier",{retriggerVerificationIn(d){setTimeout(()=>{i.startVerification(JSON.stringify(e))},d)},verificationEnded(){let d=i.getBarcodeVerificationResponse();t({isSuccess:d.isSuccess,error:d.error,allChecksPassed:d.allChecksPassed,serverResponseJSON:d.serverResponseJson})}}),i=new s;i.initialize(this.coreEngine.context,a==null?"":a),i.startVerification(JSON.stringify(e))})}onResetFromSDC(e){this.workerFunctions.postMessage({type:"idCaptureBackendReset"}),this.lastError="",this.lastResult="",this.lastLocalizedId=""}setDetectionOnlyMode(e){this.workerFunctions.postMessage({type:"idCaptureDetectionOnlyMode",payload:{detectionOnlyMode:e}})}onIdCapturedCallback(e){let a=this.extractCaptureId(e);a&&this.workerFunctions.postMessage({type:"idCaptureDidCaptureId",payload:{capturedId:a}},this.extractImageTransferablesFromCapturedId(a))}onIdPartiallyCapturedCallback(e){let a=this.extractCaptureId(e);a&&this.workerFunctions.postMessage({type:"idCaptureDidPartiallyCaptureId",payload:{capturedId:a}},this.extractImageTransferablesFromCapturedId(a))}onIdRejectedCallback(e,a){let t=this.extractCaptureId(e);this.workerFunctions.postMessage({type:"idCaptureDidRejectId",payload:{capturedId:t,rejectionReason:a}},t?this.extractImageTransferablesFromCapturedId(t):[])}onIdLocalizedCallback(e){this.workerFunctions.postMessage({type:"idCaptureDidLocalizeId",payload:{localization:JSON.parse(e)}})}extractCaptureId(e){var p,m,y,S,b,w,u,I;if(e==null)return null;let a=e.getImages(),t=a.getFrameFront(),s=a.getFrameBack(),i=f(a.getFace(),null),d=f(a.getCroppedDocumentFront(),null),l=f(a.getCroppedDocumentBack(),null),g={front:{face:i,croppedDocument:d,frame:{data:t?new Uint8ClampedArray(t.getFrameData()):null,width:(p=t==null?void 0:t.getWidth())!=null?p:0,height:(m=t==null?void 0:t.getHeight())!=null?m:0,mirrorAxis:(y=t==null?void 0:t.getMirrorAxis().value)!=null?y:0,orientation:(S=t==null?void 0:t.getOrientation())!=null?S:0}},back:{face:null,croppedDocument:l,frame:{data:s?new Uint8ClampedArray(s.getFrameData()):null,width:(b=s==null?void 0:s.getWidth())!=null?b:0,height:(w=s==null?void 0:s.getHeight())!=null?w:0,mirrorAxis:(u=s==null?void 0:s.getMirrorAxis().value)!=null?u:0,orientation:(I=s==null?void 0:s.getOrientation())!=null?I:0}}};t==null||t.delete(),s==null||s.delete(),a.delete();let c=JSON.parse(e.toJson());return{...{firstName:f(e.getFirstName(),""),lastName:f(e.getLastName(),""),secondaryLastName:f(e.getSecondaryLastName(),""),fullName:e.getFullName(),sex:f(e.getSex(),""),age:f(e.getAge(),null),isExpired:f(e.isExpired(),null),nationality:f(e.getNationality(),""),address:f(e.getAddress(),""),issuingCountry:f(e.getIssuingCountry(),""),issuingCountryIso:f(e.getIssuingCountryIso(),""),documentNumber:f(e.getDocumentNumber(),""),documentAdditionalNumber:f(e.getDocumentAdditionalNumber(),""),dateOfBirth:G(f(e.getDateOfBirth(),null)),dateOfExpiry:G(f(e.getDateOfExpiry(),null)),dateOfIssue:G(f(e.getDateOfIssue(),null)),documentType:f(e.getDocumentType(),null),documentSubtype:f(e.getDocumentSubtype(),null)},...c,imageInfo:null,rawImageInfo:g}}onShutterButtonPositionChangedCallback(e){this.workerFunctions.postMessage({type:"idCaptureDidShutterButtonPositionChanged",payload:{position:JSON.parse(e)}})}onShutterButtonStateChangedCallback(e){this.workerFunctions.postMessage({type:"idCaptureDidShutterButtonStateChanged",payload:{state:e}})}async reportSafariAbruptReload(e){let a=new this.Module.OutOfMemoryAnalyticsData(e.framesProcessedCount,e.didCaptureCount,e.didRejectCount,e.applySettingsCount,e.upTime,e.videoResolution,e.parentDomain,e.centaurusEnabled);this.Module.OutOfMemoryAnalyticsHelper.storeAnalyticsEvent(this.coreEngine.context,a),a.delete()}parseIdCaptureSession(e){return JSON.parse(e.toJson())}dispose(){var e;(e=this.SDCIdCaptureMode)==null||e.delete(),this.SDCIdCaptureMode=null,this.lastError="",this.lastLocalizedId="",this.lastResult=""}extractImageTransferablesFromCapturedId(e){let a=[];return e.rawImageInfo.front.frame.data&&e.rawImageInfo.front.frame.data.length>0&&a.push(e.rawImageInfo.front.frame.data.buffer),e.rawImageInfo.back.frame.data&&e.rawImageInfo.back.frame.data.length>0&&a.push(e.rawImageInfo.back.frame.data.buffer),a}isReadyToDisplayHints(){return this.coreEngine.view?this.coreEngine.view.hintPresenterInitialized():!1}initHintPresenterIfNotInitialized(){var a;if(this.isReadyToDisplayHints())return;let e=this.Module.HintPresenter.extend("HintPresenter",{showHint:(t,s)=>{this.workerFunctions.postMessage({type:"showHint",payload:{text:t,style:JSON.parse(s)}})},updateHint:t=>{this.workerFunctions.postMessage({type:"updateHint",payload:{style:JSON.parse(t)}})},hideHint:()=>{this.workerFunctions.postMessage({type:"hideHint",payload:{}})}});(a=this.coreEngine.view)==null||a.setHintPresenter(new e)}};function G(r){if(typeof r=="string")try{return JSON.parse(r)}catch{return null}return null}function _e(r,e,a){let t=e.IdCaptureDeserializerHelper.extend("IdCaptureDeserializerHelper",{createMode:(d,l)=>{let g=new F(r,d,l);return a(g),d.delete(),l.delete(),g.getSDCIdCaptureMode()}}),s=new t,i=new e.IdCaptureDeserializer(s);return s.delete(),i}var N=class extends v{constructor(){super(...arguments);this.idCaptureMode=null;this.lastIdCaptureModeSerializedSettings=""}getModeDeserializers(){let a=super.getModeDeserializers();return a.push_back(_e(this,this.Module,this.receiveNewCaptureMode.bind(this))),a}receiveNewCaptureMode(a){this.idCaptureMode=a}processFrame(a){return this.idCaptureMode?super.processFrame(a):{payload:a,transferables:[a.data.buffer]}}updateContext(a){super.updateContext(a)}idCaptureSetLastResult(a){var t;(t=this.idCaptureMode)==null||t.setLastResult(a)}idCaptureSetLastError(a){var t;(t=this.idCaptureMode)==null||t.setLastError(a)}idCaptureSetLastLocalizedId(a){var t;(t=this.idCaptureMode)==null||t.setLastLocalizedId(a)}idCaptureSetLastDetectionIssue(a){var t;(t=this.idCaptureMode)==null||t.setLastDetectionIssue(a)}idCaptureReset(){var a;(a=this.idCaptureMode)==null||a.reset()}idCaptureSetExternalTransactionId(a){var t;(t=this.idCaptureMode)==null||t.setExternalTransactionId(a)}idCaptureGetExternalTransactionId(){var a,t;return{payload:{transactionId:(t=(a=this.idCaptureMode)==null?void 0:a.getExternalTransactionId())!=null?t:null}}}idCaptureApplySettings(a){var t;(t=this.idCaptureMode)==null||t.applySettings(a)}idCaptureGetCentaurusSettings(){return{payload:{result:this.idCaptureMode.getCentaurusSettings()}}}idCaptureParse(a){var t,s;return{payload:{result:(s=(t=this.idCaptureMode)==null?void 0:t.parseCode(a))!=null?s:null}}}async idCaptureBarcodeVerifyAamvaCapture(a,t){var s,i;return{payload:{result:(i=await((s=this.idCaptureMode)==null?void 0:s.barcodeVerifyAamvaCapture(a,t)))!=null?i:null}}}idCaptureDataConsistencyVerifyCapture(a){var t,s;return{payload:{result:(s=(t=this.idCaptureMode)==null?void 0:t.dataConsistencyVerifyCapture(a))!=null?s:null}}}idCaptureDrivingLicenseDetailsCreateWithCentaurusData(a,t,s){let i=this.Module.DrivingLicenseDetails.createWithCentaurusData(a,t,s);return{payload:{result:JSON.parse(i)}}}getIdOpenSourceSoftwareLicenseInfo(){return{payload:{licenseText:this.Module.IdOpenSourceSoftwareLicenseInfo.getLicenseText()}}}idCaptureReportSafariAbruptReload(a){var t;(t=this.idCaptureMode)==null||t.reportSafariAbruptReload(a)}idCaptureDispose(){var a;(a=this.idCaptureMode)==null||a.dispose(),this.idCaptureMode=null}getWasmSideModuleFileName(){return""}getWasmCoreFileName(a,t){return t?a?"scandit-datacapture-sdk-id-simd-pthreads.wasm":"scandit-datacapture-sdk-id-pthreads.wasm":a?"scandit-datacapture-sdk-id-simd.wasm":"scandit-datacapture-sdk-id.wasm"}getWasmCoreExpectedHash(a,t){return t?a?"092c77226bd59346d04c8b0bc6dbd524a7613f55611c2d4009342f3ff05996ef":"e82b98020dd95ec1a60c3294db9bbfaf28319ab9817d139abdf67f7af10f86f8":a?"b59ba3581456fad4261cf49f085f7bc69d067e41249457a125de66acb8485b8d":"e6e68eb01b6113ee93428a9fd5b744e32272336189480db88f09de7c84dd2269"}getWasmMetadata(){return C}};var T=class extends j{constructor(e,a){super(e,a),this.dataCaptureInstance=new N(a,{postMessage:this.postMessage.bind(this),getOffscreenCanvas:this.getOffscreenCanvas.bind(this)})}async respondWith(e,a,t){let s=null,i;try{i=t(),i instanceof Promise&&(i=await i)}catch(l){o.log(o.Level.Debug,l),i=void 0,s=R(l)}let d={type:"workerTaskId",command:e,id:a,payload:this.hasPayload(i)?i.payload:void 0};s!=null&&(d.error=s),this.postMessage(d,this.hasTransferables(i)?i.transferables:[])}onMessage(e){switch(e.data.command){case"idCaptureSetLastResult":{let{data:t}=e;return this.respondWith(t.command,t.id,()=>{this.dataCaptureInstance.idCaptureSetLastResult(t.result)}),!0}case"idCaptureSetLastError":{let{data:t}=e;return this.respondWith(t.command,t.id,()=>{this.dataCaptureInstance.idCaptureSetLastError(t.error)}),!0}case"idCaptureSetLastLocalizedId":{let{data:t}=e;return this.respondWith(t.command,t.id,()=>{this.dataCaptureInstance.idCaptureSetLastLocalizedId(t.localizedId)}),!0}case"idCaptureSetLastDetectionIssue":{let{data:t}=e;return this.respondWith(t.command,t.id,()=>{this.dataCaptureInstance.idCaptureSetLastDetectionIssue(t.issue)}),!0}case"idCaptureReset":{let{data:t}=e;return this.respondWith(t.command,t.id,()=>this.dataCaptureInstance.idCaptureReset()),!0}case"idCaptureDispose":{let{data:t}=e;return this.respondWith(t.command,t.id,()=>this.dataCaptureInstance.idCaptureDispose()),!0}case"idCaptureApplySettings":{let{data:t}=e;return this.respondWith(t.command,t.id,()=>this.dataCaptureInstance.idCaptureApplySettings(t.settings)),!0}case"idCaptureParse":{let{data:t}=e;return this.respondWith(t.command,t.id,()=>this.dataCaptureInstance.idCaptureParse(t.code)),!0}case"idCaptureGetCentaurusSettings":{let{data:t}=e;return this.respondWith(t.command,t.id,()=>this.dataCaptureInstance.idCaptureGetCentaurusSettings()),!0}case"idCaptureBarcodeVerifyAamvaCapture":{let{data:t}=e;return this.respondWith(t.command,t.id,()=>this.dataCaptureInstance.idCaptureBarcodeVerifyAamvaCapture(t.capturedId,t.endpoint)),!0}case"idCaptureDataConsistencyVerifyCapture":{let{data:t}=e;return this.respondWith(t.command,t.id,()=>this.dataCaptureInstance.idCaptureDataConsistencyVerifyCapture(t.capturedId)),!0}case"idCaptureDrivingLicenseDetailsCreateWithCentaurusData":{let{data:t}=e;return this.respondWith(t.command,t.id,()=>this.dataCaptureInstance.idCaptureDrivingLicenseDetailsCreateWithCentaurusData(t.details.vehicleClass,t.details.restrictions,t.details.endorsements)),!0}case"getIdOpenSourceSoftwareLicenseInfo":{let{data:t}=e;return this.respondWith(t.command,t.id,()=>this.dataCaptureInstance.getIdOpenSourceSoftwareLicenseInfo()),!0}case"idCaptureReportSafariAbruptReload":{let{data:t}=e;return this.respondWith(t.command,t.id,()=>this.dataCaptureInstance.idCaptureReportSafariAbruptReload(t.environmentData)),!0}case"idCaptureSetExternalTransactionId":{let{data:t}=e;return this.respondWith(t.command,t.id,()=>this.dataCaptureInstance.idCaptureSetExternalTransactionId(t.transactionId)),!0}case"idCaptureGetExternalTransactionId":{let{data:t}=e;return this.respondWith(t.command,t.id,()=>this.dataCaptureInstance.idCaptureGetExternalTransactionId()),!0}default:return super.onMessage(e)}}};var Ea=new T(self,{get:()=>self.Module,set:r=>{self.Module=r}});function Pa(r){}})();\n'],{type:"application/javascript"})),t=new Worker(e,a);return URL.revokeObjectURL(e),t}var ne=class a extends DataCaptureLoader{constructor(){super(...arguments);this._name="IdCapture";}get dataCaptureWorker(){return (this._dataCaptureWorker)!=null||(this._dataCaptureWorker=st({name:this.name})),this._dataCaptureWorker}get name(){return this._name}get fixedWasmMemory(){return BrowserHelper.isIPhone()&&BrowserHelper.isSafari()?256:null}static async create(t){var i;let r=new a(t);return r.workerCommand("setLogLevel",{level:(i=t.logLevel)!=null?i:Logger.Level.Debug}),await r.load(),r}async workerCommand(...t){let[r,i,s]=t;return new Promise((o,u)=>{let c=this.workerCommandId++;this.workerTasks.set(c,{resolve:o,reject:u,command:r});let m={...i,command:r,id:c};this.dataCaptureWorker.postMessage(m,s);})}};var mt=Symbol("Comlink.proxy"),Kt=Symbol("Comlink.endpoint"),ht=Symbol("Comlink.releaseProxy"),Je=Symbol("Comlink.finalizer"),oe=Symbol("Comlink.thrown"),gt=a=>typeof a=="object"&&a!==null||typeof a=="function",Gt={canHandle:a=>gt(a)&&a[mt],serialize(a){let{port1:e,port2:t}=new MessageChannel;return Ct(a,e),[t,[t]]},deserialize(a){return a.start(),yt(a)}},Zt={canHandle:a=>gt(a)&&oe in a,serialize({value:a}){let e;return a instanceof Error?e={isError:true,value:{message:a.message,name:a.name,stack:a.stack}}:e={isError:false,value:a},[e,[]]},deserialize(a){throw a.isError?Object.assign(new Error(a.value.message),a.value):a.value}},ft=new Map([["proxy",Gt],["throw",Zt]]);function Qt(a,e){for(let t of a)if(e===t||t==="*"||t instanceof RegExp&&t.test(e))return true;return false}function Ct(a,e=globalThis,t=["*"]){e.addEventListener("message",function r(i){if(!i||!i.data)return;if(!Qt(t,i.origin)){console.warn(`Invalid origin '${i.origin}' for comlink proxy`);return}let{id:s,type:o,path:u}=Object.assign({path:[]},i.data),c=(i.data.argumentList||[]).map(P),m;try{let h=u.slice(0,-1).reduce((C,N)=>C[N],a),g=u.reduce((C,N)=>C[N],a);switch(o){case "GET":m=g;break;case "SET":h[u.slice(-1)[0]]=P(i.data.value),m=true;break;case "APPLY":m=g.apply(h,c);break;case "CONSTRUCT":{let C=new g(...c);m=vt(C);}break;case "ENDPOINT":{let{port1:C,port2:N}=new MessageChannel;Ct(a,N),m=tr(C,[C]);}break;case "RELEASE":m=void 0;break;default:return}}catch(h){m={value:h,[oe]:0};}Promise.resolve(m).catch(h=>({value:h,[oe]:0})).then(h=>{let[g,C]=de(h);e.postMessage(Object.assign(Object.assign({},g),{id:s}),C),o==="RELEASE"&&(e.removeEventListener("message",r),St(e),Je in a&&typeof a[Je]=="function"&&a[Je]());}).catch(h=>{let[g,C]=de({value:new TypeError("Unserializable return value"),[oe]:0});e.postMessage(Object.assign(Object.assign({},g),{id:s}),C);});}),e.start&&e.start();}function $t(a){return a.constructor.name==="MessagePort"}function St(a){$t(a)&&a.close();}function yt(a,e){let t=new Map;return a.addEventListener("message",function(i){let{data:s}=i;if(!s||!s.id)return;let o=t.get(s.id);if(o)try{o(s);}finally{t.delete(s.id);}}),ze(a,t,[],e)}function se(a){if(a)throw new Error("Proxy has been released and is not useable")}function bt(a){return j(a,new Map,{type:"RELEASE"}).then(()=>{St(a);})}var ue=new WeakMap,le="FinalizationRegistry"in globalThis&&new FinalizationRegistry(a=>{let e=(ue.get(a)||0)-1;ue.set(a,e),e===0&&bt(a);});function Yt(a,e){let t=(ue.get(e)||0)+1;ue.set(e,t),le&&le.register(a,e,a);}function Xt(a){le&&le.unregister(a);}function ze(a,e,t=[],r=function(){}){let i=false,s=new Proxy(r,{get(o,u){if(se(i),u===ht)return ()=>{Xt(s),bt(a),e.clear(),i=true;};if(u==="then"){if(t.length===0)return {then:()=>s};let c=j(a,e,{type:"GET",path:t.map(m=>m.toString())}).then(P);return c.then.bind(c)}return ze(a,e,[...t,u])},set(o,u,c){se(i);let[m,h]=de(c);return j(a,e,{type:"SET",path:[...t,u].map(g=>g.toString()),value:m},h).then(P)},apply(o,u,c){se(i);let m=t[t.length-1];if(m===Kt)return j(a,e,{type:"ENDPOINT"}).then(P);if(m==="bind")return ze(a,e,t.slice(0,-1));let[h,g]=ut(c);return j(a,e,{type:"APPLY",path:t.map(C=>C.toString()),argumentList:h},g).then(P)},construct(o,u){se(i);let[c,m]=ut(u);return j(a,e,{type:"CONSTRUCT",path:t.map(h=>h.toString()),argumentList:c},m).then(P)}});return Yt(s,a),s}function er(a){return Array.prototype.concat.apply([],a)}function ut(a){let e=a.map(de);return [e.map(t=>t[0]),er(e.map(t=>t[1]))]}var It=new WeakMap;function tr(a,e){return It.set(a,e),a}function vt(a){return Object.assign(a,{[mt]:true})}function de(a){for(let[e,t]of ft)if(t.canHandle(a)){let[r,i]=t.serialize(a);return [{type:"HANDLER",name:e,value:r},i]}return [{type:"RAW",value:a},It.get(a)||[]]}function P(a){switch(a.type){case "HANDLER":return ft.get(a.name).deserialize(a.value);case "RAW":return a.value}}function j(a,e,t,r){return new Promise(i=>{let s=rr();e.set(s,i),a.start&&a.start(),a.postMessage(Object.assign({id:s},t),r);})}function rr(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}var lt="application/javascript",ar=(a,e={})=>{let t={skipSameOrigin:true,useBlob:true,...e};i