@scrippsproduct/networks-ui-library 1.1.8 → 1.1.10-alpha.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 (121) hide show
  1. package/dist/{Form.module-Cd8qH2rj.mjs → Form.module-CarfWK5T.mjs} +1 -1
  2. package/dist/ResultsTable.module-wcNUQEKe.mjs +14 -0
  3. package/dist/_commonjsHelpers-DaMA6jEr.mjs +8 -0
  4. package/dist/assets/ResultsTable.css +1 -1
  5. package/dist/assets/ScheduleLayout.css +1 -1
  6. package/dist/{chevron-left-DRvpaLmK.mjs → chevron-left-D0UjbrKw.mjs} +1 -1
  7. package/dist/{chevron-right-C8yCnmfx.mjs → chevron-right-0ZF3LruR.mjs} +1 -1
  8. package/dist/components/ActionButton/ActionButton.test.js +209 -0
  9. package/dist/components/AdBlock/AdBlock.test.js +286 -0
  10. package/dist/components/AdjustableTwoColumnGrid/AdjustableTwoColumnGrid.test.js +295 -0
  11. package/dist/components/AirDateFormatter/AirDateFormatter.test.js +192 -0
  12. package/dist/components/AnchorTag/AnchorTag.test.js +463 -0
  13. package/dist/components/BCVideoPlayer/BCVideoPlayer.test.js +295 -0
  14. package/dist/components/BasicGridModule/BasicGridModule.js +41 -37
  15. package/dist/components/BasicGridModule/BasicGridModule.test.js +227 -0
  16. package/dist/components/Button/Button.test.js +434 -0
  17. package/dist/components/Carousel/Carousel.js +2 -2
  18. package/dist/components/Carousel/Carousel.test.js +705 -0
  19. package/dist/components/CarouselSlide/CarouselSlide.test.js +378 -0
  20. package/dist/components/CarouselSlide/slide-layouts/TwoColumn/TwoColumnSlide.js +1 -1
  21. package/dist/components/CastInfoLayout/CastInfoLayout.test.js +294 -0
  22. package/dist/components/ChannelSearch/ChannelSearch.test.js +565 -0
  23. package/dist/components/ChoicesItem/ChoicesItem.test.js +428 -0
  24. package/dist/components/Concat/Concat.js +1 -1
  25. package/dist/components/Concat/Concat.test.js +115 -0
  26. package/dist/components/CtaBlock/CtaBlock.js +1 -1
  27. package/dist/components/CtaBlock/CtaBlock.test.js +226 -0
  28. package/dist/components/CustomDataList/CustomDataList.js +4 -4
  29. package/dist/components/CustomSelect/CustomSelect.js +86 -86
  30. package/dist/components/CustomSelect/CustomSelect.test.js +313 -0
  31. package/dist/components/DateNavigation/DateNavigation.js +10 -10
  32. package/dist/components/DateNavigation/DateNavigation.test.js +370 -0
  33. package/dist/components/DatePicker/DatePicker.js +1 -1
  34. package/dist/components/DeviceAndPlatformLists/DeviceAndPlatformLists.test.js +288 -0
  35. package/dist/components/DrawerNavigation/DrawerNavigation.test.js +316 -0
  36. package/dist/components/EqualSizeFlexRow/EqualSizeFlexRow.test.js +337 -0
  37. package/dist/components/EqualSizeGrid/EqualSizeGrid.test.js +358 -0
  38. package/dist/components/ErrorHandler/ErrorHandler.js +2 -2
  39. package/dist/components/ErrorHandler/ErrorHandler.test.js +158 -0
  40. package/dist/components/FeaturedList/FeaturedList.test.js +353 -0
  41. package/dist/components/Figure/Figure.js +1 -1
  42. package/dist/components/Figure/Figure.test.js +198 -0
  43. package/dist/components/FindUs/FindUs.test.js +499 -0
  44. package/dist/components/FooterNavigation/FooterNavigation.test.js +310 -0
  45. package/dist/components/GenericList/GenericList.js +1 -1
  46. package/dist/components/GenericList/GenericList.test.js +288 -0
  47. package/dist/components/GetAirdateWrapper/GetAirdateWrapper.test.js +689 -0
  48. package/dist/components/GradientButton/GradientButton.d.ts +1 -1
  49. package/dist/components/GradientButton/GradientButton.js +33 -31
  50. package/dist/components/GradientButton/GradientButton.test.js +457 -0
  51. package/dist/components/GridList/GridList.test.js +371 -0
  52. package/dist/components/ImageCard/ImageCard.test.js +668 -0
  53. package/dist/components/ImageCard/ImageCardCore.js +28 -28
  54. package/dist/components/ImageCard/ImageCardCore.test.js +577 -0
  55. package/dist/components/ImageReplacementAnchor/ImageReplacementAnchor.test.js +379 -0
  56. package/dist/components/InfoPanel/InfoPanel.js +1 -1
  57. package/dist/components/InlineNavigation/InlineNavigation.test.js +149 -0
  58. package/dist/components/Input/Input.js +1 -1
  59. package/dist/components/Input/Input.test.js +263 -0
  60. package/dist/components/InstructionsList/InstructionsList.js +11 -11
  61. package/dist/components/InstructionsList/InstructionsList.test.js +181 -0
  62. package/dist/components/LogoListItem/LogoListItem.test.js +303 -0
  63. package/dist/components/LogoNavigation/LogoNavigation.test.js +352 -0
  64. package/dist/components/ModalContainer/ModalContainer.js +2 -2
  65. package/dist/components/NavList/NavList.test.js +332 -0
  66. package/dist/components/Overlay/Overlay.js +24 -23
  67. package/dist/components/Overlay/Overlay.test.js +198 -0
  68. package/dist/components/PageHero/PageHero.test.js +241 -0
  69. package/dist/components/PageHero/page-hero-layouts/IONShow/IONShowHero.js +1 -1
  70. package/dist/components/ProgramAirdate/ProgramAirdate.js +1 -1
  71. package/dist/components/ProgramAirdate/ProgramAirdate.test.js +414 -0
  72. package/dist/components/PromotionBlock/PromotionBlock.test.js +208 -0
  73. package/dist/components/PromotionsRowBlock/PromotionsRowBlock.test.js +221 -0
  74. package/dist/components/PromotionsRowModule/PromotionsRowModule.test.js +349 -0
  75. package/dist/components/RescanInstructions/RescanInstructions.test.js +218 -0
  76. package/dist/components/ResponsiveImage/ResponsiveImage.test.js +264 -0
  77. package/dist/components/ResultsTable/ResultsTable.js +9 -2
  78. package/dist/components/ResultsTable/ResultsTable.test.js +402 -0
  79. package/dist/components/ResultsTableBody/ResultsTableBody.js +1 -1
  80. package/dist/components/ResultsTableBody/ResultsTableBody.test.js +445 -0
  81. package/dist/components/ResultsTableHeader/ResultsTableHeader.js +37 -15
  82. package/dist/components/ResultsTableHeader/ResultsTableHeader.test.js +275 -0
  83. package/dist/components/ScheduleLayout/ScheduleContext.js +654 -626
  84. package/dist/components/ScheduleLayout/ScheduleLayout.js +1 -1
  85. package/dist/components/ScheduleLayout/useScheduleContext.js +5 -10
  86. package/dist/components/ScheduleList/ScheduleList.js +1 -1
  87. package/dist/components/SectionedContent/SectionedContent.js +1 -1
  88. package/dist/components/SectionedContent/SectionedContent.test.js +341 -0
  89. package/dist/components/Select/Select.js +24 -24
  90. package/dist/components/Select/Select.test.js +367 -0
  91. package/dist/components/ShowAboutContent/ShowAboutContent.js +1 -1
  92. package/dist/components/ShowAboutContent/ShowAboutContent.test.js +535 -0
  93. package/dist/components/ShowAboutLayout/ShowAboutLayout.test.js +570 -0
  94. package/dist/components/SocialLinks/SocialLinks.js +1 -1
  95. package/dist/components/StringList/StringList.js +1 -1
  96. package/dist/components/StringList/StringList.test.js +311 -0
  97. package/dist/components/TabContent/TabContent.js +1 -1
  98. package/dist/components/TabContent/TabContent.test.js +274 -0
  99. package/dist/components/TabNavigation/TabNavigation.js +21 -21
  100. package/dist/components/TabNavigation/TabNavigation.test.js +535 -0
  101. package/dist/components/TabbedContent/TabbedContent.test.js +654 -0
  102. package/dist/components/TextArea/TextArea.js +1 -1
  103. package/dist/components/UpcomingList/UpcomingList.test.js +471 -0
  104. package/dist/{index-VjANCDXC.mjs → index-06PEPfBQ.mjs} +1 -1
  105. package/dist/index-BUN4jQ3m.mjs +3098 -0
  106. package/dist/index-BVxBrkZB.mjs +3 -0
  107. package/dist/{index-DC2JJV3a.mjs → index-D3kkcgee.mjs} +1 -1
  108. package/dist/{index-C-kn9Zhn.mjs → index-DzfYkULW.mjs} +2 -1
  109. package/dist/magic-string.es-uPKorP4O.mjs +663 -0
  110. package/dist/matchers-35e4d3bd-BBPNTlen.mjs +2404 -0
  111. package/dist/react.esm-DLSrfVwM.mjs +23410 -0
  112. package/dist/test/setupTests.d.ts +1 -0
  113. package/dist/test/setupTests.js +55 -0
  114. package/dist/{triangle-PcCcGXjr.mjs → triangle-C4z906Wf.mjs} +1 -1
  115. package/dist/useScheduleContext-D7FdzNxe.mjs +17 -0
  116. package/dist/utils/analytics.js +1 -1
  117. package/dist/utils/getOnNowProgram.js +10 -10
  118. package/dist/{x-C-QzJ-qD.mjs → x-Ck9Vk5Fo.mjs} +1 -1
  119. package/package.json +4 -1
  120. package/dist/ResultsTable.module-1zxhXaem.mjs +0 -14
  121. package/dist/_commonjsHelpers-C6fGbg64.mjs +0 -6
