q2-tecton-elements 1.21.2 → 1.22.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. package/dist/cjs/installCanvasRenderer-b4d10c92.js +38433 -0
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/q2-badge_2.cjs.entry.js +5 -3
  4. package/dist/cjs/q2-calendar.cjs.entry.js +75 -55
  5. package/dist/cjs/q2-carousel.cjs.entry.js +3 -3
  6. package/dist/cjs/q2-chart-bar.cjs.entry.js +4679 -0
  7. package/dist/cjs/q2-chart-donut.cjs.entry.js +357 -35592
  8. package/dist/cjs/q2-checkbox.cjs.entry.js +1 -1
  9. package/dist/cjs/q2-editable-field.cjs.entry.js +1 -1
  10. package/dist/cjs/q2-radio.cjs.entry.js +1 -1
  11. package/dist/cjs/q2-tecton-elements.cjs.js +1 -1
  12. package/dist/collection/collection-manifest.json +1 -0
  13. package/dist/collection/components/q2-calendar/index.js +43 -2
  14. package/dist/collection/components/q2-chart-bar/index.js +466 -0
  15. package/dist/collection/components/q2-chart-bar/styles.css +85 -0
  16. package/dist/collection/components/q2-chart-donut/index.js +3 -3
  17. package/dist/collection/components/q2-checkbox/styles.css +5 -1
  18. package/dist/collection/components/q2-editable-field/styles.css +1 -1
  19. package/dist/collection/components/q2-input/formatting/phone.js +2 -2
  20. package/dist/collection/components/q2-input/index.js +21 -0
  21. package/dist/collection/components/q2-input/styles.css +2 -2
  22. package/dist/collection/components/q2-radio/styles.css +1 -1
  23. package/dist/collection/utils/charting.js +182 -0
  24. package/dist/components/click-elsewhere.d.ts +11 -0
  25. package/dist/components/click-elsewhere.js +6 -0
  26. package/dist/components/index.d.ts +62 -0
  27. package/dist/components/index.js +42 -0
  28. package/dist/components/index10.js +84 -0
  29. package/dist/components/index11.js +383 -0
  30. package/dist/components/index12.js +125 -0
  31. package/dist/components/index13.js +602 -0
  32. package/dist/components/index2.js +100 -0
  33. package/dist/components/index3.js +90 -0
  34. package/dist/components/index4.js +62 -0
  35. package/dist/components/index5.js +146 -0
  36. package/dist/components/index6.js +145 -0
  37. package/dist/components/index7.js +2960 -0
  38. package/dist/components/index8.js +3356 -0
  39. package/dist/components/index9.js +101 -0
  40. package/dist/components/installCanvasRenderer.js +38282 -0
  41. package/dist/components/q2-avatar.d.ts +11 -0
  42. package/dist/components/q2-avatar.js +6 -0
  43. package/dist/components/q2-badge.d.ts +11 -0
  44. package/dist/components/q2-badge.js +6 -0
  45. package/dist/components/q2-btn.d.ts +11 -0
  46. package/dist/components/q2-btn.js +6 -0
  47. package/dist/components/q2-calendar.d.ts +11 -0
  48. package/dist/components/q2-calendar.js +3755 -0
  49. package/dist/components/q2-card.d.ts +11 -0
  50. package/dist/components/q2-card.js +187 -0
  51. package/dist/components/q2-carousel-pane.d.ts +11 -0
  52. package/dist/components/q2-carousel-pane.js +97 -0
  53. package/dist/components/q2-carousel.d.ts +11 -0
  54. package/dist/components/q2-carousel.js +5379 -0
  55. package/dist/components/q2-chart-bar.d.ts +11 -0
  56. package/dist/components/q2-chart-bar.js +4710 -0
  57. package/dist/components/q2-chart-donut.d.ts +11 -0
  58. package/dist/components/q2-chart-donut.js +4887 -0
  59. package/dist/components/q2-checkbox-group.d.ts +11 -0
  60. package/dist/components/q2-checkbox-group.js +114 -0
  61. package/dist/components/q2-checkbox.d.ts +11 -0
  62. package/dist/components/q2-checkbox.js +138 -0
  63. package/dist/components/q2-dropdown-item.d.ts +11 -0
  64. package/dist/components/q2-dropdown-item.js +6 -0
  65. package/dist/components/q2-dropdown.d.ts +11 -0
  66. package/dist/components/q2-dropdown.js +345 -0
  67. package/dist/components/q2-editable-field.d.ts +11 -0
  68. package/dist/components/q2-editable-field.js +220 -0
  69. package/dist/components/q2-icon.d.ts +11 -0
  70. package/dist/components/q2-icon.js +6 -0
  71. package/dist/components/q2-input.d.ts +11 -0
  72. package/dist/components/q2-input.js +6 -0
  73. package/dist/components/q2-loading-element.d.ts +11 -0
  74. package/dist/components/q2-loading-element.js +52 -0
  75. package/dist/components/q2-loading.d.ts +11 -0
  76. package/dist/components/q2-loading.js +6 -0
  77. package/dist/components/q2-loc.d.ts +11 -0
  78. package/dist/components/q2-loc.js +40 -0
  79. package/dist/components/q2-message.d.ts +11 -0
  80. package/dist/components/q2-message.js +6 -0
  81. package/dist/components/q2-month-picker.d.ts +11 -0
  82. package/dist/components/q2-month-picker.js +189 -0
  83. package/dist/components/q2-optgroup.d.ts +11 -0
  84. package/dist/components/q2-optgroup.js +75 -0
  85. package/dist/components/q2-option-list.d.ts +11 -0
  86. package/dist/components/q2-option-list.js +6 -0
  87. package/dist/components/q2-option.d.ts +11 -0
  88. package/dist/components/q2-option.js +81 -0
  89. package/dist/components/q2-pagination.d.ts +11 -0
  90. package/dist/components/q2-pagination.js +184 -0
  91. package/dist/components/q2-pill.d.ts +11 -0
  92. package/dist/components/q2-pill.js +216 -0
  93. package/dist/components/q2-popover.d.ts +11 -0
  94. package/dist/components/q2-popover.js +6 -0
  95. package/dist/components/q2-radio-group.d.ts +11 -0
  96. package/dist/components/q2-radio-group.js +191 -0
  97. package/dist/components/q2-radio.d.ts +11 -0
  98. package/dist/components/q2-radio.js +105 -0
  99. package/dist/components/q2-section.d.ts +11 -0
  100. package/dist/components/q2-section.js +218 -0
  101. package/dist/components/q2-select.d.ts +11 -0
  102. package/dist/components/q2-select.js +817 -0
  103. package/dist/components/q2-stepper-pane.d.ts +11 -0
  104. package/dist/components/q2-stepper-pane.js +92 -0
  105. package/dist/components/q2-stepper-vertical.d.ts +11 -0
  106. package/dist/components/q2-stepper-vertical.js +311 -0
  107. package/dist/components/q2-stepper.d.ts +11 -0
  108. package/dist/components/q2-stepper.js +252 -0
  109. package/dist/components/q2-tab-container.d.ts +11 -0
  110. package/dist/components/q2-tab-container.js +288 -0
  111. package/dist/components/q2-tab-pane.d.ts +11 -0
  112. package/dist/components/q2-tab-pane.js +58 -0
  113. package/dist/components/q2-tag.d.ts +11 -0
  114. package/dist/components/q2-tag.js +156 -0
  115. package/dist/components/q2-textarea.d.ts +11 -0
  116. package/dist/components/q2-textarea.js +265 -0
  117. package/dist/components/q2-tooltip.d.ts +11 -0
  118. package/dist/components/q2-tooltip.js +112 -0
  119. package/dist/components/shapes.js +91 -0
  120. package/dist/components/tecton-tab-pane.d.ts +11 -0
  121. package/dist/components/tecton-tab-pane.js +111 -0
  122. package/dist/esm/installCanvasRenderer-0143b52d.js +38282 -0
  123. package/dist/esm/loader.js +1 -1
  124. package/dist/esm/q2-badge_2.entry.js +5 -3
  125. package/dist/esm/q2-calendar.entry.js +75 -55
  126. package/dist/esm/q2-carousel.entry.js +3 -3
  127. package/dist/esm/q2-chart-bar.entry.js +4675 -0
  128. package/dist/esm/q2-chart-donut.entry.js +171 -35406
  129. package/dist/esm/q2-checkbox.entry.js +1 -1
  130. package/dist/esm/q2-editable-field.entry.js +1 -1
  131. package/dist/esm/q2-radio.entry.js +1 -1
  132. package/dist/esm/q2-tecton-elements.js +1 -1
  133. package/dist/q2-tecton-elements/p-1f85cced.js +39 -0
  134. package/dist/q2-tecton-elements/{p-89608314.entry.js → p-4625184b.entry.js} +1 -1
  135. package/dist/q2-tecton-elements/{p-9772b15f.entry.js → p-520c40f6.entry.js} +1 -1
  136. package/dist/q2-tecton-elements/p-6b52a262.entry.js +1 -0
  137. package/dist/q2-tecton-elements/p-c4640b55.entry.js +1 -0
  138. package/dist/q2-tecton-elements/{p-7e8f43d1.entry.js → p-cf41970f.entry.js} +1 -1
  139. package/dist/q2-tecton-elements/p-e4dc9ac0.entry.js +1 -0
  140. package/dist/q2-tecton-elements/p-f35bf6a3.entry.js +1 -0
  141. package/dist/q2-tecton-elements/q2-tecton-elements.esm.js +1 -1
  142. package/dist/types/components/q2-calendar/index.d.ts +3 -0
  143. package/dist/types/components/q2-chart-bar/index.d.ts +40 -0
  144. package/dist/types/components/q2-chart-donut/index.d.ts +7 -10
  145. package/dist/types/components/q2-input/index.d.ts +1 -0
  146. package/dist/types/components.d.ts +50 -3
  147. package/dist/types/utils/charting.d.ts +14 -0
  148. package/package.json +6 -3
  149. package/dist/q2-tecton-elements/p-0766a694.entry.js +0 -1
  150. package/dist/q2-tecton-elements/p-5f064e1e.entry.js +0 -39
  151. package/dist/q2-tecton-elements/p-8d25ec52.entry.js +0 -1
  152. /package/dist/types/workspace/workspace/{tecton-production_release_1.21.x → tecton-production_release_1.22.x}/packages/q2-tecton-elements/.stencil/test/helpers.d.ts +0 -0
