@tabler/core 1.0.0-beta5 → 1.0.0-beta9

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 (73) hide show
  1. package/README.md +1 -1
  2. package/dist/.DS_Store +0 -0
  3. package/dist/css/demo.css +373 -246
  4. package/dist/css/demo.min.css +5 -5
  5. package/dist/css/demo.rtl.css +373 -246
  6. package/dist/css/demo.rtl.min.css +5 -5
  7. package/dist/css/tabler-flags.css +531 -268
  8. package/dist/css/tabler-flags.min.css +5 -5
  9. package/dist/css/tabler-flags.rtl.css +531 -268
  10. package/dist/css/tabler-flags.rtl.min.css +5 -5
  11. package/dist/css/tabler-payments.css +255 -130
  12. package/dist/css/tabler-payments.min.css +5 -5
  13. package/dist/css/tabler-payments.rtl.css +255 -130
  14. package/dist/css/tabler-payments.rtl.min.css +5 -5
  15. package/dist/css/tabler-vendors.css +731 -409
  16. package/dist/css/tabler-vendors.min.css +5 -5
  17. package/dist/css/tabler-vendors.rtl.css +731 -409
  18. package/dist/css/tabler-vendors.rtl.min.css +5 -5
  19. package/dist/css/tabler.css +12600 -7027
  20. package/dist/css/tabler.min.css +6 -6
  21. package/dist/css/tabler.rtl.css +12616 -7044
  22. package/dist/css/tabler.rtl.min.css +6 -6
  23. package/dist/js/demo.js +7 -7
  24. package/dist/js/demo.min.js +5 -5
  25. package/dist/js/tabler.esm.js +614 -294
  26. package/dist/js/tabler.esm.min.js +5 -5
  27. package/dist/js/tabler.js +615 -295
  28. package/dist/js/tabler.min.js +5 -5
  29. package/dist/libs/apexcharts/dist/apexcharts.min.js +5 -5
  30. package/dist/libs/jsvectormap/dist/js/jsvectormap.min.js +1 -0
  31. package/dist/libs/jsvectormap/dist/maps/world-merc.js +1 -0
  32. package/dist/libs/jsvectormap/dist/maps/world.js +1 -0
  33. package/dist/libs/nouislider/dist/nouislider.min.js +1 -1
  34. package/dist/libs/tom-select/dist/js/tom-select.base.min.js +171 -169
  35. package/package.json +38 -36
  36. package/src/js/demo.js +4 -5
  37. package/src/js/src/tab.js +2 -0
  38. package/src/js/tabler.js +1 -3
  39. package/src/scss/_core.scss +2 -1
  40. package/src/scss/_utilities.scss +0 -21
  41. package/src/scss/_variables.scss +39 -22
  42. package/src/scss/demo/_highlight.scss +0 -1
  43. package/src/scss/demo.scss +2 -2
  44. package/src/scss/fonts/_webfonts.scss +56 -6
  45. package/src/scss/layout/_core.scss +33 -1
  46. package/src/scss/layout/_dark.scss +29 -4
  47. package/src/scss/layout/_navbar.scss +3 -1
  48. package/src/scss/layout/_page.scss +1 -1
  49. package/src/scss/mixins/_functions.scss +16 -2
  50. package/src/scss/mixins/_mixins.scss +6 -6
  51. package/src/scss/tabler-vendors.scss +1 -0
  52. package/src/scss/ui/_avatars.scss +1 -5
  53. package/src/scss/ui/_badges.scss +11 -9
  54. package/src/scss/ui/_breadcrumbs.scss +1 -3
  55. package/src/scss/ui/_buttons.scss +47 -11
  56. package/src/scss/ui/_cards.scss +153 -61
  57. package/src/scss/ui/_dropdowns.scss +1 -0
  58. package/src/scss/ui/_forms.scss +2 -2
  59. package/src/scss/ui/_grid.scss +14 -0
  60. package/src/scss/ui/_icons.scss +6 -0
  61. package/src/scss/ui/_lists.scss +25 -0
  62. package/src/scss/ui/_markdown.scss +1 -0
  63. package/src/scss/ui/_nav.scss +1 -4
  64. package/src/scss/ui/_placeholder.scss +9 -0
  65. package/src/scss/ui/_status.scss +172 -0
  66. package/src/scss/ui/_switch-icon.scss +1 -0
  67. package/src/scss/ui/_type.scss +1 -1
  68. package/src/scss/ui/forms/_form-custom.scss +12 -0
  69. package/src/scss/ui/forms/_validation.scss +1 -1
  70. package/src/scss/utils/_colors.scss +10 -37
  71. package/src/scss/vendor/_jsvectormap.scss +48 -0
  72. package/src/scss/vendor/_litepicker.scss +3 -1
  73. package/src/scss/ui/_skeleton.scss +0 -98
package/dist/js/tabler.js CHANGED
@@ -1,9 +1,9 @@
1
1
  /*!
2
- * Tabler v1.0.0-beta5 (https://tabler.io)
3
- * @version 1.0.0-beta5
2
+ * Tabler v1.0.0-beta9 (https://tabler.io)
3
+ * @version 1.0.0-beta9
4
4
  * @link https://tabler.io
5
- * Copyright 2018-2021 The Tabler Authors
6
- * Copyright 2018-2021 codecalm.net Paweł Kuna
5
+ * Copyright 2018-2022 The Tabler Authors
6
+ * Copyright 2018-2022 codecalm.net Paweł Kuna
7
7
  * Licensed under MIT (https://github.com/tabler/tabler/blob/master/LICENSE)
8
8
  */
9
9
  (function (factory) {
@@ -22,16 +22,11 @@
22
22
 
23
23
  function _typeof(obj) {
24
24
  "@babel/helpers - typeof";
25
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
26
- _typeof = function (obj) {
27
- return typeof obj;
28
- };
29
- } else {
30
- _typeof = function (obj) {
31
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
32
- };
33
- }
34
- return _typeof(obj);
25
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
26
+ return typeof obj;
27
+ } : function (obj) {
28
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
29
+ }, _typeof(obj);
35
30
  }
36
31
  function _classCallCheck(instance, Constructor) {
37
32
  if (!(instance instanceof Constructor)) {
@@ -50,6 +45,9 @@
50
45
  function _createClass(Constructor, protoProps, staticProps) {
51
46
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
52
47
  if (staticProps) _defineProperties(Constructor, staticProps);
48
+ Object.defineProperty(Constructor, "prototype", {
49
+ writable: false
50
+ });
53
51
  return Constructor;
54
52
  }
55
53
  function _defineProperty(obj, key, value) {
@@ -76,6 +74,9 @@
76
74
  configurable: true
77
75
  }
78
76
  });
77
+ Object.defineProperty(subClass, "prototype", {
78
+ writable: false
79
+ });
79
80
  if (superClass) _setPrototypeOf(subClass, superClass);
80
81
  }
81
82
  function _getPrototypeOf(o) {
@@ -164,7 +165,7 @@
164
165
  }
165
166
  return object;
166
167
  }
167
- function _get(target, property, receiver) {
168
+ function _get() {
168
169
  if (typeof Reflect !== "undefined" && Reflect.get) {
169
170
  _get = Reflect.get;
170
171
  } else {
@@ -173,12 +174,12 @@
173
174
  if (!base) return;
174
175
  var desc = Object.getOwnPropertyDescriptor(base, property);
175
176
  if (desc.get) {
176
- return desc.get.call(receiver);
177
+ return desc.get.call(arguments.length < 3 ? target : receiver);
177
178
  }
178
179
  return desc.value;
179
180
  };
180
181
  }
181
- return _get(target, property, receiver || target);
182
+ return _get.apply(this, arguments);
182
183
  }
183
184
  function set(target, property, value, receiver) {
184
185
  if (typeof Reflect !== "undefined" && Reflect.set) {
@@ -265,6 +266,34 @@
265
266
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
266
267
  }
267
268
 
269
+ var ChangeDetails = function () {
270
+ function ChangeDetails(details) {
271
+ _classCallCheck(this, ChangeDetails);
272
+ Object.assign(this, {
273
+ inserted: '',
274
+ rawInserted: '',
275
+ skip: false,
276
+ tailShift: 0
277
+ }, details);
278
+ }
279
+ _createClass(ChangeDetails, [{
280
+ key: "aggregate",
281
+ value: function aggregate(details) {
282
+ this.rawInserted += details.rawInserted;
283
+ this.skip = this.skip || details.skip;
284
+ this.inserted += details.inserted;
285
+ this.tailShift += details.tailShift;
286
+ return this;
287
+ }
288
+ }, {
289
+ key: "offset",
290
+ get: function get() {
291
+ return this.tailShift + this.inserted.length;
292
+ }
293
+ }]);
294
+ return ChangeDetails;
295
+ }();
296
+
268
297
  function isString(str) {
269
298
  return typeof str === 'string' || str instanceof String;
270
299
  }
@@ -288,6 +317,9 @@
288
317
  function escapeRegExp(str) {
289
318
  return str.replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
290
319
  }
320
+ function normalizePrepare(prep) {
321
+ return Array.isArray(prep) ? prep : [prep, new ChangeDetails()];
322
+ }
291
323
  function objectIncludes(b, a) {
292
324
  if (a === b) return true;
293
325
  var arrA = Array.isArray(a),
@@ -375,40 +407,13 @@
375
407
  key: "removeDirection",
376
408
  get: function get() {
377
409
  if (!this.removedCount || this.insertedCount) return DIRECTION.NONE;
378
- return this.oldSelection.end === this.cursorPos || this.oldSelection.start === this.cursorPos ? DIRECTION.RIGHT : DIRECTION.LEFT;
410
+ return (this.oldSelection.end === this.cursorPos || this.oldSelection.start === this.cursorPos) &&
411
+ this.oldSelection.end === this.oldSelection.start ? DIRECTION.RIGHT : DIRECTION.LEFT;
379
412
  }
380
413
  }]);
