scandit-datacapture-frameworks-core 7.1.0 → 7.2.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -369,14 +369,25 @@ class FactoryMaker {
369
369
  var _a;
370
370
  const item = FactoryMaker.instances.get(clsName);
371
371
  if (item === null || item === undefined) {
372
- console.warn(`Trying to get a non existing instance for ${clsName}`);
373
- return;
372
+ throw new Error(`Trying to get a non existing instance for ${clsName}`);
374
373
  }
375
374
  if (!item.instance && item.builder) {
376
- item.instance = (_a = item.builder) === null || _a === void 0 ? void 0 : _a.call(item);
375
+ item.instance = (_a = item.builder) === null || _a === undefined ? undefined : _a.call(item);
377
376
  }
378
377
  return item.instance;
379
378
  }
379
+ static createInstance(clsName) {
380
+ var _a;
381
+ const item = FactoryMaker.instances.get(clsName);
382
+ if (item === null || item === undefined) {
383
+ throw new Error(`Trying to get a non existing instance for ${clsName}`);
384
+ }
385
+ const proxyInstance = (_a = item.builder) === null || _a === undefined ? undefined : _a.call(item);
386
+ if (proxyInstance === undefined) {
387
+ throw new Error(`item.builder?.() returned undefined for ${clsName}`);
388
+ }
389
+ return proxyInstance;
390
+ }
380
391
  }
381
392
  FactoryMaker.instances = new Map();
382
393
 
@@ -432,6 +443,15 @@ class BaseController {
432
443
  this.eventEmitter = FactoryMaker.getInstance('EventEmitter');
433
444
  this.proxyName = proxyName;
434
445
  }
446
+ }
447
+ class BaseNewController {
448
+ get _proxy() {
449
+ return this._cachedProxy;
450
+ }
451
+ constructor(proxyName) {
452
+ this.eventEmitter = FactoryMaker.getInstance('EventEmitter');
453
+ this._cachedProxy = FactoryMaker.createInstance(proxyName);
454
+ }
435
455
  emit(event, payload) {
436
456
  this.eventEmitter.emit(event, payload);
437
457
  }
@@ -463,6 +483,9 @@ const advancedNativeProxyHook = {
463
483
  // $methodName will be redirected to the special _call
464
484
  // method on AdvancedNativeProxy
465
485
  if (prop.startsWith("$")) {
486
+ if (prop in advancedNativeProxy) {
487
+ return advancedNativeProxy[prop];
488
+ }
466
489
  return (args) => {
467
490
  return advancedNativeProxy._call(prop.substring(1), args);
468
491
  };
@@ -488,37 +511,46 @@ class AdvancedNativeProxy extends BaseNativeProxy {
488
511
  this.nativeCaller = nativeCaller;
489
512
  this.events = events;
490
513
  this.eventSubscriptions = new Map();
491
- this.events.forEach((event) => __awaiter(this, void 0, void 0, function* () {
514
+ this.events.forEach((event) => __awaiter(this, undefined, undefined, function* () {
492
515
  yield this._registerEvent(event);
493
516
  }));
494
517
  // Wrapping the AdvancedNativeProxy instance with the JS proxy hook
495
518
  return new Proxy(this, advancedNativeProxyHook);
496
519
  }
497
520
  dispose() {
498
- return __awaiter(this, void 0, void 0, function* () {
521
+ return __awaiter(this, undefined, undefined, function* () {
499
522
  for (const event of this.events) {
500
523
  yield this._unregisterEvent(event);
501
524
  }
525
+ this.eventSubscriptions.clear();
526
+ this.events = [];
502
527
  });
503
528
  }
504
529
  _call(fnName, args) {
505
530
  return this.nativeCaller.callFn(fnName, args);
506
531
  }
507
532
  _registerEvent(event) {
508
- return __awaiter(this, void 0, void 0, function* () {
509
- const handler = (args) => __awaiter(this, void 0, void 0, function* () {
533
+ return __awaiter(this, undefined, undefined, function* () {
534
+ const handler = (args) => __awaiter(this, undefined, undefined, function* () {
510
535
  this.eventEmitter.emit(event.nativeEventName, args);
511
536
  });
512
- this.eventEmitter.on(event.nativeEventName, (args) => __awaiter(this, void 0, void 0, function* () {
537
+ this.eventEmitter.on(event.nativeEventName, (args) => __awaiter(this, undefined, undefined, function* () {
513
538
  // Call to the special method defined on the JS Proxy hook
514
- yield this[`on$${event.name}`](args);
539
+ try {
540
+ const hookArg = this.nativeCaller.eventHook(args);
541
+ yield this[`on$${event.name}`](hookArg);
542
+ }
543
+ catch (e) {
544
+ console.error(`Error while trying to execute handler for ${event.nativeEventName}`, e);
545
+ throw e;
546
+ }
515
547
  }));
516
548
  const subscription = yield this.nativeCaller.registerEvent(event.nativeEventName, handler);
517
549
  this.eventSubscriptions.set(event.name, subscription);
518
550
  });
519
551
  }
520
552
  _unregisterEvent(event) {
521
- return __awaiter(this, void 0, void 0, function* () {
553
+ return __awaiter(this, undefined, undefined, function* () {
522
554
  const subscription = this.eventSubscriptions.get(event.name);
523
555
  yield this.nativeCaller.unregisterEvent(event.nativeEventName, subscription);
524
556
  this.eventEmitter.off(event.nativeEventName);
@@ -537,12 +569,30 @@ class AdvancedNativeProxy extends BaseNativeProxy {
537
569
  * @param eventsEnum
538
570
  */
539
571
  function createAdvancedNativeProxy(nativeCaller, eventsEnum = undefined) {
540
- const eventsList = Object.entries(eventsEnum).map(([key, value]) => ({
572
+ const eventsList = eventsEnum == null ? [] : Object.entries(eventsEnum).map(([key, value]) => ({
541
573
  name: key,
542
574
  nativeEventName: value
543
575
  }));
544
576
  return new AdvancedNativeProxy(nativeCaller, eventsList);
545
577
  }
578
+ /**
579
+ * Function to create a custom AdvancedNativeProxy. This will return an object which will provide dynamically the
580
+ * methods specified in the PROXY interface.
581
+ *
582
+ * The Proxy interface implemented in order to call native methods will require a special mark
583
+ * `$methodName` for method calls
584
+ * `on$methodName` for the listeners added to the events defined in eventsEnum
585
+ * @param klass
586
+ * @param nativeCaller
587
+ * @param eventsEnum
588
+ */
589
+ function createAdvancedNativeFromCtorProxy(klass, nativeCaller, eventsEnum = undefined) {
590
+ const eventsList = Object.entries(eventsEnum).map(([key, value]) => ({
591
+ name: key,
592
+ nativeEventName: value
593
+ }));
594
+ return new klass(nativeCaller, eventsList);
595
+ }
546
596
 
547
597
  function getCoreDefaults() {
548
598
  return FactoryMaker.getInstance('CoreDefaults');
@@ -722,10 +772,10 @@ class Point extends DefaultSerializeable {
722
772
  }
723
773
  __decorate([
724
774
  nameForSerialization('x')
725
- ], Point.prototype, "_x", void 0);
775
+ ], Point.prototype, "_x", undefined);
726
776
  __decorate([
727
777
  nameForSerialization('y')
728
- ], Point.prototype, "_y", void 0);
778
+ ], Point.prototype, "_y", undefined);
729
779
 
730
780
  class Quadrilateral extends DefaultSerializeable {
731
781
  get topLeft() {
@@ -753,16 +803,16 @@ class Quadrilateral extends DefaultSerializeable {
753
803
  }
754
804
  __decorate([
755
805
  nameForSerialization('topLeft')
756
- ], Quadrilateral.prototype, "_topLeft", void 0);
806
+ ], Quadrilateral.prototype, "_topLeft", undefined);
757
807
  __decorate([
758
808
  nameForSerialization('topRight')
759
- ], Quadrilateral.prototype, "_topRight", void 0);
809
+ ], Quadrilateral.prototype, "_topRight", undefined);
760
810
  __decorate([
761
811
  nameForSerialization('bottomRight')
762
- ], Quadrilateral.prototype, "_bottomRight", void 0);
812
+ ], Quadrilateral.prototype, "_bottomRight", undefined);
763
813
  __decorate([
764
814
  nameForSerialization('bottomLeft')
765
- ], Quadrilateral.prototype, "_bottomLeft", void 0);
815
+ ], Quadrilateral.prototype, "_bottomLeft", undefined);
766
816
 
767
817
  class NumberWithUnit extends DefaultSerializeable {
768
818
  get value() {
@@ -782,10 +832,10 @@ class NumberWithUnit extends DefaultSerializeable {
782
832
  }
783
833
  __decorate([
784
834
  nameForSerialization('value')
785
- ], NumberWithUnit.prototype, "_value", void 0);
835
+ ], NumberWithUnit.prototype, "_value", undefined);
786
836
  __decorate([
787
837
  nameForSerialization('unit')
788
- ], NumberWithUnit.prototype, "_unit", void 0);
838
+ ], NumberWithUnit.prototype, "_unit", undefined);
789
839
 
790
840
  var MeasureUnit;
791
841
  (function (MeasureUnit) {
@@ -815,10 +865,10 @@ class PointWithUnit extends DefaultSerializeable {
815
865
  }
816
866
  __decorate([
817
867
  nameForSerialization('x')
818
- ], PointWithUnit.prototype, "_x", void 0);
868
+ ], PointWithUnit.prototype, "_x", undefined);
819
869
  __decorate([
820
870
  nameForSerialization('y')
821
- ], PointWithUnit.prototype, "_y", void 0);
871
+ ], PointWithUnit.prototype, "_y", undefined);
822
872
 
823
873
  class Rect extends DefaultSerializeable {
824
874
  get origin() {
@@ -835,10 +885,10 @@ class Rect extends DefaultSerializeable {
835
885
  }
836
886
  __decorate([
837
887
  nameForSerialization('origin')
838
- ], Rect.prototype, "_origin", void 0);
888
+ ], Rect.prototype, "_origin", undefined);
839
889
  __decorate([
840
890
  nameForSerialization('size')
841
- ], Rect.prototype, "_size", void 0);
891
+ ], Rect.prototype, "_size", undefined);
842
892
 
843
893
  class RectWithUnit extends DefaultSerializeable {
844
894
  get origin() {
@@ -855,10 +905,10 @@ class RectWithUnit extends DefaultSerializeable {
855
905
  }
856
906
  __decorate([
857
907
  nameForSerialization('origin')
858
- ], RectWithUnit.prototype, "_origin", void 0);
908
+ ], RectWithUnit.prototype, "_origin", undefined);
859
909
  __decorate([
860
910
  nameForSerialization('size')
861
- ], RectWithUnit.prototype, "_size", void 0);
911
+ ], RectWithUnit.prototype, "_size", undefined);
862
912
 
863
913
  class ScanditIcon extends DefaultSerializeable {
864
914
  static fromJSON(json) {
@@ -900,26 +950,26 @@ class ScanditIcon extends DefaultSerializeable {
900
950
  __decorate([
901
951
  nameForSerialization('backgroundColor'),
902
952
  ignoreFromSerializationIfNull
903
- ], ScanditIcon.prototype, "_backgroundColor", void 0);
953
+ ], ScanditIcon.prototype, "_backgroundColor", undefined);
904
954
  __decorate([
905
955
  nameForSerialization('backgroundShape'),
906
956
  ignoreFromSerializationIfNull
907
- ], ScanditIcon.prototype, "_backgroundShape", void 0);
957
+ ], ScanditIcon.prototype, "_backgroundShape", undefined);
908
958
  __decorate([
909
959
  nameForSerialization('icon'),
910
960
  ignoreFromSerializationIfNull
911
- ], ScanditIcon.prototype, "_icon", void 0);
961
+ ], ScanditIcon.prototype, "_icon", undefined);
912
962
  __decorate([
913
963
  nameForSerialization('iconColor'),
914
964
  ignoreFromSerializationIfNull
915
- ], ScanditIcon.prototype, "_iconColor", void 0);
965
+ ], ScanditIcon.prototype, "_iconColor", undefined);
916
966
  __decorate([
917
967
  nameForSerialization('backgroundStrokeColor'),
918
968
  ignoreFromSerializationIfNull
919
- ], ScanditIcon.prototype, "_backgroundStrokeColor", void 0);
969
+ ], ScanditIcon.prototype, "_backgroundStrokeColor", undefined);
920
970
  __decorate([
921
971
  nameForSerialization('backgroundStrokeWidth')
922
- ], ScanditIcon.prototype, "_backgroundStrokeWidth", void 0);
972
+ ], ScanditIcon.prototype, "_backgroundStrokeWidth", undefined);
923
973
 
