stimulus_plumbers 0.4.8 → 0.4.10

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 (81) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +39 -0
  3. data/README.md +7 -9
  4. data/app/assets/javascripts/stimulus-plumbers/controllers.manifest.json +367 -23
  5. data/app/assets/javascripts/stimulus-plumbers/index.es.js +678 -233
  6. data/app/assets/javascripts/stimulus-plumbers/index.es.js.map +1 -1
  7. data/app/assets/javascripts/stimulus-plumbers/index.umd.js +1 -1
  8. data/app/assets/javascripts/stimulus-plumbers/index.umd.js.map +1 -1
  9. data/app/assets/stylesheets/stimulus_plumbers/tokens.css +58 -53
  10. data/docs/architecture.md +0 -2
  11. data/docs/component/avatar.md +1 -0
  12. data/docs/component/button.md +1 -0
  13. data/docs/component/calendar.md +7 -16
  14. data/docs/component/checklist.md +153 -0
  15. data/docs/component/form.md +27 -5
  16. data/docs/component/icon.md +7 -5
  17. data/docs/component/indicator.md +55 -0
  18. data/docs/component/list.md +2 -3
  19. data/docs/component/ordered_list.md +118 -0
  20. data/docs/component/plumber.md +21 -0
  21. data/docs/component/popover.md +1 -2
  22. data/docs/component/progress.md +65 -0
  23. data/docs/component/timeline.md +47 -12
  24. data/docs/guide.md +21 -0
  25. data/lib/generators/stimulus_plumbers/install/install_generator.rb +21 -11
  26. data/lib/stimulus_plumbers/components/button.rb +1 -0
  27. data/lib/stimulus_plumbers/components/checklist/item/slots.rb +13 -0
  28. data/lib/stimulus_plumbers/components/checklist/item.rb +64 -0
  29. data/lib/stimulus_plumbers/components/checklist.rb +50 -0
  30. data/lib/stimulus_plumbers/components/combobox/typeahead.rb +1 -0
  31. data/lib/stimulus_plumbers/components/icon.rb +2 -2
  32. data/lib/stimulus_plumbers/components/indicator.rb +30 -0
  33. data/lib/stimulus_plumbers/components/link.rb +1 -0
  34. data/lib/stimulus_plumbers/components/ordered_list/item/slots.rb +13 -0
  35. data/lib/stimulus_plumbers/components/ordered_list/item.rb +129 -0
  36. data/lib/stimulus_plumbers/components/ordered_list.rb +24 -0
  37. data/lib/stimulus_plumbers/components/progress_bar.rb +48 -0
  38. data/lib/stimulus_plumbers/components/progress_meter.rb +37 -0
  39. data/lib/stimulus_plumbers/components/progress_ring.rb +40 -0
  40. data/lib/stimulus_plumbers/components/timeline/event.rb +2 -1
  41. data/lib/stimulus_plumbers/components/timeline/group.rb +5 -3
  42. data/lib/stimulus_plumbers/engine.rb +0 -4
  43. data/lib/stimulus_plumbers/form/builder.rb +4 -0
  44. data/lib/stimulus_plumbers/form/field.rb +1 -1
  45. data/lib/stimulus_plumbers/form/fields/inputs/code.rb +86 -0
  46. data/lib/stimulus_plumbers/form/fields/inputs/credit_card.rb +98 -0
  47. data/lib/stimulus_plumbers/form/fields/inputs/password.rb +1 -0
  48. data/lib/stimulus_plumbers/form/fields/inputs/search.rb +1 -0
  49. data/lib/stimulus_plumbers/form/fields/renderer.rb +2 -0
  50. data/lib/stimulus_plumbers/generators/css_entrypoint.rb +37 -9
  51. data/lib/stimulus_plumbers/generators/tokens_directive.rb +9 -5
  52. data/lib/stimulus_plumbers/helpers/avatar_helper.rb +1 -7
  53. data/lib/stimulus_plumbers/helpers/button_helper.rb +1 -7
  54. data/lib/stimulus_plumbers/helpers/calendar_helper.rb +2 -9
  55. data/lib/stimulus_plumbers/helpers/calendar_turbo_helper.rb +3 -6
  56. data/lib/stimulus_plumbers/helpers/checklist_helper.rb +11 -0
  57. data/lib/stimulus_plumbers/helpers/indicator_helper.rb +11 -0
  58. data/lib/stimulus_plumbers/helpers/ordered_list_helper.rb +11 -0
  59. data/lib/stimulus_plumbers/helpers/popover_helper.rb +1 -7
  60. data/lib/stimulus_plumbers/helpers/progress_helper.rb +21 -0
  61. data/lib/stimulus_plumbers/helpers.rb +8 -0
  62. data/lib/stimulus_plumbers/themes/base.rb +4 -0
  63. data/lib/stimulus_plumbers/themes/schema/icon.rb +21 -4
  64. data/lib/stimulus_plumbers/themes/schema/indicator/ranges.rb +14 -0
  65. data/lib/stimulus_plumbers/themes/schema.rb +82 -25
  66. data/lib/stimulus_plumbers/version.rb +1 -1
  67. data/lib/stimulus_plumbers.rb +10 -0
  68. data/vendor/ARIA.md +29 -2
  69. data/vendor/component/manifest.json +215 -0
  70. data/vendor/controller/docs/calendar.md +4 -7
  71. data/vendor/controller/docs/checklist.md +45 -0
  72. data/vendor/controller/docs/combobox.md +1 -31
  73. data/vendor/controller/docs/input-clearable.md +1 -4
  74. data/vendor/controller/docs/input-formatter.md +88 -23
  75. data/vendor/controller/docs/modal.md +1 -4
  76. data/vendor/controller/docs/popover.md +1 -3
  77. data/vendor/controller/docs/progress.md +82 -0
  78. data/vendor/controller/docs/reorderable.md +82 -0
  79. data/vendor/controller/docs/visibility.md +31 -0
  80. data/vendor/controller/manifest.json +367 -23
  81. metadata +27 -1
