helpyourneighbour/docs/runtime/integration_targets_helpyourneighbour.md

96 KiB

Integration Change Targets

Project: helpyourneighbour

Highest Priority Files

backend/node_modules/accepts/index.js backend/node_modules/bcryptjs/index.d.ts backend/node_modules/bcryptjs/index.js backend/node_modules/body-parser/index.js backend/node_modules/buffer-equal-constant-time/index.js backend/node_modules/bytes/index.js backend/node_modules/call-bind-apply-helpers/index.d.ts backend/node_modules/call-bind-apply-helpers/index.js backend/node_modules/call-bound/index.d.ts backend/node_modules/call-bound/index.js backend/node_modules/content-disposition/index.js backend/node_modules/content-type/index.js backend/node_modules/cookie-signature/index.js backend/node_modules/cookie/index.js backend/node_modules/denque/index.d.ts backend/node_modules/denque/index.js backend/node_modules/depd/index.js backend/node_modules/ee-first/index.js backend/node_modules/encodeurl/index.js backend/node_modules/es-define-property/index.d.ts

Relevant Runtime Notes

Integration Context Audit

Project: helpyourneighbour

package.json scripts

{ "test": "npm run test:smoke", "start": "node src/server.js", "dev": "node --watch src/server.js", "db:init": "node src/db/init.js", "db:seed": "node src/db/seed.js", "test:smoke": "node scripts/smoke-test.mjs", "test:integration": "node scripts/integration-test.mjs" }

Integration Runner

// Einfacher HTTP-Test ohne Playwright // Funktion zum Senden einer HTTP-Anfrage async function testHealthEndpoint() { try { const response = await fetch('http://localhost:3000/health'); if (response.status === 200) { console.log('Integration test passed: API server is running and healthy'); return true; } else { console.error(Integration test failed: Expected status 200, got ${response.status}); return false; } } catch (error) { console.error('Integration test failed:', error.message); return false; } }

// Führe den Test aus testHealthEndpoint().then(success => { if (!success) { process.exit(1); } });

Referenced localhost URLs

