@scandit/web-datacapture-core 7.6.5 → 7.6.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright © 2025 Scandit AG. All Rights Reserved.
1
+ Copyright © 2026 Scandit AG. All Rights Reserved.
2
2
 
3
3
  The use of this software is governed by the Scandit Terms and Conditions.
4
4
  https://ssl.scandit.com/terms/terms.pdf
@@ -1 +1 @@
1
- export{a as DataCaptureContext}from'./chunks/chunk-CKBTO64W.js';
1
+ export{a as DataCaptureContext}from'./chunks/chunk-OH47MYOE.js';
@@ -1 +1 @@
1
- export{a as DataCaptureVersion}from'./chunks/chunk-6W36BRWI.js';
1
+ export{a as DataCaptureVersion}from'./chunks/chunk-HPHMQ52J.js';
@@ -13,11 +13,12 @@ interface LoadingStatusSubscriber {
13
13
  (info: ProgressInfo): void;
14
14
  }
15
15
  declare class LoadingStatus {
16
+ private static instance;
17
+ static getInstance(): LoadingStatus;
16
18
  private readonly subscribers;
17
19
  subscribe(subscriber: LoadingStatusSubscriber): void;
18
20
  unsubscribe(subscriber: LoadingStatusSubscriber): void;
19
21
  private notify;
20
22
  }
21
- declare const loadingStatus: LoadingStatus;
22
23
 