924
974
  class ScanditIconBuilder {
925
975
  constructor() {
@@ -1009,10 +1059,10 @@ class Size extends DefaultSerializeable {
1009
1059
  }
1010
1060
  __decorate([
1011
1061
  nameForSerialization('width')
1012
- ], Size.prototype, "_width", void 0);
1062
+ ], Size.prototype, "_width", undefined);
1013
1063
  __decorate([
1014
1064
  nameForSerialization('height')
1015
- ], Size.prototype, "_height", void 0);
1065
+ ], Size.prototype, "_height", undefined);
1016
1066
 
1017
1067
  class SizeWithAspect extends DefaultSerializeable {
1018
1068
  get size() {
@@ -1029,10 +1079,10 @@ class SizeWithAspect extends DefaultSerializeable {
1029
1079
  }
1030
1080
  __decorate([
1031
1081
  nameForSerialization('size')
1032
- ], SizeWithAspect.prototype, "_size", void 0);
1082
+ ], SizeWithAspect.prototype, "_size", undefined);
1033
1083
  __decorate([
1034
1084
  nameForSerialization('aspect')
1035
- ], SizeWithAspect.prototype, "_aspect", void 0);
1085
+ ], SizeWithAspect.prototype, "_aspect", undefined);
1036
1086
 
1037
1087
  class SizeWithUnit extends DefaultSerializeable {
1038
1088
  get width() {
@@ -1049,10 +1099,10 @@ class SizeWithUnit extends DefaultSerializeable {
1049
1099
  }
1050
1100
  __decorate([
1051
1101
  nameForSerialization('width')
1052
- ], SizeWithUnit.prototype, "_width", void 0);
1102
+ ], SizeWithUnit.prototype, "_width", undefined);
1053
1103
  __decorate([
1054
1104
  nameForSerialization('height')
1055
- ], SizeWithUnit.prototype, "_height", void 0);
1105
+ ], SizeWithUnit.prototype, "_height", undefined);
1056
1106
 
1057
1107
  var SizingMode;
1058
1108
  (function (SizingMode) {
@@ -1157,16 +1207,16 @@ class SizeWithUnitAndAspect {
1157
1207
  }
1158
1208
  __decorate([
1159
1209
  nameForSerialization('widthAndHeight')
1160
- ], SizeWithUnitAndAspect.prototype, "_widthAndHeight", void 0);
1210
+ ], SizeWithUnitAndAspect.prototype, "_widthAndHeight", undefined);
1161
1211
  __decorate([
1162
1212
  nameForSerialization('widthAndAspectRatio')
1163
- ], SizeWithUnitAndAspect.prototype, "_widthAndAspectRatio", void 0);
1213
+ ], SizeWithUnitAndAspect.prototype, "_widthAndAspectRatio", undefined);
1164
1214
  __decorate([
1165
1215
  nameForSerialization('heightAndAspectRatio')
1166
- ], SizeWithUnitAndAspect.prototype, "_heightAndAspectRatio", void 0);
1216
+ ], SizeWithUnitAndAspect.prototype, "_heightAndAspectRatio", undefined);
1167
1217
  __decorate([
1168
1218
  nameForSerialization('shorterDimensionAndAspectRatio')
1169
- ], SizeWithUnitAndAspect.prototype, "_shorterDimensionAndAspectRatio", void 0);
1219
+ ], SizeWithUnitAndAspect.prototype, "_shorterDimensionAndAspectRatio", undefined);
1170
1220
 
1171
1221
  class MarginsWithUnit extends DefaultSerializeable {
1172
1222
  get left() {
@@ -1197,16 +1247,16 @@ class MarginsWithUnit extends DefaultSerializeable {
1197
1247
  }
1198
1248
  __decorate([
1199
1249
  nameForSerialization('left')
1200
- ], MarginsWithUnit.prototype, "_left", void 0);
1250
+ ], MarginsWithUnit.prototype, "_left", undefined);
1201
1251
  __decorate([
1202
1252
  nameForSerialization('right')
1203
- ], MarginsWithUnit.prototype, "_right", void 0);
1253
+ ], MarginsWithUnit.prototype, "_right", undefined);
1204
1254
  __decorate([
1205
1255
  nameForSerialization('top')
1206
- ], MarginsWithUnit.prototype, "_top", void 0);
1256
+ ], MarginsWithUnit.prototype, "_top", undefined);
1207
1257
  __decorate([
1208
1258
  nameForSerialization('bottom')
1209
- ], MarginsWithUnit.prototype, "_bottom", void 0);
1259
+ ], MarginsWithUnit.prototype, "_bottom", undefined);
1210
1260
 
1211
1261
  class Color {
1212
1262
  get redComponent() {
@@ -1310,6 +1360,9 @@ class Brush extends DefaultSerializeable {
1310
1360
  this.fill = { color: fillColor };
1311
1361
  this.stroke = { color: strokeColor, width: strokeWidth };
1312
1362
  }
1363
+ static fromJSON(brushJson) {
1364
+ return new Brush(Color.fromHex(brushJson.fillColor), Color.fromHex(brushJson.strokeColor), brushJson.strokeWidth);
1365
+ }
1313
1366
  }
1314
1367
 
1315
1368
  var Anchor;
@@ -1377,7 +1430,7 @@ class Observable extends DefaultSerializeable {
1377
1430
  }
1378
1431
  __decorate([
1379
1432
  ignoreFromSerialization
1380
- ], Observable.prototype, "listeners", void 0);
1433
+ ], Observable.prototype, "listeners", undefined);
1381
1434
 
