@scandit/web-datacapture-barcode 7.5.1 → 7.6.0

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 (122) hide show
  1. package/build/js/BarcodeBatch.js +1 -1
  2. package/build/js/BarcodeBatchBasicOverlay.js +1 -1
  3. package/build/js/BarcodeBatchSettings.js +1 -1
  4. package/build/js/BarcodeCapture.js +1 -1
  5. package/build/js/BarcodeCaptureOverlay.d.ts +13 -1
  6. package/build/js/BarcodeCaptureOverlay.js +1 -1
  7. package/build/js/BarcodeCaptureSettings.js +1 -1
  8. package/build/js/Defaults.d.ts +0 -2
  9. package/build/js/Defaults.js +1 -1
  10. package/build/js/ar/BarcodeAr.js +1 -1
  11. package/build/js/ar/BarcodeArFeedback.js +1 -1
  12. package/build/js/ar/BarcodeArPresenter.d.ts +1 -0
  13. package/build/js/ar/BarcodeArPresenter.js +1 -1
  14. package/build/js/ar/BarcodeArSettings.js +1 -1
  15. package/build/js/ar/BarcodeArView.js +1 -1
  16. package/build/js/ar/hashedId.js +1 -1
  17. package/build/js/ar/ui/atoms/BarcodeArInfoAnnotationBodyComponent.js +1 -1
  18. package/build/js/ar/ui/organisms/BarcodeArAnnotation.d.ts +2 -1
  19. package/build/js/ar/ui/organisms/BarcodeArAnnotation.js +1 -1
  20. package/build/js/ar/ui/organisms/BarcodeArCircleHighlight.js +1 -1
  21. package/build/js/ar/ui/organisms/BarcodeArInfoAnnotation.js +1 -1
  22. package/build/js/ar/ui/organisms/BarcodeArResponsiveAnnotation.js +1 -1
  23. package/build/js/chunks/{chunk-RUJWPCWD.js → chunk-33EFB3RJ.js} +1 -1
  24. package/build/js/chunks/{chunk-4MCMAHRH.js → chunk-3UGEG7WU.js} +1 -1
  25. package/build/js/chunks/{chunk-HRQFPTLO.js → chunk-4ID5S6I7.js} +1 -1
  26. package/build/js/chunks/chunk-4QBAIUZM.js +1 -0
  27. package/build/js/chunks/{chunk-6BTYJ5FK.js → chunk-5FOX5H4M.js} +1 -1
  28. package/build/js/chunks/{chunk-EGQKRCPY.js → chunk-6BZ6LQZN.js} +1 -1
  29. package/build/js/chunks/{chunk-QD4KRTNG.js → chunk-6UIDWTVF.js} +1 -1
  30. package/build/js/chunks/chunk-7326DOBM.js +1 -0
  31. package/build/js/chunks/{chunk-JFBYWTLE.js → chunk-74HYYKNV.js} +1 -1
  32. package/build/js/chunks/chunk-A72EVAUC.js +1 -0
  33. package/build/js/chunks/{chunk-QSHIXKGN.js → chunk-FOF7XHKE.js} +1 -1
  34. package/build/js/chunks/{chunk-FBZ5PKNC.js → chunk-H65TOJXR.js} +1 -1
  35. package/build/js/chunks/{chunk-R2NJCFWO.js → chunk-HMU4GQFX.js} +1 -1
  36. package/build/js/chunks/chunk-I6GJ7OYJ.js +1 -0
  37. package/build/js/chunks/{chunk-K4D6B66I.js → chunk-IHFZ5YLD.js} +1 -1
  38. package/build/js/chunks/{chunk-QWZ3XB2O.js → chunk-IKMOZCI6.js} +1 -1
  39. package/build/js/chunks/{chunk-7GJVUU3G.js → chunk-JKO4EZPZ.js} +1 -1
  40. package/build/js/chunks/{chunk-QO2O2C3A.js → chunk-JZLJVB6X.js} +1 -1
  41. package/build/js/chunks/{chunk-S7ZLCH67.js → chunk-LBKCNRLC.js} +1 -1
  42. package/build/js/chunks/{chunk-CCW3WA5F.js → chunk-N6QWL4ZH.js} +2 -2
  43. package/build/js/chunks/{chunk-YWEQCCPA.js → chunk-NIO3PMWV.js} +1 -1
  44. package/build/js/chunks/{chunk-XSBIVLTL.js → chunk-NSRY32YC.js} +1 -1
  45. package/build/js/chunks/chunk-OLJXVUYE.js +1 -0
  46. package/build/js/chunks/{chunk-DVLPRWCY.js → chunk-OQVPV5PW.js} +1 -1
  47. package/build/js/chunks/chunk-OXYHO7V6.js +1 -0
  48. package/build/js/chunks/{chunk-VWW6BAVC.js → chunk-PK3NFWEV.js} +1 -1
  49. package/build/js/chunks/{chunk-RLKGZ42F.js → chunk-QIOYMBBP.js} +1 -1
  50. package/build/js/chunks/chunk-RXRQ4VLH.js +1 -0
  51. package/build/js/chunks/{chunk-GLJCW3XH.js → chunk-TFYQKG6K.js} +1 -1
  52. package/build/js/chunks/chunk-UXI6I6RZ.js +1 -0
  53. package/build/js/chunks/{chunk-3UDJKVMP.js → chunk-V633PC7B.js} +1 -1
  54. package/build/js/chunks/chunk-VDFHSUV6.js +1 -0
  55. package/build/js/chunks/{chunk-KCLART6S.js → chunk-VJ3VETQO.js} +1 -1
  56. package/build/js/chunks/{chunk-ORLJNUNA.js → chunk-WICRT6CF.js} +1 -1
  57. package/build/js/chunks/{chunk-GCYGJSSL.js → chunk-WVXIIQEO.js} +1 -1
  58. package/build/js/chunks/chunk-XGPORK2H.js +9 -0
  59. package/build/js/chunks/{chunk-ZWUKKWEI.js → chunk-YWNGCXKZ.js} +1 -1
  60. package/build/js/chunks/{chunk-2ASAIH4R.js → chunk-YZHF42BC.js} +1 -1
  61. package/build/js/chunks/{chunk-SIU6KWL7.js → chunk-Z5DDDHBV.js} +1 -1
  62. package/build/js/chunks/{chunk-UCHREILA.js → chunk-ZXTRTKEZ.js} +1 -1
  63. package/build/js/find/BarcodeFind.js +1 -1
  64. package/build/js/find/BarcodeFindFeedback.js +1 -1
  65. package/build/js/find/BarcodeFindPresenter.js +1 -1
  66. package/build/js/find/BarcodeFindSettings.js +1 -1
  67. package/build/js/find/BarcodeFindView.js +1 -1
  68. package/build/js/find/index.js +1 -1
  69. package/build/js/find/ui/molecules/TorchIconButton.js +1 -1
  70. package/build/js/index.d.ts +1 -1
  71. package/build/js/index.js +1 -1
  72. package/build/js/moduleLoader.js +1 -1
  73. package/build/js/spark/SparkScan.js +1 -1
  74. package/build/js/spark/SparkScanBarcodeFeedback.js +1 -1
  75. package/build/js/spark/SparkScanOverlay.js +1 -1
  76. package/build/js/spark/SparkScanSettings.js +1 -1
  77. package/build/js/spark/SparkScanTargetAimerViewfinder.js +1 -1
  78. package/build/js/spark/index.js +1 -1
  79. package/build/js/spark/ui/SparkScanView.js +1 -1
  80. package/build/js/spark/ui/SparkScanViewFeedbackManager.js +1 -1
  81. package/build/js/spark/ui/SparkScanViewMiniPreview.js +1 -1
  82. package/build/js/spark/ui/SparkScanViewPresenter.js +1 -1
  83. package/build/js/spark/ui/SparkScanViewSettings.js +1 -1
  84. package/build/js/spark/ui/SparkScanViewTriggerButton.js +1 -1
  85. package/build/js/spark/ui/controllers/DragController.js +1 -1
  86. package/build/js/spark/ui/index.js +1 -1
  87. package/build/js/worker/BarcodeCaptureWorkerManager.js +1 -1
  88. package/build/js/worker/WorkerMain.js +1 -1
  89. package/build/js/worker/barcodeCapture.inlineWorker.js +1 -1
  90. package/build/js/worker/dataCaptureEngine.js +1 -1
  91. package/package.json +2 -2
  92. package/sdc-lib/resources/models/barcode_ocr_fallback_ocr_default.8c2870b758fd.model +0 -0
  93. package/sdc-lib/resources/models/barcode_ocr_fallback_ocr_detector_default.9e7b3e9f0b6c.model +0 -0
  94. package/sdc-lib/resources/models/id_ocr.1740d002ffbf.model +0 -0
  95. package/sdc-lib/resources/models/ocr_barcode_semantics_default.8c2870b758fd.model +0 -0
  96. package/sdc-lib/resources/models/ocr_mrz_default.8b80192212c2.model +0 -0
  97. package/sdc-lib/resources/models/ocr_price_label_default.1d18eb896da3.model +0 -0
  98. package/sdc-lib/scandit-datacapture-sdk-barcode-pthreads.js +1 -1
  99. package/sdc-lib/scandit-datacapture-sdk-barcode-pthreads.wasm +0 -0
  100. package/sdc-lib/scandit-datacapture-sdk-barcode-simd-pthreads.js +1 -1
  101. package/sdc-lib/scandit-datacapture-sdk-barcode-simd-pthreads.wasm +0 -0
  102. package/sdc-lib/scandit-datacapture-sdk-barcode-simd.js +1 -1
  103. package/sdc-lib/scandit-datacapture-sdk-barcode-simd.wasm +0 -0
  104. package/sdc-lib/scandit-datacapture-sdk-barcode.js +1 -1
  105. package/sdc-lib/scandit-datacapture-sdk-barcode.wasm +0 -0
  106. package/build/js/chunks/chunk-2BRB72K6.js +0 -1
  107. package/build/js/chunks/chunk-42Y6V4GC.js +0 -9
  108. package/build/js/chunks/chunk-AHHVLMVN.js +0 -1
  109. package/build/js/chunks/chunk-FFISQQ67.js +0 -1
  110. package/build/js/chunks/chunk-MMMW73IQ.js +0 -1
  111. package/build/js/chunks/chunk-NDQSQK6H.js +0 -1
  112. package/build/js/chunks/chunk-PQMKOSC7.js +0 -1
  113. package/build/js/chunks/chunk-QNZA644V.js +0 -1
  114. package/build/js/chunks/chunk-QPIZWGIE.js +0 -1
  115. package/build/js/chunks/chunk-SZ3AQK6Y.js +0 -1
  116. package/sdc-lib/resources/models/barcode_ocr_fallback_ocr_default.4df1cd250f2d.model +0 -0
  117. package/sdc-lib/resources/models/barcode_ocr_fallback_ocr_detector_default.d02cb8506d3f.model +0 -0
  118. package/sdc-lib/resources/models/id_ocr.f42a207632c0.model +0 -0
  119. package/sdc-lib/resources/models/ocr_barcode_semantics_default.f48356d94444.model +0 -0
  120. package/sdc-lib/resources/models/ocr_mrz_default.050ddaa9b833.model +0 -0
  121. package/sdc-lib/resources/models/ocr_price_label_default.ff089db78a2c.model +0 -0
  122. /package/build/js/chunks/{chunk-XDBBLGPM.js → chunk-PE4BKJIX.js} +0 -0
@@ -1 +1 @@
1
- export{a as BarcodeBatch}from'./chunks/chunk-EGQKRCPY.js';
1
+ export{a as BarcodeBatch}from'./chunks/chunk-6BZ6LQZN.js';
@@ -1 +1 @@
1
- export{b as BarcodeBatchBasicOverlay,a as BarcodeBatchBasicOverlayStyle}from'./chunks/chunk-KCLART6S.js';
1
+ export{b as BarcodeBatchBasicOverlay,a as BarcodeBatchBasicOverlayStyle}from'./chunks/chunk-VJ3VETQO.js';
@@ -1 +1 @@
1
- export{a as BarcodeBatchSettings}from'./chunks/chunk-R2NJCFWO.js';
1
+ export{a as BarcodeBatchSettings}from'./chunks/chunk-HMU4GQFX.js';
@@ -1 +1 @@
1
- export{a as BarcodeCapture}from'./chunks/chunk-QWZ3XB2O.js';
1
+ export{a as BarcodeCapture}from'./chunks/chunk-IKMOZCI6.js';
@@ -20,10 +20,16 @@ interface BarcodeCaptureOverlayJSON {
20
20
  drawLocalizedOnlyBarcodes: boolean;
21
21
  shouldShowScanAreaGuides: boolean;
22
22
  shouldRemoveLocationsAfterScan: boolean;
23
+ /**
24
+ * @deprecated Deprecated. Will be removed in a future release.
25
+ */
23
26
  style: BarcodeCaptureOverlayStyle;
24
27
  type: "barcodeCapture";
25
28
  viewfinder: ViewfinderJSON;
26
29
  }
30
+ /**
31
+ * @deprecated Deprecated. Will be removed in a future release.
32
+ */
27
33
  declare enum BarcodeCaptureOverlayStyle {
28
34
  Frame = "frame"
29
35
  }
@@ -35,10 +41,16 @@ declare class BarcodeCaptureOverlay implements DataCaptureOverlay, Serializable<
35
41
  private _style;
36
42
  private _viewfinder;
37
43
  private barcodeCapture;
44
+ /**
45
+ * @deprecated Deprecated. Will be removed in a future release.
46
+ */
38
47
  get style(): BarcodeCaptureOverlayStyle;
39
48
  static withBarcodeCapture(barcodeCapture: BarcodeCapture): Promise<BarcodeCaptureOverlay>;
40
49
  static withBarcodeCaptureForView(barcodeCapture: BarcodeCapture, view: DataCaptureView | null): Promise<BarcodeCaptureOverlay>;
41
- static withBarcodeCaptureForViewWithStyle(barcodeCapture: BarcodeCapture, view: DataCaptureView | null, style: BarcodeCaptureOverlayStyle): Promise<BarcodeCaptureOverlay>;
50
+ /**
51
+ * @deprecated Deprecated. Will be removed in a future release.
52
+ */
53
+ static withBarcodeCaptureForViewWithStyle(barcodeCapture: BarcodeCapture, view: DataCaptureView | null, _style: BarcodeCaptureOverlayStyle): Promise<BarcodeCaptureOverlay>;
42
54
  getBrush(): Brush;
43
55
  getViewfinder(): Viewfinder | null;
44
56
  setBrush(brush: Brush): Promise<void>;
