UNPKG

@farris/ui-vue

Version:

Farris Vue, a Farris Design based Vue3 component library.

1,855 lines (1,854 loc) 105 kB
var ft = Object.defineProperty; var ht = (t, r, e) => r in t ? ft(t, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[r] = e; var l = (t, r, e) => ht(t, typeof r != "symbol" ? r + "" : r, e); import { ref as B, computed as D, watch as Z, onUnmounted as mt } from "vue"; import L from "bignumber.js"; import { isUndefined as wt } from "lodash-es"; function Le(t) { const r = t.nativeElement ? t.nativeElement : t; return r.classList !== void 0 && r.classList !== null ? r : null; } function Fe(t, r) { if (r === void 0) return; const e = Le(t); e && e.classList.remove(r); } function De(t, r) { if (r === void 0) return; const e = Le(t); e && e.classList.add(r); } const gt = [ { size: "sm", width: 576, pattern: /\b(col-|col-sm-)\d+\b/ }, { size: "md", width: 768, pattern: /\bcol-md-\d+\b/ }, { size: "lg", width: 888, pattern: /\bcol-lg-\d+\b/ }, { size: "xl", width: 1200, pattern: /\bcol-xl-\d+\b/ }, { size: "el", width: 1690, pattern: /\bcol-el-\d+\b/ } ]; function Qe(t) { t != null && t.resizeObserver && (t.resizeObserver.disconnect(), t.sharedObject = null); } function $e(t, r, e = 0) { const n = []; if (!r) return; const a = e || r.getBoundingClientRect().width, i = parseFloat(a), s = t.breakPoints; for (let o = 0; o < s.length; o++) s[o].width <= i && n.push(s[o].size); if (t.className.join(",") !== n.join(",")) { if (t.className.length - n.length > 0) for (let u = n.length; u < t.className.length; u++) Fe(r, "f-area-response--" + t.className[u]); else for (let u = t.className.length; u < n.length; u++) De(r, "f-area-response--" + n[u]); t.className = [...n]; } } function yt(t, r) { t.enable && t.autoWidth ? t.resizeObserver || (t.resizeObserver = new ResizeObserver((e) => { if (!e || e.length < 1 || !e[0].contentRect) return; const n = e[0].contentRect; Math.abs(parseInt(n.width + "") - t.width) > t.threshold && ($e(t, r, n.width), t.width = parseInt(n.width + "")); }), t.resizeObserver.observe(r)) : Qe(t); } function Ae(t, r) { if (t.enable) De(r, "f-area-response"), $e(t, r); else { Fe(r, "f-area-response"); for (let e = t.className.length; e > 0; e--) De(r, "f-area-response--" + t.className[e]); t.className = []; } yt(t, r); } function bt(t) { const r = []; return gt.map((e) => { const n = "col-" + e.size + "-"; if (t.querySelectorAll('[class*="' + n + '"]').length > 0) r.push({ size: e.size, width: e.width }); else if (e.size === "sm") { const i = t.querySelectorAll('[class*="col-"]'); Array.from(i).some((o) => o.className.match(e.pattern)) && r.push({ size: e.size, width: e.width }); } }), r; } function Ee(t, r, e) { r.value && Object.prototype.hasOwnProperty.call(r.value, "enable") && (t.enable = r.value.enable), r.value && Object.prototype.hasOwnProperty.call(r.value, "autoWidth") && (t.autoWidth = r.value.autoWidth), t.breakPoints = bt(e); } const be = { // 在绑定元素的父组件 // 及他自己的所有子节点都挂载完成后调用 mounted: (t, r, e) => { e.sharedObject = { className: [], resizeObserver: null, enable: !0, autoWidth: !0, threshold: 10, width: 0, breakPoints: [] }, Ee(e.sharedObject, r, t), Ae(e.sharedObject, t); }, // 在绑定元素的父组件 // 及他自己的所有子节点都更新后调用 updated: function(t, r, e, n) { e.sharedObject = n.sharedObject, Ee(e.sharedObject, r, t), Ae(e.sharedObject, t); }, // 绑定元素的父组件卸载前调用 beforeUnmount(t, r, e) { e.sharedObject && Qe(e.sharedObject); } }, xt = { created(t, r) { t.setAttribute("title", t.textContent || r.value || ""); }, mounted(t, r) { const e = r.value || t.textContent || ""; t.setAttribute("title", e); }, updated(t, r) { const e = r.value || t.textContent || ""; t.setAttribute("title", e); }, beforeUpdate(t, r) { const e = r.value || t.textContent || ""; t.setAttribute("title", e); } }; function Sr(t, r, e, n, a) { const i = B(t.disabled), s = B(!1), o = B(t.showBorder), u = B(t.textAlign), m = B(t.updateOn), y = B(!1), b = D(() => t.editable || !t.readonly && !t.disabled), _ = D(() => t.editable && !t.disabled && !t.readonly), g = D(() => !t.disabled && !t.readonly && s.value), p = D(() => e.value === "" || e.value === null || e.value === void 0), c = D(() => (t.disabled || t.readonly) && !t.forcePlaceholder ? "" : t.placeholder), d = D(() => t.readonly || !t.editable), v = D(() => t.enableTitle ? e.value : ""), M = D(() => ({ "form-control": !0, "f-utils-fill": !0, "text-left": u.value === "left", "text-center": u.value === "center", "text-right": u.value === "right" })), h = D(() => { const f = { "f-cmp-inputgroup": !0, "input-group": !0, "f-state-disabled": i.value, "f-state-editable": _.value, "f-state-readonly": d.value, "f-state-focus": g.value, "input-group--has-clear": t.enableClear && y.value }; return (t.customClass || "").split(" ").reduce((Ye, dt) => (Ye[dt] = !0, Ye), f), f; }), w = D(() => o.value ? "" : "border-width : 0 "); function P() { return t.type && t.type !== "text" ? t.type : t.showType || "text"; } const z = B(P()); function F(f, A = !0) { e.value = f, n.value !== f && (n.value = f), A && r.emit("change", f), r.emit("update:modelValue", f), r.emit("update:value", f); } Z( () => t.modelValue, (f, A) => { f !== A && (e.value = f, n.value = f); } ), Z(() => t.disabled, (f, A) => { f !== A && (i.value = f); }), Z(() => t.showType, (f) => { f && (z.value = f); }), Z(() => t.type, (f) => { z.value = f; }); function Q(f) { return f.stopPropagation(), s.value = !1, r.emit("blur", f), f.target.tagName === "TEXTAREA" && (r.emit("update:modelValue", f.target.value), r.emit("update:value", f.target.value), r.emit("change", f.target.value)), !1; } function H(f) { r.emit("click", f); } function ie(f) { i.value || d.value || (o.value && (s.value = !0), b.value && r.emit("focus", f)); } function se(f) { r.emit("input", f.target.value, f); const A = f.target.value; n.value = A, m.value === "change" && (r.emit("update:modelValue", A), r.emit("update:value", A), r.emit("change", A)); } function U(f) { r.emit("keydown", f); } function G(f) { r.emit("keyup", f); } function S(f) { const A = f.target; A.tagName !== "INPUT" && A.tagName !== "TEXTAREA" && f.preventDefault(), f.stopPropagation(), r.emit("mousedownEvent", f); } function fe(f) { r.emit("mouseupEvent", f); } function he(f) { if (m.value === "blur") { const A = f.target.value; f.stopPropagation(), F(A); } } return { changeTextBoxValue: F, disabled: i, displayText: n, editable: _, hasFocused: g, inputGroupClass: h, inputType: z, isEmpty: p, modelValue: e, readonly: d, onBlur: Q, hasClearClass: y, onClick: H, onFocus: ie, onInput: se, onKeydown: U, onKeyup: G, onMousedown: S, onMouseup: fe, onTextBoxValueChange: he, placeholder: c, textBoxClass: M, textBoxTitle: v, inputGroupStyle: w }; } function Ur(t, r, e, n) { const a = B(t.disabled), i = B(!1), s = B("text"), o = B(t.showBorder), u = B(t.textAlign); D(() => t.editable || !t.readonly); const m = D(() => t.editable && !t.disabled && !t.readonly), y = D(() => !t.disabled && i.value), b = D(() => e.value === "" || e.value === null || e.value === void 0), _ = D(() => t.placeholder), g = D(() => t.readonly || !t.editable), p = D(() => t.enableTitle ? e.value : ""), c = D(() => ({ "form-control": !0, // 'f-utils-fill': true, "text-left": u.value === "left", "text-center": u.value === "center", "text-right": u.value === "right" })), d = D(() => ({ "f-cmp-inputgroup": !0, "input-group": !0, "f-state-disabled": !0, "f-state-editable": !1, "f-state-readonly": !0 // 'f-state-focus': hasFocused.value })), v = D(() => o.value ? "" : "border-width : 0 "); function M(h, w = !0) { } return { changeTextBoxValue: M, disabled: a, displayText: n, editable: m, hasFocused: y, inputGroupClass: d, inputType: s, isEmpty: b, modelValue: e, readonly: g, // onBlur, // onClick, // onFocus, // onInput, // onKeydown, // onKeyup, // onMousedown, // onTextBoxValueChange, placeholder: _, textBoxClass: c, textBoxTitle: p, inputGroupStyle: v }; } function Vr(t, r, e) { const n = B(!1), a = D(() => t.enableClear && !t.readonly && !t.disabled), { changeTextBoxValue: i, displayText: s, hasFocused: o, modelValue: u, isEmpty: m, hasClearClass: y } = e; function b(v) { n.value = v, y && (y.value = n.value); } Z(s, () => { o != null && o.value ? b(!!(s != null && s.value)) : b(!1); }); const _ = D(() => ({ "input-group-text": !0, "input-group-clear": !0 })), g = D(() => ({ width: "24px", display: n.value ? "flex" : "none" })); function p(v) { v.stopPropagation(), a.value && (i("", !0), b(!n.value), r.emit("clear")); } function c(v) { var P, z; const M = ((P = v.target.querySelector("input")) == null ? void 0 : P.value) || "", h = ((z = v.target.querySelector("textarea")) == null ? void 0 : z.value) || "", w = M || h; w !== u.value && (u.value = w), a.value && b(!!w); } function d(v) { a.value && b(!1); } return { clearButtonClass: _, clearButtonStyle: g, hasShownClearButton: n, onClearValue: p, onMouseEnter: c, onMouseLeave: d, shouldShowClearButton: a }; } const pt = { jan: 1, feb: 2, mar: 3, apr: 4, may: 5, jun: 6, jul: 7, aug: 8, sep: 9, oct: 10, nov: 11, dec: 12 }, vt = { sun: 0, mon: 1, tue: 2, wed: 3, thu: 4, fri: 5, sat: 6 }; class ze { constructor() { l(this, "regexes", { YEAR: "[1-9]\\d{3}", MONTH: "1[0-2]|0?[1-9]", MONTH2: "1[0-2]|0[1-9]", MONTHNAME: "jan|january|feb|february|mar|march|apr|april|may|jun|june|jul|july|aug|august|sep|september|oct|october|nov|november|dec|december", DAYNAME: "mon|monday|tue|tuesday|wed|wednesday|thu|thursday|fri|friday|sat|saturday|sun|sunday", DAY: "3[01]|[12]\\d|0?[1-9]", DAY2: "3[01]|[12]\\d|0[1-9]", TIMEZONE: "[+-][01]\\d\\:?[0-5]\\d", H24: "[01]\\d|2[0-3]", MIN: "[0-5]\\d", SEC: "[0-5]\\d", MS: "\\d{3,}", H12: "0?[1-9]|1[012]", AMPM: "am|pm", UNIT: "year|month|week|day|hour|minute|second|millisecond" }); l(this, "patterns", [ // 2010-03-15 ["iso_8601", this.makePattern("^(_YEAR_)-(_MONTH_)-(_DAY_)$"), "$2/$3/$1"], // 3-15-2010 ["us", this.makePattern("^(_MONTH_)([\\/-])(_DAY_)\\2(_YEAR_)$"), "$1/$3/$4"], // 15.03.2010 ["world", this.makePattern("^(_DAY_)([\\/\\.])(_MONTH_)\\2(_YEAR_)$"), "$3/$1/$4"], // 15-Mar-2010, 8 Dec 2011, "Thu, 8 Dec 2011" ["chicago", this.makePattern("^(?:(?:_DAYNAME_),? )?(_DAY_)([ -])(_MONTHNAME_)\\2(_YEAR_)$"), "$3 $1, $4"], // "March 4, 2012", "Mar 4 2012", "Sun Mar 4 2012" ["conversational", this.makePattern("^(?:(?:_DAYNAME_),? )?(_MONTHNAME_) (_DAY_),? (_YEAR_)$"), "$1 $2, $3"], // Tue Jun 22 17:47:27 +0000 2010 [ "month_day_time_year", this.makePattern("^(?:_DAYNAME_) (_MONTHNAME_) (_DAY_) ((?:_H24_)\\:(?:_MIN_)(?:\\:_SEC_)?) (_TIMEZONE_) (_YEAR_)$"), (r) => { const e = ("" + this.getMonthByName(r[1])).padStart(2, "0"), n = ("" + r[2]).padStart(2, "0"), a = r[5], i = r[3], s = r[4], o = a + "-" + e + "-" + n + "T" + i + s; return isNaN(o) ? !1 : o; } ], // @123456789 [ "unix", /^@(-?\d+)$/, (r) => this.create(parseInt(r[1], 10) * 1e3) ], // 24-hour time (This will help catch Date objects that are casted to a string) [ "24_hour", this.makePattern("^(?:(.+?)(?: |T))?(_H24_)\\:(_MIN_)(?:\\:(_SEC_)(?:\\.(_MS_))?)? ?(?:GMT)?(_TIMEZONE_)?(?: \\([A-Z]+\\))?$"), (r) => { let e; const n = r[1]; if (n) { if (e = this.create(n), isNaN(e)) return !1; } else e = /* @__PURE__ */ new Date(), e.setMilliseconds(0); const a = r[2], i = r[3], s = r[4], o = r[5]; return e.setHours(parseFloat(a), parseFloat(i), parseFloat(s || 0)), o && e.setMilliseconds(+String(o).slice(0, 3)), e; } ], // 12-hour time [ "12_hour", this.makePattern("^(?:(.+) )?(_H12_)(?:\\:(_MIN_)(?:\\:(_SEC_))?)? ?(_AMPM_)$"), (r) => { let e; const n = r[1]; if (n) { if (e = this.create(n), isNaN(e)) return !1; } else e = /* @__PURE__ */ new Date(), e.setMilliseconds(0); let a = parseFloat(r[2]); a = r[5].toLowerCase() === "am" ? a === 12 ? 0 : a : a === 12 ? 12 : a + 12; const i = r[3], s = r[4]; return e.setHours(a, parseFloat(i || 0), parseFloat(s || 0)), e; } ] ]); } makePattern(r) { return r = r.replace(/_([A-Z][A-Z0-9]+)_/g, (e, n) => this.regexes[n]), new RegExp(r, "i"); } getMonthByName(r) { return pt[String(r).slice(0, 3).toLowerCase()]; } getWeekdayByName(r) { return vt[String(r).slice(0, 3).toLowerCase()]; } parse(r) { if (!isNaN(Number(r))) return new Date(r); if (r = String(r).replace(/^\s*(.*)\s*$/, "$1"), r = r.replace(/\s{2,}/g, " "), r === "") return Date.now(); let e = 0; for (; e < this.patterns.length; ) { const n = this.patterns[e]; let a, i; typeof n[0] == "string" ? (i = n[1], a = n[2]) : (i = n[0], a = n[1]); const s = r.match(i); if (!s) { e++; continue; } if (typeof a == "function") { const o = a(s); if (o instanceof Date) return o; } else { const o = Date.parse(r.replace(i, a)); if (!isNaN(o)) return new Date(o); } e++; } return NaN; } create(r) { return r == null ? Date.now() : r instanceof Date ? r : this.parse(r); } } function E(t) { const r = Object.prototype.toString.call(t); return t instanceof Date || typeof t == "object" && r === "[object Date]" ? new t.constructor(+t) : typeof t == "number" || r === "[object Number]" || typeof t == "string" || r === "[object String]" ? new Date(t) : /* @__PURE__ */ new Date(NaN); } function k(t, r) { return t instanceof Date ? new t.constructor(r) : new Date(r); } function Xe(t, r) { const e = E(t); return isNaN(r) ? k(t, NaN) : (r && e.setDate(e.getDate() + r), e); } const je = 6048e5, Tt = 864e5, ke = 6e4, Oe = 36e5, Dt = 1e3; let Mt = {}; function ae() { return Mt; } function J(t, r) { var o, u, m, y; const e = ae(), n = (r == null ? void 0 : r.weekStartsOn) ?? ((u = (o = r == null ? void 0 : r.locale) == null ? void 0 : o.options) == null ? void 0 : u.weekStartsOn) ?? e.weekStartsOn ?? ((y = (m = e.locale) == null ? void 0 : m.options) == null ? void 0 : y.weekStartsOn) ?? 0, a = E(t), i = a.getDay(), s = (i < n ? 7 : 0) + i - n; return a.setDate(a.getDate() - s), a.setHours(0, 0, 0, 0), a; } function re(t) { return J(t, { weekStartsOn: 1 }); } function Ge(t) { const r = E(t), e = r.getFullYear(), n = k(t, 0); n.setFullYear(e + 1, 0, 4), n.setHours(0, 0, 0, 0); const a = re(n), i = k(t, 0); i.setFullYear(e, 0, 4), i.setHours(0, 0, 0, 0); const s = re(i); return r.getTime() >= a.getTime() ? e + 1 : r.getTime() >= s.getTime() ? e : e - 1; } function He(t) { const r = E(t); return r.setHours(0, 0, 0, 0), r; } function we(t) { const r = E(t), e = new Date( Date.UTC( r.getFullYear(), r.getMonth(), r.getDate(), r.getHours(), r.getMinutes(), r.getSeconds(), r.getMilliseconds() ) ); return e.setUTCFullYear(r.getFullYear()), +t - +e; } function Nt(t, r) { const e = He(t), n = He(r), a = +e - we(e), i = +n - we(n); return Math.round((a - i) / Tt); } function kt(t) { const r = Ge(t), e = k(t, 0); return e.setFullYear(r, 0, 4), e.setHours(0, 0, 0, 0), re(e); } function Ot(t) { return t instanceof Date || typeof t == "object" && Object.prototype.toString.call(t) === "[object Date]"; } function Se(t) { if (!Ot(t) && typeof t != "number") return !1; const r = E(t); return !isNaN(Number(r)); } function _t(t) { const r = E(t), e = k(t, 0); return e.setFullYear(r.getFullYear(), 0, 1), e.setHours(0, 0, 0, 0), e; } const Pt = { lessThanXSeconds: { one: "less than a second", other: "less than {{count}} seconds" }, xSeconds: { one: "1 second", other: "{{count}} seconds" }, halfAMinute: "half a minute", lessThanXMinutes: { one: "less than a minute", other: "less than {{count}} minutes" }, xMinutes: { one: "1 minute", other: "{{count}} minutes" }, aboutXHours: { one: "about 1 hour", other: "about {{count}} hours" }, xHours: { one: "1 hour", other: "{{count}} hours" }, xDays: { one: "1 day", other: "{{count}} days" }, aboutXWeeks: { one: "about 1 week", other: "about {{count}} weeks" }, xWeeks: { one: "1 week", other: "{{count}} weeks" }, aboutXMonths: { one: "about 1 month", other: "about {{count}} months" }, xMonths: { one: "1 month", other: "{{count}} months" }, aboutXYears: { one: "about 1 year", other: "about {{count}} years" }, xYears: { one: "1 year", other: "{{count}} years" }, overXYears: { one: "over 1 year", other: "over {{count}} years" }, almostXYears: { one: "almost 1 year", other: "almost {{count}} years" } }, Ct = (t, r, e) => { let n; const a = Pt[t]; return typeof a == "string" ? n = a : r === 1 ? n = a.one : n = a.other.replace("{{count}}", r.toString()), e != null && e.addSuffix ? e.comparison && e.comparison > 0 ? "in " + n : n + " ago" : n; }; function xe(t) { return (r = {}) => { const e = r.width ? String(r.width) : t.defaultWidth; return t.formats[e] || t.formats[t.defaultWidth]; }; } const Yt = { full: "EEEE, MMMM do, y", long: "MMMM do, y", medium: "MMM d, y", short: "MM/dd/yyyy" }, At = { full: "h:mm:ss a zzzz", long: "h:mm:ss a z", medium: "h:mm:ss a", short: "h:mm a" }, Et = { full: "{{date}} 'at' {{time}}", long: "{{date}} 'at' {{time}}", medium: "{{date}}, {{time}}", short: "{{date}}, {{time}}" }, Ht = { date: xe({ formats: Yt, defaultWidth: "full" }), time: xe({ formats: At, defaultWidth: "full" }), dateTime: xe({ formats: Et, defaultWidth: "full" }) }, Wt = { lastWeek: "'last' eeee 'at' p", yesterday: "'yesterday at' p", today: "'today at' p", tomorrow: "'tomorrow at' p", nextWeek: "eeee 'at' p", other: "P" }, Rt = (t, r, e, n) => Wt[t]; function oe(t) { return (r, e) => { const n = e != null && e.context ? String(e.context) : "standalone"; let a; if (n === "formatting" && t.formattingValues) { const s = t.defaultFormattingWidth || t.defaultWidth, o = e != null && e.width ? String(e.width) : s; a = t.formattingValues[o] || t.formattingValues[s]; } else { const s = t.defaultWidth, o = e != null && e.width ? String(e.width) : t.defaultWidth; a = t.values[o] || t.values[s]; } const i = t.argumentCallback ? t.argumentCallback(r) : r; return a[i]; }; } const It = { narrow: ["B", "A"], abbreviated: ["BC", "AD"], wide: ["Before Christ", "Anno Domini"] }, qt = { narrow: ["1", "2", "3", "4"], abbreviated: ["Q1", "Q2", "Q3", "Q4"], wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"] }, Bt = { narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"], abbreviated: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ], wide: [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ] }, Lt = { narrow: ["S", "M", "T", "W", "T", "F", "S"], short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], wide: [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ] }, Ft = { narrow: { am: "a", pm: "p", midnight: "mi", noon: "n", morning: "morning", afternoon: "afternoon", evening: "evening", night: "night" }, abbreviated: { am: "AM", pm: "PM", midnight: "midnight", noon: "noon", morning: "morning", afternoon: "afternoon", evening: "evening", night: "night" }, wide: { am: "a.m.", pm: "p.m.", midnight: "midnight", noon: "noon", morning: "morning", afternoon: "afternoon", evening: "evening", night: "night" } }, Qt = { narrow: { am: "a", pm: "p", midnight: "mi", noon: "n", morning: "in the morning", afternoon: "in the afternoon", evening: "in the evening", night: "at night" }, abbreviated: { am: "AM", pm: "PM", midnight: "midnight", noon: "noon", morning: "in the morning", afternoon: "in the afternoon", evening: "in the evening", night: "at night" }, wide: { am: "a.m.", pm: "p.m.", midnight: "midnight", noon: "noon", morning: "in the morning", afternoon: "in the afternoon", evening: "in the evening", night: "at night" } }, $t = (t, r) => { const e = Number(t), n = e % 100; if (n > 20 || n < 10) switch (n % 10) { case 1: return e + "st"; case 2: return e + "nd"; case 3: return e + "rd"; } return e + "th"; }, zt = { ordinalNumber: $t, era: oe({ values: It, defaultWidth: "wide" }), quarter: oe({ values: qt, defaultWidth: "wide", argumentCallback: (t) => t - 1 }), month: oe({ values: Bt, defaultWidth: "wide" }), day: oe({ values: Lt, defaultWidth: "wide" }), dayPeriod: oe({ values: Ft, defaultWidth: "wide", formattingValues: Qt, defaultFormattingWidth: "wide" }) }; function ue(t) { return (r, e = {}) => { const n = e.width, a = n && t.matchPatterns[n] || t.matchPatterns[t.defaultMatchWidth], i = r.match(a); if (!i) return null; const s = i[0], o = n && t.parsePatterns[n] || t.parsePatterns[t.defaultParseWidth], u = Array.isArray(o) ? jt(o, (b) => b.test(s)) : ( // eslint-disable-next-line @typescript-eslint/no-explicit-any -- I challange you to fix the type Xt(o, (b) => b.test(s)) ); let m; m = t.valueCallback ? t.valueCallback(u) : u, m = e.valueCallback ? ( // eslint-disable-next-line @typescript-eslint/no-explicit-any -- I challange you to fix the type e.valueCallback(m) ) : m; const y = r.slice(s.length); return { value: m, rest: y }; }; } function Xt(t, r) { for (const e in t) if (Object.prototype.hasOwnProperty.call(t, e) && r(t[e])) return e; } function jt(t, r) { for (let e = 0; e < t.length; e++) if (r(t[e])) return e; } function Gt(t) { return (r, e = {}) => { const n = r.match(t.matchPattern); if (!n) return null; const a = n[0], i = r.match(t.parsePattern); if (!i) return null; let s = t.valueCallback ? t.valueCallback(i[0]) : i[0]; s = e.valueCallback ? e.valueCallback(s) : s; const o = r.slice(a.length); return { value: s, rest: o }; }; } const St = /^(\d+)(th|st|nd|rd)?/i, Ut = /\d+/i, Vt = { narrow: /^(b|a)/i, abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i, wide: /^(before christ|before common era|anno domini|common era)/i }, Zt = { any: [/^b/i, /^(a|c)/i] }, Kt = { narrow: /^[1234]/i, abbreviated: /^q[1234]/i, wide: /^[1234](th|st|nd|rd)? quarter/i }, Jt = { any: [/1/i, /2/i, /3/i, /4/i] }, en = { narrow: /^[jfmasond]/i, abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i, wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i }, tn = { narrow: [ /^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i ], any: [ /^ja/i, /^f/i, /^mar/i, /^ap/i, /^may/i, /^jun/i, /^jul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i ] }, nn = { narrow: /^[smtwf]/i, short: /^(su|mo|tu|we|th|fr|sa)/i, abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i, wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i }, rn = { narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i], any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i] }, an = { narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i, any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i }, sn = { any: { am: /^a/i, pm: /^p/i, midnight: /^mi/i, noon: /^no/i, morning: /morning/i, afternoon: /afternoon/i, evening: /evening/i, night: /night/i } }, on = { ordinalNumber: Gt({ matchPattern: St, parsePattern: Ut, valueCallback: (t) => parseInt(t, 10) }), era: ue({ matchPatterns: Vt, defaultMatchWidth: "wide", parsePatterns: Zt, defaultParseWidth: "any" }), quarter: ue({ matchPatterns: Kt, defaultMatchWidth: "wide", parsePatterns: Jt, defaultParseWidth: "any", valueCallback: (t) => t + 1 }), month: ue({ matchPatterns: en, defaultMatchWidth: "wide", parsePatterns: tn, defaultParseWidth: "any" }), day: ue({ matchPatterns: nn, defaultMatchWidth: "wide", parsePatterns: rn, defaultParseWidth: "any" }), dayPeriod: ue({ matchPatterns: an, defaultMatchWidth: "any", parsePatterns: sn, defaultParseWidth: "any" }) }, Ue = { code: "en-US", formatDistance: Ct, formatLong: Ht, formatRelative: Rt, localize: zt, match: on, options: { weekStartsOn: 0, firstWeekContainsDate: 1 } }; function un(t) { const r = E(t); return Nt(r, _t(r)) + 1; } function Ve(t) { const r = E(t), e = +re(r) - +kt(r); return Math.round(e / je) + 1; } function _e(t, r) { var y, b, _, g; const e = E(t), n = e.getFullYear(), a = ae(), i = (r == null ? void 0 : r.firstWeekContainsDate) ?? ((b = (y = r == null ? void 0 : r.locale) == null ? void 0 : y.options) == null ? void 0 : b.firstWeekContainsDate) ?? a.firstWeekContainsDate ?? ((g = (_ = a.locale) == null ? void 0 : _.options) == null ? void 0 : g.firstWeekContainsDate) ?? 1, s = k(t, 0); s.setFullYear(n + 1, 0, i), s.setHours(0, 0, 0, 0); const o = J(s, r), u = k(t, 0); u.setFullYear(n, 0, i), u.setHours(0, 0, 0, 0); const m = J(u, r); return e.getTime() >= o.getTime() ? n + 1 : e.getTime() >= m.getTime() ? n : n - 1; } function cn(t, r) { var o, u, m, y; const e = ae(), n = (r == null ? void 0 : r.firstWeekContainsDate) ?? ((u = (o = r == null ? void 0 : r.locale) == null ? void 0 : o.options) == null ? void 0 : u.firstWeekContainsDate) ?? e.firstWeekContainsDate ?? ((y = (m = e.locale) == null ? void 0 : m.options) == null ? void 0 : y.firstWeekContainsDate) ?? 1, a = _e(t, r), i = k(t, 0); return i.setFullYear(a, 0, n), i.setHours(0, 0, 0, 0), J(i, r); } function Ze(t, r) { const e = E(t), n = +J(e, r) - +cn(e, r); return Math.round(n / je) + 1; } function T(t, r) { const e = t < 0 ? "-" : "", n = Math.abs(t).toString().padStart(r, "0"); return e + n; } const V = { // Year y(t, r) { const e = t.getFullYear(), n = e > 0 ? e : 1 - e; return T(r === "yy" ? n % 100 : n, r.length); }, // Month M(t, r) { const e = t.getMonth(); return r === "M" ? String(e + 1) : T(e + 1, 2); }, // Day of the month d(t, r) { return T(t.getDate(), r.length); }, // AM or PM a(t, r) { const e = t.getHours() / 12 >= 1 ? "pm" : "am"; switch (r) { case "a": case "aa": return e.toUpperCase(); case "aaa": return e; case "aaaaa": return e[0]; case "aaaa": default: return e === "am" ? "a.m." : "p.m."; } }, // Hour [1-12] h(t, r) { return T(t.getHours() % 12 || 12, r.length); }, // Hour [0-23] H(t, r) { return T(t.getHours(), r.length); }, // Minute m(t, r) { return T(t.getMinutes(), r.length); }, // Second s(t, r) { return T(t.getSeconds(), r.length); }, // Fraction of second S(t, r) { const e = r.length, n = t.getMilliseconds(), a = Math.trunc( n * Math.pow(10, e - 3) ); return T(a, r.length); } }, te = { midnight: "midnight", noon: "noon", morning: "morning", afternoon: "afternoon", evening: "evening", night: "night" }, We = { // Era G: function(t, r, e) { const n = t.getFullYear() > 0 ? 1 : 0; switch (r) { case "G": case "GG": case "GGG": return e.era(n, { width: "abbreviated" }); case "GGGGG": return e.era(n, { width: "narrow" }); case "GGGG": default: return e.era(n, { width: "wide" }); } }, // Year y: function(t, r, e) { if (r === "yo") { const n = t.getFullYear(), a = n > 0 ? n : 1 - n; return e.ordinalNumber(a, { unit: "year" }); } return V.y(t, r); }, // Local week-numbering year Y: function(t, r, e, n) { const a = _e(t, n), i = a > 0 ? a : 1 - a; if (r === "YY") { const s = i % 100; return T(s, 2); } return r === "Yo" ? e.ordinalNumber(i, { unit: "year" }) : T(i, r.length); }, // ISO week-numbering year R: function(t, r) { const e = Ge(t); return T(e, r.length); }, // Extended year. This is a single number designating the year of this calendar system. // The main difference between `y` and `u` localizers are B.C. years: // | Year | `y` | `u` | // |------|-----|-----| // | AC 1 | 1 | 1 | // | BC 1 | 1 | 0 | // | BC 2 | 2 | -1 | // Also `yy` always returns the last two digits of a year, // while `uu` pads single digit years to 2 characters and returns other years unchanged. u: function(t, r) { const e = t.getFullYear(); return T(e, r.length); }, // Quarter Q: function(t, r, e) { const n = Math.ceil((t.getMonth() + 1) / 3); switch (r) { case "Q": return String(n); case "QQ": return T(n, 2); case "Qo": return e.ordinalNumber(n, { unit: "quarter" }); case "QQQ": return e.quarter(n, { width: "abbreviated", context: "formatting" }); case "QQQQQ": return e.quarter(n, { width: "narrow", context: "formatting" }); case "QQQQ": default: return e.quarter(n, { width: "wide", context: "formatting" }); } }, // Stand-alone quarter q: function(t, r, e) { const n = Math.ceil((t.getMonth() + 1) / 3); switch (r) { case "q": return String(n); case "qq": return T(n, 2); case "qo": return e.ordinalNumber(n, { unit: "quarter" }); case "qqq": return e.quarter(n, { width: "abbreviated", context: "standalone" }); case "qqqqq": return e.quarter(n, { width: "narrow", context: "standalone" }); case "qqqq": default: return e.quarter(n, { width: "wide", context: "standalone" }); } }, // Month M: function(t, r, e) { const n = t.getMonth(); switch (r) { case "M": case "MM": return V.M(t, r); case "Mo": return e.ordinalNumber(n + 1, { unit: "month" }); case "MMM": return e.month(n, { width: "abbreviated", context: "formatting" }); case "MMMMM": return e.month(n, { width: "narrow", context: "formatting" }); case "MMMM": default: return e.month(n, { width: "wide", context: "formatting" }); } }, // Stand-alone month L: function(t, r, e) { const n = t.getMonth(); switch (r) { case "L": return String(n + 1); case "LL": return T(n + 1, 2); case "Lo": return e.ordinalNumber(n + 1, { unit: "month" }); case "LLL": return e.month(n, { width: "abbreviated", context: "standalone" }); case "LLLLL": return e.month(n, { width: "narrow", context: "standalone" }); case "LLLL": default: return e.month(n, { width: "wide", context: "standalone" }); } }, // Local week of year w: function(t, r, e, n) { const a = Ze(t, n); return r === "wo" ? e.ordinalNumber(a, { unit: "week" }) : T(a, r.length); }, // ISO week of year I: function(t, r, e) { const n = Ve(t); return r === "Io" ? e.ordinalNumber(n, { unit: "week" }) : T(n, r.length); }, // Day of the month d: function(t, r, e) { return r === "do" ? e.ordinalNumber(t.getDate(), { unit: "date" }) : V.d(t, r); }, // Day of year D: function(t, r, e) { const n = un(t); return r === "Do" ? e.ordinalNumber(n, { unit: "dayOfYear" }) : T(n, r.length); }, // Day of week E: function(t, r, e) { const n = t.getDay(); switch (r) { case "E": case "EE": case "EEE": return e.day(n, { width: "abbreviated", context: "formatting" }); case "EEEEE": return e.day(n, { width: "narrow", context: "formatting" }); case "EEEEEE": return e.day(n, { width: "short", context: "formatting" }); case "EEEE": default: return e.day(n, { width: "wide", context: "formatting" }); } }, // Local day of week e: function(t, r, e, n) { const a = t.getDay(), i = (a - n.weekStartsOn + 8) % 7 || 7; switch (r) { case "e": return String(i); case "ee": return T(i, 2); case "eo": return e.ordinalNumber(i, { unit: "day" }); case "eee": return e.day(a, { width: "abbreviated", context: "formatting" }); case "eeeee": return e.day(a, { width: "narrow", context: "formatting" }); case "eeeeee": return e.day(a, { width: "short", context: "formatting" }); case "eeee": default: return e.day(a, { width: "wide", context: "formatting" }); } }, // Stand-alone local day of week c: function(t, r, e, n) { const a = t.getDay(), i = (a - n.weekStartsOn + 8) % 7 || 7; switch (r) { case "c": return String(i); case "cc": return T(i, r.length); case "co": return e.ordinalNumber(i, { unit: "day" }); case "ccc": return e.day(a, { width: "abbreviated", context: "standalone" }); case "ccccc": return e.day(a, { width: "narrow", context: "standalone" }); case "cccccc": return e.day(a, { width: "short", context: "standalone" }); case "cccc": default: return e.day(a, { width: "wide", context: "standalone" }); } }, // ISO day of week i: function(t, r, e) { const n = t.getDay(), a = n === 0 ? 7 : n; switch (r) { case "i": return String(a); case "ii": return T(a, r.length); case "io": return e.ordinalNumber(a, { unit: "day" }); case "iii": return e.day(n, { width: "abbreviated", context: "formatting" }); case "iiiii": return e.day(n, { width: "narrow", context: "formatting" }); case "iiiiii": return e.day(n, { width: "short", context: "formatting" }); case "iiii": default: return e.day(n, { width: "wide", context: "formatting" }); } }, // AM or PM a: function(t, r, e) { const a = t.getHours() / 12 >= 1 ? "pm" : "am"; switch (r) { case "a": case "aa": return e.dayPeriod(a, { width: "abbreviated", context: "formatting" }); case "aaa": return e.dayPeriod(a, { width: "abbreviated", context: "formatting" }).toLowerCase(); case "aaaaa": return e.dayPeriod(a, { width: "narrow", context: "formatting" }); case "aaaa": default: return e.dayPeriod(a, { width: "wide", context: "formatting" }); } }, // AM, PM, midnight, noon b: function(t, r, e) { const n = t.getHours(); let a; switch (n === 12 ? a = te.noon : n === 0 ? a = te.midnight : a = n / 12 >= 1 ? "pm" : "am", r) { case "b": case "bb": return e.dayPeriod(a, { width: "abbreviated", context: "formatting" }); case "bbb": return e.dayPeriod(a, { width: "abbreviated", context: "formatting" }).toLowerCase(); case "bbbbb": return e.dayPeriod(a, { width: "narrow", context: "formatting" }); case "bbbb": default: return e.dayPeriod(a, { width: "wide", context: "formatting" }); } }, // in the morning, in the afternoon, in the evening, at night B: function(t, r, e) { const n = t.getHours(); let a; switch (n >= 17 ? a = te.evening : n >= 12 ? a = te.afternoon : n >= 4 ? a = te.morning : a = te.night, r) { case "B": case "BB": case "BBB": return e.dayPeriod(a, { width: "abbreviated", context: "formatting" }); case "BBBBB": return e.dayPeriod(a, { width: "narrow", context: "formatting" }); case "BBBB": default: return e.dayPeriod(a, { width: "wide", context: "formatting" }); } }, // Hour [1-12] h: function(t, r, e) { if (r === "ho") { let n = t.getHours() % 12; return n === 0 && (n = 12), e.ordinalNumber(n, { unit: "hour" }); } return V.h(t, r); }, // Hour [0-23] H: function(t, r, e) { return r === "Ho" ? e.ordinalNumber(t.getHours(), { unit: "hour" }) : V.H(t, r); }, // Hour [0-11] K: function(t, r, e) { const n = t.getHours() % 12; return r === "Ko" ? e.ordinalNumber(n, { unit: "hour" }) : T(n, r.length); }, // Hour [1-24] k: function(t, r, e) { let n = t.getHours(); return n === 0 && (n = 24), r === "ko" ? e.ordinalNumber(n, { unit: "hour" }) : T(n, r.length); }, // Minute m: function(t, r, e) { return r === "mo" ? e.ordinalNumber(t.getMinutes(), { unit: "minute" }) : V.m(t, r); }, // Second s: function(t, r, e) { return r === "so" ? e.ordinalNumber(t.getSeconds(), { unit: "second" }) : V.s(t, r); }, // Fraction of second S: function(t, r) { return V.S(t, r); }, // Timezone (ISO-8601. If offset is 0, output is always `'Z'`) X: function(t, r, e) { const n = t.getTimezoneOffset(); if (n === 0) return "Z"; switch (r) { case "X": return Ie(n); case "XXXX": case "XX": return ee(n); case "XXXXX": case "XXX": default: return ee(n, ":"); } }, // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent) x: function(t, r, e) { const n = t.getTimezoneOffset(); switch (r) { case "x": return Ie(n); case "xxxx": case "xx": return ee(n); case "xxxxx": case "xxx": default: return ee(n, ":"); } }, // Timezone (GMT) O: function(t, r, e) { const n = t.getTimezoneOffset(); switch (r) { case "O": case "OO": case "OOO": return "GMT" + Re(n, ":"); case "OOOO": default: return "GMT" + ee(n, ":"); } }, // Timezone (specific non-location) z: function(t, r, e) { const n = t.getTimezoneOffset(); switch (r) { case "z": case "zz": case "zzz": return "GMT" + Re(n, ":"); case "zzzz": default: return "GMT" + ee(n, ":"); } }, // Seconds timestamp t: function(t, r, e) { const n = Math.trunc(t.getTime() / 1e3); return T(n, r.length); }, // Milliseconds timestamp T: function(t, r, e) { const n = t.getTime(); return T(n, r.length); } }; function Re(t, r = "") { const e = t > 0 ? "-" : "+", n = Math.abs(t), a = Math.trunc(n / 60), i = n % 60; return i === 0 ? e + String(a) : e + String(a) + r + T(i, 2); } function Ie(t, r) { return t % 60 === 0 ? (t > 0 ? "-" : "+") + T(Math.abs(t) / 60, 2) : ee(t, r); } function ee(t, r = "") { const e = t > 0 ? "-" : "+", n = Math.abs(t), a = T(Math.trunc(n / 60), 2), i = T(n % 60, 2); return e + a + r + i; } const qe = (t, r) => { switch (t) { case "P": return r.date({ width: "short" }); case "PP": return r.date({ width: "medium" }); case "PPP": return r.date({ width: "long" }); case "PPPP": default: return r.date({ width: "full" }); } }, Ke = (t, r) => { switch (t) { case "p": return r.time({ width: "short" }); case "pp": return r.time({ width: "medium" }); case "ppp": return r.time({ width: "long" }); case "pppp": default: return r.time({ width: "full" }); } }, ln = (t, r) => { const e = t.match(/(P+)(p+)?/) || [], n = e[1], a = e[2]; if (!a) return qe(t, r); let i; switch (n) { case "P": i = r.dateTime({ width: "short" }); break; case "PP": i = r.dateTime({ width: "medium" }); break; case "PPP": i = r.dateTime({ width: "long" }); break; case "PPPP": default: i = r.dateTime({ width: "full" }); break; } return i.replace("{{date}}", qe(n, r)).replace("{{time}}", Ke(a, r)); }, Me = { p: Ke, P: ln }, dn = /^D+$/, fn = /^Y+$/, hn = ["D", "DD", "YY", "YYYY"]; function Je(t) { return dn.test(t); } function et(t) { return fn.test(t); } function Ne(t, r, e) { const n = mn(t, r, e); if (console.warn(n), hn.includes(t)) throw new RangeError(n); } function mn(t, r, e) { const n = t[0] === "Y" ? "years" : "days of the month"; return `Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${r}\`) for formatting ${n} to the input \`${e}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`; } const wn = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g, gn = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g, yn = /^'([^]*?)'?$/, bn = /''/g, xn = /[a-zA-Z]/; function de(t, r, e) { var y, b, _, g; const n = ae(), a = n.locale ?? Ue, i = n.firstWeekContainsDate ?? ((b = (y = n.locale) == null ? void 0 : y.options) == null ? void 0 : b.firstWeekContainsDate) ?? 1, s = n.weekStartsOn ?? ((g = (_ = n.locale) == null ? void 0 : _.options) == null ? void 0 : g.weekStartsOn) ?? 0, o = E(t); if (!Se(o)) throw new RangeError("Invalid time value"); let u = r.match(gn).map((p) => { const c = p[0]; if (c === "p" || c === "P") { const d = Me[c]; return d(p, a.formatLong); } return p; }).join("").match(wn).map((p) => { if (p === "''") return { isToken: !1, value: "'" }; const c = p[0]; if (c === "'") return { isToken: !1, value: pn(p) }; if (We[c]) return { isToken: !0, value: p }; if (c.match(xn)) throw new RangeError( "Format string contains an unescaped latin alphabet character `" + c + "`" ); return { isToken: !1, value: p }; }); a.localize.preprocessor && (u = a.localize.preprocessor(o, u)); const m = { firstWeekContainsDate: i, weekStartsOn: s, locale: a }; return u.map((p) => { if (!p.isToken) return p.value; const c = p.value; (et(c) || Je(c)) && Ne(c, r, String(t)); const d = We[c[0]]; return d(o, c, a.localize, m); }).join(""); } function pn(t) { const r = t.match(yn); return r ? r[1].replace(bn, "'") : t; } function vn() { return Object.assign({}, ae()); } function Tn(t) { let e = E(t).getDay(); return e === 0 && (e = 7), e; } function Dn(t, r) { const e = r instanceof Date ? k(r, 0) : new r(0); return e.setFullYear( t.getFullYear(), t.getMonth(), t.getDate() ), e.setHours( t.getHours(), t.getMinutes(), t.getSeconds(), t.getMilliseconds() ), e; } const Mn = 10; class tt { constructor() { l(this, "subPriority", 0); } validate(r, e) { return !0; } } class Nn extends tt { constructor(r, e, n, a, i) { super(), this.value = r, this.validateValue = e, this.setValue = n, this.priority = a, i && (this.subPriority = i); } validate(r, e) { return this.validateValue(r, this.value, e); } set(r, e, n) { return this.setValue(r, e, this.value, n); } } class kn extends tt { constructor() { super(...arguments); l(this, "priority", Mn); l(this, "subPriority", -1); } set(e, n) { return n.timestampIsSet ? e : k(e, Dn(e, Date)); } } class x { run(r, e, n, a) { const i = this.parse(r, e, n, a); return i ? { setter: new Nn( i.value, this.validate, this.set, this.priority, this.subPriority ), rest: i.rest } : null; } validate(r, e, n) { return !0; } } class On extends x { constructor() { super(...arguments); l(this, "priority", 140); l(this, "incompatibleTokens", ["R", "u", "t", "T"]); } parse(e, n, a) { switch (n) { case "G": case "GG": case "GGG": return a.era(e, { width: "abbreviated" }) || a.era(e, { width: "narrow" }); case "GGGGG": return a.era(e, { width: "narrow" }); case "GGGG": default: return a.era(e, { width: "wide" }) || a.era(e, { width: "abbreviated" }) || a.era(e, { width: "narrow" }); } } set(e, n, a) { return n.era = a, e.setFullYear(a, 0, 1), e.setHours(0, 0, 0, 0), e; } } const C = { month: /^(1[0-2]|0?\d)/, // 0 to 12 date: /^(3[0-1]|[0-2]?\d)/, // 0 to 31 dayOfYear: /^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/, // 0 to 366 week: /^(5[0-3]|[0-4]?\d)/, // 0 to 53 hour23h: /^(2[0-3]|[0-1]?\d)/, // 0 to 23 hour24h: /^(2[0-4]|[0-1]?\d)/, // 0 to 24 hour11h: /^(1[0-1]|0?\d)/, // 0 to 11 hour12h: /^(1[0-2]|0?\d)/, // 0 to 12 minute: /^[0-5]?\d/, // 0 to 59 second: /^[0-5]?\d/, // 0 to 59 singleDigit: /^\d/, // 0 to 9 twoDigits: /^\d{1,2}/, // 0 to 99 threeDigits: /^\d{1,3}/, // 0 to 999 fourDigits: /^\d{1,4}/, // 0 to 9999 anyDigitsSigned: /^-?\d+/, singleDigitSigned: /^-?\d/, // 0 to 9, -0 to -9 twoDigitsSigned: /^-?\d{1,2}/, // 0 to 99, -0 to -99 threeDigitsSigned: /^-?\d{1,3}/, // 0 to 999, -0 to -999 fourDigitsSigned: /^-?\d{1,4}/ // 0 to 9999, -0 to -9999 }, X = { basicOptionalMinutes: /^([+-])(\d{2})(\d{2})?|Z/, basic: /^([+-])(\d{2})(\d{2})|Z/, basicOptionalSeconds: /^([+-])(\d{2})(\d{2})((\d{2}))?|Z/, extended: /^([+-])(\d{2}):(\d{2})|Z/, extendedOptionalSeconds: /^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/ }; function Y(t, r) { return t && { value: r(t.value), rest: t.rest }; } function N(t, r) { const e = r.match(t); return e ? { value: parseInt(e[0], 10), rest: r.slice(e[0].length) } : null; } function j(t, r) { const e = r.match(t); if (!e) return null; if (e[0] === "Z") return { value: 0, rest: r.slice(1) }; const n = e[1] === "+" ? 1 : -1, a = e[2] ? parseInt(e[2], 10) : 0, i = e[3] ? parseInt(e[3], 10) : 0, s = e[5] ? parseInt(e[5], 10) : 0; return { value: n * (a * Oe + i * ke + s * Dt), rest: r.slice(e[0].length) }; } function nt(t) { return N(C.anyDigitsSigned, t); } function O(t, r) { switch (t) { case 1: return N(C.singleDigit, r); case 2: return N(C.twoDigits, r); case 3: return N(C.threeDigits, r); case 4: return N(C.fourDigits, r); default: return N(new RegExp("^\\d{1," + t + "}"), r); } } function ge(t, r) { switch (t) { case 1: return N(C.singleDigitSigned, r); case 2: return N(C.twoDigitsSigned, r); case 3: return N(C.threeDigitsSigned, r); case 4: return N(C.fourDigitsSigned, r); default: return N(new RegExp("^-?\\d{1," + t + "}"), r); } } function Pe(t) { switch (t) { case "morning": return 4; case "evening": return 17; case "pm": case "noon": case "afternoon": return 12; case "am": case "midnight": case "night": default: return 0; } } function rt(t, r) { const e = r > 0, n = e ? r : 1 - r; let a; if (n <= 50) a = t || 100; else { const i = n + 50, s = Math.trunc(i / 100) * 100, o = t >= i % 100; a = t + s - (o ? 100 : 0); } return e ? a : 1 - a; } function at(t) { return t % 400 === 0 || t % 4 === 0 && t % 100 !== 0; } class _n extends x { constructor() { super(...arguments); l(this, "priority", 130); l(this, "incompatibleTokens", ["Y", "R", "u", "w", "I", "i", "e", "c", "t", "T"]); } parse(e, n, a) { const i = (s) => ({ year: s, isTwoDigitYear: n === "yy" }); switch (n) {