@wcag-checkr/ci 1.0.0-rc.319 → 1.0.0-rc.320
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-CFmHz6nh.js","assets/scheduled-audit-runner-CCxgrfOE.js","assets/diff-DA41zYPc.js","assets/crash-reporter-Bu2p8K-p.js","assets/ai-usage-log-BX3L6bKl.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import"./modulepreload-polyfill-B5Qt9EMX.js";import{r as p,j as e,c as Se,R as je}from"./styles-Cn731SYD.js";import{u as S,c as Ce,a as Re,l as oe,s as Te,w as Ie,r as Ae,b as Ne,d as Ee,p as Ue,e as ze,E as De,A as Fe}from"./ErrorBoundary-D6Z5mQQ2.js";import{l as Pe,a as $e,g as ve,b as We,c as Le,W as Oe,d as he,r as He,s as Be,e as _e,f as ge,h as me,i as Ve,j as Me,k as Ge,m as Ke,n as qe}from"./scheduled-audit-runner-CCxgrfOE.js";import{s as W,r as Ye,i as Ze}from"./crash-reporter-Bu2p8K-p.js";import{B as ee}from"./ai-usage-log-BX3L6bKl.js";import{_ as q}from"./diff-DA41zYPc.js";import{copyAiFixerPrompt as Qe}from"./copy-ai-fixer-prompt-BeFgwwDM.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./design-system-audit-DpxJrxnb.js";function se({initialUrl:t,isRunning:a,onCrawl:r,onVerifyFixes:o,onAuditThisPage:i}){const[l,s]=p.useState(t),[n,u]=p.useState(25),[v,h]=p.useState(""),[x,k]=p.useState(""),[m,f]=p.useState(!1),[j,d]=p.useState(ee),[w,y]=p.useState(ee[0].id),[E,g]=p.useState(null);p.useEffect(()=>{t&&!l&&s(t)},[t]),p.useEffect(()=>{let c=!1;return Promise.all([W({type:"SETTINGS_GET",key:"matrixPresets"}),W({type:"SETTINGS_GET",key:"activePresetId"})]).then(([b,A])=>{if(c)return;const L=Array.isArray(b.data)?b.data:null;d(L&&L.length>0?L:ee),typeof A.data=="string"&&y(A.data)}),()=>{c=!0}},[]);function R(c){const b=j.find(A=>A.id===c);b&&(y(c),W({type:"SETTINGS_SET",key:"activePresetId",value:c}),W({type:"SETTINGS_SET",key:"stateMatrix",value:b.matrix}))}function T(){g(null);for(const[c,b]of[["Include",v.trim()],["Exclude",x.trim()]])if(b)try{new RegExp(b)}catch(A){return g(`${c} regex invalid: ${A instanceof Error?A.message:String(A)}`),!1}return!0}function C(){const c=l.trim();if(!c)return null;let b;try{b=new URL(c)}catch{return"Start URL must be a full URL starting with http:// or https://."}return b.protocol!=="http:"&&b.protocol!=="https:"?`Start URL must use http:// or https:// — ${b.protocol} can't be crawled.`:null}const D=C(),z=!!l.trim()&&!D;function N(c){if(!T()||!z)return;const b={startUrl:l.trim(),maxPages:n,includeRegex:v.trim(),excludeRegex:x.trim()};c&&o?o(b):r(b)}return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--v2-pad-3)",textAlign:"left"},children:[e.jsxs(M,{label:"Start URL",children:[e.jsx("input",{type:"url",value:l,onChange:c=>s(c.target.value),placeholder:"https://yoursite.com",disabled:a,"aria-invalid":!!D,className:"v2-mono",style:G}),D&&e.jsx("p",{role:"alert",style:{margin:"4px 0 0",fontSize:11,color:"var(--v2-critical)",lineHeight:1.4},children:D})]}),e.jsx(M,{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:c=>u(Math.min(200,Math.max(1,parseInt(c.target.value,10)||25))),disabled:a,className:"v2-mono",style:{...G,maxWidth:100}})}),e.jsx(M,{label:"Audit depth",hint:"State matrix preset applied to every crawled page.",children:e.jsx("select",{value:w,onChange:c=>R(c.target.value),disabled:a,style:G,children:j.map(c=>e.jsx("option",{value:c.id,children:c.name},c.id))})}),e.jsx("button",{type:"button",onClick:()=>f(c=>!c),className:"v2-eyebrow",style:{background:"none",border:"none",padding:0,cursor:"pointer",color:"var(--v2-ink-secondary)",textAlign:"left",alignSelf:"flex-start"},children:m?"− hide advanced filters":"+ show URL filters (include / exclude)"}),m&&e.jsxs(e.Fragment,{children:[e.jsx(M,{label:"Include only URLs matching",hint:"Optional regex. Empty = no filter.",children:e.jsx("input",{type:"text",value:v,onChange:c=>h(c.target.value),placeholder:"^https://example\\.com/products/",disabled:a,className:"v2-mono",style:G})}),e.jsx(M,{label:"Exclude URLs matching",hint:"Optional regex. Useful for /admin or /login while logged in.",children:e.jsx("input",{type:"text",value:x,onChange:c=>k(c.target.value),placeholder:"/admin|/dashboard|/login",disabled:a,className:"v2-mono",style:G})})]}),E&&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:E}),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||!z,onClick:()=>N(!1),children:a?"Crawling…":"Crawl whole site"}),o&&e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost",disabled:a||!z,onClick:()=>N(!0),title:"Skip walkthroughs that previously passed or were human-verified",children:"Verify fixes only"}),i&&e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost",disabled:a,onClick:i,title:"Single-page audit on the active tab (no crawl)",children:"Just this page"})]})]})}function Xe(){var h;const t=S(x=>x.siteCrawlProgress),a=S(x=>x.siteCrawlStatus),r=S(x=>x.progress),o=S(x=>x.aiProgress),[i,l]=p.useState(!1);function s(){l(!0),W({type:"CANCEL_SITE_CRAWL"})}if(a!=="running")return null;const n=t?Math.min(100,Math.max(0,t.current/Math.max(1,t.total)*100)):0,u=r?Math.min(100,Math.max(0,r.current/Math.max(1,r.total)*100)):0,v=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,(h=r.currentState.breakpoint)!=null&&h.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:`${n}%`,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:`${u}%`,background:"var(--v2-ink-tertiary)",transition:"width 240ms ease"}})}),v&&e.jsxs("p",{className:"v2-mono",style:{margin:0,fontSize:11,color:"var(--v2-ink-tertiary)"},children:["state: ",v]}),o&&e.jsxs("p",{className:"v2-mono",style:{margin:0,fontSize:11,color:"var(--v2-needs-review)",fontVariantNumeric:"tabular-nums"},children:["AI: ",o.current," / ",o.total," · ",o.currentCheckLabel,o.candidatesTotal&&o.candidatesTotal>0?` (${o.candidatesDone??0}/${o.candidatesTotal})`:""]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--v2-pad-3)"},children:[e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:s,disabled:i,children:i?"Cancelling…":"Cancel crawl"}),i&&e.jsx("span",{"aria-live":"polite",style:{fontSize:11,color:"var(--v2-ink-tertiary)"},children:"Wrapping up current page audit — final cancel can take up to a few seconds."})]})]})}function Je(){const t=S(h=>h.status),a=S(h=>h.progress),r=S(h=>h.aiProgress);if(t!=="running")return null;const o=a?a.current>=a.total:!1,i=a?o?"Running deep analyzers…":`Auditing… ${a.current} / ${a.total}`:"Starting audit…",l=a?o?"reading order · tab order · typography · CSS vars · AI candidates":et(a.currentState):"Loading axe + DOM analyzers",s=a?o?100:a.current/Math.max(1,a.total)*100:0,[n,u]=p.useState(!1);function v(){u(!0),W({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(le,{label:i,detail:l,pct:s,valuenow:a?Math.min(a.current,a.total):0,valuemax:a?a.total:1,ariaLabel:a?o?"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(le,{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.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--v2-pad-3)"},children:[e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:v,disabled:n,children:n?"Cancelling…":"Cancel audit"}),n&&e.jsx("span",{"aria-live":"polite",style:{fontSize:11,color:"var(--v2-ink-tertiary)"},children:"Wrapping up — final cancel can take up to a few seconds."})]})]})}function le({label:t,detail:a,pct:r,valuenow:o,valuemax:i,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":o,"aria-valuemin":0,"aria-valuemax":i,"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 et(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 M({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 G={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 X(){const t=S(u=>u.siteCrawlReport),a=S(u=>u.results),r=S(u=>u.delta),o=S(u=>u.componentId),i=S(u=>u.status),l=S(u=>u.siteCrawlStatus),[s,n]=p.useState({report:null,resolvedFails:[]});return p.useEffect(()=>{var x;let u=!1;async function v(k){return k.length===0?[]:(await Promise.all(k.map(f=>ve(f)))).flat().map(We).map(Le).filter(f=>f.verdict==="fail")}if(l==="running"||i==="running"){n({report:null,resolvedFails:[]});return}if(t)return(async()=>{const k=t.pages.map(f=>f.url),m=await v(k);u||n({report:t,resolvedFails:m})})(),()=>{u=!0};if(a.length===0||!o){n({report:null,resolvedFails:[]});return}const h=(x=a[0])==null?void 0:x.pageUrl;if(!h){n({report:null,resolvedFails:[]});return}return(async()=>{try{const[k,m]=await Promise.all([Pe(a),v([h])]),f=new Date().toISOString(),j=$e(h,[{url:h,results:a,delta:r,componentId:o,durationMs:0}],f,f,0,k.walkthroughsByComponent,k.walkthroughAcksByComponent,k.ackedKeysByComponent,k.humanVerdictsByComponent);u||n({report:j,resolvedFails:m})}catch(k){console.warn("[v2] synthesize single-page report failed",k),u||n({report:null,resolvedFails:[]})}})(),()=>{u=!0}},[t,a,r,o,i,l]),s}const tt={"1.2.1":{howToCheck:"Confirm any audio-only or video-only media has a text alternative (transcript, captions, descriptive title). If the page has no audio or video at all, mark N/A with that note."},"1.2.2":{howToCheck:"For every prerecorded video with audio, verify captions are present and synchronized. Open each video, turn captions on, and spot-check 10–15 seconds. If the page has no video with audio, mark N/A."},"1.2.3":{howToCheck:"For every prerecorded video, confirm an audio description track OR a full text alternative is available. If no prerecorded video, mark N/A."},"1.2.4":{howToCheck:"For any live streaming media with audio, verify live captions are provided. If the page has no live media, mark N/A."},"1.2.5":{howToCheck:"For prerecorded video, confirm an audio description track is provided (separate from the main audio). If no prerecorded video, mark N/A."},"1.3.1":{howToCheck:"Inspect headings, lists, tables, and form labels. Programmatic structure should match visual structure: h1→h2→h3, real <ul>/<ol>, real <table> with <th>, every form field has a <label> or aria-label. Tabbing through the page should reveal the same structure a screen reader would announce."},"1.4.3":{howToCheck:"Open the inconclusive elements. Most commonly axe failed because the background is transparent, a gradient, or an image. Identify the EFFECTIVE background color a user sees and compute the contrast ratio against the foreground; needs ≥4.5:1 for normal text, ≥3:1 for large text (18pt+ or 14pt+ bold)."},"1.4.4":{howToCheck:"Zoom the page to 200% (Ctrl+Plus four times in most browsers). Verify all content remains visible and functional — no overlapping text, no clipped buttons, no horizontal scrollbar at 1280×1024 viewport."},"1.4.10":{howToCheck:"Resize the browser to 320 CSS px wide (or use devtools mobile emulation at 320×256). Confirm content reflows without two-dimensional scrolling — vertical scroll only, no horizontal scroll except for genuinely two-dimensional content (data tables, images, complex maps)."},"1.4.11":{howToCheck:"Verify every UI component's boundary (button borders, form field outlines, focus indicators) has ≥3:1 contrast against its adjacent color. Same for meaningful graphics (icons, infographic elements). Decorative graphics are exempt."},"1.4.12":{howToCheck:"Apply this CSS via devtools and confirm no content is clipped or hidden: line-height: 1.5; letter-spacing: 0.12em; word-spacing: 0.16em; paragraph spacing 2× font-size. If layout breaks, the page fails."},"2.1.1":{howToCheck:"Tab through every interactive element. Every button, link, form field, and custom control must be reachable AND operable via keyboard alone (Enter, Space, arrow keys as appropriate). Mouse-only affordances fail."},"2.1.2":{howToCheck:"Tab into every interactive component. Confirm Tab/Shift+Tab moves focus out. No element should trap focus (typical offenders: poorly-coded modals, embedded players)."},"2.4.1":{howToCheck:"Verify a skip-to-main-content link exists (typically first focusable element, visible on focus) OR landmark regions (<main>, <nav>) are present. Either lets keyboard users bypass repeated nav."},"2.4.3":{howToCheck:"Tab through the page in source order. Focus must move in a sequence that preserves meaning — usually left-to-right, top-to-bottom. Particularly check skip links and modals."},"2.4.4":{howToCheck:`Read each link's text WITH its surrounding context (parent paragraph, list item, table cell). The combined text must convey where the link goes. "Click here" alone is ambiguous; "Click here to read our pricing" passes when context is included.`},"2.4.5":{howToCheck:"Confirm at least two ways to find a given page exist: site search, sitemap, A-Z index, table of contents, or persistent navigation. Single-page sites and process-step pages (checkout) are exempt."},"2.4.6":{howToCheck:"Read each heading and form-field label in isolation. Each should describe the topic of its section or the purpose of its field WITHOUT requiring the surrounding content to make sense."},"2.4.7":{howToCheck:"Tab through every focusable element. The current focus must be VISUALLY distinct from neighbors — an outline, a box-shadow, a background change. The default browser outline counts; CSS that removes it without replacing fails."},"2.5.3":{howToCheck:"For every control with both a visible text label and an accessible name (aria-label, alt, etc.), verify the visible label appears (verbatim, or as a substring) in the accessible name. Otherwise voice-control users can't target it by saying its visible label."},"3.1.1":{howToCheck:'View source. Confirm <html lang="..."> is present with a valid language tag (e.g. "en", "en-US", "fr").'},"3.1.2":{howToCheck:"Find any passage of foreign-language text on the page (a quote, a borrowed phrase, an entire alternate-language section). Confirm it's wrapped with the appropriate lang attribute. If the entire page is in one language, mark N/A."},"3.2.1":{howToCheck:"Tab to each focusable element. Confirm receiving focus alone does NOT trigger a context change: no navigation, no modal opening, no form submission. Action only on explicit activation (click, Enter)."},"3.2.2":{howToCheck:"In each form, change one input value (type in a field, check a checkbox, change a select). Confirm this does NOT submit the form, navigate the page, or open a modal without first warning the user."},"3.2.3":{howToCheck:"Open at least three different pages on the site. Confirm the main navigation, footer navigation, and any breadcrumb appear in the SAME relative order on each. Reordering items between pages is a fail; adding or removing items based on auth state is acceptable."},"3.2.4":{howToCheck:"Identify a few common functional elements on the site (e.g., the search input, login button, cart button, social-share icons). Verify each appears with the SAME accessible name, label, and icon on every page where it appears. Inconsistent naming is the fail mode."},"3.3.1":{howToCheck:"Submit a form with invalid data. Confirm errors are identified in text (not just color), describe what went wrong, and ideally indicate which field. Browser-default validation messages count."},"3.3.2":{howToCheck:"Every form input should have a visible label (or visible placeholder + accessible name combination) AND an instruction when format matters (date format, password rules). Placeholder-only labels fail because they disappear on focus."},"3.3.3":{howToCheck:'Submit a form with invalid data. Confirm the error message describes HOW to fix the problem (e.g., "Email must contain @" not just "Invalid email"). Exempts cases where suggestion would compromise security (password rules).'},"3.3.4":{howToCheck:"For any form that submits a legal commitment, financial transaction, or modifies/deletes user data: confirm submissions are reversible, validated for errors before commit, OR show a confirmation step before final commit."},"4.1.3":{howToCheck:'Trigger any status update (form submitted, item added to cart, search completed, error appeared). Confirm screen-reader users receive the update via an aria-live region or role="status"/"alert" — without moving focus to the update.'}};function rt(t){return tt[t]??null}function fe(t){var a;return t.storeComponentId?t.storeComponentId:(a=t.storeCrawlReport)!=null&&a.startUrl?t.storeCrawlReport.startUrl:t.pageUrls[0]?t.pageUrls[0]:null}const ce="aiConfig";function at(t){return`https://www.w3.org/WAI/WCAG22/Understanding/${t}`}const nt=new Map(Oe.map(t=>[t.id,t]));async function it(t){const r=(await chrome.tabs.query({active:!0,currentWindow:!0}))[0];if(!(r!=null&&r.id))return{ok:!1,error:"No active tab."};const o=r.id,i=Q(t.pageUrl),l=Q(r.url??"");if(!(r.url===t.pageUrl)){try{await chrome.tabs.update(o,{url:t.pageUrl})}catch(h){return{ok:!1,error:h instanceof Error?h.message:"Failed to navigate tab."}}if(!await ot(o,t.pageUrl,12e3))return{ok:!1,error:"Page did not finish loading in time."}}if(!t.selector)return{ok:!0,found:!1,matchCount:0};const n=[120,250,500,800,1200,800];let u="";for(let v=0;v<=n.length;v++)try{const h=await Ye(o,{type:"HIGHLIGHT_SHOW_REQUEST",tabId:o,selector:t.selector,scrollIntoView:!0});return{ok:!0,found:h.found,matchCount:h.matchCount}}catch(h){const x=h instanceof Error?h.message:String(h);if(u=x,!(x.includes("Could not establish connection")||x.includes("Receiving end does not exist")))break;const m=n[v];if(m===void 0)break;await new Promise(f=>setTimeout(f,m))}return{ok:!1,error:i!==l?`Navigated to ${t.pageUrl} — but the in-page highlighter couldn't attach (${u}).`:u}}function Q(t){try{return new URL(t).origin}catch{return""}}function ot(t,a,r){return new Promise(o=>{let i=!1;const l=setTimeout(()=>{i||(i=!0,chrome.tabs.onUpdated.removeListener(s),o(!1))},r);function s(n,u,v){if(n!==t||u.status!=="complete")return;const h=Q(v.url??""),x=Q(a);x&&h&&h!==x||i||(i=!0,clearTimeout(l),chrome.tabs.onUpdated.removeListener(s),o(!0))}chrome.tabs.onUpdated.addListener(s)})}function de(t){try{const a=new URL(t),r=a.pathname+a.search+a.hash||"/";return r.length>60?r.slice(0,57)+"...":r}catch{return t}}function st(t){return t.length>70?t.slice(0,67)+"...":t}function lt(t){try{const a=new Date(t),r=new Date,o=a.toDateString()===r.toDateString(),i=new Date(r);i.setDate(i.getDate()-1);const l=a.toDateString()===i.toDateString(),s=a.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"});return o?`today, ${s}`:l?`yesterday, ${s}`:`${a.toLocaleDateString(void 0,{month:"short",day:"numeric"})}, ${s}`}catch{return t}}function ct(){const{report:t}=X(),a=S(d=>d.componentId),r=S(d=>d.siteCrawlReport),[o,i]=p.useState(!1),[l,s]=p.useState(new Set),[n,u]=p.useState(0),v=p.useRef(""),[h,x]=p.useState(!1),[k,m]=p.useState("claude-sonnet-4-6");p.useEffect(()=>{(async()=>{const w=(await chrome.storage.local.get(ce))[ce];v.current=(w==null?void 0:w.apiKey)??"",x(!!(w!=null&&w.apiKey)),w!=null&&w.model&&m(w.model)})()},[]);const f=fe({storeComponentId:a,storeCrawlReport:r,pageUrls:(t==null?void 0:t.pages.map(d=>d.url))??[]});if(p.useEffect(()=>{let d=!1;return(async()=>{if(!f){d||s(new Set);return}try{const w=await he([f]);if(d)return;s(new Set(w.map(y=>y.criterionId)))}catch{d||s(new Set)}})(),()=>{d=!0}},[f,n]),!t)return null;const j=t.blockingCriteria;return!j||j.length===0||t.siteGrade!=="A"&&t.siteGrade!=="B"?null:e.jsxs("div",{style:{marginTop:"var(--v2-pad-3)",padding:"var(--v2-pad-3) var(--v2-pad-4)",border:"1px solid var(--v2-border)",borderRadius:4,background:"var(--v2-bg-elev)"},children:[e.jsxs("button",{type:"button",onClick:()=>i(d=>!d),"aria-expanded":o,style:{appearance:"none",background:"none",border:"none",padding:0,cursor:"pointer",color:"var(--v2-ink-primary)",fontSize:13,fontWeight:500,textAlign:"left",display:"flex",alignItems:"center",justifyContent:"space-between",gap:"var(--v2-pad-3)",width:"100%"},children:[e.jsx("span",{children:(()=>{const d=j.length,w=j.filter(E=>l.has(E.criterionId)).length,y=d-w;return w===0?`${d} criteri${d===1?"on":"a"} need${d===1?"s":""} your judgment`:y===0?`${d} criteri${d===1?"on":"a"} verified — re-crawl to lift the grade`:`${w} of ${d} verified · ${y} remaining`})()}),e.jsx("span",{"aria-hidden":"true",style:{fontSize:11,color:"var(--v2-ink-tertiary)"},children:o?"▾":"▸"})]}),o&&e.jsxs("div",{style:{marginTop:"var(--v2-pad-3)",display:"flex",flexDirection:"column",gap:"var(--v2-pad-2)"},children:[e.jsx("p",{style:{margin:0,fontSize:11,color:"var(--v2-ink-tertiary)",lineHeight:1.5},children:"Each criterion below has no affirmative evidence yet. Mark it Pass / N/A / Fail with a note about what you checked. Verdicts persist as forensic evidence and contribute to the audit's chain of custody."}),j.map(d=>e.jsx(dt,{criterionId:d.criterionId,title:d.title,state:d.state,evidence:d.evidence,targetComponentId:f,apiKeyRef:v,apiKeyPresent:h,model:k,onVerdictChange:()=>u(w=>w+1)},d.criterionId))]})]})}function dt({criterionId:t,title:a,state:r,evidence:o,targetComponentId:i,apiKeyRef:l,apiKeyPresent:s,model:n,onVerdictChange:u}){const[v,h]=p.useState(null),[x,k]=p.useState(""),[m,f]=p.useState(!1),[j,d]=p.useState(null),[w,y]=p.useState(null),[E,g]=p.useState(!0),[R,T]=p.useState(!1),[C,D]=p.useState(null),[z,N]=p.useState(null),[c,b]=p.useState(null),A={untested:"No evidence — automation has no rule for this criterion",inconclusive:"Inconclusive — axe / AI ran but couldn't determine",failing:"Failing — at least one fail signal across the audit"};p.useEffect(()=>{let I=!1;return(async()=>{if(!i){I||g(!1);return}try{const O=(await he([i])).find(V=>V.criterionId===t);if(I)return;y(O?{verdict:O.verdict,note:O.note,verifiedAt:O.verifiedAt}:null)}catch{I||y(null)}finally{I||g(!1)}})(),()=>{I=!0}},[t,i]);async function L(){if(i){f(!0),d(null);try{await He(i,t),y(null),u()}catch(I){d(I instanceof Error?I.message:String(I))}finally{f(!1)}}}const F=nt.get(t),H=F==null?void 0:F.shortDescription,ne=F==null?void 0:F.understandingSlug,ie=rt(t);async function ke(){if(!l.current){N("Set an Anthropic API key in extension Options first.");return}T(!0),N(null);try{const P=`Explain WCAG ${t} (${a}) in the context of this audit. State: ${r==="untested"?"no automated evidence (no axe rule covers it)":r==="inconclusive"?"inconclusive — axe or AI ran but could not produce a definitive pass/fail":"failing — at least one fail signal across the audit"}. Cover: (1) what the criterion actually requires in plain language, (2) common failure modes a developer should look for, (3) how to manually verify it on this site, (4) when to mark N/A vs Pass vs Fail. Keep it tight — 5–8 sentences total.`,O=await Ce({apiKey:l.current,model:n,messages:[{role:"user",content:P}],system:`You are wcagcheckr's WCAG explainer. The user is sitting in front of a forensic-grade audit tool and needs to record a manual verdict on a criterion the automation can't decide. Be precise. No marketing tone. When citing a verification step, name the exact device/browser/devtool action (e.g., "Resize Chrome devtools to 320 CSS px").`,maxTokens:600,maxCostUsd:.05});D(O.text),b(O.costUsd)}catch(I){N(I instanceof Error?I.message:String(I))}finally{T(!1)}}async function we(I){if(!i){d("No componentId available — re-run an audit first.");return}if(!x.trim()){d("Note is required — describe what you checked and why this verdict applies.");return}f(!0),d(null);const P=new Date().toISOString(),O=x.trim();try{await Be({componentId:i,criterionId:t,verdict:I,note:O,verifiedAt:P}),y({verdict:I,note:O,verifiedAt:P}),h(null),k(""),u()}catch(V){d(V instanceof Error?V.message:String(V))}finally{f(!1)}}if(w){const P={pass:{bg:"rgba(15, 143, 94, 0.08)",border:"var(--v2-verified)",ink:"var(--v2-verified)",label:"Pass"},na:{bg:"rgba(100, 116, 139, 0.10)",border:"var(--v2-border-strong)",ink:"var(--v2-ink-secondary)",label:"N/A"},fail:{bg:"rgba(207, 44, 44, 0.06)",border:"var(--v2-critical)",ink:"var(--v2-critical)",label:"Fail"}}[w.verdict];return e.jsxs("div",{role:"status",style:{padding:"var(--v2-pad-3) var(--v2-pad-4)",background:P.bg,border:`1px solid ${P.border}`,borderRadius:4},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"var(--v2-pad-3)",flexWrap:"wrap"},children:[e.jsxs("span",{className:"v2-mono",style:{fontSize:11,fontWeight:600,color:"var(--v2-ink-tertiary)"},children:["WCAG ",t]}),e.jsx("span",{style:{fontSize:13,fontWeight:500,color:"var(--v2-ink-primary)"},children:a}),e.jsxs("span",{className:"v2-mono",style:{fontSize:10,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.04em",padding:"2px 6px",borderRadius:3,color:"var(--v2-bg)",background:P.ink},children:["✓ ",P.label]})]}),e.jsx("p",{style:{margin:"6px 0 0",fontSize:12,color:"var(--v2-ink-primary)",lineHeight:1.5,whiteSpace:"pre-wrap"},children:w.note}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--v2-pad-3)",marginTop:"var(--v2-pad-2)",flexWrap:"wrap"},children:[e.jsxs("span",{className:"v2-mono",style:{fontSize:10,color:"var(--v2-ink-tertiary)"},children:["verified ",lt(w.verifiedAt)]}),e.jsx("button",{type:"button",onClick:L,disabled:m,style:{appearance:"none",background:"none",border:"none",padding:0,cursor:m?"wait":"pointer",fontSize:11,color:"var(--v2-ink-secondary)",textDecoration:"underline",textUnderlineOffset:2},children:m?"Un-marking…":"Un-mark this criterion"}),j&&e.jsx("span",{role:"alert",style:{fontSize:11,color:"var(--v2-critical)"},children:j})]})]})}return E?e.jsx("div",{"aria-hidden":"true",style:{padding:"var(--v2-pad-3) var(--v2-pad-4)",background:"var(--v2-bg)",border:"1px solid var(--v2-border)",borderRadius:4,minHeight:56}}):e.jsxs("div",{style:{padding:"var(--v2-pad-3) var(--v2-pad-4)",background:"var(--v2-bg)",border:"1px solid var(--v2-border)",borderRadius:4},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"var(--v2-pad-3)",flexWrap:"wrap"},children:[e.jsxs("span",{className:"v2-mono",style:{fontSize:11,fontWeight:600,color:"var(--v2-ink-tertiary)"},children:["WCAG ",t]}),e.jsx("span",{style:{fontSize:13,fontWeight:500,color:"var(--v2-ink-primary)"},children:a})]}),H&&e.jsx("p",{style:{margin:"4px 0 0",fontSize:12,color:"var(--v2-ink-secondary)",lineHeight:1.5},children:H}),e.jsx("p",{style:{margin:"6px 0 0",fontSize:11,color:"var(--v2-ink-tertiary)",lineHeight:1.5},children:A[r]}),ie&&e.jsxs("div",{style:{marginTop:"var(--v2-pad-2)"},children:[e.jsx("p",{className:"v2-eyebrow",style:{margin:0,fontSize:10},children:"how to check"}),e.jsx("p",{style:{margin:"2px 0 0",fontSize:12,color:"var(--v2-ink-secondary)",lineHeight:1.5},children:ie.howToCheck})]}),o.length>0&&e.jsxs("div",{style:{marginTop:"var(--v2-pad-3)"},children:[e.jsxs("p",{className:"v2-eyebrow",style:{margin:0,fontSize:10},children:["suspect locations · ",o.length]}),e.jsx("ul",{style:{listStyle:"none",padding:0,margin:"4px 0 0",display:"flex",flexDirection:"column",gap:"var(--v2-pad-2)"},children:o.map((I,P)=>e.jsx(ut,{ev:I},`${I.pageUrl}::${I.selector??""}::${P}`))})]}),e.jsxs("div",{style:{display:"flex",gap:"var(--v2-pad-3)",marginTop:"var(--v2-pad-2)",flexWrap:"wrap",alignItems:"center"},children:[ne&&e.jsx("a",{href:at(ne),target:"_blank",rel:"noreferrer noopener",style:{fontSize:11,color:"var(--v2-ink-secondary)",textDecoration:"underline",textUnderlineOffset:2},children:"Read W3C guidance ↗"}),s&&e.jsx("button",{type:"button",onClick:ke,disabled:R,style:{appearance:"none",background:"none",border:"none",padding:0,cursor:R?"wait":"pointer",fontSize:11,color:"var(--v2-ink-secondary)",textDecoration:"underline",textUnderlineOffset:2},children:R?"Explaining…":C?"Re-explain with AI":"Explain with AI ↗"})]}),(C||z)&&e.jsxs("div",{style:{marginTop:"var(--v2-pad-2)",padding:"var(--v2-pad-2) var(--v2-pad-3)",background:"var(--v2-bg-elev)",border:"1px solid var(--v2-border)",borderRadius:4},children:[C&&e.jsx("p",{style:{margin:0,fontSize:12,color:"var(--v2-ink-primary)",lineHeight:1.55,whiteSpace:"pre-wrap"},children:C}),z&&e.jsx("p",{role:"alert",style:{margin:0,fontSize:11,color:"var(--v2-critical)"},children:z}),c!==null&&e.jsxs("p",{className:"v2-mono",style:{margin:"4px 0 0",fontSize:10,color:"var(--v2-ink-tertiary)"},children:["$",c.toFixed(4)," · ",n]})]}),e.jsxs("div",{style:{display:"flex",gap:"var(--v2-pad-2)",marginTop:"var(--v2-pad-3)",flexWrap:"wrap"},children:[e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:()=>{h(v==="pass"?null:"pass"),d(null)},"aria-expanded":v==="pass",children:v==="pass"?"Cancel":"Mark Pass"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:()=>{h(v==="na"?null:"na"),d(null)},"aria-expanded":v==="na",children:v==="na"?"Cancel":"Mark N/A"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:()=>{h(v==="fail"?null:"fail"),d(null)},"aria-expanded":v==="fail",children:v==="fail"?"Cancel":"Mark Fail"})]}),v&&e.jsxs("div",{style:{marginTop:"var(--v2-pad-3)",display:"flex",flexDirection:"column",gap:"var(--v2-pad-2)"},children:[e.jsx("p",{className:"v2-eyebrow",style:{margin:0},children:"verification note · required"}),e.jsx("p",{style:{margin:0,fontSize:11,color:"var(--v2-ink-tertiary)",lineHeight:1.4},children:v==="na"?'Describe why this criterion does not apply to this audit (e.g., "no audio/video content on this page").':v==="pass"?'Describe what you checked to verify pass (e.g., "manually browsed page in keyboard-only mode, no focus traps").':'Describe the failure (e.g., "modal does not return focus to the trigger when closed").'}),e.jsx("textarea",{value:x,onChange:I=>k(I.target.value),rows:3,style:{width:"100%",fontFamily:"var(--v2-body)",fontSize:12,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:56},placeholder:v==="na"?"e.g., No audio or video content present on this page; criterion is not applicable.":v==="pass"?"e.g., Manually verified — page resizes correctly at 200% zoom without horizontal scroll.":"e.g., Focus visible indicator missing on dark-mode buttons."}),j&&e.jsx("p",{role:"alert",style:{margin:0,padding:"var(--v2-pad-2) var(--v2-pad-3)",background:"rgba(207, 44, 44, 0.06)",border:"1px solid var(--v2-critical)",borderRadius:4,color:"var(--v2-critical)",fontSize:11},children:j}),e.jsx("div",{children:e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary v2-btn-sm",onClick:()=>we(v),disabled:m||!x.trim(),children:m?"Saving…":`Confirm ${v.toUpperCase()}`})})]})]})}function ut({ev:t}){const[a,r]=p.useState(!1),[o,i]=p.useState(null);async function l(){r(!0),i(null);try{const s=await it({pageUrl:t.pageUrl,selector:t.selector});s.ok?t.selector?s.found?i({kind:"ok",text:`Element highlighted (${s.matchCount} match${s.matchCount===1?"":"es"}).`}):i({kind:"warn",text:"Page opened but the selector matched zero elements — DOM may have changed since the audit."}):i({kind:"ok",text:`Opened ${de(t.pageUrl)} — no element selector available; verify manually.`}):i({kind:"err",text:s.error})}finally{r(!1)}}return e.jsxs("li",{style:{padding:"var(--v2-pad-2) var(--v2-pad-3)",background:"var(--v2-bg)",border:"1px solid var(--v2-border)",borderRadius:4,display:"flex",flexDirection:"column",gap:4},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:"var(--v2-pad-2)",flexWrap:"wrap"},children:[e.jsx("span",{className:"v2-mono",title:t.pageUrl,style:{fontSize:11,color:"var(--v2-ink-secondary)",overflowWrap:"anywhere"},children:de(t.pageUrl)}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:l,disabled:a,children:a?"Opening…":t.selector?"Show on page":"Open page"})]}),t.selector&&e.jsx("span",{className:"v2-mono",title:t.selector,style:{fontSize:11,color:"var(--v2-ink-tertiary)",overflowWrap:"anywhere"},children:st(t.selector)}),t.notes&&e.jsx("span",{style:{fontSize:11,color:"var(--v2-ink-tertiary)",lineHeight:1.4},children:t.notes}),o&&e.jsx("span",{role:o.kind==="err"?"alert":"status",style:{fontSize:11,color:o.kind==="err"?"var(--v2-critical)":o.kind==="warn"?"var(--v2-needs-review)":"var(--v2-verified)"},children:o.text})]})}function pt(){const{report:t,resolvedFails:a}=X(),r=S(c=>c.siteCrawlReport),o=S(c=>c.siteCrawlStatus),i=S(c=>c.siteCrawlError),l=S(c=>c.status),s=o==="running",u=s||l==="running"&&!s,v=!!t&&!r,[h,x]=p.useState(null);p.useEffect(()=>{let c=!1;return chrome.tabs.query({active:!0,currentWindow:!0}).then(b=>{var A;c||x(((A=b[0])==null?void 0:A.url)??null)}),()=>{c=!0}},[]);const[k,m]=p.useState(!1);function f(c,b=!1){c.startUrl&&(S.getState().setSiteCrawlStatus("running"),S.getState().setSiteCrawlReport(null),S.getState().setSiteCrawlError(null),oe({type:"START_SITE_CRAWL",startUrl:c.startUrl,maxPages:c.maxPages,...c.includeRegex?{includeRegex:c.includeRegex}:{},...c.excludeRegex?{excludeRegex:c.excludeRegex}:{},...b?{verifyFixesOnly:!0}:{}}))}function j(){oe({type:"START_AUDIT",mode:"full-page"}),S.getState().startNewScan()}const[d,w]=p.useState(!1),[y,E]=p.useState(null),[g,R]=p.useState(null);async function T(){w(!0),E(null),R(null);const c=(t==null?void 0:t.siteGrade)??"A";try{const b=await W({type:"REGRADE_SITE_CRAWL"});if((b==null?void 0:b.ok)===!0)setTimeout(()=>{var F;const L=((F=S.getState().siteCrawlReport)==null?void 0:F.siteGrade)??c;R({prevGrade:c,nextGrade:L,at:Date.now()})},0);else{const L=(b==null?void 0:b.reason)??"Regrade failed.";E(L)}}catch(b){E(b instanceof Error?b.message:String(b))}finally{w(!1)}}if(p.useEffect(()=>{if(!g)return;const c=setTimeout(()=>R(null),6e3);return()=>clearTimeout(c)},[g]),u)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(Xe,{}):e.jsx(Je,{})});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."}),i&&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:"}),i]}),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(se,{initialUrl:h??"",isRunning:u,onCrawl:c=>f(c,!1),onAuditThisPage:j})]});const C=a.length,D=(t.totalWalkthroughFindings??0)+t.totalUniqueViolations+C,z=(t.walkthroughAcknowledgements??[]).length,N=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(ht,{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:(()=>{var A;const c=D+N,b=((A=t.blockingCriteria)==null?void 0:A.length)??0;return c===0&&b===0?"All clear — nothing open.":c===0&&b>0?`Visible findings clear — ${b} criteri${b===1?"on":"a"} still need${b===1?"s":""} your judgment.`:`${c} finding${c===1?"":"s"} to address.`})()}),e.jsx(gt,{openCount:D,reviewCount:N,verifiedCount:z,axeCount:t.totalUniqueViolations,walkthroughCount:t.totalWalkthroughFindings??0,autoCount:C}),h&&!vt(h,t.startUrl)&&e.jsxs("p",{className:"v2-mono",style:{margin:0,fontSize:11,color:"var(--v2-ink-tertiary)",wordBreak:"break-all"},children:["Active tab: ",h]}),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:j,title:"Re-audit the current page",children:"Re-audit this page"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost",onClick:()=>m(c=>!c),"aria-expanded":k,title:"Open crawl setup to audit the whole site instead",children:k?"Hide crawl options":"Crawl whole site"})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary",onClick:T,disabled:d,title:"Re-aggregate this audit against your latest verdicts + acks. No re-crawl. Use this after marking criteria in the Coverage gaps panel.",children:d?"Regrading…":"Regrade"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost",onClick:()=>f({startUrl:t.startUrl,maxPages:25,includeRegex:"",excludeRegex:""},!1),title:`Re-crawl ${t.startUrl} (same options) — full audit re-run, use when page code changed`,children:"Re-crawl"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost",onClick:j,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:()=>f({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:()=>m(c=>!c),"aria-expanded":k,children:k?"Hide options":"Adjust options"})]}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:()=>{Re(),S.getState().setSiteCrawlReport(null),S.getState().setSiteCrawlError(null),_e(null).catch(()=>{})},title:"Wipe these results so you can start fresh",style:{marginLeft:"auto"},children:"Clear results"})]}),y&&e.jsx("p",{role:"alert",style:{margin:"var(--v2-pad-2) 0 0",fontSize:11,color:"var(--v2-critical)"},children:y}),g&&!y&&e.jsx("p",{role:"status",style:{margin:"var(--v2-pad-2) 0 0",fontSize:11,color:"var(--v2-verified)"},children:g.prevGrade===g.nextGrade?`Regraded — grade unchanged at ${g.nextGrade}. Any verdict changes you made were already in this report.`:`Regraded — grade ${g.prevGrade} → ${g.nextGrade}.`})]})]}),e.jsx(ct,{}),k&&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(se,{initialUrl:t.startUrl,isRunning:u,onCrawl:c=>f(c,!1),onVerifyFixes:c=>f(c,!0),onAuditThisPage:j})})]})}function vt(t,a){try{return new URL(t).origin===new URL(a).origin}catch{return!1}}function ht({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 gt({openCount:t,reviewCount:a,verifiedCount:r,axeCount:o,walkthroughCount:i,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(B,{term:"open",value:t,tone:t>0?"attention":"neutral"}),e.jsx(B,{term:"review",value:a,tone:a>0?"review":"neutral"}),e.jsx(B,{term:"verified",value:r,tone:r>0?"positive":"neutral"}),e.jsx("span",{style:{color:"var(--v2-ink-faint)"},children:"·"}),e.jsx(B,{term:"axe",value:o,tone:"neutral"}),e.jsx(B,{term:"walkthrough",value:i,tone:"neutral"}),l>0&&e.jsx(B,{term:"auto-contrast",value:l,tone:"neutral"})]})}function B({term:t,value:a,tone:r}){const o={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:o[r],fontVariantNumeric:"tabular-nums"},children:a})]})}const mt=new Set(["2.4.3","2.1.2","2.4.7","1.3.2","1.4.11","2.5.3"]);function ue(t){return mt.has(t)}async function pe(t){var o,i;const a=S.getState();if(a.componentId&&((o=a.results[0])==null?void 0:o.pageUrl)===t)return a.componentId;const r=await ge();return((i=r==null?void 0:r.find(l=>l.url===t))==null?void 0:i.componentId)??null}async function ft(t,a){var l;const r=S.getState(),o=[];if(r.componentId&&r.results.length>0){const s=(l=r.results[0])==null?void 0:l.pageUrl,n=a.find(u=>u.url===s);if(n){for(const u of r.results)for(const v of u.violations)v.ruleId===t&&v.target.selector===n.selector&&o.push({componentId:r.componentId,matchKey:v.matchKey});if(o.length>0)return o}}const i=await ge()??[];for(const s of a){const n=i.find(u=>u.url===s.url);if(n)for(const u of n.results)for(const v of u.violations)v.ruleId===t&&v.target.selector===s.selector&&o.push({componentId:n.componentId,matchKey:v.matchKey})}return o}function yt({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(bt,{row:t}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx(xt,{row:t}),e.jsx(kt,{row:t})]}),e.jsx(wt,{})]}),e.jsx("div",{style:{padding:"0 var(--v2-pad-4) var(--v2-pad-4)",borderTop:"1px solid var(--v2-border)"},children:e.jsx(St,{row:t})})]})}function bt({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 xt({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 kt({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,o=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}),o&&e.jsx("span",{className:"v2-mono",style:{fontSize:11,color:"var(--v2-ink-tertiary)",wordBreak:"break-all"},children:o}),a>1&&e.jsxs("span",{className:"v2-eyebrow",style:{marginLeft:"auto"},children:["on ",a," pages"]})]})}function wt(){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 St({row:t}){return t.kind==="walkthrough-fail"?e.jsx(Ct,{row:t}):t.kind==="walkthrough-ack"?e.jsx(Rt,{row:t}):t.kind==="needs-review"?e.jsx(Tt,{row:t}):t.kind==="auto-contrast"?e.jsx(jt,{row:t}):e.jsx(It,{row:t})}function jt({row:t}){const[a,r]=p.useState(!1),[o,i]=p.useState(!1),[l,s]=p.useState(""),[n,u]=p.useState(!1),[v,h]=p.useState(!1),[x,k]=p.useState(null),m=me(t.ruleId);async function f(){if(u(!0),k(null),!l.trim()){k("Note is required — explain why the empirical contrast measurement is wrong, or why this element is acceptable in context."),u(!1);return}try{const d=(await ve(t.pageUrl)).find(y=>y.ruleId===t.ruleId&&y.selector===t.selector),w={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:d==null?void 0:d.inputHash};await Me(w),h(!0),r(!1)}catch(j){k(j instanceof Error?j.message:String(j))}finally{u(!1)}}return e.jsxs("div",{style:{paddingTop:"var(--v2-pad-3)"},children:[e.jsx(K,{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(re,{}):e.jsxs(e.Fragment,{children:[e.jsxs(ae,{children:[m&&e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:()=>i(j=>!j),"aria-expanded":o,children:o?"Hide fix recipe":"Show fix recipe"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary v2-btn-sm",onClick:()=>r(j=>!j),"aria-expanded":a,children:a?"Cancel":"Mark verified manually"})]}),o&&m&&e.jsx(be,{summary:m.summary,snippet:m.snippet}),a&&e.jsx(te,{note:l,setNote:s,busy:n,err:x,onConfirm:f,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."}),x&&!a&&e.jsx(J,{message:x})]})]})}function Ct({row:t}){const[a,r]=p.useState(!1),[o,i]=p.useState(""),[l,s]=p.useState(!1),[n,u]=p.useState(!1),[v,h]=p.useState(!1),[x,k]=p.useState(null),[m,f]=p.useState(null),j=ue(t.criterion);async function d(){if(s(!0),f(null),!o.trim()){f("Note is required — explain how you manually verified this."),s(!1);return}try{const y=await pe(t.pageUrl);if(!y){f("Could not find this page in the audit data. Re-run the audit and try again.");return}await Ve({componentId:y,criterionId:t.criterion,pageUrl:t.pageUrl,note:o.trim(),acknowledgedAt:new Date().toISOString(),verdictAtAck:t.verdict}),u(!0),r(!1)}catch(y){f(y instanceof Error?y.message:String(y))}finally{s(!1)}}async function w(){var y;h(!0),k(null),f(null);try{const g=(y=(await chrome.tabs.query({active:!0,currentWindow:!0}))[0])==null?void 0:y.id;if(!g){f("Open the audited page in your active tab to re-run.");return}const R=await pe(t.pageUrl);if(!R){f("Could not find this page in the audit data.");return}if(!ue(t.criterion)){f(`Re-run is only available for interactive criteria. ${t.criterion} is not supported.`);return}const C=await W({type:"INTERACTIVE_AUDIT_REQUEST",criterionId:t.criterion,tabId:g,componentId:R,pageUrl:t.pageUrl});if(!C.ok){f(C.error??"Re-run failed.");return}k(`Re-run verdict: ${C.verdict??"unknown"}. Re-audit the page to refresh this list.`)}catch(E){f(E instanceof Error?E.message:String(E))}finally{h(!1)}}return e.jsxs("div",{style:{paddingTop:"var(--v2-pad-3)"},children:[e.jsx(K,{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(re,{}):e.jsxs(e.Fragment,{children:[e.jsxs(ae,{children:[j&&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:()=>r(y=>!y),"aria-expanded":a,children:a?"Cancel":"Mark verified manually"})]}),x&&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:x}),a&&e.jsx(te,{note:o,setNote:i,busy:l,err:m,onConfirm:d,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."}),m&&!a&&e.jsx(J,{message:m})]})]})}function Rt({row:t}){return e.jsxs("div",{style:{paddingTop:"var(--v2-pad-3)"},children:[e.jsx(K,{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 Tt({row:t}){return e.jsx(ye,{row:t,kind:"needs-review"})}function It({row:t}){return e.jsx(ye,{row:t,kind:"axe"})}function ye({row:t,kind:a}){const[r,o]=p.useState(!1),[i,l]=p.useState(""),[s,n]=p.useState(!1),[u,v]=p.useState(!1),[h,x]=p.useState(!1),[k,m]=p.useState(null),f=me(t.ruleId);async function j(){if(n(!0),m(null),!i.trim()){m(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 d=await ft(t.ruleId,t.pages);if(d.length===0){m("Could not find this finding in the persisted audit data. Re-run the audit and try again.");return}for(const w of d)await Ge({componentId:w.componentId,matchKey:w.matchKey,ruleId:t.ruleId,note:i.trim()});v(!0),o(!1)}catch(d){m(d instanceof Error?d.message:String(d))}finally{n(!1)}}return e.jsxs("div",{style:{paddingTop:"var(--v2-pad-3)"},children:[a==="needs-review"&&t.failureSummary&&e.jsx(K,{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(K,{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(d=>e.jsx("li",{children:e.jsx("a",{href:d.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:d.url})},d.url)),t.pages.length>8&&e.jsxs("li",{className:"v2-eyebrow",children:["+ ",t.pages.length-8," more"]})]})}),u?e.jsx(re,{}):e.jsxs(e.Fragment,{children:[e.jsxs(ae,{children:[a==="axe"&&f&&e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:()=>x(d=>!d),"aria-expanded":h,children:h?"Hide fix recipe":"Show fix recipe"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary v2-btn-sm",onClick:()=>o(d=>!d),"aria-expanded":r,children:r?"Cancel":"Mark verified manually"})]}),h&&f&&e.jsx(be,{summary:f.summary,snippet:f.snippet}),r&&e.jsx(te,{note:i,setNote:l,busy:s,err:k,onConfirm:j,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"}`}),k&&!r&&e.jsx(J,{message:k})]})]})}function te({note:t,setNote:a,busy:r,err:o,onConfirm:i,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:u=>a(u.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}),o&&e.jsx(J,{message:o}),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:i,disabled:r||!t.trim(),children:r?"Saving…":n})})]})}function be({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 re(){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 J({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 K({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 ae({children:t}){return e.jsx("div",{style:{display:"flex",gap:"var(--v2-pad-2)",flexWrap:"wrap",marginTop:"var(--v2-pad-2)"},children:t})}function At(){const{report:t,resolvedFails:a}=X(),[r,o]=p.useState("open"),i=p.useMemo(()=>t?Ut(t.pages,t.findingGroups??[],a):[],[t,a]),l=p.useMemo(()=>r==="all"?i:i.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),[i,r]);if(!t)return null;const s={all:i.length,open:i.filter(n=>n.kind==="axe"||n.kind==="walkthrough-fail"||n.kind==="auto-contrast").length,review:i.filter(n=>n.kind==="needs-review").length,verified:i.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(Nt,{filter:r,setFilter:o,counts:s})]}),l.length===0?e.jsx(Et,{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,u)=>e.jsx("li",{style:{animation:`v2-row-in 240ms ease ${Math.min(u,12)*30}ms both`},children:e.jsx(yt,{row:n})},n.key))})]})}function Nt({filter:t,setFilter:a,counts:r}){const o=[{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:o.map(i=>{const l=t===i.id;return e.jsxs("button",{type:"button",role:"tab","aria-selected":l,onClick:()=>a(i.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:[i.label,e.jsx("span",{className:"v2-mono",style:{fontSize:10,color:"var(--v2-ink-tertiary)",fontVariantNumeric:"tabular-nums"},children:r[i.id]})]},i.id)})})}function Et({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 Ut(t,a,r=[]){const o=[];for(const s of a)s.needsReview?o.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}):o.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 i=new Set;for(const s of t){for(const n of s.walkthroughFindings??[]){const u=`wt-fail::${n.criterionId}::${n.pageUrl}`;i.has(u)||(i.add(u),o.push({kind:"walkthrough-fail",key:u,criterion:n.criterionId,verdict:n.verdict,impact:n.impact,reasoning:n.reasoning,pageUrl:n.pageUrl}))}for(const n of s.walkthroughAcknowledgements??[]){const u=`wt-ack::${n.criterionId}::${n.pageUrl}`;i.has(u)||(i.add(u),o.push({kind:"walkthrough-ack",key:u,criterion:n.criterionId,verdict:n.verdict,reasoning:n.reasoning,pageUrl:n.pageUrl}))}}for(const s of r)o.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 o.sort((s,n)=>{const u=s.kind==="walkthrough-ack"?l.ack:s.kind==="needs-review"?l["needs-review"]:l[s.impact],v=n.kind==="walkthrough-ack"?l.ack:n.kind==="needs-review"?l["needs-review"]:l[n.impact];return(u??99)-(v??99)}),o}function zt({open:t,onClose:a}){const{report:r}=X(),o=S(g=>g.siteCrawlReport),i=S(g=>g.results),l=S(g=>g.componentId),s=S(g=>g.delta),n=!!o,u=n||i.length>0,v=fe({storeComponentId:l,storeCrawlReport:o,pageUrls:(r==null?void 0:r.pages.map(g=>g.url))??[]}),[h,x]=p.useState({}),k=p.useRef(null);p.useEffect(()=>{var R;if(!t)return;const g=T=>{T.key==="Escape"&&a()};return document.addEventListener("keydown",g),(R=k.current)==null||R.focus(),()=>document.removeEventListener("keydown",g)},[t,a]);function m(g,R){x(T=>({...T,[g]:R}))}async function f(){m("ai-prompt",{state:"busy"});try{if(n){const g=await W({type:"EXPORT_REQUEST",format:"ai-prompt-site-crawl",results:[],...r?{siteCrawlReport:r}:{}});if(!(g!=null&&g.content))throw new Error("Empty response");await navigator.clipboard.writeText(g.content),await Y(g.content,"ai-fixer-prompt.md","text/markdown"),m("ai-prompt",{state:"done",message:"Copied to clipboard + opened in a new tab."})}else{if(!i.length)throw new Error("No audit results yet");await Qe({results:i,componentId:l??null,delta:s}),m("ai-prompt",{state:"done",message:"Copied to clipboard + opened in a new tab."})}}catch(g){m("ai-prompt",{state:"error",message:g instanceof Error?g.message:String(g)})}}async function j(){m("html",{state:"busy"});try{if(n&&r){const{renderSiteReportHtml:g}=await q(async()=>{const{renderSiteReportHtml:T}=await import("./site-report-renderer-CFmHz6nh.js");return{renderSiteReportHtml:T}},__vite__mapDeps([0,1,2,3,4])),R=g(r);await Y(R,"site-report.html","text/html"),m("html",{state:"done",message:"Opened in a new tab — Save as PDF or use Cmd/Ctrl+S."})}else{if(!i.length)throw new Error("No audit results yet");const{toHtmlPrint:g}=await q(async()=>{const{toHtmlPrint:T}=await import("./scheduled-audit-runner-CCxgrfOE.js").then(C=>C.aU);return{toHtmlPrint:T}},__vite__mapDeps([1,2,3,4])),R=g(i,s??void 0);await Y(R,"page-report.html","text/html"),m("html",{state:"done",message:"Opened in a new tab — Save as PDF or use Cmd/Ctrl+S."})}}catch(g){m("html",{state:"error",message:g instanceof Error?g.message:String(g)})}}async function d(g,R,T){m(g,{state:"busy"});try{const C=await W({type:"EXPORT_REQUEST",format:g,results:n?[]:i,...s&&!n?{delta:s}:{},...n?{siteCrawlSource:!0}:{},...v?{auditTargetId:v}:{}});if(!(C!=null&&C.content))throw new Error("Empty response");await Y(C.content,T,"text/html"),m(g,{state:"done",message:`${R} opened in a new tab.`})}catch(C){m(g,{state:"error",message:C instanceof Error?C.message:String(C)})}}async function w(){const{createZip:g}=await q(async()=>{const{createZip:N}=await import("./zip-encoder-CtULHXx_.js");return{createZip:N}},[]),{renderSiteReportHtml:R}=await q(async()=>{const{renderSiteReportHtml:N}=await import("./site-report-renderer-CFmHz6nh.js");return{renderSiteReportHtml:N}},__vite__mapDeps([0,1,2,3,4])),T=[],C=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"}],D=C.length+(n&&r?1:0);let z=0;m("zip",{state:"busy",progress:{current:0,total:D,label:"Starting…"}});try{if(n&&r){z++,m("zip",{state:"busy",progress:{current:z,total:D,label:"site-report.html (client-side)"}});try{T.push({name:"site-report.html",content:R(r)})}catch{}}for(const{format:L,filename:F}of C){z++,m("zip",{state:"busy",progress:{current:z,total:D,label:F}});try{const H=await W({type:"EXPORT_REQUEST",format:L,results:n?[]:i,...s&&!n?{delta:s}:{},...n?{siteCrawlSource:!0}:{},...v?{auditTargetId:v}:{}});H!=null&&H.content&&T.push({name:F,content:H.content})}catch{}}if(T.length===0)throw new Error("All exports failed");const N=g(T),c=new Blob([N],{type:"application/zip"}),b=URL.createObjectURL(c),A=document.createElement("a");A.href=b,A.download=n?"wcagcheckr-site-bundle.zip":"wcagcheckr-page-bundle.zip",A.click(),setTimeout(()=>URL.revokeObjectURL(b),6e4),m("zip",{state:"done",message:`Downloaded ${T.length} file${T.length===1?"":"s"}.`})}catch(N){m("zip",{state:"error",message:N instanceof Error?N.message:String(N)})}}function y(g){S.getState().setView(g),chrome.storage.local.set({v2UiEnabled:!1}),a()}function E(){W({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:k,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:[!u&&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."}),u&&e.jsxs(e.Fragment,{children:[e.jsx(_,{title:"AI fixer",children:e.jsx($,{status:h["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:f})}),e.jsxs(_,{title:"Reports",children:[e.jsx($,{status:h.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:j}),e.jsx($,{status:h["executive-report"],label:"Executive report",description:"Hero grade + framing, top risks, next steps. For non-technical readers.",onClick:()=>d("executive-report","Executive report","executive-report.html")}),n&&e.jsx($,{status:h["ticket-bundle"],label:"Ticket bundle",description:"Markdown formatted for paste into Linear / Jira / GitHub Issues — one ticket per finding, sorted by severity.",onClick:()=>d("ticket-bundle","Ticket bundle","ticket-bundle.md")})]}),e.jsxs(_,{title:"Compliance & legal",children:[e.jsx($,{status:h["defense-bundle"],label:"Defense bundle",description:"Anchored chain-of-custody evidence package. Use in pre-litigation.",onClick:()=>d("defense-bundle","Defense bundle","defense-bundle.html")}),e.jsx($,{status:h["deposition-packet"],label:"Deposition packet",description:"Full evidence bundle — anchor, receipts, fingerprints, signing cert.",onClick:()=>d("deposition-packet","Deposition packet","deposition-packet.html")}),e.jsx($,{status:h.vpat,label:"VPAT",description:"Voluntary Product Accessibility Template. Procurement-ready.",onClick:()=>d("vpat","VPAT","vpat.html")}),e.jsx($,{status:h["conformance-crosswalk"],label:"Conformance crosswalk",description:"WCAG ↔ Section 508 ↔ EN 301 549 mapping.",onClick:()=>d("conformance-crosswalk","Conformance crosswalk","conformance-crosswalk.html")}),e.jsx($,{status:h["methodology-doc"],label:"Methodology PDF",description:"Auditor-explainable methodology — what was tested, how, with what tools.",onClick:()=>d("methodology-doc","Methodology doc","methodology-doc.html")}),e.jsx($,{status:h["evidence-bundle"],label:"Evidence bundle",description:"Lighter than defense bundle — audit records + summary.",onClick:()=>d("evidence-bundle","Evidence bundle","evidence-bundle.html")})]}),e.jsx(_,{title:"Bulk",children:e.jsx($,{status:h.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:w})})]}),e.jsxs(_,{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(U,{label:"State matrix",description:"Per-state findings grid (hover · focus · dark · RTL · etc.)",onClick:()=>y("matrix")}),e.jsx(U,{label:"Per-area compliance",description:"9 sub-grade areas with drill-in: Color & contrast, Keyboard, etc.",onClick:()=>y("report")}),e.jsx(U,{label:"Baseline delta",description:"New vs. persistent vs. fixed vs. acknowledged since the last baseline.",onClick:()=>y("delta")}),e.jsx(U,{label:"Forensic log",description:"Anchored audit history with chain-of-custody.",onClick:()=>y("forensic")}),e.jsx(U,{label:"Risk dashboard",description:"Lawsuit / conformance risk tiers with prioritized actions.",onClick:()=>y("risk")}),e.jsx(U,{label:"WCAG 3 mapping",description:"Outcome-level grouping per WCAG 3 snapshot.",onClick:()=>y("wcag3")}),e.jsx(U,{label:"WCAG-EM verdicts",description:"Formal per-criterion verdict map.",onClick:()=>y("compliance")}),e.jsx(U,{label:"Schedules",description:"Recurring audit management with email alerts.",onClick:()=>y("schedules")}),e.jsx(U,{label:"Copilot chat",description:"Anthropic-powered Q&A over your audit context.",onClick:()=>y("copilot")}),e.jsx(U,{label:"Accessibility tree",description:"Inspect the live aria tree as assistive tech sees it.",onClick:()=>y("ax-tree")}),e.jsx(U,{label:"Design tokens",description:"CSS-token / design-system audit.",onClick:()=>y("tokens")}),e.jsx(U,{label:"Guided audit",description:"13 manual IGT workflows (keyboard, screen reader, etc.).",onClick:()=>y("guided")}),e.jsx(U,{label:"Per-component scorecard",description:"Custom rules, baselines, per-component drill-in.",onClick:()=>y("scorecard")}),e.jsx(U,{label:"User journey flows",description:"Multi-step audit recordings.",onClick:()=>y("flows")}),e.jsx(U,{label:"Activity / IGT runs",description:"Manual workflow run history.",onClick:()=>y("activity")})]}),e.jsx(_,{title:"Settings",children:e.jsx($,{status:void 0,label:"Open settings",description:"Matrix preset, AI config, axe rule overrides, breakpoints, auto-export.",onClick:E})})]})]})]}):null}async function Y(t,a,r){const o=new Blob([t],{type:r}),i=URL.createObjectURL(o);try{await chrome.tabs.create({url:i})}catch{const l=document.createElement("a");l.href=i,l.download=a,l.click()}setTimeout(()=>URL.revokeObjectURL(i),6e4)}function _({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 $({label:t,description:a,status:r,onClick:o}){const i=(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:o,disabled:i,children:i?"Working…":l?"Run again":"Run"})]}),a&&e.jsx("p",{style:{margin:0,fontSize:11,color:"var(--v2-ink-tertiary)",lineHeight:1.5},children:a}),i&&(r==null?void 0:r.progress)&&e.jsxs("p",{role:"status","aria-live":"polite",style:{margin:0,marginTop:4,fontSize:11,color:"var(--v2-ink-secondary)"},children:[r.progress.current,"/",r.progress.total," — ",r.progress.label??""]}),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 U({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 Dt(){var l,s;const t=S(n=>n.siteCrawlReport),a=S(n=>n.results),[r,o]=p.useState(!1),i=(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"})]}),i&&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:i,children:i})]}),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:()=>o(!0),"aria-label":"Open tools and exports drawer","aria-expanded":r,title:"Exports, baselines, schedules, forensic log, settings, more",children:"Tools"})]})]}),e.jsx(zt,{open:r,onClose:()=>o(!1)})]})}function Ft(){return p.useEffect(()=>{const t=Te(),r=new URLSearchParams(window.location.search).get("context")==="overlay"?null:chrome.runtime.connect({name:"sidepanel-tracker"}),o=Ie();Ae({forceRefresh:!0}).catch(()=>{}),Ne().catch(()=>{}),Ee().catch(()=>{}),Ue().catch(()=>{}),ze().catch(()=>{}),Ke().then(l=>{S.getState().setAcknowledgedKeys(new Set(l.map(s=>s.matchKey)))}).catch(()=>{});let i=!1;return qe().then(l=>{i||l&&S.setState({siteCrawlReport:l})}).catch(()=>{}),()=>{i=!0,o();try{t.disconnect()}catch{}try{r==null||r.disconnect()}catch{}}},[]),e.jsxs("div",{className:"v2-root",children:[e.jsx(Dt,{}),e.jsxs("main",{id:"main-content","aria-label":"wcagcheckr findings",children:[e.jsx(pt,{}),e.jsx(At,{})]})]})}Ze("side-panel");const Z="v2UiEnabled";function Pt(){const[t,a]=p.useState(null);return p.useEffect(()=>{let r=!1;chrome.storage.local.get(Z).then(i=>{r||a(!!i[Z])}).catch(()=>a(!1));const o=(i,l)=>{var s;l==="local"&&Z in i&&a(!!((s=i[Z])!=null&&s.newValue))};return chrome.storage.onChanged.addListener(o),()=>{r=!0,chrome.storage.onChanged.removeListener(o)}},[]),t===null?null:t?e.jsx(Ft,{}):e.jsx(Fe,{})}const xe=document.getElementById("root");if(!xe)throw new Error("side-panel: #root not found");Se(xe).render(e.jsx(je.StrictMode,{children:e.jsx(De,{children:e.jsx(Pt,{})})}));
|
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.320",
|
|
6
|
+
"version_name": "1.0.0-rc.320",
|
|
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-BWBvvOnk.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-Bu2p8K-p.js">
|
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.320",
|
|
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,4 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/site-report-renderer-CFmHz6nh.js","assets/scheduled-audit-runner-CCxgrfOE.js","assets/diff-DA41zYPc.js","assets/crash-reporter-Bu2p8K-p.js","assets/ai-usage-log-BX3L6bKl.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import"./modulepreload-polyfill-B5Qt9EMX.js";import{j as e,r as u,c as je,R as Se}from"./styles-Cn731SYD.js";import{u as k,c as Ce,a as Re,l as oe,s as Te,w as Ie,r as Ae,b as Ne,d as Ee,p as Ue,e as ze,E as De,A as Fe}from"./ErrorBoundary-D6Z5mQQ2.js";import{l as Pe,a as $e,g as ve,b as We,c as Le,W as Oe,d as he,r as He,s as Be,e as _e,f as ge,h as me,i as Ve,j as Me,k as Ge,m as Ke,n as qe}from"./scheduled-audit-runner-CCxgrfOE.js";import{s as F,r as Ye,i as Ze}from"./crash-reporter-Bu2p8K-p.js";import{B as J}from"./ai-usage-log-BX3L6bKl.js";import{_ as G}from"./diff-DA41zYPc.js";import{copyAiFixerPrompt as Qe}from"./copy-ai-fixer-prompt-BeFgwwDM.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./design-system-audit-DpxJrxnb.js";function se({initialUrl:t,isRunning:a,onCrawl:r,onVerifyFixes:i,onAuditThisPage:s}){const[l,o]=u.useState(t),[n,c]=u.useState(25),[p,g]=u.useState(""),[j,b]=u.useState(""),[m,f]=u.useState(!1),[w,d]=u.useState(J),[x,y]=u.useState(J[0].id),[E,h]=u.useState(null);u.useEffect(()=>{t&&!l&&o(t)},[t]),u.useEffect(()=>{let S=!1;return Promise.all([F({type:"SETTINGS_GET",key:"matrixPresets"}),F({type:"SETTINGS_GET",key:"activePresetId"})]).then(([v,R])=>{if(S)return;const N=Array.isArray(v.data)?v.data:null;d(N&&N.length>0?N:J),typeof R.data=="string"&&y(R.data)}),()=>{S=!0}},[]);function I(S){const v=w.find(R=>R.id===S);v&&(y(S),F({type:"SETTINGS_SET",key:"activePresetId",value:S}),F({type:"SETTINGS_SET",key:"stateMatrix",value:v.matrix}))}function T(){h(null);for(const[S,v]of[["Include",p.trim()],["Exclude",j.trim()]])if(v)try{new RegExp(v)}catch(R){return h(`${S} regex invalid: ${R instanceof Error?R.message:String(R)}`),!1}return!0}function C(S){if(!T())return;const v={startUrl:l.trim(),maxPages:n,includeRegex:p.trim(),excludeRegex:j.trim()};S&&i?i(v):r(v)}return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--v2-pad-3)",textAlign:"left"},children:[e.jsx(_,{label:"Start URL",children:e.jsx("input",{type:"url",value:l,onChange:S=>o(S.target.value),placeholder:"https://yoursite.com",disabled:a,className:"v2-mono",style:V})}),e.jsx(_,{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:S=>c(Math.min(200,Math.max(1,parseInt(S.target.value,10)||25))),disabled:a,className:"v2-mono",style:{...V,maxWidth:100}})}),e.jsx(_,{label:"Audit depth",hint:"State matrix preset applied to every crawled page.",children:e.jsx("select",{value:x,onChange:S=>I(S.target.value),disabled:a,style:V,children:w.map(S=>e.jsx("option",{value:S.id,children:S.name},S.id))})}),e.jsx("button",{type:"button",onClick:()=>f(S=>!S),className:"v2-eyebrow",style:{background:"none",border:"none",padding:0,cursor:"pointer",color:"var(--v2-ink-secondary)",textAlign:"left",alignSelf:"flex-start"},children:m?"− hide advanced filters":"+ show URL filters (include / exclude)"}),m&&e.jsxs(e.Fragment,{children:[e.jsx(_,{label:"Include only URLs matching",hint:"Optional regex. Empty = no filter.",children:e.jsx("input",{type:"text",value:p,onChange:S=>g(S.target.value),placeholder:"^https://example\\.com/products/",disabled:a,className:"v2-mono",style:V})}),e.jsx(_,{label:"Exclude URLs matching",hint:"Optional regex. Useful for /admin or /login while logged in.",children:e.jsx("input",{type:"text",value:j,onChange:S=>b(S.target.value),placeholder:"/admin|/dashboard|/login",disabled:a,className:"v2-mono",style:V})})]}),E&&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:E}),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:()=>C(!1),children:a?"Crawling…":"Crawl whole site"}),i&&e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost",disabled:a||!l.trim(),onClick:()=>C(!0),title:"Skip walkthroughs that previously passed or were human-verified",children:"Verify fixes only"}),s&&e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost",disabled:a,onClick:s,title:"Single-page audit on the active tab (no crawl)",children:"Just this page"})]})]})}function Xe(){var c;const t=k(p=>p.siteCrawlProgress),a=k(p=>p.siteCrawlStatus),r=k(p=>p.progress),i=k(p=>p.aiProgress);function s(){F({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,o=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:`${o}%`,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:s,children:"Cancel crawl"})})]})}function Je(){const t=k(c=>c.status),a=k(c=>c.progress),r=k(c=>c.aiProgress);if(t!=="running")return null;const i=a?a.current>=a.total:!1,s=a?i?"Running deep analyzers…":`Auditing… ${a.current} / ${a.total}`:"Starting audit…",l=a?i?"reading order · tab order · typography · CSS vars · AI candidates":et(a.currentState):"Loading axe + DOM analyzers",o=a?i?100:a.current/Math.max(1,a.total)*100:0;function n(){F({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(le,{label:s,detail:l,pct:o,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(le,{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 le({label:t,detail:a,pct:r,valuenow:i,valuemax:s,ariaLabel:l,fillColor:o}){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":s,"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:o,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 et(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 _({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 V={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 Z(){const t=k(c=>c.siteCrawlReport),a=k(c=>c.results),r=k(c=>c.delta),i=k(c=>c.componentId),s=k(c=>c.status),l=k(c=>c.siteCrawlStatus),[o,n]=u.useState({report:null,resolvedFails:[]});return u.useEffect(()=>{var j;let c=!1;async function p(b){return b.length===0?[]:(await Promise.all(b.map(f=>ve(f)))).flat().map(We).map(Le).filter(f=>f.verdict==="fail")}if(l==="running"||s==="running"){n({report:null,resolvedFails:[]});return}if(t)return(async()=>{const b=t.pages.map(f=>f.url),m=await p(b);c||n({report:t,resolvedFails:m})})(),()=>{c=!0};if(a.length===0||!i){n({report:null,resolvedFails:[]});return}const g=(j=a[0])==null?void 0:j.pageUrl;if(!g){n({report:null,resolvedFails:[]});return}return(async()=>{try{const[b,m]=await Promise.all([Pe(a),p([g])]),f=new Date().toISOString(),w=$e(g,[{url:g,results:a,delta:r,componentId:i,durationMs:0}],f,f,0,b.walkthroughsByComponent,b.walkthroughAcksByComponent,b.ackedKeysByComponent,b.humanVerdictsByComponent);c||n({report:w,resolvedFails:m})}catch(b){console.warn("[v2] synthesize single-page report failed",b),c||n({report:null,resolvedFails:[]})}})(),()=>{c=!0}},[t,a,r,i,s,l]),o}const tt={"1.2.1":{howToCheck:"Confirm any audio-only or video-only media has a text alternative (transcript, captions, descriptive title). If the page has no audio or video at all, mark N/A with that note."},"1.2.2":{howToCheck:"For every prerecorded video with audio, verify captions are present and synchronized. Open each video, turn captions on, and spot-check 10–15 seconds. If the page has no video with audio, mark N/A."},"1.2.3":{howToCheck:"For every prerecorded video, confirm an audio description track OR a full text alternative is available. If no prerecorded video, mark N/A."},"1.2.4":{howToCheck:"For any live streaming media with audio, verify live captions are provided. If the page has no live media, mark N/A."},"1.2.5":{howToCheck:"For prerecorded video, confirm an audio description track is provided (separate from the main audio). If no prerecorded video, mark N/A."},"1.3.1":{howToCheck:"Inspect headings, lists, tables, and form labels. Programmatic structure should match visual structure: h1→h2→h3, real <ul>/<ol>, real <table> with <th>, every form field has a <label> or aria-label. Tabbing through the page should reveal the same structure a screen reader would announce."},"1.4.3":{howToCheck:"Open the inconclusive elements. Most commonly axe failed because the background is transparent, a gradient, or an image. Identify the EFFECTIVE background color a user sees and compute the contrast ratio against the foreground; needs ≥4.5:1 for normal text, ≥3:1 for large text (18pt+ or 14pt+ bold)."},"1.4.4":{howToCheck:"Zoom the page to 200% (Ctrl+Plus four times in most browsers). Verify all content remains visible and functional — no overlapping text, no clipped buttons, no horizontal scrollbar at 1280×1024 viewport."},"1.4.10":{howToCheck:"Resize the browser to 320 CSS px wide (or use devtools mobile emulation at 320×256). Confirm content reflows without two-dimensional scrolling — vertical scroll only, no horizontal scroll except for genuinely two-dimensional content (data tables, images, complex maps)."},"1.4.11":{howToCheck:"Verify every UI component's boundary (button borders, form field outlines, focus indicators) has ≥3:1 contrast against its adjacent color. Same for meaningful graphics (icons, infographic elements). Decorative graphics are exempt."},"1.4.12":{howToCheck:"Apply this CSS via devtools and confirm no content is clipped or hidden: line-height: 1.5; letter-spacing: 0.12em; word-spacing: 0.16em; paragraph spacing 2× font-size. If layout breaks, the page fails."},"2.1.1":{howToCheck:"Tab through every interactive element. Every button, link, form field, and custom control must be reachable AND operable via keyboard alone (Enter, Space, arrow keys as appropriate). Mouse-only affordances fail."},"2.1.2":{howToCheck:"Tab into every interactive component. Confirm Tab/Shift+Tab moves focus out. No element should trap focus (typical offenders: poorly-coded modals, embedded players)."},"2.4.1":{howToCheck:"Verify a skip-to-main-content link exists (typically first focusable element, visible on focus) OR landmark regions (<main>, <nav>) are present. Either lets keyboard users bypass repeated nav."},"2.4.3":{howToCheck:"Tab through the page in source order. Focus must move in a sequence that preserves meaning — usually left-to-right, top-to-bottom. Particularly check skip links and modals."},"2.4.4":{howToCheck:`Read each link's text WITH its surrounding context (parent paragraph, list item, table cell). The combined text must convey where the link goes. "Click here" alone is ambiguous; "Click here to read our pricing" passes when context is included.`},"2.4.5":{howToCheck:"Confirm at least two ways to find a given page exist: site search, sitemap, A-Z index, table of contents, or persistent navigation. Single-page sites and process-step pages (checkout) are exempt."},"2.4.6":{howToCheck:"Read each heading and form-field label in isolation. Each should describe the topic of its section or the purpose of its field WITHOUT requiring the surrounding content to make sense."},"2.4.7":{howToCheck:"Tab through every focusable element. The current focus must be VISUALLY distinct from neighbors — an outline, a box-shadow, a background change. The default browser outline counts; CSS that removes it without replacing fails."},"2.5.3":{howToCheck:"For every control with both a visible text label and an accessible name (aria-label, alt, etc.), verify the visible label appears (verbatim, or as a substring) in the accessible name. Otherwise voice-control users can't target it by saying its visible label."},"3.1.1":{howToCheck:'View source. Confirm <html lang="..."> is present with a valid language tag (e.g. "en", "en-US", "fr").'},"3.1.2":{howToCheck:"Find any passage of foreign-language text on the page (a quote, a borrowed phrase, an entire alternate-language section). Confirm it's wrapped with the appropriate lang attribute. If the entire page is in one language, mark N/A."},"3.2.1":{howToCheck:"Tab to each focusable element. Confirm receiving focus alone does NOT trigger a context change: no navigation, no modal opening, no form submission. Action only on explicit activation (click, Enter)."},"3.2.2":{howToCheck:"In each form, change one input value (type in a field, check a checkbox, change a select). Confirm this does NOT submit the form, navigate the page, or open a modal without first warning the user."},"3.2.3":{howToCheck:"Open at least three different pages on the site. Confirm the main navigation, footer navigation, and any breadcrumb appear in the SAME relative order on each. Reordering items between pages is a fail; adding or removing items based on auth state is acceptable."},"3.2.4":{howToCheck:"Identify a few common functional elements on the site (e.g., the search input, login button, cart button, social-share icons). Verify each appears with the SAME accessible name, label, and icon on every page where it appears. Inconsistent naming is the fail mode."},"3.3.1":{howToCheck:"Submit a form with invalid data. Confirm errors are identified in text (not just color), describe what went wrong, and ideally indicate which field. Browser-default validation messages count."},"3.3.2":{howToCheck:"Every form input should have a visible label (or visible placeholder + accessible name combination) AND an instruction when format matters (date format, password rules). Placeholder-only labels fail because they disappear on focus."},"3.3.3":{howToCheck:'Submit a form with invalid data. Confirm the error message describes HOW to fix the problem (e.g., "Email must contain @" not just "Invalid email"). Exempts cases where suggestion would compromise security (password rules).'},"3.3.4":{howToCheck:"For any form that submits a legal commitment, financial transaction, or modifies/deletes user data: confirm submissions are reversible, validated for errors before commit, OR show a confirmation step before final commit."},"4.1.3":{howToCheck:'Trigger any status update (form submitted, item added to cart, search completed, error appeared). Confirm screen-reader users receive the update via an aria-live region or role="status"/"alert" — without moving focus to the update.'}};function rt(t){return tt[t]??null}function fe(t){var a;return t.storeComponentId?t.storeComponentId:(a=t.storeCrawlReport)!=null&&a.startUrl?t.storeCrawlReport.startUrl:t.pageUrls[0]?t.pageUrls[0]:null}const ce="aiConfig";function at(t){return`https://www.w3.org/WAI/WCAG22/Understanding/${t}`}const nt=new Map(Oe.map(t=>[t.id,t]));async function it(t){const r=(await chrome.tabs.query({active:!0,currentWindow:!0}))[0];if(!(r!=null&&r.id))return{ok:!1,error:"No active tab."};const i=r.id,s=Y(t.pageUrl),l=Y(r.url??"");if(!(r.url===t.pageUrl)){try{await chrome.tabs.update(i,{url:t.pageUrl})}catch(g){return{ok:!1,error:g instanceof Error?g.message:"Failed to navigate tab."}}if(!await ot(i,t.pageUrl,12e3))return{ok:!1,error:"Page did not finish loading in time."}}if(!t.selector)return{ok:!0,found:!1,matchCount:0};const n=[120,250,500,800,1200,800];let c="";for(let p=0;p<=n.length;p++)try{const g=await Ye(i,{type:"HIGHLIGHT_SHOW_REQUEST",tabId:i,selector:t.selector,scrollIntoView:!0});return{ok:!0,found:g.found,matchCount:g.matchCount}}catch(g){const j=g instanceof Error?g.message:String(g);if(c=j,!(j.includes("Could not establish connection")||j.includes("Receiving end does not exist")))break;const m=n[p];if(m===void 0)break;await new Promise(f=>setTimeout(f,m))}return{ok:!1,error:s!==l?`Navigated to ${t.pageUrl} — but the in-page highlighter couldn't attach (${c}).`:c}}function Y(t){try{return new URL(t).origin}catch{return""}}function ot(t,a,r){return new Promise(i=>{let s=!1;const l=setTimeout(()=>{s||(s=!0,chrome.tabs.onUpdated.removeListener(o),i(!1))},r);function o(n,c,p){if(n!==t||c.status!=="complete")return;const g=Y(p.url??""),j=Y(a);j&&g&&g!==j||s||(s=!0,clearTimeout(l),chrome.tabs.onUpdated.removeListener(o),i(!0))}chrome.tabs.onUpdated.addListener(o)})}function de(t){try{const a=new URL(t),r=a.pathname+a.search+a.hash||"/";return r.length>60?r.slice(0,57)+"...":r}catch{return t}}function st(t){return t.length>70?t.slice(0,67)+"...":t}function lt(t){try{const a=new Date(t),r=new Date,i=a.toDateString()===r.toDateString(),s=new Date(r);s.setDate(s.getDate()-1);const l=a.toDateString()===s.toDateString(),o=a.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"});return i?`today, ${o}`:l?`yesterday, ${o}`:`${a.toLocaleDateString(void 0,{month:"short",day:"numeric"})}, ${o}`}catch{return t}}function ct(){const{report:t}=Z(),a=k(d=>d.componentId),r=k(d=>d.siteCrawlReport),[i,s]=u.useState(!1),[l,o]=u.useState(new Set),[n,c]=u.useState(0),p=u.useRef(""),[g,j]=u.useState(!1),[b,m]=u.useState("claude-sonnet-4-6");u.useEffect(()=>{(async()=>{const x=(await chrome.storage.local.get(ce))[ce];p.current=(x==null?void 0:x.apiKey)??"",j(!!(x!=null&&x.apiKey)),x!=null&&x.model&&m(x.model)})()},[]);const f=fe({storeComponentId:a,storeCrawlReport:r,pageUrls:(t==null?void 0:t.pages.map(d=>d.url))??[]});if(u.useEffect(()=>{let d=!1;return(async()=>{if(!f){d||o(new Set);return}try{const x=await he([f]);if(d)return;o(new Set(x.map(y=>y.criterionId)))}catch{d||o(new Set)}})(),()=>{d=!0}},[f,n]),!t)return null;const w=t.blockingCriteria;return!w||w.length===0||t.siteGrade!=="A"&&t.siteGrade!=="B"?null:e.jsxs("div",{style:{marginTop:"var(--v2-pad-3)",padding:"var(--v2-pad-3) var(--v2-pad-4)",border:"1px solid var(--v2-border)",borderRadius:4,background:"var(--v2-bg-elev)"},children:[e.jsxs("button",{type:"button",onClick:()=>s(d=>!d),"aria-expanded":i,style:{appearance:"none",background:"none",border:"none",padding:0,cursor:"pointer",color:"var(--v2-ink-primary)",fontSize:13,fontWeight:500,textAlign:"left",display:"flex",alignItems:"center",justifyContent:"space-between",gap:"var(--v2-pad-3)",width:"100%"},children:[e.jsx("span",{children:(()=>{const d=w.length,x=w.filter(E=>l.has(E.criterionId)).length,y=d-x;return x===0?`${d} criteri${d===1?"on":"a"} need${d===1?"s":""} your judgment`:y===0?`${d} criteri${d===1?"on":"a"} verified — re-crawl to lift the grade`:`${x} of ${d} verified · ${y} remaining`})()}),e.jsx("span",{"aria-hidden":"true",style:{fontSize:11,color:"var(--v2-ink-tertiary)"},children:i?"▾":"▸"})]}),i&&e.jsxs("div",{style:{marginTop:"var(--v2-pad-3)",display:"flex",flexDirection:"column",gap:"var(--v2-pad-2)"},children:[e.jsx("p",{style:{margin:0,fontSize:11,color:"var(--v2-ink-tertiary)",lineHeight:1.5},children:"Each criterion below has no affirmative evidence yet. Mark it Pass / N/A / Fail with a note about what you checked. Verdicts persist as forensic evidence and contribute to the audit's chain of custody."}),w.map(d=>e.jsx(dt,{criterionId:d.criterionId,title:d.title,state:d.state,evidence:d.evidence,targetComponentId:f,apiKeyRef:p,apiKeyPresent:g,model:b,onVerdictChange:()=>c(x=>x+1)},d.criterionId))]})]})}function dt({criterionId:t,title:a,state:r,evidence:i,targetComponentId:s,apiKeyRef:l,apiKeyPresent:o,model:n,onVerdictChange:c}){const[p,g]=u.useState(null),[j,b]=u.useState(""),[m,f]=u.useState(!1),[w,d]=u.useState(null),[x,y]=u.useState(null),[E,h]=u.useState(!0),[I,T]=u.useState(!1),[C,S]=u.useState(null),[v,R]=u.useState(null),[N,$]=u.useState(null),X={untested:"No evidence — automation has no rule for this criterion",inconclusive:"Inconclusive — axe / AI ran but couldn't determine",failing:"Failing — at least one fail signal across the audit"};u.useEffect(()=>{let A=!1;return(async()=>{if(!s){A||h(!1);return}try{const P=(await he([s])).find(B=>B.criterionId===t);if(A)return;y(P?{verdict:P.verdict,note:P.note,verifiedAt:P.verifiedAt}:null)}catch{A||y(null)}finally{A||h(!1)}})(),()=>{A=!0}},[t,s]);async function W(){if(s){f(!0),d(null);try{await He(s,t),y(null),c()}catch(A){d(A instanceof Error?A.message:String(A))}finally{f(!1)}}}const L=nt.get(t),ae=L==null?void 0:L.shortDescription,ne=L==null?void 0:L.understandingSlug,ie=rt(t);async function ke(){if(!l.current){R("Set an Anthropic API key in extension Options first.");return}T(!0),R(null);try{const z=`Explain WCAG ${t} (${a}) in the context of this audit. State: ${r==="untested"?"no automated evidence (no axe rule covers it)":r==="inconclusive"?"inconclusive — axe or AI ran but could not produce a definitive pass/fail":"failing — at least one fail signal across the audit"}. Cover: (1) what the criterion actually requires in plain language, (2) common failure modes a developer should look for, (3) how to manually verify it on this site, (4) when to mark N/A vs Pass vs Fail. Keep it tight — 5–8 sentences total.`,P=await Ce({apiKey:l.current,model:n,messages:[{role:"user",content:z}],system:`You are wcagcheckr's WCAG explainer. The user is sitting in front of a forensic-grade audit tool and needs to record a manual verdict on a criterion the automation can't decide. Be precise. No marketing tone. When citing a verification step, name the exact device/browser/devtool action (e.g., "Resize Chrome devtools to 320 CSS px").`,maxTokens:600,maxCostUsd:.05});S(P.text),$(P.costUsd)}catch(A){R(A instanceof Error?A.message:String(A))}finally{T(!1)}}async function we(A){if(!s){d("No componentId available — re-run an audit first.");return}if(!j.trim()){d("Note is required — describe what you checked and why this verdict applies.");return}f(!0),d(null);const z=new Date().toISOString(),P=j.trim();try{await Be({componentId:s,criterionId:t,verdict:A,note:P,verifiedAt:z}),y({verdict:A,note:P,verifiedAt:z}),g(null),b(""),c()}catch(B){d(B instanceof Error?B.message:String(B))}finally{f(!1)}}if(x){const z={pass:{bg:"rgba(15, 143, 94, 0.08)",border:"var(--v2-verified)",ink:"var(--v2-verified)",label:"Pass"},na:{bg:"rgba(100, 116, 139, 0.10)",border:"var(--v2-border-strong)",ink:"var(--v2-ink-secondary)",label:"N/A"},fail:{bg:"rgba(207, 44, 44, 0.06)",border:"var(--v2-critical)",ink:"var(--v2-critical)",label:"Fail"}}[x.verdict];return e.jsxs("div",{role:"status",style:{padding:"var(--v2-pad-3) var(--v2-pad-4)",background:z.bg,border:`1px solid ${z.border}`,borderRadius:4},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"var(--v2-pad-3)",flexWrap:"wrap"},children:[e.jsxs("span",{className:"v2-mono",style:{fontSize:11,fontWeight:600,color:"var(--v2-ink-tertiary)"},children:["WCAG ",t]}),e.jsx("span",{style:{fontSize:13,fontWeight:500,color:"var(--v2-ink-primary)"},children:a}),e.jsxs("span",{className:"v2-mono",style:{fontSize:10,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.04em",padding:"2px 6px",borderRadius:3,color:"var(--v2-bg)",background:z.ink},children:["✓ ",z.label]})]}),e.jsx("p",{style:{margin:"6px 0 0",fontSize:12,color:"var(--v2-ink-primary)",lineHeight:1.5,whiteSpace:"pre-wrap"},children:x.note}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--v2-pad-3)",marginTop:"var(--v2-pad-2)",flexWrap:"wrap"},children:[e.jsxs("span",{className:"v2-mono",style:{fontSize:10,color:"var(--v2-ink-tertiary)"},children:["verified ",lt(x.verifiedAt)]}),e.jsx("button",{type:"button",onClick:W,disabled:m,style:{appearance:"none",background:"none",border:"none",padding:0,cursor:m?"wait":"pointer",fontSize:11,color:"var(--v2-ink-secondary)",textDecoration:"underline",textUnderlineOffset:2},children:m?"Un-marking…":"Un-mark this criterion"}),w&&e.jsx("span",{role:"alert",style:{fontSize:11,color:"var(--v2-critical)"},children:w})]})]})}return E?e.jsx("div",{"aria-hidden":"true",style:{padding:"var(--v2-pad-3) var(--v2-pad-4)",background:"var(--v2-bg)",border:"1px solid var(--v2-border)",borderRadius:4,minHeight:56}}):e.jsxs("div",{style:{padding:"var(--v2-pad-3) var(--v2-pad-4)",background:"var(--v2-bg)",border:"1px solid var(--v2-border)",borderRadius:4},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"var(--v2-pad-3)",flexWrap:"wrap"},children:[e.jsxs("span",{className:"v2-mono",style:{fontSize:11,fontWeight:600,color:"var(--v2-ink-tertiary)"},children:["WCAG ",t]}),e.jsx("span",{style:{fontSize:13,fontWeight:500,color:"var(--v2-ink-primary)"},children:a})]}),ae&&e.jsx("p",{style:{margin:"4px 0 0",fontSize:12,color:"var(--v2-ink-secondary)",lineHeight:1.5},children:ae}),e.jsx("p",{style:{margin:"6px 0 0",fontSize:11,color:"var(--v2-ink-tertiary)",lineHeight:1.5},children:X[r]}),ie&&e.jsxs("div",{style:{marginTop:"var(--v2-pad-2)"},children:[e.jsx("p",{className:"v2-eyebrow",style:{margin:0,fontSize:10},children:"how to check"}),e.jsx("p",{style:{margin:"2px 0 0",fontSize:12,color:"var(--v2-ink-secondary)",lineHeight:1.5},children:ie.howToCheck})]}),i.length>0&&e.jsxs("div",{style:{marginTop:"var(--v2-pad-3)"},children:[e.jsxs("p",{className:"v2-eyebrow",style:{margin:0,fontSize:10},children:["suspect locations · ",i.length]}),e.jsx("ul",{style:{listStyle:"none",padding:0,margin:"4px 0 0",display:"flex",flexDirection:"column",gap:"var(--v2-pad-2)"},children:i.map((A,z)=>e.jsx(ut,{ev:A},`${A.pageUrl}::${A.selector??""}::${z}`))})]}),e.jsxs("div",{style:{display:"flex",gap:"var(--v2-pad-3)",marginTop:"var(--v2-pad-2)",flexWrap:"wrap",alignItems:"center"},children:[ne&&e.jsx("a",{href:at(ne),target:"_blank",rel:"noreferrer noopener",style:{fontSize:11,color:"var(--v2-ink-secondary)",textDecoration:"underline",textUnderlineOffset:2},children:"Read W3C guidance ↗"}),o&&e.jsx("button",{type:"button",onClick:ke,disabled:I,style:{appearance:"none",background:"none",border:"none",padding:0,cursor:I?"wait":"pointer",fontSize:11,color:"var(--v2-ink-secondary)",textDecoration:"underline",textUnderlineOffset:2},children:I?"Explaining…":C?"Re-explain with AI":"Explain with AI ↗"})]}),(C||v)&&e.jsxs("div",{style:{marginTop:"var(--v2-pad-2)",padding:"var(--v2-pad-2) var(--v2-pad-3)",background:"var(--v2-bg-elev)",border:"1px solid var(--v2-border)",borderRadius:4},children:[C&&e.jsx("p",{style:{margin:0,fontSize:12,color:"var(--v2-ink-primary)",lineHeight:1.55,whiteSpace:"pre-wrap"},children:C}),v&&e.jsx("p",{role:"alert",style:{margin:0,fontSize:11,color:"var(--v2-critical)"},children:v}),N!==null&&e.jsxs("p",{className:"v2-mono",style:{margin:"4px 0 0",fontSize:10,color:"var(--v2-ink-tertiary)"},children:["$",N.toFixed(4)," · ",n]})]}),e.jsxs("div",{style:{display:"flex",gap:"var(--v2-pad-2)",marginTop:"var(--v2-pad-3)",flexWrap:"wrap"},children:[e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:()=>{g(p==="pass"?null:"pass"),d(null)},"aria-expanded":p==="pass",children:p==="pass"?"Cancel":"Mark Pass"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:()=>{g(p==="na"?null:"na"),d(null)},"aria-expanded":p==="na",children:p==="na"?"Cancel":"Mark N/A"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:()=>{g(p==="fail"?null:"fail"),d(null)},"aria-expanded":p==="fail",children:p==="fail"?"Cancel":"Mark Fail"})]}),p&&e.jsxs("div",{style:{marginTop:"var(--v2-pad-3)",display:"flex",flexDirection:"column",gap:"var(--v2-pad-2)"},children:[e.jsx("p",{className:"v2-eyebrow",style:{margin:0},children:"verification note · required"}),e.jsx("p",{style:{margin:0,fontSize:11,color:"var(--v2-ink-tertiary)",lineHeight:1.4},children:p==="na"?'Describe why this criterion does not apply to this audit (e.g., "no audio/video content on this page").':p==="pass"?'Describe what you checked to verify pass (e.g., "manually browsed page in keyboard-only mode, no focus traps").':'Describe the failure (e.g., "modal does not return focus to the trigger when closed").'}),e.jsx("textarea",{value:j,onChange:A=>b(A.target.value),rows:3,style:{width:"100%",fontFamily:"var(--v2-body)",fontSize:12,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:56},placeholder:p==="na"?"e.g., No audio or video content present on this page; criterion is not applicable.":p==="pass"?"e.g., Manually verified — page resizes correctly at 200% zoom without horizontal scroll.":"e.g., Focus visible indicator missing on dark-mode buttons."}),w&&e.jsx("p",{role:"alert",style:{margin:0,padding:"var(--v2-pad-2) var(--v2-pad-3)",background:"rgba(207, 44, 44, 0.06)",border:"1px solid var(--v2-critical)",borderRadius:4,color:"var(--v2-critical)",fontSize:11},children:w}),e.jsx("div",{children:e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary v2-btn-sm",onClick:()=>we(p),disabled:m||!j.trim(),children:m?"Saving…":`Confirm ${p.toUpperCase()}`})})]})]})}function ut({ev:t}){const[a,r]=u.useState(!1),[i,s]=u.useState(null);async function l(){r(!0),s(null);try{const o=await it({pageUrl:t.pageUrl,selector:t.selector});o.ok?t.selector?o.found?s({kind:"ok",text:`Element highlighted (${o.matchCount} match${o.matchCount===1?"":"es"}).`}):s({kind:"warn",text:"Page opened but the selector matched zero elements — DOM may have changed since the audit."}):s({kind:"ok",text:`Opened ${de(t.pageUrl)} — no element selector available; verify manually.`}):s({kind:"err",text:o.error})}finally{r(!1)}}return e.jsxs("li",{style:{padding:"var(--v2-pad-2) var(--v2-pad-3)",background:"var(--v2-bg)",border:"1px solid var(--v2-border)",borderRadius:4,display:"flex",flexDirection:"column",gap:4},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:"var(--v2-pad-2)",flexWrap:"wrap"},children:[e.jsx("span",{className:"v2-mono",title:t.pageUrl,style:{fontSize:11,color:"var(--v2-ink-secondary)",overflowWrap:"anywhere"},children:de(t.pageUrl)}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:l,disabled:a,children:a?"Opening…":t.selector?"Show on page":"Open page"})]}),t.selector&&e.jsx("span",{className:"v2-mono",title:t.selector,style:{fontSize:11,color:"var(--v2-ink-tertiary)",overflowWrap:"anywhere"},children:st(t.selector)}),t.notes&&e.jsx("span",{style:{fontSize:11,color:"var(--v2-ink-tertiary)",lineHeight:1.4},children:t.notes}),i&&e.jsx("span",{role:i.kind==="err"?"alert":"status",style:{fontSize:11,color:i.kind==="err"?"var(--v2-critical)":i.kind==="warn"?"var(--v2-needs-review)":"var(--v2-verified)"},children:i.text})]})}function pt(){const{report:t,resolvedFails:a}=Z(),r=k(v=>v.siteCrawlReport),i=k(v=>v.siteCrawlStatus),s=k(v=>v.siteCrawlError),l=k(v=>v.status),o=i==="running",c=o||l==="running"&&!o,p=!!t&&!r,[g,j]=u.useState(null);u.useEffect(()=>{let v=!1;return chrome.tabs.query({active:!0,currentWindow:!0}).then(R=>{var N;v||j(((N=R[0])==null?void 0:N.url)??null)}),()=>{v=!0}},[]);const[b,m]=u.useState(!1);function f(v,R=!1){v.startUrl&&(k.getState().setSiteCrawlStatus("running"),k.getState().setSiteCrawlReport(null),k.getState().setSiteCrawlError(null),oe({type:"START_SITE_CRAWL",startUrl:v.startUrl,maxPages:v.maxPages,...v.includeRegex?{includeRegex:v.includeRegex}:{},...v.excludeRegex?{excludeRegex:v.excludeRegex}:{},...R?{verifyFixesOnly:!0}:{}}))}function w(){oe({type:"START_AUDIT",mode:"full-page"}),k.getState().startNewScan()}const[d,x]=u.useState(!1),[y,E]=u.useState(null);async function h(){x(!0),E(null);try{const v=await F({type:"REGRADE_SITE_CRAWL"});if(!((v==null?void 0:v.ok)===!0)){const N=(v==null?void 0:v.reason)??"Regrade failed.";E(N)}}catch(v){E(v instanceof Error?v.message:String(v))}finally{x(!1)}}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:o?e.jsx(Xe,{}):e.jsx(Je,{})});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."}),s&&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:"}),s]}),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(se,{initialUrl:g??"",isRunning:c,onCrawl:v=>f(v,!1),onAuditThisPage:w})]});const I=a.length,T=(t.totalWalkthroughFindings??0)+t.totalUniqueViolations+I,C=(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(ht,{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:(()=>{var N;const v=T+S,R=((N=t.blockingCriteria)==null?void 0:N.length)??0;return v===0&&R===0?"All clear — nothing open.":v===0&&R>0?`Visible findings clear — ${R} criteri${R===1?"on":"a"} still need${R===1?"s":""} your judgment.`:`${v} finding${v===1?"":"s"} to address.`})()}),e.jsx(gt,{openCount:T,reviewCount:S,verifiedCount:C,axeCount:t.totalUniqueViolations,walkthroughCount:t.totalWalkthroughFindings??0,autoCount:I}),g&&!vt(g,t.startUrl)&&e.jsxs("p",{className:"v2-mono",style:{margin:0,fontSize:11,color:"var(--v2-ink-tertiary)",wordBreak:"break-all"},children:["Active tab: ",g]}),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:w,title:"Re-audit the current page",children:"Re-audit this page"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost",onClick:()=>m(v=>!v),"aria-expanded":b,title:"Open crawl setup to audit the whole site instead",children:b?"Hide crawl options":"Crawl whole site"})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary",onClick:h,disabled:d,title:"Re-aggregate this audit against your latest verdicts + acks. No re-crawl. Use this after marking criteria in the Coverage gaps panel.",children:d?"Regrading…":"Regrade"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost",onClick:()=>f({startUrl:t.startUrl,maxPages:25,includeRegex:"",excludeRegex:""},!1),title:`Re-crawl ${t.startUrl} (same options) — full audit re-run, use when page code changed`,children:"Re-crawl"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost",onClick:w,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:()=>f({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:()=>m(v=>!v),"aria-expanded":b,children:b?"Hide options":"Adjust options"})]}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:()=>{Re(),k.getState().setSiteCrawlReport(null),k.getState().setSiteCrawlError(null),_e(null).catch(()=>{})},title:"Wipe these results so you can start fresh",style:{marginLeft:"auto"},children:"Clear results"})]}),y&&e.jsx("p",{role:"alert",style:{margin:"var(--v2-pad-2) 0 0",fontSize:11,color:"var(--v2-critical)"},children:y})]})]}),e.jsx(ct,{}),b&&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(se,{initialUrl:t.startUrl,isRunning:c,onCrawl:v=>f(v,!1),onVerifyFixes:v=>f(v,!0),onAuditThisPage:w})})]})}function vt(t,a){try{return new URL(t).origin===new URL(a).origin}catch{return!1}}function ht({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 gt({openCount:t,reviewCount:a,verifiedCount:r,axeCount:i,walkthroughCount:s,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(O,{term:"open",value:t,tone:t>0?"attention":"neutral"}),e.jsx(O,{term:"review",value:a,tone:a>0?"review":"neutral"}),e.jsx(O,{term:"verified",value:r,tone:r>0?"positive":"neutral"}),e.jsx("span",{style:{color:"var(--v2-ink-faint)"},children:"·"}),e.jsx(O,{term:"axe",value:i,tone:"neutral"}),e.jsx(O,{term:"walkthrough",value:s,tone:"neutral"}),l>0&&e.jsx(O,{term:"auto-contrast",value:l,tone:"neutral"})]})}function O({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 mt=new Set(["2.4.3","2.1.2","2.4.7","1.3.2","1.4.11","2.5.3"]);function ue(t){return mt.has(t)}async function pe(t){var i,s;const a=k.getState();if(a.componentId&&((i=a.results[0])==null?void 0:i.pageUrl)===t)return a.componentId;const r=await ge();return((s=r==null?void 0:r.find(l=>l.url===t))==null?void 0:s.componentId)??null}async function ft(t,a){var l;const r=k.getState(),i=[];if(r.componentId&&r.results.length>0){const o=(l=r.results[0])==null?void 0:l.pageUrl,n=a.find(c=>c.url===o);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 s=await ge()??[];for(const o of a){const n=s.find(c=>c.url===o.url);if(n)for(const c of n.results)for(const p of c.violations)p.ruleId===t&&p.target.selector===o.selector&&i.push({componentId:n.componentId,matchKey:p.matchKey})}return i}function yt({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(bt,{row:t}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx(xt,{row:t}),e.jsx(kt,{row:t})]}),e.jsx(wt,{})]}),e.jsx("div",{style:{padding:"0 var(--v2-pad-4) var(--v2-pad-4)",borderTop:"1px solid var(--v2-border)"},children:e.jsx(jt,{row:t})})]})}function bt({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 xt({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 kt({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 wt(){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 jt({row:t}){return t.kind==="walkthrough-fail"?e.jsx(Ct,{row:t}):t.kind==="walkthrough-ack"?e.jsx(Rt,{row:t}):t.kind==="needs-review"?e.jsx(Tt,{row:t}):t.kind==="auto-contrast"?e.jsx(St,{row:t}):e.jsx(It,{row:t})}function St({row:t}){const[a,r]=u.useState(!1),[i,s]=u.useState(!1),[l,o]=u.useState(""),[n,c]=u.useState(!1),[p,g]=u.useState(!1),[j,b]=u.useState(null),m=me(t.ruleId);async function f(){if(c(!0),b(null),!l.trim()){b("Note is required — explain why the empirical contrast measurement is wrong, or why this element is acceptable in context."),c(!1);return}try{const d=(await ve(t.pageUrl)).find(y=>y.ruleId===t.ruleId&&y.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:d==null?void 0:d.inputHash};await Me(x),g(!0),r(!1)}catch(w){b(w instanceof Error?w.message:String(w))}finally{c(!1)}}return e.jsxs("div",{style:{paddingTop:"var(--v2-pad-3)"},children:[e.jsx(M,{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(te,{}):e.jsxs(e.Fragment,{children:[e.jsxs(re,{children:[m&&e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:()=>s(w=>!w),"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(w=>!w),"aria-expanded":a,children:a?"Cancel":"Mark verified manually"})]}),i&&m&&e.jsx(be,{summary:m.summary,snippet:m.snippet}),a&&e.jsx(ee,{note:l,setNote:o,busy:n,err:j,onConfirm:f,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&&!a&&e.jsx(Q,{message:j})]})]})}function Ct({row:t}){const[a,r]=u.useState(!1),[i,s]=u.useState(""),[l,o]=u.useState(!1),[n,c]=u.useState(!1),[p,g]=u.useState(!1),[j,b]=u.useState(null),[m,f]=u.useState(null),w=ue(t.criterion);async function d(){if(o(!0),f(null),!i.trim()){f("Note is required — explain how you manually verified this."),o(!1);return}try{const y=await pe(t.pageUrl);if(!y){f("Could not find this page in the audit data. Re-run the audit and try again.");return}await Ve({componentId:y,criterionId:t.criterion,pageUrl:t.pageUrl,note:i.trim(),acknowledgedAt:new Date().toISOString(),verdictAtAck:t.verdict}),c(!0),r(!1)}catch(y){f(y instanceof Error?y.message:String(y))}finally{o(!1)}}async function x(){var y;g(!0),b(null),f(null);try{const h=(y=(await chrome.tabs.query({active:!0,currentWindow:!0}))[0])==null?void 0:y.id;if(!h){f("Open the audited page in your active tab to re-run.");return}const I=await pe(t.pageUrl);if(!I){f("Could not find this page in the audit data.");return}if(!ue(t.criterion)){f(`Re-run is only available for interactive criteria. ${t.criterion} is not supported.`);return}const C=await F({type:"INTERACTIVE_AUDIT_REQUEST",criterionId:t.criterion,tabId:h,componentId:I,pageUrl:t.pageUrl});if(!C.ok){f(C.error??"Re-run failed.");return}b(`Re-run verdict: ${C.verdict??"unknown"}. Re-audit the page to refresh this list.`)}catch(E){f(E instanceof Error?E.message:String(E))}finally{g(!1)}}return e.jsxs("div",{style:{paddingTop:"var(--v2-pad-3)"},children:[e.jsx(M,{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(te,{}):e.jsxs(e.Fragment,{children:[e.jsxs(re,{children:[w&&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(y=>!y),"aria-expanded":a,children:a?"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}),a&&e.jsx(ee,{note:i,setNote:s,busy:l,err:m,onConfirm:d,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."}),m&&!a&&e.jsx(Q,{message:m})]})]})}function Rt({row:t}){return e.jsxs("div",{style:{paddingTop:"var(--v2-pad-3)"},children:[e.jsx(M,{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 Tt({row:t}){return e.jsx(ye,{row:t,kind:"needs-review"})}function It({row:t}){return e.jsx(ye,{row:t,kind:"axe"})}function ye({row:t,kind:a}){const[r,i]=u.useState(!1),[s,l]=u.useState(""),[o,n]=u.useState(!1),[c,p]=u.useState(!1),[g,j]=u.useState(!1),[b,m]=u.useState(null),f=me(t.ruleId);async function w(){if(n(!0),m(null),!s.trim()){m(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 d=await ft(t.ruleId,t.pages);if(d.length===0){m("Could not find this finding in the persisted audit data. Re-run the audit and try again.");return}for(const x of d)await Ge({componentId:x.componentId,matchKey:x.matchKey,ruleId:t.ruleId,note:s.trim()});p(!0),i(!1)}catch(d){m(d instanceof Error?d.message:String(d))}finally{n(!1)}}return e.jsxs("div",{style:{paddingTop:"var(--v2-pad-3)"},children:[a==="needs-review"&&t.failureSummary&&e.jsx(M,{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(M,{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(d=>e.jsx("li",{children:e.jsx("a",{href:d.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:d.url})},d.url)),t.pages.length>8&&e.jsxs("li",{className:"v2-eyebrow",children:["+ ",t.pages.length-8," more"]})]})}),c?e.jsx(te,{}):e.jsxs(e.Fragment,{children:[e.jsxs(re,{children:[a==="axe"&&f&&e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:()=>j(d=>!d),"aria-expanded":g,children:g?"Hide fix recipe":"Show fix recipe"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary v2-btn-sm",onClick:()=>i(d=>!d),"aria-expanded":r,children:r?"Cancel":"Mark verified manually"})]}),g&&f&&e.jsx(be,{summary:f.summary,snippet:f.snippet}),r&&e.jsx(ee,{note:s,setNote:l,busy:o,err:b,onConfirm:w,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"}`}),b&&!r&&e.jsx(Q,{message:b})]})]})}function ee({note:t,setNote:a,busy:r,err:i,onConfirm:s,hint:l,placeholder:o,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:o,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(Q,{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:s,disabled:r||!t.trim(),children:r?"Saving…":n})})]})}function be({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 te(){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 Q({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 M({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 re({children:t}){return e.jsx("div",{style:{display:"flex",gap:"var(--v2-pad-2)",flexWrap:"wrap",marginTop:"var(--v2-pad-2)"},children:t})}function At(){const{report:t,resolvedFails:a}=Z(),[r,i]=u.useState("open"),s=u.useMemo(()=>t?Ut(t.pages,t.findingGroups??[],a):[],[t,a]),l=u.useMemo(()=>r==="all"?s:s.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),[s,r]);if(!t)return null;const o={all:s.length,open:s.filter(n=>n.kind==="axe"||n.kind==="walkthrough-fail"||n.kind==="auto-contrast").length,review:s.filter(n=>n.kind==="needs-review").length,verified:s.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(Nt,{filter:r,setFilter:i,counts:o})]}),l.length===0?e.jsx(Et,{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(yt,{row:n})},n.key))})]})}function Nt({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(s=>{const l=t===s.id;return e.jsxs("button",{type:"button",role:"tab","aria-selected":l,onClick:()=>a(s.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:[s.label,e.jsx("span",{className:"v2-mono",style:{fontSize:10,color:"var(--v2-ink-tertiary)",fontVariantNumeric:"tabular-nums"},children:r[s.id]})]},s.id)})})}function Et({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 Ut(t,a,r=[]){const i=[];for(const o of a)o.needsReview?i.push({kind:"needs-review",key:`nr::${o.ruleId}::${o.representativeSelector}`,criterion:o.wcagCriterion,ruleId:o.ruleId,description:o.axeDescription,selector:o.representativeSelector,failureSummary:o.failureSummary,pages:o.pages,group:o}):i.push({kind:"axe",key:`axe::${o.ruleId}::${o.representativeSelector}`,criterion:o.wcagCriterion,ruleId:o.ruleId,impact:o.impact,description:o.axeDescription,selector:o.representativeSelector,pages:o.pages,isShared:o.isShared});const s=new Set;for(const o of t){for(const n of o.walkthroughFindings??[]){const c=`wt-fail::${n.criterionId}::${n.pageUrl}`;s.has(c)||(s.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 o.walkthroughAcknowledgements??[]){const c=`wt-ack::${n.criterionId}::${n.pageUrl}`;s.has(c)||(s.add(c),i.push({kind:"walkthrough-ack",key:c,criterion:n.criterionId,verdict:n.verdict,reasoning:n.reasoning,pageUrl:n.pageUrl}))}}for(const o of r)i.push({kind:"auto-contrast",key:`auto::${o.ruleId}::${o.selector}::${o.pageUrl}`,criterion:o.wcagCriterion??"1.4.3",ruleId:o.ruleId,impact:"serious",selector:o.selector,pageUrl:o.pageUrl,reasoning:o.reasoning});const l={critical:0,serious:1,moderate:2,minor:3,"needs-review":4,ack:5};return i.sort((o,n)=>{const c=o.kind==="walkthrough-ack"?l.ack:o.kind==="needs-review"?l["needs-review"]:l[o.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 zt({open:t,onClose:a}){const{report:r}=Z(),i=k(h=>h.siteCrawlReport),s=k(h=>h.results),l=k(h=>h.componentId),o=k(h=>h.delta),n=!!i,c=n||s.length>0,p=fe({storeComponentId:l,storeCrawlReport:i,pageUrls:(r==null?void 0:r.pages.map(h=>h.url))??[]}),[g,j]=u.useState({}),b=u.useRef(null);u.useEffect(()=>{var I;if(!t)return;const h=T=>{T.key==="Escape"&&a()};return document.addEventListener("keydown",h),(I=b.current)==null||I.focus(),()=>document.removeEventListener("keydown",h)},[t,a]);function m(h,I){j(T=>({...T,[h]:I}))}async function f(){m("ai-prompt",{state:"busy"});try{if(n){const h=await F({type:"EXPORT_REQUEST",format:"ai-prompt-site-crawl",results:[],...r?{siteCrawlReport:r}:{}});if(!(h!=null&&h.content))throw new Error("Empty response");await navigator.clipboard.writeText(h.content),await K(h.content,"ai-fixer-prompt.md","text/markdown"),m("ai-prompt",{state:"done",message:"Copied to clipboard + opened in a new tab."})}else{if(!s.length)throw new Error("No audit results yet");await Qe({results:s,componentId:l??null,delta:o}),m("ai-prompt",{state:"done",message:"Copied to clipboard + opened in a new tab."})}}catch(h){m("ai-prompt",{state:"error",message:h instanceof Error?h.message:String(h)})}}async function w(){m("html",{state:"busy"});try{if(n&&r){const{renderSiteReportHtml:h}=await G(async()=>{const{renderSiteReportHtml:T}=await import("./site-report-renderer-CFmHz6nh.js");return{renderSiteReportHtml:T}},__vite__mapDeps([0,1,2,3,4])),I=h(r);await K(I,"site-report.html","text/html"),m("html",{state:"done",message:"Opened in a new tab — Save as PDF or use Cmd/Ctrl+S."})}else{if(!s.length)throw new Error("No audit results yet");const{toHtmlPrint:h}=await G(async()=>{const{toHtmlPrint:T}=await import("./scheduled-audit-runner-CCxgrfOE.js").then(C=>C.aU);return{toHtmlPrint:T}},__vite__mapDeps([1,2,3,4])),I=h(s,o??void 0);await K(I,"page-report.html","text/html"),m("html",{state:"done",message:"Opened in a new tab — Save as PDF or use Cmd/Ctrl+S."})}}catch(h){m("html",{state:"error",message:h instanceof Error?h.message:String(h)})}}async function d(h,I,T){m(h,{state:"busy"});try{const C=await F({type:"EXPORT_REQUEST",format:h,results:n?[]:s,...o&&!n?{delta:o}:{},...n?{siteCrawlSource:!0}:{},...p?{auditTargetId:p}:{}});if(!(C!=null&&C.content))throw new Error("Empty response");await K(C.content,T,"text/html"),m(h,{state:"done",message:`${I} opened in a new tab.`})}catch(C){m(h,{state:"error",message:C instanceof Error?C.message:String(C)})}}async function x(){m("zip",{state:"busy"});try{const{createZip:h}=await G(async()=>{const{createZip:$}=await import("./zip-encoder-CtULHXx_.js");return{createZip:$}},[]),{renderSiteReportHtml:I}=await G(async()=>{const{renderSiteReportHtml:$}=await import("./site-report-renderer-CFmHz6nh.js");return{renderSiteReportHtml:$}},__vite__mapDeps([0,1,2,3,4])),T=[];if(n&&r)try{T.push({name:"site-report.html",content:I(r)})}catch{}const C=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:$,filename:X}of C)try{const W=await F({type:"EXPORT_REQUEST",format:$,results:n?[]:s,...o&&!n?{delta:o}:{},...n?{siteCrawlSource:!0}:{},...p?{auditTargetId:p}:{}});W!=null&&W.content&&T.push({name:X,content:W.content})}catch{}if(T.length===0)throw new Error("All exports failed");const S=h(T),v=new Blob([S],{type:"application/zip"}),R=URL.createObjectURL(v),N=document.createElement("a");N.href=R,N.download=n?"wcagcheckr-site-bundle.zip":"wcagcheckr-page-bundle.zip",N.click(),setTimeout(()=>URL.revokeObjectURL(R),6e4),m("zip",{state:"done",message:`Downloaded ${T.length} file${T.length===1?"":"s"}.`})}catch(h){m("zip",{state:"error",message:h instanceof Error?h.message:String(h)})}}function y(h){k.getState().setView(h),chrome.storage.local.set({v2UiEnabled:!1}),a()}function E(){F({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:b,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(H,{title:"AI fixer",children:e.jsx(D,{status:g["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:f})}),e.jsxs(H,{title:"Reports",children:[e.jsx(D,{status:g.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:w}),e.jsx(D,{status:g["executive-report"],label:"Executive report",description:"Hero grade + framing, top risks, next steps. For non-technical readers.",onClick:()=>d("executive-report","Executive report","executive-report.html")}),n&&e.jsx(D,{status:g["ticket-bundle"],label:"Ticket bundle",description:"Markdown formatted for paste into Linear / Jira / GitHub Issues — one ticket per finding, sorted by severity.",onClick:()=>d("ticket-bundle","Ticket bundle","ticket-bundle.md")})]}),e.jsxs(H,{title:"Compliance & legal",children:[e.jsx(D,{status:g["defense-bundle"],label:"Defense bundle",description:"Anchored chain-of-custody evidence package. Use in pre-litigation.",onClick:()=>d("defense-bundle","Defense bundle","defense-bundle.html")}),e.jsx(D,{status:g["deposition-packet"],label:"Deposition packet",description:"Full evidence bundle — anchor, receipts, fingerprints, signing cert.",onClick:()=>d("deposition-packet","Deposition packet","deposition-packet.html")}),e.jsx(D,{status:g.vpat,label:"VPAT",description:"Voluntary Product Accessibility Template. Procurement-ready.",onClick:()=>d("vpat","VPAT","vpat.html")}),e.jsx(D,{status:g["conformance-crosswalk"],label:"Conformance crosswalk",description:"WCAG ↔ Section 508 ↔ EN 301 549 mapping.",onClick:()=>d("conformance-crosswalk","Conformance crosswalk","conformance-crosswalk.html")}),e.jsx(D,{status:g["methodology-doc"],label:"Methodology PDF",description:"Auditor-explainable methodology — what was tested, how, with what tools.",onClick:()=>d("methodology-doc","Methodology doc","methodology-doc.html")}),e.jsx(D,{status:g["evidence-bundle"],label:"Evidence bundle",description:"Lighter than defense bundle — audit records + summary.",onClick:()=>d("evidence-bundle","Evidence bundle","evidence-bundle.html")})]}),e.jsx(H,{title:"Bulk",children:e.jsx(D,{status:g.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:x})})]}),e.jsxs(H,{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(U,{label:"State matrix",description:"Per-state findings grid (hover · focus · dark · RTL · etc.)",onClick:()=>y("matrix")}),e.jsx(U,{label:"Per-area compliance",description:"9 sub-grade areas with drill-in: Color & contrast, Keyboard, etc.",onClick:()=>y("report")}),e.jsx(U,{label:"Baseline delta",description:"New vs. persistent vs. fixed vs. acknowledged since the last baseline.",onClick:()=>y("delta")}),e.jsx(U,{label:"Forensic log",description:"Anchored audit history with chain-of-custody.",onClick:()=>y("forensic")}),e.jsx(U,{label:"Risk dashboard",description:"Lawsuit / conformance risk tiers with prioritized actions.",onClick:()=>y("risk")}),e.jsx(U,{label:"WCAG 3 mapping",description:"Outcome-level grouping per WCAG 3 snapshot.",onClick:()=>y("wcag3")}),e.jsx(U,{label:"WCAG-EM verdicts",description:"Formal per-criterion verdict map.",onClick:()=>y("compliance")}),e.jsx(U,{label:"Schedules",description:"Recurring audit management with email alerts.",onClick:()=>y("schedules")}),e.jsx(U,{label:"Copilot chat",description:"Anthropic-powered Q&A over your audit context.",onClick:()=>y("copilot")}),e.jsx(U,{label:"Accessibility tree",description:"Inspect the live aria tree as assistive tech sees it.",onClick:()=>y("ax-tree")}),e.jsx(U,{label:"Design tokens",description:"CSS-token / design-system audit.",onClick:()=>y("tokens")}),e.jsx(U,{label:"Guided audit",description:"13 manual IGT workflows (keyboard, screen reader, etc.).",onClick:()=>y("guided")}),e.jsx(U,{label:"Per-component scorecard",description:"Custom rules, baselines, per-component drill-in.",onClick:()=>y("scorecard")}),e.jsx(U,{label:"User journey flows",description:"Multi-step audit recordings.",onClick:()=>y("flows")}),e.jsx(U,{label:"Activity / IGT runs",description:"Manual workflow run history.",onClick:()=>y("activity")})]}),e.jsx(H,{title:"Settings",children:e.jsx(D,{status:void 0,label:"Open settings",description:"Matrix preset, AI config, axe rule overrides, breakpoints, auto-export.",onClick:E})})]})]})]}):null}async function K(t,a,r){const i=new Blob([t],{type:r}),s=URL.createObjectURL(i);try{await chrome.tabs.create({url:s})}catch{const l=document.createElement("a");l.href=s,l.download=a,l.click()}setTimeout(()=>URL.revokeObjectURL(s),6e4)}function H({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 D({label:t,description:a,status:r,onClick:i}){const s=(r==null?void 0:r.state)==="busy",l=(r==null?void 0:r.state)==="done",o=(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:s,children:s?"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]}),o&&(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 U({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 Dt(){var l,o;const t=k(n=>n.siteCrawlReport),a=k(n=>n.results),[r,i]=u.useState(!1),s=(t==null?void 0:t.startUrl)??((l=a[0])==null?void 0:l.pageUrl)??((o=a[0])==null?void 0:o.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"})]}),s&&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:s,children:s})]}),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(zt,{open:r,onClose:()=>i(!1)})]})}function Ft(){return u.useEffect(()=>{const t=Te(),r=new URLSearchParams(window.location.search).get("context")==="overlay"?null:chrome.runtime.connect({name:"sidepanel-tracker"}),i=Ie();Ae({forceRefresh:!0}).catch(()=>{}),Ne().catch(()=>{}),Ee().catch(()=>{}),Ue().catch(()=>{}),ze().catch(()=>{}),Ke().then(l=>{k.getState().setAcknowledgedKeys(new Set(l.map(o=>o.matchKey)))}).catch(()=>{});let s=!1;return qe().then(l=>{s||l&&k.setState({siteCrawlReport:l})}).catch(()=>{}),()=>{s=!0,i();try{t.disconnect()}catch{}try{r==null||r.disconnect()}catch{}}},[]),e.jsxs("div",{className:"v2-root",children:[e.jsx(Dt,{}),e.jsxs("main",{id:"main-content","aria-label":"wcagcheckr findings",children:[e.jsx(pt,{}),e.jsx(At,{})]})]})}Ze("side-panel");const q="v2UiEnabled";function Pt(){const[t,a]=u.useState(null);return u.useEffect(()=>{let r=!1;chrome.storage.local.get(q).then(s=>{r||a(!!s[q])}).catch(()=>a(!1));const i=(s,l)=>{var o;l==="local"&&q in s&&a(!!((o=s[q])!=null&&o.newValue))};return chrome.storage.onChanged.addListener(i),()=>{r=!0,chrome.storage.onChanged.removeListener(i)}},[]),t===null?null:t?e.jsx(Ft,{}):e.jsx(Fe,{})}const xe=document.getElementById("root");if(!xe)throw new Error("side-panel: #root not found");je(xe).render(e.jsx(Se.StrictMode,{children:e.jsx(De,{children:e.jsx(Pt,{})})}));
|