@@ -1 +1 @@
1
- export{b as BarcodeCaptureOverlay,a as BarcodeCaptureOverlayStyle}from'./chunks/chunk-SZ3AQK6Y.js';
1
+ export{b as BarcodeCaptureOverlay,a as BarcodeCaptureOverlayStyle}from'./chunks/chunk-RXRQ4VLH.js';
@@ -1 +1 @@
1
- export{a as BarcodeCaptureSettings}from'./chunks/chunk-QO2O2C3A.js';
1
+ export{a as BarcodeCaptureSettings}from'./chunks/chunk-JZLJVB6X.js';
@@ -21,7 +21,6 @@ interface Defaults {
21
21
  CompositeTypeDescriptions: PrivateCompositeTypeDescription[];
22
22
  BarcodeCapture: {
23
23
  BarcodeCaptureOverlay: {
24
- defaultStyle: BarcodeCaptureOverlayStyle;
25
24
  DefaultBrush: {
26
25
  fillColor: Color;
27
26
  strokeColor: Color;
@@ -134,7 +133,6 @@ interface DefaultsJSON {
134
133
  CompositeTypeDescriptions: string[];
135
134
  BarcodeCapture: {
136
135
  BarcodeCaptureOverlay: {
137
- defaultStyle: BarcodeCaptureOverlayStyle;
138
136
  DefaultBrush: {
139
137
  fillColor: string;
140
138
  strokeColor: string;
@@ -1 +1 @@
1
- export{b as defaultValues,a as defaultsFromJSON,c as setDefaults}from'./chunks/chunk-QNZA644V.js';
1
+ export{b as defaultValues,a as defaultsFromJSON,c as setDefaults}from'./chunks/chunk-OLJXVUYE.js';
@@ -1 +1 @@
1
- export{a as BarcodeAr}from'../chunks/chunk-PQMKOSC7.js';
1
+ export{a as BarcodeAr}from'../chunks/chunk-7326DOBM.js';
@@ -1 +1 @@
1
- export{a as BarcodeArFeedback}from'../chunks/chunk-XDBBLGPM.js';
1
+ export{a as BarcodeArFeedback}from'../chunks/chunk-PE4BKJIX.js';
@@ -30,6 +30,7 @@ declare class BarcodeArPresenter implements BarcodeArListener {
30
30
  readonly barcodeAr: BarcodeAr;
31
31
  constructor(view: BarcodeArView, context: DataCaptureContext, barcodeAr: BarcodeAr, viewSettings: BarcodeArViewSettings, cameraSettings: CameraSettings);
32
32
  get currentCamera(): Camera;
33
+ isCameraMirrored(): boolean;
33
34
  prepare(): Promise<void>;
34
35
  dispose(): Promise<void>;
35
36
  startSearching(): Promise<void>;
@@ -1 +1 @@
1
- export{a as BarcodeArPresenter}from'../chunks/chunk-2BRB72K6.js';
1
+ export{a as BarcodeArPresenter}from'../chunks/chunk-VDFHSUV6.js';
@@ -1 +1 @@
1
- export{a as BarcodeArSettings}from'../chunks/chunk-S7ZLCH67.js';
1
+ export{a as BarcodeArSettings}from'../chunks/chunk-LBKCNRLC.js';
@@ -1 +1 @@
1
- export{a as BarcodeArView}from'../chunks/chunk-QPIZWGIE.js';
1
+ export{a as BarcodeArView}from'../chunks/chunk-A72EVAUC.js';
@@ -1 +1 @@
1
- export{a as hashedId}from'../chunks/chunk-NDQSQK6H.js';
1
+ export{a as hashedId}from'../chunks/chunk-UXI6I6RZ.js';
@@ -1 +1 @@
1
- export{a as BarcodeArInfoAnnotationBodyComponent}from'../../../chunks/chunk-DVLPRWCY.js';
1
+ export{a as BarcodeArInfoAnnotationBodyComponent}from'../../../chunks/chunk-OQVPV5PW.js';
@@ -4,7 +4,8 @@ import { BarcodeArAnnotationVariation } from './private/BarcodeArAnnotationVaria
4
4
 
5
5
  declare enum BarcodeArAnnotationTrigger {
6
6
  HighlightTap = "highlightTap",
7
- HighlightTapAndBarcodeScan = "highlightTapAndBarcodeScan"
7
+ HighlightTapAndBarcodeScan = "highlightTapAndBarcodeScan",
8
+ BarcodeScan = "barcodeScan"
8
9
  }
9
10
  interface BarcodeArAnnotation extends ScanditHTMLElement {
10
11
  annotationTrigger: BarcodeArAnnotationTrigger;
@@ -1 +1 @@
1
- export{b as BarcodeArAnnotationAnchor,a as BarcodeArAnnotationTrigger}from'../../../chunks/chunk-MMMW73IQ.js';
1
+ export{b as BarcodeArAnnotationAnchor,a as BarcodeArAnnotationTrigger}from'../../../chunks/chunk-I6GJ7OYJ.js';
@@ -1 +1 @@
1
- export{b as BarcodeArCircleHighlight,a as BarcodeArCircleHighlightPreset}from'../../../chunks/chunk-RUJWPCWD.js';
1
+ export{b as BarcodeArCircleHighlight,a as BarcodeArCircleHighlightPreset}from'../../../chunks/chunk-33EFB3RJ.js';
@@ -1 +1 @@
1
- export{d as BarcodeArInfoAnnotation,a as BarcodeArInfoAnnotationAnchor,c as BarcodeArInfoAnnotationEvent,b as BarcodeArInfoAnnotationWidthPreset}from'../../../chunks/chunk-42Y6V4GC.js';
1
+ export{d as BarcodeArInfoAnnotation,a as BarcodeArInfoAnnotationAnchor,c as BarcodeArInfoAnnotationEvent,b as BarcodeArInfoAnnotationWidthPreset}from'../../../chunks/chunk-XGPORK2H.js';
@@ -1 +1 @@
1
- export{a as BarcodeArResponsiveAnnotation}from'../../../chunks/chunk-RLKGZ42F.js';
1
+ export{a as BarcodeArResponsiveAnnotation}from'../../../chunks/chunk-QIOYMBBP.js';
@@ -1 +1 @@
1
- import {a}from'./chunk-CYVVGAZ4.js';import {Color,Brush,ScanditIconShape,ScanditIconBuilder}from'@scandit/web-datacapture-core';import {ScanditHTMLElement}from'@scandit/web-datacapture-core/build/js/private/utils/ScanditHTMLElement.js';import {css}from'@scandit/web-datacapture-core/build/js/private/utils/css.js';import {defineCustomElements}from'@scandit/web-datacapture-core/build/js/private/utils/defineCustomElements.js';import {html}from'@scandit/web-datacapture-core/build/js/private/utils/html.js';var g=(t=>(t.Dot="dot",t.Icon="icon",t))(g||{}),s=Color.fromHex("#00FFFF"),m=s.withAlpha(0),i=class i extends ScanditHTMLElement{constructor(){super();this._isPulsing=false;this._icon=null;this.dot=null;this._brush=new Brush(s.withAlpha(.45),Color.fromHex("#00FFFF"),2);let t=this.attachShadow({mode:"open"});t.innerHTML=html`<slot></slot>`,t.append(i.createStyleElement().cloneNode(true));}set isPulsing(t){this._isPulsing=t,this.toggleAttribute("pulse",t);}get isPulsing(){return this._isPulsing}set icon(t){var e;(e=this._icon)==null||e.remove(),this._icon=t,t&&this.preset==="icon"&&(t.backgroundShape=ScanditIconShape.Circle,this.append(t),this.updateBrush(),this.updateSize());}get icon(){return this._icon}set barcode(t){this._barcode=t;}get barcode(){return this._barcode}set brush(t){this._brush=t,this.updateBrush();}get brush(){return this._brush}set size(t){this._size=t,this.updateSize();}get size(){return this._size!==void 0?this._size:this.preset==="dot"?26:32}static create(t,e){i.register();let o=document.createElement(i.tag);return o.barcode=t,o.preset=e,o}static register(){defineCustomElements({[i.tag]:i});}static createStyleElement(){return css`:host{border-radius:50%;display:inline-flex;--fill:#${s.toJSON()};--fill-no-opacity:#${m.toJSON()};--size:20px}:host([pulse]){animation:pulse 1.5s infinite}@keyframes pulse{0%{box-shadow:0 0 0 0 var(--fill)}70%{box-shadow:0 0 0 var(--size) var(--fill-no-opacity)}to{box-shadow:0 0 0 0 var(--fill-no-opacity)}}`}async connectedCallback(){this.brushBuilder=new ScanditIconBuilder().withBackgroundShape(ScanditIconShape.Circle).withBackgroundColor(this.brush.fillColor).withBackgroundStrokeColor(this.brush.strokeColor).withBackgroundStrokeWidth(this.brush.strokeWidth),this.dot=await this.brushBuilder.build(),this.preset==="dot"?this.append(this.dot):this.preset==="icon"&&this._icon!=null&&(this._icon.backgroundShape=ScanditIconShape.Circle,this.append(this._icon)),this.updateBrush(),this.updateSize();}updateSize(){this.dot&&(this.dot.width=this.size,this.dot.height=this.size),this.icon&&(this.icon.width=this.size,this.icon.height=this.size),this.style.setProperty("--size",`${this.size*9/10}px`);}updateBrush(){this.dot&&(this.dot.backgroundColor=this._brush.fillColor,this.dot.backgroundStrokeColor=this._brush.strokeColor,this.dot.backgroundStrokeWidth=this._brush.strokeWidth),this.icon&&(this.icon.backgroundColor=this._brush.fillColor,this.icon.backgroundStrokeColor=this._brush.strokeColor,this.icon.backgroundStrokeWidth=this._brush.strokeWidth),this.style.setProperty("--fill",`#${this._brush.fillColor.toJSON()}`),this.style.setProperty("--fill-no-opacity",`#${this._brush.fillColor.withAlpha(0).toJSON()}`);}updatePosition(t,e,o){a(this,t,e,0);}};i.tag="scandit-barcode-ar-circle-highlight";var l=i;export{g as a,l as b};
1
+ import {a}from'./chunk-CYVVGAZ4.js';import {Color,Brush,ScanditIconShape,ScanditIconBuilder}from'@scandit/web-datacapture-core';import {ScanditHTMLElement}from'@scandit/web-datacapture-core/build/js/private/utils/ScanditHTMLElement.js';import {css}from'@scandit/web-datacapture-core/build/js/private/utils/css.js';import {defineCustomElements}from'@scandit/web-datacapture-core/build/js/private/utils/defineCustomElements.js';import {html}from'@scandit/web-datacapture-core/build/js/private/utils/html.js';var g=(t=>(t.Dot="dot",t.Icon="icon",t))(g||{}),s=Color.fromHex("#00FFFF"),m=s.withAlpha(0),i=class i extends ScanditHTMLElement{constructor(){super();this._isPulsing=false;this._icon=null;this.dot=null;this._brush=new Brush(s.withAlpha(.45),Color.fromHex("#00FFFF"),2);let t=this.attachShadow({mode:"open"});t.innerHTML=html`<slot></slot>`,t.append(i.createStyleElement().cloneNode(true));}set isPulsing(t){this._isPulsing=t,this.toggleAttribute("pulse",t);}get isPulsing(){return this._isPulsing}set icon(t){var e;(e=this._icon)==null||e.remove(),this._icon=t,t&&this.preset==="icon"&&(t.backgroundShape=ScanditIconShape.Circle,this.append(t),this.updateBrush(),this.updateSize());}get icon(){return this._icon}set barcode(t){this._barcode=t;}get barcode(){return this._barcode}set brush(t){this._brush=t,this.updateBrush();}get brush(){return this._brush}set size(t){this._size=t,this.updateSize();}get size(){return this._size!==void 0?this._size:this.preset==="dot"?26:32}static create(t,e){i.register();let o=document.createElement(i.tag);return o.barcode=t,o.preset=e,o}static register(){defineCustomElements({[i.tag]:i});}static createStyleElement(){return css`:host{border-radius:50%;display:inline-flex;--fill:#${s.toJSON()};--fill-no-opacity:#${m.toJSON()};--size:20px}:host([pulse]){animation:pulse 1.5s infinite}:host(:not([pulse])){animation:none}@keyframes pulse{0%{box-shadow:0 0 0 0 var(--fill)}70%{box-shadow:0 0 0 var(--size) var(--fill-no-opacity)}to{box-shadow:0 0 0 0 var(--fill-no-opacity)}}`}async connectedCallback(){this.brushBuilder=new ScanditIconBuilder().withBackgroundShape(ScanditIconShape.Circle).withBackgroundColor(this.brush.fillColor).withBackgroundStrokeColor(this.brush.strokeColor).withBackgroundStrokeWidth(this.brush.strokeWidth),this.dot=await this.brushBuilder.build(),this.preset==="dot"?this.append(this.dot):this.preset==="icon"&&this._icon!=null&&(this._icon.backgroundShape=ScanditIconShape.Circle,this.append(this._icon)),this.updateBrush(),this.updateSize();}updateSize(){this.dot&&(this.dot.width=this.size,this.dot.height=this.size),this.icon&&(this.icon.width=this.size,this.icon.height=this.size),this.style.setProperty("--size",`${this.size*9/10}px`);}updateBrush(){this.dot&&(this.dot.backgroundColor=this._brush.fillColor,this.dot.backgroundStrokeColor=this._brush.strokeColor,this.dot.backgroundStrokeWidth=this._brush.strokeWidth),this.icon&&(this.icon.backgroundColor=this._brush.fillColor,this.icon.backgroundStrokeColor=this._brush.strokeColor,this.icon.backgroundStrokeWidth=this._brush.strokeWidth),this.style.setProperty("--fill",`#${this._brush.fillColor.toJSON()}`),this.style.setProperty("--fill-no-opacity",`#${this._brush.fillColor.withAlpha(0).toJSON()}`);}updatePosition(t,e,o){a(this,t,e,0);}};i.tag="scandit-barcode-ar-circle-highlight";var l=i;export{g as a,l as b};
@@ -1 +1 @@
1
- import {a}from'./chunk-HRQFPTLO.js';import {b}from'./chunk-QNZA644V.js';import {Brush}from'@scandit/web-datacapture-core';var s=class o{constructor(){this.type="sparkScan";this._shouldShowScanAreaGuides=false;this._shouldRemoveLocationsAfterScan=true;this._shouldDrawViewfinder=false;this._style=b.SparkScan.SparkScanOverlay.defaultStyle;this._viewfinder=new a;}get style(){return this._style}static async withSparkScanForView(a,r){let t=new o;return t.sparkScan=a,await t.setBrush(new Brush(b.SparkScan.SparkScanOverlay.DefaultBrush.fillColor,b.SparkScan.SparkScanOverlay.DefaultBrush.strokeColor,b.SparkScan.SparkScanOverlay.DefaultBrush.strokeWidth)),r&&await r.addOverlay(t),t}setRadius(a){this._viewfinder.radius=a;}getBrush(){return this._brush}async setBrush(a){this._brush=a,await this.sparkScan.notifyContext();}async overlayReadyForDraw(){await this.sparkScan.workerCommand("sparkScanOverlayReadyForDraw",{});}async setErrorBrush(a){this._errorBrush=a,await this.sparkScan.notifyContext();}async setShouldShowScanAreaGuides(a){this._shouldShowScanAreaGuides=a,await this.sparkScan.notifyContext();}async setShouldRemoveLocationsAfterScan(a){this._shouldRemoveLocationsAfterScan=a,await this.sparkScan.notifyContext();}async setShouldDrawViewfinder(a){this._shouldDrawViewfinder=a,await this.sparkScan.notifyContext();}shouldShowScanAreaGuides(){return this._shouldShowScanAreaGuides}shouldRemoveLocationsAfterScan(){return this._shouldRemoveLocationsAfterScan}toJSONObject(){var a,r;return {type:this.type,brush:this._brush.toJSONObject(),errorBrush:(r=(a=this._errorBrush)==null?void 0:a.toJSONObject())!=null?r:this._brush.toJSONObject(),shouldShowScanAreaGuides:this._shouldShowScanAreaGuides,shouldRemoveLocationsAfterScan:this._shouldRemoveLocationsAfterScan,viewfinder:this._viewfinder.toJSONObject(),style:this.style,shouldDrawViewfinder:this._shouldDrawViewfinder}}};export{s as a};
1
+ import {a}from'./chunk-4ID5S6I7.js';import {b}from'./chunk-OLJXVUYE.js';import {Brush}from'@scandit/web-datacapture-core';var s=class o{constructor(){this.type="sparkScan";this._shouldShowScanAreaGuides=false;this._shouldRemoveLocationsAfterScan=true;this._shouldDrawViewfinder=false;this._style=b.SparkScan.SparkScanOverlay.defaultStyle;this._viewfinder=new a;}get style(){return this._style}static async withSparkScanForView(a,r){let t=new o;return t.sparkScan=a,await t.setBrush(new Brush(b.SparkScan.SparkScanOverlay.DefaultBrush.fillColor,b.SparkScan.SparkScanOverlay.DefaultBrush.strokeColor,b.SparkScan.SparkScanOverlay.DefaultBrush.strokeWidth)),r&&await r.addOverlay(t),t}setRadius(a){this._viewfinder.radius=a;}getBrush(){return this._brush}async setBrush(a){this._brush=a,await this.sparkScan.notifyContext();}async overlayReadyForDraw(){await this.sparkScan.workerCommand("sparkScanOverlayReadyForDraw",{});}async setErrorBrush(a){this._errorBrush=a,await this.sparkScan.notifyContext();}async setShouldShowScanAreaGuides(a){this._shouldShowScanAreaGuides=a,await this.sparkScan.notifyContext();}async setShouldRemoveLocationsAfterScan(a){this._shouldRemoveLocationsAfterScan=a,await this.sparkScan.notifyContext();}async setShouldDrawViewfinder(a){this._shouldDrawViewfinder=a,await this.sparkScan.notifyContext();}shouldShowScanAreaGuides(){return this._shouldShowScanAreaGuides}shouldRemoveLocationsAfterScan(){return this._shouldRemoveLocationsAfterScan}toJSONObject(){var a,r;return {type:this.type,brush:this._brush.toJSONObject(),errorBrush:(r=(a=this._errorBrush)==null?void 0:a.toJSONObject())!=null?r:this._brush.toJSONObject(),shouldShowScanAreaGuides:this._shouldShowScanAreaGuides,shouldRemoveLocationsAfterScan:this._shouldRemoveLocationsAfterScan,viewfinder:this._viewfinder.toJSONObject(),style:this.style,shouldDrawViewfinder:this._shouldDrawViewfinder}}};export{s as a};
@@ -1 +1 @@
1
- import {b}from'./chunk-QNZA644V.js';import {NumberWithUnit}from'@scandit/web-datacapture-core';var i=class{constructor(){this.radius=new NumberWithUnit(b.SparkScan.SparkScanSettings.locationSelection.radius,b.SparkScan.SparkScanSettings.locationSelection.unit);this.type="targetAimer";}toJSONObject(){return {type:this.type,radius:this.radius.toJSONObject()}}};export{i as a};
1
+ import {b}from'./chunk-OLJXVUYE.js';import {NumberWithUnit}from'@scandit/web-datacapture-core';var i=class{constructor(){this.radius=new NumberWithUnit(b.SparkScan.SparkScanSettings.locationSelection.radius,b.SparkScan.SparkScanSettings.locationSelection.unit);this.type="targetAimer";}toJSONObject(){return {type:this.type,radius:this.radius.toJSONObject()}}};export{i as a};
@@ -0,0 +1 @@
1
+ var s={"scandit-datacapture-sdk-barcode-pthreads.wasm":{bytes:7222408},"scandit-datacapture-sdk-barcode-simd.wasm":{bytes:7042712},"scandit-datacapture-sdk-barcode.wasm":{bytes:7106080},"scandit-datacapture-sdk-barcode-simd-pthreads.wasm":{bytes:7159384}};export{s as a};
@@ -1 +1 @@
1
- import {a as a$3}from'./chunk-7O2NHA3I.js';import {a as a$2}from'./chunk-LTNZJEG4.js';import {a as a$4}from'./chunk-4QSEBPWB.js';import {a as a$1}from'./chunk-2ZSOWJ2F.js';import {a}from'./chunk-WVIC3JWX.js';import {a as a$5}from'./chunk-AHHVLMVN.js';import {DataCaptureEngine}from'@scandit/web-datacapture-core/build/js/worker/index.js';var c=class extends DataCaptureEngine{constructor(e,r){super(e,r);}getModeDeserializers(){this.barcodeCaptureMode=new a(this,this.Module,this.workerFunctions),this.barcodeBatchMode=new a$1(this,this.Module,this.workerFunctions),this.sparkScanMode=new a$2(this,this.Module,this.workerFunctions),this.barcodeFindMode=new a$3(this,this.Module,this.workerFunctions),this.barcodeArMode=new a$4(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,r){return r?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,r){return r?e?"591f364b6da52e23fa7c6475c893f06ff3bd2bbdd30680acafe9794551a7faa8":"3cb4cf0914d7b1084f9a67cc452c598efea93ff36ce0b24fff581c6e80411e25":e?"a0fdc0d5f0c18410858dc7db89b3d2b27ba6e8172df48c4cdad9c23977eb0093":"0f4cc07f2a8fc2b0a37c727343c55abd7afcc50b2f1b9c94c8b5ae82b6b986f4"}getWasmMetadata(){return a$5}};export{c as a};
1
+ import {a as a$1}from'./chunk-2ZSOWJ2F.js';import {a}from'./chunk-WVIC3JWX.js';import {a as a$3}from'./chunk-7O2NHA3I.js';import {a as a$2}from'./chunk-LTNZJEG4.js';import {a as a$4}from'./chunk-4QSEBPWB.js';import {a as a$5}from'./chunk-4QBAIUZM.js';import {DataCaptureEngine}from'@scandit/web-datacapture-core/build/js/worker/index.js';var c=class extends DataCaptureEngine{constructor(e,r){super(e,r);}getModeDeserializers(){this.barcodeCaptureMode=new a(this,this.Module,this.workerFunctions),this.barcodeBatchMode=new a$1(this,this.Module,this.workerFunctions),this.sparkScanMode=new a$2(this,this.Module,this.workerFunctions),this.barcodeFindMode=new a$3(this,this.Module,this.workerFunctions),this.barcodeArMode=new a$4(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,r){return r?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,r){return r?e?"918a1c9c3d7e9d70b0a74e49af75288ec5146257c5937a526532b8215af28267":"b758a5e81880aac2ef5afcd0df69cf74ecbf53b40c1be351ed417dccef81b108":e?"89afcdd95925b1a11b7628d2e03ec474c1b10481616a8b75839a4fd51c292ab3":"68041d1ef8bf6b24fbb91d19e229e0a05525eaed8a14d0ef4de8b3a7fa570030"}getWasmMetadata(){return a$5}};export{c as a};
@@ -1 +1 @@
1
- import {b}from'./chunk-QNZA644V.js';import {a}from'./chunk-IHTTMWUR.js';import {CameraSettings}from'@scandit/web-datacapture-core';import {warnMultithreadingUnavailable}from'@scandit/web-datacapture-core/build/js/private/utils/warnMultithreadingUnavailable.js';var o=class n{constructor(){this.type="barcodeTracking";this._isEnabled=true;this._context=null;this.listeners=[];this.privateListeners=new Set;this.workerMessageListener=this.onWorkerMessage.bind(this);}static get recommendedCameraSettings(){let e=new CameraSettings(b.BarcodeBatch.RecommendedCameraSettings);return e.setProperty("grayScaleFrameReader",true),e}get context(){return this._context}set context(e){this._context=e;}static async forContext(e,a){warnMultithreadingUnavailable();let t=new n;return t.settings=a,e!=null&&await e.addMode(t),t}isEnabled(){return this._isEnabled}async setEnabled(e){this._isEnabled=e,await this.notifyContext();}async applySettings(e){return this.settings=e,this.notifyContext()}addListener(e){this.listeners.includes(e)||this.listeners.push(e);}removeListener(e){this.listeners.includes(e)&&this.listeners.splice(this.listeners.indexOf(e),1);}toJSONObject(){return {type:this.type,enabled:this._isEnabled,settings:this.settings.toJSONObject()}}attachedToContext(e){this._context=e,this._context.subscribeToWorkerMessages(this.workerMessageListener);}detachedFromContext(){var e;(e=this._context)==null||e.unsubscribeToWorkerMessages(this.workerMessageListener),this._context=null;}addPrivateListener(e){this.privateListeners.add(e);}removePrivateListener(e){this.privateListeners.delete(e);}async onWorkerMessage(e){var a$1;switch(e.type){case "barcodeBatchDidUpdateSession":{{let t=a.fromJSON(e.payload);if(!this._isEnabled)return;for(let r of [...this.privateListeners,...this.listeners])r.didUpdateSession&&r.didUpdateSession(this,t);}break}case "didTapTrackedBarcode":{for(let t of this.privateListeners)(a$1=t.didTapTrackedBarcode)==null||a$1.call(t,e.payload);break}}}async notifyContext(){if(this.context)return this.context.update()}};export{o as a};
1
+ import {b}from'./chunk-OLJXVUYE.js';import {a}from'./chunk-IHTTMWUR.js';import {CameraSettings}from'@scandit/web-datacapture-core';import {warnMultithreadingUnavailable}from'@scandit/web-datacapture-core/build/js/private/utils/warnMultithreadingUnavailable.js';var o=class n{constructor(){this.type="barcodeTracking";this._isEnabled=true;this._context=null;this.listeners=[];this.privateListeners=new Set;this.workerMessageListener=this.onWorkerMessage.bind(this);}static get recommendedCameraSettings(){let e=new CameraSettings(b.BarcodeBatch.RecommendedCameraSettings);return e.setProperty("grayScaleFrameReader",true),e}get context(){return this._context}set context(e){this._context=e;}static async forContext(e,a){warnMultithreadingUnavailable();let t=new n;return t.settings=a,e!=null&&await e.setMode(t),t}isEnabled(){return this._isEnabled}async setEnabled(e){this._isEnabled=e,await this.notifyContext();}async applySettings(e){return this.settings=e,this.notifyContext()}addListener(e){this.listeners.includes(e)||this.listeners.push(e);}removeListener(e){this.listeners.includes(e)&&this.listeners.splice(this.listeners.indexOf(e),1);}toJSONObject(){return {type:this.type,enabled:this._isEnabled,settings:this.settings.toJSONObject()}}attachedToContext(e){this._context=e,this._context.subscribeToWorkerMessages(this.workerMessageListener);}detachedFromContext(){var e;(e=this._context)==null||e.unsubscribeToWorkerMessages(this.workerMessageListener),this._context=null;}addPrivateListener(e){this.privateListeners.add(e);}removePrivateListener(e){this.privateListeners.delete(e);}async onWorkerMessage(e){var a$1;switch(e.type){case "barcodeBatchDidUpdateSession":{{let t=a.fromJSON(e.payload);if(!this._isEnabled)return;for(let r of [...this.privateListeners,...this.listeners])r.didUpdateSession&&r.didUpdateSession(this,t);}break}case "didTapTrackedBarcode":{for(let t of this.privateListeners)(a$1=t.didTapTrackedBarcode)==null||a$1.call(t,e.payload);break}}}async notifyContext(){if(this.context)return this.context.update()}};export{o as a};
@@ -1 +1 @@
1
- import {a}from'./chunk-BRRT6GC7.js';import {b as b$1}from'./chunk-SZUPDKV5.js';import {b}from'./chunk-QNZA644V.js';var n=class{constructor(){this.defaultHandMode=b.SparkScan.SparkScanViewSettings.defaultHandMode;this.defaultScanningMode=new b$1("single","default");this.defaultTorchState=b.SparkScan.SparkScanViewSettings.defaultTorchState;this.defaultMiniPreviewSize=b.SparkScan.SparkScanViewSettings.defaultMiniPreviewSize;this.defaultCameraPosition=b.SparkScan.SparkScanViewSettings.defaultCameraPosition;this.hapticEnabled=b.SparkScan.SparkScanViewSettings.hapticEnabled;this.holdToScanEnabled=b.SparkScan.SparkScanViewSettings.holdToScanEnabled;this.inactiveStateTimeout=b.SparkScan.SparkScanViewSettings.inactiveStateTimeout;this.soundEnabled=b.SparkScan.SparkScanViewSettings.soundEnabled;this.toastSettings=new a;this.triggerButtonCollapseTimeout=b.SparkScan.SparkScanViewSettings.triggerButtonCollapseTimeout;this.visualFeedbackEnabled=b.SparkScan.SparkScanViewSettings.visualFeedbackEnabled;this.zoomFactorIn=b.SparkScan.SparkScanViewSettings.zoomFactorIn;this.zoomFactorOut=b.SparkScan.SparkScanViewSettings.zoomFactorOut;}toJSONObject(){return {defaultHandMode:this.defaultHandMode,defaultScanningMode:this.defaultScanningMode.toJSONObject(),defaultTorchState:this.defaultTorchState,defaultMiniPreviewSize:this.defaultMiniPreviewSize,defaultCameraPosition:this.defaultCameraPosition,hapticEnabled:this.hapticEnabled,holdToScanEnabled:this.holdToScanEnabled,inactiveStateTimeout:this.inactiveStateTimeout,soundEnabled:this.soundEnabled,toastSettings:this.toastSettings.toJSONObject(),triggerButtonCollapseTimeout:this.triggerButtonCollapseTimeout,visualFeedbackEnabled:this.visualFeedbackEnabled,zoomFactorIn:this.zoomFactorIn,zoomFactorOut:this.zoomFactorOut}}};export{n as a};
1
+ import {a}from'./chunk-BRRT6GC7.js';import {b as b$1}from'./chunk-SZUPDKV5.js';import {b}from'./chunk-OLJXVUYE.js';var n=class{constructor(){this.defaultHandMode=b.SparkScan.SparkScanViewSettings.defaultHandMode;this.defaultScanningMode=new b$1("single","default");this.defaultTorchState=b.SparkScan.SparkScanViewSettings.defaultTorchState;this.defaultMiniPreviewSize=b.SparkScan.SparkScanViewSettings.defaultMiniPreviewSize;this.defaultCameraPosition=b.SparkScan.SparkScanViewSettings.defaultCameraPosition;this.hapticEnabled=b.SparkScan.SparkScanViewSettings.hapticEnabled;this.holdToScanEnabled=b.SparkScan.SparkScanViewSettings.holdToScanEnabled;this.inactiveStateTimeout=b.SparkScan.SparkScanViewSettings.inactiveStateTimeout;this.soundEnabled=b.SparkScan.SparkScanViewSettings.soundEnabled;this.toastSettings=new a;this.triggerButtonCollapseTimeout=b.SparkScan.SparkScanViewSettings.triggerButtonCollapseTimeout;this.visualFeedbackEnabled=b.SparkScan.SparkScanViewSettings.visualFeedbackEnabled;this.zoomFactorIn=b.SparkScan.SparkScanViewSettings.zoomFactorIn;this.zoomFactorOut=b.SparkScan.SparkScanViewSettings.zoomFactorOut;}toJSONObject(){return {defaultHandMode:this.defaultHandMode,defaultScanningMode:this.defaultScanningMode.toJSONObject(),defaultTorchState:this.defaultTorchState,defaultMiniPreviewSize:this.defaultMiniPreviewSize,defaultCameraPosition:this.defaultCameraPosition,hapticEnabled:this.hapticEnabled,holdToScanEnabled:this.holdToScanEnabled,inactiveStateTimeout:this.inactiveStateTimeout,soundEnabled:this.soundEnabled,toastSettings:this.toastSettings.toJSONObject(),triggerButtonCollapseTimeout:this.triggerButtonCollapseTimeout,visualFeedbackEnabled:this.visualFeedbackEnabled,zoomFactorIn:this.zoomFactorIn,zoomFactorOut:this.zoomFactorOut}}};export{n as a};
@@ -0,0 +1 @@
1
+ import {a}from'./chunk-PE4BKJIX.js';import {a as a$1}from'./chunk-D26TRBZS.js';import {b}from'./chunk-EWNVCDJ6.js';import {CameraSettings,convertToPublicFrameData}from'@scandit/web-datacapture-core';import {warnMultithreadingUnavailable}from'@scandit/web-datacapture-core/build/js/private/utils/warnMultithreadingUnavailable.js';var o=class n{constructor(){this.skipSerialization=true;this.type="barcodeAr";this._isEnabled=true;this._context=null;this.listeners=new Set;this.privateListeners=new Set;this.workerMessageListener=this.onWorkerMessage.bind(this);}get context(){return this._context}static createRecommendedCameraSettings(){let e=new CameraSettings(b);return e.setProperty("grayScaleFrameReader",true),e}set context(e){this._context=e;}get allListeners(){return [...this.privateListeners,...this.listeners]}static async forContext(e,t){warnMultithreadingUnavailable();let r=new n;return r.feedback=await a.createDefaultBarcodeArFeedback(),r.settings=t,await e.setMode(r),r}isEnabled(){return this._isEnabled}addListener(e){this.listeners.add(e);}removeListener(e){this.listeners.delete(e);}set feedback(e){this._feedback=e;}get feedback(){return this._feedback}async setEnabled(e){var t;this._isEnabled=e,await this.workerCommand("barcodeArSetEnabled",{enabled:e}),await((t=this.context)==null?void 0:t.update([{type:"modeEnabled",newValue:e}],{updateContext:false}));}async applySettings(e){this.settings=e,await this.workerCommand("barcodeArApplySettings",{settings:e.toJSONObject()});}toJSONObject(){return {type:this.type,enabled:this._isEnabled,settings:this.settings.toJSONObject()}}async attachedToContext(e){this._context=e,this._context.subscribeToWorkerMessages(this.workerMessageListener),await this.workerCommand("barcodeArForSettings",{settings:this.settings.toJSONObject()});}async detachedFromContext(){var e;await this.workerCommand("barcodeArModeRemove",{}),(e=this._context)==null||e.unsubscribeToWorkerMessages(this.workerMessageListener),this._context=null;}async start(){return this.workerCommand("barcodeArSearchStart",{})}async stop(){return this.workerCommand("barcodeArSearchStop",{})}async pause(){return this.workerCommand("barcodeArSearchPause",{})}async workerCommand(e,t){this.context!=null&&await this.context.workerCommand(e,t);}addPrivateListener(e){this.privateListeners.add(e);}removePrivateListener(e){this.privateListeners.delete(e);}async onWorkerMessage(e){var t;switch(e.type){case "barcodeArDidUpdateSession":{if(!this._isEnabled||!this._context)return;for(let r of this.allListeners)(t=r.didUpdateSession)==null||t.call(r,this,a$1.fromJSON(e.payload.session),convertToPublicFrameData(e.payload.frameData,this._context));break}}}};export{o as a};
@@ -1 +1 @@
1
- import {b}from'./chunk-QNZA644V.js';var i=class{constructor(){this.properties={};this.symbologies={};}get enabledSymbologies(){return Object.keys(this.symbologies).filter(e=>this.symbologies[e].isEnabled)}settingsForSymbology(e){if(!this.symbologies[e]){let o=b.SymbologySettings[e];o._symbology=e,this.symbologies[e]=o;}return this.symbologies[e]}setProperty(e,o){this.properties[e]=o;}getProperty(e){return this.properties[e]}enableSymbologies(e){for(let o of e)this.enableSymbology(o,true);}enableSymbology(e,o){this.settingsForSymbology(e).isEnabled=o;}toJSONObject(){return {properties:this.properties,symbologies:Object.keys(this.symbologies).reduce((e,o)=>(e[o]=this.symbologies[o].toJSONObject(),e),{})}}};export{i as a};
1
+ import {b}from'./chunk-OLJXVUYE.js';var i=class{constructor(){this.properties={};this.symbologies={};}get enabledSymbologies(){return Object.keys(this.symbologies).filter(e=>this.symbologies[e].isEnabled)}settingsForSymbology(e){if(!this.symbologies[e]){let o=b.SymbologySettings[e];o._symbology=e,this.symbologies[e]=o;}return this.symbologies[e]}setProperty(e,o){this.properties[e]=o;}getProperty(e){return this.properties[e]}enableSymbologies(e){for(let o of e)this.enableSymbology(o,true);}enableSymbology(e,o){this.settingsForSymbology(e).isEnabled=o;}toJSONObject(){return {properties:this.properties,symbologies:Object.keys(this.symbologies).reduce((e,o)=>(e[o]=this.symbologies[o].toJSONObject(),e),{})}}};export{i as a};
@@ -0,0 +1 @@
1
+ import {a}from'./chunk-ZZQLFO35.js';import {a as a$8}from'./chunk-ZPCWOA3Y.js';import {a as a$7}from'./chunk-DQVSIMLI.js';import {b}from'./chunk-B5IOSUX4.js';import {a as a$a}from'./chunk-KMEGIFKL.js';import {a as a$5}from'./chunk-QIOYMBBP.js';import {b as b$1}from'./chunk-33EFB3RJ.js';import {a as a$6}from'./chunk-JKO4EZPZ.js';import {a as a$1}from'./chunk-I53W7VSB.js';import {a as a$9}from'./chunk-UXI6I6RZ.js';import {a as a$2}from'./chunk-VDFHSUV6.js';import {a as a$4}from'./chunk-LKQMBRKB.js';import {a as a$3}from'./chunk-7326DOBM.js';import {Anchor,DataCaptureView,Direction,Point,Size}from'@scandit/web-datacapture-core';import {Backdrop}from'@scandit/web-datacapture-core/build/js/private/ui/atoms/Backdrop.js';import {ScanditHTMLElement}from'@scandit/web-datacapture-core/build/js/private/utils/ScanditHTMLElement.js';import {css}from'@scandit/web-datacapture-core/build/js/private/utils/css.js';import {defineCustomElements}from'@scandit/web-datacapture-core/build/js/private/utils/defineCustomElements.js';import {calculateArea,calculateWidth,calculateHeight}from'@scandit/web-datacapture-core/build/js/private/utils/quadrilateralUtils.js';import {Timeout}from'@scandit/web-datacapture-core/build/js/private/utils/timeout.js';var W={async highlightForBarcode(E,T){let t=a$a.create(E);T(t);}},c=class c extends ScanditHTMLElement{constructor(){super(...arguments);this.torchIconButton=null;this.cameraSwitchButton=null;this.zoomButton=null;this.onTorchButtonClickHandler=this.onTorchButtonClick.bind(this);this.onCameraSwitchButtonHandler=this.onCameraSwitchButtonClick.bind(this);this.onZoomButtonHandler=this.onZoomButtonClick.bind(this);this.onLayoutPointerDownHandler=this.onLayoutPointerDown.bind(this);this.onInfoAnnotationTapHandler=this.onInfoAnnotationTap.bind(this);this.pendingDeletionTimeout=null;}set shouldShowZoomControl(t){this.zoomButton&&(this.zoomButton.hidden=!t);}get shouldShowZoomControl(){return this.zoomButton===null?false:!this.zoomButton.hidden}set shouldShowCameraSwitchControl(t){this.cameraSwitchButton&&(this.cameraSwitchButton.hidden=!t);}get shouldShowCameraSwitchControl(){return this.cameraSwitchButton===null?false:!this.cameraSwitchButton.hidden}set shouldShowTorchControl(t){this.torchIconButton!==null&&(this.torchIconButton.hidden=!t);}get shouldShowTorchControl(){return this.torchIconButton===null?false:!this.torchIconButton.hidden}set torchControlPosition(t){var e;(e=this.torchIconButton)==null||e.setAttribute("slot",`controls-${t===Anchor.Center?Anchor.TopLeft:t}`);}get torchControlPosition(){var e,o;let t=(o=(e=this.torchIconButton)==null?void 0:e.getAttribute("slot"))!=null?o:"";return t===""?Anchor.TopLeft:t.replace("controls-","")}set zoomControlPosition(t){var e;(e=this.zoomButton)==null||e.setAttribute("slot",`controls-${t===Anchor.Center?Anchor.BottomRight:t}`);}get zoomControlPosition(){var e,o;let t=(o=(e=this.zoomButton)==null?void 0:e.getAttribute("slot"))!=null?o:"";return t===""?Anchor.BottomRight:t.replace("controls-","")}set cameraSwitchControlPosition(t){var e;(e=this.cameraSwitchButton)==null||e.setAttribute("slot",`controls-${t===Anchor.Center?Anchor.TopRight:t}`);}get cameraSwitchControlPosition(){var e,o;let t=(o=(e=this.zoomButton)==null?void 0:e.getAttribute("slot"))!=null?o:"";return t===""?Anchor.TopRight:t.replace("controls-","")}static async createWithSettings(t,e,o,i,n){c.register();let r=document.createElement(c.tag);return r.barcodeArViewSettings=i,r.layout=a.create(),r.append(r.layout),a$1(t)?(r.dataCaptureView=t,r.dataCaptureView.containerElement.prepend(r),await t.setContext(e)):(r.dataCaptureView=await DataCaptureView.forContext(e),r.dataCaptureView.connectToElement(t),r.dataCaptureView.containerElement.prepend(r)),r.presenter=new a$2(r,e,o,i,n!=null?n:a$3.createRecommendedCameraSettings()),await r.presenter.prepare(),r}static async create(t,e,o){return c.createWithSettings(t,e,o,new a$4)}static register(){defineCustomElements({[a.tag]:a,[a$8.tag]:a$8,[a$7.tag]:a$7,[a$6.tag]:a$6,[c.tag]:c,[Backdrop.tag]:Backdrop,[a$5.tag]:a$5});}static createStyleElement(){return css`[data-could-be-deleted=true]{display:none!important}[data-on-foreground=true]{z-index:3}${c.tag}{inset:0;position:absolute;z-index:1}`}async start(){return this.presenter.startSearching()}async stop(){return this.presenter.stopSearching()}async pause(){return this.presenter.pauseSearching()}reset(){this.deletePendingViews(),this.deleteAllViews();}getNotificationPresenter(){return this.dataCaptureView.getNotificationPresenter()}toggleTorchIcon(t){this.torchIconButton!==null&&(this.torchIconButton.state=t);}onTorchButtonClick(){this.presenter.onTorchButtonClicked();}onCameraSwitchButtonClick(){this.presenter.onCameraSwitchButtonClicked();}onZoomButtonClick(){this.presenter.onZoomButtonClicked();}changeZoomButtonIcon(t){this.zoomButton&&(this.zoomButton.zoom=`${t}x`);}connectedCallback(){this.torchIconButton=a$6.create(),this.torchIconButton.slot=`controls-${this.torchControlPosition}`,this.torchIconButton.hidden=true,this.torchIconButton.addEventListener("pointerdown",this.onTorchButtonClickHandler),this.cameraSwitchButton=a$8.create(),this.cameraSwitchButton.slot=`controls-${this.cameraSwitchControlPosition}`,this.cameraSwitchButton.hidden=true,this.cameraSwitchButton.addEventListener("pointerdown",this.onCameraSwitchButtonHandler),this.zoomButton=a$7.create(),this.zoomButton.slot=`controls-${this.zoomControlPosition}`,this.zoomButton.hidden=true,this.zoomButton.addEventListener("pointerdown",this.onZoomButtonHandler),this.layout.append(this.torchIconButton,this.cameraSwitchButton,this.zoomButton),this.layout.addEventListener("pointerdown",this.onLayoutPointerDownHandler),this.layout.addEventListener("BarcodeArInfoAnnotationEventTap",this.onInfoAnnotationTapHandler),this.backdrop=Backdrop.create(),this.layout.append(this.backdrop),this.pendingDeletionTimeout=new Timeout(1e3,()=>{this.deletePendingViews();}),this.prepend(c.createStyleElement());}disconnectedCallback(){var t,e,o;this.deleteAllViews(),(t=this.torchIconButton)==null||t.removeEventListener("pointerdown",this.onTorchButtonClickHandler),(e=this.cameraSwitchButton)==null||e.removeEventListener("pointerdown",this.onCameraSwitchButtonHandler),(o=this.zoomButton)==null||o.removeEventListener("pointerdown",this.onZoomButtonHandler),this.layout.removeEventListener("pointerdown",this.onLayoutPointerDownHandler),this.layout.removeEventListener("BarcodeArInfoAnnotationEventTap",this.onInfoAnnotationTapHandler);}isPopoverAnnotation(t){return t instanceof b}isAnnotation(t){var e;return ((e=t.dataset)==null?void 0:e.identifier)==null?false:t.dataset.identifier.endsWith("-annotation")}areMultiplePopoverAllowed(){for(let t of this.layout.querySelectorAll("[data-identifier$='-annotation']"))if(t&&this.isPopoverAnnotation(t)&&t.annotationTrigger==="highlightTapAndBarcodeScan")return true;return false}async onLayoutPointerDown(t){let e=t.target,o=e==null?void 0:e.closest("[data-identifier$='-highlight']"),i=e==null?void 0:e.closest(b.tag);if((o==null?void 0:o.dataset.id)!=null){await this.handleHighlightClick(o);return}if((i==null?void 0:i.dataset.id)!=null){await this.handleAnnotationClick(i);return}await this.handleClickOutside();}async handleHighlightClick(t){var o;this.presenter.emitTappedFeedback(),(o=this.listener)==null||o.didTapHighlightForBarcode(this.presenter.barcodeAr,t.barcode,t);let e=this.queryAnnotationByDataIdentifier(t.dataset.identifier.replace("-highlight",""));!e||e.annotationTrigger==="barcodeScan"||(this.isPopoverAnnotation(e)?await this.handlePopoverHighlightClick(e,t):e.hidden=!e.hidden);}async handlePopoverHighlightClick(t,e){var o;if(!this.areMultiplePopoverAllowed()){let i=this.layout.querySelector(`${b.tag}[data-on-foreground="true"]`),n=(o=i==null?void 0:i.dataset.identifier)==null?void 0:o.replace("-annotation","-highlight"),r=this.layout.querySelector(`[data-identifier="${n}"]`);i!=null&&r!=null&&await this.hideBarcodeArPopover(i,r,false);}await this.toggleBarcodeArPopover(t,e);}async handleAnnotationClick(t){var i;let e=(i=t.dataset.identifier)==null?void 0:i.replace("-annotation","-highlight"),o=this.layout.querySelector(`[data-identifier="${e}"]`);o&&await this.toggleBarcodeArPopover(t,o);}async handleClickOutside(){var i;if(this.areMultiplePopoverAllowed())return;let t=this.layout.querySelector(`${b.tag}[data-on-foreground="true"]`);if(!t)return;let e=(i=t.dataset.identifier)==null?void 0:i.replace("-annotation","-highlight"),o=this.layout.querySelector(`[data-identifier="${e}"]`);o&&await this.hideBarcodeArPopover(t,o);}onInfoAnnotationTap(){this.presenter.emitTappedFeedback();}async showBarcodeArPopover(t,e){t.dataset.onForeground="true",t.hidden=false,e.dataset.onForeground="true",this.backdrop.open=true;}async hideBarcodeArPopover(t,e,o=true){t.dataset.onForeground="false",t.hidden=true,e&&(e.dataset.onForeground="false"),o&&this.hideBackdropIfNoPopovers();}hideBackdropIfNoPopovers(){[...this.layout.querySelectorAll(`${b.tag}`)].every(e=>e.hidden)&&(this.backdrop.open=false);}async toggleBarcodeArPopover(t,e){t.hidden?await this.showBarcodeArPopover(t,e):await this.hideBarcodeArPopover(t,e);}deleteAllViews(){for(let t of this.layout.querySelectorAll("[data-identifier]"))t.remove();}deletePendingViews(){for(let t of this.layout.querySelectorAll("[data-could-be-deleted='true']"))t.remove();this.hideBackdropIfNoPopovers();}identifierForHighlight(t){return `${t}-highlight`}identifierForAnnotation(t){return `${t}-annotation`}async onHighlightsOrAnnotationForTrackedBarcode(t){var e,o,i;await((o=(e=this.highlightProvider)!=null?e:W)==null?void 0:o.highlightForBarcode(t.barcode,async n=>this.onHighlight(t,n))),await((i=this.annotationProvider)==null?void 0:i.annotationForBarcode(t.barcode,async n=>this.onAnnotation(t,n)));}async onAnnotation(t,e){let o=e,i=a$9(t);this.updateExistingAnnotation(i)||(await this.setupNewAnnotation(o,i,t),this.updateAnnotationPosition(t,o));}updateExistingAnnotation(t){let e=this.queryAnnotationByDataId(t);return e?(e.dataset.couldBeDeleted="false",true):false}async setupNewAnnotation(t,e,o){if(t.dataset.id=e,t.dataset.identifier=this.identifierForAnnotation(o.identifier),t.hidden=true,this.layout.append(t),this.isPopoverAnnotation(t)){if(t.direction=Direction.Vertical,t.anchor==null&&(t.anchor="bottom-center"),this.areMultiplePopoverAllowed()||t.annotationTrigger==="highlightTapAndBarcodeScan"){let i=this.queryHighlightByDataId(e);i&&await this.showBarcodeArPopover(t,i);}}else t.hidden=t.annotationTrigger==="highlightTap";}getAnnotationVariationForQuad(t,e){let o=Math.max(0,Math.min(1,e)),i=t.anchorPositions,n=calculateArea(i),r=this.dataCaptureView.width,l=this.dataCaptureView.height,d=r*l;if(n<=0||d<=0)return 0;let u=n/d;return Math.max(0,Math.min(1,u))<=o?2:1}async onHighlight(t,e){let o=a$9(t),i=this.queryHighlightByDataId(o);i?i.dataset.couldBeDeleted="false":(e.dataset.id=o,e.dataset.identifier=this.identifierForHighlight(t.identifier),this.updateHighlightPosition(t,e),this.layout.append(e));}queryHighlightByDataIdentifier(t){return this.layout.querySelector(`[data-identifier$="${t}-highlight"]`)}queryAnnotationByDataIdentifier(t){return this.layout.querySelector(`[data-identifier$="${t}-annotation"]`)}queryHighlightByDataId(t){return this.layout.querySelector(`[data-identifier$="-highlight"][data-id="${t}"]`)}queryAnnotationByDataId(t){return this.layout.querySelector(`[data-identifier$="-annotation"][data-id="${t}"]`)}updateRemovedTrackedBarcodes(t){var i,n,r,l,d;let e=this.querySelectorAll("[data-identifier]");if(Object.keys(t.allTrackedBarcodes).length===0){for(let u of e)u.dataset.couldBeDeleted="true";(i=this.pendingDeletionTimeout)!=null&&i.running||(n=this.pendingDeletionTimeout)==null||n.start();return}let o=new Set(t.removedTrackedBarcodes);for(let u of e){let p=(r=u.dataset.identifier)==null?void 0:r.replace("-highlight","").replace("-annotation","");p!=null&&o.has(p)&&(u.dataset.couldBeDeleted="true");}(l=this.pendingDeletionTimeout)!=null&&l.running||(d=this.pendingDeletionTimeout)==null||d.start();}render(t){for(let[e,o]of Object.entries(t.allTrackedBarcodes)){t.addedTrackedBarcodes[e]!=null&&this.onHighlightsOrAnnotationForTrackedBarcode(o);let i=a$9(o),n=this.queryAnnotationByDataId(i),r=this.queryHighlightByDataId(i);r&&(this.updateBrushSize(r,o),this.updateHighlightPosition(o,r)),n&&this.updateAnnotationPosition(o,n,r);}this.updateRemovedTrackedBarcodes(t);}updateHighlightPosition(t,e,o="center"){if(e.hidden)return;let i=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(t.anchorPositions),n=this.normalizedViewPointFromFrameAnchorPositions(i,o);e.updatePosition(n,new Point(-50,-50),this.calculateRotationAngle(i.topLeft,i.topRight));}updateBrushSize(t,e){if(t.width==null||t.height==null)return;let o=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(e.anchorPositions),i=Math.round(calculateWidth(o)),n=Math.round(calculateHeight(o));t.width!==i&&(t.width=i),t.height!==n&&(t.height=n);}getTransformOrigin(t){return {"top-center":new Point(-50,0),"bottom-center":new Point(-50,-100),"left-center":new Point(0,-50),"right-center":new Point(-100,-50)}[t]}calculateAnnotationPosition(t,e,o){var p,w;let n=t.orderVerticesByPosition(),r=this.normalizedViewPointFromFrameAnchorPositions(t,"center"),d={"bottom-center":()=>{let s=this.normalizedViewPointFromFrameAnchorPositions(n,"topCenter");return new Point(s.x,s.y-7)},"top-center":()=>{let s=this.normalizedViewPointFromFrameAnchorPositions(n,"bottomCenter");return new Point(s.x,s.y+7)},"right-center":()=>{let s=this.normalizedViewPointFromFrameAnchorPositions(n,"centerLeft");return new Point(s.x-7,s.y)},"left-center":()=>{let s=this.normalizedViewPointFromFrameAnchorPositions(n,"centerRight");return new Point(s.x+7,s.y)}}[e]();return o?o instanceof b$1?(p={"bottom-center":new Point(r.x,r.y-7-o.clientHeight/2),"top-center":new Point(r.x,r.y+7+o.clientHeight/2),"right-center":new Point(r.x-7-o.clientWidth/2,r.y),"left-center":new Point(r.x+7+o.clientWidth/2,r.y)}[e])!=null?p:d:(w={"bottom-center":new Point(r.x,r.y-7-o.clientHeight/2),"top-center":new Point(r.x,r.y+7+o.clientHeight/2),"right-center":new Point(r.x-7-o.clientWidth/2,r.y),"left-center":new Point(r.x+7+o.clientWidth/2,r.y)}[e])!=null?w:d:d}updateAnnotationPosition(t,e,o){let i=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(t.anchorPositions);if(e.anchor||(e.anchor="top-center"),e.annotationVariation!=null){let l=this.getAnnotationVariationForQuad(t,a$5.threshold);e.annotationVariation=l;}let n=this.getTransformOrigin(e.anchor),r=this.calculateAnnotationPosition(i,e.anchor,o);e.updatePosition(r,n,this.calculateRotationAngle(i.topLeft,i.topRight));}normalizedViewPointFromFrameAnchorPositions(t,e="center"){let o=this.presenter.currentCamera.getMirrorImageEnabled(),i=new Size(this.dataCaptureView.width,this.dataCaptureView.height);if(o){let r=t[{centerLeft:"centerRight",centerRight:"centerLeft",center:"center",topCenter:"topCenter",bottomCenter:"bottomCenter"}[e]];return Point.mirrorX(r,i)}return t[e]}calculateRotationAngle(t,e){let o=e.x-t.x,n=this.presenter.isCameraMirrored()?-(e.y-t.y):e.y-t.y,r=Math.atan2(n,o);return Math.round(r*(180/Math.PI))}};c.tag="scandit-barcode-ar-view";var k=c;export{k as a};
@@ -1,4 +1,4 @@
1
- import {a as a$2}from'./chunk-M7AZ5E5Z.js';import {b as b$2}from'./chunk-2ASAIH4R.js';import {b as b$1}from'./chunk-5DP5VNWQ.js';import {a as a$3}from'./chunk-T2Y2C76P.js';import {a as a$1,b as b$3}from'./chunk-OPL5NVVM.js';import {e,f as f$1,a,b as b$4,d,c}from'./chunk-DVHTYKDX.js';import {f}from'./chunk-YBD5JYCX.js';import {Point}from'@scandit/web-datacapture-core';import {ScanditHTMLElement,defineCustomElements,safeCancelAnimation}from'@scandit/web-datacapture-core/build/js/private/utils/index.js';var b=class f$2 extends ScanditHTMLElement{constructor(){super(...arguments);this._pointerDownListener=this.onPointerDown.bind(this);this._pointerUpListener=this.onPointerUp.bind(this);this._longPressController=new b$1(this);this._longPressStartListener=this.onLongPressStart.bind(this);}get minimized(){return !this.hasAttribute("expanded")}set minimized(t){this.toggleAttribute("minimized",!t);}get expanded(){return this.hasAttribute("expanded")}set expanded(t){this.toggleAttribute("expanded",t),this._dragController&&(this._dragController.margin=t?new Point(-65,-65):new Point(0,0),this._dragController.repositionIfOutOfBounds());}get pressed(){return this.hasAttribute("pressed")}set pressed(t){this.toggleAttribute("pressed",t);}get visible(){return this.hasAttribute("visible")}set visible(t){this.toggleAttribute("visible",t);}static create(){return defineCustomElements({[f]:f$2}),document.createElement(f)}connectedCallback(){var t;this.append(this.render()),this._dragController=new b$2(this,(t=this.parentElement)==null?void 0:t.parentElement),this._dragController.connect(),this.addEventListener("pointerdown",this._pointerDownListener),this.addEventListener("pointerup",this._pointerUpListener),this.addEventListener("longpressstart",this._longPressStartListener),this._longPressController.connect(),this._longPressController.elementsAllowedToTriggerLongPressEvents.add(this),this._pulse=this.querySelector(".pulse"),this._pulseAnimation=new Animation(new KeyframeEffect(this._pulse,[{background:"rgba(0, 0, 0, 0)"},{background:`var(${e})`,transform:"translate(-50%, -50%) scale(1.1)"},{background:"rgba(0, 0, 0, 0)"}],{duration:1100,easing:"ease-out",iterations:Number.POSITIVE_INFINITY}));}disconnectedCallback(){var t;this.removeEventListener("pointerdown",this._pointerDownListener),this.removeEventListener("pointerup",this._pointerUpListener),this.removeEventListener("longpressstart",this._longPressStartListener),(t=this._dragController)==null||t.disconnect(),this._longPressController.disconnect(),this.innerHTML="";}repositionIfOutOfBounds(){var t;(t=this._dragController)==null||t.repositionIfOutOfBounds();}translateTo(t){var i;(i=this._dragController)==null||i.translateTo(t,false);}setImage(t){var n;let i=this.querySelector("div");(n=i.firstElementChild)==null||n.remove(),t&&i.append(t);}startPulsating(){var t;(t=this._pulseAnimation)==null||t.play();}stopPulsating(){this._pulseAnimation&&(safeCancelAnimation(this._pulseAnimation),this._pulseAnimation.currentTime=0);}render(){return a$2`
1
+ import {a as a$2}from'./chunk-M7AZ5E5Z.js';import {a as a$1,b as b$3}from'./chunk-OPL5NVVM.js';import {b as b$2}from'./chunk-YZHF42BC.js';import {b as b$1}from'./chunk-5DP5VNWQ.js';import {a as a$3}from'./chunk-T2Y2C76P.js';import {e,f as f$1,a,b as b$4,d,c}from'./chunk-DVHTYKDX.js';import {f}from'./chunk-YBD5JYCX.js';import {Point}from'@scandit/web-datacapture-core';import {ScanditHTMLElement,defineCustomElements,safeCancelAnimation}from'@scandit/web-datacapture-core/build/js/private/utils/index.js';var b=class f$2 extends ScanditHTMLElement{constructor(){super(...arguments);this._pointerDownListener=this.onPointerDown.bind(this);this._pointerUpListener=this.onPointerUp.bind(this);this._longPressController=new b$1(this);this._longPressStartListener=this.onLongPressStart.bind(this);}get minimized(){return !this.hasAttribute("expanded")}set minimized(t){this.toggleAttribute("minimized",!t);}get expanded(){return this.hasAttribute("expanded")}set expanded(t){this.toggleAttribute("expanded",t),this._dragController&&(this._dragController.margin=t?new Point(-65,-65):new Point(0,0),this._dragController.repositionIfOutOfBounds());}get pressed(){return this.hasAttribute("pressed")}set pressed(t){this.toggleAttribute("pressed",t);}get visible(){return this.hasAttribute("visible")}set visible(t){this.toggleAttribute("visible",t);}static create(){return defineCustomElements({[f]:f$2}),document.createElement(f)}connectedCallback(){var t;this.append(this.render()),this._dragController=new b$2(this,(t=this.parentElement)==null?void 0:t.parentElement),this._dragController.connect(),this.addEventListener("pointerdown",this._pointerDownListener),this.addEventListener("pointerup",this._pointerUpListener),this.addEventListener("longpressstart",this._longPressStartListener),this._longPressController.connect(),this._longPressController.elementsAllowedToTriggerLongPressEvents.add(this),this._pulse=this.querySelector(".pulse"),this._pulseAnimation=new Animation(new KeyframeEffect(this._pulse,[{background:"rgba(0, 0, 0, 0)"},{background:`var(${e})`,transform:"translate(-50%, -50%) scale(1.1)"},{background:"rgba(0, 0, 0, 0)"}],{duration:1100,easing:"ease-out",iterations:Number.POSITIVE_INFINITY}));}disconnectedCallback(){var t;this.removeEventListener("pointerdown",this._pointerDownListener),this.removeEventListener("pointerup",this._pointerUpListener),this.removeEventListener("longpressstart",this._longPressStartListener),(t=this._dragController)==null||t.disconnect(),this._longPressController.disconnect(),this.innerHTML="";}repositionIfOutOfBounds(){var t;(t=this._dragController)==null||t.repositionIfOutOfBounds();}translateTo(t){var i;(i=this._dragController)==null||i.translateTo(t,false);}setImage(t){var n;let i=this.querySelector("div");(n=i.firstElementChild)==null||n.remove(),t&&i.append(t);}startPulsating(){var t;(t=this._pulseAnimation)==null||t.play();}stopPulsating(){this._pulseAnimation&&(safeCancelAnimation(this._pulseAnimation),this._pulseAnimation.currentTime=0);}render(){return a$2`
2
2
  <div>
3
3
  <div class="pulse"></div>
4
4
  <svg width="49" height="26" viewBox="0 0 49 26" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -1,4 +1,4 @@
1
- import {a as a$2}from'./chunk-XSJEGOGN.js';import {a as a$1}from'./chunk-YQNNEW67.js';import {a as a$6,b as b$3}from'./chunk-2ASAIH4R.js';import {b}from'./chunk-5DP5VNWQ.js';import {a as a$5,b as b$2}from'./chunk-OPL5NVVM.js';import {g as g$2}from'./chunk-3A6GSH7S.js';import {g as g$1}from'./chunk-DVHTYKDX.js';import {a as a$3}from'./chunk-DOA2Q3CZ.js';import {j,i,f,a,g,n}from'./chunk-4JEIREAU.js';import {c,e,a as a$4,b as b$1}from'./chunk-YBD5JYCX.js';import {Point}from'@scandit/web-datacapture-core';import {ScanditHTMLElement,defineCustomElements,safeAwaitAnimation,safeCancelAnimation,html,Timeout}from'@scandit/web-datacapture-core/build/js/private/utils/index.js';var F=(i=>(i.ResizeButton="resizeButton",i.ZoomButton="zoomButton",i.TorchButton="torchButton",i.CloseButton="closeButton",i))(F||{}),q=1200,w=class w extends ScanditHTMLElement{constructor(){super(...arguments);this.resizeButtonTapListener=this.onResizeButtonTap.bind(this);this.zoomButtonTapListener=this.onZoomButtonTap.bind(this);this.torchButtonTapListener=this.onTorchButtonTap.bind(this);this.closeButtonTapListener=this.onCloseButtonTap.bind(this);this.pointerDownListener=this.onPointerDown.bind(this);this.longPressStartListener=this.onLongPressStart.bind(this);this.toolbarVisibilityChangeListener=this.onToolbarVisibilityChange.bind(this);this.longPressEndListener=this.onLongPressEnd.bind(this);this.dragEndListener=this.onDragEnd.bind(this);this.fadeOutAnimation=new Animation(new KeyframeEffect(this,[{opacity:1},{opacity:0}],{duration:500,fill:"both"}));this.replayFadeOutTimeout=null;this.longPressController=new b(this);}get visible(){return this.hasAttribute("visible")}set visible(t){this.toggleAttribute("visible",t);}get size(){return this.expanded?"expanded":"regular"}set size(t){var i;this.toggleAttribute("expanded",t==="expanded");let o=this.getNextTranslate();(i=this.dragController)==null||i.translateTo(o,false).then(async()=>{var n;return (n=this.dragController)==null?void 0:n.repositionIfOutOfBounds()});}get expanded(){return this.hasAttribute("expanded")}get[a](){var t;return Number((t=this.getAttribute(a))!=null?t:"1")}set[a](t){this.setAttribute(a,String(t));}get darkened(){return this.hasAttribute("darkened")}set darkened(t){this.toggleAttribute("darkened",t);}get orientation(){var t;return (t=this.getAttribute("orientation"))!=null?t:"portrait-primary"}set orientation(t){this.setAttribute("orientation",t);}get[g](){return this.hasAttribute(g)}set[g](t){this.toggleAttribute(g,t);}get[j](){return this.hasAttribute(j)}set[j](t){this.toggleAttribute(j,t);}get[i](){return this.hasAttribute(i)}set[i](t){this.toggleAttribute(i,t);}get[f](){return this.hasAttribute(f)}set[f](t){this.toggleAttribute(f,t);}get[n](){return this.hasAttribute(n)}set[n](t){this.toggleAttribute(n,t);}get cover(){return this.hasAttribute("cover")}set cover(t){this.toggleAttribute("cover",t);}get pressed(){return this.hasAttribute("pressed")}set pressed(t){this.toggleAttribute("pressed",t);}static create(){return defineCustomElements({[b$1]:w,[a$4]:a$3,[e]:a$2,[c]:a$1}),document.createElement(b$1)}repositionIfOutOfBounds(){var t;(t=this.dragController)==null||t.repositionIfOutOfBounds();}showToast(t,o,i){this.toast.show(t,o,i);}hideToast(){this.toast.hide();}zoomIn(){this.zoomButton&&(this[a]=2,this.zoomButton.textContent="2x",this.showToast("warning","2x zoom",1e3));}zoomOut(){this.zoomButton&&(this[a]=1,this.zoomButton.textContent="1x",this.showToast("info","1x zoom",1e3));}async fadeOut(){this.fadeOutAnimation.play(),await safeAwaitAnimation(this.fadeOutAnimation),this.visible=false;}cancelFadeOut(){var t;(t=this.replayFadeOutTimeout)==null||t.stop(),safeCancelAnimation(this.fadeOutAnimation);}async rewindAnimation(){var t,o;(((t=this.replayFadeOutTimeout)==null?void 0:t.running)===true||this.fadeOutAnimation.playState!=="idle")&&(this.cancelFadeOut(),(o=this.replayFadeOutTimeout)==null||o.start());}translateTo(t){var o;(o=this.dragController)==null||o.translateTo(t,false);}render(){var t,o,i$1,n$1,a$1,l,b;this.innerHTML=html`
1
+ import {a as a$2}from'./chunk-XSJEGOGN.js';import {a as a$1}from'./chunk-YQNNEW67.js';import {a as a$5,b as b$2}from'./chunk-OPL5NVVM.js';import {a as a$6,b as b$3}from'./chunk-YZHF42BC.js';import {b}from'./chunk-5DP5VNWQ.js';import {g as g$2}from'./chunk-3A6GSH7S.js';import {g as g$1}from'./chunk-DVHTYKDX.js';import {a as a$3}from'./chunk-DOA2Q3CZ.js';import {j,i,f,a,g,n}from'./chunk-4JEIREAU.js';import {c,e,a as a$4,b as b$1}from'./chunk-YBD5JYCX.js';import {Point}from'@scandit/web-datacapture-core';import {ScanditHTMLElement,defineCustomElements,safeAwaitAnimation,safeCancelAnimation,html,Timeout}from'@scandit/web-datacapture-core/build/js/private/utils/index.js';var F=(i=>(i.ResizeButton="resizeButton",i.ZoomButton="zoomButton",i.TorchButton="torchButton",i.CloseButton="closeButton",i))(F||{}),q=1200,w=class w extends ScanditHTMLElement{constructor(){super(...arguments);this.resizeButtonTapListener=this.onResizeButtonTap.bind(this);this.zoomButtonTapListener=this.onZoomButtonTap.bind(this);this.torchButtonTapListener=this.onTorchButtonTap.bind(this);this.closeButtonTapListener=this.onCloseButtonTap.bind(this);this.pointerDownListener=this.onPointerDown.bind(this);this.longPressStartListener=this.onLongPressStart.bind(this);this.toolbarVisibilityChangeListener=this.onToolbarVisibilityChange.bind(this);this.longPressEndListener=this.onLongPressEnd.bind(this);this.dragEndListener=this.onDragEnd.bind(this);this.fadeOutAnimation=new Animation(new KeyframeEffect(this,[{opacity:1},{opacity:0}],{duration:500,fill:"both"}));this.replayFadeOutTimeout=null;this.longPressController=new b(this);}get visible(){return this.hasAttribute("visible")}set visible(t){this.toggleAttribute("visible",t);}get size(){return this.expanded?"expanded":"regular"}set size(t){var i;this.toggleAttribute("expanded",t==="expanded");let o=this.getNextTranslate();(i=this.dragController)==null||i.translateTo(o,false).then(async()=>{var n;return (n=this.dragController)==null?void 0:n.repositionIfOutOfBounds()});}get expanded(){return this.hasAttribute("expanded")}get[a](){var t;return Number((t=this.getAttribute(a))!=null?t:"1")}set[a](t){this.setAttribute(a,String(t));}get darkened(){return this.hasAttribute("darkened")}set darkened(t){this.toggleAttribute("darkened",t);}get orientation(){var t;return (t=this.getAttribute("orientation"))!=null?t:"portrait-primary"}set orientation(t){this.setAttribute("orientation",t);}get[g](){return this.hasAttribute(g)}set[g](t){this.toggleAttribute(g,t);}get[j](){return this.hasAttribute(j)}set[j](t){this.toggleAttribute(j,t);}get[i](){return this.hasAttribute(i)}set[i](t){this.toggleAttribute(i,t);}get[f](){return this.hasAttribute(f)}set[f](t){this.toggleAttribute(f,t);}get[n](){return this.hasAttribute(n)}set[n](t){this.toggleAttribute(n,t);}get cover(){return this.hasAttribute("cover")}set cover(t){this.toggleAttribute("cover",t);}get pressed(){return this.hasAttribute("pressed")}set pressed(t){this.toggleAttribute("pressed",t);}static create(){return defineCustomElements({[b$1]:w,[a$4]:a$3,[e]:a$2,[c]:a$1}),document.createElement(b$1)}repositionIfOutOfBounds(){var t;(t=this.dragController)==null||t.repositionIfOutOfBounds();}showToast(t,o,i){this.toast.show(t,o,i);}hideToast(){this.toast.hide();}zoomIn(){this.zoomButton&&(this[a]=2,this.zoomButton.textContent="2x",this.showToast("warning","2x zoom",1e3));}zoomOut(){this.zoomButton&&(this[a]=1,this.zoomButton.textContent="1x",this.showToast("info","1x zoom",1e3));}async fadeOut(){this.fadeOutAnimation.play(),await safeAwaitAnimation(this.fadeOutAnimation),this.visible=false;}cancelFadeOut(){var t;(t=this.replayFadeOutTimeout)==null||t.stop(),safeCancelAnimation(this.fadeOutAnimation);}async rewindAnimation(){var t,o;(((t=this.replayFadeOutTimeout)==null?void 0:t.running)===true||this.fadeOutAnimation.playState!=="idle")&&(this.cancelFadeOut(),(o=this.replayFadeOutTimeout)==null||o.start());}translateTo(t){var o;(o=this.dragController)==null||o.translateTo(t,false);}render(){var t,o,i$1,n$1,a$1,l,b;this.innerHTML=html`
2
2
  <spark-scan-view-toast></spark-scan-view-toast>
3
3
  <div id="host"></div>
4
4
  <div id="controls">
@@ -1 +1 @@
1
- import {a}from'./chunk-DCUKY2F4.js';import {b}from'./chunk-QNZA644V.js';var y=class{constructor(){this.properties={};this.symbologies={};this._arucoDictionary=null;}get enabledSymbologies(){return Object.keys(this.symbologies).filter(o=>this.symbologies[o].isEnabled)}settingsForSymbology(o){if(!this.symbologies[o]){let t=b.SymbologySettings[o];t._symbology=o,this.symbologies[o]=t;}return this.symbologies[o]}setProperty(o,t){this.properties[o]=t;}getProperty(o){return this.properties[o]}enableSymbologies(o){for(let t of o)this.enableSymbology(t,true);}enableSymbology(o,t){this.settingsForSymbology(o).isEnabled=t,o==="aruco"&&(this._arucoDictionary=a.fromPreset("5X5_50"));}setArucoDictionary(o){this._arucoDictionary=o;}toJSONObject(){var o,t;return {properties:this.properties,symbologies:Object.keys(this.symbologies).reduce((i,e)=>(i[e]=this.symbologies[e].toJSONObject(),i),{}),arucoDictionary:(t=(o=this._arucoDictionary)==null?void 0:o.toJSONObject())!=null?t:null}}};export{y as a};
1
+ import {a}from'./chunk-DCUKY2F4.js';import {b}from'./chunk-OLJXVUYE.js';var y=class{constructor(){this.properties={};this.symbologies={};this._arucoDictionary=null;}get enabledSymbologies(){return Object.keys(this.symbologies).filter(o=>this.symbologies[o].isEnabled)}settingsForSymbology(o){if(!this.symbologies[o]){let t=b.SymbologySettings[o];t._symbology=o,this.symbologies[o]=t;}return this.symbologies[o]}setProperty(o,t){this.properties[o]=t;}getProperty(o){return this.properties[o]}enableSymbologies(o){for(let t of o)this.enableSymbology(t,true);}enableSymbology(o,t){this.settingsForSymbology(o).isEnabled=t,o==="aruco"&&(this._arucoDictionary=a.fromPreset("5X5_50"));}setArucoDictionary(o){this._arucoDictionary=o;}toJSONObject(){var o,t;return {properties:this.properties,symbologies:Object.keys(this.symbologies).reduce((i,e)=>(i[e]=this.symbologies[e].toJSONObject(),i),{}),arucoDictionary:(t=(o=this._arucoDictionary)==null?void 0:o.toJSONObject())!=null?t:null}}};export{y as a};
@@ -0,0 +1 @@
1
+ var i=(e=>(e.HighlightTap="highlightTap",e.HighlightTapAndBarcodeScan="highlightTapAndBarcodeScan",e.BarcodeScan="barcodeScan",e))(i||{}),n=(t=>(t.Top="top-center",t.Bottom="bottom-center",t.Left="left-center",t.Right="right-center",t))(n||{});export{i as a,n as b};
@@ -1 +1 @@
1
- import {a}from'./chunk-ZWUKKWEI.js';import {TorchState,Camera,FrameSourceState}from'@scandit/web-datacapture-core';var h=(t=>(t.Started="started",t.Paused="paused",t.Stopped="stopped",t))(h||{}),c=class{constructor(e,i,t,s,o){this.viewState="paused";this.barcodeFindViewUiListener=null;this.torchState=TorchState.Off;this.sessionState=null;this.barcodeFindView=e,this.barcodeFind=t,this.context=i,this.viewSettings=s,this.cameraSettings=o,t.feedback=a.createWithOptions(this.viewSettings.soundEnabled,this.viewSettings.hapticEnabled);}async prepare(){await this.barcodeFind.setEnabled(false),this.barcodeFind.addPrivateListener(this);let e=Camera.default;await this.context.setFrameSource(e),await this.context.frameSource.applySettings(this.cameraSettings),this.isTorchAvailable=await e.isTorchAvailable();}async dispose(){await this.context.removeMode(this.barcodeFind),this.barcodeFind.removePrivateListener(this);}async didPauseSearch(e){this.barcodeFindView.switchToPaused(Object.values(this.customerItemsListState),e);}async didStartSearch(){this.barcodeFindView.switchToStarted();}async didStopSearch(e){var i;(i=this.barcodeFindViewUiListener)==null||i.didTapFinishButton(e);}async onSetItemList(e){this.customerItemsListState=e.reduce((i,t)=>(i[t.searchOptions.barcodeData]=t,i),{}),this.barcodeFind.feedback.itemListUpdated.emit(),this.barcodeFindView.updateProgressBar(0,Object.values(this.customerItemsListState).length);}onDidUpdateSession(e,i,t){this.sessionState=i,this.barcodeFindView.updateProgressBar(this.sessionState.allFoundItems.length),this.barcodeFindView.renderDots(this.sessionState);}async onShutterButtonClicked(){this.viewState==="paused"||this.viewState==="stopped"?await this.startSearching():await this.pauseSearching();}async onTorchButtonClicked(){this.isTorchAvailable&&(await this.context.frameSource.setDesiredTorchState(this.torchState===TorchState.Off?TorchState.On:TorchState.Off),this.torchState=this.torchState===TorchState.Off?TorchState.On:TorchState.Off,this.barcodeFindView.toggleTorchIcon(this.torchState));}onDotClick(e){var t,s;let i=(t=this.sessionState)==null?void 0:t.trackedBarcodes[e];if(i!=null){let o=this.customerItemsListState[(s=i.barcode.data)!=null?s:""];this.barcodeFindView.moveCardOnTheFront(o);}}onFinishButtonClicked(){this.stopSearching();}onFindListUpdatedFeedback(){this.barcodeFind.feedback.itemListUpdated.emit();}onFeedback(){this.barcodeFind.feedback.found.emit(),this.barcodeFindView.setShutterButtonPulse(true);}async pauseSearching(){var e;this.viewState="paused",await((e=this.context.frameSource)==null?void 0:e.switchToDesiredState(FrameSourceState.Standby)),await this.barcodeFind.setEnabled(false),await this.barcodeFind.pause(),this.barcodeFindView.setShutterButtonPulse(false);}async startSearching(){var e;this.viewState="started",await((e=this.context.frameSource)==null?void 0:e.switchToDesiredState(FrameSourceState.On)),await this.barcodeFind.setEnabled(true),await this.barcodeFind.start();}async stopSearching(){var e;this.viewState="stopped",await this.barcodeFind.setEnabled(false),await((e=this.context.frameSource)==null?void 0:e.switchToDesiredState(FrameSourceState.Off)),await this.barcodeFind.stop(),this.barcodeFindView.setShutterButtonPulse(false),this.sessionState=null;}};export{h as a,c as b};
1
+ import {a}from'./chunk-YWNGCXKZ.js';import {TorchState,Camera,FrameSourceState}from'@scandit/web-datacapture-core';var h=(t=>(t.Started="started",t.Paused="paused",t.Stopped="stopped",t))(h||{}),c=class{constructor(e,i,t,s,o){this.viewState="paused";this.barcodeFindViewUiListener=null;this.torchState=TorchState.Off;this.sessionState=null;this.barcodeFindView=e,this.barcodeFind=t,this.context=i,this.viewSettings=s,this.cameraSettings=o,t.feedback=a.createWithOptions(this.viewSettings.soundEnabled,this.viewSettings.hapticEnabled);}async prepare(){await this.barcodeFind.setEnabled(false),this.barcodeFind.addPrivateListener(this);let e=Camera.default;await this.context.setFrameSource(e),await this.context.frameSource.applySettings(this.cameraSettings),this.isTorchAvailable=await e.isTorchAvailable();}async dispose(){await this.context.removeMode(this.barcodeFind),this.barcodeFind.removePrivateListener(this);}async didPauseSearch(e){this.barcodeFindView.switchToPaused(Object.values(this.customerItemsListState),e);}async didStartSearch(){this.barcodeFindView.switchToStarted();}async didStopSearch(e){var i;(i=this.barcodeFindViewUiListener)==null||i.didTapFinishButton(e);}async onSetItemList(e){this.customerItemsListState=e.reduce((i,t)=>(i[t.searchOptions.barcodeData]=t,i),{}),this.barcodeFind.feedback.itemListUpdated.emit(),this.barcodeFindView.updateProgressBar(0,Object.values(this.customerItemsListState).length);}onDidUpdateSession(e,i,t){this.sessionState=i,this.barcodeFindView.updateProgressBar(this.sessionState.allFoundItems.length),this.barcodeFindView.renderDots(this.sessionState);}async onShutterButtonClicked(){this.viewState==="paused"||this.viewState==="stopped"?await this.startSearching():await this.pauseSearching();}async onTorchButtonClicked(){this.isTorchAvailable&&(await this.context.frameSource.setDesiredTorchState(this.torchState===TorchState.Off?TorchState.On:TorchState.Off),this.torchState=this.torchState===TorchState.Off?TorchState.On:TorchState.Off,this.barcodeFindView.toggleTorchIcon(this.torchState));}onDotClick(e){var t,s;let i=(t=this.sessionState)==null?void 0:t.trackedBarcodes[e];if(i!=null){let o=this.customerItemsListState[(s=i.barcode.data)!=null?s:""];this.barcodeFindView.moveCardOnTheFront(o);}}onFinishButtonClicked(){this.stopSearching();}onFindListUpdatedFeedback(){this.barcodeFind.feedback.itemListUpdated.emit();}onFeedback(){this.barcodeFind.feedback.found.emit(),this.barcodeFindView.setShutterButtonPulse(true);}async pauseSearching(){var e;this.viewState="paused",await((e=this.context.frameSource)==null?void 0:e.switchToDesiredState(FrameSourceState.Standby)),await this.barcodeFind.setEnabled(false),await this.barcodeFind.pause(),this.barcodeFindView.setShutterButtonPulse(false);}async startSearching(){var e;this.viewState="started",await((e=this.context.frameSource)==null?void 0:e.switchToDesiredState(FrameSourceState.On)),await this.barcodeFind.setEnabled(true),await this.barcodeFind.start();}async stopSearching(){var e;this.viewState="stopped",await this.barcodeFind.setEnabled(false),await((e=this.context.frameSource)==null?void 0:e.switchToDesiredState(FrameSourceState.Off)),await this.barcodeFind.stop(),this.barcodeFindView.setShutterButtonPulse(false),this.sessionState=null;}};export{h as a,c as b};
@@ -1 +1 @@
1
- import {a}from'./chunk-WPSMXGDG.js';import {a as a$1}from'./chunk-OLFIL5XY.js';import {b}from'./chunk-QNZA644V.js';import {CameraSettings,convertToPublicFrameData,Logger}from'@scandit/web-datacapture-core';var p=class u{constructor(){this.type="barcodeCapture";this._isEnabled=true;this._feedback=a.default;this._context=null;this.listeners=new Set;this.allowedRemainingWorkerMessages=new Set;this.workerMessageListener=this.onWorkerMessage.bind(this);}static get recommendedCameraSettings(){return new CameraSettings(b.BarcodeCapture.RecommendedCameraSettings)}get context(){return this._context}get feedback(){return this._feedback}static async forContext(e,a){let t=new u;return t.settings=a,e&&await e.addMode(t),t}async setFeedback(e){return this._feedback=e,this.notifyContext()}isEnabled(){return this._isEnabled}async setEnabled(e){this._isEnabled=e,await this.notifyContext();}async applySettings(e){return this.settings=e,this.notifyContext()}addListener(e){this.listeners.has(e)||this.listeners.add(e);}removeListener(e){this.listeners.delete(e);}toJSONObject(){return {type:this.type,enabled:this._isEnabled,feedback:this.feedback.toJSONObject(),settings:this.settings.toJSONObject()}}attachedToContext(e){this._context=e,this._context.subscribeToWorkerMessages(this.workerMessageListener);}async detachedFromContext(){var e;(e=this._context)==null||e.unsubscribeToWorkerMessages(this.workerMessageListener),this._context=null;}sendClearFrameDataRequest(e){setTimeout(()=>{var a;(a=this.context)==null||a.workerCommand("deleteFrameData",{frameId:e});},0);}async onDidScan(e){if(this.context==null)return;let a=a$1.fromJSON(e.payload.session),{frameData:t}=e.payload;if(!this._isEnabled){this.sendClearFrameDataRequest(t.frameId),this.allowedRemainingWorkerMessages.clear();return}this.allowedRemainingWorkerMessages.add("successFeedback");let o=[];for(let r of this.listeners)if(r.didScan)try{let s=r.didScan(this,a,convertToPublicFrameData(t,this.context));s instanceof Promise&&await s;}catch(s){o.push(s);}this.sendClearFrameDataRequest(t.frameId),this.allowedRemainingWorkerMessages.add("barcodeCaptureDidUpdateSession");for(let r of o)Logger.log(Logger.Level.Error,r);}onDidUpdateSession(e){let a=a$1.fromJSON(e.payload);if(!(!this._isEnabled&&!this.allowedRemainingWorkerMessages.has(e.type))){this.allowedRemainingWorkerMessages.delete(e.type);for(let t of this.listeners)t.didUpdateSession&&t.didUpdateSession(this,a);}}onSuccessFeedback(e){!this._isEnabled&&!this.allowedRemainingWorkerMessages.has(e.type)||(this.allowedRemainingWorkerMessages.delete(e.type),this.feedback.success.emit());}async onWorkerMessage(e){switch(e.type){case "barcodeCaptureDidScan":{this.onDidScan(e);break}case "barcodeCaptureDidUpdateSession":{this.onDidUpdateSession(e);break}case "successFeedback":{this.onSuccessFeedback(e);break}}}async notifyContext(){this.context!=null&&await this.context.update();}};export{p as a};
1
+ import {a}from'./chunk-WPSMXGDG.js';import {a as a$1}from'./chunk-OLFIL5XY.js';import {b}from'./chunk-OLJXVUYE.js';import {CameraSettings,convertToPublicFrameData,Logger}from'@scandit/web-datacapture-core';var p=class u{constructor(){this.type="barcodeCapture";this._isEnabled=true;this._feedback=a.default;this._context=null;this.listeners=new Set;this.allowedRemainingWorkerMessages=new Set;this.workerMessageListener=this.onWorkerMessage.bind(this);}static get recommendedCameraSettings(){return new CameraSettings(b.BarcodeCapture.RecommendedCameraSettings)}get context(){return this._context}get feedback(){return this._feedback}static async forContext(e,a){let t=new u;return t.settings=a,e&&await e.setMode(t),t}async setFeedback(e){return this._feedback=e,this.notifyContext()}isEnabled(){return this._isEnabled}async setEnabled(e){this._isEnabled=e,await this.notifyContext();}async applySettings(e){return this.settings=e,this.notifyContext()}addListener(e){this.listeners.has(e)||this.listeners.add(e);}removeListener(e){this.listeners.delete(e);}toJSONObject(){return {type:this.type,enabled:this._isEnabled,feedback:this.feedback.toJSONObject(),settings:this.settings.toJSONObject()}}attachedToContext(e){this._context=e,this._context.subscribeToWorkerMessages(this.workerMessageListener);}async detachedFromContext(){var e;(e=this._context)==null||e.unsubscribeToWorkerMessages(this.workerMessageListener),this._context=null;}sendClearFrameDataRequest(e){setTimeout(()=>{var a;(a=this.context)==null||a.workerCommand("deleteFrameData",{frameId:e});},0);}async onDidScan(e){if(this.context==null)return;let a=a$1.fromJSON(e.payload.session),{frameData:t}=e.payload;if(!this._isEnabled){this.sendClearFrameDataRequest(t.frameId),this.allowedRemainingWorkerMessages.clear();return}this.allowedRemainingWorkerMessages.add("successFeedback");let o=[];for(let r of this.listeners)if(r.didScan)try{let s=r.didScan(this,a,convertToPublicFrameData(t,this.context));s instanceof Promise&&await s;}catch(s){o.push(s);}this.sendClearFrameDataRequest(t.frameId),this.allowedRemainingWorkerMessages.add("barcodeCaptureDidUpdateSession");for(let r of o)Logger.log(Logger.Level.Error,r);}onDidUpdateSession(e){let a=a$1.fromJSON(e.payload);if(!(!this._isEnabled&&!this.allowedRemainingWorkerMessages.has(e.type))){this.allowedRemainingWorkerMessages.delete(e.type);for(let t of this.listeners)t.didUpdateSession&&t.didUpdateSession(this,a);}}onSuccessFeedback(e){!this._isEnabled&&!this.allowedRemainingWorkerMessages.has(e.type)||(this.allowedRemainingWorkerMessages.delete(e.type),this.feedback.success.emit());}async onWorkerMessage(e){switch(e.type){case "barcodeCaptureDidScan":{this.onDidScan(e);break}case "barcodeCaptureDidUpdateSession":{this.onDidUpdateSession(e);break}case "successFeedback":{this.onSuccessFeedback(e);break}}}async notifyContext(){this.context!=null&&await this.context.update();}};export{p as a};
@@ -1 +1 @@
1
- import {a}from'./chunk-SEJXDETX.js';import {a as a$1}from'./chunk-XLC2JHJV.js';import {Color}from'@scandit/web-datacapture-core';import {ScanditHTMLElement,html,defineCustomElements,css}from'@scandit/web-datacapture-core/build/js/private/utils/index.js';var o=class o extends ScanditHTMLElement{constructor(){super();this.onIcon=void 0;this.offIcon=void 0;let t=this.attachShadow({mode:"open"});t.innerHTML=html`<button><slot></slot></button>`,t.append(o.createStyleElement().cloneNode(true));}get state(){var t;return (t=this.getAttribute("state"))!=null?t:"off"}set state(t){this.setAttribute("state",t);}static create(){return document.createElement(o.tag)}static register(){defineCustomElements({[o.tag]:o});}static createStyleElement(){return css`:host button{background:none;border:none;display:flex;margin:0;outline:none;padding:0}`}connectedCallback(){let t=Color.fromHex("#FFFFFF");this.onIcon=a.create(),this.offIcon=a$1.create(),this.onIcon.setAttribute("shadow",""),this.offIcon.setAttribute("shadow",""),this.onIcon.size=36,this.offIcon.size=36,this.offIcon.fill=`#${t.withAlpha(.5).toJSON()}`,this.onIcon.fill=`#${t.toJSON()}`;let e="off";(this.getAttribute("state")==="on"||this.getAttribute("state")==="off")&&(e=this.getAttribute("state")),this.state=e;}attributeChangedCallback(t,e,a){t==="state"&&this.render(a);}render(t){t==="on"?(this.offIcon!=null&&this.offIcon.remove(),this.onIcon!=null&&this.append(this.onIcon)):(this.onIcon!=null&&this.onIcon.remove(),this.offIcon!=null&&this.append(this.offIcon));}};o.tag="scandit-find-torch-button",o.observedAttributes=["state"];var n=o;n.register();export{n as a};
1
+ import {a as a$1}from'./chunk-XLC2JHJV.js';import {a}from'./chunk-SEJXDETX.js';import {Color}from'@scandit/web-datacapture-core';import {ScanditHTMLElement,html,defineCustomElements,css}from'@scandit/web-datacapture-core/build/js/private/utils/index.js';var o=class o extends ScanditHTMLElement{constructor(){super();this.onIcon=void 0;this.offIcon=void 0;let t=this.attachShadow({mode:"open"});t.innerHTML=html`<button><slot></slot></button>`,t.append(o.createStyleElement().cloneNode(true));}get state(){var t;return (t=this.getAttribute("state"))!=null?t:"off"}set state(t){this.setAttribute("state",t);}static create(){return document.createElement(o.tag)}static register(){defineCustomElements({[o.tag]:o});}static createStyleElement(){return css`:host button{background:none;border:none;display:flex;margin:0;outline:none;padding:0}`}connectedCallback(){let t=Color.fromHex("#FFFFFF");this.onIcon=a.create(),this.offIcon=a$1.create(),this.onIcon.setAttribute("shadow",""),this.offIcon.setAttribute("shadow",""),this.onIcon.size=36,this.offIcon.size=36,this.offIcon.fill=`#${t.withAlpha(.5).toJSON()}`,this.onIcon.fill=`#${t.toJSON()}`;let e="off";(this.getAttribute("state")==="on"||this.getAttribute("state")==="off")&&(e=this.getAttribute("state")),this.state=e;}attributeChangedCallback(t,e,a){t==="state"&&this.render(a);}render(t){t==="on"?(this.offIcon!=null&&this.offIcon.remove(),this.onIcon!=null&&this.append(this.onIcon)):(this.onIcon!=null&&this.onIcon.remove(),this.offIcon!=null&&this.append(this.offIcon));}};o.tag="scandit-find-torch-button",o.observedAttributes=["state"];var n=o;n.register();export{n as a};
@@ -1 +1 @@
1
- import {a}from'./chunk-DCUKY2F4.js';import {b}from'./chunk-QNZA644V.js';import {PrivateNoneLocationSelection}from'@scandit/web-datacapture-core';var S=class{constructor(){this.codeDuplicateFilter=b.BarcodeCapture.BarcodeCaptureSettings.codeDuplicateFilter;this.locationSelection=null;this.enabledCompositeTypes=[];this.scanIntention="manual";this.properties={};this.symbologies={};this._arucoDictionary=null;}get enabledSymbologies(){return Object.keys(this.symbologies).filter(o=>{var e;return (e=this.symbologies[o])==null?void 0:e.isEnabled})}get compositeTypeDescriptions(){return b.CompositeTypeDescriptions.reduce((o,e)=>(o[e.types[0]]=e,o),{})}settingsForSymbology(o){if(!this.symbologies[o]){let e=b.SymbologySettings[o];e._symbology=o,this.symbologies[o]=e;}return this.symbologies[o]}setProperty(o,e){this.properties[o]=e;}getProperty(o){return this.properties[o]}enableSymbologies(o){for(let e of o)this.enableSymbology(e,true);}enableSymbology(o,e){this.settingsForSymbology(o).isEnabled=e,o==="aruco"&&(this._arucoDictionary=a.fromPreset("5X5_50"));}enableSymbologiesForCompositeTypes(o){for(let e of o)this.enableSymbologies(this.compositeTypeDescriptions[e].symbologies);}setArucoDictionary(o){this._arucoDictionary=o;}toJSONObject(){var e,i,r,n,s;let o={};return {codeDuplicateFilter:this.codeDuplicateFilter,enabledCompositeTypes:[...this.enabledCompositeTypes],locationSelection:(i=(e=this.locationSelection)==null?void 0:e.toJSONObject())!=null?i:PrivateNoneLocationSelection,properties:{...this.properties},symbologies:Object.keys(this.symbologies).reduce((c,l)=>{var a;let y=(a=this.symbologies[l])==null?void 0:a.toJSONObject();return y&&(c[l]=y),c},o),scanIntention:(r=this.scanIntention)!=null?r:null,arucoDictionary:(s=(n=this._arucoDictionary)==null?void 0:n.toJSONObject())!=null?s:null}}};export{S as a};
1
+ import {a}from'./chunk-DCUKY2F4.js';import {b}from'./chunk-OLJXVUYE.js';import {PrivateNoneLocationSelection}from'@scandit/web-datacapture-core';var S=class{constructor(){this.codeDuplicateFilter=b.BarcodeCapture.BarcodeCaptureSettings.codeDuplicateFilter;this.locationSelection=null;this.enabledCompositeTypes=[];this.scanIntention="manual";this.properties={};this.symbologies={};this._arucoDictionary=null;}get enabledSymbologies(){return Object.keys(this.symbologies).filter(o=>{var e;return (e=this.symbologies[o])==null?void 0:e.isEnabled})}get compositeTypeDescriptions(){return b.CompositeTypeDescriptions.reduce((o,e)=>(o[e.types[0]]=e,o),{})}settingsForSymbology(o){if(!this.symbologies[o]){let e=b.SymbologySettings[o];e._symbology=o,this.symbologies[o]=e;}return this.symbologies[o]}setProperty(o,e){this.properties[o]=e;}getProperty(o){return this.properties[o]}enableSymbologies(o){for(let e of o)this.enableSymbology(e,true);}enableSymbology(o,e){this.settingsForSymbology(o).isEnabled=e,o==="aruco"&&(this._arucoDictionary=a.fromPreset("5X5_50"));}enableSymbologiesForCompositeTypes(o){for(let e of o)this.enableSymbologies(this.compositeTypeDescriptions[e].symbologies);}setArucoDictionary(o){this._arucoDictionary=o;}toJSONObject(){var e,i,r,n,s;let o={};return {codeDuplicateFilter:this.codeDuplicateFilter,enabledCompositeTypes:[...this.enabledCompositeTypes],locationSelection:(i=(e=this.locationSelection)==null?void 0:e.toJSONObject())!=null?i:PrivateNoneLocationSelection,properties:{...this.properties},symbologies:Object.keys(this.symbologies).reduce((c,l)=>{var a;let y=(a=this.symbologies[l])==null?void 0:a.toJSONObject();return y&&(c[l]=y),c},o),scanIntention:(r=this.scanIntention)!=null?r:null,arucoDictionary:(s=(n=this._arucoDictionary)==null?void 0:n.toJSONObject())!=null?s:null}}};export{S as a};
@@ -1 +1 @@
1
- import {b}from'./chunk-QNZA644V.js';var i=class{constructor(){this.properties={};this.symbologies={};}get enabledSymbologies(){return Object.keys(this.symbologies).filter(e=>this.symbologies[e].isEnabled)}settingsForSymbology(e){if(!this.symbologies[e]){let o=b.SymbologySettings[e];o._symbology=e,this.symbologies[e]=o;}return this.symbologies[e]}setProperty(e,o){this.properties[e]=o;}getProperty(e){return this.properties[e]}enableSymbologies(e){for(let o of e)this.enableSymbology(o,true);}enableSymbology(e,o){this.settingsForSymbology(e).isEnabled=o;}toJSONObject(){return {properties:this.properties,symbologies:Object.keys(this.symbologies).reduce((e,o)=>(e[o]=this.symbologies[o].toJSONObject(),e),{})}}};export{i as a};
1
+ import {b}from'./chunk-OLJXVUYE.js';var i=class{constructor(){this.properties={};this.symbologies={};}get enabledSymbologies(){return Object.keys(this.symbologies).filter(e=>this.symbologies[e].isEnabled)}settingsForSymbology(e){if(!this.symbologies[e]){let o=b.SymbologySettings[e];o._symbology=e,this.symbologies[e]=o;}return this.symbologies[e]}setProperty(e,o){this.properties[e]=o;}getProperty(e){return this.properties[e]}enableSymbologies(e){for(let o of e)this.enableSymbology(o,true);}enableSymbology(e,o){this.settingsForSymbology(e).isEnabled=o;}toJSONObject(){return {properties:this.properties,symbologies:Object.keys(this.symbologies).reduce((e,o)=>(e[o]=this.symbologies[o].toJSONObject(),e),{})}}};export{i as a};
@@ -1,7 +1,7 @@
1
- import {b}from'./chunk-YJ42KEYE.js';import {a as a$6}from'./chunk-QCO6TK2S.js';import {a}from'./chunk-WRTJHOS5.js';import {a as a$8}from'./chunk-7J6MRLL2.js';import {a as a$2}from'./chunk-YH5IBNOK.js';import {a as a$7}from'./chunk-5GGUCEGU.js';import {b as b$1}from'./chunk-EWLALL5J.js';import {a as a$4}from'./chunk-GLJCW3XH.js';import {a as a$5}from'./chunk-POONUNDO.js';import {b as b$2}from'./chunk-K4D6B66I.js';import {a as a$1}from'./chunk-7GJVUU3G.js';import {a as a$3}from'./chunk-I53W7VSB.js';import {b as b$3}from'./chunk-QNZA644V.js';import {Anchor,Localization,DataCaptureView,Size,Point}from'@scandit/web-datacapture-core';import {ShutterButton}from'@scandit/web-datacapture-core/build/js/private/ui/atoms/ShutterButton.js';import {ScanditHTMLElement}from'@scandit/web-datacapture-core/build/js/private/utils/ScanditHTMLElement.js';import {defineCustomElements}from'@scandit/web-datacapture-core/build/js/private/utils/defineCustomElements.js';import {html}from'@scandit/web-datacapture-core/build/js/private/utils/html.js';import {Card}from'@scandit/web-datacapture-core/build/js/private/ui/atoms/Card.js';var d={FinishButton:a$2.tag,ShutterButton:ShutterButton.tag,ProgressBarWithLabel:a.tag,CardListContainer:b$1.tag,TorchIconButton:a$1.tag},c=class c extends ScanditHTMLElement{constructor(){super(...arguments);this.shouldShowCarousel=true;this.shouldShowPauseButton=true;this.shouldShowFinishButton=true;this.shouldShowProgressBar=true;this.shouldShowTorchControl=false;this.torchControlPosition=Anchor.TopLeft;this.textForItemListUpdatedWhenPausedHint=null;this.textForItemListUpdatedHint=null;this.textForTapShutterToResumeSearchHint=null;this.textForTapShutterToPauseScreenHint=null;this.textForMoveCloserToBarcodesHint=null;this.textForPointAtBarcodesToSearchHint=null;this.textForAllItemsFoundSuccessfullyHint=null;this.textForCollapseCardsButton=Localization.getInstance().get("barcode.find.view.textForCollapseCardsButton");this.barcodeFindViewUiListener=null;this.shutterButton=null;this.finishButton=null;this.progressBar=null;this.cardList=null;this.onShutterButtonClickedHandler=this.onShutterButtonClicked.bind(this);this.onFinishButtonClickedHandler=this.onFinishButtonClicked.bind(this);this.onTorchButtonClickedHandler=this.onTorchButtonClicked.bind(this);this.torchIconButton=null;this.onDotClickHandler=this.onDotClick.bind(this);}get camera(){return this.presenter.context.frameSource}static async createWithSettings(t,o,i,s,r){let e=document.createElement(c.tag);return e.barcodeFindViewSettings=s,e.layout=b.create(),e.layout.innerHTML=html`
1
+ import {a as a$7}from'./chunk-5GGUCEGU.js';import {b as b$1}from'./chunk-EWLALL5J.js';import {a as a$6}from'./chunk-QCO6TK2S.js';import {a}from'./chunk-WRTJHOS5.js';import {b}from'./chunk-YJ42KEYE.js';import {a as a$8}from'./chunk-7J6MRLL2.js';import {a as a$2}from'./chunk-YH5IBNOK.js';import {a as a$4}from'./chunk-TFYQKG6K.js';import {a as a$5}from'./chunk-POONUNDO.js';import {b as b$2}from'./chunk-IHFZ5YLD.js';import {a as a$1}from'./chunk-JKO4EZPZ.js';import {a as a$3}from'./chunk-I53W7VSB.js';import {b as b$3}from'./chunk-OLJXVUYE.js';import {Anchor,Localization,DataCaptureView,Size,Point}from'@scandit/web-datacapture-core';import {ShutterButton}from'@scandit/web-datacapture-core/build/js/private/ui/atoms/ShutterButton.js';import {ScanditHTMLElement}from'@scandit/web-datacapture-core/build/js/private/utils/ScanditHTMLElement.js';import {defineCustomElements}from'@scandit/web-datacapture-core/build/js/private/utils/defineCustomElements.js';import {html}from'@scandit/web-datacapture-core/build/js/private/utils/html.js';import {Card}from'@scandit/web-datacapture-core/build/js/private/ui/atoms/Card.js';var d={FinishButton:a$2.tag,ShutterButton:ShutterButton.tag,ProgressBarWithLabel:a.tag,CardListContainer:b$1.tag,TorchIconButton:a$1.tag},c=class c extends ScanditHTMLElement{constructor(){super(...arguments);this.shouldShowCarousel=true;this.shouldShowPauseButton=true;this.shouldShowFinishButton=true;this.shouldShowProgressBar=true;this.shouldShowTorchControl=false;this.torchControlPosition=Anchor.TopLeft;this.textForItemListUpdatedWhenPausedHint=null;this.textForItemListUpdatedHint=null;this.textForTapShutterToResumeSearchHint=null;this.textForTapShutterToPauseScreenHint=null;this.textForMoveCloserToBarcodesHint=null;this.textForPointAtBarcodesToSearchHint=null;this.textForAllItemsFoundSuccessfullyHint=null;this.textForCollapseCardsButton=Localization.getInstance().get("barcode.find.view.textForCollapseCardsButton");this.barcodeFindViewUiListener=null;this.shutterButton=null;this.finishButton=null;this.progressBar=null;this.cardList=null;this.onShutterButtonClickedHandler=this.onShutterButtonClicked.bind(this);this.onFinishButtonClickedHandler=this.onFinishButtonClicked.bind(this);this.onTorchButtonClickedHandler=this.onTorchButtonClicked.bind(this);this.torchIconButton=null;this.onDotClickHandler=this.onDotClick.bind(this);}get camera(){return this.presenter.context.frameSource}static async createWithSettings(t,o,i,s,r){let e=document.createElement(c.tag);return e.barcodeFindViewSettings=s,e.layout=b.create(),e.layout.innerHTML=html`
2
2
  <${a.tag} slot="progress" value="0" max="1" ${e.shouldShowProgressBar?"":"hidden"}></${a.tag}>
3
3
  <${a$1.tag} slot="top-controls-left" ${e.shouldShowTorchControl?"":"hidden"}></${a$1.tag}>
4
4
  <${b$1.tag} slot="card-list" hidden text-for-collapse-cards-button=${e.textForCollapseCardsButton}></${b$1.tag}>
5
5
  <${ShutterButton.tag} slot="bottom-controls-center" variant="play" ${e.shouldShowPauseButton?"":"hidden"}></${ShutterButton.tag}>
6
6
  <${a$2.tag} slot="bottom-controls-right" ${e.shouldShowFinishButton?"":"hidden"}></${a$2.tag}>
7
- `,e.append(e.layout),a$3(t)?(e.dataCaptureView=t,t.htmlElement.prepend(e),await o.addMode(i),await t.setContext(o)):(e.dataCaptureView=await DataCaptureView.forContext(o),e.dataCaptureView.connectToElement(t),t.prepend(e)),e.presenter=new b$2(e,o,i,s,r!=null?r:a$4.recommendedCameraSettings),await e.presenter.prepare(),e.barcodeFindBasicOverlay=await a$5.withBarcodeFind(i,e.dataCaptureView),e}static async create(t,o,i){return c.createWithSettings(t,o,i,b$3.BarcodeFind.BarcodeFindViewSettings.settings,a$4.recommendedCameraSettings)}static register(){defineCustomElements({[c.tag]:c});}async startSearching(){return this.onShutterButtonClickedHandler()}async stopSearching(){return this.presenter.stopSearching()}async pauseSearching(){return this.onShutterButtonClickedHandler()}setListener(t){this.barcodeFindViewUiListener=t,this.presenter.barcodeFindViewUiListener=this.barcodeFindViewUiListener;}async setShouldShowUserGuidanceView(t){return this.shouldShowUserGuidance=t,this.barcodeFindBasicOverlay.setUserGuidanceEnabled(this.shouldShowUserGuidance)}async setShouldShowHints(t){return this.shouldShowHints=t,this.barcodeFindBasicOverlay.setShouldShowHint(this.shouldShowHints)}setShouldShowCarousel(t){this.shouldShowCarousel=t,this.layout.toggleVisibility(d.CardListContainer,t);}setShouldShowPauseButton(t){this.shouldShowPauseButton=t,this.layout.toggleVisibility(d.ShutterButton,t);}setShouldShowFinishButton(t){this.shouldShowFinishButton=t,this.layout.toggleVisibility(d.FinishButton,t);}setShouldShowProgressBar(t){this.shouldShowProgressBar=t,this.layout.toggleVisibility(d.ProgressBarWithLabel,t);}setShouldShowTorchControl(t){this.shouldShowTorchControl=this.presenter.isTorchAvailable?t:false,this.layout.toggleVisibility(d.TorchIconButton,this.shouldShowTorchControl);}setTorchControlPosition(t){var i;this.torchControlPosition=t,[Anchor.TopCenter,Anchor.TopLeft,Anchor.TopRight,Anchor.BottomLeft].includes(t)||(this.torchControlPosition=Anchor.TopLeft);let o={[Anchor.TopCenter]:"top-controls-center",[Anchor.TopLeft]:"top-controls-left",[Anchor.TopRight]:"top-controls-right",[Anchor.BottomLeft]:"bottom-controls-left"}[this.torchControlPosition];(i=this.torchIconButton)==null||i.setAttribute("slot",o);}setTextForCollapseCardsButton(t){this.textForCollapseCardsButton=t,this.cardList!=null&&(this.cardList["text-for-collapse-cards-button"]=t);}async setTextForAllItemsFoundSuccessfullyHint(t){return this.textForAllItemsFoundSuccessfullyHint=t,this.barcodeFindBasicOverlay.setTextForAllItemsFoundSuccessfullyHint(this.textForAllItemsFoundSuccessfullyHint)}async setTextForPointAtBarcodesToSearchHint(t){return this.textForPointAtBarcodesToSearchHint=t,this.barcodeFindBasicOverlay.setTextForPointAtBarcodesToSearchHint(this.textForPointAtBarcodesToSearchHint)}async setTextForMoveCloserToBarcodesHint(t){return this.textForMoveCloserToBarcodesHint=t,this.barcodeFindBasicOverlay.setTextForPointAtBarcodesToSearchHint(this.textForMoveCloserToBarcodesHint)}async setTextForTapShutterToPauseScreenHint(t){return this.textForTapShutterToPauseScreenHint=t,this.barcodeFindBasicOverlay.setTextForPointAtBarcodesToSearchHint(this.textForTapShutterToPauseScreenHint)}async setTextForTapShutterToResumeSearchHint(t){return this.textForTapShutterToResumeSearchHint=t,this.barcodeFindBasicOverlay.setTextForTapShutterToResumeScreenHint(this.textForTapShutterToResumeSearchHint)}async setTextForItemListUpdatedWhenPausedHint(t){return this.textForItemListUpdatedWhenPausedHint=t,this.barcodeFindBasicOverlay.setTextForItemListUpdatedWhenPausedHint(this.textForItemListUpdatedWhenPausedHint)}async setTextForItemListUpdatedHint(t){return this.textForItemListUpdatedHint=t,this.barcodeFindBasicOverlay.setTextForItemListUpdatedWhenPausedHint(this.textForItemListUpdatedHint)}connectedCallback(){var t,o,i;this.shutterButton=this.layout.querySelector(d.ShutterButton),this.finishButton=this.layout.querySelector(d.FinishButton),this.progressBar=this.layout.querySelector(d.ProgressBarWithLabel),this.cardList=this.layout.querySelector(d.CardListContainer),this.torchIconButton=this.layout.querySelector(d.TorchIconButton),(t=this.torchIconButton)==null||t.addEventListener("pointerdown",this.onTorchButtonClickedHandler),(o=this.shutterButton)==null||o.addEventListener("pointerdown",this.onShutterButtonClickedHandler),(i=this.finishButton)==null||i.addEventListener("pointerdown",this.onFinishButtonClickedHandler),this.layout.addEventListener("onlayouttap",this.onDotClickHandler);}disconnectedCallback(){var t,o,i;(t=this.shutterButton)==null||t.removeEventListener("pointerdown",this.onShutterButtonClickedHandler),(o=this.torchIconButton)==null||o.addEventListener("pointerdown",this.onTorchButtonClickedHandler),(i=this.finishButton)==null||i.removeEventListener("pointerdown",this.onFinishButtonClickedHandler),this.layout.removeEventListener("onlayouttap",this.onDotClickHandler),this.presenter.dispose();}async onShutterButtonClicked(){this.presenter.onShutterButtonClicked();}async onTorchButtonClicked(){this.presenter.onTorchButtonClicked();}updateProgressBar(t,o){this.progressBar&&(this.progressBar.value!==t&&(this.progressBar.value=t),o!=null&&this.progressBar.max!==o&&(this.progressBar.max=o));}setShutterButtonPulse(t){this.shutterButton!=null&&(this.shutterButton.pulse=t);}switchToPaused(t,o){var s,r;let i=[];for(let e of t){let l=Card.create();l.id=`${String(e.uid)}`;let n=a$6.create();if(l.append(n),n.title=e.searchOptions.barcodeData,o.some(u=>u.searchOptions.barcodeData===e.searchOptions.barcodeData)){n.title=e.searchOptions.barcodeData;let u=a$7.create();u.slot="right",n.append(u);}i.push(l);}(s=this.cardList)==null||s.renderCards(i),(r=this.cardList)==null||r.removeAttribute("hidden"),this.shutterButton.variant="play",this.shutterButton.pulse=false,this.toggleDotPulse(false);}moveCardOnTheFront(t){var i,s;if(!t)return;let o=(i=this.cardList)==null?void 0:i.getCardBySelector(`${Card.tag}#${t.uid}`);o!=null&&((s=this.cardList)==null||s.unshiftCard(o));}switchToStarted(){var t;this.clearDots(),(t=this.cardList)==null||t.setAttribute("hidden",""),this.shutterButton.variant="pause";}toggleTorchIcon(t){this.torchIconButton&&(this.torchIconButton.state=t);}onFinishButtonClicked(){this.presenter.onFinishButtonClicked();}clearDots(){let t=this.layout.querySelectorAll("[data-identifier]");for(let o of t)o.remove();}toggleDotPulse(t){let o=[...this.layout.querySelectorAll("[data-identifier]")];for(let i of o)i.pulse=t;}pointTransformation(t){return `translate3d(calc(${t.x}px - 50%), calc(${t.y}px - 50%), 0px)`}onDotClick(t){let o=t.detail.target;if(o.dataset.identifier!=null){for(let i of this.layout.querySelectorAll(a$8.tag))i.pulse=false,o===i&&o.variant==="target"&&(o.pulse=true);this.presenter.onDotClick(o.dataset.identifier);}}renderDots(t){var o,i,s;for(let r of t.removedTrackedBarcodes){let e=this.layout.querySelector(`[data-identifier="${r}"]`);e==null||e.remove();}if(t.addedTrackedBarcodes.length>0){let r=document.createDocumentFragment();for(let e of t.addedTrackedBarcodes){let l=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(e.anchorPositions),n=a$8.createWithColors(this.barcodeFindViewSettings.inListItemColor,this.barcodeFindViewSettings.notInListItemColor);n.style.setProperty("position","absolute"),n.style.setProperty("transform",this.pointTransformation(l.center)),n.dataset.identifier=`${e.identifier}`,e.barcode.data!=null&&((o=t.foundTrackedBarcodesInLastProcessedFrame[`${e.identifier}`])==null?void 0:o.barcode.data)===e.barcode.data&&(n.setAttribute("variant","target"),n.pulse=true),r.append(n);}this.layout.append(r);}for(let r of t.updatedTrackedBarcodes){let e=this.layout.querySelector(`[data-identifier="${r.identifier}"]`),{center:l}=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(r.anchorPositions);if(e){let n=(s=(i=this.camera)==null?void 0:i.getMirrorImageEnabled())!=null?s:false,u=new Size(this.dataCaptureView.width,this.dataCaptureView.height);e.style.setProperty("position","absolute");let H=n?Point.mirrorX(l,u):l;e.style.setProperty("transform",this.pointTransformation(H));}}}};c.tag="scandit-barcode-find-view";var S=c;S.register();export{S as a};
7
+ `,e.append(e.layout),a$3(t)?(e.dataCaptureView=t,t.htmlElement.prepend(e),await o.setMode(i),await t.setContext(o)):(e.dataCaptureView=await DataCaptureView.forContext(o),e.dataCaptureView.connectToElement(t),t.prepend(e)),e.presenter=new b$2(e,o,i,s,r!=null?r:a$4.recommendedCameraSettings),await e.presenter.prepare(),e.barcodeFindBasicOverlay=await a$5.withBarcodeFind(i,e.dataCaptureView),e}static async create(t,o,i){return c.createWithSettings(t,o,i,b$3.BarcodeFind.BarcodeFindViewSettings.settings,a$4.recommendedCameraSettings)}static register(){defineCustomElements({[c.tag]:c});}async startSearching(){return this.onShutterButtonClickedHandler()}async stopSearching(){return this.presenter.stopSearching()}async pauseSearching(){return this.onShutterButtonClickedHandler()}setListener(t){this.barcodeFindViewUiListener=t,this.presenter.barcodeFindViewUiListener=this.barcodeFindViewUiListener;}async setShouldShowUserGuidanceView(t){return this.shouldShowUserGuidance=t,this.barcodeFindBasicOverlay.setUserGuidanceEnabled(this.shouldShowUserGuidance)}async setShouldShowHints(t){return this.shouldShowHints=t,this.barcodeFindBasicOverlay.setShouldShowHint(this.shouldShowHints)}setShouldShowCarousel(t){this.shouldShowCarousel=t,this.layout.toggleVisibility(d.CardListContainer,t);}setShouldShowPauseButton(t){this.shouldShowPauseButton=t,this.layout.toggleVisibility(d.ShutterButton,t);}setShouldShowFinishButton(t){this.shouldShowFinishButton=t,this.layout.toggleVisibility(d.FinishButton,t);}setShouldShowProgressBar(t){this.shouldShowProgressBar=t,this.layout.toggleVisibility(d.ProgressBarWithLabel,t);}setShouldShowTorchControl(t){this.shouldShowTorchControl=this.presenter.isTorchAvailable?t:false,this.layout.toggleVisibility(d.TorchIconButton,this.shouldShowTorchControl);}setTorchControlPosition(t){var i;this.torchControlPosition=t,[Anchor.TopCenter,Anchor.TopLeft,Anchor.TopRight,Anchor.BottomLeft].includes(t)||(this.torchControlPosition=Anchor.TopLeft);let o={[Anchor.TopCenter]:"top-controls-center",[Anchor.TopLeft]:"top-controls-left",[Anchor.TopRight]:"top-controls-right",[Anchor.BottomLeft]:"bottom-controls-left"}[this.torchControlPosition];(i=this.torchIconButton)==null||i.setAttribute("slot",o);}setTextForCollapseCardsButton(t){this.textForCollapseCardsButton=t,this.cardList!=null&&(this.cardList["text-for-collapse-cards-button"]=t);}async setTextForAllItemsFoundSuccessfullyHint(t){return this.textForAllItemsFoundSuccessfullyHint=t,this.barcodeFindBasicOverlay.setTextForAllItemsFoundSuccessfullyHint(this.textForAllItemsFoundSuccessfullyHint)}async setTextForPointAtBarcodesToSearchHint(t){return this.textForPointAtBarcodesToSearchHint=t,this.barcodeFindBasicOverlay.setTextForPointAtBarcodesToSearchHint(this.textForPointAtBarcodesToSearchHint)}async setTextForMoveCloserToBarcodesHint(t){return this.textForMoveCloserToBarcodesHint=t,this.barcodeFindBasicOverlay.setTextForPointAtBarcodesToSearchHint(this.textForMoveCloserToBarcodesHint)}async setTextForTapShutterToPauseScreenHint(t){return this.textForTapShutterToPauseScreenHint=t,this.barcodeFindBasicOverlay.setTextForPointAtBarcodesToSearchHint(this.textForTapShutterToPauseScreenHint)}async setTextForTapShutterToResumeSearchHint(t){return this.textForTapShutterToResumeSearchHint=t,this.barcodeFindBasicOverlay.setTextForTapShutterToResumeScreenHint(this.textForTapShutterToResumeSearchHint)}async setTextForItemListUpdatedWhenPausedHint(t){return this.textForItemListUpdatedWhenPausedHint=t,this.barcodeFindBasicOverlay.setTextForItemListUpdatedWhenPausedHint(this.textForItemListUpdatedWhenPausedHint)}async setTextForItemListUpdatedHint(t){return this.textForItemListUpdatedHint=t,this.barcodeFindBasicOverlay.setTextForItemListUpdatedWhenPausedHint(this.textForItemListUpdatedHint)}connectedCallback(){var t,o,i;this.shutterButton=this.layout.querySelector(d.ShutterButton),this.finishButton=this.layout.querySelector(d.FinishButton),this.progressBar=this.layout.querySelector(d.ProgressBarWithLabel),this.cardList=this.layout.querySelector(d.CardListContainer),this.torchIconButton=this.layout.querySelector(d.TorchIconButton),(t=this.torchIconButton)==null||t.addEventListener("pointerdown",this.onTorchButtonClickedHandler),(o=this.shutterButton)==null||o.addEventListener("pointerdown",this.onShutterButtonClickedHandler),(i=this.finishButton)==null||i.addEventListener("pointerdown",this.onFinishButtonClickedHandler),this.layout.addEventListener("onlayouttap",this.onDotClickHandler);}disconnectedCallback(){var t,o,i;(t=this.shutterButton)==null||t.removeEventListener("pointerdown",this.onShutterButtonClickedHandler),(o=this.torchIconButton)==null||o.addEventListener("pointerdown",this.onTorchButtonClickedHandler),(i=this.finishButton)==null||i.removeEventListener("pointerdown",this.onFinishButtonClickedHandler),this.layout.removeEventListener("onlayouttap",this.onDotClickHandler),this.presenter.dispose();}async onShutterButtonClicked(){this.presenter.onShutterButtonClicked();}async onTorchButtonClicked(){this.presenter.onTorchButtonClicked();}updateProgressBar(t,o){this.progressBar&&(this.progressBar.value!==t&&(this.progressBar.value=t),o!=null&&this.progressBar.max!==o&&(this.progressBar.max=o));}setShutterButtonPulse(t){this.shutterButton!=null&&(this.shutterButton.pulse=t);}switchToPaused(t,o){var s,r;let i=[];for(let e of t){let l=Card.create();l.id=`${String(e.uid)}`;let n=a$6.create();if(l.append(n),n.title=e.searchOptions.barcodeData,o.some(u=>u.searchOptions.barcodeData===e.searchOptions.barcodeData)){n.title=e.searchOptions.barcodeData;let u=a$7.create();u.slot="right",n.append(u);}i.push(l);}(s=this.cardList)==null||s.renderCards(i),(r=this.cardList)==null||r.removeAttribute("hidden"),this.shutterButton.variant="play",this.shutterButton.pulse=false,this.toggleDotPulse(false);}moveCardOnTheFront(t){var i,s;if(!t)return;let o=(i=this.cardList)==null?void 0:i.getCardBySelector(`${Card.tag}#${t.uid}`);o!=null&&((s=this.cardList)==null||s.unshiftCard(o));}switchToStarted(){var t;this.clearDots(),(t=this.cardList)==null||t.setAttribute("hidden",""),this.shutterButton.variant="pause";}toggleTorchIcon(t){this.torchIconButton&&(this.torchIconButton.state=t);}onFinishButtonClicked(){this.presenter.onFinishButtonClicked();}clearDots(){let t=this.layout.querySelectorAll("[data-identifier]");for(let o of t)o.remove();}toggleDotPulse(t){let o=[...this.layout.querySelectorAll("[data-identifier]")];for(let i of o)i.pulse=t;}pointTransformation(t){return `translate3d(calc(${t.x}px - 50%), calc(${t.y}px - 50%), 0px)`}onDotClick(t){let o=t.detail.target;if(o.dataset.identifier!=null){for(let i of this.layout.querySelectorAll(a$8.tag))i.pulse=false,o===i&&o.variant==="target"&&(o.pulse=true);this.presenter.onDotClick(o.dataset.identifier);}}renderDots(t){var o,i,s;for(let r of t.removedTrackedBarcodes){let e=this.layout.querySelector(`[data-identifier="${r}"]`);e==null||e.remove();}if(t.addedTrackedBarcodes.length>0){let r=document.createDocumentFragment();for(let e of t.addedTrackedBarcodes){let l=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(e.anchorPositions),n=a$8.createWithColors(this.barcodeFindViewSettings.inListItemColor,this.barcodeFindViewSettings.notInListItemColor);n.style.setProperty("position","absolute"),n.style.setProperty("transform",this.pointTransformation(l.center)),n.dataset.identifier=`${e.identifier}`,e.barcode.data!=null&&((o=t.foundTrackedBarcodesInLastProcessedFrame[`${e.identifier}`])==null?void 0:o.barcode.data)===e.barcode.data&&(n.setAttribute("variant","target"),n.pulse=true),r.append(n);}this.layout.append(r);}for(let r of t.updatedTrackedBarcodes){let e=this.layout.querySelector(`[data-identifier="${r.identifier}"]`),{center:l}=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(r.anchorPositions);if(e){let n=(s=(i=this.camera)==null?void 0:i.getMirrorImageEnabled())!=null?s:false,u=new Size(this.dataCaptureView.width,this.dataCaptureView.height);e.style.setProperty("position","absolute");let H=n?Point.mirrorX(l,u):l;e.style.setProperty("transform",this.pointTransformation(H));}}}};c.tag="scandit-barcode-find-view";var S=c;S.register();export{S as a};
@@ -1 +1 @@
1
- import {a as a$2}from'./chunk-OTZPCIBD.js';import {a as a$3}from'./chunk-UCHREILA.js';import {a}from'./chunk-QCD3RIT4.js';import {c as c$1,b as b$3}from'./chunk-SZUPDKV5.js';import {a as a$4}from'./chunk-FFISQQ67.js';import {b}from'./chunk-JMUNN3HX.js';import {a as a$1,c,b as b$1}from'./chunk-ORLJNUNA.js';import {a as a$5}from'./chunk-4MCMAHRH.js';import {b as b$2}from'./chunk-QNZA644V.js';import {DataCaptureView,Anchor,LogoStyle,CameraAccess,Camera,isCameraFrameSource,FrameSourceState,Color,CameraPosition,TorchState,Logger,NumberWithUnit,RadiusLocationSelection}from'@scandit/web-datacapture-core';import {localStorage}from'@scandit/web-datacapture-core/build/js/private/utils/safeStorage.js';import {Timeout}from'@scandit/web-datacapture-core/build/js/private/utils/timeout.js';var P=class O{constructor(a$4,e,t,i){this.cameras=[];this.preferenceManager=new a(localStorage);this.defaultSuccessBrush=a$1.defaultSuccessBrush();this.defaultErrorBrush=a$1.defaultErrorBrush();this.sparkScanView=a$4,this.context=e,this.sparkScan=t,this.sparkScanViewSettings=i,this.stateManager=new a$2(this.sparkScanViewSettings,this.preferenceManager),this.feedbackManager=a$3.withDefaults(i.soundEnabled,i.hapticEnabled),this.analyticsManager=b.forContext(e),this.triggerButtonCollapseTimeout=new Timeout(this.sparkScanViewSettings.triggerButtonCollapseTimeout,async()=>{this.stateManager.state!=="idle"&&await this.switchToIdleState({sessionStopReason:"timeout"});}),this.inactiveStateTimeout=new Timeout(i.inactiveStateTimeout,async()=>{this.stateManager.state!=="inactive"&&!this.stateManager.holdingToScan&&await this.switchToInactiveState({sessionStopReason:"timeout"});}),this.stateTimeouts={active:this.inactiveStateTimeout,inactive:this.triggerButtonCollapseTimeout},this.switchToIdleState();}get portraitOrientationTriggerButtonTranslateX(){var a;return (a=this.stateManager.portraitOrientationTriggerButtonTranslateX)!=null?a:this.defaultTriggerButtonTranslateX}get portraitOrientationTriggerButtonTranslateY(){var a;return (a=this.stateManager.portraitOrientationTriggerButtonTranslateY)!=null?a:this.defaultTriggerButtonTranslateY}get landscapeOrientationTriggerButtonTranslateX(){var a;return (a=this.stateManager.landscapeOrientationTriggerButtonTranslateX)!=null?a:this.defaultTriggerButtonTranslateX}get landscapeOrientationTriggerButtonTranslateY(){var a;return (a=this.stateManager.landscapeOrientationTriggerButtonTranslateY)!=null?a:this.defaultTriggerButtonTranslateY}get portraitOrientationMiniPreviewTranslateX(){var a;return (a=this.stateManager.portraitOrientationMiniPreviewTranslateX)!=null?a:this.defaultMiniPreviewTranslateX}get portraitOrientationMiniPreviewTranslateY(){var a;return (a=this.stateManager.portraitOrientationMiniPreviewTranslateY)!=null?a:this.defaultMiniPreviewTranslateY}get landscapeOrientationMiniPreviewTranslateX(){var a;return (a=this.stateManager.landscapeOrientationMiniPreviewTranslateX)!=null?a:this.defaultMiniPreviewTranslateX}get landscapeOrientationMiniPreviewTranslateY(){var a;return (a=this.stateManager.landscapeOrientationMiniPreviewTranslateY)!=null?a: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(){var a,e;return {width:(a=this.sparkScanView.parentElement.clientWidth)!=null?a:window.innerWidth,height:(e=this.sparkScanView.parentElement.clientHeight)!=null?e:window.innerHeight}}get defaultMiniPreviewTranslateY(){return 16}static forView(a,e,t,i){return new O(a,e,t,i)}async prepareScanning(a){var i;this.context.addListener(this),this.dataCaptureView=await DataCaptureView.forContext(this.context),this.dataCaptureView.logoAnchor=Anchor.BottomCenter,this.dataCaptureView.logoStyle=LogoStyle.Minimal,this.dataCaptureView.setHiddenProperty("stopVideoTracksOnVisibilityChange",false),this.dataCaptureView.setHiddenProperty("freezeFrameWhenStoppingFrameSource",false),this.dataCaptureView.connectToElement(a);let e=await CameraAccess.getCameras();this.cameras=e.map(r=>Camera.fromDeviceCamera(r)),this.camera=isCameraFrameSource(this.context.frameSource)?this.context.frameSource:(i=this.cameras.find(r=>r.position===this.sparkScanViewSettings.defaultCameraPosition))!=null?i:Camera.default,await this.camera.applySettings(a$4.recommendedCameraSettings),await this.context.setFrameSource(this.camera),await this.camera.switchToDesiredState(FrameSourceState.Standby);let t=await this.camera.isTorchAvailable();this.sparkScanView.setTorchAvailable(t),this.sparkScanView.setZoomAvailable(this.camera.isZoomAvailable()),this.sparkScanView.cameraSwitchButtonTapped(t,this.camera.position),await this.context.addMode(this.sparkScan),this.sparkScan.addListener(this),this.sparkScanOverlay=await a$5.withSparkScanForView(this.sparkScan,this.dataCaptureView),await this.sparkScanOverlay.setShouldRemoveLocationsAfterScan(this.stateManager.scanningBehavior==="continuous"),this.analyticsManager.startSession({cameraPosition:this.camera.position,handMode:"right",hapticEnabled:this.sparkScanViewSettings.hapticEnabled,scanningMode:this.stateManager.scanningMode,soundEnabled:this.sparkScanViewSettings.soundEnabled,torchState:this.camera.getDesiredTorchState()}),await this.applyPreferences();}async startScanning(){await this.switchToActiveState();}async pauseScanning(){await this.switchToInactiveState({sessionStopReason:"user"});}async stopScanning(a){var e;await this.sparkScan.setEnabled(false),this.sparkScan.removeListener(this),await((e=this.camera)==null?void 0:e.switchToDesiredState(FrameSourceState.Off)),this.dataCaptureView.detachFromElement(),this.context.removeListener(this),this.analyticsManager.setSessionStopReason(a.sessionStopReason);}async onTriggerButtonPointerDown(){await this.sparkScan.setResultSuppressionEnabled(true);}async onTriggerButtonTap(){switch(await this.sparkScan.setResultSuppressionEnabled(false),this.stateManager.state){case "Initial":return;case "idle":case "inactive":case "error":{await this.switchToActiveState({barcodeFeedback:new c(Color.fromRGBA(0,0,0,0),this.defaultSuccessBrush,this.feedbackManager.tapFeedback)});return}case "active":await(this.stateManager.continuousModeEnabled?this.switchToInactiveState({sessionStopReason:"user",barcodeFeedback:new c(Color.fromRGBA(0,0,0,0),this.defaultSuccessBrush,this.feedbackManager.tapFeedback)}):this.switchToActiveState({barcodeFeedback:new c(Color.fromRGBA(0,0,0,0),this.defaultSuccessBrush,this.feedbackManager.tapFeedback)}));}}async onTriggerButtonLongPressStart(){var a;await this.sparkScan.setResultSuppressionEnabled(false),this.sparkScanViewSettings.holdToScanEnabled&&(this.scanningBehaviorCache=this.stateManager.scanningBehavior,this.stateManager.scanningBehavior="continuous",this.stateManager.holdingToScan=true,await((a=this.sparkScanOverlay)==null?void 0:a.setShouldRemoveLocationsAfterScan(true)),await this.switchToActiveState({barcodeFeedback:new c(Color.fromRGBA(0,0,0,0),this.defaultSuccessBrush,this.feedbackManager.tapFeedback)}));}async onTriggerButtonLongPressEnd(){var a,e;this.sparkScanViewSettings.holdToScanEnabled&&this.stateManager.state!=="error"&&(this.stateManager.scanningBehavior=(a=this.scanningBehaviorCache)!=null?a:"single",this.stateManager.holdingToScan=false,await((e=this.sparkScanOverlay)==null?void 0:e.setShouldRemoveLocationsAfterScan(this.stateManager.continuousModeEnabled)),await this.switchToInactiveState({sessionStopReason:"user",barcodeFeedback:new b$1("",0,Color.fromRGBA(0,0,0,0),this.defaultErrorBrush,this.feedbackManager.noFeedback)}));}async onClickOutside(){this.stateManager.idleState||await this.switchToIdleState();}async onVisibilityChange(){await this.switchToIdleState();}async onTargetModeButtonTap(a,e=this.feedbackManager.tapFeedback,t=true){var h,s,S;e.emit();let i=String(a),r={true:a&&this.stateManager.scanningMode instanceof b$3,false:!a&&this.stateManager.scanningMode instanceof c$1}[i];r&&(this.stateManager.scanningMode=this.stateManager.scanningMode.changeMode()),this.enableTargetMode(a),await((h=this.sparkScanOverlay)==null?void 0:h.setShouldDrawViewfinder(a)),this.startTimeoutForCurrentState(),this.sparkScanView.targetModeButtonTapped(a,t),r&&((S=(s=this.listener)==null?void 0:s.didChangeScanningMode)==null||S.call(s,this.stateManager.scanningMode),this.analyticsManager.setScanningMode(this.stateManager.scanningMode));}async onScanningBehaviorButtonTap(a,e=this.feedbackManager.tapFeedback,t=true){var i;e.emit(),this.stateManager.scanningMode=this.stateManager.scanningMode.copyWith(a?"continuous":"single"),await((i=this.sparkScanOverlay)==null?void 0:i.setShouldRemoveLocationsAfterScan(a)),this.startTimeoutForCurrentState(),this.sparkScanView.scanningBehaviorButtonTapped(a,t),this.analyticsManager.setScanningMode(this.stateManager.scanningMode);}async onBarcodeFindButtonTap(){var a,e;await this.switchToIdleState({sessionStopReason:"user"}),(e=(a=this.listener)==null?void 0:a.didTapBarcodeFindButton)==null||e.call(a,this.sparkScanView),this.restartTimeouts();}async onLabelCaptureButtonTap(){var a,e;await this.switchToIdleState({sessionStopReason:"user"}),(e=(a=this.listener)==null?void 0:a.didTapLabelCaptureButton)==null||e.call(a,this.sparkScanView),this.restartTimeouts();}async onCameraSwitchButtonTap(){if(this.feedbackManager.emitTapFeedback(),this.restartTimeouts(),!this.camera||this.stateManager.state==="error")return;let a={[CameraPosition.WorldFacing]:CameraPosition.UserFacing,[CameraPosition.UserFacing]:CameraPosition.WorldFacing}[this.camera.position],e=this.cameras.find(t=>t.position===a);e&&(await this.camera.switchToDesiredState(FrameSourceState.Off),await e.applySettings(this.camera.settings),await this.context.setFrameSource(e),await e.switchToDesiredState(FrameSourceState.On),this.sparkScanView.cameraSwitchButtonTapped(await e.isTorchAvailable(),a),this.analyticsManager.setCameraPosition(a),this.camera=e);}async onTorchButtonTap(a,e=this.feedbackManager.tapFeedback,t=true){var i;e.emit(),this.stateManager.torchState=a?TorchState.On:TorchState.Off,((i=this.camera)==null?void 0:i.getCurrentState())===FrameSourceState.On&&await this.camera.setDesiredTorchState(this.stateManager.torchState),this.startTimeoutForCurrentState(),this.sparkScanView.torchButtonTapped(a,t),this.analyticsManager.setTorchState(this.stateManager.torchState);}restartTimeouts(){for(let a of [this.triggerButtonCollapseTimeout,this.inactiveStateTimeout,this.resumeCapturingTimeout])(a==null?void 0:a.running)===true&&a.start();}async onMiniPreviewCloseButtonTap(){await this.switchToIdleState({sessionStopReason:"user"});}onMiniPreviewResizeButtonTap(){(this.stateManager.state==="active"||this.stateManager.state==="inactive")&&(this.feedbackManager.emitTapFeedback(),this.startTimeoutForCurrentState());}async onMiniPreviewZoomButtonTap(a){this.feedbackManager.emitTapFeedback(),this.stateManager.zoomFactor=a,this.camera&&(this.camera.settings.zoomFactor=a,await this.camera.applySettings(this.camera.settings)),this.startTimeoutForCurrentState();}async onMiniPreviewDrag(a,e){switch(this.stateManager.state==="active"&&await this.sparkScan.setEnabled(false),e){case "landscape-primary":case "landscape-secondary":{this.stateManager.landscapeOrientationMiniPreviewTranslateX=a.x,this.stateManager.landscapeOrientationMiniPreviewTranslateY=a.y;break}case "portrait-primary":case "portrait-secondary":{this.stateManager.portraitOrientationMiniPreviewTranslateX=a.x,this.stateManager.portraitOrientationMiniPreviewTranslateY=a.y;break}}this.restartTimeouts();}onMiniPreviewPointerMove(){this.restartTimeouts();}async onMiniPreviewPointerUp(){await this.switchToActiveState();}async onMiniPreviewDragEnd(){this.stateManager.state==="active"&&await this.sparkScan.setEnabled(true);}onTriggerButtonDrag(a,e){switch(e){case "landscape-primary":case "landscape-secondary":{this.stateManager.landscapeOrientationTriggerButtonTranslateX=a.x,this.stateManager.landscapeOrientationTriggerButtonTranslateY=a.y;break}case "portrait-primary":case "portrait-secondary":{this.stateManager.portraitOrientationTriggerButtonTranslateX=a.x,this.stateManager.portraitOrientationTriggerButtonTranslateY=a.y;break}}}async onOrientationChange(){if(this.stateManager.state==="active"&&this.stateManager.holdingToScan){this.restartTimeouts();return}this.stateManager.state==="error"&&await this.switchToInactiveState({sessionStopReason:"user"});}async didScan(a,e){if(!e.newlyRecognizedBarcode)return;let t=this.sparkScanView.feedbackDelegate.getFeedbackForBarcode(e.newlyRecognizedBarcode);t instanceof b$1?await this.switchToErrorState({barcodeFeedback:t}):t instanceof c&&await(this.stateManager.continuousModeEnabled?this.switchToActiveState({barcodeFeedback:t}):this.switchToInactiveState({sessionStopReason:"user",barcodeFeedback:t,emitSuccessFeedback:true})),this.restartTimeouts();}didChangeFrameSource(a,e){var t;if(isCameraFrameSource(e))this.camera=e;else {let i=(t=e==null?void 0:e.toJSONObject().type)!=null?t:"unknown";Logger.warn(`SparkScanView instances require a camera frame source to work, but a frame source of type "${i}" was found.`);}}setListener(a){this.listener=a;}brushForFeedback(a){return a.brush}async switchToIdleState(a={}){var e,t,i;this.feedbackManager.emitTapFeedback(),await((e=this.sparkScanOverlay)==null?void 0:e.overlayReadyForDraw()),this.setState("idle"),await this.sparkScan.setEnabled(false),await((t=this.camera)==null?void 0:t.switchToDesiredState(FrameSourceState.Standby)),this.triggerButtonCollapseTimeout.stop(),this.inactiveStateTimeout.stop(),(i=this.resumeCapturingTimeout)==null||i.stop(),this.sparkScanView.switchToIdleState(),a.sessionStopReason!=null&&this.analyticsManager.setSessionStopReason(a.sessionStopReason);}async switchToActiveState(a={}){var t,i,r,o,h,s,S;let e=this.stateManager.state;await((t=this.camera)==null?void 0:t.switchToDesiredState(FrameSourceState.On)),await((i=this.camera)==null?void 0:i.setDesiredTorchState(this.stateManager.torchState)),a.barcodeFeedback&&await((r=this.sparkScanOverlay)==null?void 0:r.setBrush(this.brushForFeedback(a.barcodeFeedback))),await((o=this.sparkScanOverlay)==null?void 0:o.setShouldRemoveLocationsAfterScan(this.stateManager.continuousModeEnabled)),await((h=this.sparkScanOverlay)==null?void 0:h.overlayReadyForDraw()),this.feedbackManager.emitBarcodeFeedback(a.barcodeFeedback),this.stateManager.holdingToScan||this.inactiveStateTimeout.start(),this.triggerButtonCollapseTimeout.stop(),(s=this.resumeCapturingTimeout)==null||s.stop(),await this.sparkScanView.switchToActiveState(this.sparkScanViewSettings.visualFeedbackEnabled&&a.barcodeFeedback instanceof c,this.stateManager.scanningBehavior,(S=a.barcodeFeedback)==null?void 0:S.visualFeedbackColor,this.stateManager.zoomedIn&&e!=="active"),await this.sparkScan.setEnabled(true),this.setState("active");}async switchToInactiveState(a){var t,i,r,o,h,s;(a.emitSuccessFeedback)!=null||(a.emitSuccessFeedback=true),this.setState("inactive"),a.barcodeFeedback&&await((t=this.sparkScanOverlay)==null?void 0:t.setBrush(this.brushForFeedback(a.barcodeFeedback))),await this.sparkScan.setEnabled(false),this.stateManager.scanningMode.previewBehavior==="persistent"?a.barcodeFeedback instanceof c&&await((i=this.sparkScanOverlay)==null?void 0:i.setShouldRemoveLocationsAfterScan(true)):await((r=this.camera)==null?void 0:r.switchToDesiredState(FrameSourceState.Standby)),this.feedbackManager.emitBarcodeFeedback(a.barcodeFeedback),await((o=this.sparkScanOverlay)==null?void 0:o.overlayReadyForDraw()),this.triggerButtonCollapseTimeout.start(),this.inactiveStateTimeout.stop(),(h=this.resumeCapturingTimeout)==null||h.stop(),await this.sparkScanView.switchToInactiveState(this.sparkScanViewSettings.visualFeedbackEnabled&&a.barcodeFeedback instanceof c&&a.emitSuccessFeedback,this.stateManager.scanningBehavior,this.stateManager.previewBehavior,(s=a.barcodeFeedback)==null?void 0:s.visualFeedbackColor),this.analyticsManager.setSessionStopReason(a.sessionStopReason);}async switchToErrorState(a){var t,i,r,o;let e=a.barcodeFeedback.resumeCapturingDelay>0;e&&(this.setState("error"),this.stateManager.scanningBehavior="single",await this.sparkScan.setEnabled(false),await((t=this.camera)==null?void 0:t.switchToDesiredState(FrameSourceState.Standby)),this.resumeCapturingTimeout=new Timeout(a.barcodeFeedback.resumeCapturingDelay,async()=>{this.stateManager.state!=="active"&&await this.switchToActiveState();}),this.resumeCapturingTimeout.start()),await((i=this.sparkScanOverlay)==null?void 0:i.setErrorBrush(a.barcodeFeedback.brush)),await((r=this.sparkScanOverlay)==null?void 0:r.overlayReadyForDraw()),await((o=this.sparkScanOverlay)==null?void 0:o.setShouldRemoveLocationsAfterScan(a.barcodeFeedback.resumeCapturingDelay===0)),await this.sparkScan.workerCommand("sparkScanEmitErrorFeedback",{shouldRemoveBrush:!e}),this.feedbackManager.emitBarcodeFeedback(a.barcodeFeedback),this.triggerButtonCollapseTimeout.stop(),this.inactiveStateTimeout.stop(),await this.sparkScanView.switchToErrorState(a.barcodeFeedback,this.sparkScanViewSettings.visualFeedbackEnabled);}enableTargetModeLocationSelection(a){var r;let e=a?b$2.SparkScan.SparkScanSettings.targetModeLocationSelection.radius:b$2.SparkScan.SparkScanSettings.locationSelection.radius,t=a?b$2.SparkScan.SparkScanSettings.targetModeLocationSelection.unit:b$2.SparkScan.SparkScanSettings.locationSelection.unit,i=new NumberWithUnit(e,t);this.sparkScan.settings.locationSelection=new RadiusLocationSelection(i),(r=this.sparkScanOverlay)==null||r.setRadius(i);}enableTargetMode(a){this.enableTargetModeLocationSelection(a);}async applyPreferences(){await this.onTargetModeButtonTap(this.stateManager.targetModeEnabled,this.feedbackManager.noFeedback,false),await this.onScanningBehaviorButtonTap(this.stateManager.continuousModeEnabled,this.feedbackManager.noFeedback,false),await this.onTorchButtonTap(this.stateManager.torchEnabled,this.feedbackManager.noFeedback,false);}setState(a){var e,t;a!==this.stateManager.state&&(this.stateManager.state=a,(t=(e=this.listener)==null?void 0:e.didChangeViewState)==null||t.call(e,a));}startTimeoutForCurrentState(){let a=this.stateTimeouts[this.stateManager.state];a==null||a.start();}};export{P as a};
1
+ import {a as a$2}from'./chunk-OTZPCIBD.js';import {a as a$3}from'./chunk-ZXTRTKEZ.js';import {a}from'./chunk-QCD3RIT4.js';import {a as a$5}from'./chunk-3UGEG7WU.js';import {c as c$1,b as b$3}from'./chunk-SZUPDKV5.js';import {a as a$4}from'./chunk-OXYHO7V6.js';import {b}from'./chunk-JMUNN3HX.js';import {a as a$1,c,b as b$1}from'./chunk-WICRT6CF.js';import {b as b$2}from'./chunk-OLJXVUYE.js';import {DataCaptureView,Anchor,LogoStyle,CameraAccess,Camera,isCameraFrameSource,FrameSourceState,Color,CameraPosition,TorchState,Logger,NumberWithUnit,RadiusLocationSelection}from'@scandit/web-datacapture-core';import {localStorage}from'@scandit/web-datacapture-core/build/js/private/utils/safeStorage.js';import {Timeout}from'@scandit/web-datacapture-core/build/js/private/utils/timeout.js';var P=class O{constructor(a$4,e,t,i){this.cameras=[];this.preferenceManager=new a(localStorage);this.defaultSuccessBrush=a$1.defaultSuccessBrush();this.defaultErrorBrush=a$1.defaultErrorBrush();this.sparkScanView=a$4,this.context=e,this.sparkScan=t,this.sparkScanViewSettings=i,this.stateManager=new a$2(this.sparkScanViewSettings,this.preferenceManager),this.feedbackManager=a$3.withDefaults(i.soundEnabled,i.hapticEnabled),this.analyticsManager=b.forContext(e),this.triggerButtonCollapseTimeout=new Timeout(this.sparkScanViewSettings.triggerButtonCollapseTimeout,async()=>{this.stateManager.state!=="idle"&&await this.switchToIdleState({sessionStopReason:"timeout"});}),this.inactiveStateTimeout=new Timeout(i.inactiveStateTimeout,async()=>{this.stateManager.state!=="inactive"&&!this.stateManager.holdingToScan&&await this.switchToInactiveState({sessionStopReason:"timeout"});}),this.stateTimeouts={active:this.inactiveStateTimeout,inactive:this.triggerButtonCollapseTimeout},this.switchToIdleState();}get portraitOrientationTriggerButtonTranslateX(){var a;return (a=this.stateManager.portraitOrientationTriggerButtonTranslateX)!=null?a:this.defaultTriggerButtonTranslateX}get portraitOrientationTriggerButtonTranslateY(){var a;return (a=this.stateManager.portraitOrientationTriggerButtonTranslateY)!=null?a:this.defaultTriggerButtonTranslateY}get landscapeOrientationTriggerButtonTranslateX(){var a;return (a=this.stateManager.landscapeOrientationTriggerButtonTranslateX)!=null?a:this.defaultTriggerButtonTranslateX}get landscapeOrientationTriggerButtonTranslateY(){var a;return (a=this.stateManager.landscapeOrientationTriggerButtonTranslateY)!=null?a:this.defaultTriggerButtonTranslateY}get portraitOrientationMiniPreviewTranslateX(){var a;return (a=this.stateManager.portraitOrientationMiniPreviewTranslateX)!=null?a:this.defaultMiniPreviewTranslateX}get portraitOrientationMiniPreviewTranslateY(){var a;return (a=this.stateManager.portraitOrientationMiniPreviewTranslateY)!=null?a:this.defaultMiniPreviewTranslateY}get landscapeOrientationMiniPreviewTranslateX(){var a;return (a=this.stateManager.landscapeOrientationMiniPreviewTranslateX)!=null?a:this.defaultMiniPreviewTranslateX}get landscapeOrientationMiniPreviewTranslateY(){var a;return (a=this.stateManager.landscapeOrientationMiniPreviewTranslateY)!=null?a: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(){var a,e;return {width:(a=this.sparkScanView.parentElement.clientWidth)!=null?a:window.innerWidth,height:(e=this.sparkScanView.parentElement.clientHeight)!=null?e:window.innerHeight}}get defaultMiniPreviewTranslateY(){return 16}static forView(a,e,t,i){return new O(a,e,t,i)}async prepareScanning(a){var i;this.context.addListener(this),this.dataCaptureView=await DataCaptureView.forContext(this.context),this.dataCaptureView.logoAnchor=Anchor.BottomCenter,this.dataCaptureView.logoStyle=LogoStyle.Minimal,this.dataCaptureView.setHiddenProperty("stopVideoTracksOnVisibilityChange",false),this.dataCaptureView.setHiddenProperty("freezeFrameWhenStoppingFrameSource",false),this.dataCaptureView.connectToElement(a);let e=await CameraAccess.getCameras();this.cameras=e.map(r=>Camera.fromDeviceCamera(r)),this.camera=isCameraFrameSource(this.context.frameSource)?this.context.frameSource:(i=this.cameras.find(r=>r.position===this.sparkScanViewSettings.defaultCameraPosition))!=null?i:Camera.default,await this.camera.applySettings(a$4.recommendedCameraSettings),await this.context.setFrameSource(this.camera),await this.camera.switchToDesiredState(FrameSourceState.Standby);let t=await this.camera.isTorchAvailable();this.sparkScanView.setTorchAvailable(t),this.sparkScanView.setZoomAvailable(this.camera.isZoomAvailable()),this.sparkScanView.cameraSwitchButtonTapped(t,this.camera.position),await this.context.setMode(this.sparkScan),this.sparkScan.addListener(this),this.sparkScanOverlay=await a$5.withSparkScanForView(this.sparkScan,this.dataCaptureView),await this.sparkScanOverlay.setShouldRemoveLocationsAfterScan(this.stateManager.scanningBehavior==="continuous"),this.analyticsManager.startSession({cameraPosition:this.camera.position,handMode:"right",hapticEnabled:this.sparkScanViewSettings.hapticEnabled,scanningMode:this.stateManager.scanningMode,soundEnabled:this.sparkScanViewSettings.soundEnabled,torchState:this.camera.getDesiredTorchState()}),await this.applyPreferences();}async startScanning(){await this.switchToActiveState();}async pauseScanning(){await this.switchToInactiveState({sessionStopReason:"user"});}async stopScanning(a){var e;await this.sparkScan.setEnabled(false),this.sparkScan.removeListener(this),await((e=this.camera)==null?void 0:e.switchToDesiredState(FrameSourceState.Off)),this.dataCaptureView.detachFromElement(),this.context.removeListener(this),this.analyticsManager.setSessionStopReason(a.sessionStopReason);}async onTriggerButtonPointerDown(){await this.sparkScan.setResultSuppressionEnabled(true);}async onTriggerButtonTap(){switch(await this.sparkScan.setResultSuppressionEnabled(false),this.stateManager.state){case "Initial":return;case "idle":case "inactive":case "error":{await this.switchToActiveState({barcodeFeedback:new c(Color.fromRGBA(0,0,0,0),this.defaultSuccessBrush,this.feedbackManager.tapFeedback)});return}case "active":await(this.stateManager.continuousModeEnabled?this.switchToInactiveState({sessionStopReason:"user",barcodeFeedback:new c(Color.fromRGBA(0,0,0,0),this.defaultSuccessBrush,this.feedbackManager.tapFeedback)}):this.switchToActiveState({barcodeFeedback:new c(Color.fromRGBA(0,0,0,0),this.defaultSuccessBrush,this.feedbackManager.tapFeedback)}));}}async onTriggerButtonLongPressStart(){var a;await this.sparkScan.setResultSuppressionEnabled(false),this.sparkScanViewSettings.holdToScanEnabled&&(this.scanningBehaviorCache=this.stateManager.scanningBehavior,this.stateManager.scanningBehavior="continuous",this.stateManager.holdingToScan=true,await((a=this.sparkScanOverlay)==null?void 0:a.setShouldRemoveLocationsAfterScan(true)),await this.switchToActiveState({barcodeFeedback:new c(Color.fromRGBA(0,0,0,0),this.defaultSuccessBrush,this.feedbackManager.tapFeedback)}));}async onTriggerButtonLongPressEnd(){var a,e;this.sparkScanViewSettings.holdToScanEnabled&&this.stateManager.state!=="error"&&(this.stateManager.scanningBehavior=(a=this.scanningBehaviorCache)!=null?a:"single",this.stateManager.holdingToScan=false,await((e=this.sparkScanOverlay)==null?void 0:e.setShouldRemoveLocationsAfterScan(this.stateManager.continuousModeEnabled)),await this.switchToInactiveState({sessionStopReason:"user",barcodeFeedback:new b$1("",0,Color.fromRGBA(0,0,0,0),this.defaultErrorBrush,this.feedbackManager.noFeedback)}));}async onClickOutside(){this.stateManager.idleState||await this.switchToIdleState();}async onVisibilityChange(){await this.switchToIdleState();}async onTargetModeButtonTap(a,e=this.feedbackManager.tapFeedback,t=true){var h,s,S;e.emit();let i=String(a),r={true:a&&this.stateManager.scanningMode instanceof b$3,false:!a&&this.stateManager.scanningMode instanceof c$1}[i];r&&(this.stateManager.scanningMode=this.stateManager.scanningMode.changeMode()),this.enableTargetMode(a),await((h=this.sparkScanOverlay)==null?void 0:h.setShouldDrawViewfinder(a)),this.startTimeoutForCurrentState(),this.sparkScanView.targetModeButtonTapped(a,t),r&&((S=(s=this.listener)==null?void 0:s.didChangeScanningMode)==null||S.call(s,this.stateManager.scanningMode),this.analyticsManager.setScanningMode(this.stateManager.scanningMode));}async onScanningBehaviorButtonTap(a,e=this.feedbackManager.tapFeedback,t=true){var i;e.emit(),this.stateManager.scanningMode=this.stateManager.scanningMode.copyWith(a?"continuous":"single"),await((i=this.sparkScanOverlay)==null?void 0:i.setShouldRemoveLocationsAfterScan(a)),this.startTimeoutForCurrentState(),this.sparkScanView.scanningBehaviorButtonTapped(a,t),this.analyticsManager.setScanningMode(this.stateManager.scanningMode);}async onBarcodeFindButtonTap(){var a,e;await this.switchToIdleState({sessionStopReason:"user"}),(e=(a=this.listener)==null?void 0:a.didTapBarcodeFindButton)==null||e.call(a,this.sparkScanView),this.restartTimeouts();}async onLabelCaptureButtonTap(){var a,e;await this.switchToIdleState({sessionStopReason:"user"}),(e=(a=this.listener)==null?void 0:a.didTapLabelCaptureButton)==null||e.call(a,this.sparkScanView),this.restartTimeouts();}async onCameraSwitchButtonTap(){if(this.feedbackManager.emitTapFeedback(),this.restartTimeouts(),!this.camera||this.stateManager.state==="error")return;let a={[CameraPosition.WorldFacing]:CameraPosition.UserFacing,[CameraPosition.UserFacing]:CameraPosition.WorldFacing}[this.camera.position],e=this.cameras.find(t=>t.position===a);e&&(await this.camera.switchToDesiredState(FrameSourceState.Off),await e.applySettings(this.camera.settings),await this.context.setFrameSource(e),await e.switchToDesiredState(FrameSourceState.On),this.sparkScanView.cameraSwitchButtonTapped(await e.isTorchAvailable(),a),this.analyticsManager.setCameraPosition(a),this.camera=e);}async onTorchButtonTap(a,e=this.feedbackManager.tapFeedback,t=true){var i;e.emit(),this.stateManager.torchState=a?TorchState.On:TorchState.Off,((i=this.camera)==null?void 0:i.getCurrentState())===FrameSourceState.On&&await this.camera.setDesiredTorchState(this.stateManager.torchState),this.startTimeoutForCurrentState(),this.sparkScanView.torchButtonTapped(a,t),this.analyticsManager.setTorchState(this.stateManager.torchState);}restartTimeouts(){for(let a of [this.triggerButtonCollapseTimeout,this.inactiveStateTimeout,this.resumeCapturingTimeout])(a==null?void 0:a.running)===true&&a.start();}async onMiniPreviewCloseButtonTap(){await this.switchToIdleState({sessionStopReason:"user"});}onMiniPreviewResizeButtonTap(){(this.stateManager.state==="active"||this.stateManager.state==="inactive")&&(this.feedbackManager.emitTapFeedback(),this.startTimeoutForCurrentState());}async onMiniPreviewZoomButtonTap(a){this.feedbackManager.emitTapFeedback(),this.stateManager.zoomFactor=a,this.camera&&(this.camera.settings.zoomFactor=a,await this.camera.applySettings(this.camera.settings)),this.startTimeoutForCurrentState();}async onMiniPreviewDrag(a,e){switch(this.stateManager.state==="active"&&await this.sparkScan.setEnabled(false),e){case "landscape-primary":case "landscape-secondary":{this.stateManager.landscapeOrientationMiniPreviewTranslateX=a.x,this.stateManager.landscapeOrientationMiniPreviewTranslateY=a.y;break}case "portrait-primary":case "portrait-secondary":{this.stateManager.portraitOrientationMiniPreviewTranslateX=a.x,this.stateManager.portraitOrientationMiniPreviewTranslateY=a.y;break}}this.restartTimeouts();}onMiniPreviewPointerMove(){this.restartTimeouts();}async onMiniPreviewPointerUp(){await this.switchToActiveState();}async onMiniPreviewDragEnd(){this.stateManager.state==="active"&&await this.sparkScan.setEnabled(true);}onTriggerButtonDrag(a,e){switch(e){case "landscape-primary":case "landscape-secondary":{this.stateManager.landscapeOrientationTriggerButtonTranslateX=a.x,this.stateManager.landscapeOrientationTriggerButtonTranslateY=a.y;break}case "portrait-primary":case "portrait-secondary":{this.stateManager.portraitOrientationTriggerButtonTranslateX=a.x,this.stateManager.portraitOrientationTriggerButtonTranslateY=a.y;break}}}async onOrientationChange(){if(this.stateManager.state==="active"&&this.stateManager.holdingToScan){this.restartTimeouts();return}this.stateManager.state==="error"&&await this.switchToInactiveState({sessionStopReason:"user"});}async didScan(a,e){if(!e.newlyRecognizedBarcode)return;let t=this.sparkScanView.feedbackDelegate.getFeedbackForBarcode(e.newlyRecognizedBarcode);t instanceof b$1?await this.switchToErrorState({barcodeFeedback:t}):t instanceof c&&await(this.stateManager.continuousModeEnabled?this.switchToActiveState({barcodeFeedback:t}):this.switchToInactiveState({sessionStopReason:"user",barcodeFeedback:t,emitSuccessFeedback:true})),this.restartTimeouts();}didChangeFrameSource(a,e){var t;if(isCameraFrameSource(e))this.camera=e;else {let i=(t=e==null?void 0:e.toJSONObject().type)!=null?t:"unknown";Logger.warn(`SparkScanView instances require a camera frame source to work, but a frame source of type "${i}" was found.`);}}setListener(a){this.listener=a;}brushForFeedback(a){return a.brush}async switchToIdleState(a={}){var e,t,i;this.feedbackManager.emitTapFeedback(),await((e=this.sparkScanOverlay)==null?void 0:e.overlayReadyForDraw()),this.setState("idle"),await this.sparkScan.setEnabled(false),await((t=this.camera)==null?void 0:t.switchToDesiredState(FrameSourceState.Standby)),this.triggerButtonCollapseTimeout.stop(),this.inactiveStateTimeout.stop(),(i=this.resumeCapturingTimeout)==null||i.stop(),this.sparkScanView.switchToIdleState(),a.sessionStopReason!=null&&this.analyticsManager.setSessionStopReason(a.sessionStopReason);}async switchToActiveState(a={}){var t,i,r,o,h,s,S;let e=this.stateManager.state;await((t=this.camera)==null?void 0:t.switchToDesiredState(FrameSourceState.On)),await((i=this.camera)==null?void 0:i.setDesiredTorchState(this.stateManager.torchState)),a.barcodeFeedback&&await((r=this.sparkScanOverlay)==null?void 0:r.setBrush(this.brushForFeedback(a.barcodeFeedback))),await((o=this.sparkScanOverlay)==null?void 0:o.setShouldRemoveLocationsAfterScan(this.stateManager.continuousModeEnabled)),await((h=this.sparkScanOverlay)==null?void 0:h.overlayReadyForDraw()),this.feedbackManager.emitBarcodeFeedback(a.barcodeFeedback),this.stateManager.holdingToScan||this.inactiveStateTimeout.start(),this.triggerButtonCollapseTimeout.stop(),(s=this.resumeCapturingTimeout)==null||s.stop(),await this.sparkScanView.switchToActiveState(this.sparkScanViewSettings.visualFeedbackEnabled&&a.barcodeFeedback instanceof c,this.stateManager.scanningBehavior,(S=a.barcodeFeedback)==null?void 0:S.visualFeedbackColor,this.stateManager.zoomedIn&&e!=="active"),await this.sparkScan.setEnabled(true),this.setState("active");}async switchToInactiveState(a){var t,i,r,o,h,s;(a.emitSuccessFeedback)!=null||(a.emitSuccessFeedback=true),this.setState("inactive"),a.barcodeFeedback&&await((t=this.sparkScanOverlay)==null?void 0:t.setBrush(this.brushForFeedback(a.barcodeFeedback))),await this.sparkScan.setEnabled(false),this.stateManager.scanningMode.previewBehavior==="persistent"?a.barcodeFeedback instanceof c&&await((i=this.sparkScanOverlay)==null?void 0:i.setShouldRemoveLocationsAfterScan(true)):await((r=this.camera)==null?void 0:r.switchToDesiredState(FrameSourceState.Standby)),this.feedbackManager.emitBarcodeFeedback(a.barcodeFeedback),await((o=this.sparkScanOverlay)==null?void 0:o.overlayReadyForDraw()),this.triggerButtonCollapseTimeout.start(),this.inactiveStateTimeout.stop(),(h=this.resumeCapturingTimeout)==null||h.stop(),await this.sparkScanView.switchToInactiveState(this.sparkScanViewSettings.visualFeedbackEnabled&&a.barcodeFeedback instanceof c&&a.emitSuccessFeedback,this.stateManager.scanningBehavior,this.stateManager.previewBehavior,(s=a.barcodeFeedback)==null?void 0:s.visualFeedbackColor),this.analyticsManager.setSessionStopReason(a.sessionStopReason);}async switchToErrorState(a){var t,i,r,o;let e=a.barcodeFeedback.resumeCapturingDelay>0;e&&(this.setState("error"),this.stateManager.scanningBehavior="single",await this.sparkScan.setEnabled(false),await((t=this.camera)==null?void 0:t.switchToDesiredState(FrameSourceState.Standby)),this.resumeCapturingTimeout=new Timeout(a.barcodeFeedback.resumeCapturingDelay,async()=>{this.stateManager.state!=="active"&&await this.switchToActiveState();}),this.resumeCapturingTimeout.start()),await((i=this.sparkScanOverlay)==null?void 0:i.setErrorBrush(a.barcodeFeedback.brush)),await((r=this.sparkScanOverlay)==null?void 0:r.overlayReadyForDraw()),await((o=this.sparkScanOverlay)==null?void 0:o.setShouldRemoveLocationsAfterScan(a.barcodeFeedback.resumeCapturingDelay===0)),await this.sparkScan.workerCommand("sparkScanEmitErrorFeedback",{shouldRemoveBrush:!e}),this.feedbackManager.emitBarcodeFeedback(a.barcodeFeedback),this.triggerButtonCollapseTimeout.stop(),this.inactiveStateTimeout.stop(),await this.sparkScanView.switchToErrorState(a.barcodeFeedback,this.sparkScanViewSettings.visualFeedbackEnabled);}enableTargetModeLocationSelection(a){var r;let e=a?b$2.SparkScan.SparkScanSettings.targetModeLocationSelection.radius:b$2.SparkScan.SparkScanSettings.locationSelection.radius,t=a?b$2.SparkScan.SparkScanSettings.targetModeLocationSelection.unit:b$2.SparkScan.SparkScanSettings.locationSelection.unit,i=new NumberWithUnit(e,t);this.sparkScan.settings.locationSelection=new RadiusLocationSelection(i),(r=this.sparkScanOverlay)==null||r.setRadius(i);}enableTargetMode(a){this.enableTargetModeLocationSelection(a);}async applyPreferences(){await this.onTargetModeButtonTap(this.stateManager.targetModeEnabled,this.feedbackManager.noFeedback,false),await this.onScanningBehaviorButtonTap(this.stateManager.continuousModeEnabled,this.feedbackManager.noFeedback,false),await this.onTorchButtonTap(this.stateManager.torchEnabled,this.feedbackManager.noFeedback,false);}setState(a){var e,t;a!==this.stateManager.state&&(this.stateManager.state=a,(t=(e=this.listener)==null?void 0:e.didChangeViewState)==null||t.call(e,a));}startTimeoutForCurrentState(){let a=this.stateTimeouts[this.stateManager.state];a==null||a.start();}};export{P as a};