@wcag-checkr/ci 1.0.0-rc.335 → 1.0.0-rc.336
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-DA-9wVvE.js","assets/scheduled-audit-runner-QcMYcqgA.js","assets/preload-helper-D7HrI6pR.js","assets/crash-reporter-Bu2p8K-p.js","assets/ai-usage-log-D5enikfX.js","assets/diff-DIBMr3fQ.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import"./modulepreload-polyfill-B5Qt9EMX.js";import{r as p,j as e,c as Ce,R as Ae}from"./styles-ea15PiMP.js";import{u as S,c as Re,a as Te,l as le,b as Ie,P as Ee,s as Ne,w as Ue,r as ze,d as De,e as Pe,p as Fe,f as $e,A as We,g as Le,E as Oe,h as He}from"./ErrorBoundary-CIHCpor0.js";import{l as Be,a as Me,g as ge,b as Ve,c as _e,W as Ge,d as me,r as Ke,s as qe,e as Ye,f as fe,h as ye,i as Ze,j as Qe,k as Xe,m as Je,n as et}from"./scheduled-audit-runner-QcMYcqgA.js";import{s as W,r as tt,i as rt}from"./crash-reporter-Bu2p8K-p.js";import{B as ee}from"./ai-usage-log-D5enikfX.js";import{_ as q}from"./preload-helper-D7HrI6pR.js";import{copyAiFixerPrompt as at}from"./copy-ai-fixer-prompt-GhPr32yI.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./design-system-audit-DpxJrxnb.js";import"./diff-DIBMr3fQ.js";function ce({initialUrl:t,isRunning:a,onCrawl:r,onVerifyFixes:o,onAuditThisPage:s}){const[l,n]=p.useState(t),[i,c]=p.useState(25),[v,h]=p.useState(""),[b,x]=p.useState(""),[m,f]=p.useState(!1),[j,d]=p.useState(ee),[w,k]=p.useState(ee[0].id),[R,g]=p.useState(null);p.useEffect(()=>{t&&!l&&n(t)},[t]),p.useEffect(()=>{let u=!1;return Promise.all([W({type:"SETTINGS_GET",key:"matrixPresets"}),W({type:"SETTINGS_GET",key:"activePresetId"})]).then(([y,E])=>{if(u)return;const L=Array.isArray(y.data)?y.data:null;d(L&&L.length>0?L:ee),typeof E.data=="string"&&k(E.data)}),()=>{u=!0}},[]);function A(u){const y=j.find(E=>E.id===u);y&&(k(u),W({type:"SETTINGS_SET",key:"activePresetId",value:u}),W({type:"SETTINGS_SET",key:"stateMatrix",value:y.matrix}))}function C(){g(null);for(const[u,y]of[["Include",v.trim()],["Exclude",b.trim()]])if(y)try{new RegExp(y)}catch(E){return g(`${u} regex invalid: ${E instanceof Error?E.message:String(E)}`),!1}return!0}function T(){const u=l.trim();if(!u)return null;let y;try{y=new URL(u)}catch{return"Start URL must be a full URL starting with http:// or https://."}return y.protocol!=="http:"&&y.protocol!=="https:"?`Start URL must use http:// or https:// — ${y.protocol} can't be crawled.`:null}const U=T(),D=!!l.trim()&&!U;function N(u){if(!C()||!D)return;const y={startUrl:l.trim(),maxPages:i,includeRegex:v.trim(),excludeRegex:b.trim()};u&&o?o(y):r(y)}return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--v2-pad-3)",textAlign:"left"},children:[e.jsxs(_,{label:"Start URL",children:[e.jsx("input",{type:"url",value:l,onChange:u=>n(u.target.value),placeholder:"https://yoursite.com",disabled:a,"aria-invalid":!!U,className:"v2-mono",style:G}),U&&e.jsx("p",{role:"alert",style:{margin:"4px 0 0",fontSize:11,color:"var(--v2-critical)",lineHeight:1.4},children:U})]}),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:i,onChange:u=>c(Math.min(200,Math.max(1,parseInt(u.target.value,10)||25))),disabled:a,className:"v2-mono",style:{...G,maxWidth:100}})}),e.jsx(_,{label:"Audit depth",hint:"State matrix preset applied to every crawled page.",children:e.jsx("select",{value:w,onChange:u=>A(u.target.value),disabled:a,style:G,children:j.map(u=>e.jsx("option",{value:u.id,children:u.name},u.id))})}),e.jsx("button",{type:"button",onClick:()=>f(u=>!u),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:v,onChange:u=>h(u.target.value),placeholder:"^https://example\\.com/products/",disabled:a,className:"v2-mono",style:G})}),e.jsx(_,{label:"Exclude URLs matching",hint:"Optional regex. Useful for /admin or /login while logged in.",children:e.jsx("input",{type:"text",value:b,onChange:u=>x(u.target.value),placeholder:"/admin|/dashboard|/login",disabled:a,className:"v2-mono",style:G})})]}),R&&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:R}),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||!D,onClick:()=>N(!1),children:a?"Crawling…":"Crawl whole site"}),o&&e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost",disabled:a||!D,onClick:()=>N(!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 nt(){var h;const t=S(b=>b.siteCrawlProgress),a=S(b=>b.siteCrawlStatus),r=S(b=>b.progress),o=S(b=>b.aiProgress),[s,l]=p.useState(!1);function n(){l(!0),W({type:"CANCEL_SITE_CRAWL"})}if(a!=="running")return null;const i=t?Math.min(100,Math.max(0,t.current/Math.max(1,t.total)*100)):0,c=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:`${i}%`,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:`${c}%`,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:n,disabled:s,children:s?"Cancelling…":"Cancel crawl"}),s&&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 it(){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,s=a?o?"Running deep analyzers…":`Auditing… ${a.current} / ${a.total}`:"Starting audit…",l=a?o?"reading order · tab order · typography · CSS vars · AI candidates":ot(a.currentState):"Loading axe + DOM analyzers",n=a?o?100:a.current/Math.max(1,a.total)*100:0,[i,c]=p.useState(!1);function v(){c(!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(de,{label:s,detail:l,pct:n,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(de,{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:i,children:i?"Cancelling…":"Cancel audit"}),i&&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 de({label:t,detail:a,pct:r,valuenow:o,valuemax:s,ariaLabel:l,fillColor:n}){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":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:n,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 ot(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 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(c=>c.siteCrawlReport),a=S(c=>c.results),r=S(c=>c.delta),o=S(c=>c.componentId),s=S(c=>c.status),l=S(c=>c.siteCrawlStatus),[n,i]=p.useState({report:null,resolvedFails:[]});return p.useEffect(()=>{var b;let c=!1;async function v(x){return x.length===0?[]:(await Promise.all(x.map(f=>ge(f)))).flat().map(Ve).map(_e).filter(f=>f.verdict==="fail")}if(l==="running"||s==="running"){i({report:null,resolvedFails:[]});return}if(t)return(async()=>{const x=t.pages.map(f=>f.url),m=await v(x);c||i({report:t,resolvedFails:m})})(),()=>{c=!0};if(a.length===0||!o){i({report:null,resolvedFails:[]});return}const h=(b=a[0])==null?void 0:b.pageUrl;if(!h){i({report:null,resolvedFails:[]});return}return(async()=>{try{const[x,m]=await Promise.all([Be(a),v([h])]),f=new Date().toISOString(),j=Me(h,[{url:h,results:a,delta:r,componentId:o,durationMs:0}],f,f,0,x.walkthroughsByComponent,x.walkthroughAcksByComponent,x.ackedKeysByComponent,x.humanVerdictsByComponent);c||i({report:j,resolvedFails:m})}catch(x){console.warn("[v2] synthesize single-page report failed",x),c||i({report:null,resolvedFails:[]})}})(),()=>{c=!0}},[t,a,r,o,s,l]),n}const st={"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 lt(t){return st[t]??null}const ct={"1.1.1":{whatAiAdds:'alt-text descriptiveness (catches generic alts like "image", "figure 1")',mode:"per-finding"},"1.3.3":{whatAiAdds:'sensory-language detection ("click the green button")',mode:"per-finding"},"1.4.1":{whatAiAdds:"color-only meaning detection",mode:"per-finding"},"1.4.5":{whatAiAdds:"image-of-text identification",mode:"per-finding"},"2.4.4":{whatAiAdds:'generic link text ("click here", "read more")',mode:"per-finding"},"2.4.6":{whatAiAdds:"heading clarity vs section content",mode:"per-finding"},"3.1.1":{whatAiAdds:"declared-language vs actual content",mode:"per-finding"},"3.1.2":{whatAiAdds:"declared-language vs actual content (parts)",mode:"per-finding"},"3.1.5":{whatAiAdds:"wall-of-text / readability",mode:"per-finding"},"4.1.2":{whatAiAdds:"ARIA role semantic correctness",mode:"per-finding"},"1.3.2":{whatAiAdds:"reading-order DOM vs visual (AI vision walkthrough)",mode:"walkthrough"},"1.4.11":{whatAiAdds:"non-text contrast against backgrounds",mode:"walkthrough"},"2.1.2":{whatAiAdds:"no keyboard trap (Tab cycle walkthrough)",mode:"walkthrough"},"2.4.3":{whatAiAdds:"focus order vs visual layout",mode:"walkthrough"},"2.4.7":{whatAiAdds:"focus visibility (screenshot walkthrough)",mode:"walkthrough"},"2.5.3":{whatAiAdds:"visible label vs accessible name match",mode:"walkthrough"}};function Y(t){return ct[t]??null}function be(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 ue="aiConfig";function dt(t){return`https://www.w3.org/WAI/WCAG22/Understanding/${t}`}const ut=new Map(Ge.map(t=>[t.id,t]));async function pt(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,s=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 vt(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 i=[120,250,500,800,1200,800];let c="";for(let v=0;v<=i.length;v++)try{const h=await tt(o,{type:"HIGHLIGHT_SHOW_REQUEST",tabId:o,selector:t.selector,scrollIntoView:!0});return{ok:!0,found:h.found,matchCount:h.matchCount}}catch(h){const b=h instanceof Error?h.message:String(h);if(c=b,!(b.includes("Could not establish connection")||b.includes("Receiving end does not exist")))break;const m=i[v];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 Q(t){try{return new URL(t).origin}catch{return""}}function vt(t,a,r){return new Promise(o=>{let s=!1;const l=setTimeout(()=>{s||(s=!0,chrome.tabs.onUpdated.removeListener(n),o(!1))},r);function n(i,c,v){if(i!==t||c.status!=="complete")return;const h=Q(v.url??""),b=Q(a);b&&h&&h!==b||s||(s=!0,clearTimeout(l),chrome.tabs.onUpdated.removeListener(n),o(!0))}chrome.tabs.onUpdated.addListener(n)})}function pe(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 ht(t){return t.length>70?t.slice(0,67)+"...":t}function gt(t){try{const a=new Date(t),r=new Date,o=a.toDateString()===r.toDateString(),s=new Date(r);s.setDate(s.getDate()-1);const l=a.toDateString()===s.toDateString(),n=a.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"});return o?`today, ${n}`:l?`yesterday, ${n}`:`${a.toLocaleDateString(void 0,{month:"short",day:"numeric"})}, ${n}`}catch{return t}}function mt(){const{report:t}=X(),a=S(d=>d.componentId),r=S(d=>d.siteCrawlReport),[o,s]=p.useState(!1),[l,n]=p.useState(new Set),[i,c]=p.useState(0),v=p.useRef(""),[h,b]=p.useState(!1),[x,m]=p.useState("claude-sonnet-4-6");p.useEffect(()=>{(async()=>{const w=(await chrome.storage.local.get(ue))[ue];v.current=(w==null?void 0:w.apiKey)??"",b(!!(w!=null&&w.apiKey)),w!=null&&w.model&&m(w.model)})()},[]);const f=be({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||n(new Set);return}try{const w=await me([f]);if(d)return;n(new Set(w.map(k=>k.criterionId)))}catch{d||n(new Set)}})(),()=>{d=!0}},[f,i]),!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:()=>s(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(R=>l.has(R.criterionId)).length,k=d-w;return w===0?`${d} criteri${d===1?"on":"a"} need${d===1?"s":""} your judgment`:k===0?`${d} criteri${d===1?"on":"a"} verified — re-crawl to lift the grade`:`${w} of ${d} verified · ${k} 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(ft,{criterionId:d.criterionId,title:d.title,state:d.state,evidence:d.evidence,targetComponentId:f,apiKeyRef:v,apiKeyPresent:h,model:x,onVerdictChange:()=>c(w=>w+1)},d.criterionId))]})]})}function ft({criterionId:t,title:a,state:r,evidence:o,targetComponentId:s,apiKeyRef:l,apiKeyPresent:n,model:i,onVerdictChange:c}){var oe,se;const[v,h]=p.useState(null),[b,x]=p.useState(""),[m,f]=p.useState(!1),[j,d]=p.useState(null),[w,k]=p.useState(null),[R,g]=p.useState(!0),[A,C]=p.useState(!1),[T,U]=p.useState(null),[D,N]=p.useState(null),[u,y]=p.useState(null),E={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(!s){I||g(!1);return}try{const O=(await me([s])).find(V=>V.criterionId===t);if(I)return;k(O?{verdict:O.verdict,note:O.note,verifiedAt:O.verifiedAt}:null)}catch{I||k(null)}finally{I||g(!1)}})(),()=>{I=!0}},[t,s]);async function L(){if(s){f(!0),d(null);try{await Ke(s,t),k(null),c()}catch(I){d(I instanceof Error?I.message:String(I))}finally{f(!1)}}}const P=ut.get(t),H=P==null?void 0:P.shortDescription,ne=P==null?void 0:P.understandingSlug,ie=lt(t);async function Se(){if(!l.current){N("Set an Anthropic API key in extension Options first.");return}C(!0),N(null);try{const F=`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 Re({apiKey:l.current,model:i,messages:[{role:"user",content:F}],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});U(O.text),y(O.costUsd)}catch(I){N(I instanceof Error?I.message:String(I))}finally{C(!1)}}async function je(I){if(!s){d("No componentId available — re-run an audit first.");return}if(!b.trim()){d("Note is required — describe what you checked and why this verdict applies.");return}f(!0),d(null);const F=new Date().toISOString(),O=b.trim();try{await qe({componentId:s,criterionId:t,verdict:I,note:O,verifiedAt:F}),k({verdict:I,note:O,verifiedAt:F}),h(null),x(""),c()}catch(V){d(V instanceof Error?V.message:String(V))}finally{f(!1)}}if(w){const F={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:F.bg,border:`1px solid ${F.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:F.ink},children:["✓ ",F.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 ",gt(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 R?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}),!n&&Y(t)&&e.jsx("span",{title:`AI would add: ${(oe=Y(t))==null?void 0:oe.whatAiAdds}. Add an API key in Settings → AI to enable.`,style:{fontSize:10,fontWeight:600,padding:"1px 6px",borderRadius:3,background:"var(--v2-bg-elev)",color:"var(--v2-ink-tertiary)",border:"1px solid var(--v2-border)",letterSpacing:"0.02em"},children:"AI skipped"})]}),H&&e.jsx("p",{style:{margin:"4px 0 0",fontSize:12,color:"var(--v2-ink-secondary)",lineHeight:1.5},children:H}),!n&&Y(t)&&e.jsxs("p",{style:{margin:"4px 0 0",fontSize:11,color:"var(--v2-ink-tertiary)",lineHeight:1.5,fontStyle:"italic"},children:["AI would judge: ",(se=Y(t))==null?void 0:se.whatAiAdds]}),e.jsx("p",{style:{margin:"6px 0 0",fontSize:11,color:"var(--v2-ink-tertiary)",lineHeight:1.5},children:E[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,F)=>e.jsx(yt,{ev:I},`${I.pageUrl}::${I.selector??""}::${F}`))})]}),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:dt(ne),target:"_blank",rel:"noreferrer noopener",style:{fontSize:11,color:"var(--v2-ink-secondary)",textDecoration:"underline",textUnderlineOffset:2},children:"Read W3C guidance ↗"}),n&&e.jsx("button",{type:"button",onClick:Se,disabled:A,style:{appearance:"none",background:"none",border:"none",padding:0,cursor:A?"wait":"pointer",fontSize:11,color:"var(--v2-ink-secondary)",textDecoration:"underline",textUnderlineOffset:2},children:A?"Explaining…":T?"Re-explain with AI":"Explain with AI ↗"})]}),(T||D)&&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:[T&&e.jsx("p",{style:{margin:0,fontSize:12,color:"var(--v2-ink-primary)",lineHeight:1.55,whiteSpace:"pre-wrap"},children:T}),D&&e.jsx("p",{role:"alert",style:{margin:0,fontSize:11,color:"var(--v2-critical)"},children:D}),u!==null&&e.jsxs("p",{className:"v2-mono",style:{margin:"4px 0 0",fontSize:10,color:"var(--v2-ink-tertiary)"},children:["$",u.toFixed(4)," · ",i]})]}),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:b,onChange:I=>x(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:()=>je(v),disabled:m||!b.trim(),children:m?"Saving…":`Confirm ${v.toUpperCase()}`})})]})]})}function yt({ev:t}){const[a,r]=p.useState(!1),[o,s]=p.useState(null);async function l(){r(!0),s(null);try{const n=await pt({pageUrl:t.pageUrl,selector:t.selector});n.ok?t.selector?n.found?s({kind:"ok",text:`Element highlighted (${n.matchCount} match${n.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 ${pe(t.pageUrl)} — no element selector available; verify manually.`}):s({kind:"err",text:n.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:pe(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:ht(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 bt(){const{report:t,resolvedFails:a}=X(),r=S(u=>u.siteCrawlReport),o=S(u=>u.siteCrawlStatus),s=S(u=>u.siteCrawlError),l=S(u=>u.status),n=o==="running",c=n||l==="running"&&!n,v=!!t&&!r,[h,b]=p.useState(null);p.useEffect(()=>{let u=!1;return chrome.tabs.query({active:!0,currentWindow:!0}).then(y=>{var E;u||b(((E=y[0])==null?void 0:E.url)??null)}),()=>{u=!0}},[]);const[x,m]=p.useState(!1);function f(u,y=!1){u.startUrl&&(S.getState().setSiteCrawlStatus("running"),S.getState().setSiteCrawlReport(null),S.getState().setSiteCrawlError(null),le({type:"START_SITE_CRAWL",startUrl:u.startUrl,maxPages:u.maxPages,...u.includeRegex?{includeRegex:u.includeRegex}:{},...u.excludeRegex?{excludeRegex:u.excludeRegex}:{},...y?{verifyFixesOnly:!0}:{}}))}function j(){le({type:"START_AUDIT",mode:"full-page"}),S.getState().startNewScan()}const[d,w]=p.useState(!1),[k,R]=p.useState(null),[g,A]=p.useState(null);async function C(){w(!0),R(null),A(null);const u=(t==null?void 0:t.siteGrade)??"A";try{const y=await W({type:"REGRADE_SITE_CRAWL"});if((y==null?void 0:y.ok)===!0)setTimeout(()=>{var P;const L=((P=S.getState().siteCrawlReport)==null?void 0:P.siteGrade)??u;A({prevGrade:u,nextGrade:L,at:Date.now()})},0);else{const L=(y==null?void 0:y.reason)??"Regrade failed.";R(L)}}catch(y){R(y instanceof Error?y.message:String(y))}finally{w(!1)}}if(p.useEffect(()=>{if(!g)return;const u=setTimeout(()=>A(null),6e3);return()=>clearTimeout(u)},[g]),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:n?e.jsx(nt,{}):e.jsx(it,{})});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(ce,{initialUrl:h??"",isRunning:c,onCrawl:u=>f(u,!1),onAuditThisPage:j})]});const T=a.length,U=(t.totalWalkthroughFindings??0)+t.totalUniqueViolations+T,D=(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(kt,{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 E;const u=U+N,y=((E=t.blockingCriteria)==null?void 0:E.length)??0;return u===0&&y===0?"All clear — nothing open.":u===0&&y>0?`Visible findings clear — ${y} criteri${y===1?"on":"a"} still need${y===1?"s":""} your judgment.`:`${u} finding${u===1?"":"s"} to address.`})()}),e.jsx(wt,{openCount:U,reviewCount:N,verifiedCount:D,axeCount:t.totalUniqueViolations,walkthroughCount:t.totalWalkthroughFindings??0,autoCount:T}),h&&!xt(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(u=>!u),"aria-expanded":x,title:"Open crawl setup to audit the whole site instead",children:x?"Hide crawl options":"Crawl whole site"})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary",onClick:C,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(u=>!u),"aria-expanded":x,children:x?"Hide options":"Adjust options"})]}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:()=>{Te(),S.getState().setSiteCrawlReport(null),S.getState().setSiteCrawlError(null),Ye(null).catch(()=>{})},title:"Wipe these results so you can start fresh",style:{marginLeft:"auto"},children:"Clear results"})]}),k&&e.jsx("p",{role:"alert",style:{margin:"var(--v2-pad-2) 0 0",fontSize:11,color:"var(--v2-critical)"},children:k}),g&&!k&&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(mt,{}),x&&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(ce,{initialUrl:t.startUrl,isRunning:c,onCrawl:u=>f(u,!1),onVerifyFixes:u=>f(u,!0),onAuditThisPage:j})})]})}function xt(t,a){try{return new URL(t).origin===new URL(a).origin}catch{return!1}}function kt({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 wt({openCount:t,reviewCount:a,verifiedCount:r,axeCount:o,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(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:s,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 St=new Set(["2.4.3","2.1.2","2.4.7","1.3.2","1.4.11","2.5.3"]);function ve(t){return St.has(t)}async function he(t){var o,s;const a=S.getState();if(a.componentId&&((o=a.results[0])==null?void 0:o.pageUrl)===t)return a.componentId;const r=await fe();return((s=r==null?void 0:r.find(l=>l.url===t))==null?void 0:s.componentId)??null}async function jt(t,a){var l;const r=S.getState(),o=[];if(r.componentId&&r.results.length>0){const n=(l=r.results[0])==null?void 0:l.pageUrl,i=a.find(c=>c.url===n);if(i){for(const c of r.results)for(const v of c.violations)v.ruleId===t&&v.target.selector===i.selector&&o.push({componentId:r.componentId,matchKey:v.matchKey});if(o.length>0)return o}}const s=await fe()??[];for(const n of a){const i=s.find(c=>c.url===n.url);if(i)for(const c of i.results)for(const v of c.violations)v.ruleId===t&&v.target.selector===n.selector&&o.push({componentId:i.componentId,matchKey:v.matchKey})}return o}function Ct({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(At,{row:t}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx(Rt,{row:t}),e.jsx(Tt,{row:t})]}),e.jsx(It,{})]}),e.jsx("div",{style:{padding:"0 var(--v2-pad-4) var(--v2-pad-4)",borderTop:"1px solid var(--v2-border)"},children:e.jsx(Et,{row:t})})]})}function At({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 Rt({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 Tt({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 It(){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 Et({row:t}){return t.kind==="walkthrough-fail"?e.jsx(Ut,{row:t}):t.kind==="walkthrough-ack"?e.jsx(zt,{row:t}):t.kind==="needs-review"?e.jsx(Dt,{row:t}):t.kind==="auto-contrast"?e.jsx(Nt,{row:t}):e.jsx(Pt,{row:t})}function Nt({row:t}){const[a,r]=p.useState(!1),[o,s]=p.useState(!1),[l,n]=p.useState(""),[i,c]=p.useState(!1),[v,h]=p.useState(!1),[b,x]=p.useState(null),m=ye(t.ruleId);async function f(){if(c(!0),x(null),!l.trim()){x("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 ge(t.pageUrl)).find(k=>k.ruleId===t.ruleId&&k.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 Qe(w),h(!0),r(!1)}catch(j){x(j instanceof Error?j.message:String(j))}finally{c(!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:()=>s(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(ke,{summary:m.summary,snippet:m.snippet}),a&&e.jsx(te,{note:l,setNote:n,busy:i,err:b,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."}),b&&!a&&e.jsx(J,{message:b})]})]})}function Ut({row:t}){const[a,r]=p.useState(!1),[o,s]=p.useState(""),[l,n]=p.useState(!1),[i,c]=p.useState(!1),[v,h]=p.useState(!1),[b,x]=p.useState(null),[m,f]=p.useState(null),j=ve(t.criterion),d=Ie();async function w(){if(n(!0),f(null),!o.trim()){f("Note is required — explain how you manually verified this."),n(!1);return}try{const R=await he(t.pageUrl);if(!R){f("Could not find this page in the audit data. Re-run the audit and try again.");return}await Ze({componentId:R,criterionId:t.criterion,pageUrl:t.pageUrl,note:o.trim(),acknowledgedAt:new Date().toISOString(),verdictAtAck:t.verdict}),c(!0),r(!1)}catch(R){f(R instanceof Error?R.message:String(R))}finally{n(!1)}}async function k(){var R;h(!0),x(null),f(null);try{const A=(R=(await chrome.tabs.query({active:!0,currentWindow:!0}))[0])==null?void 0:R.id;if(!A){f("Open the audited page in your active tab to re-run.");return}const C=await he(t.pageUrl);if(!C){f("Could not find this page in the audit data.");return}if(!ve(t.criterion)){f(`Re-run is only available for interactive criteria. ${t.criterion} is not supported.`);return}const U=await W({type:"INTERACTIVE_AUDIT_REQUEST",criterionId:t.criterion,tabId:A,componentId:C,pageUrl:t.pageUrl});if(!U.ok){f(U.error??"Re-run failed.");return}x(`Re-run verdict: ${U.verdict??"unknown"}. Re-audit the page to refresh this list.`)}catch(g){f(g instanceof Error?g.message:String(g))}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})}),i?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:k,disabled:v||!d,title:d?void 0:"AI walkthroughs need an Anthropic API key. Add one in Settings → AI.",children:v?"Re-running…":"Re-run walkthrough"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary v2-btn-sm",onClick:()=>r(R=>!R),"aria-expanded":a,children:a?"Cancel":"Mark verified manually"})]}),b&&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:b}),a&&e.jsx(te,{note:o,setNote:s,busy:l,err:m,onConfirm:w,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 zt({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 Dt({row:t}){return e.jsx(xe,{row:t,kind:"needs-review"})}function Pt({row:t}){return e.jsx(xe,{row:t,kind:"axe"})}function xe({row:t,kind:a}){const[r,o]=p.useState(!1),[s,l]=p.useState(""),[n,i]=p.useState(!1),[c,v]=p.useState(!1),[h,b]=p.useState(!1),[x,m]=p.useState(null),f=ye(t.ruleId);async function j(){if(i(!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."),i(!1);return}try{const d=await jt(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 Xe({componentId:w.componentId,matchKey:w.matchKey,ruleId:t.ruleId,note:s.trim()});v(!0),o(!1)}catch(d){m(d instanceof Error?d.message:String(d))}finally{i(!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"]})]})}),c?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:()=>b(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(ke,{summary:f.summary,snippet:f.snippet}),r&&e.jsx(te,{note:s,setNote:l,busy:n,err:x,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"}`}),x&&!r&&e.jsx(J,{message:x})]})]})}function te({note:t,setNote:a,busy:r,err:o,onConfirm:s,hint:l,placeholder:n,confirmLabel:i="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:n,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:s,disabled:r||!t.trim(),children:r?"Saving…":i})})]})}function ke({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 Ft(){const{report:t,resolvedFails:a}=X(),[r,o]=p.useState("open"),s=p.useMemo(()=>t?Lt(t.pages,t.findingGroups??[],a):[],[t,a]),l=p.useMemo(()=>r==="all"?s:s.filter(i=>r==="verified"?i.kind==="walkthrough-ack":r==="review"?i.kind==="needs-review":r==="open"?i.kind==="axe"||i.kind==="walkthrough-fail"||i.kind==="auto-contrast":!0),[s,r]);if(!t)return null;const n={all:s.length,open:s.filter(i=>i.kind==="axe"||i.kind==="walkthrough-fail"||i.kind==="auto-contrast").length,review:s.filter(i=>i.kind==="needs-review").length,verified:s.filter(i=>i.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($t,{filter:r,setFilter:o,counts:n})]}),l.length===0?e.jsx(Wt,{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((i,c)=>e.jsx("li",{style:{animation:`v2-row-in 240ms ease ${Math.min(c,12)*30}ms both`},children:e.jsx(Ct,{row:i})},i.key))})]})}function $t({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(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 Wt({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 Lt(t,a,r=[]){const o=[];for(const n of a)n.needsReview?o.push({kind:"needs-review",key:`nr::${n.ruleId}::${n.representativeSelector}`,criterion:n.wcagCriterion,ruleId:n.ruleId,description:n.axeDescription,selector:n.representativeSelector,failureSummary:n.failureSummary,pages:n.pages,group:n}):o.push({kind:"axe",key:`axe::${n.ruleId}::${n.representativeSelector}`,criterion:n.wcagCriterion,ruleId:n.ruleId,impact:n.impact,description:n.axeDescription,selector:n.representativeSelector,pages:n.pages,isShared:n.isShared});const s=new Set;for(const n of t){for(const i of n.walkthroughFindings??[]){const c=`wt-fail::${i.criterionId}::${i.pageUrl}`;s.has(c)||(s.add(c),o.push({kind:"walkthrough-fail",key:c,criterion:i.criterionId,verdict:i.verdict,impact:i.impact,reasoning:i.reasoning,pageUrl:i.pageUrl}))}for(const i of n.walkthroughAcknowledgements??[]){const c=`wt-ack::${i.criterionId}::${i.pageUrl}`;s.has(c)||(s.add(c),o.push({kind:"walkthrough-ack",key:c,criterion:i.criterionId,verdict:i.verdict,reasoning:i.reasoning,pageUrl:i.pageUrl}))}}for(const n of r)o.push({kind:"auto-contrast",key:`auto::${n.ruleId}::${n.selector}::${n.pageUrl}`,criterion:n.wcagCriterion??"1.4.3",ruleId:n.ruleId,impact:"serious",selector:n.selector,pageUrl:n.pageUrl,reasoning:n.reasoning});const l={critical:0,serious:1,moderate:2,minor:3,"needs-review":4,ack:5};return o.sort((n,i)=>{const c=n.kind==="walkthrough-ack"?l.ack:n.kind==="needs-review"?l["needs-review"]:l[n.impact],v=i.kind==="walkthrough-ack"?l.ack:i.kind==="needs-review"?l["needs-review"]:l[i.impact];return(c??99)-(v??99)}),o}function Ot({open:t,onClose:a}){const{report:r}=X(),o=S(g=>g.siteCrawlReport),s=S(g=>g.results),l=S(g=>g.componentId),n=S(g=>g.delta),i=!!o,c=i||s.length>0,v=be({storeComponentId:l,storeCrawlReport:o,pageUrls:(r==null?void 0:r.pages.map(g=>g.url))??[]}),[h,b]=p.useState({}),x=p.useRef(null);p.useEffect(()=>{var A;if(!t)return;const g=C=>{C.key==="Escape"&&a()};return document.addEventListener("keydown",g),(A=x.current)==null||A.focus(),()=>document.removeEventListener("keydown",g)},[t,a]);function m(g,A){b(C=>({...C,[g]:A}))}async function f(){m("ai-prompt",{state:"busy"});try{if(i){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 Z(g.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 at({results:s,componentId:l??null,delta:n}),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(i&&r){const{renderSiteReportHtml:g}=await q(async()=>{const{renderSiteReportHtml:C}=await import("./site-report-renderer-DA-9wVvE.js");return{renderSiteReportHtml:C}},__vite__mapDeps([0,1,2,3,4,5])),A=g(r);await Z(A,"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:g}=await q(async()=>{const{toHtmlPrint:C}=await import("./scheduled-audit-runner-QcMYcqgA.js").then(T=>T.aV);return{toHtmlPrint:C}},__vite__mapDeps([1,2,3,4,5])),A=g(s,n??void 0);await Z(A,"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,A,C){m(g,{state:"busy"});try{const T=await W({type:"EXPORT_REQUEST",format:g,results:i?[]:s,...n&&!i?{delta:n}:{},...i?{siteCrawlSource:!0}:{},...v?{auditTargetId:v}:{}});if(!(T!=null&&T.content))throw new Error("Empty response");await Z(T.content,C,"text/html"),m(g,{state:"done",message:`${A} opened in a new tab.`})}catch(T){m(g,{state:"error",message:T instanceof Error?T.message:String(T)})}}async function w(){const{createZip:g}=await q(async()=>{const{createZip:N}=await import("./zip-encoder-CtULHXx_.js");return{createZip:N}},[]),{renderSiteReportHtml:A}=await q(async()=>{const{renderSiteReportHtml:N}=await import("./site-report-renderer-DA-9wVvE.js");return{renderSiteReportHtml:N}},__vite__mapDeps([0,1,2,3,4,5])),C=[],T=i?[{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"}],U=T.length+(i&&r?1:0);let D=0;m("zip",{state:"busy",progress:{current:0,total:U,label:"Starting…"}});try{if(i&&r){D++,m("zip",{state:"busy",progress:{current:D,total:U,label:"site-report.html (client-side)"}});try{C.push({name:"site-report.html",content:A(r)})}catch{}}for(const{format:L,filename:P}of T){D++,m("zip",{state:"busy",progress:{current:D,total:U,label:P}});try{const H=await W({type:"EXPORT_REQUEST",format:L,results:i?[]:s,...n&&!i?{delta:n}:{},...i?{siteCrawlSource:!0}:{},...v?{auditTargetId:v}:{}});H!=null&&H.content&&C.push({name:P,content:H.content})}catch{}}if(C.length===0)throw new Error("All exports failed");const N=g(C),u=new Blob([N],{type:"application/zip"}),y=URL.createObjectURL(u),E=document.createElement("a");E.href=y,E.download=i?"wcagcheckr-site-bundle.zip":"wcagcheckr-page-bundle.zip",E.click(),setTimeout(()=>URL.revokeObjectURL(y),6e4),m("zip",{state:"done",message:`Downloaded ${C.length} file${C.length===1?"":"s"}.`})}catch(N){m("zip",{state:"error",message:N instanceof Error?N.message:String(N)})}}function k(g){S.getState().setView(g),chrome.storage.local.set({v2UiEnabled:!1}),a()}function R(){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:x,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(M,{title:"AI fixer",children:e.jsx($,{status:h["ai-prompt"],label:i?"Copy site-wide AI fix prompt":"Copy AI fix prompt",description:i?"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(M,{title:"Reports",children:[e.jsx($,{status:h.html,label:i?"Site report (HTML)":"Page report (HTML)",description:i?"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")}),i&&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(M,{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(M,{title:"Bulk",children:e.jsx($,{status:h.zip,label:i?"Download all as ZIP":"Download both as ZIP",description:i?"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(M,{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(z,{label:"State matrix",description:"Per-state findings grid (hover · focus · dark · RTL · etc.)",onClick:()=>k("matrix")}),e.jsx(z,{label:"Per-area compliance",description:"9 sub-grade areas with drill-in: Color & contrast, Keyboard, etc.",onClick:()=>k("report")}),e.jsx(z,{label:"Baseline delta",description:"New vs. persistent vs. fixed vs. acknowledged since the last baseline.",onClick:()=>k("delta")}),e.jsx(z,{label:"Forensic log",description:"Anchored audit history with chain-of-custody.",onClick:()=>k("forensic")}),e.jsx(z,{label:"Risk dashboard",description:"Lawsuit / conformance risk tiers with prioritized actions.",onClick:()=>k("risk")}),e.jsx(z,{label:"WCAG 3 mapping",description:"Outcome-level grouping per WCAG 3 snapshot.",onClick:()=>k("wcag3")}),e.jsx(z,{label:"WCAG-EM verdicts",description:"Formal per-criterion verdict map.",onClick:()=>k("compliance")}),e.jsx(z,{label:"Schedules",description:"Recurring audit management with email alerts.",onClick:()=>k("schedules")}),e.jsx(z,{label:"Copilot chat",description:"Anthropic-powered Q&A over your audit context.",onClick:()=>k("copilot")}),e.jsx(z,{label:"Accessibility tree",description:"Inspect the live aria tree as assistive tech sees it.",onClick:()=>k("ax-tree")}),e.jsx(z,{label:"Design tokens",description:"CSS-token / design-system audit.",onClick:()=>k("tokens")}),e.jsx(z,{label:"Guided audit",description:"13 manual IGT workflows (keyboard, screen reader, etc.).",onClick:()=>k("guided")}),e.jsx(z,{label:"Per-component scorecard",description:"Custom rules, baselines, per-component drill-in.",onClick:()=>k("scorecard")}),e.jsx(z,{label:"User journey flows",description:"Multi-step audit recordings.",onClick:()=>k("flows")}),e.jsx(z,{label:"Activity / IGT runs",description:"Manual workflow run history.",onClick:()=>k("activity")})]}),e.jsx(M,{title:"Settings",children:e.jsx($,{status:void 0,label:"Open settings",description:"Matrix preset, AI config, axe rule overrides, breakpoints, auto-export.",onClick:R})})]})]})]}):null}async function Z(t,a,r){const o=new Blob([t],{type:r}),s=URL.createObjectURL(o);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 M({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 s=(r==null?void 0:r.state)==="busy",l=(r==null?void 0:r.state)==="done",n=(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: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}),s&&(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]}),n&&(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 z({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 Ht(){var l,n;const t=S(i=>i.siteCrawlReport),a=S(i=>i.results),[r,o]=p.useState(!1),s=(t==null?void 0:t.startUrl)??((l=a[0])==null?void 0:l.pageUrl)??((n=a[0])==null?void 0:n.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:i=>{i.currentTarget.style.left="var(--v2-pad-4)",i.currentTarget.style.top="var(--v2-pad-4)"},onBlur:i=>{i.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",alignItems:"center",gap:"var(--v2-pad-2)",marginLeft:"auto"},children:[e.jsx(Ee,{}),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(Ot,{open:r,onClose:()=>o(!1)})]})}function Bt(){return p.useEffect(()=>{const t=Ne(),r=new URLSearchParams(window.location.search).get("context")==="overlay"?null:chrome.runtime.connect({name:"sidepanel-tracker"}),o=Ue();ze({forceRefresh:!0}).catch(()=>{}),De().catch(()=>{}),Pe().catch(()=>{}),Fe().catch(()=>{}),$e().catch(()=>{}),Je().then(l=>{S.getState().setAcknowledgedKeys(new Set(l.map(n=>n.matchKey)))}).catch(()=>{});let s=!1;return et().then(l=>{s||l&&S.setState({siteCrawlReport:l})}).catch(()=>{}),()=>{s=!0,o();try{t.disconnect()}catch{}try{r==null||r.disconnect()}catch{}}},[]),e.jsxs("div",{className:"v2-root",children:[e.jsx(Ht,{}),e.jsx(We,{}),e.jsx(Le,{}),e.jsxs("main",{id:"main-content","aria-label":"wcagcheckr findings",children:[e.jsx(bt,{}),e.jsx(Ft,{})]})]})}rt("side-panel");function Mt(){const[t,a]=p.useState(null);return p.useEffect(()=>{let r=!1;function o(l){const n=l.userMode,i=!!l.v2UiEnabled;let c;n==="owner"||n==="power"||n==="dev"?c=n:n==="dev"&&i?c="power":c=i?"power":"owner",r||a(c)}chrome.storage.local.get(["userMode","v2UiEnabled"]).then(o).catch(()=>a("owner"));const s=(l,n)=>{n==="local"&&(!("userMode"in l)&&!("v2UiEnabled"in l)||chrome.storage.local.get(["userMode","v2UiEnabled"]).then(o))};return chrome.storage.onChanged.addListener(s),()=>{r=!0,chrome.storage.onChanged.removeListener(s)}},[]),t===null?null:t==="power"?e.jsx(Bt,{}):e.jsx(He,{})}const we=document.getElementById("root");if(!we)throw new Error("side-panel: #root not found");Ce(we).render(e.jsx(Ae.StrictMode,{children:e.jsx(Oe,{children:e.jsx(Mt,{})})}));
|
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.336",
|
|
6
|
+
"version_name": "1.0.0-rc.336",
|
|
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-SSx7I0aD.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.336",
|
|
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-DA-9wVvE.js","assets/scheduled-audit-runner-QcMYcqgA.js","assets/preload-helper-D7HrI6pR.js","assets/crash-reporter-Bu2p8K-p.js","assets/ai-usage-log-D5enikfX.js","assets/diff-DIBMr3fQ.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import"./modulepreload-polyfill-B5Qt9EMX.js";import{r as p,j as e,c as we,R as Se}from"./styles-ea15PiMP.js";import{u as S,c as je,a as Ce,l as ie,b as Re,P as Te,s as Ie,w as Ae,r as Ne,d as Ee,e as Ue,p as ze,f as Pe,A as De,g as Fe,E as $e,h as We}from"./ErrorBoundary-CIHCpor0.js";import{l as Le,a as Oe,g as pe,b as He,c as Be,W as Me,d as ve,r as Ve,s as _e,e as Ge,f as he,h as ge,i as Ke,j as qe,k as Ye,m as Ze,n as Qe}from"./scheduled-audit-runner-QcMYcqgA.js";import{s as W,r as Xe,i as Je}from"./crash-reporter-Bu2p8K-p.js";import{B as J}from"./ai-usage-log-D5enikfX.js";import{_ as q}from"./preload-helper-D7HrI6pR.js";import{copyAiFixerPrompt as et}from"./copy-ai-fixer-prompt-GhPr32yI.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./design-system-audit-DpxJrxnb.js";import"./diff-DIBMr3fQ.js";function oe({initialUrl:t,isRunning:a,onCrawl:r,onVerifyFixes:o,onAuditThisPage:s}){const[l,i]=p.useState(t),[n,c]=p.useState(25),[v,h]=p.useState(""),[b,x]=p.useState(""),[m,f]=p.useState(!1),[j,d]=p.useState(J),[w,k]=p.useState(J[0].id),[T,g]=p.useState(null);p.useEffect(()=>{t&&!l&&i(t)},[t]),p.useEffect(()=>{let u=!1;return Promise.all([W({type:"SETTINGS_GET",key:"matrixPresets"}),W({type:"SETTINGS_GET",key:"activePresetId"})]).then(([y,N])=>{if(u)return;const L=Array.isArray(y.data)?y.data:null;d(L&&L.length>0?L:J),typeof N.data=="string"&&k(N.data)}),()=>{u=!0}},[]);function R(u){const y=j.find(N=>N.id===u);y&&(k(u),W({type:"SETTINGS_SET",key:"activePresetId",value:u}),W({type:"SETTINGS_SET",key:"stateMatrix",value:y.matrix}))}function C(){g(null);for(const[u,y]of[["Include",v.trim()],["Exclude",b.trim()]])if(y)try{new RegExp(y)}catch(N){return g(`${u} regex invalid: ${N instanceof Error?N.message:String(N)}`),!1}return!0}function I(){const u=l.trim();if(!u)return null;let y;try{y=new URL(u)}catch{return"Start URL must be a full URL starting with http:// or https://."}return y.protocol!=="http:"&&y.protocol!=="https:"?`Start URL must use http:// or https:// — ${y.protocol} can't be crawled.`:null}const U=I(),P=!!l.trim()&&!U;function E(u){if(!C()||!P)return;const y={startUrl:l.trim(),maxPages:n,includeRegex:v.trim(),excludeRegex:b.trim()};u&&o?o(y):r(y)}return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--v2-pad-3)",textAlign:"left"},children:[e.jsxs(_,{label:"Start URL",children:[e.jsx("input",{type:"url",value:l,onChange:u=>i(u.target.value),placeholder:"https://yoursite.com",disabled:a,"aria-invalid":!!U,className:"v2-mono",style:G}),U&&e.jsx("p",{role:"alert",style:{margin:"4px 0 0",fontSize:11,color:"var(--v2-critical)",lineHeight:1.4},children:U})]}),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:u=>c(Math.min(200,Math.max(1,parseInt(u.target.value,10)||25))),disabled:a,className:"v2-mono",style:{...G,maxWidth:100}})}),e.jsx(_,{label:"Audit depth",hint:"State matrix preset applied to every crawled page.",children:e.jsx("select",{value:w,onChange:u=>R(u.target.value),disabled:a,style:G,children:j.map(u=>e.jsx("option",{value:u.id,children:u.name},u.id))})}),e.jsx("button",{type:"button",onClick:()=>f(u=>!u),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:v,onChange:u=>h(u.target.value),placeholder:"^https://example\\.com/products/",disabled:a,className:"v2-mono",style:G})}),e.jsx(_,{label:"Exclude URLs matching",hint:"Optional regex. Useful for /admin or /login while logged in.",children:e.jsx("input",{type:"text",value:b,onChange:u=>x(u.target.value),placeholder:"/admin|/dashboard|/login",disabled:a,className:"v2-mono",style:G})})]}),T&&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:T}),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||!P,onClick:()=>E(!1),children:a?"Crawling…":"Crawl whole site"}),o&&e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost",disabled:a||!P,onClick:()=>E(!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 tt(){var h;const t=S(b=>b.siteCrawlProgress),a=S(b=>b.siteCrawlStatus),r=S(b=>b.progress),o=S(b=>b.aiProgress),[s,l]=p.useState(!1);function i(){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,c=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:`${c}%`,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:i,disabled:s,children:s?"Cancelling…":"Cancel crawl"}),s&&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 rt(){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,s=a?o?"Running deep analyzers…":`Auditing… ${a.current} / ${a.total}`:"Starting audit…",l=a?o?"reading order · tab order · typography · CSS vars · AI candidates":at(a.currentState):"Loading axe + DOM analyzers",i=a?o?100:a.current/Math.max(1,a.total)*100:0,[n,c]=p.useState(!1);function v(){c(!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(se,{label:s,detail:l,pct:i,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(se,{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 se({label:t,detail:a,pct:r,valuenow:o,valuemax:s,ariaLabel:l,fillColor:i}){return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--v2-pad-2)"},children:[e.jsx("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:"var(--v2-pad-3)"},children:e.jsx("span",{className:"v2-eyebrow",style:{margin:0,color:"var(--v2-action)"},children:t})}),e.jsx("div",{role:"progressbar","aria-valuenow":o,"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:i,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 at(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 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 Q(){const t=S(c=>c.siteCrawlReport),a=S(c=>c.results),r=S(c=>c.delta),o=S(c=>c.componentId),s=S(c=>c.status),l=S(c=>c.siteCrawlStatus),[i,n]=p.useState({report:null,resolvedFails:[]});return p.useEffect(()=>{var b;let c=!1;async function v(x){return x.length===0?[]:(await Promise.all(x.map(f=>pe(f)))).flat().map(He).map(Be).filter(f=>f.verdict==="fail")}if(l==="running"||s==="running"){n({report:null,resolvedFails:[]});return}if(t)return(async()=>{const x=t.pages.map(f=>f.url),m=await v(x);c||n({report:t,resolvedFails:m})})(),()=>{c=!0};if(a.length===0||!o){n({report:null,resolvedFails:[]});return}const h=(b=a[0])==null?void 0:b.pageUrl;if(!h){n({report:null,resolvedFails:[]});return}return(async()=>{try{const[x,m]=await Promise.all([Le(a),v([h])]),f=new Date().toISOString(),j=Oe(h,[{url:h,results:a,delta:r,componentId:o,durationMs:0}],f,f,0,x.walkthroughsByComponent,x.walkthroughAcksByComponent,x.ackedKeysByComponent,x.humanVerdictsByComponent);c||n({report:j,resolvedFails:m})}catch(x){console.warn("[v2] synthesize single-page report failed",x),c||n({report:null,resolvedFails:[]})}})(),()=>{c=!0}},[t,a,r,o,s,l]),i}const nt={"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 it(t){return nt[t]??null}function me(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 le="aiConfig";function ot(t){return`https://www.w3.org/WAI/WCAG22/Understanding/${t}`}const st=new Map(Me.map(t=>[t.id,t]));async function lt(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,s=Z(t.pageUrl),l=Z(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 ct(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 c="";for(let v=0;v<=n.length;v++)try{const h=await Xe(o,{type:"HIGHLIGHT_SHOW_REQUEST",tabId:o,selector:t.selector,scrollIntoView:!0});return{ok:!0,found:h.found,matchCount:h.matchCount}}catch(h){const b=h instanceof Error?h.message:String(h);if(c=b,!(b.includes("Could not establish connection")||b.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:s!==l?`Navigated to ${t.pageUrl} — but the in-page highlighter couldn't attach (${c}).`:c}}function Z(t){try{return new URL(t).origin}catch{return""}}function ct(t,a,r){return new Promise(o=>{let s=!1;const l=setTimeout(()=>{s||(s=!0,chrome.tabs.onUpdated.removeListener(i),o(!1))},r);function i(n,c,v){if(n!==t||c.status!=="complete")return;const h=Z(v.url??""),b=Z(a);b&&h&&h!==b||s||(s=!0,clearTimeout(l),chrome.tabs.onUpdated.removeListener(i),o(!0))}chrome.tabs.onUpdated.addListener(i)})}function ce(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 dt(t){return t.length>70?t.slice(0,67)+"...":t}function ut(t){try{const a=new Date(t),r=new Date,o=a.toDateString()===r.toDateString(),s=new Date(r);s.setDate(s.getDate()-1);const l=a.toDateString()===s.toDateString(),i=a.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"});return o?`today, ${i}`:l?`yesterday, ${i}`:`${a.toLocaleDateString(void 0,{month:"short",day:"numeric"})}, ${i}`}catch{return t}}function pt(){const{report:t}=Q(),a=S(d=>d.componentId),r=S(d=>d.siteCrawlReport),[o,s]=p.useState(!1),[l,i]=p.useState(new Set),[n,c]=p.useState(0),v=p.useRef(""),[h,b]=p.useState(!1),[x,m]=p.useState("claude-sonnet-4-6");p.useEffect(()=>{(async()=>{const w=(await chrome.storage.local.get(le))[le];v.current=(w==null?void 0:w.apiKey)??"",b(!!(w!=null&&w.apiKey)),w!=null&&w.model&&m(w.model)})()},[]);const f=me({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||i(new Set);return}try{const w=await ve([f]);if(d)return;i(new Set(w.map(k=>k.criterionId)))}catch{d||i(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:()=>s(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(T=>l.has(T.criterionId)).length,k=d-w;return w===0?`${d} criteri${d===1?"on":"a"} need${d===1?"s":""} your judgment`:k===0?`${d} criteri${d===1?"on":"a"} verified — re-crawl to lift the grade`:`${w} of ${d} verified · ${k} 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(vt,{criterionId:d.criterionId,title:d.title,state:d.state,evidence:d.evidence,targetComponentId:f,apiKeyRef:v,apiKeyPresent:h,model:x,onVerdictChange:()=>c(w=>w+1)},d.criterionId))]})]})}function vt({criterionId:t,title:a,state:r,evidence:o,targetComponentId:s,apiKeyRef:l,apiKeyPresent:i,model:n,onVerdictChange:c}){const[v,h]=p.useState(null),[b,x]=p.useState(""),[m,f]=p.useState(!1),[j,d]=p.useState(null),[w,k]=p.useState(null),[T,g]=p.useState(!0),[R,C]=p.useState(!1),[I,U]=p.useState(null),[P,E]=p.useState(null),[u,y]=p.useState(null),N={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 A=!1;return(async()=>{if(!s){A||g(!1);return}try{const O=(await ve([s])).find(V=>V.criterionId===t);if(A)return;k(O?{verdict:O.verdict,note:O.note,verifiedAt:O.verifiedAt}:null)}catch{A||k(null)}finally{A||g(!1)}})(),()=>{A=!0}},[t,s]);async function L(){if(s){f(!0),d(null);try{await Ve(s,t),k(null),c()}catch(A){d(A instanceof Error?A.message:String(A))}finally{f(!1)}}}const D=st.get(t),H=D==null?void 0:D.shortDescription,ae=D==null?void 0:D.understandingSlug,ne=it(t);async function xe(){if(!l.current){E("Set an Anthropic API key in extension Options first.");return}C(!0),E(null);try{const F=`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 je({apiKey:l.current,model:n,messages:[{role:"user",content:F}],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});U(O.text),y(O.costUsd)}catch(A){E(A instanceof Error?A.message:String(A))}finally{C(!1)}}async function ke(A){if(!s){d("No componentId available — re-run an audit first.");return}if(!b.trim()){d("Note is required — describe what you checked and why this verdict applies.");return}f(!0),d(null);const F=new Date().toISOString(),O=b.trim();try{await _e({componentId:s,criterionId:t,verdict:A,note:O,verifiedAt:F}),k({verdict:A,note:O,verifiedAt:F}),h(null),x(""),c()}catch(V){d(V instanceof Error?V.message:String(V))}finally{f(!1)}}if(w){const F={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:F.bg,border:`1px solid ${F.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:F.ink},children:["✓ ",F.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 ",ut(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 T?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:N[r]}),ne&&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:ne.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((A,F)=>e.jsx(ht,{ev:A},`${A.pageUrl}::${A.selector??""}::${F}`))})]}),e.jsxs("div",{style:{display:"flex",gap:"var(--v2-pad-3)",marginTop:"var(--v2-pad-2)",flexWrap:"wrap",alignItems:"center"},children:[ae&&e.jsx("a",{href:ot(ae),target:"_blank",rel:"noreferrer noopener",style:{fontSize:11,color:"var(--v2-ink-secondary)",textDecoration:"underline",textUnderlineOffset:2},children:"Read W3C guidance ↗"}),i&&e.jsx("button",{type:"button",onClick:xe,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…":I?"Re-explain with AI":"Explain with AI ↗"})]}),(I||P)&&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:[I&&e.jsx("p",{style:{margin:0,fontSize:12,color:"var(--v2-ink-primary)",lineHeight:1.55,whiteSpace:"pre-wrap"},children:I}),P&&e.jsx("p",{role:"alert",style:{margin:0,fontSize:11,color:"var(--v2-critical)"},children:P}),u!==null&&e.jsxs("p",{className:"v2-mono",style:{margin:"4px 0 0",fontSize:10,color:"var(--v2-ink-tertiary)"},children:["$",u.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:b,onChange:A=>x(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: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:()=>ke(v),disabled:m||!b.trim(),children:m?"Saving…":`Confirm ${v.toUpperCase()}`})})]})]})}function ht({ev:t}){const[a,r]=p.useState(!1),[o,s]=p.useState(null);async function l(){r(!0),s(null);try{const i=await lt({pageUrl:t.pageUrl,selector:t.selector});i.ok?t.selector?i.found?s({kind:"ok",text:`Element highlighted (${i.matchCount} match${i.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 ${ce(t.pageUrl)} — no element selector available; verify manually.`}):s({kind:"err",text:i.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:ce(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:dt(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 gt(){const{report:t,resolvedFails:a}=Q(),r=S(u=>u.siteCrawlReport),o=S(u=>u.siteCrawlStatus),s=S(u=>u.siteCrawlError),l=S(u=>u.status),i=o==="running",c=i||l==="running"&&!i,v=!!t&&!r,[h,b]=p.useState(null);p.useEffect(()=>{let u=!1;return chrome.tabs.query({active:!0,currentWindow:!0}).then(y=>{var N;u||b(((N=y[0])==null?void 0:N.url)??null)}),()=>{u=!0}},[]);const[x,m]=p.useState(!1);function f(u,y=!1){u.startUrl&&(S.getState().setSiteCrawlStatus("running"),S.getState().setSiteCrawlReport(null),S.getState().setSiteCrawlError(null),ie({type:"START_SITE_CRAWL",startUrl:u.startUrl,maxPages:u.maxPages,...u.includeRegex?{includeRegex:u.includeRegex}:{},...u.excludeRegex?{excludeRegex:u.excludeRegex}:{},...y?{verifyFixesOnly:!0}:{}}))}function j(){ie({type:"START_AUDIT",mode:"full-page"}),S.getState().startNewScan()}const[d,w]=p.useState(!1),[k,T]=p.useState(null),[g,R]=p.useState(null);async function C(){w(!0),T(null),R(null);const u=(t==null?void 0:t.siteGrade)??"A";try{const y=await W({type:"REGRADE_SITE_CRAWL"});if((y==null?void 0:y.ok)===!0)setTimeout(()=>{var D;const L=((D=S.getState().siteCrawlReport)==null?void 0:D.siteGrade)??u;R({prevGrade:u,nextGrade:L,at:Date.now()})},0);else{const L=(y==null?void 0:y.reason)??"Regrade failed.";T(L)}}catch(y){T(y instanceof Error?y.message:String(y))}finally{w(!1)}}if(p.useEffect(()=>{if(!g)return;const u=setTimeout(()=>R(null),6e3);return()=>clearTimeout(u)},[g]),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:i?e.jsx(tt,{}):e.jsx(rt,{})});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(oe,{initialUrl:h??"",isRunning:c,onCrawl:u=>f(u,!1),onAuditThisPage:j})]});const I=a.length,U=(t.totalWalkthroughFindings??0)+t.totalUniqueViolations+I,P=(t.walkthroughAcknowledgements??[]).length,E=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(ft,{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 N;const u=U+E,y=((N=t.blockingCriteria)==null?void 0:N.length)??0;return u===0&&y===0?"All clear — nothing open.":u===0&&y>0?`Visible findings clear — ${y} criteri${y===1?"on":"a"} still need${y===1?"s":""} your judgment.`:`${u} finding${u===1?"":"s"} to address.`})()}),e.jsx(yt,{openCount:U,reviewCount:E,verifiedCount:P,axeCount:t.totalUniqueViolations,walkthroughCount:t.totalWalkthroughFindings??0,autoCount:I}),h&&!mt(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(u=>!u),"aria-expanded":x,title:"Open crawl setup to audit the whole site instead",children:x?"Hide crawl options":"Crawl whole site"})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary",onClick:C,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(u=>!u),"aria-expanded":x,children:x?"Hide options":"Adjust options"})]}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:()=>{Ce(),S.getState().setSiteCrawlReport(null),S.getState().setSiteCrawlError(null),Ge(null).catch(()=>{})},title:"Wipe these results so you can start fresh",style:{marginLeft:"auto"},children:"Clear results"})]}),k&&e.jsx("p",{role:"alert",style:{margin:"var(--v2-pad-2) 0 0",fontSize:11,color:"var(--v2-critical)"},children:k}),g&&!k&&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(pt,{}),x&&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(oe,{initialUrl:t.startUrl,isRunning:c,onCrawl:u=>f(u,!1),onVerifyFixes:u=>f(u,!0),onAuditThisPage:j})})]})}function mt(t,a){try{return new URL(t).origin===new URL(a).origin}catch{return!1}}function ft({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 yt({openCount:t,reviewCount:a,verifiedCount:r,axeCount:o,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(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:s,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 bt=new Set(["2.4.3","2.1.2","2.4.7","1.3.2","1.4.11","2.5.3"]);function de(t){return bt.has(t)}async function ue(t){var o,s;const a=S.getState();if(a.componentId&&((o=a.results[0])==null?void 0:o.pageUrl)===t)return a.componentId;const r=await he();return((s=r==null?void 0:r.find(l=>l.url===t))==null?void 0:s.componentId)??null}async function xt(t,a){var l;const r=S.getState(),o=[];if(r.componentId&&r.results.length>0){const i=(l=r.results[0])==null?void 0:l.pageUrl,n=a.find(c=>c.url===i);if(n){for(const c of r.results)for(const v of c.violations)v.ruleId===t&&v.target.selector===n.selector&&o.push({componentId:r.componentId,matchKey:v.matchKey});if(o.length>0)return o}}const s=await he()??[];for(const i of a){const n=s.find(c=>c.url===i.url);if(n)for(const c of n.results)for(const v of c.violations)v.ruleId===t&&v.target.selector===i.selector&&o.push({componentId:n.componentId,matchKey:v.matchKey})}return o}function kt({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(wt,{row:t}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx(St,{row:t}),e.jsx(jt,{row:t})]}),e.jsx(Ct,{})]}),e.jsx("div",{style:{padding:"0 var(--v2-pad-4) var(--v2-pad-4)",borderTop:"1px solid var(--v2-border)"},children:e.jsx(Rt,{row:t})})]})}function wt({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 St({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 jt({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 Ct(){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 Rt({row:t}){return t.kind==="walkthrough-fail"?e.jsx(It,{row:t}):t.kind==="walkthrough-ack"?e.jsx(At,{row:t}):t.kind==="needs-review"?e.jsx(Nt,{row:t}):t.kind==="auto-contrast"?e.jsx(Tt,{row:t}):e.jsx(Et,{row:t})}function Tt({row:t}){const[a,r]=p.useState(!1),[o,s]=p.useState(!1),[l,i]=p.useState(""),[n,c]=p.useState(!1),[v,h]=p.useState(!1),[b,x]=p.useState(null),m=ge(t.ruleId);async function f(){if(c(!0),x(null),!l.trim()){x("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 pe(t.pageUrl)).find(k=>k.ruleId===t.ruleId&&k.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 qe(w),h(!0),r(!1)}catch(j){x(j instanceof Error?j.message:String(j))}finally{c(!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(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(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(ye,{summary:m.summary,snippet:m.snippet}),a&&e.jsx(ee,{note:l,setNote:i,busy:n,err:b,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."}),b&&!a&&e.jsx(X,{message:b})]})]})}function It({row:t}){const[a,r]=p.useState(!1),[o,s]=p.useState(""),[l,i]=p.useState(!1),[n,c]=p.useState(!1),[v,h]=p.useState(!1),[b,x]=p.useState(null),[m,f]=p.useState(null),j=de(t.criterion),d=Re();async function w(){if(i(!0),f(null),!o.trim()){f("Note is required — explain how you manually verified this."),i(!1);return}try{const T=await ue(t.pageUrl);if(!T){f("Could not find this page in the audit data. Re-run the audit and try again.");return}await Ke({componentId:T,criterionId:t.criterion,pageUrl:t.pageUrl,note:o.trim(),acknowledgedAt:new Date().toISOString(),verdictAtAck:t.verdict}),c(!0),r(!1)}catch(T){f(T instanceof Error?T.message:String(T))}finally{i(!1)}}async function k(){var T;h(!0),x(null),f(null);try{const R=(T=(await chrome.tabs.query({active:!0,currentWindow:!0}))[0])==null?void 0:T.id;if(!R){f("Open the audited page in your active tab to re-run.");return}const C=await ue(t.pageUrl);if(!C){f("Could not find this page in the audit data.");return}if(!de(t.criterion)){f(`Re-run is only available for interactive criteria. ${t.criterion} is not supported.`);return}const U=await W({type:"INTERACTIVE_AUDIT_REQUEST",criterionId:t.criterion,tabId:R,componentId:C,pageUrl:t.pageUrl});if(!U.ok){f(U.error??"Re-run failed.");return}x(`Re-run verdict: ${U.verdict??"unknown"}. Re-audit the page to refresh this list.`)}catch(g){f(g instanceof Error?g.message:String(g))}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(te,{}):e.jsxs(e.Fragment,{children:[e.jsxs(re,{children:[j&&e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:k,disabled:v||!d,title:d?void 0:"AI walkthroughs need an Anthropic API key. Add one in Settings → AI.",children:v?"Re-running…":"Re-run walkthrough"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary v2-btn-sm",onClick:()=>r(T=>!T),"aria-expanded":a,children:a?"Cancel":"Mark verified manually"})]}),b&&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:b}),a&&e.jsx(ee,{note:o,setNote:s,busy:l,err:m,onConfirm:w,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(X,{message:m})]})]})}function At({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 Nt({row:t}){return e.jsx(fe,{row:t,kind:"needs-review"})}function Et({row:t}){return e.jsx(fe,{row:t,kind:"axe"})}function fe({row:t,kind:a}){const[r,o]=p.useState(!1),[s,l]=p.useState(""),[i,n]=p.useState(!1),[c,v]=p.useState(!1),[h,b]=p.useState(!1),[x,m]=p.useState(null),f=ge(t.ruleId);async function j(){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 xt(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 Ye({componentId:w.componentId,matchKey:w.matchKey,ruleId:t.ruleId,note:s.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"]})]})}),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:()=>b(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(ye,{summary:f.summary,snippet:f.snippet}),r&&e.jsx(ee,{note:s,setNote:l,busy:i,err:x,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"}`}),x&&!r&&e.jsx(X,{message:x})]})]})}function ee({note:t,setNote:a,busy:r,err:o,onConfirm:s,hint:l,placeholder:i,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:i,rows:3,style:{width:"100%",fontFamily:"var(--v2-body)",fontSize:12,lineHeight:1.5,padding:"var(--v2-pad-2) var(--v2-pad-3)",background:"var(--v2-bg)",color:"var(--v2-ink-primary)",border:"1px solid var(--v2-border-strong)",borderRadius:4,resize:"vertical",minHeight:70},autoFocus:!0}),o&&e.jsx(X,{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:s,disabled:r||!t.trim(),children:r?"Saving…":n})})]})}function ye({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 X({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 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 Ut(){const{report:t,resolvedFails:a}=Q(),[r,o]=p.useState("open"),s=p.useMemo(()=>t?Dt(t.pages,t.findingGroups??[],a):[],[t,a]),l=p.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 i={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(zt,{filter:r,setFilter:o,counts:i})]}),l.length===0?e.jsx(Pt,{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(kt,{row:n})},n.key))})]})}function zt({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(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 Pt({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 Dt(t,a,r=[]){const o=[];for(const i of a)i.needsReview?o.push({kind:"needs-review",key:`nr::${i.ruleId}::${i.representativeSelector}`,criterion:i.wcagCriterion,ruleId:i.ruleId,description:i.axeDescription,selector:i.representativeSelector,failureSummary:i.failureSummary,pages:i.pages,group:i}):o.push({kind:"axe",key:`axe::${i.ruleId}::${i.representativeSelector}`,criterion:i.wcagCriterion,ruleId:i.ruleId,impact:i.impact,description:i.axeDescription,selector:i.representativeSelector,pages:i.pages,isShared:i.isShared});const s=new Set;for(const i of t){for(const n of i.walkthroughFindings??[]){const c=`wt-fail::${n.criterionId}::${n.pageUrl}`;s.has(c)||(s.add(c),o.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 i.walkthroughAcknowledgements??[]){const c=`wt-ack::${n.criterionId}::${n.pageUrl}`;s.has(c)||(s.add(c),o.push({kind:"walkthrough-ack",key:c,criterion:n.criterionId,verdict:n.verdict,reasoning:n.reasoning,pageUrl:n.pageUrl}))}}for(const i of r)o.push({kind:"auto-contrast",key:`auto::${i.ruleId}::${i.selector}::${i.pageUrl}`,criterion:i.wcagCriterion??"1.4.3",ruleId:i.ruleId,impact:"serious",selector:i.selector,pageUrl:i.pageUrl,reasoning:i.reasoning});const l={critical:0,serious:1,moderate:2,minor:3,"needs-review":4,ack:5};return o.sort((i,n)=>{const c=i.kind==="walkthrough-ack"?l.ack:i.kind==="needs-review"?l["needs-review"]:l[i.impact],v=n.kind==="walkthrough-ack"?l.ack:n.kind==="needs-review"?l["needs-review"]:l[n.impact];return(c??99)-(v??99)}),o}function Ft({open:t,onClose:a}){const{report:r}=Q(),o=S(g=>g.siteCrawlReport),s=S(g=>g.results),l=S(g=>g.componentId),i=S(g=>g.delta),n=!!o,c=n||s.length>0,v=me({storeComponentId:l,storeCrawlReport:o,pageUrls:(r==null?void 0:r.pages.map(g=>g.url))??[]}),[h,b]=p.useState({}),x=p.useRef(null);p.useEffect(()=>{var R;if(!t)return;const g=C=>{C.key==="Escape"&&a()};return document.addEventListener("keydown",g),(R=x.current)==null||R.focus(),()=>document.removeEventListener("keydown",g)},[t,a]);function m(g,R){b(C=>({...C,[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(!s.length)throw new Error("No audit results yet");await et({results:s,componentId:l??null,delta:i}),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:C}=await import("./site-report-renderer-DA-9wVvE.js");return{renderSiteReportHtml:C}},__vite__mapDeps([0,1,2,3,4,5])),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(!s.length)throw new Error("No audit results yet");const{toHtmlPrint:g}=await q(async()=>{const{toHtmlPrint:C}=await import("./scheduled-audit-runner-QcMYcqgA.js").then(I=>I.aV);return{toHtmlPrint:C}},__vite__mapDeps([1,2,3,4,5])),R=g(s,i??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,C){m(g,{state:"busy"});try{const I=await W({type:"EXPORT_REQUEST",format:g,results:n?[]:s,...i&&!n?{delta:i}:{},...n?{siteCrawlSource:!0}:{},...v?{auditTargetId:v}:{}});if(!(I!=null&&I.content))throw new Error("Empty response");await Y(I.content,C,"text/html"),m(g,{state:"done",message:`${R} opened in a new tab.`})}catch(I){m(g,{state:"error",message:I instanceof Error?I.message:String(I)})}}async function w(){const{createZip:g}=await q(async()=>{const{createZip:E}=await import("./zip-encoder-CtULHXx_.js");return{createZip:E}},[]),{renderSiteReportHtml:R}=await q(async()=>{const{renderSiteReportHtml:E}=await import("./site-report-renderer-DA-9wVvE.js");return{renderSiteReportHtml:E}},__vite__mapDeps([0,1,2,3,4,5])),C=[],I=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"}],U=I.length+(n&&r?1:0);let P=0;m("zip",{state:"busy",progress:{current:0,total:U,label:"Starting…"}});try{if(n&&r){P++,m("zip",{state:"busy",progress:{current:P,total:U,label:"site-report.html (client-side)"}});try{C.push({name:"site-report.html",content:R(r)})}catch{}}for(const{format:L,filename:D}of I){P++,m("zip",{state:"busy",progress:{current:P,total:U,label:D}});try{const H=await W({type:"EXPORT_REQUEST",format:L,results:n?[]:s,...i&&!n?{delta:i}:{},...n?{siteCrawlSource:!0}:{},...v?{auditTargetId:v}:{}});H!=null&&H.content&&C.push({name:D,content:H.content})}catch{}}if(C.length===0)throw new Error("All exports failed");const E=g(C),u=new Blob([E],{type:"application/zip"}),y=URL.createObjectURL(u),N=document.createElement("a");N.href=y,N.download=n?"wcagcheckr-site-bundle.zip":"wcagcheckr-page-bundle.zip",N.click(),setTimeout(()=>URL.revokeObjectURL(y),6e4),m("zip",{state:"done",message:`Downloaded ${C.length} file${C.length===1?"":"s"}.`})}catch(E){m("zip",{state:"error",message:E instanceof Error?E.message:String(E)})}}function k(g){S.getState().setView(g),chrome.storage.local.set({v2UiEnabled:!1}),a()}function T(){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:x,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(M,{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(M,{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(M,{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(M,{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(M,{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(z,{label:"State matrix",description:"Per-state findings grid (hover · focus · dark · RTL · etc.)",onClick:()=>k("matrix")}),e.jsx(z,{label:"Per-area compliance",description:"9 sub-grade areas with drill-in: Color & contrast, Keyboard, etc.",onClick:()=>k("report")}),e.jsx(z,{label:"Baseline delta",description:"New vs. persistent vs. fixed vs. acknowledged since the last baseline.",onClick:()=>k("delta")}),e.jsx(z,{label:"Forensic log",description:"Anchored audit history with chain-of-custody.",onClick:()=>k("forensic")}),e.jsx(z,{label:"Risk dashboard",description:"Lawsuit / conformance risk tiers with prioritized actions.",onClick:()=>k("risk")}),e.jsx(z,{label:"WCAG 3 mapping",description:"Outcome-level grouping per WCAG 3 snapshot.",onClick:()=>k("wcag3")}),e.jsx(z,{label:"WCAG-EM verdicts",description:"Formal per-criterion verdict map.",onClick:()=>k("compliance")}),e.jsx(z,{label:"Schedules",description:"Recurring audit management with email alerts.",onClick:()=>k("schedules")}),e.jsx(z,{label:"Copilot chat",description:"Anthropic-powered Q&A over your audit context.",onClick:()=>k("copilot")}),e.jsx(z,{label:"Accessibility tree",description:"Inspect the live aria tree as assistive tech sees it.",onClick:()=>k("ax-tree")}),e.jsx(z,{label:"Design tokens",description:"CSS-token / design-system audit.",onClick:()=>k("tokens")}),e.jsx(z,{label:"Guided audit",description:"13 manual IGT workflows (keyboard, screen reader, etc.).",onClick:()=>k("guided")}),e.jsx(z,{label:"Per-component scorecard",description:"Custom rules, baselines, per-component drill-in.",onClick:()=>k("scorecard")}),e.jsx(z,{label:"User journey flows",description:"Multi-step audit recordings.",onClick:()=>k("flows")}),e.jsx(z,{label:"Activity / IGT runs",description:"Manual workflow run history.",onClick:()=>k("activity")})]}),e.jsx(M,{title:"Settings",children:e.jsx($,{status:void 0,label:"Open settings",description:"Matrix preset, AI config, axe rule overrides, breakpoints, auto-export.",onClick:T})})]})]})]}):null}async function Y(t,a,r){const o=new Blob([t],{type:r}),s=URL.createObjectURL(o);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 M({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 s=(r==null?void 0:r.state)==="busy",l=(r==null?void 0:r.state)==="done",i=(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: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}),s&&(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]}),i&&(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 z({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 $t(){var l,i;const t=S(n=>n.siteCrawlReport),a=S(n=>n.results),[r,o]=p.useState(!1),s=(t==null?void 0:t.startUrl)??((l=a[0])==null?void 0:l.pageUrl)??((i=a[0])==null?void 0:i.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",alignItems:"center",gap:"var(--v2-pad-2)",marginLeft:"auto"},children:[e.jsx(Te,{}),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(Ft,{open:r,onClose:()=>o(!1)})]})}function Wt(){return p.useEffect(()=>{const t=Ie(),r=new URLSearchParams(window.location.search).get("context")==="overlay"?null:chrome.runtime.connect({name:"sidepanel-tracker"}),o=Ae();Ne({forceRefresh:!0}).catch(()=>{}),Ee().catch(()=>{}),Ue().catch(()=>{}),ze().catch(()=>{}),Pe().catch(()=>{}),Ze().then(l=>{S.getState().setAcknowledgedKeys(new Set(l.map(i=>i.matchKey)))}).catch(()=>{});let s=!1;return Qe().then(l=>{s||l&&S.setState({siteCrawlReport:l})}).catch(()=>{}),()=>{s=!0,o();try{t.disconnect()}catch{}try{r==null||r.disconnect()}catch{}}},[]),e.jsxs("div",{className:"v2-root",children:[e.jsx($t,{}),e.jsx(De,{}),e.jsx(Fe,{}),e.jsxs("main",{id:"main-content","aria-label":"wcagcheckr findings",children:[e.jsx(gt,{}),e.jsx(Ut,{})]})]})}Je("side-panel");function Lt(){const[t,a]=p.useState(null);return p.useEffect(()=>{let r=!1;function o(l){const i=l.userMode,n=!!l.v2UiEnabled;let c;i==="owner"||i==="power"||i==="dev"?c=i:i==="dev"&&n?c="power":c=n?"power":"owner",r||a(c)}chrome.storage.local.get(["userMode","v2UiEnabled"]).then(o).catch(()=>a("owner"));const s=(l,i)=>{i==="local"&&(!("userMode"in l)&&!("v2UiEnabled"in l)||chrome.storage.local.get(["userMode","v2UiEnabled"]).then(o))};return chrome.storage.onChanged.addListener(s),()=>{r=!0,chrome.storage.onChanged.removeListener(s)}},[]),t===null?null:t==="power"?e.jsx(Wt,{}):e.jsx(We,{})}const be=document.getElementById("root");if(!be)throw new Error("side-panel: #root not found");we(be).render(e.jsx(Se.StrictMode,{children:e.jsx($e,{children:e.jsx(Lt,{})})}));
|