@oslokommune/punkt-elements 16.7.1 → 16.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -0
- package/dist/accordion-BB1JrONI.cjs +34 -0
- package/dist/accordion-nNH87Y60.js +130 -0
- package/dist/alert-BEEnTiCb.cjs +33 -0
- package/dist/alert-ePJuDtmm.js +171 -0
- package/dist/async-directive-B9P1Qa0k.cjs +1 -0
- package/dist/async-directive-CaQiqjyV.js +55 -0
- package/dist/backlink-Ba03LlbB.cjs +13 -0
- package/dist/backlink-CiwXrQYD.js +38 -0
- package/dist/booleanish-BmcOU-43.js +11 -0
- package/dist/booleanish-jJLlnr6-.cjs +1 -0
- package/dist/breadcrumbs-CD1zib3s.cjs +43 -0
- package/dist/breadcrumbs-CpuVqWhF.js +76 -0
- package/dist/button-BIpd1xJh.js +95 -0
- package/dist/button-D-TOBaJB.cjs +27 -0
- package/dist/calendar-BzEtOJla.js +2031 -0
- package/dist/calendar-E5jJLt8D.cjs +90 -0
- package/dist/card-BYJu1MYm.js +339 -0
- package/dist/card-CUFhMVim.cjs +87 -0
- package/dist/checkbox-BARDb9iV.cjs +31 -0
- package/dist/checkbox-Cspxcvt_.js +111 -0
- package/dist/class-map-C8HuhNzZ.js +27 -0
- package/dist/class-map-CJ-msbHs.cjs +1 -0
- package/dist/classutils-DEL164Ur.js +7 -0
- package/dist/classutils-z8YsPlOf.cjs +1 -0
- package/dist/combobox-BcdLZRDU.js +984 -0
- package/dist/combobox-CGbFTWq_.cjs +135 -0
- package/dist/consent-DeB_5sWH.js +197 -0
- package/dist/consent-hwu7pp3S.cjs +11 -0
- package/dist/datepicker-DpmlsnH_.cjs +273 -0
- package/dist/datepicker-OVd8pmnZ.js +1125 -0
- package/dist/dialog-polyfill.esm-1hPr0gl9.js +280 -0
- package/dist/dialog-polyfill.esm-D3Oinvk0.cjs +1 -0
- package/dist/directive-3THFsVew.js +28 -0
- package/dist/directive-CJ2giQBZ.cjs +1 -0
- package/dist/directive-helpers-D1QSxY17.cjs +1 -0
- package/dist/directive-helpers-Dkv2gKgs.js +25 -0
- package/dist/element-DjtxO-1r.cjs +2 -0
- package/dist/element-cZ85T_aa.js +693 -0
- package/dist/element-with-slot-4J2o3SeU.js +166 -0
- package/dist/element-with-slot-CWoTGA1B.cjs +1 -0
- package/dist/header-DWgPgGfS.cjs +304 -0
- package/dist/header-a6ztVNp3.js +782 -0
- package/dist/heading-BgSWIRii.cjs +1 -0
- package/dist/heading-DiQLPxdf.js +73 -0
- package/dist/helptext-CCBKKLus.js +65 -0
- package/dist/helptext-D-3QfZv5.cjs +24 -0
- package/dist/icon-Co72KtgF.js +86 -0
- package/dist/icon-Dr8sfT2X.cjs +1 -0
- package/dist/if-defined-Cjj8qN-Z.js +5 -0
- package/dist/if-defined-XKOD_t_V.cjs +1 -0
- package/dist/index.d.ts +1 -2
- package/dist/input-element-B1yxcfz4.cjs +1 -0
- package/dist/input-element-Bw1s6NlF.js +643 -0
- package/dist/input-wrapper-BRuVELpK.cjs +54 -0
- package/dist/input-wrapper-CDyHTR1V.js +164 -0
- package/dist/input-wrapper-Dwd-_sKm.cjs +1 -0
- package/dist/input-wrapper-YfTmpSSY.js +117 -0
- package/dist/link-CKAFMz9j.js +89 -0
- package/dist/link-CyTCpI0k.cjs +7 -0
- package/dist/linkcard-B0KOGaGj.js +55 -0
- package/dist/linkcard-BE4-FewK.cjs +13 -0
- package/dist/listbox-DCA2JoPV.cjs +106 -0
- package/dist/listbox-DuBgTFvH.js +397 -0
- package/dist/loader-6kFZUErT.js +66 -0
- package/dist/loader-CX2rsC01.cjs +16 -0
- package/dist/messagebox-Cwlg5sOr.js +110 -0
- package/dist/messagebox-Din9X53b.cjs +13 -0
- package/dist/modal-C_wtsh9m.js +209 -0
- package/dist/modal-DS_wUOIv.cjs +36 -0
- package/dist/pkt-accordion.cjs +1 -1
- package/dist/pkt-accordion.js +2 -7
- package/dist/pkt-alert.cjs +1 -1
- package/dist/pkt-alert.js +2 -6
- package/dist/pkt-backlink.cjs +1 -1
- package/dist/pkt-backlink.js +2 -6
- package/dist/pkt-breadcrumbs.cjs +1 -43
- package/dist/pkt-breadcrumbs.js +2 -79
- package/dist/pkt-button.cjs +1 -1
- package/dist/pkt-button.js +2 -6
- package/dist/pkt-calendar.cjs +1 -1
- package/dist/pkt-calendar.js +2 -6
- package/dist/pkt-card.cjs +1 -1
- package/dist/pkt-card.js +2 -6
- package/dist/pkt-checkbox.cjs +1 -1
- package/dist/pkt-checkbox.js +2 -6
- package/dist/pkt-combobox.cjs +1 -1
- package/dist/pkt-combobox.js +2 -6
- package/dist/pkt-consent.cjs +1 -1
- package/dist/pkt-consent.js +2 -6
- package/dist/pkt-datepicker.cjs +1 -1
- package/dist/pkt-datepicker.js +5 -10
- package/dist/pkt-header.cjs +1 -304
- package/dist/pkt-header.js +2 -855
- package/dist/pkt-heading.cjs +1 -1
- package/dist/pkt-heading.js +2 -6
- package/dist/pkt-helptext.cjs +1 -1
- package/dist/pkt-helptext.js +2 -6
- package/dist/pkt-icon.cjs +1 -1
- package/dist/pkt-icon.js +2 -6
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +30 -66
- package/dist/pkt-input-wrapper.cjs +1 -1
- package/dist/pkt-input-wrapper.js +2 -6
- package/dist/pkt-link.cjs +1 -1
- package/dist/pkt-link.js +2 -6
- package/dist/pkt-linkcard.cjs +1 -1
- package/dist/pkt-linkcard.js +2 -6
- package/dist/pkt-listbox.cjs +1 -1
- package/dist/pkt-listbox.js +2 -6
- package/dist/pkt-loader.cjs +1 -1
- package/dist/pkt-loader.js +2 -6
- package/dist/pkt-messagebox.cjs +1 -1
- package/dist/pkt-messagebox.js +2 -6
- package/dist/pkt-modal.cjs +1 -1
- package/dist/pkt-modal.js +2 -6
- package/dist/pkt-options-controller-CRrI6WMk.js +43 -0
- package/dist/pkt-options-controller-CXUGx134.cjs +1 -0
- package/dist/pkt-progressbar.cjs +1 -1
- package/dist/pkt-progressbar.js +2 -6
- package/dist/pkt-radiobutton.cjs +1 -1
- package/dist/pkt-radiobutton.js +2 -6
- package/dist/pkt-select.cjs +1 -1
- package/dist/pkt-select.js +2 -6
- package/dist/pkt-tabs.cjs +1 -1
- package/dist/pkt-tabs.js +2 -7
- package/dist/pkt-tag.cjs +1 -1
- package/dist/pkt-tag.js +2 -6
- package/dist/pkt-textarea.cjs +1 -1
- package/dist/pkt-textarea.js +2 -6
- package/dist/pkt-textinput.cjs +1 -1
- package/dist/pkt-textinput.js +2 -6
- package/dist/pkt-timepicker.cjs +1 -191
- package/dist/pkt-timepicker.js +2 -558
- package/dist/progressbar-CdXtmOBb.cjs +17 -0
- package/dist/progressbar-Dy9AiYQz.js +113 -0
- package/dist/radiobutton-GOnpUbCW.cjs +31 -0
- package/dist/radiobutton-V_KPbup_.js +84 -0
- package/dist/ref-BaJ0mBT_.cjs +1 -0
- package/dist/ref-RS8Uv6uC.js +30 -0
- package/dist/repeat-Cepr3469.js +57 -0
- package/dist/repeat-CqcDYBxr.cjs +1 -0
- package/dist/select-BSAFd8Wa.js +164 -0
- package/dist/select-C2i8sOk5.cjs +49 -0
- package/dist/tabs-D8nL9rWx.cjs +37 -0
- package/dist/tabs-Y7utmJi9.js +318 -0
- package/dist/tag-DLthw5b4.cjs +27 -0
- package/dist/tag-VwykmuQR.js +179 -0
- package/dist/textarea-D7aGOyDf.cjs +46 -0
- package/dist/textarea-DYOBhJrN.js +115 -0
- package/dist/textinput-BUgntXnM.js +124 -0
- package/dist/textinput-DFh8_9cx.cjs +70 -0
- package/dist/timepicker-BIfE7KKJ.cjs +191 -0
- package/dist/timepicker-DaSwn1FA.js +503 -0
- package/dist/utils-CUqCKGvp.js +7 -0
- package/dist/utils-CjAbIttF.cjs +1 -0
- package/package.json +6 -6
- package/src/components/accordion/accordion.ts +6 -1
- package/src/components/accordion/accordionitem.ts +6 -1
- package/src/components/alert/alert.test.ts +1 -1
- package/src/components/alert/alert.ts +12 -7
- package/src/components/backlink/backlink.ts +6 -1
- package/src/components/breadcrumbs/breadcrumbs.ts +6 -1
- package/src/components/button/button.ts +6 -1
- package/src/components/calendar/calendar.ts +6 -1
- package/src/components/card/card.ts +6 -1
- package/src/components/checkbox/checkbox.ts +6 -1
- package/src/components/combobox/combobox.ts +6 -1
- package/src/components/consent/consent.ts +6 -1
- package/src/components/datepicker/date-tags.ts +6 -1
- package/src/components/datepicker/datepicker-multiple.ts +6 -1
- package/src/components/datepicker/datepicker-popup.ts +6 -1
- package/src/components/datepicker/datepicker-range.ts +6 -1
- package/src/components/datepicker/datepicker-single.ts +6 -1
- package/src/components/datepicker/datepicker-utils.test.ts +16 -23
- package/src/components/datepicker/datepicker.ts +6 -1
- package/src/components/header/header-service.ts +6 -1
- package/src/components/header/header-user-menu.ts +6 -1
- package/src/components/header/header.ts +6 -1
- package/src/components/heading/heading.ts +6 -1
- package/src/components/helptext/helptext.ts +6 -1
- package/src/components/icon/icon.ts +6 -1
- package/src/components/input-wrapper/input-wrapper.ts +6 -1
- package/src/components/link/link.ts +6 -1
- package/src/components/linkcard/linkcard.ts +6 -1
- package/src/components/listbox/listbox.ts +6 -1
- package/src/components/loader/loader.ts +6 -1
- package/src/components/messagebox/messagebox.ts +6 -1
- package/src/components/modal/modal.ts +6 -1
- package/src/components/progressbar/progressbar.ts +6 -1
- package/src/components/radiobutton/radiobutton.ts +6 -1
- package/src/components/select/select.ts +6 -1
- package/src/components/tabs/tabitem.ts +6 -1
- package/src/components/tabs/tabs.ts +6 -1
- package/src/components/tag/tag.ts +6 -1
- package/src/components/textarea/textarea.ts +6 -1
- package/src/components/textinput/textinput.ts +6 -1
- package/src/components/timepicker/timepicker.ts +6 -1
- package/dist/accordionitem-D1Agl1bB.cjs +0 -34
- package/dist/accordionitem-ZlaXvjt5.js +0 -138
- package/dist/alert-BuAXrnKl.js +0 -115
- package/dist/alert-DFkFNTxh.cjs +0 -33
- package/dist/async-directive-CMzWMlZ5.js +0 -65
- package/dist/async-directive-DoMuclel.cjs +0 -5
- package/dist/backlink-EiAXUUZP.cjs +0 -13
- package/dist/backlink-V4DAt17e.js +0 -47
- package/dist/booleanish-BKVonob4.cjs +0 -1
- package/dist/booleanish-C9R0tdXH.js +0 -11
- package/dist/button-DEyvt1LI.js +0 -137
- package/dist/button-DYv5Dg4M.cjs +0 -27
- package/dist/calendar-HIE9nxcc.cjs +0 -90
- package/dist/calendar-S63oreVW.js +0 -2138
- package/dist/card-CyeH6l1c.cjs +0 -87
- package/dist/card-DDiLfuO4.js +0 -231
- package/dist/checkbox-BLlwTABj.cjs +0 -31
- package/dist/checkbox-ejBUa5qQ.js +0 -145
- package/dist/class-map-CEnykyO_.js +0 -34
- package/dist/class-map-CsENJXf1.cjs +0 -5
- package/dist/classutils-BwNK82ZQ.cjs +0 -1
- package/dist/classutils-RQs1k6D9.js +0 -7
- package/dist/combobox-BmxSecfE.js +0 -818
- package/dist/combobox-Hb2V-fPX.cjs +0 -135
- package/dist/consent-iXyx5v6J.js +0 -173
- package/dist/consent-ruWAEVXW.cjs +0 -11
- package/dist/datepicker-CZl7b8Na.js +0 -1158
- package/dist/datepicker-D2H7U6MS.cjs +0 -273
- package/dist/dialog-polyfill.esm-CPKZe7AL.cjs +0 -1
- package/dist/dialog-polyfill.esm-CbjBMXAG.js +0 -395
- package/dist/directive-C7oCP5Bh.cjs +0 -5
- package/dist/directive-helpers-BP2WOx60.cjs +0 -5
- package/dist/directive-helpers-rm-28gIj.js +0 -38
- package/dist/directive-oAbCiebi.js +0 -27
- package/dist/element-CPpT3rFQ.js +0 -638
- package/dist/element-gR_VtSiD.cjs +0 -27
- package/dist/element-with-slot-Dqk6-TRR.js +0 -240
- package/dist/element-with-slot-ZX-up7jO.cjs +0 -1
- package/dist/heading-CKt7cVn7.js +0 -101
- package/dist/heading-Cvz8m1xL.cjs +0 -1
- package/dist/helptext-5Mzp65-F.cjs +0 -24
- package/dist/helptext-jIoWRcCF.js +0 -80
- package/dist/icon-BlKA8YuW.js +0 -103
- package/dist/icon-Bqj9oBbl.cjs +0 -9
- package/dist/if-defined-B0krMLad.js +0 -10
- package/dist/if-defined-BOW3ODSj.cjs +0 -5
- package/dist/input-element-8nLwuQS4.js +0 -837
- package/dist/input-element-DdVhUvva.cjs +0 -1
- package/dist/input-wrapper-B0MkQ0IZ.cjs +0 -54
- package/dist/input-wrapper-B2JpK016.js +0 -179
- package/dist/input-wrapper-CDgenrYA.js +0 -6
- package/dist/input-wrapper-EoSAbU-U.cjs +0 -1
- package/dist/link-R_lNhViF.cjs +0 -7
- package/dist/link-Z_GizclR.js +0 -53
- package/dist/linkcard-BlQvdB1a.js +0 -54
- package/dist/linkcard-C7HbSLlX.cjs +0 -13
- package/dist/listbox-BQKDZvZn.js +0 -438
- package/dist/listbox-CGgV9MAe.cjs +0 -106
- package/dist/loader-Ci3CHU8k.js +0 -93
- package/dist/loader-e2gs_1xz.cjs +0 -16
- package/dist/messagebox-Bf-XMlvW.js +0 -69
- package/dist/messagebox-D67w71VX.cjs +0 -13
- package/dist/modal-CyvEkbfQ.cjs +0 -36
- package/dist/modal-DzGe1g8Z.js +0 -154
- package/dist/pkt-options-controller-5LXbEzuk.cjs +0 -1
- package/dist/pkt-options-controller-B5YalfCb.js +0 -39
- package/dist/progressbar-By7e0lEI.js +0 -162
- package/dist/progressbar-DsJ2B9Vm.cjs +0 -21
- package/dist/radiobutton-6frNG9J_.js +0 -111
- package/dist/radiobutton-Bv-BZ1Hw.cjs +0 -31
- package/dist/ref-Bg_Swj5w.js +0 -42
- package/dist/ref-CL-Xk9Xm.cjs +0 -5
- package/dist/repeat-BD8TKgJb.js +0 -61
- package/dist/repeat-Cfq8CDlf.cjs +0 -5
- package/dist/select-CXZt1nHS.js +0 -228
- package/dist/select-WFhS4Vfp.cjs +0 -49
- package/dist/state-C_1EOo3D.js +0 -12
- package/dist/state-Dg-53wQ8.cjs +0 -5
- package/dist/tabitem-CB8wkKmv.js +0 -332
- package/dist/tabitem-DZpspU4Q.cjs +0 -65
- package/dist/tag-BuCpqaks.js +0 -115
- package/dist/tag-X6xdjR0N.cjs +0 -27
- package/dist/textarea-Bzuymclz.js +0 -131
- package/dist/textarea-DoeHJ7HR.cjs +0 -50
- package/dist/textinput-9lHjs4ce.js +0 -150
- package/dist/textinput-BNsLd26i.cjs +0 -70
- package/dist/utils-DznhwRXm.js +0 -8
- package/dist/utils-byXsEz1u.cjs +0 -1
|
@@ -1,2138 +0,0 @@
|
|
|
1
|
-
import { e as rt } from "./class-map-CEnykyO_.js";
|
|
2
|
-
import { P as Pt, b as D, A as at, n as f, t as Nt } from "./element-CPpT3rFQ.js";
|
|
3
|
-
import { r as Z } from "./state-C_1EOo3D.js";
|
|
4
|
-
import "./icon-BlKA8YuW.js";
|
|
5
|
-
const yt = 6048e5, Ct = 864e5, st = Symbol.for("constructDateFrom");
|
|
6
|
-
function k(t, e) {
|
|
7
|
-
return typeof t == "function" ? t(e) : t && typeof t == "object" && st in t ? t[st](e) : t instanceof Date ? new t.constructor(e) : new Date(e);
|
|
8
|
-
}
|
|
9
|
-
function b(t, e) {
|
|
10
|
-
return k(e || t, t);
|
|
11
|
-
}
|
|
12
|
-
function it(t, e, n) {
|
|
13
|
-
const r = b(t, n == null ? void 0 : n.in);
|
|
14
|
-
return isNaN(e) ? k(t, NaN) : (e && r.setDate(r.getDate() + e), r);
|
|
15
|
-
}
|
|
16
|
-
let $t = {};
|
|
17
|
-
function q() {
|
|
18
|
-
return $t;
|
|
19
|
-
}
|
|
20
|
-
function R(t, e) {
|
|
21
|
-
var o, c, d, g;
|
|
22
|
-
const n = q(), r = (e == null ? void 0 : e.weekStartsOn) ?? ((c = (o = e == null ? void 0 : e.locale) == null ? void 0 : o.options) == null ? void 0 : c.weekStartsOn) ?? n.weekStartsOn ?? ((g = (d = n.locale) == null ? void 0 : d.options) == null ? void 0 : g.weekStartsOn) ?? 0, a = b(t, e == null ? void 0 : e.in), s = a.getDay(), i = (s < r ? 7 : 0) + s - r;
|
|
23
|
-
return a.setDate(a.getDate() - i), a.setHours(0, 0, 0, 0), a;
|
|
24
|
-
}
|
|
25
|
-
function B(t, e) {
|
|
26
|
-
return R(t, { ...e, weekStartsOn: 1 });
|
|
27
|
-
}
|
|
28
|
-
function pt(t, e) {
|
|
29
|
-
const n = b(t, e == null ? void 0 : e.in), r = n.getFullYear(), a = k(n, 0);
|
|
30
|
-
a.setFullYear(r + 1, 0, 4), a.setHours(0, 0, 0, 0);
|
|
31
|
-
const s = B(a), i = k(n, 0);
|
|
32
|
-
i.setFullYear(r, 0, 4), i.setHours(0, 0, 0, 0);
|
|
33
|
-
const o = B(i);
|
|
34
|
-
return n.getTime() >= s.getTime() ? r + 1 : n.getTime() >= o.getTime() ? r : r - 1;
|
|
35
|
-
}
|
|
36
|
-
function ot(t) {
|
|
37
|
-
const e = b(t), n = new Date(
|
|
38
|
-
Date.UTC(
|
|
39
|
-
e.getFullYear(),
|
|
40
|
-
e.getMonth(),
|
|
41
|
-
e.getDate(),
|
|
42
|
-
e.getHours(),
|
|
43
|
-
e.getMinutes(),
|
|
44
|
-
e.getSeconds(),
|
|
45
|
-
e.getMilliseconds()
|
|
46
|
-
)
|
|
47
|
-
);
|
|
48
|
-
return n.setUTCFullYear(e.getFullYear()), +t - +n;
|
|
49
|
-
}
|
|
50
|
-
function wt(t, ...e) {
|
|
51
|
-
const n = k.bind(
|
|
52
|
-
null,
|
|
53
|
-
e.find((r) => typeof r == "object")
|
|
54
|
-
);
|
|
55
|
-
return e.map(n);
|
|
56
|
-
}
|
|
57
|
-
function J(t, e) {
|
|
58
|
-
const n = b(t, e == null ? void 0 : e.in);
|
|
59
|
-
return n.setHours(0, 0, 0, 0), n;
|
|
60
|
-
}
|
|
61
|
-
function Et(t, e, n) {
|
|
62
|
-
const [r, a] = wt(
|
|
63
|
-
n == null ? void 0 : n.in,
|
|
64
|
-
t,
|
|
65
|
-
e
|
|
66
|
-
), s = J(r), i = J(a), o = +s - ot(s), c = +i - ot(i);
|
|
67
|
-
return Math.round((o - c) / Ct);
|
|
68
|
-
}
|
|
69
|
-
function Wt(t, e) {
|
|
70
|
-
const n = pt(t, e), r = k(t, 0);
|
|
71
|
-
return r.setFullYear(n, 0, 4), r.setHours(0, 0, 0, 0), B(r);
|
|
72
|
-
}
|
|
73
|
-
function _t(t) {
|
|
74
|
-
return t instanceof Date || typeof t == "object" && Object.prototype.toString.call(t) === "[object Date]";
|
|
75
|
-
}
|
|
76
|
-
function Yt(t) {
|
|
77
|
-
return !(!_t(t) && typeof t != "number" || isNaN(+b(t)));
|
|
78
|
-
}
|
|
79
|
-
function Ft(t, e) {
|
|
80
|
-
const n = b(t, e == null ? void 0 : e.in);
|
|
81
|
-
return n.setHours(23, 59, 59, 999), n;
|
|
82
|
-
}
|
|
83
|
-
function It(t, e) {
|
|
84
|
-
const [n, r] = wt(t, e.start, e.end);
|
|
85
|
-
return { start: n, end: r };
|
|
86
|
-
}
|
|
87
|
-
function bt(t, e) {
|
|
88
|
-
const { start: n, end: r } = It(e == null ? void 0 : e.in, t);
|
|
89
|
-
let a = +n > +r;
|
|
90
|
-
const s = a ? +n : +r, i = a ? r : n;
|
|
91
|
-
i.setHours(0, 0, 0, 0);
|
|
92
|
-
let o = 1;
|
|
93
|
-
const c = [];
|
|
94
|
-
for (; +i <= s; )
|
|
95
|
-
c.push(k(n, i)), i.setDate(i.getDate() + o), i.setHours(0, 0, 0, 0);
|
|
96
|
-
return a ? c.reverse() : c;
|
|
97
|
-
}
|
|
98
|
-
function At(t, e) {
|
|
99
|
-
const n = b(t, e == null ? void 0 : e.in);
|
|
100
|
-
return n.setFullYear(n.getFullYear(), 0, 1), n.setHours(0, 0, 0, 0), n;
|
|
101
|
-
}
|
|
102
|
-
const Ht = {
|
|
103
|
-
lessThanXSeconds: {
|
|
104
|
-
one: "less than a second",
|
|
105
|
-
other: "less than {{count}} seconds"
|
|
106
|
-
},
|
|
107
|
-
xSeconds: {
|
|
108
|
-
one: "1 second",
|
|
109
|
-
other: "{{count}} seconds"
|
|
110
|
-
},
|
|
111
|
-
halfAMinute: "half a minute",
|
|
112
|
-
lessThanXMinutes: {
|
|
113
|
-
one: "less than a minute",
|
|
114
|
-
other: "less than {{count}} minutes"
|
|
115
|
-
},
|
|
116
|
-
xMinutes: {
|
|
117
|
-
one: "1 minute",
|
|
118
|
-
other: "{{count}} minutes"
|
|
119
|
-
},
|
|
120
|
-
aboutXHours: {
|
|
121
|
-
one: "about 1 hour",
|
|
122
|
-
other: "about {{count}} hours"
|
|
123
|
-
},
|
|
124
|
-
xHours: {
|
|
125
|
-
one: "1 hour",
|
|
126
|
-
other: "{{count}} hours"
|
|
127
|
-
},
|
|
128
|
-
xDays: {
|
|
129
|
-
one: "1 day",
|
|
130
|
-
other: "{{count}} days"
|
|
131
|
-
},
|
|
132
|
-
aboutXWeeks: {
|
|
133
|
-
one: "about 1 week",
|
|
134
|
-
other: "about {{count}} weeks"
|
|
135
|
-
},
|
|
136
|
-
xWeeks: {
|
|
137
|
-
one: "1 week",
|
|
138
|
-
other: "{{count}} weeks"
|
|
139
|
-
},
|
|
140
|
-
aboutXMonths: {
|
|
141
|
-
one: "about 1 month",
|
|
142
|
-
other: "about {{count}} months"
|
|
143
|
-
},
|
|
144
|
-
xMonths: {
|
|
145
|
-
one: "1 month",
|
|
146
|
-
other: "{{count}} months"
|
|
147
|
-
},
|
|
148
|
-
aboutXYears: {
|
|
149
|
-
one: "about 1 year",
|
|
150
|
-
other: "about {{count}} years"
|
|
151
|
-
},
|
|
152
|
-
xYears: {
|
|
153
|
-
one: "1 year",
|
|
154
|
-
other: "{{count}} years"
|
|
155
|
-
},
|
|
156
|
-
overXYears: {
|
|
157
|
-
one: "over 1 year",
|
|
158
|
-
other: "over {{count}} years"
|
|
159
|
-
},
|
|
160
|
-
almostXYears: {
|
|
161
|
-
one: "almost 1 year",
|
|
162
|
-
other: "almost {{count}} years"
|
|
163
|
-
}
|
|
164
|
-
}, Rt = (t, e, n) => {
|
|
165
|
-
let r;
|
|
166
|
-
const a = Ht[t];
|
|
167
|
-
return typeof a == "string" ? r = a : e === 1 ? r = a.one : r = a.other.replace("{{count}}", e.toString()), n != null && n.addSuffix ? n.comparison && n.comparison > 0 ? "in " + r : r + " ago" : r;
|
|
168
|
-
};
|
|
169
|
-
function X(t) {
|
|
170
|
-
return (e = {}) => {
|
|
171
|
-
const n = e.width ? String(e.width) : t.defaultWidth;
|
|
172
|
-
return t.formats[n] || t.formats[t.defaultWidth];
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
const Ut = {
|
|
176
|
-
full: "EEEE, MMMM do, y",
|
|
177
|
-
long: "MMMM do, y",
|
|
178
|
-
medium: "MMM d, y",
|
|
179
|
-
short: "MM/dd/yyyy"
|
|
180
|
-
}, Lt = {
|
|
181
|
-
full: "h:mm:ss a zzzz",
|
|
182
|
-
long: "h:mm:ss a z",
|
|
183
|
-
medium: "h:mm:ss a",
|
|
184
|
-
short: "h:mm a"
|
|
185
|
-
}, Bt = {
|
|
186
|
-
full: "{{date}} 'at' {{time}}",
|
|
187
|
-
long: "{{date}} 'at' {{time}}",
|
|
188
|
-
medium: "{{date}}, {{time}}",
|
|
189
|
-
short: "{{date}}, {{time}}"
|
|
190
|
-
}, qt = {
|
|
191
|
-
date: X({
|
|
192
|
-
formats: Ut,
|
|
193
|
-
defaultWidth: "full"
|
|
194
|
-
}),
|
|
195
|
-
time: X({
|
|
196
|
-
formats: Lt,
|
|
197
|
-
defaultWidth: "full"
|
|
198
|
-
}),
|
|
199
|
-
dateTime: X({
|
|
200
|
-
formats: Bt,
|
|
201
|
-
defaultWidth: "full"
|
|
202
|
-
})
|
|
203
|
-
}, zt = {
|
|
204
|
-
lastWeek: "'last' eeee 'at' p",
|
|
205
|
-
yesterday: "'yesterday at' p",
|
|
206
|
-
today: "'today at' p",
|
|
207
|
-
tomorrow: "'tomorrow at' p",
|
|
208
|
-
nextWeek: "eeee 'at' p",
|
|
209
|
-
other: "P"
|
|
210
|
-
}, jt = (t, e, n, r) => zt[t];
|
|
211
|
-
function F(t) {
|
|
212
|
-
return (e, n) => {
|
|
213
|
-
const r = n != null && n.context ? String(n.context) : "standalone";
|
|
214
|
-
let a;
|
|
215
|
-
if (r === "formatting" && t.formattingValues) {
|
|
216
|
-
const i = t.defaultFormattingWidth || t.defaultWidth, o = n != null && n.width ? String(n.width) : i;
|
|
217
|
-
a = t.formattingValues[o] || t.formattingValues[i];
|
|
218
|
-
} else {
|
|
219
|
-
const i = t.defaultWidth, o = n != null && n.width ? String(n.width) : t.defaultWidth;
|
|
220
|
-
a = t.values[o] || t.values[i];
|
|
221
|
-
}
|
|
222
|
-
const s = t.argumentCallback ? t.argumentCallback(e) : e;
|
|
223
|
-
return a[s];
|
|
224
|
-
};
|
|
225
|
-
}
|
|
226
|
-
const Qt = {
|
|
227
|
-
narrow: ["B", "A"],
|
|
228
|
-
abbreviated: ["BC", "AD"],
|
|
229
|
-
wide: ["Before Christ", "Anno Domini"]
|
|
230
|
-
}, Xt = {
|
|
231
|
-
narrow: ["1", "2", "3", "4"],
|
|
232
|
-
abbreviated: ["Q1", "Q2", "Q3", "Q4"],
|
|
233
|
-
wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
|
|
234
|
-
}, Gt = {
|
|
235
|
-
narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
|
|
236
|
-
abbreviated: [
|
|
237
|
-
"Jan",
|
|
238
|
-
"Feb",
|
|
239
|
-
"Mar",
|
|
240
|
-
"Apr",
|
|
241
|
-
"May",
|
|
242
|
-
"Jun",
|
|
243
|
-
"Jul",
|
|
244
|
-
"Aug",
|
|
245
|
-
"Sep",
|
|
246
|
-
"Oct",
|
|
247
|
-
"Nov",
|
|
248
|
-
"Dec"
|
|
249
|
-
],
|
|
250
|
-
wide: [
|
|
251
|
-
"January",
|
|
252
|
-
"February",
|
|
253
|
-
"March",
|
|
254
|
-
"April",
|
|
255
|
-
"May",
|
|
256
|
-
"June",
|
|
257
|
-
"July",
|
|
258
|
-
"August",
|
|
259
|
-
"September",
|
|
260
|
-
"October",
|
|
261
|
-
"November",
|
|
262
|
-
"December"
|
|
263
|
-
]
|
|
264
|
-
}, Vt = {
|
|
265
|
-
narrow: ["S", "M", "T", "W", "T", "F", "S"],
|
|
266
|
-
short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
|
|
267
|
-
abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
|
|
268
|
-
wide: [
|
|
269
|
-
"Sunday",
|
|
270
|
-
"Monday",
|
|
271
|
-
"Tuesday",
|
|
272
|
-
"Wednesday",
|
|
273
|
-
"Thursday",
|
|
274
|
-
"Friday",
|
|
275
|
-
"Saturday"
|
|
276
|
-
]
|
|
277
|
-
}, Jt = {
|
|
278
|
-
narrow: {
|
|
279
|
-
am: "a",
|
|
280
|
-
pm: "p",
|
|
281
|
-
midnight: "mi",
|
|
282
|
-
noon: "n",
|
|
283
|
-
morning: "morning",
|
|
284
|
-
afternoon: "afternoon",
|
|
285
|
-
evening: "evening",
|
|
286
|
-
night: "night"
|
|
287
|
-
},
|
|
288
|
-
abbreviated: {
|
|
289
|
-
am: "AM",
|
|
290
|
-
pm: "PM",
|
|
291
|
-
midnight: "midnight",
|
|
292
|
-
noon: "noon",
|
|
293
|
-
morning: "morning",
|
|
294
|
-
afternoon: "afternoon",
|
|
295
|
-
evening: "evening",
|
|
296
|
-
night: "night"
|
|
297
|
-
},
|
|
298
|
-
wide: {
|
|
299
|
-
am: "a.m.",
|
|
300
|
-
pm: "p.m.",
|
|
301
|
-
midnight: "midnight",
|
|
302
|
-
noon: "noon",
|
|
303
|
-
morning: "morning",
|
|
304
|
-
afternoon: "afternoon",
|
|
305
|
-
evening: "evening",
|
|
306
|
-
night: "night"
|
|
307
|
-
}
|
|
308
|
-
}, Kt = {
|
|
309
|
-
narrow: {
|
|
310
|
-
am: "a",
|
|
311
|
-
pm: "p",
|
|
312
|
-
midnight: "mi",
|
|
313
|
-
noon: "n",
|
|
314
|
-
morning: "in the morning",
|
|
315
|
-
afternoon: "in the afternoon",
|
|
316
|
-
evening: "in the evening",
|
|
317
|
-
night: "at night"
|
|
318
|
-
},
|
|
319
|
-
abbreviated: {
|
|
320
|
-
am: "AM",
|
|
321
|
-
pm: "PM",
|
|
322
|
-
midnight: "midnight",
|
|
323
|
-
noon: "noon",
|
|
324
|
-
morning: "in the morning",
|
|
325
|
-
afternoon: "in the afternoon",
|
|
326
|
-
evening: "in the evening",
|
|
327
|
-
night: "at night"
|
|
328
|
-
},
|
|
329
|
-
wide: {
|
|
330
|
-
am: "a.m.",
|
|
331
|
-
pm: "p.m.",
|
|
332
|
-
midnight: "midnight",
|
|
333
|
-
noon: "noon",
|
|
334
|
-
morning: "in the morning",
|
|
335
|
-
afternoon: "in the afternoon",
|
|
336
|
-
evening: "in the evening",
|
|
337
|
-
night: "at night"
|
|
338
|
-
}
|
|
339
|
-
}, Zt = (t, e) => {
|
|
340
|
-
const n = Number(t), r = n % 100;
|
|
341
|
-
if (r > 20 || r < 10)
|
|
342
|
-
switch (r % 10) {
|
|
343
|
-
case 1:
|
|
344
|
-
return n + "st";
|
|
345
|
-
case 2:
|
|
346
|
-
return n + "nd";
|
|
347
|
-
case 3:
|
|
348
|
-
return n + "rd";
|
|
349
|
-
}
|
|
350
|
-
return n + "th";
|
|
351
|
-
}, te = {
|
|
352
|
-
ordinalNumber: Zt,
|
|
353
|
-
era: F({
|
|
354
|
-
values: Qt,
|
|
355
|
-
defaultWidth: "wide"
|
|
356
|
-
}),
|
|
357
|
-
quarter: F({
|
|
358
|
-
values: Xt,
|
|
359
|
-
defaultWidth: "wide",
|
|
360
|
-
argumentCallback: (t) => t - 1
|
|
361
|
-
}),
|
|
362
|
-
month: F({
|
|
363
|
-
values: Gt,
|
|
364
|
-
defaultWidth: "wide"
|
|
365
|
-
}),
|
|
366
|
-
day: F({
|
|
367
|
-
values: Vt,
|
|
368
|
-
defaultWidth: "wide"
|
|
369
|
-
}),
|
|
370
|
-
dayPeriod: F({
|
|
371
|
-
values: Jt,
|
|
372
|
-
defaultWidth: "wide",
|
|
373
|
-
formattingValues: Kt,
|
|
374
|
-
defaultFormattingWidth: "wide"
|
|
375
|
-
})
|
|
376
|
-
};
|
|
377
|
-
function I(t) {
|
|
378
|
-
return (e, n = {}) => {
|
|
379
|
-
const r = n.width, a = r && t.matchPatterns[r] || t.matchPatterns[t.defaultMatchWidth], s = e.match(a);
|
|
380
|
-
if (!s)
|
|
381
|
-
return null;
|
|
382
|
-
const i = s[0], o = r && t.parsePatterns[r] || t.parsePatterns[t.defaultParseWidth], c = Array.isArray(o) ? ne(o, (m) => m.test(i)) : (
|
|
383
|
-
// [TODO] -- I challenge you to fix the type
|
|
384
|
-
ee(o, (m) => m.test(i))
|
|
385
|
-
);
|
|
386
|
-
let d;
|
|
387
|
-
d = t.valueCallback ? t.valueCallback(c) : c, d = n.valueCallback ? (
|
|
388
|
-
// [TODO] -- I challenge you to fix the type
|
|
389
|
-
n.valueCallback(d)
|
|
390
|
-
) : d;
|
|
391
|
-
const g = e.slice(i.length);
|
|
392
|
-
return { value: d, rest: g };
|
|
393
|
-
};
|
|
394
|
-
}
|
|
395
|
-
function ee(t, e) {
|
|
396
|
-
for (const n in t)
|
|
397
|
-
if (Object.prototype.hasOwnProperty.call(t, n) && e(t[n]))
|
|
398
|
-
return n;
|
|
399
|
-
}
|
|
400
|
-
function ne(t, e) {
|
|
401
|
-
for (let n = 0; n < t.length; n++)
|
|
402
|
-
if (e(t[n]))
|
|
403
|
-
return n;
|
|
404
|
-
}
|
|
405
|
-
function re(t) {
|
|
406
|
-
return (e, n = {}) => {
|
|
407
|
-
const r = e.match(t.matchPattern);
|
|
408
|
-
if (!r) return null;
|
|
409
|
-
const a = r[0], s = e.match(t.parsePattern);
|
|
410
|
-
if (!s) return null;
|
|
411
|
-
let i = t.valueCallback ? t.valueCallback(s[0]) : s[0];
|
|
412
|
-
i = n.valueCallback ? n.valueCallback(i) : i;
|
|
413
|
-
const o = e.slice(a.length);
|
|
414
|
-
return { value: i, rest: o };
|
|
415
|
-
};
|
|
416
|
-
}
|
|
417
|
-
const ae = /^(\d+)(th|st|nd|rd)?/i, se = /\d+/i, ie = {
|
|
418
|
-
narrow: /^(b|a)/i,
|
|
419
|
-
abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
|
|
420
|
-
wide: /^(before christ|before common era|anno domini|common era)/i
|
|
421
|
-
}, oe = {
|
|
422
|
-
any: [/^b/i, /^(a|c)/i]
|
|
423
|
-
}, ce = {
|
|
424
|
-
narrow: /^[1234]/i,
|
|
425
|
-
abbreviated: /^q[1234]/i,
|
|
426
|
-
wide: /^[1234](th|st|nd|rd)? quarter/i
|
|
427
|
-
}, ue = {
|
|
428
|
-
any: [/1/i, /2/i, /3/i, /4/i]
|
|
429
|
-
}, le = {
|
|
430
|
-
narrow: /^[jfmasond]/i,
|
|
431
|
-
abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
|
|
432
|
-
wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
|
|
433
|
-
}, he = {
|
|
434
|
-
narrow: [
|
|
435
|
-
/^j/i,
|
|
436
|
-
/^f/i,
|
|
437
|
-
/^m/i,
|
|
438
|
-
/^a/i,
|
|
439
|
-
/^m/i,
|
|
440
|
-
/^j/i,
|
|
441
|
-
/^j/i,
|
|
442
|
-
/^a/i,
|
|
443
|
-
/^s/i,
|
|
444
|
-
/^o/i,
|
|
445
|
-
/^n/i,
|
|
446
|
-
/^d/i
|
|
447
|
-
],
|
|
448
|
-
any: [
|
|
449
|
-
/^ja/i,
|
|
450
|
-
/^f/i,
|
|
451
|
-
/^mar/i,
|
|
452
|
-
/^ap/i,
|
|
453
|
-
/^may/i,
|
|
454
|
-
/^jun/i,
|
|
455
|
-
/^jul/i,
|
|
456
|
-
/^au/i,
|
|
457
|
-
/^s/i,
|
|
458
|
-
/^o/i,
|
|
459
|
-
/^n/i,
|
|
460
|
-
/^d/i
|
|
461
|
-
]
|
|
462
|
-
}, de = {
|
|
463
|
-
narrow: /^[smtwf]/i,
|
|
464
|
-
short: /^(su|mo|tu|we|th|fr|sa)/i,
|
|
465
|
-
abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
|
|
466
|
-
wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
|
|
467
|
-
}, fe = {
|
|
468
|
-
narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
|
|
469
|
-
any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
|
|
470
|
-
}, me = {
|
|
471
|
-
narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
|
|
472
|
-
any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
|
|
473
|
-
}, ge = {
|
|
474
|
-
any: {
|
|
475
|
-
am: /^a/i,
|
|
476
|
-
pm: /^p/i,
|
|
477
|
-
midnight: /^mi/i,
|
|
478
|
-
noon: /^no/i,
|
|
479
|
-
morning: /morning/i,
|
|
480
|
-
afternoon: /afternoon/i,
|
|
481
|
-
evening: /evening/i,
|
|
482
|
-
night: /night/i
|
|
483
|
-
}
|
|
484
|
-
}, ye = {
|
|
485
|
-
ordinalNumber: re({
|
|
486
|
-
matchPattern: ae,
|
|
487
|
-
parsePattern: se,
|
|
488
|
-
valueCallback: (t) => parseInt(t, 10)
|
|
489
|
-
}),
|
|
490
|
-
era: I({
|
|
491
|
-
matchPatterns: ie,
|
|
492
|
-
defaultMatchWidth: "wide",
|
|
493
|
-
parsePatterns: oe,
|
|
494
|
-
defaultParseWidth: "any"
|
|
495
|
-
}),
|
|
496
|
-
quarter: I({
|
|
497
|
-
matchPatterns: ce,
|
|
498
|
-
defaultMatchWidth: "wide",
|
|
499
|
-
parsePatterns: ue,
|
|
500
|
-
defaultParseWidth: "any",
|
|
501
|
-
valueCallback: (t) => t + 1
|
|
502
|
-
}),
|
|
503
|
-
month: I({
|
|
504
|
-
matchPatterns: le,
|
|
505
|
-
defaultMatchWidth: "wide",
|
|
506
|
-
parsePatterns: he,
|
|
507
|
-
defaultParseWidth: "any"
|
|
508
|
-
}),
|
|
509
|
-
day: I({
|
|
510
|
-
matchPatterns: de,
|
|
511
|
-
defaultMatchWidth: "wide",
|
|
512
|
-
parsePatterns: fe,
|
|
513
|
-
defaultParseWidth: "any"
|
|
514
|
-
}),
|
|
515
|
-
dayPeriod: I({
|
|
516
|
-
matchPatterns: me,
|
|
517
|
-
defaultMatchWidth: "any",
|
|
518
|
-
parsePatterns: ge,
|
|
519
|
-
defaultParseWidth: "any"
|
|
520
|
-
})
|
|
521
|
-
}, pe = {
|
|
522
|
-
code: "en-US",
|
|
523
|
-
formatDistance: Rt,
|
|
524
|
-
formatLong: qt,
|
|
525
|
-
formatRelative: jt,
|
|
526
|
-
localize: te,
|
|
527
|
-
match: ye,
|
|
528
|
-
options: {
|
|
529
|
-
weekStartsOn: 0,
|
|
530
|
-
firstWeekContainsDate: 1
|
|
531
|
-
}
|
|
532
|
-
};
|
|
533
|
-
function we(t, e) {
|
|
534
|
-
const n = b(t, e == null ? void 0 : e.in);
|
|
535
|
-
return Et(n, At(n)) + 1;
|
|
536
|
-
}
|
|
537
|
-
function be(t, e) {
|
|
538
|
-
const n = b(t, e == null ? void 0 : e.in), r = +B(n) - +Wt(n);
|
|
539
|
-
return Math.round(r / yt) + 1;
|
|
540
|
-
}
|
|
541
|
-
function Dt(t, e) {
|
|
542
|
-
var g, m, v, M;
|
|
543
|
-
const n = b(t, e == null ? void 0 : e.in), r = n.getFullYear(), a = q(), s = (e == null ? void 0 : e.firstWeekContainsDate) ?? ((m = (g = e == null ? void 0 : e.locale) == null ? void 0 : g.options) == null ? void 0 : m.firstWeekContainsDate) ?? a.firstWeekContainsDate ?? ((M = (v = a.locale) == null ? void 0 : v.options) == null ? void 0 : M.firstWeekContainsDate) ?? 1, i = k((e == null ? void 0 : e.in) || t, 0);
|
|
544
|
-
i.setFullYear(r + 1, 0, s), i.setHours(0, 0, 0, 0);
|
|
545
|
-
const o = R(i, e), c = k((e == null ? void 0 : e.in) || t, 0);
|
|
546
|
-
c.setFullYear(r, 0, s), c.setHours(0, 0, 0, 0);
|
|
547
|
-
const d = R(c, e);
|
|
548
|
-
return +n >= +o ? r + 1 : +n >= +d ? r : r - 1;
|
|
549
|
-
}
|
|
550
|
-
function De(t, e) {
|
|
551
|
-
var o, c, d, g;
|
|
552
|
-
const n = q(), r = (e == null ? void 0 : e.firstWeekContainsDate) ?? ((c = (o = e == null ? void 0 : e.locale) == null ? void 0 : o.options) == null ? void 0 : c.firstWeekContainsDate) ?? n.firstWeekContainsDate ?? ((g = (d = n.locale) == null ? void 0 : d.options) == null ? void 0 : g.firstWeekContainsDate) ?? 1, a = Dt(t, e), s = k((e == null ? void 0 : e.in) || t, 0);
|
|
553
|
-
return s.setFullYear(a, 0, r), s.setHours(0, 0, 0, 0), R(s, e);
|
|
554
|
-
}
|
|
555
|
-
function St(t, e) {
|
|
556
|
-
const n = b(t, e == null ? void 0 : e.in), r = +R(n, e) - +De(n, e);
|
|
557
|
-
return Math.round(r / yt) + 1;
|
|
558
|
-
}
|
|
559
|
-
function u(t, e) {
|
|
560
|
-
const n = t < 0 ? "-" : "", r = Math.abs(t).toString().padStart(e, "0");
|
|
561
|
-
return n + r;
|
|
562
|
-
}
|
|
563
|
-
const T = {
|
|
564
|
-
// Year
|
|
565
|
-
y(t, e) {
|
|
566
|
-
const n = t.getFullYear(), r = n > 0 ? n : 1 - n;
|
|
567
|
-
return u(e === "yy" ? r % 100 : r, e.length);
|
|
568
|
-
},
|
|
569
|
-
// Month
|
|
570
|
-
M(t, e) {
|
|
571
|
-
const n = t.getMonth();
|
|
572
|
-
return e === "M" ? String(n + 1) : u(n + 1, 2);
|
|
573
|
-
},
|
|
574
|
-
// Day of the month
|
|
575
|
-
d(t, e) {
|
|
576
|
-
return u(t.getDate(), e.length);
|
|
577
|
-
},
|
|
578
|
-
// AM or PM
|
|
579
|
-
a(t, e) {
|
|
580
|
-
const n = t.getHours() / 12 >= 1 ? "pm" : "am";
|
|
581
|
-
switch (e) {
|
|
582
|
-
case "a":
|
|
583
|
-
case "aa":
|
|
584
|
-
return n.toUpperCase();
|
|
585
|
-
case "aaa":
|
|
586
|
-
return n;
|
|
587
|
-
case "aaaaa":
|
|
588
|
-
return n[0];
|
|
589
|
-
case "aaaa":
|
|
590
|
-
default:
|
|
591
|
-
return n === "am" ? "a.m." : "p.m.";
|
|
592
|
-
}
|
|
593
|
-
},
|
|
594
|
-
// Hour [1-12]
|
|
595
|
-
h(t, e) {
|
|
596
|
-
return u(t.getHours() % 12 || 12, e.length);
|
|
597
|
-
},
|
|
598
|
-
// Hour [0-23]
|
|
599
|
-
H(t, e) {
|
|
600
|
-
return u(t.getHours(), e.length);
|
|
601
|
-
},
|
|
602
|
-
// Minute
|
|
603
|
-
m(t, e) {
|
|
604
|
-
return u(t.getMinutes(), e.length);
|
|
605
|
-
},
|
|
606
|
-
// Second
|
|
607
|
-
s(t, e) {
|
|
608
|
-
return u(t.getSeconds(), e.length);
|
|
609
|
-
},
|
|
610
|
-
// Fraction of second
|
|
611
|
-
S(t, e) {
|
|
612
|
-
const n = e.length, r = t.getMilliseconds(), a = Math.trunc(
|
|
613
|
-
r * Math.pow(10, n - 3)
|
|
614
|
-
);
|
|
615
|
-
return u(a, e.length);
|
|
616
|
-
}
|
|
617
|
-
}, E = {
|
|
618
|
-
midnight: "midnight",
|
|
619
|
-
noon: "noon",
|
|
620
|
-
morning: "morning",
|
|
621
|
-
afternoon: "afternoon",
|
|
622
|
-
evening: "evening",
|
|
623
|
-
night: "night"
|
|
624
|
-
}, ct = {
|
|
625
|
-
// Era
|
|
626
|
-
G: function(t, e, n) {
|
|
627
|
-
const r = t.getFullYear() > 0 ? 1 : 0;
|
|
628
|
-
switch (e) {
|
|
629
|
-
// AD, BC
|
|
630
|
-
case "G":
|
|
631
|
-
case "GG":
|
|
632
|
-
case "GGG":
|
|
633
|
-
return n.era(r, { width: "abbreviated" });
|
|
634
|
-
// A, B
|
|
635
|
-
case "GGGGG":
|
|
636
|
-
return n.era(r, { width: "narrow" });
|
|
637
|
-
// Anno Domini, Before Christ
|
|
638
|
-
case "GGGG":
|
|
639
|
-
default:
|
|
640
|
-
return n.era(r, { width: "wide" });
|
|
641
|
-
}
|
|
642
|
-
},
|
|
643
|
-
// Year
|
|
644
|
-
y: function(t, e, n) {
|
|
645
|
-
if (e === "yo") {
|
|
646
|
-
const r = t.getFullYear(), a = r > 0 ? r : 1 - r;
|
|
647
|
-
return n.ordinalNumber(a, { unit: "year" });
|
|
648
|
-
}
|
|
649
|
-
return T.y(t, e);
|
|
650
|
-
},
|
|
651
|
-
// Local week-numbering year
|
|
652
|
-
Y: function(t, e, n, r) {
|
|
653
|
-
const a = Dt(t, r), s = a > 0 ? a : 1 - a;
|
|
654
|
-
if (e === "YY") {
|
|
655
|
-
const i = s % 100;
|
|
656
|
-
return u(i, 2);
|
|
657
|
-
}
|
|
658
|
-
return e === "Yo" ? n.ordinalNumber(s, { unit: "year" }) : u(s, e.length);
|
|
659
|
-
},
|
|
660
|
-
// ISO week-numbering year
|
|
661
|
-
R: function(t, e) {
|
|
662
|
-
const n = pt(t);
|
|
663
|
-
return u(n, e.length);
|
|
664
|
-
},
|
|
665
|
-
// Extended year. This is a single number designating the year of this calendar system.
|
|
666
|
-
// The main difference between `y` and `u` localizers are B.C. years:
|
|
667
|
-
// | Year | `y` | `u` |
|
|
668
|
-
// |------|-----|-----|
|
|
669
|
-
// | AC 1 | 1 | 1 |
|
|
670
|
-
// | BC 1 | 1 | 0 |
|
|
671
|
-
// | BC 2 | 2 | -1 |
|
|
672
|
-
// Also `yy` always returns the last two digits of a year,
|
|
673
|
-
// while `uu` pads single digit years to 2 characters and returns other years unchanged.
|
|
674
|
-
u: function(t, e) {
|
|
675
|
-
const n = t.getFullYear();
|
|
676
|
-
return u(n, e.length);
|
|
677
|
-
},
|
|
678
|
-
// Quarter
|
|
679
|
-
Q: function(t, e, n) {
|
|
680
|
-
const r = Math.ceil((t.getMonth() + 1) / 3);
|
|
681
|
-
switch (e) {
|
|
682
|
-
// 1, 2, 3, 4
|
|
683
|
-
case "Q":
|
|
684
|
-
return String(r);
|
|
685
|
-
// 01, 02, 03, 04
|
|
686
|
-
case "QQ":
|
|
687
|
-
return u(r, 2);
|
|
688
|
-
// 1st, 2nd, 3rd, 4th
|
|
689
|
-
case "Qo":
|
|
690
|
-
return n.ordinalNumber(r, { unit: "quarter" });
|
|
691
|
-
// Q1, Q2, Q3, Q4
|
|
692
|
-
case "QQQ":
|
|
693
|
-
return n.quarter(r, {
|
|
694
|
-
width: "abbreviated",
|
|
695
|
-
context: "formatting"
|
|
696
|
-
});
|
|
697
|
-
// 1, 2, 3, 4 (narrow quarter; could be not numerical)
|
|
698
|
-
case "QQQQQ":
|
|
699
|
-
return n.quarter(r, {
|
|
700
|
-
width: "narrow",
|
|
701
|
-
context: "formatting"
|
|
702
|
-
});
|
|
703
|
-
// 1st quarter, 2nd quarter, ...
|
|
704
|
-
case "QQQQ":
|
|
705
|
-
default:
|
|
706
|
-
return n.quarter(r, {
|
|
707
|
-
width: "wide",
|
|
708
|
-
context: "formatting"
|
|
709
|
-
});
|
|
710
|
-
}
|
|
711
|
-
},
|
|
712
|
-
// Stand-alone quarter
|
|
713
|
-
q: function(t, e, n) {
|
|
714
|
-
const r = Math.ceil((t.getMonth() + 1) / 3);
|
|
715
|
-
switch (e) {
|
|
716
|
-
// 1, 2, 3, 4
|
|
717
|
-
case "q":
|
|
718
|
-
return String(r);
|
|
719
|
-
// 01, 02, 03, 04
|
|
720
|
-
case "qq":
|
|
721
|
-
return u(r, 2);
|
|
722
|
-
// 1st, 2nd, 3rd, 4th
|
|
723
|
-
case "qo":
|
|
724
|
-
return n.ordinalNumber(r, { unit: "quarter" });
|
|
725
|
-
// Q1, Q2, Q3, Q4
|
|
726
|
-
case "qqq":
|
|
727
|
-
return n.quarter(r, {
|
|
728
|
-
width: "abbreviated",
|
|
729
|
-
context: "standalone"
|
|
730
|
-
});
|
|
731
|
-
// 1, 2, 3, 4 (narrow quarter; could be not numerical)
|
|
732
|
-
case "qqqqq":
|
|
733
|
-
return n.quarter(r, {
|
|
734
|
-
width: "narrow",
|
|
735
|
-
context: "standalone"
|
|
736
|
-
});
|
|
737
|
-
// 1st quarter, 2nd quarter, ...
|
|
738
|
-
case "qqqq":
|
|
739
|
-
default:
|
|
740
|
-
return n.quarter(r, {
|
|
741
|
-
width: "wide",
|
|
742
|
-
context: "standalone"
|
|
743
|
-
});
|
|
744
|
-
}
|
|
745
|
-
},
|
|
746
|
-
// Month
|
|
747
|
-
M: function(t, e, n) {
|
|
748
|
-
const r = t.getMonth();
|
|
749
|
-
switch (e) {
|
|
750
|
-
case "M":
|
|
751
|
-
case "MM":
|
|
752
|
-
return T.M(t, e);
|
|
753
|
-
// 1st, 2nd, ..., 12th
|
|
754
|
-
case "Mo":
|
|
755
|
-
return n.ordinalNumber(r + 1, { unit: "month" });
|
|
756
|
-
// Jan, Feb, ..., Dec
|
|
757
|
-
case "MMM":
|
|
758
|
-
return n.month(r, {
|
|
759
|
-
width: "abbreviated",
|
|
760
|
-
context: "formatting"
|
|
761
|
-
});
|
|
762
|
-
// J, F, ..., D
|
|
763
|
-
case "MMMMM":
|
|
764
|
-
return n.month(r, {
|
|
765
|
-
width: "narrow",
|
|
766
|
-
context: "formatting"
|
|
767
|
-
});
|
|
768
|
-
// January, February, ..., December
|
|
769
|
-
case "MMMM":
|
|
770
|
-
default:
|
|
771
|
-
return n.month(r, { width: "wide", context: "formatting" });
|
|
772
|
-
}
|
|
773
|
-
},
|
|
774
|
-
// Stand-alone month
|
|
775
|
-
L: function(t, e, n) {
|
|
776
|
-
const r = t.getMonth();
|
|
777
|
-
switch (e) {
|
|
778
|
-
// 1, 2, ..., 12
|
|
779
|
-
case "L":
|
|
780
|
-
return String(r + 1);
|
|
781
|
-
// 01, 02, ..., 12
|
|
782
|
-
case "LL":
|
|
783
|
-
return u(r + 1, 2);
|
|
784
|
-
// 1st, 2nd, ..., 12th
|
|
785
|
-
case "Lo":
|
|
786
|
-
return n.ordinalNumber(r + 1, { unit: "month" });
|
|
787
|
-
// Jan, Feb, ..., Dec
|
|
788
|
-
case "LLL":
|
|
789
|
-
return n.month(r, {
|
|
790
|
-
width: "abbreviated",
|
|
791
|
-
context: "standalone"
|
|
792
|
-
});
|
|
793
|
-
// J, F, ..., D
|
|
794
|
-
case "LLLLL":
|
|
795
|
-
return n.month(r, {
|
|
796
|
-
width: "narrow",
|
|
797
|
-
context: "standalone"
|
|
798
|
-
});
|
|
799
|
-
// January, February, ..., December
|
|
800
|
-
case "LLLL":
|
|
801
|
-
default:
|
|
802
|
-
return n.month(r, { width: "wide", context: "standalone" });
|
|
803
|
-
}
|
|
804
|
-
},
|
|
805
|
-
// Local week of year
|
|
806
|
-
w: function(t, e, n, r) {
|
|
807
|
-
const a = St(t, r);
|
|
808
|
-
return e === "wo" ? n.ordinalNumber(a, { unit: "week" }) : u(a, e.length);
|
|
809
|
-
},
|
|
810
|
-
// ISO week of year
|
|
811
|
-
I: function(t, e, n) {
|
|
812
|
-
const r = be(t);
|
|
813
|
-
return e === "Io" ? n.ordinalNumber(r, { unit: "week" }) : u(r, e.length);
|
|
814
|
-
},
|
|
815
|
-
// Day of the month
|
|
816
|
-
d: function(t, e, n) {
|
|
817
|
-
return e === "do" ? n.ordinalNumber(t.getDate(), { unit: "date" }) : T.d(t, e);
|
|
818
|
-
},
|
|
819
|
-
// Day of year
|
|
820
|
-
D: function(t, e, n) {
|
|
821
|
-
const r = we(t);
|
|
822
|
-
return e === "Do" ? n.ordinalNumber(r, { unit: "dayOfYear" }) : u(r, e.length);
|
|
823
|
-
},
|
|
824
|
-
// Day of week
|
|
825
|
-
E: function(t, e, n) {
|
|
826
|
-
const r = t.getDay();
|
|
827
|
-
switch (e) {
|
|
828
|
-
// Tue
|
|
829
|
-
case "E":
|
|
830
|
-
case "EE":
|
|
831
|
-
case "EEE":
|
|
832
|
-
return n.day(r, {
|
|
833
|
-
width: "abbreviated",
|
|
834
|
-
context: "formatting"
|
|
835
|
-
});
|
|
836
|
-
// T
|
|
837
|
-
case "EEEEE":
|
|
838
|
-
return n.day(r, {
|
|
839
|
-
width: "narrow",
|
|
840
|
-
context: "formatting"
|
|
841
|
-
});
|
|
842
|
-
// Tu
|
|
843
|
-
case "EEEEEE":
|
|
844
|
-
return n.day(r, {
|
|
845
|
-
width: "short",
|
|
846
|
-
context: "formatting"
|
|
847
|
-
});
|
|
848
|
-
// Tuesday
|
|
849
|
-
case "EEEE":
|
|
850
|
-
default:
|
|
851
|
-
return n.day(r, {
|
|
852
|
-
width: "wide",
|
|
853
|
-
context: "formatting"
|
|
854
|
-
});
|
|
855
|
-
}
|
|
856
|
-
},
|
|
857
|
-
// Local day of week
|
|
858
|
-
e: function(t, e, n, r) {
|
|
859
|
-
const a = t.getDay(), s = (a - r.weekStartsOn + 8) % 7 || 7;
|
|
860
|
-
switch (e) {
|
|
861
|
-
// Numerical value (Nth day of week with current locale or weekStartsOn)
|
|
862
|
-
case "e":
|
|
863
|
-
return String(s);
|
|
864
|
-
// Padded numerical value
|
|
865
|
-
case "ee":
|
|
866
|
-
return u(s, 2);
|
|
867
|
-
// 1st, 2nd, ..., 7th
|
|
868
|
-
case "eo":
|
|
869
|
-
return n.ordinalNumber(s, { unit: "day" });
|
|
870
|
-
case "eee":
|
|
871
|
-
return n.day(a, {
|
|
872
|
-
width: "abbreviated",
|
|
873
|
-
context: "formatting"
|
|
874
|
-
});
|
|
875
|
-
// T
|
|
876
|
-
case "eeeee":
|
|
877
|
-
return n.day(a, {
|
|
878
|
-
width: "narrow",
|
|
879
|
-
context: "formatting"
|
|
880
|
-
});
|
|
881
|
-
// Tu
|
|
882
|
-
case "eeeeee":
|
|
883
|
-
return n.day(a, {
|
|
884
|
-
width: "short",
|
|
885
|
-
context: "formatting"
|
|
886
|
-
});
|
|
887
|
-
// Tuesday
|
|
888
|
-
case "eeee":
|
|
889
|
-
default:
|
|
890
|
-
return n.day(a, {
|
|
891
|
-
width: "wide",
|
|
892
|
-
context: "formatting"
|
|
893
|
-
});
|
|
894
|
-
}
|
|
895
|
-
},
|
|
896
|
-
// Stand-alone local day of week
|
|
897
|
-
c: function(t, e, n, r) {
|
|
898
|
-
const a = t.getDay(), s = (a - r.weekStartsOn + 8) % 7 || 7;
|
|
899
|
-
switch (e) {
|
|
900
|
-
// Numerical value (same as in `e`)
|
|
901
|
-
case "c":
|
|
902
|
-
return String(s);
|
|
903
|
-
// Padded numerical value
|
|
904
|
-
case "cc":
|
|
905
|
-
return u(s, e.length);
|
|
906
|
-
// 1st, 2nd, ..., 7th
|
|
907
|
-
case "co":
|
|
908
|
-
return n.ordinalNumber(s, { unit: "day" });
|
|
909
|
-
case "ccc":
|
|
910
|
-
return n.day(a, {
|
|
911
|
-
width: "abbreviated",
|
|
912
|
-
context: "standalone"
|
|
913
|
-
});
|
|
914
|
-
// T
|
|
915
|
-
case "ccccc":
|
|
916
|
-
return n.day(a, {
|
|
917
|
-
width: "narrow",
|
|
918
|
-
context: "standalone"
|
|
919
|
-
});
|
|
920
|
-
// Tu
|
|
921
|
-
case "cccccc":
|
|
922
|
-
return n.day(a, {
|
|
923
|
-
width: "short",
|
|
924
|
-
context: "standalone"
|
|
925
|
-
});
|
|
926
|
-
// Tuesday
|
|
927
|
-
case "cccc":
|
|
928
|
-
default:
|
|
929
|
-
return n.day(a, {
|
|
930
|
-
width: "wide",
|
|
931
|
-
context: "standalone"
|
|
932
|
-
});
|
|
933
|
-
}
|
|
934
|
-
},
|
|
935
|
-
// ISO day of week
|
|
936
|
-
i: function(t, e, n) {
|
|
937
|
-
const r = t.getDay(), a = r === 0 ? 7 : r;
|
|
938
|
-
switch (e) {
|
|
939
|
-
// 2
|
|
940
|
-
case "i":
|
|
941
|
-
return String(a);
|
|
942
|
-
// 02
|
|
943
|
-
case "ii":
|
|
944
|
-
return u(a, e.length);
|
|
945
|
-
// 2nd
|
|
946
|
-
case "io":
|
|
947
|
-
return n.ordinalNumber(a, { unit: "day" });
|
|
948
|
-
// Tue
|
|
949
|
-
case "iii":
|
|
950
|
-
return n.day(r, {
|
|
951
|
-
width: "abbreviated",
|
|
952
|
-
context: "formatting"
|
|
953
|
-
});
|
|
954
|
-
// T
|
|
955
|
-
case "iiiii":
|
|
956
|
-
return n.day(r, {
|
|
957
|
-
width: "narrow",
|
|
958
|
-
context: "formatting"
|
|
959
|
-
});
|
|
960
|
-
// Tu
|
|
961
|
-
case "iiiiii":
|
|
962
|
-
return n.day(r, {
|
|
963
|
-
width: "short",
|
|
964
|
-
context: "formatting"
|
|
965
|
-
});
|
|
966
|
-
// Tuesday
|
|
967
|
-
case "iiii":
|
|
968
|
-
default:
|
|
969
|
-
return n.day(r, {
|
|
970
|
-
width: "wide",
|
|
971
|
-
context: "formatting"
|
|
972
|
-
});
|
|
973
|
-
}
|
|
974
|
-
},
|
|
975
|
-
// AM or PM
|
|
976
|
-
a: function(t, e, n) {
|
|
977
|
-
const a = t.getHours() / 12 >= 1 ? "pm" : "am";
|
|
978
|
-
switch (e) {
|
|
979
|
-
case "a":
|
|
980
|
-
case "aa":
|
|
981
|
-
return n.dayPeriod(a, {
|
|
982
|
-
width: "abbreviated",
|
|
983
|
-
context: "formatting"
|
|
984
|
-
});
|
|
985
|
-
case "aaa":
|
|
986
|
-
return n.dayPeriod(a, {
|
|
987
|
-
width: "abbreviated",
|
|
988
|
-
context: "formatting"
|
|
989
|
-
}).toLowerCase();
|
|
990
|
-
case "aaaaa":
|
|
991
|
-
return n.dayPeriod(a, {
|
|
992
|
-
width: "narrow",
|
|
993
|
-
context: "formatting"
|
|
994
|
-
});
|
|
995
|
-
case "aaaa":
|
|
996
|
-
default:
|
|
997
|
-
return n.dayPeriod(a, {
|
|
998
|
-
width: "wide",
|
|
999
|
-
context: "formatting"
|
|
1000
|
-
});
|
|
1001
|
-
}
|
|
1002
|
-
},
|
|
1003
|
-
// AM, PM, midnight, noon
|
|
1004
|
-
b: function(t, e, n) {
|
|
1005
|
-
const r = t.getHours();
|
|
1006
|
-
let a;
|
|
1007
|
-
switch (r === 12 ? a = E.noon : r === 0 ? a = E.midnight : a = r / 12 >= 1 ? "pm" : "am", e) {
|
|
1008
|
-
case "b":
|
|
1009
|
-
case "bb":
|
|
1010
|
-
return n.dayPeriod(a, {
|
|
1011
|
-
width: "abbreviated",
|
|
1012
|
-
context: "formatting"
|
|
1013
|
-
});
|
|
1014
|
-
case "bbb":
|
|
1015
|
-
return n.dayPeriod(a, {
|
|
1016
|
-
width: "abbreviated",
|
|
1017
|
-
context: "formatting"
|
|
1018
|
-
}).toLowerCase();
|
|
1019
|
-
case "bbbbb":
|
|
1020
|
-
return n.dayPeriod(a, {
|
|
1021
|
-
width: "narrow",
|
|
1022
|
-
context: "formatting"
|
|
1023
|
-
});
|
|
1024
|
-
case "bbbb":
|
|
1025
|
-
default:
|
|
1026
|
-
return n.dayPeriod(a, {
|
|
1027
|
-
width: "wide",
|
|
1028
|
-
context: "formatting"
|
|
1029
|
-
});
|
|
1030
|
-
}
|
|
1031
|
-
},
|
|
1032
|
-
// in the morning, in the afternoon, in the evening, at night
|
|
1033
|
-
B: function(t, e, n) {
|
|
1034
|
-
const r = t.getHours();
|
|
1035
|
-
let a;
|
|
1036
|
-
switch (r >= 17 ? a = E.evening : r >= 12 ? a = E.afternoon : r >= 4 ? a = E.morning : a = E.night, e) {
|
|
1037
|
-
case "B":
|
|
1038
|
-
case "BB":
|
|
1039
|
-
case "BBB":
|
|
1040
|
-
return n.dayPeriod(a, {
|
|
1041
|
-
width: "abbreviated",
|
|
1042
|
-
context: "formatting"
|
|
1043
|
-
});
|
|
1044
|
-
case "BBBBB":
|
|
1045
|
-
return n.dayPeriod(a, {
|
|
1046
|
-
width: "narrow",
|
|
1047
|
-
context: "formatting"
|
|
1048
|
-
});
|
|
1049
|
-
case "BBBB":
|
|
1050
|
-
default:
|
|
1051
|
-
return n.dayPeriod(a, {
|
|
1052
|
-
width: "wide",
|
|
1053
|
-
context: "formatting"
|
|
1054
|
-
});
|
|
1055
|
-
}
|
|
1056
|
-
},
|
|
1057
|
-
// Hour [1-12]
|
|
1058
|
-
h: function(t, e, n) {
|
|
1059
|
-
if (e === "ho") {
|
|
1060
|
-
let r = t.getHours() % 12;
|
|
1061
|
-
return r === 0 && (r = 12), n.ordinalNumber(r, { unit: "hour" });
|
|
1062
|
-
}
|
|
1063
|
-
return T.h(t, e);
|
|
1064
|
-
},
|
|
1065
|
-
// Hour [0-23]
|
|
1066
|
-
H: function(t, e, n) {
|
|
1067
|
-
return e === "Ho" ? n.ordinalNumber(t.getHours(), { unit: "hour" }) : T.H(t, e);
|
|
1068
|
-
},
|
|
1069
|
-
// Hour [0-11]
|
|
1070
|
-
K: function(t, e, n) {
|
|
1071
|
-
const r = t.getHours() % 12;
|
|
1072
|
-
return e === "Ko" ? n.ordinalNumber(r, { unit: "hour" }) : u(r, e.length);
|
|
1073
|
-
},
|
|
1074
|
-
// Hour [1-24]
|
|
1075
|
-
k: function(t, e, n) {
|
|
1076
|
-
let r = t.getHours();
|
|
1077
|
-
return r === 0 && (r = 24), e === "ko" ? n.ordinalNumber(r, { unit: "hour" }) : u(r, e.length);
|
|
1078
|
-
},
|
|
1079
|
-
// Minute
|
|
1080
|
-
m: function(t, e, n) {
|
|
1081
|
-
return e === "mo" ? n.ordinalNumber(t.getMinutes(), { unit: "minute" }) : T.m(t, e);
|
|
1082
|
-
},
|
|
1083
|
-
// Second
|
|
1084
|
-
s: function(t, e, n) {
|
|
1085
|
-
return e === "so" ? n.ordinalNumber(t.getSeconds(), { unit: "second" }) : T.s(t, e);
|
|
1086
|
-
},
|
|
1087
|
-
// Fraction of second
|
|
1088
|
-
S: function(t, e) {
|
|
1089
|
-
return T.S(t, e);
|
|
1090
|
-
},
|
|
1091
|
-
// Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
|
|
1092
|
-
X: function(t, e, n) {
|
|
1093
|
-
const r = t.getTimezoneOffset();
|
|
1094
|
-
if (r === 0)
|
|
1095
|
-
return "Z";
|
|
1096
|
-
switch (e) {
|
|
1097
|
-
// Hours and optional minutes
|
|
1098
|
-
case "X":
|
|
1099
|
-
return lt(r);
|
|
1100
|
-
// Hours, minutes and optional seconds without `:` delimiter
|
|
1101
|
-
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
1102
|
-
// so this token always has the same output as `XX`
|
|
1103
|
-
case "XXXX":
|
|
1104
|
-
case "XX":
|
|
1105
|
-
return N(r);
|
|
1106
|
-
// Hours, minutes and optional seconds with `:` delimiter
|
|
1107
|
-
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
1108
|
-
// so this token always has the same output as `XXX`
|
|
1109
|
-
case "XXXXX":
|
|
1110
|
-
case "XXX":
|
|
1111
|
-
// Hours and minutes with `:` delimiter
|
|
1112
|
-
default:
|
|
1113
|
-
return N(r, ":");
|
|
1114
|
-
}
|
|
1115
|
-
},
|
|
1116
|
-
// Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
|
|
1117
|
-
x: function(t, e, n) {
|
|
1118
|
-
const r = t.getTimezoneOffset();
|
|
1119
|
-
switch (e) {
|
|
1120
|
-
// Hours and optional minutes
|
|
1121
|
-
case "x":
|
|
1122
|
-
return lt(r);
|
|
1123
|
-
// Hours, minutes and optional seconds without `:` delimiter
|
|
1124
|
-
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
1125
|
-
// so this token always has the same output as `xx`
|
|
1126
|
-
case "xxxx":
|
|
1127
|
-
case "xx":
|
|
1128
|
-
return N(r);
|
|
1129
|
-
// Hours, minutes and optional seconds with `:` delimiter
|
|
1130
|
-
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
1131
|
-
// so this token always has the same output as `xxx`
|
|
1132
|
-
case "xxxxx":
|
|
1133
|
-
case "xxx":
|
|
1134
|
-
// Hours and minutes with `:` delimiter
|
|
1135
|
-
default:
|
|
1136
|
-
return N(r, ":");
|
|
1137
|
-
}
|
|
1138
|
-
},
|
|
1139
|
-
// Timezone (GMT)
|
|
1140
|
-
O: function(t, e, n) {
|
|
1141
|
-
const r = t.getTimezoneOffset();
|
|
1142
|
-
switch (e) {
|
|
1143
|
-
// Short
|
|
1144
|
-
case "O":
|
|
1145
|
-
case "OO":
|
|
1146
|
-
case "OOO":
|
|
1147
|
-
return "GMT" + ut(r, ":");
|
|
1148
|
-
// Long
|
|
1149
|
-
case "OOOO":
|
|
1150
|
-
default:
|
|
1151
|
-
return "GMT" + N(r, ":");
|
|
1152
|
-
}
|
|
1153
|
-
},
|
|
1154
|
-
// Timezone (specific non-location)
|
|
1155
|
-
z: function(t, e, n) {
|
|
1156
|
-
const r = t.getTimezoneOffset();
|
|
1157
|
-
switch (e) {
|
|
1158
|
-
// Short
|
|
1159
|
-
case "z":
|
|
1160
|
-
case "zz":
|
|
1161
|
-
case "zzz":
|
|
1162
|
-
return "GMT" + ut(r, ":");
|
|
1163
|
-
// Long
|
|
1164
|
-
case "zzzz":
|
|
1165
|
-
default:
|
|
1166
|
-
return "GMT" + N(r, ":");
|
|
1167
|
-
}
|
|
1168
|
-
},
|
|
1169
|
-
// Seconds timestamp
|
|
1170
|
-
t: function(t, e, n) {
|
|
1171
|
-
const r = Math.trunc(+t / 1e3);
|
|
1172
|
-
return u(r, e.length);
|
|
1173
|
-
},
|
|
1174
|
-
// Milliseconds timestamp
|
|
1175
|
-
T: function(t, e, n) {
|
|
1176
|
-
return u(+t, e.length);
|
|
1177
|
-
}
|
|
1178
|
-
};
|
|
1179
|
-
function ut(t, e = "") {
|
|
1180
|
-
const n = t > 0 ? "-" : "+", r = Math.abs(t), a = Math.trunc(r / 60), s = r % 60;
|
|
1181
|
-
return s === 0 ? n + String(a) : n + String(a) + e + u(s, 2);
|
|
1182
|
-
}
|
|
1183
|
-
function lt(t, e) {
|
|
1184
|
-
return t % 60 === 0 ? (t > 0 ? "-" : "+") + u(Math.abs(t) / 60, 2) : N(t, e);
|
|
1185
|
-
}
|
|
1186
|
-
function N(t, e = "") {
|
|
1187
|
-
const n = t > 0 ? "-" : "+", r = Math.abs(t), a = u(Math.trunc(r / 60), 2), s = u(r % 60, 2);
|
|
1188
|
-
return n + a + e + s;
|
|
1189
|
-
}
|
|
1190
|
-
const ht = (t, e) => {
|
|
1191
|
-
switch (t) {
|
|
1192
|
-
case "P":
|
|
1193
|
-
return e.date({ width: "short" });
|
|
1194
|
-
case "PP":
|
|
1195
|
-
return e.date({ width: "medium" });
|
|
1196
|
-
case "PPP":
|
|
1197
|
-
return e.date({ width: "long" });
|
|
1198
|
-
case "PPPP":
|
|
1199
|
-
default:
|
|
1200
|
-
return e.date({ width: "full" });
|
|
1201
|
-
}
|
|
1202
|
-
}, kt = (t, e) => {
|
|
1203
|
-
switch (t) {
|
|
1204
|
-
case "p":
|
|
1205
|
-
return e.time({ width: "short" });
|
|
1206
|
-
case "pp":
|
|
1207
|
-
return e.time({ width: "medium" });
|
|
1208
|
-
case "ppp":
|
|
1209
|
-
return e.time({ width: "long" });
|
|
1210
|
-
case "pppp":
|
|
1211
|
-
default:
|
|
1212
|
-
return e.time({ width: "full" });
|
|
1213
|
-
}
|
|
1214
|
-
}, Se = (t, e) => {
|
|
1215
|
-
const n = t.match(/(P+)(p+)?/) || [], r = n[1], a = n[2];
|
|
1216
|
-
if (!a)
|
|
1217
|
-
return ht(t, e);
|
|
1218
|
-
let s;
|
|
1219
|
-
switch (r) {
|
|
1220
|
-
case "P":
|
|
1221
|
-
s = e.dateTime({ width: "short" });
|
|
1222
|
-
break;
|
|
1223
|
-
case "PP":
|
|
1224
|
-
s = e.dateTime({ width: "medium" });
|
|
1225
|
-
break;
|
|
1226
|
-
case "PPP":
|
|
1227
|
-
s = e.dateTime({ width: "long" });
|
|
1228
|
-
break;
|
|
1229
|
-
case "PPPP":
|
|
1230
|
-
default:
|
|
1231
|
-
s = e.dateTime({ width: "full" });
|
|
1232
|
-
break;
|
|
1233
|
-
}
|
|
1234
|
-
return s.replace("{{date}}", ht(r, e)).replace("{{time}}", kt(a, e));
|
|
1235
|
-
}, ke = {
|
|
1236
|
-
p: kt,
|
|
1237
|
-
P: Se
|
|
1238
|
-
}, ve = /^D+$/, Me = /^Y+$/, Te = ["D", "DD", "YY", "YYYY"];
|
|
1239
|
-
function xe(t) {
|
|
1240
|
-
return ve.test(t);
|
|
1241
|
-
}
|
|
1242
|
-
function Oe(t) {
|
|
1243
|
-
return Me.test(t);
|
|
1244
|
-
}
|
|
1245
|
-
function Pe(t, e, n) {
|
|
1246
|
-
const r = Ne(t, e, n);
|
|
1247
|
-
if (console.warn(r), Te.includes(t)) throw new RangeError(r);
|
|
1248
|
-
}
|
|
1249
|
-
function Ne(t, e, n) {
|
|
1250
|
-
const r = t[0] === "Y" ? "years" : "days of the month";
|
|
1251
|
-
return `Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
|
|
1252
|
-
}
|
|
1253
|
-
const Ce = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g, $e = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g, Ee = /^'([^]*?)'?$/, We = /''/g, _e = /[a-zA-Z]/;
|
|
1254
|
-
function Ye(t, e, n) {
|
|
1255
|
-
var g, m, v, M;
|
|
1256
|
-
const r = q(), a = r.locale ?? pe, s = r.firstWeekContainsDate ?? ((m = (g = r.locale) == null ? void 0 : g.options) == null ? void 0 : m.firstWeekContainsDate) ?? 1, i = r.weekStartsOn ?? ((M = (v = r.locale) == null ? void 0 : v.options) == null ? void 0 : M.weekStartsOn) ?? 0, o = b(t, n == null ? void 0 : n.in);
|
|
1257
|
-
if (!Yt(o))
|
|
1258
|
-
throw new RangeError("Invalid time value");
|
|
1259
|
-
let c = e.match($e).map((w) => {
|
|
1260
|
-
const p = w[0];
|
|
1261
|
-
if (p === "p" || p === "P") {
|
|
1262
|
-
const Y = ke[p];
|
|
1263
|
-
return Y(w, a.formatLong);
|
|
1264
|
-
}
|
|
1265
|
-
return w;
|
|
1266
|
-
}).join("").match(Ce).map((w) => {
|
|
1267
|
-
if (w === "''")
|
|
1268
|
-
return { isToken: !1, value: "'" };
|
|
1269
|
-
const p = w[0];
|
|
1270
|
-
if (p === "'")
|
|
1271
|
-
return { isToken: !1, value: Fe(w) };
|
|
1272
|
-
if (ct[p])
|
|
1273
|
-
return { isToken: !0, value: w };
|
|
1274
|
-
if (p.match(_e))
|
|
1275
|
-
throw new RangeError(
|
|
1276
|
-
"Format string contains an unescaped latin alphabet character `" + p + "`"
|
|
1277
|
-
);
|
|
1278
|
-
return { isToken: !1, value: w };
|
|
1279
|
-
});
|
|
1280
|
-
a.localize.preprocessor && (c = a.localize.preprocessor(o, c));
|
|
1281
|
-
const d = {
|
|
1282
|
-
firstWeekContainsDate: s,
|
|
1283
|
-
weekStartsOn: i,
|
|
1284
|
-
locale: a
|
|
1285
|
-
};
|
|
1286
|
-
return c.map((w) => {
|
|
1287
|
-
if (!w.isToken) return w.value;
|
|
1288
|
-
const p = w.value;
|
|
1289
|
-
(Oe(p) || xe(p)) && Pe(p, e, String(t));
|
|
1290
|
-
const Y = ct[p[0]];
|
|
1291
|
-
return Y(o, p, a.localize, d);
|
|
1292
|
-
}).join("");
|
|
1293
|
-
}
|
|
1294
|
-
function Fe(t) {
|
|
1295
|
-
const e = t.match(Ee);
|
|
1296
|
-
return e ? e[1].replace(We, "'") : t;
|
|
1297
|
-
}
|
|
1298
|
-
function Ie(t, e) {
|
|
1299
|
-
const n = b(t, e == null ? void 0 : e.in).getDay();
|
|
1300
|
-
return n === 0 ? 7 : n;
|
|
1301
|
-
}
|
|
1302
|
-
function Ae(t, e, n = "long") {
|
|
1303
|
-
return new Intl.DateTimeFormat("en-US", {
|
|
1304
|
-
// Enforces engine to render the time. Without the option JavaScriptCore omits it.
|
|
1305
|
-
hour: "numeric",
|
|
1306
|
-
timeZone: t,
|
|
1307
|
-
timeZoneName: n
|
|
1308
|
-
}).format(e).split(/\s/g).slice(2).join(" ");
|
|
1309
|
-
}
|
|
1310
|
-
const G = {}, H = {};
|
|
1311
|
-
function C(t, e) {
|
|
1312
|
-
try {
|
|
1313
|
-
const r = (G[t] || (G[t] = new Intl.DateTimeFormat("en-US", {
|
|
1314
|
-
timeZone: t,
|
|
1315
|
-
timeZoneName: "longOffset"
|
|
1316
|
-
}).format))(e).split("GMT")[1];
|
|
1317
|
-
return r in H ? H[r] : dt(r, r.split(":"));
|
|
1318
|
-
} catch {
|
|
1319
|
-
if (t in H) return H[t];
|
|
1320
|
-
const n = t == null ? void 0 : t.match(He);
|
|
1321
|
-
return n ? dt(t, n.slice(1)) : NaN;
|
|
1322
|
-
}
|
|
1323
|
-
}
|
|
1324
|
-
const He = /([+-]\d\d):?(\d\d)?/;
|
|
1325
|
-
function dt(t, e) {
|
|
1326
|
-
const n = +(e[0] || 0), r = +(e[1] || 0), a = +(e[2] || 0) / 60;
|
|
1327
|
-
return H[t] = n * 60 + r > 0 ? n * 60 + r + a : n * 60 - r - a;
|
|
1328
|
-
}
|
|
1329
|
-
class S extends Date {
|
|
1330
|
-
//#region static
|
|
1331
|
-
constructor(...e) {
|
|
1332
|
-
super(), e.length > 1 && typeof e[e.length - 1] == "string" && (this.timeZone = e.pop()), this.internal = /* @__PURE__ */ new Date(), isNaN(C(this.timeZone, this)) ? this.setTime(NaN) : e.length ? typeof e[0] == "number" && (e.length === 1 || e.length === 2 && typeof e[1] != "number") ? this.setTime(e[0]) : typeof e[0] == "string" ? this.setTime(+new Date(e[0])) : e[0] instanceof Date ? this.setTime(+e[0]) : (this.setTime(+new Date(...e)), vt(this), K(this)) : this.setTime(Date.now());
|
|
1333
|
-
}
|
|
1334
|
-
static tz(e, ...n) {
|
|
1335
|
-
return n.length ? new S(...n, e) : new S(Date.now(), e);
|
|
1336
|
-
}
|
|
1337
|
-
//#endregion
|
|
1338
|
-
//#region time zone
|
|
1339
|
-
withTimeZone(e) {
|
|
1340
|
-
return new S(+this, e);
|
|
1341
|
-
}
|
|
1342
|
-
getTimezoneOffset() {
|
|
1343
|
-
const e = -C(this.timeZone, this);
|
|
1344
|
-
return e > 0 ? Math.floor(e) : Math.ceil(e);
|
|
1345
|
-
}
|
|
1346
|
-
//#endregion
|
|
1347
|
-
//#region time
|
|
1348
|
-
setTime(e) {
|
|
1349
|
-
return Date.prototype.setTime.apply(this, arguments), K(this), +this;
|
|
1350
|
-
}
|
|
1351
|
-
//#endregion
|
|
1352
|
-
//#region date-fns integration
|
|
1353
|
-
[Symbol.for("constructDateFrom")](e) {
|
|
1354
|
-
return new S(+new Date(e), this.timeZone);
|
|
1355
|
-
}
|
|
1356
|
-
//#endregion
|
|
1357
|
-
}
|
|
1358
|
-
const ft = /^(get|set)(?!UTC)/;
|
|
1359
|
-
Object.getOwnPropertyNames(Date.prototype).forEach((t) => {
|
|
1360
|
-
if (!ft.test(t)) return;
|
|
1361
|
-
const e = t.replace(ft, "$1UTC");
|
|
1362
|
-
S.prototype[e] && (t.startsWith("get") ? S.prototype[t] = function() {
|
|
1363
|
-
return this.internal[e]();
|
|
1364
|
-
} : (S.prototype[t] = function() {
|
|
1365
|
-
return Date.prototype[e].apply(this.internal, arguments), Re(this), +this;
|
|
1366
|
-
}, S.prototype[e] = function() {
|
|
1367
|
-
return Date.prototype[e].apply(this, arguments), K(this), +this;
|
|
1368
|
-
}));
|
|
1369
|
-
});
|
|
1370
|
-
function K(t) {
|
|
1371
|
-
t.internal.setTime(+t), t.internal.setUTCSeconds(t.internal.getUTCSeconds() - Math.round(-C(t.timeZone, t) * 60));
|
|
1372
|
-
}
|
|
1373
|
-
function Re(t) {
|
|
1374
|
-
Date.prototype.setFullYear.call(t, t.internal.getUTCFullYear(), t.internal.getUTCMonth(), t.internal.getUTCDate()), Date.prototype.setHours.call(t, t.internal.getUTCHours(), t.internal.getUTCMinutes(), t.internal.getUTCSeconds(), t.internal.getUTCMilliseconds()), vt(t);
|
|
1375
|
-
}
|
|
1376
|
-
function vt(t) {
|
|
1377
|
-
const e = C(t.timeZone, t), n = e > 0 ? Math.floor(e) : Math.ceil(e), r = /* @__PURE__ */ new Date(+t);
|
|
1378
|
-
r.setUTCHours(r.getUTCHours() - 1);
|
|
1379
|
-
const a = -(/* @__PURE__ */ new Date(+t)).getTimezoneOffset(), s = -(/* @__PURE__ */ new Date(+r)).getTimezoneOffset(), i = a - s, o = Date.prototype.getHours.apply(t) !== t.internal.getUTCHours();
|
|
1380
|
-
i && o && t.internal.setUTCMinutes(t.internal.getUTCMinutes() + i);
|
|
1381
|
-
const c = a - n;
|
|
1382
|
-
c && Date.prototype.setUTCMinutes.call(t, Date.prototype.getUTCMinutes.call(t) + c);
|
|
1383
|
-
const d = /* @__PURE__ */ new Date(+t);
|
|
1384
|
-
d.setUTCSeconds(0);
|
|
1385
|
-
const g = a > 0 ? d.getSeconds() : (d.getSeconds() - 60) % 60, m = Math.round(-(C(t.timeZone, t) * 60)) % 60;
|
|
1386
|
-
(m || g) && (t.internal.setUTCSeconds(t.internal.getUTCSeconds() + m), Date.prototype.setUTCSeconds.call(t, Date.prototype.getUTCSeconds.call(t) + m + g));
|
|
1387
|
-
const v = C(t.timeZone, t), M = v > 0 ? Math.floor(v) : Math.ceil(v), p = -(/* @__PURE__ */ new Date(+t)).getTimezoneOffset() - M, Y = M !== n, nt = p - c;
|
|
1388
|
-
if (Y && nt) {
|
|
1389
|
-
Date.prototype.setUTCMinutes.call(t, Date.prototype.getUTCMinutes.call(t) + nt);
|
|
1390
|
-
const j = C(t.timeZone, t), Ot = j > 0 ? Math.floor(j) : Math.ceil(j), Q = M - Ot;
|
|
1391
|
-
Q && (t.internal.setUTCMinutes(t.internal.getUTCMinutes() + Q), Date.prototype.setUTCMinutes.call(t, Date.prototype.getUTCMinutes.call(t) + Q));
|
|
1392
|
-
}
|
|
1393
|
-
}
|
|
1394
|
-
class x extends S {
|
|
1395
|
-
//#region static
|
|
1396
|
-
static tz(e, ...n) {
|
|
1397
|
-
return n.length ? new x(...n, e) : new x(Date.now(), e);
|
|
1398
|
-
}
|
|
1399
|
-
//#endregion
|
|
1400
|
-
//#region representation
|
|
1401
|
-
toISOString() {
|
|
1402
|
-
const [e, n, r] = this.tzComponents(), a = `${e}${n}:${r}`;
|
|
1403
|
-
return this.internal.toISOString().slice(0, -1) + a;
|
|
1404
|
-
}
|
|
1405
|
-
toString() {
|
|
1406
|
-
return `${this.toDateString()} ${this.toTimeString()}`;
|
|
1407
|
-
}
|
|
1408
|
-
toDateString() {
|
|
1409
|
-
const [e, n, r, a] = this.internal.toUTCString().split(" ");
|
|
1410
|
-
return `${e == null ? void 0 : e.slice(0, -1)} ${r} ${n} ${a}`;
|
|
1411
|
-
}
|
|
1412
|
-
toTimeString() {
|
|
1413
|
-
const e = this.internal.toUTCString().split(" ")[4], [n, r, a] = this.tzComponents();
|
|
1414
|
-
return `${e} GMT${n}${r}${a} (${Ae(this.timeZone, this)})`;
|
|
1415
|
-
}
|
|
1416
|
-
toLocaleString(e, n) {
|
|
1417
|
-
return Date.prototype.toLocaleString.call(this, e, {
|
|
1418
|
-
...n,
|
|
1419
|
-
timeZone: (n == null ? void 0 : n.timeZone) || this.timeZone
|
|
1420
|
-
});
|
|
1421
|
-
}
|
|
1422
|
-
toLocaleDateString(e, n) {
|
|
1423
|
-
return Date.prototype.toLocaleDateString.call(this, e, {
|
|
1424
|
-
...n,
|
|
1425
|
-
timeZone: (n == null ? void 0 : n.timeZone) || this.timeZone
|
|
1426
|
-
});
|
|
1427
|
-
}
|
|
1428
|
-
toLocaleTimeString(e, n) {
|
|
1429
|
-
return Date.prototype.toLocaleTimeString.call(this, e, {
|
|
1430
|
-
...n,
|
|
1431
|
-
timeZone: (n == null ? void 0 : n.timeZone) || this.timeZone
|
|
1432
|
-
});
|
|
1433
|
-
}
|
|
1434
|
-
//#endregion
|
|
1435
|
-
//#region private
|
|
1436
|
-
tzComponents() {
|
|
1437
|
-
const e = this.getTimezoneOffset(), n = e > 0 ? "-" : "+", r = String(Math.floor(Math.abs(e) / 60)).padStart(2, "0"), a = String(Math.abs(e) % 60).padStart(2, "0");
|
|
1438
|
-
return [n, r, a];
|
|
1439
|
-
}
|
|
1440
|
-
//#endregion
|
|
1441
|
-
withTimeZone(e) {
|
|
1442
|
-
return new x(+this, e);
|
|
1443
|
-
}
|
|
1444
|
-
//#region date-fns integration
|
|
1445
|
-
[Symbol.for("constructDateFrom")](e) {
|
|
1446
|
-
return new x(+new Date(e), this.timeZone);
|
|
1447
|
-
}
|
|
1448
|
-
//#endregion
|
|
1449
|
-
}
|
|
1450
|
-
window.pktTz = window.pktTz === void 0 ? "Europe/Oslo" : window.pktTz;
|
|
1451
|
-
const Ue = (t = window.pktTz) => {
|
|
1452
|
-
const e = new x((/* @__PURE__ */ new Date()).toISOString(), t);
|
|
1453
|
-
return e.setHours(0, 0, 0, 0), isNaN(e.getTime()) ? /* @__PURE__ */ new Date() : new Date(e.getFullYear(), e.getMonth(), e.getDate());
|
|
1454
|
-
};
|
|
1455
|
-
function O(t) {
|
|
1456
|
-
if (!t || t === "") return /* @__PURE__ */ new Date();
|
|
1457
|
-
if (/^\d{4}-\d{2}-\d{2}$/.test(t)) {
|
|
1458
|
-
const [e, n, r] = t.split("-").map(Number);
|
|
1459
|
-
return new Date(e, n - 1, r);
|
|
1460
|
-
}
|
|
1461
|
-
if (/^\d{4}-\d{2}$/.test(t)) {
|
|
1462
|
-
const [e, n] = t.split("-").map(Number);
|
|
1463
|
-
return new Date(e, n - 1, 1);
|
|
1464
|
-
}
|
|
1465
|
-
return /^\d{4}$/.test(t) ? new Date(Number(t), 0, 1) : new Date(t);
|
|
1466
|
-
}
|
|
1467
|
-
const y = (t) => {
|
|
1468
|
-
if (!t || isNaN(t.getTime())) return "";
|
|
1469
|
-
const e = t.getFullYear(), n = String(t.getMonth() + 1).padStart(2, "0"), r = String(t.getDate()).padStart(2, "0");
|
|
1470
|
-
return `${e}-${n}-${r}`;
|
|
1471
|
-
}, U = (t) => {
|
|
1472
|
-
if (!t)
|
|
1473
|
-
return null;
|
|
1474
|
-
const e = O(t);
|
|
1475
|
-
return isNaN(e.getTime()) ? null : e;
|
|
1476
|
-
}, pn = (t, e) => {
|
|
1477
|
-
const n = _(t);
|
|
1478
|
-
return isNaN(n.getTime()) ? "" : Ye(n, e);
|
|
1479
|
-
}, _ = (t = "", e) => {
|
|
1480
|
-
const n = typeof t == "string" ? O(t) : t;
|
|
1481
|
-
return !n || isNaN(n.getTime()) ? /* @__PURE__ */ new Date() : e ? e === "end" ? Ft(n) : J(n) : n;
|
|
1482
|
-
}, $ = (t, e, n = 1) => {
|
|
1483
|
-
if (typeof t != "number" || typeof e != "number" || typeof n != "number" || isNaN(t) || isNaN(e) || isNaN(n))
|
|
1484
|
-
return /* @__PURE__ */ new Date();
|
|
1485
|
-
const r = new Date(t, e, n);
|
|
1486
|
-
return isNaN(r.getTime()) ? /* @__PURE__ */ new Date() : r;
|
|
1487
|
-
}, A = (t) => {
|
|
1488
|
-
let e;
|
|
1489
|
-
return typeof t == "number" ? e = new x(t, window.pktTz) : e = new x(t, window.pktTz), e.setHours(12, 0, 0, 0), e;
|
|
1490
|
-
};
|
|
1491
|
-
let V = null, mt;
|
|
1492
|
-
const Le = (t) => {
|
|
1493
|
-
if (!t || isNaN(t.getTime())) return "";
|
|
1494
|
-
const e = typeof window < "u" ? window.pktTz : void 0;
|
|
1495
|
-
return (!V || mt !== e) && (V = new Intl.DateTimeFormat("no", { dateStyle: "full", timeZone: e }), mt = e), V.format(t);
|
|
1496
|
-
}, Be = (t, e, n) => {
|
|
1497
|
-
if (!t || isNaN(t.getTime())) return !1;
|
|
1498
|
-
const r = e ? _(e) : null, a = n ? _(n) : null;
|
|
1499
|
-
return !(r && t < r || a && t > a);
|
|
1500
|
-
}, qe = (t, e) => {
|
|
1501
|
-
if (!t || isNaN(t.getTime()) || !Array.isArray(e)) return !1;
|
|
1502
|
-
const n = y(t);
|
|
1503
|
-
return e.includes(n);
|
|
1504
|
-
}, ze = (t, e) => {
|
|
1505
|
-
if (!t || isNaN(t.getTime()) || !Array.isArray(e)) return !1;
|
|
1506
|
-
const n = t.getDay().toString();
|
|
1507
|
-
return e.includes(n);
|
|
1508
|
-
}, Mt = (t, e, n, r, a) => !(!t || isNaN(t.getTime()) || !Be(t, e, n) || r && qe(t, r) || a && ze(t, a)), wn = (t, e, n, r, a) => t.filter((s) => {
|
|
1509
|
-
const i = U(s);
|
|
1510
|
-
return i && Mt(i, e, n, r, a);
|
|
1511
|
-
}), bn = (t) => t.slice().sort((e, n) => {
|
|
1512
|
-
const r = U(e), a = U(n);
|
|
1513
|
-
return !r || !a ? 0 : r.getTime() - a.getTime();
|
|
1514
|
-
}), Dn = (t, e) => {
|
|
1515
|
-
const n = U(t), r = U(e);
|
|
1516
|
-
return !n || !r ? !1 : n <= r;
|
|
1517
|
-
}, je = (t) => {
|
|
1518
|
-
if (!t) return [];
|
|
1519
|
-
if (Array.isArray(t)) return t.filter(Boolean);
|
|
1520
|
-
if (typeof t == "string" && t.trimStart().startsWith("["))
|
|
1521
|
-
try {
|
|
1522
|
-
const e = JSON.parse(t);
|
|
1523
|
-
if (Array.isArray(e))
|
|
1524
|
-
return e.filter(Boolean);
|
|
1525
|
-
} catch {
|
|
1526
|
-
}
|
|
1527
|
-
return String(t).split(",").map((e) => e.trim()).filter(Boolean);
|
|
1528
|
-
}, Sn = (t) => t.join(","), Qe = (t) => je(t), Xe = (t) => t ? O(t) : null, Ge = (t) => {
|
|
1529
|
-
if (typeof t == "string")
|
|
1530
|
-
return t.split(",").map((e) => O(e));
|
|
1531
|
-
if (Array.isArray(t))
|
|
1532
|
-
return t.map((e) => O(e));
|
|
1533
|
-
}, z = {
|
|
1534
|
-
csvToArray: Qe,
|
|
1535
|
-
stringToDate: Xe,
|
|
1536
|
-
stringsToDate: Ge
|
|
1537
|
-
}, Ve = { earliest: { default: null }, latest: { default: null }, weeknumbers: { default: !1 }, withcontrols: { default: !1 }, multiple: { default: !1 }, maxMultiple: { default: 4 }, range: { default: !1 } }, P = {
|
|
1538
|
-
props: Ve
|
|
1539
|
-
};
|
|
1540
|
-
function Tt(t, e) {
|
|
1541
|
-
const n = (e.excludedates ?? []).map(
|
|
1542
|
-
(r) => typeof r == "string" ? r : y(r)
|
|
1543
|
-
);
|
|
1544
|
-
return !Mt(
|
|
1545
|
-
t,
|
|
1546
|
-
e.earliest,
|
|
1547
|
-
e.latest,
|
|
1548
|
-
n,
|
|
1549
|
-
e.excludeweekdays ?? []
|
|
1550
|
-
);
|
|
1551
|
-
}
|
|
1552
|
-
function Je(t, e, n, r) {
|
|
1553
|
-
return !!(Tt(t, n) || !e && r.multiple && r.maxMultiple > 0 && r.selectedCount >= r.maxMultiple);
|
|
1554
|
-
}
|
|
1555
|
-
function Ke(t, e, n) {
|
|
1556
|
-
const r = $(t, e, 0);
|
|
1557
|
-
return !(n && _(n) > r);
|
|
1558
|
-
}
|
|
1559
|
-
function Ze(t, e, n) {
|
|
1560
|
-
const r = $(
|
|
1561
|
-
e === 11 ? t + 1 : t,
|
|
1562
|
-
e === 11 ? 0 : e + 1,
|
|
1563
|
-
1
|
|
1564
|
-
);
|
|
1565
|
-
return !(n && _(n) < r);
|
|
1566
|
-
}
|
|
1567
|
-
const L = 7, tn = 6;
|
|
1568
|
-
function en(t, e) {
|
|
1569
|
-
const n = $(t, e, 1), r = $(t, e + 1, 0), a = (n.getDay() + tn) % L, s = r.getDate(), i = Math.ceil((s + a) / L), c = $(t, e, 0).getDate(), d = St(n);
|
|
1570
|
-
return {
|
|
1571
|
-
firstDayOfMonth: n,
|
|
1572
|
-
lastDayOfMonth: r,
|
|
1573
|
-
startingDay: a,
|
|
1574
|
-
numDays: s,
|
|
1575
|
-
numRows: i,
|
|
1576
|
-
numDaysPrevMonth: c,
|
|
1577
|
-
initialWeek: d
|
|
1578
|
-
};
|
|
1579
|
-
}
|
|
1580
|
-
function nn(t, e, n, r) {
|
|
1581
|
-
const { startingDay: a, numDays: s } = r;
|
|
1582
|
-
return t === 0 && e < a ? "prev-month" : n > s ? "next-month" : "current-month";
|
|
1583
|
-
}
|
|
1584
|
-
function rn(t, e, n, r) {
|
|
1585
|
-
const { startingDay: a, numDaysPrevMonth: s, numDays: i } = r;
|
|
1586
|
-
return t === "prev-month" ? s - (a - e - 1) : t === "next-month" ? n - i : n;
|
|
1587
|
-
}
|
|
1588
|
-
function W(t) {
|
|
1589
|
-
return typeof t == "string" && (t = t.split(",")), t.length === 1 && t[0] === "" ? [] : t.map((e) => O(e));
|
|
1590
|
-
}
|
|
1591
|
-
function gt(t, e) {
|
|
1592
|
-
const n = bt({ start: t, end: e }), r = {};
|
|
1593
|
-
if (Array.isArray(n) && n.length)
|
|
1594
|
-
for (let a = 0; a < n.length; a++) {
|
|
1595
|
-
const s = n[a], i = s > t && s < e;
|
|
1596
|
-
r[y(s)] = i;
|
|
1597
|
-
}
|
|
1598
|
-
return r;
|
|
1599
|
-
}
|
|
1600
|
-
function xt(t, e, n, r) {
|
|
1601
|
-
if (e.length !== 1) return !0;
|
|
1602
|
-
const a = bt({
|
|
1603
|
-
start: e[0],
|
|
1604
|
-
end: t
|
|
1605
|
-
});
|
|
1606
|
-
if (!Array.isArray(a) || !a.length) return !0;
|
|
1607
|
-
for (let s = 0; s < a.length; s++) {
|
|
1608
|
-
for (const i of n ?? [])
|
|
1609
|
-
if (i > e[0] && i < t)
|
|
1610
|
-
return !1;
|
|
1611
|
-
if ((r ?? []).includes(Ie(a[s]).toString()))
|
|
1612
|
-
return !1;
|
|
1613
|
-
}
|
|
1614
|
-
return !0;
|
|
1615
|
-
}
|
|
1616
|
-
function tt(t, e) {
|
|
1617
|
-
const n = y(t);
|
|
1618
|
-
return e.includes(n) ? e : [...e, n];
|
|
1619
|
-
}
|
|
1620
|
-
function et(t, e) {
|
|
1621
|
-
const n = y(t), r = e.indexOf(n);
|
|
1622
|
-
if (r === -1) return e;
|
|
1623
|
-
if (e.length === 1) return [];
|
|
1624
|
-
const a = [...e];
|
|
1625
|
-
return a.splice(r, 1), a;
|
|
1626
|
-
}
|
|
1627
|
-
function an(t, e, n) {
|
|
1628
|
-
const r = y(t);
|
|
1629
|
-
return e.includes(r) ? et(t, e) : n > 0 && e.length >= n ? e : tt(t, e);
|
|
1630
|
-
}
|
|
1631
|
-
function sn(t, e, n) {
|
|
1632
|
-
const r = y(t), a = W(e);
|
|
1633
|
-
if (e.includes(r))
|
|
1634
|
-
return e.indexOf(r) === 0 ? [] : et(t, e);
|
|
1635
|
-
if (e.length > 1)
|
|
1636
|
-
return [r];
|
|
1637
|
-
if (e.length === 1) {
|
|
1638
|
-
if (!xt(t, a, n.excludedates, n.excludeweekdays))
|
|
1639
|
-
return [r];
|
|
1640
|
-
if (a[0] > t)
|
|
1641
|
-
return [r];
|
|
1642
|
-
}
|
|
1643
|
-
return tt(t, e);
|
|
1644
|
-
}
|
|
1645
|
-
const on = {
|
|
1646
|
-
ArrowLeft: -1,
|
|
1647
|
-
ArrowRight: 1,
|
|
1648
|
-
ArrowUp: -L,
|
|
1649
|
-
ArrowDown: L
|
|
1650
|
-
};
|
|
1651
|
-
function cn(t) {
|
|
1652
|
-
var n;
|
|
1653
|
-
const e = t.nodeName;
|
|
1654
|
-
return e === "INPUT" || e === "SELECT" || e === "BUTTON" && !((n = t.dataset) != null && n.date);
|
|
1655
|
-
}
|
|
1656
|
-
function un(t, e, n) {
|
|
1657
|
-
let r = it(t, e);
|
|
1658
|
-
if (!r) return null;
|
|
1659
|
-
let a = n(`button[data-date="${y(r)}"]`);
|
|
1660
|
-
for (; a instanceof HTMLButtonElement && a.dataset.disabled; )
|
|
1661
|
-
if (r = it(r, e), a = n(`button[data-date="${y(r)}"]`), !a) return null;
|
|
1662
|
-
return r;
|
|
1663
|
-
}
|
|
1664
|
-
function ln(t) {
|
|
1665
|
-
return on[t] ?? null;
|
|
1666
|
-
}
|
|
1667
|
-
var hn = Object.defineProperty, dn = Object.getOwnPropertyDescriptor, h = (t, e, n, r) => {
|
|
1668
|
-
for (var a = r > 1 ? void 0 : r ? dn(e, n) : e, s = t.length - 1, i; s >= 0; s--)
|
|
1669
|
-
(i = t[s]) && (a = (r ? i(e, n, a) : i(a)) || a);
|
|
1670
|
-
return r && a && hn(e, n, a), a;
|
|
1671
|
-
};
|
|
1672
|
-
let l = class extends Pt {
|
|
1673
|
-
constructor() {
|
|
1674
|
-
super(...arguments), this.selected = [], this.multiple = P.props.multiple.default, this.maxMultiple = P.props.maxMultiple.default, this.range = P.props.range.default, this.earliest = P.props.earliest.default, this.latest = P.props.latest.default, this.excludedates = [], this.excludeweekdays = [], this.weeknumbers = P.props.weeknumbers.default, this.withcontrols = P.props.withcontrols.default, this.currentmonth = null, this.today = null, this.dayStrings = this.strings.dates.daysShort, this.dayStringsLong = this.strings.dates.days, this.monthStrings = this.strings.dates.months, this.weekString = this.strings.dates.week, this.prevMonthString = this.strings.dates.prevMonth, this.nextMonthString = this.strings.dates.nextMonth, this._selected = [], this.inRange = {}, this.rangeHovered = null, this.year = 0, this.month = 0, this.week = 0, this.currentmonthtouched = !1, this.focusedDate = null, this.selectableDates = [], this.tabIndexSet = 0;
|
|
1675
|
-
}
|
|
1676
|
-
get todayDate() {
|
|
1677
|
-
return this.today ? O(this.today) : Ue();
|
|
1678
|
-
}
|
|
1679
|
-
/**
|
|
1680
|
-
* Lifecycle methods
|
|
1681
|
-
*/
|
|
1682
|
-
firstUpdated(t) {
|
|
1683
|
-
this.addEventListener("keydown", this.handleKeydown);
|
|
1684
|
-
}
|
|
1685
|
-
disconnectedCallback() {
|
|
1686
|
-
this.removeEventListener("keydown", this.handleKeydown), super.disconnectedCallback();
|
|
1687
|
-
}
|
|
1688
|
-
updated(t) {
|
|
1689
|
-
super.updated(t), t.has("selected") && this.convertSelected();
|
|
1690
|
-
}
|
|
1691
|
-
/**
|
|
1692
|
-
* Date and selection management
|
|
1693
|
-
*/
|
|
1694
|
-
convertSelected() {
|
|
1695
|
-
typeof this.selected == "string" && (this.selected = this.selected.split(",")), this.selected.length === 1 && this.selected[0] === "" && (this.selected = []), this._selected = W(this.selected), this.range && this.selected.length === 2 && (this.inRange = gt(this._selected[0], this._selected[1])), this.setCurrentMonth();
|
|
1696
|
-
}
|
|
1697
|
-
setCurrentMonth() {
|
|
1698
|
-
if (this.currentmonth === null && !this.currentmonthtouched && (this.currentmonthtouched = !0), this.selected.length && this.selected[0] !== "") {
|
|
1699
|
-
const t = O(this.selected[this.selected.length - 1]);
|
|
1700
|
-
this.currentmonth = isNaN(t.getTime()) ? A(this.todayDate) : t;
|
|
1701
|
-
} else this.currentmonth === null && (this.currentmonth = A(this.todayDate));
|
|
1702
|
-
(!this.currentmonth || isNaN(this.currentmonth.getTime())) && (this.currentmonth = A(this.todayDate)), this.year = this.currentmonth.getFullYear(), this.month = this.currentmonth.getMonth();
|
|
1703
|
-
}
|
|
1704
|
-
/**
|
|
1705
|
-
* Keyboard navigation
|
|
1706
|
-
*/
|
|
1707
|
-
handleKeydown(t) {
|
|
1708
|
-
const e = ln(t.key);
|
|
1709
|
-
e !== null && this.handleArrowKey(t, e);
|
|
1710
|
-
}
|
|
1711
|
-
handleArrowKey(t, e) {
|
|
1712
|
-
const n = t.target;
|
|
1713
|
-
if (cn(n)) return;
|
|
1714
|
-
if (t.preventDefault(), !this.focusedDate) {
|
|
1715
|
-
this.focusOnCurrentDate();
|
|
1716
|
-
return;
|
|
1717
|
-
}
|
|
1718
|
-
const r = this.focusedDate ? _(this.focusedDate) : $(this.year, this.month, 1), a = un(r, e, this.querySelector.bind(this));
|
|
1719
|
-
if (a) {
|
|
1720
|
-
const s = this.querySelector(`button[data-date="${y(a)}"]`);
|
|
1721
|
-
s instanceof HTMLButtonElement && !s.dataset.disabled && (this.focusedDate = y(a), s.focus());
|
|
1722
|
-
}
|
|
1723
|
-
}
|
|
1724
|
-
/**
|
|
1725
|
-
* Rendering methods
|
|
1726
|
-
*/
|
|
1727
|
-
render() {
|
|
1728
|
-
return D`
|
|
1729
|
-
<div
|
|
1730
|
-
class="pkt-calendar ${this.weeknumbers ? "pkt-cal-weeknumbers" : ""}"
|
|
1731
|
-
@focusout=${this.closeEvent}
|
|
1732
|
-
@keydown=${(t) => {
|
|
1733
|
-
t.key === "Escape" && (t.preventDefault(), this.close());
|
|
1734
|
-
}}
|
|
1735
|
-
>
|
|
1736
|
-
<nav class="pkt-cal-month-nav">
|
|
1737
|
-
${this.renderMonthNavButton("prev")}
|
|
1738
|
-
${this.renderMonthNav()}
|
|
1739
|
-
${this.renderMonthNavButton("next")}
|
|
1740
|
-
</nav>
|
|
1741
|
-
<table
|
|
1742
|
-
class="pkt-cal-days pkt-txt-12-medium pkt-calendar__body"
|
|
1743
|
-
role="grid"
|
|
1744
|
-
?aria-multiselectable=${this.range || this.multiple}
|
|
1745
|
-
>
|
|
1746
|
-
<thead>
|
|
1747
|
-
${this.renderDayNames()}
|
|
1748
|
-
</thead>
|
|
1749
|
-
<tbody>
|
|
1750
|
-
${this.renderCalendarBody()}
|
|
1751
|
-
</tbody>
|
|
1752
|
-
</table>
|
|
1753
|
-
</div>
|
|
1754
|
-
`;
|
|
1755
|
-
}
|
|
1756
|
-
renderMonthNavButton(t) {
|
|
1757
|
-
const e = t === "prev", n = e ? this.isPrevMonthAllowed() : this.isNextMonthAllowed(), r = e ? this.prevMonthString : this.nextMonthString, a = e ? "chevron-thin-left" : "chevron-thin-right", s = e ? "pkt-calendar__prev-month" : "pkt-calendar__next-month", i = e ? () => this.prevMonth() : () => this.nextMonth();
|
|
1758
|
-
return D`<div>
|
|
1759
|
-
<button
|
|
1760
|
-
type="button"
|
|
1761
|
-
aria-label="${r}"
|
|
1762
|
-
@click=${() => n && i()}
|
|
1763
|
-
@keydown=${(o) => {
|
|
1764
|
-
(o.key === "Enter" || o.key === " ") && (o.preventDefault(), n && i());
|
|
1765
|
-
}}
|
|
1766
|
-
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only ${s} ${n ? "" : "pkt-invisible"}"
|
|
1767
|
-
.data-disabled=${n ? at : "disabled"}
|
|
1768
|
-
?aria-disabled=${!n}
|
|
1769
|
-
tabindex=${n ? "0" : "-1"}
|
|
1770
|
-
>
|
|
1771
|
-
<pkt-icon class="pkt-btn__icon" name="${a}"></pkt-icon>
|
|
1772
|
-
<span class="pkt-btn__text">${r}</span>
|
|
1773
|
-
</button>
|
|
1774
|
-
</div>`;
|
|
1775
|
-
}
|
|
1776
|
-
renderDayNames() {
|
|
1777
|
-
const t = [];
|
|
1778
|
-
this.weeknumbers && t.push(D`<th><div class="pkt-calendar__week-number">${this.weekString}</div></th>`);
|
|
1779
|
-
for (let e = 0; e < this.dayStrings.length; e++)
|
|
1780
|
-
t.push(
|
|
1781
|
-
D`<th>
|
|
1782
|
-
<div class="pkt-calendar__day-name" aria-label="${this.dayStringsLong[e]}">
|
|
1783
|
-
${this.dayStrings[e]}
|
|
1784
|
-
</div>
|
|
1785
|
-
</th>`
|
|
1786
|
-
);
|
|
1787
|
-
return D`<tr class="pkt-cal-week-row">${t}</tr>`;
|
|
1788
|
-
}
|
|
1789
|
-
renderMonthNav() {
|
|
1790
|
-
return this.withcontrols ? D`<div class="pkt-cal-month-picker">
|
|
1791
|
-
<label for="${this.id}-monthnav" class="pkt-hide">${this.strings.dates.month}</label>
|
|
1792
|
-
<select
|
|
1793
|
-
aria-label="${this.strings.dates.month}"
|
|
1794
|
-
class="pkt-input pkt-input-compact"
|
|
1795
|
-
id="${this.id}-monthnav"
|
|
1796
|
-
@change=${(t) => {
|
|
1797
|
-
t.stopImmediatePropagation();
|
|
1798
|
-
const e = t.target;
|
|
1799
|
-
this.changeMonth(this.year, parseInt(e.value));
|
|
1800
|
-
}}
|
|
1801
|
-
>
|
|
1802
|
-
${this.monthStrings.map(
|
|
1803
|
-
(t, e) => D`<option value=${e} ?selected=${this.month === e}>${t}</option>`
|
|
1804
|
-
)}
|
|
1805
|
-
</select>
|
|
1806
|
-
<label for="${this.id}-yearnav" class="pkt-hide">${this.strings.dates.year}</label>
|
|
1807
|
-
<input
|
|
1808
|
-
aria-label="${this.strings.dates.year}"
|
|
1809
|
-
class="pkt-input pkt-cal-input-year pkt-input-compact"
|
|
1810
|
-
id="${this.id}-yearnav"
|
|
1811
|
-
type="number"
|
|
1812
|
-
size="4"
|
|
1813
|
-
placeholder="0000"
|
|
1814
|
-
@change=${(t) => {
|
|
1815
|
-
t.stopImmediatePropagation();
|
|
1816
|
-
const e = t.target;
|
|
1817
|
-
this.changeMonth(parseInt(e.value), this.month);
|
|
1818
|
-
}}
|
|
1819
|
-
.value=${this.year}
|
|
1820
|
-
/>
|
|
1821
|
-
</div>` : D`<div class="pkt-txt-16-medium pkt-calendar__month-title" aria-live="polite">
|
|
1822
|
-
${this.monthStrings[this.month]} ${this.year}
|
|
1823
|
-
</div>`;
|
|
1824
|
-
}
|
|
1825
|
-
getDayViewData(t, e) {
|
|
1826
|
-
const n = $(this.year, this.month, t), r = y(n), a = r === y(e), s = this.selected.includes(r), i = this.isDayDisabled(n, s), o = this.calculateTabIndex(r, i, t);
|
|
1827
|
-
return {
|
|
1828
|
-
currentDate: n,
|
|
1829
|
-
currentDateISO: r,
|
|
1830
|
-
isToday: a,
|
|
1831
|
-
isSelected: s,
|
|
1832
|
-
isDisabled: i,
|
|
1833
|
-
ariaLabel: Le(n),
|
|
1834
|
-
tabindex: o
|
|
1835
|
-
};
|
|
1836
|
-
}
|
|
1837
|
-
getDateConstraints() {
|
|
1838
|
-
return {
|
|
1839
|
-
earliest: this.earliest,
|
|
1840
|
-
latest: this.latest,
|
|
1841
|
-
excludedates: this.excludedates,
|
|
1842
|
-
excludeweekdays: this.excludeweekdays
|
|
1843
|
-
};
|
|
1844
|
-
}
|
|
1845
|
-
isDayDisabled(t, e) {
|
|
1846
|
-
return Je(t, e, this.getDateConstraints(), {
|
|
1847
|
-
multiple: this.multiple,
|
|
1848
|
-
maxMultiple: this.maxMultiple,
|
|
1849
|
-
selectedCount: this.selected.length
|
|
1850
|
-
});
|
|
1851
|
-
}
|
|
1852
|
-
calculateTabIndex(t, e, n) {
|
|
1853
|
-
return this.focusedDate ? this.focusedDate === t && !e ? "0" : "-1" : !e && this.tabIndexSet === 0 ? (this.tabIndexSet = n, "0") : this.tabIndexSet === n ? "0" : "-1";
|
|
1854
|
-
}
|
|
1855
|
-
getDayCellClasses(t) {
|
|
1856
|
-
const { currentDateISO: e, isToday: n, isSelected: r } = t, a = this.range && (this.selected.length === 2 || this.rangeHovered !== null) && e === this.selected[0], s = this.range && this.selected.length === 2 && e === this.selected[1];
|
|
1857
|
-
return {
|
|
1858
|
-
"pkt-cal-today": n,
|
|
1859
|
-
"pkt-cal-selected": r,
|
|
1860
|
-
"pkt-cal-in-range": this.inRange[e],
|
|
1861
|
-
"pkt-cal-excluded": this.isExcluded(t.currentDate),
|
|
1862
|
-
"pkt-cal-in-range-first": a,
|
|
1863
|
-
"pkt-cal-in-range-last": s,
|
|
1864
|
-
"pkt-cal-range-hover": this.rangeHovered !== null && e === y(this.rangeHovered)
|
|
1865
|
-
};
|
|
1866
|
-
}
|
|
1867
|
-
getDayButtonClasses(t) {
|
|
1868
|
-
const { currentDateISO: e, isToday: n, isSelected: r, isDisabled: a } = t, s = this.range && (this.selected.length === 2 || this.rangeHovered !== null) && e === this.selected[0], i = this.range && this.selected.length === 2 && e === this.selected[1];
|
|
1869
|
-
return {
|
|
1870
|
-
"pkt-calendar__date": !0,
|
|
1871
|
-
"pkt-calendar__date--today": n,
|
|
1872
|
-
"pkt-calendar__date--selected": r,
|
|
1873
|
-
"pkt-calendar__date--disabled": a,
|
|
1874
|
-
"pkt-calendar__date--in-range": this.inRange[e],
|
|
1875
|
-
"pkt-calendar__date--in-range-hover": this.rangeHovered !== null && e === y(this.rangeHovered),
|
|
1876
|
-
"pkt-calendar__date--range-start": s,
|
|
1877
|
-
"pkt-calendar__date--range-end": i
|
|
1878
|
-
};
|
|
1879
|
-
}
|
|
1880
|
-
handleDayFocus(t, e) {
|
|
1881
|
-
this.range && !this.isExcluded(t) && this.handleRangeHover(t), this.focusedDate = e;
|
|
1882
|
-
}
|
|
1883
|
-
renderDayView(t, e) {
|
|
1884
|
-
const n = this.getDayViewData(t, e), { currentDate: r, currentDateISO: a, isSelected: s, isDisabled: i, ariaLabel: o, tabindex: c } = n;
|
|
1885
|
-
this.selectableDates.push({ currentDateISO: a, isDisabled: i, tabindex: c });
|
|
1886
|
-
const d = this.getDayCellClasses(n), g = this.getDayButtonClasses(n);
|
|
1887
|
-
return D`<td class=${rt(d)}>
|
|
1888
|
-
<button
|
|
1889
|
-
type="button"
|
|
1890
|
-
aria-pressed=${s ? "true" : "false"}
|
|
1891
|
-
?disabled=${i}
|
|
1892
|
-
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only ${rt(g)}"
|
|
1893
|
-
@mouseover=${() => this.range && !this.isExcluded(r) && this.handleRangeHover(r)}
|
|
1894
|
-
@focus=${() => this.handleDayFocus(r, a)}
|
|
1895
|
-
aria-label="${o}"
|
|
1896
|
-
tabindex=${c}
|
|
1897
|
-
data-disabled=${i ? "disabled" : at}
|
|
1898
|
-
data-date=${a}
|
|
1899
|
-
@keydown=${(m) => {
|
|
1900
|
-
(m.key === "Enter" || m.key === " ") && (m.preventDefault(), this.handleDateSelect(r));
|
|
1901
|
-
}}
|
|
1902
|
-
@click=${(m) => {
|
|
1903
|
-
i || (m.preventDefault(), this.handleDateSelect(r));
|
|
1904
|
-
}}
|
|
1905
|
-
>
|
|
1906
|
-
<span class="pkt-btn__text pkt-txt-14-light">${t}</span>
|
|
1907
|
-
</button>
|
|
1908
|
-
</td>`;
|
|
1909
|
-
}
|
|
1910
|
-
renderEmptyDayCell(t) {
|
|
1911
|
-
return D`<td class="pkt-cal-other">
|
|
1912
|
-
<div
|
|
1913
|
-
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only"
|
|
1914
|
-
data-disabled="disabled"
|
|
1915
|
-
>
|
|
1916
|
-
<span class="pkt-btn__text pkt-txt-14-light">${t}</span>
|
|
1917
|
-
</div>
|
|
1918
|
-
</td>`;
|
|
1919
|
-
}
|
|
1920
|
-
renderWeekRow(t) {
|
|
1921
|
-
return D`<tr class="pkt-cal-week-row" role="row">${t}</tr>`;
|
|
1922
|
-
}
|
|
1923
|
-
renderCalendarBody() {
|
|
1924
|
-
const t = this.todayDate, e = en(this.year, this.month);
|
|
1925
|
-
this.selectableDates = [], this.tabIndexSet = 0;
|
|
1926
|
-
let n = 1;
|
|
1927
|
-
this.week = e.initialWeek;
|
|
1928
|
-
const r = [];
|
|
1929
|
-
for (let a = 0; a < e.numRows; a++) {
|
|
1930
|
-
const s = [];
|
|
1931
|
-
this.weeknumbers && s.push(D`<td class="pkt-cal-week">${this.week}</td>`), this.week++;
|
|
1932
|
-
for (let i = 0; i < L; i++) {
|
|
1933
|
-
const o = nn(a, i, n, e);
|
|
1934
|
-
if (o === "current-month")
|
|
1935
|
-
s.push(this.renderDayView(n, t)), n++;
|
|
1936
|
-
else {
|
|
1937
|
-
const c = rn(o, i, n, e);
|
|
1938
|
-
s.push(this.renderEmptyDayCell(c)), o === "next-month" && n++;
|
|
1939
|
-
}
|
|
1940
|
-
}
|
|
1941
|
-
r.push(this.renderWeekRow(s));
|
|
1942
|
-
}
|
|
1943
|
-
return r;
|
|
1944
|
-
}
|
|
1945
|
-
/**
|
|
1946
|
-
* Date validation
|
|
1947
|
-
*/
|
|
1948
|
-
isExcluded(t) {
|
|
1949
|
-
return Tt(t, this.getDateConstraints());
|
|
1950
|
-
}
|
|
1951
|
-
/**
|
|
1952
|
-
* Month navigation
|
|
1953
|
-
*/
|
|
1954
|
-
isPrevMonthAllowed() {
|
|
1955
|
-
return Ke(this.year, this.month, this.earliest);
|
|
1956
|
-
}
|
|
1957
|
-
prevMonth() {
|
|
1958
|
-
const t = this.month === 0 ? 11 : this.month - 1, e = this.month === 0 ? this.year - 1 : this.year;
|
|
1959
|
-
this.changeMonth(e, t);
|
|
1960
|
-
}
|
|
1961
|
-
isNextMonthAllowed() {
|
|
1962
|
-
return Ze(this.year, this.month, this.latest);
|
|
1963
|
-
}
|
|
1964
|
-
nextMonth() {
|
|
1965
|
-
const t = this.month === 11 ? 0 : this.month + 1, e = this.month === 11 ? this.year + 1 : this.year;
|
|
1966
|
-
this.changeMonth(e, t);
|
|
1967
|
-
}
|
|
1968
|
-
changeMonth(t, e) {
|
|
1969
|
-
this.year = typeof t == "string" ? parseInt(t) : t, this.month = typeof e == "string" ? parseInt(e) : e, this.currentmonth = A(new Date(this.year, this.month, 1)), this.tabIndexSet = 0, this.focusedDate = null, this.selectableDates = [];
|
|
1970
|
-
}
|
|
1971
|
-
/**
|
|
1972
|
-
* Date selection logic
|
|
1973
|
-
*/
|
|
1974
|
-
emptySelected() {
|
|
1975
|
-
this.selected = [], this._selected = [], this.inRange = {};
|
|
1976
|
-
}
|
|
1977
|
-
normalizeSelected() {
|
|
1978
|
-
return typeof this.selected == "string" ? this.selected.split(",") : this.selected;
|
|
1979
|
-
}
|
|
1980
|
-
addToSelected(t) {
|
|
1981
|
-
this.selected = tt(t, this.normalizeSelected()), this._selected = W(this.selected), this.range && this.selected.length === 2 && (this.convertSelected(), this.close());
|
|
1982
|
-
}
|
|
1983
|
-
removeFromSelected(t) {
|
|
1984
|
-
this.selected = et(t, this.normalizeSelected()), this._selected = W(this.selected);
|
|
1985
|
-
}
|
|
1986
|
-
toggleSelected(t) {
|
|
1987
|
-
this.selected = an(t, this.normalizeSelected(), this.maxMultiple), this._selected = W(this.selected);
|
|
1988
|
-
}
|
|
1989
|
-
isRangeAllowed(t) {
|
|
1990
|
-
return xt(t, this._selected, this.excludedates, this.excludeweekdays);
|
|
1991
|
-
}
|
|
1992
|
-
handleRangeSelect(t) {
|
|
1993
|
-
return this.selected = sn(t, this.normalizeSelected(), {
|
|
1994
|
-
excludedates: this.excludedates,
|
|
1995
|
-
excludeweekdays: this.excludeweekdays
|
|
1996
|
-
}), this._selected = W(this.selected), this.selected.length === 2 ? (this.convertSelected(), this.close()) : this.selected.length === 1 && (this.inRange = {}), Promise.resolve();
|
|
1997
|
-
}
|
|
1998
|
-
handleRangeHover(t) {
|
|
1999
|
-
if (!this.range || this._selected.length !== 1 || !this.isRangeAllowed(t) || this._selected[0] >= t) {
|
|
2000
|
-
this.rangeHovered = null;
|
|
2001
|
-
return;
|
|
2002
|
-
}
|
|
2003
|
-
this.rangeHovered = t, this.inRange = gt(this._selected[0], t);
|
|
2004
|
-
}
|
|
2005
|
-
handleDateSelect(t) {
|
|
2006
|
-
return t && (this.range ? this.handleRangeSelect(t) : this.multiple ? this.toggleSelected(t) : (this.selected.includes(y(t)) ? this.emptySelected() : (this.emptySelected(), this.addToSelected(t)), this.close()), this.dispatchEvent(
|
|
2007
|
-
new CustomEvent("date-selected", {
|
|
2008
|
-
detail: this.selected,
|
|
2009
|
-
bubbles: !0,
|
|
2010
|
-
composed: !0
|
|
2011
|
-
})
|
|
2012
|
-
)), Promise.resolve();
|
|
2013
|
-
}
|
|
2014
|
-
/**
|
|
2015
|
-
* Focus management and event handlers
|
|
2016
|
-
*/
|
|
2017
|
-
focusOnCurrentDate() {
|
|
2018
|
-
const t = y(A(this.todayDate)), e = this.querySelector(`button[data-date="${t}"]`);
|
|
2019
|
-
if (e instanceof HTMLButtonElement) {
|
|
2020
|
-
this.focusedDate = t, e.focus();
|
|
2021
|
-
return;
|
|
2022
|
-
}
|
|
2023
|
-
const n = this.selectableDates.find((r) => !r.isDisabled);
|
|
2024
|
-
if (n) {
|
|
2025
|
-
const r = this.querySelector(
|
|
2026
|
-
`button[data-date="${n.currentDateISO}"]`
|
|
2027
|
-
);
|
|
2028
|
-
r instanceof HTMLButtonElement && (this.focusedDate = n.currentDateISO, r.focus());
|
|
2029
|
-
}
|
|
2030
|
-
}
|
|
2031
|
-
closeEvent(t) {
|
|
2032
|
-
!this.contains(t.relatedTarget) && !t.target.classList.contains("pkt-invisible") && this.close();
|
|
2033
|
-
}
|
|
2034
|
-
close() {
|
|
2035
|
-
this.dispatchEvent(
|
|
2036
|
-
new CustomEvent("close", {
|
|
2037
|
-
detail: !0,
|
|
2038
|
-
bubbles: !0,
|
|
2039
|
-
composed: !0
|
|
2040
|
-
})
|
|
2041
|
-
);
|
|
2042
|
-
}
|
|
2043
|
-
};
|
|
2044
|
-
h([
|
|
2045
|
-
f({ converter: z.csvToArray })
|
|
2046
|
-
], l.prototype, "selected", 2);
|
|
2047
|
-
h([
|
|
2048
|
-
f({ type: Boolean })
|
|
2049
|
-
], l.prototype, "multiple", 2);
|
|
2050
|
-
h([
|
|
2051
|
-
f({ type: Number, attribute: "max-multiple" })
|
|
2052
|
-
], l.prototype, "maxMultiple", 2);
|
|
2053
|
-
h([
|
|
2054
|
-
f({ type: Boolean })
|
|
2055
|
-
], l.prototype, "range", 2);
|
|
2056
|
-
h([
|
|
2057
|
-
f({ type: String })
|
|
2058
|
-
], l.prototype, "earliest", 2);
|
|
2059
|
-
h([
|
|
2060
|
-
f({ type: String })
|
|
2061
|
-
], l.prototype, "latest", 2);
|
|
2062
|
-
h([
|
|
2063
|
-
f({ converter: z.stringsToDate })
|
|
2064
|
-
], l.prototype, "excludedates", 2);
|
|
2065
|
-
h([
|
|
2066
|
-
f({ converter: z.csvToArray })
|
|
2067
|
-
], l.prototype, "excludeweekdays", 2);
|
|
2068
|
-
h([
|
|
2069
|
-
f({ type: Boolean })
|
|
2070
|
-
], l.prototype, "weeknumbers", 2);
|
|
2071
|
-
h([
|
|
2072
|
-
f({ type: Boolean })
|
|
2073
|
-
], l.prototype, "withcontrols", 2);
|
|
2074
|
-
h([
|
|
2075
|
-
f({ converter: z.stringToDate })
|
|
2076
|
-
], l.prototype, "currentmonth", 2);
|
|
2077
|
-
h([
|
|
2078
|
-
f({ type: String })
|
|
2079
|
-
], l.prototype, "today", 2);
|
|
2080
|
-
h([
|
|
2081
|
-
f({ type: Array, attribute: "day-strings" })
|
|
2082
|
-
], l.prototype, "dayStrings", 2);
|
|
2083
|
-
h([
|
|
2084
|
-
f({ type: Array, attribute: "day-strings-long" })
|
|
2085
|
-
], l.prototype, "dayStringsLong", 2);
|
|
2086
|
-
h([
|
|
2087
|
-
f({ type: Array, attribute: "month-strings" })
|
|
2088
|
-
], l.prototype, "monthStrings", 2);
|
|
2089
|
-
h([
|
|
2090
|
-
f({ type: String, attribute: "week-string" })
|
|
2091
|
-
], l.prototype, "weekString", 2);
|
|
2092
|
-
h([
|
|
2093
|
-
f({ type: String, attribute: "prev-month-string" })
|
|
2094
|
-
], l.prototype, "prevMonthString", 2);
|
|
2095
|
-
h([
|
|
2096
|
-
f({ type: String, attribute: "next-month-string" })
|
|
2097
|
-
], l.prototype, "nextMonthString", 2);
|
|
2098
|
-
h([
|
|
2099
|
-
f({ type: Array })
|
|
2100
|
-
], l.prototype, "_selected", 2);
|
|
2101
|
-
h([
|
|
2102
|
-
Z()
|
|
2103
|
-
], l.prototype, "inRange", 2);
|
|
2104
|
-
h([
|
|
2105
|
-
f({ type: Date })
|
|
2106
|
-
], l.prototype, "rangeHovered", 2);
|
|
2107
|
-
h([
|
|
2108
|
-
f({ type: Number })
|
|
2109
|
-
], l.prototype, "year", 2);
|
|
2110
|
-
h([
|
|
2111
|
-
f({ type: Number })
|
|
2112
|
-
], l.prototype, "month", 2);
|
|
2113
|
-
h([
|
|
2114
|
-
f({ type: Number })
|
|
2115
|
-
], l.prototype, "week", 2);
|
|
2116
|
-
h([
|
|
2117
|
-
Z()
|
|
2118
|
-
], l.prototype, "currentmonthtouched", 2);
|
|
2119
|
-
h([
|
|
2120
|
-
Z()
|
|
2121
|
-
], l.prototype, "focusedDate", 2);
|
|
2122
|
-
l = h([
|
|
2123
|
-
Nt("pkt-calendar")
|
|
2124
|
-
], l);
|
|
2125
|
-
export {
|
|
2126
|
-
l as P,
|
|
2127
|
-
wn as a,
|
|
2128
|
-
U as b,
|
|
2129
|
-
y as c,
|
|
2130
|
-
Sn as d,
|
|
2131
|
-
z as e,
|
|
2132
|
-
pn as f,
|
|
2133
|
-
Dn as i,
|
|
2134
|
-
_ as n,
|
|
2135
|
-
O as p,
|
|
2136
|
-
bn as s,
|
|
2137
|
-
je as v
|
|
2138
|
-
};
|