@esic-lab/data-core-ui 0.0.27 → 0.0.28

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.
package/dist/index.js CHANGED
@@ -311,28 +311,6 @@ var require_dayjs_min = __commonJS({
311
311
  }
312
312
  });
313
313
 
314
- // node_modules/dayjs/plugin/buddhistEra.js
315
- var require_buddhistEra = __commonJS({
316
- "node_modules/dayjs/plugin/buddhistEra.js"(exports2, module2) {
317
- "use strict";
318
- !(function(t, e) {
319
- "object" == typeof exports2 && "undefined" != typeof module2 ? module2.exports = e() : "function" == typeof define && define.amd ? define(e) : (t = "undefined" != typeof globalThis ? globalThis : t || self).dayjs_plugin_buddhistEra = e();
320
- })(exports2, (function() {
321
- "use strict";
322
- return function(t, e) {
323
- var n = e.prototype, i = n.format;
324
- n.format = function(t2) {
325
- var e2 = this, n2 = (t2 || "YYYY-MM-DDTHH:mm:ssZ").replace(/(\[[^\]]+])|BBBB|BB/g, (function(t3, n3) {
326
- var i2, o = String(e2.$y + 543), f = "BB" === t3 ? [o.slice(-2), 2] : [o, 4];
327
- return n3 || (i2 = e2.$utils()).s.apply(i2, f.concat(["0"]));
328
- }));
329
- return i.bind(this)(n2);
330
- };
331
- };
332
- }));
333
- }
334
- });
335
-
336
314
  // node_modules/dayjs/locale/th.js
337
315
  var require_th = __commonJS({
338
316
  "node_modules/dayjs/locale/th.js"(exports2, module2) {
@@ -352,6 +330,134 @@ var require_th = __commonJS({
352
330
  }
353
331
  });
354
332
 
333
+ // node_modules/dayjs/plugin/customParseFormat.js
334
+ var require_customParseFormat = __commonJS({
335
+ "node_modules/dayjs/plugin/customParseFormat.js"(exports2, module2) {
336
+ "use strict";
337
+ !(function(e, t) {
338
+ "object" == typeof exports2 && "undefined" != typeof module2 ? module2.exports = t() : "function" == typeof define && define.amd ? define(t) : (e = "undefined" != typeof globalThis ? globalThis : e || self).dayjs_plugin_customParseFormat = t();
339
+ })(exports2, (function() {
340
+ "use strict";
341
+ var e = { LTS: "h:mm:ss A", LT: "h:mm A", L: "MM/DD/YYYY", LL: "MMMM D, YYYY", LLL: "MMMM D, YYYY h:mm A", LLLL: "dddd, MMMM D, YYYY h:mm A" }, t = /(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g, n = /\d/, r = /\d\d/, i = /\d\d?/, o = /\d*[^-_:/,()\s\d]+/, s = {}, a = function(e2) {
342
+ return (e2 = +e2) + (e2 > 68 ? 1900 : 2e3);
343
+ };
344
+ var f = function(e2) {
345
+ return function(t2) {
346
+ this[e2] = +t2;
347
+ };
348
+ }, h = [/[+-]\d\d:?(\d\d)?|Z/, function(e2) {
349
+ (this.zone || (this.zone = {})).offset = (function(e3) {
350
+ if (!e3) return 0;
351
+ if ("Z" === e3) return 0;
352
+ var t2 = e3.match(/([+-]|\d\d)/g), n2 = 60 * t2[1] + (+t2[2] || 0);
353
+ return 0 === n2 ? 0 : "+" === t2[0] ? -n2 : n2;
354
+ })(e2);
355
+ }], u = function(e2) {
356
+ var t2 = s[e2];
357
+ return t2 && (t2.indexOf ? t2 : t2.s.concat(t2.f));
358
+ }, d = function(e2, t2) {
359
+ var n2, r2 = s.meridiem;
360
+ if (r2) {
361
+ for (var i2 = 1; i2 <= 24; i2 += 1) if (e2.indexOf(r2(i2, 0, t2)) > -1) {
362
+ n2 = i2 > 12;
363
+ break;
364
+ }
365
+ } else n2 = e2 === (t2 ? "pm" : "PM");
366
+ return n2;
367
+ }, c = { A: [o, function(e2) {
368
+ this.afternoon = d(e2, false);
369
+ }], a: [o, function(e2) {
370
+ this.afternoon = d(e2, true);
371
+ }], Q: [n, function(e2) {
372
+ this.month = 3 * (e2 - 1) + 1;
373
+ }], S: [n, function(e2) {
374
+ this.milliseconds = 100 * +e2;
375
+ }], SS: [r, function(e2) {
376
+ this.milliseconds = 10 * +e2;
377
+ }], SSS: [/\d{3}/, function(e2) {
378
+ this.milliseconds = +e2;
379
+ }], s: [i, f("seconds")], ss: [i, f("seconds")], m: [i, f("minutes")], mm: [i, f("minutes")], H: [i, f("hours")], h: [i, f("hours")], HH: [i, f("hours")], hh: [i, f("hours")], D: [i, f("day")], DD: [r, f("day")], Do: [o, function(e2) {
380
+ var t2 = s.ordinal, n2 = e2.match(/\d+/);
381
+ if (this.day = n2[0], t2) for (var r2 = 1; r2 <= 31; r2 += 1) t2(r2).replace(/\[|\]/g, "") === e2 && (this.day = r2);
382
+ }], w: [i, f("week")], ww: [r, f("week")], M: [i, f("month")], MM: [r, f("month")], MMM: [o, function(e2) {
383
+ var t2 = u("months"), n2 = (u("monthsShort") || t2.map((function(e3) {
384
+ return e3.slice(0, 3);
385
+ }))).indexOf(e2) + 1;
386
+ if (n2 < 1) throw new Error();
387
+ this.month = n2 % 12 || n2;
388
+ }], MMMM: [o, function(e2) {
389
+ var t2 = u("months").indexOf(e2) + 1;
390
+ if (t2 < 1) throw new Error();
391
+ this.month = t2 % 12 || t2;
392
+ }], Y: [/[+-]?\d+/, f("year")], YY: [r, function(e2) {
393
+ this.year = a(e2);
394
+ }], YYYY: [/\d{4}/, f("year")], Z: h, ZZ: h };
395
+ function l(n2) {
396
+ var r2, i2;
397
+ r2 = n2, i2 = s && s.formats;
398
+ for (var o2 = (n2 = r2.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, (function(t2, n3, r3) {
399
+ var o3 = r3 && r3.toUpperCase();
400
+ return n3 || i2[r3] || e[r3] || i2[o3].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (function(e2, t3, n4) {
401
+ return t3 || n4.slice(1);
402
+ }));
403
+ }))).match(t), a2 = o2.length, f2 = 0; f2 < a2; f2 += 1) {
404
+ var h2 = o2[f2], u2 = c[h2], d2 = u2 && u2[0], l2 = u2 && u2[1];
405
+ o2[f2] = l2 ? { regex: d2, parser: l2 } : h2.replace(/^\[|\]$/g, "");
406
+ }
407
+ return function(e2) {
408
+ for (var t2 = {}, n3 = 0, r3 = 0; n3 < a2; n3 += 1) {
409
+ var i3 = o2[n3];
410
+ if ("string" == typeof i3) r3 += i3.length;
411
+ else {
412
+ var s2 = i3.regex, f3 = i3.parser, h3 = e2.slice(r3), u3 = s2.exec(h3)[0];
413
+ f3.call(t2, u3), e2 = e2.replace(u3, "");
414
+ }
415
+ }
416
+ return (function(e3) {
417
+ var t3 = e3.afternoon;
418
+ if (void 0 !== t3) {
419
+ var n4 = e3.hours;
420
+ t3 ? n4 < 12 && (e3.hours += 12) : 12 === n4 && (e3.hours = 0), delete e3.afternoon;
421
+ }
422
+ })(t2), t2;
423
+ };
424
+ }
425
+ return function(e2, t2, n2) {
426
+ n2.p.customParseFormat = true, e2 && e2.parseTwoDigitYear && (a = e2.parseTwoDigitYear);
427
+ var r2 = t2.prototype, i2 = r2.parse;
428
+ r2.parse = function(e3) {
429
+ var t3 = e3.date, r3 = e3.utc, o2 = e3.args;
430
+ this.$u = r3;
431
+ var a2 = o2[1];
432
+ if ("string" == typeof a2) {
433
+ var f2 = true === o2[2], h2 = true === o2[3], u2 = f2 || h2, d2 = o2[2];
434
+ h2 && (d2 = o2[2]), s = this.$locale(), !f2 && d2 && (s = n2.Ls[d2]), this.$d = (function(e4, t4, n3, r4) {
435
+ try {
436
+ if (["x", "X"].indexOf(t4) > -1) return new Date(("X" === t4 ? 1e3 : 1) * e4);
437
+ var i3 = l(t4)(e4), o3 = i3.year, s2 = i3.month, a3 = i3.day, f3 = i3.hours, h3 = i3.minutes, u3 = i3.seconds, d3 = i3.milliseconds, c3 = i3.zone, m2 = i3.week, M2 = /* @__PURE__ */ new Date(), Y = a3 || (o3 || s2 ? 1 : M2.getDate()), p = o3 || M2.getFullYear(), v = 0;
438
+ o3 && !s2 || (v = s2 > 0 ? s2 - 1 : M2.getMonth());
439
+ var D, w = f3 || 0, g = h3 || 0, y = u3 || 0, L = d3 || 0;
440
+ return c3 ? new Date(Date.UTC(p, v, Y, w, g, y, L + 60 * c3.offset * 1e3)) : n3 ? new Date(Date.UTC(p, v, Y, w, g, y, L)) : (D = new Date(p, v, Y, w, g, y, L), m2 && (D = r4(D).week(m2).toDate()), D);
441
+ } catch (e5) {
442
+ return /* @__PURE__ */ new Date("");
443
+ }
444
+ })(t3, a2, r3, n2), this.init(), d2 && true !== d2 && (this.$L = this.locale(d2).$L), u2 && t3 != this.format(a2) && (this.$d = /* @__PURE__ */ new Date("")), s = {};
445
+ } else if (a2 instanceof Array) for (var c2 = a2.length, m = 1; m <= c2; m += 1) {
446
+ o2[1] = a2[m - 1];
447
+ var M = n2.apply(this, o2);
448
+ if (M.isValid()) {
449
+ this.$d = M.$d, this.$L = M.$L, this.init();
450
+ break;
451
+ }
452
+ m === c2 && (this.$d = /* @__PURE__ */ new Date(""));
453
+ }
454
+ else i2.call(this, e3);
455
+ };
456
+ };
457
+ }));
458
+ }
459
+ });
460
+
355
461
  // src/index.ts
356
462
  var index_exports = {};
357
463
  __export(index_exports, {
@@ -1058,11 +1164,10 @@ function InputField({
1058
1164
  onChange,
1059
1165
  placeholder = "\u0E42\u0E1B\u0E23\u0E14\u0E23\u0E30\u0E1A\u0E38",
1060
1166
  title,
1061
- require: require2,
1167
+ required,
1062
1168
  bottomText,
1063
1169
  disabled,
1064
- showError,
1065
- errorMessage,
1170
+ error,
1066
1171
  addonBefore,
1067
1172
  addonAfter,
1068
1173
  defaultValue,
@@ -1081,7 +1186,7 @@ function InputField({
1081
1186
  /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { children: [
1082
1187
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "body-1", children: title }),
1083
1188
  " ",
1084
- require2 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-red-500", children: "*" })
1189
+ required && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-red-500", children: "*" })
1085
1190
  ] }),
1086
1191
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1087
1192
  import_antd2.Input,
@@ -1101,7 +1206,7 @@ function InputField({
1101
1206
  /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { children: [
1102
1207
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "caption-1 text-gray-500", children: bottomText }),
1103
1208
  " ",
1104
- showError && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "caption-1 text-red-500 ", children: errorMessage })
1209
+ error && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "caption-1 text-red-500 ", children: error })
1105
1210
  ] })
1106
1211
  ] })
1107
1212
  }
@@ -1169,11 +1274,10 @@ var import_jsx_runtime20 = require("react/jsx-runtime");
1169
1274
  function ColorPickerBasic({
1170
1275
  value,
1171
1276
  onChange,
1172
- require: require2,
1277
+ required,
1173
1278
  title,
1174
1279
  bottomText,
1175
- showError,
1176
- errorMessage,
1280
+ error,
1177
1281
  disabled,
1178
1282
  allowClear,
1179
1283
  defaultFormat,
@@ -1193,7 +1297,7 @@ function ColorPickerBasic({
1193
1297
  /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { children: [
1194
1298
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "body-1", children: title }),
1195
1299
  " ",
1196
- require2 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-red-500", children: "*" })
1300
+ required && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-red-500", children: "*" })
1197
1301
  ] }),
1198
1302
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1199
1303
  import_antd4.ColorPicker,
@@ -1221,7 +1325,7 @@ function ColorPickerBasic({
1221
1325
  /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { children: [
1222
1326
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "caption-1 text-gray-500", children: bottomText }),
1223
1327
  " ",
1224
- showError && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "caption-1 text-red-500 ", children: errorMessage })
1328
+ error && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "caption-1 text-red-500 ", children: error })
1225
1329
  ] })
1226
1330
  ] })
1227
1331
  }
