@oslokommune/punkt-elements 16.7.1 → 16.7.3
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 +17 -0
- package/dist/accordionitem-_9AiCIvd.cjs +34 -0
- package/dist/{accordionitem-ZlaXvjt5.js → accordionitem-dCfSrxh5.js} +57 -55
- package/dist/alert-BtOk8yRH.cjs +33 -0
- package/dist/{alert-BuAXrnKl.js → alert-DlY2_grU.js} +48 -46
- package/dist/backlink-Ce5Vldop.js +49 -0
- package/dist/backlink-y3dwjKPC.cjs +13 -0
- package/dist/button-B_TXwNzt.cjs +27 -0
- package/dist/{button-DEyvt1LI.js → button-BiY-wlKF.js} +79 -77
- package/dist/calendar-B2pji2zn.cjs +90 -0
- package/dist/{calendar-S63oreVW.js → calendar-DhjQDC4C.js} +689 -687
- package/dist/card-BwMNB5Bb.cjs +87 -0
- package/dist/{card-DDiLfuO4.js → card-CGlmcMSR.js} +99 -97
- package/dist/checkbox-BsJZYA26.js +147 -0
- package/dist/checkbox-CTY8f_qn.cjs +31 -0
- package/dist/{combobox-BmxSecfE.js → combobox-DSB5WOxg.js} +223 -226
- package/dist/{combobox-Hb2V-fPX.cjs → combobox-DbICIgKG.cjs} +4 -4
- package/dist/consent-DkOQpbsg.cjs +11 -0
- package/dist/{consent-iXyx5v6J.js → consent-SNWV_mMU.js} +48 -46
- package/dist/datepicker-BEWl9iz3.cjs +273 -0
- package/dist/{datepicker-CZl7b8Na.js → datepicker-euHyzXnb.js} +341 -329
- package/dist/{heading-CKt7cVn7.js → heading-D2tVS6lS.js} +30 -28
- package/dist/heading-DrzbgDb6.cjs +1 -0
- package/dist/helptext-BKtU4mas.js +82 -0
- package/dist/helptext-DcRC7wW2.cjs +24 -0
- package/dist/icon-CxQcIa5F.js +105 -0
- package/dist/icon-q81vqPK_.cjs +9 -0
- package/dist/input-wrapper-Bs4CRNst.js +181 -0
- package/dist/input-wrapper-Bv9aqqVq.cjs +54 -0
- package/dist/link-C0rl-86s.cjs +7 -0
- package/dist/link-Cdqgl60z.js +55 -0
- package/dist/linkcard-Dimu7Rlx.cjs +13 -0
- package/dist/linkcard-Lbq_UhjZ.js +56 -0
- package/dist/{listbox-BQKDZvZn.js → listbox-Bia4_tvN.js} +131 -129
- package/dist/listbox-La2GZQei.cjs +106 -0
- package/dist/loader-D1ugDXGV.cjs +16 -0
- package/dist/{loader-Ci3CHU8k.js → loader-DyN6RGC5.js} +51 -49
- package/dist/messagebox-BGMVm2t9.js +71 -0
- package/dist/messagebox-M0yIgCz9.cjs +13 -0
- package/dist/modal-CMO1RtIi.cjs +36 -0
- package/dist/{modal-DzGe1g8Z.js → modal-DjPQDE-Z.js} +53 -51
- package/dist/pkt-accordion.cjs +1 -1
- package/dist/pkt-accordion.js +2 -2
- package/dist/pkt-alert.cjs +1 -1
- package/dist/pkt-alert.js +3 -4
- package/dist/pkt-backlink.cjs +1 -1
- package/dist/pkt-backlink.js +2 -3
- package/dist/pkt-breadcrumbs.cjs +11 -11
- package/dist/pkt-breadcrumbs.js +30 -28
- package/dist/pkt-button.cjs +1 -1
- package/dist/pkt-button.js +3 -4
- package/dist/pkt-calendar.cjs +1 -1
- package/dist/pkt-calendar.js +2 -3
- package/dist/pkt-card.cjs +1 -1
- package/dist/pkt-card.js +2 -3
- package/dist/pkt-checkbox.cjs +1 -1
- package/dist/pkt-checkbox.js +3 -4
- package/dist/pkt-combobox.cjs +1 -1
- package/dist/pkt-combobox.js +3 -4
- package/dist/pkt-consent.cjs +1 -1
- package/dist/pkt-consent.js +2 -3
- package/dist/pkt-datepicker.cjs +1 -1
- package/dist/pkt-datepicker.js +7 -8
- package/dist/pkt-header.cjs +35 -35
- package/dist/pkt-header.js +224 -218
- package/dist/pkt-heading.cjs +1 -1
- package/dist/pkt-heading.js +3 -4
- package/dist/pkt-helptext.cjs +1 -1
- package/dist/pkt-helptext.js +3 -4
- package/dist/pkt-icon.cjs +1 -1
- package/dist/pkt-icon.js +3 -4
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +26 -26
- package/dist/pkt-input-wrapper.cjs +1 -1
- package/dist/pkt-input-wrapper.js +2 -3
- package/dist/pkt-link.cjs +1 -1
- package/dist/pkt-link.js +2 -3
- package/dist/pkt-linkcard.cjs +1 -1
- package/dist/pkt-linkcard.js +3 -4
- package/dist/pkt-listbox.cjs +1 -1
- package/dist/pkt-listbox.js +3 -4
- package/dist/pkt-loader.cjs +1 -1
- package/dist/pkt-loader.js +3 -4
- package/dist/pkt-messagebox.cjs +1 -1
- package/dist/pkt-messagebox.js +3 -4
- package/dist/pkt-modal.cjs +1 -1
- package/dist/pkt-modal.js +3 -4
- package/dist/pkt-progressbar.cjs +1 -1
- package/dist/pkt-progressbar.js +2 -3
- package/dist/pkt-radiobutton.cjs +1 -1
- package/dist/pkt-radiobutton.js +3 -4
- package/dist/pkt-select.cjs +1 -1
- package/dist/pkt-select.js +3 -4
- package/dist/pkt-tabs.cjs +1 -1
- package/dist/pkt-tabs.js +2 -2
- package/dist/pkt-tag.cjs +1 -1
- package/dist/pkt-tag.js +3 -4
- package/dist/pkt-textarea.cjs +1 -1
- package/dist/pkt-textarea.js +3 -4
- package/dist/pkt-textinput.cjs +1 -1
- package/dist/pkt-textinput.js +3 -4
- package/dist/pkt-timepicker.cjs +16 -16
- package/dist/pkt-timepicker.js +91 -89
- package/dist/progressbar-BqlMzkM_.cjs +21 -0
- package/dist/{progressbar-By7e0lEI.js → progressbar-sbHDFC12.js} +88 -88
- package/dist/radiobutton-5ZqVVtTT.cjs +31 -0
- package/dist/{radiobutton-6frNG9J_.js → radiobutton-D8Ai8ETa.js} +44 -42
- package/dist/select-De-n8on9.js +230 -0
- package/dist/select-dTWibR6_.cjs +49 -0
- package/dist/tabitem-B9-jeV97.js +334 -0
- package/dist/tabitem-BnhzqfW3.cjs +65 -0
- package/dist/tag-CbwO8yvD.cjs +27 -0
- package/dist/{tag-BuCpqaks.js → tag-D4FI5t3y.js} +42 -40
- package/dist/textarea-BmLaKzsc.cjs +50 -0
- package/dist/{textarea-Bzuymclz.js → textarea-CMiSJaYL.js} +62 -60
- package/dist/textinput-em9y4yrL.cjs +70 -0
- package/dist/{textinput-9lHjs4ce.js → textinput-r8udK0IX.js} +57 -55
- package/package.json +2 -2
- package/src/components/accordion/accordion.ts +6 -1
- package/src/components/accordion/accordionitem.ts +6 -1
- package/src/components/alert/alert.ts +6 -1
- 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.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/alert-DFkFNTxh.cjs +0 -33
- package/dist/backlink-EiAXUUZP.cjs +0 -13
- package/dist/backlink-V4DAt17e.js +0 -47
- package/dist/button-DYv5Dg4M.cjs +0 -27
- package/dist/calendar-HIE9nxcc.cjs +0 -90
- package/dist/card-CyeH6l1c.cjs +0 -87
- package/dist/checkbox-BLlwTABj.cjs +0 -31
- package/dist/checkbox-ejBUa5qQ.js +0 -145
- package/dist/consent-ruWAEVXW.cjs +0 -11
- package/dist/datepicker-D2H7U6MS.cjs +0 -273
- 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/input-wrapper-B0MkQ0IZ.cjs +0 -54
- package/dist/input-wrapper-B2JpK016.js +0 -179
- 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-CGgV9MAe.cjs +0 -106
- 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/progressbar-DsJ2B9Vm.cjs +0 -21
- package/dist/radiobutton-Bv-BZ1Hw.cjs +0 -31
- package/dist/select-CXZt1nHS.js +0 -228
- package/dist/select-WFhS4Vfp.cjs +0 -49
- package/dist/tabitem-CB8wkKmv.js +0 -332
- package/dist/tabitem-DZpspU4Q.cjs +0 -65
- package/dist/tag-X6xdjR0N.cjs +0 -27
- package/dist/textarea-DoeHJ7HR.cjs +0 -50
- package/dist/textinput-BNsLd26i.cjs +0 -70
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { P as
|
|
2
|
-
import {
|
|
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
3
|
import { e as y } from "./class-map-CEnykyO_.js";
|
|
4
|
-
import { o as
|
|
5
|
-
import "./icon-
|
|
6
|
-
var m = Object.defineProperty,
|
|
7
|
-
for (var
|
|
8
|
-
(
|
|
9
|
-
return
|
|
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
10
|
};
|
|
11
11
|
window.pktAnimationPath = window.pktAnimationPath || "https://punkt-cdn.oslo.kommune.no/latest/animations/";
|
|
12
|
-
|
|
12
|
+
class i extends b {
|
|
13
13
|
constructor() {
|
|
14
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
15
|
}
|
|
@@ -29,15 +29,15 @@ let i = class extends c {
|
|
|
29
29
|
!0
|
|
30
30
|
);
|
|
31
31
|
}
|
|
32
|
-
attributeChangedCallback(t,
|
|
33
|
-
super.attributeChangedCallback(t,
|
|
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
34
|
}
|
|
35
35
|
firstUpdated(t) {
|
|
36
36
|
super.firstUpdated(t), this.disabled === "false" && (this.disabled = !1), this.isLoading === "false" && (this.isLoading = !1);
|
|
37
37
|
}
|
|
38
38
|
// Render
|
|
39
39
|
render() {
|
|
40
|
-
const t = this.form ?? this.getAttribute("form") ?? void 0,
|
|
40
|
+
const t = this.form ?? this.getAttribute("form") ?? void 0, n = {
|
|
41
41
|
"pkt-btn": !0,
|
|
42
42
|
[`pkt-btn--${this.size}`]: !!this.size,
|
|
43
43
|
[`pkt-btn--${this.skin}`]: !!this.skin,
|
|
@@ -51,87 +51,89 @@ let i = class extends c {
|
|
|
51
51
|
};
|
|
52
52
|
return l`
|
|
53
53
|
<button
|
|
54
|
-
class=${y(
|
|
54
|
+
class=${y(n)}
|
|
55
55
|
type=${this.type}
|
|
56
56
|
?disabled=${!!this.disabled}
|
|
57
|
-
aria-busy=${
|
|
58
|
-
aria-disabled=${
|
|
59
|
-
form=${
|
|
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
60
|
>
|
|
61
61
|
${this.isLoading ? l`<pkt-icon
|
|
62
62
|
class="pkt-btn__icon pkt-btn__spinner"
|
|
63
63
|
name="spinner-blue"
|
|
64
|
-
path=${
|
|
65
|
-
></pkt-icon>` :
|
|
64
|
+
path=${a(this.loadingAnimationPath)}
|
|
65
|
+
></pkt-icon>` : h}
|
|
66
66
|
${this.variant !== "label-only" ? l`<pkt-icon
|
|
67
67
|
class="pkt-btn__icon pkt-icon"
|
|
68
68
|
name=${this.iconName}
|
|
69
|
-
path=${
|
|
70
|
-
></pkt-icon>` :
|
|
69
|
+
path=${a(this.iconPath)}
|
|
70
|
+
></pkt-icon>` : h}
|
|
71
71
|
<span class="pkt-btn__text">${f(this)}</span>
|
|
72
72
|
${this.variant === "icons-right-and-left" ? l`<pkt-icon
|
|
73
73
|
class="pkt-btn__icon"
|
|
74
74
|
name=${this.secondIconName}
|
|
75
|
-
path=${
|
|
76
|
-
></pkt-icon>` :
|
|
75
|
+
path=${a(this.secondIconPath)}
|
|
76
|
+
></pkt-icon>` : h}
|
|
77
77
|
</button>
|
|
78
78
|
`;
|
|
79
79
|
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
], i.prototype, "iconName"
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
], i.prototype, "secondIconName"
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
], i.prototype, "iconPath"
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
], i.prototype, "secondIconPath"
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
], i.prototype, "mode"
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
], i.prototype, "size"
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
], i.prototype, "fullWidth"
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
], i.prototype, "fullWidthOnMobile"
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
], i.prototype, "color"
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
], i.prototype, "skin"
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
], i.prototype, "variant"
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
], i.prototype, "state"
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
], i.prototype, "type"
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
], i.prototype, "form"
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
], i.prototype, "isLoading"
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
], i.prototype, "disabled"
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
], i.prototype, "loadingAnimationPath"
|
|
132
|
-
|
|
133
|
-
u("pkt-button")
|
|
134
|
-
|
|
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
|
+
}
|
|
135
137
|
export {
|
|
136
138
|
i as P
|
|
137
139
|
};
|
|
@@ -0,0 +1,90 @@
|
|
|
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;
|