UNPKG

@farris/ui-vue

Version:

Farris Vue, a Farris Design based Vue3 component library.

1,895 lines 109 kB
var yt = Object.defineProperty; var bt = (t, e, n) => e in t ? yt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n; var V = (t, e, n) => bt(t, typeof e != "symbol" ? e + "" : e, n); import { defineComponent as ae, toRefs as Fe, createVNode as s, Fragment as oe, createTextVNode as P, ref as E, watch as te, inject as le, getCurrentInstance as xt, onMounted as Oe, onUnmounted as Ee, computed as q, reactive as Dt, createApp as Mt, Transition as Tt, mergeProps as St, provide as kt, resolveComponent as J, onBeforeMount as Pt } from "vue"; import { isPlainObject as Re, cloneDeep as Ie } from "lodash-es"; import "bignumber.js"; import { withInstall as Ct } from "../common/index.esm.js"; const Ft = { // 是否被选中 checked: { type: Boolean, default: !1 }, // 进度条状态 默认'normal' id: { type: String, default: "" }, // 禁用 disabled: { type: Boolean, default: !1 } }, Ot = { // 是否显示进度条信息 showInfo: { type: Boolean, default: !0 }, // 进度条状态 默认'normal' status: { type: String, default: "normal" }, // 已完成的分段百分比 percent: { type: Number, default: 0 }, maxWidth: { type: Number, default: 0 } }, Et = { /** * 按钮文本 */ selectText: { type: String, default: "选择文件" }, /** * 禁用 */ disabled: { type: Boolean, default: !1 }, /** * 启用多选 */ enableMulti: { type: Boolean, default: !0 }, /** * 允许上传类型 */ accept: { type: String, default: "*" }, /** * 配置对象 */ options: { type: Object, default: {} }, /** * 已上传附件个数 */ uploadedCount: { type: Number, default: 0 }, /** * 发起服务器端请求,某个组件使用的特殊的参数 */ extendConfig: { type: Object, default: {} }, /** * 附件服务器端服务注入的Token */ uploadServerToken: { type: String, default: "" } }, Nt = /* @__PURE__ */ ae({ name: "FUploadProgress", props: Ot, setup(t, e) { const { showInfo: n, status: a, maxWidth: r, percent: i } = Fe(t); return () => s("div", { class: ["f-progress upload-progress", "upload-progress-status-" + a.value, "f-progress-status-" + a.value, "upload-progress-line", n.value ? "upload-progress-show-info" : ""] }, [s("div", { class: "upload-progress-outer", style: { "max-width": r.value > 0 ? r.value + "px" : "auto" } }, [s("div", { class: "upload-progress-inner" }, [s("div", { class: "upload-progress-bg f-progress-bg", style: { width: i.value + "%" } }, null)])]), n.value ? s("span", { class: "upload-progress-text" }, [a.value === "error" || a.value === "success" ? s("span", { class: ["upload-progress-text-icon f-icon", "f-icon-" + a.value] }, null) : s(oe, null, [i.value, P("%")])]) : ""]); } }), Ze = /* @__PURE__ */ ae({ name: "FPreviewCheckbox", props: Ft, emits: ["checkedChange"], setup(t, e) { const { disabled: n } = Fe(t), a = E(t.checked), r = (i) => { i.stopPropagation(), n.value || (a.value = !a.value, e.emit("checkedChange", { checked: a.value, id: t.id })); }; return te(() => t.checked, (i) => { a.value = i; }), () => s("div", { class: "preview-checkbox d-inline-flex align-middle" }, [s("div", { class: "custom-control custom-checkbox f-checkradio-single m-0" }, [s("input", { title: "custom-control-input", class: "custom-control-input", type: "checkbox", disabled: n.value, checked: a.value }, null), s("label", { class: "custom-control-label", onClick: (i) => r(i), onMousedown: (i) => i.stopPropagation() }, null)])]); } }), Je = /* @__PURE__ */ ae({ name: "FFileSelect", props: Et, emits: ["change", "stateChange"], setup(t, e) { const n = le("uploaderService"); n.setUploadContext(e); const a = xt(), r = E("*"); let i; const l = () => { i.files && (e.emit("change", i.files), n.handleFiles(i.files), i.value = null); }; function o() { i.value = null, n.reset(); } te(() => t.disabled, () => { o(); }), te(() => t.uploadedCount, (d) => { n.setOptions({ uploadedCount: d }); }), te(() => t.extendConfig, (d) => { n.setExtendServerConfig(d); }); function f(d) { d && d.stopPropagation(), i.click(); } function u(d) { n.handleUploadEvent(d); } return Oe(() => { var d, m; i = (d = a == null ? void 0 : a.proxy) == null ? void 0 : d.$refs.uploadInput, o(), n.setOptions(t.options), n.setExtendServerConfig(t.extendConfig), r.value = (((m = t.options) == null ? void 0 : m.allowedContentTypes) || ["*"]).join(","); }), Ee(() => { }), e.expose({ handleUploadEvent: u }), () => s(oe, null, [s("input", { ref: "uploadInput", type: "file", class: "ffileupload--browser", disabled: t.disabled, multiple: t.enableMulti, accept: r.value, onChange: () => l(), style: "width: 10px", title: "uploadInput" }, null), s("div", { class: ["upload-container", t.disabled ? "f-state-disabled" : ""], onClick: (d) => f(d), title: t.selectText }, [s("i", { class: "f-icon f-icon-upload upload-icon", style: "top: 2px;position: relative;" }, null), t.selectText])]); } }), Ke = {}, et = {}; function Ne(t) { const { properties: e, title: n, ignore: a } = t, r = a && Array.isArray(a), i = Object.keys(e).reduce((l, o) => ((!r || !a.find((f) => f === o)) && (l[o] = e[o].type === "object" && e[o].properties ? Ne(e[o]) : Ie(e[o].default)), l), {}); if (n && (!r || !a.find((l) => l === "id"))) { const l = n.toLowerCase().replace(/-/g, "_"); i.id = `${l}_${Math.random().toString().slice(2, 6)}`; } return i; } function At(t) { const { properties: e, title: n, required: a } = t; if (a && Array.isArray(a)) { const r = a.reduce((i, l) => (i[l] = e[l].type === "object" && e[l].properties ? Ne(e[l]) : Ie(e[l].default), i), {}); if (n && a.find((i) => i === "id")) { const i = n.toLowerCase().replace(/-/g, "_"); r.id = `${i}_${Math.random().toString().slice(2, 6)}`; } return r; } return { type: n }; } function tt(t, e = {}, n) { const a = Ke[t]; if (a) { let r = At(a); const i = et[t]; return r = i ? i({ getSchemaByType: tt }, r, e, n) : r, r; } return null; } function Ht(t, e) { const n = Ne(e); return Object.keys(n).reduce((a, r) => (Object.prototype.hasOwnProperty.call(t, r) && (a[r] && Re(a[r]) && Re(t[r] || !t[r]) ? Object.assign(a[r], t[r] || {}) : a[r] = t[r]), a), n), n; } function nt(t, e) { return Object.keys(t).filter((a) => t[a] != null).reduce((a, r) => { if (e.has(r)) { const i = e.get(r); if (typeof i == "string") a[i] = t[r]; else { const l = i(r, t[r], t); Object.assign(a, l); } } else a[r] = t[r]; return a; }, {}); } function Bt(t, e, n = /* @__PURE__ */ new Map()) { const a = Ht(t, e); return nt(a, n); } function _t(t = {}) { function e(u, d, m, h) { if (typeof m == "number") return h[u].length === m; if (typeof m == "object") { const x = Object.keys(m)[0], v = m[x]; if (x === "not") return Number(h[u].length) !== Number(v); if (x === "moreThan") return Number(h[u].length) >= Number(v); if (x === "lessThan") return Number(h[u].length) <= Number(v); } return !1; } function n(u, d, m, h) { return h[u] && h[u].propertyValue && String(h[u].propertyValue.value) === String(m); } const a = /* @__PURE__ */ new Map([ ["length", e], ["getProperty", n] ]); Object.keys(t).reduce((u, d) => (u.set(d, t[d]), u), a); function r(u, d) { const m = u; return typeof d == "number" ? [{ target: m, operator: "length", param: null, value: Number(d) }] : typeof d == "boolean" ? [{ target: m, operator: "getProperty", param: u, value: !!d }] : typeof d == "object" ? Object.keys(d).map((h) => { if (h === "length") return { target: m, operator: "length", param: null, value: d[h] }; const x = h, v = d[h]; return { target: m, operator: "getProperty", param: x, value: v }; }) : []; } function i(u) { return Object.keys(u).reduce((m, h) => { const x = r(h, u[h]); return m.push(...x), m; }, []); } function l(u, d) { if (a.has(u.operator)) { const m = a.get(u.operator); return m && m(u.target, u.param, u.value, d) || !1; } return !1; } function o(u, d) { return i(u).reduce((x, v) => x && l(v, d), !0); } function f(u, d) { const m = Object.keys(u), h = m.includes("allOf"), x = m.includes("anyOf"), v = h || x, S = (v ? u[v ? h ? "allOf" : "anyOf" : "allOf"] : [u]).map((M) => o(M, d)); return h ? !S.includes(!1) : S.includes(!0); } return { parseValueSchema: f }; } const Rt = {}, Yt = {}; _t(); function Wt(t, e, n = /* @__PURE__ */ new Map(), a = (l, o, f, u) => o, r = {}, i = (l) => l) { return Ke[e.title] = e, et[e.title] = a, Rt[e.title] = r, Yt[e.title] = i, (l = {}, o = !0) => { if (!o) return nt(l, n); const f = Bt(l, e, n), u = Object.keys(t).reduce((d, m) => (d[m] = t[m].default, d), {}); return Object.assign(u, f); }; } const jt = "https://json-schema.org/draft/2020-12/schema", qt = "https://farris-design.gitee.io/uploader.schema.json", $t = "uploader", Ut = "A Farris Component", Lt = "object", zt = { id: { description: "The unique identifier for uploader", type: "string" }, type: { description: "The type string of uploader", type: "string", default: "uploader" }, appearance: { description: "", type: "object", properties: { class: { type: "string" }, style: { type: "string" } }, default: {} }, binding: { description: "", type: "object", default: {} }, disable: { type: "boolean", default: !1 }, placeholder: { description: "", type: "string", default: "" }, readonly: { description: "", type: "boolean", default: !1 }, tabindex: { description: "", type: "number", default: -1 }, visible: { description: "", type: "boolean", default: !0 } }, Qt = [ "id", "type" ], Vt = { $schema: jt, $id: qt, title: $t, description: Ut, type: Lt, properties: zt, required: Qt }; function Xt(t, e) { return { customClass: e.class, customStyle: e.style }; } const Gt = /* @__PURE__ */ new Map([ ["appearance", Xt] ]); function It(t, e, n) { return e; } const Zt = "uploader", Jt = "A Farris Component", Kt = "object", en = { basic: { description: "Basic Infomation", title: "基本信息", properties: { id: { description: "组件标识", title: "标识", type: "string", readonly: !0 }, type: { description: "组件类型", title: "控件类型", type: "select", editor: { type: "waiting for modification", enum: [] } } } }, appearance: { description: "外观", title: "外观", properties: { contentFill: { description: "内容填充", title: "内容填充", type: "boolean" } } }, server: { description: "服务器配置", title: "服务器配置", properties: { rootId: { description: "附件服务器根目录", title: "附件服务器根目录", type: "string" }, formId: { description: "必填,根据【附件信息】业务字段所在位置区分:1、在子表,二级目录建议绑定主表ID。2:在主表:二级目录建议填写当前表数据ID", title: "二级目录", type: "string" } } }, upload: { description: "上传配置", title: "上传配置", properties: { uploadVisible: { description: "上传按钮是否可见", title: "上传是否可见", type: "boolean" }, uploadDisabled: { description: "禁用时,上传按钮可见,但不可用", title: "上传是否禁用", type: "boolean" }, allowEmpty: { description: "运行时是否允许不上传附件", title: "是否允许为空", type: "boolean" }, uploadSelectText: { description: "选择文件按钮文本", title: "选择文件按钮文本", type: "string" }, uploadOptions: { description: "附件上传配置", title: "附件上传配置", type: "cascade", isExpand: !0, properties: { maxUploads: { description: "值为0时表示不限制上传个数", title: "最大上传个数", type: "number" }, maxFileSize: { description: "单个附件最大值(MB)", title: "单个附件最大值(MB)", type: "number" }, allowedContentTypes: { description: "允许上传附件类型", title: "允许上传附件类型", type: "string" }, notAllowedCharsInFileName: { description: "文件名禁用字符", title: "文件名禁用字符", type: "string" } } }, enableUploadedCount: { description: "是否启用已上传个数限制", title: "是否启用已上传个数限制", type: "select", editor: { type: "waiting for modification", enum: [] } }, uploadEnableMulti: { description: "是否启用多选附件上传", title: "是否启用多选附件上传", type: "select", editor: { type: "waiting for modification", enum: [] } }, enableSliceUpload: { description: "是否启用分片上传", title: "是否启用分片上传", type: "select", editor: { type: "waiting for modification", enum: [] } }, chunkSize: { description: "分片上传时,每片的大小。单位:M", title: "分片大小(M)", type: "number" } } }, preview: { description: "附件预览", title: "附件预览", properties: { previewVisible: { description: "预览是否可见", title: "预览是否可见", type: "boolean" }, previewReadonly: { description: "预览是否只读", title: "预览是否只读", type: "boolean" }, fieldIdKey: { description: "附件ID字段", title: "附件ID字段", type: "string", editor: { type: "field-selector" } }, fileNameKey: { description: "附件名称字段", title: "附件名称字段", type: "string", editor: { type: "field-selector" } }, previewEnableMulti: { description: "是否启用批量操作", title: "是否启用批量操作", type: "boolean" }, noDelete: { description: "是否禁止删除附件", title: "是否禁止删除附件", type: "boolean" }, noPreview: { description: "是否禁止预览", title: "是否禁止预览", type: "boolean" }, previewDateFormat: { description: "附件上传时间字段的格式化设置,请注意此属性仅针对附件上传时间一个字段,若有自定义预览列,请在预览列编辑器中单独设置时间格式。", title: "附件上传时间格式化", type: "select", editor: { type: "waiting for modification", enum: [] } }, fileSortOrderKey: { description: "排序字段", title: "排序字段", type: "string" }, orderType: { description: "排序类型", title: "排序类型", type: "select", editor: { type: "waiting for modification", enum: [] } } } } }, tn = { title: Zt, description: Jt, type: Kt, categories: en }, Ae = { /** 内容区域填充 */ contentFill: { type: Boolean, default: !1 }, /** 排序字段 */ orderField: { type: String, default: "createTime" }, previewColumns: { type: Array, default: [ { field: "name", width: 200, title: "文件名", checkbox: !0 }, { field: "size", width: 100, title: "大小" }, { field: "createTime", width: 100, title: "日期" }, { field: "state", width: 100, title: "状态" }, { field: "action", width: 100, title: "操作" } ] }, previewVisible: { type: Boolean, default: !0 }, /** 是否启用批量操作 */ previewEnableMulti: { type: Boolean, default: !0 }, /** 默认重命名 */ previewDefaultRename: { type: String, default: "" }, /** 附件上传部分禁用状态 */ uploadDisabled: { type: Boolean, default: !1 }, // 附件上传部分是否可见 uploadVisible: { type: Boolean, default: !0 }, // 需要重置,通过不断的赋值来改变 // @Input() uploadNeedReset: Observable<any> = new Subject(); /** 选择文件按钮上的文字 */ uploadSelectText: { type: String, default: "选择文件" }, /** 启用多选 */ uploadEnableMulti: { type: Boolean, default: !0 }, /** 已经上传文件 */ uploadedCount: { type: Number, default: 0 }, /** 整个控件禁用 */ disabled: { type: Boolean, default: !1 }, /** 下载按钮是否禁用 */ downloadButtonDisable: { type: Boolean, default: !1 }, /** 预览按钮是否禁用 */ previewButtonDisable: { type: Boolean, default: !1 }, /** 删除按钮是否禁用 */ deleteButtonDisable: { type: Boolean, default: !1 }, /** * 自定义展示信息 */ customInfo: { type: String, default: "" }, /** * 处理传递预览的数据 */ fileInfos: { type: Array, default: [] }, /** * 上传配置 */ uploadOptions: { type: Object, default: null }, /** * 发起服务器端请求,某个组件使用的特殊的参数 */ extendConfig: { type: Object, default: {} }, /** * 附件服务器端服务注入的Token */ uploadServerToken: { type: String, default: "" }, /** * 提示服务注入的Token */ notifyServiceToken: { type: String, default: "" } }, at = Wt(Ae, Vt, Gt, It, tn), nn = { jan: 1, feb: 2, mar: 3, apr: 4, may: 5, jun: 6, jul: 7, aug: 8, sep: 9, oct: 10, nov: 11, dec: 12 }, an = { sun: 0, mon: 1, tue: 2, wed: 3, thu: 4, fri: 5, sat: 6 }; class rn { constructor() { V(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" }); V(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_)$"), (e) => { const n = ("" + this.getMonthByName(e[1])).padStart(2, "0"), a = ("" + e[2]).padStart(2, "0"), r = e[5], i = e[3], l = e[4], o = r + "-" + n + "-" + a + "T" + i + l; return isNaN(o) ? !1 : o; } ], // @123456789 [ "unix", /^@(-?\d+)$/, (e) => this.create(parseInt(e[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]+\\))?$"), (e) => { let n; const a = e[1]; if (a) { if (n = this.create(a), isNaN(n)) return !1; } else n = /* @__PURE__ */ new Date(), n.setMilliseconds(0); const r = e[2], i = e[3], l = e[4], o = e[5]; return n.setHours(parseFloat(r), parseFloat(i), parseFloat(l || 0)), o && n.setMilliseconds(+String(o).slice(0, 3)), n; } ], // 12-hour time [ "12_hour", this.makePattern("^(?:(.+) )?(_H12_)(?:\\:(_MIN_)(?:\\:(_SEC_))?)? ?(_AMPM_)$"), (e) => { let n; const a = e[1]; if (a) { if (n = this.create(a), isNaN(n)) return !1; } else n = /* @__PURE__ */ new Date(), n.setMilliseconds(0); let r = parseFloat(e[2]); r = e[5].toLowerCase() === "am" ? r === 12 ? 0 : r : r === 12 ? 12 : r + 12; const i = e[3], l = e[4]; return n.setHours(r, parseFloat(i || 0), parseFloat(l || 0)), n; } ] ]); } makePattern(e) { return e = e.replace(/_([A-Z][A-Z0-9]+)_/g, (n, a) => this.regexes[a]), new RegExp(e, "i"); } getMonthByName(e) { return nn[String(e).slice(0, 3).toLowerCase()]; } getWeekdayByName(e) { return an[String(e).slice(0, 3).toLowerCase()]; } parse(e) { if (!isNaN(Number(e))) return new Date(e); if (e = String(e).replace(/^\s*(.*)\s*$/, "$1"), e = e.replace(/\s{2,}/g, " "), e === "") return Date.now(); let n = 0; for (; n < this.patterns.length; ) { const a = this.patterns[n]; let r, i; typeof a[0] == "string" ? (i = a[1], r = a[2]) : (i = a[0], r = a[1]); const l = e.match(i); if (!l) { n++; continue; } if (typeof r == "function") { const o = r(l); if (o instanceof Date) return o; } else { const o = Date.parse(e.replace(i, r)); if (!isNaN(o)) return new Date(o); } n++; } return NaN; } create(e) { return e == null ? Date.now() : e instanceof Date ? e : this.parse(e); } } function X(t) { const e = Object.prototype.toString.call(t); return t instanceof Date || typeof t == "object" && e === "[object Date]" ? new t.constructor(+t) : typeof t == "number" || e === "[object Number]" || typeof t == "string" || e === "[object String]" ? new Date(t) : /* @__PURE__ */ new Date(NaN); } function ne(t, e) { return t instanceof Date ? new t.constructor(e) : new Date(e); } const rt = 6048e5, sn = 864e5, it = 6e4, st = 36e5; let on = {}; function Me() { return on; } function pe(t, e) { var o, f, u, d; const n = Me(), a = (e == null ? void 0 : e.weekStartsOn) ?? ((f = (o = e == null ? void 0 : e.locale) == null ? void 0 : o.options) == null ? void 0 : f.weekStartsOn) ?? n.weekStartsOn ?? ((d = (u = n.locale) == null ? void 0 : u.options) == null ? void 0 : d.weekStartsOn) ?? 0, r = X(t), i = r.getDay(), l = (i < a ? 7 : 0) + i - a; return r.setDate(r.getDate() - l), r.setHours(0, 0, 0, 0), r; } function xe(t) { return pe(t, { weekStartsOn: 1 }); } function ot(t) { const e = X(t), n = e.getFullYear(), a = ne(t, 0); a.setFullYear(n + 1, 0, 4), a.setHours(0, 0, 0, 0); const r = xe(a), i = ne(t, 0); i.setFullYear(n, 0, 4), i.setHours(0, 0, 0, 0); const l = xe(i); return e.getTime() >= r.getTime() ? n + 1 : e.getTime() >= l.getTime() ? n : n - 1; } function Ye(t) { const e = X(t); return e.setHours(0, 0, 0, 0), e; } function We(t) { const e = X(t), n = new Date( Date.UTC( e.getFullYear(), e.getMonth(), e.getDate(), e.getHours(), e.getMinutes(), e.getSeconds(), e.getMilliseconds() ) ); return n.setUTCFullYear(e.getFullYear()), +t - +n; } function ln(t, e) { const n = Ye(t), a = Ye(e), r = +n - We(n), i = +a - We(a); return Math.round((r - i) / sn); } function un(t) { const e = ot(t), n = ne(t, 0); return n.setFullYear(e, 0, 4), n.setHours(0, 0, 0, 0), xe(n); } function cn(t) { return t instanceof Date || typeof t == "object" && Object.prototype.toString.call(t) === "[object Date]"; } function lt(t) { if (!cn(t) && typeof t != "number") return !1; const e = X(t); return !isNaN(Number(e)); } function dn(t) { const e = X(t), n = ne(t, 0); return n.setFullYear(e.getFullYear(), 0, 1), n.setHours(0, 0, 0, 0), n; } const fn = { 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" } }, pn = (t, e, n) => { let a; const r = fn[t]; return typeof r == "string" ? a = r : e === 1 ? a = r.one : a = r.other.replace("{{count}}", e.toString()), n != null && n.addSuffix ? n.comparison && n.comparison > 0 ? "in " + a : a + " ago" : a; }; function Se(t) { return (e = {}) => { const n = e.width ? String(e.width) : t.defaultWidth; return t.formats[n] || t.formats[t.defaultWidth]; }; } const mn = { full: "EEEE, MMMM do, y", long: "MMMM do, y", medium: "MMM d, y", short: "MM/dd/yyyy" }, hn = { full: "h:mm:ss a zzzz", long: "h:mm:ss a z", medium: "h:mm:ss a", short: "h:mm a" }, vn = { full: "{{date}} 'at' {{time}}", long: "{{date}} 'at' {{time}}", medium: "{{date}}, {{time}}", short: "{{date}}, {{time}}" }, gn = { date: Se({ formats: mn, defaultWidth: "full" }), time: Se({ formats: hn, defaultWidth: "full" }), dateTime: Se({ formats: vn, defaultWidth: "full" }) }, wn = { lastWeek: "'last' eeee 'at' p", yesterday: "'yesterday at' p", today: "'today at' p", tomorrow: "'tomorrow at' p", nextWeek: "eeee 'at' p", other: "P" }, yn = (t, e, n, a) => wn[t]; function ce(t) { return (e, n) => { const a = n != null && n.context ? String(n.context) : "standalone"; let r; if (a === "formatting" && t.formattingValues) { const l = t.defaultFormattingWidth || t.defaultWidth, o = n != null && n.width ? String(n.width) : l; r = t.formattingValues[o] || t.formattingValues[l]; } else { const l = t.defaultWidth, o = n != null && n.width ? String(n.width) : t.defaultWidth; r = t.values[o] || t.values[l]; } const i = t.argumentCallback ? t.argumentCallback(e) : e; return r[i]; }; } const bn = { narrow: ["B", "A"], abbreviated: ["BC", "AD"], wide: ["Before Christ", "Anno Domini"] }, xn = { narrow: ["1", "2", "3", "4"], abbreviated: ["Q1", "Q2", "Q3", "Q4"], wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"] }, Dn = { 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" ] }, Mn = { 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" ] }, Tn = { 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" } }, Sn = { 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" } }, kn = (t, e) => { const n = Number(t), a = n % 100; if (a > 20 || a < 10) switch (a % 10) { case 1: return n + "st"; case 2: return n + "nd"; case 3: return n + "rd"; } return n + "th"; }, Pn = { ordinalNumber: kn, era: ce({ values: bn, defaultWidth: "wide" }), quarter: ce({ values: xn, defaultWidth: "wide", argumentCallback: (t) => t - 1 }), month: ce({ values: Dn, defaultWidth: "wide" }), day: ce({ values: Mn, defaultWidth: "wide" }), dayPeriod: ce({ values: Tn, defaultWidth: "wide", formattingValues: Sn, defaultFormattingWidth: "wide" }) }; function de(t) { return (e, n = {}) => { const a = n.width, r = a && t.matchPatterns[a] || t.matchPatterns[t.defaultMatchWidth], i = e.match(r); if (!i) return null; const l = i[0], o = a && t.parsePatterns[a] || t.parsePatterns[t.defaultParseWidth], f = Array.isArray(o) ? Fn(o, (m) => m.test(l)) : ( // eslint-disable-next-line @typescript-eslint/no-explicit-any -- I challange you to fix the type Cn(o, (m) => m.test(l)) ); let u; u = t.valueCallback ? t.valueCallback(f) : f, u = n.valueCallback ? ( // eslint-disable-next-line @typescript-eslint/no-explicit-any -- I challange you to fix the type n.valueCallback(u) ) : u; const d = e.slice(l.length); return { value: u, rest: d }; }; } function Cn(t, e) { for (const n in t) if (Object.prototype.hasOwnProperty.call(t, n) && e(t[n])) return n; } function Fn(t, e) { for (let n = 0; n < t.length; n++) if (e(t[n])) return n; } function On(t) { return (e, n = {}) => { const a = e.match(t.matchPattern); if (!a) return null; const r = a[0], i = e.match(t.parsePattern); if (!i) return null; let l = t.valueCallback ? t.valueCallback(i[0]) : i[0]; l = n.valueCallback ? n.valueCallback(l) : l; const o = e.slice(r.length); return { value: l, rest: o }; }; } const En = /^(\d+)(th|st|nd|rd)?/i, Nn = /\d+/i, An = { 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 }, Hn = { any: [/^b/i, /^(a|c)/i] }, Bn = { narrow: /^[1234]/i, abbreviated: /^q[1234]/i, wide: /^[1234](th|st|nd|rd)? quarter/i }, _n = { any: [/1/i, /2/i, /3/i, /4/i] }, Rn = { 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 }, Yn = { 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 ] }, Wn = { 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 }, jn = { 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] }, qn = { 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 }, $n = { 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 } }, Un = { ordinalNumber: On({ matchPattern: En, parsePattern: Nn, valueCallback: (t) => parseInt(t, 10) }), era: de({ matchPatterns: An, defaultMatchWidth: "wide", parsePatterns: Hn, defaultParseWidth: "any" }), quarter: de({ matchPatterns: Bn, defaultMatchWidth: "wide", parsePatterns: _n, defaultParseWidth: "any", valueCallback: (t) => t + 1 }), month: de({ matchPatterns: Rn, defaultMatchWidth: "wide", parsePatterns: Yn, defaultParseWidth: "any" }), day: de({ matchPatterns: Wn, defaultMatchWidth: "wide", parsePatterns: jn, defaultParseWidth: "any" }), dayPeriod: de({ matchPatterns: qn, defaultMatchWidth: "any", parsePatterns: $n, defaultParseWidth: "any" }) }, Ln = { code: "en-US", formatDistance: pn, formatLong: gn, formatRelative: yn, localize: Pn, match: Un, options: { weekStartsOn: 0, firstWeekContainsDate: 1 } }; function zn(t) { const e = X(t); return ln(e, dn(e)) + 1; } function Qn(t) { const e = X(t), n = +xe(e) - +un(e); return Math.round(n / rt) + 1; } function ut(t, e) { var d, m, h, x; const n = X(t), a = n.getFullYear(), r = Me(), i = (e == null ? void 0 : e.firstWeekContainsDate) ?? ((m = (d = e == null ? void 0 : e.locale) == null ? void 0 : d.options) == null ? void 0 : m.firstWeekContainsDate) ?? r.firstWeekContainsDate ?? ((x = (h = r.locale) == null ? void 0 : h.options) == null ? void 0 : x.firstWeekContainsDate) ?? 1, l = ne(t, 0); l.setFullYear(a + 1, 0, i), l.setHours(0, 0, 0, 0); const o = pe(l, e), f = ne(t, 0); f.setFullYear(a, 0, i), f.setHours(0, 0, 0, 0); const u = pe(f, e); return n.getTime() >= o.getTime() ? a + 1 : n.getTime() >= u.getTime() ? a : a - 1; } function Vn(t, e) { var o, f, u, d; const n = Me(), a = (e == null ? void 0 : e.firstWeekContainsDate) ?? ((f = (o = e == null ? void 0 : e.locale) == null ? void 0 : o.options) == null ? void 0 : f.firstWeekContainsDate) ?? n.firstWeekContainsDate ?? ((d = (u = n.locale) == null ? void 0 : u.options) == null ? void 0 : d.firstWeekContainsDate) ?? 1, r = ut(t, e), i = ne(t, 0); return i.setFullYear(r, 0, a), i.setHours(0, 0, 0, 0), pe(i, e); } function Xn(t, e) { const n = X(t), a = +pe(n, e) - +Vn(n, e); return Math.round(a / rt) + 1; } function C(t, e) { const n = t < 0 ? "-" : "", a = Math.abs(t).toString().padStart(e, "0"); return n + a; } const Z = { // Year y(t, e) { const n = t.getFullYear(), a = n > 0 ? n : 1 - n; return C(e === "yy" ? a % 100 : a, e.length); }, // Month M(t, e) { const n = t.getMonth(); return e === "M" ? String(n + 1) : C(n + 1, 2); }, // Day of the month d(t, e) { return C(t.getDate(), e.length); }, // AM or PM a(t, e) { const n = t.getHours() / 12 >= 1 ? "pm" : "am"; switch (e) { case "a": case "aa": return n.toUpperCase(); case "aaa": return n; case "aaaaa": return n[0]; case "aaaa": default: return n === "am" ? "a.m." : "p.m."; } }, // Hour [1-12] h(t, e) { return C(t.getHours() % 12 || 12, e.length); }, // Hour [0-23] H(t, e) { return C(t.getHours(), e.length); }, // Minute m(t, e) { return C(t.getMinutes(), e.length); }, // Second s(t, e) { return C(t.getSeconds(), e.length); }, // Fraction of second S(t, e) { const n = e.length, a = t.getMilliseconds(), r = Math.trunc( a * Math.pow(10, n - 3) ); return C(r, e.length); } }, se = { am: "am", pm: "pm", midnight: "midnight", noon: "noon", morning: "morning", afternoon: "afternoon", evening: "evening", night: "night" }, je = { // Era G: function(t, e, n) { const a = t.getFullYear() > 0 ? 1 : 0; switch (e) { case "G": case "GG": case "GGG": return n.era(a, { width: "abbreviated" }); case "GGGGG": return n.era(a, { width: "narrow" }); case "GGGG": default: return n.era(a, { width: "wide" }); } }, // Year y: function(t, e, n) { if (e === "yo") { const a = t.getFullYear(), r = a > 0 ? a : 1 - a; return n.ordinalNumber(r, { unit: "year" }); } return Z.y(t, e); }, // Local week-numbering year Y: function(t, e, n, a) { const r = ut(t, a), i = r > 0 ? r : 1 - r; if (e === "YY") { const l = i % 100; return C(l, 2); } return e === "Yo" ? n.ordinalNumber(i, { unit: "year" }) : C(i, e.length); }, // ISO week-numbering year R: function(t, e) { const n = ot(t); return C(n, e.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, e) { const n = t.getFullYear(); return C(n, e.length); }, // Quarter Q: function(t, e, n) { const a = Math.ceil((t.getMonth() + 1) / 3); switch (e) { case "Q": return String(a); case "QQ": return C(a, 2); case "Qo": return n.ordinalNumber(a, { unit: "quarter" }); case "QQQ": return n.quarter(a, { width: "abbreviated", context: "formatting" }); case "QQQQQ": return n.quarter(a, { width: "narrow", context: "formatting" }); case "QQQQ": default: return n.quarter(a, { width: "wide", context: "formatting" }); } }, // Stand-alone quarter q: function(t, e, n) { const a = Math.ceil((t.getMonth() + 1) / 3); switch (e) { case "q": return String(a); case "qq": return C(a, 2); case "qo": return n.ordinalNumber(a, { unit: "quarter" }); case "qqq": return n.quarter(a, { width: "abbreviated", context: "standalone" }); case "qqqqq": return n.quarter(a, { width: "narrow", context: "standalone" }); case "qqqq": default: return n.quarter(a, { width: "wide", context: "standalone" }); } }, // Month M: function(t, e, n) { const a = t.getMonth(); switch (e) { case "M": case "MM": return Z.M(t, e); case "Mo": return n.ordinalNumber(a + 1, { unit: "month" }); case "MMM": return n.month(a, { width: "abbreviated", context: "formatting" }); case "MMMMM": return n.month(a, { width: "narrow", context: "formatting" }); case "MMMM": default: return n.month(a, { width: "wide", context: "formatting" }); } }, // Stand-alone month L: function(t, e, n) { const a = t.getMonth(); switch (e) { case "L": return String(a + 1); case "LL": return C(a + 1, 2); case "Lo": return n.ordinalNumber(a + 1, { unit: "month" }); case "LLL": return n.month(a, { width: "abbreviated", context: "standalone" }); case "LLLLL": return n.month(a, { width: "narrow", context: "standalone" }); case "LLLL": default: return n.month(a, { width: "wide", context: "standalone" }); } }, // Local week of year w: function(t, e, n, a) { const r = Xn(t, a); return e === "wo" ? n.ordinalNumber(r, { unit: "week" }) : C(r, e.length); }, // ISO week of year I: function(t, e, n) { const a = Qn(t); return e === "Io" ? n.ordinalNumber(a, { unit: "week" }) : C(a, e.length); }, // Day of the month d: function(t, e, n) { return e === "do" ? n.ordinalNumber(t.getDate(), { unit: "date" }) : Z.d(t, e); }, // Day of year D: function(t, e, n) { const a = zn(t); return e === "Do" ? n.ordinalNumber(a, { unit: "dayOfYear" }) : C(a, e.length); }, // Day of week E: function(t, e, n) { const a = t.getDay(); switch (e) { case "E": case "EE": case "EEE": return n.day(a, { width: "abbreviated", context: "formatting" }); case "EEEEE": return n.day(a, { width: "narrow", context: "formatting" }); case "EEEEEE": return n.day(a, { width: "short", context: "formatting" }); case "EEEE": default: return n.day(a, { width: "wide", context: "formatting" }); } }, // Local day of week e: function(t, e, n, a) { const r = t.getDay(), i = (r - a.weekStartsOn + 8) % 7 || 7; switch (e) { case "e": return String(i); case "ee": return C(i, 2); case "eo": return n.ordinalNumber(i, { unit: "day" }); case "eee": return n.day(r, { width: "abbreviated", context: "formatting" }); case "eeeee": return n.day(r, { width: "narrow", context: "formatting" }); case "eeeeee": return n.day(r, { width: "short", context: "formatting" }); case "eeee": default: return n.day(r, { width: "wide", context: "formatting" }); } }, // Stand-alone local day of week c: function(t, e, n, a) { const r = t.getDay(), i = (r - a.weekStartsOn + 8) % 7 || 7; switch (e) { case "c": return String(i); case "cc": return C(i, e.length); case "co": return n.ordinalNumber(i, { unit: "day" }); case "ccc": return n.day(r, { width: "abbreviated", context: "standalone" }); case "ccccc": return n.day(r, { width: "narrow", context: "standalone" }); case "cccccc": return n.day(r, { width: "short", context: "standalone" }); case "cccc": default: return n.day(r, { width: "wide", context: "standalone" }); } }, // ISO day of week i: function(t, e, n) { const a = t.getDay(), r = a === 0 ? 7 : a; switch (e) { case "i": return String(r); case "ii": return C(r, e.length); case "io": return n.ordinalNumber(r, { unit: "day" }); case "iii": return n.day(a, { width: "abbreviated", context: "formatting" }); case "iiiii": return n.day(a, { width: "narrow", context: "formatting" }); case "iiiiii": return n.day(a, { width: "short", context: "formatting" }); case "iiii": default: return n.day(a, { width: "wide", context: "formatting" }); } }, // AM or PM a: function(t, e, n) { const r = t.getHours() / 12 >= 1 ? "pm" : "am"; switch (e) { case "a": case "aa": return n.dayPeriod(r, { width: "abbreviated", context: "formatting" }); case "aaa": return n.dayPeriod(r, { width: "abbreviated", context: "formatting" }).toLowerCase(); case "aaaaa": return n.dayPeriod(r, { width: "narrow", context: "formatting" }); case "aaaa": default: return n.dayPeriod(r, { width: "wide", context: "formatting" }); } }, // AM, PM, midnight, noon b: function(t, e, n) { const a = t.getHours(); let r; switch (a === 12 ? r = se.noon : a === 0 ? r = se.midnight : r = a / 12 >= 1 ? "pm" : "am", e) { case "b": case "bb": return n.dayPeriod(r, { width: "abbreviated", context: "formatting" }); case "bbb": return n.dayPeriod(r, { width: "abbreviated", context: "formatting" }).toLowerCase(); case "bbbbb": return n.dayPeriod(r, { width: "narrow", context: "formatting" }); case "bbbb": default: return n.dayPeriod(r, { width: "wide", context: "formatting" }); } }, // in the morning, in the afternoon, in the evening, at night B: function(t, e, n) { const a = t.getHours(); let r; switch (a >= 17 ? r = se.evening : a >= 12 ? r = se.afternoon : a >= 4 ? r = se.morning : r = se.night, e) { case "B": case "BB": case "BBB": return n.dayPeriod(r, { width: "abbreviated", context: "formatting" }); case "BBBBB": return n.dayPeriod(r, { width: "narrow", context: "formatting" }); case "BBBB": default: return n.dayPeriod(r, { width: "wide", context: "formatting" }); } }, // Hour [1-12] h: function(t, e, n) { if (e === "ho") { let a = t.getHours() % 12; return a === 0 && (a = 12), n.ordinalNumber(a, { unit: "hour" }); } return Z.h(t, e); }, // Hour [0-23] H: function(t, e, n) { return e === "Ho" ? n.ordinalNumber(t.getHours(), { unit: "hour" }) : Z.H(t, e); }, // Hour [0-11] K: function(t, e, n) { const a = t.getHours() % 12; return e === "Ko" ? n.ordinalNumber(a, { unit: "hour" }) : C(a, e.length); }, // Hour [1-24] k: function(t, e, n) { let a = t.getHours(); return a === 0 && (a = 24), e === "ko" ? n.ordinalNumber(a, { unit: "hour" }) : C(a, e.length); }, // Minute m: function(t, e, n) { return e === "mo" ? n.ordinalNumber(t.getMinutes(), { unit: "minute" }) : Z.m(t, e); }, // Second s: function(t, e, n) { return e === "so" ? n.ordinalNumber(t.getSeconds(), { unit: "second" }) : Z.s(t, e); }, // Fraction of second S: function(t, e) { return Z.S(t, e); }, // Timezone (ISO-8601. If offset is 0, output is always `'Z'`) X: function(t, e, n) { const a = t.getTimezoneOffset(); if (a === 0) return "Z"; switch (e) { case "X": return $e(a); case "XXXX": case "XX": return ee(a); case "XXXXX": case "XXX": default: return ee(a, ":"); } }, // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent) x: function(t, e, n) { const a = t.getTimezoneOffset(); switch (e) { case "x": return $e(a); case "xxxx": case "xx": return ee(a); case "xxxxx": case "xxx": default: return ee(a, ":"); } }, // Timezone (GMT) O: function(t, e, n) { const a = t.getTimezoneOffset(); switch (e) { case "O": case "OO": case "OOO": return "GMT" + qe(a, ":"); case "OOOO": default: return "GMT" + ee(a, ":"); } }, // Timezone (specific non-location) z: function(t, e, n) { const a = t.getTimezoneOffset(); switch (e) { case "z": case "zz": case "zzz": return "GMT" + qe(a, ":"); case "zzzz": default: return "GMT" + ee(a, ":"); } }, // Seconds timestamp t: function(t, e, n) { const a = Math.trunc(t.getTime() / 1e3); return C(a, e.length); }, // Milliseconds timestamp T: function(t, e, n) { const a = t.getTime(); return C(a, e.length); } }; function qe(t, e = "") { const n = t > 0 ? "-" : "+", a = Math.abs(t), r = Math.trunc(a / 60), i = a % 60; return i === 0 ? n + String(r) : n + String(r) + e + C(i, 2); } function $e(t, e) { return t % 60 === 0 ? (t > 0 ? "-" : "+") + C(Math.abs(t) / 60, 2) : ee(t, e); } function ee(t, e = "") { const n = t > 0 ? "-" : "+", a = Math.abs(t), r = C(Math.trunc(a / 60), 2), i = C(a % 60, 2); return n + r + e + i; } const Ue = (t, e) => { switch (t) { case "P": return e.date({ width: "short" }); case "PP": return e.date({ width: "medium" }); case "PPP": return e.date({ width: "long" }); case "PPPP": default: return e.date({ width: "full" }); } }, ct = (t, e) => { switch (t) { case "p": return e.time({ width: "short" }); case "pp": return e.time({ width: "medium" }); case "ppp": return e.time({ width: "long" }); case "pppp": default: return e.time({ width: "full" }); } }, Gn = (t, e) => { const n = t.match(/(P+)(p+)?/) || [], a = n[1], r = n[2]; if (!r) return Ue(t, e); let i; switch (a) { case "P": i = e.dateTime({ width: "short" }); break; case "PP": i = e.dateTime({ width: "medium" }); break; case "PPP": i = e.dateTime({ width: "long" }); break; case "PPPP": default: i = e.dateTime({ width: "full" }); break; } return i.replace("{{date}}", Ue(a, e)).replace("{{time}}