composeui 0.1.0__py3-none-any.whl

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