@wcag-checkr/ci 1.0.0-rc.289 → 1.0.0-rc.290
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.
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/site-report-renderer-CO660LMz.js","assets/scheduled-audit-runner-EMDedYio.js","assets/diff-DA41zYPc.js","assets/crash-reporter-Dc5lvxvY.js","assets/ai-usage-log-C-jq4cW3.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import"./modulepreload-polyfill-B5Qt9EMX.js";import{j as e,r as v,c as oe,R as le}from"./styles-DToZ04ht.js";import{u as h,c as ce,l as Z,s as de,w as ue,r as pe,a as ve,b as ge,p as me,d as he,E as fe,A as xe}from"./ErrorBoundary-0fa9s44s.js";import{l as ye,a as be,b as ke,c as we,g as ee,s as je,d as te,e as re,f as Se,h as Ce,i as Re,j as Ie,k as Ae}from"./scheduled-audit-runner-EMDedYio.js";import{s as T,i as Ee}from"./crash-reporter-Dc5lvxvY.js";import{B as _}from"./ai-usage-log-C-jq4cW3.js";import{_ as O}from"./diff-DA41zYPc.js";import{copyAiFixerPrompt as Ne}from"./copy-ai-fixer-prompt-CgqCpxXL.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./design-system-audit-DpxJrxnb.js";function Q({initialUrl:t,isRunning:a,onCrawl:r,onVerifyFixes:i,onAuditThisPage:o}){const[l,s]=v.useState(t),[n,c]=v.useState(25),[p,S]=v.useState(""),[C,g]=v.useState(""),[k,m]=v.useState(!1),[f,y]=v.useState(_),[x,w]=v.useState(_[0].id),[d,u]=v.useState(null);v.useEffect(()=>{t&&!l&&s(t)},[t]),v.useEffect(()=>{let b=!1;return Promise.all([T({type:"SETTINGS_GET",key:"matrixPresets"}),T({type:"SETTINGS_GET",key:"activePresetId"})]).then(([A,E])=>{if(b)return;const U=Array.isArray(A.data)?A.data:null;y(U&&U.length>0?U:_),typeof E.data=="string"&&w(E.data)}),()=>{b=!0}},[]);function j(b){const A=f.find(E=>E.id===b);A&&(w(b),T({type:"SETTINGS_SET",key:"activePresetId",value:b}),T({type:"SETTINGS_SET",key:"stateMatrix",value:A.matrix}))}function R(){u(null);for(const[b,A]of[["Include",p.trim()],["Exclude",C.trim()]])if(A)try{new RegExp(A)}catch(E){return u(`${b} regex invalid: ${E instanceof Error?E.message:String(E)}`),!1}return!0}function z(b){if(!R())return;const A={startUrl:l.trim(),maxPages:n,includeRegex:p.trim(),excludeRegex:C.trim()};b&&i?i(A):r(A)}return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--v2-pad-3)",textAlign:"left"},children:[e.jsx(L,{label:"Start URL",children:e.jsx("input",{type:"url",value:l,onChange:b=>s(b.target.value),placeholder:"https://yoursite.com",disabled:a,className:"v2-mono",style:D})}),e.jsx(L,{label:"Max pages",hint:"1–200. Each page runs the full pipeline you configured.",children:e.jsx("input",{type:"number",min:1,max:200,value:n,onChange:b=>c(Math.min(200,Math.max(1,parseInt(b.target.value,10)||25))),disabled:a,className:"v2-mono",style:{...D,maxWidth:100}})}),e.jsx(L,{label:"Audit depth",hint:"State matrix preset applied to every crawled page.",children:e.jsx("select",{value:x,onChange:b=>j(b.target.value),disabled:a,style:D,children:f.map(b=>e.jsx("option",{value:b.id,children:b.name},b.id))})}),e.jsx("button",{type:"button",onClick:()=>m(b=>!b),className:"v2-eyebrow",style:{background:"none",border:"none",padding:0,cursor:"pointer",color:"var(--v2-ink-secondary)",textAlign:"left",alignSelf:"flex-start"},children:k?"− hide advanced filters":"+ show URL filters (include / exclude)"}),k&&e.jsxs(e.Fragment,{children:[e.jsx(L,{label:"Include only URLs matching",hint:"Optional regex. Empty = no filter.",children:e.jsx("input",{type:"text",value:p,onChange:b=>S(b.target.value),placeholder:"^https://example\\.com/products/",disabled:a,className:"v2-mono",style:D})}),e.jsx(L,{label:"Exclude URLs matching",hint:"Optional regex. Useful for /admin or /login while logged in.",children:e.jsx("input",{type:"text",value:C,onChange:b=>g(b.target.value),placeholder:"/admin|/dashboard|/login",disabled:a,className:"v2-mono",style:D})})]}),d&&e.jsx("p",{role:"alert",style:{color:"var(--v2-critical)",fontSize:12,margin:0,padding:"var(--v2-pad-2) var(--v2-pad-3)",border:"1px solid var(--v2-critical)",borderRadius:4,background:"rgba(207, 44, 44, 0.06)"},children:d}),e.jsxs("div",{style:{display:"flex",gap:"var(--v2-pad-2)",flexWrap:"wrap",marginTop:"var(--v2-pad-2)"},children:[e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary",disabled:a||!l.trim(),onClick:()=>z(!1),children:a?"Crawling…":"Crawl whole site"}),i&&e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost",disabled:a||!l.trim(),onClick:()=>z(!0),title:"Skip walkthroughs that previously passed or were human-verified",children:"Verify fixes only"}),o&&e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost",disabled:a,onClick:o,title:"Single-page audit on the active tab (no crawl)",children:"Just this page"})]})]})}function Te(){var c;const t=h(p=>p.siteCrawlProgress),a=h(p=>p.siteCrawlStatus),r=h(p=>p.progress),i=h(p=>p.aiProgress);function o(){T({type:"CANCEL_SITE_CRAWL"})}if(a!=="running")return null;const l=t?Math.min(100,Math.max(0,t.current/Math.max(1,t.total)*100)):0,s=r?Math.min(100,Math.max(0,r.current/Math.max(1,r.total)*100)):0,n=r!=null&&r.currentState?[r.currentState.pseudoState,r.currentState.theme&&r.currentState.theme!=="light"?r.currentState.theme:null,r.currentState.direction&&r.currentState.direction!=="ltr"?r.currentState.direction:null,(c=r.currentState.breakpoint)!=null&&c.id&&r.currentState.breakpoint.id!=="desktop"?r.currentState.breakpoint.id:null].filter(Boolean).join(" · "):"";return e.jsxs("div",{role:"status","aria-live":"polite",style:{background:"var(--v2-bg-elev)",border:"1px solid var(--v2-border)",borderRadius:6,padding:"var(--v2-pad-4)",display:"flex",flexDirection:"column",gap:"var(--v2-pad-3)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:"var(--v2-pad-3)"},children:[e.jsx("p",{className:"v2-eyebrow",style:{margin:0,color:"var(--v2-action)"},children:"crawling…"}),e.jsx("p",{className:"v2-mono",style:{margin:0,fontSize:12,fontWeight:600,color:"var(--v2-ink-primary)",fontVariantNumeric:"tabular-nums"},children:t?`${t.current} / ${t.total}`:"…"})]}),e.jsx("div",{role:"progressbar","aria-valuenow":(t==null?void 0:t.current)??0,"aria-valuemin":0,"aria-valuemax":(t==null?void 0:t.total)??1,"aria-label":"Crawl progress",style:{height:8,background:"var(--v2-bg-elev-2)",borderRadius:4,overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",width:`${l}%`,background:"var(--v2-action)",transition:"width 240ms ease"}})}),(t==null?void 0:t.url)&&e.jsxs("div",{children:[e.jsx("p",{className:"v2-eyebrow",style:{margin:0,marginBottom:4},children:"current page"}),e.jsx("p",{className:"v2-mono",style:{margin:0,fontSize:11,color:"var(--v2-ink-secondary)",wordBreak:"break-all"},children:t.url})]}),(t==null?void 0:t.lastViolations)!==void 0&&t.lastViolations>0&&e.jsxs("p",{className:"v2-mono",style:{margin:0,fontSize:11,color:"var(--v2-ink-tertiary)",fontVariantNumeric:"tabular-nums"},children:["last page: ",t.lastViolations," axe violation",t.lastViolations===1?"":"s"]}),r&&e.jsxs("div",{style:{marginTop:"var(--v2-pad-2)",paddingTop:"var(--v2-pad-3)",borderTop:"1px solid var(--v2-border)",display:"flex",flexDirection:"column",gap:"var(--v2-pad-2)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:"var(--v2-pad-3)"},children:[e.jsx("span",{className:"v2-eyebrow",style:{color:"var(--v2-ink-tertiary)"},children:"this page · auditing"}),e.jsxs("span",{className:"v2-mono",style:{fontSize:11,color:"var(--v2-ink-secondary)",fontVariantNumeric:"tabular-nums"},children:[r.current," / ",r.total]})]}),e.jsx("div",{role:"progressbar","aria-valuenow":r.current,"aria-valuemin":0,"aria-valuemax":r.total,"aria-label":"Current page audit progress",style:{height:4,background:"var(--v2-bg-elev-2)",borderRadius:2,overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",width:`${s}%`,background:"var(--v2-ink-tertiary)",transition:"width 240ms ease"}})}),n&&e.jsxs("p",{className:"v2-mono",style:{margin:0,fontSize:11,color:"var(--v2-ink-tertiary)"},children:["state: ",n]}),i&&e.jsxs("p",{className:"v2-mono",style:{margin:0,fontSize:11,color:"var(--v2-needs-review)",fontVariantNumeric:"tabular-nums"},children:["AI: ",i.current," / ",i.total," · ",i.currentCheckLabel,i.candidatesTotal&&i.candidatesTotal>0?` (${i.candidatesDone??0}/${i.candidatesTotal})`:""]})]}),e.jsx("div",{children:e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:o,children:"Cancel crawl"})})]})}function Ue(){const t=h(c=>c.status),a=h(c=>c.progress),r=h(c=>c.aiProgress);if(t!=="running")return null;const i=a?a.current>=a.total:!1,o=a?i?"Running deep analyzers…":`Auditing… ${a.current} / ${a.total}`:"Starting audit…",l=a?i?"reading order · tab order · typography · CSS vars · AI candidates":ze(a.currentState):"Loading axe + DOM analyzers",s=a?i?100:a.current/Math.max(1,a.total)*100:0;function n(){T({type:"CANCEL_AUDIT"})}return e.jsxs("div",{role:"status","aria-live":"polite",style:{background:"var(--v2-bg-elev)",border:"1px solid var(--v2-border)",borderRadius:6,padding:"var(--v2-pad-4)",display:"flex",flexDirection:"column",gap:"var(--v2-pad-4)"},children:[e.jsx(X,{label:o,detail:l,pct:s,valuenow:a?Math.min(a.current,a.total):0,valuemax:a?a.total:1,ariaLabel:a?i?"Running deep analyzers: reading order, tab order, typography, custom properties, AI candidates.":`Audit progress: ${a.current} of ${a.total} states`:"Audit starting",fillColor:"var(--v2-action)"}),r&&e.jsx(X,{label:`AI augmentation… ${r.current} / ${r.total}`,detail:r.candidatesTotal&&r.candidatesTotal>0?`${r.currentCheckLabel} (${r.candidatesDone??0}/${r.candidatesTotal})`:r.currentCheckLabel,pct:r.current/Math.max(1,r.total)*100,valuenow:r.current,valuemax:r.total,ariaLabel:`AI augmentation: ${r.current} of ${r.total} checks. ${r.currentCheckLabel}`,fillColor:"var(--v2-needs-review)"}),e.jsx("div",{children:e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:n,children:"Cancel audit"})})]})}function X({label:t,detail:a,pct:r,valuenow:i,valuemax:o,ariaLabel:l,fillColor:s}){return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--v2-pad-2)"},children:[e.jsx("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:"var(--v2-pad-3)"},children:e.jsx("span",{className:"v2-eyebrow",style:{margin:0,color:"var(--v2-action)"},children:t})}),e.jsx("div",{role:"progressbar","aria-valuenow":i,"aria-valuemin":0,"aria-valuemax":o,"aria-label":l,style:{height:6,background:"var(--v2-bg-elev-2)",borderRadius:3,overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",width:`${r}%`,background:s,transition:"width 240ms ease"}})}),a&&e.jsx("p",{className:"v2-mono",style:{margin:0,fontSize:11,color:"var(--v2-ink-secondary)",wordBreak:"break-all"},children:a})]})}function ze(t){if(!t)return"";const a=[t.pseudoState];return t.theme&&t.theme!=="light"&&a.push(t.theme),t.direction&&t.direction!=="ltr"&&a.push(t.direction),a.join(" · ")}function L({label:t,hint:a,children:r}){return e.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:4},children:[e.jsx("span",{className:"v2-eyebrow",style:{color:"var(--v2-ink-secondary)"},children:t}),r,a&&e.jsx("span",{style:{fontSize:11,color:"var(--v2-ink-tertiary)",lineHeight:1.4},children:a})]})}const D={fontFamily:"var(--v2-body)",fontSize:12,padding:"8px 10px",background:"var(--v2-bg)",color:"var(--v2-ink-primary)",border:"1px solid var(--v2-border-strong)",borderRadius:4,outline:"none"};function V(){const t=h(c=>c.siteCrawlReport),a=h(c=>c.results),r=h(c=>c.delta),i=h(c=>c.componentId),o=h(c=>c.status),l=h(c=>c.siteCrawlStatus),[s,n]=v.useState({report:null,resolvedFails:[]});return v.useEffect(()=>{var C;let c=!1;async function p(g){return g.length===0?[]:(await Promise.all(g.map(m=>ee(m)))).flat().filter(m=>m.verdict==="fail")}if(l==="running"||o==="running"){n({report:null,resolvedFails:[]});return}if(t)return(async()=>{const g=t.pages.map(m=>m.url),k=await p(g);c||n({report:t,resolvedFails:k})})(),()=>{c=!0};if(a.length===0||!i){n({report:null,resolvedFails:[]});return}const S=(C=a[0])==null?void 0:C.pageUrl;if(!S){n({report:null,resolvedFails:[]});return}return(async()=>{try{const[g,k,m,f]=await Promise.all([ye([i]),be([i]),ke(i),p([S])]),y=new Map([[i,g]]),x=new Map([[i,k]]),w=new Map([[i,m]]),d=new Date().toISOString(),u=we(S,[{url:S,results:a,delta:r,componentId:i,durationMs:0}],d,d,0,y,x,w);c||n({report:u,resolvedFails:f})}catch(g){console.warn("[v2] synthesize single-page report failed",g),c||n({report:null,resolvedFails:[]})}})(),()=>{c=!0}},[t,a,r,i,o,l]),s}function Pe(){const{report:t,resolvedFails:a}=V(),r=h(u=>u.siteCrawlReport),i=h(u=>u.siteCrawlStatus),o=h(u=>u.siteCrawlError),l=h(u=>u.status),s=i==="running",c=s||l==="running"&&!s,p=!!t&&!r,[S,C]=v.useState(null);v.useEffect(()=>{let u=!1;return chrome.tabs.query({active:!0,currentWindow:!0}).then(j=>{var R;u||C(((R=j[0])==null?void 0:R.url)??null)}),()=>{u=!0}},[]);const[g,k]=v.useState(!1);function m(u,j=!1){u.startUrl&&(h.getState().setSiteCrawlStatus("running"),h.getState().setSiteCrawlReport(null),h.getState().setSiteCrawlError(null),Z({type:"START_SITE_CRAWL",startUrl:u.startUrl,maxPages:u.maxPages,...u.includeRegex?{includeRegex:u.includeRegex}:{},...u.excludeRegex?{excludeRegex:u.excludeRegex}:{},...j?{verifyFixesOnly:!0}:{}}))}function f(){Z({type:"START_AUDIT",mode:"full-page"}),h.getState().startNewScan()}if(c)return e.jsx("section",{"aria-label":"Audit in progress",style:{padding:"var(--v2-pad-5) var(--v2-pad-5)",borderBottom:"1px solid var(--v2-border)"},children:s?e.jsx(Te,{}):e.jsx(Ue,{})});if(!t)return e.jsxs("section",{"aria-label":"No audit yet",style:{padding:"var(--v2-pad-6) var(--v2-pad-5)",borderBottom:"1px solid var(--v2-border)",maxWidth:640,margin:"0 auto"},children:[e.jsx("p",{className:"v2-eyebrow",style:{marginBottom:"var(--v2-pad-2)"},children:"new audit"}),e.jsx("h1",{className:"v2-display",style:{fontSize:28,fontWeight:500,letterSpacing:"-0.02em",color:"var(--v2-ink-primary)",margin:0,marginBottom:"var(--v2-pad-2)"},children:"Configure your crawl."}),o&&e.jsxs("div",{role:"alert",style:{marginBottom:"var(--v2-pad-4)",padding:"var(--v2-pad-3) var(--v2-pad-4)",border:"1px solid var(--v2-critical)",borderRadius:4,background:"rgba(207, 44, 44, 0.06)",color:"var(--v2-critical)",fontSize:12,lineHeight:1.5},children:[e.jsx("strong",{style:{fontWeight:600,marginRight:6},children:"Last crawl failed:"}),o]}),e.jsx("p",{style:{color:"var(--v2-ink-secondary)",margin:0,marginBottom:"var(--v2-pad-5)",maxWidth:520},children:"The crawler follows internal links from the start URL, same-origin only. Each page runs your full audit pipeline (axe + DOM analyzers + AI walkthroughs). Findings appear below as a single unified list."}),e.jsx(Q,{initialUrl:S??"",isRunning:c,onCrawl:u=>m(u,!1),onAuditThisPage:f})]});const y=a.length,x=(t.totalWalkthroughFindings??0)+t.totalUniqueViolations+y,w=(t.walkthroughAcknowledgements??[]).length,d=t.totalNeedsReview;return e.jsxs("section",{"aria-label":"Audit summary",style:{padding:"var(--v2-pad-6) var(--v2-pad-5)",borderBottom:"1px solid var(--v2-border)"},children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"auto 1fr",gap:"var(--v2-pad-6)"},children:[e.jsx(Le,{grade:t.siteGrade}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",justifyContent:"center",gap:"var(--v2-pad-3)"},children:[e.jsx("p",{className:"v2-eyebrow",style:{margin:0},children:p?"page grade · single-page audit":`site grade · ${t.pagesAudited} page${t.pagesAudited===1?"":"s"}`}),e.jsx("h1",{className:"v2-display",style:{fontSize:22,fontWeight:500,letterSpacing:"-0.01em",color:"var(--v2-ink-primary)",margin:0,lineHeight:1.25},children:x===0&&d===0?"All clear — nothing open.":`${x+d} finding${x+d===1?"":"s"} to address.`}),e.jsx(De,{openCount:x,reviewCount:d,verifiedCount:w,axeCount:t.totalUniqueViolations,walkthroughCount:t.totalWalkthroughFindings??0,autoCount:y}),S&&!Fe(S,t.startUrl)&&e.jsxs("p",{className:"v2-mono",style:{margin:0,fontSize:11,color:"var(--v2-ink-tertiary)",wordBreak:"break-all"},children:["Active tab: ",S]}),e.jsxs("div",{style:{display:"flex",gap:"var(--v2-pad-2)",marginTop:"var(--v2-pad-2)",flexWrap:"wrap"},children:[p?e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary",onClick:f,title:"Re-audit the current page",children:"Re-audit this page"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost",onClick:()=>k(u=>!u),"aria-expanded":g,title:"Open crawl setup to audit the whole site instead",children:g?"Hide crawl options":"Crawl whole site"})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary",onClick:()=>m({startUrl:t.startUrl,maxPages:25,includeRegex:"",excludeRegex:""},!1),title:`Re-crawl ${t.startUrl} (same options)`,children:"Re-crawl"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost",onClick:f,title:"Single-page audit of the active tab (no crawl)",children:"Just this page"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost",onClick:()=>m({startUrl:t.startUrl,maxPages:25,includeRegex:"",excludeRegex:""},!0),title:"Skip walkthroughs that previously passed or were human-verified",children:"Verify fixes only"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost",onClick:()=>k(u=>!u),"aria-expanded":g,children:g?"Hide options":"Adjust options"})]}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:()=>{ce(),h.getState().setSiteCrawlReport(null),h.getState().setSiteCrawlError(null),je(null).catch(()=>{})},title:"Wipe these results so you can start fresh",style:{marginLeft:"auto"},children:"Clear results"})]})]})]}),g&&e.jsx("div",{style:{marginTop:"var(--v2-pad-5)",paddingTop:"var(--v2-pad-4)",borderTop:"1px solid var(--v2-border)",maxWidth:640},children:e.jsx(Q,{initialUrl:t.startUrl,isRunning:c,onCrawl:u=>m(u,!1),onVerifyFixes:u=>m(u,!0),onAuditThisPage:f})})]})}function Fe(t,a){try{return new URL(t).origin===new URL(a).origin}catch{return!1}}function Le({grade:t}){const a={A:"var(--v2-grade-a)",B:"var(--v2-grade-b)",C:"var(--v2-grade-c)",D:"var(--v2-grade-d)",F:"var(--v2-grade-f)"};return e.jsx("div",{"aria-label":`Grade ${t}`,role:"img",style:{display:"flex",alignItems:"center",justifyContent:"center",minWidth:140},children:e.jsx("span",{className:"v2-display",style:{fontSize:132,lineHeight:1,fontWeight:500,color:a[t],letterSpacing:"-0.04em",fontVariationSettings:'"opsz" 144'},children:t})})}function De({openCount:t,reviewCount:a,verifiedCount:r,axeCount:i,walkthroughCount:o,autoCount:l}){return e.jsxs("dl",{style:{display:"flex",gap:"var(--v2-pad-4)",flexWrap:"wrap",margin:0,color:"var(--v2-ink-secondary)",fontSize:12},children:[e.jsx(P,{term:"open",value:t,tone:t>0?"attention":"neutral"}),e.jsx(P,{term:"review",value:a,tone:a>0?"review":"neutral"}),e.jsx(P,{term:"verified",value:r,tone:r>0?"positive":"neutral"}),e.jsx("span",{style:{color:"var(--v2-ink-faint)"},children:"·"}),e.jsx(P,{term:"axe",value:i,tone:"neutral"}),e.jsx(P,{term:"walkthrough",value:o,tone:"neutral"}),l>0&&e.jsx(P,{term:"auto-contrast",value:l,tone:"neutral"})]})}function P({term:t,value:a,tone:r}){const i={attention:"var(--v2-critical)",review:"var(--v2-needs-review)",positive:"var(--v2-verified)",neutral:"var(--v2-ink-secondary)"};return e.jsxs("div",{style:{display:"inline-flex",alignItems:"baseline",gap:6},children:[e.jsx("dt",{className:"v2-eyebrow",style:{display:"inline",margin:0,color:"var(--v2-ink-tertiary)"},children:t}),e.jsx("dd",{className:"v2-mono",style:{margin:0,fontWeight:600,fontSize:13,color:i[r],fontVariantNumeric:"tabular-nums"},children:a})]})}const $e=new Set(["2.4.3","2.1.2","2.4.7","1.3.2","1.4.11","2.5.3"]);function J(t){return $e.has(t)}async function Y(t){var i,o;const a=h.getState();if(a.componentId&&((i=a.results[0])==null?void 0:i.pageUrl)===t)return a.componentId;const r=await te();return((o=r==null?void 0:r.find(l=>l.url===t))==null?void 0:o.componentId)??null}async function We(t,a){var l;const r=h.getState(),i=[];if(r.componentId&&r.results.length>0){const s=(l=r.results[0])==null?void 0:l.pageUrl,n=a.find(c=>c.url===s);if(n){for(const c of r.results)for(const p of c.violations)p.ruleId===t&&p.target.selector===n.selector&&i.push({componentId:r.componentId,matchKey:p.matchKey});if(i.length>0)return i}}const o=await te()??[];for(const s of a){const n=o.find(c=>c.url===s.url);if(n)for(const c of n.results)for(const p of c.violations)p.ruleId===t&&p.target.selector===s.selector&&i.push({componentId:n.componentId,matchKey:p.matchKey})}return i}function Be({row:t}){return e.jsxs("details",{style:{background:"var(--v2-bg-elev)",border:"1px solid var(--v2-border)",borderRadius:6,overflow:"hidden"},children:[e.jsxs("summary",{style:{cursor:"pointer",padding:"var(--v2-pad-3) var(--v2-pad-4)",listStyle:"none",display:"flex",alignItems:"flex-start",gap:"var(--v2-pad-3)"},children:[e.jsx(He,{row:t}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx(Me,{row:t}),e.jsx(_e,{row:t})]}),e.jsx(Oe,{})]}),e.jsx("div",{style:{padding:"0 var(--v2-pad-4) var(--v2-pad-4)",borderTop:"1px solid var(--v2-border)"},children:e.jsx(Ve,{row:t})})]})}function He({row:t}){if(t.kind==="walkthrough-ack")return e.jsx("span",{className:"v2-chip v2-chip-verified","aria-label":"Status: human verified",children:"verified"});if(t.kind==="needs-review")return e.jsx("span",{className:"v2-chip v2-chip-review","aria-label":"Status: needs human review",children:"review"});if(t.kind==="auto-contrast")return e.jsx("span",{className:"v2-chip v2-chip-serious","aria-label":"Severity: serious, auto-resolved by pixel sampler",title:"Empirical pixel-contrast measurement, not an axe-confirmed violation. Human verification recommended.",children:"auto · serious"});if(t.kind==="walkthrough-fail")return e.jsx("span",{className:t.verdict==="fail"?"v2-chip v2-chip-serious":"v2-chip v2-chip-moderate","aria-label":`Severity: ${t.verdict}`,children:t.verdict});const a={critical:"v2-chip-critical",serious:"v2-chip-serious",moderate:"v2-chip-moderate",minor:"v2-chip-minor"};return e.jsx("span",{className:`v2-chip ${a[t.impact]}`,"aria-label":`Severity: ${t.impact}`,children:t.impact})}function Me({row:t}){const a=t.kind==="walkthrough-fail"||t.kind==="walkthrough-ack"||t.kind==="needs-review"||t.kind==="axe"||t.kind==="auto-contrast"?t.criterion:null,r=t.kind==="walkthrough-fail"?`AI walkthrough ${t.verdict} on this criterion.`:t.kind==="walkthrough-ack"?"Human-verified by an auditor.":t.kind==="needs-review"?t.description:t.kind==="auto-contrast"?"Empirical contrast measurement fell below threshold.":t.description;return e.jsxs("p",{style:{margin:0,marginBottom:4,color:"var(--v2-ink-primary)",fontSize:13,fontWeight:500,lineHeight:1.4},children:[a&&e.jsxs("span",{className:"v2-mono",style:{fontSize:11,fontWeight:600,color:"var(--v2-ink-tertiary)",marginRight:8},children:["WCAG ",a]}),r]})}function _e({row:t}){const a=t.kind==="axe"||t.kind==="needs-review"?t.pages.length:1,r=t.kind==="axe"||t.kind==="needs-review"||t.kind==="auto-contrast"?t.selector:null,i=t.kind==="walkthrough-fail"||t.kind==="walkthrough-ack"||t.kind==="auto-contrast"?t.pageUrl:null;return e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"var(--v2-pad-2)",flexWrap:"wrap"},children:[r&&e.jsx("code",{className:"v2-mono",style:{fontSize:11,color:"var(--v2-ink-secondary)",background:"var(--v2-bg-elev-2)",padding:"2px 6px",borderRadius:2,wordBreak:"break-all"},children:r}),i&&e.jsx("span",{className:"v2-mono",style:{fontSize:11,color:"var(--v2-ink-tertiary)",wordBreak:"break-all"},children:i}),a>1&&e.jsxs("span",{className:"v2-eyebrow",style:{marginLeft:"auto"},children:["on ",a," pages"]})]})}function Oe(){return e.jsx("span",{"aria-hidden":"true",style:{color:"var(--v2-ink-tertiary)",fontFamily:"var(--v2-mono)",fontSize:12,marginLeft:8,marginTop:2},children:"⏵"})}function Ve({row:t}){return t.kind==="walkthrough-fail"?e.jsx(Ke,{row:t}):t.kind==="walkthrough-ack"?e.jsx(qe,{row:t}):t.kind==="needs-review"?e.jsx(Ze,{row:t}):t.kind==="auto-contrast"?e.jsx(Ge,{row:t}):e.jsx(Qe,{row:t})}function Ge({row:t}){const[a,r]=v.useState(!1),[i,o]=v.useState(!1),[l,s]=v.useState(""),[n,c]=v.useState(!1),[p,S]=v.useState(!1),[C,g]=v.useState(null),k=re(t.ruleId);async function m(){if(c(!0),g(null),!l.trim()){g("Note is required — explain why the empirical contrast measurement is wrong, or why this element is acceptable in context."),c(!1);return}try{const y=(await ee(t.pageUrl)).find(w=>w.ruleId===t.ruleId&&w.selector===t.selector),x={pageUrl:t.pageUrl,ruleId:t.ruleId,selector:t.selector,verdict:"pass",reasoning:`Human override: ${l.trim()}
|
|
3
|
+
|
|
4
|
+
(Original empirical reasoning: ${t.reasoning})`,resolvedAt:new Date().toISOString(),costUsd:0,wcagCriterion:t.criterion,inputHash:y==null?void 0:y.inputHash};await Ce(x),S(!0),r(!1)}catch(f){g(f instanceof Error?f.message:String(f))}finally{c(!1)}}return e.jsxs("div",{style:{paddingTop:"var(--v2-pad-3)"},children:[e.jsx($,{label:"Empirical measurement",children:e.jsx("p",{style:{margin:0,color:"var(--v2-ink-secondary)",fontSize:12,lineHeight:1.6,whiteSpace:"pre-wrap"},children:t.reasoning})}),e.jsx("p",{style:{margin:0,marginBottom:"var(--v2-pad-3)",fontSize:11,color:"var(--v2-ink-tertiary)",lineHeight:1.5,fontStyle:"italic"},children:"This finding came from a pixel-level screenshot diff of text against the rendered background, not from axe-core. Treat as a strong hint for human review, not a confirmed violation — gradients, translucent overlays, and animated backdrops can fool the sampler."}),p?e.jsx(K,{}):e.jsxs(e.Fragment,{children:[e.jsxs(q,{children:[k&&e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:()=>o(f=>!f),"aria-expanded":i,children:i?"Hide fix recipe":"Show fix recipe"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary v2-btn-sm",onClick:()=>r(f=>!f),"aria-expanded":a,children:a?"Cancel":"Mark verified manually"})]}),i&&k&&e.jsx(ne,{summary:k.summary,snippet:k.snippet}),a&&e.jsx(G,{note:l,setNote:s,busy:n,err:C,onConfirm:m,hint:"Why the empirical measurement is wrong, or why this is acceptable. Overrides the resolution to pass.",placeholder:"e.g., Text sits over a video poster image; static screenshot misreads the rendered background. Production poster passes 7:1."}),C&&!a&&e.jsx(M,{message:C})]})]})}function Ke({row:t}){const[a,r]=v.useState(!1),[i,o]=v.useState(""),[l,s]=v.useState(!1),[n,c]=v.useState(!1),[p,S]=v.useState(!1),[C,g]=v.useState(null),[k,m]=v.useState(null),f=J(t.criterion);async function y(){if(s(!0),m(null),!i.trim()){m("Note is required — explain how you manually verified this."),s(!1);return}try{const w=await Y(t.pageUrl);if(!w){m("Could not find this page in the audit data. Re-run the audit and try again.");return}await Se({componentId:w,criterionId:t.criterion,pageUrl:t.pageUrl,note:i.trim(),acknowledgedAt:new Date().toISOString(),verdictAtAck:t.verdict}),c(!0),r(!1)}catch(w){m(w instanceof Error?w.message:String(w))}finally{s(!1)}}async function x(){var w;S(!0),g(null),m(null);try{const u=(w=(await chrome.tabs.query({active:!0,currentWindow:!0}))[0])==null?void 0:w.id;if(!u){m("Open the audited page in your active tab to re-run.");return}const j=await Y(t.pageUrl);if(!j){m("Could not find this page in the audit data.");return}if(!J(t.criterion)){m(`Re-run is only available for interactive criteria. ${t.criterion} is not supported.`);return}const z=await T({type:"INTERACTIVE_AUDIT_REQUEST",criterionId:t.criterion,tabId:u,componentId:j,pageUrl:t.pageUrl});if(!z.ok){m(z.error??"Re-run failed.");return}g(`Re-run verdict: ${z.verdict??"unknown"}. Re-audit the page to refresh this list.`)}catch(d){m(d instanceof Error?d.message:String(d))}finally{S(!1)}}return e.jsxs("div",{style:{paddingTop:"var(--v2-pad-3)"},children:[e.jsx($,{label:"AI reasoning",children:e.jsx("p",{style:{margin:0,color:"var(--v2-ink-secondary)",fontSize:12,lineHeight:1.6},children:t.reasoning})}),n?e.jsx(K,{}):e.jsxs(e.Fragment,{children:[e.jsxs(q,{children:[f&&e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:x,disabled:p,children:p?"Re-running…":"Re-run walkthrough"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary v2-btn-sm",onClick:()=>r(w=>!w),"aria-expanded":a,children:a?"Cancel":"Mark verified manually"})]}),C&&e.jsx("p",{role:"status",style:{marginTop:"var(--v2-pad-2)",padding:"var(--v2-pad-2) var(--v2-pad-3)",background:"rgba(15, 143, 94, 0.08)",border:"1px solid var(--v2-verified)",borderRadius:4,color:"var(--v2-verified)",fontSize:11,lineHeight:1.5},children:C}),a&&e.jsx(G,{note:i,setNote:o,busy:l,err:k,onConfirm:y,hint:"Explain what you checked. This goes into the forensic record.",placeholder:"e.g., Verified — focus indicator visible on every interactive control under :focus-visible; tested with keyboard nav."}),k&&!a&&e.jsx(M,{message:k})]})]})}function qe({row:t}){return e.jsxs("div",{style:{paddingTop:"var(--v2-pad-3)"},children:[e.jsx($,{label:"What the human verified",children:e.jsx("p",{style:{margin:0,color:"var(--v2-ink-secondary)",fontSize:12,lineHeight:1.6},children:t.reasoning})}),e.jsxs("p",{style:{color:"var(--v2-ink-tertiary)",fontSize:11,margin:0,marginTop:"var(--v2-pad-2)"},children:["Original AI verdict: ",e.jsx("strong",{children:t.verdict}),". Now treated as pass for conformance."]})]})}function Ze({row:t}){return e.jsx(ae,{row:t,kind:"needs-review"})}function Qe({row:t}){return e.jsx(ae,{row:t,kind:"axe"})}function ae({row:t,kind:a}){const[r,i]=v.useState(!1),[o,l]=v.useState(""),[s,n]=v.useState(!1),[c,p]=v.useState(!1),[S,C]=v.useState(!1),[g,k]=v.useState(null),m=re(t.ruleId);async function f(){if(n(!0),k(null),!o.trim()){k(a==="needs-review"?"Note is required — explain your review judgment.":"Note is required — explain why this isn't actually an issue in your context."),n(!1);return}try{const y=await We(t.ruleId,t.pages);if(y.length===0){k("Could not find this finding in the persisted audit data. Re-run the audit and try again.");return}for(const x of y)await Re({componentId:x.componentId,matchKey:x.matchKey,ruleId:t.ruleId,note:o.trim()});p(!0),i(!1)}catch(y){k(y instanceof Error?y.message:String(y))}finally{n(!1)}}return e.jsxs("div",{style:{paddingTop:"var(--v2-pad-3)"},children:[a==="needs-review"&&t.failureSummary&&e.jsx($,{label:"AI assessment",children:e.jsx("p",{style:{margin:0,color:"var(--v2-ink-secondary)",fontSize:12,lineHeight:1.6,whiteSpace:"pre-wrap"},children:t.failureSummary})}),e.jsx($,{label:"Affected",children:e.jsxs("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:4},children:[t.pages.slice(0,8).map(y=>e.jsx("li",{children:e.jsx("a",{href:y.url,target:"_blank",rel:"noopener noreferrer",className:"v2-mono",style:{fontSize:11,color:"var(--v2-ink-secondary)",textDecoration:"underline",textDecorationColor:"var(--v2-ink-faint)",textUnderlineOffset:2},children:y.url})},y.url)),t.pages.length>8&&e.jsxs("li",{className:"v2-eyebrow",children:["+ ",t.pages.length-8," more"]})]})}),c?e.jsx(K,{}):e.jsxs(e.Fragment,{children:[e.jsxs(q,{children:[a==="axe"&&m&&e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:()=>C(y=>!y),"aria-expanded":S,children:S?"Hide fix recipe":"Show fix recipe"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary v2-btn-sm",onClick:()=>i(y=>!y),"aria-expanded":r,children:r?"Cancel":"Mark verified manually"})]}),S&&m&&e.jsx(ne,{summary:m.summary,snippet:m.snippet}),r&&e.jsx(G,{note:o,setNote:l,busy:s,err:g,onConfirm:f,hint:a==="needs-review"?"Your review judgment. Goes into the forensic record.":"Why this isn't actually an issue in your context. Goes into the forensic record.",placeholder:a==="needs-review"?"e.g., Verified — image is a portrait of the named founder; alt text correctly identifies subject and role.":'e.g., This element is decorative; aria-hidden + role="presentation" applied via design system.',confirmLabel:`Confirm — acknowledge on ${t.pages.length} page${t.pages.length===1?"":"s"}`}),g&&!r&&e.jsx(M,{message:g})]})]})}function G({note:t,setNote:a,busy:r,err:i,onConfirm:o,hint:l,placeholder:s,confirmLabel:n="Confirm acknowledgement"}){return e.jsxs("div",{style:{marginTop:"var(--v2-pad-3)",padding:"var(--v2-pad-3) var(--v2-pad-4)",border:"1px solid var(--v2-border-strong)",borderRadius:4,background:"var(--v2-bg)"},children:[e.jsx("p",{className:"v2-eyebrow",style:{margin:0,marginBottom:6},children:"verification note · required"}),e.jsx("p",{style:{margin:0,marginBottom:"var(--v2-pad-2)",fontSize:11,color:"var(--v2-ink-tertiary)"},children:l}),e.jsx("textarea",{value:t,onChange:c=>a(c.target.value),placeholder:s,rows:3,style:{width:"100%",fontFamily:"var(--v2-body)",fontSize:12,lineHeight:1.5,padding:"var(--v2-pad-2) var(--v2-pad-3)",background:"var(--v2-bg)",color:"var(--v2-ink-primary)",border:"1px solid var(--v2-border-strong)",borderRadius:4,resize:"vertical",minHeight:70},autoFocus:!0}),i&&e.jsx(M,{message:i}),e.jsx("div",{style:{marginTop:"var(--v2-pad-2)"},children:e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary v2-btn-sm",onClick:o,disabled:r||!t.trim(),children:r?"Saving…":n})})]})}function ne({summary:t,snippet:a}){return e.jsxs("div",{style:{marginTop:"var(--v2-pad-3)",padding:"var(--v2-pad-3) var(--v2-pad-4)",border:"1px solid var(--v2-verified)",borderRadius:4,background:"rgba(15, 143, 94, 0.06)"},children:[e.jsx("p",{className:"v2-eyebrow",style:{margin:0,marginBottom:6,color:"var(--v2-verified)"},children:"how to fix"}),e.jsx("p",{style:{margin:0,color:"var(--v2-ink-secondary)",fontSize:12,lineHeight:1.6},children:t}),a&&e.jsx("pre",{className:"v2-mono",style:{marginTop:"var(--v2-pad-2)",marginBottom:0,padding:"var(--v2-pad-2) var(--v2-pad-3)",background:"var(--v2-bg)",border:"1px solid var(--v2-border)",borderRadius:3,fontSize:11,color:"var(--v2-ink-primary)",overflowX:"auto",whiteSpace:"pre"},children:e.jsx("code",{children:a})})]})}function K(){return e.jsxs("div",{role:"status",style:{marginTop:"var(--v2-pad-2)",padding:"var(--v2-pad-2) var(--v2-pad-3)",background:"rgba(15, 143, 94, 0.08)",border:"1px solid var(--v2-verified)",borderRadius:4,color:"var(--v2-verified)",fontSize:12,lineHeight:1.5},children:[e.jsx("strong",{style:{fontWeight:600},children:"✓ Acknowledged."})," ","The ack is saved. Re-audit or re-crawl to see this finding drop out of the list."]})}function M({message:t}){return e.jsx("p",{role:"alert",style:{marginTop:"var(--v2-pad-2)",marginBottom:0,padding:"var(--v2-pad-2) var(--v2-pad-3)",border:"1px solid var(--v2-critical)",background:"rgba(207, 44, 44, 0.06)",borderRadius:4,color:"var(--v2-critical)",fontSize:11,lineHeight:1.4},children:t})}function $({label:t,children:a}){return e.jsxs("div",{style:{marginBottom:"var(--v2-pad-3)"},children:[e.jsx("p",{className:"v2-eyebrow",style:{margin:0,marginBottom:6},children:t}),a]})}function q({children:t}){return e.jsx("div",{style:{display:"flex",gap:"var(--v2-pad-2)",flexWrap:"wrap",marginTop:"var(--v2-pad-2)"},children:t})}function Xe(){const{report:t,resolvedFails:a}=V(),[r,i]=v.useState("open"),o=v.useMemo(()=>t?et(t.pages,t.findingGroups??[],a):[],[t,a]),l=v.useMemo(()=>r==="all"?o:o.filter(n=>r==="verified"?n.kind==="walkthrough-ack":r==="review"?n.kind==="needs-review":r==="open"?n.kind==="axe"||n.kind==="walkthrough-fail"||n.kind==="auto-contrast":!0),[o,r]);if(!t)return null;const s={all:o.length,open:o.filter(n=>n.kind==="axe"||n.kind==="walkthrough-fail"||n.kind==="auto-contrast").length,review:o.filter(n=>n.kind==="needs-review").length,verified:o.filter(n=>n.kind==="walkthrough-ack").length};return e.jsxs("section",{"aria-labelledby":"findings-heading",style:{padding:"var(--v2-pad-5) var(--v2-pad-5) var(--v2-pad-7)"},children:[e.jsxs("header",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:"var(--v2-pad-3)",marginBottom:"var(--v2-pad-4)",flexWrap:"wrap"},children:[e.jsx("h2",{id:"findings-heading",className:"v2-display",style:{fontSize:20,fontWeight:500,letterSpacing:"-0.01em",color:"var(--v2-ink-primary)",margin:0},children:"Findings"}),e.jsx(Je,{filter:r,setFilter:i,counts:s})]}),l.length===0?e.jsx(Ye,{filter:r}):e.jsx("ul",{"aria-label":`${r} findings, ${l.length} items`,style:{listStyle:"none",padding:0,margin:0,display:"flex",flexDirection:"column",gap:"var(--v2-pad-2)"},children:l.map((n,c)=>e.jsx("li",{style:{animation:`v2-row-in 240ms ease ${Math.min(c,12)*30}ms both`},children:e.jsx(Be,{row:n})},n.key))})]})}function Je({filter:t,setFilter:a,counts:r}){const i=[{id:"open",label:"Open"},{id:"review",label:"Review"},{id:"verified",label:"Verified"},{id:"all",label:"All"}];return e.jsx("div",{role:"tablist","aria-label":"Filter findings",style:{display:"inline-flex",gap:4,background:"var(--v2-bg-elev)",padding:3,borderRadius:6,border:"1px solid var(--v2-border)"},children:i.map(o=>{const l=t===o.id;return e.jsxs("button",{type:"button",role:"tab","aria-selected":l,onClick:()=>a(o.id),style:{fontFamily:"var(--v2-body)",fontSize:11,padding:"5px 10px",borderRadius:4,border:"none",cursor:"pointer",background:l?"var(--v2-bg-elev-2)":"transparent",color:l?"var(--v2-ink-primary)":"var(--v2-ink-secondary)",fontWeight:l?600:500,transition:"background 120ms ease, color 120ms ease",display:"inline-flex",alignItems:"baseline",gap:5},children:[o.label,e.jsx("span",{className:"v2-mono",style:{fontSize:10,color:"var(--v2-ink-tertiary)",fontVariantNumeric:"tabular-nums"},children:r[o.id]})]},o.id)})})}function Ye({filter:t}){const r={open:{headline:"Nothing open.",sub:"No axe violations or AI walkthrough failures across the audited pages. Switch to All to see everything, or to Verified for a record of acknowledged items."},review:{headline:"No items awaiting review.",sub:"AI walkthroughs returned definitive verdicts (or human verifications) for every criterion that needed judgment."},verified:{headline:"No human verifications recorded.",sub:"When you mark a walkthrough finding as manually verified, it appears here with your note + timestamp."},all:{headline:"Nothing to show.",sub:"No audit data yet — run a scan to begin."}}[t];return e.jsxs("div",{role:"status","aria-live":"polite",style:{padding:"var(--v2-pad-6) var(--v2-pad-4)",textAlign:"center",border:"1px dashed var(--v2-border)",borderRadius:6},children:[e.jsx("p",{className:"v2-display",style:{fontSize:18,fontWeight:500,color:"var(--v2-ink-primary)",margin:0,marginBottom:"var(--v2-pad-2)"},children:r.headline}),e.jsx("p",{style:{color:"var(--v2-ink-secondary)",margin:0,maxWidth:440,marginInline:"auto"},children:r.sub})]})}function et(t,a,r=[]){const i=[];for(const s of a)s.needsReview?i.push({kind:"needs-review",key:`nr::${s.ruleId}::${s.representativeSelector}`,criterion:s.wcagCriterion,ruleId:s.ruleId,description:s.axeDescription,selector:s.representativeSelector,failureSummary:s.failureSummary,pages:s.pages,group:s}):i.push({kind:"axe",key:`axe::${s.ruleId}::${s.representativeSelector}`,criterion:s.wcagCriterion,ruleId:s.ruleId,impact:s.impact,description:s.axeDescription,selector:s.representativeSelector,pages:s.pages,isShared:s.isShared});const o=new Set;for(const s of t){for(const n of s.walkthroughFindings??[]){const c=`wt-fail::${n.criterionId}::${n.pageUrl}`;o.has(c)||(o.add(c),i.push({kind:"walkthrough-fail",key:c,criterion:n.criterionId,verdict:n.verdict,impact:n.impact,reasoning:n.reasoning,pageUrl:n.pageUrl}))}for(const n of s.walkthroughAcknowledgements??[]){const c=`wt-ack::${n.criterionId}::${n.pageUrl}`;o.has(c)||(o.add(c),i.push({kind:"walkthrough-ack",key:c,criterion:n.criterionId,verdict:n.verdict,reasoning:n.reasoning,pageUrl:n.pageUrl}))}}for(const s of r)i.push({kind:"auto-contrast",key:`auto::${s.ruleId}::${s.selector}::${s.pageUrl}`,criterion:s.wcagCriterion??"1.4.3",ruleId:s.ruleId,impact:"serious",selector:s.selector,pageUrl:s.pageUrl,reasoning:s.reasoning});const l={critical:0,serious:1,moderate:2,minor:3,"needs-review":4,ack:5};return i.sort((s,n)=>{const c=s.kind==="walkthrough-ack"?l.ack:s.kind==="needs-review"?l["needs-review"]:l[s.impact],p=n.kind==="walkthrough-ack"?l.ack:n.kind==="needs-review"?l["needs-review"]:l[n.impact];return(c??99)-(p??99)}),i}function tt({open:t,onClose:a}){const{report:r}=V(),i=h(d=>d.siteCrawlReport),o=h(d=>d.results),l=h(d=>d.componentId),s=h(d=>d.delta),n=!!i,c=n||o.length>0,[p,S]=v.useState({}),C=v.useRef(null);v.useEffect(()=>{var u;if(!t)return;const d=j=>{j.key==="Escape"&&a()};return document.addEventListener("keydown",d),(u=C.current)==null||u.focus(),()=>document.removeEventListener("keydown",d)},[t,a]);function g(d,u){S(j=>({...j,[d]:u}))}async function k(){g("ai-prompt",{state:"busy"});try{if(n){const d=await T({type:"EXPORT_REQUEST",format:"ai-prompt-site-crawl",results:[],...r?{siteCrawlReport:r}:{}});if(!(d!=null&&d.content))throw new Error("Empty response");await navigator.clipboard.writeText(d.content),await B(d.content,"ai-fixer-prompt.md","text/markdown"),g("ai-prompt",{state:"done",message:"Copied to clipboard + opened in a new tab."})}else{if(!o.length)throw new Error("No audit results yet");await Ne({results:o,componentId:l??null,delta:s}),g("ai-prompt",{state:"done",message:"Copied to clipboard + opened in a new tab."})}}catch(d){g("ai-prompt",{state:"error",message:d instanceof Error?d.message:String(d)})}}async function m(){g("html",{state:"busy"});try{if(n&&r){const{renderSiteReportHtml:d}=await O(async()=>{const{renderSiteReportHtml:j}=await import("./site-report-renderer-CO660LMz.js");return{renderSiteReportHtml:j}},__vite__mapDeps([0,1,2,3,4])),u=d(r);await B(u,"site-report.html","text/html"),g("html",{state:"done",message:"Opened in a new tab — Save as PDF or use Cmd/Ctrl+S."})}else{if(!o.length)throw new Error("No audit results yet");const d=await T({type:"EXPORT_REQUEST",format:"html-print",results:o,...s?{delta:s}:{}});if(!(d!=null&&d.content))throw new Error("Empty response");await B(d.content,"page-report.html","text/html"),g("html",{state:"done",message:"Opened in a new tab."})}}catch(d){g("html",{state:"error",message:d instanceof Error?d.message:String(d)})}}async function f(d,u,j){g(d,{state:"busy"});try{const R=await T({type:"EXPORT_REQUEST",format:d,results:n?[]:o,...s&&!n?{delta:s}:{},...n?{siteCrawlSource:!0}:{}});if(!(R!=null&&R.content))throw new Error("Empty response");await B(R.content,j,"text/html"),g(d,{state:"done",message:`${u} opened in a new tab.`})}catch(R){g(d,{state:"error",message:R instanceof Error?R.message:String(R)})}}async function y(){g("zip",{state:"busy"});try{const{createZip:d}=await O(async()=>{const{createZip:U}=await import("./zip-encoder-CtULHXx_.js");return{createZip:U}},[]),{renderSiteReportHtml:u}=await O(async()=>{const{renderSiteReportHtml:U}=await import("./site-report-renderer-CO660LMz.js");return{renderSiteReportHtml:U}},__vite__mapDeps([0,1,2,3,4])),j=[];if(n&&r)try{j.push({name:"site-report.html",content:u(r)})}catch{}const R=n?[{format:"ai-prompt-site-crawl",filename:"ai-fixer-prompt.md"},{format:"defense-bundle",filename:"defense-bundle.html"},{format:"deposition-packet",filename:"deposition-packet.html"},{format:"evidence-bundle",filename:"evidence-bundle.html"},{format:"vpat",filename:"vpat.html"},{format:"conformance-crosswalk",filename:"conformance-crosswalk.html"},{format:"methodology-doc",filename:"methodology-doc.html"},{format:"executive-report",filename:"executive-report.html"}]:[{format:"ai-prompt",filename:"ai-fixer-prompt.md"},{format:"html-print",filename:"page-report.html"}];for(const{format:U,filename:se}of R)try{const W=await T({type:"EXPORT_REQUEST",format:U,results:n?[]:o,...s&&!n?{delta:s}:{},...n?{siteCrawlSource:!0}:{}});W!=null&&W.content&&j.push({name:se,content:W.content})}catch{}if(j.length===0)throw new Error("All exports failed");const z=d(j),b=new Blob([z],{type:"application/zip"}),A=URL.createObjectURL(b),E=document.createElement("a");E.href=A,E.download=n?"wcagcheckr-site-bundle.zip":"wcagcheckr-page-bundle.zip",E.click(),setTimeout(()=>URL.revokeObjectURL(A),6e4),g("zip",{state:"done",message:`Downloaded ${j.length} file${j.length===1?"":"s"}.`})}catch(d){g("zip",{state:"error",message:d instanceof Error?d.message:String(d)})}}function x(d){h.getState().setView(d),chrome.storage.local.set({v2UiEnabled:!1}),a()}function w(){T({type:"OPEN_SETTINGS"})}return t?e.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Tools and exports",style:{position:"fixed",inset:0,zIndex:50,display:"flex"},children:[e.jsx("div",{onClick:a,style:{position:"absolute",inset:0,background:"rgba(26, 20, 16, 0.35)",backdropFilter:"blur(2px)"},"aria-hidden":"true"}),e.jsxs("div",{style:{position:"relative",marginLeft:"auto",width:"min(100%, 440px)",height:"100%",background:"var(--v2-bg)",borderLeft:"1px solid var(--v2-border-strong)",boxShadow:"-12px 0 28px rgba(26, 20, 16, 0.18)",overflowY:"auto",display:"flex",flexDirection:"column"},children:[e.jsxs("div",{style:{position:"sticky",top:0,background:"var(--v2-bg)",borderBottom:"1px solid var(--v2-border)",padding:"var(--v2-pad-4) var(--v2-pad-5)",display:"flex",alignItems:"center",justifyContent:"space-between",zIndex:1},children:[e.jsx("h2",{className:"v2-display",style:{margin:0,fontSize:18,fontWeight:500,color:"var(--v2-ink-primary)"},children:"Tools"}),e.jsx("button",{ref:C,type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:a,"aria-label":"Close tools drawer",children:"Close"})]}),e.jsxs("div",{style:{padding:"var(--v2-pad-5)",display:"flex",flexDirection:"column",gap:"var(--v2-pad-5)"},children:[!c&&e.jsx("p",{style:{margin:0,padding:"var(--v2-pad-3) var(--v2-pad-4)",background:"var(--v2-bg-elev)",border:"1px solid var(--v2-border)",borderRadius:4,color:"var(--v2-ink-secondary)",fontSize:12,lineHeight:1.5},children:"Most tools need an audit to act on. Run an audit first, then come back here."}),c&&e.jsxs(e.Fragment,{children:[e.jsx(F,{title:"AI fixer",children:e.jsx(N,{status:p["ai-prompt"],label:n?"Copy site-wide AI fix prompt":"Copy AI fix prompt",description:n?"Multi-page markdown for ChatGPT/Claude/Copilot. Site-wide summary, consistency findings, per-page violations + fix recipes.":"Markdown for ChatGPT/Claude/Copilot. Every violation with fix recipes, AI-resolved fails, acknowledged context.",onClick:k})}),e.jsxs(F,{title:"Reports",children:[e.jsx(N,{status:p.html,label:n?"Site report (HTML)":"Page report (HTML)",description:n?"Full crawl summary with per-page grades, top violations, consistency findings. Print-ready.":"Print-friendly single-page report.",onClick:m}),e.jsx(N,{status:p["executive-report"],label:"Executive report",description:"Hero grade + framing, top risks, next steps. For non-technical readers.",onClick:()=>f("executive-report","Executive report","executive-report.html")}),n&&e.jsx(N,{status:p["ticket-bundle"],label:"Ticket bundle",description:"Markdown formatted for paste into Linear / Jira / GitHub Issues — one ticket per finding, sorted by severity.",onClick:()=>f("ticket-bundle","Ticket bundle","ticket-bundle.md")})]}),e.jsxs(F,{title:"Compliance & legal",children:[e.jsx(N,{status:p["defense-bundle"],label:"Defense bundle",description:"Anchored chain-of-custody evidence package. Use in pre-litigation.",onClick:()=>f("defense-bundle","Defense bundle","defense-bundle.html")}),e.jsx(N,{status:p["deposition-packet"],label:"Deposition packet",description:"Full evidence bundle — anchor, receipts, fingerprints, signing cert.",onClick:()=>f("deposition-packet","Deposition packet","deposition-packet.html")}),e.jsx(N,{status:p.vpat,label:"VPAT",description:"Voluntary Product Accessibility Template. Procurement-ready.",onClick:()=>f("vpat","VPAT","vpat.html")}),e.jsx(N,{status:p["conformance-crosswalk"],label:"Conformance crosswalk",description:"WCAG ↔ Section 508 ↔ EN 301 549 mapping.",onClick:()=>f("conformance-crosswalk","Conformance crosswalk","conformance-crosswalk.html")}),e.jsx(N,{status:p["methodology-doc"],label:"Methodology PDF",description:"Auditor-explainable methodology — what was tested, how, with what tools.",onClick:()=>f("methodology-doc","Methodology doc","methodology-doc.html")}),e.jsx(N,{status:p["evidence-bundle"],label:"Evidence bundle",description:"Lighter than defense bundle — audit records + summary.",onClick:()=>f("evidence-bundle","Evidence bundle","evidence-bundle.html")})]}),e.jsx(F,{title:"Bulk",children:e.jsx(N,{status:p.zip,label:n?"Download all as ZIP":"Download both as ZIP",description:n?"Every format above bundled in one ZIP. Runs each export in sequence — ~30s for an 8-page crawl.":"AI fix prompt + page report in one ZIP.",onClick:y})})]}),e.jsxs(F,{title:"Specialized views (classic UI)",children:[e.jsx("p",{style:{margin:0,marginBottom:"var(--v2-pad-2)",fontSize:11,color:"var(--v2-ink-tertiary)",lineHeight:1.5},children:`These surfaces aren't ported to v2 yet — clicking opens them in the classic UI. Return to v2 anytime via the "Try v2 UI" button in the classic Header.`}),e.jsx(I,{label:"State matrix",description:"Per-state findings grid (hover · focus · dark · RTL · etc.)",onClick:()=>x("matrix")}),e.jsx(I,{label:"Per-area compliance",description:"9 sub-grade areas with drill-in: Color & contrast, Keyboard, etc.",onClick:()=>x("report")}),e.jsx(I,{label:"Baseline delta",description:"New vs. persistent vs. fixed vs. acknowledged since the last baseline.",onClick:()=>x("delta")}),e.jsx(I,{label:"Forensic log",description:"Anchored audit history with chain-of-custody.",onClick:()=>x("forensic")}),e.jsx(I,{label:"Risk dashboard",description:"Lawsuit / conformance risk tiers with prioritized actions.",onClick:()=>x("risk")}),e.jsx(I,{label:"WCAG 3 mapping",description:"Outcome-level grouping per WCAG 3 snapshot.",onClick:()=>x("wcag3")}),e.jsx(I,{label:"WCAG-EM verdicts",description:"Formal per-criterion verdict map.",onClick:()=>x("compliance")}),e.jsx(I,{label:"Schedules",description:"Recurring audit management with email alerts.",onClick:()=>x("schedules")}),e.jsx(I,{label:"Copilot chat",description:"Anthropic-powered Q&A over your audit context.",onClick:()=>x("copilot")}),e.jsx(I,{label:"Accessibility tree",description:"Inspect the live aria tree as assistive tech sees it.",onClick:()=>x("ax-tree")}),e.jsx(I,{label:"Design tokens",description:"CSS-token / design-system audit.",onClick:()=>x("tokens")}),e.jsx(I,{label:"Guided audit",description:"13 manual IGT workflows (keyboard, screen reader, etc.).",onClick:()=>x("guided")}),e.jsx(I,{label:"Per-component scorecard",description:"Custom rules, baselines, per-component drill-in.",onClick:()=>x("scorecard")}),e.jsx(I,{label:"User journey flows",description:"Multi-step audit recordings.",onClick:()=>x("flows")}),e.jsx(I,{label:"Activity / IGT runs",description:"Manual workflow run history.",onClick:()=>x("activity")})]}),e.jsx(F,{title:"Settings",children:e.jsx(N,{status:void 0,label:"Open settings",description:"Matrix preset, AI config, axe rule overrides, breakpoints, auto-export.",onClick:w})})]})]})]}):null}async function B(t,a,r){const i=new Blob([t],{type:r}),o=URL.createObjectURL(i);try{await chrome.tabs.create({url:o})}catch{const l=document.createElement("a");l.href=o,l.download=a,l.click()}setTimeout(()=>URL.revokeObjectURL(o),6e4)}function F({title:t,children:a}){return e.jsxs("div",{children:[e.jsx("p",{className:"v2-eyebrow",style:{margin:0,marginBottom:"var(--v2-pad-2)",color:"var(--v2-ink-tertiary)"},children:t}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"var(--v2-pad-2)"},children:a})]})}function N({label:t,description:a,status:r,onClick:i}){const o=(r==null?void 0:r.state)==="busy",l=(r==null?void 0:r.state)==="done",s=(r==null?void 0:r.state)==="error";return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,padding:"var(--v2-pad-3) var(--v2-pad-4)",border:"1px solid var(--v2-border)",borderRadius:4,background:"var(--v2-bg)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"var(--v2-pad-3)"},children:[e.jsx("span",{style:{fontSize:13,fontWeight:500,color:"var(--v2-ink-primary)"},children:t}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:i,disabled:o,children:o?"Working…":l?"Run again":"Run"})]}),a&&e.jsx("p",{style:{margin:0,fontSize:11,color:"var(--v2-ink-tertiary)",lineHeight:1.5},children:a}),l&&(r==null?void 0:r.message)&&e.jsxs("p",{role:"status",style:{margin:0,marginTop:4,fontSize:11,color:"var(--v2-verified)"},children:["✓ ",r.message]}),s&&(r==null?void 0:r.message)&&e.jsx("p",{role:"alert",style:{margin:0,marginTop:4,fontSize:11,color:"var(--v2-critical)"},children:r.message})]})}function I({label:t,description:a,onClick:r}){return e.jsxs("button",{type:"button",onClick:r,style:{appearance:"none",cursor:"pointer",display:"flex",flexDirection:"column",gap:4,padding:"var(--v2-pad-3) var(--v2-pad-4)",border:"1px solid var(--v2-border)",borderRadius:4,background:"var(--v2-bg)",textAlign:"left",font:"inherit",color:"var(--v2-ink-primary)",width:"100%"},children:[e.jsxs("span",{style:{fontSize:13,fontWeight:500},children:[t," →"]}),e.jsx("span",{style:{fontSize:11,color:"var(--v2-ink-tertiary)",lineHeight:1.5},children:a})]})}function rt(){var l,s;const t=h(n=>n.siteCrawlReport),a=h(n=>n.results),[r,i]=v.useState(!1),o=(t==null?void 0:t.startUrl)??((l=a[0])==null?void 0:l.pageUrl)??((s=a[0])==null?void 0:s.scope)??null;return e.jsxs(e.Fragment,{children:[e.jsxs("header",{role:"banner",style:{display:"flex",alignItems:"center",gap:"var(--v2-pad-4)",padding:"var(--v2-pad-3) var(--v2-pad-5)",borderBottom:"1px solid var(--v2-border)",background:"var(--v2-bg)",minHeight:44},children:[e.jsx("a",{href:"#main-content",className:"v2-skip-link",style:{position:"absolute",left:-9999},onFocus:n=>{n.currentTarget.style.left="var(--v2-pad-4)",n.currentTarget.style.top="var(--v2-pad-4)"},onBlur:n=>{n.currentTarget.style.left="-9999px"},children:"Skip to main content"}),e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"var(--v2-pad-2)"},children:[e.jsx("span",{className:"v2-display",style:{fontSize:18,fontWeight:600,letterSpacing:"-0.01em",color:"var(--v2-ink-primary)"},children:"wcagcheckr"}),e.jsx("span",{className:"v2-eyebrow",children:"v2"})]}),o&&e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"var(--v2-pad-2)",marginLeft:"var(--v2-pad-4)",minWidth:0,flex:1},children:[e.jsx("span",{className:"v2-eyebrow",children:"scope"}),e.jsx("span",{className:"v2-mono",style:{fontSize:11,color:"var(--v2-ink-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},title:o,children:o})]}),e.jsxs("nav",{"aria-label":"Application",style:{display:"flex",gap:"var(--v2-pad-1)",marginLeft:"auto"},children:[e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:()=>{chrome.storage.local.set({v2UiEnabled:!1})},"aria-label":"Switch back to the classic UI",title:"Switch back to the classic v1 UI",children:"Use v1"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary v2-btn-sm",onClick:()=>i(!0),"aria-label":"Open tools and exports drawer","aria-expanded":r,title:"Exports, baselines, schedules, forensic log, settings, more",children:"Tools"})]})]}),e.jsx(tt,{open:r,onClose:()=>i(!1)})]})}function at(){return v.useEffect(()=>{const t=de(),r=new URLSearchParams(window.location.search).get("context")==="overlay"?null:chrome.runtime.connect({name:"sidepanel-tracker"}),i=ue();pe({forceRefresh:!0}).catch(()=>{}),ve().catch(()=>{}),ge().catch(()=>{}),me().catch(()=>{}),he().catch(()=>{}),Ie().then(l=>{h.getState().setAcknowledgedKeys(new Set(l.map(s=>s.matchKey)))}).catch(()=>{});let o=!1;return Ae().then(l=>{o||l&&h.setState({siteCrawlReport:l})}).catch(()=>{}),()=>{o=!0,i();try{t.disconnect()}catch{}try{r==null||r.disconnect()}catch{}}},[]),e.jsxs("div",{className:"v2-root",children:[e.jsx(rt,{}),e.jsxs("main",{id:"main-content","aria-label":"wcagcheckr findings",children:[e.jsx(Pe,{}),e.jsx(Xe,{})]})]})}Ee("side-panel");const H="v2UiEnabled";function nt(){const[t,a]=v.useState(null);return v.useEffect(()=>{let r=!1;chrome.storage.local.get(H).then(o=>{r||a(!!o[H])}).catch(()=>a(!1));const i=(o,l)=>{var s;l==="local"&&H in o&&a(!!((s=o[H])!=null&&s.newValue))};return chrome.storage.onChanged.addListener(i),()=>{r=!0,chrome.storage.onChanged.removeListener(i)}},[]),t===null?null:t?e.jsx(at,{}):e.jsx(xe,{})}const ie=document.getElementById("root");if(!ie)throw new Error("side-panel: #root not found");oe(ie).render(e.jsx(le.StrictMode,{children:e.jsx(fe,{children:e.jsx(nt,{})})}));
|
package/dist/manifest.json
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
"manifest_version": 3,
|
|
3
3
|
"name": "wcagcheckr",
|
|
4
4
|
"description": "Audit components across hover, focus, dark mode, forced colors, RTL — every state your users actually encounter. Per-component baselines surface only NEW violations.",
|
|
5
|
-
"version": "1.0.0.
|
|
6
|
-
"version_name": "1.0.0-rc.
|
|
5
|
+
"version": "1.0.0.290",
|
|
6
|
+
"version_name": "1.0.0-rc.290",
|
|
7
7
|
"author": "Locustware",
|
|
8
8
|
"homepage_url": "https://wcagcheckr.com",
|
|
9
9
|
"icons": {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>WCAG Component Auditor</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/side-panel-
|
|
7
|
+
<script type="module" crossorigin src="/assets/side-panel-Btq9c9oj.js"></script>
|
|
8
8
|
<link rel="modulepreload" crossorigin href="/assets/modulepreload-polyfill-B5Qt9EMX.js">
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/_commonjsHelpers-Cpj98o6Y.js">
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/assets/crash-reporter-Dc5lvxvY.js">
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
<link rel="modulepreload" crossorigin href="/assets/scheduled-audit-runner-EMDedYio.js">
|
|
15
15
|
<link rel="modulepreload" crossorigin href="/assets/design-system-audit-DpxJrxnb.js">
|
|
16
16
|
<link rel="modulepreload" crossorigin href="/assets/ErrorBoundary-0fa9s44s.js">
|
|
17
|
+
<link rel="modulepreload" crossorigin href="/assets/copy-ai-fixer-prompt-CgqCpxXL.js">
|
|
17
18
|
<link rel="stylesheet" crossorigin href="/assets/styles-d5msFsnl.css">
|
|
18
19
|
<link rel="stylesheet" crossorigin href="/assets/side-panel-Ctm2yXeo.css">
|
|
19
20
|
</head>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wcag-checkr/ci",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.290",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Headless wcagcheckr accessibility audit runner for CI/CD pipelines. Drives the wcagcheckr Chrome extension via Playwright, runs full-page audits across the state matrix (108 combinations: hover, focus, dark mode, RTL, breakpoints), outputs JSON / SARIF / JUnit, exits with severity-aware codes.",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import"./modulepreload-polyfill-B5Qt9EMX.js";import{j as e,r as c,c as ee,R as te}from"./styles-DToZ04ht.js";import{u as g,c as re,l as H,s as ae,w as ne,r as ie,a as se,b as le,p as oe,d as de,E as ce,A as ue}from"./ErrorBoundary-0fa9s44s.js";import{l as ve,a as pe,b as ge,c as he,g as K,s as me,d as q,e as J,f as fe,h as xe,i as ye,j as be,k as ke}from"./scheduled-audit-runner-EMDedYio.js";import{s as I,i as je}from"./crash-reporter-Dc5lvxvY.js";import{B as P}from"./ai-usage-log-C-jq4cW3.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./diff-DA41zYPc.js";import"./design-system-audit-DpxJrxnb.js";function V({initialUrl:t,isRunning:r,onCrawl:a,onVerifyFixes:n,onAuditThisPage:d}){const[l,i]=c.useState(t),[s,o]=c.useState(25),[v,k]=c.useState(""),[j,h]=c.useState(""),[x,p]=c.useState(!1),[y,m]=c.useState(P),[w,b]=c.useState(P[0].id),[S,u]=c.useState(null);c.useEffect(()=>{t&&!l&&i(t)},[t]),c.useEffect(()=>{let f=!1;return Promise.all([I({type:"SETTINGS_GET",key:"matrixPresets"}),I({type:"SETTINGS_GET",key:"activePresetId"})]).then(([C,N])=>{if(f)return;const B=Array.isArray(C.data)?C.data:null;m(B&&B.length>0?B:P),typeof N.data=="string"&&b(N.data)}),()=>{f=!0}},[]);function R(f){const C=y.find(N=>N.id===f);C&&(b(f),I({type:"SETTINGS_SET",key:"activePresetId",value:f}),I({type:"SETTINGS_SET",key:"stateMatrix",value:C.matrix}))}function E(){u(null);for(const[f,C]of[["Include",v.trim()],["Exclude",j.trim()]])if(C)try{new RegExp(C)}catch(N){return u(`${f} regex invalid: ${N instanceof Error?N.message:String(N)}`),!1}return!0}function A(f){if(!E())return;const C={startUrl:l.trim(),maxPages:s,includeRegex:v.trim(),excludeRegex:j.trim()};f&&n?n(C):a(C)}return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--v2-pad-3)",textAlign:"left"},children:[e.jsx(U,{label:"Start URL",children:e.jsx("input",{type:"url",value:l,onChange:f=>i(f.target.value),placeholder:"https://yoursite.com",disabled:r,className:"v2-mono",style:$})}),e.jsx(U,{label:"Max pages",hint:"1–200. Each page runs the full pipeline you configured.",children:e.jsx("input",{type:"number",min:1,max:200,value:s,onChange:f=>o(Math.min(200,Math.max(1,parseInt(f.target.value,10)||25))),disabled:r,className:"v2-mono",style:{...$,maxWidth:100}})}),e.jsx(U,{label:"Audit depth",hint:"State matrix preset applied to every crawled page.",children:e.jsx("select",{value:w,onChange:f=>R(f.target.value),disabled:r,style:$,children:y.map(f=>e.jsx("option",{value:f.id,children:f.name},f.id))})}),e.jsx("button",{type:"button",onClick:()=>p(f=>!f),className:"v2-eyebrow",style:{background:"none",border:"none",padding:0,cursor:"pointer",color:"var(--v2-ink-secondary)",textAlign:"left",alignSelf:"flex-start"},children:x?"− hide advanced filters":"+ show URL filters (include / exclude)"}),x&&e.jsxs(e.Fragment,{children:[e.jsx(U,{label:"Include only URLs matching",hint:"Optional regex. Empty = no filter.",children:e.jsx("input",{type:"text",value:v,onChange:f=>k(f.target.value),placeholder:"^https://example\\.com/products/",disabled:r,className:"v2-mono",style:$})}),e.jsx(U,{label:"Exclude URLs matching",hint:"Optional regex. Useful for /admin or /login while logged in.",children:e.jsx("input",{type:"text",value:j,onChange:f=>h(f.target.value),placeholder:"/admin|/dashboard|/login",disabled:r,className:"v2-mono",style:$})})]}),S&&e.jsx("p",{role:"alert",style:{color:"var(--v2-critical)",fontSize:12,margin:0,padding:"var(--v2-pad-2) var(--v2-pad-3)",border:"1px solid var(--v2-critical)",borderRadius:4,background:"rgba(207, 44, 44, 0.06)"},children:S}),e.jsxs("div",{style:{display:"flex",gap:"var(--v2-pad-2)",flexWrap:"wrap",marginTop:"var(--v2-pad-2)"},children:[e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary",disabled:r||!l.trim(),onClick:()=>A(!1),children:r?"Crawling…":"Crawl whole site"}),n&&e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost",disabled:r||!l.trim(),onClick:()=>A(!0),title:"Skip walkthroughs that previously passed or were human-verified",children:"Verify fixes only"}),d&&e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost",disabled:r,onClick:d,title:"Single-page audit on the active tab (no crawl)",children:"Just this page"})]})]})}function we(){var o;const t=g(v=>v.siteCrawlProgress),r=g(v=>v.siteCrawlStatus),a=g(v=>v.progress),n=g(v=>v.aiProgress);function d(){I({type:"CANCEL_SITE_CRAWL"})}if(r!=="running")return null;const l=t?Math.min(100,Math.max(0,t.current/Math.max(1,t.total)*100)):0,i=a?Math.min(100,Math.max(0,a.current/Math.max(1,a.total)*100)):0,s=a!=null&&a.currentState?[a.currentState.pseudoState,a.currentState.theme&&a.currentState.theme!=="light"?a.currentState.theme:null,a.currentState.direction&&a.currentState.direction!=="ltr"?a.currentState.direction:null,(o=a.currentState.breakpoint)!=null&&o.id&&a.currentState.breakpoint.id!=="desktop"?a.currentState.breakpoint.id:null].filter(Boolean).join(" · "):"";return e.jsxs("div",{role:"status","aria-live":"polite",style:{background:"var(--v2-bg-elev)",border:"1px solid var(--v2-border)",borderRadius:6,padding:"var(--v2-pad-4)",display:"flex",flexDirection:"column",gap:"var(--v2-pad-3)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:"var(--v2-pad-3)"},children:[e.jsx("p",{className:"v2-eyebrow",style:{margin:0,color:"var(--v2-action)"},children:"crawling…"}),e.jsx("p",{className:"v2-mono",style:{margin:0,fontSize:12,fontWeight:600,color:"var(--v2-ink-primary)",fontVariantNumeric:"tabular-nums"},children:t?`${t.current} / ${t.total}`:"…"})]}),e.jsx("div",{role:"progressbar","aria-valuenow":(t==null?void 0:t.current)??0,"aria-valuemin":0,"aria-valuemax":(t==null?void 0:t.total)??1,"aria-label":"Crawl progress",style:{height:8,background:"var(--v2-bg-elev-2)",borderRadius:4,overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",width:`${l}%`,background:"var(--v2-action)",transition:"width 240ms ease"}})}),(t==null?void 0:t.url)&&e.jsxs("div",{children:[e.jsx("p",{className:"v2-eyebrow",style:{margin:0,marginBottom:4},children:"current page"}),e.jsx("p",{className:"v2-mono",style:{margin:0,fontSize:11,color:"var(--v2-ink-secondary)",wordBreak:"break-all"},children:t.url})]}),(t==null?void 0:t.lastViolations)!==void 0&&t.lastViolations>0&&e.jsxs("p",{className:"v2-mono",style:{margin:0,fontSize:11,color:"var(--v2-ink-tertiary)",fontVariantNumeric:"tabular-nums"},children:["last page: ",t.lastViolations," axe violation",t.lastViolations===1?"":"s"]}),a&&e.jsxs("div",{style:{marginTop:"var(--v2-pad-2)",paddingTop:"var(--v2-pad-3)",borderTop:"1px solid var(--v2-border)",display:"flex",flexDirection:"column",gap:"var(--v2-pad-2)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:"var(--v2-pad-3)"},children:[e.jsx("span",{className:"v2-eyebrow",style:{color:"var(--v2-ink-tertiary)"},children:"this page · auditing"}),e.jsxs("span",{className:"v2-mono",style:{fontSize:11,color:"var(--v2-ink-secondary)",fontVariantNumeric:"tabular-nums"},children:[a.current," / ",a.total]})]}),e.jsx("div",{role:"progressbar","aria-valuenow":a.current,"aria-valuemin":0,"aria-valuemax":a.total,"aria-label":"Current page audit progress",style:{height:4,background:"var(--v2-bg-elev-2)",borderRadius:2,overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",width:`${i}%`,background:"var(--v2-ink-tertiary)",transition:"width 240ms ease"}})}),s&&e.jsxs("p",{className:"v2-mono",style:{margin:0,fontSize:11,color:"var(--v2-ink-tertiary)"},children:["state: ",s]}),n&&e.jsxs("p",{className:"v2-mono",style:{margin:0,fontSize:11,color:"var(--v2-needs-review)",fontVariantNumeric:"tabular-nums"},children:["AI: ",n.current," / ",n.total," · ",n.currentCheckLabel,n.candidatesTotal&&n.candidatesTotal>0?` (${n.candidatesDone??0}/${n.candidatesTotal})`:""]})]}),e.jsx("div",{children:e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:d,children:"Cancel crawl"})})]})}function Se(){const t=g(o=>o.status),r=g(o=>o.progress),a=g(o=>o.aiProgress);if(t!=="running")return null;const n=r?r.current>=r.total:!1,d=r?n?"Running deep analyzers…":`Auditing… ${r.current} / ${r.total}`:"Starting audit…",l=r?n?"reading order · tab order · typography · CSS vars · AI candidates":Ce(r.currentState):"Loading axe + DOM analyzers",i=r?n?100:r.current/Math.max(1,r.total)*100:0;function s(){I({type:"CANCEL_AUDIT"})}return e.jsxs("div",{role:"status","aria-live":"polite",style:{background:"var(--v2-bg-elev)",border:"1px solid var(--v2-border)",borderRadius:6,padding:"var(--v2-pad-4)",display:"flex",flexDirection:"column",gap:"var(--v2-pad-4)"},children:[e.jsx(O,{label:d,detail:l,pct:i,valuenow:r?Math.min(r.current,r.total):0,valuemax:r?r.total:1,ariaLabel:r?n?"Running deep analyzers: reading order, tab order, typography, custom properties, AI candidates.":`Audit progress: ${r.current} of ${r.total} states`:"Audit starting",fillColor:"var(--v2-action)"}),a&&e.jsx(O,{label:`AI augmentation… ${a.current} / ${a.total}`,detail:a.candidatesTotal&&a.candidatesTotal>0?`${a.currentCheckLabel} (${a.candidatesDone??0}/${a.candidatesTotal})`:a.currentCheckLabel,pct:a.current/Math.max(1,a.total)*100,valuenow:a.current,valuemax:a.total,ariaLabel:`AI augmentation: ${a.current} of ${a.total} checks. ${a.currentCheckLabel}`,fillColor:"var(--v2-needs-review)"}),e.jsx("div",{children:e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:s,children:"Cancel audit"})})]})}function O({label:t,detail:r,pct:a,valuenow:n,valuemax:d,ariaLabel:l,fillColor:i}){return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--v2-pad-2)"},children:[e.jsx("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:"var(--v2-pad-3)"},children:e.jsx("span",{className:"v2-eyebrow",style:{margin:0,color:"var(--v2-action)"},children:t})}),e.jsx("div",{role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":d,"aria-label":l,style:{height:6,background:"var(--v2-bg-elev-2)",borderRadius:3,overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",width:`${a}%`,background:i,transition:"width 240ms ease"}})}),r&&e.jsx("p",{className:"v2-mono",style:{margin:0,fontSize:11,color:"var(--v2-ink-secondary)",wordBreak:"break-all"},children:r})]})}function Ce(t){if(!t)return"";const r=[t.pseudoState];return t.theme&&t.theme!=="light"&&r.push(t.theme),t.direction&&t.direction!=="ltr"&&r.push(t.direction),r.join(" · ")}function U({label:t,hint:r,children:a}){return e.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:4},children:[e.jsx("span",{className:"v2-eyebrow",style:{color:"var(--v2-ink-secondary)"},children:t}),a,r&&e.jsx("span",{style:{fontSize:11,color:"var(--v2-ink-tertiary)",lineHeight:1.4},children:r})]})}const $={fontFamily:"var(--v2-body)",fontSize:12,padding:"8px 10px",background:"var(--v2-bg)",color:"var(--v2-ink-primary)",border:"1px solid var(--v2-border-strong)",borderRadius:4,outline:"none"};function Y(){const t=g(o=>o.siteCrawlReport),r=g(o=>o.results),a=g(o=>o.delta),n=g(o=>o.componentId),d=g(o=>o.status),l=g(o=>o.siteCrawlStatus),[i,s]=c.useState({report:null,resolvedFails:[]});return c.useEffect(()=>{var j;let o=!1;async function v(h){return h.length===0?[]:(await Promise.all(h.map(p=>K(p)))).flat().filter(p=>p.verdict==="fail")}if(l==="running"||d==="running"){s({report:null,resolvedFails:[]});return}if(t)return(async()=>{const h=t.pages.map(p=>p.url),x=await v(h);o||s({report:t,resolvedFails:x})})(),()=>{o=!0};if(r.length===0||!n){s({report:null,resolvedFails:[]});return}const k=(j=r[0])==null?void 0:j.pageUrl;if(!k){s({report:null,resolvedFails:[]});return}return(async()=>{try{const[h,x,p,y]=await Promise.all([ve([n]),pe([n]),ge(n),v([k])]),m=new Map([[n,h]]),w=new Map([[n,x]]),b=new Map([[n,p]]),S=new Date().toISOString(),u=he(k,[{url:k,results:r,delta:a,componentId:n,durationMs:0}],S,S,0,m,w,b);o||s({report:u,resolvedFails:y})}catch(h){console.warn("[v2] synthesize single-page report failed",h),o||s({report:null,resolvedFails:[]})}})(),()=>{o=!0}},[t,r,a,n,d,l]),i}function Re(){const{report:t,resolvedFails:r}=Y(),a=g(u=>u.siteCrawlReport),n=g(u=>u.siteCrawlStatus),d=g(u=>u.siteCrawlError),l=g(u=>u.status),i=n==="running",o=i||l==="running"&&!i,v=!!t&&!a,[k,j]=c.useState(null);c.useEffect(()=>{let u=!1;return chrome.tabs.query({active:!0,currentWindow:!0}).then(R=>{var E;u||j(((E=R[0])==null?void 0:E.url)??null)}),()=>{u=!0}},[]);const[h,x]=c.useState(!1);function p(u,R=!1){u.startUrl&&(g.getState().setSiteCrawlStatus("running"),g.getState().setSiteCrawlReport(null),g.getState().setSiteCrawlError(null),H({type:"START_SITE_CRAWL",startUrl:u.startUrl,maxPages:u.maxPages,...u.includeRegex?{includeRegex:u.includeRegex}:{},...u.excludeRegex?{excludeRegex:u.excludeRegex}:{},...R?{verifyFixesOnly:!0}:{}}))}function y(){H({type:"START_AUDIT",mode:"full-page"}),g.getState().startNewScan()}if(o)return e.jsx("section",{"aria-label":"Audit in progress",style:{padding:"var(--v2-pad-5) var(--v2-pad-5)",borderBottom:"1px solid var(--v2-border)"},children:i?e.jsx(we,{}):e.jsx(Se,{})});if(!t)return e.jsxs("section",{"aria-label":"No audit yet",style:{padding:"var(--v2-pad-6) var(--v2-pad-5)",borderBottom:"1px solid var(--v2-border)",maxWidth:640,margin:"0 auto"},children:[e.jsx("p",{className:"v2-eyebrow",style:{marginBottom:"var(--v2-pad-2)"},children:"new audit"}),e.jsx("h1",{className:"v2-display",style:{fontSize:28,fontWeight:500,letterSpacing:"-0.02em",color:"var(--v2-ink-primary)",margin:0,marginBottom:"var(--v2-pad-2)"},children:"Configure your crawl."}),d&&e.jsxs("div",{role:"alert",style:{marginBottom:"var(--v2-pad-4)",padding:"var(--v2-pad-3) var(--v2-pad-4)",border:"1px solid var(--v2-critical)",borderRadius:4,background:"rgba(207, 44, 44, 0.06)",color:"var(--v2-critical)",fontSize:12,lineHeight:1.5},children:[e.jsx("strong",{style:{fontWeight:600,marginRight:6},children:"Last crawl failed:"}),d]}),e.jsx("p",{style:{color:"var(--v2-ink-secondary)",margin:0,marginBottom:"var(--v2-pad-5)",maxWidth:520},children:"The crawler follows internal links from the start URL, same-origin only. Each page runs your full audit pipeline (axe + DOM analyzers + AI walkthroughs). Findings appear below as a single unified list."}),e.jsx(V,{initialUrl:k??"",isRunning:o,onCrawl:u=>p(u,!1),onAuditThisPage:y})]});const m=r.length,w=(t.totalWalkthroughFindings??0)+t.totalUniqueViolations+m,b=(t.walkthroughAcknowledgements??[]).length,S=t.totalNeedsReview;return e.jsxs("section",{"aria-label":"Audit summary",style:{padding:"var(--v2-pad-6) var(--v2-pad-5)",borderBottom:"1px solid var(--v2-border)"},children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"auto 1fr",gap:"var(--v2-pad-6)"},children:[e.jsx(Ie,{grade:t.siteGrade}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",justifyContent:"center",gap:"var(--v2-pad-3)"},children:[e.jsx("p",{className:"v2-eyebrow",style:{margin:0},children:v?"page grade · single-page audit":`site grade · ${t.pagesAudited} page${t.pagesAudited===1?"":"s"}`}),e.jsx("h1",{className:"v2-display",style:{fontSize:22,fontWeight:500,letterSpacing:"-0.01em",color:"var(--v2-ink-primary)",margin:0,lineHeight:1.25},children:w===0&&S===0?"All clear — nothing open.":`${w+S} finding${w+S===1?"":"s"} to address.`}),e.jsx(Ae,{openCount:w,reviewCount:S,verifiedCount:b,axeCount:t.totalUniqueViolations,walkthroughCount:t.totalWalkthroughFindings??0,autoCount:m}),k&&!Ne(k,t.startUrl)&&e.jsxs("p",{className:"v2-mono",style:{margin:0,fontSize:11,color:"var(--v2-ink-tertiary)",wordBreak:"break-all"},children:["Active tab: ",k]}),e.jsxs("div",{style:{display:"flex",gap:"var(--v2-pad-2)",marginTop:"var(--v2-pad-2)",flexWrap:"wrap"},children:[v?e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary",onClick:y,title:"Re-audit the current page",children:"Re-audit this page"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost",onClick:()=>x(u=>!u),"aria-expanded":h,title:"Open crawl setup to audit the whole site instead",children:h?"Hide crawl options":"Crawl whole site"})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary",onClick:()=>p({startUrl:t.startUrl,maxPages:25,includeRegex:"",excludeRegex:""},!1),title:`Re-crawl ${t.startUrl} (same options)`,children:"Re-crawl"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost",onClick:y,title:"Single-page audit of the active tab (no crawl)",children:"Just this page"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost",onClick:()=>p({startUrl:t.startUrl,maxPages:25,includeRegex:"",excludeRegex:""},!0),title:"Skip walkthroughs that previously passed or were human-verified",children:"Verify fixes only"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost",onClick:()=>x(u=>!u),"aria-expanded":h,children:h?"Hide options":"Adjust options"})]}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:()=>{re(),g.getState().setSiteCrawlReport(null),g.getState().setSiteCrawlError(null),me(null).catch(()=>{})},title:"Wipe these results so you can start fresh",style:{marginLeft:"auto"},children:"Clear results"})]})]})]}),h&&e.jsx("div",{style:{marginTop:"var(--v2-pad-5)",paddingTop:"var(--v2-pad-4)",borderTop:"1px solid var(--v2-border)",maxWidth:640},children:e.jsx(V,{initialUrl:t.startUrl,isRunning:o,onCrawl:u=>p(u,!1),onVerifyFixes:u=>p(u,!0),onAuditThisPage:y})})]})}function Ne(t,r){try{return new URL(t).origin===new URL(r).origin}catch{return!1}}function Ie({grade:t}){const r={A:"var(--v2-grade-a)",B:"var(--v2-grade-b)",C:"var(--v2-grade-c)",D:"var(--v2-grade-d)",F:"var(--v2-grade-f)"};return e.jsx("div",{"aria-label":`Grade ${t}`,role:"img",style:{display:"flex",alignItems:"center",justifyContent:"center",minWidth:140},children:e.jsx("span",{className:"v2-display",style:{fontSize:132,lineHeight:1,fontWeight:500,color:r[t],letterSpacing:"-0.04em",fontVariationSettings:'"opsz" 144'},children:t})})}function Ae({openCount:t,reviewCount:r,verifiedCount:a,axeCount:n,walkthroughCount:d,autoCount:l}){return e.jsxs("dl",{style:{display:"flex",gap:"var(--v2-pad-4)",flexWrap:"wrap",margin:0,color:"var(--v2-ink-secondary)",fontSize:12},children:[e.jsx(T,{term:"open",value:t,tone:t>0?"attention":"neutral"}),e.jsx(T,{term:"review",value:r,tone:r>0?"review":"neutral"}),e.jsx(T,{term:"verified",value:a,tone:a>0?"positive":"neutral"}),e.jsx("span",{style:{color:"var(--v2-ink-faint)"},children:"·"}),e.jsx(T,{term:"axe",value:n,tone:"neutral"}),e.jsx(T,{term:"walkthrough",value:d,tone:"neutral"}),l>0&&e.jsx(T,{term:"auto-contrast",value:l,tone:"neutral"})]})}function T({term:t,value:r,tone:a}){const n={attention:"var(--v2-critical)",review:"var(--v2-needs-review)",positive:"var(--v2-verified)",neutral:"var(--v2-ink-secondary)"};return e.jsxs("div",{style:{display:"inline-flex",alignItems:"baseline",gap:6},children:[e.jsx("dt",{className:"v2-eyebrow",style:{display:"inline",margin:0,color:"var(--v2-ink-tertiary)"},children:t}),e.jsx("dd",{className:"v2-mono",style:{margin:0,fontWeight:600,fontSize:13,color:n[a],fontVariantNumeric:"tabular-nums"},children:r})]})}const Te=new Set(["2.4.3","2.1.2","2.4.7","1.3.2","1.4.11","2.5.3"]);function _(t){return Te.has(t)}async function G(t){var n,d;const r=g.getState();if(r.componentId&&((n=r.results[0])==null?void 0:n.pageUrl)===t)return r.componentId;const a=await q();return((d=a==null?void 0:a.find(l=>l.url===t))==null?void 0:d.componentId)??null}async function Ee(t,r){var l;const a=g.getState(),n=[];if(a.componentId&&a.results.length>0){const i=(l=a.results[0])==null?void 0:l.pageUrl,s=r.find(o=>o.url===i);if(s){for(const o of a.results)for(const v of o.violations)v.ruleId===t&&v.target.selector===s.selector&&n.push({componentId:a.componentId,matchKey:v.matchKey});if(n.length>0)return n}}const d=await q()??[];for(const i of r){const s=d.find(o=>o.url===i.url);if(s)for(const o of s.results)for(const v of o.violations)v.ruleId===t&&v.target.selector===i.selector&&n.push({componentId:s.componentId,matchKey:v.matchKey})}return n}function Ue({row:t}){return e.jsxs("details",{style:{background:"var(--v2-bg-elev)",border:"1px solid var(--v2-border)",borderRadius:6,overflow:"hidden"},children:[e.jsxs("summary",{style:{cursor:"pointer",padding:"var(--v2-pad-3) var(--v2-pad-4)",listStyle:"none",display:"flex",alignItems:"flex-start",gap:"var(--v2-pad-3)"},children:[e.jsx($e,{row:t}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx(ze,{row:t}),e.jsx(Fe,{row:t})]}),e.jsx(We,{})]}),e.jsx("div",{style:{padding:"0 var(--v2-pad-4) var(--v2-pad-4)",borderTop:"1px solid var(--v2-border)"},children:e.jsx(Be,{row:t})})]})}function $e({row:t}){if(t.kind==="walkthrough-ack")return e.jsx("span",{className:"v2-chip v2-chip-verified","aria-label":"Status: human verified",children:"verified"});if(t.kind==="needs-review")return e.jsx("span",{className:"v2-chip v2-chip-review","aria-label":"Status: needs human review",children:"review"});if(t.kind==="auto-contrast")return e.jsx("span",{className:"v2-chip v2-chip-serious","aria-label":"Severity: serious, auto-resolved by pixel sampler",title:"Empirical pixel-contrast measurement, not an axe-confirmed violation. Human verification recommended.",children:"auto · serious"});if(t.kind==="walkthrough-fail")return e.jsx("span",{className:t.verdict==="fail"?"v2-chip v2-chip-serious":"v2-chip v2-chip-moderate","aria-label":`Severity: ${t.verdict}`,children:t.verdict});const r={critical:"v2-chip-critical",serious:"v2-chip-serious",moderate:"v2-chip-moderate",minor:"v2-chip-minor"};return e.jsx("span",{className:`v2-chip ${r[t.impact]}`,"aria-label":`Severity: ${t.impact}`,children:t.impact})}function ze({row:t}){const r=t.kind==="walkthrough-fail"||t.kind==="walkthrough-ack"||t.kind==="needs-review"||t.kind==="axe"||t.kind==="auto-contrast"?t.criterion:null,a=t.kind==="walkthrough-fail"?`AI walkthrough ${t.verdict} on this criterion.`:t.kind==="walkthrough-ack"?"Human-verified by an auditor.":t.kind==="needs-review"?t.description:t.kind==="auto-contrast"?"Empirical contrast measurement fell below threshold.":t.description;return e.jsxs("p",{style:{margin:0,marginBottom:4,color:"var(--v2-ink-primary)",fontSize:13,fontWeight:500,lineHeight:1.4},children:[r&&e.jsxs("span",{className:"v2-mono",style:{fontSize:11,fontWeight:600,color:"var(--v2-ink-tertiary)",marginRight:8},children:["WCAG ",r]}),a]})}function Fe({row:t}){const r=t.kind==="axe"||t.kind==="needs-review"?t.pages.length:1,a=t.kind==="axe"||t.kind==="needs-review"||t.kind==="auto-contrast"?t.selector:null,n=t.kind==="walkthrough-fail"||t.kind==="walkthrough-ack"||t.kind==="auto-contrast"?t.pageUrl:null;return e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"var(--v2-pad-2)",flexWrap:"wrap"},children:[a&&e.jsx("code",{className:"v2-mono",style:{fontSize:11,color:"var(--v2-ink-secondary)",background:"var(--v2-bg-elev-2)",padding:"2px 6px",borderRadius:2,wordBreak:"break-all"},children:a}),n&&e.jsx("span",{className:"v2-mono",style:{fontSize:11,color:"var(--v2-ink-tertiary)",wordBreak:"break-all"},children:n}),r>1&&e.jsxs("span",{className:"v2-eyebrow",style:{marginLeft:"auto"},children:["on ",r," pages"]})]})}function We(){return e.jsx("span",{"aria-hidden":"true",style:{color:"var(--v2-ink-tertiary)",fontFamily:"var(--v2-mono)",fontSize:12,marginLeft:8,marginTop:2},children:"⏵"})}function Be({row:t}){return t.kind==="walkthrough-fail"?e.jsx(De,{row:t}):t.kind==="walkthrough-ack"?e.jsx(Le,{row:t}):t.kind==="needs-review"?e.jsx(Me,{row:t}):t.kind==="auto-contrast"?e.jsx(Pe,{row:t}):e.jsx(He,{row:t})}function Pe({row:t}){const[r,a]=c.useState(!1),[n,d]=c.useState(!1),[l,i]=c.useState(""),[s,o]=c.useState(!1),[v,k]=c.useState(!1),[j,h]=c.useState(null),x=J(t.ruleId);async function p(){if(o(!0),h(null),!l.trim()){h("Note is required — explain why the empirical contrast measurement is wrong, or why this element is acceptable in context."),o(!1);return}try{const m=(await K(t.pageUrl)).find(b=>b.ruleId===t.ruleId&&b.selector===t.selector),w={pageUrl:t.pageUrl,ruleId:t.ruleId,selector:t.selector,verdict:"pass",reasoning:`Human override: ${l.trim()}
|
|
2
|
-
|
|
3
|
-
(Original empirical reasoning: ${t.reasoning})`,resolvedAt:new Date().toISOString(),costUsd:0,wcagCriterion:t.criterion,inputHash:m==null?void 0:m.inputHash};await xe(w),k(!0),a(!1)}catch(y){h(y instanceof Error?y.message:String(y))}finally{o(!1)}}return e.jsxs("div",{style:{paddingTop:"var(--v2-pad-3)"},children:[e.jsx(z,{label:"Empirical measurement",children:e.jsx("p",{style:{margin:0,color:"var(--v2-ink-secondary)",fontSize:12,lineHeight:1.6,whiteSpace:"pre-wrap"},children:t.reasoning})}),e.jsx("p",{style:{margin:0,marginBottom:"var(--v2-pad-3)",fontSize:11,color:"var(--v2-ink-tertiary)",lineHeight:1.5,fontStyle:"italic"},children:"This finding came from a pixel-level screenshot diff of text against the rendered background, not from axe-core. Treat as a strong hint for human review, not a confirmed violation — gradients, translucent overlays, and animated backdrops can fool the sampler."}),v?e.jsx(L,{}):e.jsxs(e.Fragment,{children:[e.jsxs(M,{children:[x&&e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:()=>d(y=>!y),"aria-expanded":n,children:n?"Hide fix recipe":"Show fix recipe"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary v2-btn-sm",onClick:()=>a(y=>!y),"aria-expanded":r,children:r?"Cancel":"Mark verified manually"})]}),n&&x&&e.jsx(X,{summary:x.summary,snippet:x.snippet}),r&&e.jsx(D,{note:l,setNote:i,busy:s,err:j,onConfirm:p,hint:"Why the empirical measurement is wrong, or why this is acceptable. Overrides the resolution to pass.",placeholder:"e.g., Text sits over a video poster image; static screenshot misreads the rendered background. Production poster passes 7:1."}),j&&!r&&e.jsx(W,{message:j})]})]})}function De({row:t}){const[r,a]=c.useState(!1),[n,d]=c.useState(""),[l,i]=c.useState(!1),[s,o]=c.useState(!1),[v,k]=c.useState(!1),[j,h]=c.useState(null),[x,p]=c.useState(null),y=_(t.criterion);async function m(){if(i(!0),p(null),!n.trim()){p("Note is required — explain how you manually verified this."),i(!1);return}try{const b=await G(t.pageUrl);if(!b){p("Could not find this page in the audit data. Re-run the audit and try again.");return}await fe({componentId:b,criterionId:t.criterion,pageUrl:t.pageUrl,note:n.trim(),acknowledgedAt:new Date().toISOString(),verdictAtAck:t.verdict}),o(!0),a(!1)}catch(b){p(b instanceof Error?b.message:String(b))}finally{i(!1)}}async function w(){var b;k(!0),h(null),p(null);try{const u=(b=(await chrome.tabs.query({active:!0,currentWindow:!0}))[0])==null?void 0:b.id;if(!u){p("Open the audited page in your active tab to re-run.");return}const R=await G(t.pageUrl);if(!R){p("Could not find this page in the audit data.");return}if(!_(t.criterion)){p(`Re-run is only available for interactive criteria. ${t.criterion} is not supported.`);return}const A=await I({type:"INTERACTIVE_AUDIT_REQUEST",criterionId:t.criterion,tabId:u,componentId:R,pageUrl:t.pageUrl});if(!A.ok){p(A.error??"Re-run failed.");return}h(`Re-run verdict: ${A.verdict??"unknown"}. Re-audit the page to refresh this list.`)}catch(S){p(S instanceof Error?S.message:String(S))}finally{k(!1)}}return e.jsxs("div",{style:{paddingTop:"var(--v2-pad-3)"},children:[e.jsx(z,{label:"AI reasoning",children:e.jsx("p",{style:{margin:0,color:"var(--v2-ink-secondary)",fontSize:12,lineHeight:1.6},children:t.reasoning})}),s?e.jsx(L,{}):e.jsxs(e.Fragment,{children:[e.jsxs(M,{children:[y&&e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:w,disabled:v,children:v?"Re-running…":"Re-run walkthrough"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary v2-btn-sm",onClick:()=>a(b=>!b),"aria-expanded":r,children:r?"Cancel":"Mark verified manually"})]}),j&&e.jsx("p",{role:"status",style:{marginTop:"var(--v2-pad-2)",padding:"var(--v2-pad-2) var(--v2-pad-3)",background:"rgba(15, 143, 94, 0.08)",border:"1px solid var(--v2-verified)",borderRadius:4,color:"var(--v2-verified)",fontSize:11,lineHeight:1.5},children:j}),r&&e.jsx(D,{note:n,setNote:d,busy:l,err:x,onConfirm:m,hint:"Explain what you checked. This goes into the forensic record.",placeholder:"e.g., Verified — focus indicator visible on every interactive control under :focus-visible; tested with keyboard nav."}),x&&!r&&e.jsx(W,{message:x})]})]})}function Le({row:t}){return e.jsxs("div",{style:{paddingTop:"var(--v2-pad-3)"},children:[e.jsx(z,{label:"What the human verified",children:e.jsx("p",{style:{margin:0,color:"var(--v2-ink-secondary)",fontSize:12,lineHeight:1.6},children:t.reasoning})}),e.jsxs("p",{style:{color:"var(--v2-ink-tertiary)",fontSize:11,margin:0,marginTop:"var(--v2-pad-2)"},children:["Original AI verdict: ",e.jsx("strong",{children:t.verdict}),". Now treated as pass for conformance."]})]})}function Me({row:t}){return e.jsx(Q,{row:t,kind:"needs-review"})}function He({row:t}){return e.jsx(Q,{row:t,kind:"axe"})}function Q({row:t,kind:r}){const[a,n]=c.useState(!1),[d,l]=c.useState(""),[i,s]=c.useState(!1),[o,v]=c.useState(!1),[k,j]=c.useState(!1),[h,x]=c.useState(null),p=J(t.ruleId);async function y(){if(s(!0),x(null),!d.trim()){x(r==="needs-review"?"Note is required — explain your review judgment.":"Note is required — explain why this isn't actually an issue in your context."),s(!1);return}try{const m=await Ee(t.ruleId,t.pages);if(m.length===0){x("Could not find this finding in the persisted audit data. Re-run the audit and try again.");return}for(const w of m)await ye({componentId:w.componentId,matchKey:w.matchKey,ruleId:t.ruleId,note:d.trim()});v(!0),n(!1)}catch(m){x(m instanceof Error?m.message:String(m))}finally{s(!1)}}return e.jsxs("div",{style:{paddingTop:"var(--v2-pad-3)"},children:[r==="needs-review"&&t.failureSummary&&e.jsx(z,{label:"AI assessment",children:e.jsx("p",{style:{margin:0,color:"var(--v2-ink-secondary)",fontSize:12,lineHeight:1.6,whiteSpace:"pre-wrap"},children:t.failureSummary})}),e.jsx(z,{label:"Affected",children:e.jsxs("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:4},children:[t.pages.slice(0,8).map(m=>e.jsx("li",{children:e.jsx("a",{href:m.url,target:"_blank",rel:"noopener noreferrer",className:"v2-mono",style:{fontSize:11,color:"var(--v2-ink-secondary)",textDecoration:"underline",textDecorationColor:"var(--v2-ink-faint)",textUnderlineOffset:2},children:m.url})},m.url)),t.pages.length>8&&e.jsxs("li",{className:"v2-eyebrow",children:["+ ",t.pages.length-8," more"]})]})}),o?e.jsx(L,{}):e.jsxs(e.Fragment,{children:[e.jsxs(M,{children:[r==="axe"&&p&&e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:()=>j(m=>!m),"aria-expanded":k,children:k?"Hide fix recipe":"Show fix recipe"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary v2-btn-sm",onClick:()=>n(m=>!m),"aria-expanded":a,children:a?"Cancel":"Mark verified manually"})]}),k&&p&&e.jsx(X,{summary:p.summary,snippet:p.snippet}),a&&e.jsx(D,{note:d,setNote:l,busy:i,err:h,onConfirm:y,hint:r==="needs-review"?"Your review judgment. Goes into the forensic record.":"Why this isn't actually an issue in your context. Goes into the forensic record.",placeholder:r==="needs-review"?"e.g., Verified — image is a portrait of the named founder; alt text correctly identifies subject and role.":'e.g., This element is decorative; aria-hidden + role="presentation" applied via design system.',confirmLabel:`Confirm — acknowledge on ${t.pages.length} page${t.pages.length===1?"":"s"}`}),h&&!a&&e.jsx(W,{message:h})]})]})}function D({note:t,setNote:r,busy:a,err:n,onConfirm:d,hint:l,placeholder:i,confirmLabel:s="Confirm acknowledgement"}){return e.jsxs("div",{style:{marginTop:"var(--v2-pad-3)",padding:"var(--v2-pad-3) var(--v2-pad-4)",border:"1px solid var(--v2-border-strong)",borderRadius:4,background:"var(--v2-bg)"},children:[e.jsx("p",{className:"v2-eyebrow",style:{margin:0,marginBottom:6},children:"verification note · required"}),e.jsx("p",{style:{margin:0,marginBottom:"var(--v2-pad-2)",fontSize:11,color:"var(--v2-ink-tertiary)"},children:l}),e.jsx("textarea",{value:t,onChange:o=>r(o.target.value),placeholder:i,rows:3,style:{width:"100%",fontFamily:"var(--v2-body)",fontSize:12,lineHeight:1.5,padding:"var(--v2-pad-2) var(--v2-pad-3)",background:"var(--v2-bg)",color:"var(--v2-ink-primary)",border:"1px solid var(--v2-border-strong)",borderRadius:4,resize:"vertical",minHeight:70},autoFocus:!0}),n&&e.jsx(W,{message:n}),e.jsx("div",{style:{marginTop:"var(--v2-pad-2)"},children:e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary v2-btn-sm",onClick:d,disabled:a||!t.trim(),children:a?"Saving…":s})})]})}function X({summary:t,snippet:r}){return e.jsxs("div",{style:{marginTop:"var(--v2-pad-3)",padding:"var(--v2-pad-3) var(--v2-pad-4)",border:"1px solid var(--v2-verified)",borderRadius:4,background:"rgba(15, 143, 94, 0.06)"},children:[e.jsx("p",{className:"v2-eyebrow",style:{margin:0,marginBottom:6,color:"var(--v2-verified)"},children:"how to fix"}),e.jsx("p",{style:{margin:0,color:"var(--v2-ink-secondary)",fontSize:12,lineHeight:1.6},children:t}),r&&e.jsx("pre",{className:"v2-mono",style:{marginTop:"var(--v2-pad-2)",marginBottom:0,padding:"var(--v2-pad-2) var(--v2-pad-3)",background:"var(--v2-bg)",border:"1px solid var(--v2-border)",borderRadius:3,fontSize:11,color:"var(--v2-ink-primary)",overflowX:"auto",whiteSpace:"pre"},children:e.jsx("code",{children:r})})]})}function L(){return e.jsxs("div",{role:"status",style:{marginTop:"var(--v2-pad-2)",padding:"var(--v2-pad-2) var(--v2-pad-3)",background:"rgba(15, 143, 94, 0.08)",border:"1px solid var(--v2-verified)",borderRadius:4,color:"var(--v2-verified)",fontSize:12,lineHeight:1.5},children:[e.jsx("strong",{style:{fontWeight:600},children:"✓ Acknowledged."})," ","The ack is saved. Re-audit or re-crawl to see this finding drop out of the list."]})}function W({message:t}){return e.jsx("p",{role:"alert",style:{marginTop:"var(--v2-pad-2)",marginBottom:0,padding:"var(--v2-pad-2) var(--v2-pad-3)",border:"1px solid var(--v2-critical)",background:"rgba(207, 44, 44, 0.06)",borderRadius:4,color:"var(--v2-critical)",fontSize:11,lineHeight:1.4},children:t})}function z({label:t,children:r}){return e.jsxs("div",{style:{marginBottom:"var(--v2-pad-3)"},children:[e.jsx("p",{className:"v2-eyebrow",style:{margin:0,marginBottom:6},children:t}),r]})}function M({children:t}){return e.jsx("div",{style:{display:"flex",gap:"var(--v2-pad-2)",flexWrap:"wrap",marginTop:"var(--v2-pad-2)"},children:t})}function Ve(){const{report:t,resolvedFails:r}=Y(),[a,n]=c.useState("open"),d=c.useMemo(()=>t?Ge(t.pages,t.findingGroups??[],r):[],[t,r]),l=c.useMemo(()=>a==="all"?d:d.filter(s=>a==="verified"?s.kind==="walkthrough-ack":a==="review"?s.kind==="needs-review":a==="open"?s.kind==="axe"||s.kind==="walkthrough-fail"||s.kind==="auto-contrast":!0),[d,a]);if(!t)return null;const i={all:d.length,open:d.filter(s=>s.kind==="axe"||s.kind==="walkthrough-fail"||s.kind==="auto-contrast").length,review:d.filter(s=>s.kind==="needs-review").length,verified:d.filter(s=>s.kind==="walkthrough-ack").length};return e.jsxs("section",{"aria-labelledby":"findings-heading",style:{padding:"var(--v2-pad-5) var(--v2-pad-5) var(--v2-pad-7)"},children:[e.jsxs("header",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:"var(--v2-pad-3)",marginBottom:"var(--v2-pad-4)",flexWrap:"wrap"},children:[e.jsx("h2",{id:"findings-heading",className:"v2-display",style:{fontSize:20,fontWeight:500,letterSpacing:"-0.01em",color:"var(--v2-ink-primary)",margin:0},children:"Findings"}),e.jsx(Oe,{filter:a,setFilter:n,counts:i})]}),l.length===0?e.jsx(_e,{filter:a}):e.jsx("ul",{"aria-label":`${a} findings, ${l.length} items`,style:{listStyle:"none",padding:0,margin:0,display:"flex",flexDirection:"column",gap:"var(--v2-pad-2)"},children:l.map((s,o)=>e.jsx("li",{style:{animation:`v2-row-in 240ms ease ${Math.min(o,12)*30}ms both`},children:e.jsx(Ue,{row:s})},s.key))})]})}function Oe({filter:t,setFilter:r,counts:a}){const n=[{id:"open",label:"Open"},{id:"review",label:"Review"},{id:"verified",label:"Verified"},{id:"all",label:"All"}];return e.jsx("div",{role:"tablist","aria-label":"Filter findings",style:{display:"inline-flex",gap:4,background:"var(--v2-bg-elev)",padding:3,borderRadius:6,border:"1px solid var(--v2-border)"},children:n.map(d=>{const l=t===d.id;return e.jsxs("button",{type:"button",role:"tab","aria-selected":l,onClick:()=>r(d.id),style:{fontFamily:"var(--v2-body)",fontSize:11,padding:"5px 10px",borderRadius:4,border:"none",cursor:"pointer",background:l?"var(--v2-bg-elev-2)":"transparent",color:l?"var(--v2-ink-primary)":"var(--v2-ink-secondary)",fontWeight:l?600:500,transition:"background 120ms ease, color 120ms ease",display:"inline-flex",alignItems:"baseline",gap:5},children:[d.label,e.jsx("span",{className:"v2-mono",style:{fontSize:10,color:"var(--v2-ink-tertiary)",fontVariantNumeric:"tabular-nums"},children:a[d.id]})]},d.id)})})}function _e({filter:t}){const a={open:{headline:"Nothing open.",sub:"No axe violations or AI walkthrough failures across the audited pages. Switch to All to see everything, or to Verified for a record of acknowledged items."},review:{headline:"No items awaiting review.",sub:"AI walkthroughs returned definitive verdicts (or human verifications) for every criterion that needed judgment."},verified:{headline:"No human verifications recorded.",sub:"When you mark a walkthrough finding as manually verified, it appears here with your note + timestamp."},all:{headline:"Nothing to show.",sub:"No audit data yet — run a scan to begin."}}[t];return e.jsxs("div",{role:"status","aria-live":"polite",style:{padding:"var(--v2-pad-6) var(--v2-pad-4)",textAlign:"center",border:"1px dashed var(--v2-border)",borderRadius:6},children:[e.jsx("p",{className:"v2-display",style:{fontSize:18,fontWeight:500,color:"var(--v2-ink-primary)",margin:0,marginBottom:"var(--v2-pad-2)"},children:a.headline}),e.jsx("p",{style:{color:"var(--v2-ink-secondary)",margin:0,maxWidth:440,marginInline:"auto"},children:a.sub})]})}function Ge(t,r,a=[]){const n=[];for(const i of r)i.needsReview?n.push({kind:"needs-review",key:`nr::${i.ruleId}::${i.representativeSelector}`,criterion:i.wcagCriterion,ruleId:i.ruleId,description:i.axeDescription,selector:i.representativeSelector,failureSummary:i.failureSummary,pages:i.pages,group:i}):n.push({kind:"axe",key:`axe::${i.ruleId}::${i.representativeSelector}`,criterion:i.wcagCriterion,ruleId:i.ruleId,impact:i.impact,description:i.axeDescription,selector:i.representativeSelector,pages:i.pages,isShared:i.isShared});const d=new Set;for(const i of t){for(const s of i.walkthroughFindings??[]){const o=`wt-fail::${s.criterionId}::${s.pageUrl}`;d.has(o)||(d.add(o),n.push({kind:"walkthrough-fail",key:o,criterion:s.criterionId,verdict:s.verdict,impact:s.impact,reasoning:s.reasoning,pageUrl:s.pageUrl}))}for(const s of i.walkthroughAcknowledgements??[]){const o=`wt-ack::${s.criterionId}::${s.pageUrl}`;d.has(o)||(d.add(o),n.push({kind:"walkthrough-ack",key:o,criterion:s.criterionId,verdict:s.verdict,reasoning:s.reasoning,pageUrl:s.pageUrl}))}}for(const i of a)n.push({kind:"auto-contrast",key:`auto::${i.ruleId}::${i.selector}::${i.pageUrl}`,criterion:i.wcagCriterion??"1.4.3",ruleId:i.ruleId,impact:"serious",selector:i.selector,pageUrl:i.pageUrl,reasoning:i.reasoning});const l={critical:0,serious:1,moderate:2,minor:3,"needs-review":4,ack:5};return n.sort((i,s)=>{const o=i.kind==="walkthrough-ack"?l.ack:i.kind==="needs-review"?l["needs-review"]:l[i.impact],v=s.kind==="walkthrough-ack"?l.ack:s.kind==="needs-review"?l["needs-review"]:l[s.impact];return(o??99)-(v??99)}),n}function Ke(){var n,d;const t=g(l=>l.siteCrawlReport),r=g(l=>l.results),a=(t==null?void 0:t.startUrl)??((n=r[0])==null?void 0:n.pageUrl)??((d=r[0])==null?void 0:d.scope)??null;return e.jsxs("header",{role:"banner",style:{display:"flex",alignItems:"center",gap:"var(--v2-pad-4)",padding:"var(--v2-pad-3) var(--v2-pad-5)",borderBottom:"1px solid var(--v2-border)",background:"var(--v2-bg)",minHeight:44},children:[e.jsx("a",{href:"#main-content",className:"v2-skip-link",style:{position:"absolute",left:-9999},onFocus:l=>{l.currentTarget.style.left="var(--v2-pad-4)",l.currentTarget.style.top="var(--v2-pad-4)"},onBlur:l=>{l.currentTarget.style.left="-9999px"},children:"Skip to main content"}),e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"var(--v2-pad-2)"},children:[e.jsx("span",{className:"v2-display",style:{fontSize:18,fontWeight:600,letterSpacing:"-0.01em",color:"var(--v2-ink-primary)"},children:"wcagcheckr"}),e.jsx("span",{className:"v2-eyebrow",children:"v2"})]}),a&&e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"var(--v2-pad-2)",marginLeft:"var(--v2-pad-4)",minWidth:0,flex:1},children:[e.jsx("span",{className:"v2-eyebrow",children:"scope"}),e.jsx("span",{className:"v2-mono",style:{fontSize:11,color:"var(--v2-ink-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},title:a,children:a})]}),e.jsxs("nav",{"aria-label":"Application",style:{display:"flex",gap:"var(--v2-pad-1)",marginLeft:"auto"},children:[e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:()=>{chrome.storage.local.set({v2UiEnabled:!1})},"aria-label":"Switch back to the classic UI",title:"Switch back to the classic v1 UI",children:"Use v1"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm","aria-label":"Open settings",title:"Open settings",onClick:()=>void I({type:"OPEN_SETTINGS"}),children:"Settings"})]})]})}function qe(){return c.useEffect(()=>{const t=ae(),a=new URLSearchParams(window.location.search).get("context")==="overlay"?null:chrome.runtime.connect({name:"sidepanel-tracker"}),n=ne();ie({forceRefresh:!0}).catch(()=>{}),se().catch(()=>{}),le().catch(()=>{}),oe().catch(()=>{}),de().catch(()=>{}),be().then(l=>{g.getState().setAcknowledgedKeys(new Set(l.map(i=>i.matchKey)))}).catch(()=>{});let d=!1;return ke().then(l=>{d||l&&g.setState({siteCrawlReport:l})}).catch(()=>{}),()=>{d=!0,n();try{t.disconnect()}catch{}try{a==null||a.disconnect()}catch{}}},[]),e.jsxs("div",{className:"v2-root",children:[e.jsx(Ke,{}),e.jsxs("main",{id:"main-content","aria-label":"wcagcheckr findings",children:[e.jsx(Re,{}),e.jsx(Ve,{})]})]})}je("side-panel");const F="v2UiEnabled";function Je(){const[t,r]=c.useState(null);return c.useEffect(()=>{let a=!1;chrome.storage.local.get(F).then(d=>{a||r(!!d[F])}).catch(()=>r(!1));const n=(d,l)=>{var i;l==="local"&&F in d&&r(!!((i=d[F])!=null&&i.newValue))};return chrome.storage.onChanged.addListener(n),()=>{a=!0,chrome.storage.onChanged.removeListener(n)}},[]),t===null?null:t?e.jsx(qe,{}):e.jsx(ue,{})}const Z=document.getElementById("root");if(!Z)throw new Error("side-panel: #root not found");ee(Z).render(e.jsx(te.StrictMode,{children:e.jsx(ce,{children:e.jsx(Je,{})})}));
|