stimulus_plumbers 0.2.8 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +52 -0
  3. data/README.md +8 -4
  4. data/app/assets/javascripts/stimulus-plumbers/stimulus-plumbers-controllers.es.js +450 -436
  5. data/app/assets/javascripts/stimulus-plumbers/stimulus-plumbers-controllers.umd.js +1 -1
  6. data/lib/stimulus_plumbers/components/action_list/item.rb +27 -0
  7. data/lib/stimulus_plumbers/components/action_list/section.rb +21 -0
  8. data/lib/stimulus_plumbers/components/action_list.rb +23 -0
  9. data/lib/stimulus_plumbers/components/avatar.rb +73 -0
  10. data/lib/stimulus_plumbers/components/button/group.rb +17 -0
  11. data/lib/stimulus_plumbers/components/button.rb +27 -0
  12. data/lib/stimulus_plumbers/components/calendar/month/turbo/days_of_month.rb +60 -41
  13. data/lib/stimulus_plumbers/components/calendar/month/turbo/days_of_week.rb +15 -12
  14. data/lib/stimulus_plumbers/components/calendar/month/turbo.rb +55 -0
  15. data/lib/stimulus_plumbers/components/calendar.rb +56 -0
  16. data/lib/stimulus_plumbers/components/card/section.rb +25 -0
  17. data/lib/stimulus_plumbers/components/card.rb +27 -0
  18. data/lib/stimulus_plumbers/components/combobox/autocomplete.rb +30 -34
  19. data/lib/stimulus_plumbers/components/combobox/date.rb +16 -18
  20. data/lib/stimulus_plumbers/components/combobox/dropdown.rb +13 -16
  21. data/lib/stimulus_plumbers/components/combobox/options/option.rb +34 -0
  22. data/lib/stimulus_plumbers/components/combobox/options/option_group.rb +29 -0
  23. data/lib/stimulus_plumbers/components/combobox/options.rb +59 -0
  24. data/lib/stimulus_plumbers/components/combobox/popover.rb +20 -0
  25. data/lib/stimulus_plumbers/components/combobox/time/drum.rb +37 -0
  26. data/lib/stimulus_plumbers/components/combobox/time.rb +32 -15
  27. data/lib/stimulus_plumbers/components/combobox/trigger.rb +38 -0
  28. data/lib/stimulus_plumbers/components/combobox.rb +59 -0
  29. data/lib/stimulus_plumbers/components/date_picker/navigation.rb +14 -22
  30. data/lib/stimulus_plumbers/components/date_picker/navigator.rb +1 -1
  31. data/lib/stimulus_plumbers/components/icon.rb +43 -0
  32. data/lib/stimulus_plumbers/components/popover/builder.rb +25 -0
  33. data/lib/stimulus_plumbers/components/popover.rb +31 -0
  34. data/lib/stimulus_plumbers/configuration.rb +3 -18
  35. data/lib/stimulus_plumbers/engine.rb +2 -2
  36. data/lib/stimulus_plumbers/form/builder.rb +8 -6
  37. data/lib/stimulus_plumbers/form/{field_component.rb → field.rb} +1 -1
  38. data/lib/stimulus_plumbers/form/fields/combobox.rb +7 -4
  39. data/lib/stimulus_plumbers/form/fields/error.rb +14 -0
  40. data/lib/stimulus_plumbers/form/fields/group.rb +14 -0
  41. data/lib/stimulus_plumbers/form/fields/hint.rb +14 -0
  42. data/lib/stimulus_plumbers/form/fields/label.rb +21 -0
  43. data/lib/stimulus_plumbers/form/fields/renderer.rb +20 -21
  44. data/lib/stimulus_plumbers/form/fields/search.rb +23 -9
  45. data/lib/stimulus_plumbers/form/fields/submit.rb +23 -0
  46. data/lib/stimulus_plumbers/helpers/action_list_helper.rb +2 -2
  47. data/lib/stimulus_plumbers/helpers/avatar_helper.rb +2 -2
  48. data/lib/stimulus_plumbers/helpers/button_helper.rb +2 -2
  49. data/lib/stimulus_plumbers/helpers/calendar_helper.rb +1 -1
  50. data/lib/stimulus_plumbers/helpers/calendar_turbo_helper.rb +1 -1
  51. data/lib/stimulus_plumbers/helpers/card_helper.rb +2 -2
  52. data/lib/stimulus_plumbers/helpers/combobox_helper.rb +5 -5
  53. data/lib/stimulus_plumbers/helpers/popover_helper.rb +2 -2
  54. data/lib/stimulus_plumbers/plumber/base.rb +20 -0
  55. data/lib/stimulus_plumbers/plumber/dispatcher/callable_inspector.rb +19 -0
  56. data/lib/stimulus_plumbers/plumber/dispatcher/instance_exec.rb +35 -0
  57. data/lib/stimulus_plumbers/plumber/dispatcher/klass_proxy.rb +34 -0
  58. data/lib/stimulus_plumbers/plumber/dispatcher/method_call.rb +36 -0
  59. data/lib/stimulus_plumbers/plumber/dispatcher.rb +28 -0
  60. data/lib/stimulus_plumbers/plumber/html_options.rb +52 -0
  61. data/lib/stimulus_plumbers/plumber/renderer.rb +89 -0
  62. data/lib/stimulus_plumbers/themes/base.rb +34 -20
  63. data/lib/stimulus_plumbers/themes/configuration.rb +38 -0
  64. data/lib/stimulus_plumbers/themes/schema/form/ranges.rb +14 -0
  65. data/lib/stimulus_plumbers/themes/schema/icon.rb +32 -0
  66. data/lib/stimulus_plumbers/themes/schema/ranges.rb +5 -5
  67. data/lib/stimulus_plumbers/themes/schema.rb +103 -0
  68. data/lib/stimulus_plumbers/version.rb +1 -1
  69. data/lib/stimulus_plumbers.rb +29 -19
  70. metadata +40 -34
  71. data/lib/stimulus_plumbers/components/action_list/renderer.rb +0 -47
  72. data/lib/stimulus_plumbers/components/avatar/renderer.rb +0 -74
  73. data/lib/stimulus_plumbers/components/button/renderer.rb +0 -33
  74. data/lib/stimulus_plumbers/components/calendar/month/turbo/renderer.rb +0 -57
  75. data/lib/stimulus_plumbers/components/calendar/renderer.rb +0 -35
  76. data/lib/stimulus_plumbers/components/card/renderer.rb +0 -41
  77. data/lib/stimulus_plumbers/components/combobox/option.rb +0 -27
  78. data/lib/stimulus_plumbers/components/combobox/option_group.rb +0 -52
  79. data/lib/stimulus_plumbers/components/combobox/renderer.rb +0 -78
  80. data/lib/stimulus_plumbers/components/icon/renderer.rb +0 -51
  81. data/lib/stimulus_plumbers/components/plumber/base.rb +0 -22
  82. data/lib/stimulus_plumbers/components/plumber/dispatcher.rb +0 -113
  83. data/lib/stimulus_plumbers/components/plumber/html_options.rb +0 -53
  84. data/lib/stimulus_plumbers/components/plumber/renderer.rb +0 -91
  85. data/lib/stimulus_plumbers/components/popover/renderer.rb +0 -46
  86. data/lib/stimulus_plumbers/components/time_picker/renderer.rb +0 -38
  87. data/lib/stimulus_plumbers/themes/base/action_list.rb +0 -14
  88. data/lib/stimulus_plumbers/themes/base/avatar.rb +0 -14
  89. data/lib/stimulus_plumbers/themes/base/button.rb +0 -18
  90. data/lib/stimulus_plumbers/themes/base/calendar.rb +0 -15
  91. data/lib/stimulus_plumbers/themes/base/card.rb +0 -12
  92. data/lib/stimulus_plumbers/themes/base/form.rb +0 -34
  93. data/lib/stimulus_plumbers/themes/base/layout.rb +0 -12
  94. data/lib/stimulus_plumbers/themes/tailwind/action_list.rb +0 -33
  95. data/lib/stimulus_plumbers/themes/tailwind/avatar.rb +0 -52
  96. data/lib/stimulus_plumbers/themes/tailwind/button.rb +0 -89
  97. data/lib/stimulus_plumbers/themes/tailwind/calendar.rb +0 -34
  98. data/lib/stimulus_plumbers/themes/tailwind/card.rb +0 -24
  99. data/lib/stimulus_plumbers/themes/tailwind/form.rb +0 -108
  100. data/lib/stimulus_plumbers/themes/tailwind/layout.rb +0 -25
  101. data/lib/stimulus_plumbers/themes/tailwind_theme.rb +0 -29
@@ -1,5 +1,5 @@
1
1
  import { Controller as e } from "@hotwired/stimulus";
2
- //#region src/focus.js
2
+ //#region src/accessibility/focus.js
3
3
  var t = [
4
4
  "a[href]",
5
5
  "area[href]",
@@ -58,7 +58,7 @@ var a = class {
58
58
  }
59
59
  };
60
60
  //#endregion
61
- //#region src/keyboard.js
61
+ //#region src/accessibility/keyboard.js
62
62
  function s(e, t) {
63
63
  return e.key === t;
64
64
  }
@@ -124,7 +124,7 @@ function p(e, t = {}) {
124
124
  }
