@scandit/web-datacapture-core 7.4.1 → 7.5.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/build/js/{Camera-wG9iakev.d.ts → Camera-BoUtNCzS.d.ts} +48 -2
  2. package/build/js/Camera.d.ts +4 -1
  3. package/build/js/Camera.js +1 -1
  4. package/build/js/CameraAccess.d.ts +4 -1
  5. package/build/js/CameraRelated.d.ts +4 -1
  6. package/build/js/DataCaptureContext.d.ts +4 -1
  7. package/build/js/DataCaptureContext.js +1 -1
  8. package/build/js/DataCaptureContextRelated.d.ts +5 -2
  9. package/build/js/DataCaptureVersion.js +1 -1
  10. package/build/js/DataCaptureView.d.ts +4 -1
  11. package/build/js/DataCaptureView.js +1 -1
  12. package/build/js/Defaults.d.ts +4 -1
  13. package/build/js/FrameData.d.ts +5 -2
  14. package/build/js/ImageFrameSource.d.ts +4 -1
  15. package/build/js/NotificationPresenter/NotificationBuilder.d.ts +25 -0
  16. package/build/js/NotificationPresenter/NotificationBuilder.js +1 -0
  17. package/build/js/NotificationPresenter/NotificationConfiguration.d.ts +24 -0
  18. package/build/js/NotificationPresenter/NotificationConfiguration.js +1 -0
  19. package/build/js/NotificationPresenter/NotificationPresenter.d.ts +14 -0
  20. package/build/js/NotificationPresenter/NotificationPresenter.js +0 -0
  21. package/build/js/NotificationPresenter/NotificationStyle.d.ts +9 -0
  22. package/build/js/NotificationPresenter/NotificationStyle.js +1 -0
  23. package/build/js/NotificationPresenter/index.d.ts +25 -0
  24. package/build/js/NotificationPresenter/index.js +1 -0
  25. package/build/js/NotificationPresenter/private/ConcreteNotificationPresenter.d.ts +32 -0
  26. package/build/js/NotificationPresenter/private/ConcreteNotificationPresenter.js +1 -0
  27. package/build/js/NotificationPresenter/private/presets.d.ts +31 -0
  28. package/build/js/NotificationPresenter/private/presets.js +1 -0
  29. package/build/js/ScanditIcon.js +1 -1
  30. package/build/js/ScanditIconBuilder.js +1 -1
  31. package/build/js/SingleImageUploader.d.ts +4 -1
  32. package/build/js/chunks/chunk-3MEGNPVU.js +1 -0
  33. package/build/js/chunks/{chunk-GDUWHYYI.js → chunk-3RIR7ALE.js} +1 -1
  34. package/build/js/chunks/chunk-43NA46NY.js +11 -0
  35. package/build/js/chunks/chunk-6CGCPUUS.js +1 -0
  36. package/build/js/chunks/chunk-6YZS76QW.js +1 -0
  37. package/build/js/chunks/{chunk-NA6AZIR5.js → chunk-72A5262S.js} +1 -1
  38. package/build/js/chunks/{chunk-FKIR44OY.js → chunk-CGHQBWDT.js} +1 -1
  39. package/build/js/chunks/chunk-EKY4M37S.js +5 -0
  40. package/build/js/chunks/{chunk-ZF7CDMAC.js → chunk-FFTRSHP6.js} +1 -1
  41. package/build/js/chunks/{chunk-RWDRTV7B.js → chunk-FPCLZS52.js} +1 -1
  42. package/build/js/chunks/chunk-GGMX65YP.js +1 -0
  43. package/build/js/chunks/{chunk-XLFQMCQP.js → chunk-HNUWDILZ.js} +1 -1
  44. package/build/js/chunks/chunk-J3PS3NRY.js +21 -0
  45. package/build/js/chunks/chunk-KUVVZN66.js +1 -0
  46. package/build/js/chunks/{chunk-2T36DQ52.js → chunk-L3SHJKNC.js} +1 -1
  47. package/build/js/chunks/chunk-NPIPIS7X.js +1 -0
  48. package/build/js/chunks/{chunk-Q24GE5CE.js → chunk-OFNRGDFQ.js} +1 -1
  49. package/build/js/chunks/{chunk-MDSBSLWV.js → chunk-PFC2HW6V.js} +1 -1
  50. package/build/js/chunks/{chunk-OH5WXZBN.js → chunk-RMKJUHZW.js} +1 -1
  51. package/build/js/chunks/chunk-RXT3JWWR.js +1 -0
  52. package/build/js/chunks/chunk-SNP4G4KV.js +0 -0
  53. package/build/js/chunks/chunk-SQBLTG2X.js +1 -0
  54. package/build/js/chunks/{chunk-7B2VPGLP.js → chunk-TCJPGGHY.js} +1 -1
  55. package/build/js/chunks/{chunk-THEE4TYK.js → chunk-UDFHSIR5.js} +1 -1
  56. package/build/js/chunks/{chunk-QQXPUJCE.js → chunk-UGUDXT2N.js} +1 -1
  57. package/build/js/chunks/{chunk-I2LMKSHH.js → chunk-UUGROS73.js} +1 -1
  58. package/build/js/chunks/chunk-VXNI7DDR.js +1 -0
  59. package/build/js/index.d.ts +6 -2
  60. package/build/js/index.js +3 -3
  61. package/build/js/private/CameraAccess.d.ts +4 -1
  62. package/build/js/private/CameraManager.d.ts +4 -1
  63. package/build/js/private/CameraManager.js +1 -1
  64. package/build/js/private/CanvasDrawerWithMetrics.d.ts +6 -3
  65. package/build/js/private/CoreModuleLicenseTextProvider.d.ts +7 -4
  66. package/build/js/private/DataCaptureContextRelated.d.ts +4 -1
  67. package/build/js/private/FrameReaders/FrameReader.d.ts +4 -1
  68. package/build/js/private/FrameReaders/FrameReaderAbstract.d.ts +4 -1
  69. package/build/js/private/FrameReaders/GrayScaleFrameReader.d.ts +4 -1
  70. package/build/js/private/FrameReaders/GrayScaleFrameReader.js +1 -1
  71. package/build/js/private/FrameReaders/index.d.ts +4 -1
  72. package/build/js/private/FrameReaders/index.js +1 -1
  73. package/build/js/private/NormalizedConfigureOptions.d.ts +5 -1
  74. package/build/js/private/ViewControls+related.js +1 -1
  75. package/build/js/private/ViewControls_related.d.ts +5 -1
  76. package/build/js/private/ViewsRegistry.d.ts +4 -1
  77. package/build/js/private/ui/atoms/AimerSvgIcon.js +1 -1
  78. package/build/js/private/ui/atoms/ArrowDownSvgIcon.js +1 -1
  79. package/build/js/private/ui/atoms/ArrowLeftSvgIcon.js +1 -1
  80. package/build/js/private/ui/atoms/ArrowRightSvgIcon.js +1 -1
  81. package/build/js/private/ui/atoms/ArrowUpSvgIcon.js +1 -1
  82. package/build/js/private/ui/atoms/ArrowsUp.js +1 -1
  83. package/build/js/private/ui/atoms/Backdrop.js +1 -1
  84. package/build/js/private/ui/atoms/CalendarExclamationMarkSvgIcon.js +1 -1
  85. package/build/js/private/ui/atoms/CameraSwitchReverseSvgIcon.js +1 -1
  86. package/build/js/private/ui/atoms/CameraSwitchSvgIcon.js +1 -1
  87. package/build/js/private/ui/atoms/Card.js +1 -1
  88. package/build/js/private/ui/atoms/CardList.js +1 -1
  89. package/build/js/private/ui/atoms/CheckSvgIcon.js +1 -1
  90. package/build/js/private/ui/atoms/ChevronDownSvgIcon.js +1 -1
  91. package/build/js/private/ui/atoms/ChevronLeftSvgIcon.js +1 -1
  92. package/build/js/private/ui/atoms/ChevronRightSvgIcon.js +1 -1
  93. package/build/js/private/ui/atoms/ChevronUpSvgIcon.js +1 -1
  94. package/build/js/private/ui/atoms/CrossSvgIcon.js +1 -1
  95. package/build/js/private/ui/atoms/Dot5xSvgIcon.js +1 -1
  96. package/build/js/private/ui/atoms/ExclamationMarkSvgIcon.js +1 -1
  97. package/build/js/private/ui/atoms/GlassSvgIcon.js +1 -1
  98. package/build/js/private/ui/atoms/HandLensCheckSvgIcon.js +1 -1
  99. package/build/js/private/ui/atoms/KeyboardSvgIcon.js +1 -1
  100. package/build/js/private/ui/atoms/LowStockSvgIcon.js +1 -1
  101. package/build/js/private/ui/atoms/OnexSvgIcon.js +1 -1
  102. package/build/js/private/ui/atoms/PrinterSvgIcon.js +1 -1
  103. package/build/js/private/ui/atoms/ProgressBar.js +1 -1
  104. package/build/js/private/ui/atoms/QuestionMarkSvgIcon.js +1 -1
  105. package/build/js/private/ui/atoms/RestartSvgIcon.js +1 -1
  106. package/build/js/private/ui/atoms/RoundedCheckSvgIcon.js +1 -1
  107. package/build/js/private/ui/atoms/RoundedCrossSvgIcon.js +1 -1
  108. package/build/js/private/ui/atoms/RoundedExclamationMarkSvgIcon.js +1 -1
  109. package/build/js/private/ui/atoms/ShutterButton.d.ts +7 -4
  110. package/build/js/private/ui/atoms/ShutterButton.js +6 -22
  111. package/build/js/private/ui/atoms/StarFilledSvgIcon.js +1 -1
  112. package/build/js/private/ui/atoms/StarHalfFilledSvgIcon.js +1 -1
  113. package/build/js/private/ui/atoms/StarOutlinedSvgIcon.js +1 -1
  114. package/build/js/private/ui/atoms/SvgIcon.js +1 -1
  115. package/build/js/private/ui/atoms/ToPickSvgIcon.js +1 -1
  116. package/build/js/private/ui/atoms/Toast.d.ts +9 -3
  117. package/build/js/private/ui/atoms/Toast.js +1 -1
  118. package/build/js/private/ui/atoms/TwoxSvgIcon.js +1 -1
  119. package/build/js/private/ui/atoms/WrongItemSvgIcon.js +1 -1
  120. package/build/js/private/ui/molecules/HintPresenter.d.ts +6 -43
  121. package/build/js/private/ui/molecules/HintPresenter.js +1 -1
  122. package/build/js/private/ui/molecules/LoadingOverlay.js +1 -1
  123. package/build/js/private/utils/index.js +1 -1
  124. package/build/js/private/utils/quadrilateralUtils.d.ts +2 -1
  125. package/build/js/private/utils/quadrilateralUtils.js +1 -1
  126. package/build/js/private/utils/replaceImagesInViewUtils.d.ts +17 -0
  127. package/build/js/sdk.d.ts +6 -3
  128. package/build/js/worker/WorkerMain.d.ts +4 -1
  129. package/build/js/worker/WorkerMain.js +1 -1
  130. package/build/js/worker/coreCapture.inlineWorker.d.ts +4 -1
  131. package/build/js/worker/coreCapture.inlineWorker.js +1 -1
  132. package/build/js/worker/dataCaptureEngine.d.ts +5 -2
  133. package/build/js/worker/dataCaptureEngine.js +1 -1
  134. package/build/js/worker/dataCaptureLoader.d.ts +5 -2
  135. package/build/js/worker/dataCaptureWorkerRelated.d.ts +4 -1
  136. package/build/js/worker/index.d.ts +4 -1
  137. package/build/js/worker/index.js +1 -1
  138. package/package.json +11 -12
  139. package/build/js/chunks/chunk-NBFWXBYG.js +0 -1
  140. package/build/js/chunks/chunk-OWJGO7ET.js +0 -1
  141. package/build/js/chunks/chunk-P3OK36HL.js +0 -21
  142. package/build/js/chunks/chunk-Q2O4RKVG.js +0 -1
  143. package/build/js/chunks/chunk-QYACFUV3.js +0 -5
  144. package/build/js/chunks/chunk-S2VISKOY.js +0 -1
  145. package/build/js/chunks/chunk-TUQETICB.js +0 -11
