shiplightai 0.1.47 → 0.1.49

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.
@@ -13,7 +13,7 @@ ${e}`)}prompt(e,t){this.section("LLM Prompt"),this.log(`System Prompt:
13
13
  ${e}`),this.log(`
14
14
  User Prompt:
15
15
  ${t}`)}response(e){this.log(`LLM Response:
16
- ${e}`)}error(e,t){this.log(`ERROR: ${e}`),t&&(this.log(`Error details: ${t.message}`),t.stack&&this.log(`Stack: ${t.stack}`))}isEnabled(){return!!B().agentLogPath}},k=new Gs});var un,js,Ks,zs,ra,ni,dn,sa,hn,ge=w(()=>{"use strict";un=Object.defineProperty,js=Object.getOwnPropertyDescriptor,Ks=Object.getOwnPropertyNames,zs=Object.prototype.hasOwnProperty,ra=(e,t)=>()=>(e&&(t=e(e=0)),t),ni=(e,t)=>{for(var i in t)un(e,i,{get:t[i],enumerable:!0})},dn=(e,t,i,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Ks(t))!zs.call(e,a)&&a!==i&&un(e,a,{get:()=>t[a],enumerable:!(n=js(t,a))||n.enumerable});return e},sa=(e,t,i)=>(dn(e,t,"default"),i&&dn(i,t,"default")),hn=e=>dn(un({},"__esModule",{value:!0}),e)});function P(e,t){return t??e?.getActionSettings()?.action_timeout_ms??pn}function Vs(e){return e.replace(/\r\n/g," ").replace(/\n/g," ").replace(/\r/g," ").trim()}function C(e,t){let i=Ae(t);return i?new Function("page",`return ${i}`)(e):null}async function mn(e,t=[]){let i=e;for(let n of t){let a=await i.locator(n).elementHandle();if(!a)return null;let o=await a.contentFrame();if(await a.dispose(),!o)return null;i=o}return i}function Xs(e){let t={action_data:e.action_data};return e.locator&&(t.locator=e.locator),e.xpath&&(t.xpath=e.xpath),e.frame_path&&(t.frame_path=e.frame_path),t}function Ys(e){let t=e.frame_path;return!t||t.length===0?"page":`page.frameLocator('${t[0]}')`}function Js(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 Ae(e){let t=Ys(e),i=e.locator;if(typeof i=="string"&&i.trim())return i=i.trim(),i.endsWith("first()")?`${t}.${i}`:`${t}.${i}.first()`;let n=Js(e);if(n){let a=JSON.stringify(n);return`${t}.locator(${a}).first()`}return null}var ai,tt,pn,de,M,L=w(()=>{"use strict";ge();ai={};ni(ai,{ACTION_TIMEOUT:()=>pn,GOTO_TIMEOUT:()=>de,LOCATOR_TIMEOUT:()=>tt,getActionTimeoutMs:()=>P,getFrameContext:()=>mn,getLocator:()=>C,getMinimalActionEntity:()=>Xs,getPageLocatorExpression:()=>Ae,sanitizeForComment:()=>Vs});M=ra(()=>{tt=5e3,pn=1e4,de=2e4})});async function gn(e,t,i=[],n=[]){try{let a=await mn(e,i);if(!a)return g.warn(`Could not find frame context for xpath: ${t}`),null;let o=null;if(n.length>0){let s=n[0];if(!s)return g.warn(`Missing shadow host xpath for element: ${t}`),null;let l=a.locator(`xpath=${la(s)}`),d=qs(t);if(o=await(d?l.locator(`css=${d}`):l.locator(`xpath=${la(t)}`)).elementHandle({timeout:tt}),!o)return g.warn(`Could not find shadow DOM element with xpath: ${t}`),null}else if(o=await a.locator(`xpath=${t}`).elementHandle({timeout:tt}),!o)return g.warn(`Could not find element with xpath: ${t}`),null;let r=await a.evaluate(s=>typeof playwright<"u"&&playwright.generateLocator?playwright.generateLocator(s):null,o);return await o.dispose(),r?(g.debug(`Generated locator for ${t}: ${r}`),r):(g.debug("playwright.generateLocator is not available (PWDEBUG=console not set), using xpath fallback"),null)}catch(a){return g.error(`Error in pickBestLocator: ${a}`),null}}async function fn(e,t){try{let i=await(await t.ownerFrame()??e).evaluate(n=>typeof playwright<"u"&&playwright.generateLocator?playwright.generateLocator(n):null,t);return await t.dispose(),i?(g.debug(`Generated locator: ${i}`),i):(g.debug("playwright.generateLocator is not available (PWDEBUG=console not set), using xpath fallback"),null)}catch(i){return g.error(`Error in pickBestLocator: ${i}`),null}}function la(e){let t=e.trim();return t.startsWith("/")||t.startsWith("(")||t.startsWith(".")?t:`//${t}`}function qs(e){let t=e.trim().replace(/^\/+/,"");if(!t)return null;let i=t.split("/").filter(Boolean),n=[];for(let a of i){let o=a.match(/^([a-zA-Z][\w-]*)(?:\[(\d+)\])?$/);if(!o)return null;let r=o[1].toLowerCase(),s=o[2]?`:nth-of-type(${o[2]})`:"";n.push(`${r}${s}`)}return n.join(" > ")}var Oe=w(()=>{"use strict";F();L();M()});async function it(e,t,i){await e.evaluate(()=>{document.getElementById("playwright-highlight-container")?.remove(),window._highlightCleanupFunctions&&(window._highlightCleanupFunctions.forEach(l=>l()),window._highlightCleanupFunctions=[])});let n=await e.screenshot({type:"png",fullPage:!1}),{default:a}=await import("sharp"),o=a(n),{width:r=0,height:s=0}=await o.metadata();return k.log(`Screenshot actual: ${r}x${s}, viewport: ${t}x${i}`),(r!==t||s!==i?await o.resize(t,i).png().toBuffer():n).toString("base64")}async function fe(e,t,i){let n=await e.evaluateHandle(r=>document.elementFromPoint(r.x,r.y),{x:t,y:i}),a=n.asElement();if(!a)throw await n.dispose(),new Error(`No element found at (${t}, ${i})`);let o=await a.boundingBox();if(!o)throw await n.dispose(),new Error(`Element at (${t}, ${i}) has no bounding box`);return{relative_x:t-(o.x+o.width/2),relative_y:i-(o.y+o.height/2),element:a}}async function oi(e,t){if(!t)return{xpath:void 0,locator:void 0,frame_path:[]};let i=await t.evaluate(a=>{let o=[],r=a;for(;r&&r.nodeType===Node.ELEMENT_NODE;){let s=1,l=r.previousElementSibling;for(;l;)l.tagName===r.tagName&&s++,l=l.previousElementSibling;o.unshift(`${r.tagName.toLowerCase()}[${s}]`),r=r.parentElement}return o.length?`/${o.join("/")}`:null}).catch(()=>null),n=await fn(e,t);return{xpath:i??void 0,locator:n??void 0,frame_path:[]}}function ri(e,t,i){return{action_description:e,action_data:t,locator:i.locator??void 0,xpath:i.xpath??void 0,frame_path:i.frame_path}}var Fe=w(()=>{"use strict";Q();Oe()});import{createGoogleGenerativeAI as Zs}from"@ai-sdk/google";import{createVertex as Qs}from"@ai-sdk/google-vertex";function si(){let e=(B().env||{}).GOOGLE_GENAI_USE_VERTEXAI;return e==="True"||e==="true"}function da(e){let t=B().env||{};if(si()){let n=t.GOOGLE_CLOUD_PROJECT;if(!n)throw new Error("GOOGLE_CLOUD_PROJECT is required when using Vertex AI");let a=e==="gemini-3-flash-preview"?"global":t.GOOGLE_CLOUD_LOCATION;if(!a)throw new Error("GOOGLE_CLOUD_LOCATION is required when using Vertex AI");return g.debug(`Using Vertex AI provider: model=${e}, location=${a}`),Qs({project:n,location:a})(e)}let i=t.GOOGLE_API_KEY;if(!i)throw new Error("Google API key is missing. Set GOOGLE_API_KEY in SDK config or environment.");return g.debug(`Using Google AI provider (API key): model=${e}`),Zs({apiKey:i})(e)}function ua(e,t){let i={thinkingConfig:{thinkingBudget:512,includeThoughts:!0}},n={thinkingConfig:{thinkingLevel:"minimal",includeThoughts:!0},mediaResolution:ca.MEDIA_RESOLUTION_HIGH},a;switch(t){case"gemini-3-flash-preview":a={...n};break;default:a={...i},e===1&&(a.mediaResolution=ca.MEDIA_RESOLUTION_HIGH)}return si()?{vertex:a}:{google:a}}var ca,He=w(()=>{"use strict";F();Z();ca={MEDIA_RESOLUTION_HIGH:"MEDIA_RESOLUTION_HIGH",MEDIA_RESOLUTION_MEDIUM:"MEDIA_RESOLUTION_MEDIUM",MEDIA_RESOLUTION_LOW:"MEDIA_RESOLUTION_LOW"}});import{GoogleGenAI as el,Environment as tl}from"@google/genai";function ue(e,t){return Math.round(e/1e3*t)}async function nl(e,t,i,n,a){let o=null,r=null;try{switch(t){case"click_at":{let s=ue(i.x,n),l=ue(i.y,a),d=await fe(e,s,l);o={action_name:"click_by_coordinates",kwargs:{relative_x:d.relative_x,relative_y:d.relative_y}},r=d.element;break}case"right_click_at":{let s=ue(i.x,n),l=ue(i.y,a),d=await fe(e,s,l);o={action_name:"right_click_by_coordinates",kwargs:{relative_x:d.relative_x,relative_y:d.relative_y}},r=d.element;break}case"double_click_at":{let s=ue(i.x,n),l=ue(i.y,a),d=await fe(e,s,l);o={action_name:"double_click_by_coordinates",kwargs:{relative_x:d.relative_x,relative_y:d.relative_y}},r=d.element;break}case"drag_and_drop":{let s=ue(i.x,n),l=ue(i.y,a),d=ue(i.destination_x,n),c=ue(i.destination_y,a),u=await fe(e,s,l);o={action_name:"drag_drop",kwargs:{relative_x:u.relative_x,relative_y:u.relative_y,delta_x:d-s,delta_y:c-l}},r=u.element;break}default:k.log(`Unsupported Gemini function: ${t}`)}}catch(s){k.error(`Error mapping Gemini action "${t}"`,s)}return{action_data:o,locatorInfo:await oi(e,r)}}async function ma(e){let{statement:t,page:i,screenshotB64:n,viewportWidth:a,viewportHeight:o,modelId:r}=e,s=r||al,l=B(),d;if(si()){let b=l.env?.GOOGLE_CLOUD_PROJECT;if(!b)return{status:"error",error:"GOOGLE_CLOUD_PROJECT is required when using Vertex AI."};let E=l.env?.GOOGLE_CLOUD_LOCATION??"global";d={vertexai:!0,project:b,location:E}}else{let b=l.env?.GOOGLE_API_KEY;if(!b)return{status:"error",error:"GOOGLE_API_KEY not found in SDK env config."};d={apiKey:b}}let c=new el(d);k.log(`Sending request to Gemini CUA (model=${s})...`);let u=await c.models.generateContent({model:s,contents:[{role:"user",parts:[{text:`Execute this action: ${t}`},{inlineData:{mimeType:"image/png",data:n}}]}],config:{tools:[{computerUse:{environment:tl.ENVIRONMENT_BROWSER,excludedPredefinedFunctions:["search","type_text_at","scroll_document","navigate","go_back","go_forward","key_combination","hover_at","scroll_at"]}},{functionDeclarations:il}],temperature:.1}});k.log("Received response from Gemini CUA");let m=u.candidates?.[0];if(!m)return{status:"error",error:"No candidates in Gemini response"};let f=m.content?.parts?.find(b=>b.functionCall);if(!f)return{status:"error",reasoning:m.content?.parts?.filter(b=>b.text).map(b=>b.text).join(" ")||"No action generated",error:"No function call in Gemini response"};let{name:h,args:x}=f.functionCall;k.log(`Generated function call: ${h} with args ${JSON.stringify(x)}`),g.debug(`Generated function call: ${h} with args ${JSON.stringify(x)}`);let{action_data:y,locatorInfo:p}=await nl(i,h,x,a,o);return y?{status:"success",actionEntity:ri(t,y,p),reasoning:"Action generated successfully using Gemini computer use",goalAccomplished:!0}:{status:"error",error:`Unsupported or invalid Gemini action: ${h}`}}var ha,il,al,li=w(()=>{"use strict";Fe();Q();He();F();Z();ha={type:"object",properties:{x:{type:"integer",description:"X coordinate in the 0-1000 normalized space."},y:{type:"integer",description:"Y coordinate in the 0-1000 normalized space."}},required:["x","y"]},il=[{name:"right_click_at",description:"Right-click at the given normalized coordinate.",parameters:ha},{name:"double_click_at",description:"Double-click at the given normalized coordinate.",parameters:ha}];al="gemini-3-flash-preview"});function ga(e){return e!=null&&typeof e=="object"}function We(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function pa(e){return typeof e=="string"?e:void 0}function ol(e){let t,i;return Array.isArray(e)?(t=We(e[0]),i=We(e[1])):ga(e)&&(t=We(e.x),i=We(e.y)),t===void 0||i===void 0?null:{x:t,y:i}}function fa(e){if(!ga(e))return{};let t=Array.isArray(e.path)?e.path.map(ol).filter(i=>i!==null):void 0;return{type:pa(e.type),x:We(e.x),y:We(e.y),button:pa(e.button),path:t}}var ci=w(()=>{"use strict"});import rl from"openai";async function sl(e,t){let i=fa(t),n=null,a=null;switch(i.type){case"click":{if(i.x===void 0||i.y===void 0)break;let o=i.button==="right"?"right_click_by_coordinates":"click_by_coordinates",r=await fe(e,i.x,i.y);n={action_name:o,kwargs:{relative_x:r.relative_x,relative_y:r.relative_y}},a=r.element;break}case"double_click":{if(i.x===void 0||i.y===void 0)break;let o=await fe(e,i.x,i.y);n={action_name:"double_click_by_coordinates",kwargs:{relative_x:o.relative_x,relative_y:o.relative_y}},a=o.element;break}case"drag":{if(!i.path||i.path.length<2)break;let o=i.path[0],r=i.path[i.path.length-1],s=await fe(e,o.x,o.y);n={action_name:"drag_drop",kwargs:{relative_x:s.relative_x,relative_y:s.relative_y,delta_x:r.x-o.x,delta_y:r.y-o.y}},a=s.element;break}}return{action_data:n,locatorInfo:await oi(e,a)}}async function ba(e){let{statement:t,page:i,viewportWidth:n,viewportHeight:a,modelId:o}=e,r=o||ll,s=await it(i,n,a),l=B().env?.OPENAI_API_KEY;if(!l)return{status:"error",error:"OPENAI_API_KEY not found in SDK env config."};let d=new rl({apiKey:l}),c=d.responses.create.bind(d.responses);k.log(`Sending request to OpenAI CUA (model=${r})...`);let u=[{role:"user",content:[{type:"input_text",text:t},{type:"input_image",detail:"original",image_url:`data:image/png;base64,${s}`}]}];async function m(p,b){let E={model:r,tools:[cl],input:p,temperature:.1};return b&&(E.previous_response_id=b),c(E)}let f=await m(u,void 0),h;for(let p=0;p<wa;p++){k.log(`Received response from OpenAI CUA (turn ${p+1})`);let b=f.output.find(A=>A.type==="computer_call");if(!b)return{status:"error",reasoning:f.output_text||"Invalid action generation response",error:"No computer_call in OpenAI response"};let E=b.actions??[];if(E.length>1&&k.log(`[openai CUA] dropping ${E.length-1} batched action(s); only the first is executed`),h=E[0],!h)return{status:"error",error:"OpenAI CUA returned a computer_call with no actions"};if(h.type!=="screenshot")break;s=await it(i,n,a);let T=[{type:"computer_call_output",call_id:b.call_id,output:{type:"computer_screenshot",image_url:`data:image/png;base64,${s}`}}];f=await m(T,f.id)}if(!h)return{status:"error",error:"OpenAI CUA loop ended without an action"};if(h.type==="screenshot")return{status:"error",error:`OpenAI CUA kept requesting screenshots after ${wa} turns`};k.log(`Generated action: ${JSON.stringify(h)}`);let{action_data:x,locatorInfo:y}=await sl(i,h);return x?{status:"success",actionEntity:ri(t,x,y),reasoning:"Action generated successfully using OpenAI computer use",goalAccomplished:!0}:{status:"error",error:`Failed to map OpenAI action: ${JSON.stringify(h)}`}}var ll,cl,wa,di=w(()=>{"use strict";ci();Fe();Q();Z();ll="gpt-5.4",cl={type:"computer"},wa=4});import{createOpenAI as dl}from"@ai-sdk/openai";function ya(e){let t=B(),i=t.env?.OPENAI_API_KEY;if(!i)throw new Error("OPENAI_API_KEY not configured in SDK config");let n=t.env?.OPENAI_BASE_URL;return g.debug(`Using OpenAI provider: model=${e}${n?`, baseURL=${n}`:""}`),dl({apiKey:i,baseURL:n})(e)}function xa(e){return{}}var nt=w(()=>{"use strict";F();Z()});import{createAnthropic as ul}from"@ai-sdk/anthropic";import{createVertexAnthropic as hl}from"@ai-sdk/google-vertex/anthropic";function ml(e){if(!e)return!1;let t=e.trim().toLowerCase();return t==="1"||t==="true"||t==="yes"||t==="on"}function wn(e){return B().env?.[e]??process.env[e]}function pl(){return ml(wn("ANTHROPIC_MODELS_USE_VERTEXAI"))}function va(e){if(pl()){let i=wn("GOOGLE_CLOUD_PROJECT"),n=wn("GOOGLE_CLOUD_LOCATION");if(!i)throw new Error("GOOGLE_CLOUD_PROJECT is required when ANTHROPIC_MODELS_USE_VERTEXAI is enabled");if(!n)throw new Error("GOOGLE_CLOUD_LOCATION is required when ANTHROPIC_MODELS_USE_VERTEXAI is enabled");return g.debug(`Using Anthropic via Vertex AI provider: model=${e}, project=${i}, location=${n}`),hl({project:i,location:n})(e)}let t=B().env?.ANTHROPIC_API_KEY;if(!t)throw new Error("ANTHROPIC_API_KEY not configured in SDK config");return g.debug(`Using Anthropic provider: model=${e}`),ul({apiKey:t})(e)}function bn(e){return{anthropic:{structuredOutputMode:"jsonTool"}}}var at=w(()=>{"use strict";F();Z()});function ka(e){if(e.startsWith("claude-"))return"anthropic";if(e.startsWith("gemini-"))return"google";if(gl.test(e))return"openai"}function ui(e){let t=e.indexOf(":");if(t>0){let i=e.slice(0,t);if(fl.has(i))return{provider:i,modelId:e.slice(t+1)}}return{provider:void 0,modelId:e}}function we(e){let{provider:t,modelId:i}=ui(e),n=t??ka(i);if(!n)throw new Error(`Cannot determine provider for model: ${e}. Use a known model prefix (claude-*, gemini-*, gpt-*) or specify a provider (e.g., "openai:${i}", "azure:${i}", "bedrock:${i}").`);if(!i)throw new Error(`Empty model ID in model string: "${e}". Specify a model after the provider prefix (e.g., "${n}:gpt-5.4-mini").`);let a=_a[n];if(!a)throw new Error(`Provider "${n}" is not yet implemented. Supported providers: ${Object.keys(_a).join(", ")}. See packages/sdk-core/src/agent/llm/DESIGN.md for the roadmap.`);return a(i)}function be(e,t){let{provider:i,modelId:n}=ui(e),a=i??ka(n);return a==="anthropic"||a==="vertex"?bn(n):a==="openai"||a==="azure"?xa(n):a==="bedrock"?n.startsWith("anthropic.")?bn(n):{}:ua(t,n)}var gl,fl,_a,ye=w(()=>{"use strict";nt();at();He();gl=/^(gpt-|o\d|chatgpt-)/;fl=new Set(["anthropic","google","openai","vertex","azure","bedrock"]);_a={anthropic:va,google:da,openai:ya}});function bl(e){return e.startsWith("gemini-")?"google":"openai"}async function Ue(e,t,i={}){let{page:n}=t,a=n.viewportSize();if(!a)return{status:"error",error:"Viewport size not available"};let{width:o,height:r}=a;k.log(`Viewport: ${o}x${r}`);let s=await it(n,o,r),l=t.agentServices.getComputerUseModel();if(!l)return{status:"error",error:"No computer use model configured"};let{modelId:d}=ui(l),c=bl(d),u=wl[c];k.log(`Using CUA provider: ${c} (model: ${d})`);let m={statement:e,page:n,screenshotB64:s,viewportWidth:o,viewportHeight:r,modelId:d};try{return await u(m)}catch(f){return k.error(`CUA provider "${c}" threw an error`,f),{status:"error",error:f.message??"CUA provider failed"}}}var wl,Be=w(()=>{"use strict";li();di();Fe();Q();ye();wl={google:ma,openai:ba}});import{zodToJsonSchema as yl}from"zod-to-json-schema";function hi(e){let t=yl(e,{$refStrategy:"none"});if(t.$schema&&delete t.$schema,t.type!=="object")throw new Error(`Schema must be a Zod object schema, got type: ${t.type}`);return ot(t),t}function ot(e){if(!(typeof e!="object"||e===null)){if(e.type==="object"&&(e.additionalProperties=!1,e.properties)){let t=Object.keys(e.properties);e.required=t;for(let i of Object.values(e.properties))ot(i)}e.type==="array"&&e.items&&ot(e.items);for(let t of["anyOf","oneOf","allOf"])Array.isArray(e[t])&&e[t].forEach(ot);for(let[t,i]of Object.entries(e))typeof i=="object"&&i!==null&&!["properties","items","anyOf","oneOf","allOf"].includes(t)&&ot(i)}}var rt=w(()=>{"use strict"});var yn,mi=w(()=>{"use strict";rt();yn=class{constructor(e){this.registry=e}getToolDefinitions(){return this.registry.getTools().filter(e=>e.availability.openai).map(e=>({type:"function",function:{name:e.name,description:e.description,parameters:hi(e.schema),strict:!0}}))}getToolDefinitionsFiltered(e){let t=new Set(e);return this.registry.getTools().filter(i=>t.has(i.name)&&i.availability.openai).map(i=>({type:"function",function:{name:i.name,description:i.description,parameters:hi(i.schema),strict:!0}}))}toJSON(){return this.getToolDefinitions()}getToolDefinition(e){let t=this.registry.get(e);if(t)return{type:"function",function:{name:t.name,description:t.description,parameters:hi(t.schema),strict:!0}}}getToolCount(){return this.registry.size()}getToolNames(){return this.registry.getToolNames()}}});function xl(e,t){let i=new Map;for(let l of t)l.hash&&l.url?i.set(l.hash,l.url):l.uuid&&l.url&&i.set(l.uuid,l.url);let n=/!\[([^\]]*)\]\(image:([a-f0-9]{64}|[a-zA-Z0-9\-]+)\)/g,a=[],o=0,r;for(;(r=n.exec(e))!==null;){let l=e.slice(o,r.index);l&&a.push({type:"text",text:l});let d=r[2];i.has(d)?a.push({type:"image",image:new URL(i.get(d))}):a.push({type:"text",text:r[0]}),o=r.index+r[0].length}let s=e.slice(o);return s&&a.push({type:"text",text:s}),a.length===0&&a.push({type:"text",text:e}),a}function vl(e){let t=[];for(let i of e){let n=i.content||"",a=i.images||[],o=xl(n,a);t.length>0&&o.length>0&&t.push({type:"text",text:`
16
+ ${e}`)}error(e,t){this.log(`ERROR: ${e}`),t&&(this.log(`Error details: ${t.message}`),t.stack&&this.log(`Stack: ${t.stack}`))}isEnabled(){return!!B().agentLogPath}},k=new Gs});var un,js,Ks,zs,ra,ni,dn,sa,hn,ge=w(()=>{"use strict";un=Object.defineProperty,js=Object.getOwnPropertyDescriptor,Ks=Object.getOwnPropertyNames,zs=Object.prototype.hasOwnProperty,ra=(e,t)=>()=>(e&&(t=e(e=0)),t),ni=(e,t)=>{for(var i in t)un(e,i,{get:t[i],enumerable:!0})},dn=(e,t,i,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Ks(t))!zs.call(e,a)&&a!==i&&un(e,a,{get:()=>t[a],enumerable:!(n=js(t,a))||n.enumerable});return e},sa=(e,t,i)=>(dn(e,t,"default"),i&&dn(i,t,"default")),hn=e=>dn(un({},"__esModule",{value:!0}),e)});function P(e,t){return t??e?.getActionSettings()?.action_timeout_ms??pn}function Vs(e){return e.replace(/\r\n/g," ").replace(/\n/g," ").replace(/\r/g," ").trim()}function C(e,t){let i=Ae(t);return i?new Function("page",`return ${i}`)(e):null}async function mn(e,t=[]){let i=e;for(let n of t){let a=await i.locator(n).elementHandle();if(!a)return null;let o=await a.contentFrame();if(await a.dispose(),!o)return null;i=o}return i}function Xs(e){let t={action_data:e.action_data};return e.locator&&(t.locator=e.locator),e.xpath&&(t.xpath=e.xpath),e.frame_path&&(t.frame_path=e.frame_path),t}function Ys(e){let t=e.frame_path;return!t||t.length===0?"page":`page.frameLocator('${t[0]}')`}function Js(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 Ae(e){let t=Ys(e),i=e.locator;if(typeof i=="string"&&i.trim())return i=i.trim(),i.endsWith("first()")?`${t}.${i}`:`${t}.${i}.first()`;let n=Js(e);if(n){let a=JSON.stringify(n);return`${t}.locator(${a}).first()`}return null}var ai,tt,pn,de,M,L=w(()=>{"use strict";ge();ai={};ni(ai,{ACTION_TIMEOUT:()=>pn,GOTO_TIMEOUT:()=>de,LOCATOR_TIMEOUT:()=>tt,getActionTimeoutMs:()=>P,getFrameContext:()=>mn,getLocator:()=>C,getMinimalActionEntity:()=>Xs,getPageLocatorExpression:()=>Ae,sanitizeForComment:()=>Vs});M=ra(()=>{tt=5e3,pn=1e4,de=2e4})});async function gn(e,t,i=[],n=[]){try{let a=await mn(e,i);if(!a)return g.warn(`Could not find frame context for xpath: ${t}`),null;let o=null;if(n.length>0){let s=n[0];if(!s)return g.warn(`Missing shadow host xpath for element: ${t}`),null;let l=a.locator(`xpath=${la(s)}`),d=qs(t);if(o=await(d?l.locator(`css=${d}`):l.locator(`xpath=${la(t)}`)).elementHandle({timeout:tt}),!o)return g.warn(`Could not find shadow DOM element with xpath: ${t}`),null}else if(o=await a.locator(`xpath=${t}`).elementHandle({timeout:tt}),!o)return g.warn(`Could not find element with xpath: ${t}`),null;let r=await a.evaluate(s=>typeof playwright<"u"&&playwright.generateLocator?playwright.generateLocator(s):null,o);return await o.dispose(),r?(g.debug(`Generated locator for ${t}: ${r}`),r):(g.debug("playwright.generateLocator is not available (PWDEBUG=console not set), using xpath fallback"),null)}catch(a){return g.error(`Error in pickBestLocator: ${a}`),null}}async function fn(e,t){try{let i=await(await t.ownerFrame()??e).evaluate(n=>typeof playwright<"u"&&playwright.generateLocator?playwright.generateLocator(n):null,t);return await t.dispose(),i?(g.debug(`Generated locator: ${i}`),i):(g.debug("playwright.generateLocator is not available (PWDEBUG=console not set), using xpath fallback"),null)}catch(i){return g.error(`Error in pickBestLocator: ${i}`),null}}function la(e){let t=e.trim();return t.startsWith("/")||t.startsWith("(")||t.startsWith(".")?t:`//${t}`}function qs(e){let t=e.trim().replace(/^\/+/,"");if(!t)return null;let i=t.split("/").filter(Boolean),n=[];for(let a of i){let o=a.match(/^([a-zA-Z][\w-]*)(?:\[(\d+)\])?$/);if(!o)return null;let r=o[1].toLowerCase(),s=o[2]?`:nth-of-type(${o[2]})`:"";n.push(`${r}${s}`)}return n.join(" > ")}var Oe=w(()=>{"use strict";F();L();M()});async function it(e,t,i){await e.evaluate(()=>{document.getElementById("playwright-highlight-container")?.remove(),window._highlightCleanupFunctions&&(window._highlightCleanupFunctions.forEach(l=>l()),window._highlightCleanupFunctions=[])});let n=await e.screenshot({type:"png",fullPage:!1}),{default:a}=await import("sharp"),o=a(n),{width:r=0,height:s=0}=await o.metadata();return k.log(`Screenshot actual: ${r}x${s}, viewport: ${t}x${i}`),(r!==t||s!==i?await o.resize(t,i).png().toBuffer():n).toString("base64")}async function fe(e,t,i){let n=await e.evaluateHandle(r=>document.elementFromPoint(r.x,r.y),{x:t,y:i}),a=n.asElement();if(!a)throw await n.dispose(),new Error(`No element found at (${t}, ${i})`);let o=await a.boundingBox();if(!o)throw await n.dispose(),new Error(`Element at (${t}, ${i}) has no bounding box`);return{relative_x:t-(o.x+o.width/2),relative_y:i-(o.y+o.height/2),element:a}}async function oi(e,t){if(!t)return{xpath:void 0,locator:void 0,frame_path:[]};let i=await t.evaluate(a=>{let o=[],r=a;for(;r&&r.nodeType===Node.ELEMENT_NODE;){let s=1,l=r.previousElementSibling;for(;l;)l.tagName===r.tagName&&s++,l=l.previousElementSibling;o.unshift(`${r.tagName.toLowerCase()}[${s}]`),r=r.parentElement}return o.length?`/${o.join("/")}`:null}).catch(()=>null),n=await fn(e,t);return{xpath:i??void 0,locator:n??void 0,frame_path:[]}}function ri(e,t,i){return{action_description:e,action_data:t,locator:i.locator??void 0,xpath:i.xpath??void 0,frame_path:i.frame_path}}var Fe=w(()=>{"use strict";Q();Oe()});import{createGoogleGenerativeAI as Zs}from"@ai-sdk/google";import{createVertex as Qs}from"@ai-sdk/google-vertex";function si(){let e=(B().env||{}).GOOGLE_GENAI_USE_VERTEXAI;return e==="True"||e==="true"}function da(e){let t=B().env||{};if(si()){let n=t.GOOGLE_CLOUD_PROJECT;if(!n)throw new Error("GOOGLE_CLOUD_PROJECT is required when using Vertex AI");let a=e==="gemini-3-flash-preview"?"global":t.GOOGLE_CLOUD_LOCATION;if(!a)throw new Error("GOOGLE_CLOUD_LOCATION is required when using Vertex AI");return g.debug(`Using Vertex AI provider: model=${e}, location=${a}`),Qs({project:n,location:a})(e)}let i=t.GOOGLE_API_KEY;if(!i)throw new Error("Google API key is missing. Set GOOGLE_API_KEY in SDK config or environment.");return g.debug(`Using Google AI provider (API key): model=${e}`),Zs({apiKey:i})(e)}function ua(e,t){let i={thinkingConfig:{thinkingBudget:512,includeThoughts:!0}},n={thinkingConfig:{thinkingLevel:"minimal",includeThoughts:!0},mediaResolution:ca.MEDIA_RESOLUTION_HIGH},a;switch(t){case"gemini-3-flash-preview":a={...n};break;default:a={...i},e===1&&(a.mediaResolution=ca.MEDIA_RESOLUTION_HIGH)}return si()?{vertex:a}:{google:a}}var ca,He=w(()=>{"use strict";F();Z();ca={MEDIA_RESOLUTION_HIGH:"MEDIA_RESOLUTION_HIGH",MEDIA_RESOLUTION_MEDIUM:"MEDIA_RESOLUTION_MEDIUM",MEDIA_RESOLUTION_LOW:"MEDIA_RESOLUTION_LOW"}});import{GoogleGenAI as el,Environment as tl}from"@google/genai";function ue(e,t){return Math.round(e/1e3*t)}async function nl(e,t,i,n,a){let o=null,r=null;try{switch(t){case"click_at":{let s=ue(i.x,n),l=ue(i.y,a),d=await fe(e,s,l);o={action_name:"click_by_coordinates",kwargs:{relative_x:d.relative_x,relative_y:d.relative_y}},r=d.element;break}case"right_click_at":{let s=ue(i.x,n),l=ue(i.y,a),d=await fe(e,s,l);o={action_name:"right_click_by_coordinates",kwargs:{relative_x:d.relative_x,relative_y:d.relative_y}},r=d.element;break}case"double_click_at":{let s=ue(i.x,n),l=ue(i.y,a),d=await fe(e,s,l);o={action_name:"double_click_by_coordinates",kwargs:{relative_x:d.relative_x,relative_y:d.relative_y}},r=d.element;break}case"drag_and_drop":{let s=ue(i.x,n),l=ue(i.y,a),d=ue(i.destination_x,n),c=ue(i.destination_y,a),u=await fe(e,s,l);o={action_name:"drag_drop",kwargs:{relative_x:u.relative_x,relative_y:u.relative_y,delta_x:d-s,delta_y:c-l}},r=u.element;break}default:k.log(`Unsupported Gemini function: ${t}`)}}catch(s){k.error(`Error mapping Gemini action "${t}"`,s)}return{action_data:o,locatorInfo:await oi(e,r)}}async function ma(e){let{statement:t,page:i,screenshotB64:n,viewportWidth:a,viewportHeight:o,modelId:r}=e,s=r||al,l=B(),d;if(si()){let b=l.env?.GOOGLE_CLOUD_PROJECT;if(!b)return{status:"error",error:"GOOGLE_CLOUD_PROJECT is required when using Vertex AI."};let E=l.env?.GOOGLE_CLOUD_LOCATION??"global";d={vertexai:!0,project:b,location:E}}else{let b=l.env?.GOOGLE_API_KEY;if(!b)return{status:"error",error:"GOOGLE_API_KEY not found in SDK env config."};d={apiKey:b}}let c=new el(d);k.log(`Sending request to Gemini CUA (model=${s})...`);let u=await c.models.generateContent({model:s,contents:[{role:"user",parts:[{text:`Execute this action: ${t}`},{inlineData:{mimeType:"image/png",data:n}}]}],config:{tools:[{computerUse:{environment:tl.ENVIRONMENT_BROWSER,excludedPredefinedFunctions:["search","type_text_at","scroll_document","navigate","go_back","go_forward","key_combination","hover_at","scroll_at"]}},{functionDeclarations:il}],temperature:.1}});k.log("Received response from Gemini CUA");let m=u.candidates?.[0];if(!m)return{status:"error",error:"No candidates in Gemini response"};let f=m.content?.parts?.find(b=>b.functionCall);if(!f)return{status:"error",reasoning:m.content?.parts?.filter(b=>b.text).map(b=>b.text).join(" ")||"No action generated",error:"No function call in Gemini response"};let{name:h,args:x}=f.functionCall;k.log(`Generated function call: ${h} with args ${JSON.stringify(x)}`),g.debug(`Generated function call: ${h} with args ${JSON.stringify(x)}`);let{action_data:y,locatorInfo:p}=await nl(i,h,x,a,o);return y?{status:"success",actionEntity:ri(t,y,p),reasoning:"Action generated successfully using Gemini computer use",goalAccomplished:!0}:{status:"error",error:`Unsupported or invalid Gemini action: ${h}`}}var ha,il,al,li=w(()=>{"use strict";Fe();Q();He();F();Z();ha={type:"object",properties:{x:{type:"integer",description:"X coordinate in the 0-1000 normalized space."},y:{type:"integer",description:"Y coordinate in the 0-1000 normalized space."}},required:["x","y"]},il=[{name:"right_click_at",description:"Right-click at the given normalized coordinate.",parameters:ha},{name:"double_click_at",description:"Double-click at the given normalized coordinate.",parameters:ha}];al="gemini-3-flash-preview"});function ga(e){return e!=null&&typeof e=="object"}function We(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function pa(e){return typeof e=="string"?e:void 0}function ol(e){let t,i;return Array.isArray(e)?(t=We(e[0]),i=We(e[1])):ga(e)&&(t=We(e.x),i=We(e.y)),t===void 0||i===void 0?null:{x:t,y:i}}function fa(e){if(!ga(e))return{};let t=Array.isArray(e.path)?e.path.map(ol).filter(i=>i!==null):void 0;return{type:pa(e.type),x:We(e.x),y:We(e.y),button:pa(e.button),path:t}}var ci=w(()=>{"use strict"});import rl from"openai";async function sl(e,t){let i=fa(t),n=null,a=null;switch(i.type){case"click":{if(i.x===void 0||i.y===void 0)break;let o=i.button==="right"?"right_click_by_coordinates":"click_by_coordinates",r=await fe(e,i.x,i.y);n={action_name:o,kwargs:{relative_x:r.relative_x,relative_y:r.relative_y}},a=r.element;break}case"double_click":{if(i.x===void 0||i.y===void 0)break;let o=await fe(e,i.x,i.y);n={action_name:"double_click_by_coordinates",kwargs:{relative_x:o.relative_x,relative_y:o.relative_y}},a=o.element;break}case"drag":{if(!i.path||i.path.length<2)break;let o=i.path[0],r=i.path[i.path.length-1],s=await fe(e,o.x,o.y);n={action_name:"drag_drop",kwargs:{relative_x:s.relative_x,relative_y:s.relative_y,delta_x:r.x-o.x,delta_y:r.y-o.y}},a=s.element;break}}return{action_data:n,locatorInfo:await oi(e,a)}}async function ba(e){let{statement:t,page:i,viewportWidth:n,viewportHeight:a,modelId:o}=e,r=o||ll,s=await it(i,n,a),l=B().env?.OPENAI_API_KEY;if(!l)return{status:"error",error:"OPENAI_API_KEY not found in SDK env config."};let d=new rl({apiKey:l}),c=d.responses.create.bind(d.responses);k.log(`Sending request to OpenAI CUA (model=${r})...`);let u=[{role:"user",content:[{type:"input_text",text:t},{type:"input_image",detail:"original",image_url:`data:image/png;base64,${s}`}]}];async function m(p,b){let E={model:r,tools:[cl],input:p,temperature:.1};return b&&(E.previous_response_id=b),c(E)}let f=await m(u,void 0),h;for(let p=0;p<wa;p++){k.log(`Received response from OpenAI CUA (turn ${p+1})`);let b=f.output.find(A=>A.type==="computer_call");if(!b)return{status:"error",reasoning:f.output_text||"Invalid action generation response",error:"No computer_call in OpenAI response"};let E=b.actions??[];if(E.length>1&&k.log(`[openai CUA] dropping ${E.length-1} batched action(s); only the first is executed`),h=E[0],!h)return{status:"error",error:"OpenAI CUA returned a computer_call with no actions"};if(h.type!=="screenshot")break;s=await it(i,n,a);let T=[{type:"computer_call_output",call_id:b.call_id,output:{type:"computer_screenshot",image_url:`data:image/png;base64,${s}`,detail:"original"}}];f=await m(T,f.id)}if(!h)return{status:"error",error:"OpenAI CUA loop ended without an action"};if(h.type==="screenshot")return{status:"error",error:`OpenAI CUA kept requesting screenshots after ${wa} turns`};k.log(`Generated action: ${JSON.stringify(h)}`);let{action_data:x,locatorInfo:y}=await sl(i,h);return x?{status:"success",actionEntity:ri(t,x,y),reasoning:"Action generated successfully using OpenAI computer use",goalAccomplished:!0}:{status:"error",error:`Failed to map OpenAI action: ${JSON.stringify(h)}`}}var ll,cl,wa,di=w(()=>{"use strict";ci();Fe();Q();Z();ll="gpt-5.4",cl={type:"computer"},wa=4});import{createOpenAI as dl}from"@ai-sdk/openai";function ya(e){let t=B(),i=t.env?.OPENAI_API_KEY;if(!i)throw new Error("OPENAI_API_KEY not configured in SDK config");let n=t.env?.OPENAI_BASE_URL;return g.debug(`Using OpenAI provider: model=${e}${n?`, baseURL=${n}`:""}`),dl({apiKey:i,baseURL:n})(e)}function xa(e){return{}}var nt=w(()=>{"use strict";F();Z()});import{createAnthropic as ul}from"@ai-sdk/anthropic";import{createVertexAnthropic as hl}from"@ai-sdk/google-vertex/anthropic";function ml(e){if(!e)return!1;let t=e.trim().toLowerCase();return t==="1"||t==="true"||t==="yes"||t==="on"}function wn(e){return B().env?.[e]??process.env[e]}function pl(){return ml(wn("ANTHROPIC_MODELS_USE_VERTEXAI"))}function va(e){if(pl()){let i=wn("GOOGLE_CLOUD_PROJECT"),n=wn("GOOGLE_CLOUD_LOCATION");if(!i)throw new Error("GOOGLE_CLOUD_PROJECT is required when ANTHROPIC_MODELS_USE_VERTEXAI is enabled");if(!n)throw new Error("GOOGLE_CLOUD_LOCATION is required when ANTHROPIC_MODELS_USE_VERTEXAI is enabled");return g.debug(`Using Anthropic via Vertex AI provider: model=${e}, project=${i}, location=${n}`),hl({project:i,location:n})(e)}let t=B().env?.ANTHROPIC_API_KEY;if(!t)throw new Error("ANTHROPIC_API_KEY not configured in SDK config");return g.debug(`Using Anthropic provider: model=${e}`),ul({apiKey:t})(e)}function bn(e){return{anthropic:{structuredOutputMode:"jsonTool"}}}var at=w(()=>{"use strict";F();Z()});function ka(e){if(e.startsWith("claude-"))return"anthropic";if(e.startsWith("gemini-"))return"google";if(gl.test(e))return"openai"}function ui(e){let t=e.indexOf(":");if(t>0){let i=e.slice(0,t);if(fl.has(i))return{provider:i,modelId:e.slice(t+1)}}return{provider:void 0,modelId:e}}function we(e){let{provider:t,modelId:i}=ui(e),n=t??ka(i);if(!n)throw new Error(`Cannot determine provider for model: ${e}. Use a known model prefix (claude-*, gemini-*, gpt-*) or specify a provider (e.g., "openai:${i}", "azure:${i}", "bedrock:${i}").`);if(!i)throw new Error(`Empty model ID in model string: "${e}". Specify a model after the provider prefix (e.g., "${n}:gpt-5.4-mini").`);let a=_a[n];if(!a)throw new Error(`Provider "${n}" is not yet implemented. Supported providers: ${Object.keys(_a).join(", ")}. See packages/sdk-core/src/agent/llm/DESIGN.md for the roadmap.`);return a(i)}function be(e,t){let{provider:i,modelId:n}=ui(e),a=i??ka(n);return a==="anthropic"||a==="vertex"?bn(n):a==="openai"||a==="azure"?xa(n):a==="bedrock"?n.startsWith("anthropic.")?bn(n):{}:ua(t,n)}var gl,fl,_a,ye=w(()=>{"use strict";nt();at();He();gl=/^(gpt-|o\d|chatgpt-)/;fl=new Set(["anthropic","google","openai","vertex","azure","bedrock"]);_a={anthropic:va,google:da,openai:ya}});function bl(e){return e.startsWith("gemini-")?"google":"openai"}async function Ue(e,t,i={}){let{page:n}=t,a=n.viewportSize();if(!a)return{status:"error",error:"Viewport size not available"};let{width:o,height:r}=a;k.log(`Viewport: ${o}x${r}`);let s=await it(n,o,r),l=t.agentServices.getComputerUseModel();if(!l)return{status:"error",error:"No computer use model configured"};let{modelId:d}=ui(l),c=bl(d),u=wl[c];k.log(`Using CUA provider: ${c} (model: ${d})`);let m={statement:e,page:n,screenshotB64:s,viewportWidth:o,viewportHeight:r,modelId:d};try{return await u(m)}catch(f){return k.error(`CUA provider "${c}" threw an error`,f),{status:"error",error:f.message??"CUA provider failed"}}}var wl,Be=w(()=>{"use strict";li();di();Fe();Q();ye();wl={google:ma,openai:ba}});import{zodToJsonSchema as yl}from"zod-to-json-schema";function hi(e){let t=yl(e,{$refStrategy:"none"});if(t.$schema&&delete t.$schema,t.type!=="object")throw new Error(`Schema must be a Zod object schema, got type: ${t.type}`);return ot(t),t}function ot(e){if(!(typeof e!="object"||e===null)){if(e.type==="object"&&(e.additionalProperties=!1,e.properties)){let t=Object.keys(e.properties);e.required=t;for(let i of Object.values(e.properties))ot(i)}e.type==="array"&&e.items&&ot(e.items);for(let t of["anyOf","oneOf","allOf"])Array.isArray(e[t])&&e[t].forEach(ot);for(let[t,i]of Object.entries(e))typeof i=="object"&&i!==null&&!["properties","items","anyOf","oneOf","allOf"].includes(t)&&ot(i)}}var rt=w(()=>{"use strict"});var yn,mi=w(()=>{"use strict";rt();yn=class{constructor(e){this.registry=e}getToolDefinitions(){return this.registry.getTools().filter(e=>e.availability.openai).map(e=>({type:"function",function:{name:e.name,description:e.description,parameters:hi(e.schema),strict:!0}}))}getToolDefinitionsFiltered(e){let t=new Set(e);return this.registry.getTools().filter(i=>t.has(i.name)&&i.availability.openai).map(i=>({type:"function",function:{name:i.name,description:i.description,parameters:hi(i.schema),strict:!0}}))}toJSON(){return this.getToolDefinitions()}getToolDefinition(e){let t=this.registry.get(e);if(t)return{type:"function",function:{name:t.name,description:t.description,parameters:hi(t.schema),strict:!0}}}getToolCount(){return this.registry.size()}getToolNames(){return this.registry.getToolNames()}}});function xl(e,t){let i=new Map;for(let l of t)l.hash&&l.url?i.set(l.hash,l.url):l.uuid&&l.url&&i.set(l.uuid,l.url);let n=/!\[([^\]]*)\]\(image:([a-f0-9]{64}|[a-zA-Z0-9\-]+)\)/g,a=[],o=0,r;for(;(r=n.exec(e))!==null;){let l=e.slice(o,r.index);l&&a.push({type:"text",text:l});let d=r[2];i.has(d)?a.push({type:"image",image:new URL(i.get(d))}):a.push({type:"text",text:r[0]}),o=r.index+r[0].length}let s=e.slice(o);return s&&a.push({type:"text",text:s}),a.length===0&&a.push({type:"text",text:e}),a}function vl(e){let t=[];for(let i of e){let n=i.content||"",a=i.images||[],o=xl(n,a);t.length>0&&o.length>0&&t.push({type:"text",text:`
17
17
 