125
125
  var m = (e = "a11y") => `${e}-${Math.random().toString(36).substr(2, 9)}`, h = (e, t = "element") => e.id ||= m(t), g = (e, t, n) => {
126
126
  e.setAttribute(t, n.toString());
127
- }, _ = (e, t) => g(e, "aria-expanded", t), v = (e, t) => g(e, "aria-pressed", t), ee = (e, t) => g(e, "aria-checked", t);
127
+ }, ee = (e, t) => g(e, "aria-expanded", t), _ = (e, t) => g(e, "aria-pressed", t), v = (e, t) => g(e, "aria-checked", t);
128
128
  function te(e, t) {
129
129
  g(e, "aria-disabled", t), t ? e.setAttribute("tabindex", "-1") : e.removeAttribute("tabindex");
130
130
  }
@@ -165,13 +165,56 @@ function ne({ trigger: e, target: t, attributes: n = null }) {
165
165
  ]), (!n || n.includes("role")) && C(t, ["role"]));
166
166
  }
167
167
  //#endregion
168
- //#region src/plumbers/plumber/support.js
169
- var w = {
170
- get visibleOnly() {
171
- return !0;
172
- },
173
- hiddenClass: null
174
- }, T = {
168
+ //#region src/requestor.js
169
+ var w = class {
170
+ constructor() {
171
+ this._abortController = null, this._timer = null;
172
+ }
173
+ schedule(e, t) {
174
+ clearTimeout(this._timer), this._timer = setTimeout(e, t);
175
+ }
176
+ async request(e, t = {}) {
177
+ this._abortController?.abort(), this._abortController = new AbortController();
178
+ let n = await fetch(e, {
179
+ ...t,
180
+ signal: this._abortController.signal
181
+ });
182
+ if (!n.ok) throw Error(`${n.status}`);
183
+ return n;
184
+ }
185
+ cancel() {
186
+ clearTimeout(this._timer), this._abortController?.abort();
187
+ }
188
+ };
189
+ //#endregion
190
+ //#region src/researcher.js
191
+ function T(e, t) {
192
+ let n = 0;
193
+ for (let r = 0; r < t.length && n < e.length; r++) t[r] === e[n] && n++;
194
+ return n === e.length;
195
+ }
196
+ function re(e, t) {
197
+ return t.includes(e);
198
+ }
199
+ function ie(e, t) {
200
+ return t.startsWith(e);
201
+ }
202
+ function ae(e) {
203
+ return e === "contains" ? re : e === "prefix" ? ie : T;
204
+ }
205
+ function oe(e, t) {
206
+ return t === "textContent" ? e.textContent?.trim().toLowerCase() ?? "" : (e.getAttribute(t) ?? "").toLowerCase();
207
+ }
208
+ function E(e, t, n = {}) {
209
+ let { strategy: r = "fuzzy", matcher: i, fields: a = ["textContent"] } = n, o = typeof i == "function" ? i : ae(r), s = t.toLowerCase(), c = 0;
210
+ return e.querySelectorAll("[role=\"option\"]").forEach((e) => {
211
+ let t = a.some((t) => o(s, oe(e, t)));
212
+ e.hidden = !t, t && c++;
213
+ }), c;
214
+ }
215
+ //#endregion
216
+ //#region src/plumbers/plumber/geometry.js
217
+ var D = {
175
218
  get top() {
176
219
  return "bottom";
177
220
  },
@@ -185,7 +228,7 @@ var w = {
185
228
  return "left";
186
229
  }
187
230
  };
188
- function E({ x: e, y: t, width: n, height: r }) {
231
+ function O({ x: e, y: t, width: n, height: r }) {
189
232
  return {
190
233
  x: e,
191
234
  y: t,
@@ -197,47 +240,39 @@ function E({ x: e, y: t, width: n, height: r }) {
197
240
  bottom: t + r
198
241
  };
199
242
  }
200
- function D() {
201
- return E({
243
+ function k() {
244
+ return O({
202
245
  x: 0,
203
246
  y: 0,
204
247
  width: window.innerWidth || document.documentElement.clientWidth,
205
248
  height: window.innerHeight || document.documentElement.clientHeight
206
249
  });
207
250
  }
208
- function re(e) {
251
+ function se(e) {
209
252
  if (!(e instanceof HTMLElement)) return !1;
210
- let t = D(), n = e.getBoundingClientRect(), r = n.top <= t.height && n.top + n.height > 0, i = n.left <= t.width && n.left + n.width > 0;
253
+ let t = k(), n = e.getBoundingClientRect(), r = n.top <= t.height && n.top + n.height > 0, i = n.left <= t.width && n.left + n.width > 0;
211
254
  return r && i;
212
255
  }
213
- function O(e) {
214
- return e instanceof Date && !isNaN(e);
215
- }
216
- function k(...e) {
217
- if (e.length === 0) throw "Missing values to parse as date";
218
- if (e.length === 1) {
219
- let t = new Date(e[0]);
220
- if (e[0] && O(t)) return t;
221
- } else {
222
- let t = new Date(...e);
223
- if (O(t)) return t;
224
- }
225
- }
226
256
  //#endregion
227
- //#region src/plumbers/plumber/index.js
228
- var ie = {
257
+ //#region src/plumbers/plumber/config.js
258
+ var A = {
259
+ get visibleOnly() {
260
+ return !0;
261
+ },
262
+ hiddenClass: null
263
+ }, ce = {
229
264
  element: null,
230
265
  visible: null,
231
266
  dispatch: !0,
232
267
  prefix: ""
233
- }, A = class {
268
+ }, j = class {
234
269
  constructor(e, t = {}) {
235
270
  this.controller = e;
236
- let { element: n, visible: r, dispatch: i, prefix: a } = Object.assign({}, ie, t);
237
- this.element = n || e.element, this.visibleOnly = typeof r == "boolean" ? r : w.visibleOnly, this.visibleCallback = typeof r == "string" ? r : null, this.notify = !!i, this.prefix = typeof a == "string" && a ? a : e.identifier;
271
+ let { element: n, visible: r, dispatch: i, prefix: a } = Object.assign({}, ce, t);
272
+ this.element = n || e.element, this.visibleOnly = typeof r == "boolean" ? r : A.visibleOnly, this.visibleCallback = typeof r == "string" ? r : null, this.notify = !!i, this.prefix = typeof a == "string" && a ? a : e.identifier;
238
273
  }
239
274
  get visible() {
240
- return this.element instanceof HTMLElement ? this.visibleOnly ? re(this.element) && this.isVisible(this.element) : !0 : !1;
275
+ return this.element instanceof HTMLElement ? this.visibleOnly ? se(this.element) && this.isVisible(this.element) : !0 : !1;
241
276
  }
242
277
  isVisible(e) {
243
278
  if (this.visibleCallback) {
@@ -266,7 +301,214 @@ var ie = {
266
301
  return n instanceof Promise ? await n : n;
267
302
  }
268
303
  }
269
- }, j = 7, M = {
304
+ }, le = {
305
+ normalize(e) {
306
+ return typeof e == "string" ? e : "";
307
+ },
308
+ validate() {
309
+ return !0;
310
+ }
311
+ };
312
+ //#endregion
313
+ //#region src/plumbers/formatters/credit_card.js
314
+ function ue(e) {
315
+ let t = 0, n = !1;
316
+ for (let r = e.length - 1; r >= 0; r--) {
317
+ let i = parseInt(e[r], 10);
318
+ n && (i *= 2, i > 9 && (i -= 9)), t += i, n = !n;
319
+ }
320
+ return t % 10 == 0;
321
+ }
322
+ var de = /\D/g, fe = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
323
+ normalize(e) {
324
+ return typeof e == "string" ? e.replace(de, "") : "";
325
+ },
326
+ validate(e) {
327
+ return typeof e != "string" || !fe.test(e) ? !1 : ue(e);
328
+ },
329
+ format(e) {
330
+ return typeof e == "string" ? e.replace(pe, "$1 ") : "";
331
+ }
332
+ }, M = { 1: 10 }, N = /\D/g, he = /^\+\d{7,15}$/, ge = {
333
+ normalize(e) {
334
+ if (typeof e != "string") return "";
335
+ let t = e.trimStart().startsWith("+"), n = e.replace(N, "");
336
+ return t ? `+${n}` : n;
337
+ },
338
+ validate(e) {
339
+ if (typeof e != "string") return !1;
340
+ if (he.test(e)) return !0;
341
+ let t = e.replace(N, "");
342
+ return Object.values(M).includes(t.length);
343
+ },
344
+ format(e) {
345
+ if (typeof e != "string") return "";
346
+ let t = e.replace(N, "");
347
+ for (let [e, n] of Object.entries(M)) {
348
+ if (t.length === n) return `(${t.slice(0, 3)}) ${t.slice(3, 6)}-${t.slice(6)}`;
349
+ let r = n + e.length;
350
+ if (t.length === r && t.startsWith(e)) {
351
+ let n = t.slice(e.length);
352
+ return `+${e} (${n.slice(0, 3)}) ${n.slice(3, 6)}-${n.slice(6)}`;
353
+ }
354
+ }
355
+ return e;
356
+ }
357
+ }, _e = /[^\d.,-]/g, P = /^-?\d+(\.\d+)?$/, F = {
358
+ normalize(e) {
359
+ if (typeof e != "string") return "";
360
+ let t = e.replace(_e, "");
361
+ if (!t) return "";
362
+ let n = t.lastIndexOf(","), r = t.lastIndexOf(".");
363
+ 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;
364
+ },
365
+ validate(e) {
366
+ return typeof e == "string" ? P.test(e) : !1;
367
+ },
368
+ format(e, t = {}) {
369
+ if (typeof e != "string") return "";
370
+ let n = parseFloat(e);
371
+ if (isNaN(n)) return e;
372
+ let r = t.locale || "en-US", i = t.currency || "USD", a = t.fractionDigits === void 0 ? {} : {
373
+ minimumFractionDigits: t.fractionDigits,
374
+ maximumFractionDigits: t.fractionDigits
375
+ };
376
+ try {
377
+ return new Intl.NumberFormat(r, {
378
+ style: "currency",
379
+ currency: i,
380
+ ...a
381
+ }).format(n);
382
+ } catch {
383
+ return e;
384
+ }
385
+ }
386
+ }, I = /^\d{4}-\d{2}-\d{2}$/, ve = /^(\d{1,4})[/\-.](\d{1,2})[/\-.](\d{1,4})$/, ye = /\D/g, L = {
387
+ normalize(e) {
388
+ if (typeof e != "string") return "";
389
+ let t = e.trim();
390
+ if (I.test(t)) return t;
391
+ let n = t.match(ve);
392
+ if (n) {
393
+ let [, e, t, r] = n;
394
+ if (e.length === 4) return `${e}-${t.padStart(2, "0")}-${r.padStart(2, "0")}`;
395
+ if (r.length === 4) return `${r}-${e.padStart(2, "0")}-${t.padStart(2, "0")}`;
396
+ }
397
+ let r = t.replace(ye, "");
398
+ if (r.length === 8) {
399
+ let e = parseInt(r.slice(0, 4), 10);
400
+ 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)}`;
401
+ }
402
+ return t;
403
+ },
404
+ validate(e) {
405
+ if (typeof e != "string") return !1;
406
+ let t = L.normalize(e);
407
+ if (!I.test(t)) return !1;
408
+ let n = /* @__PURE__ */ new Date(`${t}T00:00:00Z`);
409
+ return !isNaN(n.getTime()) && n.toISOString().startsWith(t);
410
+ },
411
+ format(e, t = {}) {
412
+ if (typeof e != "string") return "";
413
+ let n = /* @__PURE__ */ new Date(`${e}T00:00:00Z`);
414
+ if (isNaN(n.getTime())) return e;
415
+ let r = t.locale || "en-US";
416
+ try {
417
+ return new Intl.DateTimeFormat(r, {
418
+ year: t.year || "numeric",
419
+ month: t.month || "2-digit",
420
+ day: t.day || "2-digit",
421
+ timeZone: t.timeZone || "UTC"
422
+ }).format(n);
423
+ } catch {
424
+ return e;
425
+ }
426
+ }
427
+ }, be = /^([01]?\d|2[0-3]):([0-5]\d)$/, R = {
428
+ normalize(e) {
429
+ if (typeof e != "string") return "";
430
+ let t = e.trim();
431
+ if (be.test(t)) {
432
+ let [e, n] = t.split(":");
433
+ return `${String(parseInt(e, 10)).padStart(2, "0")}:${n}`;
434
+ }
435
+ let n = t.match(/^(\d{1,2}):(\d{2})\s*(AM|PM)$/i);
436
+ if (n) {
437
+ let e = parseInt(n[1], 10), t = n[2];
438
+ return e = n[3].toUpperCase() === "AM" ? e === 12 ? 0 : e : e === 12 ? 12 : e + 12, e > 23 || parseInt(t, 10) > 59 ? "" : `${String(e).padStart(2, "0")}:${t}`;
439
+ }
440
+ return "";
441
+ },
442
+ validate(e) {
443
+ return R.normalize(e) !== "";
444
+ },
445
+ format(e, t = {}) {
446
+ if (typeof e != "string") return "";
447
+ let n = e.match(/^(\d{2}):(\d{2})$/);
448
+ if (!n) return e;
449
+ let r = parseInt(n[1], 10), i = n[2];
450
+ if (t.format === "h24") return `${String(r).padStart(2, "0")}:${i}`;
451
+ let a = r < 12 ? "AM" : "PM";
452
+ return `${r % 12 || 12}:${i} ${a}`;
453
+ }
454
+ }, z = {
455
+ PLAIN: "plain",
456
+ CREDIT_CARD: "creditCard",
457
+ PHONE: "phone",
458
+ CURRENCY: "currency",
459
+ DATE: "date",
460
+ TIME: "time"
461
+ }, B = new Map([
462
+ [z.PLAIN, le],
463
+ [z.CREDIT_CARD, me],
464
+ [z.PHONE, ge],
465
+ [z.CURRENCY, F],
466
+ [z.DATE, L],
467
+ [z.TIME, R]
468
+ ]), V = {
469
+ type: z.PLAIN,
470
+ options: {}
471
+ }, H = class extends j {
472
+ static register(e, t) {
473
+ B.set(e, t);
474
+ }
475
+ constructor(e, t = {}) {
476
+ super(e, t), this.type = t.type ?? V.type, this.options = t.options ?? V.options, this.enhance();
477
+ }
478
+ enhance() {
479
+ let e = this, t = B.get(e.type) ?? B.get(z.PLAIN), n = {
480
+ normalize: (n) => t.normalize?.(n, e.options) ?? (typeof n == "string" ? n : ""),
481
+ validate: (n) => t.validate?.(n, e.options) ?? !0,
482
+ format: (n) => t.format?.(n, e.options) ?? (typeof n == "string" ? n : ""),
483
+ mask: (n) => t.mask?.(n, e.options) ?? null,
484
+ maskable: () => typeof t.mask == "function"
485
+ };
486
+ Object.defineProperty(this.controller, "formatter", {
487
+ get() {
488
+ return n;
489
+ },
490
+ configurable: !0
491
+ });
492
+ }
493
+ }, U = (e, t) => new H(e, t);
494
+ //#endregion
495
+ //#region src/plumbers/plumber/date.js
496
+ function W(e) {
497
+ return e instanceof Date && !isNaN(e);
498
+ }
499
+ function G(...e) {
500
+ if (e.length === 0) throw "Missing values to parse as date";
501
+ if (e.length === 1) {
502
+ let t = new Date(e[0]);
503
+ if (e[0] && W(t)) return t;
504
+ } else {
505
+ let t = new Date(...e);
506
+ if (W(t)) return t;
507
+ }
508
+ }
509
+ //#endregion
510
+ //#region src/plumbers/calendar.js
511
+ var K = 7, q = {
270
512
  locales: ["default"],
271
513
  today: "",
272
514
  day: null,
@@ -281,15 +523,15 @@ var ie = {
281
523
  disabledYears: [],
282
524
  firstDayOfWeek: 0,
283
525
  onNavigated: "navigated"
284
- }, ae = class extends A {
526
+ }, xe = class extends j {
285
527
  constructor(e, t = {}) {
286
528
  super(e, t);
287
- let n = Object.assign({}, M, t), { onNavigated: r, since: i, till: a, firstDayOfWeek: o } = n;
288
- this.onNavigated = r, this.since = k(i), this.till = k(a), this.firstDayOfWeek = 0 <= o && o < 7 ? o : M.firstDayOfWeek;
529
+ let n = Object.assign({}, q, t), { onNavigated: r, since: i, till: a, firstDayOfWeek: o } = n;
530
+ this.onNavigated = r, this.since = G(i), this.till = G(a), this.firstDayOfWeek = 0 <= o && o < 7 ? o : q.firstDayOfWeek;
289
531
  let { disabledDates: s, disabledWeekdays: c, disabledDays: l, disabledMonths: u, disabledYears: d } = n;
290
532
  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 : [];
291
533
  let { today: f, day: p, month: m, year: h } = n;
292
- 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();
534
+ this.now = G(f) || /* @__PURE__ */ new Date(), typeof h == "number" && typeof m == "number" && typeof p == "number" ? this.current = G(h, m, p) : this.current = this.now, this.build(), this.enhance();
293
535
  }
294
536
  build() {
295
537
  this.daysOfWeek = this.buildDaysOfWeek(), this.daysOfMonth = this.buildDaysOfMonth(), this.monthsOfYear = this.buildMonthsOfYear();
@@ -325,7 +567,7 @@ var ie = {
325
567
  let a = new Date(t, e, i);
326
568
  n.push(r(a));
327
569
  }
328
- let s = n.length % j, c = s === 0 ? 0 : j - s;
570
+ let s = n.length % K, c = s === 0 ? 0 : K - s;
329
571
  for (let i = 1; i <= c; i++) {
330
572
  let a = new Date(t, e + 1, i);
331
573
  n.push(r(a));
@@ -350,18 +592,18 @@ var ie = {
350
592
  return this.now;
351
593
  }
352
594
  set today(e) {
353
- if (!O(e)) return;
595
+ if (!W(e)) return;
354
596
  let t = this.month ? this.month : e.getMonth(), n = this.year ? this.year : e.getFullYear(), r = t == e.getMonth() && n == e.getFullYear(), i = this.hasDayValue ? this.day : r ? e.getDate() : 1;
355
597
  this.now = new Date(n, t, i).toISOString();
356
598
  }
357
599
  get current() {
358
- return typeof this.year == "number" && typeof this.month == "number" && typeof this.day == "number" ? k(this.year, this.month, this.day) : null;
600
+ return typeof this.year == "number" && typeof this.month == "number" && typeof this.day == "number" ? G(this.year, this.month, this.day) : null;
359
601
  }
360
602
  set current(e) {
361
- O(e) && (this.day = e.getDate(), this.month = e.getMonth(), this.year = e.getFullYear());
603
+ W(e) && (this.day = e.getDate(), this.month = e.getMonth(), this.year = e.getFullYear());
362
604
  }
363
605
  navigate = async (e) => {
364
- if (!O(e)) return;
606
+ if (!W(e)) return;
365
607
  let t = this.current, n = e.toISOString(), r = t.toISOString();
366
608
  this.dispatch("navigate", { detail: {
367
609
  from: r,
@@ -392,7 +634,7 @@ var ie = {
392
634
  await this.navigate(n);
393
635
  };
394
636
  isDisabled = (e) => {
395
- if (!O(e)) return !1;
637
+ if (!W(e)) return !1;
396
638
  if (this.disabledDates.length) {
397
639
  let t = e.getTime();
398
640
  for (let e of this.disabledDates) if (t === new Date(e).getTime()) return !0;
@@ -422,7 +664,7 @@ var ie = {
422
664
  return !1;
423
665
  };
424
666
  isWithinRange = (e) => {
425
- if (!O(e)) return !1;
667
+ if (!W(e)) return !1;
426
668
  let t = !0;
427
669
  return this.since && (t &&= e >= this.since), this.till && (t &&= e <= this.till), t;
428
670
  };
@@ -485,84 +727,41 @@ var ie = {
485
727
  };
486
728
  } });
487
729
  }
488
- }, oe = (e, t) => new ae(e, t), se = class extends A {
489
- constructor(e, t = {}) {
490
- super(e, t), this.debounceTimer = null, this.abortController = null;
491
- }
492
- fuzzyFilter(e, t) {
493
- let n = t.toLowerCase(), r = 0;
494
- return e.querySelectorAll("[role=\"option\"]").forEach((e) => {
495
- let t = this.fuzzyMatch(n, e.textContent.trim().toLowerCase());
496
- e.hidden = !t, t && r++;
497
- }), r;
498
- }
499
- fuzzyMatch(e, t) {
500
- let n = 0;
501
- for (let r = 0; r < t.length && n < e.length; r++) t[r] === e[n] && n++;
502
- return n === e.length;
503
- }
504
- scheduleFetch(e, t, n) {
505
- clearTimeout(this.debounceTimer), this.debounceTimer = setTimeout(() => this.fetch(e, n), t);
506
- }
507
- async fetch(e, { url: t, field: n, onLoading: r, onLoaded: i, onError: a }) {
508
- this.abortController?.abort(), this.abortController = new AbortController(), r?.(!0);
509
- let o = new URL(t, window.location.href);
510
- o.searchParams.set(n, e);
511
- try {
512
- let e = await fetch(o, {
513
- signal: this.abortController.signal,
514
- headers: {
515
- Accept: "text/html",
516
- "X-Requested-With": "XMLHttpRequest"
517
- }
518
- });
519
- if (!e.ok) throw Error(`${e.status}`);
520
- i?.(await e.text());
521
- } catch (e) {
522
- e.name !== "AbortError" && a?.(e);
523
- } finally {
524
- r?.(!1);
525
- }
526
- }
527
- cancel() {
528
- clearTimeout(this.debounceTimer), this.abortController?.abort();
529
- }
530
- }, ce = (e, t) => new se(e, t), N = {
730
+ }, Se = (e, t) => new xe(e, t), J = {
531
731
  content: null,
532
732
  url: "",
533
733
  reload: "never",
534
734
  stale: 3600,
535
735
  onLoad: "canLoad",
536
- onLoading: "contentLoading",
537
736
  onLoaded: "contentLoaded"
538
- }, le = class extends A {
737
+ }, Ce = class extends j {
539
738
  constructor(e, t = {}) {
540
739
  super(e, t);
541
- let n = Object.assign({}, N, t), { content: r, url: i, reload: a, stale: o } = n;
542
- this.content = r, this.url = i, this.reload = typeof a == "string" ? a : N.reload, this.stale = typeof o == "number" ? o : N.stale;
543
- let { onLoad: s, onLoading: c, onLoaded: l } = n;
544
- this.onLoad = s, this.onLoading = c, this.onLoaded = l, this.enhance();
740
+ let n = Object.assign({}, J, t), { content: r, url: i, reload: a, stale: o } = n;
741
+ this.content = r, this.url = i, this.reload = typeof a == "string" ? a : J.reload, this.stale = typeof o == "number" ? o : J.stale;
742
+ let { onLoad: s, onLoaded: c } = n;
743
+ this.onLoad = s, this.onLoaded = c, this._requestor = new w(), this.enhance();
545
744
  }
546
745
  get reloadable() {
547
746
  switch (this.reload) {
548
747
  case "never": return !1;
549
748
  case "always": return !0;
550
749
  default: {
551
- let e = k(this.loadedAt);
750
+ let e = G(this.loadedAt);
552
751
  return e && /* @__PURE__ */ new Date() - e > this.stale * 1e3;
553
752
  }
554
753
  }
555
754
  }
556
755
  contentLoadable = ({ url: e }) => !!e;
557
- contentLoading = async ({ url: e }) => e ? await this.remoteContentLoader(e) : await this.contentLoader();
558
756
  contentLoader = async () => "";
559
- remoteContentLoader = async (e) => (await fetch(e)).text();
757
+ remoteContentLoader = async (e) => (await this._requestor.request(e)).text();
560
758
  load = async () => {
561
759
  if (this.loadedAt && !this.reloadable) return;
562
760
  let e = this.findCallback(this.onLoad), t = await this.awaitCallback(e || this.contentLoadable, { url: this.url });
563
761
  if (this.dispatch("load", { detail: { url: this.url } }), !t) return;
762
+ this.dispatch("loading", { detail: { url: this.url } });
564
763
  let n = this.url ? await this.remoteContentLoader(this.url) : await this.contentLoader();
565
- this.dispatch("loading", { detail: { url: this.url } }), n && (await this.awaitCallback(this.onLoaded, {
764
+ n && (await this.awaitCallback(this.onLoaded, {
566
765
  url: this.url,
567
766
  content: n
568
767
  }), this.loadedAt = (/* @__PURE__ */ new Date()).getTime(), this.dispatch("loaded", { detail: {
@@ -574,37 +773,34 @@ var ie = {
574
773
  let e = this;
575
774
  Object.assign(this.controller, { load: e.load.bind(e) });
576
775
  }
577
- }, ue = (e, t) => new le(e, t), de = {
776
+ }, we = (e, t) => new Ce(e, t), Y = class extends j {
777
+ observe(e) {
778
+ this._handler = e, this.events.forEach((t) => window.addEventListener(t, e, !0));
779
+ }
780
+ unobserve() {
781
+ this._handler && this.events.forEach((e) => window.removeEventListener(e, this._handler, !0));
782
+ }
783
+ enhance() {
784
+ let e = this, t = this.controller.disconnect?.bind(this.controller) || (() => {});
785
+ this.controller.disconnect = () => {
786
+ e.unobserve(), t();
787
+ };
788
+ }
789
+ }, Te = {
578
790
  trigger: null,
579
791
  events: ["click"],
580
792
  onDismissed: "dismissed"
581
- }, fe = class extends A {
793
+ }, Ee = class extends Y {
582
794
  constructor(e, t = {}) {
583
795
  super(e, t);
584
- let { trigger: n, events: r, onDismissed: i } = Object.assign({}, de, t);
585
- this.onDismissed = i, this.trigger = n || this.element, this.events = r, this.enhance(), this.observe();
796
+ let { trigger: n, events: r, onDismissed: i } = Object.assign({}, Te, t);
797
+ this.onDismissed = i, this.trigger = n || this.element, this.events = r, this.enhance(), this.observe(this.dismiss);
586
798
  }
587
799
  dismiss = async (e) => {
588
800
  let { target: t } = e;
589
801
  t instanceof HTMLElement && (this.element.contains(t) || this.visible && (this.dispatch("dismiss"), await this.awaitCallback(this.onDismissed, { target: this.trigger }), this.dispatch("dismissed")));
590
802
  };
591
- observe() {
592
- this.events.forEach((e) => {
593
- window.addEventListener(e, this.dismiss, !0);
594
- });
595
- }
596
- unobserve() {
597
- this.events.forEach((e) => {
598
- window.removeEventListener(e, this.dismiss, !0);
599
- });
600
- }
601
- enhance() {
602
- let e = this, t = e.controller.disconnect.bind(e.controller);
603
- Object.assign(this.controller, { disconnect: () => {
604
- e.unobserve(), t();
605
- } });
606
- }
607
- }, P = (e, t) => new fe(e, t), F = {
803
+ }, X = (e, t) => new Ee(e, t), De = {
608
804
  anchor: null,
609
805
  events: ["click"],
610
806
  placement: "bottom",
@@ -612,15 +808,15 @@ var ie = {
612
808
  onFlipped: "flipped",
613
809
  ariaRole: null,
614
810
  respectMotion: !0
615
- }, I = class extends A {
811
+ }, Oe = class extends Y {
616
812
  constructor(e, t = {}) {
617
813
  super(e, t);
618
- let { anchor: n, events: r, placement: i, alignment: a, onFlipped: o, ariaRole: s, respectMotion: c } = Object.assign({}, F, t);
814
+ let { anchor: n, events: r, placement: i, alignment: a, onFlipped: o, ariaRole: s, respectMotion: c } = Object.assign({}, De, t);
619
815
  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({
620
816
  trigger: this.anchor,
621
817
  target: this.element,
622
818
  role: this.ariaRole
623
- }), this.enhance(), this.observe();
819
+ }), this.enhance(), this.observe(this.flip);
624
820
  }
625
821
  flip = async () => {
626
822
  if (!this.visible) return;
@@ -634,7 +830,7 @@ var ie = {
634
830
  }), this.dispatch("flipped", { detail: { placement: e } });
635
831
  };
636
832
  flippedRect(e, t) {
637
- let n = this.quadrumRect(e, D()), r = [this.placement, T[this.placement]], i = {};
833
+ let n = this.quadrumRect(e, k()), r = [this.placement, D[this.placement]], i = {};
638
834
  for (; !Object.keys(i).length && r.length > 0;) {
639
835
  let a = r.shift();
640
836
  if (!this.biggerRectThan(n[a], t)) continue;
@@ -645,25 +841,25 @@ var ie = {
645
841
  }
646
842
  quadrumRect(e, t) {
647
843
  return {
648
- left: E({
844
+ left: O({
649
845
  x: t.x,
650
846
  y: t.y,
651
847
  width: e.x - t.x,
652
848
  height: t.height
653
849
  }),
654
- right: E({
850
+ right: O({
655
851
  x: e.x + e.width,
656
852
  y: t.y,
657
853
  width: t.width - (e.x + e.width),
658
854
  height: t.height
659
855
  }),
660
- top: E({
856
+ top: O({
661
857
  x: t.x,
662
858
  y: t.y,
663
859
  width: t.width,
664
860
  height: e.y - t.y
665
861
  }),
666
- bottom: E({
862
+ bottom: O({
667
863
  x: t.x,
668
864
  y: e.y + e.height,
669
865
  width: t.width,
@@ -673,25 +869,25 @@ var ie = {
673
869
  }
674
870
  quadrumPlacement(e, t, n) {
675
871
  switch (t) {
676
- case "top": return E({
872
+ case "top": return O({
677
873
  x: n.x,
678
874
  y: e.y - n.height,
679
875
  width: n.width,
680
876
  height: n.height
681
877
  });
682
- case "bottom": return E({
878
+ case "bottom": return O({
683
879
  x: n.x,
684
880
  y: e.y + e.height,
685
881
  width: n.width,
686
882
  height: n.height
687
883
  });
688
- case "left": return E({
884
+ case "left": return O({
689
885
  x: e.x - n.width,
690
886
  y: n.y,
691
887
  width: n.width,
692
888
  height: n.height
693
889
  });
694
- case "right": return E({
890
+ case "right": return O({
695
891
  x: e.x + e.width,
696
892
  y: n.y,
697
893
  width: n.width,
@@ -705,7 +901,7 @@ var ie = {
705
901
  case "top":
706
902
  case "bottom": {
707
903
  let t = e.x;
708
- return this.alignment === "center" ? t = e.x + e.width / 2 - n.width / 2 : this.alignment === "end" && (t = e.x + e.width - n.width), E({
904
+ return this.alignment === "center" ? t = e.x + e.width / 2 - n.width / 2 : this.alignment === "end" && (t = e.x + e.width - n.width), O({
709
905
  x: t,
710
906
  y: n.y,
711
907
  width: n.width,
@@ -715,7 +911,7 @@ var ie = {
715
911
  case "left":
716
912
  case "right": {
717
913
  let t = e.y;
718
- return this.alignment === "center" ? t = e.y + e.height / 2 - n.height / 2 : this.alignment === "end" && (t = e.y + e.height - n.height), E({
914
+ return this.alignment === "center" ? t = e.y + e.height / 2 - n.height / 2 : this.alignment === "end" && (t = e.y + e.height - n.height), O({
719
915
  x: n.x,
720
916
  y: t,
721
917
  width: n.width,
@@ -728,215 +924,10 @@ var ie = {
728
924
  biggerRectThan(e, t) {
729
925
  return e.height >= t.height && e.width >= t.width;
730
926
  }
731
- observe() {
732
- this.events.forEach((e) => {
733
- window.addEventListener(e, this.flip, !0);
734
- });
735
- }
736
- unobserve() {
737
- this.events.forEach((e) => {
738
- window.removeEventListener(e, this.flip, !0);
739
- });
740
- }
741
927
  enhance() {
742
- let e = this, t = e.controller.disconnect.bind(e.controller);
743
- Object.assign(this.controller, {
744
- disconnect: () => {
745
- e.unobserve(), t();
746
- },
747
- flip: e.flip.bind(e)
748
- });
749
- }
750
- }, L = (e, t) => new I(e, t), R = {
751
- normalize(e) {
752
- return typeof e == "string" ? e : "";
753
- },
754
- validate() {
755
- return !0;
756
- }
757
- };
758
- //#endregion
759
- //#region src/plumbers/input_format/formatters/credit_card.js
760
- function z(e) {
761
- let t = 0, n = !1;
762
- for (let r = e.length - 1; r >= 0; r--) {
763
- let i = parseInt(e[r], 10);
764
- n && (i *= 2, i > 9 && (i -= 9)), t += i, n = !n;
765
- }
766
- return t % 10 == 0;
767
- }
768
- var B = /\D/g, V = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
769
- normalize(e) {
770
- return typeof e == "string" ? e.replace(B, "") : "";
771
- },
772
- validate(e) {
773
- return typeof e != "string" || !V.test(e) ? !1 : z(e);
774
- },
775
- format(e) {
776
- return typeof e == "string" ? e.replace(pe, "$1 ") : "";
777
- }
778
- }, H = { 1: 10 }, U = /\D/g, he = /^\+\d{7,15}$/, ge = {
779
- normalize(e) {
780
- if (typeof e != "string") return "";
781
- let t = e.trimStart().startsWith("+"), n = e.replace(U, "");
782
- return t ? `+${n}` : n;
783
- },
784
- validate(e) {
785
- if (typeof e != "string") return !1;
786
- if (he.test(e)) return !0;
787
- let t = e.replace(U, "");
788
- return Object.values(H).includes(t.length);
789
- },
790
- format(e) {
791
- if (typeof e != "string") return "";
792
- let t = e.replace(U, "");
793
- for (let [e, n] of Object.entries(H)) {
794
- if (t.length === n) return `(${t.slice(0, 3)}) ${t.slice(3, 6)}-${t.slice(6)}`;
795
- let r = n + e.length;
796
- if (t.length === r && t.startsWith(e)) {
797
- let n = t.slice(e.length);
798
- return `+${e} (${n.slice(0, 3)}) ${n.slice(3, 6)}-${n.slice(6)}`;
799
- }
800
- }
801
- return e;
928
+ super.enhance(), this.controller.flip = this.flip;
802
929
  }
803
- }, _e = /[^\d.,-]/g, ve = /^-?\d+(\.\d+)?$/, ye = {
804
- normalize(e) {
805
- if (typeof e != "string") return "";
806
- let t = e.replace(_e, "");
807
- if (!t) return "";
808
- let n = t.lastIndexOf(","), r = t.lastIndexOf(".");
809
- 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;
810
- },
811
- validate(e) {
812
- return typeof e == "string" ? ve.test(e) : !1;
813
- },
814
- format(e, t = {}) {
815
- if (typeof e != "string") return "";
816
- let n = parseFloat(e);
817
- if (isNaN(n)) return e;
818
- let r = t.locale || "en-US", i = t.currency || "USD", a = t.fractionDigits === void 0 ? {} : {
819
- minimumFractionDigits: t.fractionDigits,
820
- maximumFractionDigits: t.fractionDigits
821
- };
822
- try {
823
- return new Intl.NumberFormat(r, {
824
- style: "currency",
825
- currency: i,
826
- ...a
827
- }).format(n);
828
- } catch {
829
- return e;
830
- }
831
- }
832
- }, W = /^\d{4}-\d{2}-\d{2}$/, be = /^(\d{1,4})[/\-.](\d{1,2})[/\-.](\d{1,4})$/, xe = /\D/g, G = {
833
- normalize(e) {
834
- if (typeof e != "string") return "";
835
- let t = e.trim();
836
- if (W.test(t)) return t;
837
- let n = t.match(be);
838
- if (n) {
839
- let [, e, t, r] = n;
840
- if (e.length === 4) return `${e}-${t.padStart(2, "0")}-${r.padStart(2, "0")}`;
841
- if (r.length === 4) return `${r}-${e.padStart(2, "0")}-${t.padStart(2, "0")}`;
842
- }
843
- let r = t.replace(xe, "");
844
- if (r.length === 8) {
845
- let e = parseInt(r.slice(0, 4), 10);
846
- 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)}`;
847
- }
848
- return t;
849
- },
850
- validate(e) {
851
- if (typeof e != "string") return !1;
852
- let t = G.normalize(e);
853
- if (!W.test(t)) return !1;
854
- let n = /* @__PURE__ */ new Date(`${t}T00:00:00Z`);
855
- return !isNaN(n.getTime()) && n.toISOString().startsWith(t);
856
- },
857
- format(e, t = {}) {
858
- if (typeof e != "string") return "";
859
- let n = /* @__PURE__ */ new Date(`${e}T00:00:00Z`);
860
- if (isNaN(n.getTime())) return e;
861
- let r = t.locale || "en-US";
862
- try {
863
- return new Intl.DateTimeFormat(r, {
864
- year: t.year || "numeric",
865
- month: t.month || "2-digit",
866
- day: t.day || "2-digit",
867
- timeZone: t.timeZone || "UTC"
868
- }).format(n);
869
- } catch {
870
- return e;
871
- }
872
- }
873
- }, Se = /^([01]?\d|2[0-3]):([0-5]\d)$/, K = {
874
- normalize(e) {
875
- if (typeof e != "string") return "";
876
- let t = e.trim();
877
- if (Se.test(t)) {
878
- let [e, n] = t.split(":");
879
- return `${String(parseInt(e, 10)).padStart(2, "0")}:${n}`;
880
- }
881
- let n = t.match(/^(\d{1,2}):(\d{2})\s*(AM|PM)$/i);
882
- if (n) {
883
- let e = parseInt(n[1], 10), t = n[2];
884
- return e = n[3].toUpperCase() === "AM" ? e === 12 ? 0 : e : e === 12 ? 12 : e + 12, e > 23 || parseInt(t, 10) > 59 ? "" : `${String(e).padStart(2, "0")}:${t}`;
885
- }
886
- return "";
887
- },
888
- validate(e) {
889
- return K.normalize(e) !== "";
890
- },
891
- format(e, t = {}) {
892
- if (typeof e != "string") return "";
893
- let n = e.match(/^(\d{2}):(\d{2})$/);
894
- if (!n) return e;
895
- let r = parseInt(n[1], 10), i = n[2];
896
- if (t.format === "h24") return `${String(r).padStart(2, "0")}:${i}`;
897
- let a = r < 12 ? "AM" : "PM";
898
- return `${r % 12 || 12}:${i} ${a}`;
899
- }
900
- }, q = {
901
- PLAIN: "plain",
902
- CREDIT_CARD: "creditCard",
903
- PHONE: "phone",
904
- CURRENCY: "currency",
905
- DATE: "date",
906
- TIME: "time"
907
- }, J = new Map([
908
- [q.PLAIN, R],
909
- [q.CREDIT_CARD, me],
910
- [q.PHONE, ge],
911
- [q.CURRENCY, ye],
912
- [q.DATE, G],
913
- [q.TIME, K]
914
- ]), Y = {
915
- type: q.PLAIN,
916
- options: {}
917
- }, Ce = class extends A {
918
- static register(e, t) {
919
- J.set(e, t);
920
- }
921
- constructor(e, t = {}) {
922
- super(e, t), this.type = t.type ?? Y.type, this.options = t.options ?? Y.options, this.enhance();
923
- }
924
- enhance() {
925
- let e = this, t = J.get(e.type) ?? J.get(q.PLAIN), n = {
926
- normalize: (n) => t.normalize?.(n, e.options) ?? (typeof n == "string" ? n : ""),
927
- validate: (n) => t.validate?.(n, e.options) ?? !0,
928
- format: (n) => t.format?.(n, e.options) ?? (typeof n == "string" ? n : ""),
929
- mask: (n) => t.mask?.(n, e.options) ?? null,
930
- maskable: () => typeof t.mask == "function"
931
- };
932
- Object.defineProperty(this.controller, "inputFormat", {
933
- get() {
934
- return n;
935
- },
936
- configurable: !0
937
- });
938
- }
939
- }, X = (e, t) => new Ce(e, t), we = {
930
+ }, ke = (e, t) => new Oe(e, t), Ae = {
940
931
  events: ["resize"],
941
932
  boundaries: [
942
933
  "top",
@@ -945,11 +936,11 @@ var B = /\D/g, V = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
945
936
  ],
946
937
  onShifted: "shifted",
947
938
  respectMotion: !0
948
- }, Te = class extends A {
939
+ }, je = class extends Y {
949
940
  constructor(e, t = {}) {
950
941
  super(e, t);
951
- let { onShifted: n, events: r, boundaries: i, respectMotion: a } = Object.assign({}, we, t);
952
- 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();
942
+ let { onShifted: n, events: r, boundaries: i, respectMotion: a } = Object.assign({}, Ae, t);
943
+ 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);
953
944
  }
954
945
  shift = async () => {
955
946
  if (!this.visible) return;
@@ -958,14 +949,14 @@ var B = /\D/g, V = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
958
949
  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 });
959
950
  };
960
951
  overflowRect(e, t) {
961
- let n = {}, r = D(), i = E({
952
+ let n = {}, r = k(), i = O({
962
953
  x: e.x - t.x,
963
954
  y: e.y - t.y,
964
955
  width: e.width,
965
956
  height: e.height
966
957
  });
967
958
  for (let e of this.boundaries) {
968
- let t = this.directionDistance(i, e, r), a = T[e];
959
+ let t = this.directionDistance(i, e, r), a = D[e];
969
960
  t < 0 ? i[a] + t >= r[a] && !n[a] && (n[e] = t) : n[e] = "";
970
961
  }
971
962
  return n;
@@ -994,42 +985,26 @@ var B = /\D/g, V = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
994
985
  y: 0
995
986
  };
996
987
  }
997
- observe() {
998
- this.events.forEach((e) => {
999
- window.addEventListener(e, this.shift, !0);
1000
- });
1001
- }
1002
- unobserve() {
1003
- this.events.forEach((e) => {
1004
- window.removeEventListener(e, this.shift, !0);
1005
- });
1006
- }
1007
988
  enhance() {
1008
- let e = this, t = e.controller.disconnect.bind(e.controller);
1009
- Object.assign(this.controller, {
1010
- disconnect: () => {
1011
- e.unobserve(), t();
1012
- },
1013
- shift: e.shift.bind(e)
1014
- });
989
+ super.enhance(), this.controller.shift = this.shift;
1015
990
  }
1016
- }, Ee = (e, t) => new Te(e, t), Z = {
991
+ }, Me = (e, t) => new je(e, t), Z = {
1017
992
  visibility: "visibility",
1018
993
  onShown: "shown",
1019
994
  onHidden: "hidden"
1020
- }, De = class extends A {
995
+ }, Ne = class extends j {
1021
996
  constructor(e, t = {}) {
1022
997
  let { visibility: n, onShown: r, onHidden: i, activator: a } = Object.assign({}, Z, t), o = typeof n == "string" ? n : Z.namespace, s = typeof t.visible == "string" ? t.visible : "isVisible";
1023
998
  (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));
1024
999
  }
1025
1000
  isVisible(e) {
1026
1001
  if (!(e instanceof HTMLElement)) return !1;
1027
- let t = w.hiddenClass;
1002
+ let t = A.hiddenClass;
1028
1003
  return t ? !e.classList.contains(t) : !e.hasAttribute("hidden");
1029
1004
  }
1030
1005
  toggle(e, t) {
1031
1006
  if (!(e instanceof HTMLElement)) return;
1032
- let n = w.hiddenClass;
1007
+ let n = A.hiddenClass;
1033
1008
  n ? t ? e.classList.remove(n) : e.classList.add(n) : t ? e.removeAttribute("hidden") : e.setAttribute("hidden", !0);
1034
1009
  }
1035
1010
  activate(e) {
@@ -1052,9 +1027,13 @@ var B = /\D/g, V = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
1052
1027
  return t;
1053
1028
  } });
1054
1029
  }
1055
- }, Q = (e, t) => new De(e, t), $ = class extends e {
1030
+ }, Q = (e, t) => new Ne(e, t), Pe = class extends e {
1056
1031
  static targets = ["daysOfWeek", "daysOfMonth"];
1057
- static classes = ["dayOfWeek", "dayOfMonth"];
1032
+ static classes = [
1033
+ "dayOfWeek",
1034
+ "dayOfMonth",
1035
+ "week"
1036
+ ];
1058
1037
  static values = {
1059
1038
  locales: {
1060
1039
  type: Array,
@@ -1074,7 +1053,7 @@ var B = /\D/g, V = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
1074
1053
  }
1075
1054
  };
1076
1055
  initialize() {
1077
- oe(this);
1056
+ Se(this);
1078
1057
  }
1079
1058
  connect() {
1080
1059
  this.draw();
@@ -1097,7 +1076,7 @@ var B = /\D/g, V = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
1097
1076
  r.setAttribute("role", "columnheader"), r.title = n.long, this.hasDayOfWeekClass && r.classList.add(...this.dayOfWeekClasses), t.push(r);
1098
1077
  }
1099
1078
  let n = document.createElement("div");
1100
- n.setAttribute("role", "row"), n.replaceChildren(...t), this.daysOfWeekTarget.replaceChildren(n);
1079
+ n.setAttribute("role", "row"), this.hasWeekClass && n.classList.add(...this.weekClasses), n.replaceChildren(...t), this.daysOfWeekTarget.replaceChildren(n);
1101
1080
  }
