@govtechsg/sgds-web-component 3.20.0-rc.4 → 3.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/components/Badge/badge.js +1 -1
  2. package/components/Badge/index.umd.min.js +4 -4
  3. package/components/Badge/index.umd.min.js.map +1 -1
  4. package/components/Badge/sgds-badge.js +9 -6
  5. package/components/Badge/sgds-badge.js.map +1 -1
  6. package/components/ComboBox/index.umd.min.js +10 -10
  7. package/components/ComboBox/index.umd.min.js.map +1 -1
  8. package/components/Datepicker/datepicker-input.d.ts +1 -0
  9. package/components/Datepicker/datepicker-input.js +23 -6
  10. package/components/Datepicker/datepicker-input.js.map +1 -1
  11. package/components/Datepicker/index.umd.min.js +5 -5
  12. package/components/Datepicker/index.umd.min.js.map +1 -1
  13. package/components/Datepicker/sgds-datepicker.js +4 -4
  14. package/components/Datepicker/sgds-datepicker.js.map +1 -1
  15. package/components/Input/index.umd.min.js +7 -7
  16. package/components/Input/index.umd.min.js.map +1 -1
  17. package/components/Input/input.js +1 -1
  18. package/components/QuantityToggle/index.umd.min.js +1 -1
  19. package/components/QuantityToggle/index.umd.min.js.map +1 -1
  20. package/components/Select/index.umd.min.js +1 -1
  21. package/components/Select/index.umd.min.js.map +1 -1
  22. package/components/Stepper/index.umd.min.js +1 -1
  23. package/components/Stepper/index.umd.min.js.map +1 -1
  24. package/components/Stepper/sgds-step.d.ts +3 -3
  25. package/components/Stepper/sgds-step.js +2 -2
  26. package/components/Stepper/sgds-step.js.map +1 -1
  27. package/components/Stepper/sgds-stepper.d.ts +4 -4
  28. package/components/Stepper/sgds-stepper.js +4 -5
  29. package/components/Stepper/sgds-stepper.js.map +1 -1
  30. package/components/Textarea/index.umd.min.js +1 -1
  31. package/components/Textarea/index.umd.min.js.map +1 -1
  32. package/components/index.umd.min.js +11 -11
  33. package/components/index.umd.min.js.map +1 -1
  34. package/custom-elements.json +8 -8
  35. package/index.umd.min.js +83 -83
  36. package/index.umd.min.js.map +1 -1
  37. package/package.json +1 -1
  38. package/react/components/Badge/badge.cjs.js +1 -1
  39. package/react/components/Badge/badge.js +1 -1
  40. package/react/components/Badge/sgds-badge.cjs.js +9 -6
  41. package/react/components/Badge/sgds-badge.cjs.js.map +1 -1
  42. package/react/components/Badge/sgds-badge.js +9 -6
  43. package/react/components/Badge/sgds-badge.js.map +1 -1
  44. package/react/components/Datepicker/datepicker-input.cjs.js +23 -6
  45. package/react/components/Datepicker/datepicker-input.cjs.js.map +1 -1
  46. package/react/components/Datepicker/datepicker-input.js +23 -6
  47. package/react/components/Datepicker/datepicker-input.js.map +1 -1
  48. package/react/components/Datepicker/sgds-datepicker.cjs.js +4 -4
  49. package/react/components/Datepicker/sgds-datepicker.cjs.js.map +1 -1
  50. package/react/components/Datepicker/sgds-datepicker.js +4 -4
  51. package/react/components/Datepicker/sgds-datepicker.js.map +1 -1
  52. package/react/components/Input/input.cjs.js +1 -1
  53. package/react/components/Input/input.js +1 -1
  54. package/react/components/Stepper/sgds-step.cjs.js +2 -2
  55. package/react/components/Stepper/sgds-step.cjs.js.map +1 -1
  56. package/react/components/Stepper/sgds-step.js +2 -2
  57. package/react/components/Stepper/sgds-step.js.map +1 -1
  58. package/react/components/Stepper/sgds-stepper.cjs.js +4 -5
  59. package/react/components/Stepper/sgds-stepper.cjs.js.map +1 -1
  60. package/react/components/Stepper/sgds-stepper.js +4 -5
  61. package/react/components/Stepper/sgds-stepper.js.map +1 -1
  62. package/react/styles/form-text-control.cjs.js +1 -1
  63. package/react/styles/form-text-control.js +1 -1
  64. package/styles/form-text-control.js +1 -1
  65. package/types/react.d.ts +1 -1
@@ -14,6 +14,7 @@ export declare class DatepickerInput extends SgdsInput {
14
14
  shadowInput: Promise<HTMLInputElement>;
15
15
  private mask;
16
16
  constructor();
17
+ protected _handleBlur(): void;
17
18
  protected _handleChange(e: Event): Promise<void>;
18
19
  firstUpdated(changedProperties: PropertyValueMap<this>): Promise<void>;
19
20
  private _applyInputMask;
@@ -25,23 +25,40 @@ class DatepickerInput extends SgdsInput {
25
25
  isAfter(date, setTimeToNoon(new Date(this.maxDate))));
26
26
  if (invalidDates.length > 0) {
27
27
  this.setInvalid(true);
28
- return this.emit("sgds-invalid-input");
28
+ return this.emit("i-sgds-invalid-input");
29
29
  }
30
30
  if (this.mode === "range" && dateArray.length === 1) {
31
31
  this.setInvalid(true);
32
- return this.emit("sgds-invalid-input");
32
+ return this.emit("i-sgds-invalid-input");
33
33
  }
34
34
  if (invalidDates.length === 0 && dateArray.length > 0) {
35
35
  this.setInvalid(false);
36
- return this.emit("sgds-selectdates-input", { detail: dateArray });
36
+ return this.emit("i-sgds-selectdates-input", { detail: dateArray });
37
37
  }
38
38
  if (dateArray.length === 0 && invalidDates.length === 0) {
39
39
  this.setInvalid(false);
40
- return this.emit("sgds-empty-input");
40
+ return this.emit("i-sgds-empty-input");
41
41
  }
42
42
  };
43
43
  this.type = "text";
44
- this._handleBlur = () => null;
44
+ }
45
+ _handleBlur() {
46
+ const dates = this.mask.value.split(" - ");
47
+ const noEmptyDates = dates.filter(d => d !== this.dateFormat);
48
+ const dateArray = noEmptyDates.map(date => setTimeToNoon(parse(date, DATE_PATTERNS[this.dateFormat].fnsPattern, new Date())));
49
+ const invalidDates = dateArray.filter(date => !isValid(date) ||
50
+ isBefore(date, new Date(0, 0, 1)) ||
51
+ isBefore(date, setTimeToNoon(new Date(this.minDate))) ||
52
+ isAfter(date, setTimeToNoon(new Date(this.maxDate))));
53
+ // Only clear if the mask is complete AND there are invalid dates
54
+ // This clears complete but invalid dates like "20/20/2026"
55
+ // Incomplete dates remain in the input as-is (validation only runs on complete dates)
56
+ if (this.mask.masked.isComplete && invalidDates.length > 0 && dateArray.length > 0) {
57
+ this.value = "";
58
+ this.mask.value = "";
59
+ this.setInvalid(false);
60
+ }
61
+ this.emit("sgds-blur");
45
62
  }
