overview-components 1.0.80 → 1.0.82

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist/schemas/lit-attachments-tab.schema.js +1 -1
  2. package/dist/schemas/lit-attachments-tab.schema.js.map +1 -1
  3. package/dist/schemas/lit-tabs-overview-tab-array.schema.js +1 -1
  4. package/dist/schemas/lit-tabs-overview-tab-array.schema.js.map +1 -1
  5. package/dist/schemas/lit-tabs-overview.schema.js +1 -1
  6. package/dist/schemas/lit-tabs-overview.schema.js.map +1 -1
  7. package/package.json +1 -1
  8. package/dist/_virtual/FileSaver.min.js +0 -4
  9. package/dist/_virtual/_commonjsHelpers.js +0 -8
  10. package/dist/_virtual/air-datepicker.js +0 -4
  11. package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +0 -486
  12. package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +0 -391
  13. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +0 -131
  14. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +0 -129
  15. package/dist/node_modules/@lit/localize/init/install.js +0 -11
  16. package/dist/node_modules/@lit/localize/init/runtime.js +0 -42
  17. package/dist/node_modules/@lit/localize/internal/default-msg.js +0 -10
  18. package/dist/node_modules/@lit/localize/internal/deferred.js +0 -21
  19. package/dist/node_modules/@lit/localize/internal/fnv1a64.js +0 -17
  20. package/dist/node_modules/@lit/localize/internal/id-generation.js +0 -14
  21. package/dist/node_modules/@lit/localize/internal/locale-status-event.js +0 -9
  22. package/dist/node_modules/@lit/localize/internal/runtime-msg.js +0 -42
  23. package/dist/node_modules/@lit/localize/internal/str-tag.js +0 -15
  24. package/dist/node_modules/@lit/react/create-component.js +0 -35
  25. package/dist/node_modules/@lit/reactive-element/css-tag.js +0 -50
  26. package/dist/node_modules/@lit/reactive-element/decorators/base.js +0 -9
  27. package/dist/node_modules/@lit/reactive-element/decorators/custom-element.js +0 -13
  28. package/dist/node_modules/@lit/reactive-element/decorators/property.js +0 -37
  29. package/dist/node_modules/@lit/reactive-element/decorators/query.js +0 -20
  30. package/dist/node_modules/@lit/reactive-element/decorators/state.js +0 -12
  31. package/dist/node_modules/@lit/reactive-element/reactive-element.js +0 -250
  32. package/dist/node_modules/@tanstack/lit-table/build/lib/index.js +0 -104
  33. package/dist/node_modules/@tanstack/lit-virtual/dist/esm/index.js +0 -40
  34. package/dist/node_modules/@tanstack/table-core/build/lib/index.js +0 -1956
  35. package/dist/node_modules/@tanstack/virtual-core/dist/esm/index.js +0 -490
  36. package/dist/node_modules/@tanstack/virtual-core/dist/esm/utils.js +0 -52
  37. package/dist/node_modules/air-datepicker/air-datepicker.js +0 -1147
  38. package/dist/node_modules/air-datepicker/index.es.js +0 -4
  39. package/dist/node_modules/file-saver/dist/FileSaver.min.js +0 -74
  40. package/dist/node_modules/lit-element/lit-element.js +0 -51
  41. package/dist/node_modules/lit-html/async-directive.js +0 -69
  42. package/dist/node_modules/lit-html/directive-helpers.js +0 -45
  43. package/dist/node_modules/lit-html/directive.js +0 -27
  44. package/dist/node_modules/lit-html/directives/class-map.js +0 -34
  45. package/dist/node_modules/lit-html/directives/ref.js +0 -42
  46. package/dist/node_modules/lit-html/directives/repeat.js +0 -61
  47. package/dist/node_modules/lit-html/directives/style-map.js +0 -36
  48. package/dist/node_modules/lit-html/directives/unsafe-html.js +0 -27
  49. package/dist/node_modules/lit-html/lit-html.js +0 -243
  50. package/dist/node_modules/luxon/src/datetime.js +0 -1793
  51. package/dist/node_modules/luxon/src/duration.js +0 -723
  52. package/dist/node_modules/luxon/src/errors.js +0 -40
  53. package/dist/node_modules/luxon/src/impl/conversions.js +0 -92
  54. package/dist/node_modules/luxon/src/impl/diff.js +0 -36
  55. package/dist/node_modules/luxon/src/impl/digits.js +0 -74
  56. package/dist/node_modules/luxon/src/impl/english.js +0 -138
  57. package/dist/node_modules/luxon/src/impl/formats.js +0 -150
  58. package/dist/node_modules/luxon/src/impl/formatter.js +0 -245
  59. package/dist/node_modules/luxon/src/impl/invalid.js +0 -11
  60. package/dist/node_modules/luxon/src/impl/locale.js +0 -282
  61. package/dist/node_modules/luxon/src/impl/regexParser.js +0 -202
  62. package/dist/node_modules/luxon/src/impl/tokenParser.js +0 -329
  63. package/dist/node_modules/luxon/src/impl/util.js +0 -206
  64. package/dist/node_modules/luxon/src/impl/zoneUtil.js +0 -19
  65. package/dist/node_modules/luxon/src/info.js +0 -180
  66. package/dist/node_modules/luxon/src/interval.js +0 -466
  67. package/dist/node_modules/luxon/src/settings.js +0 -150
  68. package/dist/node_modules/luxon/src/zone.js +0 -88
  69. package/dist/node_modules/luxon/src/zones/IANAZone.js +0 -178
  70. package/dist/node_modules/luxon/src/zones/fixedOffsetZone.js +0 -125
  71. package/dist/node_modules/luxon/src/zones/invalidZone.js +0 -41
  72. package/dist/node_modules/luxon/src/zones/systemZone.js +0 -47
  73. package/dist/node_modules/sortablejs/modular/sortable.esm.js +0 -1261