1102
1081
  drawDaysOfMonth() {
1103
1082
  if (!this.hasDaysOfMonthTarget) return;
@@ -1114,13 +1093,13 @@ var B = /\D/g, V = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
1114
1093
  let r = [];
1115
1094
  for (let e = 0; e < n.length; e += 7) {
1116
1095
  let t = document.createElement("div");
1117
- t.setAttribute("role", "row");
1096
+ t.setAttribute("role", "row"), this.hasWeekClass && t.classList.add(...this.weekClasses);
1118
1097
  for (let r of n.slice(e, e + 7)) r.setAttribute("role", "gridcell"), t.appendChild(r);
1119
1098
  r.push(t);
1120
1099
  }
1121
1100
  this.daysOfMonthTarget.replaceChildren(...r);
1122
1101
  }
1123
- }, Oe = class extends e {
1102
+ }, Fe = class extends e {
1124
1103
  onSelect(e) {
1125
1104
  if (!(e.target instanceof HTMLElement)) return;
1126
1105
  e.preventDefault();
@@ -1129,18 +1108,18 @@ var B = /\D/g, V = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
1129
1108
  this.dispatch("selecting", { target: t });
1130
1109
  let n = e.target instanceof HTMLTimeElement ? e.target : e.target.querySelector("time");
1131
1110
  if (!n) return console.error(`unable to locate time element within ${t}`);
1132
- let r = k(n.dateTime);
1111
+ let r = G(n.dateTime);
1133
1112
  if (!r) return console.error(`unable to parse ${n.dateTime} found within the time element`);
1134
1113
  this.select(r.toISOString());
1135
1114
  }
1136
1115
  select(e) {
1137
- let t = k(e);
1116
+ let t = G(e);
1138
1117
  t && this.dispatch("selected", { detail: {
1139
1118
  epoch: t.getTime(),
1140
1119
  iso: e
1141
1120
  } });
1142
1121
  }
1143
- }, ke = class extends e {
1122
+ }, Ie = class extends e {
1144
1123
  static targets = ["source"];
1145
1124
  static values = { type: {
1146
1125
  type: String,
@@ -1170,7 +1149,7 @@ var B = /\D/g, V = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
1170
1149
  });
1171
1150
  }
