playwriter 0.0.16 → 0.0.21
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.
- package/dist/cdp-session.d.ts +21 -0
- package/dist/cdp-session.d.ts.map +1 -0
- package/dist/cdp-session.js +131 -0
- package/dist/cdp-session.js.map +1 -0
- package/dist/cdp-types.d.ts +15 -0
- package/dist/cdp-types.d.ts.map +1 -1
- package/dist/cdp-types.js.map +1 -1
- package/dist/create-logger.d.ts +9 -0
- package/dist/create-logger.d.ts.map +1 -0
- package/dist/create-logger.js +43 -0
- package/dist/create-logger.js.map +1 -0
- package/dist/extension/cdp-relay.d.ts +7 -3
- package/dist/extension/cdp-relay.d.ts.map +1 -1
- package/dist/extension/cdp-relay.js +22 -12
- package/dist/extension/cdp-relay.js.map +1 -1
- package/dist/mcp.js +86 -44
- package/dist/mcp.js.map +1 -1
- package/dist/mcp.test.d.ts.map +1 -1
- package/dist/mcp.test.js +669 -183
- package/dist/mcp.test.js.map +1 -1
- package/dist/prompt.md +38 -8
- package/dist/selector-generator.js +331 -0
- package/dist/start-relay-server.d.ts +1 -3
- package/dist/start-relay-server.d.ts.map +1 -1
- package/dist/start-relay-server.js +3 -16
- package/dist/start-relay-server.js.map +1 -1
- package/dist/utils.d.ts +3 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +36 -0
- package/dist/utils.js.map +1 -1
- package/dist/wait-for-page-load.d.ts +16 -0
- package/dist/wait-for-page-load.d.ts.map +1 -0
- package/dist/wait-for-page-load.js +126 -0
- package/dist/wait-for-page-load.js.map +1 -0
- package/package.json +16 -12
- package/src/cdp-session.ts +156 -0
- package/src/cdp-types.ts +6 -0
- package/src/create-logger.ts +56 -0
- package/src/debugger.md +453 -0
- package/src/extension/cdp-relay.ts +32 -14
- package/src/mcp.test.ts +795 -189
- package/src/mcp.ts +101 -47
- package/src/prompt.md +38 -8
- package/src/snapshots/shadcn-ui-accessibility.md +94 -91
- package/src/start-relay-server.ts +3 -20
- package/src/utils.ts +45 -0
- package/src/wait-for-page-load.ts +173 -0
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
(function() {
|
|
2
|
+
/* esm.sh - @mizchi/selector-generator@1.50.0-next */
|
|
3
|
+
var _n=Object.create,zt=Object.defineProperty,yn=Object.getOwnPropertyDescriptor,Jt=Object.getOwnPropertyNames,An=Object.getPrototypeOf,kn=Object.prototype.hasOwnProperty,Nn=(e,t)=>function(){return t||(0,e[Jt(e)[0]])((t={exports:{}}).exports,t),t.exports},Cn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Jt(t))!kn.call(e,i)&&i!==r&&zt(e,i,{get:()=>t[i],enumerable:!(n=yn(t,i))||n.enumerable});return e},Ln=(e,t,r)=>(r=e!=null?_n(An(e)):{},Cn(t||!e||!e.__esModule?zt(r,"default",{value:e,enumerable:!0}):r,e)),$n=Nn({"playwright-src/packages/playwright-core/src/server/injected/highlight.css?inline"(){"use strict";(function(){if(!document.getElementById("d921f4ee0d8a705d02fc2c09907b7f4af8c077650d515e9a18c9a8043a5c66a0")){var e=document.createElement("style");e.id="d921f4ee0d8a705d02fc2c09907b7f4af8c077650d515e9a18c9a8043a5c66a0",e.textContent=`/**
|
|
4
|
+
* Copyright (c) Microsoft Corporation.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
:host {
|
|
20
|
+
font-size: 13px;
|
|
21
|
+
font-family: system-ui, "Ubuntu", "Droid Sans", sans-serif;
|
|
22
|
+
color: #333;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
svg {
|
|
26
|
+
position: absolute;
|
|
27
|
+
height: 0;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
x-pw-tooltip {
|
|
31
|
+
backdrop-filter: blur(5px);
|
|
32
|
+
background-color: white;
|
|
33
|
+
border-radius: 6px;
|
|
34
|
+
box-shadow: 0 0.5rem 1.2rem rgba(0,0,0,.3);
|
|
35
|
+
display: none;
|
|
36
|
+
font-size: 12.8px;
|
|
37
|
+
font-weight: normal;
|
|
38
|
+
left: 0;
|
|
39
|
+
line-height: 1.5;
|
|
40
|
+
max-width: 600px;
|
|
41
|
+
position: absolute;
|
|
42
|
+
top: 0;
|
|
43
|
+
padding: 0;
|
|
44
|
+
flex-direction: column;
|
|
45
|
+
overflow: hidden;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
x-pw-tooltip-line {
|
|
49
|
+
display: flex;
|
|
50
|
+
max-width: 600px;
|
|
51
|
+
padding: 6px;
|
|
52
|
+
user-select: none;
|
|
53
|
+
cursor: pointer;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
x-pw-tooltip-line.selectable:hover {
|
|
57
|
+
background-color: hsl(0, 0%, 95%);
|
|
58
|
+
overflow: hidden;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
x-pw-tooltip-footer {
|
|
62
|
+
display: flex;
|
|
63
|
+
max-width: 600px;
|
|
64
|
+
padding: 6px;
|
|
65
|
+
user-select: none;
|
|
66
|
+
color: #777;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
x-pw-dialog {
|
|
70
|
+
background-color: white;
|
|
71
|
+
pointer-events: auto;
|
|
72
|
+
border-radius: 6px;
|
|
73
|
+
box-shadow: 0 0.5rem 1.2rem rgba(0,0,0,.3);
|
|
74
|
+
display: flex;
|
|
75
|
+
flex-direction: column;
|
|
76
|
+
position: absolute;
|
|
77
|
+
width: 400px;
|
|
78
|
+
height: 150px;
|
|
79
|
+
z-index: 10;
|
|
80
|
+
font-size: 13px;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
x-pw-dialog-body {
|
|
84
|
+
display: flex;
|
|
85
|
+
flex-direction: column;
|
|
86
|
+
flex: auto;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
x-pw-dialog-body label {
|
|
90
|
+
margin: 5px 8px;
|
|
91
|
+
display: flex;
|
|
92
|
+
flex-direction: row;
|
|
93
|
+
align-items: center;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
x-pw-highlight {
|
|
97
|
+
position: absolute;
|
|
98
|
+
top: 0;
|
|
99
|
+
left: 0;
|
|
100
|
+
width: 0;
|
|
101
|
+
height: 0;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
x-pw-action-point {
|
|
105
|
+
position: absolute;
|
|
106
|
+
width: 20px;
|
|
107
|
+
height: 20px;
|
|
108
|
+
background: red;
|
|
109
|
+
border-radius: 10px;
|
|
110
|
+
margin: -10px 0 0 -10px;
|
|
111
|
+
z-index: 2;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
x-pw-separator {
|
|
115
|
+
height: 1px;
|
|
116
|
+
margin: 6px 9px;
|
|
117
|
+
background: rgb(148 148 148 / 90%);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
x-pw-tool-gripper {
|
|
121
|
+
height: 28px;
|
|
122
|
+
width: 24px;
|
|
123
|
+
margin: 2px 0;
|
|
124
|
+
cursor: grab;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
x-pw-tool-gripper:active {
|
|
128
|
+
cursor: grabbing;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
x-pw-tool-gripper > x-div {
|
|
132
|
+
width: 16px;
|
|
133
|
+
height: 16px;
|
|
134
|
+
margin: 6px 4px;
|
|
135
|
+
clip-path: url(#icon-gripper);
|
|
136
|
+
background-color: #555555;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
x-pw-tools-list > label {
|
|
140
|
+
display: flex;
|
|
141
|
+
align-items: center;
|
|
142
|
+
margin: 0 10px;
|
|
143
|
+
user-select: none;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
x-pw-tools-list {
|
|
147
|
+
display: flex;
|
|
148
|
+
width: 100%;
|
|
149
|
+
border-bottom: 1px solid #dddddd;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
x-pw-tool-item {
|
|
153
|
+
pointer-events: auto;
|
|
154
|
+
cursor: pointer;
|
|
155
|
+
height: 28px;
|
|
156
|
+
width: 28px;
|
|
157
|
+
border-radius: 3px;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
x-pw-tool-item:not(.disabled):hover {
|
|
161
|
+
background-color: hsl(0, 0%, 86%);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
x-pw-tool-item.active {
|
|
165
|
+
background-color: rgba(138, 202, 228, 0.5);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
x-pw-tool-item.active:not(.disabled):hover {
|
|
169
|
+
background-color: #8acae4c4;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
x-pw-tool-item > x-div {
|
|
173
|
+
width: 16px;
|
|
174
|
+
height: 16px;
|
|
175
|
+
margin: 6px;
|
|
176
|
+
background-color: #3a3a3a;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
x-pw-tool-item.disabled > x-div {
|
|
180
|
+
background-color: rgba(97, 97, 97, 0.5);
|
|
181
|
+
cursor: default;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
x-pw-tool-item.record.active {
|
|
185
|
+
background-color: transparent;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
x-pw-tool-item.record.active:hover {
|
|
189
|
+
background-color: hsl(0, 0%, 86%);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
x-pw-tool-item.record.active > x-div {
|
|
193
|
+
background-color: #a1260d;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
x-pw-tool-item.accept > x-div {
|
|
197
|
+
background-color: #388a34;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
x-pw-tool-item.record > x-div {
|
|
201
|
+
/* codicon: circle-large-filled */
|
|
202
|
+
clip-path: url(#icon-circle-large-filled);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
x-pw-tool-item.pick-locator > x-div {
|
|
206
|
+
/* codicon: inspect */
|
|
207
|
+
clip-path: url(#icon-inspect);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
x-pw-tool-item.text > x-div {
|
|
211
|
+
/* codicon: whole-word */
|
|
212
|
+
clip-path: url(#icon-whole-word);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
x-pw-tool-item.visibility > x-div {
|
|
216
|
+
/* codicon: eye */
|
|
217
|
+
clip-path: url(#icon-eye);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
x-pw-tool-item.value > x-div {
|
|
221
|
+
/* codicon: symbol-constant */
|
|
222
|
+
clip-path: url(#icon-symbol-constant);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
x-pw-tool-item.snapshot > x-div {
|
|
226
|
+
/* codicon: eye */
|
|
227
|
+
clip-path: url(#icon-gist);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
x-pw-tool-item.accept > x-div {
|
|
231
|
+
clip-path: url(#icon-check);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
x-pw-tool-item.cancel > x-div {
|
|
235
|
+
clip-path: url(#icon-close);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
x-pw-tool-item.succeeded > x-div {
|
|
239
|
+
/* codicon: pass */
|
|
240
|
+
clip-path: url(#icon-pass);
|
|
241
|
+
background-color: #388a34 !important;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
x-pw-overlay {
|
|
245
|
+
position: absolute;
|
|
246
|
+
top: 0;
|
|
247
|
+
max-width: min-content;
|
|
248
|
+
z-index: 2147483647;
|
|
249
|
+
background: transparent;
|
|
250
|
+
pointer-events: auto;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
x-pw-overlay x-pw-tools-list {
|
|
254
|
+
background-color: #ffffffdd;
|
|
255
|
+
box-shadow: rgba(0, 0, 0, 0.1) 0px 5px 5px;
|
|
256
|
+
border-radius: 3px;
|
|
257
|
+
border-bottom: none;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
x-pw-overlay x-pw-tool-item {
|
|
261
|
+
margin: 2px;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
textarea.text-editor {
|
|
265
|
+
font-family: system-ui,Ubuntu,Droid Sans,sans-serif;
|
|
266
|
+
flex: auto;
|
|
267
|
+
border: none;
|
|
268
|
+
margin: 6px 10px;
|
|
269
|
+
color: #333;
|
|
270
|
+
outline: 1px solid transparent!important;
|
|
271
|
+
resize: none;
|
|
272
|
+
padding: 0;
|
|
273
|
+
font-size: 13px;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
textarea.text-editor.does-not-match {
|
|
277
|
+
outline: 1px solid red !important;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
x-div {
|
|
281
|
+
display: block;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
x-spacer {
|
|
285
|
+
flex: auto;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
* {
|
|
289
|
+
box-sizing: border-box;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
*[hidden] {
|
|
293
|
+
display: none !important;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
x-locator-editor {
|
|
297
|
+
flex: none;
|
|
298
|
+
width: 100%;
|
|
299
|
+
height: 60px;
|
|
300
|
+
padding: 4px;
|
|
301
|
+
border-bottom: 1px solid #dddddd;
|
|
302
|
+
outline: 1px solid transparent;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
x-locator-editor.does-not-match {
|
|
306
|
+
outline: 1px solid red;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
.CodeMirror {
|
|
310
|
+
width: 100% !important;
|
|
311
|
+
height: 100% !important;
|
|
312
|
+
}
|
|
313
|
+
`,document.head.appendChild(e)}})()}}),Ct={queryAll(e,t){t.startsWith("/")&&e.nodeType!==Node.DOCUMENT_NODE&&(t="."+t);let r=[],n=e.ownerDocument||e;if(!n)return r;let i=n.evaluate(t,e,null,XPathResult.ORDERED_NODE_ITERATOR_TYPE);for(let s=i.iterateNext();s;s=i.iterateNext())s.nodeType===Node.ELEMENT_NODE&&r.push(s);return r}},Qt="";function In(e){Qt=e}function je(e,t){for(;t;){if(e.contains(t))return!0;t=Xt(t)}return!1}function $(e){if(e.parentElement)return e.parentElement;if(e.parentNode&&e.parentNode.nodeType===11&&e.parentNode.host)return e.parentNode.host}function Kt(e){let t=e;for(;t.parentNode;)t=t.parentNode;if(t.nodeType===11||t.nodeType===9)return t}function Xt(e){for(;e.parentElement;)e=e.parentElement;return $(e)}function ge(e,t,r){for(;e;){let n=e.closest(t);if(r&&n!==r&&n?.contains(r))return;if(n)return n;e=Xt(e)}}function Q(e,t){return e.ownerDocument&&e.ownerDocument.defaultView?e.ownerDocument.defaultView.getComputedStyle(e,t):void 0}function Yt(e,t){if(t=t??Q(e),!t)return!0;if(Element.prototype.checkVisibility&&Qt!=="webkit"){if(!e.checkVisibility())return!1}else{let r=e.closest("details,summary");if(r!==e&&r?.nodeName==="DETAILS"&&!r.open)return!1}return t.visibility==="visible"}function J(e){let t=Q(e);if(!t)return!0;if(t.display==="contents"){for(let n=e.firstChild;n;n=n.nextSibling)if(n.nodeType===1&&J(n)||n.nodeType===3&&Zt(n))return!0;return!1}if(!Yt(e,t))return!1;let r=e.getBoundingClientRect();return r.width>0&&r.height>0}function Zt(e){let t=e.ownerDocument.createRange();t.selectNode(e);let r=t.getBoundingClientRect();return r.width>0&&r.height>0}function C(e){return e instanceof HTMLFormElement?"FORM":e.tagName.toUpperCase()}function we(e,t="'"){let r=JSON.stringify(e),n=r.substring(1,r.length-1).replace(/\\"/g,'"');if(t==="'")return t+n.replace(/[']/g,"\\'")+t;if(t==='"')return t+n.replace(/["]/g,'\\"')+t;if(t==="`")return t+n.replace(/[`]/g,"`")+t;throw new Error("Invalid escape char")}function He(e){return e.charAt(0).toUpperCase()+e.substring(1)}function er(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/([A-Z])([A-Z][a-z])/g,"$1_$2").toLowerCase()}function H(e){let t="";for(let r=0;r<e.length;r++)t+=Rn(e,r);return t}function ue(e){return`"${H(e).replace(/\\ /g," ")}"`}function Rn(e,t){let r=e.charCodeAt(t);return r===0?"\uFFFD":r>=1&&r<=31||r>=48&&r<=57&&(t===0||t===1&&e.charCodeAt(0)===45)?"\\"+r.toString(16)+" ":t===0&&r===45&&e.length===1?"\\"+e.charAt(t):r>=128||r===45||r===95||r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122?e.charAt(t):"\\"+e.charAt(t)}var rt;function On(){rt=new Map}function D(e){let t=rt?.get(e);return t===void 0&&(t=e.replace(/\u200b/g,"").trim().replace(/\s+/g," "),rt?.set(e,t)),t}function xe(e){return e.replace(/(^|[^\\])(\\\\)*\\(['"`])/g,"$1$2$3")}function tr(e){return e.unicode||e.unicodeSets?String(e):String(e).replace(/(^|[^\\])(\\\\)*(["'`])/g,"$1$2\\$3").replace(/>>/g,"\\>\\>")}function ie(e,t){return typeof e!="string"?tr(e):`${JSON.stringify(e)}${t?"s":"i"}`}function V(e,t){return typeof e!="string"?tr(e):`"${e.replace(/\\/g,"\\\\").replace(/["]/g,'\\"')}"${t?"s":"i"}`}function Pn(e,t,r=""){if(e.length<=t)return e;let n=[...e];return n.length>t?n.slice(0,t-r.length).join("")+r:n.join("")}function Lt(e,t){return Pn(e,t,"\u2026")}function nt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function qn(e,t){let r=e.length,n=t.length,i=0,s=0,o=Array(r+1).fill(null).map(()=>Array(n+1).fill(0));for(let c=1;c<=r;c++)for(let a=1;a<=n;a++)e[c-1]===t[a-1]&&(o[c][a]=o[c-1][a-1]+1,o[c][a]>i&&(i=o[c][a],s=c));return e.slice(s-i,s)}function $t(e){return e.hasAttribute("aria-label")||e.hasAttribute("aria-labelledby")}var It="article:not([role]), aside:not([role]), main:not([role]), nav:not([role]), section:not([role]), [role=article], [role=complementary], [role=main], [role=navigation], [role=region]",Mn=new Map([["aria-atomic",void 0],["aria-busy",void 0],["aria-controls",void 0],["aria-current",void 0],["aria-describedby",void 0],["aria-details",void 0],["aria-dropeffect",void 0],["aria-flowto",void 0],["aria-grabbed",void 0],["aria-hidden",void 0],["aria-keyshortcuts",void 0],["aria-label",new Set(["caption","code","deletion","emphasis","generic","insertion","paragraph","presentation","strong","subscript","superscript"])],["aria-labelledby",new Set(["caption","code","deletion","emphasis","generic","insertion","paragraph","presentation","strong","subscript","superscript"])],["aria-live",void 0],["aria-owns",void 0],["aria-relevant",void 0],["aria-roledescription",new Set(["generic"])]]);function rr(e,t){return[...Mn].some(([r,n])=>!n?.has(t||"")&&e.hasAttribute(r))}function nr(e){return!Number.isNaN(Number(String(e.getAttribute("tabindex"))))}function Dn(e){return!mr(e)&&(Hn(e)||nr(e))}function Hn(e){let t=C(e);return["BUTTON","DETAILS","SELECT","TEXTAREA"].includes(t)?!0:t==="A"||t==="AREA"?e.hasAttribute("href"):t==="INPUT"?!e.hidden:!1}var Fn={A:e=>e.hasAttribute("href")?"link":null,AREA:e=>e.hasAttribute("href")?"link":null,ARTICLE:()=>"article",ASIDE:()=>"complementary",BLOCKQUOTE:()=>"blockquote",BUTTON:()=>"button",CAPTION:()=>"caption",CODE:()=>"code",DATALIST:()=>"listbox",DD:()=>"definition",DEL:()=>"deletion",DETAILS:()=>"group",DFN:()=>"term",DIALOG:()=>"dialog",DT:()=>"term",EM:()=>"emphasis",FIELDSET:()=>"group",FIGURE:()=>"figure",FOOTER:e=>ge(e,It)?null:"contentinfo",FORM:e=>$t(e)?"form":null,H1:()=>"heading",H2:()=>"heading",H3:()=>"heading",H4:()=>"heading",H5:()=>"heading",H6:()=>"heading",HEADER:e=>ge(e,It)?null:"banner",HR:()=>"separator",HTML:()=>"document",IMG:e=>e.getAttribute("alt")===""&&!e.getAttribute("title")&&!rr(e)&&!nr(e)?"presentation":"img",INPUT:e=>{let t=e.type.toLowerCase();if(t==="search")return e.hasAttribute("list")?"combobox":"searchbox";if(["email","tel","text","url",""].includes(t)){let r=ve(e,e.getAttribute("list"))[0];return r&&C(r)==="DATALIST"?"combobox":"textbox"}return t==="hidden"?null:Gn[t]||"textbox"},INS:()=>"insertion",LI:()=>"listitem",MAIN:()=>"main",MARK:()=>"mark",MATH:()=>"math",MENU:()=>"list",METER:()=>"meter",NAV:()=>"navigation",OL:()=>"list",OPTGROUP:()=>"group",OPTION:()=>"option",OUTPUT:()=>"status",P:()=>"paragraph",PROGRESS:()=>"progressbar",SECTION:e=>$t(e)?"region":null,SELECT:e=>e.hasAttribute("multiple")||e.size>1?"listbox":"combobox",STRONG:()=>"strong",SUB:()=>"subscript",SUP:()=>"superscript",SVG:()=>"img",TABLE:()=>"table",TBODY:()=>"rowgroup",TD:e=>{let t=ge(e,"table"),r=t?Fe(t):"";return r==="grid"||r==="treegrid"?"gridcell":"cell"},TEXTAREA:()=>"textbox",TFOOT:()=>"rowgroup",TH:e=>{if(e.getAttribute("scope")==="col")return"columnheader";if(e.getAttribute("scope")==="row")return"rowheader";let t=ge(e,"table"),r=t?Fe(t):"";return r==="grid"||r==="treegrid"?"gridcell":"cell"},THEAD:()=>"rowgroup",TIME:()=>"time",TR:()=>"row",UL:()=>"list"},Bn={DD:["DL","DIV"],DIV:["DL"],DT:["DL","DIV"],LI:["OL","UL"],TBODY:["TABLE"],TD:["TR"],TFOOT:["TABLE"],TH:["TR"],THEAD:["TABLE"],TR:["THEAD","TBODY","TFOOT","TABLE"]};function Rt(e){let t=Fn[C(e)]?.(e)||"";if(!t)return null;let r=e;for(;r;){let n=$(r),i=Bn[C(r)];if(!i||!n||!i.includes(C(n)))break;let s=Fe(n);if((s==="none"||s==="presentation")&&!ir(n,s))return s;r=n}return t}var Wn=["alert","alertdialog","application","article","banner","blockquote","button","caption","cell","checkbox","code","columnheader","combobox","complementary","contentinfo","definition","deletion","dialog","directory","document","emphasis","feed","figure","form","generic","grid","gridcell","group","heading","img","insertion","link","list","listbox","listitem","log","main","mark","marquee","math","meter","menu","menubar","menuitem","menuitemcheckbox","menuitemradio","navigation","none","note","option","paragraph","presentation","progressbar","radio","radiogroup","region","row","rowgroup","rowheader","scrollbar","search","searchbox","separator","slider","spinbutton","status","strong","subscript","superscript","switch","tab","table","tablist","tabpanel","term","textbox","time","timer","toolbar","tooltip","tree","treegrid","treeitem"];function Fe(e){return(e.getAttribute("role")||"").split(" ").map(r=>r.trim()).find(r=>Wn.includes(r))||null}function ir(e,t){return rr(e,t)||Dn(e)}function L(e){let t=Fe(e);if(!t)return Rt(e);if(t==="none"||t==="presentation"){let r=Rt(e);if(ir(e,r))return r}return t}function sr(e){return e===null?void 0:e.toLowerCase()==="true"}function or(e){return["STYLE","SCRIPT","NOSCRIPT","TEMPLATE"].includes(C(e))}function F(e){if(or(e))return!0;let t=Q(e),r=e.nodeName==="SLOT";if(t?.display==="contents"&&!r){for(let i=e.firstChild;i;i=i.nextSibling)if(i.nodeType===1&&!F(i)||i.nodeType===3&&Zt(i))return!1;return!0}return!(e.nodeName==="OPTION"&&!!e.closest("select"))&&!r&&!Yt(e,t)?!0:ar(e)}function ar(e){let t=We?.get(e);if(t===void 0){if(t=!1,e.parentElement&&e.parentElement.shadowRoot&&!e.assignedSlot&&(t=!0),!t){let r=Q(e);t=!r||r.display==="none"||sr(e.getAttribute("aria-hidden"))===!0}if(!t){let r=$(e);r&&(t=ar(r))}We?.set(e,t)}return t}function ve(e,t){if(!t)return[];let r=Kt(e);if(!r)return[];try{let n=t.split(" ").filter(s=>!!s),i=new Set;for(let s of n){let o=r.querySelector("#"+CSS.escape(s));o&&i.add(o)}return[...i]}catch{return[]}}function U(e){return e.trim()}function Ie(e){return e.split("\xA0").map(t=>t.replace(/\r\n/g,`
|
|
314
|
+
`).replace(/\s\s*/g," ")).join("\xA0").trim()}function Ot(e,t){let r=[...e.querySelectorAll(t)];for(let n of ve(e,e.getAttribute("aria-owns")))n.matches(t)&&r.push(n),r.push(...n.querySelectorAll(t));return r}function Be(e,t){let r=t==="::before"?St:Tt;if(r?.has(e))return r?.get(e)||"";let n=Q(e,t),i=Un(n);return r&&r.set(e,i),i}function Un(e){if(!e||e.display==="none"||e.visibility==="hidden")return"";let t=e.content;if(t[0]==="'"&&t[t.length-1]==="'"||t[0]==='"'&&t[t.length-1]==='"'){let r=t.substring(1,t.length-1);return(e.display||"inline")!=="inline"?" "+r+" ":r}return""}function cr(e){let t=e.getAttribute("aria-labelledby");if(t===null)return null;let r=ve(e,t);return r.length?r:null}function jn(e,t){let r=["button","cell","checkbox","columnheader","gridcell","heading","link","menuitem","menuitemcheckbox","menuitemradio","option","radio","row","rowheader","switch","tab","tooltip","treeitem"].includes(e),n=t&&["","caption","code","contentinfo","definition","deletion","emphasis","insertion","list","listitem","mark","none","paragraph","presentation","region","row","rowgroup","section","strong","subscript","superscript","table","term","time"].includes(e);return r||n}function oe(e,t){let r=t?xt:wt,n=r?.get(e);return n===void 0&&(n="",["caption","code","definition","deletion","emphasis","generic","insertion","mark","paragraph","presentation","strong","subscript","suggestion","superscript","term","time"].includes(L(e)||"")||(n=Ie(B(e,{includeHidden:t,visitedElements:new Set,embeddedInTargetElement:"self"}))),r?.set(e,n)),n}function Pt(e,t){let r=t?Et:vt,n=r?.get(e);if(n===void 0){if(n="",e.hasAttribute("aria-describedby")){let i=ve(e,e.getAttribute("aria-describedby"));n=Ie(i.map(s=>B(s,{includeHidden:t,visitedElements:new Set,embeddedInDescribedBy:{element:s,hidden:F(s)}})).join(" "))}else e.hasAttribute("aria-description")?n=Ie(e.getAttribute("aria-description")||""):n=Ie(e.getAttribute("title")||"");r?.set(e,n)}return n}function B(e,t){if(t.visitedElements.has(e))return"";let r={...t,embeddedInTargetElement:t.embeddedInTargetElement==="self"?"descendant":t.embeddedInTargetElement};if(!t.includeHidden){let a=!!t.embeddedInLabelledBy?.hidden||!!t.embeddedInDescribedBy?.hidden||!!t.embeddedInNativeTextAlternative?.hidden||!!t.embeddedInLabel?.hidden;if(or(e)||!a&&F(e))return t.visitedElements.add(e),""}let n=cr(e);if(!t.embeddedInLabelledBy){let a=(n||[]).map(l=>B(l,{...t,embeddedInLabelledBy:{element:l,hidden:F(l)},embeddedInDescribedBy:void 0,embeddedInTargetElement:void 0,embeddedInLabel:void 0,embeddedInNativeTextAlternative:void 0})).join(" ");if(a)return a}let i=L(e)||"",s=C(e);if(t.embeddedInLabel||t.embeddedInLabelledBy||t.embeddedInTargetElement==="descendant"){let a=[...e.labels||[]].includes(e),l=(n||[]).includes(e);if(!a&&!l){if(i==="textbox")return t.visitedElements.add(e),s==="INPUT"||s==="TEXTAREA"?e.value:e.textContent||"";if(["combobox","listbox"].includes(i)){t.visitedElements.add(e);let u;if(s==="SELECT")u=[...e.selectedOptions],!u.length&&e.options.length&&u.push(e.options[0]);else{let h=i==="combobox"?Ot(e,"*").find(f=>L(f)==="listbox"):e;u=h?Ot(h,'[aria-selected="true"]').filter(f=>L(f)==="option"):[]}return!u.length&&s==="INPUT"?e.value:u.map(h=>B(h,r)).join(" ")}if(["progressbar","scrollbar","slider","spinbutton","meter"].includes(i))return t.visitedElements.add(e),e.hasAttribute("aria-valuetext")?e.getAttribute("aria-valuetext")||"":e.hasAttribute("aria-valuenow")?e.getAttribute("aria-valuenow")||"":e.getAttribute("value")||"";if(["menu"].includes(i))return t.visitedElements.add(e),""}}let o=e.getAttribute("aria-label")||"";if(U(o))return t.visitedElements.add(e),o;if(!["presentation","none"].includes(i)){if(s==="INPUT"&&["button","submit","reset"].includes(e.type)){t.visitedElements.add(e);let a=e.value||"";return U(a)?a:e.type==="submit"?"Submit":e.type==="reset"?"Reset":e.getAttribute("title")||""}if(s==="INPUT"&&e.type==="image"){t.visitedElements.add(e);let a=e.labels||[];if(a.length&&!t.embeddedInLabelledBy)return ye(a,t);let l=e.getAttribute("alt")||"";if(U(l))return l;let u=e.getAttribute("title")||"";return U(u)?u:"Submit"}if(!n&&s==="BUTTON"){t.visitedElements.add(e);let a=e.labels||[];if(a.length)return ye(a,t)}if(!n&&s==="OUTPUT"){t.visitedElements.add(e);let a=e.labels||[];return a.length?ye(a,t):e.getAttribute("title")||""}if(!n&&(s==="TEXTAREA"||s==="SELECT"||s==="INPUT")){t.visitedElements.add(e);let a=e.labels||[];if(a.length)return ye(a,t);let l=s==="INPUT"&&["text","password","search","tel","email","url"].includes(e.type)||s==="TEXTAREA",u=e.getAttribute("placeholder")||"",h=e.getAttribute("title")||"";return!l||h?h:u}if(!n&&s==="FIELDSET"){t.visitedElements.add(e);for(let l=e.firstElementChild;l;l=l.nextElementSibling)if(C(l)==="LEGEND")return B(l,{...r,embeddedInNativeTextAlternative:{element:l,hidden:F(l)}});return e.getAttribute("title")||""}if(!n&&s==="FIGURE"){t.visitedElements.add(e);for(let l=e.firstElementChild;l;l=l.nextElementSibling)if(C(l)==="FIGCAPTION")return B(l,{...r,embeddedInNativeTextAlternative:{element:l,hidden:F(l)}});return e.getAttribute("title")||""}if(s==="IMG"){t.visitedElements.add(e);let a=e.getAttribute("alt")||"";return U(a)?a:e.getAttribute("title")||""}if(s==="TABLE"){t.visitedElements.add(e);for(let l=e.firstElementChild;l;l=l.nextElementSibling)if(C(l)==="CAPTION")return B(l,{...r,embeddedInNativeTextAlternative:{element:l,hidden:F(l)}});let a=e.getAttribute("summary")||"";if(a)return a}if(s==="AREA"){t.visitedElements.add(e);let a=e.getAttribute("alt")||"";return U(a)?a:e.getAttribute("title")||""}if(s==="SVG"||e.ownerSVGElement){t.visitedElements.add(e);for(let a=e.firstElementChild;a;a=a.nextElementSibling)if(C(a)==="TITLE"&&a.ownerSVGElement)return B(a,{...r,embeddedInLabelledBy:{element:a,hidden:F(a)}})}if(e.ownerSVGElement&&s==="A"){let a=e.getAttribute("xlink:title")||"";if(U(a))return t.visitedElements.add(e),a}}let c=s==="SUMMARY"&&!["presentation","none"].includes(i);if(jn(i,t.embeddedInTargetElement==="descendant")||c||t.embeddedInLabelledBy||t.embeddedInDescribedBy||t.embeddedInLabel||t.embeddedInNativeTextAlternative){t.visitedElements.add(e);let a=Vn(e,r);if(t.embeddedInTargetElement==="self"?U(a):a)return a}if(!["presentation","none"].includes(i)||s==="IFRAME"){t.visitedElements.add(e);let a=e.getAttribute("title")||"";if(U(a))return a}return t.visitedElements.add(e),""}function Vn(e,t){let r=[],n=(s,o)=>{if(!(o&&s.assignedSlot))if(s.nodeType===1){let c=Q(s)?.display||"inline",a=B(s,t);(c!=="inline"||s.nodeName==="BR")&&(a=" "+a+" "),r.push(a)}else s.nodeType===3&&r.push(s.textContent||"")};r.push(Be(e,"::before"));let i=e.nodeName==="SLOT"?e.assignedNodes():[];if(i.length)for(let s of i)n(s,!1);else{for(let s=e.firstChild;s;s=s.nextSibling)n(s,!0);if(e.shadowRoot)for(let s=e.shadowRoot.firstChild;s;s=s.nextSibling)n(s,!0);for(let s of ve(e,e.getAttribute("aria-owns")))n(s,!0)}return r.push(Be(e,"::after")),r.join("")}var ft=["gridcell","option","row","tab","rowheader","columnheader","treeitem"];function lr(e){return C(e)==="OPTION"?e.selected:ft.includes(L(e)||"")?sr(e.getAttribute("aria-selected"))===!0:!1}var dt=["checkbox","menuitemcheckbox","option","radio","switch","menuitemradio","treeitem"];function ur(e){let t=hr(e,!0);return t==="error"?!1:t}function hr(e,t){let r=C(e);if(t&&r==="INPUT"&&e.indeterminate)return"mixed";if(r==="INPUT"&&["checkbox","radio"].includes(e.type))return e.checked;if(dt.includes(L(e)||"")){let n=e.getAttribute("aria-checked");return n==="true"?!0:t&&n==="mixed"?"mixed":!1}return"error"}var pt=["button"];function fr(e){if(pt.includes(L(e)||"")){let t=e.getAttribute("aria-pressed");if(t==="true")return!0;if(t==="mixed")return"mixed"}return!1}var gt=["application","button","checkbox","combobox","gridcell","link","listbox","menuitem","row","rowheader","tab","treeitem","columnheader","menuitemcheckbox","menuitemradio","rowheader","switch"];function dr(e){if(C(e)==="DETAILS")return e.open;if(gt.includes(L(e)||"")){let t=e.getAttribute("aria-expanded");return t===null?void 0:t==="true"}}var mt=["heading","listitem","row","treeitem"];function pr(e){let t={H1:1,H2:2,H3:3,H4:4,H5:5,H6:6}[C(e)];if(t)return t;if(mt.includes(L(e)||"")){let r=e.getAttribute("aria-level"),n=r===null?Number.NaN:Number(r);if(Number.isInteger(n)&&n>=1)return n}return 0}var gr=["application","button","composite","gridcell","group","input","link","menuitem","scrollbar","separator","tab","checkbox","columnheader","combobox","grid","listbox","menu","menubar","menuitemcheckbox","menuitemradio","option","radio","radiogroup","row","rowheader","searchbox","select","slider","spinbutton","switch","tablist","textbox","toolbar","tree","treegrid","treeitem"];function bt(e){return mr(e)||wr(e)}function mr(e){return["BUTTON","INPUT","SELECT","TEXTAREA","OPTION","OPTGROUP"].includes(e.tagName)&&(e.hasAttribute("disabled")||br(e))}function br(e){return e?C(e)==="FIELDSET"&&e.hasAttribute("disabled")?!0:br(e.parentElement):!1}function wr(e){if(!e)return!1;if(gr.includes(L(e)||"")){let t=(e.getAttribute("aria-disabled")||"").toLowerCase();if(t==="true")return!0;if(t==="false")return!1}return wr($(e))}function ye(e,t){return[...e].map(r=>B(r,{...t,embeddedInLabel:{element:r,hidden:F(r)},embeddedInNativeTextAlternative:void 0,embeddedInLabelledBy:void 0,embeddedInDescribedBy:void 0,embeddedInTargetElement:void 0})).filter(r=>!!r).join(" ")}var wt,xt,vt,Et,We,St,Tt,xr=0;function _t(){++xr,wt??=new Map,xt??=new Map,vt??=new Map,Et??=new Map,We??=new Map,St??=new Map,Tt??=new Map}function yt(){--xr||(wt=void 0,xt=void 0,vt=void 0,Et=void 0,We=void 0,St=void 0,Tt=void 0)}var Gn={button:"button",checkbox:"checkbox",image:"button",number:"spinbutton",radio:"radio",range:"slider",reset:"button",submit:"button"};function vr(e,t){for(let r of t.jsonPath)e!=null&&(e=e[r]);return Er(e,t)}function Er(e,t){let r=typeof e=="string"&&!t.caseSensitive?e.toUpperCase():e,n=typeof t.value=="string"&&!t.caseSensitive?t.value.toUpperCase():t.value;return t.op==="<truthy>"?!!r:t.op==="="?n instanceof RegExp?typeof r=="string"&&!!r.match(n):r===n:typeof r!="string"||typeof n!="string"?!1:t.op==="*="?r.includes(n):t.op==="^="?r.startsWith(n):t.op==="$="?r.endsWith(n):t.op==="|="?r===n||r.startsWith(n+"-"):t.op==="~="?r.split(" ").includes(n):!1}function At(e){let t=e.ownerDocument;return e.nodeName==="SCRIPT"||e.nodeName==="NOSCRIPT"||e.nodeName==="STYLE"||t.head&&t.head.contains(e)}function O(e,t){let r=e.get(t);if(r===void 0){if(r={full:"",normalized:"",immediate:[]},!At(t)){let n="";if(t instanceof HTMLInputElement&&(t.type==="submit"||t.type==="button"))r={full:t.value,normalized:D(t.value),immediate:[t.value]};else{for(let i=t.firstChild;i;i=i.nextSibling)i.nodeType===Node.TEXT_NODE?(r.full+=i.nodeValue||"",n+=i.nodeValue||""):(n&&r.immediate.push(n),n="",i.nodeType===Node.ELEMENT_NODE&&(r.full+=O(e,i).full));n&&r.immediate.push(n),t.shadowRoot&&(r.full+=O(e,t.shadowRoot).full),r.full&&(r.normalized=D(r.full))}}e.set(t,r)}return r}function Ve(e,t,r){if(At(t)||!r(O(e,t)))return"none";for(let n=t.firstChild;n;n=n.nextSibling)if(n.nodeType===Node.ELEMENT_NODE&&r(O(e,n)))return"selfAndChildren";return t.shadowRoot&&r(O(e,t.shadowRoot))?"selfAndChildren":"self"}function Sr(e,t){let r=cr(t);if(r)return r.map(s=>O(e,s));let n=t.getAttribute("aria-label");if(n!==null&&n.trim())return[{full:n,normalized:D(n),immediate:[n]}];let i=t.nodeName==="INPUT"&&t.type!=="hidden";if(["BUTTON","METER","OUTPUT","PROGRESS","SELECT","TEXTAREA"].includes(t.nodeName)||i){let s=t.labels;if(s)return[...s].map(o=>O(e,o))}return[]}var _=function(e,t,r){return e>=t&&e<=r};function I(e){return _(e,48,57)}function qt(e){return I(e)||_(e,65,70)||_(e,97,102)}function zn(e){return _(e,65,90)}function Jn(e){return _(e,97,122)}function Qn(e){return zn(e)||Jn(e)}function Kn(e){return e>=128}function Re(e){return Qn(e)||Kn(e)||e===95}function Mt(e){return Re(e)||I(e)||e===45}function Xn(e){return _(e,0,8)||e===11||_(e,14,31)||e===127}function te(e){return e===10}function j(e){return te(e)||e===9||e===32}var Yn=1114111,kt=class extends Error{constructor(e){super(e),this.name="InvalidCharacterError"}};function Zn(e){let t=[];for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(n===13&&e.charCodeAt(r+1)===10&&(n=10,r++),(n===13||n===12)&&(n=10),n===0&&(n=65533),_(n,55296,56319)&&_(e.charCodeAt(r+1),56320,57343)){let i=n-55296,s=e.charCodeAt(r+1)-56320;n=Math.pow(2,16)+i*Math.pow(2,10)+s,r++}t.push(n)}return t}function y(e){if(e<=65535)return String.fromCharCode(e);e-=Math.pow(2,16);let t=Math.floor(e/Math.pow(2,10))+55296,r=e%Math.pow(2,10)+56320;return String.fromCharCode(t)+String.fromCharCode(r)}function ei(e){let t=Zn(e),r=-1,n=[],i,s=0,o=0,c=0,a=function(){s+=1,c=o,o=0},l={line:s,column:o},u=function(b){return b>=t.length?-1:t[b]},h=function(b){if(b===void 0&&(b=1),b>3)throw"Spec Error: no more than three codepoints of lookahead.";return u(r+b)},f=function(b){return b===void 0&&(b=1),r+=b,i=u(r),te(i)?a():o+=b,!0},w=function(){return r-=1,te(i)?(s-=1,o=c):o-=1,l.line=s,l.column=o,!0},d=function(b){return b===void 0&&(b=i),b===-1},g=function(){},p=function(){},x=function(){if(E(),f(),j(i)){for(;j(h());)f();return new it}else{if(i===34)return Se();if(i===35)if(Mt(h())||z(h(1),h(2))){let b=new Mr("");return k(h(1),h(2),h(3))&&(b.type="id"),b.value=_e(),b}else return new N(i);else return i===36?h()===61?(f(),new ii):new N(i):i===39?Se():i===40?new Ir:i===41?new Rr:i===42?h()===61?(f(),new si):new N(i):i===43?ze()?(w(),S()):new N(i):i===44?new Nr:i===45?ze()?(w(),S()):h(1)===45&&h(2)===62?(f(2),new yr):P()?(w(),K()):new N(i):i===46?ze()?(w(),S()):new N(i):i===58?new Ar:i===59?new kr:i===60?h(1)===33&&h(2)===45&&h(3)===45?(f(3),new _r):new N(i):i===64?k(h(1),h(2),h(3))?new qr(_e()):new N(i):i===91?new $r:i===92?m()?(w(),K()):(p(),new N(i)):i===93?new st:i===94?h()===61?(f(),new ni):new N(i):i===123?new Cr:i===124?h()===61?(f(),new ri):h()===124?(f(),new Or):new N(i):i===125?new Lr:i===126?h()===61?(f(),new ti):new N(i):I(i)?(w(),S()):Re(i)?(w(),K()):d()?new Pe:new N(i)}},E=function(){for(;h(1)===47&&h(2)===42;)for(f(2);;)if(f(),i===42&&h()===47){f();break}else if(d()){p();return}},S=function(){let b=vn();if(k(h(1),h(2),h(3))){let v=new oi;return v.value=b.value,v.repr=b.repr,v.type=b.type,v.unit=_e(),v}else if(h()===37){f();let v=new Br;return v.value=b.value,v.repr=b.repr,v}else{let v=new Fr;return v.value=b.value,v.repr=b.repr,v.type=b.type,v}},K=function(){let b=_e();if(b.toLowerCase()==="url"&&h()===40){for(f();j(h(1))&&j(h(2));)f();return h()===34||h()===39?new qe(b):j(h())&&(h(2)===34||h(2)===39)?new qe(b):Te()}else return h()===40?(f(),new qe(b)):new Pr(b)},Se=function(b){b===void 0&&(b=i);let v="";for(;f();){if(i===b||d())return new Dr(v);if(te(i))return p(),w(),new Tr;i===92?d(h())?g():te(h())?f():v+=y(X()):v+=y(i)}throw new Error("Internal error")},Te=function(){let b=new Hr("");for(;j(h());)f();if(d(h()))return b;for(;f();){if(i===41||d())return b;if(j(i)){for(;j(h());)f();return h()===41||d(h())?(f(),b):(Je(),new Oe)}else{if(i===34||i===39||i===40||Xn(i))return p(),Je(),new Oe;if(i===92)if(m())b.value+=y(X());else return p(),Je(),new Oe;else b.value+=y(i)}}throw new Error("Internal error")},X=function(){if(f(),qt(i)){let b=[i];for(let q=0;q<5&&qt(h());q++)f(),b.push(i);j(h())&&f();let v=parseInt(b.map(function(q){return String.fromCharCode(q)}).join(""),16);return v>Yn&&(v=65533),v}else return d()?65533:i},z=function(b,v){return!(b!==92||te(v))},m=function(){return z(i,h())},k=function(b,v,q){return b===45?Re(v)||v===45||z(v,q):Re(b)?!0:b===92?z(b,v):!1},P=function(){return k(i,h(1),h(2))},xn=function(b,v,q){return b===43||b===45?!!(I(v)||v===46&&I(q)):b===46?!!I(v):!!I(b)},ze=function(){return xn(i,h(1),h(2))},_e=function(){let b="";for(;f();)if(Mt(i))b+=y(i);else if(m())b+=y(X());else return w(),b;throw new Error("Internal parse error")},vn=function(){let b="",v="integer";for((h()===43||h()===45)&&(f(),b+=y(i));I(h());)f(),b+=y(i);if(h(1)===46&&I(h(2)))for(f(),b+=y(i),f(),b+=y(i),v="number";I(h());)f(),b+=y(i);let q=h(1),Qe=h(2),Sn=h(3);if((q===69||q===101)&&I(Qe))for(f(),b+=y(i),f(),b+=y(i),v="number";I(h());)f(),b+=y(i);else if((q===69||q===101)&&(Qe===43||Qe===45)&&I(Sn))for(f(),b+=y(i),f(),b+=y(i),f(),b+=y(i),v="number";I(h());)f(),b+=y(i);let Tn=En(b);return{type:v,value:Tn,repr:b}},En=function(b){return+b},Je=function(){for(;f();){if(i===41||d())return;m()&&X(),g()}},Nt=0;for(;!d(h());)if(n.push(x()),Nt++,Nt>t.length*2)throw new Error("I'm infinite-looping!");return n}var T=class{constructor(){this.tokenType=""}toJSON(){return{token:this.tokenType}}toString(){return this.tokenType}toSource(){return""+this}},Tr=class extends T{constructor(){super(...arguments),this.tokenType="BADSTRING"}},Oe=class extends T{constructor(){super(...arguments),this.tokenType="BADURL"}},it=class extends T{constructor(){super(...arguments),this.tokenType="WHITESPACE"}toString(){return"WS"}toSource(){return" "}},_r=class extends T{constructor(){super(...arguments),this.tokenType="CDO"}toSource(){return"<!--"}},yr=class extends T{constructor(){super(...arguments),this.tokenType="CDC"}toSource(){return"-->"}},Ar=class extends T{constructor(){super(...arguments),this.tokenType=":"}},kr=class extends T{constructor(){super(...arguments),this.tokenType=";"}},Nr=class extends T{constructor(){super(...arguments),this.tokenType=","}},ae=class extends T{constructor(){super(...arguments),this.value="",this.mirror=""}},Cr=class extends ae{constructor(){super(),this.tokenType="{",this.value="{",this.mirror="}"}},Lr=class extends ae{constructor(){super(),this.tokenType="}",this.value="}",this.mirror="{"}},$r=class extends ae{constructor(){super(),this.tokenType="[",this.value="[",this.mirror="]"}},st=class extends ae{constructor(){super(),this.tokenType="]",this.value="]",this.mirror="["}},Ir=class extends ae{constructor(){super(),this.tokenType="(",this.value="(",this.mirror=")"}},Rr=class extends ae{constructor(){super(),this.tokenType=")",this.value=")",this.mirror="("}},ti=class extends T{constructor(){super(...arguments),this.tokenType="~="}},ri=class extends T{constructor(){super(...arguments),this.tokenType="|="}},ni=class extends T{constructor(){super(...arguments),this.tokenType="^="}},ii=class extends T{constructor(){super(...arguments),this.tokenType="$="}},si=class extends T{constructor(){super(...arguments),this.tokenType="*="}},Or=class extends T{constructor(){super(...arguments),this.tokenType="||"}},Pe=class extends T{constructor(){super(...arguments),this.tokenType="EOF"}toSource(){return""}},N=class extends T{constructor(e){super(),this.tokenType="DELIM",this.value="",this.value=y(e)}toString(){return"DELIM("+this.value+")"}toJSON(){let e=this.constructor.prototype.constructor.prototype.toJSON.call(this);return e.value=this.value,e}toSource(){return this.value==="\\"?`\\
|
|
315
|
+
`:this.value}},ce=class extends T{constructor(){super(...arguments),this.value=""}ASCIIMatch(e){return this.value.toLowerCase()===e.toLowerCase()}toJSON(){let e=this.constructor.prototype.constructor.prototype.toJSON.call(this);return e.value=this.value,e}},Pr=class extends ce{constructor(e){super(),this.tokenType="IDENT",this.value=e}toString(){return"IDENT("+this.value+")"}toSource(){return Ee(this.value)}},qe=class extends ce{constructor(e){super(),this.tokenType="FUNCTION",this.value=e,this.mirror=")"}toString(){return"FUNCTION("+this.value+")"}toSource(){return Ee(this.value)+"("}},qr=class extends ce{constructor(e){super(),this.tokenType="AT-KEYWORD",this.value=e}toString(){return"AT("+this.value+")"}toSource(){return"@"+Ee(this.value)}},Mr=class extends ce{constructor(e){super(),this.tokenType="HASH",this.value=e,this.type="unrestricted"}toString(){return"HASH("+this.value+")"}toJSON(){let e=this.constructor.prototype.constructor.prototype.toJSON.call(this);return e.value=this.value,e.type=this.type,e}toSource(){return this.type==="id"?"#"+Ee(this.value):"#"+ai(this.value)}},Dr=class extends ce{constructor(e){super(),this.tokenType="STRING",this.value=e}toString(){return'"'+Wr(this.value)+'"'}},Hr=class extends ce{constructor(e){super(),this.tokenType="URL",this.value=e}toString(){return"URL("+this.value+")"}toSource(){return'url("'+Wr(this.value)+'")'}},Fr=class extends T{constructor(){super(),this.tokenType="NUMBER",this.type="integer",this.repr=""}toString(){return this.type==="integer"?"INT("+this.value+")":"NUMBER("+this.value+")"}toJSON(){let e=super.toJSON();return e.value=this.value,e.type=this.type,e.repr=this.repr,e}toSource(){return this.repr}},Br=class extends T{constructor(){super(),this.tokenType="PERCENTAGE",this.repr=""}toString(){return"PERCENTAGE("+this.value+")"}toJSON(){let e=this.constructor.prototype.constructor.prototype.toJSON.call(this);return e.value=this.value,e.repr=this.repr,e}toSource(){return this.repr+"%"}},oi=class extends T{constructor(){super(),this.tokenType="DIMENSION",this.type="integer",this.repr="",this.unit=""}toString(){return"DIM("+this.value+","+this.unit+")"}toJSON(){let e=this.constructor.prototype.constructor.prototype.toJSON.call(this);return e.value=this.value,e.type=this.type,e.repr=this.repr,e.unit=this.unit,e}toSource(){let e=this.repr,t=Ee(this.unit);return t[0].toLowerCase()==="e"&&(t[1]==="-"||_(t.charCodeAt(1),48,57))&&(t="\\65 "+t.slice(1,t.length)),e+t}};function Ee(e){e=""+e;let t="",r=e.charCodeAt(0);for(let n=0;n<e.length;n++){let i=e.charCodeAt(n);if(i===0)throw new kt("Invalid character: the input contains U+0000.");_(i,1,31)||i===127||n===0&&_(i,48,57)||n===1&&_(i,48,57)&&r===45?t+="\\"+i.toString(16)+" ":i>=128||i===45||i===95||_(i,48,57)||_(i,65,90)||_(i,97,122)?t+=e[n]:t+="\\"+e[n]}return t}function ai(e){e=""+e;let t="";for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(n===0)throw new kt("Invalid character: the input contains U+0000.");n>=128||n===45||n===95||_(n,48,57)||_(n,65,90)||_(n,97,122)?t+=e[r]:t+="\\"+n.toString(16)+" "}return t}function Wr(e){e=""+e;let t="";for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(n===0)throw new kt("Invalid character: the input contains U+0000.");_(n,1,31)||n===127?t+="\\"+n.toString(16)+" ":n===34||n===92?t+="\\"+e[r]:t+=e[r]}return t}var R=class extends Error{};function ci(e,t){let r;try{r=ei(e),r[r.length-1]instanceof Pe||r.push(new Pe)}catch(m){let k=m.message+` while parsing selector "${e}"`,P=(m.stack||"").indexOf(m.message);throw P!==-1&&(m.stack=m.stack.substring(0,P)+k+m.stack.substring(P+m.message.length)),m.message=k,m}let n=r.find(m=>m instanceof qr||m instanceof Tr||m instanceof Oe||m instanceof Or||m instanceof _r||m instanceof yr||m instanceof kr||m instanceof Cr||m instanceof Lr||m instanceof Hr||m instanceof Br);if(n)throw new R(`Unsupported token "${n.toSource()}" while parsing selector "${e}"`);let i=0,s=new Set;function o(){return new R(`Unexpected token "${r[i].toSource()}" while parsing selector "${e}"`)}function c(){for(;r[i]instanceof it;)i++}function a(m=i){return r[m]instanceof Pr}function l(m=i){return r[m]instanceof Dr}function u(m=i){return r[m]instanceof Fr}function h(m=i){return r[m]instanceof Nr}function f(m=i){return r[m]instanceof Ir}function w(m=i){return r[m]instanceof Rr}function d(m=i){return r[m]instanceof qe}function g(m=i){return r[m]instanceof N&&r[m].value==="*"}function p(m=i){return r[m]instanceof Pe}function x(m=i){return r[m]instanceof N&&[">","+","~"].includes(r[m].value)}function E(m=i){return h(m)||w(m)||p(m)||x(m)||r[m]instanceof it}function S(){let m=[K()];for(;c(),!!h();)i++,m.push(K());return m}function K(){return c(),u()||l()?r[i++].value:Se()}function Se(){let m={simples:[]};for(c(),x()?m.simples.push({selector:{functions:[{name:"scope",args:[]}]},combinator:""}):m.simples.push({selector:Te(),combinator:""});;){if(c(),x())m.simples[m.simples.length-1].combinator=r[i++].value,c();else if(E())break;m.simples.push({combinator:"",selector:Te()})}return m}function Te(){let m="",k=[];for(;!E();)if(a()||g())m+=r[i++].toSource();else if(r[i]instanceof Mr)m+=r[i++].toSource();else if(r[i]instanceof N&&r[i].value===".")if(i++,a())m+="."+r[i++].toSource();else throw o();else if(r[i]instanceof Ar)if(i++,a())if(!t.has(r[i].value.toLowerCase()))m+=":"+r[i++].toSource();else{let P=r[i++].value.toLowerCase();k.push({name:P,args:[]}),s.add(P)}else if(d()){let P=r[i++].value.toLowerCase();if(t.has(P)?(k.push({name:P,args:S()}),s.add(P)):m+=`:${P}(${X()})`,c(),!w())throw o();i++}else throw o();else if(r[i]instanceof $r){for(m+="[",i++;!(r[i]instanceof st)&&!p();)m+=r[i++].toSource();if(!(r[i]instanceof st))throw o();m+="]",i++}else throw o();if(!m&&!k.length)throw o();return{css:m||void 0,functions:k}}function X(){let m="",k=1;for(;!p()&&((f()||d())&&k++,w()&&k--,!!k);)m+=r[i++].toSource();return m}let z=S();if(!p())throw o();if(z.some(m=>typeof m!="object"||!("simples"in m)))throw new R(`Error while parsing selector "${e}"`);return{selector:z,names:Array.from(s)}}var ot=new Set(["internal:has","internal:has-not","internal:and","internal:or","internal:chain","left-of","right-of","above","below","near"]),li=new Set(["left-of","right-of","above","below","near"]),Ur=new Set(["not","is","where","has","scope","light","visible","text","text-matches","text-is","has-text","above","below","right-of","left-of","near","nth-match"]);function Ge(e){let t=fi(e),r=[];for(let n of t.parts){if(n.name==="css"||n.name==="css:light"){n.name==="css:light"&&(n.body=":light("+n.body+")");let i=ci(n.body,Ur);r.push({name:"css",body:i.selector,source:n.body});continue}if(ot.has(n.name)){let i,s;try{let l=JSON.parse("["+n.body+"]");if(!Array.isArray(l)||l.length<1||l.length>2||typeof l[0]!="string")throw new R(`Malformed selector: ${n.name}=`+n.body);if(i=l[0],l.length===2){if(typeof l[1]!="number"||!li.has(n.name))throw new R(`Malformed selector: ${n.name}=`+n.body);s=l[1]}}catch{throw new R(`Malformed selector: ${n.name}=`+n.body)}let o={name:n.name,source:n.body,body:{parsed:Ge(i),distance:s}},c=[...o.body.parsed.parts].reverse().find(l=>l.name==="internal:control"&&l.body==="enter-frame"),a=c?o.body.parsed.parts.indexOf(c):-1;a!==-1&&ui(o.body.parsed.parts.slice(0,a+1),r.slice(0,a+1))&&o.body.parsed.parts.splice(0,a+1),r.push(o);continue}r.push({...n,source:n.body})}if(ot.has(r[0].name))throw new R(`"${r[0].name}" selector cannot be first`);return{capture:t.capture,parts:r}}function ui(e,t){return M({parts:e})===M({parts:t})}function M(e,t){return typeof e=="string"?e:e.parts.map((r,n)=>{let i=!0;!t&&n!==e.capture&&(r.name==="css"||r.name==="xpath"&&r.source.startsWith("//")||r.source.startsWith(".."))&&(i=!1);let s=i?r.name+"=":"";return`${n===e.capture?"*":""}${s}${r.source}`}).join(" >> ")}function hi(e,t){let r=(n,i)=>{for(let s of n.parts)t(s,i),ot.has(s.name)&&r(s.body.parsed,!0)};r(e,!1)}function fi(e){let t=0,r,n=0,i={parts:[]},s=()=>{let c=e.substring(n,t).trim(),a=c.indexOf("="),l,u;a!==-1&&c.substring(0,a).trim().match(/^[a-zA-Z_0-9-+:*]+$/)?(l=c.substring(0,a).trim(),u=c.substring(a+1)):c.length>1&&c[0]==='"'&&c[c.length-1]==='"'||c.length>1&&c[0]==="'"&&c[c.length-1]==="'"?(l="text",u=c):/^\(*\/\//.test(c)||c.startsWith("..")?(l="xpath",u=c):(l="css",u=c);let h=!1;if(l[0]==="*"&&(h=!0,l=l.substring(1)),i.parts.push({name:l,body:u}),h){if(i.capture!==void 0)throw new R("Only one of the selectors can capture using * modifier");i.capture=i.parts.length-1}};if(!e.includes(">>"))return t=e.length,s(),i;let o=()=>{let a=e.substring(n,t).match(/^\s*text\s*=(.*)$/);return!!a&&!!a[1]};for(;t<e.length;){let c=e[t];c==="\\"&&t+1<e.length?t+=2:c===r?(r=void 0,t++):!r&&(c==='"'||c==="'"||c==="`")&&!o()?(r=c,t++):!r&&c===">"&&e[t+1]===">"?(s(),t+=2,n=t):t++}return s(),i}function W(e,t){let r=0,n=e.length===0,i=()=>e[r]||"",s=()=>{let p=i();return++r,n=r>=e.length,p},o=p=>{throw n?new R(`Unexpected end of selector while parsing selector \`${e}\``):new R(`Error while parsing selector \`${e}\` - unexpected symbol "${i()}" at position ${r}`+(p?" during "+p:""))};function c(){for(;!n&&/\s/.test(i());)s()}function a(p){return p>="\x80"||p>="0"&&p<="9"||p>="A"&&p<="Z"||p>="a"&&p<="z"||p>="0"&&p<="9"||p==="_"||p==="-"}function l(){let p="";for(c();!n&&a(i());)p+=s();return p}function u(p){let x=s();for(x!==p&&o("parsing quoted string");!n&&i()!==p;)i()==="\\"&&s(),x+=s();return i()!==p&&o("parsing quoted string"),x+=s(),x}function h(){s()!=="/"&&o("parsing regular expression");let p="",x=!1;for(;!n;){if(i()==="\\")p+=s(),n&&o("parsing regular expression");else if(x&&i()==="]")x=!1;else if(!x&&i()==="[")x=!0;else if(!x&&i()==="/")break;p+=s()}s()!=="/"&&o("parsing regular expression");let E="";for(;!n&&i().match(/[dgimsuy]/);)E+=s();try{return new RegExp(p,E)}catch(S){throw new R(`Error while parsing selector \`${e}\`: ${S.message}`)}}function f(){let p="";return c(),i()==="'"||i()==='"'?p=u(i()).slice(1,-1):p=l(),p||o("parsing property path"),p}function w(){c();let p="";return n||(p+=s()),!n&&p!=="="&&(p+=s()),["=","*=","^=","$=","|=","~="].includes(p)||o("parsing operator"),p}function d(){s();let p=[];for(p.push(f()),c();i()===".";)s(),p.push(f()),c();if(i()==="]")return s(),{name:p.join("."),jsonPath:p,op:"<truthy>",value:null,caseSensitive:!1};let x=w(),E,S=!0;if(c(),i()==="/"){if(x!=="=")throw new R(`Error while parsing selector \`${e}\` - cannot use ${x} in attribute with regular expression`);E=h()}else if(i()==="'"||i()==='"')E=u(i()).slice(1,-1),c(),i()==="i"||i()==="I"?(S=!1,s()):(i()==="s"||i()==="S")&&(S=!0,s());else{for(E="";!n&&(a(i())||i()==="+"||i()===".");)E+=s();E==="true"?E=!0:E==="false"?E=!1:t||(E=+E,Number.isNaN(E)&&o("parsing attribute value"))}if(c(),i()!=="]"&&o("parsing attribute value"),s(),x!=="="&&typeof E!="string")throw new R(`Error while parsing selector \`${e}\` - cannot use ${x} in attribute with non-string matching value - ${E}`);return{name:p.join("."),jsonPath:p,op:x,value:E,caseSensitive:S}}let g={name:"",attributes:[]};for(g.name=l(),c();i()==="[";)g.attributes.push(d()),c();if(n||o(void 0),!g.name&&!g.attributes.length)throw new R(`Error while parsing selector \`${e}\` - selector cannot be empty`);return g}function Dt(e){return e.displayName||e.name||"Anonymous"}function di(e){if(e.type)switch(typeof e.type){case"function":return Dt(e.type);case"string":return e.type;case"object":return e.type.displayName||(e.type.render?Dt(e.type.render):"")}if(e._currentElement){let t=e._currentElement.type;if(typeof t=="string")return t;if(typeof t=="function")return t.displayName||t.name||"Anonymous"}return""}function pi(e){return e.key??e._currentElement?.key}function gi(e){if(e.child){let r=[];for(let n=e.child;n;n=n.sibling)r.push(n);return r}if(!e._currentElement)return[];let t=r=>{let n=r._currentElement?.type;return typeof n=="function"||typeof n=="string"};if(e._renderedComponent){let r=e._renderedComponent;return t(r)?[r]:[]}return e._renderedChildren?[...Object.values(e._renderedChildren)].filter(t):[]}function mi(e){let t=e.memoizedProps||e._currentElement?.props;if(!t||typeof t=="string")return t;let r={...t};return delete r.children,r}function jr(e){let t={key:pi(e),name:di(e),children:gi(e).map(jr),rootElements:[],props:mi(e)},r=e.stateNode||e._hostNode||e._renderedComponent?._hostNode;if(r instanceof Element)t.rootElements.push(r);else for(let n of t.children)t.rootElements.push(...n.rootElements);return t}function Vr(e,t,r=[]){t(e)&&r.push(e);for(let n of e.children)Vr(n,t,r);return r}function Gr(e,t=[]){let n=(e.ownerDocument||e).createTreeWalker(e,NodeFilter.SHOW_ELEMENT);do{let i=n.currentNode,s=i,o=Object.keys(s).find(a=>a.startsWith("__reactContainer")&&s[a]!==null);if(o)t.push(s[o].stateNode.current);else{let a="_reactRootContainer";s.hasOwnProperty(a)&&s[a]!==null&&t.push(s[a]._internalRoot.current)}if(i instanceof Element&&i.hasAttribute("data-reactroot"))for(let a of Object.keys(i))(a.startsWith("__reactInternalInstance")||a.startsWith("__reactFiber"))&&t.push(i[a]);let c=i instanceof Element?i.shadowRoot:null;c&&Gr(c,t)}while(n.nextNode());return t}var bi={queryAll(e,t){let{name:r,attributes:n}=W(t,!1),o=Gr(e.ownerDocument||e).map(a=>jr(a)).map(a=>Vr(a,l=>{let u=l.props??{};if(l.key!==void 0&&(u.key=l.key),r&&l.name!==r||l.rootElements.some(h=>!je(e,h)))return!1;for(let h of n)if(!vr(u,h))return!1;return!0})).flat(),c=new Set;for(let a of o)for(let l of a.rootElements)c.add(l);return[...c]}};function zr(e,t){let r=e.replace(/^[a-zA-Z]:/,"").replace(/\\/g,"/"),n=r.substring(r.lastIndexOf("/")+1);return t&&n.endsWith(t)&&(n=n.substring(0,n.length-t.length)),n}function wi(e,t){return t?t.toUpperCase():""}var xi=/(?:^|[-_/])(\w)/g,Jr=e=>e&&e.replace(xi,wi);function vi(e){function t(u){let h=u.name||u._componentTag||u.__playwright_guessedName;if(h)return h;let f=u.__file;if(f)return Jr(zr(f,".vue"))}function r(u,h){return u.type.__playwright_guessedName=h,h}function n(u){let h=t(u.type||{});if(h)return h;if(u.root===u)return"Root";for(let f in u.parent?.type?.components)if(u.parent?.type.components[f]===u.type)return r(u,f);for(let f in u.appContext?.components)if(u.appContext.components[f]===u.type)return r(u,f);return"Anonymous Component"}function i(u){return u._isBeingDestroyed||u.isUnmounted}function s(u){return u.subTree.type.toString()==="Symbol(Fragment)"}function o(u){let h=[];return u.component&&h.push(u.component),u.suspense&&h.push(...o(u.suspense.activeBranch)),Array.isArray(u.children)&&u.children.forEach(f=>{f.component?h.push(f.component):h.push(...o(f))}),h.filter(f=>!i(f)&&!f.type.devtools?.hide)}function c(u){return s(u)?a(u.subTree):[u.subTree.el]}function a(u){if(!u.children)return[];let h=[];for(let f=0,w=u.children.length;f<w;f++){let d=u.children[f];d.component?h.push(...c(d.component)):d.el&&h.push(d.el)}return h}function l(u){return{name:n(u),children:o(u.subTree).map(l),rootElements:c(u),props:u.props}}return l(e)}function Ei(e){function t(s){let o=s.displayName||s.name||s._componentTag;if(o)return o;let c=s.__file;if(c)return Jr(zr(c,".vue"))}function r(s){let o=t(s.$options||s.fnOptions||{});return o||(s.$root===s?"Root":"Anonymous Component")}function n(s){return s.$children?s.$children:Array.isArray(s.subTree.children)?s.subTree.children.filter(o=>!!o.component).map(o=>o.component):[]}function i(s){return{name:r(s),children:n(s).map(i),rootElements:[s.$el],props:s._props}}return i(e)}function Qr(e,t,r=[]){t(e)&&r.push(e);for(let n of e.children)Qr(n,t,r);return r}function Kr(e,t=[]){let n=(e.ownerDocument||e).createTreeWalker(e,NodeFilter.SHOW_ELEMENT),i=new Set;do{let s=n.currentNode;s.__vue__&&i.add(s.__vue__.$root),s.__vue_app__&&s._vnode&&s._vnode.component&&t.push({root:s._vnode.component,version:3});let o=s instanceof Element?s.shadowRoot:null;o&&Kr(o,t)}while(n.nextNode());for(let s of i)t.push({version:2,root:s});return t}var Si={queryAll(e,t){let r=e.ownerDocument||e,{name:n,attributes:i}=W(t,!1),c=Kr(r).map(l=>l.version===3?vi(l.root):Ei(l.root)).map(l=>Qr(l,u=>{if(n&&u.name!==n||u.rootElements.some(h=>!je(e,h)))return!1;for(let h of i)if(!vr(u.props,h))return!1;return!0})).flat(),a=new Set;for(let l of c)for(let u of l.rootElements)a.add(u);return[...a]}},Xr=["selected","checked","pressed","expanded","level","disabled","name","include-hidden"];Xr.sort();function he(e,t,r){if(!t.includes(r))throw new Error(`"${e}" attribute is only supported for roles: ${t.slice().sort().map(n=>`"${n}"`).join(", ")}`)}function Y(e,t){if(e.op!=="<truthy>"&&!t.includes(e.value))throw new Error(`"${e.name}" must be one of ${t.map(r=>JSON.stringify(r)).join(", ")}`)}function Z(e,t){if(!t.includes(e.op))throw new Error(`"${e.name}" does not support "${e.op}" matcher`)}function Ti(e,t){let r={role:t};for(let n of e)switch(n.name){case"checked":{he(n.name,dt,t),Y(n,[!0,!1,"mixed"]),Z(n,["<truthy>","="]),r.checked=n.op==="<truthy>"?!0:n.value;break}case"pressed":{he(n.name,pt,t),Y(n,[!0,!1,"mixed"]),Z(n,["<truthy>","="]),r.pressed=n.op==="<truthy>"?!0:n.value;break}case"selected":{he(n.name,ft,t),Y(n,[!0,!1]),Z(n,["<truthy>","="]),r.selected=n.op==="<truthy>"?!0:n.value;break}case"expanded":{he(n.name,gt,t),Y(n,[!0,!1]),Z(n,["<truthy>","="]),r.expanded=n.op==="<truthy>"?!0:n.value;break}case"level":{if(he(n.name,mt,t),typeof n.value=="string"&&(n.value=+n.value),n.op!=="="||typeof n.value!="number"||Number.isNaN(n.value))throw new Error('"level" attribute must be compared to a number');r.level=n.value;break}case"disabled":{Y(n,[!0,!1]),Z(n,["<truthy>","="]),r.disabled=n.op==="<truthy>"?!0:n.value;break}case"name":{if(n.op==="<truthy>")throw new Error('"name" attribute must have a value');if(typeof n.value!="string"&&!(n.value instanceof RegExp))throw new Error('"name" attribute must be a string or a regular expression');r.name=n.value,r.nameOp=n.op,r.exact=n.caseSensitive;break}case"include-hidden":{Y(n,[!0,!1]),Z(n,["<truthy>","="]),r.includeHidden=n.op==="<truthy>"?!0:n.value;break}default:throw new Error(`Unknown attribute "${n.name}", must be one of ${Xr.map(i=>`"${i}"`).join(", ")}.`)}return r}function _i(e,t,r){let n=[],i=o=>{if(L(o)===t.role&&!(t.selected!==void 0&&lr(o)!==t.selected)&&!(t.checked!==void 0&&ur(o)!==t.checked)&&!(t.pressed!==void 0&&fr(o)!==t.pressed)&&!(t.expanded!==void 0&&dr(o)!==t.expanded)&&!(t.level!==void 0&&pr(o)!==t.level)&&!(t.disabled!==void 0&&bt(o)!==t.disabled)&&!(!t.includeHidden&&F(o))){if(t.name!==void 0){let c=D(oe(o,!!t.includeHidden));if(typeof t.name=="string"&&(t.name=D(t.name)),r&&!t.exact&&t.nameOp==="="&&(t.nameOp="*="),!Er(c,{name:"",jsonPath:[],op:t.nameOp||"=",value:t.name,caseSensitive:!!t.exact}))return}n.push(o)}},s=o=>{let c=[];o.shadowRoot&&c.push(o.shadowRoot);for(let a of o.querySelectorAll("*"))i(a),a.shadowRoot&&c.push(a.shadowRoot);c.forEach(s)};return s(e),n}function Ht(e){return{queryAll:(t,r)=>{let n=W(r,!0),i=n.name.toLowerCase();if(!i)throw new Error("Role must not be empty");let s=Ti(n.attributes,i);_t();try{return _i(t,s,e)}finally{yt()}}}}function yi(e,t,r){let n=e.left-t.right;if(!(n<0||r!==void 0&&n>r))return n+Math.max(t.bottom-e.bottom,0)+Math.max(e.top-t.top,0)}function Ai(e,t,r){let n=t.left-e.right;if(!(n<0||r!==void 0&&n>r))return n+Math.max(t.bottom-e.bottom,0)+Math.max(e.top-t.top,0)}function ki(e,t,r){let n=t.top-e.bottom;if(!(n<0||r!==void 0&&n>r))return n+Math.max(e.left-t.left,0)+Math.max(t.right-e.right,0)}function Ni(e,t,r){let n=e.top-t.bottom;if(!(n<0||r!==void 0&&n>r))return n+Math.max(e.left-t.left,0)+Math.max(t.right-e.right,0)}function Ci(e,t,r){let n=r===void 0?50:r,i=0;return e.left-t.right>=0&&(i+=e.left-t.right),t.left-e.right>=0&&(i+=t.left-e.right),t.top-e.bottom>=0&&(i+=t.top-e.bottom),e.top-t.bottom>=0&&(i+=e.top-t.bottom),i>n?void 0:i}var Li=["left-of","right-of","above","below","near"];function Yr(e,t,r,n){let i=t.getBoundingClientRect(),s={"left-of":Ai,"right-of":yi,above:ki,below:Ni,near:Ci}[e],o;for(let c of r){if(c===t)continue;let a=s(i,c.getBoundingClientRect(),n);a!==void 0&&(o===void 0||a<o)&&(o=a)}return o}var $i=class{constructor(e){this._engines=new Map,this._cacheQueryCSS=new Map,this._cacheMatches=new Map,this._cacheQuery=new Map,this._cacheMatchesSimple=new Map,this._cacheMatchesParents=new Map,this._cacheCallMatches=new Map,this._cacheCallQuery=new Map,this._cacheQuerySimple=new Map,this._cacheText=new Map,this._retainCacheCounter=0;for(let[n,i]of e)this._engines.set(n,i);this._engines.set("not",Oi),this._engines.set("is",me),this._engines.set("where",me),this._engines.set("has",Ii),this._engines.set("scope",Ri),this._engines.set("light",Pi),this._engines.set("visible",qi),this._engines.set("text",Mi),this._engines.set("text-is",Di),this._engines.set("text-matches",Hi),this._engines.set("has-text",Fi),this._engines.set("right-of",fe("right-of")),this._engines.set("left-of",fe("left-of")),this._engines.set("above",fe("above")),this._engines.set("below",fe("below")),this._engines.set("near",fe("near")),this._engines.set("nth-match",Bi);let t=[...this._engines.keys()];t.sort();let r=[...Ur];if(r.sort(),t.join("|")!==r.join("|"))throw new Error(`Please keep customCSSNames in sync with evaluator engines: ${t.join("|")} vs ${r.join("|")}`)}begin(){++this._retainCacheCounter}end(){--this._retainCacheCounter,this._retainCacheCounter||(this._cacheQueryCSS.clear(),this._cacheMatches.clear(),this._cacheQuery.clear(),this._cacheMatchesSimple.clear(),this._cacheMatchesParents.clear(),this._cacheCallMatches.clear(),this._cacheCallQuery.clear(),this._cacheQuerySimple.clear(),this._cacheText.clear())}_cached(e,t,r,n){e.has(t)||e.set(t,[]);let i=e.get(t),s=i.find(c=>r.every((a,l)=>c.rest[l]===a));if(s)return s.result;let o=n();return i.push({rest:r,result:o}),o}_checkSelector(e){if(!(typeof e=="object"&&e&&(Array.isArray(e)||"simples"in e&&e.simples.length)))throw new Error(`Malformed selector "${e}"`);return e}matches(e,t,r){let n=this._checkSelector(t);this.begin();try{return this._cached(this._cacheMatches,e,[n,r.scope,r.pierceShadow,r.originalScope],()=>Array.isArray(n)?this._matchesEngine(me,e,n,r):(this._hasScopeClause(n)&&(r=this._expandContextForScopeMatching(r)),this._matchesSimple(e,n.simples[n.simples.length-1].selector,r)?this._matchesParents(e,n,n.simples.length-2,r):!1))}finally{this.end()}}query(e,t){let r=this._checkSelector(t);this.begin();try{return this._cached(this._cacheQuery,r,[e.scope,e.pierceShadow,e.originalScope],()=>{if(Array.isArray(r))return this._queryEngine(me,e,r);this._hasScopeClause(r)&&(e=this._expandContextForScopeMatching(e));let n=this._scoreMap;this._scoreMap=new Map;let i=this._querySimple(e,r.simples[r.simples.length-1].selector);return i=i.filter(s=>this._matchesParents(s,r,r.simples.length-2,e)),this._scoreMap.size&&i.sort((s,o)=>{let c=this._scoreMap.get(s),a=this._scoreMap.get(o);return c===a?0:c===void 0?1:a===void 0?-1:c-a}),this._scoreMap=n,i})}finally{this.end()}}_markScore(e,t){this._scoreMap&&this._scoreMap.set(e,t)}_hasScopeClause(e){return e.simples.some(t=>t.selector.functions.some(r=>r.name==="scope"))}_expandContextForScopeMatching(e){if(e.scope.nodeType!==1)return e;let t=$(e.scope);return t?{...e,scope:t,originalScope:e.originalScope||e.scope}:e}_matchesSimple(e,t,r){return this._cached(this._cacheMatchesSimple,e,[t,r.scope,r.pierceShadow,r.originalScope],()=>{if(e===r.scope||t.css&&!this._matchesCSS(e,t.css))return!1;for(let n of t.functions)if(!this._matchesEngine(this._getEngine(n.name),e,n.args,r))return!1;return!0})}_querySimple(e,t){return t.functions.length?this._cached(this._cacheQuerySimple,t,[e.scope,e.pierceShadow,e.originalScope],()=>{let r=t.css,n=t.functions;r==="*"&&n.length&&(r=void 0);let i,s=-1;r!==void 0?i=this._queryCSS(e,r):(s=n.findIndex(o=>this._getEngine(o.name).query!==void 0),s===-1&&(s=0),i=this._queryEngine(this._getEngine(n[s].name),e,n[s].args));for(let o=0;o<n.length;o++){if(o===s)continue;let c=this._getEngine(n[o].name);c.matches!==void 0&&(i=i.filter(a=>this._matchesEngine(c,a,n[o].args,e)))}for(let o=0;o<n.length;o++){if(o===s)continue;let c=this._getEngine(n[o].name);c.matches===void 0&&(i=i.filter(a=>this._matchesEngine(c,a,n[o].args,e)))}return i}):this._queryCSS(e,t.css||"*")}_matchesParents(e,t,r,n){return r<0?!0:this._cached(this._cacheMatchesParents,e,[t,r,n.scope,n.pierceShadow,n.originalScope],()=>{let{selector:i,combinator:s}=t.simples[r];if(s===">"){let o=Ae(e,n);return!o||!this._matchesSimple(o,i,n)?!1:this._matchesParents(o,t,r-1,n)}if(s==="+"){let o=Ke(e,n);return!o||!this._matchesSimple(o,i,n)?!1:this._matchesParents(o,t,r-1,n)}if(s===""){let o=Ae(e,n);for(;o;){if(this._matchesSimple(o,i,n)){if(this._matchesParents(o,t,r-1,n))return!0;if(t.simples[r-1].combinator==="")break}o=Ae(o,n)}return!1}if(s==="~"){let o=Ke(e,n);for(;o;){if(this._matchesSimple(o,i,n)){if(this._matchesParents(o,t,r-1,n))return!0;if(t.simples[r-1].combinator==="~")break}o=Ke(o,n)}return!1}if(s===">="){let o=e;for(;o;){if(this._matchesSimple(o,i,n)){if(this._matchesParents(o,t,r-1,n))return!0;if(t.simples[r-1].combinator==="")break}o=Ae(o,n)}return!1}throw new Error(`Unsupported combinator "${s}"`)})}_matchesEngine(e,t,r,n){if(e.matches)return this._callMatches(e,t,r,n);if(e.query)return this._callQuery(e,r,n).includes(t);throw new Error('Selector engine should implement "matches" or "query"')}_queryEngine(e,t,r){if(e.query)return this._callQuery(e,r,t);if(e.matches)return this._queryCSS(t,"*").filter(n=>this._callMatches(e,n,r,t));throw new Error('Selector engine should implement "matches" or "query"')}_callMatches(e,t,r,n){return this._cached(this._cacheCallMatches,t,[e,n.scope,n.pierceShadow,n.originalScope,...r],()=>e.matches(t,r,n,this))}_callQuery(e,t,r){return this._cached(this._cacheCallQuery,e,[r.scope,r.pierceShadow,r.originalScope,...t],()=>e.query(r,t,this))}_matchesCSS(e,t){return e.matches(t)}_queryCSS(e,t){return this._cached(this._cacheQueryCSS,t,[e.scope,e.pierceShadow,e.originalScope],()=>{let r=[];function n(i){if(r=r.concat([...i.querySelectorAll(t)]),!!e.pierceShadow){i.shadowRoot&&n(i.shadowRoot);for(let s of i.querySelectorAll("*"))s.shadowRoot&&n(s.shadowRoot)}}return n(e.scope),r})}_getEngine(e){let t=this._engines.get(e);if(!t)throw new Error(`Unknown selector engine "${e}"`);return t}},me={matches(e,t,r,n){if(t.length===0)throw new Error('"is" engine expects non-empty selector list');return t.some(i=>n.matches(e,i,r))},query(e,t,r){if(t.length===0)throw new Error('"is" engine expects non-empty selector list');let n=[];for(let i of t)n=n.concat(r.query(e,i));return t.length===1?n:Zr(n)}},Ii={matches(e,t,r,n){if(t.length===0)throw new Error('"has" engine expects non-empty selector list');return n.query({...r,scope:e},t).length>0}},Ri={matches(e,t,r,n){if(t.length!==0)throw new Error('"scope" engine expects no arguments');let i=r.originalScope||r.scope;return i.nodeType===9?e===i.documentElement:e===i},query(e,t,r){if(t.length!==0)throw new Error('"scope" engine expects no arguments');let n=e.originalScope||e.scope;if(n.nodeType===9){let i=n.documentElement;return i?[i]:[]}return n.nodeType===1?[n]:[]}},Oi={matches(e,t,r,n){if(t.length===0)throw new Error('"not" engine expects non-empty selector list');return!n.matches(e,t,r)}},Pi={query(e,t,r){return r.query({...e,pierceShadow:!1},t)},matches(e,t,r,n){return n.matches(e,t,{...r,pierceShadow:!1})}},qi={matches(e,t,r,n){if(t.length)throw new Error('"visible" engine expects no arguments');return J(e)}},Mi={matches(e,t,r,n){if(t.length!==1||typeof t[0]!="string")throw new Error('"text" engine expects a single string');let i=D(t[0]).toLowerCase(),s=o=>o.normalized.toLowerCase().includes(i);return Ve(n._cacheText,e,s)==="self"}},Di={matches(e,t,r,n){if(t.length!==1||typeof t[0]!="string")throw new Error('"text-is" engine expects a single string');let i=D(t[0]),s=o=>!i&&!o.immediate.length?!0:o.immediate.some(c=>D(c)===i);return Ve(n._cacheText,e,s)!=="none"}},Hi={matches(e,t,r,n){if(t.length===0||typeof t[0]!="string"||t.length>2||t.length===2&&typeof t[1]!="string")throw new Error('"text-matches" engine expects a regexp body and optional regexp flags');let i=new RegExp(t[0],t.length===2?t[1]:void 0),s=o=>i.test(o.full);return Ve(n._cacheText,e,s)==="self"}},Fi={matches(e,t,r,n){if(t.length!==1||typeof t[0]!="string")throw new Error('"has-text" engine expects a single string');if(At(e))return!1;let i=D(t[0]).toLowerCase();return(o=>o.normalized.toLowerCase().includes(i))(O(n._cacheText,e))}};function fe(e){return{matches(t,r,n,i){let s=r.length&&typeof r[r.length-1]=="number"?r[r.length-1]:void 0,o=s===void 0?r:r.slice(0,r.length-1);if(r.length<1+(s===void 0?0:1))throw new Error(`"${e}" engine expects a selector list and optional maximum distance in pixels`);let c=i.query(n,o),a=Yr(e,t,c,s);return a===void 0?!1:(i._markScore(t,a),!0)}}}var Bi={query(e,t,r){let n=t[t.length-1];if(t.length<2)throw new Error('"nth-match" engine expects non-empty selector list and an index argument');if(typeof n!="number"||n<1)throw new Error('"nth-match" engine expects a one-based index as the last argument');let i=me.query(e,t.slice(0,t.length-1),r);return n--,n<i.length?[i[n]]:[]}};function Ae(e,t){if(e!==t.scope)return t.pierceShadow?$(e):e.parentElement||void 0}function Ke(e,t){if(e!==t.scope)return e.previousElementSibling||void 0}function Zr(e){let t=new Map,r=[],n=[];function i(o){let c=t.get(o);if(c)return c;let a=$(o);return a?i(a).children.push(o):r.push(o),c={children:[],taken:!1},t.set(o,c),c}for(let o of e)i(o).taken=!0;function s(o){let c=t.get(o);if(c.taken&&n.push(o),c.children.length>1){let a=new Set(c.children);c.children=[];let l=o.firstElementChild;for(;l&&c.children.length<a.size;)a.has(l)&&c.children.push(l),l=l.nextElementSibling;for(l=o.shadowRoot?o.shadowRoot.firstElementChild:null;l&&c.children.length<a.size;)a.has(l)&&c.children.push(l),l=l.nextElementSibling}c.children.forEach(s)}return r.forEach(s),n}var at=new Map,ct=new Map,en=10,le=en/2,Ft=1,Wi=2,Ui=10,ji=50,tn=100,rn=120,nn=140,sn=160,lt=180,on=200,Vi=250,Gi=tn+le,zi=rn+le,Ji=nn+le,Qi=sn+le,Ki=lt+le,Xi=on+le,Yi=300,Zi=500,es=510,Xe=520,an=530,cn=1e4,ts=1e7,rs=1e3;function Bt(e,t,r){e._evaluator.begin(),_t();try{let n=[];if(r.forTextExpect){let o=ke(e,t.ownerDocument.documentElement,r);for(let c=t;c;c=$(c)){let a=ee(e,c,{...r,noText:!0});if(!a)continue;if(G(a)<=rs){o=a;break}}n=[Me(o)]}else{if(!t.matches("input,textarea,select")&&!t.isContentEditable){let o=ge(t,"button,select,input,[role=button],[role=checkbox],[role=radio],a,[role=link]",r.root);o&&J(o)&&(t=o)}if(r.multiple){let o=ee(e,t,r),c=ee(e,t,{...r,noText:!0}),a=[o,c];if(at.clear(),ct.clear(),o&&Ye(o)&&a.push(ee(e,t,{...r,noCSSId:!0})),c&&Ye(c)&&a.push(ee(e,t,{...r,noText:!0,noCSSId:!0})),a=a.filter(Boolean),!a.length){let l=ke(e,t,r);a.push(l),Ye(l)&&a.push(ke(e,t,{...r,noCSSId:!0}))}n=[...new Set(a.map(l=>Me(l)))]}else{let o=ee(e,t,r)||ke(e,t,r);n=[Me(o)]}}let i=n[0],s=e.parseSelector(i);return{selector:i,selectors:n,elements:e.querySelectorAll(s,r.root??t.ownerDocument)}}finally{at.clear(),ct.clear(),yt(),e._evaluator.end()}}function Wt(e){return e.filter(t=>t[0].selector[0]!=="/")}function ee(e,t,r){if(r.root&&!je(r.root,t))throw new Error("Target element must belong to the root's subtree");if(t===r.root)return[{engine:"css",selector:":scope",score:1}];if(t.ownerDocument.documentElement===t)return[{engine:"css",selector:"html",score:1}];let n=(s,o)=>{let c=s===t,a=o?is(e,s,s===t):[];s!==t&&(a=Wt(a));let l=ns(e,s,r).filter(f=>!r.omitInternalEngines||!f.engine.startsWith("internal:")).map(f=>[f]),u=Ut(e,r.root??t.ownerDocument,s,[...a,...l],c);a=Wt(a);let h=f=>{let w=o&&!f.length,d=[...f,...l].filter(p=>u?G(p)<G(u):!0),g=d[0];if(g)for(let p=$(s);p&&p!==r.root;p=$(p)){let x=i(p,w);if(!x||u&&G([...x,...g])>=G(u))continue;if(g=Ut(e,p,s,d,c),!g)return;let E=[...x,...g];(!u||G(E)<G(u))&&(u=E)}};return h(a),s===t&&a.length&&h([]),u},i=(s,o)=>{let c=o?at:ct,a=c.get(s);return a===void 0&&(a=n(s,o),c.set(s,a)),a};return n(t,!r.noText)}function ns(e,t,r){let n=[];{for(let o of["data-testid","data-test-id","data-test"])o!==r.testIdAttributeName&&t.getAttribute(o)&&n.push({engine:"css",selector:`[${o}=${ue(t.getAttribute(o))}]`,score:Wi});if(!r.noCSSId){let o=t.getAttribute("id");o&&!ss(o)&&n.push({engine:"css",selector:ln(o),score:Zi})}n.push({engine:"css",selector:H(t.nodeName.toLowerCase()),score:an})}if(t.nodeName==="IFRAME"){for(let o of["name","title"])t.getAttribute(o)&&n.push({engine:"css",selector:`${H(t.nodeName.toLowerCase())}[${o}=${ue(t.getAttribute(o))}]`,score:Ui});return t.getAttribute(r.testIdAttributeName)&&n.push({engine:"css",selector:`[${r.testIdAttributeName}=${ue(t.getAttribute(r.testIdAttributeName))}]`,score:Ft}),ut([n]),n}if(t.getAttribute(r.testIdAttributeName)&&n.push({engine:"internal:testid",selector:`[${r.testIdAttributeName}=${V(t.getAttribute(r.testIdAttributeName),!0)}]`,score:Ft}),t.nodeName==="INPUT"||t.nodeName==="TEXTAREA"){let o=t;if(o.placeholder){n.push({engine:"internal:attr",selector:`[placeholder=${V(o.placeholder,!0)}]`,score:Gi});for(let c of se(o.placeholder))n.push({engine:"internal:attr",selector:`[placeholder=${V(c.text,!1)}]`,score:tn-c.scoreBouns})}}let i=Sr(e._evaluator._cacheText,t);for(let o of i){let c=o.normalized;n.push({engine:"internal:label",selector:ie(c,!0),score:zi});for(let a of se(c))n.push({engine:"internal:label",selector:ie(a.text,!1),score:rn-a.scoreBouns})}let s=L(t);return s&&!["none","presentation"].includes(s)&&n.push({engine:"internal:role",selector:s,score:es}),t.getAttribute("name")&&["BUTTON","FORM","FIELDSET","FRAME","IFRAME","INPUT","KEYGEN","OBJECT","OUTPUT","SELECT","TEXTAREA","MAP","META","PARAM"].includes(t.nodeName)&&n.push({engine:"css",selector:`${H(t.nodeName.toLowerCase())}[name=${ue(t.getAttribute("name"))}]`,score:Xe}),["INPUT","TEXTAREA"].includes(t.nodeName)&&t.getAttribute("type")!=="hidden"&&t.getAttribute("type")&&n.push({engine:"css",selector:`${H(t.nodeName.toLowerCase())}[type=${ue(t.getAttribute("type"))}]`,score:Xe}),["INPUT","TEXTAREA","SELECT"].includes(t.nodeName)&&t.getAttribute("type")!=="hidden"&&n.push({engine:"css",selector:H(t.nodeName.toLowerCase()),score:Xe+1}),ut([n]),n}function is(e,t,r){if(t.nodeName==="SELECT")return[];let n=[],i=t.getAttribute("title");if(i){n.push([{engine:"internal:attr",selector:`[title=${V(i,!0)}]`,score:Xi}]);for(let a of se(i))n.push([{engine:"internal:attr",selector:`[title=${V(a.text,!1)}]`,score:on-a.scoreBouns}])}let s=t.getAttribute("alt");if(s&&["APPLET","AREA","IMG","INPUT"].includes(t.nodeName)){n.push([{engine:"internal:attr",selector:`[alt=${V(s,!0)}]`,score:Qi}]);for(let a of se(s))n.push([{engine:"internal:attr",selector:`[alt=${V(a.text,!1)}]`,score:sn-a.scoreBouns}])}let o=O(e._evaluator._cacheText,t).normalized;if(o){let a=se(o);if(r){o.length<=80&&n.push([{engine:"internal:text",selector:ie(o,!0),score:Ki}]);for(let u of a)n.push([{engine:"internal:text",selector:ie(u.text,!1),score:lt-u.scoreBouns}])}let l={engine:"css",selector:H(t.nodeName.toLowerCase()),score:an};for(let u of a)n.push([l,{engine:"internal:has-text",selector:ie(u.text,!1),score:lt-u.scoreBouns}]);if(o.length<=80){let u=new RegExp("^"+nt(o)+"$");n.push([l,{engine:"internal:has-text",selector:ie(u,!1),score:Vi}])}}let c=L(t);if(c&&!["none","presentation"].includes(c)){let a=oe(t,!1);if(a){n.push([{engine:"internal:role",selector:`${c}[name=${V(a,!0)}]`,score:Ji}]);for(let l of se(a))n.push([{engine:"internal:role",selector:`${c}[name=${V(l.text,!1)}]`,score:nn-l.scoreBouns}])}}return ut(n),n}function ln(e){return/^[a-zA-Z][a-zA-Z0-9\-\_]+$/.test(e)?"#"+e:`[id="${H(e)}"]`}function Ye(e){return e.some(t=>t.engine==="css"&&(t.selector.startsWith("#")||t.selector.startsWith('[id="')))}function ke(e,t,r){let n=r.root??t.ownerDocument,i=[];function s(c){let a=i.slice();c&&a.unshift(c);let l=a.join(" > "),u=e.parseSelector(l);return e.querySelector(u,n,!1)===t?l:void 0}function o(c){let a={engine:"css",selector:c,score:ts},l=e.parseSelector(c),u=e.querySelectorAll(l,n);if(u.length===1)return[a];let h={engine:"nth",selector:String(u.indexOf(t)),score:cn};return[a,h]}for(let c=t;c&&c!==n;c=$(c)){let a=c.nodeName.toLowerCase(),l="";if(c.id&&!r.noCSSId){let f=ln(c.id),w=s(f);if(w)return o(w);l=f}let u=c.parentNode,h=[...c.classList];for(let f=0;f<h.length;++f){let w="."+H(h.slice(0,f+1).join(".")),d=s(w);if(d)return o(d);!l&&u&&u.querySelectorAll(w).length===1&&(l=w)}if(u){let f=[...u.children],d=f.filter(p=>p.nodeName.toLowerCase()===a).indexOf(c)===0?H(a):`${H(a)}:nth-child(${1+f.indexOf(c)})`,g=s(d);if(g)return o(g);l||(l=d)}else l||(l=H(a));i.unshift(l)}return o(s())}function ut(e){for(let t of e)for(let r of t)r.score>ji&&r.score<Yi&&(r.score+=Math.min(en,r.selector.length/10|0))}function Me(e){let t=[],r="";for(let{engine:n,selector:i}of e)t.length&&(r!=="css"||n!=="css"||i.startsWith(":nth-match("))&&t.push(">>"),r=n,n==="css"?t.push(i):t.push(`${n}=${i}`);return t.join(" ")}function G(e){let t=0;for(let r=0;r<e.length;r++)t+=e[r].score*(e.length-r);return t}function Ut(e,t,r,n,i){let s=n.map(c=>({tokens:c,score:G(c)}));s.sort((c,a)=>c.score-a.score);let o=null;for(let{tokens:c}of s){let a=e.parseSelector(Me(c)),l=e.querySelectorAll(a,t);if(l[0]===r&&l.length===1)return c;let u=l.indexOf(r);if(!i||o||u===-1||l.length>5)continue;let h={engine:"nth",selector:String(u),score:cn};o=[...c,h]}return o}function ss(e){let t,r=0;for(let n=0;n<e.length;++n){let i=e[n],s;if(!(i==="-"||i==="_")){if(i>="a"&&i<="z"?s="lower":i>="A"&&i<="Z"?s="upper":i>="0"&&i<="9"?s="digit":s="other",s==="lower"&&t==="upper"){t=s;continue}t&&t!==s&&++r,t=s}}return r>=e.length/4}function Ne(e,t){if(e.length<=t)return e;e=e.substring(0,t);let r=e.match(/^(.*)\b(.+?)$/);return r?r[1].trimEnd():""}function se(e){let t=[];{let r=e.match(/^([\d.,]+)[^.,\w]/),n=r?r[1].length:0;if(n){let i=Ne(e.substring(n).trimStart(),80);t.push({text:i,scoreBouns:i.length<=30?2:1})}}{let r=e.match(/[^.,\w]([\d.,]+)$/),n=r?r[1].length:0;if(n){let i=Ne(e.substring(0,e.length-n).trimEnd(),80);t.push({text:i,scoreBouns:i.length<=30?2:1})}}return e.length<=30?t.push({text:e,scoreBouns:0}):(t.push({text:Ne(e,80),scoreBouns:0}),t.push({text:Ne(e,30),scoreBouns:1})),t=t.filter(r=>r.text),t.length||t.push({text:e.substring(0,80),scoreBouns:0}),t}function De(e,t,r=!1){return os(e,t,r)[0]}function os(e,t,r=!1,n=20,i){try{return re(new ds[e](i),Ge(t),r,n)}catch{return[t]}}function re(e,t,r=!1,n=20){let i=[...t.parts],s=[],o=r?"frame-locator":"page";for(let c=0;c<i.length;c++){let a=i[c],l=o;if(o="locator",a.name==="nth"){a.body==="0"?s.push([e.generateLocator(l,"first",""),e.generateLocator(l,"nth","0")]):a.body==="-1"?s.push([e.generateLocator(l,"last",""),e.generateLocator(l,"nth","-1")]):s.push([e.generateLocator(l,"nth",a.body)]);continue}if(a.name==="internal:text"){let{exact:d,text:g}=de(a.body);s.push([e.generateLocator(l,"text",g,{exact:d})]);continue}if(a.name==="internal:has-text"){let{exact:d,text:g}=de(a.body);if(!d){s.push([e.generateLocator(l,"has-text",g,{exact:d})]);continue}}if(a.name==="internal:has-not-text"){let{exact:d,text:g}=de(a.body);if(!d){s.push([e.generateLocator(l,"has-not-text",g,{exact:d})]);continue}}if(a.name==="internal:has"){let d=re(e,a.body.parsed,!1,n);s.push(d.map(g=>e.generateLocator(l,"has",g)));continue}if(a.name==="internal:has-not"){let d=re(e,a.body.parsed,!1,n);s.push(d.map(g=>e.generateLocator(l,"hasNot",g)));continue}if(a.name==="internal:and"){let d=re(e,a.body.parsed,!1,n);s.push(d.map(g=>e.generateLocator(l,"and",g)));continue}if(a.name==="internal:or"){let d=re(e,a.body.parsed,!1,n);s.push(d.map(g=>e.generateLocator(l,"or",g)));continue}if(a.name==="internal:chain"){let d=re(e,a.body.parsed,!1,n);s.push(d.map(g=>e.generateLocator(l,"chain",g)));continue}if(a.name==="internal:label"){let{exact:d,text:g}=de(a.body);s.push([e.generateLocator(l,"label",g,{exact:d})]);continue}if(a.name==="internal:role"){let d=W(a.body,!0),g={attrs:[]};for(let p of d.attributes)p.name==="name"?(g.exact=p.caseSensitive,g.name=p.value):(p.name==="level"&&typeof p.value=="string"&&(p.value=+p.value),g.attrs.push({name:p.name==="include-hidden"?"includeHidden":p.name,value:p.value}));s.push([e.generateLocator(l,"role",d.name,g)]);continue}if(a.name==="internal:testid"){let d=W(a.body,!0),{value:g}=d.attributes[0];s.push([e.generateLocator(l,"test-id",g)]);continue}if(a.name==="internal:attr"){let d=W(a.body,!0),{name:g,value:p,caseSensitive:x}=d.attributes[0],E=p,S=!!x;if(g==="placeholder"){s.push([e.generateLocator(l,"placeholder",E,{exact:S})]);continue}if(g==="alt"){s.push([e.generateLocator(l,"alt",E,{exact:S})]);continue}if(g==="title"){s.push([e.generateLocator(l,"title",E,{exact:S})]);continue}}if(a.name==="internal:control"&&a.body==="enter-frame"){let d=s[s.length-1],g=i[c-1],p=d.map(x=>e.chainLocators([x,e.generateLocator(l,"frame","")]));["xpath","css"].includes(g.name)&&p.push(e.generateLocator(l,"frame-locator",M({parts:[g]})),e.generateLocator(l,"frame-locator",M({parts:[g]},!0))),d.splice(0,d.length,...p),o="frame-locator";continue}let u=i[c+1],h=M({parts:[a]}),f=e.generateLocator(l,"default",h);if(u&&["internal:has-text","internal:has-not-text"].includes(u.name)){let{exact:d,text:g}=de(u.body);if(!d){let p=e.generateLocator("locator",u.name==="internal:has-text"?"has-text":"has-not-text",g,{exact:d}),x={};u.name==="internal:has-text"?x.hasText=g:x.hasNotText=g;let E=e.generateLocator(l,"default",h,x);s.push([e.chainLocators([f,p]),E]),c++;continue}}let w;if(["xpath","css"].includes(a.name)){let d=M({parts:[a]},!0);w=e.generateLocator(l,"default",d)}s.push([f,w].filter(Boolean))}return as(e,s,n)}function as(e,t,r){let n=t.map(()=>""),i=[],s=o=>{if(o===t.length)return i.push(e.chainLocators(n)),n.length<r;for(let c of t[o])if(n[o]=c,!s(o+1))return!1;return!0};return s(0),i}function de(e){let t=!1,r=e.match(/^\/(.*)\/([igm]*)$/);return r?{text:new RegExp(r[1],r[2])}:(e.endsWith('"')?(e=JSON.parse(e),t=!0):e.endsWith('"s')?(e=JSON.parse(e.substring(0,e.length-1)),t=!0):e.endsWith('"i')&&(e=JSON.parse(e.substring(0,e.length-1)),t=!1),{exact:t,text:e})}var cs=class{constructor(e){this.preferredQuote=e}generateLocator(e,t,r,n={}){switch(t){case"default":return n.hasText!==void 0?`locator(${this.quote(r)}, { hasText: ${this.toHasText(n.hasText)} })`:n.hasNotText!==void 0?`locator(${this.quote(r)}, { hasNotText: ${this.toHasText(n.hasNotText)} })`:`locator(${this.quote(r)})`;case"frame-locator":return`frameLocator(${this.quote(r)})`;case"frame":return"contentFrame()";case"nth":return`nth(${r})`;case"first":return"first()";case"last":return"last()";case"role":let i=[];A(n.name)?i.push(`name: ${this.regexToSourceString(n.name)}`):typeof n.name=="string"&&(i.push(`name: ${this.quote(n.name)}`),n.exact&&i.push("exact: true"));for(let{name:o,value:c}of n.attrs)i.push(`${o}: ${typeof c=="string"?this.quote(c):c}`);let s=i.length?`, { ${i.join(", ")} }`:"";return`getByRole(${this.quote(r)}${s})`;case"has-text":return`filter({ hasText: ${this.toHasText(r)} })`;case"has-not-text":return`filter({ hasNotText: ${this.toHasText(r)} })`;case"has":return`filter({ has: ${r} })`;case"hasNot":return`filter({ hasNot: ${r} })`;case"and":return`and(${r})`;case"or":return`or(${r})`;case"chain":return`locator(${r})`;case"test-id":return`getByTestId(${this.toTestIdValue(r)})`;case"text":return this.toCallWithExact("getByText",r,!!n.exact);case"alt":return this.toCallWithExact("getByAltText",r,!!n.exact);case"placeholder":return this.toCallWithExact("getByPlaceholder",r,!!n.exact);case"label":return this.toCallWithExact("getByLabel",r,!!n.exact);case"title":return this.toCallWithExact("getByTitle",r,!!n.exact);default:throw new Error("Unknown selector kind "+t)}}chainLocators(e){return e.join(".")}regexToSourceString(e){return xe(String(e))}toCallWithExact(e,t,r){return A(t)?`${e}(${this.regexToSourceString(t)})`:r?`${e}(${this.quote(t)}, { exact: true })`:`${e}(${this.quote(t)})`}toHasText(e){return A(e)?this.regexToSourceString(e):this.quote(e)}toTestIdValue(e){return A(e)?this.regexToSourceString(e):this.quote(e)}quote(e){return we(e,this.preferredQuote??"'")}},ls=class{generateLocator(e,t,r,n={}){switch(t){case"default":return n.hasText!==void 0?`locator(${this.quote(r)}, has_text=${this.toHasText(n.hasText)})`:n.hasNotText!==void 0?`locator(${this.quote(r)}, has_not_text=${this.toHasText(n.hasNotText)})`:`locator(${this.quote(r)})`;case"frame-locator":return`frame_locator(${this.quote(r)})`;case"frame":return"content_frame";case"nth":return`nth(${r})`;case"first":return"first";case"last":return"last";case"role":let i=[];A(n.name)?i.push(`name=${this.regexToString(n.name)}`):typeof n.name=="string"&&(i.push(`name=${this.quote(n.name)}`),n.exact&&i.push("exact=True"));for(let{name:o,value:c}of n.attrs){let a=typeof c=="string"?this.quote(c):c;typeof c=="boolean"&&(a=c?"True":"False"),i.push(`${er(o)}=${a}`)}let s=i.length?`, ${i.join(", ")}`:"";return`get_by_role(${this.quote(r)}${s})`;case"has-text":return`filter(has_text=${this.toHasText(r)})`;case"has-not-text":return`filter(has_not_text=${this.toHasText(r)})`;case"has":return`filter(has=${r})`;case"hasNot":return`filter(has_not=${r})`;case"and":return`and_(${r})`;case"or":return`or_(${r})`;case"chain":return`locator(${r})`;case"test-id":return`get_by_test_id(${this.toTestIdValue(r)})`;case"text":return this.toCallWithExact("get_by_text",r,!!n.exact);case"alt":return this.toCallWithExact("get_by_alt_text",r,!!n.exact);case"placeholder":return this.toCallWithExact("get_by_placeholder",r,!!n.exact);case"label":return this.toCallWithExact("get_by_label",r,!!n.exact);case"title":return this.toCallWithExact("get_by_title",r,!!n.exact);default:throw new Error("Unknown selector kind "+t)}}chainLocators(e){return e.join(".")}regexToString(e){let t=e.flags.includes("i")?", re.IGNORECASE":"";return`re.compile(r"${xe(e.source).replace(/\\\//,"/").replace(/"/g,'\\"')}"${t})`}toCallWithExact(e,t,r){return A(t)?`${e}(${this.regexToString(t)})`:r?`${e}(${this.quote(t)}, exact=True)`:`${e}(${this.quote(t)})`}toHasText(e){return A(e)?this.regexToString(e):`${this.quote(e)}`}toTestIdValue(e){return A(e)?this.regexToString(e):this.quote(e)}quote(e){return we(e,'"')}},us=class{generateLocator(e,t,r,n={}){let i;switch(e){case"page":i="Page";break;case"frame-locator":i="FrameLocator";break;case"locator":i="Locator";break}switch(t){case"default":return n.hasText!==void 0?`locator(${this.quote(r)}, new ${i}.LocatorOptions().setHasText(${this.toHasText(n.hasText)}))`:n.hasNotText!==void 0?`locator(${this.quote(r)}, new ${i}.LocatorOptions().setHasNotText(${this.toHasText(n.hasNotText)}))`:`locator(${this.quote(r)})`;case"frame-locator":return`frameLocator(${this.quote(r)})`;case"frame":return"contentFrame()";case"nth":return`nth(${r})`;case"first":return"first()";case"last":return"last()";case"role":let s=[];A(n.name)?s.push(`.setName(${this.regexToString(n.name)})`):typeof n.name=="string"&&(s.push(`.setName(${this.quote(n.name)})`),n.exact&&s.push(".setExact(true)"));for(let{name:c,value:a}of n.attrs)s.push(`.set${He(c)}(${typeof a=="string"?this.quote(a):a})`);let o=s.length?`, new ${i}.GetByRoleOptions()${s.join("")}`:"";return`getByRole(AriaRole.${er(r).toUpperCase()}${o})`;case"has-text":return`filter(new ${i}.FilterOptions().setHasText(${this.toHasText(r)}))`;case"has-not-text":return`filter(new ${i}.FilterOptions().setHasNotText(${this.toHasText(r)}))`;case"has":return`filter(new ${i}.FilterOptions().setHas(${r}))`;case"hasNot":return`filter(new ${i}.FilterOptions().setHasNot(${r}))`;case"and":return`and(${r})`;case"or":return`or(${r})`;case"chain":return`locator(${r})`;case"test-id":return`getByTestId(${this.toTestIdValue(r)})`;case"text":return this.toCallWithExact(i,"getByText",r,!!n.exact);case"alt":return this.toCallWithExact(i,"getByAltText",r,!!n.exact);case"placeholder":return this.toCallWithExact(i,"getByPlaceholder",r,!!n.exact);case"label":return this.toCallWithExact(i,"getByLabel",r,!!n.exact);case"title":return this.toCallWithExact(i,"getByTitle",r,!!n.exact);default:throw new Error("Unknown selector kind "+t)}}chainLocators(e){return e.join(".")}regexToString(e){let t=e.flags.includes("i")?", Pattern.CASE_INSENSITIVE":"";return`Pattern.compile(${this.quote(xe(e.source))}${t})`}toCallWithExact(e,t,r,n){return A(r)?`${t}(${this.regexToString(r)})`:n?`${t}(${this.quote(r)}, new ${e}.${He(t)}Options().setExact(true))`:`${t}(${this.quote(r)})`}toHasText(e){return A(e)?this.regexToString(e):this.quote(e)}toTestIdValue(e){return A(e)?this.regexToString(e):this.quote(e)}quote(e){return we(e,'"')}},hs=class{generateLocator(e,t,r,n={}){switch(t){case"default":return n.hasText!==void 0?`Locator(${this.quote(r)}, new() { ${this.toHasText(n.hasText)} })`:n.hasNotText!==void 0?`Locator(${this.quote(r)}, new() { ${this.toHasNotText(n.hasNotText)} })`:`Locator(${this.quote(r)})`;case"frame-locator":return`FrameLocator(${this.quote(r)})`;case"frame":return"ContentFrame";case"nth":return`Nth(${r})`;case"first":return"First";case"last":return"Last";case"role":let i=[];A(n.name)?i.push(`NameRegex = ${this.regexToString(n.name)}`):typeof n.name=="string"&&(i.push(`Name = ${this.quote(n.name)}`),n.exact&&i.push("Exact = true"));for(let{name:o,value:c}of n.attrs)i.push(`${He(o)} = ${typeof c=="string"?this.quote(c):c}`);let s=i.length?`, new() { ${i.join(", ")} }`:"";return`GetByRole(AriaRole.${He(r)}${s})`;case"has-text":return`Filter(new() { ${this.toHasText(r)} })`;case"has-not-text":return`Filter(new() { ${this.toHasNotText(r)} })`;case"has":return`Filter(new() { Has = ${r} })`;case"hasNot":return`Filter(new() { HasNot = ${r} })`;case"and":return`And(${r})`;case"or":return`Or(${r})`;case"chain":return`Locator(${r})`;case"test-id":return`GetByTestId(${this.toTestIdValue(r)})`;case"text":return this.toCallWithExact("GetByText",r,!!n.exact);case"alt":return this.toCallWithExact("GetByAltText",r,!!n.exact);case"placeholder":return this.toCallWithExact("GetByPlaceholder",r,!!n.exact);case"label":return this.toCallWithExact("GetByLabel",r,!!n.exact);case"title":return this.toCallWithExact("GetByTitle",r,!!n.exact);default:throw new Error("Unknown selector kind "+t)}}chainLocators(e){return e.join(".")}regexToString(e){let t=e.flags.includes("i")?", RegexOptions.IgnoreCase":"";return`new Regex(${this.quote(xe(e.source))}${t})`}toCallWithExact(e,t,r){return A(t)?`${e}(${this.regexToString(t)})`:r?`${e}(${this.quote(t)}, new() { Exact = true })`:`${e}(${this.quote(t)})`}toHasText(e){return A(e)?`HasTextRegex = ${this.regexToString(e)}`:`HasText = ${this.quote(e)}`}toTestIdValue(e){return A(e)?this.regexToString(e):this.quote(e)}toHasNotText(e){return A(e)?`HasNotTextRegex = ${this.regexToString(e)}`:`HasNotText = ${this.quote(e)}`}quote(e){return we(e,'"')}},fs=class{generateLocator(e,t,r,n={}){return JSON.stringify({kind:t,body:r,options:n})}chainLocators(e){let t=e.map(r=>JSON.parse(r));for(let r=0;r<t.length-1;++r)t[r].next=t[r+1];return JSON.stringify(t[0])}},ds={javascript:cs,python:ls,java:us,csharp:hs,jsonl:fs};function A(e){return e instanceof RegExp}var jt=Ln($n()),Ze=class{constructor(e){this._highlightEntries=[],this._highlightOptions={},this._language="javascript",this._injectedScript=e;let t=e.document;this._isUnderTest=e.isUnderTest,this._glassPaneElement=t.createElement("x-pw-glass"),this._glassPaneElement.style.position="fixed",this._glassPaneElement.style.top="0",this._glassPaneElement.style.right="0",this._glassPaneElement.style.bottom="0",this._glassPaneElement.style.left="0",this._glassPaneElement.style.zIndex="2147483646",this._glassPaneElement.style.pointerEvents="none",this._glassPaneElement.style.display="flex",this._glassPaneElement.style.backgroundColor="transparent";for(let r of["click","auxclick","dragstart","input","keydown","keyup","pointerdown","pointerup","mousedown","mouseup","mouseleave","focus","scroll"])this._glassPaneElement.addEventListener(r,n=>{n.stopPropagation(),n.stopImmediatePropagation(),n.type==="click"&&n.button===0&&this._highlightOptions.tooltipListItemSelected&&this._highlightOptions.tooltipListItemSelected(void 0)});if(this._actionPointElement=t.createElement("x-pw-action-point"),this._actionPointElement.setAttribute("hidden","true"),this._glassPaneShadow=this._glassPaneElement.attachShadow({mode:this._isUnderTest?"open":"closed"}),typeof this._glassPaneShadow.adoptedStyleSheets.push=="function"){let r=new this._injectedScript.window.CSSStyleSheet;r.replaceSync(jt.default),this._glassPaneShadow.adoptedStyleSheets.push(r)}else{let r=this._injectedScript.document.createElement("style");r.textContent=jt.default,this._glassPaneShadow.appendChild(r)}this._glassPaneShadow.appendChild(this._actionPointElement)}install(){this._injectedScript.document.documentElement&&!this._injectedScript.document.documentElement.contains(this._glassPaneElement)&&this._injectedScript.document.documentElement.appendChild(this._glassPaneElement)}setLanguage(e){this._language=e}runHighlightOnRaf(e){this._rafRequest&&cancelAnimationFrame(this._rafRequest),this.updateHighlight(this._injectedScript.querySelectorAll(e,this._injectedScript.document.documentElement),{tooltipText:De(this._language,M(e))}),this._rafRequest=this._injectedScript.builtinRequestAnimationFrame(()=>this.runHighlightOnRaf(e))}uninstall(){this._rafRequest&&cancelAnimationFrame(this._rafRequest),this._glassPaneElement.remove()}showActionPoint(e,t){this._actionPointElement.style.top=t+"px",this._actionPointElement.style.left=e+"px",this._actionPointElement.hidden=!1}hideActionPoint(){this._actionPointElement.hidden=!0}clearHighlight(){for(let e of this._highlightEntries)e.highlightElement?.remove(),e.tooltipElement?.remove();this._highlightEntries=[],this._highlightOptions={},this._glassPaneElement.style.pointerEvents="none"}updateHighlight(e,t){this._innerUpdateHighlight(e,t)}maskElements(e,t){this._innerUpdateHighlight(e,{color:t})}_innerUpdateHighlight(e,t){let r=t.color;if(r||(r=e.length>1?"#f6b26b7f":"#6fa8dc7f"),!this._highlightIsUpToDate(e,t)){this.clearHighlight(),this._highlightOptions=t,this._glassPaneElement.style.pointerEvents=t.tooltipListItemSelected?"initial":"none";for(let n=0;n<e.length;++n){let i=this._createHighlightElement();this._glassPaneShadow.appendChild(i);let s;if(t.tooltipList||t.tooltipText||t.tooltipFooter){s=this._injectedScript.document.createElement("x-pw-tooltip"),this._glassPaneShadow.appendChild(s),s.style.top="0",s.style.left="0",s.style.display="flex";let o=[];if(t.tooltipList)o=t.tooltipList;else if(t.tooltipText){let c=e.length>1?` [${n+1} of ${e.length}]`:"";o=[t.tooltipText+c]}for(let c=0;c<o.length;c++){let a=this._injectedScript.document.createElement("x-pw-tooltip-line");a.textContent=o[c],s.appendChild(a),t.tooltipListItemSelected&&(a.classList.add("selectable"),a.addEventListener("click",()=>t.tooltipListItemSelected?.(c)))}if(t.tooltipFooter){let c=this._injectedScript.document.createElement("x-pw-tooltip-footer");c.textContent=t.tooltipFooter,s.appendChild(c)}}this._highlightEntries.push({targetElement:e[n],tooltipElement:s,highlightElement:i})}for(let n of this._highlightEntries){if(n.box=n.targetElement.getBoundingClientRect(),!n.tooltipElement)continue;let{anchorLeft:i,anchorTop:s}=this.tooltipPosition(n.box,n.tooltipElement);n.tooltipTop=s,n.tooltipLeft=i}for(let n of this._highlightEntries){n.tooltipElement&&(n.tooltipElement.style.top=n.tooltipTop+"px",n.tooltipElement.style.left=n.tooltipLeft+"px");let i=n.box;n.highlightElement.style.backgroundColor=r,n.highlightElement.style.left=i.x+"px",n.highlightElement.style.top=i.y+"px",n.highlightElement.style.width=i.width+"px",n.highlightElement.style.height=i.height+"px",n.highlightElement.style.display="block",this._isUnderTest&&console.error("Highlight box for test: "+JSON.stringify({x:i.x,y:i.y,width:i.width,height:i.height}))}}}firstBox(){return this._highlightEntries[0]?.box}tooltipPosition(e,t){let r=t.offsetWidth,n=t.offsetHeight,i=this._glassPaneElement.offsetWidth,s=this._glassPaneElement.offsetHeight,o=e.left;o+r>i-5&&(o=i-r-5);let c=e.bottom+5;return c+n>s-5&&(e.top>n+5?c=e.top-n-5:c=s-5-n),{anchorLeft:o,anchorTop:c}}_highlightIsUpToDate(e,t){if(t.tooltipText!==this._highlightOptions.tooltipText||t.tooltipListItemSelected!==this._highlightOptions.tooltipListItemSelected||t.tooltipFooter!==this._highlightOptions.tooltipFooter||t.tooltipList?.length!==this._highlightOptions.tooltipList?.length)return!1;if(t.tooltipList&&this._highlightOptions.tooltipList){for(let r=0;r<t.tooltipList.length;r++)if(t.tooltipList[r]!==this._highlightOptions.tooltipList[r])return!1}if(e.length!==this._highlightEntries.length)return!1;for(let r=0;r<this._highlightEntries.length;++r){if(e[r]!==this._highlightEntries[r].targetElement)return!1;let n=this._highlightEntries[r].box;if(!n)return!1;let i=e[r].getBoundingClientRect();if(i.top!==n.top||i.right!==n.right||i.bottom!==n.bottom||i.left!==n.left)return!1}return!0}_createHighlightElement(){return this._injectedScript.document.createElement("x-pw-highlight")}appendChild(e){this._glassPaneShadow.appendChild(e)}};function ps(e){return un(e)?"'"+e.replace(/'/g,"''")+"'":e}function Vt(e){return un(e)?'"'+e.replace(/[\\"\x00-\x1f\x7f-\x9f]/g,t=>{switch(t){case"\\":return"\\\\";case'"':return'\\"';case"\b":return"\\b";case"\f":return"\\f";case`
|
|
316
|
+
`:return"\\n";case"\r":return"\\r";case" ":return"\\t";default:return"\\x"+t.charCodeAt(0).toString(16).padStart(2,"0")}})+'"':e}function un(e){return!!(e.length===0||/^\s|\s$/.test(e)||/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f-\x9f]/.test(e)||/^-\s/.test(e)||/^[&*\],].*/.test(e)||/:(\s|$)/.test(e)||/\s#/.test(e)||/[\n\r]/.test(e)||/^[?!]/.test(e)||/^[>|]/.test(e)||/^["']/.test(e)||/[{}`]/.test(e))}function Ue(e){let t=new Set,r={root:{role:"fragment",name:"",children:[],element:e},elements:new Map,ids:new Map},n=o=>{let c=r.elements.size+1;r.elements.set(c,o),r.ids.set(o,c)};n(e);let i=(o,c)=>{if(t.has(c))return;if(t.add(c),c.nodeType===Node.TEXT_NODE&&c.nodeValue){c.nodeValue&&o.children.push(c.nodeValue||"");return}if(c.nodeType!==Node.ELEMENT_NODE)return;let a=c;if(F(a))return;let l=[];if(a.hasAttribute("aria-owns")){let h=a.getAttribute("aria-owns").split(/\s+/);for(let f of h){let w=e.ownerDocument.getElementById(f);w&&l.push(w)}}n(a);let u=gs(a);u&&o.children.push(u),s(u||o,a,l)};function s(o,c,a=[]){let u=(Q(c)?.display||"inline")!=="inline"||c.nodeName==="BR"?" ":"";u&&o.children.push(u),o.children.push(Be(c,"::before"));let h=c.nodeName==="SLOT"?c.assignedNodes():[];if(h.length)for(let f of h)i(o,f);else{for(let f=c.firstChild;f;f=f.nextSibling)f.assignedSlot||i(o,f);if(c.shadowRoot)for(let f=c.shadowRoot.firstChild;f;f=f.nextSibling)i(o,f)}for(let f of a)i(o,f);o.children.push(Be(c,"::after")),u&&o.children.push(u),o.children.length===1&&o.name===o.children[0]&&(o.children=[])}_t();try{i(r.root,e)}finally{yt()}return ms(r.root),r}function gs(e){let t=L(e);if(!t||t==="presentation"||t==="none")return null;let r=oe(e,!1)||"",n={role:t,name:r,children:[],element:e};return dt.includes(t)&&(n.checked=ur(e)),gr.includes(t)&&(n.disabled=bt(e)),gt.includes(t)&&(n.expanded=dr(e)),mt.includes(t)&&(n.level=pr(e)),pt.includes(t)&&(n.pressed=fr(e)),ft.includes(t)&&(n.selected=lr(e)),(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&(n.children=[e.value]),n}function ms(e){let t=(n,i)=>{if(!n.length)return;let s=bs(n.join("")).trim();s&&i.push(s),n.length=0},r=n=>{let i=[],s=[];for(let o of n.children||[])typeof o=="string"?s.push(o):(t(s,i),r(o),i.push(o));t(s,i),n.children=i.length?i:[],n.children.length===1&&n.children[0]===n.name&&(n.children=[])};r(e)}var bs=e=>e.replace(/[\u200b\s\t\r\n]+/g," ");function hn(e,t){return t?e?typeof t=="string"?e===t:!!e.match(t):!1:!0}function ws(e,t){return hn(e,t.text)}function xs(e,t){return hn(e,t.name)}function vs(e,t){let r=Ue(e).root;return{matches:dn(r,t,!1),received:{raw:be(r,{mode:"raw"}),regex:be(r,{mode:"regex"})}}}function Es(e,t){let r=Ue(e).root;return dn(r,t,!0).map(i=>i.element)}function fn(e,t,r){return typeof e=="string"&&t.kind==="text"?ws(e,t):typeof e=="object"&&t.kind==="role"?!(t.role!=="fragment"&&t.role!==e.role||t.checked!==void 0&&t.checked!==e.checked||t.disabled!==void 0&&t.disabled!==e.disabled||t.expanded!==void 0&&t.expanded!==e.expanded||t.level!==void 0&&t.level!==e.level||t.pressed!==void 0&&t.pressed!==e.pressed||t.selected!==void 0&&t.selected!==e.selected||!xs(e.name,t)||!Ss(e.children||[],t.children||[],r)):!1}function Ss(e,t,r){if(t.length>e.length)return!1;let n=e.slice(),i=t.slice();for(let s of i){let o=n.shift();for(;o&&!fn(o,s,r+1);)o=n.shift();if(!o)return!1}return!0}function dn(e,t,r){let n=[],i=s=>{if(fn(s,t,0))return n.push(s),!r;if(typeof s=="string")return!1;for(let o of s.children||[])if(i(o))return!0;return!1};return i(e),n}function be(e,t){let r=[],n=t?.mode==="regex"?_s:()=>!0,i=t?.mode==="regex"?Ts:o=>o,s=(o,c,a)=>{if(typeof o=="string"){if(c&&!n(c,o))return;let h=Vt(i(o));h&&r.push(a+"- text: "+h);return}let l=o.role;if(o.name&&o.name.length<=900){let h=i(o.name);if(h){let f=h.startsWith("/")&&h.endsWith("/")?h:JSON.stringify(h);l+=" "+f}}if(o.checked==="mixed"&&(l+=" [checked=mixed]"),o.checked===!0&&(l+=" [checked]"),o.disabled&&(l+=" [disabled]"),o.expanded&&(l+=" [expanded]"),o.level&&(l+=` [level=${o.level}]`),o.pressed==="mixed"&&(l+=" [pressed=mixed]"),o.pressed===!0&&(l+=" [pressed]"),o.selected===!0&&(l+=" [selected]"),t?.ids){let h=t?.ids.get(o.element);h&&(l+=` [id=${h}]`)}let u=a+"- "+ps(l);if(!o.children.length)r.push(u);else if(o.children.length===1&&typeof o.children[0]=="string"){let h=n(o,o.children[0])?i(o.children[0]):null;h?r.push(u+": "+Vt(h)):r.push(u)}else{r.push(u+":");for(let h of o.children||[])s(h,o,a+" ")}};if(e.role==="fragment")for(let o of e.children||[])s(o,e,"");else s(e,null,"");return r.join(`
|
|
317
|
+
`)}function Ts(e){let t=[{regex:/\b[\d,.]+[bkmBKM]+\b/,replacement:"[\\d,.]+[bkmBKM]+"},{regex:/\b\d+[hmsp]+\b/,replacement:"\\d+[hmsp]+"},{regex:/\b[\d,.]+[hmsp]+\b/,replacement:"[\\d,.]+[hmsp]+"},{regex:/\b\d+,\d+\b/,replacement:"\\d+,\\d+"},{regex:/\b\d+\.\d{2,}\b/,replacement:"\\d+\\.\\d+"},{regex:/\b\d{2,}\.\d+\b/,replacement:"\\d+\\.\\d+"},{regex:/\b\d{2,}\b/,replacement:"\\d+"}],r="",n=0,i=new RegExp(t.map(s=>"("+s.regex.source+")").join("|"),"g");return e.replace(i,(s,...o)=>{let c=o[o.length-2],a=o.slice(0,-2);r+=nt(e.slice(n,c));for(let l=0;l<a.length;l++)if(a[l]){let{replacement:u}=t[l];r+=u;break}return n=c+s.length,s}),r?(r+=nt(e.slice(n)),String(new RegExp(r))):e}function _s(e,t){if(!t.length)return!1;if(!e.name)return!0;if(e.name.length>t.length)return!1;let r=t.length<=200&&e.name.length<=200?qn(t,e.name):"",n=t;for(;r&&n.includes(r);)n=n.replace(r,"");return n.trim().length/t.length>.1}function ys(e){let t={kind:"role",role:"fragment"};return pn(t,e),t.children&&t.children.length===1?t.children[0]:t}function pn(e,t){for(let r of t){if(typeof r=="string"){let n=Gt.parse(r);e.children=e.children||[],e.children.push(n);continue}for(let n of Object.keys(r)){e.children=e.children||[];let i=r[n];if(n==="text"){e.children.push({kind:"text",text:et(i)});continue}let s=Gt.parse(n);if(s.kind==="text"){e.children.push({kind:"text",text:et(i)});continue}if(typeof i=="string"){e.children.push({...s,children:[{kind:"text",text:et(i)}]});continue}e.children.push(s),pn(s,i)}}}function As(e){return e.replace(/[\r\n\s\t]+/g," ").trim()}function et(e){return e.startsWith("/")&&e.endsWith("/")?new RegExp(e.slice(1,-1)):As(e)}var Gt=class gn{static parse(t){return new gn(t)._parse()}constructor(t){this._input=t,this._pos=0,this._length=t.length}_peek(){return this._input[this._pos]||""}_next(){return this._pos<this._length?this._input[this._pos++]:null}_eof(){return this._pos>=this._length}_isWhitespace(){return!this._eof()&&/\s/.test(this._peek())}_skipWhitespace(){for(;this._isWhitespace();)this._pos++}_readIdentifier(t){this._eof()&&this._throwError(`Unexpected end of input when expecting ${t}`);let r=this._pos;for(;!this._eof()&&/[a-zA-Z]/.test(this._peek());)this._pos++;return this._input.slice(r,this._pos)}_readString(){let t="",r=!1;for(;!this._eof();){let n=this._next();if(r)t+=n,r=!1;else if(n==="\\")r=!0;else{if(n==='"')return t;t+=n}}this._throwError("Unterminated string")}_throwError(t,r){throw new ks(t,this._input,r||this._pos)}_readRegex(){let t="",r=!1,n=!1;for(;!this._eof();){let i=this._next();if(r)t+=i,r=!1;else if(i==="\\")r=!0,t+=i;else{if(i==="/"&&!n)return t;i==="["?(n=!0,t+=i):i==="]"&&n?(t+=i,n=!1):t+=i}}this._throwError("Unterminated regex")}_readStringOrRegex(){let t=this._peek();return t==='"'?(this._next(),this._readString()):t==="/"?(this._next(),new RegExp(this._readRegex())):null}_readAttributes(t){let r=this._pos;for(;this._skipWhitespace(),this._peek()==="[";){this._next(),this._skipWhitespace(),r=this._pos;let n=this._readIdentifier("attribute");this._skipWhitespace();let i="";if(this._peek()==="=")for(this._next(),this._skipWhitespace(),r=this._pos;this._peek()!=="]"&&!this._isWhitespace()&&!this._eof();)i+=this._next();this._skipWhitespace(),this._peek()!=="]"&&this._throwError("Expected ]"),this._next(),this._applyAttribute(t,n,i||"true",r)}}_parse(){this._skipWhitespace();let t=this._readIdentifier("role");this._skipWhitespace();let r=this._readStringOrRegex()||"",n={kind:"role",role:t,name:r};return this._readAttributes(n),this._skipWhitespace(),this._eof()||this._throwError("Unexpected input"),n}_applyAttribute(t,r,n,i){if(r==="checked"){this._assert(n==="true"||n==="false"||n==="mixed",'Value of "checked" attribute must be a boolean or "mixed"',i),t.checked=n==="true"?!0:n==="false"?!1:"mixed";return}if(r==="disabled"){this._assert(n==="true"||n==="false",'Value of "disabled" attribute must be a boolean',i),t.disabled=n==="true";return}if(r==="expanded"){this._assert(n==="true"||n==="false",'Value of "expanded" attribute must be a boolean',i),t.expanded=n==="true";return}if(r==="level"){this._assert(!isNaN(Number(n)),'Value of "level" attribute must be a number',i),t.level=Number(n);return}if(r==="pressed"){this._assert(n==="true"||n==="false"||n==="mixed",'Value of "pressed" attribute must be a boolean or "mixed"',i),t.pressed=n==="true"?!0:n==="false"?!1:"mixed";return}if(r==="selected"){this._assert(n==="true"||n==="false",'Value of "selected" attribute must be a boolean',i),t.selected=n==="true";return}this._assert(!1,`Unsupported attribute [${r}]`,i)}_assert(t,r,n){t||this._throwError(r||"Assertion error",n)}},ks=class extends Error{constructor(e,t,r){super(e+`:
|
|
318
|
+
|
|
319
|
+
`+t+`
|
|
320
|
+
`+" ".repeat(r)+`^
|
|
321
|
+
`),this.shortMessage=e,this.pos=r,this.stack=void 0}},Ns=class{constructor(e,t,r,n,i,s,o){this.onGlobalListenersRemoved=new Set,this._testIdAttributeNameForStrictErrorAndConsoleCodegen="data-testid",this.utils={asLocator:De,cacheNormalizedWhitespaces:On,elementText:O,getAriaRole:L,getElementAccessibleDescription:Pt,getElementAccessibleName:oe,isElementVisible:J,isInsideScope:je,normalizeWhiteSpace:D,parseYamlTemplate:ys},this.window=e,this.document=e.document,this.isUnderTest=t,this._sdkLanguage=r,this._testIdAttributeNameForStrictErrorAndConsoleCodegen=n,this._evaluator=new $i(new Map),this._engines=new Map,this._engines.set("xpath",Ct),this._engines.set("xpath:light",Ct),this._engines.set("_react",bi),this._engines.set("_vue",Si),this._engines.set("role",Ht(!1)),this._engines.set("text",this._createTextEngine(!0,!1)),this._engines.set("text:light",this._createTextEngine(!1,!1)),this._engines.set("id",this._createAttributeEngine("id",!0)),this._engines.set("id:light",this._createAttributeEngine("id",!1)),this._engines.set("data-testid",this._createAttributeEngine("data-testid",!0)),this._engines.set("data-testid:light",this._createAttributeEngine("data-testid",!1)),this._engines.set("data-test-id",this._createAttributeEngine("data-test-id",!0)),this._engines.set("data-test-id:light",this._createAttributeEngine("data-test-id",!1)),this._engines.set("data-test",this._createAttributeEngine("data-test",!0)),this._engines.set("data-test:light",this._createAttributeEngine("data-test",!1)),this._engines.set("css",this._createCSSEngine()),this._engines.set("nth",{queryAll:()=>[]}),this._engines.set("visible",this._createVisibleEngine()),this._engines.set("internal:control",this._createControlEngine()),this._engines.set("internal:has",this._createHasEngine()),this._engines.set("internal:has-not",this._createHasNotEngine()),this._engines.set("internal:and",{queryAll:()=>[]}),this._engines.set("internal:or",{queryAll:()=>[]}),this._engines.set("internal:chain",this._createInternalChainEngine()),this._engines.set("internal:label",this._createInternalLabelEngine()),this._engines.set("internal:text",this._createTextEngine(!0,!0)),this._engines.set("internal:has-text",this._createInternalHasTextEngine()),this._engines.set("internal:has-not-text",this._createInternalHasNotTextEngine()),this._engines.set("internal:attr",this._createNamedAttributeEngine()),this._engines.set("internal:testid",this._createNamedAttributeEngine()),this._engines.set("internal:role",Ht(!0));for(let{name:c,engine:a}of o)this._engines.set(c,a);this._stableRafCount=i,this._browserName=s,In(s),this._setupGlobalListenersRemovalDetection(),this._setupHitTargetInterceptors(),t&&(this.window.__injectedScript=this)}builtinSetTimeout(e,t){return this.window.__pwClock?.builtin?this.window.__pwClock.builtin.setTimeout(e,t):this.window.setTimeout(e,t)}builtinClearTimeout(e){return this.window.__pwClock?.builtin?this.window.__pwClock.builtin.clearTimeout(e):this.window.clearTimeout(e)}builtinRequestAnimationFrame(e){return this.window.__pwClock?.builtin?this.window.__pwClock.builtin.requestAnimationFrame(e):this.window.requestAnimationFrame(e)}eval(e){return this.window.eval(e)}testIdAttributeNameForStrictErrorAndConsoleCodegen(){return this._testIdAttributeNameForStrictErrorAndConsoleCodegen}parseSelector(e){let t=Ge(e);return hi(t,r=>{if(!this._engines.has(r.name))throw this.createStacklessError(`Unknown engine "${r.name}" while parsing selector ${e}`)}),t}generateSelector(e,t){return Bt(this,e,t)}generateSelectorSimple(e,t){return Bt(this,e,{...t,testIdAttributeName:this._testIdAttributeNameForStrictErrorAndConsoleCodegen}).selector}querySelector(e,t,r){let n=this.querySelectorAll(e,t);if(r&&n.length>1)throw this.strictModeViolationError(e,n);return n[0]}_queryNth(e,t){let r=[...e],n=+t.body;return n===-1&&(n=r.length-1),new Set(r.slice(n,n+1))}_queryLayoutSelector(e,t,r){let n=t.name,i=t.body,s=[],o=this.querySelectorAll(i.parsed,r);for(let c of e){let a=Yr(n,c,o,i.distance);a!==void 0&&s.push({element:c,score:a})}return s.sort((c,a)=>c.score-a.score),new Set(s.map(c=>c.element))}ariaSnapshot(e,t){if(e.nodeType!==Node.ELEMENT_NODE)throw this.createStacklessError("Can only capture aria snapshot of Element nodes.");let r=Ue(e);return be(r.root,t)}ariaSnapshotAsObject(e){return Ue(e)}ariaSnapshotElement(e,t){return e.elements.get(t)||null}renderAriaTree(e,t){return be(e,t)}renderAriaSnapshotWithIds(e){return be(e.root,{ids:e.ids})}getAllByAria(e,t){return Es(e.documentElement,t)}querySelectorAll(e,t){if(e.capture!==void 0){if(e.parts.some(n=>n.name==="nth"))throw this.createStacklessError("Can't query n-th element in a request with the capture.");let r={parts:e.parts.slice(0,e.capture+1)};if(e.capture<e.parts.length-1){let n={parts:e.parts.slice(e.capture+1)},i={name:"internal:has",body:{parsed:n},source:M(n)};r.parts.push(i)}return this.querySelectorAll(r,t)}if(!t.querySelectorAll)throw this.createStacklessError("Node is not queryable.");if(e.capture!==void 0)throw this.createStacklessError("Internal error: there should not be a capture in the selector.");if(t.nodeType===11&&e.parts.length===1&&e.parts[0].name==="css"&&e.parts[0].source===":scope")return[t];this._evaluator.begin();try{let r=new Set([t]);for(let n of e.parts)if(n.name==="nth")r=this._queryNth(r,n);else if(n.name==="internal:and"){let i=this.querySelectorAll(n.body.parsed,t);r=new Set(i.filter(s=>r.has(s)))}else if(n.name==="internal:or"){let i=this.querySelectorAll(n.body.parsed,t);r=new Set(Zr(new Set([...r,...i])))}else if(Li.includes(n.name))r=this._queryLayoutSelector(r,n,t);else{let i=new Set;for(let s of r){let o=this._queryEngineAll(n,s);for(let c of o)i.add(c)}r=i}return[...r]}finally{this._evaluator.end()}}_queryEngineAll(e,t){let r=this._engines.get(e.name).queryAll(t,e.body);for(let n of r)if(!("nodeName"in n))throw this.createStacklessError(`Expected a Node but got ${Object.prototype.toString.call(n)}`);return r}_createAttributeEngine(e,t){let r=n=>[{simples:[{selector:{css:`[${e}=${JSON.stringify(n)}]`,functions:[]},combinator:""}]}];return{queryAll:(n,i)=>this._evaluator.query({scope:n,pierceShadow:t},r(i))}}_createCSSEngine(){return{queryAll:(e,t)=>this._evaluator.query({scope:e,pierceShadow:!0},t)}}_createTextEngine(e,t){return{queryAll:(n,i)=>{let{matcher:s,kind:o}=Le(i,t),c=[],a=null,l=h=>{if(o==="lax"&&a&&a.contains(h))return!1;let f=Ve(this._evaluator._cacheText,h,s);f==="none"&&(a=h),(f==="self"||f==="selfAndChildren"&&o==="strict"&&!t)&&c.push(h)};n.nodeType===Node.ELEMENT_NODE&&l(n);let u=this._evaluator._queryCSS({scope:n,pierceShadow:e},"*");for(let h of u)l(h);return c}}}_createInternalHasTextEngine(){return{queryAll:(e,t)=>{if(e.nodeType!==1)return[];let r=e,n=O(this._evaluator._cacheText,r),{matcher:i}=Le(t,!0);return i(n)?[r]:[]}}}_createInternalHasNotTextEngine(){return{queryAll:(e,t)=>{if(e.nodeType!==1)return[];let r=e,n=O(this._evaluator._cacheText,r),{matcher:i}=Le(t,!0);return i(n)?[]:[r]}}}_createInternalLabelEngine(){return{queryAll:(e,t)=>{let{matcher:r}=Le(t,!0);return this._evaluator._queryCSS({scope:e,pierceShadow:!0},"*").filter(i=>Sr(this._evaluator._cacheText,i).some(s=>r(s)))}}}_createNamedAttributeEngine(){return{queryAll:(t,r)=>{let n=W(r,!0);if(n.name||n.attributes.length!==1)throw new Error("Malformed attribute selector: "+r);let{name:i,value:s,caseSensitive:o}=n.attributes[0],c=o?null:s.toLowerCase(),a;return s instanceof RegExp?a=u=>!!u.match(s):o?a=u=>u===s:a=u=>u.toLowerCase().includes(c),this._evaluator._queryCSS({scope:t,pierceShadow:!0},`[${i}]`).filter(u=>a(u.getAttribute(i)))}}}_createControlEngine(){return{queryAll(e,t){if(t==="enter-frame")return[];if(t==="return-empty")return[];if(t==="component")return e.nodeType!==1?[]:[e.childElementCount===1?e.firstElementChild:e];throw new Error(`Internal error, unknown internal:control selector ${t}`)}}}_createHasEngine(){return{queryAll:(t,r)=>t.nodeType!==1?[]:!!this.querySelector(r.parsed,t,!1)?[t]:[]}}_createHasNotEngine(){return{queryAll:(t,r)=>t.nodeType!==1?[]:!!this.querySelector(r.parsed,t,!1)?[]:[t]}}_createVisibleEngine(){return{queryAll:(t,r)=>t.nodeType!==1?[]:J(t)===!!r?[t]:[]}}_createInternalChainEngine(){return{queryAll:(t,r)=>this.querySelectorAll(r.parsed,t)}}extend(e,t){let r=this.window.eval(`
|
|
322
|
+
(() => {
|
|
323
|
+
const module = {};
|
|
324
|
+
${e}
|
|
325
|
+
return module.exports.default();
|
|
326
|
+
})()`);return new r(this,t)}async viewportRatio(e){return await new Promise(t=>{let r=new IntersectionObserver(n=>{t(n[0].intersectionRatio),r.disconnect()});r.observe(e),this.builtinRequestAnimationFrame(()=>{})})}getElementBorderWidth(e){if(e.nodeType!==Node.ELEMENT_NODE||!e.ownerDocument||!e.ownerDocument.defaultView)return{left:0,top:0};let t=e.ownerDocument.defaultView.getComputedStyle(e);return{left:parseInt(t.borderLeftWidth||"",10),top:parseInt(t.borderTopWidth||"",10)}}describeIFrameStyle(e){if(!e.ownerDocument||!e.ownerDocument.defaultView)return"error:notconnected";let t=e.ownerDocument.defaultView;for(let n=e;n;n=$(n))if(t.getComputedStyle(n).transform!=="none")return"transformed";let r=t.getComputedStyle(e);return{left:parseInt(r.borderLeftWidth||"",10)+parseInt(r.paddingLeft||"",10),top:parseInt(r.borderTopWidth||"",10)+parseInt(r.paddingTop||"",10)}}retarget(e,t){let r=e.nodeType===Node.ELEMENT_NODE?e:e.parentElement;return r?(t==="none"||(!r.matches("input, textarea, select")&&!r.isContentEditable&&(t==="button-link"?r=r.closest("button, [role=button], a, [role=link]")||r:r=r.closest("button, [role=button], [role=checkbox], [role=radio]")||r),t==="follow-label"&&(!r.matches("a, input, textarea, button, select, [role=link], [role=button], [role=checkbox], [role=radio]")&&!r.isContentEditable&&(r=r.closest("label")||r),r.nodeName==="LABEL"&&(r=r.control||r))),r):null}async checkElementStates(e,t){if(t.includes("stable")){let r=await this._checkElementIsStable(e);if(r===!1)return{missingState:"stable"};if(r==="error:notconnected")return r}for(let r of t)if(r!=="stable"){let n=this.elementState(e,r);if(n===!1)return{missingState:r};if(n==="error:notconnected")return n}}async _checkElementIsStable(e){let t=Symbol("continuePolling"),r,n=0,i=0,s=()=>{let u=this.retarget(e,"no-follow-label");if(!u)return"error:notconnected";let h=performance.now();if(this._stableRafCount>1&&h-i<15)return t;i=h;let f=u.getBoundingClientRect(),w={x:f.top,y:f.left,width:f.width,height:f.height};if(r){if(!(w.x===r.x&&w.y===r.y&&w.width===r.width&&w.height===r.height))return!1;if(++n>=this._stableRafCount)return!0}return r=w,t},o,c,a=new Promise((u,h)=>{o=u,c=h}),l=()=>{try{let u=s();u!==t?o(u):this.builtinRequestAnimationFrame(l)}catch(u){c(u)}};return this.builtinRequestAnimationFrame(l),a}elementState(e,t){let r=this.retarget(e,["stable","visible","hidden"].includes(t)?"none":"follow-label");if(!r||!r.isConnected)return t==="hidden"?!0:"error:notconnected";if(t==="visible")return J(r);if(t==="hidden")return!J(r);let n=bt(r);if(t==="disabled")return n;if(t==="enabled")return!n;let i=!(["INPUT","TEXTAREA","SELECT"].includes(r.nodeName)&&r.hasAttribute("readonly"));if(t==="editable")return!n&&i;if(t==="checked"||t==="unchecked"){let s=t==="checked",o=hr(r,!1);if(o==="error")throw this.createStacklessError("Not a checkbox or radio button");return s===o}throw this.createStacklessError(`Unexpected element state "${t}"`)}selectOptions(e,t){let r=this.retarget(e,"follow-label");if(!r)return"error:notconnected";if(r.nodeName.toLowerCase()!=="select")throw this.createStacklessError("Element is not a <select> element");let n=r,i=[...n.options],s=[],o=t.slice();for(let c=0;c<i.length;c++){let a=i[c],l=u=>{if(u instanceof Node)return a===u;let h=!0;return u.valueOrLabel!==void 0&&(h=h&&(u.valueOrLabel===a.value||u.valueOrLabel===a.label)),u.value!==void 0&&(h=h&&u.value===a.value),u.label!==void 0&&(h=h&&u.label===a.label),u.index!==void 0&&(h=h&&u.index===c),h};if(o.some(l))if(s.push(a),n.multiple)o=o.filter(u=>!l(u));else{o=[];break}}return o.length?"error:optionsnotfound":(n.value=void 0,s.forEach(c=>c.selected=!0),n.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),n.dispatchEvent(new Event("change",{bubbles:!0})),s.map(c=>c.value))}fill(e,t){let r=this.retarget(e,"follow-label");if(!r)return"error:notconnected";if(r.nodeName.toLowerCase()==="input"){let n=r,i=n.type.toLowerCase(),s=new Set(["color","date","time","datetime-local","month","range","week"]);if(!new Set(["","email","number","password","search","tel","text","url"]).has(i)&&!s.has(i))throw this.createStacklessError(`Input of type "${i}" cannot be filled`);if(i==="number"&&(t=t.trim(),isNaN(Number(t))))throw this.createStacklessError("Cannot type text into input[type=number]");if(s.has(i)){if(t=t.trim(),n.focus(),n.value=t,n.value!==t)throw this.createStacklessError("Malformed value");return r.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),r.dispatchEvent(new Event("change",{bubbles:!0})),"done"}}else if(r.nodeName.toLowerCase()!=="textarea"){if(!r.isContentEditable)throw this.createStacklessError("Element is not an <input>, <textarea> or [contenteditable] element")}return this.selectText(r),"needsinput"}selectText(e){let t=this.retarget(e,"follow-label");if(!t)return"error:notconnected";if(t.nodeName.toLowerCase()==="input"){let i=t;return i.select(),i.focus(),"done"}if(t.nodeName.toLowerCase()==="textarea"){let i=t;return i.selectionStart=0,i.selectionEnd=i.value.length,i.focus(),"done"}let r=t.ownerDocument.createRange();r.selectNodeContents(t);let n=t.ownerDocument.defaultView.getSelection();return n&&(n.removeAllRanges(),n.addRange(r)),t.focus(),"done"}_activelyFocused(e){let t=e.getRootNode().activeElement,r=t===e&&!!e.ownerDocument&&e.ownerDocument.hasFocus();return{activeElement:t,isFocused:r}}focusNode(e,t){if(!e.isConnected)return"error:notconnected";if(e.nodeType!==Node.ELEMENT_NODE)throw this.createStacklessError("Node is not an element");let{activeElement:r,isFocused:n}=this._activelyFocused(e);if(e.isContentEditable&&!n&&r&&r.blur&&r.blur(),e.focus(),e.focus(),t&&!n&&e.nodeName.toLowerCase()==="input")try{e.setSelectionRange(0,0)}catch{}return"done"}blurNode(e){if(!e.isConnected)return"error:notconnected";if(e.nodeType!==Node.ELEMENT_NODE)throw this.createStacklessError("Node is not an element");return e.blur(),"done"}setInputFiles(e,t){if(e.nodeType!==Node.ELEMENT_NODE)return"Node is not of type HTMLElement";let r=e;if(r.nodeName!=="INPUT")return"Not an <input> element";let n=r;if((n.getAttribute("type")||"").toLowerCase()!=="file")return"Not an input[type=file] element";let s=t.map(c=>{let a=Uint8Array.from(atob(c.buffer),l=>l.charCodeAt(0));return new File([a],c.name,{type:c.mimeType,lastModified:c.lastModifiedMs})}),o=new DataTransfer;for(let c of s)o.items.add(c);n.files=o.files,n.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),n.dispatchEvent(new Event("change",{bubbles:!0}))}expectHitTarget(e,t){let r=[],n=t;for(;n;){let l=Kt(n);if(!l||(r.push(l),l.nodeType===9))break;n=l.host}let i;for(let l=r.length-1;l>=0;l--){let u=r[l],h=u.elementsFromPoint(e.x,e.y),f=u.elementFromPoint(e.x,e.y);f&&h[0]&&$(f)===h[0]&&this.window.getComputedStyle(f)?.display==="contents"&&h.unshift(f),h[0]&&h[0].shadowRoot===u&&h[1]===f&&h.shift();let w=h[0];if(!w||(i=w,l&&w!==r[l-1].host))break}let s=[];for(;i&&i!==t;)s.push(i),i=$(i);if(i===t)return"done";let o=this.previewNode(s[0]||this.document.documentElement),c,a=t;for(;a;){let l=s.indexOf(a);if(l!==-1){l>1&&(c=this.previewNode(s[l-1]));break}a=$(a)}return c?{hitTargetDescription:`${o} from ${c} subtree`}:{hitTargetDescription:o}}setupHitTargetInterceptor(e,t,r,n){let i=this.retarget(e,"button-link");if(!i||!i.isConnected)return"error:notconnected";if(r){let l=this.expectHitTarget(r,i);if(l!=="done")return l.hitTargetDescription}if(t==="drag")return{stop:()=>"done"};let s={hover:mn,tap:bn,mouse:wn}[t],o,c=l=>{if(!s.has(l.type)||!l.isTrusted)return;let u=this.window.TouchEvent&&l instanceof this.window.TouchEvent?l.touches[0]:l;o===void 0&&u&&(o=this.expectHitTarget({x:u.clientX,y:u.clientY},i)),(n||o!=="done"&&o!==void 0)&&(l.preventDefault(),l.stopPropagation(),l.stopImmediatePropagation())},a=()=>(this._hitTargetInterceptor===c&&(this._hitTargetInterceptor=void 0),o||"done");return this._hitTargetInterceptor=c,{stop:a}}dispatchEvent(e,t,r){let n;switch(r={bubbles:!0,cancelable:!0,composed:!0,...r},$s.get(t)){case"mouse":n=new MouseEvent(t,r);break;case"keyboard":n=new KeyboardEvent(t,r);break;case"touch":n=new TouchEvent(t,r);break;case"pointer":n=new PointerEvent(t,r);break;case"focus":n=new FocusEvent(t,r);break;case"drag":n=new DragEvent(t,r);break;case"wheel":n=new WheelEvent(t,r);break;case"deviceorientation":try{n=new DeviceOrientationEvent(t,r)}catch{let{bubbles:i,cancelable:s,alpha:o,beta:c,gamma:a,absolute:l}=r;n=this.document.createEvent("DeviceOrientationEvent"),n.initDeviceOrientationEvent(t,i,s,o,c,a,l)}break;case"devicemotion":try{n=new DeviceMotionEvent(t,r)}catch{let{bubbles:i,cancelable:s,acceleration:o,accelerationIncludingGravity:c,rotationRate:a,interval:l}=r;n=this.document.createEvent("DeviceMotionEvent"),n.initDeviceMotionEvent(t,i,s,o,c,a,l)}break;default:n=new Event(t,r);break}e.dispatchEvent(n)}previewNode(e){if(e.nodeType===Node.TEXT_NODE)return Ce(`#text=${e.nodeValue||""}`);if(e.nodeType!==Node.ELEMENT_NODE)return Ce(`<${e.nodeName.toLowerCase()} />`);let t=e,r=[];for(let c=0;c<t.attributes.length;c++){let{name:a,value:l}=t.attributes[c];a!=="style"&&(!l&&Ls.has(a)?r.push(` ${a}`):r.push(` ${a}="${l}"`))}r.sort((c,a)=>c.length-a.length);let n=Lt(r.join(""),500);if(Cs.has(t.nodeName))return Ce(`<${t.nodeName.toLowerCase()}${n}/>`);let i=t.childNodes,s=!1;if(i.length<=5){s=!0;for(let c=0;c<i.length;c++)s=s&&i[c].nodeType===Node.TEXT_NODE}let o=s?t.textContent||"":i.length?"\u2026":"";return Ce(`<${t.nodeName.toLowerCase()}${n}>${Lt(o,50)}</${t.nodeName.toLowerCase()}>`)}strictModeViolationError(e,t){let r=t.slice(0,10).map(i=>({preview:this.previewNode(i),selector:this.generateSelectorSimple(i)})),n=r.map((i,s)=>`
|
|
327
|
+
${s+1}) ${i.preview} aka ${De(this._sdkLanguage,i.selector)}`);return r.length<t.length&&n.push(`
|
|
328
|
+
...`),this.createStacklessError(`strict mode violation: ${De(this._sdkLanguage,M(e))} resolved to ${t.length} elements:${n.join("")}
|
|
329
|
+
`)}createStacklessError(e){if(this._browserName==="firefox"){let r=new Error("Error: "+e);return r.stack="",r}let t=new Error(e);return delete t.stack,t}createHighlight(){return new Ze(this)}maskSelectors(e,t){this._highlight&&this.hideHighlight(),this._highlight=new Ze(this),this._highlight.install();let r=[];for(let n of e)r.push(this.querySelectorAll(n,this.document.documentElement));this._highlight.maskElements(r.flat(),t)}highlight(e){this._highlight||(this._highlight=new Ze(this),this._highlight.install()),this._highlight.runHighlightOnRaf(e)}hideHighlight(){this._highlight&&(this._highlight.uninstall(),delete this._highlight)}markTargetElements(e,t){this._markedElements?.callId!==t&&(this._markedElements=void 0);let r=this._markedElements?.elements||new Set,n=new CustomEvent("__playwright_unmark_target__",{bubbles:!0,cancelable:!0,detail:t,composed:!0});for(let s of r)e.has(s)||s.dispatchEvent(n);let i=new CustomEvent("__playwright_mark_target__",{bubbles:!0,cancelable:!0,detail:t,composed:!0});for(let s of e)r.has(s)||s.dispatchEvent(i);this._markedElements={callId:t,elements:e}}_setupGlobalListenersRemovalDetection(){let e="__playwright_global_listeners_check__",t=!1,r=()=>t=!0;this.window.addEventListener(e,r),new MutationObserver(n=>{if(n.some(s=>Array.from(s.addedNodes).includes(this.document.documentElement))&&(t=!1,this.window.dispatchEvent(new CustomEvent(e)),!t)){this.window.addEventListener(e,r);for(let s of this.onGlobalListenersRemoved)s()}}).observe(this.document,{childList:!0})}_setupHitTargetInterceptors(){let e=r=>this._hitTargetInterceptor?.(r),t=()=>{for(let r of Is)this.window.addEventListener(r,e,{capture:!0,passive:!1})};t(),this.onGlobalListenersRemoved.add(t)}async expect(e,t,r){return t.expression==="to.have.count"||t.expression.endsWith(".array")?this.expectArray(r,t):e?await this.expectSingleElement(e,t):!t.isNot&&t.expression==="to.be.hidden"?{matches:!0}:t.isNot&&t.expression==="to.be.visible"?{matches:!1}:!t.isNot&&t.expression==="to.be.detached"?{matches:!0}:t.isNot&&t.expression==="to.be.attached"?{matches:!1}:t.isNot&&t.expression==="to.be.in.viewport"?{matches:!1}:{matches:t.isNot,missingReceived:!0}}async expectSingleElement(e,t){let r=t.expression;{let n;if(r==="to.have.attribute"?n=e.hasAttribute(t.expressionArg):r==="to.be.checked"?n=this.elementState(e,"checked"):r==="to.be.unchecked"?n=this.elementState(e,"unchecked"):r==="to.be.disabled"?n=this.elementState(e,"disabled"):r==="to.be.editable"?n=this.elementState(e,"editable"):r==="to.be.readonly"?n=!this.elementState(e,"editable"):r==="to.be.empty"?e.nodeName==="INPUT"||e.nodeName==="TEXTAREA"?n=!e.value:n=!e.textContent?.trim():r==="to.be.enabled"?n=this.elementState(e,"enabled"):r==="to.be.focused"?n=this._activelyFocused(e).isFocused:r==="to.be.hidden"?n=this.elementState(e,"hidden"):r==="to.be.visible"?n=this.elementState(e,"visible"):r==="to.be.attached"?n=!0:r==="to.be.detached"&&(n=!1),n!==void 0){if(n==="error:notcheckbox")throw this.createStacklessError("Element is not a checkbox");if(n==="error:notconnected")throw this.createStacklessError("Element is not connected");return{received:n,matches:n}}}if(r==="to.have.property"){let n=e,i=t.expressionArg.split(".");for(let c=0;c<i.length-1;c++){if(typeof n!="object"||!(i[c]in n))return{received:void 0,matches:!1};n=n[i[c]]}let s=n[i[i.length-1]],o=ht(s,t.expectedValue);return{received:s,matches:o}}if(r==="to.be.in.viewport"){let n=await this.viewportRatio(e);return{received:`viewport ratio ${n}`,matches:n>0&&n>(t.expectedNumber??0)-1e-9}}if(r==="to.have.values"){if(e=this.retarget(e,"follow-label"),e.nodeName!=="SELECT"||!e.multiple)throw this.createStacklessError("Not a select element with a multiple attribute");let n=[...e.selectedOptions].map(i=>i.value);return n.length!==t.expectedText.length?{received:n,matches:!1}:{received:n,matches:n.map((i,s)=>new tt(t.expectedText[s]).matches(i)).every(Boolean)}}if(r==="to.match.aria"){let n=vs(e,t.expectedValue);return{received:n.received,matches:!!n.matches.length}}{let n;if(r==="to.have.attribute.value"){let i=e.getAttribute(t.expressionArg);if(i===null)return{received:null,matches:!1};n=i}else if(r==="to.have.class")n=e.classList.toString();else if(r==="to.have.css")n=this.window.getComputedStyle(e).getPropertyValue(t.expressionArg);else if(r==="to.have.id")n=e.id;else if(r==="to.have.text")n=t.useInnerText?e.innerText:O(new Map,e).full;else if(r==="to.have.accessible.name")n=oe(e,!1);else if(r==="to.have.accessible.description")n=Pt(e,!1);else if(r==="to.have.role")n=L(e)||"";else if(r==="to.have.title")n=this.document.title;else if(r==="to.have.url")n=this.document.location.href;else if(r==="to.have.value"){if(e=this.retarget(e,"follow-label"),e.nodeName!=="INPUT"&&e.nodeName!=="TEXTAREA"&&e.nodeName!=="SELECT")throw this.createStacklessError("Not an input element");n=e.value}if(n!==void 0&&t.expectedText){let i=new tt(t.expectedText[0]);return{received:n,matches:i.matches(n)}}}throw this.createStacklessError("Unknown expect matcher: "+r)}expectArray(e,t){let r=t.expression;if(r==="to.have.count"){let i=e.length,s=i===t.expectedNumber;return{received:i,matches:s}}let n;if(r==="to.have.text.array"||r==="to.contain.text.array"?n=e.map(i=>t.useInnerText?i.innerText:O(new Map,i).full):r==="to.have.class.array"?n=e.map(i=>i.classList.toString()):r==="to.have.accessible.name.array"&&(n=e.map(i=>oe(i,!1))),n&&t.expectedText){let i=r!=="to.contain.text.array";if(!(n.length===t.expectedText.length||!i))return{received:n,matches:!1};let o=t.expectedText.map(l=>new tt(l)),c=0,a=0;for(;c<o.length&&a<n.length;)o[c].matches(n[a])&&++c,++a;return{received:n,matches:c===o.length}}throw this.createStacklessError("Unknown expect matcher: "+r)}},Cs=new Set(["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","MENUITEM","META","PARAM","SOURCE","TRACK","WBR"]),Ls=new Set(["checked","selected","disabled","readonly","multiple"]);function Ce(e){return e.replace(/\n/g,"\u21B5").replace(/\t/g,"\u21C6")}var $s=new Map([["auxclick","mouse"],["click","mouse"],["dblclick","mouse"],["mousedown","mouse"],["mouseeenter","mouse"],["mouseleave","mouse"],["mousemove","mouse"],["mouseout","mouse"],["mouseover","mouse"],["mouseup","mouse"],["mouseleave","mouse"],["mousewheel","mouse"],["keydown","keyboard"],["keyup","keyboard"],["keypress","keyboard"],["textInput","keyboard"],["touchstart","touch"],["touchmove","touch"],["touchend","touch"],["touchcancel","touch"],["pointerover","pointer"],["pointerout","pointer"],["pointerenter","pointer"],["pointerleave","pointer"],["pointerdown","pointer"],["pointerup","pointer"],["pointermove","pointer"],["pointercancel","pointer"],["gotpointercapture","pointer"],["lostpointercapture","pointer"],["focus","focus"],["blur","focus"],["drag","drag"],["dragstart","drag"],["dragend","drag"],["dragover","drag"],["dragenter","drag"],["dragleave","drag"],["dragexit","drag"],["drop","drag"],["wheel","wheel"],["deviceorientation","deviceorientation"],["deviceorientationabsolute","deviceorientation"],["devicemotion","devicemotion"]]),mn=new Set(["mousemove"]),bn=new Set(["pointerdown","pointerup","touchstart","touchend","touchcancel"]),wn=new Set(["mousedown","mouseup","pointerdown","pointerup","click","auxclick","dblclick","contextmenu"]),Is=new Set([...mn,...bn,...wn]);function Rs(e){if(e=e.substring(1,e.length-1),!e.includes("\\"))return e;let t=[],r=0;for(;r<e.length;)e[r]==="\\"&&r+1<e.length&&r++,t.push(e[r++]);return t.join("")}function Le(e,t){if(e[0]==="/"&&e.lastIndexOf("/")>0){let i=e.lastIndexOf("/"),s=new RegExp(e.substring(1,i),e.substring(i+1));return{matcher:o=>s.test(o.full),kind:"regex"}}let r=t?JSON.parse.bind(JSON):Rs,n=!1;return e.length>1&&e[0]==='"'&&e[e.length-1]==='"'?(e=r(e),n=!0):t&&e.length>1&&e[0]==='"'&&e[e.length-2]==='"'&&e[e.length-1]==="i"?(e=r(e.substring(0,e.length-1)),n=!1):t&&e.length>1&&e[0]==='"'&&e[e.length-2]==='"'&&e[e.length-1]==="s"?(e=r(e.substring(0,e.length-1)),n=!0):e.length>1&&e[0]==="'"&&e[e.length-1]==="'"&&(e=r(e),n=!0),e=D(e),n?t?{kind:"strict",matcher:s=>s.normalized===e}:{matcher:s=>!e&&!s.immediate.length?!0:s.immediate.some(o=>D(o)===e),kind:"strict"}:(e=e.toLowerCase(),{kind:"lax",matcher:i=>i.normalized.toLowerCase().includes(e)})}var tt=class{constructor(e){if(this._normalizeWhiteSpace=e.normalizeWhiteSpace,this._ignoreCase=e.ignoreCase,this._string=e.matchSubstring?void 0:this.normalize(e.string),this._substring=e.matchSubstring?this.normalize(e.string):void 0,e.regexSource){let t=new Set((e.regexFlags||"").split(""));e.ignoreCase===!1&&t.delete("i"),e.ignoreCase===!0&&t.add("i"),this._regex=new RegExp(e.regexSource,[...t].join(""))}}matches(e){return this._regex||(e=this.normalize(e)),this._string!==void 0?e===this._string:this._substring!==void 0?e.includes(this._substring):this._regex?!!this._regex.test(e):!1}normalize(e){return e&&(this._normalizeWhiteSpace&&(e=D(e)),this._ignoreCase&&(e=e.toLocaleLowerCase()),e)}};function ht(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;if(Array.isArray(e)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;++n)if(!ht(e[n],t[n]))return!1;return!0}if(e instanceof RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();let r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(let n=0;n<r.length;++n)if(!t.hasOwnProperty(r[n]))return!1;for(let n of r)if(!ht(e[n],t[n]))return!1;return!0}return typeof e=="number"&&typeof t=="number"?isNaN(e)&&isNaN(t):!1}function Os(e,t,r=!1){return Ps(e,t,r)[0]}function Ps(e,t,r=!1,n=20,i){try{return ne(new Hs[e](i),Ge(t),r,n)}catch{return[t]}}function ne(e,t,r=!1,n=20){let i=[...t.parts],s=[],o=r?"frame-locator":"page";for(let c=0;c<i.length;c++){let a=i[c],l=o;if(o="locator",a.name==="nth"){a.body==="0"?s.push([e.generateLocator(l,"first",""),e.generateLocator(l,"nth","0")]):a.body==="-1"?s.push([e.generateLocator(l,"last",""),e.generateLocator(l,"nth","-1")]):s.push([e.generateLocator(l,"nth",a.body)]);continue}if(a.name==="internal:text"){let{exact:d,text:g}=pe(a.body);s.push([e.generateLocator(l,"text",g,{exact:d})]);continue}if(a.name==="internal:has-text"){let{exact:d,text:g}=pe(a.body);if(!d){s.push([e.generateLocator(l,"has-text",g,{exact:d})]);continue}}if(a.name==="internal:has-not-text"){let{exact:d,text:g}=pe(a.body);if(!d){s.push([e.generateLocator(l,"has-not-text",g,{exact:d})]);continue}}if(a.name==="internal:has"){let d=ne(e,a.body.parsed,!1,n);s.push(d.map(g=>e.generateLocator(l,"has",g)));continue}if(a.name==="internal:has-not"){let d=ne(e,a.body.parsed,!1,n);s.push(d.map(g=>e.generateLocator(l,"hasNot",g)));continue}if(a.name==="internal:and"){let d=ne(e,a.body.parsed,!1,n);s.push(d.map(g=>e.generateLocator(l,"and",g)));continue}if(a.name==="internal:or"){let d=ne(e,a.body.parsed,!1,n);s.push(d.map(g=>e.generateLocator(l,"or",g)));continue}if(a.name==="internal:chain"){let d=ne(e,a.body.parsed,!1,n);s.push(d.map(g=>e.generateLocator(l,"chain",g)));continue}if(a.name==="internal:label"){let{exact:d,text:g}=pe(a.body);s.push([e.generateLocator(l,"label",g,{exact:d})]);continue}if(a.name==="internal:role"){let d=W(a.body,!0),g={attrs:[]};for(let p of d.attributes)p.name==="name"?(g.exact=p.caseSensitive,g.name=p.value):(p.name==="level"&&typeof p.value=="string"&&(p.value=+p.value),g.attrs.push({name:p.name==="include-hidden"?"includeHidden":p.name,value:p.value}));s.push([e.generateLocator(l,"role",d.name,g)]);continue}if(a.name==="internal:testid"){let d=W(a.body,!0),{value:g}=d.attributes[0];s.push([e.generateLocator(l,"test-id",g)]);continue}if(a.name==="internal:attr"){let d=W(a.body,!0),{name:g,value:p,caseSensitive:x}=d.attributes[0],E=p,S=!!x;if(g==="placeholder"){s.push([e.generateLocator(l,"placeholder",E,{exact:S})]);continue}if(g==="alt"){s.push([e.generateLocator(l,"alt",E,{exact:S})]);continue}if(g==="title"){s.push([e.generateLocator(l,"title",E,{exact:S})]);continue}}if(a.name==="internal:control"&&a.body==="enter-frame"){let d=s[s.length-1],g=i[c-1],p=d.map(x=>e.chainLocators([x,e.generateLocator(l,"frame","")]));["xpath","css"].includes(g.name)&&p.push(e.generateLocator(l,"frame-locator",M({parts:[g]})),e.generateLocator(l,"frame-locator",M({parts:[g]},!0))),d.splice(0,d.length,...p),o="frame-locator";continue}let u=i[c+1],h=M({parts:[a]}),f=e.generateLocator(l,"default",h);if(u&&["internal:has-text","internal:has-not-text"].includes(u.name)){let{exact:d,text:g}=pe(u.body);if(!d){let p=e.generateLocator("locator",u.name==="internal:has-text"?"has-text":"has-not-text",g,{exact:d}),x={};u.name==="internal:has-text"?x.hasText=g:x.hasNotText=g;let E=e.generateLocator(l,"default",h,x);s.push([e.chainLocators([f,p]),E]),c++;continue}}let w;if(["xpath","css"].includes(a.name)){let d=M({parts:[a]},!0);w=e.generateLocator(l,"default",d)}s.push([f,w].filter(Boolean))}return qs(e,s,n)}function qs(e,t,r){let n=t.map(()=>""),i=[],s=o=>{if(o===t.length)return i.push(e.chainLocators(n)),n.length<r;for(let c of t[o])if(n[o]=c,!s(o+1))return!1;return!0};return s(0),i}function pe(e){let t=!1,r=e.match(/^\/(.*)\/([igm]*)$/);return r?{text:new RegExp(r[1],r[2])}:(e.endsWith('"')?(e=JSON.parse(e),t=!0):e.endsWith('"s')?(e=JSON.parse(e.substring(0,e.length-1)),t=!0):e.endsWith('"i')&&(e=JSON.parse(e.substring(0,e.length-1)),t=!1),{exact:t,text:e})}var Ms=class{constructor(e){this.preferredQuote=e}generateLocator(e,t,r,n={}){switch(t){case"default":return n.hasText!==void 0?`locator(${this.quote(r)}, { hasText: ${this.toHasText(n.hasText)} })`:n.hasNotText!==void 0?`locator(${this.quote(r)}, { hasNotText: ${this.toHasText(n.hasNotText)} })`:`locator(${this.quote(r)})`;case"frame-locator":return`frameLocator(${this.quote(r)})`;case"frame":return"contentFrame()";case"nth":return`nth(${r})`;case"first":return"first()";case"last":return"last()";case"role":let i=[];$e(n.name)?i.push(`name: ${this.regexToSourceString(n.name)}`):typeof n.name=="string"&&(i.push(`name: ${this.quote(n.name)}`),n.exact&&i.push("exact: true"));for(let{name:o,value:c}of n.attrs)i.push(`${o}: ${typeof c=="string"?this.quote(c):c}`);let s=i.length?`, { ${i.join(", ")} }`:"";return`getByRole(${this.quote(r)}${s})`;case"has-text":return`filter({ hasText: ${this.toHasText(r)} })`;case"has-not-text":return`filter({ hasNotText: ${this.toHasText(r)} })`;case"has":return`filter({ has: ${r} })`;case"hasNot":return`filter({ hasNot: ${r} })`;case"and":return`and(${r})`;case"or":return`or(${r})`;case"chain":return`locator(${r})`;case"test-id":return`getByTestId(${this.toTestIdValue(r)})`;case"text":return this.toCallWithExact("getByText",r,!!n.exact);case"alt":return this.toCallWithExact("getByAltText",r,!!n.exact);case"placeholder":return this.toCallWithExact("getByPlaceholder",r,!!n.exact);case"label":return this.toCallWithExact("getByLabel",r,!!n.exact);case"title":return this.toCallWithExact("getByTitle",r,!!n.exact);default:throw new Error("Unknown selector kind "+t)}}chainLocators(e){return e.join(".")}regexToSourceString(e){return xe(String(e))}toCallWithExact(e,t,r){return $e(t)?`${e}(${this.regexToSourceString(t)})`:r?`${e}(${this.quote(t)}, { exact: true })`:`${e}(${this.quote(t)})`}toHasText(e){return $e(e)?this.regexToSourceString(e):this.quote(e)}toTestIdValue(e){return $e(e)?this.regexToSourceString(e):this.quote(e)}quote(e){return we(e,this.preferredQuote??"'")}},Ds=class{generateLocator(e,t,r,n={}){return JSON.stringify({kind:t,body:r,options:n})}chainLocators(e){let t=e.map(r=>JSON.parse(r));for(let r=0;r<t.length-1;++r)t[r].next=t[r+1];return JSON.stringify(t[0])}},Hs={javascript:Ms,jsonl:Ds};function $e(e){return e instanceof RegExp}function Fs(e,t=!1,r="javascript",n="data",i=0,s="Chrome",o=[]){let c=new Ns(e,t,r,n,i,s,o);return(a,l={testIdAttributeName:"data-testid"})=>c.generateSelector(a,l)}function Bs(e,t="javascript"){return Os(t,e)}var Ws="1.50.0-next",Us="1afb56ee1b63ffbb972a1773432979b865878072";
|
|
330
|
+
globalThis.__selectorGenerator = { createSelectorGenerator: Fs, toLocator: Bs };
|
|
331
|
+
})();
|