@alto-avios/alto-ui 3.1.0 → 3.2.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 (96) hide show
  1. package/dist/assets/Accordion.css +1 -0
  2. package/dist/assets/AviosBadge.css +1 -0
  3. package/dist/assets/Button.css +1 -1
  4. package/dist/assets/CalloutBanner.css +1 -0
  5. package/dist/assets/ErrorSummary.css +1 -0
  6. package/dist/assets/FieldHeader.css +1 -1
  7. package/dist/assets/FieldLabel.css +1 -1
  8. package/dist/assets/Menu.css +1 -0
  9. package/dist/assets/PhoneNumberField.css +1 -1
  10. package/dist/assets/SelectCard.css +1 -0
  11. package/dist/assets/Tag.css +1 -1
  12. package/dist/assets/flex.css +1 -1
  13. package/dist/assets/position.css +1 -0
  14. package/dist/components/Accordion/Accordion.d.ts +35 -0
  15. package/dist/components/Accordion/Accordion.js +140 -0
  16. package/dist/components/Accordion/Accordion.js.map +1 -0
  17. package/dist/components/Accordion/index.d.ts +1 -0
  18. package/dist/components/Accordion/index.js +5 -0
  19. package/dist/components/Accordion/index.js.map +1 -0
  20. package/dist/components/AviosBadge/AviosBadge.d.ts +34 -0
  21. package/dist/components/AviosBadge/AviosBadge.js +58 -0
  22. package/dist/components/AviosBadge/AviosBadge.js.map +1 -0
  23. package/dist/components/AviosBadge/index.d.ts +1 -0
  24. package/dist/components/AviosBadge/index.js +5 -0
  25. package/dist/components/AviosBadge/index.js.map +1 -0
  26. package/dist/components/Badge/Badge.d.ts +7 -2
  27. package/dist/components/Badge/Badge.js +2 -1
  28. package/dist/components/Badge/Badge.js.map +1 -1
  29. package/dist/components/Box/Box.d.ts +4 -4
  30. package/dist/components/Box/Box.js +6 -3
  31. package/dist/components/Box/Box.js.map +1 -1
  32. package/dist/components/Button/Button.js +31 -31
  33. package/dist/components/CalloutBanner/CalloutBanner.d.ts +21 -0
  34. package/dist/components/CalloutBanner/CalloutBanner.js +96 -0
  35. package/dist/components/CalloutBanner/CalloutBanner.js.map +1 -0
  36. package/dist/components/CalloutBanner/index.d.ts +1 -0
  37. package/dist/components/CalloutBanner/index.js +5 -0
  38. package/dist/components/CalloutBanner/index.js.map +1 -0
  39. package/dist/components/Checkbox/index.d.ts +1 -0
  40. package/dist/components/CreditCardNumberField/CreditCardNumberField.d.ts +2 -2
  41. package/dist/components/CreditCardNumberField/CreditCardNumberField.js +4 -3
  42. package/dist/components/CreditCardNumberField/CreditCardNumberField.js.map +1 -1
  43. package/dist/components/DateField/DateField.d.ts +22 -3
  44. package/dist/components/DateField/DateField.js +856 -2
  45. package/dist/components/DateField/DateField.js.map +1 -1
  46. package/dist/components/ErrorSummary/ErrorSummary.d.ts +7 -0
  47. package/dist/components/ErrorSummary/ErrorSummary.js +44 -0
  48. package/dist/components/ErrorSummary/ErrorSummary.js.map +1 -0
  49. package/dist/components/ErrorSummary/index.d.ts +1 -0
  50. package/dist/components/ErrorSummary/index.js +5 -0
  51. package/dist/components/ErrorSummary/index.js.map +1 -0
  52. package/dist/components/FieldHeader/FieldHeader.js +6 -6
  53. package/dist/components/FieldLabel/FieldLabel.js +1 -1
  54. package/dist/components/Heading/Heading.d.ts +1 -1
  55. package/dist/components/Icon/Icon.d.ts +1 -0
  56. package/dist/components/Image/Image.d.ts +1 -1
  57. package/dist/components/Menu/Menu.d.ts +75 -0
  58. package/dist/components/Menu/Menu.js +356 -0
  59. package/dist/components/Menu/Menu.js.map +1 -0
  60. package/dist/components/Menu/index.d.ts +1 -0
  61. package/dist/components/Menu/index.js +5 -0
  62. package/dist/components/Menu/index.js.map +1 -0
  63. package/dist/components/Paragraph/Paragraph.d.ts +1 -1
  64. package/dist/components/PhoneNumberField/PhoneNumberField.d.ts +1 -1
  65. package/dist/components/PhoneNumberField/PhoneNumberField.js +13 -8
  66. package/dist/components/PhoneNumberField/PhoneNumberField.js.map +1 -1
  67. package/dist/components/Popover/Popover.d.ts +36 -4
  68. package/dist/components/Popover/Popover.js +21 -24
  69. package/dist/components/Popover/Popover.js.map +1 -1
  70. package/dist/components/Radio/index.d.ts +1 -0
  71. package/dist/components/SelectCard/SelectCard.d.ts +51 -0
  72. package/dist/components/SelectCard/SelectCard.js +85 -0
  73. package/dist/components/SelectCard/SelectCard.js.map +1 -0
  74. package/dist/components/SelectCard/index.d.ts +1 -0
  75. package/dist/components/SelectCard/index.js +5 -0
  76. package/dist/components/SelectCard/index.js.map +1 -0
  77. package/dist/components/SubHeading/SubHeading.d.ts +1 -1
  78. package/dist/components/Tag/Tag.js +4 -4
  79. package/dist/components/index.d.ts +6 -0
  80. package/dist/components/index.js +16 -4
  81. package/dist/components/index.js.map +1 -1
  82. package/dist/index.js +16 -4
  83. package/dist/index.js.map +1 -1
  84. package/dist/utils/border/border.d.ts +2 -2
  85. package/dist/utils/flex/flex.d.ts +10 -5
  86. package/dist/utils/flex/flex.js +383 -51
  87. package/dist/utils/flex/flex.js.map +1 -1
  88. package/dist/utils/flex/flex.test.d.ts +1 -0
  89. package/dist/utils/focus/focusStyles.d.ts +1 -1
  90. package/dist/utils/foregroundColour/foregroundColor.d.ts +1 -1
  91. package/dist/utils/position/position.d.ts +8 -0
  92. package/dist/utils/position/position.js +57 -0
  93. package/dist/utils/position/position.js.map +1 -0
  94. package/dist/utils/position/position.test.d.ts +1 -0
  95. package/dist/utils/stories/iconPropsArgTypes.js +49 -49
  96. package/package.json +1 -1
@@ -1,6 +1,7 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { DateField as DateField$1, DateInput, DateSegment } from "react-aria-components";
3
3
  import { Field } from "../_base/Field/Field.js";
4
+ import { useMemo, useState } from "react";
4
5
  import '../../assets/DateField.css';const dateField = "_dateField_1bpet_1";
5
6
  const dateInput = "_dateInput_1bpet_5";
6
7
  const dateSegment = "_dateSegment_1bpet_50";
@@ -9,8 +10,861 @@ const styles = {
9
10
  dateInput,
10
11
  dateSegment
11
12
  };
