@farris/ui-vue
Version:
Farris Vue, a Farris Design based Vue3 component library.
1,741 lines • 518 kB
JavaScript
var Ri = Object.defineProperty;
var Bi = (e, n, t) => n in e ? Ri(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t;
var L = (e, n, t) => Bi(e, typeof n != "symbol" ? n + "" : n, t);
import { ref as _, computed as V, watch as Oe, defineComponent as Xe, onBeforeUnmount as co, withDirectives as sr, createVNode as k, resolveDirective as Di, createTextVNode as pt, mergeProps as jt, Fragment as $t, reactive as Rt, createApp as fo, onUnmounted as vn, onMounted as Tt, Transition as lr, nextTick as Jt, inject as Ot, provide as Ni, triggerRef as Vi, isVNode as Li, onBeforeMount as Ai, Teleport as ur, shallowRef as ji, render as An, h as $i, cloneVNode as Hi, vShow as Wi } from "vue";
import { createPropsResolver as po, getSchemaByType as Mo, resolveAppearance as qi } from "../dynamic-resolver/index.esm.js";
import { isPlainObject as Io, cloneDeep as Pe, isUndefined as St, throttle as Ui } from "lodash-es";
import zi, { FDynamicFormGroup as Gi, FDynamicFormInput as Yi } from "../dynamic-form/index.esm.js";
import { resolveField as ft, FormSchemaEntityFieldTypeName as Po, useGuid as Xn, useCommonUtils as Qi, useDateFormat as Xi, useNumberFormat as Ki, setFieldValue as Kn, getCustomClass as jn, withInstall as Ji, FormSchemaEntityField$Type as Zi } from "../common/index.esm.js";
import { DgControl as Ro, useDesignerComponent as ea } from "../designer-canvas/index.esm.js";
import { InputBaseProperty as ta, FPropertyPanel as na } from "../property-panel/index.esm.js";
import oa from "../accordion/index.esm.js";
import ra from "../avatar/index.esm.js";
import ia from "../../designer/button-edit/index.esm.js";
import aa from "../button-group/index.esm.js";
import sa from "../calendar/index.esm.js";
import la from "../capsule/index.esm.js";
import Bo from "../../designer/checkbox/index.esm.js";
import Do from "../../designer/checkbox-group/index.esm.js";
import Jn from "../combo-list/index.esm.js";
import ua from "../combo-tree/index.esm.js";
import ca from "../component/index.esm.js";
import da from "../color-picker/index.esm.js";
import fa from "../content-container/index.esm.js";
import pa, { DATE_FORMATS as ma } from "../date-picker/index.esm.js";
import ha from "../../designer/data-grid/index.esm.js";
import va from "../dropdown/index.esm.js";
import ga from "../events-editor/index.esm.js";
import ya from "../filter-bar/index.esm.js";
import ba, { FieldSelectorRepositoryToken as $n } from "../field-selector/index.esm.js";
import wa from "../binding-selector/index.esm.js";
import Ca from "../image-cropper/index.esm.js";
import xa from "../../designer/input-group/index.esm.js";
import Sa from "../layout/index.esm.js";
import Ta from "../list-nav/index.esm.js";
import _a from "../list-view/index.esm.js";
import Fa, { LookupSchemaRepositoryToken as Ea } from "../lookup/index.esm.js";
import ka from "../mapping-editor/index.esm.js";
import Oa from "../nav/index.esm.js";
import Ma from "../number-range/index.esm.js";
import Ia from "../number-spinner/index.esm.js";
import Pa from "../order/index.esm.js";
import Ra from "../page-header/index.esm.js";
import Ba from "../page-footer/index.esm.js";
import Da from "../pagination/index.esm.js";
import Na from "../progress/index.esm.js";
import Va from "../query-solution/index.esm.js";
import La from "../../designer/radio-group/index.esm.js";
import Aa from "../rate/index.esm.js";
import ja from "../response-toolbar/index.esm.js";
import $a from "../response-layout/index.esm.js";
import Ha from "../response-layout-editor/index.esm.js";
import Wa from "../search-box/index.esm.js";
import qa from "../section/index.esm.js";
import Ua from "../smoke-detector/index.esm.js";
import za from "../splitter/index.esm.js";
import Ga from "../step/index.esm.js";
import Ya from "../switch/index.esm.js";
import Qa from "../tabs/index.esm.js";
import cr from "../tags/index.esm.js";
import Xa from "../text/index.esm.js";
import Ka from "../time-picker/index.esm.js";
import dr, { FTransfer as fr } from "../transfer/index.esm.js";
import Ja from "../tree-view/index.esm.js";
import Za from "../uploader/index.esm.js";
import es from "../verify-detail/index.esm.js";
import ts from "../video/index.esm.js";
import ns from "../textarea/index.esm.js";
import os from "../schema-selector/index.esm.js";
import rs from "../tree-grid/index.esm.js";
import is from "../event-parameter/index.esm.js";
import as from "../filter-condition-editor/index.esm.js";
import ss from "../fieldset/index.esm.js";
import ls from "../sort-condition-editor/index.esm.js";
import us from "../menu-lookup/index.esm.js";
import cs from "../drawer/index.esm.js";
import ds from "../json-editor/index.esm.js";
import fs from "../property-editor/index.esm.js";
import ps from "../expression-editor/index.esm.js";
import ms from "../code-editor/index.esm.js";
import hs from "../html-template/index.esm.js";
import "../external-container/index.esm.js";
import { useResizeObserver as pr } from "@vueuse/core";
import { useIdentify as vs, useGroupData as gs, useFilter as ys, useHierarchy as bs, useLoading as ws, useDataView as Cs, useSelection as xs, useSelectHierarchyItem as Ss, useDataViewContainerStyle as Ts, useCommandColumn as _s, useColumn as Fs, useSort as Es, useGroupColumn as ks, useRow as Os, useEdit as Ms, useVisualDataBound as Is, useVisualDataCell as Ps, useVisualDataRow as Rs, useVisualData as Bs, useCellPosition as Ds, useSidebar as Ns, useVirtualScroll as Vs, useFitColumn as Ls, useFilterHistory as As, useColumnFilter as js, useDragColumn as $s, getColumnHeader as Hs, getSidebar as Ws, getDisableMask as qs, getHorizontalScrollbar as Us, getVerticalScrollbar as zs, getEmpty as Gs } from "../data-view/index.esm.js";
import { F_MODAL_SERVICE_TOKEN as Ys } from "../modal/index.esm.js";
import { useConditionValue as Qs, FConditionFields as No, FConditionList as Xs } from "../condition/index.esm.js";
import { FCheckbox as Ks } from "../checkbox/index.esm.js";
import Vo, { FTooltip as Js } from "../tooltip/index.esm.js";
import Zs from "../button/index.esm.js";
import { FNotifyService as mr } from "../notify/index.esm.js";
import { FInputGroup as el } from "../input-group/index.esm.js";
import hr from "../radio-group/index.esm.js";
import { FDataGrid as tl } from "../data-grid/index.esm.js";
import { FCheckboxGroup as nl } from "../checkbox-group/index.esm.js";
import ol from "../condition/index.esm.js/src/condition-fields.design.component";
import rl from "../popover/index.esm.js";
import { FButtonEdit as il } from "../button-edit/index.esm.js";
const vr = {}, gr = {};
function mo(e) {
const { properties: n, title: t, ignore: o } = e, r = o && Array.isArray(o), i = Object.keys(n).reduce((a, l) => ((!r || !o.find((c) => c === l)) && (a[l] = n[l].type === "object" && n[l].properties ? mo(n[l]) : Pe(n[l].default)), a), {});
if (t && (!r || !o.find((a) => a === "id"))) {
const a = t.toLowerCase().replace(/-/g, "_");
i.id = `${a}_${Math.random().toString().slice(2, 6)}`;
}
return i;
}
function al(e) {
const { properties: n, title: t, required: o } = e;
if (o && Array.isArray(o)) {
const r = o.reduce((i, a) => (i[a] = n[a].type === "object" && n[a].properties ? mo(n[a]) : Pe(n[a].default), i), {});
if (t && o.find((i) => i === "id")) {
const i = t.toLowerCase().replace(/-/g, "_");
r.id = `${i}_${Math.random().toString().slice(2, 6)}`;
}
return r;
}
return {
type: t
};
}
function yr(e, n = {}, t) {
const o = vr[e];
if (o) {
let r = al(o);
const i = gr[e];
return r = i ? i({ getSchemaByType: yr }, r, n, t) : r, r;
}
return null;
}
function sl(e, n) {
const t = mo(n);
return Object.keys(t).reduce((o, r) => (Object.prototype.hasOwnProperty.call(e, r) && (o[r] && Io(o[r]) && Io(e[r] || !e[r]) ? Object.assign(o[r], e[r] || {}) : o[r] = e[r]), o), t), t;
}
function br(e, n) {
return Object.keys(e).filter((o) => e[o] != null).reduce((o, r) => {
if (n.has(r)) {
const i = n.get(r);
if (typeof i == "string")
o[i] = e[r];
else {
const a = i(r, e[r], e);
Object.assign(o, a);
}
} else
o[r] = e[r];
return o;
}, {});
}
function ll(e, n, t = /* @__PURE__ */ new Map()) {
const o = sl(e, n);
return br(o, t);
}
function ul(e = {}) {
function n(u, d, s, m) {
if (typeof s == "number")
return m[u].length === s;
if (typeof s == "object") {
const p = Object.keys(s)[0], f = s[p];
if (p === "not")
return Number(m[u].length) !== Number(f);
if (p === "moreThan")
return Number(m[u].length) >= Number(f);
if (p === "lessThan")
return Number(m[u].length) <= Number(f);
}
return !1;
}
function t(u, d, s, m) {
return m[u] && m[u].propertyValue && String(m[u].propertyValue.value) === String(s);
}
const o = /* @__PURE__ */ new Map([
["length", n],
["getProperty", t]
]);
Object.keys(e).reduce((u, d) => (u.set(d, e[d]), u), o);
function r(u, d) {
const s = u;
return typeof d == "number" ? [{ target: s, operator: "length", param: null, value: Number(d) }] : typeof d == "boolean" ? [{ target: s, operator: "getProperty", param: u, value: !!d }] : typeof d == "object" ? Object.keys(d).map((m) => {
if (m === "length")
return { target: s, operator: "length", param: null, value: d[m] };
const p = m, f = d[m];
return { target: s, operator: "getProperty", param: p, value: f };
}) : [];
}
function i(u) {
return Object.keys(u).reduce((s, m) => {
const p = r(m, u[m]);
return s.push(...p), s;
}, []);
}
function a(u, d) {
if (o.has(u.operator)) {
const s = o.get(u.operator);
return s && s(u.target, u.param, u.value, d) || !1;
}
return !1;
}
function l(u, d) {
return i(u).reduce((p, f) => p && a(f, d), !0);
}
function c(u, d) {
const s = Object.keys(u), m = s.includes("allOf"), p = s.includes("anyOf"), f = m || p, v = (f ? u[f ? m ? "allOf" : "anyOf" : "allOf"] : [u]).map((b) => l(b, d));
return m ? !v.includes(!1) : v.includes(!0);
}
return { parseValueSchema: c };
}
const me = {
button: { type: "button", name: "按钮" },
"response-toolbar": { type: "response-toolbar", name: "工具栏" },
"response-toolbar-item": { type: "response-toolbar-item", name: "按钮" },
"content-container": { type: "content-container", name: "容器" },
"input-group": { type: "input-group", name: "文本" },
textarea: { type: "textarea", name: "多行文本" },
lookup: { type: "lookup", name: "帮助" },
"number-spinner": { type: "number-spinner", name: "数值" },
"date-picker": { type: "date-picker", name: "日期" },
switch: { type: "switch", name: "开关" },
"radio-group": { type: "radio-group", name: "单选组" },
"check-box": { type: "check-box", name: "复选框" },
"check-group": { type: "check-group", name: "复选框组" },
"combo-list": { type: "combo-list", name: "下拉列表" },
"response-form": { type: "response-form", name: "卡片面板" },
"response-layout": { type: "response-layout", name: "布局容器", icon: "response-layout-3" },
"response-layout-item": { type: "response-layout-item", name: "布局", icon: "response-layout-1" },
"tree-grid": { type: "tree-grid", name: "树表格" },
"tree-grid-column": { type: "tree-grid-column", name: "树表格列" },
"data-grid": { type: "data-grid", name: "表格" },
"data-grid-column": { type: "data-grid-column", name: "表格列" },
module: { type: "Module", name: "模块" },
component: { type: "component", name: "组件" },
tabs: { type: "tabs", name: "标签页" },
"tab-page": { type: "tab-page", name: "标签页项", dependentParentControl: "Tab" },
"tab-toolbar-item": { type: "tab-toolbar-item", name: "标签页工具栏按钮" },
"html-template": { type: "html-template", name: "模板容器" },
"time-picker": { type: "time-picker", name: "时间选择" },
section: { type: "section", name: "分组面板" },
"section-toolbar": { type: "section-toolbar", name: "分组面板工具栏" },
"section-toolbar-item": { type: "section-toolbar-item", name: "分组面板按钮" },
splitter: { type: "splitter", name: "分栏面板" },
"splitter-pane": { type: "splitter-pane", name: "分栏面板项", dependentParentControl: "Splitter" },
"component-ref": { type: "component-ref", name: "组件引用节点" },
uploader: { type: "uploader", name: "附件上传" },
"page-header": { type: "page-header", name: "页头" },
"page-footer": { type: "page-footer", name: "页脚" },
"tab-toolbar": { type: "tab-toolbar", name: "标签页工具栏" },
fieldset: { type: "fieldset", name: "分组" },
"query-solution": { type: "query-solution", name: "筛选方案" },
drawer: { type: "drawer", name: "抽屉" },
"external-container": { type: "external-container", name: "外部容器", icon: "content-container" },
"list-nav": { type: "list-nav", name: "列表导航" },
"filter-bar": { type: "filter-bar", name: "筛选条" }
}, cl = {}, dl = {};
ul();
function tn(e, n, t = /* @__PURE__ */ new Map(), o = (a, l, c, u) => l, r = {}, i = (a) => a) {
return vr[n.title] = n, gr[n.title] = o, cl[n.title] = r, dl[n.title] = i, (a = {}, l = !0) => {
if (!l)
return br(a, t);
const c = ll(a, n, t), u = Object.keys(e).reduce((d, s) => (d[s] = e[s].default, d), {});
return Object.assign(u, c);
};
}
function gn(e, n) {
return { customClass: n.class, customStyle: n.style };
}
function fl() {
function e(n, t) {
const { dataSource: o } = n || {};
return o === void 0 ? {} : {};
}
return {
resolve: e
};
}
function pl() {
function e(n, t) {
return n.selectItemById(t);
}
return {
selectItemById: e
};
}
function ml() {
function e(n, t) {
const { columns: o } = t;
return n.updateColumns(o);
}
return {
updateColumns: e
};
}
var bt = /* @__PURE__ */ ((e) => (e.Equal = "0", e.NotEqual = "1", e.Greater = "2", e.GreaterOrEqual = "3", e.Less = "4", e.LessOrEqual = "5", e.Like = "6", e.LikeStartWith = "7", e.LikeEndWith = "8", e.In = "9", e.NotIn = "10", e))(bt || {});
const hl = [
{
value: "0",
name: "等于"
},
{
value: "1",
name: "不等于"
},
{
value: "2",
name: "大于"
},
{
value: "3",
name: "大于等于"
},
{
value: "4",
name: "小于"
},
{
value: "5",
name: "小于等于"
},
{
value: "6",
name: "包含"
},
{
value: "7",
name: "开始是"
},
{
value: "8",
name: "结束是"
}
], vl = {
"button-edit": ["0", "1", " 6", "7", "8"],
"check-box": ["0"],
"combo-list": ["0", "1"],
"combo-lookup": ["0", "1", " 6", "7", "8"],
"date-picker": ["0", "1", "2", "3", "4", "5"],
"date-range": [],
"datetime-picker": ["0", "1", "2", "3", "4", "5"],
"datetime-range": [],
"month-picker": ["0", "1", "2", "3", "4", "5"],
"month-range": [],
"year-picker": ["0", "1", "2", "3", "4", "5"],
"year-range": [],
"input-group": ["0", "1", "6", "7", "8"],
lookup: ["0", "1"],
"number-range": [],
"number-spinner": ["0", " 1", "2", "3", "4", "5"],
"radio-group": ["0"],
text: ["0", "1", " 6", "7", "8"]
};
function gl(e, n, t) {
const { fieldMap: o } = t;
function r(i) {
const a = o.get(i.fieldCode);
if (!a)
return [];
const l = a.editor.type, c = new Set(vl[l]);
return hl.filter((d) => c.has(d.value));
}
return { getCompareOperators: r };
}
const wr = {
conditions: { type: Array, default: [] },
fields: { type: Array, default: [] },
key: { type: String, default: "" },
/**
* 控间标签同行展示
*/
isControlInline: { type: Boolean, default: !0 }
};
class Cr {
constructor(n = { value: [] }) {
L(this, "editorType", "check-box");
L(this, "value");
L(this, "valueType", "boolean");
const o = (Array.isArray(n.value) ? n.value : typeof n.value == "string" ? n.value.split(",") : []).map((r) => JSON.parse(r));
this.value = o;
}
clear() {
this.value = [];
}
setValue(n) {
this.value = n;
}
getValue() {
return this.value;
}
getDisplayText() {
return this.value.map((n) => n ? "是" : "否").join(",");
}
isEmpty() {
return this.value.length === 0;
}
}
class xr {
constructor(n = { textValue: "", value: "", valueField: "" }) {
L(this, "editorType", "combo-lookup");
L(this, "textValue");
L(this, "value");
L(this, "valueField");
L(this, "valueType", "text");
this.textValue = n.textValue, this.value = n.value, this.valueField = n.valueField;
}
clear() {
this.value = "", this.valueField = "", this.textValue = "";
}
getPropValue(n, t) {
if (t.length > 1) {
const o = t.shift();
return n[o] ? this.getPropValue(n[o], t) : null;
}
return n[t[0]];
}
getTextValue(n) {
const t = n.split("."), o = this.value.split(",").map((r) => this.getPropValue(r, Pe(t)));
return o && o.length ? o.join(",") : "";
}
getValue() {
const n = this.valueField.split("."), t = this.value.split(",").map((o) => this.getPropValue(o, Pe(n)));
return t && t.length ? t.join(",") : "";
}
getDisplayText() {
return this.getValue();
}
setValue(n) {
throw new Error("Method not implemented.");
}
isEmpty() {
return !this.valueField;
}
}
function Ze(e) {
const n = Object.prototype.toString.call(e);
return e instanceof Date || typeof e == "object" && n === "[object Date]" ? new e.constructor(+e) : typeof e == "number" || n === "[object Number]" || typeof e == "string" || n === "[object String]" ? new Date(e) : /* @__PURE__ */ new Date(NaN);
}
function Ue(e, n) {
return e instanceof Date ? new e.constructor(n) : new Date(n);
}
function Sr(e, n) {
const t = Ze(e);
return isNaN(n) ? Ue(e, NaN) : (n && t.setDate(t.getDate() + n), t);
}
const Tr = 6048e5, yl = 864e5, bl = 6e4, wl = 36e5, Cl = 1e3;
let xl = {};
function sn() {
return xl;
}
function Ht(e, n) {
var l, c, u, d;
const t = sn(), o = (n == null ? void 0 : n.weekStartsOn) ?? ((c = (l = n == null ? void 0 : n.locale) == null ? void 0 : l.options) == null ? void 0 : c.weekStartsOn) ?? t.weekStartsOn ?? ((d = (u = t.locale) == null ? void 0 : u.options) == null ? void 0 : d.weekStartsOn) ?? 0, r = Ze(e), i = r.getDay(), a = (i < o ? 7 : 0) + i - o;
return r.setDate(r.getDate() - a), r.setHours(0, 0, 0, 0), r;
}
function an(e) {
return Ht(e, { weekStartsOn: 1 });
}
function _r(e) {
const n = Ze(e), t = n.getFullYear(), o = Ue(e, 0);
o.setFullYear(t + 1, 0, 4), o.setHours(0, 0, 0, 0);
const r = an(o), i = Ue(e, 0);
i.setFullYear(t, 0, 4), i.setHours(0, 0, 0, 0);
const a = an(i);
return n.getTime() >= r.getTime() ? t + 1 : n.getTime() >= a.getTime() ? t : t - 1;
}
function Lo(e) {
const n = Ze(e);
return n.setHours(0, 0, 0, 0), n;
}
function Fn(e) {
const n = Ze(e), t = new Date(
Date.UTC(
n.getFullYear(),
n.getMonth(),
n.getDate(),
n.getHours(),
n.getMinutes(),
n.getSeconds(),
n.getMilliseconds()
)
);
return t.setUTCFullYear(n.getFullYear()), +e - +t;
}
function Sl(e, n) {
const t = Lo(e), o = Lo(n), r = +t - Fn(t), i = +o - Fn(o);
return Math.round((r - i) / yl);
}
function Tl(e) {
const n = _r(e), t = Ue(e, 0);
return t.setFullYear(n, 0, 4), t.setHours(0, 0, 0, 0), an(t);
}
function _l(e) {
return e instanceof Date || typeof e == "object" && Object.prototype.toString.call(e) === "[object Date]";
}
function Fl(e) {
if (!_l(e) && typeof e != "number")
return !1;
const n = Ze(e);
return !isNaN(Number(n));
}
function El(e) {
const n = Ze(e), t = Ue(e, 0);
return t.setFullYear(n.getFullYear(), 0, 1), t.setHours(0, 0, 0, 0), t;
}
const kl = {
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"
}
}, Ol = (e, n, t) => {
let o;
const r = kl[e];
return typeof r == "string" ? o = r : n === 1 ? o = r.one : o = r.other.replace("{{count}}", n.toString()), t != null && t.addSuffix ? t.comparison && t.comparison > 0 ? "in " + o : o + " ago" : o;
};
function Hn(e) {
return (n = {}) => {
const t = n.width ? String(n.width) : e.defaultWidth;
return e.formats[t] || e.formats[e.defaultWidth];
};
}
const Ml = {
full: "EEEE, MMMM do, y",
long: "MMMM do, y",
medium: "MMM d, y",
short: "MM/dd/yyyy"
}, Il = {
full: "h:mm:ss a zzzz",
long: "h:mm:ss a z",
medium: "h:mm:ss a",
short: "h:mm a"
}, Pl = {
full: "{{date}} 'at' {{time}}",
long: "{{date}} 'at' {{time}}",
medium: "{{date}}, {{time}}",
short: "{{date}}, {{time}}"
}, Rl = {
date: Hn({
formats: Ml,
defaultWidth: "full"
}),
time: Hn({
formats: Il,
defaultWidth: "full"
}),
dateTime: Hn({
formats: Pl,
defaultWidth: "full"
})
}, Bl = {
lastWeek: "'last' eeee 'at' p",
yesterday: "'yesterday at' p",
today: "'today at' p",
tomorrow: "'tomorrow at' p",
nextWeek: "eeee 'at' p",
other: "P"
}, Dl = (e, n, t, o) => Bl[e];
function cn(e) {
return (n, t) => {
const o = t != null && t.context ? String(t.context) : "standalone";
let r;
if (o === "formatting" && e.formattingValues) {
const a = e.defaultFormattingWidth || e.defaultWidth, l = t != null && t.width ? String(t.width) : a;
r = e.formattingValues[l] || e.formattingValues[a];
} else {
const a = e.defaultWidth, l = t != null && t.width ? String(t.width) : e.defaultWidth;
r = e.values[l] || e.values[a];
}
const i = e.argumentCallback ? e.argumentCallback(n) : n;
return r[i];
};
}
const Nl = {
narrow: ["B", "A"],
abbreviated: ["BC", "AD"],
wide: ["Before Christ", "Anno Domini"]
}, Vl = {
narrow: ["1", "2", "3", "4"],
abbreviated: ["Q1", "Q2", "Q3", "Q4"],
wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
}, Ll = {
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"
]
}, Al = {
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"
]
}, jl = {
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"
}
}, $l = {
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"
}
}, Hl = (e, n) => {
const t = Number(e), o = t % 100;
if (o > 20 || o < 10)
switch (o % 10) {
case 1:
return t + "st";
case 2:
return t + "nd";
case 3:
return t + "rd";
}
return t + "th";
}, Wl = {
ordinalNumber: Hl,
era: cn({
values: Nl,
defaultWidth: "wide"
}),
quarter: cn({
values: Vl,
defaultWidth: "wide",
argumentCallback: (e) => e - 1
}),
month: cn({
values: Ll,
defaultWidth: "wide"
}),
day: cn({
values: Al,
defaultWidth: "wide"
}),
dayPeriod: cn({
values: jl,
defaultWidth: "wide",
formattingValues: $l,
defaultFormattingWidth: "wide"
})
};
function dn(e) {
return (n, t = {}) => {
const o = t.width, r = o && e.matchPatterns[o] || e.matchPatterns[e.defaultMatchWidth], i = n.match(r);
if (!i)
return null;
const a = i[0], l = o && e.parsePatterns[o] || e.parsePatterns[e.defaultParseWidth], c = Array.isArray(l) ? Ul(l, (s) => s.test(a)) : (
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- I challange you to fix the type
ql(l, (s) => s.test(a))
);
let u;
u = e.valueCallback ? e.valueCallback(c) : c, u = t.valueCallback ? (
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- I challange you to fix the type
t.valueCallback(u)
) : u;
const d = n.slice(a.length);
return { value: u, rest: d };
};
}
function ql(e, n) {
for (const t in e)
if (Object.prototype.hasOwnProperty.call(e, t) && n(e[t]))
return t;
}
function Ul(e, n) {
for (let t = 0; t < e.length; t++)
if (n(e[t]))
return t;
}
function zl(e) {
return (n, t = {}) => {
const o = n.match(e.matchPattern);
if (!o) return null;
const r = o[0], i = n.match(e.parsePattern);
if (!i) return null;
let a = e.valueCallback ? e.valueCallback(i[0]) : i[0];
a = t.valueCallback ? t.valueCallback(a) : a;
const l = n.slice(r.length);
return { value: a, rest: l };
};
}
const Gl = /^(\d+)(th|st|nd|rd)?/i, Yl = /\d+/i, Ql = {
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
}, Xl = {
any: [/^b/i, /^(a|c)/i]
}, Kl = {
narrow: /^[1234]/i,
abbreviated: /^q[1234]/i,
wide: /^[1234](th|st|nd|rd)? quarter/i
}, Jl = {
any: [/1/i, /2/i, /3/i, /4/i]
}, Zl = {
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
}, eu = {
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
]
}, tu = {
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
}, nu = {
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]
}, ou = {
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
}, ru = {
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
}
}, iu = {
ordinalNumber: zl({
matchPattern: Gl,
parsePattern: Yl,
valueCallback: (e) => parseInt(e, 10)
}),
era: dn({
matchPatterns: Ql,
defaultMatchWidth: "wide",
parsePatterns: Xl,
defaultParseWidth: "any"
}),
quarter: dn({
matchPatterns: Kl,
defaultMatchWidth: "wide",
parsePatterns: Jl,
defaultParseWidth: "any",
valueCallback: (e) => e + 1
}),
month: dn({
matchPatterns: Zl,
defaultMatchWidth: "wide",
parsePatterns: eu,
defaultParseWidth: "any"
}),
day: dn({
matchPatterns: tu,
defaultMatchWidth: "wide",
parsePatterns: nu,
defaultParseWidth: "any"
}),
dayPeriod: dn({
matchPatterns: ou,
defaultMatchWidth: "any",
parsePatterns: ru,
defaultParseWidth: "any"
})
}, Fr = {
code: "en-US",
formatDistance: Ol,
formatLong: Rl,
formatRelative: Dl,
localize: Wl,
match: iu,
options: {
weekStartsOn: 0,
firstWeekContainsDate: 1
}
};
function au(e) {
const n = Ze(e);
return Sl(n, El(n)) + 1;
}
function Er(e) {
const n = Ze(e), t = +an(n) - +Tl(n);
return Math.round(t / Tr) + 1;
}
function ho(e, n) {
var d, s, m, p;
const t = Ze(e), o = t.getFullYear(), r = sn(), i = (n == null ? void 0 : n.firstWeekContainsDate) ?? ((s = (d = n == null ? void 0 : n.locale) == null ? void 0 : d.options) == null ? void 0 : s.firstWeekContainsDate) ?? r.firstWeekContainsDate ?? ((p = (m = r.locale) == null ? void 0 : m.options) == null ? void 0 : p.firstWeekContainsDate) ?? 1, a = Ue(e, 0);
a.setFullYear(o + 1, 0, i), a.setHours(0, 0, 0, 0);
const l = Ht(a, n), c = Ue(e, 0);
c.setFullYear(o, 0, i), c.setHours(0, 0, 0, 0);
const u = Ht(c, n);
return t.getTime() >= l.getTime() ? o + 1 : t.getTime() >= u.getTime() ? o : o - 1;
}
function su(e, n) {
var l, c, u, d;
const t = sn(), o = (n == null ? void 0 : n.firstWeekContainsDate) ?? ((c = (l = n == null ? void 0 : n.locale) == null ? void 0 : l.options) == null ? void 0 : c.firstWeekContainsDate) ?? t.firstWeekContainsDate ?? ((d = (u = t.locale) == null ? void 0 : u.options) == null ? void 0 : d.firstWeekContainsDate) ?? 1, r = ho(e, n), i = Ue(e, 0);
return i.setFullYear(r, 0, o), i.setHours(0, 0, 0, 0), Ht(i, n);
}
function kr(e, n) {
const t = Ze(e), o = +Ht(t, n) - +su(t, n);
return Math.round(o / Tr) + 1;
}
function Ve(e, n) {
const t = e < 0 ? "-" : "", o = Math.abs(e).toString().padStart(n, "0");
return t + o;
}
const Nt = {
// Year
y(e, n) {
const t = e.getFullYear(), o = t > 0 ? t : 1 - t;
return Ve(n === "yy" ? o % 100 : o, n.length);
},
// Month
M(e, n) {
const t = e.getMonth();
return n === "M" ? String(t + 1) : Ve(t + 1, 2);
},
// Day of the month
d(e, n) {
return Ve(e.getDate(), n.length);
},
// AM or PM
a(e, n) {
const t = e.getHours() / 12 >= 1 ? "pm" : "am";
switch (n) {
case "a":
case "aa":
return t.toUpperCase();
case "aaa":
return t;
case "aaaaa":
return t[0];
case "aaaa":
default:
return t === "am" ? "a.m." : "p.m.";
}
},
// Hour [1-12]
h(e, n) {
return Ve(e.getHours() % 12 || 12, n.length);
},
// Hour [0-23]
H(e, n) {
return Ve(e.getHours(), n.length);
},
// Minute
m(e, n) {
return Ve(e.getMinutes(), n.length);
},
// Second
s(e, n) {
return Ve(e.getSeconds(), n.length);
},
// Fraction of second
S(e, n) {
const t = n.length, o = e.getMilliseconds(), r = Math.trunc(
o * Math.pow(10, t - 3)
);
return Ve(r, n.length);
}
}, nn = {
am: "am",
pm: "pm",
midnight: "midnight",
noon: "noon",
morning: "morning",
afternoon: "afternoon",
evening: "evening",
night: "night"
}, Ao = {
// Era
G: function(e, n, t) {
const o = e.getFullYear() > 0 ? 1 : 0;
switch (n) {
case "G":
case "GG":
case "GGG":
return t.era(o, { width: "abbreviated" });
case "GGGGG":
return t.era(o, { width: "narrow" });
case "GGGG":
default:
return t.era(o, { width: "wide" });
}
},
// Year
y: function(e, n, t) {
if (n === "yo") {
const o = e.getFullYear(), r = o > 0 ? o : 1 - o;
return t.ordinalNumber(r, { unit: "year" });
}
return Nt.y(e, n);
},
// Local week-numbering year
Y: function(e, n, t, o) {
const r = ho(e, o), i = r > 0 ? r : 1 - r;
if (n === "YY") {
const a = i % 100;
return Ve(a, 2);
}
return n === "Yo" ? t.ordinalNumber(i, { unit: "year" }) : Ve(i, n.length);
},
// ISO week-numbering year
R: function(e, n) {
const t = _r(e);
return Ve(t, n.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(e, n) {
const t = e.getFullYear();
return Ve(t, n.length);
},
// Quarter
Q: function(e, n, t) {
const o = Math.ceil((e.getMonth() + 1) / 3);
switch (n) {
case "Q":
return String(o);
case "QQ":
return Ve(o, 2);
case "Qo":
return t.ordinalNumber(o, { unit: "quarter" });
case "QQQ":
return t.quarter(o, {
width: "abbreviated",
context: "formatting"
});
case "QQQQQ":
return t.quarter(o, {
width: "narrow",
context: "formatting"
});
case "QQQQ":
default:
return t.quarter(o, {
width: "wide",
context: "formatting"
});
}
},
// Stand-alone quarter
q: function(e, n, t) {
const o = Math.ceil((e.getMonth() + 1) / 3);
switch (n) {
case "q":
return String(o);
case "qq":
return Ve(o, 2);
case "qo":
return t.ordinalNumber(o, { unit: "quarter" });
case "qqq":
return t.quarter(o, {
width: "abbreviated",
context: "standalone"
});
case "qqqqq":
return t.quarter(o, {
width: "narrow",
context: "standalone"
});
case "qqqq":
default:
return t.quarter(o, {
width: "wide",
context: "standalone"
});
}
},
// Month
M: function(e, n, t) {
const o = e.getMonth();
switch (n) {
case "M":
case "MM":
return Nt.M(e, n);
case "Mo":
return t.ordinalNumber(o + 1, { unit: "month" });
case "MMM":
return t.month(o, {
width: "abbreviated",
context: "formatting"
});
case "MMMMM":
return t.month(o, {
width: "narrow",
context: "formatting"
});
case "MMMM":
default:
return t.month(o, { width: "wide", context: "formatting" });
}
},
// Stand-alone month
L: function(e, n, t) {
const o = e.getMonth();
switch (n) {
case "L":
return String(o + 1);
case "LL":
return Ve(o + 1, 2);
case "Lo":
return t.ordinalNumber(o + 1, { unit: "month" });
case "LLL":
return t.month(o, {
width: "abbreviated",
context: "standalone"
});
case "LLLLL":
return t.month(o, {
width: "narrow",
context: "standalone"
});
case "LLLL":
default:
return t.month(o, { width: "wide", context: "standalone" });
}
},
// Local week of year
w: function(e, n, t, o) {
const r = kr(e, o);
return n === "wo" ? t.ordinalNumber(r, { unit: "week" }) : Ve(r, n.length);
},
// ISO week of year
I: function(e, n, t) {
const o = Er(e);
return n === "Io" ? t.ordinalNumber(o, { unit: "week" }) : Ve(o, n.length);
},
// Day of the month
d: function(e, n, t) {
return n === "do" ? t.ordinalNumber(e.getDate(), { unit: "date" }) : Nt.d(e, n);
},
// Day of year
D: function(e, n, t) {
const o = au(e);
return n === "Do" ? t.ordinalNumber(o, { unit: "dayOfYear" }) : Ve(o, n.length);
},
// Day of week
E: function(e, n, t) {
const o = e.getDay();
switch (n) {
case "E":
case "EE":
case "EEE":
return t.day(o, {
width: "abbreviated",
context: "formatting"
});
case "EEEEE":
return t.day(o, {
width: "narrow",
context: "formatting"
});
case "EEEEEE":
return t.day(o, {
width: "short",
context: "formatting"
});
case "EEEE":
default:
return t.day(o, {
width: "wide",
context: "formatting"
});
}
},
// Local day of week
e: function(e, n, t, o) {
const r = e.getDay(), i = (r - o.weekStartsOn + 8) % 7 || 7;
switch (n) {
case "e":
return String(i);
case "ee":
return Ve(i, 2);
case "eo":
return t.ordinalNumber(i, { unit: "day" });
case "eee":
return t.day(r, {
width: "abbreviated",
context: "formatting"
});
case "eeeee":
return t.day(r, {
width: "narrow",
context: "formatting"
});
case "eeeeee":
return t.day(r, {
width: "short",
context: "formatting"
});
case "eeee":
default:
return t.day(r, {
width: "wide",
context: "formatting"
});
}
},
// Stand-alone local day of week
c: function(e, n, t, o) {
const r = e.getDay(), i = (r - o.weekStartsOn + 8) % 7 || 7;
switch (n) {
case "c":
return String(i);
case "cc":
return Ve(i, n.length);
case "co":
return t.ordinalNumber(i, { unit: "day" });
case "ccc":
return t.day(r, {
width: "abbreviated",
context: "standalone"
});
case "ccccc":
return t.day(r, {
width: "narrow",
context: "standalone"
});
case "cccccc":
return t.day(r, {
width: "short",
context: "standalone"
});
case "cccc":
default:
return t.day(r, {
width: "wide",
context: "standalone"
});
}
},
// ISO day of week
i: function(e, n, t) {
const o = e.getDay(), r = o === 0 ? 7 : o;
switch (n) {
case "i":
return String(r);
case "ii":
return Ve(r, n.length);
case "io":
return t.ordinalNumber(r, { unit: "day" });
case "iii":
return t.day(o, {
width: "abbreviated",
context: "formatting"
});
case "iiiii":
return t.day(o, {
width: "narrow",
context: "formatting"
});
case "iiiiii":
return t.day(o, {
width: "short",
context: "formatting"
});
case "iiii":
default:
return t.day(o, {
width: "wide",
context: "formatting"
});
}
},
// AM or PM
a: function(e, n, t) {
const r = e.getHours() / 12 >= 1 ? "pm" : "am";
switch (n) {
case "a":
case "aa":
return t.dayPeriod(r, {
width: "abbreviated",
context: "formatting"
});
case "aaa":
return t.dayPeriod(r, {
width: "abbreviated",
context: "formatting"
}).toLowerCase();
case "aaaaa":
return t.dayPeriod(r, {
width: "narrow",
context: "formatting"
});
case "aaaa":
default:
return t.dayPeriod(r, {
width: "wide",
context: "formatting"
});
}
},
// AM, PM, midnight, noon
b: function(e, n, t) {
const o = e.getHours();
let r;
switch (o === 12 ? r = nn.noon : o === 0 ? r = nn.midnight : r = o / 12 >= 1 ? "pm" : "am", n) {
case "b":
case "bb":
return t.dayPeriod(r, {
width: "abbreviated",
context: "formatting"
});
case "bbb":
return t.dayPeriod(r, {
width: "abbreviated",
context: "formatting"
}).toLowerCase();
case "bbbbb":
return t.dayPeriod(r, {
width: "narrow",
context: "formatting"
});
case "bbbb":
default:
return t.dayPeriod(r, {
width: "wide",
context: "formatting"
});
}
},
// in the morning, in the afternoon, in the evening, at night
B: function(e, n, t) {
const o = e.getHours();
let r;
switch (o >= 17 ? r = nn.evening : o >= 12 ? r = nn.afternoon : o >= 4 ? r = nn.morning : r = nn.night, n) {
case "B":
case "BB":
case "BBB":
return t.dayPeriod(r, {
width: "abbreviated",
context: "formatting"
});
case "BBBBB":
return t.dayPeriod(r, {
width: "narrow",
context: "formatting"
});
case "BBBB":
default:
return t.dayPeriod(r, {
width: "wide",
context: "formatting"
});
}
},
// Hour [1-12]
h: function(e, n, t) {
if (n === "ho") {
let o = e.getHours() % 12;
return o === 0 && (o = 12), t.ordinalNumber(o, { unit: "hour" });
}
return Nt.h(e, n);
},
// Hour [0-23]
H: function(e, n, t) {
return n === "Ho" ? t.ordinalNumber(e.getHours(), { unit: "hour" }) : Nt.H(e, n);
},
// Hour [0-11]
K: function(e, n, t) {
const o = e.getHours() % 12;
return n === "Ko" ? t.ordinalNumber(o, { unit: "hour" }) : Ve(o, n.length);
},
// Hour [1-24]
k: function(e, n, t) {
let o = e.getHours();
return o === 0 && (o = 24), n === "ko" ? t.ordinalNumber(o, { unit: "hour" }) : Ve(o, n.length);
},
// Minute
m: function(e, n, t) {
return n === "mo" ? t.ordinalNumber(e.getMinutes(), { unit: "minute" }) : Nt.m(e, n);
},
// Second
s: function(e, n, t) {
return n === "so" ? t.ordinalNumber(e.getSeconds(), { unit: "second" }) : Nt.s(e, n);
},
// Fraction of second
S: function(e, n) {
return Nt.S(e, n);
},
// Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
X: function(e, n, t) {
const o = e.getTimezoneOffset();
if (o === 0)
return "Z";
switch (n) {
case "X":
return $o(o);
case "XXXX":
case "XX":
return Yt(o);
case "XXXXX":
case "XXX":
default:
return Yt(o, ":");
}
},
// Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
x: function(e, n, t) {
const o = e.getTimezoneOffset();
switch (n) {
case "x":
return $o(o);
case "xxxx":
case "xx":
return Yt(o);
case "xxxxx":
case "xxx":
default:
return Yt(o, ":");
}
},
// Timezone (GMT)
O: function(e, n, t) {
const o = e.getTimezoneOffset();
switch (n) {
case "O":
case "OO":
case "OOO":
return "GMT" + jo(o, ":");
case "OOOO":
default:
return "GMT" + Yt(o, ":");
}
},
// Timezone (specific non-location)
z: function(e, n, t) {
const o = e.getTimezoneOffset();
switch (n) {
case "z":
case "zz":
case "zzz":
return "GMT" + jo(o, ":");
case "zzzz":
default:
return "GMT" + Yt(o, ":");
}
},
// Seconds timestamp
t: function(e, n, t) {
const o = Math.trunc(e.getTime() / 1e3);
return Ve(o, n.length);
},
// Milliseconds timestamp
T: function(e, n, t) {
const o = e.getTime();
return Ve(o, n.length);
}
};
function jo(e, n = "") {
const t = e > 0 ? "-" : "+", o = Math.abs(e), r = Math.trunc(o / 60), i = o % 60;
return i === 0 ? t + String(r) : t + String(r) + n + Ve(i, 2);
}
function $o(e, n) {
return e % 60 === 0 ? (e > 0 ? "-" : "+") + Ve(Math.abs(e) / 60, 2) : Yt(e, n);
}
function Yt(e, n = "") {
const t = e > 0 ? "-" : "+", o = Math.abs(e), r = Ve(Math.trunc(o / 60), 2), i = Ve(o % 60, 2);
return t + r + n + i;
}
const Ho = (e, n) => {
switch (e) {
case "P":
return n.date({ width: "short" });
case "PP":
return n.date({ width: "medium" });
case "PPP":
return n.date({ width: "long" });
case "PPPP":
default:
return n.date({ width: "full" });
}
}, Or = (e, n) => {
switch (e) {
case "p":
return n.time({ width: "short" });
case "pp":
return n.time({ width: "medium" });
case "ppp":
return n.time({ width: "long" });
case "pppp":
default:
return n.time({ width: "full" });
}
}, lu = (e, n) => {
const t = e.match(/(P+)(p+)?/) || [], o = t[1], r = t[2];
if (!r)
return Ho(e, n);
let i;
switch (o) {
case "P":
i = n.dateTime({ width: "short" });
break;
case "PP":
i = n.dateTime({ width: "medium" });
break;
case "PPP":
i = n.dateTime({ width: "long" });
break;
case "PPPP":
default:
i = n.dateTime({ width: "full" });
break;
}
return i.replace("{{date}}", Ho(o, n)).replace("{{time}}", Or(r, n));
}, Zn = {
p: Or,
P: lu
}, uu = /^D+$/, cu = /^Y+$/, du = ["D", "DD", "YY", "YYYY"];
function Mr(e) {
return uu.test(e);
}
function Ir(e) {
return cu.test(e);
}
function eo(e, n, t) {
const o = fu(e, n, t);
if (console.warn(o), du.includes(e)) throw new RangeError(o);
}
function fu(e, n, t) {
const o = e[0] === "Y" ? "years" : "days of the month";
return `Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${n}\`) for formatting ${o} to the input \`${t}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
}
const pu = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g, mu = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g, hu = /^'([^]*?)'?$/, vu = /''/g, gu = /[a-zA-Z]/;
function vo(e, n, t) {
var d, s, m, p;
const o = sn(), r = o.locale ?? Fr, i = o.firstWeekContainsDate ?? ((s = (d = o.locale) == null ? void 0 : d.options) == null ? void 0 : s.firstWeekContainsDate) ?? 1, a = o.weekStartsOn ?? ((p = (m = o.locale) == null ? void 0 : m.options) == null ? void 0 : p.weekStartsOn) ?? 0, l = Ze(e);
if (!Fl(l))
throw new RangeError("Invalid time value");
let c = n.match(mu).map((f) => {
const w = f[0];
if (w === "p" || w === "P") {
const g = Zn[w];
return g(f, r.formatLong);
}
return f;
}).join("").match(pu).map((f) => {
if (f === "''")
return { isToken: !1, value: "'" };
const w = f[0];
if (w === "'")
return { isToken: !1, value: yu(f) };
if (Ao[w])
return { isToken: !0, value: f };
if (w.match(gu))
throw new RangeError(
"Format string contains an unescaped latin alphabet character `" + w + "`"
);
return { isToken: !1, value: f };
});
r.localize.preprocessor && (c = r.localize.preprocessor(l, c));
const u = {
firstWeekContainsDate: i,
weekStartsOn: a,
locale: r
};
return c.map((f) => {
if (!f.isToken) return f.value;
const w = f.value;
(Ir(w) || Mr(w)) && eo(w, n, String(e));
const g = Ao[w[0]];
return g(l, w, r.localize, u);
}).join("");
}
function yu(e) {
const n = e.match(hu);
return n ? n[1].replace(vu, "'") : e;
}
function bu() {
return Object.assign({}, sn());
}
function wu(e) {
let t = Ze(e).getDay();
return t === 0 && (t = 7), t;
}
function Cu(e, n) {
const t = n instanceof Date ? Ue(n, 0) : new n(0);
return t.setFullYear(
e.getFullYear(),
e.getMonth(),
e.getDate()
), t.setHours(
e.getHours(),
e.getMinutes(),
e.getSeconds(),
e.getMilliseconds()
), t;
}
const xu = 10;
class Pr {
constructor() {
L(this, "subPriority", 0);
}
validate(n, t) {
return !0;
}
}
class Su extends Pr {
constructor(n, t, o, r, i) {
super(), this.value = n, this.validateValue = t, this.setValue = o, this.priority = r, i && (this.subPriority = i);
}
validate(n, t) {
return this.validateValue(n, this.value, t);
}
set(n, t, o) {
return this.setValue(n, t, this.value, o);
}
}
class Tu extends Pr {
constructor() {
super(...arguments);
L(this, "priority", xu);
L(this, "subPriority", -1);
}
set(t, o) {
return o.timestampIsSet ? t : Ue(t, Cu(t, Date));
}
}
class Be {
run(n, t, o, r) {
const i = this.parse(n, t, o, r);
return i ? {
setter: new Su(
i.value,
this.validate,
this.set,
this.priority,
this.subPriority
),
rest: i.rest
} : null;
}
validate(n, t, o) {
return !0;
}
}
class _u extends Be {
constructor() {
super(...arguments);
L(this, "priority", 140);
L(this, "incompatibleTokens", ["R", "u", "t", "T"]);
}
parse(t, o, r) {
switch (o) {
case "G":
case "GG":
case "GGG":
return r.era(t, { width: "abbreviated" }) || r.era(t, { width: "narrow" });
case "GGGGG":
return r.era(t, { width: "narrow" });
case "GGGG":
default:
return r.era(t, { width: "wide" }) || r.era(t, { width: "abbreviated" }) || r.era(t, { width: "narrow" });
}
}
set(t, o, r) {
return o.era = r, t.setFullYear(r, 0, 1), t.setHours(0, 0, 0, 0), t;
}
}
const Ye = {
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
sec