1172
1151
  }
1173
- }, Ae = class extends e {
1152
+ }, Le = class extends e {
1174
1153
  static targets = [
1175
1154
  "previous",
1176
1155
  "next",
@@ -1203,7 +1182,7 @@ var B = /\D/g, V = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
1203
1182
  }
1204
1183
  async calendarMonthOutletConnected() {
1205
1184
  if (this.dateValue) {
1206
- let e = k(this.dateValue);
1185
+ let e = G(this.dateValue);
1207
1186
  e && await this.calendarMonthOutlet.calendar.navigate(e);
1208
1187
  }
1209
1188
  this.draw();
@@ -1250,7 +1229,7 @@ var B = /\D/g, V = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
1250
1229
  let { year: e } = this.calendarMonthOutlet.calendar;
1251
1230
  this.yearTarget.textContent = new Intl.DateTimeFormat(this.localesValue, { year: this.yearFormatValue }).format(new Date(e, 0));
1252
1231
  }
1253
- }, je = class extends e {
1232
+ }, $ = class extends e {
1254
1233
  static targets = [
1255
1234
  "listbox",
1256
1235
  "loading",
@@ -1271,7 +1250,7 @@ var B = /\D/g, V = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
1271
1250
  }
1272
1251
  };
1273
1252
  initialize() {
1274
- this.comboboxDropdown = ce(this);
1253
+ this._requestor = new w();
1275
1254
  }
