@scandit/web-datacapture-barcode 8.6.0-beta.1 → 8.6.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 (93) hide show
  1. package/build/js/{BarcodeArInfoAnnotationBodyComponent-BXOaa1oT.d.ts → BarcodeArInfoAnnotationBodyComponent-BGaYDIeF.d.ts} +3 -1
  2. package/build/js/{BarcodeArMode-D1D82tXQ.d.ts → BarcodeArMode-DNYeJc-r.d.ts} +1 -1
  3. package/build/js/BarcodeCapture.d.ts +1 -1
  4. package/build/js/{BarcodeCaptureSettings-Cjf__Ral.d.ts → BarcodeCaptureSettings-DcE4bdDZ.d.ts} +5 -1
  5. package/build/js/BarcodeCaptureSettings.d.ts +1 -1
  6. package/build/js/BarcodeCaptureSettings.js +1 -1
  7. package/build/js/BarcodeCaptureWorkerManager-Du3qKmee.js +1 -0
  8. package/build/js/{SparkScan-DJSLIr1F.d.ts → SparkScan-nhve8-Am.d.ts} +1 -1
  9. package/build/js/{SparkScanSettings-C6heTRHy.d.ts → SparkScanSettings-CtptH4fx.d.ts} +10 -3
  10. package/build/js/{SparkScanView-Ca5H_6lT.d.ts → SparkScanView-r3hp5Y4N.d.ts} +2 -1
  11. package/build/js/{SparkScanViewMiniPreview-CXYokFio.d.ts → SparkScanViewMiniPreview-BhW0WBwD.d.ts} +3 -0
  12. package/build/js/{SparkScanViewPresenter-iBLQ63pl.d.ts → SparkScanViewPresenter-4zc-flTz.d.ts} +2 -2
  13. package/build/js/SparkScanViewPresenter-BZe3-fs5.js +1 -0
  14. package/build/js/{SparkScanViewTriggerButton-0C1PbogB.d.ts → SparkScanViewTriggerButton-BcqKB5he.d.ts} +1 -0
  15. package/build/js/ar/BarcodeArView.d.ts +1 -1
  16. package/build/js/ar/BarcodeArView.js +1 -1
  17. package/build/js/ar/ui/atoms/BarcodeArInfoAnnotationBodyComponent.d.ts +2 -2
  18. package/build/js/ar/ui/atoms/BarcodeArInfoAnnotationBodyComponent.js +1 -1
  19. package/build/js/ar/ui/atoms/private/BarcodeArInfoAnnotationHeaderFooterUtils.js +1 -1
  20. package/build/js/ar/ui/atoms/private/BarcodeStatusIconContainer.d.ts +3 -0
  21. package/build/js/ar/ui/atoms/private/BarcodeStatusIconContainer.js +1 -1
  22. package/build/js/ar/ui/atoms/private/CssArrows.js +1 -1
  23. package/build/js/ar/ui/molecules/private/CameraSwitchButton.js +1 -1
  24. package/build/js/ar/ui/organisms/BarcodeArInfoAnnotation.d.ts +1 -1
  25. package/build/js/ar/ui/organisms/BarcodeArInfoAnnotation.js +1 -1
  26. package/build/js/ar/ui/organisms/BarcodeArPopoverAnnotation.d.ts +5 -2
  27. package/build/js/ar/ui/organisms/BarcodeArPopoverAnnotation.js +1 -1
  28. package/build/js/ar/ui/organisms/BarcodeArPopoverAnnotationButton.js +1 -1
  29. package/build/js/ar/ui/organisms/BarcodeArStatusIconAnnotation.d.ts +2 -1
  30. package/build/js/ar/ui/organisms/BarcodeArStatusIconAnnotation.js +1 -1
  31. package/build/js/ar/ui/organisms/private/annotationTriggerBehavior.d.ts +7 -0
  32. package/build/js/ar/ui/organisms/private/annotationTriggerBehavior.js +1 -0
  33. package/build/js/ar/ui/private/slots.d.ts +8 -0
  34. package/build/js/ar/ui/private/slots.js +1 -0
  35. package/build/js/{dataCaptureWorkerRelated-CLcrOCqV.d.ts → dataCaptureWorkerRelated-BX9zd72O.d.ts} +1 -1
  36. package/build/js/defaults/DefaultsBarcodeFind.js +1 -1
  37. package/build/js/find/BarcodeFindView.js +1 -1
  38. package/build/js/{index-BQubBIYz.d.ts → index-B35SSKej.d.ts} +4 -4
  39. package/build/js/{index-CJ6S6C6z.d.ts → index-B8as6wQU.d.ts} +3 -3
  40. package/build/js/index.d.ts +7 -7
  41. package/build/js/index.js +1 -1
  42. package/build/js/moduleLoader.js +1 -1
  43. package/build/js/private/smartScanIntentionHelper.d.ts +2 -2
  44. package/build/js/spark/SparkScan.d.ts +1 -1
  45. package/build/js/spark/SparkScan.js +1 -1
  46. package/build/js/spark/SparkScanOverlay.d.ts +1 -1
  47. package/build/js/spark/SparkScanSettings.d.ts +1 -1
  48. package/build/js/spark/SparkScanSettings.js +1 -1
  49. package/build/js/spark/index.d.ts +4 -4
  50. package/build/js/spark/ui/SparkScanOverlayManager.d.ts +2 -2
  51. package/build/js/spark/ui/SparkScanOverlayManager.js +1 -1
  52. package/build/js/spark/ui/SparkScanView.d.ts +1 -1
  53. package/build/js/spark/ui/SparkScanView.js +1 -1
  54. package/build/js/spark/ui/SparkScanViewMiniPreview.d.ts +1 -1
  55. package/build/js/spark/ui/SparkScanViewMiniPreview.js +1 -1
  56. package/build/js/spark/ui/SparkScanViewPresenter.d.ts +1 -1
  57. package/build/js/spark/ui/SparkScanViewPresenter.js +1 -1
  58. package/build/js/spark/ui/SparkScanViewTriggerButton.d.ts +1 -1
  59. package/build/js/spark/ui/SparkScanViewTriggerButton.js +1 -1
  60. package/build/js/spark/ui/SparkScanViewUiListener.d.ts +1 -1
  61. package/build/js/spark/ui/controllers/LongPressController.js +1 -1
  62. package/build/js/spark/ui/index.d.ts +5 -5
  63. package/build/js/spark/ui/index.js +1 -1
  64. package/build/js/umd/index.js +1 -1
  65. package/build/js/worker/BarcodeArMode.d.ts +1 -1
  66. package/build/js/worker/BarcodeBatchMode.d.ts +1 -1
  67. package/build/js/worker/BarcodeCaptureMode.d.ts +1 -1
  68. package/build/js/worker/BarcodeCaptureWorkerManager.d.ts +1 -1
  69. package/build/js/worker/BarcodeCaptureWorkerManager.js +1 -1
  70. package/build/js/worker/BarcodeFindMode.d.ts +1 -1
  71. package/build/js/worker/SparkScanMode.d.ts +1 -1
  72. package/build/js/worker/WorkerMain.d.ts +2 -2
  73. package/build/js/worker/dataCaptureEngine.d.ts +1 -1
  74. package/build/js/worker/dataCaptureEngine.js +1 -1
  75. package/build/js/worker/dataCaptureWorkerRelated.d.ts +1 -1
  76. package/build/js/worker/index.d.ts +1 -1
  77. package/package.json +2 -2
  78. package/sdc-lib/barcode-worker-8.6.1.js +6 -0
  79. package/sdc-lib/resources/models/id_outline_localization_model_kpts.e8f897f3d185.model +0 -0
  80. package/sdc-lib/resources/models/via_id_template_database.2729cd6f48dd.model +0 -0
  81. package/sdc-lib/scandit-datacapture-sdk-barcode-pthreads.js +1 -1
  82. package/sdc-lib/scandit-datacapture-sdk-barcode-pthreads.wasm +0 -0
  83. package/sdc-lib/scandit-datacapture-sdk-barcode-simd-pthreads.js +1 -1
  84. package/sdc-lib/scandit-datacapture-sdk-barcode-simd-pthreads.wasm +0 -0
  85. package/sdc-lib/scandit-datacapture-sdk-barcode-simd.js +1 -1
  86. package/sdc-lib/scandit-datacapture-sdk-barcode-simd.wasm +0 -0
  87. package/sdc-lib/scandit-datacapture-sdk-barcode.js +1 -1
  88. package/sdc-lib/scandit-datacapture-sdk-barcode.wasm +0 -0
  89. package/build/js/BarcodeCaptureWorkerManager-9BBiSAdI.js +0 -1
  90. package/build/js/SparkScanViewPresenter-CxLG_H-K.js +0 -1
  91. package/sdc-lib/barcode-worker-8.6.0-beta.1.js +0 -6
  92. package/sdc-lib/resources/models/id_outline_localization_model_kpts.376104335628.model +0 -0
  93. package/sdc-lib/resources/models/via_id_template_database.948ef137372d.model +0 -0