@@ -1230,2022 +1334,16 @@ function ColorPickerBasic({
1230
1334
 
1231
1335
  // src/DatePicker/DatePickerBasic/DatePickerBasic.tsx
1232
1336
  var import_antd5 = require("antd");
1233
- var import_th_TH2 = __toESM(require("antd/locale/th_TH"));
1234
1337
  var import_dayjs = __toESM(require_dayjs_min());
1235
-
1236
- // node_modules/date-fns/constants.js
1237
- var daysInYear = 365.2425;
1238
- var maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1e3;
1239
- var minTime = -maxTime;
1240
- var millisecondsInWeek = 6048e5;
1241
- var millisecondsInDay = 864e5;
1242
- var secondsInHour = 3600;
1243
- var secondsInDay = secondsInHour * 24;
1244
- var secondsInWeek = secondsInDay * 7;
1245
- var secondsInYear = secondsInDay * daysInYear;
1246
- var secondsInMonth = secondsInYear / 12;
1247
- var secondsInQuarter = secondsInMonth * 3;
1248
- var constructFromSymbol = Symbol.for("constructDateFrom");
1249
-
1250
- // node_modules/date-fns/constructFrom.js
1251
- function constructFrom(date, value) {
1252
- if (typeof date === "function") return date(value);
1253
- if (date && typeof date === "object" && constructFromSymbol in date)
1254
- return date[constructFromSymbol](value);
1255
- if (date instanceof Date) return new date.constructor(value);
1256
- return new Date(value);
1257
- }
1258
-
1259
- // node_modules/date-fns/toDate.js
1260
- function toDate(argument, context) {
1261
- return constructFrom(context || argument, argument);
1262
- }
1263
-
1264
- // node_modules/date-fns/_lib/defaultOptions.js
1265
- var defaultOptions = {};
1266
- function getDefaultOptions() {
1267
- return defaultOptions;
1268
- }
1269
-
1270
- // node_modules/date-fns/startOfWeek.js
1271
- function startOfWeek(date, options) {
1272
- const defaultOptions2 = getDefaultOptions();
1273
- const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0;
1274
- const _date = toDate(date, options?.in);
1275
- const day = _date.getDay();
1276
- const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
1277
- _date.setDate(_date.getDate() - diff);
1278
- _date.setHours(0, 0, 0, 0);
1279
- return _date;
1280
- }
1281
-
1282
- // node_modules/date-fns/startOfISOWeek.js
1283
- function startOfISOWeek(date, options) {
1284
- return startOfWeek(date, { ...options, weekStartsOn: 1 });
1285
- }
1286
-
1287
- // node_modules/date-fns/getISOWeekYear.js
1288
- function getISOWeekYear(date, options) {
1289
- const _date = toDate(date, options?.in);
1290
- const year = _date.getFullYear();
1291
- const fourthOfJanuaryOfNextYear = constructFrom(_date, 0);
1292
- fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);
1293
- fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);
1294
- const startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear);
1295
- const fourthOfJanuaryOfThisYear = constructFrom(_date, 0);
1296
- fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4);
1297
- fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0);
1298
- const startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear);
1299
- if (_date.getTime() >= startOfNextYear.getTime()) {
1300
- return year + 1;
1301
- } else if (_date.getTime() >= startOfThisYear.getTime()) {
1302
- return year;
1303
- } else {
1304
- return year - 1;
1305
- }
1306
- }
1307
-
1308
- // node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js
1309
- function getTimezoneOffsetInMilliseconds(date) {
1310
- const _date = toDate(date);
1311
- const utcDate = new Date(
1312
- Date.UTC(
1313
- _date.getFullYear(),
1314
- _date.getMonth(),
1315
- _date.getDate(),
1316
- _date.getHours(),
1317
- _date.getMinutes(),
1318
- _date.getSeconds(),
1319
- _date.getMilliseconds()
1320
- )
1321
- );
1322
- utcDate.setUTCFullYear(_date.getFullYear());
1323
- return +date - +utcDate;
1324
- }
1325
-
1326
- // node_modules/date-fns/_lib/normalizeDates.js
1327
- function normalizeDates(context, ...dates) {
1328
- const normalize = constructFrom.bind(
1329
- null,
1330
- context || dates.find((date) => typeof date === "object")
1331
- );
1332
- return dates.map(normalize);
1333
- }
1334
-
1335
- // node_modules/date-fns/startOfDay.js
1336
- function startOfDay(date, options) {
1337
- const _date = toDate(date, options?.in);
1338
- _date.setHours(0, 0, 0, 0);
1339
- return _date;
1340
- }
1341
-
1342
- // node_modules/date-fns/differenceInCalendarDays.js
1343
- function differenceInCalendarDays(laterDate, earlierDate, options) {
1344
- const [laterDate_, earlierDate_] = normalizeDates(
1345
- options?.in,
1346
- laterDate,
1347
- earlierDate
1348
- );
1349
- const laterStartOfDay = startOfDay(laterDate_);
1350
- const earlierStartOfDay = startOfDay(earlierDate_);
1351
- const laterTimestamp = +laterStartOfDay - getTimezoneOffsetInMilliseconds(laterStartOfDay);
1352
- const earlierTimestamp = +earlierStartOfDay - getTimezoneOffsetInMilliseconds(earlierStartOfDay);
1353
- return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInDay);
1354
- }
1355
-
1356
- // node_modules/date-fns/startOfISOWeekYear.js
1357
- function startOfISOWeekYear(date, options) {
1358
- const year = getISOWeekYear(date, options);
1359
- const fourthOfJanuary = constructFrom(options?.in || date, 0);
1360
- fourthOfJanuary.setFullYear(year, 0, 4);
1361
- fourthOfJanuary.setHours(0, 0, 0, 0);
1362
- return startOfISOWeek(fourthOfJanuary);
1363
- }
1364
-
1365
- // node_modules/date-fns/isDate.js
1366
- function isDate(value) {
1367
- return value instanceof Date || typeof value === "object" && Object.prototype.toString.call(value) === "[object Date]";
1368
- }
1369
-
1370
- // node_modules/date-fns/isValid.js
1371
- function isValid(date) {
1372
- return !(!isDate(date) && typeof date !== "number" || isNaN(+toDate(date)));
1373
- }
1374
-
1375
- // node_modules/date-fns/startOfYear.js
1376
- function startOfYear(date, options) {
1377
- const date_ = toDate(date, options?.in);
1378
- date_.setFullYear(date_.getFullYear(), 0, 1);
1379
- date_.setHours(0, 0, 0, 0);
1380
- return date_;
1381
- }
1382
-
1383
- // node_modules/date-fns/locale/en-US/_lib/formatDistance.js
1384
- var formatDistanceLocale = {
1385
- lessThanXSeconds: {
1386
- one: "less than a second",
1387
- other: "less than {{count}} seconds"
1388
- },
1389
- xSeconds: {
1390
- one: "1 second",
1391
- other: "{{count}} seconds"
1392
- },
1393
- halfAMinute: "half a minute",
1394
- lessThanXMinutes: {
1395
- one: "less than a minute",
1396
- other: "less than {{count}} minutes"
1397
- },
1398
- xMinutes: {
1399
- one: "1 minute",
1400
- other: "{{count}} minutes"
1401
- },
1402
- aboutXHours: {
1403
- one: "about 1 hour",
1404
- other: "about {{count}} hours"
1405
- },
1406
- xHours: {
1407
- one: "1 hour",
1408
- other: "{{count}} hours"
1409
- },
1410
- xDays: {
1411
- one: "1 day",
1412
- other: "{{count}} days"
1413
- },
1414
- aboutXWeeks: {
1415
- one: "about 1 week",
1416
- other: "about {{count}} weeks"
1417
- },
1418
- xWeeks: {
1419
- one: "1 week",
1420
- other: "{{count}} weeks"
1421
- },
1422
- aboutXMonths: {
1423
- one: "about 1 month",
1424
- other: "about {{count}} months"
1425
- },
1426
- xMonths: {
1427
- one: "1 month",
1428
- other: "{{count}} months"
1429
- },
1430
- aboutXYears: {
1431
- one: "about 1 year",
1432
- other: "about {{count}} years"
1433
- },
1434
- xYears: {
1435
- one: "1 year",
1436
- other: "{{count}} years"
1437
- },
1438
- overXYears: {
1439
- one: "over 1 year",
1440
- other: "over {{count}} years"
1441
- },
1442
- almostXYears: {
1443
- one: "almost 1 year",
1444
- other: "almost {{count}} years"
1445
- }
1446
- };
1447
- var formatDistance = (token, count, options) => {
1448
- let result;
1449
- const tokenValue = formatDistanceLocale[token];
1450
- if (typeof tokenValue === "string") {
1451
- result = tokenValue;
1452
- } else if (count === 1) {
1453
- result = tokenValue.one;
1454
- } else {
1455
- result = tokenValue.other.replace("{{count}}", count.toString());
1456
- }
1457
- if (options?.addSuffix) {
1458
- if (options.comparison && options.comparison > 0) {
1459
- return "in " + result;
1460
- } else {
1461
- return result + " ago";
1462
- }
1463
- }
1464
- return result;
1465
- };
1466
-
1467
- // node_modules/date-fns/locale/_lib/buildFormatLongFn.js
1468
- function buildFormatLongFn(args) {
1469
- return (options = {}) => {
1470
- const width = options.width ? String(options.width) : args.defaultWidth;
1471
- const format2 = args.formats[width] || args.formats[args.defaultWidth];
1472
- return format2;
1473
- };
1474
- }
1475
-
1476
- // node_modules/date-fns/locale/en-US/_lib/formatLong.js
1477
- var dateFormats = {
1478
- full: "EEEE, MMMM do, y",
1479
- long: "MMMM do, y",
1480
- medium: "MMM d, y",
1481
- short: "MM/dd/yyyy"
1482
- };
1483
- var timeFormats = {
1484
- full: "h:mm:ss a zzzz",
1485
- long: "h:mm:ss a z",
1486
- medium: "h:mm:ss a",
1487
- short: "h:mm a"
1488
- };
1489
- var dateTimeFormats = {
1490
- full: "{{date}} 'at' {{time}}",
1491
- long: "{{date}} 'at' {{time}}",
1492
- medium: "{{date}}, {{time}}",
1493
- short: "{{date}}, {{time}}"
1494
- };
1495
- var formatLong = {
1496
- date: buildFormatLongFn({
1497
- formats: dateFormats,
1498
- defaultWidth: "full"
1499
- }),
1500
- time: buildFormatLongFn({
1501
- formats: timeFormats,
1502
- defaultWidth: "full"
1503
- }),
1504
- dateTime: buildFormatLongFn({
1505
- formats: dateTimeFormats,
1506
- defaultWidth: "full"
1507
- })
1508
- };
1509
-
1510
- // node_modules/date-fns/locale/en-US/_lib/formatRelative.js
1511
- var formatRelativeLocale = {
1512
- lastWeek: "'last' eeee 'at' p",
1513
- yesterday: "'yesterday at' p",
1514
- today: "'today at' p",
1515
- tomorrow: "'tomorrow at' p",
1516
- nextWeek: "eeee 'at' p",
1517
- other: "P"
1518
- };
1519
- var formatRelative = (token, _date, _baseDate, _options) => formatRelativeLocale[token];
1520
-
1521
- // node_modules/date-fns/locale/_lib/buildLocalizeFn.js
1522
- function buildLocalizeFn(args) {
1523
- return (value, options) => {
1524
- const context = options?.context ? String(options.context) : "standalone";
1525
- let valuesArray;
1526
- if (context === "formatting" && args.formattingValues) {
1527
- const defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
1528
- const width = options?.width ? String(options.width) : defaultWidth;
1529
- valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
1530
- } else {
1531
- const defaultWidth = args.defaultWidth;
1532
- const width = options?.width ? String(options.width) : args.defaultWidth;
1533
- valuesArray = args.values[width] || args.values[defaultWidth];
1534
- }
1535
- const index = args.argumentCallback ? args.argumentCallback(value) : value;
1536
- return valuesArray[index];
1537
- };
1538
- }
1539
-
1540
- // node_modules/date-fns/locale/en-US/_lib/localize.js
1541
- var eraValues = {
1542
- narrow: ["B", "A"],
1543
- abbreviated: ["BC", "AD"],
1544
- wide: ["Before Christ", "Anno Domini"]
1545
- };
1546
- var quarterValues = {
1547
- narrow: ["1", "2", "3", "4"],
1548
- abbreviated: ["Q1", "Q2", "Q3", "Q4"],
1549
- wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
1550
- };
1551
- var monthValues = {
1552
- narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
1553
- abbreviated: [
1554
- "Jan",
1555
- "Feb",
1556
- "Mar",
1557
- "Apr",
1558
- "May",
1559
- "Jun",
1560
- "Jul",
1561
- "Aug",
1562
- "Sep",
1563
- "Oct",
1564
- "Nov",
1565
- "Dec"
1566
- ],
1567
- wide: [
1568
- "January",
1569
- "February",
1570
- "March",
1571
- "April",
1572
- "May",
1573
- "June",
1574
- "July",
1575
- "August",
1576
- "September",
1577
- "October",
1578
- "November",
1579
- "December"
1580
- ]
1581
- };
1582
- var dayValues = {
1583
- narrow: ["S", "M", "T", "W", "T", "F", "S"],
1584
- short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
1585
- abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
1586
- wide: [
1587
- "Sunday",
1588
- "Monday",
1589
- "Tuesday",
1590
- "Wednesday",
1591
- "Thursday",
1592
- "Friday",
1593
- "Saturday"
1594
- ]
1595
- };
1596
- var dayPeriodValues = {
1597
- narrow: {
1598
- am: "a",
1599
- pm: "p",
1600
- midnight: "mi",
1601
- noon: "n",
1602
- morning: "morning",
1603
- afternoon: "afternoon",
1604
- evening: "evening",
1605
- night: "night"
1606
- },
1607
- abbreviated: {
1608
- am: "AM",
1609
- pm: "PM",
1610
- midnight: "midnight",
1611
- noon: "noon",
1612
- morning: "morning",
1613
- afternoon: "afternoon",
1614
- evening: "evening",
1615
- night: "night"
1616
- },
1617
- wide: {
1618
- am: "a.m.",
1619
- pm: "p.m.",
1620
- midnight: "midnight",
1621
- noon: "noon",
1622
- morning: "morning",
1623
- afternoon: "afternoon",
1624
- evening: "evening",
1625
- night: "night"
1626
- }
1627
- };
1628
- var formattingDayPeriodValues = {
1629
- narrow: {
1630
- am: "a",
1631
- pm: "p",
1632
- midnight: "mi",
1633
- noon: "n",
1634
- morning: "in the morning",
1635
- afternoon: "in the afternoon",
1636
- evening: "in the evening",
1637
- night: "at night"
1638
- },
1639
- abbreviated: {
1640
- am: "AM",
1641
- pm: "PM",
1642
- midnight: "midnight",
1643
- noon: "noon",
1644
- morning: "in the morning",
1645
- afternoon: "in the afternoon",
1646
- evening: "in the evening",
1647
- night: "at night"
1648
- },
1649
- wide: {
1650
- am: "a.m.",
1651
- pm: "p.m.",
1652
- midnight: "midnight",
1653
- noon: "noon",
1654
- morning: "in the morning",
1655
- afternoon: "in the afternoon",
1656
- evening: "in the evening",
1657
- night: "at night"
1658
- }
1659
- };
1660
- var ordinalNumber = (dirtyNumber, _options) => {
1661
- const number = Number(dirtyNumber);
1662
- const rem100 = number % 100;
1663
- if (rem100 > 20 || rem100 < 10) {
1664
- switch (rem100 % 10) {
1665
- case 1:
1666
- return number + "st";
1667
- case 2:
1668
- return number + "nd";
1669
- case 3:
1670
- return number + "rd";
1671
- }
1672
- }
1673
- return number + "th";
1674
- };
1675
- var localize = {
1676
- ordinalNumber,
1677
- era: buildLocalizeFn({
1678
- values: eraValues,
1679
- defaultWidth: "wide"
1680
- }),
1681
- quarter: buildLocalizeFn({
1682
- values: quarterValues,
1683
- defaultWidth: "wide",
1684
- argumentCallback: (quarter) => quarter - 1
1685
- }),
1686
- month: buildLocalizeFn({
1687
- values: monthValues,
1688
- defaultWidth: "wide"
1689
- }),
1690
- day: buildLocalizeFn({
1691
- values: dayValues,
1692
- defaultWidth: "wide"
1693
- }),
1694
- dayPeriod: buildLocalizeFn({
1695
- values: dayPeriodValues,
1696
- defaultWidth: "wide",
1697
- formattingValues: formattingDayPeriodValues,
1698
- defaultFormattingWidth: "wide"
1699
- })
1700
- };
1701
-
1702
- // node_modules/date-fns/locale/_lib/buildMatchFn.js
1703
- function buildMatchFn(args) {
1704
- return (string, options = {}) => {
1705
- const width = options.width;
1706
- const matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
1707
- const matchResult = string.match(matchPattern);
1708
- if (!matchResult) {
1709
- return null;
1710
- }
1711
- const matchedString = matchResult[0];
1712
- const parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
1713
- const key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, (pattern) => pattern.test(matchedString)) : (
1714
- // [TODO] -- I challenge you to fix the type
1715
- findKey(parsePatterns, (pattern) => pattern.test(matchedString))
1716
- );
1717
- let value;
1718
- value = args.valueCallback ? args.valueCallback(key) : key;
1719
- value = options.valueCallback ? (
1720
- // [TODO] -- I challenge you to fix the type
1721
- options.valueCallback(value)
1722
- ) : value;
1723
- const rest = string.slice(matchedString.length);
1724
- return { value, rest };
1725
- };
1726
- }
1727
- function findKey(object, predicate) {
1728
- for (const key in object) {
1729
- if (Object.prototype.hasOwnProperty.call(object, key) && predicate(object[key])) {
1730
- return key;
1731
- }
1732
- }
1733
- return void 0;
1734
- }
1735
- function findIndex(array, predicate) {
1736
- for (let key = 0; key < array.length; key++) {
1737
- if (predicate(array[key])) {
1738
- return key;
1739
- }
1740
- }
1741
- return void 0;
1742
- }
1743
-
1744
- // node_modules/date-fns/locale/_lib/buildMatchPatternFn.js
1745
- function buildMatchPatternFn(args) {
1746
- return (string, options = {}) => {
1747
- const matchResult = string.match(args.matchPattern);
1748
- if (!matchResult) return null;
1749
- const matchedString = matchResult[0];
1750
- const parseResult = string.match(args.parsePattern);
1751
- if (!parseResult) return null;
1752
- let value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
1753
- value = options.valueCallback ? options.valueCallback(value) : value;
1754
- const rest = string.slice(matchedString.length);
1755
- return { value, rest };
1756
- };
1757
- }
1758
-
1759
- // node_modules/date-fns/locale/en-US/_lib/match.js
1760
- var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
1761
- var parseOrdinalNumberPattern = /\d+/i;
1762
- var matchEraPatterns = {
1763
- narrow: /^(b|a)/i,
1764
- abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
1765
- wide: /^(before christ|before common era|anno domini|common era)/i
1766
- };
1767
- var parseEraPatterns = {
1768
- any: [/^b/i, /^(a|c)/i]
1769
- };
1770
- var matchQuarterPatterns = {
1771
- narrow: /^[1234]/i,
1772
- abbreviated: /^q[1234]/i,
1773
- wide: /^[1234](th|st|nd|rd)? quarter/i
1774
- };
1775
- var parseQuarterPatterns = {
1776
- any: [/1/i, /2/i, /3/i, /4/i]
1777
- };
1778
- var matchMonthPatterns = {
1779
- narrow: /^[jfmasond]/i,
1780
- abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
1781
- wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
1782
- };
1783
- var parseMonthPatterns = {
1784
- narrow: [
1785
- /^j/i,
1786
- /^f/i,
1787
- /^m/i,
1788
- /^a/i,
1789
- /^m/i,
1790
- /^j/i,
1791
- /^j/i,
1792
- /^a/i,
1793
- /^s/i,
1794
- /^o/i,
1795
- /^n/i,
1796
- /^d/i
1797
- ],
1798
- any: [
1799
- /^ja/i,
1800
- /^f/i,
1801
- /^mar/i,
1802
- /^ap/i,
1803
- /^may/i,
1804
- /^jun/i,
1805
- /^jul/i,
1806
- /^au/i,
1807
- /^s/i,
1808
- /^o/i,
1809
- /^n/i,
1810
- /^d/i
1811
- ]
1812
- };
1813
- var matchDayPatterns = {
1814
- narrow: /^[smtwf]/i,
1815
- short: /^(su|mo|tu|we|th|fr|sa)/i,
1816
- abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
1817
- wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
1818
- };
1819
- var parseDayPatterns = {
1820
- narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
1821
- any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
1822
- };
1823
- var matchDayPeriodPatterns = {
1824
- narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
1825
- any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
1826
- };
1827
- var parseDayPeriodPatterns = {
1828
- any: {
1829
- am: /^a/i,
1830
- pm: /^p/i,
1831
- midnight: /^mi/i,
1832
- noon: /^no/i,
1833
- morning: /morning/i,
1834
- afternoon: /afternoon/i,
1835
- evening: /evening/i,
1836
- night: /night/i
1837
- }
1838
- };
1839
- var match = {
1840
- ordinalNumber: buildMatchPatternFn({
1841
- matchPattern: matchOrdinalNumberPattern,
1842
- parsePattern: parseOrdinalNumberPattern,
1843
- valueCallback: (value) => parseInt(value, 10)
1844
- }),
1845
- era: buildMatchFn({
1846
- matchPatterns: matchEraPatterns,
1847
- defaultMatchWidth: "wide",
1848
- parsePatterns: parseEraPatterns,
1849
- defaultParseWidth: "any"
1850
- }),
1851
- quarter: buildMatchFn({
1852
- matchPatterns: matchQuarterPatterns,
1853
- defaultMatchWidth: "wide",
1854
- parsePatterns: parseQuarterPatterns,
1855
- defaultParseWidth: "any",
1856
- valueCallback: (index) => index + 1
1857
- }),
1858
- month: buildMatchFn({
1859
- matchPatterns: matchMonthPatterns,
1860
- defaultMatchWidth: "wide",
1861
- parsePatterns: parseMonthPatterns,
1862
- defaultParseWidth: "any"
1863
- }),
1864
- day: buildMatchFn({
1865
- matchPatterns: matchDayPatterns,
1866
- defaultMatchWidth: "wide",
1867
- parsePatterns: parseDayPatterns,
1868
- defaultParseWidth: "any"
1869
- }),
1870
- dayPeriod: buildMatchFn({
1871
- matchPatterns: matchDayPeriodPatterns,
1872
- defaultMatchWidth: "any",
1873
- parsePatterns: parseDayPeriodPatterns,
1874
- defaultParseWidth: "any"
1875
- })
1876
- };
1877
-
1878
- // node_modules/date-fns/locale/en-US.js
1879
- var enUS = {
1880
- code: "en-US",
1881
- formatDistance,
1882
- formatLong,
1883
- formatRelative,
1884
- localize,
1885
- match,
1886
- options: {
1887
- weekStartsOn: 0,
1888
- firstWeekContainsDate: 1
1889
- }
1890
- };
1891
-
1892
- // node_modules/date-fns/getDayOfYear.js
1893
- function getDayOfYear(date, options) {
1894
- const _date = toDate(date, options?.in);
1895
- const diff = differenceInCalendarDays(_date, startOfYear(_date));
1896
- const dayOfYear = diff + 1;
1897
- return dayOfYear;
1898
- }
1899
-
1900
- // node_modules/date-fns/getISOWeek.js
1901
- function getISOWeek(date, options) {
1902
- const _date = toDate(date, options?.in);
1903
- const diff = +startOfISOWeek(_date) - +startOfISOWeekYear(_date);
1904
- return Math.round(diff / millisecondsInWeek) + 1;
1905
- }
1906
-
1907
- // node_modules/date-fns/getWeekYear.js
1908
- function getWeekYear(date, options) {
1909
- const _date = toDate(date, options?.in);
1910
- const year = _date.getFullYear();
1911
- const defaultOptions2 = getDefaultOptions();
1912
- const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1;
1913
- const firstWeekOfNextYear = constructFrom(options?.in || date, 0);
1914
- firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate);
1915
- firstWeekOfNextYear.setHours(0, 0, 0, 0);
1916
- const startOfNextYear = startOfWeek(firstWeekOfNextYear, options);
1917
- const firstWeekOfThisYear = constructFrom(options?.in || date, 0);
1918
- firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate);
1919
- firstWeekOfThisYear.setHours(0, 0, 0, 0);
1920
- const startOfThisYear = startOfWeek(firstWeekOfThisYear, options);
1921
- if (+_date >= +startOfNextYear) {
1922
- return year + 1;
1923
- } else if (+_date >= +startOfThisYear) {
1924
- return year;
1925
- } else {
1926
- return year - 1;
1927
- }
1928
- }
1929
-
1930
- // node_modules/date-fns/startOfWeekYear.js
1931
- function startOfWeekYear(date, options) {
1932
- const defaultOptions2 = getDefaultOptions();
1933
- const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1;
1934
- const year = getWeekYear(date, options);
1935
- const firstWeek = constructFrom(options?.in || date, 0);
1936
- firstWeek.setFullYear(year, 0, firstWeekContainsDate);
1937
- firstWeek.setHours(0, 0, 0, 0);
1938
- const _date = startOfWeek(firstWeek, options);
1939
- return _date;
1940
- }
1941
-
1942
- // node_modules/date-fns/getWeek.js
1943
- function getWeek(date, options) {
1944
- const _date = toDate(date, options?.in);
1945
- const diff = +startOfWeek(_date, options) - +startOfWeekYear(_date, options);
1946
- return Math.round(diff / millisecondsInWeek) + 1;
1947
- }
1948
-
1949
- // node_modules/date-fns/_lib/addLeadingZeros.js
1950
- function addLeadingZeros(number, targetLength) {
1951
- const sign = number < 0 ? "-" : "";
1952
- const output = Math.abs(number).toString().padStart(targetLength, "0");
1953
- return sign + output;
1954
- }
1955
-
1956
- // node_modules/date-fns/_lib/format/lightFormatters.js
1957
- var lightFormatters = {
1958
- // Year
1959
- y(date, token) {
1960
- const signedYear = date.getFullYear();
1961
- const year = signedYear > 0 ? signedYear : 1 - signedYear;
1962
- return addLeadingZeros(token === "yy" ? year % 100 : year, token.length);
1963
- },
1964
- // Month
1965
- M(date, token) {
1966
- const month = date.getMonth();
1967
- return token === "M" ? String(month + 1) : addLeadingZeros(month + 1, 2);
1968
- },
1969
- // Day of the month
1970
- d(date, token) {
1971
- return addLeadingZeros(date.getDate(), token.length);
1972
- },
1973
- // AM or PM
1974
- a(date, token) {
1975
- const dayPeriodEnumValue = date.getHours() / 12 >= 1 ? "pm" : "am";
1976
- switch (token) {
1977
- case "a":
1978
- case "aa":
1979
- return dayPeriodEnumValue.toUpperCase();
1980
- case "aaa":
1981
- return dayPeriodEnumValue;
1982
- case "aaaaa":
1983
- return dayPeriodEnumValue[0];
1984
- case "aaaa":
1985
- default:
1986
- return dayPeriodEnumValue === "am" ? "a.m." : "p.m.";
1987
- }
1988
- },
1989
- // Hour [1-12]
1990
- h(date, token) {
1991
- return addLeadingZeros(date.getHours() % 12 || 12, token.length);
1992
- },
1993
- // Hour [0-23]
1994
- H(date, token) {
1995
- return addLeadingZeros(date.getHours(), token.length);
1996
- },
1997
- // Minute
1998
- m(date, token) {
1999
- return addLeadingZeros(date.getMinutes(), token.length);
2000
- },
2001
- // Second
2002
- s(date, token) {
2003
- return addLeadingZeros(date.getSeconds(), token.length);
2004
- },
2005
- // Fraction of second
2006
- S(date, token) {
2007
- const numberOfDigits = token.length;
2008
- const milliseconds = date.getMilliseconds();
2009
- const fractionalSeconds = Math.trunc(
2010
- milliseconds * Math.pow(10, numberOfDigits - 3)
2011
- );
2012
- return addLeadingZeros(fractionalSeconds, token.length);
2013
- }
2014
- };
2015
-
2016
- // node_modules/date-fns/_lib/format/formatters.js
2017
- var dayPeriodEnum = {
2018
- am: "am",
2019
- pm: "pm",
2020
- midnight: "midnight",
2021
- noon: "noon",
2022
- morning: "morning",
2023
- afternoon: "afternoon",
2024
- evening: "evening",
2025
- night: "night"
2026
- };
2027
- var formatters = {
2028
- // Era
2029
- G: function(date, token, localize3) {
2030
- const era = date.getFullYear() > 0 ? 1 : 0;
2031
- switch (token) {
2032
- // AD, BC
2033
- case "G":
2034
- case "GG":
2035
- case "GGG":
2036
- return localize3.era(era, { width: "abbreviated" });
2037
- // A, B
2038
- case "GGGGG":
2039
- return localize3.era(era, { width: "narrow" });
2040
- // Anno Domini, Before Christ
2041
- case "GGGG":
2042
- default:
2043
- return localize3.era(era, { width: "wide" });
2044
- }
2045
- },
2046
- // Year
2047
- y: function(date, token, localize3) {
2048
- if (token === "yo") {
2049
- const signedYear = date.getFullYear();
2050
- const year = signedYear > 0 ? signedYear : 1 - signedYear;
2051
- return localize3.ordinalNumber(year, { unit: "year" });
2052
- }
2053
- return lightFormatters.y(date, token);
2054
- },
2055
- // Local week-numbering year
2056
- Y: function(date, token, localize3, options) {
2057
- const signedWeekYear = getWeekYear(date, options);
2058
- const weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
2059
- if (token === "YY") {
2060
- const twoDigitYear = weekYear % 100;
2061
- return addLeadingZeros(twoDigitYear, 2);
2062
- }
2063
- if (token === "Yo") {
2064
- return localize3.ordinalNumber(weekYear, { unit: "year" });
2065
- }
2066
- return addLeadingZeros(weekYear, token.length);
2067
- },
2068
- // ISO week-numbering year
2069
- R: function(date, token) {
2070
- const isoWeekYear = getISOWeekYear(date);
2071
- return addLeadingZeros(isoWeekYear, token.length);
2072
- },
2073
- // Extended year. This is a single number designating the year of this calendar system.
2074
- // The main difference between `y` and `u` localizers are B.C. years:
2075
- // | Year | `y` | `u` |
2076
- // |------|-----|-----|
2077
- // | AC 1 | 1 | 1 |
2078
- // | BC 1 | 1 | 0 |
2079
- // | BC 2 | 2 | -1 |
2080
- // Also `yy` always returns the last two digits of a year,
2081
- // while `uu` pads single digit years to 2 characters and returns other years unchanged.
2082
- u: function(date, token) {
2083
- const year = date.getFullYear();
2084
- return addLeadingZeros(year, token.length);
2085
- },
2086
- // Quarter
2087
- Q: function(date, token, localize3) {
2088
- const quarter = Math.ceil((date.getMonth() + 1) / 3);
2089
- switch (token) {
2090
- // 1, 2, 3, 4
2091
- case "Q":
2092
- return String(quarter);
2093
- // 01, 02, 03, 04
2094
- case "QQ":
2095
- return addLeadingZeros(quarter, 2);
2096
- // 1st, 2nd, 3rd, 4th
2097
- case "Qo":
2098
- return localize3.ordinalNumber(quarter, { unit: "quarter" });
2099
- // Q1, Q2, Q3, Q4
2100
- case "QQQ":
2101
- return localize3.quarter(quarter, {
2102
- width: "abbreviated",
2103
- context: "formatting"
2104
- });
2105
- // 1, 2, 3, 4 (narrow quarter; could be not numerical)
2106
- case "QQQQQ":
2107
- return localize3.quarter(quarter, {
2108
- width: "narrow",
2109
- context: "formatting"
2110
- });
2111
- // 1st quarter, 2nd quarter, ...
2112
- case "QQQQ":
2113
- default:
2114
- return localize3.quarter(quarter, {
2115
- width: "wide",
2116
- context: "formatting"
2117
- });
2118
- }
2119
- },
2120
- // Stand-alone quarter
2121
- q: function(date, token, localize3) {
2122
- const quarter = Math.ceil((date.getMonth() + 1) / 3);
2123
- switch (token) {
2124
- // 1, 2, 3, 4
2125
- case "q":
2126
- return String(quarter);
2127
- // 01, 02, 03, 04
2128
- case "qq":
2129
- return addLeadingZeros(quarter, 2);
2130
- // 1st, 2nd, 3rd, 4th
2131
- case "qo":
2132
- return localize3.ordinalNumber(quarter, { unit: "quarter" });
2133
- // Q1, Q2, Q3, Q4
2134
- case "qqq":
2135
- return localize3.quarter(quarter, {
2136
- width: "abbreviated",
2137
- context: "standalone"
2138
- });
2139
- // 1, 2, 3, 4 (narrow quarter; could be not numerical)
2140
- case "qqqqq":
2141
- return localize3.quarter(quarter, {
2142
- width: "narrow",
2143
- context: "standalone"
2144
- });
2145
- // 1st quarter, 2nd quarter, ...
2146
- case "qqqq":
2147
- default:
2148
- return localize3.quarter(quarter, {
2149
- width: "wide",
2150
- context: "standalone"
2151
- });
2152
- }
2153
- },
2154
- // Month
2155
- M: function(date, token, localize3) {
2156
- const month = date.getMonth();
2157
- switch (token) {
2158
- case "M":
2159
- case "MM":
2160
- return lightFormatters.M(date, token);
2161
- // 1st, 2nd, ..., 12th
2162
- case "Mo":
2163
- return localize3.ordinalNumber(month + 1, { unit: "month" });
2164
- // Jan, Feb, ..., Dec
2165
- case "MMM":
2166
- return localize3.month(month, {
2167
- width: "abbreviated",
2168
- context: "formatting"
2169
- });
2170
- // J, F, ..., D
2171
- case "MMMMM":
2172
- return localize3.month(month, {
2173
- width: "narrow",
2174
- context: "formatting"
2175
- });
2176
- // January, February, ..., December
2177
- case "MMMM":
2178
- default:
2179
- return localize3.month(month, { width: "wide", context: "formatting" });
2180
- }
2181
- },
2182
- // Stand-alone month
2183
- L: function(date, token, localize3) {
2184
- const month = date.getMonth();
2185
- switch (token) {
2186
- // 1, 2, ..., 12
2187
- case "L":
2188
- return String(month + 1);
2189
- // 01, 02, ..., 12
2190
- case "LL":
2191
- return addLeadingZeros(month + 1, 2);
2192
- // 1st, 2nd, ..., 12th
2193
- case "Lo":
2194
- return localize3.ordinalNumber(month + 1, { unit: "month" });
2195
- // Jan, Feb, ..., Dec
2196
- case "LLL":
2197
- return localize3.month(month, {
2198
- width: "abbreviated",
2199
- context: "standalone"
2200
- });
2201
- // J, F, ..., D
2202
- case "LLLLL":
2203
- return localize3.month(month, {
2204
- width: "narrow",
2205
- context: "standalone"
2206
- });
2207
- // January, February, ..., December
2208
- case "LLLL":
2209
- default:
2210
- return localize3.month(month, { width: "wide", context: "standalone" });
2211
- }
2212
- },
2213
- // Local week of year
2214
- w: function(date, token, localize3, options) {
2215
- const week = getWeek(date, options);
2216
- if (token === "wo") {
2217
- return localize3.ordinalNumber(week, { unit: "week" });
2218
- }
2219
- return addLeadingZeros(week, token.length);
2220
- },
2221
- // ISO week of year
2222
- I: function(date, token, localize3) {
2223
- const isoWeek = getISOWeek(date);
2224
- if (token === "Io") {
2225
- return localize3.ordinalNumber(isoWeek, { unit: "week" });
2226
- }
2227
- return addLeadingZeros(isoWeek, token.length);
2228
- },
2229
- // Day of the month
2230
- d: function(date, token, localize3) {
2231
- if (token === "do") {
2232
- return localize3.ordinalNumber(date.getDate(), { unit: "date" });
2233
- }
2234
- return lightFormatters.d(date, token);
2235
- },
2236
- // Day of year
2237
- D: function(date, token, localize3) {
2238
- const dayOfYear = getDayOfYear(date);
2239
- if (token === "Do") {
2240
- return localize3.ordinalNumber(dayOfYear, { unit: "dayOfYear" });
2241
- }
2242
- return addLeadingZeros(dayOfYear, token.length);
2243
- },
2244
- // Day of week
2245
- E: function(date, token, localize3) {
2246
- const dayOfWeek = date.getDay();
2247
- switch (token) {
2248
- // Tue
2249
- case "E":
2250
- case "EE":
2251
- case "EEE":
2252
- return localize3.day(dayOfWeek, {
2253
- width: "abbreviated",
2254
- context: "formatting"
2255
- });
2256
- // T
2257
- case "EEEEE":
2258
- return localize3.day(dayOfWeek, {
2259
- width: "narrow",
2260
- context: "formatting"
2261
- });
2262
- // Tu
2263
- case "EEEEEE":
2264
- return localize3.day(dayOfWeek, {
2265
- width: "short",
2266
- context: "formatting"
2267
- });
2268
- // Tuesday
2269
- case "EEEE":
2270
- default:
2271
- return localize3.day(dayOfWeek, {
2272
- width: "wide",
2273
- context: "formatting"
2274
- });
2275
- }
2276
- },
2277
- // Local day of week
2278
- e: function(date, token, localize3, options) {
2279
- const dayOfWeek = date.getDay();
2280
- const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
2281
- switch (token) {
2282
- // Numerical value (Nth day of week with current locale or weekStartsOn)
2283
- case "e":
2284
- return String(localDayOfWeek);
2285
- // Padded numerical value
2286
- case "ee":
2287
- return addLeadingZeros(localDayOfWeek, 2);
2288
- // 1st, 2nd, ..., 7th
2289
- case "eo":
2290
- return localize3.ordinalNumber(localDayOfWeek, { unit: "day" });
2291
- case "eee":
2292
- return localize3.day(dayOfWeek, {
2293
- width: "abbreviated",
2294
- context: "formatting"
2295
- });
2296
- // T
2297
- case "eeeee":
2298
- return localize3.day(dayOfWeek, {
2299
- width: "narrow",
2300
- context: "formatting"
2301
- });
2302
- // Tu
2303
- case "eeeeee":
2304
- return localize3.day(dayOfWeek, {
2305
- width: "short",
2306
- context: "formatting"
2307
- });
2308
- // Tuesday
2309
- case "eeee":
2310
- default:
2311
- return localize3.day(dayOfWeek, {
2312
- width: "wide",
2313
- context: "formatting"
2314
- });
2315
- }
2316
- },
2317
- // Stand-alone local day of week
2318
- c: function(date, token, localize3, options) {
2319
- const dayOfWeek = date.getDay();
2320
- const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
2321
- switch (token) {
2322
- // Numerical value (same as in `e`)
2323
- case "c":
2324
- return String(localDayOfWeek);
2325
- // Padded numerical value
2326
- case "cc":
2327
- return addLeadingZeros(localDayOfWeek, token.length);
2328
- // 1st, 2nd, ..., 7th
2329
- case "co":
2330
- return localize3.ordinalNumber(localDayOfWeek, { unit: "day" });
2331
- case "ccc":
2332
- return localize3.day(dayOfWeek, {
2333
- width: "abbreviated",
2334
- context: "standalone"
2335
- });
2336
- // T
2337
- case "ccccc":
2338
- return localize3.day(dayOfWeek, {
2339
- width: "narrow",
2340
- context: "standalone"
2341
- });
2342
- // Tu
2343
- case "cccccc":
2344
- return localize3.day(dayOfWeek, {
2345
- width: "short",
2346
- context: "standalone"
2347
- });
2348
- // Tuesday
2349
- case "cccc":
2350
- default:
2351
- return localize3.day(dayOfWeek, {
2352
- width: "wide",
2353
- context: "standalone"
2354
- });
2355
- }
2356
- },
2357
- // ISO day of week
2358
- i: function(date, token, localize3) {
2359
- const dayOfWeek = date.getDay();
2360
- const isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
2361
- switch (token) {
2362
- // 2
2363
- case "i":
2364
- return String(isoDayOfWeek);
2365
- // 02
2366
- case "ii":
2367
- return addLeadingZeros(isoDayOfWeek, token.length);
2368
- // 2nd
2369
- case "io":
2370
- return localize3.ordinalNumber(isoDayOfWeek, { unit: "day" });
2371
- // Tue
2372
- case "iii":
2373
- return localize3.day(dayOfWeek, {
2374
- width: "abbreviated",
2375
- context: "formatting"
2376
- });
2377
- // T
2378
- case "iiiii":
2379
- return localize3.day(dayOfWeek, {
2380
- width: "narrow",
2381
- context: "formatting"
2382
- });
2383
- // Tu
2384
- case "iiiiii":
2385
- return localize3.day(dayOfWeek, {
2386
- width: "short",
2387
- context: "formatting"
2388
- });
2389
- // Tuesday
2390
- case "iiii":
2391
- default:
2392
- return localize3.day(dayOfWeek, {
2393
- width: "wide",
2394
- context: "formatting"
2395
- });
2396
- }
2397
- },
2398
- // AM or PM
2399
- a: function(date, token, localize3) {
2400
- const hours = date.getHours();
2401
- const dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
2402
- switch (token) {
2403
- case "a":
2404
- case "aa":
2405
- return localize3.dayPeriod(dayPeriodEnumValue, {
2406
- width: "abbreviated",
2407
- context: "formatting"
2408
- });
2409
- case "aaa":
2410
- return localize3.dayPeriod(dayPeriodEnumValue, {
2411
- width: "abbreviated",
2412
- context: "formatting"
2413
- }).toLowerCase();
2414
- case "aaaaa":
2415
- return localize3.dayPeriod(dayPeriodEnumValue, {
2416
- width: "narrow",
2417
- context: "formatting"
2418
- });
2419
- case "aaaa":
2420
- default:
2421
- return localize3.dayPeriod(dayPeriodEnumValue, {
2422
- width: "wide",
2423
- context: "formatting"
2424
- });
2425
- }
2426
- },
2427
- // AM, PM, midnight, noon
2428
- b: function(date, token, localize3) {
2429
- const hours = date.getHours();
2430
- let dayPeriodEnumValue;
2431
- if (hours === 12) {
2432
- dayPeriodEnumValue = dayPeriodEnum.noon;
2433
- } else if (hours === 0) {
2434
- dayPeriodEnumValue = dayPeriodEnum.midnight;
2435
- } else {
2436
- dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
2437
- }
2438
- switch (token) {
2439
- case "b":
2440
- case "bb":
2441
- return localize3.dayPeriod(dayPeriodEnumValue, {
2442
- width: "abbreviated",
2443
- context: "formatting"
2444
- });
2445
- case "bbb":
2446
- return localize3.dayPeriod(dayPeriodEnumValue, {
2447
- width: "abbreviated",
2448
- context: "formatting"
2449
- }).toLowerCase();
2450
- case "bbbbb":
2451
- return localize3.dayPeriod(dayPeriodEnumValue, {
2452
- width: "narrow",
2453
- context: "formatting"
2454
- });
2455
- case "bbbb":
2456
- default:
2457
- return localize3.dayPeriod(dayPeriodEnumValue, {
2458
- width: "wide",
2459
- context: "formatting"
2460
- });
2461
- }
2462
- },
2463
- // in the morning, in the afternoon, in the evening, at night
2464
- B: function(date, token, localize3) {
2465
- const hours = date.getHours();
2466
- let dayPeriodEnumValue;
2467
- if (hours >= 17) {
2468
- dayPeriodEnumValue = dayPeriodEnum.evening;
2469
- } else if (hours >= 12) {
2470
- dayPeriodEnumValue = dayPeriodEnum.afternoon;
2471
- } else if (hours >= 4) {
2472
- dayPeriodEnumValue = dayPeriodEnum.morning;
2473
- } else {
2474
- dayPeriodEnumValue = dayPeriodEnum.night;
2475
- }
2476
- switch (token) {
2477
- case "B":
2478
- case "BB":
2479
- case "BBB":
2480
- return localize3.dayPeriod(dayPeriodEnumValue, {
2481
- width: "abbreviated",
2482
- context: "formatting"
2483
- });
2484
- case "BBBBB":
2485
- return localize3.dayPeriod(dayPeriodEnumValue, {
2486
- width: "narrow",
2487
- context: "formatting"
2488
- });
2489
- case "BBBB":
2490
- default:
2491
- return localize3.dayPeriod(dayPeriodEnumValue, {
2492
- width: "wide",
2493
- context: "formatting"
2494
- });
2495
- }
2496
- },
2497
- // Hour [1-12]
2498
- h: function(date, token, localize3) {
2499
- if (token === "ho") {
2500
- let hours = date.getHours() % 12;
2501
- if (hours === 0) hours = 12;
2502
- return localize3.ordinalNumber(hours, { unit: "hour" });
2503
- }
2504
- return lightFormatters.h(date, token);
2505
- },
2506
- // Hour [0-23]
2507
- H: function(date, token, localize3) {
2508
- if (token === "Ho") {
2509
- return localize3.ordinalNumber(date.getHours(), { unit: "hour" });
2510
- }
2511
- return lightFormatters.H(date, token);
2512
- },
2513
- // Hour [0-11]
2514
- K: function(date, token, localize3) {
2515
- const hours = date.getHours() % 12;
2516
- if (token === "Ko") {
2517
- return localize3.ordinalNumber(hours, { unit: "hour" });
2518
- }
2519
- return addLeadingZeros(hours, token.length);
2520
- },
2521
- // Hour [1-24]
2522
- k: function(date, token, localize3) {
2523
- let hours = date.getHours();
2524
- if (hours === 0) hours = 24;
2525
- if (token === "ko") {
2526
- return localize3.ordinalNumber(hours, { unit: "hour" });
2527
- }
2528
- return addLeadingZeros(hours, token.length);
2529
- },
2530
- // Minute
2531
- m: function(date, token, localize3) {
2532
- if (token === "mo") {
2533
- return localize3.ordinalNumber(date.getMinutes(), { unit: "minute" });
2534
- }
2535
- return lightFormatters.m(date, token);
2536
- },
2537
- // Second
2538
- s: function(date, token, localize3) {
2539
- if (token === "so") {
2540
- return localize3.ordinalNumber(date.getSeconds(), { unit: "second" });
2541
- }
2542
- return lightFormatters.s(date, token);
2543
- },
2544
- // Fraction of second
2545
- S: function(date, token) {
2546
- return lightFormatters.S(date, token);
2547
- },
2548
- // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
2549
- X: function(date, token, _localize) {
2550
- const timezoneOffset = date.getTimezoneOffset();
2551
- if (timezoneOffset === 0) {
2552
- return "Z";
2553
- }
2554
- switch (token) {
2555
- // Hours and optional minutes
2556
- case "X":
2557
- return formatTimezoneWithOptionalMinutes(timezoneOffset);
2558
- // Hours, minutes and optional seconds without `:` delimiter
2559
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
2560
- // so this token always has the same output as `XX`
2561
- case "XXXX":
2562
- case "XX":
2563
- return formatTimezone(timezoneOffset);
2564
- // Hours, minutes and optional seconds with `:` delimiter
2565
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
2566
- // so this token always has the same output as `XXX`
2567
- case "XXXXX":
2568
- case "XXX":
2569
- // Hours and minutes with `:` delimiter
2570
- default:
2571
- return formatTimezone(timezoneOffset, ":");
2572
- }
2573
- },
2574
- // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
2575
- x: function(date, token, _localize) {
2576
- const timezoneOffset = date.getTimezoneOffset();
2577
- switch (token) {
2578
- // Hours and optional minutes
2579
- case "x":
2580
- return formatTimezoneWithOptionalMinutes(timezoneOffset);
2581
- // Hours, minutes and optional seconds without `:` delimiter
2582
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
2583
- // so this token always has the same output as `xx`
2584
- case "xxxx":
2585
- case "xx":
2586
- return formatTimezone(timezoneOffset);
2587
- // Hours, minutes and optional seconds with `:` delimiter
2588
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
2589
- // so this token always has the same output as `xxx`
2590
- case "xxxxx":
2591
- case "xxx":
2592
- // Hours and minutes with `:` delimiter
2593
- default:
2594
- return formatTimezone(timezoneOffset, ":");
2595
- }
2596
- },
2597
- // Timezone (GMT)
2598
- O: function(date, token, _localize) {
2599
- const timezoneOffset = date.getTimezoneOffset();
2600
- switch (token) {
2601
- // Short
2602
- case "O":
2603
- case "OO":
2604
- case "OOO":
2605
- return "GMT" + formatTimezoneShort(timezoneOffset, ":");
2606
- // Long
2607
- case "OOOO":
2608
- default:
2609
- return "GMT" + formatTimezone(timezoneOffset, ":");
2610
- }
2611
- },
2612
- // Timezone (specific non-location)
2613
- z: function(date, token, _localize) {
2614
- const timezoneOffset = date.getTimezoneOffset();
2615
- switch (token) {
2616
- // Short
2617
- case "z":
2618
- case "zz":
2619
- case "zzz":
2620
- return "GMT" + formatTimezoneShort(timezoneOffset, ":");
2621
- // Long
2622
- case "zzzz":
2623
- default:
2624
- return "GMT" + formatTimezone(timezoneOffset, ":");
2625
- }
2626
- },
2627
- // Seconds timestamp
2628
- t: function(date, token, _localize) {
2629
- const timestamp = Math.trunc(+date / 1e3);
2630
- return addLeadingZeros(timestamp, token.length);
2631
- },
2632
- // Milliseconds timestamp
2633
- T: function(date, token, _localize) {
2634
- return addLeadingZeros(+date, token.length);
2635
- }
2636
- };
2637
- function formatTimezoneShort(offset, delimiter = "") {
2638
- const sign = offset > 0 ? "-" : "+";
2639
- const absOffset = Math.abs(offset);
2640
- const hours = Math.trunc(absOffset / 60);
2641
- const minutes = absOffset % 60;
2642
- if (minutes === 0) {
2643
- return sign + String(hours);
2644
- }
2645
- return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
2646
- }
2647
- function formatTimezoneWithOptionalMinutes(offset, delimiter) {
2648
- if (offset % 60 === 0) {
2649
- const sign = offset > 0 ? "-" : "+";
2650
- return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
2651
- }
2652
- return formatTimezone(offset, delimiter);
2653
- }
2654
- function formatTimezone(offset, delimiter = "") {
2655
- const sign = offset > 0 ? "-" : "+";
2656
- const absOffset = Math.abs(offset);
2657
- const hours = addLeadingZeros(Math.trunc(absOffset / 60), 2);
2658
- const minutes = addLeadingZeros(absOffset % 60, 2);
2659
- return sign + hours + delimiter + minutes;
2660
- }
2661
-
2662
- // node_modules/date-fns/_lib/format/longFormatters.js
2663
- var dateLongFormatter = (pattern, formatLong3) => {
2664
- switch (pattern) {
2665
- case "P":
2666
- return formatLong3.date({ width: "short" });
2667
- case "PP":
2668
- return formatLong3.date({ width: "medium" });
2669
- case "PPP":
2670
- return formatLong3.date({ width: "long" });
2671
- case "PPPP":
2672
- default:
2673
- return formatLong3.date({ width: "full" });
2674
- }
2675
- };
2676
- var timeLongFormatter = (pattern, formatLong3) => {
2677
- switch (pattern) {
2678
- case "p":
2679
- return formatLong3.time({ width: "short" });
2680
- case "pp":
2681
- return formatLong3.time({ width: "medium" });
2682
- case "ppp":
2683
- return formatLong3.time({ width: "long" });
2684
- case "pppp":
2685
- default:
2686
- return formatLong3.time({ width: "full" });
2687
- }
2688
- };
2689
- var dateTimeLongFormatter = (pattern, formatLong3) => {
2690
- const matchResult = pattern.match(/(P+)(p+)?/) || [];
2691
- const datePattern = matchResult[1];
2692
- const timePattern = matchResult[2];
2693
- if (!timePattern) {
2694
- return dateLongFormatter(pattern, formatLong3);
2695
- }
2696
- let dateTimeFormat;
2697
- switch (datePattern) {
2698
- case "P":
2699
- dateTimeFormat = formatLong3.dateTime({ width: "short" });
2700
- break;
2701
- case "PP":
2702
- dateTimeFormat = formatLong3.dateTime({ width: "medium" });
2703
- break;
2704
- case "PPP":
2705
- dateTimeFormat = formatLong3.dateTime({ width: "long" });
2706
- break;
2707
- case "PPPP":
2708
- default:
2709
- dateTimeFormat = formatLong3.dateTime({ width: "full" });
2710
- break;
2711
- }
2712
- return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong3)).replace("{{time}}", timeLongFormatter(timePattern, formatLong3));
2713
- };
2714
- var longFormatters = {
2715
- p: timeLongFormatter,
2716
- P: dateTimeLongFormatter
2717
- };
2718
-
2719
- // node_modules/date-fns/_lib/protectedTokens.js
2720
- var dayOfYearTokenRE = /^D+$/;
2721
- var weekYearTokenRE = /^Y+$/;
2722
- var throwTokens = ["D", "DD", "YY", "YYYY"];
2723
- function isProtectedDayOfYearToken(token) {
2724
- return dayOfYearTokenRE.test(token);
2725
- }
2726
- function isProtectedWeekYearToken(token) {
2727
- return weekYearTokenRE.test(token);
2728
- }
2729
- function warnOrThrowProtectedError(token, format2, input) {
2730
- const _message = message(token, format2, input);
2731
- console.warn(_message);
2732
- if (throwTokens.includes(token)) throw new RangeError(_message);
2733
- }
2734
- function message(token, format2, input) {
2735
- const subject = token[0] === "Y" ? "years" : "days of the month";
2736
- return `Use \`${token.toLowerCase()}\` instead of \`${token}\` (in \`${format2}\`) for formatting ${subject} to the input \`${input}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
2737
- }
2738
-
2739
- // node_modules/date-fns/format.js
2740
- var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
2741
- var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
2742
- var escapedStringRegExp = /^'([^]*?)'?$/;
2743
- var doubleQuoteRegExp = /''/g;
2744
- var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
2745
- function format(date, formatStr, options) {
2746
- const defaultOptions2 = getDefaultOptions();
2747
- const locale = options?.locale ?? defaultOptions2.locale ?? enUS;
2748
- const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1;
2749
- const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0;
2750
- const originalDate = toDate(date, options?.in);
2751
- if (!isValid(originalDate)) {
2752
- throw new RangeError("Invalid time value");
2753
- }
2754
- let parts = formatStr.match(longFormattingTokensRegExp).map((substring) => {
2755
- const firstCharacter = substring[0];
2756
- if (firstCharacter === "p" || firstCharacter === "P") {
2757
- const longFormatter = longFormatters[firstCharacter];
2758
- return longFormatter(substring, locale.formatLong);
2759
- }
2760
- return substring;
2761
- }).join("").match(formattingTokensRegExp).map((substring) => {
2762
- if (substring === "''") {
2763
- return { isToken: false, value: "'" };
2764
- }
2765
- const firstCharacter = substring[0];
2766
- if (firstCharacter === "'") {
2767
- return { isToken: false, value: cleanEscapedString(substring) };
2768
- }
2769
- if (formatters[firstCharacter]) {
2770
- return { isToken: true, value: substring };
2771
- }
2772
- if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
2773
- throw new RangeError(
2774
- "Format string contains an unescaped latin alphabet character `" + firstCharacter + "`"
2775
- );
2776
- }
2777
- return { isToken: false, value: substring };
2778
- });
2779
- if (locale.localize.preprocessor) {
2780
- parts = locale.localize.preprocessor(originalDate, parts);
2781
- }
2782
- const formatterOptions = {
2783
- firstWeekContainsDate,
2784
- weekStartsOn,
2785
- locale
2786
- };
2787
- return parts.map((part) => {
2788
- if (!part.isToken) return part.value;
2789
- const token = part.value;
2790
- if (!options?.useAdditionalWeekYearTokens && isProtectedWeekYearToken(token) || !options?.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(token)) {
2791
- warnOrThrowProtectedError(token, formatStr, String(date));
2792
- }
2793
- const formatter = formatters[token[0]];
2794
- return formatter(originalDate, token, locale.localize, formatterOptions);
2795
- }).join("");
2796
- }
2797
- function cleanEscapedString(input) {
2798
- const matched = input.match(escapedStringRegExp);
2799
- if (!matched) {
2800
- return input;
2801
- }
2802
- return matched[1].replace(doubleQuoteRegExp, "'");
2803
- }
2804
-
2805
- // src/DatePicker/DatePickerBasic/DatePickerBasic.tsx
2806
- var import_buddhistEra = __toESM(require_buddhistEra());
2807
-
2808
- // node_modules/date-fns/locale/th/_lib/formatDistance.js
2809
- var formatDistanceLocale2 = {
2810
- lessThanXSeconds: {
2811
- one: "\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32 1 \u0E27\u0E34\u0E19\u0E32\u0E17\u0E35",
2812
- other: "\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32 {{count}} \u0E27\u0E34\u0E19\u0E32\u0E17\u0E35"
2813
- },
2814
- xSeconds: {
2815
- one: "1 \u0E27\u0E34\u0E19\u0E32\u0E17\u0E35",
2816
- other: "{{count}} \u0E27\u0E34\u0E19\u0E32\u0E17\u0E35"
2817
- },
2818
- halfAMinute: "\u0E04\u0E23\u0E36\u0E48\u0E07\u0E19\u0E32\u0E17\u0E35",
2819
- lessThanXMinutes: {
2820
- one: "\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32 1 \u0E19\u0E32\u0E17\u0E35",
2821
- other: "\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32 {{count}} \u0E19\u0E32\u0E17\u0E35"
2822
- },
2823
- xMinutes: {
2824
- one: "1 \u0E19\u0E32\u0E17\u0E35",
2825
- other: "{{count}} \u0E19\u0E32\u0E17\u0E35"
2826
- },
2827
- aboutXHours: {
2828
- one: "\u0E1B\u0E23\u0E30\u0E21\u0E32\u0E13 1 \u0E0A\u0E31\u0E48\u0E27\u0E42\u0E21\u0E07",
2829
- other: "\u0E1B\u0E23\u0E30\u0E21\u0E32\u0E13 {{count}} \u0E0A\u0E31\u0E48\u0E27\u0E42\u0E21\u0E07"
2830
- },
2831
- xHours: {
2832
- one: "1 \u0E0A\u0E31\u0E48\u0E27\u0E42\u0E21\u0E07",
2833
- other: "{{count}} \u0E0A\u0E31\u0E48\u0E27\u0E42\u0E21\u0E07"
2834
- },
2835
- xDays: {
2836
- one: "1 \u0E27\u0E31\u0E19",
2837
- other: "{{count}} \u0E27\u0E31\u0E19"
2838
- },
2839
- aboutXWeeks: {
2840
- one: "\u0E1B\u0E23\u0E30\u0E21\u0E32\u0E13 1 \u0E2A\u0E31\u0E1B\u0E14\u0E32\u0E2B\u0E4C",
2841
- other: "\u0E1B\u0E23\u0E30\u0E21\u0E32\u0E13 {{count}} \u0E2A\u0E31\u0E1B\u0E14\u0E32\u0E2B\u0E4C"
2842
- },
2843
- xWeeks: {
2844
- one: "1 \u0E2A\u0E31\u0E1B\u0E14\u0E32\u0E2B\u0E4C",
2845
- other: "{{count}} \u0E2A\u0E31\u0E1B\u0E14\u0E32\u0E2B\u0E4C"
2846
- },
2847
- aboutXMonths: {
2848
- one: "\u0E1B\u0E23\u0E30\u0E21\u0E32\u0E13 1 \u0E40\u0E14\u0E37\u0E2D\u0E19",
2849
- other: "\u0E1B\u0E23\u0E30\u0E21\u0E32\u0E13 {{count}} \u0E40\u0E14\u0E37\u0E2D\u0E19"
2850
- },
2851
- xMonths: {
2852
- one: "1 \u0E40\u0E14\u0E37\u0E2D\u0E19",
2853
- other: "{{count}} \u0E40\u0E14\u0E37\u0E2D\u0E19"
2854
- },
2855
- aboutXYears: {
2856
- one: "\u0E1B\u0E23\u0E30\u0E21\u0E32\u0E13 1 \u0E1B\u0E35",
2857
- other: "\u0E1B\u0E23\u0E30\u0E21\u0E32\u0E13 {{count}} \u0E1B\u0E35"
2858
- },
2859
- xYears: {
2860
- one: "1 \u0E1B\u0E35",
2861
- other: "{{count}} \u0E1B\u0E35"
2862
- },
2863
- overXYears: {
2864
- one: "\u0E21\u0E32\u0E01\u0E01\u0E27\u0E48\u0E32 1 \u0E1B\u0E35",
2865
- other: "\u0E21\u0E32\u0E01\u0E01\u0E27\u0E48\u0E32 {{count}} \u0E1B\u0E35"
2866
- },
2867
- almostXYears: {
2868
- one: "\u0E40\u0E01\u0E37\u0E2D\u0E1A 1 \u0E1B\u0E35",
2869
- other: "\u0E40\u0E01\u0E37\u0E2D\u0E1A {{count}} \u0E1B\u0E35"
2870
- }
2871
- };
2872
- var formatDistance2 = (token, count, options) => {
2873
- let result;
2874
- const tokenValue = formatDistanceLocale2[token];
2875
- if (typeof tokenValue === "string") {
2876
- result = tokenValue;
2877
- } else if (count === 1) {
2878
- result = tokenValue.one;
2879
- } else {
2880
- result = tokenValue.other.replace("{{count}}", String(count));
2881
- }
2882
- if (options?.addSuffix) {
2883
- if (options.comparison && options.comparison > 0) {
2884
- if (token === "halfAMinute") {
2885
- return "\u0E43\u0E19" + result;
2886
- } else {
2887
- return "\u0E43\u0E19 " + result;
2888
- }
2889
- } else {
2890
- return result + "\u0E17\u0E35\u0E48\u0E1C\u0E48\u0E32\u0E19\u0E21\u0E32";
2891
- }
2892
- }
2893
- return result;
2894
- };
2895
-
2896
- // node_modules/date-fns/locale/th/_lib/formatLong.js
2897
- var dateFormats2 = {
2898
- full: "\u0E27\u0E31\u0E19EEEE\u0E17\u0E35\u0E48 do MMMM y",
2899
- long: "do MMMM y",
2900
- medium: "d MMM y",
2901
- short: "dd/MM/yyyy"
2902
- };
2903
- var timeFormats2 = {
2904
- full: "H:mm:ss \u0E19. zzzz",
2905
- long: "H:mm:ss \u0E19. z",
2906
- medium: "H:mm:ss \u0E19.",
2907
- short: "H:mm \u0E19."
2908
- };
2909
- var dateTimeFormats2 = {
2910
- full: "{{date}} '\u0E40\u0E27\u0E25\u0E32' {{time}}",
2911
- long: "{{date}} '\u0E40\u0E27\u0E25\u0E32' {{time}}",
2912
- medium: "{{date}}, {{time}}",
2913
- short: "{{date}}, {{time}}"
2914
- };
2915
- var formatLong2 = {
2916
- date: buildFormatLongFn({
2917
- formats: dateFormats2,
2918
- defaultWidth: "full"
2919
- }),
2920
- time: buildFormatLongFn({
2921
- formats: timeFormats2,
2922
- defaultWidth: "medium"
2923
- }),
2924
- dateTime: buildFormatLongFn({
2925
- formats: dateTimeFormats2,
2926
- defaultWidth: "full"
2927
- })
2928
- };
2929
-
2930
- // node_modules/date-fns/locale/th/_lib/formatRelative.js
2931
- var formatRelativeLocale2 = {
2932
- lastWeek: "eeee'\u0E17\u0E35\u0E48\u0E41\u0E25\u0E49\u0E27\u0E40\u0E27\u0E25\u0E32' p",
2933
- yesterday: "'\u0E40\u0E21\u0E37\u0E48\u0E2D\u0E27\u0E32\u0E19\u0E19\u0E35\u0E49\u0E40\u0E27\u0E25\u0E32' p",
2934
- today: "'\u0E27\u0E31\u0E19\u0E19\u0E35\u0E49\u0E40\u0E27\u0E25\u0E32' p",
2935
- tomorrow: "'\u0E1E\u0E23\u0E38\u0E48\u0E07\u0E19\u0E35\u0E49\u0E40\u0E27\u0E25\u0E32' p",
2936
- nextWeek: "eeee '\u0E40\u0E27\u0E25\u0E32' p",
2937
- other: "P"
2938
- };
2939
- var formatRelative2 = (token, _date, _baseDate, _options) => formatRelativeLocale2[token];
2940
-
2941
- // node_modules/date-fns/locale/th/_lib/localize.js
2942
- var eraValues2 = {
2943
- narrow: ["B", "\u0E04\u0E28"],
2944
- abbreviated: ["BC", "\u0E04.\u0E28."],
2945
- wide: ["\u0E1B\u0E35\u0E01\u0E48\u0E2D\u0E19\u0E04\u0E23\u0E34\u0E2A\u0E15\u0E01\u0E32\u0E25", "\u0E04\u0E23\u0E34\u0E2A\u0E15\u0E4C\u0E28\u0E31\u0E01\u0E23\u0E32\u0E0A"]
2946
- };
2947
- var quarterValues2 = {
2948
- narrow: ["1", "2", "3", "4"],
2949
- abbreviated: ["Q1", "Q2", "Q3", "Q4"],
2950
- wide: ["\u0E44\u0E15\u0E23\u0E21\u0E32\u0E2A\u0E41\u0E23\u0E01", "\u0E44\u0E15\u0E23\u0E21\u0E32\u0E2A\u0E17\u0E35\u0E48\u0E2A\u0E2D\u0E07", "\u0E44\u0E15\u0E23\u0E21\u0E32\u0E2A\u0E17\u0E35\u0E48\u0E2A\u0E32\u0E21", "\u0E44\u0E15\u0E23\u0E21\u0E32\u0E2A\u0E17\u0E35\u0E48\u0E2A\u0E35\u0E48"]
2951
- };
2952
- var dayValues2 = {
2953
- narrow: ["\u0E2D\u0E32.", "\u0E08.", "\u0E2D.", "\u0E1E.", "\u0E1E\u0E24.", "\u0E28.", "\u0E2A."],
2954
- short: ["\u0E2D\u0E32.", "\u0E08.", "\u0E2D.", "\u0E1E.", "\u0E1E\u0E24.", "\u0E28.", "\u0E2A."],
2955
- abbreviated: ["\u0E2D\u0E32.", "\u0E08.", "\u0E2D.", "\u0E1E.", "\u0E1E\u0E24.", "\u0E28.", "\u0E2A."],
2956
- wide: ["\u0E2D\u0E32\u0E17\u0E34\u0E15\u0E22\u0E4C", "\u0E08\u0E31\u0E19\u0E17\u0E23\u0E4C", "\u0E2D\u0E31\u0E07\u0E04\u0E32\u0E23", "\u0E1E\u0E38\u0E18", "\u0E1E\u0E24\u0E2B\u0E31\u0E2A\u0E1A\u0E14\u0E35", "\u0E28\u0E38\u0E01\u0E23\u0E4C", "\u0E40\u0E2A\u0E32\u0E23\u0E4C"]
2957
- };
2958
- var monthValues2 = {
2959
- narrow: [
2960
- "\u0E21.\u0E04.",
2961
- "\u0E01.\u0E1E.",
2962
- "\u0E21\u0E35.\u0E04.",
2963
- "\u0E40\u0E21.\u0E22.",
2964
- "\u0E1E.\u0E04.",
2965
- "\u0E21\u0E34.\u0E22.",
2966
- "\u0E01.\u0E04.",
2967
- "\u0E2A.\u0E04.",
2968
- "\u0E01.\u0E22.",
2969
- "\u0E15.\u0E04.",
2970
- "\u0E1E.\u0E22.",
2971
- "\u0E18.\u0E04."
2972
- ],
2973
- abbreviated: [
2974
- "\u0E21.\u0E04.",
2975
- "\u0E01.\u0E1E.",
2976
- "\u0E21\u0E35.\u0E04.",
2977
- "\u0E40\u0E21.\u0E22.",
2978
- "\u0E1E.\u0E04.",
2979
- "\u0E21\u0E34.\u0E22.",
2980
- "\u0E01.\u0E04.",
2981
- "\u0E2A.\u0E04.",
2982
- "\u0E01.\u0E22.",
2983
- "\u0E15.\u0E04.",
2984
- "\u0E1E.\u0E22.",
2985
- "\u0E18.\u0E04."
2986
- ],
2987
- wide: [
2988
- "\u0E21\u0E01\u0E23\u0E32\u0E04\u0E21",
2989
- "\u0E01\u0E38\u0E21\u0E20\u0E32\u0E1E\u0E31\u0E19\u0E18\u0E4C",
2990
- "\u0E21\u0E35\u0E19\u0E32\u0E04\u0E21",
2991
- "\u0E40\u0E21\u0E29\u0E32\u0E22\u0E19",
2992
- "\u0E1E\u0E24\u0E29\u0E20\u0E32\u0E04\u0E21",
2993
- "\u0E21\u0E34\u0E16\u0E38\u0E19\u0E32\u0E22\u0E19",
2994
- "\u0E01\u0E23\u0E01\u0E0E\u0E32\u0E04\u0E21",
2995
- "\u0E2A\u0E34\u0E07\u0E2B\u0E32\u0E04\u0E21",
2996
- "\u0E01\u0E31\u0E19\u0E22\u0E32\u0E22\u0E19",
2997
- "\u0E15\u0E38\u0E25\u0E32\u0E04\u0E21",
2998
- "\u0E1E\u0E24\u0E28\u0E08\u0E34\u0E01\u0E32\u0E22\u0E19",
2999
- "\u0E18\u0E31\u0E19\u0E27\u0E32\u0E04\u0E21"
3000
- ]
3001
- };
3002
- var dayPeriodValues2 = {
3003
- narrow: {
3004
- am: "\u0E01\u0E48\u0E2D\u0E19\u0E40\u0E17\u0E35\u0E48\u0E22\u0E07",
3005
- pm: "\u0E2B\u0E25\u0E31\u0E07\u0E40\u0E17\u0E35\u0E48\u0E22\u0E07",
3006
- midnight: "\u0E40\u0E17\u0E35\u0E48\u0E22\u0E07\u0E04\u0E37\u0E19",
3007
- noon: "\u0E40\u0E17\u0E35\u0E48\u0E22\u0E07",
3008
- morning: "\u0E40\u0E0A\u0E49\u0E32",
3009
- afternoon: "\u0E1A\u0E48\u0E32\u0E22",
3010
- evening: "\u0E40\u0E22\u0E47\u0E19",
3011
- night: "\u0E01\u0E25\u0E32\u0E07\u0E04\u0E37\u0E19"
3012
- },
3013
- abbreviated: {
3014
- am: "\u0E01\u0E48\u0E2D\u0E19\u0E40\u0E17\u0E35\u0E48\u0E22\u0E07",
3015
- pm: "\u0E2B\u0E25\u0E31\u0E07\u0E40\u0E17\u0E35\u0E48\u0E22\u0E07",
3016
- midnight: "\u0E40\u0E17\u0E35\u0E48\u0E22\u0E07\u0E04\u0E37\u0E19",
3017
- noon: "\u0E40\u0E17\u0E35\u0E48\u0E22\u0E07",
3018
- morning: "\u0E40\u0E0A\u0E49\u0E32",
3019
- afternoon: "\u0E1A\u0E48\u0E32\u0E22",
3020
- evening: "\u0E40\u0E22\u0E47\u0E19",
3021
- night: "\u0E01\u0E25\u0E32\u0E07\u0E04\u0E37\u0E19"
3022
- },
3023
- wide: {
3024
- am: "\u0E01\u0E48\u0E2D\u0E19\u0E40\u0E17\u0E35\u0E48\u0E22\u0E07",
3025
- pm: "\u0E2B\u0E25\u0E31\u0E07\u0E40\u0E17\u0E35\u0E48\u0E22\u0E07",
3026
- midnight: "\u0E40\u0E17\u0E35\u0E48\u0E22\u0E07\u0E04\u0E37\u0E19",
3027
- noon: "\u0E40\u0E17\u0E35\u0E48\u0E22\u0E07",
3028
- morning: "\u0E40\u0E0A\u0E49\u0E32",
3029
- afternoon: "\u0E1A\u0E48\u0E32\u0E22",
3030
- evening: "\u0E40\u0E22\u0E47\u0E19",
3031
- night: "\u0E01\u0E25\u0E32\u0E07\u0E04\u0E37\u0E19"
3032
- }
3033
- };
3034
- var formattingDayPeriodValues2 = {
3035
- narrow: {
3036
- am: "\u0E01\u0E48\u0E2D\u0E19\u0E40\u0E17\u0E35\u0E48\u0E22\u0E07",
3037
- pm: "\u0E2B\u0E25\u0E31\u0E07\u0E40\u0E17\u0E35\u0E48\u0E22\u0E07",
3038
- midnight: "\u0E40\u0E17\u0E35\u0E48\u0E22\u0E07\u0E04\u0E37\u0E19",
3039
- noon: "\u0E40\u0E17\u0E35\u0E48\u0E22\u0E07",
3040
- morning: "\u0E15\u0E2D\u0E19\u0E40\u0E0A\u0E49\u0E32",
3041
- afternoon: "\u0E15\u0E2D\u0E19\u0E01\u0E25\u0E32\u0E07\u0E27\u0E31\u0E19",
3042
- evening: "\u0E15\u0E2D\u0E19\u0E40\u0E22\u0E47\u0E19",
3043
- night: "\u0E15\u0E2D\u0E19\u0E01\u0E25\u0E32\u0E07\u0E04\u0E37\u0E19"
3044
- },
3045
- abbreviated: {
3046
- am: "\u0E01\u0E48\u0E2D\u0E19\u0E40\u0E17\u0E35\u0E48\u0E22\u0E07",
3047
- pm: "\u0E2B\u0E25\u0E31\u0E07\u0E40\u0E17\u0E35\u0E48\u0E22\u0E07",
3048
- midnight: "\u0E40\u0E17\u0E35\u0E48\u0E22\u0E07\u0E04\u0E37\u0E19",
3049
- noon: "\u0E40\u0E17\u0E35\u0E48\u0E22\u0E07",
3050
- morning: "\u0E15\u0E2D\u0E19\u0E40\u0E0A\u0E49\u0E32",
3051
- afternoon: "\u0E15\u0E2D\u0E19\u0E01\u0E25\u0E32\u0E07\u0E27\u0E31\u0E19",
3052
- evening: "\u0E15\u0E2D\u0E19\u0E40\u0E22\u0E47\u0E19",
3053
- night: "\u0E15\u0E2D\u0E19\u0E01\u0E25\u0E32\u0E07\u0E04\u0E37\u0E19"
3054
- },
3055
- wide: {
3056
- am: "\u0E01\u0E48\u0E2D\u0E19\u0E40\u0E17\u0E35\u0E48\u0E22\u0E07",
3057
- pm: "\u0E2B\u0E25\u0E31\u0E07\u0E40\u0E17\u0E35\u0E48\u0E22\u0E07",
3058
- midnight: "\u0E40\u0E17\u0E35\u0E48\u0E22\u0E07\u0E04\u0E37\u0E19",
3059
- noon: "\u0E40\u0E17\u0E35\u0E48\u0E22\u0E07",
3060
- morning: "\u0E15\u0E2D\u0E19\u0E40\u0E0A\u0E49\u0E32",
3061
- afternoon: "\u0E15\u0E2D\u0E19\u0E01\u0E25\u0E32\u0E07\u0E27\u0E31\u0E19",
3062
- evening: "\u0E15\u0E2D\u0E19\u0E40\u0E22\u0E47\u0E19",
3063
- night: "\u0E15\u0E2D\u0E19\u0E01\u0E25\u0E32\u0E07\u0E04\u0E37\u0E19"
3064
- }
3065
- };
3066
- var ordinalNumber2 = (dirtyNumber, _options) => {
3067
- return String(dirtyNumber);
3068
- };
3069
- var localize2 = {
3070
- ordinalNumber: ordinalNumber2,
3071
- era: buildLocalizeFn({
3072
- values: eraValues2,
3073
- defaultWidth: "wide"
3074
- }),
3075
- quarter: buildLocalizeFn({
3076
- values: quarterValues2,
3077
- defaultWidth: "wide",
3078
- argumentCallback: (quarter) => quarter - 1
3079
- }),
3080
- month: buildLocalizeFn({
3081
- values: monthValues2,
3082
- defaultWidth: "wide"
3083
- }),
3084
- day: buildLocalizeFn({
3085
- values: dayValues2,
3086
- defaultWidth: "wide"
3087
- }),
3088
- dayPeriod: buildLocalizeFn({
3089
- values: dayPeriodValues2,
3090
- defaultWidth: "wide",
3091
- formattingValues: formattingDayPeriodValues2,
3092
- defaultFormattingWidth: "wide"
3093
- })
3094
- };
3095
-
3096
- // node_modules/date-fns/locale/th/_lib/match.js
3097
- var matchOrdinalNumberPattern2 = /^\d+/i;
3098
- var parseOrdinalNumberPattern2 = /\d+/i;
3099
- var matchEraPatterns2 = {
3100
- narrow: /^([bB]|[aA]|คศ)/i,
3101
- abbreviated: /^([bB]\.?\s?[cC]\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?|ค\.?ศ\.?)/i,
3102
- wide: /^(ก่อนคริสตกาล|คริสต์ศักราช|คริสตกาล)/i
3103
- };
3104
- var parseEraPatterns2 = {
3105
- any: [/^[bB]/i, /^(^[aA]|ค\.?ศ\.?|คริสตกาล|คริสต์ศักราช|)/i]
3106
- };
3107
- var matchQuarterPatterns2 = {
3108
- narrow: /^[1234]/i,
3109
- abbreviated: /^q[1234]/i,
3110
- wide: /^ไตรมาส(ที่)? ?[1234]/i
3111
- };
3112
- var parseQuarterPatterns2 = {
3113
- any: [/(1|แรก|หนึ่ง)/i, /(2|สอง)/i, /(3|สาม)/i, /(4|สี่)/i]
3114
- };
3115
- var matchMonthPatterns2 = {
3116
- narrow: /^(ม\.?ค\.?|ก\.?พ\.?|มี\.?ค\.?|เม\.?ย\.?|พ\.?ค\.?|มิ\.?ย\.?|ก\.?ค\.?|ส\.?ค\.?|ก\.?ย\.?|ต\.?ค\.?|พ\.?ย\.?|ธ\.?ค\.?)/i,
3117
- abbreviated: /^(ม\.?ค\.?|ก\.?พ\.?|มี\.?ค\.?|เม\.?ย\.?|พ\.?ค\.?|มิ\.?ย\.?|ก\.?ค\.?|ส\.?ค\.?|ก\.?ย\.?|ต\.?ค\.?|พ\.?ย\.?|ธ\.?ค\.?')/i,
3118
- wide: /^(มกราคม|กุมภาพันธ์|มีนาคม|เมษายน|พฤษภาคม|มิถุนายน|กรกฎาคม|สิงหาคม|กันยายน|ตุลาคม|พฤศจิกายน|ธันวาคม)/i
3119
- };
3120
- var parseMonthPatterns2 = {
3121
- wide: [
3122
- /^มก/i,
3123
- /^กุม/i,
3124
- /^มี/i,
3125
- /^เม/i,
3126
- /^พฤษ/i,
3127
- /^มิ/i,
3128
- /^กรก/i,
3129
- /^ส/i,
3130
- /^กัน/i,
3131
- /^ต/i,
3132
- /^พฤศ/i,
3133
- /^ธ/i
3134
- ],
3135
- any: [
3136
- /^ม\.?ค\.?/i,
3137
- /^ก\.?พ\.?/i,
3138
- /^มี\.?ค\.?/i,
3139
- /^เม\.?ย\.?/i,
3140
- /^พ\.?ค\.?/i,
3141
- /^มิ\.?ย\.?/i,
3142
- /^ก\.?ค\.?/i,
3143
- /^ส\.?ค\.?/i,
3144
- /^ก\.?ย\.?/i,
3145
- /^ต\.?ค\.?/i,
3146
- /^พ\.?ย\.?/i,
3147
- /^ธ\.?ค\.?/i
3148
- ]
3149
- };
3150
- var matchDayPatterns2 = {
3151
- narrow: /^(อา\.?|จ\.?|อ\.?|พฤ\.?|พ\.?|ศ\.?|ส\.?)/i,
3152
- short: /^(อา\.?|จ\.?|อ\.?|พฤ\.?|พ\.?|ศ\.?|ส\.?)/i,
3153
- abbreviated: /^(อา\.?|จ\.?|อ\.?|พฤ\.?|พ\.?|ศ\.?|ส\.?)/i,
3154
- wide: /^(อาทิตย์|จันทร์|อังคาร|พุธ|พฤหัสบดี|ศุกร์|เสาร์)/i
3155
- };
3156
- var parseDayPatterns2 = {
3157
- wide: [/^อา/i, /^จั/i, /^อั/i, /^พุธ/i, /^พฤ/i, /^ศ/i, /^เส/i],
3158
- any: [/^อา/i, /^จ/i, /^อ/i, /^พ(?!ฤ)/i, /^พฤ/i, /^ศ/i, /^ส/i]
3159
- };
3160
- var matchDayPeriodPatterns2 = {
3161
- any: /^(ก่อนเที่ยง|หลังเที่ยง|เที่ยงคืน|เที่ยง|(ตอน.*?)?.*(เที่ยง|เช้า|บ่าย|เย็น|กลางคืน))/i
3162
- };
3163
- var parseDayPeriodPatterns2 = {
3164
- any: {
3165
- am: /^ก่อนเที่ยง/i,
3166
- pm: /^หลังเที่ยง/i,
3167
- midnight: /^เที่ยงคืน/i,
3168
- noon: /^เที่ยง/i,
3169
- morning: /เช้า/i,
3170
- afternoon: /บ่าย/i,
3171
- evening: /เย็น/i,
3172
- night: /กลางคืน/i
3173
- }
3174
- };
3175
- var match2 = {
3176
- ordinalNumber: buildMatchPatternFn({
3177
- matchPattern: matchOrdinalNumberPattern2,
3178
- parsePattern: parseOrdinalNumberPattern2,
3179
- valueCallback: (value) => parseInt(value, 10)
3180
- }),
3181
- era: buildMatchFn({
3182
- matchPatterns: matchEraPatterns2,
3183
- defaultMatchWidth: "wide",
3184
- parsePatterns: parseEraPatterns2,
3185
- defaultParseWidth: "any"
3186
- }),
3187
- quarter: buildMatchFn({
3188
- matchPatterns: matchQuarterPatterns2,
3189
- defaultMatchWidth: "wide",
3190
- parsePatterns: parseQuarterPatterns2,
3191
- defaultParseWidth: "any",
3192
- valueCallback: (index) => index + 1
3193
- }),
3194
- month: buildMatchFn({
3195
- matchPatterns: matchMonthPatterns2,
3196
- defaultMatchWidth: "wide",
3197
- parsePatterns: parseMonthPatterns2,
3198
- defaultParseWidth: "any"
3199
- }),
3200
- day: buildMatchFn({
3201
- matchPatterns: matchDayPatterns2,
3202
- defaultMatchWidth: "wide",
3203
- parsePatterns: parseDayPatterns2,
3204
- defaultParseWidth: "any"
3205
- }),
3206
- dayPeriod: buildMatchFn({
3207
- matchPatterns: matchDayPeriodPatterns2,
3208
- defaultMatchWidth: "any",
3209
- parsePatterns: parseDayPeriodPatterns2,
3210
- defaultParseWidth: "any"
3211
- })
3212
- };
3213
-
3214
- // node_modules/date-fns/locale/th.js
3215
- var th = {
3216
- code: "th",
3217
- formatDistance: formatDistance2,
3218
- formatLong: formatLong2,
3219
- formatRelative: formatRelative2,
3220
- localize: localize2,
3221
- match: match2,
3222
- options: {
3223
- weekStartsOn: 0,
3224
- firstWeekContainsDate: 1
3225
- }
3226
- };
3227
-
3228
- // src/DatePicker/convertToBuddhist.ts
3229
- var import_th_TH = __toESM(require("antd/es/date-picker/locale/th_TH"));
3230
- var buddhistLocale = {
3231
- ...import_th_TH.default,
3232
- lang: {
3233
- ...import_th_TH.default.lang,
3234
- fieldDateFormat: "BBBB-MM-DD",
3235
- fieldDateTimeFormat: "BBBB-MM-DD HH:mm:ss",
3236
- yearFormat: "BBBB",
3237
- cellYearFormat: "BBBB"
3238
- }
3239
- };
3240
-
3241
- // src/DatePicker/DatePickerBasic/DatePickerBasic.tsx
1338
+ var import_th_TH = __toESM(require("antd/locale/th_TH"));
1339
+ var import_th2 = __toESM(require_th());
3242
1340
  var import_jsx_runtime21 = require("react/jsx-runtime");
3243
- import_dayjs.default.extend(import_buddhistEra.default);
3244
1341
  function DatePickerBasic({
3245
1342
  value,
3246
1343
  onChange,
3247
1344
  required,
3248
- label,
1345
+ title,
1346
+ bottomText,
3249
1347
  error,
3250
1348
  placeholder = "\u0E01\u0E23\u0E38\u0E13\u0E32\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48",
3251
1349
  disabled,
@@ -3256,10 +1354,12 @@ function DatePickerBasic({
3256
1354
  className,
3257
1355
  size
3258
1356
  }) {
1357
+ const dateFormat = "DD/MM/YYYY";
1358
+ import_dayjs.default.locale("th_TH");
3259
1359
  return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3260
1360
  import_antd5.ConfigProvider,
3261
1361
  {
3262
- locale: import_th_TH2.default,
1362
+ locale: import_th_TH.default,
3263
1363
  theme: {
3264
1364
  token: {
3265
1365
  fontFamily: "Kanit",
@@ -3268,33 +1368,32 @@ function DatePickerBasic({
3268
1368
  },
3269
1369
  children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "container-input", children: [
3270
1370
  /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
3271
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "body-1", children: label }),
1371
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "body-1", children: title }),
1372
+ " ",
3272
1373
  required && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-red-500", children: "*" })
3273
1374
  ] }),
3274
1375
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3275
1376
  import_antd5.DatePicker,
3276
1377
  {
3277
1378
  className: `body-1 w-full ${className ?? ""}`,
3278
- value: value ? (0, import_dayjs.default)(value) : null,
1379
+ value,
3279
1380
  placeholder,
3280
- onChange: (date) => {
3281
- onChange(date ? date.toDate() : null);
3282
- },
1381
+ onChange,
3283
1382
  allowClear: true,
3284
1383
  disabled,
3285
- format: (date) => date ? format(date.toDate(), "dd/MM/yyyy", { locale: th }).replace(
3286
- /\d{4}$/,
3287
- (y) => String(parseInt(y) + 543)
3288
- ) : "",
3289
- defaultValue: defaultValue ? (0, import_dayjs.default)(defaultValue) : null,
3290
- disabledDate: (d) => disabledDate ? disabledDate(d.toDate()) : false,
3291
- minDate: minDate ? (0, import_dayjs.default)(minDate) : void 0,
3292
- maxDate: maxDate ? (0, import_dayjs.default)(maxDate) : void 0,
3293
- size,
3294
- locale: buddhistLocale
1384
+ format: dateFormat,
1385
+ defaultValue,
1386
+ minDate,
1387
+ maxDate,
1388
+ disabledDate,
1389
+ size
3295
1390
  }
3296
1391
  ),
3297
- error && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-red-500 caption-1", children: error })
1392
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
1393
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "caption-1 text-gray-500", children: bottomText }),
1394
+ " ",
1395
+ error && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "caption-1 text-red-500 ", children: error })
1396
+ ] })
3298
1397
  ] })
3299
1398
  }
3300
1399
  );
@@ -3302,18 +1401,19 @@ function DatePickerBasic({
3302
1401
 
3303
1402
  // src/DatePicker/DatePickerRangePicker/DatePickerRangePicker.tsx
3304
1403
  var import_antd6 = require("antd");
3305
- var import_th_TH3 = __toESM(require("antd/locale/th_TH"));
3306
- var import_th2 = __toESM(require_th());
1404
+ var import_th_TH2 = __toESM(require("antd/locale/th_TH"));
1405
+ var import_th3 = __toESM(require_th());
1406
+ var import_customParseFormat = __toESM(require_customParseFormat());
3307
1407
  var import_dayjs2 = __toESM(require_dayjs_min());
3308
- var import_buddhistEra2 = __toESM(require_buddhistEra());
3309
1408
  var import_jsx_runtime22 = require("react/jsx-runtime");
3310
- import_dayjs2.default.extend(import_buddhistEra2.default);
1409
+ import_dayjs2.default.extend(import_customParseFormat.default);
3311
1410
  function DatePickerRangePicker({
3312
1411
  value,
3313
1412
  onChange,
3314
1413
  placeholder = ["\u0E40\u0E23\u0E34\u0E48\u0E21\u0E15\u0E49\u0E19", "\u0E2A\u0E34\u0E49\u0E19\u0E2A\u0E38\u0E14"],
3315
- label,
1414
+ title,
3316
1415
  required,
1416
+ bottomText,
3317
1417
  error,
3318
1418
  disabled,
3319
1419
  minDate,
@@ -3324,10 +1424,12 @@ function DatePickerRangePicker({
3324
1424
  onOpenChange,
3325
1425
  onCalendarChange
3326
1426
  }) {
1427
+ const dateFormat = "DD/MM/YYYY";
1428
+ import_dayjs2.default.locale("th_TH");
3327
1429
  return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3328
1430
  import_antd6.ConfigProvider,
3329
1431
  {
3330
- locale: import_th_TH3.default,
1432
+ locale: import_th_TH2.default,
3331
1433
  theme: {
3332
1434
  token: {
3333
1435
  fontFamily: "Kanit",
@@ -3336,58 +1438,33 @@ function DatePickerRangePicker({
3336
1438
  },
3337
1439
  children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "container-input", children: [
3338
1440
  /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { children: [
3339
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "body-1", children: label }),
1441
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "body-1", children: title }),
3340
1442
  " ",
3341
1443
  required && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-red-500", children: "*" })
3342
1444
  ] }),
3343
1445
  /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3344
1446
  import_antd6.DatePicker.RangePicker,
3345
1447
  {
3346
- format: (date) => date ? format(date.toDate(), "dd/MM/yyyy", { locale: th }).replace(
3347
- /\d{4}$/,
3348
- (y) => String(parseInt(y) + 543)
3349
- ) : "",
3350
- value: value ? [
3351
- value[0] ? (0, import_dayjs2.default)(value[0]) : null,
3352
- value[1] ? (0, import_dayjs2.default)(value[1]) : null
3353
- ] : null,
1448
+ format: dateFormat,
1449
+ value,
3354
1450
  placeholder,
3355
1451
  className: `body-1 w-full ${className ?? ""}`,
3356
- onChange: (dates, dateStrings) => {
3357
- if (!dates) {
3358
- onChange(null);
3359
- } else {
3360
- onChange([
3361
- dates[0] ? dates[0].toDate() : null,
3362
- dates[1] ? dates[1].toDate() : null
3363
- ]);
3364
- }
3365
- },
1452
+ onChange,
3366
1453
  allowClear: true,
3367
1454
  disabled,
3368
- disabledDate: (d) => disabledDate ? disabledDate(d.toDate()) : false,
3369
- minDate: minDate ? (0, import_dayjs2.default)(minDate) : void 0,
3370
- maxDate: maxDate ? (0, import_dayjs2.default)(maxDate) : void 0,
1455
+ minDate,
1456
+ maxDate,
1457
+ disabledDate,
3371
1458
  size,
3372
1459
  onOpenChange,
3373
- onCalendarChange: (dates, dateStrings, info) => {
3374
- if (!dates) {
3375
- onCalendarChange?.([null, null], dateStrings, info);
3376
- } else {
3377
- onCalendarChange?.(
3378
- [
3379
- dates[0] ? dates[0].toDate() : null,
3380
- dates[1] ? dates[1].toDate() : null
3381
- ],
3382
- dateStrings,
3383
- info
3384
- );
3385
- }
3386
- },
3387
- locale: buddhistLocale
1460
+ onCalendarChange
3388
1461
  }
3389
1462
  ),
3390
- error && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-red-500 caption-1", children: error })
1463
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { children: [
1464
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "caption-1 text-gray-500", children: bottomText }),
1465
+ " ",
1466
+ error && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "caption-1 text-red-500 ", children: error })
1467
+ ] })
3391
1468
  ] })
3392
1469
  }
3393
1470
  );
@@ -3395,14 +1472,13 @@ function DatePickerRangePicker({
3395
1472
 
3396
1473
  // src/TimePicker/TimePickerBasic/TimePickerBasic.tsx
3397
1474
  var import_antd7 = require("antd");
3398
- var import_dayjs3 = __toESM(require_dayjs_min());
3399
- var import_th_TH4 = __toESM(require("antd/locale/th_TH"));
3400
1475
  var import_jsx_runtime23 = require("react/jsx-runtime");
3401
1476
  function TimePickerBasic({
3402
1477
  value,
3403
1478
  onChange,
3404
1479
  required,
3405
- label,
1480
+ title,
1481
+ bottomText,
3406
1482
  error,
3407
1483
  placeholder,
3408
1484
  disabled,
@@ -3411,7 +1487,6 @@ function TimePickerBasic({
3411
1487
  return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3412
1488
  import_antd7.ConfigProvider,
3413
1489
  {
3414
- locale: import_th_TH4.default,
3415
1490
  theme: {
3416
1491
  token: {
3417
1492
  fontFamily: "Kanit"
@@ -3419,7 +1494,7 @@ function TimePickerBasic({
3419
1494
  },
3420
1495
  children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "container-input", children: [
3421
1496
  /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { children: [
3422
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "body-1", children: label }),
1497
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "body-1", children: title }),
3423
1498
  " ",
3424
1499
  required && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-red-500", children: "*" })
3425
1500
  ] }),
@@ -3428,16 +1503,18 @@ function TimePickerBasic({
3428
1503
  {
3429
1504
  format: "HH:mm",
3430
1505
  className: `body-1 w-full ${className ?? ""}`,
3431
- value: value ? (0, import_dayjs3.default)(value) : null,
1506
+ value,
3432
1507
  placeholder,
3433
- onChange: (time) => {
3434
- onChange(time ? time.toDate() : null);
3435
- },
1508
+ onChange,
3436
1509
  allowClear: true,
3437
1510
  disabled
3438
1511
  }
3439
1512
  ),
3440
- error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-red-500 caption-1", children: error })
1513
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { children: [
1514
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "caption-1 text-gray-500", children: bottomText }),
1515
+ " ",
1516
+ error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "caption-1 text-red-500 ", children: error })
1517
+ ] })
3441
1518
  ] })
3442
1519
  }
3443
1520
  );
@@ -3445,15 +1522,14 @@ function TimePickerBasic({
3445
1522
 
3446
1523
  // src/TimePicker/TimePickerRangePicker/TimerPickerRangePicker.tsx
3447
1524
  var import_antd8 = require("antd");
3448
- var import_th_TH5 = __toESM(require("antd/locale/th_TH"));
3449
- var import_dayjs4 = __toESM(require_dayjs_min());
3450
1525
  var import_jsx_runtime24 = require("react/jsx-runtime");
3451
1526
  function TimePickerRangePicker({
3452
1527
  value,
3453
1528
  onChange,
3454
1529
  placeholder = ["\u0E40\u0E23\u0E34\u0E48\u0E21\u0E15\u0E49\u0E19", "\u0E2A\u0E34\u0E49\u0E19\u0E2A\u0E38\u0E14"],
3455
- label,
1530
+ title,
3456
1531
  required,
1532
+ bottomText,
3457
1533
  error,
3458
1534
  disabled,
3459
1535
  className
@@ -3461,7 +1537,6 @@ function TimePickerRangePicker({
3461
1537
  return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3462
1538
  import_antd8.ConfigProvider,
3463
1539
  {
3464
- locale: import_th_TH5.default,
3465
1540
  theme: {
3466
1541
  token: {
3467
1542
  fontFamily: "Kanit"
@@ -3469,7 +1544,7 @@ function TimePickerRangePicker({
3469
1544
  },
3470
1545
  children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "container-input", children: [
3471
1546
  /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { children: [
3472
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "body-1", children: label }),
1547
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "body-1", children: title }),
3473
1548
  " ",
3474
1549
  required && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-red-500", children: "*" })
3475
1550
  ] }),
@@ -3477,28 +1552,19 @@ function TimePickerRangePicker({
3477
1552
  import_antd8.TimePicker.RangePicker,
3478
1553
  {
3479
1554
  format: "HH:mm",
3480
- value: value ? [
3481
- value[0] ? (0, import_dayjs4.default)(value[0]) : null,
3482
- value[1] ? (0, import_dayjs4.default)(value[1]) : null
3483
- ] : null,
1555
+ value,
3484
1556
  placeholder,
3485
1557
  className: `body-1 w-full ${className ?? ""}`,
3486
- onChange: (dates, dateStrings) => {
3487
- if (!dates) {
3488
- onChange(null);
3489
- } else {
3490
- onChange([
3491
- dates[0] ? dates[0].toDate() : null,
3492
- dates[1] ? dates[1].toDate() : null
3493
- ]);
3494
- }
3495
- },
1558
+ onChange,
3496
1559
  allowClear: true,
3497
- disabled,
3498
- showNow: true
1560
+ disabled
3499
1561
  }
3500
1562
  ),
3501
- error && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-red-500 caption-1", children: error })
1563
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { children: [
1564
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "caption-1 text-gray-500", children: bottomText }),
1565
+ " ",
1566
+ error && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "caption-1 text-red-500 ", children: error })
1567
+ ] })
3502
1568
  ] })
3503
1569
  }
3504
1570
  );
@@ -3548,13 +1614,13 @@ function _defineProperty(e, r, t) {
3548
1614
  // node_modules/@ant-design/fast-color/es/FastColor.js
3549
1615
  var round = Math.round;
3550
1616
  function splitColorStr(str, parseNum) {
3551
- const match3 = str.replace(/^[^(]*\((.*)/, "$1").replace(/\).*/, "").match(/\d*\.?\d+%?/g) || [];
3552
- const numList = match3.map((item) => parseFloat(item));
1617
+ const match = str.replace(/^[^(]*\((.*)/, "$1").replace(/\).*/, "").match(/\d*\.?\d+%?/g) || [];
1618
+ const numList = match.map((item) => parseFloat(item));
3553
1619
  for (let i = 0; i < 3; i += 1) {
3554
- numList[i] = parseNum(numList[i] || 0, match3[i] || "", i);
1620
+ numList[i] = parseNum(numList[i] || 0, match[i] || "", i);
3555
1621
  }
3556
- if (match3[3]) {
3557
- numList[3] = match3[3].includes("%") ? numList[3] / 100 : numList[3];
1622
+ if (match[3]) {
1623
+ numList[3] = match[3].includes("%") ? numList[3] / 100 : numList[3];
3558
1624
  } else {
3559
1625
  numList[3] = 1;
3560
1626
  }
@@ -4218,11 +2284,10 @@ function genPresets(presets = presetPalettes) {
4218
2284
  function ColorPalettePickerBasic({
4219
2285
  value,
4220
2286
  onChange,
4221
- require: require2,
2287
+ required,
4222
2288
  title,
4223
2289
  bottomText,
4224
- showError,
4225
- errorMessage,
2290
+ error,
4226
2291
  disabled,
4227
2292
  allowClear,
4228
2293
  defaultFormat,
@@ -4249,7 +2314,7 @@ function ColorPalettePickerBasic({
4249
2314
  /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { children: [
4250
2315
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "body-1", children: title }),
4251
2316
  " ",
4252
- require2 && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-red-500", children: "*" })
2317
+ required && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-red-500", children: "*" })
4253
2318
  ] }),
4254
2319
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4255
2320
  import_antd9.ColorPicker,
@@ -4279,7 +2344,7 @@ function ColorPalettePickerBasic({
4279
2344
  /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { children: [
4280
2345
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "caption-1 text-gray-500", children: bottomText }),
4281
2346
  " ",
4282
- showError && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "caption-1 text-red-500 ", children: errorMessage })
2347
+ error && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "caption-1 text-red-500 ", children: error })
4283
2348
  ] })
4284
2349
  ] })
4285
2350
  }
@@ -4294,10 +2359,9 @@ function SelectField({
4294
2359
  onChange,
4295
2360
  placeholder = "\u0E42\u0E1B\u0E23\u0E14\u0E23\u0E30\u0E1A\u0E38",
4296
2361
  title,
4297
- require: require2,
2362
+ required,
4298
2363
  bottomText,
4299
- showError,
4300
- errorMessage,
2364
+ error,
4301
2365
  disabled,
4302
2366
  defaultValue,
4303
2367
  options,
@@ -4321,7 +2385,7 @@ function SelectField({
4321
2385
  /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { children: [
4322
2386
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "body-1", children: title }),
4323
2387
  " ",
4324
- require2 && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "text-red-500", children: "*" })
2388
+ required && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "text-red-500", children: "*" })
4325
2389
  ] }),
4326
2390
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4327
2391
  import_antd10.Select,
@@ -4338,7 +2402,19 @@ function SelectField({
4338
2402
  options,
4339
2403
  mode,
4340
2404
  onSearch: handleSearch,
4341
- prefix: prefix ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { style: { width: prefixSize, height: prefixSize, display: "flex", alignItems: "center", justifyContent: "center" }, children: prefix }) : void 0,
2405
+ prefix: prefix ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2406
+ "span",
2407
+ {
2408
+ style: {
2409
+ width: prefixSize,
2410
+ height: prefixSize,
2411
+ display: "flex",
2412
+ alignItems: "center",
2413
+ justifyContent: "center"
2414
+ },
2415
+ children: prefix
2416
+ }
2417
+ ) : void 0,
4342
2418
  allowClear: true,
4343
2419
  onClear
4344
2420
  }
@@ -4346,7 +2422,7 @@ function SelectField({
4346
2422
  /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { children: [
4347
2423
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "caption-1 text-gray-500", children: bottomText }),
4348
2424
  " ",
4349
- showError && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "caption-1 text-red-500 ", children: errorMessage })
2425
+ error && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "caption-1 text-red-500 ", children: error })
4350
2426
  ] })
4351
2427
  ] })
4352
2428
  }
@@ -4361,10 +2437,9 @@ function SelectFieldGroup({
4361
2437
  onChange,
4362
2438
  placeholder = "\u0E42\u0E1B\u0E23\u0E14\u0E23\u0E30\u0E1A\u0E38",
4363
2439
  title,
4364
- require: require2,
2440
+ required,
4365
2441
  bottomText,
4366
- showError,
4367
- errorMessage,
2442
+ error,
4368
2443
  disabled,
4369
2444
  defaultValue,
4370
2445
  options,
@@ -4386,7 +2461,7 @@ function SelectFieldGroup({
4386
2461
  /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { children: [
4387
2462
  /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "body-1", children: title }),
4388
2463
  " ",
4389
- require2 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "text-red-500", children: "*" })
2464
+ required && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "text-red-500", children: "*" })
4390
2465
  ] }),
4391
2466
  /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4392
2467
  import_antd11.Select,
@@ -4422,7 +2497,7 @@ function SelectFieldGroup({
4422
2497
  /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { children: [
4423
2498
  /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "caption-1 text-gray-500", children: bottomText }),
4424
2499
  " ",
4425
- showError && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "caption-1 text-red-500 ", children: errorMessage })
2500
+ error && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "caption-1 text-red-500 ", children: error })
4426
2501
  ] })
4427
2502
  ] })
4428
2503
  }
@@ -4449,11 +2524,10 @@ function SelectFieldStatus({
4449
2524
  onChange,
4450
2525
  placeholder,
4451
2526
  title,
4452
- require: require2,
2527
+ required,
4453
2528
  bottomText,
4454
2529
  disabled,
4455
- showError,
4456
- errorMessage,
2530
+ error,
4457
2531
  options,
4458
2532
  className
4459
2533
  }) {
@@ -4478,7 +2552,7 @@ function SelectFieldStatus({
4478
2552
  /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { children: [
4479
2553
  /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "body-1", children: title }),
4480
2554
  " ",
4481
- require2 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-red-500", children: "*" })
2555
+ required && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-red-500", children: "*" })
4482
2556
  ] }),
4483
2557
  /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4484
2558
  import_antd12.Select,
@@ -4498,7 +2572,7 @@ function SelectFieldStatus({
4498
2572
  /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { children: [
4499
2573
  /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "caption-1 text-gray-500", children: bottomText }),
4500
2574
  " ",
4501
- showError && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "caption-1 text-red-500 ", children: errorMessage })
2575
+ error && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "caption-1 text-red-500 ", children: error })
4502
2576
  ] })
4503
2577
  ] })
4504
2578
  }
@@ -4522,11 +2596,10 @@ function SelectFieldStatusReport({
4522
2596
  onChange,
4523
2597
  placeholder,
4524
2598
  title,
4525
- require: require2,
2599
+ required,
4526
2600
  bottomText,
4527
2601
  disabled,
4528
- showError,
4529
- errorMessage,
2602
+ error,
4530
2603
  className,
4531
2604
  options
4532
2605
  }) {
@@ -4551,7 +2624,7 @@ function SelectFieldStatusReport({
4551
2624
  /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { children: [
4552
2625
  /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "body-1", children: title }),
4553
2626
  " ",
4554
- require2 && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-red-500", children: "*" })
2627
+ required && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-red-500", children: "*" })
4555
2628
  ] }),
4556
2629
  /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4557
2630
  import_antd13.Select,
@@ -4571,7 +2644,7 @@ function SelectFieldStatusReport({
4571
2644
  /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { children: [
4572
2645
  /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { className: "caption-1 text-gray-500", children: bottomText }),
4573
2646
  " ",
4574
- showError && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { className: "caption-1 text-red-500 ", children: errorMessage })
2647
+ error && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { className: "caption-1 text-red-500 ", children: error })
4575
2648
  ] })
4576
2649
  ] })
4577
2650
  }
@@ -4584,12 +2657,11 @@ var import_react8 = require("react");
4584
2657
  var import_jsx_runtime30 = require("react/jsx-runtime");
4585
2658
  function SelectFieldTag({
4586
2659
  title,
4587
- require: require2,
2660
+ required,
4588
2661
  bottomText,
4589
2662
  placeholder,
4590
2663
  options,
4591
- showError,
4592
- errorMessage,
2664
+ error,
4593
2665
  value: controlledValue,
4594
2666
  className,
4595
2667
  onChange,
@@ -4628,7 +2700,7 @@ function SelectFieldTag({
4628
2700
  /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { children: [
4629
2701
  /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "body-1", children: title }),
4630
2702
  " ",
4631
- require2 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "text-red-500", children: "*" })
2703
+ required && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "text-red-500", children: "*" })
4632
2704
  ] }),
4633
2705
  /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4634
2706
  import_antd14.Select,
@@ -4652,7 +2724,7 @@ function SelectFieldTag({
4652
2724
  /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { children: [
4653
2725
  /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "caption-1 text-gray-500", children: bottomText }),
4654
2726
  " ",
4655
- showError && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "caption-1 text-red-500 ", children: errorMessage })
2727
+ error && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "caption-1 text-red-500 ", children: error })
4656
2728
  ] })
4657
2729
  ] })
4658
2730
  }
@@ -4668,11 +2740,10 @@ function SelectCustom({
4668
2740
  title = "\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E42\u0E04\u0E23\u0E07\u0E01\u0E32\u0E23",
4669
2741
  placeholder = "\u0E01\u0E23\u0E38\u0E13\u0E32\u0E40\u0E25\u0E37\u0E2D\u0E01",
4670
2742
  options,
4671
- require: require2 = false,
2743
+ required = false,
4672
2744
  onChange,
4673
2745
  bottomText,
4674
- showError,
4675
- errorMessage,
2746
+ error,
4676
2747
  onClear
4677
2748
  }) {
4678
2749
  const [value, setValue] = (0, import_react9.useState)([]);
@@ -4707,7 +2778,7 @@ function SelectCustom({
4707
2778
  /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { children: [
4708
2779
  /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "body-1", children: title }),
4709
2780
  " ",
4710
- require2 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-red-500", children: "*" })
2781
+ required && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-red-500", children: "*" })
4711
2782
  ] }),
4712
2783
  /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4713
2784
  import_antd15.Select,
@@ -4723,31 +2794,18 @@ function SelectCustom({
4723
2794
  /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { children: [
4724
2795
  /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "caption-1 text-gray-500", children: bottomText }),
4725
2796
  " ",
4726
- showError && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "caption-1 text-red-500 ", children: errorMessage })
2797
+ error && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "caption-1 text-red-500 ", children: error })
4727
2798
  ] }),
4728
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "w-full p-[2px] overflow-y-auto", children: valueList.map((v, index) => /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
4729
- "div",
4730
- {
4731
- className: "flex justify-between items-center py-[2px] body-1",
4732
- children: [
4733
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-row gap-[8px]", children: [
4734
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("p", { children: [
4735
- index + 1,
4736
- "."
4737
- ] }),
4738
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { children: v })
4739
- ] }),
4740
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4741
- import_icons_react8.IconTrash,
4742
- {
4743
- className: "cursor-pointer",
4744
- onClick: () => handleDelete(v)
4745
- }
4746
- )
4747
- ]
4748
- },
4749
- index
4750
- )) })
2799
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "w-full p-[2px] overflow-y-auto", children: valueList.map((v, index) => /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex justify-between items-center py-[2px] body-1", children: [
2800
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-row gap-[8px]", children: [
2801
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("p", { children: [
2802
+ index + 1,
2803
+ "."
2804
+ ] }),
2805
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { children: v })
2806
+ ] }),
2807
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_icons_react8.IconTrash, { className: "cursor-pointer", onClick: () => handleDelete(v) })
2808
+ ] }, index)) })
4751
2809
  ] })
4752
2810
  }
4753
2811
  );
@@ -5385,11 +3443,10 @@ function KpiSection({ type, onChangeKpiList }) {
5385
3443
  value: nameKpi,
5386
3444
  title: "\u0E0A\u0E37\u0E48\u0E2D\u0E1C\u0E25\u0E25\u0E31\u0E1E\u0E18\u0E4C\u0E17\u0E35\u0E48\u0E04\u0E32\u0E14\u0E2B\u0E27\u0E31\u0E07 (KPI)",
5387
3445
  placeholder: "\u0E42\u0E1B\u0E23\u0E14\u0E23\u0E30\u0E1A\u0E38",
5388
- require: true,
3446
+ required: true,
5389
3447
  onChange: (value) => setNameKpi(value ?? ""),
5390
3448
  className: "h-[32px]",
5391
- showError: !!errors.nameKpi,
5392
- errorMessage: errors.nameKpi
3449
+ error: errors.nameKpi
5393
3450
  }
5394
3451
  ),
5395
3452
  /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
@@ -5398,7 +3455,7 @@ function KpiSection({ type, onChangeKpiList }) {
5398
3455
  value: kpiValue,
5399
3456
  title: "\u0E1C\u0E25\u0E25\u0E31\u0E1E\u0E18\u0E4C\u0E17\u0E35\u0E48\u0E04\u0E32\u0E14\u0E2B\u0E27\u0E31\u0E07 (KPI)",
5400
3457
  placeholder: "\u0E42\u0E1B\u0E23\u0E14\u0E23\u0E30\u0E1A\u0E38",
5401
- require: true,
3458
+ required: true,
5402
3459
  onChange: (value) => {
5403
3460
  if (value === void 0 || value === "") {
5404
3461
  setKpiValue("");
@@ -5413,8 +3470,7 @@ function KpiSection({ type, onChangeKpiList }) {
5413
3470
  }
5414
3471
  }
5415
3472
  },
5416
- showError: !!errors.kpiValue,
5417
- errorMessage: errors.kpiValue
3473
+ error: errors.kpiValue
5418
3474
  }
5419
3475
  ),
5420
3476
  /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
@@ -5423,27 +3479,20 @@ function KpiSection({ type, onChangeKpiList }) {
5423
3479
  value: unitValue,
5424
3480
  title: "\u0E2B\u0E19\u0E48\u0E27\u0E22",
5425
3481
  placeholder: "\u0E42\u0E1B\u0E23\u0E14\u0E23\u0E30\u0E1A\u0E38",
5426
- require: true,
3482
+ required: true,
5427
3483
  onChange: (value) => setUnitValue(value ?? ""),
5428
3484
  className: "h-[32px]",
5429
- showError: !!errors.unitValue,
5430
- errorMessage: errors.unitValue
3485
+ error: errors.unitValue
5431
3486
  }
5432
3487
  ),
5433
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
5434
- "div",
3488
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: `flex justify-end mt-[28px]`, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
3489
+ import_icons_react11.IconCirclePlus,
5435
3490
  {
5436
- className: `flex justify-end mt-[28px]`,
5437
- children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
5438
- import_icons_react11.IconCirclePlus,
5439
- {
5440
- className: "w-[40px] h-[40px] cursor-pointer hover:scale-110 transition",
5441
- stroke: 1,
5442
- onClick: () => handleAddKpi(type)
5443
- }
5444
- )
3491
+ className: "w-[40px] h-[40px] cursor-pointer hover:scale-110 transition",
3492
+ stroke: 1,
3493
+ onClick: () => handleAddKpi(type)
5445
3494
  }
5446
- )
3495
+ ) })
5447
3496
  ] }),
5448
3497
  /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { children: kpiList.map((kpi, index) => /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
5449
3498
  "div",
@@ -5460,12 +3509,9 @@ function KpiSection({ type, onChangeKpiList }) {
5460
3509
  {
5461
3510
  value: kpi.name,
5462
3511
  onChange: (value) => setKpiList(
5463
- (prev) => prev.map(
5464
- (item) => item.id === kpi.id ? { ...item, name: value ?? "" } : item
5465
- )
3512
+ (prev) => prev.map((item) => item.id === kpi.id ? { ...item, name: value ?? "" } : item)
5466
3513
  ),
5467
- showError: !!itemErrors[kpi.id]?.name,
5468
- errorMessage: itemErrors[kpi.id]?.name
3514
+ error: itemErrors[kpi.id]?.name
5469
3515
  }
5470
3516
  ),
5471
3517
  /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
@@ -5475,16 +3521,12 @@ function KpiSection({ type, onChangeKpiList }) {
5475
3521
  onChange: (value) => {
5476
3522
  if (value === void 0 || value === "") {
5477
3523
  setKpiList(
5478
- (prev) => prev.map(
5479
- (item) => item.id === kpi.id ? { ...item, value: "" } : item
5480
- )
3524
+ (prev) => prev.map((item) => item.id === kpi.id ? { ...item, value: "" } : item)
5481
3525
  );
5482
3526
  setHasShownError(false);
5483
3527
  } else if (/^\d*\.?\d*$/.test(value)) {
5484
3528
  setKpiList(
5485
- (prev) => prev.map(
5486
- (item) => item.id === kpi.id ? { ...item, value } : item
5487
- )
3529
+ (prev) => prev.map((item) => item.id === kpi.id ? { ...item, value } : item)
5488
3530
  );
5489
3531
  setHasShownError(false);
5490
3532
  } else {
@@ -5494,8 +3536,7 @@ function KpiSection({ type, onChangeKpiList }) {
5494
3536
  }
5495
3537
  }
5496
3538
  },
5497
- showError: !!itemErrors[kpi.id]?.value,
5498
- errorMessage: itemErrors[kpi.id]?.value
3539
+ error: itemErrors[kpi.id]?.value
5499
3540
  }
5500
3541
  ),
5501
3542
  /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
@@ -5503,12 +3544,9 @@ function KpiSection({ type, onChangeKpiList }) {
5503
3544
  {
5504
3545
  value: kpi.unit,
5505
3546
  onChange: (value) => setKpiList(
5506
- (prev) => prev.map(
5507
- (item) => item.id === kpi.id ? { ...item, unit: value ?? "" } : item
5508
- )
3547
+ (prev) => prev.map((item) => item.id === kpi.id ? { ...item, unit: value ?? "" } : item)
5509
3548
  ),
5510
- showError: !!itemErrors[kpi.id]?.unit,
5511
- errorMessage: itemErrors[kpi.id]?.unit
3549
+ error: itemErrors[kpi.id]?.unit
5512
3550
  }
5513
3551
  ),
5514
3552
  /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
@@ -5523,13 +3561,7 @@ function KpiSection({ type, onChangeKpiList }) {
5523
3561
  onClick: () => handleSave(kpi.id, type)
5524
3562
  }
5525
3563
  ),
5526
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
5527
- import_icons_react11.IconX,
5528
- {
5529
- className: "w-[30px] h-[30px] cursor-pointer",
5530
- onClick: () => handleCancel(kpi.id)
5531
- }
5532
- )
3564
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_icons_react11.IconX, { className: "w-[30px] h-[30px] cursor-pointer", onClick: () => handleCancel(kpi.id) })
5533
3565
  ]
5534
3566
  }
5535
3567
  )
@@ -5538,20 +3570,8 @@ function KpiSection({ type, onChangeKpiList }) {
5538
3570
  /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "body-1", children: kpi.value }),
5539
3571
  /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "body-1", children: kpi.unit }),
5540
3572
  /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex gap-3 justify-end", children: [
5541
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
5542
- import_icons_react11.IconPencil,
5543
- {
5544
- className: "w-[30px] h-[30px] cursor-pointer",
5545
- onClick: () => handleEdit(kpi.id)
5546
- }
5547
- ),
5548
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
5549
- import_icons_react11.IconTrash,
5550
- {
5551
- className: "w-[30px] h-[30px] cursor-pointer",
5552
- onClick: () => handleDelete(kpi.id)
5553
- }
5554
- )
3573
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_icons_react11.IconPencil, { className: "w-[30px] h-[30px] cursor-pointer", onClick: () => handleEdit(kpi.id) }),
3574
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_icons_react11.IconTrash, { className: "w-[30px] h-[30px] cursor-pointer", onClick: () => handleDelete(kpi.id) })
5555
3575
  ] })
5556
3576
  ] })
5557
3577
  ]
@@ -5567,96 +3587,61 @@ function KpiSection({ type, onChangeKpiList }) {
5567
3587
  value: nameKpi,
5568
3588
  title: "\u0E0A\u0E37\u0E48\u0E2D\u0E1C\u0E25\u0E25\u0E31\u0E1E\u0E18\u0E4C\u0E17\u0E35\u0E48\u0E04\u0E32\u0E14\u0E2B\u0E27\u0E31\u0E07 (KPI)",
5569
3589
  placeholder: "\u0E42\u0E1B\u0E23\u0E14\u0E23\u0E30\u0E1A\u0E38",
5570
- require: true,
3590
+ required: true,
5571
3591
  onChange: (value) => setNameKpi(value ?? ""),
5572
3592
  className: "h-[32px]",
5573
- showError: !!errors.nameKpi,
5574
- errorMessage: errors.nameKpi
3593
+ error: errors.nameKpi
5575
3594
  }
5576
3595
  ),
5577
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
5578
- "div",
3596
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: `flex justify-end mt-[28px]`, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
3597
+ import_icons_react11.IconCirclePlus,
5579
3598
  {
5580
- className: `flex justify-end mt-[28px]`,
5581
- children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
5582
- import_icons_react11.IconCirclePlus,
5583
- {
5584
- className: "w-[40px] h-[40px] cursor-pointer hover:scale-110 transition",
5585
- stroke: 1,
5586
- onClick: () => handleAddKpi(type)
5587
- }
5588
- )
3599
+ className: "w-[40px] h-[40px] cursor-pointer hover:scale-110 transition",
3600
+ stroke: 1,
3601
+ onClick: () => handleAddKpi(type)
5589
3602
  }
5590
- )
3603
+ ) })
5591
3604
  ] }),
5592
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { children: kpiList.map((kpi, index) => /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
5593
- "div",
5594
- {
5595
- className: "grid grid-cols-[30px_1fr_80px] items-start py-2 body-1 gap-[8px]",
5596
- children: [
5597
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("p", { className: `body-1 ${kpi.isEditing ? "mt-[12px]" : ""}`, children: [
5598
- index + 1,
5599
- "."
5600
- ] }),
5601
- kpi.isEditing ? /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
5602
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
5603
- InputField,
5604
- {
5605
- value: kpi.name,
5606
- onChange: (value) => setKpiList(
5607
- (prev) => prev.map(
5608
- (item) => item.id === kpi.id ? { ...item, name: value ?? "" } : item
5609
- )
5610
- ),
5611
- showError: !!itemErrors[kpi.id]?.name,
5612
- errorMessage: itemErrors[kpi.id]?.name
5613
- }
3605
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { children: kpiList.map((kpi, index) => /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "grid grid-cols-[30px_1fr_80px] items-start py-2 body-1 gap-[8px]", children: [
3606
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("p", { className: `body-1 ${kpi.isEditing ? "mt-[12px]" : ""}`, children: [
3607
+ index + 1,
3608
+ "."
3609
+ ] }),
3610
+ kpi.isEditing ? /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
3611
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
3612
+ InputField,
3613
+ {
3614
+ value: kpi.name,
3615
+ onChange: (value) => setKpiList(
3616
+ (prev) => prev.map((item) => item.id === kpi.id ? { ...item, name: value ?? "" } : item)
5614
3617
  ),
5615
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
5616
- "div",
5617
- {
5618
- className: `flex gap-2 justify-end self-center ${!!itemErrors[kpi.id]?.name ? "mt-[-12px]" : ""}`,
5619
- children: [
5620
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
5621
- import_icons_react11.IconCheck,
5622
- {
5623
- className: "w-[30px] h-[30px] cursor-pointer",
5624
- onClick: () => handleSave(kpi.id, type)
5625
- }
5626
- ),
5627
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
5628
- import_icons_react11.IconX,
5629
- {
5630
- className: "w-[30px] h-[30px] cursor-pointer",
5631
- onClick: () => handleCancel(kpi.id)
5632
- }
5633
- )
5634
- ]
5635
- }
5636
- )
5637
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
5638
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "body-1", children: kpi.name }),
5639
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex gap-3 justify-end", children: [
3618
+ error: itemErrors[kpi.id]?.name
3619
+ }
3620
+ ),
3621
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
3622
+ "div",
3623
+ {
3624
+ className: `flex gap-2 justify-end self-center ${!!itemErrors[kpi.id]?.name ? "mt-[-12px]" : ""}`,
3625
+ children: [
5640
3626
  /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
5641
- import_icons_react11.IconPencil,
3627
+ import_icons_react11.IconCheck,
5642
3628
  {
5643
3629
  className: "w-[30px] h-[30px] cursor-pointer",
5644
- onClick: () => handleEdit(kpi.id)
3630
+ onClick: () => handleSave(kpi.id, type)
5645
3631
  }
5646
3632
  ),
5647
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
5648
- import_icons_react11.IconTrash,
5649
- {
5650
- className: "w-[30px] h-[30px] cursor-pointer",
5651
- onClick: () => handleDelete(kpi.id)
5652
- }
5653
- )
5654
- ] })
5655
- ] })
5656
- ]
5657
- },
5658
- kpi.id
5659
- )) })
3633
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_icons_react11.IconX, { className: "w-[30px] h-[30px] cursor-pointer", onClick: () => handleCancel(kpi.id) })
3634
+ ]
3635
+ }
3636
+ )
3637
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
3638
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "body-1", children: kpi.name }),
3639
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex gap-3 justify-end", children: [
3640
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_icons_react11.IconPencil, { className: "w-[30px] h-[30px] cursor-pointer", onClick: () => handleEdit(kpi.id) }),
3641
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_icons_react11.IconTrash, { className: "w-[30px] h-[30px] cursor-pointer", onClick: () => handleDelete(kpi.id) })
3642
+ ] })
3643
+ ] })
3644
+ ] }, kpi.id)) })
5660
3645
  ] })
5661
3646
  ] })
5662
3647
  }