46
63
  async _handleChange(e) {
47
64
  this.value = this.input.value;
@@ -94,7 +111,7 @@ class DatepickerInput extends SgdsInput {
94
111
  this.mask = IMask(shadowInput, maskOptions);
95
112
  this.mask.on("accept", () => {
96
113
  this.value = this.mask.masked.value;
97
- this.emit("sgds-mask-input-change", { detail: this.value });
114
+ this.emit("i-sgds-mask-input-change", { detail: this.value });
98
115
  });
99
116
  /**
100
117
  * Validation after date is complete
@@ -1 +1 @@
1
- {"version":3,"file":"datepicker-input.js","sources":["../../../src/components/Datepicker/datepicker-input.ts"],"sourcesContent":["import { isAfter, isBefore, isValid, parse } from \"date-fns\";\nimport IMask, { InputMask } from \"imask\";\nimport { html, PropertyValueMap } from \"lit\";\nimport { property, queryAsync } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { DATE_PATTERNS, setTimeToNoon } from \"../../utils/time\";\nimport { SgdsInput } from \"../Input/sgds-input\";\nimport datepickerInputStyles from \"./datepicker-input.css\";\nexport type DateFormat = \"MM/DD/YYYY\" | \"DD/MM/YYYY\" | \"YYYY/MM/DD\";\n\nexport class DatepickerInput extends SgdsInput {\n static styles = [...SgdsInput.styles, datepickerInputStyles];\n /** Date format reflected on input */\n private dateFormat = \"DD/MM/YYYY\";\n\n /** ISO date string to set the lowest allowable date value. e.g. \"2016-05-19T12:00:00.000Z\" */\n @property({ type: String }) minDate: string;\n\n /** ISO date string to set the highest allowable date value. e.g. \"2016-05-19T12:00:00.000Z\" */\n @property({ type: String }) maxDate: string;\n\n /** Changes DatePicker to single date selection or range date selection */\n @property({ type: String, reflect: true }) mode: \"single\" | \"range\" = \"single\";\n\n @queryAsync(\"input\")\n shadowInput: Promise<HTMLInputElement>;\n\n private mask: InputMask;\n constructor() {\n super();\n this.type = \"text\";\n this._handleBlur = () => null;\n }\n protected override async _handleChange(e: Event) {\n this.value = this.input.value;\n this.emit(\"sgds-change\");\n super._mixinHandleChange(e);\n await this._validateInput();\n }\n\n async firstUpdated(changedProperties: PropertyValueMap<this>) {\n super.firstUpdated(changedProperties);\n this._applyInputMask(this.dateFormat);\n }\n private async _applyInputMask(dateFormat: string) {\n const shadowInput = await this.shadowInput;\n const imPattern =\n this.mode === \"single\" ? DATE_PATTERNS[dateFormat].imPattern : DATE_PATTERNS[dateFormat].imRangePattern;\n const blocks = {\n d: { mask: IMask.MaskedRange, placeholderChar: \"D\", from: 0, to: 9, maxLength: 1 },\n m: { mask: IMask.MaskedRange, placeholderChar: \"M\", from: 0, to: 9, maxLength: 1 },\n y: { mask: IMask.MaskedRange, placeholderChar: \"Y\", from: 0, to: 9, maxLength: 1 },\n D: { mask: IMask.MaskedRange, placeholderChar: \"D\", from: 0, to: 9, maxLength: 1 },\n M: { mask: IMask.MaskedRange, placeholderChar: \"M\", from: 0, to: 9, maxLength: 1 },\n Y: { mask: IMask.MaskedRange, placeholderChar: \"Y\", from: 0, to: 9, maxLength: 1 }\n };\n const maskOptions = {\n mask: imPattern,\n pattern: imPattern,\n eager: true,\n overwrite: true,\n // define str -> date convertion\n parse: function (str: string) {\n const dates = str.split(\" - \");\n return dates.map(date => parse(date, DATE_PATTERNS[dateFormat].fnsPattern, new Date()));\n },\n format: function (dateArr: Date[]) {\n const dateStrings = dateArr.map(date => {\n let dayStr: string,\n monthStr = \"\";\n const day = date.getDate();\n const month = date.getMonth() + 1;\n const year = date.getFullYear();\n\n if (day < 10) dayStr = \"0\" + day;\n if (month < 10) monthStr = \"0\" + month;\n\n return [dayStr, monthStr, year].join(\"/\");\n });\n return dateStrings.join(\" - \");\n },\n lazy: false,\n blocks\n };\n\n this.mask = IMask(shadowInput, maskOptions);\n this.mask.on(\"accept\", () => {\n this.value = this.mask.masked.value;\n this.emit(\"sgds-mask-input-change\", { detail: this.value });\n });\n /**\n * Validation after date is complete\n */\n this.mask.on(\"complete\", this._validateInput);\n }\n public updateMaskValue() {\n this.mask?.updateValue();\n }\n private _validateInput = async () => {\n const dates = this.mask.value.split(\" - \");\n const noEmptyDates = dates.filter(d => d !== this.dateFormat);\n const dateArray: Date[] | string[] = noEmptyDates.map(date =>\n setTimeToNoon(parse(date, DATE_PATTERNS[this.dateFormat].fnsPattern, new Date()))\n );\n const invalidDates = dateArray.filter(\n date =>\n !isValid(date) ||\n isBefore(date, new Date(0, 0, 1)) ||\n isBefore(date, setTimeToNoon(new Date(this.minDate))) ||\n isAfter(date, setTimeToNoon(new Date(this.maxDate)))\n );\n\n if (invalidDates.length > 0) {\n this.setInvalid(true);\n return this.emit(\"sgds-invalid-input\");\n }\n if (this.mode === \"range\" && dateArray.length === 1) {\n this.setInvalid(true);\n return this.emit(\"sgds-invalid-input\");\n }\n if (invalidDates.length === 0 && dateArray.length > 0) {\n this.setInvalid(false);\n return this.emit(\"sgds-selectdates-input\", { detail: dateArray });\n }\n if (dateArray.length === 0 && invalidDates.length === 0) {\n this.setInvalid(false);\n return this.emit(\"sgds-empty-input\");\n }\n };\n\n public destroyInputMask() {\n this.mask?.destroy();\n }\n public async applyInputMask() {\n return await this._applyInputMask(this.dateFormat);\n }\n public async focus() {\n const input = await this.shadowInput;\n return input.focus();\n }\n render() {\n return html`\n <div\n class=\"form-control-container ${classMap({\n disabled: this.disabled\n })}\"\n >\n ${this._renderLabel()}\n <div class=\"datepicker-input-container\">\n ${this._renderInput()}\n <slot name=\"calendar-btn\"></slot>\n </div>\n ${this._renderFeedback()}\n </div>\n `;\n }\n}\n\nexport default DatepickerInput;\n"],"names":["datepickerInputStyles"],"mappings":"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"}
1
+ {"version":3,"file":"datepicker-input.js","sources":["../../../src/components/Datepicker/datepicker-input.ts"],"sourcesContent":["import { isAfter, isBefore, isValid, parse } from \"date-fns\";\nimport IMask, { InputMask } from \"imask\";\nimport { html, PropertyValueMap } from \"lit\";\nimport { property, queryAsync } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { DATE_PATTERNS, setTimeToNoon } from \"../../utils/time\";\nimport { SgdsInput } from \"../Input/sgds-input\";\nimport datepickerInputStyles from \"./datepicker-input.css\";\nexport type DateFormat = \"MM/DD/YYYY\" | \"DD/MM/YYYY\" | \"YYYY/MM/DD\";\n\nexport class DatepickerInput extends SgdsInput {\n static styles = [...SgdsInput.styles, datepickerInputStyles];\n /** Date format reflected on input */\n private dateFormat = \"DD/MM/YYYY\";\n\n /** ISO date string to set the lowest allowable date value. e.g. \"2016-05-19T12:00:00.000Z\" */\n @property({ type: String }) minDate: string;\n\n /** ISO date string to set the highest allowable date value. e.g. \"2016-05-19T12:00:00.000Z\" */\n @property({ type: String }) maxDate: string;\n\n /** Changes DatePicker to single date selection or range date selection */\n @property({ type: String, reflect: true }) mode: \"single\" | \"range\" = \"single\";\n\n @queryAsync(\"input\")\n shadowInput: Promise<HTMLInputElement>;\n\n private mask: InputMask;\n constructor() {\n super();\n this.type = \"text\";\n }\n\n protected override _handleBlur() {\n const dates = this.mask.value.split(\" - \");\n const noEmptyDates = dates.filter(d => d !== this.dateFormat);\n const dateArray: Date[] | string[] = noEmptyDates.map(date =>\n setTimeToNoon(parse(date, DATE_PATTERNS[this.dateFormat].fnsPattern, new Date()))\n );\n const invalidDates = dateArray.filter(\n date =>\n !isValid(date) ||\n isBefore(date, new Date(0, 0, 1)) ||\n isBefore(date, setTimeToNoon(new Date(this.minDate))) ||\n isAfter(date, setTimeToNoon(new Date(this.maxDate)))\n );\n\n // Only clear if the mask is complete AND there are invalid dates\n // This clears complete but invalid dates like \"20/20/2026\"\n // Incomplete dates remain in the input as-is (validation only runs on complete dates)\n if (this.mask.masked.isComplete && invalidDates.length > 0 && dateArray.length > 0) {\n this.value = \"\";\n this.mask.value = \"\";\n this.setInvalid(false);\n }\n\n this.emit(\"sgds-blur\");\n }\n\n protected override async _handleChange(e: Event) {\n this.value = this.input.value;\n this.emit(\"sgds-change\");\n super._mixinHandleChange(e);\n await this._validateInput();\n }\n\n async firstUpdated(changedProperties: PropertyValueMap<this>) {\n super.firstUpdated(changedProperties);\n this._applyInputMask(this.dateFormat);\n }\n private async _applyInputMask(dateFormat: string) {\n const shadowInput = await this.shadowInput;\n const imPattern =\n this.mode === \"single\" ? DATE_PATTERNS[dateFormat].imPattern : DATE_PATTERNS[dateFormat].imRangePattern;\n const blocks = {\n d: { mask: IMask.MaskedRange, placeholderChar: \"D\", from: 0, to: 9, maxLength: 1 },\n m: { mask: IMask.MaskedRange, placeholderChar: \"M\", from: 0, to: 9, maxLength: 1 },\n y: { mask: IMask.MaskedRange, placeholderChar: \"Y\", from: 0, to: 9, maxLength: 1 },\n D: { mask: IMask.MaskedRange, placeholderChar: \"D\", from: 0, to: 9, maxLength: 1 },\n M: { mask: IMask.MaskedRange, placeholderChar: \"M\", from: 0, to: 9, maxLength: 1 },\n Y: { mask: IMask.MaskedRange, placeholderChar: \"Y\", from: 0, to: 9, maxLength: 1 }\n };\n const maskOptions = {\n mask: imPattern,\n pattern: imPattern,\n eager: true,\n overwrite: true,\n // define str -> date convertion\n parse: function (str: string) {\n const dates = str.split(\" - \");\n return dates.map(date => parse(date, DATE_PATTERNS[dateFormat].fnsPattern, new Date()));\n },\n format: function (dateArr: Date[]) {\n const dateStrings = dateArr.map(date => {\n let dayStr: string,\n monthStr = \"\";\n const day = date.getDate();\n const month = date.getMonth() + 1;\n const year = date.getFullYear();\n\n if (day < 10) dayStr = \"0\" + day;\n if (month < 10) monthStr = \"0\" + month;\n\n return [dayStr, monthStr, year].join(\"/\");\n });\n return dateStrings.join(\" - \");\n },\n lazy: false,\n blocks\n };\n\n this.mask = IMask(shadowInput, maskOptions);\n this.mask.on(\"accept\", () => {\n this.value = this.mask.masked.value;\n this.emit(\"i-sgds-mask-input-change\", { detail: this.value });\n });\n /**\n * Validation after date is complete\n */\n this.mask.on(\"complete\", this._validateInput);\n }\n public updateMaskValue() {\n this.mask?.updateValue();\n }\n private _validateInput = async () => {\n const dates = this.mask.value.split(\" - \");\n const noEmptyDates = dates.filter(d => d !== this.dateFormat);\n const dateArray: Date[] | string[] = noEmptyDates.map(date =>\n setTimeToNoon(parse(date, DATE_PATTERNS[this.dateFormat].fnsPattern, new Date()))\n );\n const invalidDates = dateArray.filter(\n date =>\n !isValid(date) ||\n isBefore(date, new Date(0, 0, 1)) ||\n isBefore(date, setTimeToNoon(new Date(this.minDate))) ||\n isAfter(date, setTimeToNoon(new Date(this.maxDate)))\n );\n\n if (invalidDates.length > 0) {\n this.setInvalid(true);\n return this.emit(\"i-sgds-invalid-input\");\n }\n if (this.mode === \"range\" && dateArray.length === 1) {\n this.setInvalid(true);\n return this.emit(\"i-sgds-invalid-input\");\n }\n if (invalidDates.length === 0 && dateArray.length > 0) {\n this.setInvalid(false);\n return this.emit(\"i-sgds-selectdates-input\", { detail: dateArray });\n }\n if (dateArray.length === 0 && invalidDates.length === 0) {\n this.setInvalid(false);\n return this.emit(\"i-sgds-empty-input\");\n }\n };\n\n public destroyInputMask() {\n this.mask?.destroy();\n }\n public async applyInputMask() {\n return await this._applyInputMask(this.dateFormat);\n }\n public async focus() {\n const input = await this.shadowInput;\n return input.focus();\n }\n render() {\n return html`\n <div\n class=\"form-control-container ${classMap({\n disabled: this.disabled\n })}\"\n >\n ${this._renderLabel()}\n <div class=\"datepicker-input-container\">\n ${this._renderInput()}\n <slot name=\"calendar-btn\"></slot>\n </div>\n ${this._renderFeedback()}\n </div>\n `;\n }\n}\n\nexport default DatepickerInput;\n"],"names":["datepickerInputStyles"],"mappings":"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"}
@@ -2448,7 +2448,7 @@ class extends Ii{constructor(t){if(super(t),t.type!==Hi&&t.type!==Ei&&t.type!==$
2448
2448
  >
2449
2449
  </sgds-icon-button>
2450
2450
  </div>
2451
- `}}_n.styles=[xn],_n.dependencies={"sgds-icon":vn,"sgds-icon-button":bn,"sgds-button":Us},t([Zi({attribute:!1})],_n.prototype,"displayDate",void 0),t([Zi({attribute:!1})],_n.prototype,"focusedDate",void 0),t([Zi({attribute:!1})],_n.prototype,"selectedDate",void 0),t([Zi()],_n.prototype,"view",void 0),t([Zi()],_n.prototype,"focusedTabIndex",void 0),t([As("focusedTabIndex",{waitUntilFirstUpdate:!0})],_n.prototype,"_handleFocusedTabIndexChange",null);const Cn=["January","February","March","April","May","June","July","August","September","October","November","December"];function kn(t){return"string"==typeof t||t instanceof String}function Mn(t){var e;return"object"==typeof t&&null!=t&&"Object"===(null==t||null==(e=t.constructor)?void 0:e.name)}function Zn(t,e){return Array.isArray(e)?Zn(t,(t,i)=>e.includes(i)):Object.entries(t).reduce((t,i)=>{let[a,s]=i;return e(s,a)&&(t[a]=s),t},{})}const Vn="NONE",Sn="LEFT",Dn="FORCE_LEFT",An="RIGHT",Bn="FORCE_RIGHT";function En(t){return t.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function Fn(t,e){if(e===t)return!0;const i=Array.isArray(e),a=Array.isArray(t);let s;if(i&&a){if(e.length!=t.length)return!1;for(s=0;s<e.length;s++)if(!Fn(e[s],t[s]))return!1;return!0}if(i!=a)return!1;if(e&&t&&"object"==typeof e&&"object"==typeof t){const i=e instanceof Date,a=t instanceof Date;if(i&&a)return e.getTime()==t.getTime();if(i!=a)return!1;const n=e instanceof RegExp,r=t instanceof RegExp;if(n&&r)return e.toString()==t.toString();if(n!=r)return!1;const o=Object.keys(e);for(s=0;s<o.length;s++)if(!Object.prototype.hasOwnProperty.call(t,o[s]))return!1;for(s=0;s<o.length;s++)if(!Fn(t[o[s]],e[o[s]]))return!1;return!0}return!(!e||!t||"function"!=typeof e||"function"!=typeof t)&&e.toString()===t.toString()}class Hn{constructor(t){for(Object.assign(this,t);this.value.slice(0,this.startChangePos)!==this.oldValue.slice(0,this.startChangePos);)--this.oldSelection.start;if(this.insertedCount)for(;this.value.slice(this.cursorPos)!==this.oldValue.slice(this.oldSelection.end);)this.value.length-this.cursorPos<this.oldValue.length-this.oldSelection.end?++this.oldSelection.end:++this.cursorPos}get startChangePos(){return Math.min(this.cursorPos,this.oldSelection.start)}get insertedCount(){return this.cursorPos-this.startChangePos}get inserted(){return this.value.substr(this.startChangePos,this.insertedCount)}get removedCount(){return Math.max(this.oldSelection.end-this.startChangePos||this.oldValue.length-this.value.length,0)}get removed(){return this.oldValue.substr(this.startChangePos,this.removedCount)}get head(){return this.value.substring(0,this.startChangePos)}get tail(){return this.value.substring(this.startChangePos+this.insertedCount)}get removeDirection(){return!this.removedCount||this.insertedCount?Vn:this.oldSelection.end!==this.cursorPos&&this.oldSelection.start!==this.cursorPos||this.oldSelection.end!==this.oldSelection.start?Sn:An}}function $n(t,e){return new $n.InputMask(t,e)}function Tn(t){if(null==t)throw new Error("mask property should be defined");return t instanceof RegExp?$n.MaskedRegExp:kn(t)?$n.MaskedPattern:t===Date?$n.MaskedDate:t===Number?$n.MaskedNumber:Array.isArray(t)||t===Array?$n.MaskedDynamic:$n.Masked&&t.prototype instanceof $n.Masked?t:$n.Masked&&t instanceof $n.Masked?t.constructor:t instanceof Function?$n.MaskedFunction:(console.warn("Mask not found for mask",t),$n.Masked)}function In(t){if(!t)throw new Error("Options in not defined");if($n.Masked){if(t.prototype instanceof $n.Masked)return{mask:t};const{mask:e,...i}=t instanceof $n.Masked?{mask:t}:Mn(t)&&t.mask instanceof $n.Masked?t:{};if(e){const t=e.mask;return{...Zn(e,(t,e)=>!e.startsWith("_")),mask:e.constructor,_mask:t,...i}}}return Mn(t)?{...t}:{mask:t}}function Pn(t){if($n.Masked&&t instanceof $n.Masked)return t;const e=In(t),i=Tn(e.mask);if(!i)throw new Error("Masked class is not found for provided mask "+e.mask+", appropriate module needs to be imported manually before creating mask.");return e.mask===i&&delete e.mask,e._mask&&(e.mask=e._mask,delete e._mask),new i(e)}$n.createMask=Pn;class Ln{get selectionStart(){let t;try{t=this._unsafeSelectionStart}catch{}return null!=t?t:this.value.length}get selectionEnd(){let t;try{t=this._unsafeSelectionEnd}catch{}return null!=t?t:this.value.length}select(t,e){if(null!=t&&null!=e&&(t!==this.selectionStart||e!==this.selectionEnd))try{this._unsafeSelect(t,e)}catch{}}get isActive(){return!1}}$n.MaskElement=Ln;class Rn extends Ln{constructor(t){super(),this.input=t,this._onKeydown=this._onKeydown.bind(this),this._onInput=this._onInput.bind(this),this._onBeforeinput=this._onBeforeinput.bind(this),this._onCompositionEnd=this._onCompositionEnd.bind(this)}get rootElement(){var t,e,i;return null!=(t=null==(e=(i=this.input).getRootNode)?void 0:e.call(i))?t:document}get isActive(){return this.input===this.rootElement.activeElement}bindEvents(t){this.input.addEventListener("keydown",this._onKeydown),this.input.addEventListener("input",this._onInput),this.input.addEventListener("beforeinput",this._onBeforeinput),this.input.addEventListener("compositionend",this._onCompositionEnd),this.input.addEventListener("drop",t.drop),this.input.addEventListener("click",t.click),this.input.addEventListener("focus",t.focus),this.input.addEventListener("blur",t.commit),this._handlers=t}_onKeydown(t){return this._handlers.redo&&(90===t.keyCode&&t.shiftKey&&(t.metaKey||t.ctrlKey)||89===t.keyCode&&t.ctrlKey)?(t.preventDefault(),this._handlers.redo(t)):this._handlers.undo&&90===t.keyCode&&(t.metaKey||t.ctrlKey)?(t.preventDefault(),this._handlers.undo(t)):void(t.isComposing||this._handlers.selectionChange(t))}_onBeforeinput(t){return"historyUndo"===t.inputType&&this._handlers.undo?(t.preventDefault(),this._handlers.undo(t)):"historyRedo"===t.inputType&&this._handlers.redo?(t.preventDefault(),this._handlers.redo(t)):void 0}_onCompositionEnd(t){this._handlers.input(t)}_onInput(t){t.isComposing||this._handlers.input(t)}unbindEvents(){this.input.removeEventListener("keydown",this._onKeydown),this.input.removeEventListener("input",this._onInput),this.input.removeEventListener("beforeinput",this._onBeforeinput),this.input.removeEventListener("compositionend",this._onCompositionEnd),this.input.removeEventListener("drop",this._handlers.drop),this.input.removeEventListener("click",this._handlers.click),this.input.removeEventListener("focus",this._handlers.focus),this.input.removeEventListener("blur",this._handlers.commit),this._handlers={}}}$n.HTMLMaskElement=Rn;class On extends Rn{constructor(t){super(t),this.input=t}get _unsafeSelectionStart(){return null!=this.input.selectionStart?this.input.selectionStart:this.value.length}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(t,e){this.input.setSelectionRange(t,e)}get value(){return this.input.value}set value(t){this.input.value=t}}$n.HTMLMaskElement=Rn;class Yn extends Rn{get _unsafeSelectionStart(){const t=this.rootElement,e=t.getSelection&&t.getSelection(),i=e&&e.anchorOffset,a=e&&e.focusOffset;return null==a||null==i||i<a?i:a}get _unsafeSelectionEnd(){const t=this.rootElement,e=t.getSelection&&t.getSelection(),i=e&&e.anchorOffset,a=e&&e.focusOffset;return null==a||null==i||i>a?i:a}_unsafeSelect(t,e){if(!this.rootElement.createRange)return;const i=this.rootElement.createRange();i.setStart(this.input.firstChild||this.input,t),i.setEnd(this.input.lastChild||this.input,e);const a=this.rootElement,s=a.getSelection&&a.getSelection();s&&(s.removeAllRanges(),s.addRange(i))}get value(){return this.input.textContent||""}set value(t){this.input.textContent=t}}$n.HTMLContenteditableMaskElement=Yn;class Nn{constructor(){this.states=[],this.currentIndex=0}get currentState(){return this.states[this.currentIndex]}get isEmpty(){return 0===this.states.length}push(t){this.currentIndex<this.states.length-1&&(this.states.length=this.currentIndex+1),this.states.push(t),this.states.length>Nn.MAX_LENGTH&&this.states.shift(),this.currentIndex=this.states.length-1}go(t){return this.currentIndex=Math.min(Math.max(this.currentIndex+t,0),this.states.length-1),this.currentState}undo(){return this.go(-1)}redo(){return this.go(1)}clear(){this.states.length=0,this.currentIndex=0}}Nn.MAX_LENGTH=100;$n.InputMask=class{constructor(t,e){this.el=t instanceof Ln?t:t.isContentEditable&&"INPUT"!==t.tagName&&"TEXTAREA"!==t.tagName?new Yn(t):new On(t),this.masked=Pn(e),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new Nn,this._saveSelection=this._saveSelection.bind(this),this._onInput=this._onInput.bind(this),this._onChange=this._onChange.bind(this),this._onDrop=this._onDrop.bind(this),this._onFocus=this._onFocus.bind(this),this._onClick=this._onClick.bind(this),this._onUndo=this._onUndo.bind(this),this._onRedo=this._onRedo.bind(this),this.alignCursor=this.alignCursor.bind(this),this.alignCursorFriendly=this.alignCursorFriendly.bind(this),this._bindEvents(),this.updateValue(),this._onChange()}maskEquals(t){var e;return null==t||(null==(e=this.masked)?void 0:e.maskEquals(t))}get mask(){return this.masked.mask}set mask(t){if(this.maskEquals(t))return;if(!(t instanceof $n.Masked)&&this.masked.constructor===Tn(t))return void this.masked.updateOptions({mask:t});const e=t instanceof $n.Masked?t:Pn({mask:t});e.unmaskedValue=this.masked.unmaskedValue,this.masked=e}get value(){return this._value}set value(t){this.value!==t&&(this.masked.value=t,this.updateControl("auto"))}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(t){this.unmaskedValue!==t&&(this.masked.unmaskedValue=t,this.updateControl("auto"))}get rawInputValue(){return this._rawInputValue}set rawInputValue(t){this.rawInputValue!==t&&(this.masked.rawInputValue=t,this.updateControl(),this.alignCursor())}get typedValue(){return this.masked.typedValue}set typedValue(t){this.masked.typedValueEquals(t)||(this.masked.typedValue=t,this.updateControl("auto"))}get displayValue(){return this.masked.displayValue}_bindEvents(){this.el.bindEvents({selectionChange:this._saveSelection,input:this._onInput,drop:this._onDrop,click:this._onClick,focus:this._onFocus,commit:this._onChange,undo:this._onUndo,redo:this._onRedo})}_unbindEvents(){this.el&&this.el.unbindEvents()}_fireEvent(t,e){const i=this._listeners[t];i&&i.forEach(t=>t(e))}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(t){this.el&&this.el.isActive&&(this.el.select(t,t),this._saveSelection())}_saveSelection(){this.displayValue!==this.el.value&&console.warn("Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly."),this._selection={start:this.selectionStart,end:this.cursorPos}}updateValue(){this.masked.value=this.el.value,this._value=this.masked.value,this._unmaskedValue=this.masked.unmaskedValue,this._rawInputValue=this.masked.rawInputValue}updateControl(t){const e=this.masked.unmaskedValue,i=this.masked.value,a=this.masked.rawInputValue,s=this.displayValue,n=this.unmaskedValue!==e||this.value!==i||this._rawInputValue!==a;this._unmaskedValue=e,this._value=i,this._rawInputValue=a,this.el.value!==s&&(this.el.value=s),"auto"===t?this.alignCursor():null!=t&&(this.cursorPos=t),n&&this._fireChangeEvents(),this._historyChanging||!n&&!this.history.isEmpty||this.history.push({unmaskedValue:e,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(t){const{mask:e,...i}=t,a=!this.maskEquals(e),s=this.masked.optionsIsChanged(i);a&&(this.mask=e),s&&this.masked.updateOptions(i),(a||s)&&this.updateControl()}updateCursor(t){null!=t&&(this.cursorPos=t,this._delayUpdateCursor(t))}_delayUpdateCursor(t){this._abortUpdateCursor(),this._changingCursorPos=t,this._cursorChanging=setTimeout(()=>{this.el&&(this.cursorPos=this._changingCursorPos,this._abortUpdateCursor())},10)}_fireChangeEvents(){this._fireEvent("accept",this._inputEvent),this.masked.isComplete&&this._fireEvent("complete",this._inputEvent)}_abortUpdateCursor(){this._cursorChanging&&(clearTimeout(this._cursorChanging),delete this._cursorChanging)}alignCursor(){this.cursorPos=this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos,Sn))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(t,e){return this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].push(e),this}off(t,e){if(!this._listeners[t])return this;if(!e)return delete this._listeners[t],this;const i=this._listeners[t].indexOf(e);return i>=0&&this._listeners[t].splice(i,1),this}_onInput(t){this._inputEvent=t,this._abortUpdateCursor();const e=new Hn({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),i=this.masked.rawInputValue,a=this.masked.splice(e.startChangePos,e.removed.length,e.inserted,e.removeDirection,{input:!0,raw:!0}).offset,s=i===this.masked.rawInputValue?e.removeDirection:Vn;let n=this.masked.nearestInputPos(e.startChangePos+a,s);s!==Vn&&(n=this.masked.nearestInputPos(n,Vn)),this.updateControl(n),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(t){t.preventDefault(),t.stopPropagation()}_onFocus(t){this.alignCursorFriendly()}_onClick(t){this.alignCursorFriendly()}_onUndo(){this._applyHistoryState(this.history.undo())}_onRedo(){this._applyHistoryState(this.history.redo())}_applyHistoryState(t){t&&(this._historyChanging=!0,this.unmaskedValue=t.unmaskedValue,this.el.select(t.selection.start,t.selection.end),this._saveSelection(),this._historyChanging=!1)}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}};class zn{static normalize(t){return Array.isArray(t)?t:[t,new zn]}constructor(t){Object.assign(this,{inserted:"",rawInserted:"",tailShift:0,skip:!1},t)}aggregate(t){return this.inserted+=t.inserted,this.rawInserted+=t.rawInserted,this.tailShift+=t.tailShift,this.skip=this.skip||t.skip,this}get offset(){return this.tailShift+this.inserted.length}get consumed(){return Boolean(this.rawInserted)||this.skip}equals(t){return this.inserted===t.inserted&&this.tailShift===t.tailShift&&this.rawInserted===t.rawInserted&&this.skip===t.skip}}$n.ChangeDetails=zn;class Un{constructor(t,e,i){void 0===t&&(t=""),void 0===e&&(e=0),this.value=t,this.from=e,this.stop=i}toString(){return this.value}extend(t){this.value+=String(t)}appendTo(t){return t.append(this.toString(),{tail:!0}).aggregate(t._appendPlaceholder())}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(t){Object.assign(this,t)}unshift(t){if(!this.value.length||null!=t&&this.from>=t)return"";const e=this.value[0];return this.value=this.value.slice(1),e}shift(){if(!this.value.length)return"";const t=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),t}}class qn{constructor(t){this._value="",this._update({...qn.DEFAULTS,...t}),this._initialized=!0}updateOptions(t){this.optionsIsChanged(t)&&this.withValueRefresh(this._update.bind(this,t))}_update(t){Object.assign(this,t)}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue}}set state(t){this._value=t._value}reset(){this._value=""}get value(){return this._value}set value(t){this.resolve(t,{input:!0})}resolve(t,e){void 0===e&&(e={input:!0}),this.reset(),this.append(t,e,""),this.doCommit()}get unmaskedValue(){return this.value}set unmaskedValue(t){this.resolve(t,{})}get typedValue(){return this.parse?this.parse(this.value,this):this.unmaskedValue}set typedValue(t){this.format?this.value=this.format(t,this):this.unmaskedValue=String(t)}get rawInputValue(){return this.extractInput(0,this.displayValue.length,{raw:!0})}set rawInputValue(t){this.resolve(t,{raw:!0})}get displayValue(){return this.value}get isComplete(){return!0}get isFilled(){return this.isComplete}nearestInputPos(t,e){return t}totalInputPositions(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),Math.min(this.displayValue.length,e-t)}extractInput(t,e,i){return void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),this.displayValue.slice(t,e)}extractTail(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),new Un(this.extractInput(t,e),t)}appendTail(t){return kn(t)&&(t=new Un(String(t))),t.appendTo(this)}_appendCharRaw(t,e){return t?(this._value+=t,new zn({inserted:t,rawInserted:t})):new zn}_appendChar(t,e,i){void 0===e&&(e={});const a=this.state;let s;if([t,s]=this.doPrepareChar(t,e),t&&(s=s.aggregate(this._appendCharRaw(t,e)),!s.rawInserted&&"pad"===this.autofix)){const i=this.state;this.state=a;let n=this.pad(e);const r=this._appendCharRaw(t,e);n=n.aggregate(r),r.rawInserted||n.equals(s)?s=n:this.state=i}if(s.inserted){let t,n=!1!==this.doValidate(e);if(n&&null!=i){const e=this.state;if(!0===this.overwrite){t=i.state;for(let t=0;t<s.rawInserted.length;++t)i.unshift(this.displayValue.length-s.tailShift)}let a=this.appendTail(i);if(n=a.rawInserted.length===i.toString().length,!(n&&a.inserted||"shift"!==this.overwrite)){this.state=e,t=i.state;for(let t=0;t<s.rawInserted.length;++t)i.shift();a=this.appendTail(i),n=a.rawInserted.length===i.toString().length}n&&a.inserted&&(this.state=e)}n||(s=new zn,this.state=a,i&&t&&(i.state=t))}return s}_appendPlaceholder(){return new zn}_appendEager(){return new zn}append(t,e,i){if(!kn(t))throw new Error("value should be string");const a=kn(i)?new Un(String(i)):i;let s;null!=e&&e.tail&&(e._beforeTailState=this.state),[t,s]=this.doPrepare(t,e);for(let i=0;i<t.length;++i){const n=this._appendChar(t[i],e,a);if(!n.rawInserted&&!this.doSkipInvalid(t[i],e,a))break;s.aggregate(n)}return(!0===this.eager||"append"===this.eager)&&null!=e&&e.input&&t&&s.aggregate(this._appendEager()),null!=a&&(s.tailShift+=this.appendTail(a).tailShift),s}remove(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),this._value=this.displayValue.slice(0,t)+this.displayValue.slice(e),new zn}withValueRefresh(t){if(this._refreshing||!this._initialized)return t();this._refreshing=!0;const e=this.rawInputValue,i=this.value,a=t();return this.rawInputValue=e,this.value&&this.value!==i&&0===i.indexOf(this.value)&&(this.append(i.slice(this.displayValue.length),{},""),this.doCommit()),delete this._refreshing,a}runIsolated(t){if(this._isolated||!this._initialized)return t(this);this._isolated=!0;const e=this.state,i=t(this);return this.state=e,delete this._isolated,i}doSkipInvalid(t,e,i){return Boolean(this.skipInvalid)}doPrepare(t,e){return void 0===e&&(e={}),zn.normalize(this.prepare?this.prepare(t,this,e):t)}doPrepareChar(t,e){return void 0===e&&(e={}),zn.normalize(this.prepareChar?this.prepareChar(t,this,e):t)}doValidate(t){return(!this.validate||this.validate(this.value,this,t))&&(!this.parent||this.parent.doValidate(t))}doCommit(){this.commit&&this.commit(this.value,this)}splice(t,e,i,a,s){void 0===i&&(i=""),void 0===a&&(a=Vn),void 0===s&&(s={input:!0});const n=t+e,r=this.extractTail(n),o=!0===this.eager||"remove"===this.eager;let l;o&&(a=function(t){switch(t){case Sn:return Dn;case An:return Bn;default:return t}}(a),l=this.extractInput(0,n,{raw:!0}));let c=t;const d=new zn;if(a!==Vn&&(c=this.nearestInputPos(t,e>1&&0!==t&&!o?Vn:a),d.tailShift=c-t),d.aggregate(this.remove(c)),o&&a!==Vn&&l===this.rawInputValue)if(a===Dn){let t;for(;l===this.rawInputValue&&(t=this.displayValue.length);)d.aggregate(new zn({tailShift:-1})).aggregate(this.remove(t-1))}else a===Bn&&r.unshift();return d.aggregate(this.append(i,s,r))}maskEquals(t){return this.mask===t}optionsIsChanged(t){return!Fn(this,t)}typedValueEquals(t){const e=this.typedValue;return t===e||qn.EMPTY_VALUES.includes(t)&&qn.EMPTY_VALUES.includes(e)||!!this.format&&this.format(t,this)===this.format(this.typedValue,this)}pad(t){return new zn}}qn.DEFAULTS={skipInvalid:!0},qn.EMPTY_VALUES=[void 0,null,""],$n.Masked=qn;class Wn{constructor(t,e){void 0===t&&(t=[]),void 0===e&&(e=0),this.chunks=t,this.from=e}toString(){return this.chunks.map(String).join("")}extend(t){if(!String(t))return;t=kn(t)?new Un(String(t)):t;const e=this.chunks[this.chunks.length-1],i=e&&(e.stop===t.stop||null==t.stop)&&t.from===e.from+e.toString().length;if(t instanceof Un)i?e.extend(t.toString()):this.chunks.push(t);else if(t instanceof Wn){if(null==t.stop){let e;for(;t.chunks.length&&null==t.chunks[0].stop;)e=t.chunks.shift(),e.from+=t.from,this.extend(e)}t.toString()&&(t.stop=t.blockIndex,this.chunks.push(t))}}appendTo(t){if(!(t instanceof $n.MaskedPattern)){return new Un(this.toString()).appendTo(t)}const e=new zn;for(let i=0;i<this.chunks.length;++i){const a=this.chunks[i],s=t._mapPosToBlock(t.displayValue.length),n=a.stop;let r;if(null!=n&&(!s||s.index<=n)&&((a instanceof Wn||t._stops.indexOf(n)>=0)&&e.aggregate(t._appendPlaceholder(n)),r=a instanceof Wn&&t._blocks[n]),r){const i=r.appendTail(a);e.aggregate(i);const s=a.toString().slice(i.rawInserted.length);s&&e.aggregate(t.append(s,{tail:!0}))}else e.aggregate(t.append(a.toString(),{tail:!0}))}return e}get state(){return{chunks:this.chunks.map(t=>t.state),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(t){const{chunks:e,...i}=t;Object.assign(this,i),this.chunks=e.map(t=>{const e="chunks"in t?new Wn:new Un;return e.state=t,e})}unshift(t){if(!this.chunks.length||null!=t&&this.from>=t)return"";const e=null!=t?t-this.from:t;let i=0;for(;i<this.chunks.length;){const t=this.chunks[i],a=t.unshift(e);if(t.toString()){if(!a)break;++i}else this.chunks.splice(i,1);if(a)return a}return""}shift(){if(!this.chunks.length)return"";let t=this.chunks.length-1;for(;0<=t;){const e=this.chunks[t],i=e.shift();if(e.toString()){if(!i)break;--t}else this.chunks.splice(t,1);if(i)return i}return""}}class jn{constructor(t,e){this.masked=t,this._log=[];const{offset:i,index:a}=t._mapPosToBlock(e)||(e<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=i,this.index=a,this.ok=!1}get block(){return this.masked._blocks[this.index]}get pos(){return this.masked._blockStartPos(this.index)+this.offset}get state(){return{index:this.index,offset:this.offset,ok:this.ok}}set state(t){Object.assign(this,t)}pushState(){this._log.push(this.state)}popState(){const t=this._log.pop();return t&&(this.state=t),t}bindBlock(){this.block||(this.index<0&&(this.index=0,this.offset=0),this.index>=this.masked._blocks.length&&(this.index=this.masked._blocks.length-1,this.offset=this.block.displayValue.length))}_pushLeft(t){for(this.pushState(),this.bindBlock();0<=this.index;--this.index,this.offset=(null==(e=this.block)?void 0:e.displayValue.length)||0){var e;if(t())return this.ok=!0}return this.ok=!1}_pushRight(t){for(this.pushState(),this.bindBlock();this.index<this.masked._blocks.length;++this.index,this.offset=0)if(t())return this.ok=!0;return this.ok=!1}pushLeftBeforeFilled(){return this._pushLeft(()=>{if(!this.block.isFixed&&this.block.value)return this.offset=this.block.nearestInputPos(this.offset,Dn),0!==this.offset||void 0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,Sn),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,Sn),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!this.block.isFixed&&this.block.value)return this.offset=this.block.nearestInputPos(this.offset,Bn),this.offset!==this.block.value.length||void 0})}pushRightBeforeInput(){return this._pushRight(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,Vn),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,Vn),!0})}}class Gn{constructor(t){Object.assign(this,t),this._value="",this.isFixed=!0}get value(){return this._value}get unmaskedValue(){return this.isUnmasking?this.value:""}get rawInputValue(){return this._isRawInput?this.value:""}get displayValue(){return this.value}reset(){this._isRawInput=!1,this._value=""}remove(t,e){return void 0===t&&(t=0),void 0===e&&(e=this._value.length),this._value=this._value.slice(0,t)+this._value.slice(e),this._value||(this._isRawInput=!1),new zn}nearestInputPos(t,e){void 0===e&&(e=Vn);const i=this._value.length;switch(e){case Sn:case Dn:return 0;default:return i}}totalInputPositions(t,e){return void 0===t&&(t=0),void 0===e&&(e=this._value.length),this._isRawInput?e-t:0}extractInput(t,e,i){return void 0===t&&(t=0),void 0===e&&(e=this._value.length),void 0===i&&(i={}),i.raw&&this._isRawInput&&this._value.slice(t,e)||""}get isComplete(){return!0}get isFilled(){return Boolean(this._value)}_appendChar(t,e){if(void 0===e&&(e={}),this.isFilled)return new zn;const i=!0===this.eager||"append"===this.eager,a=this.char===t&&(this.isUnmasking||e.input||e.raw)&&(!e.raw||!i)&&!e.tail,s=new zn({inserted:this.char,rawInserted:a?this.char:""});return this._value=this.char,this._isRawInput=a&&(e.raw||e.input),s}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const t=new zn;return this.isFilled||(this._value=t.inserted=this.char),t}extractTail(){return new Un("")}appendTail(t){return kn(t)&&(t=new Un(String(t))),t.appendTo(this)}append(t,e,i){const a=this._appendChar(t[0],e);return null!=i&&(a.tailShift+=this.appendTail(i).tailShift),a}doCommit(){}get state(){return{_value:this._value,_rawInputValue:this.rawInputValue}}set state(t){this._value=t._value,this._isRawInput=Boolean(t._rawInputValue)}pad(t){return this._appendPlaceholder()}}class Kn{constructor(t){const{parent:e,isOptional:i,placeholderChar:a,displayChar:s,lazy:n,eager:r,...o}=t;this.masked=Pn(o),Object.assign(this,{parent:e,isOptional:i,placeholderChar:a,displayChar:s,lazy:n,eager:r})}reset(){this.isFilled=!1,this.masked.reset()}remove(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.value.length),0===t&&e>=1?(this.isFilled=!1,this.masked.remove(t,e)):new zn}get value(){return this.masked.value||(this.isFilled&&!this.isOptional?this.placeholderChar:"")}get unmaskedValue(){return this.masked.unmaskedValue}get rawInputValue(){return this.masked.rawInputValue}get displayValue(){return this.masked.value&&this.displayChar||this.value}get isComplete(){return Boolean(this.masked.value)||this.isOptional}_appendChar(t,e){if(void 0===e&&(e={}),this.isFilled)return new zn;const i=this.masked.state;let a=this.masked._appendChar(t,this.currentMaskFlags(e));return a.inserted&&!1===this.doValidate(e)&&(a=new zn,this.masked.state=i),a.inserted||this.isOptional||this.lazy||e.input||(a.inserted=this.placeholderChar),a.skip=!a.inserted&&!this.isOptional,this.isFilled=Boolean(a.inserted),a}append(t,e,i){return this.masked.append(t,this.currentMaskFlags(e),i)}_appendPlaceholder(){return this.isFilled||this.isOptional?new zn:(this.isFilled=!0,new zn({inserted:this.placeholderChar}))}_appendEager(){return new zn}extractTail(t,e){return this.masked.extractTail(t,e)}appendTail(t){return this.masked.appendTail(t)}extractInput(t,e,i){return void 0===t&&(t=0),void 0===e&&(e=this.value.length),this.masked.extractInput(t,e,i)}nearestInputPos(t,e){void 0===e&&(e=Vn);const i=this.value.length,a=Math.min(Math.max(t,0),i);switch(e){case Sn:case Dn:return this.isComplete?a:0;case An:case Bn:return this.isComplete?a:i;default:return a}}totalInputPositions(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.value.length),this.value.slice(t,e).length}doValidate(t){return this.masked.doValidate(this.currentMaskFlags(t))&&(!this.parent||this.parent.doValidate(this.currentMaskFlags(t)))}doCommit(){this.masked.doCommit()}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue,masked:this.masked.state,isFilled:this.isFilled}}set state(t){this.masked.state=t.masked,this.isFilled=t.isFilled}currentMaskFlags(t){var e;return{...t,_beforeTailState:(null==t||null==(e=t._beforeTailState)?void 0:e.masked)||(null==t?void 0:t._beforeTailState)}}pad(t){return new zn}}Kn.DEFAULT_DEFINITIONS={0:/\d/,a:/[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,"*":/./};$n.MaskedRegExp=class extends qn{updateOptions(t){super.updateOptions(t)}_update(t){const e=t.mask;e&&(t.validate=t=>t.search(e)>=0),super._update(t)}};class Qn extends qn{constructor(t){super({...Qn.DEFAULTS,...t,definitions:Object.assign({},Kn.DEFAULT_DEFINITIONS,null==t?void 0:t.definitions)})}updateOptions(t){super.updateOptions(t)}_update(t){t.definitions=Object.assign({},this.definitions,t.definitions),super._update(t),this._rebuildMask()}_rebuildMask(){const t=this.definitions;this._blocks=[],this.exposeBlock=void 0,this._stops=[],this._maskedBlocks={};const e=this.mask;if(!e||!t)return;let i=!1,a=!1;for(let s=0;s<e.length;++s){if(this.blocks){const t=e.slice(s),i=Object.keys(this.blocks).filter(e=>0===t.indexOf(e));i.sort((t,e)=>e.length-t.length);const a=i[0];if(a){const{expose:t,repeat:e,...i}=In(this.blocks[a]),n={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...i,repeat:e,parent:this},r=null!=e?new $n.RepeatBlock(n):Pn(n);r&&(this._blocks.push(r),t&&(this.exposeBlock=r),this._maskedBlocks[a]||(this._maskedBlocks[a]=[]),this._maskedBlocks[a].push(this._blocks.length-1)),s+=a.length-1;continue}}let n=e[s],r=n in t;if(n===Qn.STOP_CHAR){this._stops.push(this._blocks.length);continue}if("{"===n||"}"===n){i=!i;continue}if("["===n||"]"===n){a=!a;continue}if(n===Qn.ESCAPE_CHAR){if(++s,n=e[s],!n)break;r=!1}const o=r?new Kn({isOptional:a,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...In(t[n]),parent:this}):new Gn({char:n,eager:this.eager,isUnmasking:i});this._blocks.push(o)}}get state(){return{...super.state,_blocks:this._blocks.map(t=>t.state)}}set state(t){if(!t)return void this.reset();const{_blocks:e,...i}=t;this._blocks.forEach((t,i)=>t.state=e[i]),super.state=i}reset(){super.reset(),this._blocks.forEach(t=>t.reset())}get isComplete(){return this.exposeBlock?this.exposeBlock.isComplete:this._blocks.every(t=>t.isComplete)}get isFilled(){return this._blocks.every(t=>t.isFilled)}get isFixed(){return this._blocks.every(t=>t.isFixed)}get isOptional(){return this._blocks.every(t=>t.isOptional)}doCommit(){this._blocks.forEach(t=>t.doCommit()),super.doCommit()}get unmaskedValue(){return this.exposeBlock?this.exposeBlock.unmaskedValue:this._blocks.reduce((t,e)=>t+e.unmaskedValue,"")}set unmaskedValue(t){if(this.exposeBlock){const e=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=t,this.appendTail(e),this.doCommit()}else super.unmaskedValue=t}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce((t,e)=>t+e.value,"")}set value(t){if(this.exposeBlock){const e=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=t,this.appendTail(e),this.doCommit()}else super.value=t}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(t){if(this.exposeBlock){const e=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=t,this.appendTail(e),this.doCommit()}else super.typedValue=t}get displayValue(){return this._blocks.reduce((t,e)=>t+e.displayValue,"")}appendTail(t){return super.appendTail(t).aggregate(this._appendPlaceholder())}_appendEager(){var t;const e=new zn;let i=null==(t=this._mapPosToBlock(this.displayValue.length))?void 0:t.index;if(null==i)return e;this._blocks[i].isFilled&&++i;for(let t=i;t<this._blocks.length;++t){const i=this._blocks[t]._appendEager();if(!i.inserted)break;e.aggregate(i)}return e}_appendCharRaw(t,e){void 0===e&&(e={});const i=this._mapPosToBlock(this.displayValue.length),a=new zn;if(!i)return a;for(let n,r=i.index;n=this._blocks[r];++r){var s;const i=n._appendChar(t,{...e,_beforeTailState:null==(s=e._beforeTailState)||null==(s=s._blocks)?void 0:s[r]});if(a.aggregate(i),i.consumed)break}return a}extractTail(t,e){void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length);const i=new Wn;return t===e||this._forEachBlocksInRange(t,e,(t,e,a,s)=>{const n=t.extractTail(a,s);n.stop=this._findStopBefore(e),n.from=this._blockStartPos(e),n instanceof Wn&&(n.blockIndex=e),i.extend(n)}),i}extractInput(t,e,i){if(void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),void 0===i&&(i={}),t===e)return"";let a="";return this._forEachBlocksInRange(t,e,(t,e,s,n)=>{a+=t.extractInput(s,n,i)}),a}_findStopBefore(t){let e;for(let i=0;i<this._stops.length;++i){const a=this._stops[i];if(!(a<=t))break;e=a}return e}_appendPlaceholder(t){const e=new zn;if(this.lazy&&null==t)return e;const i=this._mapPosToBlock(this.displayValue.length);if(!i)return e;const a=i.index,s=null!=t?t:this._blocks.length;return this._blocks.slice(a,s).forEach(i=>{var a;i.lazy&&null==t||e.aggregate(i._appendPlaceholder(null==(a=i._blocks)?void 0:a.length))}),e}_mapPosToBlock(t){let e="";for(let i=0;i<this._blocks.length;++i){const a=this._blocks[i],s=e.length;if(e+=a.displayValue,t<=e.length)return{index:i,offset:t-s}}}_blockStartPos(t){return this._blocks.slice(0,t).reduce((t,e)=>t+e.displayValue.length,0)}_forEachBlocksInRange(t,e,i){void 0===e&&(e=this.displayValue.length);const a=this._mapPosToBlock(t);if(a){const t=this._mapPosToBlock(e),s=t&&a.index===t.index,n=a.offset,r=t&&s?t.offset:this._blocks[a.index].displayValue.length;if(i(this._blocks[a.index],a.index,n,r),t&&!s){for(let e=a.index+1;e<t.index;++e)i(this._blocks[e],e,0,this._blocks[e].displayValue.length);i(this._blocks[t.index],t.index,0,t.offset)}}}remove(t,e){void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length);const i=super.remove(t,e);return this._forEachBlocksInRange(t,e,(t,e,a,s)=>{i.aggregate(t.remove(a,s))}),i}nearestInputPos(t,e){if(void 0===e&&(e=Vn),!this._blocks.length)return 0;const i=new jn(this,t);if(e===Vn)return i.pushRightBeforeInput()?i.pos:(i.popState(),i.pushLeftBeforeInput()?i.pos:this.displayValue.length);if(e===Sn||e===Dn){if(e===Sn){if(i.pushRightBeforeFilled(),i.ok&&i.pos===t)return t;i.popState()}if(i.pushLeftBeforeInput(),i.pushLeftBeforeRequired(),i.pushLeftBeforeFilled(),e===Sn){if(i.pushRightBeforeInput(),i.pushRightBeforeRequired(),i.ok&&i.pos<=t)return i.pos;if(i.popState(),i.ok&&i.pos<=t)return i.pos;i.popState()}return i.ok?i.pos:e===Dn?0:(i.popState(),i.ok?i.pos:(i.popState(),i.ok?i.pos:0))}return e===An||e===Bn?(i.pushRightBeforeInput(),i.pushRightBeforeRequired(),i.pushRightBeforeFilled()?i.pos:e===Bn?this.displayValue.length:(i.popState(),i.ok?i.pos:(i.popState(),i.ok?i.pos:this.nearestInputPos(t,Sn)))):t}totalInputPositions(t,e){void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length);let i=0;return this._forEachBlocksInRange(t,e,(t,e,a,s)=>{i+=t.totalInputPositions(a,s)}),i}maskedBlock(t){return this.maskedBlocks(t)[0]}maskedBlocks(t){const e=this._maskedBlocks[t];return e?e.map(t=>this._blocks[t]):[]}pad(t){const e=new zn;return this._forEachBlocksInRange(0,this.displayValue.length,i=>e.aggregate(i.pad(t))),e}}Qn.DEFAULTS={...qn.DEFAULTS,lazy:!0,placeholderChar:"_"},Qn.STOP_CHAR="`",Qn.ESCAPE_CHAR="\\",Qn.InputDefinition=Kn,Qn.FixedDefinition=Gn,$n.MaskedPattern=Qn;class Xn extends Qn{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){const{to:e=this.to||0,from:i=this.from||0,maxLength:a=this.maxLength||0,autofix:s=this.autofix,...n}=t;this.to=e,this.from=i,this.maxLength=Math.max(String(e).length,a),this.autofix=s;const r=String(this.from).padStart(this.maxLength,"0"),o=String(this.to).padStart(this.maxLength,"0");let l=0;for(;l<o.length&&o[l]===r[l];)++l;n.mask=o.slice(0,l).replace(/0/g,"\\0")+"0".repeat(this.maxLength-l),super._update(n)}get isComplete(){return super.isComplete&&Boolean(this.value)}boundaries(t){let e="",i="";const[,a,s]=t.match(/^(\D*)(\d*)(\D*)/)||[];return s&&(e="0".repeat(a.length)+s,i="9".repeat(a.length)+s),e=e.padEnd(this.maxLength,"0"),i=i.padEnd(this.maxLength,"9"),[e,i]}doPrepareChar(t,e){let i;return void 0===e&&(e={}),[t,i]=super.doPrepareChar(t.replace(/\D/g,""),e),t||(i.skip=!this.isComplete),[t,i]}_appendCharRaw(t,e){if(void 0===e&&(e={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(t,e);const i=String(this.from).padStart(this.maxLength,"0"),a=String(this.to).padStart(this.maxLength,"0"),[s,n]=this.boundaries(this.value+t);return Number(n)<this.from?super._appendCharRaw(i[this.value.length],e):Number(s)>this.to?!e.tail&&"pad"===this.autofix&&this.value.length+1<this.maxLength?super._appendCharRaw(i[this.value.length],e).aggregate(this._appendCharRaw(t,e)):super._appendCharRaw(a[this.value.length],e):super._appendCharRaw(t,e)}doValidate(t){const e=this.value;if(-1===e.search(/[^0]/)&&e.length<=this._matchFrom)return!0;const[i,a]=this.boundaries(e);return this.from<=Number(a)&&Number(i)<=this.to&&super.doValidate(t)}pad(t){const e=new zn;if(this.value.length===this.maxLength)return e;const i=this.value,a=this.maxLength-this.value.length;if(a){this.reset();for(let i=0;i<a;++i)e.aggregate(super._appendCharRaw("0",t));i.split("").forEach(t=>this._appendCharRaw(t))}return e}}$n.MaskedRange=Xn;class Jn extends Qn{static extractPatternOptions(t){const{mask:e,pattern:i,...a}=t;return{...a,mask:kn(e)?e:i}}constructor(t){super(Jn.extractPatternOptions({...Jn.DEFAULTS,...t}))}updateOptions(t){super.updateOptions(t)}_update(t){const{mask:e,pattern:i,blocks:a,...s}={...Jn.DEFAULTS,...t},n=Object.assign({},Jn.GET_DEFAULT_BLOCKS());t.min&&(n.Y.from=t.min.getFullYear()),t.max&&(n.Y.to=t.max.getFullYear()),t.min&&t.max&&n.Y.from===n.Y.to&&(n.m.from=t.min.getMonth()+1,n.m.to=t.max.getMonth()+1,n.m.from===n.m.to&&(n.d.from=t.min.getDate(),n.d.to=t.max.getDate())),Object.assign(n,this.blocks,a),super._update({...s,mask:kn(e)?e:i,blocks:n})}doValidate(t){const e=this.date;return super.doValidate(t)&&(!this.isComplete||this.isDateExist(this.value)&&null!=e&&(null==this.min||this.min<=e)&&(null==this.max||e<=this.max))}isDateExist(t){return this.format(this.parse(t,this),this).indexOf(t)>=0}get date(){return this.typedValue}set date(t){this.typedValue=t}get typedValue(){return this.isComplete?super.typedValue:null}set typedValue(t){super.typedValue=t}maskEquals(t){return t===Date||super.maskEquals(t)}optionsIsChanged(t){return super.optionsIsChanged(Jn.extractPatternOptions(t))}}Jn.GET_DEFAULT_BLOCKS=()=>({d:{mask:Xn,from:1,to:31,maxLength:2},m:{mask:Xn,from:1,to:12,maxLength:2},Y:{mask:Xn,from:1900,to:9999}}),Jn.DEFAULTS={...Qn.DEFAULTS,mask:Date,pattern:"d{.}`m{.}`Y",format:(t,e)=>{if(!t)return"";return[String(t.getDate()).padStart(2,"0"),String(t.getMonth()+1).padStart(2,"0"),t.getFullYear()].join(".")},parse:(t,e)=>{const[i,a,s]=t.split(".").map(Number);return new Date(s,a-1,i)}},$n.MaskedDate=Jn;class tr extends qn{constructor(t){super({...tr.DEFAULTS,...t}),this.currentMask=void 0}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),"mask"in t&&(this.exposeMask=void 0,this.compiledMasks=Array.isArray(t.mask)?t.mask.map(t=>{const{expose:e,...i}=In(t),a=Pn({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...i});return e&&(this.exposeMask=a),a}):[])}_appendCharRaw(t,e){void 0===e&&(e={});const i=this._applyDispatch(t,e);return this.currentMask&&i.aggregate(this.currentMask._appendChar(t,this.currentMaskFlags(e))),i}_applyDispatch(t,e,i){void 0===t&&(t=""),void 0===e&&(e={}),void 0===i&&(i="");const a=e.tail&&null!=e._beforeTailState?e._beforeTailState._value:this.value,s=this.rawInputValue,n=e.tail&&null!=e._beforeTailState?e._beforeTailState._rawInputValue:s,r=s.slice(n.length),o=this.currentMask,l=new zn,c=null==o?void 0:o.state;return this.currentMask=this.doDispatch(t,{...e},i),this.currentMask&&(this.currentMask!==o?(this.currentMask.reset(),n&&(this.currentMask.append(n,{raw:!0}),l.tailShift=this.currentMask.value.length-a.length),r&&(l.tailShift+=this.currentMask.append(r,{raw:!0,tail:!0}).tailShift)):c&&(this.currentMask.state=c)),l}_appendPlaceholder(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendPlaceholder()),t}_appendEager(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendEager()),t}appendTail(t){const e=new zn;return t&&e.aggregate(this._applyDispatch("",{},t)),e.aggregate(this.currentMask?this.currentMask.appendTail(t):super.appendTail(t))}currentMaskFlags(t){var e,i;return{...t,_beforeTailState:(null==(e=t._beforeTailState)?void 0:e.currentMaskRef)===this.currentMask&&(null==(i=t._beforeTailState)?void 0:i.currentMask)||t._beforeTailState}}doDispatch(t,e,i){return void 0===e&&(e={}),void 0===i&&(i=""),this.dispatch(t,this,e,i)}doValidate(t){return super.doValidate(t)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(t)))}doPrepare(t,e){void 0===e&&(e={});let[i,a]=super.doPrepare(t,e);if(this.currentMask){let t;[i,t]=super.doPrepare(i,this.currentMaskFlags(e)),a=a.aggregate(t)}return[i,a]}doPrepareChar(t,e){void 0===e&&(e={});let[i,a]=super.doPrepareChar(t,e);if(this.currentMask){let t;[i,t]=super.doPrepareChar(i,this.currentMaskFlags(e)),a=a.aggregate(t)}return[i,a]}reset(){var t;null==(t=this.currentMask)||t.reset(),this.compiledMasks.forEach(t=>t.reset())}get value(){return this.exposeMask?this.exposeMask.value:this.currentMask?this.currentMask.value:""}set value(t){this.exposeMask?(this.exposeMask.value=t,this.currentMask=this.exposeMask,this._applyDispatch()):super.value=t}get unmaskedValue(){return this.exposeMask?this.exposeMask.unmaskedValue:this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(t){this.exposeMask?(this.exposeMask.unmaskedValue=t,this.currentMask=this.exposeMask,this._applyDispatch()):super.unmaskedValue=t}get typedValue(){return this.exposeMask?this.exposeMask.typedValue:this.currentMask?this.currentMask.typedValue:""}set typedValue(t){if(this.exposeMask)return this.exposeMask.typedValue=t,this.currentMask=this.exposeMask,void this._applyDispatch();let e=String(t);this.currentMask&&(this.currentMask.typedValue=t,e=this.currentMask.unmaskedValue),this.unmaskedValue=e}get displayValue(){return this.currentMask?this.currentMask.displayValue:""}get isComplete(){var t;return Boolean(null==(t=this.currentMask)?void 0:t.isComplete)}get isFilled(){var t;return Boolean(null==(t=this.currentMask)?void 0:t.isFilled)}remove(t,e){const i=new zn;return this.currentMask&&i.aggregate(this.currentMask.remove(t,e)).aggregate(this._applyDispatch()),i}get state(){var t;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map(t=>t.state),currentMaskRef:this.currentMask,currentMask:null==(t=this.currentMask)?void 0:t.state}}set state(t){const{compiledMasks:e,currentMaskRef:i,currentMask:a,...s}=t;e&&this.compiledMasks.forEach((t,i)=>t.state=e[i]),null!=i&&(this.currentMask=i,this.currentMask.state=a),super.state=s}extractInput(t,e,i){return this.currentMask?this.currentMask.extractInput(t,e,i):""}extractTail(t,e){return this.currentMask?this.currentMask.extractTail(t,e):super.extractTail(t,e)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(t,e){return this.currentMask?this.currentMask.nearestInputPos(t,e):super.nearestInputPos(t,e)}get overwrite(){return this.currentMask?this.currentMask.overwrite:this._overwrite}set overwrite(t){this._overwrite=t}get eager(){return this.currentMask?this.currentMask.eager:this._eager}set eager(t){this._eager=t}get skipInvalid(){return this.currentMask?this.currentMask.skipInvalid:this._skipInvalid}set skipInvalid(t){this._skipInvalid=t}get autofix(){return this.currentMask?this.currentMask.autofix:this._autofix}set autofix(t){this._autofix=t}maskEquals(t){return Array.isArray(t)?this.compiledMasks.every((e,i)=>{if(!t[i])return;const{mask:a,...s}=t[i];return Fn(e,s)&&e.maskEquals(a)}):super.maskEquals(t)}typedValueEquals(t){var e;return Boolean(null==(e=this.currentMask)?void 0:e.typedValueEquals(t))}}tr.DEFAULTS={...qn.DEFAULTS,dispatch:(t,e,i,a)=>{if(!e.compiledMasks.length)return;const s=e.rawInputValue,n=e.compiledMasks.map((n,r)=>{const o=e.currentMask===n,l=o?n.displayValue.length:n.nearestInputPos(n.displayValue.length,Dn);return n.rawInputValue!==s?(n.reset(),n.append(s,{raw:!0})):o||n.remove(l),n.append(t,e.currentMaskFlags(i)),n.appendTail(a),{index:r,weight:n.rawInputValue.length,totalInputPositions:n.totalInputPositions(0,Math.max(l,n.nearestInputPos(n.displayValue.length,Dn)))}});return n.sort((t,e)=>e.weight-t.weight||e.totalInputPositions-t.totalInputPositions),e.compiledMasks[n[0].index]}},$n.MaskedDynamic=tr;class er extends Qn{constructor(t){super({...er.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){const{enum:e,...i}=t;if(e){const t=e.map(t=>t.length),a=Math.min(...t),s=Math.max(...t)-a;i.mask="*".repeat(a),s&&(i.mask+="["+"*".repeat(s)+"]"),this.enum=e}super._update(i)}_appendCharRaw(t,e){void 0===e&&(e={});const i=Math.min(this.nearestInputPos(0,Bn),this.value.length),a=this.enum.filter(e=>this.matchValue(e,this.unmaskedValue+t,i));if(a.length){1===a.length&&this._forEachBlocksInRange(0,this.value.length,(t,i)=>{const s=a[0][i];i>=this.value.length||s===t.value||(t.reset(),t._appendChar(s,e))});const t=super._appendCharRaw(a[0][this.value.length],e);return 1===a.length&&a[0].slice(this.unmaskedValue.length).split("").forEach(e=>t.aggregate(super._appendCharRaw(e))),t}return new zn({skip:!this.isComplete})}extractTail(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),new Un("",t)}remove(t,e){if(void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),t===e)return new zn;const i=Math.min(super.nearestInputPos(0,Bn),this.value.length);let a;for(a=t;a>=0;--a){if(this.enum.filter(t=>this.matchValue(t,this.value.slice(i,a),i)).length>1)break}const s=super.remove(a,e);return s.tailShift+=a-t,s}get isComplete(){return this.enum.indexOf(this.value)>=0}}er.DEFAULTS={...Qn.DEFAULTS,matchValue:(t,e,i)=>t.indexOf(e,i)===i},$n.MaskedEnum=er;var ir;$n.MaskedFunction=class extends qn{updateOptions(t){super.updateOptions(t)}_update(t){super._update({...t,validate:t.mask})}};class ar extends qn{constructor(t){super({...ar.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),this._updateRegExps()}_updateRegExps(){const t="^"+(this.allowNegative?"[+|\\-]?":""),e=(this.scale?"("+En(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(t+"\\d*"+e),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(En).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(En(this.thousandsSeparator),"g")}_removeThousandsSeparators(t){return t.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(t){const e=t.split(this.radix);return e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),e.join(this.radix)}doPrepareChar(t,e){void 0===e&&(e={});const[i,a]=super.doPrepareChar(this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(e.input&&e.raw||!e.input&&!e.raw)?t.replace(this._mapToRadixRegExp,this.radix):t),e);return t&&!i&&(a.skip=!0),!i||this.allowPositive||this.value||"-"===i||a.aggregate(this._appendChar("-")),[i,a]}_separatorsCount(t,e){void 0===e&&(e=!1);let i=0;for(let a=0;a<t;++a)this._value.indexOf(this.thousandsSeparator,a)===a&&(++i,e&&(t+=this.thousandsSeparator.length));return i}_separatorsCountFromSlice(t){return void 0===t&&(t=this._value),this._separatorsCount(this._removeThousandsSeparators(t).length,!0)}extractInput(t,e,i){return void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),[t,e]=this._adjustRangeWithSeparators(t,e),this._removeThousandsSeparators(super.extractInput(t,e,i))}_appendCharRaw(t,e){void 0===e&&(e={});const i=e.tail&&e._beforeTailState?e._beforeTailState._value:this._value,a=this._separatorsCountFromSlice(i);this._value=this._removeThousandsSeparators(this.value);const s=this._value;this._value+=t;const n=this.number;let r,o=!isNaN(n),l=!1;if(o){let t;null!=this.min&&this.min<0&&this.number<this.min&&(t=this.min),null!=this.max&&this.max>0&&this.number>this.max&&(t=this.max),null!=t&&(this.autofix?(this._value=this.format(t,this).replace(ar.UNMASKED_RADIX,this.radix),l||(l=s===this._value&&!e.tail)):o=!1),o&&(o=Boolean(this._value.match(this._numberRegExp)))}o?r=new zn({inserted:this._value.slice(s.length),rawInserted:l?"":t,skip:l}):(this._value=s,r=new zn),this._value=this._insertThousandsSeparators(this._value);const c=e.tail&&e._beforeTailState?e._beforeTailState._value:this._value,d=this._separatorsCountFromSlice(c);return r.tailShift+=(d-a)*this.thousandsSeparator.length,r}_findSeparatorAround(t){if(this.thousandsSeparator){const e=t-this.thousandsSeparator.length+1,i=this.value.indexOf(this.thousandsSeparator,e);if(i<=t)return i}return-1}_adjustRangeWithSeparators(t,e){const i=this._findSeparatorAround(t);i>=0&&(t=i);const a=this._findSeparatorAround(e);return a>=0&&(e=a+this.thousandsSeparator.length),[t,e]}remove(t,e){void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),[t,e]=this._adjustRangeWithSeparators(t,e);const i=this.value.slice(0,t),a=this.value.slice(e),s=this._separatorsCount(i.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(i+a));const n=this._separatorsCountFromSlice(i);return new zn({tailShift:(n-s)*this.thousandsSeparator.length})}nearestInputPos(t,e){if(!this.thousandsSeparator)return t;switch(e){case Vn:case Sn:case Dn:{const i=this._findSeparatorAround(t-1);if(i>=0){const a=i+this.thousandsSeparator.length;if(t<a||this.value.length<=a||e===Dn)return i}break}case An:case Bn:{const e=this._findSeparatorAround(t);if(e>=0)return e+this.thousandsSeparator.length}}return t}doCommit(){if(this.value){const t=this.number;let e=t;null!=this.min&&(e=Math.max(e,this.min)),null!=this.max&&(e=Math.min(e,this.max)),e!==t&&(this.unmaskedValue=this.format(e,this));let i=this.value;this.normalizeZeros&&(i=this._normalizeZeros(i)),this.padFractionalZeros&&this.scale>0&&(i=this._padFractionalZeros(i)),this._value=i}super.doCommit()}_normalizeZeros(t){const e=this._removeThousandsSeparators(t).split(this.radix);return e[0]=e[0].replace(/^(\D*)(0*)(\d*)/,(t,e,i,a)=>e+a),t.length&&!/\d$/.test(e[0])&&(e[0]=e[0]+"0"),e.length>1&&(e[1]=e[1].replace(/0*$/,""),e[1].length||(e.length=1)),this._insertThousandsSeparators(e.join(this.radix))}_padFractionalZeros(t){if(!t)return t;const e=t.split(this.radix);return e.length<2&&e.push(""),e[1]=e[1].padEnd(this.scale,"0"),e.join(this.radix)}doSkipInvalid(t,e,i){void 0===e&&(e={});const a=0===this.scale&&t!==this.thousandsSeparator&&(t===this.radix||t===ar.UNMASKED_RADIX||this.mapToRadix.includes(t));return super.doSkipInvalid(t,e,i)&&!a}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,ar.UNMASKED_RADIX)}set unmaskedValue(t){super.unmaskedValue=t}get typedValue(){return this.parse(this.unmaskedValue,this)}set typedValue(t){this.rawInputValue=this.format(t,this).replace(ar.UNMASKED_RADIX,this.radix)}get number(){return this.typedValue}set number(t){this.typedValue=t}get allowNegative(){return null!=this.min&&this.min<0||null!=this.max&&this.max<0}get allowPositive(){return null!=this.min&&this.min>0||null!=this.max&&this.max>0}typedValueEquals(t){return(super.typedValueEquals(t)||ar.EMPTY_VALUES.includes(t)&&ar.EMPTY_VALUES.includes(this.typedValue))&&!(0===t&&""===this.value)}}ir=ar,ar.UNMASKED_RADIX=".",ar.EMPTY_VALUES=[...qn.EMPTY_VALUES,0],ar.DEFAULTS={...qn.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[ir.UNMASKED_RADIX],min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,scale:2,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:t=>t.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})},$n.MaskedNumber=ar;const sr={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function nr(t,e,i){void 0===e&&(e=sr.MASKED),void 0===i&&(i=sr.MASKED);const a=Pn(t);return t=>a.runIsolated(a=>(a[e]=t,a[i]))}$n.PIPE_TYPE=sr,$n.createPipe=nr,$n.pipe=function(t,e,i,a){return nr(e,i,a)(t)};$n.RepeatBlock=class extends Qn{get repeatFrom(){var t;return null!=(t=Array.isArray(this.repeat)?this.repeat[0]:this.repeat===1/0?0:this.repeat)?t:0}get repeatTo(){var t;return null!=(t=Array.isArray(this.repeat)?this.repeat[1]:this.repeat)?t:1/0}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){var e,i,a;const{repeat:s,...n}=In(t);this._blockOpts=Object.assign({},this._blockOpts,n);const r=Pn(this._blockOpts);this.repeat=null!=(e=null!=(i=null!=s?s:r.repeat)?i:this.repeat)?e:1/0,super._update({mask:"m".repeat(Math.max(this.repeatTo===1/0&&(null==(a=this._blocks)?void 0:a.length)||0,this.repeatFrom)),blocks:{m:r},eager:r.eager,overwrite:r.overwrite,skipInvalid:r.skipInvalid,lazy:r.lazy,placeholderChar:r.placeholderChar,displayChar:r.displayChar})}_allocateBlock(t){return t<this._blocks.length?this._blocks[t]:this.repeatTo===1/0||this._blocks.length<this.repeatTo?(this._blocks.push(Pn(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]):void 0}_appendCharRaw(t,e){void 0===e&&(e={});const i=new zn;for(let o,l,c=null!=(a=null==(s=this._mapPosToBlock(this.displayValue.length))?void 0:s.index)?a:Math.max(this._blocks.length-1,0);o=null!=(n=this._blocks[c])?n:l=!l&&this._allocateBlock(c);++c){var a,s,n,r;const d=o._appendChar(t,{...e,_beforeTailState:null==(r=e._beforeTailState)||null==(r=r._blocks)?void 0:r[c]});if(d.skip&&l){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(i.aggregate(d),d.consumed)break}return i}_trimEmptyTail(t,e){var i,a;void 0===t&&(t=0);const s=Math.max((null==(i=this._mapPosToBlock(t))?void 0:i.index)||0,this.repeatFrom,0);let n;null!=e&&(n=null==(a=this._mapPosToBlock(e))?void 0:a.index),null==n&&(n=this._blocks.length-1);let r=0;for(let t=n;s<=t&&!this._blocks[t].unmaskedValue;--t,++r);r&&(this._blocks.splice(n-r+1,r),this.mask=this.mask.slice(r))}reset(){super.reset(),this._trimEmptyTail()}remove(t,e){void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length);const i=super.remove(t,e);return this._trimEmptyTail(t,e),i}totalInputPositions(t,e){return void 0===t&&(t=0),null==e&&this.repeatTo===1/0?1/0:super.totalInputPositions(t,e)}get state(){return super.state}set state(t){this._blocks.length=t._blocks.length,this.mask=this.mask.slice(0,this._blocks.length),super.state=t}};try{globalThis.IMask=$n}catch{}var rr=re`.invalid-feedback-container{display:flex;gap:var(--sgds-form-gap-sm)}.invalid-feedback,.invalid-feedback-container{color:var(--sgds-form-danger-color-default);line-height:var(--sgds-line-height-20)}.invalid-feedback{font-size:var(--sgds-font-size-14);font-weight:var(--sgds-font-weight-regular)}.valid-icon{color:var(--sgds-form-success-color-default)}`,or=re`.form-text{color:var(--sgds-form-color-subtle);font-size:var(--sgds-font-size-label-sm);line-height:var(--sgds-line-height-2-xs)}.form-text.disabled{opacity:var(--sgds-opacity-40)}`,lr=re`.form-label{color:var(--sgds-form-color-default);margin-bottom:0}.form-label.disabled{opacity:var(--sgds-opacity-40)}.form-check-label{color:var(--sgds-form-color-default)}.form-check-input:disabled~.form-check-label,.form-check-input[disabled]~.form-check-label{cursor:not-allowed}`,cr=re`.form-control::placeholder{color:var(--sgds-form-color-subtle);font-family:var(--sgds-font-family-brand);font-weight:var(--sgds-font-weight-light);line-height:var(--sgds-line-height-24)}`;class dr extends Cs{constructor(){super(...arguments),this.label="",this.hintText="",this.disabled=!1,this.invalid=!1,this._controlId=ks("input"),this._labelId=ks("label")}setInvalid(t){this.invalid=t,t?this.emit("sgds-invalid"):this.emit("sgds-valid")}}dr.styles=[...Cs.styles,rr,or,lr,cr],t([Zi({reflect:!0})],dr.prototype,"label",void 0),t([Zi({reflect:!0})],dr.prototype,"hintText",void 0),t([Zi({reflect:!0})],dr.prototype,"name",void 0),t([Zi({type:Boolean,reflect:!0})],dr.prototype,"disabled",void 0),t([Zi({type:Boolean,reflect:!0})],dr.prototype,"invalid",void 0);var hr=re`.form-control-container{display:flex;flex-direction:column;gap:var(--sgds-form-gap-md)}.m-width-160{min-width:var(--sgds-dimension-160)}.m-width-256{min-width:var(--sgds-dimension-256)}.form-label{color:var(--sgds-form-color-default);font-size:var(--sgds-font-size-label-md)}.form-control-group{align-items:center;background-color:var(--sgds-form-surface-default);border:var(--sgds-form-border-width-default) solid var(--sgds-border-color-default);border-radius:var(--input-border-radius,var(--sgds-form-border-radius-md));display:flex;gap:var(--sgds-form-gap-md);height:var(--sgds-dimension-48);justify-content:center;overflow:hidden;padding:0 var(--sgds-form-padding-x);transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out;width:-webkit-fill-available;width:-moz-available}.form-control{appearance:none;background-clip:padding-box;background:none;border:none;color:var(--sgds-form-color-default);display:block;flex-grow:1;font-size:var(--sgds-font-size-label-md);line-height:var(--sgds-line-height-xs);min-width:0;outline:none;padding:0;width:100%}.form-clearable{color:var(--sgds-color-subtle);cursor:pointer}@media (prefers-reduced-motion:reduce){.form-control-group{transition:none}}.form-control-group:not(.disabled):not(.is-invalid):not(.readonly):not(:focus-within):hover{outline:var(--sgds-form-border-width-thick) solid var(--sgds-border-color-emphasis);outline-offset:var(--sgds-form-outline-offset-focus)}.form-control-group:not(.disabled):not(.is-invalid):focus-within{outline:var(--sgds-form-outline-focus);outline-offset:var(--sgds-form-outline-offset-focus)}.form-control-container.disabled{opacity:var(--sgds-opacity-40)}.form-control-group.disabled{background-color:var(--sgds-form-surface-muted);cursor:not-allowed}.form-control-group.readonly{background-color:var(--sgds-form-surface-raised)}.form-control-group.is-invalid:not(.disabled){border:var(--sgds-form-border-width-default) solid var(--sgds-form-danger-border-color-default)}.form-control-group:not(.disabled).is-invalid:focus-within{outline:var(--sgds-border-width-2) solid var(--sgds-form-danger-color-default);outline-offset:var(--sgds-form-outline-offset-focus)}`;const ur=(t="value")=>(e,i)=>{const a=e.constructor,s=a.prototype.attributeChangedCallback;a.prototype.attributeChangedCallback=function(e,n,r){var o;const l=a.getPropertyOptions(t);if(e===("string"==typeof l.attribute?l.attribute:t).toLowerCase()){const e=l.converter||xe,a=("function"==typeof e?e:null!==(o=null==e?void 0:e.fromAttribute)&&void 0!==o?o:xe.fromAttribute)(r,l.type);this[t]!==a&&(this[i]=a)}s.call(this,e,n,r)}};class pr{constructor(t,e){(this.host=t).addController(this),this._internals=t._internals||this.host.attachInternals(),this.options=Object.assign({setInvalid:(t,e)=>{t.invalid=e},value:t=>t.value,input:t=>t.input},e)}hostConnected(){this.host.addEventListener("invalid",t=>this.handleInvalid(t))}hostDisconnected(){this.host.removeEventListener("invalid",t=>this.handleInvalid(t))}handleInvalid(t){t.preventDefault(),this.options.setInvalid(this.host,!0)}handleInput(t){const e=t.target;this.options.setInvalid(this.host,!1),this.validateInput(e)}handleChange(t){const e=t.target;this.validateInput(e),this.options.setInvalid(this.host,!this.checkValidity())}get form(){return this._internals.form}get validity(){return this._internals.validity}get validationMessage(){return this._internals.validationMessage}get willValidate(){return this._internals.willValidate}updateInvalidState(){this.options.setInvalid(this.host,!this.checkValidity())}resetValidity(){return this._internals.setValidity({})}checkValidity(){return this._internals.checkValidity()}reportValidity(){return this._internals.reportValidity()}setValidity(t,e,i){return this._internals.setValidity(t,e,i)}setFormValue(){const t=this.options.value(this.host);this._internals.setFormValue(t)}validateInput(t){if(this.options.input(this.host).disabled)return this._internals.setValidity({});const e=t.validity;if(e.valid)this._internals.setValidity({});else for(const i in e)e[i]&&(this.validationError=i.toString(),this._internals.setValidity({[this.validationError]:!0},t.validationMessage,t))}}const gr=e=>{class i extends e{constructor(...t){super(...t),this._isTouched=!1,this._internals=this.attachInternals()}connectedCallback(){var t;super.connectedCallback(),this._mixinShouldSkipSgdsValidation()||null!==(t=this.inputValidationController)&&void 0!==t||(this.inputValidationController=new pr(this))}async firstUpdated(t){super.firstUpdated(t),this.input=this.shadowRoot.querySelector("input")||await this.sgdsInput||this.shadowRoot.querySelector("textarea")||await this.sgdsDatepickerInput,this._mixinSetFormValue(),this._mixinShouldSkipSgdsValidation()||this._mixinValidate(this.input)}formResetCallback(){this._mixinResetFormControl?this._mixinResetFormControl():(this.value=this.defaultValue,this._mixinResetValidity(this.input)),this._mixinSetFormValue()}_mixinHandleChange(t){this._mixinSetFormValue(),this._mixinShouldSkipSgdsValidation()||this.inputValidationController.handleChange(t)}_mixinHandleInputChange(t){this._mixinSetFormValue(),this._mixinShouldSkipSgdsValidation()||this.inputValidationController.handleInput(t)}_mixinResetValidity(t){this._mixinShouldSkipSgdsValidation()||(this.inputValidationController.resetValidity(),this.inputValidationController.updateInvalidState(),this.inputValidationController.validateInput(t),this._isTouched&&(this._isTouched=!1))}_mixinValidate(t){this._mixinShouldSkipSgdsValidation()||this.inputValidationController.validateInput(t)}_mixinSetFormValue(){const t=this.value;this._internals.setFormValue(t)}_mixinCheckValidity(){return!!this._mixinShouldSkipSgdsValidation()||this.inputValidationController.checkValidity()}_mixinReportValidity(){return!!this._mixinShouldSkipSgdsValidation()||this.inputValidationController.reportValidity()}_mixinGetValidity(){return this._internals.validity}_mixinGetValidationMessage(){return this._internals.validationMessage}_mixinSetValidity(t,e,i){if(!this._mixinShouldSkipSgdsValidation())return this.inputValidationController.setValidity(t,e,i)}_mixinShouldSkipSgdsValidation(){const t=this.closest("form");return(null==t?void 0:t.noValidate)||this.noValidate}}return i.formAssociated=!0,t([Bi("sgds-input")],i.prototype,"sgdsInput",void 0),t([Bi("sgds-datepicker-input")],i.prototype,"sgdsDatepickerInput",void 0),i};var vr=re`:host{--input-border-radius:var(--sgds-form-border-radius-md);--input-min-width:var(--sgds-dimension-160)}.form-control-container{min-width:var(--input-min-width)}:host(.quantity-toggle) input::-webkit-inner-spin-button{appearance:none;margin:0}:host(.quantity-toggle) input{text-align:center}.form-control-prefix,.form-control-suffix{color:var(--sgds-form-color-subtle);display:flex;flex-wrap:wrap;gap:var(--sgds-gap-xs)}.form-control-group.quantity-toggle{padding:0}sgds-icon[role=button]{cursor:pointer}sgds-icon[role=button]:focus,sgds-icon[role=button]:focus-visible{outline:var(--sgds-form-outline-focus)}.form-control-row{align-items:center;display:flex;gap:var(--sgds-gap-sm)}`;class fr extends(gr(dr)){constructor(){super(...arguments),this.type="text",this.placeholder="placeholder",this.autofocus=!1,this.readonly=!1,this.defaultValue="",this.valid=!1,this.loading=!1,this.required=!1,this.noValidate=!1,this.value="",this._isTouched=!1,this._showPassword=!1}focus(t){this.input.focus(t)}blur(){this.input.blur()}reportValidity(){return this._mixinReportValidity()}checkValidity(){return this._mixinCheckValidity()}setValidity(t,e,i){return this._mixinSetValidity(t,e,i)}get validity(){return this._mixinGetValidity()}get validationMessage(){return this._mixinGetValidationMessage()}_handleFocus(){this.emit("sgds-focus")}_handleBlur(){const t=this.emit("sgds-blur",{cancelable:!0});this._mixinShouldSkipSgdsValidation()||t.defaultPrevented||(this.setInvalid(!this._mixinCheckValidity()),this._isTouched=!0)}_handleClick(){this.focus()}_handleChange(t){this.value=this.input.value;this.emit("sgds-change",{cancelable:!0}).defaultPrevented||super._mixinHandleChange(t)}_handleInputChange(t){this.value=this.input.value;this.emit("sgds-input",{cancelable:!0}).defaultPrevented||super._mixinHandleInputChange(t)}_handleIsTouched(){this._mixinShouldSkipSgdsValidation()||this._isTouched&&this.setInvalid(!this._mixinCheckValidity())}_handleDisabledChange(){this.setInvalid(!1)}_renderInput(){const t="both"===this.hasFeedback||"style"===this.hasFeedback;return Is`
2451
+ `}}_n.styles=[xn],_n.dependencies={"sgds-icon":vn,"sgds-icon-button":bn,"sgds-button":Us},t([Zi({attribute:!1})],_n.prototype,"displayDate",void 0),t([Zi({attribute:!1})],_n.prototype,"focusedDate",void 0),t([Zi({attribute:!1})],_n.prototype,"selectedDate",void 0),t([Zi()],_n.prototype,"view",void 0),t([Zi()],_n.prototype,"focusedTabIndex",void 0),t([As("focusedTabIndex",{waitUntilFirstUpdate:!0})],_n.prototype,"_handleFocusedTabIndexChange",null);const Cn=["January","February","March","April","May","June","July","August","September","October","November","December"];function kn(t){return"string"==typeof t||t instanceof String}function Mn(t){var e;return"object"==typeof t&&null!=t&&"Object"===(null==t||null==(e=t.constructor)?void 0:e.name)}function Zn(t,e){return Array.isArray(e)?Zn(t,(t,i)=>e.includes(i)):Object.entries(t).reduce((t,i)=>{let[a,s]=i;return e(s,a)&&(t[a]=s),t},{})}const Vn="NONE",Sn="LEFT",Dn="FORCE_LEFT",An="RIGHT",Bn="FORCE_RIGHT";function En(t){return t.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function Fn(t,e){if(e===t)return!0;const i=Array.isArray(e),a=Array.isArray(t);let s;if(i&&a){if(e.length!=t.length)return!1;for(s=0;s<e.length;s++)if(!Fn(e[s],t[s]))return!1;return!0}if(i!=a)return!1;if(e&&t&&"object"==typeof e&&"object"==typeof t){const i=e instanceof Date,a=t instanceof Date;if(i&&a)return e.getTime()==t.getTime();if(i!=a)return!1;const n=e instanceof RegExp,r=t instanceof RegExp;if(n&&r)return e.toString()==t.toString();if(n!=r)return!1;const o=Object.keys(e);for(s=0;s<o.length;s++)if(!Object.prototype.hasOwnProperty.call(t,o[s]))return!1;for(s=0;s<o.length;s++)if(!Fn(t[o[s]],e[o[s]]))return!1;return!0}return!(!e||!t||"function"!=typeof e||"function"!=typeof t)&&e.toString()===t.toString()}class Hn{constructor(t){for(Object.assign(this,t);this.value.slice(0,this.startChangePos)!==this.oldValue.slice(0,this.startChangePos);)--this.oldSelection.start;if(this.insertedCount)for(;this.value.slice(this.cursorPos)!==this.oldValue.slice(this.oldSelection.end);)this.value.length-this.cursorPos<this.oldValue.length-this.oldSelection.end?++this.oldSelection.end:++this.cursorPos}get startChangePos(){return Math.min(this.cursorPos,this.oldSelection.start)}get insertedCount(){return this.cursorPos-this.startChangePos}get inserted(){return this.value.substr(this.startChangePos,this.insertedCount)}get removedCount(){return Math.max(this.oldSelection.end-this.startChangePos||this.oldValue.length-this.value.length,0)}get removed(){return this.oldValue.substr(this.startChangePos,this.removedCount)}get head(){return this.value.substring(0,this.startChangePos)}get tail(){return this.value.substring(this.startChangePos+this.insertedCount)}get removeDirection(){return!this.removedCount||this.insertedCount?Vn:this.oldSelection.end!==this.cursorPos&&this.oldSelection.start!==this.cursorPos||this.oldSelection.end!==this.oldSelection.start?Sn:An}}function $n(t,e){return new $n.InputMask(t,e)}function Tn(t){if(null==t)throw new Error("mask property should be defined");return t instanceof RegExp?$n.MaskedRegExp:kn(t)?$n.MaskedPattern:t===Date?$n.MaskedDate:t===Number?$n.MaskedNumber:Array.isArray(t)||t===Array?$n.MaskedDynamic:$n.Masked&&t.prototype instanceof $n.Masked?t:$n.Masked&&t instanceof $n.Masked?t.constructor:t instanceof Function?$n.MaskedFunction:(console.warn("Mask not found for mask",t),$n.Masked)}function In(t){if(!t)throw new Error("Options in not defined");if($n.Masked){if(t.prototype instanceof $n.Masked)return{mask:t};const{mask:e,...i}=t instanceof $n.Masked?{mask:t}:Mn(t)&&t.mask instanceof $n.Masked?t:{};if(e){const t=e.mask;return{...Zn(e,(t,e)=>!e.startsWith("_")),mask:e.constructor,_mask:t,...i}}}return Mn(t)?{...t}:{mask:t}}function Pn(t){if($n.Masked&&t instanceof $n.Masked)return t;const e=In(t),i=Tn(e.mask);if(!i)throw new Error("Masked class is not found for provided mask "+e.mask+", appropriate module needs to be imported manually before creating mask.");return e.mask===i&&delete e.mask,e._mask&&(e.mask=e._mask,delete e._mask),new i(e)}$n.createMask=Pn;class Ln{get selectionStart(){let t;try{t=this._unsafeSelectionStart}catch{}return null!=t?t:this.value.length}get selectionEnd(){let t;try{t=this._unsafeSelectionEnd}catch{}return null!=t?t:this.value.length}select(t,e){if(null!=t&&null!=e&&(t!==this.selectionStart||e!==this.selectionEnd))try{this._unsafeSelect(t,e)}catch{}}get isActive(){return!1}}$n.MaskElement=Ln;class Rn extends Ln{constructor(t){super(),this.input=t,this._onKeydown=this._onKeydown.bind(this),this._onInput=this._onInput.bind(this),this._onBeforeinput=this._onBeforeinput.bind(this),this._onCompositionEnd=this._onCompositionEnd.bind(this)}get rootElement(){var t,e,i;return null!=(t=null==(e=(i=this.input).getRootNode)?void 0:e.call(i))?t:document}get isActive(){return this.input===this.rootElement.activeElement}bindEvents(t){this.input.addEventListener("keydown",this._onKeydown),this.input.addEventListener("input",this._onInput),this.input.addEventListener("beforeinput",this._onBeforeinput),this.input.addEventListener("compositionend",this._onCompositionEnd),this.input.addEventListener("drop",t.drop),this.input.addEventListener("click",t.click),this.input.addEventListener("focus",t.focus),this.input.addEventListener("blur",t.commit),this._handlers=t}_onKeydown(t){return this._handlers.redo&&(90===t.keyCode&&t.shiftKey&&(t.metaKey||t.ctrlKey)||89===t.keyCode&&t.ctrlKey)?(t.preventDefault(),this._handlers.redo(t)):this._handlers.undo&&90===t.keyCode&&(t.metaKey||t.ctrlKey)?(t.preventDefault(),this._handlers.undo(t)):void(t.isComposing||this._handlers.selectionChange(t))}_onBeforeinput(t){return"historyUndo"===t.inputType&&this._handlers.undo?(t.preventDefault(),this._handlers.undo(t)):"historyRedo"===t.inputType&&this._handlers.redo?(t.preventDefault(),this._handlers.redo(t)):void 0}_onCompositionEnd(t){this._handlers.input(t)}_onInput(t){t.isComposing||this._handlers.input(t)}unbindEvents(){this.input.removeEventListener("keydown",this._onKeydown),this.input.removeEventListener("input",this._onInput),this.input.removeEventListener("beforeinput",this._onBeforeinput),this.input.removeEventListener("compositionend",this._onCompositionEnd),this.input.removeEventListener("drop",this._handlers.drop),this.input.removeEventListener("click",this._handlers.click),this.input.removeEventListener("focus",this._handlers.focus),this.input.removeEventListener("blur",this._handlers.commit),this._handlers={}}}$n.HTMLMaskElement=Rn;class On extends Rn{constructor(t){super(t),this.input=t}get _unsafeSelectionStart(){return null!=this.input.selectionStart?this.input.selectionStart:this.value.length}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(t,e){this.input.setSelectionRange(t,e)}get value(){return this.input.value}set value(t){this.input.value=t}}$n.HTMLMaskElement=Rn;class Yn extends Rn{get _unsafeSelectionStart(){const t=this.rootElement,e=t.getSelection&&t.getSelection(),i=e&&e.anchorOffset,a=e&&e.focusOffset;return null==a||null==i||i<a?i:a}get _unsafeSelectionEnd(){const t=this.rootElement,e=t.getSelection&&t.getSelection(),i=e&&e.anchorOffset,a=e&&e.focusOffset;return null==a||null==i||i>a?i:a}_unsafeSelect(t,e){if(!this.rootElement.createRange)return;const i=this.rootElement.createRange();i.setStart(this.input.firstChild||this.input,t),i.setEnd(this.input.lastChild||this.input,e);const a=this.rootElement,s=a.getSelection&&a.getSelection();s&&(s.removeAllRanges(),s.addRange(i))}get value(){return this.input.textContent||""}set value(t){this.input.textContent=t}}$n.HTMLContenteditableMaskElement=Yn;class Nn{constructor(){this.states=[],this.currentIndex=0}get currentState(){return this.states[this.currentIndex]}get isEmpty(){return 0===this.states.length}push(t){this.currentIndex<this.states.length-1&&(this.states.length=this.currentIndex+1),this.states.push(t),this.states.length>Nn.MAX_LENGTH&&this.states.shift(),this.currentIndex=this.states.length-1}go(t){return this.currentIndex=Math.min(Math.max(this.currentIndex+t,0),this.states.length-1),this.currentState}undo(){return this.go(-1)}redo(){return this.go(1)}clear(){this.states.length=0,this.currentIndex=0}}Nn.MAX_LENGTH=100;$n.InputMask=class{constructor(t,e){this.el=t instanceof Ln?t:t.isContentEditable&&"INPUT"!==t.tagName&&"TEXTAREA"!==t.tagName?new Yn(t):new On(t),this.masked=Pn(e),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new Nn,this._saveSelection=this._saveSelection.bind(this),this._onInput=this._onInput.bind(this),this._onChange=this._onChange.bind(this),this._onDrop=this._onDrop.bind(this),this._onFocus=this._onFocus.bind(this),this._onClick=this._onClick.bind(this),this._onUndo=this._onUndo.bind(this),this._onRedo=this._onRedo.bind(this),this.alignCursor=this.alignCursor.bind(this),this.alignCursorFriendly=this.alignCursorFriendly.bind(this),this._bindEvents(),this.updateValue(),this._onChange()}maskEquals(t){var e;return null==t||(null==(e=this.masked)?void 0:e.maskEquals(t))}get mask(){return this.masked.mask}set mask(t){if(this.maskEquals(t))return;if(!(t instanceof $n.Masked)&&this.masked.constructor===Tn(t))return void this.masked.updateOptions({mask:t});const e=t instanceof $n.Masked?t:Pn({mask:t});e.unmaskedValue=this.masked.unmaskedValue,this.masked=e}get value(){return this._value}set value(t){this.value!==t&&(this.masked.value=t,this.updateControl("auto"))}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(t){this.unmaskedValue!==t&&(this.masked.unmaskedValue=t,this.updateControl("auto"))}get rawInputValue(){return this._rawInputValue}set rawInputValue(t){this.rawInputValue!==t&&(this.masked.rawInputValue=t,this.updateControl(),this.alignCursor())}get typedValue(){return this.masked.typedValue}set typedValue(t){this.masked.typedValueEquals(t)||(this.masked.typedValue=t,this.updateControl("auto"))}get displayValue(){return this.masked.displayValue}_bindEvents(){this.el.bindEvents({selectionChange:this._saveSelection,input:this._onInput,drop:this._onDrop,click:this._onClick,focus:this._onFocus,commit:this._onChange,undo:this._onUndo,redo:this._onRedo})}_unbindEvents(){this.el&&this.el.unbindEvents()}_fireEvent(t,e){const i=this._listeners[t];i&&i.forEach(t=>t(e))}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(t){this.el&&this.el.isActive&&(this.el.select(t,t),this._saveSelection())}_saveSelection(){this.displayValue!==this.el.value&&console.warn("Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly."),this._selection={start:this.selectionStart,end:this.cursorPos}}updateValue(){this.masked.value=this.el.value,this._value=this.masked.value,this._unmaskedValue=this.masked.unmaskedValue,this._rawInputValue=this.masked.rawInputValue}updateControl(t){const e=this.masked.unmaskedValue,i=this.masked.value,a=this.masked.rawInputValue,s=this.displayValue,n=this.unmaskedValue!==e||this.value!==i||this._rawInputValue!==a;this._unmaskedValue=e,this._value=i,this._rawInputValue=a,this.el.value!==s&&(this.el.value=s),"auto"===t?this.alignCursor():null!=t&&(this.cursorPos=t),n&&this._fireChangeEvents(),this._historyChanging||!n&&!this.history.isEmpty||this.history.push({unmaskedValue:e,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(t){const{mask:e,...i}=t,a=!this.maskEquals(e),s=this.masked.optionsIsChanged(i);a&&(this.mask=e),s&&this.masked.updateOptions(i),(a||s)&&this.updateControl()}updateCursor(t){null!=t&&(this.cursorPos=t,this._delayUpdateCursor(t))}_delayUpdateCursor(t){this._abortUpdateCursor(),this._changingCursorPos=t,this._cursorChanging=setTimeout(()=>{this.el&&(this.cursorPos=this._changingCursorPos,this._abortUpdateCursor())},10)}_fireChangeEvents(){this._fireEvent("accept",this._inputEvent),this.masked.isComplete&&this._fireEvent("complete",this._inputEvent)}_abortUpdateCursor(){this._cursorChanging&&(clearTimeout(this._cursorChanging),delete this._cursorChanging)}alignCursor(){this.cursorPos=this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos,Sn))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(t,e){return this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].push(e),this}off(t,e){if(!this._listeners[t])return this;if(!e)return delete this._listeners[t],this;const i=this._listeners[t].indexOf(e);return i>=0&&this._listeners[t].splice(i,1),this}_onInput(t){this._inputEvent=t,this._abortUpdateCursor();const e=new Hn({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),i=this.masked.rawInputValue,a=this.masked.splice(e.startChangePos,e.removed.length,e.inserted,e.removeDirection,{input:!0,raw:!0}).offset,s=i===this.masked.rawInputValue?e.removeDirection:Vn;let n=this.masked.nearestInputPos(e.startChangePos+a,s);s!==Vn&&(n=this.masked.nearestInputPos(n,Vn)),this.updateControl(n),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(t){t.preventDefault(),t.stopPropagation()}_onFocus(t){this.alignCursorFriendly()}_onClick(t){this.alignCursorFriendly()}_onUndo(){this._applyHistoryState(this.history.undo())}_onRedo(){this._applyHistoryState(this.history.redo())}_applyHistoryState(t){t&&(this._historyChanging=!0,this.unmaskedValue=t.unmaskedValue,this.el.select(t.selection.start,t.selection.end),this._saveSelection(),this._historyChanging=!1)}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}};class zn{static normalize(t){return Array.isArray(t)?t:[t,new zn]}constructor(t){Object.assign(this,{inserted:"",rawInserted:"",tailShift:0,skip:!1},t)}aggregate(t){return this.inserted+=t.inserted,this.rawInserted+=t.rawInserted,this.tailShift+=t.tailShift,this.skip=this.skip||t.skip,this}get offset(){return this.tailShift+this.inserted.length}get consumed(){return Boolean(this.rawInserted)||this.skip}equals(t){return this.inserted===t.inserted&&this.tailShift===t.tailShift&&this.rawInserted===t.rawInserted&&this.skip===t.skip}}$n.ChangeDetails=zn;class Un{constructor(t,e,i){void 0===t&&(t=""),void 0===e&&(e=0),this.value=t,this.from=e,this.stop=i}toString(){return this.value}extend(t){this.value+=String(t)}appendTo(t){return t.append(this.toString(),{tail:!0}).aggregate(t._appendPlaceholder())}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(t){Object.assign(this,t)}unshift(t){if(!this.value.length||null!=t&&this.from>=t)return"";const e=this.value[0];return this.value=this.value.slice(1),e}shift(){if(!this.value.length)return"";const t=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),t}}class qn{constructor(t){this._value="",this._update({...qn.DEFAULTS,...t}),this._initialized=!0}updateOptions(t){this.optionsIsChanged(t)&&this.withValueRefresh(this._update.bind(this,t))}_update(t){Object.assign(this,t)}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue}}set state(t){this._value=t._value}reset(){this._value=""}get value(){return this._value}set value(t){this.resolve(t,{input:!0})}resolve(t,e){void 0===e&&(e={input:!0}),this.reset(),this.append(t,e,""),this.doCommit()}get unmaskedValue(){return this.value}set unmaskedValue(t){this.resolve(t,{})}get typedValue(){return this.parse?this.parse(this.value,this):this.unmaskedValue}set typedValue(t){this.format?this.value=this.format(t,this):this.unmaskedValue=String(t)}get rawInputValue(){return this.extractInput(0,this.displayValue.length,{raw:!0})}set rawInputValue(t){this.resolve(t,{raw:!0})}get displayValue(){return this.value}get isComplete(){return!0}get isFilled(){return this.isComplete}nearestInputPos(t,e){return t}totalInputPositions(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),Math.min(this.displayValue.length,e-t)}extractInput(t,e,i){return void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),this.displayValue.slice(t,e)}extractTail(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),new Un(this.extractInput(t,e),t)}appendTail(t){return kn(t)&&(t=new Un(String(t))),t.appendTo(this)}_appendCharRaw(t,e){return t?(this._value+=t,new zn({inserted:t,rawInserted:t})):new zn}_appendChar(t,e,i){void 0===e&&(e={});const a=this.state;let s;if([t,s]=this.doPrepareChar(t,e),t&&(s=s.aggregate(this._appendCharRaw(t,e)),!s.rawInserted&&"pad"===this.autofix)){const i=this.state;this.state=a;let n=this.pad(e);const r=this._appendCharRaw(t,e);n=n.aggregate(r),r.rawInserted||n.equals(s)?s=n:this.state=i}if(s.inserted){let t,n=!1!==this.doValidate(e);if(n&&null!=i){const e=this.state;if(!0===this.overwrite){t=i.state;for(let t=0;t<s.rawInserted.length;++t)i.unshift(this.displayValue.length-s.tailShift)}let a=this.appendTail(i);if(n=a.rawInserted.length===i.toString().length,!(n&&a.inserted||"shift"!==this.overwrite)){this.state=e,t=i.state;for(let t=0;t<s.rawInserted.length;++t)i.shift();a=this.appendTail(i),n=a.rawInserted.length===i.toString().length}n&&a.inserted&&(this.state=e)}n||(s=new zn,this.state=a,i&&t&&(i.state=t))}return s}_appendPlaceholder(){return new zn}_appendEager(){return new zn}append(t,e,i){if(!kn(t))throw new Error("value should be string");const a=kn(i)?new Un(String(i)):i;let s;null!=e&&e.tail&&(e._beforeTailState=this.state),[t,s]=this.doPrepare(t,e);for(let i=0;i<t.length;++i){const n=this._appendChar(t[i],e,a);if(!n.rawInserted&&!this.doSkipInvalid(t[i],e,a))break;s.aggregate(n)}return(!0===this.eager||"append"===this.eager)&&null!=e&&e.input&&t&&s.aggregate(this._appendEager()),null!=a&&(s.tailShift+=this.appendTail(a).tailShift),s}remove(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),this._value=this.displayValue.slice(0,t)+this.displayValue.slice(e),new zn}withValueRefresh(t){if(this._refreshing||!this._initialized)return t();this._refreshing=!0;const e=this.rawInputValue,i=this.value,a=t();return this.rawInputValue=e,this.value&&this.value!==i&&0===i.indexOf(this.value)&&(this.append(i.slice(this.displayValue.length),{},""),this.doCommit()),delete this._refreshing,a}runIsolated(t){if(this._isolated||!this._initialized)return t(this);this._isolated=!0;const e=this.state,i=t(this);return this.state=e,delete this._isolated,i}doSkipInvalid(t,e,i){return Boolean(this.skipInvalid)}doPrepare(t,e){return void 0===e&&(e={}),zn.normalize(this.prepare?this.prepare(t,this,e):t)}doPrepareChar(t,e){return void 0===e&&(e={}),zn.normalize(this.prepareChar?this.prepareChar(t,this,e):t)}doValidate(t){return(!this.validate||this.validate(this.value,this,t))&&(!this.parent||this.parent.doValidate(t))}doCommit(){this.commit&&this.commit(this.value,this)}splice(t,e,i,a,s){void 0===i&&(i=""),void 0===a&&(a=Vn),void 0===s&&(s={input:!0});const n=t+e,r=this.extractTail(n),o=!0===this.eager||"remove"===this.eager;let l;o&&(a=function(t){switch(t){case Sn:return Dn;case An:return Bn;default:return t}}(a),l=this.extractInput(0,n,{raw:!0}));let c=t;const d=new zn;if(a!==Vn&&(c=this.nearestInputPos(t,e>1&&0!==t&&!o?Vn:a),d.tailShift=c-t),d.aggregate(this.remove(c)),o&&a!==Vn&&l===this.rawInputValue)if(a===Dn){let t;for(;l===this.rawInputValue&&(t=this.displayValue.length);)d.aggregate(new zn({tailShift:-1})).aggregate(this.remove(t-1))}else a===Bn&&r.unshift();return d.aggregate(this.append(i,s,r))}maskEquals(t){return this.mask===t}optionsIsChanged(t){return!Fn(this,t)}typedValueEquals(t){const e=this.typedValue;return t===e||qn.EMPTY_VALUES.includes(t)&&qn.EMPTY_VALUES.includes(e)||!!this.format&&this.format(t,this)===this.format(this.typedValue,this)}pad(t){return new zn}}qn.DEFAULTS={skipInvalid:!0},qn.EMPTY_VALUES=[void 0,null,""],$n.Masked=qn;class Wn{constructor(t,e){void 0===t&&(t=[]),void 0===e&&(e=0),this.chunks=t,this.from=e}toString(){return this.chunks.map(String).join("")}extend(t){if(!String(t))return;t=kn(t)?new Un(String(t)):t;const e=this.chunks[this.chunks.length-1],i=e&&(e.stop===t.stop||null==t.stop)&&t.from===e.from+e.toString().length;if(t instanceof Un)i?e.extend(t.toString()):this.chunks.push(t);else if(t instanceof Wn){if(null==t.stop){let e;for(;t.chunks.length&&null==t.chunks[0].stop;)e=t.chunks.shift(),e.from+=t.from,this.extend(e)}t.toString()&&(t.stop=t.blockIndex,this.chunks.push(t))}}appendTo(t){if(!(t instanceof $n.MaskedPattern)){return new Un(this.toString()).appendTo(t)}const e=new zn;for(let i=0;i<this.chunks.length;++i){const a=this.chunks[i],s=t._mapPosToBlock(t.displayValue.length),n=a.stop;let r;if(null!=n&&(!s||s.index<=n)&&((a instanceof Wn||t._stops.indexOf(n)>=0)&&e.aggregate(t._appendPlaceholder(n)),r=a instanceof Wn&&t._blocks[n]),r){const i=r.appendTail(a);e.aggregate(i);const s=a.toString().slice(i.rawInserted.length);s&&e.aggregate(t.append(s,{tail:!0}))}else e.aggregate(t.append(a.toString(),{tail:!0}))}return e}get state(){return{chunks:this.chunks.map(t=>t.state),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(t){const{chunks:e,...i}=t;Object.assign(this,i),this.chunks=e.map(t=>{const e="chunks"in t?new Wn:new Un;return e.state=t,e})}unshift(t){if(!this.chunks.length||null!=t&&this.from>=t)return"";const e=null!=t?t-this.from:t;let i=0;for(;i<this.chunks.length;){const t=this.chunks[i],a=t.unshift(e);if(t.toString()){if(!a)break;++i}else this.chunks.splice(i,1);if(a)return a}return""}shift(){if(!this.chunks.length)return"";let t=this.chunks.length-1;for(;0<=t;){const e=this.chunks[t],i=e.shift();if(e.toString()){if(!i)break;--t}else this.chunks.splice(t,1);if(i)return i}return""}}class jn{constructor(t,e){this.masked=t,this._log=[];const{offset:i,index:a}=t._mapPosToBlock(e)||(e<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=i,this.index=a,this.ok=!1}get block(){return this.masked._blocks[this.index]}get pos(){return this.masked._blockStartPos(this.index)+this.offset}get state(){return{index:this.index,offset:this.offset,ok:this.ok}}set state(t){Object.assign(this,t)}pushState(){this._log.push(this.state)}popState(){const t=this._log.pop();return t&&(this.state=t),t}bindBlock(){this.block||(this.index<0&&(this.index=0,this.offset=0),this.index>=this.masked._blocks.length&&(this.index=this.masked._blocks.length-1,this.offset=this.block.displayValue.length))}_pushLeft(t){for(this.pushState(),this.bindBlock();0<=this.index;--this.index,this.offset=(null==(e=this.block)?void 0:e.displayValue.length)||0){var e;if(t())return this.ok=!0}return this.ok=!1}_pushRight(t){for(this.pushState(),this.bindBlock();this.index<this.masked._blocks.length;++this.index,this.offset=0)if(t())return this.ok=!0;return this.ok=!1}pushLeftBeforeFilled(){return this._pushLeft(()=>{if(!this.block.isFixed&&this.block.value)return this.offset=this.block.nearestInputPos(this.offset,Dn),0!==this.offset||void 0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,Sn),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,Sn),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!this.block.isFixed&&this.block.value)return this.offset=this.block.nearestInputPos(this.offset,Bn),this.offset!==this.block.value.length||void 0})}pushRightBeforeInput(){return this._pushRight(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,Vn),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,Vn),!0})}}class Gn{constructor(t){Object.assign(this,t),this._value="",this.isFixed=!0}get value(){return this._value}get unmaskedValue(){return this.isUnmasking?this.value:""}get rawInputValue(){return this._isRawInput?this.value:""}get displayValue(){return this.value}reset(){this._isRawInput=!1,this._value=""}remove(t,e){return void 0===t&&(t=0),void 0===e&&(e=this._value.length),this._value=this._value.slice(0,t)+this._value.slice(e),this._value||(this._isRawInput=!1),new zn}nearestInputPos(t,e){void 0===e&&(e=Vn);const i=this._value.length;switch(e){case Sn:case Dn:return 0;default:return i}}totalInputPositions(t,e){return void 0===t&&(t=0),void 0===e&&(e=this._value.length),this._isRawInput?e-t:0}extractInput(t,e,i){return void 0===t&&(t=0),void 0===e&&(e=this._value.length),void 0===i&&(i={}),i.raw&&this._isRawInput&&this._value.slice(t,e)||""}get isComplete(){return!0}get isFilled(){return Boolean(this._value)}_appendChar(t,e){if(void 0===e&&(e={}),this.isFilled)return new zn;const i=!0===this.eager||"append"===this.eager,a=this.char===t&&(this.isUnmasking||e.input||e.raw)&&(!e.raw||!i)&&!e.tail,s=new zn({inserted:this.char,rawInserted:a?this.char:""});return this._value=this.char,this._isRawInput=a&&(e.raw||e.input),s}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const t=new zn;return this.isFilled||(this._value=t.inserted=this.char),t}extractTail(){return new Un("")}appendTail(t){return kn(t)&&(t=new Un(String(t))),t.appendTo(this)}append(t,e,i){const a=this._appendChar(t[0],e);return null!=i&&(a.tailShift+=this.appendTail(i).tailShift),a}doCommit(){}get state(){return{_value:this._value,_rawInputValue:this.rawInputValue}}set state(t){this._value=t._value,this._isRawInput=Boolean(t._rawInputValue)}pad(t){return this._appendPlaceholder()}}class Kn{constructor(t){const{parent:e,isOptional:i,placeholderChar:a,displayChar:s,lazy:n,eager:r,...o}=t;this.masked=Pn(o),Object.assign(this,{parent:e,isOptional:i,placeholderChar:a,displayChar:s,lazy:n,eager:r})}reset(){this.isFilled=!1,this.masked.reset()}remove(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.value.length),0===t&&e>=1?(this.isFilled=!1,this.masked.remove(t,e)):new zn}get value(){return this.masked.value||(this.isFilled&&!this.isOptional?this.placeholderChar:"")}get unmaskedValue(){return this.masked.unmaskedValue}get rawInputValue(){return this.masked.rawInputValue}get displayValue(){return this.masked.value&&this.displayChar||this.value}get isComplete(){return Boolean(this.masked.value)||this.isOptional}_appendChar(t,e){if(void 0===e&&(e={}),this.isFilled)return new zn;const i=this.masked.state;let a=this.masked._appendChar(t,this.currentMaskFlags(e));return a.inserted&&!1===this.doValidate(e)&&(a=new zn,this.masked.state=i),a.inserted||this.isOptional||this.lazy||e.input||(a.inserted=this.placeholderChar),a.skip=!a.inserted&&!this.isOptional,this.isFilled=Boolean(a.inserted),a}append(t,e,i){return this.masked.append(t,this.currentMaskFlags(e),i)}_appendPlaceholder(){return this.isFilled||this.isOptional?new zn:(this.isFilled=!0,new zn({inserted:this.placeholderChar}))}_appendEager(){return new zn}extractTail(t,e){return this.masked.extractTail(t,e)}appendTail(t){return this.masked.appendTail(t)}extractInput(t,e,i){return void 0===t&&(t=0),void 0===e&&(e=this.value.length),this.masked.extractInput(t,e,i)}nearestInputPos(t,e){void 0===e&&(e=Vn);const i=this.value.length,a=Math.min(Math.max(t,0),i);switch(e){case Sn:case Dn:return this.isComplete?a:0;case An:case Bn:return this.isComplete?a:i;default:return a}}totalInputPositions(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.value.length),this.value.slice(t,e).length}doValidate(t){return this.masked.doValidate(this.currentMaskFlags(t))&&(!this.parent||this.parent.doValidate(this.currentMaskFlags(t)))}doCommit(){this.masked.doCommit()}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue,masked:this.masked.state,isFilled:this.isFilled}}set state(t){this.masked.state=t.masked,this.isFilled=t.isFilled}currentMaskFlags(t){var e;return{...t,_beforeTailState:(null==t||null==(e=t._beforeTailState)?void 0:e.masked)||(null==t?void 0:t._beforeTailState)}}pad(t){return new zn}}Kn.DEFAULT_DEFINITIONS={0:/\d/,a:/[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,"*":/./};$n.MaskedRegExp=class extends qn{updateOptions(t){super.updateOptions(t)}_update(t){const e=t.mask;e&&(t.validate=t=>t.search(e)>=0),super._update(t)}};class Qn extends qn{constructor(t){super({...Qn.DEFAULTS,...t,definitions:Object.assign({},Kn.DEFAULT_DEFINITIONS,null==t?void 0:t.definitions)})}updateOptions(t){super.updateOptions(t)}_update(t){t.definitions=Object.assign({},this.definitions,t.definitions),super._update(t),this._rebuildMask()}_rebuildMask(){const t=this.definitions;this._blocks=[],this.exposeBlock=void 0,this._stops=[],this._maskedBlocks={};const e=this.mask;if(!e||!t)return;let i=!1,a=!1;for(let s=0;s<e.length;++s){if(this.blocks){const t=e.slice(s),i=Object.keys(this.blocks).filter(e=>0===t.indexOf(e));i.sort((t,e)=>e.length-t.length);const a=i[0];if(a){const{expose:t,repeat:e,...i}=In(this.blocks[a]),n={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...i,repeat:e,parent:this},r=null!=e?new $n.RepeatBlock(n):Pn(n);r&&(this._blocks.push(r),t&&(this.exposeBlock=r),this._maskedBlocks[a]||(this._maskedBlocks[a]=[]),this._maskedBlocks[a].push(this._blocks.length-1)),s+=a.length-1;continue}}let n=e[s],r=n in t;if(n===Qn.STOP_CHAR){this._stops.push(this._blocks.length);continue}if("{"===n||"}"===n){i=!i;continue}if("["===n||"]"===n){a=!a;continue}if(n===Qn.ESCAPE_CHAR){if(++s,n=e[s],!n)break;r=!1}const o=r?new Kn({isOptional:a,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...In(t[n]),parent:this}):new Gn({char:n,eager:this.eager,isUnmasking:i});this._blocks.push(o)}}get state(){return{...super.state,_blocks:this._blocks.map(t=>t.state)}}set state(t){if(!t)return void this.reset();const{_blocks:e,...i}=t;this._blocks.forEach((t,i)=>t.state=e[i]),super.state=i}reset(){super.reset(),this._blocks.forEach(t=>t.reset())}get isComplete(){return this.exposeBlock?this.exposeBlock.isComplete:this._blocks.every(t=>t.isComplete)}get isFilled(){return this._blocks.every(t=>t.isFilled)}get isFixed(){return this._blocks.every(t=>t.isFixed)}get isOptional(){return this._blocks.every(t=>t.isOptional)}doCommit(){this._blocks.forEach(t=>t.doCommit()),super.doCommit()}get unmaskedValue(){return this.exposeBlock?this.exposeBlock.unmaskedValue:this._blocks.reduce((t,e)=>t+e.unmaskedValue,"")}set unmaskedValue(t){if(this.exposeBlock){const e=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=t,this.appendTail(e),this.doCommit()}else super.unmaskedValue=t}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce((t,e)=>t+e.value,"")}set value(t){if(this.exposeBlock){const e=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=t,this.appendTail(e),this.doCommit()}else super.value=t}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(t){if(this.exposeBlock){const e=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=t,this.appendTail(e),this.doCommit()}else super.typedValue=t}get displayValue(){return this._blocks.reduce((t,e)=>t+e.displayValue,"")}appendTail(t){return super.appendTail(t).aggregate(this._appendPlaceholder())}_appendEager(){var t;const e=new zn;let i=null==(t=this._mapPosToBlock(this.displayValue.length))?void 0:t.index;if(null==i)return e;this._blocks[i].isFilled&&++i;for(let t=i;t<this._blocks.length;++t){const i=this._blocks[t]._appendEager();if(!i.inserted)break;e.aggregate(i)}return e}_appendCharRaw(t,e){void 0===e&&(e={});const i=this._mapPosToBlock(this.displayValue.length),a=new zn;if(!i)return a;for(let n,r=i.index;n=this._blocks[r];++r){var s;const i=n._appendChar(t,{...e,_beforeTailState:null==(s=e._beforeTailState)||null==(s=s._blocks)?void 0:s[r]});if(a.aggregate(i),i.consumed)break}return a}extractTail(t,e){void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length);const i=new Wn;return t===e||this._forEachBlocksInRange(t,e,(t,e,a,s)=>{const n=t.extractTail(a,s);n.stop=this._findStopBefore(e),n.from=this._blockStartPos(e),n instanceof Wn&&(n.blockIndex=e),i.extend(n)}),i}extractInput(t,e,i){if(void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),void 0===i&&(i={}),t===e)return"";let a="";return this._forEachBlocksInRange(t,e,(t,e,s,n)=>{a+=t.extractInput(s,n,i)}),a}_findStopBefore(t){let e;for(let i=0;i<this._stops.length;++i){const a=this._stops[i];if(!(a<=t))break;e=a}return e}_appendPlaceholder(t){const e=new zn;if(this.lazy&&null==t)return e;const i=this._mapPosToBlock(this.displayValue.length);if(!i)return e;const a=i.index,s=null!=t?t:this._blocks.length;return this._blocks.slice(a,s).forEach(i=>{var a;i.lazy&&null==t||e.aggregate(i._appendPlaceholder(null==(a=i._blocks)?void 0:a.length))}),e}_mapPosToBlock(t){let e="";for(let i=0;i<this._blocks.length;++i){const a=this._blocks[i],s=e.length;if(e+=a.displayValue,t<=e.length)return{index:i,offset:t-s}}}_blockStartPos(t){return this._blocks.slice(0,t).reduce((t,e)=>t+e.displayValue.length,0)}_forEachBlocksInRange(t,e,i){void 0===e&&(e=this.displayValue.length);const a=this._mapPosToBlock(t);if(a){const t=this._mapPosToBlock(e),s=t&&a.index===t.index,n=a.offset,r=t&&s?t.offset:this._blocks[a.index].displayValue.length;if(i(this._blocks[a.index],a.index,n,r),t&&!s){for(let e=a.index+1;e<t.index;++e)i(this._blocks[e],e,0,this._blocks[e].displayValue.length);i(this._blocks[t.index],t.index,0,t.offset)}}}remove(t,e){void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length);const i=super.remove(t,e);return this._forEachBlocksInRange(t,e,(t,e,a,s)=>{i.aggregate(t.remove(a,s))}),i}nearestInputPos(t,e){if(void 0===e&&(e=Vn),!this._blocks.length)return 0;const i=new jn(this,t);if(e===Vn)return i.pushRightBeforeInput()?i.pos:(i.popState(),i.pushLeftBeforeInput()?i.pos:this.displayValue.length);if(e===Sn||e===Dn){if(e===Sn){if(i.pushRightBeforeFilled(),i.ok&&i.pos===t)return t;i.popState()}if(i.pushLeftBeforeInput(),i.pushLeftBeforeRequired(),i.pushLeftBeforeFilled(),e===Sn){if(i.pushRightBeforeInput(),i.pushRightBeforeRequired(),i.ok&&i.pos<=t)return i.pos;if(i.popState(),i.ok&&i.pos<=t)return i.pos;i.popState()}return i.ok?i.pos:e===Dn?0:(i.popState(),i.ok?i.pos:(i.popState(),i.ok?i.pos:0))}return e===An||e===Bn?(i.pushRightBeforeInput(),i.pushRightBeforeRequired(),i.pushRightBeforeFilled()?i.pos:e===Bn?this.displayValue.length:(i.popState(),i.ok?i.pos:(i.popState(),i.ok?i.pos:this.nearestInputPos(t,Sn)))):t}totalInputPositions(t,e){void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length);let i=0;return this._forEachBlocksInRange(t,e,(t,e,a,s)=>{i+=t.totalInputPositions(a,s)}),i}maskedBlock(t){return this.maskedBlocks(t)[0]}maskedBlocks(t){const e=this._maskedBlocks[t];return e?e.map(t=>this._blocks[t]):[]}pad(t){const e=new zn;return this._forEachBlocksInRange(0,this.displayValue.length,i=>e.aggregate(i.pad(t))),e}}Qn.DEFAULTS={...qn.DEFAULTS,lazy:!0,placeholderChar:"_"},Qn.STOP_CHAR="`",Qn.ESCAPE_CHAR="\\",Qn.InputDefinition=Kn,Qn.FixedDefinition=Gn,$n.MaskedPattern=Qn;class Xn extends Qn{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){const{to:e=this.to||0,from:i=this.from||0,maxLength:a=this.maxLength||0,autofix:s=this.autofix,...n}=t;this.to=e,this.from=i,this.maxLength=Math.max(String(e).length,a),this.autofix=s;const r=String(this.from).padStart(this.maxLength,"0"),o=String(this.to).padStart(this.maxLength,"0");let l=0;for(;l<o.length&&o[l]===r[l];)++l;n.mask=o.slice(0,l).replace(/0/g,"\\0")+"0".repeat(this.maxLength-l),super._update(n)}get isComplete(){return super.isComplete&&Boolean(this.value)}boundaries(t){let e="",i="";const[,a,s]=t.match(/^(\D*)(\d*)(\D*)/)||[];return s&&(e="0".repeat(a.length)+s,i="9".repeat(a.length)+s),e=e.padEnd(this.maxLength,"0"),i=i.padEnd(this.maxLength,"9"),[e,i]}doPrepareChar(t,e){let i;return void 0===e&&(e={}),[t,i]=super.doPrepareChar(t.replace(/\D/g,""),e),t||(i.skip=!this.isComplete),[t,i]}_appendCharRaw(t,e){if(void 0===e&&(e={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(t,e);const i=String(this.from).padStart(this.maxLength,"0"),a=String(this.to).padStart(this.maxLength,"0"),[s,n]=this.boundaries(this.value+t);return Number(n)<this.from?super._appendCharRaw(i[this.value.length],e):Number(s)>this.to?!e.tail&&"pad"===this.autofix&&this.value.length+1<this.maxLength?super._appendCharRaw(i[this.value.length],e).aggregate(this._appendCharRaw(t,e)):super._appendCharRaw(a[this.value.length],e):super._appendCharRaw(t,e)}doValidate(t){const e=this.value;if(-1===e.search(/[^0]/)&&e.length<=this._matchFrom)return!0;const[i,a]=this.boundaries(e);return this.from<=Number(a)&&Number(i)<=this.to&&super.doValidate(t)}pad(t){const e=new zn;if(this.value.length===this.maxLength)return e;const i=this.value,a=this.maxLength-this.value.length;if(a){this.reset();for(let i=0;i<a;++i)e.aggregate(super._appendCharRaw("0",t));i.split("").forEach(t=>this._appendCharRaw(t))}return e}}$n.MaskedRange=Xn;class Jn extends Qn{static extractPatternOptions(t){const{mask:e,pattern:i,...a}=t;return{...a,mask:kn(e)?e:i}}constructor(t){super(Jn.extractPatternOptions({...Jn.DEFAULTS,...t}))}updateOptions(t){super.updateOptions(t)}_update(t){const{mask:e,pattern:i,blocks:a,...s}={...Jn.DEFAULTS,...t},n=Object.assign({},Jn.GET_DEFAULT_BLOCKS());t.min&&(n.Y.from=t.min.getFullYear()),t.max&&(n.Y.to=t.max.getFullYear()),t.min&&t.max&&n.Y.from===n.Y.to&&(n.m.from=t.min.getMonth()+1,n.m.to=t.max.getMonth()+1,n.m.from===n.m.to&&(n.d.from=t.min.getDate(),n.d.to=t.max.getDate())),Object.assign(n,this.blocks,a),super._update({...s,mask:kn(e)?e:i,blocks:n})}doValidate(t){const e=this.date;return super.doValidate(t)&&(!this.isComplete||this.isDateExist(this.value)&&null!=e&&(null==this.min||this.min<=e)&&(null==this.max||e<=this.max))}isDateExist(t){return this.format(this.parse(t,this),this).indexOf(t)>=0}get date(){return this.typedValue}set date(t){this.typedValue=t}get typedValue(){return this.isComplete?super.typedValue:null}set typedValue(t){super.typedValue=t}maskEquals(t){return t===Date||super.maskEquals(t)}optionsIsChanged(t){return super.optionsIsChanged(Jn.extractPatternOptions(t))}}Jn.GET_DEFAULT_BLOCKS=()=>({d:{mask:Xn,from:1,to:31,maxLength:2},m:{mask:Xn,from:1,to:12,maxLength:2},Y:{mask:Xn,from:1900,to:9999}}),Jn.DEFAULTS={...Qn.DEFAULTS,mask:Date,pattern:"d{.}`m{.}`Y",format:(t,e)=>{if(!t)return"";return[String(t.getDate()).padStart(2,"0"),String(t.getMonth()+1).padStart(2,"0"),t.getFullYear()].join(".")},parse:(t,e)=>{const[i,a,s]=t.split(".").map(Number);return new Date(s,a-1,i)}},$n.MaskedDate=Jn;class tr extends qn{constructor(t){super({...tr.DEFAULTS,...t}),this.currentMask=void 0}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),"mask"in t&&(this.exposeMask=void 0,this.compiledMasks=Array.isArray(t.mask)?t.mask.map(t=>{const{expose:e,...i}=In(t),a=Pn({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...i});return e&&(this.exposeMask=a),a}):[])}_appendCharRaw(t,e){void 0===e&&(e={});const i=this._applyDispatch(t,e);return this.currentMask&&i.aggregate(this.currentMask._appendChar(t,this.currentMaskFlags(e))),i}_applyDispatch(t,e,i){void 0===t&&(t=""),void 0===e&&(e={}),void 0===i&&(i="");const a=e.tail&&null!=e._beforeTailState?e._beforeTailState._value:this.value,s=this.rawInputValue,n=e.tail&&null!=e._beforeTailState?e._beforeTailState._rawInputValue:s,r=s.slice(n.length),o=this.currentMask,l=new zn,c=null==o?void 0:o.state;return this.currentMask=this.doDispatch(t,{...e},i),this.currentMask&&(this.currentMask!==o?(this.currentMask.reset(),n&&(this.currentMask.append(n,{raw:!0}),l.tailShift=this.currentMask.value.length-a.length),r&&(l.tailShift+=this.currentMask.append(r,{raw:!0,tail:!0}).tailShift)):c&&(this.currentMask.state=c)),l}_appendPlaceholder(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendPlaceholder()),t}_appendEager(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendEager()),t}appendTail(t){const e=new zn;return t&&e.aggregate(this._applyDispatch("",{},t)),e.aggregate(this.currentMask?this.currentMask.appendTail(t):super.appendTail(t))}currentMaskFlags(t){var e,i;return{...t,_beforeTailState:(null==(e=t._beforeTailState)?void 0:e.currentMaskRef)===this.currentMask&&(null==(i=t._beforeTailState)?void 0:i.currentMask)||t._beforeTailState}}doDispatch(t,e,i){return void 0===e&&(e={}),void 0===i&&(i=""),this.dispatch(t,this,e,i)}doValidate(t){return super.doValidate(t)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(t)))}doPrepare(t,e){void 0===e&&(e={});let[i,a]=super.doPrepare(t,e);if(this.currentMask){let t;[i,t]=super.doPrepare(i,this.currentMaskFlags(e)),a=a.aggregate(t)}return[i,a]}doPrepareChar(t,e){void 0===e&&(e={});let[i,a]=super.doPrepareChar(t,e);if(this.currentMask){let t;[i,t]=super.doPrepareChar(i,this.currentMaskFlags(e)),a=a.aggregate(t)}return[i,a]}reset(){var t;null==(t=this.currentMask)||t.reset(),this.compiledMasks.forEach(t=>t.reset())}get value(){return this.exposeMask?this.exposeMask.value:this.currentMask?this.currentMask.value:""}set value(t){this.exposeMask?(this.exposeMask.value=t,this.currentMask=this.exposeMask,this._applyDispatch()):super.value=t}get unmaskedValue(){return this.exposeMask?this.exposeMask.unmaskedValue:this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(t){this.exposeMask?(this.exposeMask.unmaskedValue=t,this.currentMask=this.exposeMask,this._applyDispatch()):super.unmaskedValue=t}get typedValue(){return this.exposeMask?this.exposeMask.typedValue:this.currentMask?this.currentMask.typedValue:""}set typedValue(t){if(this.exposeMask)return this.exposeMask.typedValue=t,this.currentMask=this.exposeMask,void this._applyDispatch();let e=String(t);this.currentMask&&(this.currentMask.typedValue=t,e=this.currentMask.unmaskedValue),this.unmaskedValue=e}get displayValue(){return this.currentMask?this.currentMask.displayValue:""}get isComplete(){var t;return Boolean(null==(t=this.currentMask)?void 0:t.isComplete)}get isFilled(){var t;return Boolean(null==(t=this.currentMask)?void 0:t.isFilled)}remove(t,e){const i=new zn;return this.currentMask&&i.aggregate(this.currentMask.remove(t,e)).aggregate(this._applyDispatch()),i}get state(){var t;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map(t=>t.state),currentMaskRef:this.currentMask,currentMask:null==(t=this.currentMask)?void 0:t.state}}set state(t){const{compiledMasks:e,currentMaskRef:i,currentMask:a,...s}=t;e&&this.compiledMasks.forEach((t,i)=>t.state=e[i]),null!=i&&(this.currentMask=i,this.currentMask.state=a),super.state=s}extractInput(t,e,i){return this.currentMask?this.currentMask.extractInput(t,e,i):""}extractTail(t,e){return this.currentMask?this.currentMask.extractTail(t,e):super.extractTail(t,e)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(t,e){return this.currentMask?this.currentMask.nearestInputPos(t,e):super.nearestInputPos(t,e)}get overwrite(){return this.currentMask?this.currentMask.overwrite:this._overwrite}set overwrite(t){this._overwrite=t}get eager(){return this.currentMask?this.currentMask.eager:this._eager}set eager(t){this._eager=t}get skipInvalid(){return this.currentMask?this.currentMask.skipInvalid:this._skipInvalid}set skipInvalid(t){this._skipInvalid=t}get autofix(){return this.currentMask?this.currentMask.autofix:this._autofix}set autofix(t){this._autofix=t}maskEquals(t){return Array.isArray(t)?this.compiledMasks.every((e,i)=>{if(!t[i])return;const{mask:a,...s}=t[i];return Fn(e,s)&&e.maskEquals(a)}):super.maskEquals(t)}typedValueEquals(t){var e;return Boolean(null==(e=this.currentMask)?void 0:e.typedValueEquals(t))}}tr.DEFAULTS={...qn.DEFAULTS,dispatch:(t,e,i,a)=>{if(!e.compiledMasks.length)return;const s=e.rawInputValue,n=e.compiledMasks.map((n,r)=>{const o=e.currentMask===n,l=o?n.displayValue.length:n.nearestInputPos(n.displayValue.length,Dn);return n.rawInputValue!==s?(n.reset(),n.append(s,{raw:!0})):o||n.remove(l),n.append(t,e.currentMaskFlags(i)),n.appendTail(a),{index:r,weight:n.rawInputValue.length,totalInputPositions:n.totalInputPositions(0,Math.max(l,n.nearestInputPos(n.displayValue.length,Dn)))}});return n.sort((t,e)=>e.weight-t.weight||e.totalInputPositions-t.totalInputPositions),e.compiledMasks[n[0].index]}},$n.MaskedDynamic=tr;class er extends Qn{constructor(t){super({...er.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){const{enum:e,...i}=t;if(e){const t=e.map(t=>t.length),a=Math.min(...t),s=Math.max(...t)-a;i.mask="*".repeat(a),s&&(i.mask+="["+"*".repeat(s)+"]"),this.enum=e}super._update(i)}_appendCharRaw(t,e){void 0===e&&(e={});const i=Math.min(this.nearestInputPos(0,Bn),this.value.length),a=this.enum.filter(e=>this.matchValue(e,this.unmaskedValue+t,i));if(a.length){1===a.length&&this._forEachBlocksInRange(0,this.value.length,(t,i)=>{const s=a[0][i];i>=this.value.length||s===t.value||(t.reset(),t._appendChar(s,e))});const t=super._appendCharRaw(a[0][this.value.length],e);return 1===a.length&&a[0].slice(this.unmaskedValue.length).split("").forEach(e=>t.aggregate(super._appendCharRaw(e))),t}return new zn({skip:!this.isComplete})}extractTail(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),new Un("",t)}remove(t,e){if(void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),t===e)return new zn;const i=Math.min(super.nearestInputPos(0,Bn),this.value.length);let a;for(a=t;a>=0;--a){if(this.enum.filter(t=>this.matchValue(t,this.value.slice(i,a),i)).length>1)break}const s=super.remove(a,e);return s.tailShift+=a-t,s}get isComplete(){return this.enum.indexOf(this.value)>=0}}er.DEFAULTS={...Qn.DEFAULTS,matchValue:(t,e,i)=>t.indexOf(e,i)===i},$n.MaskedEnum=er;var ir;$n.MaskedFunction=class extends qn{updateOptions(t){super.updateOptions(t)}_update(t){super._update({...t,validate:t.mask})}};class ar extends qn{constructor(t){super({...ar.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),this._updateRegExps()}_updateRegExps(){const t="^"+(this.allowNegative?"[+|\\-]?":""),e=(this.scale?"("+En(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(t+"\\d*"+e),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(En).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(En(this.thousandsSeparator),"g")}_removeThousandsSeparators(t){return t.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(t){const e=t.split(this.radix);return e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),e.join(this.radix)}doPrepareChar(t,e){void 0===e&&(e={});const[i,a]=super.doPrepareChar(this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(e.input&&e.raw||!e.input&&!e.raw)?t.replace(this._mapToRadixRegExp,this.radix):t),e);return t&&!i&&(a.skip=!0),!i||this.allowPositive||this.value||"-"===i||a.aggregate(this._appendChar("-")),[i,a]}_separatorsCount(t,e){void 0===e&&(e=!1);let i=0;for(let a=0;a<t;++a)this._value.indexOf(this.thousandsSeparator,a)===a&&(++i,e&&(t+=this.thousandsSeparator.length));return i}_separatorsCountFromSlice(t){return void 0===t&&(t=this._value),this._separatorsCount(this._removeThousandsSeparators(t).length,!0)}extractInput(t,e,i){return void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),[t,e]=this._adjustRangeWithSeparators(t,e),this._removeThousandsSeparators(super.extractInput(t,e,i))}_appendCharRaw(t,e){void 0===e&&(e={});const i=e.tail&&e._beforeTailState?e._beforeTailState._value:this._value,a=this._separatorsCountFromSlice(i);this._value=this._removeThousandsSeparators(this.value);const s=this._value;this._value+=t;const n=this.number;let r,o=!isNaN(n),l=!1;if(o){let t;null!=this.min&&this.min<0&&this.number<this.min&&(t=this.min),null!=this.max&&this.max>0&&this.number>this.max&&(t=this.max),null!=t&&(this.autofix?(this._value=this.format(t,this).replace(ar.UNMASKED_RADIX,this.radix),l||(l=s===this._value&&!e.tail)):o=!1),o&&(o=Boolean(this._value.match(this._numberRegExp)))}o?r=new zn({inserted:this._value.slice(s.length),rawInserted:l?"":t,skip:l}):(this._value=s,r=new zn),this._value=this._insertThousandsSeparators(this._value);const c=e.tail&&e._beforeTailState?e._beforeTailState._value:this._value,d=this._separatorsCountFromSlice(c);return r.tailShift+=(d-a)*this.thousandsSeparator.length,r}_findSeparatorAround(t){if(this.thousandsSeparator){const e=t-this.thousandsSeparator.length+1,i=this.value.indexOf(this.thousandsSeparator,e);if(i<=t)return i}return-1}_adjustRangeWithSeparators(t,e){const i=this._findSeparatorAround(t);i>=0&&(t=i);const a=this._findSeparatorAround(e);return a>=0&&(e=a+this.thousandsSeparator.length),[t,e]}remove(t,e){void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),[t,e]=this._adjustRangeWithSeparators(t,e);const i=this.value.slice(0,t),a=this.value.slice(e),s=this._separatorsCount(i.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(i+a));const n=this._separatorsCountFromSlice(i);return new zn({tailShift:(n-s)*this.thousandsSeparator.length})}nearestInputPos(t,e){if(!this.thousandsSeparator)return t;switch(e){case Vn:case Sn:case Dn:{const i=this._findSeparatorAround(t-1);if(i>=0){const a=i+this.thousandsSeparator.length;if(t<a||this.value.length<=a||e===Dn)return i}break}case An:case Bn:{const e=this._findSeparatorAround(t);if(e>=0)return e+this.thousandsSeparator.length}}return t}doCommit(){if(this.value){const t=this.number;let e=t;null!=this.min&&(e=Math.max(e,this.min)),null!=this.max&&(e=Math.min(e,this.max)),e!==t&&(this.unmaskedValue=this.format(e,this));let i=this.value;this.normalizeZeros&&(i=this._normalizeZeros(i)),this.padFractionalZeros&&this.scale>0&&(i=this._padFractionalZeros(i)),this._value=i}super.doCommit()}_normalizeZeros(t){const e=this._removeThousandsSeparators(t).split(this.radix);return e[0]=e[0].replace(/^(\D*)(0*)(\d*)/,(t,e,i,a)=>e+a),t.length&&!/\d$/.test(e[0])&&(e[0]=e[0]+"0"),e.length>1&&(e[1]=e[1].replace(/0*$/,""),e[1].length||(e.length=1)),this._insertThousandsSeparators(e.join(this.radix))}_padFractionalZeros(t){if(!t)return t;const e=t.split(this.radix);return e.length<2&&e.push(""),e[1]=e[1].padEnd(this.scale,"0"),e.join(this.radix)}doSkipInvalid(t,e,i){void 0===e&&(e={});const a=0===this.scale&&t!==this.thousandsSeparator&&(t===this.radix||t===ar.UNMASKED_RADIX||this.mapToRadix.includes(t));return super.doSkipInvalid(t,e,i)&&!a}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,ar.UNMASKED_RADIX)}set unmaskedValue(t){super.unmaskedValue=t}get typedValue(){return this.parse(this.unmaskedValue,this)}set typedValue(t){this.rawInputValue=this.format(t,this).replace(ar.UNMASKED_RADIX,this.radix)}get number(){return this.typedValue}set number(t){this.typedValue=t}get allowNegative(){return null!=this.min&&this.min<0||null!=this.max&&this.max<0}get allowPositive(){return null!=this.min&&this.min>0||null!=this.max&&this.max>0}typedValueEquals(t){return(super.typedValueEquals(t)||ar.EMPTY_VALUES.includes(t)&&ar.EMPTY_VALUES.includes(this.typedValue))&&!(0===t&&""===this.value)}}ir=ar,ar.UNMASKED_RADIX=".",ar.EMPTY_VALUES=[...qn.EMPTY_VALUES,0],ar.DEFAULTS={...qn.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[ir.UNMASKED_RADIX],min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,scale:2,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:t=>t.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})},$n.MaskedNumber=ar;const sr={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function nr(t,e,i){void 0===e&&(e=sr.MASKED),void 0===i&&(i=sr.MASKED);const a=Pn(t);return t=>a.runIsolated(a=>(a[e]=t,a[i]))}$n.PIPE_TYPE=sr,$n.createPipe=nr,$n.pipe=function(t,e,i,a){return nr(e,i,a)(t)};$n.RepeatBlock=class extends Qn{get repeatFrom(){var t;return null!=(t=Array.isArray(this.repeat)?this.repeat[0]:this.repeat===1/0?0:this.repeat)?t:0}get repeatTo(){var t;return null!=(t=Array.isArray(this.repeat)?this.repeat[1]:this.repeat)?t:1/0}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){var e,i,a;const{repeat:s,...n}=In(t);this._blockOpts=Object.assign({},this._blockOpts,n);const r=Pn(this._blockOpts);this.repeat=null!=(e=null!=(i=null!=s?s:r.repeat)?i:this.repeat)?e:1/0,super._update({mask:"m".repeat(Math.max(this.repeatTo===1/0&&(null==(a=this._blocks)?void 0:a.length)||0,this.repeatFrom)),blocks:{m:r},eager:r.eager,overwrite:r.overwrite,skipInvalid:r.skipInvalid,lazy:r.lazy,placeholderChar:r.placeholderChar,displayChar:r.displayChar})}_allocateBlock(t){return t<this._blocks.length?this._blocks[t]:this.repeatTo===1/0||this._blocks.length<this.repeatTo?(this._blocks.push(Pn(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]):void 0}_appendCharRaw(t,e){void 0===e&&(e={});const i=new zn;for(let o,l,c=null!=(a=null==(s=this._mapPosToBlock(this.displayValue.length))?void 0:s.index)?a:Math.max(this._blocks.length-1,0);o=null!=(n=this._blocks[c])?n:l=!l&&this._allocateBlock(c);++c){var a,s,n,r;const d=o._appendChar(t,{...e,_beforeTailState:null==(r=e._beforeTailState)||null==(r=r._blocks)?void 0:r[c]});if(d.skip&&l){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(i.aggregate(d),d.consumed)break}return i}_trimEmptyTail(t,e){var i,a;void 0===t&&(t=0);const s=Math.max((null==(i=this._mapPosToBlock(t))?void 0:i.index)||0,this.repeatFrom,0);let n;null!=e&&(n=null==(a=this._mapPosToBlock(e))?void 0:a.index),null==n&&(n=this._blocks.length-1);let r=0;for(let t=n;s<=t&&!this._blocks[t].unmaskedValue;--t,++r);r&&(this._blocks.splice(n-r+1,r),this.mask=this.mask.slice(r))}reset(){super.reset(),this._trimEmptyTail()}remove(t,e){void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length);const i=super.remove(t,e);return this._trimEmptyTail(t,e),i}totalInputPositions(t,e){return void 0===t&&(t=0),null==e&&this.repeatTo===1/0?1/0:super.totalInputPositions(t,e)}get state(){return super.state}set state(t){this._blocks.length=t._blocks.length,this.mask=this.mask.slice(0,this._blocks.length),super.state=t}};try{globalThis.IMask=$n}catch{}var rr=re`.invalid-feedback-container{display:flex;gap:var(--sgds-form-gap-sm)}.invalid-feedback,.invalid-feedback-container{color:var(--sgds-form-danger-color-default);line-height:var(--sgds-line-height-20)}.invalid-feedback{font-size:var(--sgds-font-size-14);font-weight:var(--sgds-font-weight-regular)}.valid-icon{color:var(--sgds-form-success-color-default)}`,or=re`.form-text{color:var(--sgds-form-color-subtle);font-size:var(--sgds-font-size-label-sm);line-height:var(--sgds-line-height-2-xs)}.form-text.disabled{opacity:var(--sgds-opacity-40)}`,lr=re`.form-label{color:var(--sgds-form-color-default);margin-bottom:0}.form-label.disabled{opacity:var(--sgds-opacity-40)}.form-check-label{color:var(--sgds-form-color-default)}.form-check-input:disabled~.form-check-label,.form-check-input[disabled]~.form-check-label{cursor:not-allowed}`,cr=re`.form-control::placeholder{color:var(--sgds-form-color-subtle);font-family:var(--sgds-font-family-brand);font-weight:var(--sgds-font-weight-light);line-height:var(--sgds-line-height-24)}`;class dr extends Cs{constructor(){super(...arguments),this.label="",this.hintText="",this.disabled=!1,this.invalid=!1,this._controlId=ks("input"),this._labelId=ks("label")}setInvalid(t){this.invalid=t,t?this.emit("sgds-invalid"):this.emit("sgds-valid")}}dr.styles=[...Cs.styles,rr,or,lr,cr],t([Zi({reflect:!0})],dr.prototype,"label",void 0),t([Zi({reflect:!0})],dr.prototype,"hintText",void 0),t([Zi({reflect:!0})],dr.prototype,"name",void 0),t([Zi({type:Boolean,reflect:!0})],dr.prototype,"disabled",void 0),t([Zi({type:Boolean,reflect:!0})],dr.prototype,"invalid",void 0);var hr=re`.form-control-container{display:flex;flex-direction:column;gap:var(--sgds-form-gap-md)}.m-width-160{min-width:var(--sgds-dimension-160)}.m-width-256{min-width:var(--sgds-dimension-256)}.form-label{color:var(--sgds-form-color-default);font-size:var(--sgds-font-size-label-md)}.form-control-group{align-items:center;background-color:var(--sgds-form-surface-default);border:var(--sgds-form-border-width-default) solid var(--sgds-border-color-default);border-radius:var(--input-border-radius,var(--sgds-form-border-radius-md));display:flex;gap:var(--sgds-form-gap-md);height:var(--sgds-dimension-48);justify-content:center;overflow:hidden;padding:0 var(--sgds-form-padding-x);transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out;width:-webkit-fill-available;width:-moz-available}.form-control{appearance:none;background-clip:padding-box;background:none;border:none;color:var(--sgds-form-color-default);display:block;flex-grow:1;font-family:var(--sgds-font-family-brand);font-size:var(--sgds-font-size-label-md);line-height:var(--sgds-line-height-xs);min-width:0;outline:none;padding:0;width:100%}.form-clearable{color:var(--sgds-color-subtle);cursor:pointer}@media (prefers-reduced-motion:reduce){.form-control-group{transition:none}}.form-control-group:not(.disabled):not(.is-invalid):not(.readonly):not(:focus-within):hover{outline:var(--sgds-form-border-width-thick) solid var(--sgds-border-color-emphasis);outline-offset:var(--sgds-form-outline-offset-focus)}.form-control-group:not(.disabled):not(.is-invalid):focus-within{outline:var(--sgds-form-outline-focus);outline-offset:var(--sgds-form-outline-offset-focus)}.form-control-container.disabled{opacity:var(--sgds-opacity-40)}.form-control-group.disabled{background-color:var(--sgds-form-surface-muted);cursor:not-allowed}.form-control-group.readonly{background-color:var(--sgds-form-surface-raised)}.form-control-group.is-invalid:not(.disabled){border:var(--sgds-form-border-width-default) solid var(--sgds-form-danger-border-color-default)}.form-control-group:not(.disabled).is-invalid:focus-within{outline:var(--sgds-border-width-2) solid var(--sgds-form-danger-color-default);outline-offset:var(--sgds-form-outline-offset-focus)}`;const ur=(t="value")=>(e,i)=>{const a=e.constructor,s=a.prototype.attributeChangedCallback;a.prototype.attributeChangedCallback=function(e,n,r){var o;const l=a.getPropertyOptions(t);if(e===("string"==typeof l.attribute?l.attribute:t).toLowerCase()){const e=l.converter||xe,a=("function"==typeof e?e:null!==(o=null==e?void 0:e.fromAttribute)&&void 0!==o?o:xe.fromAttribute)(r,l.type);this[t]!==a&&(this[i]=a)}s.call(this,e,n,r)}};class pr{constructor(t,e){(this.host=t).addController(this),this._internals=t._internals||this.host.attachInternals(),this.options=Object.assign({setInvalid:(t,e)=>{t.invalid=e},value:t=>t.value,input:t=>t.input},e)}hostConnected(){this.host.addEventListener("invalid",t=>this.handleInvalid(t))}hostDisconnected(){this.host.removeEventListener("invalid",t=>this.handleInvalid(t))}handleInvalid(t){t.preventDefault(),this.options.setInvalid(this.host,!0)}handleInput(t){const e=t.target;this.options.setInvalid(this.host,!1),this.validateInput(e)}handleChange(t){const e=t.target;this.validateInput(e),this.options.setInvalid(this.host,!this.checkValidity())}get form(){return this._internals.form}get validity(){return this._internals.validity}get validationMessage(){return this._internals.validationMessage}get willValidate(){return this._internals.willValidate}updateInvalidState(){this.options.setInvalid(this.host,!this.checkValidity())}resetValidity(){return this._internals.setValidity({})}checkValidity(){return this._internals.checkValidity()}reportValidity(){return this._internals.reportValidity()}setValidity(t,e,i){return this._internals.setValidity(t,e,i)}setFormValue(){const t=this.options.value(this.host);this._internals.setFormValue(t)}validateInput(t){if(this.options.input(this.host).disabled)return this._internals.setValidity({});const e=t.validity;if(e.valid)this._internals.setValidity({});else for(const i in e)e[i]&&(this.validationError=i.toString(),this._internals.setValidity({[this.validationError]:!0},t.validationMessage,t))}}const gr=e=>{class i extends e{constructor(...t){super(...t),this._isTouched=!1,this._internals=this.attachInternals()}connectedCallback(){var t;super.connectedCallback(),this._mixinShouldSkipSgdsValidation()||null!==(t=this.inputValidationController)&&void 0!==t||(this.inputValidationController=new pr(this))}async firstUpdated(t){super.firstUpdated(t),this.input=this.shadowRoot.querySelector("input")||await this.sgdsInput||this.shadowRoot.querySelector("textarea")||await this.sgdsDatepickerInput,this._mixinSetFormValue(),this._mixinShouldSkipSgdsValidation()||this._mixinValidate(this.input)}formResetCallback(){this._mixinResetFormControl?this._mixinResetFormControl():(this.value=this.defaultValue,this._mixinResetValidity(this.input)),this._mixinSetFormValue()}_mixinHandleChange(t){this._mixinSetFormValue(),this._mixinShouldSkipSgdsValidation()||this.inputValidationController.handleChange(t)}_mixinHandleInputChange(t){this._mixinSetFormValue(),this._mixinShouldSkipSgdsValidation()||this.inputValidationController.handleInput(t)}_mixinResetValidity(t){this._mixinShouldSkipSgdsValidation()||(this.inputValidationController.resetValidity(),this.inputValidationController.updateInvalidState(),this.inputValidationController.validateInput(t),this._isTouched&&(this._isTouched=!1))}_mixinValidate(t){this._mixinShouldSkipSgdsValidation()||this.inputValidationController.validateInput(t)}_mixinSetFormValue(){const t=this.value;this._internals.setFormValue(t)}_mixinCheckValidity(){return!!this._mixinShouldSkipSgdsValidation()||this.inputValidationController.checkValidity()}_mixinReportValidity(){return!!this._mixinShouldSkipSgdsValidation()||this.inputValidationController.reportValidity()}_mixinGetValidity(){return this._internals.validity}_mixinGetValidationMessage(){return this._internals.validationMessage}_mixinSetValidity(t,e,i){if(!this._mixinShouldSkipSgdsValidation())return this.inputValidationController.setValidity(t,e,i)}_mixinShouldSkipSgdsValidation(){const t=this.closest("form");return(null==t?void 0:t.noValidate)||this.noValidate}}return i.formAssociated=!0,t([Bi("sgds-input")],i.prototype,"sgdsInput",void 0),t([Bi("sgds-datepicker-input")],i.prototype,"sgdsDatepickerInput",void 0),i};var vr=re`:host{--input-border-radius:var(--sgds-form-border-radius-md);--input-min-width:var(--sgds-dimension-160)}.form-control-container{min-width:var(--input-min-width)}:host(.quantity-toggle) input::-webkit-inner-spin-button{appearance:none;margin:0}:host(.quantity-toggle) input{text-align:center}.form-control-prefix,.form-control-suffix{color:var(--sgds-form-color-subtle);display:flex;flex-shrink:0;gap:var(--sgds-gap-xs)}.form-control-group.quantity-toggle{padding:0}sgds-icon[role=button]{cursor:pointer}sgds-icon[role=button]:focus,sgds-icon[role=button]:focus-visible{outline:var(--sgds-form-outline-focus)}.form-control-row{align-items:center;display:flex;gap:var(--sgds-gap-sm)}`;class fr extends(gr(dr)){constructor(){super(...arguments),this.type="text",this.placeholder="placeholder",this.autofocus=!1,this.readonly=!1,this.defaultValue="",this.valid=!1,this.loading=!1,this.required=!1,this.noValidate=!1,this.value="",this._isTouched=!1,this._showPassword=!1}focus(t){this.input.focus(t)}blur(){this.input.blur()}reportValidity(){return this._mixinReportValidity()}checkValidity(){return this._mixinCheckValidity()}setValidity(t,e,i){return this._mixinSetValidity(t,e,i)}get validity(){return this._mixinGetValidity()}get validationMessage(){return this._mixinGetValidationMessage()}_handleFocus(){this.emit("sgds-focus")}_handleBlur(){const t=this.emit("sgds-blur",{cancelable:!0});this._mixinShouldSkipSgdsValidation()||t.defaultPrevented||(this.setInvalid(!this._mixinCheckValidity()),this._isTouched=!0)}_handleClick(){this.focus()}_handleChange(t){this.value=this.input.value;this.emit("sgds-change",{cancelable:!0}).defaultPrevented||super._mixinHandleChange(t)}_handleInputChange(t){this.value=this.input.value;this.emit("sgds-input",{cancelable:!0}).defaultPrevented||super._mixinHandleInputChange(t)}_handleIsTouched(){this._mixinShouldSkipSgdsValidation()||this._isTouched&&this.setInvalid(!this._mixinCheckValidity())}_handleDisabledChange(){this.setInvalid(!1)}_renderInput(){const t="both"===this.hasFeedback||"style"===this.hasFeedback;return Is`
2452
2452
  <div
2453
2453
  class="form-control-group ${Bs({disabled:this.disabled,readonly:this.readonly,"is-invalid":this.invalid&&t})}"
2454
2454
  @click=${this._handleClick}
@@ -2516,7 +2516,7 @@ class extends Ii{constructor(t){if(super(t),t.type!==Hi&&t.type!==Ei&&t.type!==$
2516
2516
  </div>
2517
2517
  ${this._renderFeedback()}
2518
2518
  </div>
2519
- `}}fr.styles=[...dr.styles,hr,cr,vr],fr.dependencies={"sgds-spinner":wn,"sgds-icon":vn},t([Zi({reflect:!0})],fr.prototype,"type",void 0),t([Zi({type:String})],fr.prototype,"prefix",void 0),t([Zi({type:String})],fr.prototype,"suffix",void 0),t([Zi({type:Number,reflect:!0})],fr.prototype,"minlength",void 0),t([Zi({type:Number,reflect:!0})],fr.prototype,"maxlength",void 0),t([Zi()],fr.prototype,"min",void 0),t([Zi()],fr.prototype,"max",void 0),t([Zi({type:String,reflect:!0})],fr.prototype,"placeholder",void 0),t([Zi({type:String})],fr.prototype,"pattern",void 0),t([Zi({type:Boolean,reflect:!0})],fr.prototype,"autofocus",void 0),t([Zi({type:Boolean,reflect:!0})],fr.prototype,"readonly",void 0),t([Zi()],fr.prototype,"step",void 0),t([Zi({type:String,reflect:!0})],fr.prototype,"hasFeedback",void 0),t([Zi({type:String,reflect:!0})],fr.prototype,"invalidFeedback",void 0),t([ur()],fr.prototype,"defaultValue",void 0),t([Zi({type:Boolean,reflect:!0})],fr.prototype,"valid",void 0),t([Zi({type:Boolean,reflect:!0})],fr.prototype,"loading",void 0),t([Zi({type:Boolean,reflect:!0})],fr.prototype,"required",void 0),t([Zi({type:Boolean,reflect:!0})],fr.prototype,"noValidate",void 0),t([Zi({reflect:!0})],fr.prototype,"value",void 0),t([Vi()],fr.prototype,"_isTouched",void 0),t([Vi()],fr.prototype,"_showPassword",void 0),t([As("_isTouched",{waitUntilFirstUpdate:!0})],fr.prototype,"_handleIsTouched",null),t([As("disabled",{waitUntilFirstUpdate:!0})],fr.prototype,"_handleDisabledChange",null);var mr=re`.datepicker-input-container{display:flex;flex-direction:row;width:-webkit-fill-available;width:-moz-available}.datepicker-input-container .form-control-group{border-right:0}.calendar-btn{all:unset}`;class wr extends fr{constructor(){super(),this.dateFormat="DD/MM/YYYY",this.mode="single",this._validateInput=async()=>{const t=this.mask.value.split(" - ").filter(t=>t!==this.dateFormat),e=t.map(t=>Ds(Jt(t,Zs[this.dateFormat].fnsPattern,new Date))),i=e.filter(t=>!u(t)||at(t,new Date(0,0,1))||at(t,Ds(new Date(this.minDate)))||it(t,Ds(new Date(this.maxDate))));return i.length>0||"range"===this.mode&&1===e.length?(this.setInvalid(!0),this.emit("sgds-invalid-input")):0===i.length&&e.length>0?(this.setInvalid(!1),this.emit("sgds-selectdates-input",{detail:e})):0===e.length&&0===i.length?(this.setInvalid(!1),this.emit("sgds-empty-input")):void 0},this.type="text",this._handleBlur=()=>null}async _handleChange(t){this.value=this.input.value,this.emit("sgds-change"),super._mixinHandleChange(t),await this._validateInput()}async firstUpdated(t){super.firstUpdated(t),this._applyInputMask(this.dateFormat)}async _applyInputMask(t){const e=await this.shadowInput,i="single"===this.mode?Zs[t].imPattern:Zs[t].imRangePattern,a={mask:i,pattern:i,eager:!0,overwrite:!0,parse:function(e){return e.split(" - ").map(e=>Jt(e,Zs[t].fnsPattern,new Date))},format:function(t){return t.map(t=>{let e,i="";const a=t.getDate(),s=t.getMonth()+1;return a<10&&(e="0"+a),s<10&&(i="0"+s),[e,i,t.getFullYear()].join("/")}).join(" - ")},lazy:!1,blocks:{d:{mask:$n.MaskedRange,placeholderChar:"D",from:0,to:9,maxLength:1},m:{mask:$n.MaskedRange,placeholderChar:"M",from:0,to:9,maxLength:1},y:{mask:$n.MaskedRange,placeholderChar:"Y",from:0,to:9,maxLength:1},D:{mask:$n.MaskedRange,placeholderChar:"D",from:0,to:9,maxLength:1},M:{mask:$n.MaskedRange,placeholderChar:"M",from:0,to:9,maxLength:1},Y:{mask:$n.MaskedRange,placeholderChar:"Y",from:0,to:9,maxLength:1}}};this.mask=$n(e,a),this.mask.on("accept",()=>{this.value=this.mask.masked.value,this.emit("sgds-mask-input-change",{detail:this.value})}),this.mask.on("complete",this._validateInput)}updateMaskValue(){var t;null===(t=this.mask)||void 0===t||t.updateValue()}destroyInputMask(){var t;null===(t=this.mask)||void 0===t||t.destroy()}async applyInputMask(){return await this._applyInputMask(this.dateFormat)}async focus(){return(await this.shadowInput).focus()}render(){return Je`
2519
+ `}}fr.styles=[...dr.styles,hr,cr,vr],fr.dependencies={"sgds-spinner":wn,"sgds-icon":vn},t([Zi({reflect:!0})],fr.prototype,"type",void 0),t([Zi({type:String})],fr.prototype,"prefix",void 0),t([Zi({type:String})],fr.prototype,"suffix",void 0),t([Zi({type:Number,reflect:!0})],fr.prototype,"minlength",void 0),t([Zi({type:Number,reflect:!0})],fr.prototype,"maxlength",void 0),t([Zi()],fr.prototype,"min",void 0),t([Zi()],fr.prototype,"max",void 0),t([Zi({type:String,reflect:!0})],fr.prototype,"placeholder",void 0),t([Zi({type:String})],fr.prototype,"pattern",void 0),t([Zi({type:Boolean,reflect:!0})],fr.prototype,"autofocus",void 0),t([Zi({type:Boolean,reflect:!0})],fr.prototype,"readonly",void 0),t([Zi()],fr.prototype,"step",void 0),t([Zi({type:String,reflect:!0})],fr.prototype,"hasFeedback",void 0),t([Zi({type:String,reflect:!0})],fr.prototype,"invalidFeedback",void 0),t([ur()],fr.prototype,"defaultValue",void 0),t([Zi({type:Boolean,reflect:!0})],fr.prototype,"valid",void 0),t([Zi({type:Boolean,reflect:!0})],fr.prototype,"loading",void 0),t([Zi({type:Boolean,reflect:!0})],fr.prototype,"required",void 0),t([Zi({type:Boolean,reflect:!0})],fr.prototype,"noValidate",void 0),t([Zi({reflect:!0})],fr.prototype,"value",void 0),t([Vi()],fr.prototype,"_isTouched",void 0),t([Vi()],fr.prototype,"_showPassword",void 0),t([As("_isTouched",{waitUntilFirstUpdate:!0})],fr.prototype,"_handleIsTouched",null),t([As("disabled",{waitUntilFirstUpdate:!0})],fr.prototype,"_handleDisabledChange",null);var mr=re`.datepicker-input-container{display:flex;flex-direction:row;width:-webkit-fill-available;width:-moz-available}.datepicker-input-container .form-control-group{border-right:0}.calendar-btn{all:unset}`;class wr extends fr{constructor(){super(),this.dateFormat="DD/MM/YYYY",this.mode="single",this._validateInput=async()=>{const t=this.mask.value.split(" - ").filter(t=>t!==this.dateFormat),e=t.map(t=>Ds(Jt(t,Zs[this.dateFormat].fnsPattern,new Date))),i=e.filter(t=>!u(t)||at(t,new Date(0,0,1))||at(t,Ds(new Date(this.minDate)))||it(t,Ds(new Date(this.maxDate))));return i.length>0||"range"===this.mode&&1===e.length?(this.setInvalid(!0),this.emit("i-sgds-invalid-input")):0===i.length&&e.length>0?(this.setInvalid(!1),this.emit("i-sgds-selectdates-input",{detail:e})):0===e.length&&0===i.length?(this.setInvalid(!1),this.emit("i-sgds-empty-input")):void 0},this.type="text"}_handleBlur(){const t=this.mask.value.split(" - ").filter(t=>t!==this.dateFormat),e=t.map(t=>Ds(Jt(t,Zs[this.dateFormat].fnsPattern,new Date))),i=e.filter(t=>!u(t)||at(t,new Date(0,0,1))||at(t,Ds(new Date(this.minDate)))||it(t,Ds(new Date(this.maxDate))));this.mask.masked.isComplete&&i.length>0&&e.length>0&&(this.value="",this.mask.value="",this.setInvalid(!1)),this.emit("sgds-blur")}async _handleChange(t){this.value=this.input.value,this.emit("sgds-change"),super._mixinHandleChange(t),await this._validateInput()}async firstUpdated(t){super.firstUpdated(t),this._applyInputMask(this.dateFormat)}async _applyInputMask(t){const e=await this.shadowInput,i="single"===this.mode?Zs[t].imPattern:Zs[t].imRangePattern,a={mask:i,pattern:i,eager:!0,overwrite:!0,parse:function(e){return e.split(" - ").map(e=>Jt(e,Zs[t].fnsPattern,new Date))},format:function(t){return t.map(t=>{let e,i="";const a=t.getDate(),s=t.getMonth()+1;return a<10&&(e="0"+a),s<10&&(i="0"+s),[e,i,t.getFullYear()].join("/")}).join(" - ")},lazy:!1,blocks:{d:{mask:$n.MaskedRange,placeholderChar:"D",from:0,to:9,maxLength:1},m:{mask:$n.MaskedRange,placeholderChar:"M",from:0,to:9,maxLength:1},y:{mask:$n.MaskedRange,placeholderChar:"Y",from:0,to:9,maxLength:1},D:{mask:$n.MaskedRange,placeholderChar:"D",from:0,to:9,maxLength:1},M:{mask:$n.MaskedRange,placeholderChar:"M",from:0,to:9,maxLength:1},Y:{mask:$n.MaskedRange,placeholderChar:"Y",from:0,to:9,maxLength:1}}};this.mask=$n(e,a),this.mask.on("accept",()=>{this.value=this.mask.masked.value,this.emit("i-sgds-mask-input-change",{detail:this.value})}),this.mask.on("complete",this._validateInput)}updateMaskValue(){var t;null===(t=this.mask)||void 0===t||t.updateValue()}destroyInputMask(){var t;null===(t=this.mask)||void 0===t||t.destroy()}async applyInputMask(){return await this._applyInputMask(this.dateFormat)}async focus(){return(await this.shadowInput).focus()}render(){return Je`
2520
2520
  <div
2521
2521
  class="form-control-container ${Bs({disabled:this.disabled})}"
2522
2522
  >
@@ -2527,7 +2527,7 @@ class extends Ii{constructor(t){if(super(t),t.type!==Hi&&t.type!==Ei&&t.type!==$
2527
2527
  </div>
2528
2528
  ${this._renderFeedback()}
2529
2529
  </div>
2530
- `}}wr.styles=[...fr.styles,mr],t([Zi({type:String})],wr.prototype,"minDate",void 0),t([Zi({type:String})],wr.prototype,"maxDate",void 0),t([Zi({type:String,reflect:!0})],wr.prototype,"mode",void 0),t([Bi("input")],wr.prototype,"shadowInput",void 0);var yr,br,xr=re`:host{--datepicker-theme-color:var(--sgds-primary);--datepicker-hover-bg:var(--sgds-primary-100);--datepicker-bg:#fff;--datepicker-close-btn-bg:var(--datepicker-theme-color);--datepicker-close-btn-hover-bg:var(--sgds-primary-700);--datepicker-close-btn-color:#fff;--datepicker-selected-date-bg:var(--sgds-primary);--datepicker-selected-date-color:#fff;font-size:var(--sgds-font-size-14)}:host([menuisopen]:not([disabled]):not([readonly])) .dropdown-menu{background-color:var(--sgds-form-surface-default);display:flex;flex-direction:column;gap:var(--sgds-form-gap-sm);overflow:unset;padding:var(--sgds-form-padding-y) var(--sgds-form-padding-x);width:var(--sgds-dimension-320)}.dropdown{display:flex;height:100%}sgds-datepicker-input{--input-border-radius:var(--sgds-form-border-radius-md) 0 0 var(--sgds-form-border-radius-md);flex:1;margin-right:0}sgds-icon-button{--btn-border-radius:0 var(--sgds-form-border-radius-md) var(--sgds-form-border-radius-md) 0}.m-width-160{min-width:var(--sgds-dimension-160)}`;class _r extends(gr(Ms)){constructor(){super(),this.required=!1,this.disabled=!1,this.noValidate=!1,this.value="",this.initialValue=[],this.dateFormat="DD/MM/YYYY",this.minDate="",this.maxDate="",this.mode="single",this.hasFeedback=!1,this.label="",this.hintText="",this.noFlip=!1,this.drop="down",this.defaultValue="",this.invalid=!1,this.view="days",this.selectedDateRange=[],this.focusedTabIndex=3,this.initialDisplayDate=new Date,this._makeInputValueString=(t,e,i)=>{if(!t&&!e)return this.value;const a=t=>X(t,Zs[i].fnsPattern);switch(this.mode){case"single":t&&(this.value=a(t));break;case"range":t&&e&&(this.value=`${a(t)} - ${a(e)}`),t&&!e&&(this.value=`${a(t)} - ${this.dateFormat}`)}return this.value},this._dialogAriaLabels={days:"Choose date",months:"Choose month",years:"Choose year"},this.floatingOpts={placement:"bottom-end"}}isValueEmpty(){return""===this.value||"DD/MM/YYYY"===this.value||"DD/MM/YYYY - DD/MM/YYYY"===this.value}reportValidity(){return this._mixinReportValidity()}checkValidity(){return this._mixinCheckValidity()}setInvalid(t){this.invalid=t,this.datepickerInput&&this.datepickerInput.setInvalid(t)}setValidity(t,e,i){return this._mixinSetValidity(t,e,i)}get validity(){return this._mixinGetValidity()}get validationMessage(){return this._mixinGetValidationMessage()}async connectedCallback(){if(super.connectedCallback(),this.addEventListener("sgds-view",this._handleViewChanged),this.addEventListener("sgds-change-calendar",this._handleDateChanged),this.addEventListener("sgds-update-focus",this._handleFocusDateChanged),this.addEventListener("sgds-selectmonth",this._handleSelectMonth),this.addEventListener("sgds-selectyear",this._handleSelectYear),this.addEventListener("sgds-selectdates",this._handleSelectDatesAndClose),this.addEventListener("sgds-selectdates-input",this._handleSelectDatesInput),this.addEventListener("sgds-empty-input",this._handleEmptyInput),this.addEventListener("keydown",this._handleTab),this.addEventListener("sgds-hide",this._handleCloseMenu),this.addEventListener("sgds-show",this._handleOpenMenu),this.addEventListener("blur",this._mixinCheckValidity),this.initialValue=this.value?this.value.split(" - ").map(t=>t.trim()):this.initialValue,this.initialDisplayDate=this.displayDate||new Date,this.initialValue&&this.initialValue.length>0){const t=new RegExp(this._getDateFormatRegex()),e=this.initialValue.filter(e=>!t.test(e));if(e.length>0)return console.error("Invalid date format in initialValue:",e);{const t=this.initialValue.map(t=>Ds(Jt(t,Zs[this.dateFormat].fnsPattern,new Date)));this._handleSelectDates(t)}}else this.displayDate=this.initialDisplayDate;(await this.datepickerInputAsync).setInvalid(this.invalid)}async firstUpdated(t){if(super.firstUpdated(t),this.menuIsOpen){const t=await this.datepickerInputAsync;await this.updateFloatingPosition();(await this.calendar).focusOnCalendar(t)}}_getDateFormatRegex(){return this.dateFormat.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace("MM","\\d{2}").replace("DD","\\d{2}").replace("YYYY","\\d{4}").replace("/","\\/")}_handleTab(t){if(!this.menuIsOpen)return;const e=Array(4);t.shiftKey&&"Tab"===t.key?(t.preventDefault(),this.focusedTabIndex=(this.focusedTabIndex-1+e.length)%e.length):"Tab"===t.key&&(t.preventDefault(),this.focusedTabIndex=(this.focusedTabIndex+1+e.length)%e.length)}_handleValueChange(){this.emit("sgds-change-date")}async _handleCloseMenu(){if((await this.datepickerInputAsync).focus(),0===this.selectedDateRange.length)this.displayDate=this.initialDisplayDate;else{const t=this.selectedDateRange.length;this.displayDate=this.selectedDateRange[t-1];(await this.calendar)._updateFocusedDate()}}async _handleOpenMenu(){const t=await this.calendar,e=await this.datepickerInputAsync;t.focusOnCalendar(e)}_handleSelectDatesInput(t){this._handleSelectDates(t.detail)}async _handleSelectDates(t){t.sort((t,e)=>t.getTime()-e.getTime()),this.displayDate=t[0],this.focusedDate=t[0],this.selectedDateRange=t;const e=this._makeInputValueString(this.selectedDateRange[0],this.selectedDateRange[1],this.dateFormat);this.value=e;(await this.datepickerInputAsync).updateMaskValue(),this._manageInternalsValid()}async _handleSelectDatesAndClose(t){await this._handleSelectDates(t.detail),("range"===this.mode&&2===this.selectedDateRange.length||"single"===this.mode&&1===this.selectedDateRange.length)&&this.hideMenu()}_handleViewChanged(t){this.view=t.detail}_handleDateChanged(t){this.displayDate=t.detail}_handleFocusDateChanged(t){this.focusedDate=t.detail}_handleSelectMonth(t){this.displayDate=t.detail}_handleSelectYear(t){this.displayDate=t.detail}async _handleInvalidInput(){this.selectedDateRange=[],this.displayDate=this.initialDisplayDate,this._mixinShouldSkipSgdsValidation()||(this.invalid=!0,this._manageInternalsBadInput())}async _handleEmptyInput(){this.required&&this._manageEmptyInput()}async _resetDatepicker(t=""){this.displayDate=this.initialDisplayDate,this.selectedDateRange=[],this.value=t,this.view="days";const e=await this.datepickerInputAsync;e.setInvalid(this.invalid),e.destroyInputMask(),await e.applyInputMask(),this._mixinResetValidity(e),this.isValueEmpty()&&this._handleEmptyInput()}_manageInternalsBadInput(){this._mixinSetValidity({badInput:!0},"Invalid date input",this.datepickerInput)}_manageEmptyInput(){this._mixinSetValidity({valueMissing:!0},"Please fill in this field",this.datepickerInput)}_manageInternalsValid(){this._mixinSetFormValue(),this._mixinShouldSkipSgdsValidation()||(this._mixinSetValidity({}),this.invalid=this.datepickerInput.invalid=!1)}async _mixinResetFormControl(){this._resetDatepicker(this.defaultValue)}async _handleInputMaskChange(t){this.value=t.detail,this.isValueEmpty()&&this._resetDatepicker()}render(){return Je`
2530
+ `}}wr.styles=[...fr.styles,mr],t([Zi({type:String})],wr.prototype,"minDate",void 0),t([Zi({type:String})],wr.prototype,"maxDate",void 0),t([Zi({type:String,reflect:!0})],wr.prototype,"mode",void 0),t([Bi("input")],wr.prototype,"shadowInput",void 0);var yr,br,xr=re`:host{--datepicker-theme-color:var(--sgds-primary);--datepicker-hover-bg:var(--sgds-primary-100);--datepicker-bg:#fff;--datepicker-close-btn-bg:var(--datepicker-theme-color);--datepicker-close-btn-hover-bg:var(--sgds-primary-700);--datepicker-close-btn-color:#fff;--datepicker-selected-date-bg:var(--sgds-primary);--datepicker-selected-date-color:#fff;font-size:var(--sgds-font-size-14)}:host([menuisopen]:not([disabled]):not([readonly])) .dropdown-menu{background-color:var(--sgds-form-surface-default);display:flex;flex-direction:column;gap:var(--sgds-form-gap-sm);overflow:unset;padding:var(--sgds-form-padding-y) var(--sgds-form-padding-x);width:var(--sgds-dimension-320)}.dropdown{display:flex;height:100%}sgds-datepicker-input{--input-border-radius:var(--sgds-form-border-radius-md) 0 0 var(--sgds-form-border-radius-md);flex:1;margin-right:0}sgds-icon-button{--btn-border-radius:0 var(--sgds-form-border-radius-md) var(--sgds-form-border-radius-md) 0}.m-width-160{min-width:var(--sgds-dimension-160)}`;class _r extends(gr(Ms)){constructor(){super(),this.required=!1,this.disabled=!1,this.noValidate=!1,this.value="",this.initialValue=[],this.dateFormat="DD/MM/YYYY",this.minDate="",this.maxDate="",this.mode="single",this.hasFeedback=!1,this.label="",this.hintText="",this.noFlip=!1,this.drop="down",this.defaultValue="",this.invalid=!1,this.view="days",this.selectedDateRange=[],this.focusedTabIndex=3,this.initialDisplayDate=new Date,this._makeInputValueString=(t,e,i)=>{if(!t&&!e)return this.value;const a=t=>X(t,Zs[i].fnsPattern);switch(this.mode){case"single":t&&(this.value=a(t));break;case"range":t&&e&&(this.value=`${a(t)} - ${a(e)}`),t&&!e&&(this.value=`${a(t)} - ${this.dateFormat}`)}return this.value},this._dialogAriaLabels={days:"Choose date",months:"Choose month",years:"Choose year"},this.floatingOpts={placement:"bottom-end"}}isValueEmpty(){return""===this.value||"DD/MM/YYYY"===this.value||"DD/MM/YYYY - DD/MM/YYYY"===this.value}reportValidity(){return this._mixinReportValidity()}checkValidity(){return this._mixinCheckValidity()}setInvalid(t){this.invalid=t,this.datepickerInput&&this.datepickerInput.setInvalid(t)}setValidity(t,e,i){return this._mixinSetValidity(t,e,i)}get validity(){return this._mixinGetValidity()}get validationMessage(){return this._mixinGetValidationMessage()}async connectedCallback(){if(super.connectedCallback(),this.addEventListener("sgds-view",this._handleViewChanged),this.addEventListener("sgds-change-calendar",this._handleDateChanged),this.addEventListener("sgds-update-focus",this._handleFocusDateChanged),this.addEventListener("sgds-selectmonth",this._handleSelectMonth),this.addEventListener("sgds-selectyear",this._handleSelectYear),this.addEventListener("sgds-selectdates",this._handleSelectDatesAndClose),this.addEventListener("i-sgds-selectdates-input",this._handleSelectDatesInput),this.addEventListener("i-sgds-empty-input",this._handleEmptyInput),this.addEventListener("keydown",this._handleTab),this.addEventListener("sgds-hide",this._handleCloseMenu),this.addEventListener("sgds-show",this._handleOpenMenu),this.addEventListener("blur",this._mixinCheckValidity),this.initialValue=this.value?this.value.split(" - ").map(t=>t.trim()):this.initialValue,this.initialDisplayDate=this.displayDate||new Date,this.initialValue&&this.initialValue.length>0){const t=new RegExp(this._getDateFormatRegex()),e=this.initialValue.filter(e=>!t.test(e));if(e.length>0)return console.error("Invalid date format in initialValue:",e);{const t=this.initialValue.map(t=>Ds(Jt(t,Zs[this.dateFormat].fnsPattern,new Date)));this._handleSelectDates(t)}}else this.displayDate=this.initialDisplayDate;(await this.datepickerInputAsync).setInvalid(this.invalid)}async firstUpdated(t){if(super.firstUpdated(t),this.menuIsOpen){const t=await this.datepickerInputAsync;await this.updateFloatingPosition();(await this.calendar).focusOnCalendar(t)}}_getDateFormatRegex(){return this.dateFormat.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace("MM","\\d{2}").replace("DD","\\d{2}").replace("YYYY","\\d{4}").replace("/","\\/")}_handleTab(t){if(!this.menuIsOpen)return;const e=Array(4);t.shiftKey&&"Tab"===t.key?(t.preventDefault(),this.focusedTabIndex=(this.focusedTabIndex-1+e.length)%e.length):"Tab"===t.key&&(t.preventDefault(),this.focusedTabIndex=(this.focusedTabIndex+1+e.length)%e.length)}_handleValueChange(){this.emit("sgds-change-date")}async _handleCloseMenu(){if((await this.datepickerInputAsync).focus(),0===this.selectedDateRange.length)this.displayDate=this.initialDisplayDate;else{const t=this.selectedDateRange.length;this.displayDate=this.selectedDateRange[t-1];(await this.calendar)._updateFocusedDate()}}async _handleOpenMenu(){const t=await this.calendar,e=await this.datepickerInputAsync;t.focusOnCalendar(e)}_handleSelectDatesInput(t){this._handleSelectDates(t.detail)}async _handleSelectDates(t){t.sort((t,e)=>t.getTime()-e.getTime()),this.displayDate=t[0],this.focusedDate=t[0],this.selectedDateRange=t;const e=this._makeInputValueString(this.selectedDateRange[0],this.selectedDateRange[1],this.dateFormat);this.value=e;(await this.datepickerInputAsync).updateMaskValue(),this._manageInternalsValid()}async _handleSelectDatesAndClose(t){await this._handleSelectDates(t.detail),("range"===this.mode&&2===this.selectedDateRange.length||"single"===this.mode&&1===this.selectedDateRange.length)&&this.hideMenu()}_handleViewChanged(t){this.view=t.detail}_handleDateChanged(t){this.displayDate=t.detail}_handleFocusDateChanged(t){this.focusedDate=t.detail}_handleSelectMonth(t){this.displayDate=t.detail}_handleSelectYear(t){this.displayDate=t.detail}async _handleInvalidInput(){this.selectedDateRange=[],this.displayDate=this.initialDisplayDate,this._mixinShouldSkipSgdsValidation()||(this.invalid=!0,this._manageInternalsBadInput())}async _handleEmptyInput(){this.required&&this._manageEmptyInput()}async _resetDatepicker(t=""){this.displayDate=this.initialDisplayDate,this.selectedDateRange=[],this.value=t,this.view="days";const e=await this.datepickerInputAsync;e.setInvalid(this.invalid),e.destroyInputMask(),await e.applyInputMask(),this._mixinResetValidity(e),this.isValueEmpty()&&this._handleEmptyInput()}_manageInternalsBadInput(){this._mixinSetValidity({badInput:!0},"Invalid date input",this.datepickerInput)}_manageEmptyInput(){this._mixinSetValidity({valueMissing:!0},"Please fill in this field",this.datepickerInput)}_manageInternalsValid(){this._mixinSetFormValue(),this._mixinShouldSkipSgdsValidation()||(this._mixinSetValidity({}),this.invalid=this.datepickerInput.invalid=!1)}async _mixinResetFormControl(){this._resetDatepicker(this.defaultValue)}async _handleInputMaskChange(t){this.value=t.detail,this.isValueEmpty()&&this._resetDatepicker()}render(){return Je`
2531
2531
  <div class="datepicker-container m-width-160">
2532
2532
  <sgds-datepicker-input
2533
2533
  .value=${Ri(this.value)}
@@ -2536,8 +2536,8 @@ class extends Ii{constructor(t){if(super(t),t.type!==Hi&&t.type!==Ei&&t.type!==$
2536
2536
  placeholder=${"single"===this.mode?"DD/MM/YYYY":"DD/MM/YYYY - DD/MM/YYYY"}
2537
2537
  mode=${this.mode}
2538
2538
  invalidFeedback=${Es(this.invalidFeedback?this.invalidFeedback:this._mixinGetValidationMessage())}
2539
- @sgds-mask-input-change=${this._handleInputMaskChange}
2540
- @sgds-invalid-input=${this._handleInvalidInput}
2539
+ @i-sgds-mask-input-change=${this._handleInputMaskChange}
2540
+ @i-sgds-invalid-input=${this._handleInvalidInput}
2541
2541
  minDate=${this.minDate}
2542
2542
  maxDate=${this.maxDate}
2543
2543
  label=${this.label}