@@ -0,0 +1,3098 @@
1
+ import { h as H } from "./react.esm-DLSrfVwM.mjs";
2
+ function a(e, t, n) {
3
+ return e.namespaceURI && e.namespaceURI !== "http://www.w3.org/1999/xhtml" || (t = Array.isArray(t) ? t : [
4
+ t
5
+ ], !t.includes(e.tagName.toLowerCase())) ? !1 : n ? Object.entries(n).every(([i, r]) => e[i] === r) : !0;
6
+ }
7
+ function E(e) {
8
+ var t;
9
+ if (Yt(e) && e.defaultView)
10
+ return e.defaultView;
11
+ if (!((t = e.ownerDocument) === null || t === void 0) && t.defaultView)
12
+ return e.ownerDocument.defaultView;
13
+ throw new Error(`Could not determine window of node. Node was ${qt(e)}`);
14
+ }
15
+ function Yt(e) {
16
+ return e.nodeType === 9;
17
+ }
18
+ function qt(e) {
19
+ return typeof e == "function" ? `function ${e.name}` : e === null ? "null" : String(e);
20
+ }
21
+ function lt(e, t) {
22
+ return new Promise((n, i) => {
23
+ const r = new t();
24
+ r.onerror = i, r.onabort = i, r.onload = () => {
25
+ n(String(r.result));
26
+ }, r.readAsText(e);
27
+ });
28
+ }
29
+ function Ne(e, t) {
30
+ const n = {
31
+ ...t,
32
+ length: t.length,
33
+ item: (i) => n[i],
34
+ [Symbol.iterator]: function* () {
35
+ for (let r = 0; r < n.length; r++)
36
+ yield n[r];
37
+ }
38
+ };
39
+ return n.constructor = e.FileList, e.FileList && Object.setPrototypeOf(n, e.FileList.prototype), Object.freeze(n), n;
40
+ }
41
+ function A(e, t, n) {
42
+ return t in e ? Object.defineProperty(e, t, {
43
+ value: n,
44
+ enumerable: !0,
45
+ configurable: !0,
46
+ writable: !0
47
+ }) : e[t] = n, e;
48
+ }
49
+ class at {
50
+ getAsFile() {
51
+ return this.file;
52
+ }
53
+ getAsString(t) {
54
+ typeof this.data == "string" && t(this.data);
55
+ }
56
+ /* istanbul ignore next */
57
+ webkitGetAsEntry() {
58
+ throw new Error("not implemented");
59
+ }
60
+ constructor(t, n) {
61
+ A(this, "kind", void 0), A(this, "type", void 0), A(this, "file", null), A(this, "data", void 0), typeof t == "string" ? (this.kind = "string", this.type = String(n), this.data = t) : (this.kind = "file", this.type = t.type, this.file = t);
62
+ }
63
+ }
64
+ class Jt extends Array {
65
+ add(...t) {
66
+ const n = new at(t[0], t[1]);
67
+ return this.push(n), n;
68
+ }
69
+ clear() {
70
+ this.splice(0, this.length);
71
+ }
72
+ remove(t) {
73
+ this.splice(t, 1);
74
+ }
75
+ }
76
+ function pe(e, t) {
77
+ const [n, i] = e.split("/"), r = !i || i === "*";
78
+ return (o) => t ? o.type === (r ? n : e) : r ? o.type.startsWith(`${n}/`) : o.type === n;
79
+ }
80
+ function Qt(e) {
81
+ return new class {
82
+ getData(n) {
83
+ var i;
84
+ const r = (i = this.items.find(pe(n, !0))) !== null && i !== void 0 ? i : this.items.find(pe(n, !1));
85
+ let o = "";
86
+ return r == null || r.getAsString((s) => {
87
+ o = s;
88
+ }), o;
89
+ }
90
+ setData(n, i) {
91
+ const r = this.items.findIndex(pe(n, !0)), o = new at(i, n);
92
+ r >= 0 ? this.items.splice(r, 1, o) : this.items.push(o);
93
+ }
94
+ clearData(n) {
95
+ if (n) {
96
+ const i = this.items.findIndex(pe(n, !0));
97
+ i >= 0 && this.items.remove(i);
98
+ } else
99
+ this.items.clear();
100
+ }
101
+ get types() {
102
+ const n = [];
103
+ return this.files.length && n.push("Files"), this.items.forEach((i) => n.push(i.type)), Object.freeze(n), n;
104
+ }
105
+ /* istanbul ignore next */
106
+ setDragImage() {
107
+ }
108
+ constructor() {
109
+ A(this, "dropEffect", "none"), A(this, "effectAllowed", "uninitialized"), A(this, "items", new Jt()), A(this, "files", Ne(e, []));
110
+ }
111
+ }();
112
+ }
113
+ function Me(e, t = []) {
114
+ const n = typeof e.DataTransfer > "u" ? Qt(e) : (
115
+ /* istanbul ignore next */
116
+ new e.DataTransfer()
117
+ );
118
+ return Object.defineProperty(n, "files", {
119
+ get: () => Ne(e, t)
120
+ }), n;
121
+ }
122
+ async function Zt(e, t) {
123
+ return t.kind === "file" ? t.getAsFile() : new e.Blob([
124
+ await new Promise((n) => t.getAsString(n))
125
+ ], {
126
+ type: t.type
127
+ });
128
+ }
129
+ function ft(e, t, n) {
130
+ return t in e ? Object.defineProperty(e, t, {
131
+ value: n,
132
+ enumerable: !0,
133
+ configurable: !0,
134
+ writable: !0
135
+ }) : e[t] = n, e;
136
+ }
137
+ function pt(e, ...t) {
138
+ const n = Object.fromEntries(t.map((i) => [
139
+ typeof i == "string" ? "text/plain" : i.type,
140
+ Promise.resolve(i)
141
+ ]));
142
+ return typeof e.ClipboardItem < "u" ? new e.ClipboardItem(n) : new class {
143
+ get types() {
144
+ return Array.from(Object.keys(this.data));
145
+ }
146
+ async getType(r) {
147
+ const o = await this.data[r];
148
+ if (!o)
149
+ throw new Error(`${r} is not one of the available MIME types on this item.`);
150
+ return o instanceof e.Blob ? o : new e.Blob([
151
+ o
152
+ ], {
153
+ type: r
154
+ });
155
+ }
156
+ constructor(r) {
157
+ ft(this, "data", void 0), this.data = r;
158
+ }
159
+ }(n);
160
+ }
161
+ const W = Symbol("Manage ClipboardSub");
162
+ function Re(e, t) {
163
+ return Object.assign(new class extends e.EventTarget {
164
+ async read() {
165
+ return Array.from(this.items);
166
+ }
167
+ async readText() {
168
+ let i = "";
169
+ for (const r of this.items) {
170
+ const o = r.types.includes("text/plain") ? "text/plain" : r.types.find((s) => s.startsWith("text/"));
171
+ o && (i += await r.getType(o).then((s) => lt(s, e.FileReader)));
172
+ }
173
+ return i;
174
+ }
175
+ async write(i) {
176
+ this.items = i;
177
+ }
178
+ async writeText(i) {
179
+ this.items = [
180
+ pt(e, i)
181
+ ];
182
+ }
183
+ constructor(...i) {
184
+ super(...i), ft(this, "items", []);
185
+ }
186
+ }(), {
187
+ [W]: t
188
+ });
189
+ }
190
+ function Le(e) {
191
+ return !!(e != null && e[W]);
192
+ }
193
+ function en(e) {
194
+ if (Le(e.navigator.clipboard))
195
+ return e.navigator.clipboard[W];
196
+ const t = Object.getOwnPropertyDescriptor(e.navigator, "clipboard");
197
+ let n;
198
+ const i = {
199
+ resetClipboardStub: () => {
200
+ n = Re(e, i);
201
+ },
202
+ detachClipboardStub: () => {
203
+ t ? Object.defineProperty(e.navigator, "clipboard", t) : Object.defineProperty(e.navigator, "clipboard", {
204
+ value: void 0,
205
+ configurable: !0
206
+ });
207
+ }
208
+ };
209
+ return n = Re(e, i), Object.defineProperty(e.navigator, "clipboard", {
210
+ get: () => n,
211
+ configurable: !0
212
+ }), n[W];
213
+ }
214
+ function tn(e) {
215
+ Le(e.navigator.clipboard) && e.navigator.clipboard[W].resetClipboardStub();
216
+ }
217
+ function nn(e) {
218
+ Le(e.navigator.clipboard) && e.navigator.clipboard[W].detachClipboardStub();
219
+ }
220
+ async function rn(e) {
221
+ const t = e.defaultView, n = t == null ? void 0 : t.navigator.clipboard, i = n && await n.read();
222
+ if (!i)
223
+ throw new Error("The Clipboard API is unavailable.");
224
+ const r = Me(t);
225
+ for (const o of i)
226
+ for (const s of o.types)
227
+ r.setData(s, await o.getType(s).then((u) => lt(u, t.FileReader)));
228
+ return r;
229
+ }
230
+ async function ht(e, t) {
231
+ const n = E(e), i = n.navigator.clipboard, r = [];
232
+ for (let s = 0; s < t.items.length; s++) {
233
+ const u = t.items[s], c = await Zt(n, u);
234
+ r.push(pt(n, c));
235
+ }
236
+ if (!(i && await i.write(r).then(
237
+ () => !0,
238
+ // Can happen with other implementations that e.g. require permissions
239
+ /* istanbul ignore next */
240
+ () => !1
241
+ )))
242
+ throw new Error("The Clipboard API is unavailable.");
243
+ }
244
+ const we = globalThis;
245
+ typeof we.afterEach == "function" && we.afterEach(() => tn(globalThis.window));
246
+ typeof we.afterAll == "function" && we.afterAll(() => nn(globalThis.window));
247
+ const bt = [
248
+ "input:not([type=hidden]):not([disabled])",
249
+ "button:not([disabled])",
250
+ "select:not([disabled])",
251
+ "textarea:not([disabled])",
252
+ '[contenteditable=""]',
253
+ '[contenteditable="true"]',
254
+ "a[href]",
255
+ "[tabindex]:not([disabled])"
256
+ ].join(", ");
257
+ function $e(e) {
258
+ return e.matches(bt);
259
+ }
260
+ function on(e) {
261
+ return new e.constructor(e.type, e);
262
+ }
263
+ function _(e) {
264
+ for (let n = e; n; n = n.parentElement)
265
+ if (a(n, [
266
+ "button",
267
+ "input",
268
+ "select",
269
+ "textarea",
270
+ "optgroup",
271
+ "option"
272
+ ])) {
273
+ if (n.hasAttribute("disabled"))
274
+ return !0;
275
+ } else if (a(n, "fieldset")) {
276
+ var t;
277
+ if (n.hasAttribute("disabled") && !(!((t = n.querySelector(":scope > legend")) === null || t === void 0) && t.contains(e)))
278
+ return !0;
279
+ } else if (n.tagName.includes("-") && n.constructor.formAssociated && n.hasAttribute("disabled"))
280
+ return !0;
281
+ return !1;
282
+ }
283
+ function fe(e) {
284
+ const t = e.activeElement;
285
+ return t != null && t.shadowRoot ? fe(t.shadowRoot) : _(t) ? e.ownerDocument ? (
286
+ /* istanbul ignore next */
287
+ e.ownerDocument.body
288
+ ) : e.body : t;
289
+ }
290
+ function Se(e) {
291
+ var t;
292
+ return (t = fe(e)) !== null && t !== void 0 ? t : (
293
+ /* istanbul ignore next */
294
+ e.body
295
+ );
296
+ }
297
+ function sn(e, t) {
298
+ let n = e;
299
+ do {
300
+ if (t(n))
301
+ return n;
302
+ n = n.parentElement;
303
+ } while (n && n !== e.ownerDocument.body);
304
+ }
305
+ function R(e) {
306
+ return e.hasAttribute("contenteditable") && (e.getAttribute("contenteditable") == "true" || e.getAttribute("contenteditable") == "");
307
+ }
308
+ function de(e) {
309
+ const t = un(e);
310
+ return t && (t.closest('[contenteditable=""]') || t.closest('[contenteditable="true"]'));
311
+ }
312
+ function un(e) {
313
+ return e.nodeType === 1 ? e : e.parentElement;
314
+ }
315
+ var gt = /* @__PURE__ */ (function(e) {
316
+ return e.button = "button", e.color = "color", e.file = "file", e.image = "image", e.reset = "reset", e.submit = "submit", e.checkbox = "checkbox", e.radio = "radio", e;
317
+ })(gt || {});
318
+ function vt(e) {
319
+ return a(e, "button") || a(e, "input") && e.type in gt;
320
+ }
321
+ function z(e) {
322
+ return mt(e) && !e.readOnly || R(e);
323
+ }
324
+ var yt = /* @__PURE__ */ (function(e) {
325
+ return e.text = "text", e.date = "date", e["datetime-local"] = "datetime-local", e.email = "email", e.month = "month", e.number = "number", e.password = "password", e.search = "search", e.tel = "tel", e.time = "time", e.url = "url", e.week = "week", e;
326
+ })(yt || {});
327
+ function mt(e) {
328
+ return a(e, "textarea") || a(e, "input") && e.type in yt;
329
+ }
330
+ function k(e) {
331
+ return Et(e) && mt(e);
332
+ }
333
+ function cn(e) {
334
+ return Et(e) && vt(e);
335
+ }
336
+ function Et(e) {
337
+ return e.nodeType === 1;
338
+ }
339
+ function dn(e) {
340
+ const t = e.ownerDocument.getSelection();
341
+ if (t != null && t.focusNode && k(e)) {
342
+ const i = de(t.focusNode);
343
+ if (i) {
344
+ if (!t.isCollapsed) {
345
+ var n;
346
+ const r = ((n = i.firstChild) === null || n === void 0 ? void 0 : n.nodeType) === 3 ? i.firstChild : i;
347
+ t.setBaseAndExtent(r, 0, r, 0);
348
+ }
349
+ } else
350
+ t.setBaseAndExtent(e, 0, e, 0);
351
+ }
352
+ }
353
+ function Y(e, t) {
354
+ return H().eventWrapper(e);
355
+ }
356
+ function O(e) {
357
+ const t = sn(e, $e), n = fe(e.ownerDocument);
358
+ (t ?? e.ownerDocument.body) !== n && (Y(t ? () => t.focus() : () => n == null ? void 0 : n.blur()), dn(t ?? e.ownerDocument.body));
359
+ }
360
+ function ln(e) {
361
+ !$e(e) || !(fe(e.ownerDocument) === e) || Y(() => e.blur());
362
+ }
363
+ const U = {};
364
+ U.click = (e, t, n) => {
365
+ const i = t.closest("button,input,label,select,textarea"), r = i && a(i, "label") && i.control;
366
+ if (r && r !== t)
367
+ return () => {
368
+ $e(r) && (O(r), n.dispatchEvent(r, on(e)));
369
+ };
370
+ if (a(t, "input", {
371
+ type: "file"
372
+ }))
373
+ return () => {
374
+ ln(t), t.dispatchEvent(new (E(t)).Event("fileDialog")), O(t);
375
+ };
376
+ };
377
+ const q = Symbol("Displayed value in UI"), I = Symbol("Displayed selection in UI"), ke = Symbol("Initial value to compare on blur");
378
+ function an(e) {
379
+ return typeof e == "object" && q in e;
380
+ }
381
+ function fn(e) {
382
+ return !!e && typeof e == "object" && I in e;
383
+ }
384
+ function pn(e, t) {
385
+ e[ke] === void 0 && (e[ke] = e.value), e[q] = t, e.value = Object.assign(new String(t), {
386
+ [q]: !0
387
+ });
388
+ }
389
+ function T(e) {
390
+ return e[q] === void 0 ? e.value : String(e[q]);
391
+ }
392
+ function Fe(e) {
393
+ e[q] = void 0;
394
+ }
395
+ function wt(e) {
396
+ e[ke] = void 0;
397
+ }
398
+ function hn(e) {
399
+ return e[ke];
400
+ }
401
+ function bn(e, t) {
402
+ e[I] = t;
403
+ }
404
+ function Z(e, { focusOffset: t, anchorOffset: n = t }, i = "replace") {
405
+ const r = T(e).length, o = (f) => Math.max(0, Math.min(r, f)), s = i === "replace" || e[I] === void 0 ? o(n) : e[I].anchorOffset, u = o(t), c = Math.min(s, u), d = Math.max(s, u);
406
+ if (e[I] = {
407
+ anchorOffset: s,
408
+ focusOffset: u
409
+ }, e.selectionStart === c && e.selectionEnd === d)
410
+ return;
411
+ const l = Object.assign(new Number(c), {
412
+ [I]: !0
413
+ });
414
+ try {
415
+ e.setSelectionRange(l, d);
416
+ } catch {
417
+ }
418
+ }
419
+ function le(e) {
420
+ var t, n, i;
421
+ const r = (i = e[I]) !== null && i !== void 0 ? i : {
422
+ anchorOffset: (t = e.selectionStart) !== null && t !== void 0 ? t : 0,
423
+ focusOffset: (n = e.selectionEnd) !== null && n !== void 0 ? n : 0
424
+ };
425
+ return {
426
+ ...r,
427
+ startOffset: Math.min(r.anchorOffset, r.focusOffset),
428
+ endOffset: Math.max(r.anchorOffset, r.focusOffset)
429
+ };
430
+ }
431
+ function gn(e) {
432
+ return !!e[I];
433
+ }
434
+ function ye(e) {
435
+ e[I] = void 0;
436
+ }
437
+ const Te = globalThis.parseInt;
438
+ function vn(e) {
439
+ const t = e.replace(/\D/g, "");
440
+ if (t.length < 2)
441
+ return e;
442
+ const n = Te(t[0], 10), i = Te(t[1], 10);
443
+ if (n >= 3 || n === 2 && i >= 4) {
444
+ let r;
445
+ return n >= 3 ? r = 1 : r = 2, je(t, r);
446
+ }
447
+ return e.length === 2 ? e : je(t, 2);
448
+ }
449
+ function je(e, t) {
450
+ const n = e.slice(0, t), i = Math.min(Te(n, 10), 23), r = e.slice(t), o = Te(r, 10), s = Math.min(o, 59);
451
+ return `${i.toString().padStart(2, "0")}:${s.toString().padStart(2, "0")}`;
452
+ }
453
+ function kt(e, t) {
454
+ const n = e.cloneNode();
455
+ return n.value = t, n.value === t;
456
+ }
457
+ var Tt = /* @__PURE__ */ (function(e) {
458
+ return e.email = "email", e.password = "password", e.search = "search", e.telephone = "telephone", e.text = "text", e.url = "url", e;
459
+ })(Tt || {});
460
+ function yn(e) {
461
+ var t;
462
+ const n = (t = e.getAttribute("maxlength")) !== null && t !== void 0 ? t : "";
463
+ return /^\d+$/.test(n) && Number(n) >= 0 ? Number(n) : void 0;
464
+ }
465
+ function mn(e) {
466
+ return a(e, "textarea") || a(e, "input") && e.type in Tt;
467
+ }
468
+ function Ct(e, t, n, i) {
469
+ if (me(e) && t + n >= 0 && t + n <= e.nodeValue.length)
470
+ return {
471
+ node: e,
472
+ offset: t + n
473
+ };
474
+ const r = He(e, t, n);
475
+ if (r) {
476
+ if (me(r))
477
+ return {
478
+ node: r,
479
+ offset: n > 0 ? Math.min(1, r.nodeValue.length) : Math.max(r.nodeValue.length - 1, 0)
480
+ };
481
+ if (a(r, "br")) {
482
+ const o = He(r, void 0, n);
483
+ return o ? me(o) ? {
484
+ node: o,
485
+ offset: n > 0 ? 0 : o.nodeValue.length
486
+ } : n < 0 && a(o, "br") ? {
487
+ node: r.parentNode,
488
+ offset: he(r)
489
+ } : {
490
+ node: o.parentNode,
491
+ offset: he(o) + (n > 0 ? 0 : 1)
492
+ } : n < 0 && i === "deleteContentBackward" ? {
493
+ node: r.parentNode,
494
+ offset: he(r)
495
+ } : void 0;
496
+ } else
497
+ return {
498
+ node: r.parentNode,
499
+ offset: he(r) + (n > 0 ? 1 : 0)
500
+ };
501
+ }
502
+ }
503
+ function He(e, t, n) {
504
+ const i = Number(t) + (n < 0 ? -1 : 0);
505
+ return t !== void 0 && Be(e) && i >= 0 && i < e.children.length && (e = e.children[i]), wn(e, n === 1 ? "next" : "previous", En);
506
+ }
507
+ function En(e) {
508
+ if (me(e))
509
+ return !0;
510
+ if (Be(e)) {
511
+ if (a(e, [
512
+ "input",
513
+ "textarea"
514
+ ]))
515
+ return e.type !== "hidden";
516
+ if (a(e, "br"))
517
+ return !0;
518
+ }
519
+ return !1;
520
+ }
521
+ function he(e) {
522
+ let t = 0;
523
+ for (; e.previousSibling; )
524
+ t++, e = e.previousSibling;
525
+ return t;
526
+ }
527
+ function Be(e) {
528
+ return e.nodeType === 1;
529
+ }
530
+ function me(e) {
531
+ return e.nodeType === 3;
532
+ }
533
+ function wn(e, t, n) {
534
+ for (; ; ) {
535
+ var i;
536
+ const r = e[`${t}Sibling`];
537
+ if (r) {
538
+ if (e = kn(r, t === "next" ? "first" : "last"), n(e))
539
+ return e;
540
+ } else if (e.parentNode && (!Be(e.parentNode) || !R(e.parentNode) && e.parentNode !== ((i = e.ownerDocument) === null || i === void 0 ? void 0 : i.body)))
541
+ e = e.parentNode;
542
+ else
543
+ break;
544
+ }
545
+ }
546
+ function kn(e, t) {
547
+ for (; e.hasChildNodes(); )
548
+ e = e[`${t}Child`];
549
+ return e;
550
+ }
551
+ const ae = Symbol("Track programmatic changes for React workaround");
552
+ function Tn(e) {
553
+ return Object.getOwnPropertyNames(e).some((t) => t.startsWith("__react")) && E(e).REACT_VERSION === 17;
554
+ }
555
+ function Cn(e) {
556
+ Tn(e) && (e[ae] = {
557
+ previousValue: String(e.value),
558
+ tracked: []
559
+ });
560
+ }
561
+ function In(e, t) {
562
+ var n, i;
563
+ (i = e[ae]) === null || i === void 0 || (n = i.tracked) === null || n === void 0 || n.push(t), e[ae] || (Fe(e), Z(e, {
564
+ focusOffset: t.length
565
+ }));
566
+ }
567
+ function _n(e, t) {
568
+ var n;
569
+ const i = e[ae];
570
+ if (e[ae] = void 0, !(!(i == null || (n = i.tracked) === null || n === void 0) && n.length))
571
+ return;
572
+ const r = i.tracked.length === 2 && i.tracked[0] === i.previousValue && i.tracked[1] === e.value;
573
+ r || Fe(e), gn(e) && Z(e, {
574
+ focusOffset: r ? t : e.value.length
575
+ });
576
+ }
577
+ function It(e) {
578
+ const t = Sn(e);
579
+ if (t && k(t))
580
+ return {
581
+ type: "input",
582
+ selection: le(t)
583
+ };
584
+ const n = t == null ? void 0 : t.ownerDocument.getSelection();
585
+ return {
586
+ type: de(e) && (n == null ? void 0 : n.anchorNode) && de(n.anchorNode) ? "contenteditable" : "default",
587
+ selection: n
588
+ };
589
+ }
590
+ function Sn(e) {
591
+ return e.nodeType === 1 ? e : e.parentElement;
592
+ }
593
+ function Pn(e) {
594
+ const t = It(e);
595
+ if (t.type === "input")
596
+ return t.selection;
597
+ if (t.type === "contenteditable") {
598
+ var n;
599
+ return (n = t.selection) === null || n === void 0 ? void 0 : n.getRangeAt(0);
600
+ }
601
+ }
602
+ function j({ focusNode: e, focusOffset: t, anchorNode: n = e, anchorOffset: i = t }) {
603
+ var r, o;
604
+ if (It(e).type === "input")
605
+ return Z(e, {
606
+ anchorOffset: i,
607
+ focusOffset: t
608
+ });
609
+ (o = n.ownerDocument) === null || o === void 0 || (r = o.getSelection()) === null || r === void 0 || r.setBaseAndExtent(n, i, e, t);
610
+ }
611
+ function _t(e) {
612
+ return a(e, "input") && [
613
+ "date",
614
+ "time"
615
+ ].includes(e.type);
616
+ }
617
+ function J(e, t, n, i = "insertText") {
618
+ const r = Pn(t);
619
+ r && (!_t(t) && !e.dispatchUIEvent(t, "beforeinput", {
620
+ inputType: i,
621
+ data: n
622
+ }) || ("startContainer" in r ? An(e, t, r, n, i) : On(e, t, r, n, i)));
623
+ }
624
+ function An(e, t, n, i, r) {
625
+ let o = !1;
626
+ if (!n.collapsed)
627
+ o = !0, n.deleteContents();
628
+ else if ([
629
+ "deleteContentBackward",
630
+ "deleteContentForward"
631
+ ].includes(r)) {
632
+ const s = Ct(n.startContainer, n.startOffset, r === "deleteContentBackward" ? -1 : 1, r);
633
+ if (s) {
634
+ o = !0;
635
+ const u = n.cloneRange();
636
+ u.comparePoint(s.node, s.offset) < 0 ? u.setStart(s.node, s.offset) : u.setEnd(s.node, s.offset), u.deleteContents();
637
+ }
638
+ }
639
+ if (i)
640
+ if (n.endContainer.nodeType === 3) {
641
+ const s = n.endOffset;
642
+ n.endContainer.insertData(s, i), n.setStart(n.endContainer, s + i.length), n.setEnd(n.endContainer, s + i.length);
643
+ } else {
644
+ const s = t.ownerDocument.createTextNode(i);
645
+ n.insertNode(s), n.setStart(s, i.length), n.setEnd(s, i.length);
646
+ }
647
+ (o || i) && e.dispatchUIEvent(t, "input", {
648
+ inputType: r
649
+ });
650
+ }
651
+ function On(e, t, n, i, r) {
652
+ let o = i;
653
+ if (mn(t)) {
654
+ const d = yn(t);
655
+ if (d !== void 0 && i.length > 0) {
656
+ const l = d - t.value.length;
657
+ if (l > 0)
658
+ o = i.substring(0, l);
659
+ else
660
+ return;
661
+ }
662
+ }
663
+ const { newValue: s, newOffset: u, oldValue: c } = Un(o, t, n, r);
664
+ s === c && u === n.startOffset && u === n.endOffset || a(t, "input", {
665
+ type: "number"
666
+ }) && !Dn(s) || (pn(t, s), j({
667
+ focusNode: t,
668
+ anchorOffset: u,
669
+ focusOffset: u
670
+ }), _t(t) ? kt(t, s) && (Ge(e, t, u, {}), e.dispatchUIEvent(t, "change"), wt(t)) : Ge(e, t, u, {
671
+ data: i,
672
+ inputType: r
673
+ }));
674
+ }
675
+ function Un(e, t, { startOffset: n, endOffset: i }, r) {
676
+ const o = T(t), s = Math.max(0, n === i && r === "deleteContentBackward" ? n - 1 : n), u = o.substring(0, s), c = Math.min(o.length, n === i && r === "deleteContentForward" ? n + 1 : i), d = o.substring(c, o.length);
677
+ let l = `${u}${e}${d}`, f = s + e.length;
678
+ if (a(t, "input", {
679
+ type: "time"
680
+ })) {
681
+ const p = vn(l);
682
+ p !== "" && kt(t, p) && (l = p, f = p.length);
683
+ }
684
+ return {
685
+ oldValue: o,
686
+ newValue: l,
687
+ newOffset: f
688
+ };
689
+ }
690
+ function Ge(e, t, n, i) {
691
+ e.dispatchUIEvent(t, "input", i), _n(t, n);
692
+ }
693
+ function Dn(e) {
694
+ var t, n;
695
+ const i = e.split("e", 2);
696
+ return !(/[^\d.\-e]/.test(e) || Number((t = e.match(/-/g)) === null || t === void 0 ? void 0 : t.length) > 2 || Number((n = e.match(/\./g)) === null || n === void 0 ? void 0 : n.length) > 1 || i[1] && !/^-?\d*$/.test(i[1]));
697
+ }
698
+ U.cut = (e, t, n) => () => {
699
+ z(t) && J(n, t, "", "deleteByCut");
700
+ };
701
+ function xn(e) {
702
+ return e ? R(e) ? e.textContent : T(e) : null;
703
+ }
704
+ function Nn(e) {
705
+ const t = E(e);
706
+ for (let n = e; n != null && n.ownerDocument; n = n.parentElement) {
707
+ const { display: i, visibility: r } = t.getComputedStyle(n);
708
+ if (i === "none" || r === "hidden")
709
+ return !1;
710
+ }
711
+ return !0;
712
+ }
713
+ function Mn(e, t) {
714
+ const n = e.ownerDocument, i = n.querySelectorAll(bt), r = Array.from(i).filter((c) => c === e || !(Number(c.getAttribute("tabindex")) < 0 || _(c)));
715
+ Number(e.getAttribute("tabindex")) >= 0 && r.sort((c, d) => {
716
+ const l = Number(c.getAttribute("tabindex")), f = Number(d.getAttribute("tabindex"));
717
+ return l === f ? 0 : l === 0 ? 1 : f === 0 ? -1 : l - f;
718
+ });
719
+ const o = {};
720
+ let s = [
721
+ n.body
722
+ ];
723
+ const u = a(e, "input", {
724
+ type: "radio"
725
+ }) ? e.name : void 0;
726
+ r.forEach((c) => {
727
+ const d = c;
728
+ if (a(d, "input", {
729
+ type: "radio"
730
+ }) && d.name) {
731
+ if (d === e) {
732
+ s.push(d);
733
+ return;
734
+ } else if (d.name === u)
735
+ return;
736
+ if (d.checked) {
737
+ s = s.filter((l) => !a(l, "input", {
738
+ type: "radio",
739
+ name: d.name
740
+ })), s.push(d), o[d.name] = d;
741
+ return;
742
+ }
743
+ if (typeof o[d.name] < "u")
744
+ return;
745
+ }
746
+ s.push(d);
747
+ });
748
+ for (let c = s.findIndex((d) => d === e); ; )
749
+ if (c += t ? -1 : 1, c === s.length ? c = 0 : c === -1 && (c = s.length - 1), s[c] === e || s[c] === n.body || Nn(s[c]))
750
+ return s[c];
751
+ }
752
+ function Xe(e, t) {
753
+ if (k(e)) {
754
+ const n = le(e);
755
+ j({
756
+ focusNode: e,
757
+ focusOffset: n.startOffset === n.endOffset ? n.focusOffset + t : t < 0 ? n.startOffset : n.endOffset
758
+ });
759
+ } else {
760
+ const n = e.ownerDocument.getSelection();
761
+ if (!(n != null && n.focusNode))
762
+ return;
763
+ if (n.isCollapsed) {
764
+ const i = Ct(n.focusNode, n.focusOffset, t);
765
+ i && j({
766
+ focusNode: i.node,
767
+ focusOffset: i.offset
768
+ });
769
+ } else
770
+ n[t < 0 ? "collapseToStart" : "collapseToEnd"]();
771
+ }
772
+ }
773
+ function St(e) {
774
+ if (k(e))
775
+ return j({
776
+ focusNode: e,
777
+ anchorOffset: 0,
778
+ focusOffset: T(e).length
779
+ });
780
+ var t;
781
+ const n = (t = de(e)) !== null && t !== void 0 ? t : e.ownerDocument.body;
782
+ j({
783
+ focusNode: n,
784
+ anchorOffset: 0,
785
+ focusOffset: n.childNodes.length
786
+ });
787
+ }
788
+ function Ln(e) {
789
+ if (k(e))
790
+ return le(e).startOffset === 0 && le(e).endOffset === T(e).length;
791
+ var t;
792
+ const n = (t = de(e)) !== null && t !== void 0 ? t : e.ownerDocument.body, i = e.ownerDocument.getSelection();
793
+ return (i == null ? void 0 : i.anchorNode) === n && i.focusNode === n && i.anchorOffset === 0 && i.focusOffset === n.childNodes.length;
794
+ }
795
+ function oe(e, t, n) {
796
+ var i;
797
+ if (k(e))
798
+ return j({
799
+ focusNode: e,
800
+ anchorOffset: t,
801
+ focusOffset: n
802
+ });
803
+ if (R(e) && ((i = e.firstChild) === null || i === void 0 ? void 0 : i.nodeType) === 3)
804
+ return j({
805
+ focusNode: e.firstChild,
806
+ anchorOffset: t,
807
+ focusOffset: n
808
+ });
809
+ throw new Error("Not implemented. The result of this interaction is unreliable.");
810
+ }
811
+ function be(e, t, n) {
812
+ const i = E(t), r = Array.from(t.ownerDocument.querySelectorAll(t.name ? `input[type="radio"][name="${i.CSS.escape(t.name)}"]` : 'input[type="radio"][name=""], input[type="radio"]:not([name])'));
813
+ for (let o = r.findIndex((s) => s === t) + n; ; o += n) {
814
+ if (r[o] || (o = n > 0 ? 0 : r.length - 1), r[o] === t)
815
+ return;
816
+ if (!_(r[o])) {
817
+ O(r[o]), e.dispatchUIEvent(r[o], "click");
818
+ return;
819
+ }
820
+ }
821
+ }
822
+ U.keydown = (e, t, n) => {
823
+ var i, r;
824
+ return (r = (i = We[e.key]) === null || i === void 0 ? void 0 : i.call(We, e, t, n)) !== null && r !== void 0 ? r : $n(e, t, n);
825
+ };
826
+ const We = {
827
+ ArrowDown: (e, t, n) => {
828
+ if (a(t, "input", {
829
+ type: "radio"
830
+ }))
831
+ return () => be(n, t, 1);
832
+ },
833
+ ArrowLeft: (e, t, n) => a(t, "input", {
834
+ type: "radio"
835
+ }) ? () => be(n, t, -1) : () => Xe(t, -1),
836
+ ArrowRight: (e, t, n) => a(t, "input", {
837
+ type: "radio"
838
+ }) ? () => be(n, t, 1) : () => Xe(t, 1),
839
+ ArrowUp: (e, t, n) => {
840
+ if (a(t, "input", {
841
+ type: "radio"
842
+ }))
843
+ return () => be(n, t, -1);
844
+ },
845
+ Backspace: (e, t, n) => {
846
+ if (z(t))
847
+ return () => {
848
+ J(n, t, "", "deleteContentBackward");
849
+ };
850
+ },
851
+ Delete: (e, t, n) => {
852
+ if (z(t))
853
+ return () => {
854
+ J(n, t, "", "deleteContentForward");
855
+ };
856
+ },
857
+ End: (e, t) => {
858
+ if (a(t, [
859
+ "input",
860
+ "textarea"
861
+ ]) || R(t))
862
+ return () => {
863
+ var n, i;
864
+ const r = (i = (n = xn(t)) === null || n === void 0 ? void 0 : n.length) !== null && i !== void 0 ? i : (
865
+ /* istanbul ignore next */
866
+ 0
867
+ );
868
+ oe(t, r, r);
869
+ };
870
+ },
871
+ Home: (e, t) => {
872
+ if (a(t, [
873
+ "input",
874
+ "textarea"
875
+ ]) || R(t))
876
+ return () => {
877
+ oe(t, 0, 0);
878
+ };
879
+ },
880
+ PageDown: (e, t) => {
881
+ if (a(t, [
882
+ "input"
883
+ ]))
884
+ return () => {
885
+ const n = T(t).length;
886
+ oe(t, n, n);
887
+ };
888
+ },
889
+ PageUp: (e, t) => {
890
+ if (a(t, [
891
+ "input"
892
+ ]))
893
+ return () => {
894
+ oe(t, 0, 0);
895
+ };
896
+ },
897
+ Tab: (e, t, n) => () => {
898
+ const i = Mn(t, n.system.keyboard.modifiers.Shift);
899
+ O(i), k(i) && Z(i, {
900
+ anchorOffset: 0,
901
+ focusOffset: i.value.length
902
+ });
903
+ }
904
+ }, $n = (e, t, n) => {
905
+ if (e.code === "KeyA" && n.system.keyboard.modifiers.Control)
906
+ return () => St(t);
907
+ };
908
+ U.keypress = (e, t, n) => {
909
+ if (e.key === "Enter") {
910
+ if (a(t, "button") || a(t, "input") && Fn.includes(t.type) || a(t, "a") && t.href)
911
+ return () => {
912
+ n.dispatchUIEvent(t, "click");
913
+ };
914
+ if (a(t, "input")) {
915
+ const i = t.form, r = i == null ? void 0 : i.querySelector('input[type="submit"], button:not([type]), button[type="submit"]');
916
+ return r ? () => n.dispatchUIEvent(r, "click") : i && Bn.includes(t.type) && i.querySelectorAll("input").length === 1 ? () => n.dispatchUIEvent(i, "submit") : void 0;
917
+ }
918
+ }
919
+ if (z(t)) {
920
+ const i = e.key === "Enter" ? R(t) && !n.system.keyboard.modifiers.Shift ? "insertParagraph" : "insertLineBreak" : "insertText", r = e.key === "Enter" ? `
921
+ ` : e.key;
922
+ return () => J(n, t, r, i);
923
+ }
924
+ };
925
+ const Fn = [
926
+ "button",
927
+ "color",
928
+ "file",
929
+ "image",
930
+ "reset",
931
+ "submit"
932
+ ], Bn = [
933
+ "email",
934
+ "month",
935
+ "password",
936
+ "search",
937
+ "tel",
938
+ "text",
939
+ "url",
940
+ "week"
941
+ ];
942
+ U.keyup = (e, t, n) => {
943
+ var i;
944
+ return (i = ze[e.key]) === null || i === void 0 ? void 0 : i.call(ze, e, t, n);
945
+ };
946
+ const ze = {
947
+ " ": (e, t, n) => {
948
+ if (vt(t))
949
+ return () => n.dispatchUIEvent(t, "click");
950
+ }
951
+ };
952
+ U.paste = (e, t, n) => {
953
+ if (z(t))
954
+ return () => {
955
+ var i;
956
+ const r = (i = e.clipboardData) === null || i === void 0 ? void 0 : i.getData("text");
957
+ r && J(n, t, r, "insertFromPaste");
958
+ };
959
+ };
960
+ const Pt = {
961
+ auxclick: {
962
+ EventType: "PointerEvent",
963
+ defaultInit: {
964
+ bubbles: !0,
965
+ cancelable: !0,
966
+ composed: !0
967
+ }
968
+ },
969
+ beforeinput: {
970
+ EventType: "InputEvent",
971
+ defaultInit: {
972
+ bubbles: !0,
973
+ cancelable: !0,
974
+ composed: !0
975
+ }
976
+ },
977
+ blur: {
978
+ EventType: "FocusEvent",
979
+ defaultInit: {
980
+ bubbles: !1,
981
+ cancelable: !1,
982
+ composed: !0
983
+ }
984
+ },
985
+ click: {
986
+ EventType: "PointerEvent",
987
+ defaultInit: {
988
+ bubbles: !0,
989
+ cancelable: !0,
990
+ composed: !0
991
+ }
992
+ },
993
+ contextmenu: {
994
+ EventType: "PointerEvent",
995
+ defaultInit: {
996
+ bubbles: !0,
997
+ cancelable: !0,
998
+ composed: !0
999
+ }
1000
+ },
1001
+ copy: {
1002
+ EventType: "ClipboardEvent",
1003
+ defaultInit: {
1004
+ bubbles: !0,
1005
+ cancelable: !0,
1006
+ composed: !0
1007
+ }
1008
+ },
1009
+ change: {
1010
+ EventType: "Event",
1011
+ defaultInit: {
1012
+ bubbles: !0,
1013
+ cancelable: !1
1014
+ }
1015
+ },
1016
+ cut: {
1017
+ EventType: "ClipboardEvent",
1018
+ defaultInit: {
1019
+ bubbles: !0,
1020
+ cancelable: !0,
1021
+ composed: !0
1022
+ }
1023
+ },
1024
+ dblclick: {
1025
+ EventType: "MouseEvent",
1026
+ defaultInit: {
1027
+ bubbles: !0,
1028
+ cancelable: !0,
1029
+ composed: !0
1030
+ }
1031
+ },
1032
+ focus: {
1033
+ EventType: "FocusEvent",
1034
+ defaultInit: {
1035
+ bubbles: !1,
1036
+ cancelable: !1,
1037
+ composed: !0
1038
+ }
1039
+ },
1040
+ focusin: {
1041
+ EventType: "FocusEvent",
1042
+ defaultInit: {
1043
+ bubbles: !0,
1044
+ cancelable: !1,
1045
+ composed: !0
1046
+ }
1047
+ },
1048
+ focusout: {
1049
+ EventType: "FocusEvent",
1050
+ defaultInit: {
1051
+ bubbles: !0,
1052
+ cancelable: !1,
1053
+ composed: !0
1054
+ }
1055
+ },
1056
+ keydown: {
1057
+ EventType: "KeyboardEvent",
1058
+ defaultInit: {
1059
+ bubbles: !0,
1060
+ cancelable: !0,
1061
+ composed: !0
1062
+ }
1063
+ },
1064
+ keypress: {
1065
+ EventType: "KeyboardEvent",
1066
+ defaultInit: {
1067
+ bubbles: !0,
1068
+ cancelable: !0,
1069
+ composed: !0
1070
+ }
1071
+ },
1072
+ keyup: {
1073
+ EventType: "KeyboardEvent",
1074
+ defaultInit: {
1075
+ bubbles: !0,
1076
+ cancelable: !0,
1077
+ composed: !0
1078
+ }
1079
+ },
1080
+ paste: {
1081
+ EventType: "ClipboardEvent",
1082
+ defaultInit: {
1083
+ bubbles: !0,
1084
+ cancelable: !0,
1085
+ composed: !0
1086
+ }
1087
+ },
1088
+ input: {
1089
+ EventType: "InputEvent",
1090
+ defaultInit: {
1091
+ bubbles: !0,
1092
+ cancelable: !1,
1093
+ composed: !0
1094
+ }
1095
+ },
1096
+ mousedown: {
1097
+ EventType: "MouseEvent",
1098
+ defaultInit: {
1099
+ bubbles: !0,
1100
+ cancelable: !0,
1101
+ composed: !0
1102
+ }
1103
+ },
1104
+ mouseenter: {
1105
+ EventType: "MouseEvent",
1106
+ defaultInit: {
1107
+ bubbles: !1,
1108
+ cancelable: !1,
1109
+ composed: !0
1110
+ }
1111
+ },
1112
+ mouseleave: {
1113
+ EventType: "MouseEvent",
1114
+ defaultInit: {
1115
+ bubbles: !1,
1116
+ cancelable: !1,
1117
+ composed: !0
1118
+ }
1119
+ },
1120
+ mousemove: {
1121
+ EventType: "MouseEvent",
1122
+ defaultInit: {
1123
+ bubbles: !0,
1124
+ cancelable: !0,
1125
+ composed: !0
1126
+ }
1127
+ },
1128
+ mouseout: {
1129
+ EventType: "MouseEvent",
1130
+ defaultInit: {
1131
+ bubbles: !0,
1132
+ cancelable: !0,
1133
+ composed: !0
1134
+ }
1135
+ },
1136
+ mouseover: {
1137
+ EventType: "MouseEvent",
1138
+ defaultInit: {
1139
+ bubbles: !0,
1140
+ cancelable: !0,
1141
+ composed: !0
1142
+ }
1143
+ },
1144
+ mouseup: {
1145
+ EventType: "MouseEvent",
1146
+ defaultInit: {
1147
+ bubbles: !0,
1148
+ cancelable: !0,
1149
+ composed: !0
1150
+ }
1151
+ },
1152
+ pointerover: {
1153
+ EventType: "PointerEvent",
1154
+ defaultInit: {
1155
+ bubbles: !0,
1156
+ cancelable: !0,
1157
+ composed: !0
1158
+ }
1159
+ },
1160
+ pointerenter: {
1161
+ EventType: "PointerEvent",
1162
+ defaultInit: {
1163
+ bubbles: !1,
1164
+ cancelable: !1
1165
+ }
1166
+ },
1167
+ pointerdown: {
1168
+ EventType: "PointerEvent",
1169
+ defaultInit: {
1170
+ bubbles: !0,
1171
+ cancelable: !0,
1172
+ composed: !0
1173
+ }
1174
+ },
1175
+ pointermove: {
1176
+ EventType: "PointerEvent",
1177
+ defaultInit: {
1178
+ bubbles: !0,
1179
+ cancelable: !0,
1180
+ composed: !0
1181
+ }
1182
+ },
1183
+ pointerup: {
1184
+ EventType: "PointerEvent",
1185
+ defaultInit: {
1186
+ bubbles: !0,
1187
+ cancelable: !0,
1188
+ composed: !0
1189
+ }
1190
+ },
1191
+ pointercancel: {
1192
+ EventType: "PointerEvent",
1193
+ defaultInit: {
1194
+ bubbles: !0,
1195
+ cancelable: !1,
1196
+ composed: !0
1197
+ }
1198
+ },
1199
+ pointerout: {
1200
+ EventType: "PointerEvent",
1201
+ defaultInit: {
1202
+ bubbles: !0,
1203
+ cancelable: !0,
1204
+ composed: !0
1205
+ }
1206
+ },
1207
+ pointerleave: {
1208
+ EventType: "PointerEvent",
1209
+ defaultInit: {
1210
+ bubbles: !1,
1211
+ cancelable: !1
1212
+ }
1213
+ },
1214
+ submit: {
1215
+ EventType: "Event",
1216
+ defaultInit: {
1217
+ bubbles: !0,
1218
+ cancelable: !0
1219
+ }
1220
+ }
1221
+ };
1222
+ function At(e) {
1223
+ return Pt[e].EventType;
1224
+ }
1225
+ const Vn = [
1226
+ "MouseEvent",
1227
+ "PointerEvent"
1228
+ ];
1229
+ function Kn(e) {
1230
+ return Vn.includes(At(e));
1231
+ }
1232
+ function Rn(e) {
1233
+ return At(e) === "KeyboardEvent";
1234
+ }
1235
+ const jn = {
1236
+ ClipboardEvent: [
1237
+ Gn
1238
+ ],
1239
+ Event: [],
1240
+ FocusEvent: [
1241
+ re,
1242
+ Xn
1243
+ ],
1244
+ InputEvent: [
1245
+ re,
1246
+ Wn
1247
+ ],
1248
+ MouseEvent: [
1249
+ re,
1250
+ Pe,
1251
+ Ye
1252
+ ],
1253
+ PointerEvent: [
1254
+ re,
1255
+ Pe,
1256
+ Ye,
1257
+ Yn
1258
+ ],
1259
+ KeyboardEvent: [
1260
+ re,
1261
+ Pe,
1262
+ zn
1263
+ ]
1264
+ };
1265
+ function Ot(e, t, n) {
1266
+ const i = E(t), { EventType: r, defaultInit: o } = Pt[e], s = new (Hn(i))[r](e, o);
1267
+ return jn[r].forEach((u) => u(s, n ?? {})), s;
1268
+ }
1269
+ function Hn(e) {
1270
+ var t;
1271
+ const n = (t = e.Event) !== null && t !== void 0 ? t : class {
1272
+ };
1273
+ var i;
1274
+ const r = (i = e.AnimationEvent) !== null && i !== void 0 ? i : class extends n {
1275
+ };
1276
+ var o;
1277
+ const s = (o = e.ClipboardEvent) !== null && o !== void 0 ? o : class extends n {
1278
+ };
1279
+ var u;
1280
+ const c = (u = e.PopStateEvent) !== null && u !== void 0 ? u : class extends n {
1281
+ };
1282
+ var d;
1283
+ const l = (d = e.ProgressEvent) !== null && d !== void 0 ? d : class extends n {
1284
+ };
1285
+ var f;
1286
+ const p = (f = e.TransitionEvent) !== null && f !== void 0 ? f : class extends n {
1287
+ };
1288
+ var h;
1289
+ const g = (h = e.UIEvent) !== null && h !== void 0 ? h : class extends n {
1290
+ };
1291
+ var S;
1292
+ const ee = (S = e.CompositionEvent) !== null && S !== void 0 ? S : class extends g {
1293
+ };
1294
+ var x;
1295
+ const te = (x = e.FocusEvent) !== null && x !== void 0 ? x : class extends g {
1296
+ };
1297
+ var N;
1298
+ const ne = (N = e.InputEvent) !== null && N !== void 0 ? N : class extends g {
1299
+ };
1300
+ var M;
1301
+ const ie = (M = e.KeyboardEvent) !== null && M !== void 0 ? M : class extends g {
1302
+ };
1303
+ var L;
1304
+ const $ = (L = e.MouseEvent) !== null && L !== void 0 ? L : class extends g {
1305
+ };
1306
+ var F;
1307
+ const Xt = (F = e.DragEvent) !== null && F !== void 0 ? F : class extends $ {
1308
+ };
1309
+ var Ie;
1310
+ const Wt = (Ie = e.PointerEvent) !== null && Ie !== void 0 ? Ie : class extends $ {
1311
+ };
1312
+ var _e;
1313
+ const zt = (_e = e.TouchEvent) !== null && _e !== void 0 ? _e : class extends g {
1314
+ };
1315
+ return {
1316
+ Event: n,
1317
+ AnimationEvent: r,
1318
+ ClipboardEvent: s,
1319
+ PopStateEvent: c,
1320
+ ProgressEvent: l,
1321
+ TransitionEvent: p,
1322
+ UIEvent: g,
1323
+ CompositionEvent: ee,
1324
+ FocusEvent: te,
1325
+ InputEvent: ne,
1326
+ KeyboardEvent: ie,
1327
+ MouseEvent: $,
1328
+ DragEvent: Xt,
1329
+ PointerEvent: Wt,
1330
+ TouchEvent: zt
1331
+ };
1332
+ }
1333
+ function D(e, t) {
1334
+ for (const [n, i] of Object.entries(t))
1335
+ Object.defineProperty(e, n, {
1336
+ get: () => i ?? null
1337
+ });
1338
+ }
1339
+ function b(e) {
1340
+ return Number(e ?? 0);
1341
+ }
1342
+ function Gn(e, { clipboardData: t }) {
1343
+ D(e, {
1344
+ clipboardData: t
1345
+ });
1346
+ }
1347
+ function Xn(e, { relatedTarget: t }) {
1348
+ D(e, {
1349
+ relatedTarget: t
1350
+ });
1351
+ }
1352
+ function Wn(e, { data: t, inputType: n, isComposing: i }) {
1353
+ D(e, {
1354
+ data: t,
1355
+ isComposing: !!i,
1356
+ inputType: String(n)
1357
+ });
1358
+ }
1359
+ function re(e, { view: t, detail: n }) {
1360
+ D(e, {
1361
+ view: t,
1362
+ detail: b(n ?? 0)
1363
+ });
1364
+ }
1365
+ function Pe(e, { altKey: t, ctrlKey: n, metaKey: i, shiftKey: r, modifierAltGraph: o, modifierCapsLock: s, modifierFn: u, modifierFnLock: c, modifierNumLock: d, modifierScrollLock: l, modifierSymbol: f, modifierSymbolLock: p }) {
1366
+ D(e, {
1367
+ altKey: !!t,
1368
+ ctrlKey: !!n,
1369
+ metaKey: !!i,
1370
+ shiftKey: !!r,
1371
+ getModifierState(h) {
1372
+ return !!{
1373
+ Alt: t,
1374
+ AltGraph: o,
1375
+ CapsLock: s,
1376
+ Control: n,
1377
+ Fn: u,
1378
+ FnLock: c,
1379
+ Meta: i,
1380
+ NumLock: d,
1381
+ ScrollLock: l,
1382
+ Shift: r,
1383
+ Symbol: f,
1384
+ SymbolLock: p
1385
+ }[h];
1386
+ }
1387
+ });
1388
+ }
1389
+ function zn(e, { key: t, code: n, location: i, repeat: r, isComposing: o, charCode: s }) {
1390
+ D(e, {
1391
+ key: String(t),
1392
+ code: String(n),
1393
+ location: b(i),
1394
+ repeat: !!r,
1395
+ isComposing: !!o,
1396
+ charCode: s
1397
+ });
1398
+ }
1399
+ function Ye(e, { x: t, y: n, screenX: i, screenY: r, clientX: o = t, clientY: s = n, button: u, buttons: c, relatedTarget: d, offsetX: l, offsetY: f, pageX: p, pageY: h }) {
1400
+ D(e, {
1401
+ screenX: b(i),
1402
+ screenY: b(r),
1403
+ clientX: b(o),
1404
+ x: b(o),
1405
+ clientY: b(s),
1406
+ y: b(s),
1407
+ button: b(u),
1408
+ buttons: b(c),
1409
+ relatedTarget: d,
1410
+ offsetX: b(l),
1411
+ offsetY: b(f),
1412
+ pageX: b(p),
1413
+ pageY: b(h)
1414
+ });
1415
+ }
1416
+ function Yn(e, { pointerId: t, width: n, height: i, pressure: r, tangentialPressure: o, tiltX: s, tiltY: u, twist: c, pointerType: d, isPrimary: l }) {
1417
+ D(e, {
1418
+ pointerId: b(t),
1419
+ width: b(n ?? 1),
1420
+ height: b(i ?? 1),
1421
+ pressure: b(r),
1422
+ tangentialPressure: b(o),
1423
+ tiltX: b(s),
1424
+ tiltY: b(u),
1425
+ twist: b(c),
1426
+ pointerType: String(d),
1427
+ isPrimary: !!l
1428
+ });
1429
+ }
1430
+ function qn(e, t, n, i = !1) {
1431
+ (Kn(t) || Rn(t)) && (n = {
1432
+ ...n,
1433
+ ...this.system.getUIEventModifiers()
1434
+ });
1435
+ const r = Ot(t, e, n);
1436
+ return Ut.call(this, e, r, i);
1437
+ }
1438
+ function Ut(e, t, n = !1) {
1439
+ var i;
1440
+ const r = t.type, o = n ? () => {
1441
+ } : (i = U[r]) === null || i === void 0 ? void 0 : i.call(U, t, e, this);
1442
+ if (o) {
1443
+ t.preventDefault();
1444
+ let s = !1;
1445
+ return Object.defineProperty(t, "defaultPrevented", {
1446
+ get: () => s
1447
+ }), Object.defineProperty(t, "preventDefault", {
1448
+ value: () => {
1449
+ s = t.cancelable;
1450
+ }
1451
+ }), Y(() => e.dispatchEvent(t)), s || o(), !s;
1452
+ }
1453
+ return Y(() => e.dispatchEvent(t));
1454
+ }
1455
+ function K(e, t, n) {
1456
+ const i = Ot(t, e, n);
1457
+ Y(() => e.dispatchEvent(i));
1458
+ }
1459
+ const qe = Symbol("patched focus/blur methods");
1460
+ function Dt(e) {
1461
+ if (e.prototype[qe])
1462
+ return;
1463
+ const { focus: t, blur: n } = e.prototype;
1464
+ Object.defineProperties(e.prototype, {
1465
+ focus: {
1466
+ configurable: !0,
1467
+ get: () => r
1468
+ },
1469
+ blur: {
1470
+ configurable: !0,
1471
+ get: () => o
1472
+ },
1473
+ [qe]: {
1474
+ configurable: !0,
1475
+ get: () => ({
1476
+ focus: t,
1477
+ blur: n
1478
+ })
1479
+ }
1480
+ });
1481
+ let i;
1482
+ function r(s) {
1483
+ if (this.ownerDocument.visibilityState !== "hidden")
1484
+ return t.call(this, s);
1485
+ const u = Je(this.ownerDocument);
1486
+ if (u === this)
1487
+ return;
1488
+ const c = Symbol("focus call");
1489
+ i = c, u && (n.call(u), K(u, "blur", {
1490
+ relatedTarget: this
1491
+ }), K(u, "focusout", {
1492
+ relatedTarget: i === c ? this : null
1493
+ })), i === c && (t.call(this, s), K(this, "focus", {
1494
+ relatedTarget: u
1495
+ })), i === c && K(this, "focusin", {
1496
+ relatedTarget: u
1497
+ });
1498
+ }
1499
+ function o() {
1500
+ if (this.ownerDocument.visibilityState !== "hidden")
1501
+ return n.call(this);
1502
+ const s = Je(this.ownerDocument);
1503
+ if (s !== this)
1504
+ return;
1505
+ i = Symbol("blur call"), n.call(this), K(s, "blur", {
1506
+ relatedTarget: null
1507
+ }), K(s, "focusout", {
1508
+ relatedTarget: null
1509
+ });
1510
+ }
1511
+ }
1512
+ function Je(e) {
1513
+ const t = fe(e);
1514
+ return (t == null ? void 0 : t.tagName) === "BODY" ? null : t;
1515
+ }
1516
+ const Ae = Symbol("Interceptor for programmatical calls");
1517
+ function G(e, t, n) {
1518
+ const i = Object.getOwnPropertyDescriptor(e.constructor.prototype, t), r = Object.getOwnPropertyDescriptor(e, t), o = i != null && i.set ? "set" : "value";
1519
+ if (typeof (i == null ? void 0 : i[o]) != "function" || i[o][Ae])
1520
+ throw new Error(`Element ${e.tagName} does not implement "${String(t)}".`);
1521
+ function s(...u) {
1522
+ const { applyNative: c = !1, realArgs: d, then: l } = n.call(this, ...u), f = (!c && r || i)[o];
1523
+ o === "set" ? f.call(this, d) : f.call(this, ...d), l == null || l();
1524
+ }
1525
+ s[Ae] = Ae, Object.defineProperty(e, t, {
1526
+ ...r ?? i,
1527
+ [o]: s
1528
+ });
1529
+ }
1530
+ function Jn(e) {
1531
+ G(e, "value", function(n) {
1532
+ const i = an(n);
1533
+ return i && Cn(this), {
1534
+ applyNative: !!i,
1535
+ realArgs: Qn(this, n),
1536
+ then: i ? void 0 : () => In(this, String(n))
1537
+ };
1538
+ });
1539
+ }
1540
+ function Qn(e, t) {
1541
+ return a(e, "input", {
1542
+ type: "number"
1543
+ }) && String(t) !== "" && !Number.isNaN(Number(t)) ? String(Number(t)) : String(t);
1544
+ }
1545
+ function Zn(e) {
1546
+ G(e, "setSelectionRange", function(n, ...i) {
1547
+ const r = fn(n);
1548
+ return {
1549
+ applyNative: !!r,
1550
+ realArgs: [
1551
+ Number(n),
1552
+ ...i
1553
+ ],
1554
+ then: () => r ? void 0 : ye(e)
1555
+ };
1556
+ }), G(e, "selectionStart", function(n) {
1557
+ return {
1558
+ realArgs: n,
1559
+ then: () => ye(e)
1560
+ };
1561
+ }), G(e, "selectionEnd", function(n) {
1562
+ return {
1563
+ realArgs: n,
1564
+ then: () => ye(e)
1565
+ };
1566
+ }), G(e, "select", function() {
1567
+ return {
1568
+ realArgs: [],
1569
+ then: () => bn(e, {
1570
+ anchorOffset: 0,
1571
+ focusOffset: T(e).length
1572
+ })
1573
+ };
1574
+ });
1575
+ }
1576
+ function ei(e) {
1577
+ G(e, "setRangeText", function(...n) {
1578
+ return {
1579
+ realArgs: n,
1580
+ then: () => {
1581
+ Fe(e), ye(e);
1582
+ }
1583
+ };
1584
+ });
1585
+ }
1586
+ const X = Symbol("Node prepared with document state workarounds");
1587
+ function xt(e) {
1588
+ e[X] || (e.addEventListener("focus", (t) => {
1589
+ const n = t.target;
1590
+ Qe(n);
1591
+ }, {
1592
+ capture: !0,
1593
+ passive: !0
1594
+ }), e.activeElement && Qe(e.activeElement), e.addEventListener("blur", (t) => {
1595
+ const n = t.target, i = hn(n);
1596
+ i !== void 0 && (n.value !== i && K(n, "change"), wt(n));
1597
+ }, {
1598
+ capture: !0,
1599
+ passive: !0
1600
+ }), e[X] = X);
1601
+ }
1602
+ function Qe(e) {
1603
+ e[X] || (a(e, [
1604
+ "input",
1605
+ "textarea"
1606
+ ]) && (Jn(e), Zn(e), ei(e)), e[X] = X);
1607
+ }
1608
+ function ti(e) {
1609
+ return ni(e) ? e : e.ownerDocument;
1610
+ }
1611
+ function ni(e) {
1612
+ return e.nodeType === 9;
1613
+ }
1614
+ var m = /* @__PURE__ */ (function(e) {
1615
+ return e[e.Trigger = 2] = "Trigger", e[e.Call = 1] = "Call", e;
1616
+ })({});
1617
+ function se(e, t) {
1618
+ e.levelRefs[t] = {};
1619
+ }
1620
+ function ge(e, t) {
1621
+ return e.levelRefs[t];
1622
+ }
1623
+ function Q(e) {
1624
+ const t = e.delay;
1625
+ if (typeof t == "number")
1626
+ return Promise.all([
1627
+ new Promise((n) => globalThis.setTimeout(() => n(), t)),
1628
+ e.advanceTimers(t)
1629
+ ]);
1630
+ }
1631
+ var Ee = /* @__PURE__ */ (function(e) {
1632
+ return e[e.EachTrigger = 4] = "EachTrigger", e[e.EachApiCall = 2] = "EachApiCall", e[e.EachTarget = 1] = "EachTarget", e[e.Never = 0] = "Never", e;
1633
+ })({});
1634
+ function B(e, t, n) {
1635
+ return t in e ? Object.defineProperty(e, t, {
1636
+ value: n,
1637
+ enumerable: !0,
1638
+ configurable: !0,
1639
+ writable: !0
1640
+ }) : e[t] = n, e;
1641
+ }
1642
+ var w = /* @__PURE__ */ (function(e) {
1643
+ return e[e.STANDARD = 0] = "STANDARD", e[e.LEFT = 1] = "LEFT", e[e.RIGHT = 2] = "RIGHT", e[e.NUMPAD = 3] = "NUMPAD", e;
1644
+ })({});
1645
+ const ii = [
1646
+ "Alt",
1647
+ "AltGraph",
1648
+ "Control",
1649
+ "Fn",
1650
+ "Meta",
1651
+ "Shift",
1652
+ "Symbol"
1653
+ ];
1654
+ function Ze(e) {
1655
+ return ii.includes(e);
1656
+ }
1657
+ const ri = [
1658
+ "CapsLock",
1659
+ "FnLock",
1660
+ "NumLock",
1661
+ "ScrollLock",
1662
+ "SymbolLock"
1663
+ ];
1664
+ function et(e) {
1665
+ return ri.includes(e);
1666
+ }
1667
+ class oi {
1668
+ isKeyPressed(t) {
1669
+ return this.pressed.has(String(t.code));
1670
+ }
1671
+ getPressedKeys() {
1672
+ return this.pressed.values().map((t) => t.keyDef);
1673
+ }
1674
+ /** Press a key */
1675
+ async keydown(t, n) {
1676
+ const i = String(n.key), r = String(n.code), o = Se(t.config.document);
1677
+ this.setKeydownTarget(o), this.pressed.add(r, n), Ze(i) && (this.modifiers[i] = !0);
1678
+ const s = t.dispatchUIEvent(o, "keydown", {
1679
+ key: i,
1680
+ code: r
1681
+ });
1682
+ et(i) && !this.modifiers[i] && (this.modifiers[i] = !0, this.modifierLockStart[i] = !0), s && this.pressed.setUnprevented(r), s && this.hasKeyPress(i) && t.dispatchUIEvent(Se(t.config.document), "keypress", {
1683
+ key: i,
1684
+ code: r,
1685
+ charCode: n.key === "Enter" ? 13 : String(n.key).charCodeAt(0)
1686
+ });
1687
+ }
1688
+ /** Release a key */
1689
+ async keyup(t, n) {
1690
+ const i = String(n.key), r = String(n.code), o = this.pressed.isUnprevented(r);
1691
+ this.pressed.delete(r), Ze(i) && !this.pressed.values().find((s) => s.keyDef.key === i) && (this.modifiers[i] = !1), t.dispatchUIEvent(Se(t.config.document), "keyup", {
1692
+ key: i,
1693
+ code: r
1694
+ }, !o), et(i) && this.modifiers[i] && (this.modifierLockStart[i] ? this.modifierLockStart[i] = !1 : this.modifiers[i] = !1);
1695
+ }
1696
+ setKeydownTarget(t) {
1697
+ t !== this.lastKeydownTarget && (this.carryChar = ""), this.lastKeydownTarget = t;
1698
+ }
1699
+ hasKeyPress(t) {
1700
+ return (t.length === 1 || t === "Enter") && !this.modifiers.Control && !this.modifiers.Alt;
1701
+ }
1702
+ constructor(t) {
1703
+ B(this, "system", void 0), B(this, "modifiers", {
1704
+ Alt: !1,
1705
+ AltGraph: !1,
1706
+ CapsLock: !1,
1707
+ Control: !1,
1708
+ Fn: !1,
1709
+ FnLock: !1,
1710
+ Meta: !1,
1711
+ NumLock: !1,
1712
+ ScrollLock: !1,
1713
+ Shift: !1,
1714
+ Symbol: !1,
1715
+ SymbolLock: !1
1716
+ }), B(this, "pressed", new class {
1717
+ add(n, i) {
1718
+ var r, o, s;
1719
+ (s = (r = this.registry)[o = n]) !== null && s !== void 0 || (r[o] = {
1720
+ keyDef: i,
1721
+ unpreventedDefault: !1
1722
+ });
1723
+ }
1724
+ has(n) {
1725
+ return !!this.registry[n];
1726
+ }
1727
+ setUnprevented(n) {
1728
+ const i = this.registry[n];
1729
+ i && (i.unpreventedDefault = !0);
1730
+ }
1731
+ isUnprevented(n) {
1732
+ var i;
1733
+ return !!(!((i = this.registry[n]) === null || i === void 0) && i.unpreventedDefault);
1734
+ }
1735
+ delete(n) {
1736
+ delete this.registry[n];
1737
+ }
1738
+ values() {
1739
+ return Object.values(this.registry);
1740
+ }
1741
+ constructor() {
1742
+ B(this, "registry", {});
1743
+ }
1744
+ }()), B(this, "carryChar", ""), B(this, "lastKeydownTarget", void 0), B(this, "modifierLockStart", {}), this.system = t;
1745
+ }
1746
+ }
1747
+ const si = [
1748
+ // alphanumeric block - writing system
1749
+ ..."0123456789".split("").map((e) => ({
1750
+ code: `Digit${e}`,
1751
+ key: e
1752
+ })),
1753
+ ...")!@#$%^&*(".split("").map((e, t) => ({
1754
+ code: `Digit${t}`,
1755
+ key: e,
1756
+ shiftKey: !0
1757
+ })),
1758
+ ..."abcdefghijklmnopqrstuvwxyz".split("").map((e) => ({
1759
+ code: `Key${e.toUpperCase()}`,
1760
+ key: e
1761
+ })),
1762
+ ..."ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("").map((e) => ({
1763
+ code: `Key${e}`,
1764
+ key: e,
1765
+ shiftKey: !0
1766
+ })),
1767
+ {
1768
+ code: "BracketLeft",
1769
+ key: "["
1770
+ },
1771
+ {
1772
+ code: "BracketLeft",
1773
+ key: "{",
1774
+ shiftKey: !0
1775
+ },
1776
+ {
1777
+ code: "BracketRight",
1778
+ key: "]"
1779
+ },
1780
+ {
1781
+ code: "BracketRight",
1782
+ key: "}",
1783
+ shiftKey: !0
1784
+ },
1785
+ // alphanumeric block - functional
1786
+ {
1787
+ code: "Space",
1788
+ key: " "
1789
+ },
1790
+ {
1791
+ code: "AltLeft",
1792
+ key: "Alt",
1793
+ location: w.LEFT
1794
+ },
1795
+ {
1796
+ code: "AltRight",
1797
+ key: "Alt",
1798
+ location: w.RIGHT
1799
+ },
1800
+ {
1801
+ code: "ShiftLeft",
1802
+ key: "Shift",
1803
+ location: w.LEFT
1804
+ },
1805
+ {
1806
+ code: "ShiftRight",
1807
+ key: "Shift",
1808
+ location: w.RIGHT
1809
+ },
1810
+ {
1811
+ code: "ControlLeft",
1812
+ key: "Control",
1813
+ location: w.LEFT
1814
+ },
1815
+ {
1816
+ code: "ControlRight",
1817
+ key: "Control",
1818
+ location: w.RIGHT
1819
+ },
1820
+ {
1821
+ code: "MetaLeft",
1822
+ key: "Meta",
1823
+ location: w.LEFT
1824
+ },
1825
+ {
1826
+ code: "MetaRight",
1827
+ key: "Meta",
1828
+ location: w.RIGHT
1829
+ },
1830
+ {
1831
+ code: "OSLeft",
1832
+ key: "OS",
1833
+ location: w.LEFT
1834
+ },
1835
+ {
1836
+ code: "OSRight",
1837
+ key: "OS",
1838
+ location: w.RIGHT
1839
+ },
1840
+ {
1841
+ code: "ContextMenu",
1842
+ key: "ContextMenu"
1843
+ },
1844
+ {
1845
+ code: "Tab",
1846
+ key: "Tab"
1847
+ },
1848
+ {
1849
+ code: "CapsLock",
1850
+ key: "CapsLock"
1851
+ },
1852
+ {
1853
+ code: "Backspace",
1854
+ key: "Backspace"
1855
+ },
1856
+ {
1857
+ code: "Enter",
1858
+ key: "Enter"
1859
+ },
1860
+ // function
1861
+ {
1862
+ code: "Escape",
1863
+ key: "Escape"
1864
+ },
1865
+ // arrows
1866
+ {
1867
+ code: "ArrowUp",
1868
+ key: "ArrowUp"
1869
+ },
1870
+ {
1871
+ code: "ArrowDown",
1872
+ key: "ArrowDown"
1873
+ },
1874
+ {
1875
+ code: "ArrowLeft",
1876
+ key: "ArrowLeft"
1877
+ },
1878
+ {
1879
+ code: "ArrowRight",
1880
+ key: "ArrowRight"
1881
+ },
1882
+ // control pad
1883
+ {
1884
+ code: "Home",
1885
+ key: "Home"
1886
+ },
1887
+ {
1888
+ code: "End",
1889
+ key: "End"
1890
+ },
1891
+ {
1892
+ code: "Delete",
1893
+ key: "Delete"
1894
+ },
1895
+ {
1896
+ code: "PageUp",
1897
+ key: "PageUp"
1898
+ },
1899
+ {
1900
+ code: "PageDown",
1901
+ key: "PageDown"
1902
+ },
1903
+ // Special keys that are not part of a default US-layout but included for specific behavior
1904
+ {
1905
+ code: "Fn",
1906
+ key: "Fn"
1907
+ },
1908
+ {
1909
+ code: "Symbol",
1910
+ key: "Symbol"
1911
+ },
1912
+ {
1913
+ code: "AltRight",
1914
+ key: "AltGraph"
1915
+ }
1916
+ ], ui = [
1917
+ {
1918
+ name: "MouseLeft",
1919
+ pointerType: "mouse",
1920
+ button: "primary"
1921
+ },
1922
+ {
1923
+ name: "MouseRight",
1924
+ pointerType: "mouse",
1925
+ button: "secondary"
1926
+ },
1927
+ {
1928
+ name: "MouseMiddle",
1929
+ pointerType: "mouse",
1930
+ button: "auxiliary"
1931
+ },
1932
+ {
1933
+ name: "TouchA",
1934
+ pointerType: "touch"
1935
+ },
1936
+ {
1937
+ name: "TouchB",
1938
+ pointerType: "touch"
1939
+ },
1940
+ {
1941
+ name: "TouchC",
1942
+ pointerType: "touch"
1943
+ }
1944
+ ];
1945
+ function ci(e, t, n) {
1946
+ return t in e ? Object.defineProperty(e, t, {
1947
+ value: n,
1948
+ enumerable: !0,
1949
+ configurable: !0,
1950
+ writable: !0
1951
+ }) : e[t] = n, e;
1952
+ }
1953
+ class Nt {
1954
+ getButtons() {
1955
+ let t = 0;
1956
+ for (const n of Object.keys(this.pressed))
1957
+ t |= 2 ** Number(n);
1958
+ return t;
1959
+ }
1960
+ down(t) {
1961
+ const n = Ue(t.button);
1962
+ if (n in this.pressed) {
1963
+ this.pressed[n].push(t);
1964
+ return;
1965
+ }
1966
+ return this.pressed[n] = [
1967
+ t
1968
+ ], n;
1969
+ }
1970
+ up(t) {
1971
+ const n = Ue(t.button);
1972
+ if (n in this.pressed && (this.pressed[n] = this.pressed[n].filter((i) => i.name !== t.name), this.pressed[n].length === 0))
1973
+ return delete this.pressed[n], n;
1974
+ }
1975
+ constructor() {
1976
+ ci(this, "pressed", {});
1977
+ }
1978
+ }
1979
+ const tt = {
1980
+ primary: 0,
1981
+ secondary: 1,
1982
+ auxiliary: 2,
1983
+ back: 3,
1984
+ X1: 3,
1985
+ forward: 4,
1986
+ X2: 4
1987
+ };
1988
+ function Ue(e = 0) {
1989
+ return e in tt ? tt[e] : Number(e);
1990
+ }
1991
+ const nt = {
1992
+ 1: 2,
1993
+ 2: 1
1994
+ };
1995
+ function De(e) {
1996
+ return e = Ue(e), e in nt ? nt[e] : e;
1997
+ }
1998
+ function di(e, t, n) {
1999
+ return t in e ? Object.defineProperty(e, t, {
2000
+ value: n,
2001
+ enumerable: !0,
2002
+ configurable: !0,
2003
+ writable: !0
2004
+ }) : e[t] = n, e;
2005
+ }
2006
+ class li {
2007
+ get countPressed() {
2008
+ return this.pressedKeys.size;
2009
+ }
2010
+ isPressed(t) {
2011
+ return this.pressedKeys.has(t.name);
2012
+ }
2013
+ addPressed(t) {
2014
+ return this.pressedKeys.add(t.name);
2015
+ }
2016
+ removePressed(t) {
2017
+ return this.pressedKeys.delete(t.name);
2018
+ }
2019
+ constructor() {
2020
+ di(this, "pressedKeys", /* @__PURE__ */ new Set());
2021
+ }
2022
+ }
2023
+ function ce(e, t) {
2024
+ const n = [];
2025
+ for (let o = e; o; o = o.parentElement)
2026
+ n.push(o);
2027
+ const i = [];
2028
+ for (let o = t; o; o = o.parentElement)
2029
+ i.push(o);
2030
+ let r = 0;
2031
+ for (; !(r >= n.length || r >= i.length || n[n.length - 1 - r] !== i[i.length - 1 - r]); r++)
2032
+ ;
2033
+ return [
2034
+ n.slice(0, n.length - r),
2035
+ i.slice(0, i.length - r),
2036
+ i.slice(i.length - r)
2037
+ ];
2038
+ }
2039
+ function xe({ target: e, node: t, offset: n }) {
2040
+ return k(e) ? {
2041
+ node: e,
2042
+ offset: n ?? T(e).length
2043
+ } : t ? {
2044
+ node: t,
2045
+ offset: n ?? (t.nodeType === 3 ? t.nodeValue.length : t.childNodes.length)
2046
+ } : Mt(e, n);
2047
+ }
2048
+ function Mt(e, t, n = !0) {
2049
+ let i = t === void 0 ? e.childNodes.length - 1 : 0;
2050
+ const r = t === void 0 ? -1 : 1;
2051
+ for (; t === void 0 ? i >= (n ? Math.max(e.childNodes.length - 1, 0) : 0) : i <= e.childNodes.length; ) {
2052
+ if (t && i === e.childNodes.length)
2053
+ throw new Error("The given offset is out of bounds.");
2054
+ const o = e.childNodes.item(i), s = String(o.textContent);
2055
+ if (s.length)
2056
+ if (t !== void 0 && s.length < t)
2057
+ t -= s.length;
2058
+ else {
2059
+ if (o.nodeType === 1)
2060
+ return Mt(o, t, !1);
2061
+ if (o.nodeType === 3)
2062
+ return {
2063
+ node: o,
2064
+ offset: t ?? o.nodeValue.length
2065
+ };
2066
+ }
2067
+ i += r;
2068
+ }
2069
+ return {
2070
+ node: e,
2071
+ offset: e.childNodes.length
2072
+ };
2073
+ }
2074
+ function ai({ document: e, target: t, clickCount: n, node: i, offset: r }) {
2075
+ if (cn(t))
2076
+ return;
2077
+ const o = k(t), s = String(o ? T(t) : t.textContent), [u, c] = i ? (
2078
+ // which elements might be considered in the same line of text.
2079
+ // TODO: support expanding initial range on multiple clicks if node is given
2080
+ [
2081
+ r,
2082
+ r
2083
+ ]
2084
+ ) : fi(s, r, n);
2085
+ if (o)
2086
+ return Z(t, {
2087
+ anchorOffset: u ?? s.length,
2088
+ focusOffset: c ?? s.length
2089
+ }), {
2090
+ node: t,
2091
+ start: u ?? 0,
2092
+ end: c ?? s.length
2093
+ };
2094
+ {
2095
+ const { node: d, offset: l } = xe({
2096
+ target: t,
2097
+ node: i,
2098
+ offset: u
2099
+ }), { node: f, offset: p } = xe({
2100
+ target: t,
2101
+ node: i,
2102
+ offset: c
2103
+ }), h = t.ownerDocument.createRange();
2104
+ try {
2105
+ h.setStart(d, l), h.setEnd(f, p);
2106
+ } catch {
2107
+ throw new Error("The given offset is out of bounds.");
2108
+ }
2109
+ const g = e.getSelection();
2110
+ return g == null || g.removeAllRanges(), g == null || g.addRange(h.cloneRange()), h;
2111
+ }
2112
+ }
2113
+ function fi(e, t, n) {
2114
+ if (n % 3 === 1 || e.length === 0)
2115
+ return [
2116
+ t,
2117
+ t
2118
+ ];
2119
+ const i = t ?? e.length;
2120
+ return n % 3 === 2 ? [
2121
+ i - e.substr(0, t).match(/(\w+|\s+|\W)?$/)[0].length,
2122
+ t === void 0 ? t : t + e.substr(t).match(/^(\w+|\s+|\W)?/)[0].length
2123
+ ] : [
2124
+ i - e.substr(0, t).match(/[^\r\n]*$/)[0].length,
2125
+ t === void 0 ? t : t + e.substr(t).match(/^[^\r\n]*/)[0].length
2126
+ ];
2127
+ }
2128
+ function pi(e, { document: t, target: n, node: i, offset: r }) {
2129
+ const o = xe({
2130
+ target: n,
2131
+ node: i,
2132
+ offset: r
2133
+ });
2134
+ if ("node" in e) {
2135
+ if (o.node === e.node) {
2136
+ const s = o.offset < e.start ? e.end : e.start, u = o.offset > e.end || o.offset < e.start ? o.offset : e.end;
2137
+ Z(e.node, {
2138
+ anchorOffset: s,
2139
+ focusOffset: u
2140
+ });
2141
+ }
2142
+ } else {
2143
+ const s = e.cloneRange(), u = s.comparePoint(o.node, o.offset);
2144
+ u < 0 ? s.setStart(o.node, o.offset) : u > 0 && s.setEnd(o.node, o.offset);
2145
+ const c = t.getSelection();
2146
+ c == null || c.removeAllRanges(), c == null || c.addRange(s.cloneRange());
2147
+ }
2148
+ }
2149
+ function Lt(e, t) {
2150
+ var n, i, r, o, s, u, c, d, l, f, p, h, g, S, ee, x, te, N, ne, M, ie, L, $, F;
2151
+ return e.target !== t.target || ((n = e.coords) === null || n === void 0 ? void 0 : n.x) !== ((i = t.coords) === null || i === void 0 ? void 0 : i.x) || ((r = e.coords) === null || r === void 0 ? void 0 : r.y) !== ((o = t.coords) === null || o === void 0 ? void 0 : o.y) || ((s = e.coords) === null || s === void 0 ? void 0 : s.clientX) !== ((u = t.coords) === null || u === void 0 ? void 0 : u.clientX) || ((c = e.coords) === null || c === void 0 ? void 0 : c.clientY) !== ((d = t.coords) === null || d === void 0 ? void 0 : d.clientY) || ((l = e.coords) === null || l === void 0 ? void 0 : l.offsetX) !== ((f = t.coords) === null || f === void 0 ? void 0 : f.offsetX) || ((p = e.coords) === null || p === void 0 ? void 0 : p.offsetY) !== ((h = t.coords) === null || h === void 0 ? void 0 : h.offsetY) || ((g = e.coords) === null || g === void 0 ? void 0 : g.pageX) !== ((S = t.coords) === null || S === void 0 ? void 0 : S.pageX) || ((ee = e.coords) === null || ee === void 0 ? void 0 : ee.pageY) !== ((x = t.coords) === null || x === void 0 ? void 0 : x.pageY) || ((te = e.coords) === null || te === void 0 ? void 0 : te.screenX) !== ((N = t.coords) === null || N === void 0 ? void 0 : N.screenX) || ((ne = e.coords) === null || ne === void 0 ? void 0 : ne.screenY) !== ((M = t.coords) === null || M === void 0 ? void 0 : M.screenY) || ((ie = e.caret) === null || ie === void 0 ? void 0 : ie.node) !== ((L = t.caret) === null || L === void 0 ? void 0 : L.node) || (($ = e.caret) === null || $ === void 0 ? void 0 : $.offset) !== ((F = t.caret) === null || F === void 0 ? void 0 : F.offset);
2152
+ }
2153
+ function V(e, t, n) {
2154
+ return t in e ? Object.defineProperty(e, t, {
2155
+ value: n,
2156
+ enumerable: !0,
2157
+ configurable: !0,
2158
+ writable: !0
2159
+ }) : e[t] = n, e;
2160
+ }
2161
+ class hi {
2162
+ move(t, n, i) {
2163
+ const r = this.position, o = this.getTarget(t);
2164
+ if (this.position = n, !Lt(r, n))
2165
+ return;
2166
+ const s = this.getTarget(t), u = this.getEventInit("mousemove"), [c, d] = ce(o, s);
2167
+ return {
2168
+ leave: () => {
2169
+ o !== s && (t.dispatchUIEvent(o, "mouseout", u), c.forEach((l) => t.dispatchUIEvent(l, "mouseleave", u)));
2170
+ },
2171
+ enter: () => {
2172
+ o !== s && (t.dispatchUIEvent(s, "mouseover", u), d.forEach((l) => t.dispatchUIEvent(l, "mouseenter", u)));
2173
+ },
2174
+ move: () => {
2175
+ i || (t.dispatchUIEvent(s, "mousemove", u), this.modifySelecting(t));
2176
+ }
2177
+ };
2178
+ }
2179
+ down(t, n, i) {
2180
+ const r = this.buttons.down(n);
2181
+ if (r === void 0)
2182
+ return;
2183
+ const o = this.getTarget(t);
2184
+ this.buttonDownTarget[r] = o;
2185
+ const s = this.getEventInit("mousedown", n.button), u = _(o);
2186
+ !i && (u || t.dispatchUIEvent(o, "mousedown", s)) && (this.startSelecting(t, s.detail), O(o)), !u && De(n.button) === 2 && t.dispatchUIEvent(o, "contextmenu", this.getEventInit("contextmenu", n.button));
2187
+ }
2188
+ up(t, n, i) {
2189
+ const r = this.buttons.up(n);
2190
+ if (r === void 0)
2191
+ return;
2192
+ const o = this.getTarget(t);
2193
+ if (!_(o)) {
2194
+ if (!i) {
2195
+ const u = this.getEventInit("mouseup", n.button);
2196
+ t.dispatchUIEvent(o, "mouseup", u), this.endSelecting();
2197
+ }
2198
+ const s = ce(this.buttonDownTarget[r], o)[2][0];
2199
+ if (s) {
2200
+ const u = this.getEventInit("click", n.button);
2201
+ u.detail && (t.dispatchUIEvent(s, u.button === 0 ? "click" : "auxclick", u), u.button === 0 && u.detail === 2 && t.dispatchUIEvent(s, "dblclick", {
2202
+ ...this.getEventInit("dblclick", n.button),
2203
+ detail: u.detail
2204
+ }));
2205
+ }
2206
+ }
2207
+ }
2208
+ resetClickCount() {
2209
+ this.clickCount.reset();
2210
+ }
2211
+ getEventInit(t, n) {
2212
+ const i = {
2213
+ ...this.position.coords
2214
+ };
2215
+ return i.button = De(n), i.buttons = this.buttons.getButtons(), t === "mousedown" ? i.detail = this.clickCount.getOnDown(i.button) : t === "mouseup" ? i.detail = this.clickCount.getOnUp(i.button) : (t === "click" || t === "auxclick") && (i.detail = this.clickCount.incOnClick(i.button)), i;
2216
+ }
2217
+ getTarget(t) {
2218
+ var n;
2219
+ return (n = this.position.target) !== null && n !== void 0 ? n : t.config.document.body;
2220
+ }
2221
+ startSelecting(t, n) {
2222
+ var i, r;
2223
+ this.selecting = ai({
2224
+ document: t.config.document,
2225
+ target: this.getTarget(t),
2226
+ node: (i = this.position.caret) === null || i === void 0 ? void 0 : i.node,
2227
+ offset: (r = this.position.caret) === null || r === void 0 ? void 0 : r.offset,
2228
+ clickCount: n
2229
+ });
2230
+ }
2231
+ modifySelecting(t) {
2232
+ var n, i;
2233
+ this.selecting && pi(this.selecting, {
2234
+ document: t.config.document,
2235
+ target: this.getTarget(t),
2236
+ node: (n = this.position.caret) === null || n === void 0 ? void 0 : n.node,
2237
+ offset: (i = this.position.caret) === null || i === void 0 ? void 0 : i.offset
2238
+ });
2239
+ }
2240
+ endSelecting() {
2241
+ this.selecting = void 0;
2242
+ }
2243
+ constructor() {
2244
+ V(this, "position", {}), V(this, "buttons", new Nt()), V(this, "selecting", void 0), V(this, "buttonDownTarget", {}), V(this, "clickCount", new class {
2245
+ incOnClick(t) {
2246
+ const n = this.down[t] === void 0 ? void 0 : Number(this.down[t]) + 1;
2247
+ return this.count = this.count[t] === void 0 ? {} : {
2248
+ [t]: Number(this.count[t]) + 1
2249
+ }, n;
2250
+ }
2251
+ getOnDown(t) {
2252
+ var n;
2253
+ this.down = {
2254
+ [t]: (n = this.count[t]) !== null && n !== void 0 ? n : 0
2255
+ };
2256
+ var i;
2257
+ return this.count = {
2258
+ [t]: (i = this.count[t]) !== null && i !== void 0 ? i : 0
2259
+ }, Number(this.count[t]) + 1;
2260
+ }
2261
+ getOnUp(t) {
2262
+ return this.down[t] === void 0 ? void 0 : Number(this.down[t]) + 1;
2263
+ }
2264
+ reset() {
2265
+ this.count = {};
2266
+ }
2267
+ constructor() {
2268
+ V(this, "down", {}), V(this, "count", {});
2269
+ }
2270
+ }());
2271
+ }
2272
+ }
2273
+ function Ce(e, t) {
2274
+ var n;
2275
+ return ((n = $t(e, t)) === null || n === void 0 ? void 0 : n.pointerEvents) !== "none";
2276
+ }
2277
+ function bi(e) {
2278
+ const t = E(e);
2279
+ for (let n = e, i = []; n != null && n.ownerDocument; n = n.parentElement) {
2280
+ i.push(n);
2281
+ const r = t.getComputedStyle(n).pointerEvents;
2282
+ if (r && ![
2283
+ "inherit",
2284
+ "unset"
2285
+ ].includes(r))
2286
+ return {
2287
+ pointerEvents: r,
2288
+ tree: i
2289
+ };
2290
+ }
2291
+ }
2292
+ const it = Symbol("Last check for pointer-events");
2293
+ function $t(e, t) {
2294
+ const n = t[it];
2295
+ if (!(e.config.pointerEventsCheck !== Ee.Never && (!n || rt(e.config.pointerEventsCheck, Ee.EachApiCall) && n[m.Call] !== ge(e, m.Call) || rt(e.config.pointerEventsCheck, Ee.EachTrigger) && n[m.Trigger] !== ge(e, m.Trigger))))
2296
+ return n == null ? void 0 : n.result;
2297
+ const r = bi(t);
2298
+ return t[it] = {
2299
+ [m.Call]: ge(e, m.Call),
2300
+ [m.Trigger]: ge(e, m.Trigger),
2301
+ result: r
2302
+ }, r;
2303
+ }
2304
+ function ue(e, t) {
2305
+ const n = $t(e, t);
2306
+ if ((n == null ? void 0 : n.pointerEvents) === "none")
2307
+ throw new Error([
2308
+ `Unable to perform pointer interaction as the element ${n.tree.length > 1 ? "inherits" : "has"} \`pointer-events: none\`:`,
2309
+ "",
2310
+ gi(n.tree)
2311
+ ].join(`
2312
+ `));
2313
+ }
2314
+ function gi(e) {
2315
+ return e.reverse().map((t, n) => [
2316
+ "".padEnd(n),
2317
+ t.tagName,
2318
+ t.id && `#${t.id}`,
2319
+ t.hasAttribute("data-testid") && `(testId=${t.getAttribute("data-testid")})`,
2320
+ vi(t),
2321
+ e.length > 1 && n === 0 && " <-- This element declared `pointer-events: none`",
2322
+ e.length > 1 && n === e.length - 1 && " <-- Asserted pointer events here"
2323
+ ].filter(Boolean).join("")).join(`
2324
+ `);
2325
+ }
2326
+ function vi(e) {
2327
+ var t;
2328
+ let n;
2329
+ if (e.hasAttribute("aria-label"))
2330
+ n = e.getAttribute("aria-label");
2331
+ else if (e.hasAttribute("aria-labelledby")) {
2332
+ var i, r;
2333
+ n = (r = e.ownerDocument.getElementById(e.getAttribute("aria-labelledby"))) === null || r === void 0 || (i = r.textContent) === null || i === void 0 ? void 0 : i.trim();
2334
+ } else if (a(e, [
2335
+ "button",
2336
+ "input",
2337
+ "meter",
2338
+ "output",
2339
+ "progress",
2340
+ "select",
2341
+ "textarea"
2342
+ ]) && (!((t = e.labels) === null || t === void 0) && t.length))
2343
+ n = Array.from(e.labels).map((s) => {
2344
+ var u;
2345
+ return (u = s.textContent) === null || u === void 0 ? void 0 : u.trim();
2346
+ }).join("|");
2347
+ else if (a(e, "button")) {
2348
+ var o;
2349
+ n = (o = e.textContent) === null || o === void 0 ? void 0 : o.trim();
2350
+ }
2351
+ return n = n == null ? void 0 : n.replace(/\n/g, " "), Number(n == null ? void 0 : n.length) > 30 && (n = `${n == null ? void 0 : n.substring(0, 29)}…`), n ? `(label=${n})` : "";
2352
+ }
2353
+ function rt(e, t) {
2354
+ return (e & t) > 0;
2355
+ }
2356
+ function C(e, t, n) {
2357
+ return t in e ? Object.defineProperty(e, t, {
2358
+ value: n,
2359
+ enumerable: !0,
2360
+ configurable: !0,
2361
+ writable: !0
2362
+ }) : e[t] = n, e;
2363
+ }
2364
+ class yi {
2365
+ init(t) {
2366
+ const n = this.getTarget(t), [, i] = ce(null, n), r = this.getEventInit();
2367
+ return ue(t, n), t.dispatchUIEvent(n, "pointerover", r), i.forEach((o) => t.dispatchUIEvent(o, "pointerenter", r)), this;
2368
+ }
2369
+ move(t, n) {
2370
+ const i = this.position, r = this.getTarget(t);
2371
+ if (this.position = n, !Lt(i, n))
2372
+ return;
2373
+ const o = this.getTarget(t), s = this.getEventInit(-1), [u, c] = ce(r, o);
2374
+ return {
2375
+ leave: () => {
2376
+ Ce(t, r) && r !== o && (t.dispatchUIEvent(r, "pointerout", s), u.forEach((d) => t.dispatchUIEvent(d, "pointerleave", s)));
2377
+ },
2378
+ enter: () => {
2379
+ ue(t, o), r !== o && (t.dispatchUIEvent(o, "pointerover", s), c.forEach((d) => t.dispatchUIEvent(d, "pointerenter", s)));
2380
+ },
2381
+ move: () => {
2382
+ t.dispatchUIEvent(o, "pointermove", s);
2383
+ }
2384
+ };
2385
+ }
2386
+ down(t, n = 0) {
2387
+ if (this.isDown)
2388
+ return;
2389
+ const i = this.getTarget(t);
2390
+ ue(t, i), this.isDown = !0, this.isPrevented = !t.dispatchUIEvent(i, "pointerdown", this.getEventInit(n));
2391
+ }
2392
+ up(t, n = 0) {
2393
+ if (!this.isDown)
2394
+ return;
2395
+ const i = this.getTarget(t);
2396
+ ue(t, i), this.isPrevented = !1, this.isDown = !1, t.dispatchUIEvent(i, "pointerup", this.getEventInit(n));
2397
+ }
2398
+ release(t) {
2399
+ const n = this.getTarget(t), [i] = ce(n, null), r = this.getEventInit();
2400
+ Ce(t, n) && (t.dispatchUIEvent(n, "pointerout", r), i.forEach((o) => t.dispatchUIEvent(o, "pointerleave", r))), this.isCancelled = !0;
2401
+ }
2402
+ getTarget(t) {
2403
+ var n;
2404
+ return (n = this.position.target) !== null && n !== void 0 ? n : t.config.document.body;
2405
+ }
2406
+ getEventInit(t) {
2407
+ return {
2408
+ ...this.position.coords,
2409
+ pointerId: this.pointerId,
2410
+ pointerType: this.pointerType,
2411
+ isPrimary: this.isPrimary,
2412
+ button: De(t),
2413
+ buttons: this.buttons.getButtons()
2414
+ };
2415
+ }
2416
+ constructor({ pointerId: t, pointerType: n, isPrimary: i }, r) {
2417
+ C(this, "pointerId", void 0), C(this, "pointerType", void 0), C(this, "isPrimary", void 0), C(this, "buttons", void 0), C(this, "isMultitouch", !1), C(this, "isCancelled", !1), C(this, "isDown", !1), C(this, "isPrevented", !1), C(this, "position", {}), this.pointerId = t, this.pointerType = n, this.isPrimary = i, this.isMultitouch = !i, this.buttons = r;
2418
+ }
2419
+ }
2420
+ function P(e, t, n) {
2421
+ return t in e ? Object.defineProperty(e, t, {
2422
+ value: n,
2423
+ enumerable: !0,
2424
+ configurable: !0,
2425
+ writable: !0
2426
+ }) : e[t] = n, e;
2427
+ }
2428
+ class mi {
2429
+ isKeyPressed(t) {
2430
+ return this.devices.get(t.pointerType).isPressed(t);
2431
+ }
2432
+ async press(t, n, i) {
2433
+ this.devices.get(n.pointerType).addPressed(n), this.buttons.down(n);
2434
+ const r = this.getPointerName(n), o = n.pointerType === "touch" ? this.pointers.new(r, n.pointerType, this.buttons) : this.pointers.get(r);
2435
+ o.position = i, o.pointerType !== "touch" && (this.mouse.position = i), o.pointerType === "touch" && o.init(t), o.down(t, n.button), o.pointerType !== "touch" && this.mouse.down(t, n, o.isPrevented);
2436
+ }
2437
+ async move(t, n, i) {
2438
+ const r = this.pointers.get(n), o = r.move(t, i), s = r.pointerType === "touch" ? void 0 : this.mouse.move(t, i, r.isPrevented);
2439
+ o == null || o.leave(), s == null || s.leave(), o == null || o.enter(), s == null || s.enter(), o == null || o.move(), s == null || s.move();
2440
+ }
2441
+ async release(t, n, i) {
2442
+ const r = this.devices.get(n.pointerType);
2443
+ r.removePressed(n), this.buttons.up(n);
2444
+ const o = this.pointers.get(this.getPointerName(n)), s = o.isPrevented;
2445
+ if (o.position = i, o.pointerType !== "touch" && (this.mouse.position = i), r.countPressed === 0 && o.up(t, n.button), o.pointerType === "touch" && o.release(t), o.pointerType === "touch" && !o.isMultitouch) {
2446
+ const u = this.mouse.move(t, i, s);
2447
+ u == null || u.leave(), u == null || u.enter(), u == null || u.move(), this.mouse.down(t, n, s);
2448
+ }
2449
+ if (!o.isMultitouch) {
2450
+ const u = this.mouse.move(t, i, s);
2451
+ u == null || u.leave(), u == null || u.enter(), u == null || u.move(), this.mouse.up(t, n, s);
2452
+ }
2453
+ }
2454
+ getPointerName(t) {
2455
+ return t.pointerType === "touch" ? t.name : t.pointerType;
2456
+ }
2457
+ getPreviousPosition(t) {
2458
+ return this.pointers.has(t) ? this.pointers.get(t).position : void 0;
2459
+ }
2460
+ resetClickCount() {
2461
+ this.mouse.resetClickCount();
2462
+ }
2463
+ getMouseTarget(t) {
2464
+ var n;
2465
+ return (n = this.mouse.position.target) !== null && n !== void 0 ? n : t.config.document.body;
2466
+ }
2467
+ setMousePosition(t) {
2468
+ this.mouse.position = t, this.pointers.get("mouse").position = t;
2469
+ }
2470
+ constructor(t) {
2471
+ P(this, "system", void 0), P(this, "mouse", void 0), P(this, "buttons", void 0), P(this, "devices", new class {
2472
+ get(n) {
2473
+ var i, r, o;
2474
+ return (o = (i = this.registry)[r = n]) !== null && o !== void 0 ? o : i[r] = new li();
2475
+ }
2476
+ constructor() {
2477
+ P(this, "registry", {});
2478
+ }
2479
+ }()), P(this, "pointers", new class {
2480
+ new(n, i, r) {
2481
+ const o = i !== "touch" || !Object.values(this.registry).some((s) => s.pointerType === "touch" && !s.isCancelled);
2482
+ return o || Object.values(this.registry).forEach((s) => {
2483
+ s.pointerType === i && !s.isCancelled && (s.isMultitouch = !0);
2484
+ }), this.registry[n] = new yi({
2485
+ pointerId: this.nextId++,
2486
+ pointerType: i,
2487
+ isPrimary: o
2488
+ }, r), this.registry[n];
2489
+ }
2490
+ get(n) {
2491
+ if (!this.has(n))
2492
+ throw new Error(`Trying to access pointer "${n}" which does not exist.`);
2493
+ return this.registry[n];
2494
+ }
2495
+ has(n) {
2496
+ return n in this.registry;
2497
+ }
2498
+ constructor() {
2499
+ P(this, "registry", {}), P(this, "nextId", 1);
2500
+ }
2501
+ }()), this.system = t, this.buttons = new Nt(), this.mouse = new hi(), this.pointers.new("mouse", "mouse", this.buttons);
2502
+ }
2503
+ }
2504
+ function ot(e, t, n) {
2505
+ return t in e ? Object.defineProperty(e, t, {
2506
+ value: n,
2507
+ enumerable: !0,
2508
+ configurable: !0,
2509
+ writable: !0
2510
+ }) : e[t] = n, e;
2511
+ }
2512
+ class Ft {
2513
+ getUIEventModifiers() {
2514
+ return {
2515
+ altKey: this.keyboard.modifiers.Alt,
2516
+ ctrlKey: this.keyboard.modifiers.Control,
2517
+ metaKey: this.keyboard.modifiers.Meta,
2518
+ shiftKey: this.keyboard.modifiers.Shift,
2519
+ modifierAltGraph: this.keyboard.modifiers.AltGraph,
2520
+ modifierCapsLock: this.keyboard.modifiers.CapsLock,
2521
+ modifierFn: this.keyboard.modifiers.Fn,
2522
+ modifierFnLock: this.keyboard.modifiers.FnLock,
2523
+ modifierNumLock: this.keyboard.modifiers.NumLock,
2524
+ modifierScrollLock: this.keyboard.modifiers.ScrollLock,
2525
+ modifierSymbol: this.keyboard.modifiers.Symbol,
2526
+ modifierSymbolLock: this.keyboard.modifiers.SymbolLock
2527
+ };
2528
+ }
2529
+ constructor() {
2530
+ ot(this, "keyboard", new oi(this)), ot(this, "pointer", new mi(this));
2531
+ }
2532
+ }
2533
+ async function Ei(e) {
2534
+ const t = [];
2535
+ return this.config.skipHover || t.push({
2536
+ target: e
2537
+ }), t.push({
2538
+ keys: "[MouseLeft]",
2539
+ target: e
2540
+ }), this.pointer(t);
2541
+ }
2542
+ async function wi(e) {
2543
+ return this.pointer([
2544
+ {
2545
+ target: e
2546
+ },
2547
+ "[MouseLeft][MouseLeft]"
2548
+ ]);
2549
+ }
2550
+ async function ki(e) {
2551
+ return this.pointer([
2552
+ {
2553
+ target: e
2554
+ },
2555
+ "[MouseLeft][MouseLeft][MouseLeft]"
2556
+ ]);
2557
+ }
2558
+ async function Ti(e) {
2559
+ return this.pointer({
2560
+ target: e
2561
+ });
2562
+ }
2563
+ async function Ci(e) {
2564
+ return ue(this, this.system.pointer.getMouseTarget(this)), this.pointer({
2565
+ target: e.ownerDocument.body
2566
+ });
2567
+ }
2568
+ async function Ii({ shift: e } = {}) {
2569
+ return this.keyboard(e === !0 ? "{Shift>}{Tab}{/Shift}" : e === !1 ? "[/ShiftLeft][/ShiftRight]{Tab}" : "{Tab}");
2570
+ }
2571
+ var Ve = /* @__PURE__ */ (function(e) {
2572
+ return e["{"] = "}", e["["] = "]", e;
2573
+ })(Ve || {});
2574
+ function Bt(e, t) {
2575
+ let n = 0;
2576
+ const i = e[n] in Ve ? e[n] : "";
2577
+ n += i.length;
2578
+ const o = new RegExp(`^\\${i}{2}`).test(e) ? "" : i;
2579
+ return {
2580
+ type: o,
2581
+ ...o === "" ? _i(e, n, t) : Si(e, n, o, t)
2582
+ };
2583
+ }
2584
+ function _i(e, t, n) {
2585
+ const i = e[t];
2586
+ return Vt(i, e, t, n), t += i.length, {
2587
+ consumedLength: t,
2588
+ descriptor: i,
2589
+ releasePrevious: !1,
2590
+ releaseSelf: !0,
2591
+ repeat: 1
2592
+ };
2593
+ }
2594
+ function Si(e, t, n, i) {
2595
+ var r, o;
2596
+ const s = e[t] === "/" ? "/" : "";
2597
+ t += s.length;
2598
+ const u = n === "{" && e[t] === "\\";
2599
+ t += Number(u);
2600
+ const c = u ? e[t] : (r = e.slice(t).match(n === "{" ? /^\w+|^[^}>/]/ : /^\w+/)) === null || r === void 0 ? void 0 : r[0];
2601
+ Vt(c, e, t, i), t += c.length;
2602
+ var d;
2603
+ const l = (d = (o = e.slice(t).match(/^>\d+/)) === null || o === void 0 ? void 0 : o[0]) !== null && d !== void 0 ? d : "";
2604
+ t += l.length;
2605
+ const f = e[t] === "/" || !l && e[t] === ">" ? e[t] : "";
2606
+ t += f.length;
2607
+ const p = Ve[n], h = e[t] === p ? p : "";
2608
+ if (!h)
2609
+ throw new Error(Kt([
2610
+ !l && "repeat modifier",
2611
+ !f && "release modifier",
2612
+ `"${p}"`
2613
+ ].filter(Boolean).join(" or "), e[t], e, i));
2614
+ return t += h.length, {
2615
+ consumedLength: t,
2616
+ descriptor: c,
2617
+ releasePrevious: !!s,
2618
+ repeat: l ? Math.max(Number(l.substr(1)), 1) : 1,
2619
+ releaseSelf: Pi(f, l)
2620
+ };
2621
+ }
2622
+ function Vt(e, t, n, i) {
2623
+ if (!e)
2624
+ throw new Error(Kt("key descriptor", t[n], t, i));
2625
+ }
2626
+ function Pi(e, t) {
2627
+ if (e)
2628
+ return e === "/";
2629
+ if (t)
2630
+ return !1;
2631
+ }
2632
+ function Kt(e, t, n, i) {
2633
+ return `Expected ${e} but found "${t ?? ""}" in "${n}"
2634
+ See ${i === "pointer" ? "https://testing-library.com/docs/user-event/pointer#pressing-a-button-or-touching-the-screen" : "https://testing-library.com/docs/user-event/keyboard"}
2635
+ for more information about how userEvent parses your input.`;
2636
+ }
2637
+ function Ai(e, t) {
2638
+ const n = [];
2639
+ do {
2640
+ const { type: r, descriptor: o, consumedLength: s, releasePrevious: u, releaseSelf: c = !0, repeat: d } = Bt(t, "keyboard");
2641
+ var i;
2642
+ const l = (i = e.find((f) => {
2643
+ if (r === "[") {
2644
+ var p;
2645
+ return ((p = f.code) === null || p === void 0 ? void 0 : p.toLowerCase()) === o.toLowerCase();
2646
+ } else if (r === "{") {
2647
+ var h;
2648
+ return ((h = f.key) === null || h === void 0 ? void 0 : h.toLowerCase()) === o.toLowerCase();
2649
+ }
2650
+ return f.key === o;
2651
+ })) !== null && i !== void 0 ? i : {
2652
+ key: "Unknown",
2653
+ code: "Unknown",
2654
+ [r === "[" ? "code" : "key"]: o
2655
+ };
2656
+ n.push({
2657
+ keyDef: l,
2658
+ releasePrevious: u,
2659
+ releaseSelf: c,
2660
+ repeat: d
2661
+ }), t = t.slice(s);
2662
+ } while (t);
2663
+ return n;
2664
+ }
2665
+ async function Oi(e) {
2666
+ const t = Ai(this.config.keyboardMap, e);
2667
+ for (let n = 0; n < t.length; n++)
2668
+ await Q(this.config), await Ui(this, t[n]);
2669
+ }
2670
+ async function Ui(e, { keyDef: t, releasePrevious: n, releaseSelf: i, repeat: r }) {
2671
+ const { system: o } = e;
2672
+ if (o.keyboard.isKeyPressed(t) && await o.keyboard.keyup(e, t), !n) {
2673
+ for (let s = 1; s <= r; s++)
2674
+ await o.keyboard.keydown(e, t), s < r && await Q(e.config);
2675
+ i && await o.keyboard.keyup(e, t);
2676
+ }
2677
+ }
2678
+ async function Di(e) {
2679
+ for (const t of e.system.keyboard.getPressedKeys())
2680
+ await e.system.keyboard.keyup(e, t);
2681
+ }
2682
+ function Rt(e) {
2683
+ const t = k(e) ? {
2684
+ "text/plain": xi(e)
2685
+ } : {
2686
+ "text/plain": String(e.ownerDocument.getSelection())
2687
+ }, n = Me(E(e));
2688
+ for (const i in t)
2689
+ t[i] && n.setData(i, t[i]);
2690
+ return n;
2691
+ }
2692
+ function xi(e) {
2693
+ const t = le(e);
2694
+ return T(e).substring(t.startOffset, t.endOffset);
2695
+ }
2696
+ async function Ni() {
2697
+ const e = this.config.document;
2698
+ var t;
2699
+ const n = (t = e.activeElement) !== null && t !== void 0 ? t : (
2700
+ /* istanbul ignore next */
2701
+ e.body
2702
+ ), i = Rt(n);
2703
+ if (i.items.length !== 0)
2704
+ return this.dispatchUIEvent(n, "copy", {
2705
+ clipboardData: i
2706
+ }) && this.config.writeToClipboard && await ht(e, i), i;
2707
+ }
2708
+ async function Mi() {
2709
+ const e = this.config.document;
2710
+ var t;
2711
+ const n = (t = e.activeElement) !== null && t !== void 0 ? t : (
2712
+ /* istanbul ignore next */
2713
+ e.body
2714
+ ), i = Rt(n);
2715
+ if (i.items.length !== 0)
2716
+ return this.dispatchUIEvent(n, "cut", {
2717
+ clipboardData: i
2718
+ }) && this.config.writeToClipboard && await ht(n.ownerDocument, i), i;
2719
+ }
2720
+ async function Li(e) {
2721
+ const t = this.config.document;
2722
+ var n;
2723
+ const i = (n = t.activeElement) !== null && n !== void 0 ? n : (
2724
+ /* istanbul ignore next */
2725
+ t.body
2726
+ );
2727
+ var r;
2728
+ const o = (r = typeof e == "string" ? $i(t, e) : e) !== null && r !== void 0 ? r : await rn(t).catch(() => {
2729
+ throw new Error("`userEvent.paste()` without `clipboardData` requires the `ClipboardAPI` to be available.");
2730
+ });
2731
+ this.dispatchUIEvent(i, "paste", {
2732
+ clipboardData: o
2733
+ });
2734
+ }
2735
+ function $i(e, t) {
2736
+ const n = Me(E(e));
2737
+ return n.setData("text", t), n;
2738
+ }
2739
+ function st(e, t) {
2740
+ const n = [];
2741
+ do {
2742
+ const { descriptor: i, consumedLength: r, releasePrevious: o, releaseSelf: s = !0 } = Bt(t, "pointer"), u = e.find((c) => c.name === i);
2743
+ u && n.push({
2744
+ keyDef: u,
2745
+ releasePrevious: o,
2746
+ releaseSelf: s
2747
+ }), t = t.slice(r);
2748
+ } while (t);
2749
+ return n;
2750
+ }
2751
+ async function Fi(e) {
2752
+ const { pointerMap: t } = this.config, n = [];
2753
+ (Array.isArray(e) ? e : [
2754
+ e
2755
+ ]).forEach((i) => {
2756
+ typeof i == "string" ? n.push(...st(t, i)) : "keys" in i ? n.push(...st(t, i.keys).map((r) => ({
2757
+ ...i,
2758
+ ...r
2759
+ }))) : n.push(i);
2760
+ });
2761
+ for (let i = 0; i < n.length; i++)
2762
+ await Q(this.config), await Bi(this, n[i]);
2763
+ this.system.pointer.resetClickCount();
2764
+ }
2765
+ async function Bi(e, t) {
2766
+ var n, i;
2767
+ const r = "pointerName" in t && t.pointerName ? t.pointerName : "keyDef" in t ? e.system.pointer.getPointerName(t.keyDef) : "mouse", o = e.system.pointer.getPreviousPosition(r);
2768
+ var s, u, c, d;
2769
+ const l = {
2770
+ target: (s = t.target) !== null && s !== void 0 ? s : Vi(e, o),
2771
+ coords: (u = t.coords) !== null && u !== void 0 ? u : o == null ? void 0 : o.coords,
2772
+ caret: {
2773
+ node: (c = t.node) !== null && c !== void 0 ? c : ut(t) || o == null || (n = o.caret) === null || n === void 0 ? void 0 : n.node,
2774
+ offset: (d = t.offset) !== null && d !== void 0 ? d : ut(t) || o == null || (i = o.caret) === null || i === void 0 ? void 0 : i.offset
2775
+ }
2776
+ };
2777
+ "keyDef" in t ? (e.system.pointer.isKeyPressed(t.keyDef) && (se(e, m.Trigger), await e.system.pointer.release(e, t.keyDef, l)), t.releasePrevious || (se(e, m.Trigger), await e.system.pointer.press(e, t.keyDef, l), t.releaseSelf && (se(e, m.Trigger), await e.system.pointer.release(e, t.keyDef, l)))) : (se(e, m.Trigger), await e.system.pointer.move(e, r, l));
2778
+ }
2779
+ function ut(e) {
2780
+ var t, n;
2781
+ return !!((n = (t = e.target) !== null && t !== void 0 ? t : e.node) !== null && n !== void 0 ? n : e.offset !== void 0);
2782
+ }
2783
+ function Vi(e, t) {
2784
+ if (!t)
2785
+ throw new Error("This pointer has no previous position. Provide a target property!");
2786
+ var n;
2787
+ return (n = t.target) !== null && n !== void 0 ? n : e.config.document.body;
2788
+ }
2789
+ async function Ki(e) {
2790
+ if (!z(e) || _(e))
2791
+ throw new Error("clear()` is only supported on editable elements.");
2792
+ if (O(e), e.ownerDocument.activeElement !== e)
2793
+ throw new Error("The element to be cleared could not be focused.");
2794
+ if (St(e), !Ln(e))
2795
+ throw new Error("The element content to be cleared could not be selected.");
2796
+ J(this, e, "", "deleteContentBackward");
2797
+ }
2798
+ async function Ri(e, t) {
2799
+ return jt.call(this, !0, e, t);
2800
+ }
2801
+ async function ji(e, t) {
2802
+ return jt.call(this, !1, e, t);
2803
+ }
2804
+ async function jt(e, t, n) {
2805
+ if (!e && !t.multiple)
2806
+ throw H().getElementError("Unable to deselect an option in a non-multiple select. Use selectOptions to change the selection instead.", t);
2807
+ const i = Array.isArray(n) ? n : [
2808
+ n
2809
+ ], r = Array.from(t.querySelectorAll('option, [role="option"]')), o = i.map((u) => {
2810
+ if (typeof u != "string" && r.includes(u))
2811
+ return u;
2812
+ {
2813
+ const c = r.find((d) => d.value === u || d.innerHTML === u);
2814
+ if (c)
2815
+ return c;
2816
+ throw H().getElementError(`Value "${String(u)}" not found in options`, t);
2817
+ }
2818
+ }).filter((u) => !_(u));
2819
+ if (_(t) || !o.length) return;
2820
+ const s = (u) => {
2821
+ u.selected = e, this.dispatchUIEvent(t, "input", {
2822
+ bubbles: !0,
2823
+ cancelable: !1,
2824
+ composed: !0
2825
+ }), this.dispatchUIEvent(t, "change");
2826
+ };
2827
+ if (a(t, "select"))
2828
+ if (t.multiple)
2829
+ for (const u of o) {
2830
+ const c = this.config.pointerEventsCheck === 0 ? !0 : Ce(this, u);
2831
+ c && (this.dispatchUIEvent(u, "pointerover"), this.dispatchUIEvent(t, "pointerenter"), this.dispatchUIEvent(u, "mouseover"), this.dispatchUIEvent(t, "mouseenter"), this.dispatchUIEvent(u, "pointermove"), this.dispatchUIEvent(u, "mousemove"), this.dispatchUIEvent(u, "pointerdown"), this.dispatchUIEvent(u, "mousedown")), O(t), c && (this.dispatchUIEvent(u, "pointerup"), this.dispatchUIEvent(u, "mouseup")), s(u), c && this.dispatchUIEvent(u, "click"), await Q(this.config);
2832
+ }
2833
+ else if (o.length === 1) {
2834
+ const u = this.config.pointerEventsCheck === 0 ? !0 : Ce(this, t);
2835
+ u ? await this.click(t) : O(t), s(o[0]), u && (this.dispatchUIEvent(t, "pointerover"), this.dispatchUIEvent(t, "pointerenter"), this.dispatchUIEvent(t, "mouseover"), this.dispatchUIEvent(t, "mouseenter"), this.dispatchUIEvent(t, "pointerup"), this.dispatchUIEvent(t, "mouseup"), this.dispatchUIEvent(t, "click")), await Q(this.config);
2836
+ } else
2837
+ throw H().getElementError("Cannot select multiple options on a non-multiple select", t);
2838
+ else if (t.getAttribute("role") === "listbox")
2839
+ for (const u of o)
2840
+ await this.click(u), await this.unhover(u);
2841
+ else
2842
+ throw H().getElementError("Cannot select options on elements that are neither select nor listbox elements", t);
2843
+ }
2844
+ async function Hi(e, t, { skipClick: n = this.config.skipClick, skipAutoClose: i = this.config.skipAutoClose, initialSelectionStart: r, initialSelectionEnd: o } = {}) {
2845
+ e.disabled || (n || await this.click(e), r !== void 0 && oe(e, r, o ?? r), await this.keyboard(t), i || await Di(this));
2846
+ }
2847
+ const ct = Symbol("files and value properties are mocked");
2848
+ function Oe(e, t, n) {
2849
+ n ? Object.defineProperty(e, t, n) : delete e[t];
2850
+ }
2851
+ function Gi(e, t) {
2852
+ var n;
2853
+ (n = e[ct]) === null || n === void 0 || n.restore();
2854
+ const i = Object.getOwnPropertyDescriptor(e, "type"), r = Object.getOwnPropertyDescriptor(e, "value"), o = Object.getOwnPropertyDescriptor(e, "files");
2855
+ function s() {
2856
+ Oe(e, "type", i), Oe(e, "value", r), Oe(e, "files", o);
2857
+ }
2858
+ e[ct] = {
2859
+ restore: s
2860
+ }, Object.defineProperties(e, {
2861
+ files: {
2862
+ configurable: !0,
2863
+ get: () => t
2864
+ },
2865
+ value: {
2866
+ configurable: !0,
2867
+ get: () => t.length ? `C:\\fakepath\\${t[0].name}` : "",
2868
+ set(u) {
2869
+ if (u === "")
2870
+ s();
2871
+ else {
2872
+ var c;
2873
+ r == null || (c = r.set) === null || c === void 0 || c.call(e, u);
2874
+ }
2875
+ }
2876
+ },
2877
+ type: {
2878
+ configurable: !0,
2879
+ get: () => "file",
2880
+ set(u) {
2881
+ u !== "file" && (s(), e.type = u);
2882
+ }
2883
+ }
2884
+ });
2885
+ }
2886
+ async function Xi(e, t) {
2887
+ const n = a(e, "label") ? e.control : e;
2888
+ if (!n || !a(n, "input", {
2889
+ type: "file"
2890
+ }))
2891
+ throw new TypeError(`The ${n === e ? "given" : "associated"} ${n == null ? void 0 : n.tagName} element does not accept file uploads`);
2892
+ if (_(e)) return;
2893
+ const i = (Array.isArray(t) ? t : [
2894
+ t
2895
+ ]).filter((o) => !this.config.applyAccept || Wi(o, n.accept)).slice(0, n.multiple ? void 0 : 1), r = () => {
2896
+ var o;
2897
+ i.length === ((o = n.files) === null || o === void 0 ? void 0 : o.length) && i.every((s, u) => {
2898
+ var c;
2899
+ return s === ((c = n.files) === null || c === void 0 ? void 0 : c.item(u));
2900
+ }) || (Gi(n, Ne(E(e), i)), this.dispatchUIEvent(n, "input"), this.dispatchUIEvent(n, "change"));
2901
+ };
2902
+ n.addEventListener("fileDialog", r), await this.click(e), n.removeEventListener("fileDialog", r);
2903
+ }
2904
+ function ve(e) {
2905
+ return e.toLowerCase().replace(/(\.|\/)jpg\b/g, "$1jpeg");
2906
+ }
2907
+ function Wi(e, t) {
2908
+ if (!t)
2909
+ return !0;
2910
+ const n = [
2911
+ "audio/*",
2912
+ "image/*",
2913
+ "video/*"
2914
+ ];
2915
+ return ve(t).trim().split(/\s*,\s*/).some((i) => i.startsWith(".") ? ve(e.name).endsWith(i) : n.includes(i) ? ve(e.type).startsWith(i.replace("*", "")) : ve(e.type) === i);
2916
+ }
2917
+ const dt = {
2918
+ click: Ei,
2919
+ dblClick: wi,
2920
+ tripleClick: ki,
2921
+ hover: Ti,
2922
+ unhover: Ci,
2923
+ tab: Ii,
2924
+ keyboard: Oi,
2925
+ copy: Ni,
2926
+ cut: Mi,
2927
+ paste: Li,
2928
+ pointer: Fi,
2929
+ clear: Ki,
2930
+ deselectOptions: ji,
2931
+ selectOptions: Ri,
2932
+ type: Hi,
2933
+ upload: Xi
2934
+ };
2935
+ function zi(e) {
2936
+ return H().asyncWrapper(e);
2937
+ }
2938
+ const Ht = {
2939
+ applyAccept: !0,
2940
+ autoModify: !0,
2941
+ delay: 0,
2942
+ document: globalThis.document,
2943
+ keyboardMap: si,
2944
+ pointerMap: ui,
2945
+ pointerEventsCheck: Ee.EachApiCall,
2946
+ skipAutoClose: !1,
2947
+ skipClick: !1,
2948
+ skipHover: !1,
2949
+ writeToClipboard: !1,
2950
+ advanceTimers: () => Promise.resolve()
2951
+ }, Yi = {
2952
+ ...Ht,
2953
+ writeToClipboard: !0
2954
+ };
2955
+ function Gt(e = {}, t = Yi, n) {
2956
+ const i = Zi(e, n, t);
2957
+ return {
2958
+ ...t,
2959
+ ...e,
2960
+ document: i
2961
+ };
2962
+ }
2963
+ function qi(e = {}) {
2964
+ const t = Gt(e);
2965
+ xt(t.document), Dt(E(t.document).HTMLElement);
2966
+ var n;
2967
+ const i = (n = t.document.defaultView) !== null && n !== void 0 ? n : (
2968
+ /* istanbul ignore next */
2969
+ globalThis.window
2970
+ );
2971
+ return en(i), Ke(t).api;
2972
+ }
2973
+ function v({ keyboardState: e, pointerState: t, ...n } = {}, i) {
2974
+ const r = Gt(n, Ht, i);
2975
+ xt(r.document), Dt(E(r.document).HTMLElement);
2976
+ var o;
2977
+ const s = (o = t ?? e) !== null && o !== void 0 ? o : new Ft();
2978
+ return {
2979
+ api: Ke(r, s).api,
2980
+ system: s
2981
+ };
2982
+ }
2983
+ function Ji(e) {
2984
+ return Ke({
2985
+ ...this.config,
2986
+ ...e
2987
+ }, this.system).api;
2988
+ }
2989
+ function Qi(e, t) {
2990
+ function n(...i) {
2991
+ return se(e, m.Call), zi(() => t.apply(e, i).then(async (r) => (await Q(e.config), r)));
2992
+ }
2993
+ return Object.defineProperty(n, "name", {
2994
+ get: () => t.name
2995
+ }), n;
2996
+ }
2997
+ function Ke(e, t = new Ft()) {
2998
+ const n = {};
2999
+ return Object.assign(n, {
3000
+ config: e,
3001
+ dispatchEvent: Ut.bind(n),
3002
+ dispatchUIEvent: qn.bind(n),
3003
+ system: t,
3004
+ levelRefs: {},
3005
+ ...dt
3006
+ }), {
3007
+ instance: n,
3008
+ api: {
3009
+ ...Object.fromEntries(Object.entries(dt).map(([i, r]) => [
3010
+ i,
3011
+ Qi(n, r)
3012
+ ])),
3013
+ setup: Ji.bind(n)
3014
+ }
3015
+ };
3016
+ }
3017
+ function Zi(e, t, n) {
3018
+ var i, r;
3019
+ return (r = (i = e.document) !== null && i !== void 0 ? i : t && ti(t)) !== null && r !== void 0 ? r : n.document;
3020
+ }
3021
+ function er(e) {
3022
+ return v().api.clear(e);
3023
+ }
3024
+ function tr(e, t = {}) {
3025
+ return v(t, e).api.click(e);
3026
+ }
3027
+ function nr(e = {}) {
3028
+ return v(e).api.copy();
3029
+ }
3030
+ function ir(e = {}) {
3031
+ return v(e).api.cut();
3032
+ }
3033
+ function rr(e, t = {}) {
3034
+ return v(t).api.dblClick(e);
3035
+ }
3036
+ function or(e, t, n = {}) {
3037
+ return v(n).api.deselectOptions(e, t);
3038
+ }
3039
+ function sr(e, t = {}) {
3040
+ return v(t).api.hover(e);
3041
+ }
3042
+ async function ur(e, t = {}) {
3043
+ const { api: n, system: i } = v(t);
3044
+ return n.keyboard(e).then(() => i);
3045
+ }
3046
+ async function cr(e, t = {}) {
3047
+ const { api: n, system: i } = v(t);
3048
+ return n.pointer(e).then(() => i);
3049
+ }
3050
+ function dr(e, t) {
3051
+ return v(t).api.paste(e);
3052
+ }
3053
+ function lr(e, t, n = {}) {
3054
+ return v(n).api.selectOptions(e, t);
3055
+ }
3056
+ function ar(e, t = {}) {
3057
+ return v(t).api.tripleClick(e);
3058
+ }
3059
+ function fr(e, t, n = {}) {
3060
+ return v(n, e).api.type(e, t, n);
3061
+ }
3062
+ function pr(e, t = {}) {
3063
+ const { api: n, system: i } = v(t);
3064
+ return i.pointer.setMousePosition({
3065
+ target: e
3066
+ }), n.unhover(e);
3067
+ }
3068
+ function hr(e, t, n = {}) {
3069
+ return v(n).api.upload(e, t);
3070
+ }
3071
+ function br(e = {}) {
3072
+ return v().api.tab(e);
3073
+ }
3074
+ const gr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3075
+ __proto__: null,
3076
+ clear: er,
3077
+ click: tr,
3078
+ copy: nr,
3079
+ cut: ir,
3080
+ dblClick: rr,
3081
+ deselectOptions: or,
3082
+ hover: sr,
3083
+ keyboard: ur,
3084
+ paste: dr,
3085
+ pointer: cr,
3086
+ selectOptions: lr,
3087
+ tab: br,
3088
+ tripleClick: ar,
3089
+ type: fr,
3090
+ unhover: pr,
3091
+ upload: hr
3092
+ }, Symbol.toStringTag, { value: "Module" })), Lr = {
3093
+ ...gr,
3094
+ setup: qi
3095
+ };
3096
+ export {
3097
+ Lr as u
3098
+ };