@clubmed/usg-chat-ui 1.0.1 → 1.2.4

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