./node_modules/encodeurl/README.md:60: href.host = 'localhost' ./node_modules/mysql2/lib/connection_config.js:97: this.host = options.host || 'localhost'; ./node_modules/mysql2/typings/mysql/lib/Connection.d.ts:132: * The hostname of the database you are connecting to. (Default: localhost) ./node_modules/parseurl/README.md:67: Parsing URL "http://localhost:8888/foo/bar?user=tj&pet=fluffy" ./node_modules/body-parser/README.md:454:// POST /api/users gets JSON bodies ./node_modules/body-parser/README.md:455:app.post('/api/users', jsonParser, function (req, res) { ./node_modules/jws/readme.md:255:[encrypted-key-docs]: https://nodejs.org/api/crypto.html#crypto_sign_sign_private_key_output_format ./node_modules/safe-buffer/README.md:303:See the docs. ./node_modules/safe-buffer/README.md:341:From the node.js docs: ./node_modules/@playwright/test/README.md:5:## Documentation | API reference ./node_modules/@playwright/test/README.md:49:* API reference ./node_modules/@playwright/test/README.md:166:* API reference ./node_modules/jsonwebtoken/README.md:37:encoded private key for RSA and ECDSA. In case of a private key with passphrase an object { key, passphrase } can be used (based on crypto documentation), in this case be sure you pass the algorithm option. ./node_modules/router/README.md:159:var api = router.route('/api/') ./node_modules/router/README.md:211:- req - This is a HTTP incoming message instance. ./node_modules/router/README.md:212:- res - This is a HTTP server response instance. ./node_modules/router/README.md:274:router.use('/api/', api) ./node_modules/router/README.md:279:// handle PATCH requests to /api/set-message ./node_modules/router/README.md:306:curl http://127.0.0.1:8080/api/set-message -X PATCH -H "Content-Type: application/json" -d '{"value":"Cats!"}' ./node_modules/statuses/README.md:95:Node.js http module http.STATUS_CODES. ./node_modules/dotenv/README-es.md:5:Dotenv is a zero-dependency module that loads environment variables from a .env file into process.env. Storing configuration in the environment separate from code is based on The Twelve-Factor App methodology. ./node_modules/dotenv/README-es.md:139:You can use the --require (-r) command line option to preload dotenv. By doing this, you do not need to require and load dotenv in your application code. ./node_modules/dotenv/README-es.md:171:DATABASE_URL="postgres://${USERNAME}@localhost/my_database" ./node_modules/dotenv/README-es.md:180:DATABASE_URL postgres://username@localhost/my_database ./node_modules/dotenv/README-es.md:192:DATABASE_URL="postgres://$(whoami)@localhost/my_database" ./node_modules/dotenv/README-es.md:201:DATABASE_URL postgres://yourusername@localhost/my_database ./node_modules/dotenv/README-es.md:590:process.env, ./node_modules/dotenv/README.md:5:Dotenv is a zero-dependency module that loads environment variables from a .env file into process.env. Storing configuration in the environment separate from code is based on The Twelve-Factor App methodology. ./node_modules/dotenv/README.md:139:You can use the --require (-r) command line option to preload dotenv. By doing this, you do not need to require and load dotenv in your application code. ./node_modules/dotenv/README.md:171:DATABASE_URL="postgres://${USERNAME}@localhost/my_database" ./node_modules/dotenv/README.md:180:DATABASE_URL postgres://username@localhost/my_database ./node_modules/dotenv/README.md:192:DATABASE_URL="postgres://$(whoami)@localhost/my_database" ./node_modules/dotenv/README.md:201:DATABASE_URL postgres://yourusername@localhost/my_database ./node_modules/dotenv/README.md:590:process.env, ./node_modules/dotenv/lib/main.d.ts:18: * @param src - contents to be parsed. example: 'DB_HOST=localhost' ./node_modules/dotenv/lib/main.d.ts:19: * @returns an object with keys and values based on src. example: { DB_HOST : 'localhost' } ./node_modules/playwright-core/ThirdPartyNotices.txt:156:$ bombardier -d 10s --fasthttp http://localhost:3000/ ./node_modules/playwright-core/ThirdPartyNotices.txt:170:$ bombardier -d 10s --fasthttp http://localhost:3000/ ./node_modules/playwright-core/ThirdPartyNotices.txt:218: console.log(Listening on http://localhost:${info.port}) // Listening on http://localhost:3000 ./node_modules/playwright-core/ThirdPartyNotices.txt:228:Open http://localhost:3000 with your browser. ./node_modules/playwright-core/lib/client/events.js:45: // @see https://nodejs.org/api/events.html#events_error_events ./node_modules/playwright-core/lib/client/events.js:67: // @see https://nodejs.org/api/events.html#events_error_events ./node_modules/playwright-core/lib/mcpBundleImpl/index.js:111:&&o++}}return[e,r]}var vp=class extends Event{constructor(e,r){var o,n;super(e),this.code=(o=r==null?void 0:r.code)!=null?o:void 0,this.message=(n=r==null?void 0:r.message)!=null?n:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,r,o){return o(h0(this),r)}[Symbol.for("Deno.customInspect")](e,r){return e(h0(this),r)}};function DC(t){let e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function Cy(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(Cy).join(", "):"cause"in t&&t.cause instanceof Error?${t}: ${Cy(t.cause)}:t.message:${t}}function h0(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}var v0=t=>{throw TypeError(t)},Vy=(t,e,r)=>e.has(t)||v0("Cannot "+r),oe=(t,e,r)=>(Vy(t,e,"read from private field"),r?r.call(t):e.get(t)),Ze=(t,e,r)=>e.has(t)?v0("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Ee=(t,e,r,o)=>(Vy(t,e,"write to private field"),e.set(t,r),r),Tr=(t,e,r)=>(Vy(t,e,"access private method"),r),vt,ro,Oi,gp,_p,Tc,Ni,Ec,vn,ji,Ci,Ri,Ic,Yt,Dy,Uy,Ay,g0,Zy,My,Pc,qy,Ly,no=class extends EventTarget{constructor(e,r){var o,n;super(),Ze(this,Yt),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,Ze(this,vt),Ze(this,ro),Ze(this,Oi),Ze(this,gp),Ze(this,_p),Ze(this,Tc),Ze(this,Ni),Ze(this,Ec,null),Ze(this,vn),Ze(this,ji),Ze(this,Ci,null),Ze(this,Ri,null),Ze(this,Ic,null),Ze(this,Uy,async i=>{var a;oe(this,ji).reset();let{body:c,redirected:u,status:l,headers:d}=i;if(l===204){Tr(this,Yt,Pc).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(u?Ee(this,Oi,new URL(i.url)):Ee(this,Oi,void 0),l!==200){Tr(this,Yt,Pc).call(this,Non-200 status code (${l}),l);return}if(!(d.get("content-type")||"").startsWith("text/event-stream")){Tr(this,Yt,Pc).call(this,'Invalid content type, expected "text/event-stream"',l);return}if(oe(this,vt)===this.CLOSED)return;Ee(this,vt,this.OPEN);let s=new Event("open");if((a=oe(this,Ic))==null||a.call(this,s),this.dispatchEvent(s),typeof c!="object"||!c||!("getReader"in c)){Tr(this,Yt,Pc).call(this,"Invalid response body, expected a web ReadableStream",l),this.close();return}let f=new TextDecoder,p=c.getReader(),m=!0;do{let{done:h,value:g}=await p.read();g&&oe(this,ji).feed(f.decode(g,{stream:!h})),h&&(m=!1,oe(this,ji).reset(),Tr(this,Yt,qy).call(this))}while(m)}),Ze(this,Ay,i=>{Ee(this,vn,void 0),!(i.name==="AbortError"||i.type==="aborted")&&Tr(this,Yt,qy).call(this,Cy(i))}),Ze(this,Zy,i=>{typeof i.id=="string"&&Ee(this,Ec,i.id);let a=new MessageEvent(i.event||"message",{data:i.data,origin:oe(this,Oi)?oe(this,Oi).origin:oe(this,ro).origin,lastEventId:i.id||""});oe(this,Ri)&&(!i.event||i.event==="message")&&oe(this,Ri).call(this,a),this.dispatchEvent(a)}),Ze(this,My,i=>{Ee(this,Tc,i)}),Ze(this,Ly,()=>{Ee(this,Ni,void 0),oe(this,vt)===this.CONNECTING&&Tr(this,Yt,Dy).call(this)});try{if(e instanceof URL)Ee(this,ro,e);else if(typeof e=="string")Ee(this,ro,new URL(e,UC()));else throw new Error("Invalid URL")}catch{throw DC("An invalid or illegal string was specified")}Ee(this,ji,hp({onEvent:oe(this,Zy),onRetry:oe(this,My)})),Ee(this,vt,this.CONNECTING),Ee(this,Tc,3e3),Ee(this,_p,(o=r==null?void 0:r.fetch)!=null?o:globalThis.fetch),Ee(this,gp,(n=r==null?void 0:r.withCredentials)!=null?n:!1),Tr(this,Yt,Dy).call(this)}get readyState(){return oe(this,vt)}get url(){return oe(this,ro).href}get withCredentials(){return oe(this,gp)}get onerror(){return oe(this,Ci)}set onerror(e){Ee(this,Ci,e)}get onmessage(){return oe(this,Ri)}set onmessage(e){Ee(this,Ri,e)}get onopen(){return oe(this,Ic)}set onopen(e){Ee(this,Ic,e)}addEventListener(e,r,o){let n=r;super.addEventListener(e,n,o)}removeEventListener(e,r,o){let n=r;super.removeEventListener(e,n,o)}close(){oe(this,Ni)&&clearTimeout(oe(this,Ni)),oe(this,vt)!==this.CLOSED&&(oe(this,vn)&&oe(this,vn).abort(),Ee(this,vt,this.CLOSED),Ee(this,vn,void 0))}};vt=new WeakMap,ro=new WeakMap,Oi=new WeakMap,gp=new WeakMap,_p=new WeakMap,Tc=new WeakMap,Ni=new WeakMap,Ec=new WeakMap,vn=new WeakMap,ji=new WeakMap,Ci=new WeakMap,Ri=new WeakMap,Ic=new WeakMap,Yt=new WeakSet,Dy=function(){Ee(this,vt,this.CONNECTING),Ee(this,vn,new AbortController),oe(this,_p)(oe(this,ro),Tr(this,Yt,g0).call(this)).then(oe(this,Uy)).catch(oe(this,Ay))},Uy=new WeakMap,Ay=new WeakMap,g0=function(){var t;let e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...oe(this,Ec)?{"Last-Event-ID":oe(this,Ec)}:void 0},cache:"no-store",signal:(t=oe(this,vn))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},Zy=new WeakMap,My=new WeakMap,Pc=function(t,e){var r;oe(this,vt)!==this.CLOSED&&Ee(this,vt,this.CLOSED);let o=new vp("error",{code:e,message:t});(r=oe(this,Ci))==null||r.call(this,o),this.dispatchEvent(o)},qy=function(t,e){var r;if(oe(this,vt)===this.CLOSED)return;Ee(this,vt,this.CONNECTING);let o=new vp("error",{code:e,message:t});(r=oe(this,Ci))==null||r.call(this,o),this.dispatchEvent(o),Ee(this,Ni,setTimeout(oe(this,Ly),oe(this,Tc)))},Ly=new WeakMap,no.CONNECTING=0,no.OPEN=1,no.CLOSED=2;function UC(){let t="document"in globalThis?globalThis.document:void 0;return t&&typeof t=="object"&&"baseURI"in t&&typeof t.baseURI=="string"?t.baseURI:void 0}function Di(t){return t?t instanceof Headers?Object.fromEntries(t.entries()):Array.isArray(t)?Object.fromEntries(t):{...t}:{}}function yp(t=fetch,e){return e?async(r,o)=>{let n={...e,...o,headers:o!=null&&o.headers?{...Di(e.headers),...Di(o.headers)}:e.headers};return t(r,n)}:t}var Fy,_0,y0,$0;Fy=($0=(y0=(_0=globalThis.crypto)==null?void 0:_0.webcrypto)!=null?y0:globalThis.crypto)!=null?$0:import("node:crypto").then(t=>t.webcrypto);async function AC(t){return(await Fy).getRandomValues(new Uint8Array(t))}async function ZC(t){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r="",o=await AC(t);for(let n=0;n<t;n++){let i=o[n]%e.length;r+=e[i]}return r}async function MC(t){return await ZC(t)}async function qC(t){let e=await(await Fy).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function Jy(t){if(t||(t=43),t<43||t>128)throwExpected a length between 43 and 128. Received ${t}.;let e=await MC(t),r=await qC(e);return{code_verifier:e,code_challenge:r}}var We=hs().superRefine((t,e)=>{if(!URL.canParse(t))return e.addIssue({code:af.custom,message:"URL must be parseable",fatal:!0}),kn}).refine(t=>{let e=new URL(t);return e.protocol!=="javascript:"&&e.protocol!=="data:"&&e.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),x0=Re({resource:v().url(),authorization_servers:j(We).optional(),jwks_uri:v().url().optional(),scopes_supported:j(v()).optional(),bearer_methods_supported:j(v()).optional(),resource_signing_alg_values_supported:j(v()).optional(),resource_name:v().optional(),resource_documentation:v().optional(),resource_policy_uri:v().url().optional(),resource_tos_uri:v().url().optional(),tls_client_certificate_bound_access_tokens:pe().optional(),authorization_details_types_supported:j(v()).optional(),dpop_signing_alg_values_supported:j(v()).optional(),dpop_bound_access_tokens_required:pe().optional()}),Hy=Re({issuer:v(),authorization_endpoint:We,token_endpoint:We,registration_endpoint:We.optional(),scopes_supported:j(v()).optional(),response_types_supported:j(v()),response_modes_supported:j(v()).optional(),grant_types_supported:j(v()).optional(),token_endpoint_auth_methods_supported:j(v()).optional(),token_endpoint_auth_signing_alg_values_supported:j(v()).optional(),service_documentation:We.optional(),revocation_endpoint:We.optional(),revocation_endpoint_auth_methods_supported:j(v()).optional(),revocation_endpoint_auth_signing_alg_values_supported:j(v()).optional(),introspection_endpoint:v().optional(),introspection_endpoint_auth_methods_supported:j(v()).optional(),introspection_endpoint_auth_signing_alg_values_supported:j(v()).optional(),code_challenge_methods_supported:j(v()).optional(),client_id_metadata_document_supported:pe().optional()}),LC=Re({issuer:v(),authorization_endpoint:We,token_endpoint:We,userinfo_endpoint:We.optional(),jwks_uri:We,registration_endpoint:We.optional(),scopes_supported:j(v()).optional(),response_types_supported:j(v()),response_modes_supported:j(v()).optional(),grant_types_supported:j(v()).optional(),acr_values_supported:j(v()).optional(),subject_types_supported:j(v()),id_token_signing_alg_values_supported:j(v()),id_token_encryption_alg_values_supported:j(v()).optional(),id_token_encryption_enc_values_supported:j(v()).optional(),userinfo_signing_alg_values_supported:j(v()).optional(),userinfo_encryption_alg_values_supported:j(v()).optional(),userinfo_encryption_enc_values_supported:j(v()).optional(),request_object_signing_alg_values_supported:j(v()).optional(),request_object_encryption_alg_values_supported:j(v()).optional(),request_object_encryption_enc_values_supported:j(v()).optional(),token_endpoint_auth_methods_supported:j(v()).optional(),token_endpoint_auth_signing_alg_values_supported:j(v()).optional(),display_values_supported:j(v()).optional(),claim_types_supported:j(v()).optional(),claims_supported:j(v()).optional(),service_documentation:v().optional(),claims_locales_supported:j(v()).optional(),ui_locales_supported:j(v()).optional(),claims_parameter_supported:pe().optional(),request_parameter_supported:pe().optional(),request_uri_parameter_supported:pe().optional(),require_request_uri_registration:pe().optional(),op_policy_uri:We.optional(),op_tos_uri:We.optional(),client_id_metadata_document_supported:pe().optional()}),w0=R({...LC.shape,...Hy.pick({code_challenge_methods_supported:!0}).shape}),k0=R({access_token:v(),id_token:v().optional(),token_type:v(),expires_in:Fn.number().optional(),scope:v().optional(),refresh_token:v().optional()}).strip(),S0=R({error:v(),error_description:v().optional(),error_uri:v().optional()}),b0=We.optional().or(Z("").transform(()=>{})),VC=R({redirect_uris:j(We),token_endpoint_auth_method:v().optional(),grant_types:j(v()).optional(),response_types:j(v()).optional(),client_name:v().optional(),client_uri:We.optional(),logo_uri:b0,scope:v().optional(),contacts:j(v()).optional(),tos_uri:b0,policy_uri:v().optional(),jwks_uri:We.optional(),jwks:js().optional(),software_id:v().optional(),software_version:v().optional(),software_statement:v().optional()}).strip(),FC=R({client_id:v(),client_secret:v().optional(),client_id_issued_at:ae().optional(),client_secret_expires_at:ae().optional()}).strip(),z0=VC.merge(FC),PF=R({error:v(),error_description:v().optional()}).strip(),TF=R({token:v(),token_type_hint:v().optional()}).strip();function I0(t){let e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function P0({requestedResource:t,configuredResource:e}){let r=typeof t=="string"?new URL(t):new URL(t.href),o=typeof e=="string"?new URL(e):new URL(e.href);if(r.origin!==o.origin||r.pathname.length<o.pathname.length)return!1;let n=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",i=o.pathname.endsWith("/")?o.pathname:o.pathname+"/";return n.startsWith(i)}var Ce=class extends Error{constructor(e,r){super(e),this.errorUri=r,this.name=this.constructor.name}toResponseObject(){let e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}},Oc=class extends Ce{};Oc.errorCode="invalid_request";var oo=class extends Ce{};oo.errorCode="invalid_client";var io=class extends Ce{};io.errorCode="invalid_grant";var ao=class extends Ce{};ao.errorCode="unauthorized_client";var jc=class extends Ce{};jc.errorCode="unsupported_grant_type";var Rc=class extends Ce{};Rc.errorCode="invalid_scope";var Nc=class extends Ce{};Nc.errorCode="access_denied";var Er=class extends Ce{};Er.errorCode="server_error";var Cc=class extends Ce{};Cc.errorCode="temporarily_unavailable";var Dc=class extends Ce{};Dc.errorCode="unsupported_response_type";var Uc=class extends Ce{};Uc.errorCode="unsupported_token_type";var Ac=class extends Ce{};Ac.errorCode="invalid_token";var Zc=class extends Ce{};Zc.errorCode="method_not_allowed";var Mc=class extends Ce{};Mc.errorCode="too_many_requests";var so=class extends Ce{};so.errorCode="invalid_client_metadata";var qc=class extends Ce{};qc.errorCode="insufficient_scope";var Lc=class extends Ce{};Lc.errorCode="invalid_target";var T0={[Oc.errorCode]:Oc,[oo.errorCode]:oo,[io.errorCode]:io,[ao.errorCode]:ao,[jc.errorCode]:jc,[Rc.errorCode]:Rc,[Nc.errorCode]:Nc,[Er.errorCode]:Er,[Cc.errorCode]:Cc,[Dc.errorCode]:Dc,[Uc.errorCode]:Uc,[Ac.errorCode]:Ac,[Zc.errorCode]:Zc,[Mc.errorCode]:Mc,[so.errorCode]:so,[qc.errorCode]:qc,[Lc.errorCode]:Lc};var lt=class extends Error{constructor(e){super(e!=null?e:"Unauthorized")}};function JC(t){return["client_secret_basic","client_secret_post","none"].includes(t)}var Wy="code",By="S256";function HC(t,e){let r=t.client_secret!==void 0;return e.length===0?r?"client_secret_post":"none":"token_endpoint_auth_method"in t&&t.token_endpoint_auth_method&&JC(t.token_endpoint_auth_method)&&e.includes(t.token_endpoint_auth_method)?t.token_endpoint_auth_method:r&&e.includes("client_secret_basic")?"client_secret_basic":r&&e.includes("client_secret_post")?"client_secret_post":e.includes("none")?"none":r?"client_secret_post":"none"}function WC(t,e,r,o){let{client_id:n,client_secret:i}=e;switch(t){case"client_secret_basic":BC(n,i,r);return;case"client_secret_post":KC(n,i,o);return;case"none":GC(n,o);return;default:throw new Error(Unsupported client authentication method: ${t})}}function BC(t,e,r){if(!e)throw new Error("client_secret_basic authentication requires a client_secret");let o=btoa(${t}:${e});r.set("Authorization",Basic ${o})}function KC(t,e,r){r.set("client_id",t),e&&r.set("client_secret",e)}function GC(t,e){e.set("client_id",t)}async function O0(t){let e=t instanceof Response?t.status:void 0,r=t instanceof Response?await t.text():t;try{let o=S0.parse(JSON.parse(r)),{error:n,error_description:i,error_uri:a}=o,c=T0[n]||Er;return new c(i||"",a)}catch(o){let n=${e?HTTP ${e}: :""}Invalid OAuth error response: ${o}. Raw body: ${r};return new Er(n)}}async function Or(t,e){var r,o;try{return await Ky(t,e)}catch(n){if(n instanceof oo||n instanceof ao)return await((r=t.invalidateCredentials)==null?void 0:r.call(t,"all")),await Ky(t,e);if(n instanceof io)return await((o=t.invalidateCredentials)==null?void 0:o.call(t,"tokens")),await Ky(t,e);throw n}}async function Ky(t,{serverUrl:e,authorizationCode:r,scope:o,resourceMetadataUrl:n,fetchFn:i}){var g,y;let a,c;try{a=await QC(e,{resourceMetadataUrl:n},i),a.authorization_servers&&a.authorization_servers.length>0&&(c=a.authorization_servers[0])}catch{}c||(c=new URL("/",e));let u=await YC(e,t,a),l=await oD(c,{fetchFn:i}),d=await Promise.resolve(t.clientInformation());if(!d){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");let w=(l==null?void 0:l.client_id_metadata_document_supported)===!0,k=t.clientMetadataUrl;if(k&&!XC(k))throw new so(clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${k});if(w&&k)d={client_id:k},await((g=t.saveClientInformation)==null?void 0:g.call(t,d));else{if(!t.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");let x=await uD(c,{metadata:l,clientMetadata:t.clientMetadata,fetchFn:i});await t.saveClientInformation(x),d=x}}let s=!t.redirectUrl;if(r!==void 0||s){let w=await cD(t,c,{metadata:l,resource:u,authorizationCode:r,fetchFn:i});return await t.saveTokens(w),"AUTHORIZED"}let f=await t.tokens();if(f!=null&&f.refresh_token)try{let w=await sD(c,{metadata:l,clientInformation:d,refreshToken:f.refresh_token,resource:u,addClientAuthentication:t.addClientAuthentication,fetchFn:i});return await t.saveTokens(w),"AUTHORIZED"}catch(w){if(!(!(w instanceof Ce)||w instanceof Er))throw w}let p=t.state?await t.state():void 0,{authorizationUrl:m,codeVerifier:h}=await iD(c,{metadata:l,clientInformation:d,state:p,redirectUrl:t.redirectUrl,scope:o||((y=a==null?void 0:a.scopes_supported)==null?void 0:y.join(" "))||t.clientMetadata.scope,resource:u});return await t.saveCodeVerifier(h),await t.redirectToAuthorization(m),"REDIRECT"}function XC(t){if(!t)return!1;try{let e=new URL(t);return e.protocol==="https:"&&e.pathname!=="/"}catch{return!1}}async function YC(t,e,r){let o=I0(t);if(e.validateResourceURL)return await e.validateResourceURL(o,r==null?void 0:r.resource);if(r){if(!P0({requestedResource:o,configuredResource:r.resource}))throw new Error(Protected resource ${r.resource} does not match expected ${o} (or origin));return new URL(r.resource)}}function Ui(t){let e=t.headers.get("WWW-Authenticate");if(!e)return{};let[r,o]=e.split(" ");if(r.toLowerCase()!=="bearer"||!o)return{};let n=Gy(t,"resource_metadata")||void 0,i;if(n)try{i=new URL(n)}catch{}let a=Gy(t,"scope")||void 0,c=Gy(t,"error")||void 0;return{resourceMetadataUrl:i,scope:a,error:c}}function Gy(t,e){let r=t.headers.get("WWW-Authenticate");if(!r)return null;let o=new RegExp(${e}=(?:"([^"]+)"|([^\s,]+))),n=r.match(o);return n?n[1]||n[2]:null}async function QC(t,e,r=fetch){var n,i;let o=await rD(t,"oauth-protected-resource",r,{protocolVersion:e==null?void 0:e.protocolVersion,metadataUrl:e==null?void 0:e.resourceMetadataUrl});if(!o||o.status===404)throw await((n=o==null?void 0:o.body)==null?void 0:n.cancel()),new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!o.ok)throw await((i=o.body)==null?void 0:i.cancel()),new Error(HTTP ${o.status} trying to load well-known OAuth protected resource metadata.);return x0.parse(await o.json())}async function Xy(t,e,r=fetch){try{return await r(t,{headers:e})}catch(o){if(o instanceof TypeError)return e?Xy(t,void 0,r):void 0;throw o}}function eD(t,e="",r={}){return e.endsWith("/")&&(e=e.slice(0,-1)),r.prependPathname?${e}/.well-known/${t}:/.well-known/${t}${e}}async function E0(t,e,r=fetch){return await Xy(t,{"MCP-Protocol-Version":e},r)}function tD(t,e){return!t||t.status>=400&&t.status<500&&e!=="/"}async function rD(t,e,r,o){var u,l;let n=new URL(t),i=(u=o==null?void 0:o.protocolVersion)!=null?u:on,a;if(o!=null&&o.metadataUrl)a=new URL(o.metadataUrl);else{let d=eD(e,n.pathname);a=new URL(d,(l=o==null?void 0:o.metadataServerUrl)!=null?l:n),a.search=n.search}let c=await E0(a,i,r);if(!(o!=null&&o.metadataUrl)&&tD(c,n.pathname)){let d=new URL(/.well-known/${e},n);c=await E0(d,i,r)}return c}function nD(t){let e=typeof t=="string"?new URL(t):t,r=e.pathname!=="/",o=[];if(!r)return o.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),o.push({url:new URL("/.well-known/openid-configuration",e.origin),type:"oidc"}),o;let n=e.pathname;return n.endsWith("/")&&(n=n.slice(0,-1)),o.push({url:new URL(/.well-known/oauth-authorization-server${n},e.origin),type:"oauth"}),o.push({url:new URL(/.well-known/openid-configuration${n},e.origin),type:"oidc"}),o.push({url:new URL(${n}/.well-known/openid-configuration,e.origin),type:"oidc"}),o}async function oD(t,{fetchFn:e=fetch,protocolVersion:r=on}={}){var i;let o={"MCP-Protocol-Version":r,Accept:"application/json"},n=nD(t);for(let{url:a,type:c}of n){let u=await Xy(a,o,e);if(u){if(!u.ok){if(await((i=u.body)==null?void 0:i.cancel()),u.status>=400&&u.status<500)continue;throw new Error(HTTP ${u.status} trying to load ${c==="oauth"?"OAuth":"OpenID provider"} metadata from ${a})}return c==="oauth"?Hy.parse(await u.json()):w0.parse(await u.json())}}}async function iD(t,{metadata:e,clientInformation:r,redirectUrl:o,scope:n,state:i,resource:a}){let c;if(e){if(c=new URL(e.authorization_endpoint),!e.response_types_supported.includes(Wy))throw new Error(Incompatible auth server: does not support response type ${Wy});if(e.code_challenge_methods_supported&&!e.code_challenge_methods_supported.includes(By))throw new Error(Incompatible auth server: does not support code challenge method ${By})}else c=new URL("/authorize",t);let u=await Jy(),l=u.code_verifier,d=u.code_challenge;return c.searchParams.set("response_type",Wy),c.searchParams.set("client_id",r.client_id),c.searchParams.set("code_challenge",d),c.searchParams.set("code_challenge_method",By),c.searchParams.set("redirect_uri",String(o)),i&&c.searchParams.set("state",i),n&&c.searchParams.set("scope",n),n!=null&&n.includes("offline_access")&&c.searchParams.append("prompt","consent"),a&&c.searchParams.set("resource",a.href),{authorizationUrl:c,codeVerifier:l}}function aD(t,e,r){return new URLSearchParams({grant_type:"authorization_code",code:t,code_verifier:e,redirect_uri:String(r)})}async function j0(t,{metadata:e,tokenRequestParams:r,clientInformation:o,addClientAuthentication:n,resource:i,fetchFn:a}){var d;let c=e!=null&&e.token_endpoint?new URL(e.token_endpoint):new URL("/token",t),u=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(i&&r.set("resource",i.href),n)await n(u,r,c,e);else if(o){let s=(d=e==null?void 0:e.token_endpoint_auth_methods_supported)!=null?d:[],f=HC(o,s);WC(f,o,u,r)}let l=await(a!=null?a:fetch)(c,{method:"POST",headers:u,body:r});if(!l.ok)throw await O0(l);return k0.parse(await l.json())}async function sD(t,{metadata:e,clientInformation:r,refreshToken:o,resource:n,addClientAuthentication:i,fetchFn:a}){let c=new URLSearchParams({grant_type:"refresh_token",refresh_token:o}),u=await j0(t,{metadata:e,tokenRequestParams:c,clientInformation:r,addClientAuthentication:i,resource:n,fetchFn:a});return{refresh_token:o,...u}}async function cD(t,e,{metadata:r,resource:o,authorizationCode:n,fetchFn:i}={}){let a=t.clientMetadata.scope,c;if(t.prepareTokenRequest&&(c=await t.prepareTokenRequest(a)),!c){if(!n)throw new Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!t.redirectUrl)throw new Error("redirectUrl is required for authorization_code flow");let l=await t.codeVerifier();c=aD(n,l,t.redirectUrl)}let u=await t.clientInformation();return j0(e,{metadata:r,tokenRequestParams:c,clientInformation:u!=null?u:void 0,addClientAuthentication:t.addClientAuthentication,resource:o,fetchFn:i})}async function uD(t,{metadata:e,clientMetadata:r,fetchFn:o}){let n;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");n=new URL(e.registration_endpoint)}else n=new URL("/register",t);let i=await(o!=null?o:fetch)(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!i.ok)throw await O0(i);return z0.parse(await i.json())}var Yy=class extends Error{constructor(e,r,o){super(SSE error: ${r}),this.code=e,this.event=o}},$p=class{constructor(e,r){this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._eventSourceInit=r==null?void 0:r.eventSourceInit,this._requestInit=r==null?void 0:r.requestInit,this._authProvider=r==null?void 0:r.authProvider,this._fetch=r==null?void 0:r.fetch,this._fetchWithInit=yp(r==null?void 0:r.fetch,r==null?void 0:r.requestInit)}async _authThenStart(){var r;if(!this._authProvider)throw new lt("No auth provider");let e;try{e=await Or(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(o){throw(r=this.onerror)==null||r.call(this,o),o}if(e!=="AUTHORIZED")throw new lt;return await this._startOrAuth()}async _commonHeaders(){var o;let e={};if(this._authProvider){let n=await this._authProvider.tokens();n&&(e.Authorization=Bearer ${n.access_token})}this._protocolVersion&&(e["mcp-protocol-version"]=this._protocolVersion);let r=Di((o=this._requestInit)==null?void 0:o.headers);return new Headers({...e,...r})}_startOrAuth(){var r,o,n;let e=(n=(o=(r=this==null?void 0:this._eventSourceInit)==null?void 0:r.fetch)!=null?o:this._fetch)!=null?n:fetch;return new Promise((i,a)=>{this._eventSource=new no(this._url.href,{...this._eventSourceInit,fetch:async(c,u)=>{let l=await this._commonHeaders();l.set("Accept","text/event-stream");let d=await e(c,{...u,headers:l});if(d.status===401&&d.headers.has("www-authenticate")){let{resourceMetadataUrl:s,scope:f}=Ui(d);this._resourceMetadataUrl=s,this._scope=f}return d}}),this._abortController=new AbortController,this._eventSource.onerror=c=>{var l;if(c.code===401&&this._authProvider){this._authThenStart().then(i,a);return}let u=new Yy(c.code,c.message,c);a(u),(l=this.onerror)==null||l.call(this,u)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",c=>{var l;let u=c;try{if(this._endpoint=new URL(u.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(Endpoint origin does not match connection origin: ${this.endpoint.origin})}catch(d){a(d),(l=this.onerror)==null||l.call(this,d),this.close();return}i()}),this._eventSource.onmessage=c=>{var d,s;let u=c,l;try{l=kt.parse(JSON.parse(u.data))}catch(f){(d=this.onerror)==null||d.call(this,f);return}(s=this.onmessage)==null||s.call(this,l)}})}async start(){if(this._eventSource)throw new Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth(e){if(!this._authProvider)throw new lt("No auth provider");if(await Or(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new lt("Failed to authorize")}async close(){var e,r,o;(e=this._abortController)==null||e.abort(),(r=this._eventSource)==null||r.close(),(o=this.onclose)==null||o.call(this)}async send(e){var r,o,n,i;if(!this._endpoint)throw new Error("Not connected");try{let a=await this._commonHeaders();a.set("content-type","application/json");let c={...this._requestInit,method:"POST",headers:a,body:JSON.stringify(e),signal:(r=this._abortController)==null?void 0:r.signal},u=await((o=this._fetch)!=null?o:fetch)(this._endpoint,c);if(!u.ok){let l=await u.text().catch(()=>null);if(u.status===401&&this._authProvider){let{resourceMetadataUrl:d,scope:s}=Ui(u);if(this._resourceMetadataUrl=d,this._scope=s,await Or(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new lt;return this.send(e)}throw new Error(Error POSTing to endpoint (HTTP ${u.status}): ${l})}await((n=u.body)==null?void 0:n.cancel())}catch(a){throw(i=this.onerror)==null||i.call(this,a),a}}setProtocolVersion(e){this._protocolVersion=e}};var q0=require("node:crypto");var D0=er(C0());function Qy(t,{limit:e,encoding:r}){let o=D0.default.parse(e);return new Promise((n,i)=>{let a=0,c=[];t.on("data",u=>{if(a+=u.length,a>o)return i(new Error(Message size exceeds limit of ${e} bytes));c.push(u)}),t.on("end",()=>{try{n(Buffer.concat(c).toString(r))}catch(u){i(u)}}),t.on("error",u=>{i(u)})})}var L0=er(M0(),1),V0=require("node:url"),xD="4mb",xp=class{constructor(e,r,o){this._endpoint=e,this.res=r,this._sessionId=(0,q0.randomUUID)(),this._options=o||{enableDnsRebindingProtection:!1}}validateRequestHeaders(e){if(this._options.enableDnsRebindingProtection){if(this._options.allowedHosts&&this._options.allowedHosts.length>0){let r=e.headers.host;if(!r||!this._options.allowedHosts.includes(r))returnInvalid Host header: ${r}}if(this._options.allowedOrigins&&this._options.allowedOrigins.length>0){let r=e.headers.origin;if(r&&!this._options.allowedOrigins.includes(r))returnInvalid Origin header: ${r}}}}async start(){if(this._sseResponse)throw new Error("SSEServerTransport already started! If using Server class, note that connect() calls start() automatically.");this.res.writeHead(200,{"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive"});let e="http://localhost",r=new V0.URL(this._endpoint,e);r.searchParams.set("sessionId",this._sessionId);let o=r.pathname+r.search+r.hash;this.res.write(event: endpoint ./node_modules/playwright-core/lib/server/socksClientCertificatesInterceptor.js:304: return host === "local.playwright" ? "localhost" : host; ./node_modules/playwright-core/lib/server/browserContext.js:63: // @see https://nodejs.org/api/events.html#events_error_events ./node_modules/playwright-core/lib/server/trace/viewer/traceViewer.js:70: const url = new URL("http://localhost" + request.url); ./node_modules/playwright-core/lib/server/trace/viewer/traceViewer.js:175: await (0, import_utilsBundle.open)(url.replace("0.0.0.0", "localhost")).catch(() => { ./node_modules/playwright-core/lib/server/network.js:63: return hostname === "localhost" || hostname.endsWith(".localhost"); ./node_modules/playwright-core/lib/server/bidi/third_party/firefoxPrefs.js:124: "datareporting.healthreport.documentServerURI": http://${server}/dummy/healthreport/, ./node_modules/playwright-core/lib/server/chromium/chromium.js:220: if (endpointURL.hostname === "localhost" || endpointURL.hostname === "127.0.0.1") ./node_modules/playwright-core/lib/server/chromium/chromium.js:229: const endpointURLString = addProtocol(debuggerAddress || chromeOptionsURL).replace("localhost", "127.0.0.1"); ./node_modules/playwright-core/lib/server/chromium/chromium.js:232: if (endpointURL.hostname === "localhost" || endpointURL.hostname === "127.0.0.1") { ./node_modules/playwright-core/lib/server/chromium/chromium.js:233: const sessionInfoUrl = new URL(hubUrl).origin + "/grid/api/testsession?session=" + sessionId; ./node_modules/playwright-core/lib/server/utils/socksProxy.js:297: return host === "localhost" || host.endsWith(".localhost") || host === "127.0.0.1" || host === "[::1]"; ./node_modules/playwright-core/lib/server/utils/socksProxy.js:464: host = "localhost"; ./node_modules/playwright-core/lib/server/utils/wsServer.js:56: const wsEndpoint2 = typeof address === "string" ? ${address}${path} : ws://${hostname || "localhost"}:${address.port}${path}; ./node_modules/playwright-core/lib/server/utils/wsServer.js:67: const pathname = new URL("http://localhost" + request.url).pathname; ./node_modules/playwright-core/lib/server/utils/wsServer.js:85: const url = new URL("http://localhost" + (request.url || "")); ./node_modules/playwright-core/lib/server/utils/httpServer.js:109: this.urlPrefixHumanReadable = http://${host ?? "localhost"}:${address.port}; ./node_modules/playwright-core/lib/server/utils/httpServer.js:186: const url = new URL("http://localhost" + request.url); ./node_modules/playwright-core/lib/server/utils/network.js:174: const { host = "localhost", port = 0 } = options; ./node_modules/playwright-core/lib/server/utils/processLauncher.js:110: // @see https://nodejs.org/api/child_process.html#child_process_options_detached ./node_modules/playwright-core/lib/server/utils/crypto.js:144: DER.encodePrintableString("localhost") ./node_modules/playwright-core/lib/server/utils/crypto.js:168: DER.encodePrintableString("localhost") ./node_modules/playwright-core/lib/server/helper.js:29: if (urlString.startsWith("localhost") || urlString.startsWith("127.0.0.1")) ./node_modules/playwright-core/lib/server/registry/index.js:1181: const products = lowercaseAllKeys(JSON.parse(await (0, import_network.fetchData)(void 0, { url: "https://edgeupdates.microsoft.com/api/products" }))); ./node_modules/playwright-core/lib/vite/traceViewer/sw.bundle.js:5:If your trace is in a local or private network, please grant permission for Local Network Access.),new Error(a)}const n=new Qs(e.storage(),r=>e.resourceForSha1(r));return{traceLoader:e,snapshotServer:n}}async function Eo(s){const t=s.request;if(t.url.startsWith("chrome-extension://"))return fetch(t);const e=new URL(t.url);let n;if(t.url.startsWith(self.registration.scope)&&(n=e.pathname.substring(go.length-1)),n==="/restartServiceWorker")return bo(),new Response(null,{status:200});if(n==="/ping")return new Response(null,{status:200});const i=!!s.resultingClientId,r=s.clientId?await self.clients.get(s.clientId):void 0;if(i&&!(n!=null&&n.startsWith("/sha1/"))){if(n!=null&&n.startsWith("/snapshot/")){const{errorResponse:a,loadedTrace:o}=await Mn(s.resultingClientId,e,So);if(a)return a;const l=n.substring(10),_=o.snapshotServer.serveSnapshot(l,e.searchParams,e.href);return Fn&&_.headers.set("Content-Security-Policy","upgrade-insecure-requests"),_}return fetch(s.request)}if(!n){if(!r)return new Response("Sub-resource without a client",{status:500});const{snapshotServer:a}=await Ks(r.id,new URL(r.url),Un(r));if(!a)return new Response(null,{status:404});const o=[t.url];return Fn&&t.url.startsWith("https://")&&o.push(t.url.replace(/^https/,"http")),a.serveResource(o,t.method,r.url)}if(n==="/contexts"||n.startsWith("/snapshotInfo/")||n.startsWith("/closest-screenshot/")||n.startsWith("/sha1/")){if(!r)return new Response("Sub-resource without a client",{status:500});const{errorResponse:a,loadedTrace:o}=await Mn(r.id,e,Un(r));if(a)return a;if(n==="/contexts")return new Response(JSON.stringify(o.traceLoader.contextEntries),{status:200,headers:{"Content-Type":"application/json"}});if(n.startsWith("/snapshotInfo/")){const l=n.substring(14);return o.snapshotServer.serveSnapshotInfo(l,e.searchParams)}if(n.startsWith("/closest-screenshot/")){const l=n.substring(20);return o.snapshotServer.serveClosestScreenshot(l,e.searchParams)}if(n.startsWith("/sha1/")){const l=await o.traceLoader.resourceForSha1(n.slice(6));return l?new Response(l,{status:200,headers:xo(e.searchParams)}):new Response(null,{status:404})}}return fetch(s.request)}function xo(s){const t=s.get("dn"),e=s.get("dct");if(!t)return;const n=new Headers;return n.set("Content-Disposition",attachment; filename="attachment"; filename*=UTF-8''${encodeURIComponent(t)}),e&&n.set("Content-Type",e),n}async function To(){const s=await self.clients.matchAll(),t=new Set;for(const[e,n]of $e){if(!s.find(i=>i.id===e)){$e.delete(e);continue}t.add(n)}for(const e of Ee.keys())t.has(e)||Ee.delete(e)}function Un(s){return(t,e)=>{s.postMessage({method:"progress",params:{done:t,total:e}})}}function So(s,t){}function Ro(s){const e=new URL(s,"http://localhost").searchParams.get("path");return!!(e!=null&&e.endsWith(".json"))}self.addEventListener("fetch",function(s){if(s.request.headers.get("x-pw-serviceworker")==="skip")return!1;s.respondWith(Eo(s))}); ./node_modules/playwright-core/lib/vite/traceViewer/snapshot.html:9: throw new Error(Service workers are not supported.\nMake sure to serve the Trace Viewer (${window.location}) via HTTPS or localhost.); ./node_modules/playwright-core/lib/vite/traceViewer/index.BDwrLSGN.js:2:Make sure to serve the Trace Viewer (${window.location}) via HTTPS or localhost.);navigator.serviceWorker.register("sw.bundle.js"),navigator.serviceWorker.controller||await new Promise(h=>{navigator.serviceWorker.oncontrollerchange=()=>h()}),setInterval(function(){fetch("ping")},1e4)}const c=o.get("trace"),l=(c==null?void 0:c.endsWith(".json"))?e.jsx(q,{traceJson:c}):e.jsx($,{});V.createRoot(document.querySelector("#root")).render(l)})(); ./node_modules/playwright-core/lib/vite/traceViewer/assets/defaultSettingsView-CJSZINFr.js:51:,"\\n")}function Ex(n,e){if(n)for(const i of e.split("|")){if(i==="url")try{const l=new URL(n[i]);return l.protocol==="data:"?l.protocol:l.protocol==="about:"?n[i]:l.pathname+l.search}catch{if(n[i]!==void 0)return n[i]}if(i==="timeNumber"&&n[i]!==void 0)return new Date(n[i]).toString();const r=Ax(n,i);if(r!==void 0)return r}}function Ax(n,e){const i=e.split(".");let r=n;for(const l of i){if(typeof r!="object"||r===null)return;r=r[l]}if(r!==void 0)return String(r)}function Nx(n){var i;return(n.title??((i=Qh.get(n.type+"."+n.method))==null?void 0:i.title)??n.method).replace(/\{([^}]+)\}/g,(r,l)=>eb(n.params,l)??r)}function Cx(n){var e;return(e=Qh.get(n.type+"."+n.method))==null?void 0:e.group}const qa=Symbol("context"),tb=Symbol("nextInContext"),nb=Symbol("prevByEndTime"),ib=Symbol("nextByStartTime"),Py=Symbol("events");class BC{constructor(e,i){var l;i.forEach(o=>kx(o));const r=i.find(o=>o.origin==="library");this.traceUri=e,this.browserName=(r==null?void 0:r.browserName)||"",this.sdkLanguage=r==null?void 0:r.sdkLanguage,this.channel=r==null?void 0:r.channel,this.testIdAttributeName=r==null?void 0:r.testIdAttributeName,this.platform=(r==null?void 0:r.platform)||"",this.playwrightVersion=(l=i.find(o=>o.playwrightVersion))==null?void 0:l.playwrightVersion,this.title=(r==null?void 0:r.title)||"",this.options=(r==null?void 0:r.options)||{},this.actions=Mx(i),this.pages=[].concat(...i.map(o=>o.pages)),this.wallTime=i.map(o=>o.wallTime).reduce((o,u)=>Math.min(o||Number.MAX_VALUE,u),Number.MAX_VALUE),this.startTime=i.map(o=>o.startTime).reduce((o,u)=>Math.min(o,u),Number.MAX_VALUE),this.endTime=i.map(o=>o.endTime).reduce((o,u)=>Math.max(o,u),Number.MIN_VALUE),this.events=[].concat(...i.map(o=>o.events)),this.stdio=[].concat(...i.map(o=>o.stdio)),this.errors=[].concat(...i.map(o=>o.errors)),this.hasSource=i.some(o=>o.hasSource),this.hasStepData=i.some(o=>o.origin==="testRunner"),this.resources=[...i.map(o=>o.resources)].flat(),this.attachments=this.actions.flatMap(o=>{var u;return((u=o.attachments)==null?void 0:u.map(f=>({...f,callId:o.callId,traceUri:e})))??[]}),this.visibleAttachments=this.attachments.filter(o=>!o.name.startsWith("_")),this.events.sort((o,u)=>o.time-u.time),this.resources.sort((o,u)=>o._monotonicTime-u._monotonicTime),this.errorDescriptors=this.hasStepData?this._errorDescriptorsFromTestRunner():this._errorDescriptorsFromActions(),this.sources=Bx(this.actions,this.errorDescriptors),this.actionCounters=new Map;for(const o of this.actions)o.group=o.group??Cx({type:o.class,method:o.method}),o.group&&this.actionCounters.set(o.group,1+(this.actionCounters.get(o.group)||0))}createRelativeUrl(e){const i=new URL("http://localhost/"+e);return i.searchParams.set("trace",this.traceUri),i.toString().substring(17)}failedAction(){return this.actions.findLast(e=>e.error)}filteredActions(e){const i=new Set(e);return this.actions.filter(r=>!r.group||i.has(r.group))}renderActionTree(e){const i=this.filteredActions(e??[]),{rootItem:r}=sb(i),l=[],o=(u,f)=>{const h=Nx({...u.action,type:u.action.class});l.push(${f}${h||u.id});for(const g of u.children)o(g,f+" ")};return r.children.forEach(u=>o(u,"")),l}_errorDescriptorsFromActions(){var i;const e=[];for(const r of this.actions||[])(i=r.error)!=null&&i.message&&e.push({action:r,stack:r.stack,message:r.error.message});return e}_errorDescriptorsFromTestRunner(){return this.errors.filter(e=>!!e.message).map((e,i)=>({stack:e.stack,message:e.message}))}}function kx(n){for(const i of n.pages)i[qa]=n;for(let i=0;i<n.actions.length;++i){const r=n.actions[i];r[qa]=n}let e;for(let i=n.actions.length-1;i>=0;i--){const r=n.actions[i];r[tb]=e,r.class!=="Route"&&(e=r)}for(const i of n.events)i[qa]=n;for(const i of n.resources)i[qa]=n}function Mx(n){const e=[],i=Ox(n);e.push(...i),e.sort((r,l)=>l.parentId===r.callId?1:r.parentId===l.callId?-1:r.endTime-l.endTime);for(let r=1;r<e.length;++r)e[r][nb]=e[r-1];e.sort((r,l)=>l.parentId===r.callId?-1:r.parentId===l.callId?1:r.startTime-l.startTime);for(let r=0;r+1<e.length;++r)e[r][ib]=e[r+1];return e}let Zy=0;function Ox(n){const e=new Map,i=n.filter(u=>u.origin==="library"),r=n.filter(u=>u.origin==="testRunner");if(!r.length||!i.length)return n.map(u=>u.actions.map(f=>({...f,context:u}))).flat();for(const u of i)for(const f of u.actions)e.set(f.stepId||tmp-step@${++Zy},{...f,context:u});const l=Lx(r,e);l&&jx(i,l);const o=new Map;for(const u of r)for(const f of u.actions){const h=f.stepId&&e.get(f.stepId);if(h){o.set(f.callId,h.callId),f.error&&(h.error=f.error),f.attachments&&(h.attachments=f.attachments),f.annotations&&(h.annotations=f.annotations),f.parentId&&(h.parentId=o.get(f.parentId)??f.parentId),f.group&&(h.group=f.group),h.startTime=f.startTime,h.endTime=f.endTime;continue}f.parentId&&(f.parentId=o.get(f.parentId)??f.parentId),e.set(f.stepId||tmp-step@${++Zy},{...f,context:u})}return[...e.values()]}function jx(n,e){for(const i of n){i.startTime+=e,i.endTime+=e;for(const r of i.actions)r.startTime&&(r.startTime+=e),r.endTime&&(r.endTime+=e);for(const r of i.events)r.time+=e;for(const r of i.stdio)r.timestamp+=e;for(const r of i.pages)for(const l of r.screencastFrames)l.timestamp+=e;for(const r of i.resources)r._monotonicTime&&(r._monotonicTime+=e)}}function Lx(n,e){for(const i of n)for(const r of i.actions){if(!r.startTime)continue;const l=r.stepId?e.get(r.stepId):void 0;if(l)return r.startTime-l.startTime}return 0}function sb(n){const e=new Map;for(const l of n)e.set(l.callId,{id:l.callId,parent:void 0,children:[],action:l});const i={action:{...Ux},id:"",parent:void 0,children:[]};for(const l of e.values()){i.action.startTime=Math.min(i.action.startTime,l.action.startTime),i.action.endTime=Math.max(i.action.endTime,l.action.endTime);const o=l.action.parentId&&e.get(l.action.parentId)||i;o.children.push(l),l.parent=o}const r=l=>{for(const o of l.children)o.action.stack=o.action.stack??l.action.stack,r(o)};return r(i),{rootItem:i,itemMap:e}}function rb(n){return n[qa]}function Rx(n){return n[tb]}function Wy(n){return n[nb]}function e0(n){return n[ib]}function Dx(n){let e=0,i=0;for(const r of zx(n)){if(r.type==="console"){const l=r.messageType;l==="warning"?++i:l==="error"&&++e}r.type==="event"&&r.method==="pageError"&&++e}return{errors:e,warnings:i}}function zx(n){let e=n[Py];if(e)return e;const i=Rx(n);return e=rb(n).events.filter(r=>r.time>=n.startTime&&(!i||r.time<i.startTime)),n[Py]=e,e}function Bx(n,e){var r;const i=new Map;for(const l of n)for(const o of l.stack||[]){let u=i.get(o.file);u||(u={errors:[],content:void 0},i.set(o.file,u))}for(const l of e){const{action:o,stack:u,message:f}=l;!o||!u||(r=i.get(u[0].file))==null||r.errors.push({line:u[0].line||0,message:f})}return i}const Ux={type:"action",callId:"",startTime:0,endTime:0,class:"",method:"",params:{},log:[],context:{origin:"library",startTime:0,endTime:0,browserName:"",wallTime:0,options:{},pages:[],resources:[],actions:[],events:[],stdio:[],errors:[],hasSource:!1,contextId:""}},Hx=50,nc=({sidebarSize:n,sidebarHidden:e=!1,sidebarIsFirst:i=!1,orientation:r="vertical",minSidebarSize:l=Hx,settingName:o,sidebar:u,main:f})=>{const h=Math.max(l,n)*window.devicePixelRatio,[g,y]=on(o?o+"."+r+":size":void 0,h),[m,w]=on(o?o+"."+r+":size":void 0,h),[v,E]=U.useState(null),[x,_]=gs();let N;r==="vertical"?(N=m/window.devicePixelRatio,x&&x.height<N&&(N=x.height-10)):(N=g/window.devicePixelRatio,x&&x.width<N&&(N=x.width-10)),document.body.style.userSelect=v?"none":"inherit";let C={};return r==="vertical"?i?C={top:v?0:N-4,bottom:v?0:void 0,height:v?"initial":8}:C={bottom:v?0:N-4,top:v?0:void 0,height:v?"initial":8}:i?C={left:v?0:N-4,right:v?0:void 0,width:v?"initial":8}:C={right:v?0:N-4,left:v?0:void 0,width:v?"initial":8},S.jsxs("div",{className:Fe("split-view",r,i&&"sidebar-first"),ref:_,children:[S.jsx("div",{className:"split-view-main",children:f}),!e&&S.jsx("div",{style:{flexBasis:N},className:"split-view-sidebar",children:u}),!e&&S.jsx("div",{style:C,className:"split-view-resizer",onMouseDown:$=>E({offset:r==="vertical"?$.clientY:$.clientX,size:N}),onMouseUp:()=>E(null),onMouseMove:$=>{if(!$.buttons)E(null);else if(v){const D=(r==="vertical"?$.clientY:$.clientX)-v.offset,K=i?v.size+D:v.size-D,q=$.target.parentElement.getBoundingClientRect(),j=Math.min(Math.max(l,K),(r==="vertical"?q.height:q.width)-l);r==="vertical"?w(j*window.devicePixelRatio):y(j*window.devicePixelRatio)}}})]})},et=function(n,e,i){return n>=e&&n<=i};function Rt(n){return et(n,48,57)}function t0(n){return Rt(n)||et(n,65,70)||et(n,97,102)}function qx(n){return et(n,65,90)}function $x(n){return et(n,97,122)}function Ix(n){return qx(n)||$x(n)}function Vx(n){return n>=128}function $o(n){return Ix(n)||Vx(n)||n===95}function n0(n){return $o(n)||Rt(n)||n===45}function Gx(n){return et(n,0,8)||n===11||et(n,14,31)||n===127}function Io(n){return n===10}function Qn(n){return Io(n)||n===9||n===32}const Kx=1114111;class Jh extends Error{constructor(e){super(e),this.name="InvalidCharacterError"}}function Yx(n){const e=[];for(let i=0;i<n.length;i++){let r=n.charCodeAt(i);if(r===13&&n.charCodeAt(i+1)===10&&(r=10,i++),(r===13||r===12)&&(r=10),r===0&&(r=65533),et(r,55296,56319)&&et(n.charCodeAt(i+1),56320,57343)){const l=r-55296,o=n.charCodeAt(i+1)-56320;r=Math.pow(2,16)+l*Math.pow(2,10)+o,i++}e.push(r)}return e}function st(n){if(n<=65535)return String.fromCharCode(n);n-=Math.pow(2,16);const e=Math.floor(n/Math.pow(2,10))+55296,i=n%Math.pow(2,10)+56320;return String.fromCharCode(e)+String.fromCharCode(i)}function ab(n){const e=Yx(n);let i=-1;const r=[];let l;const o=function(V){return V>=e.length?-1:e[V]},u=function(V){if(V===void 0&&(V=1),V>3)throw"Spec Error: no more than three codepoints of lookahead.";return o(i+V)},f=function(V){return V===void 0&&(V=1),i+=V,l=o(i),!0},h=function(){return i-=1,!0},g=function(V){return V===void 0&&(V=l),V===-1},y=function(){if(m(),f(),Qn(l)){for(;Qn(u());)f();return new ic}else{if(l===34)return E();if(l===35)if(n0(u())||N(u(1),u(2))){const V=new vb("");return $(u(1),u(2),u(3))&&(V.type="id"),V.value=Q(),V}else return new dt(l);else return l===36?u()===61?(f(),new Jx):new dt(l):l===39?E():l===40?new mb:l===41?new Ph:l===42?u()===61?(f(),new Px):new dt(l):l===43?K()?(h(),w()):new dt(l):l===44?new hb:l===45?K()?(h(),w()):u(1)===45&&u(2)===62?(f(2),new cb):I()?(h(),v()):new dt(l):l===46?K()?(h(),w()):new dt(l):l===58?new ub:l===59?new fb:l===60?u(1)===33&&u(2)===45&&u(3)===45?(f(3),new ob):new dt(l):l===64?$(u(1),u(2),u(3))?new bb(Q()):new dt(l):l===91?new gb:l===92?C()?(h(),v()):new dt(l):l===93?new kh:l===94?u()===61?(f(),new Qx):new dt(l):l===123?new db:l===124?u()===61?(f(),new Fx):u()===124?(f(),new yb):new dt(l):l===125?new pb:l===126?u()===61?(f(),new Xx):new dt(l):Rt(l)?(h(),w()):$o(l)?(h(),v()):g()?new Go:new dt(l)}},m=function(){for(;u(1)===47&&u(2)===42;)for(f(2);;)if(f(),l===42&&u()===47){f();break}else if(g())return},w=function(){const V=q();if($(u(1),u(2),u(3))){const J=new Zx;return J.value=V.value,J.repr=V.repr,J.type=V.type,J.unit=Q(),J}else if(u()===37){f();const J=new xb;return J.value=V.value,J.repr=V.repr,J}else{const J=new wb;return J.value=V.value,J.repr=V.repr,J.type=V.type,J}},v=function(){const V=Q();if(V.toLowerCase()==="url"&&u()===40){for(f();Qn(u(1))&&Qn(u(2));)f();return u()===34||u()===39?new Ya(V):Qn(u())&&(u(2)===34||u(2)===39)?new Ya(V):x()}else return u()===40?(f(),new Ya(V)):new Zh(V)},E=function(V){V===void 0&&(V=l);let J="";for(;f();){if(l===V||g())return new Wh(J);if(Io(l))return h(),new lb;l===92?g(u())||(Io(u())?f():J+=st(_())):J+=st(l)}throw new Error("Internal error")},x=function(){const V=new Sb("");for(;Qn(u());)f();if(g(u()))return V;for(;f();){if(l===41||g())return V;if(Qn(l)){for(;Qn(u());)f();return u()===41||g(u())?(f(),V):(ne(),new Vo)}else{if(l===34||l===39||l===40||Gx(l))return ne(),new Vo;if(l===92)if(C())V.value+=st(_());else return ne(),new Vo;else V.value+=st(l)}}throw new Error("Internal error")},_=function(){if(f(),t0(l)){const V=[l];for(let W=0;W<5&&t0(u());W++)f(),V.push(l);Qn(u())&&f();let J=parseInt(V.map(function(W){return String.fromCharCode(W)}).join(""),16);return J>Kx&&(J=65533),J}else return g()?65533:l},N=function(V,J){return!(V!==92||Io(J))},C=function(){return N(l,u())},$=function(V,J,W){return V===45?$o(J)||J===45||N(J,W):$o(V)?!0:V===92?N(V,J):!1},I=function(){return $(l,u(1),u(2))},D=function(V,J,W){return V===43||V===45?!!(Rt(J)||J===46&&Rt(W)):V===46?!!Rt(J):!!Rt(V)},K=function(){return D(l,u(1),u(2))},Q=function(){let V="";for(;f();)if(n0(l))V+=st(l);else if(C())V+=st(_());else return h(),V;throw new Error("Internal parse error")},q=function(){let V="",J="integer";for((u()===43||u()===45)&&(f(),V+=st(l));Rt(u());)f(),V+=st(l);if(u(1)===46&&Rt(u(2)))for(f(),V+=st(l),f(),V+=st(l),J="number";Rt(u());)f(),V+=st(l);const W=u(1),Ae=u(2),B=u(3);if((W===69||W===101)&&Rt(Ae))for(f(),V+=st(l),f(),V+=st(l),J="number";Rt(u());)f(),V+=st(l);else if((W===69||W===101)&&(Ae===43||Ae===45)&&Rt(B))for(f(),V+=st(l),f(),V+=st(l),f(),V+=st(l),J="number";Rt(u());)f(),V+=st(l);const P=j(V);return{type:J,value:P,repr:V}},j=function(V){return+V},ne=function(){for(;f();){if(l===41||g())return;C()&&_()}};let le=0;for(;!g(u());)if(r.push(y()),le++,le>e.length*2)throw new Error("I'm infinite-looping!");return r}class Qe{constructor(){this.tokenType=""}toJSON(){return{token:this.tokenType}}toString(){return this.tokenType}toSource(){return""+this}}class lb extends Qe{constructor(){super(...arguments),this.tokenType="BADSTRING"}}class Vo extends Qe{constructor(){super(...arguments),this.tokenType="BADURL"}}class ic extends Qe{constructor(){super(...arguments),this.tokenType="WHITESPACE"}toString(){return"WS"}toSource(){return" "}}class ob extends Qe{constructor(){super(...arguments),this.tokenType="CDO"}toSource(){return"<!--"}}class cb extends Qe{constructor(){super(...arguments),this.tokenType="CDC"}toSource(){return"-->"}}class ub extends Qe{constructor(){super(...arguments),this.tokenType=":"}}class fb extends Qe{constructor(){super(...arguments),this.tokenType=";"}}class hb extends Qe{constructor(){super(...arguments),this.tokenType=","}}class Er extends Qe{constructor(){super(...arguments),this.value="",this.mirror=""}}class db extends Er{constructor(){super(),this.tokenType="{",this.value="{",this.mirror="}"}}class pb extends Er{constructor(){super(),this.tokenType="}",this.value="}",this.mirror="{"}}class gb extends Er{constructor(){super(),this.tokenType="[",this.value="[",this.mirror="]"}}class kh extends Er{constructor(){super(),this.tokenType="]",this.value="]",this.mirror="["}}class mb extends Er{constructor(){super(),this.tokenType="(",this.value="(",this.mirror=")"}}class Ph extends Er{constructor(){super(),this.tokenType=")",this.value=")",this.mirror="("}}class Xx extends Qe{constructor(){super(...arguments),this.tokenType="~="}}class Fx extends Qe{constructor(){super(...arguments),this.tokenType="|="}}class Qx extends Qe{constructor(){super(...arguments),this.tokenType="^="}}class Jx extends Qe{constructor(){super(...arguments),this.tokenType="$="}}class Px extends Qe{constructor(){super(...arguments),this.tokenType="*="}}class yb extends Qe{constructor(){super(...arguments),this.tokenType="||"}}class Go extends Qe{constructor(){super(...arguments),this.tokenType="EOF"}toSource(){return""}}class dt extends Qe{constructor(e){super(),this.tokenType="DELIM",this.value="",this.value=st(e)}toString(){return"DELIM("+this.value+")"}toJSON(){const e=this.constructor.prototype.constructor.prototype.toJSON.call(this);return e.value=this.value,e}toSource(){return this.value==="\\"?\ ./node_modules/playwright-core/lib/vite/traceViewer/assets/defaultSettingsView-CJSZINFr.js:266:,i)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const i=qo(e),r=cr(i);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const i=qo(e),r=cr(i);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,i){return this.type!=="comment"||this.indent<=i?!1:e.every(r=>r.type==="newline"||r.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}function zS(n){const e=n.prettyErrors!==!1;return{lineCounter:n.lineCounter||e&&new RS||null,prettyErrors:e}}function sC(n,e={}){const{lineCounter:i,prettyErrors:r}=zS(e),l=new Id(i==null?void 0:i.addNewLine),o=new $d(e),u=Array.from(o.compose(l.parse(n)));if(r&&i)for(const f of u)f.errors.forEach(dc(n,i)),f.warnings.forEach(dc(n,i));return u.length>0?u:Object.assign([],{empty:!0},o.streamInfo())}function BS(n,e={}){const{lineCounter:i,prettyErrors:r}=zS(e),l=new Id(i==null?void 0:i.addNewLine),o=new $d(e);let u=null;for(const f of o.compose(l.parse(n),!0,n.length))if(!u)u=f;else if(u.options.logLevel!=="silent"){u.errors.push(new hs(f.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&i&&(u.errors.forEach(dc(n,i)),u.warnings.forEach(dc(n,i))),u}function rC(n,e,i){let r;typeof e=="function"?r=e:i===void 0&&e&&typeof e=="object"&&(i=e);const l=BS(n,i);if(!l)return null;if(l.warnings.forEach(o=>iS(l.options.logLevel,o)),l.errors.length>0){if(l.options.logLevel!=="silent")throw l.errors[0];l.errors=[]}return l.toJS(Object.assign({reviver:r},i))}function aC(n,e,i){let r=null;if(typeof e=="function"||Array.isArray(e)?r=e:i===void 0&&e&&(i=e),typeof i=="string"&&(i=i.length),typeof i=="number"){const l=Math.round(i);i=l<1?void 0:l>8?{indent:8}:{indent:l}}if(n===void 0){const{keepUndefined:l}=i??e??{};if(!l)return}return bs(n)&&!r?n.toString(i):new Rr(n,r,i).toString(i)}const US=Object.freeze(Object.defineProperty({__proto__:null,Alias:_c,CST:tC,Composer:$d,Document:Rr,Lexer:LS,LineCounter:RS,Pair:vt,Parser:Id,Scalar:he,Schema:jc,YAMLError:Hd,YAMLMap:Xt,YAMLParseError:hs,YAMLSeq:Di,YAMLWarning:xS,isAlias:ys,isCollection:$e,isDocument:bs,isMap:Mr,isNode:Ie,isPair:He,isScalar:Le,isSeq:Or,parse:rC,parseAllDocuments:sC,parseDocument:BS,stringify:aC,visit:Ri,visitAsync:xc},Symbol.toStringTag,{value:"Module"})),lC=({action:n,model:e,sdkLanguage:i,testIdAttributeName:r,isInspecting:l,setIsInspecting:o,highlightedElement:u,setHighlightedElement:f})=>{const[h,g]=U.useState("action"),[y]=on("shouldPopulateCanvasFromScreenshot",!1),m=U.useMemo(()=>fC(n),[n]),{snapshotInfoUrl:w,snapshotUrl:v,popoutUrl:E}=U.useMemo(()=>{const _=m[h];return e&&_?hC(e.traceUri,_,y):{snapshotInfoUrl:void 0,snapshotUrl:void 0,popoutUrl:void 0}},[m,h,y,e]),x=U.useMemo(()=>w!==void 0?{snapshotInfoUrl:w,snapshotUrl:v,popoutUrl:E}:void 0,[w,v,E]);return S.jsxs("div",{className:"snapshot-tab vbox",children:[S.jsxs(nd,{children:[S.jsx(Ht,{className:"pick-locator",title:"Pick locator",icon:"target",toggled:l,onClick:()=>o(!l)}),S.jsx("div",{className:"hbox",style:{height:"100%"},role:"tablist",children:["action","before","after"].map(_=>S.jsx(Hb,{id:_,title:uC(_),selected:h===_,onSelect:()=>g(_)},_))}),S.jsx("div",{style:{flex:"auto"}}),S.jsx(Ht,{icon:"link-external",title:"Open snapshot in a new tab",disabled:!(x!=null&&x.popoutUrl),onClick:()=>{const _=window.open((x==null?void 0:x.popoutUrl)||"","_blank");_==null||_.addEventListener("DOMContentLoaded",()=>{new qv(_,{isUnderTest:qS,sdkLanguage:i,testIdAttributeName:r,stableRafCount:1,browserName:"chromium",customEngines:[]}).consoleApi.install()})}})]}),S.jsx(oC,{snapshotUrls:x,sdkLanguage:i,testIdAttributeName:r,isInspecting:l,setIsInspecting:o,highlightedElement:u,setHighlightedElement:f})]})},oC=({snapshotUrls:n,sdkLanguage:e,testIdAttributeName:i,isInspecting:r,setIsInspecting:l,highlightedElement:o,setHighlightedElement:u})=>{const f=U.useRef(null),h=U.useRef(null),[g,y]=U.useState({viewport:$S,url:""}),m=U.useRef({iteration:0,visibleIframe:0});return U.useEffect(()=>{(async()=>{const w=m.current.iteration+1,v=1-m.current.visibleIframe;m.current.iteration=w;const E=await dC(n==null?void 0:n.snapshotInfoUrl);if(m.current.iteration!==w)return;const x=[f,h][v].current;if(x){let _=()=>{};const N=new Promise(C=>_=C);try{x.addEventListener("load",_),x.addEventListener("error",_);const C=(n==null?void 0:n.snapshotUrl)||pC;x.contentWindow?x.contentWindow.location.replace(C):x.src=C,await N}catch{}finally{x.removeEventListener("load",_),x.removeEventListener("error",_)}}m.current.iteration===w&&(m.current.visibleIframe=v,y(E))})()},[n]),S.jsxs("div",{className:"vbox",tabIndex:0,onKeyDown:w=>{w.key==="Escape"&&r&&l(!1)},children:[S.jsx(Y0,{isInspecting:r,sdkLanguage:e,testIdAttributeName:i,highlightedElement:o,setHighlightedElement:u,iframe:f.current,iteration:m.current.iteration}),S.jsx(Y0,{isInspecting:r,sdkLanguage:e,testIdAttributeName:i,highlightedElement:o,setHighlightedElement:u,iframe:h.current,iteration:m.current.iteration}),S.jsx(cC,{snapshotInfo:g,children:S.jsxs("div",{className:"snapshot-switcher",children:[S.jsx("iframe",{ref:f,name:"snapshot",title:"DOM Snapshot",className:Fe(m.current.visibleIframe===0&&"snapshot-visible")}),S.jsx("iframe",{ref:h,name:"snapshot",title:"DOM Snapshot",className:Fe(m.current.visibleIframe===1&&"snapshot-visible")})]})})]})},cC=({snapshotInfo:n,children:e})=>{const[i,r]=gs(),l=40,o={width:n.viewport.width,height:n.viewport.height},u={width:Math.max(o.width,480),height:Math.max(o.height+l,320)},f=Math.min(i.width/u.width,i.height/u.height,1),h={x:(i.width-u.width)/2,y:(i.height-u.height)/2};return S.jsx("div",{ref:r,className:"snapshot-wrapper",children:S.jsxs("div",{className:"snapshot-container",style:{width:u.width+"px",height:u.height+"px",transform:translate(${h.x}px, ${h.y}px) scale(${f})},children:[S.jsx(PA,{url:n.url}),S.jsx("div",{className:"snapshot-browser-body",children:S.jsx("div",{style:{width:o.width+"px",height:o.height+"px"},children:e})})]})})};function uC(n){return n==="before"?"Before":n==="after"?"After":n==="action"?"Action":n}const Y0=({iframe:n,isInspecting:e,sdkLanguage:i,testIdAttributeName:r,highlightedElement:l,setHighlightedElement:o,iteration:u})=>(U.useEffect(()=>{const f=l.lastEdited==="ariaSnapshot"?l.ariaSnapshot:void 0,h=l.lastEdited==="locator"?l.locator:void 0,g=!!f||!!h||e,y=[],m=new URLSearchParams(window.location.search).get("isUnderTest")==="true";try{HS(y,g,i,r,m,"",n==null?void 0:n.contentWindow)}catch{}const w=f?id(US,f):void 0,v=h?QA(i,h,r):void 0;for(const{recorder:E,frameSelector:x}of y){const _=v!=null&&v.startsWith(x)?v.substring(x.length).trim():void 0,N=(w==null?void 0:w.errors.length)===0?w.fragment:void 0;E.setUIState({mode:e?"inspecting":"none",actionSelector:_,ariaTemplate:N,language:i,testIdAttributeName:r,overlay:{offsetX:0}},{async elementPicked(C){o({locator:Oi(i,x+C.selector),ariaSnapshot:C.ariaSnapshot,lastEdited:"none"})},highlightUpdated(){for(const C of y)C.recorder!==E&&C.recorder.clearHighlight()}})}},[n,e,l,o,i,r,u]),S.jsx(S.Fragment,{}));function HS(n,e,i,r,l,o,u){if(!u)return;const f=u;if(!f._recorder&&e){const h=new qv(u,{isUnderTest:l,sdkLanguage:i,testIdAttributeName:r,stableRafCount:1,browserName:"chromium",customEngines:[]}),g=new GA(h);f._injectedScript=h,f._recorder={recorder:g,frameSelector:o},l&&(window._weakRecordersForTest=window._weakRecordersForTest||new Set,window._weakRecordersForTest.add(new WeakRef(g)))}f._recorder&&n.push(f._recorder);for(let h=0;h<u.frames.length;++h){const g=u.frames[h],y=g.frameElement?f._injectedScript.generateSelectorSimple(g.frameElement,{omitInternalEngines:!0,testIdAttributeName:r})+" >> internal:control=enter-frame >> ":"";HS(n,e,i,r,l,o+y,g)}}const Ha=(n,e,i=!1)=>{if(!n)return;const r=n[e];if(r){if(!n.pageId){console.error("snapshot action must have a pageId");return}return{action:n,snapshotName:r,pageId:n.pageId,point:n.point,hasInputTarget:i}}};function fC(n){if(!n)return{};let e=Ha(n,"beforeSnapshot");if(!e){for(let l=Wy(n);l;l=Wy(l))if(l.endTime<=n.startTime&&l.afterSnapshot){e=Ha(l,"afterSnapshot");break}}let i=Ha(n,"afterSnapshot");if(!i){let l;for(let o=e0(n);o&&o.startTime<=n.endTime;o=e0(o))o.endTime>n.endTime||!o.afterSnapshot||l&&l.endTime>o.endTime||(l=o);l?i=Ha(l,"afterSnapshot"):i=e}const r=Ha(n,"inputSnapshot",!0)??i;return r&&(r.point=n.point),{action:r,before:e,after:i}}const qS=new URLSearchParams(window.location.search).has("isUnderTest");function hC(n,e,i){const r=new URLSearchParams;r.set("trace",n),r.set("name",e.snapshotName),qS&&r.set("isUnderTest","true"),e.point&&(r.set("pointX",String(e.point.x)),r.set("pointY",String(e.point.y)),e.hasInputTarget&&r.set("hasInputTarget","1")),i&&r.set("shouldPopulateCanvasFromScreenshot","1");const l=new URL(snapshot/${e.pageId}?${r.toString()},window.location.href).toString(),o=new URL(snapshotInfo/${e.pageId}?${r.toString()},window.location.href).toString(),u=new URLSearchParams;u.set("r",l),u.set("trace",n);const f=new URL(snapshot.html?${u.toString()},window.location.href).toString();return{snapshotInfoUrl:o,snapshotUrl:l,popoutUrl:f}}async function dC(n){const e={url:"",viewport:$S,timestamp:void 0,wallTime:void 0};if(n){const r=await(await fetch(n)).json();r.error||(e.url=r.url,e.viewport=r.viewport,e.timestamp=r.timestamp,e.wallTime=r.wallTime)}return e}const $S={width:1280,height:720},pC='data:text/html,<body style="background: #ddd"></body>',IS={width:200,height:45},hr=2.5,gC=IS.height+hr*2,mC=({boundaries:n,previewPoint:e})=>{var y,m;const i=ti(),[r,l]=gs(),o=U.useRef(null);let u=0;if(o.current&&e){const w=o.current.getBoundingClientRect();u=(e.clientY-w.top+o.current.scrollTop)/gC|0}const f=(m=(y=i==null?void 0:i.pages)==null?void 0:y[u])==null?void 0:m.screencastFrames;let h,g;if(e!==void 0&&f&&f.length){const w=n.minimum+(n.maximum-n.minimum)*e.x/r.width;h=f[F0(f,w,VS)-1];const v={width:Math.min(800,window.innerWidth/2|0),height:Math.min(800,window.innerHeight/2|0)};g=h?GS({width:h.width,height:h.height},v):void 0}return S.jsxs("div",{className:"film-strip",ref:l,children:[S.jsx("div",{className:"film-strip-lanes",ref:o,children:i==null?void 0:i.pages.map((w,v)=>w.screencastFrames.length?S.jsx(yC,{boundaries:n,page:w,width:r.width},v):null)}),i&&(e==null?void 0:e.x)!==void 0&&S.jsxs("div",{className:"film-strip-hover",style:{top:r.bottom+5,left:Math.min(e.x,r.width-(g?g.width:0)-10)},children:[e.action&&S.jsx("div",{className:"film-strip-hover-title",children:ed(e.action,e)}),h&&g&&S.jsx("div",{style:{width:g.width,height:g.height},children:S.jsx("img",{src:i.createRelativeUrl(sha1/${h.sha1}),width:g.width,height:g.height})})]})]})},yC=({boundaries:n,page:e,width:i})=>{const r=ti(),l={width:0,height:0},o=e.screencastFrames;for(const _ of o)l.width=Math.max(l.width,_.width),l.height=Math.max(l.height,_.height);const u=GS(l,IS),f=o[0].timestamp,h=o[o.length-1].timestamp,g=n.maximum-n.minimum,y=(f-n.minimum)/g*i,m=(n.maximum-h)/g*i,v=(h-f)/g*i/(u.width+2*hr)|0,E=(h-f)/v,x=[];for(let _=0;f&&E&&_<v;++_){const N=f+E*_,C=F0(o,N,VS)-1;x.push(S.jsx("div",{className:"film-strip-frame",style:{width:u.width,height:u.height,backgroundImage:url(${r==null?void 0:r.createRelativeUrl("sha1/"+o[C].sha1)}),backgroundSize:${u.width}px ${u.height}px,margin:hr,marginRight:hr}},_))}return x.push(S.jsx("div",{className:"film-strip-frame",style:{width:u.width,height:u.height,backgroundImage:url(${r==null?void 0:r.createRelativeUrl("sha1/"+o[o.length-1].sha1)}),backgroundSize:${u.width}px {u.height}px`,margin:hr,marginRight:hr}},x.length)),S.jsx("div",{className:"film-strip-lane",style:{marginLeft:y+"px",marginRight:m+"px"},children:x})};function VS(n,e){return n-e.timestamp}function GS(n,e){const i=Math.max(n.width/e.width,n.height/e.height);return{width:n.width/i|0,height:n.height/i|0}}const bC=({model:n,boundaries:e,consoleEntries:i,networkResources:r,onSelected:l,highlightedAction:o,highlightedResourceOrdinal:u,highlightedConsoleEntryOrdinal:f,selectedTime:h,setSelectedTime:g,sdkLanguage:y})=>{const[m,w]=gs(),[v,E]=U.useState(),[x,_]=U.useState(),[N]=on("actionsFilter",[]),{offsets:C,curtainLeft:,curtainRight:I}=U.useMemo(()=>{let J=h||e;if(v&&v.startX!==v.endX){const P=En(m.width,e,v.startX),se=En(m.width,e,v.endX);J={minimum:Math.min(P,se),maximum:Math.max(P,se)}}const W=an(m.width,e,J.minimum),B=an(m.width,e,e.maximum)-an(m.width,e,J.maximum);return{offsets:vC(m.width,e),curtainLeft:W,curtainRight:B}},[h,e,v,m]),D=U.useMemo(()=>n==null?void 0:n.filteredActions(N),[n,N]),K=U.useMemo(()=>{const J=[];for(const W of D||[])J.push({action:W,leftTime:W.startTime,rightTime:W.endTime||e.maximum,leftPosition:an(m.width,e,W.startTime),rightPosition:an(m.width,e,W.endTime||e.maximum),active:!1,error:!!W.error});for(const W of(n==null?void 0:n.resources)||[]){const Ae=W.monotonicTime,B=W.monotonicTime+W.time;J.push({resource:W,leftTime:Ae,rightTime:B,leftPosition:an(m.width,e,Ae),rightPosition:an(m.width,e,B),active:!1,error:!1})}for(const W of i||[])J.push({consoleMessage:W,leftTime:W.timestamp,rightTime:W.timestamp,leftPosition:an(m.width,e,W.timestamp),rightPosition:an(m.width,e,W.timestamp),active:!1,error:W.isError});return J},[n,D,i,e,m]);U.useMemo(()=>{for(const J of K)o?J.active=J.action===o:u!==void 0?J.active=J.resource===(r==null?void 0:r[u]):f!==void 0?J.active=J.consoleMessage===(i==null?void 0:i[f]):J.active=!1},[K,o,u,f,i,r]);const Q=U.useCallback(J=>{if((void 0),!w.current)return;const W=J.clientX-w.current.getBoundingClientRect().left,Ae=En(m.width,e,W),B=h?an(m.width,e,h.minimum):0,P=h?an(m.width,e,h.maximum):0;h&&Math.abs(W-B)<10?E({startX:P,endX:W,type:"resize"}):h&&Math.abs(W-P)<10?E({startX:B,endX:W,type:"resize"}):h&&Ae>h.minimum&&Ae<h.maximum&&J.clientY-w.current.getBoundingClientRect().top<20?E({startX:B,endX:P,pivot:W,type:"move"}):E({startX:W,endX:W,type:"resize"})},[e,m,w,h]),q=U.useCallback(J=>{if(!w.current)return;const W=J.clientX-w.current.getBoundingClientRect().left,Ae=En(m.width,e,W),B=D==null?void 0:D.findLast(we=>we.startTime<=Ae);if(!J.buttons){E(void 0);return}if(B&&l(B),!v)return;let P=v;if(v.type==="resize")P={...v,endX:W};else{const we=W-v.pivot;let k=v.startX+we,Y=v.endX+we;k<0&&(k=0,Y=k+(v.endX-v.startX)),Y>m.width&&(Y=m.width,k=Y-(v.endX-v.startX)),P={...v,startX:k,endX:Y,pivot:W}}E(P);const se=En(m.width,e,P.startX),Se=En(m.width,e,P.endX);se!==Se&&g({minimum:Math.min(se,Se),maximum:Math.max(se,Se)})},[e,v,m,D,l,w,g]),j=U.useCallback(()=>{if((void 0),!!v){if(v.startX!==v.endX){const J=En(m.width,e,v.startX),W=En(m.width,e,v.endX);g({minimum:Math.min(J,W),maximum:Math.max(J,W)})}else{const J=En(m.width,e,v.startX),W=D==null?void 0:D.findLast(Ae=>Ae.startTime<=J);W&&l(W),g(void 0)}E(void 0)}},[e,v,m,D,g,l]),ne=U.useCallback(J=>{if(!w.current)return;const W=J.clientX-w.current.getBoundingClientRect().left,Ae=En(m.width,e,W),B=D==null?void 0:D.findLast(P=>P.startTime<=Ae);({x:W,clientY:J.clientY,action:B,sdkLanguage:y})},[e,m,D,w,y]),le=U.useCallback(()=>{(void 0)},[]),V=U.useCallback(()=>{g(void 0)},[g]);return S.jsxs("div",{className:"timeline-view-container",children:[!!v&&S.jsx(jb,{cursor:(v==null?void 0:v.type)==="resize"?"ew-resize":"grab",onPaneMouseUp:j,onPaneMouseMove:q,onPaneDoubleClick:V}),S.jsxs("div",{ref:w,className:"timeline-view",onMouseDown:Q,onMouseMove:ne,onMouseLeave:le,children:[S.jsx("div",{className:"timeline-grid",children:C.map((J,W)=>S.jsx("div",{className:"timeline-divider",style:{left:J.position+"px"},children:S.jsx("div",{className:"timeline-time",children:Et(J.time-e.minimum)})},W))}),S.jsx("div",{style:{height:8}}),S.jsx(mC,{boundaries:e,previewPoint:x}),S.jsx("div",{className:"timeline-bars",children:K.filter(J=>!J.action||J.action.class!=="Test").map((J,W)=>S.jsx("div",{className:Fe("timeline-bar",J.action&&"action",J.resource&&"network",J.consoleMessage&&"console-message",J.active&&"active",J.error&&"error"),style:{left:J.leftPosition,width:Math.max(5,J.rightPosition-J.leftPosition),top:SC(J),bottom:0}},W))}),S.jsx("div",{className:"timeline-marker",style:{display:x!==void 0?"block":"none",left:((x==null?void 0:x.x)||0)+"px"}}),h&&S.jsxs("div",{className:"timeline-window",children:[S.jsx("div",{className:"timeline-window-curtain left",style:{width:$}}),S.jsx("div",{className:"timeline-window-resizer",style:{left:-5}}),S.jsx("div",{className:"timeline-window-center",children:S.jsx("div",{className:"timeline-window-drag"})}),S.jsx("div",{className:"timeline-window-resizer",style:{left:5}}),S.jsx("div",{className:"timeline-window-curtain right",style:{width:I}})]})]})]})};function vC(n,e){let r=n/64;const l=e.maximum-e.minimum,o=n/l;let u=l/r;const f=Math.ceil(Math.log(u)/Math.LN10);u=Math.pow(10,f),uo>=320&&(u=u/5),uo>=128&&(u=u/2);const h=e.minimum;let g=e.maximum;g+=64/o,r=Math.ceil((g-h)/u),u||(r=0);const y=[];for(let m=0;m<r;++m){const w=h+u*m;y.push({position:an(n,e,w),time:w})}return y}function an(n,e,i){return(i-e.minimum)/(e.maximum-e.minimum)n}function En(n,e,i){return i/n(e.maximum-e.minimum)+e.minimum}function SC(n){return n.resource?25:20}const wC=({model:n})=>{var i,r;if(!n)return S.jsx(S.Fragment,{});const e=n.wallTime!==void 0?new Date(n.wallTime).toLocaleString(void 0,{timeZoneName:"short"}):void 0;return S.jsxs("div",{style:{flex:"auto",display:"block",overflow:"hidden auto"},children:[S.jsx("div",{className:"call-section",style:{paddingTop:2},children:"Time"}),!!e&&S.jsxs("div",{className:"call-line",children:["start time:",S.jsx("span",{className:"call-value datetime",title:e,children:e})]}),S.jsxs("div",{className:"call-line",children:["duration:",S.jsx("span",{className:"call-value number",title:Et(n.endTime-n.startTime),children:Et(n.endTime-n.startTime)})]}),S.jsx("div",{className:"call-section",children:"Browser"}),S.jsxs("div",{className:"call-line",children:["engine:",S.jsx("span",{className:"call-value string",title:n.browserName,children:n.browserName})]}),n.channel&&S.jsxs("div",{className:"call-line",children:["channel:",S.jsx("span",{className:"call-value string",title:n.channel,children:n.channel})]}),n.platform&&S.jsxs("div",{className:"call-line",children:["platform:",S.jsx("span",{className:"call-value string",title:n.platform,children:n.platform})]}),n.playwrightVersion&&S.jsxs("div",{className:"call-line",children:["playwright version:",S.jsx("span",{className:"call-value string",title:n.playwrightVersion,children:n.playwrightVersion})]}),n.options.userAgent&&S.jsxs("div",{className:"call-line",children:["user agent:",S.jsx("span",{className:"call-value datetime",title:n.options.userAgent,children:n.options.userAgent})]}),n.options.baseURL&&S.jsxs(S.Fragment,{children:[S.jsx("div",{className:"call-section",style:{paddingTop:2},children:"Config"}),S.jsxs("div",{className:"call-line",children:["baseURL:",S.jsx("a",{className:"call-value string",href:n.options.baseURL,title:n.options.baseURL,target:"blank",rel:"noopener noreferrer",children:n.options.baseURL})]})]}),S.jsx("div",{className:"call-section",children:"Viewport"}),n.options.viewport&&S.jsxs("div",{className:"call-line",children:["width:",S.jsx("span",{className:"call-value number",title:String(!!((i=n.options.viewport)!=null&&i.width)),children:n.options.viewport.width})]}),n.options.viewport&&S.jsxs("div",{className:"call-line",children:["height:",S.jsx("span",{className:"call-value number",title:String(!!((r=n.options.viewport)!=null&&r.height)),children:n.options.viewport.height})]}),S.jsxs("div",{className:"call-line",children:["is mobile:",S.jsx("span",{className:"call-value boolean",title:String(!!n.options.isMobile),children:String(!!n.options.isMobile)})]}),n.options.deviceScaleFactor&&S.jsxs("div",{className:"call-line",children:["device scale:",S.jsx("span",{className:"call-value number",title:String(n.options.deviceScaleFactor),children:String(n.options.deviceScaleFactor)})]}),S.jsx("div",{className:"call-section",children:"Counts"}),S.jsxs("div",{className:"call-line",children:["pages:",S.jsx("span",{className:"call-value number",children:n.pages.length})]}),S.jsxs("div",{className:"call-line",children:["actions:",S.jsx("span",{className:"call-value number",children:n.actions.length})]}),S.jsxs("div",{className:"call-line",children:["events:",S.jsx("span",{className:"call-value number",children:n.events.length})]})]})},xC=({annotations:n})=>n.length?S.jsx("div",{className:"annotations-tab",children:n.map((e,i)=>S.jsxs("div",{className:"annotation-item",children:[S.jsx("span",{style:{fontWeight:"bold"},children:e.type}),e.description&&S.jsxs("span",{children:[": ",Db(e.description)]})]},annotation-${i}))}):S.jsx(ms,{text:"No annotations"}),C=({sdkLanguage:n,isInspecting:e,setIsInspecting:i,highlightedElement:r,setHighlightedElement:l})=>{const[o,u]=U.useState(),f=U.useCallback(h=>{const{errors:g}=id(US,h,{prettyErrors:!1}),y=g.map(m=>({message:m.message,line:m.range[1].line,column:m.range[1].col,type:"subtle-error"}));u(y),l({...r,ariaSnapshot:h,lastEdited:"ariaSnapshot"}),i(!1)},[r,l,i]);return S.jsxs("div",{style:{flex:"auto",backgroundColor:"var(--vscode-sideBar-background)",padding:"0 10px 10px 10px",overflow:"auto"},children:[S.jsxs("div",{className:"hbox",style:{lineHeight:"28px",color:"var(--vscode-editorCodeLens-foreground)"},children:[S.jsx("div",{children:"Locator"}),S.jsx(Ht,{style:{margin:"0 4px"},title:"Pick locator",icon:"target",toggled:e,onClick:()=>i(!e)}),S.jsx("div",{style:{flex:"auto"}}),S.jsx(Ht,{icon:"files",title:"Copy locator",onClick:()=>{Vy(r.locator||"")}})]}),S.jsx("div",{style:{height:50},children:S.jsx(xr,{text:r.locator||"",highlighter:n,isFocused:!0,wrapLines:!0,onChange:h=>{l({...r,locator:h,lastEdited:"locator"}),i(!1)}})}),S.jsxs("div",{className:"hbox",style:{lineHeight:"28px",color:"var(--vscode-editorCodeLens-foreground)"},children:[S.jsx("div",{style:{flex:"auto"},children:"Aria snapshot"}),S.jsx(Ht,{icon:"files",title:"Copy snapshot",onClick:()=>{Vy(r.ariaSnapshot||"")}})]}),S.jsx("div",{style:{height:150},children:S.jsx(xr,{text:r.ariaSnapshot||"",highlighter:"yaml",wrapLines:!1,highlight:o,onChange:f})})]})},TC=({className:n,style:e,open:i,isModal:r,minWidth:l,verticalOffset:o,requestClose:u,anchor:f,dataTestId:h,children:g})=>{const y=U.useRef(null),[m,w]=U.useState(0),[v]=Eh(y),[E,x]=Eh(f),=f?EC(v,E,o):void 0;return U.useEffect(()=>{const N==>{!y.current||!(.target instanceof Node)||y.current.contains($.target)||u==null||u()},C==>{.key==="Escape"&&(u==null||u())};return i?(document.addEventListener("mousedown",N),document.addEventListener("keydown",C),()=>{document.removeEventListener("mousedown",N),document.removeEventListener("keydown",C)}):()=>{}},[i,u]),U.useLayoutEffect(()=>x(),[i,x]),U.useEffect(()=>{const N=()=>w(C=>C+1);return window.addEventListener("resize",N),()=>{window.removeEventListener("resize",N)}},[]),U.useLayoutEffect(()=>{y.current&&(i?r?y.current.showModal():y.current.show():y.current.close())},[i,r]),S.jsx("dialog",{ref:y,style:{position:"fixed",margin:?0:void 0,zIndex:110,top:==null?void 0:.top,left:==null?void 0:.left,minWidth:l||0,...e},className:n,"data-testid":h,children:g})};function EC(n,e,i=4,r=4){let l=Math.max(r,e.left);l+n.width>window.innerWidth-r&&(l=window.innerWidth-n.width-r);let o=Math.max(0,e.bottom)+i;return o+n.height>window.innerHeight-i&&(Math.max(0,e.top)>n.height+i?o=Math.max(0,e.top)-n.height-i:o=window.innerHeight-i-n.height),{left:l,top:o}}const AC=({title:n,icon:e,buttonChildren:i,anchorRef:r,dialogDataTestId:l,children:o})=>{const u=U.useRef(null),f=r??u,[h,g]=U.useState(!1);return S.jsxs(S.Fragment,{children:[S.jsx(Ht,{ref:u,icon:e,title:n,onClick:()=>g(y=>!y),children:i}),S.jsx(TC,{style:{backgroundColor:"var(--vscode-sideBar-background)",padding:"4px 8px"},open:h,verticalOffset:8,requestClose:()=>g(!1),anchor:f,dataTestId:l,children:o})]})},KS=({settings:n})=>S.jsx("div",{className:"vbox settings-view",children:n.map(e=>{const i=setting-${e.name.replaceAll(/\s+/g,"-")};return S.jsx("div",{className:setting setting-${e.type},title:e.title,children:NC(e,i)},e.name)})}),NC=(n,e)=>{switch(n.type){case"check":return S.jsxs(S.Fragment,{children:[S.jsx("input",{type:"checkbox",id:e,checked:n.value,onChange:()=>n.set(!n.value)}),S.jsxs("label",{htmlFor:e,children:[n.name,!!n.count&&S.jsx("span",{className:"setting-counter",children:n.count})]})]});case"select":return S.jsxs(S.Fragment,{children:[S.jsxs("label",{htmlFor:e,children:[n.name,":",!!n.count&&S.jsx("span",{className:"setting-counter",children:n.count})]}),S.jsx("select",{id:e,value:n.value,onChange:i=>n.set(i.target.value),children:n.options.map(i=>S.jsx("option",{value:i.value,children:i.label},i.value))})]});default:return null}},HC=n=>{var i;const e=MC((i=n.model)==null?void 0:i.traceUri);return S.jsx(zb.Provider,{value:n.model,children:S.jsx(CC,{partition:e,...n})})},CC=n=>{var gl;const{partition:e,model:i,showSourcesFirst:r,rootDir:l,fallbackLocation:o,isLive:u,hideTimeline:f,status:h,annotations:g,inert:y,onOpenExternally:m,revealSource:w,testRunMetadata:v}=n,[E,x]=on("navigatorTab","actions"),[,N]=on("propertiesTab",r?"source":"call"),[C,$]=on("propertiesSidebarLocation","bottom"),[I]=on("actionsFilter",[]),[D,K]=ki("selectedCallId"),[Q,q]=ki("selectedTime"),[j,ne]=ki("highlightedCallId"),[le,V]=ki("revealedErrorKey"),[J,W]=ki("highlightedConsoleMessageOrdinal"),[Ae,B]=ki("revealedAttachmentCallId"),[P,se]=ki("highlightedResourceOrdinal"),[Se,we]=ki("treeState",{expandedItems:new Map});hx(e);const[k,Y]=U.useState({lastEdited:"none"}),[Z,ee]=U.useState(!1),ue=U.useCallback(ce=>{K(ce==null?void 0:ce.callId),V(void 0)},[K,V]),re=U.useMemo(()=>i==null?void 0:i.filteredActions(I),[i,I]),xe=((i==null?void 0:i.actions.length)??0)-((re==null?void 0:re.length)??0),tt=U.useMemo(()=>re==null?void 0:re.find(ce=>ce.callId===j),[re,j]),Re=U.useCallback(ce=>{ne(ce==null?void 0:ce.callId)},[ne]),Bi=U.useMemo(()=>(i==null?void 0:i.sources)||new Map,[i]);U.useEffect(()=>{q(void 0),V(void 0)},[i,q,V]);const kn=U.useMemo(()=>{if(D){const Sn=re==null?void 0:re.find(Ft=>Ft.callId===D);if(Sn)return Sn}const ce=i==null?void 0:i.failedAction();if(ce)return ce;if(re!=null&&re.length){let Sn=re.length-1;for(let Ft=0;Ft<re.length;++Ft)if(re[Ft].title==="After Hooks"&&Ft){Sn=Ft-1;break}return re[Sn]}},[i,re,D]),hn=U.useMemo(()=>tt||kn,[kn,tt]),Dr=U.useCallback(ce=>{ue(ce),Re(void 0)},[ue,Re]),nt=U.useCallback(ce=>{N(ce),ce!=="inspector"&&ee(!1)},[N]),vs=U.useCallback(ce=>{!Z&&ce&&nt("inspector"),ee(ce)},[ee,nt,Z]),zr=U.useCallback(ce=>{Y(ce),nt("inspector")},[nt]),zc=U.useCallback(ce=>{nt("attachments"),B({callId:ce})},[nt,B]);U.useEffect(()=>{w&&nt("source")},[w,nt]);const Ss=rT(i,Q),Ui=MT(i,Q),ni=eT(i),Br=U.useMemo(()=>{var ce;return le!==void 0?(ce=ni.errors.get(le))==null?void 0:ce.stack:hn==null?void 0:hn.stack},[hn,le,ni]),ii=(i==null?void 0:i.sdkLanguage)||"javascript",Bc={id:"inspector",title:"Locator",render:()=>S.jsx(C,{sdkLanguage:ii,isInspecting:Z,setIsInspecting:vs,highlightedElement:k,setHighlightedElement:Y})},St={id:"call",title:"Call",render:()=>S.jsx(w,{action:hn,startTimeOffset:(i==null?void 0:i.startTime)??0,sdkLanguage:ii})},Uc={id:"log",title:"Log",render:()=>S.jsx(T,{action:hn,isLive:u})},dl={id:"errors",title:"Errors",errorCount:ni.errors.size,render:()=>S.jsx(nT,{errorsModel:ni,testRunMetadata:v,sdkLanguage:ii,revealInSource:ce=>{ce.action?ue(ce.action):V(ce.message),nt("source")},wallTime:(i==null?void 0:i.wallTime)??0})};let Ur;!kn&&o&&(Ur=(gl=o.source)==null?void 0:gl.errors.length);const si={id:"source",title:"Source",errorCount:Ur,render:()=>S.jsx(P_,{stack:Br,sources:Bi,rootDir:l,stackFrameLocation:C==="bottom"?"right":"bottom",fallbackLocation:o,onOpenExternally:m})},Hc={id:"console",title:"Console",count:Ss.entries.length,render:()=>S.jsx(aT,{consoleModel:Ss,boundaries:Mn,selectedTime:Q,onAccepted:ce=>q({minimum:ce.timestamp,maximum:ce.timestamp}),onEntryHovered:W})},pl={id:"network",title:"Network",count:Ui.resources.length,render:()=>S.jsx(OT,{boundaries:Mn,networkModel:Ui,onResourceHovered:se,sdkLanguage:(i==null?void 0:i.sdkLanguage)??"javascript"})},qc={id:"attachments",title:"Attachments",count:i==null?void 0:i.visibleAttachments.length,render:()=>S.jsx(V_,{revealedAttachmentCallId:Ae})},Hi=[Bc,St,Uc,dl,Hc,pl,si,qc];if(g!==void 0){const ce={id:"annotations",title:"Annotations",count:g.length,render:()=>S.jsx(xC,{annotations:g})};Hi.push(ce)}if(r){const ce=Hi.indexOf(si);Hi.splice(ce,1),Hi.splice(1,0,si)}const{boundaries:Mn}=U.useMemo(()=>{const ce={minimum:(i==null?void 0:i.startTime)||0,maximum:(i==null?void 0:i.endTime)||3e4};return ce.minimum>ce.maximum&&(ce.minimum=0,ce.maximum=3e4),ce.maximum+=(ce.maximum-ce.minimum)/20,{boundaries:ce}},[i]);let rt=0;!u&&i&&i.endTime>=0?rt=i.endTime-i.startTime:i&&i.wallTime&&(rt=Date.now()-i.wallTime);const vn={id:"actions",title:"Actions",component:S.jsxs("div",{className:"vbox",children:[h&&S.jsxs("div",{className:"workbench-run-status","data-testid":"workbench-run-status",children:[S.jsx("span",{className:Fe("codicon",Mb(h))}),S.jsx("div",{children:b_(h)}),S.jsx("div",{className:"spacer"}),S.jsx("div",{className:"workbench-run-duration",children:rt?Et(rt):""})]}),S.jsx(S_,{sdkLanguage:ii,actions:re||[],selectedAction:i?kn:void 0,selectedTime:Q,setSelectedTime:q,treeState:Se,setTreeState:we,onSelected:Dr,onHighlighted:Re,revealActionAttachment:zc,revealConsole:()=>nt("console"),isLive:u})]})},wt={id:"metadata",title:"Metadata",component:S.jsx(wC,{model:i})},$c=E==="actions"&&S.jsx(kC,{counters:i==null?void 0:i.actionCounters,hiddenActionsCount:xe});return S.jsxs("div",{className:"vbox workbench",...y?{inert:!0}:{},children:[!f&&S.jsx(bC,{model:i,consoleEntries:Ss.entries,networkResources:Ui.resources,boundaries:Mn,highlightedAction:tt,highlightedResourceOrdinal:P,highlightedConsoleEntryOrdinal:J,onSelected:Dr,sdkLanguage:ii,selectedTime:Q,setSelectedTime:q}),S.jsx(nc,{sidebarSize:250,orientation:C==="bottom"?"vertical":"horizontal",settingName:"propertiesSidebar",main:S.jsx(nc,{sidebarSize:250,orientation:"horizontal",sidebarIsFirst:!0,settingName:"actionListSidebar",main:S.jsx(lC,{action:hn,model:i,sdkLanguage:ii,testIdAttributeName:(i==null?void 0:i.testIdAttributeName)||"data-testid",isInspecting:Z,setIsInspecting:vs,highlightedElement:k,setHighlightedElement:zr}),sidebar:S.jsx(jh,{tabs:[vn,wt],rightToolbar:[$c],selectedTab:E,setSelectedTab:x})}),sidebar:S.jsx(jh,{tabs:Hi,selectedTab:_,setSelectedTab:nt,rightToolbar:[C==="bottom"?S.jsx(Ht,{title:"Dock to right",icon:"layout-sidebar-right-off",onClick:()=>{$("right")}}):S.jsx(Ht,{title:"Dock to bottom",icon:"layout-panel-off",onClick:()=>{$("bottom")}})],mode:C==="bottom"?"default":"select"})})]})},kC=({counters:n,hiddenActionsCount:e})=>{const[i,r]=on("actionsFilter",[]),l=U.useRef(null),o=S.jsxs(S.Fragment,{children:[e>0&&S.jsxs("span",{className:"workbench-actions-hidden-count",title:e+" actions hidden by filters",children:[e," hidden"]}),S.jsx("span",{ref:l,className:"codicon codicon-filter"})]});return S.jsx(AC,{title:"Filter actions",dialogDataTestId:"actions-filter-dialog",buttonChildren:o,anchorRef:l,children:S.jsx(KS,{settings:[{type:"check",value:i.includes("getter"),set:u=>r(u?[...i,"getter"]:i.filter(f=>f!=="getter")),name:"Getters",count:n==null?void 0:n.get("getter")},{type:"check",value:i.includes("route"),set:u=>r(u?[...i,"route"]:i.filter(f=>f!=="route")),name:"Network routes",count:n==null?void 0:n.get("route")},{type:"check",value:i.includes("configuration"),set:u=>r(u?[...i,"configuration"]:i.filter(f=>f!=="configuration")),name:"Configuration",count:n==null?void 0:n.get("configuration")}]})})};function MC(n){if(!n)return"default";const e=new URL(n,"http://localhost");return e.searchParams.delete("timestamp"),e.toString()}var X0;(n=>{function e(i){for(const r of i.splice(0))r.dispose()}n.disposeAll=e})(X0||(X0={}));class ur{constructor(){this._listeners=new Set,this.event=(e,i)=>{this._listeners.add(e);let r=!1;const l=this,o={dispose(){r||(r=!0,l._listeners.delete(e))}};return i&&i.push(o),o}}fire(e){const i=!this._deliveryQueue;this._deliveryQueue||(this._deliveryQueue=[]);for(const r of this._listeners)this._deliveryQueue.push({listener:r,event:e});if(i){for(let r=0;r<this._deliveryQueue.length;r++){const{listener:l,event:o}=this._deliveryQueue[r];l.call(null,o)}this._deliveryQueue=void 0}}dispose(){this._listeners.clear(),this._deliveryQueue&&(this._deliveryQueue=[])}}class OC extends Error{constructor(){super("Test server connection closed")}}class qC{constructor(e){this._ws=new WebSocket(e)}onmessage(e){this._ws.addEventListener("message",i=>e(i.data.toString()))}onopen(e){this._ws.addEventListener("open",e)}onerror(e){this._ws.addEventListener("error",e)}onclose(e){this._ws.addEventListener("close",e)}send(e){this._ws.send(e)}close(){this._ws.close()}}class $C{constructor(e){this._onCloseEmitter=new ur,this._onReportEmitter=new ur,this._onStdioEmitter=new ur,this._onTestFilesChangedEmitter=new ur,this._onLoadTraceRequestedEmitter=new ur,this._onTestPausedEmitter=new ur,this._lastId=0,this._callbacks=new Map,this._isClosed=!1,this.onClose=this._onCloseEmitter.event,this.onReport=this._onReportEmitter.event,this.onStdio=this._onStdioEmitter.event,this.onTestFilesChanged=this._onTestFilesChangedEmitter.event,this.onLoadTraceRequested=this._onLoadTraceRequestedEmitter.event,this.onTestPaused=this._onTestPausedEmitter.event,this._transport=e,this._transport.onmessage(r=>{const l=JSON.parse(r),{id:o,result:u,error:f,method:h,params:g}=l;if(o){const y=this._callbacks.get(o);if(!y)return;this._callbacks.delete(o),f?y.reject(new Error(f)):y.resolve(u)}else this._dispatchEvent(h,g)});const i=setInterval(()=>this._sendMessage("ping").catch(()=>{}),3e4);this._connectedPromise=new Promise((r,l)=>{this._transport.onopen(r),this._transport.onerror(l)}),this._transport.onclose(()=>{this._isClosed=!0,this._onCloseEmitter.fire(),clearInterval(i);for(const r of this._callbacks.values())r.reject(new OC);this._callbacks.clear()})}isClosed(){return this._isClosed}async _sendMessage(e,i){const r=globalThis.__logForTest;r==null||r({method:e,params:i}),await this._connectedPromise;const l=++this._lastId,o={id:l,method:e,params:i};return this._transport.send(JSON.stringify(o)),new Promise((u,f)=>{this._callbacks.set(l,{resolve:u,reject:f})})}_sendMessageNoReply(e,i){this._sendMessage(e,i).catch(()=>{})}_dispatchEvent(e,i){e==="report"?this._onReportEmitter.fire(i):e==="stdio"?this._onStdioEmitter.fire(i):e==="testFilesChanged"?this._onTestFilesChangedEmitter.fire(i):e==="loadTraceRequested"?this._onLoadTraceRequestedEmitter.fire(i):e==="testPaused"&&this._onTestPausedEmitter.fire(i)}async initialize(e){await this._sendMessage("initialize",e)}async ping(e){await this._sendMessage("ping",e)}async pingNoReply(e){this._sendMessageNoReply("ping",e)}async watch(e){await this._sendMessage("watch",e)}watchNoReply(e){this._sendMessageNoReply("watch",e)}async open(e){await this._sendMessage("open",e)}openNoReply(e){this._sendMessageNoReply("open",e)}async resizeTerminal(e){await this._sendMessage("resizeTerminal",e)}resizeTerminalNoReply(e){this._sendMessageNoReply("resizeTerminal",e)}async checkBrowsers(e){return await this._sendMessage("checkBrowsers",e)}async installBrowsers(e){await this._sendMessage("installBrowsers",e)}async runGlobalSetup(e){return await this._sendMessage("runGlobalSetup",e)}async runGlobalTeardown(e){return await this._sendMessage("runGlobalTeardown",e)}async startDevServer(e){return await this._sendMessage("startDevServer",e)}async stopDevServer(e){return await this._sendMessage("stopDevServer",e)}async clearCache(e){return await this._sendMessage("clearCache",e)}async listFiles(e){return await this._sendMessage("listFiles",e)}async listTests(e){return await this._sendMessage("listTests",e)}async runTests(e){return await this._sendMessage("runTests",e)}async findRelatedTestFiles(e){return await this._sendMessage("findRelatedTestFiles",e)}async stopTests(e){await this._sendMessage("stopTests",e)}stopTestsNoReply(e){this._sendMessageNoReply("stopTests",e)}async closeGracefully(e){await this._sendMessage("closeGracefully",e)}close(){try{this.transport.close()}catch{}}}const IC=({location:n})=>{const[e,i]=on("shouldPopulateCanvasFromScreenshot",!1),[r,l]=bx(),[o,u]=on("mergeFiles",!1);return S.jsx(KS,{settings:[{type:"select",value:r,set:l,name:"Theme",options:mx},...n==="ui-mode"?[{type:"check",value:o,set:u,name:"Merge files"}]:[],{type:"check",value:e,set:i,name:"Display canvas content",title:"Attempt to display the captured canvas appearance in the snapshot preview. May not be accurate."}]})};export{AC as D,Rb as E,gt as R,nc as S,BC as T,qC as W,L as ,$C as a,IC as b,HC as c,TC as d,LC as e,zC as f,yx as g,RC as h,DC as i,S as j,Fe as k,m as l,Et as m,nd as n,Ht as o,on as p,KS as q,U as r,ls as s,Mb as t,gs as u,lx as v}; ./node_modules/playwright-core/lib/vite/traceViewer/uiMode.CQJ9SCIQ.js:5:Make sure to serve the website (${window.location}) via HTTPS or localhost.);navigator.serviceWorker.register("sw.bundle.js"),navigator.serviceWorker.controller||await new Promise(o=>{navigator.serviceWorker.oncontrollerchange=()=>o()}),setInterval(function(){fetch("ping")},1e4)}oe.createRoot(document.querySelector("#root")).render(r.jsx(ye,{}))})(); ./node_modules/playwright-core/lib/utils/isomorphic/trace/traceModel.js:74: const url = new URL("http://localhost/" + path); ./node_modules/playwright-core/lib/utils/isomorphic/trace/traceModel.js:76: return url.toString().substring("http://localhost/".length); ./node_modules/playwright-core/types/protocol.d.ts:13987:of the local hostnames (e.g. "localhost") or IP addresses (IPv4 ./node_modules/playwright-core/types/types.d.ts:31: * Page provides methods to interact with a single tab in a [Browser](https://playwright.dev/docs/api/class-browser), ./node_modules/playwright-core/types/types.d.ts:33: * [Browser](https://playwright.dev/docs/api/class-browser) instance might have multiple ./node_modules/playwright-core/types/types.d.ts:34: * [Page](https://playwright.dev/docs/api/class-page) instances. ./node_modules/playwright-core/types/types.d.ts:52: * [EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter) methods, such as on, once` or