@@ -0,0 +1,3356 @@
1
+ import { proxyCustomElement, HTMLElement, createEvent, h, Fragment } from '@stencil/core/internal/client';
2
+ import { c as createGuid, e as setMessageHeight, h as handleAriaLabel, o as overrideFocus, l as loc, i as isEventFromElement, f as labelDOM, m as messagesDOM } from './index13.js';
3
+ import { d as defineCustomElement$4 } from './index4.js';
4
+ import { d as defineCustomElement$3 } from './index5.js';
5
+ import { d as defineCustomElement$2 } from './index7.js';
6
+ import { d as defineCustomElement$1 } from './index9.js';
7
+
8
+ function formatNumber(val = '', options = {
9
+ prefix: '',
10
+ suffix: '',
11
+ decimals: 0,
12
+ decimalSeparator: '.',
13
+ thousandsSeparator: '',
14
+ allowDecimal: false,
15
+ allowNegative: true,
16
+ }, explicit = false) {
17
+ const isNegative = val[0] === '-';
18
+ let value = val;
19
+ const allowDecimal = !!options.allowDecimal && !!options.decimals;
20
+ if (explicit) {
21
+ const parsedValue = value.replace(/[^\d.]/g, '');
22
+ value = (parsedValue && Number(parsedValue).toFixed(allowDecimal ? options.decimals : 0)) || '';
23
+ }
24
+ value = value.replace(/[^\d]/g, '');
25
+ let { integerString, decimalString } = splitValue(value, allowDecimal, options.decimals);
26
+ // define decimalString
27
+ let decimalSeparator = options.decimalSeparator;
28
+ if (!allowDecimal) {
29
+ decimalSeparator = '';
30
+ decimalString = '';
31
+ }
32
+ // define negative
33
+ const negativeSymbol = options.allowNegative && isNegative ? '-' : '';
34
+ value = `${negativeSymbol}${integerString}${decimalSeparator}${decimalString}`;
35
+ // format integerString
36
+ integerString = integerString.replace(/\B(?=(\d{3})+(?!\d))/g, options.thousandsSeparator);
37
+ const formattedValue = negativeSymbol || integerString ? `${negativeSymbol}${integerString}${decimalSeparator}${decimalString}` : '';
38
+ const fullyFormattedValue = negativeSymbol || integerString
39
+ ? `${negativeSymbol}${options.prefix}${integerString}${decimalSeparator}${decimalString}${options.suffix}`
40
+ : '';
41
+ let formattingCharacterCount = formattedValue.length - value.length;
42
+ if (decimalSeparator) {
43
+ formattingCharacterCount = formattingCharacterCount + options.decimalSeparator.length;
44
+ }
45
+ const prefix = options.prefix || options.suffix;
46
+ const maxlength = Number.MAX_SAFE_INTEGER.toString().length + formattingCharacterCount + decimalString.length;
47
+ const unformattedValue = `${integerString.replace(/[^0-9]/g, '')}${decimalString}`.replace(/^0+/, '');
48
+ return {
49
+ value,
50
+ formattedValue,
51
+ fullyFormattedValue,
52
+ prefix,
53
+ suffix: '',
54
+ formattingCharacterCount,
55
+ maxlength,
56
+ unformattedValue,
57
+ };
58
+ }
59
+ function splitValue(value, allowDecimal = false, decimals) {
60
+ if (!allowDecimal) {
61
+ return {
62
+ integerString: value,
63
+ decimalString: '',
64
+ };
65
+ }
66
+ const splitIndex = value.length - decimals;
67
+ let integerString = value.substring(0, splitIndex).padStart(1, '0');
68
+ if (integerString.length > 1 && integerString[0] === '0') {
69
+ integerString = integerString.substring(1);
70
+ }
71
+ const decimalString = value.substring(splitIndex).padStart(decimals, '0');
72
+ return {
73
+ integerString,
74
+ decimalString,
75
+ };
76
+ }
77
+
78
+ function formatValue(value = '', mask = '', options) {
79
+ const prefix = (options && options.prefix) || '';
80
+ const suffix = (options && options.suffix) || '';
81
+ if (!value || !mask) {
82
+ const fullyFormattedValue = `${prefix}${value}${suffix}`;
83
+ return {
84
+ value,
85
+ formattedValue: value,
86
+ fullyFormattedValue,
87
+ prefix: prefix.trim() || suffix.trim(),
88
+ formattingCharacterCount: 0,
89
+ unformattedValue: value,
90
+ };
91
+ }
92
+ const { unformattedValue, formattedValue, formattingCharacterCount } = generateMask(value, mask);
93
+ const fullyFormattedValue = `${prefix}${formattedValue}${suffix}`;
94
+ const maxlength = mask.length;
95
+ const minFormattedLength = getMinimumFormattedLength(mask, prefix, suffix);
96
+ return {
97
+ value: unformattedValue,
98
+ formattedValue,
99
+ fullyFormattedValue,
100
+ prefix: prefix.trim() || suffix.trim(),
101
+ formattingCharacterCount,
102
+ maxlength,
103
+ minFormattedLength,
104
+ unformattedValue,
105
+ };
106
+ }
107
+ const optionalValidatingChars = ['?'];
108
+ function isOptionalValidatingChar(character) {
109
+ return optionalValidatingChars.includes(character);
110
+ }
111
+ const knownValidatingChars = ['#', '@', '*', ...optionalValidatingChars];
112
+ function isKnownValidatingChar(character) {
113
+ return knownValidatingChars.includes(character);
114
+ }
115
+ function getStaticFormattingChars(mask) {
116
+ const knownChars = knownValidatingChars.join('|');
117
+ const formattingChars = mask.replace(new RegExp(`[${knownChars}]`, 'g'), '').split('');
118
+ return new Set(formattingChars);
119
+ }
120
+ function isStaticFormattingChar(character, formattingChars) {
121
+ return formattingChars.has(character);
122
+ }
123
+ function getValidatedChar(char, matcher) {
124
+ switch (matcher) {
125
+ case '#':
126
+ char = char.replace(/[^\d]/g, '');
127
+ break;
128
+ case '@':
129
+ char = char.toUpperCase().replace(/[^A-Z]+/g, ''); // allows only upper case
130
+ break;
131
+ case '*':
132
+ char = char.toUpperCase().replace(/[^\dA-Z]+/g, '');
133
+ break;
134
+ case '?':
135
+ char = char.replace(/[^\d]/g, '');
136
+ break;
137
+ default:
138
+ return char;
139
+ }
140
+ return char;
141
+ }
142
+ function generateMask(value, mask) {
143
+ const maskArray = mask.split('');
144
+ const formattingChars = getStaticFormattingChars(mask);
145
+ let currentValueIndex = 0;
146
+ let formattingCharacterCount = 0;
147
+ let unformattedValue = '';
148
+ const formattedValue = maskArray.reduce((acc, character) => {
149
+ if (currentValueIndex >= value.length) {
150
+ return acc;
151
+ }
152
+ if (isOptionalValidatingChar(character) && isStaticFormattingChar(value[currentValueIndex], formattingChars)) {
153
+ return acc;
154
+ }
155
+ if (isKnownValidatingChar(character)) {
156
+ // Step value index if formatting character pushed out of place by user input
157
+ currentValueIndex = getNextNonFormattingCharIndex(value, currentValueIndex, formattingChars);
158
+ if (currentValueIndex >= value.length) {
159
+ return acc;
160
+ }
161
+ const validChar = getValidatedChar(value[currentValueIndex], character);
162
+ acc += validChar;
163
+ unformattedValue += validChar;
164
+ currentValueIndex++;
165
+ }
166
+ else {
167
+ // Static formatting characters added directly to formatted string
168
+ acc += character;
169
+ formattingCharacterCount++;
170
+ if (character === value[currentValueIndex]) {
171
+ // Continue to walk value if next value at this index matches formatting character
172
+ currentValueIndex++;
173
+ }
174
+ }
175
+ return acc;
176
+ }, '');
177
+ return {
178
+ unformattedValue,
179
+ formattedValue,
180
+ formattingCharacterCount,
181
+ };
182
+ }
183
+ function getNextNonFormattingCharIndex(value, currentValueIndex, formattingChars) {
184
+ if (isStaticFormattingChar(value[currentValueIndex], formattingChars)) {
185
+ currentValueIndex++;
186
+ return getNextNonFormattingCharIndex(value, currentValueIndex, formattingChars);
187
+ }
188
+ return currentValueIndex;
189
+ }
190
+ function getMinimumFormattedLength(mask, prefix, suffix) {
191
+ return (mask.replace(new RegExp(`[${optionalValidatingChars.join('|')}]`, 'g'), '').length +
192
+ prefix.length +
193
+ suffix.length);
194
+ }
195
+
196
+ // decimal data source: http://www.iso.org/iso/home/standards/currency_codes.htm 09/Nov/2016
197
+ const currencyFormats = {
198
+ AED: {
199
+ prefix: '',
200
+ suffix: 'د.إ',
201
+ decimals: 2,
202
+ decimalSeparator: '.',
203
+ thousandsSeparator: ',',
204
+ },
205
+ AFN: {
206
+ prefix: '¤',
207
+ suffix: '',
208
+ decimals: 2,
209
+ decimalSeparator: '.',
210
+ thousandsSeparator: ',',
211
+ },
212
+ ALL: {
213
+ prefix: 'L',
214
+ suffix: '',
215
+ decimals: 2,
216
+ decimalSeparator: '.',
217
+ thousandsSeparator: ',',
218
+ },
219
+ AMD: {
220
+ prefix: 'դր.',
221
+ suffix: '',
222
+ decimals: 2,
223
+ decimalSeparator: '.',
224
+ thousandsSeparator: ',',
225
+ },
226
+ ANG: {
227
+ prefix: 'ƒ',
228
+ suffix: '',
229
+ decimals: 2,
230
+ decimalSeparator: '.',
231
+ thousandsSeparator: ',',
232
+ },
233
+ AOA: {
234
+ prefix: 'Kz',
235
+ suffix: '',
236
+ decimals: 2,
237
+ decimalSeparator: '.',
238
+ thousandsSeparator: ',',
239
+ },
240
+ ARS: {
241
+ prefix: '$',
242
+ suffix: '',
243
+ decimals: 2,
244
+ decimalSeparator: '.',
245
+ thousandsSeparator: ',',
246
+ },
247
+ AUD: {
248
+ prefix: '$',
249
+ suffix: '',
250
+ decimals: 2,
251
+ decimalSeparator: '.',
252
+ thousandsSeparator: ',',
253
+ },
254
+ AWG: {
255
+ prefix: 'ƒ',
256
+ suffix: '',
257
+ decimals: 2,
258
+ decimalSeparator: '.',
259
+ thousandsSeparator: ',',
260
+ },
261
+ AZN: {
262
+ prefix: '¤',
263
+ suffix: '',
264
+ decimals: 2,
265
+ decimalSeparator: '.',
266
+ thousandsSeparator: ',',
267
+ },
268
+ BAM: {
269
+ prefix: 'КМ',
270
+ suffix: '',
271
+ decimals: 2,
272
+ decimalSeparator: '.',
273
+ thousandsSeparator: ',',
274
+ },
275
+ BBD: {
276
+ prefix: '$',
277
+ suffix: '',
278
+ decimals: 2,
279
+ decimalSeparator: '.',
280
+ thousandsSeparator: ',',
281
+ },
282
+ BDT: {
283
+ prefix: '৳',
284
+ suffix: '',
285
+ decimals: 2,
286
+ decimalSeparator: '.',
287
+ thousandsSeparator: ',',
288
+ },
289
+ BGN: {
290
+ prefix: '৳',
291
+ suffix: '',
292
+ decimals: 2,
293
+ decimalSeparator: '.',
294
+ thousandsSeparator: ',',
295
+ },
296
+ BHD: {
297
+ prefix: '',
298
+ suffix: 'ب.د',
299
+ decimals: 3,
300
+ decimalSeparator: '.',
301
+ thousandsSeparator: ',',
302
+ },
303
+ BIF: {
304
+ prefix: 'Fr',
305
+ suffix: '',
306
+ decimals: 0,
307
+ decimalSeparator: '.',
308
+ thousandsSeparator: ',',
309
+ },
310
+ BMD: {
311
+ prefix: '$',
312
+ suffix: '',
313
+ decimals: 2,
314
+ decimalSeparator: '.',
315
+ thousandsSeparator: ',',
316
+ },
317
+ BND: {
318
+ prefix: '$',
319
+ suffix: '',
320
+ decimals: 2,
321
+ decimalSeparator: '.',
322
+ thousandsSeparator: ',',
323
+ },
324
+ BOB: {
325
+ prefix: 'Bs.',
326
+ suffix: '',
327
+ decimals: 2,
328
+ decimalSeparator: '.',
329
+ thousandsSeparator: ',',
330
+ },
331
+ BRL: {
332
+ prefix: 'R$',
333
+ suffix: '',
334
+ decimals: 2,
335
+ decimalSeparator: '.',
336
+ thousandsSeparator: ',',
337
+ },
338
+ BSD: {
339
+ prefix: '$',
340
+ suffix: '',
341
+ decimals: 2,
342
+ decimalSeparator: '.',
343
+ thousandsSeparator: ',',
344
+ },
345
+ BTN: {
346
+ prefix: '¤',
347
+ suffix: '',
348
+ decimals: 2,
349
+ decimalSeparator: '.',
350
+ thousandsSeparator: ',',
351
+ },
352
+ BWP: {
353
+ prefix: 'P',
354
+ suffix: '',
355
+ decimals: 2,
356
+ decimalSeparator: '.',
357
+ thousandsSeparator: ',',
358
+ },
359
+ BYN: {
360
+ prefix: 'Br',
361
+ suffix: '',
362
+ decimals: 0,
363
+ decimalSeparator: '.',
364
+ thousandsSeparator: ',',
365
+ },
366
+ BZD: {
367
+ prefix: '$',
368
+ suffix: '',
369
+ decimals: 2,
370
+ decimalSeparator: '.',
371
+ thousandsSeparator: ',',
372
+ },
373
+ CAD: {
374
+ prefix: '$',
375
+ suffix: '',
376
+ decimals: 2,
377
+ decimalSeparator: '.',
378
+ thousandsSeparator: ',',
379
+ },
380
+ CDF: {
381
+ prefix: 'Fr',
382
+ suffix: '',
383
+ decimals: 2,
384
+ decimalSeparator: '.',
385
+ thousandsSeparator: ',',
386
+ },
387
+ CHF: {
388
+ prefix: 'Fr',
389
+ suffix: '',
390
+ decimals: 2,
391
+ decimalSeparator: '.',
392
+ thousandsSeparator: ',',
393
+ },
394
+ CLF: {
395
+ prefix: 'Fr',
396
+ suffix: '',
397
+ decimals: 4,
398
+ decimalSeparator: '.',
399
+ thousandsSeparator: ',',
400
+ },
401
+ CLP: {
402
+ prefix: '$',
403
+ suffix: '',
404
+ decimals: 0,
405
+ decimalSeparator: '.',
406
+ thousandsSeparator: ',',
407
+ },
408
+ CNY: {
409
+ prefix: '¥',
410
+ suffix: '',
411
+ decimals: 2,
412
+ decimalSeparator: '.',
413
+ thousandsSeparator: ',',
414
+ },
415
+ COP: {
416
+ prefix: '$',
417
+ suffix: '',
418
+ decimals: 2,
419
+ decimalSeparator: '.',
420
+ thousandsSeparator: ',',
421
+ },
422
+ CRC: {
423
+ prefix: '₡',
424
+ suffix: '',
425
+ decimals: 2,
426
+ decimalSeparator: '.',
427
+ thousandsSeparator: ',',
428
+ },
429
+ CUC: {
430
+ prefix: '$',
431
+ suffix: '',
432
+ decimals: 2,
433
+ decimalSeparator: '.',
434
+ thousandsSeparator: ',',
435
+ },
436
+ CUP: {
437
+ prefix: '$',
438
+ suffix: '',
439
+ decimals: 2,
440
+ decimalSeparator: '.',
441
+ thousandsSeparator: ',',
442
+ },
443
+ CVE: {
444
+ prefix: '$',
445
+ suffix: '',
446
+ decimals: 0,
447
+ decimalSeparator: '.',
448
+ thousandsSeparator: ',',
449
+ },
450
+ CZK: {
451
+ prefix: 'Kč',
452
+ suffix: '',
453
+ decimals: 2,
454
+ decimalSeparator: '.',
455
+ thousandsSeparator: ',',
456
+ },
457
+ DJF: {
458
+ prefix: 'Fr',
459
+ suffix: '',
460
+ decimals: 0,
461
+ decimalSeparator: '.',
462
+ thousandsSeparator: ',',
463
+ },
464
+ DKK: {
465
+ prefix: 'kr',
466
+ suffix: '',
467
+ decimals: 2,
468
+ decimalSeparator: '.',
469
+ thousandsSeparator: ',',
470
+ },
471
+ DOP: {
472
+ prefix: '$',
473
+ suffix: '',
474
+ decimals: 2,
475
+ decimalSeparator: '.',
476
+ thousandsSeparator: ',',
477
+ },
478
+ DZD: {
479
+ prefix: '',
480
+ suffix: 'د.ج',
481
+ decimals: 2,
482
+ decimalSeparator: '.',
483
+ thousandsSeparator: ',',
484
+ },
485
+ EEK: {
486
+ prefix: 'KR',
487
+ suffix: '',
488
+ decimals: 2,
489
+ decimalSeparator: '.',
490
+ thousandsSeparator: ',',
491
+ },
492
+ EGP: {
493
+ prefix: '£',
494
+ suffix: '',
495
+ decimals: 2,
496
+ decimalSeparator: '.',
497
+ thousandsSeparator: ',',
498
+ },
499
+ ERN: {
500
+ prefix: 'Nfk',
501
+ suffix: '',
502
+ decimals: 2,
503
+ decimalSeparator: '.',
504
+ thousandsSeparator: ',',
505
+ },
506
+ ETB: {
507
+ prefix: '¤',
508
+ suffix: '',
509
+ decimals: 2,
510
+ decimalSeparator: '.',
511
+ thousandsSeparator: ',',
512
+ },
513
+ EUR: {
514
+ prefix: '€',
515
+ suffix: '',
516
+ decimals: 2,
517
+ decimalSeparator: '.',
518
+ thousandsSeparator: ',',
519
+ },
520
+ FJD: {
521
+ prefix: '$',
522
+ suffix: '',
523
+ decimals: 2,
524
+ decimalSeparator: '.',
525
+ thousandsSeparator: ',',
526
+ },
527
+ FKP: {
528
+ prefix: '£',
529
+ suffix: '',
530
+ decimals: 2,
531
+ decimalSeparator: '.',
532
+ thousandsSeparator: ',',
533
+ },
534
+ GBP: {
535
+ prefix: '£',
536
+ suffix: '',
537
+ decimals: 2,
538
+ decimalSeparator: '.',
539
+ thousandsSeparator: ',',
540
+ },
541
+ GEL: {
542
+ prefix: 'ლ',
543
+ suffix: '',
544
+ decimals: 2,
545
+ decimalSeparator: '.',
546
+ thousandsSeparator: ',',
547
+ },
548
+ GHS: {
549
+ prefix: '¤',
550
+ suffix: '',
551
+ decimals: 2,
552
+ decimalSeparator: '.',
553
+ thousandsSeparator: ',',
554
+ },
555
+ GIP: {
556
+ prefix: '£',
557
+ suffix: '',
558
+ decimals: 2,
559
+ decimalSeparator: '.',
560
+ thousandsSeparator: ',',
561
+ },
562
+ GMD: {
563
+ prefix: 'D',
564
+ suffix: '',
565
+ decimals: 2,
566
+ decimalSeparator: '.',
567
+ thousandsSeparator: ',',
568
+ },
569
+ GNF: {
570
+ prefix: 'Fr',
571
+ suffix: '',
572
+ decimals: 0,
573
+ decimalSeparator: '.',
574
+ thousandsSeparator: ',',
575
+ },
576
+ GTQ: {
577
+ prefix: 'Q',
578
+ suffix: '',
579
+ decimals: 2,
580
+ decimalSeparator: '.',
581
+ thousandsSeparator: ',',
582
+ },
583
+ GYD: {
584
+ prefix: '$',
585
+ suffix: '',
586
+ decimals: 2,
587
+ decimalSeparator: '.',
588
+ thousandsSeparator: ',',
589
+ },
590
+ HKD: {
591
+ prefix: '$',
592
+ suffix: '',
593
+ decimals: 2,
594
+ decimalSeparator: '.',
595
+ thousandsSeparator: ',',
596
+ },
597
+ HNL: {
598
+ prefix: 'L',
599
+ suffix: '',
600
+ decimals: 2,
601
+ decimalSeparator: '.',
602
+ thousandsSeparator: ',',
603
+ },
604
+ HRK: {
605
+ prefix: 'kn',
606
+ suffix: '',
607
+ decimals: 2,
608
+ decimalSeparator: '.',
609
+ thousandsSeparator: ',',
610
+ },
611
+ HTG: {
612
+ prefix: 'G',
613
+ suffix: '',
614
+ decimals: 2,
615
+ decimalSeparator: '.',
616
+ thousandsSeparator: ',',
617
+ },
618
+ HUF: {
619
+ prefix: 'Ft',
620
+ suffix: '',
621
+ decimals: 2,
622
+ decimalSeparator: '.',
623
+ thousandsSeparator: ',',
624
+ },
625
+ IDR: {
626
+ prefix: 'Rs',
627
+ suffix: '',
628
+ decimals: 2,
629
+ decimalSeparator: '.',
630
+ thousandsSeparator: ',',
631
+ },
632
+ ILS: {
633
+ prefix: '₪',
634
+ suffix: '',
635
+ decimals: 2,
636
+ decimalSeparator: '.',
637
+ thousandsSeparator: ',',
638
+ },
639
+ INR: {
640
+ prefix: '₨',
641
+ suffix: '',
642
+ decimals: 2,
643
+ decimalSeparator: '.',
644
+ thousandsSeparator: ',',
645
+ },
646
+ IQD: {
647
+ prefix: '',
648
+ suffix: 'ع.د',
649
+ decimals: 3,
650
+ decimalSeparator: '.',
651
+ thousandsSeparator: ',',
652
+ },
653
+ IRR: {
654
+ prefix: '¤',
655
+ suffix: '',
656
+ decimals: 2,
657
+ decimalSeparator: '.',
658
+ thousandsSeparator: ',',
659
+ },
660
+ ISK: {
661
+ prefix: 'kr',
662
+ suffix: '',
663
+ decimals: 0,
664
+ decimalSeparator: '.',
665
+ thousandsSeparator: ',',
666
+ },
667
+ JMD: {
668
+ prefix: '$',
669
+ suffix: '',
670
+ decimals: 2,
671
+ decimalSeparator: '.',
672
+ thousandsSeparator: ',',
673
+ },
674
+ JOD: {
675
+ prefix: '',
676
+ suffix: 'د.ا',
677
+ decimals: 3,
678
+ decimalSeparator: '.',
679
+ thousandsSeparator: ',',
680
+ },
681
+ JPY: {
682
+ prefix: '¥',
683
+ suffix: '',
684
+ decimals: 0,
685
+ decimalSeparator: '.',
686
+ thousandsSeparator: ',',
687
+ },
688
+ KES: {
689
+ prefix: 'Sh',
690
+ suffix: '',
691
+ decimals: 2,
692
+ decimalSeparator: '.',
693
+ thousandsSeparator: ',',
694
+ },
695
+ KGS: {
696
+ prefix: '¤',
697
+ suffix: '',
698
+ decimals: 2,
699
+ decimalSeparator: '.',
700
+ thousandsSeparator: ',',
701
+ },
702
+ KHR: {
703
+ prefix: '¤',
704
+ suffix: '',
705
+ decimals: 2,
706
+ decimalSeparator: '.',
707
+ thousandsSeparator: ',',
708
+ },
709
+ KMF: {
710
+ prefix: 'Fr',
711
+ suffix: '',
712
+ decimals: 0,
713
+ decimalSeparator: '.',
714
+ thousandsSeparator: ',',
715
+ },
716
+ KPW: {
717
+ prefix: '₩',
718
+ suffix: '',
719
+ decimals: 2,
720
+ decimalSeparator: '.',
721
+ thousandsSeparator: ',',
722
+ },
723
+ KRW: {
724
+ prefix: '₩',
725
+ suffix: '',
726
+ decimals: 0,
727
+ decimalSeparator: '.',
728
+ thousandsSeparator: ',',
729
+ },
730
+ KWD: {
731
+ prefix: 'د.ك',
732
+ suffix: '',
733
+ decimals: 3,
734
+ decimalSeparator: '.',
735
+ thousandsSeparator: ',',
736
+ },
737
+ KYD: {
738
+ prefix: '$',
739
+ suffix: '',
740
+ decimals: 2,
741
+ decimalSeparator: '.',
742
+ thousandsSeparator: ',',
743
+ },
744
+ KZT: {
745
+ prefix: '〒',
746
+ suffix: '',
747
+ decimals: 2,
748
+ decimalSeparator: '.',
749
+ thousandsSeparator: ',',
750
+ },
751
+ LAK: {
752
+ prefix: '₭',
753
+ suffix: '',
754
+ decimals: 2,
755
+ decimalSeparator: '.',
756
+ thousandsSeparator: ',',
757
+ },
758
+ LBP: {
759
+ prefix: '',
760
+ suffix: 'ل.ل',
761
+ decimals: 2,
762
+ decimalSeparator: '.',
763
+ thousandsSeparator: ',',
764
+ },
765
+ LKR: {
766
+ prefix: 'Rs',
767
+ suffix: '',
768
+ decimals: 2,
769
+ decimalSeparator: '.',
770
+ thousandsSeparator: ',',
771
+ },
772
+ LRD: {
773
+ prefix: '$',
774
+ suffix: '',
775
+ decimals: 2,
776
+ decimalSeparator: '.',
777
+ thousandsSeparator: ',',
778
+ },
779
+ LSL: {
780
+ prefix: 'L',
781
+ suffix: '',
782
+ decimals: 2,
783
+ decimalSeparator: '.',
784
+ thousandsSeparator: ',',
785
+ },
786
+ LTL: {
787
+ prefix: 'Lt',
788
+ suffix: '',
789
+ decimals: 2,
790
+ decimalSeparator: '.',
791
+ thousandsSeparator: ',',
792
+ },
793
+ LVL: {
794
+ prefix: 'Ls',
795
+ suffix: '',
796
+ decimals: 2,
797
+ decimalSeparator: '.',
798
+ thousandsSeparator: ',',
799
+ },
800
+ LYD: {
801
+ prefix: '',
802
+ suffix: 'ل.د',
803
+ decimals: 3,
804
+ decimalSeparator: '.',
805
+ thousandsSeparator: ',',
806
+ },
807
+ MAD: {
808
+ prefix: '',
809
+ suffix: 'د.م.',
810
+ decimals: 2,
811
+ decimalSeparator: '.',
812
+ thousandsSeparator: ',',
813
+ },
814
+ MDL: {
815
+ prefix: 'L',
816
+ suffix: '',
817
+ decimals: 2,
818
+ decimalSeparator: '.',
819
+ thousandsSeparator: ',',
820
+ },
821
+ MGA: {
822
+ prefix: '¤',
823
+ suffix: '',
824
+ decimals: 1,
825
+ decimalSeparator: '.',
826
+ thousandsSeparator: ',',
827
+ },
828
+ MKD: {
829
+ prefix: 'ден',
830
+ suffix: '',
831
+ decimals: 2,
832
+ decimalSeparator: '.',
833
+ thousandsSeparator: ',',
834
+ },
835
+ MMK: {
836
+ prefix: 'K',
837
+ suffix: '',
838
+ decimals: 2,
839
+ decimalSeparator: '.',
840
+ thousandsSeparator: ',',
841
+ },
842
+ MNT: {
843
+ prefix: '₮',
844
+ suffix: '',
845
+ decimals: 2,
846
+ decimalSeparator: '.',
847
+ thousandsSeparator: ',',
848
+ },
849
+ MOP: {
850
+ prefix: 'P',
851
+ suffix: '',
852
+ decimals: 2,
853
+ decimalSeparator: '.',
854
+ thousandsSeparator: ',',
855
+ },
856
+ MRU: {
857
+ prefix: 'UM',
858
+ suffix: '',
859
+ decimals: 1,
860
+ decimalSeparator: '.',
861
+ thousandsSeparator: ',',
862
+ },
863
+ MUR: {
864
+ prefix: '₨',
865
+ suffix: '',
866
+ decimals: 2,
867
+ decimalSeparator: '.',
868
+ thousandsSeparator: ',',
869
+ },
870
+ MVR: {
871
+ prefix: '¤',
872
+ suffix: '',
873
+ decimals: 2,
874
+ decimalSeparator: '.',
875
+ thousandsSeparator: ',',
876
+ },
877
+ MWK: {
878
+ prefix: 'MK',
879
+ suffix: '',
880
+ decimals: 2,
881
+ decimalSeparator: '.',
882
+ thousandsSeparator: ',',
883
+ },
884
+ MXN: {
885
+ prefix: '$',
886
+ suffix: '',
887
+ decimals: 2,
888
+ decimalSeparator: '.',
889
+ thousandsSeparator: ',',
890
+ },
891
+ MYR: {
892
+ prefix: 'RM',
893
+ suffix: '',
894
+ decimals: 2,
895
+ decimalSeparator: '.',
896
+ thousandsSeparator: ',',
897
+ },
898
+ MZN: {
899
+ prefix: 'MTn',
900
+ suffix: '',
901
+ decimals: 2,
902
+ decimalSeparator: '.',
903
+ thousandsSeparator: ',',
904
+ },
905
+ NAD: {
906
+ prefix: '$',
907
+ suffix: '',
908
+ decimals: 2,
909
+ decimalSeparator: '.',
910
+ thousandsSeparator: ',',
911
+ },
912
+ NGN: {
913
+ prefix: '₦',
914
+ suffix: '',
915
+ decimals: 2,
916
+ decimalSeparator: '.',
917
+ thousandsSeparator: ',',
918
+ },
919
+ NIO: {
920
+ prefix: 'C$',
921
+ suffix: '',
922
+ decimals: 2,
923
+ decimalSeparator: '.',
924
+ thousandsSeparator: ',',
925
+ },
926
+ NOK: {
927
+ prefix: 'kr',
928
+ suffix: '',
929
+ decimals: 2,
930
+ decimalSeparator: '.',
931
+ thousandsSeparator: ',',
932
+ },
933
+ NPR: {
934
+ prefix: '₨',
935
+ suffix: '',
936
+ decimals: 2,
937
+ decimalSeparator: '.',
938
+ thousandsSeparator: ',',
939
+ },
940
+ NZD: {
941
+ prefix: '$',
942
+ suffix: '',
943
+ decimals: 2,
944
+ decimalSeparator: '.',
945
+ thousandsSeparator: ',',
946
+ },
947
+ OMR: {
948
+ prefix: '',
949
+ suffix: 'ر.ع.',
950
+ decimals: 3,
951
+ decimalSeparator: '.',
952
+ thousandsSeparator: ',',
953
+ },
954
+ PAB: {
955
+ prefix: 'B/.',
956
+ suffix: '',
957
+ decimals: 2,
958
+ decimalSeparator: '.',
959
+ thousandsSeparator: ',',
960
+ },
961
+ PEN: {
962
+ prefix: 'S/.',
963
+ suffix: '',
964
+ decimals: 2,
965
+ decimalSeparator: '.',
966
+ thousandsSeparator: ',',
967
+ },
968
+ PGK: {
969
+ prefix: 'K',
970
+ suffix: '',
971
+ decimals: 2,
972
+ decimalSeparator: '.',
973
+ thousandsSeparator: ',',
974
+ },
975
+ PHP: {
976
+ prefix: 'p',
977
+ suffix: '',
978
+ decimals: 2,
979
+ decimalSeparator: '.',
980
+ thousandsSeparator: ',',
981
+ },
982
+ PKR: {
983
+ prefix: '₨',
984
+ suffix: '',
985
+ decimals: 2,
986
+ decimalSeparator: '.',
987
+ thousandsSeparator: ',',
988
+ },
989
+ PLN: {
990
+ prefix: 'zł',
991
+ suffix: '',
992
+ decimals: 2,
993
+ decimalSeparator: '.',
994
+ thousandsSeparator: ',',
995
+ },
996
+ PYG: {
997
+ prefix: '¤',
998
+ suffix: '',
999
+ decimals: 0,
1000
+ decimalSeparator: '.',
1001
+ thousandsSeparator: ',',
1002
+ },
1003
+ QAR: {
1004
+ prefix: '',
1005
+ suffix: 'ر.ق',
1006
+ decimals: 2,
1007
+ decimalSeparator: '.',
1008
+ thousandsSeparator: ',',
1009
+ },
1010
+ RON: {
1011
+ prefix: 'L',
1012
+ suffix: '',
1013
+ decimals: 2,
1014
+ decimalSeparator: '.',
1015
+ thousandsSeparator: ',',
1016
+ },
1017
+ RSD: {
1018
+ prefix: 'дин.',
1019
+ suffix: '',
1020
+ decimals: 2,
1021
+ decimalSeparator: '.',
1022
+ thousandsSeparator: ',',
1023
+ },
1024
+ RUB: {
1025
+ prefix: 'руб.',
1026
+ suffix: '',
1027
+ decimals: 2,
1028
+ decimalSeparator: '.',
1029
+ thousandsSeparator: ',',
1030
+ },
1031
+ RWF: {
1032
+ prefix: 'Fr',
1033
+ suffix: '',
1034
+ decimals: 0,
1035
+ decimalSeparator: '.',
1036
+ thousandsSeparator: ',',
1037
+ },
1038
+ SAR: {
1039
+ prefix: '',
1040
+ suffix: 'ر.س',
1041
+ decimals: 2,
1042
+ decimalSeparator: '.',
1043
+ thousandsSeparator: ',',
1044
+ },
1045
+ SBD: {
1046
+ prefix: '$',
1047
+ suffix: '',
1048
+ decimals: 2,
1049
+ decimalSeparator: '.',
1050
+ thousandsSeparator: ',',
1051
+ },
1052
+ SCR: {
1053
+ prefix: '₨',
1054
+ suffix: '',
1055
+ decimals: 2,
1056
+ decimalSeparator: '.',
1057
+ thousandsSeparator: ',',
1058
+ },
1059
+ SDG: {
1060
+ prefix: '£',
1061
+ suffix: '',
1062
+ decimals: 2,
1063
+ decimalSeparator: '.',
1064
+ thousandsSeparator: ',',
1065
+ },
1066
+ SEK: {
1067
+ prefix: 'kr',
1068
+ suffix: '',
1069
+ decimals: 2,
1070
+ decimalSeparator: '.',
1071
+ thousandsSeparator: ',',
1072
+ },
1073
+ SGD: {
1074
+ prefix: '$',
1075
+ suffix: '',
1076
+ decimals: 2,
1077
+ decimalSeparator: '.',
1078
+ thousandsSeparator: ',',
1079
+ },
1080
+ SHP: {
1081
+ prefix: '£',
1082
+ suffix: '',
1083
+ decimals: 2,
1084
+ decimalSeparator: '.',
1085
+ thousandsSeparator: ',',
1086
+ },
1087
+ SKK: {
1088
+ prefix: 'Sk',
1089
+ suffix: '',
1090
+ decimals: 2,
1091
+ decimalSeparator: '.',
1092
+ thousandsSeparator: ',',
1093
+ },
1094
+ SLL: {
1095
+ prefix: 'Le',
1096
+ suffix: '',
1097
+ decimals: 2,
1098
+ decimalSeparator: '.',
1099
+ thousandsSeparator: ',',
1100
+ },
1101
+ SOS: {
1102
+ prefix: 'Sh',
1103
+ suffix: '',
1104
+ decimals: 2,
1105
+ decimalSeparator: '.',
1106
+ thousandsSeparator: ',',
1107
+ },
1108
+ SRD: {
1109
+ prefix: '$',
1110
+ suffix: '',
1111
+ decimals: 2,
1112
+ decimalSeparator: '.',
1113
+ thousandsSeparator: ',',
1114
+ },
1115
+ STN: {
1116
+ prefix: 'Db',
1117
+ suffix: '',
1118
+ decimals: 2,
1119
+ decimalSeparator: '.',
1120
+ thousandsSeparator: ',',
1121
+ },
1122
+ SVC: {
1123
+ prefix: '₡',
1124
+ suffix: '',
1125
+ decimals: 2,
1126
+ decimalSeparator: '.',
1127
+ thousandsSeparator: ',',
1128
+ },
1129
+ SYP: {
1130
+ prefix: '£',
1131
+ suffix: '',
1132
+ decimals: 2,
1133
+ decimalSeparator: '.',
1134
+ thousandsSeparator: ',',
1135
+ },
1136
+ SZL: {
1137
+ prefix: 'L',
1138
+ suffix: '',
1139
+ decimals: 2,
1140
+ decimalSeparator: '.',
1141
+ thousandsSeparator: ',',
1142
+ },
1143
+ THB: {
1144
+ prefix: '฿',
1145
+ suffix: '',
1146
+ decimals: 2,
1147
+ decimalSeparator: '.',
1148
+ thousandsSeparator: ',',
1149
+ },
1150
+ TJS: {
1151
+ prefix: 'ЅМ',
1152
+ suffix: '',
1153
+ decimals: 2,
1154
+ decimalSeparator: '.',
1155
+ thousandsSeparator: ',',
1156
+ },
1157
+ TMM: {
1158
+ prefix: 'm',
1159
+ suffix: '',
1160
+ decimals: 2,
1161
+ decimalSeparator: '.',
1162
+ thousandsSeparator: ',',
1163
+ },
1164
+ TND: {
1165
+ prefix: '',
1166
+ suffix: 'د.ت',
1167
+ decimals: 3,
1168
+ decimalSeparator: '.',
1169
+ thousandsSeparator: ',',
1170
+ },
1171
+ TOP: {
1172
+ prefix: 'T$',
1173
+ suffix: '',
1174
+ decimals: 2,
1175
+ decimalSeparator: '.',
1176
+ thousandsSeparator: ',',
1177
+ },
1178
+ TRY: {
1179
+ prefix: 'YTL',
1180
+ suffix: '',
1181
+ decimals: 2,
1182
+ decimalSeparator: '.',
1183
+ thousandsSeparator: ',',
1184
+ },
1185
+ TTD: {
1186
+ prefix: '$',
1187
+ suffix: '',
1188
+ decimals: 2,
1189
+ decimalSeparator: '.',
1190
+ thousandsSeparator: ',',
1191
+ },
1192
+ TWD: {
1193
+ prefix: '$',
1194
+ suffix: '',
1195
+ decimals: 2,
1196
+ decimalSeparator: '.',
1197
+ thousandsSeparator: ',',
1198
+ },
1199
+ TZS: {
1200
+ prefix: 'Sh',
1201
+ suffix: '',
1202
+ decimals: 2,
1203
+ decimalSeparator: '.',
1204
+ thousandsSeparator: ',',
1205
+ },
1206
+ UAH: {
1207
+ prefix: '¤',
1208
+ suffix: '',
1209
+ decimals: 2,
1210
+ decimalSeparator: '.',
1211
+ thousandsSeparator: ',',
1212
+ },
1213
+ UGX: {
1214
+ prefix: 'Sh',
1215
+ suffix: '',
1216
+ decimals: 0,
1217
+ decimalSeparator: '.',
1218
+ thousandsSeparator: ',',
1219
+ },
1220
+ USD: {
1221
+ prefix: '$',
1222
+ suffix: '',
1223
+ decimals: 2,
1224
+ decimalSeparator: '.',
1225
+ thousandsSeparator: ',',
1226
+ },
1227
+ UYU: {
1228
+ prefix: '$',
1229
+ suffix: '',
1230
+ decimals: 0,
1231
+ decimalSeparator: '.',
1232
+ thousandsSeparator: ',',
1233
+ },
1234
+ UZS: {
1235
+ prefix: '¤',
1236
+ suffix: '',
1237
+ decimals: 2,
1238
+ decimalSeparator: '.',
1239
+ thousandsSeparator: ',',
1240
+ },
1241
+ VEF: {
1242
+ prefix: 'Bs F',
1243
+ suffix: '',
1244
+ decimals: 2,
1245
+ decimalSeparator: '.',
1246
+ thousandsSeparator: ',',
1247
+ },
1248
+ VND: {
1249
+ prefix: '₫',
1250
+ suffix: '',
1251
+ decimals: 0,
1252
+ decimalSeparator: '.',
1253
+ thousandsSeparator: ',',
1254
+ },
1255
+ VUV: {
1256
+ prefix: 'Vt',
1257
+ suffix: '',
1258
+ decimals: 0,
1259
+ decimalSeparator: '.',
1260
+ thousandsSeparator: ',',
1261
+ },
1262
+ WST: {
1263
+ prefix: 'T',
1264
+ suffix: '',
1265
+ decimals: 2,
1266
+ decimalSeparator: '.',
1267
+ thousandsSeparator: ',',
1268
+ },
1269
+ XAF: {
1270
+ prefix: 'Fr',
1271
+ suffix: '',
1272
+ decimals: 0,
1273
+ decimalSeparator: '.',
1274
+ thousandsSeparator: ',',
1275
+ },
1276
+ XCD: {
1277
+ prefix: '$',
1278
+ suffix: '',
1279
+ decimals: 2,
1280
+ decimalSeparator: '.',
1281
+ thousandsSeparator: ',',
1282
+ },
1283
+ XOF: {
1284
+ prefix: 'Fr',
1285
+ suffix: '',
1286
+ decimals: 0,
1287
+ decimalSeparator: '.',
1288
+ thousandsSeparator: ',',
1289
+ },
1290
+ XPF: {
1291
+ prefix: 'Fr',
1292
+ suffix: '',
1293
+ decimals: 0,
1294
+ decimalSeparator: '.',
1295
+ thousandsSeparator: ',',
1296
+ },
1297
+ YER: {
1298
+ prefix: '¤',
1299
+ suffix: '',
1300
+ decimals: 2,
1301
+ decimalSeparator: '.',
1302
+ thousandsSeparator: ',',
1303
+ },
1304
+ ZAR: {
1305
+ prefix: 'R',
1306
+ suffix: '',
1307
+ decimals: 2,
1308
+ decimalSeparator: '.',
1309
+ thousandsSeparator: ',',
1310
+ },
1311
+ ZMW: {
1312
+ prefix: 'ZK',
1313
+ suffix: '',
1314
+ decimals: 2,
1315
+ decimalSeparator: '.',
1316
+ thousandsSeparator: ',',
1317
+ },
1318
+ ZWD: {
1319
+ prefix: '$',
1320
+ suffix: '',
1321
+ decimals: 2,
1322
+ decimalSeparator: '.',
1323
+ thousandsSeparator: ',',
1324
+ }, // '$9,999.99'
1325
+ };
1326
+ function formatCurrency(value, currencyCode = 'USD', explicit = false) {
1327
+ let processedCurrencyCode = currencyCode || '';
1328
+ let allowDecimal = true;
1329
+ if (processedCurrencyCode.includes('-integer')) {
1330
+ processedCurrencyCode = processedCurrencyCode.split('-integer')[0];
1331
+ allowDecimal = false;
1332
+ }
1333
+ const currencyFormat = currencyFormats[processedCurrencyCode];
1334
+ if (!currencyFormat) {
1335
+ return formatValue(value);
1336
+ }
1337
+ const options = Object.assign(Object.assign({}, currencyFormat), { allowDecimal: allowDecimal && currencyFormat.decimals > 0, allowNegative: false });
1338
+ return formatNumber(value, options, explicit);
1339
+ }
1340
+
1341
+ const phoneNumberFormats = {
1342
+ AF: {
1343
+ mask: '(##) #######',
1344
+ prefix: '+93 ',
1345
+ },
1346
+ AL: {
1347
+ mask: '#######',
1348
+ prefix: '+355 ',
1349
+ },
1350
+ DZ: {
1351
+ mask: '(##) ###-###',
1352
+ prefix: '+213 ',
1353
+ },
1354
+ // AS
1355
+ AD: {
1356
+ mask: '(#) #####',
1357
+ prefix: '+376 ',
1358
+ },
1359
+ AO: {
1360
+ mask: '#########',
1361
+ prefix: '+244 ',
1362
+ },
1363
+ AI: {
1364
+ mask: '(###) ###-####',
1365
+ prefix: '+1 ',
1366
+ },
1367
+ AG: {
1368
+ mask: '(###) ###-####',
1369
+ prefix: '+1 ',
1370
+ },
1371
+ AR: {
1372
+ mask: '##########',
1373
+ prefix: '+54 ',
1374
+ },
1375
+ AM: {
1376
+ mask: '########',
1377
+ prefix: '+375 ',
1378
+ },
1379
+ AQ: {
1380
+ mask: '##-####',
1381
+ prefix: '+672 ',
1382
+ },
1383
+ AW: {
1384
+ mask: '###-####',
1385
+ prefix: '+297 ',
1386
+ },
1387
+ AU: {
1388
+ mask: '(##) ####-####',
1389
+ prefix: '+61 ',
1390
+ },
1391
+ /* AT: {
1392
+ mask:'####?????????',
1393
+ prefix: ''
1394
+ }, */
1395
+ AT: {
1396
+ mask: '#############',
1397
+ prefix: '+43 ',
1398
+ },
1399
+ /* AZ: {
1400
+ mask:'########?',
1401
+ prefix: ''
1402
+ }, */
1403
+ AZ: {
1404
+ mask: '#########',
1405
+ prefix: '+994 ',
1406
+ },
1407
+ BS: {
1408
+ mask: '(###) ###-####',
1409
+ prefix: '+1 ',
1410
+ },
1411
+ BH: {
1412
+ mask: '####-####',
1413
+ prefix: '+973 ',
1414
+ },
1415
+ /* BD: {
1416
+ mask:'#######??',
1417
+ prefix: ''
1418
+ }, */
1419
+ BD: {
1420
+ mask: '#########',
1421
+ prefix: '+880 ',
1422
+ },
1423
+ BB: {
1424
+ mask: '(###) ###-####',
1425
+ prefix: '+1 ',
1426
+ },
1427
+ BY: {
1428
+ mask: '#########',
1429
+ prefix: '+375 ',
1430
+ },
1431
+ BE: {
1432
+ mask: '########??',
1433
+ prefix: '+32 ',
1434
+ },
1435
+ BZ: {
1436
+ mask: '#######',
1437
+ prefix: '+501 ',
1438
+ },
1439
+ BJ: {
1440
+ mask: '(##) ###-###',
1441
+ prefix: '+229 ',
1442
+ },
1443
+ BM: {
1444
+ mask: '(###) ###-####',
1445
+ prefix: '+1 ',
1446
+ },
1447
+ BT: {
1448
+ mask: '(#) ###-###',
1449
+ prefix: '+975 ',
1450
+ },
1451
+ BO: {
1452
+ mask: '(#) ###-####',
1453
+ prefix: '+591 ',
1454
+ },
1455
+ BA: {
1456
+ mask: '(##) ##-##-##',
1457
+ prefix: '+387 ',
1458
+ },
1459
+ /* BW: {
1460
+ mask:'#######?',
1461
+ prefix: ''
1462
+ }, */
1463
+ BW: {
1464
+ mask: '########',
1465
+ prefix: '+267 ',
1466
+ },
1467
+ BR: {
1468
+ mask: '(##) ####-####',
1469
+ prefix: '+55 ',
1470
+ },
1471
+ BN: {
1472
+ mask: '###-####',
1473
+ prefix: '+673 ',
1474
+ },
1475
+ BG: {
1476
+ mask: '#######?',
1477
+ prefix: '+359 ',
1478
+ },
1479
+ BF: {
1480
+ mask: '##-##-##-##',
1481
+ prefix: '+226 ',
1482
+ },
1483
+ BI: {
1484
+ mask: '####-####',
1485
+ prefix: '+257 ',
1486
+ },
1487
+ KH: {
1488
+ mask: '(##) ######',
1489
+ prefix: '+855 ',
1490
+ },
1491
+ CM: {
1492
+ mask: '####-####',
1493
+ prefix: '+237 ',
1494
+ },
1495
+ CA: {
1496
+ mask: '(###) ###-####',
1497
+ prefix: '+1 ',
1498
+ },
1499
+ CV: {
1500
+ mask: '###-####',
1501
+ prefix: '+238 ',
1502
+ },
1503
+ KY: {
1504
+ mask: '(###) ###-####',
1505
+ prefix: '+1 ',
1506
+ },
1507
+ CF: {
1508
+ mask: '###-###',
1509
+ prefix: '+236 ',
1510
+ },
1511
+ TD: {
1512
+ mask: '###-##-##',
1513
+ prefix: '+235 ',
1514
+ },
1515
+ /* CL: {
1516
+ mask:'########?',
1517
+ prefix: ''
1518
+ }, */
1519
+ CL: {
1520
+ mask: '#########',
1521
+ prefix: '+56 ',
1522
+ },
1523
+ /* CN: {
1524
+ mask:'########???',
1525
+ prefix: ''
1526
+ }, */
1527
+ CN: {
1528
+ mask: '###########',
1529
+ prefix: '+86 ',
1530
+ },
1531
+ /* CO: {
1532
+ mask:'########??',
1533
+ prefix: ''
1534
+ }, */
1535
+ CO: {
1536
+ mask: '##########',
1537
+ prefix: '57 ',
1538
+ },
1539
+ KM: {
1540
+ mask: '###-####',
1541
+ prefix: '+269 ',
1542
+ },
1543
+ CD: {
1544
+ mask: '###-####',
1545
+ prefix: '+243 ',
1546
+ },
1547
+ CG: {
1548
+ mask: '###-####',
1549
+ prefix: '+242 ',
1550
+ },
1551
+ // CK
1552
+ CR: {
1553
+ mask: '####-####',
1554
+ prefix: '+506 ',
1555
+ },
1556
+ CI: {
1557
+ mask: '####-####',
1558
+ prefix: '+225 ',
1559
+ },
1560
+ HR: {
1561
+ mask: '########?',
1562
+ prefix: '+385 ',
1563
+ },
1564
+ /* CU: {
1565
+ mask:'#####?ID:?????',
1566
+ prefix: ''
1567
+ }, */
1568
+ CU: {
1569
+ mask: '###########',
1570
+ prefix: '+53 ',
1571
+ },
1572
+ CY: {
1573
+ mask: '####-####',
1574
+ prefix: '+357 ',
1575
+ },
1576
+ CZ: {
1577
+ mask: '#########',
1578
+ prefix: '+420 ',
1579
+ },
1580
+ DK: {
1581
+ mask: '####-####',
1582
+ prefix: '+45 ',
1583
+ },
1584
+ DJ: {
1585
+ mask: '##-##-##-##',
1586
+ prefix: '+253 ',
1587
+ },
1588
+ DM: {
1589
+ mask: '(###) ###-####',
1590
+ prefix: '+1 ',
1591
+ },
1592
+ DO: {
1593
+ mask: '(###) ###-####',
1594
+ prefix: '+1 ',
1595
+ },
1596
+ TL: {
1597
+ mask: '###-####',
1598
+ prefix: '+670 ',
1599
+ },
1600
+ EC: {
1601
+ mask: '(##) ###-####',
1602
+ prefix: '+593 ',
1603
+ },
1604
+ /* EG: {
1605
+ mask:'########??',
1606
+ prefix: ''
1607
+ }, */
1608
+ EG: {
1609
+ mask: '##########',
1610
+ prefix: '+20 ',
1611
+ },
1612
+ SV: {
1613
+ mask: '####-####',
1614
+ prefix: '+503 ',
1615
+ },
1616
+ GQ: {
1617
+ mask: '##-####',
1618
+ prefix: '+240 ',
1619
+ },
1620
+ // ER:
1621
+ EE: {
1622
+ mask: '#######?',
1623
+ prefix: '+372 ',
1624
+ },
1625
+ ET: {
1626
+ mask: '(##) ###-####',
1627
+ prefix: '+251 ',
1628
+ },
1629
+ FK: {
1630
+ mask: '#####',
1631
+ prefix: '+500 ',
1632
+ },
1633
+ FO: {
1634
+ mask: '######',
1635
+ prefix: '+298 ',
1636
+ },
1637
+ FJ: {
1638
+ mask: '###-####',
1639
+ prefix: '+679 ',
1640
+ },
1641
+ /* FI: {
1642
+ mask:'#####???????',
1643
+ prefix: ''
1644
+ }, */
1645
+ FI: {
1646
+ mask: '############',
1647
+ prefix: '+358 ',
1648
+ },
1649
+ FR: {
1650
+ mask: '#########',
1651
+ prefix: '+33 ',
1652
+ },
1653
+ /* GF: {
1654
+ mask:'#########?',
1655
+ prefix: ''
1656
+ }, */
1657
+ GF: {
1658
+ mask: '##########',
1659
+ prefix: '+594 ',
1660
+ },
1661
+ PF: {
1662
+ mask: '######',
1663
+ prefix: '+689 ',
1664
+ },
1665
+ GA: {
1666
+ mask: '######?',
1667
+ prefix: '+241 ',
1668
+ },
1669
+ GM: {
1670
+ mask: '###-####',
1671
+ prefix: '+220 ',
1672
+ },
1673
+ GE: {
1674
+ mask: '########',
1675
+ prefix: '+995 ',
1676
+ },
1677
+ /* DE: {
1678
+ mask:'######?????',
1679
+ prefix: ''
1680
+ }, */
1681
+ DE: {
1682
+ mask: '###########',
1683
+ prefix: '+49 ',
1684
+ },
1685
+ /* GH: {
1686
+ mask:'########?',
1687
+ prefix: ''
1688
+ }, */
1689
+ GH: {
1690
+ mask: '#########',
1691
+ prefix: '+233 ',
1692
+ },
1693
+ GI: {
1694
+ mask: '####-####',
1695
+ prefix: '+350 ',
1696
+ },
1697
+ GR: {
1698
+ mask: '##########',
1699
+ prefix: '+30 ',
1700
+ },
1701
+ GL: {
1702
+ mask: '###-###',
1703
+ prefix: '+299 ',
1704
+ },
1705
+ GD: {
1706
+ mask: '(###) ###-####',
1707
+ prefix: '+1 ',
1708
+ },
1709
+ GP: {
1710
+ mask: '##########',
1711
+ prefix: '+590 ',
1712
+ },
1713
+ GU: {
1714
+ mask: '(###) ###-####',
1715
+ prefix: '+1 ',
1716
+ },
1717
+ GT: {
1718
+ mask: '####-####',
1719
+ prefix: '+502 ',
1720
+ },
1721
+ GN: {
1722
+ mask: '####-####',
1723
+ prefix: '+224 ',
1724
+ },
1725
+ GW: {
1726
+ mask: '###-####',
1727
+ prefix: '+245 ',
1728
+ },
1729
+ GY: {
1730
+ mask: '(###) ####',
1731
+ prefix: '+592 ',
1732
+ },
1733
+ HK: {
1734
+ mask: '####-####',
1735
+ prefix: '+852 ',
1736
+ },
1737
+ HN: {
1738
+ mask: '########',
1739
+ prefix: '+504 ',
1740
+ },
1741
+ HT: {
1742
+ mask: '####-####',
1743
+ prefix: '+509 ',
1744
+ },
1745
+ HU: {
1746
+ mask: '########??',
1747
+ prefix: '+36 ',
1748
+ },
1749
+ /* IS: {
1750
+ mask:'#######??',
1751
+ prefix: ''
1752
+ }, */
1753
+ IS: {
1754
+ mask: '#########',
1755
+ prefix: '+354 ',
1756
+ },
1757
+ IN: {
1758
+ mask: '##########',
1759
+ prefix: '+91 ',
1760
+ },
1761
+ /* ID: {
1762
+ mask:'#######???',
1763
+ prefix: ''
1764
+ }, */
1765
+ ID: {
1766
+ mask: '#######??????',
1767
+ prefix: '+62 ',
1768
+ },
1769
+ IR: {
1770
+ mask: '##########',
1771
+ prefix: '+98 ',
1772
+ },
1773
+ /* IQ: {
1774
+ mask:'########??',
1775
+ prefix: ''
1776
+ }, */
1777
+ IQ: {
1778
+ mask: '##########',
1779
+ prefix: '+964 ',
1780
+ },
1781
+ /* IE: {
1782
+ mask:'#######??',
1783
+ prefix: ''
1784
+ }, */
1785
+ IE: {
1786
+ mask: '#########',
1787
+ prefix: '+353 ',
1788
+ },
1789
+ /* IL: {
1790
+ mask:'########?',
1791
+ prefix: ''
1792
+ }, */
1793
+ IL: {
1794
+ mask: '#########',
1795
+ prefix: '+972 ',
1796
+ },
1797
+ /* IT: {
1798
+ mask:'######????',
1799
+ prefix: ''
1800
+ }, */
1801
+ IT: {
1802
+ mask: '##########',
1803
+ prefix: '+39 ',
1804
+ },
1805
+ JM: {
1806
+ mask: '(###) ###-####',
1807
+ prefix: '+1 ',
1808
+ },
1809
+ JP: {
1810
+ mask: '#########',
1811
+ prefix: '+81 ',
1812
+ },
1813
+ /* JO: {
1814
+ mask:'#######??',
1815
+ prefix: ''
1816
+ }, */
1817
+ JO: {
1818
+ mask: '#########',
1819
+ prefix: '+962 ',
1820
+ },
1821
+ KZ: {
1822
+ mask: '(###) ####-###',
1823
+ prefix: '+7 ',
1824
+ },
1825
+ /* KE: {
1826
+ mask:'######????',
1827
+ prefix: ''
1828
+ }, */
1829
+ KE: {
1830
+ mask: '##########',
1831
+ prefix: '+254 ',
1832
+ },
1833
+ KI: {
1834
+ mask: '##-###',
1835
+ prefix: '+686 ',
1836
+ },
1837
+ // kp
1838
+ /* KR: {
1839
+ mask:'####??????',
1840
+ prefix: ''
1841
+ }, */
1842
+ KR: {
1843
+ mask: '##########',
1844
+ prefix: '+82 ',
1845
+ },
1846
+ KW: {
1847
+ mask: '####-####',
1848
+ prefix: '+965 ',
1849
+ },
1850
+ KG: {
1851
+ mask: '#########',
1852
+ prefix: '+996 ',
1853
+ },
1854
+ LA: {
1855
+ mask: '########?',
1856
+ prefix: '+856 ',
1857
+ },
1858
+ LV: {
1859
+ mask: '####-####',
1860
+ prefix: '+371 ',
1861
+ },
1862
+ LB: {
1863
+ mask: '#######?',
1864
+ prefix: '+961 ',
1865
+ },
1866
+ LS: {
1867
+ mask: '##-###-###',
1868
+ prefix: '+266 ',
1869
+ },
1870
+ // LR
1871
+ /* LY: {
1872
+ mask:'########?',
1873
+ prefix: ''
1874
+ }, */
1875
+ LY: {
1876
+ mask: '########?',
1877
+ prefix: '+218 ',
1878
+ },
1879
+ LI: {
1880
+ mask: '###-####',
1881
+ prefix: '+423 ',
1882
+ },
1883
+ LT: {
1884
+ mask: '########',
1885
+ prefix: '+370 ',
1886
+ },
1887
+ /* LU: {
1888
+ mask:'#####??????',
1889
+ prefix: '+352 '
1890
+ }, */
1891
+ LU: {
1892
+ mask: '###########',
1893
+ prefix: '+352 ',
1894
+ },
1895
+ MO: {
1896
+ mask: '####-####',
1897
+ prefix: '+853 ',
1898
+ },
1899
+ MK: {
1900
+ mask: '########',
1901
+ prefix: '+389 ',
1902
+ },
1903
+ MG: {
1904
+ mask: '##-##-###-##',
1905
+ prefix: '+261 ',
1906
+ },
1907
+ /* MW: {
1908
+ mask:'#######??',
1909
+ prefix: '+265 '
1910
+ }, */
1911
+ MW: {
1912
+ mask: '#########',
1913
+ prefix: '+265 ',
1914
+ },
1915
+ /* MY: {
1916
+ mask:'#######???',
1917
+ prefix: '+60 '
1918
+ }, */
1919
+ MY: {
1920
+ mask: '##########',
1921
+ prefix: '+60 ',
1922
+ },
1923
+ MV: {
1924
+ mask: '###-####',
1925
+ prefix: '+960 ',
1926
+ },
1927
+ ML: {
1928
+ mask: '####-####',
1929
+ prefix: '+223 ',
1930
+ },
1931
+ MT: {
1932
+ mask: '##-##-##-##',
1933
+ prefix: '+356 ',
1934
+ },
1935
+ MH: {
1936
+ mask: '###-####',
1937
+ prefix: '+692 ',
1938
+ },
1939
+ MQ: {
1940
+ mask: '###-######',
1941
+ prefix: '+596 ',
1942
+ },
1943
+ // MR
1944
+ MU: {
1945
+ mask: '###-####',
1946
+ prefix: '+230 ',
1947
+ },
1948
+ // YT
1949
+ MX: {
1950
+ mask: '(###) ###-####',
1951
+ prefix: '+52 ',
1952
+ },
1953
+ // FM
1954
+ MD: {
1955
+ mask: '########',
1956
+ prefix: '+373 ',
1957
+ },
1958
+ MC: {
1959
+ mask: '####-####',
1960
+ prefix: '+377 ',
1961
+ },
1962
+ /* MN: {
1963
+ mask:'######?????',
1964
+ prefix: '+976 '
1965
+ }, */
1966
+ MN: {
1967
+ mask: '###########',
1968
+ prefix: '+976 ',
1969
+ },
1970
+ MS: {
1971
+ mask: '(###) ###-####',
1972
+ prefix: '+1 ',
1973
+ },
1974
+ MA: {
1975
+ mask: '#########?',
1976
+ prefix: '+212 ',
1977
+ },
1978
+ /* MZ: {
1979
+ mask:'########?',
1980
+ prefix: '+258 '
1981
+ }, */
1982
+ MZ: {
1983
+ mask: '#########',
1984
+ prefix: '+258 ',
1985
+ },
1986
+ /* MM: {
1987
+ mask:'#######?',
1988
+ prefix: '+95 '
1989
+ }, */
1990
+ MM: {
1991
+ mask: '########',
1992
+ prefix: '+95 ',
1993
+ },
1994
+ /* NA: {
1995
+ mask:'######????',
1996
+ prefix: '+264 '
1997
+ }, */
1998
+ NA: {
1999
+ mask: '##########',
2000
+ prefix: '+264 ',
2001
+ },
2002
+ // NR
2003
+ /* NP: {
2004
+ mask:'########??',
2005
+ prefix: '+977 '
2006
+ }, */
2007
+ NP: {
2008
+ mask: '##########',
2009
+ prefix: '+977 ',
2010
+ },
2011
+ NL: {
2012
+ mask: '#########',
2013
+ prefix: '+31 ',
2014
+ },
2015
+ /* AN: {
2016
+ mask:'#######?',
2017
+ prefix: '+599 '
2018
+ }, */
2019
+ AN: {
2020
+ mask: '########',
2021
+ prefix: '+599 ',
2022
+ },
2023
+ NC: {
2024
+ mask: '###-###',
2025
+ prefix: '+687 ',
2026
+ },
2027
+ /* NZ: {
2028
+ mask:'########??',
2029
+ prefix: '+64 '
2030
+ }, */
2031
+ NZ: {
2032
+ mask: '##########',
2033
+ prefix: '+64 ',
2034
+ },
2035
+ NI: {
2036
+ mask: '####-####',
2037
+ prefix: '+505 ',
2038
+ },
2039
+ NE: {
2040
+ mask: '##-###-###',
2041
+ prefix: '+227 ',
2042
+ },
2043
+ /* NG: {
2044
+ mask:'########??',
2045
+ prefix: '+234 '
2046
+ }, */
2047
+ NG: {
2048
+ mask: '##########',
2049
+ prefix: '+234 ',
2050
+ },
2051
+ // NU
2052
+ MP: {
2053
+ mask: '(###) ###-####',
2054
+ prefix: '+1 ',
2055
+ },
2056
+ NO: {
2057
+ mask: '####-####',
2058
+ prefix: '+47 ',
2059
+ },
2060
+ OM: {
2061
+ mask: '####-####',
2062
+ prefix: '+968 ',
2063
+ },
2064
+ /* PK: {
2065
+ mask:'#########?',
2066
+ prefix: '+92 '
2067
+ }, */
2068
+ PK: {
2069
+ mask: '##########',
2070
+ prefix: '+92 ',
2071
+ },
2072
+ PW: {
2073
+ mask: '###-####',
2074
+ prefix: '+680 ',
2075
+ },
2076
+ /* PA: {
2077
+ mask:'#######?',
2078
+ prefix: '+507 '
2079
+ }, */
2080
+ PA: {
2081
+ mask: '########',
2082
+ prefix: '+507 ',
2083
+ },
2084
+ /* PG: {
2085
+ mask:'#######?',
2086
+ prefix: '+675 '
2087
+ }, */
2088
+ PG: {
2089
+ mask: '########',
2090
+ prefix: '+675 ',
2091
+ },
2092
+ // PY
2093
+ /* PE: {
2094
+ mask:'#######????',
2095
+ prefix: '+51 '
2096
+ }, */
2097
+ PE: {
2098
+ mask: '###########',
2099
+ prefix: '+51 ',
2100
+ },
2101
+ /* PH: {
2102
+ mask:'########??',
2103
+ prefix: '+63 '
2104
+ }, */
2105
+ PH: {
2106
+ mask: '##########',
2107
+ prefix: '+63 ',
2108
+ },
2109
+ PL: {
2110
+ mask: '#########',
2111
+ prefix: '+48 ',
2112
+ },
2113
+ PT: {
2114
+ mask: '#-####-####',
2115
+ prefix: '+351 ',
2116
+ },
2117
+ PR: {
2118
+ mask: '(###) ###-####',
2119
+ prefix: '+1 ',
2120
+ },
2121
+ QA: {
2122
+ mask: '###-####',
2123
+ prefix: '+974 ',
2124
+ },
2125
+ RE: {
2126
+ mask: '###-###-###',
2127
+ prefix: '+262 ',
2128
+ },
2129
+ RO: {
2130
+ mask: '#########',
2131
+ prefix: '+40 ',
2132
+ },
2133
+ RU: {
2134
+ mask: '##########',
2135
+ prefix: '+7 ',
2136
+ },
2137
+ RW: {
2138
+ mask: '###-###-###',
2139
+ prefix: '+250 ',
2140
+ },
2141
+ SH: {
2142
+ mask: '#-###',
2143
+ prefix: '+290 ',
2144
+ },
2145
+ // PM
2146
+ KN: {
2147
+ mask: '(###) ###-####',
2148
+ prefix: '+1 ',
2149
+ },
2150
+ LC: {
2151
+ mask: '(###) ###-####',
2152
+ prefix: '+1 ',
2153
+ },
2154
+ VC: {
2155
+ mask: '(###) ###-####',
2156
+ prefix: '+1 ',
2157
+ },
2158
+ // WS
2159
+ // SM
2160
+ ST: {
2161
+ mask: '##-####',
2162
+ prefix: '+239 ',
2163
+ },
2164
+ /* SA: {
2165
+ mask:'########?',
2166
+ prefix: '+966 '
2167
+ }, */
2168
+ SA: {
2169
+ mask: '#########',
2170
+ prefix: '+966 ',
2171
+ },
2172
+ SN: {
2173
+ mask: '##-###-####',
2174
+ prefix: '+221 ',
2175
+ },
2176
+ SC: {
2177
+ mask: '###-###',
2178
+ prefix: '+248 ',
2179
+ },
2180
+ SL: {
2181
+ mask: '(##) ###-###',
2182
+ prefix: '+232 ',
2183
+ },
2184
+ SG: {
2185
+ mask: '####-####',
2186
+ prefix: '+65 ',
2187
+ },
2188
+ SK: {
2189
+ mask: '#########',
2190
+ prefix: '+421 ',
2191
+ },
2192
+ SI: {
2193
+ mask: '########',
2194
+ prefix: '+386 ',
2195
+ },
2196
+ SB: {
2197
+ mask: '##-###',
2198
+ prefix: '+677 ',
2199
+ },
2200
+ // SO
2201
+ ZA: {
2202
+ mask: '(##) ###-####',
2203
+ prefix: '+27 ',
2204
+ },
2205
+ ES: {
2206
+ mask: '###-###-###',
2207
+ prefix: '+34 ',
2208
+ },
2209
+ LK: {
2210
+ mask: '(##) ###-####',
2211
+ prefix: '+94 ',
2212
+ },
2213
+ SD: {
2214
+ mask: '##-###-####',
2215
+ prefix: '+249 ',
2216
+ },
2217
+ SR: {
2218
+ mask: '######?',
2219
+ prefix: '+597 ',
2220
+ },
2221
+ SZ: {
2222
+ mask: '###-####',
2223
+ prefix: '+268 ',
2224
+ },
2225
+ /* SE: {
2226
+ mask:'######?????',
2227
+ prefix: '+46 '
2228
+ }, */
2229
+ SE: {
2230
+ mask: '###########',
2231
+ prefix: '+46 ',
2232
+ },
2233
+ CH: {
2234
+ mask: '(##) ###-####',
2235
+ prefix: '+41 ',
2236
+ },
2237
+ /* SY: {
2238
+ mask:'########?',
2239
+ prefix: '+963 '
2240
+ }, */
2241
+ SY: {
2242
+ mask: '#########',
2243
+ prefix: '+963 ',
2244
+ },
2245
+ TJ: {
2246
+ mask: '#########',
2247
+ prefix: '+992 ',
2248
+ },
2249
+ TZ: {
2250
+ mask: '#########',
2251
+ prefix: '+255 ',
2252
+ },
2253
+ /* TH: {
2254
+ mask:'########?',
2255
+ prefix: '+66 '
2256
+ }, */
2257
+ TH: {
2258
+ mask: '#########',
2259
+ prefix: '+66 ',
2260
+ },
2261
+ TG: {
2262
+ mask: '###-####',
2263
+ prefix: '+228 ',
2264
+ },
2265
+ // TK
2266
+ // TO
2267
+ TT: {
2268
+ mask: '(###) ###-####',
2269
+ prefix: '+1 ',
2270
+ },
2271
+ TN: {
2272
+ mask: '##-###-###',
2273
+ prefix: '+216 ',
2274
+ },
2275
+ TR: {
2276
+ mask: '(###) ###-####',
2277
+ prefix: '+90 ',
2278
+ },
2279
+ TM: {
2280
+ mask: '########',
2281
+ prefix: '+993 ',
2282
+ },
2283
+ TC: {
2284
+ mask: '(###) ###-####',
2285
+ prefix: '+1 ',
2286
+ },
2287
+ // TV
2288
+ UG: {
2289
+ mask: '#########',
2290
+ prefix: '+256 ',
2291
+ },
2292
+ UA: {
2293
+ mask: '(##) ###-####',
2294
+ prefix: '+380 ',
2295
+ },
2296
+ /* AE: {
2297
+ mask:'########?',
2298
+ prefix: '+971 '
2299
+ }, */
2300
+ AE: {
2301
+ mask: '#########',
2302
+ prefix: '+971 ',
2303
+ },
2304
+ /* GB: {
2305
+ mask:'##########???',
2306
+ prefix: '+44 '
2307
+ }, */
2308
+ GB: {
2309
+ mask: '#########????',
2310
+ prefix: '+44 ',
2311
+ },
2312
+ UY: {
2313
+ mask: '########?',
2314
+ prefix: '+598 ',
2315
+ },
2316
+ UZ: {
2317
+ mask: '(##) ###-####',
2318
+ prefix: '+998 ',
2319
+ },
2320
+ // VU
2321
+ // VA
2322
+ VE: {
2323
+ mask: '(###) ###-####',
2324
+ prefix: '+58 ',
2325
+ },
2326
+ VN: {
2327
+ mask: '#######????',
2328
+ prefix: '+84 ',
2329
+ },
2330
+ VG: {
2331
+ mask: '(###) ###-####',
2332
+ prefix: '+1 ',
2333
+ },
2334
+ VI: {
2335
+ mask: '(###) ###-####',
2336
+ prefix: '+1 ',
2337
+ },
2338
+ // WF
2339
+ /* YE: {
2340
+ mask:'#######??',
2341
+ prefix: '+967 '
2342
+ }, */
2343
+ YE: {
2344
+ mask: '#########',
2345
+ prefix: '+967 ',
2346
+ },
2347
+ // YU
2348
+ ZM: {
2349
+ mask: '#########',
2350
+ prefix: '+260 ',
2351
+ },
2352
+ /* ZW: {
2353
+ mask:'####?????',
2354
+ prefix: '+263 '
2355
+ }, */
2356
+ ZW: {
2357
+ mask: '#########',
2358
+ prefix: '+263 ',
2359
+ },
2360
+ AC: {
2361
+ mask: '####',
2362
+ prefix: '+247 ',
2363
+ },
2364
+ ME: {
2365
+ mask: '(##) ###-####',
2366
+ prefix: '+382 ',
2367
+ },
2368
+ /* PS: {
2369
+ mask:'########?',
2370
+ prefix: '+970 '
2371
+ }, */
2372
+ PS: {
2373
+ mask: '#########',
2374
+ prefix: '+970 ',
2375
+ },
2376
+ /* RS: {
2377
+ mask:'#######??',
2378
+ prefix: '+381 '
2379
+ }, */
2380
+ RS: {
2381
+ mask: '#########',
2382
+ prefix: '+381 ',
2383
+ },
2384
+ /* TW: {
2385
+ mask:'########?',
2386
+ prefix: '+886 '
2387
+ }, */
2388
+ TW: {
2389
+ mask: '#########',
2390
+ prefix: '+886 ',
2391
+ },
2392
+ CW: {
2393
+ mask: '#-###-####',
2394
+ prefix: '+599 ',
2395
+ },
2396
+ US: {
2397
+ mask: '(###) ###-####',
2398
+ prefix: '',
2399
+ },
2400
+ };
2401
+ function formatPhoneNumber(value, isoCode = 'US') {
2402
+ const { mask, prefix } = phoneNumberFormats[isoCode] || phoneNumberFormats.US;
2403
+ const options = {
2404
+ prefix,
2405
+ };
2406
+ const val = value || '';
2407
+ // Brazil need edge case handle, mobile: (xx) xxxxx-xxxx, land phone: (xx) xxxx-xxxx
2408
+ if (isoCode === 'BR' && val.replace(/[^0-9]/g, '').length === 11) {
2409
+ return formatValue(val, '(##) #####-####', options);
2410
+ }
2411
+ else {
2412
+ return formatValue(val, mask, options);
2413
+ }
2414
+ }
2415
+
2416
+ function formatSSN(value) {
2417
+ return formatValue(value, '###-##-####');
2418
+ }
2419
+
2420
+ function formatAlphanumeric(value) {
2421
+ const val = (value || '').replace(/[^\da-zA-Z]/g, '');
2422
+ return formatValue(val);
2423
+ }
2424
+
2425
+ function formatAlpha(value, modifier) {
2426
+ let val = value || '';
2427
+ if (modifier === 'spaced') {
2428
+ val = val.replace(/[^a-zA-Z ]/g, '');
2429
+ }
2430
+ else {
2431
+ val = val.replace(/[^a-zA-Z]/g, '');
2432
+ }
2433
+ return formatValue(val);
2434
+ }
2435
+
2436
+ const numberFormats = {
2437
+ delimited: {
2438
+ prefix: '',
2439
+ suffix: '',
2440
+ decimals: 0,
2441
+ decimalSeparator: '.',
2442
+ thousandsSeparator: ',',
2443
+ allowDecimal: false,
2444
+ allowNegative: true,
2445
+ },
2446
+ integer: {
2447
+ prefix: '',
2448
+ suffix: '',
2449
+ decimals: 0,
2450
+ decimalSeparator: '.',
2451
+ thousandsSeparator: '',
2452
+ allowDecimal: true,
2453
+ allowNegative: true,
2454
+ },
2455
+ dec: {
2456
+ prefix: '',
2457
+ suffix: '',
2458
+ decimals: 2,
2459
+ decimalSeparator: '.',
2460
+ thousandsSeparator: ',',
2461
+ allowDecimal: true,
2462
+ allowNegative: true,
2463
+ },
2464
+ };
2465
+ function getNumberFormat(key) {
2466
+ let decimals;
2467
+ if (key.includes('dec')) {
2468
+ decimals = Number(key.replace('dec', ''));
2469
+ key = 'dec';
2470
+ }
2471
+ let numberFormat = numberFormats[key];
2472
+ if (!numberFormat) {
2473
+ return;
2474
+ }
2475
+ numberFormat = Object.assign({}, numberFormat);
2476
+ if (decimals) {
2477
+ numberFormat.decimals = decimals;
2478
+ }
2479
+ return numberFormat;
2480
+ }
2481
+ function formatNumeric(value = '', modifier = '', explicit = false) {
2482
+ const numberFormat = getNumberFormat(modifier);
2483
+ if (!numberFormat) {
2484
+ const val = (value || '').replace(/[^\d.,-]/g, '');
2485
+ return formatValue(val);
2486
+ }
2487
+ return formatNumber(value, numberFormat, explicit);
2488
+ }
2489
+ function formatPercentage(value = '', modifier = '', explicit = false) {
2490
+ const numberFormat = getNumberFormat(modifier);
2491
+ if (!numberFormat) {
2492
+ const val = (value || '').replace(/[^\d.,-]/g, '');
2493
+ return formatValue(val, undefined, { suffix: '%' });
2494
+ }
2495
+ numberFormat.suffix = '%';
2496
+ return formatNumber(value, numberFormat, explicit);
2497
+ }
2498
+
2499
+ const postalCodeFormats = {
2500
+ AF: '####',
2501
+ AL: '####',
2502
+ DZ: '#####',
2503
+ AC: 'ASCN 1ZZ',
2504
+ AD: 'AD###',
2505
+ AR: '####',
2506
+ 'AR+': '@####@@@',
2507
+ AI: 'AI-2640',
2508
+ AM: '####',
2509
+ AS: '#####',
2510
+ 'AS+4': '#####-####',
2511
+ AU: '####',
2512
+ AT: '####',
2513
+ AZ: 'AZ ####',
2514
+ BH: '###?',
2515
+ BD: '####',
2516
+ BB: 'BB#####',
2517
+ BY: '######',
2518
+ BE: '####',
2519
+ BM: '@@ **',
2520
+ BT: '#####',
2521
+ BA: '######',
2522
+ BR: '#####',
2523
+ 'BR+3': '#####-###',
2524
+ VG: 'VG####',
2525
+ BN: '@@####',
2526
+ BG: '####',
2527
+ KH: '#####',
2528
+ KY: 'KY#-####',
2529
+ CA: '@#@ #@#',
2530
+ CL: '###-####',
2531
+ CN: '######',
2532
+ CX: '####',
2533
+ CC: '####',
2534
+ CO: '######',
2535
+ CR: '#####',
2536
+ 'CR+4': '#####-####',
2537
+ CV: '####',
2538
+ HR: '#####',
2539
+ CU: '#####',
2540
+ CY: '####',
2541
+ CZ: '### ##',
2542
+ DK: '####',
2543
+ DO: '#####',
2544
+ EC: '######',
2545
+ SV: '####',
2546
+ EG: '#####',
2547
+ EE: '#####',
2548
+ ET: '####',
2549
+ FK: 'FIQQ 1ZZ',
2550
+ FO: '###',
2551
+ FI: '#####',
2552
+ FR: '#####',
2553
+ GF: '973##',
2554
+ PF: '987##',
2555
+ GI: 'GX11 1AA',
2556
+ GE: '####',
2557
+ DE: '#####',
2558
+ GR: '### ##',
2559
+ GL: '####',
2560
+ GP: '971##',
2561
+ GU: '#####',
2562
+ 'GU+4': '#####-####',
2563
+ GT: '#####',
2564
+ GG: 'GY#? #@@',
2565
+ GN: '###',
2566
+ GS: 'SIQQ 1ZZ',
2567
+ GW: '####',
2568
+ HT: '####',
2569
+ HN: '@@####',
2570
+ 'HN-': '#####',
2571
+ HU: '####',
2572
+ IS: '###',
2573
+ IN: '### ###',
2574
+ ID: '#####',
2575
+ IE: '*** ****',
2576
+ IR: '##########',
2577
+ IQ: '#####',
2578
+ IM: 'IM#? #@@',
2579
+ IL: '#######',
2580
+ IT: '#####',
2581
+ JM: '##',
2582
+ JP: '###-####',
2583
+ JE: 'JE#? #@@',
2584
+ JO: '#####',
2585
+ KZ: '######',
2586
+ KE: '#####',
2587
+ KR: '#####',
2588
+ KN: 'KN####',
2589
+ XK: '#####',
2590
+ KW: '#####',
2591
+ KG: '######',
2592
+ LA: '#####',
2593
+ LV: 'LV-####',
2594
+ LB: '####? ????',
2595
+ LS: '###',
2596
+ LR: '####',
2597
+ LI: '####',
2598
+ LT: '#####',
2599
+ LU: '####',
2600
+ MK: '####',
2601
+ MG: '###',
2602
+ MY: '#####',
2603
+ MV: '#####',
2604
+ MT: '@@@ ####',
2605
+ MH: '#####',
2606
+ 'MH+4': '#####-####',
2607
+ MU: '#####',
2608
+ MQ: '972##',
2609
+ MW: '######',
2610
+ YT: '976##',
2611
+ MX: '#####',
2612
+ FM: '#####',
2613
+ 'FM+4': '#####-####',
2614
+ MD: '####',
2615
+ MC: '980##',
2616
+ MN: '#####',
2617
+ ME: '#####',
2618
+ MA: '#####',
2619
+ MZ: '####',
2620
+ MM: '#####',
2621
+ NA: '#####',
2622
+ NP: '#####',
2623
+ NC: '988##',
2624
+ NZ: '####',
2625
+ NI: '#####',
2626
+ NE: '####',
2627
+ NG: '######',
2628
+ NF: '####',
2629
+ MP: '#####',
2630
+ NO: '####',
2631
+ OM: '###',
2632
+ PK: '#####',
2633
+ PW: '#####',
2634
+ 'PW+4': '#####-####',
2635
+ PS: '###',
2636
+ PA: '####',
2637
+ PG: '###',
2638
+ PY: '####',
2639
+ PE: '#####',
2640
+ 'PE+': '####',
2641
+ PH: '####',
2642
+ PL: '##-###',
2643
+ PT: '####',
2644
+ 'PT+3': '####-###',
2645
+ PR: '#####',
2646
+ 'PR+4': '#####-####',
2647
+ RE: '974##',
2648
+ PM: '975##',
2649
+ PN: 'PCRN 1ZZ',
2650
+ RO: '######',
2651
+ RU: '######',
2652
+ LC: 'LC## ###',
2653
+ VC: '####',
2654
+ WS: '####',
2655
+ SM: '4879#',
2656
+ SA: '#####',
2657
+ 'SA+4': '#####-####',
2658
+ SN: '#####',
2659
+ RS: '#####',
2660
+ SG: '######',
2661
+ SH: '@@@@ 1ZZ',
2662
+ SK: '### ##',
2663
+ SI: '####',
2664
+ SO: '@@ #####',
2665
+ ZA: '####',
2666
+ ES: '#####',
2667
+ LK: '#####',
2668
+ SD: '#####',
2669
+ SZ: '@###',
2670
+ SE: '### ##',
2671
+ CH: '####',
2672
+ SJ: '####',
2673
+ TW: '###',
2674
+ 'TW+2': '###-##?',
2675
+ TJ: '######',
2676
+ TZ: '#####',
2677
+ TH: '#####',
2678
+ TT: '######',
2679
+ TN: '####',
2680
+ TR: '#####',
2681
+ TM: '######',
2682
+ UA: '#####',
2683
+ UY: '#####',
2684
+ VI: '#####',
2685
+ 'VI+4': '#####-####',
2686
+ UZ: '######',
2687
+ VE: '####',
2688
+ 'VE-': '####-@',
2689
+ VN: '#####?',
2690
+ YU: '#####',
2691
+ WF: '986##',
2692
+ ZM: '#####',
2693
+ US: '#####',
2694
+ 'US+4': '#####-####',
2695
+ };
2696
+ function formatPostalCode(value, modifier = 'US') {
2697
+ const mask = postalCodeFormats[modifier];
2698
+ if (!mask) {
2699
+ return formatAlphanumeric(value);
2700
+ }
2701
+ return formatValue(value, mask);
2702
+ }
2703
+
2704
+ const dateFormats = {
2705
+ 'MM/DD/YYYY': '##/##/####',
2706
+ 'M/D/YYYY': '#?/#?/####',
2707
+ 'MM/DD/YY': '##/##/##',
2708
+ 'M/D/YY': '#?/#?/##',
2709
+ 'MM/YY': '##/##',
2710
+ 'M/YY': '#?/##',
2711
+ 'DD/MM/YYYY': '##/##/####',
2712
+ 'D/M/YYYY': '#?/#?/####',
2713
+ 'DD/MM/YY': '##/##/##',
2714
+ 'D/M/YY': '#?/#?/##',
2715
+ 'MM-DD-YYYY': '##-##-####',
2716
+ 'M-D-YYYY': '#?-#?-####',
2717
+ 'MM-DD-YY': '##-##-##',
2718
+ 'M-D-YY': '#?-#?-##',
2719
+ 'MM-YY': '##-##',
2720
+ 'M-YY': '#?-##',
2721
+ 'DD-MM-YYYY': '##-##-####',
2722
+ 'D-M-YYYY': '#?-#?-####',
2723
+ 'DD-MM-YY': '##-##-##',
2724
+ 'D-M-YY': '#?-#?-##',
2725
+ };
2726
+ function formatDate(value, format = 'MM/DD/YYYY') {
2727
+ const mask = dateFormats[format] || dateFormats['MM/DD/YYYY'];
2728
+ const formattedValueObject = formatValue(value, mask);
2729
+ return Object.assign(Object.assign({}, formattedValueObject), { value: formattedValueObject.formattedValue });
2730
+ }
2731
+
2732
+ function format(value) {
2733
+ // have a initial generic mask which then converts to specific mask
2734
+ const detectedType = formatCreditCard.detectCreditCardTypeFromValue(value);
2735
+ const formattedValueObject = creditCardFormatters[detectedType](value);
2736
+ if (value.length < 2 && detectedType === 'unknown') {
2737
+ formattedValueObject.leftIcon = 'card';
2738
+ }
2739
+ return formattedValueObject;
2740
+ }
2741
+ const unknownFormatter = function unknownFn(value) {
2742
+ const valueObject = formatValue(value, '#### #### #### ####');
2743
+ return Object.assign(Object.assign({}, valueObject), { type: 'unknown', leftIcon: 'card-unknown', leftIconMuted: value.length < 16 });
2744
+ };
2745
+ const amexFormatter = function amexFn(value) {
2746
+ const valueObject = formatValue(value, '#### ###### #####');
2747
+ return Object.assign(Object.assign({}, valueObject), { type: 'amex', leftIcon: 'card-amex-color', leftIconMuted: value.length < 15 });
2748
+ };
2749
+ const discoverFormatter = function discoverFn(value) {
2750
+ const valueObject = formatValue(value, '#### #### #### ####');
2751
+ return Object.assign(Object.assign({}, valueObject), { type: 'discover', leftIcon: 'card-discover-color', leftIconMuted: value.length < 16 });
2752
+ };
2753
+ const masterCardFormatter = function masterCardFn(value) {
2754
+ const valueObject = formatValue(value, '#### #### #### ####');
2755
+ return Object.assign(Object.assign({}, valueObject), { type: 'masterCard', leftIcon: 'card-mastercard-color', leftIconMuted: value.length < 16 });
2756
+ };
2757
+ const visaFormatter = function visaFn(value) {
2758
+ const valueObject = formatValue(value, '#### #### #### ####');
2759
+ return Object.assign(Object.assign({}, valueObject), { type: 'visa', leftIcon: 'card-visa-color', leftIconMuted: value.length < 16 });
2760
+ };
2761
+ const dinersClubInternationalFormatter = function dinersClub(value) {
2762
+ const valueObject = formatValue(value, '#### ###### ####');
2763
+ return Object.assign(Object.assign({}, valueObject), { type: 'dinersClub', leftIcon: 'card-dinersclub-color', leftIconMuted: value.length < 14 });
2764
+ };
2765
+ const creditCardFormatters = {
2766
+ discover: discoverFormatter,
2767
+ amex: amexFormatter,
2768
+ masterCard: masterCardFormatter,
2769
+ visa: visaFormatter,
2770
+ dinersClub: dinersClubInternationalFormatter,
2771
+ unknown: unknownFormatter,
2772
+ };
2773
+ /* tslint:disable:cyclomatic-complexity */
2774
+ function detectCreditCardTypeFromValue(value) {
2775
+ // use value and some algorithm from the internet to detect and return card type based on string
2776
+ // return string 'unknown' if algorithm cannot detect or returns a type that is not one of our 5 supported types
2777
+ const firstInt = parseInt(value.charAt(0));
2778
+ const secondInt = parseInt(value.charAt(1));
2779
+ switch (firstInt) {
2780
+ case 2:
2781
+ if (secondInt > 1 && secondInt < 8) {
2782
+ if (value.length >= 4) {
2783
+ const firstfour = parseInt(value.substr(0, 4));
2784
+ if (firstfour >= 2221 && firstfour < 2721) {
2785
+ return 'masterCard';
2786
+ }
2787
+ }
2788
+ else {
2789
+ return 'masterCard';
2790
+ }
2791
+ }
2792
+ break;
2793
+ case 3:
2794
+ if (secondInt === 4 || secondInt === 7) {
2795
+ return 'amex';
2796
+ }
2797
+ if (secondInt === 0) {
2798
+ if (value.length > 2) {
2799
+ const thirdInt = parseInt(value.charAt(2));
2800
+ if (thirdInt < 6 || thirdInt === 9) {
2801
+ return 'dinersClub';
2802
+ }
2803
+ }
2804
+ else {
2805
+ return 'dinersClub';
2806
+ }
2807
+ }
2808
+ if (secondInt === 6 || secondInt === 8 || secondInt === 9) {
2809
+ return 'dinersClub';
2810
+ }
2811
+ break;
2812
+ case 4:
2813
+ return 'visa';
2814
+ case 5:
2815
+ if (secondInt > 0 && secondInt < 6) {
2816
+ return 'masterCard';
2817
+ }
2818
+ break;
2819
+ case 6:
2820
+ if (secondInt === 0) {
2821
+ if (value.length > 3) {
2822
+ const firstfour = value.substr(0, 4);
2823
+ if (firstfour === '6011') {
2824
+ return 'discover';
2825
+ }
2826
+ }
2827
+ else {
2828
+ return 'discover';
2829
+ }
2830
+ }
2831
+ if (secondInt === 4) {
2832
+ if (value.length > 2) {
2833
+ const firstthree = parseInt(value.substr(0, 3));
2834
+ if (firstthree > 643) {
2835
+ return 'discover';
2836
+ }
2837
+ }
2838
+ else {
2839
+ return 'discover';
2840
+ }
2841
+ }
2842
+ if (secondInt === 5) {
2843
+ return 'discover';
2844
+ }
2845
+ if (secondInt === 2) {
2846
+ if (value.length > 5) {
2847
+ const firstsix = parseInt(value.substr(0, 6));
2848
+ if (firstsix >= 622126 && firstsix <= 622925) {
2849
+ return 'discover';
2850
+ }
2851
+ }
2852
+ else {
2853
+ return 'discover';
2854
+ }
2855
+ }
2856
+ break;
2857
+ default:
2858
+ return 'unknown';
2859
+ }
2860
+ return 'unknown';
2861
+ }
2862
+ /* tslint:enable:cyclomatic-complexity */
2863
+ const formatCreditCard = {
2864
+ detectCreditCardTypeFromValue,
2865
+ format,
2866
+ amexFormatter,
2867
+ dinersClubInternationalFormatter,
2868
+ discoverFormatter,
2869
+ masterCardFormatter,
2870
+ visaFormatter,
2871
+ unknownFormatter,
2872
+ };
2873
+
2874
+ const stylesCss = "*{box-sizing:border-box}*:active{outline:none}*:focus{outline:none;box-shadow:var(--const-double-focus-ring, 0 0 0 2px #ffffff, 0 0 0 4px #33b4ff #06C)}:host{box-shadow:none !important}::-moz-focus-inner{border:none}input,textarea,button{font-family:inherit;font-size:inherit;font-stretch:inherit}:host(.sr),:host(.sr) button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.sr,.sr button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.hidden{display:none}:host([hidden]){display:none}.invisible{visibility:hidden}:host{display:block;margin-top:var(--tct-input-margin-top, var(--t-input-margin-top, var(--app-scale-6x, 30px)));margin-bottom:var(--tct-input-margin-bottom, var(--t-input-margin-bottom, var(--app-scale-6x, 30px)));font-size:var(--tct-input-font-size, var(--t-input-font-size, var(--app-font-size, inherit)))}:host([hidden]){display:none}.field-container,.input-container{position:relative}.field-container{--comp-input-tween:var(--tct-input-tween, var(--t-input-tween, var(--tct-tween-2, var(--app-tween-2, 0.4s ease))))}label{display:block;padding-left:var(--tct-input-label-padding-left, var(--t-input-label-padding-left, 0));padding-right:var(--tct-input-label-padding-right, var(--t-input-label-padding-right, 0));margin-top:var(--tct-input-label-margin-top, var(--t-input-label-margin-top, 0));margin-bottom:var(--tct-input-label-margin-bottom, var(--t-input-label-margin-bottom, var(--tct-scale-1, var(--app-scale-1x, 5px))));color:var(--tct-input-label-font-color, var(--t-input-label-font-color, inherit));font-size:var(--tct-input-label-font-size, var(--t-input-label-font-size, inherit));font-weight:var(--tct-input-label-font-weight, var(--t-input-label-font-weight, 600));text-transform:var(--tct-input-label-text-transform, var(--t-input-label-text-transform, none));letter-spacing:var(--tct-input-label-letter-spacing, var(--t-input-label-letter-spacing, normal));transition:color var(--comp-input-tween)}.optional-tag{margin-left:var(--tct-input-label-optional-margin-left, var(--t-input-label-optional-margin-left, var(--tct-scale-1, var(--app-scale-1x, 5px))));color:var(--tct-input-label-optional-font-color, var(--t-input-label-optional-font-color, var(--t-textA, var(--t-a11y-gray-color, rgba(77, 77, 77, 0.77)))));font-size:var(--tct-input-label-optional-font-size, var(--t-input-label-optional-font-size, 12px));font-weight:var(--tct-input-label-optional-font-weight, var(--t-input-label-optional-font-weight, 400))}.input-container{background-color:var(--tct-input-bg, var(--t-input-bg, var(--t-gray-14, #fcfcfd)));display:flex;align-items:center;--comp-input-horizontal-gap:var(--tct-input-horizontal-gap, var(--t-input-horizontal-gap, 8px));--comp-input-border-top-left-radius:var(--tct-input-border-top-left-radius, var(--t-input-border-top-left-radius, var(--tct-border-radius-1, var(--app-border-radius-1, 3px))));--comp-input-border-top-right-radius:var(--tct-input-border-top-right-radius, var(--t-input-border-top-right-radius, var(--tct-border-radius-1, var(--app-border-radius-1, 3px))));--comp-input-border-bottom-right-radius:var(--tct-input-border-bottom-right-radius, var(--t-input-border-bottom-right-radius, var(--tct-border-radius-1, var(--app-border-radius-1, 3px))));--comp-input-border-bottom-left-radius:var(--tct-input-border-bottom-left-radius, var(--t-input-border-bottom-left-radius, var(--tct-border-radius-1, var(--app-border-radius-1, 3px))));--comp-input-border-radius:var(--comp-input-border-top-left-radius) var(--comp-input-border-top-right-radius)\n var(--comp-input-border-bottom-right-radius) var(--comp-input-border-bottom-left-radius);--comp-input-border-width:var(--tct-input-border-top-width, 1px) var(--tct-input-border-right-width, 1px)\n var(--tct-input-border-bottom-width, 1px) var(--tct-input-border-left-width, 1px);--comp-input-focus-border-width:var(--tct-input-focus-border-top-width, 1px)\n var(--tct-input-focus-border-right-width, 1px) var(--tct-input-focus-border-bottom-width, 1px)\n var(--tct-input-focus-border-left-width, 1px);--comp-input-prefix-clearance:calc(3 * var(--tct-input-prefix-font-size, 14px) + var(--tct-scale-1, 5px));--comp-input-icon-clearance:34px;--comp-input-min-height:var(--tct-input-min-height, var(--t-input-min-height, 44px));--comp-input-max-height:var(--tct-input-max-height, var(--t-input-max-height));border-width:var(--comp-input-border-width);border-style:solid;border-color:var(--tct-input-border-color, var(--t-input-border-color, var(--t-a11y-gray-color-AA, #949494)));border-radius:var(--comp-input-border-radius);box-shadow:var(--tct-input-box-shadow, var(--t-input-box-shadow, none));transition:border-width var(--comp-input-tween), border-color var(--comp-input-tween), box-shadow var(--comp-input-tween)}:host([disabled]:not([disabled=false])) .input-container{cursor:not-allowed;opacity:var(--tct-input-disabled-opacity, var(--t-input-disabled-opacity, var(--tct-disabled-opacity, var(--app-disabled-opacity, 0.4))))}.input-field{flex:1;border:0;-webkit-appearance:none;appearance:none;box-sizing:border-box;min-height:var(--comp-input-min-height);max-height:var(--comp-input-max-height);overflow-y:hidden;height:var(--tct-input-height, var(--t-input-height, 44px));width:100%;padding:0 var(--tct-input-horizontal-padding, var(--t-input-horizontal-padding, var(--tct-scale-2, var(--app-scale-2x, 10px))));background-color:transparent;color:var(--tct-input-font-color, var(--t-input-font-color, var(--t-text, inherit)));display:inline-block;text-align:var(--tct-input-align, \"start\");font-weight:var(--tct-input-font-weight, var(--t-input-font-weight, 400));}.input-field:focus{outline:none;box-shadow:none}.input-field::-webkit-outer-spin-button,.input-field::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.input-field[type=number]{-moz-appearance:textfield}.input-field::-ms-clear{display:none}.input-field[type=search]::-webkit-search-decoration,.input-field[type=search]::-webkit-search-cancel-button,.input-field[type=search]::-webkit-search-results-button,.input-field[type=search]::-webkit-search-results-decoration{display:none}.input-field[disabled]:not([disabled=false]){cursor:not-allowed}.right-aligned .input-field{text-align:right}.input-field:is(input){flex:1}.input-field:is(button){display:inline-flex;align-items:center}.has-custom-display .input-field:is(button){height:auto;padding:0}.input-field:is(button) span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.has-custom-display .custom-display-container{--comp-default-padding:var(--app-scale-2x, 10px) var(--app-scale-2x, 10px) var(--app-scale-3x, 15px);padding:var(--tct-input-padding, var(--t-input-padding, var(--comp-default-padding)));width:100%}.input-container:focus-within{border-width:var(--comp-input-focus-border-width, 1px);border-color:var(--tct-input-focus-border-color, var(--t-input-focus-border-color, var(--t-a11y-active-gray-color-AA, #404040)));box-shadow:var(--const-double-focus-ring), var(--tct-input-focus-box-shadow, var(--t-input-focus-box-shadow, 0 0 transparent))}.input-field::placeholder,.placeholder-text{color:var(--tct-input-placeholder-font-color, var(--t-input-placeholder-font-color, var(--t-textA, var(--app-gray-d1, rgba(77, 77, 77, 0.77)))))}.pseudo-input-container{min-width:0;flex:1}.input-icons-container-left,.input-icons-container-right{display:flex;flex-direction:row;align-items:center;gap:var(--comp-input-horizontal-gap)}.input-icons-container-left:empty,.input-icons-container-right:empty{display:none}.input-icons-container-left{padding-left:var(--comp-input-horizontal-gap)}.input-icons-container-right{padding-right:var(--comp-input-horizontal-gap)}.input-icons-container-right .btn-visibility-toggle{color:var(--tct-primary, var(--t-primary, #006eb2));font-size:12px}q2-icon{margin-top:calc(var(--tct-input-border-top-width, var(--t-input-border-top-width, 1px)) / 2);margin-bottom:calc(var(--tct-input-border-bottom-width, var(--t-input-border-bottom-width, 1px)) / 2);pointer-events:none;color:var(--tct-input-icon-stroke-primary, var(--t-input-icon-stroke-primary, var(--t-textA, var(--app-gray, rgba(77, 77, 77, 0.77)))));--tct-icon-stroke-primary:var(--tct-input-icon-stroke-primary, var(--t-input-icon-stroke-primary, var(--t-textA, var(--app-gray, rgba(77, 77, 77, 0.77)))))}.icon-left-muted{opacity:0.5}.input-prefix,.input-suffix{margin-left:calc(var(--comp-input-horizontal-gap) * -1);margin-right:calc(var(--comp-input-horizontal-gap) * -1);width:3em;display:inline-flex;align-items:center;justify-content:center;min-height:calc(\n var(--comp-input-min-height) - var(--tct-input-focus-border-top-width, var(--t-input-focus-border-top-width, 1px)) - var(--tct-input-focus-border-bottom-width, var(--t-input-focus-border-bottom-width, 1px))\n );height:calc(\n var(--tct-input-height, var(--t-input-height, 44px)) - var(--tct-input-focus-border-top-width, var(--t-input-focus-border-top-width, 1px)) - var(--tct-input-focus-border-bottom-width, var(--t-input-focus-border-bottom-width, 1px))\n );font-size:var(--tct-input-prefix-font-size, var(--t-input-prefix-font-size, inherit));color:var(--tct-input-prefix-font-color, var(--t-input-prefix-font-color, inherit));background-color:var(--tct-input-prefix-bg, var(--t-input-prefix-bg, var(--tct-input-bg, var(--t-input-bg, var(--tct-gray-14, var(--t-gray-14, #f2f2f2))))));transition:color var(--comp-input-tween), background-color var(--comp-input-tween)}.input-prefix{border-top-left-radius:calc(\n var(--comp-input-border-top-left-radius) - var(--tct-input-border-top-width, var(--t-input-border-top-width, 1px)) - var(--tct-input-border-left-width, var(--t-input-border-left-width, 1px))\n );border-bottom-left-radius:calc(\n var(--comp-input-border-bottom-left-radius) - var(--tct-input-border-bottom-width, var(--t-input-border-bottom-width, 1px)) - var(--tct-input-border-left-width, var(--t-input-border-left-width, 1px))\n );pointer-events:none;}.input-suffix{border-top-right-radius:calc(\n var(--comp-input-border-top-right-radius) - var(--tct-input-border-top-width, var(--t-input-border-top-width, 1px)) - var(--tct-input-border-right-width, var(--t-input-border-right-width, 1px))\n );border-bottom-right-radius:calc(\n var(--comp-input-border-bottom-right-radius) - var(--tct-input-border-bottom-width, var(--t-input-border-bottom-width, 1px)) - var(--tct-input-border-right-width, var(--t-input-border-right-width, 1px))\n )}.icon-error{color:var(--tct-stoplight-error, var(--const-stoplight-alert, #c30000));--tct-icon-stroke-primary:var(--tct-stoplight-error, var(--const-stoplight-alert, #c30000))}.pw-show{position:absolute;margin-right:var(--tct-scale-2, var(--app-scale-2x, 10px))}.btn-clear{margin-top:calc(var(--tct-input-border-top-width, var(--t-input-border-top-width, 1px)) / 2);margin-bottom:calc(var(--tct-input-border-bottom-width, var(--t-input-border-bottom-width, 1px)) / 2);height:22px;--tct-btn-icon-width:17px;--tct-btn-icon-height:22px;--tct-icon-size:17px}.messages-container{height:0px;overflow:hidden;background-color:var(--tct-message-bg, var(--t-message-bg, var(--tct-gray-14, var(--t-gray-14, var(--tct-gray-l3, var(--app-gray-l3, #f2f2f2))))));box-shadow:var(--tct-input-message-box-shadow, var(--t-input-message-box-shadow, var(--tct-box-shadow-1, var(--app-shadow-1, 0 2px 4px rgba(0, 0, 0, 0.3)))));transition:height var(--tct-input-messages-tween, var(--t-input-messages-tween, var(--tct-tween-1, var(--app-tween-1, 0.2s ease))));margin-top:2px;z-index:1;position:absolute;width:100%;color:var(--tct-input-messages-font-color, var(--t-input-messages-font-color, inherit))}.has-error label{color:var(--tct-input-error-label-font-color, var(--t-input-error-label-font-color, var(--tct-input-label-font-color, var(--t-input-label-font-color, inherit))))}.has-error:not(.has-focus) .input-prefix,.has-error:not(.has-focus) .input-suffix{color:var(--tct-input-error-prefix-font-color, var(--t-input-error-prefix-font-color, inherit));background-color:var(--tct-input-error-prefix-bg, var(--t-input-error-prefix-bg, var(--tct-input-bg, var(--t-input-bg, var(--tct-gray-14, var(--t-gray-14, var(--tct-gray-l3, var(--app-gray-l3, #f2f2f2))))))))}.has-error .input-container:not(:focus-within){border-color:var(--tct-input-error-border-color, var(--t-input-error-border-color, var(--const-stoplight-alert, #c30000)))}.icon-left{width:26px;height:26px}.vertical-separator{height:calc(var(--comp-input-min-height) - 2px);border-right:1px solid var(--tct-input-prefix-border-color, var(--t-input-prefix-border-color, var(--tct-input-border-color, var(--t-input-border-color, var(--t-a11y-gray-color-AA, #949494)))))}";
2875
+
2876
+ const Q2Input = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
2877
+ constructor() {
2878
+ super();
2879
+ this.__registerHost();
2880
+ this.__attachShadow();
2881
+ this.input = createEvent(this, "input", 7);
2882
+ this.change = createEvent(this, "change", 7);
2883
+ this.clear = createEvent(this, "clear", 7);
2884
+ this.scheduledAfterRender = [];
2885
+ this.guid = createGuid();
2886
+ ///// ACTIONS ////////
2887
+ this.onToggleVisibility = () => {
2888
+ this.textHidden = !this.textHidden;
2889
+ };
2890
+ this.onInputFocus = () => {
2891
+ this.scheduledAfterRender.push(() => {
2892
+ this.setCursorPosition(this.calculateCursorPositionOnFocus());
2893
+ });
2894
+ this.hasFocus = true;
2895
+ setMessageHeight(this);
2896
+ this.valueOnFocus = this.value;
2897
+ };
2898
+ this.onInputBlur = () => {
2899
+ this.hasFocus = false;
2900
+ setMessageHeight(this);
2901
+ if (this.valueOnFocus !== this.formattedValueObject.value) {
2902
+ this.valueOnFocus = this.formattedValueObject.value;
2903
+ this.change.emit(Object.assign({ value: this.formattedValueObject.value, formattedValue: this.formattedValueObject.fullyFormattedValue, minFormattedLength: this.formattedValueObject.minFormattedLength }, (this.formattedValueObject.type && { type: this.formattedValueObject.type })));
2904
+ }
2905
+ };
2906
+ this.onInputInput = (event) => {
2907
+ event.stopPropagation();
2908
+ const newFormattedValue = this.getFormattedValue(event.target.value, false);
2909
+ this.handleDataInput(newFormattedValue);
2910
+ };
2911
+ this.onInputPaste = (event) => {
2912
+ if (this.type === 'currency') {
2913
+ const clipboardData = event.clipboardData.getData('text');
2914
+ const newFormattedValue = this.getFormattedValue(clipboardData, true);
2915
+ event.preventDefault();
2916
+ this.handleDataInput(newFormattedValue);
2917
+ }
2918
+ };
2919
+ this.onInputKeydown = (event) => {
2920
+ if (event.key === 'Enter' && this.valueOnFocus !== this.formattedValueObject.value) {
2921
+ this.valueOnFocus = this.formattedValueObject.value;
2922
+ this.change.emit(Object.assign({ value: this.formattedValueObject.value, formattedValue: this.formattedValueObject.fullyFormattedValue, minFormattedLength: this.formattedValueObject.minFormattedLength }, (this.formattedValueObject.type && { type: this.formattedValueObject.type })));
2923
+ }
2924
+ };
2925
+ this.onClearInput = () => {
2926
+ const eventDetail = {
2927
+ value: '',
2928
+ formattedValue: '',
2929
+ minFormattedLength: this.formattedValueObject.minFormattedLength,
2930
+ };
2931
+ this.input.emit(eventDetail);
2932
+ this.change.emit(eventDetail);
2933
+ this.clear.emit();
2934
+ this.inputField.focus();
2935
+ };
2936
+ this.value = undefined;
2937
+ this.label = undefined;
2938
+ this.hideLabel = undefined;
2939
+ this.type = 'text';
2940
+ this.placeholder = undefined;
2941
+ this.disabled = false;
2942
+ this.autocomplete = undefined;
2943
+ this.autocorrect = undefined;
2944
+ this.autocapitalize = undefined;
2945
+ this.hideMessages = undefined;
2946
+ this.iconLeft = undefined;
2947
+ this.iconRight = undefined;
2948
+ this.readonly = undefined;
2949
+ this.clearable = undefined;
2950
+ this.optional = undefined;
2951
+ this.min = undefined;
2952
+ this.max = undefined;
2953
+ this.step = undefined;
2954
+ this.formatModifier = undefined;
2955
+ this.maxlength = undefined;
2956
+ this.pseudo = undefined;
2957
+ this.showVisibilityToggle = false;
2958
+ this.textHidden = undefined;
2959
+ this.badgeValue = undefined;
2960
+ this.badgeTheme = undefined;
2961
+ this.ariaControls = undefined;
2962
+ this.role = undefined;
2963
+ this.ariaOwns = undefined;
2964
+ this.ariaLabel = undefined;
2965
+ this.ariaHaspopup = undefined;
2966
+ this.ariaExpanded = undefined;
2967
+ this.ariaActivedescendant = undefined;
2968
+ this.current = undefined;
2969
+ this.errors = undefined;
2970
+ this.hints = undefined;
2971
+ this.formattedValueObject = undefined;
2972
+ this.hasFocus = undefined;
2973
+ }
2974
+ /////// LIFECYCLE HOOKS ////////
2975
+ componentWillLoad() {
2976
+ if (isNaN(this.maxlength)) {
2977
+ this.maxlength = undefined;
2978
+ }
2979
+ this.formattedValueObject = this.getFormattedValue(this.stringValue, true);
2980
+ handleAriaLabel(this);
2981
+ if (this.textHidden === undefined) {
2982
+ this.textHidden = this.type === 'password';
2983
+ }
2984
+ }
2985
+ componentDidLoad() {
2986
+ if (!this.pseudo) {
2987
+ this.inputField.value = this.formattedValueObject.formattedValue;
2988
+ }
2989
+ overrideFocus(this.hostElement);
2990
+ }
2991
+ componentDidRender() {
2992
+ this.scheduledAfterRender.forEach(fn => fn());
2993
+ this.scheduledAfterRender = [];
2994
+ }
2995
+ getFormattedValue(value, valueChangedFromProperty) {
2996
+ const formattingFunctions = {
2997
+ currency: formatCurrency,
2998
+ phone: formatPhoneNumber,
2999
+ ssn: formatSSN,
3000
+ alphanumeric: formatAlphanumeric,
3001
+ alpha: formatAlpha,
3002
+ numeric: formatNumeric,
3003
+ percentage: formatPercentage,
3004
+ postal: formatPostalCode,
3005
+ date: formatDate,
3006
+ 'credit-card': formatCreditCard.format,
3007
+ };
3008
+ if (formattingFunctions[this.type]) {
3009
+ return formattingFunctions[this.type](value, this.formatModifier, valueChangedFromProperty);
3010
+ }
3011
+ return {
3012
+ value,
3013
+ formattedValue: value,
3014
+ fullyFormattedValue: value,
3015
+ formattingCharacterCount: 0,
3016
+ unformattedValue: value,
3017
+ };
3018
+ }
3019
+ get canClear() {
3020
+ return this.clearable && !!this.value;
3021
+ }
3022
+ get hasError() {
3023
+ return Array.isArray(this.errors) && this.errors.length > 0;
3024
+ }
3025
+ get messages() {
3026
+ return ((this.errors && this.errors.length > 0 && this.errors) ||
3027
+ (this.hints && this.hints.length > 0 && this.hints) ||
3028
+ []);
3029
+ }
3030
+ get inputField() {
3031
+ return this.hostElement.shadowRoot.querySelector('.input-field');
3032
+ }
3033
+ get showMessages() {
3034
+ return this.messages.length > 0 && !this.hideMessages;
3035
+ }
3036
+ get inputId() {
3037
+ return `input-guid-${this.guid}`;
3038
+ }
3039
+ get inputDescribedBy() {
3040
+ return this.showMessages ? `${this.inputId}-description` : undefined;
3041
+ }
3042
+ get isMaskedType() {
3043
+ const maskedTypes = [
3044
+ 'currency',
3045
+ 'phone',
3046
+ 'ssn',
3047
+ 'alphanumeric',
3048
+ 'alpha',
3049
+ 'numeric',
3050
+ 'percentage',
3051
+ 'postal',
3052
+ 'date',
3053
+ 'credit-card',
3054
+ ];
3055
+ return maskedTypes.includes(this.type);
3056
+ }
3057
+ get wrapperClasses() {
3058
+ const classNames = ['field-container'];
3059
+ if (this.hasError)
3060
+ classNames.push('has-error');
3061
+ if (!!this.value)
3062
+ classNames.push('has-value');
3063
+ if (this.clearable && !!this.value)
3064
+ classNames.push('has-clear');
3065
+ if (this.hasFocus)
3066
+ classNames.push('has-focus');
3067
+ if (this.formattedValueObject.prefix)
3068
+ classNames.push('has-prefix');
3069
+ if (this.computedIconLeft)
3070
+ classNames.push('has-icon-left');
3071
+ if (this.showIconSeparator)
3072
+ classNames.push('has-icon-separator');
3073
+ if (this.formattedValueObject.suffix)
3074
+ classNames.push('has-suffix');
3075
+ if (!this.formattedValueObject.suffix && this.iconRight)
3076
+ classNames.push('has-icon-right');
3077
+ if (this.type === 'currency')
3078
+ classNames.push('right-aligned');
3079
+ else
3080
+ classNames.push('left-aligned');
3081
+ if (this.hasCustomDisplaySlot)
3082
+ classNames.push('has-custom-display');
3083
+ return classNames.join(' ');
3084
+ }
3085
+ get computedType() {
3086
+ const inputTypeMap = {
3087
+ text: 'text',
3088
+ tel: 'tel',
3089
+ number: 'number',
3090
+ password: 'text',
3091
+ search: 'search',
3092
+ url: 'url',
3093
+ email: 'email',
3094
+ currency: 'tel',
3095
+ phone: 'tel',
3096
+ ssn: 'tel',
3097
+ alphanumeric: 'text',
3098
+ alpha: 'text',
3099
+ numeric: 'tel',
3100
+ percentage: 'tel',
3101
+ postal: 'tel',
3102
+ date: 'tel',
3103
+ 'credit-card': 'tel',
3104
+ };
3105
+ if (['password', 'text', 'ssn'].includes(this.type) && this.textHidden) {
3106
+ return 'password';
3107
+ }
3108
+ else {
3109
+ return (this.type && inputTypeMap[this.type]) || 'text';
3110
+ }
3111
+ }
3112
+ get computedAutocomplete() {
3113
+ // force off for currenty type
3114
+ if (this.type === 'currency')
3115
+ return 'transaction-amount';
3116
+ return this.autocomplete || 'off';
3117
+ }
3118
+ get computedIconLeft() {
3119
+ if (this.formattedValueObject.prefix) {
3120
+ return;
3121
+ }
3122
+ if (this.type === 'search') {
3123
+ return 'search';
3124
+ }
3125
+ if (this.formattedValueObject.leftIcon) {
3126
+ return this.formattedValueObject.leftIcon;
3127
+ }
3128
+ return this.iconLeft;
3129
+ }
3130
+ get showIconSeparator() {
3131
+ return this.type === 'credit-card' || !!this.formattedValueObject.prefix;
3132
+ }
3133
+ get computedClassForIconLeft() {
3134
+ let className = 'icon-left';
3135
+ if (this.formattedValueObject.leftIconMuted) {
3136
+ className += ' icon-left-muted';
3137
+ }
3138
+ return className;
3139
+ }
3140
+ get stringValue() {
3141
+ return (this.value && String(this.value)) || '';
3142
+ }
3143
+ get canSetSelection() {
3144
+ // email and number type don't support setSelectionRange
3145
+ return !['email', 'number'].includes(this.computedType);
3146
+ }
3147
+ get visibilityToggleText() {
3148
+ return loc(`tecton.element.input.toggle.${this.textHidden ? 'show' : 'hide'}`);
3149
+ }
3150
+ formatAndUpdateValueFromProp() {
3151
+ this.formattedValueObject = this.getFormattedValue(this.stringValue, true);
3152
+ if (!this.pseudo) {
3153
+ this.inputField.value = this.formattedValueObject.formattedValue;
3154
+ }
3155
+ }
3156
+ //////// OBSERVERS //////////
3157
+ ariaLabelObserver() {
3158
+ handleAriaLabel(this);
3159
+ }
3160
+ valueObserver() {
3161
+ this.formatAndUpdateValueFromProp();
3162
+ }
3163
+ typeObserver() {
3164
+ this.formatAndUpdateValueFromProp();
3165
+ }
3166
+ formatModifierObserver() {
3167
+ this.formatAndUpdateValueFromProp();
3168
+ }
3169
+ hintsObserver() {
3170
+ this.hasFocus && this.scheduledAfterRender.push(() => setMessageHeight(this));
3171
+ }
3172
+ errorsObserver() {
3173
+ this.hasFocus && this.scheduledAfterRender.push(() => setMessageHeight(this));
3174
+ }
3175
+ ///////// HOST ELEMENT EVENTS //////
3176
+ onHostElementFocus(event) {
3177
+ if (!isEventFromElement(event, this.hostElement))
3178
+ return;
3179
+ this.inputField.focus();
3180
+ }
3181
+ onHostElementChange(event) {
3182
+ if (event.target === this.hostElement && !this.hostElement.onchange) {
3183
+ this.value = event.detail.value;
3184
+ }
3185
+ }
3186
+ handleDataInput(newFormattedValue) {
3187
+ if (this.maxlength === undefined ||
3188
+ newFormattedValue.unformattedValue.length <= this.maxlength ||
3189
+ newFormattedValue.unformattedValue.length <= this.formattedValueObject.unformattedValue.length) {
3190
+ this.formattedValueObject = newFormattedValue;
3191
+ }
3192
+ else if (this.maxlength) {
3193
+ newFormattedValue = this.getFormattedValue(newFormattedValue.unformattedValue.substring(0, this.maxlength), false);
3194
+ this.formattedValueObject = newFormattedValue;
3195
+ }
3196
+ // ORDER IMPORTANT: calculate cursor position -> set value -> set cursor position
3197
+ const cursorPosition = this.calculateCursorPositionOnInput();
3198
+ this.inputField.value = this.formattedValueObject.formattedValue;
3199
+ this.input.emit(Object.assign({ value: this.formattedValueObject.value, formattedValue: this.formattedValueObject.fullyFormattedValue, minFormattedLength: this.formattedValueObject.minFormattedLength }, (this.formattedValueObject.type && { type: this.formattedValueObject.type })));
3200
+ this.setCursorPosition(cursorPosition);
3201
+ }
3202
+ /////// VIEW METHODS ///////
3203
+ render() {
3204
+ return (h("div", { class: this.wrapperClasses }, labelDOM(this), this.inputContainerDOM(), messagesDOM(this)));
3205
+ }
3206
+ get hasCustomDisplaySlot() {
3207
+ return !!this.hostElement.querySelector('[slot=custom-display]');
3208
+ }
3209
+ /* tslint:disable:cyclomatic-complexity */
3210
+ inputContainerDOM() {
3211
+ return (h("div", { class: "input-container" }, h("div", { class: "input-icons-container-left" }, this.formattedValueObject.prefix && (h("span", { class: "input-prefix" }, this.formattedValueObject.prefix)), this.computedIconLeft && (h("q2-icon", { type: this.computedIconLeft, class: this.computedClassForIconLeft })), this.showIconSeparator && h("div", { class: "vertical-separator" }), this.hasError && this.type === 'currency' && (h("q2-icon", { type: "error", class: "icon-error" }))), this.pseudo ? this.pseudoInputDOM() : this.standardInputDOM(), h("div", { class: "input-icons-container-right" }, this.canClear && (h("q2-btn", { class: "btn-clear", ariaLabel: loc('tecton.element.input.clear', [this.label]), "test-id": "clearButton", onClick: this.onClearInput }, h("q2-icon", { type: "close", class: "icon-clear" }))), ['password', 'text', 'ssn'].includes(this.type) && this.showVisibilityToggle && (h("q2-btn", { class: "btn-visibility-toggle", "test-id": "toggleVisibilityButton", onClick: this.onToggleVisibility }, this.visibilityToggleText)), this.formattedValueObject.suffix && (h("span", { class: "input-suffix" }, this.formattedValueObject.suffix)), this.badgeValue && (h("q2-badge", { size: "large", theme: this.badgeTheme }, this.badgeValue)), this.iconRight && !this.formattedValueObject.suffix && (h("q2-icon", { type: this.iconRight, class: "icon-right" })), this.hasError && this.type !== 'currency' && (h("q2-icon", { type: "error", class: "icon-error" })))));
3212
+ }
3213
+ /* tslint:enable:cyclomatic-complexity */
3214
+ /* tslint:disable:cyclomatic-complexity */
3215
+ standardInputDOM() {
3216
+ const { hasCustomDisplaySlot } = this;
3217
+ const inputClasses = ['input-field'];
3218
+ if (hasCustomDisplaySlot)
3219
+ inputClasses.push('sr');
3220
+ return (h(Fragment, null, hasCustomDisplaySlot && (h("div", { class: "custom-display-container" }, h("slot", { name: "custom-display" }))), h("input", { class: inputClasses.join(' '), id: this.inputId, type: this.computedType, size: this.formattedValueObject.prefix ? 10 : undefined, max: this.max, min: this.min, step: this.step, "aria-current": this.current || undefined, "aria-describedby": this.inputDescribedBy, "aria-required": `${!this.optional}`, "aria-invalid": `${this.hasError}`, "aria-controls": (this.ariaControls && `${this.ariaControls}`) || undefined, "aria-owns": (this.ariaOwns && `${this.ariaOwns}`) || undefined, "aria-haspopup": (this.ariaHaspopup && `${this.ariaHaspopup}`) || undefined, "aria-expanded": (!!this.ariaExpanded && `${!!this.ariaExpanded}`) || undefined, "aria-activedescendant": this.ariaActivedescendant && `${this.ariaActivedescendant}`, "aria-label": this.hideLabel && this.label ? loc(this.label) : undefined, autocomplete: this.computedAutocomplete, autocapitalize: this.autocapitalize === 'on' ? 'on' : 'off', autocorrect: this.autocorrect === 'on' ? 'on' : 'off', placeholder: (this.placeholder && loc(this.placeholder)) || undefined, role: (this.role && `${this.role}`) || undefined, "test-id": "inputField", readonly: !!this.readonly, disabled: !!this.disabled, onFocus: this.onInputFocus, onBlur: this.onInputBlur, onKeyDown: this.onInputKeydown, onInput: this.onInputInput, onPaste: this.onInputPaste })));
3221
+ }
3222
+ /* tslint:enable:cyclomatic-complexity */
3223
+ pseudoInputDOM() {
3224
+ const showPlaceholder = !this.value && !!this.placeholder;
3225
+ let ariaLabelSuffix = '';
3226
+ if (this.optional) {
3227
+ ariaLabelSuffix = loc('tecton.element.input.optional');
3228
+ }
3229
+ if (this.readonly) {
3230
+ ariaLabelSuffix = loc('tecton.element.input.readonly');
3231
+ }
3232
+ return (h("div", { class: "pseudo-input-container" }, h("button", { class: "input-field", type: "button", id: this.inputId, "aria-describedby": this.inputDescribedBy, "aria-invalid": `${this.hasError}`, "aria-controls": (this.ariaControls && `${this.ariaControls}`) || undefined, "aria-owns": (this.ariaOwns && `${this.ariaOwns}`) || undefined, "aria-haspopup": (this.ariaHaspopup && `${this.ariaHaspopup}`) || undefined, "aria-expanded": this.ariaExpanded === 'true' ? 'true' : undefined, "aria-activedescendant": this.ariaActivedescendant && `${this.ariaActivedescendant}`, "aria-label": `${this.value}, ${(this.label && loc(this.label)) || ''}${ariaLabelSuffix}`, role: (this.role && `${this.role}`) || undefined, disabled: !!this.disabled, "test-id": "q2InputInnerClearButton" }, h("div", { class: "custom-display-container" }, h("slot", { name: "custom-display" }, h("span", { class: showPlaceholder ? 'placeholder-text' : '' }, showPlaceholder ? this.placeholder : this.value))))));
3233
+ }
3234
+ calculateCursorPositionOnInput() {
3235
+ const input = this.inputField;
3236
+ const formattedLength = this.formattedValueObject.formattedValue.length;
3237
+ const currentValueLength = input.value.length;
3238
+ const defaultPosition = this.type === 'currency' ? formattedLength : 0;
3239
+ return {
3240
+ startingPosition: (input && input.selectionStart) || defaultPosition,
3241
+ valueLength: formattedLength,
3242
+ previousValueLength: input && currentValueLength,
3243
+ hasSelection: false,
3244
+ };
3245
+ }
3246
+ calculateCursorPositionOnFocus() {
3247
+ const input = this.inputField;
3248
+ const valueLength = input && input.value ? input.value.length : 0;
3249
+ const startingPosition = (input && input.selectionStart) || valueLength;
3250
+ return {
3251
+ startingPosition,
3252
+ valueLength,
3253
+ previousValueLength: valueLength,
3254
+ hasSelection: getSelection().toString().length > 0,
3255
+ };
3256
+ }
3257
+ setCursorPosition(cursorData) {
3258
+ if (this.canSetSelection && !cursorData.hasSelection) {
3259
+ const input = this.inputField;
3260
+ const { valueLength, previousValueLength, startingPosition } = cursorData;
3261
+ if (startingPosition === valueLength && valueLength >= previousValueLength && this.type === 'currency') {
3262
+ input.setSelectionRange(valueLength, valueLength);
3263
+ }
3264
+ else {
3265
+ const difference = valueLength - previousValueLength;
3266
+ // Never allow the cursor to move in reverse
3267
+ const newPosition = startingPosition + (difference > 0 ? difference : 0);
3268
+ input.setSelectionRange(newPosition, newPosition);
3269
+ }
3270
+ }
3271
+ }
3272
+ get hostElement() { return this; }
3273
+ static get watchers() { return {
3274
+ "ariaLabel": ["ariaLabelObserver"],
3275
+ "value": ["valueObserver"],
3276
+ "type": ["typeObserver"],
3277
+ "formatModifier": ["formatModifierObserver"],
3278
+ "hints": ["hintsObserver"],
3279
+ "errors": ["errorsObserver"]
3280
+ }; }
3281
+ static get style() { return stylesCss; }
3282
+ }, [1, "q2-input", {
3283
+ "value": [1025],
3284
+ "label": [1537],
3285
+ "hideLabel": [1540, "hide-label"],
3286
+ "type": [513],
3287
+ "placeholder": [513],
3288
+ "disabled": [516],
3289
+ "autocomplete": [513],
3290
+ "autocorrect": [513],
3291
+ "autocapitalize": [513],
3292
+ "hideMessages": [516, "hide-messages"],
3293
+ "iconLeft": [513, "icon-left"],
3294
+ "iconRight": [513, "icon-right"],
3295
+ "readonly": [516],
3296
+ "clearable": [516],
3297
+ "optional": [516],
3298
+ "min": [514],
3299
+ "max": [514],
3300
+ "step": [514],
3301
+ "formatModifier": [513, "format-modifier"],
3302
+ "maxlength": [1538],
3303
+ "pseudo": [516],
3304
+ "showVisibilityToggle": [516, "show-visibility-toggle"],
3305
+ "textHidden": [1540, "text-hidden"],
3306
+ "badgeValue": [513, "badge-value"],
3307
+ "badgeTheme": [513, "badge-theme"],
3308
+ "ariaControls": [1, "aria-controls"],
3309
+ "role": [1],
3310
+ "ariaOwns": [1, "aria-owns"],
3311
+ "ariaLabel": [1537, "aria-label"],
3312
+ "ariaHaspopup": [1, "aria-haspopup"],
3313
+ "ariaExpanded": [1, "aria-expanded"],
3314
+ "ariaActivedescendant": [8, "aria-activedescendant"],
3315
+ "current": [1],
3316
+ "errors": [16],
3317
+ "hints": [16],
3318
+ "formattedValueObject": [32],
3319
+ "hasFocus": [32]
3320
+ }, [[0, "focus", "onHostElementFocus"], [0, "change", "onHostElementChange"]]]);
3321
+ function defineCustomElement() {
3322
+ if (typeof customElements === "undefined") {
3323
+ return;
3324
+ }
3325
+ const components = ["q2-input", "q2-badge", "q2-btn", "q2-icon", "q2-loading"];
3326
+ components.forEach(tagName => { switch (tagName) {
3327
+ case "q2-input":
3328
+ if (!customElements.get(tagName)) {
3329
+ customElements.define(tagName, Q2Input);
3330
+ }
3331
+ break;
3332
+ case "q2-badge":
3333
+ if (!customElements.get(tagName)) {
3334
+ defineCustomElement$4();
3335
+ }
3336
+ break;
3337
+ case "q2-btn":
3338
+ if (!customElements.get(tagName)) {
3339
+ defineCustomElement$3();
3340
+ }
3341
+ break;
3342
+ case "q2-icon":
3343
+ if (!customElements.get(tagName)) {
3344
+ defineCustomElement$2();
3345
+ }
3346
+ break;
3347
+ case "q2-loading":
3348
+ if (!customElements.get(tagName)) {
3349
+ defineCustomElement$1();
3350
+ }
3351
+ break;
3352
+ } });
3353
+ }
3354
+ defineCustomElement();
3355
+
3356
+ export { Q2Input as Q, defineCustomElement as d };