@orangelogic/design-system 2.111.0 → 2.113.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (157) hide show
  1. package/library/chunks/asset.HL1qMnhg.js +458 -0
  2. package/library/chunks/{button.i88sSbTZ.js → button.DIvU_uFU.js} +3 -3
  3. package/library/chunks/calendar-grid.CXYoS6VA.js +108 -0
  4. package/library/chunks/{color-swatch-group.mIHaCJsh.js → color-swatch-group.DV5uB8OC.js} +3 -3
  5. package/library/chunks/{color-swatch.D9vkPoV2.js → color-swatch.BoUZGGs4.js} +2 -2
  6. package/library/chunks/{color.vLD2sNTs.js → color.LzSGBy7o.js} +2 -2
  7. package/library/chunks/{confirm-popover.UuBhn8GA.js → confirm-popover.DS9HIy3c.js} +3 -3
  8. package/library/chunks/date-picker.D0SJADN6.js +77 -0
  9. package/library/chunks/{dialog.Bso6gK-8.js → dialog.DyT-Nai2.js} +2 -2
  10. package/library/chunks/{document-viewer.C6eclRvd.js → document-viewer.AiKX3RO6.js} +8 -7
  11. package/library/chunks/{dot-pagination.CNnUuI-Z.js → dot-pagination.CKbL6eN_.js} +1 -1
  12. package/library/chunks/{file-on-demand.Cf2ujTeF.js → file-on-demand.h8tCgq51.js} +10 -10
  13. package/library/chunks/{folder-select.ByNUfTia.js → folder-select.eoufobYO.js} +5 -5
  14. package/library/chunks/{form.Ch1cwYzO.js → form.B-5nQJva.js} +46 -34
  15. package/library/chunks/{header.hj2Kw-N7.js → header.BUp3_oeJ.js} +1 -1
  16. package/library/chunks/{i18n.D6AYDPK-.js → i18n.C21qyGi6.js} +49 -13
  17. package/library/chunks/{icon-button.ztYU-DHy.js → icon-button.DxkJ-cp-.js} +2 -2
  18. package/library/chunks/icon.DnBh6-56.js +111 -0
  19. package/library/chunks/{iframe.uLxZ6LsL.js → iframe.CwxozWMt.js} +1 -1
  20. package/library/chunks/{image.DKB6yEQO.js → image.B-YcKRop.js} +2 -2
  21. package/library/chunks/input.DdeXWD_F.js +2855 -0
  22. package/library/chunks/{list-editor.GT2kQsmR.js → list-editor.Qx2ecTcL.js} +23 -23
  23. package/library/chunks/{option.BAYtHIvG.js → option.CcGRV3jj.js} +2 -2
  24. package/library/chunks/{pagination.CCJD61IB.js → pagination.CgAt4Keg.js} +5 -5
  25. package/library/chunks/{tab-group.BsR8tdVY.js → tab-group.hfUY7YE7.js} +3 -3
  26. package/library/chunks/{table.DL_CEeYh.js → table.CP3oGDY1.js} +2905 -2306
  27. package/library/chunks/{tree.KmZRWZ0F.js → tree.YxFs3Tke.js} +2 -2
  28. package/library/components/alert.js +2 -2
  29. package/library/components/animated-image.js +15 -15
  30. package/library/components/asset-link-format.js +7 -7
  31. package/library/components/atoms.js +194 -180
  32. package/library/components/audio.js +2 -2
  33. package/library/components/avatar.js +1 -1
  34. package/library/components/border-input-group.js +2 -2
  35. package/library/components/breadcrumb.js +4 -4
  36. package/library/components/button.js +4 -4
  37. package/library/components/checkbox.js +2 -2
  38. package/library/components/color-picker.js +5 -5
  39. package/library/components/color-swatch-group.js +4 -4
  40. package/library/components/color-swatch.js +3 -3
  41. package/library/components/confirm-popover.js +4 -4
  42. package/library/components/copy-button.js +2 -2
  43. package/library/components/corner-position-input-group.js +3 -3
  44. package/library/components/date-calendar.d.ts +3 -0
  45. package/library/components/date-calendar.js +107 -0
  46. package/library/components/details.js +12 -12
  47. package/library/components/dialog.js +3 -3
  48. package/library/components/document-viewer.js +4 -4
  49. package/library/components/dot-pagination.js +2 -2
  50. package/library/components/drawer.js +2 -2
  51. package/library/components/dropdown.js +2 -2
  52. package/library/components/dynamic-select.js +4 -4
  53. package/library/components/e-chart.js +1 -1
  54. package/library/components/element-clamp.js +2 -2
  55. package/library/components/faceted-filter.d.ts +3 -0
  56. package/library/components/faceted-filter.js +295 -0
  57. package/library/components/file-on-demand.js +11 -11
  58. package/library/components/folder-select.js +5 -5
  59. package/library/components/format-bytes.js +1 -1
  60. package/library/components/format-date.js +1 -1
  61. package/library/components/format-number.js +1 -1
  62. package/library/components/format-time.js +1 -1
  63. package/library/components/header.js +2 -2
  64. package/library/components/icon-button.js +3 -3
  65. package/library/components/icon.js +10 -109
  66. package/library/components/iframe.js +2 -2
  67. package/library/components/image-comparer.js +2 -2
  68. package/library/components/image.js +3 -3
  69. package/library/components/input.js +19 -2852
  70. package/library/components/line-clamp.js +1 -1
  71. package/library/components/list-editor.js +7 -7
  72. package/library/components/masonry.js +2 -2
  73. package/library/components/menu-item.js +2 -2
  74. package/library/components/menu.js +2 -2
  75. package/library/components/molecules.js +4 -4
  76. package/library/components/option.js +3 -3
  77. package/library/components/organisms.js +2 -2
  78. package/library/components/padding-input-group.js +9 -9
  79. package/library/components/pagination.js +6 -6
  80. package/library/components/popup.js +1 -1
  81. package/library/components/position-picker.js +1 -1
  82. package/library/components/progress-bar.js +1 -1
  83. package/library/components/progress-ring.js +1 -1
  84. package/library/components/radio-group.js +1 -1
  85. package/library/components/radio.js +1 -1
  86. package/library/components/range.js +2 -2
  87. package/library/components/rating.js +6 -6
  88. package/library/components/relative-time.js +1 -1
  89. package/library/components/select.js +5 -5
  90. package/library/components/shadow-input-group.js +5 -5
  91. package/library/components/share-option-list.js +2 -2
  92. package/library/components/sidebar.js +2 -2
  93. package/library/components/size-input-group.js +3 -3
  94. package/library/components/spinner.js +1 -1
  95. package/library/components/split-panel.js +1 -1
  96. package/library/components/step.js +1 -1
  97. package/library/components/stepper-wizard.js +16 -16
  98. package/library/components/switch.js +1 -1
  99. package/library/components/tab-group.js +4 -4
  100. package/library/components/tab.js +2 -2
  101. package/library/components/table.js +5 -5
  102. package/library/components/tag.js +2 -2
  103. package/library/components/textarea.js +1 -1
  104. package/library/components/tooltip.js +1 -1
  105. package/library/components/tree-item.js +3 -3
  106. package/library/components/tree.js +2 -2
  107. package/library/components/typeface.js +2 -2
  108. package/library/components/types.js +25119 -24553
  109. package/library/components/video.js +2 -2
  110. package/library/package.json +1 -1
  111. package/library/packages/atoms/src/components/date-calendar/date-calendar.d.ts +61 -0
  112. package/library/packages/atoms/src/components/date-calendar/date-calendar.styles.d.ts +2 -0
  113. package/library/packages/atoms/src/components/details/details.d.ts +1 -0
  114. package/library/packages/atoms/src/components/faceted-filter/components/facet/facet.d.ts +58 -0
  115. package/library/packages/atoms/src/components/faceted-filter/components/facet/facet.styles.d.ts +2 -0
  116. package/library/packages/atoms/src/components/faceted-filter/faceted-filter.d.ts +71 -0
  117. package/library/packages/atoms/src/components/faceted-filter/faceted-filter.styles.d.ts +2 -0
  118. package/library/packages/atoms/src/components/icon/font-awesome-icons.d.ts +1 -0
  119. package/library/packages/atoms/src/components/icon/icon.d.ts +1 -0
  120. package/library/packages/atoms/src/components/image/image.d.ts +1 -1
  121. package/library/packages/atoms/src/components/table/table-data-loader.d.ts +13 -0
  122. package/library/packages/atoms/src/components/table/table.d.ts +13 -1
  123. package/library/packages/atoms/src/index.d.ts +3 -0
  124. package/library/packages/events/src/cx-date-select.d.ts +9 -0
  125. package/library/packages/events/src/cx-faceted-filter-change.d.ts +8 -0
  126. package/library/packages/events/src/cx-table-data-load.d.ts +17 -0
  127. package/library/packages/events/src/events.d.ts +3 -0
  128. package/library/packages/hybrid/table-core/src/tabulator-tables/modules/ClickableCell/ClickableCell.d.ts +5 -0
  129. package/library/packages/molecules/src/asset-data-display/asset-data-display.d.ts +1 -1
  130. package/library/packages/molecules/src/asset-picker/asset-picker.d.ts +2 -0
  131. package/library/packages/molecules/src/icon-picker/icon-picker.d.ts +72 -9
  132. package/library/packages/molecules/src/index.d.ts +2 -0
  133. package/library/packages/molecules/src/input-date-picker/input-date-picker.d.ts +127 -0
  134. package/library/packages/molecules/src/input-date-picker/input-date-picker.styles.d.ts +2 -0
  135. package/library/packages/molecules/src/input-date-range-picker/input-date-range-picker.d.ts +90 -0
  136. package/library/packages/molecules/src/input-date-range-picker/input-date-range-picker.styles.d.ts +2 -0
  137. package/library/packages/molecules/src/timeline/timeline.d.ts +1 -1
  138. package/library/packages/organisms/src/content-builder/components/config-form/config-form-controller.d.ts +0 -1
  139. package/library/packages/services/src/api/asset/asset.d.ts +3 -3
  140. package/library/packages/tools/src/fetch-asset/fetch-asset.d.ts +2 -2
  141. package/library/packages/tools/src/fetch-image/fetch-image.d.ts +4 -4
  142. package/library/packages/types/src/date-picker.d.ts +45 -0
  143. package/library/packages/types/src/faceted-filter.d.ts +23 -0
  144. package/library/packages/types/src/icon-picker.d.ts +8 -0
  145. package/library/packages/types/src/index.d.ts +1 -1
  146. package/library/packages/types/src/table.d.ts +12 -0
  147. package/library/packages/utils/src/custom-element/form.d.ts +5 -0
  148. package/library/packages/utils/src/custom-element/i18n.d.ts +36 -0
  149. package/library/packages/utils/src/date/calendar-grid.d.ts +40 -0
  150. package/library/packages/utils/src/date/date-range-preset.d.ts +12 -0
  151. package/library/packages/utils/src/date/date.d.ts +42 -0
  152. package/library/packages/utils/src/date/index.d.ts +3 -0
  153. package/library/packages/utils/src/index.d.ts +1 -0
  154. package/library/react-web-component.d.ts +489 -194
  155. package/library/utils.js +539 -332
  156. package/package.json +1 -1
  157. package/library/chunks/asset.NgymQ3Zx.js +0 -454