1382
1435
  class HtmlElementPosition {
1383
1436
  constructor(top, left) {
@@ -1420,8 +1473,8 @@ class HTMLElementState {
1420
1473
  var _a, _b, _c, _d;
1421
1474
  if (!other)
1422
1475
  return true;
1423
- const positionChanged = (_b = (_a = this.position) === null || _a === void 0 ? void 0 : _a.didChangeComparedTo(other.position)) !== null && _b !== void 0 ? _b : (this.position !== other.position);
1424
- const sizeChanged = (_d = (_c = this.size) === null || _c === void 0 ? void 0 : _c.didChangeComparedTo(other.size)) !== null && _d !== void 0 ? _d : (this.size !== other.size);
1476
+ const positionChanged = (_b = (_a = this.position) === null || _a === undefined ? undefined : _a.didChangeComparedTo(other.position)) !== null && _b !== undefined ? _b : (this.position !== other.position);
1477
+ const sizeChanged = (_d = (_c = this.size) === null || _c === undefined ? undefined : _c.didChangeComparedTo(other.size)) !== null && _d !== undefined ? _d : (this.size !== other.size);
1425
1478
  return positionChanged || sizeChanged || this.shouldBeUnderContent !== other.shouldBeUnderContent;
1426
1479
  }
1427
1480
  }
@@ -1437,7 +1490,7 @@ class ImageFrameSourceController {
1437
1490
  this._proxy = FactoryMaker.getInstance('ImageFrameSourceProxy');
1438
1491
  }
1439
1492
  getCurrentState() {
1440
- return __awaiter(this, void 0, void 0, function* () {
1493
+ return __awaiter(this, undefined, undefined, function* () {
1441
1494
  const result = yield this._proxy.getCurrentCameraState(this.imageFrameSource.position);
1442
1495
  if (result == null) {
1443
1496
  return FrameSourceState.Off;
@@ -1451,7 +1504,7 @@ class ImageFrameSourceController {
1451
1504
  subscribeListener() {
1452
1505
  var _a, _b;
1453
1506
  this._proxy.registerListenerForEvents();
1454
- (_b = (_a = this._proxy).subscribeDidChangeState) === null || _b === void 0 ? void 0 : _b.call(_a);
1507
+ (_b = (_a = this._proxy).subscribeDidChangeState) === null || _b === undefined ? undefined : _b.call(_a);
1455
1508
  this.eventEmitter.on(FrameSourceListenerEvents.didChangeState, (data) => {
1456
1509
  const event = EventDataParser.parse(data);
1457
1510
  if (event === null) {
@@ -1542,19 +1595,19 @@ class ImageFrameSource extends DefaultSerializeable {
1542
1595
  }
1543
1596
  __decorate([
1544
1597
  nameForSerialization('id')
1545
- ], ImageFrameSource.prototype, "_id", void 0);
1598
+ ], ImageFrameSource.prototype, "_id", undefined);
1546
1599
  __decorate([
1547
1600
  nameForSerialization('desiredState')
1548
- ], ImageFrameSource.prototype, "_desiredState", void 0);
1601
+ ], ImageFrameSource.prototype, "_desiredState", undefined);
1549
1602
  __decorate([
1550
1603
  ignoreFromSerialization
1551
- ], ImageFrameSource.prototype, "listeners", void 0);
1604
+ ], ImageFrameSource.prototype, "listeners", undefined);
1552
1605
  __decorate([
1553
1606
  ignoreFromSerialization
1554
- ], ImageFrameSource.prototype, "_context", void 0);
1607
+ ], ImageFrameSource.prototype, "_context", undefined);
1555
1608
  __decorate([
1556
1609
  ignoreFromSerialization
1557
- ], ImageFrameSource.prototype, "controller", void 0);
1610
+ ], ImageFrameSource.prototype, "controller", undefined);
1558
1611
 
1559
1612
  class PrivateFrameData {
1560
1613
  get imageBuffers() {
@@ -1599,7 +1652,7 @@ class CameraController {
1599
1652
  return this.camera;
1600
1653
  }
1601
1654
  static getFrame(frameId) {
1602
- return __awaiter(this, void 0, void 0, function* () {
1655
+ return __awaiter(this, undefined, undefined, function* () {
1603
1656
  const result = yield CameraController._proxy.getFrame(frameId);
1604
1657
  if (result == null) {
1605
1658
  return PrivateFrameData.empty();
@@ -1609,7 +1662,7 @@ class CameraController {
1609
1662
  });
1610
1663
  }
1611
1664
  static getFrameOrNull(frameId) {
1612
- return __awaiter(this, void 0, void 0, function* () {
1665
+ return __awaiter(this, undefined, undefined, function* () {
1613
1666
  const result = yield CameraController._proxy.getFrame(frameId);
1614
1667
  if (result == null) {
1615
1668
  return null;
@@ -1619,7 +1672,7 @@ class CameraController {
1619
1672
  });
1620
1673
  }
1621
1674
  getCurrentState() {
1622
- return __awaiter(this, void 0, void 0, function* () {
1675
+ return __awaiter(this, undefined, undefined, function* () {
1623
1676
  const result = yield CameraController._proxy.getCurrentCameraState(this.privateCamera.position);
1624
1677
  if (result == null) {
1625
1678
  return FrameSourceState.Off;
@@ -1628,7 +1681,7 @@ class CameraController {
1628
1681
  });
1629
1682
  }
1630
1683
  getIsTorchAvailable() {
1631
- return __awaiter(this, void 0, void 0, function* () {
1684
+ return __awaiter(this, undefined, undefined, function* () {
1632
1685
  const result = yield CameraController._proxy.isTorchAvailable(this.privateCamera.position);
1633
1686
  if (result == null) {
1634
1687
  return false;
@@ -1642,13 +1695,13 @@ class CameraController {
1642
1695
  subscribeListener() {
1643
1696
  var _a, _b;
1644
1697
  CameraController._proxy.registerListenerForCameraEvents();
1645
- (_b = (_a = CameraController._proxy).subscribeDidChangeState) === null || _b === void 0 ? void 0 : _b.call(_a);
1698
+ (_b = (_a = CameraController._proxy).subscribeDidChangeState) === null || _b === undefined ? undefined : _b.call(_a);
1646
1699
  this.eventEmitter.on(FrameSourceListenerEvents.didChangeState, (data) => {
1647
1700
  const event = EventDataParser.parse(data);
1648
1701
  if (event) {
1649
1702
  this.privateCamera.listeners.forEach(listener => {
1650
1703
  var _a;
1651
- (_a = listener === null || listener === void 0 ? void 0 : listener.didChangeState) === null || _a === void 0 ? void 0 : _a.call(listener, this.camera, event.state);
1704
+ (_a = listener === null || listener === undefined ? undefined : listener.didChangeState) === null || _a === undefined ? undefined : _a.call(listener, this.camera, event.state);
1652
1705
  });
1653
1706
  }
1654
1707
  });
@@ -1780,7 +1833,7 @@ class Camera extends DefaultSerializeable {
1780
1833
  return this.didChange();
1781
1834
  }
1782
1835
  didChange() {
1783
- return __awaiter(this, void 0, void 0, function* () {
1836
+ return __awaiter(this, undefined, undefined, function* () {
1784
1837
  if (this.context) {
1785
1838
  yield this.context.update();
1786
1839
  }
@@ -1789,22 +1842,22 @@ class Camera extends DefaultSerializeable {
1789
1842
  }
1790
1843
  __decorate([
1791
1844
  serializationDefault({})
1792
- ], Camera.prototype, "settings", void 0);
1845
+ ], Camera.prototype, "settings", undefined);
1793
1846
  __decorate([
1794
1847
  nameForSerialization('desiredTorchState')
1795
- ], Camera.prototype, "_desiredTorchState", void 0);
1848
+ ], Camera.prototype, "_desiredTorchState", undefined);
1796
1849
  __decorate([
1797
1850
  ignoreFromSerialization
1798
- ], Camera.prototype, "_desiredState", void 0);
1851
+ ], Camera.prototype, "_desiredState", undefined);
1799
1852
  __decorate([
1800
1853
  ignoreFromSerialization
1801
- ], Camera.prototype, "listeners", void 0);
1854
+ ], Camera.prototype, "listeners", undefined);
1802
1855
  __decorate([
1803
1856
  ignoreFromSerialization
1804
- ], Camera.prototype, "_context", void 0);
1857
+ ], Camera.prototype, "_context", undefined);
1805
1858
  __decorate([
1806
1859
  ignoreFromSerialization
1807
- ], Camera.prototype, "controller", void 0);
1860
+ ], Camera.prototype, "controller", undefined);
1808
1861
  __decorate([
1809
1862
  ignoreFromSerialization
1810
1863
  ], Camera, "coreDefaults", null);
@@ -1834,11 +1887,11 @@ class ControlImage extends DefaultSerializeable {
1834
1887
  __decorate([
1835
1888
  ignoreFromSerializationIfNull,
1836
1889
  nameForSerialization('data')
1837
- ], ControlImage.prototype, "_data", void 0);
1890
+ ], ControlImage.prototype, "_data", undefined);
1838
1891
  __decorate([
1839
1892
  ignoreFromSerializationIfNull,
1840
1893
  nameForSerialization('name')
1841
- ], ControlImage.prototype, "_name", void 0);
1894
+ ], ControlImage.prototype, "_name", undefined);
1842
1895
 
1843
1896
  class ContextStatus {
1844
1897
  static fromJSON(json) {
@@ -1898,23 +1951,15 @@ class DataCaptureContextController {
1898
1951
  static forDataCaptureContext(context) {
1899
1952
  const controller = new DataCaptureContextController();
1900
1953
  controller.context = context;
1901
- controller.initialize();
1902
1954
  return controller;
1903
1955
  }
1904
- static forDataCaptureContextAsync(context) {
1905
- return __awaiter(this, void 0, void 0, function* () {
1906
- const controller = new DataCaptureContextController();
1907
- controller.context = context;
1908
- yield controller.initialize();
1909
- return controller;
1910
- });
1911
- }
1912
1956
  constructor() {
1957
+ this._listenerRegistered = false;
1913
1958
  this._proxy = FactoryMaker.getInstance('DataCaptureContextProxy');
1914
1959
  this.eventEmitter = FactoryMaker.getInstance('EventEmitter');
1915
1960
  }
1916
1961
  updateContextFromJSON() {
1917
- return __awaiter(this, void 0, void 0, function* () {
1962
+ return __awaiter(this, undefined, undefined, function* () {
1918
1963
  try {
1919
1964
  yield this._proxy.updateContextFromJSON(JSON.stringify(this.context.toJSON()));
1920
1965
  }
@@ -1947,7 +1992,7 @@ class DataCaptureContextController {
1947
1992
  return this.initializeContextFromJSON();
1948
1993
  }
1949
1994
  initializeContextFromJSON() {
1950
- return __awaiter(this, void 0, void 0, function* () {
1995
+ return __awaiter(this, undefined, undefined, function* () {
1951
1996
  try {
1952
1997
  yield this._proxy.contextFromJSON(JSON.stringify(this.context.toJSON()));
1953
1998
  }
@@ -1958,7 +2003,7 @@ class DataCaptureContextController {
1958
2003
  });
1959
2004
  }
1960
2005
  static getOpenSourceSoftwareLicenseInfo() {
1961
- return __awaiter(this, void 0, void 0, function* () {
2006
+ return __awaiter(this, undefined, undefined, function* () {
1962
2007
  const proxy = FactoryMaker.getInstance('DataCaptureContextProxy');
1963
2008
  const result = yield proxy.getOpenSourceSoftwareLicenseInfo();
1964
2009
  return new OpenSourceSoftwareLicenseInfo(result.data);
@@ -1966,9 +2011,12 @@ class DataCaptureContextController {
1966
2011
  }
1967
2012
  subscribeListener() {
1968
2013
  var _a, _b, _c, _d;
2014
+ if (this._listenerRegistered) {
2015
+ return;
2016
+ }
1969
2017
  this._proxy.registerListenerForDataCaptureContext();
1970
- (_b = (_a = this._proxy).subscribeDidChangeStatus) === null || _b === void 0 ? void 0 : _b.call(_a);
1971
- (_d = (_c = this._proxy).subscribeDidStartObservingContext) === null || _d === void 0 ? void 0 : _d.call(_c);
2018
+ (_b = (_a = this._proxy).subscribeDidChangeStatus) === null || _b === undefined ? undefined : _b.call(_a);
2019
+ (_d = (_c = this._proxy).subscribeDidStartObservingContext) === null || _d === undefined ? undefined : _d.call(_c);
1972
2020
  this.eventEmitter.on(DataCaptureContextEvents.didChangeStatus, (data) => {
1973
2021
  const event = EventDataParser.parse(data);
1974
2022
  if (event === null) {
@@ -1981,9 +2029,10 @@ class DataCaptureContextController {
1981
2029
  this.eventEmitter.on(DataCaptureContextEvents.didStartObservingContext, () => {
1982
2030
  this.privateContext.listeners.forEach(listener => {
1983
2031
  var _a;
1984
- (_a = listener.didStartObservingContext) === null || _a === void 0 ? void 0 : _a.call(listener, this.context);
2032
+ (_a = listener.didStartObservingContext) === null || _a === undefined ? undefined : _a.call(listener, this.context);
1985
2033
  });
1986
2034
  });
2035
+ this._listenerRegistered = true;
1987
2036
  }
1988
2037
  notifyListenersOfDeserializationError(error) {
1989
2038
  const contextStatus = ContextStatus
@@ -2004,6 +2053,12 @@ class DataCaptureContextController {
2004
2053
  }
2005
2054
 
2006
2055
  class DataCaptureContext extends DefaultSerializeable {
2056
+ static get sharedInstance() {
2057
+ if (DataCaptureContext._instance == null) {
2058
+ DataCaptureContext._instance = new DataCaptureContext('', '', null);
2059
+ }
2060
+ return DataCaptureContext._instance;
2061
+ }
2007
2062
  static get coreDefaults() {
2008
2063
  return getCoreDefaults();
2009
2064
  }
@@ -2021,22 +2076,33 @@ class DataCaptureContext extends DefaultSerializeable {
2021
2076
  return DataCaptureContext.deviceID;
2022
2077
  }
2023
2078
  static forLicenseKey(licenseKey) {
2024
- return DataCaptureContext.create(licenseKey, null, null);
2079
+ const instance = DataCaptureContext.create(licenseKey, null, null);
2080
+ // Call initialize to ensure the shared instance is updated.
2081
+ instance.controller.initialize();
2082
+ return instance;
2025
2083
  }
2026
2084
  static forLicenseKeyWithSettings(licenseKey, settings) {
2027
- return DataCaptureContext.create(licenseKey, null, settings);
2085
+ const instance = DataCaptureContext.create(licenseKey, null, settings);
2086
+ // Call initialize to ensure the shared instance is updated.
2087
+ instance.controller.initialize();
2088
+ return instance;
2028
2089
  }
2029
2090
  static forLicenseKeyWithOptions(licenseKey, options) {
2030
- return DataCaptureContext.create(licenseKey, options, null);
2091
+ const instance = DataCaptureContext.create(licenseKey, options, null);
2092
+ // Call initialize to ensure the shared instance is updated.
2093
+ instance.controller.initialize();
2094
+ return instance;
2095
+ }
2096
+ static initialize(licenseKey, options = null, settings = null) {
2097
+ DataCaptureContext.create(licenseKey, options, settings);
2098
+ DataCaptureContext.sharedInstance.controller.initialize();
2099
+ return DataCaptureContext.sharedInstance;
2031
2100
  }
2032
2101
  static create(licenseKey, options, settings) {
2033
- if (options == null) {
2034
- options = { deviceName: null };
2035
- }
2036
- if (!DataCaptureContext.instance) {
2037
- DataCaptureContext.instance = new DataCaptureContext(licenseKey, options.deviceName || '', settings);
2038
- }
2039
- return DataCaptureContext.instance;
2102
+ DataCaptureContext.sharedInstance.licenseKey = licenseKey;
2103
+ DataCaptureContext.sharedInstance.deviceName = (options === null || options === undefined ? undefined : options.deviceName) || '';
2104
+ DataCaptureContext.sharedInstance.settings = settings || new DataCaptureContextSettings();
2105
+ return DataCaptureContext.sharedInstance;
2040
2106
  }
2041
2107
  constructor(licenseKey, deviceName, settings) {
2042
2108
  super();
@@ -2049,10 +2115,14 @@ class DataCaptureContext extends DefaultSerializeable {
2049
2115
  this.view = null;
2050
2116
  this.modes = [];
2051
2117
  this.listeners = [];
2118
+ this.licenseKey = licenseKey;
2119
+ this.deviceName = deviceName;
2052
2120
  if (settings) {
2053
2121
  this.settings = settings;
2054
2122
  }
2055
- this.initialize();
2123
+ if (this.controller == null) {
2124
+ this.controller = DataCaptureContextController.forDataCaptureContext(this);
2125
+ }
2056
2126
  }
2057
2127
  setFrameSource(frameSource) {
2058
2128
  if (this._frameSource) {
@@ -2083,6 +2153,17 @@ class DataCaptureContext extends DefaultSerializeable {
2083
2153
  this.controller.addModeToContext(mode);
2084
2154
  }
2085
2155
  }
2156
+ setMode(mode) {
2157
+ if (this.modes.length > 0) {
2158
+ this.removeAllModes();
2159
+ }
2160
+ this.addMode(mode);
2161
+ }
2162
+ removeCurrentMode() {
2163
+ if (this.modes.length > 0) {
2164
+ this.removeMode(this.modes[0]);
2165
+ }
2166
+ }
2086
2167
  removeMode(mode) {
2087
2168
  if (this.modes.includes(mode)) {
2088
2169
  this.modes.splice(this.modes.indexOf(mode), 1);
@@ -2102,8 +2183,7 @@ class DataCaptureContext extends DefaultSerializeable {
2102
2183
  if (!this.controller) {
2103
2184
  return;
2104
2185
  }
2105
- DataCaptureContext.instance = null;
2106
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.dispose();
2186
+ (_a = this.view) === null || _a === undefined ? undefined : _a.dispose();
2107
2187
  this.removeAllModes();
2108
2188
  this.controller.dispose();
2109
2189
  }
@@ -2112,25 +2192,10 @@ class DataCaptureContext extends DefaultSerializeable {
2112
2192
  return this.update();
2113
2193
  }
2114
2194
  static getOpenSourceSoftwareLicenseInfo() {
2115
- return __awaiter(this, void 0, void 0, function* () {
2195
+ return __awaiter(this, undefined, undefined, function* () {
2116
2196
  return DataCaptureContextController.getOpenSourceSoftwareLicenseInfo();
2117
2197
  });
2118
2198
  }
2119
- // Called when the capture view is shown, that is the earliest point that we need the context deserialized.
2120
- initialize() {
2121
- if (this.controller) {
2122
- return;
2123
- }
2124
- this.controller = DataCaptureContextController.forDataCaptureContext(this);
2125
- }
2126
- initializeAsync() {
2127
- return __awaiter(this, void 0, void 0, function* () {
2128
- if (this.controller) {
2129
- return;
2130
- }
2131
- this.controller = yield DataCaptureContextController.forDataCaptureContextAsync(this);
2132
- });
2133
- }
2134
2199
  update() {
2135
2200
  if (!this.controller) {
2136
2201
  return Promise.resolve();
@@ -2138,28 +2203,30 @@ class DataCaptureContext extends DefaultSerializeable {
2138
2203
  return this.controller.updateContextFromJSON();
2139
2204
  }
2140
2205
  }
2141
- DataCaptureContext.instance = null;
2142
2206
  __decorate([
2143
2207
  ignoreFromSerialization
2144
- ], DataCaptureContext.prototype, "controller", void 0);
2208
+ ], DataCaptureContext.prototype, "controller", undefined);
2145
2209
  __decorate([
2146
2210
  nameForSerialization('framework')
2147
- ], DataCaptureContext.prototype, "_framework", void 0);
2211
+ ], DataCaptureContext.prototype, "_framework", undefined);
2148
2212
  __decorate([
2149
2213
  nameForSerialization('frameworkVersion')
2150
- ], DataCaptureContext.prototype, "_frameworkVersion", void 0);
2214
+ ], DataCaptureContext.prototype, "_frameworkVersion", undefined);
2151
2215
  __decorate([
2152
2216
  nameForSerialization('frameSource')
2153
- ], DataCaptureContext.prototype, "_frameSource", void 0);
2217
+ ], DataCaptureContext.prototype, "_frameSource", undefined);
2154
2218
  __decorate([
2155
2219
  ignoreFromSerialization
2156
- ], DataCaptureContext.prototype, "view", void 0);
2220
+ ], DataCaptureContext.prototype, "view", undefined);
2157
2221
  __decorate([
2158
2222
  ignoreFromSerialization
2159
- ], DataCaptureContext.prototype, "modes", void 0);
2223
+ ], DataCaptureContext.prototype, "modes", undefined);
2160
2224
  __decorate([
2161
2225
  ignoreFromSerialization
2162
- ], DataCaptureContext.prototype, "listeners", void 0);
2226
+ ], DataCaptureContext.prototype, "listeners", undefined);
2227
+ __decorate([
2228
+ ignoreFromSerialization
2229
+ ], DataCaptureContext, "_instance", undefined);
2163
2230
  __decorate([
2164
2231
  ignoreFromSerialization
2165
2232
  ], DataCaptureContext, "coreDefaults", null);
@@ -2192,13 +2259,13 @@ class DataCaptureViewController extends BaseController {
2192
2259
  super('DataCaptureViewProxy');
2193
2260
  }
2194
2261
  viewPointForFramePoint(point) {
2195
- return __awaiter(this, void 0, void 0, function* () {
2262
+ return __awaiter(this, undefined, undefined, function* () {
2196
2263
  const result = yield this._proxy.viewPointForFramePoint(JSON.stringify(point.toJSON()));
2197
2264
  return Point.fromJSON(JSON.parse(result.data));
2198
2265
  });
2199
2266
  }
2200
2267
  viewQuadrilateralForFrameQuadrilateral(quadrilateral) {
2201
- return __awaiter(this, void 0, void 0, function* () {
2268
+ return __awaiter(this, undefined, undefined, function* () {
2202
2269
  const result = yield this._proxy.viewQuadrilateralForFrameQuadrilateral(JSON.stringify(quadrilateral.toJSON()));
2203
2270
  return Quadrilateral.fromJSON(JSON.parse(result.data));
2204
2271
  });
@@ -2213,7 +2280,7 @@ class DataCaptureViewController extends BaseController {
2213
2280
  return this._proxy.hide();
2214
2281
  }
2215
2282
  createNativeView() {
2216
- return __awaiter(this, void 0, void 0, function* () {
2283
+ return __awaiter(this, undefined, undefined, function* () {
2217
2284
  yield this.createView();
2218
2285
  this.subscribeListener();
2219
2286
  });
@@ -2233,7 +2300,7 @@ class DataCaptureViewController extends BaseController {
2233
2300
  subscribeListener() {
2234
2301
  var _a, _b;
2235
2302
  this._proxy.registerListenerForViewEvents();
2236
- (_b = (_a = this._proxy).subscribeDidChangeSize) === null || _b === void 0 ? void 0 : _b.call(_a);
2303
+ (_b = (_a = this._proxy).subscribeDidChangeSize) === null || _b === undefined ? undefined : _b.call(_a);
2237
2304
  this.eventEmitter.on(DataCaptureViewEvents.didChangeSize, (data) => {
2238
2305
  const event = EventDataParser.parse(data);
2239
2306
  if (event === null) {
@@ -2333,6 +2400,7 @@ class BaseDataCaptureView extends DefaultSerializeable {
2333
2400
  constructor(autoCreateNativeView) {
2334
2401
  super();
2335
2402
  this._context = null;
2403
+ this.viewId = null;
2336
2404
  this.overlays = [];
2337
2405
  this.controls = [];
2338
2406
  this.listeners = [];
@@ -2405,7 +2473,7 @@ class BaseDataCaptureView extends DefaultSerializeable {
2405
2473
  this.controller.updateView();
2406
2474
  }
2407
2475
  createNativeView() {
2408
- return __awaiter(this, void 0, void 0, function* () {
2476
+ return __awaiter(this, undefined, undefined, function* () {
2409
2477
  if (this.isViewCreated) {
2410
2478
  return Promise.resolve();
2411
2479
  }
@@ -2414,7 +2482,7 @@ class BaseDataCaptureView extends DefaultSerializeable {
2414
2482
  });
2415
2483
  }
2416
2484
  removeNativeView() {
2417
- return __awaiter(this, void 0, void 0, function* () {
2485
+ return __awaiter(this, undefined, undefined, function* () {
2418
2486
  if (!this.isViewCreated) {
2419
2487
  return Promise.resolve();
2420
2488
  }
@@ -2439,7 +2507,6 @@ class BaseDataCaptureView extends DefaultSerializeable {
2439
2507
  if (!this.context) {
2440
2508
  throw new Error('There should be a context attached to a view that should be shown');
2441
2509
  }
2442
- this.privateContext.initialize();
2443
2510
  return this.controller.show();
2444
2511
  }
2445
2512
  hide() {
@@ -2451,43 +2518,46 @@ class BaseDataCaptureView extends DefaultSerializeable {
2451
2518
  }
2452
2519
  __decorate([
2453
2520
  ignoreFromSerialization
2454
- ], BaseDataCaptureView.prototype, "_context", void 0);
2521
+ ], BaseDataCaptureView.prototype, "_context", undefined);
2455
2522
  __decorate([
2456
2523
  ignoreFromSerialization
2457
- ], BaseDataCaptureView.prototype, "viewComponent", void 0);
2524
+ ], BaseDataCaptureView.prototype, "viewComponent", undefined);
2458
2525
  __decorate([
2459
2526
  ignoreFromSerialization
2460
2527
  ], BaseDataCaptureView.prototype, "coreDefaults", null);
2461
2528
  __decorate([
2462
2529
  nameForSerialization('scanAreaMargins')
2463
- ], BaseDataCaptureView.prototype, "_scanAreaMargins", void 0);
2530
+ ], BaseDataCaptureView.prototype, "_scanAreaMargins", undefined);
2531
+ __decorate([
2532
+ ignoreFromSerializationIfNull
2533
+ ], BaseDataCaptureView.prototype, "viewId", undefined);
2464
2534
  __decorate([
2465
2535
  nameForSerialization('pointOfInterest')
2466
- ], BaseDataCaptureView.prototype, "_pointOfInterest", void 0);
2536
+ ], BaseDataCaptureView.prototype, "_pointOfInterest", undefined);
2467
2537
  __decorate([
2468
2538
  nameForSerialization('logoAnchor')
2469
- ], BaseDataCaptureView.prototype, "_logoAnchor", void 0);
2539
+ ], BaseDataCaptureView.prototype, "_logoAnchor", undefined);
2470
2540
  __decorate([
2471
2541
  nameForSerialization('logoOffset')
2472
- ], BaseDataCaptureView.prototype, "_logoOffset", void 0);
2542
+ ], BaseDataCaptureView.prototype, "_logoOffset", undefined);
2473
2543
  __decorate([
2474
2544
  nameForSerialization('focusGesture')
2475
- ], BaseDataCaptureView.prototype, "_focusGesture", void 0);
2545
+ ], BaseDataCaptureView.prototype, "_focusGesture", undefined);
2476
2546
  __decorate([
2477
2547
  nameForSerialization('zoomGesture')
2478
- ], BaseDataCaptureView.prototype, "_zoomGesture", void 0);
2548
+ ], BaseDataCaptureView.prototype, "_zoomGesture", undefined);
2479
2549
  __decorate([
2480
2550
  nameForSerialization('logoStyle')
2481
- ], BaseDataCaptureView.prototype, "_logoStyle", void 0);
2551
+ ], BaseDataCaptureView.prototype, "_logoStyle", undefined);
2482
2552
  __decorate([
2483
2553
  ignoreFromSerialization
2484
- ], BaseDataCaptureView.prototype, "controller", void 0);
2554
+ ], BaseDataCaptureView.prototype, "controller", undefined);
2485
2555
  __decorate([
2486
2556
  ignoreFromSerialization
2487
- ], BaseDataCaptureView.prototype, "listeners", void 0);
2557
+ ], BaseDataCaptureView.prototype, "listeners", undefined);
2488
2558
  __decorate([
2489
2559
  ignoreFromSerialization
2490
- ], BaseDataCaptureView.prototype, "isViewCreated", void 0);
2560
+ ], BaseDataCaptureView.prototype, "isViewCreated", undefined);
2491
2561
 
2492
2562
  class ZoomSwitchControl extends DefaultSerializeable {
2493
2563
  constructor() {
@@ -2503,76 +2573,76 @@ class ZoomSwitchControl extends DefaultSerializeable {
2503
2573
  }
2504
2574
  get zoomedOutImage() {
2505
2575
  var _a, _b;
2506
- if (((_a = this.icon.zoomedOut.default) === null || _a === void 0 ? void 0 : _a.isBase64EncodedImage()) == true) {
2507
- return (_b = this.icon.zoomedOut.default) === null || _b === void 0 ? void 0 : _b.data;
2576
+ if (((_a = this.icon.zoomedOut.default) === null || _a === undefined ? undefined : _a.isBase64EncodedImage()) == true) {
2577
+ return (_b = this.icon.zoomedOut.default) === null || _b === undefined ? undefined : _b.data;
2508
2578
  }
2509
2579
  return null;
2510
2580
  }
2511
2581
  set zoomedOutImage(zoomedOutImage) {
2512
2582
  var _a;
2513
2583
  this.icon.zoomedOut.default = ControlImage.fromBase64EncodedImage(zoomedOutImage);
2514
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.controlUpdated();
2584
+ (_a = this.view) === null || _a === undefined ? undefined : _a.controlUpdated();
2515
2585
  }
2516
2586
  get zoomedInImage() {
2517
2587
  var _a, _b;
2518
- if (((_a = this.icon.zoomedIn.default) === null || _a === void 0 ? void 0 : _a.isBase64EncodedImage()) == true) {
2519
- return (_b = this.icon.zoomedIn.default) === null || _b === void 0 ? void 0 : _b.data;
2588
+ if (((_a = this.icon.zoomedIn.default) === null || _a === undefined ? undefined : _a.isBase64EncodedImage()) == true) {
2589
+ return (_b = this.icon.zoomedIn.default) === null || _b === undefined ? undefined : _b.data;
2520
2590
  }
2521
2591
  return null;
2522
2592
  }
2523
2593
  set zoomedInImage(zoomedInImage) {
2524
2594
  var _a;
2525
2595
  this.icon.zoomedIn.default = ControlImage.fromBase64EncodedImage(zoomedInImage);
2526
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.controlUpdated();
2596
+ (_a = this.view) === null || _a === undefined ? undefined : _a.controlUpdated();
2527
2597
  }
2528
2598
  get zoomedInPressedImage() {
2529
2599
  var _a, _b;
2530
- if (((_a = this.icon.zoomedIn.pressed) === null || _a === void 0 ? void 0 : _a.isBase64EncodedImage()) == true) {
2531
- return (_b = this.icon.zoomedIn.pressed) === null || _b === void 0 ? void 0 : _b.data;
2600
+ if (((_a = this.icon.zoomedIn.pressed) === null || _a === undefined ? undefined : _a.isBase64EncodedImage()) == true) {
2601
+ return (_b = this.icon.zoomedIn.pressed) === null || _b === undefined ? undefined : _b.data;
2532
2602
  }
2533
2603
  return null;
2534
2604
  }
2535
2605
  set zoomedInPressedImage(zoomedInPressedImage) {
2536
2606
  var _a;
2537
2607
  this.icon.zoomedIn.pressed = ControlImage.fromBase64EncodedImage(zoomedInPressedImage);
2538
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.controlUpdated();
2608
+ (_a = this.view) === null || _a === undefined ? undefined : _a.controlUpdated();
2539
2609
  }
2540
2610
  get zoomedOutPressedImage() {
2541
2611
  var _a, _b;
2542
- if (((_a = this.icon.zoomedOut.pressed) === null || _a === void 0 ? void 0 : _a.isBase64EncodedImage()) == true) {
2543
- return (_b = this.icon.zoomedOut.pressed) === null || _b === void 0 ? void 0 : _b.data;
2612
+ if (((_a = this.icon.zoomedOut.pressed) === null || _a === undefined ? undefined : _a.isBase64EncodedImage()) == true) {
2613
+ return (_b = this.icon.zoomedOut.pressed) === null || _b === undefined ? undefined : _b.data;
2544
2614
  }
2545
2615
  return null;
2546
2616
  }
2547
2617
  set zoomedOutPressedImage(zoomedOutPressedImage) {
2548
2618
  var _a;
2549
2619
  this.icon.zoomedOut.pressed = ControlImage.fromBase64EncodedImage(zoomedOutPressedImage);
2550
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.controlUpdated();
2620
+ (_a = this.view) === null || _a === undefined ? undefined : _a.controlUpdated();
2551
2621
  }
2552
2622
  setZoomedInImage(resource) {
2553
2623
  var _a;
2554
2624
  this.icon.zoomedIn.default = ControlImage.fromResourceName(resource);
2555
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.controlUpdated();
2625
+ (_a = this.view) === null || _a === undefined ? undefined : _a.controlUpdated();
2556
2626
  }
2557
2627
  setZoomedInPressedImage(resource) {
2558
2628
  var _a;
2559
2629
  this.icon.zoomedIn.pressed = ControlImage.fromResourceName(resource);
2560
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.controlUpdated();
2630
+ (_a = this.view) === null || _a === undefined ? undefined : _a.controlUpdated();
2561
2631
  }
2562
2632
  setZoomedOutImage(resource) {
2563
2633
  var _a;
2564
2634
  this.icon.zoomedOut.default = ControlImage.fromResourceName(resource);
2565
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.controlUpdated();
2635
+ (_a = this.view) === null || _a === undefined ? undefined : _a.controlUpdated();
2566
2636
  }
2567
2637
  setZoomedOutPressedImage(resource) {
2568
2638
  var _a;
2569
2639
  this.icon.zoomedOut.pressed = ControlImage.fromResourceName(resource);
2570
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.controlUpdated();
2640
+ (_a = this.view) === null || _a === undefined ? undefined : _a.controlUpdated();
2571
2641
  }
2572
2642
  }
2573
2643
  __decorate([
2574
2644
  ignoreFromSerialization
2575
- ], ZoomSwitchControl.prototype, "view", void 0);
2645
+ ], ZoomSwitchControl.prototype, "view", undefined);
2576
2646
 
2577
2647
  class TorchSwitchControl extends DefaultSerializeable {
2578
2648
  constructor() {
@@ -2588,66 +2658,66 @@ class TorchSwitchControl extends DefaultSerializeable {
2588
2658
  }
2589
2659
  get torchOffImage() {
2590
2660
  var _a, _b;
2591
- if (((_a = this.icon.off.default) === null || _a === void 0 ? void 0 : _a.isBase64EncodedImage()) == true) {
2592
- return (_b = this.icon.off.default) === null || _b === void 0 ? void 0 : _b.data;
2661
+ if (((_a = this.icon.off.default) === null || _a === undefined ? undefined : _a.isBase64EncodedImage()) == true) {
2662
+ return (_b = this.icon.off.default) === null || _b === undefined ? undefined : _b.data;
2593
2663
  }
2594
2664
  return null;
2595
2665
  }
2596
2666
  set torchOffImage(torchOffImage) {
2597
2667
  var _a;
2598
2668
  this.icon.off.default = ControlImage.fromBase64EncodedImage(torchOffImage);
2599
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.controlUpdated();
2669
+ (_a = this.view) === null || _a === undefined ? undefined : _a.controlUpdated();
2600
2670
  }
2601
2671
  get torchOffPressedImage() {
2602
2672
  var _a, _b;
2603
- if (((_a = this.icon.off.pressed) === null || _a === void 0 ? void 0 : _a.isBase64EncodedImage()) == true) {
2604
- return (_b = this.icon.off.pressed) === null || _b === void 0 ? void 0 : _b.data;
2673
+ if (((_a = this.icon.off.pressed) === null || _a === undefined ? undefined : _a.isBase64EncodedImage()) == true) {
2674
+ return (_b = this.icon.off.pressed) === null || _b === undefined ? undefined : _b.data;
2605
2675
  }
2606
2676
  return null;
2607
2677
  }
2608
2678
  set torchOffPressedImage(torchOffPressedImage) {
2609
2679
  var _a;
2610
2680
  this.icon.off.pressed = ControlImage.fromBase64EncodedImage(torchOffPressedImage);
2611
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.controlUpdated();
2681
+ (_a = this.view) === null || _a === undefined ? undefined : _a.controlUpdated();
2612
2682
  }
2613
2683
  get torchOnImage() {
2614
2684
  var _a, _b;
2615
- if (((_a = this.icon.on.default) === null || _a === void 0 ? void 0 : _a.isBase64EncodedImage()) == true) {
2616
- return (_b = this.icon.on.default) === null || _b === void 0 ? void 0 : _b.data;
2685
+ if (((_a = this.icon.on.default) === null || _a === undefined ? undefined : _a.isBase64EncodedImage()) == true) {
2686
+ return (_b = this.icon.on.default) === null || _b === undefined ? undefined : _b.data;
2617
2687
  }
2618
2688
  return null;
2619
2689
  }
2620
2690
  set torchOnImage(torchOnImage) {
2621
2691
  var _a;
2622
2692
  this.icon.on.default = ControlImage.fromBase64EncodedImage(torchOnImage);
2623
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.controlUpdated();
2693
+ (_a = this.view) === null || _a === undefined ? undefined : _a.controlUpdated();
2624
2694
  }
2625
2695
  get torchOnPressedImage() {
2626
2696
  var _a, _b;
2627
- if (((_a = this.icon.on.pressed) === null || _a === void 0 ? void 0 : _a.isBase64EncodedImage()) == true) {
2628
- return (_b = this.icon.on.pressed) === null || _b === void 0 ? void 0 : _b.data;
2697
+ if (((_a = this.icon.on.pressed) === null || _a === undefined ? undefined : _a.isBase64EncodedImage()) == true) {
2698
+ return (_b = this.icon.on.pressed) === null || _b === undefined ? undefined : _b.data;
2629
2699
  }
2630
2700
  return null;
2631
2701
  }
2632
2702
  setTorchOffImage(resource) {
2633
2703
  var _a;
2634
2704
  this.icon.off.default = ControlImage.fromResourceName(resource);
2635
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.controlUpdated();
2705
+ (_a = this.view) === null || _a === undefined ? undefined : _a.controlUpdated();
2636
2706
  }
2637
2707
  setTorchOffPressedImage(resource) {
2638
2708
  var _a;
2639
2709
  this.icon.off.pressed = ControlImage.fromResourceName(resource);
2640
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.controlUpdated();
2710
+ (_a = this.view) === null || _a === undefined ? undefined : _a.controlUpdated();
2641
2711
  }
2642
2712
  setTorchOnImage(resource) {
2643
2713
  var _a;
2644
2714
  this.icon.on.default = ControlImage.fromResourceName(resource);
2645
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.controlUpdated();
2715
+ (_a = this.view) === null || _a === undefined ? undefined : _a.controlUpdated();
2646
2716
  }
2647
2717
  setTorchOnPressedImage(resource) {
2648
2718
  var _a;
2649
2719
  this.icon.on.pressed = ControlImage.fromResourceName(resource);
2650
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.controlUpdated();
2720
+ (_a = this.view) === null || _a === undefined ? undefined : _a.controlUpdated();
2651
2721
  }
2652
2722
  setImageResource(resource) {
2653
2723
  var _a;
@@ -2655,17 +2725,17 @@ class TorchSwitchControl extends DefaultSerializeable {
2655
2725
  this.icon.off.pressed = ControlImage.fromResourceName(resource);
2656
2726
  this.icon.on.default = ControlImage.fromResourceName(resource);
2657
2727
  this.icon.on.pressed = ControlImage.fromResourceName(resource);
2658
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.controlUpdated();
2728
+ (_a = this.view) === null || _a === undefined ? undefined : _a.controlUpdated();
2659
2729
  }
2660
2730
  set torchOnPressedImage(torchOnPressedImage) {
2661
2731
  var _a;
2662
2732
  this.icon.on.pressed = ControlImage.fromBase64EncodedImage(torchOnPressedImage);
2663
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.controlUpdated();
2733
+ (_a = this.view) === null || _a === undefined ? undefined : _a.controlUpdated();
2664
2734
  }
2665
2735
  }
2666
2736
  __decorate([
2667
2737
  ignoreFromSerialization
2668
- ], TorchSwitchControl.prototype, "view", void 0);
2738
+ ], TorchSwitchControl.prototype, "view", undefined);
2669
2739
 
2670
2740
  var VideoResolution;
2671
2741
  (function (VideoResolution) {
@@ -2780,7 +2850,7 @@ class CameraSettings extends DefaultSerializeable {
2780
2850
  }
2781
2851
  __decorate([
2782
2852
  ignoreFromSerialization
2783
- ], CameraSettings.prototype, "focusHiddenProperties", void 0);
2853
+ ], CameraSettings.prototype, "focusHiddenProperties", undefined);
2784
2854
 
2785
2855
  const NoViewfinder = { type: 'none' };
2786
2856
 
@@ -2802,7 +2872,7 @@ class RectangularViewfinderAnimation extends DefaultSerializeable {
2802
2872
  }
2803
2873
  __decorate([
2804
2874
  nameForSerialization('isLooping')
2805
- ], RectangularViewfinderAnimation.prototype, "_isLooping", void 0);
2875
+ ], RectangularViewfinderAnimation.prototype, "_isLooping", undefined);
2806
2876
 
2807
2877
  class RectangularViewfinder extends DefaultSerializeable {
2808
2878
  get sizeWithUnitAndAspect() {
@@ -2885,29 +2955,29 @@ class RectangularViewfinder extends DefaultSerializeable {
2885
2955
  }
2886
2956
  __decorate([
2887
2957
  nameForSerialization('style')
2888
- ], RectangularViewfinder.prototype, "_style", void 0);
2958
+ ], RectangularViewfinder.prototype, "_style", undefined);
2889
2959
  __decorate([
2890
2960
  nameForSerialization('lineStyle')
2891
- ], RectangularViewfinder.prototype, "_lineStyle", void 0);
2961
+ ], RectangularViewfinder.prototype, "_lineStyle", undefined);
2892
2962
  __decorate([
2893
2963
  nameForSerialization('dimming')
2894
- ], RectangularViewfinder.prototype, "_dimming", void 0);
2964
+ ], RectangularViewfinder.prototype, "_dimming", undefined);
2895
2965
  __decorate([
2896
2966
  nameForSerialization('disabledDimming')
2897
- ], RectangularViewfinder.prototype, "_disabledDimming", void 0);
2967
+ ], RectangularViewfinder.prototype, "_disabledDimming", undefined);
2898
2968
  __decorate([
2899
2969
  nameForSerialization('animation'),
2900
2970
  ignoreFromSerialization
2901
- ], RectangularViewfinder.prototype, "_animation", void 0);
2971
+ ], RectangularViewfinder.prototype, "_animation", undefined);
2902
2972
  __decorate([
2903
2973
  nameForSerialization('size')
2904
- ], RectangularViewfinder.prototype, "_sizeWithUnitAndAspect", void 0);
2974
+ ], RectangularViewfinder.prototype, "_sizeWithUnitAndAspect", undefined);
2905
2975
  __decorate([
2906
2976
  nameForSerialization('disabledColor')
2907
- ], RectangularViewfinder.prototype, "_disabledColor", void 0);
2977
+ ], RectangularViewfinder.prototype, "_disabledColor", undefined);
2908
2978
  __decorate([
2909
2979
  ignoreFromSerialization
2910
- ], RectangularViewfinder.prototype, "eventEmitter", void 0);
2980
+ ], RectangularViewfinder.prototype, "eventEmitter", undefined);
2911
2981
 
2912
2982
  var RectangularViewfinderStyle;
2913
2983
  (function (RectangularViewfinderStyle) {
@@ -3047,11 +3117,11 @@ class WaveFormVibration extends Vibration {
3047
3117
  }
3048
3118
  __decorate([
3049
3119
  nameForSerialization('timings')
3050
- ], WaveFormVibration.prototype, "_timings", void 0);
3120
+ ], WaveFormVibration.prototype, "_timings", undefined);
3051
3121
  __decorate([
3052
3122
  ignoreFromSerializationIfNull,
3053
3123
  nameForSerialization('amplitudes')
3054
- ], WaveFormVibration.prototype, "_amplitudes", void 0);
3124
+ ], WaveFormVibration.prototype, "_amplitudes", undefined);
3055
3125
 
3056
3126
  class Sound extends DefaultSerializeable {
3057
3127
  static get defaultSound() {
@@ -3068,7 +3138,7 @@ class Sound extends DefaultSerializeable {
3068
3138
  }
3069
3139
  __decorate([
3070
3140
  ignoreFromSerializationIfNull
3071
- ], Sound.prototype, "resource", void 0);
3141
+ ], Sound.prototype, "resource", undefined);
3072
3142
 
3073
3143
  class FeedbackController {
3074
3144
  constructor(feedback) {
@@ -3095,7 +3165,7 @@ class Feedback extends DefaultSerializeable {
3095
3165
  return this._sound;
3096
3166
  }
3097
3167
  static fromJSON(json) {
3098
- return new Feedback((json === null || json === void 0 ? void 0 : json.vibration) ? Vibration.fromJSON(json.vibration) : null, (json === null || json === void 0 ? void 0 : json.sound) ? Sound.fromJSON(json.sound) : null);
3168
+ return new Feedback((json === null || json === undefined ? undefined : json.vibration) ? Vibration.fromJSON(json.vibration) : null, (json === null || json === undefined ? undefined : json.sound) ? Sound.fromJSON(json.sound) : null);
3099
3169
  }
3100
3170
  constructor(vibration, sound) {
3101
3171
  super();
@@ -3115,14 +3185,14 @@ class Feedback extends DefaultSerializeable {
3115
3185
  __decorate([
3116
3186
  ignoreFromSerializationIfNull,
3117
3187
  nameForSerialization('vibration')
3118
- ], Feedback.prototype, "_vibration", void 0);
3188
+ ], Feedback.prototype, "_vibration", undefined);
3119
3189
  __decorate([
3120
3190
  ignoreFromSerializationIfNull,
3121
3191
  nameForSerialization('sound')
3122
- ], Feedback.prototype, "_sound", void 0);
3192
+ ], Feedback.prototype, "_sound", undefined);
3123
3193
  __decorate([
3124
3194
  ignoreFromSerialization
3125
- ], Feedback.prototype, "controller", void 0);
3195
+ ], Feedback.prototype, "controller", undefined);
3126
3196
 
3127
3197
  const NoneLocationSelection = { type: 'none' };
3128
3198
 
@@ -3142,7 +3212,7 @@ class RadiusLocationSelection extends DefaultSerializeable {
3142
3212
  }
3143
3213
  __decorate([
3144
3214
  nameForSerialization('radius')
3145
- ], RadiusLocationSelection.prototype, "_radius", void 0);
3215
+ ], RadiusLocationSelection.prototype, "_radius", undefined);
3146
3216
 
3147
3217
  class RectangularLocationSelection extends DefaultSerializeable {
3148
3218
  constructor() {
@@ -3204,7 +3274,7 @@ class RectangularLocationSelection extends DefaultSerializeable {
3204
3274
  }
3205
3275
  __decorate([
3206
3276
  nameForSerialization('size')
3207
- ], RectangularLocationSelection.prototype, "_sizeWithUnitAndAspect", void 0);
3277
+ ], RectangularLocationSelection.prototype, "_sizeWithUnitAndAspect", undefined);
3208
3278
 
3209
3279
  class LicenseInfo extends DefaultSerializeable {
3210
3280
  get expiration() {
@@ -3214,7 +3284,7 @@ class LicenseInfo extends DefaultSerializeable {
3214
3284
  __decorate([
3215
3285
  nameForSerialization('expiration')
3216
3286
  // @ts-ignore
3217
- ], LicenseInfo.prototype, "_expiration", void 0);
3287
+ ], LicenseInfo.prototype, "_expiration", undefined);
3218
3288
 
3219
3289
  var Expiration;
3220
3290
  (function (Expiration) {
@@ -3225,5 +3295,5 @@ var Expiration;
3225
3295
 
3226
3296
  createEventEmitter();
3227
3297
 
3228
- export { AdvancedNativeProxy, AimerViewfinder, Anchor, BaseController, BaseDataCaptureView, BaseNativeProxy, Brush, Camera, CameraController, CameraPosition, CameraSettings, Color, ContextStatus, ControlImage, DataCaptureContext, DataCaptureContextEvents, DataCaptureContextFeatures, DataCaptureContextSettings, DataCaptureViewController, DataCaptureViewEvents, DefaultSerializeable, Direction, EventDataParser, EventEmitter, Expiration, FactoryMaker, Feedback, FocusGestureStrategy, FocusRange, FontFamily, FrameSourceListenerEvents, FrameSourceState, HTMLElementState, HtmlElementPosition, HtmlElementSize, ImageBuffer, ImageFrameSource, LicenseInfo, LogoStyle, MarginsWithUnit, MeasureUnit, NoViewfinder, NoneLocationSelection, NumberWithUnit, Observable, OpenSourceSoftwareLicenseInfo, Orientation, Point, PointWithUnit, PrivateFocusGestureDeserializer, PrivateFrameData, PrivateZoomGestureDeserializer, Quadrilateral, RadiusLocationSelection, Rect, RectWithUnit, RectangularLocationSelection, RectangularViewfinder, RectangularViewfinderAnimation, RectangularViewfinderLineStyle, RectangularViewfinderStyle, ScanIntention, ScanditIcon, ScanditIconBuilder, ScanditIconShape, ScanditIconType, Size, SizeWithAspect, SizeWithUnit, SizeWithUnitAndAspect, SizingMode, Sound, SwipeToZoom, TapToFocus, TextAlignment, TorchState, TorchSwitchControl, Vibration, VibrationType, VideoResolution, WaveFormVibration, ZoomSwitchControl, createAdvancedNativeProxy, getCoreDefaults, ignoreFromSerialization, ignoreFromSerializationIfNull, loadCoreDefaults, nameForSerialization, serializationDefault };
3298
+ export { AdvancedNativeProxy, AimerViewfinder, Anchor, BaseController, BaseDataCaptureView, BaseNativeProxy, BaseNewController, Brush, Camera, CameraController, CameraPosition, CameraSettings, Color, ContextStatus, ControlImage, DataCaptureContext, DataCaptureContextEvents, DataCaptureContextFeatures, DataCaptureContextSettings, DataCaptureViewController, DataCaptureViewEvents, DefaultSerializeable, Direction, EventDataParser, EventEmitter, Expiration, FactoryMaker, Feedback, FocusGestureStrategy, FocusRange, FontFamily, FrameSourceListenerEvents, FrameSourceState, HTMLElementState, HtmlElementPosition, HtmlElementSize, ImageBuffer, ImageFrameSource, LicenseInfo, LogoStyle, MarginsWithUnit, MeasureUnit, NoViewfinder, NoneLocationSelection, NumberWithUnit, Observable, OpenSourceSoftwareLicenseInfo, Orientation, Point, PointWithUnit, PrivateFocusGestureDeserializer, PrivateFrameData, PrivateZoomGestureDeserializer, Quadrilateral, RadiusLocationSelection, Rect, RectWithUnit, RectangularLocationSelection, RectangularViewfinder, RectangularViewfinderAnimation, RectangularViewfinderLineStyle, RectangularViewfinderStyle, ScanIntention, ScanditIcon, ScanditIconBuilder, ScanditIconShape, ScanditIconType, Size, SizeWithAspect, SizeWithUnit, SizeWithUnitAndAspect, SizingMode, Sound, SwipeToZoom, TapToFocus, TextAlignment, TorchState, TorchSwitchControl, Vibration, VibrationType, VideoResolution, WaveFormVibration, ZoomSwitchControl, createAdvancedNativeFromCtorProxy, createAdvancedNativeProxy, getCoreDefaults, ignoreFromSerialization, ignoreFromSerializationIfNull, loadCoreDefaults, nameForSerialization, serializationDefault };
3229
3299
  //# sourceMappingURL=index.js.map