@@ -66,9 +66,14 @@ function c(e) {
66
66
  function l(e) {
67
67
  e.preventDefault(), e.stopPropagation();
68
68
  }
69
- var u = class {
69
+ var u = {
70
+ Alt: "altKey",
71
+ Control: "ctrlKey",
72
+ Shift: "shiftKey",
73
+ Meta: "metaKey"
74
+ }, d = class {
70
75
  constructor(e, t = {}) {
71
- this.items = Array.from(e), this.currentIndex = t.initialIndex ?? 0, this.orientation = t.orientation ?? "both", this.wrap = t.wrap ?? !0, this._handleKeyDown = this._handleKeyDown.bind(this), this._handleClick = this._handleClick.bind(this);
76
+ this.items = Array.from(e), this.currentIndex = t.initialIndex ?? 0, this.orientation = t.orientation ?? "both", this.wrap = t.wrap ?? !0, this.ignoreModifierKeys = t.ignoreModifierKeys ?? Object.keys(u), this._handleKeyDown = this._handleKeyDown.bind(this), this._handleClick = this._handleClick.bind(this);
72
77
  }
73
78
  activate() {
74
79
  return this.updateTabIndex(), this.items.forEach((e) => {
@@ -96,6 +101,7 @@ var u = class {
96
101
  t !== -1 && (this.currentIndex = t, this.updateTabIndex());
97
102
  }
98
103
  _handleKeyDown(e) {
104
+ if (this.ignoreModifierKeys.some((t) => e[u[t]])) return;
99
105
  let t = this.items.indexOf(e.currentTarget);
100
106
  t !== -1 && t !== this.currentIndex && (this.currentIndex = t, this.updateTabIndex());
101
107
  let n = this.orientation === "horizontal" ? [] : ["ArrowUp", "ArrowDown"], r = this.orientation === "vertical" ? [] : ["ArrowLeft", "ArrowRight"];
@@ -125,7 +131,7 @@ var u = class {
125
131
  }
126
132
  this.setCurrentIndex(a);
127
133
  }
128
- }, d = class {
134
+ }, f = class {
129
135
  constructor(e, t = {}) {
130
136
  this.listbox = e, this.itemSelector = t.itemSelector ?? "[role=\"option\"]:not([aria-disabled=\"true\"]):not([hidden])", this.wrap = t.wrap ?? !1, this.orientation = t.orientation ?? "vertical";
131
137
  }
@@ -177,61 +183,61 @@ var u = class {
177
183
  break;
178
184
  }
179
185
  }
180
- }, ee = (e, t, n) => {
186
+ }, p = (e, t, n) => {
181
187
  let r = document.querySelector(`[data-live-region="${e}"]`);
182
188
  return r || (r = document.createElement("div"), r.className = "sr-only", r.dataset.liveRegion = e, r.setAttribute("aria-live", e), r.setAttribute("aria-atomic", t.toString()), r.setAttribute("aria-relevant", n), document.body.appendChild(r)), r;
183
189
  };
184
- function f(e, t = {}) {
185
- let { politeness: n = "polite", atomic: r = !0, relevant: i = "additions text" } = t, a = ee(n, r, i);
190
+ function m(e, t = {}) {
191
+ let { politeness: n = "polite", atomic: r = !0, relevant: i = "additions text" } = t, a = p(n, r, i);
186
192
  a.textContent = "", setTimeout(() => {
187
193
  a.textContent = e;
188
194
  }, 100);
189
195
  }
190
- var p = (e = "a11y") => `${e}-${Math.random().toString(36).substr(2, 9)}`, m = (e, t = "element") => e.id ||= p(t), h = (e, t, n) => {
196
+ var h = (e = "a11y") => `${e}-${Math.random().toString(36).substr(2, 9)}`, ee = (e, t = "element") => e.id ||= h(t), g = (e, t, n) => {
191
197
  e.setAttribute(t, n.toString());
192
- }, g = (e, t) => h(e, "aria-expanded", t), _ = (e, t) => h(e, "aria-pressed", t), te = (e, t) => h(e, "aria-checked", t), v = (e, t) => t ? e.setAttribute("hidden", "") : e.removeAttribute("hidden");
193
- function ne(e, t) {
194
- h(e, "aria-disabled", t), t ? e.setAttribute("tabindex", "-1") : e.removeAttribute("tabindex");
198
+ }, _ = (e, t) => g(e, "aria-expanded", t), te = (e) => e.getAttribute("aria-expanded") === "true", ne = (e, t) => g(e, "aria-pressed", t), re = (e, t) => g(e, "aria-checked", t), v = (e, t) => g(e, "aria-selected", t), y = (e, t) => t ? e.setAttribute("aria-current", t) : e.removeAttribute("aria-current"), b = (e, t) => t ? e.setAttribute("hidden", "") : e.removeAttribute("hidden"), x = (e, t) => g(e, "aria-hidden", t), S = (e, t) => g(e, "aria-disabled", t), C = (e) => e.getAttribute("aria-disabled") === "true";
199
+ function w(e, t) {
200
+ g(e, "aria-disabled", t), t ? e.setAttribute("tabindex", "-1") : e.removeAttribute("tabindex");
195
201
  }
196
- var y = {
202
+ var T = (e, t) => g(e, "aria-valuemin", t), E = (e, t) => g(e, "aria-valuemax", t), D = (e, t) => t == null ? e.removeAttribute("aria-valuenow") : g(e, "aria-valuenow", t), O = {
197
203
  menu: "menu",
198
204
  listbox: "listbox",
199
205
  tree: "tree",
200
206
  grid: "grid",
201
207
  dialog: "dialog"
202
- }, b = (e, t, n) => {
208
+ }, ie = (e, t, n) => {
203
209
  Object.entries(t).forEach(([t, r]) => {
204
210
  e.setAttribute(t, r), n[t] = r;
205
211
  });
206
- }, x = (e, t, n) => n || !e.hasAttribute(t);
207
- function S({ trigger: e, target: t, role: n = null, override: r = !1 }) {
212
+ }, k = (e, t, n) => n || !e.hasAttribute(t);
213
+ function ae({ trigger: e, target: t, role: n = null, override: r = !1 }) {
208
214
  let i = {
209
215
  trigger: {},
210
216
  target: {}
211
217
  };
212
218
  if (!e || !t) return i;
213
219
  let a = {}, o = {};
214
- if (n && x(t, "role", r) && (o.role = n), t.id && (x(e, "aria-controls", r) && (a["aria-controls"] = t.id), n === "tooltip" && x(e, "aria-describedby", r) && (a["aria-describedby"] = t.id)), n && x(e, "aria-haspopup", r)) {
215
- let e = y[n] || "true";
220
+ if (n && k(t, "role", r) && (o.role = n), t.id && (k(e, "aria-controls", r) && (a["aria-controls"] = t.id), n === "tooltip" && k(e, "aria-describedby", r) && (a["aria-describedby"] = t.id)), n && k(e, "aria-haspopup", r)) {
221
+ let e = O[n] || "true";
216
222
  e && (a["aria-haspopup"] = e);
217
223
  }
218
- return b(t, o, i.target), b(e, a, i.trigger), i;
224
+ return ie(t, o, i.target), ie(e, a, i.trigger), i;
219
225
  }
220
- var C = (e, t) => {
226
+ var oe = (e, t) => {
221
227
  t.forEach((t) => {
222
228
  e.hasAttribute(t) && e.removeAttribute(t);
223
229
  });
224
230
  };
225
- function re({ trigger: e, target: t, attributes: n = null }) {
226
- !e || !t || (C(e, n || [
231
+ function se({ trigger: e, target: t, attributes: n = null }) {
232
+ !e || !t || (oe(e, n || [
227
233
  "aria-controls",
228
234
  "aria-haspopup",
229
235
  "aria-describedby"
230
- ]), (!n || n.includes("role")) && C(t, ["role"]));
236
+ ]), (!n || n.includes("role")) && oe(t, ["role"]));
231
237
  }
232
238
  //#endregion
233
239
  //#region src/requestor.js
234
- var w = class {
240
+ var A = class {
235
241
  constructor() {
236
242
  this._abortController = null, this._timer = null;
237
243
  }
@@ -253,33 +259,33 @@ var w = class {
253
259
  };
254
260
  //#endregion
255
261
  //#region src/researcher.js
256
- function T(e, t) {
262
+ function ce(e, t) {
257
263
  let n = 0;
258
264
  for (let r = 0; r < t.length && n < e.length; r++) t[r] === e[n] && n++;
259
265
  return n === e.length;
260
266
  }
261
- function ie(e, t) {
267
+ function le(e, t) {
262
268
  return t.includes(e);
263
269
  }
264
- function ae(e, t) {
270
+ function ue(e, t) {
265
271
  return t.startsWith(e);
266
272
  }
267
- function oe(e) {
268
- return e === "contains" ? ie : e === "prefix" ? ae : T;
273
+ function de(e) {
274
+ return e === "contains" ? le : e === "prefix" ? ue : ce;
269
275
  }
270
- function se(e, t) {
276
+ function fe(e, t) {
271
277
  return t === "textContent" ? e.textContent?.trim().toLowerCase() ?? "" : (e.getAttribute(t) ?? "").toLowerCase();
272
278
  }
273
- function E(e, t, n = {}) {
274
- let { strategy: r = "fuzzy", matcher: i, fields: a = ["textContent"] } = n, o = typeof i == "function" ? i : oe(r), s = t.toLowerCase(), c = 0;
279
+ function pe(e, t, n = {}) {
280
+ let { strategy: r = "fuzzy", matcher: i, fields: a = ["textContent"] } = n, o = typeof i == "function" ? i : de(r), s = t.toLowerCase(), c = 0;
275
281
  return e.querySelectorAll("[role=\"option\"]").forEach((e) => {
276
- let t = a.some((t) => o(s, se(e, t)));
282
+ let t = a.some((t) => o(s, fe(e, t)));
277
283
  e.hidden = !t, t && c++;
278
284
  }), c;
279
285
  }
280
286
  //#endregion
281
287
  //#region src/plumbers/plumber/geometry.js
282
- var ce = {
288
+ var me = {
283
289
  get top() {
284
290
  return "bottom";
285
291
  },
@@ -293,7 +299,7 @@ var ce = {
293
299
  return "left";
294
300
  }
295
301
  };
296
- function D({ x: e, y: t, width: n, height: r }) {
302
+ function j({ x: e, y: t, width: n, height: r }) {
297
303
  return {
298
304
  x: e,
299
305
  y: t,
@@ -305,46 +311,49 @@ function D({ x: e, y: t, width: n, height: r }) {
305
311
  bottom: t + r
306
312
  };
307
313
  }
308
- function O() {
309
- return D({
314
+ function he(e, t = "vertical") {
315
+ return t === "horizontal" ? e.left + e.width / 2 : e.top + e.height / 2;
316
+ }
317
+ function M() {
318
+ return j({
310
319
  x: 0,
311
320
  y: 0,
312
321
  width: window.innerWidth || document.documentElement.clientWidth,
313
322
  height: window.innerHeight || document.documentElement.clientHeight
314
323
  });
315
324
  }
316
- function le(e) {
325
+ function ge(e) {
317
326
  if (!(e instanceof HTMLElement)) return !1;
318
- let t = O(), n = e.getBoundingClientRect(), r = n.top <= t.height && n.top + n.height > 0, i = n.left <= t.width && n.left + n.width > 0;
327
+ let t = M(), n = e.getBoundingClientRect(), r = n.top <= t.height && n.top + n.height > 0, i = n.left <= t.width && n.left + n.width > 0;
319
328
  return r && i;
320
329
  }
321
330
  //#endregion
322
331
  //#region src/plumbers/plumber/config.js
323
- var k = {
332
+ var N = {
324
333
  get visibleOnly() {
325
334
  return !0;
326
335
  },
327
336
  hiddenClass: null
328
- }, ue = {
337
+ }, _e = {
329
338
  element: null,
330
339
  visible: null,
331
340
  dispatch: !0,
332
341
  prefix: ""
333
- }, A = class {
342
+ }, P = class {
334
343
  constructor(e, t = {}) {
335
344
  this.controller = e;
336
- let { element: n, visible: r, dispatch: i, prefix: a } = Object.assign({}, ue, t);
337
- this.element = n || e.element, this.visibleOnly = typeof r == "boolean" ? r : k.visibleOnly, this.visibleCallback = typeof r == "string" ? r : null, this.notify = !!i, this.prefix = typeof a == "string" && a ? a : e.identifier;
345
+ let { element: n, visible: r, dispatch: i, prefix: a } = Object.assign({}, _e, t);
346
+ this.element = n || e.element, this.visibleOnly = typeof r == "boolean" ? r : N.visibleOnly, this.visibleCallback = typeof r == "string" ? r : null, this.notify = !!i, this.prefix = typeof a == "string" && a ? a : e.identifier;
338
347
  }
339
348
  get visible() {
340
- return this.element instanceof HTMLElement ? this.visibleOnly ? le(this.element) && this.isVisible(this.element) : !0 : !1;
349
+ return this.element instanceof HTMLElement ? !this.visibleOnly || ge(this.element) && this.isVisible(this.element) : !1;
341
350
  }
342
351
  isVisible(e) {
343
352
  if (this.visibleCallback) {
344
353
  let t = this.findCallback(this.visibleCallback);
345
354
  if (typeof t == "function") return t(e);
346
355
  }
347
- return e instanceof HTMLElement ? !e.hasAttribute("hidden") : !1;
356
+ return e instanceof HTMLElement && !e.hasAttribute("hidden");
348
357
  }
349
358
  dispatch(e, { target: t = null, prefix: n = null, detail: r = null } = {}) {
350
359
  if (this.notify) return this.controller.dispatch(e, {
@@ -366,7 +375,7 @@ var k = {
366
375
  return n instanceof Promise ? await n : n;
367
376
  }
368
377
  }
369
- }, de = {
378
+ }, ve = {
370
379
  normalize(e) {
371
380
  return typeof e == "string" ? e : "";
372
381
  },
@@ -376,7 +385,7 @@ var k = {
376
385
  };
377
386
  //#endregion
378
387
  //#region src/plumbers/formatters/credit_card.js
379
- function fe(e) {
388
+ function ye(e) {
380
389
  let t = 0, n = !1;
381
390
  for (let r = e.length - 1; r >= 0; r--) {
382
391
  let i = parseInt(e[r], 10);
@@ -384,32 +393,43 @@ function fe(e) {
384
393
  }
385
394
  return t % 10 == 0;
386
395
  }
387
- var pe = /\D/g, me = /^\d{13,19}$/, he = /(.{4})(?=.)/g, ge = {
396
+ var be = /\D/g, xe = /^\d{13,19}$/, Se = /(.{4})(?=.)/g, Ce = {
388
397
  normalize(e) {
389
- return typeof e == "string" ? e.replace(pe, "") : "";
398
+ return typeof e == "string" ? e.replace(be, "") : "";
390
399
  },
391
400
  validate(e) {
392
- return typeof e != "string" || !me.test(e) ? !1 : fe(e);
401
+ return typeof e != "string" || !xe.test(e) ? !1 : ye(e);
393
402
  },
394
403
  format(e) {
395
- return typeof e == "string" ? e.replace(he, "$1 ") : "";
404
+ return typeof e == "string" ? e.replace(Se, "$1 ") : "";
405
+ },
406
+ cells() {
407
+ return {
408
+ groups: [
409
+ 4,
410
+ 4,
411
+ 4,
412
+ 4
413
+ ],
414
+ length: 0
415
+ };
396
416
  }
397
- }, j = { 1: 10 }, M = /\D/g, _e = /^\+\d{7,15}$/, ve = {
417
+ }, F = { 1: 10 }, I = /\D/g, we = /^\+\d{7,15}$/, Te = {
398
418
  normalize(e) {
399
419
  if (typeof e != "string") return "";
400
- let t = e.trimStart().startsWith("+"), n = e.replace(M, "");
420
+ let t = e.trimStart().startsWith("+"), n = e.replace(I, "");
401
421
  return t ? `+${n}` : n;
402
422
  },
403
423
  validate(e) {
404
424
  if (typeof e != "string") return !1;
405
- if (_e.test(e)) return !0;
406
- let t = e.replace(M, "");
407
- return Object.values(j).includes(t.length);
425
+ if (we.test(e)) return !0;
426
+ let t = e.replace(I, "");
427
+ return Object.values(F).includes(t.length);
408
428
  },
409
429
  format(e) {
410
430
  if (typeof e != "string") return "";
411
- let t = e.replace(M, "");
412
- for (let [e, n] of Object.entries(j)) {
431
+ let t = e.replace(I, "");
432
+ for (let [e, n] of Object.entries(F)) {
413
433
  if (t.length === n) return `(${t.slice(0, 3)}) ${t.slice(3, 6)}-${t.slice(6)}`;
414
434
  let r = n + e.length;
415
435
  if (t.length === r && t.startsWith(e)) {
@@ -419,16 +439,16 @@ var pe = /\D/g, me = /^\d{13,19}$/, he = /(.{4})(?=.)/g, ge = {
419
439
  }
420
440
  return e;
421
441
  }
422
- }, ye = /[^\d.,-]/g, be = /^-?\d+(\.\d+)?$/, xe = {
442
+ }, Ee = /[^\d.,-]/g, De = /^-?\d+(\.\d+)?$/, Oe = {
423
443
  normalize(e) {
424
444
  if (typeof e != "string") return "";
425
- let t = e.replace(ye, "");
445
+ let t = e.replace(Ee, "");
426
446
  if (!t) return "";
427
447
  let n = t.lastIndexOf(","), r = t.lastIndexOf(".");
428
448
  return n > -1 && r > -1 ? n > r ? t.replace(/\./g, "").replace(",", ".") : t.replace(/,/g, "") : n > -1 ? t.slice(n + 1).length <= 2 ? t.replace(",", ".") : t.replace(/,/g, "") : t;
429
449
  },
430
450
  validate(e) {
431
- return typeof e == "string" ? be.test(e) : !1;
451
+ return typeof e == "string" && De.test(e);
432
452
  },
433
453
  format(e, t = {}) {
434
454
  if (typeof e != "string") return "";
@@ -448,18 +468,18 @@ var pe = /\D/g, me = /^\d{13,19}$/, he = /(.{4})(?=.)/g, ge = {
448
468
  return e;
449
469
  }
450
470
  }
451
- }, N = /^\d{4}-\d{2}-\d{2}$/, Se = /^(\d{1,4})[/\-.](\d{1,2})[/\-.](\d{1,4})$/, Ce = /\D/g, P = {
471
+ }, L = /^\d{4}-\d{2}-\d{2}$/, ke = /^(\d{1,4})[/\-.](\d{1,2})[/\-.](\d{1,4})$/, Ae = /\D/g, R = {
452
472
  normalize(e) {
453
473
  if (typeof e != "string") return "";
454
474
  let t = e.trim();
455
- if (N.test(t)) return t;
456
- let n = t.match(Se);
475
+ if (L.test(t)) return t;
476
+ let n = t.match(ke);
457
477
  if (n) {
458
478
  let [, e, t, r] = n;
459
479
  if (e.length === 4) return `${e}-${t.padStart(2, "0")}-${r.padStart(2, "0")}`;
460
480
  if (r.length === 4) return `${r}-${e.padStart(2, "0")}-${t.padStart(2, "0")}`;
461
481
  }
462
- let r = t.replace(Ce, "");
482
+ let r = t.replace(Ae, "");
463
483
  if (r.length === 8) {
464
484
  let e = parseInt(r.slice(0, 4), 10);
465
485
  return e >= 1e3 && e <= 9999 ? `${r.slice(0, 4)}-${r.slice(4, 6)}-${r.slice(6, 8)}` : `${r.slice(4, 8)}-${r.slice(0, 2)}-${r.slice(2, 4)}`;
@@ -468,8 +488,8 @@ var pe = /\D/g, me = /^\d{13,19}$/, he = /(.{4})(?=.)/g, ge = {
468
488
  },
469
489
  validate(e) {
470
490
  if (typeof e != "string") return !1;
471
- let t = P.normalize(e);
472
- if (!N.test(t)) return !1;
491
+ let t = R.normalize(e);
492
+ if (!L.test(t)) return !1;
473
493
  let n = /* @__PURE__ */ new Date(`${t}T00:00:00Z`);
474
494
  return !isNaN(n.getTime()) && n.toISOString().startsWith(t);
475
495
  },
@@ -489,11 +509,11 @@ var pe = /\D/g, me = /^\d{13,19}$/, he = /(.{4})(?=.)/g, ge = {
489
509
  return e;
490
510
  }
491
511
  }
492
- }, we = /^([01]?\d|2[0-3]):([0-5]\d)$/, F = {
512
+ }, je = /^([01]?\d|2[0-3]):([0-5]\d)$/, z = {
493
513
  normalize(e) {
494
514
  if (typeof e != "string") return "";
495
515
  let t = e.trim();
496
- if (we.test(t)) {
516
+ if (je.test(t)) {
497
517
  let [e, n] = t.split(":");
498
518
  return `${String(parseInt(e, 10)).padStart(2, "0")}:${n}`;
499
519
  }
@@ -505,7 +525,7 @@ var pe = /\D/g, me = /^\d{13,19}$/, he = /(.{4})(?=.)/g, ge = {
505
525
  return "";
506
526
  },
507
527
  validate(e) {
508
- return F.normalize(e) !== "";
528
+ return z.normalize(e) !== "";
509
529
  },
510
530
  format(e, t = {}) {
511
531
  if (typeof e != "string") return "";
@@ -516,37 +536,64 @@ var pe = /\D/g, me = /^\d{13,19}$/, he = /(.{4})(?=.)/g, ge = {
516
536
  let a = r < 12 ? "AM" : "PM";
517
537
  return `${r % 12 || 12}:${i} ${a}`;
518
538
  }
519
- }, I = {
539
+ }, B = {
540
+ digits: /[^0-9]/g,
541
+ letters: /[^a-zA-Z]/g,
542
+ alphanumeric: /[^0-9a-zA-Z]/g
543
+ }, Me = {
544
+ normalize(e, t = {}) {
545
+ if (typeof e != "string") return "";
546
+ let n = B[t.charset] ?? B.alphanumeric, r = e.replace(n, "").toUpperCase(), i = t.length ?? 0;
547
+ return i > 0 ? r.slice(0, i) : r;
548
+ },
549
+ validate(e, t = {}) {
550
+ if (typeof e != "string") return !1;
551
+ let n = t.length ?? 0;
552
+ return n > 0 ? e.length === n : !0;
553
+ },
554
+ format(e) {
555
+ return typeof e == "string" ? e : "";
556
+ },
557
+ cells(e = {}) {
558
+ return {
559
+ groups: [],
560
+ length: e.length ?? 0
561
+ };
562
+ }
563
+ }, V = {
520
564
  PLAIN: "plain",
521
565
  CREDIT_CARD: "creditCard",
522
566
  PHONE: "phone",
523
567
  CURRENCY: "currency",
524
568
  DATE: "date",
525
- TIME: "time"
526
- }, L = new Map([
527
- [I.PLAIN, de],
528
- [I.CREDIT_CARD, ge],
529
- [I.PHONE, ve],
530
- [I.CURRENCY, xe],
531
- [I.DATE, P],
532
- [I.TIME, F]
533
- ]), R = {
534
- type: I.PLAIN,
569
+ TIME: "time",
570
+ CODE: "code"
571
+ }, H = /* @__PURE__ */ new Map([
572
+ [V.PLAIN, ve],
573
+ [V.CREDIT_CARD, Ce],
574
+ [V.PHONE, Te],
575
+ [V.CURRENCY, Oe],
576
+ [V.DATE, R],
577
+ [V.TIME, z],
578
+ [V.CODE, Me]
579
+ ]), Ne = {
580
+ type: V.PLAIN,
535
581
  options: {}
536
- }, z = class extends A {
582
+ }, Pe = class extends P {
537
583
  static register(e, t) {
538
- L.set(e, t);
584
+ H.set(e, t);
539
585
  }
540
586
  constructor(e, t = {}) {
541
- super(e, t), this.type = t.type ?? R.type, this.options = t.options ?? R.options, this.enhance();
587
+ super(e, t), this.type = t.type ?? Ne.type, this.options = t.options ?? Ne.options, this.enhance();
542
588
  }
543
589
  enhance() {
544
- let e = this, t = L.get(e.type) ?? L.get(I.PLAIN), n = {
590
+ let e = this, t = H.get(e.type) ?? H.get(V.PLAIN), n = {
545
591
  normalize: (n) => t.normalize?.(n, e.options) ?? (typeof n == "string" ? n : ""),
546
592
  validate: (n) => t.validate?.(n, e.options) ?? !0,
547
593
  format: (n) => t.format?.(n, e.options) ?? (typeof n == "string" ? n : ""),
548
594
  mask: (n) => t.mask?.(n, e.options) ?? null,
549
- maskable: () => typeof t.mask == "function"
595
+ maskable: () => typeof t.mask == "function",
596
+ cells: () => typeof t.cells == "function" ? t.cells(e.options) : null
550
597
  };
551
598
  Object.defineProperty(this.controller, "formatter", {
552
599
  get() {
@@ -555,30 +602,112 @@ var pe = /\D/g, me = /^\d{13,19}$/, he = /(.{4})(?=.)/g, ge = {
555
602
  configurable: !0
556
603
  });
557
604
  }
558
- }, B = (e, t) => new z(e, t), Te = /^\d{4}-\d{2}-\d{2}$/;
559
- function V(e) {
605
+ }, U = (e, t) => new Pe(e, t), Fe = {
606
+ groups: [],
607
+ length: 0
608
+ }, W = (e) => {
609
+ let t = [], n = 0;
610
+ for (let r of e) n += r, t.push(n);
611
+ return t;
612
+ }, Ie = class extends P {
613
+ constructor(e, t = {}) {
614
+ super(e, t), this.groups = Array.isArray(t.groups) ? t.groups : Fe.groups, this.length = t.length ?? Fe.length, this.adopt(), this.enhance();
615
+ }
616
+ get cells() {
617
+ return this.controller.cellTargets ?? [];
618
+ }
619
+ expected() {
620
+ if (this.length > 0) return this.length;
621
+ let e = this.groups.reduce((e, t) => e + t, 0);
622
+ return e > 0 ? e : this.cells.length;
623
+ }
624
+ active() {
625
+ return this.grouped ? this.expected() : Math.min(this.cells.length, this.expected());
626
+ }
627
+ get grouped() {
628
+ return this.groups.length > 0 && this.cells.length === this.groups.length;
629
+ }
630
+ adopt() {
631
+ let e = this.expected();
632
+ this.cells.length < e && console.warn(`[CharacterCells] expected ${e} cells, found ${this.cells.length}`);
633
+ let t = W(this.groups);
634
+ if (this.grouped) {
635
+ this.cells.forEach((n, r) => {
636
+ x(n, !0);
637
+ let i = (r === 0 ? 0 : t[r - 1]) >= e;
638
+ n.toggleAttribute("data-inactive", i), i && (n.textContent = "", n.removeAttribute("data-filled"), n.removeAttribute("data-caret")), n.setAttribute("data-group-index", r), n.removeAttribute("data-group-end");
639
+ });
640
+ return;
641
+ }
642
+ this.cells.forEach((n, r) => {
643
+ x(n, !0);
644
+ let i = r >= e;
645
+ n.toggleAttribute("data-inactive", i), i && (n.textContent = "", n.removeAttribute("data-filled"), n.removeAttribute("data-caret"));
646
+ let a = t.findIndex((e) => r < e);
647
+ a >= 0 ? (n.setAttribute("data-group-index", a), n.toggleAttribute("data-group-end", r === t[a] - 1)) : (n.removeAttribute("data-group-index"), n.removeAttribute("data-group-end"));
648
+ });
649
+ }
650
+ enhance() {
651
+ let e = this, t = {
652
+ draw: (t, n) => e.draw(t, n),
653
+ clear: () => e.draw(""),
654
+ active: () => e.active()
655
+ };
656
+ Object.defineProperty(this.controller, "characterCells", {
657
+ get() {
658
+ return t;
659
+ },
660
+ configurable: !0
661
+ });
662
+ }
663
+ draw(e = "", { focused: t = !1 } = {}) {
664
+ let n = typeof e == "string" ? e : "";
665
+ if (this.grouped) {
666
+ let e = W(this.groups);
667
+ this.cells.forEach((r, i) => {
668
+ let a = i === 0 ? 0 : e[i - 1], o = e[i];
669
+ if (a >= this.expected()) {
670
+ r.textContent = "", r.removeAttribute("data-filled"), r.removeAttribute("data-caret");
671
+ return;
672
+ }
673
+ let s = n.slice(a, o);
674
+ r.textContent = s, r.toggleAttribute("data-filled", s.length > 0), r.toggleAttribute("data-caret", t && n.length >= a && n.length < o);
675
+ });
676
+ return;
677
+ }
678
+ let r = n.split(""), i = this.active();
679
+ this.cells.forEach((e, n) => {
680
+ if (n >= i) {
681
+ e.textContent = "", e.removeAttribute("data-filled"), e.removeAttribute("data-caret");
682
+ return;
683
+ }
684
+ e.textContent = r[n] ?? "", e.toggleAttribute("data-filled", r[n] != null), e.toggleAttribute("data-caret", t && n === r.length);
685
+ });
686
+ }
687
+ }, Le = (e, t) => new Ie(e, t), Re = /^\d{4}-\d{2}-\d{2}$/;
688
+ function G(e) {
560
689
  return e instanceof Date && !isNaN(e);
561
690
  }
562
- function H(...e) {
691
+ function K(...e) {
563
692
  if (e.length === 0) throw "Missing values to parse as date";
564
693
  if (e.length === 1) {
565
694
  let t = e[0];
566
695
  if (!t) return;
567
- if (typeof t == "string" && Te.test(t)) {
696
+ if (typeof t == "string" && Re.test(t)) {
568
697
  let [e, n, r] = t.split("-").map(Number), i = new Date(e, n - 1, r);
569
- if (V(i)) return i;
698
+ if (G(i)) return i;
570
699
  } else {
571
700
  let e = new Date(t);
572
- if (V(e)) return e;
701
+ if (G(e)) return e;
573
702
  }
574
703
  } else {
575
704
  let t = new Date(...e);
576
- if (V(t)) return t;
705
+ if (G(t)) return t;
577
706
  }
578
707
  }
579
708
  //#endregion
580
709
  //#region src/plumbers/calendar.js
581
- var U = 7, Ee = 12, W = 10, G = {
710
+ var ze = 7, Be = 12, q = 10, Ve = {
582
711
  locales: ["default"],
583
712
  today: "",
584
713
  day: null,
@@ -593,15 +722,15 @@ var U = 7, Ee = 12, W = 10, G = {
593
722
  disabledYears: [],
594
723
  firstDayOfWeek: 0,
595
724
  onNavigated: "navigated"
596
- }, De = class extends A {
725
+ }, He = class extends P {
597
726
  constructor(e, t = {}) {
598
727
  super(e, t);
599
- let n = Object.assign({}, G, t), { onNavigated: r, since: i, till: a, firstDayOfWeek: o } = n;
600
- this.onNavigated = r, this.since = H(i), this.till = H(a), this.firstDayOfWeek = 0 <= o && o < 7 ? o : G.firstDayOfWeek;
728
+ let n = Object.assign({}, Ve, t), { onNavigated: r, since: i, till: a, firstDayOfWeek: o } = n;
729
+ this.onNavigated = r, this.since = K(i), this.till = K(a), this.firstDayOfWeek = 0 <= o && o < 7 ? o : Ve.firstDayOfWeek;
601
730
  let { disabledDates: s, disabledWeekdays: c, disabledDays: l, disabledMonths: u, disabledYears: d } = n;
602
731
  this.disabledDates = Array.isArray(s) ? s : [], this.disabledWeekdays = Array.isArray(c) ? c : [], this.disabledDays = Array.isArray(l) ? l : [], this.disabledMonths = Array.isArray(u) ? u : [], this.disabledYears = Array.isArray(d) ? d : [];
603
- let { today: ee, day: f, month: p, year: m } = n;
604
- this.now = H(ee) || /* @__PURE__ */ new Date(), typeof m == "number" && typeof p == "number" && typeof f == "number" ? this.current = H(m, p, f) : this.current = this.now, this.build(), this.enhance();
732
+ let { today: f, day: p, month: m, year: h } = n;
733
+ this.now = K(f) || /* @__PURE__ */ new Date(), typeof h == "number" && typeof m == "number" && typeof p == "number" ? this.current = K(h, m, p) : this.current = this.now, this.build(), this.enhance();
605
734
  }
606
735
  build() {
607
736
  this.daysOfWeek = this.buildDaysOfWeek(), this.daysOfMonth = this.buildDaysOfMonth(), this.monthsOfYear = this.buildMonthsOfYear(), this.yearsOfDecade = this.buildYearsOfDecade();
@@ -637,7 +766,7 @@ var U = 7, Ee = 12, W = 10, G = {
637
766
  let a = new Date(t, e, i);
638
767
  n.push(r(a));
639
768
  }
640
- let s = n.length % U, c = s === 0 ? 0 : U - s;
769
+ let s = n.length % ze, c = s === 0 ? 0 : ze - s;
641
770
  for (let i = 1; i <= c; i++) {
642
771
  let a = new Date(t, e + 1, i);
643
772
  n.push(r(a));
@@ -646,7 +775,7 @@ var U = 7, Ee = 12, W = 10, G = {
646
775
  }
647
776
  buildMonthsOfYear() {
648
777
  let e = new Intl.DateTimeFormat(this.localesValue, { month: "long" }), t = new Intl.DateTimeFormat(this.localesValue, { month: "short" }), n = new Intl.DateTimeFormat(this.localesValue, { month: "numeric" }), r = [];
649
- for (let i = 0; i < Ee; i++) {
778
+ for (let i = 0; i < Be; i++) {
650
779
  let a = new Date(this.year, i), o = new Date(this.year, i, 1), s = new Date(this.year, i + 1, 0), c = t.format(a), l = e.format(a), u = this.since && s < this.since || this.till && o > this.till, d = this.disabledMonths.some((e) => i == e || c === e || l === e);
651
780
  r.push({
652
781
  date: a,
@@ -660,9 +789,9 @@ var U = 7, Ee = 12, W = 10, G = {
660
789
  return r;
661
790
  }
662
791
  buildYearsOfDecade() {
663
- let e = Math.floor(this.year / W) * W, t = [];
664
- for (let n = e - 1; n <= e + W; n++) {
665
- let r = n < e || n > e + W - 1, i = this.since && n < this.since.getFullYear() || this.till && n > this.till.getFullYear(), a = this.disabledYears.some((e) => n == e);
792
+ let e = Math.floor(this.year / q) * q, t = [];
793
+ for (let n = e - 1; n <= e + q; n++) {
794
+ let r = n < e || n > e + q - 1, i = this.since && n < this.since.getFullYear() || this.till && n > this.till.getFullYear(), a = this.disabledYears.some((e) => n == e);
666
795
  t.push({
667
796
  value: n,
668
797
  current: n === this.year,
@@ -675,18 +804,18 @@ var U = 7, Ee = 12, W = 10, G = {
675
804
  return this.now;
676
805
  }
677
806
  set today(e) {
678
- if (!V(e)) return;
807
+ if (!G(e)) return;
679
808
  let t = this.month ?? e.getMonth(), n = this.year ?? e.getFullYear(), r = t == e.getMonth() && n == e.getFullYear() ? e.getDate() : 1;
680
809
  this.now = new Date(n, t, r);
681
810
  }
682
811
  get current() {
683
- return typeof this.year == "number" && typeof this.month == "number" && typeof this.day == "number" ? H(this.year, this.month, this.day) : null;
812
+ return typeof this.year == "number" && typeof this.month == "number" && typeof this.day == "number" ? K(this.year, this.month, this.day) : null;
684
813
  }
685
814
  set current(e) {
686
- V(e) && (this.day = e.getDate(), this.month = e.getMonth(), this.year = e.getFullYear());
815
+ G(e) && (this.day = e.getDate(), this.month = e.getMonth(), this.year = e.getFullYear());
687
816
  }
688
817
  navigate = async (e) => {
689
- if (!V(e)) return;
818
+ if (!G(e)) return;
690
819
  let t = this.current, n = e.toISOString(), r = t.toISOString();
691
820
  this.dispatch("navigate", { detail: {
692
821
  from: r,
@@ -717,7 +846,7 @@ var U = 7, Ee = 12, W = 10, G = {
717
846
  await this.navigate(n);
718
847
  };
719
848
  isDisabled = (e) => {
720
- if (!V(e)) return !1;
849
+ if (!G(e)) return !1;
721
850
  if (this.disabledDates.length) {
722
851
  let t = e.getTime();
723
852
  for (let e of this.disabledDates) if (t === new Date(e).getTime()) return !0;
@@ -747,7 +876,7 @@ var U = 7, Ee = 12, W = 10, G = {
747
876
  return !1;
748
877
  };
749
878
  isWithinRange = (e) => {
750
- if (!V(e)) return !1;
879
+ if (!G(e)) return !1;
751
880
  let t = !0;
752
881
  return this.since && (t &&= e >= this.since), this.till && (t &&= e <= this.till), t;
753
882
  };
@@ -813,7 +942,7 @@ var U = 7, Ee = 12, W = 10, G = {
813
942
  };
814
943
  } });
815
944
  }
816
- }, K = (e, t) => new De(e, t), Oe = class extends A {
945
+ }, J = (e, t) => new He(e, t), Ue = class extends P {
817
946
  constructor(e, t = {}) {
818
947
  super(e, t), this.handle = this.handle.bind(this), this.onSelect = t.onSelect || null;
819
948
  }
@@ -830,7 +959,7 @@ var U = 7, Ee = 12, W = 10, G = {
830
959
  if (t.disabled || t.getAttribute("aria-disabled") === "true") return;
831
960
  let n = e.target instanceof HTMLTimeElement ? e.target : e.target.querySelector("time");
832
961
  if (!n) return;
833
- let r = H(n.dateTime);
962
+ let r = K(n.dateTime);
834
963
  if (!r) return;
835
964
  this.dispatch("selecting", { target: t });
836
965
  let i = r.toISOString();
@@ -839,7 +968,7 @@ var U = 7, Ee = 12, W = 10, G = {
839
968
  iso: i
840
969
  } });
841
970
  }
842
- }, ke = class extends A {
971
+ }, We = class extends P {
843
972
  constructor(e, t = {}) {
844
973
  super(e, t), this.handle = this.handle.bind(this);
845
974
  }
@@ -856,7 +985,7 @@ var U = 7, Ee = 12, W = 10, G = {
856
985
  let n = parseInt(t.dataset.month, 10);
857
986
  isNaN(n) || this.dispatch("selected", { detail: { month: n } });
858
987
  }
859
- }, Ae = class extends A {
988
+ }, Ge = class extends P {
860
989
  constructor(e, t = {}) {
861
990
  super(e, t), this.handle = this.handle.bind(this);
862
991
  }
@@ -873,27 +1002,27 @@ var U = 7, Ee = 12, W = 10, G = {
873
1002
  let n = parseInt(t.dataset.year, 10);
874
1003
  isNaN(n) || this.dispatch("selected", { detail: { year: n } });
875
1004
  }
876
- }, q = (e, t) => new Oe(e, t), J = (e, t) => new ke(e, t), Y = (e, t) => new Ae(e, t), X = {
1005
+ }, Ke = (e, t) => new Ue(e, t), qe = (e, t) => new We(e, t), Je = (e, t) => new Ge(e, t), Y = {
877
1006
  content: null,
878
1007
  url: "",
879
1008
  reload: "never",
880
1009
  stale: 3600,
881
1010
  onLoad: "canLoad",
882
1011
  onLoaded: "contentLoaded"
883
- }, je = class extends A {
1012
+ }, Ye = class extends P {
884
1013
  constructor(e, t = {}) {
885
1014
  super(e, t);
886
- let n = Object.assign({}, X, t), { content: r, url: i, reload: a, stale: o } = n;
887
- this.content = r, this.url = i, this.reload = typeof a == "string" ? a : X.reload, this.stale = typeof o == "number" ? o : X.stale;
1015
+ let n = Object.assign({}, Y, t), { content: r, url: i, reload: a, stale: o } = n;
1016
+ this.content = r, this.url = i, this.reload = typeof a == "string" ? a : Y.reload, this.stale = typeof o == "number" ? o : Y.stale;
888
1017
  let { onLoad: s, onLoaded: c } = n;
889
- this.onLoad = s, this.onLoaded = c, this._requestor = new w(), this.enhance();
1018
+ this.onLoad = s, this.onLoaded = c, this._requestor = new A(), this.enhance();
890
1019
  }
891
1020
  get reloadable() {
892
1021
  switch (this.reload) {
893
1022
  case "never": return !1;
894
1023
  case "always": return !0;
895
1024
  default: {
896
- let e = H(this.loadedAt);
1025
+ let e = K(this.loadedAt);
897
1026
  return e && /* @__PURE__ */ new Date() - e > this.stale * 1e3;
898
1027
  }
899
1028
  }
@@ -919,7 +1048,7 @@ var U = 7, Ee = 12, W = 10, G = {
919
1048
  let e = this;
920
1049
  Object.assign(this.controller, { load: e.load.bind(e) });
921
1050
  }
922
- }, Me = (e, t) => new je(e, t), Z = class extends A {
1051
+ }, Xe = (e, t) => new Ye(e, t), X = class extends P {
923
1052
  observe(e) {
924
1053
  this._handler = e, this.events.forEach((t) => window.addEventListener(t, e, !0));
925
1054
  }
@@ -932,21 +1061,21 @@ var U = 7, Ee = 12, W = 10, G = {
932
1061
  e.unobserve(), t();
933
1062
  };
934
1063
  }
935
- }, Ne = {
1064
+ }, Ze = {
936
1065
  trigger: null,
937
1066
  events: ["click"],
938
1067
  onDismissed: "dismissed"
939
- }, Pe = class extends Z {
1068
+ }, Qe = class extends X {
940
1069
  constructor(e, t = {}) {
941
1070
  super(e, t);
942
- let { trigger: n, events: r, onDismissed: i } = Object.assign({}, Ne, t);
1071
+ let { trigger: n, events: r, onDismissed: i } = Object.assign({}, Ze, t);
943
1072
  this.onDismissed = i, this.trigger = n || this.element, this.events = r, this.enhance(), this.observe(this.dismiss);
944
1073
  }
945
1074
  dismiss = async (e) => {
946
1075
  let { target: t } = e;
947
1076
  t instanceof HTMLElement && (this.element.contains(t) || this.visible && (this.dispatch("dismiss"), await this.awaitCallback(this.onDismissed, { target: this.trigger }), this.dispatch("dismissed")));
948
1077
  };
949
- }, Q = (e, t) => new Pe(e, t), Fe = {
1078
+ }, Z = (e, t) => new Qe(e, t), $e = {
950
1079
  anchor: null,
951
1080
  events: ["click"],
952
1081
  placement: "bottom",
@@ -954,11 +1083,11 @@ var U = 7, Ee = 12, W = 10, G = {
954
1083
  onFlipped: "flipped",
955
1084
  ariaRole: null,
956
1085
  respectMotion: !0
957
- }, Ie = class extends Z {
1086
+ }, et = class extends X {
958
1087
  constructor(e, t = {}) {
959
1088
  super(e, t);
960
- let { anchor: n, events: r, placement: i, alignment: a, onFlipped: o, ariaRole: s, respectMotion: c } = Object.assign({}, Fe, t);
961
- this.anchor = n, this.events = r, this.placement = i, this.alignment = a, this.onFlipped = o, this.ariaRole = s, this.respectMotion = c, this.prefersReducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches, this.anchor && this.element && S({
1089
+ let { anchor: n, events: r, placement: i, alignment: a, onFlipped: o, ariaRole: s, respectMotion: c } = Object.assign({}, $e, t);
1090
+ this.anchor = n, this.events = r, this.placement = i, this.alignment = a, this.onFlipped = o, this.ariaRole = s, this.respectMotion = c, this.prefersReducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches, this.anchor && this.element && ae({
962
1091
  trigger: this.anchor,
963
1092
  target: this.element,
964
1093
  role: this.ariaRole
@@ -976,7 +1105,7 @@ var U = 7, Ee = 12, W = 10, G = {
976
1105
  }), this.dispatch("flipped", { detail: { placement: e } });
977
1106
  };
978
1107
  flippedRect(e, t) {
979
- let n = this.quadrumRect(e, O()), r = [this.placement, ce[this.placement]], i = {};
1108
+ let n = this.quadrumRect(e, M()), r = [this.placement, me[this.placement]], i = {};
980
1109
  for (; !Object.keys(i).length && r.length > 0;) {
981
1110
  let a = r.shift();
982
1111
  if (!this.biggerRectThan(n[a], t)) continue;
@@ -987,25 +1116,25 @@ var U = 7, Ee = 12, W = 10, G = {
987
1116
  }
988
1117
  quadrumRect(e, t) {
989
1118
  return {
990
- left: D({
1119
+ left: j({
991
1120
  x: t.x,
992
1121
  y: t.y,
993
1122
  width: e.x - t.x,
994
1123
  height: t.height
995
1124
  }),
996
- right: D({
1125
+ right: j({
997
1126
  x: e.x + e.width,
998
1127
  y: t.y,
999
1128
  width: t.width - (e.x + e.width),
1000
1129
  height: t.height
1001
1130
  }),
1002
- top: D({
1131
+ top: j({
1003
1132
  x: t.x,
1004
1133
  y: t.y,
1005
1134
  width: t.width,
1006
1135
  height: e.y - t.y
1007
1136
  }),
1008
- bottom: D({
1137
+ bottom: j({
1009
1138
  x: t.x,
1010
1139
  y: e.y + e.height,
1011
1140
  width: t.width,
@@ -1015,25 +1144,25 @@ var U = 7, Ee = 12, W = 10, G = {
1015
1144
  }
1016
1145
  quadrumPlacement(e, t, n) {
1017
1146
  switch (t) {
1018
- case "top": return D({
1147
+ case "top": return j({
1019
1148
  x: n.x,
1020
1149
  y: e.y - n.height,
1021
1150
  width: n.width,
1022
1151
  height: n.height
1023
1152
  });
1024
- case "bottom": return D({
1153
+ case "bottom": return j({
1025
1154
  x: n.x,
1026
1155
  y: e.y + e.height,
1027
1156
  width: n.width,
1028
1157
  height: n.height
1029
1158
  });
1030
- case "left": return D({
1159
+ case "left": return j({
1031
1160
  x: e.x - n.width,
1032
1161
  y: n.y,
1033
1162
  width: n.width,
1034
1163
  height: n.height
1035
1164
  });
1036
- case "right": return D({
1165
+ case "right": return j({
1037
1166
  x: e.x + e.width,
1038
1167
  y: n.y,
1039
1168
  width: n.width,
@@ -1047,7 +1176,7 @@ var U = 7, Ee = 12, W = 10, G = {
1047
1176
  case "top":
1048
1177
  case "bottom": {
1049
1178
  let t = e.x;
1050
- return this.alignment === "center" ? t = e.x + e.width / 2 - n.width / 2 : this.alignment === "end" && (t = e.x + e.width - n.width), D({
1179
+ return this.alignment === "center" ? t = e.x + e.width / 2 - n.width / 2 : this.alignment === "end" && (t = e.x + e.width - n.width), j({
1051
1180
  x: t,
1052
1181
  y: n.y,
1053
1182
  width: n.width,
@@ -1057,7 +1186,7 @@ var U = 7, Ee = 12, W = 10, G = {
1057
1186
  case "left":
1058
1187
  case "right": {
1059
1188
  let t = e.y;
1060
- return this.alignment === "center" ? t = e.y + e.height / 2 - n.height / 2 : this.alignment === "end" && (t = e.y + e.height - n.height), D({
1189
+ return this.alignment === "center" ? t = e.y + e.height / 2 - n.height / 2 : this.alignment === "end" && (t = e.y + e.height - n.height), j({
1061
1190
  x: n.x,
1062
1191
  y: t,
1063
1192
  width: n.width,
@@ -1073,7 +1202,83 @@ var U = 7, Ee = 12, W = 10, G = {
1073
1202
  enhance() {
1074
1203
  super.enhance(), this.controller.flip = this.flip;
1075
1204
  }
1076
- }, Le = (e, t) => new Ie(e, t), Re = {
1205
+ }, tt = (e, t) => new et(e, t), nt = {
1206
+ moveKey: "Alt",
1207
+ onMoved: null,
1208
+ orientation: "vertical"
1209
+ }, rt = {
1210
+ vertical: {
1211
+ back: "ArrowUp",
1212
+ forward: "ArrowDown"
1213
+ },
1214
+ horizontal: {
1215
+ back: "ArrowLeft",
1216
+ forward: "ArrowRight"
1217
+ }
1218
+ }, it = class extends P {
1219
+ constructor(e, t = {}) {
1220
+ super(e, t);
1221
+ let { moveKey: n, onMoved: r, orientation: i } = Object.assign({}, nt, t);
1222
+ this.moveKey = u[n] ? n : nt.moveKey, this.onMoved = r, this.orientation = i, this.draggingItem = null, this.onKeydown = this.onKeydown.bind(this);
1223
+ }
1224
+ get items() {
1225
+ return this.controller.itemTargets;
1226
+ }
1227
+ attachItem(e) {
1228
+ e.addEventListener("keydown", this.onKeydown);
1229
+ }
1230
+ detachItem(e) {
1231
+ e.removeEventListener("keydown", this.onKeydown);
1232
+ }
1233
+ attachItems(e) {
1234
+ e.forEach((e) => this.attachItem(e));
1235
+ }
1236
+ detachItems(e) {
1237
+ e.forEach((e) => this.detachItem(e));
1238
+ }
1239
+ resolveMoveKeys(e) {
1240
+ let { back: t, forward: n } = rt[this.orientation];
1241
+ return this.orientation === "horizontal" && getComputedStyle(e).direction === "rtl" ? {
1242
+ back: n,
1243
+ forward: t
1244
+ } : {
1245
+ back: t,
1246
+ forward: n
1247
+ };
1248
+ }
1249
+ onKeydown(e) {
1250
+ if (!this.controller.editingValue || e.repeat) return;
1251
+ let t = e.currentTarget, { back: n, forward: r } = this.resolveMoveKeys(t);
1252
+ if (e.key !== n && e.key !== r || !e[u[this.moveKey]]) return;
1253
+ let i = this.items, a = i.indexOf(t), o = e.key === n ? a - 1 : a + 1;
1254
+ o < 0 || o >= i.length || (e.preventDefault(), e.key === n ? i[o].before(t) : i[o].after(t), this.dispatch("reordered", { detail: { itemIds: this.orderedIds() } }), this.awaitCallback(this.onMoved, t), m(`Moved to position ${this.items.indexOf(t) + 1} of ${this.items.length}`));
1255
+ }
1256
+ orderedIds() {
1257
+ return this.items.filter((e) => e.id).map((e) => e.id);
1258
+ }
1259
+ startDrag(e, t, n) {
1260
+ this.draggingItem = e, t.setPointerCapture(n);
1261
+ }
1262
+ drag(e) {
1263
+ if (!this.draggingItem) return;
1264
+ let t = this.orientation === "horizontal" ? e.clientX : e.clientY, n = this.items, r = n.indexOf(this.draggingItem), i = n[r - 1];
1265
+ if (i && t < this.midpointOf(i)) {
1266
+ i.before(this.draggingItem);
1267
+ return;
1268
+ }
1269
+ let a = n[r + 1];
1270
+ a && t > this.midpointOf(a) && a.after(this.draggingItem);
1271
+ }
1272
+ endDrag(e, t) {
1273
+ if (!this.draggingItem) return null;
1274
+ e.releasePointerCapture(t);
1275
+ let n = this.draggingItem;
1276
+ return this.draggingItem = null, this.dispatch("reordered", { detail: { itemIds: this.orderedIds() } }), n;
1277
+ }
1278
+ midpointOf(e) {
1279
+ return he(e.getBoundingClientRect(), this.orientation);
1280
+ }
1281
+ }, at = (e, t) => new it(e, t), ot = {
1077
1282
  events: ["resize"],
1078
1283
  boundaries: [
1079
1284
  "top",
@@ -1082,10 +1287,10 @@ var U = 7, Ee = 12, W = 10, G = {
1082
1287
  ],
1083
1288
  onShifted: "shifted",
1084
1289
  respectMotion: !0
1085
- }, ze = class extends Z {
1290
+ }, st = class extends X {
1086
1291
  constructor(e, t = {}) {
1087
1292
  super(e, t);
1088
- let { onShifted: n, events: r, boundaries: i, respectMotion: a } = Object.assign({}, Re, t);
1293
+ let { onShifted: n, events: r, boundaries: i, respectMotion: a } = Object.assign({}, ot, t);
1089
1294
  this.onShifted = n, this.events = r, this.boundaries = i, this.respectMotion = a, this.prefersReducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches, this.enhance(), this.observe(this.shift);
1090
1295
  }
1091
1296
  shift = async () => {
@@ -1095,14 +1300,14 @@ var U = 7, Ee = 12, W = 10, G = {
1095
1300
  this.element.style.transition = this.respectMotion && this.prefersReducedMotion ? "none" : "", this.element.style.transform = `translate(${t}px, ${n}px)`, await this.awaitCallback(this.onShifted, e), this.dispatch("shifted", { detail: e });
1096
1301
  };
1097
1302
  overflowRect(e, t) {
1098
- let n = {}, r = O(), i = D({
1303
+ let n = {}, r = M(), i = j({
1099
1304
  x: e.x - t.x,
1100
1305
  y: e.y - t.y,
1101
1306
  width: e.width,
1102
1307
  height: e.height
1103
1308
  });
1104
1309
  for (let e of this.boundaries) {
1105
- let t = this.directionDistance(i, e, r), a = ce[e];
1310
+ let t = this.directionDistance(i, e, r), a = me[e];
1106
1311
  t < 0 ? i[a] + t >= r[a] && !n[a] && (n[e] = t) : n[e] = "";
1107
1312
  }
1108
1313
  return n;
@@ -1134,27 +1339,27 @@ var U = 7, Ee = 12, W = 10, G = {
1134
1339
  enhance() {
1135
1340
  super.enhance(), this.controller.shift = this.shift;
1136
1341
  }
1137
- }, Be = (e, t) => new ze(e, t), Ve = {
1342
+ }, ct = (e, t) => new st(e, t), lt = {
1138
1343
  visibility: "visibility",
1139
1344
  onShown: "shown",
1140
1345
  onHidden: "hidden"
1141
- }, He = class extends A {
1346
+ }, ut = class extends P {
1142
1347
  constructor(e, t = {}) {
1143
- let { visibility: n, onShown: r, onHidden: i, activator: a } = Object.assign({}, Ve, t), o = typeof n == "string" ? n : Ve.namespace, s = typeof t.visible == "string" ? t.visible : "isVisible";
1348
+ let { visibility: n, onShown: r, onHidden: i, activator: a } = Object.assign({}, lt, t), o = typeof n == "string" ? n : lt.namespace, s = typeof t.visible == "string" ? t.visible : "isVisible";
1144
1349
  (typeof t.visible != "boolean" || t.visible) && (t.visible = `${o}.${s}`), super(e, t), this.visibility = o, this.visibilityResolver = s, this.onShown = r, this.onHidden = i, this.activator = a instanceof HTMLElement ? a : null, this.enhance(), this.element instanceof HTMLElement && this.activate(this.isVisible(this.element));
1145
1350
  }
1146
1351
  isVisible(e) {
1147
1352
  if (!(e instanceof HTMLElement)) return !1;
1148
- let t = k.hiddenClass;
1353
+ let t = N.hiddenClass;
1149
1354
  return t ? !e.classList.contains(t) : !e.hasAttribute("hidden");
1150
1355
  }
1151
1356
  toggle(e, t) {
1152
1357
  if (!(e instanceof HTMLElement)) return;
1153
- let n = k.hiddenClass;
1154
- n ? t ? e.classList.remove(n) : e.classList.add(n) : v(e, !t);
1358
+ let n = N.hiddenClass;
1359
+ n ? t ? e.classList.remove(n) : e.classList.add(n) : b(e, !t);
1155
1360
  }
1156
1361
  activate(e) {
1157
- this.activator && g(this.activator, e);
1362
+ this.activator && _(this.activator, e);
1158
1363
  }
1159
1364
  async show() {
1160
1365
  !(this.element instanceof HTMLElement) || this.isVisible(this.element) || (this.dispatch("show"), this.toggle(this.element, !0), this.activate(!0), await this.awaitCallback(this.onShown, { target: this.element }), this.dispatch("shown"));
@@ -1173,7 +1378,7 @@ var U = 7, Ee = 12, W = 10, G = {
1173
1378
  return t;
1174
1379
  } });
1175
1380
  }
1176
- }, Ue = (e, t) => new He(e, t), We = 4, Ge = class extends e {
1381
+ }, Q = (e, t) => new ut(e, t), dt = 4, ft = class extends e {
1177
1382
  static targets = ["grid"];
1178
1383
  static values = {
1179
1384
  current: Number,
@@ -1195,7 +1400,7 @@ var U = 7, Ee = 12, W = 10, G = {
1195
1400
  }
1196
1401
  };
1197
1402
  initialize() {
1198
- this.selector = Y(this), K(this, {
1403
+ this.selector = Je(this), J(this, {
1199
1404
  today: this.todayValue,
1200
1405
  year: this.currentValue || void 0,
1201
1406
  since: this.sinceValue || null,
@@ -1213,10 +1418,9 @@ var U = 7, Ee = 12, W = 10, G = {
1213
1418
  }
1214
1419
  selectedValueChanged() {
1215
1420
  if (!this.hasGridTarget) return;
1216
- let e = H(this.selectedValue), t = e ? e.getFullYear() : null;
1421
+ let e = K(this.selectedValue), t = e ? e.getFullYear() : null;
1217
1422
  this.gridTarget.querySelectorAll("button[data-year]").forEach((e) => {
1218
- let n = parseInt(e.dataset.year, 10);
1219
- e.setAttribute("aria-selected", n === t ? "true" : "false");
1423
+ v(e, parseInt(e.dataset.year, 10) === t);
1220
1424
  });
1221
1425
  }
1222
1426
  navigate(e) {
@@ -1233,24 +1437,24 @@ var U = 7, Ee = 12, W = 10, G = {
1233
1437
  }
1234
1438
  drawGrid() {
1235
1439
  if (!this.hasGridTarget) return;
1236
- let { yearsOfDecade: e } = this.calendar, t = this.calendar.today.getFullYear(), n = H(this.selectedValue), r = n ? n.getFullYear() : null, i = [];
1440
+ let { yearsOfDecade: e } = this.calendar, t = this.calendar.today.getFullYear(), n = K(this.selectedValue), r = n ? n.getFullYear() : null, i = [];
1237
1441
  for (let n of e) {
1238
1442
  let e = document.createElement("button");
1239
- e.type = "button", e.textContent = n.value, e.dataset.year = n.value, e.setAttribute("role", "gridcell"), e.setAttribute("aria-selected", n.value === r ? "true" : "false"), n.value === t && e.setAttribute("aria-current", "year"), n.disabled && e.setAttribute("aria-disabled", "true"), i.push(e);
1443
+ e.type = "button", e.textContent = n.value, e.dataset.year = n.value, e.setAttribute("role", "gridcell"), v(e, n.value === r), n.value === t && y(e, "year"), n.disabled && S(e, !0), i.push(e);
1240
1444
  }
1241
1445
  let a = document.createElement("div");
1242
1446
  a.setAttribute("role", "rowgroup");
1243
- for (let e = 0; e < i.length; e += We) {
1447
+ for (let e = 0; e < i.length; e += dt) {
1244
1448
  let t = document.createElement("div");
1245
1449
  t.setAttribute("role", "row");
1246
- for (let n of i.slice(e, e + We)) t.appendChild(n);
1450
+ for (let n of i.slice(e, e + dt)) t.appendChild(n);
1247
1451
  a.appendChild(t);
1248
1452
  }
1249
1453
  this.gridTarget.replaceChildren(a);
1250
1454
  }
1251
- }, Ke = class extends e {
1455
+ }, pt = class extends e {
1252
1456
  initialize() {
1253
- this.selector = Y(this);
1457
+ this.selector = Je(this);
1254
1458
  }
1255
1459
  connect() {
1256
1460
  this.selector.attach();
@@ -1258,7 +1462,7 @@ var U = 7, Ee = 12, W = 10, G = {
1258
1462
  disconnect() {
1259
1463
  this.selector.detach();
1260
1464
  }
1261
- }, qe = class extends e {
1465
+ }, mt = class extends e {
1262
1466
  static targets = ["daysOfWeek", "daysOfMonth"];
1263
1467
  static classes = [
1264
1468
  "dayOfWeek",
@@ -1303,7 +1507,7 @@ var U = 7, Ee = 12, W = 10, G = {
1303
1507
  }
1304
1508
  };
1305
1509
  initialize() {
1306
- this.selector = q(this, { onSelect: "select" }), K(this, {
1510
+ this.selector = Ke(this, { onSelect: "select" }), J(this, {
1307
1511
  today: this.todayValue,
1308
1512
  since: this.sinceValue || null,
1309
1513
  till: this.tillValue || null
@@ -1328,12 +1532,15 @@ var U = 7, Ee = 12, W = 10, G = {
1328
1532
  }
1329
1533
  selectedValueChanged() {
1330
1534
  if (!this.hasDaysOfMonthTarget || (this.daysOfMonthTarget.querySelectorAll("[aria-selected]").forEach((e) => {
1331
- e.setAttribute("aria-selected", "false");
1535
+ v(e, !1);
1332
1536
  }), !this.selectedValue)) return;
1333
- let e = H(this.selectedValue);
1537
+ let e = K(this.selectedValue);
1334
1538
  if (!e) return;
1335
1539
  let t = this.daysOfMonthTarget.querySelector(`time[datetime="${e.toISOString()}"]`);
1336
- t && t.closest("[aria-selected]")?.setAttribute("aria-selected", "true");
1540
+ if (t) {
1541
+ let e = t.closest("[aria-selected]");
1542
+ e && v(e, !0);
1543
+ }
1337
1544
  }
1338
1545
  navigate(e) {
1339
1546
  this.yearValue = e.getFullYear(), this.monthValue = e.getMonth();
@@ -1342,7 +1549,7 @@ var U = 7, Ee = 12, W = 10, G = {
1342
1549
  return this.calendar.step(e, t);
1343
1550
  }
1344
1551
  select(e) {
1345
- let t = H(e);
1552
+ let t = K(e);
1346
1553
  t && (this.selectedValue = e, (t.getMonth() !== this.calendar.month || t.getFullYear() !== this.calendar.year) && this.calendar.navigate(t), this.dispatch("selected", { detail: {
1347
1554
  epoch: t.getTime(),
1348
1555
  iso: e
@@ -1356,7 +1563,7 @@ var U = 7, Ee = 12, W = 10, G = {
1356
1563
  }
1357
1564
  createDayElement(e, { selectable: t = !1, disabled: n = !1 } = {}) {
1358
1565
  let r = document.createElement(t ? "button" : "div");
1359
- return r.tabIndex = -1, e ? r.textContent = e : r.setAttribute("aria-hidden", "true"), n && (r instanceof HTMLButtonElement ? r.disabled = !0 : r.setAttribute("aria-disabled", "true")), r;
1566
+ return r.tabIndex = -1, e ? r.textContent = e : x(r, !0), n && (r instanceof HTMLButtonElement ? r.disabled = !0 : S(r, !0)), r;
1360
1567
  }
1361
1568
  drawDaysOfWeek() {
1362
1569
  if (!this.hasDaysOfWeekTarget) return;
@@ -1376,7 +1583,7 @@ var U = 7, Ee = 12, W = 10, G = {
1376
1583
  selectable: e.current || i,
1377
1584
  disabled: e.current ? r : !i
1378
1585
  });
1379
- t === e.date.getTime() && o.setAttribute("aria-current", "date"), (e.current || this.daysOfOtherMonthValue) && o.setAttribute("aria-selected", ""), !e.current && this.daysOfOtherMonthValue && this.hasDayOfOtherMonthClass ? o.classList.add(...this.dayOfOtherMonthClasses) : this.hasDayOfMonthClass && o.classList.add(...this.dayOfMonthClasses);
1586
+ t === e.date.getTime() && y(o, "date"), (e.current || this.daysOfOtherMonthValue) && o.setAttribute("aria-selected", ""), !e.current && this.daysOfOtherMonthValue && this.hasDayOfOtherMonthClass ? o.classList.add(...this.dayOfOtherMonthClasses) : this.hasDayOfMonthClass && o.classList.add(...this.dayOfMonthClasses);
1380
1587
  let s = document.createElement("time");
1381
1588
  s.dateTime = e.iso, o.appendChild(s), n.push(o);
1382
1589
  }
@@ -1389,9 +1596,9 @@ var U = 7, Ee = 12, W = 10, G = {
1389
1596
  }
1390
1597
  this.daysOfMonthTarget.replaceChildren(...r);
1391
1598
  }
1392
- }, Je = class extends e {
1599
+ }, ht = class extends e {
1393
1600
  initialize() {
1394
- this.selector = q(this);
1601
+ this.selector = Ke(this);
1395
1602
  }
1396
1603
  connect() {
1397
1604
  this.selector.attach();
@@ -1399,7 +1606,7 @@ var U = 7, Ee = 12, W = 10, G = {
1399
1606
  disconnect() {
1400
1607
  this.selector.detach();
1401
1608
  }
1402
- }, Ye = 4, Xe = class extends e {
1609
+ }, gt = 4, _t = class extends e {
1403
1610
  static targets = ["grid"];
1404
1611
  static values = {
1405
1612
  current: Number,
@@ -1429,7 +1636,7 @@ var U = 7, Ee = 12, W = 10, G = {
1429
1636
  }
1430
1637
  };
1431
1638
  initialize() {
1432
- this.selector = J(this), K(this, {
1639
+ this.selector = qe(this), J(this, {
1433
1640
  today: this.todayValue,
1434
1641
  year: this.currentValue || void 0,
1435
1642
  since: this.sinceValue || null,
@@ -1447,10 +1654,10 @@ var U = 7, Ee = 12, W = 10, G = {
1447
1654
  }
1448
1655
  selectedValueChanged() {
1449
1656
  if (!this.hasGridTarget) return;
1450
- let e = H(this.selectedValue);
1657
+ let e = K(this.selectedValue);
1451
1658
  this.gridTarget.querySelectorAll("button[data-month]").forEach((t) => {
1452
1659
  let n = parseInt(t.dataset.month, 10) - 1;
1453
- t.setAttribute("aria-selected", e && e.getMonth() === n ? "true" : "false");
1660
+ v(t, !!e && e.getMonth() === n);
1454
1661
  });
1455
1662
  }
1456
1663
  navigate(e) {
@@ -1467,26 +1674,24 @@ var U = 7, Ee = 12, W = 10, G = {
1467
1674
  }
1468
1675
  drawGrid() {
1469
1676
  if (!this.hasGridTarget) return;
1470
- let { year: e, monthsOfYear: t } = this.calendar, n = this.calendar.today, r = H(this.selectedValue), i = [], a = new Intl.DateTimeFormat(this.localesValue, { month: this.monthFormatValue });
1677
+ let { year: e, monthsOfYear: t } = this.calendar, n = this.calendar.today, r = K(this.selectedValue), i = [], a = new Intl.DateTimeFormat(this.localesValue, { month: this.monthFormatValue });
1471
1678
  for (let o of t) {
1472
1679
  let t = document.createElement("button");
1473
- t.type = "button", t.textContent = a.format(o.date), t.dataset.month = o.value + 1, t.setAttribute("role", "gridcell");
1474
- let s = r && r.getMonth() === o.value;
1475
- t.setAttribute("aria-selected", s ? "true" : "false"), o.value === n.getMonth() && e === n.getFullYear() && t.setAttribute("aria-current", "month"), o.disabled && t.setAttribute("aria-disabled", "true"), i.push(t);
1680
+ t.type = "button", t.textContent = a.format(o.date), t.dataset.month = o.value + 1, t.setAttribute("role", "gridcell"), v(t, !!r && r.getMonth() === o.value), o.value === n.getMonth() && e === n.getFullYear() && y(t, "month"), o.disabled && S(t, !0), i.push(t);
1476
1681
  }
1477
1682
  let o = document.createElement("div");
1478
1683
  o.setAttribute("role", "rowgroup");
1479
- for (let e = 0; e < i.length; e += Ye) {
1684
+ for (let e = 0; e < i.length; e += gt) {
1480
1685
  let t = document.createElement("div");
1481
1686
  t.setAttribute("role", "row");
1482
- for (let n of i.slice(e, e + Ye)) t.appendChild(n);
1687
+ for (let n of i.slice(e, e + gt)) t.appendChild(n);
1483
1688
  o.appendChild(t);
1484
1689
  }
1485
1690
  this.gridTarget.replaceChildren(o);
1486
1691
  }
1487
- }, Ze = class extends e {
1692
+ }, vt = class extends e {
1488
1693
  initialize() {
1489
- this.selector = J(this);
1694
+ this.selector = qe(this);
1490
1695
  }
1491
1696
  connect() {
1492
1697
  this.selector.attach();
@@ -1494,7 +1699,27 @@ var U = 7, Ee = 12, W = 10, G = {
1494
1699
  disconnect() {
1495
1700
  this.selector.detach();
1496
1701
  }
1497
- }, Qe = class extends e {
1702
+ }, yt = class extends e {
1703
+ static targets = ["master", "item"];
1704
+ connect() {
1705
+ this.recompute();
1706
+ }
1707
+ onChange(e) {
1708
+ e.target === this.masterTarget && this.toggleAll(this.masterTarget.checked), this.recompute();
1709
+ }
1710
+ toggleAll(e) {
1711
+ this.enabledItems().forEach((t) => {
1712
+ t.checked = e;
1713
+ });
1714
+ }
1715
+ recompute() {
1716
+ let e = this.enabledItems(), t = e.filter((e) => e.checked).length;
1717
+ this.masterTarget.checked = e.length > 0 && t === e.length, this.masterTarget.indeterminate = t > 0 && t < e.length;
1718
+ }
1719
+ enabledItems() {
1720
+ return this.itemTargets.filter((e) => !e.disabled);
1721
+ }
1722
+ }, bt = class extends e {
1498
1723
  static targets = ["source"];
1499
1724
  static values = { contentType: {
1500
1725
  type: String,
@@ -1528,7 +1753,7 @@ var U = 7, Ee = 12, W = 10, G = {
1528
1753
  "month",
1529
1754
  "year",
1530
1755
  "decade"
1531
- ], $e = class extends e {
1756
+ ], xt = class extends e {
1532
1757
  static targets = [
1533
1758
  "previous",
1534
1759
  "next",
@@ -1570,7 +1795,7 @@ var U = 7, Ee = 12, W = 10, G = {
1570
1795
  }
1571
1796
  async calendarMonthOutletConnected() {
1572
1797
  if (this.dateValue) {
1573
- let e = H(this.dateValue);
1798
+ let e = K(this.dateValue);
1574
1799
  e && await this.calendarMonthOutlet.calendar.navigate(e);
1575
1800
  }
1576
1801
  this.draw();
@@ -1665,7 +1890,7 @@ var U = 7, Ee = 12, W = 10, G = {
1665
1890
  }
1666
1891
  this.hasCalendarYearOutlet && (this.calendarYearOutletElement.hidden = !t), this.hasCalendarDecadeOutlet && (this.calendarDecadeOutletElement.hidden = !n);
1667
1892
  }
1668
- }, et = class extends e {
1893
+ }, St = class extends e {
1669
1894
  static targets = [
1670
1895
  "listbox",
1671
1896
  "loading",
@@ -1686,23 +1911,23 @@ var U = 7, Ee = 12, W = 10, G = {
1686
1911
  }
1687
1912
  };
1688
1913
  initialize() {
1689
- this._requestor = new w();
1914
+ this._requestor = new A();
1690
1915
  }
1691
1916
  connect() {
1692
- this.hasListboxTarget && (this.listboxNav = new d(this.listboxTarget));
1917
+ this.hasListboxTarget && (this.listboxNav = new f(this.listboxTarget));
1693
1918
  }
1694
1919
  disconnect() {
1695
1920
  this._requestor.cancel();
1696
1921
  }
1697
1922
  onSelect(e) {
1698
1923
  let t = e.target.closest("[role=\"option\"]");
1699
- !t || t.getAttribute("aria-disabled") === "true" || this.select(t.dataset.value ?? "");
1924
+ !t || C(t) || this.select(t.dataset.value ?? "");
1700
1925
  }
1701
1926
  select(e) {
1702
1927
  let t = this.listboxTarget.querySelectorAll("[role=\"option\"]");
1703
- t.forEach((e) => e.setAttribute("aria-selected", "false"));
1928
+ t.forEach((e) => v(e, !1));
1704
1929
  let n = [...t].find((t) => t.dataset.value === e);
1705
- n && n.setAttribute("aria-selected", "true"), this.dispatch("selected", {
1930
+ n && v(n, !0), this.dispatch("selected", {
1706
1931
  detail: { value: e },
1707
1932
  bubbles: !0
1708
1933
  });
@@ -1719,7 +1944,7 @@ var U = 7, Ee = 12, W = 10, G = {
1719
1944
  e.name !== "AbortError" && console.error("[combobox-dropdown] fetch failed", e);
1720
1945
  }).finally(() => this.setLoading(!1)), this.delayValue);
1721
1946
  } else {
1722
- let t = E(this.listboxTarget, e);
1947
+ let t = pe(this.listboxTarget, e);
1723
1948
  this.setEmpty(t === 0);
1724
1949
  }
1725
1950
  }
@@ -1732,7 +1957,7 @@ var U = 7, Ee = 12, W = 10, G = {
1732
1957
  setEmpty(e) {
1733
1958
  this.hasEmptyTarget && (this.emptyTarget.hidden = !e);
1734
1959
  }
1735
- }, tt = class extends e {
1960
+ }, Ct = class extends e {
1736
1961
  static targets = [
1737
1962
  "hour",
1738
1963
  "minute",
@@ -1743,7 +1968,7 @@ var U = 7, Ee = 12, W = 10, G = {
1743
1968
  }
1744
1969
  onSelect(e) {
1745
1970
  let t = e.target.closest("[role=\"option\"]");
1746
- t && (t.closest("[role=\"listbox\"]").querySelectorAll("[role=\"option\"]").forEach((e) => e.setAttribute("aria-selected", "false")), t.setAttribute("aria-selected", "true"), this.select(this.toH24()));
1971
+ t && (t.closest("[role=\"listbox\"]").querySelectorAll("[role=\"option\"]").forEach((e) => v(e, !1)), v(t, !0), this.select(this.toH24()));
1747
1972
  }
1748
1973
  select(e) {
1749
1974
  e && this.dispatch("selected", {
@@ -1756,7 +1981,7 @@ var U = 7, Ee = 12, W = 10, G = {
1756
1981
  }
1757
1982
  step(e, t) {
1758
1983
  let n = [...e.querySelectorAll("[role=\"option\"]")], r = e.querySelector("[aria-selected=\"true\"]"), i = n.indexOf(r), a = t > 0 ? n[Math.min(i + 1, n.length - 1)] : n[Math.max(i - 1, 0)];
1759
- !a || a === r || (n.forEach((e) => e.setAttribute("aria-selected", "false")), a.setAttribute("aria-selected", "true"), a.scrollIntoView({ block: "nearest" }), this.select(this.toH24()));
1984
+ !a || a === r || (n.forEach((e) => v(e, !1)), v(a, !0), a.scrollIntoView({ block: "nearest" }), this.select(this.toH24()));
1760
1985
  }
1761
1986
  toH24() {
1762
1987
  let e = this.selectedValue(this.hourTarget), t = this.selectedValue(this.minuteTarget);
@@ -1768,12 +1993,12 @@ var U = 7, Ee = 12, W = 10, G = {
1768
1993
  selectedValue(e) {
1769
1994
  return e?.querySelector("[aria-selected=\"true\"]")?.dataset.value ?? null;
1770
1995
  }
1771
- }, nt = class extends e {
1996
+ }, wt = class extends e {
1772
1997
  static targets = ["trigger"];
1773
1998
  connect() {
1774
- Q(this, { trigger: this.hasTriggerTarget ? this.triggerTarget : null });
1999
+ Z(this, { trigger: this.hasTriggerTarget ? this.triggerTarget : null });
1775
2000
  }
1776
- }, rt = class extends e {
2001
+ }, Tt = class extends e {
1777
2002
  static targets = ["anchor", "reference"];
1778
2003
  static values = {
1779
2004
  placement: {
@@ -1798,7 +2023,7 @@ var U = 7, Ee = 12, W = 10, G = {
1798
2023
  console.error("FlipperController requires an anchor target. Add data-flipper-target=\"anchor\" to your element.");
1799
2024
  return;
1800
2025
  }
1801
- Le(this, {
2026
+ tt(this, {
1802
2027
  element: this.referenceTarget,
1803
2028
  anchor: this.anchorTarget,
1804
2029
  placement: this.placementValue,
@@ -1806,7 +2031,7 @@ var U = 7, Ee = 12, W = 10, G = {
1806
2031
  ariaRole: this.roleValue
1807
2032
  });
1808
2033
  }
1809
- }, it = class extends e {
2034
+ }, Et = class extends e {
1810
2035
  static targets = ["trigger", "input"];
1811
2036
  static values = {
1812
2037
  value: String,
@@ -1831,8 +2056,12 @@ var U = 7, Ee = 12, W = 10, G = {
1831
2056
  valueValueChanged(e) {
1832
2057
  this.hasInputTarget && (this.inputTarget.value = e), this.dispatch("changed", { detail: { value: e } });
1833
2058
  }
1834
- }, at = class extends e {
1835
- static targets = ["input", "toggle"];
2059
+ }, Dt = class extends e {
2060
+ static targets = [
2061
+ "input",
2062
+ "toggle",
2063
+ "cell"
2064
+ ];
1836
2065
  static values = {
1837
2066
  format: {
1838
2067
  type: String,
@@ -1845,32 +2074,42 @@ var U = 7, Ee = 12, W = 10, G = {
1845
2074
  revealed: {
1846
2075
  type: Boolean,
1847
2076
  default: !1
2077
+ },
2078
+ groups: {
2079
+ type: Array,
2080
+ default: []
1848
2081
  }
1849
2082
  };
1850
2083
  connect() {
1851
- B(this, {
2084
+ U(this, {
1852
2085
  type: this.formatValue,
1853
2086
  options: this.optionsValue
1854
- }), this.format(this.readValue()), this.drawToggle();
2087
+ }), this.attachCells(), this.primeFilledState(), this.format(this.readValue()), this.drawToggle();
1855
2088
  }
1856
2089
  formatValueChanged() {
1857
- this.formatter && (B(this, {
2090
+ this.formatter && (U(this, {
1858
2091
  type: this.formatValue,
1859
2092
  options: this.optionsValue
1860
- }), this.format(this.readValue()), this.drawToggle());
2093
+ }), this.attachCells(), this.primeFilledState(), this.format(this.readValue()), this.drawToggle());
1861
2094
  }
1862
2095
  optionsValueChanged() {
1863
- this.formatter && (B(this, {
2096
+ this.formatter && (U(this, {
1864
2097
  type: this.formatValue,
1865
2098
  options: this.optionsValue
1866
- }), this.format(this.readValue()));
2099
+ }), this.attachCells(), this.primeFilledState(), this.format(this.readValue()));
1867
2100
  }
1868
2101
  revealedValueChanged() {
1869
2102
  this.formatter && (this.format(this.readValue()), this.drawToggle());
1870
2103
  }
2104
+ groupsValueChanged() {
2105
+ this.formatter && (this.attachCells(), this.format(this.readValue()));
2106
+ }
1871
2107
  onChange(e) {
1872
2108
  this.format(e?.detail?.value ?? "");
1873
2109
  }
2110
+ cellTargetConnected() {
2111
+ this.formatter && (this.attachCells(), this.drawCells(this.cellsValue(this.formatter.normalize(this.readValue()))));
2112
+ }
1874
2113
  format(e) {
1875
2114
  this.formatter && this.onFormatting(e);
1876
2115
  }
@@ -1883,10 +2122,45 @@ var U = 7, Ee = 12, W = 10, G = {
1883
2122
  let n = this.formatter.normalize(t);
1884
2123
  this.formatter.validate(n) && this.format(n);
1885
2124
  }
2125
+ attachCells() {
2126
+ if (!this.hasCellTarget) return;
2127
+ let e = this.formatter.cells();
2128
+ if (!e) {
2129
+ this.detachCells();
2130
+ return;
2131
+ }
2132
+ let t = this.groupsValue.length > 0;
2133
+ Le(this, {
2134
+ groups: t ? this.groupsValue : e.groups ?? [],
2135
+ length: t ? 0 : e.length ?? 0
2136
+ });
2137
+ }
2138
+ detachCells() {
2139
+ this.hasCellTarget && (this.cellTargets.forEach((e) => {
2140
+ e.textContent = "", e.removeAttribute("data-filled"), e.removeAttribute("data-caret");
2141
+ }), delete this.characterCells);
2142
+ }
2143
+ onInput() {
2144
+ this.format(this.readValue());
2145
+ }
2146
+ onFocus() {
2147
+ this.drawCells(this.cellsValue(this.formatter?.normalize(this.readValue()) ?? ""));
2148
+ }
2149
+ onBlur() {
2150
+ this.drawCells(this.cellsValue(this.formatter?.normalize(this.readValue()) ?? ""));
2151
+ }
2152
+ cellsValue(e) {
2153
+ return !this.formatter || this.revealedValue || !this.formatter.maskable() ? e : this.formatter.mask(e);
2154
+ }
2155
+ drawCells(e) {
2156
+ if (!this.hasCellTarget) return;
2157
+ let t = this.hasInputTarget && document.activeElement === this.inputTarget;
2158
+ this.characterCells?.draw(e, { focused: t });
2159
+ }
1886
2160
  drawToggle() {
1887
2161
  if (!this.hasToggleTarget) return;
1888
2162
  let e = this.formatter?.maskable() || this.formatValue === "password";
1889
- this.toggleTarget.hidden = !e, e && _(this.toggleTarget, this.revealedValue);
2163
+ this.toggleTarget.hidden = !e, e && ne(this.toggleTarget, this.revealedValue);
1890
2164
  }
1891
2165
  readValue() {
1892
2166
  return this.hasInputTarget ? this.inputTarget instanceof HTMLInputElement ? this.inputTarget.value : this.inputTarget.textContent : "";
@@ -1898,9 +2172,18 @@ var U = 7, Ee = 12, W = 10, G = {
1898
2172
  return;
1899
2173
  }
1900
2174
  let t = this.formatter.normalize(e), n = this.revealedValue || !this.formatter.maskable() ? this.formatter.format(t) : this.formatter.mask(t);
1901
- this.hasInputTarget && (this.inputTarget instanceof HTMLInputElement ? this.inputTarget.value = n : this.inputTarget.textContent = n), this.dispatch("formatted", { detail: { value: n } });
2175
+ this.hasInputTarget && (this.inputTarget instanceof HTMLInputElement ? this.inputTarget.value = n : this.inputTarget.textContent = n), this.dispatch("formatted", { detail: { value: n } }), this.drawCells(this.cellsValue(t));
2176
+ let r = this.isFull(t);
2177
+ r && !this.wasFull && this.dispatch("filled", { detail: { value: t } }), this.wasFull = r;
2178
+ }
2179
+ isFull(e) {
2180
+ let t = this.characterCells?.active() ?? this.formatter?.cells()?.length ?? 0;
2181
+ return t > 0 && e.length === t && this.formatter.validate(e);
1902
2182
  }
1903
- }, ot = class extends e {
2183
+ primeFilledState() {
2184
+ this.wasFull = this.isFull(this.formatter.normalize(this.readValue()));
2185
+ }
2186
+ }, Ot = class extends e {
1904
2187
  static targets = ["input", "clear"];
1905
2188
  initialize() {
1906
2189
  this.onInput = this.draw.bind(this), this.onEscape = this.handleEscape.bind(this);
@@ -1923,7 +2206,7 @@ var U = 7, Ee = 12, W = 10, G = {
1923
2206
  handleEscape(e) {
1924
2207
  e.key === "Escape" && this.inputTarget.value !== "" && (e.preventDefault(), this.clear());
1925
2208
  }
1926
- }, st = class extends e {
2209
+ }, kt = class extends e {
1927
2210
  static targets = ["modal", "overlay"];
1928
2211
  initialize() {
1929
2212
  this.onCancel = this.close.bind(this);
@@ -1935,7 +2218,7 @@ var U = 7, Ee = 12, W = 10, G = {
1935
2218
  this.isNativeDialog = e instanceof HTMLDialogElement, this.isNativeDialog ? (e.addEventListener("cancel", this.onCancel), e.addEventListener("click", this.onBackdropClick)) : (this.focusTrap = new a(e, {
1936
2219
  escapeDeactivates: !0,
1937
2220
  onDeactivate: () => this.close()
1938
- }), Q(this, { element: e }));
2221
+ }), Z(this, { element: e }));
1939
2222
  }
1940
2223
  modalTargetDisconnected(e) {
1941
2224
  this.isNativeDialog && (e.removeEventListener("cancel", this.onCancel), e.removeEventListener("click", this.onBackdropClick));
@@ -1950,7 +2233,7 @@ var U = 7, Ee = 12, W = 10, G = {
1950
2233
  let e = this.hasOverlayTarget ? this.overlayTarget : this.modalTarget;
1951
2234
  e.hidden = !1, document.body.style.overflow = "hidden", this.focusTrap && this.focusTrap.activate();
1952
2235
  }
1953
- f("Modal opened");
2236
+ m("Modal opened");
1954
2237
  }
1955
2238
  }
1956
2239
  close(e) {
@@ -1962,26 +2245,25 @@ var U = 7, Ee = 12, W = 10, G = {
1962
2245
  let e = this.hasOverlayTarget ? this.overlayTarget : this.modalTarget;
1963
2246
  e.hidden = !0, document.body.style.overflow = "", this.focusTrap && this.focusTrap.deactivate();
1964
2247
  }
1965
- f("Modal closed");
2248
+ m("Modal closed");
1966
2249
  }
1967
2250
  }
1968
2251
  onBackdropClick = (e) => {
1969
2252
  let t = this.modalTarget.getBoundingClientRect();
1970
2253
  (e.clientY < t.top || e.clientY > t.bottom || e.clientX < t.left || e.clientX > t.right) && this.close();
1971
2254
  };
1972
- }, ct = class extends e {
2255
+ }, At = class extends e {
1973
2256
  static targets = ["content"];
1974
2257
  connect() {
1975
- Be(this, { element: this.hasContentTarget ? this.contentTarget : null });
2258
+ ct(this, { element: this.hasContentTarget ? this.contentTarget : null });
1976
2259
  }
1977
- }, lt = class extends e {
2260
+ }, jt = class extends e {
1978
2261
  static targets = [
1979
2262
  "trigger",
1980
2263
  "panel",
1981
2264
  "template",
1982
2265
  "loader"
1983
2266
  ];
1984
- static classes = ["hidden"];
1985
2267
  static values = {
1986
2268
  url: String,
1987
2269
  loadedAt: String,
@@ -2007,13 +2289,13 @@ var U = 7, Ee = 12, W = 10, G = {
2007
2289
  }
2008
2290
  };
2009
2291
  connect() {
2010
- Me(this, {
2292
+ Xe(this, {
2011
2293
  element: this.hasPanelTarget ? this.panelTarget : null,
2012
2294
  url: this.hasUrlValue ? this.urlValue : null
2013
- }), this.hasPanelTarget && (Ue(this, {
2295
+ }), this.hasPanelTarget && (Q(this, {
2014
2296
  element: this.panelTarget,
2015
2297
  activator: this.hasTriggerTarget ? this.triggerTarget : null
2016
- }), Q(this)), this.hasLoaderTarget && Ue(this, {
2298
+ }), Z(this)), this.hasLoaderTarget && Q(this, {
2017
2299
  element: this.loaderTarget,
2018
2300
  visibility: "contentLoaderVisibility"
2019
2301
  });
@@ -2034,10 +2316,10 @@ var U = 7, Ee = 12, W = 10, G = {
2034
2316
  this.closeOnSelectValue && await this.close();
2035
2317
  }
2036
2318
  async shown() {
2037
- await this.load(), this.hasPanelTarget && i(this.panelTarget), f(this.announceOpenValue);
2319
+ await this.load(), this.hasPanelTarget && i(this.panelTarget), m(this.announceOpenValue);
2038
2320
  }
2039
2321
  async hidden() {
2040
- this.hasTriggerTarget && this.triggerTarget.focus(), f(this.announceCloseValue);
2322
+ this.hasTriggerTarget && this.triggerTarget.focus(), m(this.announceCloseValue);
2041
2323
  }
2042
2324
  canLoad() {
2043
2325
  return this.hasPanelTarget && this.panelTarget.tagName.toLowerCase() === "turbo-frame" ? (this.hasUrlValue && this.panelTarget.setAttribute("src", this.urlValue), !1) : !0;
@@ -2058,7 +2340,156 @@ var U = 7, Ee = 12, W = 10, G = {
2058
2340
  contentLoader() {
2059
2341
  if (this.hasTemplateTarget) return this.templateTarget instanceof HTMLTemplateElement ? this.templateTarget.content : this.templateTarget.innerHTML;
2060
2342
  }
2061
- }, ut = class extends e {
2343
+ }, Mt = class extends e {
2344
+ static targets = ["fill", "meter"];
2345
+ static values = {
2346
+ variant: {
2347
+ type: String,
2348
+ default: "bar"
2349
+ },
2350
+ current: {
2351
+ type: Number,
2352
+ default: 0
2353
+ },
2354
+ min: {
2355
+ type: Number,
2356
+ default: 0
2357
+ },
2358
+ max: {
2359
+ type: Number,
2360
+ default: 100
2361
+ },
2362
+ optimum: Number,
2363
+ low: Number,
2364
+ high: Number,
2365
+ indeterminate: {
2366
+ type: Boolean,
2367
+ default: !1
2368
+ },
2369
+ indeterminateFraction: {
2370
+ type: Number,
2371
+ default: .25
2372
+ }
2373
+ };
2374
+ connect() {
2375
+ this.variantValue === "ring" && this.hasFillTarget && this.setCircumference(this.fillTarget), this.render();
2376
+ }
2377
+ setValue(e) {
2378
+ this.currentValue = this.clamp(e), this.render(), this.dispatch("changed", { detail: {
2379
+ value: this.currentValue,
2380
+ min: this.minValue,
2381
+ max: this.maxValue
2382
+ } });
2383
+ }
2384
+ currentValueChanged() {
2385
+ this.render();
2386
+ }
2387
+ clamp(e) {
2388
+ return Math.min(this.maxValue, Math.max(this.minValue, e));
2389
+ }
2390
+ render() {
2391
+ switch (this.variantValue) {
2392
+ case "meter": return this.renderMeter();
2393
+ case "ring":
2394
+ case "bar": return T(this.element, this.minValue), E(this.element, this.maxValue), D(this.element, this.indeterminateValue ? null : this.currentValue), this.element.classList.toggle("sp-progress-indeterminate", this.indeterminateValue), this.variantValue === "ring" ? this.renderRing() : this.renderBar();
2395
+ default: return;
2396
+ }
2397
+ }
2398
+ percent() {
2399
+ let e = this.maxValue - this.minValue;
2400
+ return e <= 0 ? 0 : (this.currentValue - this.minValue) / e * 100;
2401
+ }
2402
+ renderBar() {
2403
+ if (this.hasFillTarget) {
2404
+ if (this.indeterminateValue) {
2405
+ this.fillTarget.style.width = `${this.indeterminateFractionValue * 100}%`;
2406
+ return;
2407
+ }
2408
+ this.fillTarget.style.width = `${this.percent()}%`;
2409
+ }
2410
+ }
2411
+ renderRing() {
2412
+ if (this.hasFillTarget) {
2413
+ if (this.circumference ?? this.setCircumference(this.fillTarget), this.indeterminateValue) {
2414
+ let e = this.circumference * this.indeterminateFractionValue;
2415
+ this.fillTarget.style.strokeDasharray = `${e} ${this.circumference - e}`;
2416
+ return;
2417
+ }
2418
+ this.fillTarget.style.strokeDasharray = `${this.circumference}`, this.fillTarget.style.strokeDashoffset = `${this.circumference * (1 - this.percent() / 100)}`;
2419
+ }
2420
+ }
2421
+ setCircumference(e) {
2422
+ let t = parseFloat(e.getAttribute("r"));
2423
+ this.circumference = 2 * Math.PI * t;
2424
+ }
2425
+ renderMeter() {
2426
+ if (!this.hasMeterTarget || !(this.meterTarget instanceof HTMLMeterElement)) return;
2427
+ let e = this.meterTarget;
2428
+ e.value = this.currentValue, e.min = this.minValue, e.max = this.maxValue, this.hasLowValue && (e.low = this.lowValue), this.hasHighValue && (e.high = this.highValue), this.hasOptimumValue && (e.optimum = this.optimumValue);
2429
+ }
2430
+ }, Nt = class extends e {
2431
+ static targets = [
2432
+ "item",
2433
+ "handle",
2434
+ "trigger"
2435
+ ];
2436
+ static values = {
2437
+ moveKey: {
2438
+ type: String,
2439
+ default: "Alt"
2440
+ },
2441
+ editing: {
2442
+ type: Boolean,
2443
+ default: !1
2444
+ },
2445
+ orientation: {
2446
+ type: String,
2447
+ default: "vertical"
2448
+ }
2449
+ };
2450
+ connect() {
2451
+ this.reorderable = at(this, {
2452
+ moveKey: this.moveKeyValue,
2453
+ orientation: this.orientationValue,
2454
+ onMoved: "moved"
2455
+ }), this.reorderable.attachItems(this.itemTargets), this.rovingTabIndex = new d(this.itemTargets, { orientation: this.orientationValue }), this.rovingTabIndex.activate();
2456
+ }
2457
+ disconnect() {
2458
+ this.reorderable.detachItems(this.itemTargets), this.rovingTabIndex?.deactivate(), this.rovingTabIndex = null;
2459
+ }
2460
+ itemTargetConnected(e) {
2461
+ this.reorderable?.attachItem(e), this.rovingTabIndex?.updateItems(this.itemTargets);
2462
+ }
2463
+ itemTargetDisconnected(e) {
2464
+ this.reorderable?.detachItem(e), this.rovingTabIndex?.updateItems(this.itemTargets);
2465
+ }
2466
+ editingValueChanged(e) {
2467
+ this.triggerTargets.forEach((t) => w(t, e));
2468
+ }
2469
+ toggleEditing() {
2470
+ this.editingValue = !this.editingValue;
2471
+ }
2472
+ enterEditing() {
2473
+ this.editingValue = !0;
2474
+ }
2475
+ exitEditing() {
2476
+ this.editingValue = !1;
2477
+ }
2478
+ onPointerDown(e) {
2479
+ if (!this.editingValue) return;
2480
+ let t = e.currentTarget.closest("[data-reorderable-target~=\"item\"]");
2481
+ t && this.reorderable.startDrag(t, e.currentTarget, e.pointerId);
2482
+ }
2483
+ onPointerMove(e) {
2484
+ this.editingValue && this.reorderable.drag(e);
2485
+ }
2486
+ onPointerUp(e) {
2487
+ this.editingValue && (this.reorderable.endDrag(e.currentTarget, e.pointerId), this.rovingTabIndex?.updateItems(this.itemTargets));
2488
+ }
2489
+ moved(e) {
2490
+ this.rovingTabIndex?.updateItems(this.itemTargets), this.rovingTabIndex.setCurrentIndex(this.itemTargets.indexOf(e));
2491
+ }
2492
+ }, Pt = class extends e {
2062
2493
  static targets = [
2063
2494
  "trigger",
2064
2495
  "detail",
@@ -2069,14 +2500,14 @@ var U = 7, Ee = 12, W = 10, G = {
2069
2500
  default: {}
2070
2501
  } };
2071
2502
  connect() {
2072
- this.rovingTabIndex = new u(this.triggerTargets, { orientation: "vertical" }), this.rovingTabIndex.activate();
2503
+ this.rovingTabIndex = new d(this.triggerTargets, { orientation: "vertical" }), this.rovingTabIndex.activate();
2073
2504
  }
2074
2505
  disconnect() {
2075
2506
  this.rovingTabIndex?.deactivate(), this.rovingTabIndex = null;
2076
2507
  }
2077
2508
  toggle(e) {
2078
2509
  let t = e.currentTarget;
2079
- t.getAttribute("aria-expanded") === "true" ? this.collapseItem(t) : this.expandItem(t);
2510
+ te(t) ? this.collapseItem(t) : this.expandItem(t);
2080
2511
  }
2081
2512
  expand(e) {
2082
2513
  this.expandItem(e.currentTarget);
@@ -2089,7 +2520,7 @@ var U = 7, Ee = 12, W = 10, G = {
2089
2520
  this.dispatch("expand", { detail: {
2090
2521
  trigger: e,
2091
2522
  detail: t
2092
- } }), g(e, !0), t && (v(t, !1), f(`${e.textContent.trim()} expanded`)), this.dispatch("expanded", { detail: {
2523
+ } }), _(e, !0), t && (b(t, !1), m(`${e.textContent.trim()} expanded`)), this.dispatch("expanded", { detail: {
2093
2524
  trigger: e,
2094
2525
  detail: t
2095
2526
  } });
@@ -2099,24 +2530,38 @@ var U = 7, Ee = 12, W = 10, G = {
2099
2530
  this.dispatch("collapse", { detail: {
2100
2531
  trigger: e,
2101
2532
  detail: t
2102
- } }), g(e, !1), t && (v(t, !0), f(`${e.textContent.trim()} collapsed`)), this.dispatch("collapsed", { detail: {
2533
+ } }), _(e, !1), t && (b(t, !0), m(`${e.textContent.trim()} collapsed`)), this.dispatch("collapsed", { detail: {
2103
2534
  trigger: e,
2104
2535
  detail: t
2105
2536
  } });
2106
2537
  }
2107
2538
  triggerTargetConnected(e) {
2108
- e.hasAttribute("aria-expanded") || e.setAttribute("aria-expanded", "false"), this.rovingTabIndex?.updateItems(this.triggerTargets);
2539
+ e.hasAttribute("aria-expanded") || _(e, !1), this.rovingTabIndex?.updateItems(this.triggerTargets);
2109
2540
  }
2110
2541
  triggerTargetDisconnected() {
2111
2542
  this.rovingTabIndex?.updateItems(this.triggerTargets);
2112
2543
  }
2113
2544
  timeTargetConnected(e) {
2114
2545
  if (!Object.keys(this.dateFormatValue).length || e.textContent.trim()) return;
2115
- let t = P.format(e.getAttribute("datetime"), this.dateFormatValue);
2546
+ let t = R.format(e.getAttribute("datetime"), this.dateFormatValue);
2116
2547
  t && (e.textContent = t);
2117
2548
  }
2549
+ }, Ft = class extends e {
2550
+ static targets = ["content"];
2551
+ connect() {
2552
+ Z(this);
2553
+ }
2554
+ contentTargetConnected(e) {
2555
+ ct(this, { element: e }), Q(this, { element: e });
2556
+ }
2557
+ async dismissed() {
2558
+ this.hasContentTarget && await this.visibility.hide();
2559
+ }
2560
+ async toggle() {
2561
+ this.hasContentTarget && (this.visibility.visible ? await this.visibility.hide() : (await this.visibility.show(), this.shift(this.contentTarget)));
2562
+ }
2118
2563
  };
2119
2564
  //#endregion
2120
- export { y as ARIA_HASPOPUP_VALUES, Ge as CalendarDecadeController, Ke as CalendarDecadeSelectorController, qe as CalendarMonthController, Je as CalendarMonthSelectorController, Xe as CalendarYearController, Ze as CalendarYearSelectorController, Qe as ClipboardController, $e as ComboboxDateController, et as ComboboxDropdownController, tt as ComboboxTimeController, nt as DismisserController, t as FOCUSABLE_SELECTOR, I as FORMATTER_TYPES, rt as FlipperController, a as FocusTrap, z as Formatter, ot as InputClearableController, it as InputComboboxController, at as InputFormatterController, d as ListboxNavigation, st as ModalController, ct as PannerController, lt as PopoverController, w as Requestor, u as RovingTabIndex, ut as TimelineController, f as announce, S as connectTriggerToTarget, re as disconnectTriggerFromTarget, m as ensureId, E as filterOptions, i as focusFirst, T as fuzzyMatcher, p as generateId, n as getFocusableElements, s as isActivationKey, c as isArrowKey, o as isKey, r as isVisible, l as preventDefault, h as setAriaState, te as setChecked, ne as setDisabled, g as setExpanded, v as setHidden, _ as setPressed };
2565
+ export { O as ARIA_HASPOPUP_VALUES, ft as CalendarDecadeController, pt as CalendarDecadeSelectorController, mt as CalendarMonthController, ht as CalendarMonthSelectorController, _t as CalendarYearController, vt as CalendarYearSelectorController, Ie as CharacterCells, yt as ChecklistController, bt as ClipboardController, xt as ComboboxDateController, St as ComboboxDropdownController, Ct as ComboboxTimeController, wt as DismisserController, t as FOCUSABLE_SELECTOR, V as FORMATTER_TYPES, Tt as FlipperController, a as FocusTrap, Pe as Formatter, Ot as InputClearableController, Et as InputComboboxController, Dt as InputFormatterController, f as ListboxNavigation, u as MODIFIER_KEYS, kt as ModalController, At as PannerController, jt as PopoverController, Mt as ProgressController, Nt as ReorderableController, A as Requestor, d as RovingTabIndex, Pt as TimelineController, Ft as VisibilityController, m as announce, Le as attachCharacterCells, ae as connectTriggerToTarget, se as disconnectTriggerFromTarget, ee as ensureId, pe as filterOptions, i as focusFirst, ce as fuzzyMatcher, h as generateId, n as getFocusableElements, s as isActivationKey, C as isAriaDisabled, c as isArrowKey, te as isExpanded, o as isKey, r as isVisible, l as preventDefault, S as setAriaDisabled, x as setAriaHidden, g as setAriaState, re as setChecked, y as setCurrent, w as setDisabled, _ as setExpanded, b as setHidden, ne as setPressed, v as setSelected, E as setValueMax, T as setValueMin, D as setValueNow };
2121
2566
 
2122
2567
  //# sourceMappingURL=index.es.js.map