@@ -1,2854 +1,21 @@
1
- import { n as d, C as rt } from "../chunks/lib-cortex-element.CVMmyPMC.js";
2
- import { c as ut } from "../chunks/component.styles.CRO4Odto.js";
3
- import { f as ot } from "../chunks/form-control.styles.CaGWmeAS.js";
4
- import { c as lt } from "../chunks/custom-element.L4WJXn1j.js";
5
- import { d as ht } from "../chunks/default-value.COZopaet.js";
6
- import { F as pt } from "../chunks/form.Ch1cwYzO.js";
7
- import { L as ct } from "../chunks/i18n.D6AYDPK-.js";
8
- import { H as dt } from "../chunks/slot.j5oheLJC.js";
9
- import { w as V } from "../chunks/watch.CThbualB.js";
10
- import { i as ft, x as E } from "../chunks/lit-element.jLBm65_O.js";
11
- import { r as j } from "../chunks/state.CSDxrqLd.js";
12
- import { e as O } from "../chunks/query.BBf1UFkC.js";
13
- import { e as S } from "../chunks/class-map.BiVq-cVR.js";
14
- import { o as _ } from "../chunks/if-defined.BRoBj_Rp.js";
15
- import { l as mt } from "../chunks/live.SCz6M8Gs.js";
16
- import { n as Y } from "../chunks/when.Dr1es41R.js";
17
- import gt from "./icon.js";
18
- function F(a) {
19
- return typeof a == "string" || a instanceof String;
20
- }
21
- function Z(a) {
22
- var t;
23
- return typeof a == "object" && a != null && (a == null || (t = a.constructor) == null ? void 0 : t.name) === "Object";
24
- }
25
- function W(a, t) {
26
- return Array.isArray(t) ? W(a, (e, i) => t.includes(i)) : Object.entries(a).reduce((e, i) => {
27
- let [s, n] = i;
28
- return t(n, s) && (e[s] = n), e;
29
- }, {});
30
- }
31
- const p = {
32
- NONE: "NONE",
33
- LEFT: "LEFT",
34
- FORCE_LEFT: "FORCE_LEFT",
35
- RIGHT: "RIGHT",
36
- FORCE_RIGHT: "FORCE_RIGHT"
37
- };
38
- function _t(a) {
39
- switch (a) {
40
- case p.LEFT:
41
- return p.FORCE_LEFT;
42
- case p.RIGHT:
43
- return p.FORCE_RIGHT;
44
- default:
45
- return a;
46
- }
47
- }
48
- function P(a) {
49
- return a.replace(/([.*+?^=!:${}()|[\]/\\])/g, "\\$1");
50
- }
51
- function T(a, t) {
52
- if (t === a) return !0;
53
- const e = Array.isArray(t), i = Array.isArray(a);
54
- let s;
55
- if (e && i) {
56
- if (t.length != a.length) return !1;
57
- for (s = 0; s < t.length; s++) if (!T(t[s], a[s])) return !1;
58
- return !0;
59
- }
60
- if (e != i) return !1;
61
- if (t && a && typeof t == "object" && typeof a == "object") {
62
- const n = t instanceof Date, r = a instanceof Date;
63
- if (n && r) return t.getTime() == a.getTime();
64
- if (n != r) return !1;
65
- const u = t instanceof RegExp, l = a instanceof RegExp;
66
- if (u && l) return t.toString() == a.toString();
67
- if (u != l) return !1;
68
- const c = Object.keys(t);
69
- for (s = 0; s < c.length; s++) if (!Object.prototype.hasOwnProperty.call(a, c[s])) return !1;
70
- for (s = 0; s < c.length; s++) if (!T(a[c[s]], t[c[s]])) return !1;
71
- return !0;
72
- } else if (t && a && typeof t == "function" && typeof a == "function")
73
- return t.toString() === a.toString();
74
- return !1;
75
- }
76
- class kt {
77
- /** Current input value */
78
- /** Current cursor position */
79
- /** Old input value */
80
- /** Old selection */
81
- constructor(t) {
82
- for (Object.assign(this, t); this.value.slice(0, this.startChangePos) !== this.oldValue.slice(0, this.startChangePos); )
83
- --this.oldSelection.start;
84
- if (this.insertedCount)
85
- for (; this.value.slice(this.cursorPos) !== this.oldValue.slice(this.oldSelection.end); )
86
- this.value.length - this.cursorPos < this.oldValue.length - this.oldSelection.end ? ++this.oldSelection.end : ++this.cursorPos;
87
- }
88
- /** Start changing position */
89
- get startChangePos() {
90
- return Math.min(this.cursorPos, this.oldSelection.start);
91
- }
92
- /** Inserted symbols count */
93
- get insertedCount() {
94
- return this.cursorPos - this.startChangePos;
95
- }
96
- /** Inserted symbols */
97
- get inserted() {
98
- return this.value.substr(this.startChangePos, this.insertedCount);
99
- }
100
- /** Removed symbols count */
101
- get removedCount() {
102
- return Math.max(this.oldSelection.end - this.startChangePos || // for Delete
103
- this.oldValue.length - this.value.length, 0);
104
- }
105
- /** Removed symbols */
106
- get removed() {
107
- return this.oldValue.substr(this.startChangePos, this.removedCount);
108
- }
109
- /** Unchanged head symbols */
110
- get head() {
111
- return this.value.substring(0, this.startChangePos);
112
- }
113
- /** Unchanged tail symbols */
114
- get tail() {
115
- return this.value.substring(this.startChangePos + this.insertedCount);
116
- }
117
- /** Remove direction */
118
- get removeDirection() {
119
- return !this.removedCount || this.insertedCount ? p.NONE : (this.oldSelection.end === this.cursorPos || this.oldSelection.start === this.cursorPos) && // if not range removed (event with backspace)
120
- this.oldSelection.end === this.oldSelection.start ? p.RIGHT : p.LEFT;
121
- }
122
- }
123
- function f(a, t) {
124
- return new f.InputMask(a, t);
125
- }
126
- function J(a) {
127
- if (a == null) throw new Error("mask property should be defined");
128
- return a instanceof RegExp ? f.MaskedRegExp : F(a) ? f.MaskedPattern : a === Date ? f.MaskedDate : a === Number ? f.MaskedNumber : Array.isArray(a) || a === Array ? f.MaskedDynamic : f.Masked && a.prototype instanceof f.Masked ? a : f.Masked && a instanceof f.Masked ? a.constructor : a instanceof Function ? f.MaskedFunction : (console.warn("Mask not found for mask", a), f.Masked);
129
- }
130
- function I(a) {
131
- if (!a) throw new Error("Options in not defined");
132
- if (f.Masked) {
133
- if (a.prototype instanceof f.Masked) return {
134
- mask: a
135
- };
136
- const {
137
- mask: t = void 0,
138
- ...e
139
- } = a instanceof f.Masked ? {
140
- mask: a
141
- } : Z(a) && a.mask instanceof f.Masked ? a : {};
142
- if (t) {
143
- const i = t.mask;
144
- return {
145
- ...W(t, (s, n) => !n.startsWith("_")),
146
- mask: t.constructor,
147
- _mask: i,
148
- ...e
149
- };
150
- }
151
- }
152
- return Z(a) ? {
153
- ...a
154
- } : {
155
- mask: a
156
- };
157
- }
158
- function A(a) {
159
- if (f.Masked && a instanceof f.Masked) return a;
160
- const t = I(a), e = J(t.mask);
161
- if (!e) throw new Error("Masked class is not found for provided mask " + t.mask + ", appropriate module needs to be imported manually before creating mask.");
162
- return t.mask === e && delete t.mask, t._mask && (t.mask = t._mask, delete t._mask), new e(t);
163
- }
164
- f.createMask = A;
165
- class K {
166
- /** */
167
- /** */
168
- /** */
169
- /** Safely returns selection start */
170
- get selectionStart() {
171
- let t;
172
- try {
173
- t = this._unsafeSelectionStart;
174
- } catch {
175
- }
176
- return t ?? this.value.length;
177
- }
178
- /** Safely returns selection end */
179
- get selectionEnd() {
180
- let t;
181
- try {
182
- t = this._unsafeSelectionEnd;
183
- } catch {
184
- }
185
- return t ?? this.value.length;
186
- }
187
- /** Safely sets element selection */
188
- select(t, e) {
189
- if (!(t == null || e == null || t === this.selectionStart && e === this.selectionEnd))
190
- try {
191
- this._unsafeSelect(t, e);
192
- } catch {
193
- }
194
- }
195
- /** */
196
- get isActive() {
197
- return !1;
198
- }
199
- /** */
200
- /** */
201
- /** */
202
- }
203
- f.MaskElement = K;
204
- const X = 90, vt = 89;
205
- class L extends K {
206
- /** HTMLElement to use mask on */
207
- constructor(t) {
208
- super(), this.input = t, this._onKeydown = this._onKeydown.bind(this), this._onInput = this._onInput.bind(this), this._onBeforeinput = this._onBeforeinput.bind(this), this._onCompositionEnd = this._onCompositionEnd.bind(this);
209
- }
210
- get rootElement() {
211
- var t, e, i;
212
- return (t = (e = (i = this.input).getRootNode) == null ? void 0 : e.call(i)) != null ? t : document;
213
- }
214
- /** Is element in focus */
215
- get isActive() {
216
- return this.input === this.rootElement.activeElement;
217
- }
218
- /** Binds HTMLElement events to mask internal events */
219
- bindEvents(t) {
220
- this.input.addEventListener("keydown", this._onKeydown), this.input.addEventListener("input", this._onInput), this.input.addEventListener("beforeinput", this._onBeforeinput), this.input.addEventListener("compositionend", this._onCompositionEnd), this.input.addEventListener("drop", t.drop), this.input.addEventListener("click", t.click), this.input.addEventListener("focus", t.focus), this.input.addEventListener("blur", t.commit), this._handlers = t;
221
- }
222
- _onKeydown(t) {
223
- if (this._handlers.redo && (t.keyCode === X && t.shiftKey && (t.metaKey || t.ctrlKey) || t.keyCode === vt && t.ctrlKey))
224
- return t.preventDefault(), this._handlers.redo(t);
225
- if (this._handlers.undo && t.keyCode === X && (t.metaKey || t.ctrlKey))
226
- return t.preventDefault(), this._handlers.undo(t);
227
- t.isComposing || this._handlers.selectionChange(t);
228
- }
229
- _onBeforeinput(t) {
230
- if (t.inputType === "historyUndo" && this._handlers.undo)
231
- return t.preventDefault(), this._handlers.undo(t);
232
- if (t.inputType === "historyRedo" && this._handlers.redo)
233
- return t.preventDefault(), this._handlers.redo(t);
234
- }
235
- _onCompositionEnd(t) {
236
- this._handlers.input(t);
237
- }
238
- _onInput(t) {
239
- t.isComposing || this._handlers.input(t);
240
- }
241
- /** Unbinds HTMLElement events to mask internal events */
242
- unbindEvents() {
243
- this.input.removeEventListener("keydown", this._onKeydown), this.input.removeEventListener("input", this._onInput), this.input.removeEventListener("beforeinput", this._onBeforeinput), this.input.removeEventListener("compositionend", this._onCompositionEnd), this.input.removeEventListener("drop", this._handlers.drop), this.input.removeEventListener("click", this._handlers.click), this.input.removeEventListener("focus", this._handlers.focus), this.input.removeEventListener("blur", this._handlers.commit), this._handlers = {};
244
- }
245
- }
246
- f.HTMLMaskElement = L;
247
- class xt extends L {
248
- /** InputElement to use mask on */
249
- constructor(t) {
250
- super(t), this.input = t;
251
- }
252
- /** Returns InputElement selection start */
253
- get _unsafeSelectionStart() {
254
- return this.input.selectionStart != null ? this.input.selectionStart : this.value.length;
255
- }
256
- /** Returns InputElement selection end */
257
- get _unsafeSelectionEnd() {
258
- return this.input.selectionEnd;
259
- }
260
- /** Sets InputElement selection */
261
- _unsafeSelect(t, e) {
262
- this.input.setSelectionRange(t, e);
263
- }
264
- get value() {
265
- return this.input.value;
266
- }
267
- set value(t) {
268
- this.input.value = t;
269
- }
270
- }
271
- f.HTMLMaskElement = L;
272
- class Q extends L {
273
- /** Returns HTMLElement selection start */
274
- get _unsafeSelectionStart() {
275
- const t = this.rootElement, e = t.getSelection && t.getSelection(), i = e && e.anchorOffset, s = e && e.focusOffset;
276
- return s == null || i == null || i < s ? i : s;
277
- }
278
- /** Returns HTMLElement selection end */
279
- get _unsafeSelectionEnd() {
280
- const t = this.rootElement, e = t.getSelection && t.getSelection(), i = e && e.anchorOffset, s = e && e.focusOffset;
281
- return s == null || i == null || i > s ? i : s;
282
- }
283
- /** Sets HTMLElement selection */
284
- _unsafeSelect(t, e) {
285
- if (!this.rootElement.createRange) return;
286
- const i = this.rootElement.createRange();
287
- i.setStart(this.input.firstChild || this.input, t), i.setEnd(this.input.lastChild || this.input, e);
288
- const s = this.rootElement, n = s.getSelection && s.getSelection();
289
- n && (n.removeAllRanges(), n.addRange(i));
290
- }
291
- /** HTMLElement value */
292
- get value() {
293
- return this.input.textContent || "";
294
- }
295
- set value(t) {
296
- this.input.textContent = t;
297
- }
298
- }
299
- f.HTMLContenteditableMaskElement = Q;
300
- class N {
301
- constructor() {
302
- this.states = [], this.currentIndex = 0;
303
- }
304
- get currentState() {
305
- return this.states[this.currentIndex];
306
- }
307
- get isEmpty() {
308
- return this.states.length === 0;
309
- }
310
- push(t) {
311
- this.currentIndex < this.states.length - 1 && (this.states.length = this.currentIndex + 1), this.states.push(t), this.states.length > N.MAX_LENGTH && this.states.shift(), this.currentIndex = this.states.length - 1;
312
- }
313
- go(t) {
314
- return this.currentIndex = Math.min(Math.max(this.currentIndex + t, 0), this.states.length - 1), this.currentState;
315
- }
316
- undo() {
317
- return this.go(-1);
318
- }
319
- redo() {
320
- return this.go(1);
321
- }
322
- clear() {
323
- this.states.length = 0, this.currentIndex = 0;
324
- }
325
- }
326
- N.MAX_LENGTH = 100;
327
- class bt {
328
- /**
329
- View element
330
- */
331
- /** Internal {@link Masked} model */
332
- constructor(t, e) {
333
- this.el = t instanceof K ? t : t.isContentEditable && t.tagName !== "INPUT" && t.tagName !== "TEXTAREA" ? new Q(t) : new xt(t), this.masked = A(e), this._listeners = {}, this._value = "", this._unmaskedValue = "", this._rawInputValue = "", this.history = new N(), this._saveSelection = this._saveSelection.bind(this), this._onInput = this._onInput.bind(this), this._onChange = this._onChange.bind(this), this._onDrop = this._onDrop.bind(this), this._onFocus = this._onFocus.bind(this), this._onClick = this._onClick.bind(this), this._onUndo = this._onUndo.bind(this), this._onRedo = this._onRedo.bind(this), this.alignCursor = this.alignCursor.bind(this), this.alignCursorFriendly = this.alignCursorFriendly.bind(this), this._bindEvents(), this.updateValue(), this._onChange();
334
- }
335
- maskEquals(t) {
336
- var e;
337
- return t == null || ((e = this.masked) == null ? void 0 : e.maskEquals(t));
338
- }
339
- /** Masked */
340
- get mask() {
341
- return this.masked.mask;
342
- }
343
- set mask(t) {
344
- if (this.maskEquals(t)) return;
345
- if (!(t instanceof f.Masked) && this.masked.constructor === J(t)) {
346
- this.masked.updateOptions({
347
- mask: t
348
- });
349
- return;
350
- }
351
- const e = t instanceof f.Masked ? t : A({
352
- mask: t
353
- });
354
- e.unmaskedValue = this.masked.unmaskedValue, this.masked = e;
355
- }
356
- /** Raw value */
357
- get value() {
358
- return this._value;
359
- }
360
- set value(t) {
361
- this.value !== t && (this.masked.value = t, this.updateControl("auto"));
362
- }
363
- /** Unmasked value */
364
- get unmaskedValue() {
365
- return this._unmaskedValue;
366
- }
367
- set unmaskedValue(t) {
368
- this.unmaskedValue !== t && (this.masked.unmaskedValue = t, this.updateControl("auto"));
369
- }
370
- /** Raw input value */
371
- get rawInputValue() {
372
- return this._rawInputValue;
373
- }
374
- set rawInputValue(t) {
375
- this.rawInputValue !== t && (this.masked.rawInputValue = t, this.updateControl(), this.alignCursor());
376
- }
377
- /** Typed unmasked value */
378
- get typedValue() {
379
- return this.masked.typedValue;
380
- }
381
- set typedValue(t) {
382
- this.masked.typedValueEquals(t) || (this.masked.typedValue = t, this.updateControl("auto"));
383
- }
384
- /** Display value */
385
- get displayValue() {
386
- return this.masked.displayValue;
387
- }
388
- /** Starts listening to element events */
389
- _bindEvents() {
390
- this.el.bindEvents({
391
- selectionChange: this._saveSelection,
392
- input: this._onInput,
393
- drop: this._onDrop,
394
- click: this._onClick,
395
- focus: this._onFocus,
396
- commit: this._onChange,
397
- undo: this._onUndo,
398
- redo: this._onRedo
399
- });
400
- }
401
- /** Stops listening to element events */
402
- _unbindEvents() {
403
- this.el && this.el.unbindEvents();
404
- }
405
- /** Fires custom event */
406
- _fireEvent(t, e) {
407
- const i = this._listeners[t];
408
- i && i.forEach((s) => s(e));
409
- }
410
- /** Current selection start */
411
- get selectionStart() {
412
- return this._cursorChanging ? this._changingCursorPos : this.el.selectionStart;
413
- }
414
- /** Current cursor position */
415
- get cursorPos() {
416
- return this._cursorChanging ? this._changingCursorPos : this.el.selectionEnd;
417
- }
418
- set cursorPos(t) {
419
- !this.el || !this.el.isActive || (this.el.select(t, t), this._saveSelection());
420
- }
421
- /** Stores current selection */
422
- _saveSelection() {
423
- this.displayValue !== this.el.value && console.warn("Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly."), this._selection = {
424
- start: this.selectionStart,
425
- end: this.cursorPos
426
- };
427
- }
428
- /** Syncronizes model value from view */
429
- updateValue() {
430
- this.masked.value = this.el.value, this._value = this.masked.value, this._unmaskedValue = this.masked.unmaskedValue, this._rawInputValue = this.masked.rawInputValue;
431
- }
432
- /** Syncronizes view from model value, fires change events */
433
- updateControl(t) {
434
- const e = this.masked.unmaskedValue, i = this.masked.value, s = this.masked.rawInputValue, n = this.displayValue, r = this.unmaskedValue !== e || this.value !== i || this._rawInputValue !== s;
435
- this._unmaskedValue = e, this._value = i, this._rawInputValue = s, this.el.value !== n && (this.el.value = n), t === "auto" ? this.alignCursor() : t != null && (this.cursorPos = t), r && this._fireChangeEvents(), !this._historyChanging && (r || this.history.isEmpty) && this.history.push({
436
- unmaskedValue: e,
437
- selection: {
438
- start: this.selectionStart,
439
- end: this.cursorPos
440
- }
441
- });
442
- }
443
- /** Updates options with deep equal check, recreates {@link Masked} model if mask type changes */
444
- updateOptions(t) {
445
- const {
446
- mask: e,
447
- ...i
448
- } = t, s = !this.maskEquals(e), n = this.masked.optionsIsChanged(i);
449
- s && (this.mask = e), n && this.masked.updateOptions(i), (s || n) && this.updateControl();
450
- }
451
- /** Updates cursor */
452
- updateCursor(t) {
453
- t != null && (this.cursorPos = t, this._delayUpdateCursor(t));
454
- }
455
- /** Delays cursor update to support mobile browsers */
456
- _delayUpdateCursor(t) {
457
- this._abortUpdateCursor(), this._changingCursorPos = t, this._cursorChanging = setTimeout(() => {
458
- this.el && (this.cursorPos = this._changingCursorPos, this._abortUpdateCursor());
459
- }, 10);
460
- }
461
- /** Fires custom events */
462
- _fireChangeEvents() {
463
- this._fireEvent("accept", this._inputEvent), this.masked.isComplete && this._fireEvent("complete", this._inputEvent);
464
- }
465
- /** Aborts delayed cursor update */
466
- _abortUpdateCursor() {
467
- this._cursorChanging && (clearTimeout(this._cursorChanging), delete this._cursorChanging);
468
- }
469
- /** Aligns cursor to nearest available position */
470
- alignCursor() {
471
- this.cursorPos = this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos, p.LEFT));
472
- }
473
- /** Aligns cursor only if selection is empty */
474
- alignCursorFriendly() {
475
- this.selectionStart === this.cursorPos && this.alignCursor();
476
- }
477
- /** Adds listener on custom event */
478
- on(t, e) {
479
- return this._listeners[t] || (this._listeners[t] = []), this._listeners[t].push(e), this;
480
- }
481
- /** Removes custom event listener */
482
- off(t, e) {
483
- if (!this._listeners[t]) return this;
484
- if (!e)
485
- return delete this._listeners[t], this;
486
- const i = this._listeners[t].indexOf(e);
487
- return i >= 0 && this._listeners[t].splice(i, 1), this;
488
- }
489
- /** Handles view input event */
490
- _onInput(t) {
491
- this._inputEvent = t, this._abortUpdateCursor();
492
- const e = new kt({
493
- // new state
494
- value: this.el.value,
495
- cursorPos: this.cursorPos,
496
- // old state
497
- oldValue: this.displayValue,
498
- oldSelection: this._selection
499
- }), i = this.masked.rawInputValue, s = this.masked.splice(e.startChangePos, e.removed.length, e.inserted, e.removeDirection, {
500
- input: !0,
501
- raw: !0
502
- }).offset, n = i === this.masked.rawInputValue ? e.removeDirection : p.NONE;
503
- let r = this.masked.nearestInputPos(e.startChangePos + s, n);
504
- n !== p.NONE && (r = this.masked.nearestInputPos(r, p.NONE)), this.updateControl(r), delete this._inputEvent;
505
- }
506
- /** Handles view change event and commits model value */
507
- _onChange() {
508
- this.displayValue !== this.el.value && this.updateValue(), this.masked.doCommit(), this.updateControl(), this._saveSelection();
509
- }
510
- /** Handles view drop event, prevents by default */
511
- _onDrop(t) {
512
- t.preventDefault(), t.stopPropagation();
513
- }
514
- /** Restore last selection on focus */
515
- _onFocus(t) {
516
- this.alignCursorFriendly();
517
- }
518
- /** Restore last selection on focus */
519
- _onClick(t) {
520
- this.alignCursorFriendly();
521
- }
522
- _onUndo() {
523
- this._applyHistoryState(this.history.undo());
524
- }
525
- _onRedo() {
526
- this._applyHistoryState(this.history.redo());
527
- }
528
- _applyHistoryState(t) {
529
- t && (this._historyChanging = !0, this.unmaskedValue = t.unmaskedValue, this.el.select(t.selection.start, t.selection.end), this._saveSelection(), this._historyChanging = !1);
530
- }
531
- /** Unbind view events and removes element reference */
532
- destroy() {
533
- this._unbindEvents(), this._listeners.length = 0, delete this.el;
534
- }
535
- }
536
- f.InputMask = bt;
537
- class m {
538
- /** Inserted symbols */
539
- /** Additional offset if any changes occurred before tail */
540
- /** Raw inserted is used by dynamic mask */
541
- /** Can skip chars */
542
- static normalize(t) {
543
- return Array.isArray(t) ? t : [t, new m()];
544
- }
545
- constructor(t) {
546
- Object.assign(this, {
547
- inserted: "",
548
- rawInserted: "",
549
- tailShift: 0,
550
- skip: !1
551
- }, t);
552
- }
553
- /** Aggregate changes */
554
- aggregate(t) {
555
- return this.inserted += t.inserted, this.rawInserted += t.rawInserted, this.tailShift += t.tailShift, this.skip = this.skip || t.skip, this;
556
- }
557
- /** Total offset considering all changes */
558
- get offset() {
559
- return this.tailShift + this.inserted.length;
560
- }
561
- get consumed() {
562
- return !!this.rawInserted || this.skip;
563
- }
564
- equals(t) {
565
- return this.inserted === t.inserted && this.tailShift === t.tailShift && this.rawInserted === t.rawInserted && this.skip === t.skip;
566
- }
567
- }
568
- f.ChangeDetails = m;
569
- class y {
570
- /** Tail value as string */
571
- /** Tail start position */
572
- /** Start position */
573
- constructor(t, e, i) {
574
- t === void 0 && (t = ""), e === void 0 && (e = 0), this.value = t, this.from = e, this.stop = i;
575
- }
576
- toString() {
577
- return this.value;
578
- }
579
- extend(t) {
580
- this.value += String(t);
581
- }
582
- appendTo(t) {
583
- return t.append(this.toString(), {
584
- tail: !0
585
- }).aggregate(t._appendPlaceholder());
586
- }
587
- get state() {
588
- return {
589
- value: this.value,
590
- from: this.from,
591
- stop: this.stop
592
- };
593
- }
594
- set state(t) {
595
- Object.assign(this, t);
596
- }
597
- unshift(t) {
598
- if (!this.value.length || t != null && this.from >= t) return "";
599
- const e = this.value[0];
600
- return this.value = this.value.slice(1), e;
601
- }
602
- shift() {
603
- if (!this.value.length) return "";
604
- const t = this.value[this.value.length - 1];
605
- return this.value = this.value.slice(0, -1), t;
606
- }
607
- }
608
- class v {
609
- /** */
610
- /** */
611
- /** Transforms value before mask processing */
612
- /** Transforms each char before mask processing */
613
- /** Validates if value is acceptable */
614
- /** Does additional processing at the end of editing */
615
- /** Format typed value to string */
616
- /** Parse string to get typed value */
617
- /** Enable characters overwriting */
618
- /** */
619
- /** */
620
- /** */
621
- /** */
622
- constructor(t) {
623
- this._value = "", this._update({
624
- ...v.DEFAULTS,
625
- ...t
626
- }), this._initialized = !0;
627
- }
628
- /** Sets and applies new options */
629
- updateOptions(t) {
630
- this.optionsIsChanged(t) && this.withValueRefresh(this._update.bind(this, t));
631
- }
632
- /** Sets new options */
633
- _update(t) {
634
- Object.assign(this, t);
635
- }
636
- /** Mask state */
637
- get state() {
638
- return {
639
- _value: this.value,
640
- _rawInputValue: this.rawInputValue
641
- };
642
- }
643
- set state(t) {
644
- this._value = t._value;
645
- }
646
- /** Resets value */
647
- reset() {
648
- this._value = "";
649
- }
650
- get value() {
651
- return this._value;
652
- }
653
- set value(t) {
654
- this.resolve(t, {
655
- input: !0
656
- });
657
- }
658
- /** Resolve new value */
659
- resolve(t, e) {
660
- e === void 0 && (e = {
661
- input: !0
662
- }), this.reset(), this.append(t, e, ""), this.doCommit();
663
- }
664
- get unmaskedValue() {
665
- return this.value;
666
- }
667
- set unmaskedValue(t) {
668
- this.resolve(t, {});
669
- }
670
- get typedValue() {
671
- return this.parse ? this.parse(this.value, this) : this.unmaskedValue;
672
- }
673
- set typedValue(t) {
674
- this.format ? this.value = this.format(t, this) : this.unmaskedValue = String(t);
675
- }
676
- /** Value that includes raw user input */
677
- get rawInputValue() {
678
- return this.extractInput(0, this.displayValue.length, {
679
- raw: !0
680
- });
681
- }
682
- set rawInputValue(t) {
683
- this.resolve(t, {
684
- raw: !0
685
- });
686
- }
687
- get displayValue() {
688
- return this.value;
689
- }
690
- get isComplete() {
691
- return !0;
692
- }
693
- get isFilled() {
694
- return this.isComplete;
695
- }
696
- /** Finds nearest input position in direction */
697
- nearestInputPos(t, e) {
698
- return t;
699
- }
700
- totalInputPositions(t, e) {
701
- return t === void 0 && (t = 0), e === void 0 && (e = this.displayValue.length), Math.min(this.displayValue.length, e - t);
702
- }
703
- /** Extracts value in range considering flags */
704
- extractInput(t, e, i) {
705
- return t === void 0 && (t = 0), e === void 0 && (e = this.displayValue.length), this.displayValue.slice(t, e);
706
- }
707
- /** Extracts tail in range */
708
- extractTail(t, e) {
709
- return t === void 0 && (t = 0), e === void 0 && (e = this.displayValue.length), new y(this.extractInput(t, e), t);
710
- }
711
- /** Appends tail */
712
- appendTail(t) {
713
- return F(t) && (t = new y(String(t))), t.appendTo(this);
714
- }
715
- /** Appends char */
716
- _appendCharRaw(t, e) {
717
- return t ? (this._value += t, new m({
718
- inserted: t,
719
- rawInserted: t
720
- })) : new m();
721
- }
722
- /** Appends char */
723
- _appendChar(t, e, i) {
724
- e === void 0 && (e = {});
725
- const s = this.state;
726
- let n;
727
- if ([t, n] = this.doPrepareChar(t, e), t && (n = n.aggregate(this._appendCharRaw(t, e)), !n.rawInserted && this.autofix === "pad")) {
728
- const r = this.state;
729
- this.state = s;
730
- let u = this.pad(e);
731
- const l = this._appendCharRaw(t, e);
732
- u = u.aggregate(l), l.rawInserted || u.equals(n) ? n = u : this.state = r;
733
- }
734
- if (n.inserted) {
735
- let r, u = this.doValidate(e) !== !1;
736
- if (u && i != null) {
737
- const l = this.state;
738
- if (this.overwrite === !0) {
739
- r = i.state;
740
- for (let g = 0; g < n.rawInserted.length; ++g)
741
- i.unshift(this.displayValue.length - n.tailShift);
742
- }
743
- let c = this.appendTail(i);
744
- if (u = c.rawInserted.length === i.toString().length, !(u && c.inserted) && this.overwrite === "shift") {
745
- this.state = l, r = i.state;
746
- for (let g = 0; g < n.rawInserted.length; ++g)
747
- i.shift();
748
- c = this.appendTail(i), u = c.rawInserted.length === i.toString().length;
749
- }
750
- u && c.inserted && (this.state = l);
751
- }
752
- u || (n = new m(), this.state = s, i && r && (i.state = r));
753
- }
754
- return n;
755
- }
756
- /** Appends optional placeholder at the end */
757
- _appendPlaceholder() {
758
- return new m();
759
- }
760
- /** Appends optional eager placeholder at the end */
761
- _appendEager() {
762
- return new m();
763
- }
764
- /** Appends symbols considering flags */
765
- append(t, e, i) {
766
- if (!F(t)) throw new Error("value should be string");
767
- const s = F(i) ? new y(String(i)) : i;
768
- e != null && e.tail && (e._beforeTailState = this.state);
769
- let n;
770
- [t, n] = this.doPrepare(t, e);
771
- for (let r = 0; r < t.length; ++r) {
772
- const u = this._appendChar(t[r], e, s);
773
- if (!u.rawInserted && !this.doSkipInvalid(t[r], e, s)) break;
774
- n.aggregate(u);
775
- }
776
- return (this.eager === !0 || this.eager === "append") && e != null && e.input && t && n.aggregate(this._appendEager()), s != null && (n.tailShift += this.appendTail(s).tailShift), n;
777
- }
778
- remove(t, e) {
779
- return t === void 0 && (t = 0), e === void 0 && (e = this.displayValue.length), this._value = this.displayValue.slice(0, t) + this.displayValue.slice(e), new m();
780
- }
781
- /** Calls function and reapplies current value */
782
- withValueRefresh(t) {
783
- if (this._refreshing || !this._initialized) return t();
784
- this._refreshing = !0;
785
- const e = this.rawInputValue, i = this.value, s = t();
786
- return this.rawInputValue = e, this.value && this.value !== i && i.indexOf(this.value) === 0 && (this.append(i.slice(this.displayValue.length), {}, ""), this.doCommit()), delete this._refreshing, s;
787
- }
788
- runIsolated(t) {
789
- if (this._isolated || !this._initialized) return t(this);
790
- this._isolated = !0;
791
- const e = this.state, i = t(this);
792
- return this.state = e, delete this._isolated, i;
793
- }
794
- doSkipInvalid(t, e, i) {
795
- return !!this.skipInvalid;
796
- }
797
- /** Prepares string before mask processing */
798
- doPrepare(t, e) {
799
- return e === void 0 && (e = {}), m.normalize(this.prepare ? this.prepare(t, this, e) : t);
800
- }
801
- /** Prepares each char before mask processing */
802
- doPrepareChar(t, e) {
803
- return e === void 0 && (e = {}), m.normalize(this.prepareChar ? this.prepareChar(t, this, e) : t);
804
- }
805
- /** Validates if value is acceptable */
806
- doValidate(t) {
807
- return (!this.validate || this.validate(this.value, this, t)) && (!this.parent || this.parent.doValidate(t));
808
- }
809
- /** Does additional processing at the end of editing */
810
- doCommit() {
811
- this.commit && this.commit(this.value, this);
812
- }
813
- splice(t, e, i, s, n) {
814
- i === void 0 && (i = ""), s === void 0 && (s = p.NONE), n === void 0 && (n = {
815
- input: !0
816
- });
817
- const r = t + e, u = this.extractTail(r), l = this.eager === !0 || this.eager === "remove";
818
- let c;
819
- l && (s = _t(s), c = this.extractInput(0, r, {
820
- raw: !0
821
- }));
822
- let g = t;
823
- const k = new m();
824
- if (s !== p.NONE && (g = this.nearestInputPos(t, e > 1 && t !== 0 && !l ? p.NONE : s), k.tailShift = g - t), k.aggregate(this.remove(g)), l && s !== p.NONE && c === this.rawInputValue)
825
- if (s === p.FORCE_LEFT) {
826
- let b;
827
- for (; c === this.rawInputValue && (b = this.displayValue.length); )
828
- k.aggregate(new m({
829
- tailShift: -1
830
- })).aggregate(this.remove(b - 1));
831
- } else s === p.FORCE_RIGHT && u.unshift();
832
- return k.aggregate(this.append(i, n, u));
833
- }
834
- maskEquals(t) {
835
- return this.mask === t;
836
- }
837
- optionsIsChanged(t) {
838
- return !T(this, t);
839
- }
840
- typedValueEquals(t) {
841
- const e = this.typedValue;
842
- return t === e || v.EMPTY_VALUES.includes(t) && v.EMPTY_VALUES.includes(e) || (this.format ? this.format(t, this) === this.format(this.typedValue, this) : !1);
843
- }
844
- pad(t) {
845
- return new m();
846
- }
847
- }
848
- v.DEFAULTS = {
849
- skipInvalid: !0
850
- };
851
- v.EMPTY_VALUES = [void 0, null, ""];
852
- f.Masked = v;
853
- class B {
854
- /** */
855
- constructor(t, e) {
856
- t === void 0 && (t = []), e === void 0 && (e = 0), this.chunks = t, this.from = e;
857
- }
858
- toString() {
859
- return this.chunks.map(String).join("");
860
- }
861
- extend(t) {
862
- if (!String(t)) return;
863
- t = F(t) ? new y(String(t)) : t;
864
- const e = this.chunks[this.chunks.length - 1], i = e && // if stops are same or tail has no stop
865
- (e.stop === t.stop || t.stop == null) && // if tail chunk goes just after last chunk
866
- t.from === e.from + e.toString().length;
867
- if (t instanceof y)
868
- i ? e.extend(t.toString()) : this.chunks.push(t);
869
- else if (t instanceof B) {
870
- if (t.stop == null) {
871
- let s;
872
- for (; t.chunks.length && t.chunks[0].stop == null; )
873
- s = t.chunks.shift(), s.from += t.from, this.extend(s);
874
- }
875
- t.toString() && (t.stop = t.blockIndex, this.chunks.push(t));
876
- }
877
- }
878
- appendTo(t) {
879
- if (!(t instanceof f.MaskedPattern))
880
- return new y(this.toString()).appendTo(t);
881
- const e = new m();
882
- for (let i = 0; i < this.chunks.length; ++i) {
883
- const s = this.chunks[i], n = t._mapPosToBlock(t.displayValue.length), r = s.stop;
884
- let u;
885
- if (r != null && // if block not found or stop is behind lastBlock
886
- (!n || n.index <= r) && ((s instanceof B || // for continuous block also check if stop is exist
887
- t._stops.indexOf(r) >= 0) && e.aggregate(t._appendPlaceholder(r)), u = s instanceof B && t._blocks[r]), u) {
888
- const l = u.appendTail(s);
889
- e.aggregate(l);
890
- const c = s.toString().slice(l.rawInserted.length);
891
- c && e.aggregate(t.append(c, {
892
- tail: !0
893
- }));
894
- } else
895
- e.aggregate(t.append(s.toString(), {
896
- tail: !0
897
- }));
898
- }
899
- return e;
900
- }
901
- get state() {
902
- return {
903
- chunks: this.chunks.map((t) => t.state),
904
- from: this.from,
905
- stop: this.stop,
906
- blockIndex: this.blockIndex
907
- };
908
- }
909
- set state(t) {
910
- const {
911
- chunks: e,
912
- ...i
913
- } = t;
914
- Object.assign(this, i), this.chunks = e.map((s) => {
915
- const n = "chunks" in s ? new B() : new y();
916
- return n.state = s, n;
917
- });
918
- }
919
- unshift(t) {
920
- if (!this.chunks.length || t != null && this.from >= t) return "";
921
- const e = t != null ? t - this.from : t;
922
- let i = 0;
923
- for (; i < this.chunks.length; ) {
924
- const s = this.chunks[i], n = s.unshift(e);
925
- if (s.toString()) {
926
- if (!n) break;
927
- ++i;
928
- } else
929
- this.chunks.splice(i, 1);
930
- if (n) return n;
931
- }
932
- return "";
933
- }
934
- shift() {
935
- if (!this.chunks.length) return "";
936
- let t = this.chunks.length - 1;
937
- for (; 0 <= t; ) {
938
- const e = this.chunks[t], i = e.shift();
939
- if (e.toString()) {
940
- if (!i) break;
941
- --t;
942
- } else
943
- this.chunks.splice(t, 1);
944
- if (i) return i;
945
- }
946
- return "";
947
- }
948
- }
949
- class Ct {
950
- constructor(t, e) {
951
- this.masked = t, this._log = [];
952
- const {
953
- offset: i,
954
- index: s
955
- } = t._mapPosToBlock(e) || (e < 0 ? (
956
- // first
957
- {
958
- index: 0,
959
- offset: 0
960
- }
961
- ) : (
962
- // last
963
- {
964
- index: this.masked._blocks.length,
965
- offset: 0
966
- }
967
- ));
968
- this.offset = i, this.index = s, this.ok = !1;
969
- }
970
- get block() {
971
- return this.masked._blocks[this.index];
972
- }
973
- get pos() {
974
- return this.masked._blockStartPos(this.index) + this.offset;
975
- }
976
- get state() {
977
- return {
978
- index: this.index,
979
- offset: this.offset,
980
- ok: this.ok
981
- };
982
- }
983
- set state(t) {
984
- Object.assign(this, t);
985
- }
986
- pushState() {
987
- this._log.push(this.state);
988
- }
989
- popState() {
990
- const t = this._log.pop();
991
- return t && (this.state = t), t;
992
- }
993
- bindBlock() {
994
- this.block || (this.index < 0 && (this.index = 0, this.offset = 0), this.index >= this.masked._blocks.length && (this.index = this.masked._blocks.length - 1, this.offset = this.block.displayValue.length));
995
- }
996
- _pushLeft(t) {
997
- for (this.pushState(), this.bindBlock(); 0 <= this.index; --this.index, this.offset = ((e = this.block) == null ? void 0 : e.displayValue.length) || 0) {
998
- var e;
999
- if (t()) return this.ok = !0;
1000
- }
1001
- return this.ok = !1;
1002
- }
1003
- _pushRight(t) {
1004
- for (this.pushState(), this.bindBlock(); this.index < this.masked._blocks.length; ++this.index, this.offset = 0)
1005
- if (t()) return this.ok = !0;
1006
- return this.ok = !1;
1007
- }
1008
- pushLeftBeforeFilled() {
1009
- return this._pushLeft(() => {
1010
- if (!(this.block.isFixed || !this.block.value) && (this.offset = this.block.nearestInputPos(this.offset, p.FORCE_LEFT), this.offset !== 0))
1011
- return !0;
1012
- });
1013
- }
1014
- pushLeftBeforeInput() {
1015
- return this._pushLeft(() => {
1016
- if (!this.block.isFixed)
1017
- return this.offset = this.block.nearestInputPos(this.offset, p.LEFT), !0;
1018
- });
1019
- }
1020
- pushLeftBeforeRequired() {
1021
- return this._pushLeft(() => {
1022
- if (!(this.block.isFixed || this.block.isOptional && !this.block.value))
1023
- return this.offset = this.block.nearestInputPos(this.offset, p.LEFT), !0;
1024
- });
1025
- }
1026
- pushRightBeforeFilled() {
1027
- return this._pushRight(() => {
1028
- if (!(this.block.isFixed || !this.block.value) && (this.offset = this.block.nearestInputPos(this.offset, p.FORCE_RIGHT), this.offset !== this.block.value.length))
1029
- return !0;
1030
- });
1031
- }
1032
- pushRightBeforeInput() {
1033
- return this._pushRight(() => {
1034
- if (!this.block.isFixed)
1035
- return this.offset = this.block.nearestInputPos(this.offset, p.NONE), !0;
1036
- });
1037
- }
1038
- pushRightBeforeRequired() {
1039
- return this._pushRight(() => {
1040
- if (!(this.block.isFixed || this.block.isOptional && !this.block.value))
1041
- return this.offset = this.block.nearestInputPos(this.offset, p.NONE), !0;
1042
- });
1043
- }
1044
- }
1045
- class tt {
1046
- /** */
1047
- /** */
1048
- /** */
1049
- /** */
1050
- /** */
1051
- /** */
1052
- constructor(t) {
1053
- Object.assign(this, t), this._value = "", this.isFixed = !0;
1054
- }
1055
- get value() {
1056
- return this._value;
1057
- }
1058
- get unmaskedValue() {
1059
- return this.isUnmasking ? this.value : "";
1060
- }
1061
- get rawInputValue() {
1062
- return this._isRawInput ? this.value : "";
1063
- }
1064
- get displayValue() {
1065
- return this.value;
1066
- }
1067
- reset() {
1068
- this._isRawInput = !1, this._value = "";
1069
- }
1070
- remove(t, e) {
1071
- return t === void 0 && (t = 0), e === void 0 && (e = this._value.length), this._value = this._value.slice(0, t) + this._value.slice(e), this._value || (this._isRawInput = !1), new m();
1072
- }
1073
- nearestInputPos(t, e) {
1074
- e === void 0 && (e = p.NONE);
1075
- const i = 0, s = this._value.length;
1076
- switch (e) {
1077
- case p.LEFT:
1078
- case p.FORCE_LEFT:
1079
- return i;
1080
- case p.NONE:
1081
- case p.RIGHT:
1082
- case p.FORCE_RIGHT:
1083
- default:
1084
- return s;
1085
- }
1086
- }
1087
- totalInputPositions(t, e) {
1088
- return t === void 0 && (t = 0), e === void 0 && (e = this._value.length), this._isRawInput ? e - t : 0;
1089
- }
1090
- extractInput(t, e, i) {
1091
- return t === void 0 && (t = 0), e === void 0 && (e = this._value.length), i === void 0 && (i = {}), i.raw && this._isRawInput && this._value.slice(t, e) || "";
1092
- }
1093
- get isComplete() {
1094
- return !0;
1095
- }
1096
- get isFilled() {
1097
- return !!this._value;
1098
- }
1099
- _appendChar(t, e) {
1100
- if (e === void 0 && (e = {}), this.isFilled) return new m();
1101
- const i = this.eager === !0 || this.eager === "append", n = this.char === t && (this.isUnmasking || e.input || e.raw) && (!e.raw || !i) && !e.tail, r = new m({
1102
- inserted: this.char,
1103
- rawInserted: n ? this.char : ""
1104
- });
1105
- return this._value = this.char, this._isRawInput = n && (e.raw || e.input), r;
1106
- }
1107
- _appendEager() {
1108
- return this._appendChar(this.char, {
1109
- tail: !0
1110
- });
1111
- }
1112
- _appendPlaceholder() {
1113
- const t = new m();
1114
- return this.isFilled || (this._value = t.inserted = this.char), t;
1115
- }
1116
- extractTail() {
1117
- return new y("");
1118
- }
1119
- appendTail(t) {
1120
- return F(t) && (t = new y(String(t))), t.appendTo(this);
1121
- }
1122
- append(t, e, i) {
1123
- const s = this._appendChar(t[0], e);
1124
- return i != null && (s.tailShift += this.appendTail(i).tailShift), s;
1125
- }
1126
- doCommit() {
1127
- }
1128
- get state() {
1129
- return {
1130
- _value: this._value,
1131
- _rawInputValue: this.rawInputValue
1132
- };
1133
- }
1134
- set state(t) {
1135
- this._value = t._value, this._isRawInput = !!t._rawInputValue;
1136
- }
1137
- pad(t) {
1138
- return this._appendPlaceholder();
1139
- }
1140
- }
1141
- class R {
1142
- /** */
1143
- /** */
1144
- /** */
1145
- /** */
1146
- /** */
1147
- /** */
1148
- /** */
1149
- /** */
1150
- constructor(t) {
1151
- const {
1152
- parent: e,
1153
- isOptional: i,
1154
- placeholderChar: s,
1155
- displayChar: n,
1156
- lazy: r,
1157
- eager: u,
1158
- ...l
1159
- } = t;
1160
- this.masked = A(l), Object.assign(this, {
1161
- parent: e,
1162
- isOptional: i,
1163
- placeholderChar: s,
1164
- displayChar: n,
1165
- lazy: r,
1166
- eager: u
1167
- });
1168
- }
1169
- reset() {
1170
- this.isFilled = !1, this.masked.reset();
1171
- }
1172
- remove(t, e) {
1173
- return t === void 0 && (t = 0), e === void 0 && (e = this.value.length), t === 0 && e >= 1 ? (this.isFilled = !1, this.masked.remove(t, e)) : new m();
1174
- }
1175
- get value() {
1176
- return this.masked.value || (this.isFilled && !this.isOptional ? this.placeholderChar : "");
1177
- }
1178
- get unmaskedValue() {
1179
- return this.masked.unmaskedValue;
1180
- }
1181
- get rawInputValue() {
1182
- return this.masked.rawInputValue;
1183
- }
1184
- get displayValue() {
1185
- return this.masked.value && this.displayChar || this.value;
1186
- }
1187
- get isComplete() {
1188
- return !!this.masked.value || this.isOptional;
1189
- }
1190
- _appendChar(t, e) {
1191
- if (e === void 0 && (e = {}), this.isFilled) return new m();
1192
- const i = this.masked.state;
1193
- let s = this.masked._appendChar(t, this.currentMaskFlags(e));
1194
- return s.inserted && this.doValidate(e) === !1 && (s = new m(), this.masked.state = i), !s.inserted && !this.isOptional && !this.lazy && !e.input && (s.inserted = this.placeholderChar), s.skip = !s.inserted && !this.isOptional, this.isFilled = !!s.inserted, s;
1195
- }
1196
- append(t, e, i) {
1197
- return this.masked.append(t, this.currentMaskFlags(e), i);
1198
- }
1199
- _appendPlaceholder() {
1200
- return this.isFilled || this.isOptional ? new m() : (this.isFilled = !0, new m({
1201
- inserted: this.placeholderChar
1202
- }));
1203
- }
1204
- _appendEager() {
1205
- return new m();
1206
- }
1207
- extractTail(t, e) {
1208
- return this.masked.extractTail(t, e);
1209
- }
1210
- appendTail(t) {
1211
- return this.masked.appendTail(t);
1212
- }
1213
- extractInput(t, e, i) {
1214
- return t === void 0 && (t = 0), e === void 0 && (e = this.value.length), this.masked.extractInput(t, e, i);
1215
- }
1216
- nearestInputPos(t, e) {
1217
- e === void 0 && (e = p.NONE);
1218
- const i = 0, s = this.value.length, n = Math.min(Math.max(t, i), s);
1219
- switch (e) {
1220
- case p.LEFT:
1221
- case p.FORCE_LEFT:
1222
- return this.isComplete ? n : i;
1223
- case p.RIGHT:
1224
- case p.FORCE_RIGHT:
1225
- return this.isComplete ? n : s;
1226
- case p.NONE:
1227
- default:
1228
- return n;
1229
- }
1230
- }
1231
- totalInputPositions(t, e) {
1232
- return t === void 0 && (t = 0), e === void 0 && (e = this.value.length), this.value.slice(t, e).length;
1233
- }
1234
- doValidate(t) {
1235
- return this.masked.doValidate(this.currentMaskFlags(t)) && (!this.parent || this.parent.doValidate(this.currentMaskFlags(t)));
1236
- }
1237
- doCommit() {
1238
- this.masked.doCommit();
1239
- }
1240
- get state() {
1241
- return {
1242
- _value: this.value,
1243
- _rawInputValue: this.rawInputValue,
1244
- masked: this.masked.state,
1245
- isFilled: this.isFilled
1246
- };
1247
- }
1248
- set state(t) {
1249
- this.masked.state = t.masked, this.isFilled = t.isFilled;
1250
- }
1251
- currentMaskFlags(t) {
1252
- var e;
1253
- return {
1254
- ...t,
1255
- _beforeTailState: (t == null || (e = t._beforeTailState) == null ? void 0 : e.masked) || t?._beforeTailState
1256
- };
1257
- }
1258
- pad(t) {
1259
- return new m();
1260
- }
1261
- }
1262
- R.DEFAULT_DEFINITIONS = {
1263
- 0: /\d/,
1264
- a: /[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,
1265
- // http://stackoverflow.com/a/22075070
1266
- "*": /./
1267
- };
1268
- class yt extends v {
1269
- /** */
1270
- /** Enable characters overwriting */
1271
- /** */
1272
- /** */
1273
- /** */
1274
- updateOptions(t) {
1275
- super.updateOptions(t);
1276
- }
1277
- _update(t) {
1278
- const e = t.mask;
1279
- e && (t.validate = (i) => i.search(e) >= 0), super._update(t);
1280
- }
1281
- }
1282
- f.MaskedRegExp = yt;
1283
- class x extends v {
1284
- /** */
1285
- /** */
1286
- /** Single char for empty input */
1287
- /** Single char for filled input */
1288
- /** Show placeholder only when needed */
1289
- /** Enable characters overwriting */
1290
- /** */
1291
- /** */
1292
- /** */
1293
- constructor(t) {
1294
- super({
1295
- ...x.DEFAULTS,
1296
- ...t,
1297
- definitions: Object.assign({}, R.DEFAULT_DEFINITIONS, t?.definitions)
1298
- });
1299
- }
1300
- updateOptions(t) {
1301
- super.updateOptions(t);
1302
- }
1303
- _update(t) {
1304
- t.definitions = Object.assign({}, this.definitions, t.definitions), super._update(t), this._rebuildMask();
1305
- }
1306
- _rebuildMask() {
1307
- const t = this.definitions;
1308
- this._blocks = [], this.exposeBlock = void 0, this._stops = [], this._maskedBlocks = {};
1309
- const e = this.mask;
1310
- if (!e || !t) return;
1311
- let i = !1, s = !1;
1312
- for (let n = 0; n < e.length; ++n) {
1313
- if (this.blocks) {
1314
- const c = e.slice(n), g = Object.keys(this.blocks).filter((b) => c.indexOf(b) === 0);
1315
- g.sort((b, D) => D.length - b.length);
1316
- const k = g[0];
1317
- if (k) {
1318
- const {
1319
- expose: b,
1320
- repeat: D,
1321
- ...at
1322
- } = I(this.blocks[k]), q = {
1323
- lazy: this.lazy,
1324
- eager: this.eager,
1325
- placeholderChar: this.placeholderChar,
1326
- displayChar: this.displayChar,
1327
- overwrite: this.overwrite,
1328
- autofix: this.autofix,
1329
- ...at,
1330
- repeat: D,
1331
- parent: this
1332
- }, U = D != null ? new f.RepeatBlock(
1333
- q
1334
- /* TODO */
1335
- ) : A(q);
1336
- U && (this._blocks.push(U), b && (this.exposeBlock = U), this._maskedBlocks[k] || (this._maskedBlocks[k] = []), this._maskedBlocks[k].push(this._blocks.length - 1)), n += k.length - 1;
1337
- continue;
1338
- }
1339
- }
1340
- let r = e[n], u = r in t;
1341
- if (r === x.STOP_CHAR) {
1342
- this._stops.push(this._blocks.length);
1343
- continue;
1344
- }
1345
- if (r === "{" || r === "}") {
1346
- i = !i;
1347
- continue;
1348
- }
1349
- if (r === "[" || r === "]") {
1350
- s = !s;
1351
- continue;
1352
- }
1353
- if (r === x.ESCAPE_CHAR) {
1354
- if (++n, r = e[n], !r) break;
1355
- u = !1;
1356
- }
1357
- const l = u ? new R({
1358
- isOptional: s,
1359
- lazy: this.lazy,
1360
- eager: this.eager,
1361
- placeholderChar: this.placeholderChar,
1362
- displayChar: this.displayChar,
1363
- ...I(t[r]),
1364
- parent: this
1365
- }) : new tt({
1366
- char: r,
1367
- eager: this.eager,
1368
- isUnmasking: i
1369
- });
1370
- this._blocks.push(l);
1371
- }
1372
- }
1373
- get state() {
1374
- return {
1375
- ...super.state,
1376
- _blocks: this._blocks.map((t) => t.state)
1377
- };
1378
- }
1379
- set state(t) {
1380
- if (!t) {
1381
- this.reset();
1382
- return;
1383
- }
1384
- const {
1385
- _blocks: e,
1386
- ...i
1387
- } = t;
1388
- this._blocks.forEach((s, n) => s.state = e[n]), super.state = i;
1389
- }
1390
- reset() {
1391
- super.reset(), this._blocks.forEach((t) => t.reset());
1392
- }
1393
- get isComplete() {
1394
- return this.exposeBlock ? this.exposeBlock.isComplete : this._blocks.every((t) => t.isComplete);
1395
- }
1396
- get isFilled() {
1397
- return this._blocks.every((t) => t.isFilled);
1398
- }
1399
- get isFixed() {
1400
- return this._blocks.every((t) => t.isFixed);
1401
- }
1402
- get isOptional() {
1403
- return this._blocks.every((t) => t.isOptional);
1404
- }
1405
- doCommit() {
1406
- this._blocks.forEach((t) => t.doCommit()), super.doCommit();
1407
- }
1408
- get unmaskedValue() {
1409
- return this.exposeBlock ? this.exposeBlock.unmaskedValue : this._blocks.reduce((t, e) => t += e.unmaskedValue, "");
1410
- }
1411
- set unmaskedValue(t) {
1412
- if (this.exposeBlock) {
1413
- const e = this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock)) + this.exposeBlock.displayValue.length);
1414
- this.exposeBlock.unmaskedValue = t, this.appendTail(e), this.doCommit();
1415
- } else super.unmaskedValue = t;
1416
- }
1417
- get value() {
1418
- return this.exposeBlock ? this.exposeBlock.value : (
1419
- // TODO return _value when not in change?
1420
- this._blocks.reduce((t, e) => t += e.value, "")
1421
- );
1422
- }
1423
- set value(t) {
1424
- if (this.exposeBlock) {
1425
- const e = this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock)) + this.exposeBlock.displayValue.length);
1426
- this.exposeBlock.value = t, this.appendTail(e), this.doCommit();
1427
- } else super.value = t;
1428
- }
1429
- get typedValue() {
1430
- return this.exposeBlock ? this.exposeBlock.typedValue : super.typedValue;
1431
- }
1432
- set typedValue(t) {
1433
- if (this.exposeBlock) {
1434
- const e = this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock)) + this.exposeBlock.displayValue.length);
1435
- this.exposeBlock.typedValue = t, this.appendTail(e), this.doCommit();
1436
- } else super.typedValue = t;
1437
- }
1438
- get displayValue() {
1439
- return this._blocks.reduce((t, e) => t += e.displayValue, "");
1440
- }
1441
- appendTail(t) {
1442
- return super.appendTail(t).aggregate(this._appendPlaceholder());
1443
- }
1444
- _appendEager() {
1445
- var t;
1446
- const e = new m();
1447
- let i = (t = this._mapPosToBlock(this.displayValue.length)) == null ? void 0 : t.index;
1448
- if (i == null) return e;
1449
- this._blocks[i].isFilled && ++i;
1450
- for (let s = i; s < this._blocks.length; ++s) {
1451
- const n = this._blocks[s]._appendEager();
1452
- if (!n.inserted) break;
1453
- e.aggregate(n);
1454
- }
1455
- return e;
1456
- }
1457
- _appendCharRaw(t, e) {
1458
- e === void 0 && (e = {});
1459
- const i = this._mapPosToBlock(this.displayValue.length), s = new m();
1460
- if (!i) return s;
1461
- for (let r = i.index, u; u = this._blocks[r]; ++r) {
1462
- var n;
1463
- const l = u._appendChar(t, {
1464
- ...e,
1465
- _beforeTailState: (n = e._beforeTailState) == null || (n = n._blocks) == null ? void 0 : n[r]
1466
- });
1467
- if (s.aggregate(l), l.consumed) break;
1468
- }
1469
- return s;
1470
- }
1471
- extractTail(t, e) {
1472
- t === void 0 && (t = 0), e === void 0 && (e = this.displayValue.length);
1473
- const i = new B();
1474
- return t === e || this._forEachBlocksInRange(t, e, (s, n, r, u) => {
1475
- const l = s.extractTail(r, u);
1476
- l.stop = this._findStopBefore(n), l.from = this._blockStartPos(n), l instanceof B && (l.blockIndex = n), i.extend(l);
1477
- }), i;
1478
- }
1479
- extractInput(t, e, i) {
1480
- if (t === void 0 && (t = 0), e === void 0 && (e = this.displayValue.length), i === void 0 && (i = {}), t === e) return "";
1481
- let s = "";
1482
- return this._forEachBlocksInRange(t, e, (n, r, u, l) => {
1483
- s += n.extractInput(u, l, i);
1484
- }), s;
1485
- }
1486
- _findStopBefore(t) {
1487
- let e;
1488
- for (let i = 0; i < this._stops.length; ++i) {
1489
- const s = this._stops[i];
1490
- if (s <= t) e = s;
1491
- else break;
1492
- }
1493
- return e;
1494
- }
1495
- /** Appends placeholder depending on laziness */
1496
- _appendPlaceholder(t) {
1497
- const e = new m();
1498
- if (this.lazy && t == null) return e;
1499
- const i = this._mapPosToBlock(this.displayValue.length);
1500
- if (!i) return e;
1501
- const s = i.index, n = t ?? this._blocks.length;
1502
- return this._blocks.slice(s, n).forEach((r) => {
1503
- if (!r.lazy || t != null) {
1504
- var u;
1505
- e.aggregate(r._appendPlaceholder((u = r._blocks) == null ? void 0 : u.length));
1506
- }
1507
- }), e;
1508
- }
1509
- /** Finds block in pos */
1510
- _mapPosToBlock(t) {
1511
- let e = "";
1512
- for (let i = 0; i < this._blocks.length; ++i) {
1513
- const s = this._blocks[i], n = e.length;
1514
- if (e += s.displayValue, t <= e.length)
1515
- return {
1516
- index: i,
1517
- offset: t - n
1518
- };
1519
- }
1520
- }
1521
- _blockStartPos(t) {
1522
- return this._blocks.slice(0, t).reduce((e, i) => e += i.displayValue.length, 0);
1523
- }
1524
- _forEachBlocksInRange(t, e, i) {
1525
- e === void 0 && (e = this.displayValue.length);
1526
- const s = this._mapPosToBlock(t);
1527
- if (s) {
1528
- const n = this._mapPosToBlock(e), r = n && s.index === n.index, u = s.offset, l = n && r ? n.offset : this._blocks[s.index].displayValue.length;
1529
- if (i(this._blocks[s.index], s.index, u, l), n && !r) {
1530
- for (let c = s.index + 1; c < n.index; ++c)
1531
- i(this._blocks[c], c, 0, this._blocks[c].displayValue.length);
1532
- i(this._blocks[n.index], n.index, 0, n.offset);
1533
- }
1534
- }
1535
- }
1536
- remove(t, e) {
1537
- t === void 0 && (t = 0), e === void 0 && (e = this.displayValue.length);
1538
- const i = super.remove(t, e);
1539
- return this._forEachBlocksInRange(t, e, (s, n, r, u) => {
1540
- i.aggregate(s.remove(r, u));
1541
- }), i;
1542
- }
1543
- nearestInputPos(t, e) {
1544
- if (e === void 0 && (e = p.NONE), !this._blocks.length) return 0;
1545
- const i = new Ct(this, t);
1546
- if (e === p.NONE)
1547
- return i.pushRightBeforeInput() || (i.popState(), i.pushLeftBeforeInput()) ? i.pos : this.displayValue.length;
1548
- if (e === p.LEFT || e === p.FORCE_LEFT) {
1549
- if (e === p.LEFT) {
1550
- if (i.pushRightBeforeFilled(), i.ok && i.pos === t) return t;
1551
- i.popState();
1552
- }
1553
- if (i.pushLeftBeforeInput(), i.pushLeftBeforeRequired(), i.pushLeftBeforeFilled(), e === p.LEFT) {
1554
- if (i.pushRightBeforeInput(), i.pushRightBeforeRequired(), i.ok && i.pos <= t || (i.popState(), i.ok && i.pos <= t)) return i.pos;
1555
- i.popState();
1556
- }
1557
- return i.ok ? i.pos : e === p.FORCE_LEFT ? 0 : (i.popState(), i.ok || (i.popState(), i.ok) ? i.pos : 0);
1558
- }
1559
- return e === p.RIGHT || e === p.FORCE_RIGHT ? (i.pushRightBeforeInput(), i.pushRightBeforeRequired(), i.pushRightBeforeFilled() ? i.pos : e === p.FORCE_RIGHT ? this.displayValue.length : (i.popState(), i.ok || (i.popState(), i.ok) ? i.pos : this.nearestInputPos(t, p.LEFT))) : t;
1560
- }
1561
- totalInputPositions(t, e) {
1562
- t === void 0 && (t = 0), e === void 0 && (e = this.displayValue.length);
1563
- let i = 0;
1564
- return this._forEachBlocksInRange(t, e, (s, n, r, u) => {
1565
- i += s.totalInputPositions(r, u);
1566
- }), i;
1567
- }
1568
- /** Get block by name */
1569
- maskedBlock(t) {
1570
- return this.maskedBlocks(t)[0];
1571
- }
1572
- /** Get all blocks by name */
1573
- maskedBlocks(t) {
1574
- const e = this._maskedBlocks[t];
1575
- return e ? e.map((i) => this._blocks[i]) : [];
1576
- }
1577
- pad(t) {
1578
- const e = new m();
1579
- return this._forEachBlocksInRange(0, this.displayValue.length, (i) => e.aggregate(i.pad(t))), e;
1580
- }
1581
- }
1582
- x.DEFAULTS = {
1583
- ...v.DEFAULTS,
1584
- lazy: !0,
1585
- placeholderChar: "_"
1586
- };
1587
- x.STOP_CHAR = "`";
1588
- x.ESCAPE_CHAR = "\\";
1589
- x.InputDefinition = R;
1590
- x.FixedDefinition = tt;
1591
- f.MaskedPattern = x;
1592
- class M extends x {
1593
- /**
1594
- Optionally sets max length of pattern.
1595
- Used when pattern length is longer then `to` param length. Pads zeros at start in this case.
1596
- */
1597
- /** Min bound */
1598
- /** Max bound */
1599
- get _matchFrom() {
1600
- return this.maxLength - String(this.from).length;
1601
- }
1602
- constructor(t) {
1603
- super(t);
1604
- }
1605
- updateOptions(t) {
1606
- super.updateOptions(t);
1607
- }
1608
- _update(t) {
1609
- const {
1610
- to: e = this.to || 0,
1611
- from: i = this.from || 0,
1612
- maxLength: s = this.maxLength || 0,
1613
- autofix: n = this.autofix,
1614
- ...r
1615
- } = t;
1616
- this.to = e, this.from = i, this.maxLength = Math.max(String(e).length, s), this.autofix = n;
1617
- const u = String(this.from).padStart(this.maxLength, "0"), l = String(this.to).padStart(this.maxLength, "0");
1618
- let c = 0;
1619
- for (; c < l.length && l[c] === u[c]; ) ++c;
1620
- r.mask = l.slice(0, c).replace(/0/g, "\\0") + "0".repeat(this.maxLength - c), super._update(r);
1621
- }
1622
- get isComplete() {
1623
- return super.isComplete && !!this.value;
1624
- }
1625
- boundaries(t) {
1626
- let e = "", i = "";
1627
- const [, s, n] = t.match(/^(\D*)(\d*)(\D*)/) || [];
1628
- return n && (e = "0".repeat(s.length) + n, i = "9".repeat(s.length) + n), e = e.padEnd(this.maxLength, "0"), i = i.padEnd(this.maxLength, "9"), [e, i];
1629
- }
1630
- doPrepareChar(t, e) {
1631
- e === void 0 && (e = {});
1632
- let i;
1633
- return [t, i] = super.doPrepareChar(t.replace(/\D/g, ""), e), t || (i.skip = !this.isComplete), [t, i];
1634
- }
1635
- _appendCharRaw(t, e) {
1636
- if (e === void 0 && (e = {}), !this.autofix || this.value.length + 1 > this.maxLength) return super._appendCharRaw(t, e);
1637
- const i = String(this.from).padStart(this.maxLength, "0"), s = String(this.to).padStart(this.maxLength, "0"), [n, r] = this.boundaries(this.value + t);
1638
- return Number(r) < this.from ? super._appendCharRaw(i[this.value.length], e) : Number(n) > this.to ? !e.tail && this.autofix === "pad" && this.value.length + 1 < this.maxLength ? super._appendCharRaw(i[this.value.length], e).aggregate(this._appendCharRaw(t, e)) : super._appendCharRaw(s[this.value.length], e) : super._appendCharRaw(t, e);
1639
- }
1640
- doValidate(t) {
1641
- const e = this.value;
1642
- if (e.search(/[^0]/) === -1 && e.length <= this._matchFrom) return !0;
1643
- const [s, n] = this.boundaries(e);
1644
- return this.from <= Number(n) && Number(s) <= this.to && super.doValidate(t);
1645
- }
1646
- pad(t) {
1647
- const e = new m();
1648
- if (this.value.length === this.maxLength) return e;
1649
- const i = this.value, s = this.maxLength - this.value.length;
1650
- if (s) {
1651
- this.reset();
1652
- for (let n = 0; n < s; ++n)
1653
- e.aggregate(super._appendCharRaw("0", t));
1654
- i.split("").forEach((n) => this._appendCharRaw(n));
1655
- }
1656
- return e;
1657
- }
1658
- }
1659
- f.MaskedRange = M;
1660
- const Et = "d{.}`m{.}`Y";
1661
- class w extends x {
1662
- static extractPatternOptions(t) {
1663
- const {
1664
- mask: e,
1665
- pattern: i,
1666
- ...s
1667
- } = t;
1668
- return {
1669
- ...s,
1670
- mask: F(e) ? e : i
1671
- };
1672
- }
1673
- /** Pattern mask for date according to {@link MaskedDate#format} */
1674
- /** Start date */
1675
- /** End date */
1676
- /** Format typed value to string */
1677
- /** Parse string to get typed value */
1678
- constructor(t) {
1679
- super(w.extractPatternOptions({
1680
- ...w.DEFAULTS,
1681
- ...t
1682
- }));
1683
- }
1684
- updateOptions(t) {
1685
- super.updateOptions(t);
1686
- }
1687
- _update(t) {
1688
- const {
1689
- mask: e,
1690
- pattern: i,
1691
- blocks: s,
1692
- ...n
1693
- } = {
1694
- ...w.DEFAULTS,
1695
- ...t
1696
- }, r = Object.assign({}, w.GET_DEFAULT_BLOCKS());
1697
- t.min && (r.Y.from = t.min.getFullYear()), t.max && (r.Y.to = t.max.getFullYear()), t.min && t.max && r.Y.from === r.Y.to && (r.m.from = t.min.getMonth() + 1, r.m.to = t.max.getMonth() + 1, r.m.from === r.m.to && (r.d.from = t.min.getDate(), r.d.to = t.max.getDate())), Object.assign(r, this.blocks, s), super._update({
1698
- ...n,
1699
- mask: F(e) ? e : i,
1700
- blocks: r
1701
- });
1702
- }
1703
- doValidate(t) {
1704
- const e = this.date;
1705
- return super.doValidate(t) && (!this.isComplete || this.isDateExist(this.value) && e != null && (this.min == null || this.min <= e) && (this.max == null || e <= this.max));
1706
- }
1707
- /** Checks if date is exists */
1708
- isDateExist(t) {
1709
- return this.format(this.parse(t, this), this).indexOf(t) >= 0;
1710
- }
1711
- /** Parsed Date */
1712
- get date() {
1713
- return this.typedValue;
1714
- }
1715
- set date(t) {
1716
- this.typedValue = t;
1717
- }
1718
- get typedValue() {
1719
- return this.isComplete ? super.typedValue : null;
1720
- }
1721
- set typedValue(t) {
1722
- super.typedValue = t;
1723
- }
1724
- maskEquals(t) {
1725
- return t === Date || super.maskEquals(t);
1726
- }
1727
- optionsIsChanged(t) {
1728
- return super.optionsIsChanged(w.extractPatternOptions(t));
1729
- }
1730
- }
1731
- w.GET_DEFAULT_BLOCKS = () => ({
1732
- d: {
1733
- mask: M,
1734
- from: 1,
1735
- to: 31,
1736
- maxLength: 2
1737
- },
1738
- m: {
1739
- mask: M,
1740
- from: 1,
1741
- to: 12,
1742
- maxLength: 2
1743
- },
1744
- Y: {
1745
- mask: M,
1746
- from: 1900,
1747
- to: 9999
1748
- }
1749
- });
1750
- w.DEFAULTS = {
1751
- ...x.DEFAULTS,
1752
- mask: Date,
1753
- pattern: Et,
1754
- format: (a, t) => {
1755
- if (!a) return "";
1756
- const e = String(a.getDate()).padStart(2, "0"), i = String(a.getMonth() + 1).padStart(2, "0"), s = a.getFullYear();
1757
- return [e, i, s].join(".");
1758
- },
1759
- parse: (a, t) => {
1760
- const [e, i, s] = a.split(".").map(Number);
1761
- return new Date(s, i - 1, e);
1762
- }
1763
- };
1764
- f.MaskedDate = w;
1765
- class $ extends v {
1766
- constructor(t) {
1767
- super({
1768
- ...$.DEFAULTS,
1769
- ...t
1770
- }), this.currentMask = void 0;
1771
- }
1772
- updateOptions(t) {
1773
- super.updateOptions(t);
1774
- }
1775
- _update(t) {
1776
- super._update(t), "mask" in t && (this.exposeMask = void 0, this.compiledMasks = Array.isArray(t.mask) ? t.mask.map((e) => {
1777
- const {
1778
- expose: i,
1779
- ...s
1780
- } = I(e), n = A({
1781
- overwrite: this._overwrite,
1782
- eager: this._eager,
1783
- skipInvalid: this._skipInvalid,
1784
- ...s
1785
- });
1786
- return i && (this.exposeMask = n), n;
1787
- }) : []);
1788
- }
1789
- _appendCharRaw(t, e) {
1790
- e === void 0 && (e = {});
1791
- const i = this._applyDispatch(t, e);
1792
- return this.currentMask && i.aggregate(this.currentMask._appendChar(t, this.currentMaskFlags(e))), i;
1793
- }
1794
- _applyDispatch(t, e, i) {
1795
- t === void 0 && (t = ""), e === void 0 && (e = {}), i === void 0 && (i = "");
1796
- const s = e.tail && e._beforeTailState != null ? e._beforeTailState._value : this.value, n = this.rawInputValue, r = e.tail && e._beforeTailState != null ? e._beforeTailState._rawInputValue : n, u = n.slice(r.length), l = this.currentMask, c = new m(), g = l?.state;
1797
- return this.currentMask = this.doDispatch(t, {
1798
- ...e
1799
- }, i), this.currentMask && (this.currentMask !== l ? (this.currentMask.reset(), r && (this.currentMask.append(r, {
1800
- raw: !0
1801
- }), c.tailShift = this.currentMask.value.length - s.length), u && (c.tailShift += this.currentMask.append(u, {
1802
- raw: !0,
1803
- tail: !0
1804
- }).tailShift)) : g && (this.currentMask.state = g)), c;
1805
- }
1806
- _appendPlaceholder() {
1807
- const t = this._applyDispatch();
1808
- return this.currentMask && t.aggregate(this.currentMask._appendPlaceholder()), t;
1809
- }
1810
- _appendEager() {
1811
- const t = this._applyDispatch();
1812
- return this.currentMask && t.aggregate(this.currentMask._appendEager()), t;
1813
- }
1814
- appendTail(t) {
1815
- const e = new m();
1816
- return t && e.aggregate(this._applyDispatch("", {}, t)), e.aggregate(this.currentMask ? this.currentMask.appendTail(t) : super.appendTail(t));
1817
- }
1818
- currentMaskFlags(t) {
1819
- var e, i;
1820
- return {
1821
- ...t,
1822
- _beforeTailState: ((e = t._beforeTailState) == null ? void 0 : e.currentMaskRef) === this.currentMask && ((i = t._beforeTailState) == null ? void 0 : i.currentMask) || t._beforeTailState
1823
- };
1824
- }
1825
- doDispatch(t, e, i) {
1826
- return e === void 0 && (e = {}), i === void 0 && (i = ""), this.dispatch(t, this, e, i);
1827
- }
1828
- doValidate(t) {
1829
- return super.doValidate(t) && (!this.currentMask || this.currentMask.doValidate(this.currentMaskFlags(t)));
1830
- }
1831
- doPrepare(t, e) {
1832
- e === void 0 && (e = {});
1833
- let [i, s] = super.doPrepare(t, e);
1834
- if (this.currentMask) {
1835
- let n;
1836
- [i, n] = super.doPrepare(i, this.currentMaskFlags(e)), s = s.aggregate(n);
1837
- }
1838
- return [i, s];
1839
- }
1840
- doPrepareChar(t, e) {
1841
- e === void 0 && (e = {});
1842
- let [i, s] = super.doPrepareChar(t, e);
1843
- if (this.currentMask) {
1844
- let n;
1845
- [i, n] = super.doPrepareChar(i, this.currentMaskFlags(e)), s = s.aggregate(n);
1846
- }
1847
- return [i, s];
1848
- }
1849
- reset() {
1850
- var t;
1851
- (t = this.currentMask) == null || t.reset(), this.compiledMasks.forEach((e) => e.reset());
1852
- }
1853
- get value() {
1854
- return this.exposeMask ? this.exposeMask.value : this.currentMask ? this.currentMask.value : "";
1855
- }
1856
- set value(t) {
1857
- this.exposeMask ? (this.exposeMask.value = t, this.currentMask = this.exposeMask, this._applyDispatch()) : super.value = t;
1858
- }
1859
- get unmaskedValue() {
1860
- return this.exposeMask ? this.exposeMask.unmaskedValue : this.currentMask ? this.currentMask.unmaskedValue : "";
1861
- }
1862
- set unmaskedValue(t) {
1863
- this.exposeMask ? (this.exposeMask.unmaskedValue = t, this.currentMask = this.exposeMask, this._applyDispatch()) : super.unmaskedValue = t;
1864
- }
1865
- get typedValue() {
1866
- return this.exposeMask ? this.exposeMask.typedValue : this.currentMask ? this.currentMask.typedValue : "";
1867
- }
1868
- set typedValue(t) {
1869
- if (this.exposeMask) {
1870
- this.exposeMask.typedValue = t, this.currentMask = this.exposeMask, this._applyDispatch();
1871
- return;
1872
- }
1873
- let e = String(t);
1874
- this.currentMask && (this.currentMask.typedValue = t, e = this.currentMask.unmaskedValue), this.unmaskedValue = e;
1875
- }
1876
- get displayValue() {
1877
- return this.currentMask ? this.currentMask.displayValue : "";
1878
- }
1879
- get isComplete() {
1880
- var t;
1881
- return !!((t = this.currentMask) != null && t.isComplete);
1882
- }
1883
- get isFilled() {
1884
- var t;
1885
- return !!((t = this.currentMask) != null && t.isFilled);
1886
- }
1887
- remove(t, e) {
1888
- const i = new m();
1889
- return this.currentMask && i.aggregate(this.currentMask.remove(t, e)).aggregate(this._applyDispatch()), i;
1890
- }
1891
- get state() {
1892
- var t;
1893
- return {
1894
- ...super.state,
1895
- _rawInputValue: this.rawInputValue,
1896
- compiledMasks: this.compiledMasks.map((e) => e.state),
1897
- currentMaskRef: this.currentMask,
1898
- currentMask: (t = this.currentMask) == null ? void 0 : t.state
1899
- };
1900
- }
1901
- set state(t) {
1902
- const {
1903
- compiledMasks: e,
1904
- currentMaskRef: i,
1905
- currentMask: s,
1906
- ...n
1907
- } = t;
1908
- e && this.compiledMasks.forEach((r, u) => r.state = e[u]), i != null && (this.currentMask = i, this.currentMask.state = s), super.state = n;
1909
- }
1910
- extractInput(t, e, i) {
1911
- return this.currentMask ? this.currentMask.extractInput(t, e, i) : "";
1912
- }
1913
- extractTail(t, e) {
1914
- return this.currentMask ? this.currentMask.extractTail(t, e) : super.extractTail(t, e);
1915
- }
1916
- doCommit() {
1917
- this.currentMask && this.currentMask.doCommit(), super.doCommit();
1918
- }
1919
- nearestInputPos(t, e) {
1920
- return this.currentMask ? this.currentMask.nearestInputPos(t, e) : super.nearestInputPos(t, e);
1921
- }
1922
- get overwrite() {
1923
- return this.currentMask ? this.currentMask.overwrite : this._overwrite;
1924
- }
1925
- set overwrite(t) {
1926
- this._overwrite = t;
1927
- }
1928
- get eager() {
1929
- return this.currentMask ? this.currentMask.eager : this._eager;
1930
- }
1931
- set eager(t) {
1932
- this._eager = t;
1933
- }
1934
- get skipInvalid() {
1935
- return this.currentMask ? this.currentMask.skipInvalid : this._skipInvalid;
1936
- }
1937
- set skipInvalid(t) {
1938
- this._skipInvalid = t;
1939
- }
1940
- get autofix() {
1941
- return this.currentMask ? this.currentMask.autofix : this._autofix;
1942
- }
1943
- set autofix(t) {
1944
- this._autofix = t;
1945
- }
1946
- maskEquals(t) {
1947
- return Array.isArray(t) ? this.compiledMasks.every((e, i) => {
1948
- if (!t[i]) return;
1949
- const {
1950
- mask: s,
1951
- ...n
1952
- } = t[i];
1953
- return T(e, n) && e.maskEquals(s);
1954
- }) : super.maskEquals(t);
1955
- }
1956
- typedValueEquals(t) {
1957
- var e;
1958
- return !!((e = this.currentMask) != null && e.typedValueEquals(t));
1959
- }
1960
- }
1961
- $.DEFAULTS = {
1962
- ...v.DEFAULTS,
1963
- dispatch: (a, t, e, i) => {
1964
- if (!t.compiledMasks.length) return;
1965
- const s = t.rawInputValue, n = t.compiledMasks.map((r, u) => {
1966
- const l = t.currentMask === r, c = l ? r.displayValue.length : r.nearestInputPos(r.displayValue.length, p.FORCE_LEFT);
1967
- return r.rawInputValue !== s ? (r.reset(), r.append(s, {
1968
- raw: !0
1969
- })) : l || r.remove(c), r.append(a, t.currentMaskFlags(e)), r.appendTail(i), {
1970
- index: u,
1971
- weight: r.rawInputValue.length,
1972
- totalInputPositions: r.totalInputPositions(0, Math.max(c, r.nearestInputPos(r.displayValue.length, p.FORCE_LEFT)))
1973
- };
1974
- });
1975
- return n.sort((r, u) => u.weight - r.weight || u.totalInputPositions - r.totalInputPositions), t.compiledMasks[n[0].index];
1976
- }
1977
- };
1978
- f.MaskedDynamic = $;
1979
- class z extends x {
1980
- constructor(t) {
1981
- super({
1982
- ...z.DEFAULTS,
1983
- ...t
1984
- });
1985
- }
1986
- updateOptions(t) {
1987
- super.updateOptions(t);
1988
- }
1989
- _update(t) {
1990
- const {
1991
- enum: e,
1992
- ...i
1993
- } = t;
1994
- if (e) {
1995
- const s = e.map((u) => u.length), n = Math.min(...s), r = Math.max(...s) - n;
1996
- i.mask = "*".repeat(n), r && (i.mask += "[" + "*".repeat(r) + "]"), this.enum = e;
1997
- }
1998
- super._update(i);
1999
- }
2000
- _appendCharRaw(t, e) {
2001
- e === void 0 && (e = {});
2002
- const i = Math.min(this.nearestInputPos(0, p.FORCE_RIGHT), this.value.length), s = this.enum.filter((n) => this.matchValue(n, this.unmaskedValue + t, i));
2003
- if (s.length) {
2004
- s.length === 1 && this._forEachBlocksInRange(0, this.value.length, (r, u) => {
2005
- const l = s[0][u];
2006
- u >= this.value.length || l === r.value || (r.reset(), r._appendChar(l, e));
2007
- });
2008
- const n = super._appendCharRaw(s[0][this.value.length], e);
2009
- return s.length === 1 && s[0].slice(this.unmaskedValue.length).split("").forEach((r) => n.aggregate(super._appendCharRaw(r))), n;
2010
- }
2011
- return new m({
2012
- skip: !this.isComplete
2013
- });
2014
- }
2015
- extractTail(t, e) {
2016
- return t === void 0 && (t = 0), e === void 0 && (e = this.displayValue.length), new y("", t);
2017
- }
2018
- remove(t, e) {
2019
- if (t === void 0 && (t = 0), e === void 0 && (e = this.displayValue.length), t === e) return new m();
2020
- const i = Math.min(super.nearestInputPos(0, p.FORCE_RIGHT), this.value.length);
2021
- let s;
2022
- for (s = t; s >= 0 && !(this.enum.filter((u) => this.matchValue(u, this.value.slice(i, s), i)).length > 1); --s)
2023
- ;
2024
- const n = super.remove(s, e);
2025
- return n.tailShift += s - t, n;
2026
- }
2027
- get isComplete() {
2028
- return this.enum.indexOf(this.value) >= 0;
2029
- }
2030
- }
2031
- z.DEFAULTS = {
2032
- ...x.DEFAULTS,
2033
- matchValue: (a, t, e) => a.indexOf(t, e) === e
2034
- };
2035
- f.MaskedEnum = z;
2036
- class wt extends v {
2037
- /** */
2038
- /** Enable characters overwriting */
2039
- /** */
2040
- /** */
2041
- /** */
2042
- updateOptions(t) {
2043
- super.updateOptions(t);
2044
- }
2045
- _update(t) {
2046
- super._update({
2047
- ...t,
2048
- validate: t.mask
2049
- });
2050
- }
2051
- }
2052
- f.MaskedFunction = wt;
2053
- var et;
2054
- class C extends v {
2055
- /** Single char */
2056
- /** Single char */
2057
- /** Array of single chars */
2058
- /** */
2059
- /** */
2060
- /** Digits after point */
2061
- /** Flag to remove leading and trailing zeros in the end of editing */
2062
- /** Flag to pad trailing zeros after point in the end of editing */
2063
- /** Enable characters overwriting */
2064
- /** */
2065
- /** */
2066
- /** */
2067
- /** Format typed value to string */
2068
- /** Parse string to get typed value */
2069
- constructor(t) {
2070
- super({
2071
- ...C.DEFAULTS,
2072
- ...t
2073
- });
2074
- }
2075
- updateOptions(t) {
2076
- super.updateOptions(t);
2077
- }
2078
- _update(t) {
2079
- super._update(t), this._updateRegExps();
2080
- }
2081
- _updateRegExps() {
2082
- const t = "^" + (this.allowNegative ? "[+|\\-]?" : ""), e = "\\d*", i = (this.scale ? "(" + P(this.radix) + "\\d{0," + this.scale + "})?" : "") + "$";
2083
- this._numberRegExp = new RegExp(t + e + i), this._mapToRadixRegExp = new RegExp("[" + this.mapToRadix.map(P).join("") + "]", "g"), this._thousandsSeparatorRegExp = new RegExp(P(this.thousandsSeparator), "g");
2084
- }
2085
- _removeThousandsSeparators(t) {
2086
- return t.replace(this._thousandsSeparatorRegExp, "");
2087
- }
2088
- _insertThousandsSeparators(t) {
2089
- const e = t.split(this.radix);
2090
- return e[0] = e[0].replace(/\B(?=(\d{3})+(?!\d))/g, this.thousandsSeparator), e.join(this.radix);
2091
- }
2092
- doPrepareChar(t, e) {
2093
- e === void 0 && (e = {});
2094
- const [i, s] = super.doPrepareChar(this._removeThousandsSeparators(this.scale && this.mapToRadix.length && /*
2095
- radix should be mapped when
2096
- 1) input is done from keyboard = flags.input && flags.raw
2097
- 2) unmasked value is set = !flags.input && !flags.raw
2098
- and should not be mapped when
2099
- 1) value is set = flags.input && !flags.raw
2100
- 2) raw value is set = !flags.input && flags.raw
2101
- */
2102
- (e.input && e.raw || !e.input && !e.raw) ? t.replace(this._mapToRadixRegExp, this.radix) : t), e);
2103
- return t && !i && (s.skip = !0), i && !this.allowPositive && !this.value && i !== "-" && s.aggregate(this._appendChar("-")), [i, s];
2104
- }
2105
- _separatorsCount(t, e) {
2106
- e === void 0 && (e = !1);
2107
- let i = 0;
2108
- for (let s = 0; s < t; ++s)
2109
- this._value.indexOf(this.thousandsSeparator, s) === s && (++i, e && (t += this.thousandsSeparator.length));
2110
- return i;
2111
- }
2112
- _separatorsCountFromSlice(t) {
2113
- return t === void 0 && (t = this._value), this._separatorsCount(this._removeThousandsSeparators(t).length, !0);
2114
- }
2115
- extractInput(t, e, i) {
2116
- return t === void 0 && (t = 0), e === void 0 && (e = this.displayValue.length), [t, e] = this._adjustRangeWithSeparators(t, e), this._removeThousandsSeparators(super.extractInput(t, e, i));
2117
- }
2118
- _appendCharRaw(t, e) {
2119
- e === void 0 && (e = {});
2120
- const i = e.tail && e._beforeTailState ? e._beforeTailState._value : this._value, s = this._separatorsCountFromSlice(i);
2121
- this._value = this._removeThousandsSeparators(this.value);
2122
- const n = this._value;
2123
- this._value += t;
2124
- const r = this.number;
2125
- let u = !isNaN(r), l = !1;
2126
- if (u) {
2127
- let b;
2128
- this.min != null && this.min < 0 && this.number < this.min && (b = this.min), this.max != null && this.max > 0 && this.number > this.max && (b = this.max), b != null && (this.autofix ? (this._value = this.format(b, this).replace(C.UNMASKED_RADIX, this.radix), l || (l = n === this._value && !e.tail)) : u = !1), u && (u = !!this._value.match(this._numberRegExp));
2129
- }
2130
- let c;
2131
- u ? c = new m({
2132
- inserted: this._value.slice(n.length),
2133
- rawInserted: l ? "" : t,
2134
- skip: l
2135
- }) : (this._value = n, c = new m()), this._value = this._insertThousandsSeparators(this._value);
2136
- const g = e.tail && e._beforeTailState ? e._beforeTailState._value : this._value, k = this._separatorsCountFromSlice(g);
2137
- return c.tailShift += (k - s) * this.thousandsSeparator.length, c;
2138
- }
2139
- _findSeparatorAround(t) {
2140
- if (this.thousandsSeparator) {
2141
- const e = t - this.thousandsSeparator.length + 1, i = this.value.indexOf(this.thousandsSeparator, e);
2142
- if (i <= t) return i;
2143
- }
2144
- return -1;
2145
- }
2146
- _adjustRangeWithSeparators(t, e) {
2147
- const i = this._findSeparatorAround(t);
2148
- i >= 0 && (t = i);
2149
- const s = this._findSeparatorAround(e);
2150
- return s >= 0 && (e = s + this.thousandsSeparator.length), [t, e];
2151
- }
2152
- remove(t, e) {
2153
- t === void 0 && (t = 0), e === void 0 && (e = this.displayValue.length), [t, e] = this._adjustRangeWithSeparators(t, e);
2154
- const i = this.value.slice(0, t), s = this.value.slice(e), n = this._separatorsCount(i.length);
2155
- this._value = this._insertThousandsSeparators(this._removeThousandsSeparators(i + s));
2156
- const r = this._separatorsCountFromSlice(i);
2157
- return new m({
2158
- tailShift: (r - n) * this.thousandsSeparator.length
2159
- });
2160
- }
2161
- nearestInputPos(t, e) {
2162
- if (!this.thousandsSeparator) return t;
2163
- switch (e) {
2164
- case p.NONE:
2165
- case p.LEFT:
2166
- case p.FORCE_LEFT: {
2167
- const i = this._findSeparatorAround(t - 1);
2168
- if (i >= 0) {
2169
- const s = i + this.thousandsSeparator.length;
2170
- if (t < s || this.value.length <= s || e === p.FORCE_LEFT)
2171
- return i;
2172
- }
2173
- break;
2174
- }
2175
- case p.RIGHT:
2176
- case p.FORCE_RIGHT: {
2177
- const i = this._findSeparatorAround(t);
2178
- if (i >= 0)
2179
- return i + this.thousandsSeparator.length;
2180
- }
2181
- }
2182
- return t;
2183
- }
2184
- doCommit() {
2185
- if (this.value) {
2186
- const t = this.number;
2187
- let e = t;
2188
- this.min != null && (e = Math.max(e, this.min)), this.max != null && (e = Math.min(e, this.max)), e !== t && (this.unmaskedValue = this.format(e, this));
2189
- let i = this.value;
2190
- this.normalizeZeros && (i = this._normalizeZeros(i)), this.padFractionalZeros && this.scale > 0 && (i = this._padFractionalZeros(i)), this._value = i;
2191
- }
2192
- super.doCommit();
2193
- }
2194
- _normalizeZeros(t) {
2195
- const e = this._removeThousandsSeparators(t).split(this.radix);
2196
- return e[0] = e[0].replace(/^(\D*)(0*)(\d*)/, (i, s, n, r) => s + r), t.length && !/\d$/.test(e[0]) && (e[0] = e[0] + "0"), e.length > 1 && (e[1] = e[1].replace(/0*$/, ""), e[1].length || (e.length = 1)), this._insertThousandsSeparators(e.join(this.radix));
2197
- }
2198
- _padFractionalZeros(t) {
2199
- if (!t) return t;
2200
- const e = t.split(this.radix);
2201
- return e.length < 2 && e.push(""), e[1] = e[1].padEnd(this.scale, "0"), e.join(this.radix);
2202
- }
2203
- doSkipInvalid(t, e, i) {
2204
- e === void 0 && (e = {});
2205
- const s = this.scale === 0 && t !== this.thousandsSeparator && (t === this.radix || t === C.UNMASKED_RADIX || this.mapToRadix.includes(t));
2206
- return super.doSkipInvalid(t, e, i) && !s;
2207
- }
2208
- get unmaskedValue() {
2209
- return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix, C.UNMASKED_RADIX);
2210
- }
2211
- set unmaskedValue(t) {
2212
- super.unmaskedValue = t;
2213
- }
2214
- get typedValue() {
2215
- return this.parse(this.unmaskedValue, this);
2216
- }
2217
- set typedValue(t) {
2218
- this.rawInputValue = this.format(t, this).replace(C.UNMASKED_RADIX, this.radix);
2219
- }
2220
- /** Parsed Number */
2221
- get number() {
2222
- return this.typedValue;
2223
- }
2224
- set number(t) {
2225
- this.typedValue = t;
2226
- }
2227
- get allowNegative() {
2228
- return this.min != null && this.min < 0 || this.max != null && this.max < 0;
2229
- }
2230
- get allowPositive() {
2231
- return this.min != null && this.min > 0 || this.max != null && this.max > 0;
2232
- }
2233
- typedValueEquals(t) {
2234
- return (super.typedValueEquals(t) || C.EMPTY_VALUES.includes(t) && C.EMPTY_VALUES.includes(this.typedValue)) && !(t === 0 && this.value === "");
2235
- }
2236
- }
2237
- et = C;
2238
- C.UNMASKED_RADIX = ".";
2239
- C.EMPTY_VALUES = [...v.EMPTY_VALUES, 0];
2240
- C.DEFAULTS = {
2241
- ...v.DEFAULTS,
2242
- mask: Number,
2243
- radix: ",",
2244
- thousandsSeparator: "",
2245
- mapToRadix: [et.UNMASKED_RADIX],
2246
- min: Number.MIN_SAFE_INTEGER,
2247
- max: Number.MAX_SAFE_INTEGER,
2248
- scale: 2,
2249
- normalizeZeros: !0,
2250
- padFractionalZeros: !1,
2251
- parse: Number,
2252
- format: (a) => a.toLocaleString("en-US", {
2253
- useGrouping: !1,
2254
- maximumFractionDigits: 20
2255
- })
2256
- };
2257
- f.MaskedNumber = C;
2258
- const G = {
2259
- MASKED: "value",
2260
- UNMASKED: "unmaskedValue",
2261
- TYPED: "typedValue"
2262
- };
2263
- function it(a, t, e) {
2264
- t === void 0 && (t = G.MASKED), e === void 0 && (e = G.MASKED);
2265
- const i = A(a);
2266
- return (s) => i.runIsolated((n) => (n[t] = s, n[e]));
2267
- }
2268
- function At(a, t, e, i) {
2269
- return it(t, e, i)(a);
2270
- }
2271
- f.PIPE_TYPE = G;
2272
- f.createPipe = it;
2273
- f.pipe = At;
2274
- class Ft extends x {
2275
- get repeatFrom() {
2276
- var t;
2277
- return (t = Array.isArray(this.repeat) ? this.repeat[0] : this.repeat === 1 / 0 ? 0 : this.repeat) != null ? t : 0;
2278
- }
2279
- get repeatTo() {
2280
- var t;
2281
- return (t = Array.isArray(this.repeat) ? this.repeat[1] : this.repeat) != null ? t : 1 / 0;
2282
- }
2283
- constructor(t) {
2284
- super(t);
2285
- }
2286
- updateOptions(t) {
2287
- super.updateOptions(t);
2288
- }
2289
- _update(t) {
2290
- var e, i, s;
2291
- const {
2292
- repeat: n,
2293
- ...r
2294
- } = I(t);
2295
- this._blockOpts = Object.assign({}, this._blockOpts, r);
2296
- const u = A(this._blockOpts);
2297
- this.repeat = (e = (i = n ?? u.repeat) != null ? i : this.repeat) != null ? e : 1 / 0, super._update({
2298
- mask: "m".repeat(Math.max(this.repeatTo === 1 / 0 && ((s = this._blocks) == null ? void 0 : s.length) || 0, this.repeatFrom)),
2299
- blocks: {
2300
- m: u
2301
- },
2302
- eager: u.eager,
2303
- overwrite: u.overwrite,
2304
- skipInvalid: u.skipInvalid,
2305
- lazy: u.lazy,
2306
- placeholderChar: u.placeholderChar,
2307
- displayChar: u.displayChar
2308
- });
2309
- }
2310
- _allocateBlock(t) {
2311
- if (t < this._blocks.length) return this._blocks[t];
2312
- if (this.repeatTo === 1 / 0 || this._blocks.length < this.repeatTo)
2313
- return this._blocks.push(A(this._blockOpts)), this.mask += "m", this._blocks[this._blocks.length - 1];
2314
- }
2315
- _appendCharRaw(t, e) {
2316
- e === void 0 && (e = {});
2317
- const i = new m();
2318
- for (
2319
- let l = (s = (n = this._mapPosToBlock(this.displayValue.length)) == null ? void 0 : n.index) != null ? s : Math.max(this._blocks.length - 1, 0), c, g;
2320
- // try to get a block or
2321
- // try to allocate a new block if not allocated already
2322
- c = (r = this._blocks[l]) != null ? r : g = !g && this._allocateBlock(l);
2323
- ++l
2324
- ) {
2325
- var s, n, r, u;
2326
- const k = c._appendChar(t, {
2327
- ...e,
2328
- _beforeTailState: (u = e._beforeTailState) == null || (u = u._blocks) == null ? void 0 : u[l]
2329
- });
2330
- if (k.skip && g) {
2331
- this._blocks.pop(), this.mask = this.mask.slice(1);
2332
- break;
2333
- }
2334
- if (i.aggregate(k), k.consumed) break;
2335
- }
2336
- return i;
2337
- }
2338
- _trimEmptyTail(t, e) {
2339
- var i, s;
2340
- t === void 0 && (t = 0);
2341
- const n = Math.max(((i = this._mapPosToBlock(t)) == null ? void 0 : i.index) || 0, this.repeatFrom, 0);
2342
- let r;
2343
- e != null && (r = (s = this._mapPosToBlock(e)) == null ? void 0 : s.index), r == null && (r = this._blocks.length - 1);
2344
- let u = 0;
2345
- for (let l = r; n <= l && !this._blocks[l].unmaskedValue; --l, ++u)
2346
- ;
2347
- u && (this._blocks.splice(r - u + 1, u), this.mask = this.mask.slice(u));
2348
- }
2349
- reset() {
2350
- super.reset(), this._trimEmptyTail();
2351
- }
2352
- remove(t, e) {
2353
- t === void 0 && (t = 0), e === void 0 && (e = this.displayValue.length);
2354
- const i = super.remove(t, e);
2355
- return this._trimEmptyTail(t, e), i;
2356
- }
2357
- totalInputPositions(t, e) {
2358
- return t === void 0 && (t = 0), e == null && this.repeatTo === 1 / 0 ? 1 / 0 : super.totalInputPositions(t, e);
2359
- }
2360
- get state() {
2361
- return super.state;
2362
- }
2363
- set state(t) {
2364
- this._blocks.length = t._blocks.length, this.mask = this.mask.slice(0, this._blocks.length), super.state = t;
2365
- }
2366
- }
2367
- f.RepeatBlock = Ft;
2368
- try {
2369
- globalThis.IMask = f;
2370
- } catch {
2371
- }
2372
- class Bt {
2373
- constructor(t) {
2374
- this.host = t, this.host.addController(this);
2375
- }
2376
- hostConnected() {
2377
- }
2378
- hostDisconnected() {
2379
- }
2380
- hostUpdated() {
2381
- }
2382
- sync() {
2383
- if (!this.host.input)
2384
- return;
2385
- if (!this.host.autoGrow || this.host.type === "file") {
2386
- this.host.input.style.removeProperty("width"), this.host.input.style.removeProperty("min-width");
2387
- return;
2388
- }
2389
- const t = this.host.value || this.host.placeholder || " ", e = this.measureWidth(t);
2390
- if (e <= 0) {
2391
- this.host.input.style.removeProperty("width"), this.host.input.style.removeProperty("min-width");
2392
- return;
2393
- }
2394
- this.host.input.style.width = `${e}px`, this.host.input.style.removeProperty("min-width");
2395
- }
2396
- measureWidth(t) {
2397
- return this.host.autoGrowMirror ? (this.host.autoGrowMirror.textContent = t || " ", Math.ceil(this.host.autoGrowMirror.getBoundingClientRect().width)) : 0;
2398
- }
2399
- }
2400
- const St = ft`:host{line-height:normal;display:block}:host([data-user-invalid])::part(base){border-color:var(--cx-input-invalid-border-color)}:host([data-user-invalid]:focus-within)::part(base){border-color:var(--cx-input-invalid-border-color);box-shadow:var(--cx-input-invalid-shadow)}.input{width:100%;font-family:var(--cx-input-font-family);font-weight:var(--cx-input-font-weight);letter-spacing:var(--cx-input-letter-spacing);vertical-align:middle;cursor:text;transition:var(--cx-transition-fast) color, var(--cx-transition-fast) border, var(--cx-transition-fast) box-shadow, var(--cx-transition-fast) background-color;flex:auto;justify-content:start;align-items:stretch;display:inline-flex;position:relative;overflow:hidden}.input--auto-grow{flex:0 auto;width:auto;max-width:100%}.input--standard{background-color:var(--cx-input-background-color);border:solid var(--cx-input-border-width) var(--cx-input-border-color)}.input--standard:hover:not(.input--disabled){background-color:var(--cx-input-background-color-hover);border-color:var(--cx-input-border-color-hover)}.input--standard.input--focused:not(.input--disabled){background-color:var(--cx-input-background-color-focus);border-color:var(--cx-input-border-color-focus)}.input--standard.input--focused:not(.input--disabled) .input__control{color:var(--cx-input-color-focus)}.input--standard.input--disabled{background-color:var(--cx-input-background-color-disabled);border-color:var(--cx-input-border-color-disabled);opacity:.5;cursor:default}.input--standard.input--disabled .input__control{color:var(--cx-input-color-disabled)}.input--standard.input--disabled .input__control::placeholder{color:var(--cx-input-placeholder-color-disabled)}.input--filled{background-color:var(--cx-input-filled-background-color);color:var(--cx-input-color);border:none}.input--filled:hover:not(.input--disabled){background-color:var(--cx-input-filled-background-color-hover)}.input--filled.input--focused:not(.input--disabled){background-color:var(--cx-input-filled-background-color-focus);outline:var(--cx-focus-ring);outline-offset:var(--cx-focus-ring-offset)}.input--filled.input--disabled{background-color:var(--cx-input-filled-background-color-disabled);opacity:.5;cursor:default}.input__control{font:inherit;min-width:0;color:var(--cx-input-color);background:inherit;box-shadow:none;cursor:inherit;-webkit-appearance:none;line-height:var(--cx-line-height-medium);border:none;margin:0;padding:0}.input__auto-grow-mirror{visibility:hidden;white-space:pre;pointer-events:none;box-sizing:border-box;font:inherit;letter-spacing:inherit;line-height:var(--cx-line-height-medium);border:0;margin:0;padding:0;position:absolute}.form-control--has-label .input__control,.form-control--has-label .input__auto-grow-mirror{padding-top:var(--cx-spacing-x-small);padding-bottom:var(--cx-spacing-2x-small)}.input__control::-webkit-search-decoration,.input__control::-webkit-search-cancel-button,.input__control::-webkit-search-results-button,.input__control::-webkit-search-results-decoration{-webkit-appearance:none}.input__control:-webkit-autofill,.input__control:-webkit-autofill:hover,.input__control:-webkit-autofill:focus,.input__control:-webkit-autofill:active{-webkit-text-fill-color:var(--cx-color-primary-500);caret-color:var(--cx-input-color);box-shadow:0 0 0 var(--cx-input-height-large) var(--cx-input-background-color-hover) inset!important}.input--filled .input__control:-webkit-autofill,.input--filled .input__control:-webkit-autofill:hover,.input--filled .input__control:-webkit-autofill:focus,.input--filled .input__control:-webkit-autofill:active{box-shadow:0 0 0 var(--cx-input-height-large) var(--cx-input-filled-background-color) inset!important}.input__control::placeholder{color:var(--cx-input-placeholder-color);-webkit-user-select:none;user-select:none}.input:hover:not(.input--disabled) .input__control{color:var(--cx-input-color-hover)}.input__control:focus{outline:none}.input__prefix,.input__suffix{cursor:default;flex:none;align-items:center;display:inline-flex}.input__prefix ::slotted(cx-icon),.input__suffix ::slotted(cx-icon){color:var(--cx-input-icon-color)}.input__character-count{color:var(--cx-input-suffix-color,var(--cx-input-color));font-size:var(--cx-input-font-size);font-weight:var(--cx-input-font-weight);letter-spacing:var(--cx-input-letter-spacing);line-height:var(--cx-input-line-height);padding-inline-end:var(--cx-spacing-x-small);padding-top:var(--cx-spacing-2x-small);white-space:nowrap;justify-content:flex-end;align-items:center;display:flex}.input--small{border-radius:var(--cx-input-border-radius-small);font-size:var(--cx-input-font-size-small);min-height:var(--cx-input-height-small)}.input--small .input__control,.input--small .input__auto-grow-mirror{padding-left:var(--cx-input-spacing-small);padding-right:var(--cx-input-spacing-small)}.input--small .input__clear,.input--small .input__password-toggle{width:calc(1em + var(--cx-spacing-x-small) * 2)}.input--small .input__prefix ::slotted(*){margin-inline-start:var(--cx-spacing-x-small)}.input--small .input__suffix ::slotted(*){margin-inline-end:var(--cx-spacing-x-small)}.input--small .input__control--file{gap:calc(var(--cx-input-spacing-small) / 2);padding-top:var(--cx-spacing-x-small);padding-bottom:var(--cx-spacing-x-small)}.input--medium{border-radius:var(--cx-input-border-radius-medium);font-size:var(--cx-input-font-size-small);min-height:var(--cx-input-height-medium)}.input--medium .input__control,.input--medium .input__auto-grow-mirror{padding-left:var(--cx-input-spacing-medium);padding-right:var(--cx-input-spacing-medium)}.input--medium .input__clear,.input--medium .input__password-toggle{width:calc(1em + var(--cx-spacing-x-small) * 2)}.input--medium .input__prefix ::slotted(*){margin-inline-start:var(--cx-spacing-x-small)}.input--medium .input__suffix ::slotted(*){margin-inline-end:var(--cx-spacing-x-small)}.input--medium .input__control--file{gap:calc(var(--cx-input-spacing-medium) / 2)}.input--large{border-radius:var(--cx-input-border-radius-large);font-size:var(--cx-input-font-size-small);min-height:var(--cx-input-height-large)}.input--large .input__control,.input--large .input__auto-grow-mirror{padding-left:var(--cx-input-spacing-large);padding-right:var(--cx-input-spacing-large)}.input--large .input__clear,.input--large .input__password-toggle{width:calc(1em + var(--cx-input-spacing-small) * 2)}.input--large .input__prefix ::slotted(*){margin-inline-start:var(--cx-input-spacing-small)}.input--large .input__suffix ::slotted(*){margin-inline-end:var(--cx-input-spacing-small)}.input--large .input__control--file{gap:calc(var(--cx-input-spacing-large) / 2)}.input--button-only{border:0;align-items:center;padding:0}.input--button-only .input__control--file{border:0;padding:0}.input--button-only .input-container{display:none}.input--pill.input--small{border-radius:var(--cx-input-height-small)}.input--pill.input--medium{border-radius:var(--cx-input-height-medium)}.input--pill.input--large{border-radius:var(--cx-input-height-large)}.input__clear,.input__password-toggle{font-size:inherit;color:var(--cx-input-icon-color);transition:var(--cx-transition-fast) color;cursor:pointer;background:0 0;border:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.input__clear:hover,.input__password-toggle:hover{color:var(--cx-input-icon-color-hover)}.input__clear:focus,.input__password-toggle:focus{outline:none}::-ms-reveal{display:none}.input--no-spin-buttons input[type=number]::-webkit-outer-spin-button,.input--no-spin-buttons input[type=number]::-webkit-inner-spin-button{-webkit-appearance:none;display:none}.input--no-spin-buttons input[type=number]{-moz-appearance:textfield}input[type=file]{display:none}.input-container{flex-direction:column;flex:1;justify-content:center;width:0;display:inline-flex;position:relative}.input-container--auto-grow{flex:0 auto;width:auto}.input__control--auto-grow{min-width:var(--cx-input-auto-grow-min-width,0);max-width:100%}.form-control__label{pointer-events:none;width:fit-content;text-transform:var(--cx-input-label-text-transform,none);line-height:1;-webkit-transition:transform .2s ease-in-out;-moz-transition:transform .2s ease-in-out;transition:transform .2s ease-in-out;position:relative}.form-control--has-label .input--small .form-control__label{padding:0 var(--cx-input-spacing-small);transform:translateY(calc(( var(--cx-input-height-small) + 1.25rem - var(--cx-input-font-size-small) ) / 2));margin:0}.form-control--has-label .input--medium .form-control__label{padding:0 var(--cx-input-spacing-medium);transform:translateY(calc(( var(--cx-input-height-medium) + 1rem - var(--cx-input-font-size-medium) ) / 2));margin:0}.form-control--has-label .input--large .form-control__label{padding:0 var(--cx-input-spacing-large);transform:translateY(calc(( var(--cx-input-height-large) + 1rem - var(--cx-input-font-size-large) ) / 2));margin:0}.form-control--has-label .input--small,.form-control--file .input--small{min-height:calc(var(--cx-input-height-small) + 1rem)}.form-control--has-label .input--medium,.form-control--file .input--medium{min-height:calc(var(--cx-input-height-medium) + 1rem)}.form-control--has-label .input--large,.form-control--file .input--large{min-height:calc(var(--cx-input-height-large) + 1rem)}.form-control--has-label .input--focused .form-control__label,.form-control--has-label .input--has-placeholder .form-control__label,.form-control--has-label .input:not(.input--empty) .form-control__label{transform:translateY(calc(var(--cx-spacing-2x-small) + var(--cx-spacing-3x-small)))}.input__control--file{flex-direction:row;align-items:center;width:100%;height:100%;margin-block:0;display:flex;text-align:start!important}.input__control--file span{text-overflow:ellipsis;white-space:nowrap;flex:auto;overflow:hidden}:host([data-cx-input-group__input--first]:not([data-cx-input-group__input--last])) .input{border-start-end-radius:0;border-end-end-radius:0}:host([data-cx-input-group__input--inner]) .input{border-radius:0}:host([data-cx-input-group__input--last]:not([data-cx-input-group__input--first])) .input{border-start-start-radius:0;border-end-start-radius:0}:host([data-cx-input-group__input]:not([data-cx-input-group__input--first])){margin-inline-start:calc(-1 * var(--cx-input-border-width))}:host([data-cx-input-group__input--hover]){z-index:1}:host([data-cx-input-group__input--focus]),:host([data-cx-input-group__input][checked]){z-index:2}`;
2401
- var It = Object.defineProperty, Vt = Object.getOwnPropertyDescriptor, st = (a) => {
2402
- throw TypeError(a);
2403
- }, h = (a, t, e, i) => {
2404
- for (var s = i > 1 ? void 0 : i ? Vt(t, e) : t, n = a.length - 1, r; n >= 0; n--)
2405
- (r = a[n]) && (s = (i ? r(t, e, s) : r(s)) || s);
2406
- return i && s && It(t, e, s), s;
2407
- }, Dt = (a, t, e) => t.has(a) || st("Cannot " + e), Mt = (a, t, e) => (Dt(a, t, "read from private field"), e ? e.call(a) : t.get(a)), Tt = (a, t, e) => t.has(a) ? st("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(a) : t.set(a, e), H, nt;
2408
- let o = class extends rt {
2409
- constructor() {
2410
- super(), Tt(this, H), this.formControlController = new pt(this, {
2411
- assumeInteractionOn: ["cx-input"]
2412
- }), this.hasSlotController = new dt(
2413
- this,
2414
- "help-text",
2415
- "label"
2416
- ), this.localize = new ct(this), this.autoGrowController = new Bt(this), this.hasFocus = !1, this.maskInstance = null, this.containerClicked = !1, this.title = "", this.__numberInput = Object.assign(
2417
- document.createElement("input"),
2418
- {
2419
- type: "number"
2420
- }
2421
- ), this.__dateInput = Object.assign(
2422
- document.createElement("input"),
2423
- {
2424
- type: "date"
2425
- }
2426
- ), this.type = "text", this.name = "", this.value = "", this.autoGrow = !1, this.unmaskedValue = "", this.defaultValue = "", this.size = "medium", this.filled = !1, this.pill = !1, this.label = "", this.helpText = "", this.clearable = !1, this.disabled = !1, this.placeholder = "", this.readonly = !1, this.passwordToggle = !1, this.passwordVisible = !1, this.noSpinButtons = !1, this.form = void 0, this.required = !1, this.showLength = !1, this.autocomplete = "off", this.autoFocus = !1, this.spellCheck = !0, this.maskPlaceholder = "_", this.maskLazy = !1, this.maskOverwrite = !1, this.maskBlocks = void 0, this.variant = "default", this.fileButtonLabel = "Choose file", this.buttonOnly = !1, this.fileResultLabel = (a) => {
2427
- let t = "No file chosen";
2428
- return a?.length && (a.length === 1 ? t = a[0].name : a.length > 1 && (t = `${a.length} files`)), t;
2429
- }, this.handleMaskAccept = this.handleMaskAccept.bind(this);
2430
- }
2431
- // #endregion
2432
- //
2433
- // NOTE: We use an in-memory input for these getters/setters instead of the one in the template because the properties
2434
- // can be set before the component is rendered.
2435
- //
2436
- /**
2437
- * Gets or sets the current value as a `Date` object. Returns `null` if the value can't be converted. This will use the native `<input type="{{type}}">` implementation and may result in an error.
2438
- */
2439
- get valueAsDate() {
2440
- return this.__dateInput.type = this.type, this.__dateInput.value = this.value, this.input?.valueAsDate || this.__dateInput.valueAsDate;
2441
- }
2442
- set valueAsDate(a) {
2443
- this.__dateInput.type = this.type, this.__dateInput.valueAsDate = a, this.value = this.__dateInput.value;
2444
- }
2445
- /** Gets or sets the current value as a number. Returns `NaN` if the value can't be converted. */
2446
- get valueAsNumber() {
2447
- return this.__numberInput.value = this.value, this.input?.valueAsNumber || this.__numberInput.valueAsNumber;
2448
- }
2449
- set valueAsNumber(a) {
2450
- this.__numberInput.valueAsNumber = a, this.value = this.__numberInput.value;
2451
- }
2452
- /** Gets the validity state object */
2453
- get validity() {
2454
- return this.input?.validity ?? this.__numberInput.validity;
2455
- }
2456
- /** Gets the validation message */
2457
- get validationMessage() {
2458
- return this.input?.validationMessage ?? "";
2459
- }
2460
- connectedUpdatedCallback() {
2461
- this.initMaskInstance(), this.formControlController.updateValidity(), this.autoGrowController.sync();
2462
- }
2463
- disconnectedCallback() {
2464
- super.disconnectedCallback(), this.maskInstance?.off("accept", this.handleMaskAccept), this.maskInstance?.destroy();
2465
- }
2466
- async initMaskInstance() {
2467
- if (await this.updateComplete, this.maskInstance && (this.maskInstance.off("accept", this.handleMaskAccept), this.maskInstance.destroy(), this.maskInstance = null), this.mask && this.input) {
2468
- const a = {
2469
- blocks: this.maskBlocks,
2470
- lazy: this.maskLazy,
2471
- mask: this.mask,
2472
- overwrite: this.maskOverwrite,
2473
- placeholderChar: this.maskPlaceholder
2474
- };
2475
- this.maskInstance = f(this.input, a);
2476
- const t = this.value;
2477
- this.value = this.maskInstance.value, this.unmaskedValue = this.maskInstance.unmaskedValue, t !== this.value && this.emit("cx-change"), this.maskInstance.on("accept", this.handleMaskAccept);
2478
- }
2479
- }
2480
- handleBlur() {
2481
- if (this.containerClicked) {
2482
- this.containerClicked = !1, this.focus();
2483
- return;
2484
- }
2485
- this.hasFocus = !1, this.emit("cx-blur");
2486
- }
2487
- handleChange() {
2488
- this.value = this.input.value, this.emit("cx-change");
2489
- }
2490
- handleClearClick(a) {
2491
- a.preventDefault(), this.value !== "" && (this.value = "", this.emit("cx-clear"), this.emit("cx-input"), this.emit("cx-change")), this.input.focus();
2492
- }
2493
- handleFocus() {
2494
- this.hasFocus = !0, this.emit("cx-focus");
2495
- }
2496
- // Two different handlers for input with and without mask.
2497
- // handleMaskAccept is registered to this.maskInstance inside firstUpdated()
2498
- handleMaskAccept() {
2499
- this.maskInstance && (this.value = this.maskInstance.value, this.unmaskedValue = this.maskInstance.unmaskedValue, this.formControlController.updateValidity(), this.emit("cx-input"));
2500
- }
2501
- // handleInput is registered to the input element inside render()
2502
- handleInput() {
2503
- this.maskInstance || (this.value = this.input.value, this.unmaskedValue = this.input.value, this.formControlController.updateValidity(), this.emit("cx-input"));
2504
- }
2505
- handleInvalid(a) {
2506
- this.formControlController.setValidity(!1), this.formControlController.emitInvalidEvent(a);
2507
- }
2508
- handleKeyDown(a) {
2509
- const t = a.metaKey || a.ctrlKey || a.shiftKey || a.altKey;
2510
- a.key === "Enter" && !t && setTimeout(() => {
2511
- !a.defaultPrevented && !a.isComposing && this.formControlController.submit();
2512
- }), a.ctrlKey && a.key === "a" && this.input.select(), this.emit("cx-keydown", { detail: { event: a, value: this.value } });
2513
- }
2514
- handlePasswordToggle() {
2515
- this.passwordVisible = !this.passwordVisible;
2516
- }
2517
- handleFileButtonClick() {
2518
- this.input.click();
2519
- }
2520
- handleContainerMouseDown(a) {
2521
- const t = a.composedPath();
2522
- t.includes(this.inputContainer) && !t.includes(this.input) ? (this.containerClicked = !0, this.focus()) : this.containerClicked = !1;
2523
- }
2524
- handleDisabledChange() {
2525
- this.formControlController.setValidity(this.disabled);
2526
- }
2527
- handleStepChange() {
2528
- this.input.step = String(this.step), this.formControlController.updateValidity();
2529
- }
2530
- async handleValueChange() {
2531
- await this.updateComplete, this.formControlController.updateValidity(), this.maskInstance?.el && this.value !== this.maskInstance?.value && this.maskInstance.updateValue(), this.autoGrowController.sync();
2532
- }
2533
- async handleAutoGrowChange() {
2534
- await this.updateComplete, this.autoGrowController.sync();
2535
- }
2536
- /** Sets focus on the input. */
2537
- focus(a) {
2538
- this.input.focus(a);
2539
- }
2540
- /** Removes focus from the input. */
2541
- blur() {
2542
- this.input.blur();
2543
- }
2544
- /** Selects all the text in the input. */
2545
- select() {
2546
- this.input.select();
2547
- }
2548
- /** Sets the start and end positions of the text selection (0-based). */
2549
- setSelectionRange(a, t, e = "none") {
2550
- this.input.setSelectionRange(
2551
- a,
2552
- t,
2553
- e
2554
- );
2555
- }
2556
- /** Replaces a range of text with a new string. */
2557
- setRangeText(a, t, e, i = "preserve") {
2558
- const s = t ?? this.input.selectionStart, n = e ?? this.input.selectionEnd;
2559
- this.input.setRangeText(
2560
- a,
2561
- s,
2562
- n,
2563
- i
2564
- ), this.value !== this.input.value && (this.value = this.input.value);
2565
- }
2566
- /** Displays the browser picker for an input element (only works if the browser supports it for the input type). */
2567
- showPicker() {
2568
- "showPicker" in HTMLInputElement.prototype && this.input.showPicker();
2569
- }
2570
- /** Increments the value of a numeric input type by the value of the step attribute. */
2571
- stepUp() {
2572
- this.input.stepUp(), this.value !== this.input.value && (this.value = this.input.value);
2573
- }
2574
- /** Decrements the value of a numeric input type by the value of the step attribute. */
2575
- stepDown() {
2576
- this.input.stepDown(), this.value !== this.input.value && (this.value = this.input.value);
2577
- }
2578
- /** Checks for validity but does not show a validation message. Returns `true` when valid and `false` when invalid. */
2579
- checkValidity() {
2580
- return this.input.checkValidity();
2581
- }
2582
- /** Gets the associated form, if one exists. */
2583
- getForm() {
2584
- return this.formControlController.getForm();
2585
- }
2586
- /** Checks for validity and shows the browser's validation message if the control is invalid. */
2587
- reportValidity() {
2588
- return this.input.reportValidity();
2589
- }
2590
- /** Sets a custom validation message. Pass an empty string to restore validity. */
2591
- setCustomValidity(a) {
2592
- this.input.setCustomValidity(a), this.formControlController.updateValidity();
2593
- }
2594
- render() {
2595
- const a = this.hasSlotController.test("label"), t = this.hasSlotController.test("help-text"), e = this.label ? !0 : !!a, i = this.helpText ? !0 : !!t, n = this.clearable && !this.disabled && !this.readonly && (typeof this.value == "number" || this.value.length > 0), r = this.autoGrow && this.type !== "file", u = typeof this.fileResultLabel == "function" ? this.fileResultLabel(Mt(this, H, nt)) : this.fileResultLabel;
2596
- return E`<div part="form-control" class=${S({
2597
- "form-control": !0,
2598
- "form-control--file": this.type === "file",
2599
- "form-control--has-help-text": i,
2600
- "form-control--has-label": e,
2601
- "form-control--large": this.size === "large",
2602
- "form-control--medium": this.size === "medium",
2603
- "form-control--small": this.size === "small"
2604
- })}><div part="form-control-input" class="form-control-input"><div part="base" class=${S({
2605
- input: !0,
2606
- "input--auto-grow": r,
2607
- "input--button-only": this.buttonOnly,
2608
- "input--disabled": this.disabled,
2609
- "input--empty": !this.value,
2610
- "input--filled": this.filled,
2611
- "input--focused": this.hasFocus,
2612
- "input--has-placeholder": !!this.placeholder,
2613
- "input--large": this.size === "large",
2614
- "input--medium": this.size === "medium",
2615
- "input--no-spin-buttons": this.noSpinButtons,
2616
- // States
2617
- "input--pill": this.pill,
2618
- "input--small": this.size === "small",
2619
- "input--standard": !this.filled
2620
- })}><span part="prefix" class="input__prefix"><slot name="prefix"></slot></span><span class=${S({
2621
- "input-container": !0,
2622
- "input-container--auto-grow": r
2623
- })} @mousedown=${this.handleContainerMouseDown}><label part="form-control-label" class=${S({
2624
- "form-control__label": !0,
2625
- "form-control__label--empty": !this.value
2626
- })} for="input" aria-hidden=${e ? "false" : "true"}><slot name="label" part="label">${this.label}</slot></label><input part="input" id="input" class=${S({
2627
- input__control: !0,
2628
- "input__control--auto-grow": r
2629
- })} type=${this.type === "password" && this.passwordVisible ? "text" : this.type} title=${this.title} aria-label=${_(this.ariaLabel)} name=${_(this.name)} ?disabled=${this.disabled} ?readonly=${this.readonly} ?required=${this.required} placeholder=${_(this.placeholder)} minlength=${_(this.minlength)} maxlength=${_(this.maxlength)} min=${_(this.min)} max=${_(this.max)} step=${_(this.step)} autocapitalize=${_(this.autocapitalize)} autocomplete=${_(this.autocomplete)} autocorrect=${_(this.autoCorrect)} ?autofocus=${this.autoFocus} spellcheck=${this.spellCheck} pattern=${_(this.pattern)} enterkeyhint=${_(this.enterKeyHint)} inputmode=${_(this.inputMode)} aria-describedby="help-text" .value=${mt(this.value)} @change=${this.handleChange} @input=${this.handleInput} @invalid=${this.handleInvalid} @keydown=${this.handleKeyDown} @focus=${this.handleFocus} @blur=${this.handleBlur} accept=${_(this.accept)} ?multiple=${this.multiple}>${Y(
2630
- r,
2631
- () => E`<span part="auto-grow-mirror" class="input__auto-grow-mirror" aria-hidden="true"></span>`
2632
- )}
2633
- ${this.type === "file" && !this.buttonOnly ? E`<div class="input__control input__control--file" part="file-control" @click=${this.handleFileButtonClick}><slot name="file-button"><cx-button part="file-button" variant=${_(this.variant)} size=${_(this.size)} ?disabled=${this.disabled}>${this.fileButtonLabel}</cx-button></slot><span part="file-result">${u}</span></div>` : ""}</span>${this.type === "file" && this.buttonOnly ? E`<div class="input__control input__control--file" part="file-control" @click=${this.handleFileButtonClick}><slot name="file-button"><cx-button part="file-button" variant=${_(this.variant)} size=${_(this.size)} ?disabled=${this.disabled}>${this.fileButtonLabel}</cx-button></slot></div>` : ""}
2634
- ${n ? E`<button part="clear-button" class="input__clear" type="button" aria-label=${this.localize.term("clearEntry")} @click=${this.handleClearClick} tabindex="-1"><slot name="clear-icon"><cx-icon name="close"></cx-icon></slot></button>` : ""}
2635
- ${this.passwordToggle && !this.disabled ? E`<button part="password-toggle-button" class="input__password-toggle" type="button" aria-label=${this.localize.term(
2636
- this.passwordVisible ? "hidePassword" : "showPassword"
2637
- )} @click=${this.handlePasswordToggle} tabindex="-1">${this.passwordVisible ? E`<slot name="show-password-icon"><cx-icon name="visibility_off" library="system"></cx-icon></slot>` : E`<slot name="hide-password-icon"><cx-icon name="visibility" library="system"></cx-icon></slot>`}</button>` : ""}<span part="suffix" class="input__suffix"><slot name="suffix"></slot></span></div>${Y(this.showLength, () => E`<div part="character-count" class="input__character-count">${[
2638
- this.minlength && `${this.minlength} /`,
2639
- this.value.length,
2640
- this.maxlength && `/ ${this.maxlength}`
2641
- ].filter(Boolean).join(" ")}</div>`)}</div><div part="form-control-help-text" id="help-text" class="form-control__help-text" aria-hidden=${i ? "false" : "true"}><slot name="help-text">${this.helpText}</slot></div></div>`;
2642
- }
2643
- };
2644
- H = /* @__PURE__ */ new WeakSet();
2645
- nt = function() {
2646
- return this.input?.files;
2647
- };
2648
- o.styles = [
2649
- ut,
2650
- ot,
2651
- St
2652
- ];
2653
- o.dependencies = { "cx-icon": gt };
2654
- h([
2655
- O(".input__control")
2656
- ], o.prototype, "input", 2);
2657
- h([
2658
- O(".input__auto-grow-mirror")
2659
- ], o.prototype, "autoGrowMirror", 2);
2660
- h([
2661
- O(".input-container")
2662
- ], o.prototype, "inputContainer", 2);
2663
- h([
2664
- O(".form-control__label")
2665
- ], o.prototype, "labelElement", 2);
2666
- h([
2667
- j()
2668
- ], o.prototype, "hasFocus", 2);
2669
- h([
2670
- j()
2671
- ], o.prototype, "maskInstance", 2);
2672
- h([
2673
- j()
2674
- ], o.prototype, "containerClicked", 2);
2675
- h([
2676
- d()
2677
- ], o.prototype, "title", 2);
2678
- h([
2679
- d({ reflect: !0 })
2680
- ], o.prototype, "type", 2);
2681
- h([
2682
- d()
2683
- ], o.prototype, "name", 2);
2684
- h([
2685
- d()
2686
- ], o.prototype, "value", 2);
2687
- h([
2688
- d({ attribute: "auto-grow", type: Boolean })
2689
- ], o.prototype, "autoGrow", 2);
2690
- h([
2691
- d({ attribute: "unmasked-value", reflect: !0, type: String })
2692
- ], o.prototype, "unmaskedValue", 2);
2693
- h([
2694
- ht()
2695
- ], o.prototype, "defaultValue", 2);
2696
- h([
2697
- d({ reflect: !0 })
2698
- ], o.prototype, "size", 2);
2699
- h([
2700
- d({ reflect: !0, type: Boolean })
2701
- ], o.prototype, "filled", 2);
2702
- h([
2703
- d({ reflect: !0, type: Boolean })
2704
- ], o.prototype, "pill", 2);
2705
- h([
2706
- d()
2707
- ], o.prototype, "label", 2);
2708
- h([
2709
- d({ attribute: "help-text" })
2710
- ], o.prototype, "helpText", 2);
2711
- h([
2712
- d({ type: Boolean })
2713
- ], o.prototype, "clearable", 2);
2714
- h([
2715
- d({ reflect: !0, type: Boolean })
2716
- ], o.prototype, "disabled", 2);
2717
- h([
2718
- d()
2719
- ], o.prototype, "placeholder", 2);
2720
- h([
2721
- d({ reflect: !0, type: Boolean })
2722
- ], o.prototype, "readonly", 2);
2723
- h([
2724
- d({ attribute: "password-toggle", type: Boolean })
2725
- ], o.prototype, "passwordToggle", 2);
2726
- h([
2727
- d({ attribute: "password-visible", type: Boolean })
2728
- ], o.prototype, "passwordVisible", 2);
2729
- h([
2730
- d({ attribute: "no-spin-buttons", type: Boolean })
2731
- ], o.prototype, "noSpinButtons", 2);
2732
- h([
2733
- d({ reflect: !1 })
2734
- ], o.prototype, "form", 2);
2735
- h([
2736
- d({ reflect: !0, type: Boolean })
2737
- ], o.prototype, "required", 2);
2738
- h([
2739
- d()
2740
- ], o.prototype, "pattern", 2);
2741
- h([
2742
- d({ type: Number })
2743
- ], o.prototype, "minlength", 2);
2744
- h([
2745
- d({ type: Number })
2746
- ], o.prototype, "maxlength", 2);
2747
- h([
2748
- d({ attribute: "show-length", type: Boolean })
2749
- ], o.prototype, "showLength", 2);
2750
- h([
2751
- d()
2752
- ], o.prototype, "min", 2);
2753
- h([
2754
- d()
2755
- ], o.prototype, "max", 2);
2756
- h([
2757
- d()
2758
- ], o.prototype, "step", 2);
2759
- h([
2760
- d({ attribute: "autocapitalize", reflect: !0, type: String })
2761
- ], o.prototype, "autoCapitalize", 2);
2762
- h([
2763
- d({ attribute: "autocorrect", reflect: !0, type: String })
2764
- ], o.prototype, "autoCorrect", 2);
2765
- h([
2766
- d()
2767
- ], o.prototype, "autocomplete", 2);
2768
- h([
2769
- d({ attribute: "autofocus", type: Boolean })
2770
- ], o.prototype, "autoFocus", 2);
2771
- h([
2772
- d({ attribute: "enterkeyhint", reflect: !0, type: String })
2773
- ], o.prototype, "enterKeyHint", 2);
2774
- h([
2775
- d({
2776
- attribute: "spellcheck",
2777
- converter: {
2778
- // Allow "true|false" attribute values but keep the property boolean
2779
- fromAttribute: (a) => !(!a || a === "false"),
2780
- toAttribute: (a) => a ? "true" : "false"
2781
- },
2782
- reflect: !0,
2783
- type: Boolean
2784
- })
2785
- ], o.prototype, "spellCheck", 2);
2786
- h([
2787
- d({ attribute: "inputmode", reflect: !0, type: String })
2788
- ], o.prototype, "inputMode", 2);
2789
- h([
2790
- d()
2791
- ], o.prototype, "mask", 2);
2792
- h([
2793
- d({ attribute: "mask-placeholder" })
2794
- ], o.prototype, "maskPlaceholder", 2);
2795
- h([
2796
- d({ attribute: "mask-lazy", type: Boolean })
2797
- ], o.prototype, "maskLazy", 2);
2798
- h([
2799
- d({
2800
- attribute: "mask-overwrite",
2801
- converter: {
2802
- fromAttribute: (a) => a === "shift" ? a : a !== void 0,
2803
- toAttribute: (a) => a
2804
- }
2805
- })
2806
- ], o.prototype, "maskOverwrite", 2);
2807
- h([
2808
- d({ attribute: "mask-blocks", type: Object })
2809
- ], o.prototype, "maskBlocks", 2);
2810
- h([
2811
- d()
2812
- ], o.prototype, "accept", 2);
2813
- h([
2814
- d({ type: Boolean })
2815
- ], o.prototype, "multiple", 2);
2816
- h([
2817
- d({ reflect: !0 })
2818
- ], o.prototype, "variant", 2);
2819
- h([
2820
- d({ attribute: "file-button-label" })
2821
- ], o.prototype, "fileButtonLabel", 2);
2822
- h([
2823
- d({ attribute: "button-only", type: Boolean })
2824
- ], o.prototype, "buttonOnly", 2);
2825
- h([
2826
- d({ attribute: "file-result-label" })
2827
- ], o.prototype, "fileResultLabel", 2);
2828
- h([
2829
- V(
2830
- ["mask", "maskBlocks", "maskLazy", "maskOverwrite", "maskPlaceholder"],
2831
- {
2832
- deepCompare: !0,
2833
- waitUntilFirstUpdate: !0
2834
- }
2835
- )
2836
- ], o.prototype, "initMaskInstance", 1);
2837
- h([
2838
- V("disabled", { waitUntilFirstUpdate: !0 })
2839
- ], o.prototype, "handleDisabledChange", 1);
2840
- h([
2841
- V("step", { waitUntilFirstUpdate: !0 })
2842
- ], o.prototype, "handleStepChange", 1);
2843
- h([
2844
- V("value", { waitUntilFirstUpdate: !0 })
2845
- ], o.prototype, "handleValueChange", 1);
2846
- h([
2847
- V(["autoGrow", "placeholder", "type"], { waitUntilFirstUpdate: !0 })
2848
- ], o.prototype, "handleAutoGrowChange", 1);
2849
- o = h([
2850
- lt("cx-input")
2851
- ], o);
1
+ import "../chunks/lib-cortex-element.CVMmyPMC.js";
2
+ import "../chunks/component.styles.CRO4Odto.js";
3
+ import "../chunks/form-control.styles.CaGWmeAS.js";
4
+ import "../chunks/custom-element.L4WJXn1j.js";
5
+ import "../chunks/default-value.COZopaet.js";
6
+ import "../chunks/form.B-5nQJva.js";
7
+ import "../chunks/i18n.C21qyGi6.js";
8
+ import "../chunks/slot.j5oheLJC.js";
9
+ import "../chunks/watch.CThbualB.js";
10
+ import { C as j } from "../chunks/input.DdeXWD_F.js";
11
+ import "../chunks/lit-element.jLBm65_O.js";
12
+ import "../chunks/state.CSDxrqLd.js";
13
+ import "../chunks/query.BBf1UFkC.js";
14
+ import "../chunks/class-map.BiVq-cVR.js";
15
+ import "../chunks/if-defined.BRoBj_Rp.js";
16
+ import "../chunks/live.SCz6M8Gs.js";
17
+ import "../chunks/when.Dr1es41R.js";
18
+ import "../chunks/icon.DnBh6-56.js";
2852
19
  export {
2853
- o as default
20
+ j as default
2854
21
  };