18
18
  `}),t.push(...o)}return t}function pi(e,t=Sa){if(t){let i=vl(e);if(i.length===0)return[];let n={type:"text",text:`
19
19
 
@@ -4300,7 +4300,7 @@ ${f.join(`
4300
4300
  `,n+=`- Use the EXACT placeholder name as shown above
4301
4301
  `,n+=`- Do NOT use the actual value directly in the action
4302
4302
  `,n+=`- The values shown are for context only to help you understand what data is available
4303
- `,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 Yt=w(()=>{"use strict"});async function Gc(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"],s=u=>{let m=u.toLowerCase();return m.startsWith("data:")||m.startsWith("blob:")?!0:r.some(f=>m.includes(f))},l=u=>{let m=u.resourceType(),f=u.url();if(!a.has(m)||s(f))return;let h=u.headers();h.purpose==="prefetch"||["video","audio"].includes(h["sec-fetch-dest"])||(i.add(u),n=Date.now())},d=async u=>{let m=u.request();if(!i.has(m))return;let f=(u.headers()["content-type"]||"").toLowerCase();if(["streaming","video","audio","webm","mp4","event-stream","websocket","protobuf"].some(x=>f.includes(x))){i.delete(m);return}if(![...o].some(x=>f.startsWith(x))){i.delete(m);return}let h=u.headers()["content-length"];if(h)try{if(parseInt(h,10)>5*1024*1024){i.delete(m);return}}catch{}i.delete(m),n=Date.now()},c=Date.now()-Bc;for(let u of await e.requests()){let m=u.resourceType(),f=u.url(),h=u.timing();a.has(m)&&!s(f)&&h.responseEnd===-1&&h.startTime>=c&&(i.add(u),n=Date.now())}g.debug(`[waitForStableNetwork] Pre-populated ${i.size} in-flight requests`),e.on("request",l),e.on("response",d);try{let u=Date.now(),m=Uc;for(;;){await new Promise(h=>setTimeout(h,100));let f=Date.now();if(i.size===0&&f-n>=m){g.debug(`[waitForStableNetwork] Network idle after ${f-u}ms`);break}if(f-u>t){g.debug(`[waitForStableNetwork] Max wait time exceeded (${t}ms), pending: ${i.size}`);break}}}finally{e.removeListener("request",l),e.removeListener("response",d)}}async function Ve(e,t=Wc,i=Hc){let n=Date.now();try{await Promise.all([e.waitForLoadState("load",{timeout:t}).catch(()=>{}),Gc(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 Hc,Wc,Uc,Bc,Ie=w(()=>{"use strict";Yt();F();Hc=.5*1e3,Wc=30*1e3,Uc=1*1e3,Bc=3*1e3});import{generateText as jc}from"ai";function Kc(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 gr(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(),s=t.domService||new $e(t.agentServices.getDomServiceOptions()),l={...t,domService:s};k.init(),k.section("Task Execution Started"),k.log(`Task: ${e}`),k.log(`Max steps: ${a}`),k.log(`Model: ${r}`);let d={currentStep:0,maxSteps:a,consecutiveFailures:0,maxFailures:o,lastFailReason:null,stepHistory:[],memory:[],lastGoal:null,lastEvaluation:null},c=[],u=Ji(i.customPrompt),m=new Zi(u);k.log(`System prompt length: ${u.length} chars`);let f=!1,h="",x=[];try{for(i.onEvent?.({type:"start",task:e,maxSteps:a});d.currentStep<a;){if(i.abortSignal?.aborted)throw new Error("Task aborted by user");d.currentStep++;let y=Date.now();k.section(`Step ${d.currentStep}/${a}`),k.log(`URL: ${l.page.url()}`),i.onEvent?.({type:"step_start",step:d.currentStep});try{k.log("Waiting for page to stabilize..."),await Ve(l.page),k.log("Page stabilized")}catch{k.log("Page stabilization timed out, continuing anyway")}let p;try{k.log("Preparing context (DOM + screenshot)...");let D=l.agentServices.getInteractiveClassNames(),R=l.agentServices.getIframeFallbackDomains();p=await pr(l.page,l.domService,D,R),k.log("Context prepared")}catch(D){if(D.message.includes("Execution context was destroyed")){k.log("Page navigating, waiting for load..."),await Ve(l.page);let R=l.agentServices.getInteractiveClassNames(),O=l.agentServices.getIframeFallbackDomains();p=await pr(l.page,l.domService,R,O)}else throw k.error("Error preparing context",D),D}m.addStateMessage(e,p.currentUrl,p.domTree,p.screenshotBase64,d,{isFinalStep:d.currentStep===a-1,placeholderData:t.variables,sensitiveKeys:t.sensitiveKeys});let b=await Vc(m,r,i,p.screenshotBase64);if(b.tokenUsages&&b.tokenUsages.length>0&&c.push(...b.tokenUsages),!b.stepOutput){if(k.error("Failed to get valid LLM response"),d.consecutiveFailures++,d.consecutiveFailures>=o){h="Reached the maximum allowed consecutive failures. Most recent error: Unable to get a valid response from the language model.";break}continue}let E=b.stepOutput;qc(d.currentStep,a,E);let T=await Yc(E,l,p.domState,d.currentStep,i.onEvent,p.screenshotBase64,b.debugInfo);x.push(...T.actionEntities);let A=Jc(d.currentStep,E,T,d,y,b.debugInfo,b.tokenUsages),I=Date.now()-y;if(i.onEvent?.({type:"step_complete",step:d.currentStep,duration:I}),d.consecutiveFailures>=o){k.error(`Too many consecutive failures (${d.consecutiveFailures}), stopping`),h=`Reached the maximum allowed consecutive failures. Most recent error: ${d.lastFailReason}`;break}if(T.doneResult){f=T.doneResult.success,h=T.doneResult.summary;break}if(T.completesInstruction){f=!0,h="Instruction completed";break}}return d.currentStep>=a&&!f&&(h="Reached the maximum allowed steps."),i.onEvent?.({type:"complete",totalSteps:d.currentStep,duration:Date.now()-n}),k.log(`Build success result: summary=${h}, completed=${f}, actions=${x.length}, tokens=${c.length}`),Zc(d,x,f,h,n,c,r)}catch(y){let p=y.message;return k.error(`Task execution failed: ${p}`,y),i.onEvent?.({type:"error",error:p,recoverable:!1}),Qc(d,p,n,c,r)}}async function pr(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 zc(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 Vc(e,t,i,n){let a=i.temperature??0,{system:o,messages:r}=e.getMessages(),s=0;for(let u of r)Array.isArray(u.content)&&(s+=u.content.filter(m=>m.type==="image").length);let l=be(t,s),d={model:we(t),system:o,messages:r,temperature:a,providerOptions:l},c=3;for(let u=0;u<c;u++)try{let m=Date.now();k.log(`Calling LLM (${t})...`);let f=await jc(d),h=Date.now()-m,x=f,y=x.usage;k.llmCall(t,h,y);let p=x.reasoningText;p&&(k.thinking(p),i.onEvent?.({type:"thinking",text:p})),e.addAssistantMessage(f.text);let b={systemPrompt:o,userPrompt:zc(r),rawLlmResponse:f.text,reasoningContent:p,screenshotWithSom:n},E=[],T=Kc(y,t);T&&E.push(T);let A=Xc(f.text);if(!A)if(u<c-1){k.log(`Attempt ${u+1}/${c}: 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(I=>setTimeout(I,i.retryDelay||1e3));continue}else return k.error("All parsing attempts failed"),{stepOutput:null,debugInfo:b,tokenUsages:E};return{stepOutput:A,debugInfo:b,tokenUsages:E}}catch(m){if(u<c-1){k.log(`Attempt ${u+1}/${c}: LLM call failed (${m.message}), retrying...`),await new Promise(f=>setTimeout(f,i.retryDelay||1e3));continue}else throw k.error("All LLM call attempts failed",m),m}return{stepOutput:null}}function Xc(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 k.error("Missing required field: current_goal"),null;if(!i.actions||!Array.isArray(i.actions)||i.actions.length===0)return k.error("Missing required field: actions (must be non-empty array)"),null;for(let n of i.actions){if(!n.action_name)return k.error("Action missing required field: action_name"),null;if(!n.description)return k.error("Action missing required field: description"),null}return i}catch(i){return k.error(`Failed to parse LLM JSON response: ${t.substring(0,500)}`),k.error(`Parse error: ${i.message}`),null}}async function Yc(e,t,i,n,a,o,r){let s=[],l=!0,d=null;k.log(`Using pre-captured DOM state with ${i.selectorMap.size} elements for ${e.actions.length} action(s)`);let c=null,u={...t,domState:i},m=o;for(let f of e.actions){if(f.action_name==="done"){c={success:f.kwargs.success??!0,summary:f.kwargs.summary||f.kwargs.text||"Task completed"};break}let h={},x=f.kwargs?.element_index??f.kwargs?.index;if(typeof x=="number"){let p=i.selectorMap.get(x);p&&(h=await N(t.page,p))}let y={...h,action_description:f.description,action_data:{action_name:f.action_name,kwargs:f.kwargs}};try{let p=await H.execute(f.action_name,f.kwargs,u);f.action_name==="perform_accurate_operation"&&(y=p.actionEntity);let b=await u.agentServices.getCurrentPage();if(b&&(u.page=b,t.page=u.page),p?.success===!1){l=!1,k.log("Action failed, stopping execution of remaining actions in this step"),d=p.error||"Action execution failed";break}s.push(y),a?.({type:"action",action_entity:y,step:n,debugInfo:r})}catch(p){l=!1,d=p.message,k.error(`Action execution failed: ${p.message}`);break}}return{allSuccess:l,failReason:d,actionEntities:s,doneResult:c,completesInstruction:e.completes_instruction??!1}}function Jc(e,t,i,n,a,o,r){let s={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 l=t.memory.trim();n.memory.includes(l)||(n.memory.push(l),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(s),s}function qc(e,t,i){if(k.log(`Step ${e}/${t}`),i.thinking&&k.log(`Thinking: ${i.thinking}`),i.evaluation_previous_goal&&k.log(`Evaluation: ${i.evaluation_previous_goal}`),i.memory&&k.log(`Memory: ${i.memory}`),k.log(`Goal: ${i.current_goal}`),i.actions.length===1){let n=i.actions[0];k.log(`Action: ${n.action_name}(${JSON.stringify(n.kwargs)}) - ${n.description}`)}else k.log(`Actions (${i.actions.length}):`),i.actions.forEach((n,a)=>{k.log(` ${a+1}. ${n.action_name}(${JSON.stringify(n.kwargs)}) - ${n.description}`)})}function Zc(e,t,i,n,a,o,r){let s=o.reduce((c,u)=>c+u.prompt_tokens,0),l=o.reduce((c,u)=>c+u.completion_tokens,0),d=o.reduce((c,u)=>c+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(c=>c.outcome.success).length,failedSteps:e.stepHistory.filter(c=>!c.outcome.success).length,promptTokens:s,completionTokens:l,totalTokens:d,tokenUsages:o}}}function Qc(e,t,i,n,a){let o=n.reduce((l,d)=>l+d.prompt_tokens,0),r=n.reduce((l,d)=>l+d.completion_tokens,0),s=n.reduce((l,d)=>l+d.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(l=>l.outcome.success).length,failedSteps:e.stepHistory.filter(l=>!l.outcome.success).length,promptTokens:o,completionTokens:r,totalTokens:s,tokenUsages:n}}}var fr=w(()=>{"use strict";Yn();qi();xe();Ne();Q();Ie();ye();G()});var wr={};et(wr,{TaskMessageManager:()=>Zi,formatFinalStepWarning:()=>hr,formatTaskContext:()=>Yi,getBrowserTaskJSONPrompt:()=>Ji,runTaskLoop:()=>gr});var br=w(()=>{"use strict";fr();Yn();qi();xe();Ci();Ne();dt();ut();Ge();ht();mt();Q();Ie();Yt();ye();nt();at();He();G();Oe();F();Z();gt();L();ge()});async function ft(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(H.has(i)){let a=await H.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 ed()).execute(a,e,o),{success:!0,error:void 0}}}catch(i){return{success:!1,error:i.message}}}async function ed(){if(Qi)return Qi;let e=await Promise.resolve().then(()=>(Xi(),Vi));return Qi=new e.default,Qi}async function Oi(e,t,i,n={},a){let o=a||{page:t,agentServices:i,domService:new $e(i.getDomServiceOptions()),executionHistory:n.executionHistory,variables:n.variables,sensitiveKeys:n.sensitiveKeys},r=i.replaceVariables(e),s=await vn(r,o,n);return s.status==="error"?{status:"error",completed:s.goalAccomplished||!1,actionEntities:[],explanation:s.reasoning,error:s.error,debugInfo:s.debugInfo}:{status:"success",completed:s.goalAccomplished||!1,actionEntities:s.actionEntity?[s.actionEntity]:[],explanation:s.reasoning,debugInfo:s.debugInfo}}async function Ni(e,t,i,n={},a){let o=a||{page:t,agentServices:i,domService:new $e(i.getDomServiceOptions()),executionHistory:n.executionHistory,variables:n.variables,sensitiveKeys:n.sensitiveKeys},r=i.replaceVariables(e),s=await vn(r,o,n);if(s.status==="error"||!s.actionEntity)return{status:"error",completed:s.goalAccomplished||!1,actionEntities:[],explanation:s.reasoning,error:s.error||"No action generated",debugInfo:s.debugInfo};let{actionEntity:l,reasoning:d,goalAccomplished:c,debugInfo:u}=s,m=await ft(l,o);return m.success?(d&&i.addNote(d),{status:"success",completed:c||!1,actionEntities:[l],explanation:d,debugInfo:u}):{status:"error",completed:!1,actionEntities:[l],error:m.error||"Action execution failed",debugInfo:u}}async function Di(e,t,i,n={}){let a={page:t,agentServices:i,domService:new $e(i.getDomServiceOptions()),executionHistory:n.executionHistory,variables:n.variables,sensitiveKeys:n.sensitiveKeys},o=i.replaceVariables(e);return n.useCleanScreenshotForAssertion??(n.useCleanScreenshotForAssertion=i.isUseCleanScreenshotForAssertion()),Ia(o,a,n)}async function Li(e,t,i,n,a={}){let{runTaskLoop:o}=await Promise.resolve().then(()=>(br(),wr)),r=n?l=>{n(l)}:void 0,s=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:s.success?"success":"error",completed:s.completed,actionEntities:s.trajectory.actions,explanation:s.summary,error:s.error,tokenUsages:s.metadata.tokenUsages}}var Qi,wt=w(()=>{"use strict";vi();xe();Ne();Qi=null});import{z as v}from"zod";import"yaml";import"uuid";import"yaml";import"uuid";var Lr,Ix,Rr,cd,dd,tn,Px,Cx,Fr,Hr,ud,Dr,hd,Jt,md,pd,gd,te,fd,wd,Nx,Kx,qt=w(()=>{"use strict";ge();Lr=112,Ix=1080-Lr,Rr=(e=>(e.Chromium="chromium",e.Firefox="firefox",e.Webkit="webkit",e))(Rr||{}),cd={"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"}},dd={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"]},tn=(e,t=!1)=>{let i=["chromium"];return t&&i.push("webkit"),dd[e].map(n=>cd[n]).filter(n=>n.defaultBrowserType&&i.includes(n.defaultBrowserType))},Px={desktop:{label:"Desktop",type:"desktop",devices:tn("desktop")},mobile:{label:"Mobile Web",type:"mobile",devices:tn("mobile")}},Cx={desktop:{label:"Desktop",type:"desktop",devices:tn("desktop",!0)},mobile:{label:"Mobile Web",type:"mobile",devices:tn("mobile",!0)}},Fr=(e=>(e.PASSWORD="password",e.OAUTH2="oauth2",e.SSO="sso",e.API="api",e))(Fr||{}),Hr=(e=>(e.SMS="sms",e.EMAIL="email",e.TOTP="totp",e))(Hr||{}),ud=v.enum(["JS_CODE","AI_MODE"]),Dr=v.object({type:ud,expression:v.string()}),hd=v.enum(["DRAFT","STEP","ACTION","IF_ELSE","WHILE_LOOP"]),Jt=v.object({uid:v.string(),type:hd,comment:v.string().optional()}),md=v.object({action_data:v.object({action_name:v.string(),kwargs:v.record(v.any()).optional(),args:v.array(v.any()).optional()}),action_description:v.string().optional(),url:v.string().optional(),xpath:v.string().nullable().optional(),locator:v.string().nullable().optional(),css_selector:v.string().nullable().optional(),unique_selector:v.string().nullable().optional(),element_index:v.number().nullable().optional(),frame_path:v.array(v.any()).optional(),artifacts:v.record(v.any()).optional(),feedback:v.string().optional(),original_browser_use_action:v.any().optional()}).passthrough(),pd=Jt.extend({type:v.literal("DRAFT"),description:v.string()}),gd=Jt.extend({type:v.literal("ACTION"),description:v.string(),action_entity:md.optional(),locator:v.string().optional(),use_pure_vision:v.boolean().optional()}),te=v.lazy(()=>v.union([pd,gd,Jt.extend({type:v.literal("STEP"),description:v.string().optional().default(""),statements:v.array(te),reference_id:v.number().optional()}),Jt.extend({type:v.literal("IF_ELSE"),description:v.string().optional(),condition:Dr,then:v.array(te),else:v.array(te).optional()}),Jt.extend({type:v.literal("WHILE_LOOP"),description:v.string().optional(),condition:Dr,body:v.array(te),timeout_ms:v.number().optional()})])),fd=v.object({name:v.string(),statements:v.array(te),teardown:v.array(te).optional(),skip:v.union([v.boolean(),v.string()]).optional(),timeout:v.number().optional(),fail:v.union([v.boolean(),v.string()]).optional(),only:v.boolean().optional(),slow:v.boolean().optional()}),wd=v.object({tests:v.array(fd).min(1),beforeAll:v.array(te).optional(),afterAll:v.array(te).optional(),beforeEach:v.array(te).optional(),afterEach:v.array(te).optional()}),Nx=v.object({comment:v.string().optional(),version:v.string().optional(),goal:v.string().optional(),url:v.string().optional(),baseURL:v.string().optional(),final_feedback:v.string().optional(),completed:v.boolean().optional(),success:v.boolean().optional(),statements:v.array(te).optional(),teardown:v.array(te).optional(),last_modified_at:v.string().optional(),testGroup:wd.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"}),Kx=1024*1024});var Jn=w(()=>{"use strict";Q();Ie()});import{z as _}from"zod";var Br,qn,Gr,Ye,jr,Kr,zr,ee,Vr,nn,Zn,Qn=w(()=>{"use strict";Br=_.enum(["JS_CODE","AI_MODE"]),qn=_.object({type:Br,expression:_.string()}),Gr=_.enum(["DRAFT","STEP","ACTION","IF_ELSE","WHILE_LOOP"]),Ye=_.object({uid:_.string(),type:Gr,comment:_.string().optional()}),jr=_.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(),Kr=Ye.extend({type:_.literal("DRAFT"),description:_.string()}),zr=Ye.extend({type:_.literal("ACTION"),description:_.string(),action_entity:jr.optional(),locator:_.string().optional(),use_pure_vision:_.boolean().optional()}),ee=_.lazy(()=>_.union([Kr,zr,Ye.extend({type:_.literal("STEP"),description:_.string().optional().default(""),statements:_.array(ee),reference_id:_.number().optional()}),Ye.extend({type:_.literal("IF_ELSE"),description:_.string().optional(),condition:qn,then:_.array(ee),else:_.array(ee).optional()}),Ye.extend({type:_.literal("WHILE_LOOP"),description:_.string().optional(),condition:qn,body:_.array(ee),timeout_ms:_.number().optional()})])),Vr=_.object({name:_.string(),statements:_.array(ee),teardown:_.array(ee).optional(),skip:_.union([_.boolean(),_.string()]).optional(),timeout:_.number().optional(),fail:_.union([_.boolean(),_.string()]).optional(),only:_.boolean().optional(),slow:_.boolean().optional()}),nn=_.object({tests:_.array(Vr).min(1),beforeAll:_.array(ee).optional(),afterAll:_.array(ee).optional(),beforeEach:_.array(ee).optional(),afterEach:_.array(ee).optional()}),Zn=_.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(ee).optional(),teardown:_.array(ee).optional(),last_modified_at:_.string().optional(),testGroup:nn.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 Ed,parse as qr,parseAllDocuments as Ek,parseDocument as Td,Document as Ad,isMap as qe,isSeq as ce}from"yaml";import{v4 as le}from"uuid";function Zr(e,t){let i={...t?.test_case_id!==void 0?{test_case_id:t.test_case_id}:{},...t?.name?{name:t.name}:{},goal:e.goal??"",url:e.url,base_url:e.baseURL,statements:(e.statements??[]).map(ie)};return e.final_feedback&&(i.final_feedback=e.final_feedback),e.teardown&&e.teardown.length>0&&(i.teardown=e.teardown.map(ie)),i}function an(e,t){if(e.testGroup)return es(e,t);let i=Zr(e,t),n=new Ad(i);return e.comment&&(n.commentBefore=e.comment),Xr(n,e.statements??[]),e.teardown&&Xr(n,e.teardown,"teardown"),n.toString(Qr)}function Xr(e,t,i="statements"){let n=e.contents;if(!n||!qe(n))return;let a=n.get(i,!0);ce(a)&&ei(a,t)}function ei(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),qe(a)){let o=a;if(n.type==="STEP"){let r=o.get("statements",!0);ce(r)&&ei(r,n.statements)}else if(n.type==="IF_ELSE"){let r=o.get("THEN",!0);ce(r)&&ei(r,n.then);let s=o.get("ELSE",!0);ce(s)&&n.else&&ei(s,n.else)}else if(n.type==="WHILE_LOOP"){let r=o.get("DO",!0);ce(r)&&ei(r,n.body)}}}}function es(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);let a={};return e.baseURL&&(a.base_url=e.baseURL),i.beforeAll&&i.beforeAll.length>0&&(a.beforeAll=i.beforeAll.map(ie)),i.beforeEach&&i.beforeEach.length>0&&(a.beforeEach=i.beforeEach.map(ie)),i.afterEach&&i.afterEach.length>0&&(a.afterEach=i.afterEach.map(ie)),i.afterAll&&i.afterAll.length>0&&(a.afterAll=i.afterAll.map(ie)),a.tests=i.tests.map(o=>{let r={name:o.name};return o.skip!==void 0&&(r.skip=o.skip),o.timeout!==void 0&&(r.timeout=o.timeout),o.fail!==void 0&&(r.fail=o.fail),o.only!==void 0&&(r.only=o.only),o.slow!==void 0&&(r.slow=o.slow),r.statements=o.statements.map(ie),o.teardown&&o.teardown.length>0&&(r.teardown=o.teardown.map(ie)),r}),n.suite=a,Ed(n,Qr)}function ie(e){switch(e.type){case"DRAFT":return $d(e);case"ACTION":return Md(e);case"STEP":return Id(e);case"IF_ELSE":return Pd(e);case"WHILE_LOOP":return Cd(e)}}function $d(e){return{intent:e.description}}function Md(e){let t=e.action_entity?.action_data?.action_name??e.action_entity?.action?.action_name,i=e.action_entity?.action_data?.kwargs??e.action_entity?.action?.kwargs;if(t==="verify"){let s=i?.statement;if(typeof s=="string"&&!e.action_entity?.locator&&!e.action_entity?.xpath){let l=i?.code;return typeof l=="string"?{VERIFY:s,js:l}:{VERIFY:s}}}if(t==="go_to_url"){let s=i?.url;if(typeof s=="string"&&!e.action_entity?.locator&&!e.action_entity?.xpath){let l={URL:s};return i?.new_tab===!0&&(l.new_tab=!0),typeof i?.timeout_seconds=="number"&&(l.timeout_seconds=i.timeout_seconds),l}}if(t==="js_action"){let s=i?.code;if(typeof s=="string"&&e.description)return{intent:e.description,js:s}}if(t==="ai_wait_until"){let s=i?.condition;if(typeof s=="string"){let l={WAIT_UNTIL:s};return typeof i?.timeout_seconds=="number"&&i.timeout_seconds!==60&&(l.timeout_seconds=i.timeout_seconds),l}}if(t==="wait"){let s=i?.seconds,d={WAIT:e.description||`Wait ${s}s`};return typeof s=="number"&&(d.seconds=s),d}if(t==="js_code"){let s=i?.code;if(typeof s=="string"&&!e.action_entity?.locator&&!e.action_entity?.xpath)return{CODE:s}}if(!e.action_entity)return{intent:e.description};let n=e.action_entity.action_data??e.action_entity.action;if(!n)return{intent:e.description};let 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[s,l]of Object.entries(n.kwargs))a[s]=l;return n.args&&n.args.length>0&&(a.args=n.args),a}function Id(e){let t={STEP:e.description,statements:e.statements.map(ie)};return e.reference_id!==void 0&&(t.reference_id=e.reference_id),t}function Pd(e){let t={IF:ts(e.condition),THEN:e.then.map(ie)};return e.else&&e.else.length>0&&(t.ELSE=e.else.map(ie)),t}function Cd(e){let t={WHILE:ts(e.condition),DO:e.body.map(ie)};return e.timeout_ms!==void 0&&(t.timeout_ms=e.timeout_ms),t}function ts(e){return e.type==="JS_CODE"?`js:${e.expression}`:e.expression}function ta(e){try{let t=qr(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()),i}catch{return{}}}function ea(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(ea);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]=ea(o);return n}function ke(e){if(e.length>Yr)throw new Error(`YAML input too large (${e.length} bytes, max ${Yr})`);let t=ea(qr(e));if(!t||typeof t!="object")throw new Error("Invalid YAML: expected an object at root level");if(t.suite)return Od(t);let i={version:"1.3.0",goal:t.goal,url:t.url,baseURL:t.base_url,statements:ne(t.statements??[])};t.final_feedback&&(i.final_feedback=t.final_feedback),t.teardown&&Array.isArray(t.teardown)&&(i.teardown=ne(t.teardown));let n=Zn.safeParse(i);if(!n.success)throw new Error(`Invalid TestFlow after YAML conversion: ${JSON.stringify(n.error.errors)}`);let a=n.data;return on(e,a),a}function Od(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(s=>{if(!s.name)throw new Error('Each test in a suite must have a "name" field');if(!Array.isArray(s.statements)||s.statements.length===0)throw new Error(`Suite test "${s.name}" must have a non-empty "statements" array`);let l={name:s.name,statements:ne(s.statements)};return Array.isArray(s.teardown)&&s.teardown.length>0&&(l.teardown=ne(s.teardown)),s.skip!==void 0&&(l.skip=s.skip),typeof s.timeout=="number"&&(l.timeout=s.timeout),s.fail!==void 0&&(l.fail=s.fail),s.only===!0&&(l.only=!0),s.slow===!0&&(l.slow=!0),l})};Array.isArray(t.beforeAll)&&t.beforeAll.length>0&&(a.beforeAll=ne(t.beforeAll)),Array.isArray(t.afterAll)&&t.afterAll.length>0&&(a.afterAll=ne(t.afterAll)),Array.isArray(t.beforeEach)&&t.beforeEach.length>0&&(a.beforeEach=ne(t.beforeEach)),Array.isArray(t.afterEach)&&t.afterEach.length>0&&(a.afterEach=ne(t.afterEach));let o=nn.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 ne(e){if(!Array.isArray(e))throw new Error("Expected an array of statements");return e.map(Nd)}function Nd(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 Dd(t);if("WHILE"in t)return Ld(t);if("STEP"in t)return Rd(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:le(),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:le(),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:le(),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:le(),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.');return{uid:le(),type:"ACTION",description:"Code block",action_entity:{action_description:"Code block",action_data:{action_name:"js_code",kwargs:{code:typeof i=="string"?i:String(i)}}}}}if("js"in t&&("intent"in t||"desc"in t)&&!("VERIFY"in t)){let i=t.js,n=typeof t.intent=="string"?t.intent:typeof t.desc=="string"?t.desc:"";return{uid:le(),type:"ACTION",description:n,action_entity:{action_description:n,action_data:{action_name:"js_action",kwargs:{code:typeof i=="string"?i:String(i)}}}}}if("call"in t&&typeof t.call=="string"){let{call:i,...n}=t;return Jr({...n,action:"function",functionName:i})}if("action"in t)return Jr(t);if("intent"in t&&typeof t.intent=="string"||"desc"in t&&typeof t.desc=="string")return{uid:le(),type:"DRAFT",description:typeof t.intent=="string"?t.intent:t.desc};throw new Error(`Cannot infer statement type from object: ${JSON.stringify(t)}`)}function is(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 Dd(e){let t=is(e.IF),i=e.THEN;if(!Array.isArray(i))throw new Error("IF_ELSE requires a THEN array");let n={uid:le(),type:"IF_ELSE",condition:t,then:ne(i)};return"ELSE"in e&&Array.isArray(e.ELSE)&&(n.else=ne(e.ELSE)),n}function Ld(e){let t=is(e.WHILE),i=e.DO;if(!Array.isArray(i))throw new Error("WHILE_LOOP requires a DO array");let n={uid:le(),type:"WHILE_LOOP",condition:t,body:ne(i)};return typeof e.timeout_ms=="number"&&(n.timeout_ms=e.timeout_ms),n}function Rd(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:le(),type:"STEP",description:t,statements:ne(e.statements)};return typeof e.reference_id=="number"&&(i.reference_id=e.reference_id),i}function Jr(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[d,c]of Object.entries(e))Fd.has(d)||(r[d]=c);let s={action_description:i,action_data:{action_name:t,kwargs:Object.keys(r).length>0?r:{}}};n&&(s.locator=n),a&&(s.xpath=a);let l={uid:le(),type:"ACTION",description:i,action_entity:s};return o&&(l.use_pure_vision=!0),l}function on(e,t){let i;try{i=Td(e)}catch{return}let n=i.contents;if(!n||!qe(n))return;if(i.commentBefore)t.comment=i.commentBefore;else{let l=n.items?.[0];l?.key&&l.key.commentBefore&&(t.comment=l.key.commentBefore)}let a=n,o=a.get("statements",!0);ce(o)&&t.statements&&Je(o,t.statements);let r=a.get("teardown",!0);ce(r)&&t.teardown&&Je(r,t.teardown)}function Je(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"&&qe(n)){let o=n.get("statements",!0);ce(o)&&Je(o,a.statements)}else if(a.type==="IF_ELSE"&&qe(n)){let o=n.get("THEN",!0);ce(o)&&Je(o,a.then);let r=n.get("ELSE",!0);ce(r)&&a.else&&Je(r,a.else)}else if(a.type==="WHILE_LOOP"&&qe(n)){let o=n.get("DO",!0);ce(o)&&Je(o,a.body)}}}var Qr,Yr,Fd,rn=w(()=>{"use strict";Qn();Qr={lineWidth:120,defaultKeyType:"PLAIN",defaultStringType:"PLAIN"};Yr=1024*1024;Fd=new Set(["action","intent","desc","locator","xpath","use_pure_vision"])});import{parse as Ik,stringify as Pk}from"yaml";var ns=w(()=>{"use strict";rn()});var sn=w(()=>{"use strict"});var as=w(()=>{"use strict";rn();sn()});var os=w(()=>{"use strict";sn()});import{v4 as Wk}from"uuid";var rs=w(()=>{"use strict"});var De,ss=w(()=>{"use strict";De=(e=>(e.DRAFT="DRAFT",e.STEP="STEP",e.ACTION="ACTION",e.IF_ELSE="IF_ELSE",e.WHILE_LOOP="WHILE_LOOP",e))(De||{})});var ln=w(()=>{"use strict"});var ls=w(()=>{"use strict";ln()});var cs,Bd,ds,us,ti,Gd,jd,hs=w(()=>{"use strict";cs=112,Bd=1080-cs,ds={"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"}},us={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"]},ti=(e,t=!1)=>{let i=["chromium"];return t&&i.push("webkit"),us[e].map(n=>ds[n]).filter(n=>n.defaultBrowserType&&i.includes(n.defaultBrowserType))},Gd={desktop:{label:"Desktop",type:"desktop",devices:ti("desktop")},mobile:{label:"Mobile Web",type:"mobile",devices:ti("mobile")}},jd={desktop:{label:"Desktop",type:"desktop",devices:ti("desktop",!0)},mobile:{label:"Mobile Web",type:"mobile",devices:ti("mobile",!0)}}});var ms=w(()=>{"use strict"});var ps=w(()=>{"use strict"});var gs=w(()=>{"use strict"});var fs=w(()=>{"use strict"});var ws=w(()=>{"use strict"});var bs=w(()=>{"use strict"});var ys=w(()=>{"use strict"});var xs=w(()=>{"use strict";ln()});var Ze=w(()=>{"use strict";ns();as();rn();Qn();os();rs();sn();ss();ls();hs();ms();ps();gs();fs();ws();bs();ys();xs();ln()});import{stringify as rT}from"yaml";import{createHash as Jd}from"crypto";import{parse as qd,stringify as Ts}from"yaml";import{readFileSync as Zd}from"fs";import{resolve as As,dirname as Qd}from"path";import{parse as _s,stringify as eu}from"yaml";function Xd(e){let t=e.frame_path;return!t||t.length===0?"page":`page.frameLocator('${t[0]}')`}function Yd(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 Es(e){let t=Xd(e),i=e.locator;if(typeof i=="string"&&i.trim())return i=i.trim(),i.endsWith("first()")?`${t}.${i}`:`${t}.${i}.first()`;let n=Yd(e);if(n){let a=JSON.stringify(n);return`${t}.locator(${a}).first()`}return null}function $(e,t){q.set(e,t)}function Le(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 vs(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 $s(e,t){let i={expandingPaths:new Set([As(t)]),depth:0,referencedPaths:new Set},n={...e};Array.isArray(n.statements)&&(n.statements=Pe(n.statements,t,i)),Array.isArray(n.teardown)&&(n.teardown=Pe(n.teardown,t,i));for(let a of["beforeAll","afterAll","beforeEach","afterEach"])Array.isArray(n[a])&&(n[a]=Pe(n[a],t,i));return{doc:n,referencedTemplatePaths:Array.from(i.referencedPaths)}}function Pe(e,t,i){let n=[];for(let a of e)if(tu(a)){let o=iu(a,t,i);n.push(...o)}else n.push(nu(a,t,i));return n}function tu(e){return typeof e=="object"&&e!==null&&typeof e.template=="string"}function iu(e,t,i){if(i.depth>=ks)throw new Error(`Template expansion exceeded maximum depth of ${ks}. Check for deeply nested or circular template references.`);let n=As(Qd(t),e.template);if(i.expandingPaths.has(n))throw new Error(`Circular template reference detected: ${n} is already being expanded. Stack: ${Array.from(i.expandingPaths).join(" \u2192 ")} \u2192 ${n}`);i.referencedPaths.add(n);let a;try{a=Zd(n,"utf-8")}catch(c){throw new Error(`Failed to read template file: ${n} (referenced from ${t}): ${c.message}`)}let o=_s(a);if(!o||typeof o!="object")throw new Error(`Invalid template file: ${n} \u2014 expected a YAML object`);let r=o.params||[],s=e.params||{};for(let c of r)if(!(c in s))throw new Error(`Template ${e.template} requires param "${c}" but it was not provided. Required params: [${r.join(", ")}]`);let l=o.statements;if(!Array.isArray(l))throw new Error(`Template ${e.template} must have a "statements" array`);if(Object.keys(s).length>0){let u=eu(l);for(let[m,f]of Object.entries(s))u=u.split(`<<${m}>>`).join(String(f));l=_s(u)}let d={expandingPaths:new Set([...i.expandingPaths,n]),depth:i.depth+1,referencedPaths:i.referencedPaths};return Pe(l,n,d)}function nu(e,t,i){if(typeof e!="object"||e===null)return e;let n={...e};return Array.isArray(n.statements)&&(n.statements=Pe(n.statements,t,i)),Array.isArray(n.THEN)&&(n.THEN=Pe(n.THEN,t,i)),Array.isArray(n.ELSE)&&(n.ELSE=Pe(n.ELSE,t,i)),Array.isArray(n.DO)&&(n.DO=Pe(n.DO,t,i)),n}function Is(e,t){let i=qd(e),n=i?.name,a=i?.tags,o=i?.use;if(i&&(i.name!==void 0||i.tags!==void 0||i.use!==void 0)&&(delete i.name,delete i.tags,delete i.use),i?.suite){if(i.goal||i.statements)throw new Ms('YAML file cannot have both "suite" and top-level "goal"/"statements". Use either suite format or single-test format.');return ou(i,n,a,o,t)}return au(i,n,a,o,t)}function au(e,t,i,n,a){let o=e?.beforeEach,r=e?.afterEach,s=Ps(e?.parameters),l=e?.timeout,d=e?.skip,c=e?.fail,u=e?.only,m=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 Ms(`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 y=$s(e,a);e=y.doc,f=y.referencedTemplatePaths}let h=Ts(e),x=ke(h);return a&&(Qe(x.statements??[],a,"main"),x.teardown&&Qe(x.teardown,a,"teardown")),{testFlow:x,name:t,tags:i,use:n,beforeEach:o,afterEach:r,parameters:s,timeout:l,skip:d,fail:c,only:u,slow:m,referencedTemplatePaths:f}}function ou(e,t,i,n,a){let o=e.suite;if(!Array.isArray(o.tests)||o.tests.length===0)throw new Error('Suite must have a non-empty "tests" array.');let r=o.beforeAll,s=o.afterAll,l=o.beforeEach,d=o.afterEach,c=[],u=o.tests.map(h=>{if(!h.name)throw new Error('Each test in a suite must have a "name" field.');if(!Array.isArray(h.statements)||h.statements.length===0)throw new Error(`Suite test "${h.name}" must have a non-empty "statements" array.`);let x={goal:h.name,statements:h.statements};h.teardown&&(x.teardown=h.teardown);let y=[],p=x;if(a&&typeof x=="object"){let A=$s(x,a);p=A.doc,y=A.referencedTemplatePaths,c.push(...y)}let b=Ts(p),E=ke(b),T=Ps(h.parameters);return{testFlow:E,name:h.name,tags:Array.isArray(h.tags)?h.tags:void 0,parameters:T,timeout:h.timeout,skip:h.skip,fail:h.fail,only:h.only,slow:h.slow}}),m=o.base_url,f=m?{...n,baseURL:m}:n;return{suite:{beforeAll:r,afterAll:s,beforeEach:l,afterEach:d,tests:u},name:t,tags:i,use:f,referencedTemplatePaths:c}}function Ps(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 Qe(e,t,i){for(let n=0;n<e.length;n++){let a=e[n],o=`${i}.${n}`,r=a.description||"";if(a.uid=ru(t,o,r),a.type===De.STEP)Qe(a.statements,t,o);else if(a.type===De.IF_ELSE){let s=a;Qe(s.then,t,`${o}.then`),s.else&&Qe(s.else,t,`${o}.else`)}else a.type===De.WHILE_LOOP&&Qe(a.body,t,`${o}.body`)}}function ru(e,t,i){let n=Jd("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 Ss,q,ks,Ms,Cs=w(()=>{"use strict";Ze();Ze();Ze();Ze();Ss=5e3;q=new Map;$("click",e=>{let t=Es(e);if(!t)return['await agent.execAction("click", page, {});'];let i=e.action_data?.kwargs?.timeout_ms??Ss;return[`await ${t}.click({ timeout: ${i} });`]});$("click_element",q.get("click"));$("click_element_by_index",q.get("click"));$("double_click",e=>Le("double_click",e));$("double_click_on_element",q.get("double_click"));$("right_click",e=>Le("right_click",e));$("right_click_on_element",q.get("right_click"));$("hover",e=>Le("hover",e));$("hover_element_by_index",q.get("hover"));$("input_text",e=>{let t=e.action_data?.kwargs?.text??e.action_data?.kwargs?.value??"";return Le("input_text",e,[`action_data: { kwargs: { text: ${JSON.stringify(t)} } }`])});$("fill",q.get("input_text"));$("clear_input",e=>Le("clear_input",e));$("press",e=>{let t=e.action_data?.kwargs?.keys;return[`await page.keyboard.press(${JSON.stringify(t)});`]});$("send_keys",q.get("press"));$("send_keys_on_element",e=>{let t=Es(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??Ss;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 Le("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",q.get("scroll"));$("scroll_up",q.get("scroll"));$("scroll_element",q.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=>Le("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",q.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(`
4303
+ `,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 Yt=w(()=>{"use strict"});async function Gc(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"],s=u=>{let m=u.toLowerCase();return m.startsWith("data:")||m.startsWith("blob:")?!0:r.some(f=>m.includes(f))},l=u=>{let m=u.resourceType(),f=u.url();if(!a.has(m)||s(f))return;let h=u.headers();h.purpose==="prefetch"||["video","audio"].includes(h["sec-fetch-dest"])||(i.add(u),n=Date.now())},d=async u=>{let m=u.request();if(!i.has(m))return;let f=(u.headers()["content-type"]||"").toLowerCase();if(["streaming","video","audio","webm","mp4","event-stream","websocket","protobuf"].some(x=>f.includes(x))){i.delete(m);return}if(![...o].some(x=>f.startsWith(x))){i.delete(m);return}let h=u.headers()["content-length"];if(h)try{if(parseInt(h,10)>5*1024*1024){i.delete(m);return}}catch{}i.delete(m),n=Date.now()},c=Date.now()-Bc;for(let u of await e.requests()){let m=u.resourceType(),f=u.url(),h=u.timing();a.has(m)&&!s(f)&&h.responseEnd===-1&&h.startTime>=c&&(i.add(u),n=Date.now())}g.debug(`[waitForStableNetwork] Pre-populated ${i.size} in-flight requests`),e.on("request",l),e.on("response",d);try{let u=Date.now(),m=Uc;for(;;){await new Promise(h=>setTimeout(h,100));let f=Date.now();if(i.size===0&&f-n>=m){g.debug(`[waitForStableNetwork] Network idle after ${f-u}ms`);break}if(f-u>t){g.debug(`[waitForStableNetwork] Max wait time exceeded (${t}ms), pending: ${i.size}`);break}}}finally{e.removeListener("request",l),e.removeListener("response",d)}}async function Ve(e,t=Wc,i=Hc){let n=Date.now();try{await Promise.all([e.waitForLoadState("load",{timeout:t}).catch(()=>{}),Gc(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 Hc,Wc,Uc,Bc,Ie=w(()=>{"use strict";Yt();F();Hc=.5*1e3,Wc=30*1e3,Uc=1*1e3,Bc=3*1e3});import{generateText as jc}from"ai";function Kc(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 gr(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(),s=t.domService||new $e(t.agentServices.getDomServiceOptions()),l={...t,domService:s};k.init(),k.section("Task Execution Started"),k.log(`Task: ${e}`),k.log(`Max steps: ${a}`),k.log(`Model: ${r}`);let d={currentStep:0,maxSteps:a,consecutiveFailures:0,maxFailures:o,lastFailReason:null,stepHistory:[],memory:[],lastGoal:null,lastEvaluation:null},c=[],u=Ji(i.customPrompt),m=new Zi(u);k.log(`System prompt length: ${u.length} chars`);let f=!1,h="",x=[];try{for(i.onEvent?.({type:"start",task:e,maxSteps:a});d.currentStep<a;){if(i.abortSignal?.aborted)throw new Error("Task aborted by user");d.currentStep++;let y=Date.now();k.section(`Step ${d.currentStep}/${a}`),k.log(`URL: ${l.page.url()}`),i.onEvent?.({type:"step_start",step:d.currentStep});try{k.log("Waiting for page to stabilize..."),await Ve(l.page),k.log("Page stabilized")}catch{k.log("Page stabilization timed out, continuing anyway")}let p;try{k.log("Preparing context (DOM + screenshot)...");let D=l.agentServices.getInteractiveClassNames(),R=l.agentServices.getIframeFallbackDomains();p=await pr(l.page,l.domService,D,R),k.log("Context prepared")}catch(D){if(D.message.includes("Execution context was destroyed")){k.log("Page navigating, waiting for load..."),await Ve(l.page);let R=l.agentServices.getInteractiveClassNames(),O=l.agentServices.getIframeFallbackDomains();p=await pr(l.page,l.domService,R,O)}else throw k.error("Error preparing context",D),D}m.addStateMessage(e,p.currentUrl,p.domTree,p.screenshotBase64,d,{isFinalStep:d.currentStep===a-1,placeholderData:t.variables,sensitiveKeys:t.sensitiveKeys});let b=await Vc(m,r,i,p.screenshotBase64);if(b.tokenUsages&&b.tokenUsages.length>0&&c.push(...b.tokenUsages),!b.stepOutput){if(k.error("Failed to get valid LLM response"),d.consecutiveFailures++,d.consecutiveFailures>=o){h="Reached the maximum allowed consecutive failures. Most recent error: Unable to get a valid response from the language model.";break}continue}let E=b.stepOutput;qc(d.currentStep,a,E);let T=await Yc(E,l,p.domState,d.currentStep,i.onEvent,p.screenshotBase64,b.debugInfo);x.push(...T.actionEntities);let A=Jc(d.currentStep,E,T,d,y,b.debugInfo,b.tokenUsages),I=Date.now()-y;if(i.onEvent?.({type:"step_complete",step:d.currentStep,duration:I}),d.consecutiveFailures>=o){k.error(`Too many consecutive failures (${d.consecutiveFailures}), stopping`),h=`Reached the maximum allowed consecutive failures. Most recent error: ${d.lastFailReason}`;break}if(T.doneResult){f=T.doneResult.success,h=T.doneResult.summary;break}if(T.completesInstruction){f=!0,h="Instruction completed";break}}return d.currentStep>=a&&!f&&(h="Reached the maximum allowed steps."),i.onEvent?.({type:"complete",totalSteps:d.currentStep,duration:Date.now()-n}),k.log(`Build success result: summary=${h}, completed=${f}, actions=${x.length}, tokens=${c.length}`),Zc(d,x,f,h,n,c,r)}catch(y){let p=y.message;return k.error(`Task execution failed: ${p}`,y),i.onEvent?.({type:"error",error:p,recoverable:!1}),Qc(d,p,n,c,r)}}async function pr(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 zc(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 Vc(e,t,i,n){let a=i.temperature??0,{system:o,messages:r}=e.getMessages(),s=0;for(let u of r)Array.isArray(u.content)&&(s+=u.content.filter(m=>m.type==="image").length);let l=be(t,s),d={model:we(t),system:o,messages:r,temperature:a,providerOptions:l},c=3;for(let u=0;u<c;u++)try{let m=Date.now();k.log(`Calling LLM (${t})...`);let f=await jc(d),h=Date.now()-m,x=f,y=x.usage;k.llmCall(t,h,y);let p=x.reasoningText;p&&(k.thinking(p),i.onEvent?.({type:"thinking",text:p})),e.addAssistantMessage(f.text);let b={systemPrompt:o,userPrompt:zc(r),rawLlmResponse:f.text,reasoningContent:p,screenshotWithSom:n},E=[],T=Kc(y,t);T&&E.push(T);let A=Xc(f.text);if(!A)if(u<c-1){k.log(`Attempt ${u+1}/${c}: 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(I=>setTimeout(I,i.retryDelay||1e3));continue}else return k.error("All parsing attempts failed"),{stepOutput:null,debugInfo:b,tokenUsages:E};return{stepOutput:A,debugInfo:b,tokenUsages:E}}catch(m){if(u<c-1){k.log(`Attempt ${u+1}/${c}: LLM call failed (${m.message}), retrying...`),await new Promise(f=>setTimeout(f,i.retryDelay||1e3));continue}else throw k.error("All LLM call attempts failed",m),m}return{stepOutput:null}}function Xc(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 k.error("Missing required field: current_goal"),null;if(!i.actions||!Array.isArray(i.actions)||i.actions.length===0)return k.error("Missing required field: actions (must be non-empty array)"),null;for(let n of i.actions){if(!n.action_name)return k.error("Action missing required field: action_name"),null;if(!n.description)return k.error("Action missing required field: description"),null}return i}catch(i){return k.error(`Failed to parse LLM JSON response: ${t.substring(0,500)}`),k.error(`Parse error: ${i.message}`),null}}async function Yc(e,t,i,n,a,o,r){let s=[],l=!0,d=null;k.log(`Using pre-captured DOM state with ${i.selectorMap.size} elements for ${e.actions.length} action(s)`);let c=null,u={...t,domState:i},m=o;for(let f of e.actions){if(f.action_name==="done"){c={success:f.kwargs.success??!0,summary:f.kwargs.summary||f.kwargs.text||"Task completed"};break}let h={},x=f.kwargs?.element_index??f.kwargs?.index;if(typeof x=="number"){let p=i.selectorMap.get(x);p&&(h=await N(t.page,p))}let y={...h,action_description:f.description,action_data:{action_name:f.action_name,kwargs:f.kwargs}};try{let p=await H.execute(f.action_name,f.kwargs,u);f.action_name==="perform_accurate_operation"&&(y=p.actionEntity);let b=await u.agentServices.getCurrentPage();if(b&&(u.page=b,t.page=u.page),p?.success===!1){l=!1,k.log("Action failed, stopping execution of remaining actions in this step"),d=p.error||"Action execution failed";break}s.push(y),a?.({type:"action",action_entity:y,step:n,debugInfo:r})}catch(p){l=!1,d=p.message,k.error(`Action execution failed: ${p.message}`);break}}return{allSuccess:l,failReason:d,actionEntities:s,doneResult:c,completesInstruction:e.completes_instruction??!1}}function Jc(e,t,i,n,a,o,r){let s={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 l=t.memory.trim();n.memory.includes(l)||(n.memory.push(l),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(s),s}function qc(e,t,i){if(k.log(`Step ${e}/${t}`),i.thinking&&k.log(`Thinking: ${i.thinking}`),i.evaluation_previous_goal&&k.log(`Evaluation: ${i.evaluation_previous_goal}`),i.memory&&k.log(`Memory: ${i.memory}`),k.log(`Goal: ${i.current_goal}`),i.actions.length===1){let n=i.actions[0];k.log(`Action: ${n.action_name}(${JSON.stringify(n.kwargs)}) - ${n.description}`)}else k.log(`Actions (${i.actions.length}):`),i.actions.forEach((n,a)=>{k.log(` ${a+1}. ${n.action_name}(${JSON.stringify(n.kwargs)}) - ${n.description}`)})}function Zc(e,t,i,n,a,o,r){let s=o.reduce((c,u)=>c+u.prompt_tokens,0),l=o.reduce((c,u)=>c+u.completion_tokens,0),d=o.reduce((c,u)=>c+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(c=>c.outcome.success).length,failedSteps:e.stepHistory.filter(c=>!c.outcome.success).length,promptTokens:s,completionTokens:l,totalTokens:d,tokenUsages:o}}}function Qc(e,t,i,n,a){let o=n.reduce((l,d)=>l+d.prompt_tokens,0),r=n.reduce((l,d)=>l+d.completion_tokens,0),s=n.reduce((l,d)=>l+d.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(l=>l.outcome.success).length,failedSteps:e.stepHistory.filter(l=>!l.outcome.success).length,promptTokens:o,completionTokens:r,totalTokens:s,tokenUsages:n}}}var fr=w(()=>{"use strict";Yn();qi();xe();Ne();Q();Ie();ye();G()});var wr={};et(wr,{TaskMessageManager:()=>Zi,formatFinalStepWarning:()=>hr,formatTaskContext:()=>Yi,getBrowserTaskJSONPrompt:()=>Ji,runTaskLoop:()=>gr});var br=w(()=>{"use strict";fr();Yn();qi();xe();Ci();Ne();dt();ut();Ge();ht();mt();Q();Ie();Yt();ye();nt();at();He();G();Oe();F();Z();gt();L();ge()});async function ft(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(H.has(i)){let a=await H.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 ed()).execute(a,e,o),{success:!0,error:void 0}}}catch(i){return{success:!1,error:i.message}}}async function ed(){if(Qi)return Qi;let e=await Promise.resolve().then(()=>(Xi(),Vi));return Qi=new e.default,Qi}async function Oi(e,t,i,n={},a){let o=a||{page:t,agentServices:i,domService:new $e(i.getDomServiceOptions()),executionHistory:n.executionHistory,variables:n.variables,sensitiveKeys:n.sensitiveKeys},r=i.replaceVariables(e),s=await vn(r,o,n);return s.status==="error"?{status:"error",completed:s.goalAccomplished||!1,actionEntities:[],explanation:s.reasoning,error:s.error,debugInfo:s.debugInfo}:{status:"success",completed:s.goalAccomplished||!1,actionEntities:s.actionEntity?[s.actionEntity]:[],explanation:s.reasoning,debugInfo:s.debugInfo}}async function Ni(e,t,i,n={},a){let o=a||{page:t,agentServices:i,domService:new $e(i.getDomServiceOptions()),executionHistory:n.executionHistory,variables:n.variables,sensitiveKeys:n.sensitiveKeys},r=i.replaceVariables(e),s=await vn(r,o,n);if(s.status==="error"||!s.actionEntity)return{status:"error",completed:s.goalAccomplished||!1,actionEntities:[],explanation:s.reasoning,error:s.error||"No action generated",debugInfo:s.debugInfo};let{actionEntity:l,reasoning:d,goalAccomplished:c,debugInfo:u}=s,m=await ft(l,o);return m.success?(d&&i.addNote(d),{status:"success",completed:c||!1,actionEntities:[l],explanation:d,debugInfo:u}):{status:"error",completed:!1,actionEntities:[l],error:m.error||"Action execution failed",debugInfo:u}}async function Di(e,t,i,n={}){let a={page:t,agentServices:i,domService:new $e(i.getDomServiceOptions()),executionHistory:n.executionHistory,variables:n.variables,sensitiveKeys:n.sensitiveKeys},o=i.replaceVariables(e);return n.useCleanScreenshotForAssertion??(n.useCleanScreenshotForAssertion=i.isUseCleanScreenshotForAssertion()),Ia(o,a,n)}async function Li(e,t,i,n,a={}){let{runTaskLoop:o}=await Promise.resolve().then(()=>(br(),wr)),r=n?l=>{n(l)}:void 0,s=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:s.success?"success":"error",completed:s.completed,actionEntities:s.trajectory.actions,explanation:s.summary,error:s.error,tokenUsages:s.metadata.tokenUsages}}var Qi,wt=w(()=>{"use strict";vi();xe();Ne();Qi=null});import"uuid";import{z as v}from"zod";import"yaml";import"uuid";import"yaml";var Lr,Ix,Rr,cd,dd,tn,Px,Cx,Fr,Hr,ud,Dr,hd,Jt,md,pd,gd,te,fd,wd,Lx,Vx,qt=w(()=>{"use strict";ge();Lr=112,Ix=1080-Lr,Rr=(e=>(e.Chromium="chromium",e.Firefox="firefox",e.Webkit="webkit",e))(Rr||{}),cd={"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"}},dd={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"]},tn=(e,t=!1)=>{let i=["chromium"];return t&&i.push("webkit"),dd[e].map(n=>cd[n]).filter(n=>n.defaultBrowserType&&i.includes(n.defaultBrowserType))},Px={desktop:{label:"Desktop",type:"desktop",devices:tn("desktop")},mobile:{label:"Mobile Web",type:"mobile",devices:tn("mobile")}},Cx={desktop:{label:"Desktop",type:"desktop",devices:tn("desktop",!0)},mobile:{label:"Mobile Web",type:"mobile",devices:tn("mobile",!0)}},Fr=(e=>(e.PASSWORD="password",e.OAUTH2="oauth2",e.SSO="sso",e.API="api",e))(Fr||{}),Hr=(e=>(e.SMS="sms",e.EMAIL="email",e.TOTP="totp",e))(Hr||{}),ud=v.enum(["JS_CODE","AI_MODE"]),Dr=v.object({type:ud,expression:v.string()}),hd=v.enum(["DRAFT","STEP","ACTION","IF_ELSE","WHILE_LOOP"]),Jt=v.object({uid:v.string(),type:hd,comment:v.string().optional()}),md=v.object({action_data:v.object({action_name:v.string(),kwargs:v.record(v.any()).optional(),args:v.array(v.any()).optional()}),action_description:v.string().optional(),url:v.string().optional(),xpath:v.string().nullable().optional(),locator:v.string().nullable().optional(),css_selector:v.string().nullable().optional(),unique_selector:v.string().nullable().optional(),element_index:v.number().nullable().optional(),frame_path:v.array(v.any()).optional(),artifacts:v.record(v.any()).optional(),feedback:v.string().optional(),original_browser_use_action:v.any().optional()}).passthrough(),pd=Jt.extend({type:v.literal("DRAFT"),description:v.string()}),gd=Jt.extend({type:v.literal("ACTION"),description:v.string(),action_entity:md.optional(),locator:v.string().optional(),use_pure_vision:v.boolean().optional()}),te=v.lazy(()=>v.union([pd,gd,Jt.extend({type:v.literal("STEP"),description:v.string().optional().default(""),statements:v.array(te),reference_id:v.number().optional()}),Jt.extend({type:v.literal("IF_ELSE"),description:v.string().optional(),condition:Dr,then:v.array(te),else:v.array(te).optional()}),Jt.extend({type:v.literal("WHILE_LOOP"),description:v.string().optional(),condition:Dr,body:v.array(te),timeout_ms:v.number().optional()})])),fd=v.object({name:v.string(),statements:v.array(te),teardown:v.array(te).optional(),skip:v.union([v.boolean(),v.string()]).optional(),timeout:v.number().optional(),fail:v.union([v.boolean(),v.string()]).optional(),only:v.boolean().optional(),slow:v.boolean().optional()}),wd=v.object({tests:v.array(fd).min(1),beforeAll:v.array(te).optional(),afterAll:v.array(te).optional(),beforeEach:v.array(te).optional(),afterEach:v.array(te).optional()}),Lx=v.object({comment:v.string().optional(),version:v.string().optional(),goal:v.string().optional(),url:v.string().optional(),baseURL:v.string().optional(),final_feedback:v.string().optional(),completed:v.boolean().optional(),success:v.boolean().optional(),statements:v.array(te).optional(),teardown:v.array(te).optional(),last_modified_at:v.string().optional(),testGroup:wd.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"}),Vx=1024*1024});var Jn=w(()=>{"use strict";Q();Ie()});var Br=w(()=>{"use strict"});var Gr=w(()=>{"use strict"});var jr=w(()=>{"use strict"});import{v4 as Ek}from"uuid";var Kr=w(()=>{"use strict"});import{z as _}from"zod";var zr,qn,Vr,Ye,Xr,Yr,Jr,ee,qr,nn,Zn,Qn=w(()=>{"use strict";zr=_.enum(["JS_CODE","AI_MODE"]),qn=_.object({type:zr,expression:_.string()}),Vr=_.enum(["DRAFT","STEP","ACTION","IF_ELSE","WHILE_LOOP"]),Ye=_.object({uid:_.string(),type:Vr,comment:_.string().optional()}),Xr=_.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(),Yr=Ye.extend({type:_.literal("DRAFT"),description:_.string()}),Jr=Ye.extend({type:_.literal("ACTION"),description:_.string(),action_entity:Xr.optional(),locator:_.string().optional(),use_pure_vision:_.boolean().optional()}),ee=_.lazy(()=>_.union([Yr,Jr,Ye.extend({type:_.literal("STEP"),description:_.string().optional().default(""),statements:_.array(ee),reference_id:_.number().optional()}),Ye.extend({type:_.literal("IF_ELSE"),description:_.string().optional(),condition:qn,then:_.array(ee),else:_.array(ee).optional()}),Ye.extend({type:_.literal("WHILE_LOOP"),description:_.string().optional(),condition:qn,body:_.array(ee),timeout_ms:_.number().optional()})])),qr=_.object({name:_.string(),statements:_.array(ee),teardown:_.array(ee).optional(),skip:_.union([_.boolean(),_.string()]).optional(),timeout:_.number().optional(),fail:_.union([_.boolean(),_.string()]).optional(),only:_.boolean().optional(),slow:_.boolean().optional()}),nn=_.object({tests:_.array(qr).min(1),beforeAll:_.array(ee).optional(),afterAll:_.array(ee).optional(),beforeEach:_.array(ee).optional(),afterEach:_.array(ee).optional()}),Zn=_.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(ee).optional(),teardown:_.array(ee).optional(),last_modified_at:_.string().optional(),testGroup:nn.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 Ed,parse as ts,parseAllDocuments as Pk,parseDocument as Td,Document as Ad,isMap as qe,isSeq as ce}from"yaml";import{v4 as le}from"uuid";function is(e,t){let i={...t?.test_case_id!==void 0?{test_case_id:t.test_case_id}:{},...t?.name?{name:t.name}:{},goal:e.goal??"",url:e.url,base_url:e.baseURL,statements:(e.statements??[]).map(ie)};return e.final_feedback&&(i.final_feedback=e.final_feedback),e.teardown&&e.teardown.length>0&&(i.teardown=e.teardown.map(ie)),i}function an(e,t){if(e.testGroup)return as(e,t);let i=is(e,t),n=new Ad(i);return e.comment&&(n.commentBefore=e.comment),Zr(n,e.statements??[]),e.teardown&&Zr(n,e.teardown,"teardown"),n.toString(ns)}function Zr(e,t,i="statements"){let n=e.contents;if(!n||!qe(n))return;let a=n.get(i,!0);ce(a)&&ei(a,t)}function ei(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),qe(a)){let o=a;if(n.type==="STEP"){let r=o.get("statements",!0);ce(r)&&ei(r,n.statements)}else if(n.type==="IF_ELSE"){let r=o.get("THEN",!0);ce(r)&&ei(r,n.then);let s=o.get("ELSE",!0);ce(s)&&n.else&&ei(s,n.else)}else if(n.type==="WHILE_LOOP"){let r=o.get("DO",!0);ce(r)&&ei(r,n.body)}}}}function as(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);let a={};return e.baseURL&&(a.base_url=e.baseURL),i.beforeAll&&i.beforeAll.length>0&&(a.beforeAll=i.beforeAll.map(ie)),i.beforeEach&&i.beforeEach.length>0&&(a.beforeEach=i.beforeEach.map(ie)),i.afterEach&&i.afterEach.length>0&&(a.afterEach=i.afterEach.map(ie)),i.afterAll&&i.afterAll.length>0&&(a.afterAll=i.afterAll.map(ie)),a.tests=i.tests.map(o=>{let r={name:o.name};return o.skip!==void 0&&(r.skip=o.skip),o.timeout!==void 0&&(r.timeout=o.timeout),o.fail!==void 0&&(r.fail=o.fail),o.only!==void 0&&(r.only=o.only),o.slow!==void 0&&(r.slow=o.slow),r.statements=o.statements.map(ie),o.teardown&&o.teardown.length>0&&(r.teardown=o.teardown.map(ie)),r}),n.suite=a,Ed(n,ns)}function ie(e){switch(e.type){case"DRAFT":return $d(e);case"ACTION":return Md(e);case"STEP":return Id(e);case"IF_ELSE":return Pd(e);case"WHILE_LOOP":return Cd(e)}}function $d(e){return{intent:e.description}}function Md(e){let t=e.action_entity?.action_data?.action_name??e.action_entity?.action?.action_name,i=e.action_entity?.action_data?.kwargs??e.action_entity?.action?.kwargs;if(t==="verify"){let s=i?.statement;if(typeof s=="string"&&!e.action_entity?.locator&&!e.action_entity?.xpath){let l=i?.code;return typeof l=="string"?{VERIFY:s,js:l}:{VERIFY:s}}}if(t==="go_to_url"){let s=i?.url;if(typeof s=="string"&&!e.action_entity?.locator&&!e.action_entity?.xpath){let l={URL:s};return i?.new_tab===!0&&(l.new_tab=!0),typeof i?.timeout_seconds=="number"&&(l.timeout_seconds=i.timeout_seconds),l}}if(t==="js_action"){let s=i?.code;if(typeof s=="string"&&e.description)return{intent:e.description,js:s}}if(t==="ai_wait_until"){let s=i?.condition;if(typeof s=="string"){let l={WAIT_UNTIL:s};return typeof i?.timeout_seconds=="number"&&i.timeout_seconds!==60&&(l.timeout_seconds=i.timeout_seconds),l}}if(t==="wait"){let s=i?.seconds,d={WAIT:e.description||`Wait ${s}s`};return typeof s=="number"&&(d.seconds=s),d}if(t==="js_code"){let s=i?.code;if(typeof s=="string"&&!e.action_entity?.locator&&!e.action_entity?.xpath)return{CODE:s}}if(!e.action_entity)return{intent:e.description};let n=e.action_entity.action_data??e.action_entity.action;if(!n)return{intent:e.description};let 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[s,l]of Object.entries(n.kwargs))a[s]=l;return n.args&&n.args.length>0&&(a.args=n.args),a}function Id(e){let t={STEP:e.description,statements:e.statements.map(ie)};return e.reference_id!==void 0&&(t.reference_id=e.reference_id),t}function Pd(e){let t={IF:os(e.condition),THEN:e.then.map(ie)};return e.else&&e.else.length>0&&(t.ELSE=e.else.map(ie)),t}function Cd(e){let t={WHILE:os(e.condition),DO:e.body.map(ie)};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 ta(e){try{let t=ts(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()),i}catch{return{}}}function ea(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(ea);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]=ea(o);return n}function ke(e){if(e.length>Qr)throw new Error(`YAML input too large (${e.length} bytes, max ${Qr})`);let t=ea(ts(e));if(!t||typeof t!="object")throw new Error("Invalid YAML: expected an object at root level");if(t.suite)return Od(t);let i={version:"1.3.0",goal:t.goal,url:t.url,baseURL:t.base_url,statements:ne(t.statements??[])};t.final_feedback&&(i.final_feedback=t.final_feedback),t.teardown&&Array.isArray(t.teardown)&&(i.teardown=ne(t.teardown));let n=Zn.safeParse(i);if(!n.success)throw new Error(`Invalid TestFlow after YAML conversion: ${JSON.stringify(n.error.errors)}`);let a=n.data;return on(e,a),a}function Od(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(s=>{if(!s.name)throw new Error('Each test in a suite must have a "name" field');if(!Array.isArray(s.statements)||s.statements.length===0)throw new Error(`Suite test "${s.name}" must have a non-empty "statements" array`);let l={name:s.name,statements:ne(s.statements)};return Array.isArray(s.teardown)&&s.teardown.length>0&&(l.teardown=ne(s.teardown)),s.skip!==void 0&&(l.skip=s.skip),typeof s.timeout=="number"&&(l.timeout=s.timeout),s.fail!==void 0&&(l.fail=s.fail),s.only===!0&&(l.only=!0),s.slow===!0&&(l.slow=!0),l})};Array.isArray(t.beforeAll)&&t.beforeAll.length>0&&(a.beforeAll=ne(t.beforeAll)),Array.isArray(t.afterAll)&&t.afterAll.length>0&&(a.afterAll=ne(t.afterAll)),Array.isArray(t.beforeEach)&&t.beforeEach.length>0&&(a.beforeEach=ne(t.beforeEach)),Array.isArray(t.afterEach)&&t.afterEach.length>0&&(a.afterEach=ne(t.afterEach));let o=nn.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 ne(e){if(!Array.isArray(e))throw new Error("Expected an array of statements");return e.map(Nd)}function Nd(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 Dd(t);if("WHILE"in t)return Ld(t);if("STEP"in t)return Rd(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:le(),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:le(),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:le(),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:le(),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.');return{uid:le(),type:"ACTION",description:"Code block",action_entity:{action_description:"Code block",action_data:{action_name:"js_code",kwargs:{code:typeof i=="string"?i:String(i)}}}}}if("js"in t&&("intent"in t||"desc"in t)&&!("VERIFY"in t)){let i=t.js,n=typeof t.intent=="string"?t.intent:typeof t.desc=="string"?t.desc:"";return{uid:le(),type:"ACTION",description:n,action_entity:{action_description:n,action_data:{action_name:"js_action",kwargs:{code:typeof i=="string"?i:String(i)}}}}}if("call"in t&&typeof t.call=="string"){let{call:i,...n}=t;return es({...n,action:"function",functionName:i})}if("action"in t)return es(t);if("intent"in t&&typeof t.intent=="string"||"desc"in t&&typeof t.desc=="string")return{uid:le(),type:"DRAFT",description:typeof t.intent=="string"?t.intent:t.desc};throw new Error(`Cannot infer statement type from object: ${JSON.stringify(t)}`)}function rs(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 Dd(e){let t=rs(e.IF),i=e.THEN;if(!Array.isArray(i))throw new Error("IF_ELSE requires a THEN array");let n={uid:le(),type:"IF_ELSE",condition:t,then:ne(i)};return"ELSE"in e&&Array.isArray(e.ELSE)&&(n.else=ne(e.ELSE)),n}function Ld(e){let t=rs(e.WHILE),i=e.DO;if(!Array.isArray(i))throw new Error("WHILE_LOOP requires a DO array");let n={uid:le(),type:"WHILE_LOOP",condition:t,body:ne(i)};return typeof e.timeout_ms=="number"&&(n.timeout_ms=e.timeout_ms),n}function Rd(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:le(),type:"STEP",description:t,statements:ne(e.statements)};return typeof e.reference_id=="number"&&(i.reference_id=e.reference_id),i}function es(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[d,c]of Object.entries(e))Fd.has(d)||(r[d]=c);let s={action_description:i,action_data:{action_name:t,kwargs:Object.keys(r).length>0?r:{}}};n&&(s.locator=n),a&&(s.xpath=a);let l={uid:le(),type:"ACTION",description:i,action_entity:s};return o&&(l.use_pure_vision=!0),l}function on(e,t){let i;try{i=Td(e)}catch{return}let n=i.contents;if(!n||!qe(n))return;if(i.commentBefore)t.comment=i.commentBefore;else{let l=n.items?.[0];l?.key&&l.key.commentBefore&&(t.comment=l.key.commentBefore)}let a=n,o=a.get("statements",!0);ce(o)&&t.statements&&Je(o,t.statements);let r=a.get("teardown",!0);ce(r)&&t.teardown&&Je(r,t.teardown)}function Je(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"&&qe(n)){let o=n.get("statements",!0);ce(o)&&Je(o,a.statements)}else if(a.type==="IF_ELSE"&&qe(n)){let o=n.get("THEN",!0);ce(o)&&Je(o,a.then);let r=n.get("ELSE",!0);ce(r)&&a.else&&Je(r,a.else)}else if(a.type==="WHILE_LOOP"&&qe(n)){let o=n.get("DO",!0);ce(o)&&Je(o,a.body)}}}var ns,Qr,Fd,rn=w(()=>{"use strict";Qn();ns={lineWidth:120,defaultKeyType:"PLAIN",defaultStringType:"PLAIN"};Qr=1024*1024;Fd=new Set(["action","intent","desc","locator","xpath","use_pure_vision"])});import{parse as Lk,stringify as Rk}from"yaml";var ss=w(()=>{"use strict";rn()});var sn=w(()=>{"use strict"});var ls=w(()=>{"use strict";rn();sn()});var ln=w(()=>{"use strict"});var cs=w(()=>{"use strict";ln()});var ds,Ud,us,hs,ti,Bd,Gd,ms=w(()=>{"use strict";ds=112,Ud=1080-ds,us={"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"}},hs={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"]},ti=(e,t=!1)=>{let i=["chromium"];return t&&i.push("webkit"),hs[e].map(n=>us[n]).filter(n=>n.defaultBrowserType&&i.includes(n.defaultBrowserType))},Bd={desktop:{label:"Desktop",type:"desktop",devices:ti("desktop")},mobile:{label:"Mobile Web",type:"mobile",devices:ti("mobile")}},Gd={desktop:{label:"Desktop",type:"desktop",devices:ti("desktop",!0)},mobile:{label:"Mobile Web",type:"mobile",devices:ti("mobile",!0)}}});var ps=w(()=>{"use strict"});var gs=w(()=>{"use strict";sn()});var De,fs=w(()=>{"use strict";De=(e=>(e.DRAFT="DRAFT",e.STEP="STEP",e.ACTION="ACTION",e.IF_ELSE="IF_ELSE",e.WHILE_LOOP="WHILE_LOOP",e))(De||{})});var ws=w(()=>{"use strict"});var bs=w(()=>{"use strict"});var ys=w(()=>{"use strict"});var xs=w(()=>{"use strict";ln()});var Ze=w(()=>{"use strict";Br();Gr();jr();Kr();ss();ls();rn();Qn();cs();ms();ps();gs();sn();fs();ws();bs();ys();xs();ln()});import{stringify as oT}from"yaml";import{createHash as Jd}from"crypto";import{parse as qd,stringify as Ts}from"yaml";import{readFileSync as Zd}from"fs";import{resolve as As,dirname as Qd}from"path";import{parse as _s,stringify as eu}from"yaml";function Xd(e){let t=e.frame_path;return!t||t.length===0?"page":`page.frameLocator('${t[0]}')`}function Yd(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 Es(e){let t=Xd(e),i=e.locator;if(typeof i=="string"&&i.trim())return i=i.trim(),i.endsWith("first()")?`${t}.${i}`:`${t}.${i}.first()`;let n=Yd(e);if(n){let a=JSON.stringify(n);return`${t}.locator(${a}).first()`}return null}function $(e,t){q.set(e,t)}function Le(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 vs(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 $s(e,t){let i={expandingPaths:new Set([As(t)]),depth:0,referencedPaths:new Set},n={...e};Array.isArray(n.statements)&&(n.statements=Pe(n.statements,t,i)),Array.isArray(n.teardown)&&(n.teardown=Pe(n.teardown,t,i));for(let a of["beforeAll","afterAll","beforeEach","afterEach"])Array.isArray(n[a])&&(n[a]=Pe(n[a],t,i));return{doc:n,referencedTemplatePaths:Array.from(i.referencedPaths)}}function Pe(e,t,i){let n=[];for(let a of e)if(tu(a)){let o=iu(a,t,i);n.push(...o)}else n.push(nu(a,t,i));return n}function tu(e){return typeof e=="object"&&e!==null&&typeof e.template=="string"}function iu(e,t,i){if(i.depth>=ks)throw new Error(`Template expansion exceeded maximum depth of ${ks}. Check for deeply nested or circular template references.`);let n=As(Qd(t),e.template);if(i.expandingPaths.has(n))throw new Error(`Circular template reference detected: ${n} is already being expanded. Stack: ${Array.from(i.expandingPaths).join(" \u2192 ")} \u2192 ${n}`);i.referencedPaths.add(n);let a;try{a=Zd(n,"utf-8")}catch(c){throw new Error(`Failed to read template file: ${n} (referenced from ${t}): ${c.message}`)}let o=_s(a);if(!o||typeof o!="object")throw new Error(`Invalid template file: ${n} \u2014 expected a YAML object`);let r=o.params||[],s=e.params||{};for(let c of r)if(!(c in s))throw new Error(`Template ${e.template} requires param "${c}" but it was not provided. Required params: [${r.join(", ")}]`);let l=o.statements;if(!Array.isArray(l))throw new Error(`Template ${e.template} must have a "statements" array`);if(Object.keys(s).length>0){let u=eu(l);for(let[m,f]of Object.entries(s))u=u.split(`<<${m}>>`).join(String(f));l=_s(u)}let d={expandingPaths:new Set([...i.expandingPaths,n]),depth:i.depth+1,referencedPaths:i.referencedPaths};return Pe(l,n,d)}function nu(e,t,i){if(typeof e!="object"||e===null)return e;let n={...e};return Array.isArray(n.statements)&&(n.statements=Pe(n.statements,t,i)),Array.isArray(n.THEN)&&(n.THEN=Pe(n.THEN,t,i)),Array.isArray(n.ELSE)&&(n.ELSE=Pe(n.ELSE,t,i)),Array.isArray(n.DO)&&(n.DO=Pe(n.DO,t,i)),n}function Is(e,t){let i=qd(e),n=i?.name,a=i?.tags,o=i?.use;if(i&&(i.name!==void 0||i.tags!==void 0||i.use!==void 0)&&(delete i.name,delete i.tags,delete i.use),i?.suite){if(i.goal||i.statements)throw new Ms('YAML file cannot have both "suite" and top-level "goal"/"statements". Use either suite format or single-test format.');return ou(i,n,a,o,t)}return au(i,n,a,o,t)}function au(e,t,i,n,a){let o=e?.beforeEach,r=e?.afterEach,s=Ps(e?.parameters),l=e?.timeout,d=e?.skip,c=e?.fail,u=e?.only,m=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 Ms(`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 y=$s(e,a);e=y.doc,f=y.referencedTemplatePaths}let h=Ts(e),x=ke(h);return a&&(Qe(x.statements??[],a,"main"),x.teardown&&Qe(x.teardown,a,"teardown")),{testFlow:x,name:t,tags:i,use:n,beforeEach:o,afterEach:r,parameters:s,timeout:l,skip:d,fail:c,only:u,slow:m,referencedTemplatePaths:f}}function ou(e,t,i,n,a){let o=e.suite;if(!Array.isArray(o.tests)||o.tests.length===0)throw new Error('Suite must have a non-empty "tests" array.');let r=o.beforeAll,s=o.afterAll,l=o.beforeEach,d=o.afterEach,c=[],u=o.tests.map(h=>{if(!h.name)throw new Error('Each test in a suite must have a "name" field.');if(!Array.isArray(h.statements)||h.statements.length===0)throw new Error(`Suite test "${h.name}" must have a non-empty "statements" array.`);let x={goal:h.name,statements:h.statements};h.teardown&&(x.teardown=h.teardown);let y=[],p=x;if(a&&typeof x=="object"){let A=$s(x,a);p=A.doc,y=A.referencedTemplatePaths,c.push(...y)}let b=Ts(p),E=ke(b),T=Ps(h.parameters);return{testFlow:E,name:h.name,tags:Array.isArray(h.tags)?h.tags:void 0,parameters:T,timeout:h.timeout,skip:h.skip,fail:h.fail,only:h.only,slow:h.slow}}),m=o.base_url,f=m?{...n,baseURL:m}:n;return{suite:{beforeAll:r,afterAll:s,beforeEach:l,afterEach:d,tests:u},name:t,tags:i,use:f,referencedTemplatePaths:c}}function Ps(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 Qe(e,t,i){for(let n=0;n<e.length;n++){let a=e[n],o=`${i}.${n}`,r=a.description||"";if(a.uid=ru(t,o,r),a.type===De.STEP)Qe(a.statements,t,o);else if(a.type===De.IF_ELSE){let s=a;Qe(s.then,t,`${o}.then`),s.else&&Qe(s.else,t,`${o}.else`)}else a.type===De.WHILE_LOOP&&Qe(a.body,t,`${o}.body`)}}function ru(e,t,i){let n=Jd("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 Ss,q,ks,Ms,Cs=w(()=>{"use strict";Ze();Ze();Ze();Ze();Ss=5e3;q=new Map;$("click",e=>{let t=Es(e);if(!t)return['await agent.execAction("click", page, {});'];let i=e.action_data?.kwargs?.timeout_ms??Ss;return[`await ${t}.click({ timeout: ${i} });`]});$("click_element",q.get("click"));$("click_element_by_index",q.get("click"));$("double_click",e=>Le("double_click",e));$("double_click_on_element",q.get("double_click"));$("right_click",e=>Le("right_click",e));$("right_click_on_element",q.get("right_click"));$("hover",e=>Le("hover",e));$("hover_element_by_index",q.get("hover"));$("input_text",e=>{let t=e.action_data?.kwargs?.text??e.action_data?.kwargs?.value??"";return Le("input_text",e,[`action_data: { kwargs: { text: ${JSON.stringify(t)} } }`])});$("fill",q.get("input_text"));$("clear_input",e=>Le("clear_input",e));$("press",e=>{let t=e.action_data?.kwargs?.keys;return[`await page.keyboard.press(${JSON.stringify(t)});`]});$("send_keys",q.get("press"));$("send_keys_on_element",e=>{let t=Es(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??Ss;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 Le("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",q.get("scroll"));$("scroll_up",q.get("scroll"));$("scroll_element",q.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=>Le("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",q.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(`
4304
4304
  `),s=JSON.stringify(a);return["{ const _t = Date.now(); try {",...r.map(l=>` ${l}`),` console.log(\`[VERIFY:JS] \u2713 \${((Date.now()-_t)/1000).toFixed(1)}s: ${s}\`);`,"} 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: ${s}\`);`,` await agent.assert(page, ${s}, ${JSON.stringify(t||"")});`,"} }"]}return n?i.code.split(`
4305
4305
  `):a?[`await agent.assert(page, ${JSON.stringify(a)}, ${JSON.stringify(t||"")});`]:["// Skipping verify: missing statement or code"]});$("ai_assert",q.get("verify"));$("assert",q.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(`
4306
4306
  `);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,s]=a.split("#");if(r&&s){let l=r.replace(/\.(ts|js|mjs)$/,""),d=`import { ${s} } from '${l}';`;i?.imports?.add(d);let c={...n,functionName:s},u=vs(c);return u?[u.endsWith(";")?u:`${u};`]:["// Skipping function: invalid export pattern"]}}let o=vs(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"]);$("js_action",e=>{let t=e.action_data?.kwargs?.code;return t?t.split(`
@@ -4408,4 +4408,4 @@ ${m.body}`,h=await rd(f,a,t.model);g.info(`Extracted content: ${h}`),h&&h!=="NOT
4408
4408
  }
4409
4409
  return shadow;
4410
4410
  };
4411
- })()`).catch(()=>{});await a._enableRecorder({mode:"recording",recorderMode:"api",handleSIGINT:!1,omitCallTracking:!0,testIdAttributeName:n||"data-testid"},r),await this.page.evaluate(()=>window.__pw_recorderSetMode?.("standby")).catch(()=>{})}this.recorderEnabled=!0,await o}async stopRecorder(t){this.page.context()._onRecorderEventSink=void 0,this.recorderStopResolver&&(this.recorderStopResolver(),this.recorderStopResolver=void 0)}async terminateSession(t){console.error("[debugger] Playwright session released")}async cleanupAll(){}};async function ET(e){let{yamlFilePath:t,port:i,cdpPort:n,page:a,agent:o}=e,r=new Qt(a,o);if(n)try{let f=await fetch(`http://localhost:${n}/json/version`);if(f.ok){let h=await f.json();h.webSocketDebuggerUrl&&(r.setCdpEndpoint(h.webSocketDebuggerUrl),console.error(`[debugger] CDP endpoint: ${h.webSocketDebuggerUrl}`))}}catch{console.error(`[debugger] Could not fetch CDP endpoint from port ${n}`)}let s=Fs();s.use(Fs.json({limit:"10mb"})),s.use((f,h,x)=>{if(h.setHeader("Access-Control-Allow-Origin","*"),h.setHeader("Access-Control-Allow-Methods","GET, POST, PUT, DELETE, OPTIONS"),h.setHeader("Access-Control-Allow-Headers","Content-Type, Accept, Cache-Control, Idempotency-Key"),f.method==="OPTIONS")return h.sendStatus(204);x()});let{createTestFlowRouter:l}=await Promise.resolve().then(()=>(Ds(),Ns)),{createIntRunnerRouter:d}=await Promise.resolve().then(()=>(Rs(),Ls)),c=await import("path");s.use(l({initialDir:c.dirname(t),initialFile:t})),s.use(d(r));let u=await new Promise((f,h)=>{let x=s.listen(i,"localhost",()=>f(x));x.on("error",h)});return{url:`http://localhost:${i}`,close:async()=>{await r.cleanupAll(),await new Promise((f,h)=>{u.close(x=>x?h(x):f())})}}}export{Qt as PlaywrightSandboxService,ET as startPlaywrightDebugServer};
4411
+ })()`).catch(()=>{});await a._enableRecorder({mode:"recording",recorderMode:"api",handleSIGINT:!1,omitCallTracking:!0,testIdAttributeName:n||"data-testid"},r),await this.page.evaluate(()=>window.__pw_recorderSetMode?.("standby")).catch(()=>{})}this.recorderEnabled=!0,await o}async stopRecorder(t){this.page.context()._onRecorderEventSink=void 0,this.recorderStopResolver&&(this.recorderStopResolver(),this.recorderStopResolver=void 0)}async terminateSession(t){console.error("[debugger] Playwright session released")}async cleanupAll(){}};async function ST(e){let{yamlFilePath:t,port:i,cdpPort:n,page:a,agent:o}=e,r=new Qt(a,o);if(n)try{let f=await fetch(`http://localhost:${n}/json/version`);if(f.ok){let h=await f.json();h.webSocketDebuggerUrl&&(r.setCdpEndpoint(h.webSocketDebuggerUrl),console.error(`[debugger] CDP endpoint: ${h.webSocketDebuggerUrl}`))}}catch{console.error(`[debugger] Could not fetch CDP endpoint from port ${n}`)}let s=Fs();s.use(Fs.json({limit:"10mb"})),s.use((f,h,x)=>{if(h.setHeader("Access-Control-Allow-Origin","*"),h.setHeader("Access-Control-Allow-Methods","GET, POST, PUT, DELETE, OPTIONS"),h.setHeader("Access-Control-Allow-Headers","Content-Type, Accept, Cache-Control, Idempotency-Key"),f.method==="OPTIONS")return h.sendStatus(204);x()});let{createTestFlowRouter:l}=await Promise.resolve().then(()=>(Ds(),Ns)),{createIntRunnerRouter:d}=await Promise.resolve().then(()=>(Rs(),Ls)),c=await import("path");s.use(l({initialDir:c.dirname(t),initialFile:t})),s.use(d(r));let u=await new Promise((f,h)=>{let x=s.listen(i,"localhost",()=>f(x));x.on("error",h)});return{url:`http://localhost:${i}`,close:async()=>{await r.cleanupAll(),await new Promise((f,h)=>{u.close(x=>x?h(x):f())})}}}export{Qt as PlaywrightSandboxService,ST as startPlaywrightDebugServer};