@oslokommune/punkt-elements 16.7.3 → 16.7.7
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 -5
- package/dist/pkt-backlink.cjs +1 -1
- package/dist/pkt-backlink.js +2 -5
- package/dist/pkt-breadcrumbs.cjs +1 -43
- package/dist/pkt-breadcrumbs.js +2 -81
- package/dist/pkt-button.cjs +1 -1
- package/dist/pkt-button.js +2 -5
- package/dist/pkt-calendar.cjs +1 -1
- package/dist/pkt-calendar.js +2 -5
- package/dist/pkt-card.cjs +1 -1
- package/dist/pkt-card.js +2 -5
- package/dist/pkt-checkbox.cjs +1 -1
- package/dist/pkt-checkbox.js +2 -5
- package/dist/pkt-combobox.cjs +1 -1
- package/dist/pkt-combobox.js +2 -5
- package/dist/pkt-consent.cjs +1 -1
- package/dist/pkt-consent.js +2 -5
- package/dist/pkt-datepicker.cjs +1 -1
- package/dist/pkt-datepicker.js +5 -9
- package/dist/pkt-header.cjs +1 -304
- package/dist/pkt-header.js +2 -861
- package/dist/pkt-heading.cjs +1 -1
- package/dist/pkt-heading.js +2 -5
- package/dist/pkt-helptext.cjs +1 -1
- package/dist/pkt-helptext.js +2 -5
- package/dist/pkt-icon.cjs +1 -1
- package/dist/pkt-icon.js +2 -5
- 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 -5
- package/dist/pkt-link.cjs +1 -1
- package/dist/pkt-link.js +2 -5
- package/dist/pkt-linkcard.cjs +1 -1
- package/dist/pkt-linkcard.js +2 -5
- package/dist/pkt-listbox.cjs +1 -1
- package/dist/pkt-listbox.js +2 -5
- package/dist/pkt-loader.cjs +1 -1
- package/dist/pkt-loader.js +2 -5
- package/dist/pkt-messagebox.cjs +1 -1
- package/dist/pkt-messagebox.js +2 -5
- package/dist/pkt-modal.cjs +1 -1
- package/dist/pkt-modal.js +2 -5
- 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 -5
- package/dist/pkt-radiobutton.cjs +1 -1
- package/dist/pkt-radiobutton.js +2 -5
- package/dist/pkt-select.cjs +1 -1
- package/dist/pkt-select.js +2 -5
- 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 -5
- package/dist/pkt-textarea.cjs +1 -1
- package/dist/pkt-textarea.js +2 -5
- package/dist/pkt-textinput.cjs +1 -1
- package/dist/pkt-textinput.js +2 -5
- package/dist/pkt-timepicker.cjs +1 -191
- package/dist/pkt-timepicker.js +2 -560
- 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/alert/alert.test.ts +1 -1
- package/src/components/alert/alert.ts +6 -6
- package/src/components/datepicker/datepicker-utils.test.ts +16 -23
- package/dist/accordionitem-_9AiCIvd.cjs +0 -34
- package/dist/accordionitem-dCfSrxh5.js +0 -140
- package/dist/alert-BtOk8yRH.cjs +0 -33
- package/dist/alert-DlY2_grU.js +0 -117
- package/dist/async-directive-CMzWMlZ5.js +0 -65
- package/dist/async-directive-DoMuclel.cjs +0 -5
- package/dist/backlink-Ce5Vldop.js +0 -49
- package/dist/backlink-y3dwjKPC.cjs +0 -13
- package/dist/booleanish-BKVonob4.cjs +0 -1
- package/dist/booleanish-C9R0tdXH.js +0 -11
- package/dist/button-B_TXwNzt.cjs +0 -27
- package/dist/button-BiY-wlKF.js +0 -139
- package/dist/calendar-B2pji2zn.cjs +0 -90
- package/dist/calendar-DhjQDC4C.js +0 -2140
- package/dist/card-BwMNB5Bb.cjs +0 -87
- package/dist/card-CGlmcMSR.js +0 -233
- package/dist/checkbox-BsJZYA26.js +0 -147
- package/dist/checkbox-CTY8f_qn.cjs +0 -31
- 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-DSB5WOxg.js +0 -815
- package/dist/combobox-DbICIgKG.cjs +0 -135
- package/dist/consent-DkOQpbsg.cjs +0 -11
- package/dist/consent-SNWV_mMU.js +0 -175
- package/dist/datepicker-BEWl9iz3.cjs +0 -273
- package/dist/datepicker-euHyzXnb.js +0 -1170
- 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-D2tVS6lS.js +0 -103
- package/dist/heading-DrzbgDb6.cjs +0 -1
- package/dist/helptext-BKtU4mas.js +0 -82
- package/dist/helptext-DcRC7wW2.cjs +0 -24
- package/dist/icon-CxQcIa5F.js +0 -105
- package/dist/icon-q81vqPK_.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-Bs4CRNst.js +0 -181
- package/dist/input-wrapper-Bv9aqqVq.cjs +0 -54
- package/dist/input-wrapper-CDgenrYA.js +0 -6
- package/dist/input-wrapper-EoSAbU-U.cjs +0 -1
- package/dist/link-C0rl-86s.cjs +0 -7
- package/dist/link-Cdqgl60z.js +0 -55
- package/dist/linkcard-Dimu7Rlx.cjs +0 -13
- package/dist/linkcard-Lbq_UhjZ.js +0 -56
- package/dist/listbox-Bia4_tvN.js +0 -440
- package/dist/listbox-La2GZQei.cjs +0 -106
- package/dist/loader-D1ugDXGV.cjs +0 -16
- package/dist/loader-DyN6RGC5.js +0 -95
- package/dist/messagebox-BGMVm2t9.js +0 -71
- package/dist/messagebox-M0yIgCz9.cjs +0 -13
- package/dist/modal-CMO1RtIi.cjs +0 -36
- package/dist/modal-DjPQDE-Z.js +0 -156
- package/dist/pkt-options-controller-5LXbEzuk.cjs +0 -1
- package/dist/pkt-options-controller-B5YalfCb.js +0 -39
- package/dist/progressbar-BqlMzkM_.cjs +0 -21
- package/dist/progressbar-sbHDFC12.js +0 -162
- package/dist/radiobutton-5ZqVVtTT.cjs +0 -31
- package/dist/radiobutton-D8Ai8ETa.js +0 -113
- 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-De-n8on9.js +0 -230
- package/dist/select-dTWibR6_.cjs +0 -49
- package/dist/state-C_1EOo3D.js +0 -12
- package/dist/state-Dg-53wQ8.cjs +0 -5
- package/dist/tabitem-B9-jeV97.js +0 -334
- package/dist/tabitem-BnhzqfW3.cjs +0 -65
- package/dist/tag-CbwO8yvD.cjs +0 -27
- package/dist/tag-D4FI5t3y.js +0 -117
- package/dist/textarea-BmLaKzsc.cjs +0 -50
- package/dist/textarea-CMiSJaYL.js +0 -133
- package/dist/textinput-em9y4yrL.cjs +0 -70
- package/dist/textinput-r8udK0IX.js +0 -152
- package/dist/utils-DznhwRXm.js +0 -8
- package/dist/utils-byXsEz1u.cjs +0 -1
package/dist/button-BiY-wlKF.js
DELETED
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import { P as b, s as f } from "./element-with-slot-Dqk6-TRR.js";
|
|
2
|
-
import { t as u, A as h, b as l, n as e } from "./element-CPpT3rFQ.js";
|
|
3
|
-
import { e as y } from "./class-map-CEnykyO_.js";
|
|
4
|
-
import { o as a } from "./if-defined-B0krMLad.js";
|
|
5
|
-
import "./icon-CxQcIa5F.js";
|
|
6
|
-
var m = Object.defineProperty, s = (r, t, n, p) => {
|
|
7
|
-
for (var o = void 0, d = r.length - 1, c; d >= 0; d--)
|
|
8
|
-
(c = r[d]) && (o = c(t, n, o) || o);
|
|
9
|
-
return o && m(t, n, o), o;
|
|
10
|
-
};
|
|
11
|
-
window.pktAnimationPath = window.pktAnimationPath || "https://punkt-cdn.oslo.kommune.no/latest/animations/";
|
|
12
|
-
class i extends b {
|
|
13
|
-
constructor() {
|
|
14
|
-
super(...arguments), this.iconName = "user", this.secondIconName = "user", this.mode = "light", this.size = "medium", this.fullWidth = !1, this.fullWidthOnMobile = !1, this.skin = "primary", this.variant = "label-only", this.state = "normal", this.type = "button", this.form = void 0, this.isLoading = !1, this.disabled = !1, this.loadingAnimationPath = window.pktAnimationPath;
|
|
15
|
-
}
|
|
16
|
-
// Lifecycle
|
|
17
|
-
connectedCallback() {
|
|
18
|
-
super.connectedCallback(), this.addEventListener(
|
|
19
|
-
"click",
|
|
20
|
-
(t) => {
|
|
21
|
-
(this.disabled || this.hasAttribute("disabled") || this.isLoading) && (t.preventDefault(), t.stopImmediatePropagation());
|
|
22
|
-
},
|
|
23
|
-
!0
|
|
24
|
-
), this.addEventListener(
|
|
25
|
-
"keydown",
|
|
26
|
-
(t) => {
|
|
27
|
-
(this.disabled || this.hasAttribute("disabled") || this.isLoading) && (t.key === "Enter" || t.key === " ") && (t.preventDefault(), t.stopImmediatePropagation());
|
|
28
|
-
},
|
|
29
|
-
!0
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
attributeChangedCallback(t, n, p) {
|
|
33
|
-
super.attributeChangedCallback(t, n, p), t === "disabled" && p === "false" && (this.disabled = !1), (t === "isloading" || t === "isLoading") && p === "false" && (this.isLoading = !1);
|
|
34
|
-
}
|
|
35
|
-
firstUpdated(t) {
|
|
36
|
-
super.firstUpdated(t), this.disabled === "false" && (this.disabled = !1), this.isLoading === "false" && (this.isLoading = !1);
|
|
37
|
-
}
|
|
38
|
-
// Render
|
|
39
|
-
render() {
|
|
40
|
-
const t = this.form ?? this.getAttribute("form") ?? void 0, n = {
|
|
41
|
-
"pkt-btn": !0,
|
|
42
|
-
[`pkt-btn--${this.size}`]: !!this.size,
|
|
43
|
-
[`pkt-btn--${this.skin}`]: !!this.skin,
|
|
44
|
-
[`pkt-btn--${this.variant}`]: !!this.variant,
|
|
45
|
-
[`pkt-btn--${this.color}`]: !!this.color,
|
|
46
|
-
[`pkt-btn--${this.state}`]: !!this.state,
|
|
47
|
-
"pkt-btn--full": !!this.fullWidth,
|
|
48
|
-
"pkt-btn--full-small": !!this.fullWidthOnMobile,
|
|
49
|
-
"pkt-btn--disabled": !!this.disabled,
|
|
50
|
-
"pkt-btn--isLoading": !!this.isLoading
|
|
51
|
-
};
|
|
52
|
-
return l`
|
|
53
|
-
<button
|
|
54
|
-
class=${y(n)}
|
|
55
|
-
type=${this.type}
|
|
56
|
-
?disabled=${!!this.disabled}
|
|
57
|
-
aria-busy=${a(this.isLoading ? "true" : void 0)}
|
|
58
|
-
aria-disabled=${a(this.disabled || this.isLoading ? "true" : void 0)}
|
|
59
|
-
form=${a(t)}
|
|
60
|
-
>
|
|
61
|
-
${this.isLoading ? l`<pkt-icon
|
|
62
|
-
class="pkt-btn__icon pkt-btn__spinner"
|
|
63
|
-
name="spinner-blue"
|
|
64
|
-
path=${a(this.loadingAnimationPath)}
|
|
65
|
-
></pkt-icon>` : h}
|
|
66
|
-
${this.variant !== "label-only" ? l`<pkt-icon
|
|
67
|
-
class="pkt-btn__icon pkt-icon"
|
|
68
|
-
name=${this.iconName}
|
|
69
|
-
path=${a(this.iconPath)}
|
|
70
|
-
></pkt-icon>` : h}
|
|
71
|
-
<span class="pkt-btn__text">${f(this)}</span>
|
|
72
|
-
${this.variant === "icons-right-and-left" ? l`<pkt-icon
|
|
73
|
-
class="pkt-btn__icon"
|
|
74
|
-
name=${this.secondIconName}
|
|
75
|
-
path=${a(this.secondIconPath)}
|
|
76
|
-
></pkt-icon>` : h}
|
|
77
|
-
</button>
|
|
78
|
-
`;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
s([
|
|
82
|
-
e({ type: String })
|
|
83
|
-
], i.prototype, "iconName");
|
|
84
|
-
s([
|
|
85
|
-
e({ type: String })
|
|
86
|
-
], i.prototype, "secondIconName");
|
|
87
|
-
s([
|
|
88
|
-
e({ type: String })
|
|
89
|
-
], i.prototype, "iconPath");
|
|
90
|
-
s([
|
|
91
|
-
e({ type: String })
|
|
92
|
-
], i.prototype, "secondIconPath");
|
|
93
|
-
s([
|
|
94
|
-
e({ type: String })
|
|
95
|
-
], i.prototype, "mode");
|
|
96
|
-
s([
|
|
97
|
-
e({ type: String })
|
|
98
|
-
], i.prototype, "size");
|
|
99
|
-
s([
|
|
100
|
-
e({ type: Boolean, attribute: "full-width" })
|
|
101
|
-
], i.prototype, "fullWidth");
|
|
102
|
-
s([
|
|
103
|
-
e({ type: Boolean, attribute: "full-width-on-mobile" })
|
|
104
|
-
], i.prototype, "fullWidthOnMobile");
|
|
105
|
-
s([
|
|
106
|
-
e({ type: String })
|
|
107
|
-
], i.prototype, "color");
|
|
108
|
-
s([
|
|
109
|
-
e({ type: String })
|
|
110
|
-
], i.prototype, "skin");
|
|
111
|
-
s([
|
|
112
|
-
e({ type: String })
|
|
113
|
-
], i.prototype, "variant");
|
|
114
|
-
s([
|
|
115
|
-
e({ type: String, reflect: !0 })
|
|
116
|
-
], i.prototype, "state");
|
|
117
|
-
s([
|
|
118
|
-
e({ type: String, reflect: !0 })
|
|
119
|
-
], i.prototype, "type");
|
|
120
|
-
s([
|
|
121
|
-
e({ type: String })
|
|
122
|
-
], i.prototype, "form");
|
|
123
|
-
s([
|
|
124
|
-
e({ type: Boolean, reflect: !0 })
|
|
125
|
-
], i.prototype, "isLoading");
|
|
126
|
-
s([
|
|
127
|
-
e({ type: Boolean, reflect: !0 })
|
|
128
|
-
], i.prototype, "disabled");
|
|
129
|
-
s([
|
|
130
|
-
e({ type: String })
|
|
131
|
-
], i.prototype, "loadingAnimationPath");
|
|
132
|
-
try {
|
|
133
|
-
u("pkt-button")(i);
|
|
134
|
-
} catch {
|
|
135
|
-
console.warn("Forsøker å definere <pkt-button>, men den er allerede definert");
|
|
136
|
-
}
|
|
137
|
-
export {
|
|
138
|
-
i as P
|
|
139
|
-
};
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
"use strict";const nt=require("./class-map-CsENJXf1.cjs"),u=require("./element-gR_VtSiD.cjs"),K=require("./state-Dg-53wQ8.cjs");require("./icon-q81vqPK_.cjs");const mt=6048e5,Ot=864e5,rt=Symbol.for("constructDateFrom");function k(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&rt in e?e[rt](t):e instanceof Date?new e.constructor(t):new Date(t)}function D(e,t){return k(t||e,e)}function at(e,t,n){const r=D(e,n==null?void 0:n.in);return isNaN(t)?k(e,NaN):(t&&r.setDate(r.getDate()+t),r)}let Pt={};function B(){return Pt}function R(e,t){var o,c,d,m;const n=B(),r=(t==null?void 0:t.weekStartsOn)??((c=(o=t==null?void 0:t.locale)==null?void 0:o.options)==null?void 0:c.weekStartsOn)??n.weekStartsOn??((m=(d=n.locale)==null?void 0:d.options)==null?void 0:m.weekStartsOn)??0,a=D(e,t==null?void 0:t.in),s=a.getDay(),i=(s<r?7:0)+s-r;return a.setDate(a.getDate()-i),a.setHours(0,0,0,0),a}function U(e,t){return R(e,{...t,weekStartsOn:1})}function gt(e,t){const n=D(e,t==null?void 0:t.in),r=n.getFullYear(),a=k(n,0);a.setFullYear(r+1,0,4),a.setHours(0,0,0,0);const s=U(a),i=k(n,0);i.setFullYear(r,0,4),i.setHours(0,0,0,0);const o=U(i);return n.getTime()>=s.getTime()?r+1:n.getTime()>=o.getTime()?r:r-1}function st(e){const t=D(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function yt(e,...t){const n=k.bind(null,t.find(r=>typeof r=="object"));return t.map(n)}function V(e,t){const n=D(e,t==null?void 0:t.in);return n.setHours(0,0,0,0),n}function Ct(e,t,n){const[r,a]=yt(n==null?void 0:n.in,e,t),s=V(r),i=V(a),o=+s-st(s),c=+i-st(i);return Math.round((o-c)/Ot)}function Nt(e,t){const n=gt(e,t),r=k(e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),U(r)}function $t(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function Et(e){return!(!$t(e)&&typeof e!="number"||isNaN(+D(e)))}function Wt(e,t){const n=D(e,t==null?void 0:t.in);return n.setHours(23,59,59,999),n}function _t(e,t){const[n,r]=yt(e,t.start,t.end);return{start:n,end:r}}function pt(e,t){const{start:n,end:r}=_t(t==null?void 0:t.in,e);let a=+n>+r;const s=a?+n:+r,i=a?r:n;i.setHours(0,0,0,0);let o=1;const c=[];for(;+i<=s;)c.push(k(n,i)),i.setDate(i.getDate()+o),i.setHours(0,0,0,0);return a?c.reverse():c}function Yt(e,t){const n=D(e,t==null?void 0:t.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}const It={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Ft=(e,t,n)=>{let r;const a=It[e];return typeof a=="string"?r=a:t===1?r=a.one:r=a.other.replace("{{count}}",t.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function Q(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const At={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Ht={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Rt={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},qt={date:Q({formats:At,defaultWidth:"full"}),time:Q({formats:Ht,defaultWidth:"full"}),dateTime:Q({formats:Rt,defaultWidth:"full"})},Lt={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Ut=(e,t,n,r)=>Lt[e];function I(e){return(t,n)=>{const r=n!=null&&n.context?String(n.context):"standalone";let a;if(r==="formatting"&&e.formattingValues){const i=e.defaultFormattingWidth||e.defaultWidth,o=n!=null&&n.width?String(n.width):i;a=e.formattingValues[o]||e.formattingValues[i]}else{const i=e.defaultWidth,o=n!=null&&n.width?String(n.width):e.defaultWidth;a=e.values[o]||e.values[i]}const s=e.argumentCallback?e.argumentCallback(t):t;return a[s]}}const Bt={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},zt={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},jt={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Qt={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Xt={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Gt={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Vt=(e,t)=>{const n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},Jt={ordinalNumber:Vt,era:I({values:Bt,defaultWidth:"wide"}),quarter:I({values:zt,defaultWidth:"wide",argumentCallback:e=>e-1}),month:I({values:jt,defaultWidth:"wide"}),day:I({values:Qt,defaultWidth:"wide"}),dayPeriod:I({values:Xt,defaultWidth:"wide",formattingValues:Gt,defaultFormattingWidth:"wide"})};function F(e){return(t,n={})=>{const r=n.width,a=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],s=t.match(a);if(!s)return null;const i=s[0],o=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(o)?Zt(o,p=>p.test(i)):Kt(o,p=>p.test(i));let d;d=e.valueCallback?e.valueCallback(c):c,d=n.valueCallback?n.valueCallback(d):d;const m=t.slice(i.length);return{value:d,rest:m}}}function Kt(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function Zt(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function te(e){return(t,n={})=>{const r=t.match(e.matchPattern);if(!r)return null;const a=r[0],s=t.match(e.parsePattern);if(!s)return null;let i=e.valueCallback?e.valueCallback(s[0]):s[0];i=n.valueCallback?n.valueCallback(i):i;const o=t.slice(a.length);return{value:i,rest:o}}}const ee=/^(\d+)(th|st|nd|rd)?/i,ne=/\d+/i,re={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},ae={any:[/^b/i,/^(a|c)/i]},se={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},ie={any:[/1/i,/2/i,/3/i,/4/i]},oe={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},ce={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},ue={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},le={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},he={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},de={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},fe={ordinalNumber:te({matchPattern:ee,parsePattern:ne,valueCallback:e=>parseInt(e,10)}),era:F({matchPatterns:re,defaultMatchWidth:"wide",parsePatterns:ae,defaultParseWidth:"any"}),quarter:F({matchPatterns:se,defaultMatchWidth:"wide",parsePatterns:ie,defaultParseWidth:"any",valueCallback:e=>e+1}),month:F({matchPatterns:oe,defaultMatchWidth:"wide",parsePatterns:ce,defaultParseWidth:"any"}),day:F({matchPatterns:ue,defaultMatchWidth:"wide",parsePatterns:le,defaultParseWidth:"any"}),dayPeriod:F({matchPatterns:he,defaultMatchWidth:"any",parsePatterns:de,defaultParseWidth:"any"})},me={code:"en-US",formatDistance:Ft,formatLong:qt,formatRelative:Ut,localize:Jt,match:fe,options:{weekStartsOn:0,firstWeekContainsDate:1}};function ge(e,t){const n=D(e,t==null?void 0:t.in);return Ct(n,Yt(n))+1}function ye(e,t){const n=D(e,t==null?void 0:t.in),r=+U(n)-+Nt(n);return Math.round(r/mt)+1}function wt(e,t){var m,p,w,v;const n=D(e,t==null?void 0:t.in),r=n.getFullYear(),a=B(),s=(t==null?void 0:t.firstWeekContainsDate)??((p=(m=t==null?void 0:t.locale)==null?void 0:m.options)==null?void 0:p.firstWeekContainsDate)??a.firstWeekContainsDate??((v=(w=a.locale)==null?void 0:w.options)==null?void 0:v.firstWeekContainsDate)??1,i=k((t==null?void 0:t.in)||e,0);i.setFullYear(r+1,0,s),i.setHours(0,0,0,0);const o=R(i,t),c=k((t==null?void 0:t.in)||e,0);c.setFullYear(r,0,s),c.setHours(0,0,0,0);const d=R(c,t);return+n>=+o?r+1:+n>=+d?r:r-1}function pe(e,t){var o,c,d,m;const n=B(),r=(t==null?void 0:t.firstWeekContainsDate)??((c=(o=t==null?void 0:t.locale)==null?void 0:o.options)==null?void 0:c.firstWeekContainsDate)??n.firstWeekContainsDate??((m=(d=n.locale)==null?void 0:d.options)==null?void 0:m.firstWeekContainsDate)??1,a=wt(e,t),s=k((t==null?void 0:t.in)||e,0);return s.setFullYear(a,0,r),s.setHours(0,0,0,0),R(s,t)}function bt(e,t){const n=D(e,t==null?void 0:t.in),r=+R(n,t)-+pe(n,t);return Math.round(r/mt)+1}function l(e,t){const n=e<0?"-":"",r=Math.abs(e).toString().padStart(t,"0");return n+r}const T={y(e,t){const n=e.getFullYear(),r=n>0?n:1-n;return l(t==="yy"?r%100:r,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):l(n+1,2)},d(e,t){return l(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(e,t){return l(e.getHours()%12||12,t.length)},H(e,t){return l(e.getHours(),t.length)},m(e,t){return l(e.getMinutes(),t.length)},s(e,t){return l(e.getSeconds(),t.length)},S(e,t){const n=t.length,r=e.getMilliseconds(),a=Math.trunc(r*Math.pow(10,n-3));return l(a,t.length)}},E={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},it={G:function(e,t,n){const r=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const r=e.getFullYear(),a=r>0?r:1-r;return n.ordinalNumber(a,{unit:"year"})}return T.y(e,t)},Y:function(e,t,n,r){const a=wt(e,r),s=a>0?a:1-a;if(t==="YY"){const i=s%100;return l(i,2)}return t==="Yo"?n.ordinalNumber(s,{unit:"year"}):l(s,t.length)},R:function(e,t){const n=gt(e);return l(n,t.length)},u:function(e,t){const n=e.getFullYear();return l(n,t.length)},Q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return l(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return l(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){const r=e.getMonth();switch(t){case"M":case"MM":return T.M(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){const r=e.getMonth();switch(t){case"L":return String(r+1);case"LL":return l(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){const a=bt(e,r);return t==="wo"?n.ordinalNumber(a,{unit:"week"}):l(a,t.length)},I:function(e,t,n){const r=ye(e);return t==="Io"?n.ordinalNumber(r,{unit:"week"}):l(r,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):T.d(e,t)},D:function(e,t,n){const r=ge(e);return t==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):l(r,t.length)},E:function(e,t,n){const r=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){const a=e.getDay(),s=(a-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(s);case"ee":return l(s,2);case"eo":return n.ordinalNumber(s,{unit:"day"});case"eee":return n.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(a,{width:"short",context:"formatting"});case"eeee":default:return n.day(a,{width:"wide",context:"formatting"})}},c:function(e,t,n,r){const a=e.getDay(),s=(a-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(s);case"cc":return l(s,t.length);case"co":return n.ordinalNumber(s,{unit:"day"});case"ccc":return n.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(a,{width:"narrow",context:"standalone"});case"cccccc":return n.day(a,{width:"short",context:"standalone"});case"cccc":default:return n.day(a,{width:"wide",context:"standalone"})}},i:function(e,t,n){const r=e.getDay(),a=r===0?7:r;switch(t){case"i":return String(a);case"ii":return l(a,t.length);case"io":return n.ordinalNumber(a,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){const a=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(e,t,n){const r=e.getHours();let a;switch(r===12?a=E.noon:r===0?a=E.midnight:a=r/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(e,t,n){const r=e.getHours();let a;switch(r>=17?a=E.evening:r>=12?a=E.afternoon:r>=4?a=E.morning:a=E.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let r=e.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return T.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):T.H(e,t)},K:function(e,t,n){const r=e.getHours()%12;return t==="Ko"?n.ordinalNumber(r,{unit:"hour"}):l(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t==="ko"?n.ordinalNumber(r,{unit:"hour"}):l(r,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):T.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):T.s(e,t)},S:function(e,t){return T.S(e,t)},X:function(e,t,n){const r=e.getTimezoneOffset();if(r===0)return"Z";switch(t){case"X":return ct(r);case"XXXX":case"XX":return P(r);case"XXXXX":case"XXX":default:return P(r,":")}},x:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"x":return ct(r);case"xxxx":case"xx":return P(r);case"xxxxx":case"xxx":default:return P(r,":")}},O:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+ot(r,":");case"OOOO":default:return"GMT"+P(r,":")}},z:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+ot(r,":");case"zzzz":default:return"GMT"+P(r,":")}},t:function(e,t,n){const r=Math.trunc(+e/1e3);return l(r,t.length)},T:function(e,t,n){return l(+e,t.length)}};function ot(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),a=Math.trunc(r/60),s=r%60;return s===0?n+String(a):n+String(a)+t+l(s,2)}function ct(e,t){return e%60===0?(e>0?"-":"+")+l(Math.abs(e)/60,2):P(e,t)}function P(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),a=l(Math.trunc(r/60),2),s=l(r%60,2);return n+a+t+s}const ut=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},Dt=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},we=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],a=n[2];if(!a)return ut(e,t);let s;switch(r){case"P":s=t.dateTime({width:"short"});break;case"PP":s=t.dateTime({width:"medium"});break;case"PPP":s=t.dateTime({width:"long"});break;case"PPPP":default:s=t.dateTime({width:"full"});break}return s.replace("{{date}}",ut(r,t)).replace("{{time}}",Dt(a,t))},be={p:Dt,P:we},De=/^D+$/,Se=/^Y+$/,ke=["D","DD","YY","YYYY"];function ve(e){return De.test(e)}function Me(e){return Se.test(e)}function Te(e,t,n){const r=xe(e,t,n);if(console.warn(r),ke.includes(e))throw new RangeError(r)}function xe(e,t,n){const r=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Oe=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Pe=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Ce=/^'([^]*?)'?$/,Ne=/''/g,$e=/[a-zA-Z]/;function Ee(e,t,n){var m,p,w,v;const r=B(),a=r.locale??me,s=r.firstWeekContainsDate??((p=(m=r.locale)==null?void 0:m.options)==null?void 0:p.firstWeekContainsDate)??1,i=r.weekStartsOn??((v=(w=r.locale)==null?void 0:w.options)==null?void 0:v.weekStartsOn)??0,o=D(e,n==null?void 0:n.in);if(!Et(o))throw new RangeError("Invalid time value");let c=t.match(Pe).map(b=>{const y=b[0];if(y==="p"||y==="P"){const Y=be[y];return Y(b,a.formatLong)}return b}).join("").match(Oe).map(b=>{if(b==="''")return{isToken:!1,value:"'"};const y=b[0];if(y==="'")return{isToken:!1,value:We(b)};if(it[y])return{isToken:!0,value:b};if(y.match($e))throw new RangeError("Format string contains an unescaped latin alphabet character `"+y+"`");return{isToken:!1,value:b}});a.localize.preprocessor&&(c=a.localize.preprocessor(o,c));const d={firstWeekContainsDate:s,weekStartsOn:i,locale:a};return c.map(b=>{if(!b.isToken)return b.value;const y=b.value;(Me(y)||ve(y))&&Te(y,t,String(e));const Y=it[y[0]];return Y(o,y,a.localize,d)}).join("")}function We(e){const t=e.match(Ce);return t?t[1].replace(Ne,"'"):e}function _e(e,t){const n=D(e,t==null?void 0:t.in).getDay();return n===0?7:n}function Ye(e,t,n="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:e,timeZoneName:n}).format(t).split(/\s/g).slice(2).join(" ")}const X={},H={};function C(e,t){try{const r=(X[e]||(X[e]=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"longOffset"}).format))(t).split("GMT")[1];return r in H?H[r]:lt(r,r.split(":"))}catch{if(e in H)return H[e];const n=e==null?void 0:e.match(Ie);return n?lt(e,n.slice(1)):NaN}}const Ie=/([+-]\d\d):?(\d\d)?/;function lt(e,t){const n=+(t[0]||0),r=+(t[1]||0),a=+(t[2]||0)/60;return H[e]=n*60+r>0?n*60+r+a:n*60-r-a}class S extends Date{constructor(...t){super(),t.length>1&&typeof t[t.length-1]=="string"&&(this.timeZone=t.pop()),this.internal=new Date,isNaN(C(this.timeZone,this))?this.setTime(NaN):t.length?typeof t[0]=="number"&&(t.length===1||t.length===2&&typeof t[1]!="number")?this.setTime(t[0]):typeof t[0]=="string"?this.setTime(+new Date(t[0])):t[0]instanceof Date?this.setTime(+t[0]):(this.setTime(+new Date(...t)),St(this),J(this)):this.setTime(Date.now())}static tz(t,...n){return n.length?new S(...n,t):new S(Date.now(),t)}withTimeZone(t){return new S(+this,t)}getTimezoneOffset(){const t=-C(this.timeZone,this);return t>0?Math.floor(t):Math.ceil(t)}setTime(t){return Date.prototype.setTime.apply(this,arguments),J(this),+this}[Symbol.for("constructDateFrom")](t){return new S(+new Date(t),this.timeZone)}}const ht=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!ht.test(e))return;const t=e.replace(ht,"$1UTC");S.prototype[t]&&(e.startsWith("get")?S.prototype[e]=function(){return this.internal[t]()}:(S.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),Fe(this),+this},S.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),J(this),+this}))});function J(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-C(e.timeZone,e)*60))}function Fe(e){Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),St(e)}function St(e){const t=C(e.timeZone,e),n=t>0?Math.floor(t):Math.ceil(t),r=new Date(+e);r.setUTCHours(r.getUTCHours()-1);const a=-new Date(+e).getTimezoneOffset(),s=-new Date(+r).getTimezoneOffset(),i=a-s,o=Date.prototype.getHours.apply(e)!==e.internal.getUTCHours();i&&o&&e.internal.setUTCMinutes(e.internal.getUTCMinutes()+i);const c=a-n;c&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+c);const d=new Date(+e);d.setUTCSeconds(0);const m=a>0?d.getSeconds():(d.getSeconds()-60)%60,p=Math.round(-(C(e.timeZone,e)*60))%60;(p||m)&&(e.internal.setUTCSeconds(e.internal.getUTCSeconds()+p),Date.prototype.setUTCSeconds.call(e,Date.prototype.getUTCSeconds.call(e)+p+m));const w=C(e.timeZone,e),v=w>0?Math.floor(w):Math.ceil(w),y=-new Date(+e).getTimezoneOffset()-v,Y=v!==n,et=y-c;if(Y&&et){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+et);const z=C(e.timeZone,e),xt=z>0?Math.floor(z):Math.ceil(z),j=v-xt;j&&(e.internal.setUTCMinutes(e.internal.getUTCMinutes()+j),Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+j))}}class x extends S{static tz(t,...n){return n.length?new x(...n,t):new x(Date.now(),t)}toISOString(){const[t,n,r]=this.tzComponents(),a=`${t}${n}:${r}`;return this.internal.toISOString().slice(0,-1)+a}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[t,n,r,a]=this.internal.toUTCString().split(" ");return`${t==null?void 0:t.slice(0,-1)} ${r} ${n} ${a}`}toTimeString(){const t=this.internal.toUTCString().split(" ")[4],[n,r,a]=this.tzComponents();return`${t} GMT${n}${r}${a} (${Ye(this.timeZone,this)})`}toLocaleString(t,n){return Date.prototype.toLocaleString.call(this,t,{...n,timeZone:(n==null?void 0:n.timeZone)||this.timeZone})}toLocaleDateString(t,n){return Date.prototype.toLocaleDateString.call(this,t,{...n,timeZone:(n==null?void 0:n.timeZone)||this.timeZone})}toLocaleTimeString(t,n){return Date.prototype.toLocaleTimeString.call(this,t,{...n,timeZone:(n==null?void 0:n.timeZone)||this.timeZone})}tzComponents(){const t=this.getTimezoneOffset(),n=t>0?"-":"+",r=String(Math.floor(Math.abs(t)/60)).padStart(2,"0"),a=String(Math.abs(t)%60).padStart(2,"0");return[n,r,a]}withTimeZone(t){return new x(+this,t)}[Symbol.for("constructDateFrom")](t){return new x(+new Date(t),this.timeZone)}}window.pktTz=window.pktTz===void 0?"Europe/Oslo":window.pktTz;const Ae=(e=window.pktTz)=>{const t=new x(new Date().toISOString(),e);return t.setHours(0,0,0,0),isNaN(t.getTime())?new Date:new Date(t.getFullYear(),t.getMonth(),t.getDate())};function M(e){if(!e||e==="")return new Date;if(/^\d{4}-\d{2}-\d{2}$/.test(e)){const[t,n,r]=e.split("-").map(Number);return new Date(t,n-1,r)}if(/^\d{4}-\d{2}$/.test(e)){const[t,n]=e.split("-").map(Number);return new Date(t,n-1,1)}return/^\d{4}$/.test(e)?new Date(Number(e),0,1):new Date(e)}const g=e=>{if(!e||isNaN(e.getTime()))return"";const t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return`${t}-${n}-${r}`},_=e=>{if(!e)return null;const t=M(e);return isNaN(t.getTime())?null:t},He=(e,t)=>{const n=$(e);return isNaN(n.getTime())?"":Ee(n,t)},$=(e="",t)=>{const n=typeof e=="string"?M(e):e;return!n||isNaN(n.getTime())?new Date:t?t==="end"?Wt(n):V(n):n},N=(e,t,n=1)=>{if(typeof e!="number"||typeof t!="number"||typeof n!="number"||isNaN(e)||isNaN(t)||isNaN(n))return new Date;const r=new Date(e,t,n);return isNaN(r.getTime())?new Date:r},A=e=>{let t;return typeof e=="number"?t=new x(e,window.pktTz):t=new x(e,window.pktTz),t.setHours(12,0,0,0),t};let G=null,dt;const Re=e=>{if(!e||isNaN(e.getTime()))return"";const t=typeof window<"u"?window.pktTz:void 0;return(!G||dt!==t)&&(G=new Intl.DateTimeFormat("no",{dateStyle:"full",timeZone:t}),dt=t),G.format(e)},qe=(e,t,n)=>{if(!e||isNaN(e.getTime()))return!1;const r=t?$(t):null,a=n?$(n):null;return!(r&&e<r||a&&e>a)},Le=(e,t)=>{if(!e||isNaN(e.getTime())||!Array.isArray(t))return!1;const n=g(e);return t.includes(n)},Ue=(e,t)=>{if(!e||isNaN(e.getTime())||!Array.isArray(t))return!1;const n=e.getDay().toString();return t.includes(n)},kt=(e,t,n,r,a)=>!(!e||isNaN(e.getTime())||!qe(e,t,n)||r&&Le(e,r)||a&&Ue(e,a)),Be=(e,t,n,r,a)=>e.filter(s=>{const i=_(s);return i&&kt(i,t,n,r,a)}),ze=e=>e.slice().sort((t,n)=>{const r=_(t),a=_(n);return!r||!a?0:r.getTime()-a.getTime()}),je=(e,t)=>{const n=_(e),r=_(t);return!n||!r?!1:n<=r},vt=e=>{if(!e)return[];if(Array.isArray(e))return e.filter(Boolean);if(typeof e=="string"&&e.trimStart().startsWith("["))try{const t=JSON.parse(e);if(Array.isArray(t))return t.filter(Boolean)}catch{}return String(e).split(",").map(t=>t.trim()).filter(Boolean)},Qe=e=>e.join(","),Xe=e=>vt(e),Ge=e=>e?M(e):null,Ve=e=>{if(typeof e=="string")return e.split(",").map(t=>M(t));if(Array.isArray(e))return e.map(t=>M(t))},L={csvToArray:Xe,stringToDate:Ge,stringsToDate:Ve},Je={earliest:{default:null},latest:{default:null},weeknumbers:{default:!1},withcontrols:{default:!1},multiple:{default:!1},maxMultiple:{default:4},range:{default:!1}},O={props:Je};function Mt(e,t){const n=(t.excludedates??[]).map(r=>typeof r=="string"?r:g(r));return!kt(e,t.earliest,t.latest,n,t.excludeweekdays??[])}function Ke(e,t,n,r){return!!(Mt(e,n)||!t&&r.multiple&&r.maxMultiple>0&&r.selectedCount>=r.maxMultiple)}function Ze(e,t,n){const r=N(e,t,0);return!(n&&$(n)>r)}function tn(e,t,n){const r=N(t===11?e+1:e,t===11?0:t+1,1);return!(n&&$(n)<r)}const q=7,en=6;function nn(e,t){const n=N(e,t,1),r=N(e,t+1,0),a=(n.getDay()+en)%q,s=r.getDate(),i=Math.ceil((s+a)/q),c=N(e,t,0).getDate(),d=bt(n);return{firstDayOfMonth:n,lastDayOfMonth:r,startingDay:a,numDays:s,numRows:i,numDaysPrevMonth:c,initialWeek:d}}function rn(e,t,n,r){const{startingDay:a,numDays:s}=r;return e===0&&t<a?"prev-month":n>s?"next-month":"current-month"}function an(e,t,n,r){const{startingDay:a,numDaysPrevMonth:s,numDays:i}=r;return e==="prev-month"?s-(a-t-1):e==="next-month"?n-i:n}function W(e){return typeof e=="string"&&(e=e.split(",")),e.length===1&&e[0]===""?[]:e.map(t=>M(t))}function ft(e,t){const n=pt({start:e,end:t}),r={};if(Array.isArray(n)&&n.length)for(let a=0;a<n.length;a++){const s=n[a],i=s>e&&s<t;r[g(s)]=i}return r}function Tt(e,t,n,r){if(t.length!==1)return!0;const a=pt({start:t[0],end:e});if(!Array.isArray(a)||!a.length)return!0;for(let s=0;s<a.length;s++){for(const i of n??[])if(i>t[0]&&i<e)return!1;if((r??[]).includes(_e(a[s]).toString()))return!1}return!0}function Z(e,t){const n=g(e);return t.includes(n)?t:[...t,n]}function tt(e,t){const n=g(e),r=t.indexOf(n);if(r===-1)return t;if(t.length===1)return[];const a=[...t];return a.splice(r,1),a}function sn(e,t,n){const r=g(e);return t.includes(r)?tt(e,t):n>0&&t.length>=n?t:Z(e,t)}function on(e,t,n){const r=g(e),a=W(t);if(t.includes(r))return t.indexOf(r)===0?[]:tt(e,t);if(t.length>1)return[r];if(t.length===1){if(!Tt(e,a,n.excludedates,n.excludeweekdays))return[r];if(a[0]>e)return[r]}return Z(e,t)}const cn={ArrowLeft:-1,ArrowRight:1,ArrowUp:-q,ArrowDown:q};function un(e){var n;const t=e.nodeName;return t==="INPUT"||t==="SELECT"||t==="BUTTON"&&!((n=e.dataset)!=null&&n.date)}function ln(e,t,n){let r=at(e,t);if(!r)return null;let a=n(`button[data-date="${g(r)}"]`);for(;a instanceof HTMLButtonElement&&a.dataset.disabled;)if(r=at(r,t),a=n(`button[data-date="${g(r)}"]`),!a)return null;return r}function hn(e){return cn[e]??null}var dn=Object.defineProperty,f=(e,t,n,r)=>{for(var a=void 0,s=e.length-1,i;s>=0;s--)(i=e[s])&&(a=i(t,n,a)||a);return a&&dn(t,n,a),a};class h extends u.PktElement{constructor(){super(...arguments),this.selected=[],this.multiple=O.props.multiple.default,this.maxMultiple=O.props.maxMultiple.default,this.range=O.props.range.default,this.earliest=O.props.earliest.default,this.latest=O.props.latest.default,this.excludedates=[],this.excludeweekdays=[],this.weeknumbers=O.props.weeknumbers.default,this.withcontrols=O.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}get todayDate(){return this.today?M(this.today):Ae()}firstUpdated(t){this.addEventListener("keydown",this.handleKeydown)}disconnectedCallback(){this.removeEventListener("keydown",this.handleKeydown),super.disconnectedCallback()}updated(t){super.updated(t),t.has("selected")&&this.convertSelected()}convertSelected(){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=ft(this._selected[0],this._selected[1])),this.setCurrentMonth()}setCurrentMonth(){if(this.currentmonth===null&&!this.currentmonthtouched&&(this.currentmonthtouched=!0),this.selected.length&&this.selected[0]!==""){const t=M(this.selected[this.selected.length-1]);this.currentmonth=isNaN(t.getTime())?A(this.todayDate):t}else this.currentmonth===null&&(this.currentmonth=A(this.todayDate));(!this.currentmonth||isNaN(this.currentmonth.getTime()))&&(this.currentmonth=A(this.todayDate)),this.year=this.currentmonth.getFullYear(),this.month=this.currentmonth.getMonth()}handleKeydown(t){const n=hn(t.key);n!==null&&this.handleArrowKey(t,n)}handleArrowKey(t,n){const r=t.target;if(un(r))return;if(t.preventDefault(),!this.focusedDate){this.focusOnCurrentDate();return}const a=this.focusedDate?$(this.focusedDate):N(this.year,this.month,1),s=ln(a,n,this.querySelector.bind(this));if(s){const i=this.querySelector(`button[data-date="${g(s)}"]`);i instanceof HTMLButtonElement&&!i.dataset.disabled&&(this.focusedDate=g(s),i.focus())}}render(){return u.b`
|
|
2
|
-
<div
|
|
3
|
-
class="pkt-calendar ${this.weeknumbers?"pkt-cal-weeknumbers":""}"
|
|
4
|
-
@focusout=${this.closeEvent}
|
|
5
|
-
@keydown=${t=>{t.key==="Escape"&&(t.preventDefault(),this.close())}}
|
|
6
|
-
>
|
|
7
|
-
<nav class="pkt-cal-month-nav">
|
|
8
|
-
${this.renderMonthNavButton("prev")}
|
|
9
|
-
${this.renderMonthNav()}
|
|
10
|
-
${this.renderMonthNavButton("next")}
|
|
11
|
-
</nav>
|
|
12
|
-
<table
|
|
13
|
-
class="pkt-cal-days pkt-txt-12-medium pkt-calendar__body"
|
|
14
|
-
role="grid"
|
|
15
|
-
?aria-multiselectable=${this.range||this.multiple}
|
|
16
|
-
>
|
|
17
|
-
<thead>
|
|
18
|
-
${this.renderDayNames()}
|
|
19
|
-
</thead>
|
|
20
|
-
<tbody>
|
|
21
|
-
${this.renderCalendarBody()}
|
|
22
|
-
</tbody>
|
|
23
|
-
</table>
|
|
24
|
-
</div>
|
|
25
|
-
`}renderMonthNavButton(t){const n=t==="prev",r=n?this.isPrevMonthAllowed():this.isNextMonthAllowed(),a=n?this.prevMonthString:this.nextMonthString,s=n?"chevron-thin-left":"chevron-thin-right",i=n?"pkt-calendar__prev-month":"pkt-calendar__next-month",o=n?()=>this.prevMonth():()=>this.nextMonth();return u.b`<div>
|
|
26
|
-
<button
|
|
27
|
-
type="button"
|
|
28
|
-
aria-label="${a}"
|
|
29
|
-
@click=${()=>r&&o()}
|
|
30
|
-
@keydown=${c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),r&&o())}}
|
|
31
|
-
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only ${i} ${r?"":"pkt-invisible"}"
|
|
32
|
-
.data-disabled=${r?u.A:"disabled"}
|
|
33
|
-
?aria-disabled=${!r}
|
|
34
|
-
tabindex=${r?"0":"-1"}
|
|
35
|
-
>
|
|
36
|
-
<pkt-icon class="pkt-btn__icon" name="${s}"></pkt-icon>
|
|
37
|
-
<span class="pkt-btn__text">${a}</span>
|
|
38
|
-
</button>
|
|
39
|
-
</div>`}renderDayNames(){const t=[];this.weeknumbers&&t.push(u.b`<th><div class="pkt-calendar__week-number">${this.weekString}</div></th>`);for(let n=0;n<this.dayStrings.length;n++)t.push(u.b`<th>
|
|
40
|
-
<div class="pkt-calendar__day-name" aria-label="${this.dayStringsLong[n]}">
|
|
41
|
-
${this.dayStrings[n]}
|
|
42
|
-
</div>
|
|
43
|
-
</th>`);return u.b`<tr class="pkt-cal-week-row">${t}</tr>`}renderMonthNav(){return this.withcontrols?u.b`<div class="pkt-cal-month-picker">
|
|
44
|
-
<label for="${this.id}-monthnav" class="pkt-hide">${this.strings.dates.month}</label>
|
|
45
|
-
<select
|
|
46
|
-
aria-label="${this.strings.dates.month}"
|
|
47
|
-
class="pkt-input pkt-input-compact"
|
|
48
|
-
id="${this.id}-monthnav"
|
|
49
|
-
@change=${t=>{t.stopImmediatePropagation();const n=t.target;this.changeMonth(this.year,parseInt(n.value))}}
|
|
50
|
-
>
|
|
51
|
-
${this.monthStrings.map((t,n)=>u.b`<option value=${n} ?selected=${this.month===n}>${t}</option>`)}
|
|
52
|
-
</select>
|
|
53
|
-
<label for="${this.id}-yearnav" class="pkt-hide">${this.strings.dates.year}</label>
|
|
54
|
-
<input
|
|
55
|
-
aria-label="${this.strings.dates.year}"
|
|
56
|
-
class="pkt-input pkt-cal-input-year pkt-input-compact"
|
|
57
|
-
id="${this.id}-yearnav"
|
|
58
|
-
type="number"
|
|
59
|
-
size="4"
|
|
60
|
-
placeholder="0000"
|
|
61
|
-
@change=${t=>{t.stopImmediatePropagation();const n=t.target;this.changeMonth(parseInt(n.value),this.month)}}
|
|
62
|
-
.value=${this.year}
|
|
63
|
-
/>
|
|
64
|
-
</div>`:u.b`<div class="pkt-txt-16-medium pkt-calendar__month-title" aria-live="polite">
|
|
65
|
-
${this.monthStrings[this.month]} ${this.year}
|
|
66
|
-
</div>`}getDayViewData(t,n){const r=N(this.year,this.month,t),a=g(r),s=a===g(n),i=this.selected.includes(a),o=this.isDayDisabled(r,i),c=this.calculateTabIndex(a,o,t);return{currentDate:r,currentDateISO:a,isToday:s,isSelected:i,isDisabled:o,ariaLabel:Re(r),tabindex:c}}getDateConstraints(){return{earliest:this.earliest,latest:this.latest,excludedates:this.excludedates,excludeweekdays:this.excludeweekdays}}isDayDisabled(t,n){return Ke(t,n,this.getDateConstraints(),{multiple:this.multiple,maxMultiple:this.maxMultiple,selectedCount:this.selected.length})}calculateTabIndex(t,n,r){return this.focusedDate?this.focusedDate===t&&!n?"0":"-1":!n&&this.tabIndexSet===0?(this.tabIndexSet=r,"0"):this.tabIndexSet===r?"0":"-1"}getDayCellClasses(t){const{currentDateISO:n,isToday:r,isSelected:a}=t,s=this.range&&(this.selected.length===2||this.rangeHovered!==null)&&n===this.selected[0],i=this.range&&this.selected.length===2&&n===this.selected[1];return{"pkt-cal-today":r,"pkt-cal-selected":a,"pkt-cal-in-range":this.inRange[n],"pkt-cal-excluded":this.isExcluded(t.currentDate),"pkt-cal-in-range-first":s,"pkt-cal-in-range-last":i,"pkt-cal-range-hover":this.rangeHovered!==null&&n===g(this.rangeHovered)}}getDayButtonClasses(t){const{currentDateISO:n,isToday:r,isSelected:a,isDisabled:s}=t,i=this.range&&(this.selected.length===2||this.rangeHovered!==null)&&n===this.selected[0],o=this.range&&this.selected.length===2&&n===this.selected[1];return{"pkt-calendar__date":!0,"pkt-calendar__date--today":r,"pkt-calendar__date--selected":a,"pkt-calendar__date--disabled":s,"pkt-calendar__date--in-range":this.inRange[n],"pkt-calendar__date--in-range-hover":this.rangeHovered!==null&&n===g(this.rangeHovered),"pkt-calendar__date--range-start":i,"pkt-calendar__date--range-end":o}}handleDayFocus(t,n){this.range&&!this.isExcluded(t)&&this.handleRangeHover(t),this.focusedDate=n}renderDayView(t,n){const r=this.getDayViewData(t,n),{currentDate:a,currentDateISO:s,isSelected:i,isDisabled:o,ariaLabel:c,tabindex:d}=r;this.selectableDates.push({currentDateISO:s,isDisabled:o,tabindex:d});const m=this.getDayCellClasses(r),p=this.getDayButtonClasses(r);return u.b`<td class=${nt.e(m)}>
|
|
67
|
-
<button
|
|
68
|
-
type="button"
|
|
69
|
-
aria-pressed=${i?"true":"false"}
|
|
70
|
-
?disabled=${o}
|
|
71
|
-
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only ${nt.e(p)}"
|
|
72
|
-
@mouseover=${()=>this.range&&!this.isExcluded(a)&&this.handleRangeHover(a)}
|
|
73
|
-
@focus=${()=>this.handleDayFocus(a,s)}
|
|
74
|
-
aria-label="${c}"
|
|
75
|
-
tabindex=${d}
|
|
76
|
-
data-disabled=${o?"disabled":u.A}
|
|
77
|
-
data-date=${s}
|
|
78
|
-
@keydown=${w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),this.handleDateSelect(a))}}
|
|
79
|
-
@click=${w=>{o||(w.preventDefault(),this.handleDateSelect(a))}}
|
|
80
|
-
>
|
|
81
|
-
<span class="pkt-btn__text pkt-txt-14-light">${t}</span>
|
|
82
|
-
</button>
|
|
83
|
-
</td>`}renderEmptyDayCell(t){return u.b`<td class="pkt-cal-other">
|
|
84
|
-
<div
|
|
85
|
-
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only"
|
|
86
|
-
data-disabled="disabled"
|
|
87
|
-
>
|
|
88
|
-
<span class="pkt-btn__text pkt-txt-14-light">${t}</span>
|
|
89
|
-
</div>
|
|
90
|
-
</td>`}renderWeekRow(t){return u.b`<tr class="pkt-cal-week-row" role="row">${t}</tr>`}renderCalendarBody(){const t=this.todayDate,n=nn(this.year,this.month);this.selectableDates=[],this.tabIndexSet=0;let r=1;this.week=n.initialWeek;const a=[];for(let s=0;s<n.numRows;s++){const i=[];this.weeknumbers&&i.push(u.b`<td class="pkt-cal-week">${this.week}</td>`),this.week++;for(let o=0;o<q;o++){const c=rn(s,o,r,n);if(c==="current-month")i.push(this.renderDayView(r,t)),r++;else{const d=an(c,o,r,n);i.push(this.renderEmptyDayCell(d)),c==="next-month"&&r++}}a.push(this.renderWeekRow(i))}return a}isExcluded(t){return Mt(t,this.getDateConstraints())}isPrevMonthAllowed(){return Ze(this.year,this.month,this.earliest)}prevMonth(){const t=this.month===0?11:this.month-1,n=this.month===0?this.year-1:this.year;this.changeMonth(n,t)}isNextMonthAllowed(){return tn(this.year,this.month,this.latest)}nextMonth(){const t=this.month===11?0:this.month+1,n=this.month===11?this.year+1:this.year;this.changeMonth(n,t)}changeMonth(t,n){this.year=typeof t=="string"?parseInt(t):t,this.month=typeof n=="string"?parseInt(n):n,this.currentmonth=A(new Date(this.year,this.month,1)),this.tabIndexSet=0,this.focusedDate=null,this.selectableDates=[]}emptySelected(){this.selected=[],this._selected=[],this.inRange={}}normalizeSelected(){return typeof this.selected=="string"?this.selected.split(","):this.selected}addToSelected(t){this.selected=Z(t,this.normalizeSelected()),this._selected=W(this.selected),this.range&&this.selected.length===2&&(this.convertSelected(),this.close())}removeFromSelected(t){this.selected=tt(t,this.normalizeSelected()),this._selected=W(this.selected)}toggleSelected(t){this.selected=sn(t,this.normalizeSelected(),this.maxMultiple),this._selected=W(this.selected)}isRangeAllowed(t){return Tt(t,this._selected,this.excludedates,this.excludeweekdays)}handleRangeSelect(t){return this.selected=on(t,this.normalizeSelected(),{excludedates:this.excludedates,excludeweekdays:this.excludeweekdays}),this._selected=W(this.selected),this.selected.length===2?(this.convertSelected(),this.close()):this.selected.length===1&&(this.inRange={}),Promise.resolve()}handleRangeHover(t){if(!this.range||this._selected.length!==1||!this.isRangeAllowed(t)||this._selected[0]>=t){this.rangeHovered=null;return}this.rangeHovered=t,this.inRange=ft(this._selected[0],t)}handleDateSelect(t){return t&&(this.range?this.handleRangeSelect(t):this.multiple?this.toggleSelected(t):(this.selected.includes(g(t))?this.emptySelected():(this.emptySelected(),this.addToSelected(t)),this.close()),this.dispatchEvent(new CustomEvent("date-selected",{detail:this.selected,bubbles:!0,composed:!0}))),Promise.resolve()}focusOnCurrentDate(){const t=g(A(this.todayDate)),n=this.querySelector(`button[data-date="${t}"]`);if(n instanceof HTMLButtonElement){this.focusedDate=t,n.focus();return}const r=this.selectableDates.find(a=>!a.isDisabled);if(r){const a=this.querySelector(`button[data-date="${r.currentDateISO}"]`);a instanceof HTMLButtonElement&&(this.focusedDate=r.currentDateISO,a.focus())}}closeEvent(t){!this.contains(t.relatedTarget)&&!t.target.classList.contains("pkt-invisible")&&this.close()}close(){this.dispatchEvent(new CustomEvent("close",{detail:!0,bubbles:!0,composed:!0}))}}f([u.n({converter:L.csvToArray})],h.prototype,"selected");f([u.n({type:Boolean})],h.prototype,"multiple");f([u.n({type:Number,attribute:"max-multiple"})],h.prototype,"maxMultiple");f([u.n({type:Boolean})],h.prototype,"range");f([u.n({type:String})],h.prototype,"earliest");f([u.n({type:String})],h.prototype,"latest");f([u.n({converter:L.stringsToDate})],h.prototype,"excludedates");f([u.n({converter:L.csvToArray})],h.prototype,"excludeweekdays");f([u.n({type:Boolean})],h.prototype,"weeknumbers");f([u.n({type:Boolean})],h.prototype,"withcontrols");f([u.n({converter:L.stringToDate})],h.prototype,"currentmonth");f([u.n({type:String})],h.prototype,"today");f([u.n({type:Array,attribute:"day-strings"})],h.prototype,"dayStrings");f([u.n({type:Array,attribute:"day-strings-long"})],h.prototype,"dayStringsLong");f([u.n({type:Array,attribute:"month-strings"})],h.prototype,"monthStrings");f([u.n({type:String,attribute:"week-string"})],h.prototype,"weekString");f([u.n({type:String,attribute:"prev-month-string"})],h.prototype,"prevMonthString");f([u.n({type:String,attribute:"next-month-string"})],h.prototype,"nextMonthString");f([u.n({type:Array})],h.prototype,"_selected");f([K.r()],h.prototype,"inRange");f([u.n({type:Date})],h.prototype,"rangeHovered");f([u.n({type:Number})],h.prototype,"year");f([u.n({type:Number})],h.prototype,"month");f([u.n({type:Number})],h.prototype,"week");f([K.r()],h.prototype,"currentmonthtouched");f([K.r()],h.prototype,"focusedDate");try{u.t("pkt-calendar")(h)}catch{console.warn("Forsøker å definere <pkt-calendar>, men den er allerede definert")}exports.PktCalendar=h;exports.arrayToCsv=Qe;exports.converters=L;exports.filterSelectableDates=Be;exports.formatISODate=g;exports.fromISOToDate=_;exports.fromISOtoLocal=He;exports.isValidDateRange=je;exports.newDate=$;exports.parseISODateString=M;exports.sortDateStrings=ze;exports.valueToArray=vt;
|