381
414
  return ActionDetails;
382
415
  }();
383
416
 
384
- var ChangeDetails = function () {
385
- function ChangeDetails(details) {
386
- _classCallCheck(this, ChangeDetails);
387
- Object.assign(this, {
388
- inserted: '',
389
- rawInserted: '',
390
- skip: false,
391
- tailShift: 0
392
- }, details);
393
- }
394
- _createClass(ChangeDetails, [{
395
- key: "aggregate",
396
- value: function aggregate(details) {
397
- this.rawInserted += details.rawInserted;
398
- this.skip = this.skip || details.skip;
399
- this.inserted += details.inserted;
400
- this.tailShift += details.tailShift;
401
- return this;
402
- }
403
- }, {
404
- key: "offset",
405
- get: function get() {
406
- return this.tailShift + this.inserted.length;
407
- }
408
- }]);
409
- return ChangeDetails;
410
- }();
411
-
412
417
  var ContinuousTailDetails = function () {
413
418
  function ContinuousTailDetails() {
414
419
  var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
@@ -449,13 +454,21 @@
449
454
  Object.assign(this, state);
450
455
  }
451
456
  }, {
452
- key: "shiftBefore",
453
- value: function shiftBefore(pos) {
454
- if (this.from >= pos || !this.value.length) return '';
457
+ key: "unshift",
458
+ value: function unshift(beforePos) {
459
+ if (!this.value.length || beforePos != null && this.from >= beforePos) return '';
455
460
  var shiftChar = this.value[0];
456
461
  this.value = this.value.slice(1);
457
462
  return shiftChar;
458
463
  }
464
+ }, {
465
+ key: "shift",
466
+ value: function shift() {
467
+ if (!this.value.length) return '';
468
+ var shiftChar = this.value[this.value.length - 1];
469
+ this.value = this.value.slice(0, -1);
470
+ return shiftChar;
471
+ }
459
472
  }]);
460
473
  return ContinuousTailDetails;
461
474
  }();
@@ -553,6 +566,11 @@
553
566
  get: function get() {
554
567
  return true;
555
568
  }
