shiplightai 0.1.64 → 0.1.65

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -17,7 +17,7 @@ Install it as a project dependency instead:
17
17
  `)}catch{}}function ms(e=ct()){try{let t=O.readFileSync(e,"utf-8"),n=JSON.parse(t);if(typeof n.latest=="string"&&typeof n.fetchedAt=="number"&&Date.now()-n.fetchedAt<ds)return n}catch{}return null}function ys(e,t=ct()){try{O.mkdirSync(W.dirname(t),{recursive:!0}),O.writeFileSync(t,JSON.stringify(e))}catch{}}async function ws(){try{let e=await fetch(us,{headers:{Accept:"application/json"},signal:AbortSignal.timeout(3e3)});if(!e.ok)return null;let t=await e.json();return typeof t.version=="string"?t.version:null}catch{return null}}function bs(e,t){let n=d=>{let f=d.indexOf("-");return f===-1?[d,!1]:[d.slice(0,f),!0]},r=d=>d.split(".").map(f=>parseInt(f,10)||0),[s,o]=n(e),[i,a]=n(t),l=r(s),c=r(i),u=Math.max(l.length,c.length);for(let d=0;d<u;d++){let f=l[d]??0,g=c[d]??0;if(f<g)return!0;if(f>g)return!1}return!!(o&&!a)}async function Yt(e={}){let t=e.runningVersion??it,n=e.cwd??process.cwd(),r=e.cacheFile??ct(),s=e.fetchLatest??ws,o=e.env??process.env,i=e.warn??(c=>console.warn(c));if(o.CI||t==="dev"||!O.existsSync(W.join(n,"package-lock.json")))return;let a=null,l=ms(r);if(l)a=l.latest;else{try{a=await s()}catch{a=null}a&&ys({latest:a,fetchedAt:Date.now()},r)}a&&bs(t,a)&&i(`
