@piwitests/server 0.18.1 → 0.18.2
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/.output/nitro.json +1 -1
- package/.output/public/_nuxt/{BEB2Mv6B.js → 4TxgDGVa.js} +1 -1
- package/.output/public/_nuxt/{CBEM3L1q.js → 9-wVZMur.js} +1 -1
- package/.output/public/_nuxt/{l0QnzFNM.js → B-5GukRk.js} +1 -1
- package/.output/public/_nuxt/{lowCGL2S.js → B-IcwqZ2.js} +1 -1
- package/.output/public/_nuxt/{CmbjAoQu.js → B1G3GGhQ.js} +1 -1
- package/.output/public/_nuxt/{Dwp3GkV-.js → B1X__ilH.js} +1 -1
- package/.output/public/_nuxt/{CCsl9MOZ.js → B1zMFx24.js} +1 -1
- package/.output/public/_nuxt/{B6IHiVa1.js → B2oUeBbA.js} +1 -1
- package/.output/public/_nuxt/{BAaSmp8J.js → B4jvLMfS.js} +1 -1
- package/.output/public/_nuxt/{mlAADjK3.js → BBK2-Krn.js} +1 -1
- package/.output/public/_nuxt/{Vnfkr1pJ.js → BFP6M-20.js} +1 -1
- package/.output/public/_nuxt/{oFIS9u6t.js → BHpUiv6j.js} +1 -1
- package/.output/public/_nuxt/{Bi3i470l.js → BJtlcTrb.js} +1 -1
- package/.output/public/_nuxt/{BoC6qaRF.js → BLIRKrbM.js} +1 -1
- package/.output/public/_nuxt/{D1ttGJfs.js → BLOUs6AE.js} +1 -1
- package/.output/public/_nuxt/{n-QWmQgc.js → BOCwBVnz.js} +1 -1
- package/.output/public/_nuxt/{CTgM5Fke.js → BT6p4Pgt.js} +1 -1
- package/.output/public/_nuxt/{DB3ljns7.js → BUXSUkJ_.js} +1 -1
- package/.output/public/_nuxt/{36cXPVrY.js → BVf6Yx9V.js} +1 -1
- package/.output/public/_nuxt/{DOr_4nln.js → BXY_PWcx.js} +1 -1
- package/.output/public/_nuxt/{B6rt3IcG.js → BbS6Bwby.js} +1 -1
- package/.output/public/_nuxt/{Dbg8z684.js → Bd3HqPMF.js} +1 -1
- package/.output/public/_nuxt/{DnThe2U0.js → BeFDVhpA.js} +1 -1
- package/.output/public/_nuxt/{BUMZHDRC.js → BeKvLsja.js} +1 -1
- package/.output/public/_nuxt/{BCArQk0c.js → BeUm5UNV.js} +1 -1
- package/.output/public/_nuxt/{TBDx0s9p.js → BfV444H3.js} +1 -1
- package/.output/public/_nuxt/{D8YZvjas.js → BjCHB89N.js} +1 -1
- package/.output/public/_nuxt/{C9ahP7km.js → BjKamgHq.js} +1 -1
- package/.output/public/_nuxt/{DRE6Aqqp.js → BlA8mIS-.js} +1 -1
- package/.output/public/_nuxt/{BaDv5D7A.js → BlnwU1OO.js} +1 -1
- package/.output/public/_nuxt/{C11lmBd4.js → BoJdjCVl.js} +1 -1
- package/.output/public/_nuxt/{BiX7c2qU.js → BreO2PiA.js} +1 -1
- package/.output/public/_nuxt/{EltzgiyS.js → BvIDC_R-.js} +1 -1
- package/.output/public/_nuxt/{D3MWm6JP.js → By4YL7mx.js} +1 -1
- package/.output/public/_nuxt/{BdHdHyop.js → ByuJWADR.js} +1 -1
- package/.output/public/_nuxt/{KYucVFu7.js → C1dyLp_j.js} +1 -1
- package/.output/public/_nuxt/{CPZ5wygb.js → C8OCrfDP.js} +1 -1
- package/.output/public/_nuxt/{AjuKBlzz.js → C9YzQCiq.js} +1 -1
- package/.output/public/_nuxt/{q0DPzLKN.js → CAUgpKsF.js} +1 -1
- package/.output/public/_nuxt/{riEUDnED.js → CL9-VLTJ.js} +1 -1
- package/.output/public/_nuxt/{empGC_x-.js → CN1mJlvD.js} +1 -1
- package/.output/public/_nuxt/{quV6tp4n.js → CNMoZYMv.js} +1 -1
- package/.output/public/_nuxt/{va1mwSm9.js → CPLJeOCb.js} +1 -1
- package/.output/public/_nuxt/{CRpbGS75.js → CUvGJXY3.js} +1 -1
- package/.output/public/_nuxt/{CU3W9YrI.js → CazDIG_m.js} +1 -1
- package/.output/public/_nuxt/{rm7OkgDG.js → CcXaak_K.js} +1 -1
- package/.output/public/_nuxt/{87SGk1nu.js → CdMuck_X.js} +1 -1
- package/.output/public/_nuxt/{BTYiG93l.js → CfOLBbW9.js} +1 -1
- package/.output/public/_nuxt/{Bi9DO8jm.js → CfPSts5n.js} +1 -1
- package/.output/public/_nuxt/{CLdGRzLL.js → CfROFPse.js} +1 -1
- package/.output/public/_nuxt/Cnapl7lZ.js +1 -0
- package/.output/public/_nuxt/{D51_cB9D.js → Cng9gj7q.js} +1 -1
- package/.output/public/_nuxt/{wGpfdK6o.js → CsUoYK75.js} +1 -1
- package/.output/public/_nuxt/{CGq9qR-0.js → CscWZxCi.js} +1 -1
- package/.output/public/_nuxt/{DcfRfTaA.js → CuicKV-B.js} +1 -1
- package/.output/public/_nuxt/{DraETso1.js → Cyiu1VQD.js} +1 -1
- package/.output/public/_nuxt/{B_aSGB8S.js → D0cnIs93.js} +1 -1
- package/.output/public/_nuxt/{CP0vUzbd.js → D5oNv2cB.js} +1 -1
- package/.output/public/_nuxt/{CCw3Tx4S.js → D6PUPmRC.js} +1 -1
- package/.output/public/_nuxt/{ClIKZ4qY.js → DBtBvrYc.js} +1 -1
- package/.output/public/_nuxt/{BFjmLXYo.js → DCl2yo4g.js} +1 -1
- package/.output/public/_nuxt/{BVDBIVAQ.js → DD5HpaW9.js} +1 -1
- package/.output/public/_nuxt/{C8cz5feG.js → DHXWp5yD.js} +1 -1
- package/.output/public/_nuxt/{D3SYPlEB.js → DHltYerF.js} +3 -3
- package/.output/public/_nuxt/{C4AfzZER.js → DLXydYJb.js} +1 -1
- package/.output/public/_nuxt/{BJltXwHg.js → DRPSi76A.js} +1 -1
- package/.output/public/_nuxt/{HTQtMbWb.js → DS53kyHJ.js} +1 -1
- package/.output/public/_nuxt/{C7ZVzS0K.js → DWhBqv_7.js} +1 -1
- package/.output/public/_nuxt/{DoYgYLOd.js → DWowvnwc.js} +1 -1
- package/.output/public/_nuxt/{Doul3p1_.js → DXbPFI1d.js} +1 -1
- package/.output/public/_nuxt/{BKaU95es.js → DZ1zNBVM.js} +1 -1
- package/.output/public/_nuxt/{Db_-yjYg.js → DZ3Vfcpz.js} +1 -1
- package/.output/public/_nuxt/{BfoG8R5a.js → DZOS7Fh7.js} +1 -1
- package/.output/public/_nuxt/{CUDeMcEK.js → DZUgX70W.js} +1 -1
- package/.output/public/_nuxt/{oWY3I9uX.js → Dd0kK5WH.js} +1 -1
- package/.output/public/_nuxt/{wQZj69OY.js → Df7kUO0m.js} +1 -1
- package/.output/public/_nuxt/{ClVRQpP_.js → Dga3Av-m.js} +1 -1
- package/.output/public/_nuxt/{Dy4TloG3.js → DgwTpwfB.js} +1 -1
- package/.output/public/_nuxt/DkI145a5.js +1 -0
- package/.output/public/_nuxt/{C9EpbPNU.js → DoFBTaDR.js} +1 -1
- package/.output/public/_nuxt/{DC51KKt4.js → Dr_dI5hB.js} +1 -1
- package/.output/public/_nuxt/{DoFSKAvY.js → Dwws9U0D.js} +1 -1
- package/.output/public/_nuxt/{DaewB_zT.js → EPZOxdgq.js} +1 -1
- package/.output/public/_nuxt/{DVgMaBxD.js → QmMoMxLM.js} +1 -1
- package/.output/public/_nuxt/{Dm1_3W9g.js → R1nNqTru.js} +1 -1
- package/.output/public/_nuxt/{WAaPPk0g.js → S5DLdEpg.js} +1 -1
- package/.output/public/_nuxt/builds/latest.json +1 -1
- package/.output/public/_nuxt/builds/meta/7caf3cb3-d272-4dbd-bb3f-1eeb64fab5d1.json +1 -0
- package/.output/public/_nuxt/{BAkJhSAW.js → e7zD3uJ0.js} +1 -1
- package/.output/public/_nuxt/{CYIR2GbL.js → gCELhaU9.js} +1 -1
- package/.output/public/_nuxt/{Do6zIWQf.js → gnCL8GjZ.js} +1 -1
- package/.output/public/_nuxt/{BuuvTH9e.js → hH1UFE3Z.js} +1 -1
- package/.output/public/_nuxt/{BReNbog6.js → hgHc4teu.js} +1 -1
- package/.output/public/_nuxt/{uaqMzXqE.js → ipDzNHcs.js} +1 -1
- package/.output/public/_nuxt/{B1CB30tg.js → kS3boz40.js} +1 -1
- package/.output/public/_nuxt/{DIA_NAIv.js → kjYMoWWx.js} +1 -1
- package/.output/public/_nuxt/{BsDB_eCd.js → oFM1KLWA.js} +1 -1
- package/.output/public/_nuxt/qH_j2A3a.js +1 -0
- package/.output/public/_nuxt/{DM_YaJgJ.js → qpI-_f9Q.js} +1 -1
- package/.output/public/_nuxt/{CRcjGmf7.js → rTvJTef_.js} +1 -1
- package/.output/public/_nuxt/{Ccit_CX1.js → rsiRgrVM.js} +1 -1
- package/.output/public/_nuxt/{Tt5LX5Y-.js → swrbBdtB.js} +1 -1
- package/.output/public/_nuxt/{DCMFuzDI.js → wHnZ9OaL.js} +1 -1
- package/.output/public/_nuxt/{D4SFgXAf.js → xqiPI_FQ.js} +1 -1
- package/.output/public/sw.js +1 -1
- package/.output/server/chunks/build/client.precomputed.mjs +1 -1
- package/.output/server/chunks/nitro/nitro.mjs +753 -746
- package/.output/server/package.json +1 -1
- package/package.json +1 -1
- package/.output/public/_nuxt/CiPH-swI.js +0 -1
- package/.output/public/_nuxt/Cx65B3c3.js +0 -1
- package/.output/public/_nuxt/builds/meta/2f517ae9-c342-457e-b4c5-6301728179f5.json +0 -1
- package/.output/public/_nuxt/wgcgHmRR.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{d as oe,o as n,c as l,j as $,g as S,M as mt,i as d,T as Re,ac as ft,k as t,Q as ge,H as he,v as ye,f as P,p as re,q as k,m as L,t as p,F as D,G as pt,r as j,y as ne,s as Ie,_ as Me,h as w,z as ot,B as Be,ad as Le,C as st,b as gt,D as ht,l as Oe,O as Qe,A as qe,aa as Ae,x as vt,U as Ue,ae as Se,K as je,R as yt,ab as xt,af as bt,ag as kt,ah as _t,Z as $t,$ as wt}from"./D3SYPlEB.js";import{_ as Ze}from"./B6IHiVa1.js";import{q as Ct,u as St,e as Tt,f as We,v as at,l as Pe,k as Lt,w as At}from"./BUMZHDRC.js";import{_ as It,a as zt}from"./C8cz5feG.js";import{_ as Ne}from"./empGC_x-.js";import{_ as Bt}from"./l0QnzFNM.js";import{u as Ge}from"./D3MWm6JP.js";import{u as Ee}from"./Doul3p1_.js";import{_ as Rt}from"./Dwp3GkV-.js";import{_ as Pt}from"./CCw3Tx4S.js";import{_ as Ot}from"./oFIS9u6t.js";import{l as Ut,i as Et,b as Mt}from"./36cXPVrY.js";import{_ as rt}from"./Tt5LX5Y-.js";import{_ as jt}from"./DoFSKAvY.js";const Nt={class:"flex items-center justify-between gap-2"},Kt=["aria-expanded","title"],Vt={class:"text-lg font-medium inline-flex items-center gap-1 shrink-0"},Dt={key:2,class:"min-w-0 flex-1 truncate text-sm text-gray-500 dark:text-gray-400"},Ht={key:0,class:"flex items-center gap-1 shrink-0"},Ft={key:0,class:"text-sm text-gray-500 mt-1 ml-11"},qt=oe({__name:"CollapsibleSectionCard",props:{title:{},icon:{},subtitle:{},count:{},iconClass:{default:"text-primary"},help:{},storageKey:{},defaultFolded:{type:Boolean,default:!0}},setup(e,{expose:r}){const i=e,{folded:m,toggle:o,setFolded:a}=Ut(`piwi-section-fold-${i.storageKey}`,i.defaultFolded),s=j(null);function g(){a(!1),pt(()=>s.value?.scrollIntoView({behavior:"smooth",block:"start"}))}return r({setFolded:a,reveal:g}),(c,h)=>{const C=ye,T=It,x=jt;return n(),l("div",{ref_key:"rootEl",ref:s,class:"scroll-mt-4"},[$(x,{ui:{header:"p-3 sm:px-4 sm:py-3",body:t(m)?"p-0 sm:p-0":""},class:re(t(m)&&"divide-y-0")},{header:S(()=>[d("div",Nt,[d("div",{class:"flex items-center gap-2 min-w-0 flex-1 cursor-pointer select-none rounded-sm outline-none focus-visible:outline-2 focus-visible:outline-primary",role:"button",tabindex:"0","aria-expanded":!t(m),title:t(m)?"Expand section":"Collapse section",onClick:h[1]||(h[1]=(...A)=>t(o)&&t(o)(...A)),onKeydown:[h[2]||(h[2]=ge((...A)=>t(o)&&t(o)(...A),["enter"])),h[3]||(h[3]=ge(he((...A)=>t(o)&&t(o)(...A),["prevent"]),["space"]))]},[$(C,{name:t(m)?"i-lucide-chevron-right":"i-lucide-chevron-down",class:"size-4 shrink-0 text-gray-400"},null,8,["name"]),e.icon?(n(),P(C,{key:0,name:e.icon,class:re(["size-5 shrink-0",e.iconClass])},null,8,["name","class"])):k("",!0),d("h3",Vt,[L(p(e.title),1),e.count!=null?(n(),l(D,{key:0},[L(" ("+p(e.count)+")",1)],64)):k("",!0)]),e.help?(n(),l("span",{key:1,onClick:h[0]||(h[0]=he(()=>{},["stop"]))},[$(T,{topic:e.help},null,8,["topic"])])):k("",!0),t(m)&&c.$slots.folded?(n(),l("span",Dt,[Re(c.$slots,"folded")])):k("",!0)],40,Kt),c.$slots.actions?(n(),l("div",Ht,[Re(c.$slots,"actions")])):k("",!0)]),!t(m)&&(e.subtitle||c.$slots.subtitle)?(n(),l("p",Ft,[Re(c.$slots,"subtitle",{},()=>[L(p(e.subtitle),1)])])):k("",!0)]),default:S(()=>[mt(d("div",null,[Re(c.$slots,"default")],512),[[ft,!t(m)]])]),_:3},8,["ui","class"])],512)}}}),Ke=Object.assign(qt,{__name:"CollapsibleSectionCard"}),Zt={class:"overflow-x-auto text-xs font-mono"},Wt=oe({__name:"DiffPatch",props:{patch:{}},setup(e){return(r,i)=>(n(),l("div",Zt,[(n(!0),l(D,null,ne(("parsePatchLines"in r?r.parsePatchLines:t(St))(e.patch),(m,o)=>(n(),l("div",{key:o,class:re(["px-3 py-px whitespace-pre leading-5 min-w-0",("patchLineClass"in r?r.patchLineClass:t(Ct))[m.type]])},p(m.text||" "),3))),128))]))}}),Gt=Object.assign(Wt,{__name:"DiffPatch"}),Yt=["role","aria-checked","tabindex"],Jt={class:"flex-1 min-w-0"},Qt=["title"],Xt={key:0,class:"text-[11px] leading-4 text-gray-500 truncate"},en=oe({__name:"LocatorAlternativeRow",props:{alt:{},note:{default:void 0},copied:{type:Boolean,default:!1},dense:{type:Boolean,default:!1},selectable:{type:Boolean,default:!1},selected:{type:Boolean,default:!1}},emits:["copy","select"],setup(e){const r=e;function i(a){return a>=80?"success":a>=50?"warning":"error"}function m(a){const{method:s,score:g,args:c}=a;return c&&(c.anchorTestId||c.anchorSelector||c.anchorRole)?"scoped to a stable ancestor — survives renames":g>=100?"most stable — purpose-built for testing":s==="getByRole"&&c&&!("name"in c)?"name-free role — survives renames":s==="getByRole"?"browser ARIA tree — semantic and stable":s==="getByLabel"?"associated <label> element":s==="getByPlaceholder"?"input placeholder":s==="getByText"?"visible text":s==="getByAltText"?"image alt text":s==="getByTitle"?"title attribute":s==="locator"&&g>=50?"stable selector":s==="locator"?"CSS class — may be fragile":""}const o=w(()=>r.note??m(r.alt));return(a,s)=>{const g=Ie,c=ye,h=Me;return n(),l("div",{class:re(["flex items-center gap-2 rounded border",[e.dense?"py-1 px-2":"py-1.5 px-2.5",e.selectable?"cursor-pointer hover:bg-elevated transition-colors focus-visible:outline-2 focus-visible:outline-primary":"",e.selectable&&e.selected?"border-primary/60 ring-1 ring-primary/50":"border-default/50"]]),role:e.selectable?"radio":void 0,"aria-checked":e.selectable?e.selected:void 0,tabindex:e.selectable?0:void 0,onClick:s[1]||(s[1]=C=>e.selectable&&a.$emit("select")),onKeydown:[s[2]||(s[2]=ge(he(C=>e.selectable&&a.$emit("select"),["prevent"]),["enter"])),s[3]||(s[3]=ge(he(C=>e.selectable&&a.$emit("select"),["prevent"]),["space"]))]},[$(g,{size:"xs",color:i(e.alt.score),variant:"subtle",class:re(["shrink-0 font-mono tabular-nums cursor-default text-center",e.dense?"min-w-[2.25rem]":"min-w-[2.5rem]"]),title:`Stability score: ${e.alt.score}/100`},{default:S(()=>[L(p(e.alt.score),1)]),_:1},8,["color","class","title"]),d("div",Jt,[d("code",{class:"text-xs font-mono block truncate",title:e.alt.locator},p(e.alt.locator),9,Qt),t(o)?(n(),l("p",Xt,p(t(o)),1)):k("",!0)]),e.alt.pickedByUser&&e.dense?(n(),P(c,{key:0,name:"i-lucide-user-check",class:"size-3.5 text-primary shrink-0",title:"Confirmed with the locator picker"})):e.alt.pickedByUser?(n(),P(g,{key:1,size:"xs",color:"primary",variant:"subtle",icon:"i-lucide-user-check",class:"shrink-0",title:"Confirmed with the locator picker on the failing page"})):k("",!0),$(h,{size:"xs",variant:"ghost",color:"neutral",icon:e.copied?"i-lucide-check":"i-lucide-copy",title:e.copied?"Copied!":"Copy",class:"shrink-0",onClick:s[0]||(s[0]=he(C=>a.$emit("copy"),["stop"]))},null,8,["icon","title"])],42,Yt)}}}),it=Object.assign(en,{__name:"LocatorAlternativeRow"}),Xe={getByTestId:"testid",getByRole:"semantic",getByLabel:"label",getByPlaceholder:"label",getByText:"text",getByAltText:"text",getByTitle:"text",locator:"css","page.locator":"css"},tn=50;function lt(e,r,i=tn){const m=r[0]??null;if(!m)return{recommended:null,durable:null,preservesConvention:!1,hasDurableAlternative:!1,suggestAddTestId:!1};const o=e?Xe[e]:void 0,a=(e?r.find(c=>c.method===e&&c.score>=i):void 0)??(o?r.find(c=>Xe[c.method]===o&&c.score>=i):void 0),g=r.find(c=>c.pickedByUser)??a??m;return{recommended:g,durable:m,preservesConvention:!!a&&g===a,hasDurableAlternative:g.locator!==m.locator,suggestAddTestId:m.score<i}}const ct={a:"link",button:"button",nav:"navigation",main:"main",article:"article",section:"region",form:"form",img:"img",figure:"figure",figcaption:"caption",blockquote:"blockquote",table:"table",ul:"list",ol:"list",li:"listitem",dialog:"dialog",output:"status",progress:"progressbar",meter:"meter",textarea:"textbox",h1:"heading",h2:"heading",h3:"heading",h4:"heading",h5:"heading",h6:"heading",details:"group",summary:"button",search:"search"},nn={button:"button",submit:"button",reset:"button",image:"button",checkbox:"checkbox",radio:"radio",range:"slider",search:"searchbox",number:"spinbutton",text:"textbox",email:"textbox",tel:"textbox",url:"textbox",password:"textbox"},on=["id","class","name","data-testid","placeholder","alt","title","aria-label","aria-level","role","type","href","multiple"];function sn(e){const r=e.attributes.role;if(r)return r;const i=e.tagName;if(!i)return null;if(i==="input"){const m=(e.attributes.type??"text").toLowerCase();return nn[m]??"textbox"}return i==="select"?e.attributes.multiple!=null?"listbox":"combobox":i==="a"?e.attributes.href!=null?"link":null:ct[i]??null}function an(e,r){if(r!=="heading")return null;const i=e.tagName.match(/^h([1-6])$/);if(i)return Number(i[1]);const m=e.attributes["aria-level"];return m&&/^\d+$/.test(m)?Number(m):null}const $e=(e,r)=>e.attributes[r]||null,pe=e=>e.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),He=e=>e.replace(/\\/g,"\\\\").replace(/"/g,'\\"'),et=e=>/^[A-Za-z][A-Za-z0-9_-]*$/.test(e);function rn(e){return/[a-f0-9]{8,}/i.test(e)?10:/^(?:css|sc|emotion|styled)-/i.test(e)?15:/^(bg|text|border|shadow|opacity|font|w-|h-|m[tblrxy]?-|p[tblrxy]?-|flex|grid|gap|rounded|absolute|relative|fixed|sticky|block|inline|hidden|overflow|z-|top-|right-|bottom-|left-|inset-|justify-|items-|self-|content-|order-|col-|row-)/.test(e)?25:/__/.test(e)||/--/.test(e)?35:/^[a-z]+(-[a-z]+)+$/.test(e)||/^[a-z]+[A-Z][a-zA-Z]+$/.test(e)?40:(e.includes("_")||/^[a-z]+-[a-z0-9]{5,}$/.test(e)&&/[0-9]/.test(e),15)}function tt(e){return!!(/^[a-f0-9]{8}-([a-f0-9]{4}-){3}[a-f0-9]{12}$/i.test(e)||/^[a-f0-9]{8,}$/i.test(e)||/^[a-z]+-\d+$/.test(e)||/^(emotion-|styled-|css-|sc-)/.test(e)||e.startsWith("ng-")||/^(radix-|headlessui-|mui-|mantine-|chakra-)/i.test(e)||/^:r[0-9a-z]+:$/i.test(e)||/^«r[0-9a-z]+»$/i.test(e))}function ln(e){const r=[],i=new Set,m=y=>{i.has(y.locator)||(i.add(y.locator),r.push(y))},{accessibleName:o}=e,a=e.tagName,s=sn(e),g=e.selectorCounts,c=y=>y==null||y<=1,h=e.textContent?e.textContent.replace(/\s+/g," ").trim():null,C=$e(e,"data-testid");C&&c(g?.testId)&&m({locator:`getByTestId('${pe(C)}')`,method:"getByTestId",args:{testId:C},score:100});const T=an(e,s),x=T!=null?`, level: ${T}`:"",A=y=>T!=null?{...y,level:T}:y;s&&o&&m({locator:`getByRole('${s}', { name: '${pe(o)}'${x} })`,method:"getByRole",args:A({role:s,name:o}),score:90});const z=$e(e,"aria-label");if(s&&z&&z!==o&&m({locator:`getByRole('${s}', { name: '${pe(z)}'${x} })`,method:"getByRole",args:A({role:s,name:z}),score:85}),o&&["input","select","textarea"].includes(a)){const y=$e(e,"aria-label");(e.hasLabel===void 0||e.hasLabel===!0||y===o)&&m({locator:`getByLabel('${pe(o)}')`,method:"getByLabel",args:{label:o},score:85})}const B=$e(e,"placeholder");B&&m({locator:`getByPlaceholder('${pe(B)}')`,method:"getByPlaceholder",args:{placeholder:B},score:80}),h&&h.length<80&&m({locator:`getByText('${pe(h)}')`,method:"getByText",args:{text:h},score:75});const Z=$e(e,"id");if(Z&&!tt(Z)&&c(g?.id)){const y=et(Z)?`#${Z}`:`[id="${He(Z)}"]`;m({locator:`locator('${pe(y)}')`,method:"locator",args:{selector:y},score:65})}const Y=$e(e,"name");if(Y&&c(g?.name)){const y=`[name="${He(Y)}"]`;m({locator:`locator('${pe(y)}')`,method:"locator",args:{selector:y},score:60})}const E=$e(e,"alt");E&&m({locator:`getByAltText('${pe(E)}')`,method:"getByAltText",args:{text:E},score:60});const O=$e(e,"title");O&&m({locator:`getByTitle('${pe(O)}')`,method:"getByTitle",args:{title:O},score:50});const ce=!!(C&&c(g?.testId));if(s&&!ce){const y=T!=null?`'${s}', { level: ${T} }`:`'${s}'`,H=A({role:s});let M=!1,K=!1,W=!1;for(const Q of e.ancestors??[]){if(Q.scopedRoleCount!==1)continue;if(!M&&Q.testId&&Q.testIdCount===1&&(M=!0,m({locator:`getByTestId('${pe(Q.testId)}').getByRole(${y})`,method:"getByRole",args:{...H,anchorTestId:Q.testId},score:72})),!K&&Q.id&&!tt(Q.id)&&Q.idCount===1){K=!0;const xe=et(Q.id)?`#${Q.id}`:`[id="${He(Q.id)}"]`;m({locator:`locator('${pe(xe)}').getByRole(${y})`,method:"getByRole",args:{...H,anchorSelector:xe},score:64})}const ve=Q.role||ct[Q.tag]||null;!W&&ve&&ve!==s&&Q.roleCount===1&&(W=!0,m({locator:`getByRole('${pe(ve)}').getByRole(${y})`,method:"getByRole",args:{...H,anchorRole:ve},score:55}))}const F=e.rolePosition;F&&F.role===s&&(F.count===1||T!=null&&F.levelCount===1)&&m({locator:`getByRole(${y})`,method:"getByRole",args:H,score:58})}const ee=$e(e,"class");if(ee){const y=g?.classes,H=ee.split(/\s+/).filter(M=>M.length>1&&/^[A-Za-z_-][A-Za-z0-9_-]*$/.test(M)&&c(y?.[M])).map(M=>({cls:M,score:rn(M)})).sort((M,K)=>K.score-M.score).slice(0,3);for(const{cls:M,score:K}of H)m({locator:`locator('.${pe(M)}')`,method:"locator",args:{selector:`.${M}`},score:K})}return r.sort((y,H)=>H.score-y.score)}function cn(e){const r=e.attributes,i=r["aria-label"];if(i)return i;if(e.textContent)return e.textContent;const m=r.title;if(m)return m;const o=r.placeholder;return o||null}function un(e){if(window.__piwiPickerInstalled)return;window.__piwiPickerInstalled=!0;var r=document,i=window,m=2147483600,o=e.probedAttrs,a=r.createElement("div");a.id="__piwi_picker_highlight",a.style.cssText="position:fixed;pointer-events:none;z-index:"+m+";display:none;box-sizing:border-box;border:2px solid #7c3aed;background:rgba(124,58,237,.12);border-radius:3px;",r.body.appendChild(a);var s=r.createElement("div");s.id="__piwi_picker_banner",s.style.cssText="position:fixed;top:12px;left:50%;transform:translateX(-50%);z-index:"+(m+2)+";background:#111827;color:#f9fafb;font:13px/1.5 system-ui,sans-serif;padding:10px 16px;border-radius:8px;box-shadow:0 4px 24px rgba(0,0,0,.4);max-width:80vw;",s.innerHTML='<div>Click an element to generate locators</div><div style="color:#9ca3af;margin-top:3px;font-size:11px">↑ parent · ↓ child · Esc skip</div>',r.body.appendChild(s),i.parent.postMessage({type:"pickerReady"},"*");function g(u){var b=(u.tagName||"?").toLowerCase(),I=u.getAttribute&&u.getAttribute("data-testid");if(I)return"getByTestId('"+I+"')";if(u.labels&&u.labels.length>0){var U=(u.labels[0].textContent||"").replace(/\s+/g," ").trim().slice(0,80);if(U)return"getByLabel('"+U+"')"}var X=u.getAttribute&&u.getAttribute("aria-label");if(X)return"getByLabel('"+X+"')";var J=u.getAttribute&&u.getAttribute("placeholder");if(J)return"getByPlaceholder('"+J+"')";var q=u.getAttribute&&u.getAttribute("alt");if(q)return"getByAltText('"+q+"')";var ae=u.getAttribute&&u.getAttribute("title");if(ae)return"getByTitle('"+ae+"')";if(u.id)return"locator('#"+u.id+"')";var fe=(u.getAttribute&&u.getAttribute("class")||"").split(/\s+/).find(function(_){return _.length>1});return fe?"locator('."+fe+"')":b}function c(u){for(var b=[],I=u;I&&b.length<15;){var U=(I.tagName||"").toLowerCase();if(U==="body"||U==="html")break;b.push(I),I=I.parentElement}return b.length?b:[u]}var h=["button","a","input","select","textarea","summary","option"];function C(u){for(var b=0;b<Math.min(u.length,4);b++){var I=u[b],U=(I.tagName||"").toLowerCase();if(h.indexOf(U)!==-1||I.getAttribute&&(I.getAttribute("role")||I.getAttribute("data-testid")))return b}return 0}var T=[],x=0,A=null;function z(){return T[x]||null}function B(){var u=z();if(!u){a.style.display="none";return}var b=u.getBoundingClientRect();a.style.display="block",a.style.left=b.left+"px",a.style.top=b.top+"px",a.style.width=b.width+"px",a.style.height=b.height+"px";var I=r.getElementById("__piwi_picker_foot");I&&(I.textContent=g(u)+" — click to pick · ↑ parent · ↓ child · Esc skip")}var Z=s.querySelector("[style*=margin]");Z&&(Z.id="__piwi_picker_foot");function Y(u){for(var b={},I=0;I<o.length;I++){var U=o[I],X=u.getAttribute(U)||u[U];b[U]=typeof X=="string"?X.slice(0,200):X?String(X).slice(0,200):null}var J=u.getBoundingClientRect(),q={};try{var ae=function(we){return i.CSS.escape(we)},fe=function(we){try{return r.querySelectorAll(we).length}catch{return}};b["data-testid"]&&(q.testId=fe("[data-testid="+JSON.stringify(b["data-testid"])+"]")),b.id&&(q.id=fe("#"+ae(b.id))),b.name&&(q.name=fe("[name="+JSON.stringify(b.name)+"]"));var _=(b.class||"").split(/\s+/).filter(function(we){return we.length>1}).slice(0,10);if(_.length>0){for(var v={},G=0;G<_.length;G++){var le=fe("."+ae(_[G]));le!==void 0&&(v[_[G]]=le)}q.classes=v}}catch{}var Ve=null;return u.labels&&u.labels.length>0&&(Ve=(u.labels[0].textContent||"").replace(/\s+/g," ").trim().slice(0,120)||null),{tagName:(u.tagName||"").toLowerCase(),attributes:b,textContent:(u.textContent||"").replace(/\s+/g," ").trim().slice(0,80)||null,center:{x:Math.round(J.x+J.width/2),y:Math.round(J.y+J.height/2)},hasLabel:!!(u.labels&&u.labels.length>0),labelText:Ve,selectorCounts:q}}function E(u){u.preventDefault(),u.stopImmediatePropagation()}function O(u){return u===s||u===a||s.contains&&s.contains(u)||u&&u.__piwiHint}var ce="top";function ee(u){ce!==u&&(ce=u,u==="bottom"?(s.style.top="auto",s.style.bottom="12px"):(s.style.top="12px",s.style.bottom="auto"))}function y(u){var b=u.target;if(!b||O(b)){a.style.display="none";return}b!==A&&(A=b,T=c(b),x=C(T)),B();var I=z();if(I){var U=I.getBoundingClientRect(),X=s.getBoundingClientRect(),J=8;U.left<X.right+J&&U.right>X.left-J&&U.top<X.bottom+J&&U.bottom>X.top-J&&ee(ce==="top"?"bottom":"top")}}function H(u){if(u==="Escape"){Te();return}u==="ArrowUp"&&(x=Math.min(x+1,T.length-1),B()),u==="ArrowDown"&&(x=Math.max(x-1,0),B())}function M(u){(u.key==="Escape"||u.key==="ArrowUp"||u.key==="ArrowDown")&&(E(u),H(u.key))}var K=[];function W(){for(var u=0;u<K.length;u++)K[u].parentNode&&K[u].parentNode.removeChild(K[u]);K=[]}function F(u){return(u||"").replace(/\s+/g," ").trim().toLowerCase()}function Q(u){var b=F(u);if(b.length<2)return[];for(var I=r.querySelectorAll("button,a,[role],h1,h2,h3,h4,h5,h6,label,summary,input,textarea,select,option,span,li,td,th,p"),U=[],X=[],J=0;J<I.length;J++){var q=I[J],ae=F(q.textContent);if(!ae){var fe=F(q.getAttribute&&(q.getAttribute("placeholder")||q.getAttribute("aria-label"))||"");fe&&(fe===b||fe.indexOf(b)!==-1)&&U.push(q);continue}ae.length>120||(ae===b?U.push(q):ae.indexOf(b)!==-1&&ae.length<b.length+30&&X.push(q))}return U.concat(X)}function ve(u,b){var I=u.getBoundingClientRect();if(I.width===0&&I.height===0)return null;var U=r.createElement("div");return U.__piwiHint=!0,U.style.cssText="position:fixed;pointer-events:none;z-index:"+(m+1)+";box-sizing:border-box;border-radius:3px;transition:opacity .3s;border:2px solid "+b+";box-shadow:0 0 0 3px "+b+"55;left:"+I.left+"px;top:"+I.top+"px;width:"+I.width+"px;height:"+I.height+"px;",r.body.appendChild(U),K.push(U),U}function xe(u){var b=u.getBoundingClientRect();i.parent.postMessage({type:"piwiScrollTo",y:b.top},"*")}function ze(u){if(W(),!(!u||!u.length)){for(var b=null,I=0;I<u.length;I++)for(var U=u[I],X=Q(U&&U.text),J=0;J<Math.min(X.length,3);J++)ve(X[J],"#f59e0b"),b||(b=X[J]);b&&xe(b),setTimeout(function(){for(var q=0;q<K.length;q++)K[q].style.opacity="0"},2600),setTimeout(W,3e3)}}var te=[],ke=0;function R(){i.parent.postMessage({type:"piwiSearchResult",count:te.length,index:te.length?ke:-1},"*")}function f(){W();var u=te[ke];u&&(ve(u,"#7c3aed"),xe(u),R())}function N(u){if(te=Q(u),ke=0,!te.length){W(),R();return}f()}function be(){te.length&&(ke=(ke+1)%te.length,f())}function me(u){var b=u.data;if(!(!b||typeof b.type!="string")){if(b.type==="piwiPickerKey"&&typeof b.key=="string")H(b.key);else if(b.type==="piwiHighlight")try{ze(b.hints)}catch{}else if(b.type==="piwiSearch")try{N(b.q)}catch{}else if(b.type==="piwiSearchNext")try{be()}catch{}else if(b.type==="piwiClearHints")try{W()}catch{}}}function ue(u){E(u);var b=z();if(!(!b||O(u.target))){var I=Y(b);a.style.display="none",W(),s.innerHTML='<div style="text-align:center;color:#9ca3af;">Analyzing element…</div>',Ce(),i.parent.postMessage({type:"elementPicked",attrs:I},"*")}}var _e=["mousedown","mouseup","pointerdown","pointerup","auxclick","dblclick"];function Ce(){r.removeEventListener("mousemove",y,!0),r.removeEventListener("click",ue,!0),r.removeEventListener("keydown",M,!0),i.removeEventListener("message",me,!1);for(var u=0;u<_e.length;u++)r.removeEventListener(_e[u],E,!0)}function Te(){Ce(),W(),a.remove(),s.remove(),i.parent.postMessage({type:"pickerClosed"},"*")}r.addEventListener("mousemove",y,!0),r.addEventListener("click",ue,!0),r.addEventListener("keydown",M,!0),i.addEventListener("message",me,!1);for(var se=0;se<_e.length;se++)r.addEventListener(_e[se],E,!0);function V(){var u=Math.max(r.documentElement?r.documentElement.scrollHeight:0,r.body?r.body.scrollHeight:0);u>0&&i.parent.postMessage({type:"piwiContentHeight",height:u},"*")}V();try{if(i.ResizeObserver){var ie=new i.ResizeObserver(V);r.documentElement&&ie.observe(r.documentElement),r.body&&ie.observe(r.body)}}catch{}}function dn(e){const r=[],i=new Set,m=a=>{if(typeof a!="string")return;const s=a.trim();if(s.length<2||s.length>80)return;const g=s.toLowerCase();i.has(g)||(i.add(g),r.push({text:s}))},o=a=>a&&(a.name??a.text??a.label??a.placeholder??a.alt??a.title);m(o(e.failingLocator?.args));for(const a of e.fromElementMatch??[])m(o(a.args));for(const a of e.fromAriaSnapshot??[])m(o(a.args));return r.slice(0,6)}function mn(e){return`<script>(${String(un).replace(/<\/(script)/gi,"<\\/$1")})(${JSON.stringify(e)})<\/script>`}function fn(e){return e.replace(/<base\b[^>]*>/gi,"")}function pn(e,r){return fn(e)+mn(r)}const gn={key:0,class:"flex items-center justify-center py-20"},hn={key:1,class:"py-8 text-center"},vn={class:"text-xs text-gray-400 mt-1"},yn={key:2,class:"py-8 text-center"},xn={class:"mb-2 flex items-center gap-2 flex-wrap"},bn={key:1,class:"ml-auto inline-flex rounded-md border border-default overflow-hidden text-xs"},kn={key:0,class:"flex items-center gap-1 mb-1.5 text-xs text-gray-500"},_n={class:"tabular-nums w-11 text-center select-none"},$n={class:"ml-auto text-gray-400 tabular-nums"},wn={key:1,class:"flex items-center gap-2 mb-1.5"},Cn={key:0,class:"text-xs text-gray-500 tabular-nums"},Sn={key:1,class:"text-xs text-gray-400"},Tn={key:0,class:"absolute inset-0 flex items-center justify-center bg-white dark:bg-gray-900 z-10"},Ln=["src"],An={key:2,class:"mt-4 space-y-3"},In={class:"flex items-center gap-3 bg-elevated rounded-lg p-3"},zn={class:"flex-1 min-w-0"},Bn={class:"text-sm font-medium"},Rn={class:"text-xs"},Pn={key:0,class:"text-xs text-gray-400 ml-1"},On={key:0,class:"text-xs text-gray-500 mt-0.5 truncate"},Un={class:"space-y-1",role:"radiogroup","aria-label":"Alternative locators"},En={class:"flex-1 min-w-0"},Mn={class:"text-xs font-medium text-primary"},jn={class:"text-sm font-mono block truncate mt-0.5"},Nn={class:"flex justify-between w-full"},Kn={key:1},Vn={class:"flex gap-2"},Dn=oe({__name:"SnapshotLocatorPicker",props:qe({runId:{},testRunsCaseId:{},failingLocator:{},healing:{}},{open:{type:Boolean,required:!0},openModifiers:{}}),emits:qe(["close","confirmed"],["update:open"]),setup(e,{emit:r}){const i=e,m=r,o=ot(e,"open"),a=j(!1),s=j(null),g=j(null),c=j(void 0);async function h(){a.value=!0,g.value=null;try{const _=c.value?`?source=${c.value}`:"";s.value=await $fetch(`/api/test-runs/${i.runId}/cases/${i.testRunsCaseId}/dom-snapshot${_}`),s.value?.source&&(c.value=s.value.source)}catch(_){g.value=_ instanceof Error?_.message:"Unknown error"}finally{a.value=!1}}const C=w(()=>s.value?.availableSources??[]);function T(_){_===c.value||a.value||(c.value=_,z.value=!1,x.value="pick-element",ee.value=0,H.value=!1,B.value=null,Z.value=[],se.value=null,N.value="",be.value=0,me.value=-1,h())}Be(o,_=>{_&&(s.value=null,z.value=!1,x.value="pick-element",ee.value=0,H.value=!1,c.value=void 0,B.value=null,Z.value=[],se.value=null,N.value="",be.value=0,me.value=-1,h())});const x=j("pick-element"),A=j(null),z=j(!1),B=j(null),Z=j([]),Y=j(void 0);function E(_){return URL.createObjectURL(new Blob([pn(_,{probedAttrs:on})],{type:"text/html"}))}Be(()=>s.value?.html,_=>{Y.value&&(URL.revokeObjectURL(Y.value),Y.value=void 0),_&&(Y.value=E(_))},{immediate:!0});const O=j(null),ce=j(0),ee=j(0),y=j(1),H=j(!1),M=w(()=>s.value?.viewport??null),K=w(()=>{const _=M.value;return!_?.width||!ce.value?1:Math.min(ce.value/_.width,1)}),W=w(()=>{const _=M.value;if(!_)return{width:"100%",height:ee.value?`${ee.value}px`:"100%"};const v=ee.value||_.height;return{width:`${Math.round(_.width*y.value)}px`,height:`${Math.round(v*y.value)}px`}}),F=w(()=>{const _=M.value;if(!_)return{width:"100%",height:ee.value?`${ee.value}px`:"100%",border:"0"};const v=ee.value||_.height;return{width:`${_.width}px`,height:`${v}px`,transform:`scale(${y.value})`,transformOrigin:"top left",border:"0"}}),Q=w(()=>Math.round(y.value*100)),ve=_=>Math.min(4,Math.max(.1,_));function xe(_){H.value=!0,y.value=ve(y.value*_)}function ze(){H.value=!1,y.value=K.value}Be([K,M],()=>{H.value||(y.value=K.value)});let te=null;Be(O,_=>{te?.disconnect(),_&&(ce.value=_.clientWidth,te=new ResizeObserver(v=>{for(const G of v)ce.value=G.contentRect.width}),te.observe(_))}),Le(()=>{te?.disconnect()}),Le(()=>{Y.value&&URL.revokeObjectURL(Y.value)});function ke(_){if(!A.value||_.source!==A.value.contentWindow)return;const v=_.data;if(v?.type==="pickerReady"){z.value=!0,f();return}if(v?.type==="piwiContentHeight"&&typeof v.height=="number"){ee.value=Math.max(v.height,M.value?.height??0);return}if(v?.type==="piwiScrollTo"&&typeof v.y=="number"){const G=O.value;G&&G.scrollTo({top:Math.max(0,v.y*y.value-80),behavior:"smooth"});return}if(v?.type==="piwiSearchResult"){be.value=typeof v.count=="number"?v.count:0,me.value=typeof v.index=="number"?v.index:-1;return}if(v?.type==="elementPicked"&&v.attrs){const{labelText:G,...le}=v.attrs;B.value={...le,accessibleName:G??cn(le)},Z.value=ln(B.value),se.value=null,x.value="review"}v?.type==="pickerClosed"&&U()}function R(_){A.value?.contentWindow?.postMessage(_,"*")}function f(){const _=dn({failingLocator:i.failingLocator,fromElementMatch:i.healing?.fromElementMatch??null,fromAriaSnapshot:i.healing?.fromAriaSnapshot??null});_.length&&R({type:"piwiHighlight",hints:_})}const N=j(""),be=j(0),me=j(-1);let ue=null;Be(N,_=>{ue&&clearTimeout(ue),ue=setTimeout(()=>R({type:"piwiSearch",q:_}),180)});function _e(){R({type:"piwiSearchNext"})}Le(()=>{ue&&clearTimeout(ue)});function Ce(_){if(!o.value||x.value!=="pick-element"||!z.value||_.key!=="ArrowUp"&&_.key!=="ArrowDown")return;const v=(document.activeElement?.tagName??"").toLowerCase();if(v==="input"||v==="textarea")return;const G=A.value?.contentWindow;G&&(_.preventDefault(),G.postMessage({type:"piwiPickerKey",key:_.key},"*"))}function Te(){A.value&&(A.value.src="about:blank")}st(()=>{window.addEventListener("message",ke),window.addEventListener("keydown",Ce,!0)}),Le(()=>{window.removeEventListener("message",ke),window.removeEventListener("keydown",Ce,!0)});const se=j(null),V=j(!1);function ie(_){se.value=_}const u=w(()=>lt(i.failingLocator.method,Z.value)),b=gt();async function I(){if(se.value){V.value=!0;try{(await $fetch(`/api/test-runs/${i.runId}/cases/${i.testRunsCaseId}/locator-pick`,{method:"POST",body:{failingLocator:i.failingLocator,pickedLocator:se.value,element:B.value}})).status==="ok"?m("confirmed",se.value):b.add({title:"Pick not saved",description:"This failure has no call-site or locator signature to attach the pick to.",color:"warning",icon:"i-lucide-alert-triangle"}),o.value=!1}catch(_){b.add({title:"Could not save the pick",description:Tt(_),color:"error",icon:"i-lucide-alert-triangle"})}finally{V.value=!1}}}function U(){Te(),o.value=!1}function X(){B.value=null,Z.value=[],se.value=null,x.value="pick-element",z.value=!1,N.value="",be.value=0,me.value=-1;const _=s.value?.html;_&&(Y.value&&URL.revokeObjectURL(Y.value),Y.value=E(_))}const{copy:J}=Ge(),q=j(null);let ae=null;function fe(_,v){J(_,{toast:"Locator copied"}),q.value=v,ae&&clearTimeout(ae),ae=setTimeout(()=>{q.value=null},2e3)}return Le(()=>{ae&&clearTimeout(ae)}),(_,v)=>{const G=ye,le=Me,Ve=ht,we=Ie,Je=Bt;return n(),P(Je,{open:o.value,"onUpdate:open":v[8]||(v[8]=de=>o.value=de),ui:{content:"max-w-6xl w-[95vw]"},onAfterLeave:U},{header:S(()=>[...v[9]||(v[9]=[d("div",null,[d("h3",{class:"text-lg font-medium"},"Pick a locator from the DOM snapshot"),d("p",{class:"text-sm text-gray-500 mt-0.5"}," Click the element the failing locator should target. Use ↑↓ to walk the DOM tree. ")],-1)])]),body:S(()=>[t(a)?(n(),l("div",gn,[$(G,{name:"i-lucide-loader",class:"size-6 animate-spin text-gray-400"}),v[10]||(v[10]=d("span",{class:"ml-2 text-sm text-gray-500"},"Loading DOM snapshot...",-1))])):t(g)?(n(),l("div",hn,[$(G,{name:"i-lucide-alert-triangle",class:"size-8 text-red-300 mx-auto mb-2"}),v[12]||(v[12]=d("p",{class:"text-sm text-red-500"},"Failed to load snapshot",-1)),d("p",vn,p(t(g)),1),$(le,{size:"xs",variant:"outline",color:"neutral",class:"mt-3",onClick:h},{default:S(()=>[...v[11]||(v[11]=[L("Retry",-1)])]),_:1})])):t(s)?.status!=="ok"||!t(s).html?(n(),l("div",yn,[$(G,{name:"i-lucide-file-x",class:"size-8 text-gray-300 mx-auto mb-2"}),v[13]||(v[13]=d("p",{class:"text-sm text-gray-500"},"No DOM snapshot or ARIA data available for this execution",-1)),v[14]||(v[14]=d("p",{class:"text-xs text-gray-400 mt-1"},"This test run has no stored trace or ARIA snapshot to pick from.",-1))])):(n(),l(D,{key:3},[d("div",xn,[t(s).source?(n(),l("div",{key:0,class:re(["text-xs flex items-center gap-1",t(s).source==="aria"?"text-amber-600 dark:text-amber-400":"text-green-600 dark:text-green-400"])},[$(G,{name:t(s).source==="aria"?"i-lucide-accessibility":"i-lucide-check",class:"size-3.5 shrink-0"},null,8,["name"]),t(s).source==="aria"?(n(),l(D,{key:0},[L(" Accessibility tree from the failure-time ARIA snapshot — element styles are approximate ")],64)):(n(),l(D,{key:1},[L(" Rendered from the failure-time DOM snapshot ")],64))],2)):k("",!0),t(C).length>1?(n(),l("div",bn,[d("button",{type:"button",class:re(["px-2 py-1 flex items-center gap-1 transition-colors",t(c)==="dom"?"bg-primary/10 text-primary font-medium":"text-gray-500 hover:bg-elevated"]),title:"Rendered page from the trace",onClick:v[0]||(v[0]=de=>T("dom"))},[$(G,{name:"i-lucide-layout-panel-top",class:"size-3.5"}),v[15]||(v[15]=L(" DOM ",-1))],2),d("button",{type:"button",class:re(["px-2 py-1 flex items-center gap-1 border-l border-default transition-colors",t(c)==="aria"?"bg-primary/10 text-primary font-medium":"text-gray-500 hover:bg-elevated"]),title:"Accessibility tree from the ARIA snapshot",onClick:v[1]||(v[1]=de=>T("aria"))},[$(G,{name:"i-lucide-accessibility",class:"size-3.5"}),v[16]||(v[16]=L(" Tree ",-1))],2)])):k("",!0)]),t(M)?(n(),l("div",kn,[$(le,{size:"xs",variant:"ghost",color:"neutral",icon:"i-lucide-zoom-out",title:"Zoom out",onClick:v[2]||(v[2]=de=>xe(1/1.25))}),d("span",_n,p(t(Q))+"%",1),$(le,{size:"xs",variant:"ghost",color:"neutral",icon:"i-lucide-zoom-in",title:"Zoom in",onClick:v[3]||(v[3]=de=>xe(1.25))}),$(le,{size:"xs",variant:"outline",color:"neutral",class:"ml-1",onClick:ze},{default:S(()=>[...v[17]||(v[17]=[L("Fit",-1)])]),_:1}),d("span",$n,p(t(M).width)+"×"+p(t(M).height),1)])):k("",!0),t(x)==="pick-element"?(n(),l("div",wn,[$(Ve,{modelValue:t(N),"onUpdate:modelValue":v[4]||(v[4]=de=>Oe(N)?N.value=de:null),size:"xs",icon:"i-lucide-search",placeholder:"Find an element by its text…",class:"max-w-xs",onKeydown:ge(he(_e,["prevent"]),["enter"])},null,8,["modelValue","onKeydown"]),t(N)&&t(be)>0?(n(),l("span",Cn,p(t(me)+1)+"/"+p(t(be)),1)):t(N)?(n(),l("span",Sn,"no matches")):k("",!0),t(be)>1?(n(),P(le,{key:2,size:"xs",variant:"ghost",color:"neutral",icon:"i-lucide-chevron-down",title:"Next match (Enter)",onClick:_e})):k("",!0)])):k("",!0),d("div",{ref_key:"stageRef",ref:O,class:re(["relative border border-default rounded-lg overflow-auto",[t(x)==="pick-element"?"h-[75vh]":"h-80",t(M)?"bg-gray-100 dark:bg-gray-800":""]])},[t(z)?k("",!0):(n(),l("div",Tn,[$(G,{name:"i-lucide-loader",class:"size-5 animate-spin text-gray-400"}),v[18]||(v[18]=d("span",{class:"ml-2 text-sm text-gray-500"},"Initializing picker...",-1))])),d("div",{style:Qe(t(W))},[d("iframe",{ref_key:"iframeRef",ref:A,src:t(Y),style:Qe(t(F)),class:"bg-white",sandbox:"allow-scripts",title:"DOM snapshot"},null,12,Ln)],4)],2),t(x)==="review"&&t(B)?(n(),l("div",An,[d("div",In,[$(G,{name:"i-lucide-crosshair",class:"size-5 text-primary shrink-0"}),d("div",zn,[d("p",Bn,[v[19]||(v[19]=L(" Picked: ",-1)),d("code",Rn,p(t(B).tagName),1),t(B).attributes.id?(n(),l("code",Pn,"#"+p(t(B).attributes.id),1)):k("",!0),t(B).attributes["data-testid"]?(n(),P(we,{key:1,size:"xs",color:"primary",variant:"subtle",class:"ml-1"},{default:S(()=>[L(p(t(B).attributes["data-testid"]),1)]),_:1})):k("",!0)]),t(B).textContent?(n(),l("p",On,' "'+p(t(B).textContent)+'" ',1)):k("",!0)]),$(le,{size:"xs",variant:"ghost",color:"neutral",icon:"i-lucide-rotate-ccw",title:"Pick a different element",onClick:X})]),d("div",Un,[(n(!0),l(D,null,ne(t(Z),(de,De)=>(n(),P(it,{key:De,alt:de,copied:t(q)===`picked-${De}`,dense:!0,selectable:!0,selected:t(se)?.locator===de.locator,onCopy:dt=>fe(de.locator,`picked-${De}`),onSelect:dt=>ie(de)},null,8,["alt","copied","selected","onCopy","onSelect"]))),128))]),t(u).recommended?(n(),l("div",{key:0,class:"rounded-lg border border-primary/40 bg-primary/5 p-3 flex items-center gap-3 cursor-pointer",role:"button",tabindex:"0",title:"Select this locator for Confirm",onClick:v[6]||(v[6]=de=>ie(t(u).recommended)),onKeydown:v[7]||(v[7]=ge(he(de=>ie(t(u).recommended),["prevent"]),["enter"]))},[$(G,{name:"i-lucide-star",class:"size-5 text-primary shrink-0"}),d("div",En,[d("p",Mn," Recommended (score: "+p(t(u).recommended.score)+") ",1),d("code",jn,p(t(u).recommended.locator),1)]),$(le,{size:"sm",color:"primary",variant:"solid","trailing-icon":t(q)==="rec"?"i-lucide-check":"i-lucide-copy",onClick:v[5]||(v[5]=he(de=>fe(t(u).recommended.locator,"rec"),["stop"]))},{default:S(()=>[...v[20]||(v[20]=[L(" Copy ",-1)])]),_:1},8,["trailing-icon"])],32)):k("",!0)])):k("",!0)],64))]),footer:S(()=>[d("div",Nn,[t(x)==="review"?(n(),P(le,{key:0,size:"sm",variant:"outline",color:"neutral",icon:"i-lucide-rotate-ccw",onClick:X},{default:S(()=>[...v[21]||(v[21]=[L(" Pick a different element ",-1)])]),_:1})):(n(),l("div",Kn)),d("div",Vn,[$(le,{size:"sm",variant:"outline",color:"neutral",onClick:U},{default:S(()=>[...v[22]||(v[22]=[L("Cancel",-1)])]),_:1}),t(x)==="review"?(n(),P(le,{key:0,size:"sm",color:"primary",loading:t(V),disabled:!t(se),onClick:I},{default:S(()=>[...v[23]||(v[23]=[L(" Confirm pick ",-1)])]),_:1},8,["loading","disabled"])):k("",!0)])])]),_:1},8,["open"])}}}),Hn=Object.assign(Dn,{__name:"SnapshotLocatorPicker"});function Fn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function qn(e,r){let i=0,m=null;for(let o=r;o<e.length;o++){const a=e[o];if(m){if(a==="\\"){o++;continue}a===m&&(m=null);continue}if(a==="'"||a==='"'||a==="`"){m=a;continue}if(a==="(")i++;else if(a===")"&&(i--,i===0))return o}return-1}function Zn(e,r,i){if(!e||!r||!i)return null;const m=new RegExp(`${Fn(r)}\\s*\\(`,"g");let o;for(;(o=m.exec(e))!==null;){const a=o.index,s=a>0?e[a-1]:"";if(s&&/[A-Za-z0-9_$]/.test(s))continue;const g=a+o[0].lastIndexOf("("),c=qn(e,g);if(c===-1)return null;const h=e.slice(0,a)+i+e.slice(c+1);return h===e?null:{old:e,new:h}}return null}function Wn(e,r){return`${r?`@@ ${r} @@
|
|
1
|
+
import{d as oe,o as n,c as l,j as $,g as S,M as mt,i as d,T as Re,ac as ft,k as t,Q as ge,H as he,v as ye,f as P,p as re,q as k,m as L,t as p,F as D,G as pt,r as j,y as ne,s as Ie,_ as Me,h as w,z as ot,B as Be,ad as Le,C as st,b as gt,D as ht,l as Oe,O as Qe,A as qe,aa as Ae,x as vt,U as Ue,ae as Se,K as je,R as yt,ab as xt,af as bt,ag as kt,ah as _t,Z as $t,$ as wt}from"./DHltYerF.js";import{_ as Ze}from"./B2oUeBbA.js";import{q as Ct,u as St,e as Tt,f as We,v as at,l as Pe,k as Lt,w as At}from"./BeKvLsja.js";import{_ as It,a as zt}from"./DHXWp5yD.js";import{_ as Ne}from"./CN1mJlvD.js";import{_ as Bt}from"./B-5GukRk.js";import{u as Ge}from"./By4YL7mx.js";import{u as Ee}from"./DXbPFI1d.js";import{_ as Rt}from"./B1X__ilH.js";import{_ as Pt}from"./D6PUPmRC.js";import{_ as Ot}from"./BHpUiv6j.js";import{l as Ut,i as Et,b as Mt}from"./BVf6Yx9V.js";import{_ as rt}from"./swrbBdtB.js";import{_ as jt}from"./Dwws9U0D.js";const Nt={class:"flex items-center justify-between gap-2"},Kt=["aria-expanded","title"],Vt={class:"text-lg font-medium inline-flex items-center gap-1 shrink-0"},Dt={key:2,class:"min-w-0 flex-1 truncate text-sm text-gray-500 dark:text-gray-400"},Ht={key:0,class:"flex items-center gap-1 shrink-0"},Ft={key:0,class:"text-sm text-gray-500 mt-1 ml-11"},qt=oe({__name:"CollapsibleSectionCard",props:{title:{},icon:{},subtitle:{},count:{},iconClass:{default:"text-primary"},help:{},storageKey:{},defaultFolded:{type:Boolean,default:!0}},setup(e,{expose:r}){const i=e,{folded:m,toggle:o,setFolded:a}=Ut(`piwi-section-fold-${i.storageKey}`,i.defaultFolded),s=j(null);function g(){a(!1),pt(()=>s.value?.scrollIntoView({behavior:"smooth",block:"start"}))}return r({setFolded:a,reveal:g}),(c,h)=>{const C=ye,T=It,x=jt;return n(),l("div",{ref_key:"rootEl",ref:s,class:"scroll-mt-4"},[$(x,{ui:{header:"p-3 sm:px-4 sm:py-3",body:t(m)?"p-0 sm:p-0":""},class:re(t(m)&&"divide-y-0")},{header:S(()=>[d("div",Nt,[d("div",{class:"flex items-center gap-2 min-w-0 flex-1 cursor-pointer select-none rounded-sm outline-none focus-visible:outline-2 focus-visible:outline-primary",role:"button",tabindex:"0","aria-expanded":!t(m),title:t(m)?"Expand section":"Collapse section",onClick:h[1]||(h[1]=(...A)=>t(o)&&t(o)(...A)),onKeydown:[h[2]||(h[2]=ge((...A)=>t(o)&&t(o)(...A),["enter"])),h[3]||(h[3]=ge(he((...A)=>t(o)&&t(o)(...A),["prevent"]),["space"]))]},[$(C,{name:t(m)?"i-lucide-chevron-right":"i-lucide-chevron-down",class:"size-4 shrink-0 text-gray-400"},null,8,["name"]),e.icon?(n(),P(C,{key:0,name:e.icon,class:re(["size-5 shrink-0",e.iconClass])},null,8,["name","class"])):k("",!0),d("h3",Vt,[L(p(e.title),1),e.count!=null?(n(),l(D,{key:0},[L(" ("+p(e.count)+")",1)],64)):k("",!0)]),e.help?(n(),l("span",{key:1,onClick:h[0]||(h[0]=he(()=>{},["stop"]))},[$(T,{topic:e.help},null,8,["topic"])])):k("",!0),t(m)&&c.$slots.folded?(n(),l("span",Dt,[Re(c.$slots,"folded")])):k("",!0)],40,Kt),c.$slots.actions?(n(),l("div",Ht,[Re(c.$slots,"actions")])):k("",!0)]),!t(m)&&(e.subtitle||c.$slots.subtitle)?(n(),l("p",Ft,[Re(c.$slots,"subtitle",{},()=>[L(p(e.subtitle),1)])])):k("",!0)]),default:S(()=>[mt(d("div",null,[Re(c.$slots,"default")],512),[[ft,!t(m)]])]),_:3},8,["ui","class"])],512)}}}),Ke=Object.assign(qt,{__name:"CollapsibleSectionCard"}),Zt={class:"overflow-x-auto text-xs font-mono"},Wt=oe({__name:"DiffPatch",props:{patch:{}},setup(e){return(r,i)=>(n(),l("div",Zt,[(n(!0),l(D,null,ne(("parsePatchLines"in r?r.parsePatchLines:t(St))(e.patch),(m,o)=>(n(),l("div",{key:o,class:re(["px-3 py-px whitespace-pre leading-5 min-w-0",("patchLineClass"in r?r.patchLineClass:t(Ct))[m.type]])},p(m.text||" "),3))),128))]))}}),Gt=Object.assign(Wt,{__name:"DiffPatch"}),Yt=["role","aria-checked","tabindex"],Jt={class:"flex-1 min-w-0"},Qt=["title"],Xt={key:0,class:"text-[11px] leading-4 text-gray-500 truncate"},en=oe({__name:"LocatorAlternativeRow",props:{alt:{},note:{default:void 0},copied:{type:Boolean,default:!1},dense:{type:Boolean,default:!1},selectable:{type:Boolean,default:!1},selected:{type:Boolean,default:!1}},emits:["copy","select"],setup(e){const r=e;function i(a){return a>=80?"success":a>=50?"warning":"error"}function m(a){const{method:s,score:g,args:c}=a;return c&&(c.anchorTestId||c.anchorSelector||c.anchorRole)?"scoped to a stable ancestor — survives renames":g>=100?"most stable — purpose-built for testing":s==="getByRole"&&c&&!("name"in c)?"name-free role — survives renames":s==="getByRole"?"browser ARIA tree — semantic and stable":s==="getByLabel"?"associated <label> element":s==="getByPlaceholder"?"input placeholder":s==="getByText"?"visible text":s==="getByAltText"?"image alt text":s==="getByTitle"?"title attribute":s==="locator"&&g>=50?"stable selector":s==="locator"?"CSS class — may be fragile":""}const o=w(()=>r.note??m(r.alt));return(a,s)=>{const g=Ie,c=ye,h=Me;return n(),l("div",{class:re(["flex items-center gap-2 rounded border",[e.dense?"py-1 px-2":"py-1.5 px-2.5",e.selectable?"cursor-pointer hover:bg-elevated transition-colors focus-visible:outline-2 focus-visible:outline-primary":"",e.selectable&&e.selected?"border-primary/60 ring-1 ring-primary/50":"border-default/50"]]),role:e.selectable?"radio":void 0,"aria-checked":e.selectable?e.selected:void 0,tabindex:e.selectable?0:void 0,onClick:s[1]||(s[1]=C=>e.selectable&&a.$emit("select")),onKeydown:[s[2]||(s[2]=ge(he(C=>e.selectable&&a.$emit("select"),["prevent"]),["enter"])),s[3]||(s[3]=ge(he(C=>e.selectable&&a.$emit("select"),["prevent"]),["space"]))]},[$(g,{size:"xs",color:i(e.alt.score),variant:"subtle",class:re(["shrink-0 font-mono tabular-nums cursor-default text-center",e.dense?"min-w-[2.25rem]":"min-w-[2.5rem]"]),title:`Stability score: ${e.alt.score}/100`},{default:S(()=>[L(p(e.alt.score),1)]),_:1},8,["color","class","title"]),d("div",Jt,[d("code",{class:"text-xs font-mono block truncate",title:e.alt.locator},p(e.alt.locator),9,Qt),t(o)?(n(),l("p",Xt,p(t(o)),1)):k("",!0)]),e.alt.pickedByUser&&e.dense?(n(),P(c,{key:0,name:"i-lucide-user-check",class:"size-3.5 text-primary shrink-0",title:"Confirmed with the locator picker"})):e.alt.pickedByUser?(n(),P(g,{key:1,size:"xs",color:"primary",variant:"subtle",icon:"i-lucide-user-check",class:"shrink-0",title:"Confirmed with the locator picker on the failing page"})):k("",!0),$(h,{size:"xs",variant:"ghost",color:"neutral",icon:e.copied?"i-lucide-check":"i-lucide-copy",title:e.copied?"Copied!":"Copy",class:"shrink-0",onClick:s[0]||(s[0]=he(C=>a.$emit("copy"),["stop"]))},null,8,["icon","title"])],42,Yt)}}}),it=Object.assign(en,{__name:"LocatorAlternativeRow"}),Xe={getByTestId:"testid",getByRole:"semantic",getByLabel:"label",getByPlaceholder:"label",getByText:"text",getByAltText:"text",getByTitle:"text",locator:"css","page.locator":"css"},tn=50;function lt(e,r,i=tn){const m=r[0]??null;if(!m)return{recommended:null,durable:null,preservesConvention:!1,hasDurableAlternative:!1,suggestAddTestId:!1};const o=e?Xe[e]:void 0,a=(e?r.find(c=>c.method===e&&c.score>=i):void 0)??(o?r.find(c=>Xe[c.method]===o&&c.score>=i):void 0),g=r.find(c=>c.pickedByUser)??a??m;return{recommended:g,durable:m,preservesConvention:!!a&&g===a,hasDurableAlternative:g.locator!==m.locator,suggestAddTestId:m.score<i}}const ct={a:"link",button:"button",nav:"navigation",main:"main",article:"article",section:"region",form:"form",img:"img",figure:"figure",figcaption:"caption",blockquote:"blockquote",table:"table",ul:"list",ol:"list",li:"listitem",dialog:"dialog",output:"status",progress:"progressbar",meter:"meter",textarea:"textbox",h1:"heading",h2:"heading",h3:"heading",h4:"heading",h5:"heading",h6:"heading",details:"group",summary:"button",search:"search"},nn={button:"button",submit:"button",reset:"button",image:"button",checkbox:"checkbox",radio:"radio",range:"slider",search:"searchbox",number:"spinbutton",text:"textbox",email:"textbox",tel:"textbox",url:"textbox",password:"textbox"},on=["id","class","name","data-testid","placeholder","alt","title","aria-label","aria-level","role","type","href","multiple"];function sn(e){const r=e.attributes.role;if(r)return r;const i=e.tagName;if(!i)return null;if(i==="input"){const m=(e.attributes.type??"text").toLowerCase();return nn[m]??"textbox"}return i==="select"?e.attributes.multiple!=null?"listbox":"combobox":i==="a"?e.attributes.href!=null?"link":null:ct[i]??null}function an(e,r){if(r!=="heading")return null;const i=e.tagName.match(/^h([1-6])$/);if(i)return Number(i[1]);const m=e.attributes["aria-level"];return m&&/^\d+$/.test(m)?Number(m):null}const $e=(e,r)=>e.attributes[r]||null,pe=e=>e.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),He=e=>e.replace(/\\/g,"\\\\").replace(/"/g,'\\"'),et=e=>/^[A-Za-z][A-Za-z0-9_-]*$/.test(e);function rn(e){return/[a-f0-9]{8,}/i.test(e)?10:/^(?:css|sc|emotion|styled)-/i.test(e)?15:/^(bg|text|border|shadow|opacity|font|w-|h-|m[tblrxy]?-|p[tblrxy]?-|flex|grid|gap|rounded|absolute|relative|fixed|sticky|block|inline|hidden|overflow|z-|top-|right-|bottom-|left-|inset-|justify-|items-|self-|content-|order-|col-|row-)/.test(e)?25:/__/.test(e)||/--/.test(e)?35:/^[a-z]+(-[a-z]+)+$/.test(e)||/^[a-z]+[A-Z][a-zA-Z]+$/.test(e)?40:(e.includes("_")||/^[a-z]+-[a-z0-9]{5,}$/.test(e)&&/[0-9]/.test(e),15)}function tt(e){return!!(/^[a-f0-9]{8}-([a-f0-9]{4}-){3}[a-f0-9]{12}$/i.test(e)||/^[a-f0-9]{8,}$/i.test(e)||/^[a-z]+-\d+$/.test(e)||/^(emotion-|styled-|css-|sc-)/.test(e)||e.startsWith("ng-")||/^(radix-|headlessui-|mui-|mantine-|chakra-)/i.test(e)||/^:r[0-9a-z]+:$/i.test(e)||/^«r[0-9a-z]+»$/i.test(e))}function ln(e){const r=[],i=new Set,m=y=>{i.has(y.locator)||(i.add(y.locator),r.push(y))},{accessibleName:o}=e,a=e.tagName,s=sn(e),g=e.selectorCounts,c=y=>y==null||y<=1,h=e.textContent?e.textContent.replace(/\s+/g," ").trim():null,C=$e(e,"data-testid");C&&c(g?.testId)&&m({locator:`getByTestId('${pe(C)}')`,method:"getByTestId",args:{testId:C},score:100});const T=an(e,s),x=T!=null?`, level: ${T}`:"",A=y=>T!=null?{...y,level:T}:y;s&&o&&m({locator:`getByRole('${s}', { name: '${pe(o)}'${x} })`,method:"getByRole",args:A({role:s,name:o}),score:90});const z=$e(e,"aria-label");if(s&&z&&z!==o&&m({locator:`getByRole('${s}', { name: '${pe(z)}'${x} })`,method:"getByRole",args:A({role:s,name:z}),score:85}),o&&["input","select","textarea"].includes(a)){const y=$e(e,"aria-label");(e.hasLabel===void 0||e.hasLabel===!0||y===o)&&m({locator:`getByLabel('${pe(o)}')`,method:"getByLabel",args:{label:o},score:85})}const B=$e(e,"placeholder");B&&m({locator:`getByPlaceholder('${pe(B)}')`,method:"getByPlaceholder",args:{placeholder:B},score:80}),h&&h.length<80&&m({locator:`getByText('${pe(h)}')`,method:"getByText",args:{text:h},score:75});const Z=$e(e,"id");if(Z&&!tt(Z)&&c(g?.id)){const y=et(Z)?`#${Z}`:`[id="${He(Z)}"]`;m({locator:`locator('${pe(y)}')`,method:"locator",args:{selector:y},score:65})}const Y=$e(e,"name");if(Y&&c(g?.name)){const y=`[name="${He(Y)}"]`;m({locator:`locator('${pe(y)}')`,method:"locator",args:{selector:y},score:60})}const E=$e(e,"alt");E&&m({locator:`getByAltText('${pe(E)}')`,method:"getByAltText",args:{text:E},score:60});const O=$e(e,"title");O&&m({locator:`getByTitle('${pe(O)}')`,method:"getByTitle",args:{title:O},score:50});const ce=!!(C&&c(g?.testId));if(s&&!ce){const y=T!=null?`'${s}', { level: ${T} }`:`'${s}'`,H=A({role:s});let M=!1,K=!1,W=!1;for(const Q of e.ancestors??[]){if(Q.scopedRoleCount!==1)continue;if(!M&&Q.testId&&Q.testIdCount===1&&(M=!0,m({locator:`getByTestId('${pe(Q.testId)}').getByRole(${y})`,method:"getByRole",args:{...H,anchorTestId:Q.testId},score:72})),!K&&Q.id&&!tt(Q.id)&&Q.idCount===1){K=!0;const xe=et(Q.id)?`#${Q.id}`:`[id="${He(Q.id)}"]`;m({locator:`locator('${pe(xe)}').getByRole(${y})`,method:"getByRole",args:{...H,anchorSelector:xe},score:64})}const ve=Q.role||ct[Q.tag]||null;!W&&ve&&ve!==s&&Q.roleCount===1&&(W=!0,m({locator:`getByRole('${pe(ve)}').getByRole(${y})`,method:"getByRole",args:{...H,anchorRole:ve},score:55}))}const F=e.rolePosition;F&&F.role===s&&(F.count===1||T!=null&&F.levelCount===1)&&m({locator:`getByRole(${y})`,method:"getByRole",args:H,score:58})}const ee=$e(e,"class");if(ee){const y=g?.classes,H=ee.split(/\s+/).filter(M=>M.length>1&&/^[A-Za-z_-][A-Za-z0-9_-]*$/.test(M)&&c(y?.[M])).map(M=>({cls:M,score:rn(M)})).sort((M,K)=>K.score-M.score).slice(0,3);for(const{cls:M,score:K}of H)m({locator:`locator('.${pe(M)}')`,method:"locator",args:{selector:`.${M}`},score:K})}return r.sort((y,H)=>H.score-y.score)}function cn(e){const r=e.attributes,i=r["aria-label"];if(i)return i;if(e.textContent)return e.textContent;const m=r.title;if(m)return m;const o=r.placeholder;return o||null}function un(e){if(window.__piwiPickerInstalled)return;window.__piwiPickerInstalled=!0;var r=document,i=window,m=2147483600,o=e.probedAttrs,a=r.createElement("div");a.id="__piwi_picker_highlight",a.style.cssText="position:fixed;pointer-events:none;z-index:"+m+";display:none;box-sizing:border-box;border:2px solid #7c3aed;background:rgba(124,58,237,.12);border-radius:3px;",r.body.appendChild(a);var s=r.createElement("div");s.id="__piwi_picker_banner",s.style.cssText="position:fixed;top:12px;left:50%;transform:translateX(-50%);z-index:"+(m+2)+";background:#111827;color:#f9fafb;font:13px/1.5 system-ui,sans-serif;padding:10px 16px;border-radius:8px;box-shadow:0 4px 24px rgba(0,0,0,.4);max-width:80vw;",s.innerHTML='<div>Click an element to generate locators</div><div style="color:#9ca3af;margin-top:3px;font-size:11px">↑ parent · ↓ child · Esc skip</div>',r.body.appendChild(s),i.parent.postMessage({type:"pickerReady"},"*");function g(u){var b=(u.tagName||"?").toLowerCase(),I=u.getAttribute&&u.getAttribute("data-testid");if(I)return"getByTestId('"+I+"')";if(u.labels&&u.labels.length>0){var U=(u.labels[0].textContent||"").replace(/\s+/g," ").trim().slice(0,80);if(U)return"getByLabel('"+U+"')"}var X=u.getAttribute&&u.getAttribute("aria-label");if(X)return"getByLabel('"+X+"')";var J=u.getAttribute&&u.getAttribute("placeholder");if(J)return"getByPlaceholder('"+J+"')";var q=u.getAttribute&&u.getAttribute("alt");if(q)return"getByAltText('"+q+"')";var ae=u.getAttribute&&u.getAttribute("title");if(ae)return"getByTitle('"+ae+"')";if(u.id)return"locator('#"+u.id+"')";var fe=(u.getAttribute&&u.getAttribute("class")||"").split(/\s+/).find(function(_){return _.length>1});return fe?"locator('."+fe+"')":b}function c(u){for(var b=[],I=u;I&&b.length<15;){var U=(I.tagName||"").toLowerCase();if(U==="body"||U==="html")break;b.push(I),I=I.parentElement}return b.length?b:[u]}var h=["button","a","input","select","textarea","summary","option"];function C(u){for(var b=0;b<Math.min(u.length,4);b++){var I=u[b],U=(I.tagName||"").toLowerCase();if(h.indexOf(U)!==-1||I.getAttribute&&(I.getAttribute("role")||I.getAttribute("data-testid")))return b}return 0}var T=[],x=0,A=null;function z(){return T[x]||null}function B(){var u=z();if(!u){a.style.display="none";return}var b=u.getBoundingClientRect();a.style.display="block",a.style.left=b.left+"px",a.style.top=b.top+"px",a.style.width=b.width+"px",a.style.height=b.height+"px";var I=r.getElementById("__piwi_picker_foot");I&&(I.textContent=g(u)+" — click to pick · ↑ parent · ↓ child · Esc skip")}var Z=s.querySelector("[style*=margin]");Z&&(Z.id="__piwi_picker_foot");function Y(u){for(var b={},I=0;I<o.length;I++){var U=o[I],X=u.getAttribute(U)||u[U];b[U]=typeof X=="string"?X.slice(0,200):X?String(X).slice(0,200):null}var J=u.getBoundingClientRect(),q={};try{var ae=function(we){return i.CSS.escape(we)},fe=function(we){try{return r.querySelectorAll(we).length}catch{return}};b["data-testid"]&&(q.testId=fe("[data-testid="+JSON.stringify(b["data-testid"])+"]")),b.id&&(q.id=fe("#"+ae(b.id))),b.name&&(q.name=fe("[name="+JSON.stringify(b.name)+"]"));var _=(b.class||"").split(/\s+/).filter(function(we){return we.length>1}).slice(0,10);if(_.length>0){for(var v={},G=0;G<_.length;G++){var le=fe("."+ae(_[G]));le!==void 0&&(v[_[G]]=le)}q.classes=v}}catch{}var Ve=null;return u.labels&&u.labels.length>0&&(Ve=(u.labels[0].textContent||"").replace(/\s+/g," ").trim().slice(0,120)||null),{tagName:(u.tagName||"").toLowerCase(),attributes:b,textContent:(u.textContent||"").replace(/\s+/g," ").trim().slice(0,80)||null,center:{x:Math.round(J.x+J.width/2),y:Math.round(J.y+J.height/2)},hasLabel:!!(u.labels&&u.labels.length>0),labelText:Ve,selectorCounts:q}}function E(u){u.preventDefault(),u.stopImmediatePropagation()}function O(u){return u===s||u===a||s.contains&&s.contains(u)||u&&u.__piwiHint}var ce="top";function ee(u){ce!==u&&(ce=u,u==="bottom"?(s.style.top="auto",s.style.bottom="12px"):(s.style.top="12px",s.style.bottom="auto"))}function y(u){var b=u.target;if(!b||O(b)){a.style.display="none";return}b!==A&&(A=b,T=c(b),x=C(T)),B();var I=z();if(I){var U=I.getBoundingClientRect(),X=s.getBoundingClientRect(),J=8;U.left<X.right+J&&U.right>X.left-J&&U.top<X.bottom+J&&U.bottom>X.top-J&&ee(ce==="top"?"bottom":"top")}}function H(u){if(u==="Escape"){Te();return}u==="ArrowUp"&&(x=Math.min(x+1,T.length-1),B()),u==="ArrowDown"&&(x=Math.max(x-1,0),B())}function M(u){(u.key==="Escape"||u.key==="ArrowUp"||u.key==="ArrowDown")&&(E(u),H(u.key))}var K=[];function W(){for(var u=0;u<K.length;u++)K[u].parentNode&&K[u].parentNode.removeChild(K[u]);K=[]}function F(u){return(u||"").replace(/\s+/g," ").trim().toLowerCase()}function Q(u){var b=F(u);if(b.length<2)return[];for(var I=r.querySelectorAll("button,a,[role],h1,h2,h3,h4,h5,h6,label,summary,input,textarea,select,option,span,li,td,th,p"),U=[],X=[],J=0;J<I.length;J++){var q=I[J],ae=F(q.textContent);if(!ae){var fe=F(q.getAttribute&&(q.getAttribute("placeholder")||q.getAttribute("aria-label"))||"");fe&&(fe===b||fe.indexOf(b)!==-1)&&U.push(q);continue}ae.length>120||(ae===b?U.push(q):ae.indexOf(b)!==-1&&ae.length<b.length+30&&X.push(q))}return U.concat(X)}function ve(u,b){var I=u.getBoundingClientRect();if(I.width===0&&I.height===0)return null;var U=r.createElement("div");return U.__piwiHint=!0,U.style.cssText="position:fixed;pointer-events:none;z-index:"+(m+1)+";box-sizing:border-box;border-radius:3px;transition:opacity .3s;border:2px solid "+b+";box-shadow:0 0 0 3px "+b+"55;left:"+I.left+"px;top:"+I.top+"px;width:"+I.width+"px;height:"+I.height+"px;",r.body.appendChild(U),K.push(U),U}function xe(u){var b=u.getBoundingClientRect();i.parent.postMessage({type:"piwiScrollTo",y:b.top},"*")}function ze(u){if(W(),!(!u||!u.length)){for(var b=null,I=0;I<u.length;I++)for(var U=u[I],X=Q(U&&U.text),J=0;J<Math.min(X.length,3);J++)ve(X[J],"#f59e0b"),b||(b=X[J]);b&&xe(b),setTimeout(function(){for(var q=0;q<K.length;q++)K[q].style.opacity="0"},2600),setTimeout(W,3e3)}}var te=[],ke=0;function R(){i.parent.postMessage({type:"piwiSearchResult",count:te.length,index:te.length?ke:-1},"*")}function f(){W();var u=te[ke];u&&(ve(u,"#7c3aed"),xe(u),R())}function N(u){if(te=Q(u),ke=0,!te.length){W(),R();return}f()}function be(){te.length&&(ke=(ke+1)%te.length,f())}function me(u){var b=u.data;if(!(!b||typeof b.type!="string")){if(b.type==="piwiPickerKey"&&typeof b.key=="string")H(b.key);else if(b.type==="piwiHighlight")try{ze(b.hints)}catch{}else if(b.type==="piwiSearch")try{N(b.q)}catch{}else if(b.type==="piwiSearchNext")try{be()}catch{}else if(b.type==="piwiClearHints")try{W()}catch{}}}function ue(u){E(u);var b=z();if(!(!b||O(u.target))){var I=Y(b);a.style.display="none",W(),s.innerHTML='<div style="text-align:center;color:#9ca3af;">Analyzing element…</div>',Ce(),i.parent.postMessage({type:"elementPicked",attrs:I},"*")}}var _e=["mousedown","mouseup","pointerdown","pointerup","auxclick","dblclick"];function Ce(){r.removeEventListener("mousemove",y,!0),r.removeEventListener("click",ue,!0),r.removeEventListener("keydown",M,!0),i.removeEventListener("message",me,!1);for(var u=0;u<_e.length;u++)r.removeEventListener(_e[u],E,!0)}function Te(){Ce(),W(),a.remove(),s.remove(),i.parent.postMessage({type:"pickerClosed"},"*")}r.addEventListener("mousemove",y,!0),r.addEventListener("click",ue,!0),r.addEventListener("keydown",M,!0),i.addEventListener("message",me,!1);for(var se=0;se<_e.length;se++)r.addEventListener(_e[se],E,!0);function V(){var u=Math.max(r.documentElement?r.documentElement.scrollHeight:0,r.body?r.body.scrollHeight:0);u>0&&i.parent.postMessage({type:"piwiContentHeight",height:u},"*")}V();try{if(i.ResizeObserver){var ie=new i.ResizeObserver(V);r.documentElement&&ie.observe(r.documentElement),r.body&&ie.observe(r.body)}}catch{}}function dn(e){const r=[],i=new Set,m=a=>{if(typeof a!="string")return;const s=a.trim();if(s.length<2||s.length>80)return;const g=s.toLowerCase();i.has(g)||(i.add(g),r.push({text:s}))},o=a=>a&&(a.name??a.text??a.label??a.placeholder??a.alt??a.title);m(o(e.failingLocator?.args));for(const a of e.fromElementMatch??[])m(o(a.args));for(const a of e.fromAriaSnapshot??[])m(o(a.args));return r.slice(0,6)}function mn(e){return`<script>(${String(un).replace(/<\/(script)/gi,"<\\/$1")})(${JSON.stringify(e)})<\/script>`}function fn(e){return e.replace(/<base\b[^>]*>/gi,"")}function pn(e,r){return fn(e)+mn(r)}const gn={key:0,class:"flex items-center justify-center py-20"},hn={key:1,class:"py-8 text-center"},vn={class:"text-xs text-gray-400 mt-1"},yn={key:2,class:"py-8 text-center"},xn={class:"mb-2 flex items-center gap-2 flex-wrap"},bn={key:1,class:"ml-auto inline-flex rounded-md border border-default overflow-hidden text-xs"},kn={key:0,class:"flex items-center gap-1 mb-1.5 text-xs text-gray-500"},_n={class:"tabular-nums w-11 text-center select-none"},$n={class:"ml-auto text-gray-400 tabular-nums"},wn={key:1,class:"flex items-center gap-2 mb-1.5"},Cn={key:0,class:"text-xs text-gray-500 tabular-nums"},Sn={key:1,class:"text-xs text-gray-400"},Tn={key:0,class:"absolute inset-0 flex items-center justify-center bg-white dark:bg-gray-900 z-10"},Ln=["src"],An={key:2,class:"mt-4 space-y-3"},In={class:"flex items-center gap-3 bg-elevated rounded-lg p-3"},zn={class:"flex-1 min-w-0"},Bn={class:"text-sm font-medium"},Rn={class:"text-xs"},Pn={key:0,class:"text-xs text-gray-400 ml-1"},On={key:0,class:"text-xs text-gray-500 mt-0.5 truncate"},Un={class:"space-y-1",role:"radiogroup","aria-label":"Alternative locators"},En={class:"flex-1 min-w-0"},Mn={class:"text-xs font-medium text-primary"},jn={class:"text-sm font-mono block truncate mt-0.5"},Nn={class:"flex justify-between w-full"},Kn={key:1},Vn={class:"flex gap-2"},Dn=oe({__name:"SnapshotLocatorPicker",props:qe({runId:{},testRunsCaseId:{},failingLocator:{},healing:{}},{open:{type:Boolean,required:!0},openModifiers:{}}),emits:qe(["close","confirmed"],["update:open"]),setup(e,{emit:r}){const i=e,m=r,o=ot(e,"open"),a=j(!1),s=j(null),g=j(null),c=j(void 0);async function h(){a.value=!0,g.value=null;try{const _=c.value?`?source=${c.value}`:"";s.value=await $fetch(`/api/test-runs/${i.runId}/cases/${i.testRunsCaseId}/dom-snapshot${_}`),s.value?.source&&(c.value=s.value.source)}catch(_){g.value=_ instanceof Error?_.message:"Unknown error"}finally{a.value=!1}}const C=w(()=>s.value?.availableSources??[]);function T(_){_===c.value||a.value||(c.value=_,z.value=!1,x.value="pick-element",ee.value=0,H.value=!1,B.value=null,Z.value=[],se.value=null,N.value="",be.value=0,me.value=-1,h())}Be(o,_=>{_&&(s.value=null,z.value=!1,x.value="pick-element",ee.value=0,H.value=!1,c.value=void 0,B.value=null,Z.value=[],se.value=null,N.value="",be.value=0,me.value=-1,h())});const x=j("pick-element"),A=j(null),z=j(!1),B=j(null),Z=j([]),Y=j(void 0);function E(_){return URL.createObjectURL(new Blob([pn(_,{probedAttrs:on})],{type:"text/html"}))}Be(()=>s.value?.html,_=>{Y.value&&(URL.revokeObjectURL(Y.value),Y.value=void 0),_&&(Y.value=E(_))},{immediate:!0});const O=j(null),ce=j(0),ee=j(0),y=j(1),H=j(!1),M=w(()=>s.value?.viewport??null),K=w(()=>{const _=M.value;return!_?.width||!ce.value?1:Math.min(ce.value/_.width,1)}),W=w(()=>{const _=M.value;if(!_)return{width:"100%",height:ee.value?`${ee.value}px`:"100%"};const v=ee.value||_.height;return{width:`${Math.round(_.width*y.value)}px`,height:`${Math.round(v*y.value)}px`}}),F=w(()=>{const _=M.value;if(!_)return{width:"100%",height:ee.value?`${ee.value}px`:"100%",border:"0"};const v=ee.value||_.height;return{width:`${_.width}px`,height:`${v}px`,transform:`scale(${y.value})`,transformOrigin:"top left",border:"0"}}),Q=w(()=>Math.round(y.value*100)),ve=_=>Math.min(4,Math.max(.1,_));function xe(_){H.value=!0,y.value=ve(y.value*_)}function ze(){H.value=!1,y.value=K.value}Be([K,M],()=>{H.value||(y.value=K.value)});let te=null;Be(O,_=>{te?.disconnect(),_&&(ce.value=_.clientWidth,te=new ResizeObserver(v=>{for(const G of v)ce.value=G.contentRect.width}),te.observe(_))}),Le(()=>{te?.disconnect()}),Le(()=>{Y.value&&URL.revokeObjectURL(Y.value)});function ke(_){if(!A.value||_.source!==A.value.contentWindow)return;const v=_.data;if(v?.type==="pickerReady"){z.value=!0,f();return}if(v?.type==="piwiContentHeight"&&typeof v.height=="number"){ee.value=Math.max(v.height,M.value?.height??0);return}if(v?.type==="piwiScrollTo"&&typeof v.y=="number"){const G=O.value;G&&G.scrollTo({top:Math.max(0,v.y*y.value-80),behavior:"smooth"});return}if(v?.type==="piwiSearchResult"){be.value=typeof v.count=="number"?v.count:0,me.value=typeof v.index=="number"?v.index:-1;return}if(v?.type==="elementPicked"&&v.attrs){const{labelText:G,...le}=v.attrs;B.value={...le,accessibleName:G??cn(le)},Z.value=ln(B.value),se.value=null,x.value="review"}v?.type==="pickerClosed"&&U()}function R(_){A.value?.contentWindow?.postMessage(_,"*")}function f(){const _=dn({failingLocator:i.failingLocator,fromElementMatch:i.healing?.fromElementMatch??null,fromAriaSnapshot:i.healing?.fromAriaSnapshot??null});_.length&&R({type:"piwiHighlight",hints:_})}const N=j(""),be=j(0),me=j(-1);let ue=null;Be(N,_=>{ue&&clearTimeout(ue),ue=setTimeout(()=>R({type:"piwiSearch",q:_}),180)});function _e(){R({type:"piwiSearchNext"})}Le(()=>{ue&&clearTimeout(ue)});function Ce(_){if(!o.value||x.value!=="pick-element"||!z.value||_.key!=="ArrowUp"&&_.key!=="ArrowDown")return;const v=(document.activeElement?.tagName??"").toLowerCase();if(v==="input"||v==="textarea")return;const G=A.value?.contentWindow;G&&(_.preventDefault(),G.postMessage({type:"piwiPickerKey",key:_.key},"*"))}function Te(){A.value&&(A.value.src="about:blank")}st(()=>{window.addEventListener("message",ke),window.addEventListener("keydown",Ce,!0)}),Le(()=>{window.removeEventListener("message",ke),window.removeEventListener("keydown",Ce,!0)});const se=j(null),V=j(!1);function ie(_){se.value=_}const u=w(()=>lt(i.failingLocator.method,Z.value)),b=gt();async function I(){if(se.value){V.value=!0;try{(await $fetch(`/api/test-runs/${i.runId}/cases/${i.testRunsCaseId}/locator-pick`,{method:"POST",body:{failingLocator:i.failingLocator,pickedLocator:se.value,element:B.value}})).status==="ok"?m("confirmed",se.value):b.add({title:"Pick not saved",description:"This failure has no call-site or locator signature to attach the pick to.",color:"warning",icon:"i-lucide-alert-triangle"}),o.value=!1}catch(_){b.add({title:"Could not save the pick",description:Tt(_),color:"error",icon:"i-lucide-alert-triangle"})}finally{V.value=!1}}}function U(){Te(),o.value=!1}function X(){B.value=null,Z.value=[],se.value=null,x.value="pick-element",z.value=!1,N.value="",be.value=0,me.value=-1;const _=s.value?.html;_&&(Y.value&&URL.revokeObjectURL(Y.value),Y.value=E(_))}const{copy:J}=Ge(),q=j(null);let ae=null;function fe(_,v){J(_,{toast:"Locator copied"}),q.value=v,ae&&clearTimeout(ae),ae=setTimeout(()=>{q.value=null},2e3)}return Le(()=>{ae&&clearTimeout(ae)}),(_,v)=>{const G=ye,le=Me,Ve=ht,we=Ie,Je=Bt;return n(),P(Je,{open:o.value,"onUpdate:open":v[8]||(v[8]=de=>o.value=de),ui:{content:"max-w-6xl w-[95vw]"},onAfterLeave:U},{header:S(()=>[...v[9]||(v[9]=[d("div",null,[d("h3",{class:"text-lg font-medium"},"Pick a locator from the DOM snapshot"),d("p",{class:"text-sm text-gray-500 mt-0.5"}," Click the element the failing locator should target. Use ↑↓ to walk the DOM tree. ")],-1)])]),body:S(()=>[t(a)?(n(),l("div",gn,[$(G,{name:"i-lucide-loader",class:"size-6 animate-spin text-gray-400"}),v[10]||(v[10]=d("span",{class:"ml-2 text-sm text-gray-500"},"Loading DOM snapshot...",-1))])):t(g)?(n(),l("div",hn,[$(G,{name:"i-lucide-alert-triangle",class:"size-8 text-red-300 mx-auto mb-2"}),v[12]||(v[12]=d("p",{class:"text-sm text-red-500"},"Failed to load snapshot",-1)),d("p",vn,p(t(g)),1),$(le,{size:"xs",variant:"outline",color:"neutral",class:"mt-3",onClick:h},{default:S(()=>[...v[11]||(v[11]=[L("Retry",-1)])]),_:1})])):t(s)?.status!=="ok"||!t(s).html?(n(),l("div",yn,[$(G,{name:"i-lucide-file-x",class:"size-8 text-gray-300 mx-auto mb-2"}),v[13]||(v[13]=d("p",{class:"text-sm text-gray-500"},"No DOM snapshot or ARIA data available for this execution",-1)),v[14]||(v[14]=d("p",{class:"text-xs text-gray-400 mt-1"},"This test run has no stored trace or ARIA snapshot to pick from.",-1))])):(n(),l(D,{key:3},[d("div",xn,[t(s).source?(n(),l("div",{key:0,class:re(["text-xs flex items-center gap-1",t(s).source==="aria"?"text-amber-600 dark:text-amber-400":"text-green-600 dark:text-green-400"])},[$(G,{name:t(s).source==="aria"?"i-lucide-accessibility":"i-lucide-check",class:"size-3.5 shrink-0"},null,8,["name"]),t(s).source==="aria"?(n(),l(D,{key:0},[L(" Accessibility tree from the failure-time ARIA snapshot — element styles are approximate ")],64)):(n(),l(D,{key:1},[L(" Rendered from the failure-time DOM snapshot ")],64))],2)):k("",!0),t(C).length>1?(n(),l("div",bn,[d("button",{type:"button",class:re(["px-2 py-1 flex items-center gap-1 transition-colors",t(c)==="dom"?"bg-primary/10 text-primary font-medium":"text-gray-500 hover:bg-elevated"]),title:"Rendered page from the trace",onClick:v[0]||(v[0]=de=>T("dom"))},[$(G,{name:"i-lucide-layout-panel-top",class:"size-3.5"}),v[15]||(v[15]=L(" DOM ",-1))],2),d("button",{type:"button",class:re(["px-2 py-1 flex items-center gap-1 border-l border-default transition-colors",t(c)==="aria"?"bg-primary/10 text-primary font-medium":"text-gray-500 hover:bg-elevated"]),title:"Accessibility tree from the ARIA snapshot",onClick:v[1]||(v[1]=de=>T("aria"))},[$(G,{name:"i-lucide-accessibility",class:"size-3.5"}),v[16]||(v[16]=L(" Tree ",-1))],2)])):k("",!0)]),t(M)?(n(),l("div",kn,[$(le,{size:"xs",variant:"ghost",color:"neutral",icon:"i-lucide-zoom-out",title:"Zoom out",onClick:v[2]||(v[2]=de=>xe(1/1.25))}),d("span",_n,p(t(Q))+"%",1),$(le,{size:"xs",variant:"ghost",color:"neutral",icon:"i-lucide-zoom-in",title:"Zoom in",onClick:v[3]||(v[3]=de=>xe(1.25))}),$(le,{size:"xs",variant:"outline",color:"neutral",class:"ml-1",onClick:ze},{default:S(()=>[...v[17]||(v[17]=[L("Fit",-1)])]),_:1}),d("span",$n,p(t(M).width)+"×"+p(t(M).height),1)])):k("",!0),t(x)==="pick-element"?(n(),l("div",wn,[$(Ve,{modelValue:t(N),"onUpdate:modelValue":v[4]||(v[4]=de=>Oe(N)?N.value=de:null),size:"xs",icon:"i-lucide-search",placeholder:"Find an element by its text…",class:"max-w-xs",onKeydown:ge(he(_e,["prevent"]),["enter"])},null,8,["modelValue","onKeydown"]),t(N)&&t(be)>0?(n(),l("span",Cn,p(t(me)+1)+"/"+p(t(be)),1)):t(N)?(n(),l("span",Sn,"no matches")):k("",!0),t(be)>1?(n(),P(le,{key:2,size:"xs",variant:"ghost",color:"neutral",icon:"i-lucide-chevron-down",title:"Next match (Enter)",onClick:_e})):k("",!0)])):k("",!0),d("div",{ref_key:"stageRef",ref:O,class:re(["relative border border-default rounded-lg overflow-auto",[t(x)==="pick-element"?"h-[75vh]":"h-80",t(M)?"bg-gray-100 dark:bg-gray-800":""]])},[t(z)?k("",!0):(n(),l("div",Tn,[$(G,{name:"i-lucide-loader",class:"size-5 animate-spin text-gray-400"}),v[18]||(v[18]=d("span",{class:"ml-2 text-sm text-gray-500"},"Initializing picker...",-1))])),d("div",{style:Qe(t(W))},[d("iframe",{ref_key:"iframeRef",ref:A,src:t(Y),style:Qe(t(F)),class:"bg-white",sandbox:"allow-scripts",title:"DOM snapshot"},null,12,Ln)],4)],2),t(x)==="review"&&t(B)?(n(),l("div",An,[d("div",In,[$(G,{name:"i-lucide-crosshair",class:"size-5 text-primary shrink-0"}),d("div",zn,[d("p",Bn,[v[19]||(v[19]=L(" Picked: ",-1)),d("code",Rn,p(t(B).tagName),1),t(B).attributes.id?(n(),l("code",Pn,"#"+p(t(B).attributes.id),1)):k("",!0),t(B).attributes["data-testid"]?(n(),P(we,{key:1,size:"xs",color:"primary",variant:"subtle",class:"ml-1"},{default:S(()=>[L(p(t(B).attributes["data-testid"]),1)]),_:1})):k("",!0)]),t(B).textContent?(n(),l("p",On,' "'+p(t(B).textContent)+'" ',1)):k("",!0)]),$(le,{size:"xs",variant:"ghost",color:"neutral",icon:"i-lucide-rotate-ccw",title:"Pick a different element",onClick:X})]),d("div",Un,[(n(!0),l(D,null,ne(t(Z),(de,De)=>(n(),P(it,{key:De,alt:de,copied:t(q)===`picked-${De}`,dense:!0,selectable:!0,selected:t(se)?.locator===de.locator,onCopy:dt=>fe(de.locator,`picked-${De}`),onSelect:dt=>ie(de)},null,8,["alt","copied","selected","onCopy","onSelect"]))),128))]),t(u).recommended?(n(),l("div",{key:0,class:"rounded-lg border border-primary/40 bg-primary/5 p-3 flex items-center gap-3 cursor-pointer",role:"button",tabindex:"0",title:"Select this locator for Confirm",onClick:v[6]||(v[6]=de=>ie(t(u).recommended)),onKeydown:v[7]||(v[7]=ge(he(de=>ie(t(u).recommended),["prevent"]),["enter"]))},[$(G,{name:"i-lucide-star",class:"size-5 text-primary shrink-0"}),d("div",En,[d("p",Mn," Recommended (score: "+p(t(u).recommended.score)+") ",1),d("code",jn,p(t(u).recommended.locator),1)]),$(le,{size:"sm",color:"primary",variant:"solid","trailing-icon":t(q)==="rec"?"i-lucide-check":"i-lucide-copy",onClick:v[5]||(v[5]=he(de=>fe(t(u).recommended.locator,"rec"),["stop"]))},{default:S(()=>[...v[20]||(v[20]=[L(" Copy ",-1)])]),_:1},8,["trailing-icon"])],32)):k("",!0)])):k("",!0)],64))]),footer:S(()=>[d("div",Nn,[t(x)==="review"?(n(),P(le,{key:0,size:"sm",variant:"outline",color:"neutral",icon:"i-lucide-rotate-ccw",onClick:X},{default:S(()=>[...v[21]||(v[21]=[L(" Pick a different element ",-1)])]),_:1})):(n(),l("div",Kn)),d("div",Vn,[$(le,{size:"sm",variant:"outline",color:"neutral",onClick:U},{default:S(()=>[...v[22]||(v[22]=[L("Cancel",-1)])]),_:1}),t(x)==="review"?(n(),P(le,{key:0,size:"sm",color:"primary",loading:t(V),disabled:!t(se),onClick:I},{default:S(()=>[...v[23]||(v[23]=[L(" Confirm pick ",-1)])]),_:1},8,["loading","disabled"])):k("",!0)])])]),_:1},8,["open"])}}}),Hn=Object.assign(Dn,{__name:"SnapshotLocatorPicker"});function Fn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function qn(e,r){let i=0,m=null;for(let o=r;o<e.length;o++){const a=e[o];if(m){if(a==="\\"){o++;continue}a===m&&(m=null);continue}if(a==="'"||a==='"'||a==="`"){m=a;continue}if(a==="(")i++;else if(a===")"&&(i--,i===0))return o}return-1}function Zn(e,r,i){if(!e||!r||!i)return null;const m=new RegExp(`${Fn(r)}\\s*\\(`,"g");let o;for(;(o=m.exec(e))!==null;){const a=o.index,s=a>0?e[a-1]:"";if(s&&/[A-Za-z0-9_$]/.test(s))continue;const g=a+o[0].lastIndexOf("("),c=qn(e,g);if(c===-1)return null;const h=e.slice(0,a)+i+e.slice(c+1);return h===e?null:{old:e,new:h}}return null}function Wn(e,r){return`${r?`@@ ${r} @@
|
|
2
2
|
`:""}-${e.old.trimEnd()}
|
|
3
3
|
+${e.new.trimEnd()}`}function Gn(e,r){const i=e??{},m=r??{},o=s=>s==null?null:typeof s=="string"?s:JSON.stringify(s),a=[];for(const s of new Set([...Object.keys(i),...Object.keys(m)])){const g=o(i[s]),c=o(m[s]);g!==c&&a.push({key:s,from:g,to:c})}return a}function Yn(e){const i=[`In ${e.location??(e.sourceLine?`line ${e.sourceLine.line}`:"the failing test")}, the Playwright locator \`${e.failing}\` no longer matches its element.`,`Replace it with \`${e.recommended}\`.`];return e.sourceLine&&i.push("","Current line:",e.sourceLine.text.trim()),i.join(`
|
|
4
4
|
`)}const Jn={key:0,class:"text-xs font-mono"},Qn={key:1},Xn={class:"flex items-center gap-1"},eo={key:1,class:"rounded-lg border border-primary/50 bg-primary/10 p-3 mb-3 flex items-center gap-3"},to={class:"flex-1 min-w-0"},no={class:"text-xs font-medium text-primary flex items-center gap-1.5"},oo={class:"text-sm font-mono block truncate mt-0.5"},so={key:2,class:"flex items-center gap-2 bg-elevated rounded p-2 mb-3 border border-red-200 dark:border-red-800"},ao={class:"text-xs font-mono text-red-600 dark:text-red-400 flex-1 truncate"},ro={key:4,class:"rounded-lg border border-primary/40 bg-primary/5 p-3 mb-3 space-y-2"},io={class:"flex items-center gap-2 min-w-0"},lo={key:0,class:"text-[11px] text-gray-500 truncate min-w-0"},co={key:0,class:"rounded border border-default overflow-hidden bg-default"},uo={class:"text-sm font-mono block truncate"},mo={key:0,class:"text-xs flex flex-wrap items-center gap-x-1.5 gap-y-0.5"},fo={class:"font-mono text-gray-500"},po={key:0,class:"font-mono text-red-500 line-through"},go={key:1,class:"text-gray-400"},ho={key:2,class:"font-mono text-green-600 dark:text-green-400"},vo={key:3,class:"text-gray-400"},yo={key:2,class:"text-xs text-gray-500"},xo={key:3,class:"text-xs text-primary/90 flex items-center gap-1"},bo={class:"flex items-center gap-2"},ko={key:5,class:"rounded-lg border border-default bg-elevated p-3 mb-3 flex items-center gap-3"},_o={class:"flex-1 min-w-0"},$o={class:"text-xs font-medium text-success-600 dark:text-success-400"},wo={class:"text-sm font-mono block truncate mt-0.5"},Co={class:"space-y-2"},So={key:6,class:"mt-3"},To={class:"space-y-2"},Lo={class:"flex items-center gap-1"},nt=3,Ao=oe({__name:"LocatorHealingPanel",props:{runId:{},testRunsCaseId:{},storageKey:{},affectedCount:{}},setup(e){const r=e,i=w(()=>r.storageKey?Ke:Ne),m=w(()=>r.storageKey?{storageKey:r.storageKey}:{}),{data:o,pending:a,error:s}=Ee(()=>`/api/test-runs/${r.runId}/cases/${r.testRunsCaseId}/locator-healing`,{lazy:!0},"$z1C7vU2CXe"),g=w(()=>!!o.value&&o.value.source!=="none"&&!!(o.value.fromElementMatch?.length||o.value.fromPriorSuccess?.length||o.value.fromAriaSnapshot?.length)),c=w(()=>o.value?o.value.fromElementMatch??o.value.fromPriorSuccess??o.value.fromAriaSnapshot??[]:[]),h=w(()=>c.value.find(R=>R.pickedByUser)??null),C=w(()=>o.value?.recommendation?o.value.recommendation:o.value?.priorNameMayBeStale||!c.value.length?null:lt(o.value?.failingLocator?.method,c.value)),T=w(()=>o.value?.priorNameMayBeStale&&o.value.fromPriorSuccess?.length?o.value.fromAriaSnapshot??[]:[]),x=w(()=>{const R=C.value;return R?.recommended?R.recommended.pickedByUser?"Confirmed with the locator picker on the failing page":R.preservesConvention?"Keeps your original locator style — minimal, idiomatic edit":R.suggestAddTestId?"Most stable available, but still fragile":"Most stable available — a sturdier style than the original":""}),A=w(()=>{const R=o.value?.priorNameMayBeStale,f=(()=>{switch(o.value?.source){case"prior-run":return R?"Pre-captured from the last passing run — the element looks changed since":"Pre-captured from the last passing run — highest confidence";case"element-match":return"The element looks renamed or moved — these are fresh locators for its current identity on the failing page";case"fingerprint":return"Matched by locator signature (line numbers shifted)";case"cross-test":return"Captured by another test in this project that uses the same locator";case"aria-snapshot":return"Generated from the failure-time ARIA snapshot — limited, no HTML attributes";default:return""}})(),N=o.value?.capturedAt;return N?`${f} · captured ${We(N)}`:f}),z=w(()=>{if(o.value?.priorNameMayBeStale)return"text-warning-600 dark:text-warning-400";switch(o.value?.source){case"prior-run":case"fingerprint":case"cross-test":return"text-success-600 dark:text-success-400";case"element-match":return"text-primary-600 dark:text-primary-400";default:return"text-warning-600 dark:text-warning-400"}}),B=w(()=>{const R=o.value?.failingLocator;return R?`${R.method}(${JSON.stringify(R.args)})`:""}),Z=je(),{data:Y}=Ee(()=>`/api/test-run-cases/${r.testRunsCaseId}/traces`,{lazy:!0},"$vsBboELop9"),E=w(()=>{const R=Y.value?.[0];if(!R)return null;const f=!!Z.public.demoMode&&R.filePath.startsWith("demo/");return at(R.filePath,Z.app?.baseURL,f)}),O=j(!1);async function ce(){await yt(`/api/test-runs/${r.runId}/cases/${r.testRunsCaseId}/locator-healing`)}const{copy:ee}=Ge(),y=j(null);let H=null;function M(R,f,N){ee(R,{toast:N}),y.value=f,H&&clearTimeout(H),H=setTimeout(()=>{y.value=null},2e3)}function K(R,f){M(R,f,"Locator copied")}Le(()=>{H&&clearTimeout(H)});const W=w(()=>C.value?.recommended??null),F=w(()=>r.affectedCount&&r.affectedCount>1&&W.value?`Same break affects ${r.affectedCount} tests in this cluster — one fix`:""),Q=w(()=>{if(W.value?.pickedByUser)return"your confirmed pick";switch(o.value?.source){case"prior-run":return"from the last passing run";case"fingerprint":return"from a prior run (line shifted)";case"cross-test":return"from another test in this project";case"element-match":return"from the current failing page";case"aria-snapshot":return"from the ARIA snapshot";default:return""}}),ve=w(()=>{const R=o.value?.sourceLine,f=W.value;if(!R||!f)return null;const N=Zn(R.text,o.value?.failingLocator?.method,f.locator);return N?{edit:N,patch:Wn(N,o.value?.location??null)}:null}),xe=w(()=>{if(ve.value)return[];const R=o.value?.failingLocator,f=W.value;return!R||!f||f.method!==R.method?[]:Gn(R.args,f.args)});function ze(){const R=W.value;!R||!o.value||M(Yn({location:o.value.location??null,sourceLine:o.value.sourceLine??null,failing:B.value,recommended:R.locator}),"fix-prompt","Fix prompt copied")}const te=j(!1),ke=w(()=>te.value?c.value:c.value.slice(0,nt));return(R,f)=>{const N=Me,be=vt,me=Ze,ue=ye,_e=Ie,Ce=Gt,Te=it,se=zt;return n(),l(D,null,[!t(a)&&!t(s)&&t(g)?(n(),P(Se(t(i)),Ue({key:0},t(m),{icon:"i-lucide-bandage",title:"Alternative locators",count:t(c).length,help:"locator-healing"}),Ae({subtitle:S(()=>[d("span",{class:re(t(z))},p(t(A)),3)]),default:S(()=>[t(o)?.healedInRunId?(n(),P(me,{key:0,class:"mb-3",color:"success",icon:"i-lucide-circle-check",variant:"subtle",title:"Locator healed"},{description:S(()=>[f[11]||(f[11]=L(" The recommended locator now passes at this call site — ",-1)),$(be,{to:`/test-runs/${t(o).healedInRunId}`,class:"underline font-medium"},{default:S(()=>[L(" see run #"+p(t(o).healedInRunId),1)]),_:1},8,["to"]),f[12]||(f[12]=L(". ",-1))]),_:1})):k("",!0),t(h)?(n(),l("div",eo,[$(ue,{name:"i-lucide-user-check",class:"size-5 text-primary shrink-0"}),d("div",to,[d("p",no,[f[14]||(f[14]=L(" Your pick ",-1)),$(_e,{size:"sm",color:"primary",variant:"subtle"},{default:S(()=>[...f[13]||(f[13]=[L("confirmed on the failing page",-1)])]),_:1})]),d("code",oo,p(t(h).locator),1)]),$(N,{size:"sm",color:"primary",variant:"solid","trailing-icon":t(y)==="user-pick"?"i-lucide-check":"i-lucide-copy",onClick:f[1]||(f[1]=V=>K(t(h).locator,"user-pick"))},{default:S(()=>[...f[15]||(f[15]=[L(" Copy ",-1)])]),_:1},8,["trailing-icon"])])):k("",!0),t(o)?.failingLocator?(n(),l("div",so,[$(ue,{name:"i-lucide-x-circle",class:"size-4 text-red-500 shrink-0"}),d("code",ao,p(t(B)),1),$(N,{size:"xs",variant:"ghost",color:"neutral",icon:t(y)==="failing"?"i-lucide-check":"i-lucide-copy",title:t(y)==="failing"?"Copied!":"Copy",onClick:f[2]||(f[2]=V=>K(t(B),"failing"))},null,8,["icon","title"])])):k("",!0),t(o)?.priorNameMayBeStale?(n(),P(me,{key:3,class:"mb-3",color:"warning",icon:"i-lucide-alert-triangle",variant:"subtle",title:"The element's name looks changed",description:"The captured accessible name no longer appears on the failing page, so name-based alternatives (and the failing locator itself) probably no longer match. Prefer the structural options, or the failing-page candidates below."})):k("",!0),t(W)?(n(),l("div",ro,[d("div",io,[$(ue,{name:"i-lucide-star",class:"size-4 text-primary shrink-0"}),f[16]||(f[16]=d("p",{class:"text-xs font-medium text-primary shrink-0"},"Recommended fix",-1)),t(Q)?(n(),l("span",lo," · "+p(t(Q)),1)):k("",!0),f[17]||(f[17]=d("span",{class:"flex-1"},null,-1)),$(_e,{size:"xs",color:"primary",variant:"subtle",class:"font-mono tabular-nums shrink-0"},{default:S(()=>[L(p(t(W).score),1)]),_:1})]),t(ve)?(n(),l("div",co,[$(Ce,{patch:t(ve).patch},null,8,["patch"])])):(n(),l(D,{key:1},[d("code",uo,p(t(W).locator),1),t(xe).length?(n(),l("p",mo,[(n(!0),l(D,null,ne(t(xe),(V,ie)=>(n(),l(D,{key:ie},[d("span",fo,p(V.key)+":",1),V.from?(n(),l("span",po,p(V.from),1)):(n(),l("span",go,"—")),$(ue,{name:"i-lucide-arrow-right",class:"size-3 text-gray-400"}),V.to?(n(),l("span",ho,p(V.to),1)):(n(),l("span",vo,"removed"))],64))),128))])):k("",!0)],64)),t(x)?(n(),l("p",yo,p(t(x)),1)):k("",!0),t(F)?(n(),l("p",xo,[$(ue,{name:"i-lucide-layers",class:"size-3 shrink-0"}),L(p(t(F)),1)])):k("",!0),d("div",bo,[$(N,{size:"xs",color:"primary",variant:"solid","trailing-icon":t(y)==="top"?"i-lucide-check":"i-lucide-copy",onClick:f[3]||(f[3]=V=>K(t(W).locator,"top"))},{default:S(()=>[...f[18]||(f[18]=[L(" Copy locator ",-1)])]),_:1},8,["trailing-icon"]),$(N,{size:"xs",color:"neutral",variant:"outline",icon:t(y)==="fix-prompt"?"i-lucide-check":"i-lucide-sparkles",title:"Copy an instruction an AI coding agent can apply directly to the test",onClick:ze},{default:S(()=>[...f[19]||(f[19]=[L(" Copy fix prompt ",-1)])]),_:1},8,["icon"])])])):k("",!0),t(C)?.hasDurableAlternative&&t(C).durable?(n(),l("div",ko,[$(ue,{name:"i-lucide-shield-check",class:"size-5 text-success shrink-0"}),d("div",_o,[d("p",$o," Most stable option (score: "+p(t(C).durable.score)+") ",1),d("code",wo,p(t(C).durable.locator),1),f[20]||(f[20]=d("p",{class:"text-xs text-gray-500 mt-0.5"},"Sturdier, but changes the locator style",-1))]),$(N,{size:"sm",color:"neutral",variant:"outline","trailing-icon":t(y)==="durable"?"i-lucide-check":"i-lucide-copy",onClick:f[4]||(f[4]=V=>K(t(C).durable.locator,"durable"))},{default:S(()=>[...f[21]||(f[21]=[L(" Copy ",-1)])]),_:1},8,["trailing-icon"])])):k("",!0),d("div",Co,[f[22]||(f[22]=d("p",{class:"text-xs font-medium text-gray-500"},"All alternatives",-1)),(n(!0),l(D,null,ne(t(ke),(V,ie)=>(n(),P(Te,{key:ie,alt:V,copied:t(y)===`alt-${ie}`,onCopy:u=>K(V.locator,`alt-${ie}`)},null,8,["alt","copied","onCopy"]))),128)),t(c).length>nt?(n(),P(N,{key:0,size:"xs",variant:"ghost",color:"neutral",block:"",icon:t(te)?"i-lucide-chevron-up":"i-lucide-chevron-down",onClick:f[5]||(f[5]=V=>te.value=!t(te))},{default:S(()=>[L(p(t(te)?"Show fewer":`Show all ${t(c).length} alternatives`),1)]),_:1},8,["icon"])):k("",!0)]),t(T).length?(n(),l("div",So,[f[23]||(f[23]=d("p",{class:"text-xs font-medium text-gray-500 mb-2"},"From the failing page",-1)),d("div",To,[(n(!0),l(D,null,ne(t(T),(V,ie)=>(n(),P(Te,{key:ie,alt:V,note:"candidate from the failure-time ARIA snapshot",copied:t(y)===`supp-${ie}`,onCopy:u=>K(V.locator,`supp-${ie}`)},null,8,["alt","copied","onCopy"]))),128))])])):k("",!0),t(C)?.suggestAddTestId?(n(),P(me,{key:7,class:"mt-3",color:"warning",icon:"i-lucide-info",variant:"subtle",title:"All alternatives are fragile",description:"Every captured locator scores below 50. Add a stable data-testid attribute to this element in the app for a durable fix."})):k("",!0),t(o)?.source==="aria-snapshot"?(n(),P(me,{key:8,class:"mt-3",color:"info",icon:"i-lucide-info",variant:"subtle"},{description:S(()=>[f[25]||(f[25]=L(" No HTML attributes were available. ",-1)),$(se,{to:"capture-fixtures","no-icon":"",class:"text-primary hover:underline"},{default:S(()=>[...f[24]||(f[24]=[L("Enable Piwi fixture capture",-1)])]),_:1}),f[26]||(f[26]=L(" for full alternatives including data-testid and CSS selectors. ",-1))]),_:1})):k("",!0)]),_:2},[e.storageKey?{name:"folded",fn:S(()=>[t(C)?.recommended?(n(),l("code",Jn,p(t(C).recommended.locator),1)):(n(),l("span",Qn,p(t(c).length)+" alternative"+p(t(c).length===1?"":"s"),1))]),key:"0"}:void 0,t(E)||t(o)?.failingLocator?{name:"actions",fn:S(()=>[d("div",Xn,[t(o)?.failingLocator?(n(),P(N,{key:0,size:"xs",color:"neutral",variant:"outline",icon:"i-lucide-mouse-pointer",title:"Open the failure-time DOM snapshot and click the element to pick a locator",onClick:f[0]||(f[0]=V=>O.value=!0)},{default:S(()=>[...f[9]||(f[9]=[L(" Pick from snapshot ",-1)])]),_:1})):k("",!0),t(E)?(n(),P(N,{key:1,to:t(E),target:"_blank",size:"xs",color:"neutral",variant:"outline",icon:"i-lucide-crosshair",title:"Open the failure trace in the trace viewer — its Pick locator tool works on the recorded page snapshots"},{default:S(()=>[...f[10]||(f[10]=[L(" Pick from trace ",-1)])]),_:1},8,["to"])):k("",!0)])]),key:"1"}:void 0]),1040,["count"])):!t(a)&&!t(s)&&!t(g)?(n(),P(Se(t(i)),Ue({key:1},t(m),{icon:"i-lucide-bandage",title:"Alternative locators",subtitle:"No alternatives available",help:"locator-healing"}),Ae({default:S(()=>[$(me,{color:"neutral",icon:"i-lucide-info",variant:"subtle"},{description:S(()=>[f[31]||(f[31]=L(" No pre-captured alternatives — this locator has never passed in a previous run. ",-1)),$(se,{to:"capture-fixtures","no-icon":"",class:"text-primary hover:underline"},{default:S(()=>[...f[30]||(f[30]=[L("Enable Piwi dashboard fixtures",-1)])]),_:1}),f[32]||(f[32]=L(" to capture element attributes at test time, or use “Pick from snapshot” above to choose a locator by hand on the failure-time page. ",-1))]),_:1})]),_:2},[e.storageKey?{name:"folded",fn:S(()=>[f[27]||(f[27]=d("span",null,"No alternatives available",-1))]),key:"0"}:void 0,t(E)||t(o)?.failingLocator?{name:"actions",fn:S(()=>[d("div",Lo,[t(o)?.failingLocator?(n(),P(N,{key:0,size:"xs",color:"neutral",variant:"outline",icon:"i-lucide-mouse-pointer",title:"Open the failure-time DOM snapshot and click the element to pick a locator",onClick:f[6]||(f[6]=V=>O.value=!0)},{default:S(()=>[...f[28]||(f[28]=[L(" Pick from snapshot ",-1)])]),_:1})):k("",!0),t(E)?(n(),P(N,{key:1,to:t(E),target:"_blank",size:"xs",color:"neutral",variant:"outline",icon:"i-lucide-crosshair",title:"Open the failure trace in the trace viewer — its Pick locator tool works on the recorded page snapshots"},{default:S(()=>[...f[29]||(f[29]=[L(" Pick from trace ",-1)])]),_:1},8,["to"])):k("",!0)])]),key:"1"}:void 0]),1040)):k("",!0),t(o)?.failingLocator?(n(),P(Hn,{key:2,open:t(O),"onUpdate:open":f[7]||(f[7]=V=>Oe(O)?O.value=V:null),"run-id":e.runId,"test-runs-case-id":e.testRunsCaseId,"failing-locator":t(o).failingLocator,healing:t(o),onConfirmed:ce,onClose:f[8]||(f[8]=V=>O.value=!1)},null,8,["open","run-id","test-runs-case-id","failing-locator","healing"])):k("",!0)],64)}}}),wa=Object.assign(Ao,{__name:"LocatorHealingPanel"}),Io={key:1,class:"space-y-2"},zo={class:"text-xs font-medium text-gray-500 dark:text-gray-400 sm:w-40 shrink-0"},Bo={class:"flex flex-wrap items-center gap-1.5 min-w-0 text-xs font-mono"},Ro={class:"rounded bg-red-50 px-1.5 py-0.5 text-red-700 dark:bg-red-950/30 dark:text-red-400 break-all"},Po={class:"rounded bg-green-50 px-1.5 py-0.5 text-green-700 dark:bg-green-950/30 dark:text-green-400 break-all"},Oo={key:0,class:"text-xs text-gray-400 dark:text-gray-500"},Uo={key:0},Eo=oe({__name:"EnvironmentDiffCard",props:{runId:{},testRunsCaseId:{},storageKey:{}},setup(e,{expose:r}){const i=e,m=w(()=>i.storageKey?Ke:Ne),o=w(()=>i.storageKey?{storageKey:i.storageKey}:{}),{data:a,pending:s,error:g}=Ee(()=>`/api/test-runs/${i.runId}/cases/${i.testRunsCaseId}/environment-diff`,{lazy:!0},"$yASgALxNz3"),c=w(()=>a.value?.entries??[]),h=w(()=>c.value.filter(z=>!z.informational)),C=w(()=>c.value.filter(z=>z.informational)),T=w(()=>{const z=a.value?.baseline;if(!z)return"";const B=z.startTime?` · ${We(new Date(z.startTime))}`:"";return`vs last pass in run #${z.runId}${B}`}),x=w(()=>{if(a.value?.status!=="ok")return"No passing baseline to compare against";const z=h.value.length;return z===0?"Identical to last pass — no environment drift":`${z} change${z===1?"":"s"}: ${h.value.map(B=>B.label).join(", ")}`}),A=j(null);return r({reveal:()=>A.value?.reveal?.()}),(z,B)=>{const Z=Ze,Y=ye;return!t(s)&&!t(g)&&t(a)?.status==="ok"?(n(),P(Se(t(m)),Ue({key:0,ref_key:"card",ref:A},t(o),{icon:"i-lucide-git-compare-arrows",title:"Environment diff",count:t(h).length||void 0,help:"environment-diff",subtitle:t(T)}),Ae({default:S(()=>[t(c).length===0?(n(),P(Z,{key:0,color:"success",icon:"i-lucide-check-circle",variant:"subtle",description:"The environment is identical to the last passing run — environment drift is unlikely to explain this failure."})):(n(),l("div",Io,[(n(!0),l(D,null,ne(t(h),E=>(n(),l("div",{key:E.key,class:"rounded-lg border border-default p-3 flex flex-col gap-1 sm:flex-row sm:items-center sm:gap-3"},[d("span",zo,p(E.label),1),d("div",Bo,[d("code",Ro,p(E.failing??"(unset)"),1),$(Y,{name:"i-lucide-arrow-left",class:"size-3 shrink-0 text-gray-400"}),d("code",Po,p(E.baseline??"(unset)"),1)])]))),128)),t(C).length>0?(n(),l("p",Oo,[B[0]||(B[0]=L(" Also changed (varies naturally between runs): ",-1)),(n(!0),l(D,null,ne(t(C),(E,O)=>(n(),l("span",{key:E.key},[L(p(E.label.toLowerCase())+" "+p(E.baseline??"—")+" → "+p(E.failing??"—"),1),O<t(C).length-1?(n(),l("span",Uo,", ")):k("",!0)]))),128))])):k("",!0)]))]),_:2},[e.storageKey?{name:"folded",fn:S(()=>[d("span",null,p(t(x)),1)]),key:"0"}:void 0]),1040,["count","subtitle"])):k("",!0)}}}),Ca=Object.assign(Eo,{__name:"EnvironmentDiffCard"}),Mo={class:"absolute top-4 left-4 text-white/70 text-sm font-medium"},jo=["src","alt"],No=oe({__name:"ScreenshotLightbox",props:{images:{},modelValue:{}},emits:["update:modelValue"],setup(e,{emit:r}){const i=e,m=r,o=w(()=>i.modelValue!==null);function a(){m("update:modelValue",null)}function s(){i.modelValue!==null&&i.modelValue>0&&m("update:modelValue",i.modelValue-1)}function g(){i.modelValue!==null&&i.modelValue<i.images.length-1&&m("update:modelValue",i.modelValue+1)}const c=w(()=>i.modelValue===null?null:i.images[i.modelValue]??null);function h(C){o.value&&(C.key==="Escape"&&a(),C.key==="ArrowLeft"&&s(),C.key==="ArrowRight"&&g())}return st(()=>window.addEventListener("keydown",h)),xt(()=>window.removeEventListener("keydown",h)),(C,T)=>{const x=ye;return n(),P(bt,{to:"body"},[$(kt,{name:"lightbox"},{default:S(()=>[o.value?(n(),l("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/90",onClick:he(a,["self"])},[d("button",{class:"absolute top-4 right-4 size-10 flex items-center justify-center rounded-full bg-white/10 text-white hover:bg-white/20 transition-colors",onClick:a},[$(x,{name:"i-lucide-x",class:"size-6"})]),d("div",Mo,p((e.modelValue??0)+1)+" / "+p(e.images.length),1),e.images.length>1&&(e.modelValue??0)>0?(n(),l("button",{key:0,class:"absolute left-4 size-10 flex items-center justify-center rounded-full bg-white/10 text-white hover:bg-white/20 transition-colors",onClick:s},[$(x,{name:"i-lucide-chevron-left",class:"size-6"})])):k("",!0),c.value?(n(),l("img",{key:1,src:c.value.src,alt:c.value.name,class:"max-h-[90vh] max-w-[90vw] object-contain rounded-lg",onClick:T[0]||(T[0]=he(()=>{},["stop"]))},null,8,jo)):k("",!0),e.images.length>1&&(e.modelValue??0)<e.images.length-1?(n(),l("button",{key:2,class:"absolute right-4 size-10 flex items-center justify-center rounded-full bg-white/10 text-white hover:bg-white/20 transition-colors",onClick:g},[$(x,{name:"i-lucide-chevron-right",class:"size-6"})])):k("",!0)])):k("",!0)]),_:1})])}}}),ut=Object.assign(_t(No,[["__scopeId","data-v-c02b1e9b"]]),{__name:"ScreenshotLightbox"}),Ko={class:"flex justify-end mb-2"},Vo={key:1,class:"rounded overflow-hidden border border-default bg-gray-50 dark:bg-gray-900"},Do=["src"],Ho={key:2,class:"grid grid-cols-1 sm:grid-cols-2 gap-2"},Fo={class:"rounded overflow-hidden border border-red-200 dark:border-red-900 bg-gray-50 dark:bg-gray-900"},qo=["src"],Zo={class:"rounded overflow-hidden border border-green-200 dark:border-green-900 bg-gray-50 dark:bg-gray-900"},Wo={class:"px-2 py-1 text-[10px] font-medium text-green-600 dark:text-green-400"},Go=["src"],Yo=oe({__name:"VisualDiffCard",props:{runId:{},testRunsCaseId:{},storageKey:{}},setup(e,{expose:r}){const i=e,m=w(()=>i.storageKey?Ke:Ne),o=w(()=>i.storageKey?{storageKey:i.storageKey}:{}),a=je(),{data:s,pending:g,error:c}=Ee(()=>`/api/test-runs/${i.runId}/cases/${i.testRunsCaseId}/visual-diff`,{lazy:!0},"$nTbSHl3faK"),h=w(()=>s.value?.status==="ok"?s.value.diff??null:null),C=j("overlay"),T=[{label:"Overlay",value:"overlay"},{label:"Side by side",value:"side-by-side"}],x=w(()=>h.value?Pe(h.value.path,"image/png",a.app?.baseURL):""),A=w(()=>h.value?Pe(h.value.failingPath,null,a.app?.baseURL):""),z=w(()=>h.value?Pe(h.value.baselinePath,null,a.app?.baseURL):""),B=w(()=>h.value?(h.value.changedPixelRatio*100).toFixed(2):"0"),Z=w(()=>{const ee=h.value?.changedPixelRatio??0;return ee>.1?"error":ee>.01?"warning":"success"}),Y=w(()=>h.value?h.value.dimensionMismatch?`${B.value}% changed — dimensions differ, unreliable`:`${B.value}% of pixels changed vs last pass`:"No comparable screenshots"),E=w(()=>h.value?[{src:A.value,name:"Failing screenshot"},{src:z.value,name:"Last passing screenshot"},{src:x.value,name:"Diff overlay"}]:[]),O=j(null),ce=j(null);return r({reveal:()=>ce.value?.reveal?.()}),(ee,y)=>{const H=Ie,M=Ze,K=Rt,W=ut;return!t(g)&&!t(c)&&t(h)?(n(),P(Se(t(m)),Ue({key:0,ref_key:"card",ref:ce},t(o),{icon:"i-lucide-images",title:"Visual diff",help:"visual-diff"}),Ae({subtitle:S(()=>[d("span",null,"vs last pass in run #"+p(t(h).baselineRunId),1)]),actions:S(()=>[$(H,{color:t(Z),variant:"subtle",size:"sm",class:"font-mono tabular-nums"},{default:S(()=>[L(p(t(B))+"% changed ",1)]),_:1},8,["color"])]),default:S(()=>[t(h).dimensionMismatch?(n(),P(M,{key:0,class:"mb-3",color:"warning",icon:"i-lucide-alert-triangle",variant:"subtle",title:"Screenshot dimensions differ",description:"The failing and passing screenshots have different sizes (viewport change?). They are compared on a padded canvas, so the changed-pixel ratio is inflated and unreliable."})):k("",!0),d("div",Ko,[$(K,{modelValue:t(C),"onUpdate:modelValue":y[0]||(y[0]=F=>Oe(C)?C.value=F:null),items:T,size:"xs",content:!1,ui:{list:"overflow-x-auto",trigger:"shrink-0"}},null,8,["modelValue"])]),t(C)==="overlay"?(n(),l("div",Vo,[d("img",{src:t(x),alt:"Diff overlay (red = changed pixels)",class:"w-full max-h-96 object-contain cursor-zoom-in outline-none focus-visible:outline-2 focus-visible:outline-primary",loading:"lazy",role:"button",tabindex:"0","aria-label":"Open diff overlay in lightbox",onClick:y[1]||(y[1]=F=>O.value=2),onKeydown:[y[2]||(y[2]=ge(F=>O.value=2,["enter"])),y[3]||(y[3]=ge(he(F=>O.value=2,["prevent"]),["space"]))]},null,40,Do),y[11]||(y[11]=d("p",{class:"px-2 py-1 text-[10px] text-gray-500"},"Red pixels mark differences against the last passing run",-1))])):(n(),l("div",Ho,[d("div",Fo,[y[12]||(y[12]=d("p",{class:"px-2 py-1 text-[10px] font-medium text-red-600 dark:text-red-400"},"Failing",-1)),d("img",{src:t(A),alt:"Failing screenshot",class:"w-full max-h-80 object-contain cursor-zoom-in outline-none focus-visible:outline-2 focus-visible:outline-primary",loading:"lazy",role:"button",tabindex:"0","aria-label":"Open failing screenshot in lightbox",onClick:y[4]||(y[4]=F=>O.value=0),onKeydown:[y[5]||(y[5]=ge(F=>O.value=0,["enter"])),y[6]||(y[6]=ge(he(F=>O.value=0,["prevent"]),["space"]))]},null,40,qo)]),d("div",Zo,[d("p",Wo," Last pass (run #"+p(t(h).baselineRunId)+") ",1),d("img",{src:t(z),alt:"Last passing screenshot",class:"w-full max-h-80 object-contain cursor-zoom-in outline-none focus-visible:outline-2 focus-visible:outline-primary",loading:"lazy",role:"button",tabindex:"0","aria-label":"Open last passing screenshot in lightbox",onClick:y[7]||(y[7]=F=>O.value=1),onKeydown:[y[8]||(y[8]=ge(F=>O.value=1,["enter"])),y[9]||(y[9]=ge(he(F=>O.value=1,["prevent"]),["space"]))]},null,40,Go)])])),$(W,{modelValue:t(O),"onUpdate:modelValue":y[10]||(y[10]=F=>Oe(O)?O.value=F:null),images:t(E)},null,8,["modelValue","images"])]),_:2},[e.storageKey?{name:"folded",fn:S(()=>[d("span",null,p(t(Y)),1)]),key:"0"}:void 0]),1040)):k("",!0)}}}),Sa=Object.assign(Yo,{__name:"VisualDiffCard"}),Jo={class:"max-h-96 overflow-y-auto"},Qo={key:0,class:"mt-2 text-xs text-gray-400 dark:text-gray-500"},Fe=2e4,Xo=oe({__name:"DomSnapshotCard",props:{runId:{},testRunsCaseId:{},storageKey:{}},setup(e,{expose:r}){const i=e,m=w(()=>i.storageKey?Ke:Ne),o=w(()=>i.storageKey?{storageKey:i.storageKey}:{}),{data:a,pending:s,error:g}=Ee(()=>`/api/test-runs/${i.runId}/cases/${i.testRunsCaseId}/dom-snapshot`,{lazy:!0},"$AxHFpokm2o"),c=w(()=>(a.value?.html??"").slice(0,Fe)),h=w(()=>(a.value?.html?.length??0)>Fe),C=w(()=>{const z=a.value;return!z||z.status!=="ok"?"":`${Math.round((z.html?.length??0)/1024)} KB · rendered from the uploaded trace${z.snapshotName?` (${z.snapshotName})`:""}`}),{copy:T,copied:x}=Ge(),A=j(null);return r({reveal:()=>A.value?.reveal?.()}),(z,B)=>{const Z=Me,Y=Pt,E=Ot;return!t(s)&&!t(g)&&t(a)?.status==="ok"&&t(a).html?(n(),P(Se(t(m)),Ue({key:0,ref_key:"card",ref:A},t(o),{icon:"i-lucide-file-code",title:"DOM snapshot",help:"dom-snapshot",subtitle:t(C)}),Ae({actions:S(()=>[$(Y,{text:t(x)?"Copied!":"Copy full HTML"},{default:S(()=>[$(Z,{size:"xs",variant:"ghost",color:"neutral",icon:t(x)?"i-lucide-check":"i-lucide-clipboard",onClick:B[0]||(B[0]=O=>t(T)(t(a).html))},null,8,["icon"])]),_:1},8,["text"])]),default:S(()=>[d("div",Jo,[$(E,{code:t(c),lang:"xml"},null,8,["code"])]),t(h)||t(a).truncated?(n(),l("p",Qo,[t(h)?(n(),l(D,{key:0},[L("Showing the first "+p(Math.round(Fe/1e3))+"k characters — use Copy for the full document.",1)],64)):(n(),l(D,{key:1},[L("The snapshot was truncated to its size cap.")],64))])):k("",!0)]),_:2},[e.storageKey?{name:"folded",fn:S(()=>[d("span",null,"Failure-time HTML extracted from the trace — "+p(Math.round((t(a).html.length??0)/1024))+" KB",1)]),key:"0"}:void 0]),1040,["subtitle"])):k("",!0)}}}),Ta=Object.assign(Xo,{__name:"DomSnapshotCard"}),es={class:"rounded-md border border-default overflow-hidden"},ts={class:"text-xs font-semibold text-gray-600 dark:text-gray-300 flex-1"},ns={key:0,class:"text-gray-400 font-normal ml-1"},os={key:0},ss=oe({__name:"TestEvidenceSection",props:qe({icon:{},label:{},count:{},collapsible:{type:Boolean}},{open:{type:Boolean,default:!1},openModifiers:{}}),emits:["update:open"],setup(e){const r=e,i=ot(e,"open"),m=w(()=>r.collapsible===!1||i.value);return(o,a)=>{const s=ye;return n(),l("div",es,[(n(),P(Se(e.collapsible===!1?"div":"button"),{class:re(["w-full flex items-center gap-1.5 px-3 py-2 bg-elevated border-b border-default text-left",e.collapsible!==!1&&"hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors cursor-pointer"]),onClick:a[0]||(a[0]=g=>e.collapsible!==!1&&(i.value=!i.value))},{default:S(()=>[$(s,{name:e.icon,class:"size-3.5 shrink-0 text-primary/70"},null,8,["name"]),d("span",ts,[L(p(e.label),1),e.count!=null?(n(),l("span",ns,"("+p(e.count)+")",1)):k("",!0)]),e.collapsible!==!1?(n(),P(s,{key:0,name:i.value?"i-lucide-chevron-up":"i-lucide-chevron-down",class:"size-3.5 text-gray-400"},null,8,["name"])):k("",!0)]),_:1},8,["class"])),t(m)?(n(),l("div",os,[Re(o.$slots,"default")])):k("",!0)])}}}),Ye=Object.assign(ss,{__name:"TestEvidenceSection"}),as={class:"grid grid-cols-2 gap-2 p-2 bg-gray-50 dark:bg-gray-900"},rs=["aria-label","onClick","onKeydown"],is=["src","alt"],ls={class:"absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity bg-black/30"},cs={class:"absolute bottom-0 inset-x-0 px-1.5 py-0.5 text-[10px] text-white bg-black/50 truncate"},us=oe({__name:"TestEvidenceScreenshots",props:{attachments:{}},setup(e){const r=e,i=je();function m(s){return s.split("/").pop()||s}const o=w(()=>r.attachments.filter(s=>Et(s.path,s.contentType)).map(s=>({src:Pe(s.path,s.contentType,i.app?.baseURL),name:s.name||m(s.path)}))),a=j(null);return(s,g)=>{const c=ye,h=ut,C=Ye;return t(o).length>0?(n(),P(C,{key:0,icon:"i-lucide-image",label:"Screenshots",count:t(o).length,collapsible:!1},{default:S(()=>[d("div",as,[(n(!0),l(D,null,ne(t(o),(T,x)=>(n(),l("div",{key:T.src,class:"relative group cursor-pointer rounded overflow-hidden border border-default outline-none focus-visible:outline-2 focus-visible:outline-primary",role:"button",tabindex:"0","aria-label":`View screenshot ${T.name}`,onClick:A=>a.value=x,onKeydown:[ge(A=>a.value=x,["enter"]),ge(he(A=>a.value=x,["prevent"]),["space"])]},[d("img",{src:T.src,alt:T.name,class:"w-full h-28 object-cover object-top transition-opacity group-hover:opacity-80",loading:"lazy"},null,8,is),d("div",ls,[$(c,{name:"i-lucide-zoom-in",class:"size-5 text-white"})]),d("p",cs,p(T.name),1)],40,rs))),128))]),$(h,{modelValue:t(a),"onUpdate:modelValue":g[0]||(g[0]=T=>Oe(a)?a.value=T:null),images:t(o)},null,8,["modelValue","images"])]),_:1},8,["count"])):k("",!0)}}}),La=Object.assign(us,{__name:"TestEvidenceScreenshots"}),ds={class:"m-0"},ms={class:"bg-black rounded overflow-hidden"},fs=["src"],ps=["title"],gs=oe({__name:"VideoPlayer",props:{src:{},label:{}},setup(e){return(r,i)=>(n(),l("figure",ds,[d("div",ms,[d("video",{src:e.src,controls:"",preload:"metadata",class:"w-full max-h-96"}," Your browser does not support the video tag. ",8,fs)]),e.label?(n(),l("figcaption",{key:0,class:"mt-1 text-xs text-gray-400 truncate",title:e.label},p(e.label),9,ps)):k("",!0)]))}}),hs=Object.assign(gs,{__name:"VideoPlayer"}),vs={class:"space-y-2 p-2 bg-gray-50 dark:bg-gray-900"},ys=oe({__name:"TestEvidenceVideos",props:{attachments:{}},setup(e){const r=e,i=je();function m(a){return a.split("/").pop()||a}const o=w(()=>r.attachments.filter(a=>Mt(a.path,a.contentType)).map(a=>({src:Pe(a.path,a.contentType,i.app?.baseURL),name:a.name||m(a.path)})));return(a,s)=>{const g=hs,c=Ye;return t(o).length>0?(n(),P(c,{key:0,icon:"i-lucide-video",label:"Videos",count:t(o).length,collapsible:!1},{default:S(()=>[d("div",vs,[(n(!0),l(D,null,ne(t(o),h=>(n(),P(g,{key:h.src,src:h.src,label:h.name},null,8,["src","label"]))),128))])]),_:1},8,["count"])):k("",!0)}}}),Aa=Object.assign(ys,{__name:"TestEvidenceVideos"}),xs={class:"flex items-center justify-between gap-2"},bs={class:"flex items-center gap-2 min-w-0"},ks={class:"text-sm truncate"},_s={key:0,class:"text-xs text-gray-400 shrink-0"},$s={key:1,class:"text-xs text-gray-400 shrink-0"},ws={class:"flex items-center gap-1.5 shrink-0"},Cs=oe({__name:"TraceListItem",props:{trace:{},showTime:{type:Boolean,default:!0}},setup(e){const r=e,i=je(),m=w(()=>(i.app?.baseURL??"/").replace(/\/$/,"")),o=w(()=>!!i.public.demoMode&&r.trace.filePath.startsWith("demo/")),a=w(()=>r.trace.filePath.split("/").pop()||r.trace.filePath),s=w(()=>at(r.trace.filePath,i.app?.baseURL,o.value)),g=w(()=>o.value?`${m.value}/${r.trace.filePath}`:`${m.value}/api/files/${At(r.trace.filePath)}`);return(c,h)=>{const C=ye,T=Me;return n(),l("div",xs,[d("div",bs,[$(C,{name:"i-lucide-file-archive",class:"size-4 text-gray-400 shrink-0"}),d("span",ks,p(t(a)),1),e.trace.size?(n(),l("span",_s,p(("formatBytes"in c?c.formatBytes:t(Lt))(e.trace.size)),1)):k("",!0),e.showTime?(n(),l("span",$s,p(("formatRelativeTime"in c?c.formatRelativeTime:t(We))(e.trace.createdAt)),1)):k("",!0)]),d("div",ws,[$(T,{to:t(s),target:"_blank",icon:"i-lucide-bug-play",size:"xs",label:"View trace"},null,8,["to"]),$(T,{to:t(g),target:"_blank",icon:"i-lucide-download",size:"xs",color:"neutral",variant:"soft",label:"Download"},null,8,["to"])])])}}}),Ss=Object.assign(Cs,{__name:"TraceListItem"}),Ts={key:0,class:"flex items-center justify-center py-4"},Ls={key:1,class:"divide-y divide-default"},As=oe({__name:"TestEvidenceTraces",props:{traces:{},loading:{type:Boolean}},setup(e){return(r,i)=>{const m=ye,o=Ss,a=Ye;return e.loading||e.traces.length>0?(n(),P(a,{key:0,icon:"i-lucide-bug-play",label:"Traces",count:e.traces.length||null,collapsible:!1},{default:S(()=>[e.loading&&!e.traces.length?(n(),l("div",Ts,[$(m,{name:"i-lucide-loader-circle",class:"size-4 animate-spin text-gray-400"})])):(n(),l("div",Ls,[(n(!0),l(D,null,ne(e.traces,s=>(n(),P(o,{key:s.id,trace:s,class:"px-3 py-2"},null,8,["trace"]))),128))]))]),_:1},8,["count"])):k("",!0)}}}),Ia=Object.assign(As,{__name:"TestEvidenceTraces"}),Is={class:"space-y-2"},zs={key:0,class:"rounded-lg border border-default overflow-hidden"},Bs=["title"],Rs={key:2,class:"truncate text-gray-400 dark:text-gray-500"},Ps={class:"font-mono"},Os={key:0,class:"overflow-x-auto text-xs font-mono leading-relaxed py-1"},Us={class:"min-w-max"},Es={key:1,class:"rounded-lg border border-dashed border-default"},Ms=["onClick"],js={key:0,class:"px-3 pb-2 space-y-1"},Ns=["title"],Ks={key:0,class:"truncate font-mono shrink-0"},Vs=oe({__name:"TraceCallStack",props:{frames:{},projectKey:{},projectName:{}},setup(e){const r=e,i=w(()=>{if(!r.frames.some(T=>T.inProject))return r.frames.map((T,x)=>({kind:"frame",frame:T,frameIndex:x}));const c=[];let h=[];const C=()=>{h.length!==0&&(c.push({kind:"group",frames:h,key:`group-${c.length}`}),h=[])};return r.frames.forEach((T,x)=>{T.inProject?(C(),c.push({kind:"frame",frame:T,frameIndex:x})):h.push(T)}),C(),c}),m=w(()=>{const g=r.frames.findIndex(c=>c.inProject);return g>=0?g:0}),o=j(new Set);function a(g){const c=new Set(o.value);c.has(g)?c.delete(g):c.add(g),o.value=c}function s(g){return g.source?g.source.lines.map((c,h)=>{const C=g.source.startLine+h;return{lineNo:C,text:c,failing:C===g.line}}):[]}return(g,c)=>{const h=ye,C=rt,T=Ie;return n(),l("div",Is,[(n(!0),l(D,null,ne(t(i),x=>(n(),l(D,{key:x.kind==="frame"?`f-${x.frameIndex}`:x.key},[x.kind==="frame"?(n(),l("div",zs,[d("div",{class:re(["flex items-center gap-2 px-3 py-1.5 bg-elevated/40 text-xs",x.frame.source?"border-b border-default":""])},[$(h,{name:x.frameIndex===t(m)?"i-lucide-circle-x":"i-lucide-corner-left-up",class:re([x.frameIndex===t(m)?"text-red-500":"text-gray-400","size-3.5 shrink-0"])},null,8,["name","class"]),x.frame.inProject?(n(),P(C,{key:0,"file-path":x.frame.file,line:x.frame.line,column:x.frame.column,"project-key":e.projectKey,"project-name":e.projectName,class:"min-w-0"},null,8,["file-path","line","column","project-key","project-name"])):(n(),l("code",{key:1,class:"truncate text-gray-500 dark:text-gray-400",title:x.frame.absFile||x.frame.file},p(x.frame.file)+":"+p(x.frame.line),9,Bs)),x.frame.functionName?(n(),l("span",Rs,[c[0]||(c[0]=L(" in ",-1)),d("span",Ps,p(x.frame.functionName),1)])):k("",!0),$(T,{color:x.frameIndex===t(m)?"error":"neutral",variant:"subtle",size:"xs",class:"ml-auto shrink-0"},{default:S(()=>[L(p(x.frameIndex===t(m)?"Failed here":"Caller"),1)]),_:2},1032,["color"])],2),x.frame.source?(n(),l("div",Os,[d("div",Us,[(n(!0),l(D,null,ne(s(x.frame),A=>(n(),l("div",{key:A.lineNo,class:re(["px-3 whitespace-pre flex",A.failing?"bg-red-50 dark:bg-red-950/30 text-red-700 dark:text-red-300 font-medium":"text-gray-600 dark:text-gray-400"])},[d("span",{class:re(["w-10 shrink-0 text-right pr-3 tabular-nums select-none",A.failing?"text-red-400 dark:text-red-500":"text-gray-300 dark:text-gray-600"])},p(A.lineNo),3),d("span",null,p(A.text),1)],2))),128))])])):k("",!0)])):(n(),l("div",Es,[d("button",{type:"button",class:"w-full flex items-center gap-2 px-3 py-1.5 text-xs text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300",onClick:A=>a(x.key)},[$(h,{name:t(o).has(x.key)?"i-lucide-chevron-down":"i-lucide-chevron-right",class:"size-3.5 shrink-0"},null,8,["name"]),L(" "+p(x.frames.length)+" frame"+p(x.frames.length===1?"":"s")+" in dependencies ",1)],8,Ms),t(o).has(x.key)?(n(),l("div",js,[(n(!0),l(D,null,ne(x.frames,(A,z)=>(n(),l("div",{key:z,class:"flex items-center gap-2 text-xs text-gray-400 dark:text-gray-500 min-w-0"},[$(h,{name:"i-lucide-corner-left-up",class:"size-3 shrink-0"}),d("code",{class:"truncate",title:A.absFile||A.file},p(A.file)+":"+p(A.line),9,Ns),A.functionName?(n(),l("span",Ks,p(A.functionName),1)):k("",!0)]))),128))])):k("",!0)]))],64))),128))])}}}),za=Object.assign(Vs,{__name:"TraceCallStack"}),Ds={class:"space-y-2"},Hs={class:"flex items-center gap-2 px-3 py-1.5 bg-elevated/40 border-b border-default text-xs"},Fs={class:"overflow-x-auto text-xs font-mono leading-relaxed py-1"},qs={class:"min-w-max"},Zs=oe({__name:"TestSourceStack",props:{frames:{},projectKey:{},projectName:{}},setup(e){function r(i){return i.split(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as P,W as L,X as O,S as T,o as r,c as v,j as C,g as f,T as q,k as e,U as z,Q as H,H as M,V as I,f as u,q as h,F as j,h as w,Y as D,a0 as Q,a1 as W,a3 as X,a4 as Y,a5 as G,aN as J,aO as Z,aq as ee,i as ae,p as o,v as S,m as R,t as A,a6 as te}from"./
|
|
1
|
+
import{d as P,W as L,X as O,S as T,o as r,c as v,j as C,g as f,T as q,k as e,U as z,Q as H,H as M,V as I,f as u,q as h,F as j,h as w,Y as D,a0 as Q,a1 as W,a3 as X,a4 as Y,a5 as G,aN as J,aO as Z,aq as ee,i as ae,p as o,v as S,m as R,t as A,a6 as te}from"./DHltYerF.js";import{L as se}from"./e7zD3uJ0.js";import{u as re}from"./qH_j2A3a.js";import{u as le}from"./DkI145a5.js";import{V as ie}from"./CcXaak_K.js";const[oe,ne]=D("SwitchRoot");var de=P({inheritAttrs:!1,__name:"SwitchRoot",props:{defaultValue:{type:null,required:!1},modelValue:{type:null,required:!1,default:void 0},disabled:{type:Boolean,required:!1},id:{type:String,required:!1},value:{type:String,required:!1,default:"on"},trueValue:{type:null,required:!1,default:()=>!0},falseValue:{type:null,required:!1,default:()=>!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"button"},name:{type:String,required:!1},required:{type:Boolean,required:!1}},emits:["update:modelValue"],setup(g,{emit:c}){const t=g,d=c,{disabled:n}=L(t),a=O(t,"modelValue",d,{defaultValue:t.defaultValue??t.falseValue,passive:t.modelValue===void 0}),i=w(()=>a.value===t.trueValue);function m(){n.value||(a.value=i.value?t.falseValue:t.trueValue)}const{forwardRef:V,currentElement:b}=T(),x=re(b),k=le(),_=w(()=>t.id&&b.value?document.querySelector(`[for="${t.id}"]`)?.innerText:void 0);return ne({checked:i,toggleCheck:m,disabled:n}),(s,B)=>(r(),v(j,null,[C(e(I),z({id:s.id,ref:e(V),role:"switch",type:s.as==="button"?"button":void 0,value:s.value,"aria-label":s.$attrs["aria-label"]||_.value,"aria-checked":i.value,"aria-required":s.required,"data-state":i.value?"checked":"unchecked","data-disabled":e(n)?"":void 0,"as-child":s.asChild,as:s.as,disabled:e(n)},{...e(k),...s.$attrs},{onClick:m,onKeydown:H(M(m,["prevent"]),["enter"])}),{default:f(()=>[q(s.$slots,"default",{modelValue:e(a),checked:i.value})]),_:3},16,["id","type","value","aria-label","aria-checked","aria-required","data-state","data-disabled","as-child","as","disabled","onKeydown"]),e(x)&&s.name?(r(),u(e(ie),z({key:0,type:"checkbox",name:s.name,disabled:e(n),required:s.required,value:s.value,checked:i.value},e(k)),null,16,["name","disabled","required","value","checked"])):h("v-if",!0)],64))}}),ue=de,ce=P({__name:"SwitchThumb",props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"span"}},setup(g){const c=oe();return T(),(t,d)=>(r(),u(e(I),{"data-state":e(c).checked.value?"checked":"unchecked","data-disabled":e(c).disabled.value?"":void 0,"as-child":t.asChild,as:t.as},{default:f(()=>[q(t.$slots,"default")]),_:3},8,["data-state","data-disabled","as-child","as"]))}}),pe=ce;const he={slots:{root:"relative flex items-start",base:["inline-flex items-center shrink-0 rounded-full border-2 border-transparent focus-visible:outline-3 data-[state=unchecked]:bg-accented","transition-[background] duration-200"],container:"flex items-center",thumb:"group pointer-events-none rounded-full bg-default shadow-lg ring-0 transition-transform duration-200 data-[state=unchecked]:translate-x-0 data-[state=unchecked]:rtl:-translate-x-0 flex items-center justify-center",icon:["absolute shrink-0 group-data-[state=unchecked]:text-dimmed opacity-0 size-10/12","transition-[color,opacity] duration-200"],wrapper:"ms-2",label:"block font-medium text-default",description:"text-muted"},variants:{color:{primary:{base:"data-[state=checked]:bg-primary outline-primary/25",icon:"group-data-[state=checked]:text-primary"},secondary:{base:"data-[state=checked]:bg-secondary outline-secondary/25",icon:"group-data-[state=checked]:text-secondary"},success:{base:"data-[state=checked]:bg-success outline-success/25",icon:"group-data-[state=checked]:text-success"},info:{base:"data-[state=checked]:bg-info outline-info/25",icon:"group-data-[state=checked]:text-info"},warning:{base:"data-[state=checked]:bg-warning outline-warning/25",icon:"group-data-[state=checked]:text-warning"},error:{base:"data-[state=checked]:bg-error outline-error/25",icon:"group-data-[state=checked]:text-error"},neutral:{base:"data-[state=checked]:bg-inverted outline-inverted/25",icon:"group-data-[state=checked]:text-highlighted"}},size:{xs:{base:"w-7",container:"h-4",thumb:"size-3 data-[state=checked]:translate-x-3 data-[state=checked]:rtl:-translate-x-3",wrapper:"text-xs"},sm:{base:"w-8",container:"h-4",thumb:"size-3.5 data-[state=checked]:translate-x-3.5 data-[state=checked]:rtl:-translate-x-3.5",wrapper:"text-xs"},md:{base:"w-9",container:"h-5",thumb:"size-4 data-[state=checked]:translate-x-4 data-[state=checked]:rtl:-translate-x-4",wrapper:"text-sm"},lg:{base:"w-10",container:"h-5",thumb:"size-4.5 data-[state=checked]:translate-x-4.5 data-[state=checked]:rtl:-translate-x-4.5",wrapper:"text-sm"},xl:{base:"w-11",container:"h-6",thumb:"size-5 data-[state=checked]:translate-x-5 data-[state=checked]:rtl:-translate-x-5",wrapper:"text-base"}},checked:{true:{icon:"group-data-[state=checked]:opacity-100"}},unchecked:{true:{icon:"group-data-[state=unchecked]:opacity-100"}},loading:{true:{icon:"animate-spin"}},highlight:{true:""},required:{true:{label:"after:content-['*'] after:ms-0.5 after:text-error"}},disabled:{true:{root:"opacity-75",base:"cursor-not-allowed",label:"cursor-not-allowed",description:"cursor-not-allowed"}}},compoundVariants:[{color:"primary",highlight:!0,class:{base:"ring ring-primary"}},{color:"secondary",highlight:!0,class:{base:"ring ring-secondary"}},{color:"success",highlight:!0,class:{base:"ring ring-success"}},{color:"info",highlight:!0,class:{base:"ring ring-info"}},{color:"warning",highlight:!0,class:{base:"ring ring-warning"}},{color:"error",highlight:!0,class:{base:"ring ring-error"}},{color:"neutral",highlight:!0,class:{base:"ring ring-inverted"}}],defaultVariants:{color:"primary",size:"md"}},ye=Object.assign({inheritAttrs:!1},{__name:"USwitch",props:{as:{type:null,required:!1},color:{type:null,required:!1},size:{type:null,required:!1},highlight:{type:Boolean,required:!1},loading:{type:Boolean,required:!1},loadingIcon:{type:null,required:!1},checkedIcon:{type:null,required:!1},uncheckedIcon:{type:null,required:!1},label:{type:String,required:!1},description:{type:String,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},disabled:{type:Boolean,required:!1},id:{type:String,required:!1},name:{type:String,required:!1},required:{type:Boolean,required:!1},value:{type:String,required:!1},defaultValue:{type:null,required:!1},modelValue:{type:null,required:!1},trueValue:{type:null,required:!1},falseValue:{type:null,required:!1}},emits:["change","update:modelValue"],setup(g,{emit:c}){const t=g,d=Q(),n=c,a=W("switch",t),i=X(),m=Y(G(a,"required","value","defaultValue","modelValue","trueValue","falseValue"),n),{id:V,emitFormChange:b,emitFormInput:x,size:k,color:_,highlight:s,name:B,disabled:F,ariaAttrs:N}=J(t),$=V.value??Z(),E=ee(),U=w(()=>{const{"data-state":p,...y}=E;return y}),l=w(()=>te({extend:he,...i.ui?.switch||{}})({size:k.value??a.size,color:_.value??a.color,highlight:s.value??a.highlight,required:a.required,loading:a.loading,disabled:F.value||a.loading}));function K(p){const y=new Event("change",{target:{value:p}});n("change",y),b(),x()}return(p,y)=>(r(),u(e(I),{as:e(a).as,"data-slot":p.$attrs["data-slot"]??"root",class:o(l.value.root({class:[e(a).ui?.root,e(a).class]}))},{default:f(()=>[ae("div",{"data-slot":"container",class:o(l.value.container({class:e(a).ui?.container}))},[C(e(ue),z({id:e($)},{...e(m),...U.value,...e(N)},{name:e(B),disabled:e(F)||e(a).loading,"data-slot":"base",class:l.value.base({class:e(a).ui?.base}),"onUpdate:modelValue":K}),{default:f(()=>[C(e(pe),{"data-slot":"thumb",class:o(l.value.thumb({class:e(a).ui?.thumb}))},{default:f(()=>[e(a).loading?(r(),u(S,{key:0,name:e(a).loadingIcon||e(i).ui.icons.loading,"data-slot":"icon",class:o(l.value.icon({class:e(a).ui?.icon,checked:!0,unchecked:!0}))},null,8,["name","class"])):(r(),v(j,{key:1},[e(a).checkedIcon?(r(),u(S,{key:0,name:e(a).checkedIcon,"data-slot":"icon",class:o(l.value.icon({class:e(a).ui?.icon,checked:!0}))},null,8,["name","class"])):h("",!0),e(a).uncheckedIcon?(r(),u(S,{key:1,name:e(a).uncheckedIcon,"data-slot":"icon",class:o(l.value.icon({class:e(a).ui?.icon,unchecked:!0}))},null,8,["name","class"])):h("",!0)],64))]),_:1},8,["class"])]),_:1},16,["id","name","disabled","class"])],2),e(a).label||d.label||e(a).description||d.description?(r(),v("div",{key:0,"data-slot":"wrapper",class:o(l.value.wrapper({class:e(a).ui?.wrapper}))},[e(a).label||d.label?(r(),u(e(se),{key:0,for:e($),"data-slot":"label",class:o(l.value.label({class:e(a).ui?.label}))},{default:f(()=>[q(p.$slots,"label",{label:e(a).label},()=>[R(A(e(a).label),1)])]),_:3},8,["for","class"])):h("",!0),e(a).description||d.description?(r(),v("p",{key:1,"data-slot":"description",class:o(l.value.description({class:e(a).ui?.description}))},[q(p.$slots,"description",{description:e(a).description},()=>[R(A(e(a).description),1)])],2)):h("",!0)],2)):h("",!0)]),_:3},8,["as","data-slot","class"]))}});export{ye as _};
|