cally 0.9.2 → 0.10.0

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.
Files changed (3) hide show
  1. package/dist/cally.d.ts +504 -9
  2. package/dist/cally.js +613 -553
  3. package/package.json +5 -2
package/dist/cally.js CHANGED
@@ -1,4 +1,4 @@
1
- class le {
1
+ class me {
2
2
  /**
3
3
  * @type {T}
4
4
  */
@@ -29,66 +29,66 @@ class le {
29
29
  return this.#e.add(t), () => this.#e.delete(t);
30
30
  }
31
31
  }
32
- const Rt = (e) => new le(e), st = Symbol.for("atomico.hooks");
33
- globalThis[st] = globalThis[st] || {};
34
- let A = globalThis[st];
35
- const ue = Symbol.for("Atomico.suspense"), Yt = Symbol.for("Atomico.effect"), fe = Symbol.for("Atomico.layoutEffect"), Ft = Symbol.for("Atomico.insertionEffect"), R = (e, t, n) => {
36
- const { i: s, hooks: o } = A.c, r = o[s] = o[s] || {};
37
- return r.value = e(r.value), r.effect = t, r.tag = n, A.c.i++, o[s].value;
38
- }, It = (e) => R((t = Rt(e)) => t), W = () => R((e = Rt(A.c.host)) => e), Lt = () => A.c.update, de = (e, t, n = 0) => {
39
- let s = {}, o = !1;
40
- const r = () => o, a = (l, c) => {
41
- for (const d in s) {
42
- const i = s[d];
43
- i.effect && i.tag === l && (i.value = i.effect(i.value, c));
32
+ const Bt = (e) => new me(e), at = Symbol.for("atomico.hooks");
33
+ globalThis[at] = globalThis[at] || {};
34
+ let A = globalThis[at];
35
+ const ye = Symbol.for("Atomico.suspense"), Wt = Symbol.for("Atomico.effect"), pe = Symbol.for("Atomico.layoutEffect"), qt = Symbol.for("Atomico.insertionEffect"), $ = (e, t, n) => {
36
+ const { i: s, hooks: r } = A.c, o = r[s] = r[s] || {};
37
+ return o.value = e(o.value), o.effect = t, o.tag = n, A.c.i++, r[s].value;
38
+ }, zt = (e) => $((t = Bt(e)) => t), H = () => $((e = Bt(A.c.host)) => e), Ht = () => A.c.update, ge = (e, t, n = 0) => {
39
+ let s = {}, r = !1;
40
+ const o = () => r, a = (d, i) => {
41
+ for (const m in s) {
42
+ const c = s[m];
43
+ c.effect && c.tag === d && (c.value = c.effect(c.value, i));
44
44
  }
45
45
  };
46
- return { load: (l) => {
46
+ return { load: (d) => {
47
47
  A.c = { host: t, hooks: s, update: e, i: 0, id: n };
48
- let c;
48
+ let i;
49
49
  try {
50
- o = !1, c = l();
51
- } catch (d) {
52
- if (d !== ue) throw d;
53
- o = !0;
50
+ r = !1, i = d();
51
+ } catch (m) {
52
+ if (m !== ye) throw m;
53
+ r = !0;
54
54
  } finally {
55
55
  A.c = null;
56
56
  }
57
- return c;
58
- }, cleanEffects: (l) => (a(Ft, l), () => (a(fe, l), () => {
59
- a(Yt, l);
60
- })), isSuspense: r };
61
- }, x = Symbol.for;
62
- function xt(e, t) {
57
+ return i;
58
+ }, cleanEffects: (d) => (a(qt, d), () => (a(pe, d), () => {
59
+ a(Wt, d);
60
+ })), isSuspense: o };
61
+ }, L = Symbol.for;
62
+ function Kt(e, t) {
63
63
  const n = e.length;
64
64
  if (n !== t.length) return !1;
65
65
  for (let s = 0; s < n; s++) {
66
- let o = e[s], r = t[s];
67
- if (o !== r) return !1;
66
+ let r = e[s], o = t[s];
67
+ if (r !== o) return !1;
68
68
  }
69
69
  return !0;
70
70
  }
71
- const M = (e) => typeof e == "function", F = (e) => typeof e == "object", { isArray: he } = Array, ot = (e, t) => (t ? e instanceof HTMLStyleElement : !0) && "hydrate" in (e?.dataset || {});
72
- function _t(e, t) {
71
+ const k = (e) => typeof e == "function", Y = (e) => typeof e == "object", { isArray: be } = Array, ct = (e, t) => (t ? e instanceof HTMLStyleElement : !0) && "hydrate" in (e?.dataset || {});
72
+ function Jt(e, t) {
73
73
  let n;
74
- const s = (o) => {
75
- let { length: r } = o;
76
- for (let a = 0; a < r; a++) {
77
- const u = o[a];
78
- if (u && Array.isArray(u))
79
- s(u);
74
+ const s = (r) => {
75
+ let { length: o } = r;
76
+ for (let a = 0; a < o; a++) {
77
+ const l = r[a];
78
+ if (l && Array.isArray(l))
79
+ s(l);
80
80
  else {
81
- const f = typeof u;
82
- if (u == null || f === "function" || f === "boolean")
81
+ const u = typeof l;
82
+ if (l == null || u === "function" || u === "boolean")
83
83
  continue;
84
- f === "string" || f === "number" ? (n == null && (n = ""), n += u) : (n != null && (t(n), n = null), t(u));
84
+ u === "string" || u === "number" ? (n == null && (n = ""), n += l) : (n != null && (t(n), n = null), t(l));
85
85
  }
86
86
  }
87
87
  };
88
88
  s(e), n != null && t(n);
89
89
  }
90
- const jt = (e, t, n) => (e.addEventListener(t, n), () => e.removeEventListener(t, n));
91
- class Bt {
90
+ const Zt = (e, t, n) => (e.addEventListener(t, n), () => e.removeEventListener(t, n));
91
+ class Xt {
92
92
  /**
93
93
  *
94
94
  * @param {HTMLElement} target
@@ -99,40 +99,40 @@ class Bt {
99
99
  this.message = n, this.target = t, this.value = s;
100
100
  }
101
101
  }
102
- class qt extends Bt {
102
+ class Gt extends Xt {
103
103
  }
104
- class me extends Bt {
104
+ class De extends Xt {
105
105
  }
106
- const z = "Custom", ye = null, pe = { true: 1, "": 1, 1: 1 };
107
- function ge(e, t, n, s, o) {
106
+ const q = "Custom", Ce = null, ve = { true: 1, "": 1, 1: 1 };
107
+ function we(e, t, n, s, r) {
108
108
  const {
109
- type: r,
109
+ type: o,
110
110
  reflect: a,
111
- event: u,
112
- value: f,
113
- attr: l = be(t)
114
- } = n?.name != z && F(n) && n != ye ? n : { type: n }, c = r?.name === z && r.map, d = f != null ? r == Function || !M(f) ? () => f : f : null;
111
+ event: l,
112
+ value: u,
113
+ attr: d = Te(t)
114
+ } = n?.name != q && Y(n) && n != Ce ? n : { type: n }, i = o?.name === q && o.map, m = u != null ? o == Function || !k(u) ? () => u : u : null;
115
115
  Object.defineProperty(e, t, {
116
116
  configurable: !0,
117
117
  /**
118
118
  * @this {import("dom").AtomicoThisInternal}
119
119
  * @param {any} newValue
120
120
  */
121
- set(i) {
122
- const m = this[t];
123
- d && r != Boolean && i == null && (i = d());
124
- const { error: g, value: b } = (c ? Te : Ee)(
125
- r,
126
- i
121
+ set(c) {
122
+ const f = this[t];
123
+ m && o != Boolean && c == null && (c = m());
124
+ const { error: g, value: b } = (i ? ke : Pe)(
125
+ o,
126
+ c
127
127
  );
128
128
  if (g && b != null)
129
- throw new qt(
129
+ throw new Gt(
130
130
  this,
131
- `The value defined for prop '${t}' must be of type '${r.name}'`,
131
+ `The value defined for prop '${t}' must be of type '${o.name}'`,
132
132
  b
133
133
  );
134
- m != b && (this._props[t] = b ?? void 0, this.update(), u && zt(this, u), this.updated.then(() => {
135
- a && (this._ignoreAttr = l, De(this, r, l, this[t]), this._ignoreAttr = null);
134
+ f != b && (this._props[t] = b ?? void 0, this.update(), l && Qt(this, l), this.updated.then(() => {
135
+ a && (this._ignoreAttr = d, Ee(this, o, d, this[t]), this._ignoreAttr = null);
136
136
  }));
137
137
  },
138
138
  /**
@@ -141,21 +141,21 @@ function ge(e, t, n, s, o) {
141
141
  get() {
142
142
  return this._props[t];
143
143
  }
144
- }), d && (o[t] = d()), s[l] = { prop: t, type: r };
144
+ }), m && (r[t] = m()), s[d] = { prop: t, type: o };
145
145
  }
146
- const zt = (e, { type: t, base: n = CustomEvent, ...s }) => e.dispatchEvent(new n(t, s)), be = (e) => e.replace(/([A-Z])/g, "-$1").toLowerCase(), De = (e, t, n, s) => s == null || t == Boolean && !s ? e.removeAttribute(n) : e.setAttribute(
146
+ const Qt = (e, { type: t, base: n = CustomEvent, ...s }) => e.dispatchEvent(new n(t, s)), Te = (e) => e.replace(/([A-Z])/g, "-$1").toLowerCase(), Ee = (e, t, n, s) => s == null || t == Boolean && !s ? e.removeAttribute(n) : e.setAttribute(
147
147
  n,
148
- t?.name === z && t?.serialize ? t?.serialize(s) : F(s) ? JSON.stringify(s) : t == Boolean ? "" : s
149
- ), Ce = (e, t) => e == Boolean ? !!pe[t] : e == Number ? Number(t) : e == String ? t : e == Array || e == Object ? JSON.parse(t) : e.name == z ? t : (
148
+ t?.name === q && t?.serialize ? t?.serialize(s) : Y(s) ? JSON.stringify(s) : t == Boolean ? "" : s
149
+ ), Se = (e, t) => e == Boolean ? !!ve[t] : e == Number ? Number(t) : e == String ? t : e == Array || e == Object ? JSON.parse(t) : e.name == q ? t : (
150
150
  // TODO: If when defining reflect the prop can also be of type string?
151
151
  new e(t)
152
- ), Te = ({ map: e }, t) => {
152
+ ), ke = ({ map: e }, t) => {
153
153
  try {
154
154
  return { value: e(t), error: !1 };
155
155
  } catch {
156
156
  return { value: t, error: !0 };
157
157
  }
158
- }, Ee = (e, t) => e == null || t == null ? { value: t, error: !1 } : e != String && t === "" ? { value: void 0, error: !1 } : e == Object || e == Array || e == Symbol ? {
158
+ }, Pe = (e, t) => e == null || t == null ? { value: t, error: !1 } : e != String && t === "" ? { value: void 0, error: !1 } : e == Object || e == Array || e == Symbol ? {
159
159
  value: t,
160
160
  error: {}.toString.call(t) !== `[object ${e.name}]`
161
161
  } : t instanceof e ? {
@@ -165,57 +165,57 @@ const zt = (e, { type: t, base: n = CustomEvent, ...s }) => e.dispatchEvent(new
165
165
  value: t,
166
166
  error: e == Number ? typeof t != "number" ? !0 : Number.isNaN(t) : e == String ? typeof t != "string" : typeof t != "boolean"
167
167
  } : { value: t, error: !0 };
168
- let ve = 0;
169
- const we = (e) => {
168
+ let Me = 0;
169
+ const Ne = (e) => {
170
170
  const t = (e?.dataset || {})?.hydrate || "";
171
- return t || "c" + ve++;
172
- }, k = (e, t = HTMLElement) => {
173
- const n = {}, s = {}, o = "prototype" in t && t.prototype instanceof Element, r = o ? t : "base" in t ? t.base : HTMLElement, { props: a, styles: u } = o ? e : t;
174
- class f extends r {
171
+ return t || "c" + Me++;
172
+ }, N = (e, t = HTMLElement) => {
173
+ const n = {}, s = {}, r = "prototype" in t && t.prototype instanceof Element, o = r ? t : "base" in t ? t.base : HTMLElement, { props: a, styles: l } = r ? e : t;
174
+ class u extends o {
175
175
  constructor() {
176
176
  super(), this._setup(), this._render = () => e({ ...this._props });
177
- for (const c in s) this[c] = s[c];
177
+ for (const i in s) this[i] = s[i];
178
178
  }
179
179
  /**
180
180
  * @returns {import("core").Sheets[]}
181
181
  */
182
182
  static get styles() {
183
- return [super.styles, u];
183
+ return [super.styles, l];
184
184
  }
185
185
  async _setup() {
186
186
  if (this._props) return;
187
187
  this._props = {};
188
- let c, d;
188
+ let i, m;
189
189
  this.mounted = new Promise(
190
- (y) => this.mount = () => {
191
- y(), c != this.parentNode && (d != c ? this.unmounted.then(this.update) : this.update()), c = this.parentNode;
190
+ (p) => this.mount = () => {
191
+ p(), i != this.parentNode && (m != i ? this.unmounted.then(this.update) : this.update()), i = this.parentNode;
192
192
  }
193
193
  ), this.unmounted = new Promise(
194
- (y) => this.unmount = () => {
195
- y(), (c != this.parentNode || !this.isConnected) && (i.cleanEffects(!0)()(), d = this.parentNode, c = null);
194
+ (p) => this.unmount = () => {
195
+ p(), (i != this.parentNode || !this.isConnected) && (c.cleanEffects(!0)()(), m = this.parentNode, i = null);
196
196
  }
197
197
  ), this.symbolId = this.symbolId || Symbol(), this.symbolIdParent = Symbol();
198
- const i = de(
198
+ const c = ge(
199
199
  () => this.update(),
200
200
  this,
201
- we(this)
201
+ Ne(this)
202
202
  );
203
- let m, g = !0;
204
- const b = ot(this);
205
- this.update = () => (m || (m = !0, this.updated = (this.updated || this.mounted).then(() => {
203
+ let f, g = !0;
204
+ const b = ct(this);
205
+ this.update = () => (f || (f = !0, this.updated = (this.updated || this.mounted).then(() => {
206
206
  try {
207
- const y = i.load(this._render), p = i.cleanEffects();
208
- return y && //@ts-ignore
209
- y.render(this, this.symbolId, b), m = !1, g && !i.isSuspense() && (g = !1, !b && Se(this)), p();
207
+ const p = c.load(this._render), y = c.cleanEffects();
208
+ return p && //@ts-ignore
209
+ p.render(this, this.symbolId, b), f = !1, g && !c.isSuspense() && (g = !1, !b && Oe(this)), y();
210
210
  } finally {
211
- m = !1;
211
+ f = !1;
212
212
  }
213
213
  }).then(
214
214
  /**
215
215
  * @param {import("internal/hooks.js").CleanUseEffects} [cleanUseEffect]
216
216
  */
217
- (y) => {
218
- y && y();
217
+ (p) => {
218
+ p && p();
219
219
  }
220
220
  )), this.updated), this.update();
221
221
  }
@@ -231,58 +231,58 @@ const we = (e) => {
231
231
  * @param {(string|null)} oldValue
232
232
  * @param {(string|null)} value
233
233
  */
234
- attributeChangedCallback(c, d, i) {
235
- if (n[c]) {
236
- if (c === this._ignoreAttr || d === i) return;
237
- const { prop: m, type: g } = n[c];
234
+ attributeChangedCallback(i, m, c) {
235
+ if (n[i]) {
236
+ if (i === this._ignoreAttr || m === c) return;
237
+ const { prop: f, type: g } = n[i];
238
238
  try {
239
- this[m] = Ce(g, i);
239
+ this[f] = Se(g, c);
240
240
  } catch {
241
- throw new me(
241
+ throw new De(
242
242
  this,
243
- `The value defined as attr '${c}' cannot be parsed by type '${g.name}'`,
244
- i
243
+ `The value defined as attr '${i}' cannot be parsed by type '${g.name}'`,
244
+ c
245
245
  );
246
246
  }
247
247
  } else
248
- super.attributeChangedCallback(c, d, i);
248
+ super.attributeChangedCallback(i, m, c);
249
249
  }
250
250
  static get props() {
251
251
  return { ...super.props, ...a };
252
252
  }
253
253
  static get observedAttributes() {
254
- const c = super.observedAttributes || [];
255
- for (const d in a)
256
- ge(this.prototype, d, a[d], n, s);
257
- return Object.keys(n).concat(c);
254
+ const i = super.observedAttributes || [];
255
+ for (const m in a)
256
+ we(this.prototype, m, a[m], n, s);
257
+ return Object.keys(n).concat(i);
258
258
  }
259
259
  }
260
- return f;
260
+ return u;
261
261
  };
262
- function Se(e) {
262
+ function Oe(e) {
263
263
  const { styles: t } = e.constructor, { shadowRoot: n } = e;
264
264
  if (n && t.length) {
265
265
  const s = [];
266
- _t(t, (o) => {
267
- o && (o instanceof Element ? n.appendChild(o.cloneNode(!0)) : s.push(o));
266
+ Jt(t, (r) => {
267
+ r && (r instanceof Element ? n.appendChild(r.cloneNode(!0)) : s.push(r));
268
268
  }), s.length && (n.adoptedStyleSheets = s);
269
269
  }
270
270
  }
271
- const Ht = (e) => (t, n) => {
272
- R(
271
+ const Vt = (e) => (t, n) => {
272
+ $(
273
273
  /**
274
274
  * Clean the effect hook
275
275
  * @type {import("internal/hooks.js").CollectorEffect}
276
276
  */
277
- ([s, o] = []) => ((o || !o) && (o && xt(o, n) ? s = s || !0 : (M(s) && s(), s = null)), [s, n]),
277
+ ([s, r] = []) => ((r || !r) && (r && Kt(r, n) ? s = s || !0 : (k(s) && s(), s = null)), [s, n]),
278
278
  /**
279
279
  * @returns {any}
280
280
  */
281
- ([s, o], r) => r ? (M(s) && s(), []) : [s || t(), o],
281
+ ([s, r], o) => o ? (k(s) && s(), []) : [s || t(), r],
282
282
  e
283
283
  );
284
- }, L = Ht(Yt), Me = Ht(Ft);
285
- class Wt extends Array {
284
+ }, I = Vt(Wt), Ue = Vt(qt);
285
+ class te extends Array {
286
286
  /**
287
287
  *
288
288
  * @param {any} initialState
@@ -290,14 +290,14 @@ class Wt extends Array {
290
290
  */
291
291
  constructor(t, n) {
292
292
  let s = !0;
293
- const o = (r) => {
293
+ const r = (o) => {
294
294
  try {
295
- n(r, this, s);
295
+ n(o, this, s);
296
296
  } finally {
297
297
  s = !1;
298
298
  }
299
299
  };
300
- super(void 0, o, n), o(t);
300
+ super(void 0, r, n), r(t);
301
301
  }
302
302
  /**
303
303
  * The following code allows a mutable approach to useState
@@ -312,47 +312,47 @@ class Wt extends Array {
312
312
  // this[2](nextState, this);
313
313
  // }
314
314
  }
315
- const it = (e) => {
316
- const t = Lt();
317
- return R(
318
- (n = new Wt(e, (s, o, r) => {
319
- s = M(s) ? s(o[0]) : s, s !== o[0] && (o[0] = s, r || t());
315
+ const dt = (e) => {
316
+ const t = Ht();
317
+ return $(
318
+ (n = new te(e, (s, r, o) => {
319
+ s = k(s) ? s(r[0]) : s, s !== r[0] && (r[0] = s, o || t());
320
320
  })) => n
321
321
  );
322
- }, w = (e, t) => {
323
- const [n] = R(([s, o, r = 0] = []) => ((!o || o && !xt(o, t)) && (s = e()), [s, t, r]));
322
+ }, T = (e, t) => {
323
+ const [n] = $(([s, r, o = 0] = []) => ((!r || r && !Kt(r, t)) && (s = e()), [s, t, o]));
324
324
  return n;
325
- }, lt = (e) => {
326
- const { current: t } = W();
325
+ }, ft = (e) => {
326
+ const { current: t } = H();
327
327
  if (!(e in t))
328
- throw new qt(
328
+ throw new Gt(
329
329
  t,
330
330
  `For useProp("${e}"), the prop does not exist on the host.`,
331
331
  e
332
332
  );
333
- return R(
334
- (n = new Wt(t[e], (s, o) => {
335
- s = M(s) ? s(t[e]) : s, t[e] = s;
333
+ return $(
334
+ (n = new te(t[e], (s, r) => {
335
+ s = k(s) ? s(t[e]) : s, t[e] = s;
336
336
  })) => (n[0] = t[e], n)
337
337
  );
338
- }, N = (e, t = {}) => {
339
- const n = W();
340
- return n[e] || (n[e] = (s = t.detail) => zt(n.current, {
338
+ }, E = (e, t = {}) => {
339
+ const n = H();
340
+ return n[e] || (n[e] = (s = t.detail) => Qt(n.current, {
341
341
  type: e,
342
342
  ...t,
343
343
  detail: s
344
344
  })), n[e];
345
- }, rt = x("atomico/options");
346
- globalThis[rt] = globalThis[rt] || {
345
+ }, it = L("atomico/options");
346
+ globalThis[it] = globalThis[it] || {
347
347
  sheet: !!document.adoptedStyleSheets
348
348
  };
349
- const K = globalThis[rt], Ne = new Promise((e) => {
350
- K.ssr || (document.readyState === "loading" ? jt(document, "DOMContentLoaded", e) : e());
351
- }), Pe = {
349
+ const K = globalThis[it], Ae = new Promise((e) => {
350
+ K.ssr || (document.readyState === "loading" ? Zt(document, "DOMContentLoaded", e) : e());
351
+ }), $e = {
352
352
  checked: 1,
353
353
  value: 1,
354
354
  selected: 1
355
- }, ke = {
355
+ }, Fe = {
356
356
  list: 1,
357
357
  type: 1,
358
358
  size: 1,
@@ -362,39 +362,39 @@ const K = globalThis[rt], Ne = new Promise((e) => {
362
362
  src: 1,
363
363
  href: 1,
364
364
  slot: 1
365
- }, Oe = {
365
+ }, Ye = {
366
366
  shadowDom: 1,
367
367
  staticNode: 1,
368
368
  cloneNode: 1,
369
369
  children: 1,
370
370
  key: 1
371
- }, q = {}, at = [];
372
- class ct extends Text {
371
+ }, W = {}, lt = [];
372
+ class ut extends Text {
373
373
  }
374
- const Ae = x("atomico/id"), I = x("atomico/type"), Q = x("atomico/ref"), Kt = x("atomico/vnode"), Jt = () => {
374
+ const Re = L("atomico/id"), R = L("atomico/type"), et = L("atomico/ref"), ee = L("atomico/vnode"), ne = () => {
375
375
  };
376
- function Ue(e, t, n) {
377
- return Xt(this, e, t, n);
376
+ function Ie(e, t, n) {
377
+ return oe(this, e, t, n);
378
378
  }
379
- const Zt = (e, t, ...n) => {
380
- const s = t || q;
381
- let { children: o } = s;
382
- if (o = o ?? (n.length ? n : at), e === Jt)
383
- return o;
384
- const r = e ? e instanceof Node ? 1 : (
379
+ const se = (e, t, ...n) => {
380
+ const s = t || W;
381
+ let { children: r } = s;
382
+ if (r = r ?? (n.length ? n : lt), e === ne)
383
+ return r;
384
+ const o = e ? e instanceof Node ? 1 : (
385
385
  //@ts-ignore
386
386
  e.prototype instanceof HTMLElement && 2
387
387
  ) : 0;
388
- if (r === !1 && e instanceof Function)
388
+ if (o === !1 && e instanceof Function)
389
389
  return e(
390
- o != at ? { children: o, ...s } : s
390
+ r != lt ? { children: r, ...s } : s
391
391
  );
392
- const a = K.render || Ue;
392
+ const a = K.render || Ie;
393
393
  return {
394
- [I]: Kt,
394
+ [R]: ee,
395
395
  type: e,
396
396
  props: s,
397
- children: o,
397
+ children: r,
398
398
  key: s.key,
399
399
  // key for lists by keys
400
400
  // define if the node declares its shadowDom
@@ -402,7 +402,7 @@ const Zt = (e, t, ...n) => {
402
402
  // allows renderings to run only once
403
403
  static: s.staticNode,
404
404
  // defines whether the type is a childNode `1` or a constructor `2`
405
- raw: r,
405
+ raw: o,
406
406
  // defines whether to use the second parameter for document.createElement
407
407
  is: s.is,
408
408
  // clone the node if it comes from a reference
@@ -410,184 +410,184 @@ const Zt = (e, t, ...n) => {
410
410
  render: a
411
411
  };
412
412
  };
413
- function Xt(e, t, n = Ae, s, o) {
414
- let r;
415
- if (t && t[n] && t[n].vnode == e || e[I] != Kt)
413
+ function oe(e, t, n = Re, s, r) {
414
+ let o;
415
+ if (t && t[n] && t[n].vnode == e || e[R] != ee)
416
416
  return t;
417
- (e || !t) && (o = o || e.type == "svg", r = e.type != "host" && (e.raw == 1 ? (t && e.clone ? t[Q] : t) != e.type : e.raw == 2 ? !(t instanceof e.type) : t ? t[Q] || t.localName != e.type : !t), r && e.type != null && (e.raw == 1 && e.clone ? (s = !0, t = e.type.cloneNode(!0), t[Q] = e.type) : t = e.raw == 1 ? e.type : e.raw == 2 ? new e.type() : o ? document.createElementNS(
417
+ (e || !t) && (r = r || e.type == "svg", o = e.type != "host" && (e.raw == 1 ? (t && e.clone ? t[et] : t) != e.type : e.raw == 2 ? !(t instanceof e.type) : t ? t[et] || t.localName != e.type : !t), o && e.type != null && (e.raw == 1 && e.clone ? (s = !0, t = e.type.cloneNode(!0), t[et] = e.type) : t = e.raw == 1 ? e.type : e.raw == 2 ? new e.type() : r ? document.createElementNS(
418
418
  "http://www.w3.org/2000/svg",
419
419
  e.type
420
420
  ) : document.createElement(
421
421
  e.type,
422
422
  e.is ? { is: e.is } : void 0
423
423
  )));
424
- const a = t[n] ? t[n] : q, { vnode: u = q, cycle: f = 0 } = a;
425
- let { fragment: l, handlers: c } = a;
426
- const { children: d = at, props: i = q } = u;
427
- if (c = r ? {} : c || {}, e.static && !r) return t;
424
+ const a = t[n] ? t[n] : W, { vnode: l = W, cycle: u = 0 } = a;
425
+ let { fragment: d, handlers: i } = a;
426
+ const { children: m = lt, props: c = W } = l;
427
+ if (i = o ? {} : i || {}, e.static && !o) return t;
428
428
  if (e.shadow && !t.shadowRoot && // @ts-ignore
429
- t.attachShadow({ mode: "open", ...e.shadow }), e.props != i && Ye(t, i, e.props, c, o), e.children !== d) {
430
- const m = e.shadow ? t.shadowRoot : t;
431
- l = Re(
429
+ t.attachShadow({ mode: "open", ...e.shadow }), e.props != c && _e(t, c, e.props, i, r), e.children !== m) {
430
+ const f = e.shadow ? t.shadowRoot : t;
431
+ d = Le(
432
432
  e.children,
433
433
  /**
434
434
  * @todo for hydration use attribute and send childNodes
435
435
  */
436
- l,
437
- m,
436
+ d,
437
+ f,
438
438
  n,
439
439
  // add support to foreignObject, children will escape from svg
440
- !f && s,
441
- o && e.type == "foreignObject" ? !1 : o
440
+ !u && s,
441
+ r && e.type == "foreignObject" ? !1 : r
442
442
  );
443
443
  }
444
- return t[n] = { vnode: e, handlers: c, fragment: l, cycle: f + 1 }, t;
444
+ return t[n] = { vnode: e, handlers: i, fragment: d, cycle: u + 1 }, t;
445
445
  }
446
- function $e(e, t) {
447
- const n = new ct(""), s = new ct("");
448
- let o;
446
+ function xe(e, t) {
447
+ const n = new ut(""), s = new ut("");
448
+ let r;
449
449
  if (e[t ? "prepend" : "append"](n), t) {
450
- let { lastElementChild: r } = e;
451
- for (; r; ) {
452
- const { previousElementSibling: a } = r;
453
- if (ot(r, !0) && !ot(a, !0)) {
454
- o = r;
450
+ let { lastElementChild: o } = e;
451
+ for (; o; ) {
452
+ const { previousElementSibling: a } = o;
453
+ if (ct(o, !0) && !ct(a, !0)) {
454
+ r = o;
455
455
  break;
456
456
  }
457
- r = a;
457
+ o = a;
458
458
  }
459
459
  }
460
- return o ? o.before(s) : e.append(s), {
460
+ return r ? r.before(s) : e.append(s), {
461
461
  markStart: n,
462
462
  markEnd: s
463
463
  };
464
464
  }
465
- function Re(e, t, n, s, o, r) {
466
- e = e == null ? null : he(e) ? e : [e];
467
- const a = t || $e(n, o), { markStart: u, markEnd: f, keyes: l } = a;
468
- let c;
469
- const d = l && /* @__PURE__ */ new Set();
470
- let i = u;
471
- if (e && _t(e, (m) => {
472
- if (typeof m == "object" && !m[I])
465
+ function Le(e, t, n, s, r, o) {
466
+ e = e == null ? null : be(e) ? e : [e];
467
+ const a = t || xe(n, r), { markStart: l, markEnd: u, keyes: d } = a;
468
+ let i;
469
+ const m = d && /* @__PURE__ */ new Set();
470
+ let c = l;
471
+ if (e && Jt(e, (f) => {
472
+ if (typeof f == "object" && !f[R])
473
473
  return;
474
- const g = m[I] && m.key, b = l && g != null && l.get(g);
475
- i != f && i === b ? d.delete(i) : i = i == f ? f : i.nextSibling;
476
- const y = l ? b : i;
477
- let p = y;
478
- if (m[I])
479
- p = Xt(m, y, s, o, r);
474
+ const g = f[R] && f.key, b = d && g != null && d.get(g);
475
+ c != u && c === b ? m.delete(c) : c = c == u ? u : c.nextSibling;
476
+ const p = d ? b : c;
477
+ let y = p;
478
+ if (f[R])
479
+ y = oe(f, p, s, r, o);
480
480
  else {
481
- const v = m + "";
482
- !(p instanceof Text) || p instanceof ct ? p = new Text(v) : p.data != v && (p.data = v);
481
+ const P = f + "";
482
+ !(y instanceof Text) || y instanceof ut ? y = new Text(P) : y.data != P && (y.data = P);
483
483
  }
484
- p != i && (l && d.delete(p), !y || l ? (n.insertBefore(p, i), l && i != f && d.add(i)) : y == f ? n.insertBefore(p, f) : (n.replaceChild(p, y), i = p)), g != null && (c = c || /* @__PURE__ */ new Map(), c.set(g, p));
485
- }), i = i == f ? f : i.nextSibling, t && i != f)
486
- for (; i != f; ) {
487
- const m = i;
488
- i = i.nextSibling, m.remove();
484
+ y != c && (d && m.delete(y), !p || d ? (n.insertBefore(y, c), d && c != u && m.add(c)) : p == u ? n.insertBefore(y, u) : (n.replaceChild(y, p), c = y)), g != null && (i = i || /* @__PURE__ */ new Map(), i.set(g, y));
485
+ }), c = c == u ? u : c.nextSibling, t && c != u)
486
+ for (; c != u; ) {
487
+ const f = c;
488
+ c = c.nextSibling, f.remove();
489
489
  }
490
- return d && d.forEach((m) => m.remove()), a.keyes = c, a;
490
+ return m && m.forEach((f) => f.remove()), a.keyes = i, a;
491
491
  }
492
- function Ye(e, t, n, s, o) {
493
- for (const r in t)
494
- !(r in n) && St(e, r, t[r], null, o, s);
495
- for (const r in n)
496
- St(e, r, t[r], n[r], o, s);
492
+ function _e(e, t, n, s, r) {
493
+ for (const o in t)
494
+ !(o in n) && Ut(e, o, t[o], null, r, s);
495
+ for (const o in n)
496
+ Ut(e, o, t[o], n[o], r, s);
497
497
  }
498
- function St(e, t, n, s, o, r) {
499
- if (t = t == "class" && !o ? "className" : t, n = n ?? null, s = s ?? null, t in e && Pe[t] && (n = e[t]), !(s === n || Oe[t] || t[0] == "_"))
498
+ function Ut(e, t, n, s, r, o) {
499
+ if (t = t == "class" && !r ? "className" : t, n = n ?? null, s = s ?? null, t in e && $e[t] && (n = e[t]), !(s === n || Ye[t] || t[0] == "_"))
500
500
  if (e.localName === "slot" && t === "assignNode" && "assign" in e)
501
501
  e.assign(s);
502
- else if (t[0] == "o" && t[1] == "n" && (M(s) || M(n)))
503
- Fe(e, t.slice(2), s, r);
502
+ else if (t[0] == "o" && t[1] == "n" && (k(s) || k(n)))
503
+ je(e, t.slice(2), s, o);
504
504
  else if (t == "ref")
505
- s && (M(s) ? s(e) : s.current = e);
505
+ s && (k(s) ? s(e) : s.current = e);
506
506
  else if (t == "style") {
507
507
  const { style: a } = e;
508
508
  n = n || "", s = s || "";
509
- const u = F(n), f = F(s);
510
- if (u)
511
- for (const l in n)
512
- if (f)
513
- !(l in s) && Mt(a, l, null);
509
+ const l = Y(n), u = Y(s);
510
+ if (l)
511
+ for (const d in n)
512
+ if (u)
513
+ !(d in s) && At(a, d, null);
514
514
  else
515
515
  break;
516
- if (f)
517
- for (const l in s) {
518
- const c = s[l];
519
- u && n[l] === c || Mt(a, l, c);
516
+ if (u)
517
+ for (const d in s) {
518
+ const i = s[d];
519
+ l && n[d] === i || At(a, d, i);
520
520
  }
521
521
  else
522
522
  a.cssText = s;
523
523
  } else {
524
524
  const a = t[0] == "$" ? t.slice(1) : t;
525
- a === t && (!o && !ke[t] && t in e || M(s) || M(n)) ? e[t] = s ?? "" : s == null ? e.removeAttribute(a) : e.setAttribute(
525
+ a === t && (!r && !Fe[t] && t in e || k(s) || k(n)) ? e[t] = s ?? "" : s == null ? e.removeAttribute(a) : e.setAttribute(
526
526
  a,
527
- F(s) ? JSON.stringify(s) : s
527
+ Y(s) ? JSON.stringify(s) : s
528
528
  );
529
529
  }
530
530
  }
531
- function Fe(e, t, n, s) {
532
- if (s.handleEvent || (s.handleEvent = (o) => s[o.type].call(e, o)), n) {
531
+ function je(e, t, n, s) {
532
+ if (s.handleEvent || (s.handleEvent = (r) => s[r.type].call(e, r)), n) {
533
533
  if (!s[t]) {
534
- const o = n.capture || n.once || n.passive ? Object.assign({}, n) : null;
535
- e.addEventListener(t, s, o);
534
+ const r = n.capture || n.once || n.passive ? Object.assign({}, n) : null;
535
+ e.addEventListener(t, s, r);
536
536
  }
537
537
  s[t] = n;
538
538
  } else
539
539
  s[t] && (e.removeEventListener(t, s), delete s[t]);
540
540
  }
541
- function Mt(e, t, n) {
541
+ function At(e, t, n) {
542
542
  let s = "setProperty";
543
543
  n == null && (s = "removeProperty", n = null), ~t.indexOf("-") ? e[s](t, n) : e[t] = n;
544
544
  }
545
- const Ie = Zt("host", { style: "display: contents" }), Gt = "value", Le = (e, t) => {
546
- const n = W(), s = It();
547
- Me(
548
- () => jt(
545
+ const Be = se("host", { style: "display: contents" }), re = "value", ht = (e, t) => {
546
+ const n = H(), s = zt();
547
+ Ue(
548
+ () => Zt(
549
549
  n.current,
550
550
  "ConnectContext",
551
551
  /**
552
552
  * @param {CustomEvent<import("context").DetailConnectContext>} event
553
553
  */
554
- (o) => {
555
- o.composedPath().at(0) !== o.currentTarget && e === o.detail.id && (o.stopPropagation(), o.detail.connect(s));
554
+ (r) => {
555
+ r.composedPath().at(0) !== r.currentTarget && e === r.detail.id && (r.stopPropagation(), r.detail.connect(s));
556
556
  }
557
557
  ),
558
558
  [e]
559
559
  ), s.current = t;
560
- }, ut = (e) => {
561
- const t = N("ConnectContext", {
560
+ }, J = (e) => {
561
+ const t = E("ConnectContext", {
562
562
  bubbles: !0,
563
563
  composed: !0
564
- }), [n, s] = it(() => {
564
+ }), [n, s] = dt(() => {
565
565
  if (K.ssr) return;
566
- let r;
566
+ let o;
567
567
  return t({
568
568
  id: e,
569
569
  /**
570
570
  * @param {import("core").Ref} parentContext
571
571
  */
572
572
  connect(a) {
573
- r = a;
573
+ o = a;
574
574
  }
575
- }), r;
576
- }), o = Lt();
577
- return L(() => {
578
- Ne.then(
575
+ }), o;
576
+ }), r = Ht();
577
+ return I(() => {
578
+ Ae.then(
579
579
  () => t({
580
580
  id: e,
581
581
  connect: s
582
582
  })
583
583
  );
584
- }, [e]), L(() => {
584
+ }, [e]), I(() => {
585
585
  if (n)
586
- return n.on(o);
587
- }, [n]), n?.current || e[Gt];
588
- }, Qt = (e) => {
589
- const t = k(
590
- ({ value: n }) => (Le(t, n), Ie),
586
+ return n.on(r);
587
+ }, [n]), n?.current || e[re];
588
+ }, mt = (e) => {
589
+ const t = N(
590
+ ({ value: n }) => (ht(t, n), Be),
591
591
  {
592
592
  props: {
593
593
  value: {
@@ -597,9 +597,9 @@ const Ie = Zt("host", { style: "display: contents" }), Gt = "value", Le = (e, t)
597
597
  }
598
598
  }
599
599
  );
600
- return t[Gt] = e, t;
600
+ return t[re] = e, t;
601
601
  };
602
- Qt({
602
+ mt({
603
603
  /**
604
604
  *
605
605
  * @param {string} type
@@ -608,15 +608,15 @@ Qt({
608
608
  dispatch(e, t) {
609
609
  }
610
610
  });
611
- const Nt = {};
612
- function J(e, ...t) {
611
+ const $t = {};
612
+ function Z(e, ...t) {
613
613
  const n = (e.raw || e).reduce(
614
- (s, o, r) => s + o + (t[r] || ""),
614
+ (s, r, o) => s + r + (t[o] || ""),
615
615
  ""
616
616
  );
617
- return Nt[n] = Nt[n] || xe(n);
617
+ return $t[n] = $t[n] || We(n);
618
618
  }
619
- function xe(e) {
619
+ function We(e) {
620
620
  if (K.sheet) {
621
621
  const t = new CSSStyleSheet();
622
622
  return t.replaceSync(e), t;
@@ -625,49 +625,55 @@ function xe(e) {
625
625
  return t.textContent = e, t;
626
626
  }
627
627
  }
628
- const h = (e, t, n) => (t == null ? t = { key: n } : t.key = n, Zt(e, t)), S = h, ft = J`*,*:before,*:after{box-sizing:border-box}button{padding:0;touch-action:manipulation;cursor:pointer;user-select:none}`, dt = J`.vh{position:absolute;transform:scale(0)}`;
629
- function ht() {
628
+ const h = (e, t, n) => (t == null ? t = { key: n } : t.key = n, se(e, t)), S = h, yt = Z`*,*:before,*:after{box-sizing:border-box}button{padding:0;touch-action:manipulation;cursor:pointer;user-select:none}`, pt = Z`.vh{position:absolute;transform:scale(0)}`;
629
+ let Ft = !1;
630
+ function qe(e) {
631
+ return e === 0 && !Ft && (Ft = !0, console.warn(
632
+ "[cally] Using 0 for Sunday in firstDayOfWeek is deprecated and will be removed in v1. Use 7 instead."
633
+ )), e === 7 ? 0 : e;
634
+ }
635
+ function gt() {
630
636
  const e = /* @__PURE__ */ new Date();
631
637
  return new C(e.getFullYear(), e.getMonth() + 1, e.getDate());
632
638
  }
633
- const _e = 864e5;
634
- function je(e) {
635
- const t = E(e);
639
+ const ze = 864e5;
640
+ function He(e) {
641
+ const t = w(e);
636
642
  t.setUTCDate(t.getUTCDate() + 3 - (t.getUTCDay() + 6) % 7);
637
643
  const n = new Date(Date.UTC(t.getUTCFullYear(), 0, 4));
638
644
  return 1 + Math.round(
639
- ((t.getTime() - n.getTime()) / _e - 3 + (n.getUTCDay() + 6) % 7) / 7
645
+ ((t.getTime() - n.getTime()) / ze - 3 + (n.getUTCDay() + 6) % 7) / 7
640
646
  );
641
647
  }
642
- function mt(e, t = 0) {
643
- const n = E(e), s = n.getUTCDay(), o = (s < t ? 7 : 0) + s - t;
644
- return n.setUTCDate(n.getUTCDate() - o), C.from(n);
648
+ function bt(e, t = 0) {
649
+ const n = w(e), s = n.getUTCDay(), r = (s < t ? 7 : 0) + s - t;
650
+ return n.setUTCDate(n.getUTCDate() - r), C.from(n);
645
651
  }
646
- function Vt(e, t = 0) {
647
- return mt(e, t).add({ days: 6 });
652
+ function ae(e, t = 0) {
653
+ return bt(e, t).add({ days: 6 });
648
654
  }
649
- function te(e) {
655
+ function Dt(e) {
650
656
  return C.from(new Date(Date.UTC(e.year, e.month, 0)));
651
657
  }
652
- function Z(e, t, n) {
658
+ function X(e, t, n) {
653
659
  return t && C.compare(e, t) < 0 ? t : n && C.compare(e, n) > 0 ? n : e;
654
660
  }
655
- const Be = { days: 1 };
656
- function qe(e, t = 0) {
657
- let n = mt(e.toPlainDate(), t);
658
- const s = Vt(te(e), t), o = [];
661
+ const Ke = { days: 1 };
662
+ function Je(e, t = 0) {
663
+ let n = bt(e.toPlainDate(), t);
664
+ const s = ae(Dt(e), t), r = [];
659
665
  for (; C.compare(n, s) < 0; ) {
660
- const r = [];
666
+ const o = [];
661
667
  for (let a = 0; a < 7; a++)
662
- r.push(n), n = n.add(Be);
663
- o.push(r);
668
+ o.push(n), n = n.add(Ke);
669
+ r.push(o);
664
670
  }
665
- return o;
671
+ return r;
666
672
  }
667
- function E(e) {
673
+ function w(e) {
668
674
  return new Date(Date.UTC(e.year, e.month - 1, e.day ?? 1));
669
675
  }
670
- const ze = /^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[0-1])$/, V = (e, t) => e.toString().padStart(t, "0");
676
+ const Ze = /^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[0-1])$/, nt = (e, t) => e.toString().padStart(t, "0");
671
677
  class C {
672
678
  constructor(t, n, s) {
673
679
  this.year = t, this.month = n, this.day = s;
@@ -676,19 +682,19 @@ class C {
676
682
  // i didn't want to get into more complex arithmetic since it get tricky fast
677
683
  // this is enough to serve my needs and will still be a drop-in replacement when actual Temporal API lands
678
684
  add(t) {
679
- const n = E(this);
685
+ const n = w(this);
680
686
  if ("days" in t)
681
687
  return n.setUTCDate(this.day + t.days), C.from(n);
682
- let { year: s, month: o } = this;
683
- "months" in t ? (o = this.month + t.months, n.setUTCMonth(o - 1)) : (s = this.year + t.years, n.setUTCFullYear(s));
684
- const r = C.from(E({ year: s, month: o, day: 1 }));
685
- return Z(C.from(n), r, te(r));
688
+ let { year: s, month: r } = this;
689
+ "months" in t ? (r = this.month + t.months, n.setUTCMonth(r - 1)) : (s = this.year + t.years, n.setUTCFullYear(s));
690
+ const o = C.from(w({ year: s, month: r, day: 1 }));
691
+ return X(C.from(n), o, Dt(o));
686
692
  }
687
693
  toString() {
688
- return `${V(this.year, 4)}-${V(this.month, 2)}-${V(this.day, 2)}`;
694
+ return `${nt(this.year, 4)}-${nt(this.month, 2)}-${nt(this.day, 2)}`;
689
695
  }
690
696
  toPlainYearMonth() {
691
- return new U(this.year, this.month);
697
+ return new O(this.year, this.month);
692
698
  }
693
699
  equals(t) {
694
700
  return C.compare(this, t) === 0;
@@ -698,14 +704,14 @@ class C {
698
704
  }
699
705
  static from(t) {
700
706
  if (typeof t == "string") {
701
- const n = t.match(ze);
707
+ const n = t.match(Ze);
702
708
  if (!n)
703
709
  throw new TypeError(t);
704
- const [, s, o, r] = n;
710
+ const [, s, r, o] = n;
705
711
  return new C(
706
712
  parseInt(s, 10),
707
- parseInt(o, 10),
708
- parseInt(r, 10)
713
+ parseInt(r, 10),
714
+ parseInt(o, 10)
709
715
  );
710
716
  }
711
717
  return new C(
@@ -715,13 +721,13 @@ class C {
715
721
  );
716
722
  }
717
723
  }
718
- class U {
724
+ class O {
719
725
  constructor(t, n) {
720
726
  this.year = t, this.month = n;
721
727
  }
722
728
  add(t) {
723
- const n = E(this), s = (t.months ?? 0) + (t.years ?? 0) * 12;
724
- return n.setUTCMonth(n.getUTCMonth() + s), new U(n.getUTCFullYear(), n.getUTCMonth() + 1);
729
+ const n = w(this), s = (t.months ?? 0) + (t.years ?? 0) * 12;
730
+ return n.setUTCMonth(n.getUTCMonth() + s), new O(n.getUTCFullYear(), n.getUTCMonth() + 1);
725
731
  }
726
732
  equals(t) {
727
733
  return this.year === t.year && this.month === t.month;
@@ -733,161 +739,193 @@ class U {
733
739
  return t.year < n.year ? -1 : t.year > n.year ? 1 : t.month < n.month ? -1 : t.month > n.month ? 1 : 0;
734
740
  }
735
741
  }
736
- function H(e, t) {
742
+ const Yt = /* @__PURE__ */ new Date(), G = mt({
743
+ type: "date",
744
+ value: new O(Yt.getUTCFullYear(), Yt.getUTCMonth() + 1)
745
+ });
746
+ customElements.define("calendar-heading-ctx", G);
747
+ function z(e, t) {
737
748
  if (t)
738
749
  try {
739
750
  return e.from(t);
740
751
  } catch {
741
752
  }
742
753
  }
743
- function P(e) {
744
- const [t, n] = lt(e);
745
- return [w(() => H(C, t), [t]), (r) => n(r?.toString())];
754
+ function M(e) {
755
+ const [t, n] = ft(e);
756
+ return [T(() => z(C, t), [t]), (o) => n(o?.toString())];
746
757
  }
747
- function He(e) {
748
- const [t = "", n] = lt(e);
749
- return [w(() => {
750
- const [r, a] = t.split("/"), u = H(C, r), f = H(C, a);
751
- return u && f ? [u, f] : [];
752
- }, [t]), (r) => n(`${r[0]}/${r[1]}`)];
758
+ function Xe(e) {
759
+ const [t = "", n] = ft(e);
760
+ return [T(() => {
761
+ const [o, a] = t.split("/"), l = z(C, o), u = z(C, a);
762
+ return l && u ? [l, u] : [];
763
+ }, [t]), (o) => n(`${o[0]}/${o[1]}`)];
753
764
  }
754
- function We(e) {
755
- const [t = "", n] = lt(e);
756
- return [w(() => {
757
- const r = [];
765
+ function Ge(e) {
766
+ const [t = "", n] = ft(e);
767
+ return [T(() => {
768
+ const o = [];
758
769
  for (const a of t.trim().split(/\s+/)) {
759
- const u = H(C, a);
760
- u && r.push(u);
770
+ const l = z(C, a);
771
+ l && o.push(l);
761
772
  }
762
- return r;
763
- }, [t]), (r) => n(r.join(" "))];
773
+ return o;
774
+ }, [t]), (o) => n(o.join(" "))];
764
775
  }
765
- function $(e, t) {
766
- return w(
776
+ function Q(e, t) {
777
+ return T(
767
778
  () => new Intl.DateTimeFormat(t, { timeZone: "UTC", ...e }),
768
779
  [t, e]
769
780
  );
770
781
  }
771
- function Pt(e, t, n) {
772
- const s = $(e, n);
773
- return w(() => {
774
- const o = [], r = /* @__PURE__ */ new Date();
782
+ function Rt(e, t, n) {
783
+ const s = Q(e, n);
784
+ return T(() => {
785
+ const r = [], o = /* @__PURE__ */ new Date();
775
786
  for (var a = 0; a < 7; a++) {
776
- const u = (r.getUTCDay() - t + 7) % 7;
777
- o[u] = s.format(r), r.setUTCDate(r.getUTCDate() + 1);
787
+ const l = (o.getUTCDay() - t + 7) % 7;
788
+ r[l] = s.format(o), o.setUTCDate(o.getUTCDate() + 1);
778
789
  }
779
- return o;
790
+ return r;
780
791
  }, [t, s]);
781
792
  }
782
- const kt = (e, t, n) => Z(e, t, n) === e, Ot = (e) => e.target.matches(":dir(ltr)"), Ke = { month: "long", day: "numeric" }, Je = { month: "long" }, Ze = { weekday: "long" }, tt = { bubbles: !0 };
783
- function Xe({ props: e, context: t }) {
793
+ const It = (e, t, n) => X(e, t, n) === e, xt = (e) => e.target.matches(":dir(ltr)"), Qe = { month: "long", day: "numeric" }, Ve = { weekday: "long" }, st = { bubbles: !0 };
794
+ function tn({ props: e, context: t }) {
784
795
  const { offset: n } = e, {
785
796
  firstDayOfWeek: s,
786
- isDateDisallowed: o,
787
- min: r,
797
+ isDateDisallowed: r,
798
+ min: o,
788
799
  max: a,
789
- today: u,
790
- page: f,
791
- locale: l,
792
- focusedDate: c,
793
- formatWeekday: d
794
- } = t, i = u ?? ht(), m = Pt(Ze, s, l), g = w(
795
- () => ({ weekday: d }),
796
- [d]
797
- ), b = Pt(g, s, l), y = $(Ke, l), p = $(Je, l), v = w(
798
- () => f.start.add({ months: n }),
799
- [f, n]
800
- ), X = w(
801
- () => qe(v, s),
802
- [v, s]
803
- ), se = N("focusday", tt), oe = N("selectday", tt), re = N("hoverday", tt);
804
- function Dt(D) {
805
- se(Z(D, r, a));
800
+ today: l,
801
+ page: u,
802
+ locale: d,
803
+ focusedDate: i,
804
+ formatWeekday: m
805
+ } = t, c = l ?? gt(), f = Rt(Ve, s, d), g = T(
806
+ () => ({ weekday: m }),
807
+ [m]
808
+ ), b = Rt(g, s, d), p = Q(Qe, d), y = T(
809
+ () => u.start.add({ months: n }),
810
+ [u, n]
811
+ );
812
+ ht(G, { type: "date", value: y, locale: d });
813
+ const P = T(
814
+ () => Je(y, s),
815
+ [y, s]
816
+ ), V = E("focusday", st), le = E("selectday", st), ue = E("hoverday", st);
817
+ function Et(D) {
818
+ V(X(D, o, a));
806
819
  }
807
- function ae(D) {
808
- let T;
820
+ function de(D) {
821
+ let v;
809
822
  switch (D.key) {
810
823
  case "ArrowRight":
811
- T = c.add({ days: Ot(D) ? 1 : -1 });
824
+ v = i.add({ days: xt(D) ? 1 : -1 });
812
825
  break;
813
826
  case "ArrowLeft":
814
- T = c.add({ days: Ot(D) ? -1 : 1 });
827
+ v = i.add({ days: xt(D) ? -1 : 1 });
815
828
  break;
816
829
  case "ArrowDown":
817
- T = c.add({ days: 7 });
830
+ v = i.add({ days: 7 });
818
831
  break;
819
832
  case "ArrowUp":
820
- T = c.add({ days: -7 });
833
+ v = i.add({ days: -7 });
821
834
  break;
822
835
  case "PageUp":
823
- T = c.add(D.shiftKey ? { years: -1 } : { months: -1 });
836
+ v = i.add(D.shiftKey ? { years: -1 } : { months: -1 });
824
837
  break;
825
838
  case "PageDown":
826
- T = c.add(D.shiftKey ? { years: 1 } : { months: 1 });
839
+ v = i.add(D.shiftKey ? { years: 1 } : { months: 1 });
827
840
  break;
828
841
  case "Home":
829
- T = mt(c, s);
842
+ v = bt(i, s);
830
843
  break;
831
844
  case "End":
832
- T = Vt(c, s);
845
+ v = ae(i, s);
833
846
  break;
834
847
  default:
835
848
  return;
836
849
  }
837
- Dt(T), D.preventDefault();
850
+ Et(v), D.preventDefault();
838
851
  }
839
- function ce(D) {
840
- const T = v.equals(D);
841
- if (!t.showOutsideDays && !T)
852
+ function fe(D) {
853
+ const v = y.equals(D);
854
+ if (!t.showOutsideDays && !v)
842
855
  return;
843
- const ie = D.equals(c), Ct = D.equals(i), j = E(D), B = o?.(j), Tt = !kt(D, r, a);
844
- let Et = "", O;
856
+ const he = D.equals(i), St = D.equals(c), j = w(D), B = r?.(j), kt = !It(D, o, a);
857
+ let Pt = "", U;
845
858
  if (t.type === "range") {
846
- const [Y, G] = t.value, vt = Y?.equals(D), wt = G?.equals(D);
847
- O = Y && G && kt(D, Y, G), Et = `${vt ? "range-start" : ""} ${wt ? "range-end" : ""} ${O && !vt && !wt ? "range-inner" : ""}`;
848
- } else t.type === "multi" ? O = t.value.some((Y) => Y.equals(D)) : O = t.value?.equals(D);
859
+ const [F, tt] = t.value, Nt = F?.equals(D), Ot = tt?.equals(D);
860
+ U = F && tt && It(D, F, tt), Pt = `${Nt ? "range-start" : ""} ${Ot ? "range-end" : ""} ${U && !Nt && !Ot ? "range-inner" : ""}`;
861
+ } else t.type === "multi" ? U = t.value.some((F) => F.equals(D)) : U = t.value?.equals(D);
862
+ const Mt = j.getUTCDay();
849
863
  return {
850
- part: `${`button day day-${j.getUTCDay()} ${// we don't want outside days to ever be shown as selected
851
- T ? O ? "selected" : "" : "outside"} ${B ? "disallowed" : ""} ${Ct ? "today" : ""} ${t.getDayParts?.(j) ?? ""}`} ${Et}`,
852
- tabindex: T && ie ? 0 : -1,
853
- disabled: Tt,
864
+ part: `${`button day day-${Mt === 0 ? "0 day-7" : Mt} ${// we don't want outside days to ever be shown as selected
865
+ v ? U ? "selected" : "" : "outside"} ${B ? "disallowed" : ""} ${St ? "today" : ""} ${t.getDayParts?.(j) ?? ""}`} ${Pt}`,
866
+ tabindex: v && he ? 0 : -1,
867
+ disabled: kt,
854
868
  "aria-disabled": B ? "true" : void 0,
855
- "aria-pressed": T && O,
856
- "aria-current": Ct ? "date" : void 0,
857
- "aria-label": y.format(j),
858
- onkeydown: ae,
869
+ "aria-pressed": v && U,
870
+ "aria-current": St ? "date" : void 0,
871
+ "aria-label": p.format(j),
872
+ onkeydown: de,
859
873
  onclick() {
860
- B || oe(D), Dt(D);
874
+ B || le(D), Et(D);
861
875
  },
862
876
  onmouseover() {
863
- !B && !Tt && re(D);
877
+ !B && !kt && ue(D);
864
878
  }
865
879
  };
866
880
  }
867
881
  return {
868
- weeks: X,
869
- yearMonth: v,
870
- daysLong: m,
882
+ weeks: P,
883
+ yearMonth: y,
884
+ daysLong: f,
871
885
  daysVisible: b,
872
- formatter: p,
873
- getDayProps: ce
886
+ getDayProps: fe
874
887
  };
875
888
  }
876
- const et = ht(), _ = Qt({
889
+ const ot = gt(), _ = mt({
877
890
  type: "date",
878
891
  firstDayOfWeek: 1,
879
- focusedDate: et,
880
- page: { start: et.toPlainYearMonth(), end: et.toPlainYearMonth() }
892
+ focusedDate: ot,
893
+ page: { start: ot.toPlainYearMonth(), end: ot.toPlainYearMonth() }
881
894
  });
882
895
  customElements.define("calendar-ctx", _);
883
- const Ge = (e, t) => (t + e) % 7, Qe = k(
896
+ const x = N(
897
+ (e) => {
898
+ const t = J(G), n = T(() => {
899
+ const o = {};
900
+ return e.year && (o.year = e.year), e.month && (o.month = e.month), o;
901
+ }, [e.year, e.month]), s = Q(n, t.locale), r = t.type === "range" ? s.formatRange(w(t.value.start), w(t.value.end)) : s.format(w(t.value));
902
+ return /* @__PURE__ */ h("host", { shadowDom: !0, children: r });
903
+ },
904
+ {
905
+ props: {
906
+ year: {
907
+ type: String,
908
+ value: () => {
909
+ }
910
+ },
911
+ month: {
912
+ type: String,
913
+ value: () => {
914
+ }
915
+ }
916
+ }
917
+ }
918
+ );
919
+ customElements.define("calendar-heading", x);
920
+ const en = (e, t) => (t + e) % 7, nn = N(
884
921
  (e) => {
885
- const t = ut(_), n = It(), s = Xe({ props: e, context: t });
886
- function o() {
922
+ const t = J(_), n = zt(), s = tn({ props: e, context: t });
923
+ function r() {
887
924
  n.current.querySelector("button[tabindex='0']")?.focus();
888
925
  }
889
- return /* @__PURE__ */ S("host", { shadowDom: !0, focus: o, children: [
890
- /* @__PURE__ */ h("div", { id: "h", part: "heading", children: s.formatter.format(E(s.yearMonth)) }),
926
+ return /* @__PURE__ */ S("host", { shadowDom: !0, focus: r, children: [
927
+ /* @__PURE__ */ h(x, { month: "long", id: "h", class: "vh" }),
928
+ /* @__PURE__ */ h("slot", { name: "heading", part: "heading", children: /* @__PURE__ */ h(x, { month: "long", "aria-hidden": "true" }) }),
891
929
  /* @__PURE__ */ S("table", { ref: n, "aria-labelledby": "h", part: "table", children: [
892
930
  /* @__PURE__ */ S("colgroup", { children: [
893
931
  t.showWeekNumbers && /* @__PURE__ */ h("col", { part: "col-weeknumber" }),
@@ -904,23 +942,26 @@ const Ge = (e, t) => (t + e) % 7, Qe = k(
904
942
  /* @__PURE__ */ h("span", { class: "vh", children: "Week" }),
905
943
  /* @__PURE__ */ h("span", { "aria-hidden": "true", children: "#" })
906
944
  ] }) }),
907
- s.daysLong.map((r, a) => /* @__PURE__ */ S(
908
- "th",
909
- {
910
- part: `th day day-${Ge(t.firstDayOfWeek, a)}`,
911
- scope: "col",
912
- children: [
913
- /* @__PURE__ */ h("span", { class: "vh", children: r }),
914
- /* @__PURE__ */ h("span", { "aria-hidden": "true", children: s.daysVisible[a] })
915
- ]
916
- }
917
- ))
945
+ s.daysLong.map((o, a) => {
946
+ const l = en(t.firstDayOfWeek, a);
947
+ return /* @__PURE__ */ S(
948
+ "th",
949
+ {
950
+ part: `th day day-${l === 0 ? "0 day-7" : l}`,
951
+ scope: "col",
952
+ children: [
953
+ /* @__PURE__ */ h("span", { class: "vh", children: o }),
954
+ /* @__PURE__ */ h("span", { "aria-hidden": "true", children: s.daysVisible[a] })
955
+ ]
956
+ }
957
+ );
958
+ })
918
959
  ] }) }),
919
- /* @__PURE__ */ h("tbody", { children: s.weeks.map((r, a) => /* @__PURE__ */ S("tr", { part: "tr week", children: [
920
- t.showWeekNumbers && /* @__PURE__ */ h("th", { class: "num", part: "th weeknumber", scope: "row", children: je(r[0]) }),
921
- r.map((u, f) => {
922
- const l = s.getDayProps(u);
923
- return /* @__PURE__ */ h("td", { part: "td", children: l && /* @__PURE__ */ h("button", { class: "num", ...l, children: u.day }) }, f);
960
+ /* @__PURE__ */ h("tbody", { children: s.weeks.map((o, a) => /* @__PURE__ */ S("tr", { part: "tr week", children: [
961
+ t.showWeekNumbers && /* @__PURE__ */ h("th", { class: "num", part: "th weeknumber", scope: "row", children: He(o[0]) }),
962
+ o.map((l, u) => {
963
+ const d = s.getDayProps(l);
964
+ return /* @__PURE__ */ h("td", { part: "td", children: d && /* @__PURE__ */ h("button", { class: "num", ...d, children: l.day }) }, u);
924
965
  })
925
966
  ] }, a)) })
926
967
  ] })
@@ -934,14 +975,14 @@ const Ge = (e, t) => (t + e) % 7, Qe = k(
934
975
  }
935
976
  },
936
977
  styles: [
937
- ft,
938
- dt,
939
- J`:host{--color-accent: black;--color-text-on-accent: white;display:flex;flex-direction:column;gap:.25rem;text-align:center;inline-size:fit-content}table{border-collapse:collapse;font-size:.875rem}th{inline-size:2.25rem;block-size:2.25rem}td{padding-inline:0}.num{font-variant-numeric:tabular-nums}button{color:inherit;font-size:inherit;background:transparent;border:0;block-size:2.25rem;inline-size:2.25rem}button:hover:where(:not(:disabled,[aria-disabled])){background:#0000000d}button:is([aria-pressed=true],:focus-visible){background:var(--color-accent);color:var(--color-text-on-accent)}button:focus-visible{outline:1px solid var(--color-text-on-accent);outline-offset:-2px}button:disabled,:host::part(outside),:host::part(disallowed){cursor:default;opacity:.5}`
978
+ yt,
979
+ pt,
980
+ Z`:host{--color-accent: black;--color-text-on-accent: white;display:flex;flex-direction:column;gap:.25rem;text-align:center;inline-size:fit-content}table{border-collapse:collapse;font-size:.875rem}th{inline-size:2.25rem;block-size:2.25rem}td{padding-inline:0}.num{font-variant-numeric:tabular-nums}button{color:inherit;font-size:inherit;background:transparent;border:0;block-size:2.25rem;inline-size:2.25rem}button:hover:where(:not(:disabled,[aria-disabled])){background:#0000000d}button:is([aria-pressed=true],:focus-visible){background:var(--color-accent);color:var(--color-text-on-accent)}button:focus-visible{outline:1px solid var(--color-text-on-accent);outline-offset:-2px}button:disabled,:host::part(outside),:host::part(disallowed){cursor:default;opacity:.5}`
940
981
  ]
941
982
  }
942
983
  );
943
- customElements.define("calendar-month", Qe);
944
- function At(e) {
984
+ customElements.define("calendar-month", nn);
985
+ function Lt(e) {
945
986
  return /* @__PURE__ */ h(
946
987
  "button",
947
988
  {
@@ -952,28 +993,40 @@ function At(e) {
952
993
  }
953
994
  );
954
995
  }
955
- function yt(e) {
956
- const t = E(e.page.start), n = E(e.page.end);
996
+ function Ct(e) {
957
997
  return /* @__PURE__ */ h(
958
998
  _,
959
999
  {
960
- value: e,
1000
+ value: {
1001
+ ...e,
1002
+ firstDayOfWeek: qe(e.firstDayOfWeek)
1003
+ },
961
1004
  onselectday: e.onSelect,
962
1005
  onfocusday: e.onFocus,
963
1006
  onhoverday: e.onHover,
964
1007
  children: /* @__PURE__ */ S("div", { role: "group", "aria-labelledby": "h", part: "container", children: [
965
- /* @__PURE__ */ h("div", { id: "h", class: "vh", "aria-live": "polite", "aria-atomic": "true", children: e.formatVerbose.formatRange(t, n) }),
1008
+ /* @__PURE__ */ h(
1009
+ x,
1010
+ {
1011
+ month: "long",
1012
+ year: "numeric",
1013
+ id: "h",
1014
+ class: "vh",
1015
+ "aria-live": "polite",
1016
+ "aria-atomic": "true"
1017
+ }
1018
+ ),
966
1019
  /* @__PURE__ */ S("div", { part: "header", children: [
967
- /* @__PURE__ */ h(At, { name: "previous", onclick: e.previous, children: "Previous" }),
968
- /* @__PURE__ */ h("slot", { part: "heading", name: "heading", children: /* @__PURE__ */ h("div", { "aria-hidden": "true", children: e.format.formatRange(t, n) }) }),
969
- /* @__PURE__ */ h(At, { name: "next", onclick: e.next, children: "Next" })
1020
+ /* @__PURE__ */ h(Lt, { name: "previous", onclick: e.previous, children: "Previous" }),
1021
+ /* @__PURE__ */ h("slot", { part: "heading", name: "heading", children: /* @__PURE__ */ h(x, { year: "numeric", "aria-hidden": "true" }) }),
1022
+ /* @__PURE__ */ h(Lt, { name: "next", onclick: e.next, children: "Next" })
970
1023
  ] }),
971
1024
  /* @__PURE__ */ h("slot", { part: "months" })
972
1025
  ] })
973
1026
  }
974
1027
  );
975
1028
  }
976
- const pt = {
1029
+ const vt = {
977
1030
  value: {
978
1031
  type: String,
979
1032
  value: ""
@@ -1032,184 +1085,190 @@ const pt = {
1032
1085
  type: Boolean,
1033
1086
  value: !1
1034
1087
  }
1035
- }, gt = [
1036
- ft,
1037
- dt,
1038
- J`:host{display:block;inline-size:fit-content}:host::part(container){display:flex;flex-direction:column;gap:1em}:host::part(header){display:flex;align-items:center;justify-content:space-between}:host::part(heading){font-weight:700;font-size:1.25em}:host::part(button){display:flex;align-items:center;justify-content:center}:host::part(button disabled){cursor:default;opacity:.5}`
1039
- ], Ve = { year: "numeric" }, tn = { year: "numeric", month: "long" };
1040
- function nt(e, t) {
1088
+ }, wt = [
1089
+ yt,
1090
+ pt,
1091
+ Z`:host{display:block;inline-size:fit-content}:host::part(container){display:flex;flex-direction:column;gap:1em}:host::part(header){display:flex;align-items:center;justify-content:space-between}:host::part(heading){font-weight:700;font-size:1.25em}:host::part(button){display:flex;align-items:center;justify-content:center}:host::part(button disabled){cursor:default;opacity:.5}`
1092
+ ];
1093
+ function rt(e, t) {
1041
1094
  return (t.year - e.year) * 12 + t.month - e.month;
1042
1095
  }
1043
- const Ut = (e, t) => (e = t === 12 ? new U(e.year, 1) : e, {
1096
+ const _t = (e, t, n = "months") => (t === 12 && n !== "single" && (e = new O(e.year, 1)), {
1044
1097
  start: e,
1045
1098
  end: e.add({ months: t - 1 })
1046
1099
  });
1047
- function en({
1100
+ function sn({
1048
1101
  pageBy: e,
1049
1102
  focusedDate: t,
1050
1103
  months: n,
1051
1104
  max: s,
1052
- min: o,
1053
- goto: r
1105
+ min: r,
1106
+ goto: o
1054
1107
  }) {
1055
- const a = e === "single" ? 1 : n, [u, f] = it(
1056
- () => Ut(t.toPlainYearMonth(), n)
1057
- ), l = (d) => f(Ut(u.start.add({ months: d }), n)), c = (d) => {
1058
- const i = nt(u.start, d.toPlainYearMonth());
1059
- return i >= 0 && i < n;
1108
+ const a = e === "single" ? 1 : n, [l, u] = dt(
1109
+ () => _t(t.toPlainYearMonth(), n, e)
1110
+ ), d = E("pagechange"), i = (c) => {
1111
+ const f = _t(l.start.add({ months: c }), n, e);
1112
+ u(f), d({
1113
+ start: w(f.start),
1114
+ end: w(Dt(f.end))
1115
+ });
1116
+ }, m = (c) => {
1117
+ const f = rt(l.start, c.toPlainYearMonth());
1118
+ return f >= 0 && f < n;
1060
1119
  };
1061
- return L(() => {
1062
- if (c(t))
1120
+ return I(() => {
1121
+ if (m(t))
1063
1122
  return;
1064
- const d = nt(t.toPlainYearMonth(), u.start);
1065
- r(t.add({ months: d }));
1066
- }, [u.start]), L(() => {
1067
- if (c(t))
1123
+ const c = rt(t.toPlainYearMonth(), l.start);
1124
+ o(t.add({ months: c }));
1125
+ }, [l.start]), I(() => {
1126
+ if (m(t))
1068
1127
  return;
1069
- const d = nt(u.start, t.toPlainYearMonth());
1070
- l(d === -1 ? -a : d === n ? a : Math.floor(d / n) * n);
1128
+ const c = rt(l.start, t.toPlainYearMonth());
1129
+ i(c === -1 ? -a : c === n ? a : Math.floor(c / n) * n);
1071
1130
  }, [t, a, n]), {
1072
- page: u,
1073
- previous: !o || !c(o) ? () => l(-a) : void 0,
1074
- next: !s || !c(s) ? () => l(a) : void 0
1131
+ page: l,
1132
+ previous: !r || !m(r) ? () => i(-a) : void 0,
1133
+ next: !s || !m(s) ? () => i(a) : void 0
1075
1134
  };
1076
1135
  }
1077
- function bt({
1136
+ function Tt({
1078
1137
  months: e,
1079
1138
  pageBy: t,
1080
1139
  locale: n,
1081
1140
  focusedDate: s,
1082
- setFocusedDate: o
1141
+ setFocusedDate: r
1083
1142
  }) {
1084
- const [r] = P("min"), [a] = P("max"), [u] = P("today"), f = N("focusday"), l = N("change"), c = w(
1085
- () => Z(s ?? u ?? ht(), r, a),
1086
- [s, u, r, a]
1143
+ const [o] = M("min"), [a] = M("max"), [l] = M("today"), u = E("focusday"), d = E("change"), i = T(
1144
+ () => X(s ?? l ?? gt(), o, a),
1145
+ [s, l, o, a]
1087
1146
  );
1088
- function d(p) {
1089
- o(p), f(E(p));
1147
+ function m(y) {
1148
+ r(y), u(w(y));
1090
1149
  }
1091
- const { next: i, previous: m, page: g } = en({
1150
+ const { next: c, previous: f, page: g } = sn({
1092
1151
  pageBy: t,
1093
- focusedDate: c,
1152
+ focusedDate: i,
1094
1153
  months: e,
1095
- min: r,
1154
+ min: o,
1096
1155
  max: a,
1097
- goto: d
1098
- }), b = W();
1099
- function y(p) {
1100
- const v = p?.target ?? "day";
1101
- v === "day" ? b.current.querySelectorAll("calendar-month").forEach((X) => X.focus(p)) : b.current.shadowRoot.querySelector(`[part~='${v}']`).focus(p);
1156
+ goto: m
1157
+ });
1158
+ ht(G, { type: "range", value: g, locale: n });
1159
+ const b = H();
1160
+ function p(y) {
1161
+ const P = y?.target ?? "day";
1162
+ P === "day" ? b.current.querySelectorAll("calendar-month").forEach((V) => V.focus(y)) : b.current.shadowRoot.querySelector(`[part~='${P}']`).focus(y);
1102
1163
  }
1103
1164
  return {
1104
- format: $(Ve, n),
1105
- formatVerbose: $(tn, n),
1106
1165
  page: g,
1107
- focusedDate: c,
1108
- dispatch: l,
1109
- onFocus(p) {
1110
- p.stopPropagation(), d(p.detail), setTimeout(y);
1166
+ focusedDate: i,
1167
+ dispatch: d,
1168
+ onFocus(y) {
1169
+ y.stopPropagation(), m(y.detail), setTimeout(p);
1111
1170
  },
1112
- min: r,
1171
+ min: o,
1113
1172
  max: a,
1114
- today: u,
1115
- next: i,
1116
- previous: m,
1117
- focus: y
1173
+ today: l,
1174
+ next: c,
1175
+ previous: f,
1176
+ focus: p
1118
1177
  };
1119
1178
  }
1120
- const nn = k(
1179
+ const on = N(
1121
1180
  (e) => {
1122
- const [t, n] = P("value"), [s = t, o] = P("focusedDate"), r = bt({
1181
+ const [t, n] = M("value"), [s = t, r] = M("focusedDate"), o = Tt({
1123
1182
  ...e,
1124
1183
  focusedDate: s,
1125
- setFocusedDate: o
1184
+ setFocusedDate: r
1126
1185
  });
1127
- function a(u) {
1128
- n(u.detail), r.dispatch();
1186
+ function a(l) {
1187
+ n(l.detail), o.dispatch();
1129
1188
  }
1130
- return /* @__PURE__ */ h("host", { shadowDom: !0, focus: r.focus, children: /* @__PURE__ */ h(
1131
- yt,
1189
+ return /* @__PURE__ */ h("host", { shadowDom: !0, focus: o.focus, children: /* @__PURE__ */ h(
1190
+ Ct,
1132
1191
  {
1133
1192
  ...e,
1134
- ...r,
1193
+ ...o,
1135
1194
  type: "date",
1136
1195
  value: t,
1137
1196
  onSelect: a
1138
1197
  }
1139
1198
  ) });
1140
1199
  },
1141
- { props: pt, styles: gt }
1200
+ { props: vt, styles: wt }
1142
1201
  );
1143
- customElements.define("calendar-date", nn);
1144
- function ee(e) {
1145
- return /* @__PURE__ */ S(Jt, { children: [
1202
+ customElements.define("calendar-date", on);
1203
+ function ce(e) {
1204
+ return /* @__PURE__ */ S(ne, { children: [
1146
1205
  /* @__PURE__ */ h("label", { part: "label", for: "s", children: /* @__PURE__ */ h("slot", { name: "label", children: e.label }) }),
1147
1206
  /* @__PURE__ */ h("select", { id: "s", part: "select", onchange: e.onChange, children: e.options.map((t) => /* @__PURE__ */ h("option", { part: "option", ...t })) })
1148
1207
  ] });
1149
1208
  }
1150
- const ne = [ft, dt];
1151
- function sn(e, t) {
1209
+ const ie = [yt, pt];
1210
+ function rn(e, t) {
1152
1211
  return Array.from({ length: e }, (n, s) => t(s));
1153
1212
  }
1154
- function on(e) {
1155
- const { min: t, max: n, focusedDate: s } = ut(_), o = N("focusday", { bubbles: !0 }), r = s.toPlainYearMonth(), a = r.year, u = Math.floor(e.maxYears / 2), f = a - u, l = a + (e.maxYears - u - 1), c = Math.max(f, t?.year ?? -1 / 0), d = Math.min(l, n?.year ?? 1 / 0), i = sn(d - c + 1, (g) => {
1156
- const b = c + g;
1213
+ function an(e) {
1214
+ const { min: t, max: n, focusedDate: s } = J(_), r = E("focusday", { bubbles: !0 }), o = s.toPlainYearMonth(), a = o.year, l = Math.floor(e.maxYears / 2), u = a - l, d = a + (e.maxYears - l - 1), i = Math.max(u, t?.year ?? -1 / 0), m = Math.min(d, n?.year ?? 1 / 0), c = rn(m - i + 1, (g) => {
1215
+ const b = i + g;
1157
1216
  return {
1158
1217
  label: `${b}`,
1159
1218
  value: `${b}`,
1160
- selected: b === r.year
1219
+ selected: b === o.year
1161
1220
  };
1162
1221
  });
1163
- function m(g) {
1164
- const y = parseInt(g.currentTarget.value) - r.year;
1165
- o(s.add({ years: y }));
1222
+ function f(g) {
1223
+ const p = parseInt(g.currentTarget.value) - o.year;
1224
+ r(s.add({ years: p }));
1166
1225
  }
1167
- return { options: i, onChange: m };
1226
+ return { options: c, onChange: f };
1168
1227
  }
1169
- const rn = k(
1228
+ const cn = N(
1170
1229
  (e) => {
1171
- const t = on(e);
1172
- return /* @__PURE__ */ h("host", { shadowDom: !0, children: /* @__PURE__ */ h(ee, { label: "Year", ...t }) });
1230
+ const t = an(e);
1231
+ return /* @__PURE__ */ h("host", { shadowDom: !0, children: /* @__PURE__ */ h(ce, { label: "Year", ...t }) });
1173
1232
  },
1174
1233
  {
1175
1234
  props: {
1176
1235
  maxYears: { type: Number, value: 20 }
1177
1236
  },
1178
- styles: ne
1237
+ styles: ie
1179
1238
  }
1180
1239
  );
1181
- customElements.define("calendar-select-year", rn);
1182
- function an(e) {
1183
- const { min: t, max: n, focusedDate: s, locale: o } = ut(_), r = N("focusday", { bubbles: !0 }), a = w(
1240
+ customElements.define("calendar-select-year", cn);
1241
+ function ln(e) {
1242
+ const { min: t, max: n, focusedDate: s, locale: r } = J(_), o = E("focusday", { bubbles: !0 }), a = T(
1184
1243
  () => ({ month: e.formatMonth }),
1185
1244
  [e.formatMonth]
1186
- ), u = $(a, o), f = w(() => {
1187
- const i = [], m = /* @__PURE__ */ new Date();
1188
- m.setUTCDate(1);
1245
+ ), l = Q(a, r), u = T(() => {
1246
+ const c = [], f = /* @__PURE__ */ new Date();
1247
+ f.setUTCDate(1);
1189
1248
  for (var g = 0; g < 12; g++) {
1190
- const b = (m.getUTCMonth() + 12) % 12;
1191
- i[b] = u.format(m), m.setUTCMonth(m.getUTCMonth() + 1);
1249
+ const b = (f.getUTCMonth() + 12) % 12;
1250
+ c[b] = l.format(f), f.setUTCMonth(f.getUTCMonth() + 1);
1192
1251
  }
1193
- return i;
1194
- }, [u]), l = s.toPlainYearMonth(), c = f.map((i, m) => {
1195
- const g = m + 1, b = l.add({ months: g - l.month }), y = t != null && U.compare(b, t) < 0 || n != null && U.compare(b, n) > 0;
1252
+ return c;
1253
+ }, [l]), d = s.toPlainYearMonth(), i = u.map((c, f) => {
1254
+ const g = f + 1, b = d.add({ months: g - d.month }), p = t != null && O.compare(b, t) < 0 || n != null && O.compare(b, n) > 0;
1196
1255
  return {
1197
- label: i,
1256
+ label: c,
1198
1257
  value: `${g}`,
1199
- disabled: y,
1200
- selected: g === l.month
1258
+ disabled: p,
1259
+ selected: g === d.month
1201
1260
  };
1202
1261
  });
1203
- function d(i) {
1204
- const g = parseInt(i.currentTarget.value) - l.month;
1205
- r(s.add({ months: g }));
1262
+ function m(c) {
1263
+ const g = parseInt(c.currentTarget.value) - d.month;
1264
+ o(s.add({ months: g }));
1206
1265
  }
1207
- return { options: c, onChange: d };
1266
+ return { options: i, onChange: m };
1208
1267
  }
1209
- const cn = k(
1268
+ const un = N(
1210
1269
  (e) => {
1211
- const t = an(e);
1212
- return /* @__PURE__ */ h("host", { shadowDom: !0, children: /* @__PURE__ */ h(ee, { label: "Month", ...t }) });
1270
+ const t = ln(e);
1271
+ return /* @__PURE__ */ h("host", { shadowDom: !0, children: /* @__PURE__ */ h(ce, { label: "Month", ...t }) });
1213
1272
  },
1214
1273
  {
1215
1274
  props: {
@@ -1218,86 +1277,87 @@ const cn = k(
1218
1277
  value: () => "long"
1219
1278
  }
1220
1279
  },
1221
- styles: ne
1280
+ styles: ie
1222
1281
  }
1223
1282
  );
1224
- customElements.define("calendar-select-month", cn);
1225
- const $t = (e, t) => C.compare(e, t) < 0 ? [e, t] : [t, e], ln = k(
1283
+ customElements.define("calendar-select-month", un);
1284
+ const jt = (e, t) => C.compare(e, t) < 0 ? [e, t] : [t, e], dn = N(
1226
1285
  (e) => {
1227
- const [t, n] = He("value"), [s = t[0], o] = P("focusedDate"), r = bt({
1286
+ const [t, n] = Xe("value"), [s = t[0], r] = M("focusedDate"), o = Tt({
1228
1287
  ...e,
1229
1288
  focusedDate: s,
1230
- setFocusedDate: o
1231
- }), a = N("rangestart"), u = N("rangeend"), [f, l] = P(
1289
+ setFocusedDate: r
1290
+ }), a = E("rangestart"), l = E("rangeend"), [u, d] = M(
1232
1291
  "tentative"
1233
- ), [c, d] = it();
1234
- L(() => d(void 0), [f]);
1235
- function i(y) {
1236
- r.onFocus(y), m(y);
1292
+ ), [i, m] = dt();
1293
+ I(() => m(void 0), [u]);
1294
+ function c(p) {
1295
+ o.onFocus(p), f(p);
1237
1296
  }
1238
- function m(y) {
1239
- y.stopPropagation(), f && d(y.detail);
1297
+ function f(p) {
1298
+ p.stopPropagation(), u && m(p.detail);
1240
1299
  }
1241
- function g(y) {
1242
- const p = y.detail;
1243
- y.stopPropagation(), f ? (n($t(f, p)), l(void 0), u(E(p)), r.dispatch()) : (l(p), a(E(p)));
1300
+ function g(p) {
1301
+ const y = p.detail;
1302
+ p.stopPropagation(), u ? (n(jt(u, y)), d(void 0), l(w(y)), o.dispatch()) : (d(y), a(w(y)));
1244
1303
  }
1245
- const b = f ? $t(f, c ?? f) : t;
1246
- return /* @__PURE__ */ h("host", { shadowDom: !0, focus: r.focus, children: /* @__PURE__ */ h(
1247
- yt,
1304
+ const b = u ? jt(u, i ?? u) : t;
1305
+ return /* @__PURE__ */ h("host", { shadowDom: !0, focus: o.focus, children: /* @__PURE__ */ h(
1306
+ Ct,
1248
1307
  {
1249
1308
  ...e,
1250
- ...r,
1309
+ ...o,
1251
1310
  type: "range",
1252
1311
  value: b,
1253
- onFocus: i,
1254
- onHover: m,
1312
+ onFocus: c,
1313
+ onHover: f,
1255
1314
  onSelect: g
1256
1315
  }
1257
1316
  ) });
1258
1317
  },
1259
1318
  {
1260
1319
  props: {
1261
- ...pt,
1320
+ ...vt,
1262
1321
  tentative: {
1263
1322
  type: String,
1264
1323
  value: ""
1265
1324
  }
1266
1325
  },
1267
- styles: gt
1326
+ styles: wt
1268
1327
  }
1269
1328
  );
1270
- customElements.define("calendar-range", ln);
1271
- const un = k(
1329
+ customElements.define("calendar-range", dn);
1330
+ const fn = N(
1272
1331
  (e) => {
1273
- const [t, n] = We("value"), [s = t[0], o] = P("focusedDate"), r = bt({
1332
+ const [t, n] = Ge("value"), [s = t[0], r] = M("focusedDate"), o = Tt({
1274
1333
  ...e,
1275
1334
  focusedDate: s,
1276
- setFocusedDate: o
1335
+ setFocusedDate: r
1277
1336
  });
1278
- function a(u) {
1279
- const f = [...t], l = t.findIndex((c) => c.equals(u.detail));
1280
- l < 0 ? f.push(u.detail) : f.splice(l, 1), n(f), r.dispatch();
1337
+ function a(l) {
1338
+ const u = [...t], d = t.findIndex((i) => i.equals(l.detail));
1339
+ d < 0 ? u.push(l.detail) : u.splice(d, 1), n(u), o.dispatch();
1281
1340
  }
1282
- return /* @__PURE__ */ h("host", { shadowDom: !0, focus: r.focus, children: /* @__PURE__ */ h(
1283
- yt,
1341
+ return /* @__PURE__ */ h("host", { shadowDom: !0, focus: o.focus, children: /* @__PURE__ */ h(
1342
+ Ct,
1284
1343
  {
1285
1344
  ...e,
1286
- ...r,
1345
+ ...o,
1287
1346
  type: "multi",
1288
1347
  value: t,
1289
1348
  onSelect: a
1290
1349
  }
1291
1350
  ) });
1292
1351
  },
1293
- { props: pt, styles: gt }
1352
+ { props: vt, styles: wt }
1294
1353
  );
1295
- customElements.define("calendar-multi", un);
1354
+ customElements.define("calendar-multi", fn);
1296
1355
  export {
1297
- nn as CalendarDate,
1298
- Qe as CalendarMonth,
1299
- un as CalendarMulti,
1300
- ln as CalendarRange,
1301
- cn as CalendarSelectMonth,
1302
- rn as CalendarSelectYear
1356
+ on as CalendarDate,
1357
+ x as CalendarHeading,
1358
+ nn as CalendarMonth,
1359
+ fn as CalendarMulti,
1360
+ dn as CalendarRange,
1361
+ un as CalendarSelectMonth,
1362
+ cn as CalendarSelectYear
1303
1363
  };