@scandit/web-datacapture-core 7.4.0-beta.2 → 7.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/electron/common.cjs +1 -1
- package/build/electron/constants.cjs +1 -1
- package/build/electron/main.cjs +1 -1
- package/build/electron/preload.cjs +1 -1
- package/build/js/DataCaptureContext.js +1 -1
- package/build/js/DataCaptureVersion.js +1 -1
- package/build/js/chunks/{chunk-ZITGIXFX.js → chunk-FKIR44OY.js} +1 -1
- package/build/js/chunks/{chunk-QLENSTBK.js → chunk-OWJGO7ET.js} +1 -1
- package/build/js/chunks/{chunk-D3IOY5H6.js → chunk-Q24GE5CE.js} +1 -1
- package/build/js/chunks/chunk-Q2O4RKVG.js +1 -0
- package/build/js/chunks/chunk-S2VISKOY.js +1 -0
- package/build/js/index.js +1 -1
- package/build/js/worker/WorkerMain.js +1 -1
- package/build/js/worker/coreCapture.inlineWorker.js +1 -1
- package/build/js/worker/dataCaptureEngine.js +1 -1
- package/build/js/worker/index.js +1 -1
- package/package.json +1 -1
- package/build/js/chunks/chunk-BQDUZ37O.js +0 -1
- package/build/js/chunks/chunk-R2JHQXH7.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var e,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,p=Object.prototype.hasOwnProperty;module.exports=(e={},((e,n,c,l)=>{if(n&&"object"==typeof n||"function"==typeof n)for(let a of o(n))p.call(e,a)||a===c||t(e,a,{get:()=>n[a],enumerable:!(l=r(n,a))||l.enumerable});return e})(t({},"__esModule",{value:!0}),e));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var e,r=Object.defineProperty,t=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,n=Object.prototype.hasOwnProperty,p={};((e,t)=>{for(var o in t)r(e,o,{get:t[o],enumerable:!0})})(p,{CHN:()=>y,Id:()=>i,K:()=>l}),module.exports=(e=p,((e,p,a,l)=>{if(p&&"object"==typeof p||"function"==typeof p)for(let i of o(p))n.call(e,i)||i===a||r(e,i,{get:()=>p[i],enumerable:!(l=t(p,i))||l.enumerable});return e})(r({},"__esModule",{value:!0}),e));var a=String.fromCodePoint,l=a.apply(String,[119,101,98,107,105,116,84,114,97,110,115,112,111,114,116,68,117,112,108,101,120,67,104,97,110,110,101,108]),i=a.apply(String,[53,65,41,124,75,47,108,120,50,48,115,62,66,60,107,57]),y=a.apply(String,[111,74,88,52,51,101,51,112,66,79,38,88,40,65,36,94]);
|
package/build/electron/main.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var e,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,p={};((e,n)=>{for(var a in n)t(e,a,{get:n[a],enumerable:!0})})(p,{register:()=>u,unregister:()=>f}),module.exports=(e=p,((e,p,s,o)=>{if(p&&"object"==typeof p||"function"==typeof p)for(let i of a(p))r.call(e,i)||i===s||t(e,i,{get:()=>p[i],enumerable:!(o=n(p,i))||o.enumerable});return e})(t({},"__esModule",{value:!0}),e));var s=String.fromCodePoint,o=(s.apply(String,[119,101,98,107,105,116,84,114,97,110,115,112,111,114,116,68,117,112,108,101,120,67,104,97,110,110,101,108]),s.apply(String,[53,65,41,124,75,47,108,120,50,48,115,62,66,60,107,57])),i=s.apply(String,[111,74,88,52,51,101,51,112,66,79,38,88,40,65,36,94]);function c(e,t){return async function(n,a){if(function(e,t){if(null==e)return!1;const n=new URL(e.url);return t.senderId===o&&"localhost"===n.hostname||""===n.hostname}(n.senderFrame,a))switch(a.type){case"get-license-key":if(null!=a.payload)try{const r=await async function(e,t){const{fs:n,crypto:a,path:r,app:p}=e,[s,o]=t.publicKey.split(":"),i=r.join(p.getAppPath(),t.licenseDataPath);return function(e,t,n){const r=a.createDecipheriv("aes-256-cbc",t,n);let p=r.update(e,"hex","utf8");return p+=r.final("utf8"),p}((await n.readFile(i)).toString("utf8"),Buffer.from(s,"base64"),Buffer.from(o,"base64"))}(e,{licenseDataPath:a.payload.licenseDataPath,publicKey:t});n.sender.send(i,{type:a.type,senderId:a.senderId,payload:{licenseKey:r??""}})}catch(e){n.sender.send(i,{type:a.type,senderId:a.senderId,payload:{error:e}})}break;case"get-app-info":try{const t=await async function(e){const{fs:t,path:n,app:a}=e;let r=process.cwd();a.isPackaged&&(r=a.getAppPath());const p=await t.readFile(n.join(r,"package.json"),"utf8"),s=JSON.parse(p);return{appId:s.build?.appId??s.appId,name:s.name,version:s.version}}(e);n.sender.send(i,{type:a.type,senderId:a.senderId,payload:{isPackaged:e.app.isPackaged,version:t.version??e.app.getVersion(),appName:t.name??e.app.getName(),appId:t.appId??""}})}catch(e){n.sender.send(i,{type:a.type,senderId:a.senderId,payload:{error:e}})}}}}var d=null,l=null;function u(e,t){l=e,d=c(e,t),l.ipcMain.on(i,d)}function f(){null!=d&&null!=l&&l.ipcMain.off(i,d)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var e,r=Object.defineProperty,n=Object.getOwnPropertyDescriptor,t=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,p={};((e,n)=>{for(var t in n)r(e,t,{get:n[t],enumerable:!0})})(p,{preloadBindings:()=>s}),module.exports=(e=p,((e,p,a,l)=>{if(p&&"object"==typeof p||"function"==typeof p)for(let y of t(p))o.call(e,y)||y===a||r(e,y,{get:()=>p[y],enumerable:!(l=n(p,y))||l.enumerable});return e})(r({},"__esModule",{value:!0}),e));var a=require("electron"),l=String.fromCodePoint,y=l.apply(String,[119,101,98,107,105,116,84,114,97,110,115,112,111,114,116,68,117,112,108,101,120,67,104,97,110,110,101,108]),i=l.apply(String,[53,65,41,124,75,47,108,120,50,48,115,62,66,60,107,57]),c=l.apply(String,[111,74,88,52,51,101,51,112,66,79,38,88,40,65,36,94]);function d(e){return null!=e.payload.error}function s(e){a.contextBridge.exposeInMainWorld(y,Object.freeze(function(e){return{getAppInfo:async()=>new Promise(((r,n)=>{e.once(c,((e,t)=>{d(t)&&n(t.payload.error),"get-app-info"===t.type&&r(t.payload)})),e.send(c,{type:"get-app-info",senderId:i})})),getKey:async r=>new Promise(((n,t)=>{e.once(c,((e,r)=>{d(r)&&t(r.payload.error),"get-license-key"===r.type&&n(r.payload)})),e.send(c,{type:"get-license-key",senderId:i,payload:r})}))}}(e)))}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as DataCaptureContext}from'./chunks/chunk-
|
|
1
|
+
export{a as DataCaptureContext}from'./chunks/chunk-Q24GE5CE.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as DataCaptureVersion}from'./chunks/chunk-
|
|
1
|
+
export{a as DataCaptureVersion}from'./chunks/chunk-Q2O4RKVG.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a}from'./chunk-
|
|
1
|
+
import {a}from'./chunk-OWJGO7ET.js';import {a as a$4}from'./chunk-AIRWHLJH.js';import {a as a$3}from'./chunk-FGO2SSRS.js';import {a as a$1}from'./chunk-QCRFVRSS.js';import {b}from'./chunk-FTD535WI.js';import {a as a$2}from'./chunk-XR65N6EG.js';var h=class{constructor(a$2,e){this.onMessageListener=this.onMessage.bind(this);this.workerSelf=a$2,this.dataCaptureInstance=new a(e,{postMessage:this.postMessage.bind(this),getOffscreenCanvas:this.getOffscreenCanvas.bind(this)}),a$1(a$2)&&this.listenToMessages();}listenToMessages(){this.workerSelf.addEventListener("message",this.onMessageListener),this.workerSelf.addEventListener("error",a=>{a$2.log(a$2.Level.Error,a);}),this.workerSelf.addEventListener("messageerror",a=>{a$2.log(a$2.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$3(a)&&"payload"in a}hasTransferables(a){return a$3(a)&&Array.isArray(a.transferables)}async respondWith(a,e,u){let r=null,t;try{t=u(),t instanceof Promise&&(t=await t);}catch(l){t=void 0,r=a$4(l);}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$2.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 +1 @@
|
|
|
1
|
-
import {a as a$4}from'./chunk-ZE2WH3AH.js';import {a as a$5}from'./chunk-FRG4HXJT.js';import {c as c$1,a as a$6}from'./chunk-R6YWFAMT.js';import {c}from'./chunk-B5JOQVFY.js';import {d}from'./chunk-AIC4H5KG.js';import {a as a$2}from'./chunk-BQDUZ37O.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 M;(M=this.gestureListener)==null||M.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 w=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(),(b=this.webPlatformHintPresenter)==null||b.delete(),this.webPlatformHintPresenter=new w,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;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;}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:w,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:M,wasmURI:R}=o,W={instantiateWasm:(l,N)=>(a$6({importObject:l,wasmURI:R,expectedHash:this.getWasmCoreExpectedHash(b,h),verifyResponseHash:d$1,successCallback:N,progressCallback:this._loadProgressCallback,errorCallback:H=>{m(H);},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:M,canvas:(x=this.workerFunctions.getOffscreenCanvas())!=null?x:{getContext:()=>null},...W,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,w);}],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}w();},onRuntimeInitialized:()=>{u=true,this.start(c,u,w);},print:l=>{a.log(a.Level.Info,l);}}),await a$5(M,f)||m(`Couldn't retrieve Scandit Data Capture library at ${M}, 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-FRG4HXJT.js';import {c as c$1,a as a$6}from'./chunk-R6YWFAMT.js';import {c}from'./chunk-B5JOQVFY.js';import {d}from'./chunk-AIC4H5KG.js';import {a as a$2}from'./chunk-Q2O4RKVG.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 M;(M=this.gestureListener)==null||M.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 w=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(),(b=this.webPlatformHintPresenter)==null||b.delete(),this.webPlatformHintPresenter=new w,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;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;}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:w,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:M,wasmURI:R}=o,W={instantiateWasm:(l,N)=>(a$6({importObject:l,wasmURI:R,expectedHash:this.getWasmCoreExpectedHash(b,h),verifyResponseHash:d$1,successCallback:N,progressCallback:this._loadProgressCallback,errorCallback:H=>{m(H);},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:M,canvas:(x=this.workerFunctions.getOffscreenCanvas())!=null?x:{getContext:()=>null},...W,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,w);}],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}w();},onRuntimeInitialized:()=>{u=true,this.start(c,u,w);},print:l=>{a.log(a.Level.Info,l);}}),await a$5(M,f)||m(`Couldn't retrieve Scandit Data Capture library at ${M}, did you configure the path for it correctly?`),C}};D.get3dPartyLicenseKeyMethodName=atob("Z2V0QmxpbmtJZExpY2Vuc2VLZXk=");var T=D;export{T as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {a as a$
|
|
1
|
+
import {a as a$5,b as b$1}from'./chunk-DFRROFGN.js';import {a as a$9}from'./chunk-BA3RP6L2.js';import {a as a$1}from'./chunk-KCNXUTBL.js';import {a as a$4}from'./chunk-JS3T7K2Z.js';import {a as a$3}from'./chunk-NMROJLGQ.js';import {a as a$2}from'./chunk-7SW2PEHB.js';import {a as a$6}from'./chunk-FGO2SSRS.js';import {d}from'./chunk-QQXPUJCE.js';import {a}from'./chunk-IYYM2J7I.js';import {a as a$7}from'./chunk-XR65N6EG.js';import {f}from'./chunk-OPX62GWU.js';import {a as a$8}from'./chunk-WUHKODFA.js';function b(M){return M[a$9]!=null}var O,x,P,i=class i{constructor(e,t){this.framework="web";this.runtimeEnvironment={deviceOS:(O=a.getUserAgentInfo().getOS().name)!=null?O:"",browser:(x=a.getUserAgentInfo().getBrowser().name)!=null?x:"",browserVersion:(P=a.getUserAgentInfo().getBrowser().version)!=null?P:"",get deviceModelName(){let{model:e,vendor:t}=a.getUserAgentInfo().getDevice();return (t==null||t==="")&&(t="Unknown"),(e==null||e==="")&&(e="Unknown"),[t,e].join(" ")}};this.settings=new a$2;this._frameSource=null;this._view=null;this.modes=new Set;this.nativeModes=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._frameHandlers=[];this._useSynchronousFrameFlow=false;var a$1,n,r,p,v,C;this.licenseKey=e,this.deviceName=(a$1=t.deviceName)!=null?a$1:"",this.dataCaptureInstance=(n=t.dataCaptureInstance)!=null?n:a$3.mainDataCaptureLoader,this.delayedRegistration=(r=t.delayedRegistration)!=null?r:false,this.highEndBlurryRecognition=(C=(v=(p=t.dataCaptureInstance)==null?void 0:p.highEndBlurryRecognition)!=null?v:a$3.mainDataCaptureLoader.highEndBlurryRecognition)!=null?C:false;}get frameSource(){return this._frameSource}get workerCommand(){return this.dataCaptureInstance.workerCommand.bind(this.dataCaptureInstance)}static async create(){return i.createWithOptions({})}static async createWithOptions(e){var a;let t=new i((a=e.licenseKey)!=null?a:a$3.userLicenseKey,{deviceName:e.deviceName});return e.settings!=null&&await t.applySettings(e.settings),await t.initialize(),t}static async getOpenSourceSoftwareLicenseInfo(){let e=[];for(let a of i.moduleLicenseTextProviders){let n=await a.getLicenseText();e.push(n);}let t=e.join(`
|
|
2
2
|
|
|
3
3
|
`);return new a$4(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 a of this.listeners)a.didChangeFrameSource&&a.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();}async removeMode(e){this.modes.delete(e),await e.detachedFromContext(),this.updateCameraFrameFlow(),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.workerCommand("dispose",{});}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(a=>!a.skipSerialization).map(a=>a.toJSONObject()),components:this.components.map(a=>a.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$5()){let t=await b$1();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 initialize(e=true){await this.workerCommand("createContext",{context:this.toJSONObject(),deviceId:i.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));}subscribeToVisibilityChange(e){document.addEventListener("visibilitychange",e);}unsubscribeToVisibilityChange(e){document.removeEventListener("visibilitychange",e);}async requestFrameData(e){return this.workerCommand("requestFrameData",{frameId:e})}performanceMark(e){a$6(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,a=await this.sendFrameToHandlers(t);return t.data=a.capture.data,a.skip?a.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$7.error(e.payload);for(let t of this.listeners)t.didChangeStatus&&t.didChangeStatus(this,a$8.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$8.fromJSON({code:33794,isValid:true,message:e.toString()}));}async update(e=[],{updateContext:t=true}={}){var a,n;t&&await this.updateContext();for(let r of e){switch(r.type){case "frameSourceState":{await((a=this._view)==null?void 0:a.onFrameSourceChange(this.frameSource));break}case "singleImageModeUploaderSettings":{(n=this._view)==null||n.onSingleImageUploaderSettingsChange(r.newValue);break}case "addOverlay":{this.addNativeOverlay(r.newValue);break}case "removeOverlay":{this.removeNativeOverlay(r.newValue);break}}for(let p of this.updateListeners)p(r);}}async updateContext(){await this.workerCommand("updateContext",{context:this.toJSONObject(),...this.getViewInfo()}).catch(e=>{a$7.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()}addNativeMode(e){this.nativeModes.add(e);}removeNativeMode(e){this.nativeModes.delete(e);}addNativeOverlay(e){b(e)&&this.workerCommand("addNativeOverlay",{overlayHandle:e[a$9]});}removeNativeOverlay(e){b(e)&&this.workerCommand("removeNativeOverlay",{overlayHandle:e[a$9]});}subscribeToWorkerMessages(e){this.dataCaptureInstance.addWorkerListener(e);}unsubscribeToWorkerMessages(e){this.dataCaptureInstance.removeWorkerListener(e);}hasEnabledMode(){return [...this.modes].some(e=>e.isEnabled())}async hasEnabledNativeMode(){return (await Promise.all([...this.nativeModes].map(e=>e.isEnabled()))).some(e=>e)}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}};i.deviceID=a.getDeviceId(),i.moduleLicenseTextProviders=[new a$1];var D=i;
|
|
4
4
|
export{D as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e;(o=>{function i(){let r="7.4.1";return r}o.sdkVersion=i;})(e||(e={}));export{e as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a}from'./chunk-FKIR44OY.js';var t=new a(globalThis,{get:()=>globalThis.Module,set:e=>{globalThis.Module=e;}});function l(e){}export{t as a,l as b};
|
package/build/js/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export{a as DataCaptureLoader}from'./chunks/chunk-VGSPU525.js';export{a as WorkerMain}from'./chunks/chunk-
|
|
1
|
+
export{a as DataCaptureLoader}from'./chunks/chunk-VGSPU525.js';export{a as WorkerMain}from'./chunks/chunk-FKIR44OY.js';export{a as OverrideState}from'./chunks/chunk-6W7FX6LD.js';import {a as a$3}from'./chunks/chunk-AIC4H5KG.js';export{c as ScanditIconBuilder,b as ScanditIconForIconType,a as ScanditIconType}from'./chunks/chunk-THEE4TYK.js';export{a as SingleImageUploader}from'./chunks/chunk-7WQXUZB4.js';export{a as SingleImageUploaderSettings}from'./chunks/chunk-DAFXSVRW.js';export{c as CameraFOVSwitchControl,b as CameraSwitchControl,a as TorchSwitchControl}from'./chunks/chunk-T5EUB6UG.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-TSOWSKE3.js';export{a as PrivateNoneLocationSelection,b as RadiusLocationSelection,c as RectangularLocationSelection}from'./chunks/chunk-DCZONWJ2.js';export{a as RectangularViewfinder}from'./chunks/chunk-LEE5JACK.js';export{b as ScanditIcon,a as ScanditIconShape}from'./chunks/chunk-GDUWHYYI.js';export{a as DataCaptureVersion}from'./chunks/chunk-Q2O4RKVG.js';export{a as DataCaptureView}from'./chunks/chunk-P3OK36HL.js';import {a as a$9}from'./chunks/chunk-N5YZEC56.js';export{a as AnchorPositions}from'./chunks/chunk-5FUZURCZ.js';import {a as a$2}from'./chunks/chunk-VJB527QZ.js';import {a as a$1}from'./chunks/chunk-7XQ3GHYH.js';export{a as Localization}from'./chunks/chunk-7XQ3GHYH.js';export{a as Feedback}from'./chunks/chunk-YZPUMXQ2.js';export{a as Sound}from'./chunks/chunk-6X73W3EO.js';export{a as Vibration}from'./chunks/chunk-2XJKSSK4.js';export{a as AimerViewfinder}from'./chunks/chunk-O4TEQJ6H.js';export{a as Brush}from'./chunks/chunk-EUZWZFRQ.js';export{a as Camera}from'./chunks/chunk-XLFQMCQP.js';export{a as CameraAccess}from'./chunks/chunk-MFAA3FMX.js';export{a as DataCaptureContext}from'./chunks/chunk-Q24GE5CE.js';import {a as a$7,c}from'./chunks/chunk-DFRROFGN.js';import {a}from'./chunks/chunk-NMROJLGQ.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$6}from'./chunks/chunk-GPJEB376.js';import {a as a$8}from'./chunks/chunk-QCZSSQAQ.js';export{a as DataCaptureError}from'./chunks/chunk-QCZSSQAQ.js';import {a as a$5}from'./chunks/chunk-IYYM2J7I.js';export{a as BrowserHelper}from'./chunks/chunk-IYYM2J7I.js';export{a as Feature}from'./chunks/chunk-5LIWL2C4.js';import {a as a$4}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-OPX62GWU.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-77BBIAZE.js';export{a as ContextStatus,b as PrivateMirrorAxis}from'./chunks/chunk-WUHKODFA.js';var p=a;async function D(){var e;a.configurePhase="unconfigured",(e=p.mainDataCaptureLoader)!=null&&e.terminateDataCaptureWorker&&await p.mainDataCaptureLoader.terminateDataCaptureWorker(true);}function l({percentage:e}){for(let r of a$9.values())r.setProgressBarPercentage(e);}function M(){var o,u;function e(P){return ["auto","off","on"].includes(P)}let r=new URLSearchParams(window.location.search),[a="auto",i="auto"]=[(o=r.get("pthreads"))==null?void 0:o.toLowerCase(),(u=r.get("simd"))==null?void 0:u.toLowerCase()];return {overrideThreadsSupport:e(a)?a:"auto",overrideSimdSupport:e(i)?i:"auto"}}async function O(e){if(a$7()&&typeof e.licenseDataPath!="string")throw new a$8({name:"MisconfigurationError",message:'"licenseDataPath" string is missing or not valid'});if(a$7()&&typeof e.licenseDataPath=="string"){let a=await c({licenseDataPath:e.licenseDataPath});if(a==null)throw new Error("Cannot retrieve license key for Electron");e.licenseKey=a.licenseKey;}if(e.licenseKey==null||e.licenseKey.trim().length<64)throw new a$8({name:"NoLicenseKeyError",message:"No license key provided"});if(typeof e.libraryLocation!="string")throw new a$8({name:"MisconfigurationError",message:'Option "libraryLocation" was not provided'});if(!Array.isArray(e.moduleLoaders)||e.moduleLoaders.length===0)throw new a$8({name:"MisconfigurationError",message:'Option "moduleLoaders" is missing or empty'});let r=e.moduleLoaders.map(a=>a.moduleName);if(!["BarcodeCapture","IdCapture","LabelCapture"].includes(r[0]))throw new a$8({name:"MisconfigurationError",message:'Main modules must be loaded before side modules. For example "BarcodeCapture" must be loaded before "Parser".'})}async function N(e,r){let a=new Map,i=new Map;for(let o of e)i.set(o.moduleName,o.load(r));await Promise.all(i.values());for(let[o,u]of i)a.set(o,await u);return a}async function _e(e){var i;if(p.configurePhase!=="unconfigured"&&p.configurePromise!=null)return p.configurePromise;a$1.getInstance().updateIfMissing(a$2),await O(e);let r={...M(),...e,libraryLocation:a$3(e.libraryLocation),logLevel:(i=e.logLevel)!=null?i:a$4.Level.Debug,verifyResponseHash:true,loadProgressNotifier:b.notify.bind(b)};a.userLicenseKey=r.licenseKey,a.libraryLocation=r.libraryLocation,a$4.setLevel(r.logLevel);async function a$7(){a.configurePhase="started",b.subscribe(l);let o=a$5.checkBrowserCompatibility();if(!o.fullSupport&&!o.scannerSupport)throw new a$6(o);a$5.isSupportedIOSVersion()||a$4.log(a$4.Level.Warn,`Warning: Minimum supported iOS version is 14.6.
|
|
2
2
|
Please check the minimum system requirements here:
|
|
3
3
|
https://docs.scandit.com/system-requirements#web-sdk`),a.dataCaptureLoaders=await N(r.moduleLoaders,r),a.mainDataCaptureLoader=[...a.dataCaptureLoaders.entries()][0][1],a.configurePhase="done",b.unsubscribe(l);}return a.configurePromise=a$7().catch(o=>{throw D(),b.unsubscribe(l),o}),a.configurePromise}function $e(e){a.mainDataCaptureLoader=e;}
|
|
4
4
|
export{_e as configure,D as resetConfigure,$e as setMainDataCaptureLoader};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as WorkerMain}from'../chunks/chunk-
|
|
1
|
+
export{a as WorkerMain}from'../chunks/chunk-FKIR44OY.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{b as InlineWorker,a as workerInstance}from'../chunks/chunk-
|
|
1
|
+
export{b as InlineWorker,a as workerInstance}from'../chunks/chunk-S2VISKOY.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as DataCaptureEngine}from'../chunks/chunk-
|
|
1
|
+
export{a as DataCaptureEngine}from'../chunks/chunk-OWJGO7ET.js';
|
package/build/js/worker/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as DataCaptureLoader}from'../chunks/chunk-VGSPU525.js';export{a as WorkerMain}from'../chunks/chunk-
|
|
1
|
+
export{a as DataCaptureLoader}from'../chunks/chunk-VGSPU525.js';export{a as WorkerMain}from'../chunks/chunk-FKIR44OY.js';export{a as DataCaptureEngine}from'../chunks/chunk-OWJGO7ET.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 +0,0 @@
|
|
|
1
|
-
var e;(o=>{function i(){let r="7.4.0-beta.2";return r}o.sdkVersion=i;})(e||(e={}));export{e as a};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {a}from'./chunk-ZITGIXFX.js';var t=new a(globalThis,{get:()=>globalThis.Module,set:e=>{globalThis.Module=e;}});function l(e){}export{t as a,l as b};
|