Best JavaScript code snippet using playwright-internal
injectedScriptSource.js
Source: injectedScriptSource.js
1var pwExport
2;(() => {
3 'use strict'
4 var e = {
5 204: (e, t) => {
6 Object.defineProperty(t, '__esModule', { value: !0 }),
7 (t.checkComponentAttribute = function (e, t) {
8 for (const n of t.jsonPath) null != e && (e = e[n])
9 const n =
10 'string' != typeof e || t.caseSensetive ? e : e.toUpperCase(),
11 r =
12 'string' != typeof t.value || t.caseSensetive
13 ? t.value
14 : t.value.toUpperCase()
15 return '<truthy>' === t.op
16 ? !!n
17 : '=' === t.op
18 ? n === r
19 : 'string' == typeof n &&
20 'string' == typeof r &&
21 ('*=' === t.op
22 ? n.includes(r)
23 : '^=' === t.op
24 ? n.startsWith(r)
25 : '$=' === t.op
26 ? n.endsWith(r)
27 : '|=' === t.op
28 ? n === r || n.startsWith(r + '-')
29 : '~=' === t.op && n.split(' ').includes(r))
30 }),
31 (t.parseComponentSelector = function (e) {
32 let t = 0,
33 n = 0 === e.length
34 const r = () => e[t] || '',
35 o = () => {
36 const o = r()
37 return ++t, (n = t >= e.length), o
38 },
39 i = (o) => {
40 if (n)
41 throw new Error(
42 `Unexpected end of selector while parsing selector \`${e}\``
43 )
44 throw new Error(
45 `Error while parsing selector \`${e}\` - unexpected symbol "${r()}" at position ${t}` +
46 (o ? ' during ' + o : '')
47 )
48 }
49 function s() {
50 for (; !n && /\s/.test(r()); ) o()
51 }
52 function c() {
53 let e = ''
54 for (s(); !n && /[-$0-9A-Z_]/i.test(r()); ) e += o()
55 return e
56 }
57 function a(e) {
58 let t = o()
59 for (t !== e && i('parsing quoted string'); !n && r() !== e; )
60 '\\' === r() && o(), (t += o())
61 return r() !== e && i('parsing quoted string'), (t += o()), t
62 }
63 function u() {
64 let e = ''
65 return (
66 s(),
67 (e = "'" === r() || '"' === r() ? a(r()).slice(1, -1) : c()),
68 e || i('parsing property path'),
69 e
70 )
71 }
72 function l() {
73 o()
74 const t = []
75 for (t.push(u()), s(); '.' === r(); ) o(), t.push(u()), s()
76 if (']' === r())
77 return (
78 o(),
79 {
80 jsonPath: t,
81 op: '<truthy>',
82 value: null,
83 caseSensetive: !1
84 }
85 )
86 const c = (function () {
87 s()
88 let e = ''
89 return (
90 n || (e += o()),
91 n || '=' === e || (e += o()),
92 ['=', '*=', '^=', '$=', '|=', '~='].includes(e) ||
93 i('parsing operator'),
94 e
95 )
96 })()
97 let l,
98 h = !0
99 if ((s(), "'" === r() || '"' === r()))
100 (l = a(r()).slice(1, -1)),
101 s(),
102 'i' === r() || 'I' === r()
103 ? ((h = !1), o())
104 : ('s' !== r() && 'S' !== r()) || ((h = !0), o())
105 else {
106 for (l = ''; !n && !/\s/.test(r()) && ']' !== r(); ) l += o()
107 'true' === l
108 ? (l = !0)
109 : 'false' === l
110 ? (l = !1)
111 : ((l = +l), isNaN(l) && i('parsing attribute value'))
112 }
113 if (
114 (s(),
115 ']' !== r() && i('parsing attribute value'),
116 o(),
117 '=' !== c && 'string' != typeof l)
118 )
119 throw new Error(
120 `Error while parsing selector \`${e}\` - cannot use ${c} in attribute with non-string matching value - ${l}`
121 )
122 return { jsonPath: t, op: c, value: l, caseSensetive: h }
123 }
124 const h = { name: '', attributes: [] }
125 for (h.name = c(), s(); '[' === r(); ) h.attributes.push(l()), s()
126 if ((n || i(void 0), !h.name && !h.attributes.length))
127 throw new Error(
128 `Error while parsing selector \`${e}\` - selector cannot be empty`
129 )
130 return h
131 })
132 },
133 317: (e, t, n) => {
134 Object.defineProperty(t, '__esModule', { value: !0 }),
135 (t.parseCSS = function (e, t) {
136 let n
137 try {
138 ;(n = r.tokenize(e)),
139 n[n.length - 1] instanceof r.EOFToken ||
140 n.push(new r.EOFToken())
141 } catch (t) {
142 const n = t.message + ` while parsing selector "${e}"`,
143 r = (t.stack || '').indexOf(t.message)
144 throw (
145 (-1 !== r &&
146 (t.stack =
147 t.stack.substring(0, r) +
148 n +
149 t.stack.substring(r + t.message.length)),
150 (t.message = n),
151 t)
152 )
153 }
154 const o = n.find(
155 (e) =>
156 e instanceof r.AtKeywordToken ||
157 e instanceof r.BadStringToken ||
158 e instanceof r.BadURLToken ||
159 e instanceof r.ColumnToken ||
160 e instanceof r.CDOToken ||
161 e instanceof r.CDCToken ||
162 e instanceof r.SemicolonToken ||
163 e instanceof r.OpenCurlyToken ||
164 e instanceof r.CloseCurlyToken ||
165 e instanceof r.URLToken ||
166 e instanceof r.PercentageToken
167 )
168 if (o)
169 throw new Error(
170 `Unsupported token "${o.toSource()}" while parsing selector "${e}"`
171 )
172 let i = 0
173 const s = new Set()
174 function c() {
175 return new Error(
176 `Unexpected token "${n[
177 i
178 ].toSource()}" while parsing selector "${e}"`
179 )
180 }
181 function a() {
182 for (; n[i] instanceof r.WhitespaceToken; ) i++
183 }
184 function u(e = i) {
185 return n[e] instanceof r.IdentToken
186 }
187 function l(e = i) {
188 return n[e] instanceof r.CommaToken
189 }
190 function h(e = i) {
191 return n[e] instanceof r.CloseParenToken
192 }
193 function p(e = i) {
194 return n[e] instanceof r.DelimToken && '*' === n[e].value
195 }
196 function f(e = i) {
197 return n[e] instanceof r.EOFToken
198 }
199 function d(e = i) {
200 return (
201 n[e] instanceof r.DelimToken &&
202 ['>', '+', '~'].includes(n[e].value)
203 )
204 }
205 function m(e = i) {
206 return (
207 l(e) ||
208 h(e) ||
209 f(e) ||
210 d(e) ||
211 n[e] instanceof r.WhitespaceToken
212 )
213 }
214 function g() {
215 const e = [y()]
216 for (; a(), l(); ) i++, e.push(y())
217 return e
218 }
219 function y() {
220 return (
221 a(),
222 (function (e = i) {
223 return n[e] instanceof r.NumberToken
224 })() ||
225 (function (e = i) {
226 return n[e] instanceof r.StringToken
227 })()
228 ? n[i++].value
229 : (function () {
230 const e = { simples: [] }
231 for (
232 a(),
233 d()
234 ? e.simples.push({
235 selector: {
236 functions: [{ name: 'scope', args: [] }]
237 },
238 combinator: ''
239 })
240 : e.simples.push({ selector: v(), combinator: '' });
241 ;
242
243 ) {
244 if ((a(), d()))
245 (e.simples[e.simples.length - 1].combinator =
246 n[i++].value),
247 a()
248 else if (m()) break
249 e.simples.push({ combinator: '', selector: v() })
250 }
251 return e
252 })()
253 )
254 }
255 function v() {
256 let e = ''
257 const o = []
258 for (; !m(); )
259 if (u() || p()) e += n[i++].toSource()
260 else if (n[i] instanceof r.HashToken) e += n[i++].toSource()
261 else if (n[i] instanceof r.DelimToken && '.' === n[i].value) {
262 if ((i++, !u())) throw c()
263 e += '.' + n[i++].toSource()
264 } else if (n[i] instanceof r.ColonToken)
265 if ((i++, u()))
266 if (t.has(n[i].value.toLowerCase())) {
267 const e = n[i++].value.toLowerCase()
268 o.push({ name: e, args: [] }), s.add(e)
269 } else e += ':' + n[i++].toSource()
270 else {
271 if (!(n[i] instanceof r.FunctionToken)) throw c()
272 {
273 const r = n[i++].value.toLowerCase()
274 if (
275 (t.has(r)
276 ? (o.push({ name: r, args: g() }), s.add(r))
277 : (e += `:${r}(${w()})`),
278 a(),
279 !h())
280 )
281 throw c()
282 i++
283 }
284 }
285 else {
286 if (!(n[i] instanceof r.OpenSquareToken)) throw c()
287 for (
288 e += '[', i++;
289 !(n[i] instanceof r.CloseSquareToken || f());
290
291 )
292 e += n[i++].toSource()
293 if (!(n[i] instanceof r.CloseSquareToken)) throw c()
294 ;(e += ']'), i++
295 }
296 if (!e && !o.length) throw c()
297 return { css: e || void 0, functions: o }
298 }
299 function w() {
300 let e = ''
301 for (; !h() && !f(); ) e += n[i++].toSource()
302 return e
303 }
304 const b = g()
305 if (!f()) throw new Error(`Error while parsing selector "${e}"`)
306 if (b.some((e) => 'object' != typeof e || !('simples' in e)))
307 throw new Error(`Error while parsing selector "${e}"`)
308 return { selector: b, names: Array.from(s) }
309 }),
310 (t.serializeSelector = function e(t) {
311 return t
312 .map((t) =>
313 'string' == typeof t
314 ? `"${t}"`
315 : 'number' == typeof t
316 ? String(t)
317 : t.simples
318 .map(({ selector: t, combinator: n }) => {
319 let r = t.css || ''
320 return (
321 (r += t.functions
322 .map((t) => `:${t.name}(${e(t.args)})`)
323 .join('')),
324 n && (r += ' ' + n),
325 r
326 )
327 })
328 .join(' ')
329 )
330 .join(', ')
331 })
332 var r = (function (e, t) {
333 if (e && e.__esModule) return e
334 if (null === e || ('object' != typeof e && 'function' != typeof e))
335 return { default: e }
336 var n = o(t)
337 if (n && n.has(e)) return n.get(e)
338 var r = {},
339 i = Object.defineProperty && Object.getOwnPropertyDescriptor
340 for (var s in e)
341 if ('default' !== s && Object.prototype.hasOwnProperty.call(e, s)) {
342 var c = i ? Object.getOwnPropertyDescriptor(e, s) : null
343 c && (c.get || c.set)
344 ? Object.defineProperty(r, s, c)
345 : (r[s] = e[s])
346 }
347 return (r.default = e), n && n.set(e, r), r
348 })(n(503))
349 function o(e) {
350 if ('function' != typeof WeakMap) return null
351 var t = new WeakMap(),
352 n = new WeakMap()
353 return (o = function (e) {
354 return e ? n : t
355 })(e)
356 }
357 },
358 503: (e, t) => {
359 var n, r
360 ;(n = function (e) {
361 var t = function (e, t, n) {
362 return e >= t && e <= n
363 }
364 function n(e) {
365 return t(e, 48, 57)
366 }
367 function r(e) {
368 return n(e) || t(e, 65, 70) || t(e, 97, 102)
369 }
370 function o(e) {
371 return (
372 (function (e) {
373 return t(e, 65, 90)
374 })(e) ||
375 (function (e) {
376 return t(e, 97, 122)
377 })(e)
378 )
379 }
380 function i(e) {
381 return (
382 o(e) ||
383 (function (e) {
384 return e >= 128
385 })(e) ||
386 95 == e
387 )
388 }
389 function s(e) {
390 return i(e) || n(e) || 45 == e
391 }
392 function c(e) {
393 return t(e, 0, 8) || 11 == e || t(e, 14, 31) || 127 == e
394 }
395 function a(e) {
396 return 10 == e
397 }
398 function u(e) {
399 return a(e) || 9 == e || 32 == e
400 }
401 var l = function (e) {
402 this.message = e
403 }
404 function h(e) {
405 if (e <= 65535) return String.fromCharCode(e)
406 e -= Math.pow(2, 16)
407 var t = Math.floor(e / Math.pow(2, 10)) + 55296,
408 n = (e % Math.pow(2, 10)) + 56320
409 return String.fromCharCode(t) + String.fromCharCode(n)
410 }
411 function p() {
412 throw 'Abstract Base Class'
413 }
414 function f() {
415 return this
416 }
417 function d() {
418 return this
419 }
420 function m() {
421 return this
422 }
423 function g() {
424 return this
425 }
426 function y() {
427 return this
428 }
429 function v() {
430 return this
431 }
432 function w() {
433 return this
434 }
435 function b() {
436 return this
437 }
438 function E() {
439 throw 'Abstract Base Class'
440 }
441 function _() {
442 return (this.value = '{'), (this.mirror = '}'), this
443 }
444 function S() {
445 return (this.value = '}'), (this.mirror = '{'), this
446 }
447 function T() {
448 return (this.value = '['), (this.mirror = ']'), this
449 }
450 function k() {
451 return (this.value = ']'), (this.mirror = '['), this
452 }
453 function N() {
454 return (this.value = '('), (this.mirror = ')'), this
455 }
456 function x() {
457 return (this.value = ')'), (this.mirror = '('), this
458 }
459 function C() {
460 return this
461 }
462 function A() {
463 return this
464 }
465 function O() {
466 return this
467 }
468 function M() {
469 return this
470 }
471 function $() {
472 return this
473 }
474 function R() {
475 return this
476 }
477 function j() {
478 return this
479 }
480 function L(e) {
481 return (this.value = h(e)), this
482 }
483 function P() {
484 throw 'Abstract Base Class'
485 }
486 function q(e) {
487 this.value = e
488 }
489 function D(e) {
490 ;(this.value = e), (this.mirror = ')')
491 }
492 function I(e) {
493 this.value = e
494 }
495 function U(e) {
496 ;(this.value = e), (this.type = 'unrestricted')
497 }
498 function W(e) {
499 this.value = e
500 }
501 function F(e) {
502 this.value = e
503 }
504 function B() {
505 ;(this.value = null), (this.type = 'integer'), (this.repr = '')
506 }
507 function z() {
508 ;(this.value = null), (this.repr = '')
509 }
510 function V() {
511 ;(this.value = null),
512 (this.type = 'integer'),
513 (this.repr = ''),
514 (this.unit = '')
515 }
516 function H(e) {
517 for (
518 var n = '', r = (e = '' + e).charCodeAt(0), o = 0;
519 o < e.length;
520 o++
521 ) {
522 var i = e.charCodeAt(o)
523 if (0 == i)
524 throw new l('Invalid character: the input contains U+0000.')
525 t(i, 1, 31) ||
526 127 == i ||
527 (0 == o && t(i, 48, 57)) ||
528 (1 == o && t(i, 48, 57) && 45 == r)
529 ? (n += '\\' + i.toString(16) + ' ')
530 : i >= 128 ||
531 45 == i ||
532 95 == i ||
533 t(i, 48, 57) ||
534 t(i, 65, 90) ||
535 t(i, 97, 122)
536 ? (n += e[o])
537 : (n += '\\' + e[o])
538 }
539 return n
540 }
541 function G(e) {
542 e = '' + e
543 for (var n = '', r = 0; r < e.length; r++) {
544 var o = e.charCodeAt(r)
545 if (0 == o)
546 throw new l('Invalid character: the input contains U+0000.')
547 t(o, 1, 31) || 127 == o
548 ? (n += '\\' + o.toString(16) + ' ')
549 : (n += 34 == o || 92 == o ? '\\' + e[r] : e[r])
550 }
551 return n
552 }
553 ;((l.prototype = new Error()).name = 'InvalidCharacterError'),
554 (p.prototype.toJSON = function () {
555 return { token: this.tokenType }
556 }),
557 (p.prototype.toString = function () {
558 return this.tokenType
559 }),
560 (p.prototype.toSource = function () {
561 return '' + this
562 }),
563 (f.prototype = Object.create(p.prototype)),
564 (f.prototype.tokenType = 'BADSTRING'),
565 (d.prototype = Object.create(p.prototype)),
566 (d.prototype.tokenType = 'BADURL'),
567 (m.prototype = Object.create(p.prototype)),
568 (m.prototype.tokenType = 'WHITESPACE'),
569 (m.prototype.toString = function () {
570 return 'WS'
571 }),
572 (m.prototype.toSource = function () {
573 return ' '
574 }),
575 (g.prototype = Object.create(p.prototype)),
576 (g.prototype.tokenType = 'CDO'),
577 (g.prototype.toSource = function () {
578 return '\x3c!--'
579 }),
580 (y.prototype = Object.create(p.prototype)),
581 (y.prototype.tokenType = 'CDC'),
582 (y.prototype.toSource = function () {
583 return '--\x3e'
584 }),
585 (v.prototype = Object.create(p.prototype)),
586 (v.prototype.tokenType = ':'),
587 (w.prototype = Object.create(p.prototype)),
588 (w.prototype.tokenType = ';'),
589 (b.prototype = Object.create(p.prototype)),
590 (b.prototype.tokenType = ','),
591 (E.prototype = Object.create(p.prototype)),
592 (_.prototype = Object.create(E.prototype)),
593 (_.prototype.tokenType = '{'),
594 (S.prototype = Object.create(E.prototype)),
595 (S.prototype.tokenType = '}'),
596 (T.prototype = Object.create(E.prototype)),
597 (T.prototype.tokenType = '['),
598 (k.prototype = Object.create(E.prototype)),
599 (k.prototype.tokenType = ']'),
600 (N.prototype = Object.create(E.prototype)),
601 (N.prototype.tokenType = '('),
602 (x.prototype = Object.create(E.prototype)),
603 (x.prototype.tokenType = ')'),
604 (C.prototype = Object.create(p.prototype)),
605 (C.prototype.tokenType = '~='),
606 (A.prototype = Object.create(p.prototype)),
607 (A.prototype.tokenType = '|='),
608 (O.prototype = Object.create(p.prototype)),
609 (O.prototype.tokenType = '^='),
610 (M.prototype = Object.create(p.prototype)),
611 (M.prototype.tokenType = '$='),
612 ($.prototype = Object.create(p.prototype)),
613 ($.prototype.tokenType = '*='),
614 (R.prototype = Object.create(p.prototype)),
615 (R.prototype.tokenType = '||'),
616 (j.prototype = Object.create(p.prototype)),
617 (j.prototype.tokenType = 'EOF'),
618 (j.prototype.toSource = function () {
619 return ''
620 }),
621 (L.prototype = Object.create(p.prototype)),
622 (L.prototype.tokenType = 'DELIM'),
623 (L.prototype.toString = function () {
624 return 'DELIM(' + this.value + ')'
625 }),
626 (L.prototype.toJSON = function () {
627 var e =
628 this.constructor.prototype.constructor.prototype.toJSON.call(
629 this
630 )
631 return (e.value = this.value), e
632 }),
633 (L.prototype.toSource = function () {
634 return '\\' == this.value ? '\\\n' : this.value
635 }),
636 (P.prototype = Object.create(p.prototype)),
637 (P.prototype.ASCIIMatch = function (e) {
638 return this.value.toLowerCase() == e.toLowerCase()
639 }),
640 (P.prototype.toJSON = function () {
641 var e =
642 this.constructor.prototype.constructor.prototype.toJSON.call(
643 this
644 )
645 return (e.value = this.value), e
646 }),
647 (q.prototype = Object.create(P.prototype)),
648 (q.prototype.tokenType = 'IDENT'),
649 (q.prototype.toString = function () {
650 return 'IDENT(' + this.value + ')'
651 }),
652 (q.prototype.toSource = function () {
653 return H(this.value)
654 }),
655 (D.prototype = Object.create(P.prototype)),
656 (D.prototype.tokenType = 'FUNCTION'),
657 (D.prototype.toString = function () {
658 return 'FUNCTION(' + this.value + ')'
659 }),
660 (D.prototype.toSource = function () {
661 return H(this.value) + '('
662 }),
663 (I.prototype = Object.create(P.prototype)),
664 (I.prototype.tokenType = 'AT-KEYWORD'),
665 (I.prototype.toString = function () {
666 return 'AT(' + this.value + ')'
667 }),
668 (I.prototype.toSource = function () {
669 return '@' + H(this.value)
670 }),
671 (U.prototype = Object.create(P.prototype)),
672 (U.prototype.tokenType = 'HASH'),
673 (U.prototype.toString = function () {
674 return 'HASH(' + this.value + ')'
675 }),
676 (U.prototype.toJSON = function () {
677 var e =
678 this.constructor.prototype.constructor.prototype.toJSON.call(
679 this
680 )
681 return (e.value = this.value), (e.type = this.type), e
682 }),
683 (U.prototype.toSource = function () {
684 return 'id' == this.type
685 ? '#' + H(this.value)
686 : '#' +
687 (function (e) {
688 for (
689 var n = '', r = ((e = '' + e).charCodeAt(0), 0);
690 r < e.length;
691 r++
692 ) {
693 var o = e.charCodeAt(r)
694 if (0 == o)
695 throw new l(
696 'Invalid character: the input contains U+0000.'
697 )
698 o >= 128 ||
699 45 == o ||
700 95 == o ||
701 t(o, 48, 57) ||
702 t(o, 65, 90) ||
703 t(o, 97, 122)
704 ? (n += e[r])
705 : (n += '\\' + o.toString(16) + ' ')
706 }
707 return n
708 })(this.value)
709 }),
710 (W.prototype = Object.create(P.prototype)),
711 (W.prototype.tokenType = 'STRING'),
712 (W.prototype.toString = function () {
713 return '"' + G(this.value) + '"'
714 }),
715 (F.prototype = Object.create(P.prototype)),
716 (F.prototype.tokenType = 'URL'),
717 (F.prototype.toString = function () {
718 return 'URL(' + this.value + ')'
719 }),
720 (F.prototype.toSource = function () {
721 return 'url("' + G(this.value) + '")'
722 }),
723 (B.prototype = Object.create(p.prototype)),
724 (B.prototype.tokenType = 'NUMBER'),
725 (B.prototype.toString = function () {
726 return 'integer' == this.type
727 ? 'INT(' + this.value + ')'
728 : 'NUMBER(' + this.value + ')'
729 }),
730 (B.prototype.toJSON = function () {
731 var e =
732 this.constructor.prototype.constructor.prototype.toJSON.call(
733 this
734 )
735 return (
736 (e.value = this.value),
737 (e.type = this.type),
738 (e.repr = this.repr),
739 e
740 )
741 }),
742 (B.prototype.toSource = function () {
743 return this.repr
744 }),
745 (z.prototype = Object.create(p.prototype)),
746 (z.prototype.tokenType = 'PERCENTAGE'),
747 (z.prototype.toString = function () {
748 return 'PERCENTAGE(' + this.value + ')'
749 }),
750 (z.prototype.toJSON = function () {
751 var e =
752 this.constructor.prototype.constructor.prototype.toJSON.call(
753 this
754 )
755 return (e.value = this.value), (e.repr = this.repr), e
756 }),
757 (z.prototype.toSource = function () {
758 return this.repr + '%'
759 }),
760 (V.prototype = Object.create(p.prototype)),
761 (V.prototype.tokenType = 'DIMENSION'),
762 (V.prototype.toString = function () {
763 return 'DIM(' + this.value + ',' + this.unit + ')'
764 }),
765 (V.prototype.toJSON = function () {
766 var e =
767 this.constructor.prototype.constructor.prototype.toJSON.call(
768 this
769 )
770 return (
771 (e.value = this.value),
772 (e.type = this.type),
773 (e.repr = this.repr),
774 (e.unit = this.unit),
775 e
776 )
777 }),
778 (V.prototype.toSource = function () {
779 var e = this.repr,
780 n = H(this.unit)
781 return (
782 'e' != n[0].toLowerCase() ||
783 ('-' != n[1] && !t(n.charCodeAt(1), 48, 57)) ||
784 (n = '\\65 ' + n.slice(1, n.length)),
785 e + n
786 )
787 }),
788 (e.tokenize = function (e) {
789 e = (function (e) {
790 for (var n = [], r = 0; r < e.length; r++) {
791 var o = e.charCodeAt(r)
792 if (
793 (13 == o && 10 == e.charCodeAt(r + 1) && ((o = 10), r++),
794 (13 != o && 12 != o) || (o = 10),
795 0 == o && (o = 65533),
796 t(o, 55296, 56319) && t(e.charCodeAt(r + 1), 56320, 57343))
797 ) {
798 var i = o - 55296,
799 s = e.charCodeAt(r + 1) - 56320
800 ;(o = Math.pow(2, 16) + i * Math.pow(2, 10) + s), r++
801 }
802 n.push(o)
803 }
804 return n
805 })(e)
806 for (
807 var o,
808 l = -1,
809 p = [],
810 E = 0,
811 P = 0,
812 H = 0,
813 G = { line: E, column: P },
814 J = function (t) {
815 return t >= e.length ? -1 : e[t]
816 },
817 Q = function (e) {
818 if ((void 0 === e && (e = 1), e > 3))
819 throw 'Spec Error: no more than three codepoints of lookahead.'
820 return J(l + e)
821 },
822 X = function (e) {
823 return (
824 void 0 === e && (e = 1),
825 a((o = J((l += e))))
826 ? ((E += 1), (H = P), (P = 0))
827 : (P += e),
828 !0
829 )
830 },
831 K = function () {
832 return (
833 (l -= 1),
834 a(o) ? ((E -= 1), (P = H)) : (P -= 1),
835 (G.line = E),
836 (G.column = P),
837 !0
838 )
839 },
840 Z = function (e) {
841 return void 0 === e && (e = o), -1 == e
842 },
843 Y = function () {
844 return (
845 console.log(
846 'Parse error at index ' +
847 l +
848 ', processing codepoint 0x' +
849 o.toString(16) +
850 '.'
851 ),
852 !0
853 )
854 },
855 ee = function () {
856 if ((te(), X(), u(o))) {
857 for (; u(Q()); ) X()
858 return new m()
859 }
860 if (34 == o) return oe()
861 if (35 == o) {
862 if (s(Q()) || ce(Q(1), Q(2))) {
863 var e = new U()
864 return (
865 ue(Q(1), Q(2), Q(3)) && (e.type = 'id'),
866 (e.value = pe()),
867 e
868 )
869 }
870 return new L(o)
871 }
872 return 36 == o
873 ? 61 == Q()
874 ? (X(), new M())
875 : new L(o)
876 : 39 == o
877 ? oe()
878 : 40 == o
879 ? new N()
880 : 41 == o
881 ? new x()
882 : 42 == o
883 ? 61 == Q()
884 ? (X(), new $())
885 : new L(o)
886 : 43 == o
887 ? he()
888 ? (K(), ne())
889 : new L(o)
890 : 44 == o
891 ? new b()
892 : 45 == o
893 ? he()
894 ? (K(), ne())
895 : 45 == Q(1) && 62 == Q(2)
896 ? (X(2), new y())
897 : le()
898 ? (K(), re())
899 : new L(o)
900 : 46 == o
901 ? he()
902 ? (K(), ne())
903 : new L(o)
904 : 58 == o
905 ? new v()
906 : 59 == o
907 ? new w()
908 : 60 == o
909 ? 33 == Q(1) && 45 == Q(2) && 45 == Q(3)
910 ? (X(3), new g())
911 : new L(o)
912 : 64 == o
913 ? ue(Q(1), Q(2), Q(3))
914 ? new I(pe())
915 : new L(o)
916 : 91 == o
917 ? new T()
918 : 92 == o
919 ? ae()
920 ? (K(), re())
921 : (Y(), new L(o))
922 : 93 == o
923 ? new k()
924 : 94 == o
925 ? 61 == Q()
926 ? (X(), new O())
927 : new L(o)
928 : 123 == o
929 ? new _()
930 : 124 == o
931 ? 61 == Q()
932 ? (X(), new A())
933 : 124 == Q()
934 ? (X(), new R())
935 : new L(o)
936 : 125 == o
937 ? new S()
938 : 126 == o
939 ? 61 == Q()
940 ? (X(), new C())
941 : new L(o)
942 : n(o)
943 ? (K(), ne())
944 : i(o)
945 ? (K(), re())
946 : Z()
947 ? new j()
948 : new L(o)
949 },
950 te = function () {
951 for (; 47 == Q(1) && 42 == Q(2); )
952 for (X(2); ; ) {
953 if ((X(), 42 == o && 47 == Q())) {
954 X()
955 break
956 }
957 if (Z()) return void Y()
958 }
959 },
960 ne = function () {
961 var e,
962 t = fe()
963 return ue(Q(1), Q(2), Q(3))
964 ? (((e = new V()).value = t.value),
965 (e.repr = t.repr),
966 (e.type = t.type),
967 (e.unit = pe()),
968 e)
969 : 37 == Q()
970 ? (X(),
971 ((e = new z()).value = t.value),
972 (e.repr = t.repr),
973 e)
974 : (((e = new B()).value = t.value),
975 (e.repr = t.repr),
976 (e.type = t.type),
977 e)
978 },
979 re = function () {
980 var e = pe()
981 if ('url' == e.toLowerCase() && 40 == Q()) {
982 for (X(); u(Q(1)) && u(Q(2)); ) X()
983 return 34 == Q() || 39 == Q()
984 ? new D(e)
985 : !u(Q()) || (34 != Q(2) && 39 != Q(2))
986 ? ie()
987 : new D(e)
988 }
989 return 40 == Q() ? (X(), new D(e)) : new q(e)
990 },
991 oe = function (e) {
992 void 0 === e && (e = o)
993 for (var t = ''; X(); ) {
994 if (o == e || Z()) return new W(t)
995 if (a(o)) return Y(), K(), new f()
996 92 == o
997 ? Z(Q()) || (a(Q()) ? X() : (t += h(se())))
998 : (t += h(o))
999 }
1000 },
1001 ie = function () {
1002 for (var e = new F(''); u(Q()); ) X()
1003 if (Z(Q())) return e
1004 for (; X(); ) {
1005 if (41 == o || Z()) return e
1006 if (u(o)) {
1007 for (; u(Q()); ) X()
1008 return 41 == Q() || Z(Q()) ? (X(), e) : (me(), new d())
1009 }
1010 if (34 == o || 39 == o || 40 == o || c(o))
1011 return Y(), me(), new d()
1012 if (92 == o) {
1013 if (!ae()) return Y(), me(), new d()
1014 e.value += h(se())
1015 } else e.value += h(o)
1016 }
1017 },
1018 se = function () {
1019 if ((X(), r(o))) {
1020 for (var e = [o], t = 0; t < 5 && r(Q()); t++)
1021 X(), e.push(o)
1022 u(Q()) && X()
1023 var n = parseInt(
1024 e
1025 .map(function (e) {
1026 return String.fromCharCode(e)
1027 })
1028 .join(''),
1029 16
1030 )
1031 return n > 1114111 && (n = 65533), n
1032 }
1033 return Z() ? 65533 : o
1034 },
1035 ce = function (e, t) {
1036 return 92 == e && !a(t)
1037 },
1038 ae = function () {
1039 return ce(o, Q())
1040 },
1041 ue = function (e, t, n) {
1042 return 45 == e
1043 ? i(t) || 45 == t || ce(t, n)
1044 : !!i(e) || (92 == e && ce(e, t))
1045 },
1046 le = function () {
1047 return ue(o, Q(1), Q(2))
1048 },
1049 he = function () {
1050 return (
1051 (e = o),
1052 (t = Q(1)),
1053 (r = Q(2)),
1054 43 == e || 45 == e
1055 ? !!n(t) || !(46 != t || !n(r))
1056 : 46 == e
1057 ? !!n(t)
1058 : !!n(e)
1059 )
1060 var e, t, r
1061 },
1062 pe = function () {
1063 for (var e = ''; X(); )
1064 if (s(o)) e += h(o)
1065 else {
1066 if (!ae()) return K(), e
1067 e += h(se())
1068 }
1069 },
1070 fe = function () {
1071 var e = [],
1072 t = 'integer'
1073 for (
1074 (43 != Q() && 45 != Q()) || (X(), (e += h(o)));
1075 n(Q());
1076
1077 )
1078 X(), (e += h(o))
1079 if (46 == Q(1) && n(Q(2)))
1080 for (
1081 X(), e += h(o), X(), e += h(o), t = 'number';
1082 n(Q());
1083
1084 )
1085 X(), (e += h(o))
1086 var r = Q(1),
1087 i = Q(2),
1088 s = Q(3)
1089 if ((69 != r && 101 != r) || !n(i)) {
1090 if ((69 == r || 101 == r) && (43 == i || 45 == i) && n(s))
1091 for (
1092 X(),
1093 e += h(o),
1094 X(),
1095 e += h(o),
1096 X(),
1097 e += h(o),
1098 t = 'number';
1099 n(Q());
1100
1101 )
1102 X(), (e += h(o))
1103 } else
1104 for (
1105 X(), e += h(o), X(), e += h(o), t = 'number';
1106 n(Q());
1107
1108 )
1109 X(), (e += h(o))
1110 return { type: t, value: de(e), repr: e }
1111 },
1112 de = function (e) {
1113 return +e
1114 },
1115 me = function () {
1116 for (; X(); ) {
1117 if (41 == o || Z()) return
1118 ae() && se()
1119 }
1120 },
1121 ge = 0;
1122 !Z(Q());
1123
1124 )
1125 if ((p.push(ee()), ++ge > 2 * e.length))
1126 return "I'm infinite-looping!"
1127 return p
1128 }),
1129 (e.IdentToken = q),
1130 (e.FunctionToken = D),
1131 (e.AtKeywordToken = I),
1132 (e.HashToken = U),
1133 (e.StringToken = W),
1134 (e.BadStringToken = f),
1135 (e.URLToken = F),
1136 (e.BadURLToken = d),
1137 (e.DelimToken = L),
1138 (e.NumberToken = B),
1139 (e.PercentageToken = z),
1140 (e.DimensionToken = V),
1141 (e.IncludeMatchToken = C),
1142 (e.DashMatchToken = A),
1143 (e.PrefixMatchToken = O),
1144 (e.SuffixMatchToken = M),
1145 (e.SubstringMatchToken = $),
1146 (e.ColumnToken = R),
1147 (e.WhitespaceToken = m),
1148 (e.CDOToken = g),
1149 (e.CDCToken = y),
1150 (e.ColonToken = v),
1151 (e.SemicolonToken = w),
1152 (e.CommaToken = b),
1153 (e.OpenParenToken = N),
1154 (e.CloseParenToken = x),
1155 (e.OpenSquareToken = T),
1156 (e.CloseSquareToken = k),
1157 (e.OpenCurlyToken = _),
1158 (e.CloseCurlyToken = S),
1159 (e.EOFToken = j),
1160 (e.CSSParserToken = p),
1161 (e.GroupingToken = E)
1162 }),
1163 void 0 === (r = n.apply(t, [t])) || (e.exports = r)
1164 },
1165 461: (e, t, n) => {
1166 Object.defineProperty(t, '__esModule', { value: !0 }),
1167 (t.parseSelector = function (e) {
1168 const t = (function (e) {
1169 let t,
1170 n = 0,
1171 r = 0
1172 const o = { parts: [] },
1173 i = () => {
1174 const t = e.substring(r, n).trim(),
1175 i = t.indexOf('=')
1176 let s, c
1177 ;-1 !== i &&
1178 t
1179 .substring(0, i)
1180 .trim()
1181 .match(/^[a-zA-Z_0-9-+:*]+$/)
1182 ? ((s = t.substring(0, i).trim()),
1183 (c = t.substring(i + 1)))
1184 : (t.length > 1 &&
1185 '"' === t[0] &&
1186 '"' === t[t.length - 1]) ||
1187 (t.length > 1 &&
1188 "'" === t[0] &&
1189 "'" === t[t.length - 1])
1190 ? ((s = 'text'), (c = t))
1191 : /^\(*\/\//.test(t) || t.startsWith('..')
1192 ? ((s = 'xpath'), (c = t))
1193 : ((s = 'css'), (c = t))
1194 let a = !1
1195 if (
1196 ('*' === s[0] && ((a = !0), (s = s.substring(1))),
1197 o.parts.push({ name: s, body: c }),
1198 a)
1199 ) {
1200 if (void 0 !== o.capture)
1201 throw new Error(
1202 'Only one of the selectors can capture using * modifier'
1203 )
1204 o.capture = o.parts.length - 1
1205 }
1206 }
1207 if (!e.includes('>>')) return (n = e.length), i(), o
1208 for (; n < e.length; ) {
1209 const o = e[n]
1210 '\\' === o && n + 1 < e.length
1211 ? (n += 2)
1212 : o === t
1213 ? ((t = void 0), n++)
1214 : t || ('"' !== o && "'" !== o && '`' !== o)
1215 ? t || '>' !== o || '>' !== e[n + 1]
1216 ? n++
1217 : (i(), (n += 2), (r = n))
1218 : ((t = o), n++)
1219 }
1220 return i(), o
1221 })(e),
1222 n = t.parts.map((e) =>
1223 'css' === e.name || 'css:light' === e.name
1224 ? ('css:light' === e.name &&
1225 (e.body = ':light(' + e.body + ')'),
1226 { name: 'css', body: (0, r.parseCSS)(e.body, o).selector })
1227 : e
1228 )
1229 return { selector: e, capture: t.capture, parts: n }
1230 }),
1231 (t.customCSSNames = void 0)
1232 var r = n(317)
1233 const o = new Set([
1234 'not',
1235 'is',
1236 'where',
1237 'has',
1238 'scope',
1239 'light',
1240 'visible',
1241 'text',
1242 'text-matches',
1243 'text-is',
1244 'has-text',
1245 'above',
1246 'below',
1247 'right-of',
1248 'left-of',
1249 'near',
1250 'nth-match'
1251 ])
1252 t.customCSSNames = o
1253 },
1254 836: (e, t, n) => {
1255 Object.defineProperty(t, '__esModule', { value: !0 }),
1256 (t.ReactEngine = void 0)
1257 var r = n(204)
1258 function o(e) {
1259 if ('function' == typeof e.type)
1260 return e.type.displayName || e.type.name || 'Anonymous'
1261 if ('string' == typeof e.type) return e.type
1262 if (e._currentElement) {
1263 const t = e._currentElement.type
1264 if ('string' == typeof t) return t
1265 if ('function' == typeof t)
1266 return t.displayName || t.name || 'Anonymous'
1267 }
1268 return ''
1269 }
1270 function i(e) {
1271 if (e.child) {
1272 const t = []
1273 for (let n = e.child; n; n = n.sibling) t.push(n)
1274 return t
1275 }
1276 if (!e._currentElement) return []
1277 const t = (e) => {
1278 var t
1279 const n =
1280 null === (t = e._currentElement) || void 0 === t ? void 0 : t.type
1281 return 'function' == typeof n || 'string' == typeof n
1282 }
1283 if (e._renderedComponent) {
1284 const n = e._renderedComponent
1285 return t(n) ? [n] : []
1286 }
1287 return e._renderedChildren
1288 ? [...Object.values(e._renderedChildren)].filter(t)
1289 : []
1290 }
1291 function s(e) {
1292 var t
1293 const n =
1294 e.memoizedProps ||
1295 (null === (t = e._currentElement) || void 0 === t
1296 ? void 0
1297 : t.props)
1298 if (!n || 'string' == typeof n) return n
1299 const r = { ...n }
1300 return delete r.children, r
1301 }
1302 function c(e) {
1303 var t
1304 const n = {
1305 name: o(e),
1306 children: i(e).map(c),
1307 rootElements: [],
1308 props: s(e)
1309 },
1310 r =
1311 e.stateNode ||
1312 e._hostNode ||
1313 (null === (t = e._renderedComponent) || void 0 === t
1314 ? void 0
1315 : t._hostNode)
1316 if (r instanceof Element) n.rootElements.push(r)
1317 else
1318 for (const e of n.children) n.rootElements.push(...e.rootElements)
1319 return n
1320 }
1321 function a(e, t, n = []) {
1322 t(e) && n.push(e)
1323 for (const r of e.children) a(r, t, n)
1324 return n
1325 }
1326 const u = {
1327 queryAll(e, t) {
1328 const { name: n, attributes: o } = (0, r.parseComponentSelector)(t),
1329 i = (function () {
1330 const e = [],
1331 t = document.createTreeWalker(
1332 document,
1333 NodeFilter.SHOW_ELEMENT
1334 )
1335 for (; t.nextNode(); ) {
1336 const n = t.currentNode
1337 n.hasOwnProperty('_reactRootContainer') &&
1338 e.push(n._reactRootContainer._internalRoot.current)
1339 }
1340 for (const t of document.querySelectorAll('[data-reactroot]'))
1341 for (const n of Object.keys(t))
1342 (n.startsWith('__reactInternalInstance') ||
1343 n.startsWith('__reactFiber')) &&
1344 e.push(t[n])
1345 return e
1346 })()
1347 .map((e) => c(e))
1348 .map((t) =>
1349 a(t, (t) => {
1350 if (n && t.name !== n) return !1
1351 if (t.rootElements.some((t) => !e.contains(t))) return !1
1352 for (const e of o)
1353 if (!(0, r.checkComponentAttribute)(t.props, e)) return !1
1354 return !0
1355 })
1356 )
1357 .flat(),
1358 s = new Set()
1359 for (const e of i) for (const t of e.rootElements) s.add(t)
1360 return [...s]
1361 }
1362 }
1363 t.ReactEngine = u
1364 },
1365 848: (e, t, n) => {
1366 Object.defineProperty(t, '__esModule', { value: !0 }),
1367 (t.createLaxTextMatcher = d),
1368 (t.createStrictTextMatcher = m),
1369 (t.createRegexTextMatcher = g),
1370 (t.elementText = v),
1371 (t.elementMatchesText = w),
1372 (t.parentElementOrShadowHost = x),
1373 (t.isVisible = O),
1374 (t.SelectorEvaluatorImpl = void 0)
1375 var r = n(461)
1376 t.SelectorEvaluatorImpl = class {
1377 constructor(e) {
1378 ;(this._engines = new Map()),
1379 (this._cacheQueryCSS = new Map()),
1380 (this._cacheMatches = new Map()),
1381 (this._cacheQuery = new Map()),
1382 (this._cacheMatchesSimple = new Map()),
1383 (this._cacheMatchesParents = new Map()),
1384 (this._cacheCallMatches = new Map()),
1385 (this._cacheCallQuery = new Map()),
1386 (this._cacheQuerySimple = new Map()),
1387 (this._cacheText = new Map()),
1388 (this._scoreMap = void 0),
1389 (this._retainCacheCounter = 0)
1390 for (const [t, n] of e) this._engines.set(t, n)
1391 this._engines.set('not', c),
1392 this._engines.set('is', o),
1393 this._engines.set('where', o),
1394 this._engines.set('has', i),
1395 this._engines.set('scope', s),
1396 this._engines.set('light', a),
1397 this._engines.set('visible', u),
1398 this._engines.set('text', l),
1399 this._engines.set('text-is', h),
1400 this._engines.set('text-matches', p),
1401 this._engines.set('has-text', f),
1402 this._engines.set('right-of', k('right-of', b)),
1403 this._engines.set('left-of', k('left-of', E)),
1404 this._engines.set('above', k('above', _)),
1405 this._engines.set('below', k('below', S)),
1406 this._engines.set('near', k('near', T)),
1407 this._engines.set('nth-match', N)
1408 const t = [...this._engines.keys()]
1409 t.sort()
1410 const n = [...r.customCSSNames]
1411 if ((n.sort(), t.join('|') !== n.join('|')))
1412 throw new Error(
1413 `Please keep customCSSNames in sync with evaluator engines: ${t.join(
1414 '|'
1415 )} vs ${n.join('|')}`
1416 )
1417 }
1418 begin() {
1419 ++this._retainCacheCounter
1420 }
1421 end() {
1422 --this._retainCacheCounter,
1423 this._retainCacheCounter ||
1424 (this._cacheQueryCSS.clear(),
1425 this._cacheMatches.clear(),
1426 this._cacheQuery.clear(),
1427 this._cacheMatchesSimple.clear(),
1428 this._cacheMatchesParents.clear(),
1429 this._cacheCallMatches.clear(),
1430 this._cacheCallQuery.clear(),
1431 this._cacheQuerySimple.clear(),
1432 this._cacheText.clear())
1433 }
1434 _cached(e, t, n, r) {
1435 e.has(t) || e.set(t, [])
1436 const o = e.get(t),
1437 i = o.find((e) => n.every((t, n) => e.rest[n] === t))
1438 if (i) return i.result
1439 const s = r()
1440 return o.push({ rest: n, result: s }), s
1441 }
1442 _checkSelector(e) {
1443 if (
1444 'object' != typeof e ||
1445 !e ||
1446 !(Array.isArray(e) || ('simples' in e && e.simples.length))
1447 )
1448 throw new Error(`Malformed selector "${e}"`)
1449 return e
1450 }
1451 matches(e, t, n) {
1452 const r = this._checkSelector(t)
1453 this.begin()
1454 try {
1455 return this._cached(
1456 this._cacheMatches,
1457 e,
1458 [r, n.scope, n.pierceShadow],
1459 () =>
1460 Array.isArray(r)
1461 ? this._matchesEngine(o, e, r, n)
1462 : !!this._matchesSimple(
1463 e,
1464 r.simples[r.simples.length - 1].selector,
1465 n
1466 ) && this._matchesParents(e, r, r.simples.length - 2, n)
1467 )
1468 } finally {
1469 this.end()
1470 }
1471 }
1472 query(e, t) {
1473 const n = this._checkSelector(t)
1474 this.begin()
1475 try {
1476 return this._cached(
1477 this._cacheQuery,
1478 n,
1479 [e.scope, e.pierceShadow],
1480 () => {
1481 if (Array.isArray(n)) return this._queryEngine(o, e, n)
1482 const t = this._scoreMap
1483 this._scoreMap = new Map()
1484 let r = this._querySimple(
1485 e,
1486 n.simples[n.simples.length - 1].selector
1487 )
1488 return (
1489 (r = r.filter((t) =>
1490 this._matchesParents(t, n, n.simples.length - 2, e)
1491 )),
1492 this._scoreMap.size &&
1493 r.sort((e, t) => {
1494 const n = this._scoreMap.get(e),
1495 r = this._scoreMap.get(t)
1496 return n === r
1497 ? 0
1498 : void 0 === n
1499 ? 1
1500 : void 0 === r
1501 ? -1
1502 : n - r
1503 }),
1504 (this._scoreMap = t),
1505 r
1506 )
1507 }
1508 )
1509 } finally {
1510 this.end()
1511 }
1512 }
1513 _markScore(e, t) {
1514 this._scoreMap && this._scoreMap.set(e, t)
1515 }
1516 _matchesSimple(e, t, n) {
1517 return this._cached(
1518 this._cacheMatchesSimple,
1519 e,
1520 [t, n.scope, n.pierceShadow],
1521 () => {
1522 if (
1523 !t.functions.some(
1524 (e) => 'scope' === e.name || 'is' === e.name
1525 ) &&
1526 e === n.scope
1527 )
1528 return !1
1529 if (t.css && !this._matchesCSS(e, t.css)) return !1
1530 for (const r of t.functions)
1531 if (
1532 !this._matchesEngine(this._getEngine(r.name), e, r.args, n)
1533 )
1534 return !1
1535 return !0
1536 }
1537 )
1538 }
1539 _querySimple(e, t) {
1540 return t.functions.length
1541 ? this._cached(
1542 this._cacheQuerySimple,
1543 t,
1544 [e.scope, e.pierceShadow],
1545 () => {
1546 let n = t.css
1547 const r = t.functions
1548 let o
1549 '*' === n && r.length && (n = void 0)
1550 let i = -1
1551 void 0 !== n
1552 ? (o = this._queryCSS(e, n))
1553 : ((i = r.findIndex(
1554 (e) => void 0 !== this._getEngine(e.name).query
1555 )),
1556 -1 === i && (i = 0),
1557 (o = this._queryEngine(
1558 this._getEngine(r[i].name),
1559 e,
1560 r[i].args
1561 )))
1562 for (let t = 0; t < r.length; t++) {
1563 if (t === i) continue
1564 const n = this._getEngine(r[t].name)
1565 void 0 !== n.matches &&
1566 (o = o.filter((o) =>
1567 this._matchesEngine(n, o, r[t].args, e)
1568 ))
1569 }
1570 for (let t = 0; t < r.length; t++) {
1571 if (t === i) continue
1572 const n = this._getEngine(r[t].name)
1573 void 0 === n.matches &&
1574 (o = o.filter((o) =>
1575 this._matchesEngine(n, o, r[t].args, e)
1576 ))
1577 }
1578 return o
1579 }
1580 )
1581 : this._queryCSS(e, t.css || '*')
1582 }
1583 _matchesParents(e, t, n, r) {
1584 return (
1585 n < 0 ||
1586 this._cached(
1587 this._cacheMatchesParents,
1588 e,
1589 [t, n, r.scope, r.pierceShadow],
1590 () => {
1591 const { selector: o, combinator: i } = t.simples[n]
1592 if ('>' === i) {
1593 const i = C(e, r)
1594 return (
1595 !(!i || !this._matchesSimple(i, o, r)) &&
1596 this._matchesParents(i, t, n - 1, r)
1597 )
1598 }
1599 if ('+' === i) {
1600 const i = A(e, r)
1601 return (
1602 !(!i || !this._matchesSimple(i, o, r)) &&
1603 this._matchesParents(i, t, n - 1, r)
1604 )
1605 }
1606 if ('' === i) {
1607 let i = C(e, r)
1608 for (; i; ) {
1609 if (this._matchesSimple(i, o, r)) {
1610 if (this._matchesParents(i, t, n - 1, r)) return !0
1611 if ('' === t.simples[n - 1].combinator) break
1612 }
1613 i = C(i, r)
1614 }
1615 return !1
1616 }
1617 if ('~' === i) {
1618 let i = A(e, r)
1619 for (; i; ) {
1620 if (this._matchesSimple(i, o, r)) {
1621 if (this._matchesParents(i, t, n - 1, r)) return !0
1622 if ('~' === t.simples[n - 1].combinator) break
1623 }
1624 i = A(i, r)
1625 }
1626 return !1
1627 }
1628 if ('>=' === i) {
1629 let i = e
1630 for (; i; ) {
1631 if (this._matchesSimple(i, o, r)) {
1632 if (this._matchesParents(i, t, n - 1, r)) return !0
1633 if ('' === t.simples[n - 1].combinator) break
1634 }
1635 i = C(i, r)
1636 }
1637 return !1
1638 }
1639 throw new Error(`Unsupported combinator "${i}"`)
1640 }
1641 )
1642 )
1643 }
1644 _matchesEngine(e, t, n, r) {
1645 if (e.matches) return this._callMatches(e, t, n, r)
1646 if (e.query) return this._callQuery(e, n, r).includes(t)
1647 throw new Error(
1648 'Selector engine should implement "matches" or "query"'
1649 )
1650 }
1651 _queryEngine(e, t, n) {
1652 if (e.query) return this._callQuery(e, n, t)
1653 if (e.matches)
1654 return this._queryCSS(t, '*').filter((r) =>
1655 this._callMatches(e, r, n, t)
1656 )
1657 throw new Error(
1658 'Selector engine should implement "matches" or "query"'
1659 )
1660 }
1661 _callMatches(e, t, n, r) {
1662 return this._cached(
1663 this._cacheCallMatches,
1664 t,
1665 [e, r.scope, r.pierceShadow, ...n],
1666 () => e.matches(t, n, r, this)
1667 )
1668 }
1669 _callQuery(e, t, n) {
1670 return this._cached(
1671 this._cacheCallQuery,
1672 e,
1673 [n.scope, n.pierceShadow, ...t],
1674 () => e.query(n, t, this)
1675 )
1676 }
1677 _matchesCSS(e, t) {
1678 return e.matches(t)
1679 }
1680 _queryCSS(e, t) {
1681 return this._cached(
1682 this._cacheQueryCSS,
1683 t,
1684 [e.scope, e.pierceShadow],
1685 () => {
1686 let n = []
1687 return (
1688 (function r(o) {
1689 if (
1690 ((n = n.concat([...o.querySelectorAll(t)])),
1691 e.pierceShadow)
1692 ) {
1693 o.shadowRoot && r(o.shadowRoot)
1694 for (const e of o.querySelectorAll('*'))
1695 e.shadowRoot && r(e.shadowRoot)
1696 }
1697 })(e.scope),
1698 n
1699 )
1700 }
1701 )
1702 }
1703 _getEngine(e) {
1704 const t = this._engines.get(e)
1705 if (!t) throw new Error(`Unknown selector engine "${e}"`)
1706 return t
1707 }
1708 }
1709 const o = {
1710 matches(e, t, n, r) {
1711 if (0 === t.length)
1712 throw new Error('"is" engine expects non-empty selector list')
1713 return t.some((t) => r.matches(e, t, n))
1714 },
1715 query(e, t, n) {
1716 if (0 === t.length)
1717 throw new Error('"is" engine expects non-empty selector list')
1718 let r = []
1719 for (const o of t) r = r.concat(n.query(e, o))
1720 return 1 === t.length
1721 ? r
1722 : (function (e) {
1723 const t = new Map(),
1724 n = [],
1725 r = []
1726 function o(e) {
1727 let r = t.get(e)
1728 if (r) return r
1729 const i = x(e)
1730 return (
1731 i ? o(i).children.push(e) : n.push(e),
1732 (r = { children: [], taken: !1 }),
1733 t.set(e, r),
1734 r
1735 )
1736 }
1737 return (
1738 e.forEach((e) => (o(e).taken = !0)),
1739 n.forEach(function e(n) {
1740 const o = t.get(n)
1741 if ((o.taken && r.push(n), o.children.length > 1)) {
1742 const e = new Set(o.children)
1743 o.children = []
1744 let t = n.firstElementChild
1745 for (; t && o.children.length < e.size; )
1746 e.has(t) && o.children.push(t),
1747 (t = t.nextElementSibling)
1748 for (
1749 t = n.shadowRoot
1750 ? n.shadowRoot.firstElementChild
1751 : null;
1752 t && o.children.length < e.size;
1753
1754 )
1755 e.has(t) && o.children.push(t),
1756 (t = t.nextElementSibling)
1757 }
1758 o.children.forEach(e)
1759 }),
1760 r
1761 )
1762 })(r)
1763 }
1764 },
1765 i = {
1766 matches(e, t, n, r) {
1767 if (0 === t.length)
1768 throw new Error('"has" engine expects non-empty selector list')
1769 return r.query({ ...n, scope: e }, t).length > 0
1770 }
1771 },
1772 s = {
1773 matches(e, t, n, r) {
1774 if (0 !== t.length)
1775 throw new Error('"scope" engine expects no arguments')
1776 return 9 === n.scope.nodeType
1777 ? e === n.scope.documentElement
1778 : e === n.scope
1779 },
1780 query(e, t, n) {
1781 if (0 !== t.length)
1782 throw new Error('"scope" engine expects no arguments')
1783 if (9 === e.scope.nodeType) {
1784 const t = e.scope.documentElement
1785 return t ? [t] : []
1786 }
1787 return 1 === e.scope.nodeType ? [e.scope] : []
1788 }
1789 },
1790 c = {
1791 matches(e, t, n, r) {
1792 if (0 === t.length)
1793 throw new Error('"not" engine expects non-empty selector list')
1794 return !r.matches(e, t, n)
1795 }
1796 },
1797 a = {
1798 query: (e, t, n) => n.query({ ...e, pierceShadow: !1 }, t),
1799 matches: (e, t, n, r) => r.matches(e, t, { ...n, pierceShadow: !1 })
1800 },
1801 u = {
1802 matches(e, t, n, r) {
1803 if (t.length)
1804 throw new Error('"visible" engine expects no arguments')
1805 return O(e)
1806 }
1807 },
1808 l = {
1809 matches(e, t, n, r) {
1810 if (1 !== t.length || 'string' != typeof t[0])
1811 throw new Error('"text" engine expects a single string')
1812 return 'self' === w(r, e, d(t[0]))
1813 }
1814 },
1815 h = {
1816 matches(e, t, n, r) {
1817 if (1 !== t.length || 'string' != typeof t[0])
1818 throw new Error('"text-is" engine expects a single string')
1819 return 'none' !== w(r, e, m(t[0]))
1820 }
1821 },
1822 p = {
1823 matches(e, t, n, r) {
1824 if (
1825 0 === t.length ||
1826 'string' != typeof t[0] ||
1827 t.length > 2 ||
1828 (2 === t.length && 'string' != typeof t[1])
1829 )
1830 throw new Error(
1831 '"text-matches" engine expects a regexp body and optional regexp flags'
1832 )
1833 return 'self' === w(r, e, g(t[0], 2 === t.length ? t[1] : void 0))
1834 }
1835 },
1836 f = {
1837 matches(e, t, n, r) {
1838 if (1 !== t.length || 'string' != typeof t[0])
1839 throw new Error('"has-text" engine expects a single string')
1840 return !y(e) && d(t[0])(v(r, e))
1841 }
1842 }
1843 function d(e) {
1844 return (
1845 (e = e.trim().replace(/\s+/g, ' ').toLowerCase()),
1846 (t) => t.full.trim().replace(/\s+/g, ' ').toLowerCase().includes(e)
1847 )
1848 }
1849 function m(e) {
1850 return (
1851 (e = e.trim().replace(/\s+/g, ' ')),
1852 (t) =>
1853 (!e && !t.immediate.length) ||
1854 t.immediate.some((t) => t.trim().replace(/\s+/g, ' ') === e)
1855 )
1856 }
1857 function g(e, t) {
1858 const n = new RegExp(e, t)
1859 return (e) => n.test(e.full)
1860 }
1861 function y(e) {
1862 return (
1863 'SCRIPT' === e.nodeName ||
1864 'STYLE' === e.nodeName ||
1865 (document.head && document.head.contains(e))
1866 )
1867 }
1868 function v(e, t) {
1869 let n = e._cacheText.get(t)
1870 if (void 0 === n) {
1871 if (((n = { full: '', immediate: [] }), !y(t))) {
1872 let r = ''
1873 if (
1874 t instanceof HTMLInputElement &&
1875 ('submit' === t.type || 'button' === t.type)
1876 )
1877 n = { full: t.value, immediate: [t.value] }
1878 else {
1879 for (let o = t.firstChild; o; o = o.nextSibling)
1880 o.nodeType === Node.TEXT_NODE
1881 ? ((n.full += o.nodeValue || ''), (r += o.nodeValue || ''))
1882 : (r && n.immediate.push(r),
1883 (r = ''),
1884 o.nodeType === Node.ELEMENT_NODE &&
1885 (n.full += v(e, o).full))
1886 r && n.immediate.push(r),
1887 t.shadowRoot && (n.full += v(e, t.shadowRoot).full)
1888 }
1889 }
1890 e._cacheText.set(t, n)
1891 }
1892 return n
1893 }
1894 function w(e, t, n) {
1895 if (y(t)) return 'none'
1896 if (!n(v(e, t))) return 'none'
1897 for (let r = t.firstChild; r; r = r.nextSibling)
1898 if (r.nodeType === Node.ELEMENT_NODE && n(v(e, r)))
1899 return 'selfAndChildren'
1900 return t.shadowRoot && n(v(e, t.shadowRoot))
1901 ? 'selfAndChildren'
1902 : 'self'
1903 }
1904 function b(e, t, n) {
1905 const r = e.left - t.right
1906 if (!(r < 0 || (void 0 !== n && r > n)))
1907 return (
1908 r + Math.max(t.bottom - e.bottom, 0) + Math.max(e.top - t.top, 0)
1909 )
1910 }
1911 function E(e, t, n) {
1912 const r = t.left - e.right
1913 if (!(r < 0 || (void 0 !== n && r > n)))
1914 return (
1915 r + Math.max(t.bottom - e.bottom, 0) + Math.max(e.top - t.top, 0)
1916 )
1917 }
1918 function _(e, t, n) {
1919 const r = t.top - e.bottom
1920 if (!(r < 0 || (void 0 !== n && r > n)))
1921 return (
1922 r + Math.max(e.left - t.left, 0) + Math.max(t.right - e.right, 0)
1923 )
1924 }
1925 function S(e, t, n) {
1926 const r = e.top - t.bottom
1927 if (!(r < 0 || (void 0 !== n && r > n)))
1928 return (
1929 r + Math.max(e.left - t.left, 0) + Math.max(t.right - e.right, 0)
1930 )
1931 }
1932 function T(e, t, n) {
1933 const r = void 0 === n ? 50 : n
1934 let o = 0
1935 return (
1936 e.left - t.right >= 0 && (o += e.left - t.right),
1937 t.left - e.right >= 0 && (o += t.left - e.right),
1938 t.top - e.bottom >= 0 && (o += t.top - e.bottom),
1939 e.top - t.bottom >= 0 && (o += e.top - t.bottom),
1940 o > r ? void 0 : o
1941 )
1942 }
1943 function k(e, t) {
1944 return {
1945 matches(n, r, o, i) {
1946 const s =
1947 r.length && 'number' == typeof r[r.length - 1]
1948 ? r[r.length - 1]
1949 : void 0,
1950 c = void 0 === s ? r : r.slice(0, r.length - 1)
1951 if (r.length < 1 + (void 0 === s ? 0 : 1))
1952 throw new Error(
1953 `"${e}" engine expects a selector list and optional maximum distance in pixels`
1954 )
1955 const a = n.getBoundingClientRect()
1956 let u
1957 for (const e of i.query(o, c)) {
1958 if (e === n) continue
1959 const r = t(a, e.getBoundingClientRect(), s)
1960 void 0 !== r && (void 0 === u || r < u) && (u = r)
1961 }
1962 return void 0 !== u && (i._markScore(n, u), !0)
1963 }
1964 }
1965 }
1966 const N = {
1967 query(e, t, n) {
1968 let r = t[t.length - 1]
1969 if (t.length < 2)
1970 throw new Error(
1971 '"nth-match" engine expects non-empty selector list and an index argument'
1972 )
1973 if ('number' != typeof r || r < 1)
1974 throw new Error(
1975 '"nth-match" engine expects a one-based index as the last argument'
1976 )
1977 const i = o.query(e, t.slice(0, t.length - 1), n)
1978 return r--, r < i.length ? [i[r]] : []
1979 }
1980 }
1981 function x(e) {
1982 return e.parentElement
1983 ? e.parentElement
1984 : e.parentNode &&
1985 e.parentNode.nodeType === Node.DOCUMENT_FRAGMENT_NODE &&
1986 e.parentNode.host
1987 ? e.parentNode.host
1988 : void 0
1989 }
1990 function C(e, t) {
1991 if (e !== t.scope)
1992 return t.pierceShadow ? x(e) : e.parentElement || void 0
1993 }
1994 function A(e, t) {
1995 if (e !== t.scope) return e.previousElementSibling || void 0
1996 }
1997 function O(e) {
1998 if (!e.ownerDocument || !e.ownerDocument.defaultView) return !0
1999 const t = e.ownerDocument.defaultView.getComputedStyle(e)
2000 if (!t || 'hidden' === t.visibility) return !1
2001 const n = e.getBoundingClientRect()
2002 return n.width > 0 && n.height > 0
2003 }
2004 },
2005 854: (e, t, n) => {
2006 Object.defineProperty(t, '__esModule', { value: !0 }),
2007 (t.querySelector = function (e, t, n) {
2008 try {
2009 const r = e.parseSelector(t)
2010 return { selector: t, elements: e.querySelectorAll(r, n) }
2011 } catch (e) {
2012 return { selector: t, elements: [] }
2013 }
2014 }),
2015 (t.generateSelector = function (e, t) {
2016 e._evaluator.begin()
2017 try {
2018 const n = (function (e, t) {
2019 if (t.ownerDocument.documentElement === t)
2020 return [{ engine: 'css', selector: 'html', score: 1 }]
2021 const n = (u, h) => {
2022 const d = h ? o : i
2023 let m = d.get(u)
2024 return (
2025 void 0 === m &&
2026 ((m = ((o, i) => {
2027 const u = o === t
2028 let h = i
2029 ? (function (e, t, n) {
2030 if ('SELECT' === t.nodeName) return []
2031 const o = (0, r.elementText)(e._evaluator, t)
2032 .full.trim()
2033 .replace(/\s+/g, ' ')
2034 .substring(0, 80)
2035 if (!o) return []
2036 const i = []
2037 let s = o
2038 if (
2039 ((o.includes('"') ||
2040 o.includes('>>') ||
2041 '/' === o[0]) &&
2042 (s = `/.*${(function (e) {
2043 return e.replace(
2044 /[.*+?^>${}()|[\]\\]/g,
2045 '\\$&'
2046 )
2047 })(o)}.*/`),
2048 i.push({
2049 engine: 'text',
2050 selector: s,
2051 score: 10
2052 }),
2053 n && s === o)
2054 ) {
2055 let e = t.nodeName.toLocaleLowerCase()
2056 t.hasAttribute('role') &&
2057 (e += `[role=${l(
2058 t.getAttribute('role')
2059 )}]`),
2060 i.push({
2061 engine: 'css',
2062 selector: `${e}:has-text("${o}")`,
2063 score: 30
2064 })
2065 }
2066 return i
2067 })(e, o, o === t).map((e) => [e])
2068 : []
2069 o !== t && (h = s(h))
2070 const d = (function (e, t) {
2071 const n = []
2072 for (const e of [
2073 'data-testid',
2074 'data-test-id',
2075 'data-test'
2076 ])
2077 t.hasAttribute(e) &&
2078 n.push({
2079 engine: 'css',
2080 selector: `[${e}=${l(t.getAttribute(e))}]`,
2081 score: 1
2082 })
2083 if ('INPUT' === t.nodeName) {
2084 const e = t
2085 e.placeholder &&
2086 n.push({
2087 engine: 'css',
2088 selector: `[placeholder=${l(e.placeholder)}]`,
2089 score: 10
2090 })
2091 }
2092 t.hasAttribute('aria-label') &&
2093 n.push({
2094 engine: 'css',
2095 selector: `[aria-label=${l(
2096 t.getAttribute('aria-label')
2097 )}]`,
2098 score: 10
2099 }),
2100 t.getAttribute('alt') &&
2101 ['APPLET', 'AREA', 'IMG', 'INPUT'].includes(
2102 t.nodeName
2103 ) &&
2104 n.push({
2105 engine: 'css',
2106 selector: `${t.nodeName.toLowerCase()}[alt=${l(
2107 t.getAttribute('alt')
2108 )}]`,
2109 score: 10
2110 }),
2111 t.hasAttribute('role') &&
2112 n.push({
2113 engine: 'css',
2114 selector: `${t.nodeName.toLocaleLowerCase()}[role=${l(
2115 t.getAttribute('role')
2116 )}]`,
2117 score: 50
2118 }),
2119 t.getAttribute('name') &&
2120 [
2121 'BUTTON',
2122 'FORM',
2123 'FIELDSET',
2124 'IFRAME',
2125 'INPUT',
2126 'KEYGEN',
2127 'OBJECT',
2128 'OUTPUT',
2129 'SELECT',
2130 'TEXTAREA',
2131 'MAP',
2132 'META',
2133 'PARAM'
2134 ].includes(t.nodeName) &&
2135 n.push({
2136 engine: 'css',
2137 selector: `${t.nodeName.toLowerCase()}[name=${l(
2138 t.getAttribute('name')
2139 )}]`,
2140 score: 50
2141 }),
2142 ['INPUT', 'TEXTAREA'].includes(t.nodeName) &&
2143 'hidden' !== t.getAttribute('type') &&
2144 t.getAttribute('type') &&
2145 n.push({
2146 engine: 'css',
2147 selector: `${t.nodeName.toLowerCase()}[type=${l(
2148 t.getAttribute('type')
2149 )}]`,
2150 score: 50
2151 }),
2152 ['INPUT', 'TEXTAREA', 'SELECT'].includes(
2153 t.nodeName
2154 ) &&
2155 n.push({
2156 engine: 'css',
2157 selector: t.nodeName.toLowerCase(),
2158 score: 50
2159 })
2160 const r = t.getAttribute('id')
2161 return (
2162 r &&
2163 !(function (e) {
2164 let t,
2165 n = 0
2166 for (let r = 0; r < e.length; ++r) {
2167 const o = e[r]
2168 let i
2169 '-' !== o &&
2170 '_' !== o &&
2171 ((i =
2172 o >= 'a' && o <= 'z'
2173 ? 'lower'
2174 : o >= 'A' && o <= 'Z'
2175 ? 'upper'
2176 : o >= '0' && o <= '9'
2177 ? 'digit'
2178 : 'other'),
2179 'lower' !== i || 'upper' !== t
2180 ? (t && t !== i && ++n, (t = i))
2181 : (t = i))
2182 }
2183 return n >= e.length / 4
2184 })(r) &&
2185 n.push({
2186 engine: 'css',
2187 selector: a(r),
2188 score: 100
2189 }),
2190 n.push({
2191 engine: 'css',
2192 selector: t.nodeName.toLocaleLowerCase(),
2193 score: 200
2194 }),
2195 n
2196 )
2197 })(0, o).map((e) => [e])
2198 let m = f(e, t.ownerDocument, o, [...h, ...d], u)
2199 h = s(h)
2200 const g = (t) => {
2201 const r = i && !t.length,
2202 s = [...t, ...d].filter((e) => !m || p(e) < p(m))
2203 let a = s[0]
2204 if (a)
2205 for (let t = c(o); t; t = c(t)) {
2206 const i = n(t, r)
2207 if (!i) continue
2208 if (m && p([...i, ...a]) >= p(m)) continue
2209 if (((a = f(e, t, o, s, u)), !a)) return
2210 const c = [...i, ...a]
2211 ;(!m || p(c) < p(m)) && (m = c)
2212 }
2213 }
2214 return g(h), o === t && h.length && g([]), m
2215 })(u, h)),
2216 d.set(u, m)),
2217 m
2218 )
2219 }
2220 return n(t, !0)
2221 })(
2222 e,
2223 (t =
2224 t.closest(
2225 'button,select,input,[role=button],[role=checkbox],[role=radio]'
2226 ) || t)
2227 ),
2228 d = h(n || [u(e, t)]),
2229 m = e.parseSelector(d)
2230 return {
2231 selector: d,
2232 elements: e.querySelectorAll(m, t.ownerDocument)
2233 }
2234 } finally {
2235 o.clear(), i.clear(), e._evaluator.end()
2236 }
2237 })
2238 var r = n(848)
2239 const o = new Map(),
2240 i = new Map()
2241 function s(e) {
2242 return e.filter((e) => '/' !== e[0].selector[0])
2243 }
2244 function c(e) {
2245 return e.parentElement
2246 ? e.parentElement
2247 : e.parentNode &&
2248 e.parentNode.nodeType === Node.DOCUMENT_FRAGMENT_NODE &&
2249 e.parentNode.host
2250 ? e.parentNode.host
2251 : null
2252 }
2253 function a(e) {
2254 return /^[a-zA-Z][a-zA-Z0-9\-\_]+$/.test(e) ? '#' + e : `[id="${e}"]`
2255 }
2256 function u(e, t) {
2257 const n = 1e7,
2258 r = t.ownerDocument,
2259 o = []
2260 function i(n) {
2261 const r = o.slice()
2262 n && r.unshift(n)
2263 const i = r.join(' '),
2264 s = e.parseSelector(i)
2265 return e.querySelector(s, t.ownerDocument, !1) === t ? i : void 0
2266 }
2267 for (let e = t; e && e !== r; e = c(e)) {
2268 const t = e.nodeName.toLowerCase()
2269 let r = ''
2270 if (e.id) {
2271 const t = a(e.id),
2272 o = i(t)
2273 if (o) return { engine: 'css', selector: o, score: n }
2274 r = t
2275 }
2276 const s = e.parentNode,
2277 c = [...e.classList]
2278 for (let e = 0; e < c.length; ++e) {
2279 const t = '.' + c.slice(0, e + 1).join('.'),
2280 o = i(t)
2281 if (o) return { engine: 'css', selector: o, score: n }
2282 !r && s && 1 === s.querySelectorAll(t).length && (r = t)
2283 }
2284 if (s) {
2285 const o = [...s.children],
2286 c =
2287 0 ===
2288 o.filter((e) => e.nodeName.toLowerCase() === t).indexOf(e)
2289 ? t
2290 : `${t}:nth-child(${1 + o.indexOf(e)})`,
2291 a = i(c)
2292 if (a) return { engine: 'css', selector: a, score: n }
2293 r || (r = c)
2294 } else r || (r = t)
2295 o.unshift(r)
2296 }
2297 return { engine: 'css', selector: i(), score: n }
2298 }
2299 function l(e) {
2300 return `"${e.replace(/"/g, '\\"').replace(/\n/g, '\\n')}"`
2301 }
2302 function h(e) {
2303 const t = []
2304 let n = ''
2305 for (const { engine: r, selector: o } of e)
2306 t.length &&
2307 ('css' !== n || 'css' !== r || o.startsWith(':nth-match(')) &&
2308 t.push('>>'),
2309 (n = r),
2310 'css' === r ? t.push(o) : t.push(`${r}=${o}`)
2311 return t.join(' ')
2312 }
2313 function p(e) {
2314 let t = 0
2315 for (let n = 0; n < e.length; n++) t += e[n].score * (e.length - n)
2316 return t
2317 }
2318 function f(e, t, n, r, o) {
2319 const i = r.map((e) => ({ tokens: e, score: p(e) }))
2320 i.sort((e, t) => e.score - t.score)
2321 let s = null
2322 for (const { tokens: r } of i) {
2323 const i = e.parseSelector(h(r)),
2324 c = e.querySelectorAll(i, t),
2325 a = c.indexOf(n)
2326 if (0 === a) return r
2327 if (!o || s || -1 === a || c.length > 5) continue
2328 const u = r.map((e) =>
2329 'text' !== e.engine
2330 ? e
2331 : e.selector.startsWith('/') && e.selector.endsWith('/')
2332 ? {
2333 engine: 'css',
2334 selector: `:text-matches("${e.selector.substring(
2335 1,
2336 e.selector.length - 1
2337 )}")`,
2338 score: e.score
2339 }
2340 : {
2341 engine: 'css',
2342 selector: `:text("${e.selector}")`,
2343 score: e.score
2344 }
2345 )
2346 s = [
2347 {
2348 engine: 'css',
2349 selector: `:nth-match(${h(u)}, ${a + 1})`,
2350 score: p(u) + 1e3
2351 }
2352 ]
2353 }
2354 return s
2355 }
2356 },
2357 12: (e, t, n) => {
2358 Object.defineProperty(t, '__esModule', { value: !0 }),
2359 (t.VueEngine = void 0)
2360 var r = n(204)
2361 function o(e, t) {
2362 const n = e.replace(/^[a-zA-Z]:/, '').replace(/\\/g, '/')
2363 let r = n.substring(n.lastIndexOf('/') + 1)
2364 return (
2365 t && r.endsWith(t) && (r = r.substring(0, r.length - t.length)), r
2366 )
2367 }
2368 function i(e, t) {
2369 return t ? t.toUpperCase() : ''
2370 }
2371 const s = /(?:^|[-_/])(\w)/g,
2372 c = (e) => e && e.replace(s, i)
2373 function a(e, t, n = []) {
2374 t(e) && n.push(e)
2375 for (const r of e.children) a(r, t, n)
2376 return n
2377 }
2378 const u = {
2379 queryAll(e, t) {
2380 const { name: n, attributes: i } = (0, r.parseComponentSelector)(t),
2381 s = (function () {
2382 const e = []
2383 for (const t of document.querySelectorAll('[data-v-app]'))
2384 t._vnode &&
2385 t._vnode.component &&
2386 e.push({ root: t._vnode.component, version: 3 })
2387 const t = document.createTreeWalker(
2388 document,
2389 NodeFilter.SHOW_ELEMENT
2390 ),
2391 n = new Set()
2392 for (; t.nextNode(); ) {
2393 const e = t.currentNode
2394 e && e.__vue__ && n.add(e.__vue__.$root)
2395 }
2396 for (const t of n) e.push({ version: 2, root: t })
2397 return e
2398 })()
2399 .map((e) =>
2400 3 === e.version
2401 ? (function (e) {
2402 function t(e, t) {
2403 return (e.type.__playwright_guessedName = t), t
2404 }
2405 function n(e) {
2406 const n = (function (e) {
2407 const t =
2408 e.name ||
2409 e._componentTag ||
2410 e.__playwright_guessedName
2411 if (t) return t
2412 const n = e.__file
2413 return n ? c(o(n, '.vue')) : void 0
2414 })(e.type || {})
2415 if (n) return n
2416 if (e.root === e) return 'Root'
2417 for (const n in null === (r = e.parent) ||
2418 void 0 === r ||
2419 null === (i = r.type) ||
2420 void 0 === i
2421 ? void 0
2422 : i.components) {
2423 var r, i, s
2424 if (
2425 (null === (s = e.parent) || void 0 === s
2426 ? void 0
2427 : s.type.components[n]) === e.type
2428 )
2429 return t(e, n)
2430 }
2431 for (const n in null === (a = e.appContext) ||
2432 void 0 === a
2433 ? void 0
2434 : a.components) {
2435 var a
2436 if (e.appContext.components[n] === e.type)
2437 return t(e, n)
2438 }
2439 return 'Anonymous Component'
2440 }
2441 function r(e) {
2442 const t = []
2443 return (
2444 e.component && t.push(e.component),
2445 e.suspense && t.push(...r(e.suspense.activeBranch)),
2446 Array.isArray(e.children) &&
2447 e.children.forEach((e) => {
2448 e.component
2449 ? t.push(e.component)
2450 : t.push(...r(e))
2451 }),
2452 t.filter((e) => {
2453 var t
2454 return !(
2455 (function (e) {
2456 return e._isBeingDestroyed || e.isUnmounted
2457 })(e) ||
2458 (null !== (t = e.type.devtools) &&
2459 void 0 !== t &&
2460 t.hide)
2461 )
2462 })
2463 )
2464 }
2465 function i(e) {
2466 return (function (e) {
2467 return (
2468 'Symbol(Fragment)' === e.subTree.type.toString()
2469 )
2470 })(e)
2471 ? (function (e) {
2472 if (!e.children) return []
2473 const t = []
2474 for (
2475 let n = 0, r = e.children.length;
2476 n < r;
2477 n++
2478 ) {
2479 const r = e.children[n]
2480 r.component
2481 ? t.push(...i(r.component))
2482 : r.el && t.push(r.el)
2483 }
2484 return t
2485 })(e.subTree)
2486 : [e.subTree.el]
2487 }
2488 return (function e(t) {
2489 return {
2490 name: n(t),
2491 children: r(t.subTree).map(e),
2492 rootElements: i(t),
2493 props: t.props
2494 }
2495 })(e)
2496 })(e.root)
2497 : (function (e) {
2498 function t(e) {
2499 return (
2500 (function (e) {
2501 const t =
2502 e.displayName || e.name || e._componentTag
2503 if (t) return t
2504 const n = e.__file
2505 return n ? c(o(n, '.vue')) : void 0
2506 })(e.$options || e.fnOptions || {}) ||
2507 (e.$root === e ? 'Root' : 'Anonymous Component')
2508 )
2509 }
2510 function n(e) {
2511 return e.$children
2512 ? e.$children
2513 : Array.isArray(e.subTree.children)
2514 ? e.subTree.children
2515 .filter((e) => !!e.component)
2516 .map((e) => e.component)
2517 : []
2518 }
2519 return (function e(r) {
2520 return {
2521 name: t(r),
2522 children: n(r).map(e),
2523 rootElements: [r.$el],
2524 props: r._props
2525 }
2526 })(e)
2527 })(e.root)
2528 )
2529 .map((t) =>
2530 a(t, (t) => {
2531 if (n && t.name !== n) return !1
2532 if (t.rootElements.some((t) => !e.contains(t))) return !1
2533 for (const e of i)
2534 if (!(0, r.checkComponentAttribute)(t.props, e)) return !1
2535 return !0
2536 })
2537 )
2538 .flat(),
2539 u = new Set()
2540 for (const e of s) for (const t of e.rootElements) u.add(t)
2541 return [...u]
2542 }
2543 }
2544 t.VueEngine = u
2545 },
2546 530: (e, t) => {
2547 Object.defineProperty(t, '__esModule', { value: !0 }),
2548 (t.XPathEngine = void 0)
2549 const n = {
2550 queryAll(e, t) {
2551 t.startsWith('/') && (t = '.' + t)
2552 const n = [],
2553 r = e instanceof Document ? e : e.ownerDocument
2554 if (!r) return n
2555 const o = r.evaluate(
2556 t,
2557 e,
2558 null,
2559 XPathResult.ORDERED_NODE_ITERATOR_TYPE
2560 )
2561 for (let e = o.iterateNext(); e; e = o.iterateNext())
2562 e.nodeType === Node.ELEMENT_NODE && n.push(e)
2563 return n
2564 }
2565 }
2566 t.XPathEngine = n
2567 }
2568 },
2569 t = {}
2570 function n(r) {
2571 var o = t[r]
2572 if (void 0 !== o) return o.exports
2573 var i = (t[r] = { exports: {} })
2574 return e[r](i, i.exports, n), i.exports
2575 }
2576 n.g = (function () {
2577 if ('object' == typeof globalThis) return globalThis
2578 try {
2579 return this || new Function('return this')()
2580 } catch (e) {
2581 if ('object' == typeof window) return window
2582 }
2583 })()
2584 var r = {}
2585 ;(() => {
2586 var e = r
2587 e.default = void 0
2588 var t = n(530),
2589 o = n(836),
2590 i = n(12),
2591 s = n(461),
2592 c = n(848),
2593 a = n(854)
2594 const u = new Set([
2595 'AREA',
2596 'BASE',
2597 'BR',
2598 'COL',
2599 'COMMAND',
2600 'EMBED',
2601 'HR',
2602 'IMG',
2603 'INPUT',
2604 'KEYGEN',
2605 'LINK',
2606 'MENUITEM',
2607 'META',
2608 'PARAM',
2609 'SOURCE',
2610 'TRACK',
2611 'WBR'
2612 ]),
2613 l = new Set(['checked', 'selected', 'disabled', 'readonly', 'multiple'])
2614 function h(e) {
2615 return e.replace(/\n/g, 'âµ').replace(/\t/g, 'â')
2616 }
2617 const p = new Map([
2618 ['auxclick', 'mouse'],
2619 ['click', 'mouse'],
2620 ['dblclick', 'mouse'],
2621 ['mousedown', 'mouse'],
2622 ['mouseeenter', 'mouse'],
2623 ['mouseleave', 'mouse'],
2624 ['mousemove', 'mouse'],
2625 ['mouseout', 'mouse'],
2626 ['mouseover', 'mouse'],
2627 ['mouseup', 'mouse'],
2628 ['mouseleave', 'mouse'],
2629 ['mousewheel', 'mouse'],
2630 ['keydown', 'keyboard'],
2631 ['keyup', 'keyboard'],
2632 ['keypress', 'keyboard'],
2633 ['textInput', 'keyboard'],
2634 ['touchstart', 'touch'],
2635 ['touchmove', 'touch'],
2636 ['touchend', 'touch'],
2637 ['touchcancel', 'touch'],
2638 ['pointerover', 'pointer'],
2639 ['pointerout', 'pointer'],
2640 ['pointerenter', 'pointer'],
2641 ['pointerleave', 'pointer'],
2642 ['pointerdown', 'pointer'],
2643 ['pointerup', 'pointer'],
2644 ['pointermove', 'pointer'],
2645 ['pointercancel', 'pointer'],
2646 ['gotpointercapture', 'pointer'],
2647 ['lostpointercapture', 'pointer'],
2648 ['focus', 'focus'],
2649 ['blur', 'focus'],
2650 ['drag', 'drag'],
2651 ['dragstart', 'drag'],
2652 ['dragend', 'drag'],
2653 ['dragover', 'drag'],
2654 ['dragenter', 'drag'],
2655 ['dragleave', 'drag'],
2656 ['dragexit', 'drag'],
2657 ['drop', 'drag']
2658 ])
2659 function f(e) {
2660 if (!e.includes('\\')) return e
2661 const t = []
2662 let n = 0
2663 for (; n < e.length; )
2664 '\\' === e[n] && n + 1 < e.length && n++, t.push(e[n++])
2665 return t.join('')
2666 }
2667 class d {
2668 constructor(e) {
2669 ;(this._string = void 0),
2670 (this._substring = void 0),
2671 (this._regex = void 0),
2672 (this._normalizeWhiteSpace = void 0),
2673 (this._normalizeWhiteSpace = e.normalizeWhiteSpace),
2674 (this._string = e.matchSubstring
2675 ? void 0
2676 : this.normalizeWhiteSpace(e.string)),
2677 (this._substring = e.matchSubstring
2678 ? this.normalizeWhiteSpace(e.string)
2679 : void 0),
2680 (this._regex = e.regexSource
2681 ? new RegExp(e.regexSource, e.regexFlags)
2682 : void 0)
2683 }
2684 matches(e) {
2685 return (
2686 this._normalizeWhiteSpace &&
2687 !this._regex &&
2688 (e = this.normalizeWhiteSpace(e)),
2689 void 0 !== this._string
2690 ? e === this._string
2691 : void 0 !== this._substring
2692 ? e.includes(this._substring)
2693 : !!this._regex && !!this._regex.test(e)
2694 )
2695 }
2696 normalizeWhiteSpace(e) {
2697 return e && this._normalizeWhiteSpace
2698 ? e.trim().replace(/\s+/g, ' ')
2699 : e
2700 }
2701 }
2702 function m(e, t) {
2703 if (e === t) return !0
2704 if (e && t && 'object' == typeof e && 'object' == typeof t) {
2705 if (e.constructor !== t.constructor) return !1
2706 if (Array.isArray(e)) {
2707 if (e.length !== t.length) return !1
2708 for (let n = 0; n < e.length; ++n) if (!m(e[n], t[n])) return !1
2709 return !0
2710 }
2711 if (e instanceof RegExp)
2712 return e.source === t.source && e.flags === t.flags
2713 if (e.valueOf !== Object.prototype.valueOf)
2714 return e.valueOf() === t.valueOf()
2715 if (e.toString !== Object.prototype.toString)
2716 return e.toString() === t.toString()
2717 const n = Object.keys(e)
2718 if (n.length !== Object.keys(t).length) return !1
2719 for (let e = 0; e < n.length; ++e)
2720 if (!t.hasOwnProperty(n[e])) return !1
2721 for (const r of n) if (!m(e[r], t[r])) return !1
2722 return !0
2723 }
2724 return (
2725 'number' == typeof e && 'number' == typeof t && isNaN(e) && isNaN(t)
2726 )
2727 }
2728 var g = class {
2729 constructor(e, n, r) {
2730 ;(this._engines = void 0),
2731 (this._evaluator = void 0),
2732 (this._stableRafCount = void 0),
2733 (this._browserName = void 0),
2734 (this.onGlobalListenersRemoved = new Set()),
2735 (this._evaluator = new c.SelectorEvaluatorImpl(new Map())),
2736 (this._engines = new Map()),
2737 this._engines.set('xpath', t.XPathEngine),
2738 this._engines.set('xpath:light', t.XPathEngine),
2739 this._engines.set('_react', o.ReactEngine),
2740 this._engines.set('_vue', i.VueEngine),
2741 this._engines.set('text', this._createTextEngine(!0)),
2742 this._engines.set('text:light', this._createTextEngine(!1)),
2743 this._engines.set('id', this._createAttributeEngine('id', !0)),
2744 this._engines.set('id:light', this._createAttributeEngine('id', !1)),
2745 this._engines.set(
2746 'data-testid',
2747 this._createAttributeEngine('data-testid', !0)
2748 ),
2749 this._engines.set(
2750 'data-testid:light',
2751 this._createAttributeEngine('data-testid', !1)
2752 ),
2753 this._engines.set(
2754 'data-test-id',
2755 this._createAttributeEngine('data-test-id', !0)
2756 ),
2757 this._engines.set(
2758 'data-test-id:light',
2759 this._createAttributeEngine('data-test-id', !1)
2760 ),
2761 this._engines.set(
2762 'data-test',
2763 this._createAttributeEngine('data-test', !0)
2764 ),
2765 this._engines.set(
2766 'data-test:light',
2767 this._createAttributeEngine('data-test', !1)
2768 ),
2769 this._engines.set('css', this._createCSSEngine()),
2770 this._engines.set('nth', { queryAll: () => [] }),
2771 this._engines.set('visible', { queryAll: () => [] })
2772 for (const { name: e, engine: t } of r) this._engines.set(e, t)
2773 ;(this._stableRafCount = e),
2774 (this._browserName = n),
2775 this._setupGlobalListenersRemovalDetection()
2776 }
2777 eval(e) {
2778 return n.g.eval(e)
2779 }
2780 parseSelector(e) {
2781 const t = (0, s.parseSelector)(e)
2782 for (const n of t.parts)
2783 if (!this._engines.has(n.name))
2784 throw this.createStacklessError(
2785 `Unknown engine "${n.name}" while parsing selector ${e}`
2786 )
2787 return t
2788 }
2789 querySelector(e, t, n) {
2790 if (!t.querySelector)
2791 throw this.createStacklessError('Node is not queryable.')
2792 this._evaluator.begin()
2793 try {
2794 var r, o
2795 const i = this._querySelectorRecursively(
2796 [{ element: t, capture: void 0 }],
2797 e,
2798 0,
2799 new Map()
2800 )
2801 if (n && i.length > 1)
2802 throw this.strictModeViolationError(
2803 e,
2804 i.map((e) => e.element)
2805 )
2806 return (
2807 (null === (r = i[0]) || void 0 === r ? void 0 : r.capture) ||
2808 (null === (o = i[0]) || void 0 === o ? void 0 : o.element)
2809 )
2810 } finally {
2811 this._evaluator.end()
2812 }
2813 }
2814 _querySelectorRecursively(e, t, n, r) {
2815 if (n === t.parts.length) return e
2816 const o = t.parts[n]
2817 if ('nth' === o.name) {
2818 let i = []
2819 if ('0' === o.body) i = e.slice(0, 1)
2820 else if ('-1' === o.body) e.length && (i = e.slice(e.length - 1))
2821 else {
2822 if ('number' == typeof t.capture)
2823 throw this.createStacklessError(
2824 "Can't query n-th element in a request with the capture."
2825 )
2826 const n = +o.body,
2827 r = new Set()
2828 for (const t of e) r.add(t.element), n + 1 === r.size && (i = [t])
2829 }
2830 return this._querySelectorRecursively(i, t, n + 1, r)
2831 }
2832 if ('visible' === o.name) {
2833 const i = Boolean(o.body),
2834 s = e.filter((e) => i === (0, c.isVisible)(e.element))
2835 return this._querySelectorRecursively(s, t, n + 1, r)
2836 }
2837 const i = []
2838 for (const o of e) {
2839 const e = n - 1 === t.capture ? o.element : o.capture
2840 let s = r.get(o.element)
2841 s || ((s = []), r.set(o.element, s))
2842 let c = s[n]
2843 c || ((c = this._queryEngineAll(t.parts[n], o.element)), (s[n] = c))
2844 for (const t of c) {
2845 if (!('nodeName' in t))
2846 throw this.createStacklessError(
2847 `Expected a Node but got ${Object.prototype.toString.call(t)}`
2848 )
2849 i.push({ element: t, capture: e })
2850 }
2851 }
2852 return this._querySelectorRecursively(i, t, n + 1, r)
2853 }
2854 querySelectorAll(e, t) {
2855 if (!t.querySelectorAll)
2856 throw this.createStacklessError('Node is not queryable.')
2857 this._evaluator.begin()
2858 try {
2859 const n = this._querySelectorRecursively(
2860 [{ element: t, capture: void 0 }],
2861 e,
2862 0,
2863 new Map()
2864 ),
2865 r = new Set()
2866 for (const e of n) r.add(e.capture || e.element)
2867 return [...r]
2868 } finally {
2869 this._evaluator.end()
2870 }
2871 }
2872 _queryEngineAll(e, t) {
2873 return this._engines.get(e.name).queryAll(t, e.body)
2874 }
2875 _createAttributeEngine(e, t) {
2876 return {
2877 queryAll: (n, r) =>
2878 this._evaluator.query(
2879 { scope: n, pierceShadow: t },
2880 ((t) => [
2881 {
2882 simples: [
2883 {
2884 selector: {
2885 css: `[${e}=${JSON.stringify(t)}]`,
2886 functions: []
2887 },
2888 combinator: ''
2889 }
2890 ]
2891 }
2892 ])(r)
2893 )
2894 }
2895 }
2896 _createCSSEngine() {
2897 const e = this._evaluator
2898 return {
2899 queryAll: (t, n) => e.query({ scope: t, pierceShadow: !0 }, n)
2900 }
2901 }
2902 _createTextEngine(e) {
2903 const t = (t, n) => {
2904 const { matcher: r, kind: o } = (function (e) {
2905 if ('/' === e[0] && e.lastIndexOf('/') > 0) {
2906 const t = e.lastIndexOf('/')
2907 return {
2908 matcher: (0, c.createRegexTextMatcher)(
2909 e.substring(1, t),
2910 e.substring(t + 1)
2911 ),
2912 kind: 'regex'
2913 }
2914 }
2915 let t = !1
2916 return (
2917 e.length > 1 &&
2918 '"' === e[0] &&
2919 '"' === e[e.length - 1] &&
2920 ((e = f(e.substring(1, e.length - 1))), (t = !0)),
2921 e.length > 1 &&
2922 "'" === e[0] &&
2923 "'" === e[e.length - 1] &&
2924 ((e = f(e.substring(1, e.length - 1))), (t = !0)),
2925 {
2926 matcher: t
2927 ? (0, c.createStrictTextMatcher)(e)
2928 : (0, c.createLaxTextMatcher)(e),
2929 kind: t ? 'strict' : 'lax'
2930 }
2931 )
2932 })(n),
2933 i = []
2934 let s = null
2935 const a = (e) => {
2936 if ('lax' === o && s && s.contains(e)) return !1
2937 const t = (0, c.elementMatchesText)(this._evaluator, e, r)
2938 'none' === t && (s = e),
2939 ('self' === t || ('selfAndChildren' === t && 'strict' === o)) &&
2940 i.push(e)
2941 }
2942 t.nodeType === Node.ELEMENT_NODE && a(t)
2943 const u = this._evaluator._queryCSS(
2944 { scope: t, pierceShadow: e },
2945 '*'
2946 )
2947 for (const e of u) a(e)
2948 return i
2949 }
2950 return { queryAll: (e, n) => t(e, n) }
2951 }
2952 extend(e, t) {
2953 return new (n.g.eval(
2954 `\n (() => {\n ${e}\n return pwExport;\n })()`
2955 ))(this, t)
2956 }
2957 isVisible(e) {
2958 return (0, c.isVisible)(e)
2959 }
2960 pollRaf(e) {
2961 return this.poll(e, (e) => requestAnimationFrame(e))
2962 }
2963 pollInterval(e, t) {
2964 return this.poll(t, (t) => setTimeout(t, e))
2965 }
2966 pollLogScale(e) {
2967 const t = [100, 250, 500]
2968 let n = 0
2969 return this.poll(e, (e) => setTimeout(e, t[n++] || 1e3))
2970 }
2971 poll(e, t) {
2972 return this._runAbortableTask((n) => {
2973 let r, o
2974 const i = new Promise((e, t) => {
2975 ;(r = e), (o = t)
2976 }),
2977 s = () => {
2978 if (!n.aborted)
2979 try {
2980 const o = e(n)
2981 o !== n.continuePolling ? r(o) : t(s)
2982 } catch (e) {
2983 n.log(' ' + e.message), o(e)
2984 }
2985 }
2986 return s(), i
2987 })
2988 }
2989 _runAbortableTask(e) {
2990 let t,
2991 n = [],
2992 r = !1
2993 const o = () => {
2994 t && (t(n), (n = []), (t = void 0))
2995 }
2996 let i,
2997 s = ''
2998 const c = {
2999 injectedScript: this,
3000 aborted: !1,
3001 continuePolling: Symbol('continuePolling'),
3002 log: (e) => {
3003 ;(s = e), n.push({ message: e }), o()
3004 },
3005 logRepeating: (e) => {
3006 e !== s && c.log(e)
3007 },
3008 setIntermediateResult: (e) => {
3009 i !== e && ((i = e), n.push({ intermediateResult: e }), o())
3010 }
3011 }
3012 return {
3013 takeNextLogs: () =>
3014 new Promise((e) => {
3015 ;(t = e), (n.length || r) && o()
3016 }),
3017 run: () => {
3018 const t = e(c)
3019 return (
3020 t.finally(() => {
3021 ;(r = !0), o()
3022 }),
3023 t
3024 )
3025 },
3026 cancel: () => {
3027 c.aborted = !0
3028 },
3029 takeLastLogs: () => n
3030 }
3031 }
3032 getElementBorderWidth(e) {
3033 if (
3034 e.nodeType !== Node.ELEMENT_NODE ||
3035 !e.ownerDocument ||
3036 !e.ownerDocument.defaultView
3037 )
3038 return { left: 0, top: 0 }
3039 const t = e.ownerDocument.defaultView.getComputedStyle(e)
3040 return {
3041 left: parseInt(t.borderLeftWidth || '', 10),
3042 top: parseInt(t.borderTopWidth || '', 10)
3043 }
3044 }
3045 retarget(e, t) {
3046 let n = e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement
3047 return n
3048 ? (n.matches('input, textarea, select') ||
3049 (n =
3050 n.closest(
3051 'button, [role=button], [role=checkbox], [role=radio]'
3052 ) || n),
3053 'follow-label' === t &&
3054 (n.matches(
3055 'input, textarea, button, select, [role=button], [role=checkbox], [role=radio]'
3056 ) ||
3057 n.isContentEditable ||
3058 (n = n.closest('label') || n),
3059 'LABEL' === n.nodeName && (n = n.control || n)),
3060 n)
3061 : null
3062 }
3063 waitForElementStatesAndPerformAction(e, t, n, r) {
3064 let o,
3065 i = 0,
3066 s = 0,
3067 c = 0
3068 return this.pollRaf((a) => {
3069 if (n) return a.log(' forcing action'), r(e, a)
3070 for (const n of t) {
3071 if ('stable' !== n) {
3072 const t = this.elementState(e, n)
3073 if ('boolean' != typeof t) return t
3074 if (!t)
3075 return (
3076 a.logRepeating(` element is not ${n} - waiting...`),
3077 a.continuePolling
3078 )
3079 continue
3080 }
3081 const t = this.retarget(e, 'no-follow-label')
3082 if (!t) return 'error:notconnected'
3083 if (1 == ++i) return a.continuePolling
3084 const r = performance.now()
3085 if (this._stableRafCount > 1 && r - c < 15) return a.continuePolling
3086 c = r
3087 const u = t.getBoundingClientRect(),
3088 l = { x: u.top, y: u.left, width: u.width, height: u.height }
3089 o &&
3090 l.x === o.x &&
3091 l.y === o.y &&
3092 l.width === o.width &&
3093 l.height === o.height
3094 ? ++s
3095 : (s = 0)
3096 const h = s >= this._stableRafCount,
3097 p = h || !o
3098 if (
3099 ((o = l),
3100 p || a.logRepeating(' element is not stable - waiting...'),
3101 !h)
3102 )
3103 return a.continuePolling
3104 }
3105 return r(e, a)
3106 })
3107 }
3108 elementState(e, t) {
3109 const n = this.retarget(
3110 e,
3111 ['stable', 'visible', 'hidden'].includes(t)
3112 ? 'no-follow-label'
3113 : 'follow-label'
3114 )
3115 if (!n || !n.isConnected) return 'hidden' === t || 'error:notconnected'
3116 if ('visible' === t) return this.isVisible(n)
3117 if ('hidden' === t) return !this.isVisible(n)
3118 const r =
3119 ['BUTTON', 'INPUT', 'SELECT', 'TEXTAREA'].includes(n.nodeName) &&
3120 n.hasAttribute('disabled')
3121 if ('disabled' === t) return r
3122 if ('enabled' === t) return !r
3123 const o = !(
3124 ['INPUT', 'TEXTAREA', 'SELECT'].includes(n.nodeName) &&
3125 n.hasAttribute('readonly')
3126 )
3127 if ('editable' === t) return !r && o
3128 if ('checked' === t) {
3129 if (['checkbox', 'radio'].includes(n.getAttribute('role') || ''))
3130 return 'true' === n.getAttribute('aria-checked')
3131 if ('INPUT' !== n.nodeName)
3132 throw this.createStacklessError('Not a checkbox or radio button')
3133 if (!['radio', 'checkbox'].includes(n.type.toLowerCase()))
3134 throw this.createStacklessError('Not a checkbox or radio button')
3135 return n.checked
3136 }
3137 throw this.createStacklessError(`Unexpected element state "${t}"`)
3138 }
3139 selectOptions(e, t, n) {
3140 const r = this.retarget(t, 'follow-label')
3141 if (!r) return 'error:notconnected'
3142 if ('select' !== r.nodeName.toLowerCase())
3143 throw this.createStacklessError('Element is not a <select> element')
3144 const o = r,
3145 i = [...o.options],
3146 s = []
3147 let c = e.slice()
3148 for (let e = 0; e < i.length; e++) {
3149 const t = i[e],
3150 n = (n) => {
3151 if (n instanceof Node) return t === n
3152 let r = !0
3153 return (
3154 void 0 !== n.value && (r = r && n.value === t.value),
3155 void 0 !== n.label && (r = r && n.label === t.label),
3156 void 0 !== n.index && (r = r && n.index === e),
3157 r
3158 )
3159 }
3160 if (c.some(n)) {
3161 if ((s.push(t), !o.multiple)) {
3162 c = []
3163 break
3164 }
3165 c = c.filter((e) => !n(e))
3166 }
3167 }
3168 return c.length
3169 ? (n.logRepeating(' did not find some options - waiting... '),
3170 n.continuePolling)
3171 : ((o.value = void 0),
3172 s.forEach((e) => (e.selected = !0)),
3173 n.log(' selected specified option(s)'),
3174 o.dispatchEvent(new Event('input', { bubbles: !0 })),
3175 o.dispatchEvent(new Event('change', { bubbles: !0 })),
3176 s.map((e) => e.value))
3177 }
3178 fill(e, t, n) {
3179 const r = this.retarget(t, 'follow-label')
3180 if (!r) return 'error:notconnected'
3181 if ('input' === r.nodeName.toLowerCase()) {
3182 const t = r,
3183 o = t.type.toLowerCase(),
3184 i = new Set([
3185 'date',
3186 'time',
3187 'datetime',
3188 'datetime-local',
3189 'month',
3190 'week'
3191 ])
3192 if (
3193 !new Set([
3194 '',
3195 'email',
3196 'number',
3197 'password',
3198 'search',
3199 'tel',
3200 'text',
3201 'url'
3202 ]).has(o) &&
3203 !i.has(o)
3204 )
3205 throw (
3206 (n.log(` input of type "${o}" cannot be filled`),
3207 this.createStacklessError(
3208 `Input of type "${o}" cannot be filled`
3209 ))
3210 )
3211 if ('number' === o && ((e = e.trim()), isNaN(Number(e))))
3212 throw this.createStacklessError(
3213 'Cannot type text into input[type=number]'
3214 )
3215 if (i.has(o)) {
3216 if (((e = e.trim()), t.focus(), (t.value = e), t.value !== e))
3217 throw this.createStacklessError('Malformed value')
3218 return (
3219 r.dispatchEvent(new Event('input', { bubbles: !0 })),
3220 r.dispatchEvent(new Event('change', { bubbles: !0 })),
3221 'done'
3222 )
3223 }
3224 } else if ('textarea' === r.nodeName.toLowerCase());
3225 else if (!r.isContentEditable)
3226 throw this.createStacklessError(
3227 'Element is not an <input>, <textarea> or [contenteditable] element'
3228 )