18
18
  \x1B[33m\u26A0 shiplightai ${a} is available (you have ${t}).
19
19
  Run: npm update shiplightai\x1B[0m
20
- `)}var it,_e,us,ds,hs,Le=_(()=>{"use strict";it="0.1.64",_e=it!=="dev"?it:void 0,us="https://registry.npmjs.org/shiplightai/latest",ds=3600*1e3,hs=10080*60*1e3});import*as ne from"fs";import*as ae from"path";function lt(e){let{projectPath:t}=e,n=e.projectName??ae.basename(ae.resolve(t));if(ne.existsSync(t)&&ne.readdirSync(t).length>0)throw new Error(`Cannot scaffold into non-empty directory: ${t}`);ne.mkdirSync(t,{recursive:!0});let r=(s,o)=>{let i=ae.join(t,s);ne.mkdirSync(ae.dirname(i),{recursive:!0}),ne.writeFileSync(i,o)};return r("package.json",vs.replace("{{name}}",n)),r("playwright.config.ts",Ss),r(".gitignore",_s),r(".env.example",xs),r(".mcp.json",Ts),r(".claude/CLAUDE.md",ks),r(".claude/auth.md",Ps),r(".claude/creating-tests.md",As),r(".claude/settings.local.json",Es),r(".claude/test-spec-template.md",$s),r(".claude/updating-tests.md",Ms),r("auth/example.login.ts",Is),r("environments/example.env.yaml",Os),r("tests/example.test.yaml",Ls),{projectPath:t,projectName:n,filesCreated:["package.json","playwright.config.ts",".gitignore",".env.example",".mcp.json",".claude/CLAUDE.md",".claude/auth.md",".claude/creating-tests.md",".claude/settings.local.json",".claude/test-spec-template.md",".claude/updating-tests.md","auth/example.login.ts","environments/example.env.yaml","tests/example.test.yaml"]}}var vs,Ss,_s,xs,Ts,ks,Ps,As,Es,$s,Ms,Is,Os,Ls,Jt=_(()=>{"use strict";vs=`{
20
+ `)}var it,_e,us,ds,hs,Le=_(()=>{"use strict";it="0.1.65",_e=it!=="dev"?it:void 0,us="https://registry.npmjs.org/shiplightai/latest",ds=3600*1e3,hs=10080*60*1e3});import*as ne from"fs";import*as ae from"path";function lt(e){let{projectPath:t}=e,n=e.projectName??ae.basename(ae.resolve(t));if(ne.existsSync(t)&&ne.readdirSync(t).length>0)throw new Error(`Cannot scaffold into non-empty directory: ${t}`);ne.mkdirSync(t,{recursive:!0});let r=(s,o)=>{let i=ae.join(t,s);ne.mkdirSync(ae.dirname(i),{recursive:!0}),ne.writeFileSync(i,o)};return r("package.json",vs.replace("{{name}}",n)),r("playwright.config.ts",Ss),r(".gitignore",_s),r(".env.example",xs),r(".mcp.json",Ts),r(".claude/CLAUDE.md",ks),r(".claude/auth.md",Ps),r(".claude/creating-tests.md",As),r(".claude/settings.local.json",Es),r(".claude/test-spec-template.md",$s),r(".claude/updating-tests.md",Ms),r("auth/example.login.ts",Is),r("environments/example.env.yaml",Os),r("tests/example.test.yaml",Ls),{projectPath:t,projectName:n,filesCreated:["package.json","playwright.config.ts",".gitignore",".env.example",".mcp.json",".claude/CLAUDE.md",".claude/auth.md",".claude/creating-tests.md",".claude/settings.local.json",".claude/test-spec-template.md",".claude/updating-tests.md","auth/example.login.ts","environments/example.env.yaml","tests/example.test.yaml"]}}var vs,Ss,_s,xs,Ts,ks,Ps,As,Es,$s,Ms,Is,Os,Ls,Jt=_(()=>{"use strict";vs=`{
21
21
  "name": "{{name}}",
22
22
  "type": "module",
23
23
  "scripts": {
@@ -635,7 +635,8 @@ test('__shiplight_debug__', async ({ page, agent }) => {
635
635
  // Keep alive until the server is closed externally (Ctrl+C kills the process)
636
636
  await new Promise(() => {});
637
637
  });
638
- `}async function Bs(e){let{createServer:t}=await import("net");for(let n=e;n<e+20;n++)if(await new Promise(s=>{let o=t();o.once("error",()=>s(!1)),o.once("listening",()=>{o.close(()=>s(!0))}),o.listen(n,"127.0.0.1")}))return n;throw new Error(`No available port found in range ${e}-${e+19}`)}async function pt(e){let{yamlFilePath:t,configPath:n,tempSuffix:r="",headed:s}=e,o=q.dirname(n),i=await Bs(16174),a;if(!se.existsSync(t))throw new Error(`Please select a test file before starting the debug session. File not found: ${t}`);try{let y=Fs(se.readFileSync(t,"utf-8"));y?.use&&typeof y.use=="object"&&!Array.isArray(y.use)&&(a=y.use),y?.base_url&&!a?.baseURL&&(a={...a,baseURL:y.base_url}),y?.settings?.auto_dismiss_modal!==void 0&&(a={...a,autoDismissModal:!!y.settings.auto_dismiss_modal}),y?.settings?.browser_timezone!=null&&(a={...a,timezoneId:String(y.settings.browser_timezone)}),y?.settings?.browser_language!=null&&(a={...a,locale:String(y.settings.browser_language)}),y?.settings?.extra_http_headers!=null&&typeof y.settings.extra_http_headers=="object"&&(a={...a,extraHTTPHeaders:y.settings.extra_http_headers})}catch(y){console.error("[debugger] Could not parse YAML for `use` block:",y)}let l=q.dirname(q.resolve(t)),c=r?`-${r}`:"",u=q.join(l,`.__shiplight_debug__${c}.yaml.spec.ts`),d=Us(t,i,a,o);se.writeFileSync(u,d);let f=pn(u),g=["playwright","test",u,...s?["--headed"]:[]],h=js("npx",g,{stdio:["ignore","pipe","pipe"],shell:!0,cwd:o,env:{...process.env,PWDEBUG:"console",SHIPLIGHT_REGISTRY_URL:""}});h.stdout?.on("data",y=>{process.stderr.write(y)}),h.stderr?.on("data",y=>{process.stderr.write(y)});let p=()=>{h.killed||h.kill("SIGTERM")};process.on("SIGTERM",p),process.on("SIGINT",p),process.on("exit",p),h.on("close",y=>{process.removeListener("SIGTERM",p),process.removeListener("SIGINT",p),process.removeListener("exit",p),f(),y!==0&&y!==null&&console.error(`[debugger] Playwright process exited with code ${y}`)}),console.error("[debugger] Waiting for Playwright sandbox to start...");let v=["127.0.0.1","::1"];async function w(y){try{let k=y.includes(":")?`[${y}]`:y,P=await fetch(`http://${k}:${i}/api/test-flow`);if(P.ok){try{await P.text()}catch{}return!0}}catch{}return!1}let m=null;for(let y=0;y<180;y++){if(h.exitCode!==null)throw f(),new Error(`Playwright process exited with code ${h.exitCode} before sandbox was ready`);for(let k of v)if(await w(k)){m=k;break}if(m){console.error(`[debugger] Playwright sandbox ready on ${m}:${i}`);break}if(y===179)throw p(),f(),new Error("Timed out waiting for Playwright sandbox to start (180s)");await new Promise(k=>setTimeout(k,1e3))}if(!m)throw p(),f(),new Error("Sandbox poll finished without a reachable host");return{port:i,host:m,pid:h.pid??0,cleanup:async()=>{p(),f()}}}var ut=_(()=>{"use strict"});import{z as b}from"zod";var dn,dt,hn,fe,fn,gn,mn,j,yn,De,ht,ft=_(()=>{"use strict";dn=b.enum(["JS_CODE","AI_MODE"]),dt=b.object({type:dn,expression:b.string()}),hn=b.enum(["DRAFT","STEP","ACTION","IF_ELSE","WHILE_LOOP"]),fe=b.object({uid:b.string(),type:hn,comment:b.string().optional()}),fn=b.object({action_data:b.object({action_name:b.string(),kwargs:b.record(b.any()).optional(),args:b.array(b.any()).optional()}),action_description:b.string().optional(),url:b.string().optional(),xpath:b.string().nullable().optional(),locator:b.string().nullable().optional(),css_selector:b.string().nullable().optional(),unique_selector:b.string().nullable().optional(),element_index:b.number().nullable().optional(),frame_path:b.array(b.any()).optional(),artifacts:b.record(b.any()).optional(),feedback:b.string().optional(),original_browser_use_action:b.any().optional()}).passthrough(),gn=fe.extend({type:b.literal("DRAFT"),description:b.string()}),mn=fe.extend({type:b.literal("ACTION"),description:b.string(),action_entity:fn.optional(),locator:b.string().optional(),use_pure_vision:b.boolean().optional()}),j=b.lazy(()=>b.union([gn,mn,fe.extend({type:b.literal("STEP"),description:b.string().optional().default(""),statements:b.array(j),reference_id:b.number().optional(),template_path:b.string().optional(),template_params:b.record(b.string()).optional()}),fe.extend({type:b.literal("IF_ELSE"),description:b.string().optional(),condition:dt,then:b.array(j),else:b.array(j).optional()}),fe.extend({type:b.literal("WHILE_LOOP"),description:b.string().optional(),condition:dt,body:b.array(j),timeout_ms:b.number().optional()})])),yn=b.object({name:b.string(),statements:b.array(j),teardown:b.array(j).optional(),skip:b.union([b.boolean(),b.string()]).optional(),timeout:b.number().optional(),fail:b.union([b.boolean(),b.string()]).optional(),only:b.boolean().optional(),slow:b.boolean().optional()}),De=b.object({tests:b.array(yn).min(1),beforeAll:b.array(j).optional(),afterAll:b.array(j).optional(),beforeEach:b.array(j).optional(),afterEach:b.array(j).optional()}),ht=b.object({comment:b.string().optional(),version:b.string().optional(),goal:b.string().optional(),url:b.string().optional(),baseURL:b.string().optional(),final_feedback:b.string().optional(),completed:b.boolean().optional(),success:b.boolean().optional(),statements:b.array(j).optional(),teardown:b.array(j).optional(),last_modified_at:b.string().optional(),testGroup:De.optional()}).refine(e=>e.testGroup!==void 0?e.goal===void 0&&(e.statements===void 0||e.statements.length===0):e.goal!==void 0,{message:"TestFlow must have either goal/statements (single test) or testGroup (suite), not both"})});import{stringify as Hs,parse as Sn,parseAllDocuments as pa,parseDocument as Ws,Document as Gs,isMap as me,isSeq as z}from"yaml";import{v4 as K}from"uuid";function je(e,t){let n={...t?.test_case_id!==void 0?{test_case_id:t.test_case_id}:{},...t?.name?{name:t.name}:{},goal:e.goal??"",url:e.url,base_url:e.baseURL,...t?.timeout!==void 0?{timeout:t.timeout}:{},...t?.settings&&Object.keys(t.settings).length>0?{settings:t.settings}:{},statements:(e.statements??[]).map(B)};return e.final_feedback&&(n.final_feedback=e.final_feedback),e.teardown&&e.teardown.length>0&&(n.teardown=e.teardown.map(B)),n}function ke(e,t){if(e.testGroup)return xn(e,t);let n=je(e,t),r=new Gs(n);return e.comment&&(r.commentBefore=e.comment),wn(r,e.statements??[]),e.teardown&&wn(r,e.teardown,"teardown"),r.toString(_n)}function wn(e,t,n="statements"){let r=e.contents;if(!r||!me(r))return;let s=r.get(n,!0);z(s)&&Te(s,t)}function Te(e,t){for(let n=0;n<Math.min(e.items.length,t.length);n++){let r=t[n],s=e.items[n];if(n>0&&(s.spaceBefore=!0),r.comment&&(n===0?e.commentBefore=r.comment:s.commentBefore=r.comment),me(s)){let o=s;if(r.type==="STEP"){let i=o.get("statements",!0);z(i)&&Te(i,r.statements)}else if(r.type==="IF_ELSE"){let i=o.get("THEN",!0);z(i)&&Te(i,r.then);let a=o.get("ELSE",!0);z(a)&&r.else&&Te(a,r.else)}else if(r.type==="WHILE_LOOP"){let i=o.get("DO",!0);z(i)&&Te(i,r.body)}}}}function xn(e,t){let n=e.testGroup;if(!n)throw new Error("suiteToYaml requires a TestFlow with testGroup");let r={};t?.test_case_id!==void 0&&(r.test_case_id=t.test_case_id),t?.name&&(r.name=t.name),t?.tags&&t.tags.length>0&&(r.tags=t.tags),t?.use&&Object.keys(t.use).length>0&&(r.use=t.use),t?.settings&&Object.keys(t.settings).length>0&&(r.settings=t.settings);let s={};return e.baseURL&&(s.base_url=e.baseURL),n.beforeAll&&n.beforeAll.length>0&&(s.beforeAll=n.beforeAll.map(B)),n.beforeEach&&n.beforeEach.length>0&&(s.beforeEach=n.beforeEach.map(B)),n.afterEach&&n.afterEach.length>0&&(s.afterEach=n.afterEach.map(B)),n.afterAll&&n.afterAll.length>0&&(s.afterAll=n.afterAll.map(B)),s.tests=n.tests.map(o=>{let i={name:o.name};return o.skip!==void 0&&(i.skip=o.skip),o.timeout!==void 0&&(i.timeout=o.timeout),o.fail!==void 0&&(i.fail=o.fail),o.only!==void 0&&(i.only=o.only),o.slow!==void 0&&(i.slow=o.slow),i.statements=o.statements.map(B),o.teardown&&o.teardown.length>0&&(i.teardown=o.teardown.map(B)),i}),r.suite=s,Hs(r,_n)}function B(e){switch(e.type){case"DRAFT":return Ks(e);case"ACTION":return zs(e);case"STEP":return Vs(e);case"IF_ELSE":return Ys(e);case"WHILE_LOOP":return Js(e)}}function Ks(e){return{intent:e.description}}function zs(e){let t=e.action_entity?.action_data?.action_name??e.action_entity?.action?.action_name,n=e.action_entity?.action_data?.kwargs??e.action_entity?.action?.kwargs;if(t==="verify"){let a=n?.statement;if(typeof a=="string"&&!e.action_entity?.locator&&!e.action_entity?.xpath){let l=n?.code;return typeof l=="string"?{VERIFY:a,js:l}:{VERIFY:a}}}if(t==="go_to_url"){let a=n?.url;if(typeof a=="string"&&!e.action_entity?.locator&&!e.action_entity?.xpath){let l={URL:a};return n?.new_tab===!0&&(l.new_tab=!0),typeof n?.timeout_seconds=="number"&&(l.timeout_seconds=n.timeout_seconds),l}}if(t==="js_action"){let a=n?.code;if(typeof a=="string"&&e.description)return{intent:e.description,js:a}}if(t==="ai_wait_until"){let a=n?.condition;if(typeof a=="string"){let l={WAIT_UNTIL:a};return typeof n?.timeout_seconds=="number"&&n.timeout_seconds!==60&&(l.timeout_seconds=n.timeout_seconds),l}}if(t==="wait"){let a=n?.seconds,c={WAIT:e.description||`Wait ${a}s`};return typeof a=="number"&&(c.seconds=a),c}if(t==="js_code"){let a=n?.code;if(typeof a=="string"&&!e.action_entity?.locator&&!e.action_entity?.xpath)return{CODE:a}}if(!e.action_entity)return{intent:e.description};let r=e.action_entity.action_data??e.action_entity.action;if(!r)return{intent:e.description};let s={intent:e.description,action:r.action_name},o=e.locator??e.action_entity.locator;o&&(s.locator=o);let i=e.action_entity.xpath;if(i&&(s.xpath=i),e.use_pure_vision&&(s.use_pure_vision=!0),r.kwargs&&Object.keys(r.kwargs).length>0)for(let[a,l]of Object.entries(r.kwargs))s[a]=l;return r.args&&r.args.length>0&&(s.args=r.args),s}function Vs(e){if(e.template_path){let n={template:e.template_path};return e.template_params&&Object.keys(e.template_params).length>0&&(n.params=e.template_params),n}let t={STEP:e.description,statements:e.statements.map(B)};return e.reference_id!==void 0&&(t.reference_id=e.reference_id),t}function Ys(e){let t={IF:Tn(e.condition),THEN:e.then.map(B)};return e.else&&e.else.length>0&&(t.ELSE=e.else.map(B)),t}function Js(e){let t={WHILE:Tn(e.condition),DO:e.body.map(B)};return e.timeout_ms!==void 0&&(t.timeout_ms=e.timeout_ms),t}function Tn(e){return e.type==="JS_CODE"?`js:${e.expression}`:e.expression}function Pe(e){try{let t=Sn(e);if(!t||typeof t!="object")return{};let n={};return typeof t.test_case_id=="number"&&Number.isFinite(t.test_case_id)&&(n.test_case_id=t.test_case_id),typeof t.template_id=="number"&&Number.isFinite(t.template_id)&&(n.template_id=t.template_id),typeof t.name=="string"&&t.name.trim()&&(n.name=t.name.trim()),typeof t.timeout=="number"&&Number.isFinite(t.timeout)&&(n.timeout=t.timeout),t.settings&&typeof t.settings=="object"&&!Array.isArray(t.settings)&&(n.settings=t.settings),n}catch{return{}}}function gt(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(gt);let t=e,n=Object.keys(t);if(n.length===1){let s=n[0];if(s.startsWith("{ ")&&s.endsWith(" }")&&t[s]===null)return`{{${s.slice(2,-2)}}}`}let r={};for(let[s,o]of Object.entries(t))r[s]=gt(o);return r}function C(e){if(e.length>bn)throw new Error(`YAML input too large (${e.length} bytes, max ${bn})`);let t=gt(Sn(e));if(!t||typeof t!="object")throw new Error("Invalid YAML: expected an object at root level");if(t.suite)return qs(t);let n={version:"1.3.0",goal:t.goal,url:t.url,baseURL:t.base_url,statements:H(t.statements??[])};t.final_feedback&&(n.final_feedback=t.final_feedback),t.teardown&&Array.isArray(t.teardown)&&(n.teardown=H(t.teardown));let r=ht.safeParse(n);if(!r.success)throw new Error(`Invalid TestFlow after YAML conversion: ${JSON.stringify(r.error.errors)}`);let s=r.data;return Fe(e,s),s}function qs(e){let t=e.suite;if(!t||typeof t!="object")throw new Error("Invalid suite: expected an object");let n=t.tests;if(!Array.isArray(n)||n.length===0)throw new Error('Suite must have a non-empty "tests" array');let s={tests:n.map(a=>{if(!a.name)throw new Error('Each test in a suite must have a "name" field');if(!Array.isArray(a.statements)||a.statements.length===0)throw new Error(`Suite test "${a.name}" must have a non-empty "statements" array`);let l={name:a.name,statements:H(a.statements)};return Array.isArray(a.teardown)&&a.teardown.length>0&&(l.teardown=H(a.teardown)),a.skip!==void 0&&(l.skip=a.skip),typeof a.timeout=="number"&&(l.timeout=a.timeout),a.fail!==void 0&&(l.fail=a.fail),a.only===!0&&(l.only=!0),a.slow===!0&&(l.slow=!0),l})};Array.isArray(t.beforeAll)&&t.beforeAll.length>0&&(s.beforeAll=H(t.beforeAll)),Array.isArray(t.afterAll)&&t.afterAll.length>0&&(s.afterAll=H(t.afterAll)),Array.isArray(t.beforeEach)&&t.beforeEach.length>0&&(s.beforeEach=H(t.beforeEach)),Array.isArray(t.afterEach)&&t.afterEach.length>0&&(s.afterEach=H(t.afterEach));let o=De.safeParse(s);if(!o.success)throw new Error(`Invalid TestGroup: ${JSON.stringify(o.error.errors)}`);return{version:"1.3.0",baseURL:t.base_url||void 0,testGroup:o.data}}function H(e){if(!Array.isArray(e))throw new Error("Expected an array of statements");return e.map(Xs)}function Xs(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 Zs(t);if("WHILE"in t)return Qs(t);if("STEP"in t)return eo(t);if("VERIFY"in t){let n=t.VERIFY,r={statement:typeof n=="string"?n:String(n)};return typeof t.js=="string"&&(r.code=t.js),{uid:K(),type:"ACTION",description:String(n),action_entity:{action_description:String(n),action_data:{action_name:"verify",kwargs:r}}}}if("URL"in t){let n=t.URL,r=t.new_tab===!0?!0:void 0,s=typeof t.timeout_seconds=="number"?t.timeout_seconds:void 0,o={url:typeof n=="string"?n:String(n)};return r&&(o.new_tab=!0),s!==void 0&&(o.timeout_seconds=s),{uid:K(),type:"ACTION",description:`Navigate to ${n}`,action_entity:{action_description:`Navigate to ${n}`,action_data:{action_name:"go_to_url",kwargs:o}}}}if("WAIT_UNTIL"in t){let n=t.WAIT_UNTIL,r=typeof t.timeout_seconds=="number"?t.timeout_seconds:60;return{uid:K(),type:"ACTION",description:`Wait until: ${n}`,action_entity:{action_description:`Wait until: ${n}`,action_data:{action_name:"ai_wait_until",kwargs:{condition:typeof n=="string"?n:String(n),timeout_seconds:r}}}}}if("WAIT"in t){let n=t.WAIT,r=typeof t.seconds=="number"?t.seconds:3;return{uid:K(),type:"ACTION",description:typeof n=="string"?n:`Wait ${r}s`,action_entity:{action_description:typeof n=="string"?n:`Wait ${r}s`,action_data:{action_name:"wait",kwargs:{seconds:r}}}}}if("CODE"in t){let n=t.CODE;if(n==null)throw new Error('CODE statement has no code. Use "CODE: |" followed by indented code on the next line.');return{uid:K(),type:"ACTION",description:"Code block",action_entity:{action_description:"Code block",action_data:{action_name:"js_code",kwargs:{code:typeof n=="string"?n:String(n)}}}}}if("js"in t&&("intent"in t||"desc"in t)&&!("VERIFY"in t)&&t.action!=="verify"){let n=t.js,r=typeof t.intent=="string"?t.intent:typeof t.desc=="string"?t.desc:"";return{uid:K(),type:"ACTION",description:r,action_entity:{action_description:r,action_data:{action_name:"js_action",kwargs:{code:typeof n=="string"?n:String(n)}}}}}if("call"in t&&typeof t.call=="string"){let{call:n,...r}=t;return vn({...r,action:"function",functionName:n})}if("action"in t)return vn(t);if("intent"in t&&typeof t.intent=="string"||"desc"in t&&typeof t.desc=="string")return{uid:K(),type:"DRAFT",description:typeof t.intent=="string"?t.intent:t.desc};throw new Error(`Cannot infer statement type from object: ${JSON.stringify(t)}`)}function kn(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 Zs(e){let t=kn(e.IF),n=e.THEN;if(!Array.isArray(n))throw new Error("IF_ELSE requires a THEN array");let r={uid:K(),type:"IF_ELSE",condition:t,then:H(n)};return"ELSE"in e&&Array.isArray(e.ELSE)&&(r.else=H(e.ELSE)),r}function Qs(e){let t=kn(e.WHILE),n=e.DO;if(!Array.isArray(n))throw new Error("WHILE_LOOP requires a DO array");let r={uid:K(),type:"WHILE_LOOP",condition:t,body:H(n)};return typeof e.timeout_ms=="number"&&(r.timeout_ms=e.timeout_ms),r}function eo(e){let t=typeof e.STEP=="string"?e.STEP:"";if(!Array.isArray(e.statements))throw new Error("STEP requires a statements array");let n={uid:K(),type:"STEP",description:t,statements:H(e.statements)};if(typeof e.reference_id=="number"&&(n.reference_id=e.reference_id),typeof e.template_path=="string"&&(n.template_path=e.template_path),e.template_params&&typeof e.template_params=="object"&&!Array.isArray(e.template_params)){let r=e.template_params,s={};for(let[o,i]of Object.entries(r))s[o]=String(i);n.template_params=s}return n}function vn(e){let t=typeof e.action=="string"?e.action:String(e.action),n=typeof e.intent=="string"?e.intent:typeof e.desc=="string"?e.desc:"",r=typeof e.locator=="string"?e.locator:void 0,s=typeof e.xpath=="string"?e.xpath:void 0,o=typeof e.use_pure_vision=="boolean"?e.use_pure_vision:void 0,i={};for(let[c,u]of Object.entries(e))to.has(c)||(i[c]=u);t==="verify"&&typeof i.js=="string"&&(i.code=i.js,delete i.js);let a={action_description:n,action_data:{action_name:t,kwargs:Object.keys(i).length>0?i:{}}};r&&(a.locator=r),s&&(a.xpath=s);let l={uid:K(),type:"ACTION",description:n,action_entity:a};return o&&(l.use_pure_vision=!0),l}function Fe(e,t){let n;try{n=Ws(e)}catch{return}let r=n.contents;if(!r||!me(r))return;if(n.commentBefore)t.comment=n.commentBefore;else{let l=r.items?.[0];l?.key&&l.key.commentBefore&&(t.comment=l.key.commentBefore)}let s=r,o=s.get("statements",!0);z(o)&&t.statements&&ge(o,t.statements);let i=s.get("teardown",!0);z(i)&&t.teardown&&ge(i,t.teardown)}function ge(e,t){e.commentBefore&&t.length>0&&(t[0].comment=e.commentBefore);for(let n=0;n<Math.min(e.items.length,t.length);n++){let r=e.items[n];r.commentBefore&&!(n===0&&e.commentBefore)&&(t[n].comment=r.commentBefore);let s=t[n];if(s.type==="STEP"&&me(r)){let o=r.get("statements",!0);z(o)&&ge(o,s.statements)}else if(s.type==="IF_ELSE"&&me(r)){let o=r.get("THEN",!0);z(o)&&ge(o,s.then);let i=r.get("ELSE",!0);z(i)&&s.else&&ge(i,s.else)}else if(s.type==="WHILE_LOOP"&&me(r)){let o=r.get("DO",!0);z(o)&&ge(o,s.body)}}}var _n,bn,to,Ue=_(()=>{"use strict";ft();_n={lineWidth:120,defaultKeyType:"PLAIN",defaultStringType:"PLAIN"};bn=1024*1024;to=new Set(["action","intent","desc","locator","xpath","use_pure_vision"])});import{parse as ga,stringify as ma}from"yaml";var Pn=_(()=>{"use strict";Ue()});var mt,Be,He=_(()=>{"use strict";mt=e=>{let t=[];switch(e.type){case"STEP":e.statements&&t.push({key:"statements",statements:e.statements});break;case"IF_ELSE":e.then&&t.push({key:"then",statements:e.then}),e.else&&t.push({key:"else",statements:e.else});break;case"WHILE_LOOP":e.body&&t.push({key:"body",statements:e.body});break}return t},Be=e=>{let t=[],n=r=>{for(let s of r){t.push(s);let o=mt(s);for(let i of o)n(i.statements)}};return n(e),t}});function In(e){let t=0,n=0;for(let r of e)if(r.type==="DRAFT")n++;else if(r.type==="ACTION"){let s=r.action_entity?.action_data?.action_name??"";Mn.has(s)||t++}return{action:t,draft:n}}function ro(e){try{return new Function(`return async function() { ${e} }`),null}catch(t){return t.message}}function $n(e){try{return new Function(`return async function() { return (${e}) }`),null}catch(t){return t.message}}function so(e){let t=e.split(/\r?\n/).map(s=>s.trim()).filter(s=>s.length>0&&!s.startsWith("//")).length,n=e.match(/\bawait\b/g),r=n?n.length:0;return t<=An&&r<=En?null:`${t} non-blank line(s), ${r} await(s) \u2014 limits are ${An} lines and ${En} awaits. The js: field is a cache for one natural-language intent, not a place for multi-step logic. Break this into multiple statements \u2014 one VERIFY or intent+js per UI interaction or assertion \u2014 so each step is visible in the debugger and self-healable.`}function yt(e,t){let n=t?.coverageThreshold??no,r=[],s=[],o;try{o=C(e)}catch(f){return{valid:!1,errors:[`Invalid YAML: ${f.message}`],warnings:[],stats:{total:0,action:0,draft:0,coverage:0}}}o.goal||r.push('Missing required field: "goal"'),o.statements?.length||r.push('Missing required field: "statements"');let i=[...Be(o.statements??[]),...o.teardown?Be(o.teardown):[]],{action:a,draft:l}=In(i),c="Hint: in YAML double-quoted strings, backslashes are escape characters \u2014 use \\\\/ instead of \\/ for regex, or use single quotes.";for(let f of i){let g=f;if(g.reference_id!==void 0){let h=g.description||f.uid;r.push(`Unresolved cloud template reference on statement "${h}" (reference_id: ${g.reference_id}). Local YAML tests cannot use reference_id \u2014 inline the template statements or use the local "template:" key instead.`)}if(f.type==="ACTION"){let h=f,p=h.action_entity?.action_data?.action_name??"";if(p==="js_code"||p==="js_action"||p==="verify"||p==="ai_assert"){let v=h.action_entity?.action_data?.kwargs?.code;if(typeof v=="string"){let w=ro(v);if(w){let m=h.description||p;r.push(`Invalid JS in "${m}": ${w}. ${c}`)}else if(p==="verify"||p==="js_action"){let m=so(v);if(m){let y=h.description||p;r.push(`JS cache for "${y}" is too complex: ${m}`)}}}}}if(f.type==="IF_ELSE"){let h=f;if(h.condition.type==="JS_CODE"){let p=$n(h.condition.expression);p&&r.push(`Invalid JS in IF condition "${h.condition.expression}": ${p}. ${c}`)}}if(f.type==="WHILE_LOOP"){let h=f;if(h.condition.type==="JS_CODE"){let p=$n(h.condition.expression);p&&r.push(`Invalid JS in WHILE condition "${h.condition.expression}": ${p}. ${c}`)}}}let u=a+l,d=u>0?Math.round(a/u*100):0;return u>0&&d/100<n&&s.push(`Low action coverage: ${a}/${u} statements (${d}%) are enriched with action/js. ${l} draft statement(s) still need enrichment. Use MCP tools (act, get_locators) to convert drafts to actions.`),{valid:r.length===0,errors:r,warnings:s,stats:{total:u,action:a,draft:l,coverage:d}}}var no,An,En,Mn,On=_(()=>{"use strict";Ue();He();no=.5,An=5,En=3,Mn=new Set(["verify","ai_assert","done","go_to_url","ai_wait_until","wait","js_code"])});function wt(){return{version:"1.0",entries:{}}}var Ln=_(()=>{"use strict";He()});import{v4 as ka}from"uuid";var Rn=_(()=>{"use strict"});var V,bt,Cn=_(()=>{"use strict";V=(e=>(e.DRAFT="DRAFT",e.STEP="STEP",e.ACTION="ACTION",e.IF_ELSE="IF_ELSE",e.WHILE_LOOP="WHILE_LOOP",e))(V||{}),bt=18e4});var We=_(()=>{"use strict"});var Nn=_(()=>{"use strict";We()});var Dn,io,jn,Fn,Ae,ao,co,Un=_(()=>{"use strict";Dn=112,io=1080-Dn,jn={"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"}},Fn={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"]},Ae=(e,t=!1)=>{let n=["chromium"];return t&&n.push("webkit"),Fn[e].map(r=>jn[r]).filter(r=>r.defaultBrowserType&&n.includes(r.defaultBrowserType))},ao={desktop:{label:"Desktop",type:"desktop",devices:Ae("desktop")},mobile:{label:"Mobile Web",type:"mobile",devices:Ae("mobile")}},co={desktop:{label:"Desktop",type:"desktop",devices:Ae("desktop",!0)},mobile:{label:"Mobile Web",type:"mobile",devices:Ae("mobile",!0)}}});var Bn=_(()=>{"use strict"});var Hn=_(()=>{"use strict"});var Wn=_(()=>{"use strict"});var Gn=_(()=>{"use strict"});var Kn=_(()=>{"use strict"});var zn=_(()=>{"use strict"});var Vn=_(()=>{"use strict"});var Yn=_(()=>{"use strict";We()});var ce=_(()=>{"use strict";Pn();On();Ue();ft();Ln();Rn();He();Cn();Nn();Un();Bn();Hn();Wn();Gn();Kn();zn();Vn();Yn();We()});import{stringify as po}from"yaml";import{createHash as $o}from"crypto";import{parse as Mo,stringify as sr}from"yaml";import{readFileSync as Io,existsSync as Oo}from"fs";import{resolve as St,dirname as Lo}from"path";import{parse as Zn,stringify as Ro}from"yaml";import{readFileSync as Bo,writeFileSync as Ho,mkdirSync as Wo}from"fs";import{dirname as Go}from"path";function oe(e){return e.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}function I(e){return e.replace(/\r\n/g," ").replace(/\n/g," ").replace(/\r/g," ").trim()}function uo(e){let t=e.frame_path;return!t||t.length===0?"page":`page.frameLocator('${t[0]}')`}function ho(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 Ke(e){let t=uo(e),n=e.locator;if(typeof n=="string"&&n.trim())return n=n.trim(),n.endsWith("first()")?`${t}.${n}`:`${t}.${n}.first()`;let r=ho(e);if(r){let s=JSON.stringify(r);return`${t}.locator(${s}).first()`}return null}function Jn(e){let t=e.action_data?.action_name;return!t||(t==="verify"||t==="ai_assert"||t==="assert")&&e.action_data?.kwargs?.code?!1:fo.includes(t)}function mo(e){let t=e.action_data?.action_name;return!t||(t==="verify"||t==="ai_assert"||t==="assert")&&e.action_data?.kwargs?.code?!1:!go.includes(t)}function S(e,t){R.set(e,t)}function yo(e){return R.get(e)}function ue(e,t,n=[]){let r=[...n];return t.locator?r.push(`locator: ${JSON.stringify(t.locator)}`):t.xpath&&r.push(`xpath: ${JSON.stringify(t.xpath)}`),t.frame_path&&t.frame_path.length>0&&r.push(`frame_path: ${JSON.stringify(t.frame_path)}`),r.length===0?[`await agent.execAction("${e}", page, {});`]:[`await agent.execAction("${e}", page, {`,...r.map(s=>` ${s},`),"});"]}function qn(e){let t=e.functionName;if(!t)return null;let n=Array.isArray(e.args)?e.args.map(String):[];if(n.length===0)return`await ${t}()`;let r=["page","testContext","request","agent"],s=["undefined","null","true","false"],o=n.map(i=>r.includes(i)||s.includes(i)||/^-?\d+(\.\d+)?$/.test(i)?i:i.startsWith("$")?`agent.agentServices.readVariable('${i.substring(1)}')`:`"${i}"`);return`await ${t}(${o.join(", ")})`}function X(e,t,n,r="main"){let s=[];for(let o=0;o<e.length;o++){let i=e[o],a=`${r}.${o}`,l=wo(i,t,a,n);l.length>0&&(s.push(...l),o<e.length-1&&s.push(""))}return s}function wo(e,t,n,r){let s=" ".repeat(t);switch(e.type){case"DRAFT":return bo(e,t,n,r);case"ACTION":return vo(e,t,n,r);case"STEP":return So(e,t,n,r);case"IF_ELSE":return _o(e,t,n,r);case"WHILE_LOOP":return xo(e,t,n,r);default:return[`${s}// Unknown statement type: ${e.type}`]}}function bo(e,t,n,r){let s=" ".repeat(t),o=e.description?.trim()||"";if(!o)return[`${s}// ${n}: Skipping - no description`];if(r.noAgent)return[`${s}// ${n}: ${I(o)}`,`${s}// DRAFT: ${I(o)} (requires agent - skipped in hook)`];let i=JSON.stringify(o);return[`${s}// ${n}: ${I(o)}`,`${s}// \u26A0 DRAFT: AI-resolved at runtime (~5-10s). Add a locator to make this <1s.`,`${s}page = agent.agentServices.validatePage(page);`,`${s}await agent.run(page, ${i}, '${n}');`]}function vo(e,t,n,r){let s=" ".repeat(t),o=e.description,i=e.uid,l=r.actionEntityStore?.entries[e.uid]?.action_entity??e.action_entity;if(!l){if(!o)return[`${s}// ${n}: Skipping - no description`];if(r.noAgent)return[`${s}// ${n}: ${I(o)}`,`${s}// DRAFT: ${I(o)} (requires agent - skipped in hook)`];let y=JSON.stringify(o),k=!!e.use_pure_vision;return[`${s}// ${n}: ${I(o)}`,`${s}// \u26A0 DRAFT: AI-resolved at runtime (~5-10s). Add a locator to make this <1s.`,`${s}page = agent.agentServices.validatePage(page);`,`${s}await agent.execute(page, ${y}, '${n}', ${k});`]}let c=e.locator?{...l,locator:e.locator}:l;o&&o!==c.action_description&&(c={...c,action_description:o});let u=c.action_data?.action_name||"",d=c.action_description||"",f=yo(u);if(!f)return[`${s}// ${n}: Unknown action: ${u}`];let g={imports:r.imports},h=f(c,n,g);if(r.noAgent){if(Jn(c))return[`${s}// ${n}: ${I(d)}`,`${s}// AI action: ${I(d)} (requires agent - skipped in hook)`];let y=To(c,u,s,n);return y||[`${s}// ${n}: ${I(d)}`,...h.map(k=>`${s}${k}`)]}if(Jn(c))return[`${s}// ${n}: ${I(d)}`,`${s}page = agent.agentServices.validatePage(page);`,...h.map(y=>`${s}${y}`)];let p=JSON.stringify(d),v=h.map(y=>`${s} ${y}`),w=mo(c),m=i?`'${i}'`:"undefined";return[`${s}// ${n}: ${I(d)}`,`${s}page = agent.agentServices.validatePage(page);`,`${s}await agent.step(page, async () => {`,...v,`${s}}, ${p}, '${n}', ${m}, ${w});`]}function So(e,t,n,r){let s=" ".repeat(t),o=[];e.description&&e.description.trim()&&o.push(`${s}// Step: ${I(e.description)}`);let i=X(e.statements,t,r,n);return o.push(...i),o}function _o(e,t,n,r){let s=" ".repeat(t),o=[];if(o.push(`${s}// ${n}: Conditional check`),e.condition.type==="JS_CODE")o.push(`${s}if (${e.condition.expression}) {`);else{o.push(`${s}// AI Condition: ${I(e.condition.expression)}`);let a=JSON.stringify(e.condition.expression);o.push(`${s}if (await agent.evaluate(page, ${a}, "${n}")) {`)}let i=X(e.then,t+1,r,`${n}.then`);if(o.push(...i),e.else&&e.else.length>0){o.push(`${s}} else {`);let a=X(e.else,t+1,r,`${n}.else`);o.push(...a)}return o.push(`${s}}`),o}function xo(e,t,n,r){let s=" ".repeat(t),o=[];o.push(`${s}// ${n}: Loop`);let i=e.timeout_ms??bt,a=i/1e3,l=e.timeout_ms?`While loop exceeded timeout of ${a}s`:`While loop exceeded default timeout of ${a}s`,c=`loop_${n.replace(/\./g,"_")}`;if(o.push(`${s}const ${c}_start = Date.now();`),o.push(`${s}const ${c}_timeout = ${i};`),o.push(`${s}const ${c}_check = () => {`),o.push(`${s} if (Date.now() - ${c}_start > ${c}_timeout) {`),o.push(`${s} throw new Error('${l}');`),o.push(`${s} }`),o.push(`${s} return true;`),o.push(`${s}};`),e.condition.type==="JS_CODE")o.push(`${s}while (${c}_check() && (${e.condition.expression})) {`);else{o.push(`${s}// AI Loop Condition: ${I(e.condition.expression)}`);let d=JSON.stringify(e.condition.expression);o.push(`${s}while (${c}_check() && await agent.evaluate(page, ${d}, "${n}")) {`)}let u=X(e.body,t+1,r,`${n}.body`);return o.push(...u),o.push(`${s}}`),o}function To(e,t,n,r){let s=e.action_description||"",o=e.action_data?.kwargs||{},i=o.timeout_ms??_t;switch(t){case"go_to_url":case"open_tab":{let a=o.url||"";return[`${n}// ${r}: ${I(s)}`,`${n}await page.goto(${JSON.stringify(a)}, { waitUntil: 'domcontentloaded' });`]}case"go_back":return[`${n}// ${r}: ${I(s)}`,`${n}await page.goBack();`];case"go_forward":return[`${n}// ${r}: ${I(s)}`,`${n}await page.goForward();`];case"input_text":{let a=o.text||"",l=Ke(e);return l?[`${n}// ${r}: ${I(s)}`,`${n}await ${l}.fill(${JSON.stringify(a)}, { timeout: ${i} });`]:null}case"select_dropdown_option":{let a=o.text||o.label||"",l=Ke(e);return l?[`${n}// ${r}: ${I(s)}`,`${n}await ${l}.selectOption({ label: ${JSON.stringify(a)} }, { timeout: ${i} });`]:null}default:return null}}function ko(e,t){let n=[],r=t?.version||"unknown";n.push(`// @generated by shiplightai v${r}`),n.push(...nr()),n.push(""),t?.use&&Object.keys(t.use).length>0&&(n.push(`test.use(${JSON.stringify(t.use,null,2)});`),n.push(""));let s=new Set,o={imports:s,actionEntityStore:t?.actionEntityStore};t?.beforeEach&&t.beforeEach.length>0&&(n.push(...Xn("beforeEach",t.beforeEach,o)),n.push(""));let i=t?.timeout||t?.skip!==void 0||t?.fail!==void 0||t?.only||t?.slow?{timeout:t.timeout,skip:t.skip,fail:t.fail,only:t.only,slow:t.slow}:void 0;if(t?.parameters&&t.parameters.length>0){let a=t?.testName||e.goal||"Generated test",l=vt(t?.tags);for(let c of t.parameters){let u=tr(e,c.values);n.push(...Ve(u,`${l}${oe(a)} [${oe(c.name)}]`,o,0,i)),n.push("")}}else{let a=t?.testName||e.goal||"Generated test",l=vt(t?.tags);n.push(...Ve(e,`${l}${oe(a)}`,o,0,i))}return t?.afterEach&&t.afterEach.length>0&&(n.push(""),n.push(...Xn("afterEach",t.afterEach,o))),rr(n,s),n.join(`
638
+ `}async function Bs(e){let{createServer:t}=await import("net");for(let n=e;n<e+20;n++)if(await new Promise(s=>{let o=t();o.once("error",()=>s(!1)),o.once("listening",()=>{o.close(()=>s(!0))}),o.listen(n,"127.0.0.1")}))return n;throw new Error(`No available port found in range ${e}-${e+19}`)}async function pt(e){let{yamlFilePath:t,configPath:n,tempSuffix:r="",headed:s}=e,o=q.dirname(n),i=await Bs(16174),a;if(!se.existsSync(t))throw new Error(`Please select a test file before starting the debug session. File not found: ${t}`);try{let y=Fs(se.readFileSync(t,"utf-8"));y?.use&&typeof y.use=="object"&&!Array.isArray(y.use)&&(a=y.use),y?.base_url&&!a?.baseURL&&(a={...a,baseURL:y.base_url}),y?.settings?.auto_dismiss_modal!==void 0&&(a={...a,autoDismissModal:!!y.settings.auto_dismiss_modal}),y?.settings?.browser_timezone!=null&&(a={...a,timezoneId:String(y.settings.browser_timezone)}),y?.settings?.browser_language!=null&&(a={...a,locale:String(y.settings.browser_language)}),y?.settings?.extra_http_headers!=null&&typeof y.settings.extra_http_headers=="object"&&(a={...a,extraHTTPHeaders:y.settings.extra_http_headers})}catch(y){console.error("[debugger] Could not parse YAML for `use` block:",y)}let l=q.dirname(q.resolve(t)),c=r?`-${r}`:"",u=q.join(l,`.__shiplight_debug__${c}.yaml.spec.ts`),d=Us(t,i,a,o);se.writeFileSync(u,d);let f=pn(u),g=["playwright","test",u,...s?["--headed"]:[]],h=js("npx",g,{stdio:["ignore","pipe","pipe"],shell:!0,cwd:o,env:{...process.env,PWDEBUG:"console",SHIPLIGHT_REGISTRY_URL:""}});h.stdout?.on("data",y=>{process.stderr.write(y)}),h.stderr?.on("data",y=>{process.stderr.write(y)});let p=()=>{h.killed||h.kill("SIGTERM")};process.on("SIGTERM",p),process.on("SIGINT",p),process.on("exit",p),h.on("close",y=>{process.removeListener("SIGTERM",p),process.removeListener("SIGINT",p),process.removeListener("exit",p),f(),y!==0&&y!==null&&console.error(`[debugger] Playwright process exited with code ${y}`)}),console.error("[debugger] Waiting for Playwright sandbox to start...");let v=["127.0.0.1","::1"];async function w(y){try{let k=y.includes(":")?`[${y}]`:y,P=await fetch(`http://${k}:${i}/api/test-flow`);if(P.ok){try{await P.text()}catch{}return!0}}catch{}return!1}let m=null;for(let y=0;y<180;y++){if(h.exitCode!==null)throw f(),new Error(`Playwright process exited with code ${h.exitCode} before sandbox was ready`);for(let k of v)if(await w(k)){m=k;break}if(m){console.error(`[debugger] Playwright sandbox ready on ${m}:${i}`);break}if(y===179)throw p(),f(),new Error("Timed out waiting for Playwright sandbox to start (180s)");await new Promise(k=>setTimeout(k,1e3))}if(!m)throw p(),f(),new Error("Sandbox poll finished without a reachable host");return{port:i,host:m,pid:h.pid??0,cleanup:async()=>{p(),f()}}}var ut=_(()=>{"use strict"});var dn=_(()=>{"use strict"});var hn=_(()=>{"use strict"});var fn=_(()=>{"use strict"});import{v4 as pa}from"uuid";var gn=_(()=>{"use strict"});import{z as b}from"zod";var mn,dt,yn,fe,wn,bn,vn,j,Sn,De,ht,ft=_(()=>{"use strict";mn=b.enum(["JS_CODE","AI_MODE"]),dt=b.object({type:mn,expression:b.string()}),yn=b.enum(["DRAFT","STEP","ACTION","IF_ELSE","WHILE_LOOP"]),fe=b.object({uid:b.string(),type:yn,comment:b.string().optional()}),wn=b.object({action_data:b.object({action_name:b.string(),kwargs:b.record(b.any()).optional(),args:b.array(b.any()).optional()}),action_description:b.string().optional(),url:b.string().optional(),xpath:b.string().nullable().optional(),locator:b.string().nullable().optional(),css_selector:b.string().nullable().optional(),unique_selector:b.string().nullable().optional(),element_index:b.number().nullable().optional(),frame_path:b.array(b.any()).optional(),artifacts:b.record(b.any()).optional(),feedback:b.string().optional(),original_browser_use_action:b.any().optional()}).passthrough(),bn=fe.extend({type:b.literal("DRAFT"),description:b.string()}),vn=fe.extend({type:b.literal("ACTION"),description:b.string(),action_entity:wn.optional(),locator:b.string().optional(),use_pure_vision:b.boolean().optional()}),j=b.lazy(()=>b.union([bn,vn,fe.extend({type:b.literal("STEP"),description:b.string().optional().default(""),statements:b.array(j),reference_id:b.number().optional(),template_path:b.string().optional(),template_params:b.record(b.string()).optional()}),fe.extend({type:b.literal("IF_ELSE"),description:b.string().optional(),condition:dt,then:b.array(j),else:b.array(j).optional()}),fe.extend({type:b.literal("WHILE_LOOP"),description:b.string().optional(),condition:dt,body:b.array(j),timeout_ms:b.number().optional()})])),Sn=b.object({name:b.string(),statements:b.array(j),teardown:b.array(j).optional(),skip:b.union([b.boolean(),b.string()]).optional(),timeout:b.number().optional(),fail:b.union([b.boolean(),b.string()]).optional(),only:b.boolean().optional(),slow:b.boolean().optional()}),De=b.object({tests:b.array(Sn).min(1),beforeAll:b.array(j).optional(),afterAll:b.array(j).optional(),beforeEach:b.array(j).optional(),afterEach:b.array(j).optional()}),ht=b.object({comment:b.string().optional(),version:b.string().optional(),goal:b.string().optional(),url:b.string().optional(),baseURL:b.string().optional(),final_feedback:b.string().optional(),completed:b.boolean().optional(),success:b.boolean().optional(),statements:b.array(j).optional(),teardown:b.array(j).optional(),last_modified_at:b.string().optional(),testGroup:De.optional()}).refine(e=>e.testGroup!==void 0?e.goal===void 0&&(e.statements===void 0||e.statements.length===0):e.goal!==void 0,{message:"TestFlow must have either goal/statements (single test) or testGroup (suite), not both"})});import{stringify as Hs,parse as kn,parseAllDocuments as ma,parseDocument as Ws,Document as Gs,isMap as me,isSeq as z}from"yaml";import{v4 as K}from"uuid";function je(e,t){let n={...t?.test_case_id!==void 0?{test_case_id:t.test_case_id}:{},...t?.name?{name:t.name}:{},goal:e.goal??"",url:e.url,base_url:e.baseURL,...t?.timeout!==void 0?{timeout:t.timeout}:{},...t?.settings&&Object.keys(t.settings).length>0?{settings:t.settings}:{},statements:(e.statements??[]).map(B)};return e.final_feedback&&(n.final_feedback=e.final_feedback),e.teardown&&e.teardown.length>0&&(n.teardown=e.teardown.map(B)),n}function ke(e,t){if(e.testGroup)return An(e,t);let n=je(e,t),r=new Gs(n);return e.comment&&(r.commentBefore=e.comment),_n(r,e.statements??[]),e.teardown&&_n(r,e.teardown,"teardown"),r.toString(Pn)}function _n(e,t,n="statements"){let r=e.contents;if(!r||!me(r))return;let s=r.get(n,!0);z(s)&&Te(s,t)}function Te(e,t){for(let n=0;n<Math.min(e.items.length,t.length);n++){let r=t[n],s=e.items[n];if(n>0&&(s.spaceBefore=!0),r.comment&&(n===0?e.commentBefore=r.comment:s.commentBefore=r.comment),me(s)){let o=s;if(r.type==="STEP"){let i=o.get("statements",!0);z(i)&&Te(i,r.statements)}else if(r.type==="IF_ELSE"){let i=o.get("THEN",!0);z(i)&&Te(i,r.then);let a=o.get("ELSE",!0);z(a)&&r.else&&Te(a,r.else)}else if(r.type==="WHILE_LOOP"){let i=o.get("DO",!0);z(i)&&Te(i,r.body)}}}}function An(e,t){let n=e.testGroup;if(!n)throw new Error("suiteToYaml requires a TestFlow with testGroup");let r={};t?.test_case_id!==void 0&&(r.test_case_id=t.test_case_id),t?.name&&(r.name=t.name),t?.tags&&t.tags.length>0&&(r.tags=t.tags),t?.use&&Object.keys(t.use).length>0&&(r.use=t.use),t?.settings&&Object.keys(t.settings).length>0&&(r.settings=t.settings);let s={};return e.baseURL&&(s.base_url=e.baseURL),n.beforeAll&&n.beforeAll.length>0&&(s.beforeAll=n.beforeAll.map(B)),n.beforeEach&&n.beforeEach.length>0&&(s.beforeEach=n.beforeEach.map(B)),n.afterEach&&n.afterEach.length>0&&(s.afterEach=n.afterEach.map(B)),n.afterAll&&n.afterAll.length>0&&(s.afterAll=n.afterAll.map(B)),s.tests=n.tests.map(o=>{let i={name:o.name};return o.skip!==void 0&&(i.skip=o.skip),o.timeout!==void 0&&(i.timeout=o.timeout),o.fail!==void 0&&(i.fail=o.fail),o.only!==void 0&&(i.only=o.only),o.slow!==void 0&&(i.slow=o.slow),i.statements=o.statements.map(B),o.teardown&&o.teardown.length>0&&(i.teardown=o.teardown.map(B)),i}),r.suite=s,Hs(r,Pn)}function B(e){switch(e.type){case"DRAFT":return Ks(e);case"ACTION":return zs(e);case"STEP":return Vs(e);case"IF_ELSE":return Ys(e);case"WHILE_LOOP":return Js(e)}}function Ks(e){return{intent:e.description}}function zs(e){let t=e.action_entity?.action_data?.action_name??e.action_entity?.action?.action_name,n=e.action_entity?.action_data?.kwargs??e.action_entity?.action?.kwargs;if(t==="verify"){let a=n?.statement;if(typeof a=="string"&&!e.action_entity?.locator&&!e.action_entity?.xpath){let l=n?.code;return typeof l=="string"?{VERIFY:a,js:l}:{VERIFY:a}}}if(t==="go_to_url"){let a=n?.url;if(typeof a=="string"&&!e.action_entity?.locator&&!e.action_entity?.xpath){let l={URL:a};return n?.new_tab===!0&&(l.new_tab=!0),typeof n?.timeout_seconds=="number"&&(l.timeout_seconds=n.timeout_seconds),l}}if(t==="js_action"){let a=n?.code;if(typeof a=="string"&&e.description)return{intent:e.description,js:a}}if(t==="ai_wait_until"){let a=n?.condition;if(typeof a=="string"){let l={WAIT_UNTIL:a};return typeof n?.timeout_seconds=="number"&&n.timeout_seconds!==60&&(l.timeout_seconds=n.timeout_seconds),l}}if(t==="wait"){let a=n?.seconds,c={WAIT:e.description||`Wait ${a}s`};return typeof a=="number"&&(c.seconds=a),c}if(t==="js_code"){let a=n?.code;if(typeof a=="string"&&!e.action_entity?.locator&&!e.action_entity?.xpath)return{CODE:a}}if(!e.action_entity)return{intent:e.description};let r=e.action_entity.action_data??e.action_entity.action;if(!r)return{intent:e.description};let s={intent:e.description,action:r.action_name},o=e.locator??e.action_entity.locator;o&&(s.locator=o);let i=e.action_entity.xpath;if(i&&(s.xpath=i),e.use_pure_vision&&(s.use_pure_vision=!0),r.kwargs&&Object.keys(r.kwargs).length>0)for(let[a,l]of Object.entries(r.kwargs))s[a]=l;return r.args&&r.args.length>0&&(s.args=r.args),s}function Vs(e){if(e.template_path){let n={template:e.template_path};return e.template_params&&Object.keys(e.template_params).length>0&&(n.params=e.template_params),n}let t={STEP:e.description,statements:e.statements.map(B)};return e.reference_id!==void 0&&(t.reference_id=e.reference_id),t}function Ys(e){let t={IF:En(e.condition),THEN:e.then.map(B)};return e.else&&e.else.length>0&&(t.ELSE=e.else.map(B)),t}function Js(e){let t={WHILE:En(e.condition),DO:e.body.map(B)};return e.timeout_ms!==void 0&&(t.timeout_ms=e.timeout_ms),t}function En(e){return e.type==="JS_CODE"?`js:${e.expression}`:e.expression}function Pe(e){try{let t=kn(e);if(!t||typeof t!="object")return{};let n={};return typeof t.test_case_id=="number"&&Number.isFinite(t.test_case_id)&&(n.test_case_id=t.test_case_id),typeof t.template_id=="number"&&Number.isFinite(t.template_id)&&(n.template_id=t.template_id),typeof t.name=="string"&&t.name.trim()&&(n.name=t.name.trim()),typeof t.timeout=="number"&&Number.isFinite(t.timeout)&&(n.timeout=t.timeout),t.settings&&typeof t.settings=="object"&&!Array.isArray(t.settings)&&(n.settings=t.settings),n}catch{return{}}}function gt(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(gt);let t=e,n=Object.keys(t);if(n.length===1){let s=n[0];if(s.startsWith("{ ")&&s.endsWith(" }")&&t[s]===null)return`{{${s.slice(2,-2)}}}`}let r={};for(let[s,o]of Object.entries(t))r[s]=gt(o);return r}function C(e){if(e.length>xn)throw new Error(`YAML input too large (${e.length} bytes, max ${xn})`);let t=gt(kn(e));if(!t||typeof t!="object")throw new Error("Invalid YAML: expected an object at root level");if(t.suite)return qs(t);let n={version:"1.3.0",goal:t.goal,url:t.url,baseURL:t.base_url,statements:H(t.statements??[])};t.final_feedback&&(n.final_feedback=t.final_feedback),t.teardown&&Array.isArray(t.teardown)&&(n.teardown=H(t.teardown));let r=ht.safeParse(n);if(!r.success)throw new Error(`Invalid TestFlow after YAML conversion: ${JSON.stringify(r.error.errors)}`);let s=r.data;return Fe(e,s),s}function qs(e){let t=e.suite;if(!t||typeof t!="object")throw new Error("Invalid suite: expected an object");let n=t.tests;if(!Array.isArray(n)||n.length===0)throw new Error('Suite must have a non-empty "tests" array');let s={tests:n.map(a=>{if(!a.name)throw new Error('Each test in a suite must have a "name" field');if(!Array.isArray(a.statements)||a.statements.length===0)throw new Error(`Suite test "${a.name}" must have a non-empty "statements" array`);let l={name:a.name,statements:H(a.statements)};return Array.isArray(a.teardown)&&a.teardown.length>0&&(l.teardown=H(a.teardown)),a.skip!==void 0&&(l.skip=a.skip),typeof a.timeout=="number"&&(l.timeout=a.timeout),a.fail!==void 0&&(l.fail=a.fail),a.only===!0&&(l.only=!0),a.slow===!0&&(l.slow=!0),l})};Array.isArray(t.beforeAll)&&t.beforeAll.length>0&&(s.beforeAll=H(t.beforeAll)),Array.isArray(t.afterAll)&&t.afterAll.length>0&&(s.afterAll=H(t.afterAll)),Array.isArray(t.beforeEach)&&t.beforeEach.length>0&&(s.beforeEach=H(t.beforeEach)),Array.isArray(t.afterEach)&&t.afterEach.length>0&&(s.afterEach=H(t.afterEach));let o=De.safeParse(s);if(!o.success)throw new Error(`Invalid TestGroup: ${JSON.stringify(o.error.errors)}`);return{version:"1.3.0",baseURL:t.base_url||void 0,testGroup:o.data}}function H(e){if(!Array.isArray(e))throw new Error("Expected an array of statements");return e.map(Xs)}function Xs(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 Zs(t);if("WHILE"in t)return Qs(t);if("STEP"in t)return eo(t);if("VERIFY"in t){let n=t.VERIFY,r={statement:typeof n=="string"?n:String(n)};return typeof t.js=="string"&&(r.code=t.js),{uid:K(),type:"ACTION",description:String(n),action_entity:{action_description:String(n),action_data:{action_name:"verify",kwargs:r}}}}if("URL"in t){let n=t.URL,r=t.new_tab===!0?!0:void 0,s=typeof t.timeout_seconds=="number"?t.timeout_seconds:void 0,o={url:typeof n=="string"?n:String(n)};return r&&(o.new_tab=!0),s!==void 0&&(o.timeout_seconds=s),{uid:K(),type:"ACTION",description:`Navigate to ${n}`,action_entity:{action_description:`Navigate to ${n}`,action_data:{action_name:"go_to_url",kwargs:o}}}}if("WAIT_UNTIL"in t){let n=t.WAIT_UNTIL,r=typeof t.timeout_seconds=="number"?t.timeout_seconds:60;return{uid:K(),type:"ACTION",description:`Wait until: ${n}`,action_entity:{action_description:`Wait until: ${n}`,action_data:{action_name:"ai_wait_until",kwargs:{condition:typeof n=="string"?n:String(n),timeout_seconds:r}}}}}if("WAIT"in t){let n=t.WAIT,r=typeof t.seconds=="number"?t.seconds:3;return{uid:K(),type:"ACTION",description:typeof n=="string"?n:`Wait ${r}s`,action_entity:{action_description:typeof n=="string"?n:`Wait ${r}s`,action_data:{action_name:"wait",kwargs:{seconds:r}}}}}if("CODE"in t){let n=t.CODE;if(n==null)throw new Error('CODE statement has no code. Use "CODE: |" followed by indented code on the next line.');return{uid:K(),type:"ACTION",description:"Code block",action_entity:{action_description:"Code block",action_data:{action_name:"js_code",kwargs:{code:typeof n=="string"?n:String(n)}}}}}if("js"in t&&("intent"in t||"desc"in t)&&!("VERIFY"in t)&&t.action!=="verify"){let n=t.js,r=typeof t.intent=="string"?t.intent:typeof t.desc=="string"?t.desc:"";return{uid:K(),type:"ACTION",description:r,action_entity:{action_description:r,action_data:{action_name:"js_action",kwargs:{code:typeof n=="string"?n:String(n)}}}}}if("call"in t&&typeof t.call=="string"){let{call:n,...r}=t;return Tn({...r,action:"function",functionName:n})}if("action"in t)return Tn(t);if("intent"in t&&typeof t.intent=="string"||"desc"in t&&typeof t.desc=="string")return{uid:K(),type:"DRAFT",description:typeof t.intent=="string"?t.intent:t.desc};throw new Error(`Cannot infer statement type from object: ${JSON.stringify(t)}`)}function $n(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 Zs(e){let t=$n(e.IF),n=e.THEN;if(!Array.isArray(n))throw new Error("IF_ELSE requires a THEN array");let r={uid:K(),type:"IF_ELSE",condition:t,then:H(n)};return"ELSE"in e&&Array.isArray(e.ELSE)&&(r.else=H(e.ELSE)),r}function Qs(e){let t=$n(e.WHILE),n=e.DO;if(!Array.isArray(n))throw new Error("WHILE_LOOP requires a DO array");let r={uid:K(),type:"WHILE_LOOP",condition:t,body:H(n)};return typeof e.timeout_ms=="number"&&(r.timeout_ms=e.timeout_ms),r}function eo(e){let t=typeof e.STEP=="string"?e.STEP:"";if(!Array.isArray(e.statements))throw new Error("STEP requires a statements array");let n={uid:K(),type:"STEP",description:t,statements:H(e.statements)};if(typeof e.reference_id=="number"&&(n.reference_id=e.reference_id),typeof e.template_path=="string"&&(n.template_path=e.template_path),e.template_params&&typeof e.template_params=="object"&&!Array.isArray(e.template_params)){let r=e.template_params,s={};for(let[o,i]of Object.entries(r))s[o]=String(i);n.template_params=s}return n}function Tn(e){let t=typeof e.action=="string"?e.action:String(e.action),n=typeof e.intent=="string"?e.intent:typeof e.desc=="string"?e.desc:"",r=typeof e.locator=="string"?e.locator:void 0,s=typeof e.xpath=="string"?e.xpath:void 0,o=typeof e.use_pure_vision=="boolean"?e.use_pure_vision:void 0,i={};for(let[c,u]of Object.entries(e))to.has(c)||(i[c]=u);t==="verify"&&typeof i.js=="string"&&(i.code=i.js,delete i.js);let a={action_description:n,action_data:{action_name:t,kwargs:Object.keys(i).length>0?i:{}}};r&&(a.locator=r),s&&(a.xpath=s);let l={uid:K(),type:"ACTION",description:n,action_entity:a};return o&&(l.use_pure_vision=!0),l}function Fe(e,t){let n;try{n=Ws(e)}catch{return}let r=n.contents;if(!r||!me(r))return;if(n.commentBefore)t.comment=n.commentBefore;else{let l=r.items?.[0];l?.key&&l.key.commentBefore&&(t.comment=l.key.commentBefore)}let s=r,o=s.get("statements",!0);z(o)&&t.statements&&ge(o,t.statements);let i=s.get("teardown",!0);z(i)&&t.teardown&&ge(i,t.teardown)}function ge(e,t){e.commentBefore&&t.length>0&&(t[0].comment=e.commentBefore);for(let n=0;n<Math.min(e.items.length,t.length);n++){let r=e.items[n];r.commentBefore&&!(n===0&&e.commentBefore)&&(t[n].comment=r.commentBefore);let s=t[n];if(s.type==="STEP"&&me(r)){let o=r.get("statements",!0);z(o)&&ge(o,s.statements)}else if(s.type==="IF_ELSE"&&me(r)){let o=r.get("THEN",!0);z(o)&&ge(o,s.then);let i=r.get("ELSE",!0);z(i)&&s.else&&ge(i,s.else)}else if(s.type==="WHILE_LOOP"&&me(r)){let o=r.get("DO",!0);z(o)&&ge(o,s.body)}}}var Pn,xn,to,Ue=_(()=>{"use strict";ft();Pn={lineWidth:120,defaultKeyType:"PLAIN",defaultStringType:"PLAIN"};xn=1024*1024;to=new Set(["action","intent","desc","locator","xpath","use_pure_vision"])});import{parse as Sa,stringify as _a}from"yaml";var Mn=_(()=>{"use strict";Ue()});var mt,Be,He=_(()=>{"use strict";mt=e=>{let t=[];switch(e.type){case"STEP":e.statements&&t.push({key:"statements",statements:e.statements});break;case"IF_ELSE":e.then&&t.push({key:"then",statements:e.then}),e.else&&t.push({key:"else",statements:e.else});break;case"WHILE_LOOP":e.body&&t.push({key:"body",statements:e.body});break}return t},Be=e=>{let t=[],n=r=>{for(let s of r){t.push(s);let o=mt(s);for(let i of o)n(i.statements)}};return n(e),t}});function Cn(e){let t=0,n=0;for(let r of e)if(r.type==="DRAFT")n++;else if(r.type==="ACTION"){let s=r.action_entity?.action_data?.action_name??"";Rn.has(s)||t++}return{action:t,draft:n}}function ro(e){try{return new Function(`return async function() { ${e} }`),null}catch(t){return t.message}}function Ln(e){try{return new Function(`return async function() { return (${e}) }`),null}catch(t){return t.message}}function so(e){let t=e.split(/\r?\n/).map(o=>o.trim()).filter(o=>o.length>0&&!o.startsWith("//")),n=t.length,r=t.join(`
639
+ `).match(/\bawait\b/g),s=r?r.length:0;return n<=In&&s<=On?null:`${n} non-blank line(s), ${s} await(s) \u2014 limits are ${In} lines and ${On} awaits. The js: field is a cache for one natural-language intent, not a place for multi-step logic. Break this into multiple statements \u2014 one VERIFY or intent+js per UI interaction or assertion \u2014 so each step is visible in the debugger and self-healable.`}function yt(e,t){let n=t?.coverageThreshold??no,r=[],s=[],o;try{o=C(e)}catch(f){return{valid:!1,errors:[`Invalid YAML: ${f.message}`],warnings:[],stats:{total:0,action:0,draft:0,coverage:0}}}o.goal||r.push('Missing required field: "goal"'),o.statements?.length||r.push('Missing required field: "statements"');let i=[...Be(o.statements??[]),...o.teardown?Be(o.teardown):[]],{action:a,draft:l}=Cn(i),c="Hint: in YAML double-quoted strings, backslashes are escape characters \u2014 use \\\\/ instead of \\/ for regex, or use single quotes.";for(let f of i){let g=f;if(g.reference_id!==void 0){let h=g.description||f.uid;r.push(`Unresolved cloud template reference on statement "${h}" (reference_id: ${g.reference_id}). Local YAML tests cannot use reference_id \u2014 inline the template statements or use the local "template:" key instead.`)}if(f.type==="ACTION"){let h=f,p=h.action_entity?.action_data?.action_name??"";if(p==="js_code"||p==="js_action"||p==="verify"||p==="ai_assert"){let v=h.action_entity?.action_data?.kwargs?.code;if(typeof v=="string"){let w=ro(v);if(w){let m=h.description||p;r.push(`Invalid JS in "${m}": ${w}. ${c}`)}else if(p==="verify"||p==="js_action"){let m=so(v);if(m){let y=h.description||p;r.push(`JS cache for "${y}" is too complex: ${m}`)}}}}}if(f.type==="IF_ELSE"){let h=f;if(h.condition.type==="JS_CODE"){let p=Ln(h.condition.expression);p&&r.push(`Invalid JS in IF condition "${h.condition.expression}": ${p}. ${c}`)}}if(f.type==="WHILE_LOOP"){let h=f;if(h.condition.type==="JS_CODE"){let p=Ln(h.condition.expression);p&&r.push(`Invalid JS in WHILE condition "${h.condition.expression}": ${p}. ${c}`)}}}let u=a+l,d=u>0?Math.round(a/u*100):0;return u>0&&d/100<n&&s.push(`Low action coverage: ${a}/${u} statements (${d}%) are enriched with action/js. ${l} draft statement(s) still need enrichment. Use MCP tools (act, get_locators) to convert drafts to actions.`),{valid:r.length===0,errors:r,warnings:s,stats:{total:u,action:a,draft:l,coverage:d}}}var no,In,On,Rn,Nn=_(()=>{"use strict";Ue();He();no=.5,In=5,On=3,Rn=new Set(["verify","ai_assert","done","go_to_url","ai_wait_until","wait","js_code"])});var We=_(()=>{"use strict"});var Dn=_(()=>{"use strict";We()});var jn,io,Fn,Un,Ae,ao,co,Bn=_(()=>{"use strict";jn=112,io=1080-jn,Fn={"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"}},Un={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"]},Ae=(e,t=!1)=>{let n=["chromium"];return t&&n.push("webkit"),Un[e].map(r=>Fn[r]).filter(r=>r.defaultBrowserType&&n.includes(r.defaultBrowserType))},ao={desktop:{label:"Desktop",type:"desktop",devices:Ae("desktop")},mobile:{label:"Mobile Web",type:"mobile",devices:Ae("mobile")}},co={desktop:{label:"Desktop",type:"desktop",devices:Ae("desktop",!0)},mobile:{label:"Mobile Web",type:"mobile",devices:Ae("mobile",!0)}}});var Hn=_(()=>{"use strict"});function wt(){return{version:"1.0",entries:{}}}var Wn=_(()=>{"use strict";He()});var V,bt,Gn=_(()=>{"use strict";V=(e=>(e.DRAFT="DRAFT",e.STEP="STEP",e.ACTION="ACTION",e.IF_ELSE="IF_ELSE",e.WHILE_LOOP="WHILE_LOOP",e))(V||{}),bt=18e4});var Kn=_(()=>{"use strict"});var zn=_(()=>{"use strict"});var Vn=_(()=>{"use strict"});var Yn=_(()=>{"use strict";We()});var ce=_(()=>{"use strict";dn();hn();fn();gn();Mn();Nn();Ue();ft();Dn();Bn();Hn();Wn();He();Gn();Kn();zn();Vn();Yn();We()});import{stringify as po}from"yaml";import{createHash as $o}from"crypto";import{parse as Mo,stringify as sr}from"yaml";import{readFileSync as Io,existsSync as Oo}from"fs";import{resolve as St,dirname as Lo}from"path";import{parse as Zn,stringify as Ro}from"yaml";import{readFileSync as Bo,writeFileSync as Ho,mkdirSync as Wo}from"fs";import{dirname as Go}from"path";function oe(e){return e.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}function I(e){return e.replace(/\r\n/g," ").replace(/\n/g," ").replace(/\r/g," ").trim()}function uo(e){let t=e.frame_path;return!t||t.length===0?"page":`page.frameLocator('${t[0]}')`}function ho(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 Ke(e){let t=uo(e),n=e.locator;if(typeof n=="string"&&n.trim())return n=n.trim(),n.endsWith("first()")?`${t}.${n}`:`${t}.${n}.first()`;let r=ho(e);if(r){let s=JSON.stringify(r);return`${t}.locator(${s}).first()`}return null}function Jn(e){let t=e.action_data?.action_name;return!t||(t==="verify"||t==="ai_assert"||t==="assert")&&e.action_data?.kwargs?.code?!1:fo.includes(t)}function mo(e){let t=e.action_data?.action_name;return!t||(t==="verify"||t==="ai_assert"||t==="assert")&&e.action_data?.kwargs?.code?!1:!go.includes(t)}function S(e,t){R.set(e,t)}function yo(e){return R.get(e)}function ue(e,t,n=[]){let r=[...n];return t.locator?r.push(`locator: ${JSON.stringify(t.locator)}`):t.xpath&&r.push(`xpath: ${JSON.stringify(t.xpath)}`),t.frame_path&&t.frame_path.length>0&&r.push(`frame_path: ${JSON.stringify(t.frame_path)}`),r.length===0?[`await agent.execAction("${e}", page, {});`]:[`await agent.execAction("${e}", page, {`,...r.map(s=>` ${s},`),"});"]}function qn(e){let t=e.functionName;if(!t)return null;let n=Array.isArray(e.args)?e.args.map(String):[];if(n.length===0)return`await ${t}()`;let r=["page","testContext","request","agent"],s=["undefined","null","true","false"],o=n.map(i=>r.includes(i)||s.includes(i)||/^-?\d+(\.\d+)?$/.test(i)?i:i.startsWith("$")?`agent.agentServices.readVariable('${i.substring(1)}')`:`"${i}"`);return`await ${t}(${o.join(", ")})`}function X(e,t,n,r="main"){let s=[];for(let o=0;o<e.length;o++){let i=e[o],a=`${r}.${o}`,l=wo(i,t,a,n);l.length>0&&(s.push(...l),o<e.length-1&&s.push(""))}return s}function wo(e,t,n,r){let s=" ".repeat(t);switch(e.type){case"DRAFT":return bo(e,t,n,r);case"ACTION":return vo(e,t,n,r);case"STEP":return So(e,t,n,r);case"IF_ELSE":return _o(e,t,n,r);case"WHILE_LOOP":return xo(e,t,n,r);default:return[`${s}// Unknown statement type: ${e.type}`]}}function bo(e,t,n,r){let s=" ".repeat(t),o=e.description?.trim()||"";if(!o)return[`${s}// ${n}: Skipping - no description`];if(r.noAgent)return[`${s}// ${n}: ${I(o)}`,`${s}// DRAFT: ${I(o)} (requires agent - skipped in hook)`];let i=JSON.stringify(o);return[`${s}// ${n}: ${I(o)}`,`${s}// \u26A0 DRAFT: AI-resolved at runtime (~5-10s). Add a locator to make this <1s.`,`${s}page = agent.agentServices.validatePage(page);`,`${s}await agent.run(page, ${i}, '${n}');`]}function vo(e,t,n,r){let s=" ".repeat(t),o=e.description,i=e.uid,l=r.actionEntityStore?.entries[e.uid]?.action_entity??e.action_entity;if(!l){if(!o)return[`${s}// ${n}: Skipping - no description`];if(r.noAgent)return[`${s}// ${n}: ${I(o)}`,`${s}// DRAFT: ${I(o)} (requires agent - skipped in hook)`];let y=JSON.stringify(o),k=!!e.use_pure_vision;return[`${s}// ${n}: ${I(o)}`,`${s}// \u26A0 DRAFT: AI-resolved at runtime (~5-10s). Add a locator to make this <1s.`,`${s}page = agent.agentServices.validatePage(page);`,`${s}await agent.execute(page, ${y}, '${n}', ${k});`]}let c=e.locator?{...l,locator:e.locator}:l;o&&o!==c.action_description&&(c={...c,action_description:o});let u=c.action_data?.action_name||"",d=c.action_description||"",f=yo(u);if(!f)return[`${s}// ${n}: Unknown action: ${u}`];let g={imports:r.imports},h=f(c,n,g);if(r.noAgent){if(Jn(c))return[`${s}// ${n}: ${I(d)}`,`${s}// AI action: ${I(d)} (requires agent - skipped in hook)`];let y=To(c,u,s,n);return y||[`${s}// ${n}: ${I(d)}`,...h.map(k=>`${s}${k}`)]}if(Jn(c))return[`${s}// ${n}: ${I(d)}`,`${s}page = agent.agentServices.validatePage(page);`,...h.map(y=>`${s}${y}`)];let p=JSON.stringify(d),v=h.map(y=>`${s} ${y}`),w=mo(c),m=i?`'${i}'`:"undefined";return[`${s}// ${n}: ${I(d)}`,`${s}page = agent.agentServices.validatePage(page);`,`${s}await agent.step(page, async () => {`,...v,`${s}}, ${p}, '${n}', ${m}, ${w});`]}function So(e,t,n,r){let s=" ".repeat(t),o=[];e.description&&e.description.trim()&&o.push(`${s}// Step: ${I(e.description)}`);let i=X(e.statements,t,r,n);return o.push(...i),o}function _o(e,t,n,r){let s=" ".repeat(t),o=[];if(o.push(`${s}// ${n}: Conditional check`),e.condition.type==="JS_CODE")o.push(`${s}if (${e.condition.expression}) {`);else{o.push(`${s}// AI Condition: ${I(e.condition.expression)}`);let a=JSON.stringify(e.condition.expression);o.push(`${s}if (await agent.evaluate(page, ${a}, "${n}")) {`)}let i=X(e.then,t+1,r,`${n}.then`);if(o.push(...i),e.else&&e.else.length>0){o.push(`${s}} else {`);let a=X(e.else,t+1,r,`${n}.else`);o.push(...a)}return o.push(`${s}}`),o}function xo(e,t,n,r){let s=" ".repeat(t),o=[];o.push(`${s}// ${n}: Loop`);let i=e.timeout_ms??bt,a=i/1e3,l=e.timeout_ms?`While loop exceeded timeout of ${a}s`:`While loop exceeded default timeout of ${a}s`,c=`loop_${n.replace(/\./g,"_")}`;if(o.push(`${s}const ${c}_start = Date.now();`),o.push(`${s}const ${c}_timeout = ${i};`),o.push(`${s}const ${c}_check = () => {`),o.push(`${s} if (Date.now() - ${c}_start > ${c}_timeout) {`),o.push(`${s} throw new Error('${l}');`),o.push(`${s} }`),o.push(`${s} return true;`),o.push(`${s}};`),e.condition.type==="JS_CODE")o.push(`${s}while (${c}_check() && (${e.condition.expression})) {`);else{o.push(`${s}// AI Loop Condition: ${I(e.condition.expression)}`);let d=JSON.stringify(e.condition.expression);o.push(`${s}while (${c}_check() && await agent.evaluate(page, ${d}, "${n}")) {`)}let u=X(e.body,t+1,r,`${n}.body`);return o.push(...u),o.push(`${s}}`),o}function To(e,t,n,r){let s=e.action_description||"",o=e.action_data?.kwargs||{},i=o.timeout_ms??_t;switch(t){case"go_to_url":case"open_tab":{let a=o.url||"";return[`${n}// ${r}: ${I(s)}`,`${n}await page.goto(${JSON.stringify(a)}, { waitUntil: 'domcontentloaded' });`]}case"go_back":return[`${n}// ${r}: ${I(s)}`,`${n}await page.goBack();`];case"go_forward":return[`${n}// ${r}: ${I(s)}`,`${n}await page.goForward();`];case"input_text":{let a=o.text||"",l=Ke(e);return l?[`${n}// ${r}: ${I(s)}`,`${n}await ${l}.fill(${JSON.stringify(a)}, { timeout: ${i} });`]:null}case"select_dropdown_option":{let a=o.text||o.label||"",l=Ke(e);return l?[`${n}// ${r}: ${I(s)}`,`${n}await ${l}.selectOption({ label: ${JSON.stringify(a)} }, { timeout: ${i} });`]:null}default:return null}}function ko(e,t){let n=[],r=t?.version||"unknown";n.push(`// @generated by shiplightai v${r}`),n.push(...nr()),n.push(""),t?.use&&Object.keys(t.use).length>0&&(n.push(`test.use(${JSON.stringify(t.use,null,2)});`),n.push(""));let s=new Set,o={imports:s,actionEntityStore:t?.actionEntityStore};t?.beforeEach&&t.beforeEach.length>0&&(n.push(...Xn("beforeEach",t.beforeEach,o)),n.push(""));let i=t?.timeout||t?.skip!==void 0||t?.fail!==void 0||t?.only||t?.slow?{timeout:t.timeout,skip:t.skip,fail:t.fail,only:t.only,slow:t.slow}:void 0;if(t?.parameters&&t.parameters.length>0){let a=t?.testName||e.goal||"Generated test",l=vt(t?.tags);for(let c of t.parameters){let u=tr(e,c.values);n.push(...Ve(u,`${l}${oe(a)} [${oe(c.name)}]`,o,0,i)),n.push("")}}else{let a=t?.testName||e.goal||"Generated test",l=vt(t?.tags);n.push(...Ve(e,`${l}${oe(a)}`,o,0,i))}return t?.afterEach&&t.afterEach.length>0&&(n.push(""),n.push(...Xn("afterEach",t.afterEach,o))),rr(n,s),n.join(`
639
640
  `)}function Po(e,t){let n=[],r=t?.version||"unknown";n.push(`// @generated by shiplightai v${r}`),n.push(...nr()),n.push(""),t?.use&&Object.keys(t.use).length>0&&(n.push(`test.use(${JSON.stringify(t.use,null,2)});`),n.push(""));let s=new Set,o={imports:s,actionEntityStore:t?.actionEntityStore},i=t?.testName||"Test Suite",a=vt(t?.tags);n.push(`test.describe.serial('${a}${oe(i)}', () => {`),e.beforeAll&&e.beforeAll.length>0&&(n.push(...Ge("beforeAll",e.beforeAll,o,1)),n.push("")),e.beforeEach&&e.beforeEach.length>0&&(n.push(...Ge("beforeEach",e.beforeEach,o,1)),n.push(""));for(let c=0;c<e.tests.length;c++){let u=e.tests[c],d=u.timeout||u.skip!==void 0||u.fail!==void 0||u.only||u.slow?{timeout:u.timeout,skip:u.skip,fail:u.fail,only:u.only,slow:u.slow}:void 0;if(u.parameters&&u.parameters.length>0)for(let f of u.parameters){let g=tr(u.testFlow,f.values);n.push(...Ve(g,`${oe(u.name)} [${oe(f.name)}]`,o,1,d)),n.push("")}else n.push(...Ve(u.testFlow,oe(u.name),o,1,d)),(c<e.tests.length-1||e.afterEach||e.afterAll)&&n.push("")}return e.afterEach&&e.afterEach.length>0&&(n.push(...Ge("afterEach",e.afterEach,o,1)),n.push("")),e.afterAll&&e.afterAll.length>0&&n.push(...Ge("afterAll",e.afterAll,o,1)),n.push("});"),rr(n,s),n.join(`
640
641
  `)}function vt(e){return e&&e.length>0?e.map(t=>`@${t}`).join(" ")+" ":""}function ze(e){let t=new Set;function n(r){for(let s of r)switch(s.type){case V.ACTION:{let i=s.action_entity?.action_data?.kwargs;if(i?.args&&Array.isArray(i.args))for(let a of i.args)typeof a=="string"&&Ao.includes(a)&&t.add(a);break}case V.STEP:n(s.statements);break;case V.IF_ELSE:{let o=s;n(o.then),o.else&&n(o.else);break}case V.WHILE_LOOP:n(s.body);break}}return n(e),t}function Eo(e){let t=ze(e.statements??[]);if(e.teardown)for(let n of ze(e.teardown))t.add(n);return t}function xt(e){return`{ ${["page","agent",...Array.from(e).sort()].join(", ")} }`}function Ve(e,t,n,r=0,s){let o=" ".repeat(r),i=[],a=Eo(e),l=xt(a),c=s?.only?"test.only":"test";i.push(`${o}${c}('${t}', async (${l}) => {`),s?.skip===!0?i.push(`${o} test.skip();`):typeof s?.skip=="string"&&i.push(`${o} test.skip(true, '${oe(s.skip)}');`),s?.fail===!0?i.push(`${o} test.fail();`):typeof s?.fail=="string"&&i.push(`${o} test.fail(true, '${oe(s.fail)}');`),s?.slow&&i.push(`${o} test.slow();`),s?.timeout&&i.push(`${o} test.setTimeout(${s.timeout});`);let u=e.teardown&&e.teardown.length>0,d=r+1;if(u){if(i.push(`${o} try {`),e.statements&&e.statements.length>0){i.push(`${o} // Test steps`);let g=X(e.statements,d+1,n);i.push(...g)}i.push(`${o} } finally {`),i.push(`${o} // Teardown`);let f=X(e.teardown,d+1,n,"teardown");i.push(...f),i.push(`${o} }`)}else if(e.statements&&e.statements.length>0){i.push(`${o} // Test steps`);let f=X(e.statements,d,n);i.push(...f)}return i.push(`${o}});`),i}function Xn(e,t,n){let r=[],s=er(t),o=ze(s),i=xt(o);return r.push(`test.${e}(async (${i}) => {`),r.push(...X(s,1,n,e)),r.push("});"),r}function Ge(e,t,n,r){let s=" ".repeat(r),o=[],i=er(t);if(e==="beforeAll"||e==="afterAll"){let l={...n,noAgent:!0};o.push(`${s}test.${e}(async ({ browser }, workerInfo) => {`),o.push(`${s} const page = await browser.newPage({ baseURL: workerInfo.project.use.baseURL });`),o.push(...X(i,r+1,l,e)),o.push(`${s} await page.close();`),o.push(`${s}});`)}else{let l=ze(i),c=xt(l);o.push(`${s}test.${e}(async (${c}) => {`),o.push(...X(i,r+1,n,e)),o.push(`${s}});`)}return o}function er(e){let n=po({goal:"_hook",statements:e});return C(n).statements??[]}function tr(e,t){let n=ke(e);for(let[r,s]of Object.entries(t))n=n.split(`<<${r}>>`).join(String(s));return C(n)}function nr(){return["import { test, expect } from 'shiplightai/fixture';"]}function rr(e,t){if(t.size>0){let n=0;for(let s=0;s<e.length;s++)e[s].startsWith("import ")&&(n=s+1);let r=Array.from(t);e.splice(n,0,...r)}}function or(e,t,n){let r={expandingPaths:new Set([St(t)]),depth:0,referencedPaths:new Set,basePath:n},s={...e};Array.isArray(s.statements)&&(s.statements=le(s.statements,t,r)),Array.isArray(s.teardown)&&(s.teardown=le(s.teardown,t,r));for(let o of["beforeAll","afterAll","beforeEach","afterEach"])Array.isArray(s[o])&&(s[o]=le(s[o],t,r));return{doc:s,referencedTemplatePaths:Array.from(r.referencedPaths)}}function le(e,t,n){let r=[];for(let s of e)if(Co(s)){let o=No(s,t,n);r.push(o)}else r.push(Do(s,t,n));return r}function Co(e){return typeof e=="object"&&e!==null&&typeof e.template=="string"}function No(e,t,n){if(n.depth>=Qn)throw new Error(`Template expansion exceeded maximum depth of ${Qn}. Check for deeply nested or circular template references.`);let r=St(Lo(t),e.template),s=!Oo(r)&&n.basePath?St(n.basePath,e.template):r;if(n.expandingPaths.has(s))throw new Error(`Circular template reference detected: ${s} is already being expanded. Stack: ${Array.from(n.expandingPaths).join(" \u2192 ")} \u2192 ${s}`);n.referencedPaths.add(s);let o;try{o=Io(s,"utf-8")}catch(h){throw new Error(`Failed to read template file: ${s} (referenced from ${t}): ${h.message}`)}let i=Zn(o);if(!i||typeof i!="object")throw new Error(`Invalid template file: ${s} \u2014 expected a YAML object`);let a=i.params||[],l=e.params||{};for(let h of a)if(!(h in l))throw new Error(`Template ${e.template} requires param "${h}" but it was not provided. Required params: [${a.join(", ")}]`);let c=i.statements;if(!Array.isArray(c))throw new Error(`Template ${e.template} must have a "statements" array`);if(Object.keys(l).length>0){let p=Ro(c);for(let[v,w]of Object.entries(l))p=p.split(`<<${v}>>`).join(String(w));c=Zn(p)}let u={expandingPaths:new Set([...n.expandingPaths,s]),depth:n.depth+1,referencedPaths:n.referencedPaths},d=le(c,s,u),g={STEP:i.name||e.template.replace(/\.yaml$/,"").split("/").pop()||e.template,template_path:e.template,statements:d};return Object.keys(l).length>0&&(g.template_params=l),g}function Do(e,t,n){if(typeof e!="object"||e===null)return e;let r={...e};return Array.isArray(r.statements)&&(r.statements=le(r.statements,t,n)),Array.isArray(r.THEN)&&(r.THEN=le(r.THEN,t,n)),Array.isArray(r.ELSE)&&(r.ELSE=le(r.ELSE,t,n)),Array.isArray(r.DO)&&(r.DO=le(r.DO,t,n)),r}function kt(e,t,n){let r=Mo(e),s=r?.name,o=r?.tags,i=r?.use;if(r&&(r.name!==void 0||r.tags!==void 0||r.use!==void 0)&&(delete r.name,delete r.tags,delete r.use),r?.suite){if(r.goal||r.statements)throw new Tt('YAML file cannot have both "suite" and top-level "goal"/"statements". Use either suite format or single-test format.');return Fo(r,s,o,i,t,n)}return jo(r,s,o,i,t,n)}function jo(e,t,n,r,s,o){let i=e?.beforeEach,a=e?.afterEach,l=ir(e?.parameters),c=e?.timeout,u=e?.skip,d=e?.fail,f=e?.only,g=e?.slow,h=e?.settings,p=r;if(h){let y={};h.auto_dismiss_modal!==void 0&&(y.autoDismissModal=!!h.auto_dismiss_modal),h.browser_timezone!==void 0&&h.browser_timezone!==null&&(y.timezoneId=String(h.browser_timezone)),h.browser_language!==void 0&&h.browser_language!==null&&(y.locale=String(h.browser_language)),h.extra_http_headers!==void 0&&h.extra_http_headers!==null&&typeof h.extra_http_headers=="object"&&(y.extraHTTPHeaders=h.extra_http_headers),Object.keys(y).length>0&&(p={...p,...y})}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,delete e.settings),e?.url)throw new Tt(`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 v=[];if(s&&e&&typeof e=="object"){let y=or(e,s,o);e=y.doc,v=y.referencedTemplatePaths}let w=sr(e),m=C(w);return s&&(ye(m.statements??[],s,"main"),m.teardown&&ye(m.teardown,s,"teardown")),{testFlow:m,name:t,tags:n,use:p,beforeEach:i,afterEach:a,parameters:l,timeout:c,skip:u,fail:d,only:f,slow:g,referencedTemplatePaths:v}}function Fo(e,t,n,r,s,o){let i=e.suite;if(!Array.isArray(i.tests)||i.tests.length===0)throw new Error('Suite must have a non-empty "tests" array.');let a=i.beforeAll,l=i.afterAll,c=i.beforeEach,u=i.afterEach,d=[],f=i.tests.map(p=>{if(!p.name)throw new Error('Each test in a suite must have a "name" field.');if(!Array.isArray(p.statements)||p.statements.length===0)throw new Error(`Suite test "${p.name}" must have a non-empty "statements" array.`);let v={goal:p.name,statements:p.statements};p.teardown&&(v.teardown=p.teardown);let w=[],m=v;if(s&&typeof v=="object"){let E=or(v,s,o);m=E.doc,w=E.referencedTemplatePaths,d.push(...w)}let y=sr(m),k=C(y),P=ir(p.parameters);return{testFlow:k,name:p.name,tags:Array.isArray(p.tags)?p.tags:void 0,parameters:P,timeout:p.timeout,skip:p.skip,fail:p.fail,only:p.only,slow:p.slow}}),g=i.base_url,h=g?{...r,baseURL:g}:r;return{suite:{beforeAll:a,afterAll:l,beforeEach:c,afterEach:u,tests:f},name:t,tags:n,use:h,referencedTemplatePaths:d}}function ir(e){if(!(!Array.isArray(e)||e.length===0))return e.map((t,n)=>{if(!t.name)throw new Error(`Parameter set at index ${n} 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 ye(e,t,n){for(let r=0;r<e.length;r++){let s=e[r],o=`${n}.${r}`,i=s.description||"";if(s.uid=Uo(t,o,i),s.type===V.STEP)ye(s.statements,t,o);else if(s.type===V.IF_ELSE){let a=s;ye(a.then,t,`${o}.then`),a.else&&ye(a.else,t,`${o}.else`)}else s.type===V.WHILE_LOOP&&ye(s.body,t,`${o}.body`)}}function Uo(e,t,n){let r=$o("sha256").update(`${e}:${t}:${n}`).digest("hex");return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20,32)}`}function ar(e,t){let n;try{n=Bo(e,"utf-8")}catch(r){return{valid:!1,errors:[`Failed to read file: ${r.message}`],warnings:[]}}return Ko(n,e,t)}function Ko(e,t,n){let r=/\btemplate:\s/.test(e),s=/^suite:/m.test(e),o=r||s?null:yt(e);if(o&&!o.valid)return{valid:!1,errors:o.errors,warnings:[],stats:o.stats};let i,a,l=[];try{let c=n?.parsed??kt(e,t);l=c.referencedTemplatePaths;let u={version:n?.version,actionEntityStore:n?.actionEntityStore},d=c.testFlow?.baseURL?{...c.use,baseURL:c.testFlow.baseURL}:c.use;c.suite?i=Po(c.suite,{...u,testName:c.name,tags:c.tags,use:c.use}):i=ko(c.testFlow,{...u,testName:c.name,tags:c.tags,use:d,beforeEach:c.beforeEach,afterEach:c.afterEach,parameters:c.parameters,timeout:c.timeout,skip:c.skip,fail:c.fail,only:c.only,slow:c.slow});let f=i.split(`
641
642
  `).filter(g=>!g.startsWith("import ")).join(`
@@ -1581,9 +1582,9 @@ Merged ${l.length} tests from ${u} shards into: ${f}`),await Kr(d,r),n&&Hi(l),t)
1581
1582
  `;for(let l of a)i+=`- ${l}
1582
1583
  `;i+=`
1583
1584
  </details>
1584
- `}return i}function Hi(e){let t=process.env.GITHUB_STEP_SUMMARY;if(!t){console.warn("Warning: $GITHUB_STEP_SUMMARY not set, skipping GitHub summary.");return}$.appendFileSync(t,zr(e)),console.log("GitHub step summary written.")}var Yr=_(()=>{"use strict";jr();Hr();Le()});var Jr,qr=_(()=>{"use strict";Jr="0.1.64"});var Xr={};te(Xr,{runTranspile:()=>Gi});import*as rt from"path";import{glob as Wi}from"glob";async function Gi(e){(e.includes("--help")||e.includes("-h"))&&(console.log("Usage: shiplight transpile [glob]"),console.log(""),console.log("Transpiles YAML test files to Playwright spec files (.yaml.spec.ts)."),console.log("Validates syntax and reports action coverage warnings."),console.log("Default glob: **/*.test.yaml"),console.log(""),console.log("Examples:"),console.log(" shiplight transpile # transpile all YAML tests"),console.log(' shiplight transpile "tests/**/*.test.yaml" # transpile specific directory'),console.log(" shiplight transpile tests/login.test.yaml # transpile a single file"),process.exit(0));let t=e[0]||"**/*.test.yaml",n=process.cwd(),r=await Wi(t,{cwd:n,ignore:["node_modules/**","*.yaml.spec.ts"]});r.length===0&&(console.log(`No files matched: ${t}`),process.exit(0));let s=0,o=0,i=0;for(let a of r.sort()){let l=rt.resolve(n,a),c=ar(l,{version:Jr});if(!c.valid){s++,console.log(`
1585
+ `}return i}function Hi(e){let t=process.env.GITHUB_STEP_SUMMARY;if(!t){console.warn("Warning: $GITHUB_STEP_SUMMARY not set, skipping GitHub summary.");return}$.appendFileSync(t,zr(e)),console.log("GitHub step summary written.")}var Yr=_(()=>{"use strict";jr();Hr();Le()});var Jr,qr=_(()=>{"use strict";Jr="0.1.65"});var Xr={};te(Xr,{runTranspile:()=>Gi});import*as rt from"path";import{glob as Wi}from"glob";async function Gi(e){(e.includes("--help")||e.includes("-h"))&&(console.log("Usage: shiplight transpile [glob]"),console.log(""),console.log("Transpiles YAML test files to Playwright spec files (.yaml.spec.ts)."),console.log("Validates syntax and reports action coverage warnings."),console.log("Default glob: **/*.test.yaml"),console.log(""),console.log("Examples:"),console.log(" shiplight transpile # transpile all YAML tests"),console.log(' shiplight transpile "tests/**/*.test.yaml" # transpile specific directory'),console.log(" shiplight transpile tests/login.test.yaml # transpile a single file"),process.exit(0));let t=e[0]||"**/*.test.yaml",n=process.cwd(),r=await Wi(t,{cwd:n,ignore:["node_modules/**","*.yaml.spec.ts"]});r.length===0&&(console.log(`No files matched: ${t}`),process.exit(0));let s=0,o=0,i=0;for(let a of r.sort()){let l=rt.resolve(n,a),c=ar(l,{version:Jr});if(!c.valid){s++,console.log(`
1585
1586
  \u2717 ${a}`);for(let d of c.errors)console.log(` ERROR: ${d}`);continue}i++;let u=rt.basename(c.specFile);if(c.warnings.length>0){o++,console.log(`\u26A0 ${a} \u2192 ${u}`);for(let d of c.warnings)console.log(` WARNING: ${d}`)}else console.log(`\u2713 ${a} \u2192 ${u}`)}console.log(`
1586
- ${r.length} file(s): ${i} transpiled, ${s} error(s), ${o} warning(s)`),process.exit(s>0?1:0)}var Zr=_(()=>{"use strict";Pt();qr()});var ts={};te(ts,{runInspect:()=>Ki});import*as st from"fs";import*as Qr from"path";async function Ki(e){(e.includes("--help")||e.includes("-h")||e.length===0)&&(console.log("Usage: shiplight inspect <file.test.yaml> [options]"),console.log(""),console.log("Parse a YAML test file and output the resulting TestFlow JSON."),console.log("Useful for verifying YAML \u2192 JSON conversion."),console.log(""),console.log("Options:"),console.log(" --pretty Pretty-print JSON (default)"),console.log(" --compact Compact JSON output"),console.log(" --stats Show statement statistics only"),console.log(""),console.log("Examples:"),console.log(" shiplight inspect tests/login.test.yaml"),console.log(" shiplight inspect tests/suite.test.yaml --stats"),console.log(" shiplight inspect tests/login.test.yaml --compact | jq ."),process.exit(e.length===0?1:0));let t=e.includes("--compact"),n=e.includes("--stats"),r=e.find(i=>!i.startsWith("--"));r||(console.error("Error: no file specified"),process.exit(1));let s=Qr.resolve(process.cwd(),r);st.existsSync(s)||(console.error(`Error: file not found: ${s}`),process.exit(1));let o=st.readFileSync(s,"utf-8");try{let i=Pe(o),a=C(o);if(n)zi(a,i);else{let l={...i.test_case_id!==void 0?{test_case_id:i.test_case_id}:{},...i.name?{name:i.name}:{},testFlow:a};console.log(JSON.stringify(l,null,t?0:2))}}catch(i){console.error(`Error parsing ${r}: ${i.message}`),process.exit(1)}}function zi(e,t){if(console.log(`File: ${t.name||"(unnamed)"}`),t.test_case_id!==void 0&&console.log(`Cloud ID: ${t.test_case_id}`),console.log(`Version: ${e.version||"unknown"}`),e.testGroup){let n=e.testGroup;console.log("Type: suite (testGroup)"),console.log(`Tests: ${n.tests.length}`);for(let r of n.tests){let s=r.skip?` [SKIP${typeof r.skip=="string"?`: ${r.skip}`:""}]`:"";console.log(` - ${r.name}: ${r.statements.length} statements${r.teardown?`, ${r.teardown.length} teardown`:""}${s}`)}n.beforeAll?.length&&console.log(`Hooks: beforeAll (${n.beforeAll.length})`),n.afterAll?.length&&console.log(`Hooks: afterAll (${n.afterAll.length})`),n.beforeEach?.length&&console.log(`Hooks: beforeEach (${n.beforeEach.length})`),n.afterEach?.length&&console.log(`Hooks: afterEach (${n.afterEach.length})`)}else{console.log("Type: single test"),console.log(`Goal: ${e.goal}`),e.url&&console.log(`URL: ${e.url}`),e.baseURL&&console.log(`Base URL: ${e.baseURL}`),console.log(`Statements: ${e.statements?.length??0}`),e.teardown?.length&&console.log(`Teardown: ${e.teardown.length}`);let n=es(e.statements??[]);console.log(` DRAFT: ${n.drafts}, ACTION: ${n.actions}, STEP: ${n.steps}`)}}function es(e){let t={drafts:0,actions:0,steps:0};for(let n of e)if(n.type==="DRAFT")t.drafts++;else if(n.type==="ACTION")t.actions++;else if(n.type==="STEP"){t.steps++;let r=es(n.statements??[]);t.drafts+=r.drafts,t.actions+=r.actions,t.steps+=r.steps}return t}var ns=_(()=>{"use strict";ce()});var rs=ls((Vp,Vi)=>{Vi.exports={name:"shiplightai",version:"0.1.64",type:"module",description:"Shiplight CLI for running and debugging .test.yaml files",main:"dist/index.js",types:"dist/index.d.ts",bin:{shiplight:"dist/cli.js"},exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/cjs/index.cjs",default:"./dist/index.js"},"./fixture":{types:"./dist/fixture.d.ts",import:"./dist/fixture.js",require:"./dist/cjs/fixture.cjs",default:"./dist/fixture.js"},"./debugger-pw":{types:"./dist/debugger-pw.d.ts",import:"./dist/debugger-pw.js",require:"./dist/cjs/debugger-pw.cjs",default:"./dist/debugger-pw.js"},"./debugger-manager":{types:"./dist/debugger-manager.d.ts",import:"./dist/debugger-manager.js",require:"./dist/cjs/debugger-manager.cjs",default:"./dist/debugger-manager.js"},"./debugger-server":{types:"./dist/debugger-server.d.ts",import:"./dist/debugger-server.js",require:"./dist/cjs/debugger-server.cjs",default:"./dist/debugger-server.js"},"./reporter":{types:"./dist/reporter.d.ts",import:"./dist/reporter.js",require:"./dist/cjs/reporter.cjs",default:"./dist/reporter.js"},"./package.json":"./package.json"},files:["dist","!dist/**/*.map","README.md"],publishConfig:{registry:"https://registry.npmjs.org",access:"public"},scripts:{prebuild:"pnpm typecheck",build:"tsup",pack:"pnpm build && pnpm pack",clean:"rm -rf dist",dev:"tsup --watch","dev:run":"node --import tsx/esm src/cli.ts",test:"playwright test","test:unit":"tsx --test 'src/**/*.test.ts'",typecheck:"tsc --noEmit"},dependencies:{"@ai-sdk/anthropic":"^3.0.1","@ai-sdk/google":"^3.0.1","@ai-sdk/google-vertex":"^4.0.1","@ai-sdk/openai":"^3.0.1","@ai-sdk/provider":"^3.0.1","@anthropic-ai/claude-agent-sdk":"^0.1.72","@babel/parser":"^7.28.5","@babel/plugin-transform-typescript":"^7.27.0","@google/genai":"^1.34.0","google-auth-library":"^10.0.0","@babel/preset-env":"^7.26.9","@babel/preset-typescript":"^7.27.0","@modelcontextprotocol/sdk":"^1.29.0","@shiplightai/devtools-assets":"workspace:*",ai:"^6.0.3",axios:"^1.15.0",chalk:"^4.1.2",commander:"^11.0.0",dotenv:"^16.0.3",express:"^5.2.1","fs-extra":"^11.2.0",glob:"^13.0.0","html-to-text":"^9.0.5",open:"^10.1.0",openai:"^6.25.0",ora:"^5.4.1",otplib:"^13.4.0","p-retry":"^6.2.1",sharp:"^0.34.5",uuid:"^11.1.0",yaml:"^2.8.3",zod:"^3.22.0","zod-to-json-schema":"^3.24.6"},devDependencies:{"@playwright/test":"1.60.0","@types/express":"^4.17.21","@types/node":"^24.0.0","mcp-tools":"workspace:*","sdk-core":"workspace:*","sdk-internal":"workspace:*","shiplight-tools":"workspace:*","shiplight-types":"workspace:*","@loggia/common":"workspace:*",tsup:"^8.3.5",typescript:"5.5.4"},peerDependencies:{"@playwright/test":"^1.60.0"},engines:{node:">=22.0.0"},keywords:["playwright","yaml","testing","automation","ai","shiplight","mcp"],author:"Shiplight",license:"MIT"}});Le();import Yi from"dotenv";Yi.config();Vt();Yt();function ss(){console.log(`
1587
+ ${r.length} file(s): ${i} transpiled, ${s} error(s), ${o} warning(s)`),process.exit(s>0?1:0)}var Zr=_(()=>{"use strict";Pt();qr()});var ts={};te(ts,{runInspect:()=>Ki});import*as st from"fs";import*as Qr from"path";async function Ki(e){(e.includes("--help")||e.includes("-h")||e.length===0)&&(console.log("Usage: shiplight inspect <file.test.yaml> [options]"),console.log(""),console.log("Parse a YAML test file and output the resulting TestFlow JSON."),console.log("Useful for verifying YAML \u2192 JSON conversion."),console.log(""),console.log("Options:"),console.log(" --pretty Pretty-print JSON (default)"),console.log(" --compact Compact JSON output"),console.log(" --stats Show statement statistics only"),console.log(""),console.log("Examples:"),console.log(" shiplight inspect tests/login.test.yaml"),console.log(" shiplight inspect tests/suite.test.yaml --stats"),console.log(" shiplight inspect tests/login.test.yaml --compact | jq ."),process.exit(e.length===0?1:0));let t=e.includes("--compact"),n=e.includes("--stats"),r=e.find(i=>!i.startsWith("--"));r||(console.error("Error: no file specified"),process.exit(1));let s=Qr.resolve(process.cwd(),r);st.existsSync(s)||(console.error(`Error: file not found: ${s}`),process.exit(1));let o=st.readFileSync(s,"utf-8");try{let i=Pe(o),a=C(o);if(n)zi(a,i);else{let l={...i.test_case_id!==void 0?{test_case_id:i.test_case_id}:{},...i.name?{name:i.name}:{},testFlow:a};console.log(JSON.stringify(l,null,t?0:2))}}catch(i){console.error(`Error parsing ${r}: ${i.message}`),process.exit(1)}}function zi(e,t){if(console.log(`File: ${t.name||"(unnamed)"}`),t.test_case_id!==void 0&&console.log(`Cloud ID: ${t.test_case_id}`),console.log(`Version: ${e.version||"unknown"}`),e.testGroup){let n=e.testGroup;console.log("Type: suite (testGroup)"),console.log(`Tests: ${n.tests.length}`);for(let r of n.tests){let s=r.skip?` [SKIP${typeof r.skip=="string"?`: ${r.skip}`:""}]`:"";console.log(` - ${r.name}: ${r.statements.length} statements${r.teardown?`, ${r.teardown.length} teardown`:""}${s}`)}n.beforeAll?.length&&console.log(`Hooks: beforeAll (${n.beforeAll.length})`),n.afterAll?.length&&console.log(`Hooks: afterAll (${n.afterAll.length})`),n.beforeEach?.length&&console.log(`Hooks: beforeEach (${n.beforeEach.length})`),n.afterEach?.length&&console.log(`Hooks: afterEach (${n.afterEach.length})`)}else{console.log("Type: single test"),console.log(`Goal: ${e.goal}`),e.url&&console.log(`URL: ${e.url}`),e.baseURL&&console.log(`Base URL: ${e.baseURL}`),console.log(`Statements: ${e.statements?.length??0}`),e.teardown?.length&&console.log(`Teardown: ${e.teardown.length}`);let n=es(e.statements??[]);console.log(` DRAFT: ${n.drafts}, ACTION: ${n.actions}, STEP: ${n.steps}`)}}function es(e){let t={drafts:0,actions:0,steps:0};for(let n of e)if(n.type==="DRAFT")t.drafts++;else if(n.type==="ACTION")t.actions++;else if(n.type==="STEP"){t.steps++;let r=es(n.statements??[]);t.drafts+=r.drafts,t.actions+=r.actions,t.steps+=r.steps}return t}var ns=_(()=>{"use strict";ce()});var rs=ls((Vp,Vi)=>{Vi.exports={name:"shiplightai",version:"0.1.65",type:"module",description:"Shiplight CLI for running and debugging .test.yaml files",main:"dist/index.js",types:"dist/index.d.ts",bin:{shiplight:"dist/cli.js"},exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/cjs/index.cjs",default:"./dist/index.js"},"./fixture":{types:"./dist/fixture.d.ts",import:"./dist/fixture.js",require:"./dist/cjs/fixture.cjs",default:"./dist/fixture.js"},"./debugger-pw":{types:"./dist/debugger-pw.d.ts",import:"./dist/debugger-pw.js",require:"./dist/cjs/debugger-pw.cjs",default:"./dist/debugger-pw.js"},"./debugger-manager":{types:"./dist/debugger-manager.d.ts",import:"./dist/debugger-manager.js",require:"./dist/cjs/debugger-manager.cjs",default:"./dist/debugger-manager.js"},"./debugger-server":{types:"./dist/debugger-server.d.ts",import:"./dist/debugger-server.js",require:"./dist/cjs/debugger-server.cjs",default:"./dist/debugger-server.js"},"./reporter":{types:"./dist/reporter.d.ts",import:"./dist/reporter.js",require:"./dist/cjs/reporter.cjs",default:"./dist/reporter.js"},"./package.json":"./package.json"},files:["dist","!dist/**/*.map","README.md"],publishConfig:{registry:"https://registry.npmjs.org",access:"public"},scripts:{prebuild:"pnpm typecheck",build:"tsup",pack:"pnpm build && pnpm pack",clean:"rm -rf dist",dev:"tsup --watch","dev:run":"node --import tsx/esm src/cli.ts",test:"playwright test","test:unit":"tsx --test 'src/**/*.test.ts'",typecheck:"tsc --noEmit"},dependencies:{"@ai-sdk/anthropic":"^3.0.1","@ai-sdk/google":"^3.0.1","@ai-sdk/google-vertex":"^4.0.1","@ai-sdk/openai":"^3.0.1","@ai-sdk/provider":"^3.0.1","@anthropic-ai/claude-agent-sdk":"^0.1.72","@babel/parser":"^7.28.5","@babel/plugin-transform-typescript":"^7.27.0","@google/genai":"^1.34.0","google-auth-library":"^10.0.0","@babel/preset-env":"^7.26.9","@babel/preset-typescript":"^7.27.0","@modelcontextprotocol/sdk":"^1.29.0","@shiplightai/devtools-assets":"workspace:*",ai:"^6.0.3",axios:"^1.15.0",chalk:"^4.1.2",commander:"^11.0.0",dotenv:"^16.0.3",express:"^5.2.1","fs-extra":"^11.2.0",glob:"^13.0.0","html-to-text":"^9.0.5",open:"^10.1.0",openai:"^6.25.0",ora:"^5.4.1",otplib:"^13.4.0","p-retry":"^6.2.1",sharp:"^0.34.5",uuid:"^11.1.0",yaml:"^2.8.3",zod:"^3.22.0","zod-to-json-schema":"^3.24.6"},devDependencies:{"@playwright/test":"1.60.0","@types/express":"^4.17.21","@types/node":"^24.0.0","mcp-tools":"workspace:*","sdk-core":"workspace:*","sdk-internal":"workspace:*","shiplight-tools":"workspace:*","shiplight-types":"workspace:*","@loggia/common":"workspace:*",tsup:"^8.3.5",typescript:"5.5.4"},peerDependencies:{"@playwright/test":"^1.60.0"},engines:{node:">=22.0.0"},keywords:["playwright","yaml","testing","automation","ai","shiplight","mcp"],author:"Shiplight",license:"MIT"}});Le();import Yi from"dotenv";Yi.config();Vt();Yt();function ss(){console.log(`
1587
1588
  Usage: shiplight <command> [options]
1588
1589
 
1589
1590
  Commands: