shiplightai 0.1.97 → 0.1.98
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/dist/cjs/debugger-pw.cjs +5 -5
- package/dist/cjs/fixture.cjs +34 -34
- package/dist/cjs/index.cjs +33 -33
- package/dist/cjs/reporter.cjs +51 -44
- package/dist/cli.js +140 -134
- package/dist/debugger-pw.js +5 -5
- package/dist/fixture.js +34 -34
- package/dist/index.js +33 -33
- package/dist/reporter.js +51 -44
- package/package.json +3 -3
package/dist/cjs/debugger-pw.cjs
CHANGED
|
@@ -157,7 +157,7 @@ To use them, write Jinja-like template syntax: {{ placeholder_name }}
|
|
|
157
157
|
Based on the above information, please determine the right action to accomplish the task.
|
|
158
158
|
`,d.push({type:"text",text:h}),d}var on=b(()=>{"use strict";Ht()});async function vd(e){let t=e.context().pages(),i=null,n=[];for(let o=0;o<t.length;o++){let r=t[o];r===e&&(i=o);let s="(title unavailable)";try{s=await Promise.race([r.title(),new Promise((c,d)=>setTimeout(()=>d(new Error("timeout")),1e3))])}catch{}let l=`Tab ${o}: ${r.url()}`;s&&(l+=` - ${s.slice(0,50)}`),n.push(l)}let a=n.length>0?n.join(`
|
|
159
159
|
`):"";return{currentTabText:i!==null?`Current tab: ${i}
|
|
160
|
-
`:"",tabsText:a}}async function xd(e,t){let{currentTabText:i,tabsText:n}=await vd(e);return{elementsText:t,currentUrl:e.url(),currentTitle:await e.title(),currentTabText:i,tabsText:n}}async function rn(e,t){let{page:i,domService:n,agentServices:a}=e,o=typeof t=="boolean"?{useCleanScreenshot:t}:t||{},r=a.getInteractiveClassNames(),s=a.getIframeFallbackDomains(),{domState:l,screenshotBase64:c,slicedScreenshotsBase64:d}=await n.getClickableElementsWithScreenshot(i,{interactiveClassNames:r,playwrightFrameFallbackDomains:s,useCleanScreenshot:o.useCleanScreenshot,useSlicedScreenshots:o.useSlicedScreenshots,resizeSlicedScreenshots:o.resizeSlicedScreenshots,useAccessibilityTree:o.useAccessibilityTree,actionIntent:o.actionIntent}),u=l.elementTree.clickableElementsToString(),h=await xd(i,u);return d&&(h.slicedScreenshotsBase64=d),{domTree:u,screenshotBase64:c,slicedScreenshotsBase64:d,domState:l,pageContext:h}}var Wt=b(()=>{"use strict"});var ue,_a,Y,Te=b(()=>{"use strict";ue=require("zod"),_a=class{constructor(){this.tools=new Map}register(e){if(this.tools.has(e.name))throw new Error(`Tool '${e.name}' is already registered`);let t={name:e.name,description:e.description,schema:e.schema,execute:e.execute,resolveArgs:e.resolveArgs,redactErrorText:e.redactErrorText,usesElementIndex:e.usesElementIndex??!1,availability:{openai:e.availability?.openai??!0,mcp:e.availability?.mcp??!0}};this.tools.set(e.name,t)}get(e){return this.tools.get(e)}has(e){return this.tools.has(e)}getToolNames(){return Array.from(this.tools.keys())}getTools(){return Array.from(this.tools.values())}async execute(e,t,i){let n=this.tools.get(e);if(!n)throw new Error(`Tool not found: ${e}`);try{let a=t?.description,o={...t};delete o.description;let r=n.resolveArgs?n.resolveArgs(o):o,s=n.schema.parse(r),l={...i,actionDescription:a,...n.resolveArgs?{rawArgs:o}:{}};return await n.execute(s,l)}catch(a){if(a instanceof ue.z.ZodError){let o=(n.redactErrorText??(r=>r))(a.issues.map(r=>`${r.path.join(".")}: ${r.message}`).join(", "));return{success:!1,error:`Invalid arguments for tool '${e}': ${o}`,actionEntity:{action_description:t?.description||`${e} (validation failed)`,action_data:{action_name:e,kwargs:t},feedback:`Validation error: ${o}`}}}throw a}}clear(){this.tools.clear()}size(){return this.tools.size}buildActionUnionSchema(){let e=this.getTools().filter(t=>t.availability.openai);return this.buildUnionSchemaFromTools(e)}buildActionUnionSchemaForTools(e,t=!1){let i=new Set(e),n=this.getTools().filter(a=>i.has(a.name));return this.buildUnionSchemaFromTools(n,t)}buildUnionSchemaFromTools(e,t=!1){if(e.length===0)return ue.z.object({done:ue.z.any()});let i=e.map(r=>{let s=r.schema;if(t&&s instanceof ue.z.ZodObject){let l=s._def.shape();s=ue.z.object({...l,description:ue.z.string().describe("Semantic, human-readable description of the action")})}if(s instanceof ue.z.ZodObject){let l=s._def.shape();Object.keys(l).length===0&&(s=ue.z.object({_empty:ue.z.boolean().optional().describe("Placeholder for an action that takes no parameters. Its value is ignored.")}))}return ue.z.object({[r.name]:s})});if(i.length===1)return i[0];let[n,a,...o]=i;return ue.z.union([n,a,...o])}},Y=new _a});function ze(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function _d(e){return!e.keys?.length&&!e.properties&&!e.items&&!e.branches&&!e.additional}function ka(e){let t=e.type;if(t==="null"||Array.isArray(t)&&t.includes("null"))return!0;for(let i of["anyOf","oneOf"]){let n=e[i];if(Array.isArray(n)&&n.some(a=>ze(a)&&ka(a)))return!0}return kd.every(i=>e[i]===void 0)}function Sd(e){if(ka(e))return e;if(typeof e.type=="string"&&e.enum===void 0&&e.const===void 0)return{...e,type:[e.type,"null"]};let{description:t,...i}=e;return{...t!==void 0?{description:t}:{},anyOf:[i,{type:"null"}]}}function gt(e){if(!ze(e))return{schema:e};let t={...e},i={},n=e.properties;if(ze(n)){let a=new Set(Array.isArray(e.required)?e.required:[]),o=Object.keys(n),r=[],s={},l={};for(let c of o){let d=n[c],u=gt(d),h=u.schema;if(ze(h)&&"default"in h){let{default:p,...w}=h;h=w}a.has(c)||ze(h)&&!ka(h)&&(r.push(c),h=Sd(h)),l[c]=h,u.promoted&&(s[c]=u.promoted)}t.properties=l,t.required=o,t.additionalProperties=!1,r.length>0&&(i.keys=r),Object.keys(s).length>0&&(i.properties=s)}if(ze(e.additionalProperties)){let a=gt(e.additionalProperties);t.additionalProperties=a.schema,a.promoted&&(i.additional=a.promoted)}if(Array.isArray(e.items)){let a=e.items.map(o=>gt(o));t.items=a.map(o=>o.schema),a.some(o=>o.promoted)&&(i.items=a.map(o=>o.promoted))}else if(e.items!==void 0){let a=gt(e.items);t.items=a.schema,a.promoted&&(i.items=a.promoted)}for(let a of["anyOf","oneOf","allOf"]){let o=e[a];if(!Array.isArray(o))continue;let r=o.map(s=>gt(s));t[a]=r.map(s=>s.schema),r.some(s=>s.promoted)&&(i.branches=r.map((s,l)=>{let c=o[l],d=ze(c)?c.properties:void 0,u=ze(d)?Object.keys(d):void 0;if(!(!s.promoted&&!u))return{...s.promoted??{},...u?{declared:u}:{}}}))}return{schema:t,promoted:_d(i)?void 0:i}}function hr(e){if(e.items!==void 0)return e.items;for(let t of e.branches??[]){let i=t&&hr(t);if(i!==void 0)return i}}function Ed(e){if(!e||e.length===0)return[];let t=new Set;for(let i of e){if(!i?.declared)continue;let n=new Set(i.keys??[]);for(let a of i.declared)n.has(a)||t.add(a)}return t.size===0?e:e.map(i=>{if(!i?.keys?.length)return i;let n=i.keys.filter(a=>!t.has(a));return n.length===i.keys.length?i:{...i,keys:n}})}function jt(e,t){if(t===void 0||e===null||typeof e!="object")return e;if(Array.isArray(e)){let o=hr(t);return o===void 0?e:e.map((r,s)=>jt(r,Array.isArray(o)?o[s]:o))}let i=e,n=!1,a=()=>(n||(i={...i},n=!0),i);for(let o of t.keys??[])i[o]===null&&delete a()[o];for(let[o,r]of Object.entries(t.properties??{})){if(!(o in i))continue;let s=jt(i[o],r);s!==i[o]&&(a()[o]=s)}if(t.additional)for(let o of Object.keys(i)){let r=jt(i[o],t.additional);r!==i[o]&&(a()[o]=r)}for(let o of Ed(t.branches)){let r=jt(i,o);r!==i&&(i=r,n=!0)}return i}function sn(e){let{schema:t,promoted:i}=gt((0,ur.zodToJsonSchema)(e,{$refStrategy:"none"}));return(0,dr.jsonSchema)(t,{validate:async n=>{let a=await e.safeParseAsync(jt(n,i));return a.success?{success:!0,value:a.data}:{success:!1,error:a.error}}})}var dr,ur,kd,Ut=b(()=>{"use strict";dr=require("ai"),ur=require("zod-to-json-schema");kd=["type","enum","const","anyOf","oneOf","allOf","not","$ref"]});function Ae(e,t){if(!e||typeof e!="object")return null;let i=e;return{prompt_tokens:i.promptTokens||i.inputTokens||0,completion_tokens:i.completionTokens||i.outputTokens||0,total_tokens:i.totalTokens||0,model:Ke(t).modelId}}var Ve=b(()=>{"use strict";it()});function pr(){let e=V().llmCallTimeoutMs;return e===void 0?da:e}async function be(e){let t=pr(),i=t>0?AbortSignal.timeout(t):void 0;try{return await e(i)}catch(n){throw i?.aborted&&fr(n)?new mr(t):n}}function fr(e,t=new Set){if(typeof e!="object"||e===null||t.has(e))return!1;t.add(e);let i=e.name;if(i==="TimeoutError"||i==="AbortError")return!0;let n=e.cause;return n!==void 0&&fr(n,t)}var Sa,mr,$e=b(()=>{"use strict";ne();Sa=2,mr=class extends Error{constructor(e){super(`LLM call exceeded the ${Math.round(e/1e3)}s ceiling (SdkConfig.llmCallTimeoutMs). This bounds the whole call including the AI SDK's internal retries and backoff, so the provider was most likely slow or degraded rather than the request being malformed. Raise llmCallTimeoutMs for genuinely long generations, or set it to 0 to disable the ceiling.`),this.name="LlmCallTimeoutError",this.timeoutMs=e}}});function gr(e){let t=V(),i=t.env?.OPENAI_API_KEY;if(i){let a=t.env?.OPENAI_BASE_URL;return g.debug(`Using OpenAI provider: model=${e}${a?`, baseURL=${a}`:""}`),(0,Ea.createOpenAI)({apiKey:i,baseURL:a})(e)}let n=t.env?.SHIPLIGHT_API_TOKEN;if(n){let a=jo(n,t.env?.SHIPLIGHT_API_URL);return g.debug(`Using Shiplight LLM proxy (OpenAI): model=${e}, baseURL=${a}`),(0,Ea.createOpenAI)({apiKey:n,baseURL:a})(e)}throw new tt("OPENAI_API_KEY not configured in SDK config")}function wr(e){return{}}var Ea,Bt=b(()=>{"use strict";Ue();Be();U();ne();Ea=require("@ai-sdk/openai")});function Td(e){if(!e)return!1;let t=e.trim().toLowerCase();return t==="1"||t==="true"||t==="yes"||t==="on"}function Ad(){return Td(V().env?.ANTHROPIC_MODELS_USE_VERTEXAI)}function br(e){let t=V();if(Ad()){let a=t.env?.GOOGLE_CLOUD_PROJECT,o=t.env?.GOOGLE_CLOUD_LOCATION;if(!a)throw new Error("GOOGLE_CLOUD_PROJECT is required when ANTHROPIC_MODELS_USE_VERTEXAI is enabled");if(!o)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=${a}, location=${o}`),(0,yr.createVertexAnthropic)({project:a,location:o})(e)}let i=t.env?.ANTHROPIC_API_KEY;if(i)return g.debug(`Using Anthropic provider: model=${e}`),(0,Ta.createAnthropic)({apiKey:i})(e);let n=t.env?.SHIPLIGHT_API_TOKEN;if(n){let a=Uo(n,t.env?.SHIPLIGHT_API_URL);return g.debug(`Using Shiplight LLM proxy (Anthropic): model=${e}, baseURL=${a}`),(0,Ta.createAnthropic)({apiKey:n,baseURL:a})(e)}throw new tt("ANTHROPIC_API_KEY not configured in SDK config")}function vr(e){return/^claude-(opus-4-[0-6]|sonnet-4-[0-6]|haiku-[34]|[23])/.test(e)}function Aa(e){return{anthropic:{structuredOutputMode:"jsonTool"}}}var Ta,yr,Gt=b(()=>{"use strict";Ue();Be();U();ne();Ta=require("@ai-sdk/anthropic"),yr=require("@ai-sdk/google-vertex/anthropic")});function $a(e){if(e.startsWith("claude-"))return"anthropic";if(e.startsWith("gemini-"))return"google";if($d.test(e))return"openai"}function ve(e){let{provider:t,modelId:i}=Ke(e),n=t??$a(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=xr[n];if(!a)throw new Error(`Provider "${n}" is not yet implemented. Supported providers: ${Object.keys(xr).join(", ")}. See packages/sdk-core/src/agent/llm/DESIGN.md for the roadmap.`);return a(i)}function xe(e,t){let{provider:i,modelId:n}=Ke(e),a=i??$a(n);return a==="anthropic"||a==="vertex"?Aa(n):a==="openai"||a==="azure"?wr(n):a==="bedrock"?n.startsWith("anthropic.")?Aa(n):{}:Xo(t,n)}function Me(e,t){let i=t??0,{provider:n,modelId:a}=Ke(e),o=n??$a(a),r;if((o==="anthropic"||o==="vertex")&&a.startsWith("claude-"))r=a;else if(o==="bedrock"){let s=a.match(/^(?:[a-z]{2}\.)?anthropic\.(claude-.+)$/);s&&(r=s[1])}return r!==void 0?vr(r)?i:void 0:i}var $d,xr,Ie=b(()=>{"use strict";Bt();Gt();ut();it();$d=/^(gpt-|o\d|chatgpt-)/;xr={anthropic:br,google:Vo,openai:gr}});async function q(e,t){if(t<0)return;let{page:i,domService:n}=e;return(e.domState||await n.getClickableElements(i)).selectorMap.get(t)}function Md(e){let t=e.split("/").filter(a=>a);if(t.length===0)return"*";let i=t[t.length-1],n=i.match(/^(\w+)(?:\[(\d+)\])?$/);if(n){let[,a,o]=n;return o?`${a}:nth-of-type(${o})`:a}return i}function Id(e,t=!0){try{let i=Md(e.xpath);if(e.attributes.class&&t){let a=/^[a-zA-Z_][a-zA-Z0-9_-]*$/,o=e.attributes.class.split(/\s+/);for(let r of o)r.trim()&&a.test(r)&&(i+=`.${r}`)}let n=new Set(["id","name","type","placeholder","aria-label","aria-labelledby","aria-describedby","role","for","autocomplete","required","readonly","alt","title","target"]);t&&["data-id","data-qa","data-cy","data-testid","data-handlepos"].forEach(a=>n.add(a));for(let[a,o]of Object.entries(e.attributes)){if(a==="class"||!a.trim()||!n.has(a))continue;let r=a.replace(/:/g,"\\:");if(o==="")i+=`[${r}]`;else if(/["'<>`\n\r\t]/.test(o)){let s=o;o.includes(`
|
|
160
|
+
`:"",tabsText:a}}async function xd(e,t){let{currentTabText:i,tabsText:n}=await vd(e);return{elementsText:t,currentUrl:e.url(),currentTitle:await e.title(),currentTabText:i,tabsText:n}}async function rn(e,t){let{page:i,domService:n,agentServices:a}=e,o=typeof t=="boolean"?{useCleanScreenshot:t}:t||{},r=a.getInteractiveClassNames(),s=a.getIframeFallbackDomains(),{domState:l,screenshotBase64:c,slicedScreenshotsBase64:d}=await n.getClickableElementsWithScreenshot(i,{interactiveClassNames:r,playwrightFrameFallbackDomains:s,useCleanScreenshot:o.useCleanScreenshot,useSlicedScreenshots:o.useSlicedScreenshots,resizeSlicedScreenshots:o.resizeSlicedScreenshots,useAccessibilityTree:o.useAccessibilityTree,actionIntent:o.actionIntent}),u=l.elementTree.clickableElementsToString(),h=await xd(i,u);return d&&(h.slicedScreenshotsBase64=d),{domTree:u,screenshotBase64:c,slicedScreenshotsBase64:d,domState:l,pageContext:h}}var Wt=b(()=>{"use strict"});var ue,_a,Y,Te=b(()=>{"use strict";ue=require("zod"),_a=class{constructor(){this.tools=new Map}register(e){if(this.tools.has(e.name))throw new Error(`Tool '${e.name}' is already registered`);let t={name:e.name,description:e.description,schema:e.schema,execute:e.execute,resolveArgs:e.resolveArgs,redactErrorText:e.redactErrorText,usesElementIndex:e.usesElementIndex??!1,availability:{openai:e.availability?.openai??!0,mcp:e.availability?.mcp??!0}};this.tools.set(e.name,t)}get(e){return this.tools.get(e)}has(e){return this.tools.has(e)}getToolNames(){return Array.from(this.tools.keys())}getTools(){return Array.from(this.tools.values())}async execute(e,t,i){let n=this.tools.get(e);if(!n)throw new Error(`Tool not found: ${e}`);try{let a=t?.description,o={...t};delete o.description;let r=n.resolveArgs?n.resolveArgs(o):o,s=n.schema.parse(r),l={...i,actionDescription:a,...n.resolveArgs?{rawArgs:o}:{}};return await n.execute(s,l)}catch(a){if(a instanceof ue.z.ZodError){let o=(n.redactErrorText??(r=>r))(a.issues.map(r=>`${r.path.join(".")}: ${r.message}`).join(", "));return{success:!1,error:`Invalid arguments for tool '${e}': ${o}`,actionEntity:{action_description:t?.description||`${e} (validation failed)`,action_data:{action_name:e,kwargs:t},feedback:`Validation error: ${o}`}}}throw a}}clear(){this.tools.clear()}size(){return this.tools.size}buildActionUnionSchema(){let e=this.getTools().filter(t=>t.availability.openai);return this.buildUnionSchemaFromTools(e)}buildActionUnionSchemaForTools(e,t=!1){let i=new Set(e),n=this.getTools().filter(a=>i.has(a.name));return this.buildUnionSchemaFromTools(n,t)}buildUnionSchemaFromTools(e,t=!1){if(e.length===0)return ue.z.object({done:ue.z.any()});let i=e.map(r=>{let s=r.schema;if(t&&s instanceof ue.z.ZodObject){let l=s._def.shape();s=ue.z.object({...l,description:ue.z.string().describe("Semantic, human-readable description of the action")})}if(s instanceof ue.z.ZodObject){let l=s._def.shape();Object.keys(l).length===0&&(s=ue.z.object({_empty:ue.z.boolean().optional().describe("Placeholder for an action that takes no parameters. Its value is ignored.")}))}return ue.z.object({[r.name]:s})});if(i.length===1)return i[0];let[n,a,...o]=i;return ue.z.union([n,a,...o])}},Y=new _a});function ze(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function _d(e){return!e.keys?.length&&!e.properties&&!e.items&&!e.branches&&!e.additional}function ka(e){let t=e.type;if(t==="null"||Array.isArray(t)&&t.includes("null"))return!0;for(let i of["anyOf","oneOf"]){let n=e[i];if(Array.isArray(n)&&n.some(a=>ze(a)&&ka(a)))return!0}return kd.every(i=>e[i]===void 0)}function Sd(e){if(ka(e))return e;if(typeof e.type=="string"&&e.enum===void 0&&e.const===void 0)return{...e,type:[e.type,"null"]};let{description:t,...i}=e;return{...t!==void 0?{description:t}:{},anyOf:[i,{type:"null"}]}}function gt(e){if(!ze(e))return{schema:e};let t={...e},i={},n=e.properties;if(ze(n)){let a=new Set(Array.isArray(e.required)?e.required:[]),o=Object.keys(n),r=[],s={},l={};for(let c of o){let d=n[c],u=gt(d),h=u.schema;if(ze(h)&&"default"in h){let{default:p,...w}=h;h=w}a.has(c)||ze(h)&&!ka(h)&&(r.push(c),h=Sd(h)),l[c]=h,u.promoted&&(s[c]=u.promoted)}t.properties=l,t.required=o,t.additionalProperties=!1,r.length>0&&(i.keys=r),Object.keys(s).length>0&&(i.properties=s)}if(ze(e.additionalProperties)){let a=gt(e.additionalProperties);t.additionalProperties=a.schema,a.promoted&&(i.additional=a.promoted)}if(Array.isArray(e.items)){let a=e.items.map(o=>gt(o));t.items=a.map(o=>o.schema),a.some(o=>o.promoted)&&(i.items=a.map(o=>o.promoted))}else if(e.items!==void 0){let a=gt(e.items);t.items=a.schema,a.promoted&&(i.items=a.promoted)}for(let a of["anyOf","oneOf","allOf"]){let o=e[a];if(!Array.isArray(o))continue;let r=o.map(s=>gt(s));t[a]=r.map(s=>s.schema),r.some(s=>s.promoted)&&(i.branches=r.map((s,l)=>{let c=o[l],d=ze(c)?c.properties:void 0,u=ze(d)?Object.keys(d):void 0;if(!(!s.promoted&&!u))return{...s.promoted??{},...u?{declared:u}:{}}}))}return{schema:t,promoted:_d(i)?void 0:i}}function hr(e){if(e.items!==void 0)return e.items;for(let t of e.branches??[]){let i=t&&hr(t);if(i!==void 0)return i}}function Ed(e){if(!e||e.length===0)return[];let t=new Set;for(let i of e){if(!i?.declared)continue;let n=new Set(i.keys??[]);for(let a of i.declared)n.has(a)||t.add(a)}return t.size===0?e:e.map(i=>{if(!i?.keys?.length)return i;let n=i.keys.filter(a=>!t.has(a));return n.length===i.keys.length?i:{...i,keys:n}})}function jt(e,t){if(t===void 0||e===null||typeof e!="object")return e;if(Array.isArray(e)){let o=hr(t);return o===void 0?e:e.map((r,s)=>jt(r,Array.isArray(o)?o[s]:o))}let i=e,n=!1,a=()=>(n||(i={...i},n=!0),i);for(let o of t.keys??[])i[o]===null&&delete a()[o];for(let[o,r]of Object.entries(t.properties??{})){if(!(o in i))continue;let s=jt(i[o],r);s!==i[o]&&(a()[o]=s)}if(t.additional)for(let o of Object.keys(i)){let r=jt(i[o],t.additional);r!==i[o]&&(a()[o]=r)}for(let o of Ed(t.branches)){let r=jt(i,o);r!==i&&(i=r,n=!0)}return i}function sn(e){let{schema:t,promoted:i}=gt((0,ur.zodToJsonSchema)(e,{$refStrategy:"none"}));return(0,dr.jsonSchema)(t,{validate:async n=>{let a=await e.safeParseAsync(jt(n,i));return a.success?{success:!0,value:a.data}:{success:!1,error:a.error}}})}var dr,ur,kd,Ut=b(()=>{"use strict";dr=require("ai"),ur=require("zod-to-json-schema");kd=["type","enum","const","anyOf","oneOf","allOf","not","$ref"]});function Ae(e,t){if(!e||typeof e!="object")return null;let i=e;return{prompt_tokens:i.promptTokens||i.inputTokens||0,completion_tokens:i.completionTokens||i.outputTokens||0,total_tokens:i.totalTokens||0,model:Ke(t).modelId}}var Ve=b(()=>{"use strict";it()});function pr(){let e=V().llmCallTimeoutMs;return e===void 0?da:e}async function be(e){let t=pr(),i=t>0?AbortSignal.timeout(t):void 0;try{return await e(i)}catch(n){throw i?.aborted&&fr(n)?new mr(t):n}}function fr(e,t=new Set){if(typeof e!="object"||e===null||t.has(e))return!1;t.add(e);let i=e.name;if(i==="TimeoutError"||i==="AbortError")return!0;let n=e.cause;return n!==void 0&&fr(n,t)}var Sa,mr,$e=b(()=>{"use strict";ne();Sa=2,mr=class extends Error{constructor(e){super(`LLM call exceeded the ${Math.round(e/1e3)}s ceiling (SdkConfig.llmCallTimeoutMs). This bounds the whole call including the AI SDK's internal retries and backoff, so the provider was most likely slow or degraded rather than the request being malformed. Raise llmCallTimeoutMs for genuinely long generations, or set it to 0 to disable the ceiling.`),this.name="LlmCallTimeoutError",this.timeoutMs=e}}});function Td(e){if(!e)return!1;let t=e.trim().toLowerCase();return t==="1"||t==="true"||t==="yes"||t==="on"}function Ad(){return Td(V().env?.ANTHROPIC_MODELS_USE_VERTEXAI)}function wr(e){let t=V();if(Ad()){let a=t.env?.GOOGLE_CLOUD_PROJECT,o=t.env?.GOOGLE_CLOUD_LOCATION;if(!a)throw new Error("GOOGLE_CLOUD_PROJECT is required when ANTHROPIC_MODELS_USE_VERTEXAI is enabled");if(!o)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=${a}, location=${o}`),(0,gr.createVertexAnthropic)({project:a,location:o})(e)}let i=t.env?.ANTHROPIC_API_KEY;if(i)return g.debug(`Using Anthropic provider: model=${e}`),(0,Ea.createAnthropic)({apiKey:i})(e);let n=t.env?.SHIPLIGHT_API_TOKEN;if(n){let a=Uo(n,t.env?.SHIPLIGHT_API_URL);return g.debug(`Using Shiplight LLM proxy (Anthropic): model=${e}, baseURL=${a}`),(0,Ea.createAnthropic)({apiKey:n,baseURL:a})(e)}throw new tt("ANTHROPIC_API_KEY not configured in SDK config")}function yr(e){return/^claude-(opus-4-[0-6]|sonnet-4-[0-6]|haiku-[34]|[23])/.test(e)}function Ta(e){return{anthropic:{structuredOutputMode:"jsonTool"}}}var Ea,gr,Bt=b(()=>{"use strict";Ue();Be();U();ne();Ea=require("@ai-sdk/anthropic"),gr=require("@ai-sdk/google-vertex/anthropic")});function br(e){let t=V(),i=t.env?.OPENAI_API_KEY;if(i){let a=t.env?.OPENAI_BASE_URL;return g.debug(`Using OpenAI provider: model=${e}${a?`, baseURL=${a}`:""}`),(0,Aa.createOpenAI)({apiKey:i,baseURL:a})(e)}let n=t.env?.SHIPLIGHT_API_TOKEN;if(n){let a=jo(n,t.env?.SHIPLIGHT_API_URL);return g.debug(`Using Shiplight LLM proxy (OpenAI): model=${e}, baseURL=${a}`),(0,Aa.createOpenAI)({apiKey:n,baseURL:a})(e)}throw new tt("OPENAI_API_KEY not configured in SDK config")}function vr(e){return{}}var Aa,Gt=b(()=>{"use strict";Ue();Be();U();ne();Aa=require("@ai-sdk/openai")});function $a(e){if(e.startsWith("claude-"))return"anthropic";if(e.startsWith("gemini-"))return"google";if($d.test(e))return"openai"}function ve(e){let{provider:t,modelId:i}=Ke(e),n=t??$a(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=xr[n];if(!a)throw new Error(`Provider "${n}" is not yet implemented. Supported providers: ${Object.keys(xr).join(", ")}. See packages/sdk-core/src/agent/llm/DESIGN.md for the roadmap.`);return a(i)}function xe(e,t){let{provider:i,modelId:n}=Ke(e),a=i??$a(n);return a==="anthropic"||a==="vertex"?Ta(n):a==="openai"||a==="azure"?vr(n):a==="bedrock"?n.startsWith("anthropic.")?Ta(n):{}:Xo(t,n)}function Me(e,t){let i=t??0,{provider:n,modelId:a}=Ke(e),o=n??$a(a),r;if((o==="anthropic"||o==="vertex")&&a.startsWith("claude-"))r=a;else if(o==="bedrock"){let s=a.match(/^(?:[a-z]{2}\.)?anthropic\.(claude-.+)$/);s&&(r=s[1])}return r!==void 0?yr(r)?i:void 0:i}var $d,xr,Ie=b(()=>{"use strict";Bt();ut();Gt();it();$d=/^(gpt-|o\d|chatgpt-)/;xr={anthropic:wr,google:Vo,openai:br}});async function q(e,t){if(t<0)return;let{page:i,domService:n}=e;return(e.domState||await n.getClickableElements(i)).selectorMap.get(t)}function Md(e){let t=e.split("/").filter(a=>a);if(t.length===0)return"*";let i=t[t.length-1],n=i.match(/^(\w+)(?:\[(\d+)\])?$/);if(n){let[,a,o]=n;return o?`${a}:nth-of-type(${o})`:a}return i}function Id(e,t=!0){try{let i=Md(e.xpath);if(e.attributes.class&&t){let a=/^[a-zA-Z_][a-zA-Z0-9_-]*$/,o=e.attributes.class.split(/\s+/);for(let r of o)r.trim()&&a.test(r)&&(i+=`.${r}`)}let n=new Set(["id","name","type","placeholder","aria-label","aria-labelledby","aria-describedby","role","for","autocomplete","required","readonly","alt","title","target"]);t&&["data-id","data-qa","data-cy","data-testid","data-handlepos"].forEach(a=>n.add(a));for(let[a,o]of Object.entries(e.attributes)){if(a==="class"||!a.trim()||!n.has(a))continue;let r=a.replace(/:/g,"\\:");if(o==="")i+=`[${r}]`;else if(/["'<>`\n\r\t]/.test(o)){let s=o;o.includes(`
|
|
161
161
|
`)&&(s=o.split(`
|
|
162
162
|
`)[0]),s=s.replace(/\s+/g," ").trim();let l=s.replace(/"/g,'\\"');i+=`[${r}*="${l}"]`}else i+=`[${r}="${o}"]`}return i}catch{return`${e.tagName||"*"}[highlight_index='${e.highlightIndex}']`}}function Cd(e){let t=e.attributes;if(t.title)return`iframe[title="${t.title.replace(/"/g,'\\"')}"]`;if(t.id)return`iframe#${t.id}`;if(t.name)return`iframe[name="${t.name.replace(/"/g,'\\"')}"]`;if(t.src){try{let i=new URL(t.src);if(i.protocol==="chrome-extension:")return`iframe[src^="${i.origin}"]`}catch{}return`iframe[src="${t.src.replace(/"/g,'\\"')}"]`}return Id(e,!1)}function _r(e){let t=[],i=e;for(;i&&i.parent!==null;){let o=i.parent;t.push(o),i=o}t.reverse();let n=[],a=t.filter(o=>o.tagName==="iframe");for(let o of a){let r=Cd(o);g.debug("[frame-path] iframe attrs:",JSON.stringify(o.attributes),"\u2192",r),n.push(r)}return n}async function W(e,t){let i=null,n=_r(t);return t.xpath&&(i=await ya(e,t.xpath,n,t.shadowHostXPaths??[])),{locator:i||void 0,xpath:i?void 0:t.xpath,frame_path:n}}var ee=b(()=>{"use strict";Qe();U()});function Pd(e){let t=e.toLowerCase();return[/\b(type|enter|input|fill|write|set)\b/,/\b(text|value|field|box)\b.*\b(to|with|as)\b/,/\b(username|password|email|search|query)\b/].some(i=>i.test(t))?"input":[/\bscroll\b/,/\b(scroll|swipe)\s*(up|down|left|right)\b/,/\b(page|move)\s*(down|up)\b/].some(i=>i.test(t))?"scroll":[/\b(click|tap|press|select|choose|pick|check|toggle)\b/,/\b(open|close|submit|confirm|cancel|dismiss)\b/,/\b(button|link|menu|dropdown|checkbox|radio)\b/].some(i=>i.test(t))?"click":"all"}function Od(e){if(!e)return null;if(e instanceof URL)return e.href;if(typeof e=="object"&&e.href)return String(e.href);if(typeof e=="object"&&typeof e.toString=="function"){let t=e.toString();if(t.startsWith("http://")||t.startsWith("https://"))return t}return typeof e=="string"&&(e.startsWith("http://")||e.startsWith("https://"))?e:null}function Nd(e){return e.map(t=>({role:t.role,content:Array.isArray(t.content)?t.content.map(i=>{if(i.type==="file"){let n=i.data,a=Od(n);if(a)return{type:"image",file:a};let o=typeof n=="string"?n:"";return{type:"image",file:o.startsWith("data:")?o:`data:image/png;base64,${o}`}}return{type:"text",text:i.text}}):t.content}))}async function kr(e,t,i={}){let{page:n,agentServices:a}=t,o=a.getModel(),r=a.retrieveKnowledges(e).catch(N=>(T.log(`Failed to retrieve knowledges: ${N.message}`),[])),s=a.isSlicedScreenshotsEnabled(),l=a.isResizeSlicedScreenshotsEnabled(),c=a.isKnowledgeImagesEnabled(),d=a.isAccessibilityTreeEnabled(),u=a.isActionIntentFilteringEnabled(),h=u?Pd(e):"all";u&&h!=="all"&&T.log(`Action intent filtering: detected '${h}' intent from statement`);let{screenshotBase64:p,domState:w,pageContext:f}=await rn(t,{useSlicedScreenshots:s,resizeSlicedScreenshots:l,useAccessibilityTree:d,actionIntent:h});t.domState=w;let y=new ua(Y).getToolDefinitions().map(N=>{let J=N.function;return`${J.name}: ${J.description}
|
|
163
163
|
Parameters: ${JSON.stringify(J.parameters,null,2)}`}).join(`
|
|
@@ -4118,12 +4118,12 @@ Based on the above information, please determine if the statement is true.
|
|
|
4118
4118
|
return (async () => {
|
|
4119
4119
|
${a}
|
|
4120
4120
|
})();
|
|
4121
|
-
`)(e,o)}transpile(e){let t=this.generateFunctionCallCode(e.action_data?.kwargs||{});return t?[t.endsWith(";")?t:`${t};`]:["// Skipping function: missing functionName"]}generateFunctionCallCode(e){let t=e.functionName;if(!t)return null;let i;if(Array.isArray(e.args))i=e.args.map(String);else if(Array.isArray(e.parameterNames)){let r=e.parameterValues||[];i=e.parameterNames.map((s,l)=>l<r.length?String(r[l]):"undefined")}else return`await ${t}()`;if(i.length===0)return`await ${t}()`;let n=["page","testContext","request","agent"],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(", ")})`}}});var vn=b(()=>{"use strict";yt()});var Ur,Zt=b(()=>{"use strict";Ur=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e[e.SILENT=4]="SILENT",e))(Ur||{})});var vt={};lt(vt,{evaluateStatement:()=>kn,executeAction:()=>Qt,executeStep:()=>_n,generateActionStep:()=>xn,runTask:()=>Sn});var xt=b(()=>{"use strict";ei();dn();ln();Vi();ft();en();nn();ct();tn();Ge();on();Wt();Ht();Te();Lt();Ut();vn();nt();Vt();yt();Xt();Jt();qt();re();Ve();$e();Ie();Bt();
|
|
4121
|
+
`)(e,o)}transpile(e){let t=this.generateFunctionCallCode(e.action_data?.kwargs||{});return t?[t.endsWith(";")?t:`${t};`]:["// Skipping function: missing functionName"]}generateFunctionCallCode(e){let t=e.functionName;if(!t)return null;let i;if(Array.isArray(e.args))i=e.args.map(String);else if(Array.isArray(e.parameterNames)){let r=e.parameterValues||[];i=e.parameterNames.map((s,l)=>l<r.length?String(r[l]):"undefined")}else return`await ${t}()`;if(i.length===0)return`await ${t}()`;let n=["page","testContext","request","agent"],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(", ")})`}}});var vn=b(()=>{"use strict";yt()});var Ur,Zt=b(()=>{"use strict";Ur=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e[e.SILENT=4]="SILENT",e))(Ur||{})});var vt={};lt(vt,{evaluateStatement:()=>kn,executeAction:()=>Qt,executeStep:()=>_n,generateActionStep:()=>xn,runTask:()=>Sn});var xt=b(()=>{"use strict";ei();dn();ln();Vi();ft();en();nn();ct();tn();Ge();on();Wt();Ht();Te();Lt();Ut();vn();nt();Vt();yt();Xt();Jt();qt();re();Ve();$e();Ie();Bt();ut();Gt();Ue();Be();dt();it();ee();Qe();U();ne();Zt();B();Se()});var Da,Br,qg,En=b(()=>{"use strict";Da=require("zod"),Br=class{async execute(e,t,i){let n=t.action_data;if(!n)throw new Error("Action data not found");let a=n.kwargs.statement;if(!a)throw new Error("Missing statement for ai_action");let o=n.kwargs.use_pure_vision,{executeStep:r}=await Promise.resolve().then(()=>(xt(),vt)),s=await r(a,e,i,{usePureVision:o});if(s.status!=="success")throw new Error(s.error||"Action execution failed")}transpile(e,t){let i=e.action_data?.kwargs?.statement;if(!i)return["// Skipping ai_action: missing statement"];let n=JSON.stringify(i),a=e.action_data?.kwargs?.use_pure_vision;return[`await agent.execute(page, ${n}, '${t||""}', ${a});`]}},qg=Da.z.object({statement:Da.z.string().describe('The action to perform (e.g., "click the submit button")')})});var Ra,Gr,ew,Tn=b(()=>{"use strict";Ra=require("zod"),Gr=class{async execute(e,t,i){let n=t.action_data;if(!n)throw new Error("Action data not found");let a=n.kwargs.statement;if(!a)throw new Error("Missing statement for ai_step");let{runTask:o}=await Promise.resolve().then(()=>(xt(),vt)),r=await o(a,e,i);if(r.status!=="success")throw new Error(r.error||"Task execution failed")}transpile(e,t){let i=e.action_data?.kwargs?.statement;return i?[`await agent.run(page, ${JSON.stringify(i)}, '${t||""}');`]:["// Skipping ai_step: missing statement"]}},ew=Ra.z.object({statement:Ra.z.string().describe('The complete step to execute (e.g., "fill in the login form and submit")')})});var Kr,An=b(()=>{"use strict";B();P();Kr=class{async execute(e,t,i){let n=t.action_data;if(!n)throw new Error("Action data not found");if(typeof n.kwargs.relative_x=="number"&&typeof n.kwargs.relative_y=="number"){let a=F(e,t);if(a){await a.waitFor({state:"attached",timeout:R(i,t.action_data?.kwargs?.timeout_ms)});let o=await a.boundingBox();if(o){let r=o.x+n.kwargs.relative_x+o.width/2,s=o.y+n.kwargs.relative_y+o.height/2;await e.mouse.move(r,s),await e.waitForTimeout(200),await e.mouse.click(r,s),await e.waitForTimeout(500)}}else throw new Error("Element-anchored coordinates provided but no locator found")}else if(typeof n.kwargs.x=="number"&&typeof n.kwargs.y=="number")await e.mouse.move(n.kwargs.x,n.kwargs.y),await e.waitForTimeout(200),await e.mouse.click(n.kwargs.x,n.kwargs.y),await e.waitForTimeout(500);else throw new Error("Missing or invalid coordinates")}transpile(e){let t=e.action_data?.kwargs||{},i=[];return typeof t.relative_x=="number"&&typeof t.relative_y=="number"?(i.push(`action_data: { kwargs: { relative_x: ${t.relative_x}, relative_y: ${t.relative_y} } }`),e.locator?i.push(`locator: ${JSON.stringify(e.locator)}`):e.xpath&&i.push(`xpath: ${JSON.stringify(e.xpath)}`),e.frame_path&&e.frame_path.length>0&&i.push(`frame_path: ${JSON.stringify(e.frame_path)}`)):typeof t.x=="number"&&typeof t.y=="number"&&i.push(`action_data: { kwargs: { x: ${t.x}, y: ${t.y} } }`),['await agent.execAction("click_by_coordinates", page, {',...i.map(n=>` ${n},`),"});"]}}});async function Gd(e,t,i,n){return{...await W(i,t),action_description:e,action_data:{action_name:"set_date_for_native_date_picker",kwargs:{date:n}}}}function Fa(e,t){return{action_description:`${e} (failed - element not found)`,action_data:{action_name:"set_date_for_native_date_picker",kwargs:t},feedback:"Element not found in DOM"}}function Vr(e,t){e.register({name:"set_date_for_native_date_picker",description:`Set a date in a native HTML date picker input (<input type="date">).
|
|
4122
4122
|
|
|
4123
4123
|
IMPORTANT: ONLY use this action for input elements that have type="date" attribute (native HTML date picker).
|
|
4124
4124
|
Do NOT use it for custom/non-native date pickers
|
|
4125
4125
|
|
|
4126
|
-
The date must be in YYYY-MM-DD format (e.g., 2024-03-15).`,schema:Kd,usesElementIndex:!0,async execute(i,n){let{element_index:a,date:o}=i,{page:r,agentServices:s}=n;try{let l=await q(n,a);if(!l)return{success:!1,error:`Date picker element with index ${a} not found`,actionEntity:Fa(`Set date to ${o} on element ${a}`,{index:a,date:o})};let c=l.attributes.type;if(c!=="date")return{success:!1,error:`Element ${a} is not a native date picker (type="${c}"). This action only works with <input type="date">.`,actionEntity:Fa(`Set date to ${o} on element ${a}`,{index:a,date:o})};let d=await Gd(`Set date to ${o} on element ${a}`,l,r,o);return await t.execute(r,d,s),{success:!0,actionEntity:d,message:`Set date to ${o} on element ${a}`}}catch(l){return{success:!1,error:l.message,actionEntity:Fa(`Set date to ${o} on element ${a}`,{index:a,date:o})}}}})}var ti,zr,Kd,ii=b(()=>{"use strict";ee();B();ti=require("zod");P();zr=class{async execute(e,t,i){let n=t.action_data;if(!n)throw new Error("Action data not found");let a=n.kwargs.date;if(!a)throw new Error("Date value is required");if(!/^\d{4}-\d{2}-\d{2}$/.test(a))throw new Error(`Invalid date format: ${a}. Expected format: YYYY-MM-DD (e.g., 2024-03-15)`);let o=i.replaceVariables(String(a)),r=F(e,t);if(r){let s=await r.getAttribute("type").catch(()=>null);if(s&&s!=="date")throw new Error(`Element is not a native date picker (type="${s}"). This action only works with <input type="date">. For custom date pickers, use AI-powered actions.`);await r.fill(o,{timeout:R(i,t.action_data?.kwargs?.timeout_ms)})}else throw new Error("No locator found for set_date_for_native_date_picker action")}transpile(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},`),"});"]}};Kd=ti.z.object({element_index:ti.z.number().int().describe("Index of the native date picker input element"),date:ti.z.string().regex(/^\d{4}-\d{2}-\d{2}$/).describe("Date in YYYY-MM-DD format (e.g., 2024-03-15)"),timeout_ms:ti.z.number().optional().describe("Per-action timeout in ms. Overrides the default 5s action timeout. Set this only when the instruction states a timeout; otherwise leave it unset so the configured default applies.")})});function Jr(e,t){e.register({name:"switch_tab",description:"Switch to a different browser tab by index (0-based).",schema:zd,async execute(i,n){let a=i.tab_index,{page:o,agentServices:r,actionDescription:s}=n;try{let l={action_description:s||`Switch to tab ${a}`,action_data:{action_name:"switch_tab",kwargs:{page_id:a}}};return await t.execute(o,l,r),{success:!0,actionEntity:l,message:`Switched to tab ${a}`}}catch(l){return{success:!1,error:l.message,actionEntity:{action_description:(s||`Switch to tab ${a}`)+" (failed)",action_data:{action_name:"switch_tab",kwargs:{page_id:a}},feedback:l.message}}}}})}var Ha,Xr,zd,ni=b(()=>{"use strict";Ha=require("zod"),Xr=class{async execute(e,t,i){let n=t.action_data;if(!n)throw new Error("Action data not found");let a=n.kwargs.page_id??n.kwargs.tab_index??0;if(typeof a=="number"){let o=e.context().pages(),r=a===-1?o.length-1:a;if(i){let s=await i.switchTab(r);await s.waitForLoadState("load",{timeout:15e3}).catch(()=>{}),await s.waitForTimeout(500)}}else throw new Error("Missing page_id for switch_tab action")}transpile(e){return['await agent.execAction("switch_tab", page, {',` action_data: { kwargs: { page_id: ${e.action_data?.kwargs?.page_id??e.action_data?.kwargs?.tab_index??0} } },`,"});"]}},zd=Ha.z.object({tab_index:Ha.z.number().int().nonnegative().describe("Index of the tab to switch to (0-based). Use 0 for first tab, 1 for second, etc.")})});async function qr(e,t,i,n){let{useFileInput:a,timeout:o,mockShowOpenFilePicker:r}=n;if(r){g.info("Using mockShowOpenFilePicker approach");let s=i.map(l=>({path:l,buffer:new Uint8Array(Yr.default.readFileSync(l))}));await e.evaluate(l=>{window.__pw_showOpenFilePicker_mock_files=l},s),await t.click({timeout:o}),await e.waitForTimeout(3e3),await e.evaluate(()=>{delete window.__pw_showOpenFilePicker_mock_files})}else if(a)g.info("Using direct file input approach"),await t.setInputFiles(i,{timeout:o}),await e.waitForTimeout(3e3);else{g.info("Using file chooser approach");let s=e.waitForEvent("filechooser",{timeout:o});s.catch(()=>{}),await t.click({timeout:o}),await(await s).setFiles(i),await e.waitForTimeout(3e3)}g.info(`Successfully uploaded ${i.length} file(s)`)}var Yr,ai=b(()=>{"use strict";U();Yr=ie(require("fs"),1)});async function Vd(e,t,i={},n){return{...await W(t,e),action_description:n||"Upload file to element",action_data:{action_name:"upload_file",kwargs:{...i}}}}function Zr(e,t){return{action_description:`${e} (failed - element not found)`,action_data:{action_name:"upload_file",kwargs:t},feedback:"Element not found in DOM"}}function es(e,t){e.register({name:"upload_file",description:'Click on target element (usually contains hints like "Upload file" or "Choose file" etc.) to trigger the file upload dialog, and choose the files to upload',schema:Xd,usesElementIndex:!0,async execute(i,n){let{element_index:a,paths:o}=i,{page:r,agentServices:s,actionDescription:l}=n;try{let c=await q(n,a);if(!c)return{success:!1,error:`File input element with index ${a} not found`,actionEntity:Zr(l||`Upload file to element ${a}`,{index:a,paths:o})};let d=await Vd(c,r,{paths:o},l);return await t.execute(r,d,s),{success:!0,actionEntity:d,message:`Uploaded file to element ${a}`}}catch(c){return{success:!1,error:c.message,actionEntity:Zr(l||`Upload file to element ${a}`,{index:a,paths:o})}}}})}var ae,Qr,Xd,ww,oi=b(()=>{"use strict";ai();ee();B();ae=require("zod");P();Qr=class{async execute(e,t,i){let n=t.action_data;if(!n)throw new Error("Action data not found");let a=[];if(n.kwargs.paths?a=Array.isArray(n.kwargs.paths)?n.kwargs.paths:[n.kwargs.paths]:n.kwargs.path&&(a=Array.isArray(n.kwargs.path)?n.kwargs.path:[n.kwargs.path]),a.length===0)throw new Error("No file paths provided for upload_file action");await i.downloadTestDataFiles(a);let o=a.map(c=>i.getTestDataFilePath(c)),r=F(e,t);if(!r)throw new Error("Missing locator for upload_file action");let s=n.kwargs.use_file_input||!1,l=i.getActionSettings().mock_show_open_file_picker??!1;await qr(e,r,o,{useFileInput:s,timeout:R(i,t.action_data?.kwargs?.timeout_ms),mockShowOpenFilePicker:l})}transpile(e){let t=e.action_data?.kwargs||{},i=[],n={};return t.paths?n.paths=t.paths:t.path&&(n.path=t.path),t.use_file_input&&(n.use_file_input=!0),i.push(`action_data: { kwargs: ${JSON.stringify(n)} }`),e.locator?i.push(`locator: ${JSON.stringify(e.locator)}`):e.xpath&&i.push(`xpath: ${JSON.stringify(e.xpath)}`),e.frame_path&&e.frame_path.length>0&&i.push(`frame_path: ${JSON.stringify(e.frame_path)}`),['await agent.execAction("upload_file", page, {',...i.map(a=>` ${a},`),"});"]}};Xd=ae.z.object({element_index:ae.z.number().int().describe("Index of the target element to trigger the file upload dialog"),paths:ae.z.union([ae.z.string(),ae.z.array(ae.z.string())]).describe('Path to a file, relative to the test project root (e.g. "fixtures/data.csv"), or an array of such paths.'),timeout_ms:ae.z.number().optional().describe("Per-action timeout in ms. Overrides the default 5s action timeout. Set this only when the instruction states a timeout; otherwise leave it unset so the configured default applies.")});ww=ae.z.object({element_index:ae.z.number().int().describe("Index of the file input element"),paths:ae.z.union([ae.z.string(),ae.z.array(ae.z.string())]).describe('Path to a file, relative to the test project root (e.g. "fixtures/data.csv"), or an array of such paths.'),timeout_ms:ae.z.number().optional().describe("Per-action timeout in ms. Overrides the default 5s action timeout. Set this only when the instruction states a timeout; otherwise leave it unset so the configured default applies.")})});function is(e,t){e.register({name:"wait",description:"Wait for a specified number of seconds before continuing.",schema:Jd,async execute(i,n){let{seconds:a}=i,{page:o,agentServices:r,actionDescription:s}=n;try{let l={action_description:s||`Wait ${a} seconds`,action_data:{action_name:"wait",kwargs:{seconds:a}}};return await t.execute(o,l,r),{success:!0,actionEntity:l,message:`Waited ${a} seconds`}}catch(l){return{success:!1,error:l.message,actionEntity:{action_description:(s||`Wait ${a} seconds`)+" (failed)",action_data:{action_name:"wait",kwargs:{seconds:a}},feedback:l.message}}}}})}var Wa,ts,Jd,ri=b(()=>{"use strict";Wa=require("zod"),ts=class{async execute(e,t){let i=t.action_data;if(!i)throw new Error("Action data not found");let n=i.kwargs.seconds||1;await e.waitForTimeout(n*1e3)}transpile(e){return[`await page.waitForTimeout(${(e.action_data?.kwargs?.seconds||1)*1e3});`]}},Jd=Wa.z.object({seconds:Wa.z.number().positive().describe("Number of seconds to wait")})});function as(e,t){e.register({name:"wait_for_download_complete",description:"Wait for an in-progress download to complete.",schema:Yd,async execute(i,n){let{timeout_seconds:a=10}=i,{page:o,agentServices:r}=n;try{let s={action_description:`Wait for download to complete (timeout: ${a}s)`,action_data:{action_name:"wait_for_download_complete",kwargs:{timeout_seconds:a}}};return await t.execute(o,s,r),{success:!0,actionEntity:s,message:"Download completed"}}catch(s){return{success:!1,error:s.message,actionEntity:{action_description:"Wait for download to complete (failed)",action_data:{action_name:"wait_for_download_complete",kwargs:{timeout_seconds:a}},feedback:s.message}}}}})}var ja,ns,Yd,si=b(()=>{"use strict";ja=require("zod"),ns=class{async execute(e,t,i){let n=t.action_data;if(!n)throw new Error("Action data not found");let a=n.kwargs.timeout_seconds||10;await i.waitForDownloadComplete(e,a)}transpile(e){return['await agent.execAction("wait_for_download_complete", page, {',` action_data: { kwargs: { timeout_seconds: ${e.action_data?.kwargs?.timeout_seconds||10} } },`,"});"]}},Yd=ja.z.object({timeout_seconds:ja.z.number().positive().optional().describe("Maximum time in seconds to wait for download to complete. Set this only when the instruction states a timeout; otherwise leave it unset so the 10s default applies.")})});function ls(e){if(e!==null&&typeof e=="object"){for(let t of Object.values(e))ls(t);Object.freeze(e)}return e}var k,Iw,Fw,jw,Gw,Mn,rs,Tw,ss,qd,Zd,$n,Aw,$w,Ua,Ba,Qd,os,eu,li,tu,iu,nu,he,au,ou,Mw,Ww,zw,ru,Vw,su,Xw,Ye=b(()=>{"use strict";Se();k=require("zod"),Iw=require("yaml"),Fw=require("uuid"),jw=require("yaml"),Gw=require("uuid"),Mn=(e=>(e.JS_CODE="JS_CODE",e.AI_MODE="AI_MODE",e))(Mn||{}),rs=112,Tw=1080-rs,ss=(e=>(e.Chromium="chromium",e.Firefox="firefox",e.Webkit="webkit",e))(ss||{}),qd={"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"}},Zd={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"]},$n=(e,t=!1)=>{let i=["chromium"];return t&&i.push("webkit"),Zd[e].map(n=>qd[n]).filter(n=>n.defaultBrowserType&&i.includes(n.defaultBrowserType))},Aw={desktop:{label:"Desktop",type:"desktop",devices:$n("desktop")},mobile:{label:"Mobile Web",type:"mobile",devices:$n("mobile")}},$w={desktop:{label:"Desktop",type:"desktop",devices:$n("desktop",!0)},mobile:{label:"Mobile Web",type:"mobile",devices:$n("mobile",!0)}},Ua=(e=>(e.PASSWORD="password",e.OAUTH2="oauth2",e.SSO="sso",e.API="api",e))(Ua||{}),Ba=(e=>(e.SMS="sms",e.EMAIL="email",e.TOTP="totp",e))(Ba||{}),Qd=k.z.enum(["JS_CODE","AI_MODE"]),os=k.z.object({type:Qd,expression:k.z.string()}),eu=k.z.enum(["DRAFT","STEP","ACTION","IF_ELSE","WHILE_LOOP"]),li=k.z.object({uid:k.z.string(),type:eu,comment:k.z.string().optional()}),tu=k.z.object({action_data:k.z.object({action_name:k.z.string(),kwargs:k.z.record(k.z.any()).optional(),args:k.z.array(k.z.any()).optional()}),action_description:k.z.string().optional(),url:k.z.string().optional(),xpath:k.z.string().nullable().optional(),locator:k.z.string().nullable().optional(),css_selector:k.z.string().nullable().optional(),unique_selector:k.z.string().nullable().optional(),element_index:k.z.number().nullable().optional(),frame_path:k.z.array(k.z.any()).optional(),artifacts:k.z.record(k.z.any()).optional(),feedback:k.z.string().optional(),original_browser_use_action:k.z.any().optional()}).passthrough(),iu=li.extend({type:k.z.literal("DRAFT"),description:k.z.string()}),nu=li.extend({type:k.z.literal("ACTION"),description:k.z.string(),action_entity:tu.optional(),locator:k.z.string().optional(),use_pure_vision:k.z.boolean().optional()}),he=k.z.lazy(()=>k.z.union([iu,nu,li.extend({type:k.z.literal("STEP"),description:k.z.string().optional().default(""),statements:k.z.array(he),reference_id:k.z.number().optional(),template_path:k.z.string().optional(),template_params:k.z.record(k.z.string()).optional()}),li.extend({type:k.z.literal("IF_ELSE"),description:k.z.string().optional(),condition:os,then:k.z.array(he),else:k.z.array(he).optional()}),li.extend({type:k.z.literal("WHILE_LOOP"),description:k.z.string().optional(),condition:os,body:k.z.array(he),timeout_ms:k.z.number().optional()})])),au=k.z.object({name:k.z.string(),statements:k.z.array(he),teardown:k.z.array(he).optional(),skip:k.z.union([k.z.boolean(),k.z.string()]).optional(),timeout:k.z.number().optional(),fail:k.z.union([k.z.boolean(),k.z.string()]).optional(),only:k.z.boolean().optional(),slow:k.z.boolean().optional()}),ou=k.z.object({tests:k.z.array(au).min(1),beforeAll:k.z.array(he).optional(),afterAll:k.z.array(he).optional(),beforeEach:k.z.array(he).optional(),afterEach:k.z.array(he).optional()}),Mw=k.z.object({comment:k.z.string().optional(),version:k.z.string().optional(),goal:k.z.string().optional(),url:k.z.string().optional(),baseURL:k.z.string().optional(),final_feedback:k.z.string().optional(),completed:k.z.boolean().optional(),success:k.z.boolean().optional(),statements:k.z.array(he).optional(),teardown:k.z.array(he).optional(),last_modified_at:k.z.string().optional(),testGroup:ou.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"}),Ww=1024*1024,zw=Object.freeze(["lite","standard","pro"]),ru=1,Vw=Object.freeze(["WEB_AGENT_MODEL","WEB_AGENT_FALLBACK_MODELS","COMPUTER_USE_MODEL"]),su=ls({version:ru,defaultTier:"lite",tiers:{lite:{webagent:{primary:"google:gemini-3-flash-preview",fallbacks:["anthropic:claude-haiku-4-5","openai:gpt-5.6-luna"]}},standard:{webagent:{primary:"google:gemini-3.5-flash",fallbacks:["anthropic:claude-sonnet-5","openai:gpt-5.6-terra"]}},pro:{webagent:{primary:"anthropic:claude-opus-4-8",fallbacks:["openai:gpt-5.6-sol","anthropic:claude-opus-4-7"]}}},computerUse:{primary:"google:gemini-3-flash-preview",fallbacks:[]}});Xw=Object.freeze([...su.tiers.standard.webagent.fallbacks])});var _t=b(()=>{"use strict"});async function hu(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 h=u.toLowerCase();return h.startsWith("data:")||h.startsWith("blob:")?!0:r.some(p=>h.includes(p))},l=u=>{let h=u.resourceType(),p=u.url();if(!a.has(h)||s(p))return;let w=u.headers();w.purpose==="prefetch"||["video","audio"].includes(w["sec-fetch-dest"])||(i.add(u),n=Date.now())},c=async u=>{let h=u.request();if(!i.has(h))return;let p=(u.headers()["content-type"]||"").toLowerCase();if(["streaming","video","audio","webm","mp4","event-stream","websocket","protobuf"].some(f=>p.includes(f))){i.delete(h);return}if(![...o].some(f=>p.startsWith(f))){i.delete(h);return}let w=u.headers()["content-length"];if(w)try{if(parseInt(w,10)>5*1024*1024){i.delete(h);return}}catch{}i.delete(h),n=Date.now()},d=Date.now()-uu;for(let u of await e.requests()){let h=u.resourceType(),p=u.url(),w=u.timing();a.has(h)&&!s(p)&&w.responseEnd===-1&&w.startTime>=d&&(i.add(u),n=Date.now())}g.debug(`[waitForStableNetwork] Pre-populated ${i.size} in-flight requests`),e.on("request",l),e.on("response",c);try{let u=Date.now(),h=du;for(;;){await new Promise(w=>setTimeout(w,100));let p=Date.now();if(i.size===0&&p-n>=h){g.debug(`[waitForStableNetwork] Network idle after ${p-u}ms`);break}if(p-u>t){g.debug(`[waitForStableNetwork] Max wait time exceeded (${t}ms), pending: ${i.size}`);break}}}finally{e.removeListener("request",l),e.removeListener("response",c)}}async function kt(e,t=cu,i=lu){let n=Date.now();try{await Promise.all([e.waitForLoadState("load",{timeout:t}).catch(()=>{}),hu(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 lu,cu,du,uu,Pe=b(()=>{"use strict";_t();U();lu=.5*1e3,cu=30*1e3,du=1*1e3,uu=3*1e3});async function Ga(e,t,i=60){let n=Math.min(i,300),a=250,o=Date.now(),r=o+n*1e3;g.info(`Waiting for JS condition (timeout: ${n}s)`);let s=0,l=0,c,d;for(;;){try{if(s++,await t())return g.info("JS wait condition met"),{met:!0,evalCount:s,errorCount:l,lastError:c,elapsedMs:Date.now()-o}}catch(u){l++;let h=u.message;c=h,h!==d&&(g.warn(`Error evaluating JS wait condition: ${h}`),d=h)}if(Date.now()>r)return g.warn("Timeout waiting for JS condition"),{met:!1,evalCount:s,errorCount:l,lastError:c,elapsedMs:Date.now()-o};await e.waitForTimeout(a)}}function Ka(e){let t=(e.elapsedMs/1e3).toFixed(1);if(e.met){let n=`${e.evalCount} evaluation${e.evalCount===1?"":"s"}`;return`Condition met after ${t}s (${n})`}if(e.evalCount>0&&e.errorCount===e.evalCount)return`Condition never evaluated successfully (${e.evalCount} attempts, all errored) \u2014 the expression is likely invalid: ${e.lastError}. Waited the full ${t}s \u2014 continuing`;let i=e.errorCount>0?`, ${e.errorCount} errored`:"";return`Condition not met within ${t}s (evaluated ${e.evalCount} times${i}) \u2014 continuing`}var St=b(()=>{"use strict";Pe();U()});async function ds(e,t,i){let n=t.action_data;if(!n)throw new Error("Action data not found");let a=n.kwargs.condition;if(!a)throw new Error("Missing condition for ai_wait_until");let o=n.kwargs.timeout_seconds||60,r=Math.min(o,300);if(n.kwargs.condition_type===Mn.JS_CODE){let u=typeof n.kwargs.js=="string"?n.kwargs.js:a,h;try{h=new Function("page","expect","agent",`
|
|
4126
|
+
The date must be in YYYY-MM-DD format (e.g., 2024-03-15).`,schema:Kd,usesElementIndex:!0,async execute(i,n){let{element_index:a,date:o}=i,{page:r,agentServices:s}=n;try{let l=await q(n,a);if(!l)return{success:!1,error:`Date picker element with index ${a} not found`,actionEntity:Fa(`Set date to ${o} on element ${a}`,{index:a,date:o})};let c=l.attributes.type;if(c!=="date")return{success:!1,error:`Element ${a} is not a native date picker (type="${c}"). This action only works with <input type="date">.`,actionEntity:Fa(`Set date to ${o} on element ${a}`,{index:a,date:o})};let d=await Gd(`Set date to ${o} on element ${a}`,l,r,o);return await t.execute(r,d,s),{success:!0,actionEntity:d,message:`Set date to ${o} on element ${a}`}}catch(l){return{success:!1,error:l.message,actionEntity:Fa(`Set date to ${o} on element ${a}`,{index:a,date:o})}}}})}var ti,zr,Kd,ii=b(()=>{"use strict";ee();B();ti=require("zod");P();zr=class{async execute(e,t,i){let n=t.action_data;if(!n)throw new Error("Action data not found");let a=n.kwargs.date;if(!a)throw new Error("Date value is required");if(!/^\d{4}-\d{2}-\d{2}$/.test(a))throw new Error(`Invalid date format: ${a}. Expected format: YYYY-MM-DD (e.g., 2024-03-15)`);let o=i.replaceVariables(String(a)),r=F(e,t);if(r){let s=await r.getAttribute("type").catch(()=>null);if(s&&s!=="date")throw new Error(`Element is not a native date picker (type="${s}"). This action only works with <input type="date">. For custom date pickers, use AI-powered actions.`);await r.fill(o,{timeout:R(i,t.action_data?.kwargs?.timeout_ms)})}else throw new Error("No locator found for set_date_for_native_date_picker action")}transpile(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},`),"});"]}};Kd=ti.z.object({element_index:ti.z.number().int().describe("Index of the native date picker input element"),date:ti.z.string().regex(/^\d{4}-\d{2}-\d{2}$/).describe("Date in YYYY-MM-DD format (e.g., 2024-03-15)"),timeout_ms:ti.z.number().optional().describe("Per-action timeout in ms. Overrides the default 5s action timeout. Set this only when the instruction states a timeout; otherwise leave it unset so the configured default applies.")})});function Jr(e,t){e.register({name:"switch_tab",description:"Switch to a different browser tab by index (0-based).",schema:zd,async execute(i,n){let a=i.tab_index,{page:o,agentServices:r,actionDescription:s}=n;try{let l={action_description:s||`Switch to tab ${a}`,action_data:{action_name:"switch_tab",kwargs:{page_id:a}}};return await t.execute(o,l,r),{success:!0,actionEntity:l,message:`Switched to tab ${a}`}}catch(l){return{success:!1,error:l.message,actionEntity:{action_description:(s||`Switch to tab ${a}`)+" (failed)",action_data:{action_name:"switch_tab",kwargs:{page_id:a}},feedback:l.message}}}}})}var Ha,Xr,zd,ni=b(()=>{"use strict";Ha=require("zod"),Xr=class{async execute(e,t,i){let n=t.action_data;if(!n)throw new Error("Action data not found");let a=n.kwargs.page_id??n.kwargs.tab_index??0;if(typeof a=="number"){let o=e.context().pages(),r=a===-1?o.length-1:a;if(i){let s=await i.switchTab(r);await s.waitForLoadState("load",{timeout:15e3}).catch(()=>{}),await s.waitForTimeout(500)}}else throw new Error("Missing page_id for switch_tab action")}transpile(e){return['await agent.execAction("switch_tab", page, {',` action_data: { kwargs: { page_id: ${e.action_data?.kwargs?.page_id??e.action_data?.kwargs?.tab_index??0} } },`,"});"]}},zd=Ha.z.object({tab_index:Ha.z.number().int().nonnegative().describe("Index of the tab to switch to (0-based). Use 0 for first tab, 1 for second, etc.")})});async function qr(e,t,i,n){let{useFileInput:a,timeout:o,mockShowOpenFilePicker:r}=n;if(r){g.info("Using mockShowOpenFilePicker approach");let s=i.map(l=>({path:l,buffer:new Uint8Array(Yr.default.readFileSync(l))}));await e.evaluate(l=>{window.__pw_showOpenFilePicker_mock_files=l},s),await t.click({timeout:o}),await e.waitForTimeout(3e3),await e.evaluate(()=>{delete window.__pw_showOpenFilePicker_mock_files})}else if(a)g.info("Using direct file input approach"),await t.setInputFiles(i,{timeout:o}),await e.waitForTimeout(3e3);else{g.info("Using file chooser approach");let s=e.waitForEvent("filechooser",{timeout:o});s.catch(()=>{}),await t.click({timeout:o}),await(await s).setFiles(i),await e.waitForTimeout(3e3)}g.info(`Successfully uploaded ${i.length} file(s)`)}var Yr,ai=b(()=>{"use strict";U();Yr=ie(require("fs"),1)});async function Vd(e,t,i={},n){return{...await W(t,e),action_description:n||"Upload file to element",action_data:{action_name:"upload_file",kwargs:{...i}}}}function Zr(e,t){return{action_description:`${e} (failed - element not found)`,action_data:{action_name:"upload_file",kwargs:t},feedback:"Element not found in DOM"}}function es(e,t){e.register({name:"upload_file",description:'Click on target element (usually contains hints like "Upload file" or "Choose file" etc.) to trigger the file upload dialog, and choose the files to upload',schema:Xd,usesElementIndex:!0,async execute(i,n){let{element_index:a,paths:o}=i,{page:r,agentServices:s,actionDescription:l}=n;try{let c=await q(n,a);if(!c)return{success:!1,error:`File input element with index ${a} not found`,actionEntity:Zr(l||`Upload file to element ${a}`,{index:a,paths:o})};let d=await Vd(c,r,{paths:o},l);return await t.execute(r,d,s),{success:!0,actionEntity:d,message:`Uploaded file to element ${a}`}}catch(c){return{success:!1,error:c.message,actionEntity:Zr(l||`Upload file to element ${a}`,{index:a,paths:o})}}}})}var ae,Qr,Xd,ww,oi=b(()=>{"use strict";ai();ee();B();ae=require("zod");P();Qr=class{async execute(e,t,i){let n=t.action_data;if(!n)throw new Error("Action data not found");let a=[];if(n.kwargs.paths?a=Array.isArray(n.kwargs.paths)?n.kwargs.paths:[n.kwargs.paths]:n.kwargs.path&&(a=Array.isArray(n.kwargs.path)?n.kwargs.path:[n.kwargs.path]),a.length===0)throw new Error("No file paths provided for upload_file action");await i.downloadTestDataFiles(a);let o=a.map(c=>i.getTestDataFilePath(c)),r=F(e,t);if(!r)throw new Error("Missing locator for upload_file action");let s=n.kwargs.use_file_input||!1,l=i.getActionSettings().mock_show_open_file_picker??!1;await qr(e,r,o,{useFileInput:s,timeout:R(i,t.action_data?.kwargs?.timeout_ms),mockShowOpenFilePicker:l})}transpile(e){let t=e.action_data?.kwargs||{},i=[],n={};return t.paths?n.paths=t.paths:t.path&&(n.path=t.path),t.use_file_input&&(n.use_file_input=!0),i.push(`action_data: { kwargs: ${JSON.stringify(n)} }`),e.locator?i.push(`locator: ${JSON.stringify(e.locator)}`):e.xpath&&i.push(`xpath: ${JSON.stringify(e.xpath)}`),e.frame_path&&e.frame_path.length>0&&i.push(`frame_path: ${JSON.stringify(e.frame_path)}`),['await agent.execAction("upload_file", page, {',...i.map(a=>` ${a},`),"});"]}};Xd=ae.z.object({element_index:ae.z.number().int().describe("Index of the target element to trigger the file upload dialog"),paths:ae.z.union([ae.z.string(),ae.z.array(ae.z.string())]).describe('Path to a file, relative to the test project root (e.g. "fixtures/data.csv"), or an array of such paths.'),timeout_ms:ae.z.number().optional().describe("Per-action timeout in ms. Overrides the default 5s action timeout. Set this only when the instruction states a timeout; otherwise leave it unset so the configured default applies.")});ww=ae.z.object({element_index:ae.z.number().int().describe("Index of the file input element"),paths:ae.z.union([ae.z.string(),ae.z.array(ae.z.string())]).describe('Path to a file, relative to the test project root (e.g. "fixtures/data.csv"), or an array of such paths.'),timeout_ms:ae.z.number().optional().describe("Per-action timeout in ms. Overrides the default 5s action timeout. Set this only when the instruction states a timeout; otherwise leave it unset so the configured default applies.")})});function is(e,t){e.register({name:"wait",description:"Wait for a specified number of seconds before continuing.",schema:Jd,async execute(i,n){let{seconds:a}=i,{page:o,agentServices:r,actionDescription:s}=n;try{let l={action_description:s||`Wait ${a} seconds`,action_data:{action_name:"wait",kwargs:{seconds:a}}};return await t.execute(o,l,r),{success:!0,actionEntity:l,message:`Waited ${a} seconds`}}catch(l){return{success:!1,error:l.message,actionEntity:{action_description:(s||`Wait ${a} seconds`)+" (failed)",action_data:{action_name:"wait",kwargs:{seconds:a}},feedback:l.message}}}}})}var Wa,ts,Jd,ri=b(()=>{"use strict";Wa=require("zod"),ts=class{async execute(e,t){let i=t.action_data;if(!i)throw new Error("Action data not found");let n=i.kwargs.seconds||1;await e.waitForTimeout(n*1e3)}transpile(e){return[`await page.waitForTimeout(${(e.action_data?.kwargs?.seconds||1)*1e3});`]}},Jd=Wa.z.object({seconds:Wa.z.number().positive().describe("Number of seconds to wait")})});function as(e,t){e.register({name:"wait_for_download_complete",description:"Wait for an in-progress download to complete.",schema:Yd,async execute(i,n){let{timeout_seconds:a=10}=i,{page:o,agentServices:r}=n;try{let s={action_description:`Wait for download to complete (timeout: ${a}s)`,action_data:{action_name:"wait_for_download_complete",kwargs:{timeout_seconds:a}}};return await t.execute(o,s,r),{success:!0,actionEntity:s,message:"Download completed"}}catch(s){return{success:!1,error:s.message,actionEntity:{action_description:"Wait for download to complete (failed)",action_data:{action_name:"wait_for_download_complete",kwargs:{timeout_seconds:a}},feedback:s.message}}}}})}var ja,ns,Yd,si=b(()=>{"use strict";ja=require("zod"),ns=class{async execute(e,t,i){let n=t.action_data;if(!n)throw new Error("Action data not found");let a=n.kwargs.timeout_seconds||10;await i.waitForDownloadComplete(e,a)}transpile(e){return['await agent.execAction("wait_for_download_complete", page, {',` action_data: { kwargs: { timeout_seconds: ${e.action_data?.kwargs?.timeout_seconds||10} } },`,"});"]}},Yd=ja.z.object({timeout_seconds:ja.z.number().positive().optional().describe("Maximum time in seconds to wait for download to complete. Set this only when the instruction states a timeout; otherwise leave it unset so the 10s default applies.")})});function ls(e){if(e!==null&&typeof e=="object"){for(let t of Object.values(e))ls(t);Object.freeze(e)}return e}var k,Iw,Fw,jw,Gw,Mn,Ua,Ba,rs,Tw,ss,qd,Zd,$n,Aw,$w,Qd,os,eu,li,tu,iu,nu,he,au,ou,Mw,Ww,zw,ru,Vw,su,Xw,Ye=b(()=>{"use strict";Se();k=require("zod"),Iw=require("yaml"),Fw=require("uuid"),jw=require("yaml"),Gw=require("uuid"),Mn=(e=>(e.JS_CODE="JS_CODE",e.AI_MODE="AI_MODE",e))(Mn||{}),Ua=(e=>(e.PASSWORD="password",e.OAUTH2="oauth2",e.SSO="sso",e.API="api",e))(Ua||{}),Ba=(e=>(e.SMS="sms",e.EMAIL="email",e.TOTP="totp",e))(Ba||{}),rs=112,Tw=1080-rs,ss=(e=>(e.Chromium="chromium",e.Firefox="firefox",e.Webkit="webkit",e))(ss||{}),qd={"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"}},Zd={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"]},$n=(e,t=!1)=>{let i=["chromium"];return t&&i.push("webkit"),Zd[e].map(n=>qd[n]).filter(n=>n.defaultBrowserType&&i.includes(n.defaultBrowserType))},Aw={desktop:{label:"Desktop",type:"desktop",devices:$n("desktop")},mobile:{label:"Mobile Web",type:"mobile",devices:$n("mobile")}},$w={desktop:{label:"Desktop",type:"desktop",devices:$n("desktop",!0)},mobile:{label:"Mobile Web",type:"mobile",devices:$n("mobile",!0)}},Qd=k.z.enum(["JS_CODE","AI_MODE"]),os=k.z.object({type:Qd,expression:k.z.string()}),eu=k.z.enum(["DRAFT","STEP","ACTION","IF_ELSE","WHILE_LOOP"]),li=k.z.object({uid:k.z.string(),type:eu,comment:k.z.string().optional()}),tu=k.z.object({action_data:k.z.object({action_name:k.z.string(),kwargs:k.z.record(k.z.any()).optional(),args:k.z.array(k.z.any()).optional()}),action_description:k.z.string().optional(),url:k.z.string().optional(),xpath:k.z.string().nullable().optional(),locator:k.z.string().nullable().optional(),css_selector:k.z.string().nullable().optional(),unique_selector:k.z.string().nullable().optional(),element_index:k.z.number().nullable().optional(),frame_path:k.z.array(k.z.any()).optional(),artifacts:k.z.record(k.z.any()).optional(),feedback:k.z.string().optional(),original_browser_use_action:k.z.any().optional()}).passthrough(),iu=li.extend({type:k.z.literal("DRAFT"),description:k.z.string()}),nu=li.extend({type:k.z.literal("ACTION"),description:k.z.string(),action_entity:tu.optional(),locator:k.z.string().optional(),use_pure_vision:k.z.boolean().optional()}),he=k.z.lazy(()=>k.z.union([iu,nu,li.extend({type:k.z.literal("STEP"),description:k.z.string().optional().default(""),statements:k.z.array(he),reference_id:k.z.number().optional(),template_path:k.z.string().optional(),template_params:k.z.record(k.z.string()).optional()}),li.extend({type:k.z.literal("IF_ELSE"),description:k.z.string().optional(),condition:os,then:k.z.array(he),else:k.z.array(he).optional()}),li.extend({type:k.z.literal("WHILE_LOOP"),description:k.z.string().optional(),condition:os,body:k.z.array(he),timeout_ms:k.z.number().optional()})])),au=k.z.object({name:k.z.string(),statements:k.z.array(he),teardown:k.z.array(he).optional(),skip:k.z.union([k.z.boolean(),k.z.string()]).optional(),timeout:k.z.number().optional(),fail:k.z.union([k.z.boolean(),k.z.string()]).optional(),only:k.z.boolean().optional(),slow:k.z.boolean().optional()}),ou=k.z.object({tests:k.z.array(au).min(1),beforeAll:k.z.array(he).optional(),afterAll:k.z.array(he).optional(),beforeEach:k.z.array(he).optional(),afterEach:k.z.array(he).optional()}),Mw=k.z.object({comment:k.z.string().optional(),version:k.z.string().optional(),goal:k.z.string().optional(),url:k.z.string().optional(),baseURL:k.z.string().optional(),final_feedback:k.z.string().optional(),completed:k.z.boolean().optional(),success:k.z.boolean().optional(),statements:k.z.array(he).optional(),teardown:k.z.array(he).optional(),last_modified_at:k.z.string().optional(),testGroup:ou.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"}),Ww=1024*1024,zw=Object.freeze(["lite","standard","pro"]),ru=1,Vw=Object.freeze(["WEB_AGENT_MODEL","WEB_AGENT_FALLBACK_MODELS","COMPUTER_USE_MODEL"]),su=ls({version:ru,defaultTier:"lite",tiers:{lite:{webagent:{primary:"google:gemini-3-flash-preview",fallbacks:["anthropic:claude-haiku-4-5","openai:gpt-5.6-luna"]}},standard:{webagent:{primary:"google:gemini-3.5-flash",fallbacks:["anthropic:claude-sonnet-5","openai:gpt-5.6-terra"]}},pro:{webagent:{primary:"anthropic:claude-opus-4-8",fallbacks:["openai:gpt-5.6-sol","anthropic:claude-opus-4-7"]}}},computerUse:{primary:"google:gemini-3-flash-preview",fallbacks:[]}});Xw=Object.freeze([...su.tiers.standard.webagent.fallbacks])});var _t=b(()=>{"use strict"});async function hu(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 h=u.toLowerCase();return h.startsWith("data:")||h.startsWith("blob:")?!0:r.some(p=>h.includes(p))},l=u=>{let h=u.resourceType(),p=u.url();if(!a.has(h)||s(p))return;let w=u.headers();w.purpose==="prefetch"||["video","audio"].includes(w["sec-fetch-dest"])||(i.add(u),n=Date.now())},c=async u=>{let h=u.request();if(!i.has(h))return;let p=(u.headers()["content-type"]||"").toLowerCase();if(["streaming","video","audio","webm","mp4","event-stream","websocket","protobuf"].some(f=>p.includes(f))){i.delete(h);return}if(![...o].some(f=>p.startsWith(f))){i.delete(h);return}let w=u.headers()["content-length"];if(w)try{if(parseInt(w,10)>5*1024*1024){i.delete(h);return}}catch{}i.delete(h),n=Date.now()},d=Date.now()-uu;for(let u of await e.requests()){let h=u.resourceType(),p=u.url(),w=u.timing();a.has(h)&&!s(p)&&w.responseEnd===-1&&w.startTime>=d&&(i.add(u),n=Date.now())}g.debug(`[waitForStableNetwork] Pre-populated ${i.size} in-flight requests`),e.on("request",l),e.on("response",c);try{let u=Date.now(),h=du;for(;;){await new Promise(w=>setTimeout(w,100));let p=Date.now();if(i.size===0&&p-n>=h){g.debug(`[waitForStableNetwork] Network idle after ${p-u}ms`);break}if(p-u>t){g.debug(`[waitForStableNetwork] Max wait time exceeded (${t}ms), pending: ${i.size}`);break}}}finally{e.removeListener("request",l),e.removeListener("response",c)}}async function kt(e,t=cu,i=lu){let n=Date.now();try{await Promise.all([e.waitForLoadState("load",{timeout:t}).catch(()=>{}),hu(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 lu,cu,du,uu,Pe=b(()=>{"use strict";_t();U();lu=.5*1e3,cu=30*1e3,du=1*1e3,uu=3*1e3});async function Ga(e,t,i=60){let n=Math.min(i,300),a=250,o=Date.now(),r=o+n*1e3;g.info(`Waiting for JS condition (timeout: ${n}s)`);let s=0,l=0,c,d;for(;;){try{if(s++,await t())return g.info("JS wait condition met"),{met:!0,evalCount:s,errorCount:l,lastError:c,elapsedMs:Date.now()-o}}catch(u){l++;let h=u.message;c=h,h!==d&&(g.warn(`Error evaluating JS wait condition: ${h}`),d=h)}if(Date.now()>r)return g.warn("Timeout waiting for JS condition"),{met:!1,evalCount:s,errorCount:l,lastError:c,elapsedMs:Date.now()-o};await e.waitForTimeout(a)}}function Ka(e){let t=(e.elapsedMs/1e3).toFixed(1);if(e.met){let n=`${e.evalCount} evaluation${e.evalCount===1?"":"s"}`;return`Condition met after ${t}s (${n})`}if(e.evalCount>0&&e.errorCount===e.evalCount)return`Condition never evaluated successfully (${e.evalCount} attempts, all errored) \u2014 the expression is likely invalid: ${e.lastError}. Waited the full ${t}s \u2014 continuing`;let i=e.errorCount>0?`, ${e.errorCount} errored`:"";return`Condition not met within ${t}s (evaluated ${e.evalCount} times${i}) \u2014 continuing`}var St=b(()=>{"use strict";Pe();U()});async function ds(e,t,i){let n=t.action_data;if(!n)throw new Error("Action data not found");let a=n.kwargs.condition;if(!a)throw new Error("Missing condition for ai_wait_until");let o=n.kwargs.timeout_seconds||60,r=Math.min(o,300);if(n.kwargs.condition_type===Mn.JS_CODE){let u=typeof n.kwargs.js=="string"?n.kwargs.js:a,h;try{h=new Function("page","expect","agent",`
|
|
4127
4127
|
return (async () => (${u}))();
|
|
4128
4128
|
`)}catch(w){return await e.waitForTimeout(r*1e3),{met:!1,message:`Condition could not be parsed as JavaScript: ${w.message}. Waited the full ${r}s \u2014 continuing`}}let p=await Ga(e,()=>h(e,Je.expect,i.agent),r);return{met:p.met,message:Ka(p)}}let s=r*1e3,l=5e3,c=Date.now(),{evaluateStatement:d}=await Promise.resolve().then(()=>(xt(),vt));for(;Date.now()-c<s;){if((await d(a,e,i,{})).success)return{met:!0,message:`Condition met: ${a}`};await e.waitForTimeout(l)}return{met:!1,message:`Condition not met within ${r}s: ${a} \u2014 continuing`}}function hs(e){e.register({name:"ai_wait_until",description:'Wait until a specific condition is met on the page (e.g., "page loads", "spinner disappears", "button becomes enabled"). Use this instead of wait when the goal is to wait for something to happen rather than waiting a fixed duration.',schema:mu,async execute(t,i){let{condition:n,timeout_seconds:a=60}=t,{page:o,agentServices:r}=i;try{let s={action_description:`Wait until: ${n}`,action_data:{action_name:"ai_wait_until",kwargs:{condition:n,timeout_seconds:a}}},l=await ds(o,s,r);return l.met||r.addNote?.(l.message),{success:!0,actionEntity:s,message:l.message}}catch(s){return{success:!1,error:s.message,actionEntity:{action_description:`Wait until: ${n} (failed)`,action_data:{action_name:"ai_wait_until",kwargs:{condition:n,timeout_seconds:a}},feedback:s.message}}}}})}var In,us,mu,ci=b(()=>{"use strict";bt();Ye();St();U();In=require("zod");us=class{async execute(e,t,i){let n=await ds(e,t,i);n.met||(g.warn(n.message),i.addNote?.(n.message))}transpile(e,t){let i=e.action_data?.kwargs?.condition,n=e.action_data?.kwargs?.timeout_seconds||60;if(!i)return["// Skipping ai_wait_until: missing condition"];if(e.action_data?.kwargs?.condition_type===Mn.JS_CODE){let a=e.action_data?.kwargs?.js,o=typeof a=="string"?a:i,r=typeof a=="string"?`, ${JSON.stringify(i)}`:"";return[`await agent.waitForJs(page, async () => (${o}), ${n}, '${t}'${r});`]}return[`await agent.waitUntilCondition(page, ${JSON.stringify(i)}, ${n}, '${t}');`]}},mu=In.z.object({condition:In.z.string().describe('The condition to wait for (e.g., "the loading spinner disappears")'),timeout_seconds:In.z.number().positive().optional().describe("Timeout in seconds. Set this only when the instruction states a timeout; otherwise leave it unset so the 60s default applies.")})});async function pu(e,t,i,n,a={}){return{...await W(n,i),action_description:t,action_data:{action_name:e,kwargs:{...a}}}}function ms(e,t,i){return{action_description:`${e} (failed - element not found)`,action_data:{action_name:t,kwargs:i},feedback:"Element not found in DOM"}}function ps(e,t){e.register({name:"right_click",description:"Right-click an interactive element.",schema:fu,usesElementIndex:!0,async execute(i,n){let{element_index:a}=i,{page:o,agentServices:r,actionDescription:s}=n;try{let l=await q(n,a);if(!l)return{success:!1,error:`Element with index ${a} not found.`,actionEntity:ms(`Right-click element ${a}`,"right_click",{index:a})};let c=s||`Right-click element ${a}`,d=await pu("right_click",c,l,o);return await t.execute(o,d,r),{success:!0,actionEntity:d,message:`Right-clicked element ${a}`}}catch(l){return{success:!1,error:l.message,actionEntity:ms(`Right-click element ${a}`,"right_click",{index:a})}}}})}var Cn,za,fu,di=b(()=>{"use strict";ee();B();Cn=require("zod");P();za=class{async execute(e,t,i){let n=F(e,t),a=R(i,t.action_data?.kwargs?.timeout_ms);if(n)await n.click({button:"right",timeout:a});else throw new Error("No locator found for right_click action")}transpile(e){let t=[];return e.locator?t.push(`locator: ${JSON.stringify(e.locator)}`):e.xpath&&t.push(`xpath: ${JSON.stringify(e.xpath)}`),e.frame_path&&e.frame_path.length>0&&t.push(`frame_path: ${JSON.stringify(e.frame_path)}`),t.length===0?['await agent.execAction("right_click", page, {});']:['await agent.execAction("right_click", page, {',...t.map(i=>` ${i},`),"});"]}};fu=Cn.z.object({element_index:Cn.z.number().int().describe("Index of the element to right-click"),timeout_ms:Cn.z.number().optional().describe("Per-action timeout in ms. Overrides the default 5s action timeout. Set this only when the instruction states a timeout; otherwise leave it unset so the configured default applies.")})});function gs(e,t){e.register({name:"save_variable",description:"Save a value to a named variable for later use in the test.",schema:gu,async execute(i,n){let{name:a,value:o}=i,{page:r,agentServices:s}=n;try{let l={action_description:`Save variable "${a}" = "${o}"`,action_data:{action_name:"save_variable",kwargs:{name:a,value:o}}};return await t.execute(r,l,s),{success:!0,actionEntity:l,message:`Saved variable "${a}"`}}catch(l){return{success:!1,error:l.message,actionEntity:{action_description:`Save variable "${a}" (failed)`,action_data:{action_name:"save_variable",kwargs:{name:a,value:o}},feedback:l.message}}}}})}var Pn,fs,gu,ui=b(()=>{"use strict";Pn=require("zod"),fs=class{async execute(e,t,i){let n=t.action_data;if(!n)throw new Error("Action data not found");let a=n.kwargs.name,o=n.kwargs.value;if(!a||o===void 0)throw new Error("Missing variable name or value for save_variable");a.startsWith("$")&&(a=a.slice(1)),i.saveVariable(a,o)}transpile(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)} } },`,"});"]}},gu=Pn.z.object({name:Pn.z.string().describe("Variable name to save"),value:Pn.z.string().describe("Value to save in the variable")})});async function wu(e,t,i={}){return{action_description:t,action_data:{action_name:e,kwargs:{...i}}}}function yu(e,t,i){return{action_description:`${e} (failed)`,action_data:{action_name:t,kwargs:i},feedback:"Scroll failed!"}}function ws(e,t){e.register({name:"scroll",description:"Scroll the page by specified number of pages (set down=True to scroll down, down=False to scroll up, num_pages=number of pages to scroll like 0.5 for half page, 1.0 for one page, etc.). ",schema:bu,async execute(i,n){let{down:a,num_pages:o}=i,{page:r,agentServices:s,actionDescription:l}=n;try{let c=l||`Scroll ${a?"down":"up"} ${o} page(s)`,d=await wu("scroll",c,{down:a,num_pages:o});return await t.execute(r,d,s),{success:!0,actionEntity:d,message:`Scrolled ${a?"down":"up"} ${o} page(s)`}}catch(c){return{success:!1,error:c.message,actionEntity:yu(l||`Scroll ${a?"down":"up"} ${o} page(s)`,"scroll",{down:a,num_pages:o})}}}})}var On,hi,bu,mi=b(()=>{"use strict";On=require("zod"),hi=class{async execute(e,t){let i=t.action_data;if(!i)throw new Error("Action data not found");let n=i.kwargs.down??!0,a=i.kwargs.num_pages??1,o=n?1:-1;await e.evaluate(`window.scrollBy(0, window.innerHeight * ${a} * ${o})`)}transpile(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)})');`]}};bu=On.z.object({down:On.z.boolean().describe("True to scroll down, False to scroll up"),num_pages:On.z.number().nonnegative().describe("Number of pages to scroll (0.5 = half page, 1.0 = one page, etc.)")})});async function vu(e,t,i,n,a={}){return{...await W(n,i),action_description:t,action_data:{action_name:e,kwargs:{...a}}}}function ys(e,t,i){return{action_description:`${e} (failed)`,action_data:{action_name:t,kwargs:i},feedback:"Element not found in DOM"}}function vs(e,t){e.register({name:"scroll_on_element",description:"Scroll on a scrollable element horizontally and vertically.",schema:xu,usesElementIndex:!0,async execute(i,n){let{element_index:a,delta_x:o,delta_y:r}=i,{page:s,agentServices:l}=n;try{let c=await q(n,a);if(!c)return{success:!1,error:`Element with index ${a} not found`,actionEntity:ys(`Scroll on element ${a} horizontally: ${o}px, vertically: ${r}px`,"scroll_on_element",{index:a,delta_x:o,delta_y:r})};let d=await vu("scroll_on_element",`Scroll on element ${a} horizontally: ${o}px, vertically: ${r}px`,c,s,{delta_x:o,delta_y:r});return await t.execute(s,d,l),{success:!0,actionEntity:d,message:`Scrolled on element ${a} horizontally: ${o}px, vertically: ${r}px`}}catch(c){return{success:!1,error:c.message,actionEntity:ys(`Scroll on element ${a} horizontally: ${o}px, vertically: ${r}px`,"scroll_on_element",{index:a,delta_x:o,delta_y:r})}}}})}var Et,bs,xu,pi=b(()=>{"use strict";ee();B();Et=require("zod");P();bs=class{async execute(e,t,i){let n=t.action_data;if(!n)throw new Error("Action data not found");let a=n.kwargs.delta_x||0,o=n.kwargs.delta_y||0,r=F(e,t),s=R(i,t.action_data?.kwargs?.timeout_ms);if(r)await r.hover({timeout:s}),await e.mouse.wheel(a,o);else throw new Error("No locator found for scroll_on_element action")}transpile(e){let t=je(e);if(!t){let a=e.action_data?.kwargs?.delta_x||0,o=e.action_data?.kwargs?.delta_y||0;return['await agent.execAction("scroll_on_element", page, {',` action_data: { kwargs: { delta_x: ${a}, delta_y: ${o} } },`,"});"]}let i=e.action_data?.kwargs?.delta_x||0,n=e.action_data?.kwargs?.delta_y||0;return[`await ${t}.hover({ timeout: ${R()} });`,`await page.mouse.wheel(${i}, ${n});`]}};xu=Et.z.object({element_index:Et.z.number().int().describe("Index of the scrollable element"),delta_x:Et.z.number().optional().describe("The number of pixels to scroll horizontally. Positive values scroll right, negative values scroll left."),delta_y:Et.z.number().optional().describe("The number of pixels to scroll vertically. Positive values scroll down, negative values scroll up."),timeout_ms:Et.z.number().optional().describe("Per-action timeout in ms. Overrides the default 5s action timeout. Set this only when the instruction states a timeout; otherwise leave it unset so the configured default applies.")})});function _s(e,t){e.register({name:"scroll_to_text",description:"Scroll the page until specified text becomes visible.",schema:_u,async execute(i,n){let{text:a}=i,{page:o,agentServices:r,actionDescription:s}=n;try{let l={action_description:s||`Scroll to text "${a}"`,action_data:{action_name:"scroll_to_text",kwargs:{text:a}}};return await t.execute(o,l,r),{success:!0,actionEntity:l,message:`Scrolled to text "${a}"`}}catch(l){return{success:!1,error:l.message,actionEntity:{action_description:(s||`Scroll to text "${a}"`)+" (failed)",action_data:{action_name:"scroll_to_text",kwargs:{text:a}},feedback:l.message}}}}})}var Va,xs,_u,fi=b(()=>{"use strict";Va=require("zod"),xs=class{async execute(e,t){let i=t.action_data;if(!i)throw new Error("Action data not found");let n=i.kwargs.text;if(n)await e.getByText(n,{exact:!1}).first().scrollIntoViewIfNeeded(),await e.waitForTimeout(500);else throw new Error("Missing text for scroll_to_text action")}transpile(e){let t=e.action_data?.kwargs?.text||"";return[`await page.getByText(${JSON.stringify(t)}, { exact: false }).first().scrollIntoViewIfNeeded();`]}},_u=Va.z.object({text:Va.z.string().describe("Text to scroll to on the page")})});async function ku(e,t,i,n){return{...await W(t,e),action_description:n||`Select option "${i}"`,action_data:{action_name:"select_dropdown_option",kwargs:{text:i}}}}function ks(e,t){return{action_description:`${e} (failed - element not found)`,action_data:{action_name:"select_dropdown_option",kwargs:t},feedback:"Element not found in DOM"}}function Es(e,t){e.register({name:"select_dropdown_option",description:"Select an option from a dropdown/select element by value, label, or index.",schema:Su,usesElementIndex:!0,async execute(i,n){let{element_index:a,option:o}=i,{page:r,agentServices:s,actionDescription:l}=n;try{let c=await q(n,a);if(!c)return{success:!1,error:`Dropdown element with index ${a} not found`,actionEntity:ks(l||`Select option in dropdown ${a}`,{index:a,option:o})};let d=await ku(c,r,o,l);return await t.execute(r,d,s),{success:!0,actionEntity:d,message:`Selected option "${o}" in dropdown ${a}`}}catch(c){return{success:!1,error:c.message,actionEntity:ks(`Select option in dropdown ${a}`,{index:a,option:o})}}}})}var gi,Ss,Su,wi=b(()=>{"use strict";ee();B();gi=require("zod");P();Ss=class{async execute(e,t,i){let n=t.action_data;if(!n)throw new Error("Action data not found");let a=n.kwargs.text||n.kwargs.option,o=F(e,t),r=R(i,t.action_data?.kwargs?.timeout_ms);if(o&&a)await o.selectOption(a,{timeout:r});else throw new Error("Missing locator or option label for select_dropdown_option action")}transpile(e){let t=e.action_data?.kwargs?.text||e.action_data?.kwargs?.option||"",i=[];return i.push(`action_data: { kwargs: { text: ${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("select_dropdown_option", page, {',...i.map(n=>` ${n},`),"});"]}};Su=gi.z.object({element_index:gi.z.number().int().describe("Index of the dropdown/select element"),option:gi.z.string().describe("Option value, label, or index to select"),timeout_ms:gi.z.number().optional().describe("Per-action timeout in ms. Overrides the default 5s action timeout. Set this only when the instruction states a timeout; otherwise leave it unset so the configured default applies.")})});function Ts(e,t){e.register({name:"go_to_url",description:"Navigate to a specific URL. Use this to visit web pages. Set new_tab=true to open in a new tab.",schema:Eu,async execute(i,n){let{url:a,new_tab:o,timeout_seconds:r}=i,{page:s,agentServices:l,actionDescription:c}=n,d={url:a,new_tab:o??!1};r!==void 0&&(d.timeout_seconds=r);let u=r?` (timeout: ${r}s)`:"";try{let h=o?`Open ${a} in new tab`:`Navigate to ${a}`,p={action_description:c||h,action_data:{action_name:"go_to_url",kwargs:d}};return await t.execute(s,p,l),{success:!0,actionEntity:p,message:(o?`Opened ${a} in new tab`:`Navigated to ${a}`)+u}}catch(h){let p=o?`Open ${a} in new tab`:`Navigate to ${a}`;return{success:!1,error:h.message,actionEntity:{action_description:(c||p)+" (failed)",action_data:{action_name:"go_to_url",kwargs:d},feedback:h.message}}}}})}var yi,Xa,Eu,bi=b(()=>{"use strict";B();yi=require("zod");P();Xa=class{async execute(e,t,i){let n=t.action_data;if(!n)throw new Error("Action data not found");let a=n.kwargs.url;if(!a)throw new Error("Missing URL for go_to_url action");let o=n.kwargs.new_tab===!0,r=i.replaceVariables(String(a));if(r.startsWith("/")){let c=e.url(),d=null;try{let u=new URL(c);u.origin&&u.origin!=="null"&&(d=u.origin)}catch{}d&&(r=d+r)}let s=n.kwargs.timeout_seconds?n.kwargs.timeout_seconds*1e3:we,l=e;o&&(l=await e.context().newPage(),i.setPage(l)),await l.goto(r,{timeout:s})}transpile(e){let t=e.action_data?.kwargs?.url||"",i=e.action_data?.kwargs?.new_tab===!0,n=e.action_data?.kwargs?.timeout_seconds,a=[`url: ${JSON.stringify(t)}`];return i&&a.push("new_tab: true"),n&&a.push(`timeout_seconds: ${n}`),['await agent.execAction("go_to_url", page, {',` action_data: { kwargs: { ${a.join(", ")} } },`,"});"]}},Eu=yi.z.object({url:yi.z.string().describe('URL to navigate to (HTTP/HTTPS URL, or a path like "/home")'),new_tab:yi.z.boolean().optional().describe("If true, open the URL in a new tab instead of the current page. Default is false."),timeout_seconds:yi.z.number().positive().optional().describe("Navigation timeout in seconds. Set this only when the instruction states a timeout; otherwise leave it unset so the 20s default applies.")})});async function Tu(e,t,i,n,a={}){return{...await W(n,i),action_description:t,action_data:{action_name:e,kwargs:{...a}}}}function As(e,t,i){return{action_description:`${e} (failed - element not found)`,action_data:{action_name:t,kwargs:i},feedback:"Element not found in DOM"}}function $s(e,t){e.register({name:"hover",description:"Hover over an interactive element.",schema:Au,usesElementIndex:!0,async execute(i,n){let{element_index:a}=i,{page:o,agentServices:r,actionDescription:s}=n;try{let l=await q(n,a);if(!l)return{success:!1,error:`Element with index ${a} not found.`,actionEntity:As(`Hover element ${a}`,"hover",{index:a})};let c=s||`Hover over element ${a}`,d=await Tu("hover",c,l,o);return await t.execute(o,d,r),{success:!0,actionEntity:d,message:`Hovered over element ${a}`}}catch(l){return{success:!1,error:l.message,actionEntity:As(`Hover element ${a}`,"hover",{index:a})}}}})}var Nn,Ja,Au,vi=b(()=>{"use strict";ee();B();Nn=require("zod");P();Ja=class{async execute(e,t,i){let n=F(e,t),a=R(i,t.action_data?.kwargs?.timeout_ms);if(n){await n.waitFor({state:"attached",timeout:a});let o=await n.elementHandle();if(!o)throw new Error("Unable to obtain element handle for hover action");let r=await o.boundingBox();if(!r)throw new Error("Unable to determine bounding box for hover action");let s=r.x+r.width/2,l=r.y+r.height/2;await e.mouse.move(s,l)}else throw new Error("No locator found for hover action")}transpile(e){let t=[];return e.locator?t.push(`locator: ${JSON.stringify(e.locator)}`):e.xpath&&t.push(`xpath: ${JSON.stringify(e.xpath)}`),e.frame_path&&e.frame_path.length>0&&t.push(`frame_path: ${JSON.stringify(e.frame_path)}`),t.length===0?['await agent.execAction("hover", page, {});']:['await agent.execAction("hover", page, {',...t.map(i=>` ${i},`),"});"]}};Au=Nn.z.object({element_index:Nn.z.number().int().describe("Index of the element to hover over"),timeout_ms:Nn.z.number().optional().describe("Per-action timeout in ms. Overrides the default 5s action timeout. Set this only when the instruction states a timeout; otherwise leave it unset so the configured default applies.")})});async function $u(e,t,i,n,a={}){return{...await W(n,i),action_description:t,action_data:{action_name:e,kwargs:{...a}}}}function Ms(e,t,i){return{action_description:`${e} (failed - element not found)`,action_data:{action_name:t,kwargs:i},feedback:"Element not found in DOM"}}function Is(e,t){e.register({name:"input_text",description:"Type text into an input field. To replace existing content, use clear_input first.",schema:Mu,usesElementIndex:!0,async execute(i,n){let{element_index:a,text:o}=i,{page:r,agentServices:s,actionDescription:l}=n;try{let c=await q(n,a);if(!c)return{success:!1,error:`Input element with index ${a} not found`,actionEntity:Ms(l||`Input text to element ${a}`,"input_text",{index:a,text:o})};let d=l||`Input text to element ${a}`,u=await $u("input_text",d,c,r,{text:o});return await t.execute(r,u,s),{success:!0,actionEntity:u,message:`Input text to element ${a}`}}catch(c){return{success:!1,error:c.message,actionEntity:Ms(`Input text to element ${a}`,"input_text",{index:a,text:o})}}}})}var xi,Ya,Mu,_i=b(()=>{"use strict";ee();B();xi=require("zod");P();Ya=class{async execute(e,t,i){let n=t.action_data;if(!n)throw new Error("Action data not found");let a=n.kwargs.text??n.kwargs.value??"",o=i.replaceVariables(String(a)),r=F(e,t),s=R(i,t.action_data?.kwargs?.timeout_ms);if(r){await r.evaluate(c=>{c.value&&(c.value="")},null,{timeout:s}),await r.click({timeout:s}),await e.waitForTimeout(200);let l=i.getActionSettings().type_delay;l!==void 0?await e.keyboard.type(o,{delay:l}):await e.keyboard.type(o)}else throw new Error("No locator found for input_text action")}transpile(e){let t=e.action_data?.kwargs?.text??e.action_data?.kwargs?.value??"",i=[];return i.push(`action_data: { kwargs: { text: ${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("input_text", page, {',...i.map(n=>` ${n},`),"});"]}};Mu=xi.z.object({element_index:xi.z.number().int().describe("Index of the input element"),text:xi.z.string().describe("Text to type into the input. To use a placeholder, write {{ placeholder_name }} using exact placeholder name. Use clear_input first if you want to replace existing content."),timeout_ms:xi.z.number().optional().describe("Per-action timeout in ms. Overrides the default 5s action timeout. Set this only when the instruction states a timeout; otherwise leave it unset so the configured default applies.")})});function Cs(e,t){e.register({name:"press",description:"Press a single keyboard key or key combination. Supports combinations like `Control+A` for select all. Does NOT support sequences - call this action multiple times to press keys in sequence.",schema:Iu,async execute(i,n){let{keys:a}=i,{page:o,agentServices:r,actionDescription:s}=n;try{let l={action_description:s||`Press keys "${a}"`,action_data:{action_name:"press",kwargs:{keys:a}}};return await t.execute(o,l,r),{success:!0,actionEntity:l,message:`Pressed keys "${a}"`}}catch(l){return{success:!1,error:l.message,actionEntity:{action_description:(s||`Press keys "${a}"`)+" (failed)",action_data:{action_name:"press",kwargs:{keys:a}},feedback:l.message}}}}})}var qa,Za,Iu,ki=b(()=>{"use strict";qa=require("zod"),Za=class{async execute(e,t){let i=t.action_data;if(!i)throw new Error("Action data not found");let n=i.kwargs.keys;if(!n||typeof n!="string")throw new Error("Missing or invalid keys for press action");await e.keyboard.press(n),await e.waitForTimeout(500)}transpile(e){let t=e.action_data?.kwargs?.keys;return[`await page.keyboard.press(${JSON.stringify(t)});`]}},Iu=qa.z.object({keys:qa.z.string().describe("A single key or key combination to press (e.g. Escape, Backspace, Insert, PageDown, Delete, Tab, Enter). Key combinations like `Control+o`, `Control+Shift+T`, `ControlOrMeta+a` are supported. Note: This does NOT support sequences - to press multiple keys in sequence (e.g., Control+A then Backspace), call this action multiple times.")})});function Ns(e,t){e.register({name:"reload_page",description:"Reload the current page. WARNING: This will reset any in-progress forms or multi-step flows (like login). Only use when you need to refresh stale data or clear a stuck state. Do NOT use during login, checkout, or form submission flows.",schema:Cu,async execute(i,n){let{page:a,agentServices:o}=n;try{let r={action_description:"Reload page",action_data:{action_name:"reload_page",kwargs:{}}};return await t.execute(a,r,o),{success:!0,actionEntity:r,message:`Reloaded ${a.url()}`}}catch(r){return{success:!1,error:r.message,actionEntity:{action_description:"Reload page (failed)",action_data:{action_name:"reload_page",kwargs:{}},feedback:r.message}}}}})}var Ps,Os,Cu,Si=b(()=>{"use strict";B();Ps=require("zod");P();Os=class{async execute(e,t){await e.reload({timeout:we}),await e.waitForLoadState("load",{timeout:we}),await e.waitForTimeout(1e3)}transpile(e){return['await agent.execAction("reload_page", page, {});']}},Cu=Ps.z.object({})});function Ds(e,t){e.register({name:"done",description:"Mark the current task as complete. Use when you have finished all requested actions.",schema:Pu,async execute(i,n){let{page:a,agentServices:o}=n;try{let r={action_description:"Task completed",action_data:{action_name:"done",kwargs:{}}};return await t.execute(a,r,o),{success:!0,actionEntity:r,message:"Task marked as complete"}}catch(r){return{success:!1,error:r.message,actionEntity:{action_description:"Task completed (failed)",action_data:{action_name:"done",kwargs:{}},feedback:r.message}}}}})}var Ln,Ls,Pu,Ei=b(()=>{"use strict";Ln=require("zod"),Ls=class{async execute(e,t){}transpile(e){return["// Done - no action needed"]}},Pu=Ln.z.object({success:Ln.z.boolean().describe("Whether the task was completed successfully"),summary:Ln.z.string().describe("Summary of what was accomplished or why it failed")})});async function Ou(e,t,i,n,a={}){return{...await W(n,i),action_description:t,action_data:{action_name:e,kwargs:{...a}}}}function Rs(e,t,i){return{action_description:`${e} (failed - element not found)`,action_data:{action_name:t,kwargs:i},feedback:"Element not found in DOM"}}function Fs(e,t){e.register({name:"double_click",description:"Double-click an interactive element.",schema:Nu,usesElementIndex:!0,async execute(i,n){let{element_index:a}=i,{page:o,agentServices:r,actionDescription:s}=n;try{let l=await q(n,a);if(!l)return{success:!1,error:`Element with index ${a} not found.`,actionEntity:Rs(`Double-click element ${a}`,"double_click",{index:a})};let c=s||`Double-click element ${a}`,d=await Ou("double_click",c,l,o);return await t.execute(o,d,r),{success:!0,actionEntity:d,message:`Double-clicked element ${a}`}}catch(l){return{success:!1,error:l.message,actionEntity:Rs(`Double-click element ${a}`,"double_click",{index:a})}}}})}var Dn,Qa,Nu,Ti=b(()=>{"use strict";ee();B();Dn=require("zod");P();Qa=class{async execute(e,t,i){let n=F(e,t),a=R(i,t.action_data?.kwargs?.timeout_ms);if(n)await n.dblclick({timeout:a});else throw new Error("No locator found for double_click action")}transpile(e){let t=[];return e.locator?t.push(`locator: ${JSON.stringify(e.locator)}`):e.xpath&&t.push(`xpath: ${JSON.stringify(e.xpath)}`),e.frame_path&&e.frame_path.length>0&&t.push(`frame_path: ${JSON.stringify(e.frame_path)}`),t.length===0?['await agent.execAction("double_click", page, {});']:['await agent.execAction("double_click", page, {',...t.map(i=>` ${i},`),"});"]}};Nu=Dn.z.object({element_index:Dn.z.number().int().describe("Index of the element to double-click"),timeout_ms:Dn.z.number().optional().describe("Per-action timeout in ms. Overrides the default 5s action timeout. Set this only when the instruction states a timeout; otherwise leave it unset so the configured default applies.")})});function Ws(e,t){e.register({name:"generate_2fa_code",description:'Generate a 2FA code from an OTP secret key. The code is saved to the "otp_code" variable. To use the otp_code, you must use `$otp_code` to access it.',schema:Lu,async execute(i,n){let{otp_secret_key:a}=i,{page:o,agentServices:r}=n;try{let s={action_description:"Generate 2FA code",action_data:{action_name:"generate_2fa_code",kwargs:{otp_secret_key:a}}};return await t.execute(o,s,r),{success:!0,actionEntity:s,message:'Generated 2FA code and saved to variable "otp_code"'}}catch(s){return{success:!1,error:s.message,actionEntity:{action_description:"Generate 2FA code (failed)",action_data:{action_name:"generate_2fa_code",kwargs:{otp_secret_key:a}},feedback:s.message}}}}})}var eo,Hs,Lu,Ai=b(()=>{"use strict";eo=require("zod"),Hs=class{async execute(e,t,i){let n=t.action_data;if(!n)throw new Error("Action data not found");let a=n.kwargs.otp_secret_key;if(!a)throw new Error("Missing otp_secret_key for generate_2fa_code");let o=i.replaceVariables(String(a)),r=await i.generate2faCode(o);i.saveVariable("otp_code",r)}transpile(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)} } },`,"});"]}},Lu=eo.z.object({otp_secret_key:eo.z.string().describe("The OTP secret key to generate the 2FA code from")})});async function Du(e,t,i){return{...await W(t,e),action_description:i||"Get dropdown options",action_data:{action_name:"get_dropdown_options",kwargs:{}}}}function js(e,t){return{action_description:`${e} (failed - element not found)`,action_data:{action_name:"get_dropdown_options",kwargs:t},feedback:"Element not found in DOM"}}function Bs(e,t){e.register({name:"get_dropdown_options",description:"Get all options from a native dropdown",schema:Ru,usesElementIndex:!0,async execute(i,n){let{element_index:a}=i,{page:o,agentServices:r,actionDescription:s}=n;try{let l=await q(n,a);if(!l)return{success:!1,error:`Dropdown element with index ${a} not found`,actionEntity:js(s||`Get options from dropdown ${a}`,{index:a})};let c=await Du(l,o,s);return await t.execute(o,c,r),{success:!0,actionEntity:c,message:c.feedback||"No options found"}}catch(l){return{success:!1,error:l.message,actionEntity:js(s||`Get options from dropdown ${a}`,{index:a})}}}})}var to,Us,Ru,$i=b(()=>{"use strict";ee();to=require("zod"),Us=class{async execute(e,t,i){if(!t.xpath)throw new Error("XPath not found in action entity");let n=[];for(let a of e.frames())try{let o=await a.evaluate(r=>{let s=document.evaluate(r,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;return s?{options:Array.from(s.options).map(l=>({text:l.text,value:l.value,index:l.index})),id:s.id,name:s.name}:null},t.xpath);if(o){let r=[];for(let s of o.options){let l=JSON.stringify(s.text);r.push(`${s.index}: text=${l}`)}n.push(...r)}}catch{}if(n.length>0){let a=n.join(`
|
|
4129
4129
|
`);a+=`
|
|
@@ -4322,7 +4322,7 @@ ${p.join(`
|
|
|
4322
4322
|
`,n+=`- Use the EXACT placeholder name as shown above
|
|
4323
4323
|
`,n+=`- Do NOT use the actual value directly in the action
|
|
4324
4324
|
`,n+=`- The values shown are for context only to help you understand what data is available
|
|
4325
|
-
`,n+='- In action descriptions, describe what the placeholder represents in natural language (e.g., "Type the first user name" instead of "Type {{ firstUserName }}")',n}}});async function ll(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=[r,...t.agentServices.getFallbackModels().filter(_=>_!==r)],l=0,c=r,d=t.domService||new Xe(t.agentServices.getDomServiceOptions()),u={...t,domService:d};T.init(),T.section("Task Execution Started"),T.log(`Task: ${e}`),T.log(`Max steps: ${a}`),T.log(`Model: ${s.length>1?s.join(" \u2192 "):r}`);let h={currentStep:0,maxSteps:a,consecutiveFailures:0,maxFailures:o,lastFailReason:null,stepHistory:[],memory:[],lastGoal:null,lastEvaluation:null},p=[],w=Vn(i.customPrompt),f=new Jn(w);T.log(`System prompt length: ${w.length} chars`);let y=!1,m="",v=[];try{for(i.onEvent?.({type:"start",task:e,maxSteps:a});h.currentStep<a;){if(i.abortSignal?.aborted)throw new Error("Task aborted by user");h.currentStep++;let _=Date.now();T.section(`Step ${h.currentStep}/${a}`),T.log(`URL: ${u.page.url()}`),i.onEvent?.({type:"step_start",step:h.currentStep});try{T.log("Waiting for page to stabilize..."),await kt(u.page),T.log("Page stabilized")}catch{T.log("Page stabilization timed out, continuing anyway")}let x;try{T.log("Preparing context (DOM + screenshot)...");let G=u.agentServices.getInteractiveClassNames(),Z=u.agentServices.getIframeFallbackDomains();x=await rl(u.page,u.domService,G,Z),T.log("Context prepared")}catch(G){if(G.message.includes("Execution context was destroyed")){T.log("Page navigating, waiting for load..."),await kt(u.page);let Z=u.agentServices.getInteractiveClassNames(),K=u.agentServices.getIframeFallbackDomains();x=await rl(u.page,u.domService,Z,K)}else throw T.error("Error preparing context",G),G}f.addStateMessage(e,x.currentUrl,x.domTree,x.screenshotBase64,h,{isFinalStep:h.currentStep===a-1,placeholderData:t.variables,sensitiveKeys:t.sensitiveKeys});let E=await Yu(f,s,l,i,x.screenshotBase64);if(typeof E.modelIndexUsed=="number"&&(l=E.modelIndexUsed,c=s[E.modelIndexUsed]??c),E.tokenUsages&&E.tokenUsages.length>0&&p.push(...E.tokenUsages),!E.stepOutput){if(T.error("Failed to get valid LLM response"),h.consecutiveFailures++,h.consecutiveFailures>=o){m="Reached the maximum allowed consecutive failures. Most recent error: Unable to get a valid response from the language model.";break}continue}let $=E.stepOutput;eh(h.currentStep,a,$);let I=await Zu($,u,x.domState,h.currentStep,i.onEvent,x.screenshotBase64,E.debugInfo);v.push(...I.actionEntities);let D=Qu(h.currentStep,$,I,h,_,E.debugInfo,E.tokenUsages),C=Date.now()-_;if(i.onEvent?.({type:"step_complete",step:h.currentStep,duration:C}),h.consecutiveFailures>=o){T.error(`Too many consecutive failures (${h.consecutiveFailures}), stopping`),m=`Reached the maximum allowed consecutive failures. Most recent error: ${h.lastFailReason}`;break}if(I.doneResult){y=I.doneResult.success,m=I.doneResult.summary;break}if(I.completesInstruction){y=!0,m="Instruction completed";break}}return h.currentStep>=a&&!y&&(m="Reached the maximum allowed steps."),i.onEvent?.({type:"complete",totalSteps:h.currentStep,duration:Date.now()-n}),T.log(`Build success result: summary=${m}, completed=${y}, actions=${v.length}, tokens=${p.length}`),th(h,v,y,m,n,p,c)}catch(_){let x=_.message;return T.error(`Task execution failed: ${x}`,_),i.onEvent?.({type:"error",error:x,recoverable:!1}),ih(h,x,n,p,c)}}async function rl(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 Ju(e){return e.map(t=>({role:t.role,content:Array.isArray(t.content)?t.content.map(i=>{if(i.type==="file"){let n=i.data,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 Yu(e,t,i,n,a){let{messages:o}=e.getMessages(),r=0;for(let d of o)Array.isArray(d.content)&&(r+=d.content.filter(u=>u.type==="file").length);let s=ar(),l=3,c=Math.max(0,Math.min(i,t.length-1));for(let d=c;d<t.length;d++){let u=t[d],h=d===t.length-1,p=xe(u,r),w=Me(u,n.temperature);try{for(let f=0;f<l;f++){let{system:y,messages:m}=e.getMessages(),v={model:ve(u),instructions:y,messages:m,providerOptions:p};w!==void 0&&(v.temperature=w);let _=new AbortController,x=s>0?setTimeout(()=>_.abort(),s):void 0,E=or(n.abortSignal,s>0?_.signal:void 0);E&&(v.abortSignal=E);let $;try{let z=Date.now();d===c?T.log(`Calling LLM (${u})...`):T.log(`Calling LLM (${u}) [fallback ${d}/${t.length-1}]...`),$=await be(Le=>(0,sl.generateText)({...v,abortSignal:Le}));let fe=Date.now()-z;T.llmCall(u,fe,$.usage)}finally{x&&clearTimeout(x)}let I=$,D=I.usage,C=I.reasoningText;C&&(T.thinking(C),n.onEvent?.({type:"thinking",text:C})),e.addAssistantMessage($.text);let G={systemPrompt:y,userPrompt:Ju(m),rawLlmResponse:$.text,reasoningContent:C,screenshotWithSom:a},Z=[],K=Ae(D,u);K&&Z.push(K);let X=qu($.text);if(!X){if(f<l-1){T.log(`Attempt ${f+1}/${l}: 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.");continue}return T.error("All parsing attempts failed"),{stepOutput:null,debugInfo:G,tokenUsages:Z,modelIndexUsed:d}}return{stepOutput:X,debugInfo:G,tokenUsages:Z,modelIndexUsed:d}}}catch(f){if(n.abortSignal?.aborted)throw f;if(!h&&xa(f)){T.log(`Model "${u}" failed (${f.message}); falling back to "${t[d+1]}"`);continue}throw T.error("All LLM call attempts failed",f),f}}return{stepOutput:null}}function qu(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 T.error("Missing required field: current_goal"),null;if(!i.actions||!Array.isArray(i.actions)||i.actions.length===0)return T.error("Missing required field: actions (must be non-empty array)"),null;for(let n of i.actions){if(!n.action_name)return T.error("Action missing required field: action_name"),null;if(!n.description)return T.error("Action missing required field: description"),null}return i}catch(i){return T.error(`Failed to parse LLM JSON response: ${t.substring(0,500)}`),T.error(`Parse error: ${i.message}`),null}}async function Zu(e,t,i,n,a,o,r){let s=[],l=!0,c=null;T.log(`Using pre-captured DOM state with ${i.selectorMap.size} elements for ${e.actions.length} action(s)`);let d=null,u={...t,domState:i},h=o;for(let p of e.actions){if(p.action_name==="done"){d={success:p.kwargs.success??!0,summary:p.kwargs.summary||p.kwargs.text||"Task completed"};break}let w={},f=p.kwargs?.element_index??p.kwargs?.index;if(typeof f=="number"){let m=i.selectorMap.get(f);m&&(w=await W(t.page,m))}let y={...w,action_description:p.description,action_data:{action_name:p.action_name,kwargs:p.kwargs}};try{let m=await Y.execute(p.action_name,p.kwargs,u);p.action_name==="perform_accurate_operation"&&(y=m.actionEntity);let v=await u.agentServices.getCurrentPage();if(v&&(u.page=v,t.page=u.page),m?.success===!1){l=!1,T.log("Action failed, stopping execution of remaining actions in this step"),c=m.error||"Action execution failed";break}s.push(y),a?.({type:"action",action_entity:y,step:n,debugInfo:r})}catch(m){l=!1,c=m.message,T.error(`Action execution failed: ${m.message}`);break}}return{allSuccess:l,failReason:c,actionEntities:s,doneResult:d,completesInstruction:e.completes_instruction??!1}}function Qu(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 eh(e,t,i){if(T.log(`Step ${e}/${t}`),i.thinking&&T.log(`Thinking: ${i.thinking}`),i.evaluation_previous_goal&&T.log(`Evaluation: ${i.evaluation_previous_goal}`),i.memory&&T.log(`Memory: ${i.memory}`),T.log(`Goal: ${i.current_goal}`),i.actions.length===1){let n=i.actions[0];T.log(`Action: ${n.action_name}(${JSON.stringify(n.kwargs)}) - ${n.description}`)}else T.log(`Actions (${i.actions.length}):`),i.actions.forEach((n,a)=>{T.log(` ${a+1}. ${n.action_name}(${JSON.stringify(n.kwargs)}) - ${n.description}`)})}function th(e,t,i,n,a,o,r){let s=o.reduce((d,u)=>d+u.prompt_tokens,0),l=o.reduce((d,u)=>d+u.completion_tokens,0),c=o.reduce((d,u)=>d+u.total_tokens,0);return{success:!0,completed:i,summary:n,trajectory:{steps:e.currentStep,actions:t,stepRecords:e.stepHistory},metadata:{totalSteps:e.currentStep,totalDuration:Date.now()-a,model:r,successfulSteps:e.stepHistory.filter(d=>d.outcome.success).length,failedSteps:e.stepHistory.filter(d=>!d.outcome.success).length,promptTokens:s,completionTokens:l,totalTokens:c,tokenUsages:o}}}function ih(e,t,i,n,a){let o=n.reduce((l,c)=>l+c.prompt_tokens,0),r=n.reduce((l,c)=>l+c.completion_tokens,0),s=n.reduce((l,c)=>l+c.total_tokens,0);return{success:!1,completed:!1,error:t,trajectory:{steps:e.currentStep,actions:[],stepRecords:e.stepHistory},metadata:{totalSteps:e.currentStep,totalDuration:Date.now()-i,model:a,successfulSteps:e.stepHistory.filter(l=>l.outcome.success).length,failedSteps:e.stepHistory.filter(l=>!l.outcome.success).length,promptTokens:o,completionTokens:r,totalTokens:s,tokenUsages:n}}}var sl,cl=b(()=>{"use strict";so();Xn();Ge();Te();nt();re();Ve();$e();Ie();ee();Pe();sl=require("ai")});var dl={};lt(dl,{TaskMessageManager:()=>Jn,formatFinalStepWarning:()=>ol,formatTaskContext:()=>zn,getBrowserTaskJSONPrompt:()=>Vn,runTaskLoop:()=>ll});var ul=b(()=>{"use strict";cl();so();Xn();Ge();Te();vn();nt();Vt();yt();Xt();Jt();qt();re();Ve();$e();Ie();Bt();Gt();ut();Ue();Be();dt();it();ee();Qe();Pe();_t();U();ne();Zt();B();Se()});async function Qt(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(Y.has(i)){let a=await Y.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 nh()).execute(a,e,o),{success:!0,error:void 0}}}catch(i){return{success:!1,error:i.message}}}async function nh(){if(Yn)return Yn;let e=await Promise.resolve().then(()=>(Kn(),Gn));return Yn=new e.default,Yn}async function xn(e,t,i,n={},a){let o=a||{page:t,agentServices:i,domService:new Xe(i.getDomServiceOptions()),executionHistory:n.executionHistory,variables:n.variables,sensitiveKeys:n.sensitiveKeys},r=i.replaceVariables(e),s=await Ma(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 _n(e,t,i,n={},a){let o=a||{page:t,agentServices:i,domService:new Xe(i.getDomServiceOptions()),executionHistory:n.executionHistory,variables:n.variables,sensitiveKeys:n.sensitiveKeys},r=i.replaceVariables(e),s=await Ma(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:c,goalAccomplished:d,debugInfo:u}=s,h=await Qt(l,o);return h.success?(c&&i.addNote(c),{status:"success",completed:d||!1,actionEntities:[l],explanation:c,debugInfo:u}):{status:"error",completed:!1,actionEntities:[l],error:h.error||"Action execution failed",debugInfo:u}}async function kn(e,t,i,n={}){let a={page:t,agentServices:i,domService:new Xe(i.getDomServiceOptions()),executionHistory:n.executionHistory,variables:n.variables,sensitiveKeys:n.sensitiveKeys},o=i.replaceVariables(e);return n.useCleanScreenshotForAssertion??(n.useCleanScreenshotForAssertion=i.isUseCleanScreenshotForAssertion()),Sr(o,a,n)}async function Sn(e,t,i,n,a={}){let{runTaskLoop:o}=await Promise.resolve().then(()=>(ul(),dl)),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 Yn,ei=b(()=>{"use strict";dn();Te();nt();Yn=null});var mo=b(()=>{"use strict";re();Pe()});var Ll=b(()=>{"use strict"});var Dl=b(()=>{"use strict"});var Rl=b(()=>{"use strict"});var S,Fl,go,Hl,Mt,Wl,jl,Ul,le,Bl,Zn,wo,yo=b(()=>{"use strict";S=require("zod"),Fl=S.z.enum(["JS_CODE","AI_MODE"]),go=S.z.object({type:Fl,expression:S.z.string()}),Hl=S.z.enum(["DRAFT","STEP","ACTION","IF_ELSE","WHILE_LOOP"]),Mt=S.z.object({uid:S.z.string(),type:Hl,comment:S.z.string().optional()}),Wl=S.z.object({action_data:S.z.object({action_name:S.z.string(),kwargs:S.z.record(S.z.any()).optional(),args:S.z.array(S.z.any()).optional()}),action_description:S.z.string().optional(),url:S.z.string().optional(),xpath:S.z.string().nullable().optional(),locator:S.z.string().nullable().optional(),css_selector:S.z.string().nullable().optional(),unique_selector:S.z.string().nullable().optional(),element_index:S.z.number().nullable().optional(),frame_path:S.z.array(S.z.any()).optional(),artifacts:S.z.record(S.z.any()).optional(),feedback:S.z.string().optional(),original_browser_use_action:S.z.any().optional()}).passthrough(),jl=Mt.extend({type:S.z.literal("DRAFT"),description:S.z.string()}),Ul=Mt.extend({type:S.z.literal("ACTION"),description:S.z.string(),action_entity:Wl.optional(),locator:S.z.string().optional(),use_pure_vision:S.z.boolean().optional()}),le=S.z.lazy(()=>S.z.union([jl,Ul,Mt.extend({type:S.z.literal("STEP"),description:S.z.string().optional().default(""),statements:S.z.array(le),reference_id:S.z.number().optional(),template_path:S.z.string().optional(),template_params:S.z.record(S.z.string()).optional()}),Mt.extend({type:S.z.literal("IF_ELSE"),description:S.z.string().optional(),condition:go,then:S.z.array(le),else:S.z.array(le).optional()}),Mt.extend({type:S.z.literal("WHILE_LOOP"),description:S.z.string().optional(),condition:go,body:S.z.array(le),timeout_ms:S.z.number().optional()})])),Bl=S.z.object({name:S.z.string(),statements:S.z.array(le),teardown:S.z.array(le).optional(),skip:S.z.union([S.z.boolean(),S.z.string()]).optional(),timeout:S.z.number().optional(),fail:S.z.union([S.z.boolean(),S.z.string()]).optional(),only:S.z.boolean().optional(),slow:S.z.boolean().optional()}),Zn=S.z.object({tests:S.z.array(Bl).min(1),beforeAll:S.z.array(le).optional(),afterAll:S.z.array(le).optional(),beforeEach:S.z.array(le).optional(),afterEach:S.z.array(le).optional()}),wo=S.z.object({comment:S.z.string().optional(),version:S.z.string().optional(),goal:S.z.string().optional(),url:S.z.string().optional(),baseURL:S.z.string().optional(),final_feedback:S.z.string().optional(),completed:S.z.boolean().optional(),success:S.z.boolean().optional(),statements:S.z.array(le).optional(),teardown:S.z.array(le).optional(),last_modified_at:S.z.string().optional(),testGroup:Zn.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"})});function Qn(e,t){let i={...t?.test_case_id!==void 0?{test_case_id:t.test_case_id}:{},...t?.name?{name:t.name}:{},...t?.tags&&t.tags.length>0?{tags:t.tags}:{},...t?.skip!==void 0?{skip:t.skip}:{},...t?.fail!==void 0?{fail:t.fail}:{},...t?.only?{only:t.only}:{},...t?.slow?{slow:t.slow}:{},goal:e.goal??"",url:e.url,base_url:e.baseURL,...t?.timeout!==void 0?{timeout:t.timeout}:{},...t?.settings&&Object.keys(t.settings).length>0?{settings:t.settings}:{},...t?.use&&Object.keys(t.use).length>0?{use:t.use}:{},...t?.beforeEach&&t.beforeEach.length>0?{beforeEach:t.beforeEach}:{},...t?.afterEach&&t.afterEach.length>0?{afterEach:t.afterEach}:{},...t?.parameters&&t.parameters.length>0?{parameters:t.parameters}:{},statements:(e.statements??[]).map(me)};return e.final_feedback&&(i.final_feedback=e.final_feedback),e.teardown&&e.teardown.length>0&&(i.teardown=e.teardown.map(me)),i}function vo(e,t){if(e.testGroup)return Xl(e,t);let i=Qn(e,t),n=new H.Document(i),a=n.contents?.get("tags",!0);return(0,H.isSeq)(a)&&(a.flow=!0),e.comment&&(n.commentBefore=e.comment),Gl(n,e.statements??[]),e.teardown&&Gl(n,e.teardown,"teardown"),n.toString(Vl)}function Gl(e,t,i="statements"){let n=e.contents;if(!n||!(0,H.isMap)(n))return;let a=n.get(i,!0);(0,H.isSeq)(a)&&Ri(a,t)}function Ri(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),(0,H.isMap)(a)){let o=a;if(n.type==="STEP"){let r=o.get("statements",!0);(0,H.isSeq)(r)&&Ri(r,n.statements)}else if(n.type==="IF_ELSE"){let r=o.get("THEN",!0);(0,H.isSeq)(r)&&Ri(r,n.then);let s=o.get("ELSE",!0);(0,H.isSeq)(s)&&n.else&&Ri(s,n.else)}else if(n.type==="WHILE_LOOP"){let r=o.get("DO",!0);(0,H.isSeq)(r)&&Ri(r,n.body)}}}}function Xl(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),e.baseURL&&(n.base_url=e.baseURL),t?.tags&&t.tags.length>0&&(n.tags=t.tags),t?.use&&Object.keys(t.use).length>0&&(n.use=t.use),t?.settings&&Object.keys(t.settings).length>0&&(n.settings=t.settings);let a={};i.beforeAll&&i.beforeAll.length>0&&(a.beforeAll=i.beforeAll.map(me)),i.beforeEach&&i.beforeEach.length>0&&(a.beforeEach=i.beforeEach.map(me)),i.afterEach&&i.afterEach.length>0&&(a.afterEach=i.afterEach.map(me)),i.afterAll&&i.afterAll.length>0&&(a.afterAll=i.afterAll.map(me)),a.tests=i.tests.map(s=>{let l={name:s.name};return s.skip!==void 0&&(l.skip=s.skip),s.timeout!==void 0&&(l.timeout=s.timeout),s.fail!==void 0&&(l.fail=s.fail),s.only!==void 0&&(l.only=s.only),s.slow!==void 0&&(l.slow=s.slow),l.statements=s.statements.map(me),s.teardown&&s.teardown.length>0&&(l.teardown=s.teardown.map(me)),l}),n.suite=a;let o=new H.Document(n),r=o.contents?.get("tags",!0);return(0,H.isSeq)(r)&&(r.flow=!0),o.toString(Vl)}function me(e){switch(e.type){case"DRAFT":return Sh(e);case"ACTION":return Eh(e);case"STEP":return Th(e);case"IF_ELSE":return Ah(e);case"WHILE_LOOP":return $h(e)}}function Sh(e){return{intent:e.description}}function Eh(e){let t=e.action_entity?.action_data?.action_name??e.action_entity?.action?.action_name,i=e.action_entity?.action_data?.kwargs??e.action_entity?.action?.kwargs;if(t==="verify"){let s=i?.statement;if(typeof s=="string"&&!e.action_entity?.locator&&!e.action_entity?.xpath){let l=i?.code;return typeof l=="string"&&l.trim()?{VERIFY:s,js:l}:{VERIFY:s}}}if(t==="go_to_url"){let s=i?.url;if(typeof s=="string"&&!e.action_entity?.locator&&!e.action_entity?.xpath){let l={URL:s};return i?.new_tab===!0&&(l.new_tab=!0),typeof i?.timeout_seconds=="number"&&(l.timeout_seconds=i.timeout_seconds),l}}if(t==="js_action"){let s=i?.code;if(typeof s=="string"&&s.trim()&&e.description)return{description:e.description,js:s}}if(t==="ai_wait_until"){let s=i?.condition;if(typeof s=="string"){let l=typeof i?.js=="string"&&i.js.trim()?i.js:void 0,c={};if(l)c.WAIT_UNTIL=s,c.js=l;else{let d=i?.condition_type==="JS_CODE"?"JS_CODE":"AI_MODE";c.WAIT_UNTIL=xo({type:d,expression:s})}return typeof i?.timeout_seconds=="number"&&i.timeout_seconds!==60&&(c.timeout_seconds=i.timeout_seconds),c}}if(t==="wait"){let s=i?.seconds,c={WAIT:e.description||`Wait ${s}s`};return typeof s=="number"&&(c.seconds=s),c}if(t==="js_code"){let s=i?.code;if(typeof s=="string"&&!e.action_entity?.locator&&!e.action_entity?.xpath)return{description:e.description||"Code block",js:s}}if(!e.action_entity)return{intent:e.description};let n=e.action_entity.action_data??e.action_entity.action;if(!n)return{intent:e.description};if(n.action_name==="function"&&typeof n.kwargs?.functionName=="string"&&n.kwargs.functionName.includes("#")&&!Array.isArray(n.kwargs.parameterNames)&&!Array.isArray(n.kwargs.parameterValues)&&(!Array.isArray(n.args)||n.args.length===0)){let s={intent:e.description,call:n.kwargs.functionName};return Array.isArray(n.kwargs.args)&&n.kwargs.args.length>0&&(s.args=n.kwargs.args),s}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))s!=="uid"&&(s==="statement"&&(t==="ai_action"||t==="ai_step")||(a[s]=l));return n.args&&n.args.length>0&&(a.args=n.args),a}function Th(e){if(e.template_path){let i={template:e.template_path};return e.template_params&&Object.keys(e.template_params).length>0&&(i.params=e.template_params),i}let t={STEP:e.description,statements:e.statements.map(me)};return e.reference_id!==void 0&&(t.reference_id=e.reference_id),t}function Ah(e){let t={IF:xo(e.condition),THEN:e.then.map(me)};return e.else&&e.else.length>0&&(t.ELSE=e.else.map(me)),t}function $h(e){let t={WHILE:xo(e.condition),DO:e.body.map(me)};return e.timeout_ms!==void 0&&(t.timeout_ms=e.timeout_ms),t}function xo(e){return e.type==="JS_CODE"?`js:${e.expression}`:e.expression}function _o(e){try{let t=(0,H.parse)(e);if(!t||typeof t!="object")return{};let i={};return typeof t.test_case_id=="number"&&Number.isFinite(t.test_case_id)&&(i.test_case_id=t.test_case_id),typeof t.template_id=="number"&&Number.isFinite(t.template_id)&&(i.template_id=t.template_id),typeof t.name=="string"&&t.name.trim()&&(i.name=t.name.trim()),typeof t.timeout=="number"&&Number.isFinite(t.timeout)&&(i.timeout=t.timeout),t.settings&&typeof t.settings=="object"&&!Array.isArray(t.settings)&&(i.settings=t.settings),t.use&&typeof t.use=="object"&&!Array.isArray(t.use)&&(i.use=t.use),Array.isArray(t.tags)&&t.tags.every(n=>typeof n=="string")&&(i.tags=t.tags),(typeof t.skip=="boolean"||typeof t.skip=="string")&&(i.skip=t.skip),(typeof t.fail=="boolean"||typeof t.fail=="string")&&(i.fail=t.fail),t.only===!0&&(i.only=!0),t.slow===!0&&(i.slow=!0),Array.isArray(t.beforeEach)&&t.beforeEach.length>0&&(i.beforeEach=t.beforeEach),Array.isArray(t.afterEach)&&t.afterEach.length>0&&(i.afterEach=t.afterEach),Array.isArray(t.parameters)&&t.parameters.length>0&&(i.parameters=t.parameters),i}catch{return{}}}function bo(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(bo);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]=bo(o);return n}function Oe(e){if(e.length>Kl)throw new Error(`YAML input too large (${e.length} bytes, max ${Kl})`);let t=bo((0,H.parse)(e));if(!t||typeof t!="object")throw new Error("Invalid YAML: expected an object at root level");if(t.suite)return Mh(t);let i={version:"1.3.0",goal:t.goal,url:t.url,baseURL:t.base_url,statements:pe(t.statements??[])};t.final_feedback&&(i.final_feedback=t.final_feedback),t.teardown&&Array.isArray(t.teardown)&&(i.teardown=pe(t.teardown));let n=wo.safeParse(i);if(!n.success)throw new Error(`Invalid TestFlow after YAML conversion: ${JSON.stringify(n.error.errors)}`);let a=n.data;return ea(e,a),a}function Mh(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:pe(s.statements)};return Array.isArray(s.teardown)&&s.teardown.length>0&&(l.teardown=pe(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=pe(t.beforeAll)),Array.isArray(t.afterAll)&&t.afterAll.length>0&&(a.afterAll=pe(t.afterAll)),Array.isArray(t.beforeEach)&&t.beforeEach.length>0&&(a.beforeEach=pe(t.beforeEach)),Array.isArray(t.afterEach)&&t.afterEach.length>0&&(a.afterEach=pe(t.afterEach));let o=Zn.safeParse(a);if(!o.success)throw new Error(`Invalid TestGroup: ${JSON.stringify(o.error.errors)}`);return{version:"1.3.0",baseURL:(t.base_url??e.base_url)||void 0,testGroup:o.data}}function pe(e){if(!Array.isArray(e))throw new Error("Expected an array of statements");return e.map(Ih)}function Ih(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 Ch(t);if("WHILE"in t)return Ph(t);if("STEP"in t)return Oh(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:(0,ce.v4)(),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:(0,ce.v4)(),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=typeof t.WAIT_UNTIL=="string"?t.WAIT_UNTIL:String(t.WAIT_UNTIL),n=ko(i),a=typeof t.timeout_seconds=="number"?t.timeout_seconds:60;if(typeof t.js=="string"){if(n.type==="JS_CODE")throw new Error('WAIT_UNTIL cannot combine a "js:"-prefixed condition with a sibling "js:" key \u2014 put the intent in WAIT_UNTIL and the expression in js:');return{uid:(0,ce.v4)(),type:"ACTION",description:`Wait until: ${i}`,action_entity:{action_description:`Wait until: ${i}`,action_data:{action_name:"ai_wait_until",kwargs:{condition:i,condition_type:"JS_CODE",js:t.js,timeout_seconds:a}}}}}return{uid:(0,ce.v4)(),type:"ACTION",description:`Wait until: ${n.expression}`,action_entity:{action_description:`Wait until: ${n.expression}`,action_data:{action_name:"ai_wait_until",kwargs:{condition:n.expression,condition_type:n.type,timeout_seconds:a}}}}}if("WAIT"in t){let i=t.WAIT,n=typeof t.seconds=="number"?t.seconds:3;return{uid:(0,ce.v4)(),type:"ACTION",description:typeof i=="string"?i:`Wait ${n}s`,action_entity:{action_description:typeof i=="string"?i:`Wait ${n}s`,action_data:{action_name:"wait",kwargs:{seconds:n}}}}}if("CODE"in t){let i=t.CODE;if(i==null)throw new Error('CODE statement has no code. Use "CODE: |" followed by indented code on the next line.');let n=typeof t.description=="string"?t.description:"Code block";return{uid:(0,ce.v4)(),type:"ACTION",description:n,action_entity:{action_description:n,action_data:{action_name:"js_code",kwargs:{code:typeof i=="string"?i:String(i)}}}}}if("js"in t&&!("VERIFY"in t)&&!("action"in t)){if("intent"in t||"desc"in t)throw new Error("A `js:` statement uses `description:`, not `intent:`. Raw JS does not self-heal \u2014 use `description: + js:` for code, or express it as a structured action (`intent:` + `action:`/`locator:`) to keep self-healing.");let i=typeof t.description=="string"&&t.description.trim()!==""?t.description:"Code block",n=t.js;return{uid:(0,ce.v4)(),type:"ACTION",description:i,action_entity:{action_description:i,action_data:{action_name:"js_code",kwargs:{code:typeof n=="string"?n:String(n)}}}}}if("call"in t&&typeof t.call=="string"){let{call:i,...n}=t;return zl({...n,action:"function",functionName:i})}if("action"in t)return zl(t);if("intent"in t&&typeof t.intent=="string"||"desc"in t&&typeof t.desc=="string")return{uid:(0,ce.v4)(),type:"DRAFT",description:typeof t.intent=="string"?t.intent:t.desc};throw new Error(`Cannot infer statement type from object: ${JSON.stringify(t)}`)}function ko(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 Ch(e){let t=ko(e.IF),i=e.THEN;if(!Array.isArray(i))throw new Error("IF_ELSE requires a THEN array");let n={uid:(0,ce.v4)(),type:"IF_ELSE",condition:t,then:pe(i)};return"ELSE"in e&&Array.isArray(e.ELSE)&&(n.else=pe(e.ELSE)),n}function Ph(e){let t=ko(e.WHILE),i=e.DO;if(!Array.isArray(i))throw new Error("WHILE_LOOP requires a DO array");let n={uid:(0,ce.v4)(),type:"WHILE_LOOP",condition:t,body:pe(i)};return typeof e.timeout_ms=="number"&&(n.timeout_ms=e.timeout_ms),n}function Oh(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:(0,ce.v4)(),type:"STEP",description:t,statements:pe(e.statements)};if(typeof e.reference_id=="number"&&(i.reference_id=e.reference_id),typeof e.template_path=="string"&&(i.template_path=e.template_path),e.template_params&&typeof e.template_params=="object"&&!Array.isArray(e.template_params)){let n=e.template_params,a={};for(let[o,r]of Object.entries(n))a[o]=String(r);i.template_params=a}return i}function zl(e){let t=typeof e.action=="string"?e.action:String(e.action),i=typeof e.intent=="string"?e.intent:typeof e.desc=="string"?e.desc:"",n=typeof e.locator=="string"?e.locator:void 0,a=typeof e.xpath=="string"?e.xpath:void 0,o=typeof e.use_pure_vision=="boolean"?e.use_pure_vision:void 0,r={};for(let[c,d]of Object.entries(e))Nh.has(c)||(r[c]=d);t==="verify"&&typeof r.js=="string"&&(r.code=r.js,delete r.js),(t==="ai_action"||t==="ai_step")&&(r.statement===void 0&&(r.statement=i),o&&(r.use_pure_vision=!0));let s={action_description:i,action_data:{action_name:t,kwargs:Object.keys(r).length>0?r:{}}};n&&(s.locator=n),a&&(s.xpath=a);let l={uid:(0,ce.v4)(),type:"ACTION",description:i,action_entity:s};return o&&(l.use_pure_vision=!0),l}function ea(e,t){let i;try{i=(0,H.parseDocument)(e)}catch{return}let n=i.contents;if(!n||!(0,H.isMap)(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);(0,H.isSeq)(o)&&t.statements&&It(o,t.statements);let r=a.get("teardown",!0);(0,H.isSeq)(r)&&t.teardown&&It(r,t.teardown)}function It(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"&&(0,H.isMap)(n)){let o=n.get("statements",!0);(0,H.isSeq)(o)&&It(o,a.statements)}else if(a.type==="IF_ELSE"&&(0,H.isMap)(n)){let o=n.get("THEN",!0);(0,H.isSeq)(o)&&It(o,a.then);let r=n.get("ELSE",!0);(0,H.isSeq)(r)&&a.else&&It(r,a.else)}else if(a.type==="WHILE_LOOP"&&(0,H.isMap)(n)){let o=n.get("DO",!0);(0,H.isSeq)(o)&&It(o,a.body)}}}var H,ce,Vl,Kl,Nh,ta=b(()=>{"use strict";yo();H=require("yaml"),ce=require("uuid");Vl={lineWidth:120,defaultKeyType:"PLAIN",defaultStringType:"PLAIN"};Kl=1024*1024;Nh=new Set(["action","intent","desc","locator","xpath","use_pure_vision"])});var Jl,Yl=b(()=>{"use strict";ta();Jl=require("yaml")});var ia=b(()=>{"use strict"});var ql=b(()=>{"use strict";ta();ia()});var Zl=b(()=>{"use strict"});var Ql=b(()=>{"use strict";ia()});var Rh,ec=b(()=>{"use strict";Rh=require("uuid")});var ot,tc=b(()=>{"use strict";ot=(e=>(e.DRAFT="DRAFT",e.STEP="STEP",e.ACTION="ACTION",e.IF_ELSE="IF_ELSE",e.WHILE_LOOP="WHILE_LOOP",e))(ot||{})});var na=b(()=>{"use strict"});var ic=b(()=>{"use strict";na()});var nc=b(()=>{"use strict";na()});var ac,Wh,oc,rc,Fi,jh,Uh,sc=b(()=>{"use strict";ac=112,Wh=1080-ac,oc={"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"}},rc={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"]},Fi=(e,t=!1)=>{let i=["chromium"];return t&&i.push("webkit"),rc[e].map(n=>oc[n]).filter(n=>n.defaultBrowserType&&i.includes(n.defaultBrowserType))},jh={desktop:{label:"Desktop",type:"desktop",devices:Fi("desktop")},mobile:{label:"Mobile Web",type:"mobile",devices:Fi("mobile")}},Uh={desktop:{label:"Desktop",type:"desktop",devices:Fi("desktop",!0)},mobile:{label:"Mobile Web",type:"mobile",devices:Fi("mobile",!0)}}});var lc=b(()=>{"use strict"});var cc=b(()=>{"use strict"});function uc(e){if(e!==null&&typeof e=="object"){for(let t of Object.values(e))uc(t);Object.freeze(e)}return e}var Bh,dc,Gh,So,Eo=b(()=>{"use strict";Bh=Object.freeze(["lite","standard","pro"]),dc=1,Gh=Object.freeze(["WEB_AGENT_MODEL","WEB_AGENT_FALLBACK_MODELS","COMPUTER_USE_MODEL"]),So=uc({version:dc,defaultTier:"lite",tiers:{lite:{webagent:{primary:"google:gemini-3-flash-preview",fallbacks:["anthropic:claude-haiku-4-5","openai:gpt-5.6-luna"]}},standard:{webagent:{primary:"google:gemini-3.5-flash",fallbacks:["anthropic:claude-sonnet-5","openai:gpt-5.6-terra"]}},pro:{webagent:{primary:"anthropic:claude-opus-4-8",fallbacks:["openai:gpt-5.6-sol","anthropic:claude-opus-4-7"]}}},computerUse:{primary:"google:gemini-3-flash-preview",fallbacks:[]}})});var Xh,hc=b(()=>{"use strict";Eo();Xh=Object.freeze([...So.tiers.standard.webagent.fallbacks])});var mc=b(()=>{"use strict"});var Ct=b(()=>{"use strict";Ll();Dl();Rl();Yl();ql();ta();yo();Zl();Ql();ec();ia();tc();ic();nc();na();sc();lc();cc();hc();Eo();mc()});function Qh(e){let t=e.frame_path;return!t||t.length===0?"page":`page.frameLocator('${t[0]}')`}function em(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 yc(e){let t=Qh(e),i=e.locator;if(typeof i=="string"&&i.trim())return i=i.trim(),i.endsWith("first()")?`${t}.${i}`:`${t}.${i}.first()`;let n=em(e);if(n){let a=JSON.stringify(n);return`${t}.locator(${a}).first()`}return null}function M(e,t){oe.set(e,t)}function rt(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 To(e,t){let i=t.action_data?.kwargs||{},n=[];return typeof i.relative_x=="number"&&typeof i.relative_y=="number"?(n.push(`action_data: { kwargs: { relative_x: ${i.relative_x}, relative_y: ${i.relative_y} } }`),t.locator?n.push(`locator: ${JSON.stringify(t.locator)}`):t.xpath&&n.push(`xpath: ${JSON.stringify(t.xpath)}`),t.frame_path&&t.frame_path.length>0&&n.push(`frame_path: ${JSON.stringify(t.frame_path)}`)):typeof i.x=="number"&&typeof i.y=="number"&&n.push(`action_data: { kwargs: { x: ${i.x}, y: ${i.y} } }`),[`await agent.execAction("${e}", page, {`,...n.map(a=>` ${a},`),"});"]}function pc(e){let t=e.functionName;if(!t)return null;let i=Array.isArray(e.args)?e.args.map(String):Array.isArray(e.parameterValues)?e.parameterValues.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 vc(e,t,i){let n={expandingPaths:new Set([(0,Pt.resolve)(t)]),depth:0,referencedPaths:new Set,basePath:i},a={...e};Array.isArray(a.statements)&&(a.statements=qe(a.statements,t,n)),Array.isArray(a.teardown)&&(a.teardown=qe(a.teardown,t,n));for(let o of["beforeAll","afterAll","beforeEach","afterEach"])Array.isArray(a[o])&&(a[o]=qe(a[o],t,n));return{doc:a,referencedTemplatePaths:Array.from(n.referencedPaths)}}function qe(e,t,i){let n=[];for(let a of e)if(tm(a)){let o=im(a,t,i);n.push(o)}else n.push(nm(a,t,i));return n}function tm(e){return typeof e=="object"&&e!==null&&typeof e.template=="string"}function im(e,t,i){if(i.depth>=fc)throw new Error(`Template expansion exceeded maximum depth of ${fc}. Check for deeply nested or circular template references.`);let n=(0,Pt.resolve)((0,Pt.dirname)(t),e.template),a=!(0,ra.existsSync)(n)&&i.basePath?(0,Pt.resolve)(i.basePath,e.template):n;if(i.expandingPaths.has(a))throw new Error(`Circular template reference detected: ${a} is already being expanded. Stack: ${Array.from(i.expandingPaths).join(" \u2192 ")} \u2192 ${a}`);i.referencedPaths.add(a);let o;try{o=(0,ra.readFileSync)(a,"utf-8")}catch(w){throw new Error(`Failed to read template file: ${a} (referenced from ${t}): ${w.message}`)}let r=(0,Hi.parse)(o);if(!r||typeof r!="object")throw new Error(`Invalid template file: ${a} \u2014 expected a YAML object`);let s=r.params||[],l=e.params||{};for(let w of s)if(!(w in l))throw new Error(`Template ${e.template} requires param "${w}" but it was not provided. Required params: [${s.join(", ")}]`);let c=r.statements;if(!Array.isArray(c))throw new Error(`Template ${e.template} must have a "statements" array`);if(Object.keys(l).length>0){let f=(0,Hi.stringify)(c);for(let[y,m]of Object.entries(l))f=f.split(`<<${y}>>`).join(String(m));c=(0,Hi.parse)(f)}let d={expandingPaths:new Set([...i.expandingPaths,a]),depth:i.depth+1,referencedPaths:i.referencedPaths},u=qe(c,a,d),p={STEP:r.name||e.template.replace(/\.yaml$/,"").split("/").pop()||e.template,template_path:e.template,statements:u};return Object.keys(l).length>0&&(p.template_params=l),p}function nm(e,t,i){if(typeof e!="object"||e===null)return e;let n={...e};return Array.isArray(n.statements)&&(n.statements=qe(n.statements,t,i)),Array.isArray(n.THEN)&&(n.THEN=qe(n.THEN,t,i)),Array.isArray(n.ELSE)&&(n.ELSE=qe(n.ELSE,t,i)),Array.isArray(n.DO)&&(n.DO=qe(n.DO,t,i)),n}function am(e){let t=[],i=e;for(;;){let n=aa.get(i);if(n!==void 0){for(let o of t)aa.set(o,n);return n}if(t.push(i),(0,xc.existsSync)((0,Ne.join)(i,".git"))){for(let o of t)aa.set(o,i);return i}let a=(0,Ne.dirname)(i);if(a===i){for(let o of t)aa.set(o,null);return null}i=a}}function gc(e){return e.split(/[\\/]/).join("/")}function om(e){if(!(0,Ne.isAbsolute)(e))return gc(e);let t=am((0,Ne.dirname)(e));return gc(t?(0,Ne.relative)(t,e):e)}function kc(e,t,i){let n=(0,Wi.parse)(e),a=n?.name,o=n?.tags,r=n?.use;if(n&&(n.name!==void 0||n.tags!==void 0||n.use!==void 0)&&(delete n.name,delete n.tags,delete n.use),n?.suite){if(n.goal||n.statements)throw new _c('YAML file cannot have both "suite" and top-level "goal"/"statements". Use either suite format or single-test format.');return sm(n,a,o,r,t,i)}return rm(n,a,o,r,t,i)}function rm(e,t,i,n,a,o){let r=e?.beforeEach,s=e?.afterEach,l=Sc(e?.parameters),c=e?.timeout,d=e?.skip,u=e?.fail,h=e?.only,p=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 _c(`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 w=[];if(a&&e&&typeof e=="object"){let m=vc(e,a,o);e=m.doc,w=m.referencedTemplatePaths}let f=(0,Wi.stringify)(e),y=Oe(f);return a&&(Ze(y.statements??[],a,"main"),y.teardown&&Ze(y.teardown,a,"teardown")),{testFlow:y,name:t,tags:i,use:n,beforeEach:r,afterEach:s,parameters:l,timeout:c,skip:d,fail:u,only:h,slow:p,referencedTemplatePaths:w}}function sm(e,t,i,n,a,o){let r=e.suite;if(!Array.isArray(r.tests)||r.tests.length===0)throw new Error('Suite must have a non-empty "tests" array.');let s=r.beforeAll,l=r.afterAll,c=r.beforeEach,d=r.afterEach,u=[],h=r.tests.map((f,y)=>{if(!f.name)throw new Error('Each test in a suite must have a "name" field.');if(!Array.isArray(f.statements)||f.statements.length===0)throw new Error(`Suite test "${f.name}" must have a non-empty "statements" array.`);let m={goal:f.name,statements:f.statements};f.teardown&&(m.teardown=f.teardown);let v=[],_=m;if(a&&typeof m=="object"){let I=vc(m,a,o);_=I.doc,v=I.referencedTemplatePaths,u.push(...v)}let x=(0,Wi.stringify)(_),E=Oe(x);if(a){let I=`tests[${y}]`;Ze(E.statements??[],a,I),E.teardown&&Ze(E.teardown,a,`${I}.teardown`)}let $=Sc(f.parameters);return{testFlow:E,name:f.name,tags:Array.isArray(f.tags)?f.tags:void 0,parameters:$,timeout:f.timeout,skip:f.skip,fail:f.fail,only:f.only,slow:f.slow}}),p=r.base_url??e.base_url,w=p?{...n,baseURL:p}:n;return{suite:{beforeAll:s,afterAll:l,beforeEach:c,afterEach:d,tests:h},name:t,tags:i,use:w,referencedTemplatePaths:u}}function Sc(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 Ze(e,t,i){for(let n=0;n<e.length;n++){let a=e[n],o=`${i}.${n}`,r=a.description||"";if(a.uid=lm(t,o,r),a.type===ot.STEP)Ze(a.statements,t,o);else if(a.type===ot.IF_ELSE){let s=a;Ze(s.then,t,`${o}.then`),s.else&&Ze(s.else,t,`${o}.else`)}else a.type===ot.WHILE_LOOP&&Ze(a.body,t,`${o}.body`)}}function lm(e,t,i){let n=om(e),a=(0,bc.createHash)("sha256").update(`${n}:${t}:${i}`).digest("hex");return`${a.slice(0,8)}-${a.slice(8,12)}-${a.slice(12,16)}-${a.slice(16,20)}-${a.slice(20,32)}`}var Zh,oa,bc,Wi,ra,Pt,Hi,xc,Ne,wc,oe,fc,aa,_c,Ec=b(()=>{"use strict";Ct();Zh=require("yaml");Ct();oa=ie(require("path"),1),bc=require("crypto"),Wi=require("yaml");Ct();ra=require("fs"),Pt=require("path"),Hi=require("yaml"),xc=require("fs"),Ne=require("path");Ct();wc=5e3;oe=new Map;M("click",e=>{let t=yc(e);if(!t)return['await agent.execAction("click", page, {});'];let i=e.action_data?.kwargs?.timeout_ms??wc;return[`await ${t}.click({ timeout: ${i} });`]});M("click_element",oe.get("click"));M("click_element_by_index",oe.get("click"));M("double_click",e=>rt("double_click",e));M("double_click_on_element",oe.get("double_click"));M("right_click",e=>rt("right_click",e));M("right_click_on_element",oe.get("right_click"));M("hover",e=>rt("hover",e));M("hover_element_by_index",oe.get("hover"));M("input_text",e=>{let t=e.action_data?.kwargs?.text??e.action_data?.kwargs?.value??"";return rt("input_text",e,[`action_data: { kwargs: { text: ${JSON.stringify(t)} } }`])});M("fill",oe.get("input_text"));M("clear_input",e=>rt("clear_input",e));M("press",e=>{let t=e.action_data?.kwargs?.keys;return[`await page.keyboard.press(${JSON.stringify(t)});`]});M("send_keys",oe.get("press"));M("send_keys_on_element",e=>{let t=yc(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??wc;return[`await ${t}.press(${JSON.stringify(i)}, { timeout: ${n} });`]});M("select_dropdown_option",e=>{let t=e.action_data?.kwargs?.text||e.action_data?.kwargs?.option||"";return rt("select_dropdown_option",e,[`action_data: { kwargs: { text: ${JSON.stringify(t)} } }`])});M("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)})');`]});M("scroll_down",oe.get("scroll"));M("scroll_up",oe.get("scroll"));M("scroll_element",oe.get("scroll"));M("scroll_to_text",e=>{let t=e.action_data?.kwargs?.text||"";return[`await page.getByText(${JSON.stringify(t)}, { exact: false }).first().scrollIntoViewIfNeeded();`]});M("scroll_on_element",e=>rt("scroll_on_element",e,[`action_data: { kwargs: ${JSON.stringify(e.action_data?.kwargs||{})} }`]));M("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)} } },`,"});"]});M("open_tab",oe.get("go_to_url"));M("go_back",()=>['await agent.execAction("go_back", page, {});']);M("reload_page",()=>['await agent.execAction("reload_page", page, {});']);M("wait",e=>[`await page.waitForTimeout(${(e.action_data?.kwargs?.seconds||1)*1e3});`]);M("wait_for_page_ready",()=>["await page.waitForLoadState('domcontentloaded');"]);M("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(`
|
|
4325
|
+
`,n+='- In action descriptions, describe what the placeholder represents in natural language (e.g., "Type the first user name" instead of "Type {{ firstUserName }}")',n}}});async function ll(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=[r,...t.agentServices.getFallbackModels().filter(_=>_!==r)],l=0,c=r,d=t.domService||new Xe(t.agentServices.getDomServiceOptions()),u={...t,domService:d};T.init(),T.section("Task Execution Started"),T.log(`Task: ${e}`),T.log(`Max steps: ${a}`),T.log(`Model: ${s.length>1?s.join(" \u2192 "):r}`);let h={currentStep:0,maxSteps:a,consecutiveFailures:0,maxFailures:o,lastFailReason:null,stepHistory:[],memory:[],lastGoal:null,lastEvaluation:null},p=[],w=Vn(i.customPrompt),f=new Jn(w);T.log(`System prompt length: ${w.length} chars`);let y=!1,m="",v=[];try{for(i.onEvent?.({type:"start",task:e,maxSteps:a});h.currentStep<a;){if(i.abortSignal?.aborted)throw new Error("Task aborted by user");h.currentStep++;let _=Date.now();T.section(`Step ${h.currentStep}/${a}`),T.log(`URL: ${u.page.url()}`),i.onEvent?.({type:"step_start",step:h.currentStep});try{T.log("Waiting for page to stabilize..."),await kt(u.page),T.log("Page stabilized")}catch{T.log("Page stabilization timed out, continuing anyway")}let x;try{T.log("Preparing context (DOM + screenshot)...");let G=u.agentServices.getInteractiveClassNames(),Z=u.agentServices.getIframeFallbackDomains();x=await rl(u.page,u.domService,G,Z),T.log("Context prepared")}catch(G){if(G.message.includes("Execution context was destroyed")){T.log("Page navigating, waiting for load..."),await kt(u.page);let Z=u.agentServices.getInteractiveClassNames(),K=u.agentServices.getIframeFallbackDomains();x=await rl(u.page,u.domService,Z,K)}else throw T.error("Error preparing context",G),G}f.addStateMessage(e,x.currentUrl,x.domTree,x.screenshotBase64,h,{isFinalStep:h.currentStep===a-1,placeholderData:t.variables,sensitiveKeys:t.sensitiveKeys});let E=await Yu(f,s,l,i,x.screenshotBase64);if(typeof E.modelIndexUsed=="number"&&(l=E.modelIndexUsed,c=s[E.modelIndexUsed]??c),E.tokenUsages&&E.tokenUsages.length>0&&p.push(...E.tokenUsages),!E.stepOutput){if(T.error("Failed to get valid LLM response"),h.consecutiveFailures++,h.consecutiveFailures>=o){m="Reached the maximum allowed consecutive failures. Most recent error: Unable to get a valid response from the language model.";break}continue}let $=E.stepOutput;eh(h.currentStep,a,$);let I=await Zu($,u,x.domState,h.currentStep,i.onEvent,x.screenshotBase64,E.debugInfo);v.push(...I.actionEntities);let D=Qu(h.currentStep,$,I,h,_,E.debugInfo,E.tokenUsages),C=Date.now()-_;if(i.onEvent?.({type:"step_complete",step:h.currentStep,duration:C}),h.consecutiveFailures>=o){T.error(`Too many consecutive failures (${h.consecutiveFailures}), stopping`),m=`Reached the maximum allowed consecutive failures. Most recent error: ${h.lastFailReason}`;break}if(I.doneResult){y=I.doneResult.success,m=I.doneResult.summary;break}if(I.completesInstruction){y=!0,m="Instruction completed";break}}return h.currentStep>=a&&!y&&(m="Reached the maximum allowed steps."),i.onEvent?.({type:"complete",totalSteps:h.currentStep,duration:Date.now()-n}),T.log(`Build success result: summary=${m}, completed=${y}, actions=${v.length}, tokens=${p.length}`),th(h,v,y,m,n,p,c)}catch(_){let x=_.message;return T.error(`Task execution failed: ${x}`,_),i.onEvent?.({type:"error",error:x,recoverable:!1}),ih(h,x,n,p,c)}}async function rl(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 Ju(e){return e.map(t=>({role:t.role,content:Array.isArray(t.content)?t.content.map(i=>{if(i.type==="file"){let n=i.data,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 Yu(e,t,i,n,a){let{messages:o}=e.getMessages(),r=0;for(let d of o)Array.isArray(d.content)&&(r+=d.content.filter(u=>u.type==="file").length);let s=ar(),l=3,c=Math.max(0,Math.min(i,t.length-1));for(let d=c;d<t.length;d++){let u=t[d],h=d===t.length-1,p=xe(u,r),w=Me(u,n.temperature);try{for(let f=0;f<l;f++){let{system:y,messages:m}=e.getMessages(),v={model:ve(u),instructions:y,messages:m,providerOptions:p};w!==void 0&&(v.temperature=w);let _=new AbortController,x=s>0?setTimeout(()=>_.abort(),s):void 0,E=or(n.abortSignal,s>0?_.signal:void 0);E&&(v.abortSignal=E);let $;try{let z=Date.now();d===c?T.log(`Calling LLM (${u})...`):T.log(`Calling LLM (${u}) [fallback ${d}/${t.length-1}]...`),$=await be(Le=>(0,sl.generateText)({...v,abortSignal:Le}));let fe=Date.now()-z;T.llmCall(u,fe,$.usage)}finally{x&&clearTimeout(x)}let I=$,D=I.usage,C=I.reasoningText;C&&(T.thinking(C),n.onEvent?.({type:"thinking",text:C})),e.addAssistantMessage($.text);let G={systemPrompt:y,userPrompt:Ju(m),rawLlmResponse:$.text,reasoningContent:C,screenshotWithSom:a},Z=[],K=Ae(D,u);K&&Z.push(K);let X=qu($.text);if(!X){if(f<l-1){T.log(`Attempt ${f+1}/${l}: 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.");continue}return T.error("All parsing attempts failed"),{stepOutput:null,debugInfo:G,tokenUsages:Z,modelIndexUsed:d}}return{stepOutput:X,debugInfo:G,tokenUsages:Z,modelIndexUsed:d}}}catch(f){if(n.abortSignal?.aborted)throw f;if(!h&&xa(f)){T.log(`Model "${u}" failed (${f.message}); falling back to "${t[d+1]}"`);continue}throw T.error("All LLM call attempts failed",f),f}}return{stepOutput:null}}function qu(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 T.error("Missing required field: current_goal"),null;if(!i.actions||!Array.isArray(i.actions)||i.actions.length===0)return T.error("Missing required field: actions (must be non-empty array)"),null;for(let n of i.actions){if(!n.action_name)return T.error("Action missing required field: action_name"),null;if(!n.description)return T.error("Action missing required field: description"),null}return i}catch(i){return T.error(`Failed to parse LLM JSON response: ${t.substring(0,500)}`),T.error(`Parse error: ${i.message}`),null}}async function Zu(e,t,i,n,a,o,r){let s=[],l=!0,c=null;T.log(`Using pre-captured DOM state with ${i.selectorMap.size} elements for ${e.actions.length} action(s)`);let d=null,u={...t,domState:i},h=o;for(let p of e.actions){if(p.action_name==="done"){d={success:p.kwargs.success??!0,summary:p.kwargs.summary||p.kwargs.text||"Task completed"};break}let w={},f=p.kwargs?.element_index??p.kwargs?.index;if(typeof f=="number"){let m=i.selectorMap.get(f);m&&(w=await W(t.page,m))}let y={...w,action_description:p.description,action_data:{action_name:p.action_name,kwargs:p.kwargs}};try{let m=await Y.execute(p.action_name,p.kwargs,u);p.action_name==="perform_accurate_operation"&&(y=m.actionEntity);let v=await u.agentServices.getCurrentPage();if(v&&(u.page=v,t.page=u.page),m?.success===!1){l=!1,T.log("Action failed, stopping execution of remaining actions in this step"),c=m.error||"Action execution failed";break}s.push(y),a?.({type:"action",action_entity:y,step:n,debugInfo:r})}catch(m){l=!1,c=m.message,T.error(`Action execution failed: ${m.message}`);break}}return{allSuccess:l,failReason:c,actionEntities:s,doneResult:d,completesInstruction:e.completes_instruction??!1}}function Qu(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 eh(e,t,i){if(T.log(`Step ${e}/${t}`),i.thinking&&T.log(`Thinking: ${i.thinking}`),i.evaluation_previous_goal&&T.log(`Evaluation: ${i.evaluation_previous_goal}`),i.memory&&T.log(`Memory: ${i.memory}`),T.log(`Goal: ${i.current_goal}`),i.actions.length===1){let n=i.actions[0];T.log(`Action: ${n.action_name}(${JSON.stringify(n.kwargs)}) - ${n.description}`)}else T.log(`Actions (${i.actions.length}):`),i.actions.forEach((n,a)=>{T.log(` ${a+1}. ${n.action_name}(${JSON.stringify(n.kwargs)}) - ${n.description}`)})}function th(e,t,i,n,a,o,r){let s=o.reduce((d,u)=>d+u.prompt_tokens,0),l=o.reduce((d,u)=>d+u.completion_tokens,0),c=o.reduce((d,u)=>d+u.total_tokens,0);return{success:!0,completed:i,summary:n,trajectory:{steps:e.currentStep,actions:t,stepRecords:e.stepHistory},metadata:{totalSteps:e.currentStep,totalDuration:Date.now()-a,model:r,successfulSteps:e.stepHistory.filter(d=>d.outcome.success).length,failedSteps:e.stepHistory.filter(d=>!d.outcome.success).length,promptTokens:s,completionTokens:l,totalTokens:c,tokenUsages:o}}}function ih(e,t,i,n,a){let o=n.reduce((l,c)=>l+c.prompt_tokens,0),r=n.reduce((l,c)=>l+c.completion_tokens,0),s=n.reduce((l,c)=>l+c.total_tokens,0);return{success:!1,completed:!1,error:t,trajectory:{steps:e.currentStep,actions:[],stepRecords:e.stepHistory},metadata:{totalSteps:e.currentStep,totalDuration:Date.now()-i,model:a,successfulSteps:e.stepHistory.filter(l=>l.outcome.success).length,failedSteps:e.stepHistory.filter(l=>!l.outcome.success).length,promptTokens:o,completionTokens:r,totalTokens:s,tokenUsages:n}}}var sl,cl=b(()=>{"use strict";so();Xn();Ge();Te();nt();re();Ve();$e();Ie();ee();Pe();sl=require("ai")});var dl={};lt(dl,{TaskMessageManager:()=>Jn,formatFinalStepWarning:()=>ol,formatTaskContext:()=>zn,getBrowserTaskJSONPrompt:()=>Vn,runTaskLoop:()=>ll});var ul=b(()=>{"use strict";cl();so();Xn();Ge();Te();vn();nt();Vt();yt();Xt();Jt();qt();re();Ve();$e();Ie();Bt();ut();Gt();Ue();Be();dt();it();ee();Qe();Pe();_t();U();ne();Zt();B();Se()});async function Qt(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(Y.has(i)){let a=await Y.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 nh()).execute(a,e,o),{success:!0,error:void 0}}}catch(i){return{success:!1,error:i.message}}}async function nh(){if(Yn)return Yn;let e=await Promise.resolve().then(()=>(Kn(),Gn));return Yn=new e.default,Yn}async function xn(e,t,i,n={},a){let o=a||{page:t,agentServices:i,domService:new Xe(i.getDomServiceOptions()),executionHistory:n.executionHistory,variables:n.variables,sensitiveKeys:n.sensitiveKeys},r=i.replaceVariables(e),s=await Ma(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 _n(e,t,i,n={},a){let o=a||{page:t,agentServices:i,domService:new Xe(i.getDomServiceOptions()),executionHistory:n.executionHistory,variables:n.variables,sensitiveKeys:n.sensitiveKeys},r=i.replaceVariables(e),s=await Ma(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:c,goalAccomplished:d,debugInfo:u}=s,h=await Qt(l,o);return h.success?(c&&i.addNote(c),{status:"success",completed:d||!1,actionEntities:[l],explanation:c,debugInfo:u}):{status:"error",completed:!1,actionEntities:[l],error:h.error||"Action execution failed",debugInfo:u}}async function kn(e,t,i,n={}){let a={page:t,agentServices:i,domService:new Xe(i.getDomServiceOptions()),executionHistory:n.executionHistory,variables:n.variables,sensitiveKeys:n.sensitiveKeys},o=i.replaceVariables(e);return n.useCleanScreenshotForAssertion??(n.useCleanScreenshotForAssertion=i.isUseCleanScreenshotForAssertion()),Sr(o,a,n)}async function Sn(e,t,i,n,a={}){let{runTaskLoop:o}=await Promise.resolve().then(()=>(ul(),dl)),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 Yn,ei=b(()=>{"use strict";dn();Te();nt();Yn=null});var mo=b(()=>{"use strict";re();Pe()});var Ll=b(()=>{"use strict"});var Dl=b(()=>{"use strict"});var Rl=b(()=>{"use strict"});var S,Fl,go,Hl,Mt,Wl,jl,Ul,le,Bl,Zn,wo,yo=b(()=>{"use strict";S=require("zod"),Fl=S.z.enum(["JS_CODE","AI_MODE"]),go=S.z.object({type:Fl,expression:S.z.string()}),Hl=S.z.enum(["DRAFT","STEP","ACTION","IF_ELSE","WHILE_LOOP"]),Mt=S.z.object({uid:S.z.string(),type:Hl,comment:S.z.string().optional()}),Wl=S.z.object({action_data:S.z.object({action_name:S.z.string(),kwargs:S.z.record(S.z.any()).optional(),args:S.z.array(S.z.any()).optional()}),action_description:S.z.string().optional(),url:S.z.string().optional(),xpath:S.z.string().nullable().optional(),locator:S.z.string().nullable().optional(),css_selector:S.z.string().nullable().optional(),unique_selector:S.z.string().nullable().optional(),element_index:S.z.number().nullable().optional(),frame_path:S.z.array(S.z.any()).optional(),artifacts:S.z.record(S.z.any()).optional(),feedback:S.z.string().optional(),original_browser_use_action:S.z.any().optional()}).passthrough(),jl=Mt.extend({type:S.z.literal("DRAFT"),description:S.z.string()}),Ul=Mt.extend({type:S.z.literal("ACTION"),description:S.z.string(),action_entity:Wl.optional(),locator:S.z.string().optional(),use_pure_vision:S.z.boolean().optional()}),le=S.z.lazy(()=>S.z.union([jl,Ul,Mt.extend({type:S.z.literal("STEP"),description:S.z.string().optional().default(""),statements:S.z.array(le),reference_id:S.z.number().optional(),template_path:S.z.string().optional(),template_params:S.z.record(S.z.string()).optional()}),Mt.extend({type:S.z.literal("IF_ELSE"),description:S.z.string().optional(),condition:go,then:S.z.array(le),else:S.z.array(le).optional()}),Mt.extend({type:S.z.literal("WHILE_LOOP"),description:S.z.string().optional(),condition:go,body:S.z.array(le),timeout_ms:S.z.number().optional()})])),Bl=S.z.object({name:S.z.string(),statements:S.z.array(le),teardown:S.z.array(le).optional(),skip:S.z.union([S.z.boolean(),S.z.string()]).optional(),timeout:S.z.number().optional(),fail:S.z.union([S.z.boolean(),S.z.string()]).optional(),only:S.z.boolean().optional(),slow:S.z.boolean().optional()}),Zn=S.z.object({tests:S.z.array(Bl).min(1),beforeAll:S.z.array(le).optional(),afterAll:S.z.array(le).optional(),beforeEach:S.z.array(le).optional(),afterEach:S.z.array(le).optional()}),wo=S.z.object({comment:S.z.string().optional(),version:S.z.string().optional(),goal:S.z.string().optional(),url:S.z.string().optional(),baseURL:S.z.string().optional(),final_feedback:S.z.string().optional(),completed:S.z.boolean().optional(),success:S.z.boolean().optional(),statements:S.z.array(le).optional(),teardown:S.z.array(le).optional(),last_modified_at:S.z.string().optional(),testGroup:Zn.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"})});function Qn(e,t){let i={...t?.test_case_id!==void 0?{test_case_id:t.test_case_id}:{},...t?.name?{name:t.name}:{},...t?.tags&&t.tags.length>0?{tags:t.tags}:{},...t?.skip!==void 0?{skip:t.skip}:{},...t?.fail!==void 0?{fail:t.fail}:{},...t?.only?{only:t.only}:{},...t?.slow?{slow:t.slow}:{},goal:e.goal??"",url:e.url,base_url:e.baseURL,...t?.timeout!==void 0?{timeout:t.timeout}:{},...t?.settings&&Object.keys(t.settings).length>0?{settings:t.settings}:{},...t?.use&&Object.keys(t.use).length>0?{use:t.use}:{},...t?.beforeEach&&t.beforeEach.length>0?{beforeEach:t.beforeEach}:{},...t?.afterEach&&t.afterEach.length>0?{afterEach:t.afterEach}:{},...t?.parameters&&t.parameters.length>0?{parameters:t.parameters}:{},statements:(e.statements??[]).map(me)};return e.final_feedback&&(i.final_feedback=e.final_feedback),e.teardown&&e.teardown.length>0&&(i.teardown=e.teardown.map(me)),i}function vo(e,t){if(e.testGroup)return Xl(e,t);let i=Qn(e,t),n=new H.Document(i),a=n.contents?.get("tags",!0);return(0,H.isSeq)(a)&&(a.flow=!0),e.comment&&(n.commentBefore=e.comment),Gl(n,e.statements??[]),e.teardown&&Gl(n,e.teardown,"teardown"),n.toString(Vl)}function Gl(e,t,i="statements"){let n=e.contents;if(!n||!(0,H.isMap)(n))return;let a=n.get(i,!0);(0,H.isSeq)(a)&&Ri(a,t)}function Ri(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),(0,H.isMap)(a)){let o=a;if(n.type==="STEP"){let r=o.get("statements",!0);(0,H.isSeq)(r)&&Ri(r,n.statements)}else if(n.type==="IF_ELSE"){let r=o.get("THEN",!0);(0,H.isSeq)(r)&&Ri(r,n.then);let s=o.get("ELSE",!0);(0,H.isSeq)(s)&&n.else&&Ri(s,n.else)}else if(n.type==="WHILE_LOOP"){let r=o.get("DO",!0);(0,H.isSeq)(r)&&Ri(r,n.body)}}}}function Xl(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),e.baseURL&&(n.base_url=e.baseURL),t?.tags&&t.tags.length>0&&(n.tags=t.tags),t?.use&&Object.keys(t.use).length>0&&(n.use=t.use),t?.settings&&Object.keys(t.settings).length>0&&(n.settings=t.settings);let a={};i.beforeAll&&i.beforeAll.length>0&&(a.beforeAll=i.beforeAll.map(me)),i.beforeEach&&i.beforeEach.length>0&&(a.beforeEach=i.beforeEach.map(me)),i.afterEach&&i.afterEach.length>0&&(a.afterEach=i.afterEach.map(me)),i.afterAll&&i.afterAll.length>0&&(a.afterAll=i.afterAll.map(me)),a.tests=i.tests.map(s=>{let l={name:s.name};return s.skip!==void 0&&(l.skip=s.skip),s.timeout!==void 0&&(l.timeout=s.timeout),s.fail!==void 0&&(l.fail=s.fail),s.only!==void 0&&(l.only=s.only),s.slow!==void 0&&(l.slow=s.slow),l.statements=s.statements.map(me),s.teardown&&s.teardown.length>0&&(l.teardown=s.teardown.map(me)),l}),n.suite=a;let o=new H.Document(n),r=o.contents?.get("tags",!0);return(0,H.isSeq)(r)&&(r.flow=!0),o.toString(Vl)}function me(e){switch(e.type){case"DRAFT":return Sh(e);case"ACTION":return Eh(e);case"STEP":return Th(e);case"IF_ELSE":return Ah(e);case"WHILE_LOOP":return $h(e)}}function Sh(e){return{intent:e.description}}function Eh(e){let t=e.action_entity?.action_data?.action_name??e.action_entity?.action?.action_name,i=e.action_entity?.action_data?.kwargs??e.action_entity?.action?.kwargs;if(t==="verify"){let s=i?.statement;if(typeof s=="string"&&!e.action_entity?.locator&&!e.action_entity?.xpath){let l=i?.code;return typeof l=="string"&&l.trim()?{VERIFY:s,js:l}:{VERIFY:s}}}if(t==="go_to_url"){let s=i?.url;if(typeof s=="string"&&!e.action_entity?.locator&&!e.action_entity?.xpath){let l={URL:s};return i?.new_tab===!0&&(l.new_tab=!0),typeof i?.timeout_seconds=="number"&&(l.timeout_seconds=i.timeout_seconds),l}}if(t==="js_action"){let s=i?.code;if(typeof s=="string"&&s.trim()&&e.description)return{description:e.description,js:s}}if(t==="ai_wait_until"){let s=i?.condition;if(typeof s=="string"){let l=typeof i?.js=="string"&&i.js.trim()?i.js:void 0,c={};if(l)c.WAIT_UNTIL=s,c.js=l;else{let d=i?.condition_type==="JS_CODE"?"JS_CODE":"AI_MODE";c.WAIT_UNTIL=xo({type:d,expression:s})}return typeof i?.timeout_seconds=="number"&&i.timeout_seconds!==60&&(c.timeout_seconds=i.timeout_seconds),c}}if(t==="wait"){let s=i?.seconds,c={WAIT:e.description||`Wait ${s}s`};return typeof s=="number"&&(c.seconds=s),c}if(t==="js_code"){let s=i?.code;if(typeof s=="string"&&!e.action_entity?.locator&&!e.action_entity?.xpath)return{description:e.description||"Code block",js:s}}if(!e.action_entity)return{intent:e.description};let n=e.action_entity.action_data??e.action_entity.action;if(!n)return{intent:e.description};if(n.action_name==="function"&&typeof n.kwargs?.functionName=="string"&&n.kwargs.functionName.includes("#")&&!Array.isArray(n.kwargs.parameterNames)&&!Array.isArray(n.kwargs.parameterValues)&&(!Array.isArray(n.args)||n.args.length===0)){let s={intent:e.description,call:n.kwargs.functionName};return Array.isArray(n.kwargs.args)&&n.kwargs.args.length>0&&(s.args=n.kwargs.args),s}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))s!=="uid"&&(s==="statement"&&(t==="ai_action"||t==="ai_step")||(a[s]=l));return n.args&&n.args.length>0&&(a.args=n.args),a}function Th(e){if(e.template_path){let i={template:e.template_path};return e.template_params&&Object.keys(e.template_params).length>0&&(i.params=e.template_params),i}let t={STEP:e.description,statements:e.statements.map(me)};return e.reference_id!==void 0&&(t.reference_id=e.reference_id),t}function Ah(e){let t={IF:xo(e.condition),THEN:e.then.map(me)};return e.else&&e.else.length>0&&(t.ELSE=e.else.map(me)),t}function $h(e){let t={WHILE:xo(e.condition),DO:e.body.map(me)};return e.timeout_ms!==void 0&&(t.timeout_ms=e.timeout_ms),t}function xo(e){return e.type==="JS_CODE"?`js:${e.expression}`:e.expression}function _o(e){try{let t=(0,H.parse)(e);if(!t||typeof t!="object")return{};let i={};return typeof t.test_case_id=="number"&&Number.isFinite(t.test_case_id)&&(i.test_case_id=t.test_case_id),typeof t.template_id=="number"&&Number.isFinite(t.template_id)&&(i.template_id=t.template_id),typeof t.name=="string"&&t.name.trim()&&(i.name=t.name.trim()),typeof t.timeout=="number"&&Number.isFinite(t.timeout)&&(i.timeout=t.timeout),t.settings&&typeof t.settings=="object"&&!Array.isArray(t.settings)&&(i.settings=t.settings),t.use&&typeof t.use=="object"&&!Array.isArray(t.use)&&(i.use=t.use),Array.isArray(t.tags)&&t.tags.every(n=>typeof n=="string")&&(i.tags=t.tags),(typeof t.skip=="boolean"||typeof t.skip=="string")&&(i.skip=t.skip),(typeof t.fail=="boolean"||typeof t.fail=="string")&&(i.fail=t.fail),t.only===!0&&(i.only=!0),t.slow===!0&&(i.slow=!0),Array.isArray(t.beforeEach)&&t.beforeEach.length>0&&(i.beforeEach=t.beforeEach),Array.isArray(t.afterEach)&&t.afterEach.length>0&&(i.afterEach=t.afterEach),Array.isArray(t.parameters)&&t.parameters.length>0&&(i.parameters=t.parameters),i}catch{return{}}}function bo(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(bo);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]=bo(o);return n}function Oe(e){if(e.length>Kl)throw new Error(`YAML input too large (${e.length} bytes, max ${Kl})`);let t=bo((0,H.parse)(e));if(!t||typeof t!="object")throw new Error("Invalid YAML: expected an object at root level");if(t.suite)return Mh(t);let i={version:"1.3.0",goal:t.goal,url:t.url,baseURL:t.base_url,statements:pe(t.statements??[])};t.final_feedback&&(i.final_feedback=t.final_feedback),t.teardown&&Array.isArray(t.teardown)&&(i.teardown=pe(t.teardown));let n=wo.safeParse(i);if(!n.success)throw new Error(`Invalid TestFlow after YAML conversion: ${JSON.stringify(n.error.errors)}`);let a=n.data;return ea(e,a),a}function Mh(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:pe(s.statements)};return Array.isArray(s.teardown)&&s.teardown.length>0&&(l.teardown=pe(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=pe(t.beforeAll)),Array.isArray(t.afterAll)&&t.afterAll.length>0&&(a.afterAll=pe(t.afterAll)),Array.isArray(t.beforeEach)&&t.beforeEach.length>0&&(a.beforeEach=pe(t.beforeEach)),Array.isArray(t.afterEach)&&t.afterEach.length>0&&(a.afterEach=pe(t.afterEach));let o=Zn.safeParse(a);if(!o.success)throw new Error(`Invalid TestGroup: ${JSON.stringify(o.error.errors)}`);return{version:"1.3.0",baseURL:(t.base_url??e.base_url)||void 0,testGroup:o.data}}function pe(e){if(!Array.isArray(e))throw new Error("Expected an array of statements");return e.map(Ih)}function Ih(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 Ch(t);if("WHILE"in t)return Ph(t);if("STEP"in t)return Oh(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:(0,ce.v4)(),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:(0,ce.v4)(),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=typeof t.WAIT_UNTIL=="string"?t.WAIT_UNTIL:String(t.WAIT_UNTIL),n=ko(i),a=typeof t.timeout_seconds=="number"?t.timeout_seconds:60;if(typeof t.js=="string"){if(n.type==="JS_CODE")throw new Error('WAIT_UNTIL cannot combine a "js:"-prefixed condition with a sibling "js:" key \u2014 put the intent in WAIT_UNTIL and the expression in js:');return{uid:(0,ce.v4)(),type:"ACTION",description:`Wait until: ${i}`,action_entity:{action_description:`Wait until: ${i}`,action_data:{action_name:"ai_wait_until",kwargs:{condition:i,condition_type:"JS_CODE",js:t.js,timeout_seconds:a}}}}}return{uid:(0,ce.v4)(),type:"ACTION",description:`Wait until: ${n.expression}`,action_entity:{action_description:`Wait until: ${n.expression}`,action_data:{action_name:"ai_wait_until",kwargs:{condition:n.expression,condition_type:n.type,timeout_seconds:a}}}}}if("WAIT"in t){let i=t.WAIT,n=typeof t.seconds=="number"?t.seconds:3;return{uid:(0,ce.v4)(),type:"ACTION",description:typeof i=="string"?i:`Wait ${n}s`,action_entity:{action_description:typeof i=="string"?i:`Wait ${n}s`,action_data:{action_name:"wait",kwargs:{seconds:n}}}}}if("CODE"in t){let i=t.CODE;if(i==null)throw new Error('CODE statement has no code. Use "CODE: |" followed by indented code on the next line.');let n=typeof t.description=="string"?t.description:"Code block";return{uid:(0,ce.v4)(),type:"ACTION",description:n,action_entity:{action_description:n,action_data:{action_name:"js_code",kwargs:{code:typeof i=="string"?i:String(i)}}}}}if("js"in t&&!("VERIFY"in t)&&!("action"in t)){if("intent"in t||"desc"in t)throw new Error("A `js:` statement uses `description:`, not `intent:`. Raw JS does not self-heal \u2014 use `description: + js:` for code, or express it as a structured action (`intent:` + `action:`/`locator:`) to keep self-healing.");let i=typeof t.description=="string"&&t.description.trim()!==""?t.description:"Code block",n=t.js;return{uid:(0,ce.v4)(),type:"ACTION",description:i,action_entity:{action_description:i,action_data:{action_name:"js_code",kwargs:{code:typeof n=="string"?n:String(n)}}}}}if("call"in t&&typeof t.call=="string"){let{call:i,...n}=t;return zl({...n,action:"function",functionName:i})}if("action"in t)return zl(t);if("intent"in t&&typeof t.intent=="string"||"desc"in t&&typeof t.desc=="string")return{uid:(0,ce.v4)(),type:"DRAFT",description:typeof t.intent=="string"?t.intent:t.desc};throw new Error(`Cannot infer statement type from object: ${JSON.stringify(t)}`)}function ko(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 Ch(e){let t=ko(e.IF),i=e.THEN;if(!Array.isArray(i))throw new Error("IF_ELSE requires a THEN array");let n={uid:(0,ce.v4)(),type:"IF_ELSE",condition:t,then:pe(i)};return"ELSE"in e&&Array.isArray(e.ELSE)&&(n.else=pe(e.ELSE)),n}function Ph(e){let t=ko(e.WHILE),i=e.DO;if(!Array.isArray(i))throw new Error("WHILE_LOOP requires a DO array");let n={uid:(0,ce.v4)(),type:"WHILE_LOOP",condition:t,body:pe(i)};return typeof e.timeout_ms=="number"&&(n.timeout_ms=e.timeout_ms),n}function Oh(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:(0,ce.v4)(),type:"STEP",description:t,statements:pe(e.statements)};if(typeof e.reference_id=="number"&&(i.reference_id=e.reference_id),typeof e.template_path=="string"&&(i.template_path=e.template_path),e.template_params&&typeof e.template_params=="object"&&!Array.isArray(e.template_params)){let n=e.template_params,a={};for(let[o,r]of Object.entries(n))a[o]=String(r);i.template_params=a}return i}function zl(e){let t=typeof e.action=="string"?e.action:String(e.action),i=typeof e.intent=="string"?e.intent:typeof e.desc=="string"?e.desc:"",n=typeof e.locator=="string"?e.locator:void 0,a=typeof e.xpath=="string"?e.xpath:void 0,o=typeof e.use_pure_vision=="boolean"?e.use_pure_vision:void 0,r={};for(let[c,d]of Object.entries(e))Nh.has(c)||(r[c]=d);t==="verify"&&typeof r.js=="string"&&(r.code=r.js,delete r.js),(t==="ai_action"||t==="ai_step")&&(r.statement===void 0&&(r.statement=i),o&&(r.use_pure_vision=!0));let s={action_description:i,action_data:{action_name:t,kwargs:Object.keys(r).length>0?r:{}}};n&&(s.locator=n),a&&(s.xpath=a);let l={uid:(0,ce.v4)(),type:"ACTION",description:i,action_entity:s};return o&&(l.use_pure_vision=!0),l}function ea(e,t){let i;try{i=(0,H.parseDocument)(e)}catch{return}let n=i.contents;if(!n||!(0,H.isMap)(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);(0,H.isSeq)(o)&&t.statements&&It(o,t.statements);let r=a.get("teardown",!0);(0,H.isSeq)(r)&&t.teardown&&It(r,t.teardown)}function It(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"&&(0,H.isMap)(n)){let o=n.get("statements",!0);(0,H.isSeq)(o)&&It(o,a.statements)}else if(a.type==="IF_ELSE"&&(0,H.isMap)(n)){let o=n.get("THEN",!0);(0,H.isSeq)(o)&&It(o,a.then);let r=n.get("ELSE",!0);(0,H.isSeq)(r)&&a.else&&It(r,a.else)}else if(a.type==="WHILE_LOOP"&&(0,H.isMap)(n)){let o=n.get("DO",!0);(0,H.isSeq)(o)&&It(o,a.body)}}}var H,ce,Vl,Kl,Nh,ta=b(()=>{"use strict";yo();H=require("yaml"),ce=require("uuid");Vl={lineWidth:120,defaultKeyType:"PLAIN",defaultStringType:"PLAIN"};Kl=1024*1024;Nh=new Set(["action","intent","desc","locator","xpath","use_pure_vision"])});var Jl,Yl=b(()=>{"use strict";ta();Jl=require("yaml")});var ia=b(()=>{"use strict"});var ql=b(()=>{"use strict";ta();ia()});var Zl=b(()=>{"use strict"});var Ql=b(()=>{"use strict";ia()});var Rh,ec=b(()=>{"use strict";Rh=require("uuid")});var ot,tc=b(()=>{"use strict";ot=(e=>(e.DRAFT="DRAFT",e.STEP="STEP",e.ACTION="ACTION",e.IF_ELSE="IF_ELSE",e.WHILE_LOOP="WHILE_LOOP",e))(ot||{})});var ic=b(()=>{"use strict"});var na=b(()=>{"use strict"});var nc=b(()=>{"use strict";na()});var ac=b(()=>{"use strict";na()});var oc,Wh,rc,sc,Fi,jh,Uh,lc=b(()=>{"use strict";oc=112,Wh=1080-oc,rc={"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"}},sc={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"]},Fi=(e,t=!1)=>{let i=["chromium"];return t&&i.push("webkit"),sc[e].map(n=>rc[n]).filter(n=>n.defaultBrowserType&&i.includes(n.defaultBrowserType))},jh={desktop:{label:"Desktop",type:"desktop",devices:Fi("desktop")},mobile:{label:"Mobile Web",type:"mobile",devices:Fi("mobile")}},Uh={desktop:{label:"Desktop",type:"desktop",devices:Fi("desktop",!0)},mobile:{label:"Mobile Web",type:"mobile",devices:Fi("mobile",!0)}}});var cc=b(()=>{"use strict"});function uc(e){if(e!==null&&typeof e=="object"){for(let t of Object.values(e))uc(t);Object.freeze(e)}return e}var Bh,dc,Gh,So,Eo=b(()=>{"use strict";Bh=Object.freeze(["lite","standard","pro"]),dc=1,Gh=Object.freeze(["WEB_AGENT_MODEL","WEB_AGENT_FALLBACK_MODELS","COMPUTER_USE_MODEL"]),So=uc({version:dc,defaultTier:"lite",tiers:{lite:{webagent:{primary:"google:gemini-3-flash-preview",fallbacks:["anthropic:claude-haiku-4-5","openai:gpt-5.6-luna"]}},standard:{webagent:{primary:"google:gemini-3.5-flash",fallbacks:["anthropic:claude-sonnet-5","openai:gpt-5.6-terra"]}},pro:{webagent:{primary:"anthropic:claude-opus-4-8",fallbacks:["openai:gpt-5.6-sol","anthropic:claude-opus-4-7"]}}},computerUse:{primary:"google:gemini-3-flash-preview",fallbacks:[]}})});var Xh,hc=b(()=>{"use strict";Eo();Xh=Object.freeze([...So.tiers.standard.webagent.fallbacks])});var mc=b(()=>{"use strict"});var Ct=b(()=>{"use strict";Ll();Dl();Rl();Yl();ql();ta();yo();Zl();Ql();ec();ia();tc();ic();nc();ac();na();lc();cc();hc();Eo();mc()});function Qh(e){let t=e.frame_path;return!t||t.length===0?"page":`page.frameLocator('${t[0]}')`}function em(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 yc(e){let t=Qh(e),i=e.locator;if(typeof i=="string"&&i.trim())return i=i.trim(),i.endsWith("first()")?`${t}.${i}`:`${t}.${i}.first()`;let n=em(e);if(n){let a=JSON.stringify(n);return`${t}.locator(${a}).first()`}return null}function M(e,t){oe.set(e,t)}function rt(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 To(e,t){let i=t.action_data?.kwargs||{},n=[];return typeof i.relative_x=="number"&&typeof i.relative_y=="number"?(n.push(`action_data: { kwargs: { relative_x: ${i.relative_x}, relative_y: ${i.relative_y} } }`),t.locator?n.push(`locator: ${JSON.stringify(t.locator)}`):t.xpath&&n.push(`xpath: ${JSON.stringify(t.xpath)}`),t.frame_path&&t.frame_path.length>0&&n.push(`frame_path: ${JSON.stringify(t.frame_path)}`)):typeof i.x=="number"&&typeof i.y=="number"&&n.push(`action_data: { kwargs: { x: ${i.x}, y: ${i.y} } }`),[`await agent.execAction("${e}", page, {`,...n.map(a=>` ${a},`),"});"]}function pc(e){let t=e.functionName;if(!t)return null;let i=Array.isArray(e.args)?e.args.map(String):Array.isArray(e.parameterValues)?e.parameterValues.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 vc(e,t,i){let n={expandingPaths:new Set([(0,Pt.resolve)(t)]),depth:0,referencedPaths:new Set,basePath:i},a={...e};Array.isArray(a.statements)&&(a.statements=qe(a.statements,t,n)),Array.isArray(a.teardown)&&(a.teardown=qe(a.teardown,t,n));for(let o of["beforeAll","afterAll","beforeEach","afterEach"])Array.isArray(a[o])&&(a[o]=qe(a[o],t,n));return{doc:a,referencedTemplatePaths:Array.from(n.referencedPaths)}}function qe(e,t,i){let n=[];for(let a of e)if(tm(a)){let o=im(a,t,i);n.push(o)}else n.push(nm(a,t,i));return n}function tm(e){return typeof e=="object"&&e!==null&&typeof e.template=="string"}function im(e,t,i){if(i.depth>=fc)throw new Error(`Template expansion exceeded maximum depth of ${fc}. Check for deeply nested or circular template references.`);let n=(0,Pt.resolve)((0,Pt.dirname)(t),e.template),a=!(0,ra.existsSync)(n)&&i.basePath?(0,Pt.resolve)(i.basePath,e.template):n;if(i.expandingPaths.has(a))throw new Error(`Circular template reference detected: ${a} is already being expanded. Stack: ${Array.from(i.expandingPaths).join(" \u2192 ")} \u2192 ${a}`);i.referencedPaths.add(a);let o;try{o=(0,ra.readFileSync)(a,"utf-8")}catch(w){throw new Error(`Failed to read template file: ${a} (referenced from ${t}): ${w.message}`)}let r=(0,Hi.parse)(o);if(!r||typeof r!="object")throw new Error(`Invalid template file: ${a} \u2014 expected a YAML object`);let s=r.params||[],l=e.params||{};for(let w of s)if(!(w in l))throw new Error(`Template ${e.template} requires param "${w}" but it was not provided. Required params: [${s.join(", ")}]`);let c=r.statements;if(!Array.isArray(c))throw new Error(`Template ${e.template} must have a "statements" array`);if(Object.keys(l).length>0){let f=(0,Hi.stringify)(c);for(let[y,m]of Object.entries(l))f=f.split(`<<${y}>>`).join(String(m));c=(0,Hi.parse)(f)}let d={expandingPaths:new Set([...i.expandingPaths,a]),depth:i.depth+1,referencedPaths:i.referencedPaths},u=qe(c,a,d),p={STEP:r.name||e.template.replace(/\.yaml$/,"").split("/").pop()||e.template,template_path:e.template,statements:u};return Object.keys(l).length>0&&(p.template_params=l),p}function nm(e,t,i){if(typeof e!="object"||e===null)return e;let n={...e};return Array.isArray(n.statements)&&(n.statements=qe(n.statements,t,i)),Array.isArray(n.THEN)&&(n.THEN=qe(n.THEN,t,i)),Array.isArray(n.ELSE)&&(n.ELSE=qe(n.ELSE,t,i)),Array.isArray(n.DO)&&(n.DO=qe(n.DO,t,i)),n}function am(e){let t=[],i=e;for(;;){let n=aa.get(i);if(n!==void 0){for(let o of t)aa.set(o,n);return n}if(t.push(i),(0,xc.existsSync)((0,Ne.join)(i,".git"))){for(let o of t)aa.set(o,i);return i}let a=(0,Ne.dirname)(i);if(a===i){for(let o of t)aa.set(o,null);return null}i=a}}function gc(e){return e.split(/[\\/]/).join("/")}function om(e){if(!(0,Ne.isAbsolute)(e))return gc(e);let t=am((0,Ne.dirname)(e));return gc(t?(0,Ne.relative)(t,e):e)}function kc(e,t,i){let n=(0,Wi.parse)(e),a=n?.name,o=n?.tags,r=n?.use;if(n&&(n.name!==void 0||n.tags!==void 0||n.use!==void 0)&&(delete n.name,delete n.tags,delete n.use),n?.suite){if(n.goal||n.statements)throw new _c('YAML file cannot have both "suite" and top-level "goal"/"statements". Use either suite format or single-test format.');return sm(n,a,o,r,t,i)}return rm(n,a,o,r,t,i)}function rm(e,t,i,n,a,o){let r=e?.beforeEach,s=e?.afterEach,l=Sc(e?.parameters),c=e?.timeout,d=e?.skip,u=e?.fail,h=e?.only,p=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 _c(`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 w=[];if(a&&e&&typeof e=="object"){let m=vc(e,a,o);e=m.doc,w=m.referencedTemplatePaths}let f=(0,Wi.stringify)(e),y=Oe(f);return a&&(Ze(y.statements??[],a,"main"),y.teardown&&Ze(y.teardown,a,"teardown")),{testFlow:y,name:t,tags:i,use:n,beforeEach:r,afterEach:s,parameters:l,timeout:c,skip:d,fail:u,only:h,slow:p,referencedTemplatePaths:w}}function sm(e,t,i,n,a,o){let r=e.suite;if(!Array.isArray(r.tests)||r.tests.length===0)throw new Error('Suite must have a non-empty "tests" array.');let s=r.beforeAll,l=r.afterAll,c=r.beforeEach,d=r.afterEach,u=[],h=r.tests.map((f,y)=>{if(!f.name)throw new Error('Each test in a suite must have a "name" field.');if(!Array.isArray(f.statements)||f.statements.length===0)throw new Error(`Suite test "${f.name}" must have a non-empty "statements" array.`);let m={goal:f.name,statements:f.statements};f.teardown&&(m.teardown=f.teardown);let v=[],_=m;if(a&&typeof m=="object"){let I=vc(m,a,o);_=I.doc,v=I.referencedTemplatePaths,u.push(...v)}let x=(0,Wi.stringify)(_),E=Oe(x);if(a){let I=`tests[${y}]`;Ze(E.statements??[],a,I),E.teardown&&Ze(E.teardown,a,`${I}.teardown`)}let $=Sc(f.parameters);return{testFlow:E,name:f.name,tags:Array.isArray(f.tags)?f.tags:void 0,parameters:$,timeout:f.timeout,skip:f.skip,fail:f.fail,only:f.only,slow:f.slow}}),p=r.base_url??e.base_url,w=p?{...n,baseURL:p}:n;return{suite:{beforeAll:s,afterAll:l,beforeEach:c,afterEach:d,tests:h},name:t,tags:i,use:w,referencedTemplatePaths:u}}function Sc(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 Ze(e,t,i){for(let n=0;n<e.length;n++){let a=e[n],o=`${i}.${n}`,r=a.description||"";if(a.uid=lm(t,o,r),a.type===ot.STEP)Ze(a.statements,t,o);else if(a.type===ot.IF_ELSE){let s=a;Ze(s.then,t,`${o}.then`),s.else&&Ze(s.else,t,`${o}.else`)}else a.type===ot.WHILE_LOOP&&Ze(a.body,t,`${o}.body`)}}function lm(e,t,i){let n=om(e),a=(0,bc.createHash)("sha256").update(`${n}:${t}:${i}`).digest("hex");return`${a.slice(0,8)}-${a.slice(8,12)}-${a.slice(12,16)}-${a.slice(16,20)}-${a.slice(20,32)}`}var Zh,oa,bc,Wi,ra,Pt,Hi,xc,Ne,wc,oe,fc,aa,_c,Ec=b(()=>{"use strict";Ct();Zh=require("yaml");Ct();oa=ie(require("path"),1),bc=require("crypto"),Wi=require("yaml");Ct();ra=require("fs"),Pt=require("path"),Hi=require("yaml"),xc=require("fs"),Ne=require("path");Ct();wc=5e3;oe=new Map;M("click",e=>{let t=yc(e);if(!t)return['await agent.execAction("click", page, {});'];let i=e.action_data?.kwargs?.timeout_ms??wc;return[`await ${t}.click({ timeout: ${i} });`]});M("click_element",oe.get("click"));M("click_element_by_index",oe.get("click"));M("double_click",e=>rt("double_click",e));M("double_click_on_element",oe.get("double_click"));M("right_click",e=>rt("right_click",e));M("right_click_on_element",oe.get("right_click"));M("hover",e=>rt("hover",e));M("hover_element_by_index",oe.get("hover"));M("input_text",e=>{let t=e.action_data?.kwargs?.text??e.action_data?.kwargs?.value??"";return rt("input_text",e,[`action_data: { kwargs: { text: ${JSON.stringify(t)} } }`])});M("fill",oe.get("input_text"));M("clear_input",e=>rt("clear_input",e));M("press",e=>{let t=e.action_data?.kwargs?.keys;return[`await page.keyboard.press(${JSON.stringify(t)});`]});M("send_keys",oe.get("press"));M("send_keys_on_element",e=>{let t=yc(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??wc;return[`await ${t}.press(${JSON.stringify(i)}, { timeout: ${n} });`]});M("select_dropdown_option",e=>{let t=e.action_data?.kwargs?.text||e.action_data?.kwargs?.option||"";return rt("select_dropdown_option",e,[`action_data: { kwargs: { text: ${JSON.stringify(t)} } }`])});M("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)})');`]});M("scroll_down",oe.get("scroll"));M("scroll_up",oe.get("scroll"));M("scroll_element",oe.get("scroll"));M("scroll_to_text",e=>{let t=e.action_data?.kwargs?.text||"";return[`await page.getByText(${JSON.stringify(t)}, { exact: false }).first().scrollIntoViewIfNeeded();`]});M("scroll_on_element",e=>rt("scroll_on_element",e,[`action_data: { kwargs: ${JSON.stringify(e.action_data?.kwargs||{})} }`]));M("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)} } },`,"});"]});M("open_tab",oe.get("go_to_url"));M("go_back",()=>['await agent.execAction("go_back", page, {});']);M("reload_page",()=>['await agent.execAction("reload_page", page, {});']);M("wait",e=>[`await page.waitForTimeout(${(e.action_data?.kwargs?.seconds||1)*1e3});`]);M("wait_for_page_ready",()=>["await page.waitForLoadState('domcontentloaded');"]);M("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(`
|
|
4326
4326
|
`),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(`
|
|
4327
4327
|
`):a?[`await agent.assert(page, ${JSON.stringify(a)}, ${JSON.stringify(t||"")});`]:["// Skipping verify: missing statement or code"]});M("ai_assert",oe.get("verify"));M("assert",oe.get("verify"));M("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});`]});M("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"]});M("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||""}');`]});M("ai_wait_until",(e,t)=>{let i=e.action_data?.kwargs?.condition,n=e.action_data?.kwargs?.timeout_seconds||60;if(!i)return["// Skipping ai_wait_until: missing condition"];if(e.action_data?.kwargs?.condition_type==="JS_CODE"){let o=e.action_data?.kwargs?.js,r=typeof o=="string"?o:i,s=typeof o=="string"?`, ${JSON.stringify(i)}`:"";return[`await agent.waitForJs(page, async () => (${r}), ${n}, '${t||""}'${s});`]}return[`await agent.waitUntilCondition(page, ${JSON.stringify(i)}, ${n}, '${t||""}');`]});M("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)} } },`,"});"]});M("js_code",e=>{let t=e.action_data?.kwargs?.code;if(!t)return["// Skipping js_code: missing code"];let i=["{"],n=t.split(`
|
|
4328
4328
|
`);for(let a of n)i.push(` ${a}`);return i.push("}"),i});M("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)$/,"");if(oa.default.isAbsolute(r))return[`throw new Error(${JSON.stringify(`Absolute paths are not supported in call: references. Use a path relative to the project root (got: "${r}")`)})`];if(!l.startsWith(".")&&i?.projectRoot&&i?.yamlDir){let h=oa.default.resolve(i.projectRoot,l),p=oa.default.relative(i.yamlDir,h).replace(/\\/g,"/");l=p.startsWith("..")?p:"./"+p}let c=`import { ${s} } from '${l}';`;i?.imports?.add(c);let d={...n,functionName:s},u=pc(d);return u?[u.endsWith(";")?u:`${u};`]:["// Skipping function: invalid export pattern"]}}let o=pc(n);return o?[o.endsWith(";")?o:`${o};`]:["// Skipping function: missing functionName"]});M("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)} } },`,"});"]});M("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},`),"});"]});M("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} } },`,"});"]);M("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} } },`,"});"]);M("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} } },`,"});"]});M("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},`),"});"]});M("done",()=>["// Done - no action needed"]);M("click_by_coordinates",e=>To("click_by_coordinates",e));M("right_click_by_coordinates",e=>To("right_click_by_coordinates",e));M("double_click_by_coordinates",e=>To("double_click_by_coordinates",e));M("drag_drop",e=>{let t=e.action_data?.kwargs||{},i={};typeof t.relative_x=="number"&&(i.relative_x=t.relative_x),typeof t.relative_y=="number"&&(i.relative_y=t.relative_y),typeof t.delta_x=="number"&&(i.delta_x=t.delta_x),typeof t.delta_y=="number"&&(i.delta_y=t.delta_y),typeof t.coord_source_x=="number"&&(i.coord_source_x=t.coord_source_x),typeof t.coord_source_y=="number"&&(i.coord_source_y=t.coord_source_y),typeof t.coord_target_x=="number"&&(i.coord_target_x=t.coord_target_x),typeof t.coord_target_y=="number"&&(i.coord_target_y=t.coord_target_y);let n=[`action_data: { kwargs: ${JSON.stringify(i)} }`];return e.locator?n.push(`locator: ${JSON.stringify(e.locator)}`):e.xpath&&n.push(`xpath: ${JSON.stringify(e.xpath)}`),e.frame_path&&e.frame_path.length>0&&n.push(`frame_path: ${JSON.stringify(e.frame_path)}`),['await agent.execAction("drag_drop", page, {',...n.map(a=>` ${a},`),"});"]});M("get_dropdown_options",e=>{let t=[];return e.xpath&&t.push(`xpath: ${JSON.stringify(e.xpath)}`),e.frame_path&&e.frame_path.length>0&&t.push(`frame_path: ${JSON.stringify(e.frame_path)}`),t.length===0?['await agent.execAction("get_dropdown_options", page, {});']:['await agent.execAction("get_dropdown_options", page, {',...t.map(i=>` ${i},`),"});"]});M("extract_email_content",e=>{let t=e.action_data?.kwargs||{};return['await agent.execAction("extract_email_content", page, {',` action_data: { kwargs: ${JSON.stringify(t)} },`,"});"]});M("js_action",e=>{let t=e.action_data?.kwargs?.code;return t?t.split(`
|
|
@@ -4410,7 +4410,7 @@ Date: ${h.date}
|
|
|
4410
4410
|
Body:
|
|
4411
4411
|
${h.body}`,w=await lh(p,a,t.model,t.extraction_type);g.info(`Extracted content: ${w}`),w&&w!=="NOT_FOUND"&&u.push({content:w,email_subject:h.subject,email_from:h.from,email_date:h.date})}if(u.length>0){let h=u[0],p=`$email_${t.extraction_type}`;t.extraction_type==="custom"?p="$email_extracted_content":t.extraction_type==="activation_link"?p="$email_magic_link":t.extraction_type==="verification_code"&&(p="$email_otp_code");let w=(new Date().getTime()-o.getTime())/1e3;return g.info(`Successfully extracted content after ${s} attempts in ${w.toFixed(1)} seconds`),{data:h.content,result_variable:p,status:"success",message:`Successfully extracted content from email: ${h.email_subject.substring(0,50)}... (attempts: ${s})`}}else g.info(`Found emails but no extractable content in attempt ${s}`)}else g.info(`No emails found in attempt ${s}`)}catch(c){g.warn(`Error in polling attempt ${s}: ${c.message}`)}if(new Date(Date.now()+n*1e3)>=r){g.info("Not enough time for another polling attempt");break}g.info(`Waiting ${n} seconds before next attempt...`),await new Promise(c=>setTimeout(c,n*1e3))}let l=(new Date().getTime()-o.getTime())/1e3;return{data:void 0,status:"error",message:`No emails with extractable content found after ${s} attempts over ${l.toFixed(1)} seconds`}}catch(a){return g.error(`Error extracting email content: ${a.message}`),{data:void 0,status:"error",message:`Error extracting email content: ${a.message}`}}}dt();U();ne();var _e=require("zod");function gl(e){switch(e){case"verification_code":return"email_otp_code";case"activation_link":return"email_magic_link";case"custom":return"email_extracted_content";default:return"email_content"}}var wl=class{getMailgunConfig(){let e=V().env||{};if(e.MAILGUN_API_KEY)return{apiKey:e.MAILGUN_API_KEY,domain:e.MAILGUN_DOMAIN||""};let t=e.SHIPLIGHT_API_TOKEN;if(t){let i=`${et(t,e.SHIPLIGHT_API_URL)}/mailgun`;return g.debug(`[extract_email_content] Using Shiplight proxy for Mailgun: ${i}`),{apiKey:t,domain:e.MAILGUN_DOMAIN||"",baseURL:i,authHeader:`Bearer ${t}`}}}async execute(e,t,i){let n=t.action_data;if(!n)throw new Error("Action data not found");let a=this.getMailgunConfig();if(!a)throw new Error("Mailgun configuration not provided. Please configure MAILGUN_API_KEY and MAILGUN_DOMAIN, or set SHIPLIGHT_API_TOKEN to route through the Shiplight proxy.");let o=n.kwargs,r=i.getModel?.()||"gemini-2.5-pro",s=await fl(a,{model:r,forward_email:o.forward_email,extraction_type:o.extraction_type,prompt:o.prompt,filters:{from_email:o.filter_from_email,to_email:o.filter_to_email,subject:o.filter_subject,body_contains:o.filter_body_contains},timeout:o.timeout});if(s.status==="success"&&s.data){let l=s.result_variable?.replace(/^\$/,"")||gl(o.extraction_type);i.variableStore.set(l,s.data),g.info(`[extract_email_content] Extracted and saved to ${l}`)}else throw new Error(s.message||"Failed to extract email content")}transpile(e){let t=e.action_data?.kwargs||{};return['await agent.execAction("extract_email_content", page, {',` action_data: { kwargs: ${JSON.stringify(t)} },`,"});"]}},ch=_e.z.object({forward_email:_e.z.string().describe("Email address where emails are forwarded to (Mailgun inbox)"),extraction_type:_e.z.enum(["verification_code","activation_link","custom"]).describe("Type of content to extract: verification_code for OTP codes, activation_link for magic links, custom for custom prompts"),prompt:_e.z.string().optional().describe("Custom extraction prompt (required when extraction_type is custom)"),filter_from_email:_e.z.string().optional().describe("Filter emails by sender address"),filter_to_email:_e.z.string().optional().describe("Filter emails by recipient address"),filter_subject:_e.z.string().optional().describe("Filter emails by subject (partial match)"),filter_body_contains:_e.z.string().optional().describe("Filter emails by body content (partial match)"),timeout:_e.z.number().optional().describe("Timeout in seconds for polling (default: 60)")});function yl(e,t){e.register({name:"extract_email_content",description:"Extract verification codes, magic links, or custom content from emails received via Mailgun. Polls the Mailgun inbox for matching emails and uses AI to extract the requested content.",schema:ch,async execute(i,n){let{forward_email:a,extraction_type:o,prompt:r,filter_from_email:s,filter_to_email:l,filter_subject:c,filter_body_contains:d,timeout:u}=i,{page:h,agentServices:p}=n;g.info(`[extract_email_content] Extracting ${o} from ${a}`);try{let w={action_description:`Extract ${o} from email`,action_data:{action_name:"extract_email_content",kwargs:{forward_email:a,extraction_type:o,prompt:r,filter_from_email:s,filter_to_email:l,filter_subject:c,filter_body_contains:d,timeout:u}}};await t.execute(h,w,p);let f=gl(o);return{success:!0,actionEntity:w,message:`Extracted ${o} and saved to $${f}`}}catch(w){return{success:!1,error:w.message,actionEntity:{action_description:`Extract ${o} from email (failed)`,action_data:{action_name:"extract_email_content",kwargs:{forward_email:a,extraction_type:o,prompt:r,filter_from_email:s,filter_to_email:l,filter_subject:c,filter_body_contains:d,timeout:u}},feedback:w.message}}}}})}ii();ni();oi();ri();si();ci();di();ui();mi();pi();fi();wi();bi();vi();_i();ki();Si();Ei();Ti();Ai();$i();Mi();Ii();Ci();Pi();Oi();Ni();var qn=null;async function ke(){if(qn)return qn;let e=(await Promise.resolve().then(()=>(Kn(),Gn))).default;return qn=new e,qn}async function bl(e){let t=await ke(),i=t.getAction("click"),n=t.getAction("hover"),a=t.getAction("right_click"),o=t.getAction("double_click");return il(e,i),$s(e,n),ps(e,a),Fs(e,o),"Click, hover, double-click, right-click, or drag elements"}async function vl(e){let t=await ke(),i=t.getAction("go_to_url"),n=t.getAction("go_back"),a=t.getAction("reload_page");return Ts(e,i),zs(e,n),Ns(e,a),"Navigate to URLs, go back, or reload the page"}async function xl(e){let t=await ke(),i=t.getAction("clear_input"),n=t.getAction("input_text"),a=t.getAction("press");return el(e,i),Is(e,n),Cs(e,a),"Type text into inputs, clear input values, or press keyboard keys"}async function _l(e){let t=await ke(),i=t.getAction("scroll_on_element"),n=t.getAction("scroll_to_text"),a=t.getAction("scroll");return vs(e,i),_s(e,n),ws(e,a),"Scroll the page or scroll to specific text/elements"}async function kl(e){let t=await ke(),i=t.getAction("close_tab"),n=t.getAction("switch_tab");return al(e,i),Jr(e,n),"Switch between browser tabs or close tabs"}async function Sl(e){let t=await ke(),i=t.getAction("upload_file"),n=t.getAction("wait_for_download_complete");return es(e,i),as(e,n),"Upload files or wait for downloads to complete"}async function El(e){let t=await ke(),i=t.getAction("get_dropdown_options"),n=t.getAction("select_dropdown_option"),a=t.getAction("set_date_for_native_date_picker");return Bs(e,i),Es(e,n),Vr(e,a),"Get dropdown options, select dropdown values, or set date for native date picker input"}async function Tl(e){let t=await ke(),i=t.getAction("wait"),n=t.getAction("save_variable"),a=t.getAction("done");return is(e,i),gs(e,n),Ds(e,a),hl(e),"Wait for conditions, save variables, or complete tasks"}async function Al(e){let t=(await ke()).getAction("generate_2fa_code");Ws(e,t);let i=new wl;return(await Promise.resolve().then(()=>(Kn(),Gn))).default.registerAction("extract_email_content",i),yl(e,i),"Generate 2FA codes or extract email/activation codes"}async function $l(e){let t=await ke(),i=t.getAction("verify"),n=t.getAction("ai_extract");return Js(e,i),qs(e,n),hs(e),"Perform AI-powered assertions, extractions, or wait conditions"}Te();var dh=[bl(Y),vl(Y),xl(Y),_l(Y),kl(Y),Sl(Y),El(Y),Tl(Y),$l(Y),Al(Y)],a0=Promise.all(dh);Lt();Ye();Pe();_t();U();var co=require("playwright");var uo=require("child_process"),Ml=ie(require("fs"),1),Il=ie(require("path"),1);function fh(){if(process.platform==="win32"){let i=(0,uo.execFileSync)("powershell.exe",["-NoProfile","-NonInteractive","-Command","Get-CimInstance Win32_Process | Select-Object ProcessId,ParentProcessId,CommandLine | ConvertTo-Json -Compress"],{encoding:"utf-8",timeout:1e4}),n=JSON.parse(i.trim());return(Array.isArray(n)?n:[n]).filter(a=>a!==null&&typeof a=="object").filter(a=>typeof a.ProcessId=="number").map(a=>({pid:a.ProcessId,ppid:typeof a.ParentProcessId=="number"?a.ParentProcessId:0,args:typeof a.CommandLine=="string"?a.CommandLine:""}))}let e=(0,uo.execFileSync)("ps",["-axo","pid=,ppid=,args="],{encoding:"utf-8"}),t=[];for(let i of e.split(`
|
|
4412
4412
|
`)){let n=i.trimStart().match(/^(\d+)\s+(\d+)\s+(.*)$/);n&&t.push({pid:parseInt(n[1],10),ppid:parseInt(n[2],10),args:n[3]})}return t}function gh(e){let t=fh(),i=new Set([e]),n=!0;for(;n;){n=!1;for(let a of t)!i.has(a.pid)&&i.has(a.ppid)&&(i.add(a.pid),n=!0)}for(let a of t){if(a.pid===e||!i.has(a.pid)||!/chrome|chromium/i.test(a.args))continue;let o=a.args.match(/--user-data-dir=(?:"([^"]+)"|(\S+))/);if(o)return o[1]??o[2]}return null}async function wh(e,t){let i=Il.join(e,"DevToolsActivePort"),n=Date.now()+t;for(;Date.now()<n;){try{let a=Ml.readFileSync(i,"utf-8").trim(),[o,r]=a.split(`
|
|
4413
|
-
`),s=parseInt(o,10);if(Number.isFinite(s)&&s>0&&typeof r=="string"&&r.startsWith("/"))return{port:s,wsPath:r}}catch{}await new Promise(a=>setTimeout(a,100))}throw new Error(`Timed out waiting for ${i} \u2014 Chromium never exposed DevTools`)}async function ho(e,t=3e4){let i=gh(e);if(!i)throw new Error(`No Chromium descendant of pid ${e} with --user-data-dir found. Did you launch with --remote-debugging-port=0 and is the browser still running?`);let{port:n,wsPath:a}=await wh(i,t);return`ws://127.0.0.1:${n}${a}`}Ye();var yh=(e=>(e.Desktop="desktop",e.Mobile="mobile",e))(yh||{});var Di=(e=>(e.Started="started",e.Action="action",e.Completion="completion",e.Error="error",e.Aborted="aborted",e.Keepalive="keepalive",e))(Di||{});ei();nt();mo();re();Ye();St();Pe();U();var po=require("otplib"),U0=(0,po.createGuardrails)({MIN_SECRET_BYTES:1});Ve();$e();Ie();var vh=require("ai"),V0=20*1024*1024;Be();ai();Ye();St();U();ei();dn();ln();Vi();ft();en();nn();ct();tn();Ge();on();Wt();Ht();Te();Lt();Ut();vn();nt();Vt();yt();Xt();Jt();qt();mo();re();Ve();$e();Ie();Bt();
|
|
4413
|
+
`),s=parseInt(o,10);if(Number.isFinite(s)&&s>0&&typeof r=="string"&&r.startsWith("/"))return{port:s,wsPath:r}}catch{}await new Promise(a=>setTimeout(a,100))}throw new Error(`Timed out waiting for ${i} \u2014 Chromium never exposed DevTools`)}async function ho(e,t=3e4){let i=gh(e);if(!i)throw new Error(`No Chromium descendant of pid ${e} with --user-data-dir found. Did you launch with --remote-debugging-port=0 and is the browser still running?`);let{port:n,wsPath:a}=await wh(i,t);return`ws://127.0.0.1:${n}${a}`}Ye();var yh=(e=>(e.Desktop="desktop",e.Mobile="mobile",e))(yh||{});var Di=(e=>(e.Started="started",e.Action="action",e.Completion="completion",e.Error="error",e.Aborted="aborted",e.Keepalive="keepalive",e))(Di||{});ei();nt();mo();re();Ye();St();Pe();U();var po=require("otplib"),U0=(0,po.createGuardrails)({MIN_SECRET_BYTES:1});Ve();$e();Ie();var vh=require("ai"),V0=20*1024*1024;Be();ai();Ye();St();U();ei();dn();ln();Vi();ft();en();nn();ct();tn();Ge();on();Wt();Ht();Te();Lt();Ut();vn();nt();Vt();yt();Xt();Jt();qt();mo();re();Ve();$e();Ie();Bt();ut();Gt();Ue();Be();dt();it();ro();hn();mn();pn();fn();gn();wn();yn();bn();En();Tn();An();ii();ni();oi();ri();si();ci();di();ui();mi();pi();fi();wi();bi();vi();_i();ki();Si();Ei();Ti();Ai();$i();Mi();Ii();bt();Ci();Pi();Oi();Ni();Rn();ai();ee();Qe();Ye();St();Pe();_t();U();ne();Zt();Bn();B();Se();function fo(e){if(!e)return;let t=e.getAll(),i=e.getAllSensitiveKeys();if(i.size===0)return t;let n={};for(let[a,o]of Object.entries(t))n[a]=i.has(a)?"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022":o;return n}function kh(e,t,i){let n=e.startsWith(".")?t:i??process.cwd();return se.resolve(n,e)}var At=class{page;agent;testContext;testDir=process.cwd();projectRoot;sessionId="pw-"+Math.random().toString(36).slice(2,10);abortController=null;recorderStopResolver;recorderEnabled=!1;screenshotHistory=[];yamlFilePath;artifactsDir;constructor(t,i,n,a,o){this.page=t,this.agent=i,this.testContext=o,this.projectRoot=a,n&&(this.agent._getContext().testDataDir=n)}cdpEndpoint=null;setCdpEndpoint(t){this.cdpEndpoint=t}getCdpEndpoint(){if(this.cdpEndpoint)return this.cdpEndpoint;let t=this.page.context().browser();if(!t)return null;let i=t.wsEndpoint?.();return typeof i=="string"?i:null}async createSession(t){if(t?.testFilePath){this.testDir=se.dirname(t.testFilePath),this.yamlFilePath=t.testFilePath;let i=this.projectRoot??this.testDir,n=se.basename(t.testFilePath,".test.yaml");if(this.artifactsDir=se.join(i,".shiplight","artifacts",n),t.testFilePath.endsWith(".test.yaml"))try{let a=await $t.readFile(t.testFilePath,"utf-8"),r=(0,Ol.parse)(a)?.parameters;if(r&&r.length>0&&r[0].values)for(let[s,l]of Object.entries(r[0].values))this.agent.agentServices.saveVariable(s,l)}catch{}}return{sessionId:this.sessionId}}async executeLogin(t){return{status:"success",details:"Handled by Playwright"}}async ensureBrowser(t){return{page:this.page,liveviewUrl:""}}async startDebug(t){return{sessionId:this.sessionId,liveviewUrl:"",browserWsUrl:""}}async executeAction(t,i,n,a){let o=i.action_data||i.action;if(!o)throw new Error("ActionEntity has no action_data");console.error(`[pw-sandbox] executeAction stepId=${JSON.stringify(n)} action_name=${JSON.stringify(o.action_name)} locator=${JSON.stringify(i.locator)} kwargs=${JSON.stringify(o.kwargs)}`);let r=this.agent.agentServices.validatePage(this.page);if(o.action_name==="js_code"&&n==="prelude"){if(r.url()==="about:blank"){let p=o.kwargs?.code?.match(/PLAYWRIGHT_STARTING_URL \|\| '([^']*)'/)?.[1];p&&await r.goto(p,{waitUntil:"domcontentloaded"})}return{status:"success"}}if(o.action_name==="js_code"&&o.kwargs?.isSync===!0)return this.executeCode(t,o.kwargs.code||"");if(o.action_name==="function"&&o.kwargs?.functionName?.includes("#"))return this.executeFunction(o.kwargs,o.args);let s=a?.stmtUid;s&&this.agent.getNewActionEntities().delete(s);let l;if(at.isAiAction(i)){let f=new Li().transpile(i,n,s).join(`
|
|
4414
4414
|
`),y=new Function("page","agent",`return (async () => { ${f} })();`);try{await y(r,this.agent),l={actionGenerationDebugInfo:this.agent._getContext()?.lastActionDebugInfo}}catch(m){let v=this.agent._getContext();return{status:"error",details:this.agent.getAgentNote()||m.message,actionGenerationDebugInfo:v?.lastActionDebugInfo,testContext:fo(v?.variableStore)}}}else{let p=i.action_description||o.action_name,w=!!a?.withSelfHealing&&at.canSelfHeal(i);l=await this.agent.step(r,async()=>{await this.agent.execAction(o.action_name,r,i)},p,n,s,w)}let c=this.agent.getAgentNote(),u=this.agent._getContext()?.variableStore,h={...l,status:"success",testContext:fo(u)};if(c&&(h.details=c),s){let p=this.agent.getNewActionEntities().get(s);if(p){let{element_index:w,...f}=p.action_data?.kwargs||{};h.newActionEntity={...p,action_data:p.action_data?{...p.action_data,kwargs:f}:p.action_data}}}return h}async runStep(t,i,n,a,o){let r=[];this.abortController=new AbortController;try{let s=await this.agent.run(this.agent.agentServices.validatePage(this.page),i,n,{onAction:c=>{r.push(c),a({type:Di.Action,data:{action_entity:c}})}}),l=this.agent._getContext()?.variableStore;return a({type:Di.Completion,data:{success:s?.success??!0,details:s?.details,testContext:fo(l)}}),{success:s?.success??!0,actions:r,details:s?.details}}finally{this.abortController=null}}async executeFunction(t,i){let n=t.functionName,[a,o]=n.split("#");try{if(se.isAbsolute(a))return{status:"error",details:`Absolute paths are not supported in call: references. Use a path relative to the project root (got: "${a}")`};let r=kh(a,this.testDir,this.projectRoot),l=(await import((0,Cl.pathToFileURL)(r).href))[o];if(typeof l!="function")return{status:"error",details:`Export "${o}" not found or not a function in ${a}`};let d=l.toString().match(/\(([^)]*)\)/),u=d&&d[1].trim()?d[1].split(",").map(x=>x.split(":")[0].trim().replace(/\?$/,"")):[],h=Array.isArray(t.args)?t.args:void 0,p=Array.isArray(t.parameterNames)?t.parameterNames.map(String):[],w=Array.isArray(t.parameterValues)?t.parameterValues:Array.isArray(i)?i:[],f={};p.forEach((x,E)=>{let $=x.split(":")[0].trim();f[$]=w[E]??""});let y=this.agent.agentServices.validatePage(this.page),m=x=>x==="page"?y:x==="agent"?this.agent:x==="request"?this.page.context().request:x==="testContext"?this.testContext:typeof x=="string"&&x.startsWith("$")?this.agent.agentServices.readVariable(x.substring(1)):x,v=u.map(x=>{if(x==="page")return y;if(x==="agent")return this.agent;if(x==="request")return this.page.context().request;if(x==="testContext")return this.testContext;let E=f[x]??"";return m(E)}),_=h&&h.length>0?h.map(m):u.length>0?v:w.map(m);return await l(..._),{status:"success"}}catch(r){let s=r instanceof Error?r.message:String(r);return{status:"error",details:`Function call failed: ${n} \u2014 ${s}`}}}async executeCode(t,i){try{return{status:"success",result:await new Function("page","expect","agent",`return (async () => { return (${i}); })();`)(this.agent.agentServices.validatePage(this.page),Nl.expect,this.agent)}}catch(n){return{status:"error",details:n instanceof Error?n.message:String(n)}}}stopRunStep(t){return this.abortController?(this.abortController.abort(),!0):!1}async evaluate(t,i,n){try{let a=await this.agent.evaluate(this.agent.agentServices.validatePage(this.page),i);return{status:"success",conclusion:a?"true":"false",explanation:a?`Condition met: ${i}`:`Condition not met: ${i}`}}catch(a){return{status:"error",conclusion:"unknown",explanation:a.message}}}async generateAction(t,i,n,a){let o=await this.agent.generate(this.agent.agentServices.validatePage(this.page),i,n,a?.usePureVision),r=o.actions?.[0];return r?{status:"success",action:r,explanation:o.details,debugInfo:o.debugInfo,completes_instruction:o.success}:{status:"error",explanation:o.details||"Failed to generate action",debugInfo:o.debugInfo}}async takeScreenshot(t,i){let n=await this.agent.agentServices.validatePage(this.page).screenshot(),a=i??`debug-${this.screenshotHistory.length}`,o;if(this.artifactsDir){let r=se.join(this.artifactsDir,a.replace(/\./g,"-"));await $t.mkdir(r,{recursive:!0}),o=se.join(r,"screenshot.png")}else o=se.join(Pl.tmpdir(),`shiplight-screenshot-${Date.now()}.png`);return await $t.writeFile(o,n),this.screenshotHistory.push({stepId:a,path:o}),{screenshot:n.toString("base64"),screenshotPath:o}}getSessionArtifacts(t){return{outputDir:this.artifactsDir,screenshots:[...this.screenshotHistory]}}async startRecorder(t,i,n){let a=this.page.context(),o=new Promise(s=>{this.recorderStopResolver=s}),r={actionAdded:(s,l,c)=>{i({type:"actionAdded",action:l.action,code:c,timestamp:Date.now()})},actionUpdated:(s,l,c)=>{i({type:"actionUpdated",action:l.action,code:c,timestamp:Date.now()})},signalAdded:(s,l)=>{i({type:"signal",signal:l.signal,timestamp:Date.now()})}};if(this.recorderEnabled)a._onRecorderEventSink=r,await this.page.evaluate(()=>window.__pw_recorderSetMode?.("recording")).catch(()=>{});else{let s="x-pw-overlay { display: none !important; }";await a.addInitScript(`(() => {
|
|
4415
4415
|
const orig = Element.prototype.attachShadow;
|
|
4416
4416
|
Element.prototype.attachShadow = function(init) {
|