12
- const DateField = (props) => {
13
- return /* @__PURE__ */ jsx(Field, { as: DateField$1, className: styles.dateField, ...props, children: /* @__PURE__ */ jsx(DateInput, { className: styles.dateInput, children: (segment) => /* @__PURE__ */ jsx(DateSegment, { className: styles.dateSegment, segment }) }) });
13
+ function $2b4dce13dd5a17fa$export$842a2cf37af977e1(amount, numerator) {
14
+ return amount - numerator * Math.floor(amount / numerator);
15
+ }
16
+ const $3b62074eb05584b2$var$EPOCH = 1721426;
17
+ function $3b62074eb05584b2$export$f297eb839006d339(era, year, month, day) {
18
+ year = $3b62074eb05584b2$export$c36e0ecb2d4fa69d(era, year);
19
+ let y1 = year - 1;
20
+ let monthOffset = -2;
21
+ if (month <= 2) monthOffset = 0;
22
+ else if ($3b62074eb05584b2$export$553d7fa8e3805fc0(year)) monthOffset = -1;
23
+ return $3b62074eb05584b2$var$EPOCH - 1 + 365 * y1 + Math.floor(y1 / 4) - Math.floor(y1 / 100) + Math.floor(y1 / 400) + Math.floor((367 * month - 362) / 12 + monthOffset + day);
24
+ }
25
+ function $3b62074eb05584b2$export$553d7fa8e3805fc0(year) {
26
+ return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
27
+ }
28
+ function $3b62074eb05584b2$export$c36e0ecb2d4fa69d(era, year) {
29
+ return era === "BC" ? 1 - year : year;
30
+ }
31
+ function $3b62074eb05584b2$export$4475b7e617eb123c(year) {
32
+ let era = "AD";
33
+ if (year <= 0) {
34
+ era = "BC";
35
+ year = 1 - year;
36
+ }
37
+ return [
38
+ era,
39
+ year
40
+ ];
41
+ }
42
+ const $3b62074eb05584b2$var$daysInMonth = {
43
+ standard: [
44
+ 31,
45
+ 28,
46
+ 31,
47
+ 30,
48
+ 31,
49
+ 30,
50
+ 31,
51
+ 31,
52
+ 30,
53
+ 31,
54
+ 30,
55
+ 31
56
+ ],
57
+ leapyear: [
58
+ 31,
59
+ 29,
60
+ 31,
61
+ 30,
62
+ 31,
63
+ 30,
64
+ 31,
65
+ 31,
66
+ 30,
67
+ 31,
68
+ 30,
69
+ 31
70
+ ]
71
+ };
72
+ class $3b62074eb05584b2$export$80ee6245ec4f29ec {
73
+ fromJulianDay(jd) {
74
+ let jd0 = jd;
75
+ let depoch = jd0 - $3b62074eb05584b2$var$EPOCH;
76
+ let quadricent = Math.floor(depoch / 146097);
77
+ let dqc = $2b4dce13dd5a17fa$export$842a2cf37af977e1(depoch, 146097);
78
+ let cent = Math.floor(dqc / 36524);
79
+ let dcent = $2b4dce13dd5a17fa$export$842a2cf37af977e1(dqc, 36524);
80
+ let quad = Math.floor(dcent / 1461);
81
+ let dquad = $2b4dce13dd5a17fa$export$842a2cf37af977e1(dcent, 1461);
82
+ let yindex = Math.floor(dquad / 365);
83
+ let extendedYear = quadricent * 400 + cent * 100 + quad * 4 + yindex + (cent !== 4 && yindex !== 4 ? 1 : 0);
84
+ let [era, year] = $3b62074eb05584b2$export$4475b7e617eb123c(extendedYear);
85
+ let yearDay = jd0 - $3b62074eb05584b2$export$f297eb839006d339(era, year, 1, 1);
86
+ let leapAdj = 2;
87
+ if (jd0 < $3b62074eb05584b2$export$f297eb839006d339(era, year, 3, 1)) leapAdj = 0;
88
+ else if ($3b62074eb05584b2$export$553d7fa8e3805fc0(year)) leapAdj = 1;
89
+ let month = Math.floor(((yearDay + leapAdj) * 12 + 373) / 367);
90
+ let day = jd0 - $3b62074eb05584b2$export$f297eb839006d339(era, year, month, 1) + 1;
91
+ return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(era, year, month, day);
92
+ }
93
+ toJulianDay(date) {
94
+ return $3b62074eb05584b2$export$f297eb839006d339(date.era, date.year, date.month, date.day);
95
+ }
96
+ getDaysInMonth(date) {
97
+ return $3b62074eb05584b2$var$daysInMonth[$3b62074eb05584b2$export$553d7fa8e3805fc0(date.year) ? "leapyear" : "standard"][date.month - 1];
98
+ }
99
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
100
+ getMonthsInYear(date) {
101
+ return 12;
102
+ }
103
+ getDaysInYear(date) {
104
+ return $3b62074eb05584b2$export$553d7fa8e3805fc0(date.year) ? 366 : 365;
105
+ }
106
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
107
+ getYearsInEra(date) {
108
+ return 9999;
109
+ }
110
+ getEras() {
111
+ return [
112
+ "BC",
113
+ "AD"
114
+ ];
115
+ }
116
+ isInverseEra(date) {
117
+ return date.era === "BC";
118
+ }
119
+ balanceDate(date) {
120
+ if (date.year <= 0) {
121
+ date.era = date.era === "BC" ? "AD" : "BC";
122
+ date.year = 1 - date.year;
123
+ }
124
+ }
125
+ constructor() {
126
+ this.identifier = "gregory";
127
+ }
128
+ }
129
+ function $14e0f24ef4ac5c92$export$68781ddf31c0090f(a, b) {
130
+ return a.calendar.toJulianDay(a) - b.calendar.toJulianDay(b);
131
+ }
132
+ function $14e0f24ef4ac5c92$export$c19a80a9721b80f6(a, b) {
133
+ return $14e0f24ef4ac5c92$var$timeToMs(a) - $14e0f24ef4ac5c92$var$timeToMs(b);
134
+ }
135
+ function $14e0f24ef4ac5c92$var$timeToMs(a) {
136
+ return a.hour * 36e5 + a.minute * 6e4 + a.second * 1e3 + a.millisecond;
137
+ }
138
+ let $14e0f24ef4ac5c92$var$localTimeZone = null;
139
+ function $14e0f24ef4ac5c92$export$aa8b41735afcabd2() {
140
+ if ($14e0f24ef4ac5c92$var$localTimeZone == null) $14e0f24ef4ac5c92$var$localTimeZone = new Intl.DateTimeFormat().resolvedOptions().timeZone;
141
+ return $14e0f24ef4ac5c92$var$localTimeZone;
142
+ }
143
+ function $11d87f3f76e88657$export$bd4fb2bc8bb06fb(date) {
144
+ date = $11d87f3f76e88657$export$b4a036af3fc0b032(date, new $3b62074eb05584b2$export$80ee6245ec4f29ec());
145
+ let year = $3b62074eb05584b2$export$c36e0ecb2d4fa69d(date.era, date.year);
146
+ return $11d87f3f76e88657$var$epochFromParts(year, date.month, date.day, date.hour, date.minute, date.second, date.millisecond);
147
+ }
148
+ function $11d87f3f76e88657$var$epochFromParts(year, month, day, hour, minute, second, millisecond) {
149
+ let date = /* @__PURE__ */ new Date();
150
+ date.setUTCHours(hour, minute, second, millisecond);
151
+ date.setUTCFullYear(year, month - 1, day);
152
+ return date.getTime();
153
+ }
154
+ function $11d87f3f76e88657$export$59c99f3515d3493f(ms, timeZone) {
155
+ if (timeZone === "UTC") return 0;
156
+ if (ms > 0 && timeZone === $14e0f24ef4ac5c92$export$aa8b41735afcabd2()) return new Date(ms).getTimezoneOffset() * -6e4;
157
+ let { year, month, day, hour, minute, second } = $11d87f3f76e88657$var$getTimeZoneParts(ms, timeZone);
158
+ let utc = $11d87f3f76e88657$var$epochFromParts(year, month, day, hour, minute, second, 0);
159
+ return utc - Math.floor(ms / 1e3) * 1e3;
160
+ }
161
+ const $11d87f3f76e88657$var$formattersByTimeZone = /* @__PURE__ */ new Map();
162
+ function $11d87f3f76e88657$var$getTimeZoneParts(ms, timeZone) {
163
+ let formatter = $11d87f3f76e88657$var$formattersByTimeZone.get(timeZone);
164
+ if (!formatter) {
165
+ formatter = new Intl.DateTimeFormat("en-US", {
166
+ timeZone,
167
+ hour12: false,
168
+ era: "short",
169
+ year: "numeric",
170
+ month: "numeric",
171
+ day: "numeric",
172
+ hour: "numeric",
173
+ minute: "numeric",
174
+ second: "numeric"
175
+ });
176
+ $11d87f3f76e88657$var$formattersByTimeZone.set(timeZone, formatter);
177
+ }
178
+ let parts = formatter.formatToParts(new Date(ms));
179
+ let namedParts = {};
180
+ for (let part of parts) if (part.type !== "literal") namedParts[part.type] = part.value;
181
+ return {
182
+ // Firefox returns B instead of BC... https://bugzilla.mozilla.org/show_bug.cgi?id=1752253
183
+ year: namedParts.era === "BC" || namedParts.era === "B" ? -namedParts.year + 1 : +namedParts.year,
184
+ month: +namedParts.month,
185
+ day: +namedParts.day,
186
+ hour: namedParts.hour === "24" ? 0 : +namedParts.hour,
187
+ minute: +namedParts.minute,
188
+ second: +namedParts.second
189
+ };
190
+ }
191
+ const $11d87f3f76e88657$var$DAYMILLIS = 864e5;
192
+ function $11d87f3f76e88657$var$getValidWallTimes(date, timeZone, earlier, later) {
193
+ let found = earlier === later ? [
194
+ earlier
195
+ ] : [
196
+ earlier,
197
+ later
198
+ ];
199
+ return found.filter((absolute) => $11d87f3f76e88657$var$isValidWallTime(date, timeZone, absolute));
200
+ }
201
+ function $11d87f3f76e88657$var$isValidWallTime(date, timeZone, absolute) {
202
+ let parts = $11d87f3f76e88657$var$getTimeZoneParts(absolute, timeZone);
203
+ return date.year === parts.year && date.month === parts.month && date.day === parts.day && date.hour === parts.hour && date.minute === parts.minute && date.second === parts.second;
204
+ }
205
+ function $11d87f3f76e88657$export$5107c82f94518f5c(date, timeZone, disambiguation = "compatible") {
206
+ let dateTime = $11d87f3f76e88657$export$b21e0b124e224484(date);
207
+ if (timeZone === "UTC") return $11d87f3f76e88657$export$bd4fb2bc8bb06fb(dateTime);
208
+ if (timeZone === $14e0f24ef4ac5c92$export$aa8b41735afcabd2() && disambiguation === "compatible") {
209
+ dateTime = $11d87f3f76e88657$export$b4a036af3fc0b032(dateTime, new $3b62074eb05584b2$export$80ee6245ec4f29ec());
210
+ let date2 = /* @__PURE__ */ new Date();
211
+ let year = $3b62074eb05584b2$export$c36e0ecb2d4fa69d(dateTime.era, dateTime.year);
212
+ date2.setFullYear(year, dateTime.month - 1, dateTime.day);
213
+ date2.setHours(dateTime.hour, dateTime.minute, dateTime.second, dateTime.millisecond);
214
+ return date2.getTime();
215
+ }
216
+ let ms = $11d87f3f76e88657$export$bd4fb2bc8bb06fb(dateTime);
217
+ let offsetBefore = $11d87f3f76e88657$export$59c99f3515d3493f(ms - $11d87f3f76e88657$var$DAYMILLIS, timeZone);
218
+ let offsetAfter = $11d87f3f76e88657$export$59c99f3515d3493f(ms + $11d87f3f76e88657$var$DAYMILLIS, timeZone);
219
+ let valid = $11d87f3f76e88657$var$getValidWallTimes(dateTime, timeZone, ms - offsetBefore, ms - offsetAfter);
220
+ if (valid.length === 1) return valid[0];
221
+ if (valid.length > 1) switch (disambiguation) {
222
+ case "compatible":
223
+ case "earlier":
224
+ return valid[0];
225
+ case "later":
226
+ return valid[valid.length - 1];
227
+ case "reject":
228
+ throw new RangeError("Multiple possible absolute times found");
229
+ }
230
+ switch (disambiguation) {
231
+ case "earlier":
232
+ return Math.min(ms - offsetBefore, ms - offsetAfter);
233
+ case "compatible":
234
+ case "later":
235
+ return Math.max(ms - offsetBefore, ms - offsetAfter);
236
+ case "reject":
237
+ throw new RangeError("No such absolute time found");
238
+ }
239
+ }
240
+ function $11d87f3f76e88657$export$e67a095c620b86fe(dateTime, timeZone, disambiguation = "compatible") {
241
+ return new Date($11d87f3f76e88657$export$5107c82f94518f5c(dateTime, timeZone, disambiguation));
242
+ }
243
+ function $11d87f3f76e88657$export$1b96692a1ba042ac(ms, timeZone) {
244
+ let offset = $11d87f3f76e88657$export$59c99f3515d3493f(ms, timeZone);
245
+ let date = new Date(ms + offset);
246
+ let year = date.getUTCFullYear();
247
+ let month = date.getUTCMonth() + 1;
248
+ let day = date.getUTCDate();
249
+ let hour = date.getUTCHours();
250
+ let minute = date.getUTCMinutes();
251
+ let second = date.getUTCSeconds();
252
+ let millisecond = date.getUTCMilliseconds();
253
+ return new $35ea8db9cb2ccb90$export$d3b7288e7994edea(year < 1 ? "BC" : "AD", year < 1 ? -year + 1 : year, month, day, timeZone, offset, hour, minute, second, millisecond);
254
+ }
255
+ function $11d87f3f76e88657$export$b21e0b124e224484(date, time) {
256
+ let hour = 0, minute = 0, second = 0, millisecond = 0;
257
+ if ("timeZone" in date) ({ hour, minute, second, millisecond } = date);
258
+ else if ("hour" in date && !time) return date;
259
+ if (time) ({ hour, minute, second, millisecond } = time);
260
+ return new $35ea8db9cb2ccb90$export$ca871e8dbb80966f(date.calendar, date.era, date.year, date.month, date.day, hour, minute, second, millisecond);
261
+ }
262
+ function $11d87f3f76e88657$export$b4a036af3fc0b032(date, calendar) {
263
+ if (date.calendar.identifier === calendar.identifier) return date;
264
+ let calendarDate = calendar.fromJulianDay(date.calendar.toJulianDay(date));
265
+ let copy = date.copy();
266
+ copy.calendar = calendar;
267
+ copy.era = calendarDate.era;
268
+ copy.year = calendarDate.year;
269
+ copy.month = calendarDate.month;
270
+ copy.day = calendarDate.day;
271
+ $735220c2d4774dd3$export$c4e2ecac49351ef2(copy);
272
+ return copy;
273
+ }
274
+ function $11d87f3f76e88657$export$84c95a83c799e074(date, timeZone, disambiguation) {
275
+ if (date instanceof $35ea8db9cb2ccb90$export$d3b7288e7994edea) {
276
+ if (date.timeZone === timeZone) return date;
277
+ return $11d87f3f76e88657$export$538b00033cc11c75(date, timeZone);
278
+ }
279
+ let ms = $11d87f3f76e88657$export$5107c82f94518f5c(date, timeZone, disambiguation);
280
+ return $11d87f3f76e88657$export$1b96692a1ba042ac(ms, timeZone);
281
+ }
282
+ function $11d87f3f76e88657$export$83aac07b4c37b25(date) {
283
+ let ms = $11d87f3f76e88657$export$bd4fb2bc8bb06fb(date) - date.offset;
284
+ return new Date(ms);
285
+ }
286
+ function $11d87f3f76e88657$export$538b00033cc11c75(date, timeZone) {
287
+ let ms = $11d87f3f76e88657$export$bd4fb2bc8bb06fb(date) - date.offset;
288
+ return $11d87f3f76e88657$export$b4a036af3fc0b032($11d87f3f76e88657$export$1b96692a1ba042ac(ms, timeZone), date.calendar);
289
+ }
290
+ const $735220c2d4774dd3$var$ONE_HOUR = 36e5;
291
+ function $735220c2d4774dd3$export$e16d8520af44a096(date, duration) {
292
+ let mutableDate = date.copy();
293
+ let days = "hour" in mutableDate ? $735220c2d4774dd3$var$addTimeFields(mutableDate, duration) : 0;
294
+ $735220c2d4774dd3$var$addYears(mutableDate, duration.years || 0);
295
+ if (mutableDate.calendar.balanceYearMonth) mutableDate.calendar.balanceYearMonth(mutableDate, date);
296
+ mutableDate.month += duration.months || 0;
297
+ $735220c2d4774dd3$var$balanceYearMonth(mutableDate);
298
+ $735220c2d4774dd3$var$constrainMonthDay(mutableDate);
299
+ mutableDate.day += (duration.weeks || 0) * 7;
300
+ mutableDate.day += duration.days || 0;
301
+ mutableDate.day += days;
302
+ $735220c2d4774dd3$var$balanceDay(mutableDate);
303
+ if (mutableDate.calendar.balanceDate) mutableDate.calendar.balanceDate(mutableDate);
304
+ if (mutableDate.year < 1) {
305
+ mutableDate.year = 1;
306
+ mutableDate.month = 1;
307
+ mutableDate.day = 1;
308
+ }
309
+ let maxYear = mutableDate.calendar.getYearsInEra(mutableDate);
310
+ if (mutableDate.year > maxYear) {
311
+ var _mutableDate_calendar_isInverseEra, _mutableDate_calendar;
312
+ let isInverseEra = (_mutableDate_calendar_isInverseEra = (_mutableDate_calendar = mutableDate.calendar).isInverseEra) === null || _mutableDate_calendar_isInverseEra === void 0 ? void 0 : _mutableDate_calendar_isInverseEra.call(_mutableDate_calendar, mutableDate);
313
+ mutableDate.year = maxYear;
314
+ mutableDate.month = isInverseEra ? 1 : mutableDate.calendar.getMonthsInYear(mutableDate);
315
+ mutableDate.day = isInverseEra ? 1 : mutableDate.calendar.getDaysInMonth(mutableDate);
316
+ }
317
+ if (mutableDate.month < 1) {
318
+ mutableDate.month = 1;
319
+ mutableDate.day = 1;
320
+ }
321
+ let maxMonth = mutableDate.calendar.getMonthsInYear(mutableDate);
322
+ if (mutableDate.month > maxMonth) {
323
+ mutableDate.month = maxMonth;
324
+ mutableDate.day = mutableDate.calendar.getDaysInMonth(mutableDate);
325
+ }
326
+ mutableDate.day = Math.max(1, Math.min(mutableDate.calendar.getDaysInMonth(mutableDate), mutableDate.day));
327
+ return mutableDate;
328
+ }
329
+ function $735220c2d4774dd3$var$addYears(date, years) {
330
+ var _date_calendar_isInverseEra, _date_calendar;
331
+ if ((_date_calendar_isInverseEra = (_date_calendar = date.calendar).isInverseEra) === null || _date_calendar_isInverseEra === void 0 ? void 0 : _date_calendar_isInverseEra.call(_date_calendar, date)) years = -years;
332
+ date.year += years;
333
+ }
334
+ function $735220c2d4774dd3$var$balanceYearMonth(date) {
335
+ while (date.month < 1) {
336
+ $735220c2d4774dd3$var$addYears(date, -1);
337
+ date.month += date.calendar.getMonthsInYear(date);
338
+ }
339
+ let monthsInYear = 0;
340
+ while (date.month > (monthsInYear = date.calendar.getMonthsInYear(date))) {
341
+ date.month -= monthsInYear;
342
+ $735220c2d4774dd3$var$addYears(date, 1);
343
+ }
344
+ }
345
+ function $735220c2d4774dd3$var$balanceDay(date) {
346
+ while (date.day < 1) {
347
+ date.month--;
348
+ $735220c2d4774dd3$var$balanceYearMonth(date);
349
+ date.day += date.calendar.getDaysInMonth(date);
350
+ }
351
+ while (date.day > date.calendar.getDaysInMonth(date)) {
352
+ date.day -= date.calendar.getDaysInMonth(date);
353
+ date.month++;
354
+ $735220c2d4774dd3$var$balanceYearMonth(date);
355
+ }
356
+ }
357
+ function $735220c2d4774dd3$var$constrainMonthDay(date) {
358
+ date.month = Math.max(1, Math.min(date.calendar.getMonthsInYear(date), date.month));
359
+ date.day = Math.max(1, Math.min(date.calendar.getDaysInMonth(date), date.day));
360
+ }
361
+ function $735220c2d4774dd3$export$c4e2ecac49351ef2(date) {
362
+ if (date.calendar.constrainDate) date.calendar.constrainDate(date);
363
+ date.year = Math.max(1, Math.min(date.calendar.getYearsInEra(date), date.year));
364
+ $735220c2d4774dd3$var$constrainMonthDay(date);
365
+ }
366
+ function $735220c2d4774dd3$export$3e2544e88a25bff8(duration) {
367
+ let inverseDuration = {};
368
+ for (let key in duration) if (typeof duration[key] === "number") inverseDuration[key] = -duration[key];
369
+ return inverseDuration;
370
+ }
371
+ function $735220c2d4774dd3$export$4e2d2ead65e5f7e3(date, duration) {
372
+ return $735220c2d4774dd3$export$e16d8520af44a096(date, $735220c2d4774dd3$export$3e2544e88a25bff8(duration));
373
+ }
374
+ function $735220c2d4774dd3$export$adaa4cf7ef1b65be(date, fields) {
375
+ let mutableDate = date.copy();
376
+ if (fields.era != null) mutableDate.era = fields.era;
377
+ if (fields.year != null) mutableDate.year = fields.year;
378
+ if (fields.month != null) mutableDate.month = fields.month;
379
+ if (fields.day != null) mutableDate.day = fields.day;
380
+ $735220c2d4774dd3$export$c4e2ecac49351ef2(mutableDate);
381
+ return mutableDate;
382
+ }
383
+ function $735220c2d4774dd3$export$e5d5e1c1822b6e56(value, fields) {
384
+ let mutableValue = value.copy();
385
+ if (fields.hour != null) mutableValue.hour = fields.hour;
386
+ if (fields.minute != null) mutableValue.minute = fields.minute;
387
+ if (fields.second != null) mutableValue.second = fields.second;
388
+ if (fields.millisecond != null) mutableValue.millisecond = fields.millisecond;
389
+ $735220c2d4774dd3$export$7555de1e070510cb(mutableValue);
390
+ return mutableValue;
391
+ }
392
+ function $735220c2d4774dd3$var$balanceTime(time) {
393
+ time.second += Math.floor(time.millisecond / 1e3);
394
+ time.millisecond = $735220c2d4774dd3$var$nonNegativeMod(time.millisecond, 1e3);
395
+ time.minute += Math.floor(time.second / 60);
396
+ time.second = $735220c2d4774dd3$var$nonNegativeMod(time.second, 60);
397
+ time.hour += Math.floor(time.minute / 60);
398
+ time.minute = $735220c2d4774dd3$var$nonNegativeMod(time.minute, 60);
399
+ let days = Math.floor(time.hour / 24);
400
+ time.hour = $735220c2d4774dd3$var$nonNegativeMod(time.hour, 24);
401
+ return days;
402
+ }
403
+ function $735220c2d4774dd3$export$7555de1e070510cb(time) {
404
+ time.millisecond = Math.max(0, Math.min(time.millisecond, 1e3));
405
+ time.second = Math.max(0, Math.min(time.second, 59));
406
+ time.minute = Math.max(0, Math.min(time.minute, 59));
407
+ time.hour = Math.max(0, Math.min(time.hour, 23));
408
+ }
409
+ function $735220c2d4774dd3$var$nonNegativeMod(a, b) {
410
+ let result = a % b;
411
+ if (result < 0) result += b;
412
+ return result;
413
+ }
414
+ function $735220c2d4774dd3$var$addTimeFields(time, duration) {
415
+ time.hour += duration.hours || 0;
416
+ time.minute += duration.minutes || 0;
417
+ time.second += duration.seconds || 0;
418
+ time.millisecond += duration.milliseconds || 0;
419
+ return $735220c2d4774dd3$var$balanceTime(time);
420
+ }
421
+ function $735220c2d4774dd3$export$d52ced6badfb9a4c(value, field, amount, options) {
422
+ let mutable = value.copy();
423
+ switch (field) {
424
+ case "era": {
425
+ let eras = value.calendar.getEras();
426
+ let eraIndex = eras.indexOf(value.era);
427
+ if (eraIndex < 0) throw new Error("Invalid era: " + value.era);
428
+ eraIndex = $735220c2d4774dd3$var$cycleValue(eraIndex, amount, 0, eras.length - 1, options === null || options === void 0 ? void 0 : options.round);
429
+ mutable.era = eras[eraIndex];
430
+ $735220c2d4774dd3$export$c4e2ecac49351ef2(mutable);
431
+ break;
432
+ }
433
+ case "year":
434
+ var _mutable_calendar_isInverseEra, _mutable_calendar;
435
+ if ((_mutable_calendar_isInverseEra = (_mutable_calendar = mutable.calendar).isInverseEra) === null || _mutable_calendar_isInverseEra === void 0 ? void 0 : _mutable_calendar_isInverseEra.call(_mutable_calendar, mutable)) amount = -amount;
436
+ mutable.year = $735220c2d4774dd3$var$cycleValue(value.year, amount, -Infinity, 9999, options === null || options === void 0 ? void 0 : options.round);
437
+ if (mutable.year === -Infinity) mutable.year = 1;
438
+ if (mutable.calendar.balanceYearMonth) mutable.calendar.balanceYearMonth(mutable, value);
439
+ break;
440
+ case "month":
441
+ mutable.month = $735220c2d4774dd3$var$cycleValue(value.month, amount, 1, value.calendar.getMonthsInYear(value), options === null || options === void 0 ? void 0 : options.round);
442
+ break;
443
+ case "day":
444
+ mutable.day = $735220c2d4774dd3$var$cycleValue(value.day, amount, 1, value.calendar.getDaysInMonth(value), options === null || options === void 0 ? void 0 : options.round);
445
+ break;
446
+ default:
447
+ throw new Error("Unsupported field " + field);
448
+ }
449
+ if (value.calendar.balanceDate) value.calendar.balanceDate(mutable);
450
+ $735220c2d4774dd3$export$c4e2ecac49351ef2(mutable);
451
+ return mutable;
452
+ }
453
+ function $735220c2d4774dd3$export$dd02b3e0007dfe28(value, field, amount, options) {
454
+ let mutable = value.copy();
455
+ switch (field) {
456
+ case "hour": {
457
+ let hours = value.hour;
458
+ let min = 0;
459
+ let max = 23;
460
+ if ((options === null || options === void 0 ? void 0 : options.hourCycle) === 12) {
461
+ let isPM = hours >= 12;
462
+ min = isPM ? 12 : 0;
463
+ max = isPM ? 23 : 11;
464
+ }
465
+ mutable.hour = $735220c2d4774dd3$var$cycleValue(hours, amount, min, max, options === null || options === void 0 ? void 0 : options.round);
466
+ break;
467
+ }
468
+ case "minute":
469
+ mutable.minute = $735220c2d4774dd3$var$cycleValue(value.minute, amount, 0, 59, options === null || options === void 0 ? void 0 : options.round);
470
+ break;
471
+ case "second":
472
+ mutable.second = $735220c2d4774dd3$var$cycleValue(value.second, amount, 0, 59, options === null || options === void 0 ? void 0 : options.round);
473
+ break;
474
+ case "millisecond":
475
+ mutable.millisecond = $735220c2d4774dd3$var$cycleValue(value.millisecond, amount, 0, 999, options === null || options === void 0 ? void 0 : options.round);
476
+ break;
477
+ default:
478
+ throw new Error("Unsupported field " + field);
479
+ }
480
+ return mutable;
481
+ }
482
+ function $735220c2d4774dd3$var$cycleValue(value, amount, min, max, round = false) {
483
+ if (round) {
484
+ value += Math.sign(amount);
485
+ if (value < min) value = max;
486
+ let div = Math.abs(amount);
487
+ if (amount > 0) value = Math.ceil(value / div) * div;
488
+ else value = Math.floor(value / div) * div;
489
+ if (value > max) value = min;
490
+ } else {
491
+ value += amount;
492
+ if (value < min) value = max - (min - value - 1);
493
+ else if (value > max) value = min + (value - max - 1);
494
+ }
495
+ return value;
496
+ }
497
+ function $735220c2d4774dd3$export$96b1d28349274637(dateTime, duration) {
498
+ let ms;
499
+ if (duration.years != null && duration.years !== 0 || duration.months != null && duration.months !== 0 || duration.weeks != null && duration.weeks !== 0 || duration.days != null && duration.days !== 0) {
500
+ let res2 = $735220c2d4774dd3$export$e16d8520af44a096($11d87f3f76e88657$export$b21e0b124e224484(dateTime), {
501
+ years: duration.years,
502
+ months: duration.months,
503
+ weeks: duration.weeks,
504
+ days: duration.days
505
+ });
506
+ ms = $11d87f3f76e88657$export$5107c82f94518f5c(res2, dateTime.timeZone);
507
+ } else
508
+ ms = $11d87f3f76e88657$export$bd4fb2bc8bb06fb(dateTime) - dateTime.offset;
509
+ ms += duration.milliseconds || 0;
510
+ ms += (duration.seconds || 0) * 1e3;
511
+ ms += (duration.minutes || 0) * 6e4;
512
+ ms += (duration.hours || 0) * 36e5;
513
+ let res = $11d87f3f76e88657$export$1b96692a1ba042ac(ms, dateTime.timeZone);
514
+ return $11d87f3f76e88657$export$b4a036af3fc0b032(res, dateTime.calendar);
515
+ }
516
+ function $735220c2d4774dd3$export$6814caac34ca03c7(dateTime, duration) {
517
+ return $735220c2d4774dd3$export$96b1d28349274637(dateTime, $735220c2d4774dd3$export$3e2544e88a25bff8(duration));
518
+ }
519
+ function $735220c2d4774dd3$export$9a297d111fc86b79(dateTime, field, amount, options) {
520
+ switch (field) {
521
+ case "hour": {
522
+ let min = 0;
523
+ let max = 23;
524
+ if ((options === null || options === void 0 ? void 0 : options.hourCycle) === 12) {
525
+ let isPM = dateTime.hour >= 12;
526
+ min = isPM ? 12 : 0;
527
+ max = isPM ? 23 : 11;
528
+ }
529
+ let plainDateTime = $11d87f3f76e88657$export$b21e0b124e224484(dateTime);
530
+ let minDate = $11d87f3f76e88657$export$b4a036af3fc0b032($735220c2d4774dd3$export$e5d5e1c1822b6e56(plainDateTime, {
531
+ hour: min
532
+ }), new $3b62074eb05584b2$export$80ee6245ec4f29ec());
533
+ let minAbsolute = [
534
+ $11d87f3f76e88657$export$5107c82f94518f5c(minDate, dateTime.timeZone, "earlier"),
535
+ $11d87f3f76e88657$export$5107c82f94518f5c(minDate, dateTime.timeZone, "later")
536
+ ].filter((ms2) => $11d87f3f76e88657$export$1b96692a1ba042ac(ms2, dateTime.timeZone).day === minDate.day)[0];
537
+ let maxDate = $11d87f3f76e88657$export$b4a036af3fc0b032($735220c2d4774dd3$export$e5d5e1c1822b6e56(plainDateTime, {
538
+ hour: max
539
+ }), new $3b62074eb05584b2$export$80ee6245ec4f29ec());
540
+ let maxAbsolute = [
541
+ $11d87f3f76e88657$export$5107c82f94518f5c(maxDate, dateTime.timeZone, "earlier"),
542
+ $11d87f3f76e88657$export$5107c82f94518f5c(maxDate, dateTime.timeZone, "later")
543
+ ].filter((ms2) => $11d87f3f76e88657$export$1b96692a1ba042ac(ms2, dateTime.timeZone).day === maxDate.day).pop();
544
+ let ms = $11d87f3f76e88657$export$bd4fb2bc8bb06fb(dateTime) - dateTime.offset;
545
+ let hours = Math.floor(ms / $735220c2d4774dd3$var$ONE_HOUR);
546
+ let remainder = ms % $735220c2d4774dd3$var$ONE_HOUR;
547
+ ms = $735220c2d4774dd3$var$cycleValue(hours, amount, Math.floor(minAbsolute / $735220c2d4774dd3$var$ONE_HOUR), Math.floor(maxAbsolute / $735220c2d4774dd3$var$ONE_HOUR), options === null || options === void 0 ? void 0 : options.round) * $735220c2d4774dd3$var$ONE_HOUR + remainder;
548
+ return $11d87f3f76e88657$export$b4a036af3fc0b032($11d87f3f76e88657$export$1b96692a1ba042ac(ms, dateTime.timeZone), dateTime.calendar);
549
+ }
550
+ case "minute":
551
+ case "second":
552
+ case "millisecond":
553
+ return $735220c2d4774dd3$export$dd02b3e0007dfe28(dateTime, field, amount, options);
554
+ case "era":
555
+ case "year":
556
+ case "month":
557
+ case "day": {
558
+ let res = $735220c2d4774dd3$export$d52ced6badfb9a4c($11d87f3f76e88657$export$b21e0b124e224484(dateTime), field, amount, options);
559
+ let ms = $11d87f3f76e88657$export$5107c82f94518f5c(res, dateTime.timeZone);
560
+ return $11d87f3f76e88657$export$b4a036af3fc0b032($11d87f3f76e88657$export$1b96692a1ba042ac(ms, dateTime.timeZone), dateTime.calendar);
561
+ }
562
+ default:
563
+ throw new Error("Unsupported field " + field);
564
+ }
565
+ }
566
+ function $735220c2d4774dd3$export$31b5430eb18be4f8(dateTime, fields, disambiguation) {
567
+ let plainDateTime = $11d87f3f76e88657$export$b21e0b124e224484(dateTime);
568
+ let res = $735220c2d4774dd3$export$e5d5e1c1822b6e56($735220c2d4774dd3$export$adaa4cf7ef1b65be(plainDateTime, fields), fields);
569
+ if (res.compare(plainDateTime) === 0) return dateTime;
570
+ let ms = $11d87f3f76e88657$export$5107c82f94518f5c(res, dateTime.timeZone, disambiguation);
571
+ return $11d87f3f76e88657$export$b4a036af3fc0b032($11d87f3f76e88657$export$1b96692a1ba042ac(ms, dateTime.timeZone), dateTime.calendar);
572
+ }
573
+ const $fae977aafc393c5c$var$DATE_TIME_RE = /^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?$/;
574
+ const $fae977aafc393c5c$var$ABSOLUTE_RE = /^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;
575
+ function $fae977aafc393c5c$export$588937bcd60ade55(value) {
576
+ let m = value.match($fae977aafc393c5c$var$DATE_TIME_RE);
577
+ if (!m) throw new Error("Invalid ISO 8601 date time string: " + value);
578
+ let year = $fae977aafc393c5c$var$parseNumber(m[1], -9999, 9999);
579
+ let era = year < 1 ? "BC" : "AD";
580
+ let date = new $35ea8db9cb2ccb90$export$ca871e8dbb80966f(era, year < 1 ? -year + 1 : year, $fae977aafc393c5c$var$parseNumber(m[2], 1, 12), 1, m[4] ? $fae977aafc393c5c$var$parseNumber(m[4], 0, 23) : 0, m[5] ? $fae977aafc393c5c$var$parseNumber(m[5], 0, 59) : 0, m[6] ? $fae977aafc393c5c$var$parseNumber(m[6], 0, 59) : 0, m[7] ? $fae977aafc393c5c$var$parseNumber(m[7], 0, Infinity) * 1e3 : 0);
581
+ date.day = $fae977aafc393c5c$var$parseNumber(m[3], 0, date.calendar.getDaysInMonth(date));
582
+ return date;
583
+ }
584
+ function $fae977aafc393c5c$export$5adfdab05168c219(value, timeZone) {
585
+ let m = value.match($fae977aafc393c5c$var$ABSOLUTE_RE);
586
+ if (!m) throw new Error("Invalid ISO 8601 date time string: " + value);
587
+ let year = $fae977aafc393c5c$var$parseNumber(m[1], -9999, 9999);
588
+ let era = year < 1 ? "BC" : "AD";
589
+ let date = new $35ea8db9cb2ccb90$export$d3b7288e7994edea(era, year < 1 ? -year + 1 : year, $fae977aafc393c5c$var$parseNumber(m[2], 1, 12), 1, timeZone, 0, m[4] ? $fae977aafc393c5c$var$parseNumber(m[4], 0, 23) : 0, m[5] ? $fae977aafc393c5c$var$parseNumber(m[5], 0, 59) : 0, m[6] ? $fae977aafc393c5c$var$parseNumber(m[6], 0, 59) : 0, m[7] ? $fae977aafc393c5c$var$parseNumber(m[7], 0, Infinity) * 1e3 : 0);
590
+ date.day = $fae977aafc393c5c$var$parseNumber(m[3], 0, date.calendar.getDaysInMonth(date));
591
+ var _m_;
592
+ if (m[8]) date.offset = $fae977aafc393c5c$var$parseNumber(m[8], -23, 23) * 36e5 + $fae977aafc393c5c$var$parseNumber((_m_ = m[9]) !== null && _m_ !== void 0 ? _m_ : "0", 0, 59) * 6e4;
593
+ return $11d87f3f76e88657$export$538b00033cc11c75(date, timeZone);
594
+ }
595
+ function $fae977aafc393c5c$var$parseNumber(value, min, max) {
596
+ let val = Number(value);
597
+ if (val < min || val > max) throw new RangeError(`Value out of range: ${min} <= ${val} <= ${max}`);
598
+ return val;
599
+ }
600
+ function $fae977aafc393c5c$export$f59dee82248f5ad4(time) {
601
+ return `${String(time.hour).padStart(2, "0")}:${String(time.minute).padStart(2, "0")}:${String(time.second).padStart(2, "0")}${time.millisecond ? String(time.millisecond / 1e3).slice(1) : ""}`;
602
+ }
603
+ function $fae977aafc393c5c$export$60dfd74aa96791bd(date) {
604
+ let gregorianDate = $11d87f3f76e88657$export$b4a036af3fc0b032(date, new $3b62074eb05584b2$export$80ee6245ec4f29ec());
605
+ let year;
606
+ if (gregorianDate.era === "BC") year = gregorianDate.year === 1 ? "0000" : "-" + String(Math.abs(1 - gregorianDate.year)).padStart(6, "00");
607
+ else year = String(gregorianDate.year).padStart(4, "0");
608
+ return `${year}-${String(gregorianDate.month).padStart(2, "0")}-${String(gregorianDate.day).padStart(2, "0")}`;
609
+ }
610
+ function $fae977aafc393c5c$export$4223de14708adc63(date) {
611
+ return `${$fae977aafc393c5c$export$60dfd74aa96791bd(date)}T${$fae977aafc393c5c$export$f59dee82248f5ad4(date)}`;
612
+ }
613
+ function $fae977aafc393c5c$var$offsetToString(offset) {
614
+ let sign = Math.sign(offset) < 0 ? "-" : "+";
615
+ offset = Math.abs(offset);
616
+ let offsetHours = Math.floor(offset / 36e5);
617
+ let offsetMinutes = offset % 36e5 / 6e4;
618
+ return `${sign}${String(offsetHours).padStart(2, "0")}:${String(offsetMinutes).padStart(2, "0")}`;
619
+ }
620
+ function $fae977aafc393c5c$export$bf79f1ebf4b18792(date) {
621
+ return `${$fae977aafc393c5c$export$4223de14708adc63(date)}${$fae977aafc393c5c$var$offsetToString(date.offset)}[${date.timeZone}]`;
622
+ }
623
+ function _check_private_redeclaration(obj, privateCollection) {
624
+ if (privateCollection.has(obj)) {
625
+ throw new TypeError("Cannot initialize the same private elements twice on an object");
626
+ }
627
+ }
628
+ function _class_private_field_init(obj, privateMap, value) {
629
+ _check_private_redeclaration(obj, privateMap);
630
+ privateMap.set(obj, value);
631
+ }
632
+ function $35ea8db9cb2ccb90$var$shiftArgs(args) {
633
+ let calendar = typeof args[0] === "object" ? args.shift() : new $3b62074eb05584b2$export$80ee6245ec4f29ec();
634
+ let era;
635
+ if (typeof args[0] === "string") era = args.shift();
636
+ else {
637
+ let eras = calendar.getEras();
638
+ era = eras[eras.length - 1];
639
+ }
640
+ let year = args.shift();
641
+ let month = args.shift();
642
+ let day = args.shift();
643
+ return [
644
+ calendar,
645
+ era,
646
+ year,
647
+ month,
648
+ day
649
+ ];
650
+ }
651
+ var $35ea8db9cb2ccb90$var$_type = /* @__PURE__ */ new WeakMap();
652
+ class $35ea8db9cb2ccb90$export$99faa760c7908e4f {
653
+ /** Returns a copy of this date. */
654
+ copy() {
655
+ if (this.era) return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(this.calendar, this.era, this.year, this.month, this.day);
656
+ else return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(this.calendar, this.year, this.month, this.day);
657
+ }
658
+ /** Returns a new `CalendarDate` with the given duration added to it. */
659
+ add(duration) {
660
+ return $735220c2d4774dd3$export$e16d8520af44a096(this, duration);
661
+ }
662
+ /** Returns a new `CalendarDate` with the given duration subtracted from it. */
663
+ subtract(duration) {
664
+ return $735220c2d4774dd3$export$4e2d2ead65e5f7e3(this, duration);
665
+ }
666
+ /** Returns a new `CalendarDate` with the given fields set to the provided values. Other fields will be constrained accordingly. */
667
+ set(fields) {
668
+ return $735220c2d4774dd3$export$adaa4cf7ef1b65be(this, fields);
669
+ }
670
+ /**
671
+ * Returns a new `CalendarDate` with the given field adjusted by a specified amount.
672
+ * When the resulting value reaches the limits of the field, it wraps around.
673
+ */
674
+ cycle(field, amount, options) {
675
+ return $735220c2d4774dd3$export$d52ced6badfb9a4c(this, field, amount, options);
676
+ }
677
+ /** Converts the date to a native JavaScript Date object, with the time set to midnight in the given time zone. */
678
+ toDate(timeZone) {
679
+ return $11d87f3f76e88657$export$e67a095c620b86fe(this, timeZone);
680
+ }
681
+ /** Converts the date to an ISO 8601 formatted string. */
682
+ toString() {
683
+ return $fae977aafc393c5c$export$60dfd74aa96791bd(this);
684
+ }
685
+ /** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */
686
+ compare(b) {
687
+ return $14e0f24ef4ac5c92$export$68781ddf31c0090f(this, b);
688
+ }
689
+ constructor(...args) {
690
+ _class_private_field_init(this, $35ea8db9cb2ccb90$var$_type, {
691
+ writable: true,
692
+ value: void 0
693
+ });
694
+ let [calendar, era, year, month, day] = $35ea8db9cb2ccb90$var$shiftArgs(args);
695
+ this.calendar = calendar;
696
+ this.era = era;
697
+ this.year = year;
698
+ this.month = month;
699
+ this.day = day;
700
+ $735220c2d4774dd3$export$c4e2ecac49351ef2(this);
701
+ }
702
+ }
703
+ var $35ea8db9cb2ccb90$var$_type2 = /* @__PURE__ */ new WeakMap();
704
+ class $35ea8db9cb2ccb90$export$ca871e8dbb80966f {
705
+ /** Returns a copy of this date. */
706
+ copy() {
707
+ if (this.era) return new $35ea8db9cb2ccb90$export$ca871e8dbb80966f(this.calendar, this.era, this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond);
708
+ else return new $35ea8db9cb2ccb90$export$ca871e8dbb80966f(this.calendar, this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond);
709
+ }
710
+ /** Returns a new `CalendarDateTime` with the given duration added to it. */
711
+ add(duration) {
712
+ return $735220c2d4774dd3$export$e16d8520af44a096(this, duration);
713
+ }
714
+ /** Returns a new `CalendarDateTime` with the given duration subtracted from it. */
715
+ subtract(duration) {
716
+ return $735220c2d4774dd3$export$4e2d2ead65e5f7e3(this, duration);
717
+ }
718
+ /** Returns a new `CalendarDateTime` with the given fields set to the provided values. Other fields will be constrained accordingly. */
719
+ set(fields) {
720
+ return $735220c2d4774dd3$export$adaa4cf7ef1b65be($735220c2d4774dd3$export$e5d5e1c1822b6e56(this, fields), fields);
721
+ }
722
+ /**
723
+ * Returns a new `CalendarDateTime` with the given field adjusted by a specified amount.
724
+ * When the resulting value reaches the limits of the field, it wraps around.
725
+ */
726
+ cycle(field, amount, options) {
727
+ switch (field) {
728
+ case "era":
729
+ case "year":
730
+ case "month":
731
+ case "day":
732
+ return $735220c2d4774dd3$export$d52ced6badfb9a4c(this, field, amount, options);
733
+ default:
734
+ return $735220c2d4774dd3$export$dd02b3e0007dfe28(this, field, amount, options);
735
+ }
736
+ }
737
+ /** Converts the date to a native JavaScript Date object in the given time zone. */
738
+ toDate(timeZone, disambiguation) {
739
+ return $11d87f3f76e88657$export$e67a095c620b86fe(this, timeZone, disambiguation);
740
+ }
741
+ /** Converts the date to an ISO 8601 formatted string. */
742
+ toString() {
743
+ return $fae977aafc393c5c$export$4223de14708adc63(this);
744
+ }
745
+ /** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */
746
+ compare(b) {
747
+ let res = $14e0f24ef4ac5c92$export$68781ddf31c0090f(this, b);
748
+ if (res === 0) return $14e0f24ef4ac5c92$export$c19a80a9721b80f6(this, $11d87f3f76e88657$export$b21e0b124e224484(b));
749
+ return res;
750
+ }
751
+ constructor(...args) {
752
+ _class_private_field_init(this, $35ea8db9cb2ccb90$var$_type2, {
753
+ writable: true,
754
+ value: void 0
755
+ });
756
+ let [calendar, era, year, month, day] = $35ea8db9cb2ccb90$var$shiftArgs(args);
757
+ this.calendar = calendar;
758
+ this.era = era;
759
+ this.year = year;
760
+ this.month = month;
761
+ this.day = day;
762
+ this.hour = args.shift() || 0;
763
+ this.minute = args.shift() || 0;
764
+ this.second = args.shift() || 0;
765
+ this.millisecond = args.shift() || 0;
766
+ $735220c2d4774dd3$export$c4e2ecac49351ef2(this);
767
+ }
768
+ }
769
+ var $35ea8db9cb2ccb90$var$_type3 = /* @__PURE__ */ new WeakMap();
770
+ class $35ea8db9cb2ccb90$export$d3b7288e7994edea {
771
+ /** Returns a copy of this date. */
772
+ copy() {
773
+ if (this.era) return new $35ea8db9cb2ccb90$export$d3b7288e7994edea(this.calendar, this.era, this.year, this.month, this.day, this.timeZone, this.offset, this.hour, this.minute, this.second, this.millisecond);
774
+ else return new $35ea8db9cb2ccb90$export$d3b7288e7994edea(this.calendar, this.year, this.month, this.day, this.timeZone, this.offset, this.hour, this.minute, this.second, this.millisecond);
775
+ }
776
+ /** Returns a new `ZonedDateTime` with the given duration added to it. */
777
+ add(duration) {
778
+ return $735220c2d4774dd3$export$96b1d28349274637(this, duration);
779
+ }
780
+ /** Returns a new `ZonedDateTime` with the given duration subtracted from it. */
781
+ subtract(duration) {
782
+ return $735220c2d4774dd3$export$6814caac34ca03c7(this, duration);
783
+ }
784
+ /** Returns a new `ZonedDateTime` with the given fields set to the provided values. Other fields will be constrained accordingly. */
785
+ set(fields, disambiguation) {
786
+ return $735220c2d4774dd3$export$31b5430eb18be4f8(this, fields, disambiguation);
787
+ }
788
+ /**
789
+ * Returns a new `ZonedDateTime` with the given field adjusted by a specified amount.
790
+ * When the resulting value reaches the limits of the field, it wraps around.
791
+ */
792
+ cycle(field, amount, options) {
793
+ return $735220c2d4774dd3$export$9a297d111fc86b79(this, field, amount, options);
794
+ }
795
+ /** Converts the date to a native JavaScript Date object. */
796
+ toDate() {
797
+ return $11d87f3f76e88657$export$83aac07b4c37b25(this);
798
+ }
799
+ /** Converts the date to an ISO 8601 formatted string, including the UTC offset and time zone identifier. */
800
+ toString() {
801
+ return $fae977aafc393c5c$export$bf79f1ebf4b18792(this);
802
+ }
803
+ /** Converts the date to an ISO 8601 formatted string in UTC. */
804
+ toAbsoluteString() {
805
+ return this.toDate().toISOString();
806
+ }
807
+ /** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */
808
+ compare(b) {
809
+ return this.toDate().getTime() - $11d87f3f76e88657$export$84c95a83c799e074(b, this.timeZone).toDate().getTime();
810
+ }
811
+ constructor(...args) {
812
+ _class_private_field_init(this, $35ea8db9cb2ccb90$var$_type3, {
813
+ writable: true,
814
+ value: void 0
815
+ });
816
+ let [calendar, era, year, month, day] = $35ea8db9cb2ccb90$var$shiftArgs(args);
817
+ let timeZone = args.shift();
818
+ let offset = args.shift();
819
+ this.calendar = calendar;
820
+ this.era = era;
821
+ this.year = year;
822
+ this.month = month;
823
+ this.day = day;
824
+ this.timeZone = timeZone;
825
+ this.offset = offset;
826
+ this.hour = args.shift() || 0;
827
+ this.minute = args.shift() || 0;
828
+ this.second = args.shift() || 0;
829
+ this.millisecond = args.shift() || 0;
830
+ $735220c2d4774dd3$export$c4e2ecac49351ef2(this);
831
+ }
832
+ }
833
+ function parseDateValue(value) {
834
+ if (!value) return void 0;
835
+ if (typeof value === "string") {
836
+ try {
837
+ return $fae977aafc393c5c$export$5adfdab05168c219(value, "UTC");
838
+ } catch (err) {
839
+ try {
840
+ return $fae977aafc393c5c$export$588937bcd60ade55(value);
841
+ } catch (err2) {
842
+ return void 0;
843
+ }
844
+ }
845
+ }
846
+ return value;
847
+ }
848
+ const DateField = ({
849
+ defaultValue: defaultPropValue,
850
+ value: controlledValue,
851
+ onChange: onChangeProp,
852
+ minValue: minPropValue,
853
+ maxValue: maxPropValue,
854
+ ...props
855
+ }) => {
856
+ const defaultValue = useMemo(() => parseDateValue(defaultPropValue), [defaultPropValue]);
857
+ const controlledDateValue = useMemo(() => parseDateValue(controlledValue), [controlledValue]);
858
+ const minValue = useMemo(() => parseDateValue(minPropValue), [minPropValue]);
859
+ const maxValue = useMemo(() => parseDateValue(maxPropValue), [maxPropValue]);
860
+ const [value, setValue] = useState(controlledDateValue ?? defaultValue);
861
+ const onChange = (newValue) => {
862
+ if (onChangeProp) {
863
+ onChangeProp((newValue == null ? void 0 : newValue.toString()) ?? "");
864
+ }
865
+ setValue(newValue);
866
+ };
867
+ return /* @__PURE__ */ jsx(Field, { as: DateField$1, className: styles.dateField, value: controlledDateValue ?? value, minValue, maxValue, onChange, granularity: "day", ...props, children: /* @__PURE__ */ jsx(DateInput, { className: styles.dateInput, children: (segment) => /* @__PURE__ */ jsx(DateSegment, { className: styles.dateSegment, segment }) }) });
14
868
  };
15
869
  export {
16
870
  DateField,