23
- export { LoadingStatus, type LoadingStatusSubscriber, type ProgressInfo, loadingStatus as default };
24
+ export { LoadingStatus, type LoadingStatusSubscriber, type ProgressInfo };
@@ -1 +1 @@
1
- export{a as LoadingStatus,b as default}from'./chunks/chunk-6H6FKGVE.js';
1
+ export{a as LoadingStatus}from'./chunks/chunk-JQDTJGOT.js';
@@ -1 +1 @@
1
- import {a}from'./chunk-QUJWWKHB.js';import {a as a$2}from'./chunk-SEAVQZN6.js';import {a as a$5}from'./chunk-AIRWHLJH.js';import {a as a$1}from'./chunk-QCRFVRSS.js';import {a as a$4}from'./chunk-FGO2SSRS.js';import {b}from'./chunk-FTD535WI.js';import {a as a$3}from'./chunk-XR65N6EG.js';var h=class{constructor(a$3,e){this.onMessageListener=this.onMessage.bind(this);this.workerSelf=a$3,this.dataCaptureInstance=new a(e,{postMessage:this.postMessage.bind(this),getOffscreenCanvas:this.getOffscreenCanvas.bind(this)}),a$1(a$3)&&(a$2(a$3),this.listenToMessages());}listenToMessages(){this.workerSelf.addEventListener("message",this.onMessageListener),this.workerSelf.addEventListener("error",a=>{a$3.log(a$3.Level.Error,a);}),this.workerSelf.addEventListener("messageerror",a=>{a$3.log(a$3.Level.Error,a);});}postMessage(a,e){this.workerSelf.postMessage(a,e!=null?e:[]);}getOffscreenCanvas(){if(typeof this.workerSelf.OffscreenCanvas=="function")return new this.workerSelf.OffscreenCanvas(32,32)}hasPayload(a){return a$4(a)&&"payload"in a}hasTransferables(a){return a$4(a)&&Array.isArray(a.transferables)}async respondWith(a,e,l){let r=null,t;try{t=l(),t instanceof Promise&&(t=await t);}catch(m){t=void 0,r=a$5(m);}let n={type:"workerTaskId",command:a,id:e,payload:this.hasPayload(t)?t.payload:void 0};r!=null&&(n.error=r),this.postMessage(n,this.hasTransferables(t)?t.transferables:[]);}onMessage(a){switch(a.data.command){case "loadLibrary":{{let{data:e}=a;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}=a;this.respondWith(e.command,e.id,async()=>{this.dataCaptureInstance.onTap(e.point);});}break}case "hintPresenterV2update":{{let{data:e}=a;this.respondWith(e.command,e.id,async()=>{this.dataCaptureInstance.hintPresenterV2Update();});}break}case "createContext":{{let{data:e}=a;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}=a;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.setFrameSource(e.mirrorAxis,e.isCameraFrameSource));}break}case "processFrame":{{let{data:e}=a;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}=a;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.requestFrameData(e.frameId));}break}case "deleteFrameData":{{let{data:e}=a;this.respondWith(e.command,e.id,()=>{this.dataCaptureInstance.deleteFrameData(e.frameId);});}break}case "updateContext":{{let{data:e}=a;this.respondWith(e.command,e.id,async()=>this.dataCaptureInstance.updateContext(e));}break}case "dispose":{this.respondWith(a.data.command,a.data.id,()=>this.dataCaptureInstance.dispose());break}case "flushAnalytics":{this.respondWith(a.data.command,a.data.id,()=>{this.dataCaptureInstance.flushAnalytics();});break}case "reportCameraProperties":{{let{data:e}=a;this.respondWith(e.command,e.id,async()=>this.dataCaptureInstance.reportCameraProperties(e));}break}case "setLogLevel":{{let{data:e}=a;this.respondWith(e.command,e.id,()=>{a$3.setLevel(e.level);});}break}case "extractCentaurusLicense":{{let{data:e}=a;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.extractCentaurusLicense(e.licenseKey));}break}case "documentVisibility":{{let{data:e}=a;this.respondWith(e.command,e.id,()=>{this.dataCaptureInstance.onDocumentVisibilityChange(e.state);});}break}case "isFeatureSupported":{{let{data:e}=a;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.isFeatureSupported(e.feature));}break}case "getViewfinderInfo":{{let{data:e}=a;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.getViewfinderInfo());}break}case "getOpenSourceSoftwareLicenseInfo":{{let{data:e}=a;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.getOpenSourceSoftwareLicenseInfo());}break}case "addNativeOverlay":this.dataCaptureInstance.addNativeOverlay(a);break;case "removeNativeOverlay":this.dataCaptureInstance.removeNativeOverlay(a);break;default:return b(a.data),false}return true}};export{h as a};
1
+ import {a}from'./chunk-MQ3WX6DY.js';import {a as a$2}from'./chunk-SEAVQZN6.js';import {a as a$5}from'./chunk-AIRWHLJH.js';import {a as a$1}from'./chunk-QCRFVRSS.js';import {a as a$4}from'./chunk-FGO2SSRS.js';import {b}from'./chunk-FTD535WI.js';import {a as a$3}from'./chunk-XR65N6EG.js';var h=class{constructor(a$3,e){this.onMessageListener=this.onMessage.bind(this);this.workerSelf=a$3,this.dataCaptureInstance=new a(e,{postMessage:this.postMessage.bind(this),getOffscreenCanvas:this.getOffscreenCanvas.bind(this)}),a$1(a$3)&&(a$2(a$3),this.listenToMessages());}listenToMessages(){this.workerSelf.addEventListener("message",this.onMessageListener),this.workerSelf.addEventListener("error",a=>{a$3.log(a$3.Level.Error,a);}),this.workerSelf.addEventListener("messageerror",a=>{a$3.log(a$3.Level.Error,a);});}postMessage(a,e){this.workerSelf.postMessage(a,e!=null?e:[]);}getOffscreenCanvas(){if(typeof this.workerSelf.OffscreenCanvas=="function")return new this.workerSelf.OffscreenCanvas(32,32)}hasPayload(a){return a$4(a)&&"payload"in a}hasTransferables(a){return a$4(a)&&Array.isArray(a.transferables)}async respondWith(a,e,l){let r=null,t;try{t=l(),t instanceof Promise&&(t=await t);}catch(m){t=void 0,r=a$5(m);}let n={type:"workerTaskId",command:a,id:e,payload:this.hasPayload(t)?t.payload:void 0};r!=null&&(n.error=r),this.postMessage(n,this.hasTransferables(t)?t.transferables:[]);}onMessage(a){switch(a.data.command){case "loadLibrary":{{let{data:e}=a;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}=a;this.respondWith(e.command,e.id,async()=>{this.dataCaptureInstance.onTap(e.point);});}break}case "hintPresenterV2update":{{let{data:e}=a;this.respondWith(e.command,e.id,async()=>{this.dataCaptureInstance.hintPresenterV2Update();});}break}case "createContext":{{let{data:e}=a;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}=a;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.setFrameSource(e.mirrorAxis,e.isCameraFrameSource));}break}case "processFrame":{{let{data:e}=a;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}=a;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.requestFrameData(e.frameId));}break}case "deleteFrameData":{{let{data:e}=a;this.respondWith(e.command,e.id,()=>{this.dataCaptureInstance.deleteFrameData(e.frameId);});}break}case "updateContext":{{let{data:e}=a;this.respondWith(e.command,e.id,async()=>this.dataCaptureInstance.updateContext(e));}break}case "dispose":{this.respondWith(a.data.command,a.data.id,()=>this.dataCaptureInstance.dispose());break}case "flushAnalytics":{this.respondWith(a.data.command,a.data.id,()=>{this.dataCaptureInstance.flushAnalytics();});break}case "reportCameraProperties":{{let{data:e}=a;this.respondWith(e.command,e.id,async()=>this.dataCaptureInstance.reportCameraProperties(e));}break}case "setLogLevel":{{let{data:e}=a;this.respondWith(e.command,e.id,()=>{a$3.setLevel(e.level);});}break}case "extractCentaurusLicense":{{let{data:e}=a;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.extractCentaurusLicense(e.licenseKey));}break}case "documentVisibility":{{let{data:e}=a;this.respondWith(e.command,e.id,()=>{this.dataCaptureInstance.onDocumentVisibilityChange(e.state);});}break}case "isFeatureSupported":{{let{data:e}=a;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.isFeatureSupported(e.feature));}break}case "getViewfinderInfo":{{let{data:e}=a;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.getViewfinderInfo());}break}case "getOpenSourceSoftwareLicenseInfo":{{let{data:e}=a;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.getOpenSourceSoftwareLicenseInfo());}break}case "addNativeOverlay":this.dataCaptureInstance.addNativeOverlay(a);break;case "removeNativeOverlay":this.dataCaptureInstance.removeNativeOverlay(a);break;default:return b(a.data),false}return true}};export{h as a};
@@ -0,0 +1 @@
1
+ var e=class e 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 e.instance||(e.instance=new e),e.instance}set configurePhase(i){this._configurePhase=i;}get configurePhase(){return this._configurePhase}set configurePromise(i){this._configurePromise=i;}get configurePromise(){return this._configurePromise}};e.instance=null;var a=e;export{a};
@@ -0,0 +1 @@
1
+ var e;(o=>{function i(){let r="7.6.7";return r}o.sdkVersion=i;})(e||(e={}));export{e as a};
@@ -0,0 +1 @@
1
+ import {a}from'./chunk-2AUEQB74.js';var t=new a(globalThis,{get:()=>globalThis.Module,set:e=>{globalThis.Module=e;}});function l(e){}export{t as a,l as b};
@@ -0,0 +1 @@
1
+ var s=class s{constructor(){this.subscribers=new Set;}static getInstance(){return s.instance||(s.instance=new s),s.instance}subscribe(e){this.subscribers.add(e);}unsubscribe(e){this.subscribers.has(e)&&this.subscribers.delete(e);}notify(e){for(let r of this.subscribers)r(e);}};s.instance=null;var i=s;export{i as a};
@@ -1 +1 @@
1
- import {a as a$4}from'./chunk-ZE2WH3AH.js';import {a as a$5}from'./chunk-G2BRTVN7.js';import {c as c$1,a as a$6}from'./chunk-4W2T3TLN.js';import {c}from'./chunk-UWLAKRB2.js';import {d}from'./chunk-AIC4H5KG.js';import {a as a$2}from'./chunk-6W36BRWI.js';import {a as a$1}from'./chunk-O7TZTIHO.js';import {a as a$3}from'./chunk-QCZSSQAQ.js';import {c as c$2,e}from'./chunk-42THCP2K.js';import {a}from'./chunk-XR65N6EG.js';var D=class D{constructor(e,t){this.hintPresenterV2=null;this.MAX_NUMBER_OF_IMAGES_IN_FRAME_DATA_POOL=10;this.redrawInterval=1e3/30;this.redrawRequests=[];this._isDrawLoopRunning=false;this.frameDataPool=new Map;this.lastFrameCounter=-1;this.poorMansBenchmarkLogs=false;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=t,this._loadProgressCallback=this._loadProgressCallback.bind(this),c(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 t=this.getNextFrameId();this.frameDataPool.set(t,new Uint8ClampedArray(e.getFrameData()));let s=this.lastUsedModuleMirrorAxis==null?false:this.lastUsedModuleMirrorAxis!==this.Module.Axis.None;return {frameId:t,width:e.getWidth(),height:e.getHeight(),isFrameSourceMirrored:s}}createContext(e){var m,C,f,b,h;let t=this.getModeDeserializers(),s=c$1(location);(s==="localhost"||s==="127.0.0.1")&&navigator.userAgent.includes("Electron")&&e.appName!=null&&(s+=`-${e.appName}`),this.parentDomain=e.parentDomain,this.contextDeserializer=new this.Module.DataCaptureContextDeserializer(this.writableDataPath,e.deviceId,e.context.deviceModelName,s,this.parentDomain,t,e.delayedRegistration,e.highEndBlurryRecognition,this.resourcePath);let i=this.contextDeserializer.contextFromJson(JSON.stringify(e.context));if(i==null){let r=this.contextDeserializer.getLastError();throw new Error(`Could not create the context: ${r}`)}let a=i.getView();this.context=i.getContext(),i.delete();let d=this.Module.DataCaptureContextListener.extend("DataCaptureContextListener",{didChangeStatus:(r,o)=>{this.contextDidChangeStatus(JSON.parse(o.toJson())),r.delete();},didStartObservingContext:r=>{this.didStartObservingContext(),r.delete();},didStopObservingContext:r=>{r.delete();}}),p=this.Module.DataCaptureContextFrameListener.extend("DataCaptureContextFrameListener",{onObservationStarted:r=>{r.delete();},onObservationStopped:r=>{r.delete();},onFrameProcessingStarted:(r,o)=>{this.workerFunctions.postMessage({type:"onFrameProcessingStarted"}),o.delete(),r.delete();},onFrameProcessingFinished:(r,o)=>{this.workerFunctions.postMessage({type:"onFrameProcessingFinished"}),o.delete(),r.delete();},onFrameSkipped:(r,o)=>{this.workerFunctions.postMessage({type:"onFrameSkipped"}),o.delete(),r.delete();}}),g=this.Module.GestureRecognizer.extend("GestureRecognizer",{setGestureListener:(r,o)=>{var w;(w=this.gestureListener)==null||w.delete(),this.gestureListener=r.clone(),r.delete();}});(m=this.gestureRecognizer)==null||m.delete(),this.gestureRecognizer=new g;let u=new d;this.context.addListener(u),u.delete();let c=new p;this.context.addFrameListener(c),c.delete(),this.setView(a),(C=this.view)==null||C.setGestureRecognizer(this.gestureRecognizer);let M=this.Module.PlatformHintPresenter.extend("PlatformHintPresenter",{setHintPresenter:r=>{r.delete();},showToast:r=>{this.workerFunctions.postMessage({type:"showToast",payload:JSON.parse(r)});},hideToast:r=>{this.workerFunctions.postMessage({type:"hideToast",payload:JSON.parse(r)});},showGuidance:r=>{this.workerFunctions.postMessage({type:"showGuidance",payload:JSON.parse(r)});},hideGuidance:r=>{this.workerFunctions.postMessage({type:"hideGuidance",payload:JSON.parse(r)});},startUpdateTimer:r=>{this.workerFunctions.postMessage({type:"startUpdateTimer",payload:{duration:{unit:"ms",value:r}}});},stopUpdateTimer:()=>{this.workerFunctions.postMessage({type:"stopUpdateTimer"});}});(f=this.hintPresenterV2)==null||f.delete(),this.hintPresenterV2=null,(b=this.webPlatformHintPresenter)==null||b.delete(),this.webPlatformHintPresenter=null,this.webPlatformHintPresenter=new M,this.view&&(this.hintPresenterV2=new this.Module.HintPresenterV2(this.webPlatformHintPresenter),(h=this.view)==null||h.setHintPresenterV2(this.hintPresenterV2));}onTap(e){var t;(t=this.gestureListener)==null||t.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,t,s,i;this.context.dispose(),this.frameDataPool.clear(),this.isDrawLoopRunning=false,this.lastFrameCounter=-1,(e=this.gestureRecognizer)==null||e.delete(),this.gestureRecognizer=null,(t=this.gestureListener)==null||t.delete(),this.gestureListener=null,(s=this.hintPresenterV2)==null||s.delete(),this.hintPresenterV2=null,(i=this.webPlatformHintPresenter)==null||i.delete(),this.webPlatformHintPresenter=null;}flushAnalytics(){this.context.flushAnalytics();}extractCentaurusLicense(e){return {payload:{centaurus:{licenseKey:this.Module.LicenseUtils[D.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 t=this.frameDataPool.get(e);return t==null?{payload:{data:null}}:{payload:{data:t},transferables:[t.buffer]}}scheduleRedraw(e,t){this.addRedrawRequest(t),this.isDrawLoopRunning||this.startDrawLoop(e);}sendViewRefreshCommands(e){this.workerFunctions.postMessage({type:"draw",payload:e},[e.buffer]);}setFrameSource(e,t){var s;this.lastUsedModuleMirrorAxis=this.mapMirrorAxisOnModule(e),(s=this.imageFrameSource)==null||s.delete(),this.imageFrameSource=new this.Module.ImageBufferFrameSource(this.lastUsedModuleMirrorAxis,t,0),this.context.setFrameSource(this.imageFrameSource);}startDrawLoop(e){this.isDrawLoopRunning=true;let t=a=>this.redrawRequests.length>0&&this.redrawRequests[0]<=a,s=a=>{for(;this.redrawRequests.length>0&&this.redrawRequests[0]<=a;)this.redrawRequests.shift();},i=()=>{this.loopTimeoutId=setTimeout(()=>{if(!this.isDrawLoopRunning)return;let a=performance.now();if(t(a)){s(a),e.draw();let d=e.getDrawCommands();this.sendViewRefreshCommands(new Uint8Array(d));}i();},this.redrawInterval);};i();}updateContext(e){if(this.context!=null&&this.contextDeserializer!=null){e.view!=null&&!e.view.visible&&this.context.flushAnalytics();let t=this.onBeforeUpdateContextHook(e),s=this.contextDeserializer.updateContextFromJson(this.context,this.view,JSON.stringify(t.context));if(s==null){let a=this.contextDeserializer.getLastError();throw new Error(`Could not update the context: ${a}`)}this.context.delete(),this.context=s.getContext();let i=s.getView();s.delete(),i!=null&&t.view!=null&&i.setViewSize(t.view.width,t.view.height,t.view.orientation),!this.hintPresenterV2&&this.webPlatformHintPresenter&&(this.hintPresenterV2=new this.Module.HintPresenterV2(this.webPlatformHintPresenter)),i!=null&&this.hintPresenterV2&&i.setHintPresenterV2(this.hintPresenterV2),this.gestureRecognizer!=null&&(i==null||i.setGestureRecognizer(this.gestureRecognizer)),this.setView(i),a.debug("context updated",t);}}onBeforeUpdateContextHook(e){return e}onDocumentVisibilityChange(e){e==="hidden"&&this.context.flushAnalytics();}isFeatureSupported(e){return {payload:{supported:this.context.isFeatureSupported(e)}}}getViewfinderInfo(){var e,t;return {payload:{isDisplayingViewfinder:(t=(e=this.view)==null?void 0:e.isDisplayingViewfinder())!=null?t:false,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,t){return t?e?globalThis.SDC_WASM_CORE_MT_SIMD_HASH:globalThis.SDC_WASM_CORE_MT_HASH:e?globalThis.SDC_WASM_CORE_SIMD_HASH:""}getWasmCoreFileName(e,t){return t?e?globalThis.SDC_WASM_CORE_MT_SIMD_FILE_NAME:globalThis.SDC_WASM_CORE_MT_FILE_NAME:e?globalThis.SDC_WASM_CORE_SIMD_FILE_NAME:""}getWasmMetadata(){return globalThis.WASM_METADATA}getWasmSideModuleFileName(){return ""}_loadProgressCallback(e){this.workerFunctions.postMessage({type:"loadLibraryProgress",payload:e});}addRedrawRequest(e){this.redrawRequests.push(Math.round(performance.now())+e),this.redrawRequests.sort((t,s)=>t-s);}contextDidChangeStatus(e){e.code===260?e.message=e.message.replace("domain name",`domain name (${c$1(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=false,this.sendViewRefreshCommands(new Uint8Array([])));}addNativeOverlay(e){a.warn("addNativeOverlay has not been implemented for this module",e);}removeNativeOverlay(e){a.warn("removeNativeOverlay has not been implemented for this module",e);}setViewRefreshHandler(e){if(e==null||e.isViewRefreshHandlerSet)return;let t=this.Module.NeedsRedrawDelegate.extend("NeedsRedrawDelegate",{setNeedsRedrawIn:this.scheduleRedraw.bind(this,e)}),s=new t;e.setNeedsRedrawDelegate(s),e.isViewRefreshHandlerSet=true;}setupDataDecoding(){let e=this.moduleHandler.get(),t=e.DataDecoding.extend("DataDecoding",{decode(s,i){try{let a=JSON.parse(i),d=[];for(let p of a){let g=new TextDecoder(p.ianaName,{fatal:true});d.push(g.decode(s.slice(p.startIndex,p.endIndex)));}return d.join("")}catch(a){return ""}}});e.setDataDecoding(new t);}start(e,t,s){e&&t&&(this.setupDataDecoding(),this.moduleHandler.get().callMain(),this.moduleHandler.get().__emscripten_proxy_main!==void 0||s());}getWritableDataPath(e){return e!=null?(a.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$1,locationPath:t,writableDataPathOverride:s,overrideThreadsSupport:i,overrideSimdSupport:a$7,verifyResponseHash:d$1,referredOrigin:p,fixedWasmMemory:g}){var x;let u=false,c=false;this.writableDataPath=this.getWritableDataPath(s),this.resourcePath=`${e$1}${this.resourceFilesSubfolder}/`,globalThis.path=t;let{resolve:M,reject:m,promise:C}=new a$1,f=a$2.sdkVersion();if(f==="")throw new a$3({name:"Invalid library version",message:"Library version is not defined or empty, cannot generate proper path to library files."});let[b,h]=await Promise.all([c$2(),e()]);i!=="auto"&&(h=i==="on"),a$7!=="auto"&&(b=a$7==="on");let r=this.getWasmCoreFileName(b,h),o=d(f,e$1,r),{jsURI:w,wasmURI:R}=o,H={instantiateWasm:(l,W)=>(a$6({importObject:l,wasmURI:R,expectedHash:this.getWasmCoreExpectedHash(b,h),verifyResponseHash:d$1,successCallback:W,progressCallback:this._loadProgressCallback,errorCallback:N=>{m(N);},referredOrigin:p}),{})},y=g===null?null:new WebAssembly.Memory({initial:this.numOfMBToPages(g),maximum:this.numOfMBToPages(300),shared:h});return y!==null&&a.log(a.Level.Debug,"Fixed wasmMemory set",y),this.moduleHandler.set({...y?{wasmMemory:y}:{},mainScriptUrlOrBlob:w,canvas:(x=this.workerFunctions.getOffscreenCanvas())!=null?x:{getContext:()=>null},...H,dynamicLibraries:this.getWasmDynamicLibraries(R),locateFile:l=>e$1+l,noInitialRun:true,preRun:[async()=>{try{await a$4({writableDataPath:this.writableDataPath});}catch(l){if(l.name==="BlockedIndexedDB"){m(l.toString());return}a.log(a.Level.Debug,"No IndexedDB support, some data will not be persisted:",l);}c=true,this.start(c,u,M);}],onMainComplete:()=>{if([u,c].includes(false)){a.log(a.Level.Warn,{runtimeLoaded:u,fileSystemSynced:c},"Both runtimeLoaded and fileSystemSynced should be true when calling onMainComplete"),m("onMainComplete has been called but runtime or file system was not ready.");return}M();},onRuntimeInitialized:()=>{u=true,this.start(c,u,M);},print:l=>{a.log(a.Level.Info,l);}}),await a$5(w,f)||m(`Couldn't retrieve Scandit Data Capture library at ${w}, did you configure the path for it correctly?`),C}};D.get3dPartyLicenseKeyMethodName=atob("Z2V0QmxpbmtJZExpY2Vuc2VLZXk=");var T=D;export{T as a};
1
+ import {a as a$4}from'./chunk-ZE2WH3AH.js';import {a as a$5}from'./chunk-G2BRTVN7.js';import {c as c$1,a as a$6}from'./chunk-4W2T3TLN.js';import {c}from'./chunk-UWLAKRB2.js';import {d}from'./chunk-AIC4H5KG.js';import {a as a$2}from'./chunk-HPHMQ52J.js';import {a as a$1}from'./chunk-O7TZTIHO.js';import {a as a$3}from'./chunk-QCZSSQAQ.js';import {c as c$2,e}from'./chunk-42THCP2K.js';import {a}from'./chunk-XR65N6EG.js';var D=class D{constructor(e,t){this.hintPresenterV2=null;this.MAX_NUMBER_OF_IMAGES_IN_FRAME_DATA_POOL=10;this.redrawInterval=1e3/30;this.redrawRequests=[];this._isDrawLoopRunning=false;this.frameDataPool=new Map;this.lastFrameCounter=-1;this.poorMansBenchmarkLogs=false;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=t,this._loadProgressCallback=this._loadProgressCallback.bind(this),c(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 t=this.getNextFrameId();this.frameDataPool.set(t,new Uint8ClampedArray(e.getFrameData()));let s=this.lastUsedModuleMirrorAxis==null?false:this.lastUsedModuleMirrorAxis!==this.Module.Axis.None;return {frameId:t,width:e.getWidth(),height:e.getHeight(),isFrameSourceMirrored:s}}createContext(e){var m,C,f,b,h;let t=this.getModeDeserializers(),s=c$1(location);(s==="localhost"||s==="127.0.0.1")&&navigator.userAgent.includes("Electron")&&e.appName!=null&&(s+=`-${e.appName}`),this.parentDomain=e.parentDomain,this.contextDeserializer=new this.Module.DataCaptureContextDeserializer(this.writableDataPath,e.deviceId,e.context.deviceModelName,s,this.parentDomain,t,e.delayedRegistration,e.highEndBlurryRecognition,this.resourcePath);let i=this.contextDeserializer.contextFromJson(JSON.stringify(e.context));if(i==null){let r=this.contextDeserializer.getLastError();throw new Error(`Could not create the context: ${r}`)}let a=i.getView();this.context=i.getContext(),i.delete();let d=this.Module.DataCaptureContextListener.extend("DataCaptureContextListener",{didChangeStatus:(r,o)=>{this.contextDidChangeStatus(JSON.parse(o.toJson())),r.delete();},didStartObservingContext:r=>{this.didStartObservingContext(),r.delete();},didStopObservingContext:r=>{r.delete();}}),p=this.Module.DataCaptureContextFrameListener.extend("DataCaptureContextFrameListener",{onObservationStarted:r=>{r.delete();},onObservationStopped:r=>{r.delete();},onFrameProcessingStarted:(r,o)=>{this.workerFunctions.postMessage({type:"onFrameProcessingStarted"}),o.delete(),r.delete();},onFrameProcessingFinished:(r,o)=>{this.workerFunctions.postMessage({type:"onFrameProcessingFinished"}),o.delete(),r.delete();},onFrameSkipped:(r,o)=>{this.workerFunctions.postMessage({type:"onFrameSkipped"}),o.delete(),r.delete();}}),g=this.Module.GestureRecognizer.extend("GestureRecognizer",{setGestureListener:(r,o)=>{var w;(w=this.gestureListener)==null||w.delete(),this.gestureListener=r.clone(),r.delete();}});(m=this.gestureRecognizer)==null||m.delete(),this.gestureRecognizer=new g;let u=new d;this.context.addListener(u),u.delete();let c=new p;this.context.addFrameListener(c),c.delete(),this.setView(a),(C=this.view)==null||C.setGestureRecognizer(this.gestureRecognizer);let M=this.Module.PlatformHintPresenter.extend("PlatformHintPresenter",{setHintPresenter:r=>{r.delete();},showToast:r=>{this.workerFunctions.postMessage({type:"showToast",payload:JSON.parse(r)});},hideToast:r=>{this.workerFunctions.postMessage({type:"hideToast",payload:JSON.parse(r)});},showGuidance:r=>{this.workerFunctions.postMessage({type:"showGuidance",payload:JSON.parse(r)});},hideGuidance:r=>{this.workerFunctions.postMessage({type:"hideGuidance",payload:JSON.parse(r)});},startUpdateTimer:r=>{this.workerFunctions.postMessage({type:"startUpdateTimer",payload:{duration:{unit:"ms",value:r}}});},stopUpdateTimer:()=>{this.workerFunctions.postMessage({type:"stopUpdateTimer"});}});(f=this.hintPresenterV2)==null||f.delete(),this.hintPresenterV2=null,(b=this.webPlatformHintPresenter)==null||b.delete(),this.webPlatformHintPresenter=null,this.webPlatformHintPresenter=new M,this.view&&(this.hintPresenterV2=new this.Module.HintPresenterV2(this.webPlatformHintPresenter),(h=this.view)==null||h.setHintPresenterV2(this.hintPresenterV2));}onTap(e){var t;(t=this.gestureListener)==null||t.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,t,s,i;this.context.dispose(),this.frameDataPool.clear(),this.isDrawLoopRunning=false,this.lastFrameCounter=-1,(e=this.gestureRecognizer)==null||e.delete(),this.gestureRecognizer=null,(t=this.gestureListener)==null||t.delete(),this.gestureListener=null,(s=this.hintPresenterV2)==null||s.delete(),this.hintPresenterV2=null,(i=this.webPlatformHintPresenter)==null||i.delete(),this.webPlatformHintPresenter=null;}flushAnalytics(){this.context.flushAnalytics();}extractCentaurusLicense(e){return {payload:{centaurus:{licenseKey:this.Module.LicenseUtils[D.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 t=this.frameDataPool.get(e);return t==null?{payload:{data:null}}:{payload:{data:t},transferables:[t.buffer]}}scheduleRedraw(e,t){this.addRedrawRequest(t),this.isDrawLoopRunning||this.startDrawLoop(e);}sendViewRefreshCommands(e){this.workerFunctions.postMessage({type:"draw",payload:e},[e.buffer]);}setFrameSource(e,t){var s;this.lastUsedModuleMirrorAxis=this.mapMirrorAxisOnModule(e),(s=this.imageFrameSource)==null||s.delete(),this.imageFrameSource=new this.Module.ImageBufferFrameSource(this.lastUsedModuleMirrorAxis,t,0),this.context.setFrameSource(this.imageFrameSource);}startDrawLoop(e){this.isDrawLoopRunning=true;let t=a=>this.redrawRequests.length>0&&this.redrawRequests[0]<=a,s=a=>{for(;this.redrawRequests.length>0&&this.redrawRequests[0]<=a;)this.redrawRequests.shift();},i=()=>{this.loopTimeoutId=setTimeout(()=>{if(!this.isDrawLoopRunning)return;let a=performance.now();if(t(a)){s(a),e.draw();let d=e.getDrawCommands();this.sendViewRefreshCommands(new Uint8Array(d));}i();},this.redrawInterval);};i();}updateContext(e){if(this.context!=null&&this.contextDeserializer!=null){e.view!=null&&!e.view.visible&&this.context.flushAnalytics();let t=this.onBeforeUpdateContextHook(e),s=this.contextDeserializer.updateContextFromJson(this.context,this.view,JSON.stringify(t.context));if(s==null){let a=this.contextDeserializer.getLastError();throw new Error(`Could not update the context: ${a}`)}this.context.delete(),this.context=s.getContext();let i=s.getView();s.delete(),i!=null&&t.view!=null&&i.setViewSize(t.view.width,t.view.height,t.view.orientation),!this.hintPresenterV2&&this.webPlatformHintPresenter&&(this.hintPresenterV2=new this.Module.HintPresenterV2(this.webPlatformHintPresenter)),i!=null&&this.hintPresenterV2&&i.setHintPresenterV2(this.hintPresenterV2),this.gestureRecognizer!=null&&(i==null||i.setGestureRecognizer(this.gestureRecognizer)),this.setView(i),a.debug("context updated",t);}}onBeforeUpdateContextHook(e){return e}onDocumentVisibilityChange(e){e==="hidden"&&this.context.flushAnalytics();}isFeatureSupported(e){return {payload:{supported:this.context.isFeatureSupported(e)}}}getViewfinderInfo(){var e,t;return {payload:{isDisplayingViewfinder:(t=(e=this.view)==null?void 0:e.isDisplayingViewfinder())!=null?t:false,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,t){return t?e?globalThis.SDC_WASM_CORE_MT_SIMD_HASH:globalThis.SDC_WASM_CORE_MT_HASH:e?globalThis.SDC_WASM_CORE_SIMD_HASH:""}getWasmCoreFileName(e,t){return t?e?globalThis.SDC_WASM_CORE_MT_SIMD_FILE_NAME:globalThis.SDC_WASM_CORE_MT_FILE_NAME:e?globalThis.SDC_WASM_CORE_SIMD_FILE_NAME:""}getWasmMetadata(){return globalThis.WASM_METADATA}getWasmSideModuleFileName(){return ""}_loadProgressCallback(e){this.workerFunctions.postMessage({type:"loadLibraryProgress",payload:e});}addRedrawRequest(e){this.redrawRequests.push(Math.round(performance.now())+e),this.redrawRequests.sort((t,s)=>t-s);}contextDidChangeStatus(e){e.code===260?e.message=e.message.replace("domain name",`domain name (${c$1(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=false,this.sendViewRefreshCommands(new Uint8Array([])));}addNativeOverlay(e){a.warn("addNativeOverlay has not been implemented for this module",e);}removeNativeOverlay(e){a.warn("removeNativeOverlay has not been implemented for this module",e);}setViewRefreshHandler(e){if(e==null||e.isViewRefreshHandlerSet)return;let t=this.Module.NeedsRedrawDelegate.extend("NeedsRedrawDelegate",{setNeedsRedrawIn:this.scheduleRedraw.bind(this,e)}),s=new t;e.setNeedsRedrawDelegate(s),e.isViewRefreshHandlerSet=true;}setupDataDecoding(){let e=this.moduleHandler.get(),t=e.DataDecoding.extend("DataDecoding",{decode(s,i){try{let a=JSON.parse(i),d=[];for(let p of a){let g=new TextDecoder(p.ianaName,{fatal:true});d.push(g.decode(s.slice(p.startIndex,p.endIndex)));}return d.join("")}catch(a){return ""}}});e.setDataDecoding(new t);}start(e,t,s){e&&t&&(this.setupDataDecoding(),this.moduleHandler.get().callMain(),this.moduleHandler.get().__emscripten_proxy_main!==void 0||s());}getWritableDataPath(e){return e!=null?(a.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$1,locationPath:t,writableDataPathOverride:s,overrideThreadsSupport:i,overrideSimdSupport:a$7,verifyResponseHash:d$1,referredOrigin:p,fixedWasmMemory:g}){var x;let u=false,c=false;this.writableDataPath=this.getWritableDataPath(s),this.resourcePath=`${e$1}${this.resourceFilesSubfolder}/`,globalThis.path=t;let{resolve:M,reject:m,promise:C}=new a$1,f=a$2.sdkVersion();if(f==="")throw new a$3({name:"Invalid library version",message:"Library version is not defined or empty, cannot generate proper path to library files."});let[b,h]=await Promise.all([c$2(),e()]);i!=="auto"&&(h=i==="on"),a$7!=="auto"&&(b=a$7==="on");let r=this.getWasmCoreFileName(b,h),o=d(f,e$1,r),{jsURI:w,wasmURI:R}=o,H={instantiateWasm:(l,W)=>(a$6({importObject:l,wasmURI:R,expectedHash:this.getWasmCoreExpectedHash(b,h),verifyResponseHash:d$1,successCallback:W,progressCallback:this._loadProgressCallback,errorCallback:N=>{m(N);},referredOrigin:p}),{})},y=g===null?null:new WebAssembly.Memory({initial:this.numOfMBToPages(g),maximum:this.numOfMBToPages(300),shared:h});return y!==null&&a.log(a.Level.Debug,"Fixed wasmMemory set",y),this.moduleHandler.set({...y?{wasmMemory:y}:{},mainScriptUrlOrBlob:w,canvas:(x=this.workerFunctions.getOffscreenCanvas())!=null?x:{getContext:()=>null},...H,dynamicLibraries:this.getWasmDynamicLibraries(R),locateFile:l=>e$1+l,noInitialRun:true,preRun:[async()=>{try{await a$4({writableDataPath:this.writableDataPath});}catch(l){if(l.name==="BlockedIndexedDB"){m(l.toString());return}a.log(a.Level.Debug,"No IndexedDB support, some data will not be persisted:",l);}c=true,this.start(c,u,M);}],onMainComplete:()=>{if([u,c].includes(false)){a.log(a.Level.Warn,{runtimeLoaded:u,fileSystemSynced:c},"Both runtimeLoaded and fileSystemSynced should be true when calling onMainComplete"),m("onMainComplete has been called but runtime or file system was not ready.");return}M();},onRuntimeInitialized:()=>{u=true,this.start(c,u,M);},print:l=>{a.log(a.Level.Info,l);}}),await a$5(w,f)||m(`Couldn't retrieve Scandit Data Capture library at ${w}, did you configure the path for it correctly?`),C}};D.get3dPartyLicenseKeyMethodName=atob("Z2V0QmxpbmtJZExpY2Vuc2VLZXk=");var T=D;export{T as a};
@@ -0,0 +1,2 @@
1
+ import {a}from'./chunk-GNA6ZKV3.js';import {a as a$1}from'./chunk-XR65N6EG.js';var s=class{constructor(t=a.getInstance(),e=a$1,r=globalThis.fetch.bind(globalThis)){this.sdk=t,this.logger=e,this.fetch=r;}get workerCommand(){var t;return (t=this.sdk.mainDataCaptureLoader)==null?void 0:t.workerCommand.bind(this.sdk.mainDataCaptureLoader)}async getLicenseText(){var o,i;if(this.sdk.configurePhase!=="done")return this.logger.warn('You must call "configure" before retrieving open source license text info.'),"";let t=new URL(`${((o=this.sdk.libraryLocation)!=null?o:"").replace(/\/$/,"")}/license/web-core-license.txt`),[e,r]=await Promise.all([(i=this.workerCommand)==null?void 0:i.call(this,"getOpenSourceSoftwareLicenseInfo",{}),this.fetchWebLicenseText(t.toString())]);return [e==null?void 0:e.licenseText,r].filter(l=>l!=null).join(`
2
+ `)}async fetchWebLicenseText(t){return this.fetch(t,{mode:"cors",credentials:"include",headers:{"Content-Type":"text/plain"}}).then(async e=>{if(!e.ok)throw new Error(`${e.status} ${e.statusText}`);return e.text()}).catch(e=>(this.logger.warn(`Failed to fetch license from ${t}: ${e.toString()}`),null))}};export{s as a};
@@ -1,4 +1,4 @@
1
- import {a as a$6,b}from'./chunk-LISC6VSM.js';import {a as a$a}from'./chunk-BA3RP6L2.js';import {a as a$2}from'./chunk-34HLD6AY.js';import {a as a$5}from'./chunk-JS3T7K2Z.js';import {a as a$3}from'./chunk-NKCR7VPO.js';import {a as a$4}from'./chunk-7SW2PEHB.js';import {a as a$7}from'./chunk-FGO2SSRS.js';import {d}from'./chunk-5SBW2P36.js';import {a as a$1}from'./chunk-UCD6YLP3.js';import {a as a$8}from'./chunk-XR65N6EG.js';import {f}from'./chunk-7ELPJFJV.js';import {a as a$9}from'./chunk-WUHKODFA.js';import {c}from'./chunk-TR3NGINC.js';function n(l,e,t){let r=t.value;return t.value=function(...s){return a$3.configurePhase==="done"&&a$3.mainDataCaptureLoader!=null?r.apply(this,s):Promise.reject(new Error(`Please await the call to configure() before calling ${String(e)}`))},t}function F(l){return l[a$a]!=null}function g(l){return "skipSerialization"in l||l[a$a]!=null}var N,E,R,a=class a{constructor(){this.framework="web";this.runtimeEnvironment={deviceOS:(N=a$1.getUserAgentInfo().getOS().name)!=null?N:"",browser:(E=a$1.getUserAgentInfo().getBrowser().name)!=null?E:"",browserVersion:(R=a$1.getUserAgentInfo().getBrowser().version)!=null?R:"",get deviceModelName(){let{model:e,vendor:t}=a$1.getUserAgentInfo().getDevice();return (t==null||t==="")&&(t="Unknown"),(e==null||e==="")&&(e="Unknown"),[t,e].join(" ")}};this.settings=new a$4;this._frameSource=null;this._view=null;this.modes=new Set;this.components=[];this.listeners=[];this.updateListeners=new Set;this.cameraPropertiesReportListener=this.reportCameraProperties.bind(this);this.cameraAccessErrorListener=this.onCameraAccessError.bind(this);this.onWorkerMessageListener=this.onWorkerMessage.bind(this);this.onVisibilityChangeListener=this.onVisibilityChange.bind(this);this.pendingWorkerMessageListeners=new Set;this.delayedRegistration=false;this.highEndBlurryRecognition=false;this._frameHandlers=[];this._useSynchronousFrameFlow=false;}static get sharedInstance(){return a._sharedInstance==null&&(a._sharedInstance=new a),a._sharedInstance}async initializeWithOptions(e,t=a$3){var r,s,o,m,f,y,w,S,b;this.licenseKey=(s=(r=e.licenseKey)!=null?r:t.userLicenseKey)!=null?s:"",this.deviceName=(o=e.deviceName)!=null?o:"",this.dataCaptureInstance=(m=e.dataCaptureInstance)!=null?m:t.mainDataCaptureLoader,this.delayedRegistration=(f=e.delayedRegistration)!=null?f:false,e.settings!=null&&(this.settings=e.settings),this.highEndBlurryRecognition=(b=(S=(y=e.dataCaptureInstance)==null?void 0:y.highEndBlurryRecognition)!=null?S:(w=t.mainDataCaptureLoader)==null?void 0:w.highEndBlurryRecognition)!=null?b:false;for(let I of this.pendingWorkerMessageListeners)this.dataCaptureInstance.addWorkerListener(I);this.pendingWorkerMessageListeners.clear(),this.settings!=null&&await this.applySettings(this.settings),await this.createContext();}get frameSource(){return this._frameSource}get workerCommand(){if(this.dataCaptureInstance==null)throw new Error("Cannot call workerCommand before dataCaptureInstance is set");return this.dataCaptureInstance.workerCommand.bind(this.dataCaptureInstance)}static async create(){return a.createWithOptions({})}static async createWithOptions(e){return a._sharedInstance&&await a._sharedInstance.dispose(),await a.sharedInstance.initializeWithOptions(e),a.sharedInstance}static async getOpenSourceSoftwareLicenseInfo(){let e=[];for(let r of a.moduleLicenseTextProviders){let s=await r.getLicenseText();e.push(s);}let t=e.join(`
1
+ import {a as a$6,b}from'./chunk-LISC6VSM.js';import {a as a$a}from'./chunk-BA3RP6L2.js';import {a as a$2}from'./chunk-N6BLNZCH.js';import {a as a$5}from'./chunk-JS3T7K2Z.js';import {a as a$3}from'./chunk-GNA6ZKV3.js';import {a as a$4}from'./chunk-7SW2PEHB.js';import {a as a$7}from'./chunk-FGO2SSRS.js';import {d}from'./chunk-5SBW2P36.js';import {a as a$1}from'./chunk-UCD6YLP3.js';import {a as a$8}from'./chunk-XR65N6EG.js';import {f}from'./chunk-7ELPJFJV.js';import {a as a$9}from'./chunk-WUHKODFA.js';import {c}from'./chunk-TR3NGINC.js';function s(l,e,t){let r=t.value;return t.value=function(...o){let i=a$3.getInstance();return i.configurePhase==="done"&&i.mainDataCaptureLoader!=null?r.apply(this,o):Promise.reject(new Error(`Please await the call to configure() before calling ${String(e)}`))},t}function F(l){return l[a$a]!=null}function g(l){return "skipSerialization"in l||l[a$a]!=null}var N,E,I,a=class a{constructor(){this.framework="web";this.runtimeEnvironment={deviceOS:(N=a$1.getUserAgentInfo().getOS().name)!=null?N:"",browser:(E=a$1.getUserAgentInfo().getBrowser().name)!=null?E:"",browserVersion:(I=a$1.getUserAgentInfo().getBrowser().version)!=null?I:"",get deviceModelName(){let{model:e,vendor:t}=a$1.getUserAgentInfo().getDevice();return (t==null||t==="")&&(t="Unknown"),(e==null||e==="")&&(e="Unknown"),[t,e].join(" ")}};this.settings=new a$4;this._frameSource=null;this._view=null;this.modes=new Set;this.components=[];this.listeners=[];this.updateListeners=new Set;this.cameraPropertiesReportListener=this.reportCameraProperties.bind(this);this.cameraAccessErrorListener=this.onCameraAccessError.bind(this);this.onWorkerMessageListener=this.onWorkerMessage.bind(this);this.onVisibilityChangeListener=this.onVisibilityChange.bind(this);this.pendingWorkerMessageListeners=new Set;this.delayedRegistration=false;this.highEndBlurryRecognition=false;this._frameHandlers=[];this._useSynchronousFrameFlow=false;}static get sharedInstance(){return a._sharedInstance==null&&(a._sharedInstance=new a),a._sharedInstance}async initializeWithOptions(e,t=a$3.getInstance()){var r,o,i,m,f,y,w,S,b;this.licenseKey=(o=(r=e.licenseKey)!=null?r:t.userLicenseKey)!=null?o:"",this.deviceName=(i=e.deviceName)!=null?i:"",this.dataCaptureInstance=(m=e.dataCaptureInstance)!=null?m:t.mainDataCaptureLoader,this.delayedRegistration=(f=e.delayedRegistration)!=null?f:false,e.settings!=null&&(this.settings=e.settings),this.highEndBlurryRecognition=(b=(S=(y=e.dataCaptureInstance)==null?void 0:y.highEndBlurryRecognition)!=null?S:(w=t.mainDataCaptureLoader)==null?void 0:w.highEndBlurryRecognition)!=null?b:false;for(let R of this.pendingWorkerMessageListeners)this.dataCaptureInstance.addWorkerListener(R);this.pendingWorkerMessageListeners.clear(),this.settings!=null&&await this.applySettings(this.settings),await this.createContext();}get frameSource(){return this._frameSource}get workerCommand(){if(this.dataCaptureInstance==null)throw new Error("Cannot call workerCommand before dataCaptureInstance is set");return this.dataCaptureInstance.workerCommand.bind(this.dataCaptureInstance)}static async create(){return a.createWithOptions({})}static async createWithOptions(e){return a._sharedInstance&&await a._sharedInstance.dispose(),await a.sharedInstance.initializeWithOptions(e),a.sharedInstance}static async getOpenSourceSoftwareLicenseInfo(){let e=[];for(let r of a.moduleLicenseTextProviders){let o=await r.getLicenseText();e.push(o);}let t=e.join(`
2
2
 
3
- `);return new a$5(t)}async setFrameSource(e){let t=e!==this._frameSource;if(this._frameSource!==null&&(this._frameSource.context=null),this._frameSource=e!=null?e:null,e&&(e.context=this,await this.workerCommand("setFrameSource",{mirrorAxis:this.getMirrorAxisForFrameSource(e),isCameraFrameSource:f(e)})),await this.update([{type:"frameSourceState",newValue:this.frameSource}]),t)for(let r of this.listeners)r.didChangeFrameSource&&r.didChangeFrameSource(this,this._frameSource);}addListener(e){this.listeners.includes(e)||this.listeners.push(e);}async flushAnalytics(){await this.workerCommand("flushAnalytics",{});}removeListener(e){this.listeners.includes(e)&&this.listeners.splice(this.listeners.indexOf(e),1);}async addMode(e){this.modes.add(e),await e.attachedToContext(this),this.updateCameraFrameFlow(),await this.update([],{updateContext:!g(e)});}async removeMode(e){this.modes.delete(e),await e.detachedFromContext(),this.updateCameraFrameFlow(),await this.update([],{updateContext:!g(e)});}async setMode(e){this.modes.has(e)||(this.modes.clear(),this.modes.add(e),await e.attachedToContext(this),this.updateCameraFrameFlow(),await this.update());}async removeCurrentMode(){for(let e of this.modes)await e.detachedFromContext();this.modes.clear(),await this.update();}async removeAllModes(){for(let e of this.modes)await this.removeMode(e);}async dispose(){d.instance().removeListener("cameraProperties",this.cameraPropertiesReportListener),d.instance().removeListener("cameraAccessError",this.cameraAccessErrorListener),this.unsubscribeToVisibilityChange(this.onVisibilityChangeListener),await this.removeAllModes(),this.dataCaptureInstance&&await this.workerCommand("dispose",{}),this.listeners=[],this.modes.clear(),this.components.length=0,this.updateListeners.clear(),this.pendingWorkerMessageListeners.clear(),this.dataCaptureInstance=void 0,this.delayedRegistration=false,this.highEndBlurryRecognition=false,this._frameHandlers.length=0,this.frameSource&&(this.frameSource.context=null,this._frameSource=null),this._view&&(this._view.setContext(null),this._view=null),this.licenseKey="",this.deviceName="";}async applySettings(e){this.settings=e,await this.update();}toJSONObject(){var e,t;return {licenseKey:this.licenseKey,framework:this.framework,deviceName:this.deviceName,...this.runtimeEnvironment,modes:[...this.modes].filter(r=>!g(r)).map(r=>r.toJSONObject()),components:this.components.map(r=>r.toJSONObject()),frameSource:this.frameSource?this.frameSource.toJSONObject():null,settings:this.settings.toJSONObject(),view:(t=(e=this._view)==null?void 0:e.toJSONObject())!=null?t:null}}getView(){return this._view}async setView(e){return this._view=e,this.update([{type:"viewSet",newValue:e}])}async getAppName(){let e=null;if(a$6()){let t=await b();if((t==null?void 0:t.appName)==null||t.appName==="")throw new Error("Cannot retrieve electron appName. Did you set it up in package.json? https://www.electronjs.org/docs/latest/api/app#appgetname");e=t.appName;}return e}urlToHostname(e){try{return new URL(e!=null?e:"").hostname}catch(t){return ""}}getParentDomain(){var t;let e="";return parent!==window&&(e||(e=this.urlToHostname((t=location.ancestorOrigins)==null?void 0:t[0])),e||(e=this.urlToHostname(document.referrer)),e||(e="")),e.startsWith("[")&&e.endsWith("]")&&(e=e.slice(1,-1)),e}async createContext(e=true){await this.workerCommand("createContext",{context:this.toJSONObject(),deviceId:a.deviceID,delayedRegistration:this.delayedRegistration,highEndBlurryRecognition:this.highEndBlurryRecognition,appName:await this.getAppName(),parentDomain:this.getParentDomain()}),this.subscribeToWorkerMessages(this.onWorkerMessageListener),e&&(this.subscribeToCameraManagerEvents(),this.subscribeToVisibilityChange(this.onVisibilityChangeListener)),this._view!=null&&await this.setView(this._view),this.frameSource!=null&&await this.setFrameSource(this.frameSource);}subscribeToVisibilityChange(e){document.addEventListener("visibilitychange",e);}unsubscribeToVisibilityChange(e){document.removeEventListener("visibilitychange",e);}async requestFrameData(e){return this.workerCommand("requestFrameData",{frameId:e})}performanceMark(e){a$7(globalThis.performance)&&typeof globalThis.performance.mark=="function"&&performance.mark(e);}async sendFrameToProcessor(e){let t=e instanceof ImageData?{data:e.data,width:e.width,height:e.height}:e,r=await this.sendFrameToHandlers(t);return t.data=r.capture.data,r.skip?r.capture:(this.performanceMark("processFrameBeforeSDC"),this.sendFrameToSDC(t))}async sendFrameToHandlers(e){for(let t of this._frameHandlers)if((await t(e)).action==="skip")return {skip:true,capture:e};return {skip:false,capture:e}}async sendFrameToSDC(e){return this.workerCommand("processFrame",e,[e.data.buffer])}registerFrameHandler(e){this._frameHandlers.includes(e)||this._frameHandlers.push(e);}unregisterFrameHandler(e){this._frameHandlers.includes(e)&&this._frameHandlers.splice(this._frameHandlers.indexOf(e),1);}onVisibilityChange(){this.workerCommand("documentVisibility",{state:document.visibilityState});}onWorkerMessage(e){if(e.type==="contextDidChangeStatus"){e.payload.isValid||a$8.error(e.payload);for(let t of this.listeners)t.didChangeStatus&&t.didChangeStatus(this,a$9.fromJSON(e.payload));}if(e.type==="didStartObservingContext")for(let t of this.listeners)t.didStartObservingContext&&t.didStartObservingContext(this);e.type==="onFrameProcessingFinished"&&this.performanceMark("processFrameAfterSDC");}subscribeToCameraManagerEvents(){d.instance().addListener("cameraProperties",this.cameraPropertiesReportListener),d.instance().addListener("cameraAccessError",this.cameraAccessErrorListener);}async reportCameraProperties(e){return this.workerCommand("reportCameraProperties",e)}onCameraAccessError(e){for(let t of this.listeners)t.didChangeStatus&&t.didChangeStatus(this,a$9.fromJSON({code:33794,isValid:true,message:typeof(e==null?void 0:e.toString)=="function"?e.toString():"Unknown error"}));}async update(e=[],{updateContext:t=true}={}){var r,s;t&&await this.updateContext();for(let o of e){switch(o.type){case "frameSourceState":{await((r=this._view)==null?void 0:r.onFrameSourceChange(this.frameSource));break}case "singleImageModeUploaderSettings":{(s=this._view)==null||s.onSingleImageUploaderSettingsChange(o.newValue);break}case "addOverlay":{await this.addNativeOverlay(o.newValue);break}case "removeOverlay":{await this.removeNativeOverlay(o.newValue);break}}for(let m of this.updateListeners)m(o);}}async updateContext(){await this.workerCommand("updateContext",{context:this.toJSONObject(),...this.getViewInfo()}).catch(e=>a$8.warn("Error while updating context:",e));}getViewInfo(){return this._view!=null?{view:{width:this._view.width,height:this._view.height,visible:this._view.width>0&&this._view.height>0,orientation:this._view.orientation}}:{view:null}}getMirrorAxisForFrameSource(e){let t="None";return f(e)&&e.getMirrorImageEnabled()&&(t="Y"),t}async addComponent(e){if(!this.components.includes(e))return this.components.push(e),e._context=this,this.update()}async addNativeOverlay(e){if(F(e))return this.workerCommand("addNativeOverlay",{overlayHandle:e[a$a]})}async removeNativeOverlay(e){if(F(e))return this.workerCommand("removeNativeOverlay",{overlayHandle:e[a$a]})}subscribeToWorkerMessages(e){this.dataCaptureInstance?this.dataCaptureInstance.addWorkerListener(e):this.pendingWorkerMessageListeners.add(e);}unsubscribeToWorkerMessages(e){this.dataCaptureInstance&&this.dataCaptureInstance.removeWorkerListener(e),this.pendingWorkerMessageListeners.delete(e);}hasEnabledMode(){return [...this.modes].some(e=>e.isEnabled())}updateCameraFrameFlow(){let e=[...this.modes].some(t=>t._synchronousFrameFlow===true);d.instance().setFrameHandling(e);}async isFeatureSupported(e){return (await this.workerCommand("isFeatureSupported",{feature:e})).supported}};a.deviceID=a$1.getDeviceId(),a.moduleLicenseTextProviders=[new a$2],c([n],a.prototype,"initializeWithOptions",1),c([n],a.prototype,"addMode",1),c([n],a.prototype,"removeMode",1),c([n],a.prototype,"setMode",1),c([n],a.prototype,"removeCurrentMode",1),c([n],a.prototype,"createContext",1),c([n],a.prototype,"addComponent",1),c([n],a.prototype,"addNativeOverlay",1),c([n],a.prototype,"removeNativeOverlay",1),c([n],a.prototype,"isFeatureSupported",1);var L=a;
3
+ `);return new a$5(t)}async setFrameSource(e){let t=e!==this._frameSource;if(this._frameSource!==null&&(this._frameSource.context=null),this._frameSource=e!=null?e:null,e&&(e.context=this,await this.workerCommand("setFrameSource",{mirrorAxis:this.getMirrorAxisForFrameSource(e),isCameraFrameSource:f(e)})),await this.update([{type:"frameSourceState",newValue:this.frameSource}]),t)for(let r of this.listeners)r.didChangeFrameSource&&r.didChangeFrameSource(this,this._frameSource);}addListener(e){this.listeners.includes(e)||this.listeners.push(e);}async flushAnalytics(){await this.workerCommand("flushAnalytics",{});}removeListener(e){this.listeners.includes(e)&&this.listeners.splice(this.listeners.indexOf(e),1);}async addMode(e){this.modes.add(e),await e.attachedToContext(this),this.updateCameraFrameFlow(),await this.update([],{updateContext:!g(e)});}async removeMode(e){this.modes.delete(e),await e.detachedFromContext(),this.updateCameraFrameFlow(),await this.update([],{updateContext:!g(e)});}async setMode(e){this.modes.has(e)||(this.modes.clear(),this.modes.add(e),await e.attachedToContext(this),this.updateCameraFrameFlow(),await this.update());}async removeCurrentMode(){for(let e of this.modes)await e.detachedFromContext();this.modes.clear(),await this.update();}async removeAllModes(){for(let e of this.modes)await this.removeMode(e);}async dispose(){d.instance().removeListener("cameraProperties",this.cameraPropertiesReportListener),d.instance().removeListener("cameraAccessError",this.cameraAccessErrorListener),this.unsubscribeToVisibilityChange(this.onVisibilityChangeListener),await this.removeAllModes(),this.dataCaptureInstance&&await this.workerCommand("dispose",{}),this.listeners=[],this.modes.clear(),this.components.length=0,this.updateListeners.clear(),this.pendingWorkerMessageListeners.clear(),this.dataCaptureInstance=void 0,this.delayedRegistration=false,this.highEndBlurryRecognition=false,this._frameHandlers.length=0,this.frameSource&&(this.frameSource.context=null,this._frameSource=null),this._view&&(this._view.setContext(null),this._view=null),this.licenseKey="",this.deviceName="";}async applySettings(e){this.settings=e,await this.update();}toJSONObject(){var e,t;return {licenseKey:this.licenseKey,framework:this.framework,deviceName:this.deviceName,...this.runtimeEnvironment,modes:[...this.modes].filter(r=>!g(r)).map(r=>r.toJSONObject()),components:this.components.map(r=>r.toJSONObject()),frameSource:this.frameSource?this.frameSource.toJSONObject():null,settings:this.settings.toJSONObject(),view:(t=(e=this._view)==null?void 0:e.toJSONObject())!=null?t:null}}getView(){return this._view}async setView(e){return this._view=e,this.update([{type:"viewSet",newValue:e}])}async getAppName(){let e=null;if(a$6()){let t=await b();if((t==null?void 0:t.appName)==null||t.appName==="")throw new Error("Cannot retrieve electron appName. Did you set it up in package.json? https://www.electronjs.org/docs/latest/api/app#appgetname");e=t.appName;}return e}urlToHostname(e){try{return new URL(e!=null?e:"").hostname}catch(t){return ""}}getParentDomain(){var t;let e="";return parent!==window&&(e||(e=this.urlToHostname((t=location.ancestorOrigins)==null?void 0:t[0])),e||(e=this.urlToHostname(document.referrer)),e||(e="")),e.startsWith("[")&&e.endsWith("]")&&(e=e.slice(1,-1)),e}async createContext(e=true){await this.workerCommand("createContext",{context:this.toJSONObject(),deviceId:a.deviceID,delayedRegistration:this.delayedRegistration,highEndBlurryRecognition:this.highEndBlurryRecognition,appName:await this.getAppName(),parentDomain:this.getParentDomain()}),this.subscribeToWorkerMessages(this.onWorkerMessageListener),e&&(this.subscribeToCameraManagerEvents(),this.subscribeToVisibilityChange(this.onVisibilityChangeListener)),this._view!=null&&await this.setView(this._view),this.frameSource!=null&&await this.setFrameSource(this.frameSource);}subscribeToVisibilityChange(e){document.addEventListener("visibilitychange",e);}unsubscribeToVisibilityChange(e){document.removeEventListener("visibilitychange",e);}async requestFrameData(e){return this.workerCommand("requestFrameData",{frameId:e})}performanceMark(e){a$7(globalThis.performance)&&typeof globalThis.performance.mark=="function"&&performance.mark(e);}async sendFrameToProcessor(e){let t=e instanceof ImageData?{data:e.data,width:e.width,height:e.height}:e,r=await this.sendFrameToHandlers(t);return t.data=r.capture.data,r.skip?r.capture:(this.performanceMark("processFrameBeforeSDC"),this.sendFrameToSDC(t))}async sendFrameToHandlers(e){for(let t of this._frameHandlers)if((await t(e)).action==="skip")return {skip:true,capture:e};return {skip:false,capture:e}}async sendFrameToSDC(e){return this.workerCommand("processFrame",e,[e.data.buffer])}registerFrameHandler(e){this._frameHandlers.includes(e)||this._frameHandlers.push(e);}unregisterFrameHandler(e){this._frameHandlers.includes(e)&&this._frameHandlers.splice(this._frameHandlers.indexOf(e),1);}onVisibilityChange(){this.workerCommand("documentVisibility",{state:document.visibilityState});}onWorkerMessage(e){if(e.type==="contextDidChangeStatus"){e.payload.isValid||a$8.error(e.payload);for(let t of this.listeners)t.didChangeStatus&&t.didChangeStatus(this,a$9.fromJSON(e.payload));}if(e.type==="didStartObservingContext")for(let t of this.listeners)t.didStartObservingContext&&t.didStartObservingContext(this);e.type==="onFrameProcessingFinished"&&this.performanceMark("processFrameAfterSDC");}subscribeToCameraManagerEvents(){d.instance().addListener("cameraProperties",this.cameraPropertiesReportListener),d.instance().addListener("cameraAccessError",this.cameraAccessErrorListener);}async reportCameraProperties(e){return this.workerCommand("reportCameraProperties",e)}onCameraAccessError(e){for(let t of this.listeners)t.didChangeStatus&&t.didChangeStatus(this,a$9.fromJSON({code:33794,isValid:true,message:typeof(e==null?void 0:e.toString)=="function"?e.toString():"Unknown error"}));}async update(e=[],{updateContext:t=true}={}){var r,o;t&&await this.updateContext();for(let i of e){switch(i.type){case "frameSourceState":{await((r=this._view)==null?void 0:r.onFrameSourceChange(this.frameSource));break}case "singleImageModeUploaderSettings":{(o=this._view)==null||o.onSingleImageUploaderSettingsChange(i.newValue);break}case "addOverlay":{await this.addNativeOverlay(i.newValue);break}case "removeOverlay":{await this.removeNativeOverlay(i.newValue);break}}for(let m of this.updateListeners)m(i);}}async updateContext(){await this.workerCommand("updateContext",{context:this.toJSONObject(),...this.getViewInfo()}).catch(e=>a$8.warn("Error while updating context:",e));}getViewInfo(){return this._view!=null?{view:{width:this._view.width,height:this._view.height,visible:this._view.width>0&&this._view.height>0,orientation:this._view.orientation}}:{view:null}}getMirrorAxisForFrameSource(e){let t="None";return f(e)&&e.getMirrorImageEnabled()&&(t="Y"),t}async addComponent(e){if(!this.components.includes(e))return this.components.push(e),e._context=this,this.update()}async addNativeOverlay(e){if(F(e))return this.workerCommand("addNativeOverlay",{overlayHandle:e[a$a]})}async removeNativeOverlay(e){if(F(e))return this.workerCommand("removeNativeOverlay",{overlayHandle:e[a$a]})}subscribeToWorkerMessages(e){this.dataCaptureInstance?this.dataCaptureInstance.addWorkerListener(e):this.pendingWorkerMessageListeners.add(e);}unsubscribeToWorkerMessages(e){this.dataCaptureInstance&&this.dataCaptureInstance.removeWorkerListener(e),this.pendingWorkerMessageListeners.delete(e);}hasEnabledMode(){return [...this.modes].some(e=>e.isEnabled())}updateCameraFrameFlow(){let e=[...this.modes].some(t=>t._synchronousFrameFlow===true);d.instance().setFrameHandling(e);}async isFeatureSupported(e){return (await this.workerCommand("isFeatureSupported",{feature:e})).supported}};a.deviceID=a$1.getDeviceId(),a.moduleLicenseTextProviders=[new a$2],c([s],a.prototype,"initializeWithOptions",1),c([s],a.prototype,"addMode",1),c([s],a.prototype,"removeMode",1),c([s],a.prototype,"setMode",1),c([s],a.prototype,"removeCurrentMode",1),c([s],a.prototype,"createContext",1),c([s],a.prototype,"addComponent",1),c([s],a.prototype,"addNativeOverlay",1),c([s],a.prototype,"removeNativeOverlay",1),c([s],a.prototype,"isFeatureSupported",1);var L=a;
4
4
  export{L as a};
@@ -1,12 +1,13 @@
1
1
  /// <reference types="emscripten" />
2
2
  import { Logger } from './logger.js';
3
3
  import { ConfigurePhase } from './sdk.js';
4
+ import { LoadingStatus } from './LoadingStatus.js';
5
+ export { LoadingStatusSubscriber, ProgressInfo } from './LoadingStatus.js';
4
6
  export { WorkerMain } from './worker/WorkerMain.js';
5
7
  export { Anchor, Color, ColorJSON, Direction, JSONType, MarginsWithUnit, MarginsWithUnitJSON, MeasureUnit, NumberWithUnit, NumberWithUnitJSON, Orientation, Point, PointJSON, PointWithUnit, PointWithUnitJSON, Quadrilateral, QuadrilateralJSON, Rect, RectJSON, RectWithUnit, RectWithUnitJSON, Size, SizeJSON, SizeWithAspect, SizeWithUnit, SizeWithUnitAndAspect, SizeWithUnitAndAspectJSON, SizeWithUnitJSON, SizingMode } from './Common.js';
6
8
  export { OverrideState } from './worker/OverrideState.js';
7
9
  import { D as DataCaptureLoader } from './Camera-C1Hz9V3G.js';
8
10
  export { g as Camera, h as CameraAccess, e as CameraJSON, C as CameraPosition, n as CameraSettings, k as CameraSettingsFromJSON, l as CameraSettingsJSON, j as CameraSettingsJSONBase, o as Change, H as ContextStatus, G as ContextStatusJSON, u as DataCaptureComponent, t as DataCaptureComponentJSON, B as DataCaptureContext, x as DataCaptureContextCreationOptions, y as DataCaptureContextJSON, E as DataCaptureContextListener, S as DataCaptureLoaderOptions, p as DataCaptureMode, r as DataCaptureModeJSON, J as DataCaptureOverlay, N as DataCaptureView, M as DataCaptureViewConnectOptions, L as DataCaptureViewJSON, K as DataCaptureViewListener, i as DeviceCamera, F as FocusGestureStrategy, O as FrameData, a as FrameSource, d as FrameSourceJSON, c as FrameSourceListener, b as FrameSourceState, P as PrivateChangeSet, s as PrivateDataCaptureComponent, w as PrivateDataCaptureContext, v as PrivateDataCaptureContextOptions, q as PrivateDataCaptureMode, A as PrivateFrameHandler, z as PrivateFrameHandlerResponse, Q as PrivateLoadableFrameData, I as PrivateMirrorAxis, T as TorchState, f as VideoFrameResolution, V as VideoResolution, R as convertToPublicFrameData, m as isCameraFrameSource } from './Camera-C1Hz9V3G.js';
9
- export { LoadingStatus, LoadingStatusSubscriber, ProgressInfo, default as loadingStatus } from './LoadingStatus.js';
10
11
  export { DeepMutable, DeepPartial, DistributiveKeyOf, MethodSignature, Mutable, Optional, Prettify, assert, assertUnreachable, assertUnreachableThrowException } from './tsHelper.js';
11
12
  export { AimerViewfinder } from './AimerViewfinder.js';
12
13
  export { Brush, BrushJSON } from './Brush.js';
@@ -48,6 +49,8 @@ import './private/HtmlElementState.js';
48
49
  import './private/ui/atoms/SvgIcon.js';
49
50
  import 'csstype';
50
51
 
52
+ declare const loadingStatus: LoadingStatus;
53
+
51
54
  type PrivateCaptureModuleName = "BarcodeCapture" | "IdCapture" | "Parser" | "LabelCapture";
52
55
  interface ModuleLoader {
53
56
  moduleName: string;
@@ -73,4 +76,4 @@ declare function configure(options: ConfigureOptions): Promise<void>;
73
76
  */
74
77
  declare function __setConfigurePhase(phase: ConfigurePhase, newLoader?: DataCaptureLoader): void;
75
78
 
76
- export { type ConfigureOptions, DataCaptureLoader, Logger, type ModuleLoader, type PrivateCaptureModuleName, __setConfigurePhase, configure, resetConfigure };
79
+ export { type ConfigureOptions, DataCaptureLoader, LoadingStatus, Logger, type ModuleLoader, type PrivateCaptureModuleName, __setConfigurePhase, configure, loadingStatus, resetConfigure };
package/build/js/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import {a as a$5}from'./chunks/chunk-GC2ECHKL.js';import {a as a$1}from'./chunks/chunk-ACFJP5SR.js';export{a as DataCaptureLoader}from'./chunks/chunk-VGSPU525.js';export{a as WorkerMain}from'./chunks/chunk-3GGCR76I.js';export{a as OverrideState}from'./chunks/chunk-6W7FX6LD.js';import {a as a$6}from'./chunks/chunk-AIC4H5KG.js';export{a as NotificationBuilder}from'./chunks/chunk-VBRTZG3W.js';export{c as ScanditIconBuilder,b as ScanditIconForIconType,a as ScanditIconType}from'./chunks/chunk-W2FVIH2I.js';export{a as SingleImageUploader}from'./chunks/chunk-4TDWWHP2.js';export{a as SingleImageUploaderSettings}from'./chunks/chunk-5S5BT5PK.js';export{c as CameraFOVSwitchControl,b as CameraSwitchControl,a as TorchSwitchControl}from'./chunks/chunk-FS52JIW4.js';export{a as NoViewfinder}from'./chunks/chunk-4ZMCJXZS.js';export{a as convertToPublicFrameData}from'./chunks/chunk-UHFABUTI.js';export{a as ImageFrameSource}from'./chunks/chunk-BS7MAI4E.js';export{a as LaserlineViewfinder}from'./chunks/chunk-H75G3H4R.js';export{a as PrivateNoneLocationSelection,b as RadiusLocationSelection,c as RectangularLocationSelection}from'./chunks/chunk-AKDTQZ73.js';export{a as RectangularViewfinder}from'./chunks/chunk-6NVWG2LP.js';export{b as ScanditIcon,a as ScanditIconShape}from'./chunks/chunk-27Z5CYJL.js';export{a as DataCaptureVersion}from'./chunks/chunk-6W36BRWI.js';export{a as DataCaptureView}from'./chunks/chunk-KOFOHU5G.js';import {a as a$a}from'./chunks/chunk-N5YZEC56.js';export{a as AnchorPositions}from'./chunks/chunk-EKOWJS3E.js';export{a as NotificationConfiguration}from'./chunks/chunk-KUVVZN66.js';export{a as NotificationStyle}from'./chunks/chunk-RXT3JWWR.js';import {a as a$4}from'./chunks/chunk-VJB527QZ.js';import {a as a$3}from'./chunks/chunk-GHTCNOQN.js';export{a as Localization}from'./chunks/chunk-GHTCNOQN.js';export{a as Feedback}from'./chunks/chunk-N2GWO3EX.js';export{a as Sound}from'./chunks/chunk-AUWF33RB.js';export{a as Vibration}from'./chunks/chunk-SJJGHQ52.js';export{a as AimerViewfinder}from'./chunks/chunk-26DQPDMK.js';export{a as Brush}from'./chunks/chunk-PUP3NNKU.js';export{a as Camera}from'./chunks/chunk-KIT67VAW.js';export{a as CameraAccess}from'./chunks/chunk-DFFYK2ZZ.js';export{a as DataCaptureContext}from'./chunks/chunk-CKBTO64W.js';import {a as a$b,c}from'./chunks/chunk-LISC6VSM.js';import {a as a$2}from'./chunks/chunk-NKCR7VPO.js';import {b}from'./chunks/chunk-6H6FKGVE.js';export{b as loadingStatus}from'./chunks/chunk-6H6FKGVE.js';export{a as DataCaptureContextSettings}from'./chunks/chunk-7SW2PEHB.js';export{a as ScanditHTMLElement}from'./chunks/chunk-EV4OEANA.js';export{a as assert,b as assertUnreachable,c as assertUnreachableThrowException}from'./chunks/chunk-FTD535WI.js';import {a as a$9}from'./chunks/chunk-GPJEB376.js';import {a as a$c}from'./chunks/chunk-QCZSSQAQ.js';export{a as DataCaptureError}from'./chunks/chunk-QCZSSQAQ.js';import {a as a$8}from'./chunks/chunk-UCD6YLP3.js';export{a as BrowserHelper}from'./chunks/chunk-UCD6YLP3.js';export{a as Feature}from'./chunks/chunk-NVK73TNL.js';import {a as a$7}from'./chunks/chunk-XR65N6EG.js';export{a as Logger}from'./chunks/chunk-XR65N6EG.js';export{c as CameraPosition,g as CameraSettings,e as FocusGestureStrategy,a as FrameSourceState,b as TorchState,d as VideoResolution,f as isCameraFrameSource}from'./chunks/chunk-7ELPJFJV.js';export{c as RectangularViewfinderAnimation,b as RectangularViewfinderLineStyle,a as RectangularViewfinderStyle}from'./chunks/chunk-WGLHZXRT.js';export{a as LogoStyle,c as SwipeToZoom,b as TapToFocus}from'./chunks/chunk-GX4YCYCH.js';export{q as Anchor,n as Color,p as Direction,m as MarginsWithUnit,c as MeasureUnit,d as NumberWithUnit,o as Orientation,a as Point,e as PointWithUnit,b as Quadrilateral,f as Rect,g as RectWithUnit,i as Size,j as SizeWithAspect,h as SizeWithUnit,l as SizeWithUnitAndAspect,k as SizingMode}from'./chunks/chunk-TPQTY3KB.js';export{a as ContextStatus,b as PrivateMirrorAxis}from'./chunks/chunk-WUHKODFA.js';a$1();var a=a$2;async function A(){var e;a.configurePhase="unconfigured",a.configurePromise=null,(e=a.mainDataCaptureLoader)!=null&&e.terminateDataCaptureWorker&&await a.mainDataCaptureLoader.terminateDataCaptureWorker(true);}function g({percentage:e}){for(let r of a$a.values())r.setProgressBarPercentage(e);}function B(){var i,u,f;function e(b){return ["auto","off","on"].includes(b)}let r=new URLSearchParams(window.location.search),[o="auto",s="auto",n=false]=[(i=r.get("pthreads"))==null?void 0:i.toLowerCase(),(u=r.get("simd"))==null?void 0:u.toLowerCase(),((f=r.get("forceAllPolyfills"))==null?void 0:f.toLowerCase())==="true"];return {overrideThreadsSupport:e(o)?o:"auto",overrideSimdSupport:e(s)?s:"auto",forceAllPolyfills:n}}async function I(e){if(a$b()&&typeof e.licenseDataPath!="string")throw new a$c({name:"MisconfigurationError",message:'"licenseDataPath" string is missing or not valid'});if(a$b()&&typeof e.licenseDataPath=="string"){let o=await c({licenseDataPath:e.licenseDataPath});if(o==null)throw new Error("Cannot retrieve license key for Electron");e.licenseKey=o.licenseKey;}if(e.licenseKey==null||e.licenseKey.trim().length<64)throw new a$c({name:"NoLicenseKeyError",message:"No license key provided"});if(typeof e.libraryLocation!="string")throw new a$c({name:"MisconfigurationError",message:'Option "libraryLocation" was not provided'});if(!Array.isArray(e.moduleLoaders)||e.moduleLoaders.length===0)throw new a$c({name:"MisconfigurationError",message:'Option "moduleLoaders" is missing or empty'});let r=e.moduleLoaders.map(o=>o.moduleName);if(!["BarcodeCapture","IdCapture","LabelCapture"].includes(r[0]))throw new a$c({name:"MisconfigurationError",message:'Main modules must be loaded before side modules. For example "BarcodeCapture" must be loaded before "Parser".'})}async function z(e,r){let o=new Map,s=new Map;for(let n of e)s.set(n.moduleName,n.load(r));await Promise.all(s.values());for(let[n,i]of s)o.set(n,await i);return o}async function nr(e){if(a.configurePhase!=="unconfigured"&&a.configurePromise!=null)return a.configurePromise;a$3.getInstance().updateIfMissing(a$4);async function r(){var f;a$2.configurePhase="started";let{forceAllPolyfills:o,overrideThreadsSupport:s,overrideSimdSupport:n}=B();await a$5({forceAllPolyfills:o}),await I(e);let i={overrideThreadsSupport:s,overrideSimdSupport:n,...e,libraryLocation:a$6(e.libraryLocation),logLevel:(f=e.logLevel)!=null?f:a$7.Level.Debug,verifyResponseHash:true,loadProgressNotifier:b.notify.bind(b)};a$7.setLevel(i.logLevel),a$2.userLicenseKey=i.licenseKey,a$2.libraryLocation=i.libraryLocation,b.subscribe(g);let u=a$8.checkBrowserCompatibility();if(!u.fullSupport&&!u.scannerSupport)throw new a$9(u);a$8.isSupportedIOSVersion()||a$7.log(a$7.Level.Warn,`Warning: Minimum supported iOS version is 14.6.
1
+ import {a as a$5}from'./chunks/chunk-GC2ECHKL.js';import {a as a$4}from'./chunks/chunk-ACFJP5SR.js';export{a as DataCaptureLoader}from'./chunks/chunk-VGSPU525.js';export{a as WorkerMain}from'./chunks/chunk-2AUEQB74.js';export{a as OverrideState}from'./chunks/chunk-6W7FX6LD.js';import {a as a$6}from'./chunks/chunk-AIC4H5KG.js';export{a as NotificationBuilder}from'./chunks/chunk-VBRTZG3W.js';export{c as ScanditIconBuilder,b as ScanditIconForIconType,a as ScanditIconType}from'./chunks/chunk-W2FVIH2I.js';export{a as SingleImageUploader}from'./chunks/chunk-4TDWWHP2.js';export{a as SingleImageUploaderSettings}from'./chunks/chunk-5S5BT5PK.js';export{c as CameraFOVSwitchControl,b as CameraSwitchControl,a as TorchSwitchControl}from'./chunks/chunk-FS52JIW4.js';export{a as NoViewfinder}from'./chunks/chunk-4ZMCJXZS.js';export{a as convertToPublicFrameData}from'./chunks/chunk-UHFABUTI.js';export{a as ImageFrameSource}from'./chunks/chunk-BS7MAI4E.js';export{a as LaserlineViewfinder}from'./chunks/chunk-H75G3H4R.js';import {a as a$1}from'./chunks/chunk-JQDTJGOT.js';export{a as PrivateNoneLocationSelection,b as RadiusLocationSelection,c as RectangularLocationSelection}from'./chunks/chunk-AKDTQZ73.js';export{a as RectangularViewfinder}from'./chunks/chunk-6NVWG2LP.js';export{b as ScanditIcon,a as ScanditIconShape}from'./chunks/chunk-27Z5CYJL.js';export{a as DataCaptureVersion}from'./chunks/chunk-HPHMQ52J.js';export{a as DataCaptureView}from'./chunks/chunk-KOFOHU5G.js';import {a as a$a}from'./chunks/chunk-N5YZEC56.js';export{a as AnchorPositions}from'./chunks/chunk-EKOWJS3E.js';export{a as NotificationConfiguration}from'./chunks/chunk-KUVVZN66.js';export{a as NotificationStyle}from'./chunks/chunk-RXT3JWWR.js';import {a as a$3}from'./chunks/chunk-VJB527QZ.js';import {a as a$2}from'./chunks/chunk-GHTCNOQN.js';export{a as Localization}from'./chunks/chunk-GHTCNOQN.js';export{a as Feedback}from'./chunks/chunk-N2GWO3EX.js';export{a as Sound}from'./chunks/chunk-AUWF33RB.js';export{a as Vibration}from'./chunks/chunk-SJJGHQ52.js';export{a as AimerViewfinder}from'./chunks/chunk-26DQPDMK.js';export{a as Brush}from'./chunks/chunk-PUP3NNKU.js';export{a as Camera}from'./chunks/chunk-KIT67VAW.js';export{a as CameraAccess}from'./chunks/chunk-DFFYK2ZZ.js';export{a as DataCaptureContext}from'./chunks/chunk-OH47MYOE.js';import {a as a$b,c}from'./chunks/chunk-LISC6VSM.js';import {a}from'./chunks/chunk-GNA6ZKV3.js';export{a as DataCaptureContextSettings}from'./chunks/chunk-7SW2PEHB.js';export{a as ScanditHTMLElement}from'./chunks/chunk-EV4OEANA.js';export{a as assert,b as assertUnreachable,c as assertUnreachableThrowException}from'./chunks/chunk-FTD535WI.js';import {a as a$9}from'./chunks/chunk-GPJEB376.js';import {a as a$c}from'./chunks/chunk-QCZSSQAQ.js';export{a as DataCaptureError}from'./chunks/chunk-QCZSSQAQ.js';import {a as a$8}from'./chunks/chunk-UCD6YLP3.js';export{a as BrowserHelper}from'./chunks/chunk-UCD6YLP3.js';export{a as Feature}from'./chunks/chunk-NVK73TNL.js';import {a as a$7}from'./chunks/chunk-XR65N6EG.js';export{a as Logger}from'./chunks/chunk-XR65N6EG.js';export{c as CameraPosition,g as CameraSettings,e as FocusGestureStrategy,a as FrameSourceState,b as TorchState,d as VideoResolution,f as isCameraFrameSource}from'./chunks/chunk-7ELPJFJV.js';export{c as RectangularViewfinderAnimation,b as RectangularViewfinderLineStyle,a as RectangularViewfinderStyle}from'./chunks/chunk-WGLHZXRT.js';export{a as LogoStyle,c as SwipeToZoom,b as TapToFocus}from'./chunks/chunk-GX4YCYCH.js';export{q as Anchor,n as Color,p as Direction,m as MarginsWithUnit,c as MeasureUnit,d as NumberWithUnit,o as Orientation,a as Point,e as PointWithUnit,b as Quadrilateral,f as Rect,g as RectWithUnit,i as Size,j as SizeWithAspect,h as SizeWithUnit,l as SizeWithUnitAndAspect,k as SizingMode}from'./chunks/chunk-TPQTY3KB.js';export{a as ContextStatus,b as PrivateMirrorAxis}from'./chunks/chunk-WUHKODFA.js';var t=a.getInstance(),p=a$1.getInstance();async function A(){var e;t.configurePhase="unconfigured",t.configurePromise=null,(e=t.mainDataCaptureLoader)!=null&&e.terminateDataCaptureWorker&&await t.mainDataCaptureLoader.terminateDataCaptureWorker(true);}function y({percentage:e}){for(let r of a$a.values())r.setProgressBarPercentage(e);}function B(){var n,s,m;function e(f){return ["auto","off","on"].includes(f)}let r=new URLSearchParams(window.location.search),[o="auto",a="auto",i=false]=[(n=r.get("pthreads"))==null?void 0:n.toLowerCase(),(s=r.get("simd"))==null?void 0:s.toLowerCase(),((m=r.get("forceAllPolyfills"))==null?void 0:m.toLowerCase())==="true"];return {overrideThreadsSupport:e(o)?o:"auto",overrideSimdSupport:e(a)?a:"auto",forceAllPolyfills:i}}async function z(e){if(a$b()&&typeof e.licenseDataPath!="string")throw new a$c({name:"MisconfigurationError",message:'"licenseDataPath" string is missing or not valid'});if(a$b()&&typeof e.licenseDataPath=="string"){let o=await c({licenseDataPath:e.licenseDataPath});if(o==null)throw new Error("Cannot retrieve license key for Electron");e.licenseKey=o.licenseKey;}if(e.licenseKey==null||e.licenseKey.trim().length<64)throw new a$c({name:"NoLicenseKeyError",message:"No license key provided"});if(typeof e.libraryLocation!="string")throw new a$c({name:"MisconfigurationError",message:'Option "libraryLocation" was not provided'});if(!Array.isArray(e.moduleLoaders)||e.moduleLoaders.length===0)throw new a$c({name:"MisconfigurationError",message:'Option "moduleLoaders" is missing or empty'});let r=e.moduleLoaders.map(o=>o.moduleName);if(!["BarcodeCapture","IdCapture","LabelCapture"].includes(r[0]))throw new a$c({name:"MisconfigurationError",message:'Main modules must be loaded before side modules. For example "BarcodeCapture" must be loaded before "Parser".'})}async function T(e,r){let o=new Map,a=new Map;for(let i of e)a.set(i.moduleName,i.load(r));await Promise.all(a.values());for(let[i,n]of a)o.set(i,await n);return o}async function mr(e){if(t.configurePhase!=="unconfigured"&&t.configurePromise!=null)return t.configurePromise;a$2.getInstance().updateIfMissing(a$3);let r=a.getInstance();async function o(){var f;a$4(),r.configurePhase="started";let{forceAllPolyfills:a,overrideThreadsSupport:i,overrideSimdSupport:n}=B();await a$5({forceAllPolyfills:a}),await z(e);let s={overrideThreadsSupport:i,overrideSimdSupport:n,...e,libraryLocation:a$6(e.libraryLocation),logLevel:(f=e.logLevel)!=null?f:a$7.Level.Debug,verifyResponseHash:true,loadProgressNotifier:p.notify.bind(p)};a$7.setLevel(s.logLevel),r.userLicenseKey=s.licenseKey,r.libraryLocation=s.libraryLocation,p.subscribe(y);let m=a$8.checkBrowserCompatibility();if(!m.fullSupport&&!m.scannerSupport)throw new a$9(m);a$8.isSupportedIOSVersion()||a$7.log(a$7.Level.Warn,`Warning: Minimum supported iOS version is 14.6.
2
2
  Please check the minimum system requirements here:
3
- https://docs.scandit.com/system-requirements#web-sdk`),a$2.dataCaptureLoaders=await z(i.moduleLoaders,i),a$2.mainDataCaptureLoader=[...a$2.dataCaptureLoaders.entries()][0][1],a$2.configurePhase="done",b.unsubscribe(g);}return a$2.configurePromise=r().catch(o=>{throw A(),b.unsubscribe(g),o}),a$2.configurePromise}function mr(e,r){switch(a.configurePhase=e,e){case "done":r&&(a.mainDataCaptureLoader=r),a.configurePromise=Promise.resolve();break;case "unconfigured":a.configurePromise=null;break;default:throw new Error(`Invalid configure phase: ${e}`)}}
4
- export{mr as __setConfigurePhase,nr as configure,A as resetConfigure};
3
+ https://docs.scandit.com/system-requirements#web-sdk`),r.dataCaptureLoaders=await T(s.moduleLoaders,s),r.mainDataCaptureLoader=[...r.dataCaptureLoaders.entries()][0][1],r.configurePhase="done",p.unsubscribe(y);}return r.configurePromise=o().catch(a=>{throw A(),a$1.getInstance().unsubscribe(y),a}),r.configurePromise}function ur(e,r){switch(t.configurePhase=e,e){case "done":r&&(t.mainDataCaptureLoader=r),t.configurePromise=Promise.resolve();break;case "unconfigured":t.configurePromise=null;break;default:throw new Error(`Invalid configure phase: ${e}`)}}
4
+ export{ur as __setConfigurePhase,mr as configure,p as loadingStatus,A as resetConfigure};
@@ -1 +1 @@
1
- export{a as CoreModuleLicenseTextProvider}from'../chunks/chunk-34HLD6AY.js';
1
+ export{a as CoreModuleLicenseTextProvider}from'../chunks/chunk-N6BLNZCH.js';
package/build/js/sdk.d.ts CHANGED
@@ -29,7 +29,6 @@ interface SDKGlobals {
29
29
  userLicenseKey: string | null;
30
30
  mainDataCaptureLoader: DataCaptureLoader | undefined;
31
31
  dataCaptureLoaders: Map<string, DataCaptureLoader>;
32
- loadingStatus: LoadingStatus;
33
32
  libraryLocation: string | undefined;
34
33
  }
35
34
  type PartialSDKGlobals = Partial<SDKGlobals>;
@@ -41,12 +40,13 @@ declare class SDK extends EventTarget implements SDKGlobals {
41
40
  libraryLocation: string | undefined;
42
41
  private _configurePhase;
43
42
  private _configurePromise;
43
+ private static instance;
44
+ static getInstance(): SDK;
44
45
  constructor();
45
46
  set configurePhase(value: ConfigurePhase);
46
47
  get configurePhase(): ConfigurePhase;
47
48
  set configurePromise(value: Promise<void> | null);
48
49
  get configurePromise(): Promise<void> | null;
49
50
  }
50
- declare const sdk: SDK;
51
51
 
52
- export { type ConfigurePhase, type PartialSDKGlobals, type SDKGlobals, sdk };
52
+ export { type ConfigurePhase, type PartialSDKGlobals, SDK, type SDKGlobals };
package/build/js/sdk.js CHANGED
@@ -1 +1 @@
1
- export{a as sdk}from'./chunks/chunk-NKCR7VPO.js';
1
+ export{a as SDK}from'./chunks/chunk-GNA6ZKV3.js';
@@ -1 +1 @@
1
- export{a as WorkerMain}from'../chunks/chunk-3GGCR76I.js';
1
+ export{a as WorkerMain}from'../chunks/chunk-2AUEQB74.js';
@@ -1 +1 @@
1
- export{b as InlineWorker,a as workerInstance}from'../chunks/chunk-OX4A6NBF.js';
1
+ export{b as InlineWorker,a as workerInstance}from'../chunks/chunk-I3UQEZAT.js';
@@ -1 +1 @@
1
- export{a as DataCaptureEngine}from'../chunks/chunk-QUJWWKHB.js';
1
+ export{a as DataCaptureEngine}from'../chunks/chunk-MQ3WX6DY.js';
@@ -1 +1 @@
1
- export{a as DataCaptureLoader}from'../chunks/chunk-VGSPU525.js';export{a as WorkerMain}from'../chunks/chunk-3GGCR76I.js';export{a as DataCaptureEngine}from'../chunks/chunk-QUJWWKHB.js';export{h as GuidanceHintAnchor,i as GuidanceHintStyle,g as HintAnchor,e as HintCornerStyle,a as HintFont,d as HintHeight,f as HintIcon,b as HintTextAlignment,c as HintWidth,k as LicensedFeature,j as ToastHintStyle}from'../chunks/chunk-L7TY4UEP.js';
1
+ export{a as DataCaptureLoader}from'../chunks/chunk-VGSPU525.js';export{a as WorkerMain}from'../chunks/chunk-2AUEQB74.js';export{a as DataCaptureEngine}from'../chunks/chunk-MQ3WX6DY.js';export{h as GuidanceHintAnchor,i as GuidanceHintStyle,g as HintAnchor,e as HintCornerStyle,a as HintFont,d as HintHeight,f as HintIcon,b as HintTextAlignment,c as HintWidth,k as LicensedFeature,j as ToastHintStyle}from'../chunks/chunk-L7TY4UEP.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scandit/web-datacapture-core",
3
- "version": "7.6.5",
3
+ "version": "7.6.7",
4
4
  "description": "Scandit Data Capture SDK for the Web",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "sideEffects": false,
@@ -1,2 +0,0 @@
1
- import {a}from'./chunk-NKCR7VPO.js';import {a as a$1}from'./chunk-XR65N6EG.js';var s=class{constructor(t=a,e=a$1,r=globalThis.fetch.bind(globalThis)){this.sdk=t,this.logger=e,this.fetch=r;}get workerCommand(){var t;return (t=this.sdk.mainDataCaptureLoader)==null?void 0:t.workerCommand.bind(this.sdk.mainDataCaptureLoader)}async getLicenseText(){var o,i;if(this.sdk.configurePhase!=="done")return this.logger.warn('You must call "configure" before retrieving open source license text info.'),"";let t=new URL(`${((o=this.sdk.libraryLocation)!=null?o:"").replace(/\/$/,"")}/license/web-core-license.txt`),[e,r]=await Promise.all([(i=this.workerCommand)==null?void 0:i.call(this,"getOpenSourceSoftwareLicenseInfo",{}),this.fetchWebLicenseText(t.toString())]);return [e==null?void 0:e.licenseText,r].filter(l=>l!=null).join(`
2
- `)}async fetchWebLicenseText(t){return this.fetch(t,{mode:"cors",credentials:"include",headers:{"Content-Type":"text/plain"}}).then(async e=>{if(!e.ok)throw new Error(`${e.status} ${e.statusText}`);return e.text()}).catch(e=>(this.logger.warn(`Failed to fetch license from ${t}: ${e.toString()}`),null))}};export{s as a};
@@ -1 +0,0 @@
1
- var r=class{constructor(){this.subscribers=new Set;}subscribe(s){this.subscribers.add(s);}unsubscribe(s){this.subscribers.has(s)&&this.subscribers.delete(s);}notify(s){for(let e of this.subscribers)e(s);}},i=new r,b=i;export{r as a,b};
@@ -1 +0,0 @@
1
- var e;(o=>{function i(){let r="7.6.5";return r}o.sdkVersion=i;})(e||(e={}));export{e as a};
@@ -1 +0,0 @@
1
- import {b}from'./chunk-6H6FKGVE.js';var a=class 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.loadingStatus=b,this.libraryLocation=void 0;}set configurePhase(e){this._configurePhase=e;}get configurePhase(){return this._configurePhase}set configurePromise(e){this._configurePromise=e;}get configurePromise(){return this._configurePromise}},n=new a;export{n as a};
@@ -1 +0,0 @@
1
- import {a}from'./chunk-3GGCR76I.js';var t=new a(globalThis,{get:()=>globalThis.Module,set:e=>{globalThis.Module=e;}});function l(e){}export{t as a,l as b};