@wcag-checkr/ci 1.0.0-rc.67 → 1.0.0-rc.68
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{ErrorBoundary--cCm9hHT.js → ErrorBoundary-Mujc_UjK.js} +4 -4
- package/dist/assets/{devtools-panel-DnqfdmW9.js → devtools-panel-BKrFw7jn.js} +1 -1
- package/dist/assets/{side-panel-BCDAUNkn.js → side-panel-CCKVEmz3.js} +1 -1
- package/dist/devtools/panel.html +2 -2
- package/dist/manifest.json +2 -2
- package/dist/side-panel/side-panel.html +2 -2
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/forensic-log-DaUcnSG0.js","assets/crash-reporter-Dc5lvxvY.js","assets/state-PELIq3oj.js","assets/site-report-renderer-CgrGjXZe.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
var as=Object.defineProperty;var ns=(t,s,a)=>s in t?as(t,s,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[s]=a;var at=(t,s,a)=>ns(t,typeof s!="symbol"?s+"":s,a);import{R as je,i as se,r as x,j as e,M as me,C as qe,l as rs,o as Ye,t as Xe,m as At,s as Ct,k as Pe}from"./styles-pWj24Nu1.js";import{_ as Ie}from"./preload-helper-D7HrI6pR.js";import{o as ee,r as q,s as H,c as Rt,b as ae,d as Ne}from"./crash-reporter-Dc5lvxvY.js";import{g as is,a as X,u as os,b as ls,c as cs,d as Et,e as Re,f as Tt,l as ds,h as It,A as Y,s as us,i as Ze,j as ps,O as hs,k as ms,m as xs,n as nt,o as gs,p as $t,q as fs,r as bs,t as vs,v as ys,T as js,w as ws,x as Ns}from"./forensic-log-DaUcnSG0.js";import{B as Ge,i as _t,b as Lt,T as Ut}from"./state-PELIq3oj.js";const rt=t=>{let s;const a=new Set,n=(p,l)=>{const u=typeof p=="function"?p(s):p;if(!Object.is(u,s)){const h=s;s=l??(typeof u!="object"||u===null)?u:Object.assign({},s,u),a.forEach(f=>f(s,h))}},r=()=>s,c={setState:n,getState:r,getInitialState:()=>d,subscribe:p=>(a.add(p),()=>a.delete(p))},d=s=t(n,r,c);return c},ks=t=>t?rt(t):rt,Ss=t=>t;function As(t,s=Ss){const a=je.useSyncExternalStore(t.subscribe,je.useCallback(()=>s(t.getState()),[t,s]),je.useCallback(()=>s(t.getInitialState()),[t,s]));return je.useDebugValue(a),a}const it=t=>{const s=ks(t),a=n=>As(s,n);return Object.assign(a,s),a},Cs=t=>t?it(t):it,g=Cs(t=>({status:"idle",progress:null,results:[],delta:null,componentId:null,errorMessage:null,freshThisSession:!1,baselineList:[],tier:"trial",trialDaysRemaining:null,seatsUsed:null,seatsTotal:null,planCode:null,licenseDaysRemaining:null,pastDue:!1,messages:[],unreadMessageCount:0,criticalUnacked:!1,view:"matrix",userMode:null,siteCrawlStatus:"idle",siteCrawlProgress:null,siteCrawlReport:null,siteCrawlError:null,pinnedMatchKey:null,pinnedFound:!0,aiFailure:null,aiProgress:null,acknowledgedKeys:new Set,setStatus:s=>t({status:s}),startNewScan:()=>t({status:"running",results:[],delta:null,errorMessage:null,progress:null,componentId:null,pinnedMatchKey:null,pinnedFound:!0,aiFailure:null,aiProgress:null}),setProgress:s=>t({progress:s}),setResults:(s,a,n)=>t({results:s,delta:a,componentId:n,status:"complete",errorMessage:null,freshThisSession:!0,aiProgress:null,pinnedMatchKey:null,pinnedFound:!0}),setDelta:s=>t({delta:s}),setError:s=>t({errorMessage:s,status:"failed"}),setBaselineList:s=>t({baselineList:s}),clearResults:()=>t({results:[],delta:null,componentId:null,errorMessage:null,progress:null,status:"idle",freshThisSession:!1,pinnedMatchKey:null,pinnedFound:!0,aiFailure:null,aiProgress:null}),setTier:(s,a)=>t({tier:s,trialDaysRemaining:(a==null?void 0:a.trialDaysRemaining)??null,seatsUsed:(a==null?void 0:a.seatsUsed)??null,seatsTotal:(a==null?void 0:a.seatsTotal)??null,planCode:(a==null?void 0:a.planCode)??null,licenseDaysRemaining:(a==null?void 0:a.licenseDaysRemaining)??null,pastDue:(a==null?void 0:a.pastDue)??!1}),setView:s=>t({view:s}),setUserMode:s=>t({userMode:s}),setSiteCrawlStatus:s=>t({siteCrawlStatus:s}),setSiteCrawlProgress:s=>t({siteCrawlProgress:s}),setSiteCrawlReport:s=>t({siteCrawlReport:s}),setSiteCrawlError:s=>t({siteCrawlError:s}),setPinned:(s,a=!0)=>t({pinnedMatchKey:s,pinnedFound:a}),setAiFailure:s=>t({aiFailure:s}),clearAiFailure:()=>t({aiFailure:null}),setAiProgress:s=>t({aiProgress:s}),setAcknowledgedKeys:s=>t({acknowledgedKeys:s}),markAcknowledged:s=>t(a=>({acknowledgedKeys:new Set(a.acknowledgedKeys).add(s)})),markUnacknowledged:s=>t(a=>{const n=new Set(a.acknowledgedKeys);return n.delete(s),{acknowledgedKeys:n}}),setMessages:(s,a,n)=>t({messages:s,unreadMessageCount:a,criticalUnacked:n}),applyMessageAck:(s,a)=>t(n=>{const r=n.messages.map(c=>c.id!==s?c:a==="seen"?{...c,seen:!0}:a==="dismissed"?{...c,dismissed:!0}:a==="acknowledged"?{...c,acknowledged:!0}:a==="clicked"?{...c,clicked:!0}:c).filter(c=>c.severity==="critical"?!c.acknowledged:!c.dismissed),i=r.filter(c=>!c.seen).length,o=r.some(c=>c.severity==="critical"&&!c.acknowledged);return{messages:r,unreadMessageCount:i,criticalUnacked:o}})})),$e="sidePanel:lastAudit";function Rs(){const t=[];return t.push(ee("AUDIT_PROGRESS_EVENT",s=>{const a=g.getState().status==="running";g.getState().setProgress({current:s.current,total:s.total,currentState:s.currentState}),g.getState().setStatus("running"),a||se.polite(`Audit running, scanning ${s.total} state${s.total===1?"":"s"}.`)})),t.push(ee("AUDIT_COMPLETE_EVENT",s=>{var i;g.getState().setResults(s.results,s.delta,s.componentId);const a=s.results.reduce((o,c)=>o+c.violations.length,0),n=((i=s.delta)==null?void 0:i.newCount)??0,r=s.delta?`Audit complete. ${n} new violation${n===1?"":"s"} versus baseline.`:`Audit complete. ${a} violation${a===1?"":"s"} found across ${s.results.length} state${s.results.length===1?"":"s"}.`;se.polite(r),Es({results:s.results,delta:s.delta,componentId:s.componentId})})),t.push(ee("AUDIT_FAILED_EVENT",s=>{g.getState().setError(s.error.message)})),t.push(ee("AI_AUGMENTATION_PROGRESS_EVENT",s=>{const a=g.getState().aiProgress;g.getState().setAiProgress({currentCheckLabel:s.currentCheckLabel,current:s.current,total:s.total,candidatesDone:s.candidatesDone,candidatesTotal:s.candidatesTotal}),a||se.polite(`AI augmentation running ${s.total} check${s.total===1?"":"s"}.`)})),t.push(ee("AI_AUGMENTATION_FAILED_EVENT",s=>{g.getState().setAiFailure({severity:s.severity,reason:s.reason,checksAttempted:s.checksAttempted,checksSucceeded:s.checksSucceeded,checksErrored:s.checksErrored,errorDetails:s.errorDetails})})),t.push(ee("SCORECARD_UPDATED_EVENT",()=>{_e()})),t.push(ee("LICENSE_CHANGED_EVENT",()=>{Dt()})),t.push(ee("SITE_CRAWL_PROGRESS_EVENT",s=>{const a=g.getState();a.setSiteCrawlStatus("running"),a.setSiteCrawlProgress({current:s.current,total:s.total,url:s.url,lastViolations:s.violations}),s.status==="auditing"&&s.current===1&&se.polite(`Site crawl started, scanning up to ${s.total} pages.`)})),t.push(ee("SITE_CRAWL_COMPLETE_EVENT",s=>{const a=g.getState();a.setSiteCrawlStatus("complete"),a.setSiteCrawlReport(s.report),a.setSiteCrawlProgress(null),se.polite(`Site crawl complete. Grade ${s.report.siteGrade}, ${s.report.totalUniqueViolations} unique violation${s.report.totalUniqueViolations===1?"":"s"}.`)})),t.push(ee("SITE_CRAWL_FAILED_EVENT",s=>{const a=g.getState();a.setSiteCrawlStatus("failed"),a.setSiteCrawlError(s.error.message),a.setSiteCrawlProgress(null),se.assertive(`Site crawl failed: ${s.error.message}`)})),()=>t.forEach(s=>s())}async function Es(t){const s={...t,results:t.results.map(({screenshotDataUrl:a,...n})=>n)};try{await chrome.storage.local.set({[$e]:s})}catch(a){console.warn("[wire-messaging] persistLastAudit failed; results stay in-memory only",a)}}async function Ts(){const s=(await chrome.storage.local.get($e))[$e];s&&g.setState({results:s.results,delta:s.delta,componentId:s.componentId,status:"complete"})}async function Is(){await chrome.storage.local.remove($e)}async function et(){g.getState().clearResults(),await Is()}async function _e(){const t=await q({type:"BASELINE_LIST"});g.getState().setBaselineList(t.items)}async function Dt(t){const s=await q({type:"TIER_GET",forceRefresh:(t==null?void 0:t.forceRefresh)===!0});g.getState().setTier(s.tier,{trialDaysRemaining:s.trialDaysRemaining,seatsUsed:s.seatsUsed,seatsTotal:s.seatsTotal,planCode:s.planCode,licenseDaysRemaining:s.licenseDaysRemaining,pastDue:s.pastDue}),Ft()}async function Ft(){const{fetchMessages:t}=await Ie(async()=>{const{fetchMessages:n}=await Promise.resolve().then(()=>Ps);return{fetchMessages:n}},void 0),s=g.getState().userMode,a=await t(s);a&&g.getState().setMessages(a.messages,a.unreadCount,a.criticalUnacked)}async function $s(){const s=(await q({type:"SETTINGS_GET",key:"userMode"})).data,a=s==="owner"||s==="dev"?s:null;g.getState().setUserMode(a)}function _s(){return chrome.runtime.connect({name:"audit-keepalive"})}let Le=null;async function Ls(){if(Le===null)try{const t=await chrome.windows.getCurrent();typeof t.id=="number"&&(Le=t.id)}catch{}}function Ot(){if(Le===null)return;const t=chrome.sidePanel;!t||typeof t.open!="function"||t.open({windowId:Le}).catch(()=>{})}function le(t){Ot(),H(t)}function Us({onClose:t}){const[s,a]=x.useState(""),[n,r]=x.useState(""),[i,o]=x.useState(!0),[c,d]=x.useState(""),[p,l]=x.useState(!1),[u,h]=x.useState(null);async function f(m){var N;if(m.preventDefault(),!(!s.trim()||!n.trim())){l(!0),h(null);try{const C=await q({type:"SUPPORT_MESSAGE_REQUEST",subject:s.trim(),body:n.trim(),includeContext:i,replyEmail:c.trim()||void 0});C.success?(h({ok:!0,msg:`Sent (ref: ${C.ticketRef??"n/a"})`}),setTimeout(t,1200)):h({ok:!1,msg:((N=C.error)==null?void 0:N.message)??"Failed to send"})}finally{l(!1)}}}return e.jsxs("form",{onSubmit:f,className:"space-y-3 text-sm",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"support-subject",className:"block text-xs font-medium mb-1",children:"Subject"}),e.jsx("input",{id:"support-subject",type:"text",value:s,onChange:m=>a(m.target.value),required:!0,className:"w-full text-xs border border-slate-300 rounded px-2 py-1"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"support-body",className:"block text-xs font-medium mb-1",children:"Message"}),e.jsx("textarea",{id:"support-body",value:n,onChange:m=>r(m.target.value),required:!0,rows:6,className:"w-full text-xs border border-slate-300 rounded px-2 py-1"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"support-reply",className:"block text-xs font-medium mb-1",children:"Reply email (optional)"}),e.jsx("input",{id:"support-reply",type:"email",autoComplete:"email",value:c,onChange:m=>d(m.target.value),className:"w-full text-xs border border-slate-300 rounded px-2 py-1"})]}),e.jsxs("label",{className:"flex items-start gap-2 text-xs",children:[e.jsx("input",{type:"checkbox",checked:i,onChange:m=>o(m.target.checked),className:"mt-0.5"}),e.jsx("span",{className:"text-slate-600",children:"Include extension version, browser platform, and license tier (no URLs, page content, or audit data is sent)."})]}),u&&e.jsx("p",{id:"support-form-result",role:u.ok?"status":"alert",className:`text-xs ${u.ok?"text-green-700":"text-red-700"}`,children:u.msg}),e.jsxs("div",{className:"flex gap-2 justify-end",children:[e.jsx("button",{type:"button",onClick:t,className:"text-xs px-3 py-1 hover:bg-slate-100 rounded",children:"Cancel"}),e.jsx("button",{type:"submit",disabled:p,className:"text-xs px-3 py-1 bg-brand-500 text-white rounded disabled:opacity-50",children:p?"Sending…":"Send"})]})]})}function ot({onClick:t,ariaLabel:s,title:a,children:n,className:r}){return e.jsx("button",{onClick:t,"aria-label":s,title:a??s,className:`inline-flex items-center justify-center min-w-[24px] min-h-[24px] text-xs text-slate-500 hover:text-slate-900 ${r??""}`,children:n})}const Ue=Rt("messages-client"),Ds="https://api.wcagcheckr.com",Mt="wcagcheckr",Fs=1e4;function Os(){try{return chrome.runtime.getManifest().version}catch{return"0.0.0"}}async function Pt(t,s){const a=await is();if(!a)throw new Error("no_license_token");const n={...(s==null?void 0:s.headers)??{},Authorization:`Bearer ${a}`,"X-Extension-Version":Os()};return s!=null&&s.userMode&&(n["X-User-Mode"]=s.userMode),fetch(`${Ds}${t}`,{...s,headers:n,signal:AbortSignal.timeout(Fs)})}async function Ms(t){try{const s=await Pt(`/v1/products/${Mt}/messages`,{userMode:t??null});return s.ok?await s.json():(Ue.warn("fetchMessages http",s.status),null)}catch(s){return Ue.warn("fetchMessages failed",s),null}}async function ue(t,s){try{const a=await Pt(`/v1/products/${Mt}/messages/${t}/ack`,{method:"POST",body:JSON.stringify({action:s}),headers:{"content-type":"application/json"}});return a.ok?!0:(Ue.warn("ackMessage http",a.status,"action",s),!1)}catch(a){return Ue.warn("ackMessage failed",a),!1}}const Ps=Object.freeze(Object.defineProperty({__proto__:null,ackMessage:ue,fetchMessages:Ms},Symbol.toStringTag,{value:"Module"})),Gs=["http:","https:"];function Vs(t){try{const s=new URL(t);return Gs.includes(s.protocol)}catch{return!1}}function lt(t){const s=[];let a=0,n=0;for(;a<t.length;){if(t[a]==="["){const i=t.indexOf("]",a+1);if(i!==-1&&t[i+1]==="("){const o=t.indexOf(")",i+2);if(o!==-1){const c=t.slice(a+1,i),d=t.slice(i+2,o);Vs(d)?s.push(e.jsx("a",{href:d,target:"_blank",rel:"noopener",className:"text-brand-700 underline",children:c},`l-${n++}`)):s.push(e.jsx(x.Fragment,{children:c},`l-${n++}`)),a=o+1;continue}}}if(t[a]==="*"&&t[a+1]==="*"){const i=t.indexOf("**",a+2);if(i!==-1){s.push(e.jsx("strong",{children:t.slice(a+2,i)},`b-${n++}`)),a=i+2;continue}}if(t[a]==="*"&&t[a+1]!=="*"){const i=t.indexOf("*",a+1);if(i!==-1&&t[i+1]!=="*"){s.push(e.jsx("em",{children:t.slice(a+1,i)},`i-${n++}`)),a=i+1;continue}}let r=a+1;for(;r<t.length&&t[r]!=="*"&&t[r]!=="[";)r++;s.push(e.jsx(x.Fragment,{children:t.slice(a,r)},`t-${n++}`)),a=r}return s}function Gt({source:t}){const s=t.split(/\r?\n/),a=[];let n=[],r=[],i=0;function o(){if(r.length===0)return;const d=r.join(" ");a.push(e.jsx("p",{className:"leading-snug",children:lt(d)},`p-${i++}`)),r=[]}function c(){n.length!==0&&(a.push(e.jsx("ul",{className:"list-disc pl-5 space-y-0.5",children:n.map((d,p)=>e.jsx("li",{children:lt(d)},p))},`u-${i++}`)),n=[])}for(const d of s){const p=d.trimEnd();if(p===""){o(),c();continue}const l=/^[-*]\s+(.*)$/.exec(p);if(l){o(),n.push(l[1]);continue}c(),r.push(p)}return o(),c(),e.jsx("div",{className:"space-y-1.5",children:a})}const Ws={info:"bg-blue-500",promo:"bg-purple-500",warning:"bg-amber-500",critical:"bg-rose-500"},Bs={critical:"bg-rose-50 border-rose-200"};function Vt(){const t=g(h=>h.unreadMessageCount),s=g(h=>h.messages),a=g(h=>h.applyMessageAck),[n,r]=x.useState(!1),i=x.useRef(-1),[o,c]=x.useState(!1);x.useEffect(()=>{const h=s.filter(m=>!m.seen);if(h.length===0)return;const f=Math.max(...h.map(m=>m.id));if(f>i.current){i.current=f,c(!0);const m=setTimeout(()=>c(!1),1500);return()=>clearTimeout(m)}},[s]);async function d(){const h=s.filter(f=>!f.seen);if(h.length!==0)for(const f of h)a(f.id,"seen"),ue(f.id,"seen")}function p(){const h=!n;r(h),h&&d()}async function l(h){a(h.id,"dismissed"),await ue(h.id,"dismissed")}async function u(h){h.ctaUrl&&(a(h.id,"clicked"),ue(h.id,"clicked"),chrome.tabs.create({url:h.ctaUrl}).catch(()=>{window.open(h.ctaUrl,"_blank","noopener")}))}return e.jsxs("div",{className:"relative",children:[e.jsxs("button",{type:"button",onClick:p,"aria-label":t>0?`Notifications (${t} unread)`:"Notifications","aria-expanded":n,"aria-haspopup":"dialog",className:`relative grid place-items-center w-7 h-7 rounded text-slate-500 hover:bg-slate-100 hover:text-slate-700 focus-visible:outline focus-visible:outline-2 focus-visible:outline-brand-500 ${o?"animate-bell-pulse":""}`,title:t>0?`${t} new message${t===1?"":"s"}`:"No new messages",children:[e.jsx(Hs,{active:t>0}),t>0&&e.jsx("span",{"aria-hidden":"true",className:"absolute top-0.5 right-0.5 w-2 h-2 rounded-full bg-rose-500 ring-2 ring-white"})]}),n&&e.jsx(zs,{messages:s,onClose:()=>r(!1),onDismiss:l,onCtaClick:u})]})}function Hs({active:t}){return e.jsx("svg",{viewBox:"0 0 20 20",width:"16",height:"16","aria-hidden":"true",fill:"currentColor",className:t?"text-rose-500":"",children:e.jsx("path",{d:"M10 2a5 5 0 00-5 5v3l-1.6 2.4a1 1 0 00.84 1.6h11.52a1 1 0 00.84-1.6L15 10V7a5 5 0 00-5-5zm-1.5 13a1.5 1.5 0 003 0h-3z"})})}function zs({messages:t,onClose:s,onDismiss:a,onCtaClick:n}){const r=x.useRef(null);return x.useEffect(()=>{const i=c=>{r.current&&(r.current.contains(c.target)||s())},o=c=>{c.key==="Escape"&&s()};return document.addEventListener("mousedown",i),document.addEventListener("keydown",o),()=>{document.removeEventListener("mousedown",i),document.removeEventListener("keydown",o)}},[s]),e.jsxs("div",{ref:r,role:"dialog","aria-label":"Notifications",className:"absolute right-0 top-full mt-1 w-80 max-h-[420px] overflow-y-auto bg-white border border-slate-200 rounded shadow-lg z-50 text-xs",children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-slate-200",children:[e.jsx("span",{className:"font-medium",children:"Notifications"}),e.jsx("button",{type:"button",onClick:()=>{Ft()},className:"text-[11px] text-brand-700 hover:underline",children:"Refresh"})]}),t.length===0?e.jsx("div",{className:"p-4 text-center text-slate-500 text-[11px]",children:"No messages."}):e.jsx("ul",{className:"divide-y divide-slate-100",children:t.map(i=>e.jsx("li",{className:`p-3 ${i.seen?"":"bg-slate-50"}`,children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx("div",{className:`shrink-0 w-1 self-stretch rounded ${Ws[i.severity]}`,"aria-hidden":"true"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("div",{className:"font-medium text-slate-800",children:i.title}),i.dismissible&&i.severity!=="critical"&&e.jsx("button",{type:"button",onClick:()=>a(i),"aria-label":"Dismiss message",className:"text-slate-400 hover:text-slate-700 shrink-0",children:"✕"})]}),e.jsx("div",{className:"mt-1 text-slate-700",children:e.jsx(Gt,{source:i.bodyMd})}),i.ctaLabel&&i.ctaUrl&&e.jsx("button",{type:"button",onClick:()=>n(i),className:"mt-2 text-[11px] px-2 py-1 bg-brand-500 text-white rounded hover:bg-brand-600",children:i.ctaLabel}),e.jsx("div",{className:"mt-1 text-[10px] text-slate-400",children:new Date(i.createdAt).toLocaleString()})]})]})},i.id))})]})}function Wt(){const t=g(i=>i.messages),s=g(i=>i.applyMessageAck),a=t.find(i=>i.severity==="critical"&&!i.acknowledged);if(!a)return null;async function n(){s(a.id,"acknowledged"),await ue(a.id,"acknowledged")}async function r(){a.ctaUrl&&(s(a.id,"clicked"),ue(a.id,"clicked"),chrome.tabs.create({url:a.ctaUrl}).catch(()=>{}))}return e.jsxs("div",{role:"alert",className:`border-y ${Bs.critical} px-3 py-2 text-xs flex items-start gap-2`,children:[e.jsx("span",{"aria-hidden":"true",className:"text-rose-600 text-sm leading-none mt-0.5",children:"⚠"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-semibold text-rose-900",children:a.title}),e.jsx("div",{className:"mt-0.5 text-rose-900/90",children:e.jsx(Gt,{source:a.bodyMd})}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-2",children:[a.ctaLabel&&a.ctaUrl&&e.jsx("button",{type:"button",onClick:r,className:"text-[11px] px-2 py-1 bg-rose-600 text-white rounded hover:bg-rose-700",children:a.ctaLabel}),e.jsx("button",{type:"button",onClick:n,className:"text-[11px] px-2 py-1 border border-rose-300 text-rose-800 rounded hover:bg-rose-100",children:"Acknowledge"})]})]})]})}const fe=["matrix","delta","activity","guided","flows","scorecard","crawl","forensic","compliance"];function Ks(t){if(!t)return null;try{return new URL(t).hostname}catch{return t}}function qs(){var u,h;const t=g(f=>f.view),s=g(f=>f.setView),a=g(f=>f.setUserMode),n=g(f=>f.results),r=g(f=>f.status),[i,o]=x.useState(!1),c=((u=n[0])==null?void 0:u.pageUrl)??((h=n[0])==null?void 0:h.scope),d=Ks(c),p=n.length>0&&r!=="running";function l(){a("owner"),H({type:"SETTINGS_SET",key:"userMode",value:"owner"})}return e.jsxs("header",{className:"border-b border-slate-200 bg-white px-3 py-2",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"font-semibold text-sm leading-tight",children:"wcagcheckr"}),e.jsxs("p",{className:"text-[10px] text-slate-500 leading-tight font-mono",children:["v",chrome.runtime.getManifest().version]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button",onClick:l,title:"Switch to the simplified site-owner view",className:"text-[11px] px-2 py-1 border border-slate-300 rounded text-slate-600 hover:bg-slate-50",children:"Owner mode"}),e.jsx(Vt,{}),e.jsx(ot,{onClick:()=>void H({type:"OPEN_SETTINGS"}),ariaLabel:"Open settings",children:"⚙"}),e.jsx(ot,{onClick:()=>o(!0),ariaLabel:"Send support message",children:"?"})]})]}),p&&d&&e.jsxs("div",{className:"flex items-center gap-2 mb-2 px-2 py-1 rounded bg-brand-50 border border-brand-200 text-[11px]",title:c??"",children:[e.jsx("span",{className:"text-slate-500 shrink-0",children:"Audit:"}),e.jsx("span",{className:"font-mono font-medium text-slate-800 truncate flex-1","aria-label":`Showing audit results for ${d}`,children:d}),e.jsx("button",{type:"button",onClick:()=>void et(),className:"shrink-0 text-[11px] px-2 py-0.5 rounded border border-slate-300 bg-white text-slate-700 hover:bg-slate-50 hover:border-slate-400",title:"Clear these results so you can run a fresh audit",children:"Clear"})]}),e.jsx(Qs,{view:t,setView:s}),e.jsx(me,{open:i,onClose:()=>o(!1),title:"Send support message",children:e.jsx(Us,{onClose:()=>o(!1)})})]})}function Qs({view:t,setView:s}){const a=x.useRef([]);function n(i){var d;const o=(i+fe.length)%fe.length,c=fe[o];c&&(s(c),(d=a.current[o])==null||d.focus())}function r(i,o){switch(i.key){case"ArrowRight":i.preventDefault(),n(o+1);break;case"ArrowLeft":i.preventDefault(),n(o-1);break;case"Home":i.preventDefault(),n(0);break;case"End":i.preventDefault(),n(fe.length-1);break}}return e.jsx("nav",{className:"flex flex-wrap gap-1","aria-label":"Audit views",role:"tablist",children:fe.map((i,o)=>{const c=t===i;return e.jsx("button",{ref:d=>{a.current[o]=d},role:"tab","aria-selected":c,tabIndex:c?0:-1,onClick:()=>s(i),onKeyDown:d=>r(d,o),className:c?"text-xs px-3 py-1 rounded bg-brand-500 text-white":"text-xs px-3 py-1 rounded text-slate-600 hover:bg-slate-100",children:i[0].toUpperCase()+i.slice(1)},i)})})}function Js({feature:t,upgradeUrl:s}){const[a,n]=x.useState(!1);return e.jsxs("div",{className:"p-3 bg-amber-50 border border-amber-200 rounded",children:[e.jsxs("p",{className:"text-xs text-amber-900 mb-2",children:[e.jsx("strong",{children:t})," requires a higher tier."]}),e.jsx("button",{type:"button",onClick:()=>n(!0),className:"text-xs text-brand-600 hover:underline font-medium",children:"Upgrade →"}),e.jsx(qe,{open:a,onClose:()=>n(!1)})]})}const Ys="https://wcagcheckr.com/upgrade";function Xs(){const[t,s]=x.useState("single-element"),[a,n]=x.useState(!1),[r,i]=x.useState(null),[o,c]=x.useState(null),[d,p]=x.useState(Ge),[l,u]=x.useState(Ge[0].id),h=g(j=>j.status),f=g(j=>j.tier),m=g(j=>j.results.length>0),N=h==="running";x.useEffect(()=>{Promise.all([q({type:"SETTINGS_GET",key:"matrixPresets"}),q({type:"SETTINGS_GET",key:"activePresetId"})]).then(([j,$])=>{const z=Array.isArray(j.data)?j.data:null;p(z&&z.length>0?z:Ge),typeof $.data=="string"&&u($.data)})},[]);function C(j){const $=d.find(z=>z.id===j);$&&(u(j),H({type:"SETTINGS_SET",key:"activePresetId",value:j}),H({type:"SETTINGS_SET",key:"stateMatrix",value:$.matrix}))}const T=_t(f,"storybookAutoIterate");x.useEffect(()=>{const j=ee("ELEMENT_PICKED_EVENT",(z,I)=>{n(!1);const O=I.frameId;A(O),i({selector:z.selector,frameId:O})}),$=ee("PICKER_CANCELLED_EVENT",()=>n(!1));return()=>{j(),$()}},[]);async function b(){const j=await X();j&&(n(!0),await ae(j,{type:"PICKER_ACTIVATE_REQUEST",tabId:j}))}function v(){r&&(A(r.frameId),le({type:"START_AUDIT",mode:"single-element",scope:r.selector,frameId:r.frameId}),g.getState().startNewScan())}function y(){if(!T){c("storybook:auto-iterate");return}A(),le({type:"START_AUDIT",mode:"storybook-all"}),g.getState().startNewScan()}function S(){A(),le({type:"START_AUDIT",mode:"all-frames"}),g.getState().startNewScan()}function E(){A(),le({type:"START_AUDIT",mode:"full-page"}),g.getState().startNewScan()}function w(){H({type:"CANCEL_AUDIT"})}async function A(j){g.getState().setPinned(null);const $=await X();if($)try{await ae($,{type:"HIGHLIGHT_CLEAR_REQUEST",tabId:$},j)}catch{}}return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"px-3 py-2 border-b border-slate-200 bg-white space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs("select",{"aria-label":"Audit mode",value:t,onChange:j=>s(j.target.value),disabled:N||a,className:"text-xs border border-slate-300 rounded px-2 py-1",children:[e.jsx("option",{value:"single-element",children:"Single element"}),e.jsx("option",{value:"full-page",children:"Full page"}),e.jsx("option",{value:"all-frames",children:"All iframes"}),e.jsxs("option",{value:"storybook-all",children:["All stories (Storybook / Ladle)",T?"":" (paid)"]})]}),e.jsx("select",{"aria-label":"State-matrix preset",value:l,onChange:j=>C(j.target.value),disabled:N||a,title:"Switch the state-matrix preset used for the next audit",className:"text-xs border border-slate-300 rounded px-2 py-1",children:d.map(j=>e.jsx("option",{value:j.id,children:j.name},j.id))}),t==="single-element"?e.jsx(Zs,{picking:a,picked:r,isRunning:N,onPick:b,onRun:v,onClearPick:()=>i(null)}):t==="full-page"?e.jsx("button",{onClick:E,disabled:N,className:"text-xs px-3 py-1 bg-brand-500 text-white rounded hover:bg-brand-600 disabled:opacity-50",children:N?"Auditing…":"Scan page"}):t==="all-frames"?e.jsx("button",{onClick:S,disabled:N,className:"text-xs px-3 py-1 bg-brand-500 text-white rounded hover:bg-brand-600 disabled:opacity-50",children:N?"Auditing…":"Audit all iframes"}):e.jsx("button",{onClick:y,disabled:N,className:"text-xs px-3 py-1 bg-brand-500 text-white rounded hover:bg-brand-600 disabled:opacity-50",children:N?"Auditing…":"Audit all stories"}),N&&e.jsx("button",{onClick:w,className:"text-xs px-3 py-1 border border-slate-300 text-slate-700 rounded hover:bg-slate-100",children:"Stop"}),!N&&m&&e.jsx("button",{type:"button",onClick:()=>void et(),className:"text-xs text-slate-500 hover:text-slate-800 hover:underline ml-auto",title:"Clear current results",children:"Clear"})]}),t==="single-element"&&r&&!a&&!N&&e.jsx(ea,{selector:r.selector,onRepick:b,onClear:()=>i(null)})]}),e.jsx(me,{open:o!==null,onClose:()=>c(null),title:"Upgrade to continue",children:e.jsx(Js,{feature:o??"",upgradeUrl:Ys})})]})}function Zs({picking:t,picked:s,isRunning:a,onPick:n,onRun:r,onClearPick:i}){return a?e.jsx("button",{disabled:!0,className:"text-xs px-3 py-1 bg-brand-500 text-white rounded opacity-50",children:"Auditing…"}):t?e.jsx("button",{disabled:!0,className:"text-xs px-3 py-1 bg-brand-400 text-white rounded",children:"Click an element on the page"}):s?e.jsx("button",{onClick:r,className:"text-xs px-3 py-1 bg-brand-500 text-white rounded hover:bg-brand-600",children:"Run audit"}):e.jsx("button",{onClick:n,className:"text-xs px-3 py-1 bg-brand-500 text-white rounded hover:bg-brand-600",children:"Pick element"})}function ea({selector:t,onRepick:s,onClear:a}){return e.jsxs("div",{className:"text-[11px] text-slate-600 flex items-center gap-2 flex-wrap",children:[e.jsx("span",{children:"Selected:"}),e.jsx("code",{className:"font-mono bg-slate-100 px-1.5 py-0.5 rounded text-slate-700 truncate max-w-[180px]",title:t,children:t}),e.jsx("button",{type:"button",onClick:s,className:"text-brand-600 hover:underline",children:"Re-pick"}),e.jsx("span",{"aria-hidden":"true",className:"text-slate-300",children:"·"}),e.jsx("button",{type:"button",onClick:a,className:"text-slate-500 hover:text-slate-700 hover:underline",children:"Clear"})]})}const ta={outline:"OUTLINE_HIDE_REQUEST","tab-order":"TAB_ORDER_HIDE_REQUEST","reading-order":"READING_ORDER_HIDE_REQUEST","target-size":"TARGET_SIZE_HIDE_REQUEST"},sa={outline:"OUTLINE_SHOW_REQUEST","tab-order":"TAB_ORDER_SHOW_REQUEST","reading-order":"READING_ORDER_SHOW_REQUEST","target-size":"TARGET_SIZE_SHOW_REQUEST"};function aa(){const[t,s]=x.useState(null),[a,n]=x.useState(!1),[r,i]=x.useState(null),[o,c]=x.useState("off"),p=g(f=>f.results).flatMap(f=>f.violations);async function l(f){const m=await X();m&&(c(f),f==="off"?await ae(m,{type:"VISION_SIMULATOR_CLEAR",tabId:m}).catch(()=>{}):await ae(m,{type:"VISION_SIMULATOR_APPLY",tabId:m,mode:f}).catch(()=>{}))}async function u(f){const m=await X();if(m){if(t&&await ae(m,{type:ta[t],tabId:m}).catch(()=>{}),t===f){s(null);return}await ae(m,{type:sa[f],tabId:m}).catch(()=>{}),s(f)}}async function h(){const f=await X();if(f){if(a){await ae(f,{type:"FIX_PREVIEW_HIDE_REQUEST",tabId:f}).catch(()=>{}),n(!1),i(null);return}if(p.length===0){i("Run an audit first.");return}try{const m=await Ne(f,{type:"FIX_PREVIEW_SHOW_REQUEST",tabId:f,violations:p});n(!0),i(`Previewing ${m.visualFixCount} visual fix${m.visualFixCount===1?"":"es"} + ${m.annotationCount} annotation${m.annotationCount===1?"":"s"}.`)}catch{i("Preview failed.")}}}return e.jsxs("div",{className:"px-3 py-2 border-b border-slate-200 bg-white flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-[11px] uppercase tracking-wide text-slate-500 mr-1",title:"Page overlays — these draw information on the live page. They do NOT change what the audit detects.",children:"Visualizers"}),e.jsx(be,{label:"Outline",title:"Show heading + landmark structure overlay",on:t==="outline",onClick:()=>u("outline")}),e.jsx(be,{label:"Tab order",title:"Number focusables in tab sequence. Red = tab order doesn't follow visual layout (focus jumps around). Amber = positive tabindex reordered the DOM sequence.",on:t==="tab-order",onClick:()=>u("tab-order")}),e.jsx(be,{label:"Reading order",title:"Number content in DOM order (what a screen reader reads). Red = element's DOM position differs from its visual position; badge shows DOM→Visual.",on:t==="reading-order",onClick:()=>u("reading-order")}),e.jsx(be,{label:"Targets",title:"Show interactive-element dimensions vs WCAG 2.5.8 (24px AA) / 2.5.5 (44px AAA)",on:t==="target-size",onClick:()=>u("target-size")}),e.jsx("span",{className:"w-px h-4 bg-slate-200 mx-1","aria-hidden":"true"}),e.jsx(be,{label:"Preview fixes ✨",title:"Apply contrast/target-size/focus-ring fixes to the live page + annotate where labels and alt text are missing. Toggle off to revert.",on:a,onClick:h}),e.jsx("span",{className:"w-px h-4 bg-slate-200 mx-1","aria-hidden":"true"}),e.jsxs("label",{className:"text-[11px] text-slate-700 flex items-center gap-1.5",children:[e.jsx("span",{title:"Apply a CSS filter that simulates how the page looks for users with color-vision or low-vision impairments. Visual only — does NOT change what the audit detects.",children:"Vision sim:"}),e.jsxs("select",{"aria-label":"Vision-impairment simulator",value:o,onChange:f=>void l(f.target.value),className:`text-xs border rounded px-1.5 py-0.5 ${o==="off"?"border-slate-300 bg-white text-slate-700":"border-brand-500 bg-brand-50 text-brand-700 font-medium"}`,children:[e.jsx("option",{value:"off",children:"Off"}),e.jsxs("optgroup",{label:"Color blindness",children:[e.jsx("option",{value:"deuteranomaly",children:"Deuteranomaly (green-weak — most common)"}),e.jsx("option",{value:"deuteranopia",children:"Deuteranopia (green-blind)"}),e.jsx("option",{value:"protanomaly",children:"Protanomaly (red-weak)"}),e.jsx("option",{value:"protanopia",children:"Protanopia (red-blind)"}),e.jsx("option",{value:"tritanomaly",children:"Tritanomaly (blue-weak)"}),e.jsx("option",{value:"tritanopia",children:"Tritanopia (blue-blind)"}),e.jsx("option",{value:"achromatomaly",children:"Achromatomaly (partial color blindness)"}),e.jsx("option",{value:"achromatopsia",children:"Achromatopsia (no color)"})]}),e.jsxs("optgroup",{label:"Low vision",children:[e.jsx("option",{value:"cataract",children:"Cataract (blur)"}),e.jsx("option",{value:"low-contrast",children:"Low contrast sensitivity"}),e.jsx("option",{value:"glaucoma",children:"Glaucoma (tunnel vision)"}),e.jsx("option",{value:"macular",children:"Macular degeneration (central loss)"})]})]})]}),r&&e.jsx("span",{className:"text-[11px] text-slate-500 basis-full",children:r})]})}function be({label:t,title:s,on:a,onClick:n}){return e.jsx("button",{type:"button",title:s,"aria-pressed":a,onClick:n,className:`text-xs px-2 py-1 rounded border transition-colors ${a?"bg-brand-500 text-white border-brand-500 hover:bg-brand-600":"bg-white text-slate-700 border-slate-300 hover:bg-slate-50"}`,children:t})}function na(t){if(!t)return"";const s=[t.pseudoState];return t.theme!=="light"&&s.push(t.theme),t.direction!=="ltr"&&s.push(t.direction),s.join(" · ")}function ra(){const t=g(p=>p.status),s=g(p=>p.progress),a=g(p=>p.aiProgress);if(t!=="running"||!s)return null;const n=a!=null,r=!n&&s.current>=s.total,i=n?a.current/a.total*100:s.current/s.total*100,o=n?a.current:s.current,c=n?a.total:s.total,d=n?`AI augmentation: ${a.current} of ${a.total} checks. ${a.currentCheckLabel}`:r?"Running deep analyzers: reading order, tab order, typography, custom properties, AI candidates.":`Audit progress: ${s.current} of ${s.total} states`;return e.jsxs("div",{className:"px-3 py-2 bg-slate-100 border-b border-slate-200",children:[e.jsxs("div",{className:"flex justify-between items-center gap-2 text-xs text-slate-600 mb-1",children:[e.jsx("span",{children:n?e.jsxs(e.Fragment,{children:["AI augmentation… ",a.current,"/",a.total]}):r?e.jsx(e.Fragment,{children:"Running deep analyzers…"}):e.jsxs(e.Fragment,{children:["Auditing… ",s.current,"/",s.total]})}),e.jsx("span",{className:"text-slate-500 truncate flex-1",children:n?a.candidatesTotal&&a.candidatesTotal>0?`${a.currentCheckLabel} (${a.candidatesDone??0}/${a.candidatesTotal})`:a.currentCheckLabel:r?"reading order · tab order · typography · CSS vars · AI candidates":na(s.currentState)}),e.jsx("button",{type:"button",onClick:()=>void H({type:"CANCEL_AUDIT"}),className:"text-[11px] px-2 py-0.5 border border-slate-400 bg-white text-slate-700 rounded hover:bg-slate-200 shrink-0",children:"Stop"})]}),e.jsx("div",{className:`h-1 rounded-full overflow-hidden ${n?"bg-violet-100":"bg-slate-200"}`,role:"progressbar","aria-valuenow":o,"aria-valuemin":0,"aria-valuemax":c,"aria-label":d,children:e.jsx("div",{className:`h-full transition-all ${n?"bg-violet-500":"bg-brand-500"}`,style:{width:`${i}%`}})})]})}const ve={"ada-iii":{id:"ada-iii",name:"ADA Title III",region:"US",blurb:"US civil-rights law; courts treat WCAG 2.1 AA as the de facto digital standard."},508:{id:"508",name:"Section 508",region:"US federal",blurb:"US federal procurement requirement; references WCAG 2.0 AA via 36 CFR Part 1194."},eaa:{id:"eaa",name:"EAA",region:"EU",blurb:"European Accessibility Act, in force 2025-06-28; references EN 301 549 → WCAG 2.1 AA."},"en-301-549":{id:"en-301-549",name:"EN 301 549",region:"EU",blurb:"European harmonized accessibility standard, baseline WCAG 2.1 AA."},aoda:{id:"aoda",name:"AODA",region:"Ontario",blurb:"Accessibility for Ontarians with Disabilities Act; WCAG 2.0 AA required since 2021."}};function ia(t){return/^wcag\d/.test(t.wcagCriterion)?[ve["ada-iii"],ve[508],ve.eaa,ve["en-301-549"],ve.aoda]:[]}const oa={minor:"bg-blue-100 text-blue-700",moderate:"bg-yellow-100 text-yellow-700",serious:"bg-orange-100 text-orange-700",critical:"bg-red-100 text-red-700"};function De({violation:t,alreadyAcknowledged:s}){const a=g(b=>b.pinnedMatchKey),n=g(b=>b.pinnedFound),r=g(b=>b.setPinned),i=g(b=>{var v;return(v=b.results[0])==null?void 0:v.frameId}),o=g(b=>{var v;return(v=b.results[0])==null?void 0:v.scope}),c=g(b=>b.results),d=g(b=>b.acknowledgedKeys.has(t.matchKey)),p=g(b=>b.markAcknowledged),l=g(b=>b.markUnacknowledged),u=s||d,h=a===t.matchKey,f=h&&!n;async function m(b){try{return(await Ne(b,{type:"HIGHLIGHT_SHOW_REQUEST",tabId:b,selector:t.target.selector},i)).found}catch{return!0}}async function N(){const b=await X();if(!b)return;if(h){r(null);try{await ae(b,{type:"HIGHLIGHT_CLEAR_REQUEST",tabId:b},i)}catch{}return}const v=await m(b);r(t.matchKey,v)}function C(b){b.stopPropagation(),t.currentState.breakpoint.width<=640&&Ot(),(async()=>{const v=await X();if(!v)return;try{await q({type:"STATE_DRIVE_REQUEST",tabId:v,state:t.currentState,scope:o,frameId:i})}catch{}const y=await m(v);r(t.matchKey,y)})()}async function T(b){b.stopPropagation();const v=await X();if(!v)return;try{await q({type:"STATE_DRIVE_REQUEST",tabId:v,state:ua(),scope:o,frameId:i})}catch{H({type:"STATE_RESET_REQUEST",tabId:v})}const y=await m(v);r(t.matchKey,y)}return e.jsxs("button",{type:"button",onClick:N,"aria-pressed":h,className:`w-full text-left border rounded p-2 bg-white block transition-shadow
|
|
3
|
-
${h?"border-rose-400 ring-2 ring-rose-300":"border-slate-200 hover:border-slate-300"}`,children:[e.jsxs("div",{className:"flex items-start justify-between mb-1 gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-medium text-xs truncate",children:t.ruleId}),e.jsxs("div",{className:"text-xs text-slate-500",children:[t.wcagCriterion," · ",t.wcagLevel]})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[t.flakyAcrossRuns&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-amber-100 text-amber-700",title:"Did not appear in every audit run — likely a transient environment artifact",children:"flaky"}),e.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded ${oa[t.impact]}`,children:t.impact})]})]}),e.jsx("p",{className:"text-xs text-slate-700 mb-2",children:t.description}),e.jsx("code",{className:"text-[11px] bg-slate-50 p-1.5 rounded block text-slate-600 font-mono whitespace-pre-wrap break-all",children:t.target.outerHTML}),e.jsx(pa,{violation:t}),e.jsx(xa,{violation:t}),e.jsx(ma,{violation:t}),e.jsx(ha,{text:t.target.failureSummary}),e.jsx(ga,{ruleId:t.ruleId}),h&&e.jsxs("div",{className:"text-[11px] text-slate-600 mt-2 flex flex-wrap items-center gap-x-2 gap-y-1",children:[e.jsxs("span",{children:["State: ",la(t.currentState)]}),e.jsx("span",{"aria-hidden":"true",children:"·"}),e.jsx("a",{role:"button",tabIndex:0,onClick:C,onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),C(b))},className:"text-brand-600 hover:underline cursor-pointer",children:"Load state"}),e.jsx("span",{"aria-hidden":"true",children:"·"}),e.jsx("a",{role:"button",tabIndex:0,onClick:T,onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),T(b))},className:"text-brand-600 hover:underline cursor-pointer",children:"Load default"}),f&&e.jsx("span",{className:"text-amber-700 basis-full",children:"Couldn't find this element on the page. The story may have re-rendered or unmounted."})]}),t.needsReview&&e.jsx("div",{className:"mt-2 flex items-center gap-2 text-xs",children:u?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"inline-flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded bg-emerald-100 text-emerald-800 font-semibold",children:"✓ Acknowledged"}),e.jsx("span",{role:"button",tabIndex:0,onClick:b=>{b.stopPropagation(),l(t.matchKey),da(t,c)},onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),b.target.click())},className:"text-slate-600 hover:text-slate-900 hover:underline cursor-pointer",children:"Un-acknowledge"})]}):e.jsx("span",{role:"button",tabIndex:0,onClick:b=>{b.stopPropagation(),p(t.matchKey),ca(t,c)},onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),b.target.click())},title:"Mark this finding as 'reviewed, not an issue.' It won't appear in future audits unless the content changes.",className:"px-2 py-0.5 border border-slate-300 bg-white text-slate-700 rounded hover:bg-slate-50 cursor-pointer",children:"Acknowledge as not an issue"})}),t.helpUrl&&e.jsx("a",{href:t.helpUrl,target:"_blank",rel:"noreferrer",onClick:b=>b.stopPropagation(),className:"text-xs text-brand-600 hover:underline mt-2 inline-block",children:"Learn more →"})]})}function la(t){const s=[];return s.push(t.pseudoState==="default"?"default":`:${t.pseudoState}`),t.theme!=="light"&&s.push(t.theme),t.direction!=="ltr"&&s.push(t.direction),t.breakpoint.id!=="desktop"&&s.push(t.breakpoint.id),t.ariaVariation&&s.push(t.ariaVariation.id),s.join(" · ")}async function ca(t,s){await ls({componentId:t.componentId,matchKey:t.matchKey,ruleId:t.ruleId}),await Bt(t.componentId,s)}async function da(t,s){await os(t.componentId,t.matchKey),await Bt(t.componentId,s)}async function Bt(t,s){const a=s.flatMap(n=>n.violations);try{const n=await q({type:"BASELINE_COMPARE",componentId:t,currentViolations:a});g.getState().setDelta(n.delta)}catch{}}function ua(){const t=Lt.breakpointPresets;return{pseudoState:"default",ariaVariation:null,theme:"light",direction:"ltr",breakpoint:t.find(a=>a.id==="desktop")??t[0]}}function Ht(t){if(t.ruleId!=="color-contrast"&&t.ruleId!=="color-contrast-enhanced")return null;const s=t.target.failureSummary||"",a=/contrast of (\d+(?:\.\d+)?)/i.exec(s),n=/Expected contrast ratio of (\d+(?:\.\d+)?):1/i.exec(s),r=/foreground color:\s*(#[0-9a-fA-F]+)/i.exec(s),i=/background color:\s*(#[0-9a-fA-F]+)/i.exec(s);return!a||!n?null:{ratio:parseFloat(a[1]),required:parseFloat(n[1]),fg:(r==null?void 0:r[1])??"#000000",bg:(i==null?void 0:i[1])??"#ffffff"}}function pa({violation:t}){const s=Ht(t);if(!s)return null;const a=s.ratio>=s.required;return e.jsxs("div",{className:"mt-2 flex items-center gap-2 text-[11px]",children:[e.jsx("div",{className:"flex items-center justify-center w-9 h-6 rounded border border-slate-300",style:{background:s.bg,color:s.fg},title:`fg ${s.fg} on bg ${s.bg}`,children:"Aa"}),e.jsxs("span",{className:a?"text-green-700":"text-rose-700 font-medium",children:[s.ratio.toFixed(2)," : 1"]}),e.jsxs("span",{className:"text-slate-500",children:["needs ",s.required.toFixed(1)," : 1"]})]})}function ha({text:t}){return t?e.jsxs("details",{className:"mt-2",children:[e.jsx("summary",{className:"text-[11px] text-slate-500 cursor-pointer hover:text-slate-700",children:"Show failure detail"}),e.jsx("pre",{className:"text-[11px] text-slate-600 whitespace-pre-wrap mt-1 bg-slate-50 p-1.5 rounded",children:t})]}):null}function ma({violation:t}){const s=ia(t);return s.length===0?null:e.jsx("div",{className:"mt-2 flex flex-wrap gap-1",children:s.map(a=>e.jsx("span",{title:`${a.region} — ${a.blurb}`,className:"text-[10px] px-1.5 py-0.5 rounded bg-slate-100 text-slate-600 border border-slate-200",children:a.name},a.id))})}function xa({violation:t}){const s=Ht(t),[a,n]=x.useState({kind:"idle"});if(!s)return null;async function r(){n({kind:"loading"});try{const i=t.ruleId==="color-contrast-enhanced"?"AAA":"AA",o=await q({type:"AI_COLOR_SUGGEST_REQUEST",inputs:[{matchKey:t.matchKey,foreground:s.fg,background:s.bg,fontSize:16,fontWeight:400,targetLevel:i}]}),c=o.results.find(d=>d.matchKey===t.matchKey);n(c?{kind:"ready",suggestion:c}:{kind:"empty",reason:o.unavailableReason??"AI returned no suggestions for this contrast pair."})}catch(i){n({kind:"empty",reason:i instanceof Error?i.message:String(i)})}}return e.jsxs("div",{className:"mt-2",children:[a.kind==="idle"&&e.jsx("button",{type:"button",onClick:i=>{i.stopPropagation(),r()},className:"text-[11px] px-2 py-1 rounded border border-brand-300 bg-brand-50 text-brand-700 hover:bg-brand-100 font-medium",title:"Ask the configured AI for in-palette color replacements that pass WCAG contrast.",children:"✨ AI fix suggestions"}),a.kind==="loading"&&e.jsx("span",{className:"text-[11px] text-slate-500",children:"Asking AI for color suggestions…"}),a.kind==="empty"&&e.jsx("p",{className:"text-[11px] text-slate-500 bg-slate-50 border border-slate-200 rounded p-2",children:a.reason}),a.kind==="ready"&&e.jsxs("div",{className:"border border-brand-200 rounded bg-brand-50 p-2 space-y-2",children:[e.jsxs("p",{className:"text-[11px] text-brand-900 font-medium",children:["AI suggestions (",a.suggestion.suggestions.length,")"]}),e.jsx("ul",{className:"space-y-1.5",children:a.suggestion.suggestions.map((i,o)=>e.jsxs("li",{className:"flex items-start gap-2 text-[11px]",children:[e.jsx("div",{className:"flex items-center justify-center w-9 h-6 rounded border border-slate-300 shrink-0",style:{background:i.background,color:i.foreground},title:`fg ${i.foreground} on bg ${i.background}`,children:"Aa"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-baseline gap-1.5",children:[e.jsx("code",{className:"font-mono",children:i.foreground}),e.jsx("span",{className:"text-slate-500",children:"on"}),e.jsx("code",{className:"font-mono",children:i.background}),e.jsxs("span",{className:"text-emerald-700 font-medium",children:[i.contrast.toFixed(2)," : 1"]})]}),i.rationale&&e.jsx("p",{className:"text-slate-600 mt-0.5",children:i.rationale})]})]},o))}),a.suggestion.reasoning&&e.jsx("p",{className:"text-[10px] text-slate-500 italic",children:a.suggestion.reasoning})]})]})}function ga({ruleId:t}){const s=cs(t);return s?e.jsxs("details",{className:"mt-2",children:[e.jsx("summary",{className:"text-[11px] text-emerald-700 cursor-pointer hover:text-emerald-900 font-medium",children:"How to fix"}),e.jsxs("div",{className:"mt-1 bg-emerald-50 border border-emerald-200 rounded p-2 space-y-2",children:[e.jsx("p",{className:"text-[11px] text-slate-700 leading-relaxed",children:s.summary}),s.snippet&&e.jsx("pre",{className:"text-[11px] text-slate-700 bg-white p-1.5 rounded border border-emerald-100 overflow-x-auto",children:e.jsx("code",{children:s.snippet})})]})]}):null}const fa=[{id:"contrast",label:"Color & contrast",axeRules:["color-contrast","color-contrast-enhanced","link-in-text-block"],igtWorkflowIds:["visual-indicators"]},{id:"alt-text",label:"Alt text",axeRules:["image-alt","input-image-alt","object-alt","svg-img-alt","area-alt","role-img-alt"],igtWorkflowIds:[]},{id:"forms",label:"Forms",axeRules:["label","select-name","aria-input-field-name","aria-toggle-field-name","form-field-multiple-labels","label-content-name-mismatch","autocomplete-valid","label-title-only","wcc-onfocus-context-change","wcc-oninput-context-change","wcc-cognitive-auth-challenge"],igtWorkflowIds:["forms"]},{id:"keyboard",label:"Keyboard",axeRules:["nested-interactive","tabindex","frame-focusable-content","no-focusable-content","focus-order-semantics","wcc-gesture-no-alternative","wcc-drag-no-alternative"],igtWorkflowIds:["keyboard","focus-management"]},{id:"tab-order",label:"Tab order",axeRules:[],igtWorkflowIds:[],verifiedByWorkflowIds:["keyboard"],heuristic:"tab-order"},{id:"screen-reader",label:"Screen reader / ARIA",axeRules:["aria-allowed-attr","aria-required-attr","aria-required-children","aria-required-parent","aria-roles","aria-valid-attr-value","aria-valid-attr","aria-hidden-body","aria-hidden-focus","button-name","input-button-name","link-name","frame-title","presentation-role-conflict","aria-allowed-role","aria-prohibited-attr","aria-text","aria-deprecated-role","aria-conditional-attr","aria-braille-equivalent","empty-button","empty-heading","empty-link"],igtWorkflowIds:["screen-reader"]},{id:"reading-order",label:"Reading order",axeRules:[],igtWorkflowIds:[],verifiedByWorkflowIds:["page-structure"],heuristic:"reading-order"},{id:"page-structure",label:"Page structure",axeRules:["heading-order","page-has-heading-one","landmark-one-main","landmark-no-duplicate-banner","landmark-no-duplicate-contentinfo","landmark-no-duplicate-main","region","bypass","empty-table-header","landmark-banner-is-top-level","landmark-complementary-is-top-level","landmark-contentinfo-is-top-level","landmark-main-is-top-level","landmark-unique"],igtWorkflowIds:["page-structure"]}];function ba(t){const s=fa.map(i=>va(i,t)),a=s.reduce((i,o)=>i+ya(o.letter),0)/Math.max(1,s.length),n=ja(Math.round(a)),r=s.filter(i=>i.letter==="D"||i.letter==="F");return{overallLetter:n,subGrades:s,warningAreas:r,isLawsuitRisk:r.length>0}}function va(t,s){const a=new Set(t.axeRules),n=s.violations.filter(w=>a.has(w.ruleId)),r=s.manualRuns.filter(w=>t.igtWorkflowIds.includes(w.workflowId)),i=t.igtWorkflowIds.map(w=>s.workflows.find(A=>A.id===w)).filter(w=>w!=null);let o=i.length>0;for(const w of i){const A=r.find($=>$.workflowId===w.id);if((A?Object.keys(A.steps).length:0)!==w.steps.length){o=!1;break}}const c=r.some(w=>Object.keys(w.steps).length>0),d=t.verifiedByWorkflowIds??[],p=s.manualRuns.filter(w=>d.includes(w.workflowId)),l=d.map(w=>s.workflows.find(A=>A.id===w)).filter(w=>w!=null);let u=d.length>0&&l.length===d.length;for(const w of l){const A=p.find($=>$.workflowId===w.id);if((A?Object.keys(A.steps).length:0)!==w.steps.length){u=!1;break}}let h=null;if(u)for(const w of p)w.completedAt&&(h===null||w.completedAt>h)&&(h=w.completedAt);const f=t.heuristic==="tab-order"?s.heuristicCounts.tabOrder??0:t.heuristic==="reading-order"?s.heuristicCounts.readingOrder??0:0,m=d[0]??t.igtWorkflowIds[0]??null;if(u&&d.length>0)return{id:t.id,label:t.label,letter:"A",untested:!1,needsIgt:!1,igtCompleted:!0,verifiedByIgt:!0,verifiedAt:h,suppressedHeuristicCount:f,primaryVerifierWorkflowId:m,counts:{critical:0,serious:0,moderate:0,minor:0},caps:{cappedAtC:!1,cappedAtB:!1}};const N=t.axeRules.length>0||t.heuristic!=null,C=t.igtWorkflowIds.length>0;if(N?!s.auditRan:!c)return{id:t.id,label:t.label,letter:"F",untested:!0,needsIgt:C||d.length>0,igtCompleted:!1,verifiedByIgt:!1,verifiedAt:null,suppressedHeuristicCount:0,primaryVerifierWorkflowId:m,counts:{critical:0,serious:0,moderate:0,minor:0},caps:{cappedAtC:!1,cappedAtB:!1}};const b={critical:0,serious:0,moderate:0,minor:0};for(const w of Et(n))b[w.impact]++;b.serious+=f;for(const w of r){const A=i.find(j=>j.id===w.workflowId);if(A)for(const j of A.steps){const $=w.steps[j.id];($==null?void 0:$.status)==="fail"&&(j.severity==="required"?b.serious++:b.moderate++)}}const v=b.critical>0,y=b.serious>0;let S;b.critical>=5?S="F":b.critical>=1?S="D":b.serious>=1?S="C":b.moderate>=1?S="B":S="A";const E=S!=="A"&&(C&&!o||d.length>0&&!u);return{id:t.id,label:t.label,letter:S,untested:!1,needsIgt:E,igtCompleted:o,verifiedByIgt:!1,verifiedAt:null,suppressedHeuristicCount:0,primaryVerifierWorkflowId:m,counts:b,caps:{cappedAtC:v,cappedAtB:y}}}function ya(t){return t==="A"?4:t==="B"?3:t==="C"?2:t==="D"?1:0}function ja(t){return t>=4?"A":t>=3?"B":t>=2?"C":t>=1?"D":"F"}const wa={A:"bg-emerald-500",B:"bg-lime-500",C:"bg-yellow-500",D:"bg-orange-500",F:"bg-rose-600"},Na={A:"bg-emerald-500 text-white",B:"bg-lime-500 text-white",C:"bg-yellow-500 text-slate-900",D:"bg-orange-500 text-white",F:"bg-rose-600 text-white"};function ka({violations:t,componentId:s}){var Q,te,J,ne,re,G,Se;const[a,n]=x.useState([]),[r,i]=x.useState([]),[o,c]=x.useState(new Set),[d,p]=x.useState(null),[l,u]=x.useState({}),[h,f]=x.useState(new Set),m=g(L=>L.status),N=g(L=>L.progress),C=g(L=>L.freshThisSession),T=g(L=>L.results),b=(Q=T[0])==null?void 0:Q.startedAt,v=((te=T[0])==null?void 0:te.pageUrl)??((J=T[0])==null?void 0:J.scope)??null;if(x.useEffect(()=>{if(!s){n([]);return}let L=!1;return chrome.storage.local.get("igtRuns").then(W=>{if(L)return;const U=((W==null?void 0:W.igtRuns)??{})[s]??{};n(Object.values(U))}),()=>{L=!0}},[s]),x.useEffect(()=>{if(!v){i([]);return}let L=!1;return Re(v).then(W=>{L||i(W)}),()=>{L=!0}},[v]),m==="running")return e.jsx(Ia,{current:N==null?void 0:N.current,total:N==null?void 0:N.total});const y=ba({violations:t,auditRan:T.length>0,manualRuns:a,workflows:Y,heuristicCounts:{tabOrder:((re=(ne=T[0])==null?void 0:ne.tabOrderIssues)==null?void 0:re.length)??0,readingOrder:((Se=(G=T[0])==null?void 0:G.readingOrderIssues)==null?void 0:Se.length)??0}}),S=g(L=>L.acknowledgedKeys),E=T.length>0?Tt(T,{runs:a,workflows:Y},"2.1","AA",S,r):void 0,w=T.length>0?ds(It({audits:T,igtRuns:a,workflows:Y,acknowledgedMatchKeys:S,incompleteResolutions:r}),Y):void 0,A=E?!E.canClaimConformance:!1,j=A&&y.overallLetter==="A"?"B":y.overallLetter;async function $(L){var B;if(!v||!((B=E==null?void 0:E.inconclusiveReasons)!=null&&B[L]))return;const k=E.inconclusiveReasons[L].filter(V=>V.source==="axe-incomplete"&&V.elements&&V.elements.length>0);if(k.length===0)return;c(V=>new Set(V).add(L)),p(null);const U=[];let _=0;try{for(const D of k){const K=await H({type:"AI_RESOLVE_INCOMPLETE_REQUEST",ruleId:D.ruleOrStepId,pageUrl:D.pageUrl??v,wcagCriterion:L,elements:D.elements??[],targetLevel:"AA"});if(K!=null&&K.unavailableReason){p(K.unavailableReason);break}K!=null&&K.resolutions&&(U.push(...K.resolutions),_+=K.totalCostUsd??0)}if(v){const D=await Re(v);i(D)}const V={total:U.length,pass:U.filter(D=>D.verdict==="pass").length,fail:U.filter(D=>D.verdict==="fail").length,uncertain:U.filter(D=>D.verdict==="uncertain").length,costUsd:_,resolutions:U};u(D=>({...D,[L]:V}))}finally{c(V=>{const D=new Set(V);return D.delete(L),D})}}function z(L){f(W=>{const k=new Set(W);return k.has(L)?k.delete(L):k.add(L),k})}async function I(L){var K,xe;if(!v)return;const W=((K=E==null?void 0:E.inconclusiveReasons)==null?void 0:K[L])??[],k=((xe=E==null?void 0:E.failingReasons)==null?void 0:xe[L])??[],U=[],_=new Set;for(const M of W){if(M.source!=="axe-incomplete"||!M.elements)continue;const ie=M.pageUrl??v;for(const oe of M.elements){const ge=`${ie}::${M.ruleOrStepId}::${oe.selector}`;_.has(ge)||(_.add(ge),U.push({ruleId:M.ruleOrStepId,pageUrl:ie,selector:oe.selector}))}}for(const M of k){if(M.source!=="ai"||!M.selector)continue;const ie=M.ruleOrStepId.startsWith("ai-resolved::")?M.ruleOrStepId.slice(13):M.ruleOrStepId,oe=M.pageUrl??v,ge=`${oe}::${ie}::${M.selector}`;_.has(ge)||(_.add(ge),U.push({ruleId:ie,pageUrl:oe,selector:M.selector}))}if(U.length===0)return;const B=new Date().toISOString(),V=[];for(const M of U){const ie=r.find(oe=>oe.pageUrl===M.pageUrl&&oe.ruleId===M.ruleId&&oe.selector===M.selector);ie&&ie.verdict==="pass"&&ie.reasoning.startsWith("Marked as visually verified")||V.push({pageUrl:M.pageUrl,ruleId:M.ruleId,selector:M.selector,verdict:"pass",reasoning:`Marked as visually verified by user on ${B.slice(0,10)}.`,resolvedAt:B,costUsd:0,wcagCriterion:L})}if(V.length===0)return;await us(V);const D=await Re(v);i(D),u(M=>({...M,[L]:{total:V.length,pass:V.length,fail:0,uncertain:0,costUsd:0,resolutions:V}}))}const O=(()=>{if(!A||y.overallLetter!=="A"||!E)return null;const L=E.untestedCriteria.length,W=E.inconclusiveCriteria.length,k=E.failingCriteria.length,U=[];k>0&&U.push(`${k} WCAG ${E.targetLevel} ${k===1?"criterion":"criteria"} failing`),W>0&&U.push(`${W} WCAG ${E.targetLevel} ${W===1?"criterion":"criteria"} inconclusive`),L>0&&U.push(`${L} WCAG ${E.targetLevel} ${L===1?"criterion":"criteria"} still untested`);const _=k>0?"Fix the failing items OR Mark visually verified if AI was wrong about them.":W>0?"Resolve axe-incomplete + IGT-skip items to claim conformance.":"Open Guided Tests to evaluate them.";return`Capped at B — ${U.join(" + ")}. ${_}`})();let P=0;for(const L of Y){const W=a.find(U=>U.workflowId===L.id);if(!W)continue;L.steps.every(U=>{const _=W.steps[U.id];return(_==null?void 0:_.status)==="pass"||(_==null?void 0:_.status)==="fail"||(_==null?void 0:_.status)==="skip"||(_==null?void 0:_.status)==="not-applicable"})&&P++}const Z=Et(t.filter(L=>!S.has(L.matchKey))).length;return e.jsxs("div",{className:"border border-slate-200 rounded-lg bg-white overflow-hidden",children:[!C&&b&&e.jsx($a,{scannedAt:b}),e.jsxs("div",{className:"flex",children:[e.jsx("div",{className:`flex items-center justify-center w-24 ${wa[j]} text-white shrink-0`,children:e.jsx("span",{className:"text-5xl font-bold leading-none",children:j})}),e.jsxs("div",{className:"flex-1 p-3 space-y-1",children:[e.jsx("p",{className:"text-xs font-semibold text-slate-900",children:"Overall grade"}),e.jsxs("p",{className:"text-[11px] text-slate-600 leading-snug",children:["Mean of ",y.subGrades.length," verification areas below. Untested areas count as F until verified."]}),O&&e.jsx("p",{className:"text-[11px] text-amber-800 leading-snug mt-1 bg-amber-50 border border-amber-200 rounded px-2 py-1",children:O})]})]}),y.isLawsuitRisk&&e.jsx(Ca,{areas:y.warningAreas}),e.jsx(Ra,{grades:y.subGrades}),E&&e.jsx(Sa,{coverage:E,onResolveWithAi:$,onMarkVisuallyVerified:I,resolving:o,resolveError:d,lastResolveResult:l,expandedResultFor:h,onToggleResultDetail:z}),w&&e.jsx(Aa,{layers:w}),e.jsx(Ta,{violationsRemaining:Z,manualCompleted:P,manualTotal:Y.length}),P>0||T.length>0?e.jsxs("div",{className:"border-t border-slate-200 px-3 py-2 bg-slate-50",children:[e.jsx("p",{className:"text-[11px] uppercase tracking-wide text-slate-500 mb-1.5",children:"Manual coverage (Guided Tests)"}),e.jsxs("div",{className:"text-[11px] text-slate-700 mb-1.5",children:[e.jsx("strong",{children:P})," of ",e.jsx("strong",{children:Y.length})," workflows complete"]}),e.jsx("div",{className:"flex h-1 bg-slate-200 rounded-full overflow-hidden",children:e.jsx("div",{className:"bg-emerald-500",style:{width:`${P/Y.length*100}%`}})})]}):null]})}function Sa({coverage:t,onResolveWithAi:s,onMarkVisuallyVerified:a,resolving:n,resolveError:r,lastResolveResult:i,expandedResultFor:o,onToggleResultDetail:c}){const d=t.untestedCriteria.length+t.inconclusiveCriteria.length,[p,l]=x.useState(d>0&&d<=3),u=t.totalApplicable===0?0:Math.round(t.evaluated/t.totalApplicable*100),h=t.canClaimConformance,f=[];return t.failingCriteria.length>0&&f.push({kind:"failing",ids:t.failingCriteria}),t.inconclusiveCriteria.length>0&&f.push({kind:"inconclusive",ids:t.inconclusiveCriteria}),t.untestedCriteria.length>0&&f.push({kind:"untested",ids:t.untestedCriteria}),e.jsxs("div",{className:`border-t ${h?"border-emerald-200 bg-emerald-50":"border-amber-200 bg-amber-50"} px-3 py-2 text-[11px] leading-snug`,children:[e.jsxs("div",{className:`flex items-center justify-between gap-2 ${h?"text-emerald-900":"text-amber-900"}`,children:[e.jsxs("div",{children:[e.jsxs("span",{className:"font-semibold",children:["WCAG ",t.targetVersion," ",t.targetLevel," coverage:"," ",t.evaluated," of ",t.totalApplicable," criteria evaluated (",u,"%)"]}),h&&e.jsxs("p",{className:"text-[11px] mt-0.5",children:["Every applicable criterion has been evaluated and either passes or is N/A. This audit can be presented as a conformance-claim for ",t.targetVersion," ",t.targetLevel," for the audited URL(s)."]}),!h&&(()=>{const m=[];t.failingCriteria.length>0&&m.push("failing"),t.inconclusiveCriteria.length>0&&m.push("inconclusive"),t.untestedCriteria.length>0&&m.push("untested");const N=m.length===0?"unresolved":m.length===1?m[0]:m.length===2?`${m[0]} or ${m[1]}`:`${m.slice(0,-1).join(", ")}, or ${m[m.length-1]}`;return e.jsxs("p",{className:"text-[11px] mt-0.5 font-semibold",children:["Cannot claim ",t.targetLevel," conformance — applicable criteria remain ",N,"."]})})(),!h&&t.untestedCriteria.length>0&&e.jsxs("p",{className:"text-[11px] mt-0.5",children:[e.jsxs("strong",{children:[t.untestedCriteria.length," untested"]})," ",t.untestedCriteria.length===1?"criterion":"criteria"," — mark Pass / Fail / N/A in Guided Tests below."]}),!h&&t.inconclusiveCriteria.length>0&&e.jsxs("p",{className:"text-[11px] mt-0.5",children:[e.jsxs("strong",{children:[t.inconclusiveCriteria.length," inconclusive"]})," ",t.inconclusiveCriteria.length===1?"criterion":"criteria"," — axe couldn't fully determine OR an IGT step was skipped. Resolve before claiming conformance."]})]}),!h&&f.length>0&&e.jsx("button",{type:"button",onClick:()=>l(m=>!m),className:"text-[11px] underline shrink-0 self-start",children:p?"hide":"show list"})]}),p&&!h&&e.jsxs("div",{className:"mt-1.5 space-y-1.5",children:[f.map(m=>e.jsxs("div",{children:[e.jsxs("div",{className:`text-[10.5px] font-semibold uppercase tracking-wide ${m.kind==="failing"?"text-rose-900":"text-amber-900"}`,children:[m.kind==="untested"?"Untested":m.kind==="inconclusive"?"Inconclusive":"Failing"," (",m.ids.length,")"]}),e.jsx("ul",{className:"text-[10.5px] text-amber-900 space-y-1",children:m.ids.map(N=>{var w,A;const C=m.kind==="inconclusive"?(w=t.inconclusiveReasons)==null?void 0:w[N]:void 0,T=m.kind==="failing"?(A=t.failingReasons)==null?void 0:A[N]:void 0,b=C==null?void 0:C.some(j=>j.source==="axe-incomplete"&&j.elements&&j.elements.length>0),v=T==null?void 0:T.some(j=>j.source==="ai"),y=(n==null?void 0:n.has(N))??!1,S=i==null?void 0:i[N],E=(o==null?void 0:o.has(N))??!1;return e.jsxs("li",{className:"leading-snug",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 flex-wrap",children:[e.jsxs("code",{className:"font-mono text-[11px]",children:["· ",N]}),(m.kind==="inconclusive"&&b||m.kind==="failing"&&v)&&(s||a)&&e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[m.kind==="inconclusive"&&s&&e.jsx("button",{type:"button",disabled:y,onClick:()=>s(N),className:"text-[11px] font-semibold px-2 py-1 bg-brand-500 text-white rounded hover:bg-brand-600 disabled:opacity-50 shadow-sm",title:"Ask AI to determine pass/fail for the specific elements axe couldn't sample.",children:y?"Resolving…":S?"✨ Resolve again →":"✨ Resolve with AI →"}),a&&e.jsx("button",{type:"button",disabled:y,onClick:()=>a(N),className:"text-[11px] font-semibold px-2 py-1 bg-white text-emerald-700 border border-emerald-500 rounded hover:bg-emerald-50 disabled:opacity-50",title:m.kind==="failing"?"Override AI's fail determination — your human visual judgment is the highest authority per WCAG-EM.":"Mark all unresolved elements as visually verified by you. Same semantic weight as Acknowledge on a violation — closes the loop for items only a human can judge (text over images, gradients, etc.).",children:"✓ Mark visually verified"})]})]}),S&&e.jsxs("div",{className:"ml-3 mt-1 p-1.5 bg-white/60 border border-amber-200 rounded text-[10.5px]",children:[e.jsxs("div",{className:"font-semibold text-amber-900 flex items-center gap-2 flex-wrap",children:["AI returned ",S.total," ",S.total===1?"verdict":"verdicts",":",S.pass>0&&e.jsxs("span",{className:"text-emerald-700",children:["✓ ",S.pass," pass"]}),S.fail>0&&e.jsxs("span",{className:"text-rose-700",children:["✗ ",S.fail," fail"]}),S.uncertain>0&&e.jsxs("span",{className:"text-amber-700",children:["? ",S.uncertain," uncertain"]}),e.jsxs("span",{className:"text-slate-500 font-normal",children:["· $",S.costUsd.toFixed(4)]}),c&&e.jsx("button",{type:"button",onClick:()=>c(N),className:"ml-auto text-[10px] underline text-brand-700",children:E?"hide reasoning":"show reasoning"})]}),S.uncertain>0&&e.jsxs("p",{className:"mt-0.5 text-[10px] text-amber-800",children:["AI couldn't determine ",S.uncertain," ",S.uncertain===1?"element":"elements"," ","(typically text over images/gradients — needs visual review). These keep the criterion inconclusive."]}),S.pass===S.total&&S.total>0&&e.jsxs("p",{className:"mt-0.5 text-[10px] text-emerald-800",children:["All elements passed contrast — criterion above will flip to"," ",e.jsx("strong",{children:"pass"})," on next render."]}),E&&e.jsx("ul",{className:"mt-1.5 space-y-1 max-h-40 overflow-y-auto",children:S.resolutions.map((j,$)=>e.jsxs("li",{className:"text-[10px] leading-snug",children:[e.jsx("span",{className:j.verdict==="pass"?"text-emerald-700 font-semibold":j.verdict==="fail"?"text-rose-700 font-semibold":"text-amber-700 font-semibold",children:j.verdict==="pass"?"✓":j.verdict==="fail"?"✗":"?"})," ",e.jsx("code",{className:"font-mono bg-slate-100 px-1 rounded",children:j.selector}),e.jsx("div",{className:"ml-4 text-slate-600",children:j.reasoning})]},$))})]}),T&&T.length>0&&e.jsx("ul",{className:"ml-3 mt-0.5 space-y-0.5",children:T.map((j,$)=>e.jsxs("li",{className:"text-[10px] text-rose-800",children:[j.source==="ai"&&e.jsxs(e.Fragment,{children:["AI verdict ",e.jsx("code",{className:"font-mono",children:j.ruleOrStepId.replace(/^ai-resolved::/,"")})," fail — "]}),j.source==="axe"&&e.jsxs(e.Fragment,{children:["axe rule ",e.jsx("code",{className:"font-mono",children:j.ruleOrStepId})," fail — "]}),j.source==="igt"&&e.jsxs(e.Fragment,{children:["Guided Test ",e.jsx("code",{className:"font-mono",children:j.ruleOrStepId})," fail — "]}),j.selector&&e.jsx("code",{className:"font-mono bg-rose-100 px-1 rounded mr-1",children:j.selector}),j.notes&&e.jsx("span",{className:"text-rose-700",children:j.notes})]},$))}),C&&C.length>0?e.jsx("ul",{className:"ml-3 mt-0.5 space-y-0.5",children:C.map((j,$)=>e.jsxs("li",{className:"text-[10px] text-amber-800",children:[j.source==="axe-incomplete"&&e.jsxs(e.Fragment,{children:["axe rule ",e.jsx("code",{className:"font-mono",children:j.ruleOrStepId})," — "]}),j.source==="igt-skip"&&e.jsxs(e.Fragment,{children:["Guided Test step ",e.jsx("code",{className:"font-mono",children:j.ruleOrStepId})," skipped — "]}),j.source==="ai-uncertain"&&e.jsxs(e.Fragment,{children:["AI rule ",e.jsx("code",{className:"font-mono",children:j.ruleOrStepId})," — "]}),j.resolutionHint,j.elements&&j.elements.length>0&&e.jsxs("span",{className:"block ml-1 mt-0.5 text-[10px] text-amber-700",children:["on ",j.elements.length===1?"element":`${j.elements.length} elements`,":"," ",j.elements.slice(0,3).map((z,I,O)=>e.jsxs("span",{children:[e.jsx("code",{className:"font-mono bg-amber-100 px-1 rounded",children:z.selector}),I<O.length-1&&e.jsx("span",{className:"text-amber-600",children:", "})]},I)),j.elements.length>3&&e.jsxs("span",{className:"text-amber-600",children:[", +",j.elements.length-3," more"]})]})]},$))}):m.kind==="inconclusive"&&e.jsx("p",{className:"ml-3 mt-0.5 text-[10px] text-amber-800 italic",children:"Re-run the audit to see the specific axe rule or Guided Test step responsible. (Cached data from a pre-rc.53 build doesn't carry the reason metadata.)"})]},N)})})]},m.kind)),r&&e.jsx("p",{className:"text-[10px] text-rose-700 bg-rose-50 border border-rose-200 rounded px-1.5 py-1 mt-1",children:r})]})]})}const ct={automation:{label:"Automation",hint:"axe-core rules — runs on every scan."},ai:{label:"AI judgment",hint:"wcagcheckr AI analyzers (alt-text, contrast, vision)."},human:{label:"Human verification",hint:"Independent Guided Tests — manual checks."}};function Aa({layers:t}){const s=g(n=>n.setView),a=["automation","ai","human"];return e.jsxs("div",{className:"border-t border-slate-200 px-3 py-2",children:[e.jsx("p",{className:"text-[11px] uppercase tracking-wide text-slate-500 mb-1.5",children:"Evidence layers"}),e.jsx("ul",{className:"space-y-1",children:a.map(n=>{const r=t[n],i=r.coveredCriteria.length,o=r.blocked.length,c=r.unevaluated.length,d=r.cleared,p=i>0&&o===0&&c===0,l=p?"text-emerald-700":o>0?"text-rose-700":"text-amber-700";return e.jsxs("li",{className:"flex items-start gap-2 text-[11px]",children:[e.jsx("span",{className:`w-5 h-5 inline-flex items-center justify-center rounded text-[10px] font-bold shrink-0 ${p?"bg-emerald-500 text-white":o>0?"bg-rose-500 text-white":"bg-amber-500 text-white"}`,"aria-hidden":"true",children:p?"✓":o>0?"!":"?"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-baseline gap-1.5 flex-wrap",children:[e.jsx("span",{className:"font-medium text-slate-800",children:ct[n].label}),e.jsx("span",{className:`font-mono text-[10px] ${l}`,children:i===0?"no coverage yet":`${d}/${i}`}),o>0&&e.jsxs("span",{className:"text-[10px] text-rose-700",children:["· ",o," blocked"]}),c>0&&e.jsxs("span",{className:"text-[10px] text-amber-700",children:["· ",c," pending"]})]}),e.jsx("p",{className:"text-[10px] text-slate-500 leading-snug",children:ct[n].hint}),n==="human"&&c>0&&e.jsx("button",{type:"button",onClick:()=>s("guided"),className:"text-[10px] text-brand-600 hover:underline mt-0.5",children:"Open Guided Tests →"})]})]},n)})})]})}function Ca({areas:t}){const s=t.map(a=>a.label);return e.jsxs("div",{className:"border-t border-rose-200 bg-rose-50 px-3 py-2 text-[11px] text-rose-900 leading-snug",children:[e.jsx("p",{className:"font-semibold mb-0.5",children:"⚠ Not lawsuit-safe"}),e.jsx("p",{children:s.length===1?e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:s[0]})," scored ",t[0].letter,". Even a high overall grade doesn't help if one area is failing — demand-letter mills target the weakest link."]}):e.jsxs(e.Fragment,{children:[s.length," areas are at lawsuit-risk:"," ",s.map((a,n)=>e.jsxs("span",{children:[e.jsx("strong",{children:a}),n<s.length-1?", ":""]},a)),". Fix these before relying on the overall grade."]})})]})}function Ra({grades:t}){const s=g(a=>a.setView);return e.jsxs("div",{className:"border-t border-slate-200 px-3 py-2",children:[e.jsx("p",{className:"text-[11px] uppercase tracking-wide text-slate-500 mb-2",children:"Verification areas"}),e.jsx("ul",{className:"grid grid-cols-1 gap-1.5",children:t.map(a=>e.jsxs("li",{className:"flex items-center gap-2 text-[11px]",children:[e.jsx("span",{className:`w-6 h-6 inline-flex items-center justify-center rounded text-xs font-bold ${Na[a.letter]}`,"aria-label":`Grade ${a.letter}`,children:a.letter}),e.jsx("span",{className:"font-medium text-slate-800 flex-1 min-w-0",children:a.label}),e.jsx(Ea,{grade:a,onOpenGuided:()=>s("guided")})]},a.id))})]})}function Ea({grade:t,onOpenGuided:s}){const a=n=>{if(!n)return"";const r=Y.find(i=>i.id===n);return(r==null?void 0:r.name)??n};if(t.untested)return e.jsxs("span",{className:"text-slate-500 text-[10px] italic",children:["not graded —"," ",t.primaryVerifierWorkflowId?e.jsxs("button",{type:"button",onClick:s,className:"text-brand-600 hover:underline not-italic",children:["run ",a(t.primaryVerifierWorkflowId)," →"]}):"no data yet"]});if(t.verifiedByIgt){const n=t.verifiedAt?zt(Date.now()-new Date(t.verifiedAt).getTime()):null;return e.jsxs("span",{className:"text-emerald-700 text-[10px]",title:t.suppressedHeuristicCount>0?`Heuristic flagged ${t.suppressedHeuristicCount} issue${t.suppressedHeuristicCount===1?"":"s"}, but you verified this area in Guided Tests — those are treated as noise unless you re-verify.`:"Verified via Guided Tests",children:["✓ verified",n?` ${n} ago`:""]})}return t.needsIgt?e.jsxs("button",{type:"button",onClick:s,className:"text-amber-700 hover:underline text-[10px]",title:"Verify this area by running the relevant Guided Tests workflow",children:["verify with ",a(t.primaryVerifierWorkflowId)," →"]}):t.counts.critical>0||t.counts.serious>0?e.jsxs("span",{className:"text-slate-500 text-[10px]",children:[t.counts.critical>0&&e.jsxs("span",{className:"text-rose-700",children:[t.counts.critical," critical"]}),t.counts.critical>0&&t.counts.serious>0&&" · ",t.counts.serious>0&&e.jsxs("span",{className:"text-orange-700",children:[t.counts.serious," serious"]})]}):e.jsx("span",{className:"text-emerald-700 text-[10px]",children:"clean"})}function Ta({violationsRemaining:t,manualCompleted:s,manualTotal:a}){const n=g(o=>o.setView),r=[{done:t===0,label:t===0?"Automated checks pass":`Fix ${t} automated violation${t===1?"":"s"}`,action:void 0,tooltip:void 0},{done:!0,label:`Optional: deep-check via Guided Tests (${s}/${a} done)`,action:()=>n("guided"),tooltip:"Guided Tests are opt-in. The audit's automated checks + AI analyzers already produce a binary pass/fail for every WCAG criterion. Run these workflows if you want belt-and-suspenders confidence on top of automation."},{done:!1,label:"Export AI fix prompt + complete manual checklist",action:()=>n("delta"),tooltip:`Switches to the Delta tab. Click the Export menu and pick "AI fix prompt" — markdown for ChatGPT/Claude/Copilot, with manual checklist for the WCAG criteria automation can't detect.`}],i=r.findIndex(o=>!o.done);return e.jsxs("div",{className:"border-t border-slate-200 px-3 py-2 bg-slate-50",children:[e.jsx("p",{className:"text-[11px] uppercase tracking-wide text-slate-500 mb-1.5",children:"Path to full WCAG compliance"}),e.jsx("ol",{className:"space-y-1 text-[11px]",children:r.map((o,c)=>{const d=c===i,p=o.done;return e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:p?"font-mono text-emerald-700 shrink-0":d?"font-mono text-brand-600 font-semibold shrink-0":"font-mono text-slate-400 shrink-0","aria-hidden":"true",children:p?"✓":`${c+1}.`}),o.action?e.jsxs("button",{type:"button",onClick:o.action,title:o.tooltip,className:d?"text-brand-700 font-semibold underline-offset-2 hover:underline text-left leading-snug":"text-slate-600 underline-offset-2 hover:underline hover:text-slate-900 text-left leading-snug",children:[o.label," →"]}):e.jsx("span",{className:p?"text-slate-500 line-through leading-snug":d?"text-slate-900 font-medium leading-snug":"text-slate-500 leading-snug",children:o.label})]},c)})})]})}function Ia({current:t,total:s}){return e.jsxs("div",{role:"status","aria-live":"polite",className:"border border-slate-200 rounded-lg bg-white p-4 flex items-center gap-3",children:[e.jsx("span",{className:"inline-block w-5 h-5 border-2 border-brand-500 border-t-transparent rounded-full animate-spin motion-reduce:animate-none","aria-hidden":"true"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-medium text-slate-900",children:"Scanning…"}),e.jsx("p",{className:"text-[11px] text-slate-500",children:typeof t=="number"&&typeof s=="number"?`State ${t} of ${s}. Grade will appear when the scan completes.`:"Grade will appear when the scan completes."})]})]})}function $a({scannedAt:t}){const s=Date.now()-new Date(t).getTime();return e.jsxs("div",{className:"bg-amber-50 border-b border-amber-200 px-3 py-1.5 text-[11px] text-amber-900 flex items-center gap-2",children:[e.jsx("span",{"aria-hidden":"true",children:"↻"}),e.jsxs("span",{children:["Showing a previous scan (",zt(s)," old). Re-scan to grade the current page state."]})]})}function zt(t){const s=Math.floor(t/1e3);if(s<60)return"less than a minute";if(s<120)return"1 minute";if(s<3600)return`${Math.floor(s/60)} minutes`;if(s<7200)return"1 hour";if(s<86400)return`${Math.floor(s/3600)} hours`;const a=Math.floor(s/86400);return a===1?"1 day":`${a} days`}const Qe="dismissedFindings";function Oe(t){try{const s=new URL(t);return`${s.origin}${s.pathname.replace(/\/+$/,"")}`}catch{return t}}function pe(t){return`reading-order::${t}`}function he(t){return`tab-order::${t}`}async function Me(){try{const t=await chrome.storage.local.get(Qe),s=t==null?void 0:t[Qe];if(s&&typeof s=="object")return s}catch{}return{}}async function tt(t){await chrome.storage.local.set({[Qe]:t})}async function Fe(t){return(await Me())[Oe(t)]??{}}async function Kt(t,s,a,n){const r=await Me(),i=Oe(t),o=r[i]??{};o[s]={reason:a,dismissedAt:new Date().toISOString(),snippet:n},r[i]=o,await tt(r)}async function ke(t,s){if(s.length===0)return;const a=await Me(),n=Oe(t),r=a[n]??{},i=new Date().toISOString();for(const o of s)r[o.key]={reason:o.reason,dismissedAt:i,snippet:o.snippet};a[n]=r,await tt(a)}async function qt(t,s){const a=await Me(),n=Oe(t),r=a[n];!r||!(s in r)||(delete r[s],Object.keys(r).length===0?delete a[n]:a[n]=r,await tt(a))}const _a=Object.freeze(Object.defineProperty({__proto__:null,addDismissal:Kt,addDismissals:ke,dismissalKeyForReadingOrder:pe,dismissalKeyForTabOrder:he,getDismissalsForUrl:Fe,removeDismissal:qt},Symbol.toStringTag,{value:"Module"}));function Qt(t){return[t.pseudoState,t.theme,t.direction,t.breakpoint.id].join(" · ")}function Jt(t){return`${Ze(t.ruleId,t.target.selector)}::${t.target.outerHTML.slice(0,64)}`}function La(t){const s=new Map;for(const a of t)for(const n of a.violations){const r=Jt(n),i=s.get(r);i?i.states.push(n.currentState):s.set(r,{representative:n,states:[n.currentState]})}return Array.from(s.values())}const dt={critical:0,serious:1,moderate:2,minor:3};function Ua(){var m,N,C,T;const t=g(b=>b.results),s=g(b=>b.componentId),a=g(b=>b.setView),n=((m=t[0])==null?void 0:m.pageUrl)??((N=t[0])==null?void 0:N.scope)??"",[r,i]=x.useState({}),[o,c]=x.useState(new Set);if(x.useEffect(()=>{if(!n)return;Fe(n).then(i);const b=()=>{document.visibilityState==="visible"&&n&&Fe(n).then(i)};return document.addEventListener("visibilitychange",b),()=>document.removeEventListener("visibilitychange",b)},[n]),x.useEffect(()=>{if(!s){c(new Set);return}let b=!1;const v=async()=>{const S=await chrome.storage.local.get("igtRuns");if(b)return;const w=((S==null?void 0:S.igtRuns)??{})[s]??{},A=new Set;for(const j of Y){const $=w[j.id];$&&Object.keys($.steps).length===j.steps.length&&A.add(j.id)}c(A)};v();const y=()=>{document.visibilityState==="visible"&&v()};return document.addEventListener("visibilitychange",y),()=>{b=!0,document.removeEventListener("visibilitychange",y)}},[s]),t.length===0)return e.jsx("div",{className:"p-4 text-center text-slate-500 text-sm",children:"No audit results yet. Pick an element to start."});const d=t.reduce((b,v)=>b+v.durationMs,0),p=t.reduce((b,v)=>b+v.violations.length,0),l=La(t);l.sort((b,v)=>{const y=dt[b.representative.impact]??99,S=dt[v.representative.impact]??99;return y!==S?y-S:v.states.length-b.states.length});const u=t.map(b=>Qt(b.state)).join(`
|
|
3
|
+
${h?"border-rose-400 ring-2 ring-rose-300":"border-slate-200 hover:border-slate-300"}`,children:[e.jsxs("div",{className:"flex items-start justify-between mb-1 gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-medium text-xs truncate",children:t.ruleId}),e.jsxs("div",{className:"text-xs text-slate-500",children:[t.wcagCriterion," · ",t.wcagLevel]})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[t.flakyAcrossRuns&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-amber-100 text-amber-700",title:"Did not appear in every audit run — likely a transient environment artifact",children:"flaky"}),e.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded ${oa[t.impact]}`,children:t.impact})]})]}),e.jsx("p",{className:"text-xs text-slate-700 mb-2",children:t.description}),e.jsx("code",{className:"text-[11px] bg-slate-50 p-1.5 rounded block text-slate-600 font-mono whitespace-pre-wrap break-all",children:t.target.outerHTML}),e.jsx(pa,{violation:t}),e.jsx(xa,{violation:t}),e.jsx(ma,{violation:t}),e.jsx(ha,{text:t.target.failureSummary}),e.jsx(ga,{ruleId:t.ruleId}),h&&e.jsxs("div",{className:"text-[11px] text-slate-600 mt-2 flex flex-wrap items-center gap-x-2 gap-y-1",children:[e.jsxs("span",{children:["State: ",la(t.currentState)]}),e.jsx("span",{"aria-hidden":"true",children:"·"}),e.jsx("a",{role:"button",tabIndex:0,onClick:C,onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),C(b))},className:"text-brand-600 hover:underline cursor-pointer",children:"Load state"}),e.jsx("span",{"aria-hidden":"true",children:"·"}),e.jsx("a",{role:"button",tabIndex:0,onClick:T,onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),T(b))},className:"text-brand-600 hover:underline cursor-pointer",children:"Load default"}),f&&e.jsx("span",{className:"text-amber-700 basis-full",children:"Couldn't find this element on the page. The story may have re-rendered or unmounted."})]}),t.needsReview&&e.jsx("div",{className:"mt-2 flex items-center gap-2 text-xs",children:u?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"inline-flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded bg-emerald-100 text-emerald-800 font-semibold",children:"✓ Acknowledged"}),e.jsx("span",{role:"button",tabIndex:0,onClick:b=>{b.stopPropagation(),l(t.matchKey),da(t,c)},onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),b.target.click())},className:"text-slate-600 hover:text-slate-900 hover:underline cursor-pointer",children:"Un-acknowledge"})]}):e.jsx("span",{role:"button",tabIndex:0,onClick:b=>{b.stopPropagation(),p(t.matchKey),ca(t,c)},onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),b.target.click())},title:"Mark this finding as 'reviewed, not an issue.' It won't appear in future audits unless the content changes.",className:"px-2 py-0.5 border border-slate-300 bg-white text-slate-700 rounded hover:bg-slate-50 cursor-pointer",children:"Acknowledge as not an issue"})}),t.helpUrl&&e.jsx("a",{href:t.helpUrl,target:"_blank",rel:"noreferrer",onClick:b=>b.stopPropagation(),className:"text-xs text-brand-600 hover:underline mt-2 inline-block",children:"Learn more →"})]})}function la(t){const s=[];return s.push(t.pseudoState==="default"?"default":`:${t.pseudoState}`),t.theme!=="light"&&s.push(t.theme),t.direction!=="ltr"&&s.push(t.direction),t.breakpoint.id!=="desktop"&&s.push(t.breakpoint.id),t.ariaVariation&&s.push(t.ariaVariation.id),s.join(" · ")}async function ca(t,s){await ls({componentId:t.componentId,matchKey:t.matchKey,ruleId:t.ruleId}),await Bt(t.componentId,s)}async function da(t,s){await os(t.componentId,t.matchKey),await Bt(t.componentId,s)}async function Bt(t,s){const a=s.flatMap(n=>n.violations);try{const n=await q({type:"BASELINE_COMPARE",componentId:t,currentViolations:a});g.getState().setDelta(n.delta)}catch{}}function ua(){const t=Lt.breakpointPresets;return{pseudoState:"default",ariaVariation:null,theme:"light",direction:"ltr",breakpoint:t.find(a=>a.id==="desktop")??t[0]}}function Ht(t){if(t.ruleId!=="color-contrast"&&t.ruleId!=="color-contrast-enhanced")return null;const s=t.target.failureSummary||"",a=/contrast of (\d+(?:\.\d+)?)/i.exec(s),n=/Expected contrast ratio of (\d+(?:\.\d+)?):1/i.exec(s),r=/foreground color:\s*(#[0-9a-fA-F]+)/i.exec(s),i=/background color:\s*(#[0-9a-fA-F]+)/i.exec(s);return!a||!n?null:{ratio:parseFloat(a[1]),required:parseFloat(n[1]),fg:(r==null?void 0:r[1])??"#000000",bg:(i==null?void 0:i[1])??"#ffffff"}}function pa({violation:t}){const s=Ht(t);if(!s)return null;const a=s.ratio>=s.required;return e.jsxs("div",{className:"mt-2 flex items-center gap-2 text-[11px]",children:[e.jsx("div",{className:"flex items-center justify-center w-9 h-6 rounded border border-slate-300",style:{background:s.bg,color:s.fg},title:`fg ${s.fg} on bg ${s.bg}`,children:"Aa"}),e.jsxs("span",{className:a?"text-green-700":"text-rose-700 font-medium",children:[s.ratio.toFixed(2)," : 1"]}),e.jsxs("span",{className:"text-slate-500",children:["needs ",s.required.toFixed(1)," : 1"]})]})}function ha({text:t}){return t?e.jsxs("details",{className:"mt-2",children:[e.jsx("summary",{className:"text-[11px] text-slate-500 cursor-pointer hover:text-slate-700",children:"Show failure detail"}),e.jsx("pre",{className:"text-[11px] text-slate-600 whitespace-pre-wrap mt-1 bg-slate-50 p-1.5 rounded",children:t})]}):null}function ma({violation:t}){const s=ia(t);return s.length===0?null:e.jsx("div",{className:"mt-2 flex flex-wrap gap-1",children:s.map(a=>e.jsx("span",{title:`${a.region} — ${a.blurb}`,className:"text-[10px] px-1.5 py-0.5 rounded bg-slate-100 text-slate-600 border border-slate-200",children:a.name},a.id))})}function xa({violation:t}){const s=Ht(t),[a,n]=x.useState({kind:"idle"});if(!s)return null;async function r(){n({kind:"loading"});try{const i=t.ruleId==="color-contrast-enhanced"?"AAA":"AA",o=await q({type:"AI_COLOR_SUGGEST_REQUEST",inputs:[{matchKey:t.matchKey,foreground:s.fg,background:s.bg,fontSize:16,fontWeight:400,targetLevel:i}]}),c=o.results.find(d=>d.matchKey===t.matchKey);n(c?{kind:"ready",suggestion:c}:{kind:"empty",reason:o.unavailableReason??"AI returned no suggestions for this contrast pair."})}catch(i){n({kind:"empty",reason:i instanceof Error?i.message:String(i)})}}return e.jsxs("div",{className:"mt-2",children:[a.kind==="idle"&&e.jsx("button",{type:"button",onClick:i=>{i.stopPropagation(),r()},className:"text-[11px] px-2 py-1 rounded border border-brand-300 bg-brand-50 text-brand-700 hover:bg-brand-100 font-medium",title:"Ask the configured AI for in-palette color replacements that pass WCAG contrast.",children:"✨ AI fix suggestions"}),a.kind==="loading"&&e.jsx("span",{className:"text-[11px] text-slate-500",children:"Asking AI for color suggestions…"}),a.kind==="empty"&&e.jsx("p",{className:"text-[11px] text-slate-500 bg-slate-50 border border-slate-200 rounded p-2",children:a.reason}),a.kind==="ready"&&e.jsxs("div",{className:"border border-brand-200 rounded bg-brand-50 p-2 space-y-2",children:[e.jsxs("p",{className:"text-[11px] text-brand-900 font-medium",children:["AI suggestions (",a.suggestion.suggestions.length,")"]}),e.jsx("ul",{className:"space-y-1.5",children:a.suggestion.suggestions.map((i,o)=>e.jsxs("li",{className:"flex items-start gap-2 text-[11px]",children:[e.jsx("div",{className:"flex items-center justify-center w-9 h-6 rounded border border-slate-300 shrink-0",style:{background:i.background,color:i.foreground},title:`fg ${i.foreground} on bg ${i.background}`,children:"Aa"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-baseline gap-1.5",children:[e.jsx("code",{className:"font-mono",children:i.foreground}),e.jsx("span",{className:"text-slate-500",children:"on"}),e.jsx("code",{className:"font-mono",children:i.background}),e.jsxs("span",{className:"text-emerald-700 font-medium",children:[i.contrast.toFixed(2)," : 1"]})]}),i.rationale&&e.jsx("p",{className:"text-slate-600 mt-0.5",children:i.rationale})]})]},o))}),a.suggestion.reasoning&&e.jsx("p",{className:"text-[10px] text-slate-500 italic",children:a.suggestion.reasoning})]})]})}function ga({ruleId:t}){const s=cs(t);return s?e.jsxs("details",{className:"mt-2",children:[e.jsx("summary",{className:"text-[11px] text-emerald-700 cursor-pointer hover:text-emerald-900 font-medium",children:"How to fix"}),e.jsxs("div",{className:"mt-1 bg-emerald-50 border border-emerald-200 rounded p-2 space-y-2",children:[e.jsx("p",{className:"text-[11px] text-slate-700 leading-relaxed",children:s.summary}),s.snippet&&e.jsx("pre",{className:"text-[11px] text-slate-700 bg-white p-1.5 rounded border border-emerald-100 overflow-x-auto",children:e.jsx("code",{children:s.snippet})})]})]}):null}const fa=[{id:"contrast",label:"Color & contrast",axeRules:["color-contrast","color-contrast-enhanced","link-in-text-block"],igtWorkflowIds:["visual-indicators"]},{id:"alt-text",label:"Alt text",axeRules:["image-alt","input-image-alt","object-alt","svg-img-alt","area-alt","role-img-alt"],igtWorkflowIds:[]},{id:"forms",label:"Forms",axeRules:["label","select-name","aria-input-field-name","aria-toggle-field-name","form-field-multiple-labels","label-content-name-mismatch","autocomplete-valid","label-title-only","wcc-onfocus-context-change","wcc-oninput-context-change","wcc-cognitive-auth-challenge"],igtWorkflowIds:["forms"]},{id:"keyboard",label:"Keyboard",axeRules:["nested-interactive","tabindex","frame-focusable-content","no-focusable-content","focus-order-semantics","wcc-gesture-no-alternative","wcc-drag-no-alternative"],igtWorkflowIds:["keyboard","focus-management"]},{id:"tab-order",label:"Tab order",axeRules:[],igtWorkflowIds:[],verifiedByWorkflowIds:["keyboard"],heuristic:"tab-order"},{id:"screen-reader",label:"Screen reader / ARIA",axeRules:["aria-allowed-attr","aria-required-attr","aria-required-children","aria-required-parent","aria-roles","aria-valid-attr-value","aria-valid-attr","aria-hidden-body","aria-hidden-focus","button-name","input-button-name","link-name","frame-title","presentation-role-conflict","aria-allowed-role","aria-prohibited-attr","aria-text","aria-deprecated-role","aria-conditional-attr","aria-braille-equivalent","empty-button","empty-heading","empty-link"],igtWorkflowIds:["screen-reader"]},{id:"reading-order",label:"Reading order",axeRules:[],igtWorkflowIds:[],verifiedByWorkflowIds:["page-structure"],heuristic:"reading-order"},{id:"page-structure",label:"Page structure",axeRules:["heading-order","page-has-heading-one","landmark-one-main","landmark-no-duplicate-banner","landmark-no-duplicate-contentinfo","landmark-no-duplicate-main","region","bypass","empty-table-header","landmark-banner-is-top-level","landmark-complementary-is-top-level","landmark-contentinfo-is-top-level","landmark-main-is-top-level","landmark-unique"],igtWorkflowIds:["page-structure"]}];function ba(t){const s=fa.map(i=>va(i,t)),a=s.reduce((i,o)=>i+ya(o.letter),0)/Math.max(1,s.length),n=ja(Math.round(a)),r=s.filter(i=>i.letter==="D"||i.letter==="F");return{overallLetter:n,subGrades:s,warningAreas:r,isLawsuitRisk:r.length>0}}function va(t,s){const a=new Set(t.axeRules),n=s.violations.filter(w=>a.has(w.ruleId)),r=s.manualRuns.filter(w=>t.igtWorkflowIds.includes(w.workflowId)),i=t.igtWorkflowIds.map(w=>s.workflows.find(A=>A.id===w)).filter(w=>w!=null);let o=i.length>0;for(const w of i){const A=r.find($=>$.workflowId===w.id);if((A?Object.keys(A.steps).length:0)!==w.steps.length){o=!1;break}}const c=r.some(w=>Object.keys(w.steps).length>0),d=t.verifiedByWorkflowIds??[],p=s.manualRuns.filter(w=>d.includes(w.workflowId)),l=d.map(w=>s.workflows.find(A=>A.id===w)).filter(w=>w!=null);let u=d.length>0&&l.length===d.length;for(const w of l){const A=p.find($=>$.workflowId===w.id);if((A?Object.keys(A.steps).length:0)!==w.steps.length){u=!1;break}}let h=null;if(u)for(const w of p)w.completedAt&&(h===null||w.completedAt>h)&&(h=w.completedAt);const f=t.heuristic==="tab-order"?s.heuristicCounts.tabOrder??0:t.heuristic==="reading-order"?s.heuristicCounts.readingOrder??0:0,m=d[0]??t.igtWorkflowIds[0]??null;if(u&&d.length>0)return{id:t.id,label:t.label,letter:"A",untested:!1,needsIgt:!1,igtCompleted:!0,verifiedByIgt:!0,verifiedAt:h,suppressedHeuristicCount:f,primaryVerifierWorkflowId:m,counts:{critical:0,serious:0,moderate:0,minor:0},caps:{cappedAtC:!1,cappedAtB:!1}};const N=t.axeRules.length>0||t.heuristic!=null,C=t.igtWorkflowIds.length>0;if(N?!s.auditRan:!c)return{id:t.id,label:t.label,letter:"F",untested:!0,needsIgt:C||d.length>0,igtCompleted:!1,verifiedByIgt:!1,verifiedAt:null,suppressedHeuristicCount:0,primaryVerifierWorkflowId:m,counts:{critical:0,serious:0,moderate:0,minor:0},caps:{cappedAtC:!1,cappedAtB:!1}};const b={critical:0,serious:0,moderate:0,minor:0};for(const w of Et(n))b[w.impact]++;b.serious+=f;for(const w of r){const A=i.find(j=>j.id===w.workflowId);if(A)for(const j of A.steps){const $=w.steps[j.id];($==null?void 0:$.status)==="fail"&&(j.severity==="required"?b.serious++:b.moderate++)}}const v=b.critical>0,y=b.serious>0;let S;b.critical>=5?S="F":b.critical>=1?S="D":b.serious>=1?S="C":b.moderate>=1?S="B":S="A";const E=S!=="A"&&(C&&!o||d.length>0&&!u);return{id:t.id,label:t.label,letter:S,untested:!1,needsIgt:E,igtCompleted:o,verifiedByIgt:!1,verifiedAt:null,suppressedHeuristicCount:0,primaryVerifierWorkflowId:m,counts:b,caps:{cappedAtC:v,cappedAtB:y}}}function ya(t){return t==="A"?4:t==="B"?3:t==="C"?2:t==="D"?1:0}function ja(t){return t>=4?"A":t>=3?"B":t>=2?"C":t>=1?"D":"F"}const wa={A:"bg-emerald-500",B:"bg-lime-500",C:"bg-yellow-500",D:"bg-orange-500",F:"bg-rose-600"},Na={A:"bg-emerald-500 text-white",B:"bg-lime-500 text-white",C:"bg-yellow-500 text-slate-900",D:"bg-orange-500 text-white",F:"bg-rose-600 text-white"};function ka({violations:t,componentId:s}){var Q,te,J,ne,re,G,Se;const[a,n]=x.useState([]),[r,i]=x.useState([]),[o,c]=x.useState(new Set),[d,p]=x.useState(null),[l,u]=x.useState({}),[h,f]=x.useState(new Set),m=g(_=>_.status),N=g(_=>_.progress),C=g(_=>_.freshThisSession),T=g(_=>_.results),b=(Q=T[0])==null?void 0:Q.startedAt,v=((te=T[0])==null?void 0:te.pageUrl)??((J=T[0])==null?void 0:J.scope)??null;if(x.useEffect(()=>{if(!s){n([]);return}let _=!1;return chrome.storage.local.get("igtRuns").then(W=>{if(_)return;const U=((W==null?void 0:W.igtRuns)??{})[s]??{};n(Object.values(U))}),()=>{_=!0}},[s]),x.useEffect(()=>{if(!v){i([]);return}let _=!1;return Re(v).then(W=>{_||i(W)}),()=>{_=!0}},[v]),m==="running")return e.jsx(Ia,{current:N==null?void 0:N.current,total:N==null?void 0:N.total});const y=ba({violations:t,auditRan:T.length>0,manualRuns:a,workflows:Y,heuristicCounts:{tabOrder:((re=(ne=T[0])==null?void 0:ne.tabOrderIssues)==null?void 0:re.length)??0,readingOrder:((Se=(G=T[0])==null?void 0:G.readingOrderIssues)==null?void 0:Se.length)??0}}),S=g(_=>_.acknowledgedKeys),E=T.length>0?Tt(T,{runs:a,workflows:Y},"2.1","AA",S,r):void 0,w=T.length>0?ds(It({audits:T,igtRuns:a,workflows:Y,acknowledgedMatchKeys:S,incompleteResolutions:r}),Y):void 0,A=E?E.failingCriteria.length>0||E.inconclusiveCriteria.length>0:!1,j=A&&y.overallLetter==="A"?"B":y.overallLetter;async function $(_){var B;if(!v||!((B=E==null?void 0:E.inconclusiveReasons)!=null&&B[_]))return;const k=E.inconclusiveReasons[_].filter(V=>V.source==="axe-incomplete"&&V.elements&&V.elements.length>0);if(k.length===0)return;c(V=>new Set(V).add(_)),p(null);const U=[];let L=0;try{for(const D of k){const K=await H({type:"AI_RESOLVE_INCOMPLETE_REQUEST",ruleId:D.ruleOrStepId,pageUrl:D.pageUrl??v,wcagCriterion:_,elements:D.elements??[],targetLevel:"AA"});if(K!=null&&K.unavailableReason){p(K.unavailableReason);break}K!=null&&K.resolutions&&(U.push(...K.resolutions),L+=K.totalCostUsd??0)}if(v){const D=await Re(v);i(D)}const V={total:U.length,pass:U.filter(D=>D.verdict==="pass").length,fail:U.filter(D=>D.verdict==="fail").length,uncertain:U.filter(D=>D.verdict==="uncertain").length,costUsd:L,resolutions:U};u(D=>({...D,[_]:V}))}finally{c(V=>{const D=new Set(V);return D.delete(_),D})}}function z(_){f(W=>{const k=new Set(W);return k.has(_)?k.delete(_):k.add(_),k})}async function I(_){var K,xe;if(!v)return;const W=((K=E==null?void 0:E.inconclusiveReasons)==null?void 0:K[_])??[],k=((xe=E==null?void 0:E.failingReasons)==null?void 0:xe[_])??[],U=[],L=new Set;for(const M of W){if(M.source!=="axe-incomplete"||!M.elements)continue;const ie=M.pageUrl??v;for(const oe of M.elements){const ge=`${ie}::${M.ruleOrStepId}::${oe.selector}`;L.has(ge)||(L.add(ge),U.push({ruleId:M.ruleOrStepId,pageUrl:ie,selector:oe.selector}))}}for(const M of k){if(M.source!=="ai"||!M.selector)continue;const ie=M.ruleOrStepId.startsWith("ai-resolved::")?M.ruleOrStepId.slice(13):M.ruleOrStepId,oe=M.pageUrl??v,ge=`${oe}::${ie}::${M.selector}`;L.has(ge)||(L.add(ge),U.push({ruleId:ie,pageUrl:oe,selector:M.selector}))}if(U.length===0)return;const B=new Date().toISOString(),V=[];for(const M of U){const ie=r.find(oe=>oe.pageUrl===M.pageUrl&&oe.ruleId===M.ruleId&&oe.selector===M.selector);ie&&ie.verdict==="pass"&&ie.reasoning.startsWith("Marked as visually verified")||V.push({pageUrl:M.pageUrl,ruleId:M.ruleId,selector:M.selector,verdict:"pass",reasoning:`Marked as visually verified by user on ${B.slice(0,10)}.`,resolvedAt:B,costUsd:0,wcagCriterion:_})}if(V.length===0)return;await us(V);const D=await Re(v);i(D),u(M=>({...M,[_]:{total:V.length,pass:V.length,fail:0,uncertain:0,costUsd:0,resolutions:V}}))}const O=(()=>{if(!A||y.overallLetter!=="A"||!E)return null;const _=E.inconclusiveCriteria.length,W=E.failingCriteria.length,k=[];W>0&&k.push(`${W} WCAG ${E.targetLevel} ${W===1?"criterion":"criteria"} failing`),_>0&&k.push(`${_} WCAG ${E.targetLevel} ${_===1?"criterion":"criteria"} inconclusive`);const U=W>0?"Fix the failing items OR Mark visually verified if AI was wrong about them.":"Resolve axe-incomplete + IGT-skip items to claim conformance.";return`Capped at B — ${k.join(" + ")}. ${U}`})();let P=0;for(const _ of Y){const W=a.find(U=>U.workflowId===_.id);if(!W)continue;_.steps.every(U=>{const L=W.steps[U.id];return(L==null?void 0:L.status)==="pass"||(L==null?void 0:L.status)==="fail"||(L==null?void 0:L.status)==="skip"||(L==null?void 0:L.status)==="not-applicable"})&&P++}const Z=Et(t.filter(_=>!S.has(_.matchKey))).length;return e.jsxs("div",{className:"border border-slate-200 rounded-lg bg-white overflow-hidden",children:[!C&&b&&e.jsx($a,{scannedAt:b}),e.jsxs("div",{className:"flex",children:[e.jsx("div",{className:`flex items-center justify-center w-24 ${wa[j]} text-white shrink-0`,children:e.jsx("span",{className:"text-5xl font-bold leading-none",children:j})}),e.jsxs("div",{className:"flex-1 p-3 space-y-1",children:[e.jsx("p",{className:"text-xs font-semibold text-slate-900",children:"Overall grade"}),e.jsxs("p",{className:"text-[11px] text-slate-600 leading-snug",children:["Mean of ",y.subGrades.length," verification areas below. Untested areas count as F until verified."]}),O&&e.jsx("p",{className:"text-[11px] text-amber-800 leading-snug mt-1 bg-amber-50 border border-amber-200 rounded px-2 py-1",children:O})]})]}),y.isLawsuitRisk&&e.jsx(Ca,{areas:y.warningAreas}),e.jsx(Ra,{grades:y.subGrades}),E&&e.jsx(Sa,{coverage:E,onResolveWithAi:$,onMarkVisuallyVerified:I,resolving:o,resolveError:d,lastResolveResult:l,expandedResultFor:h,onToggleResultDetail:z}),w&&e.jsx(Aa,{layers:w}),e.jsx(Ta,{violationsRemaining:Z,manualCompleted:P,manualTotal:Y.length}),P>0||T.length>0?e.jsxs("div",{className:"border-t border-slate-200 px-3 py-2 bg-slate-50",children:[e.jsx("p",{className:"text-[11px] uppercase tracking-wide text-slate-500 mb-1.5",children:"Manual coverage (Guided Tests)"}),e.jsxs("div",{className:"text-[11px] text-slate-700 mb-1.5",children:[e.jsx("strong",{children:P})," of ",e.jsx("strong",{children:Y.length})," workflows complete"]}),e.jsx("div",{className:"flex h-1 bg-slate-200 rounded-full overflow-hidden",children:e.jsx("div",{className:"bg-emerald-500",style:{width:`${P/Y.length*100}%`}})})]}):null]})}function Sa({coverage:t,onResolveWithAi:s,onMarkVisuallyVerified:a,resolving:n,resolveError:r,lastResolveResult:i,expandedResultFor:o,onToggleResultDetail:c}){const d=t.untestedCriteria.length+t.inconclusiveCriteria.length,[p,l]=x.useState(d>0&&d<=3),u=t.totalApplicable===0?0:Math.round(t.evaluated/t.totalApplicable*100),h=t.canClaimConformance,f=[];return t.failingCriteria.length>0&&f.push({kind:"failing",ids:t.failingCriteria}),t.inconclusiveCriteria.length>0&&f.push({kind:"inconclusive",ids:t.inconclusiveCriteria}),t.untestedCriteria.length>0&&f.push({kind:"untested",ids:t.untestedCriteria}),e.jsxs("div",{className:`border-t ${h?"border-emerald-200 bg-emerald-50":"border-amber-200 bg-amber-50"} px-3 py-2 text-[11px] leading-snug`,children:[e.jsxs("div",{className:`flex items-center justify-between gap-2 ${h?"text-emerald-900":"text-amber-900"}`,children:[e.jsxs("div",{children:[e.jsxs("span",{className:"font-semibold",children:["WCAG ",t.targetVersion," ",t.targetLevel," coverage:"," ",t.evaluated," of ",t.totalApplicable," criteria evaluated (",u,"%)"]}),h&&e.jsxs("p",{className:"text-[11px] mt-0.5",children:["Every applicable criterion has been evaluated and either passes or is N/A. This audit can be presented as a conformance-claim for ",t.targetVersion," ",t.targetLevel," for the audited URL(s)."]}),!h&&(()=>{const m=[];t.failingCriteria.length>0&&m.push("failing"),t.inconclusiveCriteria.length>0&&m.push("inconclusive"),t.untestedCriteria.length>0&&m.push("untested");const N=m.length===0?"unresolved":m.length===1?m[0]:m.length===2?`${m[0]} or ${m[1]}`:`${m.slice(0,-1).join(", ")}, or ${m[m.length-1]}`;return e.jsxs("p",{className:"text-[11px] mt-0.5 font-semibold",children:["Cannot claim ",t.targetLevel," conformance — applicable criteria remain ",N,"."]})})(),!h&&t.untestedCriteria.length>0&&e.jsxs("p",{className:"text-[11px] mt-0.5",children:[e.jsxs("strong",{children:[t.untestedCriteria.length," untested"]})," ",t.untestedCriteria.length===1?"criterion":"criteria"," — mark Pass / Fail / N/A in Guided Tests below."]}),!h&&t.inconclusiveCriteria.length>0&&e.jsxs("p",{className:"text-[11px] mt-0.5",children:[e.jsxs("strong",{children:[t.inconclusiveCriteria.length," inconclusive"]})," ",t.inconclusiveCriteria.length===1?"criterion":"criteria"," — axe couldn't fully determine OR an IGT step was skipped. Resolve before claiming conformance."]})]}),!h&&f.length>0&&e.jsx("button",{type:"button",onClick:()=>l(m=>!m),className:"text-[11px] underline shrink-0 self-start",children:p?"hide":"show list"})]}),p&&!h&&e.jsxs("div",{className:"mt-1.5 space-y-1.5",children:[f.map(m=>e.jsxs("div",{children:[e.jsxs("div",{className:`text-[10.5px] font-semibold uppercase tracking-wide ${m.kind==="failing"?"text-rose-900":"text-amber-900"}`,children:[m.kind==="untested"?"Untested":m.kind==="inconclusive"?"Inconclusive":"Failing"," (",m.ids.length,")"]}),e.jsx("ul",{className:"text-[10.5px] text-amber-900 space-y-1",children:m.ids.map(N=>{var w,A;const C=m.kind==="inconclusive"?(w=t.inconclusiveReasons)==null?void 0:w[N]:void 0,T=m.kind==="failing"?(A=t.failingReasons)==null?void 0:A[N]:void 0,b=C==null?void 0:C.some(j=>j.source==="axe-incomplete"&&j.elements&&j.elements.length>0),v=T==null?void 0:T.some(j=>j.source==="ai"),y=(n==null?void 0:n.has(N))??!1,S=i==null?void 0:i[N],E=(o==null?void 0:o.has(N))??!1;return e.jsxs("li",{className:"leading-snug",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 flex-wrap",children:[e.jsxs("code",{className:"font-mono text-[11px]",children:["· ",N]}),(m.kind==="inconclusive"&&b||m.kind==="failing"&&v)&&(s||a)&&e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[m.kind==="inconclusive"&&s&&e.jsx("button",{type:"button",disabled:y,onClick:()=>s(N),className:"text-[11px] font-semibold px-2 py-1 bg-brand-500 text-white rounded hover:bg-brand-600 disabled:opacity-50 shadow-sm",title:"Ask AI to determine pass/fail for the specific elements axe couldn't sample.",children:y?"Resolving…":S?"✨ Resolve again →":"✨ Resolve with AI →"}),a&&e.jsx("button",{type:"button",disabled:y,onClick:()=>a(N),className:"text-[11px] font-semibold px-2 py-1 bg-white text-emerald-700 border border-emerald-500 rounded hover:bg-emerald-50 disabled:opacity-50",title:m.kind==="failing"?"Override AI's fail determination — your human visual judgment is the highest authority per WCAG-EM.":"Mark all unresolved elements as visually verified by you. Same semantic weight as Acknowledge on a violation — closes the loop for items only a human can judge (text over images, gradients, etc.).",children:"✓ Mark visually verified"})]})]}),S&&e.jsxs("div",{className:"ml-3 mt-1 p-1.5 bg-white/60 border border-amber-200 rounded text-[10.5px]",children:[e.jsxs("div",{className:"font-semibold text-amber-900 flex items-center gap-2 flex-wrap",children:["AI returned ",S.total," ",S.total===1?"verdict":"verdicts",":",S.pass>0&&e.jsxs("span",{className:"text-emerald-700",children:["✓ ",S.pass," pass"]}),S.fail>0&&e.jsxs("span",{className:"text-rose-700",children:["✗ ",S.fail," fail"]}),S.uncertain>0&&e.jsxs("span",{className:"text-amber-700",children:["? ",S.uncertain," uncertain"]}),e.jsxs("span",{className:"text-slate-500 font-normal",children:["· $",S.costUsd.toFixed(4)]}),c&&e.jsx("button",{type:"button",onClick:()=>c(N),className:"ml-auto text-[10px] underline text-brand-700",children:E?"hide reasoning":"show reasoning"})]}),S.uncertain>0&&e.jsxs("p",{className:"mt-0.5 text-[10px] text-amber-800",children:["AI couldn't determine ",S.uncertain," ",S.uncertain===1?"element":"elements"," ","(typically text over images/gradients — needs visual review). These keep the criterion inconclusive."]}),S.pass===S.total&&S.total>0&&e.jsxs("p",{className:"mt-0.5 text-[10px] text-emerald-800",children:["All elements passed contrast — criterion above will flip to"," ",e.jsx("strong",{children:"pass"})," on next render."]}),E&&e.jsx("ul",{className:"mt-1.5 space-y-1 max-h-40 overflow-y-auto",children:S.resolutions.map((j,$)=>e.jsxs("li",{className:"text-[10px] leading-snug",children:[e.jsx("span",{className:j.verdict==="pass"?"text-emerald-700 font-semibold":j.verdict==="fail"?"text-rose-700 font-semibold":"text-amber-700 font-semibold",children:j.verdict==="pass"?"✓":j.verdict==="fail"?"✗":"?"})," ",e.jsx("code",{className:"font-mono bg-slate-100 px-1 rounded",children:j.selector}),e.jsx("div",{className:"ml-4 text-slate-600",children:j.reasoning})]},$))})]}),T&&T.length>0&&e.jsx("ul",{className:"ml-3 mt-0.5 space-y-0.5",children:T.map((j,$)=>e.jsxs("li",{className:"text-[10px] text-rose-800",children:[j.source==="ai"&&e.jsxs(e.Fragment,{children:["AI verdict ",e.jsx("code",{className:"font-mono",children:j.ruleOrStepId.replace(/^ai-resolved::/,"")})," fail — "]}),j.source==="axe"&&e.jsxs(e.Fragment,{children:["axe rule ",e.jsx("code",{className:"font-mono",children:j.ruleOrStepId})," fail — "]}),j.source==="igt"&&e.jsxs(e.Fragment,{children:["Guided Test ",e.jsx("code",{className:"font-mono",children:j.ruleOrStepId})," fail — "]}),j.selector&&e.jsx("code",{className:"font-mono bg-rose-100 px-1 rounded mr-1",children:j.selector}),j.notes&&e.jsx("span",{className:"text-rose-700",children:j.notes})]},$))}),C&&C.length>0?e.jsx("ul",{className:"ml-3 mt-0.5 space-y-0.5",children:C.map((j,$)=>e.jsxs("li",{className:"text-[10px] text-amber-800",children:[j.source==="axe-incomplete"&&e.jsxs(e.Fragment,{children:["axe rule ",e.jsx("code",{className:"font-mono",children:j.ruleOrStepId})," — "]}),j.source==="igt-skip"&&e.jsxs(e.Fragment,{children:["Guided Test step ",e.jsx("code",{className:"font-mono",children:j.ruleOrStepId})," skipped — "]}),j.source==="ai-uncertain"&&e.jsxs(e.Fragment,{children:["AI rule ",e.jsx("code",{className:"font-mono",children:j.ruleOrStepId})," — "]}),j.resolutionHint,j.elements&&j.elements.length>0&&e.jsxs("span",{className:"block ml-1 mt-0.5 text-[10px] text-amber-700",children:["on ",j.elements.length===1?"element":`${j.elements.length} elements`,":"," ",j.elements.slice(0,3).map((z,I,O)=>e.jsxs("span",{children:[e.jsx("code",{className:"font-mono bg-amber-100 px-1 rounded",children:z.selector}),I<O.length-1&&e.jsx("span",{className:"text-amber-600",children:", "})]},I)),j.elements.length>3&&e.jsxs("span",{className:"text-amber-600",children:[", +",j.elements.length-3," more"]})]})]},$))}):m.kind==="inconclusive"&&e.jsx("p",{className:"ml-3 mt-0.5 text-[10px] text-amber-800 italic",children:"Re-run the audit to see the specific axe rule or Guided Test step responsible. (Cached data from a pre-rc.53 build doesn't carry the reason metadata.)"})]},N)})})]},m.kind)),r&&e.jsx("p",{className:"text-[10px] text-rose-700 bg-rose-50 border border-rose-200 rounded px-1.5 py-1 mt-1",children:r})]})]})}const ct={automation:{label:"Automation",hint:"axe-core rules — runs on every scan."},ai:{label:"AI judgment",hint:"wcagcheckr AI analyzers (alt-text, contrast, vision)."},human:{label:"Human verification",hint:"Independent Guided Tests — manual checks."}};function Aa({layers:t}){const s=g(n=>n.setView),a=["automation","ai","human"];return e.jsxs("div",{className:"border-t border-slate-200 px-3 py-2",children:[e.jsx("p",{className:"text-[11px] uppercase tracking-wide text-slate-500 mb-1.5",children:"Evidence layers"}),e.jsx("ul",{className:"space-y-1",children:a.map(n=>{const r=t[n],i=r.coveredCriteria.length,o=r.blocked.length,c=r.unevaluated.length,d=r.cleared,p=i>0&&o===0&&c===0,l=p?"text-emerald-700":o>0?"text-rose-700":"text-amber-700";return e.jsxs("li",{className:"flex items-start gap-2 text-[11px]",children:[e.jsx("span",{className:`w-5 h-5 inline-flex items-center justify-center rounded text-[10px] font-bold shrink-0 ${p?"bg-emerald-500 text-white":o>0?"bg-rose-500 text-white":"bg-amber-500 text-white"}`,"aria-hidden":"true",children:p?"✓":o>0?"!":"?"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-baseline gap-1.5 flex-wrap",children:[e.jsx("span",{className:"font-medium text-slate-800",children:ct[n].label}),e.jsx("span",{className:`font-mono text-[10px] ${l}`,children:i===0?"no coverage yet":`${d}/${i}`}),o>0&&e.jsxs("span",{className:"text-[10px] text-rose-700",children:["· ",o," blocked"]}),c>0&&e.jsxs("span",{className:"text-[10px] text-amber-700",children:["· ",c," pending"]})]}),e.jsx("p",{className:"text-[10px] text-slate-500 leading-snug",children:ct[n].hint}),n==="human"&&c>0&&e.jsx("button",{type:"button",onClick:()=>s("guided"),className:"text-[10px] text-brand-600 hover:underline mt-0.5",children:"Open Guided Tests →"})]})]},n)})})]})}function Ca({areas:t}){const s=t.map(a=>a.label);return e.jsxs("div",{className:"border-t border-rose-200 bg-rose-50 px-3 py-2 text-[11px] text-rose-900 leading-snug",children:[e.jsx("p",{className:"font-semibold mb-0.5",children:"⚠ Not lawsuit-safe"}),e.jsx("p",{children:s.length===1?e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:s[0]})," scored ",t[0].letter,". Even a high overall grade doesn't help if one area is failing — demand-letter mills target the weakest link."]}):e.jsxs(e.Fragment,{children:[s.length," areas are at lawsuit-risk:"," ",s.map((a,n)=>e.jsxs("span",{children:[e.jsx("strong",{children:a}),n<s.length-1?", ":""]},a)),". Fix these before relying on the overall grade."]})})]})}function Ra({grades:t}){const s=g(a=>a.setView);return e.jsxs("div",{className:"border-t border-slate-200 px-3 py-2",children:[e.jsx("p",{className:"text-[11px] uppercase tracking-wide text-slate-500 mb-2",children:"Verification areas"}),e.jsx("ul",{className:"grid grid-cols-1 gap-1.5",children:t.map(a=>e.jsxs("li",{className:"flex items-center gap-2 text-[11px]",children:[e.jsx("span",{className:`w-6 h-6 inline-flex items-center justify-center rounded text-xs font-bold ${Na[a.letter]}`,"aria-label":`Grade ${a.letter}`,children:a.letter}),e.jsx("span",{className:"font-medium text-slate-800 flex-1 min-w-0",children:a.label}),e.jsx(Ea,{grade:a,onOpenGuided:()=>s("guided")})]},a.id))})]})}function Ea({grade:t,onOpenGuided:s}){const a=n=>{if(!n)return"";const r=Y.find(i=>i.id===n);return(r==null?void 0:r.name)??n};if(t.untested)return e.jsxs("span",{className:"text-slate-500 text-[10px] italic",children:["not graded —"," ",t.primaryVerifierWorkflowId?e.jsxs("button",{type:"button",onClick:s,className:"text-brand-600 hover:underline not-italic",children:["run ",a(t.primaryVerifierWorkflowId)," →"]}):"no data yet"]});if(t.verifiedByIgt){const n=t.verifiedAt?zt(Date.now()-new Date(t.verifiedAt).getTime()):null;return e.jsxs("span",{className:"text-emerald-700 text-[10px]",title:t.suppressedHeuristicCount>0?`Heuristic flagged ${t.suppressedHeuristicCount} issue${t.suppressedHeuristicCount===1?"":"s"}, but you verified this area in Guided Tests — those are treated as noise unless you re-verify.`:"Verified via Guided Tests",children:["✓ verified",n?` ${n} ago`:""]})}return t.needsIgt?e.jsxs("button",{type:"button",onClick:s,className:"text-amber-700 hover:underline text-[10px]",title:"Verify this area by running the relevant Guided Tests workflow",children:["verify with ",a(t.primaryVerifierWorkflowId)," →"]}):t.counts.critical>0||t.counts.serious>0?e.jsxs("span",{className:"text-slate-500 text-[10px]",children:[t.counts.critical>0&&e.jsxs("span",{className:"text-rose-700",children:[t.counts.critical," critical"]}),t.counts.critical>0&&t.counts.serious>0&&" · ",t.counts.serious>0&&e.jsxs("span",{className:"text-orange-700",children:[t.counts.serious," serious"]})]}):e.jsx("span",{className:"text-emerald-700 text-[10px]",children:"clean"})}function Ta({violationsRemaining:t,manualCompleted:s,manualTotal:a}){const n=g(o=>o.setView),r=[{done:t===0,label:t===0?"Automated checks pass":`Fix ${t} automated violation${t===1?"":"s"}`,action:void 0,tooltip:void 0},{done:!0,label:`Optional: deep-check via Guided Tests (${s}/${a} done)`,action:()=>n("guided"),tooltip:"Guided Tests are opt-in. The audit's automated checks + AI analyzers already produce a binary pass/fail for every WCAG criterion. Run these workflows if you want belt-and-suspenders confidence on top of automation."},{done:!1,label:"Export AI fix prompt + complete manual checklist",action:()=>n("delta"),tooltip:`Switches to the Delta tab. Click the Export menu and pick "AI fix prompt" — markdown for ChatGPT/Claude/Copilot, with manual checklist for the WCAG criteria automation can't detect.`}],i=r.findIndex(o=>!o.done);return e.jsxs("div",{className:"border-t border-slate-200 px-3 py-2 bg-slate-50",children:[e.jsx("p",{className:"text-[11px] uppercase tracking-wide text-slate-500 mb-1.5",children:"Path to full WCAG compliance"}),e.jsx("ol",{className:"space-y-1 text-[11px]",children:r.map((o,c)=>{const d=c===i,p=o.done;return e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:p?"font-mono text-emerald-700 shrink-0":d?"font-mono text-brand-600 font-semibold shrink-0":"font-mono text-slate-400 shrink-0","aria-hidden":"true",children:p?"✓":`${c+1}.`}),o.action?e.jsxs("button",{type:"button",onClick:o.action,title:o.tooltip,className:d?"text-brand-700 font-semibold underline-offset-2 hover:underline text-left leading-snug":"text-slate-600 underline-offset-2 hover:underline hover:text-slate-900 text-left leading-snug",children:[o.label," →"]}):e.jsx("span",{className:p?"text-slate-500 line-through leading-snug":d?"text-slate-900 font-medium leading-snug":"text-slate-500 leading-snug",children:o.label})]},c)})})]})}function Ia({current:t,total:s}){return e.jsxs("div",{role:"status","aria-live":"polite",className:"border border-slate-200 rounded-lg bg-white p-4 flex items-center gap-3",children:[e.jsx("span",{className:"inline-block w-5 h-5 border-2 border-brand-500 border-t-transparent rounded-full animate-spin motion-reduce:animate-none","aria-hidden":"true"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-medium text-slate-900",children:"Scanning…"}),e.jsx("p",{className:"text-[11px] text-slate-500",children:typeof t=="number"&&typeof s=="number"?`State ${t} of ${s}. Grade will appear when the scan completes.`:"Grade will appear when the scan completes."})]})]})}function $a({scannedAt:t}){const s=Date.now()-new Date(t).getTime();return e.jsxs("div",{className:"bg-amber-50 border-b border-amber-200 px-3 py-1.5 text-[11px] text-amber-900 flex items-center gap-2",children:[e.jsx("span",{"aria-hidden":"true",children:"↻"}),e.jsxs("span",{children:["Showing a previous scan (",zt(s)," old). Re-scan to grade the current page state."]})]})}function zt(t){const s=Math.floor(t/1e3);if(s<60)return"less than a minute";if(s<120)return"1 minute";if(s<3600)return`${Math.floor(s/60)} minutes`;if(s<7200)return"1 hour";if(s<86400)return`${Math.floor(s/3600)} hours`;const a=Math.floor(s/86400);return a===1?"1 day":`${a} days`}const Qe="dismissedFindings";function Oe(t){try{const s=new URL(t);return`${s.origin}${s.pathname.replace(/\/+$/,"")}`}catch{return t}}function pe(t){return`reading-order::${t}`}function he(t){return`tab-order::${t}`}async function Me(){try{const t=await chrome.storage.local.get(Qe),s=t==null?void 0:t[Qe];if(s&&typeof s=="object")return s}catch{}return{}}async function tt(t){await chrome.storage.local.set({[Qe]:t})}async function Fe(t){return(await Me())[Oe(t)]??{}}async function Kt(t,s,a,n){const r=await Me(),i=Oe(t),o=r[i]??{};o[s]={reason:a,dismissedAt:new Date().toISOString(),snippet:n},r[i]=o,await tt(r)}async function ke(t,s){if(s.length===0)return;const a=await Me(),n=Oe(t),r=a[n]??{},i=new Date().toISOString();for(const o of s)r[o.key]={reason:o.reason,dismissedAt:i,snippet:o.snippet};a[n]=r,await tt(a)}async function qt(t,s){const a=await Me(),n=Oe(t),r=a[n];!r||!(s in r)||(delete r[s],Object.keys(r).length===0?delete a[n]:a[n]=r,await tt(a))}const _a=Object.freeze(Object.defineProperty({__proto__:null,addDismissal:Kt,addDismissals:ke,dismissalKeyForReadingOrder:pe,dismissalKeyForTabOrder:he,getDismissalsForUrl:Fe,removeDismissal:qt},Symbol.toStringTag,{value:"Module"}));function Qt(t){return[t.pseudoState,t.theme,t.direction,t.breakpoint.id].join(" · ")}function Jt(t){return`${Ze(t.ruleId,t.target.selector)}::${t.target.outerHTML.slice(0,64)}`}function La(t){const s=new Map;for(const a of t)for(const n of a.violations){const r=Jt(n),i=s.get(r);i?i.states.push(n.currentState):s.set(r,{representative:n,states:[n.currentState]})}return Array.from(s.values())}const dt={critical:0,serious:1,moderate:2,minor:3};function Ua(){var m,N,C,T;const t=g(b=>b.results),s=g(b=>b.componentId),a=g(b=>b.setView),n=((m=t[0])==null?void 0:m.pageUrl)??((N=t[0])==null?void 0:N.scope)??"",[r,i]=x.useState({}),[o,c]=x.useState(new Set);if(x.useEffect(()=>{if(!n)return;Fe(n).then(i);const b=()=>{document.visibilityState==="visible"&&n&&Fe(n).then(i)};return document.addEventListener("visibilitychange",b),()=>document.removeEventListener("visibilitychange",b)},[n]),x.useEffect(()=>{if(!s){c(new Set);return}let b=!1;const v=async()=>{const S=await chrome.storage.local.get("igtRuns");if(b)return;const w=((S==null?void 0:S.igtRuns)??{})[s]??{},A=new Set;for(const j of Y){const $=w[j.id];$&&Object.keys($.steps).length===j.steps.length&&A.add(j.id)}c(A)};v();const y=()=>{document.visibilityState==="visible"&&v()};return document.addEventListener("visibilitychange",y),()=>{b=!0,document.removeEventListener("visibilitychange",y)}},[s]),t.length===0)return e.jsx("div",{className:"p-4 text-center text-slate-500 text-sm",children:"No audit results yet. Pick an element to start."});const d=t.reduce((b,v)=>b+v.durationMs,0),p=t.reduce((b,v)=>b+v.violations.length,0),l=La(t);l.sort((b,v)=>{const y=dt[b.representative.impact]??99,S=dt[v.representative.impact]??99;return y!==S?y-S:v.states.length-b.states.length});const u=t.map(b=>Qt(b.state)).join(`
|
|
4
4
|
`),h=o.has("keyboard")?0:(((C=t[0])==null?void 0:C.tabOrderIssues)??[]).filter(b=>!(he(b.selector)in r)).length,f=o.has("page-structure")?0:(((T=t[0])==null?void 0:T.readingOrderIssues)??[]).filter(b=>!(pe(b.selector)in r)).length;return e.jsxs("div",{className:"p-3 space-y-3",children:[e.jsx(ka,{violations:t.flatMap(b=>b.violations),componentId:s}),(h>0||f>0)&&e.jsxs("button",{type:"button",onClick:()=>a("activity"),className:"w-full text-left border border-rose-200 rounded bg-rose-50 px-3 py-2 hover:bg-rose-100 transition-colors",children:[e.jsx("p",{className:"text-xs font-semibold text-rose-900",children:"⚠ Keyboard / screen-reader concerns axe-core can't see"}),e.jsxs("p",{className:"text-[11px] text-rose-800 leading-snug mt-0.5",children:[h>0&&e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:h})," tab-order issue",h===1?"":"s"," (WCAG 2.4.3)"]}),h>0&&f>0&&" · ",f>0&&e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:f})," reading-order issue",f===1?"":"s"," (WCAG 1.3.2)"]})," ","— click to view in ",e.jsx("span",{className:"underline",children:"Activity"})," tab."]})]}),e.jsxs("div",{className:"text-xs text-slate-500 border-b border-slate-200 pb-2",children:[e.jsxs("span",{title:u,"aria-label":`${t.length} states tested: ${u.replace(/\n/g,", ")}`,className:"underline decoration-dotted decoration-slate-400 cursor-help",children:[t.length," ",t.length===1?"state":"states"]})," · ",l.length," unique ",l.length===1?"violation":"violations"," ",e.jsxs("span",{className:"text-slate-500",children:["(",p," across all states)"]})," · ",(d/1e3).toFixed(1),"s"]}),l.length===0?e.jsx("p",{className:"text-xs text-slate-500 italic px-1",children:"No violations found."}):e.jsx("div",{className:"space-y-1.5",children:l.map(b=>e.jsxs("div",{className:"space-y-1",children:[e.jsx(De,{violation:b.representative}),e.jsx(Da,{states:b.states,totalStates:t.length})]},Jt(b.representative)))})]})}function Da({states:t,totalStates:s}){if(t.length===s)return e.jsxs("p",{className:"text-[11px] text-slate-500 px-1",children:["Found in ",e.jsxs("span",{className:"font-medium",children:["all ",s," states"]}),"."]});const a=Array.from(new Set(t.map(Qt))),n=a.slice(0,3).join(", "),r=a.length>3?`, +${a.length-3} more`:"",i=a.join(`
|
|
5
5
|
`);return e.jsxs("p",{className:"text-[11px] text-slate-500 px-1",title:i,children:["Found in ",a.length," of ",s," states:"," ",e.jsxs("span",{className:"text-slate-600",children:[n,r]})]})}const Fa={minor:"bg-blue-100 text-blue-700",moderate:"bg-yellow-100 text-yellow-700",serious:"bg-orange-100 text-orange-700",critical:"bg-red-100 text-red-700"};function Oa({ruleId:t,violations:s}){const[a,n]=x.useState(s.length===1),r=s[0];if(!r)return null;const i=r.impact,o=r.description,c=s.length;return c===1?e.jsx(De,{violation:r}):e.jsxs("div",{className:"border border-slate-200 rounded bg-white",children:[e.jsxs("button",{type:"button",onClick:()=>n(d=>!d),className:"w-full text-left p-2 hover:bg-slate-50 flex items-center justify-between gap-2","aria-expanded":a,children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[e.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded font-semibold uppercase tracking-wide shrink-0 ${Fa[i]}`,children:i}),e.jsx("span",{className:"text-[11px] font-mono text-slate-500 shrink-0",children:t}),e.jsx("span",{className:"text-xs text-slate-700 truncate",children:o})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsxs("span",{className:"text-[11px] font-semibold text-slate-600",children:["×",c]}),e.jsx("span",{className:"text-slate-400 text-xs",children:a?"▾":"▸"})]})]}),a&&e.jsx("div",{className:"border-t border-slate-200 p-2 space-y-1.5 bg-slate-50/50",children:s.map((d,p)=>e.jsx(De,{violation:d},p))})]})}function Ma(t){const s=[],a=new Map;for(const n of t)a.has(n.ruleId)||(s.push(n.ruleId),a.set(n.ruleId,[])),a.get(n.ruleId).push(n);return s.map(n=>({ruleId:n,violations:a.get(n)}))}const Pa={"defense-bundle":"Defense report ready","evidence-bundle":"Evidence bundle ready"};function Yt({open:t,onClose:s,format:a,content:n,filename:r}){const i=rs(new Blob([n]).size);function o(){Xe(n,r),s()}function c(){Ye(n),s()}return e.jsxs(me,{open:t,onClose:s,title:Pa[a],description:`Generated bundle — ${i}. Save to your Downloads folder, or open in a new tab to preview.`,children:[e.jsxs("div",{className:"space-y-3 text-xs text-slate-700",children:[e.jsxs("p",{children:["File: ",e.jsx("code",{className:"bg-slate-100 px-1 py-0.5 rounded text-[11px]",children:r})]}),e.jsxs("p",{className:"text-slate-500",children:["Tip: open the report and press Ctrl+P (Cmd+P on Mac) → ",e.jsx("em",{children:"Save as PDF"})," if you want a sealed-format version for legal use."]}),e.jsxs("p",{className:"text-[10px] text-slate-400",children:["To skip this prompt and download immediately on future exports, enable",e.jsx("em",{children:' "Skip the download confirmation"'})," in Settings → Advanced."]})]}),e.jsxs("div",{className:"flex justify-end gap-2 mt-4",children:[e.jsx("button",{onClick:s,className:"text-xs px-3 py-1.5 rounded border border-slate-300 text-slate-700 hover:bg-slate-50",children:"Cancel"}),e.jsx("button",{onClick:c,className:"text-xs px-3 py-1.5 rounded border border-slate-300 text-slate-700 hover:bg-slate-50",children:"Open preview"}),e.jsx("button",{onClick:o,className:"text-xs px-3 py-1.5 bg-brand-500 text-white rounded hover:bg-brand-600",children:"Download HTML"})]})]})}const ut=7800;function Ga(t,s,a){const n=t.replace(/\/$/,""),r=[];for(const l of a){const u=`${l.ruleId}::${l.target.selector}`,h=`:${l.currentState.pseudoState} · ${l.currentState.theme} · ${l.currentState.direction}`,f=r.find(m=>`${m.ruleId}::${m.target.selector}`===u);if(f){f._states.includes(h)||f._states.push(h);continue}r.push({...l,_states:[h]})}const i=`a11y: ${r.length} new violation${r.length===1?"":"s"} in ${s??"audited component"}`,o=[];o.push(`**Component:** \`${s??"unknown"}\``),o.push(""),o.push("Detected by WCAG Component Auditor as **new** vs the saved baseline — these are violations introduced since the last accepted baseline."),o.push(""),o.push("---"),o.push("");for(const l of r)o.push(`### \`${l.ruleId}\` — ${l.impact}`),o.push(""),o.push(l.description),o.push(""),o.push(`- **WCAG:** ${l.wcagCriterion} (${l.wcagLevel})`),o.push(`- **Selector:** \`${l.target.selector}\``),o.push(`- **Found in state(s):** ${l._states.join(", ")}`),l.helpUrl&&o.push(`- **More info:** ${l.helpUrl}`),o.push(""),o.push("```html"),o.push(l.target.outerHTML),o.push("```"),o.push("");o.push("---"),o.push(""),o.push("_Filed via WCAG Component Auditor (delta-only — inherited debt not included)._");const c=o.join(`
|
|
6
6
|
`),d=new URLSearchParams({title:i,body:c});let p=`${n}/issues/new?${d.toString()}`;return p.length>ut&&(p=p.slice(0,ut)),{url:p,title:i,body:c}}const pt=7800;function Va(t,s,a){const n=t.replace(/\/$/,""),r=[];for(const l of a){const u=`${l.ruleId}::${l.target.selector}`,h=`:${l.currentState.pseudoState} · ${l.currentState.theme} · ${l.currentState.direction}`,f=r.find(m=>`${m.ruleId}::${m.target.selector}`===u);if(f){f._states.includes(h)||f._states.push(h);continue}r.push({...l,_states:[h]})}const i=`a11y: ${r.length} new violation${r.length===1?"":"s"} in ${s??"audited component"}`,o=[];o.push(`Component: ${s??"unknown"}`),o.push(""),o.push("Detected by WCAG Component Auditor as NEW vs the saved baseline — these are violations introduced since the last accepted baseline."),o.push(""),o.push("---"),o.push("");for(const l of r)o.push(`Rule: ${l.ruleId} (${l.impact})`),o.push(`WCAG: ${l.wcagCriterion} ${l.wcagLevel}`),o.push(`Description: ${l.description}`),o.push(`Selector: ${l.target.selector}`),o.push(`Found in state(s): ${l._states.join(", ")}`),l.helpUrl&&o.push(`More info: ${l.helpUrl}`),o.push(""),o.push(`HTML: ${l.target.outerHTML}`),o.push(""),o.push("---"),o.push("");o.push("Filed via WCAG Component Auditor (delta-only — inherited debt not included).");const c=o.join(`
|
|
@@ -519,6 +519,6 @@ pre{white-space:pre-wrap;word-break:break-word;background:#f8fafc;border:1px sol
|
|
|
519
519
|
<span>${r.totalCriteria} criteria · ${r.pass} pass · ${r.fail} fail · ${r.inconclusive} inconclusive</span>
|
|
520
520
|
</footer>
|
|
521
521
|
</body>
|
|
522
|
-
</html>`}async function kr(t,s){const a=Nr(t,s),n=new Blob([a],{type:"text/html;charset=utf-8"}),r=URL.createObjectURL(n);await chrome.tabs.create({url:r})}const Ke=Rt("wcag-em-anchor"),Sr="https://api.wcagcheckr.com",Ar="wcagcheckr",Cr=15e3;function ss(t){return{scope:{siteName:t.inputs.siteName,siteUrl:t.inputs.siteUrl,targetVersion:t.inputs.targetVersion,targetLevel:t.inputs.targetLevel,accessibilitySupportBaseline:t.inputs.accessibilitySupportBaseline,additionalStandards:t.inputs.additionalStandards??[]},evaluator:{name:t.inputs.evaluator.name,organization:t.inputs.evaluator.organization??null,qualifications:t.inputs.evaluator.qualifications??null,contact:t.inputs.evaluator.contact??null},sample:{pages:t.inputs.pageSample.map(s=>({url:s.url,type:s.pageType,selectionType:s.selectionType,hasAuditData:s.hasAuditData}))},verdicts:t.rows.map(s=>({sc:s.criterion.id,level:s.criterion.level,verdict:s.verdict,overridden:s.overridden,axeFailureCount:s.signals.axeFailures.length,igtFailureCount:s.signals.igtFailures.length})),summary:{totalCriteria:t.summary.totalCriteria,pass:t.summary.pass,fail:t.summary.fail,inconclusive:t.summary.inconclusive,notApplicable:t.summary.notApplicable,notEvaluated:t.summary.notEvaluated,levelAchieved:t.summary.levelAchieved,meetsTarget:t.summary.meetsTarget},generatedAt:t.generatedAt}}async function Rr(t){const s=new TextEncoder().encode(t),a=await crypto.subtle.digest("SHA-256",s);return Array.from(new Uint8Array(a)).map(n=>n.toString(16).padStart(2,"0")).join("")}async function Er(t){return Rr(ys(ss(t)))}function Tr(t){if(typeof t!="object"||t===null)return!1;const s=t;return s.schemaVersion!==1&&s.schemaVersion!==2||!(typeof s.anchoredAt=="string"&&typeof s.tsaName=="string"&&typeof s.rfc3161TokenBase64=="string"&&s.rfc3161TokenBase64.length>0&&typeof s.serverSignatureBase64=="string"&&s.serverSignatureBase64.length>0&&typeof s.serverKeyFingerprint=="string"&&s.serverKeyFingerprint.length>0)?!1:s.schemaVersion===2?typeof s.prevAuditHash=="string"&&/^[0-9a-f]{64}$/.test(s.prevAuditHash):!0}async function Ir(t,s){const a=await Er(t),n={auditHash:a,pageUrl:t.inputs.siteUrl,capturedAt:t.generatedAt},r=`${Sr}/v1/products/${Ar}/forensic/anchor`;try{const i=await fetch(r,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(n),signal:AbortSignal.timeout(Cr)});if(!i.ok)return Ke.warn(`anchor HTTP ${i.status}`),null;const o=await i.json();return Tr(o)?{reportHash:a,capturedAt:t.generatedAt,receipt:o}:(Ke.warn("anchor returned malformed receipt",o),null)}catch(i){return Ke.warn("anchor request failed",i),null}}function $r(t,s,a){return{schemaVersion:1,tool:{name:"wcagcheckr",version:a},productSlug:"wcagcheckr",bundledAt:new Date().toISOString(),reportHash:s.reportHash,receipt:s.receipt,canonicalPayload:ss(t)}}const St="igtRuns",_r={pass:"bg-emerald-100 text-emerald-800",fail:"bg-rose-100 text-rose-800",inconclusive:"bg-amber-100 text-amber-800","not-evaluated":"bg-slate-100 text-slate-700","not-applicable":"bg-slate-50 text-slate-500"},Lr={pass:"Pass",fail:"Fail",inconclusive:"Inconclusive","not-evaluated":"Not eval","not-applicable":"N/A"};function Ur(){const t=g(k=>k.results),s=g(k=>k.acknowledgedKeys),[a,n]=x.useState(""),[r,i]=x.useState(""),o=ws,c=js,[d,p]=x.useState("Latest two stable versions of Chrome, Safari, Firefox, and Edge on Windows + macOS, paired with NVDA, JAWS, and VoiceOver."),[l,u]=x.useState(""),[h,f]=x.useState(""),[m,N]=x.useState(""),[C,T]=x.useState(""),[b,v]=x.useState(""),[y,S]=x.useState(""),[E,w]=x.useState({}),[A,j]=x.useState(!1),[$,z]=x.useState([]),[I,O]=x.useState(null),[P,Z]=x.useState(!1),[Q,te]=x.useState(null);x.useEffect(()=>{let k=!1;return chrome.storage.local.get(St).then(U=>{if(k)return;const
|
|
523
|
-
`).map(B=>B.trim()).filter(Boolean))U.has(
|
|
524
|
-
https://app.example.com/account`,className:"w-full border border-slate-300 rounded px-2 py-1 text-xs resize-y"}),e.jsx("span",{className:"text-[10px] text-slate-500",children:'Pages without audit data will be listed in the report as "no audit data" — audit each then regenerate.'})]})]}),e.jsxs("fieldset",{className:"border border-slate-200 rounded p-2 space-y-2",children:[e.jsx("legend",{className:"px-1 text-[11px] font-medium text-slate-700",children:"Evaluator"}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-[11px] font-medium text-slate-600",children:"Name"}),e.jsx("input",{type:"text",value:h,onChange:k=>f(k.target.value),placeholder:"Jane Doe",className:"w-full border border-slate-300 rounded px-2 py-1 text-xs"})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-[11px] font-medium text-slate-600",children:"Organization (optional)"}),e.jsx("input",{type:"text",value:m,onChange:k=>N(k.target.value),className:"w-full border border-slate-300 rounded px-2 py-1 text-xs"})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-[11px] font-medium text-slate-600",children:"Qualifications (optional)"}),e.jsx("input",{type:"text",value:C,onChange:k=>T(k.target.value),placeholder:"IAAP CPACC; 7 years a11y consulting",className:"w-full border border-slate-300 rounded px-2 py-1 text-xs"})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-[11px] font-medium text-slate-600",children:"Contact (optional)"}),e.jsx("input",{type:"text",value:b,onChange:k=>v(k.target.value),placeholder:"jane@example.com",className:"w-full border border-slate-300 rounded px-2 py-1 text-xs"})]})]}),G&&e.jsxs("details",{className:"border border-slate-200 rounded",children:[e.jsxs("summary",{className:"px-2 py-1.5 cursor-pointer font-medium text-slate-700",children:["Per-criterion verdicts (",G.rows.length,")"]}),e.jsx("ul",{className:"divide-y divide-slate-100 max-h-96 overflow-y-auto",children:G.rows.map(k=>e.jsxs("li",{className:"px-2 py-1.5 flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"font-mono text-[10px] text-slate-500",children:[k.criterion.id," · ",k.criterion.level]}),e.jsx("div",{className:"text-[11px] text-slate-700 truncate",children:k.criterion.title})]}),e.jsx("span",{className:`shrink-0 px-1.5 py-0.5 rounded text-[10px] font-semibold ${_r[k.verdict]}`,children:Lr[k.verdict]})]},k.criterion.id))})]}),e.jsxs("fieldset",{className:"border border-slate-200 rounded p-2 space-y-2",children:[e.jsx("legend",{className:"px-1 text-[11px] font-medium text-slate-700",children:"Forensic anchor"}),I?e.jsxs("div",{className:"text-[11px] bg-sky-50 border border-sky-200 rounded p-2 text-sky-900",children:[e.jsx("div",{className:"font-medium",children:"✓ Anchored"}),e.jsxs("div",{className:"mt-0.5",children:["Hash: ",e.jsxs("code",{className:"font-mono text-[10px]",children:[I.reportHash.slice(0,24),"…"]})]}),e.jsxs("div",{className:"mt-0.5",children:["RFC 3161 timestamp from ",I.receipt.tsaName,", ed25519 signed."]}),e.jsx("div",{className:"mt-1 text-[10px] text-sky-700",children:"Any edit to the form will clear this anchor — re-anchor before generating the final report."})]}):e.jsx("p",{className:"text-[11px] text-slate-500",children:`Anchoring attaches an RFC 3161 trusted timestamp + ed25519 signature to this report's content hash, defending against later-altered claims of the form "this report dated X said Y." Paid feature.`}),Q&&e.jsx("p",{className:"text-[11px] text-rose-700 bg-rose-50 border border-rose-200 rounded p-1.5",children:Q}),e.jsxs("div",{className:"flex gap-2 flex-wrap",children:[e.jsx("button",{type:"button",disabled:!G||!a||!h||P,onClick:()=>void
|
|
522
|
+
</html>`}async function kr(t,s){const a=Nr(t,s),n=new Blob([a],{type:"text/html;charset=utf-8"}),r=URL.createObjectURL(n);await chrome.tabs.create({url:r})}const Ke=Rt("wcag-em-anchor"),Sr="https://api.wcagcheckr.com",Ar="wcagcheckr",Cr=15e3;function ss(t){return{scope:{siteName:t.inputs.siteName,siteUrl:t.inputs.siteUrl,targetVersion:t.inputs.targetVersion,targetLevel:t.inputs.targetLevel,accessibilitySupportBaseline:t.inputs.accessibilitySupportBaseline,additionalStandards:t.inputs.additionalStandards??[]},evaluator:{name:t.inputs.evaluator.name,organization:t.inputs.evaluator.organization??null,qualifications:t.inputs.evaluator.qualifications??null,contact:t.inputs.evaluator.contact??null},sample:{pages:t.inputs.pageSample.map(s=>({url:s.url,type:s.pageType,selectionType:s.selectionType,hasAuditData:s.hasAuditData}))},verdicts:t.rows.map(s=>({sc:s.criterion.id,level:s.criterion.level,verdict:s.verdict,overridden:s.overridden,axeFailureCount:s.signals.axeFailures.length,igtFailureCount:s.signals.igtFailures.length})),summary:{totalCriteria:t.summary.totalCriteria,pass:t.summary.pass,fail:t.summary.fail,inconclusive:t.summary.inconclusive,notApplicable:t.summary.notApplicable,notEvaluated:t.summary.notEvaluated,levelAchieved:t.summary.levelAchieved,meetsTarget:t.summary.meetsTarget},generatedAt:t.generatedAt}}async function Rr(t){const s=new TextEncoder().encode(t),a=await crypto.subtle.digest("SHA-256",s);return Array.from(new Uint8Array(a)).map(n=>n.toString(16).padStart(2,"0")).join("")}async function Er(t){return Rr(ys(ss(t)))}function Tr(t){if(typeof t!="object"||t===null)return!1;const s=t;return s.schemaVersion!==1&&s.schemaVersion!==2||!(typeof s.anchoredAt=="string"&&typeof s.tsaName=="string"&&typeof s.rfc3161TokenBase64=="string"&&s.rfc3161TokenBase64.length>0&&typeof s.serverSignatureBase64=="string"&&s.serverSignatureBase64.length>0&&typeof s.serverKeyFingerprint=="string"&&s.serverKeyFingerprint.length>0)?!1:s.schemaVersion===2?typeof s.prevAuditHash=="string"&&/^[0-9a-f]{64}$/.test(s.prevAuditHash):!0}async function Ir(t,s){const a=await Er(t),n={auditHash:a,pageUrl:t.inputs.siteUrl,capturedAt:t.generatedAt},r=`${Sr}/v1/products/${Ar}/forensic/anchor`;try{const i=await fetch(r,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(n),signal:AbortSignal.timeout(Cr)});if(!i.ok)return Ke.warn(`anchor HTTP ${i.status}`),null;const o=await i.json();return Tr(o)?{reportHash:a,capturedAt:t.generatedAt,receipt:o}:(Ke.warn("anchor returned malformed receipt",o),null)}catch(i){return Ke.warn("anchor request failed",i),null}}function $r(t,s,a){return{schemaVersion:1,tool:{name:"wcagcheckr",version:a},productSlug:"wcagcheckr",bundledAt:new Date().toISOString(),reportHash:s.reportHash,receipt:s.receipt,canonicalPayload:ss(t)}}const St="igtRuns",_r={pass:"bg-emerald-100 text-emerald-800",fail:"bg-rose-100 text-rose-800",inconclusive:"bg-amber-100 text-amber-800","not-evaluated":"bg-slate-100 text-slate-700","not-applicable":"bg-slate-50 text-slate-500"},Lr={pass:"Pass",fail:"Fail",inconclusive:"Inconclusive","not-evaluated":"Not eval","not-applicable":"N/A"};function Ur(){const t=g(k=>k.results),s=g(k=>k.acknowledgedKeys),[a,n]=x.useState(""),[r,i]=x.useState(""),o=ws,c=js,[d,p]=x.useState("Latest two stable versions of Chrome, Safari, Firefox, and Edge on Windows + macOS, paired with NVDA, JAWS, and VoiceOver."),[l,u]=x.useState(""),[h,f]=x.useState(""),[m,N]=x.useState(""),[C,T]=x.useState(""),[b,v]=x.useState(""),[y,S]=x.useState(""),[E,w]=x.useState({}),[A,j]=x.useState(!1),[$,z]=x.useState([]),[I,O]=x.useState(null),[P,Z]=x.useState(!1),[Q,te]=x.useState(null);x.useEffect(()=>{let k=!1;return chrome.storage.local.get(St).then(U=>{if(k)return;const L=U[St]??{};w(L),j(!0)}).catch(()=>{k||j(!0)}),()=>{k=!0}},[]),x.useEffect(()=>{var k;if(!a&&((k=t[0])!=null&&k.pageUrl))try{const U=new URL(t[0].pageUrl);n(U.hostname),i(U.origin)}catch{}},[t,a]),x.useEffect(()=>{const k=new Set;for(const L of t)k.add(L.pageUrl??L.scope);if(k.size===0){z([]);return}let U=!1;return Promise.all(Array.from(k).map(L=>Re(L))).then(L=>{U||z(L.flat())}).catch(()=>{}),()=>{U=!0}},[t]);const J=x.useMemo(()=>{const k=new Map,U=new Map;for(const B of t){const V=B.pageUrl??B.scope,D=k.get(V)??[];D.push(B),k.set(V,D)}const L=new Map;for(const B of t){const V=B.pageUrl??B.scope;L.set(B.componentId,V)}for(const[B,V]of Object.entries(E)){const D=L.get(B);if(!D)continue;const K=U.get(D)??{};Object.assign(K,V),U.set(D,K)}return{auditsByUrl:k,igtRunsByUrl:U,workflows:Y,acknowledgedMatchKeys:s,incompleteResolutions:$}},[t,E,s,$]),ne=x.useMemo(()=>{const k=[],U=new Set;for(const L of J.auditsByUrl.keys())U.has(L)||(U.add(L),k.push({url:L,selectionType:"critical",pageType:"audited",hasAuditData:!0}));for(const L of y.split(`
|
|
523
|
+
`).map(B=>B.trim()).filter(Boolean))U.has(L)||(U.add(L),k.push({url:L,selectionType:"structured",pageType:"unaudited",hasAuditData:!1}));return k},[J,y]),re=x.useMemo(()=>({siteName:a||"Untitled site",siteUrl:r||"https://example.com",targetVersion:o,targetLevel:c,accessibilitySupportBaseline:d,additionalStandards:l.split(",").map(k=>k.trim()).filter(Boolean),pageSample:ne,evaluator:{name:h||"(evaluator name pending)",organization:m||void 0,qualifications:C||void 0,contact:b||void 0}}),[a,r,o,c,d,l,ne,h,m,C,b]),G=x.useMemo(()=>A?jr(re,J):null,[re,J,A]);async function Se(){G&&await kr(G,I)}async function _(){if(G){Z(!0),te(null);try{const k=await Ir(G);if(!k){te("Anchor request failed. The server may be unreachable, or the license tier may not include forensic anchoring. Report is still generatable without anchoring.");return}O(k)}finally{Z(!1)}}}function W(){var K,xe,M;if(!G||!I)return;const k=((M=(xe=(K=chrome.runtime).getManifest)==null?void 0:xe.call(K))==null?void 0:M.version)??"0.0.0",U=$r(G,I,k),L=new Blob([JSON.stringify(U,null,2)],{type:"application/json"}),B=URL.createObjectURL(L),V=`wcagcheckr-wcag-em-bundle-${new Date().toISOString().replace(/[:.]/g,"-")}.json`,D=document.createElement("a");D.href=B,D.download=V,D.click(),setTimeout(()=>URL.revokeObjectURL(B),1e3)}return x.useEffect(()=>{O(null),te(null)},[a,r,d,l,h,m,C,b,y]),A?e.jsxs("div",{className:"p-3 space-y-3 text-xs",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm font-semibold text-slate-900",children:"WCAG-EM Conformance Report"}),e.jsx("p",{className:"text-[11px] text-slate-500 mt-1",children:"Generate a W3C-EM-format report combining your axe audit data + Independent Guided Test results into a per-criterion conformance verdict. Output is a printable HTML page you can save as PDF."})]}),G&&G.summary.totalCriteria>0&&e.jsx(Dr,{totalCriteria:G.summary.totalCriteria,pass:G.summary.pass,fail:G.summary.fail,inconclusive:G.summary.inconclusive,notEvaluated:G.summary.notEvaluated,notApplicable:G.summary.notApplicable,levelAchieved:G.summary.levelAchieved,meetsTarget:G.summary.meetsTarget,targetVersion:o,targetLevel:c,auditedUrlCount:J.auditsByUrl.size}),e.jsxs("fieldset",{className:"border border-slate-200 rounded p-2 space-y-2",children:[e.jsx("legend",{className:"px-1 text-[11px] font-medium text-slate-700",children:"Scope"}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-[11px] font-medium text-slate-600",children:"Site / app name"}),e.jsx("input",{type:"text",value:a,onChange:k=>n(k.target.value),placeholder:"Acme Web App",className:"w-full border border-slate-300 rounded px-2 py-1 text-xs"})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-[11px] font-medium text-slate-600",children:"Site URL"}),e.jsx("input",{type:"url",value:r,onChange:k=>i(k.target.value),placeholder:"https://app.example.com",className:"w-full border border-slate-300 rounded px-2 py-1 text-xs"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"block text-[11px] font-medium text-slate-600",children:"Conformance target"}),e.jsxs("div",{className:"inline-flex items-center gap-2 mt-0.5 px-2 py-1 bg-slate-50 border border-slate-200 rounded text-xs",children:[e.jsxs("span",{className:"font-semibold text-slate-900",children:["WCAG ",o," Level ",c]}),e.jsx("span",{className:"text-[10px] text-slate-500",children:"— locked target"})]}),e.jsx("p",{className:"text-[10px] text-slate-500 mt-1",children:"AA is the legal-protection bar (ADA / Section 508 / EN 301 549). Level A is insufficient for lawsuit defence; AAA is unachievable for most production sites. wcagcheckr grades against AA only."})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-[11px] font-medium text-slate-600",children:"Accessibility-support baseline"}),e.jsx("textarea",{value:d,onChange:k=>p(k.target.value),rows:2,className:"w-full border border-slate-300 rounded px-2 py-1 text-xs resize-y"}),e.jsx("span",{className:"text-[10px] text-slate-500",children:"Per W3C-EM §2.b — the AT / browser combos your claim covers."})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-[11px] font-medium text-slate-600",children:"Additional standards (comma-separated, optional)"}),e.jsx("input",{type:"text",value:l,onChange:k=>u(k.target.value),placeholder:"Section 508 (Revised 2017), EN 301 549 v3.2.1, ADA Title III",className:"w-full border border-slate-300 rounded px-2 py-1 text-xs"})]})]}),e.jsxs("fieldset",{className:"border border-slate-200 rounded p-2 space-y-2",children:[e.jsx("legend",{className:"px-1 text-[11px] font-medium text-slate-700",children:"Page sample"}),e.jsxs("p",{className:"text-[11px] text-slate-500",children:["Audited pages are auto-included.",J.auditsByUrl.size>0?e.jsxs(e.Fragment,{children:[" Current audit covers ",e.jsx("strong",{children:J.auditsByUrl.size})," URL",J.auditsByUrl.size===1?"":"s","."]}):e.jsx(e.Fragment,{children:" No audited URL data in the store yet — run an audit first."})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-[11px] font-medium text-slate-600",children:"Additional sample URLs (one per line, optional)"}),e.jsx("textarea",{value:y,onChange:k=>S(k.target.value),rows:3,placeholder:`https://app.example.com/checkout
|
|
524
|
+
https://app.example.com/account`,className:"w-full border border-slate-300 rounded px-2 py-1 text-xs resize-y"}),e.jsx("span",{className:"text-[10px] text-slate-500",children:'Pages without audit data will be listed in the report as "no audit data" — audit each then regenerate.'})]})]}),e.jsxs("fieldset",{className:"border border-slate-200 rounded p-2 space-y-2",children:[e.jsx("legend",{className:"px-1 text-[11px] font-medium text-slate-700",children:"Evaluator"}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-[11px] font-medium text-slate-600",children:"Name"}),e.jsx("input",{type:"text",value:h,onChange:k=>f(k.target.value),placeholder:"Jane Doe",className:"w-full border border-slate-300 rounded px-2 py-1 text-xs"})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-[11px] font-medium text-slate-600",children:"Organization (optional)"}),e.jsx("input",{type:"text",value:m,onChange:k=>N(k.target.value),className:"w-full border border-slate-300 rounded px-2 py-1 text-xs"})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-[11px] font-medium text-slate-600",children:"Qualifications (optional)"}),e.jsx("input",{type:"text",value:C,onChange:k=>T(k.target.value),placeholder:"IAAP CPACC; 7 years a11y consulting",className:"w-full border border-slate-300 rounded px-2 py-1 text-xs"})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-[11px] font-medium text-slate-600",children:"Contact (optional)"}),e.jsx("input",{type:"text",value:b,onChange:k=>v(k.target.value),placeholder:"jane@example.com",className:"w-full border border-slate-300 rounded px-2 py-1 text-xs"})]})]}),G&&e.jsxs("details",{className:"border border-slate-200 rounded",children:[e.jsxs("summary",{className:"px-2 py-1.5 cursor-pointer font-medium text-slate-700",children:["Per-criterion verdicts (",G.rows.length,")"]}),e.jsx("ul",{className:"divide-y divide-slate-100 max-h-96 overflow-y-auto",children:G.rows.map(k=>e.jsxs("li",{className:"px-2 py-1.5 flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"font-mono text-[10px] text-slate-500",children:[k.criterion.id," · ",k.criterion.level]}),e.jsx("div",{className:"text-[11px] text-slate-700 truncate",children:k.criterion.title})]}),e.jsx("span",{className:`shrink-0 px-1.5 py-0.5 rounded text-[10px] font-semibold ${_r[k.verdict]}`,children:Lr[k.verdict]})]},k.criterion.id))})]}),e.jsxs("fieldset",{className:"border border-slate-200 rounded p-2 space-y-2",children:[e.jsx("legend",{className:"px-1 text-[11px] font-medium text-slate-700",children:"Forensic anchor"}),I?e.jsxs("div",{className:"text-[11px] bg-sky-50 border border-sky-200 rounded p-2 text-sky-900",children:[e.jsx("div",{className:"font-medium",children:"✓ Anchored"}),e.jsxs("div",{className:"mt-0.5",children:["Hash: ",e.jsxs("code",{className:"font-mono text-[10px]",children:[I.reportHash.slice(0,24),"…"]})]}),e.jsxs("div",{className:"mt-0.5",children:["RFC 3161 timestamp from ",I.receipt.tsaName,", ed25519 signed."]}),e.jsx("div",{className:"mt-1 text-[10px] text-sky-700",children:"Any edit to the form will clear this anchor — re-anchor before generating the final report."})]}):e.jsx("p",{className:"text-[11px] text-slate-500",children:`Anchoring attaches an RFC 3161 trusted timestamp + ed25519 signature to this report's content hash, defending against later-altered claims of the form "this report dated X said Y." Paid feature.`}),Q&&e.jsx("p",{className:"text-[11px] text-rose-700 bg-rose-50 border border-rose-200 rounded p-1.5",children:Q}),e.jsxs("div",{className:"flex gap-2 flex-wrap",children:[e.jsx("button",{type:"button",disabled:!G||!a||!h||P,onClick:()=>void _(),className:"text-xs px-3 py-1.5 border border-slate-300 rounded hover:bg-slate-50 disabled:opacity-50",children:P?"Anchoring…":I?"Re-anchor":"Anchor this report"}),I&&e.jsx("button",{type:"button",onClick:W,className:"text-xs px-3 py-1.5 border border-slate-300 rounded hover:bg-slate-50",title:"Download a JSON file containing the canonical report + receipt; verify offline via wcagcheckr-ci verify",children:"Download verification bundle"})]})]}),e.jsx("div",{className:"flex justify-end gap-2 pt-1 border-t border-slate-200",children:e.jsx("button",{type:"button",disabled:!G||!a||!h,onClick:()=>void Se(),className:"text-xs px-3 py-1.5 bg-brand-500 text-white rounded hover:bg-brand-600 disabled:opacity-50",children:"Generate WCAG-EM report →"})})]}):e.jsx("div",{className:"p-3 text-xs text-slate-500",children:"Loading IGT runs…"})}function Dr({totalCriteria:t,pass:s,fail:a,inconclusive:n,notEvaluated:r,notApplicable:i,levelAchieved:o,meetsTarget:c,targetVersion:d,targetLevel:p,auditedUrlCount:l}){return e.jsxs("div",{className:`border rounded p-2 ${c?"border-emerald-300 bg-emerald-50":"border-amber-300 bg-amber-50"}`,children:[e.jsx("div",{className:`text-xs font-semibold ${c?"text-emerald-900":"text-amber-900"}`,children:c?`Currently meeting WCAG ${d} Level ${p}`:`Does not currently meet WCAG ${d} Level ${p}`}),e.jsxs("div",{className:"text-[11px] mt-1 text-slate-700",children:["Highest fully-satisfied: ",e.jsx("strong",{children:o??"none"})," · ",t," applicable criteria across ",l," audited URL",l===1?"":"s"]}),e.jsxs("div",{className:"text-[10px] mt-1 text-slate-600",children:["Pass ",s," · Fail ",a," · Inconclusive ",n,i>0&&e.jsxs(e.Fragment,{children:[" · N/A ",i]})," · ","Not evaluated ",r]})]})}function Wr(){const t=g(a=>a.view),s=g(a=>a.userMode);return x.useEffect(()=>{const a=_s(),r=new URLSearchParams(window.location.search).get("context")==="overlay"?null:chrome.runtime.connect({name:"sidepanel-tracker"}),i=Rs();Dt({forceRefresh:!0}).catch(()=>{}),_e().catch(()=>{}),$s().catch(()=>{}),Ls().catch(()=>{}),Ts().catch(()=>{}),Ns().then(c=>{g.getState().setAcknowledgedKeys(new Set(c.map(d=>d.matchKey)))}).catch(()=>{});const o=c=>{if(c.key!=="Escape")return;const{pinnedMatchKey:d,setPinned:p,results:l}=g.getState();d&&(p(null),X().then(u=>{var h;u&&ae(u,{type:"HIGHLIGHT_CLEAR_REQUEST",tabId:u},(h=l[0])==null?void 0:h.frameId).catch(()=>{})}))};return window.addEventListener("keydown",o),()=>{i(),a.disconnect(),r==null||r.disconnect(),window.removeEventListener("keydown",o)}},[]),s===null?e.jsxs(e.Fragment,{children:[e.jsx(Un,{}),e.jsx(Pe,{})]}):s==="owner"?e.jsxs(e.Fragment,{children:[e.jsx(nr,{}),e.jsx(vt,{}),e.jsx(Pe,{})]}):e.jsxs("div",{className:"flex flex-col h-screen bg-slate-50 text-slate-900 text-sm",children:[e.jsx("a",{href:"#main-content",className:"sr-only focus:not-sr-only focus:fixed focus:top-2 focus:left-2 focus:z-50 focus:bg-white focus:text-slate-900 focus:px-3 focus:py-1.5 focus:rounded focus:shadow focus:outline focus:outline-2 focus:outline-brand-500",children:"Skip to main content"}),e.jsx(ts,{}),e.jsx(Wt,{}),e.jsx(qs,{}),e.jsxs("main",{id:"main-content",className:"flex-1 flex flex-col overflow-hidden","aria-label":"wcagcheckr",children:[e.jsx(Xs,{}),e.jsx(aa,{}),e.jsx(In,{}),e.jsx(Tn,{}),e.jsx(ra,{}),e.jsx(Rn,{}),e.jsx(En,{}),e.jsxs("div",{className:"flex-1 overflow-y-auto",role:"region","aria-label":`${t} view`,children:[t==="matrix"&&e.jsx(Ua,{}),t==="delta"&&e.jsx(Wa,{}),t==="activity"&&e.jsx(tn,{}),t==="guided"&&e.jsx(mn,{}),t==="flows"&&e.jsx(bn,{}),t==="scorecard"&&e.jsx(jn,{}),t==="crawl"&&e.jsx(Xt,{}),t==="forensic"&&e.jsx(es,{}),t==="compliance"&&e.jsx(Ur,{})]})]}),e.jsx(Ln,{}),e.jsx($n,{}),e.jsx(Cn,{}),e.jsx(vt,{}),e.jsx(Pe,{})]})}class Br extends je.Component{constructor(){super(...arguments);at(this,"state",{error:null})}static getDerivedStateFromError(a){return{error:a}}componentDidCatch(a,n){console.error("[side-panel] render crashed",a,n.componentStack)}render(){return this.state.error?e.jsxs("div",{className:"p-4 text-sm bg-red-50 text-red-900 h-full flex flex-col",children:[e.jsx("h2",{className:"font-semibold mb-2",children:"Side panel crashed"}),e.jsx("p",{className:"text-xs mb-3",children:this.state.error.message}),e.jsx("button",{onClick:()=>location.reload(),className:"text-xs px-3 py-1 bg-red-600 text-white rounded hover:bg-red-700 self-start",children:"Reload"})]}):this.props.children}}export{Wr as A,Br as E};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./modulepreload-polyfill-B5Qt9EMX.js";import{c as t,j as o,R as e}from"./styles-pWj24Nu1.js";import{E as s,A as i}from"./ErrorBoundary
|
|
1
|
+
import"./modulepreload-polyfill-B5Qt9EMX.js";import{c as t,j as o,R as e}from"./styles-pWj24Nu1.js";import{E as s,A as i}from"./ErrorBoundary-Mujc_UjK.js";import{i as m}from"./crash-reporter-Dc5lvxvY.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./state-PELIq3oj.js";import"./preload-helper-D7HrI6pR.js";import"./forensic-log-DaUcnSG0.js";m("devtools-panel");const r=document.getElementById("root");if(!r)throw new Error("devtools panel: #root not found");t(r).render(o.jsx(e.StrictMode,{children:o.jsx(s,{children:o.jsx(i,{})})}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./modulepreload-polyfill-B5Qt9EMX.js";import{c as t,j as r,R as e}from"./styles-pWj24Nu1.js";import{E as i,A as s}from"./ErrorBoundary
|
|
1
|
+
import"./modulepreload-polyfill-B5Qt9EMX.js";import{c as t,j as r,R as e}from"./styles-pWj24Nu1.js";import{E as i,A as s}from"./ErrorBoundary-Mujc_UjK.js";import{i as m}from"./crash-reporter-Dc5lvxvY.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./state-PELIq3oj.js";import"./preload-helper-D7HrI6pR.js";import"./forensic-log-DaUcnSG0.js";m("side-panel");const o=document.getElementById("root");if(!o)throw new Error("side-panel: #root not found");t(o).render(r.jsx(e.StrictMode,{children:r.jsx(i,{children:r.jsx(s,{})})}));
|
package/dist/devtools/panel.html
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<title>wcagcheckr</title>
|
|
6
|
-
<script type="module" crossorigin src="/assets/devtools-panel-
|
|
6
|
+
<script type="module" crossorigin src="/assets/devtools-panel-BKrFw7jn.js"></script>
|
|
7
7
|
<link rel="modulepreload" crossorigin href="/assets/modulepreload-polyfill-B5Qt9EMX.js">
|
|
8
8
|
<link rel="modulepreload" crossorigin href="/assets/_commonjsHelpers-Cpj98o6Y.js">
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/crash-reporter-Dc5lvxvY.js">
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<link rel="modulepreload" crossorigin href="/assets/styles-pWj24Nu1.js">
|
|
12
12
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-D7HrI6pR.js">
|
|
13
13
|
<link rel="modulepreload" crossorigin href="/assets/forensic-log-DaUcnSG0.js">
|
|
14
|
-
<link rel="modulepreload" crossorigin href="/assets/ErrorBoundary
|
|
14
|
+
<link rel="modulepreload" crossorigin href="/assets/ErrorBoundary-Mujc_UjK.js">
|
|
15
15
|
<link rel="stylesheet" crossorigin href="/assets/styles-DyeH361z.css">
|
|
16
16
|
</head>
|
|
17
17
|
<body class="bg-slate-50">
|
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.68",
|
|
6
|
+
"version_name": "1.0.0-rc.68",
|
|
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-CCKVEmz3.js"></script>
|
|
8
8
|
<link rel="modulepreload" crossorigin href="/assets/modulepreload-polyfill-B5Qt9EMX.js">
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/_commonjsHelpers-Cpj98o6Y.js">
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/assets/crash-reporter-Dc5lvxvY.js">
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<link rel="modulepreload" crossorigin href="/assets/styles-pWj24Nu1.js">
|
|
13
13
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-D7HrI6pR.js">
|
|
14
14
|
<link rel="modulepreload" crossorigin href="/assets/forensic-log-DaUcnSG0.js">
|
|
15
|
-
<link rel="modulepreload" crossorigin href="/assets/ErrorBoundary
|
|
15
|
+
<link rel="modulepreload" crossorigin href="/assets/ErrorBoundary-Mujc_UjK.js">
|
|
16
16
|
<link rel="stylesheet" crossorigin href="/assets/styles-DyeH361z.css">
|
|
17
17
|
</head>
|
|
18
18
|
<body class="m-0 p-0">
|
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.68",
|
|
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",
|