@@ -1 +0,0 @@
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,21 +0,0 @@
1
- import {b as b$3}from'./chunk-QYACFUV3.js';import {a as a$9}from'./chunk-OH5WXZBN.js';import {a as a$d}from'./chunk-46WJFV3I.js';import {d as d$2,c,b as b$4}from'./chunk-NBFWXBYG.js';import {a as a$f}from'./chunk-7CQVGY6N.js';import {a as a$2}from'./chunk-N5YZEC56.js';import {a as a$b}from'./chunk-FSWALUUO.js';import {b,a as a$3}from'./chunk-5S537AFM.js';import {a as a$g}from'./chunk-DMOXDUF6.js';import {b as b$1}from'./chunk-457L5N2F.js';import {a as a$a}from'./chunk-JVZYXEYO.js';import {a as a$c}from'./chunk-3BBG6EVS.js';import {a as a$8}from'./chunk-KYNYQBNF.js';import {a as a$7}from'./chunk-ZKROZLQ4.js';import {a as a$5}from'./chunk-5FUZURCZ.js';import {a as a$1}from'./chunk-VJB527QZ.js';import {a as a$6}from'./chunk-NMX4VHW2.js';import {a}from'./chunk-7XQ3GHYH.js';import {d as d$1}from'./chunk-QQXPUJCE.js';import {a as a$e}from'./chunk-XR65N6EG.js';import {d}from'./chunk-QM37NXPY.js';import {a as a$4,b as b$2,i,f}from'./chunk-77BBIAZE.js';import {a as a$h}from'./chunk-WUHKODFA.js';var y="core.camera.recovery",B=class q{constructor(){this.focusGesture=d.DataCaptureView.focusGesture;this.zoomGesture=d.DataCaptureView.zoomGesture;this._scanAreaMargins=d.DataCaptureView.scanAreaMargins;this._pointOfInterest=d.DataCaptureView.pointOfInterest;this._logoStyle=d.DataCaptureView.logoStyle;this._logoAnchor=d.DataCaptureView.logoAnchor;this._logoOffset=d.DataCaptureView.logoOffset;this._context=null;this.overlays=new Set;this.controls=[];this.controlWidgets=new WeakMap;this.frozenFrameCanvas=document.createElement("canvas");this.listeners=[];this.isVideoElementDetached=false;this.orientation="portrait";this.hiddenProperties={stopVideoTracksOnVisibilityChange:true,freezeFrameWhenStoppingFrameSource:true};this.orientationObserver=new b;this.onOrientationChangeListener=this.onOrientationChange.bind(this);this.onHintPresenterUpdateHandler=this.onHintPresenterUpdate.bind(this);this.onBeforeShowToastsHandler=this.onBeforeShowToasts.bind(this);this.onWorkerMessageHandler=this.onWorkerMessage.bind(this);this.visibilityListener=this.onVisibilityChange.bind(this),this.cameraRecoveryListener=this.cameraRecovery.bind(this),a.getInstance().updateIfMissing(a$1);}get scanAreaMargins(){return this._scanAreaMargins}set scanAreaMargins(e){var t;this._scanAreaMargins=e,(t=this.privateContext)==null||t.update();}get pointOfInterest(){return this._pointOfInterest}set pointOfInterest(e){var t;this._pointOfInterest=e,(t=this.privateContext)==null||t.update();}get logoStyle(){return this._logoStyle}set logoStyle(e){var t;this._logoStyle=e,(t=this.privateContext)==null||t.update();}get logoAnchor(){return this._logoAnchor}set logoAnchor(e){var t;this._logoAnchor=e,(t=this.privateContext)==null||t.update();}get logoOffset(){return this._logoOffset}set logoOffset(e){var t;this._logoOffset=e,(t=this.privateContext)==null||t.update();}get cameraRecoveryText(){return a.getInstance().get(y)}get width(){var e,t;return Math.round((t=(e=this.htmlElementState)==null?void 0:e.width)!=null?t:0)}get height(){var e,t;return Math.round((t=(e=this.htmlElementState)==null?void 0:e.height)!=null?t:0)}get canvasDrawer(){return !this._canvasDrawer&&this.canvasElement!=null&&(this._canvasDrawer=new b$1(this.canvasElement),this._canvasDrawer.startObservingCanvasResize()),this._canvasDrawer}get privateContext(){return this._context}static async forContext(e){let t=new q;return await t.setContext(e),t}showProgressBar(){var e;(e=this.loadingOverlay)==null||e.show();}hideProgressBar(){var e;(e=this.loadingOverlay)==null||e.hide();}setProgressBarPercentage(e){this.loadingOverlay&&(this.loadingOverlay.progress=e);}setProgressBarMessage(e){this.loadingOverlay&&(this.loadingOverlay.message=e);}getContext(){return this._context}async setContext(e){var t,i,n;if(this._context=e,e){if(this.overlays.size>0&&((t=this.privateContext)==null?void 0:t.modes.size)===0)throw new Error(["Cannot assign this view to this context. This view has overlays but the context does not have any mode attached matching these overlays.","Remove the overlays first before attaching the view to the context, or add the corresponding mode to the context before attaching this view."].join(" "));await e.setView(this),(i=this.privateContext)==null||i.subscribeToWorkerMessages(this.onWorkerMessageHandler),(n=this._context)!=null&&n.frameSource&&await this.onFrameSourceChange(this._context.frameSource);}}connectToElement(e){var t,i,n;this.orientationObserver.register(),this.setupHtmlElement(e),(t=this.canvasDrawer)==null||t.startObservingCanvasResize(),this.htmlElementDidChange(),a$2.add(this),this.orientation=this.orientationObserver.orientation.value,this.orientationObserver.addEventListener(a$3,this.onOrientationChangeListener),(i=this.hintPresenter)==null||i.addEventListener("hintpresenterupdate",this.onHintPresenterUpdateHandler),(n=this.hintPresenter)==null||n.addEventListener("willshow",this.onBeforeShowToastsHandler),this.localizationSubscription=a.getInstance().subscribe(a=>{a[y]!=null&&(this.cameraRecoveryElement.textContent=a[y]);});}detachFromElement(){var e,t,i,n,a,o,l,d;(e=this.htmlElementState)==null||e.removeListeners(),this.removeStyles(),(t=this.canvasDrawer)==null||t.endObservingCanvasResize(),document.removeEventListener("visibilitychange",this.visibilityListener);for(let h of ["touchend","mousedown"])this.cameraRecoveryElement.removeEventListener(h,this.cameraRecoveryListener);(i=this.loadingOverlay)==null||i.remove(),(n=this.customLocationsView)==null||n.unmount(),this.htmlElementDidChange(),(a=this.gestureRecognizer)==null||a.removeAllListeners(),this.clearHtmlElementContent(),a$2.delete(this),this.orientationObserver.unregister(),this.orientationObserver.removeEventListener(a$3,this.onOrientationChangeListener),(o=this.hintPresenter)==null||o.removeEventListener("hintpresenterupdate",this.onHintPresenterUpdateHandler),(l=this.hintPresenter)==null||l.removeEventListener("willshow",this.onBeforeShowToastsHandler),(d=this.localizationSubscription)==null||d.cancel();}async addOverlay(e){var t;this.overlays.has(e)||(this.overlays.add(e),await((t=this.privateContext)==null?void 0:t.update([{type:"addOverlay",newValue:e}])));}async removeOverlay(e){var t;this.overlays.has(e)&&(await((t=this.privateContext)==null?void 0:t.update([{type:"removeOverlay",newValue:e}])),this.overlays.delete(e));}addListener(e){this.listeners.includes(e)||this.listeners.push(e);}removeListener(e){this.listeners.includes(e)&&this.listeners.splice(this.listeners.indexOf(e),1);}viewPointForFramePoint(e){var v,b,O,P,L,V,D,R;let t={width:(b=(v=this.htmlElementState)==null?void 0:v.width)!=null?b:0,height:(P=(O=this.htmlElementState)==null?void 0:O.height)!=null?P:0},i={width:(V=(L=this.videoElement)==null?void 0:L.videoWidth)!=null?V:0,height:(R=(D=this.videoElement)==null?void 0:D.videoHeight)!=null?R:0},n=t.width/t.height,a=i.width/i.height,o=n>a?t.width/i.width:t.height/i.height,l={x:e.x*o,y:e.y*o},d=(i.width*o-t.width)/2,h=(i.height*o-t.height)/2;return new a$4(l.x-d,l.y-h)}viewQuadrilateralForFrameQuadrilateral(e){let t=this.viewPointForFramePoint(e.topLeft),i=this.viewPointForFramePoint(e.topRight),n=this.viewPointForFramePoint(e.bottomLeft),a=this.viewPointForFramePoint(e.bottomRight);return new b$2(t,i,a,n)}addControl(e){var t;this.controls.includes(e)||(e.view=this,this.controls.push(e),this.controlsUpdated(),(t=this.privateContext)==null||t.update([{type:"addControl",newValue:e}]));}removeControl(e){var t;if(this.controls.includes(e)){e.view=null;let i=this.controls.splice(this.controls.indexOf(e),1);this.getControlWidget(i[0]).remove(true),this.controlsUpdated(),(t=this.privateContext)==null||t.update([{type:"removeControl",newValue:e}]);}}toJSONObject(){var e;return {scanAreaMargins:this.scanAreaMargins.toJSONObject(),pointOfInterest:this.pointOfInterest.toJSONObject(),logoAnchor:this.logoAnchor,logoOffset:this.logoOffset.toJSONObject(),logoHidden:(e=this.logoHidden)!=null?e:false,logoStyle:this.logoStyle,overlays:[...this.overlays].map(t=>t.toJSONObject()),controls:this.controls.map(t=>t.toJSONObject()),focusGesture:this.focusGesture?this.focusGesture.toJSONObject():null,zoomGesture:this.zoomGesture?this.zoomGesture.toJSONObject():null}}isCameraRecoveryVisible(){return !this.cameraRecoveryElement.hidden}setCameraRecoveryVisible(e){this.cameraRecoveryElement.hidden=!e;}async allowPictureInPicture(e){await d$1.instance().allowPictureInPicture(e);}viewAnchorPositionsForFrameAnchorPositions(e){let t=this.viewPointForFramePoint(e.topLeft),i=this.viewPointForFramePoint(e.topRight),n=this.viewPointForFramePoint(e.bottomLeft),a=this.viewPointForFramePoint(e.bottomRight),o=this.viewPointForFramePoint(e.centerLeft),l=this.viewPointForFramePoint(e.centerRight),d=this.viewPointForFramePoint(e.topCenter),h=this.viewPointForFramePoint(e.bottomCenter),v=this.viewPointForFramePoint(e.center);return new a$5(t,i,a,n,o,d,l,h,v)}setDidTapCustomLocationsViewListener(e){this.customLocationsView&&this.customLocationsView.listener===null&&(this.customLocationsView.listener=e);}renderCustomLocationsView(e){this.customLocationsView!=null&&(this.customLocationsView.setMirrored(d$1.instance().isMirrorImageEnabled()),Object.keys(e).includes("removedIds")?this.customLocationsView.render(e):this.customLocationsView.renderDomView(e));}removeStyles(){for(let e of document.querySelectorAll("style[scandit]"))e.remove();}onHintPresenterUpdate(e){var t;(t=this.privateContext)==null||t.workerCommand("hintPresenterV2update",{});}clearHtmlElementContent(){var e;this.htmlElement&&((e=this.canvasDrawer)==null||e.endObservingCanvasResize(),this.htmlElement.innerHTML="",this.cameraPaintboardElement=void 0,this.singleImageUploaderPaintboardElement=void 0,this.htmlElement=void 0);}setupHtmlElement(e){var o,l,d;this.createStyles(),this.htmlElement=e,b$3.register();let t=`
2
- <div class="${a$6.CONTAINER_CLASS_NAME}">
3
- <div class="${a$6.PAINTBOARDS_CONTAINER_CLASS_NAME}">
4
- <div data-js-id="loading-overlay"></div>
5
- <div class="${a$6.PAINTBOARD_CLASS_NAME}" data-js-id="camera-paintboard">
6
- <video autoplay="autoplay" playsinline="true" muted="muted" poster="${a$7}" style="opacity: 0;"></video>
7
- <img class="${a$6.FROZEN_FRAME}" data-js-id="frozen-frame" alt="frozen-frame" hidden />
8
- <canvas></canvas>
9
- <div data-js-id="${a$8.CUSTOM_VIEW_CONTAINER}"></div>
10
- <div class="${a$6.HINT_CONTAINER_CLASS_NAME}">
11
- <div class="${a$6.HINT_CLASS_NAME}" hidden></div>
12
- </div>
13
- <${b$3.tag}></${b$3.tag}>
14
- <div class="${a$6.CONTROLS_CLASS_NAME}"></div>
15
- <div class="${a$6.CAMERA_RECOVERY_CLASS_NAME}" hidden>${this.cameraRecoveryText}</div>
16
- <div class="${a$6.ERROR_CLASS_NAME}" hidden></div>
17
- </div>
18
- <div class="${a$6.PAINTBOARD_CLASS_NAME}" data-js-id="singleimage-paintboard"></div>
19
- </div>
20
- </div>
21
- `;this.htmlElement.innerHTML=t,this.hintPresenter=this.htmlElement.querySelector(b$3.tag),this.loadingOverlay&&this.loadingOverlay.remove(),this.loadingOverlay=a$9.create(),this.loadingOverlay.hide(),(o=this.htmlElement.querySelector('[data-js-id="loading-overlay"]'))==null||o.replaceWith(this.loadingOverlay),this.customLocationsView&&this.customLocationsView.unmount(),this.customLocationsView=new a$a,this.customLocationsView.mount(this.htmlElement.querySelector(`[data-js-id="${a$8.CUSTOM_VIEW_CONTAINER}"]`)),this.customLocationsView.mapViewAnchorPositionsForFramePoint=h=>this.viewAnchorPositionsForFrameAnchorPositions(h),this.containerElement=this.htmlElement.querySelector(`.${a$6.CONTAINER_CLASS_NAME}`),this.cameraPaintboardElement=this.containerElement.querySelector('[data-js-id="camera-paintboard"]'),this.singleImageUploaderPaintboardElement=this.containerElement.querySelector('[data-js-id="singleimage-paintboard"]');let i=this.cameraPaintboardElement.querySelector("canvas");this.canvasElement==null?this.canvasElement=i:i.replaceWith(this.canvasElement);let n=this.cameraPaintboardElement.querySelector('[data-js-id="frozen-frame"]');this.frozenFrame==null?this.frozenFrame=n:n.replaceWith(this.frozenFrame),this.controlsElement=this.cameraPaintboardElement.querySelector(`.${a$6.CONTROLS_CLASS_NAME}`),this.cameraRecoveryElement=this.cameraPaintboardElement.querySelector(`.${a$6.CAMERA_RECOVERY_CLASS_NAME}`),this.errorElement=this.cameraPaintboardElement.querySelector(`.${a$6.ERROR_CLASS_NAME}`),this.hintContainerElement=this.cameraPaintboardElement.querySelector(`.${a$6.HINT_CONTAINER_CLASS_NAME}`),this.hintElement=this.cameraPaintboardElement.querySelector(`.${a$6.HINT_CLASS_NAME}`);let a=this.cameraPaintboardElement.querySelector("video");this.videoElement?a.replaceWith(this.videoElement):(this.videoElement=a,this.videoPauseListener=this.handleVideoPause.bind(this),this.videoElement.addEventListener("pause",this.videoPauseListener)),this.lastFrameSourceState!=null&&((d=(l=this._context)==null?void 0:l.frameSource)==null||d.switchToDesiredState(this.lastFrameSourceState)),document.addEventListener("visibilitychange",this.visibilityListener);for(let h of ["touchend","mousedown"])this.cameraRecoveryElement.addEventListener(h,this.cameraRecoveryListener);this.htmlElementState&&this.htmlElementState.removeListeners(),this.htmlElementState=new a$b(this.htmlElement),this.htmlElementState.onStateChanged(this.htmlElementDidChange.bind(this)),this.htmlElementState.onDisconnected(this.htmlElementDisconnected.bind(this)),this.gestureRecognizer=new a$c(this.htmlElement),this.gestureRecognizer.addListener({onTap:async h=>{var v;(v=this.privateContext)==null||v.workerCommand("onTap",{point:h.toJSONObject()});}});}setupHtmlElementSingleImageUploader(e){var i;if(this.singleImageUploaderPaintboardElement==null)return;this.singleImageUploaderView&&this.singleImageUploaderView.unmount(),this.singleImageUploaderView=new a$d(e),this.singleImageUploaderView.mount(this.containerElement.querySelector('[data-js-id="singleimage-paintboard"]'));let t=(i=this._context)==null?void 0:i.frameSource;this.singleImageUploaderView.onInputCheck(n=>{t.getCurrentState()!=="starting"&&n.preventDefault();}),this.singleImageUploaderView.onBeforeFileRead(()=>{t._context&&this.singleImageUploaderView&&(this.singleImageUploaderView.canUploadFile=t._context.hasEnabledMode());}),this.singleImageUploaderView.onImageLoadError(()=>{t.currentState="starting",a$e.log(a$e.Level.Error,"Could not load image from selected file");}),this.singleImageUploaderView.onFileReaderError(n=>{var o,l;let a=n.target;t.currentState="starting",a$e.log(a$e.Level.Error,`Error while reading the file: ${(l=(o=a.error)==null?void 0:o.toString())!=null?l:""}`);}),this.singleImageUploaderView.onCaptureReady(async n=>{await t.processUploadedFileCapture(n);}),this.singleImageUploaderView.setButtonState(t.getCurrentState()==="starting"?"enabled":"disabled"),t.addView(this.singleImageUploaderView);}setupHtmlElementVisibility(e){this.cameraPaintboardElement!=null&&(this.cameraPaintboardElement.hidden=e!=="camera"),this.singleImageUploaderPaintboardElement!=null&&(this.singleImageUploaderPaintboardElement.hidden=e!=="singleImageUploader");}createStyles(){if(document.querySelector("style[scandit]")===null){let e=a$f();for(let[t,i]of Object.entries(e))i.setAttribute("scandit",`data-capture-sdk-${t}`),document.head.append(i);}}async onOrientationChange(e){var t,i;this.orientation=e.detail.value,await((i=this.privateContext)==null?void 0:i.update([{type:"viewChange",newValue:{...(t=this.htmlElementState)==null?void 0:t.toJSONObject(),orientation:this.orientation}}]));}htmlElementDidChange(){var i$1,n;if(!this.htmlElementState)return;let e=this.htmlElementState,t=e.toJSONObject();if(!a$b.areEquivalentJSONStates(this.lastHtmlElementState,t)){this.orientation=this.orientationObserver.orientation.value,(i$1=this.privateContext)==null||i$1.update([{type:"viewChange",newValue:{...e.toJSONObject(),orientation:this.orientation}}]),this.lastHtmlElementState=t,(n=this.canvasDrawer)==null||n.updateCanvasSizeAttributes(this.width,this.height),this.handleVideoDisplay(t.visible);for(let a of this.listeners)typeof a.didChangeSize=="function"&&a.didChangeSize(this,new i(t.size.width.value,t.size.height.value),this.orientation);}}async htmlElementDisconnected(){var e,t,i,n,a,o,l;this.isVideoElementDetached=false,(e=this.videoElement)==null||e.remove(),this.lastFrameSourceState=(i=(t=this._context)==null?void 0:t.frameSource)==null?void 0:i.getCurrentState(),await((a=(n=this._context)==null?void 0:n.frameSource)==null?void 0:a.switchToDesiredState("off")),await((l=this.privateContext)==null?void 0:l.update([{type:"viewChange",newValue:{...(o=this.htmlElementState)==null?void 0:o.toJSONObject(),orientation:this.orientation}}]));}handleVideoDisplay(e){this.videoElement==null||this.cameraPaintboardElement==null||(!e&&!this.isVideoElementDetached?(this.videoElement.width=0,this.videoElement.height=0,this.videoElement.style.opacity="0",this.videoElement.style.visibility="hidden",document.body.append(this.videoElement),this.isVideoElementDetached=true):e&&this.isVideoElementDetached&&(this.cameraPaintboardElement.insertAdjacentElement("afterbegin",this.videoElement),this.isVideoElementDetached=false,this.videoElement.style.removeProperty("visibility"),this.videoElement.removeAttribute("width"),this.videoElement.removeAttribute("height"),this.videoElement.style.removeProperty("opacity")));}isCanvasDrawerWithMetrics(e){return e instanceof a$g}onWorkerMessage(e){var t,i;switch(e.type){case "draw":{this.drawEngineCommands(e.payload);break}case "performanceMetricsReport":{let n=this._canvasDrawer;n!=null&&this.isCanvasDrawerWithMetrics(n)&&n.setPerformanceMetrics(e.payload);break}case "contextDidChangeStatus":{let n=a$h.fromJSON(e.payload);(t=this.loadingOverlay)==null||t.hide(),n.isValid?this.clearError():this.displayError(n);break}case "showHint":{this.displayHint(e.payload.text,e.payload.style);break}case "updateHint":{this.updateHint(e.payload.style);break}case "hideHint":{this.hideHint();break}default:{(i=this.hintPresenter)==null||i.handleMessage(e);break}}}async onBeforeShowToasts(){var t,i$1;let e=await((t=this._context)==null?void 0:t.workerCommand("getViewfinderInfo",{}));if((e==null?void 0:e.rect)!=null){if(e.rect.origin.x===0&&e.rect.origin.y===0&&e.rect.size.width===0&&e.rect.size.height===0)return;(i$1=this.hintPresenter)==null||i$1.setViewFinderRect(new f(new a$4(e.rect.origin.x,e.rect.origin.y),new i(e.rect.size.width,e.rect.size.height)));}}drawEngineCommands(e){var t;(t=this.canvasDrawer)==null||t.draw(e);}displayError(e){this.errorElement.textContent=`Error ${e.code}: ${e.message}`,this.errorElement.hidden=false;}clearError(){this.errorElement.textContent="",this.errorElement.hidden=true;}displayHint(e,t){this.hintElement.textContent=e,this.hintElement.hidden=false,this.updateHint(t);}hideHint(){this.hintElement.textContent="",this.hintElement.hidden=true;}updateHint(e){this.hintElement.style.background=e.backgroundColor,this.hintElement.style.color=e.textColor,this.hintElement.style.fontSize=e.font==="body"?"1.25rem":"1rem",this.hintElement.style.borderRadius=e.hintCornerStyle==="rounded"?"5px":"0px",e.hintHeight==="taller"&&(this.hintElement.style.paddingTop="1.25em",this.hintElement.style.paddingBottom="1.25em"),e.hintWidth==="wider"&&(this.hintElement.style.paddingLeft="1.25em",this.hintElement.style.paddingRight="1.25em"),this.updateAnchor(e);}updateAnchor(e){let t=`${e.verticalOffsetRatio*100}vh`;switch(e.anchor){case "topLeft":{this.hintContainerElement.style.placeContent="start left",this.hintElement.style.transform=`translateY(${t})`;break}case "topCenter":{this.hintContainerElement.style.placeContent="start center",this.hintElement.style.transform=`translateY(${t})`;break}case "topRight":{this.hintContainerElement.style.placeContent="start right",this.hintElement.style.transform=`translateY(${t})`;break}case "centerLeft":{this.hintContainerElement.style.placeContent="center start";break}case "center":{this.hintContainerElement.style.placeContent="center";break}case "centerRight":{this.hintContainerElement.style.placeContent="center end";break}case "bottomLeft":{this.hintContainerElement.style.placeContent="end left";break}case "bottomCenter":{this.hintContainerElement.style.placeContent="end center";break}case "bottomRight":{this.hintContainerElement.style.placeContent="end right";break}}}controlsUpdated(){var e;this.redrawControls(),(e=this.privateContext)==null||e.update();}redrawControls(){var t;let e=(t=this._context)==null?void 0:t.frameSource;for(let i of this.controls){let n=this.getControlWidget(i);e==null||e.desiredState==="off"||e.desiredState==="standby"||e.desiredState==="stopping"?n.remove():n.install();}}registerControlWidget(e,t){let i=new t(e,this.controlsElement);return this.controlWidgets.set(e,i),i}getControlWidget(e){let t=this.controlWidgets.get(e);if(t)return t;let{type:i}=e,n;switch(i){case "torch":{n=new b$4(e,this.controlsElement),this.controlWidgets.set(e,n);break}case "camera":{n=new c(e,this.controlsElement),this.controlWidgets.set(e,n);break}case "camera-fov":{n=new d$2(e,this.controlsElement),this.controlWidgets.set(e,n);break}}return n}async onFrameSourceChange(e){let t=e==null?void 0:e.type;if(this.setupHtmlElementVisibility(t),t==="camera"){let i=e==null?void 0:e.getCurrentState();i!=null&&await this.onCameraStateChanged(i);}else t==="singleImageUploader"&&this.setupHtmlElementSingleImageUploader(e.settings);}async onCameraStateChanged(e){var t;switch((t=this.cameraPaintboardElement)==null||t.classList.toggle(a$6.PAINTBOARD_CLASS_NAME_STATE_ON,e==="on"),e){case "stopping":{this.hiddenProperties.freezeFrameWhenStoppingFrameSource&&this.freezeFrame(),this.setVideoElementOpacity("0");return}case "starting":case "bootingUp":case "wakingUp":{if(!this.htmlElement){a$e.log(a$e.Level.Error,"cannot set frame source stream before connecting view to an HTML element");return}this.videoElement&&(d$1.instance().videoElement=this.videoElement,d$1.instance().gui.isCameraRecoveryVisible=this.isCameraRecoveryVisible.bind(this),d$1.instance().gui.setCameraRecoveryVisible=this.setCameraRecoveryVisible.bind(this),this.setVideoElementOpacity("0"));return}case "off":{this.setVideoElementOpacity("0"),this.redrawControls();return}case "on":{await d$1.instance().waitForCapabilities(),this.redrawControls(),this.unfreezeFrame(),this.setVideoElementOpacity("1");break}case "goingToSleep":{this.freezeFrame();break}}}setVideoElementOpacity(e){this.videoElement&&(this.videoElement.style.opacity=e),this.canvasElement&&(this.canvasElement.style.opacity=e);}onSingleImageUploaderSettingsChange(e){this.setupHtmlElementSingleImageUploader(e);}handleVideoPause(){d$1.instance().playVideo();}setHiddenProperty(e,t){this.hiddenProperties[e]=t;}async onVisibilityChange(){var t,i;let e=(t=this.videoElement)==null?void 0:t.srcObject;if(this.hiddenProperties.stopVideoTracksOnVisibilityChange&&(document.visibilityState==="hidden"&&d$1.instance().stopVideoTracks(),document.visibilityState==="visible"&&d$1.instance().activeCamera!=null&&e!=null))if(!e.active||(i=e.getVideoTracks()[0])!=null&&i.muted)try{a$e.debug('Detected visibility change ("visible") event with inactive video source, try to reinitialize camera'),await d$1.instance().reinitializeCamera();}catch(n){}else a$e.debug('Detected visibility change ("visible") event with active video source, replay video'),d$1.instance().playVideo();}async cameraRecovery(e){e.preventDefault(),d$1.instance().activeCamera=d$1.instance().selectedCamera,await d$1.instance().reinitializeCamera();}freezeFrame(){var i;if(!this.frozenFrame)return;let e=d$1.instance().getCurrentFrame();if(!e)return;let t=new ImageData(e.data,e.width,e.height);this.frozenFrameCanvas.width=t.width,this.frozenFrameCanvas.height=t.height,this.frozenFrame.width=t.width,this.frozenFrame.height=t.height,(i=this.frozenFrameCanvas.getContext("2d"))==null||i.putImageData(t,0,0),this.frozenFrame.src=this.frozenFrameCanvas.toDataURL("image/jpeg",.4),this.frozenFrame.classList.toggle(a$6.MIRRORED_CLASS_NAME,d$1.instance().isMirrorImageEnabled()),this.frozenFrame.hidden=false;}unfreezeFrame(){this.frozenFrame&&(this.frozenFrame.src="",this.frozenFrame.hidden=true);}};export{B as a};
@@ -1 +0,0 @@
1
- var e;(o=>{function i(){let r="7.4.1";return r}o.sdkVersion=i;})(e||(e={}));export{e as a};
@@ -1,5 +0,0 @@
1
- import {b as b$1}from'./chunk-TUQETICB.js';import {a as a$7}from'./chunk-ZF7CDMAC.js';import {b,a as a$6}from'./chunk-5S537AFM.js';import {a as a$3}from'./chunk-MU6SADSF.js';import {a as a$1}from'./chunk-EV4OEANA.js';import {a as a$5}from'./chunk-3A4KLILV.js';import {a as a$4}from'./chunk-LSZZVJ6B.js';import {a as a$2}from'./chunk-R6E4CT22.js';var o="--view-finder-top",a="--view-finder-bottom",l="--hint-anchor-offset",w="--max-width-fraction",$="--horizontal-margin",c="--max-width-ratio-adjust",E=(d=>(d.Update="hintpresenterupdate",d))(E||{});function s(p,d=100){return typeof p=="string"?p.slice(0,d):""}var n=class n extends a$1{constructor(){super();this.onDidToastHideHandler=this.onDidToastHide.bind(this);this.orientationObserver=new b;this.onOrientationChangeHandler=a$2(this.onOrientationChange.bind(this),200);let t=this.attachShadow({mode:"open"});t.innerHTML=a$3`
2
- <div id="root">
3
- <slot></slot>
4
- </div>
5
- `,t.append(n.createStyleElement().cloneNode(true)),this.root=t.querySelector("#root");}static createStyleElement(){return a$4`:host{pointer-events:none}:host #root{inset:0;position:absolute;width:100%;${o}:0;${a}:0;${c}:1;z-index:1}::slotted(${b$1.tag}){left:50%;max-width:calc(var(${w})*var(${c})*100% - var(${$}));position:absolute;transform:translate3d(-50%,0,0);width:100%}::slotted(${b$1.tag}.${"aboveViewFinder"}){transform:translate3d(-50%,calc(-100% + var(${o}) - var(${l})),0)}::slotted(${b$1.tag}.${"belowViewFinder"}){transform:translate3d(-50%,calc(var(${a}) + var(${l})),0)}::slotted(${b$1.tag}.${"top"}){top:calc(var(${l}))}::slotted(${b$1.tag}.fitToText){width:fit-content}`}static register(){a$5({[n.tag]:n});}static create(){return document.createElement(n.tag)}connectedCallback(){this.orientationObserver.addEventListener(a$6,this.onOrientationChangeHandler),this.orientationObserver.register(),this.addEventListener("didhide",this.onDidToastHideHandler),this._viewFinderRect==null&&(this.root.style.setProperty(o,`${this.root.clientHeight/2}px`),this.root.style.setProperty(a,`${this.root.clientHeight/2+1}px`));}disconnectedCallback(){this.removeEventListener("didhide",this.onDidToastHideHandler);}setViewFinderRect(t){if(t===null){this.root.style.removeProperty(o),this.root.style.removeProperty(a);return}this._viewFinderRect=t;let{origin:{y:i},size:{height:e}}=this._viewFinderRect;this.root.style.setProperty(o,`${i}px`),this.root.style.setProperty(a,`${i+e}px`);}handleMessage(t){let{type:i}=t;switch(i){case "showToast":{this.showToast(t.payload);break}case "hideToast":{this.hideToast(t.payload);break}case "showGuidance":{this.showGuidance(t.payload);break}case "hideGuidance":{this.hideGuidance(t.payload);break}case "startUpdateTimer":{this.startUpdateTimer(t.payload.duration.value);break}case "stopUpdateTimer":{this.stopUpdateTimer();break}}}onDidToastHide(t){t.stopPropagation(),t.detail.target.remove();}async showToast(t){let i=this.idFromHint(t),e=this.querySelector(`#${i}`);if(e||(e=b$1.create(),e.id=i,this.append(e)),e.textContent=t.text,e.hintStyle=t.hintStyle,e.className="",e.style.setProperty(l,`${e.hintStyle.hintAnchorOffset/16}rem`),e.style.setProperty(w,t.hintStyle.maxWidthFraction.toString()),e.style.setProperty($,`${t.hintStyle.horizontalMargin/16}rem`),e.classList.add(t.hintStyle.hintAnchor),e.classList.toggle("fitToText",t.hintStyle.fitToText),t.tag==="MoveCloserGuidance"){let v=a$7.create();v.setAttribute("slot","first-child"),e.append(v),e.setAttribute("direction","column");}return e.show()}async hideToast(t){let i=this.querySelector(`#${this.idFromHint(t)}`);if(i!=null)return i.hide()}async showGuidance(t){return this.showToast(t)}async hideGuidance(t){return this.hideToast(t)}startUpdateTimer(t){this.intervalId=setInterval(()=>{this.dispatchEvent(new CustomEvent("hintpresenterupdate"));},t);}stopUpdateTimer(){clearInterval(this.intervalId);}idFromHint(t){var i;return btoa([s(t.hintStyle.textColor),s(t.hintStyle.backgroundColor),s(t.hintStyle.hintAnchor),s((i=t.tag)!=null?i:""),s(t.hintStyle.textAlignment)].join("-")).split("+").join("-").split("/").join("_").replace(/=+$/,"")}onOrientationChange(t){let i=1;i=t.detail.value==="landscapeLeft"||t.detail.value==="landscapeRight"?window.innerHeight/window.innerWidth:1,this.root.style.setProperty(c,i.toString()),this._viewFinderRect==null&&(this.root.style.setProperty(o,`${this.root.clientHeight/2}px`),this.root.style.setProperty(a,`${this.root.clientHeight/2+1}px`));}};n.tag="scandit-hints";var h=n;h.register();export{E as a,h as b};
@@ -1 +0,0 @@
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};
@@ -1,11 +0,0 @@
1
- import {a as a$3}from'./chunk-RWDRTV7B.js';import {a as a$2}from'./chunk-I2LMKSHH.js';import {e as e$1}from'./chunk-IVDD7PCI.js';import {a as a$4}from'./chunk-MU6SADSF.js';import {a as a$1}from'./chunk-EV4OEANA.js';import {a as a$6}from'./chunk-3A4KLILV.js';import {a as a$5}from'./chunk-LSZZVJ6B.js';var b=(i=>(i.DidShow="didshow",i.DidHide="didhide",i.WillShow="willshow",i))(b||{}),o="--text-size",s="--text-color",n="--text-alignment",a="--text-weight",r="--line-height",l="--background-color",c="--corner-radius",h="--max-lines",x="ease-in-out",e=class e extends a$1{constructor(){super();this.toast=null;this._hintStyle=null;this.currentAnimation=null;this.animationDuration=250;let t=this.attachShadow({mode:"open"});this._exclamationIcon=a$2.create(),this._checkIcon=a$3.create(),this._exclamationIcon.size=24,this._checkIcon.size=24,t.innerHTML=a$4`
2
- <div class="toast">
3
- <slot name="first-child"></slot>
4
- <div class="left">
5
- <slot name="icon"></slot>
6
- </div>
7
- <p class="middle">
8
- <slot></slot>
9
- </p>
10
- </div>
11
- `,t.append(e.createStyleElement().cloneNode(true)),this.toast=t.querySelector(".toast");}static createStyleElement(){return a$5`:host{display:inline-block;font-family:SF Pro Display,sans-serif}:host([hidden]){display:none}.toast{${o}:1rem;${s}:#000;${a}:400;${n}:${"center"};${r}:1.5rem;${l}:#fff;${c}:.25rem;${h}:2;align-items:flex-start;background-color:var(${l});border-radius:var(${c});color:var(${s});display:flex;flex-direction:row;font-size:var(${o});font-weight:var(${a});gap:.625rem;justify-content:var(${n});line-height:var(${r});padding:1rem}:host([direction=column]) .toast{align-items:center;flex-direction:column}:host([direction=row]) .toast{align-items:center;flex-direction:row}.toast .left{align-self:flex-start;display:flex}.toast.icon-${"none"} .left{display:none}.toast p.middle{display:inline-block;display:-webkit-box;margin:0;padding:0;text-align:var(${n});-webkit-line-clamp:var(${h});-webkit-box-orient:vertical;align-self:center;overflow:hidden;text-shadow:0 1px 2px #${e$1.withAlpha(.3).toJSON()}}p.middle{text-align:var(${n})}`}get hintStyle(){return this._hintStyle}set hintStyle(t){this._hintStyle=t,this.render();}get showAnimation(){return new Animation(new KeyframeEffect(this,[{opacity:0},{opacity:1}],{duration:this.animationDuration,fill:"both",easing:x}))}get hideAnimation(){return new Animation(new KeyframeEffect(this,[{opacity:1},{opacity:0}],{duration:this.animationDuration,fill:"both",easing:x}))}static create(){return document.createElement(e.tag)}static register(){a$6({[e.tag]:e});}async show(){return this.toggle(true)}async hide(){return this.toggle(false)}connectedCallback(){this.render();}async toggle(t){var i,m;if(this.currentAnimation==null){this.animationDuration=(m=(i=this.hintStyle)==null?void 0:i.isAnimatedToView)==null||m?250:0,this.currentAnimation=t?this.showAnimation:this.hideAnimation,t&&this.dispatchEvent(new CustomEvent("willshow",{bubbles:true})),this.currentAnimation.play();try{await this.currentAnimation.finished,this.dispatchEvent(new CustomEvent(t?"didshow":"didhide",{bubbles:true,detail:{target:this}}));}catch(E){}finally{this.currentAnimation=null;}}}render(){var t;!this.toast||!this.hintStyle||(this.toast.className="toast",this.toast.style.setProperty(o,`${this.hintStyle.textSize}px`),this.toast.style.setProperty(s,`#${this.hintStyle.textColor}`),this.toast.style.setProperty(a,this.hintStyle.textWeight.toString()),this.toast.style.setProperty(n,this.hintStyle.textAlignment),this.toast.style.setProperty(r,`${this.hintStyle.lineHeight/14}`),this.toast.style.setProperty(l,`#${this.hintStyle.backgroundColor}`),this.toast.style.setProperty(c,`${this.hintStyle.cornerRadius/10}rem`),this.toast.style.setProperty(h,this.hintStyle.maxLines.toString()),this.toast.classList.toggle("icon-none",this.hintStyle.hintIcon==="none"),this.hintStyle.hintIcon==="check"?(this._checkIcon.setAttribute("slot","icon"),this.append(this._checkIcon)):this.hintStyle.hintIcon==="exclamationMark"&&(this._exclamationIcon.setAttribute("slot","icon"),this.append(this._exclamationIcon)),(t=this.querySelector("[slot=icon]"))==null||t.setAttribute("fill",`#${this.hintStyle.iconColor}`));}};e.tag="scandit-toast-hint";var d=e;d.register();export{b as a,d as b};