shiplightai 0.1.91 → 0.1.92
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/debugger-pw.cjs +2 -2
- package/dist/cjs/fixture.cjs +5 -5
- package/dist/cjs/index.cjs +2 -2
- package/dist/cjs/reporter.cjs +1 -1
- package/dist/cli.js +33 -33
- package/dist/debugger-pw.js +2 -2
- package/dist/fixture.js +5 -5
- package/dist/index.js +2 -2
- package/dist/reporter.js +1 -1
- package/package.json +3 -3
package/dist/fixture.js
CHANGED
|
@@ -4097,7 +4097,7 @@ Based on the above information, please determine if the statement is true.
|
|
|
4097
4097
|
return (async () => {
|
|
4098
4098
|
${o}
|
|
4099
4099
|
})();
|
|
4100
|
-
`)(e,a)}transpile(e){let t=this.generateFunctionCallCode(e.action_data?.kwargs||{});return t?[t.endsWith(";")?t:`${t};`]:["// Skipping function: missing functionName"]}generateFunctionCallCode(e){let t=e.functionName;if(!t)return null;let i;if(Array.isArray(e.args))i=e.args.map(String);else if(Array.isArray(e.parameterNames)){let r=e.parameterValues||[];i=e.parameterNames.map((s,l)=>l<r.length?String(r[l]):"undefined")}else return`await ${t}()`;if(i.length===0)return`await ${t}()`;let n=["page","testContext","request","agent"],o=["undefined","null","true","false"],a=i.map(r=>n.includes(r)||o.includes(r)||/^-?\d+(\.\d+)?$/.test(r)?r:r.startsWith("$")?`agent.agentServices.readVariable('${r.substring(1)}')`:`"${r}"`);return`await ${t}(${a.join(", ")})`}}});import{createHash as ea}from"crypto";var al,Dn=f(()=>{"use strict";Et();al=class{static convertDomElementToHistoryElement(e){let t=this.getParentBranchPath(e),i=this.generateCssSelector(e);return{tagName:e.tagName,xpath:e.xpath,highlightIndex:e.highlightIndex,entireParentBranchPath:t,attributes:e.attributes,shadowRoot:e.shadowRoot,cssSelector:i,pageCoordinates:e.pageCoordinates,viewportCoordinates:e.viewportCoordinates,viewportInfo:e.viewportInfo}}static findHistoryElementInTree(e,t){let i=this.hashDomHistoryElement(e),n=o=>{if(o.highlightIndex!==null){let a=this.hashDomElement(o);if(this.compareHashes(a,i))return o}for(let a of o.children)if(a instanceof Ie){let r=n(a);if(r!==null)return r}return null};return n(t)}static compareHistoryElementAndDomElement(e,t){let i=this.hashDomHistoryElement(e),n=this.hashDomElement(t);return this.compareHashes(i,n)}static hashDomHistoryElement(e){let t=this.parentBranchPathHash(e.entireParentBranchPath),i=this.attributesHash(e.attributes),n=this.xpathHash(e.xpath);return{branchPathHash:t,attributesHash:i,xpathHash:n}}static hashDomElement(e){let t=this.getParentBranchPath(e),i=this.parentBranchPathHash(t),n=this.attributesHash(e.attributes),o=this.xpathHash(e.xpath);return{branchPathHash:i,attributesHash:n,xpathHash:o}}static getParentBranchPath(e){let t=[],i=e;for(;i!==null&&i.parent!==null;)t.push(i),i=i.parent;return t.reverse(),t.map(n=>n.tagName)}static parentBranchPathHash(e){let t=e.join("/");return ea("sha256").update(t).digest("hex")}static attributesHash(e){let t=Object.entries(e).map(([i,n])=>`${i}=${n}`).join("");return ea("sha256").update(t).digest("hex")}static xpathHash(e){return ea("sha256").update(e).digest("hex")}static compareHashes(e,t){return e.branchPathHash===t.branchPathHash&&e.attributesHash===t.attributesHash&&e.xpathHash===t.xpathHash}static generateCssSelector(e){let t=e.attributes.id;if(t)return`#${t}`;let i=e.attributes.class;if(i){let n=i.split(/\s+/).filter(o=>o.trim());if(n.length>0)return`${e.tagName}.${n.join(".")}`}return e.tagName}}});var ta,Mt=f(()=>{"use strict";ta=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e[e.SILENT=4]="SILENT",e))(ta||{})});var It={};mt(It,{evaluateStatement:()=>nt,executeAction:()=>si,executeStep:()=>it,generateActionStep:()=>$t,runTask:()=>ot});var Ct=f(()=>{"use strict";li();kn();vn();_t();dn();hn();un();ft();fn();je();bn();ei();Qt();Ne();Zt();Dn();tt();ti();Et();ii();ni();ri();se();St();Me();Xt();bt();Yt();Be();wt();q();Qe();j();ie();Mt();K();Se()});import{z as rl}from"zod";var sl,cx,Nn=f(()=>{"use strict";sl=class{async execute(e,t,i){let n=t.action_data;if(!n)throw new Error("Action data not found");let o=n.kwargs.statement;if(!o)throw new Error("Missing statement for ai_step");let{runTask:a}=await Promise.resolve().then(()=>(Ct(),It)),r=await a(o,e,i);if(r.status!=="success")throw new Error(r.error||"Task execution failed")}transpile(e,t){let i=e.action_data?.kwargs?.statement;return i?[`await agent.run(page, ${JSON.stringify(i)}, '${t||""}');`]:["// Skipping ai_step: missing statement"]}},cx=rl.object({statement:rl.string().describe('The complete step to execute (e.g., "fill in the login form and submit")')})});var ll,Rn=f(()=>{"use strict";K();P();ll=class{async execute(e,t,i){let n=t.action_data;if(!n)throw new Error("Action data not found");if(typeof n.kwargs.relative_x=="number"&&typeof n.kwargs.relative_y=="number"){let o=F(e,t);if(o){await o.waitFor({state:"attached",timeout:D(i,t.action_data?.kwargs?.timeout_ms)});let a=await o.boundingBox();if(a){let r=a.x+n.kwargs.relative_x+a.width/2,s=a.y+n.kwargs.relative_y+a.height/2;await e.mouse.move(r,s),await e.waitForTimeout(200),await e.mouse.click(r,s),await e.waitForTimeout(500)}}else throw new Error("Element-anchored coordinates provided but no locator found")}else if(typeof n.kwargs.x=="number"&&typeof n.kwargs.y=="number")await e.mouse.move(n.kwargs.x,n.kwargs.y),await e.waitForTimeout(200),await e.mouse.click(n.kwargs.x,n.kwargs.y),await e.waitForTimeout(500);else throw new Error("Missing or invalid coordinates")}transpile(e){let t=e.action_data?.kwargs||{},i=[];return typeof t.relative_x=="number"&&typeof t.relative_y=="number"?(i.push(`action_data: { kwargs: { relative_x: ${t.relative_x}, relative_y: ${t.relative_y} } }`),e.locator?i.push(`locator: ${JSON.stringify(e.locator)}`):e.xpath&&i.push(`xpath: ${JSON.stringify(e.xpath)}`),e.frame_path&&e.frame_path.length>0&&i.push(`frame_path: ${JSON.stringify(e.frame_path)}`)):typeof t.x=="number"&&typeof t.y=="number"&&i.push(`action_data: { kwargs: { x: ${t.x}, y: ${t.y} } }`),['await agent.execAction("click_by_coordinates", page, {',...i.map(n=>` ${n},`),"});"]}}});import{z as cl}from"zod";var dl,fx,Fn=f(()=>{"use strict";dl=class{async execute(e,t,i){let n=t.action_data;if(!n)throw new Error("Action data not found");let o=n.kwargs.statement;if(!o)throw new Error("Missing statement for ai_action");let a=n.kwargs.use_pure_vision,{executeStep:r}=await Promise.resolve().then(()=>(Ct(),It)),s=await r(o,e,i,{usePureVision:a});if(s.status!=="success")throw new Error(s.error||"Action execution failed")}transpile(e,t){let i=e.action_data?.kwargs?.statement;if(!i)return["// Skipping ai_action: missing statement"];let n=JSON.stringify(i),o=e.action_data?.kwargs?.use_pure_vision;return[`await agent.execute(page, ${n}, '${t||""}', ${o});`]}},fx=cl.object({statement:cl.string().describe('The action to perform (e.g., "click the submit button")')})});import{z as ul}from"zod";function ml(e,t){e.register({name:"switch_tab",description:"Switch to a different browser tab by index (0-based).",schema:Mm,async execute(i,n){let o=i.tab_index,{page:a,agentServices:r,actionDescription:s}=n;try{let l={action_description:s||`Switch to tab ${o}`,action_data:{action_name:"switch_tab",kwargs:{page_id:o}}};return await t.execute(a,l,r),{success:!0,actionEntity:l,message:`Switched to tab ${o}`}}catch(l){return{success:!1,error:l.message,actionEntity:{action_description:(s||`Switch to tab ${o}`)+" (failed)",action_data:{action_name:"switch_tab",kwargs:{page_id:o}},feedback:l.message}}}}})}var hl,Mm,ci=f(()=>{"use strict";hl=class{async execute(e,t,i){let n=t.action_data;if(!n)throw new Error("Action data not found");let o=n.kwargs.page_id??n.kwargs.tab_index??0;if(typeof o=="number"){let a=e.context().pages(),r=o===-1?a.length-1:o;if(i){let s=await i.switchTab(r);await s.waitForLoadState("load",{timeout:15e3}).catch(()=>{}),await s.waitForTimeout(500)}}else throw new Error("Missing page_id for switch_tab action")}transpile(e){return['await agent.execAction("switch_tab", page, {',` action_data: { kwargs: { page_id: ${e.action_data?.kwargs?.page_id??e.action_data?.kwargs?.tab_index??0} } },`,"});"]}},Mm=ul.object({tab_index:ul.number().int().nonnegative().describe("Index of the tab to switch to (0-based). Use 0 for first tab, 1 for second, etc.")})});import Im from"fs";import Cm from"path";async function pl(e,t,i,n,o,a){let r=Array.isArray(t)?t:[t];if(r.length===0)throw new Error("No file paths provided for upload");let s=r.map(c=>{if(c.startsWith("/")||c.match(/^[A-Za-z]:\\/))return c;let u=n.testDataDir||process.cwd();return Cm.join(u,c)});h.info(`Uploading files: ${s.join(", ")}`);let l=i.timeout||2e4,d={useFileInput:i.useFileInput||!1,timeout:l};if(i.selector&&typeof i.selector!="string"){let c=i.selector;await Hn(e,c,s,d);return}if(i.selector&&typeof i.selector=="string"){let c=i.selector,u=(c.startsWith("xpath="),e.locator(c));await Hn(e,u,s,d);return}if(o){let c=r.map(m=>`"${m}"`).join(", "),u="";i.targetDescription?u=`Upload ${c} to ${i.targetDescription}`:u=`Upload ${c}`,h.info(`Using AI to handle file upload: ${u}`),await o(e,u,a)}else throw new Error("No selector provided and AI action execution is not available")}async function Hn(e,t,i,n){let{useFileInput:o,timeout:a,mockShowOpenFilePicker:r}=n;if(r){h.info("Using mockShowOpenFilePicker approach");let s=i.map(l=>({path:l,buffer:new Uint8Array(Im.readFileSync(l))}));await e.evaluate(l=>{window.__pw_showOpenFilePicker_mock_files=l},s),await t.click({timeout:a}),await e.waitForTimeout(3e3),await e.evaluate(()=>{delete window.__pw_showOpenFilePicker_mock_files})}else if(o)h.info("Using direct file input approach"),await t.setInputFiles(i,{timeout:a}),await e.waitForTimeout(3e3);else{h.info("Using file chooser approach");let s=e.waitForEvent("filechooser",{timeout:a});s.catch(()=>{}),await t.click({timeout:a}),await(await s).setFiles(i),await e.waitForTimeout(3e3)}h.info(`Successfully uploaded ${i.length} file(s)`)}var di=f(()=>{"use strict";j()});import{z as le}from"zod";async function $m(e,t,i={},n){return{...await W(t,e),action_description:n||"Upload file to element",action_data:{action_name:"upload_file",kwargs:{...i}}}}function gl(e,t){return{action_description:`${e} (failed - element not found)`,action_data:{action_name:"upload_file",kwargs:t},feedback:"Element not found in DOM"}}function wl(e,t){e.register({name:"upload_file",description:'Click on target element (usually contains hints like "Upload file" or "Choose file" etc.) to trigger the file upload dialog, and choose the files to upload',schema:Pm,usesElementIndex:!0,async execute(i,n){let{element_index:o,paths:a}=i,{page:r,agentServices:s,actionDescription:l}=n;try{let d=await Y(n,o);if(!d)return{success:!1,error:`File input element with index ${o} not found`,actionEntity:gl(l||`Upload file to element ${o}`,{index:o,paths:a})};let c=await $m(d,r,{paths:a},l);return await t.execute(r,c,s),{success:!0,actionEntity:c,message:`Uploaded file to element ${o}`}}catch(d){return{success:!1,error:d.message,actionEntity:gl(l||`Upload file to element ${o}`,{index:o,paths:a})}}}})}var fl,Pm,Cx,ui=f(()=>{"use strict";di();q();K();P();fl=class{async execute(e,t,i){let n=t.action_data;if(!n)throw new Error("Action data not found");let o=[];if(n.kwargs.paths?o=Array.isArray(n.kwargs.paths)?n.kwargs.paths:[n.kwargs.paths]:n.kwargs.path&&(o=Array.isArray(n.kwargs.path)?n.kwargs.path:[n.kwargs.path]),o.length===0)throw new Error("No file paths provided for upload_file action");await i.downloadTestDataFiles(o);let a=o.map(d=>i.getTestDataFilePath(d)),r=F(e,t);if(!r)throw new Error("Missing locator for upload_file action");let s=n.kwargs.use_file_input||!1,l=i.getActionSettings().mock_show_open_file_picker??!1;await Hn(e,r,a,{useFileInput:s,timeout:D(i,t.action_data?.kwargs?.timeout_ms),mockShowOpenFilePicker:l})}transpile(e){let t=e.action_data?.kwargs||{},i=[],n={};return t.paths?n.paths=t.paths:t.path&&(n.path=t.path),t.use_file_input&&(n.use_file_input=!0),i.push(`action_data: { kwargs: ${JSON.stringify(n)} }`),e.locator?i.push(`locator: ${JSON.stringify(e.locator)}`):e.xpath&&i.push(`xpath: ${JSON.stringify(e.xpath)}`),e.frame_path&&e.frame_path.length>0&&i.push(`frame_path: ${JSON.stringify(e.frame_path)}`),['await agent.execAction("upload_file", page, {',...i.map(o=>` ${o},`),"});"]}};Pm=le.object({element_index:le.number().int().describe("Index of the target element to trigger the file upload dialog"),paths:le.union([le.string(),le.array(le.string())]).describe('Path to a file, relative to the test project root (e.g. "fixtures/data.csv"), or an array of such paths.'),timeout_ms:le.number().optional().describe("Per-action timeout in ms. Overrides the default 5s action timeout.")});Cx=le.object({element_index:le.number().int().describe("Index of the file input element"),paths:le.union([le.string(),le.array(le.string())]).describe('Path to a file, relative to the test project root (e.g. "fixtures/data.csv"), or an array of such paths.'),timeout_ms:le.number().optional().describe("Per-action timeout in ms. Overrides the default 5s action timeout.")})});import{z as bl}from"zod";function xl(e,t){e.register({name:"wait",description:"Wait for a specified number of seconds before continuing.",schema:Om,async execute(i,n){let{seconds:o}=i,{page:a,agentServices:r,actionDescription:s}=n;try{let l={action_description:s||`Wait ${o} seconds`,action_data:{action_name:"wait",kwargs:{seconds:o}}};return await t.execute(a,l,r),{success:!0,actionEntity:l,message:`Waited ${o} seconds`}}catch(l){return{success:!1,error:l.message,actionEntity:{action_description:(s||`Wait ${o} seconds`)+" (failed)",action_data:{action_name:"wait",kwargs:{seconds:o}},feedback:l.message}}}}})}var yl,Om,hi=f(()=>{"use strict";yl=class{async execute(e,t){let i=t.action_data;if(!i)throw new Error("Action data not found");let n=i.kwargs.seconds||1;await e.waitForTimeout(n*1e3)}transpile(e){return[`await page.waitForTimeout(${(e.action_data?.kwargs?.seconds||1)*1e3});`]}},Om=bl.object({seconds:bl.number().positive().describe("Number of seconds to wait")})});import{z as vl}from"zod";function kl(e,t){e.register({name:"wait_for_download_complete",description:"Wait for an in-progress download to complete.",schema:Lm,async execute(i,n){let{timeout_seconds:o=10}=i,{page:a,agentServices:r}=n;try{let s={action_description:`Wait for download to complete (timeout: ${o}s)`,action_data:{action_name:"wait_for_download_complete",kwargs:{timeout_seconds:o}}};return await t.execute(a,s,r),{success:!0,actionEntity:s,message:"Download completed"}}catch(s){return{success:!1,error:s.message,actionEntity:{action_description:"Wait for download to complete (failed)",action_data:{action_name:"wait_for_download_complete",kwargs:{timeout_seconds:o}},feedback:s.message}}}}})}var _l,Lm,mi=f(()=>{"use strict";_l=class{async execute(e,t,i){let n=t.action_data;if(!n)throw new Error("Action data not found");let o=n.kwargs.timeout_seconds||10;await i.waitForDownloadComplete(e,o)}transpile(e){return['await agent.execAction("wait_for_download_complete", page, {',` action_data: { kwargs: { timeout_seconds: ${e.action_data?.kwargs?.timeout_seconds||10} } },`,"});"]}},Lm=vl.object({timeout_seconds:vl.number().positive().optional().describe("Maximum time in seconds to wait for download to complete (default: 10)")})});import{z as T}from"zod";import"yaml";import"uuid";import"uuid";import"yaml";function Un(e,t){if(!e||typeof e!="string")return e;let i=t instanceof Map?Object.fromEntries(t):t,n=a=>{let r=a.startsWith("$")?a.slice(1):a,s=i[r]??i[`$${r}`];return s!=null?String(s):void 0},o=e;return o=o.replace(/\{\{\s*\$?([^}]+?)\s*\}\}/g,(a,r)=>{let s=n(r.trim());return s!==void 0?s:a}),o=o.replace(/<secret>\$?([\w-]+)<\/secret>/g,(a,r)=>{let s=n(r);return s!==void 0?s:a}),o=o.replace(/\$\{([^}]+)\}/g,(a,r)=>{let s=n(r.trim());return s!==void 0?s:a}),o=o.replace(/\$([a-zA-Z_]\w*)/g,(a,r)=>{let s=n(r);return s!==void 0?s:a}),o}var Gn,Dm,Bn,Nm,Rm,Fm,Hm,Wm,Um,Gm,Bm,at,Pt,El,jm,Wn,gi,Wx,Ux,jn,Tl,Al,Ml,Il,rt,fi,ia,Km,Sl,zm,pi,Vm,Xm,Ym,fe,Jm,qm,Bx,ev,rv,Re=f(()=>{"use strict";Se();Gn=(e=>(e.JS_CODE="JS_CODE",e.AI_MODE="AI_MODE",e))(Gn||{}),Dm="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36",Bn=112,Nm=1920,Rm=1080,Fm=1920,Hm=1080-Bn,Wm=1280,Um=720,Gm=500,Bm=500,at="Desktop Chrome",Pt=(e=>(e.Chromium="chromium",e.Firefox="firefox",e.Webkit="webkit",e))(Pt||{}),El={"Blackberry PlayBook":{name:"Blackberry PlayBook",userAgent:"Mozilla/5.0 (PlayBook; U; RIM Tablet OS 2.1.0; en-US) AppleWebKit/536.2+ (KHTML like Gecko) Version/26.0 Safari/536.2+",screen:{width:600,height:1024},viewport:{width:600,height:1024},deviceScaleFactor:1,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"BlackBerry Z30":{name:"BlackBerry Z30",userAgent:"Mozilla/5.0 (BB10; Touch) AppleWebKit/537.10+ (KHTML, like Gecko) Version/26.0 Mobile Safari/537.10+",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Galaxy Note 3":{name:"Galaxy Note 3",userAgent:"Mozilla/5.0 (Linux; U; Android 4.3; en-us; SM-N900T Build/JSS15J) AppleWebKit/534.30 (KHTML, like Gecko) Version/26.0 Mobile Safari/534.30",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Galaxy Note II":{name:"Galaxy Note II",userAgent:"Mozilla/5.0 (Linux; U; Android 4.1; en-us; GT-N7100 Build/JRO03C) AppleWebKit/534.30 (KHTML, like Gecko) Version/26.0 Mobile Safari/534.30",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Galaxy S III":{name:"Galaxy S III",userAgent:"Mozilla/5.0 (Linux; U; Android 4.0; en-us; GT-I9300 Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/26.0 Mobile Safari/534.30",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Galaxy S5":{name:"Galaxy S5",userAgent:"Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy S8":{name:"Galaxy S8",userAgent:"Mozilla/5.0 (Linux; Android 7.0; SM-G950U Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:740},viewport:{width:360,height:740},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy S9+":{name:"Galaxy S9+",userAgent:"Mozilla/5.0 (Linux; Android 8.0.0; SM-G965U Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:320,height:658},viewport:{width:320,height:658},deviceScaleFactor:4.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy S24":{name:"Galaxy S24",userAgent:"Mozilla/5.0 (Linux; Android 14; SM-S921U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:780},viewport:{width:360,height:780},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy A55":{name:"Galaxy A55",userAgent:"Mozilla/5.0 (Linux; Android 14; SM-A556B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:480,height:1040},viewport:{width:480,height:1040},deviceScaleFactor:2.25,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy Tab S4":{name:"Galaxy Tab S4",userAgent:"Mozilla/5.0 (Linux; Android 8.1.0; SM-T837A) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:712,height:1138},viewport:{width:712,height:1138},deviceScaleFactor:2.25,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy Tab S9":{name:"Galaxy Tab S9",userAgent:"Mozilla/5.0 (Linux; Android 14; SM-X710) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:640,height:1024},viewport:{width:640,height:1024},deviceScaleFactor:2.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"iPad (gen 5)":{name:"iPad (gen 5)",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:768,height:1024},viewport:{width:768,height:1024},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad (gen 6)":{name:"iPad (gen 6)",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:768,height:1024},viewport:{width:768,height:1024},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad (gen 7)":{name:"iPad (gen 7)",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:810,height:1080},viewport:{width:810,height:1080},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad (gen 11)":{name:"iPad (gen 11)",userAgent:"Mozilla/5.0 (iPad; CPU OS 18_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/19E241 Safari/604.1",screen:{width:656,height:944},viewport:{width:656,height:944},deviceScaleFactor:2.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad Mini":{name:"iPad Mini",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:768,height:1024},viewport:{width:768,height:1024},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad Pro 11":{name:"iPad Pro 11",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:834,height:1194},viewport:{width:834,height:1194},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 6":{name:"iPhone 6",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:375,height:667},viewport:{width:375,height:667},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 6 Plus":{name:"iPhone 6 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:414,height:736},viewport:{width:414,height:736},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 7":{name:"iPhone 7",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:375,height:667},viewport:{width:375,height:667},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 7 Plus":{name:"iPhone 7 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:414,height:736},viewport:{width:414,height:736},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 8":{name:"iPhone 8",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:375,height:667},viewport:{width:375,height:667},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 8 Plus":{name:"iPhone 8 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:414,height:736},viewport:{width:414,height:736},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone SE":{name:"iPhone SE",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/26.0 Mobile/14E304 Safari/602.1",screen:{width:320,height:568},viewport:{width:320,height:568},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone SE (3rd gen)":{name:"iPhone SE (3rd gen)",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 18_5 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/26.0 Mobile/19E241 Safari/602.1",screen:{width:375,height:667},viewport:{width:375,height:667},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone X":{name:"iPhone X",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:375,height:812},viewport:{width:375,height:812},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone XR":{name:"iPhone XR",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:414,height:896},viewport:{width:414,height:896},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 11":{name:"iPhone 11",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:414,height:896},viewport:{width:414,height:715},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 11 Pro":{name:"iPhone 11 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:375,height:812},viewport:{width:375,height:635},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 11 Pro Max":{name:"iPhone 11 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:414,height:896},viewport:{width:414,height:715},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 12":{name:"iPhone 12",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 12 Pro":{name:"iPhone 12 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 12 Pro Max":{name:"iPhone 12 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:428,height:926},viewport:{width:428,height:746},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 12 Mini":{name:"iPhone 12 Mini",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:375,height:812},viewport:{width:375,height:629},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 13":{name:"iPhone 13",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 13 Pro":{name:"iPhone 13 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 13 Pro Max":{name:"iPhone 13 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:428,height:926},viewport:{width:428,height:746},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 13 Mini":{name:"iPhone 13 Mini",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:375,height:812},viewport:{width:375,height:629},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 14":{name:"iPhone 14",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 14 Plus":{name:"iPhone 14 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:428,height:926},viewport:{width:428,height:746},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 14 Pro":{name:"iPhone 14 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:393,height:852},viewport:{width:393,height:660},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 14 Pro Max":{name:"iPhone 14 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:430,height:932},viewport:{width:430,height:740},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 15":{name:"iPhone 15",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:393,height:852},viewport:{width:393,height:659},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 15 Plus":{name:"iPhone 15 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:430,height:932},viewport:{width:430,height:739},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 15 Pro":{name:"iPhone 15 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:393,height:852},viewport:{width:393,height:659},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 15 Pro Max":{name:"iPhone 15 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:430,height:932},viewport:{width:430,height:739},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Kindle Fire HDX":{name:"Kindle Fire HDX",userAgent:"Mozilla/5.0 (Linux; U; en-us; KFAPWI Build/JDQ39) AppleWebKit/535.19 (KHTML, like Gecko) Silk/3.13 Safari/535.19 Silk-Accelerated=true",screen:{width:800,height:1280},viewport:{width:800,height:1280},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"LG Optimus L70":{name:"LG Optimus L70",userAgent:"Mozilla/5.0 (Linux; U; Android 4.4.2; en-us; LGMS323 Build/KOT49I.MS32310c) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:384,height:640},viewport:{width:384,height:640},deviceScaleFactor:1.25,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Microsoft Lumia 550":{name:"Microsoft Lumia 550",userAgent:"Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 550) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36 Edge/14.14263",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Microsoft Lumia 950":{name:"Microsoft Lumia 950",userAgent:"Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 950) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36 Edge/14.14263",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:4,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 10":{name:"Nexus 10",userAgent:"Mozilla/5.0 (Linux; Android 6.0.1; Nexus 10 Build/MOB31T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:800,height:1280},viewport:{width:800,height:1280},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 4":{name:"Nexus 4",userAgent:"Mozilla/5.0 (Linux; Android 4.4.2; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:384,height:640},viewport:{width:384,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 5":{name:"Nexus 5",userAgent:"Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 5X":{name:"Nexus 5X",userAgent:"Mozilla/5.0 (Linux; Android 8.0.0; Nexus 5X Build/OPR4.170623.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:732},viewport:{width:412,height:732},deviceScaleFactor:2.625,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 6":{name:"Nexus 6",userAgent:"Mozilla/5.0 (Linux; Android 7.1.1; Nexus 6 Build/N6F26U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:732},viewport:{width:412,height:732},deviceScaleFactor:3.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 6P":{name:"Nexus 6P",userAgent:"Mozilla/5.0 (Linux; Android 8.0.0; Nexus 6P Build/OPP3.170518.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:732},viewport:{width:412,height:732},deviceScaleFactor:3.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 7":{name:"Nexus 7",userAgent:"Mozilla/5.0 (Linux; Android 6.0.1; Nexus 7 Build/MOB30X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:600,height:960},viewport:{width:600,height:960},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nokia Lumia 520":{name:"Nokia Lumia 520",userAgent:"Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 520)",screen:{width:320,height:533},viewport:{width:320,height:533},deviceScaleFactor:1.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nokia N9":{name:"Nokia N9",userAgent:"Mozilla/5.0 (MeeGo; NokiaN9) AppleWebKit/534.13 (KHTML, like Gecko) NokiaBrowser/8.5.0 Mobile Safari/534.13",screen:{width:480,height:854},viewport:{width:480,height:854},deviceScaleFactor:1,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Pixel 2":{name:"Pixel 2",userAgent:"Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:411,height:731},viewport:{width:411,height:731},deviceScaleFactor:2.625,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 2 XL":{name:"Pixel 2 XL",userAgent:"Mozilla/5.0 (Linux; Android 8.0.0; Pixel 2 XL Build/OPD1.170816.004) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:411,height:823},viewport:{width:411,height:823},deviceScaleFactor:3.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 3":{name:"Pixel 3",userAgent:"Mozilla/5.0 (Linux; Android 9; Pixel 3 Build/PQ1A.181105.017.A1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:393,height:786},viewport:{width:393,height:786},deviceScaleFactor:2.75,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 4":{name:"Pixel 4",userAgent:"Mozilla/5.0 (Linux; Android 10; Pixel 4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:353,height:745},viewport:{width:353,height:745},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 4a (5G)":{name:"Pixel 4a (5G)",userAgent:"Mozilla/5.0 (Linux; Android 11; Pixel 4a (5G)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:892},viewport:{width:412,height:765},deviceScaleFactor:2.63,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 5":{name:"Pixel 5",userAgent:"Mozilla/5.0 (Linux; Android 11; Pixel 5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:393,height:851},viewport:{width:393,height:727},deviceScaleFactor:2.75,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 7":{name:"Pixel 7",userAgent:"Mozilla/5.0 (Linux; Android 14; Pixel 7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:915},viewport:{width:412,height:839},deviceScaleFactor:2.625,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Moto G4":{name:"Moto G4",userAgent:"Mozilla/5.0 (Linux; Android 7.0; Moto G (4)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Desktop Chrome HiDPI":{name:"Desktop Chrome HiDPI",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1792,height:1120},viewport:{width:1280,height:720},deviceScaleFactor:2,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Edge HiDPI":{name:"Desktop Edge HiDPI",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36 Edg/141.0.7390.16",screen:{width:1792,height:1120},viewport:{width:1280,height:720},deviceScaleFactor:2,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Firefox HiDPI":{name:"Desktop Firefox HiDPI",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:142.0.1) Gecko/20100101 Firefox/142.0.1",screen:{width:1792,height:1120},viewport:{width:1280,height:720},deviceScaleFactor:2,isMobile:!1,hasTouch:!1,defaultBrowserType:"firefox"},"Desktop Safari":{name:"Desktop Safari",userAgent:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Safari/605.1.15",screen:{width:1792,height:1120},viewport:{width:1280,height:720},deviceScaleFactor:2,isMobile:!1,hasTouch:!1,defaultBrowserType:"webkit"},"Desktop Chrome":{name:"Desktop Chrome",displayName:"Playwright Chromium",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1920,height:1080},viewport:{width:1920,height:1080},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Chrome Medium Resolution":{name:"Desktop Chrome Medium Resolution",displayName:"Playwright Chromium",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1280,height:720},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Chrome (Branded)":{name:"Desktop Chrome (Branded)",displayName:"Google Chrome",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1920,height:1080},viewport:{width:1920,height:1080},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium",channel:"chrome"},"Desktop Chrome Medium Resolution (Branded)":{name:"Desktop Chrome Medium Resolution (Branded)",displayName:"Google Chrome",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1280,height:720},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium",channel:"chrome"},"Desktop Edge":{name:"Desktop Edge",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36 Edg/141.0.7390.16",screen:{width:1920,height:1080},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Edge (Branded)":{name:"Desktop Edge (Branded)",displayName:"Microsoft Edge",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36 Edg/141.0.7390.16",screen:{width:1920,height:1080},viewport:{width:1920,height:1080},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium",channel:"msedge"},"Desktop Edge Medium Resolution (Branded)":{name:"Desktop Edge Medium Resolution (Branded)",displayName:"Microsoft Edge",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36 Edg/141.0.7390.16",screen:{width:1280,height:720},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium",channel:"msedge"},"Desktop Firefox":{name:"Desktop Firefox",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:142.0.1) Gecko/20100101 Firefox/142.0.1",screen:{width:1920,height:1080},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"firefox"}},jm={desktop:["Desktop Chrome","Desktop Chrome Medium Resolution","Desktop Chrome (Branded)","Desktop Chrome Medium Resolution (Branded)","Desktop Edge (Branded)","Desktop Edge Medium Resolution (Branded)","Desktop Safari"],mobile:["iPhone 15 Pro Max","iPhone 15 Pro","iPhone 15 Plus","iPhone 15","iPhone 14 Pro Max","iPhone 14 Pro","iPhone 14 Plus","iPhone 14","iPhone 13 Pro Max","iPhone 13 Pro","iPhone 13","iPhone 13 Mini","iPhone 12 Pro Max","iPhone 12 Pro","iPhone 12","iPhone 12 Mini","iPhone 11 Pro Max","iPhone 11 Pro","iPhone 11","iPhone XR","iPhone X","iPhone SE (3rd gen)","iPhone SE","iPhone 8 Plus","iPhone 8","iPhone 7 Plus","iPhone 7","iPhone 6 Plus","iPhone 6","Galaxy S24","Galaxy A55","Galaxy S9+","Galaxy S8","Galaxy S5","Galaxy Note 3","Galaxy Note II","Galaxy S III","Pixel 7","Pixel 5","Pixel 4a (5G)","Pixel 4","Pixel 3","Pixel 2 XL","Pixel 2","Nexus 6P","Nexus 6","Nexus 5X","Nexus 5","Nexus 4","Moto G4","LG Optimus L70","Microsoft Lumia 950","Microsoft Lumia 550","Nokia Lumia 520","Nokia N9","BlackBerry Z30"]},Wn=(e,t=!1)=>{let i=["chromium"];return t&&i.push("webkit"),jm[e].map(n=>El[n]).filter(n=>n.defaultBrowserType&&i.includes(n.defaultBrowserType))},gi=e=>El[e],Wx={desktop:{label:"Desktop",type:"desktop",devices:Wn("desktop")},mobile:{label:"Mobile Web",type:"mobile",devices:Wn("mobile")}},Ux={desktop:{label:"Desktop",type:"desktop",devices:Wn("desktop",!0)},mobile:{label:"Mobile Web",type:"mobile",devices:Wn("mobile",!0)}},jn=(e,t=!1)=>{let i={userAgent:Dm,viewport:{width:Fm,height:Hm},isMobile:!1,hasTouch:!1};if(!e||e===at)return i;let n=gi(e);if(!n)return i;let{width:o,height:a}=n.viewport,r=Math.max(Gm/o,1),s=Math.max(Bm/a,1),l=Math.max(r,s),d={width:Math.round(o*l),height:Math.round(a*l)};return{userAgent:n.userAgent,viewport:t?d:n.viewport,isMobile:n.isMobile,hasTouch:n.hasTouch}},Tl=e=>{let t={width:Nm,height:Rm};if(!e||e===at)return t;let i=jn(e);return i.viewport?{width:i.viewport.width,height:i.viewport.height+Bn}:t},Al=e=>{let t={width:Wm,height:Um};if(!e||e===at)return t;let i=jn(e);return i.viewport?{width:i.viewport.width,height:i.viewport.height}:t},Ml=e=>!e||e===at?void 0:gi(e)?.channel,Il=e=>!e||e===at?"chromium":gi(e)?.defaultBrowserType??"chromium",rt=(e=>(e.PASSWORD="password",e.OAUTH2="oauth2",e.SSO="sso",e.API="api",e))(rt||{}),fi=(e=>(e.SMS="sms",e.EMAIL="email",e.TOTP="totp",e))(fi||{}),ia=class Cl{constructor(){Ko(this,"data",{}),Ko(this,"sensitive",new Set)}get(t){return this.data[t]}set(t,i,n=!1){this.data[t]=i,n?this.sensitive.add(t):this.sensitive.has(t)&&this.sensitive.delete(t)}getAll(){return{...this.data}}isSensitive(t){return this.sensitive.has(t)}getAllSensitiveKeys(){return new Set(this.sensitive)}delete(t){return this.sensitive.delete(t),delete this.data[t]}clear(){this.data={},this.sensitive.clear()}has(t){return t in this.data}get size(){return Object.keys(this.data).length}merge(t){for(let[i,n]of Object.entries(t.getAll()))this.set(i,n,t.isSensitive(i))}toJSON(){return{data:{...this.data},sensitiveKeys:Array.from(this.sensitive)}}static fromJSON(t){let i=new Cl;if(t.data){let n=new Set(t.sensitiveKeys||[]);for(let[o,a]of Object.entries(t.data))i.set(o,a,n.has(o))}return i}},Km=T.enum(["JS_CODE","AI_MODE"]),Sl=T.object({type:Km,expression:T.string()}),zm=T.enum(["DRAFT","STEP","ACTION","IF_ELSE","WHILE_LOOP"]),pi=T.object({uid:T.string(),type:zm,comment:T.string().optional()}),Vm=T.object({action_data:T.object({action_name:T.string(),kwargs:T.record(T.any()).optional(),args:T.array(T.any()).optional()}),action_description:T.string().optional(),url:T.string().optional(),xpath:T.string().nullable().optional(),locator:T.string().nullable().optional(),css_selector:T.string().nullable().optional(),unique_selector:T.string().nullable().optional(),element_index:T.number().nullable().optional(),frame_path:T.array(T.any()).optional(),artifacts:T.record(T.any()).optional(),feedback:T.string().optional(),original_browser_use_action:T.any().optional()}).passthrough(),Xm=pi.extend({type:T.literal("DRAFT"),description:T.string()}),Ym=pi.extend({type:T.literal("ACTION"),description:T.string(),action_entity:Vm.optional(),locator:T.string().optional(),use_pure_vision:T.boolean().optional()}),fe=T.lazy(()=>T.union([Xm,Ym,pi.extend({type:T.literal("STEP"),description:T.string().optional().default(""),statements:T.array(fe),reference_id:T.number().optional(),template_path:T.string().optional(),template_params:T.record(T.string()).optional()}),pi.extend({type:T.literal("IF_ELSE"),description:T.string().optional(),condition:Sl,then:T.array(fe),else:T.array(fe).optional()}),pi.extend({type:T.literal("WHILE_LOOP"),description:T.string().optional(),condition:Sl,body:T.array(fe),timeout_ms:T.number().optional()})])),Jm=T.object({name:T.string(),statements:T.array(fe),teardown:T.array(fe).optional(),skip:T.union([T.boolean(),T.string()]).optional(),timeout:T.number().optional(),fail:T.union([T.boolean(),T.string()]).optional(),only:T.boolean().optional(),slow:T.boolean().optional()}),qm=T.object({tests:T.array(Jm).min(1),beforeAll:T.array(fe).optional(),afterAll:T.array(fe).optional(),beforeEach:T.array(fe).optional(),afterEach:T.array(fe).optional()}),Bx=T.object({comment:T.string().optional(),version:T.string().optional(),goal:T.string().optional(),url:T.string().optional(),baseURL:T.string().optional(),final_feedback:T.string().optional(),completed:T.boolean().optional(),success:T.boolean().optional(),statements:T.array(fe).optional(),teardown:T.array(fe).optional(),last_modified_at:T.string().optional(),testGroup:qm.optional()}).refine(e=>e.testGroup!==void 0?e.goal===void 0&&(e.statements===void 0||e.statements.length===0):e.goal!==void 0,{message:"TestFlow must have either goal/statements (single test) or testGroup (suite), not both"}),ev=1024*1024,rv=Object.freeze(["anthropic:claude-sonnet-5","google:gemini-3.1-pro-preview"])});var Ve,st=f(()=>{"use strict";Ve=`
|
|
4100
|
+
`)(e,a)}transpile(e){let t=this.generateFunctionCallCode(e.action_data?.kwargs||{});return t?[t.endsWith(";")?t:`${t};`]:["// Skipping function: missing functionName"]}generateFunctionCallCode(e){let t=e.functionName;if(!t)return null;let i;if(Array.isArray(e.args))i=e.args.map(String);else if(Array.isArray(e.parameterNames)){let r=e.parameterValues||[];i=e.parameterNames.map((s,l)=>l<r.length?String(r[l]):"undefined")}else return`await ${t}()`;if(i.length===0)return`await ${t}()`;let n=["page","testContext","request","agent"],o=["undefined","null","true","false"],a=i.map(r=>n.includes(r)||o.includes(r)||/^-?\d+(\.\d+)?$/.test(r)?r:r.startsWith("$")?`agent.agentServices.readVariable('${r.substring(1)}')`:`"${r}"`);return`await ${t}(${a.join(", ")})`}}});import{createHash as ea}from"crypto";var al,Dn=f(()=>{"use strict";Et();al=class{static convertDomElementToHistoryElement(e){let t=this.getParentBranchPath(e),i=this.generateCssSelector(e);return{tagName:e.tagName,xpath:e.xpath,highlightIndex:e.highlightIndex,entireParentBranchPath:t,attributes:e.attributes,shadowRoot:e.shadowRoot,cssSelector:i,pageCoordinates:e.pageCoordinates,viewportCoordinates:e.viewportCoordinates,viewportInfo:e.viewportInfo}}static findHistoryElementInTree(e,t){let i=this.hashDomHistoryElement(e),n=o=>{if(o.highlightIndex!==null){let a=this.hashDomElement(o);if(this.compareHashes(a,i))return o}for(let a of o.children)if(a instanceof Ie){let r=n(a);if(r!==null)return r}return null};return n(t)}static compareHistoryElementAndDomElement(e,t){let i=this.hashDomHistoryElement(e),n=this.hashDomElement(t);return this.compareHashes(i,n)}static hashDomHistoryElement(e){let t=this.parentBranchPathHash(e.entireParentBranchPath),i=this.attributesHash(e.attributes),n=this.xpathHash(e.xpath);return{branchPathHash:t,attributesHash:i,xpathHash:n}}static hashDomElement(e){let t=this.getParentBranchPath(e),i=this.parentBranchPathHash(t),n=this.attributesHash(e.attributes),o=this.xpathHash(e.xpath);return{branchPathHash:i,attributesHash:n,xpathHash:o}}static getParentBranchPath(e){let t=[],i=e;for(;i!==null&&i.parent!==null;)t.push(i),i=i.parent;return t.reverse(),t.map(n=>n.tagName)}static parentBranchPathHash(e){let t=e.join("/");return ea("sha256").update(t).digest("hex")}static attributesHash(e){let t=Object.entries(e).map(([i,n])=>`${i}=${n}`).join("");return ea("sha256").update(t).digest("hex")}static xpathHash(e){return ea("sha256").update(e).digest("hex")}static compareHashes(e,t){return e.branchPathHash===t.branchPathHash&&e.attributesHash===t.attributesHash&&e.xpathHash===t.xpathHash}static generateCssSelector(e){let t=e.attributes.id;if(t)return`#${t}`;let i=e.attributes.class;if(i){let n=i.split(/\s+/).filter(o=>o.trim());if(n.length>0)return`${e.tagName}.${n.join(".")}`}return e.tagName}}});var ta,Mt=f(()=>{"use strict";ta=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e[e.SILENT=4]="SILENT",e))(ta||{})});var It={};mt(It,{evaluateStatement:()=>nt,executeAction:()=>si,executeStep:()=>it,generateActionStep:()=>$t,runTask:()=>ot});var Ct=f(()=>{"use strict";li();kn();vn();_t();dn();hn();un();ft();fn();je();bn();ei();Qt();Ne();Zt();Dn();tt();ti();Et();ii();ni();ri();se();St();Me();Xt();bt();Yt();Be();wt();q();Qe();j();ie();Mt();K();Se()});import{z as rl}from"zod";var sl,cx,Nn=f(()=>{"use strict";sl=class{async execute(e,t,i){let n=t.action_data;if(!n)throw new Error("Action data not found");let o=n.kwargs.statement;if(!o)throw new Error("Missing statement for ai_step");let{runTask:a}=await Promise.resolve().then(()=>(Ct(),It)),r=await a(o,e,i);if(r.status!=="success")throw new Error(r.error||"Task execution failed")}transpile(e,t){let i=e.action_data?.kwargs?.statement;return i?[`await agent.run(page, ${JSON.stringify(i)}, '${t||""}');`]:["// Skipping ai_step: missing statement"]}},cx=rl.object({statement:rl.string().describe('The complete step to execute (e.g., "fill in the login form and submit")')})});var ll,Rn=f(()=>{"use strict";K();P();ll=class{async execute(e,t,i){let n=t.action_data;if(!n)throw new Error("Action data not found");if(typeof n.kwargs.relative_x=="number"&&typeof n.kwargs.relative_y=="number"){let o=F(e,t);if(o){await o.waitFor({state:"attached",timeout:D(i,t.action_data?.kwargs?.timeout_ms)});let a=await o.boundingBox();if(a){let r=a.x+n.kwargs.relative_x+a.width/2,s=a.y+n.kwargs.relative_y+a.height/2;await e.mouse.move(r,s),await e.waitForTimeout(200),await e.mouse.click(r,s),await e.waitForTimeout(500)}}else throw new Error("Element-anchored coordinates provided but no locator found")}else if(typeof n.kwargs.x=="number"&&typeof n.kwargs.y=="number")await e.mouse.move(n.kwargs.x,n.kwargs.y),await e.waitForTimeout(200),await e.mouse.click(n.kwargs.x,n.kwargs.y),await e.waitForTimeout(500);else throw new Error("Missing or invalid coordinates")}transpile(e){let t=e.action_data?.kwargs||{},i=[];return typeof t.relative_x=="number"&&typeof t.relative_y=="number"?(i.push(`action_data: { kwargs: { relative_x: ${t.relative_x}, relative_y: ${t.relative_y} } }`),e.locator?i.push(`locator: ${JSON.stringify(e.locator)}`):e.xpath&&i.push(`xpath: ${JSON.stringify(e.xpath)}`),e.frame_path&&e.frame_path.length>0&&i.push(`frame_path: ${JSON.stringify(e.frame_path)}`)):typeof t.x=="number"&&typeof t.y=="number"&&i.push(`action_data: { kwargs: { x: ${t.x}, y: ${t.y} } }`),['await agent.execAction("click_by_coordinates", page, {',...i.map(n=>` ${n},`),"});"]}}});import{z as cl}from"zod";var dl,fx,Fn=f(()=>{"use strict";dl=class{async execute(e,t,i){let n=t.action_data;if(!n)throw new Error("Action data not found");let o=n.kwargs.statement;if(!o)throw new Error("Missing statement for ai_action");let a=n.kwargs.use_pure_vision,{executeStep:r}=await Promise.resolve().then(()=>(Ct(),It)),s=await r(o,e,i,{usePureVision:a});if(s.status!=="success")throw new Error(s.error||"Action execution failed")}transpile(e,t){let i=e.action_data?.kwargs?.statement;if(!i)return["// Skipping ai_action: missing statement"];let n=JSON.stringify(i),o=e.action_data?.kwargs?.use_pure_vision;return[`await agent.execute(page, ${n}, '${t||""}', ${o});`]}},fx=cl.object({statement:cl.string().describe('The action to perform (e.g., "click the submit button")')})});import{z as ul}from"zod";function ml(e,t){e.register({name:"switch_tab",description:"Switch to a different browser tab by index (0-based).",schema:Mm,async execute(i,n){let o=i.tab_index,{page:a,agentServices:r,actionDescription:s}=n;try{let l={action_description:s||`Switch to tab ${o}`,action_data:{action_name:"switch_tab",kwargs:{page_id:o}}};return await t.execute(a,l,r),{success:!0,actionEntity:l,message:`Switched to tab ${o}`}}catch(l){return{success:!1,error:l.message,actionEntity:{action_description:(s||`Switch to tab ${o}`)+" (failed)",action_data:{action_name:"switch_tab",kwargs:{page_id:o}},feedback:l.message}}}}})}var hl,Mm,ci=f(()=>{"use strict";hl=class{async execute(e,t,i){let n=t.action_data;if(!n)throw new Error("Action data not found");let o=n.kwargs.page_id??n.kwargs.tab_index??0;if(typeof o=="number"){let a=e.context().pages(),r=o===-1?a.length-1:o;if(i){let s=await i.switchTab(r);await s.waitForLoadState("load",{timeout:15e3}).catch(()=>{}),await s.waitForTimeout(500)}}else throw new Error("Missing page_id for switch_tab action")}transpile(e){return['await agent.execAction("switch_tab", page, {',` action_data: { kwargs: { page_id: ${e.action_data?.kwargs?.page_id??e.action_data?.kwargs?.tab_index??0} } },`,"});"]}},Mm=ul.object({tab_index:ul.number().int().nonnegative().describe("Index of the tab to switch to (0-based). Use 0 for first tab, 1 for second, etc.")})});import Im from"fs";import Cm from"path";async function pl(e,t,i,n,o,a){let r=Array.isArray(t)?t:[t];if(r.length===0)throw new Error("No file paths provided for upload");let s=r.map(c=>{if(c.startsWith("/")||c.match(/^[A-Za-z]:\\/))return c;let u=n.testDataDir||process.cwd();return Cm.join(u,c)});h.info(`Uploading files: ${s.join(", ")}`);let l=i.timeout||2e4,d={useFileInput:i.useFileInput||!1,timeout:l};if(i.selector&&typeof i.selector!="string"){let c=i.selector;await Hn(e,c,s,d);return}if(i.selector&&typeof i.selector=="string"){let c=i.selector,u=(c.startsWith("xpath="),e.locator(c));await Hn(e,u,s,d);return}if(o){let c=r.map(m=>`"${m}"`).join(", "),u="";i.targetDescription?u=`Upload ${c} to ${i.targetDescription}`:u=`Upload ${c}`,h.info(`Using AI to handle file upload: ${u}`),await o(e,u,a)}else throw new Error("No selector provided and AI action execution is not available")}async function Hn(e,t,i,n){let{useFileInput:o,timeout:a,mockShowOpenFilePicker:r}=n;if(r){h.info("Using mockShowOpenFilePicker approach");let s=i.map(l=>({path:l,buffer:new Uint8Array(Im.readFileSync(l))}));await e.evaluate(l=>{window.__pw_showOpenFilePicker_mock_files=l},s),await t.click({timeout:a}),await e.waitForTimeout(3e3),await e.evaluate(()=>{delete window.__pw_showOpenFilePicker_mock_files})}else if(o)h.info("Using direct file input approach"),await t.setInputFiles(i,{timeout:a}),await e.waitForTimeout(3e3);else{h.info("Using file chooser approach");let s=e.waitForEvent("filechooser",{timeout:a});s.catch(()=>{}),await t.click({timeout:a}),await(await s).setFiles(i),await e.waitForTimeout(3e3)}h.info(`Successfully uploaded ${i.length} file(s)`)}var di=f(()=>{"use strict";j()});import{z as le}from"zod";async function $m(e,t,i={},n){return{...await W(t,e),action_description:n||"Upload file to element",action_data:{action_name:"upload_file",kwargs:{...i}}}}function gl(e,t){return{action_description:`${e} (failed - element not found)`,action_data:{action_name:"upload_file",kwargs:t},feedback:"Element not found in DOM"}}function wl(e,t){e.register({name:"upload_file",description:'Click on target element (usually contains hints like "Upload file" or "Choose file" etc.) to trigger the file upload dialog, and choose the files to upload',schema:Pm,usesElementIndex:!0,async execute(i,n){let{element_index:o,paths:a}=i,{page:r,agentServices:s,actionDescription:l}=n;try{let d=await Y(n,o);if(!d)return{success:!1,error:`File input element with index ${o} not found`,actionEntity:gl(l||`Upload file to element ${o}`,{index:o,paths:a})};let c=await $m(d,r,{paths:a},l);return await t.execute(r,c,s),{success:!0,actionEntity:c,message:`Uploaded file to element ${o}`}}catch(d){return{success:!1,error:d.message,actionEntity:gl(l||`Upload file to element ${o}`,{index:o,paths:a})}}}})}var fl,Pm,Cx,ui=f(()=>{"use strict";di();q();K();P();fl=class{async execute(e,t,i){let n=t.action_data;if(!n)throw new Error("Action data not found");let o=[];if(n.kwargs.paths?o=Array.isArray(n.kwargs.paths)?n.kwargs.paths:[n.kwargs.paths]:n.kwargs.path&&(o=Array.isArray(n.kwargs.path)?n.kwargs.path:[n.kwargs.path]),o.length===0)throw new Error("No file paths provided for upload_file action");await i.downloadTestDataFiles(o);let a=o.map(d=>i.getTestDataFilePath(d)),r=F(e,t);if(!r)throw new Error("Missing locator for upload_file action");let s=n.kwargs.use_file_input||!1,l=i.getActionSettings().mock_show_open_file_picker??!1;await Hn(e,r,a,{useFileInput:s,timeout:D(i,t.action_data?.kwargs?.timeout_ms),mockShowOpenFilePicker:l})}transpile(e){let t=e.action_data?.kwargs||{},i=[],n={};return t.paths?n.paths=t.paths:t.path&&(n.path=t.path),t.use_file_input&&(n.use_file_input=!0),i.push(`action_data: { kwargs: ${JSON.stringify(n)} }`),e.locator?i.push(`locator: ${JSON.stringify(e.locator)}`):e.xpath&&i.push(`xpath: ${JSON.stringify(e.xpath)}`),e.frame_path&&e.frame_path.length>0&&i.push(`frame_path: ${JSON.stringify(e.frame_path)}`),['await agent.execAction("upload_file", page, {',...i.map(o=>` ${o},`),"});"]}};Pm=le.object({element_index:le.number().int().describe("Index of the target element to trigger the file upload dialog"),paths:le.union([le.string(),le.array(le.string())]).describe('Path to a file, relative to the test project root (e.g. "fixtures/data.csv"), or an array of such paths.'),timeout_ms:le.number().optional().describe("Per-action timeout in ms. Overrides the default 5s action timeout.")});Cx=le.object({element_index:le.number().int().describe("Index of the file input element"),paths:le.union([le.string(),le.array(le.string())]).describe('Path to a file, relative to the test project root (e.g. "fixtures/data.csv"), or an array of such paths.'),timeout_ms:le.number().optional().describe("Per-action timeout in ms. Overrides the default 5s action timeout.")})});import{z as bl}from"zod";function xl(e,t){e.register({name:"wait",description:"Wait for a specified number of seconds before continuing.",schema:Om,async execute(i,n){let{seconds:o}=i,{page:a,agentServices:r,actionDescription:s}=n;try{let l={action_description:s||`Wait ${o} seconds`,action_data:{action_name:"wait",kwargs:{seconds:o}}};return await t.execute(a,l,r),{success:!0,actionEntity:l,message:`Waited ${o} seconds`}}catch(l){return{success:!1,error:l.message,actionEntity:{action_description:(s||`Wait ${o} seconds`)+" (failed)",action_data:{action_name:"wait",kwargs:{seconds:o}},feedback:l.message}}}}})}var yl,Om,hi=f(()=>{"use strict";yl=class{async execute(e,t){let i=t.action_data;if(!i)throw new Error("Action data not found");let n=i.kwargs.seconds||1;await e.waitForTimeout(n*1e3)}transpile(e){return[`await page.waitForTimeout(${(e.action_data?.kwargs?.seconds||1)*1e3});`]}},Om=bl.object({seconds:bl.number().positive().describe("Number of seconds to wait")})});import{z as vl}from"zod";function kl(e,t){e.register({name:"wait_for_download_complete",description:"Wait for an in-progress download to complete.",schema:Lm,async execute(i,n){let{timeout_seconds:o=10}=i,{page:a,agentServices:r}=n;try{let s={action_description:`Wait for download to complete (timeout: ${o}s)`,action_data:{action_name:"wait_for_download_complete",kwargs:{timeout_seconds:o}}};return await t.execute(a,s,r),{success:!0,actionEntity:s,message:"Download completed"}}catch(s){return{success:!1,error:s.message,actionEntity:{action_description:"Wait for download to complete (failed)",action_data:{action_name:"wait_for_download_complete",kwargs:{timeout_seconds:o}},feedback:s.message}}}}})}var _l,Lm,mi=f(()=>{"use strict";_l=class{async execute(e,t,i){let n=t.action_data;if(!n)throw new Error("Action data not found");let o=n.kwargs.timeout_seconds||10;await i.waitForDownloadComplete(e,o)}transpile(e){return['await agent.execAction("wait_for_download_complete", page, {',` action_data: { kwargs: { timeout_seconds: ${e.action_data?.kwargs?.timeout_seconds||10} } },`,"});"]}},Lm=vl.object({timeout_seconds:vl.number().positive().optional().describe("Maximum time in seconds to wait for download to complete (default: 10)")})});import{z as T}from"zod";import"yaml";import"uuid";import"uuid";import"yaml";function Un(e,t){if(!e||typeof e!="string")return e;let i=t instanceof Map?Object.fromEntries(t):t,n=a=>{let r=a.startsWith("$")?a.slice(1):a,s=i[r]??i[`$${r}`];return s!=null?String(s):void 0},o=e;return o=o.replace(/\{\{\s*\$?([^}]+?)\s*\}\}/g,(a,r)=>{let s=n(r.trim());return s!==void 0?s:a}),o=o.replace(/<secret>\$?([\w-]+)<\/secret>/g,(a,r)=>{let s=n(r);return s!==void 0?s:a}),o=o.replace(/\$\{([^}]+)\}/g,(a,r)=>{let s=n(r.trim());return s!==void 0?s:a}),o=o.replace(/\$([a-zA-Z_]\w*)/g,(a,r)=>{let s=n(r);return s!==void 0?s:a}),o}var Gn,at,gi,Dm,Bn,Nm,Rm,Fm,Hm,Wm,Um,Gm,Bm,rt,Pt,El,jm,Wn,fi,Wx,Ux,jn,Tl,Al,Ml,Il,ia,Km,Sl,zm,pi,Vm,Xm,Ym,fe,Jm,qm,Bx,ev,rv,Re=f(()=>{"use strict";Se();Gn=(e=>(e.JS_CODE="JS_CODE",e.AI_MODE="AI_MODE",e))(Gn||{}),at=(e=>(e.PASSWORD="password",e.OAUTH2="oauth2",e.SSO="sso",e.API="api",e))(at||{}),gi=(e=>(e.SMS="sms",e.EMAIL="email",e.TOTP="totp",e))(gi||{}),Dm="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36",Bn=112,Nm=1920,Rm=1080,Fm=1920,Hm=1080-Bn,Wm=1280,Um=720,Gm=500,Bm=500,rt="Desktop Chrome",Pt=(e=>(e.Chromium="chromium",e.Firefox="firefox",e.Webkit="webkit",e))(Pt||{}),El={"Blackberry PlayBook":{name:"Blackberry PlayBook",userAgent:"Mozilla/5.0 (PlayBook; U; RIM Tablet OS 2.1.0; en-US) AppleWebKit/536.2+ (KHTML like Gecko) Version/26.0 Safari/536.2+",screen:{width:600,height:1024},viewport:{width:600,height:1024},deviceScaleFactor:1,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"BlackBerry Z30":{name:"BlackBerry Z30",userAgent:"Mozilla/5.0 (BB10; Touch) AppleWebKit/537.10+ (KHTML, like Gecko) Version/26.0 Mobile Safari/537.10+",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Galaxy Note 3":{name:"Galaxy Note 3",userAgent:"Mozilla/5.0 (Linux; U; Android 4.3; en-us; SM-N900T Build/JSS15J) AppleWebKit/534.30 (KHTML, like Gecko) Version/26.0 Mobile Safari/534.30",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Galaxy Note II":{name:"Galaxy Note II",userAgent:"Mozilla/5.0 (Linux; U; Android 4.1; en-us; GT-N7100 Build/JRO03C) AppleWebKit/534.30 (KHTML, like Gecko) Version/26.0 Mobile Safari/534.30",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Galaxy S III":{name:"Galaxy S III",userAgent:"Mozilla/5.0 (Linux; U; Android 4.0; en-us; GT-I9300 Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/26.0 Mobile Safari/534.30",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Galaxy S5":{name:"Galaxy S5",userAgent:"Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy S8":{name:"Galaxy S8",userAgent:"Mozilla/5.0 (Linux; Android 7.0; SM-G950U Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:740},viewport:{width:360,height:740},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy S9+":{name:"Galaxy S9+",userAgent:"Mozilla/5.0 (Linux; Android 8.0.0; SM-G965U Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:320,height:658},viewport:{width:320,height:658},deviceScaleFactor:4.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy S24":{name:"Galaxy S24",userAgent:"Mozilla/5.0 (Linux; Android 14; SM-S921U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:780},viewport:{width:360,height:780},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy A55":{name:"Galaxy A55",userAgent:"Mozilla/5.0 (Linux; Android 14; SM-A556B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:480,height:1040},viewport:{width:480,height:1040},deviceScaleFactor:2.25,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy Tab S4":{name:"Galaxy Tab S4",userAgent:"Mozilla/5.0 (Linux; Android 8.1.0; SM-T837A) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:712,height:1138},viewport:{width:712,height:1138},deviceScaleFactor:2.25,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy Tab S9":{name:"Galaxy Tab S9",userAgent:"Mozilla/5.0 (Linux; Android 14; SM-X710) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:640,height:1024},viewport:{width:640,height:1024},deviceScaleFactor:2.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"iPad (gen 5)":{name:"iPad (gen 5)",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:768,height:1024},viewport:{width:768,height:1024},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad (gen 6)":{name:"iPad (gen 6)",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:768,height:1024},viewport:{width:768,height:1024},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad (gen 7)":{name:"iPad (gen 7)",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:810,height:1080},viewport:{width:810,height:1080},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad (gen 11)":{name:"iPad (gen 11)",userAgent:"Mozilla/5.0 (iPad; CPU OS 18_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/19E241 Safari/604.1",screen:{width:656,height:944},viewport:{width:656,height:944},deviceScaleFactor:2.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad Mini":{name:"iPad Mini",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:768,height:1024},viewport:{width:768,height:1024},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad Pro 11":{name:"iPad Pro 11",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:834,height:1194},viewport:{width:834,height:1194},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 6":{name:"iPhone 6",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:375,height:667},viewport:{width:375,height:667},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 6 Plus":{name:"iPhone 6 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:414,height:736},viewport:{width:414,height:736},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 7":{name:"iPhone 7",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:375,height:667},viewport:{width:375,height:667},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 7 Plus":{name:"iPhone 7 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:414,height:736},viewport:{width:414,height:736},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 8":{name:"iPhone 8",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:375,height:667},viewport:{width:375,height:667},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 8 Plus":{name:"iPhone 8 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:414,height:736},viewport:{width:414,height:736},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone SE":{name:"iPhone SE",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/26.0 Mobile/14E304 Safari/602.1",screen:{width:320,height:568},viewport:{width:320,height:568},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone SE (3rd gen)":{name:"iPhone SE (3rd gen)",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 18_5 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/26.0 Mobile/19E241 Safari/602.1",screen:{width:375,height:667},viewport:{width:375,height:667},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone X":{name:"iPhone X",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:375,height:812},viewport:{width:375,height:812},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone XR":{name:"iPhone XR",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:414,height:896},viewport:{width:414,height:896},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 11":{name:"iPhone 11",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:414,height:896},viewport:{width:414,height:715},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 11 Pro":{name:"iPhone 11 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:375,height:812},viewport:{width:375,height:635},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 11 Pro Max":{name:"iPhone 11 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:414,height:896},viewport:{width:414,height:715},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 12":{name:"iPhone 12",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 12 Pro":{name:"iPhone 12 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 12 Pro Max":{name:"iPhone 12 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:428,height:926},viewport:{width:428,height:746},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 12 Mini":{name:"iPhone 12 Mini",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:375,height:812},viewport:{width:375,height:629},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 13":{name:"iPhone 13",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 13 Pro":{name:"iPhone 13 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 13 Pro Max":{name:"iPhone 13 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:428,height:926},viewport:{width:428,height:746},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 13 Mini":{name:"iPhone 13 Mini",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:375,height:812},viewport:{width:375,height:629},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 14":{name:"iPhone 14",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 14 Plus":{name:"iPhone 14 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:428,height:926},viewport:{width:428,height:746},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 14 Pro":{name:"iPhone 14 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:393,height:852},viewport:{width:393,height:660},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 14 Pro Max":{name:"iPhone 14 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:430,height:932},viewport:{width:430,height:740},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 15":{name:"iPhone 15",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:393,height:852},viewport:{width:393,height:659},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 15 Plus":{name:"iPhone 15 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:430,height:932},viewport:{width:430,height:739},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 15 Pro":{name:"iPhone 15 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:393,height:852},viewport:{width:393,height:659},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 15 Pro Max":{name:"iPhone 15 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:430,height:932},viewport:{width:430,height:739},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Kindle Fire HDX":{name:"Kindle Fire HDX",userAgent:"Mozilla/5.0 (Linux; U; en-us; KFAPWI Build/JDQ39) AppleWebKit/535.19 (KHTML, like Gecko) Silk/3.13 Safari/535.19 Silk-Accelerated=true",screen:{width:800,height:1280},viewport:{width:800,height:1280},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"LG Optimus L70":{name:"LG Optimus L70",userAgent:"Mozilla/5.0 (Linux; U; Android 4.4.2; en-us; LGMS323 Build/KOT49I.MS32310c) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:384,height:640},viewport:{width:384,height:640},deviceScaleFactor:1.25,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Microsoft Lumia 550":{name:"Microsoft Lumia 550",userAgent:"Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 550) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36 Edge/14.14263",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Microsoft Lumia 950":{name:"Microsoft Lumia 950",userAgent:"Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 950) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36 Edge/14.14263",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:4,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 10":{name:"Nexus 10",userAgent:"Mozilla/5.0 (Linux; Android 6.0.1; Nexus 10 Build/MOB31T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:800,height:1280},viewport:{width:800,height:1280},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 4":{name:"Nexus 4",userAgent:"Mozilla/5.0 (Linux; Android 4.4.2; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:384,height:640},viewport:{width:384,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 5":{name:"Nexus 5",userAgent:"Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 5X":{name:"Nexus 5X",userAgent:"Mozilla/5.0 (Linux; Android 8.0.0; Nexus 5X Build/OPR4.170623.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:732},viewport:{width:412,height:732},deviceScaleFactor:2.625,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 6":{name:"Nexus 6",userAgent:"Mozilla/5.0 (Linux; Android 7.1.1; Nexus 6 Build/N6F26U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:732},viewport:{width:412,height:732},deviceScaleFactor:3.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 6P":{name:"Nexus 6P",userAgent:"Mozilla/5.0 (Linux; Android 8.0.0; Nexus 6P Build/OPP3.170518.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:732},viewport:{width:412,height:732},deviceScaleFactor:3.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 7":{name:"Nexus 7",userAgent:"Mozilla/5.0 (Linux; Android 6.0.1; Nexus 7 Build/MOB30X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:600,height:960},viewport:{width:600,height:960},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nokia Lumia 520":{name:"Nokia Lumia 520",userAgent:"Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 520)",screen:{width:320,height:533},viewport:{width:320,height:533},deviceScaleFactor:1.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nokia N9":{name:"Nokia N9",userAgent:"Mozilla/5.0 (MeeGo; NokiaN9) AppleWebKit/534.13 (KHTML, like Gecko) NokiaBrowser/8.5.0 Mobile Safari/534.13",screen:{width:480,height:854},viewport:{width:480,height:854},deviceScaleFactor:1,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Pixel 2":{name:"Pixel 2",userAgent:"Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:411,height:731},viewport:{width:411,height:731},deviceScaleFactor:2.625,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 2 XL":{name:"Pixel 2 XL",userAgent:"Mozilla/5.0 (Linux; Android 8.0.0; Pixel 2 XL Build/OPD1.170816.004) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:411,height:823},viewport:{width:411,height:823},deviceScaleFactor:3.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 3":{name:"Pixel 3",userAgent:"Mozilla/5.0 (Linux; Android 9; Pixel 3 Build/PQ1A.181105.017.A1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:393,height:786},viewport:{width:393,height:786},deviceScaleFactor:2.75,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 4":{name:"Pixel 4",userAgent:"Mozilla/5.0 (Linux; Android 10; Pixel 4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:353,height:745},viewport:{width:353,height:745},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 4a (5G)":{name:"Pixel 4a (5G)",userAgent:"Mozilla/5.0 (Linux; Android 11; Pixel 4a (5G)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:892},viewport:{width:412,height:765},deviceScaleFactor:2.63,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 5":{name:"Pixel 5",userAgent:"Mozilla/5.0 (Linux; Android 11; Pixel 5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:393,height:851},viewport:{width:393,height:727},deviceScaleFactor:2.75,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 7":{name:"Pixel 7",userAgent:"Mozilla/5.0 (Linux; Android 14; Pixel 7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:915},viewport:{width:412,height:839},deviceScaleFactor:2.625,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Moto G4":{name:"Moto G4",userAgent:"Mozilla/5.0 (Linux; Android 7.0; Moto G (4)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Desktop Chrome HiDPI":{name:"Desktop Chrome HiDPI",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1792,height:1120},viewport:{width:1280,height:720},deviceScaleFactor:2,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Edge HiDPI":{name:"Desktop Edge HiDPI",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36 Edg/141.0.7390.16",screen:{width:1792,height:1120},viewport:{width:1280,height:720},deviceScaleFactor:2,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Firefox HiDPI":{name:"Desktop Firefox HiDPI",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:142.0.1) Gecko/20100101 Firefox/142.0.1",screen:{width:1792,height:1120},viewport:{width:1280,height:720},deviceScaleFactor:2,isMobile:!1,hasTouch:!1,defaultBrowserType:"firefox"},"Desktop Safari":{name:"Desktop Safari",userAgent:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Safari/605.1.15",screen:{width:1792,height:1120},viewport:{width:1280,height:720},deviceScaleFactor:2,isMobile:!1,hasTouch:!1,defaultBrowserType:"webkit"},"Desktop Chrome":{name:"Desktop Chrome",displayName:"Playwright Chromium",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1920,height:1080},viewport:{width:1920,height:1080},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Chrome Medium Resolution":{name:"Desktop Chrome Medium Resolution",displayName:"Playwright Chromium",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1280,height:720},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Chrome (Branded)":{name:"Desktop Chrome (Branded)",displayName:"Google Chrome",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1920,height:1080},viewport:{width:1920,height:1080},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium",channel:"chrome"},"Desktop Chrome Medium Resolution (Branded)":{name:"Desktop Chrome Medium Resolution (Branded)",displayName:"Google Chrome",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1280,height:720},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium",channel:"chrome"},"Desktop Edge":{name:"Desktop Edge",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36 Edg/141.0.7390.16",screen:{width:1920,height:1080},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Edge (Branded)":{name:"Desktop Edge (Branded)",displayName:"Microsoft Edge",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36 Edg/141.0.7390.16",screen:{width:1920,height:1080},viewport:{width:1920,height:1080},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium",channel:"msedge"},"Desktop Edge Medium Resolution (Branded)":{name:"Desktop Edge Medium Resolution (Branded)",displayName:"Microsoft Edge",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36 Edg/141.0.7390.16",screen:{width:1280,height:720},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium",channel:"msedge"},"Desktop Firefox":{name:"Desktop Firefox",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:142.0.1) Gecko/20100101 Firefox/142.0.1",screen:{width:1920,height:1080},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"firefox"}},jm={desktop:["Desktop Chrome","Desktop Chrome Medium Resolution","Desktop Chrome (Branded)","Desktop Chrome Medium Resolution (Branded)","Desktop Edge (Branded)","Desktop Edge Medium Resolution (Branded)","Desktop Safari"],mobile:["iPhone 15 Pro Max","iPhone 15 Pro","iPhone 15 Plus","iPhone 15","iPhone 14 Pro Max","iPhone 14 Pro","iPhone 14 Plus","iPhone 14","iPhone 13 Pro Max","iPhone 13 Pro","iPhone 13","iPhone 13 Mini","iPhone 12 Pro Max","iPhone 12 Pro","iPhone 12","iPhone 12 Mini","iPhone 11 Pro Max","iPhone 11 Pro","iPhone 11","iPhone XR","iPhone X","iPhone SE (3rd gen)","iPhone SE","iPhone 8 Plus","iPhone 8","iPhone 7 Plus","iPhone 7","iPhone 6 Plus","iPhone 6","Galaxy S24","Galaxy A55","Galaxy S9+","Galaxy S8","Galaxy S5","Galaxy Note 3","Galaxy Note II","Galaxy S III","Pixel 7","Pixel 5","Pixel 4a (5G)","Pixel 4","Pixel 3","Pixel 2 XL","Pixel 2","Nexus 6P","Nexus 6","Nexus 5X","Nexus 5","Nexus 4","Moto G4","LG Optimus L70","Microsoft Lumia 950","Microsoft Lumia 550","Nokia Lumia 520","Nokia N9","BlackBerry Z30"]},Wn=(e,t=!1)=>{let i=["chromium"];return t&&i.push("webkit"),jm[e].map(n=>El[n]).filter(n=>n.defaultBrowserType&&i.includes(n.defaultBrowserType))},fi=e=>El[e],Wx={desktop:{label:"Desktop",type:"desktop",devices:Wn("desktop")},mobile:{label:"Mobile Web",type:"mobile",devices:Wn("mobile")}},Ux={desktop:{label:"Desktop",type:"desktop",devices:Wn("desktop",!0)},mobile:{label:"Mobile Web",type:"mobile",devices:Wn("mobile",!0)}},jn=(e,t=!1)=>{let i={userAgent:Dm,viewport:{width:Fm,height:Hm},isMobile:!1,hasTouch:!1};if(!e||e===rt)return i;let n=fi(e);if(!n)return i;let{width:o,height:a}=n.viewport,r=Math.max(Gm/o,1),s=Math.max(Bm/a,1),l=Math.max(r,s),d={width:Math.round(o*l),height:Math.round(a*l)};return{userAgent:n.userAgent,viewport:t?d:n.viewport,isMobile:n.isMobile,hasTouch:n.hasTouch}},Tl=e=>{let t={width:Nm,height:Rm};if(!e||e===rt)return t;let i=jn(e);return i.viewport?{width:i.viewport.width,height:i.viewport.height+Bn}:t},Al=e=>{let t={width:Wm,height:Um};if(!e||e===rt)return t;let i=jn(e);return i.viewport?{width:i.viewport.width,height:i.viewport.height}:t},Ml=e=>!e||e===rt?void 0:fi(e)?.channel,Il=e=>!e||e===rt?"chromium":fi(e)?.defaultBrowserType??"chromium",ia=class Cl{constructor(){Ko(this,"data",{}),Ko(this,"sensitive",new Set)}get(t){return this.data[t]}set(t,i,n=!1){this.data[t]=i,n?this.sensitive.add(t):this.sensitive.has(t)&&this.sensitive.delete(t)}getAll(){return{...this.data}}isSensitive(t){return this.sensitive.has(t)}getAllSensitiveKeys(){return new Set(this.sensitive)}delete(t){return this.sensitive.delete(t),delete this.data[t]}clear(){this.data={},this.sensitive.clear()}has(t){return t in this.data}get size(){return Object.keys(this.data).length}merge(t){for(let[i,n]of Object.entries(t.getAll()))this.set(i,n,t.isSensitive(i))}toJSON(){return{data:{...this.data},sensitiveKeys:Array.from(this.sensitive)}}static fromJSON(t){let i=new Cl;if(t.data){let n=new Set(t.sensitiveKeys||[]);for(let[o,a]of Object.entries(t.data))i.set(o,a,n.has(o))}return i}},Km=T.enum(["JS_CODE","AI_MODE"]),Sl=T.object({type:Km,expression:T.string()}),zm=T.enum(["DRAFT","STEP","ACTION","IF_ELSE","WHILE_LOOP"]),pi=T.object({uid:T.string(),type:zm,comment:T.string().optional()}),Vm=T.object({action_data:T.object({action_name:T.string(),kwargs:T.record(T.any()).optional(),args:T.array(T.any()).optional()}),action_description:T.string().optional(),url:T.string().optional(),xpath:T.string().nullable().optional(),locator:T.string().nullable().optional(),css_selector:T.string().nullable().optional(),unique_selector:T.string().nullable().optional(),element_index:T.number().nullable().optional(),frame_path:T.array(T.any()).optional(),artifacts:T.record(T.any()).optional(),feedback:T.string().optional(),original_browser_use_action:T.any().optional()}).passthrough(),Xm=pi.extend({type:T.literal("DRAFT"),description:T.string()}),Ym=pi.extend({type:T.literal("ACTION"),description:T.string(),action_entity:Vm.optional(),locator:T.string().optional(),use_pure_vision:T.boolean().optional()}),fe=T.lazy(()=>T.union([Xm,Ym,pi.extend({type:T.literal("STEP"),description:T.string().optional().default(""),statements:T.array(fe),reference_id:T.number().optional(),template_path:T.string().optional(),template_params:T.record(T.string()).optional()}),pi.extend({type:T.literal("IF_ELSE"),description:T.string().optional(),condition:Sl,then:T.array(fe),else:T.array(fe).optional()}),pi.extend({type:T.literal("WHILE_LOOP"),description:T.string().optional(),condition:Sl,body:T.array(fe),timeout_ms:T.number().optional()})])),Jm=T.object({name:T.string(),statements:T.array(fe),teardown:T.array(fe).optional(),skip:T.union([T.boolean(),T.string()]).optional(),timeout:T.number().optional(),fail:T.union([T.boolean(),T.string()]).optional(),only:T.boolean().optional(),slow:T.boolean().optional()}),qm=T.object({tests:T.array(Jm).min(1),beforeAll:T.array(fe).optional(),afterAll:T.array(fe).optional(),beforeEach:T.array(fe).optional(),afterEach:T.array(fe).optional()}),Bx=T.object({comment:T.string().optional(),version:T.string().optional(),goal:T.string().optional(),url:T.string().optional(),baseURL:T.string().optional(),final_feedback:T.string().optional(),completed:T.boolean().optional(),success:T.boolean().optional(),statements:T.array(fe).optional(),teardown:T.array(fe).optional(),last_modified_at:T.string().optional(),testGroup:qm.optional()}).refine(e=>e.testGroup!==void 0?e.goal===void 0&&(e.statements===void 0||e.statements.length===0):e.goal!==void 0,{message:"TestFlow must have either goal/statements (single test) or testGroup (suite), not both"}),ev=1024*1024,rv=Object.freeze(["anthropic:claude-sonnet-5","google:gemini-3.1-pro-preview"])});var Ve,st=f(()=>{"use strict";Ve=`
|
|
4101
4101
|
// check to make sure we're not inside the PDF viewer
|
|
4102
4102
|
window.isPdfViewer = !!document?.body?.querySelector('body > embed[type="application/pdf"][width="100%"]')
|
|
4103
4103
|
if (!window.isPdfViewer) {
|
|
@@ -4429,7 +4429,7 @@ ${m.body}`,y=await rg(g,o,t.model);h.info(`Extracted content: ${y}`),y&&y!=="NOT
|
|
|
4429
4429
|
`)}var lo,Aa=f(()=>{"use strict";Sa();Ta();ci();ui();hi();mi();wi();bi();xi();_i();ki();Si();Ei();Ti();Ai();Mi();Ii();Ci();$i();Pi();Oi();Li();Di();Ni();Ri();Fi();Hi();Wi();Ui();lo=null});async function qc(){await cg}function Zc(){return V}function Qc(e=!0){let t=new kt;return e&&(co(t),uo(t),ho(t),mo(t),po(t),go(t),fo(t),bo(t),wo(t),yo(t)),t}async function ed(){let e=new kt,t=await Yc(e),i=Jc(t);return{registry:e,capabilities:t,summary:i}}function td(){return["- Mouse: Click, hover, double-click, right-click or drag on elements","- Navigation: Navigate to URLs, go back, or reload the page","- Input: Type text into inputs, clear input fields, or press keyboard keys","- Scroll: Scroll the page or scroll to specific text/elements","- Tabs: Switch between browser tabs or close tabs","- Files: Upload files or wait for downloads to complete","- Forms: Get dropdown options or select dropdown values","- Utility: Wait for conditions, save variables, or complete tasks","- Auth: Generate 2FA codes or extract email/activation codes","- AI: Perform AI-powered verifications, extractions, or wait conditions"].join(`
|
|
4430
4430
|
`)}var lg,cg,id=f(()=>{"use strict";Aa();Ne();lg=[co(V),uo(V),ho(V),mo(V),po(V),go(V),fo(V),wo(V),yo(V),bo(V)],cg=Promise.all(lg)});function od(e){return e.getTools().map(t=>({name:t.name,description:t.description,inputSchema:pn(t.schema)}))}var nd,ad=f(()=>{"use strict";Zt();nd=class{constructor(e,t){this.registry=e,this.getContext=t}getToolDefinitions(){return this.registry.getTools().filter(e=>e.availability.mcp).map(e=>({name:e.name,description:e.description,inputSchema:pn(e.schema)}))}getToolDefinitionsFiltered(e){let t=new Set(e);return this.registry.getTools().filter(i=>t.has(i.name)&&i.availability.mcp).map(i=>({name:i.name,description:i.description,inputSchema:pn(i.schema)}))}async createServer(e="web-sdk-tools"){throw new Error("MCP server creation not yet implemented. Install and configure an MCP SDK like @modelcontextprotocol/sdk")}async executeTool(e,t){let i=await this.getContext(),n=await this.registry.execute(e,t,i);return{content:[{type:"text",text:n.success?n.message||"Tool executed successfully":n.error||"Tool execution failed"}]}}getToolCount(){return this.registry.size()}getToolNames(){return this.registry.getToolNames()}}});var rd=f(()=>{"use strict"});function Ma(e){let t=e.toLowerCase();return t.includes("claude")||t.includes("anthropic")?"anthropic":t.includes("gemini")||t.includes("google")?"gemini":t.startsWith("gpt")||t.startsWith("o1")||t.startsWith("o3")||t.startsWith("o4")||t.includes("openai")?"openai":"unknown"}function dg(e){switch(e.actionType){case"execute":case"run":return"action";case"generate":return"draft";case"assert":return"verify_ai";case"evaluate":return e.conditionKind==="while"?"evaluate_while":e.conditionKind==="wait_until"?"evaluate_wait_until":"evaluate_if";default:return null}}function sd(e,t){let i=e[t];return typeof i=="number"?i:0}function ug(e,t,i,n){return`${e}\0${t}\0${i}\0${n}`}function ld(e,t={}){let i=t.routing??"proxy",n=t.providerOf??Ma,o=new Map;for(let a of e??[]){let r=dg(a);if(r)for(let s of a.tokenUsages??[]){let l=s.model??"unknown",d=n(l),c=ug(r,d,l,i),u=o.get(c);u||(u={operation:r,provider:d,model:l,routing:i,calls:0,input_tokens:0,output_tokens:0,thinking_tokens:0,cache_read_tokens:0},o.set(c,u)),u.calls+=1,u.input_tokens+=s.prompt_tokens||0,u.output_tokens+=s.completion_tokens||0,u.thinking_tokens+=sd(s,"thinking_tokens"),u.cache_read_tokens+=sd(s,"cache_read_tokens")}}return{by_operation:Array.from(o.values()).sort((a,r)=>a.operation!==r.operation?a.operation.localeCompare(r.operation):a.provider!==r.provider?a.provider.localeCompare(r.provider):a.model.localeCompare(r.model))}}var cd=f(()=>{"use strict"});function dd(){let e=process.env.OMNITERM_BROWSER_REGISTRY_URL;return e?e.replace(/\/$/,""):null}async function Nt(e){let t=dd();if(!t)return null;try{let i=await fetch(`${t}/browsers`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)});return i.ok?(await i.json()).id??null:null}catch{return null}}async function Rt(e){if(!e)return;let t=dd();if(t)try{await fetch(`${t}/browsers/${encodeURIComponent(e)}`,{method:"DELETE"})}catch{}}var Ia=f(()=>{"use strict"});import lt from"fs";import hg from"os";import ji from"path";import{chromium as ud,firefox as mg,webkit as pg}from"playwright";async function gg(e,t){let i=JSON.parse(lt.readFileSync(t,"utf-8"));i.cookies?.length&&await e.addCookies(i.cookies)}var hd,md=f(()=>{"use strict";Ia();Re();Ce();st();j();hd=class{constructor(e={}){e.testDir&&(this.testDir=e.testDir,this.videoBasePath=ji.join(e.testDir,"videos"),this.statesBasePath=ji.join(e.testDir,"states"),this.downloadsBasePath=ji.join(e.testDir,"downloads"),lt.mkdirSync(this.videoBasePath,{recursive:!0}),lt.mkdirSync(this.statesBasePath,{recursive:!0}),lt.mkdirSync(this.downloadsBasePath,{recursive:!0})),this.terminationTimeout=e.terminationTimeout??null,this.defaultHeadless=e.headless??!1,this.additionalArgs=e.additionalArgs??[]}async launchBrowser(e={}){let t=e.debugPort,i=e.headless??this.defaultHeadless,n=Il(e.deviceName),o=Ml(e.deviceName),a=n===Pt.Chromium,r=!!e.extensionPath;h.info(`[BrowserManager] Launching ${n} browser for device: ${e.deviceName||"default"}${t?` on port ${t}`:""}`);let s={headless:i};if(a){r&&i&&(h.warn("[BrowserManager] Extension requested in headless mode; forcing headed mode to load extension."),i=!1,s.headless=!1);let k=[];(e.enableCamera||e.enableMicrophone)&&(k.push("--use-fake-device-for-media-stream","--use-fake-ui-for-media-stream"),e.enableMicrophone&&e.fakeAudioCapturePath&&(k.push(`--use-file-for-fake-audio-capture=${e.fakeAudioCapturePath}`),h.info(`[BrowserManager] Using fake audio capture file: ${e.fakeAudioCapturePath}`)));let S=r&&e.extensionPath?[`--disable-extensions-except=${e.extensionPath}`,`--load-extension=${e.extensionPath}`]:[];s.args=[...$l(t,e.disableSecurity??!0,i),...k,...S,...this.additionalArgs],o&&(s.channel=o,h.debug(`[BrowserManager] Launching browser with channel: ${o}`))}let l=jn(e.deviceName),d=Al(e.deviceName),c={acceptDownloads:!0,...l,timezoneId:e.timezoneId||"America/Los_Angeles",locale:e.locale||"en-US"};e.viewport&&(c.viewport=e.viewport,c.screen=e.viewport),e.isMobile!==void 0&&(c.isMobile=e.isMobile),e.hasTouch!==void 0&&(c.hasTouch=e.hasTouch),e.userAgent&&(c.userAgent=e.userAgent),e.colorScheme&&(c.colorScheme=e.colorScheme),e.geolocation&&(c.geolocation=e.geolocation,c.permissions=[...c.permissions||[],"geolocation"]);let u=r&&a?e.localStorageStatePath:void 0;e.localStorageStatePath&&!u&&(c.storageState=e.localStorageStatePath),e.recordVideo&&this.videoBasePath&&(c.recordVideo={dir:this.videoBasePath,size:{width:d.width,height:d.height}}),e.proxy&&(c.proxy=e.proxy),e.extraHTTPHeaders&&Object.keys(e.extraHTTPHeaders).length>0&&(c.extraHTTPHeaders=e.extraHTTPHeaders);let m,g,y,_=!1;if(a&&(r||e.userDataDir)){if(e.userDataDir)y=e.userDataDir;else{let S=this.testDir||lt.mkdtempSync(ji.join(hg.tmpdir(),"shiplight-"));y=ji.join(S,`ext-profile-${Date.now()}`),lt.mkdirSync(y,{recursive:!0}),_=!0}let k={...s,...c};g=await ud.launchPersistentContext(y,k),u&&(await gg(g,u),h.info(`[BrowserManager] Loaded storage state into persistent context from ${u}`)),m=g.browser(),h.info(`[BrowserManager] Launched persistent context${e.extensionPath?` for extension at ${e.extensionPath}`:` with profile at ${y}`}`)}else{switch(n){case Pt.Firefox:m=await mg.launch(s);break;case Pt.Webkit:m=await pg.launch(s);break;case Pt.Chromium:default:m=await ud.launch(s);break}g=await m.newContext(c)}if(g.addInitScript(Ve),a){let k=["clipboard-read","clipboard-write"];e.enableCamera&&k.push("camera"),e.enableMicrophone&&k.push("microphone");try{await g.grantPermissions(k),h.info(`[BrowserManager] Granted permissions: ${k.join(", ")}`)}catch(S){h.warn("[BrowserManager] Failed to grant permissions:",S)}}else(e.enableCamera||e.enableMicrophone)&&h.warn("[BrowserManager] Camera/microphone enabled but browser is not Chromium; ignoring.");if(e.cookies&&e.cookies.length>0){let k=(Date.now()+31536e6)/1e3,S=e.cookies.map(I=>({...I,expires:k}));await g.addCookies(S),h.info(`[BrowserManager] Added ${e.cookies.length} cookies to browser context with expires=${k}`)}let x=e.viewport,p=x?{width:x.width,height:x.height+Bn}:Tl(e.deviceName);if(h.info(`[BrowserManager] windowSize=${JSON.stringify(p)}`),a){let k=async S=>{try{await zn(S,p.width,p.height),x&&await S.setViewportSize(x)}catch(I){h.warn("[BrowserManager] Failed to set window bounds via CDP:",I)}};for(let S of g.pages())await k(S);g.on("page",k)}let b="";if(a&&t!==void 0)try{b=await Kn(t)}catch(k){h.warn("[BrowserManager] Failed to get CDP WebSocket URL:",k)}let E=null;b&&(E=await Nt({cdpUrl:b,label:`agent ${e.deviceName??n}`,pid:process.pid}),E&&h.info(`[BrowserManager] Registered browser with dev-box registry id=${E}`));let v={debugPort:t,browser:m,context:g,startTime:new Date,timeout:null,browserWsUrl:b,downloadsBasePath:this.downloadsBasePath,browserType:n,userDataDir:y,isTempUserDataDir:_,registryId:E};if(this.terminationTimeout!==null){let k=setTimeout(()=>{h.info(`[BrowserManager] Browser auto-terminated after ${this.terminationTimeout}ms`),this.terminateBrowser(v).catch(S=>h.error("[BrowserManager] Error terminating browser:",S))},this.terminationTimeout);v.timeout=k}return v}async terminateBrowser(e){if(e.timeout&&clearTimeout(e.timeout),await Rt(e.registryId??null),await e.context.close(),await e.browser.close(),e.isTempUserDataDir&&e.userDataDir)try{lt.rmSync(e.userDataDir,{recursive:!0,force:!0})}catch(t){h.warn("[BrowserManager] Failed to clean up temp user data dir:",e.userDataDir,t)}}getVideoBasePath(){return this.videoBasePath}getStatesBasePath(){return this.statesBasePath}getDownloadsBasePath(){return this.downloadsBasePath}}});import{execFileSync as pd}from"child_process";import*as gd from"fs";import*as fd from"path";function fg(){if(process.platform==="win32"){let i=pd("powershell.exe",["-NoProfile","-NonInteractive","-Command","Get-CimInstance Win32_Process | Select-Object ProcessId,ParentProcessId,CommandLine | ConvertTo-Json -Compress"],{encoding:"utf-8",timeout:1e4}),n=JSON.parse(i.trim());return(Array.isArray(n)?n:[n]).filter(o=>o!==null&&typeof o=="object").filter(o=>typeof o.ProcessId=="number").map(o=>({pid:o.ProcessId,ppid:typeof o.ParentProcessId=="number"?o.ParentProcessId:0,args:typeof o.CommandLine=="string"?o.CommandLine:""}))}let e=pd("ps",["-axo","pid=,ppid=,args="],{encoding:"utf-8"}),t=[];for(let i of e.split(`
|
|
4431
4431
|
`)){let n=i.trimStart().match(/^(\d+)\s+(\d+)\s+(.*)$/);n&&t.push({pid:parseInt(n[1],10),ppid:parseInt(n[2],10),args:n[3]})}return t}function wg(e){let t=fg(),i=new Set([e]),n=!0;for(;n;){n=!1;for(let o of t)!i.has(o.pid)&&i.has(o.ppid)&&(i.add(o.pid),n=!0)}for(let o of t){if(o.pid===e||!i.has(o.pid)||!/chrome|chromium/i.test(o.args))continue;let a=o.args.match(/--user-data-dir=(?:"([^"]+)"|(\S+))/);if(a)return a[1]??a[2]}return null}async function bg(e,t){let i=fd.join(e,"DevToolsActivePort"),n=Date.now()+t;for(;Date.now()<n;){try{let o=gd.readFileSync(i,"utf-8").trim(),[a,r]=o.split(`
|
|
4432
|
-
`),s=parseInt(a,10);if(Number.isFinite(s)&&s>0&&typeof r=="string"&&r.startsWith("/"))return{port:s,wsPath:r}}catch{}await new Promise(o=>setTimeout(o,100))}throw new Error(`Timed out waiting for ${i} \u2014 Chromium never exposed DevTools`)}async function xo(e,t=3e4){let i=wg(e);if(!i)throw new Error(`No Chromium descendant of pid ${e} with --user-data-dir found. Did you launch with --remote-debugging-port=0 and is the browser still running?`);let{port:n,wsPath:o}=await bg(i,t);return`ws://127.0.0.1:${n}${o}`}var wd=f(()=>{"use strict"});var bd,yd=f(()=>{"use strict";Re();bd=e=>{if(!e||e===
|
|
4432
|
+
`),s=parseInt(a,10);if(Number.isFinite(s)&&s>0&&typeof r=="string"&&r.startsWith("/"))return{port:s,wsPath:r}}catch{}await new Promise(o=>setTimeout(o,100))}throw new Error(`Timed out waiting for ${i} \u2014 Chromium never exposed DevTools`)}async function xo(e,t=3e4){let i=wg(e);if(!i)throw new Error(`No Chromium descendant of pid ${e} with --user-data-dir found. Did you launch with --remote-debugging-port=0 and is the browser still running?`);let{port:n,wsPath:o}=await bg(i,t);return`ws://127.0.0.1:${n}${o}`}var wd=f(()=>{"use strict"});var bd,yd=f(()=>{"use strict";Re();bd=e=>{if(!e||e===rt)return"desktop";let t=fi(e);return t&&t.isMobile?"mobile":"desktop"}});var yg,xd=f(()=>{"use strict";yg=(e=>(e.Desktop="desktop",e.Mobile="mobile",e))(yg||{})});var Ca,vo,$a=f(()=>{"use strict";Ca=(e=>(e.Started="started",e.Action="action",e.Completion="completion",e.Error="error",e.Aborted="aborted",e.Keepalive="keepalive",e))(Ca||{}),vo=class extends Error{constructor(e){super(e),this.name="AgentTaskFailedError",this.details=e}}});async function vd(e,t){let i=Object.getPrototypeOf(async()=>{}).constructor,n=`
|
|
4433
4433
|
return await (${t});
|
|
4434
4434
|
`;return await new i("page",n)(e)}async function Ki(e,t,i){let n=[],o=[];for(let a of t){let r=!1;try{let s=`page.${a}`;w.log(`Checking element existence: ${s}`),n.push(`Checking element existence: ${s}`);try{await vd(e,`${s}.waitFor({ state: 'attached', timeout: ${xg} })`),w.log(`Element is attached: ${s}`),n.push(`Element is attached: ${s}`),r=!0}catch{await vd(e,`${s}.count()`)>0?(w.log(`Element found (snapshot): ${s}`),n.push(`Element found (snapshot): ${s}`),r=!0):(w.log(`Element not found: ${s}`),n.push(`Element not found: ${s}`),r=!1)}}catch(s){w.log(`Error checking element: ${s.message}`),n.push(`Error checking element: ${s.message}`),r=!1}if(o.push(r),!r&&i)break}return{successResults:o,logs:n}}async function Pa(e,t,i=!0){let{successResults:n,logs:o}=await Ki(e,t,i);return{success:n.length===t.length&&n.every(a=>a),logs:o}}async function zi(e,t){if(!t||t.length===0)return w.log("No validation expressions provided, cannot validate login"),!1;w.log(`Validating login with ${t.length} expression(s)`);let{success:i,logs:n}=await Pa(e,t,!0);return i?w.log("All validation expressions passed"):w.log(`Validation failed: ${n.join(", ")}`),i}async function Oa(e,t){let i=e.context().browser();if(!i)throw new Error("Cannot create unsigned-in context: browser not available");let n=await i.newContext(),o=await n.newPage();return await o.goto(t),await Fe(o,vg),{context:n,page:o,close:async()=>{await o.close(),await n.close()}}}async function La(e,t,i,n,o,a){let r=`
|
|
4435
4435
|
Based on the current page status, generate ${o} Playwright locators in JavaScript code that can
|
|
@@ -4491,7 +4491,7 @@ ${m.join(`
|
|
|
4491
4491
|
${e.trim()}`:this.context.agentNote=e.trim())}readVariable(e){let t=e.startsWith("$")?e.slice(1):e,i=this.context.variableStore.get(t);return h.debug(`Read variable: ${t} = ${JSON.stringify(i)}`),i}async generate2faCode(e){try{let t=_g({secret:e,guardrails:Sg});return h.info(`Generated 2FA code: ${t}`),t}catch(t){throw h.error(`Failed to generate 2FA code: ${t.message}`),new Error(`Failed to generate 2FA code: ${t.message}`)}}async getDOMText(e){return await e.evaluate(()=>document.body.innerText)}async waitUntilStable(e,t){return Fe(e,t)}setPage(e){this.context.setPage?(h.info("[AgentServices] Calling setPage callback"),this.context.setPage(e)):h.debug("[AgentServices] setPage callback not configured")}getModel(){if(!this.context.model)throw new Error("No LLM model configured. An LLM model is required for AI-powered actions (login, verify, ai_extract, ai_wait_until, etc.). Set GOOGLE_API_KEY or ANTHROPIC_API_KEY in your MCP server configuration.");return this.context.model}getFallbackModels(){return this.context.fallbackModels??[]}getComputerUseModel(){return this.context.computer_use_model}getComputerUseFallbackModels(){return this.context.computer_use_fallback_models??[]}get variableStore(){return this.context.variableStore}getDownloadDir(){return this.context.downloadDir}getActionSettings(){return this.context.organizationSettings?.action_code_conversion_settings||{}}getInteractiveClassNames(){return this.context.organizationSettings?.agent_settings?.interactive_class_names||[]}getIframeFallbackDomains(){return this.context.organizationSettings?.agent_settings?.iframe_fallback_domains||[]}isUseCleanScreenshotForAssertion(){return this.context.organizationSettings?.use_clean_screenshot_for_assertion??!0}isKnowledgeImagesEnabled(){return this.context.organizationSettings?.agent_settings?.enable_knowledge_images||!1}isSlicedScreenshotsEnabled(){return this.context.organizationSettings?.agent_settings?.use_sliced_screenshots||!1}isResizeSlicedScreenshotsEnabled(){return this.context.organizationSettings?.agent_settings?.resize_sliced_screenshots||!1}isAccessibilityTreeEnabled(){return this.context.organizationSettings?.agent_settings?.use_accessibility_tree||!1}isActionIntentFilteringEnabled(){return this.context.organizationSettings?.agent_settings?.use_action_intent_filtering||!1}isDomTreeTsEnabled(){let e=process.env.USE_DOM_TREE_TS;return e!==void 0?e==="true"||e==="1":this.context.organizationSettings?.agent_settings?.use_dom_tree_ts||!1}setExtensionEnabled(e){this.extensionEnabled=e}getDomServiceOptions(){return{useDomTreeTs:this.isDomTreeTsEnabled(),domTreeRoot:this.extensionEnabled?"document":"body"}}setKnowledgeRetriever(e){this.knowledgeRetriever=e}hasKnowledgeRetriever(){return this.knowledgeRetriever!==void 0}async retrieveKnowledges(e,t,i,n){if(!this.knowledgeRetriever)return h.debug("[AgentServices] No knowledge retriever configured"),[];try{let o=await this.knowledgeRetriever(e,t,i,n);return h.debug(`[AgentServices] Retrieved ${o.length} knowledges for statement`),o}catch(o){return h.warn(`[AgentServices] Failed to retrieve knowledges: ${o.message}`),[]}}}});import*as Xi from"fs";import*as Eo from"path";import{generateText as Eg}from"ai";async function Tg(e){let t;try{t=await Xi.promises.stat(e)}catch{throw new Error(`agent.ai: file not found or unreadable: ${e}`)}if(!t.isFile())throw new Error(`agent.ai: not a file: ${e}`);if(t.size>Ed)throw new Error(`agent.ai: file exceeds the ${Math.floor(Ed/(1024*1024))}MB attachment limit (${t.size} bytes): ${e}`);let i=Eo.extname(e).toLowerCase(),n=Eo.basename(e);if(Td[i])return{parts:[{type:"image",image:await Xi.promises.readFile(e)}],imageCount:1};if(Ad[i])return{parts:[{type:"file",data:await Xi.promises.readFile(e),mediaType:Ad[i],filename:n}],imageCount:0};if(Md.has(i)){let o=await Xi.promises.readFile(e,"utf-8");return{parts:[{type:"text",text:`File: ${n}
|
|
4492
4492
|
---
|
|
4493
4493
|
${o}
|
|
4494
|
-
---`}],imageCount:0}}throw new Error(`agent.ai: ${i?`unsupported attachment type "${i}"`:"file has no extension, cannot determine attachment type"} (${e}). Supported: PDF, images (${Object.keys(Td).join(", ")}), and text files (${[...Md].join(", ")}). For other formats, parse the file in code and pass the extracted text in the prompt.`)}async function Id(e,t,i){let n=[],o=0;for(let s of t){let{parts:l,imageCount:d}=await Tg(s);n.push(...l),o+=d}n.push({type:"text",text:e});let a=Ae(i,void 0),r=await Eg({model:pe(i),messages:[{role:"user",content:n}],...a!==void 0?{temperature:a}:{},providerOptions:ge(i,o)});return{text:r.text,tokenUsage:Ke(r.usage,i)}}var Ed,Td,Ad,Md,Ra=f(()=>{"use strict";St();Me();Ed=20*1024*1024,Td={".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".webp":"image/webp",".gif":"image/gif"},Ad={".pdf":"application/pdf"},Md=new Set([".txt",".csv",".tsv",".json",".md",".markdown",".html",".htm",".xml",".yaml",".yml",".log"])});var Cd={};mt(Cd,{LoginType:()=>
|
|
4494
|
+
---`}],imageCount:0}}throw new Error(`agent.ai: ${i?`unsupported attachment type "${i}"`:"file has no extension, cannot determine attachment type"} (${e}). Supported: PDF, images (${Object.keys(Td).join(", ")}), and text files (${[...Md].join(", ")}). For other formats, parse the file in code and pass the extracted text in the prompt.`)}async function Id(e,t,i){let n=[],o=0;for(let s of t){let{parts:l,imageCount:d}=await Tg(s);n.push(...l),o+=d}n.push({type:"text",text:e});let a=Ae(i,void 0),r=await Eg({model:pe(i),messages:[{role:"user",content:n}],...a!==void 0?{temperature:a}:{},providerOptions:ge(i,o)});return{text:r.text,tokenUsage:Ke(r.usage,i)}}var Ed,Td,Ad,Md,Ra=f(()=>{"use strict";St();Me();Ed=20*1024*1024,Td={".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".webp":"image/webp",".gif":"image/gif"},Ad={".pdf":"application/pdf"},Md=new Set([".txt",".csv",".tsv",".json",".md",".markdown",".html",".htm",".xml",".yaml",".yml",".log"])});var Cd={};mt(Cd,{LoginType:()=>at,checkLocators:()=>Ki,createUnsignedInContext:()=>Oa,generateAndValidateLoginLocators:()=>_o,generateValidationLocators:()=>La,validateLogin:()=>zi,validateLoginLocators:()=>Pa});var $d=f(()=>{"use strict";ko();se();Re();Ce();st();j();ie();Mt();Se()});import*as Z from"fs";import*as ne from"path";function Mg(e){try{let t=e.toString(),i,n=t.indexOf("=>");if(n!==-1){let s=t.slice(n+2).trim();if(s.startsWith("{")){let l=s.lastIndexOf("}");i=s.slice(1,l)}else return s.trim()}else{let s=t.indexOf("{"),l=t.lastIndexOf("}");s!==-1&&l>s&&(i=t.slice(s+1,l))}if(!i)return;let o=i.split(`
|
|
4495
4495
|
`),a=o.filter(s=>s.trim().length>0);if(a.length===0)return;let r=Math.min(...a.map(s=>s.match(/^(\s*)/)?.[1].length??0));return o.map(s=>s.slice(r)).join(`
|
|
4496
4496
|
`).trim()}catch{return}}function Ft(e,t){let i={};for(let[n,o]of Object.entries(e))i[n]=t.has(n)?"*****":o;return i}var Ag,Ig,Cg,Fa,Pd=f(()=>{"use strict";$a();li();tt();ko();se();Na();Ra();di();Re();Ot();j();Ag=1;Ig=3,Cg=40;Fa=class{constructor(e){this.context=e,this._newActionEntities=new Map,this.agentServices=new So(e),this.agentServices.agent=this,this.context.tokenUsages||(this.context.tokenUsages=[])}getNewActionEntities(){return this._newActionEntities}getAgentNote(){return this.context.agentNote||void 0}async getActionHandler(){if(!this._actionHandler){let{default:e}=await Promise.resolve().then(()=>(Dt(),Lt));this._actionHandler=new e}return this._actionHandler}async execAction(e,t,i){let n=(await this.getActionHandler()).getAction(e);if(!n)throw new Error(`Unknown action: ${e}`);await n.execute(t,i,this.agentServices)}async dismissModalIfPresent(e,t){try{let i=await this.execute(e,`TASK: Check if there is an INTRUSIVE POPUP blocking the page, and dismiss it if present.
|
|
4497
4497
|
|
|
@@ -4527,7 +4527,7 @@ If the page is not signed in, sign in with the OAuth provider "${l.provider_name
|
|
|
4527
4527
|
`}t.additional_prompt&&(s+=`
|
|
4528
4528
|
Additional instructions: ${t.additional_prompt}
|
|
4529
4529
|
`);try{w.log("Level 3: Attempting agent-based login"),w.log(`Login prompt:
|
|
4530
|
-
${s}`);let l=this.agentServices.knowledgeRetriever,d=!1;this.agentServices.hasKnowledgeRetriever()&&l&&(w.log("Setting up login knowledge retriever..."),this.agentServices.setKnowledgeRetriever(async(_,x,p,b)=>await l(_,x,p,"login")),d=!0,w.log("Login knowledge retriever configured"));let c;try{if(c=await this.run(e,s,"login"),!c.success)return w.log("Level 3 FAILED: Agent login failed"),h.info("Login: Failed"),{success:!1,page:e}}finally{d&&l&&(this.agentServices.setKnowledgeRetriever(l),w.log("Restored original knowledge retriever"))}let u=await e.context().storageState(),m;if(o)w.log("Skipping validation locator generation (AI verification mode enabled)");else if(t.num_verification_exprs!==0)try{w.log("Generating validation locators for future login verification...");let _=await _o(e,t.site_url,{verification_hint:t.verification_hint,num_verification_exprs:t.num_verification_exprs},async(x,p)=>this.run(x,p),async x=>this.getDOMText(x));_?(m=_,w.log(`Generated ${m.length} validation locator(s): ${JSON.stringify(m)}`)):w.log("Failed to generate validation locators, login will still succeed")}catch(_){w.log(`Error generating validation locators: ${_.message}`)}else w.log("Skipping validation locator generation (num_verification_exprs=0)");w.log("Level 3 SUCCESS: Agent login succeeded"),h.info("Login: Agent login succeeded");let g=c.actions||[],y=g.length>0?g:i?.cached_actions;return{success:!0,page:e,storage_state:u,cached_actions:y,validation_exprs:m}}catch(l){return w.error(`Agent login failed: ${l.message}`),h.info("Login: Failed"),{success:!1,page:e}}}async executeCachedLogin(e,t,i){let n=(await Promise.resolve().then(()=>(Dt(),Lt))).default,o=new n;for(let a=0;a<t.length;a++){let r=t[a];w.log(`Executing cached action ${a+1}/${t.length}: ${r.action_description||r.action_data?.action_name}`);try{if(!r.action_data){w.log(`Action ${a+1} missing action_data, skipping`);continue}await o.execute(e,r,this.agentServices),await this.waitUntilStable(e,5e3)}catch(s){return w.error(`Cached action ${a+1} failed: ${s.message}`),{success:!1}}}return i?.aiVerificationStatement?(w.log("Verifying cached login result with AI verification statement"),await this.evaluate(e,i.aiVerificationStatement)?{success:!0}:{success:!1}):i?.validationExprs&&i.validationExprs.length>0?await zi(e,i.validationExprs)?{success:!0}:{success:!1}:(w.log("Cached login cannot be verified: missing AI verification statement and validation expressions"),{success:!1})}async login(e,t){let i={site_url:t.url,num_verification_exprs:0,account:{type:rt.PASSWORD,username:t.username,password:t.password,...t.totpSecret&&{two_factor_auth_config:{type:fi.TOTP,data:t.totpSecret}}}};return(await this.loginPage(e,i)).success}getCompletedExecutionHistory(){if(!this.context.executionHistory||this.context.executionHistory.length===0)return[];let e=this.context.executionHistory[this.context.executionHistory.length-1];return!e[1]||e[1].trim()===""?this.context.executionHistory.slice(0,-1):this.context.executionHistory}addToExecutionHistory(e,t){this.context.executionHistory||(this.context.executionHistory=[]),this.context.executionHistory.push([e,t])}async createStepResult(e,t,i,n){if(this.context.stepTracking&&!this.context.stepTracking.results[t]){this.context.stepTracking.currentStepId=t,this.context.stepTracking.onStepChange&&this.context.stepTracking.onStepChange(t);try{e=this.agentServices.validatePage(e),await this.waitUntilStable(e);let o={description:i,startTime:Date.now(),artifacts:[],type:n,code:i};if(this.context.stepTracking.artifactsDir){let a=ne.join(this.context.stepTracking.artifactsDir,t.replace(/\./g,"-"));Z.mkdirSync(a,{recursive:!0});let r=ne.join(a,"screenshot.png");e=this.agentServices.validatePage(e),await e.screenshot({type:"png",path:r}),o.screenshot=r}o.contextBefore=this.snapshotVariables(),this.context.stepTracking.results[t]=o}catch(o){h.warn(`createStepResult failed for step ${t}: ${o}`),this.context.stepTracking.results[t]={description:i,startTime:Date.now(),artifacts:[],contextBefore:this.snapshotVariables()}}}}snapshotVariables(){return Ft(this.context.variableStore.getAll(),this.context.variableStore.getAllSensitiveKeys())}saveDebugInfoToFiles(e,t,i,n=0){let o={};if(!this.context.stepTracking?.artifactsDir)return h.debug("[saveDebugInfoToFiles] No artifacts directory configured, skipping debug info save"),o;let a=ne.join(this.context.stepTracking.artifactsDir,e.replace(/\./g,"-"));try{if(Z.mkdirSync(a,{recursive:!0}),t.systemPrompt){let r=ne.join(a,`system_prompt_${n}.txt`);Z.writeFileSync(r,t.systemPrompt),o.system_prompt_path=r,h.debug(`[saveDebugInfoToFiles] Saved system prompt to: ${r}`)}if(t.userPrompt)if(typeof t.userPrompt=="string"){let r=ne.join(a,`user_prompt_${n}.txt`);Z.writeFileSync(r,t.userPrompt),o.user_prompt_path=r,h.debug(`[saveDebugInfoToFiles] Saved user prompt to: ${r}`)}else{let r=t.userPrompt.map(d=>Array.isArray(d.content)?{...d,content:d.content.map(c=>c.type==="image"&&c.file?.startsWith("data:")?{...c,file:"[base64 image data stripped]"}:c)}:d),s=ne.join(a,`messages_${n}.json`),l={system:t.systemPrompt,messages:r};Z.writeFileSync(s,JSON.stringify(l,null,2)),o.messages_path=s,h.debug(`[saveDebugInfoToFiles] Saved messages to: ${s}`)}if(t.rawLlmResponse){let r=i?i.replace(/[\/\\:]/g,"-"):"llm",s=ne.join(a,`${r}_response_${n}.txt`);Z.writeFileSync(s,t.rawLlmResponse),o.response_path=s,h.debug(`[saveDebugInfoToFiles] Saved LLM response to: ${s}`)}if(t.screenshotWithSom){let r=ne.join(a,`screenshot_${n}.png`);Z.writeFileSync(r,Buffer.from(t.screenshotWithSom,"base64")),o.screenshot_path=r,h.debug(`[saveDebugInfoToFiles] Saved SOM screenshot to: ${r}`)}if(t.reasoningContent){let r=ne.join(a,`reasoning_${n}.txt`);Z.writeFileSync(r,t.reasoningContent),o.reasoning_path=r,h.debug(`[saveDebugInfoToFiles] Saved reasoning to: ${r}`)}h.debug(`[saveDebugInfoToFiles] Saved ${Object.keys(o).length} artifacts for step ${e}`)}catch(r){h.error(`[saveDebugInfoToFiles] Failed to save debug info for step ${e}:`,r)}return o}async updateStepResult(e,t,i,n,o){if(!this.context.stepTracking)return;let a=this.context.stepTracking.results[e];if(a){if(t&&(a.status=t,a.contextAfter=this.snapshotVariables(),this.context.stepTracking.currentStepId=void 0,this.context.stepTracking.onStepChange&&this.context.stepTracking.onStepChange(void 0)),i!==void 0&&(a.message=i),n&&a.artifacts.push(n),o){let r=o.tokenUsages?.[0]?.model,s=a.artifacts.length,l=this.saveDebugInfoToFiles(e,o,r,s);Object.keys(l).length>0&&a.artifacts.push(l)}a.duration=Date.now()-a.startTime,this.context.stepTracking.onStepComplete&&this.context.stepTracking.onStepComplete(e,a)}}async writeExecutionResults(e,t){try{if(await Z.promises.mkdir(e,{recursive:!0}),this.context.stepTracking?.results&&Object.keys(this.context.stepTracking.results).length>0){let i=ne.join(e,"test-results.json");await Z.promises.writeFile(i,JSON.stringify(this.context.stepTracking.results,null,2)),h.debug(`Test results written to: ${i}`)}if(t?.tokenUsages&&this.context.tokenUsages&&this.context.tokenUsages.length>0){let i=ne.join(e,"token-usages.json");await Z.promises.writeFile(i,JSON.stringify(this.context.tokenUsages,null,2)),h.debug(`Token usages written to: ${i}`)}if(this.context.aiActionDetails&&this.context.aiActionDetails.length>0){let i=ne.join(e,"ai-actions.json");await Z.promises.writeFile(i,JSON.stringify(this.context.aiActionDetails,null,2)),h.debug(`AI action details written to: ${i}`)}}catch(i){throw h.error("Failed to write execution results:",i),i}}}});function $g(){let e=new Date,t=new Intl.DateTimeFormat("en-US",{timeZone:"America/Los_Angeles",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(e),i=t.find(p=>p.type==="year").value,n=t.find(p=>p.type==="month").value,o=t.find(p=>p.type==="day").value,a=t.find(p=>p.type==="hour").value,r=t.find(p=>p.type==="minute").value,s=t.find(p=>p.type==="second").value,l=String(e.getMilliseconds()).padStart(3,"0"),d=`${i}-${n}-${o}T${a}:${r}:${s}.${l}`,c=e.toISOString().slice(0,-1),u=Date.parse(d+"Z"),m=Date.parse(c+"Z"),g=Math.round((m-u)/(1e3*60)),y=String(Math.floor(Math.abs(g)/60)).padStart(2,"0"),_=String(Math.abs(g)%60).padStart(2,"0"),x=g<=0?"+":"-";return`${i}-${n}-${o}T${a}:${r}:${s}.${l}${x}${y}:${_}`}function Ha(e){let t=e.variableStore;return t.has("currentTime")||t.set("currentTime",$g()),{model:e.model,fallbackModels:e.fallbackModels,computer_use_model:e.computer_use_model,computer_use_fallback_models:e.computer_use_fallback_models,variableStore:t,organizationId:e.organizationId,organizationSettings:e.organizationSettings,executionHistory:e.executionHistory||[],testDataDir:e.testDataDir,downloadDir:e.downloadDir,useNativeGenerator:e.useNativeGenerator,autoDismissModal:e.autoDismissModal,tokenUsages:[],aiActionDetails:[]}}var Od=f(()=>{"use strict"});var Ld={};mt(Ld,{ActionHandler:()=>io,ActionHelper:()=>Gi,Agent:()=>Fa,AgentServices:()=>So,AgentStepEventTypes:()=>Ca,AgentTaskFailedError:()=>vo,BrowserManager:()=>hd,DEFAULT_EVENT_LISTENER_LIMIT:()=>Tn,DomService:()=>xe,EVENT_LISTENER_CANDIDATE_SELECTORS:()=>En,HistoryTreeProcessor:()=>al,INIT_SCRIPT:()=>Ve,INTERACTION_EVENT_TYPES:()=>Tt,INTERACTIVE_ROLES:()=>ai,LogLevel:()=>ta,LoginType:()=>rt,MCPToolProvider:()=>nd,OpenAIToolProvider:()=>gn,SDK_VERSION:()=>Og,ToolRegistry:()=>kt,TwoFactorAuthType:()=>fi,VariableStore:()=>ia,WebAgent:()=>Fa,buildRunUsageSummary:()=>ld,configureSdk:()=>Xr,createAgent:()=>Pg,createAgentContext:()=>Ha,createToolRegistry:()=>Qc,createToolRegistryWithCapabilities:()=>ed,discoverChromiumCdpUrl:()=>xo,ensureToolsRegistered:()=>qc,evaluateStatement:()=>nt,executeStep:()=>it,exportMCPTools:()=>od,filterInteractionListeners:()=>Ys,generateActionStep:()=>$t,getActionEntityLocatorInfo:()=>W,getBrowserCdpUrl:()=>Kn,getCapabilitySummary:()=>td,getFramePath:()=>qo,getModel:()=>pe,getPageInfo:()=>Ll,getPageWsUrl:()=>Ol,getPlatformFromDeviceName:()=>bd,getProviderOptions:()=>ge,getSdkConfig:()=>X,getToolRegistry:()=>Zc,inferProvider:()=>Ma,injectUserFunction:()=>Uo,isInteractionEventType:()=>Xs,isInteractiveRole:()=>Vs,loadKnowledgeMappings:()=>es,loadKnowledges:()=>Qr,loadUserFunctions:()=>qr,logger:()=>h,newBrowserContext:()=>Pl,parseSSEStream:()=>zr,parseSdkLogLevelFromEnv:()=>Yr,pickBestLocator:()=>zt,pickBestLocatorForElement:()=>rn,pickBestLocators:()=>rs,registerBrowser:()=>Nt,replaceVariables:()=>Un,runTask:()=>ot,setWindowBounds:()=>zn,toolRegistry:()=>V,unregisterBrowser:()=>Rt});function Pg(e){let t=new ia,i=new Set(e.sensitiveKeys||[]);if(e.variables)for(let[o,a]of Object.entries(e.variables))t.set(o,a,i.has(o));let n=Ha({model:e.model,variableStore:t,testDataDir:e.testDataDir,downloadDir:e.downloadDir});return new Fa(n)}var Og,Wa=f(()=>{"use strict";Vr();Zr();ts();id();ad();rd();Aa();Sa();Ta();Ea();cd();md();Ia();wd();yd();xd();Pd();$a();li();kn();vn();_t();dn();hn();un();ft();fn();je();bn();ei();Qt();Ne();Zt();Dn();tt();ti();Et();ii();ni();ri();ko();se();Na();Da();Ra();St();Me();Xt();bt();Yt();Be();wt();_a();An();Mn();In();Cn();$n();Pn();On();Ln();Nn();Rn();Fn();ci();ui();hi();mi();wi();bi();xi();_i();ki();Si();Ei();Ti();Ai();Mi();Ii();Ci();$i();Pi();Oi();Li();Di();Ni();At();Ri();Fi();Hi();Wi();Ui();Zn();di();q();Qe();Re();Ot();Ce();st();j();ie();Mt();to();K();Od();Se();Og="1.0.0"});var Dd,Nd=f(()=>{"use strict";Dd=class{version;goal;url;constructor(e,t){this.version=e,this.goal=t.goal,this.url=t.url}generatePrelude(){let e=`// version ${this.version}
|
|
4530
|
+
${s}`);let l=this.agentServices.knowledgeRetriever,d=!1;this.agentServices.hasKnowledgeRetriever()&&l&&(w.log("Setting up login knowledge retriever..."),this.agentServices.setKnowledgeRetriever(async(_,x,p,b)=>await l(_,x,p,"login")),d=!0,w.log("Login knowledge retriever configured"));let c;try{if(c=await this.run(e,s,"login"),!c.success)return w.log("Level 3 FAILED: Agent login failed"),h.info("Login: Failed"),{success:!1,page:e}}finally{d&&l&&(this.agentServices.setKnowledgeRetriever(l),w.log("Restored original knowledge retriever"))}let u=await e.context().storageState(),m;if(o)w.log("Skipping validation locator generation (AI verification mode enabled)");else if(t.num_verification_exprs!==0)try{w.log("Generating validation locators for future login verification...");let _=await _o(e,t.site_url,{verification_hint:t.verification_hint,num_verification_exprs:t.num_verification_exprs},async(x,p)=>this.run(x,p),async x=>this.getDOMText(x));_?(m=_,w.log(`Generated ${m.length} validation locator(s): ${JSON.stringify(m)}`)):w.log("Failed to generate validation locators, login will still succeed")}catch(_){w.log(`Error generating validation locators: ${_.message}`)}else w.log("Skipping validation locator generation (num_verification_exprs=0)");w.log("Level 3 SUCCESS: Agent login succeeded"),h.info("Login: Agent login succeeded");let g=c.actions||[],y=g.length>0?g:i?.cached_actions;return{success:!0,page:e,storage_state:u,cached_actions:y,validation_exprs:m}}catch(l){return w.error(`Agent login failed: ${l.message}`),h.info("Login: Failed"),{success:!1,page:e}}}async executeCachedLogin(e,t,i){let n=(await Promise.resolve().then(()=>(Dt(),Lt))).default,o=new n;for(let a=0;a<t.length;a++){let r=t[a];w.log(`Executing cached action ${a+1}/${t.length}: ${r.action_description||r.action_data?.action_name}`);try{if(!r.action_data){w.log(`Action ${a+1} missing action_data, skipping`);continue}await o.execute(e,r,this.agentServices),await this.waitUntilStable(e,5e3)}catch(s){return w.error(`Cached action ${a+1} failed: ${s.message}`),{success:!1}}}return i?.aiVerificationStatement?(w.log("Verifying cached login result with AI verification statement"),await this.evaluate(e,i.aiVerificationStatement)?{success:!0}:{success:!1}):i?.validationExprs&&i.validationExprs.length>0?await zi(e,i.validationExprs)?{success:!0}:{success:!1}:(w.log("Cached login cannot be verified: missing AI verification statement and validation expressions"),{success:!1})}async login(e,t){let i={site_url:t.url,num_verification_exprs:0,account:{type:at.PASSWORD,username:t.username,password:t.password,...t.totpSecret&&{two_factor_auth_config:{type:gi.TOTP,data:t.totpSecret}}}};return(await this.loginPage(e,i)).success}getCompletedExecutionHistory(){if(!this.context.executionHistory||this.context.executionHistory.length===0)return[];let e=this.context.executionHistory[this.context.executionHistory.length-1];return!e[1]||e[1].trim()===""?this.context.executionHistory.slice(0,-1):this.context.executionHistory}addToExecutionHistory(e,t){this.context.executionHistory||(this.context.executionHistory=[]),this.context.executionHistory.push([e,t])}async createStepResult(e,t,i,n){if(this.context.stepTracking&&!this.context.stepTracking.results[t]){this.context.stepTracking.currentStepId=t,this.context.stepTracking.onStepChange&&this.context.stepTracking.onStepChange(t);try{e=this.agentServices.validatePage(e),await this.waitUntilStable(e);let o={description:i,startTime:Date.now(),artifacts:[],type:n,code:i};if(this.context.stepTracking.artifactsDir){let a=ne.join(this.context.stepTracking.artifactsDir,t.replace(/\./g,"-"));Z.mkdirSync(a,{recursive:!0});let r=ne.join(a,"screenshot.png");e=this.agentServices.validatePage(e),await e.screenshot({type:"png",path:r}),o.screenshot=r}o.contextBefore=this.snapshotVariables(),this.context.stepTracking.results[t]=o}catch(o){h.warn(`createStepResult failed for step ${t}: ${o}`),this.context.stepTracking.results[t]={description:i,startTime:Date.now(),artifacts:[],contextBefore:this.snapshotVariables()}}}}snapshotVariables(){return Ft(this.context.variableStore.getAll(),this.context.variableStore.getAllSensitiveKeys())}saveDebugInfoToFiles(e,t,i,n=0){let o={};if(!this.context.stepTracking?.artifactsDir)return h.debug("[saveDebugInfoToFiles] No artifacts directory configured, skipping debug info save"),o;let a=ne.join(this.context.stepTracking.artifactsDir,e.replace(/\./g,"-"));try{if(Z.mkdirSync(a,{recursive:!0}),t.systemPrompt){let r=ne.join(a,`system_prompt_${n}.txt`);Z.writeFileSync(r,t.systemPrompt),o.system_prompt_path=r,h.debug(`[saveDebugInfoToFiles] Saved system prompt to: ${r}`)}if(t.userPrompt)if(typeof t.userPrompt=="string"){let r=ne.join(a,`user_prompt_${n}.txt`);Z.writeFileSync(r,t.userPrompt),o.user_prompt_path=r,h.debug(`[saveDebugInfoToFiles] Saved user prompt to: ${r}`)}else{let r=t.userPrompt.map(d=>Array.isArray(d.content)?{...d,content:d.content.map(c=>c.type==="image"&&c.file?.startsWith("data:")?{...c,file:"[base64 image data stripped]"}:c)}:d),s=ne.join(a,`messages_${n}.json`),l={system:t.systemPrompt,messages:r};Z.writeFileSync(s,JSON.stringify(l,null,2)),o.messages_path=s,h.debug(`[saveDebugInfoToFiles] Saved messages to: ${s}`)}if(t.rawLlmResponse){let r=i?i.replace(/[\/\\:]/g,"-"):"llm",s=ne.join(a,`${r}_response_${n}.txt`);Z.writeFileSync(s,t.rawLlmResponse),o.response_path=s,h.debug(`[saveDebugInfoToFiles] Saved LLM response to: ${s}`)}if(t.screenshotWithSom){let r=ne.join(a,`screenshot_${n}.png`);Z.writeFileSync(r,Buffer.from(t.screenshotWithSom,"base64")),o.screenshot_path=r,h.debug(`[saveDebugInfoToFiles] Saved SOM screenshot to: ${r}`)}if(t.reasoningContent){let r=ne.join(a,`reasoning_${n}.txt`);Z.writeFileSync(r,t.reasoningContent),o.reasoning_path=r,h.debug(`[saveDebugInfoToFiles] Saved reasoning to: ${r}`)}h.debug(`[saveDebugInfoToFiles] Saved ${Object.keys(o).length} artifacts for step ${e}`)}catch(r){h.error(`[saveDebugInfoToFiles] Failed to save debug info for step ${e}:`,r)}return o}async updateStepResult(e,t,i,n,o){if(!this.context.stepTracking)return;let a=this.context.stepTracking.results[e];if(a){if(t&&(a.status=t,a.contextAfter=this.snapshotVariables(),this.context.stepTracking.currentStepId=void 0,this.context.stepTracking.onStepChange&&this.context.stepTracking.onStepChange(void 0)),i!==void 0&&(a.message=i),n&&a.artifacts.push(n),o){let r=o.tokenUsages?.[0]?.model,s=a.artifacts.length,l=this.saveDebugInfoToFiles(e,o,r,s);Object.keys(l).length>0&&a.artifacts.push(l)}a.duration=Date.now()-a.startTime,this.context.stepTracking.onStepComplete&&this.context.stepTracking.onStepComplete(e,a)}}async writeExecutionResults(e,t){try{if(await Z.promises.mkdir(e,{recursive:!0}),this.context.stepTracking?.results&&Object.keys(this.context.stepTracking.results).length>0){let i=ne.join(e,"test-results.json");await Z.promises.writeFile(i,JSON.stringify(this.context.stepTracking.results,null,2)),h.debug(`Test results written to: ${i}`)}if(t?.tokenUsages&&this.context.tokenUsages&&this.context.tokenUsages.length>0){let i=ne.join(e,"token-usages.json");await Z.promises.writeFile(i,JSON.stringify(this.context.tokenUsages,null,2)),h.debug(`Token usages written to: ${i}`)}if(this.context.aiActionDetails&&this.context.aiActionDetails.length>0){let i=ne.join(e,"ai-actions.json");await Z.promises.writeFile(i,JSON.stringify(this.context.aiActionDetails,null,2)),h.debug(`AI action details written to: ${i}`)}}catch(i){throw h.error("Failed to write execution results:",i),i}}}});function $g(){let e=new Date,t=new Intl.DateTimeFormat("en-US",{timeZone:"America/Los_Angeles",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(e),i=t.find(p=>p.type==="year").value,n=t.find(p=>p.type==="month").value,o=t.find(p=>p.type==="day").value,a=t.find(p=>p.type==="hour").value,r=t.find(p=>p.type==="minute").value,s=t.find(p=>p.type==="second").value,l=String(e.getMilliseconds()).padStart(3,"0"),d=`${i}-${n}-${o}T${a}:${r}:${s}.${l}`,c=e.toISOString().slice(0,-1),u=Date.parse(d+"Z"),m=Date.parse(c+"Z"),g=Math.round((m-u)/(1e3*60)),y=String(Math.floor(Math.abs(g)/60)).padStart(2,"0"),_=String(Math.abs(g)%60).padStart(2,"0"),x=g<=0?"+":"-";return`${i}-${n}-${o}T${a}:${r}:${s}.${l}${x}${y}:${_}`}function Ha(e){let t=e.variableStore;return t.has("currentTime")||t.set("currentTime",$g()),{model:e.model,fallbackModels:e.fallbackModels,computer_use_model:e.computer_use_model,computer_use_fallback_models:e.computer_use_fallback_models,variableStore:t,organizationId:e.organizationId,organizationSettings:e.organizationSettings,executionHistory:e.executionHistory||[],testDataDir:e.testDataDir,downloadDir:e.downloadDir,useNativeGenerator:e.useNativeGenerator,autoDismissModal:e.autoDismissModal,tokenUsages:[],aiActionDetails:[]}}var Od=f(()=>{"use strict"});var Ld={};mt(Ld,{ActionHandler:()=>io,ActionHelper:()=>Gi,Agent:()=>Fa,AgentServices:()=>So,AgentStepEventTypes:()=>Ca,AgentTaskFailedError:()=>vo,BrowserManager:()=>hd,DEFAULT_EVENT_LISTENER_LIMIT:()=>Tn,DomService:()=>xe,EVENT_LISTENER_CANDIDATE_SELECTORS:()=>En,HistoryTreeProcessor:()=>al,INIT_SCRIPT:()=>Ve,INTERACTION_EVENT_TYPES:()=>Tt,INTERACTIVE_ROLES:()=>ai,LogLevel:()=>ta,LoginType:()=>at,MCPToolProvider:()=>nd,OpenAIToolProvider:()=>gn,SDK_VERSION:()=>Og,ToolRegistry:()=>kt,TwoFactorAuthType:()=>gi,VariableStore:()=>ia,WebAgent:()=>Fa,buildRunUsageSummary:()=>ld,configureSdk:()=>Xr,createAgent:()=>Pg,createAgentContext:()=>Ha,createToolRegistry:()=>Qc,createToolRegistryWithCapabilities:()=>ed,discoverChromiumCdpUrl:()=>xo,ensureToolsRegistered:()=>qc,evaluateStatement:()=>nt,executeStep:()=>it,exportMCPTools:()=>od,filterInteractionListeners:()=>Ys,generateActionStep:()=>$t,getActionEntityLocatorInfo:()=>W,getBrowserCdpUrl:()=>Kn,getCapabilitySummary:()=>td,getFramePath:()=>qo,getModel:()=>pe,getPageInfo:()=>Ll,getPageWsUrl:()=>Ol,getPlatformFromDeviceName:()=>bd,getProviderOptions:()=>ge,getSdkConfig:()=>X,getToolRegistry:()=>Zc,inferProvider:()=>Ma,injectUserFunction:()=>Uo,isInteractionEventType:()=>Xs,isInteractiveRole:()=>Vs,loadKnowledgeMappings:()=>es,loadKnowledges:()=>Qr,loadUserFunctions:()=>qr,logger:()=>h,newBrowserContext:()=>Pl,parseSSEStream:()=>zr,parseSdkLogLevelFromEnv:()=>Yr,pickBestLocator:()=>zt,pickBestLocatorForElement:()=>rn,pickBestLocators:()=>rs,registerBrowser:()=>Nt,replaceVariables:()=>Un,runTask:()=>ot,setWindowBounds:()=>zn,toolRegistry:()=>V,unregisterBrowser:()=>Rt});function Pg(e){let t=new ia,i=new Set(e.sensitiveKeys||[]);if(e.variables)for(let[o,a]of Object.entries(e.variables))t.set(o,a,i.has(o));let n=Ha({model:e.model,variableStore:t,testDataDir:e.testDataDir,downloadDir:e.downloadDir});return new Fa(n)}var Og,Wa=f(()=>{"use strict";Vr();Zr();ts();id();ad();rd();Aa();Sa();Ta();Ea();cd();md();Ia();wd();yd();xd();Pd();$a();li();kn();vn();_t();dn();hn();un();ft();fn();je();bn();ei();Qt();Ne();Zt();Dn();tt();ti();Et();ii();ni();ri();ko();se();Na();Da();Ra();St();Me();Xt();bt();Yt();Be();wt();_a();An();Mn();In();Cn();$n();Pn();On();Ln();Nn();Rn();Fn();ci();ui();hi();mi();wi();bi();xi();_i();ki();Si();Ei();Ti();Ai();Mi();Ii();Ci();$i();Pi();Oi();Li();Di();Ni();At();Ri();Fi();Hi();Wi();Ui();Zn();di();q();Qe();Re();Ot();Ce();st();j();ie();Mt();to();K();Od();Se();Og="1.0.0"});var Dd,Nd=f(()=>{"use strict";Dd=class{version;goal;url;constructor(e,t){this.version=e,this.goal=t.goal,this.url=t.url}generatePrelude(){let e=`// version ${this.version}
|
|
4531
4531
|
`,t=this.goal,i=this.url;e+=`// Navigate to the specified URL
|
|
4532
4532
|
const targetUrl = process.env.PLAYWRIGHT_STARTING_URL || '${i}';
|
|
4533
4533
|
if (targetUrl !== null) {
|
|
@@ -4544,4 +4544,4 @@ await page.waitForTimeout(2000);
|
|
|
4544
4544
|
`;return e}generatePostlude(){return""}}});function Rd(e){if(!e)return"desktop";for(let t of Ng)if(t.test(e))return"mobile";return"desktop"}var Ng,Fd=f(()=>{"use strict";Ng=[/iphone/i,/ipad/i,/android/i,/pixel/i,/galaxy/i,/mobile/i,/nexus/i,/blackberry/i,/kindle/i]});function Hd(e,t){if(!e||typeof e!="string")return e;let i=t instanceof Map?Object.fromEntries(t):t,n=a=>{let r=a.startsWith("$")?a.slice(1):a,s=i[r]??i[`$${r}`];return s!=null?String(s):void 0},o=e;return o=o.replace(/\{\{\s*\$?([^}]+?)\s*\}\}/g,(a,r)=>{let s=n(r.trim());return s!==void 0?s:a}),o=o.replace(/<secret>\$?([\w-]+)<\/secret>/g,(a,r)=>{let s=n(r);return s!==void 0?s:a}),o=o.replace(/\$\{([^}]+)\}/g,(a,r)=>{let s=n(r.trim());return s!==void 0?s:a}),o=o.replace(/\$([a-zA-Z_]\w*)/g,(a,r)=>{let s=n(r);return s!==void 0?s:a}),o}var Wd=f(()=>{"use strict"});function Ga(e){for(let t of e){if(t.type==="STEP"){let n=t;if(n.reference_id||n.template_path)return!0}let i=We(t);for(let n of i)if(Ga(n.statements))return!0}return!1}function Bd(e){let t=new Set;function i(n){for(let o of n){if(o.type==="STEP"){let r=o;r.reference_id&&t.add(r.reference_id)}let a=We(o);for(let r of a)i(r.statements)}}return i(e),Array.from(t)}function zd(e){if(!e?.statements||!Array.isArray(e.statements))return{};let t={};return Ze(e.statements,"main",t),e.teardown&&Array.isArray(e.teardown)&&Ze(e.teardown,"teardown",t),t}function Xe(e,t,i){let n=e+".",o=t.filter(([c])=>c===e||c.startsWith(n));if(o.length===0)return[];let a=[],r=new Set;for(let[c]of o){let u=c===e?"":c.slice(n.length);if(!u)continue;let m=u.split(".")[0];r.has(m)||r.add(m)}let s=Array.from(r);s.sort((c,u)=>{let m=/^\d+$/.test(c)?parseInt(c,10):-1,g=/^\d+$/.test(u)?parseInt(u,10):-1;return m>=0&&g>=0?m-g:c==="then"&&u==="else"?-1:c==="else"&&u==="then"||c==="body"?1:u==="body"?-1:c.localeCompare(u)});function l(c){return i[c]}function d(c){let u=c.match(/^(IF|WHILE)\s+([\s\S]+)$/);return{type:"AI_MODE",expression:(u?u[2].trim():c)||"true"}}for(let c of s){let u=e?`${e}.${c}`:c,m=l(u),g=m?.description??"",y=u;if(c==="then"){let v=`${e}.then`,k=`${e}.else`,S=Xe(v,t,i),I=Xe(k,t,i),O=l(e),C=O?d(O.description):{type:"JS_CODE",expression:"true"};a.push({uid:e,type:"IF_ELSE",condition:C,then:S,...I.length>0?{else:I}:{}});continue}if(c==="else")continue;if(c==="body"){let v=`${e}.body`,k=Xe(v,t,i),S=l(e),I=S?d(S.description):{type:"JS_CODE",expression:"true"};a.push({uid:e,type:"WHILE_LOOP",condition:I,body:k});continue}let _=`${e}.${c}`,x=t.some(([v])=>v.startsWith(_+".then.")||v===_+".then"),p=t.some(([v])=>v.startsWith(_+".else.")||v===_+".else"),b=t.some(([v])=>v.startsWith(_+".body.")||v===_+".body"),E=t.filter(([v])=>{if(!v.startsWith(_+"."))return!1;let S=v.slice(_.length+1).split(".")[0];return/^\d+$/.test(S)&&S!=="then"&&S!=="else"&&S!=="body"});if(x||p){let v=_+".then",k=_+".else",S=Xe(v,t,i),I=Xe(k,t,i),O=m?d(g):{type:"JS_CODE",expression:"true"};a.push({uid:u,type:"IF_ELSE",condition:O,then:S,...I.length>0?{else:I}:{}})}else if(b){let v=_+".body",k=Xe(v,t,i),S=m?d(g):{type:"JS_CODE",expression:"true"};a.push({uid:u,type:"WHILE_LOOP",condition:S,body:k})}else if(E.length>0){let v=Xe(_,t,i);a.push({uid:u,type:"STEP",description:g||"Group",statements:v})}else a.push({uid:u,type:"ACTION",description:g||"Action",action_entity:m?.action_entity})}return a}function Vd(e){let t=Object.entries(e),i=n=>{let o=n+".";return t.some(([r])=>r===n||r.startsWith(o))?Xe(n,t,e):[]};return{before:i("before"),main:i("main"),teardown:i("teardown"),after:i("after")}}var We,ue,Ye,Je,qe,Yi,Ud,Gd,Rg,Fg,jd,Kd,Ze,To=f(()=>{"use strict";We=e=>{let t=[];switch(e.type){case"STEP":e.statements&&t.push({key:"statements",statements:e.statements});break;case"IF_ELSE":e.then&&t.push({key:"then",statements:e.then}),e.else&&t.push({key:"else",statements:e.else});break;case"WHILE_LOOP":e.body&&t.push({key:"body",statements:e.body});break}return t},ue=(e,t,i=void 0,n="root")=>{for(let o=0;o<e.length;o++){let a=e[o],r=a.uid;if(r===t)return{stableId:r,path:[o],statement:a,parent:i,containerKey:n,index:o};let s=We(a);for(let l of s){let d=ue(l.statements,t,a,l.key);if(d)return{...d,path:[o,l.key,...d.path]}}}return null},Ye=(e,t,i)=>{let n=ue(e,t);if(!n)return null;let{statement:o,parent:a,containerKey:r,index:s}=n,l=null;switch(o.type){case"DRAFT":case"ACTION":l=Je(e,n)||qe(e,n);break;case"STEP":if(o.statements&&o.statements.length>0)return o.statements[0];l=Je(e,n)||qe(e,n);break;case"IF_ELSE":if(i===!0&&o.then&&o.then.length>0)return o.then[0];if(i===!1&&o.else&&o.else.length>0)return o.else[0];l=Je(e,n)||qe(e,n);break;case"WHILE_LOOP":if(i===!0&&o.body&&o.body.length>0)return o.body[0];l=Je(e,n)||qe(e,n);break;default:l=Je(e,n)||qe(e,n);break}if(a&&a.type==="WHILE_LOOP"&&r==="body"){if(!l)return a;let d=ue(e,l.uid);if(!d||d.parent!==a)return a}return l},Je=(e,t)=>{if(!t.parent)return e[t.index+1]||null;let n=We(t.parent).find(o=>o.key===t.containerKey);return n&&t.index+1<n.statements.length?n.statements[t.index+1]:null},qe=(e,t)=>{if(!t.parent)return null;let i=t.parent.uid,n=ue(e,i);return n?Je(e,n)||qe(e,n):null},Yi=e=>{let t=[],i=n=>{for(let o of n){t.push(o);let a=We(o);for(let r of a)i(r.statements)}};return i(e),t},Ud=e=>{switch(e.type){case"DRAFT":case"ACTION":return!0;case"STEP":return!0;case"IF_ELSE":case"WHILE_LOOP":return!0;default:return!1}},Gd=(e,t,i)=>{if(!ue(e,t))return null;if(i===null){let s=[],l=t;for(;l!==null&&ue(e,l);)if(s.push(l),l=Ye(e,l)?.uid||null,s.length>1e3)return null;return s}if(!ue(e,i))return null;if(t===i)return[];let a=[],r=t;for(;r&&r!==i;){let s=ue(e,r);if(!s)break;if(a.push(r),s.statement.type==="IF_ELSE"){let l=Rg(s.statement,i);l?r=Ye(e,r,l==="then")?.uid||null:r=Ye(e,r)?.uid||null}else s.statement.type==="WHILE_LOOP"?Fg(s.statement,i)?r=Ye(e,r,!0)?.uid||null:r=Ye(e,r,!1)?.uid||null:r=Ye(e,r)?.uid||null;if(a.length>1e3)return null}return r===i?a:null},Rg=(e,t)=>{if(e.type!=="IF_ELSE")return null;let i=e;return i.then&&ue(i.then,t)?"then":i.else&&ue(i.else,t)?"else":null},Fg=(e,t)=>{if(e.type!=="WHILE_LOOP")return!1;let i=e;return!!(i.body&&ue(i.body,t))};jd=e=>e.startsWith("ai_")?!0:["js_code","function","assert","verify","wait_for_download_complete","extract_activation_code","extract_email_content"].includes(e),Kd=e=>!["js_code","function","assert","ai_assert","verify","ai_extract","ai_wait_until","upload_file","login","extract_activation_code","extract_email_content","ai_step"].includes(e),Ze=(e,t,i)=>{e.forEach((n,o)=>{let a=`${t}.${o}`;n.type==="DRAFT"?i[a]={description:n.description||"Draft",action_entity:void 0}:n.type==="ACTION"?i[a]={description:n.description||"Action",action_entity:n.action_entity,locator:n.locator}:n.type==="STEP"&&n.statements?Ze(n.statements,a,i):n.type==="IF_ELSE"?(i[a]={description:"IF "+(n.condition?.expression||""),action_entity:void 0},n.then&&Ze(n.then,`${a}.then`,i),n.else&&Ze(n.else,`${a}.else`,i)):n.type==="WHILE_LOOP"&&(i[a]={description:"WHILE "+(n.condition?.expression||""),action_entity:void 0},n.body&&Ze(n.body,`${a}.body`,i))})}});import{z as A}from"zod";var Ba,Ao,ja,ct,Ka,za,Va,ce,Xa,Ji,Mo,Ya=f(()=>{"use strict";Ba=A.enum(["JS_CODE","AI_MODE"]),Ao=A.object({type:Ba,expression:A.string()}),ja=A.enum(["DRAFT","STEP","ACTION","IF_ELSE","WHILE_LOOP"]),ct=A.object({uid:A.string(),type:ja,comment:A.string().optional()}),Ka=A.object({action_data:A.object({action_name:A.string(),kwargs:A.record(A.any()).optional(),args:A.array(A.any()).optional()}),action_description:A.string().optional(),url:A.string().optional(),xpath:A.string().nullable().optional(),locator:A.string().nullable().optional(),css_selector:A.string().nullable().optional(),unique_selector:A.string().nullable().optional(),element_index:A.number().nullable().optional(),frame_path:A.array(A.any()).optional(),artifacts:A.record(A.any()).optional(),feedback:A.string().optional(),original_browser_use_action:A.any().optional()}).passthrough(),za=ct.extend({type:A.literal("DRAFT"),description:A.string()}),Va=ct.extend({type:A.literal("ACTION"),description:A.string(),action_entity:Ka.optional(),locator:A.string().optional(),use_pure_vision:A.boolean().optional()}),ce=A.lazy(()=>A.union([za,Va,ct.extend({type:A.literal("STEP"),description:A.string().optional().default(""),statements:A.array(ce),reference_id:A.number().optional(),template_path:A.string().optional(),template_params:A.record(A.string()).optional()}),ct.extend({type:A.literal("IF_ELSE"),description:A.string().optional(),condition:Ao,then:A.array(ce),else:A.array(ce).optional()}),ct.extend({type:A.literal("WHILE_LOOP"),description:A.string().optional(),condition:Ao,body:A.array(ce),timeout_ms:A.number().optional()})])),Xa=A.object({name:A.string(),statements:A.array(ce),teardown:A.array(ce).optional(),skip:A.union([A.boolean(),A.string()]).optional(),timeout:A.number().optional(),fail:A.union([A.boolean(),A.string()]).optional(),only:A.boolean().optional(),slow:A.boolean().optional()}),Ji=A.object({tests:A.array(Xa).min(1),beforeAll:A.array(ce).optional(),afterAll:A.array(ce).optional(),beforeEach:A.array(ce).optional(),afterEach:A.array(ce).optional()}),Mo=A.object({comment:A.string().optional(),version:A.string().optional(),goal:A.string().optional(),url:A.string().optional(),baseURL:A.string().optional(),final_feedback:A.string().optional(),completed:A.boolean().optional(),success:A.boolean().optional(),statements:A.array(ce).optional(),teardown:A.array(ce).optional(),last_modified_at:A.string().optional(),testGroup:Ji.optional()}).refine(e=>e.testGroup!==void 0?e.goal===void 0&&(e.statements===void 0||e.statements.length===0):e.goal!==void 0,{message:"TestFlow must have either goal/statements (single test) or testGroup (suite), not both"})});import{stringify as Io,parse as Co,parseAllDocuments as Hg,parseDocument as Wg,Document as qd,isMap as Wt,isSeq as he}from"yaml";import{v4 as ve}from"uuid";function qa(e,t){let i={...t?.test_case_id!==void 0?{test_case_id:t.test_case_id}:{},...t?.name?{name:t.name}:{},...t?.tags&&t.tags.length>0?{tags:t.tags}:{},...t?.skip!==void 0?{skip:t.skip}:{},...t?.fail!==void 0?{fail:t.fail}:{},...t?.only?{only:t.only}:{},...t?.slow?{slow:t.slow}:{},goal:e.goal??"",url:e.url,base_url:e.baseURL,...t?.timeout!==void 0?{timeout:t.timeout}:{},...t?.settings&&Object.keys(t.settings).length>0?{settings:t.settings}:{},...t?.use&&Object.keys(t.use).length>0?{use:t.use}:{},...t?.beforeEach&&t.beforeEach.length>0?{beforeEach:t.beforeEach}:{},...t?.afterEach&&t.afterEach.length>0?{afterEach:t.afterEach}:{},...t?.parameters&&t.parameters.length>0?{parameters:t.parameters}:{},statements:(e.statements??[]).map(we)};return e.final_feedback&&(i.final_feedback=e.final_feedback),e.teardown&&e.teardown.length>0&&(i.teardown=e.teardown.map(we)),i}function Zd(e,t){if(e.testGroup)return Za(e,t);let i=qa(e,t),n=new qd(i),o=n.contents?.get("tags",!0);return he(o)&&(o.flow=!0),e.comment&&(n.commentBefore=e.comment),Xd(n,e.statements??[]),e.teardown&&Xd(n,e.teardown,"teardown"),n.toString(Ut)}function Xd(e,t,i="statements"){let n=e.contents;if(!n||!Wt(n))return;let o=n.get(i,!0);he(o)&&qi(o,t)}function qi(e,t){for(let i=0;i<Math.min(e.items.length,t.length);i++){let n=t[i],o=e.items[i];if(i>0&&(o.spaceBefore=!0),n.comment&&(i===0?e.commentBefore=n.comment:o.commentBefore=n.comment),Wt(o)){let a=o;if(n.type==="STEP"){let r=a.get("statements",!0);he(r)&&qi(r,n.statements)}else if(n.type==="IF_ELSE"){let r=a.get("THEN",!0);he(r)&&qi(r,n.then);let s=a.get("ELSE",!0);he(s)&&n.else&&qi(s,n.else)}else if(n.type==="WHILE_LOOP"){let r=a.get("DO",!0);he(r)&&qi(r,n.body)}}}}function Za(e,t){let i=e.testGroup;if(!i)throw new Error("suiteToYaml requires a TestFlow with testGroup");let n={};t?.test_case_id!==void 0&&(n.test_case_id=t.test_case_id),t?.name&&(n.name=t.name),t?.tags&&t.tags.length>0&&(n.tags=t.tags),t?.use&&Object.keys(t.use).length>0&&(n.use=t.use),t?.settings&&Object.keys(t.settings).length>0&&(n.settings=t.settings);let o={};e.baseURL&&(o.base_url=e.baseURL),i.beforeAll&&i.beforeAll.length>0&&(o.beforeAll=i.beforeAll.map(we)),i.beforeEach&&i.beforeEach.length>0&&(o.beforeEach=i.beforeEach.map(we)),i.afterEach&&i.afterEach.length>0&&(o.afterEach=i.afterEach.map(we)),i.afterAll&&i.afterAll.length>0&&(o.afterAll=i.afterAll.map(we)),o.tests=i.tests.map(s=>{let l={name:s.name};return s.skip!==void 0&&(l.skip=s.skip),s.timeout!==void 0&&(l.timeout=s.timeout),s.fail!==void 0&&(l.fail=s.fail),s.only!==void 0&&(l.only=s.only),s.slow!==void 0&&(l.slow=s.slow),l.statements=s.statements.map(we),s.teardown&&s.teardown.length>0&&(l.teardown=s.teardown.map(we)),l}),n.suite=o;let a=new qd(n),r=a.contents?.get("tags",!0);return he(r)&&(r.flow=!0),a.toString(Ut)}function Qd(e){return e.map(t=>Io(t,Ut)).join(`---
|
|
4545
4545
|
`)}function we(e){switch(e.type){case"DRAFT":return Ug(e);case"ACTION":return eu(e);case"STEP":return Bg(e);case"IF_ELSE":return jg(e);case"WHILE_LOOP":return Kg(e)}}function Ug(e){return{intent:e.description}}function eu(e){let t=e.action_entity?.action_data?.action_name??e.action_entity?.action?.action_name,i=e.action_entity?.action_data?.kwargs??e.action_entity?.action?.kwargs;if(t==="verify"){let s=i?.statement;if(typeof s=="string"&&!e.action_entity?.locator&&!e.action_entity?.xpath){let l=i?.code;return typeof l=="string"&&l.trim()?{VERIFY:s,js:l}:{VERIFY:s}}}if(t==="go_to_url"){let s=i?.url;if(typeof s=="string"&&!e.action_entity?.locator&&!e.action_entity?.xpath){let l={URL:s};return i?.new_tab===!0&&(l.new_tab=!0),typeof i?.timeout_seconds=="number"&&(l.timeout_seconds=i.timeout_seconds),l}}if(t==="js_action"){let s=i?.code;if(typeof s=="string"&&s.trim()&&e.description)return{description:e.description,js:s}}if(t==="ai_wait_until"){let s=i?.condition;if(typeof s=="string"){let l=i?.condition_type==="JS_CODE"?"JS_CODE":"AI_MODE",d={WAIT_UNTIL:Qa({type:l,expression:s})};return typeof i?.timeout_seconds=="number"&&i.timeout_seconds!==60&&(d.timeout_seconds=i.timeout_seconds),d}}if(t==="wait"){let s=i?.seconds,d={WAIT:e.description||`Wait ${s}s`};return typeof s=="number"&&(d.seconds=s),d}if(t==="js_code"){let s=i?.code;if(typeof s=="string"&&!e.action_entity?.locator&&!e.action_entity?.xpath)return{description:e.description||"Code block",js:s}}if(!e.action_entity)return{intent:e.description};let n=e.action_entity.action_data??e.action_entity.action;if(!n)return{intent:e.description};let o={intent:e.description,action:n.action_name},a=e.locator??e.action_entity.locator;a&&(o.locator=a);let r=e.action_entity.xpath;if(r&&(o.xpath=r),e.use_pure_vision&&(o.use_pure_vision=!0),n.kwargs&&Object.keys(n.kwargs).length>0)for(let[s,l]of Object.entries(n.kwargs))s!=="uid"&&(s==="statement"&&(t==="ai_action"||t==="ai_step")||(o[s]=l));return n.args&&n.args.length>0&&(o.args=n.args),o}function tu(e,t,i){let n={uid:"",type:"ACTION",description:t||e.action_description||"",action_entity:e,locator:i},o=eu(n);if(typeof o=="object"&&o!==null){let a={...o};return delete a.intent,delete a.description,delete a.VERIFY,delete a.WAIT_UNTIL,delete a.WAIT,delete a.statement,Object.keys(a).length>0?Io(a,Ut).trim():""}return Io(o,Ut).trim()}function iu(e){let t=Co(e);if(!t||typeof t!="object")throw new Error("Invalid YAML: expected an object");if("VERIFY"in t){let c=String(t.VERIFY),u=typeof t.js=="string"?t.js:void 0;return{description:c,actionEntity:{action_description:c,action_data:{action_name:"verify",kwargs:{statement:c,...u?{code:u}:{}}}}}}if("URL"in t){let c=String(t.URL),u={url:c};return t.new_tab===!0&&(u.new_tab=!0),typeof t.timeout_seconds=="number"&&(u.timeout_seconds=t.timeout_seconds),{description:`Navigate to ${c}`,actionEntity:{action_description:`Navigate to ${c}`,action_data:{action_name:"go_to_url",kwargs:u}}}}if("CODE"in t){let c=String(t.CODE);return{description:c,actionEntity:{action_description:c,action_data:{action_name:"js_code",kwargs:{code:c}}}}}if("js"in t&&typeof t.js=="string"&&!("VERIFY"in t)&&!("action"in t)){let c=typeof t.description=="string"?t.description:typeof t.intent=="string"?t.intent:"";return{description:c,actionEntity:{action_description:c,action_data:{action_name:"js_code",kwargs:{code:t.js}}}}}if("WAIT_UNTIL"in t){let c=$o(String(t.WAIT_UNTIL)),u={condition:c.expression,condition_type:c.type};return typeof t.timeout_seconds=="number"&&(u.timeout_seconds=t.timeout_seconds),{description:`Wait until ${c.expression}`,actionEntity:{action_description:`Wait until ${c.expression}`,action_data:{action_name:"ai_wait_until",kwargs:u}}}}if("WAIT"in t){let c=String(t.WAIT),u={};return typeof t.seconds=="number"&&(u.seconds=t.seconds),{description:c,actionEntity:{action_description:c,action_data:{action_name:"wait",kwargs:u}}}}let i=typeof t.intent=="string"?t.intent:void 0,n=typeof t.action=="string"?t.action:void 0,o=typeof t.locator=="string"?t.locator:void 0,a=typeof t.xpath=="string"?t.xpath:void 0,r=Array.isArray(t.frame_path)?t.frame_path:void 0,s=Array.isArray(t.args)?t.args:void 0,l={};for(let[c,u]of Object.entries(t))Gg.has(c)||(l[c]=u);return n?{actionEntity:{action_description:i||"",action_data:{action_name:n,kwargs:l,...s&&s.length>0?{args:s}:{}},...o?{locator:o}:{},...a?{xpath:a}:{},...r?{frame_path:r}:{}},description:i,locator:o}:{description:i,actionEntity:{action_description:i||""}}}function Bg(e){if(e.template_path){let i={template:e.template_path};return e.template_params&&Object.keys(e.template_params).length>0&&(i.params=e.template_params),i}let t={STEP:e.description,statements:e.statements.map(we)};return e.reference_id!==void 0&&(t.reference_id=e.reference_id),t}function jg(e){let t={IF:Qa(e.condition),THEN:e.then.map(we)};return e.else&&e.else.length>0&&(t.ELSE=e.else.map(we)),t}function Kg(e){let t={WHILE:Qa(e.condition),DO:e.body.map(we)};return e.timeout_ms!==void 0&&(t.timeout_ms=e.timeout_ms),t}function Qa(e){return e.type==="JS_CODE"?`js:${e.expression}`:e.expression}function nu(e){let t=Hg(e),i;if(t.length>1||t.length===1&&!Array.isArray(t[0]?.toJSON()))i=t.map((n,o)=>n.errors.length>0?{__parseError:`Document ${o+1}: ${n.errors[0].message}`}:n.toJSON());else{let n;try{n=Co(e)}catch(o){throw new Error(`Invalid YAML: ${o instanceof Error?o.message:String(o)}`)}if(!Array.isArray(n))throw new Error("Expected a YAML array or multi-document YAML (separated by ---)");i=n}return i.map((n,o)=>{try{if(n&&typeof n=="object"&&"__parseError"in n)return{error:n.__parseError};if(!n||typeof n!="object")return{error:`Item ${o+1}: expected an object`};let a=n,r=typeof a.name=="string"&&a.name.trim()||void 0,s=typeof a.goal=="string"?a.goal.trim():"";if(!s)return{error:`Item ${o+1}: missing "goal" field`};if(Array.isArray(a.statements))try{let l=Io(a,Ut),d=dt(l);return{name:r,goal:d.goal??s,testFlow:d}}catch{}return{name:r,goal:s}}catch(a){return{error:`Item ${o+1}: ${a instanceof Error?a.message:String(a)}`}}})}function ou(e){try{let t=Co(e);if(!t||typeof t!="object")return{};let i={};return typeof t.test_case_id=="number"&&Number.isFinite(t.test_case_id)&&(i.test_case_id=t.test_case_id),typeof t.template_id=="number"&&Number.isFinite(t.template_id)&&(i.template_id=t.template_id),typeof t.name=="string"&&t.name.trim()&&(i.name=t.name.trim()),typeof t.timeout=="number"&&Number.isFinite(t.timeout)&&(i.timeout=t.timeout),t.settings&&typeof t.settings=="object"&&!Array.isArray(t.settings)&&(i.settings=t.settings),t.use&&typeof t.use=="object"&&!Array.isArray(t.use)&&(i.use=t.use),Array.isArray(t.tags)&&t.tags.every(n=>typeof n=="string")&&(i.tags=t.tags),(typeof t.skip=="boolean"||typeof t.skip=="string")&&(i.skip=t.skip),(typeof t.fail=="boolean"||typeof t.fail=="string")&&(i.fail=t.fail),t.only===!0&&(i.only=!0),t.slow===!0&&(i.slow=!0),Array.isArray(t.beforeEach)&&t.beforeEach.length>0&&(i.beforeEach=t.beforeEach),Array.isArray(t.afterEach)&&t.afterEach.length>0&&(i.afterEach=t.afterEach),Array.isArray(t.parameters)&&t.parameters.length>0&&(i.parameters=t.parameters),i}catch{return{}}}function Ja(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(Ja);let t=e,i=Object.keys(t);if(i.length===1){let o=i[0];if(o.startsWith("{ ")&&o.endsWith(" }")&&t[o]===null)return`{{${o.slice(2,-2)}}}`}let n={};for(let[o,a]of Object.entries(t))n[o]=Ja(a);return n}function dt(e){if(e.length>Yd)throw new Error(`YAML input too large (${e.length} bytes, max ${Yd})`);let t=Ja(Co(e));if(!t||typeof t!="object")throw new Error("Invalid YAML: expected an object at root level");if(t.suite)return zg(t);let i={version:"1.3.0",goal:t.goal,url:t.url,baseURL:t.base_url,statements:be(t.statements??[])};t.final_feedback&&(i.final_feedback=t.final_feedback),t.teardown&&Array.isArray(t.teardown)&&(i.teardown=be(t.teardown));let n=Mo.safeParse(i);if(!n.success)throw new Error(`Invalid TestFlow after YAML conversion: ${JSON.stringify(n.error.errors)}`);let o=n.data;return er(e,o),o}function zg(e){let t=e.suite;if(!t||typeof t!="object")throw new Error("Invalid suite: expected an object");let i=t.tests;if(!Array.isArray(i)||i.length===0)throw new Error('Suite must have a non-empty "tests" array');let o={tests:i.map(s=>{if(!s.name)throw new Error('Each test in a suite must have a "name" field');if(!Array.isArray(s.statements)||s.statements.length===0)throw new Error(`Suite test "${s.name}" must have a non-empty "statements" array`);let l={name:s.name,statements:be(s.statements)};return Array.isArray(s.teardown)&&s.teardown.length>0&&(l.teardown=be(s.teardown)),s.skip!==void 0&&(l.skip=s.skip),typeof s.timeout=="number"&&(l.timeout=s.timeout),s.fail!==void 0&&(l.fail=s.fail),s.only===!0&&(l.only=!0),s.slow===!0&&(l.slow=!0),l})};Array.isArray(t.beforeAll)&&t.beforeAll.length>0&&(o.beforeAll=be(t.beforeAll)),Array.isArray(t.afterAll)&&t.afterAll.length>0&&(o.afterAll=be(t.afterAll)),Array.isArray(t.beforeEach)&&t.beforeEach.length>0&&(o.beforeEach=be(t.beforeEach)),Array.isArray(t.afterEach)&&t.afterEach.length>0&&(o.afterEach=be(t.afterEach));let a=Ji.safeParse(o);if(!a.success)throw new Error(`Invalid TestGroup: ${JSON.stringify(a.error.errors)}`);return{version:"1.3.0",baseURL:t.base_url||void 0,testGroup:a.data}}function be(e){if(!Array.isArray(e))throw new Error("Expected an array of statements");return e.map(Vg)}function Vg(e){if(typeof e=="string")throw new Error(`Plain string statements are not supported. Use an object with a "desc" key instead. Example: { "desc": "${e}" }`);if(typeof e!="object"||e===null)throw new Error(`Invalid statement: expected object, got ${typeof e}`);let t=e;if("IF"in t)return Xg(t);if("WHILE"in t)return Yg(t);if("STEP"in t)return Jg(t);if("VERIFY"in t){let i=t.VERIFY,n={statement:typeof i=="string"?i:String(i)};return typeof t.js=="string"&&(n.code=t.js),{uid:ve(),type:"ACTION",description:String(i),action_entity:{action_description:String(i),action_data:{action_name:"verify",kwargs:n}}}}if("URL"in t){let i=t.URL,n=t.new_tab===!0?!0:void 0,o=typeof t.timeout_seconds=="number"?t.timeout_seconds:void 0,a={url:typeof i=="string"?i:String(i)};return n&&(a.new_tab=!0),o!==void 0&&(a.timeout_seconds=o),{uid:ve(),type:"ACTION",description:`Navigate to ${i}`,action_entity:{action_description:`Navigate to ${i}`,action_data:{action_name:"go_to_url",kwargs:a}}}}if("WAIT_UNTIL"in t){let i=$o(typeof t.WAIT_UNTIL=="string"?t.WAIT_UNTIL:String(t.WAIT_UNTIL)),n=typeof t.timeout_seconds=="number"?t.timeout_seconds:60;return{uid:ve(),type:"ACTION",description:`Wait until: ${i.expression}`,action_entity:{action_description:`Wait until: ${i.expression}`,action_data:{action_name:"ai_wait_until",kwargs:{condition:i.expression,condition_type:i.type,timeout_seconds:n}}}}}if("WAIT"in t){let i=t.WAIT,n=typeof t.seconds=="number"?t.seconds:3;return{uid:ve(),type:"ACTION",description:typeof i=="string"?i:`Wait ${n}s`,action_entity:{action_description:typeof i=="string"?i:`Wait ${n}s`,action_data:{action_name:"wait",kwargs:{seconds:n}}}}}if("CODE"in t){let i=t.CODE;if(i==null)throw new Error('CODE statement has no code. Use "CODE: |" followed by indented code on the next line.');let n=typeof t.description=="string"?t.description:"Code block";return{uid:ve(),type:"ACTION",description:n,action_entity:{action_description:n,action_data:{action_name:"js_code",kwargs:{code:typeof i=="string"?i:String(i)}}}}}if("js"in t&&!("VERIFY"in t)&&!("action"in t)){if("intent"in t||"desc"in t)throw new Error("A `js:` statement uses `description:`, not `intent:`. Raw JS does not self-heal \u2014 use `description: + js:` for code, or express it as a structured action (`intent:` + `action:`/`locator:`) to keep self-healing.");let i=typeof t.description=="string"&&t.description.trim()!==""?t.description:"Code block",n=t.js;return{uid:ve(),type:"ACTION",description:i,action_entity:{action_description:i,action_data:{action_name:"js_code",kwargs:{code:typeof n=="string"?n:String(n)}}}}}if("call"in t&&typeof t.call=="string"){let{call:i,...n}=t;return Jd({...n,action:"function",functionName:i})}if("action"in t)return Jd(t);if("intent"in t&&typeof t.intent=="string"||"desc"in t&&typeof t.desc=="string")return{uid:ve(),type:"DRAFT",description:typeof t.intent=="string"?t.intent:t.desc};throw new Error(`Cannot infer statement type from object: ${JSON.stringify(t)}`)}function $o(e){if(typeof e!="string")throw new Error(`Condition must be a string, got ${typeof e}`);return e.startsWith("js:")?{type:"JS_CODE",expression:e.slice(3)}:{type:"AI_MODE",expression:e}}function Xg(e){let t=$o(e.IF),i=e.THEN;if(!Array.isArray(i))throw new Error("IF_ELSE requires a THEN array");let n={uid:ve(),type:"IF_ELSE",condition:t,then:be(i)};return"ELSE"in e&&Array.isArray(e.ELSE)&&(n.else=be(e.ELSE)),n}function Yg(e){let t=$o(e.WHILE),i=e.DO;if(!Array.isArray(i))throw new Error("WHILE_LOOP requires a DO array");let n={uid:ve(),type:"WHILE_LOOP",condition:t,body:be(i)};return typeof e.timeout_ms=="number"&&(n.timeout_ms=e.timeout_ms),n}function Jg(e){let t=typeof e.STEP=="string"?e.STEP:"";if(!Array.isArray(e.statements))throw new Error("STEP requires a statements array");let i={uid:ve(),type:"STEP",description:t,statements:be(e.statements)};if(typeof e.reference_id=="number"&&(i.reference_id=e.reference_id),typeof e.template_path=="string"&&(i.template_path=e.template_path),e.template_params&&typeof e.template_params=="object"&&!Array.isArray(e.template_params)){let n=e.template_params,o={};for(let[a,r]of Object.entries(n))o[a]=String(r);i.template_params=o}return i}function Jd(e){let t=typeof e.action=="string"?e.action:String(e.action),i=typeof e.intent=="string"?e.intent:typeof e.desc=="string"?e.desc:"",n=typeof e.locator=="string"?e.locator:void 0,o=typeof e.xpath=="string"?e.xpath:void 0,a=typeof e.use_pure_vision=="boolean"?e.use_pure_vision:void 0,r={};for(let[d,c]of Object.entries(e))qg.has(d)||(r[d]=c);t==="verify"&&typeof r.js=="string"&&(r.code=r.js,delete r.js),(t==="ai_action"||t==="ai_step")&&(r.statement===void 0&&(r.statement=i),a&&(r.use_pure_vision=!0));let s={action_description:i,action_data:{action_name:t,kwargs:Object.keys(r).length>0?r:{}}};n&&(s.locator=n),o&&(s.xpath=o);let l={uid:ve(),type:"ACTION",description:i,action_entity:s};return a&&(l.use_pure_vision=!0),l}function er(e,t){let i;try{i=Wg(e)}catch{return}let n=i.contents;if(!n||!Wt(n))return;if(i.commentBefore)t.comment=i.commentBefore;else{let l=n.items?.[0];l?.key&&l.key.commentBefore&&(t.comment=l.key.commentBefore)}let o=n,a=o.get("statements",!0);he(a)&&t.statements&&Ht(a,t.statements);let r=o.get("teardown",!0);he(r)&&t.teardown&&Ht(r,t.teardown)}function Ht(e,t){e.commentBefore&&t.length>0&&(t[0].comment=e.commentBefore);for(let i=0;i<Math.min(e.items.length,t.length);i++){let n=e.items[i];n.commentBefore&&!(i===0&&e.commentBefore)&&(t[i].comment=n.commentBefore);let o=t[i];if(o.type==="STEP"&&Wt(n)){let a=n.get("statements",!0);he(a)&&Ht(a,o.statements)}else if(o.type==="IF_ELSE"&&Wt(n)){let a=n.get("THEN",!0);he(a)&&Ht(a,o.then);let r=n.get("ELSE",!0);he(r)&&o.else&&Ht(r,o.else)}else if(o.type==="WHILE_LOOP"&&Wt(n)){let a=n.get("DO",!0);he(a)&&Ht(a,o.body)}}}var Ut,Gg,Yd,qg,Po=f(()=>{"use strict";Ya();Ut={lineWidth:120,defaultKeyType:"PLAIN",defaultStringType:"PLAIN"};Gg=new Set(["intent","description","action","locator","xpath","frame_path","args","js"]);Yd=1024*1024;qg=new Set(["action","intent","desc","locator","xpath","use_pure_vision"])});function nr(e){let t=0,i=0;for(let n of e)if(n.type==="DRAFT")i++;else if(n.type==="ACTION"){let o=n.action_entity?.action_data?.action_name??"";ir.has(o)||t++}return{action:t,draft:i}}function Qg(e){try{return new Function(`return async function() { ${e} }`),null}catch(t){return t.message}}function tr(e){try{return new Function(`return async function() { return (${e}) }`),null}catch(t){return t.message}}function ef(e){let t=e.split(/\r?\n/).map(a=>a.trim()).filter(a=>a.length>0&&!a.startsWith("//")),i=t.length,n=t.join(`
|
|
4546
4546
|
`).match(/\bawait\b/g),o=n?n.length:0;return i<=au&&o<=ru?null:`${i} non-blank line(s), ${o} await(s) \u2014 limits are ${au} lines and ${ru} awaits. The VERIFY js: field is a cache for one natural-language assertion, not a place for multi-step logic. Break this into multiple statements \u2014 one VERIFY per assertion \u2014 so each step is visible in the debugger and self-healable. For freeform setup code (mocking, storage), use the description: + js: escape hatch, which has no complexity cap.`}function su(e,t){let i=t?.coverageThreshold??Zg,n=[],o=[],a;try{a=dt(e)}catch(m){return{valid:!1,errors:[`Invalid YAML: ${m.message}`],warnings:[],stats:{total:0,action:0,draft:0,coverage:0}}}a.goal||n.push('Missing required field: "goal"'),a.statements?.length||n.push('Missing required field: "statements"');let r=[...Yi(a.statements??[]),...a.teardown?Yi(a.teardown):[]],{action:s,draft:l}=nr(r),d="Hint: in YAML double-quoted strings, backslashes are escape characters \u2014 use \\\\/ instead of \\/ for regex, or use single quotes.";for(let m of r){let g=m;if(g.reference_id!==void 0){let y=g.description||m.uid;n.push(`Unresolved cloud template reference on statement "${y}" (reference_id: ${g.reference_id}). Local YAML tests cannot use reference_id \u2014 inline the template statements or use the local "template:" key instead.`)}if(m.type==="ACTION"){let y=m,_=y.action_entity?.action_data?.action_name??"";if(_==="js_code"||_==="js_action"||_==="verify"||_==="ai_assert"){let x=y.action_entity?.action_data?.kwargs?.code;if(typeof x=="string"){let p=Qg(x);if(p){let b=y.description||_;n.push(`Invalid JS in "${b}": ${p}. ${d}`)}else if(_==="verify"){let b=ef(x);if(b){let E=y.description||_;n.push(`JS cache for "${E}" is too complex: ${b}`)}}}}if(_==="ai_wait_until"&&y.action_entity?.action_data?.kwargs?.condition_type==="JS_CODE"){let x=y.action_entity?.action_data?.kwargs?.condition;if(typeof x=="string"){let p=tr(x);p&&n.push(`Invalid JS in WAIT_UNTIL condition "${x}": ${p}. ${d}`)}}}if(m.type==="IF_ELSE"){let y=m;if(y.condition.type==="JS_CODE"){let _=tr(y.condition.expression);_&&n.push(`Invalid JS in IF condition "${y.condition.expression}": ${_}. ${d}`)}}if(m.type==="WHILE_LOOP"){let y=m;if(y.condition.type==="JS_CODE"){let _=tr(y.condition.expression);_&&n.push(`Invalid JS in WHILE condition "${y.condition.expression}": ${_}. ${d}`)}}}let c=s+l,u=c>0?Math.round(s/c*100):0;return c>0&&u/100<i&&o.push(`Low action coverage: ${s}/${c} statements (${u}%) are enriched with action/js. ${l} draft statement(s) still need enrichment. Use MCP tools (act, get_locators) to convert drafts to actions.`),{valid:n.length===0,errors:n,warnings:o,stats:{total:c,action:s,draft:l,coverage:u}}}var Zg,au,ru,ir,lu=f(()=>{"use strict";To();Po();Zg=.5,au=5,ru=3,ir=new Set(["verify","ai_assert","done","go_to_url","ai_wait_until","wait","js_code"])});function cu(){return{version:"1.0",entries:{}}}function du(e,t){return{action_entity:e,updated_at:new Date().toISOString(),updated_by:{source:"runner",test_run_id:t}}}function uu(e,t){let i=t?.entries[e.uid],n=i?.action_entity??e.action_entity;return e.locator&&n?{...n,locator:e.locator}:i?i.action_entity:e.action_entity?e.action_entity:null}function hu(e,t,i,n){return e.entries[t]={action_entity:i,updated_at:new Date().toISOString(),updated_by:n},e}function mu(e,t){let i=e??{version:"1.0",entries:{}};for(let[n,o]of t)i.entries[n]=o;return i}function pu(e){return e?Object.keys(e.entries).length===0:!0}function gu(e){return e?Object.keys(e.entries).length:0}function fu(e,t){if(!t||Object.keys(t.entries).length===0)return e;let i=or(e.statements??[],t),n=e.teardown?or(e.teardown,t):void 0;return{...e,statements:i,teardown:n}}function or(e,t){return e.map(i=>tf(i,t))}function tf(e,t){if(e.type==="ACTION"){let o=e,a=t.entries[o.uid];return a?{...o,action_entity:a.action_entity}:o}let i=We(e);if(i.length===0)return e;let n={};for(let o of i)n[o.key]=or(o.statements,t);return{...e,...n}}var wu=f(()=>{"use strict";To()});import{v4 as nf}from"uuid";function rr(e){let t=e.match(/\.getByRole\(['"]([^'"]+)['"]/);if(t&&t[1]){let p=e.match(/\.filter\(\{\s*hasText:\s*['"]([^'"]*(?:\\.[^'"]*)*)['"]\s*\}\)/);if(p&&p[1]){let E=p[1].replace(/\\(.)/g,"$1");return`${t[1]} element with text "${E}"`}let b=e.match(/\.filter\(\{\s*hasText:\s*(\/.*?\/[gimuy]*)\s*\}\)/);if(b&&b[1]){let E=b[1].replace(/^\/|\/$/g,""),v=E.length>30?`${E.substring(0,27)}...`:E;return`${t[1]} element with text matching "${v}"`}return`${t[1]} element`}let i=e.match(/\.filter\(\{\s*hasText:\s*['"]([^'"]*(?:\\.[^'"]*)*)['"]\s*\}\)/);if(i&&i[1]){let p=Gt(e),b=i[1].replace(/\\(.)/g,"$1");return`${p} with text "${b}"`}let n=e.match(/\.filter\(\{\s*hasText:\s*(\/.*?\/[gimuy]*)\s*\}\)/);if(n&&n[1])return`${Gt(e)} with text matching ${n[1]}`;let o=e.match(/\.filter\(\{\s*has:\s*[^}]+getByText\('((?:[^'\\]|\\.)*)'(?:,\s*\{[^}]*\})?\)/);if(o&&o[1]){let p=Gt(e),b=o[1].replace(/\\(.)/g,"$1");return`${p} containing "${b}"`}let a=e.match(/\.filter\(\{\s*has:\s*[^}]+getByText\("((?:[^"\\]|\\.)*)"(?:,\s*\{[^}]*\})?\)/);if(a&&a[1]){let p=Gt(e),b=a[1].replace(/\\(.)/g,"$1");return`${p} containing "${b}"`}let r=e.match(/\.filter\(\{\s*hasNot:\s*[^}]+getByText\('((?:[^'\\]|\\.)*)'(?:,\s*\{[^}]*\})?\)/);if(r&&r[1]){let p=Gt(e),b=r[1].replace(/\\(.)/g,"$1");return`${p} not containing "${b}"`}let s=e.match(/\.filter\(\{\s*hasNot:\s*[^}]+getByText\("((?:[^"\\]|\\.)*)"(?:,\s*\{[^}]*\})?\)/);if(s&&s[1]){let p=Gt(e),b=s[1].replace(/\\(.)/g,"$1");return`${p} not containing "${b}"`}let l=e.match(/name:\s*'((?:[^'\\]|\\.)*)'/);if(l&&l[1])return`"${l[1].replace(/\\(.)/g,"$1")}"`;let d=e.match(/name:\s*"((?:[^"\\]|\\.)*)"/);if(d&&d[1])return`"${d[1].replace(/\\(.)/g,"$1")}"`;let c=e.match(/getByText\('((?:[^'\\]|\\.)*)'(?:,\s*\{[^}]*\})?\)/);if(c&&c[1])return`"${c[1].replace(/\\(.)/g,"$1")}"`;let u=e.match(/getByText\("((?:[^"\\]|\\.)*)"(?:,\s*\{[^}]*\})?\)/);if(u&&u[1])return`"${u[1].replace(/\\(.)/g,"$1")}"`;let m=e.match(/getByPlaceholder\('((?:[^'\\]|\\.)*)'(?:,\s*\{[^}]*\})?\)/);if(m&&m[1])return`input with placeholder "${m[1].replace(/\\(.)/g,"$1")}"`;let g=e.match(/getByPlaceholder\("((?:[^"\\]|\\.)*)"(?:,\s*\{[^}]*\})?\)/);if(g&&g[1])return`input with placeholder "${g[1].replace(/\\(.)/g,"$1")}"`;let y=e.match(/getByLabel\('((?:[^'\\]|\\.)*)'(?:,\s*\{[^}]*\})?\)/);if(y&&y[1])return`"${y[1].replace(/\\(.)/g,"$1")}"`;let _=e.match(/getByLabel\("((?:[^"\\]|\\.)*)"(?:,\s*\{[^}]*\})?\)/);if(_&&_[1])return`"${_[1].replace(/\\(.)/g,"$1")}"`;let x=e.match(/getByRole\(['"]([^'"]+)['"]/);return x&&x[1]?`${x[1]} element`:e.length>50?`${e.substring(0,47)}...`:e}function sr(e,t){if(!e||!t)return null;let i=t.replace(/^ref=/,""),n=e.split(`
|
|
4547
|
-
`);for(let o of n){if(!o.includes(`[ref=${i}]`))continue;let s=o.replace(/\s+\[[^\]]+\](?:\s*\[[^\]]+\])*.*$/,"").trim().replace(/^[-–—]\s*/,"").trim().replace(/\\"/g,'"');return s.length>0?s:null}return null}function lr(e,t=""){let i=e.match(/page\d*\.(.+?)\.(click|fill|press|check|uncheck|hover|selectOption|dragTo|dblclick|screenshot|setInputFiles|locator|frameLocator)/);if(i&&i[1])return i[1].trim();let n=e.match(/page\d*\.locator\(([^)]+)\)/);if(n&&n[1])return`locator(${n[1]})`;let o=e.match(/page\d*\.frameLocator\(([^)]+)\)/);return o&&o[1]?`frameLocator(${o[1]})`:t}function Gt(e){let t=e.match(/^locator\(['"]([^'"]+)['"]\)/);if(t&&t[1]){let o=t[1],a=o.match(/^([a-zA-Z][\w-]*)/);return a?a[1]:o.length>20?`${o.substring(0,17)}...`:o}let i=e.match(/getByRole\(['"]([^'"]+)['"]/);if(i&&i[1])return i[1];let n=e.match(/getByTestId\(['"]([^'"]+)['"]/);return n&&n[1]?`element with testId "${n[1]}"`:"element"}function ar(e){let t=e.match(/\.fill\(['"]([^'"]*)['"]\)/);if(t&&t[1]!==void 0)return t[1];let i=e.match(/\.press\(['"]([^'"]+)['"]\)/);if(i&&i[1])return i[1];let n=e.match(/\.selectOption\(['"]([^'"]+)['"]\)/);return n&&n[1]?n[1]:""}function of(e){let t=e.match(/button:\s*['"]([^'"]+)['"]/);return t?t[1]:void 0}function af(e){let t=e.match(/modifiers:\s*\[([^\]]+)\]/);if(t&&t[1])return t[1].split(",").map(i=>i.trim().replace(/['"]/g,""))}function yu(e,t){let i=e.name||"unknown",n=lr(t,e.selector||""),o=e.ariaSnapshot??e.arIAaSnapshot??"",a=e.ref,r=/getByTestId\s*\(/.test(n),l=(a&&o&&r?sr(o,a):null)??rr(n),d,c,u={};switch(i){case"click":{let m=of(t),g=af(t);m==="right"?(d="right_click_on_element",c=`Right click on ${l}`):(d="click_element",c=`Click on ${l}`),u={index:0},m&&m!=="left"&&(u.button=m),g&&(u.modifiers=g);break}case"fill":{let m=e.text||e.value||ar(t)||"";d="fill",c=m?`Fill ${l} with '${m}'`:`Fill ${l}`,u={value:m,index:0};break}case"press":{let m=e.key||ar(t)||"";d="press",c=`Press '${m}' on ${l}`,u={keyComb:m,index:0};break}case"selectOption":{let m=e.options?.[0]||ar(t)||"";d="select_dropdown_option",c=`Select '${m}' from ${l}`,u={text:m,index:0};break}case"check":d="click_element",c=`Check ${l}`,u={index:0};break;case"uncheck":d="click_element",c=`Uncheck ${l}`,u={index:0};break;case"setInputFiles":{let m=e.files||[];d="upload_file",c=m.length>0?`Upload file(s) to ${l}`:`Upload file to ${l}`,u={paths:m,index:0};break}case"navigate":case"goto":d="go_to_url",c=`Navigate to ${e.url||"URL"}`,u={url:e.url||"",new_tab:!1};break;case"dblclick":d="double_click_on_element",c=`Double click on ${l}`,u={index:0};break;case"hover":d="hover",c=`Hover over ${l}`,u={index:0};break;case"wheel":case"scroll":d="scroll",c=`Scroll on ${l}`,u={x:e.deltaX||0,y:e.deltaY||0,index:e.selector?0:-1};break;case"dragTo":d="drag_drop",c=`Drag ${l} to target`,u={index:0};break;case"screenshot":d="wait",c="Take screenshot",u={seconds:.5};break;case"wait":d="wait",c=`Wait for ${e.timeout||1e3}ms`,u={seconds:(e.timeout||1e3)/1e3};break;default:d="click_element",c=`${i} on ${l}`,u={index:0};break}return{locator:n,xpath:e.xpath||"",css_selector:e.css_selector||"",unique_selector:e.selector||e.css_selector||"",frame_path:e.frame_path||[],action_data:{action_name:d,args:[],kwargs:u},action_description:c,url:"",feedback:""}}var bu,xu=f(()=>{"use strict";bu=()=>nf()});import{parse as rf,stringify as sf}from"yaml";function cr(e,t){let i=[];t.version!=="1.0"&&i.push(`Unsupported patch version: ${t.version}`),(!Array.isArray(t.operations)||t.operations.length===0)&&i.push("Patch must have at least one operation");for(let n=0;n<t.operations.length;n++){let o=t.operations[n],a=`operations[${n}]`;switch(o.reason||i.push(`${a}: missing reason`),o.op){case"remove":{(typeof o.index!="number"||o.index<0||o.index>=e.length)&&i.push(`${a}: index ${o.index} out of bounds (0..${e.length-1})`);break}case"modify":{(typeof o.index!="number"||o.index<0||o.index>=e.length)&&i.push(`${a}: index ${o.index} out of bounds (0..${e.length-1})`),(o.statement===void 0||o.statement===null)&&i.push(`${a}: missing statement`);break}case"insert":{(typeof o.index!="number"||o.index<0||o.index>=e.length)&&i.push(`${a}: index ${o.index} out of bounds (0..${e.length-1})`),o.position!=="before"&&o.position!=="after"&&i.push(`${a}: position must be 'before' or 'after'`),(o.statement===void 0||o.statement===null)&&i.push(`${a}: missing statement`);break}default:i.push(`${a}: unknown operation type "${o.op}"`)}}return{valid:i.length===0,errors:i}}function dr(e,t){let i=cr(e,t);if(!i.valid)throw new Error(`Invalid patch: ${i.errors.join("; ")}`);let n=[...e],o=t.operations.map((s,l)=>({...s,originalOrder:l})),a={remove:0,modify:1,insert:2},r=[...o].sort((s,l)=>s.index!==l.index?l.index-s.index:a[s.op]-a[l.op]);for(let s of r)switch(s.op){case"remove":n.splice(s.index,1);break;case"modify":n[s.index]=s.statement;break;case"insert":s.position==="before"?n.splice(s.index,0,s.statement):n.splice(s.index+1,0,s.statement);break}return n}function vu(e,t){let i=rf(e);if(!i||typeof i!="object")throw new Error("Invalid YAML: expected an object at root level");let n=i.statements;if(!Array.isArray(n))throw new Error('YAML must have a "statements" array');let o=dr(n,t);i.statements=o;let a=sf(i,{lineWidth:120,defaultKeyType:"PLAIN",defaultStringType:"PLAIN"});return dt(a),{modifiedYaml:a,modifiedStatements:o}}var _u=f(()=>{"use strict";Po()});var ur,hr,ku,Su=f(()=>{"use strict";ur=(e=>(e.DRAFT="DRAFT",e.STEP="STEP",e.ACTION="ACTION",e.IF_ELSE="IF_ELSE",e.WHILE_LOOP="WHILE_LOOP",e))(ur||{}),hr=(e=>(e.JS_CODE="JS_CODE",e.AI_MODE="AI_MODE",e))(hr||{}),ku=18e4});function Eu(e){return e?e.startsWith(_e)?"android":e.startsWith(ke)?"ios":"web":"web"}function Tu(e){return e?e.startsWith(_e)||e.startsWith(ke):!1}function Au(e){return!!e&&e.startsWith(_e)}function Mu(e){return!!e&&e.startsWith(ke)}function Iu(e){return e.startsWith(_e)?e.slice(_e.length):e.startsWith(ke)?e.slice(ke.length):e}function Cu(e){return`${_e}${e}`}function $u(e){return`${ke}${e}`}function Oo(e){return e?e.startsWith("http://")||e.startsWith("https://"):!1}function Pu(e){return e?!Oo(e):!1}function mr(e){return e?Oo(e)?["web"]:["android","ios"]:["web","android","ios"]}function Ou(e,t){if(!t)return!0;let i=mr(t);return e==="desktop"||e==="mobile"?i.includes("web"):i.includes(e)}var _e,ke,Lo=f(()=>{"use strict";_e="android:",ke="ios:"});function Lu(e){let t=e.trim();if(!t||t.startsWith("List of devices"))return null;let i=t.split(/\s+/);if(i.length<2)return null;let n=i[0],o=i[1],a="usb";return n.startsWith("emulator-")?a="emulator":n.includes(":")&&(a="wifi"),{id:n,state:o,connectionType:a}}function Du(e){return e.startsWith(_e)?e:`${_e}${e}`}function Nu(e){return e.model?`${e.model} (${e.id})`:e.connectionType==="emulator"?`Android Emulator (${e.id})`:e.id}var Ru=f(()=>{"use strict";Lo()});function Fu(e){return e.startsWith(ke)?e:`${ke}${e}`}function Hu(e){let t=e.iosVersion?` (iOS ${e.iosVersion})`:"";return e.deviceType==="simulator"?`${e.name}${t} - Simulator`:`${e.name}${t}`}function Wu(e){return!!(/^[0-9a-fA-F]{40}$/.test(e)||/^[0-9a-fA-F]{8}-[0-9a-fA-F]{16}$/.test(e))}var Uu=f(()=>{"use strict";Lo()});var pr,Do,gr,fr,wr,br,yr,xr,vr,_r,ut,kr,Zi,Sr,Er,Bt,Gu,Qi,Bu,ju,No,Ku,zu,Vu,Xu,Yu=f(()=>{"use strict";pr="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36",Do=112,gr=1920,fr=1080,wr=1920,br=1080-Do,yr=1280,xr=720,vr=500,_r=500,ut="Desktop Chrome",kr=(e=>(e.Chromium="chromium",e.Firefox="firefox",e.Webkit="webkit",e))(kr||{}),Zi={"Blackberry PlayBook":{name:"Blackberry PlayBook",userAgent:"Mozilla/5.0 (PlayBook; U; RIM Tablet OS 2.1.0; en-US) AppleWebKit/536.2+ (KHTML like Gecko) Version/26.0 Safari/536.2+",screen:{width:600,height:1024},viewport:{width:600,height:1024},deviceScaleFactor:1,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"BlackBerry Z30":{name:"BlackBerry Z30",userAgent:"Mozilla/5.0 (BB10; Touch) AppleWebKit/537.10+ (KHTML, like Gecko) Version/26.0 Mobile Safari/537.10+",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Galaxy Note 3":{name:"Galaxy Note 3",userAgent:"Mozilla/5.0 (Linux; U; Android 4.3; en-us; SM-N900T Build/JSS15J) AppleWebKit/534.30 (KHTML, like Gecko) Version/26.0 Mobile Safari/534.30",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Galaxy Note II":{name:"Galaxy Note II",userAgent:"Mozilla/5.0 (Linux; U; Android 4.1; en-us; GT-N7100 Build/JRO03C) AppleWebKit/534.30 (KHTML, like Gecko) Version/26.0 Mobile Safari/534.30",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Galaxy S III":{name:"Galaxy S III",userAgent:"Mozilla/5.0 (Linux; U; Android 4.0; en-us; GT-I9300 Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/26.0 Mobile Safari/534.30",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Galaxy S5":{name:"Galaxy S5",userAgent:"Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy S8":{name:"Galaxy S8",userAgent:"Mozilla/5.0 (Linux; Android 7.0; SM-G950U Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:740},viewport:{width:360,height:740},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy S9+":{name:"Galaxy S9+",userAgent:"Mozilla/5.0 (Linux; Android 8.0.0; SM-G965U Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:320,height:658},viewport:{width:320,height:658},deviceScaleFactor:4.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy S24":{name:"Galaxy S24",userAgent:"Mozilla/5.0 (Linux; Android 14; SM-S921U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:780},viewport:{width:360,height:780},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy A55":{name:"Galaxy A55",userAgent:"Mozilla/5.0 (Linux; Android 14; SM-A556B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:480,height:1040},viewport:{width:480,height:1040},deviceScaleFactor:2.25,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy Tab S4":{name:"Galaxy Tab S4",userAgent:"Mozilla/5.0 (Linux; Android 8.1.0; SM-T837A) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:712,height:1138},viewport:{width:712,height:1138},deviceScaleFactor:2.25,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy Tab S9":{name:"Galaxy Tab S9",userAgent:"Mozilla/5.0 (Linux; Android 14; SM-X710) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:640,height:1024},viewport:{width:640,height:1024},deviceScaleFactor:2.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"iPad (gen 5)":{name:"iPad (gen 5)",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:768,height:1024},viewport:{width:768,height:1024},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad (gen 6)":{name:"iPad (gen 6)",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:768,height:1024},viewport:{width:768,height:1024},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad (gen 7)":{name:"iPad (gen 7)",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:810,height:1080},viewport:{width:810,height:1080},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad (gen 11)":{name:"iPad (gen 11)",userAgent:"Mozilla/5.0 (iPad; CPU OS 18_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/19E241 Safari/604.1",screen:{width:656,height:944},viewport:{width:656,height:944},deviceScaleFactor:2.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad Mini":{name:"iPad Mini",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:768,height:1024},viewport:{width:768,height:1024},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad Pro 11":{name:"iPad Pro 11",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:834,height:1194},viewport:{width:834,height:1194},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 6":{name:"iPhone 6",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:375,height:667},viewport:{width:375,height:667},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 6 Plus":{name:"iPhone 6 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:414,height:736},viewport:{width:414,height:736},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 7":{name:"iPhone 7",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:375,height:667},viewport:{width:375,height:667},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 7 Plus":{name:"iPhone 7 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:414,height:736},viewport:{width:414,height:736},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 8":{name:"iPhone 8",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:375,height:667},viewport:{width:375,height:667},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 8 Plus":{name:"iPhone 8 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:414,height:736},viewport:{width:414,height:736},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone SE":{name:"iPhone SE",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/26.0 Mobile/14E304 Safari/602.1",screen:{width:320,height:568},viewport:{width:320,height:568},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone SE (3rd gen)":{name:"iPhone SE (3rd gen)",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 18_5 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/26.0 Mobile/19E241 Safari/602.1",screen:{width:375,height:667},viewport:{width:375,height:667},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone X":{name:"iPhone X",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:375,height:812},viewport:{width:375,height:812},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone XR":{name:"iPhone XR",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:414,height:896},viewport:{width:414,height:896},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 11":{name:"iPhone 11",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:414,height:896},viewport:{width:414,height:715},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 11 Pro":{name:"iPhone 11 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:375,height:812},viewport:{width:375,height:635},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 11 Pro Max":{name:"iPhone 11 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:414,height:896},viewport:{width:414,height:715},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 12":{name:"iPhone 12",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 12 Pro":{name:"iPhone 12 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 12 Pro Max":{name:"iPhone 12 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:428,height:926},viewport:{width:428,height:746},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 12 Mini":{name:"iPhone 12 Mini",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:375,height:812},viewport:{width:375,height:629},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 13":{name:"iPhone 13",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 13 Pro":{name:"iPhone 13 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 13 Pro Max":{name:"iPhone 13 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:428,height:926},viewport:{width:428,height:746},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 13 Mini":{name:"iPhone 13 Mini",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:375,height:812},viewport:{width:375,height:629},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 14":{name:"iPhone 14",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 14 Plus":{name:"iPhone 14 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:428,height:926},viewport:{width:428,height:746},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 14 Pro":{name:"iPhone 14 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:393,height:852},viewport:{width:393,height:660},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 14 Pro Max":{name:"iPhone 14 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:430,height:932},viewport:{width:430,height:740},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 15":{name:"iPhone 15",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:393,height:852},viewport:{width:393,height:659},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 15 Plus":{name:"iPhone 15 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:430,height:932},viewport:{width:430,height:739},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 15 Pro":{name:"iPhone 15 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:393,height:852},viewport:{width:393,height:659},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 15 Pro Max":{name:"iPhone 15 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:430,height:932},viewport:{width:430,height:739},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Kindle Fire HDX":{name:"Kindle Fire HDX",userAgent:"Mozilla/5.0 (Linux; U; en-us; KFAPWI Build/JDQ39) AppleWebKit/535.19 (KHTML, like Gecko) Silk/3.13 Safari/535.19 Silk-Accelerated=true",screen:{width:800,height:1280},viewport:{width:800,height:1280},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"LG Optimus L70":{name:"LG Optimus L70",userAgent:"Mozilla/5.0 (Linux; U; Android 4.4.2; en-us; LGMS323 Build/KOT49I.MS32310c) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:384,height:640},viewport:{width:384,height:640},deviceScaleFactor:1.25,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Microsoft Lumia 550":{name:"Microsoft Lumia 550",userAgent:"Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 550) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36 Edge/14.14263",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Microsoft Lumia 950":{name:"Microsoft Lumia 950",userAgent:"Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 950) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36 Edge/14.14263",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:4,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 10":{name:"Nexus 10",userAgent:"Mozilla/5.0 (Linux; Android 6.0.1; Nexus 10 Build/MOB31T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:800,height:1280},viewport:{width:800,height:1280},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 4":{name:"Nexus 4",userAgent:"Mozilla/5.0 (Linux; Android 4.4.2; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:384,height:640},viewport:{width:384,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 5":{name:"Nexus 5",userAgent:"Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 5X":{name:"Nexus 5X",userAgent:"Mozilla/5.0 (Linux; Android 8.0.0; Nexus 5X Build/OPR4.170623.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:732},viewport:{width:412,height:732},deviceScaleFactor:2.625,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 6":{name:"Nexus 6",userAgent:"Mozilla/5.0 (Linux; Android 7.1.1; Nexus 6 Build/N6F26U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:732},viewport:{width:412,height:732},deviceScaleFactor:3.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 6P":{name:"Nexus 6P",userAgent:"Mozilla/5.0 (Linux; Android 8.0.0; Nexus 6P Build/OPP3.170518.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:732},viewport:{width:412,height:732},deviceScaleFactor:3.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 7":{name:"Nexus 7",userAgent:"Mozilla/5.0 (Linux; Android 6.0.1; Nexus 7 Build/MOB30X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:600,height:960},viewport:{width:600,height:960},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nokia Lumia 520":{name:"Nokia Lumia 520",userAgent:"Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 520)",screen:{width:320,height:533},viewport:{width:320,height:533},deviceScaleFactor:1.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nokia N9":{name:"Nokia N9",userAgent:"Mozilla/5.0 (MeeGo; NokiaN9) AppleWebKit/534.13 (KHTML, like Gecko) NokiaBrowser/8.5.0 Mobile Safari/534.13",screen:{width:480,height:854},viewport:{width:480,height:854},deviceScaleFactor:1,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Pixel 2":{name:"Pixel 2",userAgent:"Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:411,height:731},viewport:{width:411,height:731},deviceScaleFactor:2.625,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 2 XL":{name:"Pixel 2 XL",userAgent:"Mozilla/5.0 (Linux; Android 8.0.0; Pixel 2 XL Build/OPD1.170816.004) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:411,height:823},viewport:{width:411,height:823},deviceScaleFactor:3.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 3":{name:"Pixel 3",userAgent:"Mozilla/5.0 (Linux; Android 9; Pixel 3 Build/PQ1A.181105.017.A1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:393,height:786},viewport:{width:393,height:786},deviceScaleFactor:2.75,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 4":{name:"Pixel 4",userAgent:"Mozilla/5.0 (Linux; Android 10; Pixel 4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:353,height:745},viewport:{width:353,height:745},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 4a (5G)":{name:"Pixel 4a (5G)",userAgent:"Mozilla/5.0 (Linux; Android 11; Pixel 4a (5G)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:892},viewport:{width:412,height:765},deviceScaleFactor:2.63,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 5":{name:"Pixel 5",userAgent:"Mozilla/5.0 (Linux; Android 11; Pixel 5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:393,height:851},viewport:{width:393,height:727},deviceScaleFactor:2.75,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 7":{name:"Pixel 7",userAgent:"Mozilla/5.0 (Linux; Android 14; Pixel 7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:915},viewport:{width:412,height:839},deviceScaleFactor:2.625,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Moto G4":{name:"Moto G4",userAgent:"Mozilla/5.0 (Linux; Android 7.0; Moto G (4)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Desktop Chrome HiDPI":{name:"Desktop Chrome HiDPI",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1792,height:1120},viewport:{width:1280,height:720},deviceScaleFactor:2,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Edge HiDPI":{name:"Desktop Edge HiDPI",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36 Edg/141.0.7390.16",screen:{width:1792,height:1120},viewport:{width:1280,height:720},deviceScaleFactor:2,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Firefox HiDPI":{name:"Desktop Firefox HiDPI",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:142.0.1) Gecko/20100101 Firefox/142.0.1",screen:{width:1792,height:1120},viewport:{width:1280,height:720},deviceScaleFactor:2,isMobile:!1,hasTouch:!1,defaultBrowserType:"firefox"},"Desktop Safari":{name:"Desktop Safari",userAgent:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Safari/605.1.15",screen:{width:1792,height:1120},viewport:{width:1280,height:720},deviceScaleFactor:2,isMobile:!1,hasTouch:!1,defaultBrowserType:"webkit"},"Desktop Chrome":{name:"Desktop Chrome",displayName:"Playwright Chromium",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1920,height:1080},viewport:{width:1920,height:1080},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Chrome Medium Resolution":{name:"Desktop Chrome Medium Resolution",displayName:"Playwright Chromium",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1280,height:720},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Chrome (Branded)":{name:"Desktop Chrome (Branded)",displayName:"Google Chrome",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1920,height:1080},viewport:{width:1920,height:1080},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium",channel:"chrome"},"Desktop Chrome Medium Resolution (Branded)":{name:"Desktop Chrome Medium Resolution (Branded)",displayName:"Google Chrome",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1280,height:720},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium",channel:"chrome"},"Desktop Edge":{name:"Desktop Edge",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36 Edg/141.0.7390.16",screen:{width:1920,height:1080},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Edge (Branded)":{name:"Desktop Edge (Branded)",displayName:"Microsoft Edge",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36 Edg/141.0.7390.16",screen:{width:1920,height:1080},viewport:{width:1920,height:1080},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium",channel:"msedge"},"Desktop Edge Medium Resolution (Branded)":{name:"Desktop Edge Medium Resolution (Branded)",displayName:"Microsoft Edge",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36 Edg/141.0.7390.16",screen:{width:1280,height:720},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium",channel:"msedge"},"Desktop Firefox":{name:"Desktop Firefox",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:142.0.1) Gecko/20100101 Firefox/142.0.1",screen:{width:1920,height:1080},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"firefox"}},Sr=(e=>(e.Desktop="desktop",e.Mobile="mobile",e))(Sr||{}),Er={desktop:["Desktop Chrome","Desktop Chrome Medium Resolution","Desktop Chrome (Branded)","Desktop Chrome Medium Resolution (Branded)","Desktop Edge (Branded)","Desktop Edge Medium Resolution (Branded)","Desktop Safari"],mobile:["iPhone 15 Pro Max","iPhone 15 Pro","iPhone 15 Plus","iPhone 15","iPhone 14 Pro Max","iPhone 14 Pro","iPhone 14 Plus","iPhone 14","iPhone 13 Pro Max","iPhone 13 Pro","iPhone 13","iPhone 13 Mini","iPhone 12 Pro Max","iPhone 12 Pro","iPhone 12","iPhone 12 Mini","iPhone 11 Pro Max","iPhone 11 Pro","iPhone 11","iPhone XR","iPhone X","iPhone SE (3rd gen)","iPhone SE","iPhone 8 Plus","iPhone 8","iPhone 7 Plus","iPhone 7","iPhone 6 Plus","iPhone 6","Galaxy S24","Galaxy A55","Galaxy S9+","Galaxy S8","Galaxy S5","Galaxy Note 3","Galaxy Note II","Galaxy S III","Pixel 7","Pixel 5","Pixel 4a (5G)","Pixel 4","Pixel 3","Pixel 2 XL","Pixel 2","Nexus 6P","Nexus 6","Nexus 5X","Nexus 5","Nexus 4","Moto G4","LG Optimus L70","Microsoft Lumia 950","Microsoft Lumia 550","Nokia Lumia 520","Nokia N9","BlackBerry Z30"]},Bt=(e,t=!1)=>{let i=["chromium"];return t&&i.push("webkit"),Er[e].map(n=>Zi[n]).filter(n=>n.defaultBrowserType&&i.includes(n.defaultBrowserType))},Gu=()=>Object.keys(Zi),Qi=e=>Zi[e],Bu={desktop:{label:"Desktop",type:"desktop",devices:Bt("desktop")},mobile:{label:"Mobile Web",type:"mobile",devices:Bt("mobile")}},ju={desktop:{label:"Desktop",type:"desktop",devices:Bt("desktop",!0)},mobile:{label:"Mobile Web",type:"mobile",devices:Bt("mobile",!0)}},No=(e,t=!1)=>{let i={userAgent:pr,viewport:{width:wr,height:br},isMobile:!1,hasTouch:!1};if(!e||e===ut)return i;let n=Qi(e);if(!n)return i;let{width:o,height:a}=n.viewport,r=Math.max(vr/o,1),s=Math.max(_r/a,1),l=Math.max(r,s),d={width:Math.round(o*l),height:Math.round(a*l)};return{userAgent:n.userAgent,viewport:t?d:n.viewport,isMobile:n.isMobile,hasTouch:n.hasTouch}},Ku=e=>{let t={width:gr,height:fr};if(!e||e===ut)return t;let i=No(e);return i.viewport?{width:i.viewport.width,height:i.viewport.height+Do}:t},zu=e=>{let t={width:yr,height:xr};if(!e||e===ut)return t;let i=No(e);return i.viewport?{width:i.viewport.width,height:i.viewport.height}:t},Vu=e=>!e||e===ut?void 0:Qi(e)?.channel,Xu=e=>!e||e===ut?"chromium":Qi(e)?.defaultBrowserType??"chromium"});var Tr,Ar,Ju=f(()=>{"use strict";Tr=(e=>(e.PASSWORD="password",e.OAUTH2="oauth2",e.SSO="sso",e.API="api",e))(Tr||{}),Ar=(e=>(e.SMS="sms",e.EMAIL="email",e.TOTP="totp",e))(Ar||{})});var qu,Qu=f(()=>{"use strict";qu=class Zu{data={};sensitive=new Set;get(t){return this.data[t]}set(t,i,n=!1){this.data[t]=i,n?this.sensitive.add(t):this.sensitive.has(t)&&this.sensitive.delete(t)}getAll(){return{...this.data}}isSensitive(t){return this.sensitive.has(t)}getAllSensitiveKeys(){return new Set(this.sensitive)}delete(t){return this.sensitive.delete(t),delete this.data[t]}clear(){this.data={},this.sensitive.clear()}has(t){return t in this.data}get size(){return Object.keys(this.data).length}merge(t){for(let[i,n]of Object.entries(t.getAll()))this.set(i,n,t.isSensitive(i))}toJSON(){return{data:{...this.data},sensitiveKeys:Array.from(this.sensitive)}}static fromJSON(t){let i=new Zu;if(t.data){let n=new Set(t.sensitiveKeys||[]);for(let[o,a]of Object.entries(t.data))i.set(o,a,n.has(o))}return i}}});function eh(e,t=lf()){return{copilot:e?.models?.copilot||t.COPILOT_MODEL||$r,webagent:e?.models?.webagent||t.WEB_AGENT_MODEL||Ro,computer_use:e?.models?.computer_use||t.COMPUTER_USE_MODEL||Pr}}function th(e){if(e){if(e.WEB_AGENT_MODEL)return e.WEB_AGENT_MODEL;if(e.GOOGLE_API_KEY||ih(e))return en;if(e.ANTHROPIC_API_KEY)return Mr;if(e.OPENAI_API_KEY)return Ir;if(e.SHIPLIGHT_API_TOKEN)return Ro}}function ih(e){let t=e.GOOGLE_GENAI_USE_VERTEXAI;return(t==="true"||t==="True")&&!!e.GOOGLE_CLOUD_PROJECT}function nh(e){let t=e?.WEB_AGENT_FALLBACK_MODELS;return t===void 0?[...Or]:t.split(",").map(i=>i.trim()).filter(i=>i.length>0)}function oh(e){if(e){if(e.COMPUTER_USE_MODEL)return e.COMPUTER_USE_MODEL;if(e.GOOGLE_API_KEY||ih(e))return jt;if(e.OPENAI_API_KEY)return Cr;if(e.SHIPLIGHT_API_TOKEN)return jt}}var Mr,en,Ir,jt,Cr,$r,Ro,Pr,lf,Or,ah=f(()=>{"use strict";Mr="claude-haiku-4-5",en="gemini-3.5-flash",Ir="gpt-5.4-mini",jt="gemini-3-flash-preview",Cr="gpt-5.4",$r="claude-sonnet-4-6",Ro=en,Pr=jt,lf=()=>typeof process<"u"?process.env:{};Or=Object.freeze(["anthropic:claude-sonnet-5","google:gemini-3.1-pro-preview"])});var Lr,rh=f(()=>{"use strict";Lr=(e=>(e.INITIALIZING="initializing",e.READY="ready",e.PROCESSING="processing",e.STOPPING="stopping",e.WAITING_USER="waiting_user",e.COMPLETED="completed",e.FAILED="failed",e))(Lr||{})});var Dr={};mt(Dr,{ADDRESS_BAR_HEIGHT:()=>Do,ANDROID_DEVICE_PREFIX:()=>_e,ActionEntitySchema:()=>Ka,ActionSchema:()=>Va,AgentStatus:()=>Lr,BaseStatementSchema:()=>ct,BrowserType:()=>kr,ConditionSchema:()=>Ao,ConditionType:()=>hr,ConditionTypeSchema:()=>Ba,DEFAULT_ANTHROPIC_MODEL:()=>Mr,DEFAULT_COMPUTER_USE_MODEL:()=>Pr,DEFAULT_COPILOT_MODEL:()=>$r,DEFAULT_DEVICE_NAME:()=>ut,DEFAULT_GEMINI_COMPUTER_USE_MODEL:()=>jt,DEFAULT_GOOGLE_MODEL:()=>en,DEFAULT_OPENAI_COMPUTER_USE_MODEL:()=>Cr,DEFAULT_OPENAI_MODEL:()=>Ir,DEFAULT_WEBAGENT_FALLBACK_MODELS:()=>Or,DEFAULT_WEBAGENT_MODEL:()=>Ro,DEFAULT_WHILE_LOOP_TIMEOUT_MS:()=>ku,DEVICE_CATEGORIES:()=>Er,DeviceType:()=>Sr,DraftSchema:()=>za,IOS_DEVICE_PREFIX:()=>ke,LoginType:()=>Tr,MIN_WINDOW_HEIGHT:()=>_r,MIN_WINDOW_WIDTH:()=>vr,NON_INTENT_ACTIONS:()=>ir,NodeJSCodeCommon:()=>Dd,PLAYWRIGHT_DEVICES:()=>Zi,RECORD_VIDEO_HEIGHT:()=>xr,RECORD_VIDEO_WIDTH:()=>yr,StatementSchema:()=>ce,StatementType:()=>ur,StatementTypeSchema:()=>ja,TestFlowSchema:()=>Mo,TestGroupEntrySchema:()=>Xa,TestGroupSchema:()=>Ji,TwoFactorAuthType:()=>Ar,UI_DEVICE_CATEGORIES:()=>Bu,UI_DEVICE_CATEGORIES_ELECTRON:()=>ju,USER_AGENT:()=>pr,VIEWPORT_HEIGHT:()=>br,VIEWPORT_WIDTH:()=>wr,VariableStore:()=>qu,WINDOW_HEIGHT:()=>fr,WINDOW_WIDTH:()=>gr,actionEntityToYaml:()=>tu,actionStepsMapToTestFlowSections:()=>Vd,allowPureVisionAction:()=>Kd,applyPatchToYaml:()=>dr,applyPatchToYamlString:()=>vu,collectActionSteps:()=>Ze,convertPlaywrightActionToEntity:()=>yu,countIntentStatements:()=>nr,createAndroidDeviceName:()=>Cu,createEmptyStore:()=>cu,createIOSDeviceName:()=>$u,createRunnerStoreEntry:()=>du,extractActionStepsFromTestFlow:()=>zd,extractAndAttachComments:()=>er,extractDeviceIdentifier:()=>Iu,extractElementDescription:()=>rr,extractElementDescriptionFromAriaSnapshot:()=>sr,extractLocatorFromCode:()=>lr,extractYamlMetadata:()=>ou,findNextAfterContainer:()=>qe,findNextSibling:()=>Je,findNextStatement:()=>Ye,findPathBetweenStatements:()=>Gd,findStatementPathById:()=>ue,generateUid:()=>bu,getAllDeviceNames:()=>Gu,getAllReferenceIds:()=>Bd,getAllStatementsInOrder:()=>Yi,getAndroidDeviceDisplayName:()=>Nu,getBrowserWindowSize:()=>Ku,getCompatiblePlatforms:()=>mr,getDeviceBrowserType:()=>Xu,getDeviceByName:()=>Qi,getDeviceChannel:()=>Vu,getDeviceOptions:()=>No,getDevicesByCategory:()=>Bt,getIOSDeviceDisplayName:()=>Hu,getLoginConfigPlatform:()=>Rd,getRecordVideoSize:()=>zu,getStatementContainers:()=>We,getStoreSize:()=>gu,getTestPlatformFromDeviceName:()=>Eu,hasReferenceIds:()=>Ga,isAndroidDevice:()=>Au,isAppPackage:()=>Pu,isDynamicAction:()=>jd,isExecutableStatement:()=>Ud,isIOSDevice:()=>Mu,isNativeDevice:()=>Tu,isPhysicalDeviceUDID:()=>Wu,isPlatformCompatibleWithUrl:()=>Ou,isStoreEmpty:()=>pu,isWebUrl:()=>Oo,mergeActionEntitiesIntoTestFlow:()=>fu,mergeStoreUpdates:()=>mu,parseAdbDeviceLine:()=>Lu,parseYamlArrayItems:()=>nu,replaceVariables:()=>Hd,resolveActionEntity:()=>uu,resolveComputerUseModelFromEnv:()=>oh,resolveModels:()=>eh,resolveWebAgentFallbackModelsFromEnv:()=>nh,resolveWebAgentModelFromEnv:()=>th,suiteToYaml:()=>Za,testFlowToYaml:()=>Zd,testFlowToYamlObject:()=>qa,toAndroidDeviceName:()=>Du,toIOSDeviceName:()=>Fu,updateStoreEntry:()=>hu,validatePatch:()=>cr,validateTestYaml:()=>su,yamlObjectsToString:()=>Qd,yamlToActionEntity:()=>iu,yamlToTestFlow:()=>dt});var Nr=f(()=>{"use strict";Nd();Fd();Wd();lu();wu();xu();To();_u();Po();Su();Ya();Ru();Uu();Lo();Yu();Ju();Qu();ah();rh()});import*as Ue from"path";import*as hh from"fs";import{pathToFileURL as cf}from"url";import{test as df,expect as ZM,chromium as uf}from"@playwright/test";import*as re from"fs";import*as pt from"path";import{randomUUID as Ur}from"crypto";import{tmpdir as Gr}from"os";function Br(e){return[`--disable-extensions-except=${e}`,`--load-extension=${e}`,"--no-first-run","--disable-default-apps"]}function jr(e){if(!re.existsSync(e))return console.warn(`[fixture] extensionStorageState file not found: ${e}`),null;let t;try{t=JSON.parse(re.readFileSync(e,"utf-8"))}catch(a){throw new Error(`[fixture] Failed to parse extensionStorageState at ${e}: ${a}`)}let i=t;if(!Array.isArray(i.cookies))return null;let n=(Date.now()+365*24*60*60*1e3)/1e3,o=i.cookies.filter(a=>a&&typeof a=="object"&&typeof a.name=="string"&&typeof a.domain=="string");return o.length<i.cookies.length&&console.warn(`[fixture] Skipped ${i.cookies.length-o.length} malformed cookies (missing name or domain)`),o.map(a=>({...a,expires:n}))}function Kr(e,t=process.cwd()){if(e){let n=pt.resolve(t,e),o=pt.join(Gr(),`ext-profile-${Ur()}`);if(re.existsSync(n)){try{re.cpSync(n,o,{recursive:!0})}catch(r){try{re.rmSync(o,{recursive:!0,force:!0})}catch(s){console.warn("[fixture] Failed to clean up partial profile copy:",o,s)}throw new Error(`[fixture] Failed to copy extension profile from ${n}: ${r}`)}let a=pt.join(o,"SingletonLock");re.existsSync(a)&&re.rmSync(a,{force:!0})}else re.mkdirSync(o,{recursive:!0});return o}let i=pt.join(Gr(),`ext-profile-${Ur()}`);return re.mkdirSync(i,{recursive:!0}),i}Wa();import qA from"dotenv";var Lg="__shiplightDotenvCache__";function Dg(){return globalThis[Lg]}function Ua(){let e=Dg();return e===void 0?process.env:e}function sh(e){return e.config?.rootDir??process.cwd()}async function hf(e,t,i,n=process.cwd()){let o=Ue.resolve(n,e.auth),a=await import(cf(o).href),r=a.login||a.default;if(typeof r!="function")throw new Error(`auth module "${e.auth}" must export a login(args, browser?) function that returns a storageState file path`);let s={...e.args};i&&!s.baseUrl&&(s.baseUrl=i);let l=await r(s,t);if(typeof l!="string")throw new Error(`auth module "${e.auth}" login() must return a storageState file path (got ${typeof l})`);return l}function lh(e){return!(!e||e==="off")}var mf=["acceptDownloads","baseURL","bypassCSP","colorScheme","deviceScaleFactor","extraHTTPHeaders","geolocation","hasTouch","httpCredentials","ignoreHTTPSErrors","isMobile","javaScriptEnabled","locale","offline","permissions","proxy","serviceWorkers","timezoneId","userAgent","viewport"],iI=["storageState","contextOptions","clientCertificates"],pf=[{key:"deviceScaleFactor",conflicts:e=>e!==void 0},{key:"isMobile",conflicts:e=>!!e}];function gf(e){if(e.viewport!==null)return[];let t=[];for(let{key:i,conflicts:n}of pf)n(e[i])&&(delete e[i],t.push(i));return t}function ch(e,t){let i={...e};for(let[o,a]of Object.entries(t))a!==void 0&&(i[o]=a);let n=gf(i);return n.length>0&&console.warn(`[fixture] "viewport: null" (no fixed viewport) is incompatible with ${n.join(" and ")}; dropping ${n.length>1?"them":"it"} so the browser context can be created.`),i}function mh(e,t){return!e||e==="off"?!1:e==="on"?!0:e==="retain-on-failure"?t.status!==t.expectedStatus:e==="on-first-retry"?t.retry>0:typeof e=="object"&&e!==null&&"mode"in e?mh(e.mode,t):!0}async function dh(e,t,i){let n=mh(t,i);for(let o of e)try{if(n){let a=await o.path();await i.attach("video",{path:a,contentType:"video/webm"})}else await o.delete()}catch(a){console.warn("[fixture] Failed to process video:",a)}}var Fo;async function uh(){return Fo||(Fo=await Promise.resolve().then(()=>(Wa(),Ld)),Fo)}var ff=new Set(["get","set","getAll","has","__variableStore"]);function wf(e){let t={__variableStore:e,get(i){return e.get(i)},set(i,n,o=!1){e.set(i,n,o)},getAll(){return e.getAll()}};return new Proxy(t,{get(i,n,o){if(n in i)return Reflect.get(i,n,o);if(typeof n=="string")return i.get(n)},set(i,n,o){return typeof n!="string"||ff.has(n)?Reflect.set(i,n,o):(i.set(n,o),!0)},has(i,n){return n in i?!0:typeof n=="string"?e.has?.(n)??!1:!1}})}function bf(e){if(!e)return null;let t;try{t=JSON.parse(e)}catch(n){throw new Error(`SHIPLIGHT_VARS_OVERRIDE is not valid JSON: ${n.message}`)}if(t===null||typeof t!="object"||Array.isArray(t))throw new Error("SHIPLIGHT_VARS_OVERRIDE must be a JSON object");let i={};for(let[n,o]of Object.entries(t)){if(typeof o!="string")throw new Error(`SHIPLIGHT_VARS_OVERRIDE key "${n}" must be a string`);i[n]=o}return i}function yf(e,t,i){let n=r=>{if(!r||!(e in r))return null;let s=r[e];return s&&typeof s=="object"&&"value"in s?s.sensitive===!0:!1},o=n(i);if(o!==null)return o;let a=n(t);return a!==null?a:!1}function xf(e,t,i,n=process.env.SHIPLIGHT_VARS_OVERRIDE){let o=bf(n);if(o)for(let[a,r]of Object.entries(o)){let s=yf(a,t,i);e.set(a,r,s)}}var vf=["GOOGLE_API_KEY","ANTHROPIC_API_KEY","OPENAI_API_KEY","OPENAI_BASE_URL","ANTHROPIC_MODELS_USE_VERTEXAI","GOOGLE_GENAI_USE_VERTEXAI","GOOGLE_CLOUD_PROJECT","GOOGLE_CLOUD_LOCATION","MAILGUN_API_KEY","MAILGUN_DOMAIN","SHIPLIGHT_API_TOKEN","SHIPLIGHT_API_URL","WEB_AGENT_LLM_TIMEOUT_MS"];function _f(e=Ua()){let t={};for(let i of vf)t[i]=e[i]??"";return t}var nI=df.extend({account:[void 0,{option:!0}],autoDismissModal:[!1,{option:!0}],variables:[void 0,{option:!0}],extensionDir:[void 0,{option:!0}],userDataDir:[void 0,{option:!0}],extensionStorageState:[void 0,{option:!0}],launchOptions:async({launchOptions:e},t)=>{if(!process.env.OMNITERM_BROWSER_REGISTRY_URL){await t(e);return}let i=e?.args??[],n={...e,args:[...i,"--remote-debugging-port=0"]};await t(n)},browser:async({browser:e},t)=>{let i=null;if(process.env.OMNITERM_BROWSER_REGISTRY_URL)try{let n=await xo(process.pid),o=process.env.TEST_WORKER_INDEX??"?";i=await Nt({cdpUrl:n,label:`shiplight test w${o}`,pid:process.pid})}catch{}await t(e),await Rt(i)},context:async({browser:e,account:t,extensionDir:i,userDataDir:n,extensionStorageState:o,acceptDownloads:a,baseURL:r,bypassCSP:s,colorScheme:l,deviceScaleFactor:d,extraHTTPHeaders:c,geolocation:u,hasTouch:m,httpCredentials:g,ignoreHTTPSErrors:y,isMobile:_,javaScriptEnabled:x,locale:p,offline:b,permissions:E,proxy:v,serviceWorkers:k,timezoneId:S,userAgent:I,viewport:O},C,$)=>{let H=i||n,z=sh($),R={acceptDownloads:a,baseURL:r,bypassCSP:s,colorScheme:l,deviceScaleFactor:d,extraHTTPHeaders:c,geolocation:u,hasTouch:m,httpCredentials:g,ignoreHTTPSErrors:y,isMobile:_,javaScriptEnabled:x,locale:p,offline:b,permissions:E,proxy:v,serviceWorkers:k,timezoneId:S,userAgent:I,viewport:O},B={};for(let U of mf){if(!(U in R))throw new Error(`[fixture] HANDLED_CONTEXT_OPTION_KEYS lists "${U}" but the context fixture does not resolve it \u2014 add "${U}" to the fixture destructure and fixtureOptionValues so per-test use: overrides apply.`);B[U]=R[U]}if(H){if(t||$.project.use.auth)throw new Error('Cannot use both "extensionDir"/"userDataDir" and "auth" \u2014 persistent context tests manage their own context. Use extensionStorageState for authentication instead.');let U=$.project.use?.browserName;U&&U!=="chromium"&&console.warn(`[fixture] Persistent context requires Chromium but project is configured for "${U}". Forcing Chromium.`);let de=process.env.PLAYWRIGHT_HEADLESS==="true";i&&de&&console.warn("[fixture] PLAYWRIGHT_HEADLESS=true with extensionDir \u2014 Chrome extensions will not function in headless mode.");let Q=Kr(n,z),oe=i?Br(Ue.resolve(z,i)):[],ee=ch($.project.use,B),{storageState:Pe,account:N,extensionDir:J,userDataDir:te,extensionStorageState:Oe,autoDismissModal:Ho,video:L,...G}=ee,Le=lh(L)?{dir:$.outputDir}:void 0,ae;try{if(ae=await uf.launchPersistentContext(Q,{...G,headless:de,args:oe,viewport:"viewport"in G?G.viewport:{width:1280,height:720},...Le?{recordVideo:Le}:{}}),o){let ht=Ue.resolve(z,o),me=jr(ht);me&&await ae.addCookies(me)}await C(ae)}finally{let ht=ae?.pages().map(me=>me.video()).filter(me=>me!==null)??[];if(await ae?.close().catch(me=>{console.warn("[fixture] Failed to close persistent context:",me)}),await dh(ht,L,$),!n)try{hh.rmSync(Q,{recursive:!0,force:!0})}catch(me){console.warn("[fixture] Failed to clean up temp profile dir:",Q,me)}}}else{let U=ch($.project.use,B),de=$.project.use,Q=de.auth?{auth:de.auth,args:de.args}:t;if(Q){if(!Q.auth)throw new Error("Auth is declared but missing the script path. Provide auth in playwright.config.ts: use: { auth: './auth.login.ts' }");U.storageState=await hf(Q,e,r,z)}let oe=U.video;lh(oe)&&!U.recordVideo&&(U.recordVideo={dir:$.outputDir});let ee=await e.newContext(U);ee.addInitScript(Ve);try{await C(ee)}finally{let Pe=ee.pages().map(N=>N.video()).filter(N=>N!==null);await ee.close(),await dh(Pe,oe,$)}}},page:async({context:e},t)=>{let i=await e.newPage();await t(i)},testContext:async({variables:e},t,i)=>{let{VariableStore:n}=await uh(),o=new n,a=l=>{if(l)for(let[d,c]of Object.entries(l))typeof c=="string"?o.set(d,c,!1):c&&typeof c=="object"&&"value"in c&&o.set(d,c.value,c.sensitive===!0)},r=i.project.use.variables;a(r),a(e),xf(o,r,e);let s=wf(o);global.testContext=s,global.$=s,global.ctx=s,await t(s),delete global.testContext,delete global.$,delete global.ctx},$:async({testContext:e},t)=>{await t(e)},ctx:async({testContext:e},t)=>{await t(e)},agent:async({page:e,testContext:t,autoDismissModal:i},n,o)=>{let{WebAgent:a,createAgentContext:r,configureSdk:s,parseSdkLogLevelFromEnv:l}=await uh(),d=l();s({env:_f(),...d!==void 0&&{logLevel:d}});let{resolveWebAgentModelFromEnv:c,resolveComputerUseModelFromEnv:u,resolveWebAgentFallbackModelsFromEnv:m}=await Promise.resolve().then(()=>(Nr(),Dr)),g=Ua(),y=c(g);if(!y)throw new Error("No AI model configured. Set WEB_AGENT_MODEL, GOOGLE_API_KEY, ANTHROPIC_API_KEY, OPENAI_API_KEY, SHIPLIGHT_API_TOKEN, or Google Vertex via ADC (GOOGLE_GENAI_USE_VERTEXAI=true + GOOGLE_CLOUD_PROJECT) in your .env file (or in the runner environment for CI).");let _=u(g),x=m(g),p=t.__variableStore,b=r({model:y,fallbackModels:x,computer_use_model:_,variableStore:p,autoDismissModal:i,testDataDir:sh(o),downloadDir:Ue.join(o.outputDir,"downloads")}),E=Ue.join(o.outputDir,"artifacts");b.stepTracking={results:{},artifactsDir:E};let v=new a(b),k=e.context();v.agentServices.setupPageTracking(k);for(let S of k.pages())v.setupDownloadTracking(S),v.setupDialogHandling(S);k.on("page",S=>{v.setupDownloadTracking(S),v.setupDialogHandling(S)}),global.agent=v,await n(v),delete global.agent;try{let S=o.outputDir;await v.writeExecutionResults(S);let I=Ue.join(S,"test-results.json");await(await import("fs/promises")).stat(I).catch(()=>null)&&await o.attach("shiplight-results",{path:I,contentType:"application/json"})}catch(S){console.error("[Shiplight] Failed to attach step results:",S)}try{let S=v.getNewActionEntities();if(S.size>0&&o.status==="passed"){let{createEmptyStore:I,createRunnerStoreEntry:O}=await Promise.resolve().then(()=>(Nr(),Dr)),C=await import("fs/promises"),$=I();for(let[z,R]of S)$.entries[z]=O(R,0);let H=Ue.join(o.outputDir,"new-action-entities.json");await C.writeFile(H,JSON.stringify($,null,2)),await o.attach("shiplight-new-action-entities",{path:H,contentType:"application/json"}),console.log(`[Shiplight] ${S.size} healed action entit${S.size===1?"y":"ies"} saved`)}}catch(S){console.warn("[Shiplight] Failed to persist new action entities:",S)}}});export{iI as EXCLUDED_CONTEXT_OPTION_KEYS,mf as HANDLED_CONTEXT_OPTION_KEYS,vf as SDK_ENV_ALLOWLIST,pf as VIEWPORT_INCOMPATIBLE_OPTIONS,xf as applyVarsOverride,_f as buildSdkEnv,wf as createTestContext,gf as dropViewportIncompatibleOptions,ZM as expect,yf as isDeclaredSensitive,ch as mergeResolvedContextOptions,bf as parseVarsOverrideEnv,hf as resolveAuthState,sh as resolveProjectRoot,nI as test};
|
|
4547
|
+
`);for(let o of n){if(!o.includes(`[ref=${i}]`))continue;let s=o.replace(/\s+\[[^\]]+\](?:\s*\[[^\]]+\])*.*$/,"").trim().replace(/^[-–—]\s*/,"").trim().replace(/\\"/g,'"');return s.length>0?s:null}return null}function lr(e,t=""){let i=e.match(/page\d*\.(.+?)\.(click|fill|press|check|uncheck|hover|selectOption|dragTo|dblclick|screenshot|setInputFiles|locator|frameLocator)/);if(i&&i[1])return i[1].trim();let n=e.match(/page\d*\.locator\(([^)]+)\)/);if(n&&n[1])return`locator(${n[1]})`;let o=e.match(/page\d*\.frameLocator\(([^)]+)\)/);return o&&o[1]?`frameLocator(${o[1]})`:t}function Gt(e){let t=e.match(/^locator\(['"]([^'"]+)['"]\)/);if(t&&t[1]){let o=t[1],a=o.match(/^([a-zA-Z][\w-]*)/);return a?a[1]:o.length>20?`${o.substring(0,17)}...`:o}let i=e.match(/getByRole\(['"]([^'"]+)['"]/);if(i&&i[1])return i[1];let n=e.match(/getByTestId\(['"]([^'"]+)['"]/);return n&&n[1]?`element with testId "${n[1]}"`:"element"}function ar(e){let t=e.match(/\.fill\(['"]([^'"]*)['"]\)/);if(t&&t[1]!==void 0)return t[1];let i=e.match(/\.press\(['"]([^'"]+)['"]\)/);if(i&&i[1])return i[1];let n=e.match(/\.selectOption\(['"]([^'"]+)['"]\)/);return n&&n[1]?n[1]:""}function of(e){let t=e.match(/button:\s*['"]([^'"]+)['"]/);return t?t[1]:void 0}function af(e){let t=e.match(/modifiers:\s*\[([^\]]+)\]/);if(t&&t[1])return t[1].split(",").map(i=>i.trim().replace(/['"]/g,""))}function yu(e,t){let i=e.name||"unknown",n=lr(t,e.selector||""),o=e.ariaSnapshot??e.arIAaSnapshot??"",a=e.ref,r=/getByTestId\s*\(/.test(n),l=(a&&o&&r?sr(o,a):null)??rr(n),d,c,u={};switch(i){case"click":{let m=of(t),g=af(t);m==="right"?(d="right_click_on_element",c=`Right click on ${l}`):(d="click_element",c=`Click on ${l}`),u={index:0},m&&m!=="left"&&(u.button=m),g&&(u.modifiers=g);break}case"fill":{let m=e.text||e.value||ar(t)||"";d="fill",c=m?`Fill ${l} with '${m}'`:`Fill ${l}`,u={value:m,index:0};break}case"press":{let m=e.key||ar(t)||"";d="press",c=`Press '${m}' on ${l}`,u={keyComb:m,index:0};break}case"selectOption":{let m=e.options?.[0]||ar(t)||"";d="select_dropdown_option",c=`Select '${m}' from ${l}`,u={text:m,index:0};break}case"check":d="click_element",c=`Check ${l}`,u={index:0};break;case"uncheck":d="click_element",c=`Uncheck ${l}`,u={index:0};break;case"setInputFiles":{let m=e.files||[];d="upload_file",c=m.length>0?`Upload file(s) to ${l}`:`Upload file to ${l}`,u={paths:m,index:0};break}case"navigate":case"goto":d="go_to_url",c=`Navigate to ${e.url||"URL"}`,u={url:e.url||"",new_tab:!1};break;case"dblclick":d="double_click_on_element",c=`Double click on ${l}`,u={index:0};break;case"hover":d="hover",c=`Hover over ${l}`,u={index:0};break;case"wheel":case"scroll":d="scroll",c=`Scroll on ${l}`,u={x:e.deltaX||0,y:e.deltaY||0,index:e.selector?0:-1};break;case"dragTo":d="drag_drop",c=`Drag ${l} to target`,u={index:0};break;case"screenshot":d="wait",c="Take screenshot",u={seconds:.5};break;case"wait":d="wait",c=`Wait for ${e.timeout||1e3}ms`,u={seconds:(e.timeout||1e3)/1e3};break;default:d="click_element",c=`${i} on ${l}`,u={index:0};break}return{locator:n,xpath:e.xpath||"",css_selector:e.css_selector||"",unique_selector:e.selector||e.css_selector||"",frame_path:e.frame_path||[],action_data:{action_name:d,args:[],kwargs:u},action_description:c,url:"",feedback:""}}var bu,xu=f(()=>{"use strict";bu=()=>nf()});import{parse as rf,stringify as sf}from"yaml";function cr(e,t){let i=[];t.version!=="1.0"&&i.push(`Unsupported patch version: ${t.version}`),(!Array.isArray(t.operations)||t.operations.length===0)&&i.push("Patch must have at least one operation");for(let n=0;n<t.operations.length;n++){let o=t.operations[n],a=`operations[${n}]`;switch(o.reason||i.push(`${a}: missing reason`),o.op){case"remove":{(typeof o.index!="number"||o.index<0||o.index>=e.length)&&i.push(`${a}: index ${o.index} out of bounds (0..${e.length-1})`);break}case"modify":{(typeof o.index!="number"||o.index<0||o.index>=e.length)&&i.push(`${a}: index ${o.index} out of bounds (0..${e.length-1})`),(o.statement===void 0||o.statement===null)&&i.push(`${a}: missing statement`);break}case"insert":{(typeof o.index!="number"||o.index<0||o.index>=e.length)&&i.push(`${a}: index ${o.index} out of bounds (0..${e.length-1})`),o.position!=="before"&&o.position!=="after"&&i.push(`${a}: position must be 'before' or 'after'`),(o.statement===void 0||o.statement===null)&&i.push(`${a}: missing statement`);break}default:i.push(`${a}: unknown operation type "${o.op}"`)}}return{valid:i.length===0,errors:i}}function dr(e,t){let i=cr(e,t);if(!i.valid)throw new Error(`Invalid patch: ${i.errors.join("; ")}`);let n=[...e],o=t.operations.map((s,l)=>({...s,originalOrder:l})),a={remove:0,modify:1,insert:2},r=[...o].sort((s,l)=>s.index!==l.index?l.index-s.index:a[s.op]-a[l.op]);for(let s of r)switch(s.op){case"remove":n.splice(s.index,1);break;case"modify":n[s.index]=s.statement;break;case"insert":s.position==="before"?n.splice(s.index,0,s.statement):n.splice(s.index+1,0,s.statement);break}return n}function vu(e,t){let i=rf(e);if(!i||typeof i!="object")throw new Error("Invalid YAML: expected an object at root level");let n=i.statements;if(!Array.isArray(n))throw new Error('YAML must have a "statements" array');let o=dr(n,t);i.statements=o;let a=sf(i,{lineWidth:120,defaultKeyType:"PLAIN",defaultStringType:"PLAIN"});return dt(a),{modifiedYaml:a,modifiedStatements:o}}var _u=f(()=>{"use strict";Po()});var ur,hr,ku,Su=f(()=>{"use strict";ur=(e=>(e.DRAFT="DRAFT",e.STEP="STEP",e.ACTION="ACTION",e.IF_ELSE="IF_ELSE",e.WHILE_LOOP="WHILE_LOOP",e))(ur||{}),hr=(e=>(e.JS_CODE="JS_CODE",e.AI_MODE="AI_MODE",e))(hr||{}),ku=18e4});var mr,pr,Eu=f(()=>{"use strict";mr=(e=>(e.PASSWORD="password",e.OAUTH2="oauth2",e.SSO="sso",e.API="api",e))(mr||{}),pr=(e=>(e.SMS="sms",e.EMAIL="email",e.TOTP="totp",e))(pr||{})});function Tu(e){return e?e.startsWith(_e)?"android":e.startsWith(ke)?"ios":"web":"web"}function Au(e){return e?e.startsWith(_e)||e.startsWith(ke):!1}function Mu(e){return!!e&&e.startsWith(_e)}function Iu(e){return!!e&&e.startsWith(ke)}function Cu(e){return e.startsWith(_e)?e.slice(_e.length):e.startsWith(ke)?e.slice(ke.length):e}function $u(e){return`${_e}${e}`}function Pu(e){return`${ke}${e}`}function Oo(e){return e?e.startsWith("http://")||e.startsWith("https://"):!1}function Ou(e){return e?!Oo(e):!1}function gr(e){return e?Oo(e)?["web"]:["android","ios"]:["web","android","ios"]}function Lu(e,t){if(!t)return!0;let i=gr(t);return e==="desktop"||e==="mobile"?i.includes("web"):i.includes(e)}var _e,ke,Lo=f(()=>{"use strict";_e="android:",ke="ios:"});function Du(e){let t=e.trim();if(!t||t.startsWith("List of devices"))return null;let i=t.split(/\s+/);if(i.length<2)return null;let n=i[0],o=i[1],a="usb";return n.startsWith("emulator-")?a="emulator":n.includes(":")&&(a="wifi"),{id:n,state:o,connectionType:a}}function Nu(e){return e.startsWith(_e)?e:`${_e}${e}`}function Ru(e){return e.model?`${e.model} (${e.id})`:e.connectionType==="emulator"?`Android Emulator (${e.id})`:e.id}var Fu=f(()=>{"use strict";Lo()});function Hu(e){return e.startsWith(ke)?e:`${ke}${e}`}function Wu(e){let t=e.iosVersion?` (iOS ${e.iosVersion})`:"";return e.deviceType==="simulator"?`${e.name}${t} - Simulator`:`${e.name}${t}`}function Uu(e){return!!(/^[0-9a-fA-F]{40}$/.test(e)||/^[0-9a-fA-F]{8}-[0-9a-fA-F]{16}$/.test(e))}var Gu=f(()=>{"use strict";Lo()});var fr,Do,wr,br,yr,xr,vr,_r,kr,Sr,ut,Er,Zi,Tr,Ar,Bt,Bu,Qi,ju,Ku,No,zu,Vu,Xu,Yu,Ju=f(()=>{"use strict";fr="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36",Do=112,wr=1920,br=1080,yr=1920,xr=1080-Do,vr=1280,_r=720,kr=500,Sr=500,ut="Desktop Chrome",Er=(e=>(e.Chromium="chromium",e.Firefox="firefox",e.Webkit="webkit",e))(Er||{}),Zi={"Blackberry PlayBook":{name:"Blackberry PlayBook",userAgent:"Mozilla/5.0 (PlayBook; U; RIM Tablet OS 2.1.0; en-US) AppleWebKit/536.2+ (KHTML like Gecko) Version/26.0 Safari/536.2+",screen:{width:600,height:1024},viewport:{width:600,height:1024},deviceScaleFactor:1,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"BlackBerry Z30":{name:"BlackBerry Z30",userAgent:"Mozilla/5.0 (BB10; Touch) AppleWebKit/537.10+ (KHTML, like Gecko) Version/26.0 Mobile Safari/537.10+",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Galaxy Note 3":{name:"Galaxy Note 3",userAgent:"Mozilla/5.0 (Linux; U; Android 4.3; en-us; SM-N900T Build/JSS15J) AppleWebKit/534.30 (KHTML, like Gecko) Version/26.0 Mobile Safari/534.30",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Galaxy Note II":{name:"Galaxy Note II",userAgent:"Mozilla/5.0 (Linux; U; Android 4.1; en-us; GT-N7100 Build/JRO03C) AppleWebKit/534.30 (KHTML, like Gecko) Version/26.0 Mobile Safari/534.30",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Galaxy S III":{name:"Galaxy S III",userAgent:"Mozilla/5.0 (Linux; U; Android 4.0; en-us; GT-I9300 Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/26.0 Mobile Safari/534.30",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Galaxy S5":{name:"Galaxy S5",userAgent:"Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy S8":{name:"Galaxy S8",userAgent:"Mozilla/5.0 (Linux; Android 7.0; SM-G950U Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:740},viewport:{width:360,height:740},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy S9+":{name:"Galaxy S9+",userAgent:"Mozilla/5.0 (Linux; Android 8.0.0; SM-G965U Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:320,height:658},viewport:{width:320,height:658},deviceScaleFactor:4.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy S24":{name:"Galaxy S24",userAgent:"Mozilla/5.0 (Linux; Android 14; SM-S921U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:780},viewport:{width:360,height:780},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy A55":{name:"Galaxy A55",userAgent:"Mozilla/5.0 (Linux; Android 14; SM-A556B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:480,height:1040},viewport:{width:480,height:1040},deviceScaleFactor:2.25,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy Tab S4":{name:"Galaxy Tab S4",userAgent:"Mozilla/5.0 (Linux; Android 8.1.0; SM-T837A) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:712,height:1138},viewport:{width:712,height:1138},deviceScaleFactor:2.25,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy Tab S9":{name:"Galaxy Tab S9",userAgent:"Mozilla/5.0 (Linux; Android 14; SM-X710) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:640,height:1024},viewport:{width:640,height:1024},deviceScaleFactor:2.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"iPad (gen 5)":{name:"iPad (gen 5)",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:768,height:1024},viewport:{width:768,height:1024},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad (gen 6)":{name:"iPad (gen 6)",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:768,height:1024},viewport:{width:768,height:1024},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad (gen 7)":{name:"iPad (gen 7)",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:810,height:1080},viewport:{width:810,height:1080},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad (gen 11)":{name:"iPad (gen 11)",userAgent:"Mozilla/5.0 (iPad; CPU OS 18_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/19E241 Safari/604.1",screen:{width:656,height:944},viewport:{width:656,height:944},deviceScaleFactor:2.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad Mini":{name:"iPad Mini",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:768,height:1024},viewport:{width:768,height:1024},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad Pro 11":{name:"iPad Pro 11",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:834,height:1194},viewport:{width:834,height:1194},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 6":{name:"iPhone 6",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:375,height:667},viewport:{width:375,height:667},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 6 Plus":{name:"iPhone 6 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:414,height:736},viewport:{width:414,height:736},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 7":{name:"iPhone 7",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:375,height:667},viewport:{width:375,height:667},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 7 Plus":{name:"iPhone 7 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:414,height:736},viewport:{width:414,height:736},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 8":{name:"iPhone 8",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:375,height:667},viewport:{width:375,height:667},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 8 Plus":{name:"iPhone 8 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:414,height:736},viewport:{width:414,height:736},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone SE":{name:"iPhone SE",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/26.0 Mobile/14E304 Safari/602.1",screen:{width:320,height:568},viewport:{width:320,height:568},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone SE (3rd gen)":{name:"iPhone SE (3rd gen)",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 18_5 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/26.0 Mobile/19E241 Safari/602.1",screen:{width:375,height:667},viewport:{width:375,height:667},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone X":{name:"iPhone X",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:375,height:812},viewport:{width:375,height:812},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone XR":{name:"iPhone XR",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:414,height:896},viewport:{width:414,height:896},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 11":{name:"iPhone 11",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:414,height:896},viewport:{width:414,height:715},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 11 Pro":{name:"iPhone 11 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:375,height:812},viewport:{width:375,height:635},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 11 Pro Max":{name:"iPhone 11 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:414,height:896},viewport:{width:414,height:715},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 12":{name:"iPhone 12",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 12 Pro":{name:"iPhone 12 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 12 Pro Max":{name:"iPhone 12 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:428,height:926},viewport:{width:428,height:746},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 12 Mini":{name:"iPhone 12 Mini",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:375,height:812},viewport:{width:375,height:629},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 13":{name:"iPhone 13",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 13 Pro":{name:"iPhone 13 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 13 Pro Max":{name:"iPhone 13 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:428,height:926},viewport:{width:428,height:746},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 13 Mini":{name:"iPhone 13 Mini",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:375,height:812},viewport:{width:375,height:629},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 14":{name:"iPhone 14",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 14 Plus":{name:"iPhone 14 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:428,height:926},viewport:{width:428,height:746},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 14 Pro":{name:"iPhone 14 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:393,height:852},viewport:{width:393,height:660},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 14 Pro Max":{name:"iPhone 14 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:430,height:932},viewport:{width:430,height:740},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 15":{name:"iPhone 15",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:393,height:852},viewport:{width:393,height:659},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 15 Plus":{name:"iPhone 15 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:430,height:932},viewport:{width:430,height:739},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 15 Pro":{name:"iPhone 15 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:393,height:852},viewport:{width:393,height:659},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 15 Pro Max":{name:"iPhone 15 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:430,height:932},viewport:{width:430,height:739},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Kindle Fire HDX":{name:"Kindle Fire HDX",userAgent:"Mozilla/5.0 (Linux; U; en-us; KFAPWI Build/JDQ39) AppleWebKit/535.19 (KHTML, like Gecko) Silk/3.13 Safari/535.19 Silk-Accelerated=true",screen:{width:800,height:1280},viewport:{width:800,height:1280},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"LG Optimus L70":{name:"LG Optimus L70",userAgent:"Mozilla/5.0 (Linux; U; Android 4.4.2; en-us; LGMS323 Build/KOT49I.MS32310c) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:384,height:640},viewport:{width:384,height:640},deviceScaleFactor:1.25,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Microsoft Lumia 550":{name:"Microsoft Lumia 550",userAgent:"Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 550) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36 Edge/14.14263",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Microsoft Lumia 950":{name:"Microsoft Lumia 950",userAgent:"Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 950) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36 Edge/14.14263",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:4,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 10":{name:"Nexus 10",userAgent:"Mozilla/5.0 (Linux; Android 6.0.1; Nexus 10 Build/MOB31T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:800,height:1280},viewport:{width:800,height:1280},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 4":{name:"Nexus 4",userAgent:"Mozilla/5.0 (Linux; Android 4.4.2; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:384,height:640},viewport:{width:384,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 5":{name:"Nexus 5",userAgent:"Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 5X":{name:"Nexus 5X",userAgent:"Mozilla/5.0 (Linux; Android 8.0.0; Nexus 5X Build/OPR4.170623.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:732},viewport:{width:412,height:732},deviceScaleFactor:2.625,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 6":{name:"Nexus 6",userAgent:"Mozilla/5.0 (Linux; Android 7.1.1; Nexus 6 Build/N6F26U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:732},viewport:{width:412,height:732},deviceScaleFactor:3.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 6P":{name:"Nexus 6P",userAgent:"Mozilla/5.0 (Linux; Android 8.0.0; Nexus 6P Build/OPP3.170518.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:732},viewport:{width:412,height:732},deviceScaleFactor:3.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 7":{name:"Nexus 7",userAgent:"Mozilla/5.0 (Linux; Android 6.0.1; Nexus 7 Build/MOB30X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:600,height:960},viewport:{width:600,height:960},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nokia Lumia 520":{name:"Nokia Lumia 520",userAgent:"Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 520)",screen:{width:320,height:533},viewport:{width:320,height:533},deviceScaleFactor:1.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nokia N9":{name:"Nokia N9",userAgent:"Mozilla/5.0 (MeeGo; NokiaN9) AppleWebKit/534.13 (KHTML, like Gecko) NokiaBrowser/8.5.0 Mobile Safari/534.13",screen:{width:480,height:854},viewport:{width:480,height:854},deviceScaleFactor:1,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Pixel 2":{name:"Pixel 2",userAgent:"Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:411,height:731},viewport:{width:411,height:731},deviceScaleFactor:2.625,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 2 XL":{name:"Pixel 2 XL",userAgent:"Mozilla/5.0 (Linux; Android 8.0.0; Pixel 2 XL Build/OPD1.170816.004) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:411,height:823},viewport:{width:411,height:823},deviceScaleFactor:3.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 3":{name:"Pixel 3",userAgent:"Mozilla/5.0 (Linux; Android 9; Pixel 3 Build/PQ1A.181105.017.A1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:393,height:786},viewport:{width:393,height:786},deviceScaleFactor:2.75,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 4":{name:"Pixel 4",userAgent:"Mozilla/5.0 (Linux; Android 10; Pixel 4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:353,height:745},viewport:{width:353,height:745},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 4a (5G)":{name:"Pixel 4a (5G)",userAgent:"Mozilla/5.0 (Linux; Android 11; Pixel 4a (5G)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:892},viewport:{width:412,height:765},deviceScaleFactor:2.63,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 5":{name:"Pixel 5",userAgent:"Mozilla/5.0 (Linux; Android 11; Pixel 5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:393,height:851},viewport:{width:393,height:727},deviceScaleFactor:2.75,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 7":{name:"Pixel 7",userAgent:"Mozilla/5.0 (Linux; Android 14; Pixel 7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:915},viewport:{width:412,height:839},deviceScaleFactor:2.625,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Moto G4":{name:"Moto G4",userAgent:"Mozilla/5.0 (Linux; Android 7.0; Moto G (4)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Desktop Chrome HiDPI":{name:"Desktop Chrome HiDPI",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1792,height:1120},viewport:{width:1280,height:720},deviceScaleFactor:2,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Edge HiDPI":{name:"Desktop Edge HiDPI",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36 Edg/141.0.7390.16",screen:{width:1792,height:1120},viewport:{width:1280,height:720},deviceScaleFactor:2,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Firefox HiDPI":{name:"Desktop Firefox HiDPI",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:142.0.1) Gecko/20100101 Firefox/142.0.1",screen:{width:1792,height:1120},viewport:{width:1280,height:720},deviceScaleFactor:2,isMobile:!1,hasTouch:!1,defaultBrowserType:"firefox"},"Desktop Safari":{name:"Desktop Safari",userAgent:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Safari/605.1.15",screen:{width:1792,height:1120},viewport:{width:1280,height:720},deviceScaleFactor:2,isMobile:!1,hasTouch:!1,defaultBrowserType:"webkit"},"Desktop Chrome":{name:"Desktop Chrome",displayName:"Playwright Chromium",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1920,height:1080},viewport:{width:1920,height:1080},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Chrome Medium Resolution":{name:"Desktop Chrome Medium Resolution",displayName:"Playwright Chromium",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1280,height:720},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Chrome (Branded)":{name:"Desktop Chrome (Branded)",displayName:"Google Chrome",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1920,height:1080},viewport:{width:1920,height:1080},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium",channel:"chrome"},"Desktop Chrome Medium Resolution (Branded)":{name:"Desktop Chrome Medium Resolution (Branded)",displayName:"Google Chrome",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1280,height:720},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium",channel:"chrome"},"Desktop Edge":{name:"Desktop Edge",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36 Edg/141.0.7390.16",screen:{width:1920,height:1080},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Edge (Branded)":{name:"Desktop Edge (Branded)",displayName:"Microsoft Edge",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36 Edg/141.0.7390.16",screen:{width:1920,height:1080},viewport:{width:1920,height:1080},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium",channel:"msedge"},"Desktop Edge Medium Resolution (Branded)":{name:"Desktop Edge Medium Resolution (Branded)",displayName:"Microsoft Edge",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36 Edg/141.0.7390.16",screen:{width:1280,height:720},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium",channel:"msedge"},"Desktop Firefox":{name:"Desktop Firefox",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:142.0.1) Gecko/20100101 Firefox/142.0.1",screen:{width:1920,height:1080},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"firefox"}},Tr=(e=>(e.Desktop="desktop",e.Mobile="mobile",e))(Tr||{}),Ar={desktop:["Desktop Chrome","Desktop Chrome Medium Resolution","Desktop Chrome (Branded)","Desktop Chrome Medium Resolution (Branded)","Desktop Edge (Branded)","Desktop Edge Medium Resolution (Branded)","Desktop Safari"],mobile:["iPhone 15 Pro Max","iPhone 15 Pro","iPhone 15 Plus","iPhone 15","iPhone 14 Pro Max","iPhone 14 Pro","iPhone 14 Plus","iPhone 14","iPhone 13 Pro Max","iPhone 13 Pro","iPhone 13","iPhone 13 Mini","iPhone 12 Pro Max","iPhone 12 Pro","iPhone 12","iPhone 12 Mini","iPhone 11 Pro Max","iPhone 11 Pro","iPhone 11","iPhone XR","iPhone X","iPhone SE (3rd gen)","iPhone SE","iPhone 8 Plus","iPhone 8","iPhone 7 Plus","iPhone 7","iPhone 6 Plus","iPhone 6","Galaxy S24","Galaxy A55","Galaxy S9+","Galaxy S8","Galaxy S5","Galaxy Note 3","Galaxy Note II","Galaxy S III","Pixel 7","Pixel 5","Pixel 4a (5G)","Pixel 4","Pixel 3","Pixel 2 XL","Pixel 2","Nexus 6P","Nexus 6","Nexus 5X","Nexus 5","Nexus 4","Moto G4","LG Optimus L70","Microsoft Lumia 950","Microsoft Lumia 550","Nokia Lumia 520","Nokia N9","BlackBerry Z30"]},Bt=(e,t=!1)=>{let i=["chromium"];return t&&i.push("webkit"),Ar[e].map(n=>Zi[n]).filter(n=>n.defaultBrowserType&&i.includes(n.defaultBrowserType))},Bu=()=>Object.keys(Zi),Qi=e=>Zi[e],ju={desktop:{label:"Desktop",type:"desktop",devices:Bt("desktop")},mobile:{label:"Mobile Web",type:"mobile",devices:Bt("mobile")}},Ku={desktop:{label:"Desktop",type:"desktop",devices:Bt("desktop",!0)},mobile:{label:"Mobile Web",type:"mobile",devices:Bt("mobile",!0)}},No=(e,t=!1)=>{let i={userAgent:fr,viewport:{width:yr,height:xr},isMobile:!1,hasTouch:!1};if(!e||e===ut)return i;let n=Qi(e);if(!n)return i;let{width:o,height:a}=n.viewport,r=Math.max(kr/o,1),s=Math.max(Sr/a,1),l=Math.max(r,s),d={width:Math.round(o*l),height:Math.round(a*l)};return{userAgent:n.userAgent,viewport:t?d:n.viewport,isMobile:n.isMobile,hasTouch:n.hasTouch}},zu=e=>{let t={width:wr,height:br};if(!e||e===ut)return t;let i=No(e);return i.viewport?{width:i.viewport.width,height:i.viewport.height+Do}:t},Vu=e=>{let t={width:vr,height:_r};if(!e||e===ut)return t;let i=No(e);return i.viewport?{width:i.viewport.width,height:i.viewport.height}:t},Xu=e=>!e||e===ut?void 0:Qi(e)?.channel,Yu=e=>!e||e===ut?"chromium":Qi(e)?.defaultBrowserType??"chromium"});var qu,Qu=f(()=>{"use strict";qu=class Zu{data={};sensitive=new Set;get(t){return this.data[t]}set(t,i,n=!1){this.data[t]=i,n?this.sensitive.add(t):this.sensitive.has(t)&&this.sensitive.delete(t)}getAll(){return{...this.data}}isSensitive(t){return this.sensitive.has(t)}getAllSensitiveKeys(){return new Set(this.sensitive)}delete(t){return this.sensitive.delete(t),delete this.data[t]}clear(){this.data={},this.sensitive.clear()}has(t){return t in this.data}get size(){return Object.keys(this.data).length}merge(t){for(let[i,n]of Object.entries(t.getAll()))this.set(i,n,t.isSensitive(i))}toJSON(){return{data:{...this.data},sensitiveKeys:Array.from(this.sensitive)}}static fromJSON(t){let i=new Zu;if(t.data){let n=new Set(t.sensitiveKeys||[]);for(let[o,a]of Object.entries(t.data))i.set(o,a,n.has(o))}return i}}});function eh(e,t=lf()){return{copilot:e?.models?.copilot||t.COPILOT_MODEL||$r,webagent:e?.models?.webagent||t.WEB_AGENT_MODEL||Ro,computer_use:e?.models?.computer_use||t.COMPUTER_USE_MODEL||Pr}}function th(e){if(e){if(e.WEB_AGENT_MODEL)return e.WEB_AGENT_MODEL;if(e.GOOGLE_API_KEY||ih(e))return en;if(e.ANTHROPIC_API_KEY)return Mr;if(e.OPENAI_API_KEY)return Ir;if(e.SHIPLIGHT_API_TOKEN)return Ro}}function ih(e){let t=e.GOOGLE_GENAI_USE_VERTEXAI;return(t==="true"||t==="True")&&!!e.GOOGLE_CLOUD_PROJECT}function nh(e){let t=e?.WEB_AGENT_FALLBACK_MODELS;return t===void 0?[...Or]:t.split(",").map(i=>i.trim()).filter(i=>i.length>0)}function oh(e){if(e){if(e.COMPUTER_USE_MODEL)return e.COMPUTER_USE_MODEL;if(e.GOOGLE_API_KEY||ih(e))return jt;if(e.OPENAI_API_KEY)return Cr;if(e.SHIPLIGHT_API_TOKEN)return jt}}var Mr,en,Ir,jt,Cr,$r,Ro,Pr,lf,Or,ah=f(()=>{"use strict";Mr="claude-haiku-4-5",en="gemini-3.5-flash",Ir="gpt-5.4-mini",jt="gemini-3-flash-preview",Cr="gpt-5.4",$r="claude-sonnet-4-6",Ro=en,Pr=jt,lf=()=>typeof process<"u"?process.env:{};Or=Object.freeze(["anthropic:claude-sonnet-5","google:gemini-3.1-pro-preview"])});var Lr,rh=f(()=>{"use strict";Lr=(e=>(e.INITIALIZING="initializing",e.READY="ready",e.PROCESSING="processing",e.STOPPING="stopping",e.WAITING_USER="waiting_user",e.COMPLETED="completed",e.FAILED="failed",e))(Lr||{})});var Dr={};mt(Dr,{ADDRESS_BAR_HEIGHT:()=>Do,ANDROID_DEVICE_PREFIX:()=>_e,ActionEntitySchema:()=>Ka,ActionSchema:()=>Va,AgentStatus:()=>Lr,BaseStatementSchema:()=>ct,BrowserType:()=>Er,ConditionSchema:()=>Ao,ConditionType:()=>hr,ConditionTypeSchema:()=>Ba,DEFAULT_ANTHROPIC_MODEL:()=>Mr,DEFAULT_COMPUTER_USE_MODEL:()=>Pr,DEFAULT_COPILOT_MODEL:()=>$r,DEFAULT_DEVICE_NAME:()=>ut,DEFAULT_GEMINI_COMPUTER_USE_MODEL:()=>jt,DEFAULT_GOOGLE_MODEL:()=>en,DEFAULT_OPENAI_COMPUTER_USE_MODEL:()=>Cr,DEFAULT_OPENAI_MODEL:()=>Ir,DEFAULT_WEBAGENT_FALLBACK_MODELS:()=>Or,DEFAULT_WEBAGENT_MODEL:()=>Ro,DEFAULT_WHILE_LOOP_TIMEOUT_MS:()=>ku,DEVICE_CATEGORIES:()=>Ar,DeviceType:()=>Tr,DraftSchema:()=>za,IOS_DEVICE_PREFIX:()=>ke,LoginType:()=>mr,MIN_WINDOW_HEIGHT:()=>Sr,MIN_WINDOW_WIDTH:()=>kr,NON_INTENT_ACTIONS:()=>ir,NodeJSCodeCommon:()=>Dd,PLAYWRIGHT_DEVICES:()=>Zi,RECORD_VIDEO_HEIGHT:()=>_r,RECORD_VIDEO_WIDTH:()=>vr,StatementSchema:()=>ce,StatementType:()=>ur,StatementTypeSchema:()=>ja,TestFlowSchema:()=>Mo,TestGroupEntrySchema:()=>Xa,TestGroupSchema:()=>Ji,TwoFactorAuthType:()=>pr,UI_DEVICE_CATEGORIES:()=>ju,UI_DEVICE_CATEGORIES_ELECTRON:()=>Ku,USER_AGENT:()=>fr,VIEWPORT_HEIGHT:()=>xr,VIEWPORT_WIDTH:()=>yr,VariableStore:()=>qu,WINDOW_HEIGHT:()=>br,WINDOW_WIDTH:()=>wr,actionEntityToYaml:()=>tu,actionStepsMapToTestFlowSections:()=>Vd,allowPureVisionAction:()=>Kd,applyPatchToYaml:()=>dr,applyPatchToYamlString:()=>vu,collectActionSteps:()=>Ze,convertPlaywrightActionToEntity:()=>yu,countIntentStatements:()=>nr,createAndroidDeviceName:()=>$u,createEmptyStore:()=>cu,createIOSDeviceName:()=>Pu,createRunnerStoreEntry:()=>du,extractActionStepsFromTestFlow:()=>zd,extractAndAttachComments:()=>er,extractDeviceIdentifier:()=>Cu,extractElementDescription:()=>rr,extractElementDescriptionFromAriaSnapshot:()=>sr,extractLocatorFromCode:()=>lr,extractYamlMetadata:()=>ou,findNextAfterContainer:()=>qe,findNextSibling:()=>Je,findNextStatement:()=>Ye,findPathBetweenStatements:()=>Gd,findStatementPathById:()=>ue,generateUid:()=>bu,getAllDeviceNames:()=>Bu,getAllReferenceIds:()=>Bd,getAllStatementsInOrder:()=>Yi,getAndroidDeviceDisplayName:()=>Ru,getBrowserWindowSize:()=>zu,getCompatiblePlatforms:()=>gr,getDeviceBrowserType:()=>Yu,getDeviceByName:()=>Qi,getDeviceChannel:()=>Xu,getDeviceOptions:()=>No,getDevicesByCategory:()=>Bt,getIOSDeviceDisplayName:()=>Wu,getLoginConfigPlatform:()=>Rd,getRecordVideoSize:()=>Vu,getStatementContainers:()=>We,getStoreSize:()=>gu,getTestPlatformFromDeviceName:()=>Tu,hasReferenceIds:()=>Ga,isAndroidDevice:()=>Mu,isAppPackage:()=>Ou,isDynamicAction:()=>jd,isExecutableStatement:()=>Ud,isIOSDevice:()=>Iu,isNativeDevice:()=>Au,isPhysicalDeviceUDID:()=>Uu,isPlatformCompatibleWithUrl:()=>Lu,isStoreEmpty:()=>pu,isWebUrl:()=>Oo,mergeActionEntitiesIntoTestFlow:()=>fu,mergeStoreUpdates:()=>mu,parseAdbDeviceLine:()=>Du,parseYamlArrayItems:()=>nu,replaceVariables:()=>Hd,resolveActionEntity:()=>uu,resolveComputerUseModelFromEnv:()=>oh,resolveModels:()=>eh,resolveWebAgentFallbackModelsFromEnv:()=>nh,resolveWebAgentModelFromEnv:()=>th,suiteToYaml:()=>Za,testFlowToYaml:()=>Zd,testFlowToYamlObject:()=>qa,toAndroidDeviceName:()=>Nu,toIOSDeviceName:()=>Hu,updateStoreEntry:()=>hu,validatePatch:()=>cr,validateTestYaml:()=>su,yamlObjectsToString:()=>Qd,yamlToActionEntity:()=>iu,yamlToTestFlow:()=>dt});var Nr=f(()=>{"use strict";Nd();Fd();Wd();lu();wu();xu();To();_u();Po();Su();Ya();Eu();Fu();Gu();Lo();Ju();Qu();ah();rh()});import*as Ue from"path";import*as hh from"fs";import{pathToFileURL as cf}from"url";import{test as df,expect as ZM,chromium as uf}from"@playwright/test";import*as re from"fs";import*as pt from"path";import{randomUUID as Ur}from"crypto";import{tmpdir as Gr}from"os";function Br(e){return[`--disable-extensions-except=${e}`,`--load-extension=${e}`,"--no-first-run","--disable-default-apps"]}function jr(e){if(!re.existsSync(e))return console.warn(`[fixture] extensionStorageState file not found: ${e}`),null;let t;try{t=JSON.parse(re.readFileSync(e,"utf-8"))}catch(a){throw new Error(`[fixture] Failed to parse extensionStorageState at ${e}: ${a}`)}let i=t;if(!Array.isArray(i.cookies))return null;let n=(Date.now()+365*24*60*60*1e3)/1e3,o=i.cookies.filter(a=>a&&typeof a=="object"&&typeof a.name=="string"&&typeof a.domain=="string");return o.length<i.cookies.length&&console.warn(`[fixture] Skipped ${i.cookies.length-o.length} malformed cookies (missing name or domain)`),o.map(a=>({...a,expires:n}))}function Kr(e,t=process.cwd()){if(e){let n=pt.resolve(t,e),o=pt.join(Gr(),`ext-profile-${Ur()}`);if(re.existsSync(n)){try{re.cpSync(n,o,{recursive:!0})}catch(r){try{re.rmSync(o,{recursive:!0,force:!0})}catch(s){console.warn("[fixture] Failed to clean up partial profile copy:",o,s)}throw new Error(`[fixture] Failed to copy extension profile from ${n}: ${r}`)}let a=pt.join(o,"SingletonLock");re.existsSync(a)&&re.rmSync(a,{force:!0})}else re.mkdirSync(o,{recursive:!0});return o}let i=pt.join(Gr(),`ext-profile-${Ur()}`);return re.mkdirSync(i,{recursive:!0}),i}Wa();import qA from"dotenv";var Lg="__shiplightDotenvCache__";function Dg(){return globalThis[Lg]}function Ua(){let e=Dg();return e===void 0?process.env:e}function sh(e){return e.config?.rootDir??process.cwd()}async function hf(e,t,i,n=process.cwd()){let o=Ue.resolve(n,e.auth),a=await import(cf(o).href),r=a.login||a.default;if(typeof r!="function")throw new Error(`auth module "${e.auth}" must export a login(args, browser?) function that returns a storageState file path`);let s={...e.args};i&&!s.baseUrl&&(s.baseUrl=i);let l=await r(s,t);if(typeof l!="string")throw new Error(`auth module "${e.auth}" login() must return a storageState file path (got ${typeof l})`);return l}function lh(e){return!(!e||e==="off")}var mf=["acceptDownloads","baseURL","bypassCSP","colorScheme","deviceScaleFactor","extraHTTPHeaders","geolocation","hasTouch","httpCredentials","ignoreHTTPSErrors","isMobile","javaScriptEnabled","locale","offline","permissions","proxy","serviceWorkers","timezoneId","userAgent","viewport"],iI=["storageState","contextOptions","clientCertificates"],pf=[{key:"deviceScaleFactor",conflicts:e=>e!==void 0},{key:"isMobile",conflicts:e=>!!e}];function gf(e){if(e.viewport!==null)return[];let t=[];for(let{key:i,conflicts:n}of pf)n(e[i])&&(delete e[i],t.push(i));return t}function ch(e,t){let i={...e};for(let[o,a]of Object.entries(t))a!==void 0&&(i[o]=a);let n=gf(i);return n.length>0&&console.warn(`[fixture] "viewport: null" (no fixed viewport) is incompatible with ${n.join(" and ")}; dropping ${n.length>1?"them":"it"} so the browser context can be created.`),i}function mh(e,t){return!e||e==="off"?!1:e==="on"?!0:e==="retain-on-failure"?t.status!==t.expectedStatus:e==="on-first-retry"?t.retry>0:typeof e=="object"&&e!==null&&"mode"in e?mh(e.mode,t):!0}async function dh(e,t,i){let n=mh(t,i);for(let o of e)try{if(n){let a=await o.path();await i.attach("video",{path:a,contentType:"video/webm"})}else await o.delete()}catch(a){console.warn("[fixture] Failed to process video:",a)}}var Fo;async function uh(){return Fo||(Fo=await Promise.resolve().then(()=>(Wa(),Ld)),Fo)}var ff=new Set(["get","set","getAll","has","__variableStore"]);function wf(e){let t={__variableStore:e,get(i){return e.get(i)},set(i,n,o=!1){e.set(i,n,o)},getAll(){return e.getAll()}};return new Proxy(t,{get(i,n,o){if(n in i)return Reflect.get(i,n,o);if(typeof n=="string")return i.get(n)},set(i,n,o){return typeof n!="string"||ff.has(n)?Reflect.set(i,n,o):(i.set(n,o),!0)},has(i,n){return n in i?!0:typeof n=="string"?e.has?.(n)??!1:!1}})}function bf(e){if(!e)return null;let t;try{t=JSON.parse(e)}catch(n){throw new Error(`SHIPLIGHT_VARS_OVERRIDE is not valid JSON: ${n.message}`)}if(t===null||typeof t!="object"||Array.isArray(t))throw new Error("SHIPLIGHT_VARS_OVERRIDE must be a JSON object");let i={};for(let[n,o]of Object.entries(t)){if(typeof o!="string")throw new Error(`SHIPLIGHT_VARS_OVERRIDE key "${n}" must be a string`);i[n]=o}return i}function yf(e,t,i){let n=r=>{if(!r||!(e in r))return null;let s=r[e];return s&&typeof s=="object"&&"value"in s?s.sensitive===!0:!1},o=n(i);if(o!==null)return o;let a=n(t);return a!==null?a:!1}function xf(e,t,i,n=process.env.SHIPLIGHT_VARS_OVERRIDE){let o=bf(n);if(o)for(let[a,r]of Object.entries(o)){let s=yf(a,t,i);e.set(a,r,s)}}var vf=["GOOGLE_API_KEY","ANTHROPIC_API_KEY","OPENAI_API_KEY","OPENAI_BASE_URL","ANTHROPIC_MODELS_USE_VERTEXAI","GOOGLE_GENAI_USE_VERTEXAI","GOOGLE_CLOUD_PROJECT","GOOGLE_CLOUD_LOCATION","MAILGUN_API_KEY","MAILGUN_DOMAIN","SHIPLIGHT_API_TOKEN","SHIPLIGHT_API_URL","WEB_AGENT_LLM_TIMEOUT_MS"];function _f(e=Ua()){let t={};for(let i of vf)t[i]=e[i]??"";return t}var nI=df.extend({account:[void 0,{option:!0}],autoDismissModal:[!1,{option:!0}],variables:[void 0,{option:!0}],extensionDir:[void 0,{option:!0}],userDataDir:[void 0,{option:!0}],extensionStorageState:[void 0,{option:!0}],launchOptions:async({launchOptions:e},t)=>{if(!process.env.OMNITERM_BROWSER_REGISTRY_URL){await t(e);return}let i=e?.args??[],n={...e,args:[...i,"--remote-debugging-port=0"]};await t(n)},browser:async({browser:e},t)=>{let i=null;if(process.env.OMNITERM_BROWSER_REGISTRY_URL)try{let n=await xo(process.pid),o=process.env.TEST_WORKER_INDEX??"?";i=await Nt({cdpUrl:n,label:`shiplight test w${o}`,pid:process.pid})}catch{}await t(e),await Rt(i)},context:async({browser:e,account:t,extensionDir:i,userDataDir:n,extensionStorageState:o,acceptDownloads:a,baseURL:r,bypassCSP:s,colorScheme:l,deviceScaleFactor:d,extraHTTPHeaders:c,geolocation:u,hasTouch:m,httpCredentials:g,ignoreHTTPSErrors:y,isMobile:_,javaScriptEnabled:x,locale:p,offline:b,permissions:E,proxy:v,serviceWorkers:k,timezoneId:S,userAgent:I,viewport:O},C,$)=>{let H=i||n,z=sh($),R={acceptDownloads:a,baseURL:r,bypassCSP:s,colorScheme:l,deviceScaleFactor:d,extraHTTPHeaders:c,geolocation:u,hasTouch:m,httpCredentials:g,ignoreHTTPSErrors:y,isMobile:_,javaScriptEnabled:x,locale:p,offline:b,permissions:E,proxy:v,serviceWorkers:k,timezoneId:S,userAgent:I,viewport:O},B={};for(let U of mf){if(!(U in R))throw new Error(`[fixture] HANDLED_CONTEXT_OPTION_KEYS lists "${U}" but the context fixture does not resolve it \u2014 add "${U}" to the fixture destructure and fixtureOptionValues so per-test use: overrides apply.`);B[U]=R[U]}if(H){if(t||$.project.use.auth)throw new Error('Cannot use both "extensionDir"/"userDataDir" and "auth" \u2014 persistent context tests manage their own context. Use extensionStorageState for authentication instead.');let U=$.project.use?.browserName;U&&U!=="chromium"&&console.warn(`[fixture] Persistent context requires Chromium but project is configured for "${U}". Forcing Chromium.`);let de=process.env.PLAYWRIGHT_HEADLESS==="true";i&&de&&console.warn("[fixture] PLAYWRIGHT_HEADLESS=true with extensionDir \u2014 Chrome extensions will not function in headless mode.");let Q=Kr(n,z),oe=i?Br(Ue.resolve(z,i)):[],ee=ch($.project.use,B),{storageState:Pe,account:N,extensionDir:J,userDataDir:te,extensionStorageState:Oe,autoDismissModal:Ho,video:L,...G}=ee,Le=lh(L)?{dir:$.outputDir}:void 0,ae;try{if(ae=await uf.launchPersistentContext(Q,{...G,headless:de,args:oe,viewport:"viewport"in G?G.viewport:{width:1280,height:720},...Le?{recordVideo:Le}:{}}),o){let ht=Ue.resolve(z,o),me=jr(ht);me&&await ae.addCookies(me)}await C(ae)}finally{let ht=ae?.pages().map(me=>me.video()).filter(me=>me!==null)??[];if(await ae?.close().catch(me=>{console.warn("[fixture] Failed to close persistent context:",me)}),await dh(ht,L,$),!n)try{hh.rmSync(Q,{recursive:!0,force:!0})}catch(me){console.warn("[fixture] Failed to clean up temp profile dir:",Q,me)}}}else{let U=ch($.project.use,B),de=$.project.use,Q=de.auth?{auth:de.auth,args:de.args}:t;if(Q){if(!Q.auth)throw new Error("Auth is declared but missing the script path. Provide auth in playwright.config.ts: use: { auth: './auth.login.ts' }");U.storageState=await hf(Q,e,r,z)}let oe=U.video;lh(oe)&&!U.recordVideo&&(U.recordVideo={dir:$.outputDir});let ee=await e.newContext(U);ee.addInitScript(Ve);try{await C(ee)}finally{let Pe=ee.pages().map(N=>N.video()).filter(N=>N!==null);await ee.close(),await dh(Pe,oe,$)}}},page:async({context:e},t)=>{let i=await e.newPage();await t(i)},testContext:async({variables:e},t,i)=>{let{VariableStore:n}=await uh(),o=new n,a=l=>{if(l)for(let[d,c]of Object.entries(l))typeof c=="string"?o.set(d,c,!1):c&&typeof c=="object"&&"value"in c&&o.set(d,c.value,c.sensitive===!0)},r=i.project.use.variables;a(r),a(e),xf(o,r,e);let s=wf(o);global.testContext=s,global.$=s,global.ctx=s,await t(s),delete global.testContext,delete global.$,delete global.ctx},$:async({testContext:e},t)=>{await t(e)},ctx:async({testContext:e},t)=>{await t(e)},agent:async({page:e,testContext:t,autoDismissModal:i},n,o)=>{let{WebAgent:a,createAgentContext:r,configureSdk:s,parseSdkLogLevelFromEnv:l}=await uh(),d=l();s({env:_f(),...d!==void 0&&{logLevel:d}});let{resolveWebAgentModelFromEnv:c,resolveComputerUseModelFromEnv:u,resolveWebAgentFallbackModelsFromEnv:m}=await Promise.resolve().then(()=>(Nr(),Dr)),g=Ua(),y=c(g);if(!y)throw new Error("No AI model configured. Set WEB_AGENT_MODEL, GOOGLE_API_KEY, ANTHROPIC_API_KEY, OPENAI_API_KEY, SHIPLIGHT_API_TOKEN, or Google Vertex via ADC (GOOGLE_GENAI_USE_VERTEXAI=true + GOOGLE_CLOUD_PROJECT) in your .env file (or in the runner environment for CI).");let _=u(g),x=m(g),p=t.__variableStore,b=r({model:y,fallbackModels:x,computer_use_model:_,variableStore:p,autoDismissModal:i,testDataDir:sh(o),downloadDir:Ue.join(o.outputDir,"downloads")}),E=Ue.join(o.outputDir,"artifacts");b.stepTracking={results:{},artifactsDir:E};let v=new a(b),k=e.context();v.agentServices.setupPageTracking(k);for(let S of k.pages())v.setupDownloadTracking(S),v.setupDialogHandling(S);k.on("page",S=>{v.setupDownloadTracking(S),v.setupDialogHandling(S)}),global.agent=v,await n(v),delete global.agent;try{let S=o.outputDir;await v.writeExecutionResults(S);let I=Ue.join(S,"test-results.json");await(await import("fs/promises")).stat(I).catch(()=>null)&&await o.attach("shiplight-results",{path:I,contentType:"application/json"})}catch(S){console.error("[Shiplight] Failed to attach step results:",S)}try{let S=v.getNewActionEntities();if(S.size>0&&o.status==="passed"){let{createEmptyStore:I,createRunnerStoreEntry:O}=await Promise.resolve().then(()=>(Nr(),Dr)),C=await import("fs/promises"),$=I();for(let[z,R]of S)$.entries[z]=O(R,0);let H=Ue.join(o.outputDir,"new-action-entities.json");await C.writeFile(H,JSON.stringify($,null,2)),await o.attach("shiplight-new-action-entities",{path:H,contentType:"application/json"}),console.log(`[Shiplight] ${S.size} healed action entit${S.size===1?"y":"ies"} saved`)}}catch(S){console.warn("[Shiplight] Failed to persist new action entities:",S)}}});export{iI as EXCLUDED_CONTEXT_OPTION_KEYS,mf as HANDLED_CONTEXT_OPTION_KEYS,vf as SDK_ENV_ALLOWLIST,pf as VIEWPORT_INCOMPATIBLE_OPTIONS,xf as applyVarsOverride,_f as buildSdkEnv,wf as createTestContext,gf as dropViewportIncompatibleOptions,ZM as expect,yf as isDeclaredSensitive,ch as mergeResolvedContextOptions,bf as parseVarsOverrideEnv,hf as resolveAuthState,sh as resolveProjectRoot,nI as test};
|