@@ -1,1147 +0,0 @@
1
- import { getDefaultExportFromCjs as fe, commonjsGlobal as De } from "../../_virtual/_commonjsHelpers.js";
2
- import { __module as re } from "../../_virtual/air-datepicker.js";
3
- (function(he, we) {
4
- (function(W, z) {
5
- he.exports = z();
6
- })(De, function() {
7
- return function() {
8
- var W = { d: function(h, e) {
9
- for (var i in e) W.o(e, i) && !W.o(h, i) && Object.defineProperty(h, i, { enumerable: !0, get: e[i] });
10
- }, o: function(h, e) {
11
- return Object.prototype.hasOwnProperty.call(h, e);
12
- } }, z = {};
13
- W.d(z, { default: function() {
14
- return F;
15
- } });
16
- var l = { days: "days", months: "months", years: "years", day: "day", month: "month", year: "year", eventChangeViewDate: "changeViewDate", eventChangeCurrentView: "changeCurrentView", eventChangeFocusDate: "changeFocusDate", eventChangeSelectedDate: "changeSelectedDate", eventChangeTime: "changeTime", eventChangeLastSelectedDate: "changeLastSelectedDate", actionSelectDate: "selectDate", actionUnselectDate: "unselectDate", cssClassWeekend: "-weekend-" }, te = { classes: "", inline: !1, locale: { days: ["Воскресенье", "Понедельник", "Вторник", "Среда", "Четверг", "Пятница", "Суббота"], daysShort: ["Вос", "Пон", "Вто", "Сре", "Чет", "Пят", "Суб"], daysMin: ["Вс", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"], months: ["Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь"], monthsShort: ["Янв", "Фев", "Мар", "Апр", "Май", "Июн", "Июл", "Авг", "Сен", "Окт", "Ноя", "Дек"], today: "Сегодня", clear: "Очистить", dateFormat: "dd.MM.yyyy", timeFormat: "HH:mm", firstDay: 1 }, startDate: /* @__PURE__ */ new Date(), firstDay: "", weekends: [6, 0], dateFormat: "", altField: "", altFieldDateFormat: "T", toggleSelected: !0, keyboardNav: !0, selectedDates: !1, container: "", isMobile: !1, visible: !1, position: "bottom left", offset: 12, view: l.days, minView: l.days, showOtherMonths: !0, selectOtherMonths: !0, moveToOtherMonthsOnSelect: !0, showOtherYears: !0, selectOtherYears: !0, moveToOtherYearsOnSelect: !0, minDate: "", maxDate: "", disableNavWhenOutOfRange: !0, multipleDates: !1, multipleDatesSeparator: ", ", range: !1, dynamicRange: !0, buttons: !1, monthsField: "monthsShort", showEvent: "focus", autoClose: !1, fixedHeight: !1, prevHtml: '<svg><path d="M 17,12 l -5,5 l 5,5"></path></svg>', nextHtml: '<svg><path d="M 14,12 l 5,5 l -5,5"></path></svg>', navTitles: { days: "MMMM, <i>yyyy</i>", months: "yyyy", years: "yyyy1 - yyyy2" }, timepicker: !1, onlyTimepicker: !1, dateTimeSeparator: " ", timeFormat: "", minHours: 0, maxHours: 24, minMinutes: 0, maxMinutes: 59, hoursStep: 1, minutesStep: 1, onSelect: !1, onChangeViewDate: !1, onChangeView: !1, onRenderCell: !1, onShow: !1, onHide: !1, onClickDayName: !1 };
17
- function y(h) {
18
- let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : document;
19
- return typeof h == "string" ? e.querySelector(h) : h;
20
- }
21
- function $() {
22
- let { tagName: h = "div", className: e = "", innerHtml: i = "", id: t = "", attrs: n = {} } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, a = document.createElement(h);
23
- return e && a.classList.add(...e.split(" ")), t && (a.id = t), i && (a.innerHTML = i), n && X(a, n), a;
24
- }
25
- function X(h, e) {
26
- for (let [i, t] of Object.entries(e)) t !== void 0 && h.setAttribute(i, t);
27
- return h;
28
- }
29
- function ie(h) {
30
- return new Date(h.getFullYear(), h.getMonth() + 1, 0).getDate();
31
- }
32
- function g(h) {
33
- let e = h.getHours(), { hours: i, dayPeriod: t } = se(e);
34
- return { year: h.getFullYear(), month: h.getMonth(), fullMonth: h.getMonth() + 1 < 10 ? "0" + (h.getMonth() + 1) : h.getMonth() + 1, date: h.getDate(), fullDate: h.getDate() < 10 ? "0" + h.getDate() : h.getDate(), day: h.getDay(), hours: e, fullHours: P(e), hours12: i, dayPeriod: t, fullHours12: P(i), minutes: h.getMinutes(), fullMinutes: h.getMinutes() < 10 ? "0" + h.getMinutes() : h.getMinutes() };
35
- }
36
- function se(h) {
37
- return { dayPeriod: h > 11 ? "pm" : "am", hours: h % 12 == 0 ? 12 : h % 12 };
38
- }
39
- function P(h) {
40
- return h < 10 ? "0" + h : h;
41
- }
42
- function x(h) {
43
- let e = 10 * Math.floor(h.getFullYear() / 10);
44
- return [e, e + 9];
45
- }
46
- function _() {
47
- let h = [];
48
- for (var e = arguments.length, i = new Array(e), t = 0; t < e; t++) i[t] = arguments[t];
49
- return i.forEach((n) => {
50
- if (typeof n == "object") for (let a in n) n[a] && h.push(a);
51
- else n && h.push(n);
52
- }), h.join(" ");
53
- }
54
- function f(h, e) {
55
- let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : l.days;
56
- if (!h || !e) return !1;
57
- let t = g(h), n = g(e);
58
- return { [l.days]: t.date === n.date && t.month === n.month && t.year === n.year, [l.months]: t.month === n.month && t.year === n.year, [l.years]: t.year === n.year }[i];
59
- }
60
- function S(h, e, i) {
61
- let t = G(h, !1).getTime(), n = G(e, !1).getTime();
62
- return i ? t >= n : t > n;
63
- }
64
- function j(h, e) {
65
- return !S(h, e, !0);
66
- }
67
- function G(h) {
68
- let e = !(arguments.length > 1 && arguments[1] !== void 0) || arguments[1], i = new Date(h.getTime());
69
- return typeof e != "boolean" || e || function(t) {
70
- t.setHours(0, 0, 0, 0);
71
- }(i), i;
72
- }
73
- function b(h, e, i) {
74
- h.length ? h.forEach((t) => {
75
- t.addEventListener(e, i);
76
- }) : h.addEventListener(e, i);
77
- }
78
- function K(h, e) {
79
- return !(!h || h === document || h instanceof DocumentFragment) && (h.matches(e) ? h : K(h.parentNode, e));
80
- }
81
- function B(h, e, i) {
82
- return h > i ? i : h < e ? e : h;
83
- }
84
- function q(h) {
85
- for (var e = arguments.length, i = new Array(e > 1 ? e - 1 : 0), t = 1; t < e; t++) i[t - 1] = arguments[t];
86
- return i.filter((n) => n).forEach((n) => {
87
- for (let [a, s] of Object.entries(n)) if (s !== void 0 && s.toString() === "[object Object]") {
88
- let r = h[a] !== void 0 ? h[a].toString() : void 0, o = s.toString(), d = Array.isArray(s) ? [] : {};
89
- h[a] = h[a] ? r !== o ? d : h[a] : d, q(h[a], s);
90
- } else h[a] = s;
91
- }), h;
92
- }
93
- function k(h) {
94
- let e = h;
95
- return h instanceof Date || (typeof h == "string" && /^\d{4}-\d{2}-\d{2}$/.test(h) && (h += "T00:00:00"), e = new Date(h)), isNaN(e.getTime()) && (console.log(`Unable to convert value "${h}" to Date object`), e = !1), e;
96
- }
97
- function Q(h) {
98
- let e = "\\s|\\.|-|/|\\\\|,|\\$|\\!|\\?|:|;";
99
- return new RegExp("(^|>|" + e + ")(" + h + ")($|<|" + e + ")", "g");
100
- }
101
- function E(h, e, i) {
102
- return (e = function(t) {
103
- var n = function(a, s) {
104
- if (typeof a != "object" || a === null) return a;
105
- var r = a[Symbol.toPrimitive];
106
- if (r !== void 0) {
107
- var o = r.call(a, "string");
108
- if (typeof o != "object") return o;
109
- throw new TypeError("@@toPrimitive must return a primitive value.");
110
- }
111
- return String(a);
112
- }(t);
113
- return typeof n == "symbol" ? n : String(n);
114
- }(e)) in h ? Object.defineProperty(h, e, { value: i, enumerable: !0, configurable: !0, writable: !0 }) : h[e] = i, h;
115
- }
116
- class oe {
117
- constructor() {
118
- let { type: e, date: i, dp: t, opts: n, body: a } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
119
- E(this, "focus", () => {
120
- this.$cell.classList.add("-focus-"), this.focused = !0;
121
- }), E(this, "removeFocus", () => {
122
- this.$cell.classList.remove("-focus-"), this.focused = !1;
123
- }), E(this, "select", () => {
124
- this.$cell.classList.add("-selected-"), this.selected = !0;
125
- }), E(this, "removeSelect", () => {
126
- this.$cell.classList.remove("-selected-", "-range-from-", "-range-to-"), this.selected = !1;
127
- }), E(this, "onChangeSelectedDate", () => {
128
- this.isDisabled || (this._handleSelectedStatus(), this.opts.range && this._handleRangeStatus());
129
- }), E(this, "onChangeFocusDate", (s) => {
130
- if (!s) return void (this.focused && this.removeFocus());
131
- let r = f(s, this.date, this.type);
132
- r ? this.focus() : !r && this.focused && this.removeFocus(), this.opts.range && this._handleRangeStatus();
133
- }), E(this, "render", () => (this.$cell.innerHTML = this._getHtml(), this._handleClasses(), this.$cell)), this.type = e, this.singleType = this.type.slice(0, -1), this.date = i, this.dp = t, this.opts = n, this.body = a, this.customData = !1, this.init();
134
- }
135
- init() {
136
- var e, i;
137
- let { onRenderCell: t } = this.opts;
138
- t && (this.customData = t({ date: this.date, cellType: this.singleType, datepicker: this.dp })), this._createElement(), this._bindDatepickerEvents(), (e = this.customData) !== null && e !== void 0 && e.disabled ? this.dp.disableDate(this.date) : ((i = this.customData) === null || i === void 0 ? void 0 : i.disabled) === !1 && this.dp.enableDate(this.date);
139
- }
140
- _bindDatepickerEvents() {
141
- this.dp.on(l.eventChangeSelectedDate, this.onChangeSelectedDate), this.dp.on(l.eventChangeFocusDate, this.onChangeFocusDate);
142
- }
143
- unbindDatepickerEvents() {
144
- this.dp.off(l.eventChangeSelectedDate, this.onChangeSelectedDate), this.dp.off(l.eventChangeFocusDate, this.onChangeFocusDate);
145
- }
146
- _createElement() {
147
- var e;
148
- let { year: i, month: t, fullMonth: n, date: a, fullDate: s } = g(this.date), r = ((e = this.customData) === null || e === void 0 ? void 0 : e.attrs) || {};
149
- this.$cell = $({ attrs: { "data-year": i, "data-month": t, "data-date": a, "data-iso-date": `${i}-${n}-${s}`, ...r } }), this.$cell.adpCell = this;
150
- }
151
- _getClassName() {
152
- var e;
153
- let i = /* @__PURE__ */ new Date(), { selectOtherMonths: t, selectOtherYears: n } = this.opts, { minDate: a, maxDate: s, isDateDisabled: r } = this.dp, { day: o } = g(this.date), d = this._isOutOfMinMaxRange(), c = r(this.date), u = _("air-datepicker-cell", `-${this.singleType}-`, { "-current-": f(i, this.date, this.type), "-min-date-": a && f(a, this.date, this.type), "-max-date-": s && f(s, this.date, this.type) }), p = "";
154
- switch (this.type) {
155
- case l.days:
156
- p = _({ "-weekend-": this.dp.isWeekend(o), "-other-month-": this.isOtherMonth, "-disabled-": this.isOtherMonth && !t || d || c });
157
- break;
158
- case l.months:
159
- p = _({ "-disabled-": d });
160
- break;
161
- case l.years:
162
- p = _({ "-other-decade-": this.isOtherDecade, "-disabled-": d || this.isOtherDecade && !n });
163
- }
164
- return _(u, p, (e = this.customData) === null || e === void 0 ? void 0 : e.classes).split(" ");
165
- }
166
- _getHtml() {
167
- var e;
168
- let { year: i, month: t, date: n } = g(this.date), { showOtherMonths: a, showOtherYears: s } = this.opts;
169
- if ((e = this.customData) !== null && e !== void 0 && e.html) return this.customData.html;
170
- switch (this.type) {
171
- case l.days:
172
- return !a && this.isOtherMonth ? "" : n;
173
- case l.months:
174
- return this.dp.locale[this.opts.monthsField][t];
175
- case l.years:
176
- return !s && this.isOtherDecade ? "" : i;
177
- }
178
- }
179
- _isOutOfMinMaxRange() {
180
- let { minDate: e, maxDate: i } = this.dp, { type: t, date: n } = this, { month: a, year: s, date: r } = g(n), o = t === l.days, d = t === l.years, c = !!e && new Date(s, d ? e.getMonth() : a, o ? r : e.getDate()), u = !!i && new Date(s, d ? i.getMonth() : a, o ? r : i.getDate());
181
- return e && i ? j(c, e) || S(u, i) : e ? j(c, e) : i ? S(u, i) : void 0;
182
- }
183
- destroy() {
184
- this.unbindDatepickerEvents();
185
- }
186
- _handleRangeStatus() {
187
- const { selectedDates: e, focusDate: i, rangeDateTo: t, rangeDateFrom: n } = this.dp, a = e.length;
188
- if (this.$cell.classList.remove("-range-from-", "-range-to-", "-in-range-"), !a) return;
189
- let s = n, r = t;
190
- if (a === 1 && i) {
191
- const p = S(i, e[0]);
192
- s = p ? e[0] : i, r = p ? i : e[0];
193
- }
194
- let o = _({ "-in-range-": s && r && (d = this.date, c = s, u = r, S(d, c) && j(d, u)), "-range-from-": s && f(this.date, s, this.type), "-range-to-": r && f(this.date, r, this.type) });
195
- var d, c, u;
196
- o && this.$cell.classList.add(...o.split(" "));
197
- }
198
- _handleSelectedStatus() {
199
- let e = this.dp._checkIfDateIsSelected(this.date, this.type);
200
- e ? this.select() : !e && this.selected && this.removeSelect();
201
- }
202
- _handleInitialFocusStatus() {
203
- f(this.dp.focusDate, this.date, this.type) && this.focus();
204
- }
205
- _handleClasses() {
206
- this.$cell.setAttribute("class", ""), this._handleInitialFocusStatus(), this.dp.hasSelectedDates && (this._handleSelectedStatus(), this.dp.opts.range && this._handleRangeStatus()), this.$cell.classList.add(...this._getClassName());
207
- }
208
- get isDisabled() {
209
- return this.$cell.matches(".-disabled-");
210
- }
211
- get isOtherMonth() {
212
- return this.dp.isOtherMonth(this.date);
213
- }
214
- get isOtherDecade() {
215
- return this.dp.isOtherDecade(this.date);
216
- }
217
- }
218
- function C(h, e, i) {
219
- return (e = function(t) {
220
- var n = function(a, s) {
221
- if (typeof a != "object" || a === null) return a;
222
- var r = a[Symbol.toPrimitive];
223
- if (r !== void 0) {
224
- var o = r.call(a, "string");
225
- if (typeof o != "object") return o;
226
- throw new TypeError("@@toPrimitive must return a primitive value.");
227
- }
228
- return String(a);
229
- }(t);
230
- return typeof n == "symbol" ? n : String(n);
231
- }(e)) in h ? Object.defineProperty(h, e, { value: i, enumerable: !0, configurable: !0, writable: !0 }) : h[e] = i, h;
232
- }
233
- let le = { [l.days]: `<div class="air-datepicker-body--day-names"></div><div class="air-datepicker-body--cells -${l.days}-"></div>`, [l.months]: `<div class="air-datepicker-body--cells -${l.months}-"></div>`, [l.years]: `<div class="air-datepicker-body--cells -${l.years}-"></div>` };
234
- const U = ".air-datepicker-cell";
235
- class V {
236
- constructor(e) {
237
- let { dp: i, type: t, opts: n } = e;
238
- C(this, "handleClick", (a) => {
239
- let s = a.target.closest(U).adpCell;
240
- if (s.isDisabled) return;
241
- if (!this.dp.isMinViewReached) return void this.dp.down();
242
- let r = this.dp._checkIfDateIsSelected(s.date, s.type);
243
- r ? this.dp._handleAlreadySelectedDates(r, s.date) : this.dp.selectDate(s.date);
244
- }), C(this, "handleDayNameClick", (a) => {
245
- let s = a.target.getAttribute("data-day-index");
246
- this.opts.onClickDayName({ dayIndex: Number(s), datepicker: this.dp });
247
- }), C(this, "onChangeCurrentView", (a) => {
248
- a !== this.type ? this.hide() : (this.show(), this.render());
249
- }), C(this, "onMouseOverCell", (a) => {
250
- let s = K(a.target, U);
251
- this.dp.setFocusDate(!!s && s.adpCell.date);
252
- }), C(this, "onMouseOutCell", () => {
253
- this.dp.setFocusDate(!1);
254
- }), C(this, "onClickBody", (a) => {
255
- let { onClickDayName: s } = this.opts, r = a.target;
256
- r.closest(U) && this.handleClick(a), s && r.closest(".air-datepicker-body--day-name") && this.handleDayNameClick(a);
257
- }), C(this, "onMouseDown", (a) => {
258
- this.pressed = !0;
259
- let s = K(a.target, U), r = s && s.adpCell;
260
- f(r.date, this.dp.rangeDateFrom) && (this.rangeFromFocused = !0), f(r.date, this.dp.rangeDateTo) && (this.rangeToFocused = !0);
261
- }), C(this, "onMouseMove", (a) => {
262
- if (!this.pressed || !this.dp.isMinViewReached) return;
263
- a.preventDefault();
264
- let s = K(a.target, U), r = s && s.adpCell, { selectedDates: o, rangeDateTo: d, rangeDateFrom: c } = this.dp;
265
- if (!r || r.isDisabled) return;
266
- let { date: u } = r;
267
- if (o.length === 2) {
268
- if (this.rangeFromFocused && !S(u, d)) {
269
- let { hours: p, minutes: v } = g(c);
270
- u.setHours(p), u.setMinutes(v), this.dp.rangeDateFrom = u, this.dp.replaceDate(c, u);
271
- }
272
- if (this.rangeToFocused && !j(u, c)) {
273
- let { hours: p, minutes: v } = g(d);
274
- u.setHours(p), u.setMinutes(v), this.dp.rangeDateTo = u, this.dp.replaceDate(d, u);
275
- }
276
- }
277
- }), C(this, "onMouseUp", () => {
278
- this.pressed = !1, this.rangeFromFocused = !1, this.rangeToFocused = !1;
279
- }), C(this, "onChangeViewDate", (a, s) => {
280
- if (!this.isVisible) return;
281
- let r = x(a), o = x(s);
282
- switch (this.dp.currentView) {
283
- case l.days:
284
- if (f(a, s, l.months)) return;
285
- break;
286
- case l.months:
287
- if (f(a, s, l.years)) return;
288
- break;
289
- case l.years:
290
- if (r[0] === o[0] && r[1] === o[1]) return;
291
- }
292
- this.render();
293
- }), C(this, "render", () => {
294
- this.destroyCells(), this._generateCells(), this.cells.forEach((a) => {
295
- this.$cells.appendChild(a.render());
296
- });
297
- }), this.dp = i, this.type = t, this.opts = n, this.cells = [], this.$el = "", this.pressed = !1, this.isVisible = !0, this.init();
298
- }
299
- init() {
300
- this._buildBaseHtml(), this.type === l.days && this.renderDayNames(), this.render(), this._bindEvents(), this._bindDatepickerEvents();
301
- }
302
- _bindEvents() {
303
- let { range: e, dynamicRange: i } = this.opts;
304
- b(this.$el, "mouseover", this.onMouseOverCell), b(this.$el, "mouseout", this.onMouseOutCell), b(this.$el, "click", this.onClickBody), e && i && (b(this.$el, "mousedown", this.onMouseDown), b(this.$el, "mousemove", this.onMouseMove), b(window.document, "mouseup", this.onMouseUp));
305
- }
306
- _bindDatepickerEvents() {
307
- this.dp.on(l.eventChangeViewDate, this.onChangeViewDate), this.dp.on(l.eventChangeCurrentView, this.onChangeCurrentView);
308
- }
309
- _buildBaseHtml() {
310
- this.$el = $({ className: `air-datepicker-body -${this.type}-`, innerHtml: le[this.type] }), this.$names = y(".air-datepicker-body--day-names", this.$el), this.$cells = y(".air-datepicker-body--cells", this.$el);
311
- }
312
- _getDayNamesHtml() {
313
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.dp.locale.firstDay, i = "", t = this.dp.isWeekend, { onClickDayName: n } = this.opts, a = e, s = 0;
314
- for (; s < 7; ) {
315
- let r = a % 7;
316
- i += `<div class="${_("air-datepicker-body--day-name", { [l.cssClassWeekend]: t(r), "-clickable-": !!n })}" data-day-index='${r}'>${this.dp.locale.daysMin[r]}</div>`, s++, a++;
317
- }
318
- return i;
319
- }
320
- renderDayNames() {
321
- this.$names.innerHTML = this._getDayNamesHtml();
322
- }
323
- _generateCell(e) {
324
- let { type: i, dp: t, opts: n } = this;
325
- return new oe({ type: i, dp: t, opts: n, date: e, body: this });
326
- }
327
- _generateCells() {
328
- V.getDatesFunction(this.type)(this.dp, (e) => {
329
- this.cells.push(this._generateCell(e));
330
- });
331
- }
332
- show() {
333
- this.isVisible = !0, this.$el.classList.remove("-hidden-");
334
- }
335
- hide() {
336
- this.isVisible = !1, this.$el.classList.add("-hidden-");
337
- }
338
- destroyCells() {
339
- this.cells.forEach((e) => e.destroy()), this.cells = [], this.$cells.innerHTML = "";
340
- }
341
- destroy() {
342
- this.destroyCells(), this.dp.off(l.eventChangeViewDate, this.onChangeViewDate), this.dp.off(l.eventChangeCurrentView, this.onChangeCurrentView);
343
- }
344
- static getDaysDates(e, i) {
345
- let { viewDate: t, opts: { fixedHeight: n }, locale: { firstDay: a } } = e, s = ie(t), { year: r, month: o } = g(t), d = new Date(r, o, 1), c = new Date(r, o, s), u = d.getDay() - a, p = 6 - c.getDay() + a;
346
- u = u < 0 ? u + 7 : u, p = p > 6 ? p - 7 : p;
347
- let v = function(I, ee) {
348
- let { year: J, month: ge, date: ve } = g(I);
349
- return new Date(J, ge, ve - ee);
350
- }(d, u), w = s + u + p, D = v.getDate(), { year: M, month: Y } = g(v), A = 0;
351
- n && (w = 42);
352
- const N = [];
353
- for (; A < w; ) {
354
- let I = new Date(M, Y, D + A);
355
- i && i(I), N.push(I), A++;
356
- }
357
- return N;
358
- }
359
- static getMonthsDates(e, i) {
360
- let { year: t } = e.parsedViewDate, n = 0, a = [];
361
- for (; n < 12; ) {
362
- const s = new Date(t, n);
363
- a.push(s), i && i(s), n++;
364
- }
365
- return a;
366
- }
367
- static getYearsDates(e, i) {
368
- let t = x(e.viewDate), n = t[0] - 1, a = t[1] + 1, s = n, r = [];
369
- for (; s <= a; ) {
370
- const o = new Date(s, 0);
371
- r.push(o), i && i(o), s++;
372
- }
373
- return r;
374
- }
375
- static getDatesFunction() {
376
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : l.days;
377
- return { [l.days]: V.getDaysDates, [l.months]: V.getMonthsDates, [l.years]: V.getYearsDates }[e];
378
- }
379
- }
380
- function H(h, e, i) {
381
- return (e = function(t) {
382
- var n = function(a, s) {
383
- if (typeof a != "object" || a === null) return a;
384
- var r = a[Symbol.toPrimitive];
385
- if (r !== void 0) {
386
- var o = r.call(a, "string");
387
- if (typeof o != "object") return o;
388
- throw new TypeError("@@toPrimitive must return a primitive value.");
389
- }
390
- return String(a);
391
- }(t);
392
- return typeof n == "symbol" ? n : String(n);
393
- }(e)) in h ? Object.defineProperty(h, e, { value: i, enumerable: !0, configurable: !0, writable: !0 }) : h[e] = i, h;
394
- }
395
- class de {
396
- constructor(e) {
397
- let { dp: i, opts: t } = e;
398
- H(this, "onClickNav", (n) => {
399
- let a = K(n.target, ".air-datepicker-nav--action");
400
- if (!a) return;
401
- let s = a.dataset.action;
402
- this.dp[s]();
403
- }), H(this, "onChangeViewDate", () => {
404
- this.render(), this._resetNavStatus(), this.handleNavStatus();
405
- }), H(this, "onChangeCurrentView", () => {
406
- this.render(), this._resetNavStatus(), this.handleNavStatus();
407
- }), H(this, "onClickNavTitle", () => {
408
- this.dp.isFinalView || this.dp.up();
409
- }), H(this, "update", () => {
410
- let { prevHtml: n, nextHtml: a } = this.opts;
411
- this.$prev.innerHTML = n, this.$next.innerHTML = a, this._resetNavStatus(), this.render(), this.handleNavStatus();
412
- }), H(this, "renderDelay", () => {
413
- setTimeout(this.render);
414
- }), H(this, "render", () => {
415
- this.$title.innerHTML = this._getTitle(), function(n, a) {
416
- for (let s in a) a[s] ? n.classList.add(s) : n.classList.remove(s);
417
- }(this.$title, { "-disabled-": this.dp.isFinalView });
418
- }), this.dp = i, this.opts = t, this.init();
419
- }
420
- init() {
421
- this._createElement(), this._buildBaseHtml(), this._defineDOM(), this.render(), this.handleNavStatus(), this._bindEvents(), this._bindDatepickerEvents();
422
- }
423
- _defineDOM() {
424
- this.$title = y(".air-datepicker-nav--title", this.$el), this.$prev = y('[data-action="prev"]', this.$el), this.$next = y('[data-action="next"]', this.$el);
425
- }
426
- _bindEvents() {
427
- this.$el.addEventListener("click", this.onClickNav), this.$title.addEventListener("click", this.onClickNavTitle);
428
- }
429
- _bindDatepickerEvents() {
430
- this.dp.on(l.eventChangeViewDate, this.onChangeViewDate), this.dp.on(l.eventChangeCurrentView, this.onChangeCurrentView), this.isNavIsFunction && (this.dp.on(l.eventChangeSelectedDate, this.renderDelay), this.dp.opts.timepicker && this.dp.on(l.eventChangeTime, this.render));
431
- }
432
- destroy() {
433
- this.dp.off(l.eventChangeViewDate, this.onChangeViewDate), this.dp.off(l.eventChangeCurrentView, this.onChangeCurrentView), this.isNavIsFunction && (this.dp.off(l.eventChangeSelectedDate, this.renderDelay), this.dp.opts.timepicker && this.dp.off(l.eventChangeTime, this.render));
434
- }
435
- _createElement() {
436
- this.$el = $({ tagName: "nav", className: "air-datepicker-nav" });
437
- }
438
- _getTitle() {
439
- let { dp: e, opts: i } = this, t = i.navTitles[e.currentView];
440
- return typeof t == "function" ? t(e) : e.formatDate(e.viewDate, t);
441
- }
442
- handleNavStatus() {
443
- let { disableNavWhenOutOfRange: e } = this.opts, { minDate: i, maxDate: t } = this.dp;
444
- if (!i && !t || !e) return;
445
- let { year: n, month: a } = this.dp.parsedViewDate, s = !!i && g(i), r = !!t && g(t);
446
- switch (this.dp.currentView) {
447
- case l.days:
448
- i && s.month >= a && s.year >= n && this._disableNav("prev"), t && r.month <= a && r.year <= n && this._disableNav("next");
449
- break;
450
- case l.months:
451
- i && s.year >= n && this._disableNav("prev"), t && r.year <= n && this._disableNav("next");
452
- break;
453
- case l.years: {
454
- let o = x(this.dp.viewDate);
455
- i && s.year >= o[0] && this._disableNav("prev"), t && r.year <= o[1] && this._disableNav("next");
456
- break;
457
- }
458
- }
459
- }
460
- _disableNav(e) {
461
- y('[data-action="' + e + '"]', this.$el).classList.add("-disabled-");
462
- }
463
- _resetNavStatus() {
464
- (function(e) {
465
- for (var i = arguments.length, t = new Array(i > 1 ? i - 1 : 0), n = 1; n < i; n++) t[n - 1] = arguments[n];
466
- e.length ? e.forEach((a) => {
467
- a.classList.remove(...t);
468
- }) : e.classList.remove(...t);
469
- })(this.$el.querySelectorAll(".air-datepicker-nav--action"), "-disabled-");
470
- }
471
- _buildBaseHtml() {
472
- let { prevHtml: e, nextHtml: i } = this.opts;
473
- this.$el.innerHTML = `<div class="air-datepicker-nav--action" data-action="prev">${e}</div><div class="air-datepicker-nav--title"></div><div class="air-datepicker-nav--action" data-action="next">${i}</div>`;
474
- }
475
- get isNavIsFunction() {
476
- let { navTitles: e } = this.opts;
477
- return Object.keys(e).find((i) => typeof e[i] == "function");
478
- }
479
- }
480
- var ae = { today: { content: (h) => h.locale.today, onClick: (h) => h.setViewDate(/* @__PURE__ */ new Date()) }, clear: { content: (h) => h.locale.clear, onClick: (h) => h.clear() } };
481
- class ue {
482
- constructor(e) {
483
- let { dp: i, opts: t } = e;
484
- this.dp = i, this.opts = t, this.init();
485
- }
486
- init() {
487
- this.createElement(), this.render();
488
- }
489
- createElement() {
490
- this.$el = $({ className: "air-datepicker-buttons" });
491
- }
492
- destroy() {
493
- this.$el.parentNode.removeChild(this.$el);
494
- }
495
- clearHtml() {
496
- return this.$el.innerHTML = "", this;
497
- }
498
- generateButtons() {
499
- let { buttons: e } = this.opts;
500
- Array.isArray(e) || (e = [e]), e.forEach((i) => {
501
- let t = i;
502
- typeof i == "string" && ae[i] && (t = ae[i]);
503
- let n = this.createButton(t);
504
- t.onClick && this.attachEventToButton(n, t.onClick), this.$el.appendChild(n);
505
- });
506
- }
507
- attachEventToButton(e, i) {
508
- e.addEventListener("click", () => {
509
- i(this.dp);
510
- });
511
- }
512
- createButton(e) {
513
- let { content: i, className: t, tagName: n = "button", attrs: a = {} } = e;
514
- return $({ tagName: n, innerHtml: `<span tabindex='-1'>${typeof i == "function" ? i(this.dp) : i}</span>`, className: _("air-datepicker-button", t), attrs: a });
515
- }
516
- render() {
517
- this.generateButtons();
518
- }
519
- }
520
- function L(h, e, i) {
521
- return (e = function(t) {
522
- var n = function(a, s) {
523
- if (typeof a != "object" || a === null) return a;
524
- var r = a[Symbol.toPrimitive];
525
- if (r !== void 0) {
526
- var o = r.call(a, "string");
527
- if (typeof o != "object") return o;
528
- throw new TypeError("@@toPrimitive must return a primitive value.");
529
- }
530
- return String(a);
531
- }(t);
532
- return typeof n == "symbol" ? n : String(n);
533
- }(e)) in h ? Object.defineProperty(h, e, { value: i, enumerable: !0, configurable: !0, writable: !0 }) : h[e] = i, h;
534
- }
535
- class ce {
536
- constructor() {
537
- let { opts: e, dp: i } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
538
- L(this, "toggleTimepickerIsActive", (n) => {
539
- this.dp.timepickerIsActive = n;
540
- }), L(this, "onChangeSelectedDate", (n) => {
541
- let { date: a, updateTime: s = !1 } = n;
542
- a && (this.setMinMaxTime(a), this.setCurrentTime(!!s && a), this.addTimeToDate(a));
543
- }), L(this, "onChangeLastSelectedDate", (n) => {
544
- n && (this.setTime(n), this.render());
545
- }), L(this, "onChangeInputRange", (n) => {
546
- let a = n.target;
547
- this[a.getAttribute("name")] = a.value, this.updateText(), this.dp.trigger(l.eventChangeTime, { hours: this.hours, minutes: this.minutes });
548
- }), L(this, "onMouseEnterLeave", (n) => {
549
- let a = n.target.getAttribute("name"), s = this.$minutesText;
550
- a === "hours" && (s = this.$hoursText), s.classList.toggle("-focus-");
551
- }), L(this, "onFocus", () => {
552
- this.toggleTimepickerIsActive(!0);
553
- }), L(this, "onBlur", () => {
554
- this.toggleTimepickerIsActive(!1);
555
- }), this.opts = e, this.dp = i;
556
- let { timeFormat: t } = this.dp.locale;
557
- t && (t.match(Q("h")) || t.match(Q("hh"))) && (this.ampm = !0), this.init();
558
- }
559
- init() {
560
- this.setTime(this.dp.lastSelectedDate || this.dp.viewDate), this.createElement(), this.buildHtml(), this.defineDOM(), this.render(), this.bindDatepickerEvents(), this.bindDOMEvents();
561
- }
562
- bindDatepickerEvents() {
563
- this.dp.on(l.eventChangeSelectedDate, this.onChangeSelectedDate), this.dp.on(l.eventChangeLastSelectedDate, this.onChangeLastSelectedDate);
564
- }
565
- bindDOMEvents() {
566
- let e = "input";
567
- navigator.userAgent.match(/trident/gi) && (e = "change"), b(this.$ranges, e, this.onChangeInputRange), b(this.$ranges, "mouseenter", this.onMouseEnterLeave), b(this.$ranges, "mouseleave", this.onMouseEnterLeave), b(this.$ranges, "focus", this.onFocus), b(this.$ranges, "mousedown", this.onFocus), b(this.$ranges, "blur", this.onBlur);
568
- }
569
- createElement() {
570
- this.$el = $({ className: _("air-datepicker-time", { "-am-pm-": this.dp.ampm }) });
571
- }
572
- destroy() {
573
- this.dp.off(l.eventChangeSelectedDate, this.onChangeSelectedDate), this.dp.off(l.eventChangeLastSelectedDate, this.onChangeLastSelectedDate), this.$el.parentNode.removeChild(this.$el);
574
- }
575
- buildHtml() {
576
- let { ampm: e, hours: i, displayHours: t, minutes: n, minHours: a, minMinutes: s, maxHours: r, maxMinutes: o, dayPeriod: d, opts: { hoursStep: c, minutesStep: u } } = this;
577
- this.$el.innerHTML = `<div class="air-datepicker-time--current"> <span class="air-datepicker-time--current-hours">${P(t)}</span> <span class="air-datepicker-time--current-colon">:</span> <span class="air-datepicker-time--current-minutes">${P(n)}</span> ` + (e ? `<span class='air-datepicker-time--current-ampm'>${d}</span>` : "") + `</div><div class="air-datepicker-time--sliders"> <div class="air-datepicker-time--row"> <input type="range" name="hours" value="${i}" min="${a}" max="${r}" step="${c}"/> </div> <div class="air-datepicker-time--row"> <input type="range" name="minutes" value="${n}" min="${s}" max="${o}" step="${u}"/> </div></div>`;
578
- }
579
- defineDOM() {
580
- let e = (i) => y(i, this.$el);
581
- this.$ranges = this.$el.querySelectorAll('[type="range"]'), this.$hours = e('[name="hours"]'), this.$minutes = e('[name="minutes"]'), this.$hoursText = e(".air-datepicker-time--current-hours"), this.$minutesText = e(".air-datepicker-time--current-minutes"), this.$ampm = e(".air-datepicker-time--current-ampm");
582
- }
583
- setTime(e) {
584
- this.setMinMaxTime(e), this.setCurrentTime(e);
585
- }
586
- addTimeToDate(e) {
587
- e && (e.setHours(this.hours), e.setMinutes(this.minutes));
588
- }
589
- setMinMaxTime(e) {
590
- if (this.setMinMaxTimeFromOptions(), e) {
591
- let { minDate: i, maxDate: t } = this.dp;
592
- i && f(e, i) && this.setMinTimeFromMinDate(i), t && f(e, t) && this.setMaxTimeFromMaxDate(t);
593
- }
594
- }
595
- setCurrentTime(e) {
596
- let { hours: i, minutes: t } = e ? g(e) : this;
597
- this.hours = B(i, this.minHours, this.maxHours), this.minutes = B(t, this.minMinutes, this.maxMinutes);
598
- }
599
- setMinMaxTimeFromOptions() {
600
- let { minHours: e, minMinutes: i, maxHours: t, maxMinutes: n } = this.opts;
601
- this.minHours = B(e, 0, 23), this.minMinutes = B(i, 0, 59), this.maxHours = B(t, 0, 23), this.maxMinutes = B(n, 0, 59);
602
- }
603
- setMinTimeFromMinDate(e) {
604
- let { lastSelectedDate: i } = this.dp;
605
- this.minHours = e.getHours(), i && i.getHours() > e.getHours() ? this.minMinutes = this.opts.minMinutes : this.minMinutes = e.getMinutes();
606
- }
607
- setMaxTimeFromMaxDate(e) {
608
- let { lastSelectedDate: i } = this.dp;
609
- this.maxHours = e.getHours(), i && i.getHours() < e.getHours() ? this.maxMinutes = this.opts.maxMinutes : this.maxMinutes = e.getMinutes();
610
- }
611
- updateSliders() {
612
- X(this.$hours, { min: this.minHours, max: this.maxHours }).value = this.hours, X(this.$minutes, { min: this.minMinutes, max: this.maxMinutes }).value = this.minutes;
613
- }
614
- updateText() {
615
- this.$hoursText.innerHTML = P(this.displayHours), this.$minutesText.innerHTML = P(this.minutes), this.ampm && (this.$ampm.innerHTML = this.dayPeriod);
616
- }
617
- set hours(e) {
618
- this._hours = e;
619
- let { hours: i, dayPeriod: t } = se(e);
620
- this.displayHours = this.ampm ? i : e, this.dayPeriod = t;
621
- }
622
- get hours() {
623
- return this._hours;
624
- }
625
- render() {
626
- this.updateSliders(), this.updateText();
627
- }
628
- }
629
- function O(h, e, i) {
630
- return (e = function(t) {
631
- var n = function(a, s) {
632
- if (typeof a != "object" || a === null) return a;
633
- var r = a[Symbol.toPrimitive];
634
- if (r !== void 0) {
635
- var o = r.call(a, "string");
636
- if (typeof o != "object") return o;
637
- throw new TypeError("@@toPrimitive must return a primitive value.");
638
- }
639
- return String(a);
640
- }(t);
641
- return typeof n == "symbol" ? n : String(n);
642
- }(e)) in h ? Object.defineProperty(h, e, { value: i, enumerable: !0, configurable: !0, writable: !0 }) : h[e] = i, h;
643
- }
644
- class pe {
645
- constructor(e) {
646
- let { dp: i, opts: t } = e;
647
- O(this, "pressedKeys", /* @__PURE__ */ new Set()), O(this, "hotKeys", /* @__PURE__ */ new Map([[[["Control", "ArrowRight"], ["Control", "ArrowUp"]], (n) => n.month++], [[["Control", "ArrowLeft"], ["Control", "ArrowDown"]], (n) => n.month--], [[["Shift", "ArrowRight"], ["Shift", "ArrowUp"]], (n) => n.year++], [[["Shift", "ArrowLeft"], ["Shift", "ArrowDown"]], (n) => n.year--], [[["Alt", "ArrowRight"], ["Alt", "ArrowUp"]], (n) => n.year += 10], [[["Alt", "ArrowLeft"], ["Alt", "ArrowDown"]], (n) => n.year -= 10], [["Control", "Shift", "ArrowUp"], (n, a) => a.up()]])), O(this, "handleHotKey", (n) => {
648
- let a = this.hotKeys.get(n), s = g(this.getInitialFocusDate());
649
- a(s, this.dp);
650
- let { year: r, month: o, date: d } = s, c = ie(new Date(r, o));
651
- c < d && (d = c);
652
- let u = this.dp.getClampedDate(new Date(r, o, d));
653
- this.dp.setFocusDate(u, { viewDateTransition: !0 });
654
- }), O(this, "isHotKeyPressed", () => {
655
- let n = !1, a = this.pressedKeys.size, s = (r) => this.pressedKeys.has(r);
656
- for (let [r] of this.hotKeys) {
657
- if (n) break;
658
- if (Array.isArray(r[0])) r.forEach((o) => {
659
- n || a !== o.length || (n = o.every(s) && r);
660
- });
661
- else {
662
- if (a !== r.length) continue;
663
- n = r.every(s) && r;
664
- }
665
- }
666
- return n;
667
- }), O(this, "isArrow", (n) => n >= 37 && n <= 40), O(this, "onKeyDown", (n) => {
668
- if (!this.dp.visible && !this.dp.treatAsInline) return;
669
- let { key: a, which: s } = n, { dp: r, dp: { focusDate: o }, opts: d } = this;
670
- this.registerKey(a);
671
- let c = this.isHotKeyPressed();
672
- if (c) return n.preventDefault(), void this.handleHotKey(c);
673
- if (this.isArrow(s)) return n.preventDefault(), void this.focusNextCell(a);
674
- if (a === "Enter") {
675
- if (r.currentView !== d.minView) return void r.down();
676
- if (o) {
677
- let u = r._checkIfDateIsSelected(o);
678
- return void (u ? r._handleAlreadySelectedDates(u, o) : r.selectDate(o));
679
- }
680
- }
681
- a === "Escape" && this.dp.hide();
682
- }), O(this, "onKeyUp", (n) => {
683
- this.removeKey(n.key);
684
- }), this.dp = i, this.opts = t, this.init();
685
- }
686
- init() {
687
- this.bindKeyboardEvents();
688
- }
689
- bindKeyboardEvents() {
690
- let { $el: e } = this.dp;
691
- e.addEventListener("keydown", this.onKeyDown), e.addEventListener("keyup", this.onKeyUp);
692
- }
693
- destroy() {
694
- let { $el: e } = this.dp;
695
- e.removeEventListener("keydown", this.onKeyDown), e.removeEventListener("keyup", this.onKeyUp), this.hotKeys = null, this.pressedKeys = null;
696
- }
697
- getInitialFocusDate() {
698
- let { focusDate: e, currentView: i, selectedDates: t, parsedViewDate: { year: n, month: a } } = this.dp, s = e || t[t.length - 1];
699
- if (!s) switch (i) {
700
- case l.days:
701
- s = new Date(n, a, (/* @__PURE__ */ new Date()).getDate());
702
- break;
703
- case l.months:
704
- s = new Date(n, a, 1);
705
- break;
706
- case l.years:
707
- s = new Date(n, 0, 1);
708
- }
709
- return s;
710
- }
711
- focusNextCell(e) {
712
- let i = this.getInitialFocusDate(), { currentView: t } = this.dp, { days: n, months: a, years: s } = l, r = g(i), o = r.year, d = r.month, c = r.date;
713
- switch (e) {
714
- case "ArrowLeft":
715
- t === n && (c -= 1), t === a && (d -= 1), t === s && (o -= 1);
716
- break;
717
- case "ArrowUp":
718
- t === n && (c -= 7), t === a && (d -= 3), t === s && (o -= 4);
719
- break;
720
- case "ArrowRight":
721
- t === n && (c += 1), t === a && (d += 1), t === s && (o += 1);
722
- break;
723
- case "ArrowDown":
724
- t === n && (c += 7), t === a && (d += 3), t === s && (o += 4);
725
- }
726
- let u = this.dp.getClampedDate(new Date(o, d, c));
727
- this.dp.setFocusDate(u, { viewDateTransition: !0 });
728
- }
729
- registerKey(e) {
730
- this.pressedKeys.add(e);
731
- }
732
- removeKey(e) {
733
- this.pressedKeys.delete(e);
734
- }
735
- }
736
- let me = { on(h, e) {
737
- this.__events || (this.__events = {}), this.__events[h] ? this.__events[h].push(e) : this.__events[h] = [e];
738
- }, off(h, e) {
739
- this.__events && this.__events[h] && (this.__events[h] = this.__events[h].filter((i) => i !== e));
740
- }, removeAllEvents() {
741
- this.__events = {};
742
- }, trigger(h) {
743
- for (var e = arguments.length, i = new Array(e > 1 ? e - 1 : 0), t = 1; t < e; t++) i[t - 1] = arguments[t];
744
- this.__events && this.__events[h] && this.__events[h].forEach((n) => {
745
- n(...i);
746
- });
747
- } };
748
- function m(h, e, i) {
749
- return (e = function(t) {
750
- var n = function(a, s) {
751
- if (typeof a != "object" || a === null) return a;
752
- var r = a[Symbol.toPrimitive];
753
- if (r !== void 0) {
754
- var o = r.call(a, "string");
755
- if (typeof o != "object") return o;
756
- throw new TypeError("@@toPrimitive must return a primitive value.");
757
- }
758
- return String(a);
759
- }(t);
760
- return typeof n == "symbol" ? n : String(n);
761
- }(e)) in h ? Object.defineProperty(h, e, { value: i, enumerable: !0, configurable: !0, writable: !0 }) : h[e] = i, h;
762
- }
763
- let R = "", T = "", Z = !1;
764
- class F {
765
- static buildGlobalContainer(e) {
766
- Z = !0, R = $({ className: e, id: e }), y("body").appendChild(R);
767
- }
768
- constructor(e, i) {
769
- var t = this;
770
- if (m(this, "viewIndexes", [l.days, l.months, l.years]), m(this, "next", () => {
771
- let { year: s, month: r } = this.parsedViewDate;
772
- switch (this.currentView) {
773
- case l.days:
774
- this.setViewDate(new Date(s, r + 1, 1));
775
- break;
776
- case l.months:
777
- this.setViewDate(new Date(s + 1, r, 1));
778
- break;
779
- case l.years:
780
- this.setViewDate(new Date(s + 10, 0, 1));
781
- }
782
- }), m(this, "prev", () => {
783
- let { year: s, month: r } = this.parsedViewDate;
784
- switch (this.currentView) {
785
- case l.days:
786
- this.setViewDate(new Date(s, r - 1, 1));
787
- break;
788
- case l.months:
789
- this.setViewDate(new Date(s - 1, r, 1));
790
- break;
791
- case l.years:
792
- this.setViewDate(new Date(s - 10, 0, 1));
793
- }
794
- }), m(this, "_finishHide", () => {
795
- this.hideAnimation = !1, this._destroyComponents(), this.$container.removeChild(this.$datepicker);
796
- }), m(this, "setPosition", function(s) {
797
- let r = arguments.length > 1 && arguments[1] !== void 0 && arguments[1];
798
- if (typeof (s = s || t.opts.position) == "function") return void (t.customHide = s({ $datepicker: t.$datepicker, $target: t.$el, $pointer: t.$pointer, isViewChange: r, done: t._finishHide }));
799
- let o, d, { isMobile: c } = t.opts, u = t.$el.getBoundingClientRect(), p = t.$el.getBoundingClientRect(), v = t.$datepicker.offsetParent, w = t.$el.offsetParent, D = t.$datepicker.getBoundingClientRect(), M = s.split(" "), Y = window.scrollY, A = window.scrollX, N = t.opts.offset, I = M[0], ee = M[1];
800
- if (c) t.$datepicker.style.cssText = "left: 50%; top: 50%";
801
- else {
802
- if (v === w && v !== document.body && (p = { top: t.$el.offsetTop, left: t.$el.offsetLeft, width: u.width, height: t.$el.offsetHeight }, Y = 0, A = 0), v !== w && v !== document.body) {
803
- let J = v.getBoundingClientRect();
804
- p = { top: u.top - J.top, left: u.left - J.left, width: u.width, height: u.height }, Y = 0, A = 0;
805
- }
806
- switch (I) {
807
- case "top":
808
- o = p.top - D.height - N;
809
- break;
810
- case "right":
811
- d = p.left + p.width + N;
812
- break;
813
- case "bottom":
814
- o = p.top + p.height + N;
815
- break;
816
- case "left":
817
- d = p.left - D.width - N;
818
- }
819
- switch (ee) {
820
- case "top":
821
- o = p.top;
822
- break;
823
- case "right":
824
- d = p.left + p.width - D.width;
825
- break;
826
- case "bottom":
827
- o = p.top + p.height - D.height;
828
- break;
829
- case "left":
830
- d = p.left;
831
- break;
832
- case "center":
833
- /left|right/.test(I) ? o = p.top + p.height / 2 - D.height / 2 : d = p.left + p.width / 2 - D.width / 2;
834
- }
835
- t.$datepicker.style.cssText = `left: ${d + A}px; top: ${o + Y}px`;
836
- }
837
- }), m(this, "_setInputValue", () => {
838
- let { opts: s, $altField: r, locale: { dateFormat: o } } = this, { altFieldDateFormat: d, altField: c } = s;
839
- c && r && (r.value = this._getInputValue(d)), this.$el.value = this._getInputValue(o), this.$el.dispatchEvent(new Event("change"));
840
- }), m(this, "_getInputValue", (s) => {
841
- let { selectedDates: r, opts: o } = this, { multipleDates: d, multipleDatesSeparator: c } = o;
842
- if (!r.length) return "";
843
- let u = typeof s == "function", p = u ? s(d ? r : r[0]) : r.map((v) => this.formatDate(v, s));
844
- return p = u ? p : p.join(c), p;
845
- }), m(this, "_checkIfDateIsSelected", function(s) {
846
- let r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : l.days, o = !1;
847
- return t.selectedDates.some((d) => {
848
- let c = f(s, d, r);
849
- return o = c && d, c;
850
- }), o;
851
- }), m(this, "_scheduleCallAfterTransition", (s) => {
852
- this._cancelScheduledCall(), s && s(!1), this._onTransitionEnd = () => {
853
- s && s(!0);
854
- }, this.$datepicker.addEventListener("transitionend", this._onTransitionEnd, { once: !0 });
855
- }), m(this, "_cancelScheduledCall", () => {
856
- this.$datepicker.removeEventListener("transitionend", this._onTransitionEnd);
857
- }), m(this, "setViewDate", (s) => {
858
- if (!((s = k(s)) instanceof Date) || f(s, this.viewDate)) return;
859
- let r = this.viewDate;
860
- this.viewDate = s;
861
- let { onChangeViewDate: o } = this.opts;
862
- if (o) {
863
- let { month: d, year: c } = this.parsedViewDate;
864
- o({ month: d, year: c, decade: this.curDecade });
865
- }
866
- this.trigger(l.eventChangeViewDate, s, r);
867
- }), m(this, "setFocusDate", function(s) {
868
- let r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
869
- (!s || (s = k(s)) instanceof Date) && (t.focusDate = s, t.trigger(l.eventChangeFocusDate, s, r));
870
- }), m(this, "setCurrentView", function(s) {
871
- let r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
872
- if (t.viewIndexes.includes(s)) {
873
- if (t.currentView = s, t.elIsInput && t.visible && t.setPosition(void 0, !0), t.trigger(l.eventChangeCurrentView, s), !t.views[s]) {
874
- let o = t.views[s] = new V({ dp: t, opts: t.opts, type: s });
875
- t.shouldUpdateDOM && t.$content.appendChild(o.$el);
876
- }
877
- t.opts.onChangeView && !r.silent && t.opts.onChangeView(s);
878
- }
879
- }), m(this, "_updateLastSelectedDate", (s) => {
880
- this.lastSelectedDate = s, this.trigger(l.eventChangeLastSelectedDate, s);
881
- }), m(this, "destroy", () => {
882
- if (this.isDestroyed) return;
883
- let { showEvent: s, isMobile: r } = this.opts, o = this.$datepicker.parentNode;
884
- o && o.removeChild(this.$datepicker), this.$el.removeEventListener(s, this._onFocus), this.$el.removeEventListener("blur", this._onBlur), window.removeEventListener("resize", this._onResize), r && this._removeMobileAttributes(), this.keyboardNav && this.keyboardNav.destroy(), this.views = null, this.nav = null, this.$datepicker = null, this.opts = {}, this.$customContainer = null, this.viewDate = null, this.focusDate = null, this.selectedDates = [], this.rangeDateFrom = null, this.rangeDateTo = null, this.isDestroyed = !0;
885
- }), m(this, "update", function() {
886
- let s = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, o = q({}, t.opts), { silent: d } = r;
887
- q(t.opts, s);
888
- let { timepicker: c, buttons: u, range: p, selectedDates: v, isMobile: w } = t.opts, D = t.visible || t.treatAsInline;
889
- t._createMinMaxDates(), t._limitViewDateByMaxMinDates(), t._handleLocale(), v && (t.selectedDates = [], t.selectDate(v, { silent: d })), s.view && t.setCurrentView(s.view, { silent: d }), t._setInputValue(), o.range && !p ? (t.rangeDateTo = !1, t.rangeDateFrom = !1) : !o.range && p && t.selectedDates.length && (t.rangeDateFrom = t.selectedDates[0], t.rangeDateTo = t.selectedDates[1]), o.timepicker && !c ? (D && t.timepicker.destroy(), t.timepicker = !1, t.$timepicker.parentNode.removeChild(t.$timepicker)) : !o.timepicker && c && t._addTimepicker(), !o.buttons && u ? t._addButtons() : o.buttons && !u ? (t.buttons.destroy(), t.$buttons.parentNode.removeChild(t.$buttons)) : D && o.buttons && u && t.buttons.clearHtml().render(), !o.isMobile && w ? (t.treatAsInline || T || t._createMobileOverlay(), t._addMobileAttributes(), t.visible && t._showMobileOverlay()) : o.isMobile && !w && (t._removeMobileAttributes(), t.visible && (T.classList.remove("-active-"), typeof t.opts.position != "function" && t.setPosition())), D && (t.nav.update(), t.views[t.currentView].render(), t.currentView === l.days && t.views[t.currentView].renderDayNames());
890
- }), m(this, "disableDate", (s, r) => {
891
- (Array.isArray(s) ? s : [s]).forEach((o) => {
892
- let d = k(o);
893
- if (!d) return;
894
- let c = r ? "delete" : "add";
895
- this.disabledDates[c](this.formatDate(d, "yyyy-MM-dd"));
896
- let u = this.getCell(d, this.currentViewSingular);
897
- u && u.adpCell.render();
898
- }, []);
899
- }), m(this, "enableDate", (s) => {
900
- this.disableDate(s, !0);
901
- }), m(this, "isDateDisabled", (s) => {
902
- let r = k(s);
903
- return this.disabledDates.has(this.formatDate(r, "yyyy-MM-dd"));
904
- }), m(this, "isOtherMonth", (s) => {
905
- let { month: r } = g(s);
906
- return r !== this.parsedViewDate.month;
907
- }), m(this, "isOtherYear", (s) => {
908
- let { year: r } = g(s);
909
- return r !== this.parsedViewDate.year;
910
- }), m(this, "isOtherDecade", (s) => {
911
- let { year: r } = g(s), [o, d] = x(this.viewDate);
912
- return r < o || r > d;
913
- }), m(this, "_onChangeSelectedDate", (s) => {
914
- let { silent: r } = s;
915
- setTimeout(() => {
916
- this._setInputValue(), this.opts.onSelect && !r && this._triggerOnSelect();
917
- });
918
- }), m(this, "_onChangeFocusedDate", function(s) {
919
- let { viewDateTransition: r } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
920
- if (!s) return;
921
- let o = !1;
922
- r && (o = t.isOtherMonth(s) || t.isOtherYear(s) || t.isOtherDecade(s)), o && t.setViewDate(s), t.opts.onFocus && t.opts.onFocus({ datepicker: t, date: s });
923
- }), m(this, "_onChangeTime", (s) => {
924
- let { hours: r, minutes: o } = s, d = /* @__PURE__ */ new Date(), { lastSelectedDate: c, opts: { onSelect: u } } = this, p = c;
925
- c || (p = d);
926
- let v = this.getCell(p, this.currentViewSingular), w = v && v.adpCell;
927
- w && w.isDisabled || (p.setHours(r), p.setMinutes(o), c ? (this._setInputValue(), u && this._triggerOnSelect()) : this.selectDate(p));
928
- }), m(this, "_onFocus", (s) => {
929
- this.visible || this.show();
930
- }), m(this, "_onBlur", (s) => {
931
- this.inFocus || !this.visible || this.opts.isMobile || this.hide();
932
- }), m(this, "_onMouseDown", (s) => {
933
- this.inFocus = !0;
934
- }), m(this, "_onMouseUp", (s) => {
935
- this.inFocus = !1, this.$el.focus();
936
- }), m(this, "_onResize", () => {
937
- this.visible && typeof this.opts.position != "function" && this.setPosition();
938
- }), m(this, "_onClickOverlay", () => {
939
- this.visible && this.hide();
940
- }), m(this, "getViewDates", function() {
941
- let s = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : l.days;
942
- return V.getDatesFunction(s)(t);
943
- }), m(this, "isWeekend", (s) => this.opts.weekends.includes(s)), m(this, "getClampedDate", (s) => {
944
- let { minDate: r, maxDate: o } = this, d = s;
945
- return o && S(s, o) ? d = o : r && j(s, r) && (d = r), d;
946
- }), this.$el = y(e), !this.$el) return;
947
- this.$datepicker = $({ className: "air-datepicker" }), this.opts = q({}, te, i), this.$customContainer = !!this.opts.container && y(this.opts.container), this.$altField = y(this.opts.altField || !1);
948
- let { view: n, startDate: a } = this.opts;
949
- a || (this.opts.startDate = /* @__PURE__ */ new Date()), this.$el.nodeName === "INPUT" && (this.elIsInput = !0), this.inited = !1, this.visible = !1, this.viewDate = k(this.opts.startDate), this.focusDate = !1, this.initialReadonly = this.$el.getAttribute("readonly"), this.customHide = !1, this.currentView = n, this.selectedDates = [], this.disabledDates = /* @__PURE__ */ new Set(), this.isDestroyed = !1, this.views = {}, this.keys = [], this.rangeDateFrom = "", this.rangeDateTo = "", this.timepickerIsActive = !1, this.treatAsInline = this.opts.inline || !this.elIsInput, this.init();
950
- }
951
- init() {
952
- let { opts: e, treatAsInline: i, opts: { inline: t, isMobile: n, selectedDates: a, keyboardNav: s, onlyTimepicker: r } } = this, o = y("body");
953
- (!Z || Z && R && !o.contains(R)) && !t && this.elIsInput && !this.$customContainer && F.buildGlobalContainer(F.defaultGlobalContainerId), !n || T || i || this._createMobileOverlay(), this._handleLocale(), this._bindSubEvents(), this._createMinMaxDates(), this._limitViewDateByMaxMinDates(), this.elIsInput && (t || this._bindEvents(), s && !r && (this.keyboardNav = new pe({ dp: this, opts: e }))), a && this.selectDate(a, { silent: !0 }), this.opts.visible && !i && this.show(), n && !i && this.$el.setAttribute("readonly", !0), i && this._createComponents();
954
- }
955
- _createMobileOverlay() {
956
- T = $({ className: "air-datepicker-overlay" }), R.appendChild(T);
957
- }
958
- _createComponents() {
959
- let { opts: e, treatAsInline: i, opts: { inline: t, buttons: n, timepicker: a, position: s, classes: r, onlyTimepicker: o, isMobile: d } } = this;
960
- this._buildBaseHtml(), this.elIsInput && (t || this._setPositionClasses(s)), !t && this.elIsInput || this.$datepicker.classList.add("-inline-"), r && this.$datepicker.classList.add(...r.split(" ")), o && this.$datepicker.classList.add("-only-timepicker-"), d && !i && this._addMobileAttributes(), this.views[this.currentView] = new V({ dp: this, type: this.currentView, opts: e }), this.nav = new de({ dp: this, opts: e }), a && this._addTimepicker(), n && this._addButtons(), this.$content.appendChild(this.views[this.currentView].$el), this.$nav.appendChild(this.nav.$el);
961
- }
962
- _destroyComponents() {
963
- for (let e in this.views) this.views[e].destroy();
964
- this.views = {}, this.nav.destroy(), this.timepicker && this.timepicker.destroy();
965
- }
966
- _addMobileAttributes() {
967
- T.addEventListener("click", this._onClickOverlay), this.$datepicker.classList.add("-is-mobile-"), this.$el.setAttribute("readonly", !0);
968
- }
969
- _removeMobileAttributes() {
970
- T.removeEventListener("click", this._onClickOverlay), this.$datepicker.classList.remove("-is-mobile-"), this.initialReadonly || this.initialReadonly === "" || this.$el.removeAttribute("readonly");
971
- }
972
- _createMinMaxDates() {
973
- let { minDate: e, maxDate: i } = this.opts;
974
- this.minDate = !!e && k(e), this.maxDate = !!i && k(i);
975
- }
976
- _addTimepicker() {
977
- this.$timepicker = $({ className: "air-datepicker--time" }), this.$datepicker.appendChild(this.$timepicker), this.timepicker = new ce({ dp: this, opts: this.opts }), this.$timepicker.appendChild(this.timepicker.$el);
978
- }
979
- _addButtons() {
980
- this.$buttons = $({ className: "air-datepicker--buttons" }), this.$datepicker.appendChild(this.$buttons), this.buttons = new ue({ dp: this, opts: this.opts }), this.$buttons.appendChild(this.buttons.$el);
981
- }
982
- _bindSubEvents() {
983
- this.on(l.eventChangeSelectedDate, this._onChangeSelectedDate), this.on(l.eventChangeFocusDate, this._onChangeFocusedDate), this.on(l.eventChangeTime, this._onChangeTime);
984
- }
985
- _buildBaseHtml() {
986
- let { inline: e } = this.opts;
987
- var i, t;
988
- this.elIsInput ? e ? (i = this.$datepicker, (t = this.$el).parentNode.insertBefore(i, t.nextSibling)) : this.$container.appendChild(this.$datepicker) : this.$el.appendChild(this.$datepicker), this.$datepicker.innerHTML = '<i class="air-datepicker--pointer"></i><div class="air-datepicker--navigation"></div><div class="air-datepicker--content"></div>', this.$content = y(".air-datepicker--content", this.$datepicker), this.$pointer = y(".air-datepicker--pointer", this.$datepicker), this.$nav = y(".air-datepicker--navigation", this.$datepicker);
989
- }
990
- _handleLocale() {
991
- let { locale: e, dateFormat: i, firstDay: t, timepicker: n, onlyTimepicker: a, timeFormat: s, dateTimeSeparator: r } = this.opts;
992
- var o;
993
- this.locale = (o = e, JSON.parse(JSON.stringify(o))), i && (this.locale.dateFormat = i), s !== void 0 && s !== "" && (this.locale.timeFormat = s);
994
- let { timeFormat: d } = this.locale;
995
- if (t !== "" && (this.locale.firstDay = t), n && typeof i != "function") {
996
- let c = d ? r : "";
997
- this.locale.dateFormat = [this.locale.dateFormat, d || ""].join(c);
998
- }
999
- a && typeof i != "function" && (this.locale.dateFormat = this.locale.timeFormat);
1000
- }
1001
- _setPositionClasses(e) {
1002
- if (typeof e == "function") return void this.$datepicker.classList.add("-custom-position-");
1003
- let i = (e = e.split(" "))[0], t = `air-datepicker -${i}-${e[1]}- -from-${i}-`;
1004
- this.$datepicker.classList.add(...t.split(" "));
1005
- }
1006
- _bindEvents() {
1007
- this.$el.addEventListener(this.opts.showEvent, this._onFocus), this.$el.addEventListener("blur", this._onBlur), this.$datepicker.addEventListener("mousedown", this._onMouseDown), this.$datepicker.addEventListener("mouseup", this._onMouseUp), window.addEventListener("resize", this._onResize);
1008
- }
1009
- _limitViewDateByMaxMinDates() {
1010
- let { viewDate: e, minDate: i, maxDate: t } = this;
1011
- t && S(e, t) && this.setViewDate(t), i && j(e, i) && this.setViewDate(i);
1012
- }
1013
- formatDate() {
1014
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.viewDate, i = arguments.length > 1 ? arguments[1] : void 0;
1015
- if (e = k(e), !(e instanceof Date)) return;
1016
- let t = i, n = this.locale, a = g(e), s = a.dayPeriod, r = x(e), o = F.replacer, d = { T: e.getTime(), m: a.minutes, mm: a.fullMinutes, h: a.hours12, hh: a.fullHours12, H: a.hours, HH: a.fullHours, aa: s, AA: s.toUpperCase(), E: n.daysShort[a.day], EEEE: n.days[a.day], d: a.date, dd: a.fullDate, M: a.month + 1, MM: a.fullMonth, MMM: n.monthsShort[a.month], MMMM: n.months[a.month], yy: a.year.toString().slice(-2), yyyy: a.year, yyyy1: r[0], yyyy2: r[1] };
1017
- for (let [c, u] of Object.entries(d)) t = o(t, Q(c), u);
1018
- return t;
1019
- }
1020
- down(e) {
1021
- this._handleUpDownActions(e, "down");
1022
- }
1023
- up(e) {
1024
- this._handleUpDownActions(e, "up");
1025
- }
1026
- selectDate(e) {
1027
- let i, t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, { currentView: n, parsedViewDate: a, selectedDates: s } = this, { updateTime: r, silent: o } = t, { moveToOtherMonthsOnSelect: d, moveToOtherYearsOnSelect: c, multipleDates: u, range: p, autoClose: v, onBeforeSelect: w } = this.opts, D = s.length;
1028
- if (Array.isArray(e)) return e.forEach((M) => {
1029
- this.selectDate(M, t);
1030
- }), new Promise((M) => {
1031
- setTimeout(M);
1032
- });
1033
- if ((e = k(e)) instanceof Date) {
1034
- if (w && !o && !w({ date: e, datepicker: this })) return Promise.resolve();
1035
- if (n === l.days && e.getMonth() !== a.month && d && (i = new Date(e.getFullYear(), e.getMonth(), 1)), n === l.years && e.getFullYear() !== a.year && c && (i = new Date(e.getFullYear(), 0, 1)), i && this.setViewDate(i), u && !p) {
1036
- if (D === u) return;
1037
- this._checkIfDateIsSelected(e) || s.push(e);
1038
- } else if (p) switch (D) {
1039
- case 1:
1040
- s.push(e), this.rangeDateTo || (this.rangeDateTo = e), S(this.rangeDateFrom, this.rangeDateTo) && (this.rangeDateTo = this.rangeDateFrom, this.rangeDateFrom = e), this.selectedDates = [this.rangeDateFrom, this.rangeDateTo];
1041
- break;
1042
- case 2:
1043
- this.selectedDates = [e], this.rangeDateFrom = e, this.rangeDateTo = "";
1044
- break;
1045
- default:
1046
- this.selectedDates = [e], this.rangeDateFrom = e;
1047
- }
1048
- else this.selectedDates = [e];
1049
- return this.trigger(l.eventChangeSelectedDate, { action: l.actionSelectDate, silent: t == null ? void 0 : t.silent, date: e, updateTime: r }), this._updateLastSelectedDate(e), v && !this.timepickerIsActive && this.visible && (u || p ? p && D === 1 && this.hide() : this.hide()), new Promise((M) => {
1050
- setTimeout(M);
1051
- });
1052
- }
1053
- }
1054
- unselectDate(e) {
1055
- let i = this.selectedDates, t = this;
1056
- if ((e = k(e)) instanceof Date) return i.some((n, a) => {
1057
- if (f(n, e)) return i.splice(a, 1), t.selectedDates.length ? (t.rangeDateTo = "", t.rangeDateFrom = i[0], t._updateLastSelectedDate(t.selectedDates[t.selectedDates.length - 1])) : (t.rangeDateFrom = "", t.rangeDateTo = "", t._updateLastSelectedDate(!1)), this.trigger(l.eventChangeSelectedDate, { action: l.actionUnselectDate, date: e }), !0;
1058
- });
1059
- }
1060
- replaceDate(e, i) {
1061
- let t = this.selectedDates.find((a) => f(a, e, this.currentView)), n = this.selectedDates.indexOf(t);
1062
- n < 0 || f(this.selectedDates[n], i, this.currentView) || (this.selectedDates[n] = i, this.trigger(l.eventChangeSelectedDate, { action: l.actionSelectDate, date: i, updateTime: !0 }), this._updateLastSelectedDate(i));
1063
- }
1064
- clear() {
1065
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
1066
- return this.selectedDates = [], this.rangeDateFrom = !1, this.rangeDateTo = !1, this.lastSelectedDate = !1, this.trigger(l.eventChangeSelectedDate, { action: l.actionUnselectDate, silent: e.silent }), new Promise((i) => {
1067
- setTimeout(i);
1068
- });
1069
- }
1070
- show() {
1071
- let { onShow: e, isMobile: i } = this.opts;
1072
- this._cancelScheduledCall(), this.visible || this.hideAnimation || this._createComponents(), this.setPosition(this.opts.position), this.$datepicker.classList.add("-active-"), this.visible = !0, e && this._scheduleCallAfterTransition(e), i && this._showMobileOverlay();
1073
- }
1074
- hide() {
1075
- let { onHide: e, isMobile: i } = this.opts, t = this._hasTransition();
1076
- this.visible = !1, this.hideAnimation = !0, this.$datepicker.classList.remove("-active-"), this.customHide && this.customHide(), this.elIsInput && this.$el.blur(), this._scheduleCallAfterTransition((n) => {
1077
- !this.customHide && (n && t || !n && !t) && this._finishHide(), e && e(n);
1078
- }), i && T.classList.remove("-active-");
1079
- }
1080
- _triggerOnSelect() {
1081
- let e = [], i = [], { selectedDates: t, locale: n, opts: { onSelect: a, multipleDates: s, range: r } } = this, o = s || r, d = typeof n.dateFormat == "function";
1082
- t.length && (e = t.map(G), i = d ? s ? n.dateFormat(e) : e.map((c) => n.dateFormat(c)) : e.map((c) => this.formatDate(c, n.dateFormat))), a({ date: o ? e : e[0], formattedDate: o ? i : i[0], datepicker: this });
1083
- }
1084
- _handleAlreadySelectedDates(e, i) {
1085
- let { selectedDates: t, rangeDateFrom: n, rangeDateTo: a } = this, { range: s, toggleSelected: r } = this.opts, o = t.length, d = typeof r == "function" ? r({ datepicker: this, date: i }) : r, c = !!(s && o === 1 && e), u = c ? G(i) : i;
1086
- s && !d && (o !== 2 && this.selectDate(u), o === 2 && f(n, a)) || (d ? this.unselectDate(u) : this._updateLastSelectedDate(c ? u : e));
1087
- }
1088
- _handleUpDownActions(e, i) {
1089
- if (!((e = k(e || this.focusDate || this.viewDate)) instanceof Date)) return;
1090
- let t = i === "up" ? this.viewIndex + 1 : this.viewIndex - 1;
1091
- t > 2 && (t = 2), t < 0 && (t = 0), this.setViewDate(new Date(e.getFullYear(), e.getMonth(), 1)), this.setCurrentView(this.viewIndexes[t]);
1092
- }
1093
- getCell(e) {
1094
- let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : l.day;
1095
- if (!((e = k(e)) instanceof Date)) return;
1096
- let { year: t, month: n, date: a } = g(e), s = `[data-year="${t}"]`, r = `[data-month="${n}"]`, o = { [l.day]: `${s}${r}[data-date="${a}"]`, [l.month]: `${s}${r}`, [l.year]: `${s}` };
1097
- return this.views[this.currentView] ? this.views[this.currentView].$el.querySelector(o[i]) : void 0;
1098
- }
1099
- _showMobileOverlay() {
1100
- T.classList.add("-active-");
1101
- }
1102
- _hasTransition() {
1103
- return window.getComputedStyle(this.$datepicker).getPropertyValue("transition-duration").split(", ").reduce((e, i) => parseFloat(i) + e, 0) > 0;
1104
- }
1105
- get shouldUpdateDOM() {
1106
- return this.visible || this.treatAsInline;
1107
- }
1108
- get parsedViewDate() {
1109
- return g(this.viewDate);
1110
- }
1111
- get currentViewSingular() {
1112
- return this.currentView.slice(0, -1);
1113
- }
1114
- get curDecade() {
1115
- return x(this.viewDate);
1116
- }
1117
- get viewIndex() {
1118
- return this.viewIndexes.indexOf(this.currentView);
1119
- }
1120
- get isFinalView() {
1121
- return this.currentView === l.years;
1122
- }
1123
- get hasSelectedDates() {
1124
- return this.selectedDates.length > 0;
1125
- }
1126
- get isMinViewReached() {
1127
- return this.currentView === this.opts.minView || this.currentView === l.days;
1128
- }
1129
- get $container() {
1130
- return this.$customContainer || R;
1131
- }
1132
- static replacer(e, i, t) {
1133
- return e.replace(i, function(n, a, s, r) {
1134
- return a + t + r;
1135
- });
1136
- }
1137
- }
1138
- var ne;
1139
- return m(F, "defaults", te), m(F, "version", "3.6.0"), m(F, "defaultGlobalContainerId", "air-datepicker-global-container"), ne = F.prototype, Object.assign(ne, me), z.default;
1140
- }();
1141
- });
1142
- })(re);
1143
- var ye = re.exports;
1144
- const $e = /* @__PURE__ */ fe(ye);
1145
- export {
1146
- $e as default
1147
- };