shiplightai 0.1.81 → 0.1.82

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.
@@ -4298,11 +4298,11 @@ ${h.join(`
4298
4298
  `,n+=`- Use the EXACT placeholder name as shown above
4299
4299
  `,n+=`- Do NOT use the actual value directly in the action
4300
4300
  `,n+=`- The values shown are for context only to help you understand what data is available
4301
- `,n+='- In action descriptions, describe what the placeholder represents in natural language (e.g., "Type the first user name" instead of "Type {{ firstUserName }}")',n}}});var si=x(()=>{"use strict"});async function Sd(e,t){let i=new Set,n=Date.now(),a=new Set(["document","stylesheet","image","font","script","iframe"]),o=new Set(["text/html","text/css","application/javascript","image/","font/","application/json"]),r=["analytics","tracking","telemetry","beacon","metrics","doubleclick","adsystem","adserver","advertising","facebook.com/plugins","platform.twitter","linkedin.com/embed","livechat","zendesk","intercom","crisp.chat","hotjar","push-notifications","onesignal","pushwoosh","heartbeat","ping","alive","webrtc","rtmp://","wss://","cloudfront.net","fastly.net"],l=u=>{let p=u.toLowerCase();return p.startsWith("data:")||p.startsWith("blob:")?!0:r.some(h=>p.includes(h))},s=u=>{let p=u.resourceType(),h=u.url();if(!a.has(p)||l(h))return;let f=u.headers();f.purpose==="prefetch"||["video","audio"].includes(f["sec-fetch-dest"])||(i.add(u),n=Date.now())},c=async u=>{let p=u.request();if(!i.has(p))return;let h=(u.headers()["content-type"]||"").toLowerCase();if(["streaming","video","audio","webm","mp4","event-stream","websocket","protobuf"].some(g=>h.includes(g))){i.delete(p);return}if(![...o].some(g=>h.startsWith(g))){i.delete(p);return}let f=u.headers()["content-length"];if(f)try{if(parseInt(f,10)>5*1024*1024){i.delete(p);return}}catch{}i.delete(p),n=Date.now()},d=Date.now()-kd;for(let u of await e.requests()){let p=u.resourceType(),h=u.url(),f=u.timing();a.has(p)&&!l(h)&&f.responseEnd===-1&&f.startTime>=d&&(i.add(u),n=Date.now())}w.debug(`[waitForStableNetwork] Pre-populated ${i.size} in-flight requests`),e.on("request",s),e.on("response",c);try{let u=Date.now(),p=_d;for(;;){await new Promise(f=>setTimeout(f,100));let h=Date.now();if(i.size===0&&h-n>=p){w.debug(`[waitForStableNetwork] Network idle after ${h-u}ms`);break}if(h-u>t){w.debug(`[waitForStableNetwork] Max wait time exceeded (${t}ms), pending: ${i.size}`);break}}}finally{e.removeListener("request",s),e.removeListener("response",c)}}async function it(e,t=vd,i=xd){let n=Date.now();try{await Promise.all([e.waitForLoadState("load",{timeout:t}).catch(()=>{}),Sd(e,t)])}catch(r){throw r instanceof Error?new Error(`Failed during network stabilization: ${r.message}`):new Error("An unknown error occurred during network stabilization.")}let a=Date.now()-n,o=Math.max(i-a,0);o>0&&await new Promise(r=>setTimeout(r,o))}var xd,vd,_d,kd,Oe=x(()=>{"use strict";si();U();xd=.5*1e3,vd=30*1e3,_d=1*1e3,kd=3*1e3});import{generateText as Ed}from"ai";function Td(e,t){return e?{prompt_tokens:e.promptTokens||e.inputTokens||0,completion_tokens:e.completionTokens||e.outputTokens||0,total_tokens:e.totalTokens||0,model:t}:null}async function zr(e,t,i={}){let n=Date.now();if(i.maxSteps!==void 0&&i.maxSteps<=0)throw new Error(`maxSteps must be >= 1, got ${i.maxSteps}`);let a=i.maxSteps??15,o=3,r=t.agentServices.getModel(),l=t.domService||new Ne(t.agentServices.getDomServiceOptions()),s={...t,domService:l};E.init(),E.section("Task Execution Started"),E.log(`Task: ${e}`),E.log(`Max steps: ${a}`),E.log(`Model: ${r}`);let c={currentStep:0,maxSteps:a,consecutiveFailures:0,maxFailures:o,lastFailReason:null,stepHistory:[],memory:[],lastGoal:null,lastEvaluation:null},d=[],u=un(i.customPrompt),p=new mn(u);E.log(`System prompt length: ${u.length} chars`);let h=!1,f="",g=[];try{for(i.onEvent?.({type:"start",task:e,maxSteps:a});c.currentStep<a;){if(i.abortSignal?.aborted)throw new Error("Task aborted by user");c.currentStep++;let y=Date.now();E.section(`Step ${c.currentStep}/${a}`),E.log(`URL: ${s.page.url()}`),i.onEvent?.({type:"step_start",step:c.currentStep});try{E.log("Waiting for page to stabilize..."),await it(s.page),E.log("Page stabilized")}catch{E.log("Page stabilization timed out, continuing anyway")}let m;try{E.log("Preparing context (DOM + screenshot)...");let N=s.agentServices.getInteractiveClassNames(),O=s.agentServices.getIframeFallbackDomains();m=await Kr(s.page,s.domService,N,O),E.log("Context prepared")}catch(N){if(N.message.includes("Execution context was destroyed")){E.log("Page navigating, waiting for load..."),await it(s.page);let O=s.agentServices.getInteractiveClassNames(),L=s.agentServices.getIframeFallbackDomains();m=await Kr(s.page,s.domService,O,L)}else throw E.error("Error preparing context",N),N}p.addStateMessage(e,m.currentUrl,m.domTree,m.screenshotBase64,c,{isFinalStep:c.currentStep===a-1,placeholderData:t.variables,sensitiveKeys:t.sensitiveKeys});let b=await $d(p,r,i,m.screenshotBase64);if(b.tokenUsages&&b.tokenUsages.length>0&&d.push(...b.tokenUsages),!b.stepOutput){if(E.error("Failed to get valid LLM response"),c.consecutiveFailures++,c.consecutiveFailures>=o){f="Reached the maximum allowed consecutive failures. Most recent error: Unable to get a valid response from the language model.";break}continue}let v=b.stepOutput;Cd(c.currentStep,a,v);let S=await Id(v,s,m.domState,c.currentStep,i.onEvent,m.screenshotBase64,b.debugInfo);g.push(...S.actionEntities);let T=Pd(c.currentStep,v,S,c,y,b.debugInfo,b.tokenUsages),M=Date.now()-y;if(i.onEvent?.({type:"step_complete",step:c.currentStep,duration:M}),c.consecutiveFailures>=o){E.error(`Too many consecutive failures (${c.consecutiveFailures}), stopping`),f=`Reached the maximum allowed consecutive failures. Most recent error: ${c.lastFailReason}`;break}if(S.doneResult){h=S.doneResult.success,f=S.doneResult.summary;break}if(S.completesInstruction){h=!0,f="Instruction completed";break}}return c.currentStep>=a&&!h&&(f="Reached the maximum allowed steps."),i.onEvent?.({type:"complete",totalSteps:c.currentStep,duration:Date.now()-n}),E.log(`Build success result: summary=${f}, completed=${h}, actions=${g.length}, tokens=${d.length}`),Nd(c,g,h,f,n,d,r)}catch(y){let m=y.message;return E.error(`Task execution failed: ${m}`,y),i.onEvent?.({type:"error",error:m,recoverable:!1}),Od(c,m,n,d,r)}}async function Kr(e,t,i,n){let{domState:a,screenshotBase64:o}=await t.getClickableElementsWithScreenshot(e,{interactiveClassNames:i,playwrightFrameFallbackDomains:n}),r=a.elementTree.clickableElementsToString();return{currentUrl:e.url(),domTree:r,screenshotBase64:o,domState:a}}function Ad(e){return e.map(t=>({role:t.role,content:Array.isArray(t.content)?t.content.map(i=>{if(i.type==="image"){let n=i.image,a=typeof n=="string"?n:"";return{type:"image",file:a.startsWith("data:")?a:`data:image/png;base64,${a}`}}return{type:"text",text:i.text}}):t.content}))}async function $d(e,t,i,n){let a=i.temperature??0,{system:o,messages:r}=e.getMessages(),l=0;for(let u of r)Array.isArray(u.content)&&(l+=u.content.filter(p=>p.type==="image").length);let s=ve(t,l),c={model:xe(t),system:o,messages:r,temperature:a,providerOptions:s},d=3;for(let u=0;u<d;u++)try{let p=Date.now();E.log(`Calling LLM (${t})...`);let h=await Ed(c),f=Date.now()-p,g=h,y=g.usage;E.llmCall(t,f,y);let m=g.reasoningText;m&&(E.thinking(m),i.onEvent?.({type:"thinking",text:m})),e.addAssistantMessage(h.text);let b={systemPrompt:o,userPrompt:Ad(r),rawLlmResponse:h.text,reasoningContent:m,screenshotWithSom:n},v=[],S=Td(y,t);S&&v.push(S);let T=Md(h.text);if(!T)if(u<d-1){E.log(`Attempt ${u+1}/${d}: Failed to parse response, retrying...`),e.addTextMessage("user","Your response was not valid JSON. Please respond with a properly formatted JSON object according to the expected format."),await new Promise(M=>setTimeout(M,i.retryDelay||1e3));continue}else return E.error("All parsing attempts failed"),{stepOutput:null,debugInfo:b,tokenUsages:v};return{stepOutput:T,debugInfo:b,tokenUsages:v}}catch(p){if(u<d-1){E.log(`Attempt ${u+1}/${d}: LLM call failed (${p.message}), retrying...`),await new Promise(h=>setTimeout(h,i.retryDelay||1e3));continue}else throw E.error("All LLM call attempts failed",p),p}return{stepOutput:null}}function Md(e){let t=e.trim();t.startsWith("```json")?t=t.replace(/^```json\s*/,"").replace(/\s*```\s*$/,""):t.startsWith("```")&&(t=t.replace(/^```\s*/,"").replace(/\s*```\s*$/,""));try{let i=JSON.parse(t);if(!i.current_goal)return E.error("Missing required field: current_goal"),null;if(!i.actions||!Array.isArray(i.actions)||i.actions.length===0)return E.error("Missing required field: actions (must be non-empty array)"),null;for(let n of i.actions){if(!n.action_name)return E.error("Action missing required field: action_name"),null;if(!n.description)return E.error("Action missing required field: description"),null}return i}catch(i){return E.error(`Failed to parse LLM JSON response: ${t.substring(0,500)}`),E.error(`Parse error: ${i.message}`),null}}async function Id(e,t,i,n,a,o,r){let l=[],s=!0,c=null;E.log(`Using pre-captured DOM state with ${i.selectorMap.size} elements for ${e.actions.length} action(s)`);let d=null,u={...t,domState:i},p=o;for(let h of e.actions){if(h.action_name==="done"){d={success:h.kwargs.success??!0,summary:h.kwargs.summary||h.kwargs.text||"Task completed"};break}let f={},g=h.kwargs?.element_index??h.kwargs?.index;if(typeof g=="number"){let m=i.selectorMap.get(g);m&&(f=await H(t.page,m))}let y={...f,action_description:h.description,action_data:{action_name:h.action_name,kwargs:h.kwargs}};try{let m=await j.execute(h.action_name,h.kwargs,u);h.action_name==="perform_accurate_operation"&&(y=m.actionEntity);let b=await u.agentServices.getCurrentPage();if(b&&(u.page=b,t.page=u.page),m?.success===!1){s=!1,E.log("Action failed, stopping execution of remaining actions in this step"),c=m.error||"Action execution failed";break}l.push(y),a?.({type:"action",action_entity:y,step:n,debugInfo:r})}catch(m){s=!1,c=m.message,E.error(`Action execution failed: ${m.message}`);break}}return{allSuccess:s,failReason:c,actionEntities:l,doneResult:d,completesInstruction:e.completes_instruction??!1}}function Pd(e,t,i,n,a,o,r){let l={stepNumber:e,thinking:t.thinking,evaluation:t.evaluation_previous_goal,memory:t.memory,goal:t.current_goal,actions:i.actionEntities,timestamp:a,duration:Date.now()-a,outcome:{success:i.allSuccess},debugInfo:o,tokenUsages:r};if(n.lastGoal=t.current_goal,t.evaluation_previous_goal&&(n.lastEvaluation=t.evaluation_previous_goal),t.memory&&t.memory.trim()){let s=t.memory.trim();n.memory.includes(s)||(n.memory.push(s),n.memory.length>10&&(n.memory=n.memory.slice(-10)))}return i.allSuccess?(n.consecutiveFailures=0,n.lastFailReason=null):(n.consecutiveFailures++,n.lastFailReason=i.failReason),n.stepHistory.push(l),l}function Cd(e,t,i){if(E.log(`Step ${e}/${t}`),i.thinking&&E.log(`Thinking: ${i.thinking}`),i.evaluation_previous_goal&&E.log(`Evaluation: ${i.evaluation_previous_goal}`),i.memory&&E.log(`Memory: ${i.memory}`),E.log(`Goal: ${i.current_goal}`),i.actions.length===1){let n=i.actions[0];E.log(`Action: ${n.action_name}(${JSON.stringify(n.kwargs)}) - ${n.description}`)}else E.log(`Actions (${i.actions.length}):`),i.actions.forEach((n,a)=>{E.log(` ${a+1}. ${n.action_name}(${JSON.stringify(n.kwargs)}) - ${n.description}`)})}function Nd(e,t,i,n,a,o,r){let l=o.reduce((d,u)=>d+u.prompt_tokens,0),s=o.reduce((d,u)=>d+u.completion_tokens,0),c=o.reduce((d,u)=>d+u.total_tokens,0);return{success:!0,completed:i,summary:n,trajectory:{steps:e.currentStep,actions:t,stepRecords:e.stepHistory},metadata:{totalSteps:e.currentStep,totalDuration:Date.now()-a,model:r,successfulSteps:e.stepHistory.filter(d=>d.outcome.success).length,failedSteps:e.stepHistory.filter(d=>!d.outcome.success).length,promptTokens:l,completionTokens:s,totalTokens:c,tokenUsages:o}}}function Od(e,t,i,n,a){let o=n.reduce((s,c)=>s+c.prompt_tokens,0),r=n.reduce((s,c)=>s+c.completion_tokens,0),l=n.reduce((s,c)=>s+c.total_tokens,0);return{success:!1,completed:!1,error:t,trajectory:{steps:e.currentStep,actions:[],stepRecords:e.stepHistory},metadata:{totalSteps:e.currentStep,totalDuration:Date.now()-i,model:a,successfulSteps:e.stepHistory.filter(s=>s.outcome.success).length,failedSteps:e.stepHistory.filter(s=>!s.outcome.success).length,promptTokens:o,completionTokens:r,totalTokens:l,tokenUsages:n}}}var Vr=x(()=>{"use strict";la();hn();ke();He();ae();Oe();_e();X()});var Xr={};dt(Xr,{TaskMessageManager:()=>mn,formatFinalStepWarning:()=>Br,formatTaskContext:()=>dn,getBrowserTaskJSONPrompt:()=>un,runTaskLoop:()=>zr});var Yr=x(()=>{"use strict";Vr();la();hn();ke();Gi();He();xt();vt();Ze();_t();kt();ae();Oe();si();_e();gt();Ve();ft();Ce();ze();X();Re();U();ne();Tt();W();ye()});async function At(e,t){try{if(!e.action_data)return{success:!1,error:"Action entity missing action_data"};let{action_name:i,kwargs:n}=e.action_data;if(j.has(i)){let a=await j.execute(i,n,t),o=a?.success!==!1,r=a?.error||a?.message;return{success:o,error:o?void 0:r}}else{let{page:a,agentServices:o}=t;return await(await Ld()).execute(a,e,o),{success:!0,error:void 0}}}catch(i){return{success:!1,error:i.message}}}async function Ld(){if(pn)return pn;let e=await Promise.resolve().then(()=>(cn(),ln));return pn=new e.default,pn}async function Ki(e,t,i,n={},a){let o=a||{page:t,agentServices:i,domService:new Ne(i.getDomServiceOptions()),executionHistory:n.executionHistory,variables:n.variables,sensitiveKeys:n.sensitiveKeys},r=i.replaceVariables(e),l=await Dn(r,o,n);return l.status==="error"?{status:"error",completed:l.goalAccomplished||!1,actionEntities:[],explanation:l.reasoning,error:l.error,debugInfo:l.debugInfo}:{status:"success",completed:l.goalAccomplished||!1,actionEntities:l.actionEntity?[l.actionEntity]:[],explanation:l.reasoning,debugInfo:l.debugInfo}}async function zi(e,t,i,n={},a){let o=a||{page:t,agentServices:i,domService:new Ne(i.getDomServiceOptions()),executionHistory:n.executionHistory,variables:n.variables,sensitiveKeys:n.sensitiveKeys},r=i.replaceVariables(e),l=await Dn(r,o,n);if(l.status==="error"||!l.actionEntity)return{status:"error",completed:l.goalAccomplished||!1,actionEntities:[],explanation:l.reasoning,error:l.error||"No action generated",debugInfo:l.debugInfo};let{actionEntity:s,reasoning:c,goalAccomplished:d,debugInfo:u}=l,p=await At(s,o);return p.success?(c&&i.addNote(c),{status:"success",completed:d||!1,actionEntities:[s],explanation:c,debugInfo:u}):{status:"error",completed:!1,actionEntities:[s],error:p.error||"Action execution failed",debugInfo:u}}async function Vi(e,t,i,n={}){let a={page:t,agentServices:i,domService:new Ne(i.getDomServiceOptions()),executionHistory:n.executionHistory,variables:n.variables,sensitiveKeys:n.sensitiveKeys},o=i.replaceVariables(e);return n.useCleanScreenshotForAssertion??(n.useCleanScreenshotForAssertion=i.isUseCleanScreenshotForAssertion()),so(o,a,n)}async function Xi(e,t,i,n,a={}){let{runTaskLoop:o}=await Promise.resolve().then(()=>(Yr(),Xr)),r=n?s=>{n(s)}:void 0,l=await o(e,{page:t,agentServices:i,domService:void 0,executionHistory:a.executionHistory,variables:a.variables,sensitiveKeys:a.sensitiveKeys},{maxSteps:a.maxSteps,onEvent:r,abortSignal:a.abortSignal});return{status:l.success?"success":"error",completed:l.completed,actionEntities:l.trajectory.actions,explanation:l.summary,error:l.error,tokenUsages:l.metadata.tokenUsages}}var pn,$t=x(()=>{"use strict";Li();ke();He();pn=null});import{z as _}from"zod";import"yaml";import"uuid";import"yaml";import"uuid";var ms,Lv,ps,Gd,Kd,fn,Dv,Rv,gs,fs,zd,hs,Vd,li,Xd,Yd,Jd,le,qd,Zd,Hv,Jv,ci=x(()=>{"use strict";ye();ms=112,Lv=1080-ms,ps=(e=>(e.Chromium="chromium",e.Firefox="firefox",e.Webkit="webkit",e))(ps||{}),Gd={"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"}},Kd={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"]},fn=(e,t=!1)=>{let i=["chromium"];return t&&i.push("webkit"),Kd[e].map(n=>Gd[n]).filter(n=>n.defaultBrowserType&&i.includes(n.defaultBrowserType))},Dv={desktop:{label:"Desktop",type:"desktop",devices:fn("desktop")},mobile:{label:"Mobile Web",type:"mobile",devices:fn("mobile")}},Rv={desktop:{label:"Desktop",type:"desktop",devices:fn("desktop",!0)},mobile:{label:"Mobile Web",type:"mobile",devices:fn("mobile",!0)}},gs=(e=>(e.PASSWORD="password",e.OAUTH2="oauth2",e.SSO="sso",e.API="api",e))(gs||{}),fs=(e=>(e.SMS="sms",e.EMAIL="email",e.TOTP="totp",e))(fs||{}),zd=_.enum(["JS_CODE","AI_MODE"]),hs=_.object({type:zd,expression:_.string()}),Vd=_.enum(["DRAFT","STEP","ACTION","IF_ELSE","WHILE_LOOP"]),li=_.object({uid:_.string(),type:Vd,comment:_.string().optional()}),Xd=_.object({action_data:_.object({action_name:_.string(),kwargs:_.record(_.any()).optional(),args:_.array(_.any()).optional()}),action_description:_.string().optional(),url:_.string().optional(),xpath:_.string().nullable().optional(),locator:_.string().nullable().optional(),css_selector:_.string().nullable().optional(),unique_selector:_.string().nullable().optional(),element_index:_.number().nullable().optional(),frame_path:_.array(_.any()).optional(),artifacts:_.record(_.any()).optional(),feedback:_.string().optional(),original_browser_use_action:_.any().optional()}).passthrough(),Yd=li.extend({type:_.literal("DRAFT"),description:_.string()}),Jd=li.extend({type:_.literal("ACTION"),description:_.string(),action_entity:Xd.optional(),locator:_.string().optional(),use_pure_vision:_.boolean().optional()}),le=_.lazy(()=>_.union([Yd,Jd,li.extend({type:_.literal("STEP"),description:_.string().optional().default(""),statements:_.array(le),reference_id:_.number().optional(),template_path:_.string().optional(),template_params:_.record(_.string()).optional()}),li.extend({type:_.literal("IF_ELSE"),description:_.string().optional(),condition:hs,then:_.array(le),else:_.array(le).optional()}),li.extend({type:_.literal("WHILE_LOOP"),description:_.string().optional(),condition:hs,body:_.array(le),timeout_ms:_.number().optional()})])),qd=_.object({name:_.string(),statements:_.array(le),teardown:_.array(le).optional(),skip:_.union([_.boolean(),_.string()]).optional(),timeout:_.number().optional(),fail:_.union([_.boolean(),_.string()]).optional(),only:_.boolean().optional(),slow:_.boolean().optional()}),Zd=_.object({tests:_.array(qd).min(1),beforeAll:_.array(le).optional(),afterAll:_.array(le).optional(),beforeEach:_.array(le).optional(),afterEach:_.array(le).optional()}),Hv=_.object({comment:_.string().optional(),version:_.string().optional(),goal:_.string().optional(),url:_.string().optional(),baseURL:_.string().optional(),final_feedback:_.string().optional(),completed:_.boolean().optional(),success:_.boolean().optional(),statements:_.array(le).optional(),teardown:_.array(le).optional(),last_modified_at:_.string().optional(),testGroup:Zd.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"}),Jv=1024*1024});var da=x(()=>{"use strict";ae();Oe()});import{z as k}from"zod";var vs,ua,_s,at,ks,Ss,Es,re,Ts,wn,ha,ma=x(()=>{"use strict";vs=k.enum(["JS_CODE","AI_MODE"]),ua=k.object({type:vs,expression:k.string()}),_s=k.enum(["DRAFT","STEP","ACTION","IF_ELSE","WHILE_LOOP"]),at=k.object({uid:k.string(),type:_s,comment:k.string().optional()}),ks=k.object({action_data:k.object({action_name:k.string(),kwargs:k.record(k.any()).optional(),args:k.array(k.any()).optional()}),action_description:k.string().optional(),url:k.string().optional(),xpath:k.string().nullable().optional(),locator:k.string().nullable().optional(),css_selector:k.string().nullable().optional(),unique_selector:k.string().nullable().optional(),element_index:k.number().nullable().optional(),frame_path:k.array(k.any()).optional(),artifacts:k.record(k.any()).optional(),feedback:k.string().optional(),original_browser_use_action:k.any().optional()}).passthrough(),Ss=at.extend({type:k.literal("DRAFT"),description:k.string()}),Es=at.extend({type:k.literal("ACTION"),description:k.string(),action_entity:ks.optional(),locator:k.string().optional(),use_pure_vision:k.boolean().optional()}),re=k.lazy(()=>k.union([Ss,Es,at.extend({type:k.literal("STEP"),description:k.string().optional().default(""),statements:k.array(re),reference_id:k.number().optional(),template_path:k.string().optional(),template_params:k.record(k.string()).optional()}),at.extend({type:k.literal("IF_ELSE"),description:k.string().optional(),condition:ua,then:k.array(re),else:k.array(re).optional()}),at.extend({type:k.literal("WHILE_LOOP"),description:k.string().optional(),condition:ua,body:k.array(re),timeout_ms:k.number().optional()})])),Ts=k.object({name:k.string(),statements:k.array(re),teardown:k.array(re).optional(),skip:k.union([k.boolean(),k.string()]).optional(),timeout:k.number().optional(),fail:k.union([k.boolean(),k.string()]).optional(),only:k.boolean().optional(),slow:k.boolean().optional()}),wn=k.object({tests:k.array(Ts).min(1),beforeAll:k.array(re).optional(),afterAll:k.array(re).optional(),beforeEach:k.array(re).optional(),afterEach:k.array(re).optional()}),ha=k.object({comment:k.string().optional(),version:k.string().optional(),goal:k.string().optional(),url:k.string().optional(),baseURL:k.string().optional(),final_feedback:k.string().optional(),completed:k.boolean().optional(),success:k.boolean().optional(),statements:k.array(re).optional(),teardown:k.array(re).optional(),last_modified_at:k.string().optional(),testGroup:wn.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 US,parse as Is,parseAllDocuments as jS,parseDocument as pu,Document as Ps,isMap as rt,isSeq as se}from"yaml";import{v4 as me}from"uuid";function yn(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(ce)};return e.final_feedback&&(i.final_feedback=e.final_feedback),e.teardown&&e.teardown.length>0&&(i.teardown=e.teardown.map(ce)),i}function ga(e,t){if(e.testGroup)return Ns(e,t);let i=yn(e,t),n=new Ps(i),a=n.contents?.get("tags",!0);return se(a)&&(a.flow=!0),e.comment&&(n.commentBefore=e.comment),As(n,e.statements??[]),e.teardown&&As(n,e.teardown,"teardown"),n.toString(Cs)}function As(e,t,i="statements"){let n=e.contents;if(!n||!rt(n))return;let a=n.get(i,!0);se(a)&&hi(a,t)}function hi(e,t){for(let i=0;i<Math.min(e.items.length,t.length);i++){let n=t[i],a=e.items[i];if(i>0&&(a.spaceBefore=!0),n.comment&&(i===0?e.commentBefore=n.comment:a.commentBefore=n.comment),rt(a)){let o=a;if(n.type==="STEP"){let r=o.get("statements",!0);se(r)&&hi(r,n.statements)}else if(n.type==="IF_ELSE"){let r=o.get("THEN",!0);se(r)&&hi(r,n.then);let l=o.get("ELSE",!0);se(l)&&n.else&&hi(l,n.else)}else if(n.type==="WHILE_LOOP"){let r=o.get("DO",!0);se(r)&&hi(r,n.body)}}}}function Ns(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 a={};e.baseURL&&(a.base_url=e.baseURL),i.beforeAll&&i.beforeAll.length>0&&(a.beforeAll=i.beforeAll.map(ce)),i.beforeEach&&i.beforeEach.length>0&&(a.beforeEach=i.beforeEach.map(ce)),i.afterEach&&i.afterEach.length>0&&(a.afterEach=i.afterEach.map(ce)),i.afterAll&&i.afterAll.length>0&&(a.afterAll=i.afterAll.map(ce)),a.tests=i.tests.map(l=>{let s={name:l.name};return l.skip!==void 0&&(s.skip=l.skip),l.timeout!==void 0&&(s.timeout=l.timeout),l.fail!==void 0&&(s.fail=l.fail),l.only!==void 0&&(s.only=l.only),l.slow!==void 0&&(s.slow=l.slow),s.statements=l.statements.map(ce),l.teardown&&l.teardown.length>0&&(s.teardown=l.teardown.map(ce)),s}),n.suite=a;let o=new Ps(n),r=o.contents?.get("tags",!0);return se(r)&&(r.flow=!0),o.toString(Cs)}function ce(e){switch(e.type){case"DRAFT":return gu(e);case"ACTION":return fu(e);case"STEP":return wu(e);case"IF_ELSE":return yu(e);case"WHILE_LOOP":return bu(e)}}function gu(e){return{intent:e.description}}function fu(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 l=i?.statement;if(typeof l=="string"&&!e.action_entity?.locator&&!e.action_entity?.xpath){let s=i?.code;return typeof s=="string"&&s.trim()?{VERIFY:l,js:s}:{VERIFY:l}}}if(t==="go_to_url"){let l=i?.url;if(typeof l=="string"&&!e.action_entity?.locator&&!e.action_entity?.xpath){let s={URL:l};return i?.new_tab===!0&&(s.new_tab=!0),typeof i?.timeout_seconds=="number"&&(s.timeout_seconds=i.timeout_seconds),s}}if(t==="js_action"){let l=i?.code;if(typeof l=="string"&&l.trim()&&e.description)return{description:e.description,js:l}}if(t==="ai_wait_until"){let l=i?.condition;if(typeof l=="string"){let s={WAIT_UNTIL:l};return typeof i?.timeout_seconds=="number"&&i.timeout_seconds!==60&&(s.timeout_seconds=i.timeout_seconds),s}}if(t==="wait"){let l=i?.seconds,c={WAIT:e.description||`Wait ${l}s`};return typeof l=="number"&&(c.seconds=l),c}if(t==="js_code"){let l=i?.code;if(typeof l=="string"&&!e.action_entity?.locator&&!e.action_entity?.xpath)return{description:e.description||"Code block",js:l}}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 a={intent:e.description,action:n.action_name},o=e.locator??e.action_entity.locator;o&&(a.locator=o);let r=e.action_entity.xpath;if(r&&(a.xpath=r),e.use_pure_vision&&(a.use_pure_vision=!0),n.kwargs&&Object.keys(n.kwargs).length>0)for(let[l,s]of Object.entries(n.kwargs))l!=="uid"&&(l==="statement"&&(t==="ai_action"||t==="ai_step")||(a[l]=s));return n.args&&n.args.length>0&&(a.args=n.args),a}function wu(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(ce)};return e.reference_id!==void 0&&(t.reference_id=e.reference_id),t}function yu(e){let t={IF:Os(e.condition),THEN:e.then.map(ce)};return e.else&&e.else.length>0&&(t.ELSE=e.else.map(ce)),t}function bu(e){let t={WHILE:Os(e.condition),DO:e.body.map(ce)};return e.timeout_ms!==void 0&&(t.timeout_ms=e.timeout_ms),t}function Os(e){return e.type==="JS_CODE"?`js:${e.expression}`:e.expression}function fa(e){try{let t=Is(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 pa(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(pa);let t=e,i=Object.keys(t);if(i.length===1){let a=i[0];if(a.startsWith("{ ")&&a.endsWith(" }")&&t[a]===null)return`{{${a.slice(2,-2)}}}`}let n={};for(let[a,o]of Object.entries(t))n[a]=pa(o);return n}function Te(e){if(e.length>$s)throw new Error(`YAML input too large (${e.length} bytes, max ${$s})`);let t=pa(Is(e));if(!t||typeof t!="object")throw new Error("Invalid YAML: expected an object at root level");if(t.suite)return xu(t);let i={version:"1.3.0",goal:t.goal,url:t.url,baseURL:t.base_url,statements:de(t.statements??[])};t.final_feedback&&(i.final_feedback=t.final_feedback),t.teardown&&Array.isArray(t.teardown)&&(i.teardown=de(t.teardown));let n=ha.safeParse(i);if(!n.success)throw new Error(`Invalid TestFlow after YAML conversion: ${JSON.stringify(n.error.errors)}`);let a=n.data;return bn(e,a),a}function xu(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 a={tests:i.map(l=>{if(!l.name)throw new Error('Each test in a suite must have a "name" field');if(!Array.isArray(l.statements)||l.statements.length===0)throw new Error(`Suite test "${l.name}" must have a non-empty "statements" array`);let s={name:l.name,statements:de(l.statements)};return Array.isArray(l.teardown)&&l.teardown.length>0&&(s.teardown=de(l.teardown)),l.skip!==void 0&&(s.skip=l.skip),typeof l.timeout=="number"&&(s.timeout=l.timeout),l.fail!==void 0&&(s.fail=l.fail),l.only===!0&&(s.only=!0),l.slow===!0&&(s.slow=!0),s})};Array.isArray(t.beforeAll)&&t.beforeAll.length>0&&(a.beforeAll=de(t.beforeAll)),Array.isArray(t.afterAll)&&t.afterAll.length>0&&(a.afterAll=de(t.afterAll)),Array.isArray(t.beforeEach)&&t.beforeEach.length>0&&(a.beforeEach=de(t.beforeEach)),Array.isArray(t.afterEach)&&t.afterEach.length>0&&(a.afterEach=de(t.afterEach));let o=wn.safeParse(a);if(!o.success)throw new Error(`Invalid TestGroup: ${JSON.stringify(o.error.errors)}`);return{version:"1.3.0",baseURL:t.base_url||void 0,testGroup:o.data}}function de(e){if(!Array.isArray(e))throw new Error("Expected an array of statements");return e.map(vu)}function vu(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 _u(t);if("WHILE"in t)return ku(t);if("STEP"in t)return Su(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:me(),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,a=typeof t.timeout_seconds=="number"?t.timeout_seconds:void 0,o={url:typeof i=="string"?i:String(i)};return n&&(o.new_tab=!0),a!==void 0&&(o.timeout_seconds=a),{uid:me(),type:"ACTION",description:`Navigate to ${i}`,action_entity:{action_description:`Navigate to ${i}`,action_data:{action_name:"go_to_url",kwargs:o}}}}if("WAIT_UNTIL"in t){let i=t.WAIT_UNTIL,n=typeof t.timeout_seconds=="number"?t.timeout_seconds:60;return{uid:me(),type:"ACTION",description:`Wait until: ${i}`,action_entity:{action_description:`Wait until: ${i}`,action_data:{action_name:"ai_wait_until",kwargs:{condition:typeof i=="string"?i:String(i),timeout_seconds:n}}}}}if("WAIT"in t){let i=t.WAIT,n=typeof t.seconds=="number"?t.seconds:3;return{uid:me(),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:me(),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:me(),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 Ms({...n,action:"function",functionName:i})}if("action"in t)return Ms(t);if("intent"in t&&typeof t.intent=="string"||"desc"in t&&typeof t.desc=="string")return{uid:me(),type:"DRAFT",description:typeof t.intent=="string"?t.intent:t.desc};throw new Error(`Cannot infer statement type from object: ${JSON.stringify(t)}`)}function Ls(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 _u(e){let t=Ls(e.IF),i=e.THEN;if(!Array.isArray(i))throw new Error("IF_ELSE requires a THEN array");let n={uid:me(),type:"IF_ELSE",condition:t,then:de(i)};return"ELSE"in e&&Array.isArray(e.ELSE)&&(n.else=de(e.ELSE)),n}function ku(e){let t=Ls(e.WHILE),i=e.DO;if(!Array.isArray(i))throw new Error("WHILE_LOOP requires a DO array");let n={uid:me(),type:"WHILE_LOOP",condition:t,body:de(i)};return typeof e.timeout_ms=="number"&&(n.timeout_ms=e.timeout_ms),n}function Su(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:me(),type:"STEP",description:t,statements:de(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,a={};for(let[o,r]of Object.entries(n))a[o]=String(r);i.template_params=a}return i}function Ms(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,a=typeof e.xpath=="string"?e.xpath:void 0,o=typeof e.use_pure_vision=="boolean"?e.use_pure_vision:void 0,r={};for(let[c,d]of Object.entries(e))Eu.has(c)||(r[c]=d);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);let l={action_description:i,action_data:{action_name:t,kwargs:Object.keys(r).length>0?r:{}}};n&&(l.locator=n),a&&(l.xpath=a);let s={uid:me(),type:"ACTION",description:i,action_entity:l};return o&&(s.use_pure_vision=!0),s}function bn(e,t){let i;try{i=pu(e)}catch{return}let n=i.contents;if(!n||!rt(n))return;if(i.commentBefore)t.comment=i.commentBefore;else{let s=n.items?.[0];s?.key&&s.key.commentBefore&&(t.comment=s.key.commentBefore)}let a=n,o=a.get("statements",!0);se(o)&&t.statements&&ot(o,t.statements);let r=a.get("teardown",!0);se(r)&&t.teardown&&ot(r,t.teardown)}function ot(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 a=t[i];if(a.type==="STEP"&&rt(n)){let o=n.get("statements",!0);se(o)&&ot(o,a.statements)}else if(a.type==="IF_ELSE"&&rt(n)){let o=n.get("THEN",!0);se(o)&&ot(o,a.then);let r=n.get("ELSE",!0);se(r)&&a.else&&ot(r,a.else)}else if(a.type==="WHILE_LOOP"&&rt(n)){let o=n.get("DO",!0);se(o)&&ot(o,a.body)}}}var Cs,$s,Eu,xn=x(()=>{"use strict";ma();Cs={lineWidth:120,defaultKeyType:"PLAIN",defaultStringType:"PLAIN"};$s=1024*1024;Eu=new Set(["action","intent","desc","locator","xpath","use_pure_vision"])});import{parse as VS,stringify as XS}from"yaml";var Ds=x(()=>{"use strict";xn()});var vn=x(()=>{"use strict"});var Rs=x(()=>{"use strict";xn();vn()});var Fs=x(()=>{"use strict";vn()});import{v4 as nE}from"uuid";var Hs=x(()=>{"use strict"});var Ue,Ws=x(()=>{"use strict";Ue=(e=>(e.DRAFT="DRAFT",e.STEP="STEP",e.ACTION="ACTION",e.IF_ELSE="IF_ELSE",e.WHILE_LOOP="WHILE_LOOP",e))(Ue||{})});var _n=x(()=>{"use strict"});var Us=x(()=>{"use strict";_n()});var js,Mu,Bs,Gs,mi,Iu,Pu,Ks=x(()=>{"use strict";js=112,Mu=1080-js,Bs={"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"}},Gs={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"]},mi=(e,t=!1)=>{let i=["chromium"];return t&&i.push("webkit"),Gs[e].map(n=>Bs[n]).filter(n=>n.defaultBrowserType&&i.includes(n.defaultBrowserType))},Iu={desktop:{label:"Desktop",type:"desktop",devices:mi("desktop")},mobile:{label:"Mobile Web",type:"mobile",devices:mi("mobile")}},Pu={desktop:{label:"Desktop",type:"desktop",devices:mi("desktop",!0)},mobile:{label:"Mobile Web",type:"mobile",devices:mi("mobile",!0)}}});var zs=x(()=>{"use strict"});var Vs=x(()=>{"use strict"});var Xs=x(()=>{"use strict"});var Ys=x(()=>{"use strict"});var Js=x(()=>{"use strict"});var qs=x(()=>{"use strict"});var Zs=x(()=>{"use strict"});var Qs=x(()=>{"use strict";_n()});var st=x(()=>{"use strict";Ds();Rs();xn();ma();Fs();Hs();vn();Ws();Us();Ks();zs();Vs();Xs();Ys();Js();qs();Zs();Qs();_n()});import{stringify as _1}from"yaml";import{createHash as Ru}from"crypto";import{parse as Fu,stringify as ol}from"yaml";import{readFileSync as Hu,existsSync as Wu}from"fs";import{resolve as wa,dirname as Uu}from"path";import{parse as tl,stringify as ju}from"yaml";function Lu(e){let t=e.frame_path;return!t||t.length===0?"page":`page.frameLocator('${t[0]}')`}function Du(e){let t=e.xpath;return typeof t=="string"&&t.trim()?!t.startsWith("xpath=")&&!t.startsWith("/")&&!t.startsWith("//")?`xpath=//${t}`:t.startsWith("xpath=")?t:`xpath=${t}`:null}function al(e){let t=Lu(e),i=e.locator;if(typeof i=="string"&&i.trim())return i=i.trim(),i.endsWith("first()")?`${t}.${i}`:`${t}.${i}.first()`;let n=Du(e);if(n){let a=JSON.stringify(n);return`${t}.locator(${a}).first()`}return null}function $(e,t){te.set(e,t)}function je(e,t,i=[]){let n=[...i];return t.locator?n.push(`locator: ${JSON.stringify(t.locator)}`):t.xpath&&n.push(`xpath: ${JSON.stringify(t.xpath)}`),t.frame_path&&t.frame_path.length>0&&n.push(`frame_path: ${JSON.stringify(t.frame_path)}`),n.length===0?[`await agent.execAction("${e}", page, {});`]:[`await agent.execAction("${e}", page, {`,...n.map(a=>` ${a},`),"});"]}function ya(e,t){let i=t.action_data?.kwargs||{},n=[];return typeof i.relative_x=="number"&&typeof i.relative_y=="number"?(n.push(`action_data: { kwargs: { relative_x: ${i.relative_x}, relative_y: ${i.relative_y} } }`),t.locator?n.push(`locator: ${JSON.stringify(t.locator)}`):t.xpath&&n.push(`xpath: ${JSON.stringify(t.xpath)}`),t.frame_path&&t.frame_path.length>0&&n.push(`frame_path: ${JSON.stringify(t.frame_path)}`)):typeof i.x=="number"&&typeof i.y=="number"&&n.push(`action_data: { kwargs: { x: ${i.x}, y: ${i.y} } }`),[`await agent.execAction("${e}", page, {`,...n.map(a=>` ${a},`),"});"]}function el(e){let t=e.functionName;if(!t)return null;let i=Array.isArray(e.args)?e.args.map(String):[];if(i.length===0)return`await ${t}()`;let n=["page","testContext","request","agent"],a=["undefined","null","true","false"],o=i.map(r=>n.includes(r)||a.includes(r)||/^-?\d+(\.\d+)?$/.test(r)?r:r.startsWith("$")?`agent.agentServices.readVariable('${r.substring(1)}')`:`"${r}"`);return`await ${t}(${o.join(", ")})`}function rl(e,t,i){let n={expandingPaths:new Set([wa(t)]),depth:0,referencedPaths:new Set,basePath:i},a={...e};Array.isArray(a.statements)&&(a.statements=Le(a.statements,t,n)),Array.isArray(a.teardown)&&(a.teardown=Le(a.teardown,t,n));for(let o of["beforeAll","afterAll","beforeEach","afterEach"])Array.isArray(a[o])&&(a[o]=Le(a[o],t,n));return{doc:a,referencedTemplatePaths:Array.from(n.referencedPaths)}}function Le(e,t,i){let n=[];for(let a of e)if(Bu(a)){let o=Gu(a,t,i);n.push(o)}else n.push(Ku(a,t,i));return n}function Bu(e){return typeof e=="object"&&e!==null&&typeof e.template=="string"}function Gu(e,t,i){if(i.depth>=il)throw new Error(`Template expansion exceeded maximum depth of ${il}. Check for deeply nested or circular template references.`);let n=wa(Uu(t),e.template),a=!Wu(n)&&i.basePath?wa(i.basePath,e.template):n;if(i.expandingPaths.has(a))throw new Error(`Circular template reference detected: ${a} is already being expanded. Stack: ${Array.from(i.expandingPaths).join(" \u2192 ")} \u2192 ${a}`);i.referencedPaths.add(a);let o;try{o=Hu(a,"utf-8")}catch(f){throw new Error(`Failed to read template file: ${a} (referenced from ${t}): ${f.message}`)}let r=tl(o);if(!r||typeof r!="object")throw new Error(`Invalid template file: ${a} \u2014 expected a YAML object`);let l=r.params||[],s=e.params||{};for(let f of l)if(!(f in s))throw new Error(`Template ${e.template} requires param "${f}" but it was not provided. Required params: [${l.join(", ")}]`);let c=r.statements;if(!Array.isArray(c))throw new Error(`Template ${e.template} must have a "statements" array`);if(Object.keys(s).length>0){let g=ju(c);for(let[y,m]of Object.entries(s))g=g.split(`<<${y}>>`).join(String(m));c=tl(g)}let d={expandingPaths:new Set([...i.expandingPaths,a]),depth:i.depth+1,referencedPaths:i.referencedPaths},u=Le(c,a,d),h={STEP:r.name||e.template.replace(/\.yaml$/,"").split("/").pop()||e.template,template_path:e.template,statements:u};return Object.keys(s).length>0&&(h.template_params=s),h}function Ku(e,t,i){if(typeof e!="object"||e===null)return e;let n={...e};return Array.isArray(n.statements)&&(n.statements=Le(n.statements,t,i)),Array.isArray(n.THEN)&&(n.THEN=Le(n.THEN,t,i)),Array.isArray(n.ELSE)&&(n.ELSE=Le(n.ELSE,t,i)),Array.isArray(n.DO)&&(n.DO=Le(n.DO,t,i)),n}function ll(e,t,i){let n=Fu(e),a=n?.name,o=n?.tags,r=n?.use;if(n&&(n.name!==void 0||n.tags!==void 0||n.use!==void 0)&&(delete n.name,delete n.tags,delete n.use),n?.suite){if(n.goal||n.statements)throw new sl('YAML file cannot have both "suite" and top-level "goal"/"statements". Use either suite format or single-test format.');return Vu(n,a,o,r,t,i)}return zu(n,a,o,r,t,i)}function zu(e,t,i,n,a,o){let r=e?.beforeEach,l=e?.afterEach,s=cl(e?.parameters),c=e?.timeout,d=e?.skip,u=e?.fail,p=e?.only,h=e?.slow;if(e&&(delete e.beforeEach,delete e.afterEach,delete e.parameters,delete e.timeout,delete e.skip,delete e.fail,delete e.only,delete e.slow),e?.url)throw new sl(`The "url" field is not supported in local YAML tests. Use "base_url: ${e.url}" and add "- URL: /" as the first statement instead.`);e&&!e.goal&&t&&(e.goal=t);let f=[];if(a&&e&&typeof e=="object"){let m=rl(e,a,o);e=m.doc,f=m.referencedTemplatePaths}let g=ol(e),y=Te(g);return a&&(lt(y.statements??[],a,"main"),y.teardown&&lt(y.teardown,a,"teardown")),{testFlow:y,name:t,tags:i,use:n,beforeEach:r,afterEach:l,parameters:s,timeout:c,skip:d,fail:u,only:p,slow:h,referencedTemplatePaths:f}}function Vu(e,t,i,n,a,o){let r=e.suite;if(!Array.isArray(r.tests)||r.tests.length===0)throw new Error('Suite must have a non-empty "tests" array.');let l=r.beforeAll,s=r.afterAll,c=r.beforeEach,d=r.afterEach,u=[],p=r.tests.map(g=>{if(!g.name)throw new Error('Each test in a suite must have a "name" field.');if(!Array.isArray(g.statements)||g.statements.length===0)throw new Error(`Suite test "${g.name}" must have a non-empty "statements" array.`);let y={goal:g.name,statements:g.statements};g.teardown&&(y.teardown=g.teardown);let m=[],b=y;if(a&&typeof y=="object"){let M=rl(y,a,o);b=M.doc,m=M.referencedTemplatePaths,u.push(...m)}let v=ol(b),S=Te(v),T=cl(g.parameters);return{testFlow:S,name:g.name,tags:Array.isArray(g.tags)?g.tags:void 0,parameters:T,timeout:g.timeout,skip:g.skip,fail:g.fail,only:g.only,slow:g.slow}}),h=r.base_url,f=h?{...n,baseURL:h}:n;return{suite:{beforeAll:l,afterAll:s,beforeEach:c,afterEach:d,tests:p},name:t,tags:i,use:f,referencedTemplatePaths:u}}function cl(e){if(!(!Array.isArray(e)||e.length===0))return e.map((t,i)=>{if(!t.name)throw new Error(`Parameter set at index ${i} must have a "name" field.`);if(!t.values||typeof t.values!="object")throw new Error(`Parameter set "${t.name}" must have a "values" object.`);return{name:t.name,values:t.values}})}function lt(e,t,i){for(let n=0;n<e.length;n++){let a=e[n],o=`${i}.${n}`,r=a.description||"";if(a.uid=Xu(t,o,r),a.type===Ue.STEP)lt(a.statements,t,o);else if(a.type===Ue.IF_ELSE){let l=a;lt(l.then,t,`${o}.then`),l.else&&lt(l.else,t,`${o}.else`)}else a.type===Ue.WHILE_LOOP&&lt(a.body,t,`${o}.body`)}}function Xu(e,t,i){let n=Ru("sha256").update(`${e}:${t}:${i}`).digest("hex");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20,32)}`}var nl,te,il,sl,dl=x(()=>{"use strict";st();st();st();st();nl=5e3;te=new Map;$("click",e=>{let t=al(e);if(!t)return['await agent.execAction("click", page, {});'];let i=e.action_data?.kwargs?.timeout_ms??nl;return[`await ${t}.click({ timeout: ${i} });`]});$("click_element",te.get("click"));$("click_element_by_index",te.get("click"));$("double_click",e=>je("double_click",e));$("double_click_on_element",te.get("double_click"));$("right_click",e=>je("right_click",e));$("right_click_on_element",te.get("right_click"));$("hover",e=>je("hover",e));$("hover_element_by_index",te.get("hover"));$("input_text",e=>{let t=e.action_data?.kwargs?.text??e.action_data?.kwargs?.value??"";return je("input_text",e,[`action_data: { kwargs: { text: ${JSON.stringify(t)} } }`])});$("fill",te.get("input_text"));$("clear_input",e=>je("clear_input",e));$("press",e=>{let t=e.action_data?.kwargs?.keys;return[`await page.keyboard.press(${JSON.stringify(t)});`]});$("send_keys",te.get("press"));$("send_keys_on_element",e=>{let t=al(e),i=e.action_data?.kwargs?.keys||"";if(!t)return['await agent.execAction("send_keys_on_element", page, {',` action_data: { kwargs: { keys: ${JSON.stringify(i)} } },`,"});"];let n=e.action_data?.kwargs?.timeout_ms??nl;return[`await ${t}.press(${JSON.stringify(i)}, { timeout: ${n} });`]});$("select_dropdown_option",e=>{let t=e.action_data?.kwargs?.text||e.action_data?.kwargs?.option||"";return je("select_dropdown_option",e,[`action_data: { kwargs: { text: ${JSON.stringify(t)} } }`])});$("scroll",e=>{let t=e.action_data?.kwargs?.down??!0;return[`await page.evaluate('window.scrollBy(0, window.innerHeight * ${(e.action_data?.kwargs?.num_pages??1)*(t?1:-1)})');`]});$("scroll_down",te.get("scroll"));$("scroll_up",te.get("scroll"));$("scroll_element",te.get("scroll"));$("scroll_to_text",e=>{let t=e.action_data?.kwargs?.text||"";return[`await page.getByText(${JSON.stringify(t)}, { exact: false }).first().scrollIntoViewIfNeeded();`]});$("scroll_on_element",e=>je("scroll_on_element",e,[`action_data: { kwargs: ${JSON.stringify(e.action_data?.kwargs||{})} }`]));$("go_to_url",e=>{let t=e.action_data?.kwargs?.url||"";return e.action_data?.kwargs?.new_tab===!0?['await agent.execAction("go_to_url", page, {',` action_data: { kwargs: { url: ${JSON.stringify(t)}, new_tab: true } },`,"});"]:['await agent.execAction("go_to_url", page, {',` action_data: { kwargs: { url: ${JSON.stringify(t)} } },`,"});"]});$("open_tab",te.get("go_to_url"));$("go_back",()=>['await agent.execAction("go_back", page, {});']);$("reload_page",()=>['await agent.execAction("reload_page", page, {});']);$("wait",e=>[`await page.waitForTimeout(${(e.action_data?.kwargs?.seconds||1)*1e3});`]);$("wait_for_page_ready",()=>["await page.waitForLoadState('domcontentloaded');"]);$("verify",(e,t)=>{let i=e.action_data?.kwargs,n=typeof i?.code=="string",a=n?i?.statement||e.action_description:e.action_description||i?.statement;if(n&&a){let r=i.code.split(`
4301
+ `,n+='- In action descriptions, describe what the placeholder represents in natural language (e.g., "Type the first user name" instead of "Type {{ firstUserName }}")',n}}});var si=x(()=>{"use strict"});async function Sd(e,t){let i=new Set,n=Date.now(),a=new Set(["document","stylesheet","image","font","script","iframe"]),o=new Set(["text/html","text/css","application/javascript","image/","font/","application/json"]),r=["analytics","tracking","telemetry","beacon","metrics","doubleclick","adsystem","adserver","advertising","facebook.com/plugins","platform.twitter","linkedin.com/embed","livechat","zendesk","intercom","crisp.chat","hotjar","push-notifications","onesignal","pushwoosh","heartbeat","ping","alive","webrtc","rtmp://","wss://","cloudfront.net","fastly.net"],l=u=>{let p=u.toLowerCase();return p.startsWith("data:")||p.startsWith("blob:")?!0:r.some(h=>p.includes(h))},s=u=>{let p=u.resourceType(),h=u.url();if(!a.has(p)||l(h))return;let f=u.headers();f.purpose==="prefetch"||["video","audio"].includes(f["sec-fetch-dest"])||(i.add(u),n=Date.now())},c=async u=>{let p=u.request();if(!i.has(p))return;let h=(u.headers()["content-type"]||"").toLowerCase();if(["streaming","video","audio","webm","mp4","event-stream","websocket","protobuf"].some(g=>h.includes(g))){i.delete(p);return}if(![...o].some(g=>h.startsWith(g))){i.delete(p);return}let f=u.headers()["content-length"];if(f)try{if(parseInt(f,10)>5*1024*1024){i.delete(p);return}}catch{}i.delete(p),n=Date.now()},d=Date.now()-kd;for(let u of await e.requests()){let p=u.resourceType(),h=u.url(),f=u.timing();a.has(p)&&!l(h)&&f.responseEnd===-1&&f.startTime>=d&&(i.add(u),n=Date.now())}w.debug(`[waitForStableNetwork] Pre-populated ${i.size} in-flight requests`),e.on("request",s),e.on("response",c);try{let u=Date.now(),p=_d;for(;;){await new Promise(f=>setTimeout(f,100));let h=Date.now();if(i.size===0&&h-n>=p){w.debug(`[waitForStableNetwork] Network idle after ${h-u}ms`);break}if(h-u>t){w.debug(`[waitForStableNetwork] Max wait time exceeded (${t}ms), pending: ${i.size}`);break}}}finally{e.removeListener("request",s),e.removeListener("response",c)}}async function it(e,t=vd,i=xd){let n=Date.now();try{await Promise.all([e.waitForLoadState("load",{timeout:t}).catch(()=>{}),Sd(e,t)])}catch(r){throw r instanceof Error?new Error(`Failed during network stabilization: ${r.message}`):new Error("An unknown error occurred during network stabilization.")}let a=Date.now()-n,o=Math.max(i-a,0);o>0&&await new Promise(r=>setTimeout(r,o))}var xd,vd,_d,kd,Oe=x(()=>{"use strict";si();U();xd=.5*1e3,vd=30*1e3,_d=1*1e3,kd=3*1e3});import{generateText as Ed}from"ai";function Td(e,t){return e?{prompt_tokens:e.promptTokens||e.inputTokens||0,completion_tokens:e.completionTokens||e.outputTokens||0,total_tokens:e.totalTokens||0,model:t}:null}async function zr(e,t,i={}){let n=Date.now();if(i.maxSteps!==void 0&&i.maxSteps<=0)throw new Error(`maxSteps must be >= 1, got ${i.maxSteps}`);let a=i.maxSteps??15,o=3,r=t.agentServices.getModel(),l=t.domService||new Ne(t.agentServices.getDomServiceOptions()),s={...t,domService:l};E.init(),E.section("Task Execution Started"),E.log(`Task: ${e}`),E.log(`Max steps: ${a}`),E.log(`Model: ${r}`);let c={currentStep:0,maxSteps:a,consecutiveFailures:0,maxFailures:o,lastFailReason:null,stepHistory:[],memory:[],lastGoal:null,lastEvaluation:null},d=[],u=un(i.customPrompt),p=new mn(u);E.log(`System prompt length: ${u.length} chars`);let h=!1,f="",g=[];try{for(i.onEvent?.({type:"start",task:e,maxSteps:a});c.currentStep<a;){if(i.abortSignal?.aborted)throw new Error("Task aborted by user");c.currentStep++;let y=Date.now();E.section(`Step ${c.currentStep}/${a}`),E.log(`URL: ${s.page.url()}`),i.onEvent?.({type:"step_start",step:c.currentStep});try{E.log("Waiting for page to stabilize..."),await it(s.page),E.log("Page stabilized")}catch{E.log("Page stabilization timed out, continuing anyway")}let m;try{E.log("Preparing context (DOM + screenshot)...");let N=s.agentServices.getInteractiveClassNames(),O=s.agentServices.getIframeFallbackDomains();m=await Kr(s.page,s.domService,N,O),E.log("Context prepared")}catch(N){if(N.message.includes("Execution context was destroyed")){E.log("Page navigating, waiting for load..."),await it(s.page);let O=s.agentServices.getInteractiveClassNames(),L=s.agentServices.getIframeFallbackDomains();m=await Kr(s.page,s.domService,O,L)}else throw E.error("Error preparing context",N),N}p.addStateMessage(e,m.currentUrl,m.domTree,m.screenshotBase64,c,{isFinalStep:c.currentStep===a-1,placeholderData:t.variables,sensitiveKeys:t.sensitiveKeys});let b=await $d(p,r,i,m.screenshotBase64);if(b.tokenUsages&&b.tokenUsages.length>0&&d.push(...b.tokenUsages),!b.stepOutput){if(E.error("Failed to get valid LLM response"),c.consecutiveFailures++,c.consecutiveFailures>=o){f="Reached the maximum allowed consecutive failures. Most recent error: Unable to get a valid response from the language model.";break}continue}let v=b.stepOutput;Cd(c.currentStep,a,v);let S=await Id(v,s,m.domState,c.currentStep,i.onEvent,m.screenshotBase64,b.debugInfo);g.push(...S.actionEntities);let T=Pd(c.currentStep,v,S,c,y,b.debugInfo,b.tokenUsages),M=Date.now()-y;if(i.onEvent?.({type:"step_complete",step:c.currentStep,duration:M}),c.consecutiveFailures>=o){E.error(`Too many consecutive failures (${c.consecutiveFailures}), stopping`),f=`Reached the maximum allowed consecutive failures. Most recent error: ${c.lastFailReason}`;break}if(S.doneResult){h=S.doneResult.success,f=S.doneResult.summary;break}if(S.completesInstruction){h=!0,f="Instruction completed";break}}return c.currentStep>=a&&!h&&(f="Reached the maximum allowed steps."),i.onEvent?.({type:"complete",totalSteps:c.currentStep,duration:Date.now()-n}),E.log(`Build success result: summary=${f}, completed=${h}, actions=${g.length}, tokens=${d.length}`),Nd(c,g,h,f,n,d,r)}catch(y){let m=y.message;return E.error(`Task execution failed: ${m}`,y),i.onEvent?.({type:"error",error:m,recoverable:!1}),Od(c,m,n,d,r)}}async function Kr(e,t,i,n){let{domState:a,screenshotBase64:o}=await t.getClickableElementsWithScreenshot(e,{interactiveClassNames:i,playwrightFrameFallbackDomains:n}),r=a.elementTree.clickableElementsToString();return{currentUrl:e.url(),domTree:r,screenshotBase64:o,domState:a}}function Ad(e){return e.map(t=>({role:t.role,content:Array.isArray(t.content)?t.content.map(i=>{if(i.type==="image"){let n=i.image,a=typeof n=="string"?n:"";return{type:"image",file:a.startsWith("data:")?a:`data:image/png;base64,${a}`}}return{type:"text",text:i.text}}):t.content}))}async function $d(e,t,i,n){let a=i.temperature??0,{system:o,messages:r}=e.getMessages(),l=0;for(let u of r)Array.isArray(u.content)&&(l+=u.content.filter(p=>p.type==="image").length);let s=ve(t,l),c={model:xe(t),system:o,messages:r,temperature:a,providerOptions:s},d=3;for(let u=0;u<d;u++)try{let p=Date.now();E.log(`Calling LLM (${t})...`);let h=await Ed(c),f=Date.now()-p,g=h,y=g.usage;E.llmCall(t,f,y);let m=g.reasoningText;m&&(E.thinking(m),i.onEvent?.({type:"thinking",text:m})),e.addAssistantMessage(h.text);let b={systemPrompt:o,userPrompt:Ad(r),rawLlmResponse:h.text,reasoningContent:m,screenshotWithSom:n},v=[],S=Td(y,t);S&&v.push(S);let T=Md(h.text);if(!T)if(u<d-1){E.log(`Attempt ${u+1}/${d}: Failed to parse response, retrying...`),e.addTextMessage("user","Your response was not valid JSON. Please respond with a properly formatted JSON object according to the expected format."),await new Promise(M=>setTimeout(M,i.retryDelay||1e3));continue}else return E.error("All parsing attempts failed"),{stepOutput:null,debugInfo:b,tokenUsages:v};return{stepOutput:T,debugInfo:b,tokenUsages:v}}catch(p){if(u<d-1){E.log(`Attempt ${u+1}/${d}: LLM call failed (${p.message}), retrying...`),await new Promise(h=>setTimeout(h,i.retryDelay||1e3));continue}else throw E.error("All LLM call attempts failed",p),p}return{stepOutput:null}}function Md(e){let t=e.trim();t.startsWith("```json")?t=t.replace(/^```json\s*/,"").replace(/\s*```\s*$/,""):t.startsWith("```")&&(t=t.replace(/^```\s*/,"").replace(/\s*```\s*$/,""));try{let i=JSON.parse(t);if(!i.current_goal)return E.error("Missing required field: current_goal"),null;if(!i.actions||!Array.isArray(i.actions)||i.actions.length===0)return E.error("Missing required field: actions (must be non-empty array)"),null;for(let n of i.actions){if(!n.action_name)return E.error("Action missing required field: action_name"),null;if(!n.description)return E.error("Action missing required field: description"),null}return i}catch(i){return E.error(`Failed to parse LLM JSON response: ${t.substring(0,500)}`),E.error(`Parse error: ${i.message}`),null}}async function Id(e,t,i,n,a,o,r){let l=[],s=!0,c=null;E.log(`Using pre-captured DOM state with ${i.selectorMap.size} elements for ${e.actions.length} action(s)`);let d=null,u={...t,domState:i},p=o;for(let h of e.actions){if(h.action_name==="done"){d={success:h.kwargs.success??!0,summary:h.kwargs.summary||h.kwargs.text||"Task completed"};break}let f={},g=h.kwargs?.element_index??h.kwargs?.index;if(typeof g=="number"){let m=i.selectorMap.get(g);m&&(f=await H(t.page,m))}let y={...f,action_description:h.description,action_data:{action_name:h.action_name,kwargs:h.kwargs}};try{let m=await j.execute(h.action_name,h.kwargs,u);h.action_name==="perform_accurate_operation"&&(y=m.actionEntity);let b=await u.agentServices.getCurrentPage();if(b&&(u.page=b,t.page=u.page),m?.success===!1){s=!1,E.log("Action failed, stopping execution of remaining actions in this step"),c=m.error||"Action execution failed";break}l.push(y),a?.({type:"action",action_entity:y,step:n,debugInfo:r})}catch(m){s=!1,c=m.message,E.error(`Action execution failed: ${m.message}`);break}}return{allSuccess:s,failReason:c,actionEntities:l,doneResult:d,completesInstruction:e.completes_instruction??!1}}function Pd(e,t,i,n,a,o,r){let l={stepNumber:e,thinking:t.thinking,evaluation:t.evaluation_previous_goal,memory:t.memory,goal:t.current_goal,actions:i.actionEntities,timestamp:a,duration:Date.now()-a,outcome:{success:i.allSuccess},debugInfo:o,tokenUsages:r};if(n.lastGoal=t.current_goal,t.evaluation_previous_goal&&(n.lastEvaluation=t.evaluation_previous_goal),t.memory&&t.memory.trim()){let s=t.memory.trim();n.memory.includes(s)||(n.memory.push(s),n.memory.length>10&&(n.memory=n.memory.slice(-10)))}return i.allSuccess?(n.consecutiveFailures=0,n.lastFailReason=null):(n.consecutiveFailures++,n.lastFailReason=i.failReason),n.stepHistory.push(l),l}function Cd(e,t,i){if(E.log(`Step ${e}/${t}`),i.thinking&&E.log(`Thinking: ${i.thinking}`),i.evaluation_previous_goal&&E.log(`Evaluation: ${i.evaluation_previous_goal}`),i.memory&&E.log(`Memory: ${i.memory}`),E.log(`Goal: ${i.current_goal}`),i.actions.length===1){let n=i.actions[0];E.log(`Action: ${n.action_name}(${JSON.stringify(n.kwargs)}) - ${n.description}`)}else E.log(`Actions (${i.actions.length}):`),i.actions.forEach((n,a)=>{E.log(` ${a+1}. ${n.action_name}(${JSON.stringify(n.kwargs)}) - ${n.description}`)})}function Nd(e,t,i,n,a,o,r){let l=o.reduce((d,u)=>d+u.prompt_tokens,0),s=o.reduce((d,u)=>d+u.completion_tokens,0),c=o.reduce((d,u)=>d+u.total_tokens,0);return{success:!0,completed:i,summary:n,trajectory:{steps:e.currentStep,actions:t,stepRecords:e.stepHistory},metadata:{totalSteps:e.currentStep,totalDuration:Date.now()-a,model:r,successfulSteps:e.stepHistory.filter(d=>d.outcome.success).length,failedSteps:e.stepHistory.filter(d=>!d.outcome.success).length,promptTokens:l,completionTokens:s,totalTokens:c,tokenUsages:o}}}function Od(e,t,i,n,a){let o=n.reduce((s,c)=>s+c.prompt_tokens,0),r=n.reduce((s,c)=>s+c.completion_tokens,0),l=n.reduce((s,c)=>s+c.total_tokens,0);return{success:!1,completed:!1,error:t,trajectory:{steps:e.currentStep,actions:[],stepRecords:e.stepHistory},metadata:{totalSteps:e.currentStep,totalDuration:Date.now()-i,model:a,successfulSteps:e.stepHistory.filter(s=>s.outcome.success).length,failedSteps:e.stepHistory.filter(s=>!s.outcome.success).length,promptTokens:o,completionTokens:r,totalTokens:l,tokenUsages:n}}}var Vr=x(()=>{"use strict";la();hn();ke();He();ae();Oe();_e();X()});var Xr={};dt(Xr,{TaskMessageManager:()=>mn,formatFinalStepWarning:()=>Br,formatTaskContext:()=>dn,getBrowserTaskJSONPrompt:()=>un,runTaskLoop:()=>zr});var Yr=x(()=>{"use strict";Vr();la();hn();ke();Gi();He();xt();vt();Ze();_t();kt();ae();Oe();si();_e();gt();Ve();ft();Ce();ze();X();Re();U();ne();Tt();W();ye()});async function At(e,t){try{if(!e.action_data)return{success:!1,error:"Action entity missing action_data"};let{action_name:i,kwargs:n}=e.action_data;if(j.has(i)){let a=await j.execute(i,n,t),o=a?.success!==!1,r=a?.error||a?.message;return{success:o,error:o?void 0:r}}else{let{page:a,agentServices:o}=t;return await(await Ld()).execute(a,e,o),{success:!0,error:void 0}}}catch(i){return{success:!1,error:i.message}}}async function Ld(){if(pn)return pn;let e=await Promise.resolve().then(()=>(cn(),ln));return pn=new e.default,pn}async function Ki(e,t,i,n={},a){let o=a||{page:t,agentServices:i,domService:new Ne(i.getDomServiceOptions()),executionHistory:n.executionHistory,variables:n.variables,sensitiveKeys:n.sensitiveKeys},r=i.replaceVariables(e),l=await Dn(r,o,n);return l.status==="error"?{status:"error",completed:l.goalAccomplished||!1,actionEntities:[],explanation:l.reasoning,error:l.error,debugInfo:l.debugInfo}:{status:"success",completed:l.goalAccomplished||!1,actionEntities:l.actionEntity?[l.actionEntity]:[],explanation:l.reasoning,debugInfo:l.debugInfo}}async function zi(e,t,i,n={},a){let o=a||{page:t,agentServices:i,domService:new Ne(i.getDomServiceOptions()),executionHistory:n.executionHistory,variables:n.variables,sensitiveKeys:n.sensitiveKeys},r=i.replaceVariables(e),l=await Dn(r,o,n);if(l.status==="error"||!l.actionEntity)return{status:"error",completed:l.goalAccomplished||!1,actionEntities:[],explanation:l.reasoning,error:l.error||"No action generated",debugInfo:l.debugInfo};let{actionEntity:s,reasoning:c,goalAccomplished:d,debugInfo:u}=l,p=await At(s,o);return p.success?(c&&i.addNote(c),{status:"success",completed:d||!1,actionEntities:[s],explanation:c,debugInfo:u}):{status:"error",completed:!1,actionEntities:[s],error:p.error||"Action execution failed",debugInfo:u}}async function Vi(e,t,i,n={}){let a={page:t,agentServices:i,domService:new Ne(i.getDomServiceOptions()),executionHistory:n.executionHistory,variables:n.variables,sensitiveKeys:n.sensitiveKeys},o=i.replaceVariables(e);return n.useCleanScreenshotForAssertion??(n.useCleanScreenshotForAssertion=i.isUseCleanScreenshotForAssertion()),so(o,a,n)}async function Xi(e,t,i,n,a={}){let{runTaskLoop:o}=await Promise.resolve().then(()=>(Yr(),Xr)),r=n?s=>{n(s)}:void 0,l=await o(e,{page:t,agentServices:i,domService:void 0,executionHistory:a.executionHistory,variables:a.variables,sensitiveKeys:a.sensitiveKeys},{maxSteps:a.maxSteps,onEvent:r,abortSignal:a.abortSignal});return{status:l.success?"success":"error",completed:l.completed,actionEntities:l.trajectory.actions,explanation:l.summary,error:l.error,tokenUsages:l.metadata.tokenUsages}}var pn,$t=x(()=>{"use strict";Li();ke();He();pn=null});import"uuid";import{z as _}from"zod";import"yaml";import"uuid";import"yaml";var ms,Lv,ps,Gd,Kd,fn,Dv,Rv,gs,fs,zd,hs,Vd,li,Xd,Yd,Jd,le,qd,Zd,Uv,Zv,ci=x(()=>{"use strict";ye();ms=112,Lv=1080-ms,ps=(e=>(e.Chromium="chromium",e.Firefox="firefox",e.Webkit="webkit",e))(ps||{}),Gd={"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"}},Kd={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"]},fn=(e,t=!1)=>{let i=["chromium"];return t&&i.push("webkit"),Kd[e].map(n=>Gd[n]).filter(n=>n.defaultBrowserType&&i.includes(n.defaultBrowserType))},Dv={desktop:{label:"Desktop",type:"desktop",devices:fn("desktop")},mobile:{label:"Mobile Web",type:"mobile",devices:fn("mobile")}},Rv={desktop:{label:"Desktop",type:"desktop",devices:fn("desktop",!0)},mobile:{label:"Mobile Web",type:"mobile",devices:fn("mobile",!0)}},gs=(e=>(e.PASSWORD="password",e.OAUTH2="oauth2",e.SSO="sso",e.API="api",e))(gs||{}),fs=(e=>(e.SMS="sms",e.EMAIL="email",e.TOTP="totp",e))(fs||{}),zd=_.enum(["JS_CODE","AI_MODE"]),hs=_.object({type:zd,expression:_.string()}),Vd=_.enum(["DRAFT","STEP","ACTION","IF_ELSE","WHILE_LOOP"]),li=_.object({uid:_.string(),type:Vd,comment:_.string().optional()}),Xd=_.object({action_data:_.object({action_name:_.string(),kwargs:_.record(_.any()).optional(),args:_.array(_.any()).optional()}),action_description:_.string().optional(),url:_.string().optional(),xpath:_.string().nullable().optional(),locator:_.string().nullable().optional(),css_selector:_.string().nullable().optional(),unique_selector:_.string().nullable().optional(),element_index:_.number().nullable().optional(),frame_path:_.array(_.any()).optional(),artifacts:_.record(_.any()).optional(),feedback:_.string().optional(),original_browser_use_action:_.any().optional()}).passthrough(),Yd=li.extend({type:_.literal("DRAFT"),description:_.string()}),Jd=li.extend({type:_.literal("ACTION"),description:_.string(),action_entity:Xd.optional(),locator:_.string().optional(),use_pure_vision:_.boolean().optional()}),le=_.lazy(()=>_.union([Yd,Jd,li.extend({type:_.literal("STEP"),description:_.string().optional().default(""),statements:_.array(le),reference_id:_.number().optional(),template_path:_.string().optional(),template_params:_.record(_.string()).optional()}),li.extend({type:_.literal("IF_ELSE"),description:_.string().optional(),condition:hs,then:_.array(le),else:_.array(le).optional()}),li.extend({type:_.literal("WHILE_LOOP"),description:_.string().optional(),condition:hs,body:_.array(le),timeout_ms:_.number().optional()})])),qd=_.object({name:_.string(),statements:_.array(le),teardown:_.array(le).optional(),skip:_.union([_.boolean(),_.string()]).optional(),timeout:_.number().optional(),fail:_.union([_.boolean(),_.string()]).optional(),only:_.boolean().optional(),slow:_.boolean().optional()}),Zd=_.object({tests:_.array(qd).min(1),beforeAll:_.array(le).optional(),afterAll:_.array(le).optional(),beforeEach:_.array(le).optional(),afterEach:_.array(le).optional()}),Uv=_.object({comment:_.string().optional(),version:_.string().optional(),goal:_.string().optional(),url:_.string().optional(),baseURL:_.string().optional(),final_feedback:_.string().optional(),completed:_.boolean().optional(),success:_.boolean().optional(),statements:_.array(le).optional(),teardown:_.array(le).optional(),last_modified_at:_.string().optional(),testGroup:Zd.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"}),Zv=1024*1024});var da=x(()=>{"use strict";ae();Oe()});var vs=x(()=>{"use strict"});var _s=x(()=>{"use strict"});var ks=x(()=>{"use strict"});var wn=x(()=>{"use strict"});var Ss=x(()=>{"use strict";wn()});import{v4 as GS}from"uuid";var Es=x(()=>{"use strict"});import{z as k}from"zod";var Ts,ua,As,at,$s,Ms,Is,re,Ps,yn,ha,ma=x(()=>{"use strict";Ts=k.enum(["JS_CODE","AI_MODE"]),ua=k.object({type:Ts,expression:k.string()}),As=k.enum(["DRAFT","STEP","ACTION","IF_ELSE","WHILE_LOOP"]),at=k.object({uid:k.string(),type:As,comment:k.string().optional()}),$s=k.object({action_data:k.object({action_name:k.string(),kwargs:k.record(k.any()).optional(),args:k.array(k.any()).optional()}),action_description:k.string().optional(),url:k.string().optional(),xpath:k.string().nullable().optional(),locator:k.string().nullable().optional(),css_selector:k.string().nullable().optional(),unique_selector:k.string().nullable().optional(),element_index:k.number().nullable().optional(),frame_path:k.array(k.any()).optional(),artifacts:k.record(k.any()).optional(),feedback:k.string().optional(),original_browser_use_action:k.any().optional()}).passthrough(),Ms=at.extend({type:k.literal("DRAFT"),description:k.string()}),Is=at.extend({type:k.literal("ACTION"),description:k.string(),action_entity:$s.optional(),locator:k.string().optional(),use_pure_vision:k.boolean().optional()}),re=k.lazy(()=>k.union([Ms,Is,at.extend({type:k.literal("STEP"),description:k.string().optional().default(""),statements:k.array(re),reference_id:k.number().optional(),template_path:k.string().optional(),template_params:k.record(k.string()).optional()}),at.extend({type:k.literal("IF_ELSE"),description:k.string().optional(),condition:ua,then:k.array(re),else:k.array(re).optional()}),at.extend({type:k.literal("WHILE_LOOP"),description:k.string().optional(),condition:ua,body:k.array(re),timeout_ms:k.number().optional()})])),Ps=k.object({name:k.string(),statements:k.array(re),teardown:k.array(re).optional(),skip:k.union([k.boolean(),k.string()]).optional(),timeout:k.number().optional(),fail:k.union([k.boolean(),k.string()]).optional(),only:k.boolean().optional(),slow:k.boolean().optional()}),yn=k.object({tests:k.array(Ps).min(1),beforeAll:k.array(re).optional(),afterAll:k.array(re).optional(),beforeEach:k.array(re).optional(),afterEach:k.array(re).optional()}),ha=k.object({comment:k.string().optional(),version:k.string().optional(),goal:k.string().optional(),url:k.string().optional(),baseURL:k.string().optional(),final_feedback:k.string().optional(),completed:k.boolean().optional(),success:k.boolean().optional(),statements:k.array(re).optional(),teardown:k.array(re).optional(),last_modified_at:k.string().optional(),testGroup:yn.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 JS,parse as Ls,parseAllDocuments as qS,parseDocument as gu,Document as Ds,isMap as rt,isSeq as se}from"yaml";import{v4 as me}from"uuid";function bn(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(ce)};return e.final_feedback&&(i.final_feedback=e.final_feedback),e.teardown&&e.teardown.length>0&&(i.teardown=e.teardown.map(ce)),i}function ga(e,t){if(e.testGroup)return Fs(e,t);let i=bn(e,t),n=new Ds(i),a=n.contents?.get("tags",!0);return se(a)&&(a.flow=!0),e.comment&&(n.commentBefore=e.comment),Cs(n,e.statements??[]),e.teardown&&Cs(n,e.teardown,"teardown"),n.toString(Rs)}function Cs(e,t,i="statements"){let n=e.contents;if(!n||!rt(n))return;let a=n.get(i,!0);se(a)&&hi(a,t)}function hi(e,t){for(let i=0;i<Math.min(e.items.length,t.length);i++){let n=t[i],a=e.items[i];if(i>0&&(a.spaceBefore=!0),n.comment&&(i===0?e.commentBefore=n.comment:a.commentBefore=n.comment),rt(a)){let o=a;if(n.type==="STEP"){let r=o.get("statements",!0);se(r)&&hi(r,n.statements)}else if(n.type==="IF_ELSE"){let r=o.get("THEN",!0);se(r)&&hi(r,n.then);let l=o.get("ELSE",!0);se(l)&&n.else&&hi(l,n.else)}else if(n.type==="WHILE_LOOP"){let r=o.get("DO",!0);se(r)&&hi(r,n.body)}}}}function Fs(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 a={};e.baseURL&&(a.base_url=e.baseURL),i.beforeAll&&i.beforeAll.length>0&&(a.beforeAll=i.beforeAll.map(ce)),i.beforeEach&&i.beforeEach.length>0&&(a.beforeEach=i.beforeEach.map(ce)),i.afterEach&&i.afterEach.length>0&&(a.afterEach=i.afterEach.map(ce)),i.afterAll&&i.afterAll.length>0&&(a.afterAll=i.afterAll.map(ce)),a.tests=i.tests.map(l=>{let s={name:l.name};return l.skip!==void 0&&(s.skip=l.skip),l.timeout!==void 0&&(s.timeout=l.timeout),l.fail!==void 0&&(s.fail=l.fail),l.only!==void 0&&(s.only=l.only),l.slow!==void 0&&(s.slow=l.slow),s.statements=l.statements.map(ce),l.teardown&&l.teardown.length>0&&(s.teardown=l.teardown.map(ce)),s}),n.suite=a;let o=new Ds(n),r=o.contents?.get("tags",!0);return se(r)&&(r.flow=!0),o.toString(Rs)}function ce(e){switch(e.type){case"DRAFT":return fu(e);case"ACTION":return wu(e);case"STEP":return yu(e);case"IF_ELSE":return bu(e);case"WHILE_LOOP":return xu(e)}}function fu(e){return{intent:e.description}}function wu(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 l=i?.statement;if(typeof l=="string"&&!e.action_entity?.locator&&!e.action_entity?.xpath){let s=i?.code;return typeof s=="string"&&s.trim()?{VERIFY:l,js:s}:{VERIFY:l}}}if(t==="go_to_url"){let l=i?.url;if(typeof l=="string"&&!e.action_entity?.locator&&!e.action_entity?.xpath){let s={URL:l};return i?.new_tab===!0&&(s.new_tab=!0),typeof i?.timeout_seconds=="number"&&(s.timeout_seconds=i.timeout_seconds),s}}if(t==="js_action"){let l=i?.code;if(typeof l=="string"&&l.trim()&&e.description)return{description:e.description,js:l}}if(t==="ai_wait_until"){let l=i?.condition;if(typeof l=="string"){let s={WAIT_UNTIL:l};return typeof i?.timeout_seconds=="number"&&i.timeout_seconds!==60&&(s.timeout_seconds=i.timeout_seconds),s}}if(t==="wait"){let l=i?.seconds,c={WAIT:e.description||`Wait ${l}s`};return typeof l=="number"&&(c.seconds=l),c}if(t==="js_code"){let l=i?.code;if(typeof l=="string"&&!e.action_entity?.locator&&!e.action_entity?.xpath)return{description:e.description||"Code block",js:l}}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 a={intent:e.description,action:n.action_name},o=e.locator??e.action_entity.locator;o&&(a.locator=o);let r=e.action_entity.xpath;if(r&&(a.xpath=r),e.use_pure_vision&&(a.use_pure_vision=!0),n.kwargs&&Object.keys(n.kwargs).length>0)for(let[l,s]of Object.entries(n.kwargs))l!=="uid"&&(l==="statement"&&(t==="ai_action"||t==="ai_step")||(a[l]=s));return n.args&&n.args.length>0&&(a.args=n.args),a}function yu(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(ce)};return e.reference_id!==void 0&&(t.reference_id=e.reference_id),t}function bu(e){let t={IF:Hs(e.condition),THEN:e.then.map(ce)};return e.else&&e.else.length>0&&(t.ELSE=e.else.map(ce)),t}function xu(e){let t={WHILE:Hs(e.condition),DO:e.body.map(ce)};return e.timeout_ms!==void 0&&(t.timeout_ms=e.timeout_ms),t}function Hs(e){return e.type==="JS_CODE"?`js:${e.expression}`:e.expression}function fa(e){try{let t=Ls(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 pa(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(pa);let t=e,i=Object.keys(t);if(i.length===1){let a=i[0];if(a.startsWith("{ ")&&a.endsWith(" }")&&t[a]===null)return`{{${a.slice(2,-2)}}}`}let n={};for(let[a,o]of Object.entries(t))n[a]=pa(o);return n}function Te(e){if(e.length>Ns)throw new Error(`YAML input too large (${e.length} bytes, max ${Ns})`);let t=pa(Ls(e));if(!t||typeof t!="object")throw new Error("Invalid YAML: expected an object at root level");if(t.suite)return vu(t);let i={version:"1.3.0",goal:t.goal,url:t.url,baseURL:t.base_url,statements:de(t.statements??[])};t.final_feedback&&(i.final_feedback=t.final_feedback),t.teardown&&Array.isArray(t.teardown)&&(i.teardown=de(t.teardown));let n=ha.safeParse(i);if(!n.success)throw new Error(`Invalid TestFlow after YAML conversion: ${JSON.stringify(n.error.errors)}`);let a=n.data;return xn(e,a),a}function vu(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 a={tests:i.map(l=>{if(!l.name)throw new Error('Each test in a suite must have a "name" field');if(!Array.isArray(l.statements)||l.statements.length===0)throw new Error(`Suite test "${l.name}" must have a non-empty "statements" array`);let s={name:l.name,statements:de(l.statements)};return Array.isArray(l.teardown)&&l.teardown.length>0&&(s.teardown=de(l.teardown)),l.skip!==void 0&&(s.skip=l.skip),typeof l.timeout=="number"&&(s.timeout=l.timeout),l.fail!==void 0&&(s.fail=l.fail),l.only===!0&&(s.only=!0),l.slow===!0&&(s.slow=!0),s})};Array.isArray(t.beforeAll)&&t.beforeAll.length>0&&(a.beforeAll=de(t.beforeAll)),Array.isArray(t.afterAll)&&t.afterAll.length>0&&(a.afterAll=de(t.afterAll)),Array.isArray(t.beforeEach)&&t.beforeEach.length>0&&(a.beforeEach=de(t.beforeEach)),Array.isArray(t.afterEach)&&t.afterEach.length>0&&(a.afterEach=de(t.afterEach));let o=yn.safeParse(a);if(!o.success)throw new Error(`Invalid TestGroup: ${JSON.stringify(o.error.errors)}`);return{version:"1.3.0",baseURL:t.base_url||void 0,testGroup:o.data}}function de(e){if(!Array.isArray(e))throw new Error("Expected an array of statements");return e.map(_u)}function _u(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 ku(t);if("WHILE"in t)return Su(t);if("STEP"in t)return Eu(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:me(),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,a=typeof t.timeout_seconds=="number"?t.timeout_seconds:void 0,o={url:typeof i=="string"?i:String(i)};return n&&(o.new_tab=!0),a!==void 0&&(o.timeout_seconds=a),{uid:me(),type:"ACTION",description:`Navigate to ${i}`,action_entity:{action_description:`Navigate to ${i}`,action_data:{action_name:"go_to_url",kwargs:o}}}}if("WAIT_UNTIL"in t){let i=t.WAIT_UNTIL,n=typeof t.timeout_seconds=="number"?t.timeout_seconds:60;return{uid:me(),type:"ACTION",description:`Wait until: ${i}`,action_entity:{action_description:`Wait until: ${i}`,action_data:{action_name:"ai_wait_until",kwargs:{condition:typeof i=="string"?i:String(i),timeout_seconds:n}}}}}if("WAIT"in t){let i=t.WAIT,n=typeof t.seconds=="number"?t.seconds:3;return{uid:me(),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:me(),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:me(),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 Os({...n,action:"function",functionName:i})}if("action"in t)return Os(t);if("intent"in t&&typeof t.intent=="string"||"desc"in t&&typeof t.desc=="string")return{uid:me(),type:"DRAFT",description:typeof t.intent=="string"?t.intent:t.desc};throw new Error(`Cannot infer statement type from object: ${JSON.stringify(t)}`)}function Ws(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 ku(e){let t=Ws(e.IF),i=e.THEN;if(!Array.isArray(i))throw new Error("IF_ELSE requires a THEN array");let n={uid:me(),type:"IF_ELSE",condition:t,then:de(i)};return"ELSE"in e&&Array.isArray(e.ELSE)&&(n.else=de(e.ELSE)),n}function Su(e){let t=Ws(e.WHILE),i=e.DO;if(!Array.isArray(i))throw new Error("WHILE_LOOP requires a DO array");let n={uid:me(),type:"WHILE_LOOP",condition:t,body:de(i)};return typeof e.timeout_ms=="number"&&(n.timeout_ms=e.timeout_ms),n}function Eu(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:me(),type:"STEP",description:t,statements:de(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,a={};for(let[o,r]of Object.entries(n))a[o]=String(r);i.template_params=a}return i}function Os(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,a=typeof e.xpath=="string"?e.xpath:void 0,o=typeof e.use_pure_vision=="boolean"?e.use_pure_vision:void 0,r={};for(let[c,d]of Object.entries(e))Tu.has(c)||(r[c]=d);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);let l={action_description:i,action_data:{action_name:t,kwargs:Object.keys(r).length>0?r:{}}};n&&(l.locator=n),a&&(l.xpath=a);let s={uid:me(),type:"ACTION",description:i,action_entity:l};return o&&(s.use_pure_vision=!0),s}function xn(e,t){let i;try{i=gu(e)}catch{return}let n=i.contents;if(!n||!rt(n))return;if(i.commentBefore)t.comment=i.commentBefore;else{let s=n.items?.[0];s?.key&&s.key.commentBefore&&(t.comment=s.key.commentBefore)}let a=n,o=a.get("statements",!0);se(o)&&t.statements&&ot(o,t.statements);let r=a.get("teardown",!0);se(r)&&t.teardown&&ot(r,t.teardown)}function ot(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 a=t[i];if(a.type==="STEP"&&rt(n)){let o=n.get("statements",!0);se(o)&&ot(o,a.statements)}else if(a.type==="IF_ELSE"&&rt(n)){let o=n.get("THEN",!0);se(o)&&ot(o,a.then);let r=n.get("ELSE",!0);se(r)&&a.else&&ot(r,a.else)}else if(a.type==="WHILE_LOOP"&&rt(n)){let o=n.get("DO",!0);se(o)&&ot(o,a.body)}}}var Rs,Ns,Tu,vn=x(()=>{"use strict";ma();Rs={lineWidth:120,defaultKeyType:"PLAIN",defaultStringType:"PLAIN"};Ns=1024*1024;Tu=new Set(["action","intent","desc","locator","xpath","use_pure_vision"])});import{parse as iE,stringify as nE}from"yaml";var Us=x(()=>{"use strict";vn()});var js=x(()=>{"use strict";wn();vn()});var Ue,Bs=x(()=>{"use strict";Ue=(e=>(e.DRAFT="DRAFT",e.STEP="STEP",e.ACTION="ACTION",e.IF_ELSE="IF_ELSE",e.WHILE_LOOP="WHILE_LOOP",e))(Ue||{})});var _n=x(()=>{"use strict"});var Gs=x(()=>{"use strict";_n()});var Ks=x(()=>{"use strict";_n()});var zs,Iu,Vs,Xs,mi,Pu,Cu,Ys=x(()=>{"use strict";zs=112,Iu=1080-zs,Vs={"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"}},Xs={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"]},mi=(e,t=!1)=>{let i=["chromium"];return t&&i.push("webkit"),Xs[e].map(n=>Vs[n]).filter(n=>n.defaultBrowserType&&i.includes(n.defaultBrowserType))},Pu={desktop:{label:"Desktop",type:"desktop",devices:mi("desktop")},mobile:{label:"Mobile Web",type:"mobile",devices:mi("mobile")}},Cu={desktop:{label:"Desktop",type:"desktop",devices:mi("desktop",!0)},mobile:{label:"Mobile Web",type:"mobile",devices:mi("mobile",!0)}}});var Js=x(()=>{"use strict"});var qs=x(()=>{"use strict"});var Zs=x(()=>{"use strict"});var Qs=x(()=>{"use strict"});var st=x(()=>{"use strict";vs();_s();ks();Ss();Es();Us();js();wn();vn();Bs();ma();Gs();Ks();_n();Ys();Js();qs();Zs();Qs()});import{stringify as _1}from"yaml";import{createHash as Ru}from"crypto";import{parse as Fu,stringify as ol}from"yaml";import{readFileSync as Hu,existsSync as Wu}from"fs";import{resolve as wa,dirname as Uu}from"path";import{parse as tl,stringify as ju}from"yaml";function Lu(e){let t=e.frame_path;return!t||t.length===0?"page":`page.frameLocator('${t[0]}')`}function Du(e){let t=e.xpath;return typeof t=="string"&&t.trim()?!t.startsWith("xpath=")&&!t.startsWith("/")&&!t.startsWith("//")?`xpath=//${t}`:t.startsWith("xpath=")?t:`xpath=${t}`:null}function al(e){let t=Lu(e),i=e.locator;if(typeof i=="string"&&i.trim())return i=i.trim(),i.endsWith("first()")?`${t}.${i}`:`${t}.${i}.first()`;let n=Du(e);if(n){let a=JSON.stringify(n);return`${t}.locator(${a}).first()`}return null}function $(e,t){te.set(e,t)}function je(e,t,i=[]){let n=[...i];return t.locator?n.push(`locator: ${JSON.stringify(t.locator)}`):t.xpath&&n.push(`xpath: ${JSON.stringify(t.xpath)}`),t.frame_path&&t.frame_path.length>0&&n.push(`frame_path: ${JSON.stringify(t.frame_path)}`),n.length===0?[`await agent.execAction("${e}", page, {});`]:[`await agent.execAction("${e}", page, {`,...n.map(a=>` ${a},`),"});"]}function ya(e,t){let i=t.action_data?.kwargs||{},n=[];return typeof i.relative_x=="number"&&typeof i.relative_y=="number"?(n.push(`action_data: { kwargs: { relative_x: ${i.relative_x}, relative_y: ${i.relative_y} } }`),t.locator?n.push(`locator: ${JSON.stringify(t.locator)}`):t.xpath&&n.push(`xpath: ${JSON.stringify(t.xpath)}`),t.frame_path&&t.frame_path.length>0&&n.push(`frame_path: ${JSON.stringify(t.frame_path)}`)):typeof i.x=="number"&&typeof i.y=="number"&&n.push(`action_data: { kwargs: { x: ${i.x}, y: ${i.y} } }`),[`await agent.execAction("${e}", page, {`,...n.map(a=>` ${a},`),"});"]}function el(e){let t=e.functionName;if(!t)return null;let i=Array.isArray(e.args)?e.args.map(String):[];if(i.length===0)return`await ${t}()`;let n=["page","testContext","request","agent"],a=["undefined","null","true","false"],o=i.map(r=>n.includes(r)||a.includes(r)||/^-?\d+(\.\d+)?$/.test(r)?r:r.startsWith("$")?`agent.agentServices.readVariable('${r.substring(1)}')`:`"${r}"`);return`await ${t}(${o.join(", ")})`}function rl(e,t,i){let n={expandingPaths:new Set([wa(t)]),depth:0,referencedPaths:new Set,basePath:i},a={...e};Array.isArray(a.statements)&&(a.statements=Le(a.statements,t,n)),Array.isArray(a.teardown)&&(a.teardown=Le(a.teardown,t,n));for(let o of["beforeAll","afterAll","beforeEach","afterEach"])Array.isArray(a[o])&&(a[o]=Le(a[o],t,n));return{doc:a,referencedTemplatePaths:Array.from(n.referencedPaths)}}function Le(e,t,i){let n=[];for(let a of e)if(Bu(a)){let o=Gu(a,t,i);n.push(o)}else n.push(Ku(a,t,i));return n}function Bu(e){return typeof e=="object"&&e!==null&&typeof e.template=="string"}function Gu(e,t,i){if(i.depth>=il)throw new Error(`Template expansion exceeded maximum depth of ${il}. Check for deeply nested or circular template references.`);let n=wa(Uu(t),e.template),a=!Wu(n)&&i.basePath?wa(i.basePath,e.template):n;if(i.expandingPaths.has(a))throw new Error(`Circular template reference detected: ${a} is already being expanded. Stack: ${Array.from(i.expandingPaths).join(" \u2192 ")} \u2192 ${a}`);i.referencedPaths.add(a);let o;try{o=Hu(a,"utf-8")}catch(f){throw new Error(`Failed to read template file: ${a} (referenced from ${t}): ${f.message}`)}let r=tl(o);if(!r||typeof r!="object")throw new Error(`Invalid template file: ${a} \u2014 expected a YAML object`);let l=r.params||[],s=e.params||{};for(let f of l)if(!(f in s))throw new Error(`Template ${e.template} requires param "${f}" but it was not provided. Required params: [${l.join(", ")}]`);let c=r.statements;if(!Array.isArray(c))throw new Error(`Template ${e.template} must have a "statements" array`);if(Object.keys(s).length>0){let g=ju(c);for(let[y,m]of Object.entries(s))g=g.split(`<<${y}>>`).join(String(m));c=tl(g)}let d={expandingPaths:new Set([...i.expandingPaths,a]),depth:i.depth+1,referencedPaths:i.referencedPaths},u=Le(c,a,d),h={STEP:r.name||e.template.replace(/\.yaml$/,"").split("/").pop()||e.template,template_path:e.template,statements:u};return Object.keys(s).length>0&&(h.template_params=s),h}function Ku(e,t,i){if(typeof e!="object"||e===null)return e;let n={...e};return Array.isArray(n.statements)&&(n.statements=Le(n.statements,t,i)),Array.isArray(n.THEN)&&(n.THEN=Le(n.THEN,t,i)),Array.isArray(n.ELSE)&&(n.ELSE=Le(n.ELSE,t,i)),Array.isArray(n.DO)&&(n.DO=Le(n.DO,t,i)),n}function ll(e,t,i){let n=Fu(e),a=n?.name,o=n?.tags,r=n?.use;if(n&&(n.name!==void 0||n.tags!==void 0||n.use!==void 0)&&(delete n.name,delete n.tags,delete n.use),n?.suite){if(n.goal||n.statements)throw new sl('YAML file cannot have both "suite" and top-level "goal"/"statements". Use either suite format or single-test format.');return Vu(n,a,o,r,t,i)}return zu(n,a,o,r,t,i)}function zu(e,t,i,n,a,o){let r=e?.beforeEach,l=e?.afterEach,s=cl(e?.parameters),c=e?.timeout,d=e?.skip,u=e?.fail,p=e?.only,h=e?.slow;if(e&&(delete e.beforeEach,delete e.afterEach,delete e.parameters,delete e.timeout,delete e.skip,delete e.fail,delete e.only,delete e.slow),e?.url)throw new sl(`The "url" field is not supported in local YAML tests. Use "base_url: ${e.url}" and add "- URL: /" as the first statement instead.`);e&&!e.goal&&t&&(e.goal=t);let f=[];if(a&&e&&typeof e=="object"){let m=rl(e,a,o);e=m.doc,f=m.referencedTemplatePaths}let g=ol(e),y=Te(g);return a&&(lt(y.statements??[],a,"main"),y.teardown&&lt(y.teardown,a,"teardown")),{testFlow:y,name:t,tags:i,use:n,beforeEach:r,afterEach:l,parameters:s,timeout:c,skip:d,fail:u,only:p,slow:h,referencedTemplatePaths:f}}function Vu(e,t,i,n,a,o){let r=e.suite;if(!Array.isArray(r.tests)||r.tests.length===0)throw new Error('Suite must have a non-empty "tests" array.');let l=r.beforeAll,s=r.afterAll,c=r.beforeEach,d=r.afterEach,u=[],p=r.tests.map(g=>{if(!g.name)throw new Error('Each test in a suite must have a "name" field.');if(!Array.isArray(g.statements)||g.statements.length===0)throw new Error(`Suite test "${g.name}" must have a non-empty "statements" array.`);let y={goal:g.name,statements:g.statements};g.teardown&&(y.teardown=g.teardown);let m=[],b=y;if(a&&typeof y=="object"){let M=rl(y,a,o);b=M.doc,m=M.referencedTemplatePaths,u.push(...m)}let v=ol(b),S=Te(v),T=cl(g.parameters);return{testFlow:S,name:g.name,tags:Array.isArray(g.tags)?g.tags:void 0,parameters:T,timeout:g.timeout,skip:g.skip,fail:g.fail,only:g.only,slow:g.slow}}),h=r.base_url,f=h?{...n,baseURL:h}:n;return{suite:{beforeAll:l,afterAll:s,beforeEach:c,afterEach:d,tests:p},name:t,tags:i,use:f,referencedTemplatePaths:u}}function cl(e){if(!(!Array.isArray(e)||e.length===0))return e.map((t,i)=>{if(!t.name)throw new Error(`Parameter set at index ${i} must have a "name" field.`);if(!t.values||typeof t.values!="object")throw new Error(`Parameter set "${t.name}" must have a "values" object.`);return{name:t.name,values:t.values}})}function lt(e,t,i){for(let n=0;n<e.length;n++){let a=e[n],o=`${i}.${n}`,r=a.description||"";if(a.uid=Xu(t,o,r),a.type===Ue.STEP)lt(a.statements,t,o);else if(a.type===Ue.IF_ELSE){let l=a;lt(l.then,t,`${o}.then`),l.else&&lt(l.else,t,`${o}.else`)}else a.type===Ue.WHILE_LOOP&&lt(a.body,t,`${o}.body`)}}function Xu(e,t,i){let n=Ru("sha256").update(`${e}:${t}:${i}`).digest("hex");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20,32)}`}var nl,te,il,sl,dl=x(()=>{"use strict";st();st();st();st();nl=5e3;te=new Map;$("click",e=>{let t=al(e);if(!t)return['await agent.execAction("click", page, {});'];let i=e.action_data?.kwargs?.timeout_ms??nl;return[`await ${t}.click({ timeout: ${i} });`]});$("click_element",te.get("click"));$("click_element_by_index",te.get("click"));$("double_click",e=>je("double_click",e));$("double_click_on_element",te.get("double_click"));$("right_click",e=>je("right_click",e));$("right_click_on_element",te.get("right_click"));$("hover",e=>je("hover",e));$("hover_element_by_index",te.get("hover"));$("input_text",e=>{let t=e.action_data?.kwargs?.text??e.action_data?.kwargs?.value??"";return je("input_text",e,[`action_data: { kwargs: { text: ${JSON.stringify(t)} } }`])});$("fill",te.get("input_text"));$("clear_input",e=>je("clear_input",e));$("press",e=>{let t=e.action_data?.kwargs?.keys;return[`await page.keyboard.press(${JSON.stringify(t)});`]});$("send_keys",te.get("press"));$("send_keys_on_element",e=>{let t=al(e),i=e.action_data?.kwargs?.keys||"";if(!t)return['await agent.execAction("send_keys_on_element", page, {',` action_data: { kwargs: { keys: ${JSON.stringify(i)} } },`,"});"];let n=e.action_data?.kwargs?.timeout_ms??nl;return[`await ${t}.press(${JSON.stringify(i)}, { timeout: ${n} });`]});$("select_dropdown_option",e=>{let t=e.action_data?.kwargs?.text||e.action_data?.kwargs?.option||"";return je("select_dropdown_option",e,[`action_data: { kwargs: { text: ${JSON.stringify(t)} } }`])});$("scroll",e=>{let t=e.action_data?.kwargs?.down??!0;return[`await page.evaluate('window.scrollBy(0, window.innerHeight * ${(e.action_data?.kwargs?.num_pages??1)*(t?1:-1)})');`]});$("scroll_down",te.get("scroll"));$("scroll_up",te.get("scroll"));$("scroll_element",te.get("scroll"));$("scroll_to_text",e=>{let t=e.action_data?.kwargs?.text||"";return[`await page.getByText(${JSON.stringify(t)}, { exact: false }).first().scrollIntoViewIfNeeded();`]});$("scroll_on_element",e=>je("scroll_on_element",e,[`action_data: { kwargs: ${JSON.stringify(e.action_data?.kwargs||{})} }`]));$("go_to_url",e=>{let t=e.action_data?.kwargs?.url||"";return e.action_data?.kwargs?.new_tab===!0?['await agent.execAction("go_to_url", page, {',` action_data: { kwargs: { url: ${JSON.stringify(t)}, new_tab: true } },`,"});"]:['await agent.execAction("go_to_url", page, {',` action_data: { kwargs: { url: ${JSON.stringify(t)} } },`,"});"]});$("open_tab",te.get("go_to_url"));$("go_back",()=>['await agent.execAction("go_back", page, {});']);$("reload_page",()=>['await agent.execAction("reload_page", page, {});']);$("wait",e=>[`await page.waitForTimeout(${(e.action_data?.kwargs?.seconds||1)*1e3});`]);$("wait_for_page_ready",()=>["await page.waitForLoadState('domcontentloaded');"]);$("verify",(e,t)=>{let i=e.action_data?.kwargs,n=typeof i?.code=="string",a=n?i?.statement||e.action_description:e.action_description||i?.statement;if(n&&a){let r=i.code.split(`
4302
4302
  `),l=JSON.stringify(a);return["{ const _t = Date.now(); try {",...r.map(s=>` ${s}`),` console.log(\`[VERIFY:JS] \u2713 \${((Date.now()-_t)/1000).toFixed(1)}s: ${l}\`);`,"} catch (_e) {",` console.log(\`[VERIFY:JS\u2192AI] JS failed \${((Date.now()-_t)/1000).toFixed(1)}s: (\${_e instanceof Error ? _e.message : String(_e)}), falling back to AI: ${l}\`);`,` await agent.assert(page, ${l}, ${JSON.stringify(t||"")});`,"} }"]}return n?i.code.split(`
4303
4303
  `):a?[`await agent.assert(page, ${JSON.stringify(a)}, ${JSON.stringify(t||"")});`]:["// Skipping verify: missing statement or code"]});$("ai_assert",te.get("verify"));$("assert",te.get("verify"));$("ai_action",(e,t)=>{let i=e.action_data?.kwargs?.statement;if(!i)return["// Skipping ai_action: missing statement"];let n=JSON.stringify(i),a=e.action_data?.kwargs?.use_pure_vision;return[`await agent.execute(page, ${n}, '${t||""}', ${a});`]});$("ai_step",(e,t)=>{let i=e.action_data?.kwargs?.statement;return i?[`await agent.run(page, ${JSON.stringify(i)}, '${t||""}');`]:["// Skipping ai_step: missing statement"]});$("ai_extract",(e,t)=>{let i=e.action_data?.kwargs?.element_description,n=e.action_data?.kwargs?.variable_name;if(!i||!n)return["// Skipping ai_extract: missing element_description or variable_name"];let a=JSON.stringify(i),o=JSON.stringify(n);return[`await agent.extract(page, ${a}, ${o}, '${t||""}');`]});$("ai_wait_until",(e,t)=>{let i=e.action_data?.kwargs?.condition,n=e.action_data?.kwargs?.timeout_seconds||60;return i?[`await agent.waitUntilCondition(page, ${JSON.stringify(i)}, ${n}, '${t||""}');`]:["// Skipping ai_wait_until: missing condition"]});$("save_variable",e=>{let t=e.action_data?.kwargs?.name||"",i=e.action_data?.kwargs?.value;return['await agent.execAction("save_variable", page, {',` action_data: { kwargs: { name: ${JSON.stringify(t)}, value: ${JSON.stringify(i)} } },`,"});"]});$("js_code",e=>{let t=e.action_data?.kwargs?.code;if(!t)return["// Skipping js_code: missing code"];let i=["{"],n=t.split(`
4304
4304
  `);for(let a of n)i.push(` ${a}`);return i.push("}"),i});$("function",(e,t,i)=>{let n=e.action_data?.kwargs||{},a=n.functionName;if(a&&a.includes("#")){let[r,l]=a.split("#");if(r&&l){let s=r.replace(/\.(ts|js|mjs)$/,""),c=`import { ${l} } from '${s}';`;i?.imports?.add(c);let d={...n,functionName:l},u=el(d);return u?[u.endsWith(";")?u:`${u};`]:["// Skipping function: invalid export pattern"]}}let o=el(n);return o?[o.endsWith(";")?o:`${o};`]:["// Skipping function: missing functionName"]});$("generate_2fa_code",e=>{let t=e.action_data?.kwargs?.otp_secret_key||"";return['await agent.execAction("generate_2fa_code", page, {',` action_data: { kwargs: { otp_secret_key: ${JSON.stringify(t)} } },`,"});"]});$("upload_file",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(a=>` ${a},`),"});"]});$("wait_for_download_complete",e=>['await agent.execAction("wait_for_download_complete", page, {',` action_data: { kwargs: { timeout_seconds: ${e.action_data?.kwargs?.timeout_seconds||10} } },`,"});"]);$("switch_tab",e=>['await agent.execAction("switch_tab", page, {',` action_data: { kwargs: { page_id: ${e.action_data?.kwargs?.page_id??e.action_data?.kwargs?.tab_index??0} } },`,"});"]);$("close_tab",e=>{let t=e.action_data?.kwargs?.page_id;return t=t??e.action_data?.kwargs?.index,['await agent.execAction("close_tab", page, {',` action_data: { kwargs: { page_id: ${t} } },`,"});"]});$("set_date_for_native_date_picker",e=>{let t=e.action_data?.kwargs?.date??"",i=[];return i.push(`action_data: { kwargs: { date: ${JSON.stringify(t)} } }`),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("set_date_for_native_date_picker", page, {',...i.map(n=>` ${n},`),"});"]});$("done",()=>["// Done - no action needed"]);$("click_by_coordinates",e=>ya("click_by_coordinates",e));$("right_click_by_coordinates",e=>ya("right_click_by_coordinates",e));$("double_click_by_coordinates",e=>ya("double_click_by_coordinates",e));$("drag_drop",e=>{let t=e.action_data?.kwargs||{},i={};typeof t.relative_x=="number"&&(i.relative_x=t.relative_x),typeof t.relative_y=="number"&&(i.relative_y=t.relative_y),typeof t.delta_x=="number"&&(i.delta_x=t.delta_x),typeof t.delta_y=="number"&&(i.delta_y=t.delta_y),typeof t.coord_source_x=="number"&&(i.coord_source_x=t.coord_source_x),typeof t.coord_source_y=="number"&&(i.coord_source_y=t.coord_source_y),typeof t.coord_target_x=="number"&&(i.coord_target_x=t.coord_target_x),typeof t.coord_target_y=="number"&&(i.coord_target_y=t.coord_target_y);let n=[`action_data: { kwargs: ${JSON.stringify(i)} }`];return e.locator?n.push(`locator: ${JSON.stringify(e.locator)}`):e.xpath&&n.push(`xpath: ${JSON.stringify(e.xpath)}`),e.frame_path&&e.frame_path.length>0&&n.push(`frame_path: ${JSON.stringify(e.frame_path)}`),['await agent.execAction("drag_drop", page, {',...n.map(a=>` ${a},`),"});"]});$("get_dropdown_options",e=>{let t=[];return e.xpath&&t.push(`xpath: ${JSON.stringify(e.xpath)}`),e.frame_path&&e.frame_path.length>0&&t.push(`frame_path: ${JSON.stringify(e.frame_path)}`),t.length===0?['await agent.execAction("get_dropdown_options", page, {});']:['await agent.execAction("get_dropdown_options", page, {',...t.map(i=>` ${i},`),"});"]});$("extract_email_content",e=>{let t=e.action_data?.kwargs||{};return['await agent.execAction("extract_email_content", page, {',` action_data: { kwargs: ${JSON.stringify(t)} },`,"});"]});$("js_action",e=>{let t=e.action_data?.kwargs?.code;return t?t.split(`
4305
- `):["// Skipping js_action: missing code"]});il=5;sl=class extends Error{constructor(e){super(e),this.name="YamlValidationError"}}});var hl={};dt(hl,{createTestFlowRouter:()=>qu});import{Router as Yu}from"express";import*as C from"fs/promises";import*as P from"path";import{stringify as fi,parse as ct}from"yaml";function pi(e){return e.map(t=>{if(t.type==="ACTION"&&t.action_entity){let i=t.action_entity,n=i.action_data??i.action,a=n?.kwargs?Object.fromEntries(Object.entries(n.kwargs).filter(([r])=>r!=="element_index")):n?.kwargs,o={...i};if(delete o.xpath,n&&a!==void 0){let r={...n,kwargs:a};i.action_data?o.action_data=r:o.action=r}return{...t,action_entity:o}}return t.type==="STEP"?{...t,statements:pi(t.statements)}:t.type==="IF_ELSE"?{...t,then:pi(t.then),...t.else?{else:pi(t.else)}:{}}:t.type==="WHILE_LOOP"?{...t,body:pi(t.body)}:t})}function Be(e){if(!e||e.length===0)return[];let i=fi({goal:"_hook",statements:e});return Te(i).statements??[]}async function ul(e){try{let t=await C.readdir(e,{withFileTypes:!0});for(let i of t)if(!(i.name==="node_modules"||i.name.startsWith("."))&&(i.isFile()&&i.name.endsWith(".test.yaml")||i.isDirectory()&&await ul(P.join(e,i.name))))return!0}catch{}return!1}function kn(e){let t=2166136261;for(let i=0;i<e.length;i++)t^=e.charCodeAt(i),t=Math.imul(t,16777619)>>>0;return t%2147483647+1}async function Ju(e){let t=new Map,i;try{i=await C.readdir(e)}catch(n){if(n.code==="ENOENT")return t;throw n}for(let n of i.filter(a=>a.endsWith(".yaml")))try{let a=P.join(e,n),r=ct(await C.readFile(a,"utf-8"))?.name??P.basename(n,".yaml");t.set(kn(r),`templates/${n}`)}catch{}return t}function ba(e,t){if(Array.isArray(e))return e.map(o=>ba(o,t));if(!e||typeof e!="object")return e;let i=e,n={};for(let[o,r]of Object.entries(i))n[o]=ba(r,t);let a=typeof i.reference_id=="number"?i.reference_id:void 0;if(a!==void 0&&typeof n.template_path!="string"){let o=t.get(a);o&&(n.template_path=o,delete n.reference_id)}return n}function Sn(e){return yn({statements:e}).statements}async function gi(e,t){for(let i of e)if(i.type==="STEP"){if(i.template_path&&i.statements.length>0){let n=P.join(t,i.template_path);try{let a=ct(await C.readFile(n,"utf-8"))??{};a.statements=Sn(i.statements),await C.writeFile(n,fi(a),"utf-8")}catch{}}await gi(i.statements,t)}else i.type==="IF_ELSE"?(await gi(i.then,t),i.else&&await gi(i.else,t)):i.type==="WHILE_LOOP"&&await gi(i.body,t)}function qu(e){let{initialDir:t,initialFile:i,projectRoot:n,onFileSelected:a}=e,o=Yu();function r(){return P.join(n??t,"fixtures")}o.get("/api/files",async(s,c)=>{try{let d=typeof s.query.dir=="string"?s.query.dir:t,u=P.resolve(d),p=await C.readdir(u,{withFileTypes:!0}),h=[];for(let g of p)if(g.name!=="node_modules"&&!g.name.startsWith("."))if(g.isDirectory()){let y=P.join(u,g.name);await ul(y)&&h.push({name:g.name,type:"directory",path:y})}else g.isFile()&&g.name.endsWith(".test.yaml")&&h.push({name:g.name,type:"file",path:P.join(u,g.name)});h.sort((g,y)=>g.type!==y.type?g.type==="directory"?-1:1:g.name.localeCompare(y.name));let f=P.dirname(u);c.json({dir:u,parent:f!==u?f:null,entries:h,initialFile:i??null,projectRoot:n??t})}catch(d){console.error("[debugger] Error listing files:",d),c.status(500).json({error:d.message})}});function l(s){if(typeof s=="string"&&s){let c=P.resolve(s);return c.endsWith(".test.yaml")?{filePath:c}:{error:"File must be a .test.yaml file"}}return i?{filePath:i}:{error:"No file specified. Pass ?file= parameter."}}return o.get("/api/test-flow",async(s,c)=>{let d=l(s.query.file);if("error"in d)return c.status(400).json({error:d.error});let u=d.filePath;try{a?.(u);let p=await C.readFile(u,"utf-8"),h=await C.stat(u),f=fa(p),g=ll(p,u,n);if(g.suite){let y=g.suite,m={tests:y.tests.map(v=>({name:v.name,statements:v.testFlow.statements??[],teardown:v.testFlow.teardown,skip:v.skip,timeout:v.timeout,fail:v.fail,only:v.only,slow:v.slow})),beforeAll:Be(y.beforeAll),afterAll:Be(y.afterAll),beforeEach:Be(y.beforeEach),afterEach:Be(y.afterEach)},b={version:"1.3.0",baseURL:g.use?.baseURL,testGroup:m};c.json({isSuite:!0,testFlow:b,metadata:f,name:g.name,tags:g.tags,use:g.use,filePath:u,fileName:P.basename(u),lastModified:h.mtimeMs})}else{let y=g.testFlow;bn(p,y),c.json({isSuite:!1,testFlow:y,metadata:f,name:g.name,tags:g.tags,use:g.use,parameters:g.parameters,filePath:u,fileName:P.basename(u),lastModified:h.mtimeMs})}}catch(p){if(p.code==="ENOENT")return c.status(404).json({error:`File not found: ${u}`});console.error("[debugger] Error loading test flow:",p),c.status(500).json({error:p.message})}}),o.put("/api/test-flow",async(s,c)=>{try{let d=l(s.query.file);if("error"in d)return c.status(400).json({error:d.error});let u=d.filePath,{testFlow:p,metadata:h}=s.body;if(!p)return c.status(400).json({error:"testFlow is required"});let f=P.join(n??t,"templates"),g=await Ju(f),y=ba(p,g),m=pi(y.statements??[]),b={...y,statements:m},v=n??t,S=[b.statements??[],b.teardown??[],...b.testGroup?.tests?.flatMap(O=>[O.statements,...O.teardown?[O.teardown]:[]])??[],...b.testGroup?.beforeEach?[b.testGroup.beforeEach]:[],...b.testGroup?.afterEach?[b.testGroup.afterEach]:[]];for(let O of S)await gi(O,v);let T=ga(b,h),M=u+".tmp";await C.writeFile(M,T,"utf-8"),await C.rename(M,u);let N=await C.stat(u);c.json({success:!0,lastModified:N.mtimeMs})}catch(d){console.error("[debugger] Error saving test flow:",d),c.status(500).json({error:d.message})}}),o.get("/api/fixtures",async(s,c)=>{try{let d=r();try{let p=(await C.readdir(d,{withFileTypes:!0})).filter(h=>h.isFile()).map(h=>h.name).sort();c.json({files:p,dir:d})}catch(u){if(u.code==="ENOENT")c.json({files:[],dir:d});else throw u}}catch(d){console.error("[debugger] Error listing fixtures:",d),c.status(500).json({error:d.message})}}),o.post("/api/fixtures",async(s,c)=>{try{let d=r();await C.mkdir(d,{recursive:!0});let{name:u,content:p}=s.body;if(!u||!p)return c.status(400).json({error:"name and content are required"});let h=P.basename(u);if(!h)return c.status(400).json({error:"Invalid file name"});let f=P.join(d,h);await C.writeFile(f,Buffer.from(p,"base64")),c.json({fileName:h})}catch(d){console.error("[debugger] Error saving fixture:",d),c.status(500).json({error:d.message})}}),o.get("/api/functions",async(s,c)=>{let d=P.join(n??t,"helpers"),u;try{u=await C.readdir(d)}catch(g){return g.code==="ENOENT"?c.json([]):(console.error("[debugger] Error reading helpers dir:",g),c.status(500).json({error:g.message}))}let p=u.filter(g=>/\.(ts|js|mjs)$/.test(g)),h=[],f=1;for(let g of p){let y=await C.readFile(P.join(d,g),"utf-8"),m=/export\s+async\s+function\s+(\w+)\s*(\([^)]*\))/g,b;for(;(b=m.exec(y))!==null;){let[,v,S]=b,T=S.replace(/\s*:\s*[^,)]+/g,"");h.push({id:f++,name:`helpers/${g}#${v}`,description:"",status:"Active",code:`async function ${v}${T} {}`})}}c.json(h)}),o.get("/api/reusable-steps",async(s,c)=>{let d=P.join(n??t,"templates"),u;try{u=await C.readdir(d)}catch(f){return f.code==="ENOENT"?c.json([]):(console.error("[debugger] Error reading templates dir:",f),c.status(500).json({error:f.message}))}let p=u.filter(f=>f.endsWith(".yaml")).sort(),h=[];for(let f of p)try{let g=await C.readFile(P.join(d,f),"utf-8"),y=ct(g);if(!y||typeof y!="object")continue;let m=y.name??P.basename(f,".yaml"),b=y.description??"",v=Be(y.statements);h.push({id:kn(m),organizationId:"local",name:m,description:b,statements:v})}catch(g){console.error(`[debugger] Error parsing template ${f}:`,g)}c.json(h)}),o.post("/api/reusable-steps/exists/:name",async(s,c)=>{let d=P.join(n??t,"templates"),u=decodeURIComponent(s.params.name).toLowerCase(),p;try{p=await C.readdir(d)}catch(h){return h.code==="ENOENT"?c.json(!1):c.status(500).json({error:h.message})}for(let h of p.filter(f=>f.endsWith(".yaml")))try{let f=await C.readFile(P.join(d,h),"utf-8");if((ct(f)?.name??P.basename(h,".yaml")).toLowerCase()===u)return c.json(!0)}catch{}c.json(!1)}),o.post("/api/reusable-steps",async(s,c)=>{let d=P.join(n??t,"templates"),{reusableStep:u}=s.body??{};if(!u?.name||!Array.isArray(u.statements))return c.status(400).json({error:"reusableStep.name and reusableStep.statements are required"});await C.mkdir(d,{recursive:!0});let p=u.name.replace(/[/\\:*?"<>|]/g,"-").trim(),h=P.join(d,`${p}.yaml`),f={name:u.name,statements:Sn(u.statements)};u.description&&(f.description=u.description),await C.writeFile(h,fi(f),"utf-8"),c.json({id:kn(u.name),organizationId:"local",name:u.name,description:u.description??"",statements:u.statements})}),o.put("/api/reusable-steps/:id/update",async(s,c)=>{let d=parseInt(s.params.id,10),u=P.join(n??t,"templates"),p;try{p=await C.readdir(u)}catch(h){return h.code==="ENOENT"?c.status(404).json({error:"Templates directory not found"}):c.status(500).json({error:h.message})}for(let h of p.filter(f=>f.endsWith(".yaml")))try{let f=P.join(u,h),g=ct(await C.readFile(f,"utf-8"))??{},y=g.name??P.basename(h,".yaml");if(kn(y)!==d)continue;let m=s.body??{};return m.description!==void 0&&(g.description=m.description),m.statements!==void 0&&(g.statements=Sn(m.statements)),await C.writeFile(f,fi(g),"utf-8"),c.json({id:d,organizationId:"local",...g,statements:m.statements!==void 0?m.statements:Be(g.statements)})}catch{}c.status(404).json({error:`Template with id ${d} not found`})}),o.put("/api/templates/:name",async(s,c)=>{let d=P.join(n??t,"templates"),u=decodeURIComponent(s.params.name),p;try{p=await C.readdir(d)}catch(h){return h.code==="ENOENT"?c.status(404).json({error:"Templates directory not found"}):c.status(500).json({error:h.message})}for(let h of p.filter(f=>f.endsWith(".yaml")))try{let f=P.join(d,h),g=ct(await C.readFile(f,"utf-8"))??{};if((g.name??P.basename(h,".yaml"))!==u)continue;let m=s.body??{};return m.name!==void 0&&(g.name=m.name),m.description!==void 0&&(g.description=m.description),m.statements!==void 0&&(g.statements=Sn(m.statements)),await C.writeFile(f,fi(g),"utf-8"),c.json({organizationId:"local",...g,statements:m.statements!==void 0?m.statements:Be(g.statements)})}catch{}c.status(404).json({error:`Template "${u}" not found`})}),o.get("/api/test-results",async(s,c)=>{let d=l(s.query.file);if("error"in d)return c.status(400).json({error:d.error});let u=n??t,p=P.basename(d.filePath,".test.yaml"),h=P.join(u,".shiplight","artifacts",p),f=[],g=null;try{let y=await C.readdir(h,{withFileTypes:!0});for(let m of y)if(m.isDirectory()){let b=P.join(h,m.name),v=await C.readdir(b);for(let S of v.filter(T=>/\.(png|jpe?g|webp)$/i.test(T))){let T=P.relative(h,P.join(b,S)),M=m.name.match(/^(.+?)_(before|after)$/),N=M?M[1]:m.name,O=M?M[2]:"screenshot";f.push({url:`/api/report-assets/${p}/${T}`,label:O,stepId:N})}}else/\.(webm|mp4)$/i.test(m.name)&&(g||(g=`/api/report-assets/${p}/${m.name}`));f.sort((m,b)=>m.stepId!==b.stepId?(m.stepId??"").localeCompare(b.stepId??""):m.label.localeCompare(b.label))}catch{}if(f.length===0&&!g)return c.status(404).json({error:"No test results found"});c.json({videoPath:g,screenshots:f})}),o}var ml=x(()=>{"use strict";st();dl()});var pl={};dt(pl,{createIntRunnerRouter:()=>Qu});import{Router as Zu}from"express";function Qu(e){let t=Zu();return t.get("/api/browser-cdp",async(i,n)=>{let a=e.getCdpEndpoint();if(!a)return n.status(404).json({error:"No browser running. Start a debug session first."});n.json({cdpUrl:a})}),t.post("/api/int-runner/create-session",async(i,n)=>{try{let a=i.body.startingUrl||i.body.testFlow?.url||i.body.urlOverride,o=i.body.testFilePath,r=await e.createSession({startingUrl:a,testFilePath:o});n.json({status:"success",sessionId:r.sessionId,searchParams:""})}catch(a){console.error("[debugger] create-session error:",a),n.status(500).json({status:"error",message:a.message})}}),t.post("/api/int-runner/login",async(i,n)=>{try{let{session:a}=i.body;if(!a?.sessionId)return n.status(400).json({status:"error",message:"Missing session"});let o=await e.executeLogin(a.sessionId);n.json(o)}catch(a){console.error("[debugger] login error:",a),n.status(500).json({status:"error",details:a.message})}}),t.post("/api/int-runner/liveview-url",async(i,n)=>{let{session:a}=i.body;if(!a?.sessionId)return n.status(400).json({status:"error",message:"Missing session"});n.json({liveviewUrl:"",browserWsUrl:""})}),t.post("/api/int-runner/end-debug",async(i,n)=>{let{session:a}=i.body;if(!a?.sessionId)return n.status(400).json({status:"error",message:"Missing session"});n.json({status:"success"})}),t.post("/api/int-runner/start-debug",async(i,n)=>{try{let{session:a}=i.body;if(!a?.sessionId)return n.status(400).json({status:"error",message:"Missing session"});let o=await e.startDebug(a.sessionId);n.json({status:"success",...o})}catch(a){console.error("[debugger] start-debug error:",a),n.status(500).json({status:"error",message:a.message})}}),t.post("/api/int-runner/execute-action",async(i,n)=>{try{let{session:a,actionEntity:o,stepId:r,withSelfHealing:l,stmtUid:s,executionHistory:c}=i.body;if(!a?.sessionId||!o)return n.status(400).json({status:"error",message:"Missing session or actionEntity"});let d=await e.executeAction(a.sessionId,o,r,{withSelfHealing:l,stmtUid:s,executionHistory:c});n.json(d)}catch(a){console.error("[debugger] execute-action error:",a),n.status(500).json({status:"error",details:a.message})}}),t.post("/api/int-runner/run-step",async(i,n)=>{let{session:a,statement:o,stepId:r,executionHistory:l}=i.body;if(!a?.sessionId||!o)return n.status(400).json({success:!1,message:"Session and statement required"});n.setHeader("Content-Type","text/event-stream"),n.setHeader("Cache-Control","no-cache"),n.setHeader("Connection","keep-alive"),n.flushHeaders();let s=c=>{n.write(`data: ${JSON.stringify(c)}
4305
+ `):["// Skipping js_action: missing code"]});il=5;sl=class extends Error{constructor(e){super(e),this.name="YamlValidationError"}}});var hl={};dt(hl,{createTestFlowRouter:()=>qu});import{Router as Yu}from"express";import*as C from"fs/promises";import*as P from"path";import{stringify as fi,parse as ct}from"yaml";function pi(e){return e.map(t=>{if(t.type==="ACTION"&&t.action_entity){let i=t.action_entity,n=i.action_data??i.action,a=n?.kwargs?Object.fromEntries(Object.entries(n.kwargs).filter(([r])=>r!=="element_index")):n?.kwargs,o={...i};if(delete o.xpath,n&&a!==void 0){let r={...n,kwargs:a};i.action_data?o.action_data=r:o.action=r}return{...t,action_entity:o}}return t.type==="STEP"?{...t,statements:pi(t.statements)}:t.type==="IF_ELSE"?{...t,then:pi(t.then),...t.else?{else:pi(t.else)}:{}}:t.type==="WHILE_LOOP"?{...t,body:pi(t.body)}:t})}function Be(e){if(!e||e.length===0)return[];let i=fi({goal:"_hook",statements:e});return Te(i).statements??[]}async function ul(e){try{let t=await C.readdir(e,{withFileTypes:!0});for(let i of t)if(!(i.name==="node_modules"||i.name.startsWith("."))&&(i.isFile()&&i.name.endsWith(".test.yaml")||i.isDirectory()&&await ul(P.join(e,i.name))))return!0}catch{}return!1}function kn(e){let t=2166136261;for(let i=0;i<e.length;i++)t^=e.charCodeAt(i),t=Math.imul(t,16777619)>>>0;return t%2147483647+1}async function Ju(e){let t=new Map,i;try{i=await C.readdir(e)}catch(n){if(n.code==="ENOENT")return t;throw n}for(let n of i.filter(a=>a.endsWith(".yaml")))try{let a=P.join(e,n),r=ct(await C.readFile(a,"utf-8"))?.name??P.basename(n,".yaml");t.set(kn(r),`templates/${n}`)}catch{}return t}function ba(e,t){if(Array.isArray(e))return e.map(o=>ba(o,t));if(!e||typeof e!="object")return e;let i=e,n={};for(let[o,r]of Object.entries(i))n[o]=ba(r,t);let a=typeof i.reference_id=="number"?i.reference_id:void 0;if(a!==void 0&&typeof n.template_path!="string"){let o=t.get(a);o&&(n.template_path=o,delete n.reference_id)}return n}function Sn(e){return bn({statements:e}).statements}async function gi(e,t){for(let i of e)if(i.type==="STEP"){if(i.template_path&&i.statements.length>0){let n=P.join(t,i.template_path);try{let a=ct(await C.readFile(n,"utf-8"))??{};a.statements=Sn(i.statements),await C.writeFile(n,fi(a),"utf-8")}catch{}}await gi(i.statements,t)}else i.type==="IF_ELSE"?(await gi(i.then,t),i.else&&await gi(i.else,t)):i.type==="WHILE_LOOP"&&await gi(i.body,t)}function qu(e){let{initialDir:t,initialFile:i,projectRoot:n,onFileSelected:a}=e,o=Yu();function r(){return P.join(n??t,"fixtures")}o.get("/api/files",async(s,c)=>{try{let d=typeof s.query.dir=="string"?s.query.dir:t,u=P.resolve(d),p=await C.readdir(u,{withFileTypes:!0}),h=[];for(let g of p)if(g.name!=="node_modules"&&!g.name.startsWith("."))if(g.isDirectory()){let y=P.join(u,g.name);await ul(y)&&h.push({name:g.name,type:"directory",path:y})}else g.isFile()&&g.name.endsWith(".test.yaml")&&h.push({name:g.name,type:"file",path:P.join(u,g.name)});h.sort((g,y)=>g.type!==y.type?g.type==="directory"?-1:1:g.name.localeCompare(y.name));let f=P.dirname(u);c.json({dir:u,parent:f!==u?f:null,entries:h,initialFile:i??null,projectRoot:n??t})}catch(d){console.error("[debugger] Error listing files:",d),c.status(500).json({error:d.message})}});function l(s){if(typeof s=="string"&&s){let c=P.resolve(s);return c.endsWith(".test.yaml")?{filePath:c}:{error:"File must be a .test.yaml file"}}return i?{filePath:i}:{error:"No file specified. Pass ?file= parameter."}}return o.get("/api/test-flow",async(s,c)=>{let d=l(s.query.file);if("error"in d)return c.status(400).json({error:d.error});let u=d.filePath;try{a?.(u);let p=await C.readFile(u,"utf-8"),h=await C.stat(u),f=fa(p),g=ll(p,u,n);if(g.suite){let y=g.suite,m={tests:y.tests.map(v=>({name:v.name,statements:v.testFlow.statements??[],teardown:v.testFlow.teardown,skip:v.skip,timeout:v.timeout,fail:v.fail,only:v.only,slow:v.slow})),beforeAll:Be(y.beforeAll),afterAll:Be(y.afterAll),beforeEach:Be(y.beforeEach),afterEach:Be(y.afterEach)},b={version:"1.3.0",baseURL:g.use?.baseURL,testGroup:m};c.json({isSuite:!0,testFlow:b,metadata:f,name:g.name,tags:g.tags,use:g.use,filePath:u,fileName:P.basename(u),lastModified:h.mtimeMs})}else{let y=g.testFlow;xn(p,y),c.json({isSuite:!1,testFlow:y,metadata:f,name:g.name,tags:g.tags,use:g.use,parameters:g.parameters,filePath:u,fileName:P.basename(u),lastModified:h.mtimeMs})}}catch(p){if(p.code==="ENOENT")return c.status(404).json({error:`File not found: ${u}`});console.error("[debugger] Error loading test flow:",p),c.status(500).json({error:p.message})}}),o.put("/api/test-flow",async(s,c)=>{try{let d=l(s.query.file);if("error"in d)return c.status(400).json({error:d.error});let u=d.filePath,{testFlow:p,metadata:h}=s.body;if(!p)return c.status(400).json({error:"testFlow is required"});let f=P.join(n??t,"templates"),g=await Ju(f),y=ba(p,g),m=pi(y.statements??[]),b={...y,statements:m},v=n??t,S=[b.statements??[],b.teardown??[],...b.testGroup?.tests?.flatMap(O=>[O.statements,...O.teardown?[O.teardown]:[]])??[],...b.testGroup?.beforeEach?[b.testGroup.beforeEach]:[],...b.testGroup?.afterEach?[b.testGroup.afterEach]:[]];for(let O of S)await gi(O,v);let T=ga(b,h),M=u+".tmp";await C.writeFile(M,T,"utf-8"),await C.rename(M,u);let N=await C.stat(u);c.json({success:!0,lastModified:N.mtimeMs})}catch(d){console.error("[debugger] Error saving test flow:",d),c.status(500).json({error:d.message})}}),o.get("/api/fixtures",async(s,c)=>{try{let d=r();try{let p=(await C.readdir(d,{withFileTypes:!0})).filter(h=>h.isFile()).map(h=>h.name).sort();c.json({files:p,dir:d})}catch(u){if(u.code==="ENOENT")c.json({files:[],dir:d});else throw u}}catch(d){console.error("[debugger] Error listing fixtures:",d),c.status(500).json({error:d.message})}}),o.post("/api/fixtures",async(s,c)=>{try{let d=r();await C.mkdir(d,{recursive:!0});let{name:u,content:p}=s.body;if(!u||!p)return c.status(400).json({error:"name and content are required"});let h=P.basename(u);if(!h)return c.status(400).json({error:"Invalid file name"});let f=P.join(d,h);await C.writeFile(f,Buffer.from(p,"base64")),c.json({fileName:h})}catch(d){console.error("[debugger] Error saving fixture:",d),c.status(500).json({error:d.message})}}),o.get("/api/functions",async(s,c)=>{let d=P.join(n??t,"helpers"),u;try{u=await C.readdir(d)}catch(g){return g.code==="ENOENT"?c.json([]):(console.error("[debugger] Error reading helpers dir:",g),c.status(500).json({error:g.message}))}let p=u.filter(g=>/\.(ts|js|mjs)$/.test(g)),h=[],f=1;for(let g of p){let y=await C.readFile(P.join(d,g),"utf-8"),m=/export\s+async\s+function\s+(\w+)\s*(\([^)]*\))/g,b;for(;(b=m.exec(y))!==null;){let[,v,S]=b,T=S.replace(/\s*:\s*[^,)]+/g,"");h.push({id:f++,name:`helpers/${g}#${v}`,description:"",status:"Active",code:`async function ${v}${T} {}`})}}c.json(h)}),o.get("/api/reusable-steps",async(s,c)=>{let d=P.join(n??t,"templates"),u;try{u=await C.readdir(d)}catch(f){return f.code==="ENOENT"?c.json([]):(console.error("[debugger] Error reading templates dir:",f),c.status(500).json({error:f.message}))}let p=u.filter(f=>f.endsWith(".yaml")).sort(),h=[];for(let f of p)try{let g=await C.readFile(P.join(d,f),"utf-8"),y=ct(g);if(!y||typeof y!="object")continue;let m=y.name??P.basename(f,".yaml"),b=y.description??"",v=Be(y.statements);h.push({id:kn(m),organizationId:"local",name:m,description:b,statements:v})}catch(g){console.error(`[debugger] Error parsing template ${f}:`,g)}c.json(h)}),o.post("/api/reusable-steps/exists/:name",async(s,c)=>{let d=P.join(n??t,"templates"),u=decodeURIComponent(s.params.name).toLowerCase(),p;try{p=await C.readdir(d)}catch(h){return h.code==="ENOENT"?c.json(!1):c.status(500).json({error:h.message})}for(let h of p.filter(f=>f.endsWith(".yaml")))try{let f=await C.readFile(P.join(d,h),"utf-8");if((ct(f)?.name??P.basename(h,".yaml")).toLowerCase()===u)return c.json(!0)}catch{}c.json(!1)}),o.post("/api/reusable-steps",async(s,c)=>{let d=P.join(n??t,"templates"),{reusableStep:u}=s.body??{};if(!u?.name||!Array.isArray(u.statements))return c.status(400).json({error:"reusableStep.name and reusableStep.statements are required"});await C.mkdir(d,{recursive:!0});let p=u.name.replace(/[/\\:*?"<>|]/g,"-").trim(),h=P.join(d,`${p}.yaml`),f={name:u.name,statements:Sn(u.statements)};u.description&&(f.description=u.description),await C.writeFile(h,fi(f),"utf-8"),c.json({id:kn(u.name),organizationId:"local",name:u.name,description:u.description??"",statements:u.statements})}),o.put("/api/reusable-steps/:id/update",async(s,c)=>{let d=parseInt(s.params.id,10),u=P.join(n??t,"templates"),p;try{p=await C.readdir(u)}catch(h){return h.code==="ENOENT"?c.status(404).json({error:"Templates directory not found"}):c.status(500).json({error:h.message})}for(let h of p.filter(f=>f.endsWith(".yaml")))try{let f=P.join(u,h),g=ct(await C.readFile(f,"utf-8"))??{},y=g.name??P.basename(h,".yaml");if(kn(y)!==d)continue;let m=s.body??{};return m.description!==void 0&&(g.description=m.description),m.statements!==void 0&&(g.statements=Sn(m.statements)),await C.writeFile(f,fi(g),"utf-8"),c.json({id:d,organizationId:"local",...g,statements:m.statements!==void 0?m.statements:Be(g.statements)})}catch{}c.status(404).json({error:`Template with id ${d} not found`})}),o.put("/api/templates/:name",async(s,c)=>{let d=P.join(n??t,"templates"),u=decodeURIComponent(s.params.name),p;try{p=await C.readdir(d)}catch(h){return h.code==="ENOENT"?c.status(404).json({error:"Templates directory not found"}):c.status(500).json({error:h.message})}for(let h of p.filter(f=>f.endsWith(".yaml")))try{let f=P.join(d,h),g=ct(await C.readFile(f,"utf-8"))??{};if((g.name??P.basename(h,".yaml"))!==u)continue;let m=s.body??{};return m.name!==void 0&&(g.name=m.name),m.description!==void 0&&(g.description=m.description),m.statements!==void 0&&(g.statements=Sn(m.statements)),await C.writeFile(f,fi(g),"utf-8"),c.json({organizationId:"local",...g,statements:m.statements!==void 0?m.statements:Be(g.statements)})}catch{}c.status(404).json({error:`Template "${u}" not found`})}),o.get("/api/test-results",async(s,c)=>{let d=l(s.query.file);if("error"in d)return c.status(400).json({error:d.error});let u=n??t,p=P.basename(d.filePath,".test.yaml"),h=P.join(u,".shiplight","artifacts",p),f=[],g=null;try{let y=await C.readdir(h,{withFileTypes:!0});for(let m of y)if(m.isDirectory()){let b=P.join(h,m.name),v=await C.readdir(b);for(let S of v.filter(T=>/\.(png|jpe?g|webp)$/i.test(T))){let T=P.relative(h,P.join(b,S)),M=m.name.match(/^(.+?)_(before|after)$/),N=M?M[1]:m.name,O=M?M[2]:"screenshot";f.push({url:`/api/report-assets/${p}/${T}`,label:O,stepId:N})}}else/\.(webm|mp4)$/i.test(m.name)&&(g||(g=`/api/report-assets/${p}/${m.name}`));f.sort((m,b)=>m.stepId!==b.stepId?(m.stepId??"").localeCompare(b.stepId??""):m.label.localeCompare(b.label))}catch{}if(f.length===0&&!g)return c.status(404).json({error:"No test results found"});c.json({videoPath:g,screenshots:f})}),o}var ml=x(()=>{"use strict";st();dl()});var pl={};dt(pl,{createIntRunnerRouter:()=>Qu});import{Router as Zu}from"express";function Qu(e){let t=Zu();return t.get("/api/browser-cdp",async(i,n)=>{let a=e.getCdpEndpoint();if(!a)return n.status(404).json({error:"No browser running. Start a debug session first."});n.json({cdpUrl:a})}),t.post("/api/int-runner/create-session",async(i,n)=>{try{let a=i.body.startingUrl||i.body.testFlow?.url||i.body.urlOverride,o=i.body.testFilePath,r=await e.createSession({startingUrl:a,testFilePath:o});n.json({status:"success",sessionId:r.sessionId,searchParams:""})}catch(a){console.error("[debugger] create-session error:",a),n.status(500).json({status:"error",message:a.message})}}),t.post("/api/int-runner/login",async(i,n)=>{try{let{session:a}=i.body;if(!a?.sessionId)return n.status(400).json({status:"error",message:"Missing session"});let o=await e.executeLogin(a.sessionId);n.json(o)}catch(a){console.error("[debugger] login error:",a),n.status(500).json({status:"error",details:a.message})}}),t.post("/api/int-runner/liveview-url",async(i,n)=>{let{session:a}=i.body;if(!a?.sessionId)return n.status(400).json({status:"error",message:"Missing session"});n.json({liveviewUrl:"",browserWsUrl:""})}),t.post("/api/int-runner/end-debug",async(i,n)=>{let{session:a}=i.body;if(!a?.sessionId)return n.status(400).json({status:"error",message:"Missing session"});n.json({status:"success"})}),t.post("/api/int-runner/start-debug",async(i,n)=>{try{let{session:a}=i.body;if(!a?.sessionId)return n.status(400).json({status:"error",message:"Missing session"});let o=await e.startDebug(a.sessionId);n.json({status:"success",...o})}catch(a){console.error("[debugger] start-debug error:",a),n.status(500).json({status:"error",message:a.message})}}),t.post("/api/int-runner/execute-action",async(i,n)=>{try{let{session:a,actionEntity:o,stepId:r,withSelfHealing:l,stmtUid:s,executionHistory:c}=i.body;if(!a?.sessionId||!o)return n.status(400).json({status:"error",message:"Missing session or actionEntity"});let d=await e.executeAction(a.sessionId,o,r,{withSelfHealing:l,stmtUid:s,executionHistory:c});n.json(d)}catch(a){console.error("[debugger] execute-action error:",a),n.status(500).json({status:"error",details:a.message})}}),t.post("/api/int-runner/run-step",async(i,n)=>{let{session:a,statement:o,stepId:r,executionHistory:l}=i.body;if(!a?.sessionId||!o)return n.status(400).json({success:!1,message:"Session and statement required"});n.setHeader("Content-Type","text/event-stream"),n.setHeader("Cache-Control","no-cache"),n.setHeader("Connection","keep-alive"),n.flushHeaders();let s=c=>{n.write(`data: ${JSON.stringify(c)}
4306
4306
 
4307
4307
  `)};try{await e.runStep(a.sessionId,o,r,s,l)}catch(c){s({type:"error",data:{message:c.message}})}finally{n.end()}}),t.post("/api/int-runner/execute-step",async(i,n)=>{let{session:a,statement:o,stepId:r,executionHistory:l,maxSteps:s}=i.body;if(!a?.sessionId||!o)return n.status(400).json({success:!1,message:"Session and statement required"});n.setHeader("Content-Type","text/event-stream"),n.setHeader("Cache-Control","no-cache"),n.setHeader("Connection","keep-alive"),n.flushHeaders();let c=d=>{n.write(`data: ${JSON.stringify(d)}
4308
4308