1276
1255
  onSelect(e) {
1277
1256
  let t = e.target.closest("[role=\"option\"]");
@@ -1307,17 +1286,15 @@ var B = /\D/g, V = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
1307
1286
  !i || i === n || (t.forEach((e) => e.setAttribute("aria-selected", "false")), i.setAttribute("aria-selected", "true"), i.scrollIntoView({ block: "nearest" }));
1308
1287
  }
1309
1288
  filter(e) {
1310
- if (this.urlValue) this.comboboxDropdown.scheduleFetch(e, this.delayValue, {
1311
- url: this.urlValue,
1312
- field: this.fieldValue,
1313
- onLoading: (e) => this.setLoading(e),
1314
- onLoaded: (e) => {
1289
+ if (this.urlValue) {
1290
+ let t = new URL(this.urlValue, window.location.href);
1291
+ t.searchParams.set(this.fieldValue, e), this.setLoading(!0), this._requestor.schedule(() => this._requestor.request(t).then((e) => e.text()).then((e) => {
1315
1292
  this.listboxTarget.innerHTML = e, this.setEmpty(this.listboxTarget.querySelectorAll("[role=\"option\"]").length === 0);
1316
- },
1317
- onError: (e) => console.error("[combobox-dropdown] fetch failed", e)
1318
- });
1319
- else {
1320
- let t = this.comboboxDropdown.fuzzyFilter(this.listboxTarget, e);
1293
+ }).catch((e) => {
1294
+ e.name !== "AbortError" && console.error("[combobox-dropdown] fetch failed", e);
1295
+ }).finally(() => this.setLoading(!1)), this.delayValue);
1296
+ } else {
1297
+ let t = E(this.listboxTarget, e);
1321
1298
  this.setEmpty(t === 0);
1322
1299
  }
1323
1300
  }
@@ -1331,9 +1308,9 @@ var B = /\D/g, V = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
1331
1308
  this.hasEmptyTarget && (this.emptyTarget.hidden = !e);
1332
1309
  }