@@ -1 +0,0 @@
1
- import{DataCaptureLoader as e}from"@scandit/web-datacapture-core";var t=`barcode-worker-8.6.0-beta.1.js`;function n(e){try{var n=e.endsWith(`/`)?e:e+`/`;return new URL(t,n).href}catch(n){var r=n instanceof Error?n.message:String(n);throw Error(`Invalid worker URL: `+e+`/`+t+` (`+r+`)`)}}function r(e){try{return new URL(e).origin===location.origin}catch(n){var t=n instanceof Error?n.message:String(n);return console.warn(`Could not determine origin for worker URL "`+e+`": `+t+`. Defaulting to cross-origin path.`),!1}}function i(e,t){/javascript|ecmascript/i.test(e.type)||(e=new Blob([e],{type:`application/javascript`}));var n=URL.createObjectURL(e),r=new Worker(n,{name:t});return setTimeout(function(){URL.revokeObjectURL(n)},0),r}async function a(e){if(!e||!e.libraryLocation)throw Error(`ExternalWorker requires options.libraryLocation`);var t=n(e.libraryLocation);try{var a=await fetch(t,r(t)?{}:{mode:`cors`});if(!a.ok)throw Error(`Failed to load worker script: `+t+` (status `+a.status+`)`);var o=await a.blob();return r(t)?new Worker(t,{name:e.name}):i(o,e.name)}catch(e){throw e instanceof Error&&e.message.startsWith(`Failed to load worker script:`)?e:Error(`Failed to load worker script: `+t+` (`+(e instanceof Error?e.message:e)+`)`)}}var o=class t extends e{constructor(...e){super(...e),this._name=`BarcodeCapture`}get dataCaptureWorker(){if(!this._dataCaptureWorker)throw Error(`Worker not initialized. Use BarcodeCaptureWorkerManager.create() to instantiate.`);return this._dataCaptureWorker}get name(){return this._name}async createDataCaptureWorker(){return await a({name:this.name,libraryLocation:this.libraryLocation})}static async create(e){let n=new t(e);return n._dataCaptureWorker=await n.createDataCaptureWorker(),n.addWorkerMessageListener(),await n.workerCommand(`setLogLevel`,{level:n.logLevel}),await n.load(),n}async workerCommand(e,t,n){return new Promise((r,i)=>{let a=this.workerCommandId++;this.workerTasks.set(a,{resolve:r,reject:i,command:e});let o={...t,command:e,id:a};this.dataCaptureWorker.postMessage(o,n)})}};export{o as t};
@@ -1 +0,0 @@
1
- import"./SelectionMode.js";import"./spark/ui/SparkScanMiniPreviewSize.js";import{defaultSparkScan as e}from"./defaults/DefaultsSparkScan.js";import"./spark/SparkScanPreviewBehavior.js";import"./spark/SparkScanScanningBehavior.js";import{SparkScanScanningModeDefault as t,SparkScanScanningModeTarget as n}from"./spark/SparkScanScanningMode.js";import{SparkScanAnalyticsManager as r}from"./spark/SparkScanAnalyticsManager.js";import{SparkScanBarcodeErrorFeedback as i,SparkScanBarcodeFeedback as a,SparkScanBarcodeSuccessFeedback as o}from"./spark/SparkScanBarcodeFeedback.js";import"./spark/ui/constants/constants.js";import{SparkScanCameraManager as s}from"./spark/ui/SparkScanCameraManager.js";import"./spark/ui/SparkScanViewState.js";import{SparkScanOverlayManager as c}from"./spark/ui/SparkScanOverlayManager.js";import{SparkScanTimeoutManager as l}from"./spark/ui/SparkScanTimeoutManager.js";import{SparkScanViewFeedbackManager as u}from"./spark/ui/SparkScanViewFeedbackManager.js";import{SparkScanViewPreferenceManager as d}from"./spark/ui/SparkScanViewPreferenceManager.js";import{SparkScanViewStateManager as f}from"./spark/ui/SparkScanViewStateManager.js";import{Anchor as p,Color as m,DataCaptureView as h,Logger as g,LogoStyle as _,NumberWithUnit as v,RadiusLocationSelection as y,TorchState as b}from"@scandit/web-datacapture-core";import{SafeStorage as x}from"@scandit/web-datacapture-core/build/js/private/utils/safeStorage.js";function S(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}function C(e,t,n){let r=n.value;return typeof r==`function`?r.constructor.name!==`AsyncFunction`&&r.constructor!==(async()=>{}).constructor?(g.warn(`@afterPrepareScanning applied to non-async method: ${t}`),n):(n.value=function(...e){return this._preparationPromise?this._preparationPromise.then(()=>r.apply(this,e)):Promise.reject(Error(`prepare should be called before calling ${t} method`))},n):(g.warn(`@afterPrepareScanning applied to non-function: ${t}`),n)}var w=class g{get camera(){return this.cameraManager.camera}constructor(e,t){this._context=null,this._sparkScan=null,this._preparationPromise=null,this._stopScanningPromise=null,this._dataCaptureView=null,this.preferenceManager=new d(x.getInstanceFor(`localStorage`)),this.defaultSuccessBrush=a.defaultSuccessBrush(),this.defaultErrorBrush=a.defaultErrorBrush(),this.sparkScanView=e,this.cameraManager=new s,this.setSparkScanViewSettings(t)}set context(e){this._context!==e&&(this._preparationPromise=null,this._context=e,e&&(this.analyticsManager=r.forContext(e)))}get context(){return this._context}set sparkScan(e){this._sparkScan!==e&&(this._preparationPromise=null,this._sparkScan=e)}get sparkScan(){return this._sparkScan}get sparkScan$(){if(!this._sparkScan)throw Error(`SparkScan mode is required to be set before calling this method`);return this._sparkScan}get context$(){if(!this._context)throw Error(`Context is required to be set before calling this method`);return this._context}setSparkScanViewSettings(e){this.sparkScanViewSettings=e,this.overlayManager?this.overlayManager.setViewSettings(this.sparkScanViewSettings):this.overlayManager=new c(this.sparkScanViewSettings),this.stateManager?this.stateManager.setViewSettings(this.sparkScanViewSettings):this.stateManager=new f(this.sparkScanViewSettings,this.preferenceManager),this.feedbackManager=u.withDefaults(this.sparkScanViewSettings.soundEnabled,this.sparkScanViewSettings.hapticEnabled),this.timeoutManager=new l(this.sparkScanViewSettings,this)}get portraitOrientationTriggerButtonTranslateX(){return this.stateManager.portraitOrientationTriggerButtonTranslateX??this.defaultTriggerButtonTranslateX}get portraitOrientationTriggerButtonTranslateY(){return this.stateManager.portraitOrientationTriggerButtonTranslateY??this.defaultTriggerButtonTranslateY}get landscapeOrientationTriggerButtonTranslateX(){return this.stateManager.landscapeOrientationTriggerButtonTranslateX??this.defaultTriggerButtonTranslateX}get landscapeOrientationTriggerButtonTranslateY(){return this.stateManager.landscapeOrientationTriggerButtonTranslateY??this.defaultTriggerButtonTranslateY}get portraitOrientationMiniPreviewTranslateX(){return this.stateManager.portraitOrientationMiniPreviewTranslateX??this.defaultMiniPreviewTranslateX}get portraitOrientationMiniPreviewTranslateY(){return this.stateManager.portraitOrientationMiniPreviewTranslateY??this.defaultMiniPreviewTranslateY}get landscapeOrientationMiniPreviewTranslateX(){return this.stateManager.landscapeOrientationMiniPreviewTranslateX??this.defaultMiniPreviewTranslateX}get landscapeOrientationMiniPreviewTranslateY(){return this.stateManager.landscapeOrientationMiniPreviewTranslateY??this.defaultMiniPreviewTranslateY}get defaultTriggerButtonTranslateX(){return this.parentViewSizes.width-Math.min(this.parentViewSizes.width/3,110)-90/2}get defaultTriggerButtonTranslateY(){return this.parentViewSizes.height-Math.min(this.parentViewSizes.height/3,250)-90/2}get defaultMiniPreviewTranslateX(){return this.parentViewSizes.width-225-16}get parentViewSizes(){return{width:this.sparkScanView.parentElement.clientWidth??window.innerWidth,height:this.sparkScanView.parentElement.clientHeight??window.innerHeight}}get defaultMiniPreviewTranslateY(){return 16}static forView(e,t){return new g(e,t)}async prepareScanning(e){if(this._preparationPromise)return this._preparationPromise;this._stopScanningPromise&&await this._stopScanningPromise,this._preparationPromise=this._internalPrepareScanning(e);try{await this._preparationPromise}catch(e){throw this._preparationPromise=null,e}return this._preparationPromise}async _internalPrepareScanning(e){var t;let n=this.context$,r=this.sparkScan$;(t=this._dataCaptureView)==null||t.detachFromElement(),this._dataCaptureView=await h.forContext(n),this._dataCaptureView.logoAnchor=p.BottomCenter,this._dataCaptureView.logoStyle=_.Minimal,this._dataCaptureView.setProperty(`stopVideoTracksOnVisibilityChange`,!1),this._dataCaptureView.setProperty(`freezeFrameWhenStoppingFrameSource`,!1),this._dataCaptureView.connectToElement(e);let i=await this.cameraManager.prepareScanning(n,this.sparkScanViewSettings);this.sparkScanView.setTorchAvailable(i.isTorchAvailable),this.sparkScanView.setZoomAvailable(i.isZoomAvailable),this.sparkScanView.cameraSwitchButtonTapped(i.isTorchAvailable,i.cameraPosition),await n.setMode(r),r.addListener(this),r.setDelegate(this),await this.overlayManager.prepareScanning(r,this._dataCaptureView,this.stateManager.scanningBehavior),this.analyticsManager.startSession({cameraPosition:this.camera.position,hapticEnabled:this.sparkScanViewSettings.hapticEnabled,scanningMode:this.stateManager.scanningMode,soundEnabled:this.sparkScanViewSettings.soundEnabled,torchState:this.camera.getDesiredTorchState()}),await this.applyPreferences(),await this.switchToIdleState()}async stopScanning(e){if(this._stopScanningPromise)return this._stopScanningPromise;if(this.stateManager.state!==`Initial`){this._preparationPromise=null,this._stopScanningPromise=this._internalStopScanning(e);try{await this._stopScanningPromise}finally{this._stopScanningPromise=null}}}async _internalStopScanning(e){var t;this.timeoutManager.stopCurrentTimeout();let n=this.context$,r=this.sparkScan$;await r.setEnabled(!1),r.removeListener(this),r.setDelegate(void 0),await n.removeMode(r),await this.cameraManager.stopScanning(),(t=this._dataCaptureView)==null||t.detachFromElement(),this.analyticsManager.setSessionStopReason(e.sessionStopReason),this.setState(`Initial`)}async startScanning(){await this.switchToActiveState()}async pauseScanning(){await this.switchToInactiveState({sessionStopReason:`user`})}async onTriggerButtonPointerDown(){this.stateManager.triggerButtonPressed=!0}async onTriggerButtonTap(){switch(this.stateManager.state){case`Initial`:this.stateManager.triggerButtonPressed=!1;return;case`idle`:case`inactive`:case`error`:await this.switchToActiveState({barcodeFeedback:this.tapBarcodeFeedback});return;case`active`:if(this.stateManager.inSmartScanSelection){this.timeoutManager.restartCurrentTimeout(),await this.sparkScan$.selectItemWithSmartScanSelection();return}await(this.stateManager.continuousModeEnabled?this.switchToInactiveState({sessionStopReason:`user`,barcodeFeedback:this.silentBarcodeFeedback}):this.switchToActiveState({barcodeFeedback:this.tapBarcodeFeedback}))}}async onTriggerButtonLongPressStart(){this.stateManager.triggerButtonPressed=!0,this.sparkScanViewSettings.holdToScanEnabled&&!this.isSelectionModeOn()&&(this.scanningBehaviorCache=this.stateManager.scanningBehavior,this.stateManager.scanningBehavior=`continuous`,this.stateManager.holdingToScan=!0,await this.overlayManager.setShouldRemoveLocationsAfterScan(!0),await this.switchToActiveState({barcodeFeedback:this.tapBarcodeFeedback}))}isSelectionModeOn(){return this.sparkScan$.settings.selectionMode===`on`}async onTriggerButtonLongPressEnd(){this.stateManager.holdingToScan&&this.stateManager.state!==`error`?(await this.cancelInProgressLongPress(),await this.switchToInactiveState({sessionStopReason:`user`,barcodeFeedback:this.silentErrorBarcodeFeedback})):this.stateManager.triggerButtonPressed=!1}async cancelInProgressLongPress(){this.stateManager.scanningBehavior=this.scanningBehaviorCache??`single`,this.stateManager.holdingToScan=!1,await this.overlayManager.setShouldRemoveLocationsAfterScan(this.stateManager.continuousModeEnabled)}async onClickOutside(){this.stateManager.idleState||await this.switchToIdleState({emitTapFeedback:!0})}async onVisibilityChange(){await this.switchToIdleState()}async onTargetModeButtonTap(e,r=this.feedbackManager.tapFeedback,i=!0){r.emit(),e&&this.stateManager.holdingToScan&&await this.cancelInProgressLongPress();let a=String(e),o={true:e&&this.stateManager.scanningMode instanceof t,false:!e&&this.stateManager.scanningMode instanceof n}[a];if(!this._sparkScan&&o&&(this.stateManager.scanningMode=this.stateManager.scanningMode.changeMode()),this.enableTargetModeLocationSelection(e),this._sparkScan&&(this._sparkScan.settings.selectionMode!==`auto`&&(this._sparkScan.settings.selectionMode=e?`on`:`off`),await this._sparkScan.applySettings(this._sparkScan.settings)),await this.overlayManager.setShouldDrawViewfinder(e),this.timeoutManager.restartCurrentTimeout(),this.sparkScanView.targetModeButtonTapped(e,i),o){var s,c;(s=this.listener)==null||(c=s.didChangeScanningMode)==null||c.call(s,this.stateManager.scanningMode),this.analyticsManager.setScanningMode(this.stateManager.scanningMode)}this.updateSizeControlVisibility()}async onScanningBehaviorButtonTap(e,t=this.feedbackManager.tapFeedback,n=!0){t.emit(),this.stateManager.scanningMode=this.stateManager.scanningMode.copyWith(e?`continuous`:`single`),await this.overlayManager.setShouldRemoveLocationsAfterScan(e),this.timeoutManager.restartCurrentTimeout(),this.sparkScanView.scanningBehaviorButtonTapped(e,n),this.analyticsManager.setScanningMode(this.stateManager.scanningMode)}async onBarcodeFindButtonTap(){var e,t;await this.switchToIdleState({sessionStopReason:`user`,emitTapFeedback:!0}),(e=this.listener)==null||(t=e.didTapBarcodeFindButton)==null||t.call(e,this.sparkScanView),this.timeoutManager.restartCurrentTimeout()}async onLabelCaptureButtonTap(){var e,t;await this.switchToIdleState({sessionStopReason:`user`,emitTapFeedback:!0}),(e=this.listener)==null||(t=e.didTapLabelCaptureButton)==null||t.call(e,this.sparkScanView),this.timeoutManager.restartCurrentTimeout()}async onCameraSwitchButtonTap(){if(this.feedbackManager.emitTapFeedback(),this.timeoutManager.restartCurrentTimeout(),!this.camera||this.stateManager.state===`error`)return;let e=await this.cameraManager.onCameraSwitchButtonTap();e&&(this.sparkScanView.cameraSwitchButtonTapped(e.isTorchAvailable,e.cameraPosition),this.analyticsManager.setCameraPosition(e.cameraPosition))}async onTorchButtonTap(e,t=this.feedbackManager.tapFeedback,n=!0){t.emit(),this.stateManager.torchState=e?b.On:b.Off,await this.cameraManager.onTorchButtonTap(this.stateManager.torchState),this.timeoutManager.restartCurrentTimeout(),this.sparkScanView.torchButtonTapped(e,n),this.analyticsManager.setTorchState(this.stateManager.torchState)}async onTriggerButtonCollapseTimeout(){this.stateManager.state!==`idle`&&this._preparationPromise&&await this.switchToIdleState({sessionStopReason:`timeout`})}async onInactiveStateTimeout(){this.stateManager.state!==`inactive`&&!this.stateManager.holdingToScan&&this._preparationPromise&&await this.switchToInactiveState({sessionStopReason:`timeout`})}async onResumeCapturingTimeout(){this.stateManager.state!==`active`&&this._preparationPromise&&await this.switchToActiveState()}async onMiniPreviewCloseButtonTap(){await this.switchToIdleState({sessionStopReason:`user`,emitTapFeedback:!0})}onMiniPreviewResizeButtonTap(){(this.stateManager.state===`active`||this.stateManager.state===`inactive`)&&(this.feedbackManager.emitTapFeedback(),this.timeoutManager.restartCurrentTimeout())}async onMiniPreviewZoomButtonTap(e){this.feedbackManager.emitTapFeedback(),this.stateManager.zoomFactor=e,await this.cameraManager.onMiniPreviewZoomButtonTap(e),this.timeoutManager.restartCurrentTimeout()}async onMiniPreviewDrag(e,t){switch(this.stateManager.state===`active`&&await this.sparkScan$.setEnabled(!1),t){case`landscape-primary`:case`landscape-secondary`:this.stateManager.landscapeOrientationMiniPreviewTranslateX=e.x,this.stateManager.landscapeOrientationMiniPreviewTranslateY=e.y;break;case`portrait-primary`:case`portrait-secondary`:this.stateManager.portraitOrientationMiniPreviewTranslateX=e.x,this.stateManager.portraitOrientationMiniPreviewTranslateY=e.y;break}this.timeoutManager.restartCurrentTimeout()}onMiniPreviewPointerMove(){this.timeoutManager.restartCurrentTimeout()}async onMiniPreviewPointerUp(){this.stateManager.inSmartScanSelection||await this.switchToActiveState()}async onMiniPreviewDragEnd(){this.stateManager.state===`active`&&await this.sparkScan$.setEnabled(!0)}async onMiniPreviewVisibilityChange(e){e&&this.sparkScanView.repositionMiniPreviewIfOutOfBounds(),this.stateManager.inSmartScanSelection&&!e&&await this.onSwitchedAwayFromSmartScanSelection()}onTriggerButtonDrag(e,t){switch(t){case`landscape-primary`:case`landscape-secondary`:this.stateManager.landscapeOrientationTriggerButtonTranslateX=e.x,this.stateManager.landscapeOrientationTriggerButtonTranslateY=e.y;break;case`portrait-primary`:case`portrait-secondary`:this.stateManager.portraitOrientationTriggerButtonTranslateX=e.x,this.stateManager.portraitOrientationTriggerButtonTranslateY=e.y;break}}async onOrientationChange(){if(this.stateManager.state===`active`&&this.stateManager.holdingToScan){this.timeoutManager.restartCurrentTimeout();return}this.stateManager.state===`error`&&await this.switchToInactiveState({sessionStopReason:`user`})}async didScan(e,t){if(!t.newlyRecognizedBarcode)return;let n=this.sparkScanView.feedbackDelegate.getFeedbackForBarcode(t.newlyRecognizedBarcode);if(n){if(n instanceof i){await this.switchToErrorState({barcodeFeedback:n}),this.timeoutManager.restartCurrentTimeout();return}if(n instanceof o){if(this.stateManager.continuousModeEnabled){await this.switchToActiveState({barcodeFeedback:n}),this.timeoutManager.restartCurrentTimeout();return}await this.switchToInactiveState({barcodeFeedback:n,emitSuccessFeedback:!0,sessionStopReason:`user`}),this.timeoutManager.restartCurrentTimeout()}}}setListener(e){this.listener=e}async onSwitchedToSmartScanSelection(){if(this.overlayManager.isReady){this.stateManager.inSmartScanSelection=!0,this.stateManager.previewSizeControlVisibleBeforeSmartScanSelection=this.sparkScanView.previewSizeControlVisible,await this.overlayManager.onSwitchedToSmartScanSelection(this._dataCaptureView);let e=this.sparkScan$.settings.selectionMode,t=e===`on`;this.stateManager.selectionModeOn=t,(e===`auto`||!this.stateManager.targetModeEnabled&&!t)&&(this.stateManager.miniPreviewSizeBeforeSmartScanSelection=this.sparkScanView.miniPreviewSize,this.sparkScanView.miniPreviewSize=`expanded`),this.updateSizeControlVisibility()}}async onSwitchedAwayFromSmartScanSelection(){this.overlayManager.isReady&&this.stateManager.inSmartScanSelection&&(this.stateManager.inSmartScanSelection=!1,this.stateManager.selectionModeOn=!1,await this.overlayManager.onSwitchedAwayFromSmartScanSelection(this._dataCaptureView),this.stateManager.miniPreviewSizeBeforeSmartScanSelection!=null&&(this.sparkScanView.miniPreviewSize=this.stateManager.miniPreviewSizeBeforeSmartScanSelection,this.stateManager.miniPreviewSizeBeforeSmartScanSelection=void 0),this.updateSizeControlVisibility())}get tapBarcodeFeedback(){return new o(m.fromRGBA(0,0,0,0),this.defaultSuccessBrush,this.feedbackManager.tapFeedback)}get silentBarcodeFeedback(){return new o(m.fromRGBA(0,0,0,0),this.defaultSuccessBrush,this.feedbackManager.noFeedback)}get silentErrorBarcodeFeedback(){return new i(``,0,m.fromRGBA(0,0,0,0),this.defaultErrorBrush,this.feedbackManager.noFeedback)}async switchToIdleState(e={}){await this.sparkScan$.setEnabled(!1),await this.cameraManager.onSwitchToIdleState(),e.emitTapFeedback===!0&&this.feedbackManager.emitTapFeedback(),await this.overlayManager.onSwitchToIdleState(),this.setState(`idle`),this.timeoutManager.onSwitchToIdleState(),this.stateManager.triggerButtonPressed=!1,this.sparkScanView.switchToIdleState(),e.sessionStopReason!=null&&this.analyticsManager.setSessionStopReason(e.sessionStopReason)}async switchToActiveState(e={}){var t;let n=this.stateManager.state;await this.cameraManager.onSwitchToActiveState(this.stateManager.torchState),await this.overlayManager.onSwitchToActiveState(n,this.stateManager.continuousModeEnabled,e.barcodeFeedback),this.feedbackManager.emitBarcodeFeedback(e.barcodeFeedback),this.timeoutManager.onSwitchToActiveState(this.stateManager.holdingToScan),await this.sparkScanView.switchToActiveState(this.sparkScanViewSettings.visualFeedbackEnabled&&e.barcodeFeedback instanceof o,this.stateManager.scanningBehavior,(t=e.barcodeFeedback)==null?void 0:t.visualFeedbackColor,this.stateManager.zoomedIn&&n!==`active`),await this.sparkScan$.setEnabled(!0),this.setState(`active`)}async switchToInactiveState(e){var t;this.stateManager.inSmartScanSelection?await this.sparkScan$.setEnabled(!1):this.stateManager.shouldEnableSuppression?await this.sparkScan$.setResultSuppressionEnabled(!0):await this.sparkScan$.setEnabled(!1),this.stateManager.triggerButtonPressed=!1,this.stateManager.scanningMode.previewBehavior===`persistent`&&e.barcodeFeedback instanceof o&&await this.overlayManager.setShouldRemoveLocationsAfterScan(!0),await this.cameraManager.onSwitchToInactiveState(this.stateManager.scanningMode.previewBehavior),e.emitSuccessFeedback??=!0,this.setState(`inactive`),e.barcodeFeedback&&await this.overlayManager.setBrushForFeedback(e.barcodeFeedback),this.feedbackManager.emitBarcodeFeedback(e.barcodeFeedback),await this.overlayManager.overlayReadyForDraw(),this.timeoutManager.onSwitchToInactiveState(),await this.sparkScanView.switchToInactiveState(this.sparkScanViewSettings.visualFeedbackEnabled&&e.barcodeFeedback instanceof o&&e.emitSuccessFeedback,this.stateManager.scanningBehavior,this.stateManager.previewBehavior,(t=e.barcodeFeedback)==null?void 0:t.visualFeedbackColor),this.analyticsManager.setSessionStopReason(e.sessionStopReason)}async switchToErrorState(e){let t=e.barcodeFeedback.resumeCapturingDelay>0;t&&(await this.sparkScan$.setEnabled(!1),await this.cameraManager.onSwitchToErrorState(),this.setState(`error`),this.stateManager.scanningBehavior=`single`),this.timeoutManager.onSwitchToErrorState(t,e.barcodeFeedback.resumeCapturingDelay),await this.overlayManager.onSwitchToErrorState(e.barcodeFeedback),await this.sparkScan$.workerCommand(`sparkScanEmitErrorFeedback`,{shouldRemoveBrush:!t}),this.feedbackManager.emitBarcodeFeedback(e.barcodeFeedback),await this.sparkScanView.switchToErrorState(e.barcodeFeedback,this.sparkScanViewSettings.visualFeedbackEnabled)}applySelectionModeToScanningMode(e){if(e==null)return;if(e===`auto`){this.stateManager.scanningMode instanceof n&&(this.stateManager.scanningMode=this.stateManager.scanningMode.changeMode());return}let t=e===`on`;this.stateManager.scanningMode instanceof n!==t&&(this.stateManager.scanningMode=this.stateManager.scanningMode.changeMode())}enableTargetModeLocationSelection(t){let n=new v(t?e.SparkScanSettings.targetModeLocationSelection.radius:e.SparkScanSettings.locationSelection.radius,t?e.SparkScanSettings.targetModeLocationSelection.unit:e.SparkScanSettings.locationSelection.unit);this.sparkScan$.settings.locationSelection=new y(n),this.overlayManager.setRadius(n)}async applyPreferences(){await this.onTargetModeButtonTap(this.stateManager.targetModeEnabled,this.feedbackManager.noFeedback,!1),await this.onScanningBehaviorButtonTap(this.stateManager.continuousModeEnabled,this.feedbackManager.noFeedback,!1),await this.onTorchButtonTap(this.stateManager.torchEnabled,this.feedbackManager.noFeedback,!1),this.sparkScanView.repositionElementsIfOutOfBounds()}setState(e){if(e!==this.stateManager.state){var t,n;this.stateManager.state=e,(t=this.listener)==null||(n=t.didChangeViewState)==null||n.call(t,e)}}updateSizeControlVisibility(){if(!this.stateManager.inSmartScanSelection&&this.stateManager.previewSizeControlVisibleBeforeSmartScanSelection!==void 0){this.sparkScanView.previewSizeControlVisible=this.stateManager.previewSizeControlVisibleBeforeSmartScanSelection,this.stateManager.previewSizeControlVisibleBeforeSmartScanSelection=void 0;return}let e=this.stateManager.inSmartScanSelection&&!this.stateManager.targetModeEnabled&&!this.stateManager.selectionModeOn,t=this.sparkScanView.previewSizeControlVisible;this.sparkScanView.previewSizeControlVisible=t&&!e}};S([C],w.prototype,`switchToActiveState`,null),S([C],w.prototype,`switchToInactiveState`,null),S([C],w.prototype,`switchToErrorState`,null);export{w as t};
@@ -1,6 +0,0 @@
1
- (function(){function e(e){return typeof e==`object`&&!!e}function t(t){if(typeof t==`string`)return t;if(e(t)){if(typeof t.message==`string`)return t.message}else if(typeof t?.toString==`function`)return t.toString();return`unknown error`}let n;(function(e){e.Level=function(e){return e.Debug=`debug`,e.Info=`info`,e.Warn=`warn`,e.Error=`error`,e.Quiet=`quiet`,e}({});let t=new Map([[`debug`,1],[`info`,2],[`warn`,3],[`error`,4],[`quiet`,5]]),n=`debug`;function r(e){n=e}e.setLevel=r;function i(e,...r){if(!(t.get(n)>t.get(e)))switch(e){case`debug`:console.debug(...r);break;case`info`:console.log(...r);break;case`warn`:console.warn(...r);break;case`error`:console.error(...r);break;default:break}}e.log=i;function a(...e){i(`warn`,...e)}e.warn=a;function o(...e){i(`debug`,...e)}e.debug=o;function s(...e){i(`info`,...e)}e.info=s;function c(...e){i(`error`,...e)}e.error=c})(n||={});var r=class e extends Error{constructor(t){super(t.message),Object.setPrototypeOf(this,e.prototype),this.name=t.name}toString(){return`${this.name}: ${this.message}`}};function i(e){return/^https?:\/\/(?:[^./]*\.)*cdn.jsdelivr.net\//.test(e)?{result:!0,cdnBaseURL:`https://cdn.jsdelivr.net/npm/`}:/^https?:\/\/(?:[^./]*\.)*unpkg.com\//.test(e)?{result:!0,cdnBaseURL:`https://unpkg.com/`}:{result:!1,cdnBaseURL:``}}function a(e){let t=/@scandit\/web-datacapture-[a-z]+/i.exec(e);return t?t[0]:null}function o(e,t,n){let r=t,o=i(r);if(o.result){let t=a(r);t!=null&&(r=`${o.cdnBaseURL}${t}@${e}/sdc-lib/`)}let s=n.replace(`.wasm`,``);return o.result?{jsURI:`${r}${s}.js`,wasmURI:`${r}${s}.wasm`}:{jsURI:`${r}${s}.js?v=${e}`,wasmURI:`${r}${s}.wasm?v=${e}`}}(function(e){return e[e.Free=0]=`Free`,e[e.Writing=1]=`Writing`,e[e.Ready=2]=`Ready`,e[e.Processing=3]=`Processing`,e})({});var s=class e{constructor(e,t,n,r){this.getHeapBuffer=e,this.memAddressSlotByteLength=t,this.stateBuffer=n,this.addressBuffer=r,this._staleAddressDetected=!1}static create(t){let n=new Int32Array(new SharedArrayBuffer(t.memAddressSlotCount*Int32Array.BYTES_PER_ELEMENT)),r=new Uint32Array(new SharedArrayBuffer(t.memAddressSlotCount*Uint32Array.BYTES_PER_ELEMENT));for(let e=0;e<t.memAddressSlotCount;e++)Atomics.store(r,e,t.allocateUint8Array(t.memAddressSlotByteLength));return new e(t.getHeapBuffer,t.memAddressSlotByteLength,n,r)}static attach(t){return new e(()=>t.heapBuffer,t.memAddressSlotByteLength,new Int32Array(t.stateSharedBuffer),new Uint32Array(t.addressSharedBuffer))}get hasStaleAddresses(){return this._staleAddressDetected}get memAddressSlotCount(){return this.stateBuffer.length}get buffers(){return{stateSharedBuffer:this.stateBuffer.buffer,addressSharedBuffer:this.addressBuffer.buffer,heapBuffer:this.getHeapBuffer(),memAddressSlotByteLength:this.memAddressSlotByteLength}}viewFor(e){return new Uint8ClampedArray(this.getHeapBuffer(),e,this.memAddressSlotByteLength)}claimFreeMemAddressSlot(){for(let e=0;e<this.stateBuffer.length;e++)if(Atomics.compareExchange(this.stateBuffer,e,0,1)===0){let t=Atomics.load(this.addressBuffer,e);return t+this.memAddressSlotByteLength>this.getHeapBuffer().byteLength?(this._staleAddressDetected=!0,this.abandon(e),null):{index:e,address:t,view:this.viewFor(t)}}return null}markReady(e){let t=Atomics.compareExchange(this.stateBuffer,e,1,2);if(t!==1)throw Error(`SharedFrameMemAddressSlotPool: cannot mark memAddressSlot ${e} ready from state ${t}`)}abandon(e){let t=Atomics.compareExchange(this.stateBuffer,e,1,0);if(t!==1)throw Error(`SharedFrameMemAddressSlotPool: cannot abandon memAddressSlot ${e} from state ${t}`)}beginProcessing(e){if(Atomics.compareExchange(this.stateBuffer,e,2,3)!==2)return null;let t=Atomics.load(this.addressBuffer,e);return{index:e,address:t,view:this.viewFor(t)}}release(e,t){let n=Atomics.load(this.stateBuffer,e);if(n!==3)throw Error(`SharedFrameMemAddressSlotPool: cannot release memAddressSlot ${e} from state ${n}`);for(let n=0;n<this.addressBuffer.length;n++)if(Atomics.load(this.addressBuffer,n)===t)throw Error(`SharedFrameMemAddressSlotPool: replacement address ${t} for memAddressSlot ${e} is already in use by memAddressSlot ${n} — addresses must never be reused`);Atomics.store(this.addressBuffer,e,t),Atomics.store(this.stateBuffer,e,0)}dispose(e){for(let t=0;t<this.addressBuffer.length;t++)e(Atomics.load(this.addressBuffer,t))}},c=class{constructor(){this.promise=new Promise((e,t)=>{this.reject=t,this.resolve=e})}};let l;(function(e){function t(){return`8.6.0-beta.1`}e.sdkVersion=t})(l||={});let u={};function d(e){return[...new Uint8Array(e)].map(e=>{let t=e.toString(16);return t.length===1?`0${t}`:t}).join(``)}async function*f(e){let t=e.getReader();try{for(;;){let{done:e,value:n}=await t.read();if(e)return;yield n}}finally{t.releaseLock()}}async function p(e){let t=[],n=0,r=0;for await(let r of f(e))t.push(r),n+=r.length;let i=new Uint8Array(n);for(let e of t)i.set(e,r),r+=e.length;return i.buffer}(function(e){return e.VALID=`VALID`,e.INVALID=`INVALID`,e.NOT_VERIFIABLE=`NOT_VERIFIABLE`,e})({});async function m(e,t,r){if(typeof crypto.subtle.digest!=`function`)return n.log(n.Level.Warn,`Insecure context (see https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts): The hash of the Scandit Data Capture library WASM file found at ${r} could not be verified`),`NOT_VERIFIABLE`;try{let i=e instanceof Promise?await e:e,a=d(await crypto.subtle.digest(`SHA-256`,i));return t==null?(n.log(n.Level.Warn,`The library hash is not defined or empty, cannot correctly verify integrity.`),`NOT_VERIFIABLE`):a===t?(n.log(n.Level.Debug,`Data Capture library WASM integrity found at ${r} has been verified correctly.`),`VALID`):(n.log(n.Level.Warn,`The Scandit Data Capture library WASM file found at ${r} seems invalid: expected file hash doesn't match (received: ${a}, expected: ${t}). Please ensure the correct Scandit Data Capture file (with correct version) is retrieved.`),`INVALID`)}catch(e){return n.log(n.Level.Warn,`Wasm response could not be verified`,e),`NOT_VERIFIABLE`}}let h=new Map([[`br`,4.4],[`gzip`,2.9],[`none`,1]]);function g(e){let t=`content-encoding`;if(e==null||e.get(t)==null)return h.get(`none`);let n=new Set((e.get(t)??``).split(`,`).map(e=>e.trim()));for(let[e,t]of h)if(n.has(e))return t;return h.get(`none`)}function _(e){if(e==null)return 0;let t=g(e)??1,n=Number.parseInt(e.get(`content-length`)??`0`,10);return Number.isNaN(n)?0:Math.floor(n*t*100)/100}function v(e){let{pathname:t}=new URL(e);for(let[e,n]of Object.entries(u))if(t.endsWith(e))return n.bytes;return 0}function y(e){u=e}let b=(e,t)=>{let n=_(t);return n===0?v(e):n};function x(e,t,r,{onProgress:i,onError:a,onComplete:o}){if(!t.body)return[t];let s=b(e,t.headers),c=0,l=0;if(typeof TransformStream>`u`)return n.warn(`TransformStream is not supported in this environment. Progress tracking will be disabled.`),[t];let[u,d]=r?t.body.tee():[t.body],f=u.pipeThrough(new TransformStream({async transform(t,n){try{c+=t.length,l=Number((c/s*100).toFixed(2)),s>0&&t.length>0&&l<100?i?.({percentage:l,loadedBytes:c,privateUri:e}):s===0&&t.length>0&&i?.({percentage:null,loadedBytes:c,privateUri:e}),n.enqueue(t)}catch(e){n.error(e),a?.({error:e})}},flush(t){i?.({percentage:100,loadedBytes:c,privateUri:e}),o?.({percentage:100,loadedBytes:c,privateUri:e}),t.terminate()}}));return[new Response(f,{headers:new Headers(t.headers),status:t.status,statusText:t.statusText}),d]}async function S({wasmURI:e,expectedHash:t,verifyResponseHash:n,onProgress:r,onComplete:i,onError:a,referredOrigin:o}){let s=await fetch(e,{referrerPolicy:`origin`,referrer:o??``});if(!s.ok)throw Error(`HTTP status code is not ok: ${s.status}, ${s.statusText}`);let[c,l]=x(e,s,n,{onProgress:r,onError:a,onComplete:i});return l!=null&&m(p(l),t,e),c}function C({wasmURI:e,expectedHash:t,verifyResponseHash:r,progressCallback:i,successCallback:a,errorCallback:o,importObject:s,referredOrigin:c}){async function l(l){try{let n=await S({wasmURI:e,expectedHash:t,verifyResponseHash:r,onProgress:i,referredOrigin:c}),o=await(l??n).arrayBuffer(),u=await globalThis.WebAssembly.instantiate(o,s);a(u.instance,u.module)}catch(t){n.log(n.Level.Error,t),n.log(n.Level.Error,`Couldn't instantiate Scandit SDK DataCapture library at ${e}, did you configure the path for it correctly?`),o?.(t)}}async function u(){let o;try{o=await S({wasmURI:e,expectedHash:t,verifyResponseHash:r,onProgress:i,referredOrigin:c});let n=await globalThis.WebAssembly.instantiateStreaming(o,s);a(n.instance,n.module)}catch(e){n.log(n.Level.Warn,e),n.log(n.Level.Warn,`WebAssembly streaming compile failed. Falling back to ArrayBuffer instantiation (this will make things slower)`),l(o?.bodyUsed===!0?void 0:o)}}typeof globalThis.WebAssembly.instantiateStreaming==`function`?u():l()}async function w(e,t,n,r){return new Promise((i,a)=>{e().then(i).catch(o=>{let s=t*2;if(s>n){a(o);return}r(o),globalThis.setTimeout(()=>{w(e,s,n,r).then(i).catch(a)},t)})})}function T(e){var t;let n=`unknown`;if((t=e.href)!=null&&t.startsWith(`blob:null/`))n=`localhost`;else{let t=e.pathname?.length>1&&!e.pathname.startsWith(`/`);n=new URL(t?e.pathname:e.origin).hostname}return n.startsWith(`[`)&&n.endsWith(`]`)?(n=n.slice(1,-1),n):(/^(\d{1,3}\.){3}\d{1,3}$/.test(n)&&(n=n.split(`.`).map(e=>Number.parseInt(e,10).toString()).join(`.`)),n)}async function E(e){let t;try{let i=new Promise((i,a)=>{t=setTimeout(()=>{n.debug(`IndexedDB database is blocked (timed out after ${e}ms). If you are running a Debug wasm build, things are slower and the timeout can be configured via IndexedDBBlockedTimeoutMs in localStorage (requires page reload).`),a(new r({name:`BlockedIndexedDB`,message:`IndexedDB database is blocked`}))},e)}),a=new Promise((e,t)=>{FS.syncfs(!0,n=>{n==null?e():t(n)})});await Promise.race([a,i])}finally{t!==void 0&&clearTimeout(t)}}async function ee(e){try{FS.mkdir(e.writableDataPath)}catch(e){if(e.code!==`EEXIST`)throw e}return FS.mount(IDBFS,{autoPersist:!0},e.writableDataPath),E(e.indexedDBTimeoutMs)}async function D(e,t){function r(e){try{return new URL(e,self.location.href).origin!==self.location.origin}catch(t){return n.log(n.Level.Warn,`Could not determine origin for WASM JS URL "${e}": ${t instanceof Error?t.message:String(t)}. Defaulting to same-origin path.`),!1}}function i(t){n.log(n.Level.Warn,t),n.log(n.Level.Warn,`Couldn't retrieve Scandit Data Capture library at ${e}, retrying...`)}try{if(r(e)){let t=await w(async()=>{let t=await fetch(e,{mode:`cors`,credentials:`omit`});if(!t.ok)throw Error(`Failed to load WASM JS script: ${e} (status ${t.status})`);let n=await t.blob();return/javascript|ecmascript/i.test(n.type)?n:new Blob([n],{type:`application/javascript`})},250,4e3,i),n=URL.createObjectURL(t);try{await importScripts(n)}finally{URL.revokeObjectURL(n)}self.Module.mainScriptUrlOrBlob=t}else await w(async()=>importScripts(e),250,4e3,i),self.Module.mainScriptUrlOrBlob=e;let a=globalThis.SDC_WASM_JS_VERSION;return a!==t&&n.log(n.Level.Warn,`The Scandit Data Capture library JS file found at ${e} seems invalid: expected version doesn't match (received: ${a}, expected: ${t}). Please ensure the correct Scandit Data Capture file (with correct version) is retrieved.`),!0}catch(e){return n.log(n.Level.Error,e),!1}}function O(e,t,n){let r=t*n,i=new Uint8ClampedArray(r*4),a=new Uint32Array(i.buffer);for(let t=0;t<r;t++){let n=e[t];a[t]=4278190080|n<<16|n<<8|n}return i}var k=class{constructor(e,t){this.workerFunctions=e,this.options=t,this.imageIdCounter=0,this.conversions=new Map}convertToJpeg(e,t){let n=this.imageIdCounter++,r=new c;this.conversions.set(n,r);let i=e.toBitmap();return this.workerFunctions.postMessage({type:`convertToJPEG`,imageId:n,width:e.getWidth(),height:e.getHeight(),data:i,planes:e.getPlanes(),orientation:t,quality:this.options.quality},Array.from(new Set([i.buffer]))),r.promise}convertToBitmap(e){return{data:e.toBitmap(),byteOrder:1}}onConvertToJPEGResult(e,t){let r=this.conversions.get(e);r?(r.resolve(t),this.conversions.delete(e)):n.warn(`ImageConverterForwarder: Conversion for imageId ${e} not found in Map`)}},A=class{constructor(e){this.options=e}get quality(){return this.options.quality}async convertToJpeg(e,t){try{let{width:n,height:r,planes:i}=this.validateAndExtractImageData(e);this.prepareCanvas(n,r);let a=this.processImageData(e,i,n,r);return await this.convertToJpegBytes(a,t)}catch(e){throw n.warn(`Failed to convert image to JPEG: ${e}`),e instanceof Error?e:Error(`Failed to convert image to JPEG`)}}convertToBitmap(e){return{data:e.toBitmap(),byteOrder:1}}validateAndExtractImageData(e){let t=e.getWidth(),r=e.getHeight(),i=e.getPlanes();if(t<=0||r<=0)throw n.warn(`Invalid image dimensions: ${t}x${r}`),Error(`Invalid image dimensions: ${t}x${r}`);if(!i||i.length===0)throw n.warn(`ImageBuffer has no planes`),Error(`ImageBuffer has no planes`);return{width:t,height:r,planes:i}}prepareCanvas(e,t){if(!this.ensureCanvas(e,t))throw Error(`Failed to create OffscreenCanvas`);if(!this.canvas||!this.context)throw Error(`Canvas or context not properly initialized`)}processImageData(e,t,n,r){let i=this.createImageDataFromBuffer(e,t,n,r);if(i===null)throw Error(`Failed to create ImageData`);return this.validateImageData(i,n,r),i}validateImageData(e,t,r){if(e.width!==t||e.height!==r)throw n.warn(`ImageData dimensions mismatch: expected ${t}x${r}, got ${e.width}x${e.height}`),Error(`ImageData dimensions mismatch`);if(!e.data||e.data.length!==t*r*4)throw n.warn(`ImageData has invalid data length: expected ${t*r*4}, got ${e.data?.length||0}`),Error(`ImageData has invalid data length`)}async convertToJpegBytes(e,t){if(!this.context||!this.canvas)throw Error(`Canvas or context not available`);try{this.context.putImageData(e,0,0)}catch(e){throw n.warn(`Failed to put image data on canvas: ${e}`),Error(`Failed to put image data on canvas: ${e}`)}let r=t===0?this.canvas:this.applyRotation(this.canvas,t),i;try{i=await this.canvasToBlob(r)}catch(e){throw n.warn(`Failed to convert canvas to blob: ${e}`),Error(`Failed to convert canvas to blob: ${e}`)}if(!i||i.size===0)throw n.warn(`Canvas convertToBlob returned empty or null blob`),Error(`Failed to create JPEG blob`);let a;try{a=await i.arrayBuffer()}catch(e){throw n.warn(`Failed to get array buffer from blob: ${e}`),Error(`Failed to get array buffer from blob: ${e}`)}if(!a||a.byteLength===0)throw n.warn(`Blob arrayBuffer returned empty or null buffer`),Error(`Failed to get array buffer from blob`);return new Uint8Array(a)}ensureCanvas(e,t){try{return(!this.canvas||this.canvas.width!==e||this.canvas.height!==t)&&(this.canvas=this.getNewCanvas(e,t),this.context=this.canvas.getContext(`2d`)),this.context!==null}catch(e){return n.warn(`Failed to create HTMLCanvasElement`,e),!1}}createImageDataFromBuffer(e,t,r,i){let a=new Set(t.map(e=>e.channel));try{if(this.isYUVFormat(a)){let t=e.toBitmap();return!t||t.length!==r*i*4?(n.warn(`Invalid bitmap data from toBitmap(): expected ${r*i*4} bytes, got ${t?.length||0}`),null):new ImageData(new Uint8ClampedArray(t),r,i)}if(this.isRGBAFormat(a))return this.createImageDataFromRGBAPlanes(t,r,i);if(this.isRGBFormat(a))return this.createImageDataFromRGBPlanes(t,r,i);if(this.isGrayscaleFormat(a))return this.createImageDataFromGrayscalePlanes(t,r,i);n.warn(`Unknown image format with channels: ${Array.from(a).join(`, `)}, falling back to toBitmap()`);let o=e.toBitmap();if(!o||o.length===0)return n.warn(`toBitmap() returned empty or null data`),null;let s=o.length/(r*i);return s===4?new ImageData(new Uint8ClampedArray(o),r,i):(n.warn(`Unsupported format: ${s} bytes per pixel`),null)}catch(e){return n.warn(`Failed to create ImageData: ${e}`),null}}isYUVFormat(e){return e.has(0)&&e.has(1)&&e.has(2)}isRGBAFormat(e){return e.has(3)&&e.has(4)&&e.has(5)&&e.has(6)}isRGBFormat(e){return e.has(3)&&e.has(4)&&e.has(5)&&!e.has(6)}isGrayscaleFormat(e){return e.has(0)&&!e.has(1)&&!e.has(2)}createImageDataFromRGBAPlanes(e,t,r){let i=e.find(e=>e.channel===3),a=e.find(e=>e.channel===4),o=e.find(e=>e.channel===5),s=e.find(e=>e.channel===6);if(!i||!a||!o||!s)return n.warn(`Missing RGBA planes`),null;let c=new Uint8ClampedArray(t*r*4);for(let e=0;e<r;e++)for(let n=0;n<t;n++){let r=(e*t+n)*4;c[r]=this.getPixelFromPlane(i,n,e),c[r+1]=this.getPixelFromPlane(a,n,e),c[r+2]=this.getPixelFromPlane(o,n,e),c[r+3]=this.getPixelFromPlane(s,n,e)}return new ImageData(c,t,r)}createImageDataFromRGBPlanes(e,t,r){let i=e.find(e=>e.channel===3),a=e.find(e=>e.channel===4),o=e.find(e=>e.channel===5);if(!i||!a||!o)return n.warn(`Missing RGB planes`),null;let s=new Uint8ClampedArray(t*r*4);for(let e=0;e<r;e++)for(let n=0;n<t;n++){let r=(e*t+n)*4;s[r]=this.getPixelFromPlane(i,n,e),s[r+1]=this.getPixelFromPlane(a,n,e),s[r+2]=this.getPixelFromPlane(o,n,e),s[r+3]=255}return new ImageData(s,t,r)}createImageDataFromGrayscalePlanes(e,t,r){let i=e.find(e=>e.channel===0);if(!i)return n.warn(`Missing Y plane for grayscale`),null;let a=new Uint8ClampedArray(t*r*4);for(let e=0;e<r;e++)for(let n=0;n<t;n++){let r=(e*t+n)*4,o=this.getPixelFromPlane(i,n,e);a[r]=o,a[r+1]=o,a[r+2]=o,a[r+3]=255}return new ImageData(a,t,r)}getPixelFromPlane(e,t,n){let r=Math.floor(t/(e.subsamplingX||1)),i=Math.floor(n/(e.subsamplingY||1)),a=e.rowStride,o=e.pixelStride,s=i*a+r*o,c=e.data;return s<c.length?c[s]:0}applyRotation(e,t){let n=t*Math.PI/180,r=t===90||t===270||t===-90||t===-270,i=r?e.height:e.width,a=r?e.width:e.height,o=this.getNewCanvas(i,a),s=o.getContext(`2d`);if(!s)throw Error(`Failed to get 2D context for rotated canvas`);return s.translate(i/2,a/2),s.rotate(n),s.translate(-e.width/2,-e.height/2),s.drawImage(e,0,0),o}};A.JPEG_IMAGE_MIME_TYPE=`image/jpeg`;var te=class extends A{getNewCanvas(e,t){return new OffscreenCanvas(e,t)}canvasToBlob(e){return e.convertToBlob({type:A.JPEG_IMAGE_MIME_TYPE,quality:this.options.quality})}},ne=class{constructor(e){this.viewInfo=null,this.viewInfo=this.cloneViewInfo(e)}isSame(e){return this.viewInfo==null&&e==null?!0:this.viewInfo==null&&e!=null||this.viewInfo!=null&&e==null?!1:this.viewInfo.width===e.width&&this.viewInfo.height===e.height&&this.viewInfo.orientation===e.orientation&&this.viewInfo.viewFinderRect.origin.x===e.viewFinderRect.origin.x&&this.viewInfo.viewFinderRect.origin.y===e.viewFinderRect.origin.y&&this.viewInfo.viewFinderRect.size.width===e.viewFinderRect.size.width&&this.viewInfo.viewFinderRect.size.height===e.viewFinderRect.size.height}update(e){this.viewInfo=this.cloneViewInfo(e)}cloneViewInfo(e){return e?{...e,viewFinderRect:{origin:{...e.viewFinderRect.origin},size:{...e.viewFinderRect.size}}}:null}},j=class e{constructor(e,t){this.hintPresenterV2=null,this.threadsSupport=!0,this.insufficientMultithreadingReported=!1,this.MAX_NUMBER_OF_IMAGES_IN_FRAME_DATA_POOL=5,this.redrawInterval=1e3/30,this.redrawRequests=[],this._isDrawLoopRunning=!1,this.frameDataPool=new Map,this.lastFrameColorType=`RGBA`,this.lastFrameId=null,this.poorMansBenchmarkLogs=!1,this.writableDataPathStandard=`/scandit_sync_folder`,this.resourceFilesSubfolder=`resources`,this.performanceMetricsReporterTimer=void 0,this.lastMetricsReportTime=0,this.metricsReportInterval=1e3,this.performanceMetrics={frameDataPoolSize:0,cameraOutputFrames:0,redrawRequestsCount:0,actualRedrawsCount:0,frameProcessingStartedCount:0,frameProcessedCount:0,frameSkippedCount:0,frameHandoffTotalMicros:0,frameHandoffCount:0},this.frameProcessingStartedCount=0,this.frameProcessingFinishedCount=0,this.gestureListener=null,this.webPlatformHintPresenter=null,this.deviceInstance=null,this.deviceInfo=null,this.lastViewInfo=new ne(null),this.lastFrameProcessingStartedCount=0,this.lastFrameProcessingFinishedCount=0,this.moduleHandler=e,this.workerFunctions=t,this._loadProgressCallback=this._loadProgressCallback.bind(this),y(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}prepareFrameForListener(e){let t=this.lastFrameId;if(this.frameDataPool.size>=this.MAX_NUMBER_OF_IMAGES_IN_FRAME_DATA_POOL){let e=this.frameDataPool.keys().next().value;e!=null&&this.frameDataPool.delete(e)}let n=e.getFrameData(),r=new Uint8ClampedArray(n);this.frameDataPool.set(t,{data:r,colorType:this.lastFrameColorType,frameId:t,width:e.getWidth(),height:e.getHeight()});let i=this.lastUsedModuleMirrorAxis!=null&&this.lastUsedModuleMirrorAxis!==this.Module.Axis.None;return{frameId:t,width:e.getWidth(),height:e.getHeight(),isFrameSourceMirrored:i,colorType:this.lastFrameColorType}}createContext(e){var t,n,r,i;let a=this.getModeDeserializers(),o=T(location);(o===`localhost`||o===`127.0.0.1`)&&navigator.userAgent.includes(`Electron`)&&e.appName!=null&&(o+=`-${e.appName}`),this.parentDomain=e.parentDomain,this.contextDeserializer=new this.Module.DataCaptureContextDeserializer(this.writableDataPath,e.deviceId,e.context.deviceModelName,o,this.parentDomain,a,e.highEndBlurryRecognition,this.resourcePath);let s=this.contextDeserializer.contextFromJson(JSON.stringify(e.context));if(s==null){let e=this.contextDeserializer.getLastError();throw Error(`Could not create the context: ${e}`)}let c=s.getView();this.context=s.getContext(),this.insufficientMultithreadingReported=!1,s.delete(),this.setupDeviceInterface(e.isTablet,e.batteryInfo);let l=this.Module.DataCaptureContextListener.extend(`DataCaptureContextListener`,{didChangeStatus:(e,t)=>{this.contextDidChangeStatus(JSON.parse(t.toJson())),e.delete()},didStartObservingContext:e=>{this.didStartObservingContext(),e.delete()},didStopObservingContext:e=>{e.delete()}}),u=this.Module.DataCaptureContextFrameListener.extend(`DataCaptureContextFrameListener`,{onObservationStarted:e=>{e.delete()},onObservationStopped:e=>{e.delete()},onFrameProcessingStarted:(e,t)=>{this.workerFunctions.postMessage({type:`onFrameProcessingStarted`}),t.delete(),e.delete()},onFrameProcessingFinished:(e,t)=>{this.workerFunctions.postMessage({type:`onFrameProcessingFinished`}),t.delete(),e.delete()},onFrameSkipped:(e,t)=>{this.workerFunctions.postMessage({type:`onFrameSkipped`}),t.delete(),e.delete()}}),d=this.Module.GestureRecognizer.extend(`GestureRecognizer`,{setGestureListener:(e,t)=>{var n;(n=this.gestureListener)==null||n.delete(),this.gestureListener=e.clone(),e.delete()}});(t=this.gestureRecognizer)==null||t.delete(),this.gestureRecognizer=new d;let f=new l;this.context.addListener(f),f.delete();let p=new u;this.context.addFrameListener(p),p.delete(),this.setView(c),(n=this.view)==null||n.setGestureRecognizer(this.gestureRecognizer);let m=this.Module.PlatformHintPresenter.extend(`PlatformHintPresenter`,{setHintPresenter:e=>{e.delete()},showToast:e=>{this.workerFunctions.postMessage({type:`showToast`,payload:JSON.parse(e)})},hideToast:e=>{this.workerFunctions.postMessage({type:`hideToast`,payload:JSON.parse(e)})},showGuidance:e=>{this.workerFunctions.postMessage({type:`showGuidance`,payload:JSON.parse(e)})},hideGuidance:e=>{this.workerFunctions.postMessage({type:`hideGuidance`,payload:JSON.parse(e)})},startUpdateTimer:e=>{this.workerFunctions.postMessage({type:`startUpdateTimer`,payload:{duration:{unit:`ms`,value:e}}})},stopUpdateTimer:()=>{this.workerFunctions.postMessage({type:`stopUpdateTimer`})}});if((r=this.hintPresenterV2)==null||r.delete(),this.hintPresenterV2=null,(i=this.webPlatformHintPresenter)==null||i.delete(),this.webPlatformHintPresenter=null,this.webPlatformHintPresenter=new m,this.view){var h;this.hintPresenterV2=new this.Module.HintPresenterV2(this.webPlatformHintPresenter),(h=this.view)==null||h.setHintPresenterV2(this.hintPresenterV2)}this.webImageConverterInstance=this.getImageConverterInstance({quality:1}),this.Module.ImageConverter.setInstance(this.webImageConverterInstance)}convertToJPEGResult(e,t){this.webImageConverterInstance instanceof k&&this.webImageConverterInstance.onConvertToJPEGResult(e,t)}getImageConverterInstance(e){return this.workerFunctions.getOffscreenCanvas()==null?new k(this.workerFunctions,e):new te(e)}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??(this.lastMetricsReportTime=performance.now(),this.scheduleMetricsReporting())}scheduleMetricsReporting(){this.performanceMetricsReporterTimer=setTimeout(()=>{this.checkAndReportMetrics()},100)}checkAndReportMetrics(){let e=performance.now();e-this.lastMetricsReportTime>=this.metricsReportInterval&&(this.reportPerformanceMetrics(),this.performanceMetrics.cameraOutputFrames=0,this.performanceMetrics.redrawRequestsCount=0,this.performanceMetrics.actualRedrawsCount=0,this.performanceMetrics.frameHandoffTotalMicros=0,this.performanceMetrics.frameHandoffCount=0,this.lastMetricsReportTime=e),this._isDrawLoopRunning?this.scheduleMetricsReporting():this.performanceMetricsReporterTimer=void 0}async reportPerformanceMetrics(){let e=this.frameProcessingStartedCount-this.lastFrameProcessingStartedCount,t=this.frameProcessingFinishedCount-this.lastFrameProcessingFinishedCount;this.lastFrameProcessingStartedCount=this.frameProcessingStartedCount,this.lastFrameProcessingFinishedCount=this.frameProcessingFinishedCount;let n={cameraOutputFrames:this.performanceMetrics.cameraOutputFrames,redrawRequestsCount:this.performanceMetrics.redrawRequestsCount,actualRedrawsCount:this.performanceMetrics.actualRedrawsCount,frameDataPoolSize:this.performanceMetrics.frameDataPoolSize,frameProcessingStartedCount:e,frameProcessedCount:t,frameSkippedCount:this.performanceMetrics.frameSkippedCount,frameHandoffTotalMicros:this.performanceMetrics.frameHandoffTotalMicros,frameHandoffCount:this.performanceMetrics.frameHandoffCount};this.workerFunctions.postMessage({type:`performanceMetricsReport`,payload:n})}deleteFrameData(e){this.frameDataPool.delete(e)}dispose(){var e,t,n,r,i,a;this.context.dispose(),(e=this.sharedFrameMemAddressSlotPool)==null||e.dispose(e=>this.Module.deleteUint8Array(e)),this.sharedFrameMemAddressSlotPool=void 0,this.frameDataPool.clear(),this.isDrawLoopRunning=!1,this.cleanupMetricsReporting(),(t=this.gestureRecognizer)==null||t.delete(),this.gestureRecognizer=null,(n=this.gestureListener)==null||n.delete(),this.gestureListener=null,(r=this.hintPresenterV2)==null||r.delete(),this.hintPresenterV2=null,(i=this.webPlatformHintPresenter)==null||i.delete(),this.webPlatformHintPresenter=null,(a=this.deviceInstance)==null||a.delete(),this.deviceInstance=null,this.deviceInfo=null}cleanupMetricsReporting(){this.performanceMetricsReporterTimer!=null&&(typeof this.performanceMetricsReporterTimer==`number`?cancelAnimationFrame(this.performanceMetricsReporterTimer):clearTimeout(this.performanceMetricsReporterTimer),this.performanceMetricsReporterTimer=void 0)}flushAnalytics(){this.context.flushAnalytics()}reportInsufficientMultithreadingIfNeeded(e){if(this.threadsSupport||this.insufficientMultithreadingReported)return;this.insufficientMultithreadingReported=!0;let t=new this.Module.InsufficientMultithreadingAnalyticsData(e);this.Module.InsufficientMultithreadingAnalyticsHelper.storeAnalyticsEvent(this.context,t),t.delete()}extractCentaurusLicense(t){return{payload:{centaurus:{licenseKey:this.Module.LicenseUtils[e.get3dPartyLicenseKeyMethodName](t)}}}}getModeDeserializers(){return new this.Module.VectorDataCaptureModeDeserializer}loadLibrary(e){return this.libraryLoadingPromise??=this.setup(e),this.libraryLoadingPromise}processFrame(e){var t;if(this.context==null)return n.debug(`[processFrame] Context is null, returning frame without processing`),{payload:e,transferables:[e.data.buffer]};this.lastFrameId=e.frameId;let r=e.data,i=e.colorType===`GRAYSCALE`?this.Module.ImageBufferFormat.Grayscale8:this.Module.ImageBufferFormat.Rgba8888;this.lastFrameColorType=e.colorType===`GRAYSCALE`?`GRAYSCALE`:`RGBA`;let a=this.Module.allocateUint8Array(r.byteLength);return this.Module.HEAPU8.set(r,a),(t=this.imageFrameSource)==null||t.outputFrame(a,e.width,e.height,i),{payload:e,transferables:[e.data.buffer]}}negotiateSharedFramePath(e){var t;return this.Module.HEAPU8.buffer instanceof SharedArrayBuffer?((t=this.sharedFrameMemAddressSlotPool)==null||t.dispose(e=>this.Module.deleteUint8Array(e)),this.sharedFrameMemAddressSlotPool=s.create({memAddressSlotCount:e.memAddressSlotCount,memAddressSlotByteLength:e.memAddressSlotByteLength,allocateUint8Array:e=>this.Module.allocateUint8Array(e),getHeapBuffer:()=>this.Module.HEAPU8.buffer}),{payload:this.sharedFrameMemAddressSlotPool.buffers}):{payload:null}}processFrameFromMemAddressSlot(e){var t;if(this.context==null||this.sharedFrameMemAddressSlotPool==null)return;let n=this.sharedFrameMemAddressSlotPool.beginProcessing(e.memAddressSlotIndex);if(n==null)return;this.lastFrameId=e.frameId,this.lastFrameColorType=e.colorType===`GRAYSCALE`?`GRAYSCALE`:`RGBA`;let r=e.colorType===`GRAYSCALE`?this.Module.ImageBufferFormat.Grayscale8:this.Module.ImageBufferFormat.Rgba8888;(t=this.imageFrameSource)==null||t.outputFrame(n.address,e.width,e.height,r);let i=this.Module.allocateUint8Array(this.sharedFrameMemAddressSlotPool.buffers.memAddressSlotByteLength);this.sharedFrameMemAddressSlotPool.release(n.index,i)}reportCameraProperties(e){this.context.setCameraProperties(e.deviceId,e.isFrontFacing,e.hasAutofocus)}requestFrameData(e){let t=this.frameDataPool.get(e);if(t==null)return{payload:{data:null,frameId:null,colorType:null}};if(t.data.buffer.byteLength===0)return this.frameDataPool.delete(e),{payload:{data:null,frameId:null,colorType:null}};let n=t.data;t.colorType===`GRAYSCALE`&&(n=O(t.data,t.width,t.height));let r={payload:{data:n,frameId:t.frameId,colorType:t.colorType},transferables:[n.buffer]};return this.frameDataPool.delete(e),r}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 n;this.lastUsedModuleMirrorAxis=this.mapMirrorAxisOnModule(e),(n=this.imageFrameSource)==null||n.delete(),this.imageFrameSource=new this.Module.ImageBufferFrameSource(this.lastUsedModuleMirrorAxis,t,0),this.context.setFrameSource(this.imageFrameSource)}startDrawLoop(e){this.isDrawLoopRunning=!0;let t=e=>this.redrawRequests.length>0&&this.redrawRequests[0]<=e,n=e=>{for(;this.redrawRequests.length>0&&this.redrawRequests[0]<=e;)this.redrawRequests.shift()},r=()=>{this.loopTimeoutId=setTimeout(()=>{if(!this.isDrawLoopRunning)return;let i=performance.now();if(t(i)){n(i),e.draw();let t=e.getDrawCommands();this.sendViewRefreshCommands(new Uint8Array(t))}r()},this.redrawInterval)};r()}updateContext(e){if(this.context!=null&&this.contextDeserializer!=null){e.view!=null&&!e.view.visible&&this.context.flushAnalytics();let t=this.onBeforeUpdateContextHook(e),r=this.contextDeserializer.updateContextFromJson(this.context,this.view,JSON.stringify(t.context));if(r==null){let e=this.contextDeserializer.getLastError();throw Error(`Could not update the context: ${e}`)}this.context.delete(),this.context=r.getContext(),this.insufficientMultithreadingReported=!1;let i=r.getView();r.delete(),i!=null&&t.view!=null&&(i.setViewSize(t.view.width,t.view.height,t.view.orientation),i.draw()),!this.hintPresenterV2&&this.webPlatformHintPresenter&&(this.hintPresenterV2=new this.Module.HintPresenterV2(this.webPlatformHintPresenter)),i!=null&&this.hintPresenterV2&&i.setHintPresenterV2(this.hintPresenterV2),this.gestureRecognizer!=null&&i?.setGestureRecognizer(this.gestureRecognizer),this.setView(i),this.notifyMainThreadOnViewInfoChanged(i),n.debug(`context updated`,t)}}notifyMainThreadOnViewInfoChanged(e){let t=this.getViewInfo(e);this.lastViewInfo.isSame(t)||(this.lastViewInfo.update(t),this.workerFunctions.postMessage({type:`viewSizeChanged`,payload:t}))}getViewInfo(e){if(e!=null)try{let t=JSON.parse(e.getViewInfo());if(t!=null){let e=this.getOrientationFromNumber(t.orientation);return{...t,orientation:e}}}catch(e){n.error(`Failed to get view size`,e)}return null}getOrientationFromNumber(e){switch(e){case 90:return`landscapeRight`;case 180:return`portraitUpsideDown`;case 270:return`landscapeLeft`;default:return`portrait`}}onBeforeUpdateContextHook(e){return e}onDocumentVisibilityChange(e){e===`hidden`&&this.context.flushAnalytics()}isFeatureSupported(e){return{payload:{supported:this.context.isFeatureSupported(e)}}}getViewfinderInfo(){return{payload:{isDisplayingViewfinder:this.view?.isDisplayingViewfinder()??!1,rect:JSON.parse(this.view.getViewfinderRect())}}}getOpenSourceSoftwareLicenseInfo(){return{payload:{licenseText:this.Module.OpenSourceSoftwareLicenseInfo.getLicenseText()}}}getWasmDynamicLibraries(e){return this.getWasmSideModuleFileName()==null?[]:[`${e.replace(/\/[^/]*$/,`/`)}${this.getWasmSideModuleFileName()}`]}getWasmCoreExpectedHash(e,t){return t?e?`28defafb82ee027a01e6dab69a37b431aee00e9aa588947cbfaf514d1f35c368`:`ffbff4a25ce91b79fd164cecea5a3a5579de10c8cb0d52b37ed2fb81f0870c60`:e?`aeba880e156e4ba7ba8ec6b2bfb0c53a01ac7bbdfafeaf8434dad47934f6aa62`:``}getWasmCoreFileName(e,t){return t?e?`scandit-datacapture-sdk-barcode-simd-pthreads.wasm`:`scandit-datacapture-sdk-barcode-pthreads.wasm`:e?`scandit-datacapture-sdk-barcode-simd.wasm`:``}getWasmMetadata(){return{"scandit-datacapture-sdk-barcode-simd-pthreads.wasm":{bytes:7682723},"scandit-datacapture-sdk-barcode-pthreads.wasm":{bytes:7730691},"scandit-datacapture-sdk-barcode-simd.wasm":{bytes:7740383},"scandit-datacapture-sdk-barcode.wasm":{bytes:7802746}}}getWasmSideModuleFileName(){return``}_loadProgressCallback(e){this.workerFunctions.postMessage({type:`loadLibraryProgress`,payload:e})}addRedrawRequest(e){this.redrawRequests.push(Math.round(performance.now())+e),this.redrawRequests.sort((e,t)=>e-t)}contextDidChangeStatus(e){e.code===260?e.message=e.message.replace(`domain name`,`domain name (${T(location)})`):e.code===265?e.message=e.message.replace(`domain name`,`domain name (${this.parentDomain})`):e.code===28&&(e.message+=` Resource files were expected at "${this.resourcePath}". This can be caused by a version mismatch, e.g. a browser or CDN cache still holding files from a previous SDK version. Please ensure the correct Scandit Data Capture resource files (with correct version) are retrieved.`),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??(this.isDrawLoopRunning=!1,this.sendViewRefreshCommands(new Uint8Array([])))}addNativeOverlay(e){n.warn(`addNativeOverlay has not been implemented for this module`,e)}removeNativeOverlay(e){n.warn(`removeNativeOverlay has not been implemented for this module`,e)}setViewRefreshHandler(e){if(e==null||e.isViewRefreshHandlerSet)return;let t=new(this.Module.NeedsRedrawDelegate.extend(`NeedsRedrawDelegate`,{setNeedsRedrawIn:this.scheduleRedraw.bind(this,e)}));e.setNeedsRedrawDelegate(t),e.isViewRefreshHandlerSet=!0}setupDataDecoding(){let e=this.moduleHandler.get(),t=e.DataDecoding.extend(`DataDecoding`,{decode(e,t){try{let n=JSON.parse(t),r=[];for(let t of n){let n=new TextDecoder(t.ianaName,{fatal:!0});r.push(n.decode(e.slice(t.startIndex,t.endIndex)))}return r.join(``)}catch{return``}}});e.setDataDecoding(new t)}getBatteryData(){var e;let t=(e=this.deviceInfo)==null||(e=e.batteryInfo)==null?void 0:e.percentage;if(t!=null)return{percentage:t}}isTablet(){return this.deviceInfo?.isTablet??!1}setupDeviceInterface(e,t){this.deviceInfo={isTablet:e,batteryInfo:t};let n=this.moduleHandler.get(),r=n.DeviceInterface.extend(`DeviceInterface`,{getBatteryData:this.getBatteryData.bind(this),isTablet:this.isTablet.bind(this)});this.deviceInstance=new r,n.DeviceHolder.setCurrentDevice(this.deviceInstance)}updateBatteryInfo(e){this.deviceInfo&&(this.deviceInfo.batteryInfo=e)}start(e,t,n){e&&t&&(this.setupDataDecoding(),this.moduleHandler.get().callMain(),this.moduleHandler.get().__emscripten_proxy_main===void 0&&n())}getWritableDataPath(e){return e==null?this.writableDataPathStandard:(n.debug(`IndexedDB database name override in use to recover from blocked standard database: ${e}`),e)}numOfMBToPages(e){return Math.ceil(1024*e*1024/64/1024)}async setup({libraryLocation:e,locationPath:t,writableDataPathOverride:i,indexedDBTimeoutMs:a,verifyResponseHash:s,referredOrigin:u,fixedWasmMemory:d,simdSupport:f,threadsSupport:p}){let m=!1,h=!1;this.threadsSupport=p,this.writableDataPath=this.getWritableDataPath(i),this.resourcePath=`${e}${this.resourceFilesSubfolder}/`,globalThis.path=t;let{resolve:g,reject:_,promise:v}=new c,y=l.sdkVersion();if(y===``)throw new r({name:`Invalid library version`,message:`Library version is not defined or empty, cannot generate proper path to library files.`});let{jsURI:b,wasmURI:x}=o(y,e,this.getWasmCoreFileName(f,p)),S={instantiateWasm:(e,t)=>(C({importObject:e,wasmURI:x,expectedHash:this.getWasmCoreExpectedHash(f,p),verifyResponseHash:s,successCallback:t,progressCallback:this._loadProgressCallback,errorCallback:e=>{_(e)},referredOrigin:u}),{})},w=d===null?null:new WebAssembly.Memory({initial:this.numOfMBToPages(d),maximum:this.numOfMBToPages(300),shared:p});return w!==null&&n.log(n.Level.Debug,`Fixed wasmMemory set`,w),this.moduleHandler.set({...w?{wasmMemory:w}:{},mainScriptUrlOrBlob:b,canvas:this.workerFunctions.getOffscreenCanvas()??{getContext:()=>null},...S,dynamicLibraries:this.getWasmDynamicLibraries(x),locateFile:t=>e+t,noInitialRun:!0,preRun:[async()=>{try{await ee({writableDataPath:this.writableDataPath,indexedDBTimeoutMs:a})}catch(e){if(e.name===`BlockedIndexedDB`){_(e.toString());return}n.log(n.Level.Debug,`No IndexedDB support, some data will not be persisted:`,e)}h=!0,this.start(h,m,g)}],onMainComplete:()=>{if([m,h].includes(!1)){n.log(n.Level.Warn,{runtimeLoaded:m,fileSystemSynced:h},`Both runtimeLoaded and fileSystemSynced should be true when calling onMainComplete`),_(`onMainComplete has been called but runtime or file system was not ready.`);return}g()},onRuntimeInitialized:()=>{m=!0,this.start(h,m,g)},print:e=>{n.info(e)}}),await D(b,y)||_(`Couldn't retrieve Scandit Data Capture library at ${b}, did you configure the path for it correctly?`),v}};j.get3dPartyLicenseKeyMethodName=atob(`Z2V0QmxpbmtJZExpY2Vuc2VLZXk=`);function M(e){console.warn(`Reached unexpected case`,e)}function N(e){return typeof e==`object`&&!!e&&e.document==null&&`addEventListener`in e&&typeof e.importScripts==`function`}var P=class{constructor(e){if(typeof e!=`function`)throw TypeError(`FinalizationRegistry callback must be a function`)}register(e,t,n){}unregister(e){return!1}};function F(e){e.FinalizationRegistry===void 0&&(e.FinalizationRegistry=P)}var I=class{constructor(e,t){this.onMessageListener=this.onMessage.bind(this),this.workerSelf=e,this.dataCaptureInstance=new j(t,{postMessage:this.postMessage.bind(this),getOffscreenCanvas:this.getOffscreenCanvas.bind(this)}),N(e)&&(F(e),this.listenToMessages())}listenToMessages(){this.workerSelf.addEventListener(`message`,this.onMessageListener),this.workerSelf.addEventListener(`error`,e=>{n.log(n.Level.Error,e)}),this.workerSelf.addEventListener(`messageerror`,e=>{n.log(n.Level.Error,e)})}postMessage(e,t){this.workerSelf.postMessage(e,t??[])}getOffscreenCanvas(){if(this.isOffscreenCanvasSupported())return new this.workerSelf.OffscreenCanvas(32,32)}isOffscreenCanvasSupported(){return typeof this.workerSelf.OffscreenCanvas==`function`}hasPayload(t){return e(t)&&`payload`in t}hasTransferables(t){return e(t)&&Array.isArray(t.transferables)}async respondWith(e,n,r){let i=null,a;try{a=r(),a instanceof Promise&&(a=await a)}catch(e){a=void 0,i=t(e)}let o={type:`workerTaskId`,command:e,id:n,payload:this.hasPayload(a)?a.payload:void 0};i!=null&&(o.error=i),this.postMessage(o,this.hasTransferables(a)?a.transferables:[])}onMessage(e){switch(e.data.command){case`loadLibrary`:{let{data:t}=e;this.respondWith(t.command,t.id,async()=>this.dataCaptureInstance.loadLibrary({libraryLocation:t.libraryLocation,locationPath:t.locationPath,referredOrigin:t.referredOrigin,writableDataPathOverride:t.writableDataPathOverride,threadsSupport:t.threadsSupport,simdSupport:t.simdSupport,verifyResponseHash:t.verifyResponseHash,fixedWasmMemory:t.fixedWasmMemory,indexedDBTimeoutMs:t.indexedDBTimeoutMs}))}break;case`onTap`:{let{data:t}=e;this.respondWith(t.command,t.id,async()=>{this.dataCaptureInstance.onTap(t.point)})}break;case`hintPresenterV2update`:{let{data:t}=e;this.respondWith(t.command,t.id,async()=>{this.dataCaptureInstance.hintPresenterV2Update()})}break;case`createContext`:{let{data:t}=e;this.respondWith(t.command,t.id,()=>this.dataCaptureInstance.createContext({context:t.context,deviceId:t.deviceId,highEndBlurryRecognition:t.highEndBlurryRecognition,appName:t.appName,parentDomain:t.parentDomain,isTablet:t.isTablet,batteryInfo:t.batteryInfo}))}break;case`setFrameSource`:{let{data:t}=e;this.respondWith(t.command,t.id,()=>this.dataCaptureInstance.setFrameSource(t.mirrorAxis,t.isCameraFrameSource))}break;case`processFrame`:{let{data:t}=e;this.respondWith(t.command,t.id,()=>this.dataCaptureInstance.processFrame({data:t.data,frameId:t.frameId,width:t.width,height:t.height,colorType:t.colorType}))}break;case`negotiateSharedFramePath`:{let{data:t}=e;this.respondWith(t.command,t.id,()=>this.dataCaptureInstance.negotiateSharedFramePath({memAddressSlotByteLength:t.memAddressSlotByteLength,memAddressSlotCount:t.memAddressSlotCount}))}break;case`processFrameFromMemAddressSlot`:{let{data:t}=e;this.respondWith(t.command,t.id,()=>this.dataCaptureInstance.processFrameFromMemAddressSlot({memAddressSlotIndex:t.memAddressSlotIndex,frameId:t.frameId,width:t.width,height:t.height,colorType:t.colorType}))}break;case`requestFrameData`:{let{data:t}=e;this.respondWith(t.command,t.id,()=>this.dataCaptureInstance.requestFrameData(t.frameId))}break;case`deleteFrameData`:{let{data:t}=e;this.respondWith(t.command,t.id,()=>{this.dataCaptureInstance.deleteFrameData(t.frameId)})}break;case`updateContext`:{let{data:t}=e;this.respondWith(t.command,t.id,async()=>this.dataCaptureInstance.updateContext(t))}break;case`dispose`:this.respondWith(e.data.command,e.data.id,()=>this.dataCaptureInstance.dispose());break;case`flushAnalytics`:this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.flushAnalytics()});break;case`reportCameraProperties`:{let{data:t}=e;this.respondWith(t.command,t.id,async()=>this.dataCaptureInstance.reportCameraProperties(t))}break;case`setLogLevel`:{let{data:t}=e;this.respondWith(t.command,t.id,()=>{n.setLevel(t.level)})}break;case`updateBatteryInfo`:{let{data:t}=e;this.respondWith(t.command,t.id,()=>{this.dataCaptureInstance.updateBatteryInfo(t.batteryInfo)})}break;case`extractCentaurusLicense`:{let{data:t}=e;this.respondWith(t.command,t.id,()=>this.dataCaptureInstance.extractCentaurusLicense(t.licenseKey))}break;case`documentVisibility`:{let{data:t}=e;this.respondWith(t.command,t.id,()=>{this.dataCaptureInstance.onDocumentVisibilityChange(t.state)})}break;case`isFeatureSupported`:{let{data:t}=e;this.respondWith(t.command,t.id,()=>this.dataCaptureInstance.isFeatureSupported(t.feature))}break;case`getViewfinderInfo`:{let{data:t}=e;this.respondWith(t.command,t.id,()=>this.dataCaptureInstance.getViewfinderInfo())}break;case`getOpenSourceSoftwareLicenseInfo`:{let{data:t}=e;this.respondWith(t.command,t.id,()=>this.dataCaptureInstance.getOpenSourceSoftwareLicenseInfo())}break;case`addNativeOverlay`:this.dataCaptureInstance.addNativeOverlay(e);break;case`removeNativeOverlay`:this.dataCaptureInstance.removeNativeOverlay(e);break;case`convertToJPEGResult`:{let{data:t}=e;this.dataCaptureInstance.convertToJPEGResult(t.imageId,t.result)}break;default:return M(e.data),!1}return!0}},L=class{constructor(e,t,n){this.barcodeAr=null,this.coreEngine=e,this.Module=t,this.workerFunctions=n}async forSettings(e){this.barcodeAr?.delete(),this.barcodeAr=new this.Module.BarcodeAr(this.coreEngine.context,JSON.stringify(e));let t=this.Module.BarcodeArListener.extend(`BarcodeArListener`,{didUpdateSession:(e,t,n)=>{let r=this.coreEngine.prepareFrameForListener(n);this.workerFunctions.postMessage({type:`barcodeArDidUpdateSession`,payload:{session:JSON.parse(t.toJsonIgnoringLicense()),frameData:r}}),e.delete(),t.delete(),n.delete()}});this.barcodeAr.addListener(new t,1),this.Module.addBarcodeArToContext(this.coreEngine.context,this.barcodeAr),this.coreEngine.reportInsufficientMultithreadingIfNeeded(`BarcodeAr`)}start(){this.barcodeAr?.start()}pause(){this.barcodeAr?.pause()}stop(){this.barcodeAr?.stop()}setEnabled(e){this.barcodeAr?.setEnabled(e)}async removeMode(){this.barcodeAr!=null&&this.Module.removeBarcodeArFromContext(this.coreEngine.context,this.barcodeAr)}applySettings(e){this.barcodeAr?.applySettings(JSON.stringify(e))}},R=class{constructor(e,t,n){this.coreEngine=e,this.Module=t,this.workerFunctions=n,this.setup()}barcodeBatchDidUpdateSession(e){this.workerFunctions.postMessage({type:`barcodeBatchDidUpdateSession`,payload:JSON.parse(e.toJson())})}getBatchDeserializer(){return this.barcodeBatchDeserializer}setup(){let e=new(this.Module.BarcodeBatchListener.extend(`BarcodeTrackingListener`,{didUpdateSession:(e,t,n)=>{this.barcodeBatchDidUpdateSession(t),e.delete(),t.delete(),n.delete()},onTrackedBarcodeTapped:(e,t)=>{this.onTrackedBarcodeTapped(t),e.delete(),t.delete()}})),t=this.Module.BarcodeBatchDeserializerListener.extend(`BarcodeTrackingDeserializerListener`,{onModeDeserializationFinished:(t,n,r)=>{n.addListener(e,1),this.coreEngine.reportInsufficientMultithreadingIfNeeded(`BarcodeBatch`),t.delete(),n.delete(),r.delete()},onModeDeserializationStarted(e,t,n){e.delete(),t.delete(),n.delete()},onSettingsDeserializationStarted(e,t,n){e.delete(),t.delete(),n.delete()},onSettingsDeserializationFinished(e,t,n){e.delete(),t.delete(),n.delete()}});this.barcodeBatchDeserializer=new this.Module.BarcodeBatchDeserializer,this.barcodeBatchDeserializer.setListener(new t)}onTrackedBarcodeTapped(e){this.workerFunctions.postMessage({type:`didTapTrackedBarcode`,payload:JSON.parse(e.toJson())})}},z=class{constructor(e,t,n){this.captureListenerSet=!1,this.coreEngine=e,this.Module=t,this.workerFunctions=n,this.setup()}barcodeCaptureDidUpdateSession(e){this.workerFunctions.postMessage({type:`barcodeCaptureDidUpdateSession`,payload:JSON.parse(e.toJson())})}barcodeBatchDidUpdateSession(e){this.workerFunctions.postMessage({type:`barcodeBatchDidUpdateSession`,payload:JSON.parse(e.toJson())})}getCaptureDeserializer(){return this.barcodeCaptureDeserializer}getTrackingDeserializer(){return this.barcodeBatchDeserializer}setup(){let e=this.Module.BarcodeCaptureListener.extend(`BarcodeCaptureListener`,{didScan:(e,t,n)=>{this.barcodeCaptureDidScan(t,n),e.delete(),n.delete(),t.delete()},didUpdateSession:(e,t,n)=>{this.barcodeCaptureDidUpdateSession(t),e.delete(),n.delete(),t.delete()}}),t=this.Module.Feedback.extend(`Feedback`,{emit:()=>{this.successFeedback()}}),n=new e,r=new t,i=this.Module.BarcodeCaptureDeserializerListener.extend(`BarcodeCaptureDeserializerListener`,{onModeDeserializationFinished:(e,t,i)=>{t.addListener(n,1),t.setSuccessFeedback(r),e.delete(),t.delete(),i.delete()},onModeDeserializationStarted(e,t,n){e.delete(),t.delete(),n.delete()},onSettingsDeserializationStarted(e,t,n){e.delete(),t.delete(),n.delete()},onSettingsDeserializationFinished(e,t,n){e.delete(),t.delete(),n.delete()}});this.barcodeCaptureDeserializer=new this.Module.BarcodeCaptureDeserializer,this.barcodeCaptureDeserializer.setListener(new i)}successFeedback(){this.workerFunctions.postMessage({type:`successFeedback`})}barcodeCaptureDidScan(e,t){let n=this.coreEngine.prepareFrameForListener(t);this.workerFunctions.postMessage({type:`barcodeCaptureDidScan`,payload:{session:JSON.parse(e.toJson()),frameData:n}})}};function B(e){return e.charAt(0).toUpperCase()+e.slice(1)}function V(e){return e}var H=class{constructor(e,t,n){this.barcodeFind=null,this.basicOverlay=null,this.transparentGuidanceHintStyle={backgroundColor:`00000000`,cornerRadius:4,fitToText:!1,isAnimatedToView:!1,textAlignment:`center`,hintIcon:`none`,hintAnchor:`center`,hintAnchorOffset:0,horizontalMargin:0,iconColor:`00000000`,lineHeight:-1,maxLines:1,maxWidthFraction:.8,textColor:`ffffffff`,textSize:15,textWeight:600},this.customerTransformation=V,this.coreEngine=e,this.Module=t,this.workerFunctions=n}async forSettings(e){this.barcodeFind?.delete(),this.barcodeFind=new this.Module.BarcodeFind(this.coreEngine.context,JSON.stringify(e));let t=this.Module.Feedback.extend(`Feedback`,{emit:()=>{this.listUpdatedFeedback()}}),n=this.Module.Feedback.extend(`Feedback`,{emit:()=>{this.barcodeFindFeedback()}}),r=this.Module.BarcodeFindTransformer.extend(`BarcodeFindTransformer`,{transformBarcodeData:e=>this.customerTransformation(e)}),i=this.Module.BarcodeFindListener.extend(`BarcodeFindListener`,{didUpdateSession:(e,t,n)=>{let r=this.coreEngine.prepareFrameForListener(n);this.workerFunctions.postMessage({type:`barcodeFindDidUpdateSession`,payload:{session:JSON.parse(t.toJsonIgnoringLicense()),frameData:r}}),e.delete(),t.delete(),n.delete()},onSearchPaused:e=>{let t=[];for(let n=0;n<e.size();n++)t.push(e.get(n));this.workerFunctions.postMessage({type:`barcodeFindSearchPaused`,payload:{foundItems:t}})},onSearchStopped:e=>{let t=[];for(let n=0;n<e.size();n++)t.push(e.get(n));this.workerFunctions.postMessage({type:`barcodeFindSearchStopped`,payload:{foundItems:t}})},onSearchStarted:()=>{this.workerFunctions.postMessage({type:`barcodeFindSearchStarted`,payload:{}})}});this.barcodeFind.setBarcodeFindTransformer(new r),this.barcodeFind.addListener(new i,1),this.barcodeFind.setItemListUpdatedFeedback(new t),this.barcodeFind.setFeedback(new n),this.Module.addBarcodeFindToContext(this.coreEngine.context,this.barcodeFind),this.coreEngine.reportInsufficientMultithreadingIfNeeded(`BarcodeFind`)}barcodeFindFeedback(){this.workerFunctions.postMessage({type:`barcodeFindFeedback`,payload:{}})}start(){this.barcodeFind?.start()}stop(){this.barcodeFind?.stop()}pause(){this.barcodeFind?.pause()}setEnabled(e){this.barcodeFind?.setEnabled(e)}setItemList(e){this.barcodeFind?.setItemList(JSON.stringify(e))}async removeMode(){this.barcodeFind!=null&&this.Module.removeBarcodeFindFromContext(this.coreEngine.context,this.barcodeFind)}addBasicOverlay(){this.basicOverlay?.delete(),this.basicOverlay=null,this.barcodeFind!=null&&(this.basicOverlay=new this.Module.BarcodeFindBasicOverlay(this.barcodeFind)),this.coreEngine.view!=null&&this.basicOverlay!=null&&(this.basicOverlay.setGuidanceHandler(this.createWebFindGuidanceHandler()),this.Module.addBarcodeFindBasicOverlayToView(this.coreEngine.view,this.basicOverlay))}removeBasicOverlay(){this.coreEngine.view!=null&&this.basicOverlay!=null&&this.Module.removeBarcodeFindBasicOverlayFromView(this.coreEngine.view,this.basicOverlay)}async applySettings(e){this.barcodeFind?.applySettings(JSON.stringify(e))}updateBasicOverlay(e){let t=Object.entries(e).filter(([e,t])=>e!==`type`);for(let[e,n]of t){let t=`set${B(e)}`;this.basicOverlay!=null&&typeof this.basicOverlay[t]==`function`&&n!=null&&this.basicOverlay[t](n)}}setTransformerFunction(e){this.customerTransformation=e??V}successFeedback(){this.workerFunctions.postMessage({type:`successFeedback`})}listUpdatedFeedback(){this.workerFunctions.postMessage({type:`barcodeFindListUpdatedFeedback`,payload:{}})}setToast(e,t){let n=this.coreEngine.hintPresenterV2;e?n?.showToast(JSON.stringify(t)):n?.hideToast(t.tag)}setGuidance(e,t,n){let r={tag:n,text:t,hintStyle:this.transparentGuidanceHintStyle};this.workerFunctions.postMessage({type:e?`showGuidance`:`hideGuidance`,payload:r})}createWebFindGuidanceHandler(){return new(this.Module.BarcodeFindGuidanceHandler.extend(`BarcodeFindGuidanceHandler`,{setInitialGuidance:(e,t)=>{this.setGuidance(e,t,`InitialGuidance`)},setMoveCloserGuidance:(e,t)=>{this.setGuidance(!1,t,`InitialGuidance`),this.setGuidance(e,t,`MoveCloserGuidance`)},setTapShutterToPause:(e,t)=>{this.setGuidance(!1,t,`InitialGuidance`),this.setGuidance(e,t,`TapShutterToPause`)},setTapShutterToResume:(e,t)=>{this.setGuidance(!1,t,`InitialGuidance`),this.setGuidance(e,t,`TapShutterResume`)}}))}},U=class{constructor(e){this.subscribers=new Set,this.property={key:e,value:null}}addSubscriber(e){this.subscribers.add(e),e.onPropertyChanged?.(this.property)}removeSubscriber(e){this.subscribers.delete(e)}setProperty(e){if(this.property.value!==e.value){this.property={key:this.property.key,value:e.value};for(let e of this.subscribers)e.onPropertyChanged?.(this.property)}}};let W={torch_state:new U(`torch_state`),scanning_mode:new U(`scanning_mode`),sound_enabled:new U(`sound_enabled`),haptic_enabled:new U(`haptic_enabled`),session_stop_reason:new U(`session_stop_reason`),camera_position:new U(`camera_position`)};var G=class{getBehaviorSubject(e){return W[e]}},K=class{constructor(e,t,n){this.captureListenerSet=!1,this.propertyPushSource=new G,this.coreEngine=e,this.Module=t,this.workerFunctions=n,this.setup()}sparkScanDidUpdateSession(e){this.workerFunctions.postMessage({type:`sparkScanDidUpdateSession`,payload:JSON.parse(e.toJson())})}getSparkScanDeserializer(){return this.sparkScanDeserializer}setup(){let e=this.Module.SparkScanListener.extend(`SparkScanListener`,{didScan:(e,t,n)=>{this.sparkScanDidScan(t,n),e.delete(),t.delete(),n.delete()},didUpdateSession:(e,t,n)=>{this.sparkScanDidUpdateSession(t),e.delete(),t.delete(),n.delete()}}),t=this.Module.Feedback.extend(`Feedback`,{emit:()=>{this.successFeedback()}}),n=this.Module.SparkScanDeserializerListener.extend(`SparkScanDeserializerListener`,{onModeDeserializationFinished:(n,r,i)=>{if(!this.captureListenerSet){r.addListener(new e,1),r.setSuccessFeedback(new t),r.setPropertyPushSource(this.propertyPushSource);let n=new(this.Module.SparkScanViewHandlerDelegate.extend(`SparkScanViewHandlerDelegate`,{onSwitchedAwayFromSmartScanSelection:()=>{this.workerFunctions.postMessage({type:`sparkScanSwitchedAwayFromSmartScanSelection`})},onSwitchedToSmartScanSelection:()=>{this.workerFunctions.postMessage({type:`sparkScanSwitchedToSmartScanSelection`})},enableHapticWhenOverlapping:()=>{},onStateTransition:()=>{},resetAllTimers:()=>{}})),i=r.getStateMachine();i.setViewHandlerDelegate(n),n.delete(),i.delete(),this.sparkScan=r.clone(),this.captureListenerSet=!0}this.coreEngine.reportInsufficientMultithreadingIfNeeded(`SparkScan`),n.delete(),i.delete(),r.delete()},onModeDeserializationStarted(e,t,n){e.delete(),t.delete(),n.delete()},onSettingsDeserializationStarted(e,t,n){e.delete(),t.delete(),n.delete()},onSettingsDeserializationFinished(e,t,n){e.delete(),t.delete(),n.delete()},onOverlayDeserializationStarted(e,t,n){e.delete(),t.delete(),n.delete()},onOverlayDeserializationFinished:(e,t,n)=>{this.sparkScanOverlay?.delete(),this.sparkScanOverlay=t,e.delete(),n.delete()}});this.sparkScanDeserializer=new this.Module.SparkScanDeserializer,this.sparkScanDeserializer.setListener(new n)}emitErrorFeedback(e){this.sparkScanOverlay?.onErrorFeedbackEmitted(e)}overlayReadyForDraw(){this.sparkScanOverlay?.onReadyForNewData()}discardEnqueuedData(){this.sparkScanOverlay?.discardEnqueuedData()}analyticsManagerPropertyChanged(e){this.propertyPushSource.getBehaviorSubject(e.key).setProperty(e)}successFeedback(){this.workerFunctions.postMessage({type:`successFeedback`})}selectItemWithSmartScanSelection(){this.sparkScan?.selectItemWithSmartScanSelectionAsync()}async removeMode(){this.captureListenerSet=!1,this.sparkScan?.delete(),this.sparkScan=void 0,this.sparkScanOverlay?.delete(),this.sparkScanOverlay=void 0}sparkScanDidScan(e,t){let n=this.coreEngine.prepareFrameForListener(t);this.workerFunctions.postMessage({type:`sparkScanDidScan`,payload:{session:JSON.parse(e.toJson()),frameData:n}})}},q=class extends j{constructor(e,t){super(e,t)}getModeDeserializers(){this.barcodeCaptureMode=new z(this,this.Module,this.workerFunctions),this.barcodeBatchMode=new R(this,this.Module,this.workerFunctions),this.sparkScanMode=new K(this,this.Module,this.workerFunctions),this.barcodeFindMode=new H(this,this.Module,this.workerFunctions),this.barcodeArMode=new L(this,this.Module,this.workerFunctions);let e=super.getModeDeserializers();return e.push_back(this.barcodeCaptureMode.getCaptureDeserializer()),e.push_back(this.barcodeBatchMode.getBatchDeserializer()),e.push_back(this.sparkScanMode.getSparkScanDeserializer()),e}getWasmSideModuleFileName(){return``}getWasmCoreFileName(e,t){return t?e?`scandit-datacapture-sdk-barcode-simd-pthreads.wasm`:`scandit-datacapture-sdk-barcode-pthreads.wasm`:e?`scandit-datacapture-sdk-barcode-simd.wasm`:`scandit-datacapture-sdk-barcode.wasm`}getWasmCoreExpectedHash(e,t){return t?e?`28defafb82ee027a01e6dab69a37b431aee00e9aa588947cbfaf514d1f35c368`:`ffbff4a25ce91b79fd164cecea5a3a5579de10c8cb0d52b37ed2fb81f0870c60`:e?`aeba880e156e4ba7ba8ec6b2bfb0c53a01ac7bbdfafeaf8434dad47934f6aa62`:`e7e09162e2fca92306953267c2b3e851fb71c14d5348c4ea0cad3dbf491081b1`}getWasmMetadata(){return{"scandit-datacapture-sdk-barcode-simd-pthreads.wasm":{bytes:7682723},"scandit-datacapture-sdk-barcode-pthreads.wasm":{bytes:7730691},"scandit-datacapture-sdk-barcode-simd.wasm":{bytes:7740383},"scandit-datacapture-sdk-barcode.wasm":{bytes:7802746}}}};function re(e){return(e=>/^[$A-Z_a-z][\w$]*\s*\(.*\)\s*\{/.test(e)&&!e.startsWith(`function`))(e)?`function ${e}`:e}let J=[`fetch`,`XMLHttpRequest`,`eval`,`Function`,`self`,`globalThis`,`Module`,`importScripts`,`this`,`console`,`window`,`document`,`import`,`Worker`,`ServiceWorker`,`with`,`Reflect`,`Proxy`],Y=[`constructor`,`__proto__`];function X(e,t){let n=t+2,r=e.length;for(;n<r&&!(e[n]===`*`&&n+1<r&&e[n+1]===`/`);)n++;return Math.min(r,n+2)}function ie(e,t){let n=t+2,r=e.length;for(;n<r&&e[n]!==`
2
- `&&e[n]!==`\r`;)n++;return n}function Z(e,t,n){let r=t+1,i=e.length;for(;r<i&&e[r]!==n&&e[r]!==`
3
- `&&e[r]!==`\r`;)r+=e[r]===`\\`&&r+1<i?2:1;return r<i&&e[r]===n?r+1:r}function ae(e){let t=``,n=0,r=e.length;for(;n<r;){let i=e[n],a=n+1<r?e[n+1]:``;if(i===`/`&&a===`*`){n=X(e,n);continue}if(i===`/`&&a===`/`){n=ie(e,n);continue}if(i===`'`||i===`"`){t+=i+i,n=Z(e,n,i);continue}if(i==="`"){let r=Q(e,n);t+=r.text,n=r.next;continue}t+=i,n++}return t}function Q(e,t){let n=t+1,r=e.length,i=[];for(;n<r&&e[n]!=="`";){if(e[n]===`\\`&&n+1<r){n+=2;continue}if(e[n]===`$`&&n+1<r&&e[n+1]===`{`){let t=n+2,r=oe(e,t);i.push(e.substring(t,r)),n=r+1;continue}n++}return{text:i.length===0?"``":`\`\`+(${i.join(`)+(`)})`,next:Math.min(r,n+1)}}function oe(e,t){let n=1,r=t,i=e.length;for(;r<i&&n>0;){let t=e[r];if(t===`{`)n++,r++;else if(t===`}`){if(n--,n===0)return r;r++}else t===`'`||t===`"`?r=Z(e,r,t):t==="`"?r=Q(e,r).next:t===`\\`&&r+1<i?r+=2:r++}return Math.min(i,r)}let se=/(['"`])((?:\\.|(?!\1).)*)\1\s*\+\s*(['"`])((?:\\.|(?!\3).)*)\3/g;function ce(e){let t,n=e;do t=n,n=t.replace(se,(e,t,n,r,i)=>`'${n}${i}'`);while(n!==t);return n}let le=[`getPrototypeOf`],ue=/^[$A-Z_a-z][\w$]*$/,de=/^-?\d+(?:\.\d+)?$/,fe=/^(?:""|''|``(?:\+\([^()]*\))*)$/,pe=new Set([`return`,`throw`,`typeof`,`void`,`delete`,`new`,`in`,`of`,`instanceof`,`await`,`yield`,`case`]);function $(e,t){let n=t-1;for(;n>=0&&/\s/.test(e[n]);)n--;if(n<0)return!1;let r=e[n];if(r===`)`||r===`]`)return!0;if(!/[\w$]/.test(r))return!1;let i=n+1;for(;n>=0&&/[\w$]/.test(e[n]);)n--;let a=e.substring(n+1,i);return!pe.has(a)}function me(e,t){let n=e.length,r=1,i=t+1;for(;i<n&&r>0;)e[i]===`[`?r++:e[i]===`]`&&r--,r>0&&i++;return i}function he(e){return e===``||ue.test(e)||de.test(e)||fe.test(e)}function ge(e){let t=e.length,n=0;for(;n<t;){if(e[n]!==`[`||!$(e,n)){n++;continue}let t=me(e,n);if(!he(e.substring(n+1,t).trim()))return!0;n=t+1}return!1}function _e(e){let t=ce(e),n=ae(t);for(let e of J)if(RegExp(`\\b${e}\\b`).test(n))return!0;for(let e of[...J,...Y])if(RegExp(`\\[\\s*(['"\`])${e}\\1\\s*\\]`).test(t))return!0;for(let e of Y)if(RegExp(`\\.\\s*${e}\\b`).test(n))return!0;for(let e of le)if(RegExp(`\\.\\s*${e}\\b`).test(n))return!0;return!!ge(n)}function ve(e){if(e==null)return null;let t=re(e);if(_e(t))throw Error(`Function should be pure. Shouldn't introduce side effects, or rely on global scope`);let n=new Set([`eval`,`this`,`import`,`with`]),r=`'use strict';
4
- return (function (${J.filter(e=>!n.has(e)).join(`,`)}) {
5
- return (${t});
6
- })();`;try{return Function(r)()}catch{return null}}new class extends I{constructor(e,t){super(e,t),this.dataCaptureInstance=new q(t,{postMessage:this.postMessage.bind(this),getOffscreenCanvas:this.getOffscreenCanvas.bind(this)})}async respondWith(e,n,r){let i=null,a;try{a=r(),a instanceof Promise&&(a=await a)}catch(e){a=void 0,i=t(e)}let o={type:`workerTaskId`,command:e,id:n,payload:this.hasPayload(a)?a.payload:void 0};i!=null&&(o.error=i),this.postMessage(o,this.hasTransferables(a)?a.transferables:[])}onMessage(e){switch(e.data.command){case`sparkScanEmitErrorFeedback`:{let{data:t}=e;return this.respondWith(t.command,t.id,()=>{this.dataCaptureInstance.sparkScanMode.emitErrorFeedback(t.shouldRemoveBrush)}),!0}case`sparkScanOverlayReadyForDraw`:{let{data:t}=e;return this.respondWith(t.command,t.id,()=>{this.dataCaptureInstance.sparkScanMode.overlayReadyForDraw()}),!0}case`sparkScanOverlayDiscardEnqueuedData`:{let{data:t}=e;return this.respondWith(t.command,t.id,()=>{this.dataCaptureInstance.sparkScanMode.discardEnqueuedData()}),!0}case`sparkScanAnalyticsManagerPropertyChanged`:{let{data:t}=e;return this.respondWith(t.command,t.id,async()=>{this.dataCaptureInstance.sparkScanMode.analyticsManagerPropertyChanged(t.property)}),!0}case`sparkScanSelectItemWithSmartScanSelection`:{let{data:t}=e;return this.respondWith(t.command,t.id,async()=>{this.dataCaptureInstance.sparkScanMode.selectItemWithSmartScanSelection()}),!0}case`sparkScanModeRemove`:{let{data:t}=e;return this.respondWith(t.command,t.id,async()=>this.dataCaptureInstance.sparkScanMode.removeMode()),!0}case`barcodeFindForSettings`:{let{data:t}=e;return this.respondWith(t.command,t.id,async()=>this.dataCaptureInstance.barcodeFindMode.forSettings(t.settings)),!0}case`barcodeFindModeRemove`:{let{data:t}=e;return this.respondWith(t.command,t.id,async()=>this.dataCaptureInstance.barcodeFindMode.removeMode()),!0}case`barcodeFindSearchStart`:return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.start()}),!0;case`barcodeFindSearchPause`:return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.pause()}),!0;case`barcodeFindSearchStop`:return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.stop()}),!0;case`barcodeFindSetItemList`:{let{data:t}=e;return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.setItemList(t.itemList)}),!0}case`barcodeFindSetEnabled`:{let{data:t}=e;return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.setEnabled(t.enabled)}),!0}case`barcodeFindApplySettings`:{let{data:t}=e;return this.respondWith(t.command,t.id,async()=>this.dataCaptureInstance.barcodeFindMode.applySettings(t.settings)),!0}case`barcodeFindAddBasicOverlay`:{let{data:t}=e;return this.respondWith(t.command,t.id,async()=>{this.dataCaptureInstance.barcodeFindMode.addBasicOverlay()}),!0}case`barcodeFindRemoveBasicOverlay`:{let{data:t}=e;return this.respondWith(t.command,t.id,async()=>{this.dataCaptureInstance.barcodeFindMode.removeBasicOverlay()}),!0}case`barcodeFindUpdateBasicOverlay`:{let{data:t}=e;return this.respondWith(t.command,t.id,async()=>{this.dataCaptureInstance.barcodeFindMode.updateBasicOverlay(t.jsonOverlay)}),!0}case`barcodeFindSetTransformerFunction`:{let{data:t}=e;return this.respondWith(t.command,t.id,async()=>{let e=ve(t.functionAsString);this.dataCaptureInstance.barcodeFindMode.setTransformerFunction(e)}),!0}case`barcodeArForSettings`:{let{data:t}=e;return this.respondWith(t.command,t.id,async()=>this.dataCaptureInstance.barcodeArMode.forSettings(t.settings)),!0}case`barcodeArModeRemove`:{let{data:t}=e;return this.respondWith(t.command,t.id,async()=>this.dataCaptureInstance.barcodeArMode.removeMode()),!0}case`barcodeArSearchStart`:return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeArMode.start()}),!0;case`barcodeArSearchPause`:return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeArMode.pause()}),!0;case`barcodeArSearchStop`:return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeArMode.stop()}),!0;case`barcodeArSetEnabled`:{let{data:t}=e;return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeArMode.setEnabled(t.enabled)}),!0}case`barcodeArApplySettings`:{let{data:t}=e;return this.respondWith(t.command,t.id,async()=>{this.dataCaptureInstance.barcodeArMode.applySettings(t.settings)}),!0}default:return super.onMessage(e)}}}(globalThis,{get:()=>globalThis.Module,set:e=>{globalThis.Module=e}})})();