569
+ }, {
570
+ key: "isFilled",
571
+ get: function get() {
572
+ return this.isComplete;
573
+ }
556
574
  }, {
557
575
  key: "nearestInputPos",
558
576
  value: function nearestInputPos(cursorPos, direction) {
@@ -594,18 +612,30 @@
594
612
  var flags = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
595
613
  var checkTail = arguments.length > 2 ? arguments[2] : undefined;
596
614
  var consistentState = this.state;
597
- var details = this._appendCharRaw(this.doPrepare(ch, flags), flags);
615
+ var details;
616
+ var _normalizePrepare = normalizePrepare(this.doPrepare(ch, flags));
617
+ var _normalizePrepare2 = _slicedToArray(_normalizePrepare, 2);
618
+ ch = _normalizePrepare2[0];
619
+ details = _normalizePrepare2[1];
620
+ details = details.aggregate(this._appendCharRaw(ch, flags));
598
621
  if (details.inserted) {
599
622
  var consistentTail;
600
623
  var appended = this.doValidate(flags) !== false;
601
624
  if (appended && checkTail != null) {
602
625
  var beforeTailState = this.state;
603
- if (this.overwrite) {
626
+ if (this.overwrite === true) {
604
627
  consistentTail = checkTail.state;
605
- checkTail.shiftBefore(this.value.length);
628
+ checkTail.unshift(this.value.length);
606
629
  }
607
630
  var tailDetails = this.appendTail(checkTail);
608
631
  appended = tailDetails.rawInserted === checkTail.toString();
632
+ if (!(appended && tailDetails.inserted) && this.overwrite === 'shift') {
633
+ this.state = beforeTailState;
634
+ consistentTail = checkTail.state;
635
+ checkTail.shift();
636
+ tailDetails = this.appendTail(checkTail);
637
+ appended = tailDetails.rawInserted === checkTail.toString();
638
+ }
609
639
  if (appended && tailDetails.inserted) this.state = beforeTailState;
610
640
  }
611
641
  if (!appended) {
@@ -621,6 +651,11 @@
621
651
  value: function _appendPlaceholder() {
622
652
  return new ChangeDetails();
623
653
  }
654
+ }, {
655
+ key: "_appendEager",
656
+ value: function _appendEager() {
657
+ return new ChangeDetails();
658
+ }
624
659
  }, {
625
660
  key: "append",
626
661
  value: function append(str, flags, tail) {
@@ -634,6 +669,9 @@
634
669
  if (checkTail != null) {
635
670
  details.tailShift += this.appendTail(checkTail).tailShift;
636
671
  }
672
+ if (this.eager && flags !== null && flags !== void 0 && flags.input && str) {
673
+ details.aggregate(this._appendEager());
674
+ }
637
675
  return details;
638
676
  }
639
677
  }, {
@@ -701,13 +739,37 @@
701
739
  value: function splice(start, deleteCount, inserted, removeDirection) {
702
740
  var tailPos = start + deleteCount;
703
741
  var tail = this.extractTail(tailPos);
704
- var startChangePos = this.nearestInputPos(start, removeDirection);
705
- var changeDetails = new ChangeDetails({
742
+ var oldRawValue;
743
+ if (this.eager) {
744
+ removeDirection = forceDirection(removeDirection);
745
+ oldRawValue = this.extractInput(0, tailPos, {
746
+ raw: true
747
+ });
748
+ }
749
+ var startChangePos = this.nearestInputPos(start, deleteCount > 1 && start !== 0 && !this.eager ? DIRECTION.NONE : removeDirection);
750
+ var details = new ChangeDetails({
706
751
  tailShift: startChangePos - start
707
- }).aggregate(this.remove(startChangePos)).aggregate(this.append(inserted, {
752
+ }).aggregate(this.remove(startChangePos));
753
+ if (this.eager && removeDirection !== DIRECTION.NONE && oldRawValue === this.rawInputValue) {
754
+ if (removeDirection === DIRECTION.FORCE_LEFT) {
755
+ var valLength;
756
+ while (oldRawValue === this.rawInputValue && (valLength = this.value.length)) {
757
+ details.aggregate(new ChangeDetails({
758
+ tailShift: -1
759
+ })).aggregate(this.remove(valLength - 1));
760
+ }
761
+ } else if (removeDirection === DIRECTION.FORCE_RIGHT) {
762
+ tail.unshift();
763
+ }
764
+ }
765
+ return details.aggregate(this.append(inserted, {
708
766
  input: true
709
767
  }, tail));
710
- return changeDetails;
768
+ }
769
+ }, {
770
+ key: "maskEquals",
771
+ value: function maskEquals(mask) {
772
+ return this.mask === mask;
711
773
  }
712
774
  }]);
713
775
  return Masked;
@@ -732,8 +794,8 @@
732
794
  if (mask instanceof Number || typeof mask === 'number' || mask === Number) return IMask.MaskedNumber;
733
795
  if (Array.isArray(mask) || mask === Array) return IMask.MaskedDynamic;
734
796
  if (IMask.Masked && mask.prototype instanceof IMask.Masked) return mask;
735
- if (mask instanceof Function) return IMask.MaskedFunction;
736
797
  if (mask instanceof IMask.Masked) return mask.constructor;
798
+ if (mask instanceof Function) return IMask.MaskedFunction;
737
799
  console.warn('Mask not found for mask', mask);
738
800
  return IMask.Masked;
739
801
  }
@@ -767,7 +829,7 @@
767
829
  _createClass(PatternInputDefinition, [{
768
830
  key: "reset",
769
831
  value: function reset() {
770
- this._isFilled = false;
832
+ this.isFilled = false;
771
833
  this.masked.reset();
772
834
  }
773
835
  }, {
@@ -776,7 +838,7 @@
776
838
  var fromPos = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
777
839
  var toPos = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.value.length;
778
840
  if (fromPos === 0 && toPos >= 1) {
779
- this._isFilled = false;
841
+ this.isFilled = false;
780
842
  return this.masked.remove(fromPos, toPos);
781
843
  }
782
844
  return new ChangeDetails();
@@ -784,7 +846,7 @@
784
846
  }, {
785
847
  key: "value",
786
848
  get: function get() {
787
- return this.masked.value || (this._isFilled && !this.isOptional ? this.placeholderChar : '');
849
+ return this.masked.value || (this.isFilled && !this.isOptional ? this.placeholderChar : '');
788
850
  }
789
851
  }, {
790
852
  key: "unmaskedValue",
@@ -798,11 +860,11 @@
798
860
  }
799
861
  }, {
800
862
  key: "_appendChar",
801
- value: function _appendChar(str) {
863
+ value: function _appendChar(ch) {
802
864
  var flags = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
803
- if (this._isFilled) return new ChangeDetails();
865
+ if (this.isFilled) return new ChangeDetails();
804
866
  var state = this.masked.state;
805
- var details = this.masked._appendChar(str, flags);
867
+ var details = this.masked._appendChar(ch, flags);
806
868
  if (details.inserted && this.doValidate(flags) === false) {
807
869
  details.inserted = details.rawInserted = '';
808
870
  this.masked.state = state;
@@ -811,7 +873,7 @@
811
873
  details.inserted = this.placeholderChar;
812
874
  }
813
875
  details.skip = !details.inserted && !this.isOptional;
814
- this._isFilled = Boolean(details.inserted);
876
+ this.isFilled = Boolean(details.inserted);
815
877
  return details;
816
878
  }
817
879
  }, {
@@ -824,11 +886,16 @@
824
886
  key: "_appendPlaceholder",
825
887
  value: function _appendPlaceholder() {
826
888
  var details = new ChangeDetails();
827
- if (this._isFilled || this.isOptional) return details;
828
- this._isFilled = true;
889
+ if (this.isFilled || this.isOptional) return details;
890
+ this.isFilled = true;
829
891
  details.inserted = this.placeholderChar;
830
892
  return details;
831
893
  }
894
+ }, {
895
+ key: "_appendEager",
896
+ value: function _appendEager() {
897
+ return new ChangeDetails();
898
+ }
832
899
  }, {
833
900
  key: "extractTail",
834
901
  value: function extractTail() {
@@ -884,12 +951,12 @@
884
951
  get: function get() {
885
952
  return {
886
953
  masked: this.masked.state,
887
- _isFilled: this._isFilled
954
+ isFilled: this.isFilled
888
955
  };
889
956
  },
890
957
  set: function set(state) {
891
958
  this.masked.state = state.masked;
892
- this._isFilled = state._isFilled;
959
+ this.isFilled = state.isFilled;
893
960
  }
894
961
  }]);
895
962
  return PatternInputDefinition;
@@ -900,6 +967,7 @@
900
967
  _classCallCheck(this, PatternFixedDefinition);
901
968
  Object.assign(this, opts);
902
969
  this._value = '';
970
+ this.isFixed = true;
903
971
  }
904
972
  _createClass(PatternFixedDefinition, [{
905
973
  key: "value",
@@ -956,19 +1024,29 @@
956
1024
  get: function get() {
957
1025
  return true;
958
1026
  }
1027
+ }, {
1028
+ key: "isFilled",
1029
+ get: function get() {
1030
+ return Boolean(this._value);
1031
+ }
959
1032
  }, {
960
1033
  key: "_appendChar",
961
- value: function _appendChar(str) {
1034
+ value: function _appendChar(ch) {
962
1035
  var flags = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
963
1036
  var details = new ChangeDetails();
964
1037
  if (this._value) return details;
965
- var appended = this.char === str[0];
966
- var isResolved = appended && (this.isUnmasking || flags.input || flags.raw) && !flags.tail;
1038
+ var appended = this.char === ch;
1039
+ var isResolved = appended && (this.isUnmasking || flags.input || flags.raw) && !this.eager && !flags.tail;
967
1040
  if (isResolved) details.rawInserted = this.char;
968
1041
  this._value = details.inserted = this.char;
969
1042
  this._isRawInput = isResolved && (flags.raw || flags.input);
970
1043
  return details;
971
1044
  }
1045
+ }, {
1046
+ key: "_appendEager",
1047
+ value: function _appendEager() {
1048
+ return this._appendChar(this.char);
1049
+ }
972
1050
  }, {
973
1051
  key: "_appendPlaceholder",
974
1052
  value: function _appendPlaceholder() {
@@ -992,7 +1070,7 @@
992
1070
  }, {
993
1071
  key: "append",
994
1072
  value: function append(str, flags, tail) {
995
- var details = this._appendChar(str, flags);
1073
+ var details = this._appendChar(str[0], flags);
996
1074
  if (tail != null) {
997
1075
  details.tailShift += this.appendTail(tail).tailShift;
998
1076
  }
@@ -1036,7 +1114,8 @@
1036
1114
  if (!String(tailChunk)) return;
1037
1115
  if (isString(tailChunk)) tailChunk = new ContinuousTailDetails(String(tailChunk));
1038
1116
  var lastChunk = this.chunks[this.chunks.length - 1];
1039
- var extendLast = lastChunk && (lastChunk.stop === tailChunk.stop || tailChunk.stop == null) &&
1117
+ var extendLast = lastChunk && (
1118
+ lastChunk.stop === tailChunk.stop || tailChunk.stop == null) &&
1040
1119
  tailChunk.from === lastChunk.from + lastChunk.toString().length;
1041
1120
  if (tailChunk instanceof ContinuousTailDetails) {
1042
1121
  if (extendLast) {
@@ -1072,7 +1151,8 @@
1072
1151
  var lastBlockIter = masked._mapPosToBlock(masked.value.length);
1073
1152
  var stop = chunk.stop;
1074
1153
  var chunkBlock = void 0;
1075
- if (stop != null && (!lastBlockIter || lastBlockIter.index <= stop)) {
1154
+ if (stop != null && (
1155
+ !lastBlockIter || lastBlockIter.index <= stop)) {
1076
1156
  if (chunk instanceof ChunksTailDetails ||
1077
1157
  masked._stops.indexOf(stop) >= 0) {
1078
1158
  details.aggregate(masked._appendPlaceholder(stop));
@@ -1119,14 +1199,14 @@
1119
1199
  });
1120
1200
  }
1121
1201
  }, {
1122
- key: "shiftBefore",
1123
- value: function shiftBefore(pos) {
1124
- if (this.from >= pos || !this.chunks.length) return '';
1125
- var chunkShiftPos = pos - this.from;
1202
+ key: "unshift",
1203
+ value: function unshift(beforePos) {
1204
+ if (!this.chunks.length || beforePos != null && this.from >= beforePos) return '';
1205
+ var chunkShiftPos = beforePos != null ? beforePos - this.from : beforePos;
1126
1206
  var ci = 0;
1127
1207
  while (ci < this.chunks.length) {
1128
1208
  var chunk = this.chunks[ci];
1129
- var shiftChar = chunk.shiftBefore(chunkShiftPos);
1209
+ var shiftChar = chunk.unshift(chunkShiftPos);
1130
1210
  if (chunk.toString()) {
1131
1211
  if (!shiftChar) break;
1132
1212
  ++ci;
@@ -1137,10 +1217,178 @@
1137
1217
  }
1138
1218
  return '';
1139
1219
  }
1220
+ }, {
1221
+ key: "shift",
1222
+ value: function shift() {
1223
+ if (!this.chunks.length) return '';
1224
+ var ci = this.chunks.length - 1;
1225
+ while (0 <= ci) {
1226
+ var chunk = this.chunks[ci];
1227
+ var shiftChar = chunk.shift();
1228
+ if (chunk.toString()) {
1229
+ if (!shiftChar) break;
1230
+ --ci;
1231
+ } else {
1232
+ this.chunks.splice(ci, 1);
1233
+ }
1234
+ if (shiftChar) return shiftChar;
1235
+ }
1236
+ return '';
1237
+ }
1140
1238
  }]);
1141
1239
  return ChunksTailDetails;
1142
1240
  }();
1143
1241
 
1242
+ var PatternCursor = function () {
1243
+ function PatternCursor(masked, pos) {
1244
+ _classCallCheck(this, PatternCursor);
1245
+ this.masked = masked;
1246
+ this._log = [];
1247
+ var _ref = masked._mapPosToBlock(pos) || (pos < 0 ?
1248
+ {
1249
+ index: 0,
1250
+ offset: 0
1251
+ } :
1252
+ {
1253
+ index: this.masked._blocks.length,
1254
+ offset: 0
1255
+ }),
1256
+ offset = _ref.offset,
1257
+ index = _ref.index;
1258
+ this.offset = offset;
1259
+ this.index = index;
1260
+ this.ok = false;
1261
+ }
1262
+ _createClass(PatternCursor, [{
1263
+ key: "block",
1264
+ get: function get() {
1265
+ return this.masked._blocks[this.index];
1266
+ }
1267
+ }, {
1268
+ key: "pos",
1269
+ get: function get() {
1270
+ return this.masked._blockStartPos(this.index) + this.offset;
1271
+ }
1272
+ }, {
1273
+ key: "state",
1274
+ get: function get() {
1275
+ return {
1276
+ index: this.index,
1277
+ offset: this.offset,
1278
+ ok: this.ok
1279
+ };
1280
+ },
1281
+ set: function set(s) {
1282
+ Object.assign(this, s);
1283
+ }
1284
+ }, {
1285
+ key: "pushState",
1286
+ value: function pushState() {
1287
+ this._log.push(this.state);
1288
+ }
1289
+ }, {
1290
+ key: "popState",
1291
+ value: function popState() {
1292
+ var s = this._log.pop();
1293
+ this.state = s;
1294
+ return s;
1295
+ }
1296
+ }, {
1297
+ key: "bindBlock",
1298
+ value: function bindBlock() {
1299
+ if (this.block) return;
1300
+ if (this.index < 0) {
1301
+ this.index = 0;
1302
+ this.offset = 0;
1303
+ }
1304
+ if (this.index >= this.masked._blocks.length) {
1305
+ this.index = this.masked._blocks.length - 1;
1306
+ this.offset = this.block.value.length;
1307
+ }
1308
+ }
1309
+ }, {
1310
+ key: "_pushLeft",
1311
+ value: function _pushLeft(fn) {
1312
+ this.pushState();
1313
+ for (this.bindBlock(); 0 <= this.index; --this.index, this.offset = ((_this$block = this.block) === null || _this$block === void 0 ? void 0 : _this$block.value.length) || 0) {
1314
+ var _this$block;
1315
+ if (fn()) return this.ok = true;
1316
+ }
1317
+ return this.ok = false;
1318
+ }
1319
+ }, {
1320
+ key: "_pushRight",
1321
+ value: function _pushRight(fn) {
1322
+ this.pushState();
1323
+ for (this.bindBlock(); this.index < this.masked._blocks.length; ++this.index, this.offset = 0) {
1324
+ if (fn()) return this.ok = true;
1325
+ }
1326
+ return this.ok = false;
1327
+ }
1328
+ }, {
1329
+ key: "pushLeftBeforeFilled",
1330
+ value: function pushLeftBeforeFilled() {
1331
+ var _this = this;
1332
+ return this._pushLeft(function () {
1333
+ if (_this.block.isFixed || !_this.block.value) return;
1334
+ _this.offset = _this.block.nearestInputPos(_this.offset, DIRECTION.FORCE_LEFT);
1335
+ if (_this.offset !== 0) return true;
1336
+ });
1337
+ }
1338
+ }, {
1339
+ key: "pushLeftBeforeInput",
1340
+ value: function pushLeftBeforeInput() {
1341
+ var _this2 = this;
1342
+ return this._pushLeft(function () {
1343
+ if (_this2.block.isFixed) return;
1344
+ _this2.offset = _this2.block.nearestInputPos(_this2.offset, DIRECTION.LEFT);
1345
+ return true;
1346
+ });
1347
+ }
1348
+ }, {
1349
+ key: "pushLeftBeforeRequired",
1350
+ value: function pushLeftBeforeRequired() {
1351
+ var _this3 = this;
1352
+ return this._pushLeft(function () {
1353
+ if (_this3.block.isFixed || _this3.block.isOptional && !_this3.block.value) return;
1354
+ _this3.offset = _this3.block.nearestInputPos(_this3.offset, DIRECTION.LEFT);
1355
+ return true;
1356
+ });
1357
+ }
1358
+ }, {
1359
+ key: "pushRightBeforeFilled",
1360
+ value: function pushRightBeforeFilled() {
1361
+ var _this4 = this;
1362
+ return this._pushRight(function () {
1363
+ if (_this4.block.isFixed || !_this4.block.value) return;
1364
+ _this4.offset = _this4.block.nearestInputPos(_this4.offset, DIRECTION.FORCE_RIGHT);
1365
+ if (_this4.offset !== _this4.block.value.length) return true;
1366
+ });
1367
+ }
1368
+ }, {
1369
+ key: "pushRightBeforeInput",
1370
+ value: function pushRightBeforeInput() {
1371
+ var _this5 = this;
1372
+ return this._pushRight(function () {
1373
+ if (_this5.block.isFixed) return;
1374
+ _this5.offset = _this5.block.nearestInputPos(_this5.offset, DIRECTION.NONE);
1375
+ return true;
1376
+ });
1377
+ }
1378
+ }, {
1379
+ key: "pushRightBeforeRequired",
1380
+ value: function pushRightBeforeRequired() {
1381
+ var _this6 = this;
1382
+ return this._pushRight(function () {
1383
+ if (_this6.block.isFixed || _this6.block.isOptional && !_this6.block.value) return;
1384
+ _this6.offset = _this6.block.nearestInputPos(_this6.offset, DIRECTION.NONE);
1385
+ return true;
1386
+ });
1387
+ }
1388
+ }]);
1389
+ return PatternCursor;
1390
+ }();
1391
+
1144
1392
  var MaskedRegExp = function (_Masked) {
1145
1393
  _inherits(MaskedRegExp, _Masked);
1146
1394
  var _super = _createSuper(MaskedRegExp);
@@ -1207,6 +1455,7 @@
1207
1455
  var maskedBlock = createMask(Object.assign({
1208
1456
  parent: _this,
1209
1457
  lazy: _this.lazy,
1458
+ eager: _this.eager,
1210
1459
  placeholderChar: _this.placeholderChar,
1211
1460
  overwrite: _this.overwrite
1212
1461
  }, _this.blocks[bName]));
@@ -1222,7 +1471,7 @@
1222
1471
  if (_ret === "continue") continue;
1223
1472
  }
1224
1473
  var char = pattern[i];
1225
- var _isInput = (char in defs);
1474
+ var isInput = (char in defs);
1226
1475
  if (char === MaskedPattern.STOP_CHAR) {
1227
1476
  this._stops.push(this._blocks.length);
1228
1477
  continue;
@@ -1239,16 +1488,18 @@
1239
1488
  ++i;
1240
1489
  char = pattern[i];
1241
1490
  if (!char) break;
1242
- _isInput = false;
1491
+ isInput = false;
1243
1492
  }
1244
- var def = _isInput ? new PatternInputDefinition({
1493
+ var def = isInput ? new PatternInputDefinition({
1245
1494
  parent: this,
1246
1495
  lazy: this.lazy,
1496
+ eager: this.eager,
1247
1497
  placeholderChar: this.placeholderChar,
1248
1498
  mask: defs[char],
1249
1499
  isOptional: optionalBlock
1250
1500
  }) : new PatternFixedDefinition({
1251
1501
  char: char,
1502
+ eager: this.eager,
1252
1503
  isUnmasking: unmaskingBlock
1253
1504
  });
1254
1505
  this._blocks.push(def);
@@ -1286,6 +1537,27 @@
1286
1537
  return b.isComplete;
1287
1538
  });
1288
1539
  }
1540
+ }, {
1541
+ key: "isFilled",
1542
+ get: function get() {
1543
+ return this._blocks.every(function (b) {
1544
+ return b.isFilled;
1545
+ });
1546
+ }
1547
+ }, {
1548
+ key: "isFixed",
1549
+ get: function get() {
1550
+ return this._blocks.every(function (b) {
1551
+ return b.isFixed;
1552
+ });
1553
+ }
1554
+ }, {
1555
+ key: "isOptional",
1556
+ get: function get() {
1557
+ return this._blocks.every(function (b) {
1558
+ return b.isOptional;
1559
+ });
1560
+ }
1289
1561
  }, {
1290
1562
  key: "doCommit",
1291
1563
  value: function doCommit() {
@@ -1319,6 +1591,21 @@
1319
1591
  value: function appendTail(tail) {
1320
1592
  return _get(_getPrototypeOf(MaskedPattern.prototype), "appendTail", this).call(this, tail).aggregate(this._appendPlaceholder());
1321
1593
  }
1594
+ }, {
1595
+ key: "_appendEager",
1596
+ value: function _appendEager() {
1597
+ var _this$_mapPosToBlock;
1598
+ var details = new ChangeDetails();
1599
+ var startBlockIndex = (_this$_mapPosToBlock = this._mapPosToBlock(this.value.length)) === null || _this$_mapPosToBlock === void 0 ? void 0 : _this$_mapPosToBlock.index;
1600
+ if (startBlockIndex == null) return details;
1601
+ if (this._blocks[startBlockIndex].isFilled) ++startBlockIndex;
1602
+ for (var bi = startBlockIndex; bi < this._blocks.length; ++bi) {
1603
+ var d = this._blocks[bi]._appendEager();
1604
+ if (!d.inserted) break;
1605
+ details.aggregate(d);
1606
+ }
1607
+ return details;
1608
+ }
1322
1609
  }, {
1323
1610
  key: "_appendCharRaw",
1324
1611
  value: function _appendCharRaw(ch) {
@@ -1327,9 +1614,12 @@
1327
1614
  var details = new ChangeDetails();
1328
1615
  if (!blockIter) return details;
1329
1616
  for (var bi = blockIter.index;; ++bi) {
1617
+ var _flags$_beforeTailSta;
1330
1618
  var _block = this._blocks[bi];
1331
1619
  if (!_block) break;
1332
- var blockDetails = _block._appendChar(ch, flags);
1620
+ var blockDetails = _block._appendChar(ch, Object.assign({}, flags, {
1621
+ _beforeTailState: (_flags$_beforeTailSta = flags._beforeTailState) === null || _flags$_beforeTailSta === void 0 ? void 0 : _flags$_beforeTailSta._blocks[bi]
1622
+ }));
1333
1623
  var skip = blockDetails.skip;
1334
1624
  details.aggregate(blockDetails);
1335
1625
  if (skip || blockDetails.rawInserted) break;
@@ -1454,136 +1744,49 @@
1454
1744
  key: "nearestInputPos",
1455
1745
  value: function nearestInputPos(cursorPos) {
1456
1746
  var direction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DIRECTION.NONE;
1457
- var beginBlockData = this._mapPosToBlock(cursorPos) || {
1458
- index: 0,
1459
- offset: 0
1460
- };
1461
- var beginBlockOffset = beginBlockData.offset,
1462
- beginBlockIndex = beginBlockData.index;
1463
- var beginBlock = this._blocks[beginBlockIndex];
1464
- if (!beginBlock) return cursorPos;
1465
- var beginBlockCursorPos = beginBlockOffset;
1466
- if (beginBlockCursorPos !== 0 && beginBlockCursorPos < beginBlock.value.length) {
1467
- beginBlockCursorPos = beginBlock.nearestInputPos(beginBlockOffset, forceDirection(direction));
1468
- }
1469
- var cursorAtRight = beginBlockCursorPos === beginBlock.value.length;
1470
- var cursorAtLeft = beginBlockCursorPos === 0;
1471
- if (!cursorAtLeft && !cursorAtRight) return this._blockStartPos(beginBlockIndex) + beginBlockCursorPos;
1472
- var searchBlockIndex = cursorAtRight ? beginBlockIndex + 1 : beginBlockIndex;
1747
+ if (!this._blocks.length) return 0;
1748
+ var cursor = new PatternCursor(this, cursorPos);
1473
1749
  if (direction === DIRECTION.NONE) {
1474
- if (searchBlockIndex > 0) {
1475
- var blockIndexAtLeft = searchBlockIndex - 1;
1476
- var blockAtLeft = this._blocks[blockIndexAtLeft];
1477
- var blockInputPos = blockAtLeft.nearestInputPos(0, DIRECTION.NONE);
1478
- if (!blockAtLeft.value.length || blockInputPos !== blockAtLeft.value.length) {
1479
- return this._blockStartPos(searchBlockIndex);
1480
- }
1481
- }
1482
- var firstInputAtRight = searchBlockIndex;
1483
- for (var bi = firstInputAtRight; bi < this._blocks.length; ++bi) {
1484
- var blockAtRight = this._blocks[bi];
1485
- var _blockInputPos = blockAtRight.nearestInputPos(0, DIRECTION.NONE);
1486
- if (!blockAtRight.value.length || _blockInputPos !== blockAtRight.value.length) {
1487
- return this._blockStartPos(bi) + _blockInputPos;
1488
- }
1489
- }
1490
- for (var _bi = searchBlockIndex - 1; _bi >= 0; --_bi) {
1491
- var _block3 = this._blocks[_bi];
1492
- var _blockInputPos2 = _block3.nearestInputPos(0, DIRECTION.NONE);
1493
- if (!_block3.value.length || _blockInputPos2 !== _block3.value.length) {
1494
- return this._blockStartPos(_bi) + _block3.value.length;
1495
- }
1496
- }
1497
- return cursorPos;
1750
+ if (cursor.pushRightBeforeInput()) return cursor.pos;
1751
+ cursor.popState();
1752
+ if (cursor.pushLeftBeforeInput()) return cursor.pos;
1753
+ return this.value.length;
1498
1754
  }
1499
1755
  if (direction === DIRECTION.LEFT || direction === DIRECTION.FORCE_LEFT) {
1500
- var firstFilledBlockIndexAtRight;
1501
- for (var _bi2 = searchBlockIndex; _bi2 < this._blocks.length; ++_bi2) {
1502
- if (this._blocks[_bi2].value) {
1503
- firstFilledBlockIndexAtRight = _bi2;
1504
- break;
1505
- }
1506
- }
1507
- if (firstFilledBlockIndexAtRight != null) {
1508
- var filledBlock = this._blocks[firstFilledBlockIndexAtRight];
1509
- var _blockInputPos3 = filledBlock.nearestInputPos(0, DIRECTION.RIGHT);
1510
- if (_blockInputPos3 === 0 && filledBlock.unmaskedValue.length) {
1511
- return this._blockStartPos(firstFilledBlockIndexAtRight) + _blockInputPos3;
1512
- }
1513
- }
1514
- var firstFilledInputBlockIndex = -1;
1515
- var firstEmptyInputBlockIndex;
1516
- for (var _bi3 = searchBlockIndex - 1; _bi3 >= 0; --_bi3) {
1517
- var _block4 = this._blocks[_bi3];
1518
- var _blockInputPos4 = _block4.nearestInputPos(_block4.value.length, DIRECTION.FORCE_LEFT);
1519
- if (!_block4.value || _blockInputPos4 !== 0) firstEmptyInputBlockIndex = _bi3;
1520
- if (_blockInputPos4 !== 0) {
1521
- if (_blockInputPos4 !== _block4.value.length) {
1522
- return this._blockStartPos(_bi3) + _blockInputPos4;
1523
- } else {
1524
- firstFilledInputBlockIndex = _bi3;
1525
- break;
1526
- }
1527
- }
1528
- }
1529
1756
  if (direction === DIRECTION.LEFT) {
1530
- for (var _bi4 = firstFilledInputBlockIndex + 1; _bi4 <= Math.min(searchBlockIndex, this._blocks.length - 1); ++_bi4) {
1531
- var _block5 = this._blocks[_bi4];
1532
- var _blockInputPos5 = _block5.nearestInputPos(0, DIRECTION.NONE);
1533
- var blockAlignedPos = this._blockStartPos(_bi4) + _blockInputPos5;
1534
- if (blockAlignedPos > cursorPos) break;
1535
- if (_blockInputPos5 !== _block5.value.length) return blockAlignedPos;
1536
- }
1537
- }
1538
- if (firstFilledInputBlockIndex >= 0) {
1539
- return this._blockStartPos(firstFilledInputBlockIndex) + this._blocks[firstFilledInputBlockIndex].value.length;
1540
- }
1541
- if (direction === DIRECTION.FORCE_LEFT || this.lazy && !this.extractInput() && !isInput(this._blocks[searchBlockIndex])) {
1542
- return 0;
1543
- }
1544
- if (firstEmptyInputBlockIndex != null) {
1545
- return this._blockStartPos(firstEmptyInputBlockIndex);
1757
+ cursor.pushRightBeforeFilled();
1758
+ if (cursor.ok && cursor.pos === cursorPos) return cursorPos;
1759
+ cursor.popState();
1546
1760
  }
1547
- for (var _bi5 = searchBlockIndex; _bi5 < this._blocks.length; ++_bi5) {
1548
- var _block6 = this._blocks[_bi5];
1549
- var _blockInputPos6 = _block6.nearestInputPos(0, DIRECTION.NONE);
1550
- if (!_block6.value.length || _blockInputPos6 !== _block6.value.length) {
1551
- return this._blockStartPos(_bi5) + _blockInputPos6;
1552
- }
1761
+ cursor.pushLeftBeforeInput();
1762
+ cursor.pushLeftBeforeRequired();
1763
+ cursor.pushLeftBeforeFilled();
1764
+ if (direction === DIRECTION.LEFT) {
1765
+ cursor.pushRightBeforeInput();
1766
+ cursor.pushRightBeforeRequired();
1767
+ if (cursor.ok && cursor.pos <= cursorPos) return cursor.pos;
1768
+ cursor.popState();
1769
+ if (cursor.ok && cursor.pos <= cursorPos) return cursor.pos;
1770
+ cursor.popState();
1553
1771
  }
1772
+ if (cursor.ok) return cursor.pos;
1773
+ if (direction === DIRECTION.FORCE_LEFT) return 0;
1774
+ cursor.popState();
1775
+ if (cursor.ok) return cursor.pos;
1776
+ cursor.popState();
1777
+ if (cursor.ok) return cursor.pos;
1554
1778
  return 0;
1555
1779
  }
1556
1780
  if (direction === DIRECTION.RIGHT || direction === DIRECTION.FORCE_RIGHT) {
1557
- var firstInputBlockAlignedIndex;
1558
- var firstInputBlockAlignedPos;
1559
- for (var _bi6 = searchBlockIndex; _bi6 < this._blocks.length; ++_bi6) {
1560
- var _block7 = this._blocks[_bi6];
1561
- var _blockInputPos7 = _block7.nearestInputPos(0, DIRECTION.NONE);
1562
- if (_blockInputPos7 !== _block7.value.length) {
1563
- firstInputBlockAlignedPos = this._blockStartPos(_bi6) + _blockInputPos7;
1564
- firstInputBlockAlignedIndex = _bi6;
1565
- break;
1566
- }
1567
- }
1568
- if (firstInputBlockAlignedIndex != null && firstInputBlockAlignedPos != null) {
1569
- for (var _bi7 = firstInputBlockAlignedIndex; _bi7 < this._blocks.length; ++_bi7) {
1570
- var _block8 = this._blocks[_bi7];
1571
- var _blockInputPos8 = _block8.nearestInputPos(0, DIRECTION.FORCE_RIGHT);
1572
- if (_blockInputPos8 !== _block8.value.length) {
1573
- return this._blockStartPos(_bi7) + _blockInputPos8;
1574
- }
1575
- }
1576
- return direction === DIRECTION.FORCE_RIGHT ? this.value.length : firstInputBlockAlignedPos;
1577
- }
1578
- for (var _bi8 = Math.min(searchBlockIndex, this._blocks.length - 1); _bi8 >= 0; --_bi8) {
1579
- var _block9 = this._blocks[_bi8];
1580
- var _blockInputPos9 = _block9.nearestInputPos(_block9.value.length, DIRECTION.LEFT);
1581
- if (_blockInputPos9 !== 0) {
1582
- var alignedPos = this._blockStartPos(_bi8) + _blockInputPos9;
1583
- if (alignedPos >= cursorPos) return alignedPos;
1584
- break;
1585
- }
1586
- }
1781
+ cursor.pushRightBeforeInput();
1782
+ cursor.pushRightBeforeRequired();
1783
+ if (cursor.pushRightBeforeFilled()) return cursor.pos;
1784
+ if (direction === DIRECTION.FORCE_RIGHT) return this.value.length;
1785
+ cursor.popState();
1786
+ if (cursor.ok) return cursor.pos;
1787
+ cursor.popState();
1788
+ if (cursor.ok) return cursor.pos;
1789
+ return this.nearestInputPos(cursorPos, DIRECTION.LEFT);
1587
1790
  }
1588
1791
  return cursorPos;
1589
1792
  }
@@ -1613,11 +1816,6 @@
1613
1816
  MaskedPattern.ESCAPE_CHAR = '\\';
1614
1817
  MaskedPattern.InputDefinition = PatternInputDefinition;
1615
1818
  MaskedPattern.FixedDefinition = PatternFixedDefinition;
1616
- function isInput(block) {
1617
- if (!block) return false;
1618
- var value = block.value;
1619
- return !value || block.nearestInputPos(0, DIRECTION.NONE) !== value.length;
1620
- }
1621
1819
  IMask.MaskedPattern = MaskedPattern;
1622
1820
 
1623
1821
  var MaskedRange = function (_MaskedPattern) {
@@ -1638,7 +1836,8 @@
1638
1836
  value: function _update(opts) {
1639
1837
  opts = Object.assign({
1640
1838
  to: this.to || 0,
1641
- from: this.from || 0
1839
+ from: this.from || 0,
1840
+ maxLength: this.maxLength || 0
1642
1841
  }, opts);
1643
1842
  var maxLength = String(opts.to).length;
1644
1843
  if (opts.maxLength != null) maxLength = Math.max(maxLength, opts.maxLength);
@@ -1676,23 +1875,30 @@
1676
1875
  }
1677
1876
  }, {
1678
1877
  key: "doPrepare",
1679
- value: function doPrepare(str) {
1878
+ value: function doPrepare(ch) {
1680
1879
  var flags = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1681
- str = _get(_getPrototypeOf(MaskedRange.prototype), "doPrepare", this).call(this, str, flags).replace(/\D/g, '');
1682
- if (!this.autofix) return str;
1880
+ var details;
1881
+ var _normalizePrepare = normalizePrepare(_get(_getPrototypeOf(MaskedRange.prototype), "doPrepare", this).call(this, ch.replace(/\D/g, ''), flags));
1882
+ var _normalizePrepare2 = _slicedToArray(_normalizePrepare, 2);
1883
+ ch = _normalizePrepare2[0];
1884
+ details = _normalizePrepare2[1];
1885
+ if (!this.autofix || !ch) return ch;
1683
1886
  var fromStr = String(this.from).padStart(this.maxLength, '0');
1684
1887
  var toStr = String(this.to).padStart(this.maxLength, '0');
1685
- var val = this.value;
1686
- var prepStr = '';
1687
- for (var ci = 0; ci < str.length; ++ci) {
1688
- var nextVal = val + prepStr + str[ci];
1689
- var _this$boundaries = this.boundaries(nextVal),
1690
- _this$boundaries2 = _slicedToArray(_this$boundaries, 2),
1691
- minstr = _this$boundaries2[0],
1692
- maxstr = _this$boundaries2[1];
1693
- if (Number(maxstr) < this.from) prepStr += fromStr[nextVal.length - 1];else if (Number(minstr) > this.to) prepStr += toStr[nextVal.length - 1];else prepStr += str[ci];
1888
+ var nextVal = this.value + ch;
1889
+ if (nextVal.length > this.maxLength) return '';
1890
+ var _this$boundaries = this.boundaries(nextVal),
1891
+ _this$boundaries2 = _slicedToArray(_this$boundaries, 2),
1892
+ minstr = _this$boundaries2[0],
1893
+ maxstr = _this$boundaries2[1];
1894
+ if (Number(maxstr) < this.from) return fromStr[nextVal.length - 1];
1895
+ if (Number(minstr) > this.to) {
1896
+ if (this.autofix === 'pad' && nextVal.length < this.maxLength) {
1897
+ return ['', details.aggregate(this.append(fromStr[nextVal.length - 1] + ch, flags))];
1898
+ }
1899
+ return toStr[nextVal.length - 1];
1694
1900
  }
1695
- return prepStr;
1901
+ return ch;
1696
1902
  }
1697
1903
  }, {
1698
1904
  key: "doValidate",
@@ -1739,10 +1945,10 @@
1739
1945
  opts.blocks.d.to = opts.max.getDate();
1740
1946
  }
1741
1947
  }
1742
- Object.assign(opts.blocks, blocks);
1948
+ Object.assign(opts.blocks, this.blocks, blocks);
1743
1949
  Object.keys(opts.blocks).forEach(function (bk) {
1744
1950
  var b = opts.blocks[bk];
1745
- if (!('autofix' in b)) b.autofix = opts.autofix;
1951
+ if (!('autofix' in b) && 'autofix' in opts) b.autofix = opts.autofix;
1746
1952
  });
1747
1953
  _get(_getPrototypeOf(MaskedDate.prototype), "_update", this).call(this, opts);
1748
1954
  }
@@ -1777,12 +1983,18 @@
1777
1983
  set: function set(value) {
1778
1984
  _set(_getPrototypeOf(MaskedDate.prototype), "typedValue", value, this, true);
1779
1985
  }
1986
+ }, {
1987
+ key: "maskEquals",
1988
+ value: function maskEquals(mask) {
1989
+ return mask === Date || _get(_getPrototypeOf(MaskedDate.prototype), "maskEquals", this).call(this, mask);
1990
+ }
1780
1991
  }]);
1781
1992
  return MaskedDate;
1782
1993
  }(MaskedPattern);
1783
1994
  MaskedDate.DEFAULTS = {
1784
1995
  pattern: 'd{.}`m{.}`Y',
1785
1996
  format: function format(date) {
1997
+ if (!date) return '';
1786
1998
  var day = String(date.getDate()).padStart(2, '0');
1787
1999
  var month = String(date.getMonth() + 1).padStart(2, '0');
1788
2000
  var year = date.getFullYear();
@@ -1884,7 +2096,8 @@
1884
2096
  _createClass(HTMLMaskElement, [{
1885
2097
  key: "rootElement",
1886
2098
  get: function get() {
1887
- return this.input.getRootNode ? this.input.getRootNode() : document;
2099
+ var _this$input$getRootNo, _this$input$getRootNo2, _this$input;
2100
+ return (_this$input$getRootNo = (_this$input$getRootNo2 = (_this$input = this.input).getRootNode) === null || _this$input$getRootNo2 === void 0 ? void 0 : _this$input$getRootNo2.call(_this$input)) !== null && _this$input$getRootNo !== void 0 ? _this$input$getRootNo : document;
1888
2101
  }
1889
2102
  }, {
1890
2103
  key: "isActive",
@@ -1968,14 +2181,24 @@
1968
2181
  function get() {
1969
2182
  var root = this.rootElement;
1970
2183
  var selection = root.getSelection && root.getSelection();
1971
- return selection && selection.anchorOffset;
2184
+ var anchorOffset = selection && selection.anchorOffset;
2185
+ var focusOffset = selection && selection.focusOffset;
2186
+ if (focusOffset == null || anchorOffset == null || anchorOffset < focusOffset) {
2187
+ return anchorOffset;
2188
+ }
2189
+ return focusOffset;
1972
2190
  }
1973
2191
  }, {
1974
2192
  key: "_unsafeSelectionEnd",
1975
2193
  get: function get() {
1976
2194
  var root = this.rootElement;
1977
2195
  var selection = root.getSelection && root.getSelection();
1978
- return selection && this._unsafeSelectionStart + String(selection).length;
2196
+ var anchorOffset = selection && selection.anchorOffset;
2197
+ var focusOffset = selection && selection.focusOffset;
2198
+ if (focusOffset == null || anchorOffset == null || anchorOffset > focusOffset) {
2199
+ return anchorOffset;
2200
+ }
2201
+ return focusOffset;
1979
2202
  }
1980
2203
  }, {
1981
2204
  key: "_unsafeSelect",
@@ -2047,7 +2270,8 @@
2047
2270
  }, {
2048
2271
  key: "maskEquals",
2049
2272
  value: function maskEquals(mask) {
2050
- return mask == null || mask === this.masked.mask || mask === Date && this.masked instanceof MaskedDate;
2273
+ var _this$masked;
2274
+ return mask == null || ((_this$masked = this.masked) === null || _this$masked === void 0 ? void 0 : _this$masked.maskEquals(mask));
2051
2275
  }
2052
2276
  }, {
2053
2277
  key: "value",
@@ -2125,7 +2349,8 @@
2125
2349
  }
2126
2350
  }, {
2127
2351
  key: "_saveSelection",
2128
- value: function _saveSelection() {
2352
+ value: function
2353
+ _saveSelection() {
2129
2354
  if (this.value !== this.el.value) {
2130
2355
  console.warn('Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly.');
2131
2356
  }
@@ -2198,7 +2423,7 @@
2198
2423
  }, {
2199
2424
  key: "alignCursor",
2200
2425
  value: function alignCursor() {
2201
- this.cursorPos = this.masked.nearestInputPos(this.cursorPos, DIRECTION.LEFT);
2426
+ this.cursorPos = this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos, DIRECTION.LEFT));
2202
2427
  }
2203
2428
  }, {
2204
2429
  key: "alignCursorFriendly",
@@ -2238,6 +2463,7 @@
2238
2463
  var offset = this.masked.splice(details.startChangePos, details.removed.length, details.inserted, details.removeDirection).offset;
2239
2464
  var removeDirection = oldRawValue === this.masked.rawInputValue ? details.removeDirection : DIRECTION.NONE;
2240
2465
  var cursorPos = this.masked.nearestInputPos(details.startChangePos + offset, removeDirection);
2466
+ if (removeDirection !== DIRECTION.NONE) cursorPos = this.masked.nearestInputPos(cursorPos, DIRECTION.NONE);
2241
2467
  this.updateControl();
2242
2468
  this.updateCursor(cursorPos);
2243
2469
  delete this._inputEvent;
@@ -2350,12 +2576,19 @@
2350
2576
  }
2351
2577
  }, {
2352
2578
  key: "doPrepare",
2353
- value: function doPrepare(str) {
2579
+ value: function doPrepare(ch) {
2354
2580
  var _get2;
2581
+ ch = ch.replace(this._mapToRadixRegExp, this.radix);
2582
+ var noSepCh = this._removeThousandsSeparators(ch);
2355
2583
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
2356
2584
  args[_key - 1] = arguments[_key];
2357
2585
  }
2358
- return (_get2 = _get(_getPrototypeOf(MaskedNumber.prototype), "doPrepare", this)).call.apply(_get2, [this, this._removeThousandsSeparators(str.replace(this._mapToRadixRegExp, this.radix))].concat(args));
2586
+ var _normalizePrepare = normalizePrepare((_get2 = _get(_getPrototypeOf(MaskedNumber.prototype), "doPrepare", this)).call.apply(_get2, [this, noSepCh].concat(args))),
2587
+ _normalizePrepare2 = _slicedToArray(_normalizePrepare, 2),
2588
+ prepCh = _normalizePrepare2[0],
2589
+ details = _normalizePrepare2[1];
2590
+ if (ch && !noSepCh) details.skip = true;
2591
+ return [prepCh, details];
2359
2592
  }
2360
2593
  }, {
2361
2594
  key: "_separatorsCount",
@@ -2477,7 +2710,9 @@
2477
2710
  var valid = regexp.test(this._removeThousandsSeparators(this.value));
2478
2711
  if (valid) {
2479
2712
  var number = this.number;
2480
- valid = valid && !isNaN(number) && (this.min == null || this.min >= 0 || this.min <= this.number) && (this.max == null || this.max <= 0 || this.number <= this.max);
2713
+ valid = valid && !isNaN(number) && (
2714
+ this.min == null || this.min >= 0 || this.min <= this.number) && (
2715
+ this.max == null || this.max <= 0 || this.number <= this.max);
2481
2716
  }
2482
2717
  return valid && _get(_getPrototypeOf(MaskedNumber.prototype), "doValidate", this).call(this, flags);
2483
2718
  }
@@ -2492,7 +2727,7 @@
2492
2727
  if (validnum !== number) this.unmaskedValue = String(validnum);
2493
2728
  var formatted = this.value;
2494
2729
  if (this.normalizeZeros) formatted = this._normalizeZeros(formatted);
2495
- if (this.padFractionalZeros) formatted = this._padFractionalZeros(formatted);
2730
+ if (this.padFractionalZeros && this.scale > 0) formatted = this._padFractionalZeros(formatted);
2496
2731
  this._value = formatted;
2497
2732
  }
2498
2733
  _get(_getPrototypeOf(MaskedNumber.prototype), "doCommit", this).call(this);
@@ -2657,6 +2892,15 @@
2657
2892
  }
2658
2893
  return details;
2659
2894
  }
2895
+ }, {
2896
+ key: "_appendEager",
2897
+ value: function _appendEager() {
2898
+ var details = this._applyDispatch.apply(this, arguments);
2899
+ if (this.currentMask) {
2900
+ details.aggregate(this.currentMask._appendEager());
2901
+ }
2902
+ return details;
2903
+ }
2660
2904
  }, {
2661
2905
  key: "doDispatch",
2662
2906
  value: function doDispatch(appended) {
@@ -2675,7 +2919,8 @@
2675
2919
  }, {
2676
2920
  key: "reset",
2677
2921
  value: function reset() {
2678
- if (this.currentMask) this.currentMask.reset();
2922
+ var _this$currentMask2;
2923
+ (_this$currentMask2 = this.currentMask) === null || _this$currentMask2 === void 0 ? void 0 : _this$currentMask2.reset();
2679
2924
  this.compiledMasks.forEach(function (m) {
2680
2925
  return m.reset();
2681
2926
  });
@@ -2713,15 +2958,22 @@
2713
2958
  }, {
2714
2959
  key: "isComplete",
2715
2960
  get: function get() {
2716
- return !!this.currentMask && this.currentMask.isComplete;
2961
+ var _this$currentMask3;
2962
+ return Boolean((_this$currentMask3 = this.currentMask) === null || _this$currentMask3 === void 0 ? void 0 : _this$currentMask3.isComplete);
2963
+ }
2964
+ }, {
2965
+ key: "isFilled",
2966
+ get: function get() {
2967
+ var _this$currentMask4;
2968
+ return Boolean((_this$currentMask4 = this.currentMask) === null || _this$currentMask4 === void 0 ? void 0 : _this$currentMask4.isFilled);
2717
2969
  }
2718
2970
  }, {
2719
2971
  key: "remove",
2720
2972
  value: function remove() {
2721
2973
  var details = new ChangeDetails();
2722
2974
  if (this.currentMask) {
2723
- var _this$currentMask2;
2724
- details.aggregate((_this$currentMask2 = this.currentMask).remove.apply(_this$currentMask2, arguments))
2975
+ var _this$currentMask5;
2976
+ details.aggregate((_this$currentMask5 = this.currentMask).remove.apply(_this$currentMask5, arguments))
2725
2977
  .aggregate(this._applyDispatch());
2726
2978
  }
2727
2979
  return details;
@@ -2755,17 +3007,17 @@
2755
3007
  }, {
2756
3008
  key: "extractInput",
2757
3009
  value: function extractInput() {
2758
- var _this$currentMask3;
2759
- return this.currentMask ? (_this$currentMask3 = this.currentMask).extractInput.apply(_this$currentMask3, arguments) : '';
3010
+ var _this$currentMask6;
3011
+ return this.currentMask ? (_this$currentMask6 = this.currentMask).extractInput.apply(_this$currentMask6, arguments) : '';
2760
3012
  }
2761
3013
  }, {
2762
3014
  key: "extractTail",
2763
3015
  value: function extractTail() {
2764
- var _this$currentMask4, _get3;
3016
+ var _this$currentMask7, _get3;
2765
3017
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
2766
3018
  args[_key2] = arguments[_key2];
2767
3019
  }
2768
- return this.currentMask ? (_this$currentMask4 = this.currentMask).extractTail.apply(_this$currentMask4, args) : (_get3 = _get(_getPrototypeOf(MaskedDynamic.prototype), "extractTail", this)).call.apply(_get3, [this].concat(args));
3020
+ return this.currentMask ? (_this$currentMask7 = this.currentMask).extractTail.apply(_this$currentMask7, args) : (_get3 = _get(_getPrototypeOf(MaskedDynamic.prototype), "extractTail", this)).call.apply(_get3, [this].concat(args));
2769
3021
  }
2770
3022
  }, {
2771
3023
  key: "doCommit",
@@ -2776,11 +3028,11 @@
2776
3028
  }, {
2777
3029
  key: "nearestInputPos",
2778
3030
  value: function nearestInputPos() {
2779
- var _this$currentMask5, _get4;
3031
+ var _this$currentMask8, _get4;
2780
3032
  for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
2781
3033
  args[_key3] = arguments[_key3];
2782
3034
  }
2783
- return this.currentMask ? (_this$currentMask5 = this.currentMask).nearestInputPos.apply(_this$currentMask5, args) : (_get4 = _get(_getPrototypeOf(MaskedDynamic.prototype), "nearestInputPos", this)).call.apply(_get4, [this].concat(args));
3035
+ return this.currentMask ? (_this$currentMask8 = this.currentMask).nearestInputPos.apply(_this$currentMask8, args) : (_get4 = _get(_getPrototypeOf(MaskedDynamic.prototype), "nearestInputPos", this)).call.apply(_get4, [this].concat(args));
2784
3036
  }
2785
3037
  }, {
2786
3038
  key: "overwrite",
@@ -2790,6 +3042,22 @@
2790
3042
  set: function set(overwrite) {
2791
3043
  console.warn('"overwrite" option is not available in dynamic mask, use this option in siblings');
2792
3044
  }
3045
+ }, {
3046
+ key: "eager",
3047
+ get: function get() {
3048
+ return this.currentMask ? this.currentMask.eager : _get(_getPrototypeOf(MaskedDynamic.prototype), "eager", this);
3049
+ },
3050
+ set: function set(eager) {
3051
+ console.warn('"eager" option is not available in dynamic mask, use this option in siblings');
3052
+ }
3053
+ }, {
3054
+ key: "maskEquals",
3055
+ value: function maskEquals(mask) {
3056
+ return Array.isArray(mask) && this.compiledMasks.every(function (m, mi) {
3057
+ var _mask$mi;
3058
+ return m.maskEquals((_mask$mi = mask[mi]) === null || _mask$mi === void 0 ? void 0 : _mask$mi.mask);
3059
+ });
3060
+ }
2793
3061
  }]);
2794
3062
  return MaskedDynamic;
2795
3063
  }(Masked);
@@ -2986,11 +3254,27 @@
2986
3254
  return placement.split('-')[0];
2987
3255
  }
2988
3256
 
2989
- function getBoundingClientRect(element,
2990
- includeScale) {
3257
+ var max = Math.max;
3258
+ var min = Math.min;
3259
+ var round = Math.round;
3260
+
3261
+ function getBoundingClientRect(element, includeScale) {
3262
+ if (includeScale === void 0) {
3263
+ includeScale = false;
3264
+ }
2991
3265
  var rect = element.getBoundingClientRect();
2992
3266
  var scaleX = 1;
2993
3267
  var scaleY = 1;
3268
+ if (isHTMLElement(element) && includeScale) {
3269
+ var offsetHeight = element.offsetHeight;
3270
+ var offsetWidth = element.offsetWidth;
3271
+ if (offsetWidth > 0) {
3272
+ scaleX = round(rect.width) / offsetWidth || 1;
3273
+ }
3274
+ if (offsetHeight > 0) {
3275
+ scaleY = round(rect.height) / offsetHeight || 1;
3276
+ }
3277
+ }
2994
3278
  return {
2995
3279
  width: rect.width / scaleX,
2996
3280
  height: rect.height / scaleY,
@@ -3106,13 +3390,13 @@
3106
3390
  return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
3107
3391
  }
3108
3392
 
3109
- var max = Math.max;
3110
- var min = Math.min;
3111
- var round = Math.round;
3112
-
3113
3393
  function within(min$1, value, max$1) {
3114
3394
  return max(min$1, min(value, max$1));
3115
3395
  }
3396
+ function withinMaxClamp(min, value, max) {
3397
+ var v = within(min, value, max);
3398
+ return v > max ? max : v;
3399
+ }
3116
3400
 
3117
3401
  function getFreshSideObject() {
3118
3402
  return {
@@ -3215,8 +3499,8 @@
3215
3499
  var win = window;
3216
3500
  var dpr = win.devicePixelRatio || 1;
3217
3501
  return {
3218
- x: round(round(x * dpr) / dpr) || 0,
3219
- y: round(round(y * dpr) / dpr) || 0
3502
+ x: round(x * dpr) / dpr || 0,
3503
+ y: round(y * dpr) / dpr || 0
3220
3504
  };
3221
3505
  }
3222
3506
  function mapToStyles(_ref2) {
@@ -3229,12 +3513,21 @@
3229
3513
  position = _ref2.position,
3230
3514
  gpuAcceleration = _ref2.gpuAcceleration,
3231
3515
  adaptive = _ref2.adaptive,
3232
- roundOffsets = _ref2.roundOffsets;
3233
- var _ref3 = roundOffsets === true ? roundOffsetsByDPR(offsets) : typeof roundOffsets === 'function' ? roundOffsets(offsets) : offsets,
3234
- _ref3$x = _ref3.x,
3235
- x = _ref3$x === void 0 ? 0 : _ref3$x,
3236
- _ref3$y = _ref3.y,
3237
- y = _ref3$y === void 0 ? 0 : _ref3$y;
3516
+ roundOffsets = _ref2.roundOffsets,
3517
+ isFixed = _ref2.isFixed;
3518
+ var _offsets$x = offsets.x,
3519
+ x = _offsets$x === void 0 ? 0 : _offsets$x,
3520
+ _offsets$y = offsets.y,
3521
+ y = _offsets$y === void 0 ? 0 : _offsets$y;
3522
+ var _ref3 = typeof roundOffsets === 'function' ? roundOffsets({
3523
+ x: x,
3524
+ y: y
3525
+ }) : {
3526
+ x: x,
3527
+ y: y
3528
+ };
3529
+ x = _ref3.x;
3530
+ y = _ref3.y;
3238
3531
  var hasX = offsets.hasOwnProperty('x');
3239
3532
  var hasY = offsets.hasOwnProperty('y');
3240
3533
  var sideX = left;
@@ -3254,27 +3547,40 @@
3254
3547
  offsetParent = offsetParent;
3255
3548
  if (placement === top || (placement === left || placement === right) && variation === end) {
3256
3549
  sideY = bottom;
3257
- y -= offsetParent[heightProp] - popperRect.height;
3550
+ var offsetY = isFixed && win.visualViewport ? win.visualViewport.height :
3551
+ offsetParent[heightProp];
3552
+ y -= offsetY - popperRect.height;
3258
3553
  y *= gpuAcceleration ? 1 : -1;
3259
3554
  }
3260
3555
  if (placement === left || (placement === top || placement === bottom) && variation === end) {
3261
3556
  sideX = right;
3262
- x -= offsetParent[widthProp] - popperRect.width;
3557
+ var offsetX = isFixed && win.visualViewport ? win.visualViewport.width :
3558
+ offsetParent[widthProp];
3559
+ x -= offsetX - popperRect.width;
3263
3560
  x *= gpuAcceleration ? 1 : -1;
3264
3561
  }
3265
3562
  }
3266
3563
  var commonStyles = Object.assign({
3267
3564
  position: position
3268
3565
  }, adaptive && unsetSides);
3566
+ var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
3567
+ x: x,
3568
+ y: y
3569
+ }) : {
3570
+ x: x,
3571
+ y: y
3572
+ };
3573
+ x = _ref4.x;
3574
+ y = _ref4.y;
3269
3575
  if (gpuAcceleration) {
3270
3576
  var _Object$assign;
3271
3577
  return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
3272
3578
  }
3273
3579
  return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
3274
3580
  }
3275
- function computeStyles(_ref4) {
3276
- var state = _ref4.state,
3277
- options = _ref4.options;
3581
+ function computeStyles(_ref5) {
3582
+ var state = _ref5.state,
3583
+ options = _ref5.options;
3278
3584
  var _options$gpuAccelerat = options.gpuAcceleration,
3279
3585
  gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
3280
3586
  _options$adaptive = options.adaptive,
@@ -3286,7 +3592,8 @@
3286
3592
  variation: getVariation(state.placement),
3287
3593
  popper: state.elements.popper,
3288
3594
  popperRect: state.rects.popper,
3289
- gpuAcceleration: gpuAcceleration
3595
+ gpuAcceleration: gpuAcceleration,
3596
+ isFixed: state.options.strategy === 'fixed'
3290
3597
  };
3291
3598
  if (state.modifiersData.popperOffsets != null) {
3292
3599
  state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
@@ -3491,7 +3798,7 @@
3491
3798
  return rect;
3492
3799
  }
3493
3800
  function getClientRectFromMixedType(element, clippingParent) {
3494
- return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isHTMLElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
3801
+ return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isElement$1(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
3495
3802
  }
3496
3803
  function getClippingParents(element) {
3497
3804
  var clippingParents = listScrollParents(getParentNode(element));
@@ -3934,6 +4241,14 @@
3934
4241
  var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {
3935
4242
  placement: state.placement
3936
4243
  })) : tetherOffset;
4244
+ var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {
4245
+ mainAxis: tetherOffsetValue,
4246
+ altAxis: tetherOffsetValue
4247
+ } : Object.assign({
4248
+ mainAxis: 0,
4249
+ altAxis: 0
4250
+ }, tetherOffsetValue);
4251
+ var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
3937
4252
  var data = {
3938
4253
  x: 0,
3939
4254
  y: 0
@@ -3941,13 +4256,14 @@
3941
4256
  if (!popperOffsets) {
3942
4257
  return;
3943
4258
  }
3944
- if (checkMainAxis || checkAltAxis) {
4259
+ if (checkMainAxis) {
4260
+ var _offsetModifierState$;
3945
4261
  var mainSide = mainAxis === 'y' ? top : left;
3946
4262
  var altSide = mainAxis === 'y' ? bottom : right;
3947
4263
  var len = mainAxis === 'y' ? 'height' : 'width';
3948
4264
  var offset = popperOffsets[mainAxis];
3949
- var min$1 = popperOffsets[mainAxis] + overflow[mainSide];
3950
- var max$1 = popperOffsets[mainAxis] - overflow[altSide];
4265
+ var min$1 = offset + overflow[mainSide];
4266
+ var max$1 = offset - overflow[altSide];
3951
4267
  var additive = tether ? -popperRect[len] / 2 : 0;
3952
4268
  var minLen = variation === start ? referenceRect[len] : popperRect[len];
3953
4269
  var maxLen = variation === start ? -popperRect[len] : -referenceRect[len];
@@ -3960,28 +4276,32 @@
3960
4276
  var arrowPaddingMin = arrowPaddingObject[mainSide];
3961
4277
  var arrowPaddingMax = arrowPaddingObject[altSide];
3962
4278
  var arrowLen = within(0, referenceRect[len], arrowRect[len]);
3963
- var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - tetherOffsetValue : minLen - arrowLen - arrowPaddingMin - tetherOffsetValue;
3964
- var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + tetherOffsetValue : maxLen + arrowLen + arrowPaddingMax + tetherOffsetValue;
4279
+ var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
4280
+ var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
3965
4281
  var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
3966
4282
  var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
3967
- var offsetModifierValue = state.modifiersData.offset ? state.modifiersData.offset[state.placement][mainAxis] : 0;
3968
- var tetherMin = popperOffsets[mainAxis] + minOffset - offsetModifierValue - clientOffset;
3969
- var tetherMax = popperOffsets[mainAxis] + maxOffset - offsetModifierValue;
3970
- if (checkMainAxis) {
3971
- var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1);
3972
- popperOffsets[mainAxis] = preventedOffset;
3973
- data[mainAxis] = preventedOffset - offset;
3974
- }
3975
- if (checkAltAxis) {
3976
- var _mainSide = mainAxis === 'x' ? top : left;
3977
- var _altSide = mainAxis === 'x' ? bottom : right;
3978
- var _offset = popperOffsets[altAxis];
3979
- var _min = _offset + overflow[_mainSide];
3980
- var _max = _offset - overflow[_altSide];
3981
- var _preventedOffset = within(tether ? min(_min, tetherMin) : _min, _offset, tether ? max(_max, tetherMax) : _max);
3982
- popperOffsets[altAxis] = _preventedOffset;
3983
- data[altAxis] = _preventedOffset - _offset;
3984
- }
4283
+ var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
4284
+ var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;
4285
+ var tetherMax = offset + maxOffset - offsetModifierValue;
4286
+ var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1);
4287
+ popperOffsets[mainAxis] = preventedOffset;
4288
+ data[mainAxis] = preventedOffset - offset;
4289
+ }
4290
+ if (checkAltAxis) {
4291
+ var _offsetModifierState$2;
4292
+ var _mainSide = mainAxis === 'x' ? top : left;
4293
+ var _altSide = mainAxis === 'x' ? bottom : right;
4294
+ var _offset = popperOffsets[altAxis];
4295
+ var _len = altAxis === 'y' ? 'height' : 'width';
4296
+ var _min = _offset + overflow[_mainSide];
4297
+ var _max = _offset - overflow[_altSide];
4298
+ var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
4299
+ var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
4300
+ var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
4301
+ var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
4302
+ var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
4303
+ popperOffsets[altAxis] = _preventedOffset;
4304
+ data[altAxis] = _preventedOffset - _offset;
3985
4305
  }
3986
4306
  state.modifiersData[name] = data;
3987
4307
  }
@@ -4010,8 +4330,8 @@
4010
4330
 
4011
4331
  function isElementScaled(element) {
4012
4332
  var rect = element.getBoundingClientRect();
4013
- var scaleX = rect.width / element.offsetWidth || 1;
4014
- var scaleY = rect.height / element.offsetHeight || 1;
4333
+ var scaleX = round(rect.width) / element.offsetWidth || 1;
4334
+ var scaleY = round(rect.height) / element.offsetHeight || 1;
4015
4335
  return scaleX !== 1 || scaleY !== 1;
4016
4336
  }
4017
4337
  function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
@@ -4019,9 +4339,9 @@
4019
4339
  isFixed = false;
4020
4340
  }
4021
4341
  var isOffsetParentAnElement = isHTMLElement(offsetParent);
4022
- isHTMLElement(offsetParent) && isElementScaled(offsetParent);
4342
+ var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
4023
4343
  var documentElement = getDocumentElement(offsetParent);
4024
- var rect = getBoundingClientRect(elementOrVirtualElement);
4344
+ var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled);
4025
4345
  var scroll = {
4026
4346
  scrollLeft: 0,
4027
4347
  scrollTop: 0
@@ -4036,7 +4356,7 @@
4036
4356
  scroll = getNodeScroll(offsetParent);
4037
4357
  }
4038
4358
  if (isHTMLElement(offsetParent)) {
4039
- offsets = getBoundingClientRect(offsetParent);
4359
+ offsets = getBoundingClientRect(offsetParent, true);
4040
4360
  offsets.x += offsetParent.clientLeft;
4041
4361
  offsets.y += offsetParent.clientTop;
4042
4362
  } else if (documentElement) {
@@ -7818,6 +8138,7 @@
7818
8138
  });
7819
8139
  }
7820
8140
  };
8141
+ EnableActivationTabsFromLocationHash();
7821
8142
 
7822
8143
  var toastsTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="toast"]'));
7823
8144
  toastsTriggerList.map(function (toastTriggerEl) {
@@ -7825,6 +8146,5 @@
7825
8146
  });
7826
8147
 
7827
8148
  window.bootstrap = bootstrap;
7828
- EnableActivationTabsFromLocationHash();
7829
8149
 
7830
8150
  }));