1333
1310
  disconnect() {
1334
- this.comboboxDropdown.cancel();
1311
+ this._requestor.cancel();
1335
1312
  }
1336
- }, Me = class extends e {
1313
+ }, Re = class extends e {
1337
1314
  static targets = [
1338
1315
  "hour",
1339
1316
  "minute",
@@ -1369,12 +1346,12 @@ var B = /\D/g, V = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
1369
1346
  selectedValue(e) {
1370
1347
  return e?.querySelector("[aria-selected=\"true\"]")?.dataset.value ?? null;
1371
1348
  }
1372
- }, Ne = class extends e {
1349
+ }, ze = class extends e {
1373
1350
  static targets = ["trigger"];
1374
1351
  connect() {
1375
- P(this, { trigger: this.hasTriggerTarget ? this.triggerTarget : null });
1352
+ X(this, { trigger: this.hasTriggerTarget ? this.triggerTarget : null });
1376
1353
  }
1377
- }, Pe = class extends e {
1354
+ }, Be = class extends e {
1378
1355
  static targets = ["anchor", "reference"];
1379
1356
  static values = {
1380
1357
  placement: {
@@ -1399,7 +1376,7 @@ var B = /\D/g, V = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
1399
1376
  console.error("FlipperController requires an anchor target. Add data-flipper-target=\"anchor\" to your element.");
1400
1377
  return;
1401
1378
  }
1402
- L(this, {
1379
+ ke(this, {
1403
1380
  element: this.referenceTarget,
1404
1381
  anchor: this.anchorTarget,
1405
1382
  placement: this.placementValue,
@@ -1407,7 +1384,7 @@ var B = /\D/g, V = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
1407
1384
  ariaRole: this.roleValue
1408
1385
  });
1409
1386
  }
1410
- }, Fe = class extends e {
1387
+ }, Ve = class extends e {
1411
1388
  static targets = [
1412
1389
  "trigger",
1413
1390
  "popover",
@@ -1421,17 +1398,32 @@ var B = /\D/g, V = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
1421
1398
  }
1422
1399
  };
1423
1400
  static outlets = ["combobox-dropdown"];
1424
- open() {
1425
- this.hasPopoverTarget && (this.popoverTarget.hidden = !1, this.hasTriggerTarget && _(this.triggerTarget, !0), this.focusFirstInPopover());
1401
+ connect() {
1402
+ X(this), this.hasPopoverTarget && Q(this, {
1403
+ element: this.popoverTarget,
1404
+ activator: this.hasTriggerTarget ? this.triggerTarget : null
1405
+ });
1426
1406
  }
1427
- close() {
1428
- this.hasPopoverTarget && (this.popoverTarget.hidden = !0, this.hasTriggerTarget && (_(this.triggerTarget, !1), this.triggerTarget.focus()));
1407
+ async dismissed() {
1408
+ await this.close();
1429
1409
  }
1430
- toggle() {
1431
- this.hasPopoverTarget && this.popoverTarget.hidden ? this.open() : this.close();
1410
+ async open() {
1411
+ this.hasPopoverTarget && await this.visibility.show();
1432
1412
  }
1433
- onSelect(e) {
1434
- e.detail?.value !== void 0 && (this.valueValue = e.detail.value), this.close();
1413
+ async close() {
1414
+ this.hasPopoverTarget && await this.visibility.hide();
1415
+ }
1416
+ async toggle() {
1417
+ this.visibility?.visible ? await this.close() : await this.open();
1418
+ }
1419
+ async shown() {
1420
+ this.hasPopoverTarget && i(this.popoverTarget);
1421
+ }
1422
+ async hidden() {
1423
+ this.hasTriggerTarget && this.triggerTarget.focus();
1424
+ }
1425
+ async onSelect(e) {
1426
+ e.detail?.value !== void 0 && (this.valueValue = e.detail.value), await this.close();
1435
1427
  }
1436
1428
  onInput(e) {
1437
1429
  if (e.target !== this.triggerTarget) return;
@@ -1445,10 +1437,7 @@ var B = /\D/g, V = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
1445
1437
  valueValueChanged(e) {
1446
1438
  this.hasValueTarget && (this.valueTarget.value = e), this.dispatch("changed", { detail: { value: e } });
1447
1439
  }
1448
- focusFirstInPopover() {
1449
- this.hasPopoverTarget && this.popoverTarget.querySelector("button:not([disabled]), [href], input:not([type=\"hidden\"]):not([disabled]), [tabindex]:not([tabindex=\"-1\"])")?.focus();
1450
- }
1451
- }, Ie = class extends e {
1440
+ }, He = class extends e {
1452
1441
  static targets = ["input", "toggle"];
1453
1442
  static values = {
1454
1443
  type: {
@@ -1465,73 +1454,98 @@ var B = /\D/g, V = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
1465
1454
  }
1466
1455
  };
1467
1456
  connect() {
1468
- X(this, {
1457
+ U(this, {
1469
1458
  type: this.typeValue,
1470
1459
  options: this.optionsValue
1471
1460
  }), this.format(this.readValue()), this.drawToggle();
1472
1461
  }
1473
1462
  typeValueChanged() {
1474
- this.inputFormat && (X(this, {
1463
+ this.formatter && (U(this, {
1475
1464
  type: this.typeValue,
1476
1465
  options: this.optionsValue
1477
1466
  }), this.format(this.readValue()), this.drawToggle());
1478
1467
  }
1479
1468
  optionsValueChanged() {
1480
- this.inputFormat && (X(this, {
1469
+ this.formatter && (U(this, {
1481
1470
  type: this.typeValue,
1482
1471
  options: this.optionsValue
1483
1472
  }), this.format(this.readValue()));
1484
1473
  }
1485
1474
  revealedValueChanged() {
1486
- this.inputFormat && (this.format(this.readValue()), this.drawToggle());
1475
+ this.formatter && (this.format(this.readValue()), this.drawToggle());
1487
1476
  }
1488
1477
  onChange(e) {
1489
1478
  this.format(e?.detail?.value ?? "");
1490
1479
  }
1491
1480
  format(e) {
1492
- this.inputFormat && this.onFormatting(e);
1481
+ this.formatter && this.onFormatting(e);
1493
1482
  }
1494
1483
  toggle() {
1495
- !this.inputFormat.maskable() && this.typeValue !== "password" || (this.revealedValue = !this.revealedValue);
1484
+ !this.formatter.maskable() && this.typeValue !== "password" || (this.revealedValue = !this.revealedValue);
1496
1485
  }
1497
1486
  onPaste(e) {
1498
1487
  let t = e.detail?.text ?? "";
1499
- if (!this.inputFormat || !t) return;
1500
- let n = this.inputFormat.normalize(t);
1501
- this.inputFormat.validate(n) && this.format(n);
1488
+ if (!this.formatter || !t) return;
1489
+ let n = this.formatter.normalize(t);
1490
+ this.formatter.validate(n) && this.format(n);
1502
1491
  }
1503
1492
  drawToggle() {
1504
1493
  if (!this.hasToggleTarget) return;
1505
- let e = this.inputFormat?.maskable() || this.typeValue === "password";
1506
- this.toggleTarget.hidden = !e, e && v(this.toggleTarget, this.revealedValue);
1494
+ let e = this.formatter?.maskable() || this.typeValue === "password";
1495
+ this.toggleTarget.hidden = !e, e && _(this.toggleTarget, this.revealedValue);
1507
1496
  }
1508
1497
  readValue() {
1509
1498
  return this.hasInputTarget ? this.inputTarget instanceof HTMLInputElement ? this.inputTarget.value : this.inputTarget.textContent : "";
1510
1499
  }
1511
1500
  onFormatting(e) {
1512
- if (!this.inputFormat) return;
1501
+ if (!this.formatter) return;
1513
1502
  if (this.typeValue === "password") {
1514
1503
  this.hasInputTarget && (this.inputTarget.type = this.revealedValue ? "text" : "password");
1515
1504
  return;
1516
1505
  }
1517
- let t = this.inputFormat.normalize(e), n = this.revealedValue || !this.inputFormat.maskable() ? this.inputFormat.format(t) : this.inputFormat.mask(t);
1506
+ let t = this.formatter.normalize(e), n = this.revealedValue || !this.formatter.maskable() ? this.formatter.format(t) : this.formatter.mask(t);
1518
1507
  this.hasInputTarget && (this.inputTarget instanceof HTMLInputElement ? this.inputTarget.value = n : this.inputTarget.textContent = n), this.dispatch("formatted", { detail: { value: n } });
1519
1508
  }
1520
- }, Le = class extends e {
1509
+ }, Ue = class extends e {
1510
+ static targets = ["input", "clear"];
1511
+ initialize() {
1512
+ this.onInput = this.draw.bind(this), this.onEscape = this.handleEscape.bind(this);
1513
+ }
1514
+ connect() {
1515
+ this.draw();
1516
+ }
1517
+ inputTargetConnected(e) {
1518
+ e.addEventListener("input", this.onInput), e.addEventListener("keydown", this.onEscape);
1519
+ }
1520
+ inputTargetDisconnected(e) {
1521
+ e.removeEventListener("input", this.onInput), e.removeEventListener("keydown", this.onEscape);
1522
+ }
1523
+ clear() {
1524
+ this.hasInputTarget && (this.inputTarget.value = "", this.draw(), this.inputTarget.focus(), this.inputTarget.dispatchEvent(new Event("input", { bubbles: !0 })));
1525
+ }
1526
+ draw() {
1527
+ !this.hasInputTarget || !this.hasClearTarget || (this.clearTarget.hidden = this.inputTarget.value.length === 0);
1528
+ }
1529
+ handleEscape(e) {
1530
+ e.key === "Escape" && this.inputTarget.value !== "" && (e.preventDefault(), this.clear());
1531
+ }
1532
+ }, We = class extends e {
1521
1533
  static targets = ["modal", "overlay"];
1534
+ initialize() {
1535
+ this.onCancel = this.close.bind(this);
1536
+ }
1522
1537
  connect() {
1523
- if (!this.hasModalTarget) {
1524
- console.error("ModalController requires a modal target. Add data-modal-target=\"modal\" to your element.");
1525
- return;
1526
- }
1527
- this.isNativeDialog = this.modalTarget instanceof HTMLDialogElement, this.isNativeDialog ? (this.modalTarget.addEventListener("cancel", this.close), this.modalTarget.addEventListener("click", this.onBackdropClick)) : (this.focusTrap = new a(this.modalTarget, { escapeDeactivates: !0 }), P(this, { element: this.modalTarget }));
1538
+ this.hasModalTarget || console.error("ModalController requires a modal target. Add data-modal-target=\"modal\" to your element.");
1539
+ }
1540
+ modalTargetConnected(e) {
1541
+ this.isNativeDialog = e instanceof HTMLDialogElement, this.isNativeDialog ? (e.addEventListener("cancel", this.onCancel), e.addEventListener("click", this.onBackdropClick)) : (this.focusTrap = new a(e, { escapeDeactivates: !0 }), X(this, { element: e }));
1542
+ }
1543
+ modalTargetDisconnected(e) {
1544
+ this.isNativeDialog && (e.removeEventListener("cancel", this.onCancel), e.removeEventListener("click", this.onBackdropClick));
1528
1545
  }
1529
1546
  dismissed = () => {
1530
1547
  this.close();
1531
1548
  };
1532
- disconnect() {
1533
- this.isNativeDialog && (this.modalTarget.removeEventListener("cancel", this.close), this.modalTarget.removeEventListener("click", this.onBackdropClick));
1534
- }
1535
1549
  open(e) {
1536
1550
  if (e && e.preventDefault(), this.hasModalTarget) {
1537
1551
  if (this.isNativeDialog) this.previouslyFocused = document.activeElement, this.modalTarget.showModal();
@@ -1558,12 +1572,12 @@ var B = /\D/g, V = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
1558
1572
  let t = this.modalTarget.getBoundingClientRect();
1559
1573
  (e.clientY < t.top || e.clientY > t.bottom || e.clientX < t.left || e.clientX > t.right) && this.close();
1560
1574
  };
1561
- }, Re = class extends e {
1575
+ }, Ge = class extends e {
1562
1576
  static targets = ["content"];
1563
1577
  connect() {
1564
- Ee(this, { element: this.hasContentTarget ? this.contentTarget : null });
1578
+ Me(this, { element: this.hasContentTarget ? this.contentTarget : null });
1565
1579
  }
1566
- }, ze = class extends e {
1580
+ }, Ke = class extends e {
1567
1581
  static targets = [
1568
1582
  "content",
1569
1583
  "template",
@@ -1584,7 +1598,7 @@ var B = /\D/g, V = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
1584
1598
  }
1585
1599
  };
1586
1600
  connect() {
1587
- ue(this, {
1601
+ we(this, {
1588
1602
  element: this.hasContentTarget ? this.contentTarget : null,
1589
1603
  url: this.hasUrlValue ? this.urlValue : null
1590
1604
  }), this.hasContentTarget && Q(this, {
@@ -1625,4 +1639,4 @@ var B = /\D/g, V = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
1625
1639
  }
1626
1640
  };
1627
1641
  //#endregion
1628
- export { y as ARIA_HASPOPUP_VALUES, $ as CalendarMonthController, Oe as CalendarMonthObserverController, ke as ClipboardController, Ae as ComboboxDateController, je as ComboboxDropdownController, Me as ComboboxTimeController, Ne as DismisserController, t as FOCUSABLE_SELECTOR, Pe as FlipperController, o as FocusRestoration, a as FocusTrap, Fe as InputComboboxController, Ie as InputFormatController, Le as ModalController, Re as PannerController, ze as PopoverController, d as RovingTabIndex, p as announce, S as connectTriggerToTarget, ne as disconnectTriggerFromTarget, h as ensureId, i as focusFirst, m as generateId, n as getFocusableElements, c as isActivationKey, l as isArrowKey, s as isKey, r as isVisible, u as preventDefault, g as setAriaState, ee as setChecked, te as setDisabled, _ as setExpanded, v as setPressed };
1642
+ export { y as ARIA_HASPOPUP_VALUES, Pe as CalendarMonthController, Fe as CalendarMonthObserverController, Ie as ClipboardController, Le as ComboboxDateController, $ as ComboboxDropdownController, Re as ComboboxTimeController, ze as DismisserController, t as FOCUSABLE_SELECTOR, z as FORMATTER_TYPES, Be as FlipperController, o as FocusRestoration, a as FocusTrap, H as Formatter, Ve as InputComboboxController, He as InputFormatController, Ue as InputSearchController, We as ModalController, Ge as PannerController, Ke as PopoverController, w as Requestor, d as RovingTabIndex, p as announce, S as connectTriggerToTarget, ne as disconnectTriggerFromTarget, h as ensureId, E as filterOptions, i as focusFirst, T as fuzzyMatcher, m as generateId, n as getFocusableElements, c as isActivationKey, l as isArrowKey, s as isKey, r as isVisible, u as preventDefault, g as setAriaState, v as setChecked, te as setDisabled, ee as setExpanded, _ as setPressed };