@farris/ui-vue
Version:
Farris Vue, a Farris Design based Vue3 component library.
1,652 lines • 500 kB
JavaScript
var Qa = Object.defineProperty;
var Ka = (e, n, t) => n in e ? Qa(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t;
var R = (e, n, t) => Ka(e, typeof n != "symbol" ? n + "" : n, t);
import { defineComponent as Ee, ref as h, computed as V, watch as ve, createVNode as M, Fragment as Vt, onMounted as Je, createTextVNode as dt, mergeProps as gt, nextTick as Et, withDirectives as xn, vModelText as Za, reactive as kt, resolveDirective as To, createApp as An, onUnmounted as Qt, Transition as ko, onBeforeUnmount as So, onBeforeMount as Ja, Teleport as Yn, shallowRef as er, render as kn, h as tr, cloneVNode as nr, inject as bt, provide as or, triggerRef as ar, isVNode as rr, vShow as ir } from "vue";
import { isPlainObject as co, cloneDeep as xt, isUndefined as fo } from "lodash-es";
import "bignumber.js";
import { withInstall as qn, useTextBox as sr, useClear as _o, useDateFormat as Oo, useNumberFormat as lr, resolveField as yt, setFieldValue as Fn, getCustomClass as Sn, FormSchemaEntityField$Type as po, FormSchemaEntityFieldType$Type as ur, useTextBoxDesign as cr } from "../common/index.esm.js";
import Po from "../button-edit/index.esm.js";
import dr, { useNumber as fr, useFormat as pr, useSpinner as mr, useTextBox as hr } from "../number-spinner/index.esm.js";
import { DgControl as mo, useDesignerComponent as Do } from "../designer-canvas/index.esm.js";
import { useResizeObserver as Fo } from "@vueuse/core";
import { useIdentify as vr, useGroupData as yr, useFilter as gr, useHierarchy as br, useLoading as wr, useDataView as Cr, useSelection as Mr, useSelectHierarchyItem as xr, useDataViewContainerStyle as Tr, useCommandColumn as kr, useColumn as Sr, useSort as _r, useGroupColumn as Or, useRow as Pr, useEdit as Dr, useVisualDataBound as Fr, useVisualDataCell as Er, useVisualDataRow as Ir, useVisualData as Br, useCellPosition as Nr, useSidebar as Vr, useVirtualScroll as Hr, useFitColumn as $r, useFilterHistory as Rr, useColumnFilter as Lr, useDragColumn as Wr, getColumnHeader as jr, getSidebar as Ar, getDisableMask as Yr, getHorizontalScrollbar as qr, getVerticalScrollbar as Gr, getEmpty as zr } from "../data-view/index.esm.js";
import "../modal/index.esm.js";
import Ur from "../transfer/index.esm.js";
import Xr from "../tabs/index.esm.js";
import Qr from "../order/index.esm.js";
import "../condition/index.esm.js";
import Kr, { FCheckbox as Zr } from "../checkbox/index.esm.js";
import Jr from "../filter-bar/index.esm.js";
import ho from "../tooltip/index.esm.js";
import ei from "../pagination/index.esm.js";
import ti from "../button/index.esm.js";
import ni from "../search-box/index.esm.js";
import oi from "../tags/index.esm.js";
import ai, { FDynamicFormGroup as ri, FDynamicFormInput as ii } from "../dynamic-form/index.esm.js";
import si from "../binding-selector/index.esm.js";
import "../notify/index.esm.js";
import li from "../accordion/index.esm.js";
import ui from "../avatar/index.esm.js";
import ci from "../button-group/index.esm.js";
import di from "../calendar/index.esm.js";
import fi from "../capsule/index.esm.js";
import pi from "../color-picker/index.esm.js";
import En from "../combo-list/index.esm.js";
import mi from "../content-container/index.esm.js";
import hi from "../data-grid/index.esm.js";
import vi from "../date-picker/index.esm.js";
import yi from "../dropdown/index.esm.js";
import "../external-container/index.esm.js";
import gi from "../events-editor/index.esm.js";
import bi from "../image-cropper/index.esm.js";
import wi from "../input-group/index.esm.js";
import Ci from "../layout/index.esm.js";
import Mi from "../list-nav/index.esm.js";
import xi from "../list-view/index.esm.js";
import Ti from "../lookup/index.esm.js";
import ki from "../nav/index.esm.js";
import Si from "../number-range/index.esm.js";
import _i from "../page-header/index.esm.js";
import Oi from "../page-footer/index.esm.js";
import Pi from "../progress/index.esm.js";
import Di from "../query-solution/index.esm.js";
import Fi from "../radio-group/index.esm.js";
import Ei from "../rate/index.esm.js";
import Ii from "../response-toolbar/index.esm.js";
import Bi from "../response-layout/index.esm.js";
import Ni from "../response-layout-editor/index.esm.js";
import Vi from "../section/index.esm.js";
import Hi from "../smoke-detector/index.esm.js";
import $i from "../splitter/index.esm.js";
import Ri from "../step/index.esm.js";
import Li from "../switch/index.esm.js";
import Wi from "../text/index.esm.js";
import ji from "../time-picker/index.esm.js";
import Ai from "../tree-view/index.esm.js";
import Yi from "../uploader/index.esm.js";
import qi from "../verify-detail/index.esm.js";
import Gi from "../component/index.esm.js";
import zi from "../video/index.esm.js";
import Ui from "../textarea/index.esm.js";
import Xi from "../tree-grid/index.esm.js";
import Qi from "../fieldset/index.esm.js";
import Ki from "../drawer/index.esm.js";
import Zi from "../combo-tree/index.esm.js";
import Ji from "../field-selector/index.esm.js";
import es from "../mapping-editor/index.esm.js";
import ts from "../schema-selector/index.esm.js";
import ns from "../event-parameter/index.esm.js";
import os from "../filter-condition-editor/index.esm.js";
import as from "../sort-condition-editor/index.esm.js";
import rs from "../menu-lookup/index.esm.js";
import { createPropsResolver as is, resolveAppearance as ss } from "../dynamic-resolver/index.esm.js";
const Tn = ["日", "一", "二", "三", "四", "五", "六"];
var ct = /* @__PURE__ */ ((e) => (e[e.previous = 1] = "previous", e[e.current = 2] = "current", e[e.next = 3] = "next", e))(ct || {});
const ls = {
dates: { Type: Array, default: [] },
daysInWeek: { Type: Array, default: Tn },
enableKeyboadNavigate: { Type: Boolean, default: !0 },
enableMarkCurrent: { Type: Boolean, default: !0 },
enablePeriod: { Type: Boolean, default: !1 },
firstDayOfTheWeek: { Type: Boolean, default: "Sun." },
selected: { Type: Object, default: null },
selectedPeriod: { Type: Object, default: null },
selectedWeek: { Type: Object, default: null },
selectMode: { Type: String, default: "day" },
showWeekNumber: { Type: Boolean, default: !1 },
weekTitle: { Type: String, default: "Week" }
};
var Pt = /* @__PURE__ */ ((e) => (e[e.enter = 13] = "enter", e[e.esc = 27] = "esc", e[e.space = 32] = "space", e[e.leftArrow = 37] = "leftArrow", e[e.upArrow = 38] = "upArrow", e[e.rightArrow = 39] = "rightArrow", e[e.downArrow = 40] = "downArrow", e[e.tab = 9] = "tab", e[e.shift = 16] = "shift", e))(Pt || {});
function Gn() {
function e(n) {
const t = n.key || n.keyCode;
return t === "Enter" || t === 13 ? 13 : t === "Escape" || t === 27 ? 27 : t === " " || t === 32 ? 32 : t === "ArrowLeft" || t === 37 ? 37 : t === "ArrowUp" || t === 38 ? 38 : t === "ArrowRight" || t === 39 ? 39 : t === "ArrowDown" || t === 40 ? 40 : t === "Tab" || t === 9 ? 9 : t === "Shift" || t === 16 ? 16 : -1;
}
return { getKeyCodeFromEvent: e };
}
function Wt() {
function e() {
return { year: 0, month: 0, day: 0 };
}
function n(c) {
return new Date(
c.year || 0,
c.month ? c.month - 1 : 0,
c.day || 0,
c.hour ? c.hour : 0,
c.minute ? c.minute : 0,
c.second ? c.second : 0,
0
);
}
function t(c) {
const s = /* @__PURE__ */ new Date();
return c.year || (c.year = s.getFullYear()), c.month || (c.month = s.getMonth() + 1), c.day || (c.day = 1), new Date(
c.year,
c.month - 1,
c.day,
c.hour ? c.hour : 0,
c.minute ? c.minute : 0,
c.second ? c.second : 0,
0
);
}
function o(c) {
return new Date(
c.year || 1,
(c.month || 1) - 1,
c.day,
c.hour ? c.hour : 0,
c.minute ? c.minute : 0,
c.second ? c.second : 0,
0
).getDay();
}
function a(c) {
return Tn.indexOf(c);
}
function r(c) {
return n(c).getTime();
}
function i(c) {
return Math.round(r(c) / 1e3);
}
function l(c, s, d) {
const v = r(s), p = r(d), _ = r(c);
return p - _ > _ - v ? s : d;
}
function u() {
const c = /* @__PURE__ */ new Date();
return {
year: c.getFullYear(),
month: c.getMonth() + 1,
day: c.getDate(),
hour: c.getHours(),
minute: c.getMinutes(),
second: c.getSeconds()
};
}
function f(c, s) {
const d = s.match(/[^(DdMmYy)]{1,}/g), v = {};
if (d) {
let p = d[0];
d[0] !== d[1] && (p = d[0] + d[1], d[2] && d[1] !== d[2] && (p += d[2]));
const _ = new RegExp("[" + p + "]"), w = c.split(_), g = s.split(_);
for (let b = 0; b < g.length; b++)
g[b].indexOf("yyyy") !== -1 && (v.year = Number(w[b])), g[b].indexOf("M") !== -1 && (v.month = Number(w[b] || "1")), g[b].indexOf("d") !== -1 && (v.day = Number(w[b] || "1"));
} else {
const p = (s + "").indexOf("yyyy"), _ = (s + "").indexOf("MM"), w = (s + "").indexOf("dd");
if (p >= 0) {
const g = c.substring(p, p + 4);
v.year = Number(g);
}
_ >= 0 && (v.month = Number(c.substring(_, _ + 2) || "1")), w >= 0 && (v.day = Number(c.substring(w, w + 2) || "01"));
}
return v;
}
return {
emptyDate: e,
getDate: n,
getDate2: t,
getDayNumber: o,
getEpocTime: i,
getNearDate: l,
getWeekdayIndex: a,
getTimeInMilliseconds: r,
getToday: u,
getDateObject: f
};
}
function un() {
const { getTimeInMilliseconds: e } = Wt();
function n(s) {
return s && s.year !== 0 && s.month !== 0 && s.day !== 0;
}
function t(s) {
return s && s.year !== 0 && s.month !== 0;
}
function o(s) {
return s && s.year !== 0;
}
function a(s, d) {
return e(s) < e(d);
}
function r(s, d) {
return e(s) <= e(d);
}
function i(s, d) {
return e(s) === e(d);
}
function l(s, d) {
const v = e(d);
return e(s.from) === v || e(s.to) === v;
}
function u(s, d) {
return !d || !n(d.to) || !n(d.from) ? !1 : r(d.from, s) && r(s, d.to);
}
function f(s, d) {
return n(d) && e(s) >= e(d);
}
function c(s, d) {
return n(d) && e(s) <= e(d);
}
return {
isDateEarlier: a,
equal: i,
inPeriod: u,
isPoint: l,
equalOrEarlier: r,
isInitializedDate: n,
isInitializedMonth: t,
isInitializedYear: o,
isMonthDisabledByDisableSince: f,
isMonthDisabledByDisableUntil: c
};
}
const In = /* @__PURE__ */ Ee({
name: "FDatePickerCalendarView",
props: ls,
emits: ["click", "clickWeek", "keyDown", "mouseEnter", "mouseLeave"],
setup(e, n) {
const t = h(e.dates), o = h(e.daysInWeek), a = h(e.enableKeyboadNavigate), r = h(e.enableMarkCurrent), i = h(e.enablePeriod), l = h(e.firstDayOfTheWeek), u = h(e.selected), f = h(e.selectedPeriod), c = h(e.selectedWeek), s = h(e.selectMode), d = h(e.showWeekNumber), v = h(e.weekTitle), p = V(() => d.value && l.value === "Mon");
ve(() => e.dates, () => {
t.value = e.dates;
}), ve(() => e.selected, () => {
u.value = e.selected;
}), ve(() => e.enablePeriod, (T, D) => {
T !== D && (i.value = T);
});
const {
equal: _,
inPeriod: w,
isInitializedDate: g,
equalOrEarlier: b,
isPoint: x
} = un(), {
getKeyCodeFromEvent: y
} = Gn(), C = (T) => {
const D = !!c.value && T.numberInTheYear === c.value.numberInTheYear && T.year === c.value.year;
return {
"f-datepicker-selectWeek": s.value === "week",
"f-datepicker-selectedWeek": s.value === "week" && D
};
}, O = V(() => d.value && l.value === "Mon");
function m(T) {
return w(T, f.value);
}
function k(T) {
return !!f.value && x(f.value, T);
}
function S(T) {
return !!u.value && _({
year: u.value.year,
month: u.value.month,
day: u.value.day
}, {
year: T.year,
month: T.month,
day: T.day
});
}
const F = (T, D, N) => {
const A = s.value !== "week" && T.tag === ct.current && (i.value && m(T.date) && !k(T.date) || T.range), z = T.tag === ct.previous || T.tag === ct.next, X = {
"f-datepicker-range": A,
"f-datepicker-no-currmonth": z,
"f-datepicker-disabled": T.disable,
"f-datepicker-singledate": !T.disable
}, J = `d_${D}_${N}`;
return X[J] = !0, X;
}, P = (T) => {
const D = s.value !== "week" && T.tag === ct.current && (!i.value && S(T.date) || i.value && k(T.date)), N = T.isCurrent && r.value, A = T.highlight && (T.tag === ct.previous || T.tag === ct.next || T.disable);
return {
"f-datepicker-date": !0,
"f-datepicker-selected": D,
"f-datepicker-current": N,
"f-datepicker-opacity": A,
"f-datepicker-highlight": T.highlight,
"f-datepicker-disabled": T.disable
};
};
function B(T, D) {
D.disable || s.value === "week" || (T.stopPropagation(), n.emit("click", {
event: T,
dayItem: D
}));
}
function $(T, D) {
s.value === "week" && (T.stopPropagation(), n.emit("clickWeek", D));
}
function H(T, D) {
const N = y(T);
N !== Pt.tab && (T.preventDefault(), N === Pt.enter || N === Pt.space ? B(T, D) : a.value && n.emit("keyDown", D.date));
}
function E(T) {
f.value && g(f.value.from) && !g(f.value.to) && (t.value.forEach((D) => {
D.days.forEach((N) => {
N.range = !!f.value && (b(f.value.from, N.date) && b(N.date, T.date) || b(N.date, f.value.from) && b(T.date, N.date));
});
}), n.emit("mouseEnter", T.date));
}
function I() {
t.value.forEach((T) => {
T.days.forEach((D) => {
D.range = !1;
});
}), n.emit("mouseLeave");
}
return () => M(Vt, null, [M("div", {
class: "f-datepicker-table-wrapper"
}, [M("table", {
class: "f-datepicker-table",
cellpadding: "0"
}, [M("thead", null, [M("tr", null, [p.value && M("th", {
class: "f-datepicker-weeknbr-title"
}, [v.value]), o.value && o.value.map((T) => M("th", {
scope: "col",
style: "padding-bottom: 8px;padding-top: 4px"
}, [T]))])]), M("tbody", null, [t.value && t.value.map((T, D) => M("tr", {
class: C(T),
onClick: (N) => $(N, T)
}, [O.value && M("td", {
class: "f-datepicker-weeknbr"
}, [M("div", {
class: "f-datepicker-date"
}, [T.numberInTheYear])]), T.days && T.days.map((N, A) => M("td", {
id: `d_${D}_${A}`,
tabindex: "0",
class: F(N, D, A),
onClick: (z) => B(z, N),
onKeydown: (z) => H(z, N),
onMouseenter: () => E(N),
onMouseleave: () => I()
}, [N.marked && N.marked.marked && M("span", {
class: "f-datepicker-markdate",
style: {
"background-color": N.marked.color
}
}, null), M("div", {
class: P(N)
}, [N.date.day])]))]))])])])]);
}
}), us = {
activeMonth: { type: Object, require: !0 },
ariaLabelPrevMonth: { type: String, default: "" },
ariaLabelNextMonth: { type: String, default: "" },
dateFormat: { type: String, default: "yyyy-MM-dd" },
disablePrePage: { type: Boolean, default: !1 },
disablePreRecord: { type: Boolean, default: !1 },
disableNextRecord: { type: Boolean, default: !1 },
disableNextPage: { type: Boolean, default: !1 },
years: { type: Array, default: [[{}]] },
selectingMonth: { type: Boolean, default: !1 },
selectingYear: { type: Boolean, default: !1 },
selectMode: { type: String, default: "day" }
}, Bn = /* @__PURE__ */ Ee({
name: "FDatePickerCalendarNavbar",
props: us,
emits: ["clickMonth", "clickYear", "prePage", "preRecord", "nextRecord", "nextPage"],
setup(e, n) {
return () => {
const t = h(e.ariaLabelPrevMonth), o = h(e.ariaLabelNextMonth), a = h(e.dateFormat), r = h(e.disablePrePage), i = h(e.disablePreRecord), l = h(e.disableNextRecord), u = h(e.disableNextPage), f = h(e.activeMonth), c = h(e.years), s = h(e.selectingMonth), d = h(e.selectingYear), v = h(e.selectMode), p = h(!0), _ = h(!0);
ve(() => e.activeMonth, () => {
var T, D, N, A;
f.value = {
month: (T = e.activeMonth) == null ? void 0 : T.month,
year: (D = e.activeMonth) == null ? void 0 : D.year,
displayTextOfMonth: (N = e.activeMonth) == null ? void 0 : N.displayTextOfMonth,
displayTextOfYear: (A = e.activeMonth) == null ? void 0 : A.displayTextOfMonth
};
});
const w = V(() => ({
"f-datepicker-header": !0,
monthYearSelBarBorder: s.value || d.value
})), g = V(() => ({
"f-datepicker-header-btn": !0,
"f-datepicker-header-btn-disabled": r.value
})), b = V(() => !s.value && !d.value), x = V(() => ({
"f-datepicker-header-btn": !0,
"f-datepicker-header-btn-disabled": i.value
})), y = V(() => ({
"f-datepicker-header-btn": !0,
"f-datepicker-header-btn-disabled": l.value
})), C = V(() => ({
"f-datepicker-header-btn": !0,
"f-datepicker-header-btn-disabled": u.value
})), O = V(() => ({
"f-datepicker-header-btn": !0,
"f-datepicker-yearLabel": p.value,
"f-datepicker-labelBtnNotEdit": !p.value
})), m = V(() => ({
"f-datepicker-header-btn": !0,
"f-datepicker-monthLabel": _.value,
"f-datepicker-labelBtnNotEdit": !_.value
})), k = V(() => {
const T = a.value ? a.value.indexOf("yyyy") : 0, D = a.value ? a.value.indexOf("MM") : 0;
return T > D ? "MM-yyyy" : "yyyy-MM";
});
function S(T) {
T.stopPropagation(), n.emit("prePage");
}
function F(T) {
T.stopPropagation(), n.emit("preRecord");
}
function P(T) {
T.stopPropagation(), n.emit("clickYear");
}
function B(T) {
T.stopPropagation(), n.emit("clickMonth");
}
function $(T) {
T.stopPropagation(), n.emit("nextRecord");
}
function H(T) {
T.stopPropagation(), n.emit("nextPage");
}
function E() {
return M("button", {
type: "button",
class: O.value,
onClick: (T) => {
p.value && P(T);
},
tabindex: p.value ? "0" : "-1",
disabled: v.value === "year"
}, [d.value ? c.value.length > 3 ? c.value[0][1].year + " - " + c.value[3][1].year : "" : f.value.displayTextOfYear]);
}
function I() {
return !d.value && v.value !== "month" && M("button", {
type: "button",
class: m.value,
onClick: (T) => {
_.value && B(T);
},
tabindex: _.value ? "0" : "-1"
}, [f.value.displayTextOfMonth]);
}
return M("div", {
class: w.value
}, [M("div", {
class: "f-datepicker-prev-btn"
}, [M("button", {
type: "button",
class: g.value,
onClick: S
}, [M("i", {
class: "f-icon f-icon-arrow-double-60-left"
}, null)]), b.value && M("button", {
type: "button",
"aria-label": t.value,
class: x.value,
onClick: F
}, [M("i", {
class: "f-icon f-icon-arrow-chevron-left"
}, null)])]), M("div", {
class: "f-datepicker-monthYearText"
}, [k.value === "yyyy-MM" ? [E(), I()] : [I(), E()]]), M("div", {
class: "f-datepicker-next-btn"
}, [b.value && M("button", {
type: "button",
"aria-label": o.value,
class: y.value,
onClick: $
}, [M("i", {
class: "f-icon f-icon-arrow-chevron-right"
}, null)]), M("button", {
type: "button",
class: C.value,
onClick: H
}, [M("i", {
class: "f-icon f-icon-arrow-double-60-right"
}, null)])])]);
};
}
}), Eo = {
1: "一月",
2: "二月",
3: "三月",
4: "四月",
5: "五月",
6: "六月",
7: "七月",
8: "八月",
9: "九月",
10: "十月",
11: "十一月",
12: "十二月"
}, Io = {}, Bo = {};
function zn(e) {
const { properties: n, title: t, ignore: o } = e, a = o && Array.isArray(o), r = Object.keys(n).reduce((i, l) => ((!a || !o.find((u) => u === l)) && (i[l] = n[l].type === "object" && n[l].properties ? zn(n[l]) : xt(n[l].default)), i), {});
if (t && (!a || !o.find((i) => i === "id"))) {
const i = t.toLowerCase().replace(/-/g, "_");
r.id = `${i}_${Math.random().toString().slice(2, 6)}`;
}
return r;
}
function cs(e) {
const { properties: n, title: t, required: o } = e;
if (o && Array.isArray(o)) {
const a = o.reduce((r, i) => (r[i] = n[i].type === "object" && n[i].properties ? zn(n[i]) : xt(n[i].default), r), {});
if (t && o.find((r) => r === "id")) {
const r = t.toLowerCase().replace(/-/g, "_");
a.id = `${r}_${Math.random().toString().slice(2, 6)}`;
}
return a;
}
return {
type: t
};
}
function No(e, n = {}, t) {
const o = Io[e];
if (o) {
let a = cs(o);
const r = Bo[e];
return a = r ? r({ getSchemaByType: No }, a, n, t) : a, a;
}
return null;
}
function ds(e, n) {
const t = zn(n);
return Object.keys(t).reduce((o, a) => (Object.prototype.hasOwnProperty.call(e, a) && (o[a] && co(o[a]) && co(e[a] || !e[a]) ? Object.assign(o[a], e[a] || {}) : o[a] = e[a]), o), t), t;
}
function Vo(e, n) {
return Object.keys(e).filter((o) => e[o] != null).reduce((o, a) => {
if (n.has(a)) {
const r = n.get(a);
if (typeof r == "string")
o[r] = e[a];
else {
const i = r(a, e[a], e);
Object.assign(o, i);
}
} else
o[a] = e[a];
return o;
}, {});
}
function fs(e, n, t = /* @__PURE__ */ new Map()) {
const o = ds(e, n);
return Vo(o, t);
}
function ps(e = {}) {
function n(f, c, s, d) {
if (typeof s == "number")
return d[f].length === s;
if (typeof s == "object") {
const v = Object.keys(s)[0], p = s[v];
if (v === "not")
return Number(d[f].length) !== Number(p);
if (v === "moreThan")
return Number(d[f].length) >= Number(p);
if (v === "lessThan")
return Number(d[f].length) <= Number(p);
}
return !1;
}
function t(f, c, s, d) {
return d[f] && d[f].propertyValue && String(d[f].propertyValue.value) === String(s);
}
const o = /* @__PURE__ */ new Map([
["length", n],
["getProperty", t]
]);
Object.keys(e).reduce((f, c) => (f.set(c, e[c]), f), o);
function a(f, c) {
const s = f;
return typeof c == "number" ? [{ target: s, operator: "length", param: null, value: Number(c) }] : typeof c == "boolean" ? [{ target: s, operator: "getProperty", param: f, value: !!c }] : typeof c == "object" ? Object.keys(c).map((d) => {
if (d === "length")
return { target: s, operator: "length", param: null, value: c[d] };
const v = d, p = c[d];
return { target: s, operator: "getProperty", param: v, value: p };
}) : [];
}
function r(f) {
return Object.keys(f).reduce((s, d) => {
const v = a(d, f[d]);
return s.push(...v), s;
}, []);
}
function i(f, c) {
if (o.has(f.operator)) {
const s = o.get(f.operator);
return s && s(f.target, f.param, f.value, c) || !1;
}
return !1;
}
function l(f, c) {
return r(f).reduce((v, p) => v && i(p, c), !0);
}
function u(f, c) {
const s = Object.keys(f), d = s.includes("allOf"), v = s.includes("anyOf"), p = d || v, g = (p ? f[p ? d ? "allOf" : "anyOf" : "allOf"] : [f]).map((x) => l(x, c));
return d ? !g.includes(!1) : g.includes(!0);
}
return { parseValueSchema: u };
}
const le = {
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: "标签页工具栏按钮" },
"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: "抽屉" }
}, ms = {}, hs = {};
ps();
function Dt(e, n, t = /* @__PURE__ */ new Map(), o = (i, l, u, f) => l, a = {}, r = (i) => i) {
return Io[n.title] = n, Bo[n.title] = o, ms[n.title] = a, hs[n.title] = r, (i = {}, l = !0) => {
if (!l)
return Vo(i, t);
const u = fs(i, n, t), f = Object.keys(e).reduce((c, s) => (c[s] = e[s].default, c), {});
return Object.assign(f, u);
};
}
function cn(e, n) {
return { customClass: n.class, customStyle: n.style };
}
function vs() {
function e(n, t) {
const { dataSource: o } = n || {};
return o === void 0 ? {} : {};
}
return {
resolve: e
};
}
function ys() {
function e(n, t) {
return n.selectItemById(t);
}
return {
selectItemById: e
};
}
function gs() {
function e(n, t) {
const { columns: o } = t;
return n.updateColumns(o);
}
return {
updateColumns: e
};
}
const Ho = /* @__PURE__ */ new Map([
["appearance", cn]
]);
function $o(e, n, t) {
return n;
}
const bs = "https://json-schema.org/draft/2020-12/schema", ws = "https://farris-design.gitee.io/date-view.schema.json", Cs = "date-view", Ms = "A Farris Input Component", xs = "object", Ts = {
id: {
description: "The unique identifier for date picker",
type: "string"
},
type: {
description: "The type string of date picker",
type: "string",
default: "date-view"
},
appearance: {
description: "",
type: "object",
properties: {
class: {
type: "string"
},
style: {
type: "string"
}
},
default: {}
},
disable: {
type: "string",
default: !1
},
visible: {
description: "",
type: "boolean",
default: !0
}
}, ks = [
"id",
"type"
], Ss = {
$schema: bs,
$id: ws,
title: Cs,
description: Ms,
type: xs,
properties: Ts,
required: ks
}, _s = "date-view", Os = "A Farris Component", Ps = "object", Ds = {
basic: {
description: "Basic Infomation",
title: "基本信息",
properties: {
id: {
description: "组件标识",
title: "标识",
type: "string",
readonly: !0
},
type: {
description: "组件类型",
title: "控件类型",
type: "select",
editor: {
type: "waiting for modification",
enum: []
}
}
}
},
behavior: {
description: "Basic Infomation",
title: "行为",
properties: {
visible: {
description: "",
title: "可见",
type: "boolean"
}
}
}
}, Fs = {
title: _s,
description: Os,
type: Ps,
categories: Ds
}, Ro = {
/** */
top: { type: Number, default: 0 },
/** */
left: { type: Number, default: 0 },
/** 位置 */
position: { type: String, default: "bottom" },
/** 是否允许日期范围 */
enablePeriod: { type: Boolean, default: !1 },
dateFormat: { type: String, default: "yyyy-MM-dd" },
valueFormat: { type: String, default: "yyyy-MM-dd" },
dates: { type: Array, default: [] },
daysInWeek: { type: Array, default: Tn },
/** 禁用日期 */
disableDates: { Type: Array, default: [] },
/** 禁用范围 */
disablePeriod: { Type: Array, default: [] },
/** 自...禁用 */
disableSince: { Type: Object, default: { year: 0, month: 0, day: 0 } },
/** 禁用特定日 */
disableWeekdays: { Type: Array, default: [] },
/** 禁用周末 */
disableWeekends: { Type: Boolean, default: !1 },
/** 到...禁用 */
disableUntil: { Type: Object, default: { year: 0, month: 0, day: 0 } },
/** 是否允许键盘定位 */
enableKeyboadNavigate: { type: Boolean, default: !0 },
/** 是否启用标记当前 */
enableMarkCurrent: { type: Boolean, default: !0 },
/** 每周第一天 */
firstDayOfTheWeek: { type: String, default: "Sun." },
/** 高亮日期 */
highlightDates: { Type: Array, default: [] },
/** 是否高亮周六 */
highlightSaturday: { Type: Boolean, default: !1 },
/** 是否高亮周日 */
highlightSunday: { Type: Boolean, default: !1 },
/** 最晚年限 */
maxYear: { Type: Number, default: 1e4 },
/** 最早年限 */
minYear: { Type: Number, default: 1 },
/** 模式;Embedded;popup; */
mode: { Type: String, default: "Embedded" },
/** 月份 */
months: { type: Array, default: [[]] },
/** 月份名称 */
nameOfMonths: { Type: Object, default: Eo },
/** 二级日期 */
secondaryDates: { type: Array, default: [] },
/** 二级月份 */
secondaryMonths: { type: Array, default: [[]] },
/** 选择的时间*/
selectedDate: { type: Object, default: null },
/** 日期范围组件结束日期 */
selectedSecondDate: { type: Object, default: null },
/** 选择的月份 */
selectedMonth: { type: Object, default: null },
/** 选择期限 */
selectedPeriod: { type: Object, default: null },
/** 选择周 */
selectedWeek: { type: Object, default: null },
/** 选择方式 */
selectMode: { type: String, default: "day" },
/** 显示第几周 */
showWeekNumber: { type: Boolean, default: !1 },
/** 每周标题 */
weekTitle: { type: String, default: "Week" },
/** 年份 */
years: { Type: Array, default: [[]] },
/** 日期时间值 */
value: { type: String, default: null },
/** 是否展示时分秒 */
showTime: { type: Boolean, default: !1 }
}, Lo = Dt(Ro, Ss, Ho, $o, Fs), Es = {
modelValue: {
type: String,
default: ""
},
hourStep: {
type: Number,
default: 1
},
minuteStep: {
type: Number,
default: 1
},
secondStep: {
type: Number,
default: 1
},
defaultOpenValue: {
type: Date,
default: null
},
disabledHours: {
type: Function,
default: null
},
disabledMinutes: {
type: Function,
default: null
},
disabledSeconds: {
type: Function,
default: null
},
format: {
type: String,
default: "HH:mm:ss"
},
isOpen: {
type: Boolean,
default: !1
},
use12Hours: {
type: Boolean,
default: !1
},
showHeader: {
type: Boolean,
default: !1
},
hideDisabledElements: {
type: Boolean,
default: !1
}
};
function Ke(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 je(e, n) {
return e instanceof Date ? new e.constructor(n) : new Date(n);
}
function Wo(e, n) {
const t = Ke(e);
return isNaN(n) ? je(e, NaN) : (n && t.setDate(t.getDate() + n), t);
}
const jo = 6048e5, Is = 864e5, Un = 6e4, Xn = 36e5, Bs = 1e3;
let Ns = {};
function Kt() {
return Ns;
}
function Ht(e, n) {
var l, u, f, c;
const t = Kt(), o = (n == null ? void 0 : n.weekStartsOn) ?? ((u = (l = n == null ? void 0 : n.locale) == null ? void 0 : l.options) == null ? void 0 : u.weekStartsOn) ?? t.weekStartsOn ?? ((c = (f = t.locale) == null ? void 0 : f.options) == null ? void 0 : c.weekStartsOn) ?? 0, a = Ke(e), r = a.getDay(), i = (r < o ? 7 : 0) + r - o;
return a.setDate(a.getDate() - i), a.setHours(0, 0, 0, 0), a;
}
function zt(e) {
return Ht(e, { weekStartsOn: 1 });
}
function Ao(e) {
const n = Ke(e), t = n.getFullYear(), o = je(e, 0);
o.setFullYear(t + 1, 0, 4), o.setHours(0, 0, 0, 0);
const a = zt(o), r = je(e, 0);
r.setFullYear(t, 0, 4), r.setHours(0, 0, 0, 0);
const i = zt(r);
return n.getTime() >= a.getTime() ? t + 1 : n.getTime() >= i.getTime() ? t : t - 1;
}
function vo(e) {
const n = Ke(e);
return n.setHours(0, 0, 0, 0), n;
}
function yn(e) {
const n = Ke(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 Vs(e, n) {
const t = vo(e), o = vo(n), a = +t - yn(t), r = +o - yn(o);
return Math.round((a - r) / Is);
}
function Hs(e) {
const n = Ao(e), t = je(e, 0);
return t.setFullYear(n, 0, 4), t.setHours(0, 0, 0, 0), zt(t);
}
function $s(e) {
return e instanceof Date || typeof e == "object" && Object.prototype.toString.call(e) === "[object Date]";
}
function Qn(e) {
if (!$s(e) && typeof e != "number")
return !1;
const n = Ke(e);
return !isNaN(Number(n));
}
function Rs(e) {
const n = Ke(e), t = je(e, 0);
return t.setFullYear(n.getFullYear(), 0, 1), t.setHours(0, 0, 0, 0), t;
}
const Ls = {
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"
}
}, Ws = (e, n, t) => {
let o;
const a = Ls[e];
return typeof a == "string" ? o = a : n === 1 ? o = a.one : o = a.other.replace("{{count}}", n.toString()), t != null && t.addSuffix ? t.comparison && t.comparison > 0 ? "in " + o : o + " ago" : o;
};
function _n(e) {
return (n = {}) => {
const t = n.width ? String(n.width) : e.defaultWidth;
return e.formats[t] || e.formats[e.defaultWidth];
};
}
const js = {
full: "EEEE, MMMM do, y",
long: "MMMM do, y",
medium: "MMM d, y",
short: "MM/dd/yyyy"
}, As = {
full: "h:mm:ss a zzzz",
long: "h:mm:ss a z",
medium: "h:mm:ss a",
short: "h:mm a"
}, Ys = {
full: "{{date}} 'at' {{time}}",
long: "{{date}} 'at' {{time}}",
medium: "{{date}}, {{time}}",
short: "{{date}}, {{time}}"
}, qs = {
date: _n({
formats: js,
defaultWidth: "full"
}),
time: _n({
formats: As,
defaultWidth: "full"
}),
dateTime: _n({
formats: Ys,
defaultWidth: "full"
})
}, Gs = {
lastWeek: "'last' eeee 'at' p",
yesterday: "'yesterday at' p",
today: "'today at' p",
tomorrow: "'tomorrow at' p",
nextWeek: "eeee 'at' p",
other: "P"
}, zs = (e, n, t, o) => Gs[e];
function nn(e) {
return (n, t) => {
const o = t != null && t.context ? String(t.context) : "standalone";
let a;
if (o === "formatting" && e.formattingValues) {
const i = e.defaultFormattingWidth || e.defaultWidth, l = t != null && t.width ? String(t.width) : i;
a = e.formattingValues[l] || e.formattingValues[i];
} else {
const i = e.defaultWidth, l = t != null && t.width ? String(t.width) : e.defaultWidth;
a = e.values[l] || e.values[i];
}
const r = e.argumentCallback ? e.argumentCallback(n) : n;
return a[r];
};
}
const Us = {
narrow: ["B", "A"],
abbreviated: ["BC", "AD"],
wide: ["Before Christ", "Anno Domini"]
}, Xs = {
narrow: ["1", "2", "3", "4"],
abbreviated: ["Q1", "Q2", "Q3", "Q4"],
wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
}, Qs = {
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"
]
}, Ks = {
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"
]
}, Zs = {
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"
}
}, Js = {
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"
}
}, el = (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";
}, tl = {
ordinalNumber: el,
era: nn({
values: Us,
defaultWidth: "wide"
}),
quarter: nn({
values: Xs,
defaultWidth: "wide",
argumentCallback: (e) => e - 1
}),
month: nn({
values: Qs,
defaultWidth: "wide"
}),
day: nn({
values: Ks,
defaultWidth: "wide"
}),
dayPeriod: nn({
values: Zs,
defaultWidth: "wide",
formattingValues: Js,
defaultFormattingWidth: "wide"
})
};
function on(e) {
return (n, t = {}) => {
const o = t.width, a = o && e.matchPatterns[o] || e.matchPatterns[e.defaultMatchWidth], r = n.match(a);
if (!r)
return null;
const i = r[0], l = o && e.parsePatterns[o] || e.parsePatterns[e.defaultParseWidth], u = Array.isArray(l) ? ol(l, (s) => s.test(i)) : (
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- I challange you to fix the type
nl(l, (s) => s.test(i))
);
let f;
f = e.valueCallback ? e.valueCallback(u) : u, f = t.valueCallback ? (
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- I challange you to fix the type
t.valueCallback(f)
) : f;
const c = n.slice(i.length);
return { value: f, rest: c };
};
}
function nl(e, n) {
for (const t in e)
if (Object.prototype.hasOwnProperty.call(e, t) && n(e[t]))
return t;
}
function ol(e, n) {
for (let t = 0; t < e.length; t++)
if (n(e[t]))
return t;
}
function al(e) {
return (n, t = {}) => {
const o = n.match(e.matchPattern);
if (!o) return null;
const a = o[0], r = n.match(e.parsePattern);
if (!r) return null;
let i = e.valueCallback ? e.valueCallback(r[0]) : r[0];
i = t.valueCallback ? t.valueCallback(i) : i;
const l = n.slice(a.length);
return { value: i, rest: l };
};
}
const rl = /^(\d+)(th|st|nd|rd)?/i, il = /\d+/i, sl = {
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
}, ll = {
any: [/^b/i, /^(a|c)/i]
}, ul = {
narrow: /^[1234]/i,
abbreviated: /^q[1234]/i,
wide: /^[1234](th|st|nd|rd)? quarter/i
}, cl = {
any: [/1/i, /2/i, /3/i, /4/i]
}, dl = {
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
}, fl = {
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
]
}, pl = {
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
}, ml = {
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]
}, hl = {
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
}, vl = {
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
}
}, yl = {
ordinalNumber: al({
matchPattern: rl,
parsePattern: il,
valueCallback: (e) => parseInt(e, 10)
}),
era: on({
matchPatterns: sl,
defaultMatchWidth: "wide",
parsePatterns: ll,
defaultParseWidth: "any"
}),
quarter: on({
matchPatterns: ul,
defaultMatchWidth: "wide",
parsePatterns: cl,
defaultParseWidth: "any",
valueCallback: (e) => e + 1
}),
month: on({
matchPatterns: dl,
defaultMatchWidth: "wide",
parsePatterns: fl,
defaultParseWidth: "any"
}),
day: on({
matchPatterns: pl,
defaultMatchWidth: "wide",
parsePatterns: ml,
defaultParseWidth: "any"
}),
dayPeriod: on({
matchPatterns: hl,
defaultMatchWidth: "any",
parsePatterns: vl,
defaultParseWidth: "any"
})
}, Yo = {
code: "en-US",
formatDistance: Ws,
formatLong: qs,
formatRelative: zs,
localize: tl,
match: yl,
options: {
weekStartsOn: 0,
firstWeekContainsDate: 1
}
};
function gl(e) {
const n = Ke(e);
return Vs(n, Rs(n)) + 1;
}
function qo(e) {
const n = Ke(e), t = +zt(n) - +Hs(n);
return Math.round(t / jo) + 1;
}
function Kn(e, n) {
var c, s, d, v;
const t = Ke(e), o = t.getFullYear(), a = Kt(), r = (n == null ? void 0 : n.firstWeekContainsDate) ?? ((s = (c = n == null ? void 0 : n.locale) == null ? void 0 : c.options) == null ? void 0 : s.firstWeekContainsDate) ?? a.firstWeekContainsDate ?? ((v = (d = a.locale) == null ? void 0 : d.options) == null ? void 0 : v.firstWeekContainsDate) ?? 1, i = je(e, 0);
i.setFullYear(o + 1, 0, r), i.setHours(0, 0, 0, 0);
const l = Ht(i, n), u = je(e, 0);
u.setFullYear(o, 0, r), u.setHours(0, 0, 0, 0);
const f = Ht(u, n);
return t.getTime() >= l.getTime() ? o + 1 : t.getTime() >= f.getTime() ? o : o - 1;
}
function bl(e, n) {
var l, u, f, c;
const t = Kt(), o = (n == null ? void 0 : n.firstWeekContainsDate) ?? ((u = (l = n == null ? void 0 : n.locale) == null ? void 0 : l.options) == null ? void 0 : u.firstWeekContainsDate) ?? t.firstWeekContainsDate ?? ((c = (f = t.locale) == null ? void 0 : f.options) == null ? void 0 : c.firstWeekContainsDate) ?? 1, a = Kn(e, n), r = je(e, 0);
return r.setFullYear(a, 0, o), r.setHours(0, 0, 0, 0), Ht(r, n);
}
function Go(e, n) {
const t = Ke(e), o = +Ht(t, n) - +bl(t, n);
return Math.round(o / jo) + 1;
}
function Fe(e, n) {
const t = e < 0 ? "-" : "", o = Math.abs(e).toString().padStart(n, "0");
return t + o;
}
const It = {
// Year
y(e, n) {
const t = e.getFullYear(), o = t > 0 ? t : 1 - t;
return Fe(n === "yy" ? o % 100 : o, n.length);
},
// Month
M(e, n) {
const t = e.getMonth();
return n === "M" ? String(t + 1) : Fe(t + 1, 2);
},
// Day of the month
d(e, n) {
return Fe(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 Fe(e.getHours() % 12 || 12, n.length);
},
// Hour [0-23]
H(e, n) {
return Fe(e.getHours(), n.length);
},
// Minute
m(e, n) {
return Fe(e.getMinutes(), n.length);
},
// Second
s(e, n) {
return Fe(e.getSeconds(), n.length);
},
// Fraction of second
S(e, n) {
const t = n.length, o = e.getMilliseconds(), a = Math.trunc(
o * Math.pow(10, t - 3)
);
return Fe(a, n.length);
}
}, At = {
am: "am",
pm: "pm",
midnight: "midnight",
noon: "noon",
morning: "morning",
afternoon: "afternoon",
evening: "evening",
night: "night"
}, yo = {
// 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(), a = o > 0 ? o : 1 - o;
return t.ordinalNumber(a, { unit: "year" });
}
return It.y(e, n);
},
// Local week-numbering year
Y: function(e, n, t, o) {
const a = Kn(e, o), r = a > 0 ? a : 1 - a;
if (n === "YY") {
const i = r % 100;
return Fe(i, 2);
}
return n === "Yo" ? t.ordinalNumber(r, { unit: "year" }) : Fe(r, n.length);
},
// ISO week-numbering year
R: function(e, n) {
const t = Ao(e);
return Fe(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 Fe(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 Fe(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 Fe(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 It.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 F