ferridriver 0.3.0

Browser automation in Rust with a Playwright-compatible API. Four pluggable backends: CDP pipe, CDP WebSocket, Playwright WebKit, Firefox BiDi.
Documentation
(function(){if(window.__fd)return;(()=>{function Jn(e,t){if(e.role!==t.role||e.name!==t.name)return!1;if(!$i(e,t)||Ue(e)!==Ue(t))return!1;let n=Object.keys(e.props),r=Object.keys(t.props);return n.length===r.length&&n.every((i)=>e.props[i]===t.props[i])}function Ue(e){return e.box.cursor==="pointer"}function $i(e,t){return e.active===t.active&&e.checked===t.checked&&e.disabled===t.disabled&&e.expanded===t.expanded&&e.selected===t.selected&&e.level===t.level&&e.pressed===t.pressed}function Kn(e,t,n={}){let r=new e.LineCounter,i={keepSourceTokens:!0,lineCounter:r,...n},s=e.parseDocument(t,i),a=[],o=(f)=>{return[r.linePos(f[0]),r.linePos(f[1])]},l=(f)=>{a.push({message:f.message,range:[r.linePos(f.pos[0]),r.linePos(f.pos[1])]})},c=(f,x)=>{for(let d of x.items){if(d instanceof e.Scalar&&typeof d.value==="string"){let E=ft.parse(d,i,a);if(E)f.children=f.children||[],f.children.push(E);continue}if(d instanceof e.YAMLMap){h(f,d);continue}a.push({message:"Sequence items should be strings or maps",range:o(d.range||x.range)})}},h=(f,x)=>{for(let d of x.items){if(f.children=f.children||[],!(d.key instanceof e.Scalar&&typeof d.key.value==="string")){a.push({message:"Only string keys are supported",range:o(d.key.range||x.range)});continue}let{key:p,value:E}=d;if(p.value==="text"){if(!(E instanceof e.Scalar&&typeof E.value==="string")){a.push({message:"Text value should be a string",range:o(d.value.range||x.range)});continue}f.children.push({kind:"text",text:nn(E.value)});continue}if(p.value==="/children"){if(!(E instanceof e.Scalar&&typeof E.value==="string")||E.value!=="contain"&&E.value!=="equal"&&E.value!=="deep-equal"){a.push({message:'Strict value should be "contain", "equal" or "deep-equal"',range:o(d.value.range||x.range)});continue}f.containerMode=E.value;continue}if(p.value.startsWith("/")){if(!(E instanceof e.Scalar&&typeof E.value==="string")){a.push({message:"Property value should be a string",range:o(d.value.range||x.range)});continue}f.props=f.props??{},f.props[p.value.slice(1)]=nn(E.value);continue}let S=ft.parse(p,i,a);if(!S)continue;if(E instanceof e.Scalar){let U=typeof E.value;if(U!=="string"&&U!=="number"&&U!=="boolean"){a.push({message:"Node value should be a string or a sequence",range:o(d.value.range||x.range)});continue}f.children.push({...S,children:[{kind:"text",text:nn(String(E.value))}]});continue}if(E instanceof e.YAMLSeq){f.children.push(S),c(S,E);continue}a.push({message:"Map values should be strings or sequences",range:o(d.value.range||x.range)})}},u={kind:"role",role:"fragment"};if(s.errors.forEach(l),a.length)return{errors:a,fragment:u};if(!(s.contents instanceof e.YAMLSeq))a.push({message:'Aria snapshot must be a YAML sequence, elements starting with " -"',range:s.contents?o(s.contents.range):[{line:0,col:0},{line:0,col:0}]});if(a.length)return{errors:a,fragment:u};if(c(u,s.contents),a.length)return{errors:a,fragment:Pi};if(u.children?.length===1&&(!u.containerMode||u.containerMode==="contain"))return{fragment:u.children[0],errors:[]};return{fragment:u,errors:[]}}var Pi={kind:"role",role:"fragment"};function Xn(e){return e.replace(/[\u200b\u00ad]/g,"").replace(/[\r\n\s\t]+/g," ").trim()}function nn(e){return{raw:e,normalized:Xn(e)}}class ft{_input;_pos;_length;static parse(e,t,n){try{return new ft(e.value)._parse()}catch(r){if(r instanceof rn){let i=t.prettyErrors===!1?r.message:r.message+`:

`+e.value+`
`+" ".repeat(r.pos)+`^
`;return n.push({message:i,range:[t.lineCounter.linePos(e.range[0]),t.lineCounter.linePos(e.range[0]+r.pos)]}),null}throw r}}constructor(e){this._input=e,this._pos=0,this._length=e.length}_peek(){return this._input[this._pos]||""}_next(){if(this._pos<this._length)return this._input[this._pos++];return null}_eof(){return this._pos>=this._length}_isWhitespace(){return!this._eof()&&/\s/.test(this._peek())}_skipWhitespace(){while(this._isWhitespace())this._pos++}_readIdentifier(e){if(this._eof())this._throwError(`Unexpected end of input when expecting ${e}`);let t=this._pos;while(!this._eof()&&/[a-zA-Z]/.test(this._peek()))this._pos++;return this._input.slice(t,this._pos)}_readString(){let e="",t=!1;while(!this._eof()){let n=this._next();if(t)e+=n,t=!1;else if(n==="\\")t=!0;else if(n==='"')return e;else e+=n}this._throwError("Unterminated string")}_throwError(e,t=0){throw new rn(e,t||this._pos)}_readRegex(){let e="",t=!1,n=!1;while(!this._eof()){let r=this._next();if(t)e+=r,t=!1;else if(r==="\\")t=!0,e+=r;else if(r==="/"&&!n)return{pattern:e};else if(r==="[")n=!0,e+=r;else if(r==="]"&&n)e+=r,n=!1;else e+=r}this._throwError("Unterminated regex")}_readStringOrRegex(){let e=this._peek();if(e==='"')return this._next(),Xn(this._readString());if(e==="/")return this._next(),this._readRegex();return null}_readAttributes(e){let t=this._pos;while(!0)if(this._skipWhitespace(),this._peek()==="["){this._next(),this._skipWhitespace(),t=this._pos;let n=this._readIdentifier("attribute");this._skipWhitespace();let r="";if(this._peek()==="="){this._next(),this._skipWhitespace(),t=this._pos;while(this._peek()!=="]"&&!this._isWhitespace()&&!this._eof())r+=this._next()}if(this._skipWhitespace(),this._peek()!=="]")this._throwError("Expected ]");this._next(),this._applyAttribute(e,n,r||"true",t)}else break}_parse(){this._skipWhitespace();let e=this._readIdentifier("role");this._skipWhitespace();let t=this._readStringOrRegex()||"",n={kind:"role",role:e,name:t};if(this._readAttributes(n),this._skipWhitespace(),!this._eof())this._throwError("Unexpected input");return n}_applyAttribute(e,t,n,r){if(t==="checked"){this._assert(n==="true"||n==="false"||n==="mixed",'Value of "checked" attribute must be a boolean or "mixed"',r),e.checked=n==="true"?!0:n==="false"?!1:"mixed";return}if(t==="disabled"){this._assert(n==="true"||n==="false",'Value of "disabled" attribute must be a boolean',r),e.disabled=n==="true";return}if(t==="expanded"){this._assert(n==="true"||n==="false",'Value of "expanded" attribute must be a boolean',r),e.expanded=n==="true";return}if(t==="active"){this._assert(n==="true"||n==="false",'Value of "active" attribute must be a boolean',r),e.active=n==="true";return}if(t==="level"){this._assert(!isNaN(Number(n)),'Value of "level" attribute must be a number',r),e.level=Number(n);return}if(t==="pressed"){this._assert(n==="true"||n==="false"||n==="mixed",'Value of "pressed" attribute must be a boolean or "mixed"',r),e.pressed=n==="true"?!0:n==="false"?!1:"mixed";return}if(t==="selected"){this._assert(n==="true"||n==="false",'Value of "selected" attribute must be a boolean',r),e.selected=n==="true";return}this._assert(!1,`Unsupported attribute [${t}]`,r)}_assert(e,t,n){if(!e)this._throwError(t||"Assertion error",n)}}class rn extends Error{pos;constructor(e,t){super(e);this.pos=t}}function Zn(e,t){function n(a,o,l){let c=1,h=l+c;for(let u of a.children||[])if(typeof u==="string")c++,h++;else c+=n(u,o,h),h+=c;if(!["none","presentation","fragment","iframe","generic"].includes(a.role)&&a.name){let u=o.get(a.role);if(!u)u=new Map,o.set(a.role,u);let f=u.get(a.name),x=c*100-l;if(!f||f.sizeAndPosition<x)u.set(a.name,{node:a,sizeAndPosition:x})}return c}let r=new Map;if(e)n(e,r,0);let i=new Map;n(t,i,0);let s=[];for(let[a,o]of i)for(let[l,c]of o)if(!r.get(a)?.get(l))s.push(c);return s.sort((a,o)=>o.sizeAndPosition-a.sizeAndPosition),s[0]?.node}var C=function(e,t,n){return e>=t&&e<=n};function V(e){return C(e,48,57)}function er(e){return V(e)||C(e,65,70)||C(e,97,102)}function Hi(e){return C(e,65,90)}function qi(e){return C(e,97,122)}function Bi(e){return Hi(e)||qi(e)}function Ui(e){return e>=128}function pt(e){return Bi(e)||Ui(e)||e===95}function tr(e){return pt(e)||V(e)||e===45}function Fi(e){return C(e,0,8)||e===11||C(e,14,31)||e===127}function be(e){return e===10}function ee(e){return be(e)||e===9||e===32}var Wi=1114111;class gt extends Error{constructor(e){super(e);this.name="InvalidCharacterError"}}function Vi(e){let t=[];for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(r===13&&e.charCodeAt(n+1)===10)r=10,n++;if(r===13||r===12)r=10;if(r===0)r=65533;if(C(r,55296,56319)&&C(e.charCodeAt(n+1),56320,57343)){let i=r-55296,s=e.charCodeAt(n+1)-56320;r=Math.pow(2,16)+i*Math.pow(2,10)+s,n++}t.push(r)}return t}function k(e){if(e<=65535)return String.fromCharCode(e);e-=Math.pow(2,16);let t=Math.floor(e/Math.pow(2,10))+55296,n=e%Math.pow(2,10)+56320;return String.fromCharCode(t)+String.fromCharCode(n)}function mt(e){let t=Vi(e),n=-1,r=[],i,s=0,a=0,o=0,l=function(){s+=1,o=a,a=0},c={line:s,column:a},h=function(m){if(m>=t.length)return-1;return t[m]},u=function(m){if(m===void 0)m=1;if(m>3)throw"Spec Error: no more than three codepoints of lookahead.";return h(n+m)},f=function(m){if(m===void 0)m=1;if(n+=m,i=h(n),be(i))l();else a+=m;return!0},x=function(){if(n-=1,be(i))s-=1,a=o;else a-=1;return c.line=s,c.column=a,!0},d=function(m){if(m===void 0)m=i;return m===-1},b=function(){},p=function(){},E=function(){if(S(),f(),ee(i)){while(ee(u()))f();return new le}else if(i===34)return U();else if(i===35)if(tr(u())||Q(u(1),u(2))){let m=new Ct("");if(N(u(1),u(2),u(3)))m.type="id";return m.value=me(),m}else return new L(i);else if(i===36)if(u()===61)return f(),new sr;else return new L(i);else if(i===39)return U();else if(i===40)return new _t;else if(i===41)return new Ee;else if(i===42)if(u()===61)return f(),new or;else return new L(i);else if(i===43)if(Be())return x(),w();else return new L(i);else if(i===44)return new wt;else if(i===45)if(Be())return x(),w();else if(u(1)===45&&u(2)===62)return f(2),new Et;else if(q())return x(),Y();else return new L(i);else if(i===46)if(Be())return x(),w();else return new L(i);else if(i===58)return new St;else if(i===59)return new yt;else if(i===60)if(u(1)===33&&u(2)===45&&u(3)===45)return f(3),new xt;else return new L(i);else if(i===64)if(N(u(1),u(2),u(3)))return new Lt(me());else return new L(i);else if(i===91)return new At;else if(i===92)if(g())return x(),Y();else return p(),new L(i);else if(i===93)return new Fe;else if(i===94)if(u()===61)return f(),new ir;else return new L(i);else if(i===123)return new Tt;else if(i===124)if(u()===61)return f(),new rr;else if(u()===124)return f(),new Nt;else return new L(i);else if(i===125)return new vt;else if(i===126)if(u()===61)return f(),new nr;else return new L(i);else if(V(i))return x(),w();else if(pt(i))return x(),Y();else if(d())return new Se;else return new L(i)},S=function(){while(u(1)===47&&u(2)===42){f(2);while(!0)if(f(),i===42&&u()===47){f();break}else if(d()){p();return}}},w=function(){let m=en();if(N(u(1),u(2),u(3))){let y=new ar;return y.value=m.value,y.repr=m.repr,y.type=m.type,y.unit=me(),y}else if(u()===37){f();let y=new kt;return y.value=m.value,y.repr=m.repr,y}else{let y=new Rt;return y.value=m.value,y.repr=m.repr,y.type=m.type,y}},Y=function(){let m=me();if(m.toLowerCase()==="url"&&u()===40){f();while(ee(u(1))&&ee(u(2)))f();if(u()===34||u()===39)return new ie(m);else if(ee(u())&&(u(2)===34||u(2)===39))return new ie(m);else return K()}else if(u()===40)return f(),new ie(m);else return new ye(m)},U=function(m){if(m===void 0)m=i;let y="";while(f())if(i===m||d())return new we(y);else if(be(i))return p(),x(),new bt;else if(i===92)if(d(u()))b();else if(be(u()))f();else y+=k(H());else y+=k(i);throw Error("Internal error")},K=function(){let m=new It("");while(ee(u()))f();if(d(u()))return m;while(f())if(i===41||d())return m;else if(ee(i)){while(ee(u()))f();if(u()===41||d(u()))return f(),m;else return ht(),new xe}else if(i===34||i===39||i===40||Fi(i))return p(),ht(),new xe;else if(i===92)if(g())m.value+=k(H());else return p(),ht(),new xe;else m.value+=k(i);throw Error("Internal error")},H=function(){if(f(),er(i)){let m=[i];for(let z=0;z<5;z++)if(er(u()))f(),m.push(i);else break;if(ee(u()))f();let y=parseInt(m.map(function(z){return String.fromCharCode(z)}).join(""),16);if(y>Wi)y=65533;return y}else if(d())return 65533;else return i},Q=function(m,y){if(m!==92)return!1;if(be(y))return!1;return!0},g=function(){return Q(i,u())},N=function(m,y,z){if(m===45)return pt(y)||y===45||Q(y,z);else if(pt(m))return!0;else if(m===92)return Q(m,y);else return!1},q=function(){return N(i,u(1),u(2))},Zt=function(m,y,z){if(m===43||m===45){if(V(y))return!0;if(y===46&&V(z))return!0;return!1}else if(m===46){if(V(y))return!0;return!1}else if(V(m))return!0;else return!1},Be=function(){return Zt(i,u(1),u(2))},me=function(){let m="";while(f())if(tr(i))m+=k(i);else if(g())m+=k(H());else return x(),m;throw Error("Internal parse error")},en=function(){let m="",y="integer";if(u()===43||u()===45)f(),m+=k(i);while(V(u()))f(),m+=k(i);if(u(1)===46&&V(u(2))){f(),m+=k(i),f(),m+=k(i),y="number";while(V(u()))f(),m+=k(i)}let z=u(1),tn=u(2),Oi=u(3);if((z===69||z===101)&&V(tn)){f(),m+=k(i),f(),m+=k(i),y="number";while(V(u()))f(),m+=k(i)}else if((z===69||z===101)&&(tn===43||tn===45)&&V(Oi)){f(),m+=k(i),f(),m+=k(i),f(),m+=k(i),y="number";while(V(u()))f(),m+=k(i)}let Mi=W(m);return{type:y,value:Mi,repr:m}},W=function(m){return+m},ht=function(){while(f())if(i===41||d())return;else if(g())H(),b();else b()},Gn=0;while(!d(u()))if(r.push(E()),Gn++,Gn>t.length*2)throw Error("I'm infinite-looping!");return r}class v{tokenType="";value;toJSON(){return{token:this.tokenType}}toString(){return this.tokenType}toSource(){return""+this}}class bt extends v{tokenType="BADSTRING"}class xe extends v{tokenType="BADURL"}class le extends v{tokenType="WHITESPACE";toString(){return"WS"}toSource(){return" "}}class xt extends v{tokenType="CDO";toSource(){return"<!--"}}class Et extends v{tokenType="CDC";toSource(){return"-->"}}class St extends v{tokenType=":"}class yt extends v{tokenType=";"}class wt extends v{tokenType=","}class ce extends v{value="";mirror=""}class Tt extends ce{tokenType="{";constructor(){super();this.value="{",this.mirror="}"}}class vt extends ce{tokenType="}";constructor(){super();this.value="}",this.mirror="{"}}class At extends ce{tokenType="[";constructor(){super();this.value="[",this.mirror="]"}}class Fe extends ce{tokenType="]";constructor(){super();this.value="]",this.mirror="["}}class _t extends ce{tokenType="(";constructor(){super();this.value="(",this.mirror=")"}}class Ee extends ce{tokenType=")";constructor(){super();this.value=")",this.mirror="("}}class nr extends v{tokenType="~="}class rr extends v{tokenType="|="}class ir extends v{tokenType="^="}class sr extends v{tokenType="$="}class or extends v{tokenType="*="}class Nt extends v{tokenType="||"}class Se extends v{tokenType="EOF";toSource(){return""}}class L extends v{tokenType="DELIM";value="";constructor(e){super();this.value=k(e)}toString(){return"DELIM("+this.value+")"}toJSON(){let e=this.constructor.prototype.constructor.prototype.toJSON.call(this);return e.value=this.value,e}toSource(){if(this.value==="\\")return"\\\n";else return this.value}}class ue extends v{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}}class ye extends ue{constructor(e){super();this.value=e}tokenType="IDENT";toString(){return"IDENT("+this.value+")"}toSource(){return We(this.value)}}class ie extends ue{tokenType="FUNCTION";mirror;constructor(e){super();this.value=e,this.mirror=")"}toString(){return"FUNCTION("+this.value+")"}toSource(){return We(this.value)+"("}}class Lt extends ue{tokenType="AT-KEYWORD";constructor(e){super();this.value=e}toString(){return"AT("+this.value+")"}toSource(){return"@"+We(this.value)}}class Ct extends ue{tokenType="HASH";type;constructor(e){super();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(){if(this.type==="id")return"#"+We(this.value);else return"#"+ji(this.value)}}class we extends ue{tokenType="STRING";constructor(e){super();this.value=e}toString(){return'"'+lr(this.value)+'"'}}class It extends ue{tokenType="URL";constructor(e){super();this.value=e}toString(){return"URL("+this.value+")"}toSource(){return'url("'+lr(this.value)+'")'}}class Rt extends v{tokenType="NUMBER";type;repr;constructor(){super();this.type="integer",this.repr=""}toString(){if(this.type==="integer")return"INT("+this.value+")";return"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}}class kt extends v{tokenType="PERCENTAGE";repr;constructor(){super();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+"%"}}class ar extends v{tokenType="DIMENSION";type;repr;unit;constructor(){super();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=We(this.unit);if(t[0].toLowerCase()==="e"&&(t[1]==="-"||C(t.charCodeAt(1),48,57)))t="\\65 "+t.slice(1,t.length);return e+t}}function We(e){e=""+e;let t="",n=e.charCodeAt(0);for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);if(i===0)throw new gt("Invalid character: the input contains U+0000.");if(C(i,1,31)||i===127||r===0&&C(i,48,57)||r===1&&C(i,48,57)&&n===45)t+="\\"+i.toString(16)+" ";else if(i>=128||i===45||i===95||C(i,48,57)||C(i,65,90)||C(i,97,122))t+=e[r];else t+="\\"+e[r]}return t}function ji(e){e=""+e;let t="";for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(r===0)throw new gt("Invalid character: the input contains U+0000.");if(r>=128||r===45||r===95||C(r,48,57)||C(r,65,90)||C(r,97,122))t+=e[n];else t+="\\"+r.toString(16)+" "}return t}function lr(e){e=""+e;let t="";for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(r===0)throw new gt("Invalid character: the input contains U+0000.");if(C(r,1,31)||r===127)t+="\\"+r.toString(16)+" ";else if(r===34||r===92)t+="\\"+e[n];else t+=e[n]}return t}class M extends Error{}function ur(e,t){let n;try{if(n=mt(e),!(n[n.length-1]instanceof Se))n.push(new Se)}catch(g){let N=g.message+` while parsing css selector "${e}". Did you mean to CSS.escape it?`,q=(g.stack||"").indexOf(g.message);if(q!==-1)g.stack=g.stack.substring(0,q)+N+g.stack.substring(q+g.message.length);throw g.message=N,g}let r=n.find((g)=>{return g instanceof Lt||g instanceof bt||g instanceof xe||g instanceof Nt||g instanceof xt||g instanceof Et||g instanceof yt||g instanceof Tt||g instanceof vt||g instanceof It||g instanceof kt});if(r)throw new M(`Unsupported token "${r.toSource()}" while parsing css selector "${e}". Did you mean to CSS.escape it?`);let i=0,s=new Set;function a(){return new M(`Unexpected token "${n[i].toSource()}" while parsing css selector "${e}". Did you mean to CSS.escape it?`)}function o(){while(n[i]instanceof le)i++}function l(g=i){return n[g]instanceof ye}function c(g=i){return n[g]instanceof we}function h(g=i){return n[g]instanceof Rt}function u(g=i){return n[g]instanceof wt}function f(g=i){return n[g]instanceof _t}function x(g=i){return n[g]instanceof Ee}function d(g=i){return n[g]instanceof ie}function b(g=i){return n[g]instanceof L&&n[g].value==="*"}function p(g=i){return n[g]instanceof Se}function E(g=i){return n[g]instanceof L&&[">","+","~"].includes(n[g].value)}function S(g=i){return u(g)||x(g)||p(g)||E(g)||n[g]instanceof le}function w(){let g=[Y()];while(!0){if(o(),!u())break;i++,g.push(Y())}return g}function Y(){if(o(),h())return n[i++].value;if(c())return n[i++].value;return U()}function U(){let g={simples:[]};if(o(),E())g.simples.push({selector:{functions:[{name:"scope",args:[]}]},combinator:""});else g.simples.push({selector:K(),combinator:""});while(!0){if(o(),E())g.simples[g.simples.length-1].combinator=n[i++].value,o();else if(S())break;g.simples.push({combinator:"",selector:K()})}return g}function K(){let g="",N=[];while(!S())if(l()||b())g+=n[i++].toSource();else if(n[i]instanceof Ct)g+=n[i++].toSource();else if(n[i]instanceof L&&n[i].value===".")if(i++,l())g+="."+n[i++].toSource();else throw a();else if(n[i]instanceof St)if(i++,l())if(!t.has(n[i].value.toLowerCase()))g+=":"+n[i++].toSource();else{let q=n[i++].value.toLowerCase();N.push({name:q,args:[]}),s.add(q)}else if(d()){let q=n[i++].value.toLowerCase();if(!t.has(q))g+=`:${q}(${H()})`;else N.push({name:q,args:w()}),s.add(q);if(o(),!x())throw a();i++}else throw a();else if(n[i]instanceof At){g+="[",i++;while(!(n[i]instanceof Fe)&&!p())g+=n[i++].toSource();if(!(n[i]instanceof Fe))throw a();g+="]",i++}else throw a();if(!g&&!N.length)throw a();return{css:g||void 0,functions:N}}function H(){let g="",N=1;while(!p()){if(f()||d())N++;if(x())N--;if(!N)break;g+=n[i++].toSource()}return g}let Q=w();if(!p())throw a();if(Q.some((g)=>typeof g!=="object"||!("simples"in g)))throw new M(`Error while parsing css selector "${e}". Did you mean to CSS.escape it?`);return{selector:Q,names:Array.from(s)}}var sn=new Set(["internal:has","internal:has-not","internal:and","internal:or","internal:chain","left-of","right-of","above","below","near"]),zi=new Set(["left-of","right-of","above","below","near"]),on=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 Ve(e){let t=Qi(e),n=[];for(let r of t.parts){if(r.name==="css"||r.name==="css:light"){if(r.name==="css:light")r.body=":light("+r.body+")";let i=ur(r.body,on);n.push({name:"css",body:i.selector,source:r.body});continue}if(sn.has(r.name)){let i,s;try{let c=JSON.parse("["+r.body+"]");if(!Array.isArray(c)||c.length<1||c.length>2||typeof c[0]!=="string")throw new M(`Malformed selector: ${r.name}=`+r.body);if(i=c[0],c.length===2){if(typeof c[1]!=="number"||!zi.has(r.name))throw new M(`Malformed selector: ${r.name}=`+r.body);s=c[1]}}catch(c){throw new M(`Malformed selector: ${r.name}=`+r.body)}let a={name:r.name,source:r.body,body:{parsed:Ve(i),distance:s}},o=[...a.body.parsed.parts].reverse().find((c)=>c.name==="internal:control"&&c.body==="enter-frame"),l=o?a.body.parsed.parts.indexOf(o):-1;if(l!==-1&&Yi(a.body.parsed.parts.slice(0,l+1),n.slice(0,l+1)))a.body.parsed.parts.splice(0,l+1);n.push(a);continue}n.push({...r,source:r.body})}if(sn.has(n[0].name))throw new M(`"${n[0].name}" selector cannot be first`);return{capture:t.capture,parts:n}}function Yi(e,t){return F({parts:e})===F({parts:t})}function F(e,t){if(typeof e==="string")return e;return e.parts.map((n,r)=>{let i=!0;if(!t&&r!==e.capture){if(n.name==="css")i=!1;else if(n.name==="xpath"&&n.source.startsWith("//")||n.source.startsWith(".."))i=!1}let s=i?n.name+"=":"";return`${r===e.capture?"*":""}${s}${n.source}`}).join(" >> ")}function dr(e,t){let n=(r,i)=>{for(let s of r.parts)if(t(s,i),sn.has(s.name))n(s.body.parsed,!0)};n(e,!1)}function Qi(e){let t=0,n,r=0,i={parts:[]},s=()=>{let o=e.substring(r,t).trim(),l=o.indexOf("="),c,h;if(l!==-1&&o.substring(0,l).trim().match(/^[a-zA-Z_0-9-+:*]+$/))c=o.substring(0,l).trim(),h=o.substring(l+1);else if(o.length>1&&o[0]==='"'&&o[o.length-1]==='"')c="text",h=o;else if(o.length>1&&o[0]==="'"&&o[o.length-1]==="'")c="text",h=o;else if(/^\(*\/\//.test(o)||o.startsWith(".."))c="xpath",h=o;else c="css",h=o;let u=!1;if(c[0]==="*")u=!0,c=c.substring(1);if(i.parts.push({name:c,body:h}),u){if(i.capture!==void 0)throw new M("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 a=()=>{let l=e.substring(r,t).match(/^\s*text\s*=(.*)$/);return!!l&&!!l[1]};while(t<e.length){let o=e[t];if(o==="\\"&&t+1<e.length)t+=2;else if(o===n)n=void 0,t++;else if(!n&&(o==='"'||o==="'"||o==="`")&&!a())n=o,t++;else if(!n&&o===">"&&e[t+1]===">")s(),t+=2,r=t;else t++}return s(),i}function se(e,t){let n=0,r=e.length===0,i=()=>e[n]||"",s=()=>{let p=i();return++n,r=n>=e.length,p},a=(p)=>{if(r)throw new M(`Unexpected end of selector while parsing selector \`${e}\``);throw new M(`Error while parsing selector \`${e}\` - unexpected symbol "${i()}" at position ${n}`+(p?" during "+p:""))};function o(){while(!r&&/\s/.test(i()))s()}function l(p){return p>="€"||p>="0"&&p<="9"||p>="A"&&p<="Z"||p>="a"&&p<="z"||p>="0"&&p<="9"||p==="_"||p==="-"}function c(){let p="";o();while(!r&&l(i()))p+=s();return p}function h(p){let E=s();if(E!==p)a("parsing quoted string");while(!r&&i()!==p){if(i()==="\\")s();E+=s()}if(i()!==p)a("parsing quoted string");return E+=s(),E}function u(){if(s()!=="/")a("parsing regular expression");let p="",E=!1;while(!r){if(i()==="\\"){if(p+=s(),r)a("parsing regular expression")}else if(E&&i()==="]")E=!1;else if(!E&&i()==="[")E=!0;else if(!E&&i()==="/")break;p+=s()}if(s()!=="/")a("parsing regular expression");let S="";while(!r&&i().match(/[dgimsuy]/))S+=s();try{return new RegExp(p,S)}catch(w){throw new M(`Error while parsing selector \`${e}\`: ${w.message}`)}}function f(){let p="";if(o(),i()==="'"||i()==='"')p=h(i()).slice(1,-1);else p=c();if(!p)a("parsing property path");return p}function x(){o();let p="";if(!r)p+=s();if(!r&&p!=="=")p+=s();if(!["=","*=","^=","$=","|=","~="].includes(p))a("parsing operator");return p}function d(){s();let p=[];p.push(f()),o();while(i()===".")s(),p.push(f()),o();if(i()==="]")return s(),{name:p.join("."),jsonPath:p,op:"<truthy>",value:null,caseSensitive:!1};let E=x(),S=void 0,w=!0;if(o(),i()==="/"){if(E!=="=")throw new M(`Error while parsing selector \`${e}\` - cannot use ${E} in attribute with regular expression`);S=u()}else if(i()==="'"||i()==='"'){if(S=h(i()).slice(1,-1),o(),i()==="i"||i()==="I")w=!1,s();else if(i()==="s"||i()==="S")w=!0,s()}else{S="";while(!r&&(l(i())||i()==="+"||i()==="."))S+=s();if(S==="true")S=!0;else if(S==="false")S=!1;else if(!t){if(S=+S,Number.isNaN(S))a("parsing attribute value")}}if(o(),i()!=="]")a("parsing attribute value");if(s(),E!=="="&&typeof S!=="string")throw new M(`Error while parsing selector \`${e}\` - cannot use ${E} in attribute with non-string matching value - ${S}`);return{name:p.join("."),jsonPath:p,op:E,value:S,caseSensitive:w}}let b={name:"",attributes:[]};b.name=c(),o();while(i()==="[")b.attributes.push(d()),o();if(!r)a(void 0);if(!b.name&&!b.attributes.length)throw new M(`Error while parsing selector \`${e}\` - selector cannot be empty`);return b}function je(e,t="'"){let n=JSON.stringify(e),r=n.substring(1,n.length-1).replace(/\\"/g,'"');if(t==="'")return t+r.replace(/[']/g,"\\'")+t;if(t==='"')return t+r.replace(/["]/g,"\\\"")+t;if(t==="`")return t+r.replace(/[`]/g,"\\`")+t;throw Error("Invalid escape char")}function ze(e){return e.charAt(0).toUpperCase()+e.substring(1)}function ln(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/([A-Z])([A-Z][a-z])/g,"$1_$2").toLowerCase()}function de(e){return`"${e.replace(/["\\]/g,(t)=>"\\"+t)}"`}var an;function hr(){an=new Map}function A(e){let t=an?.get(e);if(t===void 0)t=e.replace(/[\u200b\u00ad]/g,"").trim().replace(/\s+/g," "),an?.set(e,t);return t}function Ye(e){return e.replace(/(^|[^\\])(\\\\)*\\(['"`])/g,"$1$2$3")}function fr(e){if(e.unicode||e.unicodeSets)return String(e);return String(e).replace(/(^|[^\\])(\\\\)*(["'`])/g,"$1$2\\$3").replace(/>>/g,"\\>\\>")}function I(e,t){if(typeof e!=="string")return fr(e);return`${JSON.stringify(e)}${t?"s":"i"}`}function O(e,t){if(typeof e!=="string")return fr(e);return`"${e.replace(/\\/g,"\\\\").replace(/["]/g,"\\\"")}"${t?"s":"i"}`}function Gi(e,t,n=""){if(e.length<=t)return e;let r=[...e];if(r.length>t)return r.slice(0,t-n.length).join("")+n;return r.join("")}function cn(e,t){return Gi(e,t,"…")}function Te(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function pr(e,t){let n=e.length,r=t.length,i=0,s=0,a=Array(n+1).fill(null).map(()=>Array(r+1).fill(0));for(let o=1;o<=n;o++)for(let l=1;l<=r;l++)if(e[o-1]===t[l-1]){if(a[o][l]=a[o-1][l-1]+1,a[o][l]>i)i=a[o][l],s=o}return e.slice(s-i,s)}var Wo=new RegExp("([\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~])))","g");function te(e,t,n=!1){return Ji(e,t,n,1)[0]}function Ji(e,t,n=!1,r=20,i){try{return ve(new Xi[e](i),Ve(t),n,r)}catch(s){return[t]}}function ve(e,t,n=!1,r=20){let i=[...t.parts],s=[],a=n?"frame-locator":"page";for(let o=0;o<i.length;o++){let l=i[o],c=a;if(a="locator",l.name==="internal:describe")continue;if(l.name==="nth"){if(l.body==="0")s.push([e.generateLocator(c,"first",""),e.generateLocator(c,"nth","0")]);else if(l.body==="-1")s.push([e.generateLocator(c,"last",""),e.generateLocator(c,"nth","-1")]);else s.push([e.generateLocator(c,"nth",l.body)]);continue}if(l.name==="visible"){s.push([e.generateLocator(c,"visible",l.body),e.generateLocator(c,"default",`visible=${l.body}`)]);continue}if(l.name==="internal:text"){let{exact:d,text:b}=Qe(l.body);s.push([e.generateLocator(c,"text",b,{exact:d})]);continue}if(l.name==="internal:has-text"){let{exact:d,text:b}=Qe(l.body);if(!d){s.push([e.generateLocator(c,"has-text",b,{exact:d})]);continue}}if(l.name==="internal:has-not-text"){let{exact:d,text:b}=Qe(l.body);if(!d){s.push([e.generateLocator(c,"has-not-text",b,{exact:d})]);continue}}if(l.name==="internal:has"){let d=ve(e,l.body.parsed,!1,r);s.push(d.map((b)=>e.generateLocator(c,"has",b)));continue}if(l.name==="internal:has-not"){let d=ve(e,l.body.parsed,!1,r);s.push(d.map((b)=>e.generateLocator(c,"hasNot",b)));continue}if(l.name==="internal:and"){let d=ve(e,l.body.parsed,!1,r);s.push(d.map((b)=>e.generateLocator(c,"and",b)));continue}if(l.name==="internal:or"){let d=ve(e,l.body.parsed,!1,r);s.push(d.map((b)=>e.generateLocator(c,"or",b)));continue}if(l.name==="internal:chain"){let d=ve(e,l.body.parsed,!1,r);s.push(d.map((b)=>e.generateLocator(c,"chain",b)));continue}if(l.name==="internal:label"){let{exact:d,text:b}=Qe(l.body);s.push([e.generateLocator(c,"label",b,{exact:d})]);continue}if(l.name==="internal:role"){let d=se(l.body,!0),b={attrs:[]};for(let p of d.attributes)if(p.name==="name")b.exact=p.caseSensitive,b.name=p.value;else{if(p.name==="level"&&typeof p.value==="string")p.value=+p.value;b.attrs.push({name:p.name==="include-hidden"?"includeHidden":p.name,value:p.value})}s.push([e.generateLocator(c,"role",d.name,b)]);continue}if(l.name==="internal:testid"){let d=se(l.body,!0),{value:b}=d.attributes[0];s.push([e.generateLocator(c,"test-id",b)]);continue}if(l.name==="internal:attr"){let d=se(l.body,!0),{name:b,value:p,caseSensitive:E}=d.attributes[0],S=p,w=!!E;if(b==="placeholder"){s.push([e.generateLocator(c,"placeholder",S,{exact:w})]);continue}if(b==="alt"){s.push([e.generateLocator(c,"alt",S,{exact:w})]);continue}if(b==="title"){s.push([e.generateLocator(c,"title",S,{exact:w})]);continue}}if(l.name==="internal:control"&&l.body==="enter-frame"){let d=s[s.length-1],b=i[o-1],p=d.map((E)=>e.chainLocators([E,e.generateLocator(c,"frame","")]));if(["xpath","css"].includes(b.name))p.push(e.generateLocator(c,"frame-locator",F({parts:[b]})),e.generateLocator(c,"frame-locator",F({parts:[b]},!0)));d.splice(0,d.length,...p),a="frame-locator";continue}let h=i[o+1],u=F({parts:[l]}),f=e.generateLocator(c,"default",u);if(h&&["internal:has-text","internal:has-not-text"].includes(h.name)){let{exact:d,text:b}=Qe(h.body);if(!d){let p=e.generateLocator("locator",h.name==="internal:has-text"?"has-text":"has-not-text",b,{exact:d}),E={};if(h.name==="internal:has-text")E.hasText=b;else E.hasNotText=b;let S=e.generateLocator(c,"default",u,E);s.push([e.chainLocators([f,p]),S]),o++;continue}}let x;if(["xpath","css"].includes(l.name)){let d=F({parts:[l]},!0);x=e.generateLocator(c,"default",d)}s.push([f,x].filter(Boolean))}return Ki(e,s,r)}function Ki(e,t,n){let r=t.map(()=>""),i=[],s=(a)=>{if(a===t.length)return i.push(e.chainLocators(r)),i.length<n;for(let o of t[a])if(r[a]=o,!s(a+1))return!1;return!0};return s(0),i}function Qe(e){let t=!1,n=e.match(/^\/(.*)\/([igm]*)$/);if(n)return{text:new RegExp(n[1],n[2])};if(e.endsWith('"'))e=JSON.parse(e),t=!0;else if(e.endsWith('"s'))e=JSON.parse(e.substring(0,e.length-1)),t=!0;else if(e.endsWith('"i'))e=JSON.parse(e.substring(0,e.length-1)),t=!1;return{exact:t,text:e}}class gr{preferredQuote;constructor(e){this.preferredQuote=e}generateLocator(e,t,n,r={}){switch(t){case"default":if(r.hasText!==void 0)return`locator(${this.quote(n)}, { hasText: ${this.toHasText(r.hasText)} })`;if(r.hasNotText!==void 0)return`locator(${this.quote(n)}, { hasNotText: ${this.toHasText(r.hasNotText)} })`;return`locator(${this.quote(n)})`;case"frame-locator":return`frameLocator(${this.quote(n)})`;case"frame":return"contentFrame()";case"nth":return`nth(${n})`;case"first":return"first()";case"last":return"last()";case"visible":return`filter({ visible: ${n==="true"?"true":"false"} })`;case"role":let i=[];if($(r.name))i.push(`name: ${this.regexToSourceString(r.name)}`);else if(typeof r.name==="string"){if(i.push(`name: ${this.quote(r.name)}`),r.exact)i.push("exact: true")}for(let{name:a,value:o}of r.attrs)i.push(`${a}: ${typeof o==="string"?this.quote(o):o}`);let s=i.length?`, { ${i.join(", ")} }`:"";return`getByRole(${this.quote(n)}${s})`;case"has-text":return`filter({ hasText: ${this.toHasText(n)} })`;case"has-not-text":return`filter({ hasNotText: ${this.toHasText(n)} })`;case"has":return`filter({ has: ${n} })`;case"hasNot":return`filter({ hasNot: ${n} })`;case"and":return`and(${n})`;case"or":return`or(${n})`;case"chain":return`locator(${n})`;case"test-id":return`getByTestId(${this.toTestIdValue(n)})`;case"text":return this.toCallWithExact("getByText",n,!!r.exact);case"alt":return this.toCallWithExact("getByAltText",n,!!r.exact);case"placeholder":return this.toCallWithExact("getByPlaceholder",n,!!r.exact);case"label":return this.toCallWithExact("getByLabel",n,!!r.exact);case"title":return this.toCallWithExact("getByTitle",n,!!r.exact);default:throw Error("Unknown selector kind "+t)}}chainLocators(e){return e.join(".")}regexToSourceString(e){return Ye(String(e))}toCallWithExact(e,t,n){if($(t))return`${e}(${this.regexToSourceString(t)})`;return n?`${e}(${this.quote(t)}, { exact: true })`:`${e}(${this.quote(t)})`}toHasText(e){if($(e))return this.regexToSourceString(e);return this.quote(e)}toTestIdValue(e){if($(e))return this.regexToSourceString(e);return this.quote(e)}quote(e){return je(e,this.preferredQuote??"'")}}class mr{generateLocator(e,t,n,r={}){switch(t){case"default":if(r.hasText!==void 0)return`locator(${this.quote(n)}, has_text=${this.toHasText(r.hasText)})`;if(r.hasNotText!==void 0)return`locator(${this.quote(n)}, has_not_text=${this.toHasText(r.hasNotText)})`;return`locator(${this.quote(n)})`;case"frame-locator":return`frame_locator(${this.quote(n)})`;case"frame":return"content_frame";case"nth":return`nth(${n})`;case"first":return"first";case"last":return"last";case"visible":return`filter(visible=${n==="true"?"True":"False"})`;case"role":let i=[];if($(r.name))i.push(`name=${this.regexToString(r.name)}`);else if(typeof r.name==="string"){if(i.push(`name=${this.quote(r.name)}`),r.exact)i.push("exact=True")}for(let{name:a,value:o}of r.attrs){let l=typeof o==="string"?this.quote(o):o;if(typeof o==="boolean")l=o?"True":"False";i.push(`${ln(a)}=${l}`)}let s=i.length?`, ${i.join(", ")}`:"";return`get_by_role(${this.quote(n)}${s})`;case"has-text":return`filter(has_text=${this.toHasText(n)})`;case"has-not-text":return`filter(has_not_text=${this.toHasText(n)})`;case"has":return`filter(has=${n})`;case"hasNot":return`filter(has_not=${n})`;case"and":return`and_(${n})`;case"or":return`or_(${n})`;case"chain":return`locator(${n})`;case"test-id":return`get_by_test_id(${this.toTestIdValue(n)})`;case"text":return this.toCallWithExact("get_by_text",n,!!r.exact);case"alt":return this.toCallWithExact("get_by_alt_text",n,!!r.exact);case"placeholder":return this.toCallWithExact("get_by_placeholder",n,!!r.exact);case"label":return this.toCallWithExact("get_by_label",n,!!r.exact);case"title":return this.toCallWithExact("get_by_title",n,!!r.exact);default:throw Error("Unknown selector kind "+t)}}chainLocators(e){return e.join(".")}regexToString(e){let t=e.flags.includes("i")?", re.IGNORECASE":"";return`re.compile(r"${Ye(e.source).replace(/\\\//,"/").replace(/"/g,"\\\"")}"${t})`}toCallWithExact(e,t,n){if($(t))return`${e}(${this.regexToString(t)})`;if(n)return`${e}(${this.quote(t)}, exact=True)`;return`${e}(${this.quote(t)})`}toHasText(e){if($(e))return this.regexToString(e);return`${this.quote(e)}`}toTestIdValue(e){if($(e))return this.regexToString(e);return this.quote(e)}quote(e){return je(e,'"')}}class br{generateLocator(e,t,n,r={}){let i;switch(e){case"page":i="Page";break;case"frame-locator":i="FrameLocator";break;case"locator":i="Locator";break}switch(t){case"default":if(r.hasText!==void 0)return`locator(${this.quote(n)}, new ${i}.LocatorOptions().setHasText(${this.toHasText(r.hasText)}))`;if(r.hasNotText!==void 0)return`locator(${this.quote(n)}, new ${i}.LocatorOptions().setHasNotText(${this.toHasText(r.hasNotText)}))`;return`locator(${this.quote(n)})`;case"frame-locator":return`frameLocator(${this.quote(n)})`;case"frame":return"contentFrame()";case"nth":return`nth(${n})`;case"first":return"first()";case"last":return"last()";case"visible":return`filter(new ${i}.FilterOptions().setVisible(${n==="true"?"true":"false"}))`;case"role":let s=[];if($(r.name))s.push(`.setName(${this.regexToString(r.name)})`);else if(typeof r.name==="string"){if(s.push(`.setName(${this.quote(r.name)})`),r.exact)s.push(".setExact(true)")}for(let{name:o,value:l}of r.attrs)s.push(`.set${ze(o)}(${typeof l==="string"?this.quote(l):l})`);let a=s.length?`, new ${i}.GetByRoleOptions()${s.join("")}`:"";return`getByRole(AriaRole.${ln(n).toUpperCase()}${a})`;case"has-text":return`filter(new ${i}.FilterOptions().setHasText(${this.toHasText(n)}))`;case"has-not-text":return`filter(new ${i}.FilterOptions().setHasNotText(${this.toHasText(n)}))`;case"has":return`filter(new ${i}.FilterOptions().setHas(${n}))`;case"hasNot":return`filter(new ${i}.FilterOptions().setHasNot(${n}))`;case"and":return`and(${n})`;case"or":return`or(${n})`;case"chain":return`locator(${n})`;case"test-id":return`getByTestId(${this.toTestIdValue(n)})`;case"text":return this.toCallWithExact(i,"getByText",n,!!r.exact);case"alt":return this.toCallWithExact(i,"getByAltText",n,!!r.exact);case"placeholder":return this.toCallWithExact(i,"getByPlaceholder",n,!!r.exact);case"label":return this.toCallWithExact(i,"getByLabel",n,!!r.exact);case"title":return this.toCallWithExact(i,"getByTitle",n,!!r.exact);default:throw 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(Ye(e.source))}${t})`}toCallWithExact(e,t,n,r){if($(n))return`${t}(${this.regexToString(n)})`;if(r)return`${t}(${this.quote(n)}, new ${e}.${ze(t)}Options().setExact(true))`;return`${t}(${this.quote(n)})`}toHasText(e){if($(e))return this.regexToString(e);return this.quote(e)}toTestIdValue(e){if($(e))return this.regexToString(e);return this.quote(e)}quote(e){return je(e,'"')}}class xr{generateLocator(e,t,n,r={}){switch(t){case"default":if(r.hasText!==void 0)return`Locator(${this.quote(n)}, new() { ${this.toHasText(r.hasText)} })`;if(r.hasNotText!==void 0)return`Locator(${this.quote(n)}, new() { ${this.toHasNotText(r.hasNotText)} })`;return`Locator(${this.quote(n)})`;case"frame-locator":return`FrameLocator(${this.quote(n)})`;case"frame":return"ContentFrame";case"nth":return`Nth(${n})`;case"first":return"First";case"last":return"Last";case"visible":return`Filter(new() { Visible = ${n==="true"?"true":"false"} })`;case"role":let i=[];if($(r.name))i.push(`NameRegex = ${this.regexToString(r.name)}`);else if(typeof r.name==="string"){if(i.push(`Name = ${this.quote(r.name)}`),r.exact)i.push("Exact = true")}for(let{name:a,value:o}of r.attrs)i.push(`${ze(a)} = ${typeof o==="string"?this.quote(o):o}`);let s=i.length?`, new() { ${i.join(", ")} }`:"";return`GetByRole(AriaRole.${ze(n)}${s})`;case"has-text":return`Filter(new() { ${this.toHasText(n)} })`;case"has-not-text":return`Filter(new() { ${this.toHasNotText(n)} })`;case"has":return`Filter(new() { Has = ${n} })`;case"hasNot":return`Filter(new() { HasNot = ${n} })`;case"and":return`And(${n})`;case"or":return`Or(${n})`;case"chain":return`Locator(${n})`;case"test-id":return`GetByTestId(${this.toTestIdValue(n)})`;case"text":return this.toCallWithExact("GetByText",n,!!r.exact);case"alt":return this.toCallWithExact("GetByAltText",n,!!r.exact);case"placeholder":return this.toCallWithExact("GetByPlaceholder",n,!!r.exact);case"label":return this.toCallWithExact("GetByLabel",n,!!r.exact);case"title":return this.toCallWithExact("GetByTitle",n,!!r.exact);default:throw 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(Ye(e.source))}${t})`}toCallWithExact(e,t,n){if($(t))return`${e}(${this.regexToString(t)})`;if(n)return`${e}(${this.quote(t)}, new() { Exact = true })`;return`${e}(${this.quote(t)})`}toHasText(e){if($(e))return`HasTextRegex = ${this.regexToString(e)}`;return`HasText = ${this.quote(e)}`}toTestIdValue(e){if($(e))return this.regexToString(e);return this.quote(e)}toHasNotText(e){if($(e))return`HasNotTextRegex = ${this.regexToString(e)}`;return`HasNotText = ${this.quote(e)}`}quote(e){return je(e,'"')}}class Er{generateLocator(e,t,n,r={}){return JSON.stringify({kind:t,body:n,options:r})}chainLocators(e){let t=e.map((n)=>JSON.parse(n));for(let n=0;n<t.length-1;++n)t[n].next=t[n+1];return JSON.stringify(t[0])}}var Xi={javascript:gr,python:mr,java:br,csharp:xr,jsonl:Er};function $(e){return e instanceof RegExp}function Sr(e){if(!yr(e))return e;return"'"+e.replace(/'/g,"''")+"'"}function Ot(e){if(!yr(e))return e;return'"'+e.replace(/[\\"\x00-\x1f\x7f-\x9f]/g,(t)=>{switch(t){case"\\":return"\\\\";case'"':return"\\\"";case"\b":return"\\b";case"\f":return"\\f";case`
`:return"\\n";case"\r":return"\\r";case"\t":return"\\t";default:return"\\x"+t.charCodeAt(0).toString(16).padStart(2,"0")}})+'"'}function yr(e){if(e.length===0)return!0;if(/^\s|\s$/.test(e))return!0;if(/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f-\x9f]/.test(e))return!0;if(/^-/.test(e))return!0;if(/[\n:](\s|$)/.test(e))return!0;if(/\s#/.test(e))return!0;if(/[\n\r]/.test(e))return!0;if(/^[&*\],?!>|@"'#%]/.test(e))return!0;if(/[{}`]/.test(e))return!0;if(/^\[/.test(e))return!0;if(!isNaN(Number(e))||["y","n","yes","no","true","false","on","off","null"].includes(e.toLowerCase()))return!0;return!1}var wr={};function Tr(e){wr=e}function Ge(e,t){while(t){if(e.contains(t))return!0;t=vr(t)}return!1}function R(e){if(e.parentElement)return e.parentElement;if(!e.parentNode)return;if(e.parentNode.nodeType===11&&e.parentNode.host)return e.parentNode.host}function Mt(e){let t=e;while(t.parentNode)t=t.parentNode;if(t.nodeType===11||t.nodeType===9)return t}function vr(e){while(e.parentElement)e=e.parentElement;return R(e)}function he(e,t,n){while(e){let r=e.closest(t);if(n&&r!==n&&r?.contains(n))return;if(r)return r;e=vr(e)}}function Z(e,t){let n=t==="::before"?fn:t==="::after"?pn:hn;if(n&&n.has(e))return n.get(e);let r=e.ownerDocument&&e.ownerDocument.defaultView?e.ownerDocument.defaultView.getComputedStyle(e,t):void 0;return n?.set(e,r),r}function un(e,t){if(t=t??Z(e),!t)return!0;if(Element.prototype.checkVisibility&&wr.browserNameForWorkarounds!=="webkit"){if(!e.checkVisibility())return!1}else{let n=e.closest("details,summary");if(n!==e&&n?.nodeName==="DETAILS"&&!n.open)return!1}if(t.visibility!=="visible")return!1;return!0}function Je(e){let t=Z(e);if(!t)return{visible:!0,inline:!1};let n=t.cursor;if(t.display==="contents"){for(let i=e.firstChild;i;i=i.nextSibling){if(i.nodeType===1&&B(i))return{visible:!0,inline:!1,cursor:n};if(i.nodeType===3&&dn(i))return{visible:!0,inline:!0,cursor:n}}return{visible:!1,inline:!1,cursor:n}}if(!un(e,t))return{cursor:n,visible:!1,inline:!1};let r=e.getBoundingClientRect();return{cursor:n,visible:r.width>0&&r.height>0,inline:t.display==="inline"}}function B(e){return Je(e).visible}function dn(e){let t=e.ownerDocument.createRange();t.selectNode(e);let n=t.getBoundingClientRect();return n.width>0&&n.height>0}function _(e){let t=e.tagName;if(typeof t==="string")return t.toUpperCase();if(e instanceof HTMLFormElement)return"FORM";return e.tagName.toUpperCase()}var hn,fn,pn,Ar=0;function Ae(){++Ar,hn??=new Map,fn??=new Map,pn??=new Map}function _e(){if(!--Ar)hn=void 0,fn=void 0,pn=void 0}function _r(e){return e.hasAttribute("aria-label")||e.hasAttribute("aria-labelledby")}var Nr="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]",Zi=[["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",["caption","code","deletion","emphasis","generic","insertion","paragraph","presentation","strong","subscript","superscript"]],["aria-labelledby",["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",["generic"]]];function kr(e,t){return Zi.some(([n,r])=>{return!r?.includes(t||"")&&e.hasAttribute(n)})}function Or(e){return!Number.isNaN(Number(String(e.getAttribute("tabindex"))))}function es(e){return!Br(e)&&(ts(e)||Or(e))}function ts(e){let t=_(e);if(["BUTTON","DETAILS","SELECT","TEXTAREA"].includes(t))return!0;if(t==="A"||t==="AREA")return e.hasAttribute("href");if(t==="INPUT")return!e.hidden;return!1}var ns={A:(e)=>{return e.hasAttribute("href")?"link":null},AREA:(e)=>{return 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)=>he(e,Nr)?null:"contentinfo",FORM:(e)=>_r(e)?"form":null,H1:()=>"heading",H2:()=>"heading",H3:()=>"heading",H4:()=>"heading",H5:()=>"heading",H6:()=>"heading",HEADER:(e)=>he(e,Nr)?null:"banner",HR:()=>"separator",HTML:()=>"document",IMG:(e)=>e.getAttribute("alt")===""&&!e.getAttribute("title")&&!kr(e)&&!Or(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 n=Le(e,e.getAttribute("list"))[0];return n&&_(n)==="DATALIST"?"combobox":"textbox"}if(t==="hidden")return null;if(t==="file")return"button";return fs[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",SEARCH:()=>"search",SECTION:(e)=>_r(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=he(e,"table"),n=t?gn(t):"";return n==="grid"||n==="treegrid"?"gridcell":"cell"},TEXTAREA:()=>"textbox",TFOOT:()=>"rowgroup",TH:(e)=>{let t=e.getAttribute("scope");if(t==="col"||t==="colgroup")return"columnheader";if(t==="row"||t==="rowgroup")return"rowheader";let{nextElementSibling:n,previousElementSibling:r}=e,i=!!e.parentElement&&_(e.parentElement)==="TR"?e.parentElement:void 0;if(!n&&!r){if(i){let s=he(i,"table");if(s&&s.rows.length<=1)return null}return"columnheader"}if(Lr(n)&&Lr(r))return"columnheader";if(Cr(n)||Cr(r))return"rowheader";return"columnheader"},THEAD:()=>"rowgroup",TIME:()=>"time",TR:()=>"row",UL:()=>"list"};function Lr(e){return!!e&&_(e)==="TH"}function Cr(e){if(!e||_(e)!=="TD")return!1;return!!(e.textContent?.trim()||e.children.length>0)}var rs={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 Ir(e){let t=ns[_(e)]?.(e)||"";if(!t)return null;let n=e;while(n){let r=R(n),i=rs[_(n)];if(!i||!r||!i.includes(_(r)))break;let s=gn(r);if((s==="none"||s==="presentation")&&!Mr(r,s))return s;n=r}return t}var is=["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 gn(e){return(e.getAttribute("role")||"").split(" ").map((n)=>n.trim()).find((n)=>is.includes(n))||null}function Mr(e,t){return kr(e,t)||es(e)}function T(e){let t=gn(e);if(!t)return Ir(e);if(t==="none"||t==="presentation"){let n=Ir(e);if(Mr(e,n))return n}return t}function $r(e){return e===null?void 0:e.toLowerCase()==="true"}function Pr(e){return["STYLE","SCRIPT","NOSCRIPT","TEMPLATE"].includes(_(e))}function j(e){if(Pr(e))return!0;let t=Z(e),n=e.nodeName==="SLOT";if(t?.display==="contents"&&!n){for(let i=e.firstChild;i;i=i.nextSibling){if(i.nodeType===1&&!j(i))return!1;if(i.nodeType===3&&dn(i))return!1}return!0}if(!(e.nodeName==="OPTION"&&!!e.closest("select"))&&!n&&!un(e,t))return!0;return Dr(e)}function Dr(e){let t=Pt?.get(e);if(t===void 0){if(t=!1,e.parentElement&&e.parentElement.shadowRoot&&!e.assignedSlot)t=!0;if(!t){let n=Z(e);t=!n||n.display==="none"||$r(e.getAttribute("aria-hidden"))===!0}if(!t){let n=R(e);if(n)t=Dr(n)}Pt?.set(e,t)}return t}function Le(e,t){if(!t)return[];let n=Mt(e);if(!n)return[];try{let r=t.split(" ").filter((s)=>!!s),i=[];for(let s of r){let a=n.querySelector("#"+CSS.escape(s));if(a&&!i.includes(a))i.push(a)}return i}catch(r){return[]}}function ne(e){return e.trim()}function Xe(e){return e.split(" ").map((t)=>t.replace(/\r\n/g,`
`).replace(/[\u200b\u00ad]/g,"").replace(/\s\s*/g," ")).join(" ").trim()}function Rr(e,t){let n=[...e.querySelectorAll(t)];for(let r of Le(e,e.getAttribute("aria-owns"))){if(r.matches(t))n.push(r);n.push(...r.querySelectorAll(t))}return n}function Ne(e,t){let n=t==="::before"?An:t==="::after"?_n:vn;if(n?.has(e))return n?.get(e);let r=Z(e,t),i;if(r){let s=r.content;if(s&&s!=="none"&&s!=="normal"){if(r.display!=="none"&&r.visibility!=="hidden")i=ss(e,s,!!t)}}if(t&&i!==void 0){if((r?.display||"inline")!=="inline")i=" "+i+" "}if(n)n.set(e,i);return i}function ss(e,t,n){if(!t||t==="none"||t==="normal")return;try{let r=mt(t).filter((o)=>!(o instanceof le)),i=r.findIndex((o)=>o instanceof L&&o.value==="/");if(i!==-1)r=r.slice(i+1);else if(!n)return;let s=[],a=0;while(a<r.length)if(r[a]instanceof we)s.push(r[a].value),a++;else if(a+2<r.length&&r[a]instanceof ie&&r[a].value==="attr"&&r[a+1]instanceof ye&&r[a+2]instanceof Ee){let o=r[a+1].value;s.push(e.getAttribute(o)||""),a+=3}else return;return s.join("")}catch{}}function mn(e){let t=e.getAttribute("aria-labelledby");if(t===null)return null;let n=Le(e,t);return n.length?n:null}function os(e,t){let n=["button","cell","checkbox","columnheader","gridcell","heading","link","menuitem","menuitemcheckbox","menuitemradio","option","radio","row","rowheader","switch","tab","tooltip","treeitem"].includes(e),r=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 n||r}function G(e,t){let n=t?yn:Sn,r=n?.get(e);if(r===void 0){if(r="",!["caption","code","definition","deletion","emphasis","generic","insertion","mark","paragraph","presentation","strong","subscript","suggestion","superscript","term","time"].includes(T(e)||""))r=Xe(X(e,{includeHidden:t,visitedElements:new Set,embeddedInTargetElement:"self"}));n?.set(e,r)}return r}function bn(e,t){let n=t?Tn:wn,r=n?.get(e);if(r===void 0){if(r="",e.hasAttribute("aria-describedby")){let i=Le(e,e.getAttribute("aria-describedby"));r=Xe(i.map((s)=>X(s,{includeHidden:t,visitedElements:new Set,embeddedInDescribedBy:{element:s,hidden:j(s)}})).join(" "))}else if(e.hasAttribute("aria-description"))r=Xe(e.getAttribute("aria-description")||"");else r=Xe(e.getAttribute("title")||"");n?.set(e,r)}return r}function as(e){let t=e.getAttribute("aria-invalid");if(!t||t.trim()===""||t.toLocaleLowerCase()==="false")return"false";if(t==="true"||t==="grammar"||t==="spelling")return t;return"true"}function ls(e){if("validity"in e)return e.validity?.valid===!1;return!1}function Hr(e){let t=$t,n=$t?.get(e);if(n===void 0){n="";let r=as(e)!=="false",i=ls(e);if(r||i){let s=e.getAttribute("aria-errormessage");n=Le(e,s).map((l)=>Xe(X(l,{visitedElements:new Set,embeddedInDescribedBy:{element:l,hidden:j(l)}}))).join(" ").trim()}t?.set(e,n)}return n}function X(e,t){if(t.visitedElements.has(e))return"";let n={...t,embeddedInTargetElement:t.embeddedInTargetElement==="self"?"descendant":t.embeddedInTargetElement};if(!t.includeHidden){let l=!!t.embeddedInLabelledBy?.hidden||!!t.embeddedInDescribedBy?.hidden||!!t.embeddedInNativeTextAlternative?.hidden||!!t.embeddedInLabel?.hidden;if(Pr(e)||!l&&j(e))return t.visitedElements.add(e),""}let r=mn(e);if(!t.embeddedInLabelledBy){let l=(r||[]).map((c)=>X(c,{...t,embeddedInLabelledBy:{element:c,hidden:j(c)},embeddedInDescribedBy:void 0,embeddedInTargetElement:void 0,embeddedInLabel:void 0,embeddedInNativeTextAlternative:void 0})).join(" ");if(l)return l}let i=T(e)||"",s=_(e);if(!!t.embeddedInLabel||!!t.embeddedInLabelledBy||t.embeddedInTargetElement==="descendant"){let l=[...e.labels||[]].includes(e),c=(r||[]).includes(e);if(!l&&!c){if(i==="textbox"){if(t.visitedElements.add(e),s==="INPUT"||s==="TEXTAREA")return e.value;return e.textContent||""}if(["combobox","listbox"].includes(i)){t.visitedElements.add(e);let h;if(s==="SELECT"){if(h=[...e.selectedOptions],!h.length&&e.options.length)h.push(e.options[0])}else{let u=i==="combobox"?Rr(e,"*").find((f)=>T(f)==="listbox"):e;h=u?Rr(u,'[aria-selected="true"]').filter((f)=>T(f)==="option"):[]}if(!h.length&&s==="INPUT")return e.value;return h.map((u)=>X(u,n)).join(" ")}if(["progressbar","scrollbar","slider","spinbutton","meter"].includes(i)){if(t.visitedElements.add(e),e.hasAttribute("aria-valuetext"))return e.getAttribute("aria-valuetext")||"";if(e.hasAttribute("aria-valuenow"))return e.getAttribute("aria-valuenow")||"";return e.getAttribute("value")||""}if(["menu"].includes(i))return t.visitedElements.add(e),""}}let a=e.getAttribute("aria-label")||"";if(ne(a))return t.visitedElements.add(e),a;if(!["presentation","none"].includes(i)){if(s==="INPUT"&&["button","submit","reset"].includes(e.type)){t.visitedElements.add(e);let l=e.value||"";if(ne(l))return l;if(e.type==="submit")return"Submit";if(e.type==="reset")return"Reset";return e.getAttribute("title")||""}if(s==="INPUT"&&e.type==="file"){t.visitedElements.add(e);let l=e.labels||[];if(l.length&&!t.embeddedInLabelledBy)return Ke(l,t);return"Choose File"}if(s==="INPUT"&&e.type==="image"){t.visitedElements.add(e);let l=e.labels||[];if(l.length&&!t.embeddedInLabelledBy)return Ke(l,t);let c=e.getAttribute("alt")||"";if(ne(c))return c;let h=e.getAttribute("title")||"";if(ne(h))return h;return"Submit"}if(!r&&s==="BUTTON"){t.visitedElements.add(e);let l=e.labels||[];if(l.length)return Ke(l,t)}if(!r&&s==="OUTPUT"){t.visitedElements.add(e);let l=e.labels||[];if(l.length)return Ke(l,t);return e.getAttribute("title")||""}if(!r&&(s==="TEXTAREA"||s==="SELECT"||s==="INPUT")){t.visitedElements.add(e);let l=e.labels||[];if(l.length)return Ke(l,t);let c=s==="INPUT"&&["text","password","search","tel","email","url"].includes(e.type)||s==="TEXTAREA",h=e.getAttribute("placeholder")||"",u=e.getAttribute("title")||"";if(!c||u)return u;return h}if(!r&&s==="FIELDSET"){t.visitedElements.add(e);for(let c=e.firstElementChild;c;c=c.nextElementSibling)if(_(c)==="LEGEND")return X(c,{...n,embeddedInNativeTextAlternative:{element:c,hidden:j(c)}});return e.getAttribute("title")||""}if(!r&&s==="FIGURE"){t.visitedElements.add(e);for(let c=e.firstElementChild;c;c=c.nextElementSibling)if(_(c)==="FIGCAPTION")return X(c,{...n,embeddedInNativeTextAlternative:{element:c,hidden:j(c)}});return e.getAttribute("title")||""}if(s==="IMG"){t.visitedElements.add(e);let l=e.getAttribute("alt")||"";if(ne(l))return l;return e.getAttribute("title")||""}if(s==="TABLE"){t.visitedElements.add(e);for(let c=e.firstElementChild;c;c=c.nextElementSibling)if(_(c)==="CAPTION")return X(c,{...n,embeddedInNativeTextAlternative:{element:c,hidden:j(c)}});let l=e.getAttribute("summary")||"";if(l)return l}if(s==="AREA"){t.visitedElements.add(e);let l=e.getAttribute("alt")||"";if(ne(l))return l;return e.getAttribute("title")||""}if(s==="SVG"||e.ownerSVGElement){t.visitedElements.add(e);for(let l=e.firstElementChild;l;l=l.nextElementSibling)if(_(l)==="TITLE"&&l.ownerSVGElement)return X(l,{...n,embeddedInLabelledBy:{element:l,hidden:j(l)}})}if(e.ownerSVGElement&&s==="A"){let l=e.getAttribute("xlink:title")||"";if(ne(l))return t.visitedElements.add(e),l}}let o=s==="SUMMARY"&&!["presentation","none"].includes(i);if(os(i,t.embeddedInTargetElement==="descendant")||o||!!t.embeddedInLabelledBy||!!t.embeddedInDescribedBy||!!t.embeddedInLabel||!!t.embeddedInNativeTextAlternative){t.visitedElements.add(e);let l=cs(e,n);if(t.embeddedInTargetElement==="self"?ne(l):l)return l}if(!["presentation","none"].includes(i)||s==="IFRAME"){t.visitedElements.add(e);let l=e.getAttribute("title")||"";if(ne(l))return l}return t.visitedElements.add(e),""}function cs(e,t){let n=[],r=(s,a)=>{if(a&&s.assignedSlot)return;if(s.nodeType===1){let o=Z(s)?.display||"inline",l=X(s,t);if(o!=="inline"||s.nodeName==="BR")l=" "+l+" ";n.push(l)}else if(s.nodeType===3)n.push(s.textContent||"")};n.push(Ne(e,"::before")||"");let i=Ne(e);if(i!==void 0)n.push(i);else{let s=e.nodeName==="SLOT"?e.assignedNodes():[];if(s.length)for(let a of s)r(a,!1);else{for(let a=e.firstChild;a;a=a.nextSibling)r(a,!0);if(e.shadowRoot)for(let a=e.shadowRoot.firstChild;a;a=a.nextSibling)r(a,!0);for(let a of Le(e,e.getAttribute("aria-owns")))r(a,!0)}}return n.push(Ne(e,"::after")||""),n.join("")}var Ze=["gridcell","option","row","tab","rowheader","columnheader","treeitem"];function Dt(e){if(_(e)==="OPTION")return e.selected;if(Ze.includes(T(e)||""))return $r(e.getAttribute("aria-selected"))===!0;return!1}var et=["checkbox","menuitemcheckbox","option","radio","switch","menuitemradio","treeitem"];function Ht(e){let t=xn(e,!0);return t==="error"?!1:t}function qr(e){return xn(e,!0)}function tt(e){return xn(e,!1)}function xn(e,t){let n=_(e);if(t&&n==="INPUT"&&e.indeterminate)return"mixed";if(n==="INPUT"&&["checkbox","radio"].includes(e.type))return e.checked;if(et.includes(T(e)||"")){let r=e.getAttribute("aria-checked");if(r==="true")return!0;if(t&&r==="mixed")return"mixed";return!1}return"error"}var us=["checkbox","combobox","grid","gridcell","listbox","radiogroup","slider","spinbutton","textbox","columnheader","rowheader","searchbox","switch","treegrid"];function nt(e){let t=_(e);if(["INPUT","TEXTAREA","SELECT"].includes(t))return e.hasAttribute("readonly");if(us.includes(T(e)||""))return e.getAttribute("aria-readonly")==="true";if(e.isContentEditable)return!1;return"error"}var rt=["button"];function qt(e){if(rt.includes(T(e)||"")){let t=e.getAttribute("aria-pressed");if(t==="true")return!0;if(t==="mixed")return"mixed"}return!1}var it=["application","button","checkbox","combobox","gridcell","link","listbox","menuitem","row","rowheader","tab","treeitem","columnheader","menuitemcheckbox","menuitemradio","rowheader","switch"];function Bt(e){if(_(e)==="DETAILS")return e.open;if(it.includes(T(e)||"")){let t=e.getAttribute("aria-expanded");if(t===null)return;if(t==="true")return!0;return!1}return}var st=["heading","listitem","row","treeitem"];function Ut(e){let t={H1:1,H2:2,H3:3,H4:4,H5:5,H6:6}[_(e)];if(t)return t;if(st.includes(T(e)||"")){let n=e.getAttribute("aria-level"),r=n===null?Number.NaN:Number(n);if(Number.isInteger(r)&&r>=1)return r}return 0}var En=["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 J(e){return Br(e)||Ur(e)}function Br(e){return["BUTTON","INPUT","SELECT","TEXTAREA","OPTION","OPTGROUP"].includes(_(e))&&(e.hasAttribute("disabled")||ds(e)||hs(e))}function ds(e){return _(e)==="OPTION"&&!!e.closest("OPTGROUP[DISABLED]")}function hs(e){let t=e?.closest("FIELDSET[DISABLED]");if(!t)return!1;let n=t.querySelector(":scope > LEGEND");return!n||!n.contains(e)}function Ur(e,t=!1){if(!e)return!1;if(t||En.includes(T(e)||"")){let n=(e.getAttribute("aria-disabled")||"").toLowerCase();if(n==="true")return!0;if(n==="false")return!1;return Ur(R(e),!0)}return!1}function Ke(e,t){return[...e].map((n)=>X(n,{...t,embeddedInLabel:{element:n,hidden:j(n)},embeddedInNativeTextAlternative:void 0,embeddedInLabelledBy:void 0,embeddedInDescribedBy:void 0,embeddedInTargetElement:void 0})).filter((n)=>!!n).join(" ")}function Fr(e){let t=Nn,n=e,r,i=[];for(;n;n=R(n)){let s=t.get(n);if(s!==void 0){r=s;break}i.push(n);let a=Z(n);if(!a){r=!0;break}let o=a.pointerEvents;if(o){r=o!=="none";break}}if(r===void 0)r=!0;for(let s of i)t.set(s,r);return r}var Sn,yn,wn,Tn,$t,Pt,vn,An,_n,Nn,Wr=0;function oe(){Ae(),++Wr,Sn??=new Map,yn??=new Map,wn??=new Map,Tn??=new Map,$t??=new Map,Pt??=new Map,vn??=new Map,An??=new Map,_n??=new Map,Nn??=new Map}function ae(){if(!--Wr)Sn=void 0,yn=void 0,wn=void 0,Tn=void 0,$t=void 0,Pt=void 0,vn=void 0,An=void 0,_n=void 0,Nn=void 0;_e()}var fs={button:"button",checkbox:"checkbox",image:"button",number:"spinbutton",radio:"radio",range:"slider",reset:"button",submit:"button"};var gs=0;function Qr(e){if(e.mode==="ai")return{visibility:"ariaOrVisible",refs:"interactable",refPrefix:e.refPrefix,includeGenericRole:!0,renderActive:!e.doNotRenderActive,renderCursorPointer:!0};if(e.mode==="autoexpect")return{visibility:"ariaAndVisible",refs:"none"};if(e.mode==="codegen")return{visibility:"aria",refs:"none",renderStringsAsRegex:!0};return{visibility:"aria",refs:"none"}}function Ie(e,t){let n=Qr(t),r=new Set,i={root:{role:"fragment",name:"",children:[],props:{},box:Je(e),receivesPointerEvents:!0},elements:new Map,refs:new Map,iframeRefs:[]};Cn(i.root,e);let s=(o,l,c)=>{if(r.has(l))return;if(r.add(l),l.nodeType===Node.TEXT_NODE&&l.nodeValue){if(!c)return;let b=l.nodeValue;if(o.role!=="textbox"&&b)o.children.push(l.nodeValue||"");return}if(l.nodeType!==Node.ELEMENT_NODE)return;let h=l,u=!j(h),f=u;if(n.visibility==="ariaOrVisible")f=u||B(h);if(n.visibility==="ariaAndVisible")f=u&&B(h);if(n.visibility==="aria"&&!f)return;let x=[];if(h.hasAttribute("aria-owns")){let b=h.getAttribute("aria-owns").split(/\s+/);for(let p of b){let E=e.ownerDocument.getElementById(p);if(E)x.push(E)}}let d=f?ms(h,n):null;if(d){if(d.ref){if(i.elements.set(d.ref,h),i.refs.set(h,d.ref),d.role==="iframe")i.iframeRefs.push(d.ref)}o.children.push(d)}a(d||o,h,x,f)};function a(o,l,c,h){let f=(Z(l)?.display||"inline")!=="inline"||l.nodeName==="BR"?" ":"";if(f)o.children.push(f);o.children.push(Ne(l,"::before")||"");let x=l.nodeName==="SLOT"?l.assignedNodes():[];if(x.length)for(let d of x)s(o,d,h);else{for(let d=l.firstChild;d;d=d.nextSibling)if(!d.assignedSlot)s(o,d,h);if(l.shadowRoot)for(let d=l.shadowRoot.firstChild;d;d=d.nextSibling)s(o,d,h)}for(let d of c)s(o,d,h);if(o.children.push(Ne(l,"::after")||""),f)o.children.push(f);if(o.children.length===1&&o.name===o.children[0])o.children=[];if(o.role==="link"&&l.hasAttribute("href")){let d=l.getAttribute("href");o.props.url=d}if(o.role==="textbox"&&l.hasAttribute("placeholder")&&l.getAttribute("placeholder")!==o.name){let d=l.getAttribute("placeholder");o.props.placeholder=d}}oe();try{s(i.root,e,!0)}finally{ae()}return xs(i.root),bs(i.root),i}function Vr(e,t){if(t.refs==="none")return;if(t.refs==="interactable"&&(!e.box.visible||!e.receivesPointerEvents))return;let n=kn(e),r=n._ariaRef;if(!r||r.role!==e.role||r.name!==e.name)r={role:e.role,name:e.name,ref:(t.refPrefix??"")+"e"+ ++gs},n._ariaRef=r;e.ref=r.ref}function ms(e,t){let n=e.ownerDocument.activeElement===e;if(e.nodeName==="IFRAME"){let c={role:"iframe",name:"",children:[],props:{},box:Je(e),receivesPointerEvents:!0,active:n};return Cn(c,e),Vr(c,t),c}let r=t.includeGenericRole?"generic":null,i=T(e)??r;if(!i||i==="presentation"||i==="none")return null;let s=A(G(e,!1)||""),a=Fr(e),o=Je(e);if(i==="generic"&&o.inline&&e.childNodes.length===1&&e.childNodes[0].nodeType===Node.TEXT_NODE)return null;let l={role:i,name:s,children:[],props:{},box:o,receivesPointerEvents:a,active:n};if(Cn(l,e),Vr(l,t),et.includes(i))l.checked=Ht(e);if(En.includes(i))l.disabled=J(e);if(it.includes(i))l.expanded=Bt(e);if(st.includes(i))l.level=Ut(e);if(rt.includes(i))l.pressed=qt(e);if(Ze.includes(i))l.selected=Dt(e);if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement){if(e.type!=="checkbox"&&e.type!=="radio"&&e.type!=="file")l.children=[e.value]}return l}function bs(e){let t=(n)=>{let r=[];for(let s of n.children||[]){if(typeof s==="string"){r.push(s);continue}let a=t(s);r.push(...a)}if(n.role==="generic"&&!n.name&&r.length<=1&&r.every((s)=>typeof s!=="string"&&!!s.ref))return r;return n.children=r,[n]};t(e)}function xs(e){let t=(r,i)=>{if(!r.length)return;let s=A(r.join(""));if(s)i.push(s);r.length=0},n=(r)=>{let i=[],s=[];for(let a of r.children||[])if(typeof a==="string")s.push(a);else t(s,i),n(a),i.push(a);if(t(s,i),r.children=i.length?i:[],r.children.length===1&&r.children[0]===r.name)r.children=[]};n(e)}function Es(e,t){if(!t)return!0;if(!e)return!1;if(typeof t==="string")return e===t;return!!e.match(new RegExp(t.pattern))}function jr(e,t){if(!t?.normalized)return!0;if(!e)return!1;if(e===t.normalized)return!0;if(e===t.raw)return!0;let n=Ss(t);if(n)return!!e.match(n);return!1}var Ln=Symbol("cachedRegex");function Ss(e){if(e[Ln]!==void 0)return e[Ln];let{raw:t}=e,n=t.startsWith("/")&&t.endsWith("/")&&t.length>1,r;try{r=n?new RegExp(t.slice(1,-1)):null}catch(i){r=null}return e[Ln]=r,r}function In(e,t){let n=Ie(e,{mode:"default"});return{matches:Jr(n.root,t,!1,!1),received:{raw:Ce(n,{mode:"default"}).text,regex:Ce(n,{mode:"codegen"}).text}}}function Gr(e,t){let n=Ie(e,{mode:"default"}).root;return Jr(n,t,!0,!1).map((i)=>kn(i))}function Rn(e,t,n){if(typeof e==="string"&&t.kind==="text")return jr(e,t.text);if(e===null||typeof e!=="object"||t.kind!=="role")return!1;if(t.role!=="fragment"&&t.role!==e.role)return!1;if(t.checked!==void 0&&t.checked!==e.checked)return!1;if(t.disabled!==void 0&&t.disabled!==e.disabled)return!1;if(t.expanded!==void 0&&t.expanded!==e.expanded)return!1;if(t.level!==void 0&&t.level!==e.level)return!1;if(t.pressed!==void 0&&t.pressed!==e.pressed)return!1;if(t.selected!==void 0&&t.selected!==e.selected)return!1;if(!Es(e.name,t.name))return!1;if(!jr(e.props.url,t.props?.url))return!1;if(t.containerMode==="contain")return Yr(e.children||[],t.children||[]);if(t.containerMode==="equal")return zr(e.children||[],t.children||[],!1);if(t.containerMode==="deep-equal"||n)return zr(e.children||[],t.children||[],!0);return Yr(e.children||[],t.children||[])}function zr(e,t,n){if(t.length!==e.length)return!1;for(let r=0;r<t.length;++r)if(!Rn(e[r],t[r],n))return!1;return!0}function Yr(e,t){if(t.length>e.length)return!1;let n=e.slice(),r=t.slice();for(let i of r){let s=n.shift();while(s){if(Rn(s,i,!1))break;s=n.shift()}if(!s)return!1}return!0}function Jr(e,t,n,r){let i=[],s=(a,o)=>{if(Rn(a,t,r)){let l=typeof a==="string"?o:a;if(l)i.push(l);return!n}if(typeof a==="string")return!1;for(let l of a.children||[])if(s(l,a))return!0;return!1};return s(e,null),i}function Kr(e,t=new Map){if(e?.ref)t.set(e.ref,e);for(let n of e?.children||[])if(typeof n!=="string")Kr(n,t);return t}function ys(e,t){let n=Kr(t?.root),r=new Map,i=(s,a)=>{let o=s.children.length===a?.children.length&&Jn(s,a),l=o;for(let c=0;c<s.children.length;c++){let h=s.children[c],u=a?.children[c];if(typeof h==="string")o&&=h===u,l&&=h===u;else{let f=typeof u!=="string"?u:void 0;if(h.ref)f=n.get(h.ref);let x=i(h,f);if(!f||!x&&!h.ref||f!==u)l=!1;o&&=x&&f===u}}return r.set(s,o?"same":l?"skip":"changed"),o};return i(e.root,n.get(t?.root?.ref)),r}function ws(e,t){let n=[],r=(i)=>{let s=t.get(i);if(s==="same");else if(s==="skip"){for(let a of i.children)if(typeof a!=="string")r(a)}else n.push(i)};for(let i of e)if(typeof i==="string")n.push(i);else r(i);return n}function Ft(e){return"  ".repeat(e)}function Ce(e,t,n){let r=Qr(t),i=[],s={},a=r.renderStringsAsRegex?vs:()=>!0,o=r.renderStringsAsRegex?Ts:(d)=>d,l=e.root.role==="fragment"?e.root.children:[e.root],c=ys(e,n);if(n)l=ws(l,c);let h=(d,b)=>{if(t.depth&&b>t.depth)return;let p=Ot(o(d));if(p)i.push(Ft(b)+"- text: "+p)},u=(d,b)=>{let p=d.role;if(d.name&&d.name.length<=900){let E=o(d.name);if(E){let S=E.startsWith("/")&&E.endsWith("/")?E:JSON.stringify(E);p+=" "+S}}if(d.checked==="mixed")p+=" [checked=mixed]";if(d.checked===!0)p+=" [checked]";if(d.disabled)p+=" [disabled]";if(d.expanded)p+=" [expanded]";if(d.active&&r.renderActive)p+=" [active]";if(d.level)p+=` [level=${d.level}]`;if(d.pressed==="mixed")p+=" [pressed=mixed]";if(d.pressed===!0)p+=" [pressed]";if(d.selected===!0)p+=" [selected]";if(d.ref){if(p+=` [ref=${d.ref}]`,b&&Ue(d))p+=" [cursor=pointer]"}return p},f=(d)=>{return d?.children.length===1&&typeof d.children[0]==="string"&&!Object.keys(d.props).length?d.children[0]:void 0},x=(d,b,p)=>{if(t.depth&&b>t.depth)return;if(d.role==="iframe"&&d.ref)s[d.ref]=b;if(c.get(d)==="same"&&d.ref){i.push(Ft(b)+`- ref=${d.ref} [unchanged]`);return}let E=!!n&&!b,S=Ft(b)+"- "+(E?"<changed> ":"")+Sr(u(d,p)),w=f(d),Y=!!t.depth&&b===t.depth;if(!w&&(!d.children.length||Y)&&!Object.keys(d.props).length)i.push(S);else if(w!==void 0)if(a(d,w))i.push(S+": "+Ot(o(w)));else i.push(S);else{i.push(S+":");for(let[H,Q]of Object.entries(d.props))i.push(Ft(b+1)+"- /"+H+": "+Ot(Q));let K=!!d.ref&&p&&Ue(d);for(let H of d.children)if(typeof H==="string")h(a(d,H)?H:"",b+1);else x(H,b+1,p&&!K)}};for(let d of l)if(typeof d==="string")h(d,0);else x(d,0,!!r.renderCursorPointer);return{text:i.join(`
`),iframeDepths:s}}function Ts(e){let t=[{regex:/\b[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}\b/,replacement:"[0-9a-fA-F-]+"},{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+"}],n="",r=0,i=new RegExp(t.map((s)=>"("+s.regex.source+")").join("|"),"g");if(e.replace(i,(s,...a)=>{let o=a[a.length-2],l=a.slice(0,-2);n+=Te(e.slice(r,o));for(let c=0;c<l.length;c++)if(l[c]){let{replacement:h}=t[c];n+=h;break}return r=o+s.length,s}),!n)return e;return n+=Te(e.slice(r)),String(new RegExp(n))}function vs(e,t){if(!t.length)return!1;if(!e.name)return!0;let n=t.length<=200&&e.name.length<=200?pr(t,e.name):"",r=t;while(n&&r.includes(n))r=r.replace(n,"");return r.trim().length/t.length>0.1}var Xr=Symbol("element");function kn(e){return e[Xr]}function Cn(e,t){e[Xr]=t}function Zr(e,t){let n=Zn(e,t);return n?kn(n):void 0}var On=`/**
 * Copyright (c) Microsoft Corporation.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

:host {
  font-size: 13px;
  font-family: system-ui, "Ubuntu", "Droid Sans", sans-serif;
  color: #333;
}

svg {
  position: absolute;
  height: 0;
}

x-pw-tooltip {
  backdrop-filter: blur(5px);
  background-color: white;
  border-radius: 6px;
  box-shadow: 0 0.5rem 1.2rem rgba(0,0,0,.3);
  display: none;
  font-size: 12.8px;
  font-weight: normal;
  left: 0;
  line-height: 1.5;
  max-width: 600px;
  position: absolute;
  top: 0;
  padding: 0;
  flex-direction: column;
  overflow: hidden;
}

x-pw-tooltip-line {
  display: flex;
  max-width: 600px;
  padding: 6px;
  user-select: none;
  cursor: pointer;
}

x-pw-tooltip-footer {
  display: flex;
  max-width: 600px;
  padding: 6px;
  user-select: none;
  color: #777;
}

x-pw-dialog {
  background-color: white;
  pointer-events: auto;
  border-radius: 6px;
  box-shadow: 0 0.5rem 1.2rem rgba(0,0,0,.3);
  display: flex;
  flex-direction: column;
  position: absolute;
  z-index: 10;
  font-size: 13px;
}

x-pw-dialog:not(.autosize) {
  width: 400px;
  height: 150px;
}

x-pw-dialog-body {
  display: flex;
  flex-direction: column;
  flex: auto;
}

x-pw-dialog-body label {
  margin: 5px 8px;
  display: flex;
  flex-direction: row;
  align-items: center;
}

x-pw-highlight {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
}

x-pw-action-point {
  position: absolute;
  width: 20px;
  height: 20px;
  background: red;
  border-radius: 10px;
  margin: -10px 0 0 -10px;
  z-index: 2;
}

x-pw-title {
  position: absolute;
  backdrop-filter: blur(5px);
  background-color: rgba(0, 0, 0, 0.5);
  color: white;
  border-radius: 6px;
  padding: 6px;
  font-size: 24px;
  line-height: 1.4;
  white-space: nowrap;
  user-select: none;
  z-index: 3;
}

x-pw-user-overlays, x-pw-user-overlay {
  position: absolute;
  inset: 0;
}

@keyframes pw-fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

x-pw-separator {
  height: 1px;
  margin: 6px 9px;
  background: rgb(148 148 148 / 90%);
}

x-pw-tool-gripper {
  height: 28px;
  width: 24px;
  margin: 2px 0;
  cursor: grab;
}

x-pw-tool-gripper:active {
  cursor: grabbing;
}

x-pw-tool-gripper > x-div {
  width: 16px;
  height: 16px;
  margin: 6px 4px;
  clip-path: url(#icon-gripper);
  background-color: #555555;
}

x-pw-tools-list > label {
  display: flex;
  align-items: center;
  margin: 0 10px;
  user-select: none;
}

x-pw-tools-list {
  display: flex;
  width: 100%;
  border-bottom: 1px solid #dddddd;
}

x-pw-tool-item {
  pointer-events: auto;
  height: 28px;
  width: 28px;
  border-radius: 3px;
}

x-pw-tool-item:not(.disabled) {
  cursor: pointer;
}

x-pw-tool-item:not(.disabled):hover {
  background-color: hsl(0, 0%, 86%);
}

x-pw-tool-item.toggled {
  background-color: rgba(138, 202, 228, 0.5);
}

x-pw-tool-item.toggled:not(.disabled):hover {
  background-color: #8acae4c4;
}

x-pw-tool-item > x-div {
  width: 16px;
  height: 16px;
  margin: 6px;
  background-color: #3a3a3a;
}

x-pw-tool-item.disabled > x-div {
  background-color: rgba(97, 97, 97, 0.5);
  cursor: default;
}

x-pw-tool-item.record.toggled {
  background-color: transparent;
}

x-pw-tool-item.record.toggled:not(.disabled):hover {
  background-color: hsl(0, 0%, 86%);
}

x-pw-tool-item.record.toggled > x-div {
  background-color: #a1260d;
}

x-pw-tool-item.record.disabled.toggled > x-div {
  opacity: 0.8;
}

x-pw-tool-item.accept > x-div {
  background-color: #388a34;
}

x-pw-tool-item.record > x-div {
  /* codicon: circle-large-filled */
  clip-path: url(#icon-circle-large-filled);
}

x-pw-tool-item.record.toggled > x-div {
  /* codicon: stop-circle */
  clip-path: url(#icon-stop-circle);
}

x-pw-tool-item.pick-locator > x-div {
  /* codicon: inspect */
  clip-path: url(#icon-inspect);
}

x-pw-tool-item.text > x-div {
  /* codicon: whole-word */
  clip-path: url(#icon-whole-word);
}

x-pw-tool-item.visibility > x-div {
  /* codicon: eye */
  clip-path: url(#icon-eye);
}

x-pw-tool-item.value > x-div {
  /* codicon: symbol-constant */
  clip-path: url(#icon-symbol-constant);
}

x-pw-tool-item.snapshot > x-div {
  /* codicon: eye */
  clip-path: url(#icon-gist);
}

x-pw-tool-item.accept > x-div {
  clip-path: url(#icon-check);
}

x-pw-tool-item.cancel > x-div {
  clip-path: url(#icon-close);
}

x-pw-tool-item.succeeded > x-div {
  /* codicon: pass */
  clip-path: url(#icon-pass);
  background-color: #388a34 !important;
}

x-pw-overlay {
  position: absolute;
  top: 0;
  max-width: min-content;
  z-index: 2147483647;
  background: transparent;
  pointer-events: auto;
}

x-pw-overlay x-pw-tools-list {
  background-color: #ffffffdd;
  box-shadow: rgba(0, 0, 0, 0.1) 0px 5px 5px;
  border-radius: 3px;
  border-bottom: none;
}

x-pw-overlay x-pw-tool-item {
  margin: 2px;
}

textarea.text-editor {
  font-family: system-ui,Ubuntu,Droid Sans,sans-serif;
  flex: auto;
  border: none;
  margin: 6px 10px;
  color: #333;
  outline: 1px solid transparent!important;
  resize: none;
  padding: 0;
  font-size: 13px;
}

textarea.text-editor.does-not-match {
  outline: 1px solid red !important;
}

x-div {
  display: block;
}

x-spacer {
  flex: auto;
}

* {
  box-sizing: border-box;
}

*[hidden] {
  display: none !important;
}

x-locator-editor {
  flex: none;
  width: 100%;
  height: 60px;
  padding: 4px;
  border-bottom: 1px solid #dddddd;
  outline: 1px solid transparent;
}

x-locator-editor.does-not-match {
  outline: 1px solid red;
}

.CodeMirror {
  width: 100% !important;
  height: 100% !important;
}

x-pw-action-list {
  flex: auto;
  display: flex;
  flex-direction: column;
  user-select: none;
}

x-pw-action-item {
  padding: 6px 10px;
  cursor: pointer;
  overflow: hidden;
}

x-pw-action-item:hover {
  background-color: hsl(0, 0%, 95%);
}

x-pw-action-item:last-child {
  border-bottom-left-radius: 6px;
  border-bottom-right-radius: 6px;
}
`;class ot{_glassPaneElement;_glassPaneShadow;_renderedEntries=[];_actionPointElement;_titleElement;_userOverlayContainer;_userOverlays=new Map;_userOverlayHidden=!1;_isUnderTest;_injectedScript;_rafRequest;_language="javascript";_elementHighlightSelectors=new Map;constructor(e){this._injectedScript=e;let t=e.document;if(this._isUnderTest=e.isUnderTest,this._glassPaneElement=t.createElement("x-pw-glass"),this._glassPaneElement.setAttribute("popover","manual"),this._glassPaneElement.style.inset="0",this._glassPaneElement.style.width="100%",this._glassPaneElement.style.height="100%",this._glassPaneElement.style.maxWidth="none",this._glassPaneElement.style.maxHeight="none",this._glassPaneElement.style.padding="0",this._glassPaneElement.style.margin="0",this._glassPaneElement.style.border="none",this._glassPaneElement.style.overflow="visible",this._glassPaneElement.style.pointerEvents="none",this._glassPaneElement.style.display="flex",this._glassPaneElement.style.backgroundColor="transparent",this._actionPointElement=t.createElement("x-pw-action-point"),this._actionPointElement.setAttribute("hidden","true"),this._titleElement=t.createElement("x-pw-title"),this._titleElement.setAttribute("hidden","true"),this._userOverlayContainer=t.createElement("x-pw-user-overlays"),this._userOverlayContainer.setAttribute("hidden","true"),this._glassPaneShadow=this._glassPaneElement.attachShadow({mode:this._isUnderTest?"open":"closed"}),typeof this._glassPaneShadow.adoptedStyleSheets.push==="function"){let n=new this._injectedScript.window.CSSStyleSheet;n.replaceSync(On),this._glassPaneShadow.adoptedStyleSheets.push(n)}else{let n=this._injectedScript.document.createElement("style");n.textContent=On,this._glassPaneShadow.appendChild(n)}this._glassPaneShadow.appendChild(this._actionPointElement),this._glassPaneShadow.appendChild(this._titleElement),this._glassPaneShadow.appendChild(this._userOverlayContainer)}install(){if(!this._injectedScript.document.documentElement)return;if(!this._injectedScript.document.documentElement.contains(this._glassPaneElement)||this._glassPaneElement.nextElementSibling)this._injectedScript.document.documentElement.appendChild(this._glassPaneElement);this._bringToFront()}_bringToFront(){this._glassPaneElement.hidePopover(),this._glassPaneElement.showPopover()}setLanguage(e){this._language=e}addElementHighlight(e,t){let n=F(e);this._elementHighlightSelectors.set(n,{selector:e,cssStyle:t}),this._ensureElementHighlightRaf()}removeElementHighlight(e){let t=F(e);if(!this._elementHighlightSelectors.delete(t))return;if(this._elementHighlightSelectors.size===0){if(this._rafRequest)this._injectedScript.utils.builtins.cancelAnimationFrame(this._rafRequest),this._rafRequest=void 0;this.clearHighlight()}}_ensureElementHighlightRaf(){if(this._rafRequest)return;let e=()=>{let t=[];for(let{selector:n,cssStyle:r}of this._elementHighlightSelectors.values()){let i=this._injectedScript.querySelectorAll(n,this._injectedScript.document.documentElement),s=te(this._language,F(n)),a=i.length>1?"#f6b26b7f":"#6fa8dc7f";for(let o=0;o<i.length;++o){let l=i.length>1?` [${o+1} of ${i.length}]`:"";t.push({element:i[o],color:a,tooltipText:s+l,cssStyle:r})}}this.updateHighlight(t),this._rafRequest=this._injectedScript.utils.builtins.requestAnimationFrame(e)};this._rafRequest=this._injectedScript.utils.builtins.requestAnimationFrame(e)}uninstall(){if(this._rafRequest)this._injectedScript.utils.builtins.cancelAnimationFrame(this._rafRequest),this._rafRequest=void 0;this._elementHighlightSelectors.clear(),this._glassPaneElement.remove()}showActionPoint(e,t,n){if(this._actionPointElement.style.top=t+"px",this._actionPointElement.style.left=e+"px",this._actionPointElement.hidden=!1,n)this._actionPointElement.style.animation=`pw-fade-out ${n}ms ease-out forwards`;else this._actionPointElement.style.animation=""}hideActionPoint(){this._actionPointElement.hidden=!0}showActionTitle(e,t,n,r){if(this._titleElement.textContent=e,this._titleElement.hidden=!1,t){let i=t/4;this._titleElement.style.animation=`pw-fade-out ${i}ms ease-out ${t-i}ms forwards`}else this._titleElement.style.animation="";switch(this._titleElement.style.top="",this._titleElement.style.bottom="",this._titleElement.style.left="",this._titleElement.style.right="",this._titleElement.style.transform="",n){case"top-left":this._titleElement.style.top="6px",this._titleElement.style.left="6px";break;case"top":this._titleElement.style.top="6px",this._titleElement.style.left="50%",this._titleElement.style.transform="translateX(-50%)";break;case"bottom-left":this._titleElement.style.bottom="6px",this._titleElement.style.left="6px";break;case"bottom":this._titleElement.style.bottom="6px",this._titleElement.style.left="50%",this._titleElement.style.transform="translateX(-50%)";break;case"bottom-right":this._titleElement.style.bottom="6px",this._titleElement.style.right="6px";break;case"top-right":default:this._titleElement.style.top="6px",this._titleElement.style.right="6px";break}if(r)this._titleElement.style.fontSize=r+"px"}hideActionTitle(){this._titleElement.hidden=!0}addUserOverlay(e,t){let n=this._injectedScript.document.createElement("div");n.className="x-pw-user-overlay",n.innerHTML=t;for(let r of n.querySelectorAll("script"))r.remove();for(let r of n.querySelectorAll("*"))for(let i of[...r.attributes])if(i.name.startsWith("on"))r.removeAttribute(i.name);return this._userOverlays.set(e,n),this._userOverlayContainer.appendChild(n),this._userOverlayContainer.hidden=this._userOverlayHidden,e}getUserOverlay(e){return this._userOverlays.get(e)}removeUserOverlay(e){let t=this._userOverlays.get(e);if(t)t.remove(),this._userOverlays.delete(e);if(this._userOverlays.size===0)this._userOverlayContainer.hidden=!0}setUserOverlaysVisible(e){this._userOverlayHidden=!e,this._userOverlayContainer.hidden=!e||this._userOverlays.size===0}clearHighlight(){for(let e of this._renderedEntries)e.highlightElement?.remove(),e.tooltipElement?.remove();this._renderedEntries=[]}maskElements(e,t){this.updateHighlight(e.map((n)=>({element:n,color:t})))}updateHighlight(e){if(this._highlightIsUpToDate(e))return;this.clearHighlight();for(let t of e){let n=this._createHighlightElement();this._glassPaneShadow.appendChild(n);let r;if(t.tooltipText){r=this._injectedScript.document.createElement("x-pw-tooltip"),this._glassPaneShadow.appendChild(r),r.style.top="0",r.style.left="0",r.style.display="flex";let i=this._injectedScript.document.createElement("x-pw-tooltip-line");i.textContent=t.tooltipText,r.appendChild(i)}this._renderedEntries.push({targetElement:t.element,box:ei(t.box),color:t.color,borderColor:t.borderColor,fadeDuration:t.fadeDuration,cssStyle:t.cssStyle,tooltipElement:r,highlightElement:n})}for(let t of this._renderedEntries){if(!t.box&&!t.targetElement)continue;if(t.box=t.box||t.targetElement.getBoundingClientRect(),!t.tooltipElement)continue;let{anchorLeft:n,anchorTop:r}=this.tooltipPosition(t.box,t.tooltipElement);t.tooltipTop=r,t.tooltipLeft=n}for(let t of this._renderedEntries){if(t.tooltipElement)t.tooltipElement.style.top=t.tooltipTop+"px",t.tooltipElement.style.left=t.tooltipLeft+"px";let n=t.box;if(t.highlightElement.style.backgroundColor=t.color,t.highlightElement.style.left=n.x+"px",t.highlightElement.style.top=n.y+"px",t.highlightElement.style.width=n.width+"px",t.highlightElement.style.height=n.height+"px",t.highlightElement.style.display="block",t.borderColor)t.highlightElement.style.border="2px solid "+t.borderColor;if(t.fadeDuration)t.highlightElement.style.animation=`pw-fade-out ${t.fadeDuration}ms ease-out forwards`;if(t.cssStyle)t.highlightElement.style.cssText+=";"+t.cssStyle;if(this._isUnderTest)console.error("Highlight box for test: "+JSON.stringify({x:n.x,y:n.y,width:n.width,height:n.height}))}}firstBox(){return this._renderedEntries[0]?.box}firstTooltipBox(){let e=this._renderedEntries[0];if(!e||!e.tooltipElement||e.tooltipLeft===void 0||e.tooltipTop===void 0)return;return{x:e.tooltipLeft,y:e.tooltipTop,left:e.tooltipLeft,top:e.tooltipTop,width:e.tooltipElement.offsetWidth,height:e.tooltipElement.offsetHeight,bottom:e.tooltipTop+e.tooltipElement.offsetHeight,right:e.tooltipLeft+e.tooltipElement.offsetWidth,toJSON:()=>{}}}tooltipPosition(e,t){let{offsetWidth:n,offsetHeight:r}=t,i=this._glassPaneElement.offsetWidth,s=this._glassPaneElement.offsetHeight,a=Math.max(5,e.left);if(a+n>i-5)a=i-n-5;let o=Math.max(0,e.bottom)+5;if(o+r>s-5)if(Math.max(0,e.top)>r+5)o=Math.max(0,e.top)-r-5;else o=s-5-r;return{anchorLeft:a,anchorTop:o}}_highlightIsUpToDate(e){if(e.length!==this._renderedEntries.length)return!1;for(let t=0;t<this._renderedEntries.length;++t){if(e[t].element!==this._renderedEntries[t].targetElement)return!1;if(e[t].color!==this._renderedEntries[t].color)return!1;if(e[t].cssStyle!==this._renderedEntries[t].cssStyle)return!1;let n=this._renderedEntries[t].box;if(!n)return!1;let r=e[t].box?ei(e[t].box):e[t].element.getBoundingClientRect();if(r.top!==n.top||r.right!==n.right||r.bottom!==n.bottom||r.left!==n.left)return!1}return!0}_createHighlightElement(){return this._injectedScript.document.createElement("x-pw-highlight")}appendChild(e){this._glassPaneShadow.appendChild(e)}onGlassPaneClick(e){this._glassPaneElement.style.pointerEvents="auto",this._glassPaneElement.style.backgroundColor="rgba(0, 0, 0, 0.3)",this._glassPaneElement.addEventListener("click",e)}offGlassPaneClick(e){this._glassPaneElement.style.pointerEvents="none",this._glassPaneElement.style.backgroundColor="transparent",this._glassPaneElement.removeEventListener("click",e)}}function ei(e){if(!e)return;return new DOMRect(e.x,e.y,e.width,e.height)}function As(e,t,n){let r=e.left-t.right;if(r<0||n!==void 0&&r>n)return;return r+Math.max(t.bottom-e.bottom,0)+Math.max(e.top-t.top,0)}function _s(e,t,n){let r=t.left-e.right;if(r<0||n!==void 0&&r>n)return;return r+Math.max(t.bottom-e.bottom,0)+Math.max(e.top-t.top,0)}function Ns(e,t,n){let r=t.top-e.bottom;if(r<0||n!==void 0&&r>n)return;return r+Math.max(e.left-t.left,0)+Math.max(t.right-e.right,0)}function Ls(e,t,n){let r=e.top-t.bottom;if(r<0||n!==void 0&&r>n)return;return r+Math.max(e.left-t.left,0)+Math.max(t.right-e.right,0)}function Cs(e,t,n){let r=n===void 0?50:n,i=0;if(e.left-t.right>=0)i+=e.left-t.right;if(t.left-e.right>=0)i+=t.left-e.right;if(t.top-e.bottom>=0)i+=t.top-e.bottom;if(e.top-t.bottom>=0)i+=e.top-t.bottom;return i>r?void 0:i}var ti=["left-of","right-of","above","below","near"];function Wt(e,t,n,r){let i=t.getBoundingClientRect(),s={"left-of":_s,"right-of":As,above:Ns,below:Ls,near:Cs}[e],a;for(let o of n){if(o===t)continue;let l=s(i,o.getBoundingClientRect(),r);if(l===void 0)continue;if(a===void 0||l<a)a=l}return a}function ni(e,t){let n=typeof e==="string"&&!t.caseSensitive?e.toUpperCase():e,r=typeof t.value==="string"&&!t.caseSensitive?t.value.toUpperCase():t.value;if(t.op==="<truthy>")return!!n;if(t.op==="="){if(r instanceof RegExp)return typeof n==="string"&&!!n.match(r);return n===r}if(typeof n!=="string"||typeof r!=="string")return!1;if(t.op==="*=")return n.includes(r);if(t.op==="^=")return n.startsWith(r);if(t.op==="$=")return n.endsWith(r);if(t.op==="|=")return n===r||n.startsWith(r+"-");if(t.op==="~=")return n.split(" ").includes(r);return!1}function Vt(e){let t=e.ownerDocument;return e.nodeName==="SCRIPT"||e.nodeName==="NOSCRIPT"||e.nodeName==="STYLE"||t.head&&t.head.contains(e)}function P(e,t){let n=e.get(t);if(n===void 0){if(n={full:"",normalized:"",immediate:[]},!Vt(t)){let r="";if(t instanceof HTMLInputElement&&(t.type==="submit"||t.type==="button"))n={full:t.value,normalized:A(t.value),immediate:[t.value]};else{for(let i=t.firstChild;i;i=i.nextSibling)if(i.nodeType===Node.TEXT_NODE)n.full+=i.nodeValue||"",r+=i.nodeValue||"";else if(i.nodeType===Node.COMMENT_NODE)continue;else{if(r)n.immediate.push(r);if(r="",i.nodeType===Node.ELEMENT_NODE)n.full+=P(e,i).full}if(r)n.immediate.push(r);if(t.shadowRoot)n.full+=P(e,t.shadowRoot).full;if(n.full)n.normalized=A(n.full)}}e.set(t,n)}return n}function Re(e,t,n){if(Vt(t))return"none";if(!n(P(e,t)))return"none";for(let r=t.firstChild;r;r=r.nextSibling)if(r.nodeType===Node.ELEMENT_NODE&&n(P(e,r)))return"selfAndChildren";if(t.shadowRoot&&n(P(e,t.shadowRoot)))return"selfAndChildren";return"self"}function jt(e,t){let n=mn(t);if(n)return n.map((s)=>P(e,s));let r=t.getAttribute("aria-label");if(r!==null&&!!r.trim())return[{full:r,normalized:A(r),immediate:[r]}];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((a)=>P(e,a))}return[]}var ri=["selected","checked","pressed","expanded","level","disabled","name","include-hidden"];ri.sort();function at(e,t,n){if(!t.includes(n))throw Error(`"${e}" attribute is only supported for roles: ${t.slice().sort().map((r)=>`"${r}"`).join(", ")}`)}function ke(e,t){if(e.op!=="<truthy>"&&!t.includes(e.value))throw Error(`"${e.name}" must be one of ${t.map((n)=>JSON.stringify(n)).join(", ")}`)}function Oe(e,t){if(!t.includes(e.op))throw Error(`"${e.name}" does not support "${e.op}" matcher`)}function Is(e,t){let n={role:t};for(let r of e)switch(r.name){case"checked":{at(r.name,et,t),ke(r,[!0,!1,"mixed"]),Oe(r,["<truthy>","="]),n.checked=r.op==="<truthy>"?!0:r.value;break}case"pressed":{at(r.name,rt,t),ke(r,[!0,!1,"mixed"]),Oe(r,["<truthy>","="]),n.pressed=r.op==="<truthy>"?!0:r.value;break}case"selected":{at(r.name,Ze,t),ke(r,[!0,!1]),Oe(r,["<truthy>","="]),n.selected=r.op==="<truthy>"?!0:r.value;break}case"expanded":{at(r.name,it,t),ke(r,[!0,!1]),Oe(r,["<truthy>","="]),n.expanded=r.op==="<truthy>"?!0:r.value;break}case"level":{if(at(r.name,st,t),typeof r.value==="string")r.value=+r.value;if(r.op!=="="||typeof r.value!=="number"||Number.isNaN(r.value))throw Error('"level" attribute must be compared to a number');n.level=r.value;break}case"disabled":{ke(r,[!0,!1]),Oe(r,["<truthy>","="]),n.disabled=r.op==="<truthy>"?!0:r.value;break}case"name":{if(r.op==="<truthy>")throw Error('"name" attribute must have a value');if(typeof r.value!=="string"&&!(r.value instanceof RegExp))throw Error('"name" attribute must be a string or a regular expression');n.name=r.value,n.nameOp=r.op,n.exact=r.caseSensitive;break}case"include-hidden":{ke(r,[!0,!1]),Oe(r,["<truthy>","="]),n.includeHidden=r.op==="<truthy>"?!0:r.value;break}default:throw Error(`Unknown attribute "${r.name}", must be one of ${ri.map((i)=>`"${i}"`).join(", ")}.`)}return n}function Rs(e,t,n){let r=[],i=(a)=>{if(T(a)!==t.role)return;if(t.selected!==void 0&&Dt(a)!==t.selected)return;if(t.checked!==void 0&&Ht(a)!==t.checked)return;if(t.pressed!==void 0&&qt(a)!==t.pressed)return;if(t.expanded!==void 0&&Bt(a)!==t.expanded)return;if(t.level!==void 0&&Ut(a)!==t.level)return;if(t.disabled!==void 0&&J(a)!==t.disabled)return;if(!t.includeHidden){if(j(a))return}if(t.name!==void 0){let o=A(G(a,!!t.includeHidden));if(typeof t.name==="string")t.name=A(t.name);if(n&&!t.exact&&t.nameOp==="=")t.nameOp="*=";if(!ni(o,{name:"",jsonPath:[],op:t.nameOp||"=",value:t.name,caseSensitive:!!t.exact}))return}r.push(a)},s=(a)=>{let o=[];if(a.shadowRoot)o.push(a.shadowRoot);for(let l of a.querySelectorAll("*"))if(i(l),l.shadowRoot)o.push(l.shadowRoot);o.forEach(s)};return s(e),r}function Mn(e){return{queryAll:(t,n)=>{let r=se(n,!0),i=r.name.toLowerCase();if(!i)throw Error("Role must not be empty");let s=Is(r.attributes,i);oe();try{return Rs(t,s,e)}finally{ae()}}}}class Pn{_engines;_cacheQueryCSS;_cacheMatches;_cacheQuery;_cacheMatchesSimple;_cacheMatchesParents;_cacheCallMatches;_cacheCallQuery;_cacheQuerySimple;_cacheText;_scoreMap;_retainCacheCounter=0;constructor(){this._cacheText=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._engines=new Map,this._engines.set("not",Ms),this._engines.set("is",ct),this._engines.set("where",ct),this._engines.set("has",ks),this._engines.set("scope",Os),this._engines.set("light",$s),this._engines.set("visible",Ps),this._engines.set("text",Ds),this._engines.set("text-is",Hs),this._engines.set("text-matches",qs),this._engines.set("has-text",Bs),this._engines.set("right-of",lt("right-of")),this._engines.set("left-of",lt("left-of")),this._engines.set("above",lt("above")),this._engines.set("below",lt("below")),this._engines.set("near",lt("near")),this._engines.set("nth-match",Us);let e=[...this._engines.keys()];e.sort();let t=[...on];if(t.sort(),e.join("|")!==t.join("|"))throw Error(`Please keep customCSSNames in sync with evaluator engines: ${e.join("|")} vs ${t.join("|")}`)}begin(){++this._retainCacheCounter}end(){if(--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,n,r){if(!e.has(t))e.set(t,[]);let i=e.get(t),s=i.find((o)=>n.every((l,c)=>o.rest[c]===l));if(s)return s.result;let a=r();return i.push({rest:n,result:a}),a}_checkSelector(e){if(!(typeof e==="object"&&e&&(Array.isArray(e)||("simples"in e)&&e.simples.length)))throw Error(`Malformed selector "${e}"`);return e}matches(e,t,n){let r=this._checkSelector(t);this.begin();try{return this._cached(this._cacheMatches,e,[r,n.scope,n.pierceShadow,n.originalScope],()=>{if(Array.isArray(r))return this._matchesEngine(ct,e,r,n);if(this._hasScopeClause(r))n=this._expandContextForScopeMatching(n);if(!this._matchesSimple(e,r.simples[r.simples.length-1].selector,n))return!1;return this._matchesParents(e,r,r.simples.length-2,n)})}finally{this.end()}}query(e,t){let n=this._checkSelector(t);this.begin();try{return this._cached(this._cacheQuery,n,[e.scope,e.pierceShadow,e.originalScope],()=>{if(Array.isArray(n))return this._queryEngine(ct,e,n);if(this._hasScopeClause(n))e=this._expandContextForScopeMatching(e);let r=this._scoreMap;this._scoreMap=new Map;let i=this._querySimple(e,n.simples[n.simples.length-1].selector);if(i=i.filter((s)=>this._matchesParents(s,n,n.simples.length-2,e)),this._scoreMap.size)i.sort((s,a)=>{let o=this._scoreMap.get(s),l=this._scoreMap.get(a);if(o===l)return 0;if(o===void 0)return 1;if(l===void 0)return-1;return o-l});return this._scoreMap=r,i})}finally{this.end()}}_markScore(e,t){if(this._scoreMap)this._scoreMap.set(e,t)}_hasScopeClause(e){return e.simples.some((t)=>t.selector.functions.some((n)=>n.name==="scope"))}_expandContextForScopeMatching(e){if(e.scope.nodeType!==1)return e;let t=R(e.scope);if(!t)return e;return{...e,scope:t,originalScope:e.originalScope||e.scope}}_matchesSimple(e,t,n){return this._cached(this._cacheMatchesSimple,e,[t,n.scope,n.pierceShadow,n.originalScope],()=>{if(e===n.scope)return!1;if(t.css&&!this._matchesCSS(e,t.css))return!1;for(let r of t.functions)if(!this._matchesEngine(this._getEngine(r.name),e,r.args,n))return!1;return!0})}_querySimple(e,t){if(!t.functions.length)return this._queryCSS(e,t.css||"*");return this._cached(this._cacheQuerySimple,t,[e.scope,e.pierceShadow,e.originalScope],()=>{let{css:n,functions:r}=t;if(n==="*"&&r.length)n=void 0;let i,s=-1;if(n!==void 0)i=this._queryCSS(e,n);else{if(s=r.findIndex((a)=>this._getEngine(a.name).query!==void 0),s===-1)s=0;i=this._queryEngine(this._getEngine(r[s].name),e,r[s].args)}for(let a=0;a<r.length;a++){if(a===s)continue;let o=this._getEngine(r[a].name);if(o.matches!==void 0)i=i.filter((l)=>this._matchesEngine(o,l,r[a].args,e))}for(let a=0;a<r.length;a++){if(a===s)continue;let o=this._getEngine(r[a].name);if(o.matches===void 0)i=i.filter((l)=>this._matchesEngine(o,l,r[a].args,e))}return i})}_matchesParents(e,t,n,r){if(n<0)return!0;return this._cached(this._cacheMatchesParents,e,[t,n,r.scope,r.pierceShadow,r.originalScope],()=>{let{selector:i,combinator:s}=t.simples[n];if(s===">"){let a=zt(e,r);if(!a||!this._matchesSimple(a,i,r))return!1;return this._matchesParents(a,t,n-1,r)}if(s==="+"){let a=$n(e,r);if(!a||!this._matchesSimple(a,i,r))return!1;return this._matchesParents(a,t,n-1,r)}if(s===""){let a=zt(e,r);while(a){if(this._matchesSimple(a,i,r)){if(this._matchesParents(a,t,n-1,r))return!0;if(t.simples[n-1].combinator==="")break}a=zt(a,r)}return!1}if(s==="~"){let a=$n(e,r);while(a){if(this._matchesSimple(a,i,r)){if(this._matchesParents(a,t,n-1,r))return!0;if(t.simples[n-1].combinator==="~")break}a=$n(a,r)}return!1}if(s===">="){let a=e;while(a){if(this._matchesSimple(a,i,r)){if(this._matchesParents(a,t,n-1,r))return!0;if(t.simples[n-1].combinator==="")break}a=zt(a,r)}return!1}throw Error(`Unsupported combinator "${s}"`)})}_matchesEngine(e,t,n,r){if(e.matches)return this._callMatches(e,t,n,r);if(e.query)return this._callQuery(e,n,r).includes(t);throw Error('Selector engine should implement "matches" or "query"')}_queryEngine(e,t,n){if(e.query)return this._callQuery(e,n,t);if(e.matches)return this._queryCSS(t,"*").filter((r)=>this._callMatches(e,r,n,t));throw Error('Selector engine should implement "matches" or "query"')}_callMatches(e,t,n,r){return this._cached(this._cacheCallMatches,t,[e,r.scope,r.pierceShadow,r.originalScope,...n],()=>{return e.matches(t,n,r,this)})}_callQuery(e,t,n){return this._cached(this._cacheCallQuery,e,[n.scope,n.pierceShadow,n.originalScope,...t],()=>{return e.query(n,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 n=[];function r(i){if(n=n.concat([...i.querySelectorAll(t)]),!e.pierceShadow)return;if(i.shadowRoot)r(i.shadowRoot);for(let s of i.querySelectorAll("*"))if(s.shadowRoot)r(s.shadowRoot)}return r(e.scope),n})}_getEngine(e){let t=this._engines.get(e);if(!t)throw Error(`Unknown selector engine "${e}"`);return t}}var ct={matches(e,t,n,r){if(t.length===0)throw Error('"is" engine expects non-empty selector list');return t.some((i)=>r.matches(e,i,n))},query(e,t,n){if(t.length===0)throw Error('"is" engine expects non-empty selector list');let r=[];for(let i of t)r=r.concat(n.query(e,i));return t.length===1?r:Dn(r)}},ks={matches(e,t,n,r){if(t.length===0)throw Error('"has" engine expects non-empty selector list');return r.query({...n,scope:e},t).length>0}},Os={matches(e,t,n,r){if(t.length!==0)throw Error('"scope" engine expects no arguments');let i=n.originalScope||n.scope;if(i.nodeType===9)return e===i.documentElement;return e===i},query(e,t,n){if(t.length!==0)throw Error('"scope" engine expects no arguments');let r=e.originalScope||e.scope;if(r.nodeType===9){let i=r.documentElement;return i?[i]:[]}if(r.nodeType===1)return[r];return[]}},Ms={matches(e,t,n,r){if(t.length===0)throw Error('"not" engine expects non-empty selector list');return!r.matches(e,t,n)}},$s={query(e,t,n){return n.query({...e,pierceShadow:!1},t)},matches(e,t,n,r){return r.matches(e,t,{...n,pierceShadow:!1})}},Ps={matches(e,t,n,r){if(t.length)throw Error('"visible" engine expects no arguments');return B(e)}},Ds={matches(e,t,n,r){if(t.length!==1||typeof t[0]!=="string")throw Error('"text" engine expects a single string');let i=A(t[0]).toLowerCase(),s=(a)=>a.normalized.toLowerCase().includes(i);return Re(r._cacheText,e,s)==="self"}},Hs={matches(e,t,n,r){if(t.length!==1||typeof t[0]!=="string")throw Error('"text-is" engine expects a single string');let i=A(t[0]),s=(a)=>{if(!i&&!a.immediate.length)return!0;return a.immediate.some((o)=>A(o)===i)};return Re(r._cacheText,e,s)!=="none"}},qs={matches(e,t,n,r){if(t.length===0||typeof t[0]!=="string"||t.length>2||t.length===2&&typeof t[1]!=="string")throw 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=(a)=>i.test(a.full);return Re(r._cacheText,e,s)==="self"}},Bs={matches(e,t,n,r){if(t.length!==1||typeof t[0]!=="string")throw Error('"has-text" engine expects a single string');if(Vt(e))return!1;let i=A(t[0]).toLowerCase();return((a)=>a.normalized.toLowerCase().includes(i))(P(r._cacheText,e))}};function lt(e){return{matches(t,n,r,i){let s=n.length&&typeof n[n.length-1]==="number"?n[n.length-1]:void 0,a=s===void 0?n:n.slice(0,n.length-1);if(n.length<1+(s===void 0?0:1))throw Error(`"${e}" engine expects a selector list and optional maximum distance in pixels`);let o=i.query(r,a),l=Wt(e,t,o,s);if(l===void 0)return!1;return i._markScore(t,l),!0}}}var Us={query(e,t,n){let r=t[t.length-1];if(t.length<2)throw Error('"nth-match" engine expects non-empty selector list and an index argument');if(typeof r!=="number"||r<1)throw Error('"nth-match" engine expects a one-based index as the last argument');let i=ct.query(e,t.slice(0,t.length-1),n);return r--,r<i.length?[i[r]]:[]}};function zt(e,t){if(e===t.scope)return;if(!t.pierceShadow)return e.parentElement||void 0;return R(e)}function $n(e,t){if(e===t.scope)return;return e.previousElementSibling||void 0}function Dn(e){let t=new Map,n=[],r=[];function i(a){let o=t.get(a);if(o)return o;let l=R(a);if(l)i(l).children.push(a);else n.push(a);return o={children:[],taken:!1},t.set(a,o),o}for(let a of e)i(a).taken=!0;function s(a){let o=t.get(a);if(o.taken)r.push(a);if(o.children.length>1){let l=new Set(o.children);o.children=[];let c=a.firstElementChild;while(c&&o.children.length<l.size){if(l.has(c))o.children.push(c);c=c.nextElementSibling}c=a.shadowRoot?a.shadowRoot.firstElementChild:null;while(c&&o.children.length<l.size){if(l.has(c))o.children.push(c);c=c.nextElementSibling}}o.children.forEach(s)}return n.forEach(s),r}var oi=10,$e=oi/2,ii=1,Fs=2,Ws=10,Vs=50,ai=100,li=120,ci=140,ui=160,Qt=180,di=200,si=250,js=li+$e,zs=ci+$e,Ys=ai+$e,Qs=ui+$e,Gs=Qt+$e,Js=di+$e,Ks=300,Xs=500,hi=510,Hn=520,fi=530,Bn=1e4,Zs=1e7,eo=1000;function Fn(e,t,n){e._evaluator.begin();let r={allowText:new Map,disallowText:new Map};oe(),Ae();try{let i=[];if(n.forTextExpect){let o=ut(e,t.ownerDocument.documentElement,n);for(let l=t;l;l=R(l)){let c=fe(r,e,l,{...n,noText:!0});if(!c)continue;if(pe(c)<=eo){o=c;break}}i=[Gt(o)]}else{if(!t.matches("input,textarea,select")&&!t.isContentEditable){let o=he(t,"button,select,input,[role=button],[role=checkbox],[role=radio],a,[role=link]",n.root);if(o&&B(o))t=o}if(n.multiple){let o=fe(r,e,t,n),l=fe(r,e,t,{...n,noText:!0}),c=[o,l];if(r.allowText.clear(),r.disallowText.clear(),o&&qn(o))c.push(fe(r,e,t,{...n,noCSSId:!0}));if(l&&qn(l))c.push(fe(r,e,t,{...n,noText:!0,noCSSId:!0}));if(c=c.filter(Boolean),!c.length){let h=ut(e,t,n);if(c.push(h),qn(h))c.push(ut(e,t,{...n,noCSSId:!0}))}i=[...new Set(c.map((h)=>Gt(h)))]}else{let o=fe(r,e,t,n)||ut(e,t,n);i=[Gt(o)]}}let s=i[0],a=e.parseSelector(s);return{selector:s,selectors:i,elements:e.querySelectorAll(a,n.root??t.ownerDocument)}}finally{_e(),ae(),e._evaluator.end()}}function fe(e,t,n,r){if(r.root&&!Ge(r.root,n))throw Error("Target element must belong to the root's subtree");if(n===r.root)return[{engine:"css",selector:":scope",score:1}];if(n.ownerDocument.documentElement===n)return[{engine:"css",selector:"html",score:1}];let i=null,s=(o)=>{if(!i||pe(o)<pe(i))i=o},a=[];if(!r.noText)for(let o of no(t,n,!r.isRecursive))a.push({candidate:o,isTextCandidate:!0});for(let o of to(t,n,r)){if(r.omitInternalEngines&&o.engine.startsWith("internal:"))continue;a.push({candidate:[o],isTextCandidate:!1})}a.sort((o,l)=>pe(o.candidate)-pe(l.candidate));for(let{candidate:o,isTextCandidate:l}of a){let c=t.querySelectorAll(t.parseSelector(Gt(o)),r.root??n.ownerDocument);if(!c.includes(n))continue;if(c.length===1){s(o);break}let h=c.indexOf(n);if(h>5)continue;if(s([...o,{engine:"nth",selector:String(h),score:Bn}]),r.isRecursive)continue;for(let u=R(n);u&&u!==r.root;u=R(u)){let f=c.filter((w)=>Ge(u,w)&&w!==u),x=f.indexOf(n);if(f.length>5||x===-1||x===h&&f.length>1)continue;let d=f.length===1?o:[...o,{engine:"nth",selector:String(x),score:Bn}];if(i&&pe([{engine:"",selector:"",score:1},...d])>=pe(i))continue;let p=!!r.noText||l,E=p?e.disallowText:e.allowText,S=E.get(u);if(S===void 0)S=fe(e,t,u,{...r,isRecursive:!0,noText:p})||ut(t,u,r),E.set(u,S);if(!S)continue;s([...S,...d])}}return i}function to(e,t,n){let r=[];{for(let a of["data-testid","data-test-id","data-test"])if(a!==n.testIdAttributeName&&t.getAttribute(a))r.push({engine:"css",selector:`[${a}=${de(t.getAttribute(a))}]`,score:Fs});if(!n.noCSSId){let a=t.getAttribute("id");if(a&&!ro(a))r.push({engine:"css",selector:pi(a),score:Xs})}r.push({engine:"css",selector:re(t),score:fi})}if(t.nodeName==="IFRAME"){for(let a of["name","title"])if(t.getAttribute(a))r.push({engine:"css",selector:`${re(t)}[${a}=${de(t.getAttribute(a))}]`,score:Ws});if(t.getAttribute(n.testIdAttributeName))r.push({engine:"css",selector:`[${n.testIdAttributeName}=${de(t.getAttribute(n.testIdAttributeName))}]`,score:ii});return Un([r]),r}if(t.getAttribute(n.testIdAttributeName))r.push({engine:"internal:testid",selector:`[${n.testIdAttributeName}=${O(t.getAttribute(n.testIdAttributeName),!0)}]`,score:ii});if(t.nodeName==="INPUT"||t.nodeName==="TEXTAREA"){let a=t;if(a.placeholder){r.push({engine:"internal:attr",selector:`[placeholder=${O(a.placeholder,!0)}]`,score:js});for(let o of Me(a.placeholder))r.push({engine:"internal:attr",selector:`[placeholder=${O(o.text,!1)}]`,score:li-o.scoreBonus})}}let i=jt(e._evaluator._cacheText,t);for(let a of i){let o=a.normalized;r.push({engine:"internal:label",selector:I(o,!0),score:zs});for(let l of Me(o))r.push({engine:"internal:label",selector:I(l.text,!1),score:ci-l.scoreBonus})}let s=T(t);if(s&&!["none","presentation"].includes(s))r.push({engine:"internal:role",selector:s,score:hi});if(t.getAttribute("name")&&["BUTTON","FORM","FIELDSET","FRAME","IFRAME","INPUT","KEYGEN","OBJECT","OUTPUT","SELECT","TEXTAREA","MAP","META","PARAM"].includes(t.nodeName))r.push({engine:"css",selector:`${re(t)}[name=${de(t.getAttribute("name"))}]`,score:Hn});if(["INPUT","TEXTAREA"].includes(t.nodeName)&&t.getAttribute("type")!=="hidden"){if(t.getAttribute("type"))r.push({engine:"css",selector:`${re(t)}[type=${de(t.getAttribute("type"))}]`,score:Hn})}if(["INPUT","TEXTAREA","SELECT"].includes(t.nodeName)&&t.getAttribute("type")!=="hidden")r.push({engine:"css",selector:re(t),score:Hn+1});return Un([r]),r}function no(e,t,n){if(t.nodeName==="SELECT")return[];let r=[],i=t.getAttribute("title");if(i){r.push([{engine:"internal:attr",selector:`[title=${O(i,!0)}]`,score:Js}]);for(let c of Me(i))r.push([{engine:"internal:attr",selector:`[title=${O(c.text,!1)}]`,score:di-c.scoreBonus}])}let s=t.getAttribute("alt");if(s&&["APPLET","AREA","IMG","INPUT"].includes(t.nodeName)){r.push([{engine:"internal:attr",selector:`[alt=${O(s,!0)}]`,score:Qs}]);for(let c of Me(s))r.push([{engine:"internal:attr",selector:`[alt=${O(c.text,!1)}]`,score:ui-c.scoreBonus}])}let a=P(e._evaluator._cacheText,t).normalized,o=a?Me(a):[];if(a){if(n){if(a.length<=80)r.push([{engine:"internal:text",selector:I(a,!0),score:Gs}]);for(let h of o)r.push([{engine:"internal:text",selector:I(h.text,!1),score:Qt-h.scoreBonus}])}let c={engine:"css",selector:re(t),score:fi};for(let h of o)r.push([c,{engine:"internal:has-text",selector:I(h.text,!1),score:Qt-h.scoreBonus}]);if(n&&a.length<=80){let h=new RegExp("^"+Te(a)+"$");r.push([c,{engine:"internal:has-text",selector:I(h,!1),score:si}])}}let l=T(t);if(l&&!["none","presentation"].includes(l)){let c=G(t,!1);if(c&&!c.match(/^\p{Co}+$/u)){let h={engine:"internal:role",selector:`${l}[name=${O(c,!0)}]`,score:Ys};r.push([h]);for(let u of Me(c))r.push([{engine:"internal:role",selector:`${l}[name=${O(u.text,!1)}]`,score:ai-u.scoreBonus}])}else{let h={engine:"internal:role",selector:`${l}`,score:hi};for(let u of o)r.push([h,{engine:"internal:has-text",selector:I(u.text,!1),score:Qt-u.scoreBonus}]);if(n&&a.length<=80){let u=new RegExp("^"+Te(a)+"$");r.push([h,{engine:"internal:has-text",selector:I(u,!1),score:si}])}}}return Un(r),r}function pi(e){return/^[a-zA-Z][a-zA-Z0-9\-\_]+$/.test(e)?"#"+e:`[id=${de(e)}]`}function qn(e){return e.some((t)=>t.engine==="css"&&(t.selector.startsWith("#")||t.selector.startsWith('[id="')))}function ut(e,t,n){let r=n.root??t.ownerDocument,i=[];function s(o){let l=i.slice();if(o)l.unshift(o);let c=l.join(" > "),h=e.parseSelector(c);return e.querySelector(h,r,!1)===t?c:void 0}function a(o){let l={engine:"css",selector:o,score:Zs},c=e.parseSelector(o),h=e.querySelectorAll(c,r);if(h.length===1)return[l];let u={engine:"nth",selector:String(h.indexOf(t)),score:Bn};return[l,u]}for(let o=t;o&&o!==r;o=R(o)){let l="";if(o.id&&!n.noCSSId){let u=pi(o.id),f=s(u);if(f)return a(f);l=u}let c=o.parentNode,h=[...o.classList].map(io);for(let u=0;u<h.length;++u){let f="."+h.slice(0,u+1).join("."),x=s(f);if(x)return a(x);if(!l&&c){if(c.querySelectorAll(f).length===1)l=f}}if(c){let u=[...c.children],f=o.nodeName,d=u.filter((p)=>p.nodeName===f).indexOf(o)===0?re(o):`${re(o)}:nth-child(${1+u.indexOf(o)})`,b=s(d);if(b)return a(b);if(!l)l=d}else if(!l)l=re(o);i.unshift(l)}return a(s())}function Un(e){for(let t of e)for(let n of t)if(n.score>Vs&&n.score<Ks)n.score+=Math.min(oi,n.selector.length/10|0)}function Gt(e){let t=[],n="";for(let{engine:r,selector:i}of e){if(t.length&&(n!=="css"||r!=="css"||i.startsWith(":nth-match(")))t.push(">>");if(n=r,r==="css")t.push(i);else t.push(`${r}=${i}`)}return t.join(" ")}function pe(e){let t=0;for(let n=0;n<e.length;n++)t+=e[n].score*(e.length-n);return t}function ro(e){let t,n=0;for(let r=0;r<e.length;++r){let i=e[r],s;if(i==="-"||i==="_")continue;if(i>="a"&&i<="z")s="lower";else if(i>="A"&&i<="Z")s="upper";else if(i>="0"&&i<="9")s="digit";else s="other";if(s==="lower"&&t==="upper"){t=s;continue}if(t&&t!==s)++n;t=s}return n>=e.length/4}function Yt(e,t){if(e.length<=t)return e;e=e.substring(0,t);let n=e.match(/^(.*)\b(.+?)$/);if(!n)return"";return n[1].trimEnd()}function Me(e){let t=[];{let n=e.match(/^([\d.,]+)[^.,\w]/),r=n?n[1].length:0;if(r){let i=Yt(e.substring(r).trimStart(),80);t.push({text:i,scoreBonus:i.length<=30?2:1})}}{let n=e.match(/[^.,\w]([\d.,]+)$/),r=n?n[1].length:0;if(r){let i=Yt(e.substring(0,e.length-r).trimEnd(),80);t.push({text:i,scoreBonus:i.length<=30?2:1})}}if(e.length<=30)t.push({text:e,scoreBonus:0});else t.push({text:Yt(e,80),scoreBonus:0}),t.push({text:Yt(e,30),scoreBonus:1});if(t=t.filter((n)=>n.text),!t.length)t.push({text:e.substring(0,80),scoreBonus:0});return t}function re(e){return e.nodeName.toLocaleLowerCase().replace(/[:\.]/g,(t)=>"\\"+t)}function io(e){let t="";for(let n=0;n<e.length;n++)t+=so(e,n);return t}function so(e,t){let n=e.charCodeAt(t);if(n===0)return"�";if(n>=1&&n<=31||n>=48&&n<=57&&(t===0||t===1&&e.charCodeAt(0)===45))return"\\"+n.toString(16)+" ";if(t===0&&n===45&&e.length===1)return"\\"+e.charAt(t);if(n>=128||n===45||n===95||n>=48&&n<=57||n>=65&&n<=90||n>=97&&n<=122)return e.charAt(t);return"\\"+e.charAt(t)}var Wn={queryAll(e,t){if(t.startsWith("/")&&e.nodeType!==Node.DOCUMENT_NODE)t="."+t;let n=[],r=e.ownerDocument||e;if(!r)return n;let i=r.evaluate(t,e,null,XPathResult.ORDERED_NODE_ITERATOR_TYPE);for(let s=i.iterateNext();s;s=i.iterateNext())if(s.nodeType===Node.ELEMENT_NODE)n.push(s);return n}};function Vn(e,t,n){return`internal:attr=[${e}=${O(t,n?.exact||!1)}]`}function gi(e,t){return`internal:testid=[${e}=${O(t,!0)}]`}function mi(e,t){return"internal:label="+I(e,!!t?.exact)}function bi(e,t){return Vn("alt",e,t)}function xi(e,t){return Vn("title",e,t)}function Ei(e,t){return Vn("placeholder",e,t)}function Si(e,t){return"internal:text="+I(e,!!t?.exact)}function yi(e,t={}){let n=[];if(t.checked!==void 0)n.push(["checked",String(t.checked)]);if(t.disabled!==void 0)n.push(["disabled",String(t.disabled)]);if(t.selected!==void 0)n.push(["selected",String(t.selected)]);if(t.expanded!==void 0)n.push(["expanded",String(t.expanded)]);if(t.includeHidden!==void 0)n.push(["include-hidden",String(t.includeHidden)]);if(t.level!==void 0)n.push(["level",String(t.level)]);if(t.name!==void 0)n.push(["name",O(t.name,!!t.exact)]);if(t.pressed!==void 0)n.push(["pressed",String(t.pressed)]);return`internal:role=${e}${n.map(([r,i])=>`[${r}=${i}]`).join("")}`}var Pe=Symbol("selector");class De{[Pe];element;elements;constructor(e,t,n){if(n?.hasText)t+=` >> internal:has-text=${I(n.hasText,!1)}`;if(n?.hasNotText)t+=` >> internal:has-not-text=${I(n.hasNotText,!1)}`;if(n?.has)t+=" >> internal:has="+JSON.stringify(n.has[Pe]);if(n?.hasNot)t+=" >> internal:has-not="+JSON.stringify(n.hasNot[Pe]);if(n?.visible!==void 0)t+=` >> visible=${n.visible?"true":"false"}`;if(this[Pe]=t,t){let s=e.parseSelector(t);this.element=e.querySelector(s,e.document,!1),this.elements=e.querySelectorAll(s,e.document)}let r=t,i=this;i.locator=(s,a)=>{return new De(e,r?r+" >> "+s:s,a)},i.getByTestId=(s)=>i.locator(gi(e.testIdAttributeNameForStrictErrorAndConsoleCodegen(),s)),i.getByAltText=(s,a)=>i.locator(bi(s,a)),i.getByLabel=(s,a)=>i.locator(mi(s,a)),i.getByPlaceholder=(s,a)=>i.locator(Ei(s,a)),i.getByText=(s,a)=>i.locator(Si(s,a)),i.getByTitle=(s,a)=>i.locator(xi(s,a)),i.getByRole=(s,a={})=>i.locator(yi(s,a)),i.filter=(s)=>new De(e,t,s),i.first=()=>i.locator("nth=0"),i.last=()=>i.locator("nth=-1"),i.nth=(s)=>i.locator(`nth=${s}`),i.and=(s)=>new De(e,r+" >> internal:and="+JSON.stringify(s[Pe])),i.or=(s)=>new De(e,r+" >> internal:or="+JSON.stringify(s[Pe]))}}class jn{_injectedScript;constructor(e){this._injectedScript=e}install(){if(this._injectedScript.window.playwright)return;this._injectedScript.window.playwright={$:(e,t)=>this._querySelector(e,!!t),$$:(e)=>this._querySelectorAll(e),inspect:(e)=>this._inspect(e),selector:(e)=>this._selector(e),generateLocator:(e,t)=>this._generateLocator(e,t),ariaSnapshot:(e,t)=>{return this._injectedScript.ariaSnapshot(e||this._injectedScript.document.body,t||{mode:"default"})},resume:()=>this._resume(),...new De(this._injectedScript,"")},delete this._injectedScript.window.playwright.filter,delete this._injectedScript.window.playwright.first,delete this._injectedScript.window.playwright.last,delete this._injectedScript.window.playwright.nth,delete this._injectedScript.window.playwright.and,delete this._injectedScript.window.playwright.or}_querySelector(e,t){if(typeof e!=="string")throw Error("Usage: playwright.query('Playwright >> selector').");let n=this._injectedScript.parseSelector(e);return this._injectedScript.querySelector(n,this._injectedScript.document,t)}_querySelectorAll(e){if(typeof e!=="string")throw Error("Usage: playwright.$$('Playwright >> selector').");let t=this._injectedScript.parseSelector(e);return this._injectedScript.querySelectorAll(t,this._injectedScript.document)}_inspect(e){if(typeof e!=="string")throw Error("Usage: playwright.inspect('Playwright >> selector').");this._injectedScript.window.inspect(this._querySelector(e,!1))}_selector(e){if(!(e instanceof Element))throw Error("Usage: playwright.selector(element).");return this._injectedScript.generateSelectorSimple(e)}_generateLocator(e,t){if(!(e instanceof Element))throw Error("Usage: playwright.locator(element).");let n=this._injectedScript.generateSelectorSimple(e);return te(t||"javascript",n)}_resume(){if(!this._injectedScript.window.__pw_resume)return!1;this._injectedScript.window.__pw_resume().catch(()=>{})}}function oo(e){try{return e instanceof RegExp||Object.prototype.toString.call(e)==="[object RegExp]"}catch(t){return!1}}function ao(e){try{return e instanceof Date||Object.prototype.toString.call(e)==="[object Date]"}catch(t){return!1}}function lo(e){try{return e instanceof URL||Object.prototype.toString.call(e)==="[object URL]"}catch(t){return!1}}function co(e){try{return e instanceof Error||e&&Object.getPrototypeOf(e)?.name==="Error"}catch(t){return!1}}function uo(e,t){try{return e instanceof t||Object.prototype.toString.call(e)===`[object ${t.name}]`}catch(n){return!1}}function ho(e){try{return e instanceof ArrayBuffer||Object.prototype.toString.call(e)==="[object ArrayBuffer]"}catch(t){return!1}}var vi={i8:Int8Array,ui8:Uint8Array,ui8c:Uint8ClampedArray,i16:Int16Array,ui16:Uint16Array,i32:Int32Array,ui32:Uint32Array,f32:Float32Array,f64:Float64Array,bi64:BigInt64Array,bui64:BigUint64Array};function wi(e){if("toBase64"in e)return e.toBase64();let t=Array.from(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)).map((n)=>String.fromCharCode(n)).join("");return btoa(t)}function Ti(e,t){let n=atob(e),r=new Uint8Array(n.length);for(let i=0;i<n.length;i++)r[i]=n.charCodeAt(i);return new t(r.buffer)}function He(e,t=[],n=new Map){if(Object.is(e,void 0))return;if(typeof e==="object"&&e){if("ref"in e)return n.get(e.ref);if("v"in e){if(e.v==="undefined")return;if(e.v==="null")return null;if(e.v==="NaN")return NaN;if(e.v==="Infinity")return 1/0;if(e.v==="-Infinity")return-1/0;if(e.v==="-0")return-0;return}if("d"in e)return new Date(e.d);if("u"in e)return new URL(e.u);if("bi"in e)return BigInt(e.bi);if("e"in e){let r=Error(e.e.m);return r.name=e.e.n,r.stack=e.e.s,r}if("r"in e)return new RegExp(e.r.p,e.r.f);if("a"in e){let r=[];n.set(e.id,r);for(let i of e.a)r.push(He(i,t,n));return r}if("o"in e){let r={};n.set(e.id,r);for(let{k:i,v:s}of e.o){if(i==="__proto__")continue;r[i]=He(s,t,n)}return r}if("h"in e)return t[e.h];if("ta"in e)return Ti(e.ta.b,vi[e.ta.k]);if("ab"in e)return Ti(e.ab.b,Uint8Array).buffer}return e}function Jt(e,t){return zn(e,t,{visited:new Map,lastId:0})}function zn(e,t,n){if(e&&typeof e==="object"){if(typeof globalThis.Window==="function"&&e instanceof globalThis.Window)return"ref: <Window>";if(typeof globalThis.Document==="function"&&e instanceof globalThis.Document)return"ref: <Document>";if(typeof globalThis.Node==="function"&&e instanceof globalThis.Node)return"ref: <Node>"}return Ai(e,t,n)}function Ai(e,t,n){let r=t(e);if("fallThrough"in r)e=r.fallThrough;else return r;if(typeof e==="symbol")return{v:"undefined"};if(Object.is(e,void 0))return{v:"undefined"};if(Object.is(e,null))return{v:"null"};if(Object.is(e,NaN))return{v:"NaN"};if(Object.is(e,1/0))return{v:"Infinity"};if(Object.is(e,-1/0))return{v:"-Infinity"};if(Object.is(e,-0))return{v:"-0"};if(typeof e==="boolean")return e;if(typeof e==="number")return e;if(typeof e==="string")return e;if(typeof e==="bigint")return{bi:e.toString()};if(co(e)){let s;if(e.stack?.startsWith(e.name+": "+e.message))s=e.stack;else s=`${e.name}: ${e.message}
${e.stack}`;return{e:{n:e.name,m:e.message,s}}}if(ao(e))return{d:e.toJSON()};if(lo(e))return{u:e.toJSON()};if(oo(e))return{r:{p:e.source,f:e.flags}};for(let[s,a]of Object.entries(vi))if(uo(e,a))return{ta:{b:wi(e),k:s}};if(ho(e))return{ab:{b:wi(new Uint8Array(e))}};let i=n.visited.get(e);if(i)return{ref:i};if(Array.isArray(e)){let s=[],a=++n.lastId;n.visited.set(e,a);for(let o=0;o<e.length;++o)s.push(zn(e[o],t,n));return{a:s,id:a}}if(typeof e==="object"){let s=[],a=++n.lastId;n.visited.set(e,a);for(let l of Object.keys(e)){let c;try{c=e[l]}catch(h){continue}if(l==="toJSON"&&typeof c==="function")s.push({k:l,v:{o:[],id:0}});else s.push({k:l,v:zn(c,t,n)})}let o;try{if(s.length===0&&e.toJSON&&typeof e.toJSON==="function")o={value:e.toJSON()}}catch(l){}if(o)return Ai(o.value,t,n);return{o:s,id:a}}}class qe{global;builtins;isUnderTest;constructor(e,t){if(this.global=e,this.isUnderTest=t,e.__pwClock)this.builtins=e.__pwClock.builtins;else this.builtins={setTimeout:e.setTimeout?.bind(e),clearTimeout:e.clearTimeout?.bind(e),setInterval:e.setInterval?.bind(e),clearInterval:e.clearInterval?.bind(e),requestAnimationFrame:e.requestAnimationFrame?.bind(e),cancelAnimationFrame:e.cancelAnimationFrame?.bind(e),requestIdleCallback:e.requestIdleCallback?.bind(e),cancelIdleCallback:e.cancelIdleCallback?.bind(e),performance:e.performance,Intl:e.Intl,Date:e.Date,AbortSignal:e.AbortSignal};if(this.isUnderTest)e.builtins=this.builtins}evaluate(e,t,n,r,...i){let s=i.slice(0,r),a=i.slice(r),o=[];for(let c=0;c<s.length;c++)o[c]=He(s[c],a);let l=this.global.eval(n);if(e===!0)l=l(...o);else if(e===!1)l=l;else if(typeof l==="function")l=l(...o);return t?this._promiseAwareJsonValueNoThrow(l):l}jsonValue(e,t){if(t===void 0)return;return Jt(t,(n)=>({fallThrough:n}))}_promiseAwareJsonValueNoThrow(e){let t=(n)=>{try{return this.jsonValue(!0,n)}catch(r){return}};if(e&&typeof e==="object"&&typeof e.then==="function")return(async()=>{let n=await e;return t(n)})();return t(e)}}class Qn{_engines;_evaluator;_stableRafCount;_browserName;_isUtilityWorld;onGlobalListenersRemoved;_hitTargetInterceptor;_highlight;isUnderTest;_sdkLanguage;_testIdAttributeNameForStrictErrorAndConsoleCodegen="data-testid";_markedElements;window;document;consoleApi;_lastAriaSnapshotForTrack=new Map;_lastAriaSnapshotForQuery;utils={asLocator:te,cacheNormalizedWhitespaces:hr,elementText:P,getAriaRole:T,getElementAccessibleDescription:bn,getElementAccessibleName:G,isElementVisible:B,isInsideScope:Ge,normalizeWhiteSpace:A,parseAriaSnapshot:Kn,generateAriaTree:Ie,findNewElement:Zr,builtins:null};_autoClosingTags;_booleanAttributes;_eventTypes;_hoverHitTargetInterceptorEvents;_tapHitTargetInterceptorEvents;_mouseHitTargetInterceptorEvents;_allHitTargetInterceptorEvents;constructor(e,t){this.window=e,this.document=e.document,this.isUnderTest=t.isUnderTest,this.utils.builtins=new qe(e,t.isUnderTest).builtins,this._sdkLanguage=t.sdkLanguage,this._testIdAttributeNameForStrictErrorAndConsoleCodegen=t.testIdAttributeName,this._evaluator=new Pn,this.consoleApi=new jn(this),this.onGlobalListenersRemoved=new Set,this._autoClosingTags=new Set(["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","MENUITEM","META","PARAM","SOURCE","TRACK","WBR"]),this._booleanAttributes=new Set(["checked","selected","disabled","readonly","multiple"]),this._eventTypes=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"]]),this._hoverHitTargetInterceptorEvents=new Set(["mousemove"]),this._tapHitTargetInterceptorEvents=new Set(["pointerdown","pointerup","touchstart","touchend","touchcancel"]),this._mouseHitTargetInterceptorEvents=new Set(["mousedown","mouseup","pointerdown","pointerup","click","auxclick","dblclick","contextmenu"]),this._allHitTargetInterceptorEvents=new Set([...this._hoverHitTargetInterceptorEvents,...this._tapHitTargetInterceptorEvents,...this._mouseHitTargetInterceptorEvents]),this._engines=new Map,this._engines.set("xpath",Wn),this._engines.set("xpath:light",Wn),this._engines.set("role",Mn(!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",Mn(!0)),this._engines.set("internal:describe",this._createDescribeEngine()),this._engines.set("aria-ref",this._createAriaRefEngine());for(let{name:n,source:r}of t.customEngines)this._engines.set(n,this.eval(r));if(this._stableRafCount=t.stableRafCount,this._browserName=t.browserName,this._isUtilityWorld=!!t.isUtilityWorld,Tr({browserNameForWorkarounds:t.browserName}),this._setupGlobalListenersRemovalDetection(),this._setupHitTargetInterceptors(),this.isUnderTest)this.window.__injectedScript=this}eval(e){return this.window.eval(e)}testIdAttributeNameForStrictErrorAndConsoleCodegen(){return this._testIdAttributeNameForStrictErrorAndConsoleCodegen}parseSelector(e){let t=Ve(e);return dr(t,(n)=>{if(!this._engines.has(n.name))throw this.createStacklessError(`Unknown engine "${n.name}" while parsing selector ${e}`)}),t}generateSelector(e,t){return Fn(this,e,t)}generateSelectorSimple(e,t){return Fn(this,e,{...t,testIdAttributeName:this._testIdAttributeNameForStrictErrorAndConsoleCodegen}).selector}querySelector(e,t,n){let r=this.querySelectorAll(e,t);if(n&&r.length>1)throw this.strictModeViolationError(e,r);return this.checkDeprecatedSelectorUsage(e,r),r[0]}_queryNth(e,t){let n=[...e],r=+t.body;if(r===-1)r=n.length-1;return new Set(n.slice(r,r+1))}_queryLayoutSelector(e,t,n){let{name:r,body:i}=t,s=[],a=this.querySelectorAll(i.parsed,n);for(let o of e){let l=Wt(r,o,a,i.distance);if(l!==void 0)s.push({element:o,score:l})}return s.sort((o,l)=>o.score-l.score),new Set(s.map((o)=>o.element))}ariaSnapshot(e,t){return this.incrementalAriaSnapshot(e,t).full}incrementalAriaSnapshot(e,t){if(e.nodeType!==Node.ELEMENT_NODE)throw this.createStacklessError("Can only capture aria snapshot of Element nodes.");let n=Ie(e,t),r=Ce(n,t),i;if(t.track){let s=this._lastAriaSnapshotForTrack.get(t.track);if(s)i=Ce(n,t,s).text;this._lastAriaSnapshotForTrack.set(t.track,n)}return this._lastAriaSnapshotForQuery=n,{full:r.text,incremental:i,iframeRefs:n.iframeRefs,iframeDepths:r.iframeDepths}}ariaSnapshotForRecorder(){let e=Ie(this.document.body,{mode:"ai"}),{text:t}=Ce(e,{mode:"ai"});return{ariaSnapshot:t,refs:e.refs}}getAllElementsMatchingExpectAriaTemplate(e,t){return Gr(e.documentElement,t)}querySelectorAll(e,t){if(e.capture!==void 0){if(e.parts.some((r)=>r.name==="nth"))throw this.createStacklessError("Can't query n-th element in a request with the capture.");let n={parts:e.parts.slice(0,e.capture+1)};if(e.capture<e.parts.length-1){let r={parts:e.parts.slice(e.capture+1)},i={name:"internal:has",body:{parsed:r},source:F(r)};n.parts.push(i)}return this.querySelectorAll(n,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 n=new Set([t]);for(let r of e.parts)if(r.name==="nth")n=this._queryNth(n,r);else if(r.name==="internal:and"){let i=this.querySelectorAll(r.body.parsed,t);n=new Set(i.filter((s)=>n.has(s)))}else if(r.name==="internal:or"){let i=this.querySelectorAll(r.body.parsed,t);n=new Set(Dn(new Set([...n,...i])))}else if(ti.includes(r.name))n=this._queryLayoutSelector(n,r,t);else{let i=new Set;for(let s of n){let a=this._queryEngineAll(r,s);for(let o of a)i.add(o)}n=i}return[...n]}finally{this._evaluator.end()}}_queryEngineAll(e,t){let n=this._engines.get(e.name).queryAll(t,e.body);for(let r of n)if(!("nodeName"in r))throw this.createStacklessError(`Expected a Node but got ${Object.prototype.toString.call(r)}`);return n}_createAttributeEngine(e,t){let n=(r)=>{return[{simples:[{selector:{css:`[${e}=${JSON.stringify(r)}]`,functions:[]},combinator:""}]}]};return{queryAll:(r,i)=>{return this._evaluator.query({scope:r,pierceShadow:t},n(i))}}}_createCSSEngine(){return{queryAll:(e,t)=>{return this._evaluator.query({scope:e,pierceShadow:!0},t)}}}_createTextEngine(e,t){return{queryAll:(r,i)=>{let{matcher:s,kind:a}=Xt(i,t),o=[],l=null,c=(u)=>{if(a==="lax"&&l&&l.contains(u))return!1;let f=Re(this._evaluator._cacheText,u,s);if(f==="none")l=u;if(f==="self"||f==="selfAndChildren"&&a==="strict"&&!t)o.push(u)};if(r.nodeType===Node.ELEMENT_NODE)c(r);let h=this._evaluator._queryCSS({scope:r,pierceShadow:e},"*");for(let u of h)c(u);return o}}}_createInternalHasTextEngine(){return{queryAll:(e,t)=>{if(e.nodeType!==1)return[];let n=e,r=P(this._evaluator._cacheText,n),{matcher:i}=Xt(t,!0);return i(r)?[n]:[]}}}_createInternalHasNotTextEngine(){return{queryAll:(e,t)=>{if(e.nodeType!==1)return[];let n=e,r=P(this._evaluator._cacheText,n),{matcher:i}=Xt(t,!0);return i(r)?[]:[n]}}}_createInternalLabelEngine(){return{queryAll:(e,t)=>{let{matcher:n}=Xt(t,!0);return this._evaluator._queryCSS({scope:e,pierceShadow:!0},"*").filter((i)=>{return jt(this._evaluator._cacheText,i).some((s)=>n(s))})}}}_createNamedAttributeEngine(){return{queryAll:(t,n)=>{let r=se(n,!0);if(r.name||r.attributes.length!==1)throw Error("Malformed attribute selector: "+n);let{name:i,value:s,caseSensitive:a}=r.attributes[0],o=a?null:s.toLowerCase(),l;if(s instanceof RegExp)l=(h)=>!!h.match(s);else if(a)l=(h)=>h===s;else l=(h)=>h.toLowerCase().includes(o);return this._evaluator._queryCSS({scope:t,pierceShadow:!0},`[${i}]`).filter((h)=>l(h.getAttribute(i)))}}}_createDescribeEngine(){return{queryAll:(t)=>{if(t.nodeType!==1)return[];return[t]}}}_createControlEngine(){return{queryAll(e,t){if(t==="enter-frame")return[];if(t==="return-empty")return[];if(t==="component"){if(e.nodeType!==1)return[];return[e.childElementCount===1?e.firstElementChild:e]}throw Error(`Internal error, unknown internal:control selector ${t}`)}}}_createHasEngine(){return{queryAll:(t,n)=>{if(t.nodeType!==1)return[];return this.querySelector(n.parsed,t,!1)?[t]:[]}}}_createHasNotEngine(){return{queryAll:(t,n)=>{if(t.nodeType!==1)return[];return this.querySelector(n.parsed,t,!1)?[]:[t]}}}_createVisibleEngine(){return{queryAll:(t,n)=>{if(t.nodeType!==1)return[];let r=n==="true";return B(t)===r?[t]:[]}}}_createInternalChainEngine(){return{queryAll:(t,n)=>{return this.querySelectorAll(n.parsed,t)}}}extend(e,t){return new(this.window.eval(`
    (() => {
      const module = {};
      ${e}
      return module.exports.default();
    })()`))(this,t)}async viewportRatio(e){return await new Promise((t)=>{let n=new IntersectionObserver((r)=>{t(r[0].intersectionRatio),n.disconnect()});n.observe(e),this.utils.builtins.requestAnimationFrame(()=>{})})}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 r=e;r;r=R(r))if(t.getComputedStyle(r).transform!=="none")return"transformed";let n=t.getComputedStyle(e);return{left:parseInt(n.borderLeftWidth||"",10)+parseInt(n.paddingLeft||"",10),top:parseInt(n.borderTopWidth||"",10)+parseInt(n.paddingTop||"",10)}}retarget(e,t){let n=e.nodeType===Node.ELEMENT_NODE?e:e.parentElement;if(!n)return null;if(t==="none")return n;if(!n.matches("input, textarea, select")&&!n.isContentEditable)if(t==="button-link")n=n.closest("button, [role=button], a, [role=link]")||n;else n=n.closest("button, [role=button], [role=checkbox], [role=radio]")||n;if(t==="follow-label"){if(!n.matches("a, input, textarea, button, select, [role=link], [role=button], [role=checkbox], [role=radio]")&&!n.isContentEditable){let r=n.closest("label");if(r&&r.control)n=r.control}}return n}async checkElementStates(e,t){if(t.includes("stable")){let n=await this._checkElementIsStable(e);if(n===!1)return{missingState:"stable"};if(n==="error:notconnected")return"error:notconnected"}for(let n of t)if(n!=="stable"){let r=this.elementState(e,n);if(r.received==="error:notconnected")return"error:notconnected";if(!r.matches)return{missingState:n}}}async _checkElementIsStable(e){let t=Symbol("continuePolling"),n,r=0,i=0,s=()=>{let h=this.retarget(e,"no-follow-label");if(!h)return"error:notconnected";let u=this.utils.builtins.performance.now();if(this._stableRafCount>1&&u-i<15)return t;i=u;let f=h.getBoundingClientRect(),x={x:f.top,y:f.left,width:f.width,height:f.height};if(n){if(!(x.x===n.x&&x.y===n.y&&x.width===n.width&&x.height===n.height))return!1;if(++r>=this._stableRafCount)return!0}return n=x,t},a,o,l=new Promise((h,u)=>{a=h,o=u}),c=()=>{try{let h=s();if(h!==t)a(h);else this.utils.builtins.requestAnimationFrame(c)}catch(h){o(h)}};return this.utils.builtins.requestAnimationFrame(c),l}_createAriaRefEngine(){return{queryAll:(t,n)=>{let r=this._lastAriaSnapshotForQuery?.elements?.get(n);return r&&r.isConnected?[r]:[]}}}elementState(e,t){let n=this.retarget(e,["visible","hidden"].includes(t)?"none":"follow-label");if(!n||!n.isConnected){if(t==="hidden")return{matches:!0,received:"hidden"};return{matches:!1,received:"error:notconnected"}}if(t==="visible"||t==="hidden"){let r=B(n);return{matches:t==="visible"?r:!r,received:r?"visible":"hidden"}}if(t==="disabled"||t==="enabled"){let r=J(n);return{matches:t==="disabled"?r:!r,received:r?"disabled":"enabled"}}if(t==="editable"){let r=J(n),i=nt(n);if(i==="error")throw this.createStacklessError("Element is not an <input>, <textarea>, <select> or [contenteditable] and does not have a role allowing [aria-readonly]");return{matches:!r&&!i,received:r?"disabled":i?"readOnly":"editable"}}if(t==="checked"||t==="unchecked"){let r=t==="checked",i=tt(n);if(i==="error")throw this.createStacklessError("Not a checkbox or radio button");let s=n.nodeName==="INPUT"&&n.type==="radio";return{matches:r===i,received:i?"checked":"unchecked",isRadio:s}}if(t==="indeterminate"){let r=qr(n);if(r==="error")throw this.createStacklessError("Not a checkbox or radio button");return{matches:r==="mixed",received:r===!0?"checked":r===!1?"unchecked":"mixed"}}throw this.createStacklessError(`Unexpected element state "${t}"`)}selectOptions(e,t){let n=this.retarget(e,"follow-label");if(!n)return"error:notconnected";if(n.nodeName.toLowerCase()!=="select")throw this.createStacklessError("Element is not a <select> element");let r=n,i=[...r.options],s=[],a=t.slice();for(let o=0;o<i.length;o++){let l=i[o],c=A(l.label),h=(u)=>{if(u instanceof Node)return l===u;let f=(d)=>d===l.label||A(d)===c,x=!0;if(u.valueOrLabel!==void 0)x=x&&(u.valueOrLabel===l.value||f(u.valueOrLabel));if(u.value!==void 0)x=x&&u.value===l.value;if(u.label!==void 0)x=x&&f(u.label);if(u.index!==void 0)x=x&&u.index===o;return x};if(!a.some(h))continue;if(!this.elementState(l,"enabled").matches)return"error:optionnotenabled";if(s.push(l),r.multiple)a=a.filter((u)=>!h(u));else{a=[];break}}if(a.length)return"error:optionsnotfound";return r.value=void 0,s.forEach((o)=>o.selected=!0),r.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),r.dispatchEvent(new Event("change",{bubbles:!0})),s.map((o)=>o.value)}fill(e,t){let n=this.retarget(e,"follow-label");if(!n)return"error:notconnected";if(n.nodeName.toLowerCase()==="input"){let r=n,i=r.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"){if(t=t.trim(),isNaN(Number(t)))throw this.createStacklessError("Cannot type text into input[type=number]")}if(i==="color")t=t.toLowerCase();if(s.has(i)){if(t=t.trim(),r.focus(),r.value=t,r.value!==t)throw this.createStacklessError("Malformed value");return n.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),n.dispatchEvent(new Event("change",{bubbles:!0})),"done"}}else if(n.nodeName.toLowerCase()==="textarea");else if(!n.isContentEditable)throw this.createStacklessError("Element is not an <input>, <textarea> or [contenteditable] element");return this.selectText(n),"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"}t.focus();let n=t.ownerDocument.createRange();n.selectNodeContents(t);let r=t.ownerDocument.defaultView.getSelection();if(r)r.removeAllRanges(),r.addRange(n);return"done"}_activelyFocused(e){let t=e.getRootNode().activeElement,n=t===e&&!!e.ownerDocument&&e.ownerDocument.hasFocus();return{activeElement:t,isFocused:n}}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:n,isFocused:r}=this._activelyFocused(e);if(e.isContentEditable&&!r&&n&&n.blur)n.blur();if(e.focus(),e.focus(),t&&!r&&e.nodeName.toLowerCase()==="input")try{e.setSelectionRange(0,0)}catch(i){}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 n=e;if(n.nodeName!=="INPUT")return"Not an <input> element";let r=n;if((r.getAttribute("type")||"").toLowerCase()!=="file")return"Not an input[type=file] element";let s=t.map((o)=>{let l=Uint8Array.from(atob(o.buffer),(c)=>c.charCodeAt(0));return new File([l],o.name,{type:o.mimeType,lastModified:o.lastModifiedMs})}),a=new DataTransfer;for(let o of s)a.items.add(o);r.files=a.files,r.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),r.dispatchEvent(new Event("change",{bubbles:!0}))}expectHitTarget(e,t){let n=[],r=t;while(r){let c=Mt(r);if(!c)break;if(n.push(c),c.nodeType===9)break;r=c.host}let i;for(let c=n.length-1;c>=0;c--){let h=n[c],u=h.elementsFromPoint(e.x,e.y),f=h.elementFromPoint(e.x,e.y);if(f&&u[0]&&R(f)===u[0]){if(this.window.getComputedStyle(f)?.display==="contents")u.unshift(f)}if(u[0]&&u[0].shadowRoot===h&&u[1]===f)u.shift();let x=u[0];if(!x)break;if(i=x,c&&x!==n[c-1].host)break}let s=[];while(i&&i!==t)s.push(i),i=i.assignedSlot??R(i);if(i===t)return"done";let a=this.previewNode(s[0]||this.document.documentElement),o,l=t;while(l){let c=s.indexOf(l);if(c!==-1){if(c>1)o=this.previewNode(s[c-1]);break}l=R(l)}if(o)return{hitTargetDescription:`${a} from ${o} subtree`};return{hitTargetDescription:a}}setupHitTargetInterceptor(e,t,n,r){let i=this.retarget(e,"button-link");if(!i||!i.isConnected)return"error:notconnected";if(n){let c=this.expectHitTarget(n,i);if(c!=="done")return c.hitTargetDescription}if(t==="drag")return{stop:()=>"done"};let s={hover:this._hoverHitTargetInterceptorEvents,tap:this._tapHitTargetInterceptorEvents,mouse:this._mouseHitTargetInterceptorEvents}[t],a,o=(c)=>{if(!s.has(c.type))return;if(!c.isTrusted)return;let h=!!this.window.TouchEvent&&c instanceof this.window.TouchEvent?c.touches[0]:c;if(a===void 0&&h)a=this.expectHitTarget({x:h.clientX,y:h.clientY},i);if(r||a!=="done"&&a!==void 0)c.preventDefault(),c.stopPropagation(),c.stopImmediatePropagation()},l=()=>{if(this._hitTargetInterceptor===o)this._hitTargetInterceptor=void 0;return a||"done"};return this._hitTargetInterceptor=o,{stop:l}}dispatchEvent(e,t,n){let r,i={bubbles:!0,cancelable:!0,composed:!0,...n};switch(this._eventTypes.get(t)){case"mouse":r=new MouseEvent(t,i);break;case"keyboard":r=new KeyboardEvent(t,i);break;case"touch":{if(this._browserName==="webkit"){let s=(o)=>{if(o instanceof Touch)return o;let l=o.pageX;if(l===void 0&&o.clientX!==void 0)l=o.clientX+(this.document.scrollingElement?.scrollLeft||0);let c=o.pageY;if(c===void 0&&o.clientY!==void 0)c=o.clientY+(this.document.scrollingElement?.scrollTop||0);return this.document.createTouch(this.window,o.target??e,o.identifier,l,c,o.screenX,o.screenY,o.radiusX,o.radiusY,o.rotationAngle,o.force)},a=(o)=>{if(o instanceof TouchList||!o)return o;return this.document.createTouchList(...o.map(s))};i.target??=e,i.touches=a(i.touches),i.targetTouches=a(i.targetTouches),i.changedTouches=a(i.changedTouches),r=new TouchEvent(t,i)}else i.target??=e,i.touches=i.touches?.map((s)=>s instanceof Touch?s:new Touch({...s,target:s.target??e})),i.targetTouches=i.targetTouches?.map((s)=>s instanceof Touch?s:new Touch({...s,target:s.target??e})),i.changedTouches=i.changedTouches?.map((s)=>s instanceof Touch?s:new Touch({...s,target:s.target??e})),r=new TouchEvent(t,i);break}case"pointer":r=new PointerEvent(t,i);break;case"focus":r=new FocusEvent(t,i);break;case"drag":r=new DragEvent(t,i);break;case"wheel":r=new WheelEvent(t,i);break;case"deviceorientation":try{r=new DeviceOrientationEvent(t,i)}catch{let{bubbles:s,cancelable:a,alpha:o,beta:l,gamma:c,absolute:h}=i;r=this.document.createEvent("DeviceOrientationEvent"),r.initDeviceOrientationEvent(t,s,a,o,l,c,h)}break;case"devicemotion":try{r=new DeviceMotionEvent(t,i)}catch{let{bubbles:s,cancelable:a,acceleration:o,accelerationIncludingGravity:l,rotationRate:c,interval:h}=i;r=this.document.createEvent("DeviceMotionEvent"),r.initDeviceMotionEvent(t,s,a,o,l,c,h)}break;default:r=new Event(t,i);break}e.dispatchEvent(r)}previewNode(e){if(e.nodeType===Node.TEXT_NODE)return Kt(`#text=${e.nodeValue||""}`);if(e.nodeType!==Node.ELEMENT_NODE)return Kt(`<${e.nodeName.toLowerCase()} />`);let t=e,n=[];for(let o=0;o<t.attributes.length;o++){let{name:l,value:c}=t.attributes[o];if(l==="style")continue;if(!c&&this._booleanAttributes.has(l))n.push(` ${l}`);else n.push(` ${l}="${c}"`)}n.sort((o,l)=>o.length-l.length);let r=cn(n.join(""),500);if(this._autoClosingTags.has(t.nodeName))return Kt(`<${t.nodeName.toLowerCase()}${r}/>`);let i=t.childNodes,s=!1;if(i.length<=5){s=!0;for(let o=0;o<i.length;o++)s=s&&i[o].nodeType===Node.TEXT_NODE}let a=s?t.textContent||"":i.length?"…":"";return Kt(`<${t.nodeName.toLowerCase()}${r}>${cn(a,50)}</${t.nodeName.toLowerCase()}>`)}_generateSelectors(e){this._evaluator.begin(),oe(),Ae();try{let t=this._isUtilityWorld&&this._browserName==="firefox"?2:10;return e.slice(0,t).map((r)=>({preview:this.previewNode(r),selector:this.generateSelectorSimple(r)})).map((r,i)=>`${i+1}) ${r.preview} aka ${te(this._sdkLanguage,r.selector)}`)}finally{_e(),ae(),this._evaluator.end()}}strictModeViolationError(e,t){let n=this._generateSelectors(t).map((r)=>`
    `+r);if(n.length<t.length)n.push(`
    ...`);return this.createStacklessError(`strict mode violation: ${te(this._sdkLanguage,F(e))} resolved to ${t.length} elements:${n.join("")}
`)}checkDeprecatedSelectorUsage(e,t){let n=new Set(["_react","_vue","xpath:light","text:light","id:light","data-testid:light","data-test-id:light","data-test:light"]);if(!t.length)return;let r=e.parts.find((s)=>n.has(s.name));if(!r)return;let i=this._generateSelectors(t).map((s)=>`
    `+s);if(i.length<t.length)i.push(`
    ...`);throw this.createStacklessError(`"${r.name}" selector is not supported: ${te(this._sdkLanguage,F(e))} resolved to ${t.length} element${t.length===1?"":"s"}:${i.join("")}
`)}createStacklessError(e){if(this._browserName==="firefox"){let n=Error("Error: "+e);return n.stack="",n}let t=Error(e);return delete t.stack,t}createHighlight(){return new ot(this)}maskSelectors(e,t){let n=this._createHighlight(),r=[];for(let i of e)r.push(this.querySelectorAll(i,this.document.documentElement));n.maskElements(r.flat(),t)}_createHighlight(){if(this._highlight)this.hideHighlight();return this._highlight=new ot(this),this._highlight.install(),this._highlight}_ensureHighlight(){if(!this._highlight)this._highlight=new ot(this),this._highlight.install();return this._highlight}addHighlight(e,t){this._ensureHighlight().addElementHighlight(e,t)}removeHighlight(e){this._ensureHighlight().removeElementHighlight(e)}setScreencastAnnotation(e){let t=this._ensureHighlight();if(!e){t.updateHighlight([]),t.hideActionPoint(),t.hideActionTitle();return}let n=e.duration??500;if(e.box)t.updateHighlight([{box:e.box,color:"rgba(0, 128, 255, 0.15)",borderColor:"rgba(0, 128, 255, 0.6)",fadeDuration:n}]);if(e.point)t.showActionPoint(e.point.x,e.point.y,n);if(e.actionTitle)t.showActionTitle(e.actionTitle,n,e.position,e.fontSize)}addUserOverlay(e,t){this._ensureHighlight().addUserOverlay(e,t)}getUserOverlay(e){return this._ensureHighlight().getUserOverlay(e)}removeUserOverlay(e){this._ensureHighlight().removeUserOverlay(e)}setUserOverlaysVisible(e){this._ensureHighlight().setUserOverlaysVisible(e)}hideHighlight(){if(this._highlight)this._highlight.uninstall(),delete this._highlight}markTargetElements(e,t){if(this._markedElements?.callId!==t)this._markedElements=void 0;let n=this._markedElements?.elements||new Set,r=new CustomEvent("__playwright_unmark_target__",{bubbles:!0,cancelable:!0,detail:t,composed:!0});for(let s of n)if(!e.has(s))s.dispatchEvent(r);let i=new CustomEvent("__playwright_mark_target__",{bubbles:!0,cancelable:!0,detail:t,composed:!0});for(let s of e)if(!n.has(s))s.dispatchEvent(i);this._markedElements={callId:t,elements:e}}_setupGlobalListenersRemovalDetection(){let t=!1,n=()=>t=!0;this.window.addEventListener("__playwright_global_listeners_check__",n),new MutationObserver((r)=>{if(!r.some((s)=>Array.from(s.addedNodes).includes(this.document.documentElement)))return;if(t=!1,this.window.dispatchEvent(new CustomEvent("__playwright_global_listeners_check__")),t)return;this.window.addEventListener("__playwright_global_listeners_check__",n);for(let s of this.onGlobalListenersRemoved)s()}).observe(this.document,{childList:!0})}_setupHitTargetInterceptors(){let e=(n)=>this._hitTargetInterceptor?.(n),t=()=>{for(let n of this._allHitTargetInterceptorEvents)this.window.addEventListener(n,e,{capture:!0,passive:!1})};t(),this.onGlobalListenersRemoved.add(t)}async expect(e,t,n){if(t.expression==="to.have.count"||t.expression.endsWith(".array"))return this.expectArray(n,t);if(!e){if(!t.isNot&&t.expression==="to.be.hidden")return{matches:!0};if(t.isNot&&t.expression==="to.be.visible")return{matches:!1};if(!t.isNot&&t.expression==="to.be.detached")return{matches:!0};if(t.isNot&&t.expression==="to.be.attached")return{matches:!1};if(t.isNot&&t.expression==="to.be.in.viewport")return{matches:!1};if(t.expression==="to.have.title"&&t?.expectedText?.[0]){let i=new ge(t.expectedText[0]),s=this.document.title;return{received:s,matches:i.matches(s)}}if(t.expression==="to.have.url"&&t?.expectedText?.[0]){let i=new ge(t.expectedText[0]),s=this.document.location.href;return{received:s,matches:i.matches(s)}}if(t.expression==="to.match.aria"&&!t.selector){if(!this.document.body)return{matches:t.isNot,missingReceived:!0};let i=In(this.document.body,t.expectedValue);return{received:i.received,matches:!!i.matches.length}}return{matches:t.isNot,missingReceived:!0}}return await this.expectSingleElement(e,t)}async expectSingleElement(e,t){let n=t.expression;{let r;if(n==="to.have.attribute"){let i=e.hasAttribute(t.expressionArg);r={matches:i,received:i?"attribute present":"attribute not present"}}else if(n==="to.be.checked"){let{checked:i,indeterminate:s}=t.expectedValue;if(s){if(i!==void 0)throw this.createStacklessError("Can't assert indeterminate and checked at the same time");r=this.elementState(e,"indeterminate")}else r=this.elementState(e,i===!1?"unchecked":"checked")}else if(n==="to.be.disabled")r=this.elementState(e,"disabled");else if(n==="to.be.editable")r=this.elementState(e,"editable");else if(n==="to.be.readonly")r=this.elementState(e,"editable"),r.matches=!r.matches;else if(n==="to.be.empty")if(e.nodeName==="INPUT"||e.nodeName==="TEXTAREA"){let i=e.value;r={matches:!i,received:i?"notEmpty":"empty"}}else{let i=e.textContent?.trim();r={matches:!i,received:i?"notEmpty":"empty"}}else if(n==="to.be.enabled")r=this.elementState(e,"enabled");else if(n==="to.be.focused"){let i=this._activelyFocused(e).isFocused;r={matches:i,received:i?"focused":"inactive"}}else if(n==="to.be.hidden")r=this.elementState(e,"hidden");else if(n==="to.be.visible")r=this.elementState(e,"visible");else if(n==="to.be.attached")r={matches:!0,received:"attached"};else if(n==="to.be.detached")r={matches:!1,received:"attached"};if(r){if(r.received==="error:notconnected")throw this.createStacklessError("Element is not connected");return r}}if(n==="to.have.property"){let r=e,i=t.expressionArg.split(".");for(let o=0;o<i.length-1;o++){if(typeof r!=="object"||!(i[o]in r))return{received:void 0,matches:!1};r=r[i[o]]}let s=r[i[i.length-1]],a=Yn(s,t.expectedValue);return{received:s,matches:a}}if(n==="to.be.in.viewport"){let r=await this.viewportRatio(e);return{received:`viewport ratio ${r}`,matches:r>0&&r>(t.expectedNumber??0)-0.000000001}}if(n==="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 r=[...e.selectedOptions].map((i)=>i.value);if(r.length!==t.expectedText.length)return{received:r,matches:!1};return{received:r,matches:r.map((i,s)=>new ge(t.expectedText[s]).matches(i)).every(Boolean)}}if(n==="to.match.aria"){let r=In(e,t.expectedValue);return{received:r.received,matches:!!r.matches.length}}{let r;if(n==="to.have.attribute.value"){let i=e.getAttribute(t.expressionArg);if(i===null)return{received:null,matches:!1};r=i}else if(["to.have.class","to.contain.class"].includes(n)){if(!t.expectedText)throw this.createStacklessError("Expected text is not provided for "+n);return{received:e.classList.toString(),matches:new ge(t.expectedText[0]).matchesClassList(this,e.classList,n==="to.contain.class")}}else if(n==="to.have.css")r=this.window.getComputedStyle(e,t.pseudo?`::${t.pseudo}`:void 0).getPropertyValue(t.expressionArg);else if(n==="to.have.id")r=e.id;else if(n==="to.have.text")r=t.useInnerText?e.innerText:P(new Map,e).full;else if(n==="to.have.accessible.name")r=G(e,!1);else if(n==="to.have.accessible.description")r=bn(e,!1);else if(n==="to.have.accessible.error.message")r=Hr(e);else if(n==="to.have.role")r=T(e)||"";else if(n==="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");r=e.value}if(r!==void 0&&t.expectedText){let i=new ge(t.expectedText[0]);return{received:r,matches:i.matches(r)}}}throw this.createStacklessError("Unknown expect matcher: "+n)}expectArray(e,t){let n=t.expression;if(n==="to.have.count"){let o=e.length,l=o===t.expectedNumber;return{received:o,matches:l}}if(!t.expectedText)throw this.createStacklessError("Expected text is not provided for "+n);if(["to.have.class.array","to.contain.class.array"].includes(n)){let o=e.map((h)=>h.classList),l=o.map(String);if(o.length!==t.expectedText.length)return{received:l,matches:!1};let c=this._matchSequentially(t.expectedText,o,(h,u)=>h.matchesClassList(this,u,n==="to.contain.class.array"));return{received:l,matches:c}}if(!["to.contain.text.array","to.have.text.array"].includes(n))throw this.createStacklessError("Unknown expect matcher: "+n);let r=e.map((o)=>t.useInnerText?o.innerText:P(new Map,o).full),i=n!=="to.contain.text.array";if(!(r.length===t.expectedText.length||!i))return{received:r,matches:!1};let a=this._matchSequentially(t.expectedText,r,(o,l)=>o.matches(l));return{received:r,matches:a}}_matchSequentially(e,t,n){let r=e.map((a)=>new ge(a)),i=0,s=0;while(i<r.length&&s<t.length){if(n(r[i],t[s]))++i;++s}return i===r.length}}function Kt(e){return e.replace(/\n/g,"↵").replace(/\t/g,"⇆")}function fo(e){if(e=e.substring(1,e.length-1),!e.includes("\\"))return e;let t=[],n=0;while(n<e.length){if(e[n]==="\\"&&n+1<e.length)n++;t.push(e[n++])}return t.join("")}function Xt(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:(a)=>s.test(a.full),kind:"regex"}}let n=t?JSON.parse.bind(JSON):fo,r=!1;if(e.length>1&&e[0]==='"'&&e[e.length-1]==='"')e=n(e),r=!0;else if(t&&e.length>1&&e[0]==='"'&&e[e.length-2]==='"'&&e[e.length-1]==="i")e=n(e.substring(0,e.length-1)),r=!1;else if(t&&e.length>1&&e[0]==='"'&&e[e.length-2]==='"'&&e[e.length-1]==="s")e=n(e.substring(0,e.length-1)),r=!0;else if(e.length>1&&e[0]==="'"&&e[e.length-1]==="'")e=n(e),r=!0;if(e=A(e),r){if(t)return{kind:"strict",matcher:(s)=>s.normalized===e};return{matcher:(s)=>{if(!e&&!s.immediate.length)return!0;return s.immediate.some((a)=>A(a)===e)},kind:"strict"}}return e=e.toLowerCase(),{kind:"lax",matcher:(i)=>i.normalized.toLowerCase().includes(e)}}class ge{_string;_substring;_regex;_normalizeWhiteSpace;_ignoreCase;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(""));if(e.ignoreCase===!1)t.delete("i");if(e.ignoreCase===!0)t.add("i");this._regex=new RegExp(e.regexSource,[...t].join(""))}}matches(e){if(!this._regex)e=this.normalize(e);if(this._string!==void 0)return e===this._string;if(this._substring!==void 0)return e.includes(this._substring);if(this._regex)return!!this._regex.test(e);return!1}matchesClassList(e,t,n){if(n){if(this._regex)throw e.createStacklessError("Partial matching does not support regular expressions. Please provide a string value.");return this._string.split(/\s+/g).filter(Boolean).every((r)=>t.contains(r))}return this.matches(t.toString())}normalize(e){if(!e)return e;if(this._normalizeWhiteSpace)e=A(e);if(this._ignoreCase)e=e.toLocaleLowerCase();return e}}function Yn(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 r=0;r<e.length;++r)if(!Yn(e[r],t[r]))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 n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r=0;r<n.length;++r)if(!t.hasOwnProperty(n[r]))return!1;for(let r of n)if(!Yn(e[r],t[r]))return!1;return!0}if(typeof e==="number"&&typeof t==="number")return isNaN(e)&&isNaN(t);return!1}var D=new Qn(window,{isUnderTest:!1,sdkLanguage:"javascript",testIdAttributeName:"data-testid",stableRafCount:2,browserName:"chromium",customEngines:[]});function dt(e,t){let n=e.map((r)=>{let{engine:i,body:s}=r,a=s.startsWith('"')&&s.endsWith('"'),o=a?s.slice(1,-1):s;switch(i){case"text":return`internal:text=${I(o,a)}`;case"label":return`internal:label=${I(o,a)}`;case"placeholder":return`internal:attr=[placeholder=${O(o,a)}]`;case"alt":return`internal:attr=[alt=${O(o,a)}]`;case"title":return`internal:attr=[title=${O(o,a)}]`;case"testid":return`internal:testid=[data-testid=${O(o,!0)}]`;case"role":return`internal:role=${s}`;case"has":return`internal:has="${s.replace(/"/g,"\\\"")}"`;case"has-not":return`internal:has-not="${s.replace(/"/g,"\\\"")}"`;case"has-text":return`internal:has-text=${I(o,a)}`;case"has-not-text":return`internal:has-not-text=${I(o,a)}`;case"internal:text":case"internal:label":case"internal:attr":case"internal:testid":case"internal:role":case"internal:has":case"internal:has-not":case"internal:has-text":case"internal:has-not-text":case"internal:and":case"internal:or":return`${i}=${s}`;default:return`${i}=${s}`}}).join(" >> ");try{let r=D.parseSelector(n);return D.querySelectorAll(r,t)}catch{let r=t===document?[document.documentElement]:[t];for(let i of e){if(i.engine==="nth"){let o=parseInt(i.body,10);r=o>=0&&o<r.length?[r[o]]:[];continue}let s=[],a=new Set;for(let o of r){let l=[];try{if(i.engine==="css")l=[...o.querySelectorAll(i.body)];else if(i.engine==="xpath"){let h=(o.ownerDocument||document).evaluate(i.body.startsWith("/")?"."+i.body:i.body,o,null,XPathResult.ORDERED_NODE_ITERATOR_TYPE);for(let u=h.iterateNext();u;u=h.iterateNext())if(u.nodeType===Node.ELEMENT_NODE)l.push(u)}else if(i.engine==="id"){let c=document.getElementById(i.body);if(c)l=[c]}}catch{}for(let c of l)if(!a.has(c))a.add(c),s.push(c)}r=s}return r}}function Ci(e,t){let n=D.elementState(e,t);if(typeof n==="object"&&n!==null&&"matches"in n)return n.matches;return n}function po(e,t){for(let n of t){let r=Ci(e,n);if(r==="error:notconnected")return"error:notconnected";if(!r)return`error:not${n}`}return"done"}function Ii(e){if(!e.isConnected)return{actionable:!1,reason:"notconnected"};if(!B(e))return{actionable:!1,reason:"notvisible"};if(J(e))return{actionable:!1,reason:"disabled"};return{actionable:!0}}function go(e,t){return D.expectHitTarget(e,t)}function mo(e,t,n="mouse"){let r=window;if(r.__fd&&r.__fd._hitInterceptor){try{r.__fd._hitInterceptor.stop()}catch{}r.__fd._hitInterceptor=null}let i=D.setupHitTargetInterceptor(e,n,t,!1);if(typeof i==="string")return i;if(i==="error:notconnected")return i;return r.__fd._hitInterceptor=i,"ok"}function bo(){let e=window,t=e.__fd&&e.__fd._hitInterceptor;if(!t)return"done";return e.__fd._hitInterceptor=null,t.stop()}function Ri(e){let t=e.tagName?.toUpperCase();if(t==="SELECT")return"select";if(t==="INPUT"&&e.type==="file")return"file";return""}function xo(e,t){let n=Ri(e);if(n)return{guard:n,actionable:!1,point:null};let r=Ii(e);if(!r.actionable)return{guard:"",actionable:!1,reason:r.reason,point:null};if(typeof e.scrollIntoViewIfNeeded==="function")e.scrollIntoViewIfNeeded();else e.scrollIntoView({block:"center",inline:"center"});let i=e.getBoundingClientRect(),s=t?i.x+t.x:i.x+i.width/2,a=t?i.y+t.y:i.y+i.height/2,o=e.ownerDocument.defaultView;while(o&&o!==o.parent&&o.frameElement){let l=o.frameElement.getBoundingClientRect();s+=l.x,a+=l.y,o=o.parent}return{guard:"",actionable:!0,point:{x:s,y:a}}}function Eo(e,t){if(e.focus(),e.value="",t!==void 0)e.value=t;e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0}))}function So(e){e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0}))}function yo(e,t){return D.fill(e,t)}function wo(e,...t){return D.selectOptions(e,t)}function To(e){return{options:[...e.options].map((t,n)=>({index:n,text:(t.textContent||"").trim(),value:t.value,selected:t.selected}))}}function vo(e,t){let r=[...e.options].find((i)=>i.value===t||_i(i.textContent||"")===_i(t));if(!r)return{selected:!1,error:"Option not found"};return e.value=r.value,e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0})),{selected:!0,value:r.value}}function Ao(e){D.focusNode(e,!1)}function _o(e){D.blurNode(e)}function No(e){D.selectText(e)}function Lo(e,t){return D.setInputFiles(e,t)}function _i(e){return(e||"").replace(/[\u200b\u00ad]/g,"").trim().replace(/\s+/g," ")}function ki(e){e=e||document;let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);while(n.nextNode()){let r=n.currentNode;if(t.push(r),r.shadowRoot){let i=ki(r.shadowRoot);t.push(...i)}}return t}function Co(e,t,n,r,i,s){let a;try{a=t?new RegExp(e,n?"g":"gi"):new RegExp(e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n?"g":"gi")}catch{return JSON.stringify({error:"Invalid pattern"})}let l=(i?document.querySelector(i)||document.body:document.body).innerText||"",c=[],h;while((h=a.exec(l))&&c.length<s){let u=Math.max(0,h.index-r),f=Math.min(l.length,h.index+h[0].length+r);c.push({match_text:h[0],context:l.slice(u,f),element_path:"",char_position:h.index})}return JSON.stringify({total:c.length,has_more:!1,matches:c})}function Io(e,t,n,r){try{let i=[...document.querySelectorAll(e)].slice(0,n);return JSON.stringify(i.map((s,a)=>{let o={index:a,tag:s.tagName.toLowerCase()};for(let l of t){let c=s.getAttribute(l);if(c!==null)o[l]=c}if(r)o.text=(s.textContent||"").trim().slice(0,200);return o}))}catch(i){return JSON.stringify({error:i.message})}}function Ro(){return JSON.stringify({scrollY:window.scrollY,scrollHeight:document.documentElement.scrollHeight,viewportHeight:window.innerHeight})}function ko(){let e=[...document.querySelectorAll("[id]")].map((n)=>n.id).filter(Boolean).slice(0,50),t=[...document.querySelectorAll("input,textarea,select,button,a")].map((n)=>{let r=n.tagName.toLowerCase(),i=n.id?`#${n.id}`:"",s=n.getAttribute("name")?`[name="${n.getAttribute("name")}"]`:"",a=n.getAttribute("type")?`[type="${n.getAttribute("type")}"]`:"";return`${r}${i}${s}${a}`}).slice(0,50);return JSON.stringify({ids:e,inputs:t})}var Ni=0,Li=!1;function Oo(){if(!Li){Li=!0;let e=console.error;console.error=function(...t){Ni++,e.apply(console,t)}}return Ni}function Mo(e,t){return new Promise((n)=>{let r=Date.now()+t,i=null,s=0;function a(){if(Date.now()>=r){n("timeout");return}if(!e.isConnected){n("detached");return}if(!B(e)){setTimeout(a,50);return}if(J(e)){setTimeout(a,50);return}let o=e.getBoundingClientRect();if(i&&o.x===i.x&&o.y===i.y&&o.width===i.width&&o.height===i.height){if(++s>=2){n("done");return}}else s=0;i=o,requestAnimationFrame(a)}requestAnimationFrame(a)})}function $o(){let e=document.body.cloneNode(!0);e.querySelectorAll("script,style,noscript,svg,iframe").forEach((n)=>n.remove());function t(n){if(n.nodeType===3)return(n.textContent||"").replace(/\s+/g," ");if(n.nodeType!==1)return"";let r=n,i=r.tagName.toLowerCase(),s=[...r.childNodes].map(t).join("");if(/^h[1-6]$/.test(i))return`
`+"#".repeat(parseInt(i[1]))+" "+s.trim()+`
`;if(i==="p"||i==="div")return`
`+s.trim()+`
`;if(i==="br")return`
`;if(i==="li")return"- "+s.trim()+`
`;if(i==="a")return`[${s.trim()}](${r.getAttribute("href")||""})`;if(i==="strong"||i==="b")return`**${s.trim()}**`;if(i==="em"||i==="i")return`*${s.trim()}*`;if(i==="code")return`\`${s.trim()}\``;if(i==="pre")return"\n```\n"+s.trim()+"\n```\n";if(i==="img")return`![${r.getAttribute("alt")||""}](${r.getAttribute("src")||""})`;return s}return t(e).replace(/\n{3,}/g,`

`).trim()}function Po(){window.alert=()=>{},window.confirm=()=>!0,window.prompt=()=>""}function Do(e){document.querySelectorAll("[data-fdref]").forEach((i)=>i.removeAttribute("data-fdref"));let t=[],n=0;function r(i,s,a){if(e>=0&&a>e)return;let o=n++,l=String(o);if(i.setAttribute)i.setAttribute("data-fdref",l);let c="";try{c=T(i)||""}catch{}if(!c){let W=i.tagName;c={A:"link",NAV:"navigation",MAIN:"main",HEADER:"banner",FOOTER:"contentinfo",ASIDE:"complementary",SECTION:"region",ARTICLE:"article",FORM:"form",TABLE:"table",THEAD:"rowgroup",TBODY:"rowgroup",TR:"row",TH:"columnheader",TD:"cell",UL:"list",OL:"list",LI:"listitem",DL:"list",DT:"term",DD:"definition",DIALOG:"dialog",DETAILS:"group",PROGRESS:"progressbar",METER:"meter",OUTPUT:"status",HR:"separator",IMG:"img",FIGURE:"figure",BLOCKQUOTE:"blockquote",PRE:"generic",CODE:"code"}[W]||""}if(!c||c==="none"||c==="presentation"){for(let W of i.children)r(W,s,a);if(i.shadowRoot)for(let W of i.shadowRoot.children)r(W,s,a);return}let h="";try{h=G(i,!1)||""}catch{}if(!h)h=i.getAttribute?.("aria-label")||i.getAttribute?.("alt")||i.getAttribute?.("title")||i.getAttribute?.("placeholder")||"";if(!h&&i.textContent)h=i.textContent.trim().substring(0,100);let u=i,f=i,x=i.getAttribute?.("aria-description")||"",d="";try{let W=tt(i);if(W===!0)d="true";else if(W===!1)d="false"}catch{}let b=!!J(i),p=!1;try{p=nt(i)}catch{}let E=0,S=i.tagName;if(/^H[1-6]$/.test(S))E=parseInt(S[1]);let w=i.getAttribute?.("aria-level");if(w)E=parseInt(w)||E;let Y=0,U=0,K=0,H="";if("valueAsNumber"in i)K=f.valueAsNumber||0,Y=parseFloat(f.min)||0,U=parseFloat(f.max)||100;let Q=i.getAttribute?.("aria-valuenow");if(Q)K=parseFloat(Q)||0;let g=i.getAttribute?.("aria-valuetext");if(g)H=g;let N="",q=i.getAttribute?.("aria-expanded");if(q==="true")N="true";else if(q==="false")N="false";let Zt=i.getAttribute?.("aria-selected")==="true"||i.selected===!0,Be=i.getAttribute?.("aria-required")==="true"||f.required===!0,me=i.href||i.getAttribute?.("href")||"",en=i.getAttribute?.("aria-keyshortcuts")||"";if(t.push({nodeId:l,parentId:s,backendId:o,role:c,name:h,ignored:!1,description:x,checked:d,disabled:b,readonly:p,level:E,valueMin:Y,valueMax:U,valueNow:K,valueText:H,expanded:N,selected:Zt,required:Be,url:me,keyShortcuts:en}),i.shadowRoot)for(let W of i.shadowRoot.children)r(W,l,a+1);for(let W of i.children)r(W,l,a+1)}return r(document.documentElement,null,0),t}if(!window.__fd)window.__fd={_injected:D,_exec:dt,sel(e){try{let t=dt(e,document);return t.forEach((n,r)=>n.setAttribute("data-fd-sel",""+r)),JSON.stringify(t.map((n,r)=>{let i=(n.textContent||"").trim();return{index:r,tag:n.tagName.toLowerCase(),text:i.length>100?i.slice(0,100)+"...":i}}))}catch(t){return JSON.stringify({error:t.message})}},selOne(e,t){let n=dt(e,document);if(t&&n.length>1)throw Error("strict mode violation: "+n.length);return n.length>0?n[0]:null},selAll(e){return dt(e,document)},selCount(e){return dt(e,document).length},parseSelector:(e)=>D.parseSelector(e),querySelector:(e,t,n)=>D.querySelector(e,t,n),querySelectorAll:(e,t)=>D.querySelectorAll(e,t),elementState:Ci,checkElementStates:po,isActionable:Ii,isVisible:B,expectHitTarget:go,installHitInterceptor:mo,finalizeHitInterceptor:bo,clearAndDispatch:Eo,dispatchInputEvents:So,clickGuard:Ri,clickPrep:xo,selectOption:vo,selectOptions:wo,getOptions:To,fill:yo,focusNode:Ao,blurNode:_o,selectText:No,setInputFiles:Lo,searchPage:Co,findElementsCSS:Io,scrollInfo:Ro,suggestSelectors:ko,consoleErrors:Oo,waitForActionable:Mo,extractMarkdown:$o,dismissDialogs:Po,allElements:ki,getAriaRole:T,getAccessibleName:G,getAriaDisabled:J,getChecked:tt,getReadonly:nt,accessibilityTree:Do,ariaSnapshot:(e,t)=>D.ariaSnapshot(e,{mode:t?.mode||"default",depth:t?.depth}),incrementalAriaSnapshot:(e,t)=>D.incrementalAriaSnapshot(e,{mode:t?.mode||"default",depth:t?.depth,refPrefix:t?.refPrefix}),markIframeByAriaRef:(e,t)=>{let n=document.querySelectorAll("iframe,frame");for(let r of n){let i=r._ariaRef;if(i&&i.ref===e)return r.setAttribute(t,e),!0}return!1},UtilityScript:qe,newUtilityScript:()=>new qe(window,!1),parseEvaluationResultValue:He,serializeAsCallArgument:Jt};})();
})()