@wcag-checkr/ci 1.0.22 → 1.0.23
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-CAo1EDqF.js +594 -0
- package/dist/assets/ai-usage-log-DVzy9AU1.js +1 -0
- package/dist/assets/{copy-ai-fixer-prompt-B-f3tzmf.js → copy-ai-fixer-prompt-CoTMEYa8.js} +2 -2
- package/dist/assets/{devtools-panel-BiasJu8-.js → devtools-panel-BZ5-1wG6.js} +1 -1
- package/dist/assets/{options-Q406rAw1.js → options-C7TJwA_a.js} +3 -3
- package/dist/assets/{parallel-tab-flow-DN_z0IGA.js → parallel-tab-flow-B8XxnbrB.js} +1 -1
- package/dist/assets/{rubric-config-client-Ck8nJHda.js → rubric-config-client-DhPZ3tGE.js} +1 -1
- package/dist/assets/scheduled-audit-runner-Dek_J9pU.js +2105 -0
- package/dist/assets/{service-worker.ts-BZg0XiJG.js → service-worker.ts-BGN4N7Yn.js} +2 -2
- package/dist/assets/{side-panel-B_vXy4v5.js → side-panel-DvxfwgMS.js} +3 -3
- package/dist/assets/{site-report-renderer-Cdd4E5RB.js → site-report-renderer-Bw9jYmSg.js} +1 -1
- package/dist/assets/{styles-clWOl0K-.js → styles-Dg6rHpW6.js} +13 -13
- package/dist/assets/{tier-config-client-D1GMRTQW.js → tier-config-client-CimEdyEg.js} +1 -1
- package/dist/devtools/panel.html +5 -5
- package/dist/manifest.json +1 -1
- package/dist/options/options.html +4 -4
- package/dist/service-worker-loader.js +1 -1
- package/dist/side-panel/side-panel.html +8 -8
- package/package.json +1 -1
- package/dist/assets/ErrorBoundary-D9lJ5zgJ.js +0 -594
- package/dist/assets/ai-usage-log-HdIilbbf.js +0 -1
- package/dist/assets/scheduled-audit-runner-DO-z335b.js +0 -2101
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import"./modulepreload-polyfill-B5Qt9EMX.js";import{a as q,R as D,u as z,j as e,b as X,r as i,d as fe,P as U,e as L,f as be,g as $e,h as Ge,i as ge,k as _,y as Be,C as Ke,A as Ve,c as He}from"./styles-clWOl0K-.js";import{c as ye,r as T,o as Je,T as Ye,a as ze,s as C,O as Z,b as We,l as qe,g as Qe,d as Xe}from"./crash-reporter-DAZnNefT.js";import{w as Ze,r as et}from"./tier-config-client-D1GMRTQW.js";import{D as tt,A as K,g as st,a as at,s as ee,c as nt,b as V,l as rt,d as ot,e as te}from"./ai-usage-log-HdIilbbf.js";import{l as lt,s as se,v as it}from"./custom-rules-CAe0nbES.js";import"./_commonjsHelpers-Cpj98o6Y.js";function ct(t){const s=t+"CollectionProvider",[a,r]=q(s),[o,x]=a(s,{collectionRef:{current:null},itemMap:new Map}),c=N=>{const{scope:p,children:u}=N,f=D.useRef(null),y=D.useRef(new Map).current;return e.jsx(o,{scope:p,itemMap:y,collectionRef:f,children:u})};c.displayName=s;const n=t+"CollectionSlot",d=X(n),m=D.forwardRef((N,p)=>{const{scope:u,children:f}=N,y=x(n,u),k=z(p,y.collectionRef);return e.jsx(d,{ref:k,children:f})});m.displayName=n;const l=t+"CollectionItemSlot",h="data-radix-collection-item",b=X(l),g=D.forwardRef((N,p)=>{const{scope:u,children:f,...y}=N,k=D.useRef(null),F=z(p,k),R=x(l,u);return D.useEffect(()=>(R.itemMap.set(k,{ref:k,...y}),()=>void R.itemMap.delete(k))),e.jsx(b,{[h]:"",ref:F,children:f})});g.displayName=l;function j(N){const p=x(t+"CollectionConsumer",N);return D.useCallback(()=>{const f=p.collectionRef.current;if(!f)return[];const y=Array.from(f.querySelectorAll(`[${h}]`));return Array.from(p.itemMap.values()).sort((R,E)=>y.indexOf(R.ref.current)-y.indexOf(E.ref.current))},[p.collectionRef,p.itemMap])}return[{Provider:c,Slot:m,ItemSlot:g},j,r]}var dt=i.createContext(void 0);function ve(t){const s=i.useContext(dt);return t||s||"ltr"}var H="rovingFocusGroup.onEntryFocus",ut={bubbles:!1,cancelable:!0},O="RovingFocusGroup",[W,je,xt]=ct(O),[mt,Ne]=q(O,[xt]),[ht,pt]=mt(O),ke=i.forwardRef((t,s)=>e.jsx(W.Provider,{scope:t.__scopeRovingFocusGroup,children:e.jsx(W.Slot,{scope:t.__scopeRovingFocusGroup,children:e.jsx(ft,{...t,ref:s})})}));ke.displayName=O;var ft=i.forwardRef((t,s)=>{const{__scopeRovingFocusGroup:a,orientation:r,loop:o=!1,dir:x,currentTabStopId:c,defaultCurrentTabStopId:n,onCurrentTabStopIdChange:d,onEntryFocus:m,preventScrollOnEntryFocus:l=!1,...h}=t,b=i.useRef(null),g=z(s,b),j=ve(x),[N,p]=be({prop:c,defaultProp:n??null,onChange:d,caller:O}),[u,f]=i.useState(!1),y=$e(m),k=je(a),F=i.useRef(!1),[R,E]=i.useState(0);return i.useEffect(()=>{const w=b.current;if(w)return w.addEventListener(H,y),()=>w.removeEventListener(H,y)},[y]),e.jsx(ht,{scope:a,orientation:r,dir:j,loop:o,currentTabStopId:N,onItemFocus:i.useCallback(w=>p(w),[p]),onItemShiftTab:i.useCallback(()=>f(!0),[]),onFocusableItemAdd:i.useCallback(()=>E(w=>w+1),[]),onFocusableItemRemove:i.useCallback(()=>E(w=>w-1),[]),children:e.jsx(U.div,{tabIndex:u||R===0?-1:0,"data-orientation":r,...h,ref:g,style:{outline:"none",...t.style},onMouseDown:L(t.onMouseDown,()=>{F.current=!0}),onFocus:L(t.onFocus,w=>{const v=!F.current;if(w.target===w.currentTarget&&v&&!u){const S=new CustomEvent(H,ut);if(w.currentTarget.dispatchEvent(S),!S.defaultPrevented){const A=k().filter(P=>P.focusable),I=A.find(P=>P.active),Me=A.find(P=>P.id===N),Oe=[I,Me,...A].filter(Boolean).map(P=>P.ref.current);Te(Oe,l)}}F.current=!1}),onBlur:L(t.onBlur,()=>f(!1))})})}),Se="RovingFocusGroupItem",we=i.forwardRef((t,s)=>{const{__scopeRovingFocusGroup:a,focusable:r=!0,active:o=!1,tabStopId:x,children:c,...n}=t,d=fe(),m=x||d,l=pt(Se,a),h=l.currentTabStopId===m,b=je(a),{onFocusableItemAdd:g,onFocusableItemRemove:j,currentTabStopId:N}=l;return i.useEffect(()=>{if(r)return g(),()=>j()},[r,g,j]),e.jsx(W.ItemSlot,{scope:a,id:m,focusable:r,active:o,children:e.jsx(U.span,{tabIndex:h?0:-1,"data-orientation":l.orientation,...n,ref:s,onMouseDown:L(t.onMouseDown,p=>{r?l.onItemFocus(m):p.preventDefault()}),onFocus:L(t.onFocus,()=>l.onItemFocus(m)),onKeyDown:L(t.onKeyDown,p=>{if(p.key==="Tab"&&p.shiftKey){l.onItemShiftTab();return}if(p.target!==p.currentTarget)return;const u=yt(p,l.orientation,l.dir);if(u!==void 0){if(p.metaKey||p.ctrlKey||p.altKey||p.shiftKey)return;p.preventDefault();let y=b().filter(k=>k.focusable).map(k=>k.ref.current);if(u==="last")y.reverse();else if(u==="prev"||u==="next"){u==="prev"&&y.reverse();const k=y.indexOf(p.currentTarget);y=l.loop?vt(y,k+1):y.slice(k+1)}setTimeout(()=>Te(y))}}),children:typeof c=="function"?c({isCurrentTabStop:h,hasTabStop:N!=null}):c})})});we.displayName=Se;var bt={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function gt(t,s){return s!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function yt(t,s,a){const r=gt(t.key,a);if(!(s==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(s==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return bt[r]}function Te(t,s=!1){const a=document.activeElement;for(const r of t)if(r===a||(r.focus({preventScroll:s}),document.activeElement!==a))return}function vt(t,s){return t.map((a,r)=>t[(s+r)%t.length])}var jt=ke,Nt=we,B="Tabs",[kt]=q(B,[Ne]),Ce=Ne(),[St,Q]=kt(B),Ee=i.forwardRef((t,s)=>{const{__scopeTabs:a,value:r,onValueChange:o,defaultValue:x,orientation:c="horizontal",dir:n,activationMode:d="automatic",...m}=t,l=ve(n),[h,b]=be({prop:r,onChange:o,defaultProp:x??"",caller:B});return e.jsx(St,{scope:a,baseId:fe(),value:h,onValueChange:b,orientation:c,dir:l,activationMode:d,children:e.jsx(U.div,{dir:l,"data-orientation":c,...m,ref:s})})});Ee.displayName=B;var Ae="TabsList",Ie=i.forwardRef((t,s)=>{const{__scopeTabs:a,loop:r=!0,...o}=t,x=Q(Ae,a),c=Ce(a);return e.jsx(jt,{asChild:!0,...c,orientation:x.orientation,dir:x.dir,loop:r,children:e.jsx(U.div,{role:"tablist","aria-orientation":x.orientation,...o,ref:s})})});Ie.displayName=Ae;var Re="TabsTrigger",_e=i.forwardRef((t,s)=>{const{__scopeTabs:a,value:r,disabled:o=!1,...x}=t,c=Q(Re,a),n=Ce(a),d=De(c.baseId,r),m=Pe(c.baseId,r),l=r===c.value;return e.jsx(Nt,{asChild:!0,...n,focusable:!o,active:l,children:e.jsx(U.button,{type:"button",role:"tab","aria-selected":l,"aria-controls":m,"data-state":l?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:d,...x,ref:s,onMouseDown:L(t.onMouseDown,h=>{!o&&h.button===0&&h.ctrlKey===!1?c.onValueChange(r):h.preventDefault()}),onKeyDown:L(t.onKeyDown,h=>{[" ","Enter"].includes(h.key)&&c.onValueChange(r)}),onFocus:L(t.onFocus,()=>{const h=c.activationMode!=="manual";!l&&!o&&h&&c.onValueChange(r)})})})});_e.displayName=Re;var Le="TabsContent",Fe=i.forwardRef((t,s)=>{const{__scopeTabs:a,value:r,forceMount:o,children:x,...c}=t,n=Q(Le,a),d=De(n.baseId,r),m=Pe(n.baseId,r),l=r===n.value,h=i.useRef(l);return i.useEffect(()=>{const b=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(b)},[]),e.jsx(Ge,{present:o||l,children:({present:b})=>e.jsx(U.div,{"data-state":l?"active":"inactive","data-orientation":n.orientation,role:"tabpanel","aria-labelledby":d,hidden:!b,id:m,tabIndex:0,...c,ref:s,style:{...t.style,animationDuration:h.current?"0s":void 0},children:b&&x})})});Fe.displayName=Le;function De(t,s){return`${t}-trigger-${s}`}function Pe(t,s){return`${t}-content-${s}`}var wt=Ee,Tt=Ie,Ct=_e,$=Fe;const Et=["default","hover","focus","focus-visible","active","disabled"],At=["light","dark","forced-colors-active","forced-colors-none"],It=["ltr","rtl"];function Rt({value:t,onChange:s}){function a(o,x){return o.includes(x)?o.filter(c=>c!==x):[...o,x]}function r(){const o=t.ariaVariations.length===0?1:t.ariaVariations.length;return t.pseudoStates.length*o*t.themes.length*t.directions.length*t.breakpoints.length}return e.jsxs("div",{className:"space-y-3 border border-slate-200 rounded p-3 bg-white",children:[e.jsx(G,{label:"Pseudo-states",all:Et,selected:t.pseudoStates,onToggle:o=>s({...t,pseudoStates:a(t.pseudoStates,o)})}),e.jsx(G,{label:"Themes",all:At,selected:t.themes,onToggle:o=>s({...t,themes:a(t.themes,o)})}),e.jsx(G,{label:"Directions",all:It,selected:t.directions,onToggle:o=>s({...t,directions:a(t.directions,o)})}),e.jsx(G,{label:"Breakpoints",all:t.breakpointPresets.map(o=>o.id),selected:t.breakpoints,onToggle:o=>s({...t,breakpoints:a(t.breakpoints,o)})}),e.jsxs("p",{className:"text-xs text-slate-500 pt-2 border-t border-slate-100",children:[e.jsx("strong",{children:r()})," audits per component"]})]})}function G({label:t,all:s,selected:a,onToggle:r}){return e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium mb-1.5",children:t}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.map(o=>{const x=a.includes(o);return e.jsx("button",{type:"button",onClick:()=>r(o),className:x?"text-xs px-2 py-1 rounded bg-brand-500 text-white":"text-xs px-2 py-1 rounded bg-slate-100 text-slate-700 hover:bg-slate-200",children:o},o)})})]})}function _t({value:t,onChange:s}){const[a,r]=i.useState(""),[o,x]=i.useState("");function c(m){m.preventDefault();const l=a.trim(),h=o.trim();!l||!h||(s({...t,[l]:h}),r(""),x(""))}function n(m){const l={...t};delete l[m],s(l)}const d=Object.entries(t);return e.jsxs("div",{className:"space-y-3 border border-slate-200 rounded p-3 bg-white",children:[d.length===0?e.jsx("p",{className:"text-xs text-slate-500 italic",children:"no aliases"}):e.jsx("ul",{className:"space-y-1",children:d.map(([m,l])=>e.jsxs("li",{className:"text-xs flex items-center justify-between gap-2 border border-slate-100 rounded p-1.5",children:[e.jsxs("span",{className:"font-mono truncate",title:`${m} → ${l}`,children:[m," ",e.jsx("span",{className:"text-slate-500",children:"→"})," ",l]}),e.jsx("button",{onClick:()=>n(m),className:"text-slate-500 hover:text-red-600 shrink-0","aria-label":`Remove alias ${m}`,children:"×"})]},m))}),e.jsxs("form",{onSubmit:c,className:"grid grid-cols-[1fr_1fr_auto] gap-2 items-end",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-slate-500 mb-1",children:"From"}),e.jsx("input",{type:"text",value:a,onChange:m=>r(m.target.value),placeholder:"https://example.com::testid:btn-a",className:"w-full text-xs border border-slate-300 rounded px-2 py-1 font-mono"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-slate-500 mb-1",children:"Treat as"}),e.jsx("input",{type:"text",value:o,onChange:m=>x(m.target.value),placeholder:"https://example.com::testid:btn-canonical",className:"w-full text-xs border border-slate-300 rounded px-2 py-1 font-mono"})]}),e.jsx("button",{type:"submit",className:"text-xs px-3 py-1 bg-brand-500 text-white rounded disabled:opacity-50",disabled:!a.trim()||!o.trim(),children:"Add"})]})]})}const ae=ye("billing-portal-client"),Lt="https://api.wcagcheckr.com",Ft="wcagcheckr",Dt=15e3;async function Pt(t){const s=`${Lt}/v1/products/${Ft}/billing-portal`;try{const a=await fetch(s,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({licenseToken:t.licenseToken}),signal:AbortSignal.timeout(Dt)}),r=await a.json().catch(()=>null);return a.ok?r!=null&&r.url?{ok:!0,url:r.url}:{ok:!1,error:"malformed response — no url",status:a.status}:(ae.warn(`billing portal HTTP ${a.status}`,r),{ok:!1,status:a.status,error:(r==null?void 0:r.hint)??(r==null?void 0:r.error)??`HTTP ${a.status}`})}catch(a){return ae.warn("billing portal request failed",a),{ok:!1,error:a instanceof Error?a.message:String(a)}}}const ne=ye("subscription-resume-client"),Ut="https://api.wcagcheckr.com",Mt="wcagcheckr",Ot=1e4;async function $t(t){try{const s=await fetch(`${Ut}/v1/products/${Mt}/subscription/resume`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({licenseToken:t.licenseToken}),signal:AbortSignal.timeout(Ot)}),a=await s.json().catch(()=>null);return s.ok?{ok:!0,alreadyActive:(a==null?void 0:a.alreadyActive)===!0}:(ne.warn(`resume http ${s.status}`,a),{ok:!1,status:s.status,error:(a==null?void 0:a.hint)??(a==null?void 0:a.error)??`HTTP ${s.status}`})}catch(s){return ne.warn("resume request failed",s),{ok:!1,error:s instanceof Error?s.message:String(s)}}}const Gt={free:"Free",solo:"Solo",team:"Team"},Bt={free:"Free",solo:"Solo (monthly)","solo-yearly":"Solo (yearly)","solo-single-month":"Solo (single month — non-recurring)",team:"Team (5 seats, monthly)","team-yearly":"Team (5 seats, yearly)","team-15":"Team (15 seats, monthly)","team-15-yearly":"Team (15 seats, yearly)"},Kt=new Set(["solo-single-month"]);function Vt(t){if(!t)return null;const s=new Date(t).getTime()-Date.now();return Number.isFinite(s)?Math.ceil(s/(24*60*60*1e3)):null}function M(t){return t?Bt[t]??t:"—"}function re(t){if(!t)return"no expiry on file";try{return new Date(t).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return t}}function Ht({tier:t,onTierChange:s}){const[a,r]=i.useState(null),[o,x]=i.useState(null),[c,n]=i.useState(!1),[d,m]=i.useState(""),[l,h]=i.useState(!1),[b,g]=i.useState(null),[j,N]=i.useState(!1),[p,u]=i.useState(!1),f=ge(),y=i.useCallback(async v=>{const A=(await chrome.storage.local.get("licenseToken")).licenseToken??null;if(r(A),!A){x(null);return}try{const I=await T({type:"LICENSE_VALIDATE_REQUEST",token:A,forceRefresh:(v==null?void 0:v.forceRefresh)===!0});x(I)}catch{x(null)}},[]);i.useEffect(()=>(y({forceRefresh:!0}),Je("LICENSE_CHANGED_EVENT",()=>{y()})),[y]);async function k(){if(d.trim()){h(!0),g(null);try{const v=await T({type:"LICENSE_SET_REQUEST",token:d.trim()}),S=await T({type:"LICENSE_VALIDATE_REQUEST",token:d.trim()});if(S.valid&&S.plan){const A=zt(S.plan);s(A);let I=`Activated as ${M(S.plan)}.`;v.seatClaim.ok?v.seatClaim.overCapacity&&(I=`Activated as ${M(S.plan)}. Note: this license is currently OVER its seat cap (${v.seatClaim.seatsUsed} of ${v.seatClaim.seatsTotal} seats). Release one or upgrade.`):v.seatClaim.reason==="cap-reached"?I=`Activated as ${M(S.plan)}, BUT this license is at its seat capacity (${v.seatClaim.seatsUsed} of ${v.seatClaim.seatsTotal} seats used). Release a seat from another device, or upgrade to a higher-seat plan. This device's seat won't be active until you do.`:v.seatClaim.reason==="network"&&(I=`Activated as ${M(S.plan)}. (Seat-tracking ping failed — retrying in the background.)`),g(I),v.seatClaim.ok&&!v.seatClaim.overCapacity?_.polite(I):_.assertive(I),m(""),n(!1),await y()}else{const A="Token did not validate. Check the value and try again.";g(A),_.assertive(A)}}catch(v){const S=v instanceof Error?v.message:String(v);g(S),_.assertive(S)}finally{h(!1)}}}async function F(){if(a)try{await navigator.clipboard.writeText(a),N(!0),setTimeout(()=>N(!1),2e3)}catch{}}async function R(){if(window.confirm(`Remove the active license token from this extension?
|
|
1
|
+
import"./modulepreload-polyfill-B5Qt9EMX.js";import{a as q,R as D,b as z,j as e,d as X,r as i,e as fe,P,f as L,g as be,h as $e,i as Ge,k as ge,l as _,y as Be,C as Ke,A as K,m as Ve,c as He}from"./styles-Dg6rHpW6.js";import{c as ye,r as T,o as Je,T as Ye,a as ze,s as C,O as Z,b as We,l as qe,g as Qe,d as Xe}from"./crash-reporter-DAZnNefT.js";import{w as Ze,r as et}from"./tier-config-client-CimEdyEg.js";import{D as tt,g as st,A as at,s as ee,c as nt,a as V,l as rt,b as ot,d as te}from"./ai-usage-log-DVzy9AU1.js";import{l as lt,s as se,v as it}from"./custom-rules-CAe0nbES.js";import"./_commonjsHelpers-Cpj98o6Y.js";function ct(t){const s=t+"CollectionProvider",[a,r]=q(s),[o,x]=a(s,{collectionRef:{current:null},itemMap:new Map}),c=N=>{const{scope:p,children:u}=N,f=D.useRef(null),y=D.useRef(new Map).current;return e.jsx(o,{scope:p,itemMap:y,collectionRef:f,children:u})};c.displayName=s;const n=t+"CollectionSlot",d=X(n),m=D.forwardRef((N,p)=>{const{scope:u,children:f}=N,y=x(n,u),k=z(p,y.collectionRef);return e.jsx(d,{ref:k,children:f})});m.displayName=n;const l=t+"CollectionItemSlot",h="data-radix-collection-item",b=X(l),g=D.forwardRef((N,p)=>{const{scope:u,children:f,...y}=N,k=D.useRef(null),F=z(p,k),R=x(l,u);return D.useEffect(()=>(R.itemMap.set(k,{ref:k,...y}),()=>void R.itemMap.delete(k))),e.jsx(b,{[h]:"",ref:F,children:f})});g.displayName=l;function j(N){const p=x(t+"CollectionConsumer",N);return D.useCallback(()=>{const f=p.collectionRef.current;if(!f)return[];const y=Array.from(f.querySelectorAll(`[${h}]`));return Array.from(p.itemMap.values()).sort((R,E)=>y.indexOf(R.ref.current)-y.indexOf(E.ref.current))},[p.collectionRef,p.itemMap])}return[{Provider:c,Slot:m,ItemSlot:g},j,r]}var dt=i.createContext(void 0);function ve(t){const s=i.useContext(dt);return t||s||"ltr"}var H="rovingFocusGroup.onEntryFocus",ut={bubbles:!1,cancelable:!0},O="RovingFocusGroup",[W,je,xt]=ct(O),[mt,Ne]=q(O,[xt]),[ht,pt]=mt(O),ke=i.forwardRef((t,s)=>e.jsx(W.Provider,{scope:t.__scopeRovingFocusGroup,children:e.jsx(W.Slot,{scope:t.__scopeRovingFocusGroup,children:e.jsx(ft,{...t,ref:s})})}));ke.displayName=O;var ft=i.forwardRef((t,s)=>{const{__scopeRovingFocusGroup:a,orientation:r,loop:o=!1,dir:x,currentTabStopId:c,defaultCurrentTabStopId:n,onCurrentTabStopIdChange:d,onEntryFocus:m,preventScrollOnEntryFocus:l=!1,...h}=t,b=i.useRef(null),g=z(s,b),j=ve(x),[N,p]=be({prop:c,defaultProp:n??null,onChange:d,caller:O}),[u,f]=i.useState(!1),y=$e(m),k=je(a),F=i.useRef(!1),[R,E]=i.useState(0);return i.useEffect(()=>{const w=b.current;if(w)return w.addEventListener(H,y),()=>w.removeEventListener(H,y)},[y]),e.jsx(ht,{scope:a,orientation:r,dir:j,loop:o,currentTabStopId:N,onItemFocus:i.useCallback(w=>p(w),[p]),onItemShiftTab:i.useCallback(()=>f(!0),[]),onFocusableItemAdd:i.useCallback(()=>E(w=>w+1),[]),onFocusableItemRemove:i.useCallback(()=>E(w=>w-1),[]),children:e.jsx(P.div,{tabIndex:u||R===0?-1:0,"data-orientation":r,...h,ref:g,style:{outline:"none",...t.style},onMouseDown:L(t.onMouseDown,()=>{F.current=!0}),onFocus:L(t.onFocus,w=>{const v=!F.current;if(w.target===w.currentTarget&&v&&!u){const S=new CustomEvent(H,ut);if(w.currentTarget.dispatchEvent(S),!S.defaultPrevented){const A=k().filter(U=>U.focusable),I=A.find(U=>U.active),Me=A.find(U=>U.id===N),Oe=[I,Me,...A].filter(Boolean).map(U=>U.ref.current);Te(Oe,l)}}F.current=!1}),onBlur:L(t.onBlur,()=>f(!1))})})}),Se="RovingFocusGroupItem",we=i.forwardRef((t,s)=>{const{__scopeRovingFocusGroup:a,focusable:r=!0,active:o=!1,tabStopId:x,children:c,...n}=t,d=fe(),m=x||d,l=pt(Se,a),h=l.currentTabStopId===m,b=je(a),{onFocusableItemAdd:g,onFocusableItemRemove:j,currentTabStopId:N}=l;return i.useEffect(()=>{if(r)return g(),()=>j()},[r,g,j]),e.jsx(W.ItemSlot,{scope:a,id:m,focusable:r,active:o,children:e.jsx(P.span,{tabIndex:h?0:-1,"data-orientation":l.orientation,...n,ref:s,onMouseDown:L(t.onMouseDown,p=>{r?l.onItemFocus(m):p.preventDefault()}),onFocus:L(t.onFocus,()=>l.onItemFocus(m)),onKeyDown:L(t.onKeyDown,p=>{if(p.key==="Tab"&&p.shiftKey){l.onItemShiftTab();return}if(p.target!==p.currentTarget)return;const u=yt(p,l.orientation,l.dir);if(u!==void 0){if(p.metaKey||p.ctrlKey||p.altKey||p.shiftKey)return;p.preventDefault();let y=b().filter(k=>k.focusable).map(k=>k.ref.current);if(u==="last")y.reverse();else if(u==="prev"||u==="next"){u==="prev"&&y.reverse();const k=y.indexOf(p.currentTarget);y=l.loop?vt(y,k+1):y.slice(k+1)}setTimeout(()=>Te(y))}}),children:typeof c=="function"?c({isCurrentTabStop:h,hasTabStop:N!=null}):c})})});we.displayName=Se;var bt={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function gt(t,s){return s!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function yt(t,s,a){const r=gt(t.key,a);if(!(s==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(s==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return bt[r]}function Te(t,s=!1){const a=document.activeElement;for(const r of t)if(r===a||(r.focus({preventScroll:s}),document.activeElement!==a))return}function vt(t,s){return t.map((a,r)=>t[(s+r)%t.length])}var jt=ke,Nt=we,B="Tabs",[kt]=q(B,[Ne]),Ce=Ne(),[St,Q]=kt(B),Ee=i.forwardRef((t,s)=>{const{__scopeTabs:a,value:r,onValueChange:o,defaultValue:x,orientation:c="horizontal",dir:n,activationMode:d="automatic",...m}=t,l=ve(n),[h,b]=be({prop:r,onChange:o,defaultProp:x??"",caller:B});return e.jsx(St,{scope:a,baseId:fe(),value:h,onValueChange:b,orientation:c,dir:l,activationMode:d,children:e.jsx(P.div,{dir:l,"data-orientation":c,...m,ref:s})})});Ee.displayName=B;var Ae="TabsList",Ie=i.forwardRef((t,s)=>{const{__scopeTabs:a,loop:r=!0,...o}=t,x=Q(Ae,a),c=Ce(a);return e.jsx(jt,{asChild:!0,...c,orientation:x.orientation,dir:x.dir,loop:r,children:e.jsx(P.div,{role:"tablist","aria-orientation":x.orientation,...o,ref:s})})});Ie.displayName=Ae;var Re="TabsTrigger",_e=i.forwardRef((t,s)=>{const{__scopeTabs:a,value:r,disabled:o=!1,...x}=t,c=Q(Re,a),n=Ce(a),d=De(c.baseId,r),m=Ue(c.baseId,r),l=r===c.value;return e.jsx(Nt,{asChild:!0,...n,focusable:!o,active:l,children:e.jsx(P.button,{type:"button",role:"tab","aria-selected":l,"aria-controls":m,"data-state":l?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:d,...x,ref:s,onMouseDown:L(t.onMouseDown,h=>{!o&&h.button===0&&h.ctrlKey===!1?c.onValueChange(r):h.preventDefault()}),onKeyDown:L(t.onKeyDown,h=>{[" ","Enter"].includes(h.key)&&c.onValueChange(r)}),onFocus:L(t.onFocus,()=>{const h=c.activationMode!=="manual";!l&&!o&&h&&c.onValueChange(r)})})})});_e.displayName=Re;var Le="TabsContent",Fe=i.forwardRef((t,s)=>{const{__scopeTabs:a,value:r,forceMount:o,children:x,...c}=t,n=Q(Le,a),d=De(n.baseId,r),m=Ue(n.baseId,r),l=r===n.value,h=i.useRef(l);return i.useEffect(()=>{const b=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(b)},[]),e.jsx(Ge,{present:o||l,children:({present:b})=>e.jsx(P.div,{"data-state":l?"active":"inactive","data-orientation":n.orientation,role:"tabpanel","aria-labelledby":d,hidden:!b,id:m,tabIndex:0,...c,ref:s,style:{...t.style,animationDuration:h.current?"0s":void 0},children:b&&x})})});Fe.displayName=Le;function De(t,s){return`${t}-trigger-${s}`}function Ue(t,s){return`${t}-content-${s}`}var wt=Ee,Tt=Ie,Ct=_e,$=Fe;const Et=["default","hover","focus","focus-visible","active","disabled"],At=["light","dark","forced-colors-active","forced-colors-none"],It=["ltr","rtl"];function Rt({value:t,onChange:s}){function a(o,x){return o.includes(x)?o.filter(c=>c!==x):[...o,x]}function r(){const o=t.ariaVariations.length===0?1:t.ariaVariations.length;return t.pseudoStates.length*o*t.themes.length*t.directions.length*t.breakpoints.length}return e.jsxs("div",{className:"space-y-3 border border-slate-200 rounded p-3 bg-white",children:[e.jsx(G,{label:"Pseudo-states",all:Et,selected:t.pseudoStates,onToggle:o=>s({...t,pseudoStates:a(t.pseudoStates,o)})}),e.jsx(G,{label:"Themes",all:At,selected:t.themes,onToggle:o=>s({...t,themes:a(t.themes,o)})}),e.jsx(G,{label:"Directions",all:It,selected:t.directions,onToggle:o=>s({...t,directions:a(t.directions,o)})}),e.jsx(G,{label:"Breakpoints",all:t.breakpointPresets.map(o=>o.id),selected:t.breakpoints,onToggle:o=>s({...t,breakpoints:a(t.breakpoints,o)})}),e.jsxs("p",{className:"text-xs text-slate-500 pt-2 border-t border-slate-100",children:[e.jsx("strong",{children:r()})," audits per component"]})]})}function G({label:t,all:s,selected:a,onToggle:r}){return e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium mb-1.5",children:t}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.map(o=>{const x=a.includes(o);return e.jsx("button",{type:"button",onClick:()=>r(o),className:x?"text-xs px-2 py-1 rounded bg-brand-500 text-white":"text-xs px-2 py-1 rounded bg-slate-100 text-slate-700 hover:bg-slate-200",children:o},o)})})]})}function _t({value:t,onChange:s}){const[a,r]=i.useState(""),[o,x]=i.useState("");function c(m){m.preventDefault();const l=a.trim(),h=o.trim();!l||!h||(s({...t,[l]:h}),r(""),x(""))}function n(m){const l={...t};delete l[m],s(l)}const d=Object.entries(t);return e.jsxs("div",{className:"space-y-3 border border-slate-200 rounded p-3 bg-white",children:[d.length===0?e.jsx("p",{className:"text-xs text-slate-500 italic",children:"no aliases"}):e.jsx("ul",{className:"space-y-1",children:d.map(([m,l])=>e.jsxs("li",{className:"text-xs flex items-center justify-between gap-2 border border-slate-100 rounded p-1.5",children:[e.jsxs("span",{className:"font-mono truncate",title:`${m} → ${l}`,children:[m," ",e.jsx("span",{className:"text-slate-500",children:"→"})," ",l]}),e.jsx("button",{onClick:()=>n(m),className:"text-slate-500 hover:text-red-600 shrink-0","aria-label":`Remove alias ${m}`,children:"×"})]},m))}),e.jsxs("form",{onSubmit:c,className:"grid grid-cols-[1fr_1fr_auto] gap-2 items-end",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-slate-500 mb-1",children:"From"}),e.jsx("input",{type:"text",value:a,onChange:m=>r(m.target.value),placeholder:"https://example.com::testid:btn-a",className:"w-full text-xs border border-slate-300 rounded px-2 py-1 font-mono"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-slate-500 mb-1",children:"Treat as"}),e.jsx("input",{type:"text",value:o,onChange:m=>x(m.target.value),placeholder:"https://example.com::testid:btn-canonical",className:"w-full text-xs border border-slate-300 rounded px-2 py-1 font-mono"})]}),e.jsx("button",{type:"submit",className:"text-xs px-3 py-1 bg-brand-500 text-white rounded disabled:opacity-50",disabled:!a.trim()||!o.trim(),children:"Add"})]})]})}const ae=ye("billing-portal-client"),Lt="https://api.wcagcheckr.com",Ft="wcagcheckr",Dt=15e3;async function Ut(t){const s=`${Lt}/v1/products/${Ft}/billing-portal`;try{const a=await fetch(s,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({licenseToken:t.licenseToken}),signal:AbortSignal.timeout(Dt)}),r=await a.json().catch(()=>null);return a.ok?r!=null&&r.url?{ok:!0,url:r.url}:{ok:!1,error:"malformed response — no url",status:a.status}:(ae.warn(`billing portal HTTP ${a.status}`,r),{ok:!1,status:a.status,error:(r==null?void 0:r.hint)??(r==null?void 0:r.error)??`HTTP ${a.status}`})}catch(a){return ae.warn("billing portal request failed",a),{ok:!1,error:a instanceof Error?a.message:String(a)}}}const ne=ye("subscription-resume-client"),Pt="https://api.wcagcheckr.com",Mt="wcagcheckr",Ot=1e4;async function $t(t){try{const s=await fetch(`${Pt}/v1/products/${Mt}/subscription/resume`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({licenseToken:t.licenseToken}),signal:AbortSignal.timeout(Ot)}),a=await s.json().catch(()=>null);return s.ok?{ok:!0,alreadyActive:(a==null?void 0:a.alreadyActive)===!0}:(ne.warn(`resume http ${s.status}`,a),{ok:!1,status:s.status,error:(a==null?void 0:a.hint)??(a==null?void 0:a.error)??`HTTP ${s.status}`})}catch(s){return ne.warn("resume request failed",s),{ok:!1,error:s instanceof Error?s.message:String(s)}}}const Gt={free:"Free",solo:"Solo",team:"Team"},Bt={free:"Free",solo:"Solo (monthly)","solo-yearly":"Solo (yearly)","solo-single-month":"Solo (single month — non-recurring)",team:"Team (5 seats, monthly)","team-yearly":"Team (5 seats, yearly)","team-15":"Team (15 seats, monthly)","team-15-yearly":"Team (15 seats, yearly)"},Kt=new Set(["solo-single-month"]);function Vt(t){if(!t)return null;const s=new Date(t).getTime()-Date.now();return Number.isFinite(s)?Math.ceil(s/(24*60*60*1e3)):null}function M(t){return t?Bt[t]??t:"—"}function re(t){if(!t)return"no expiry on file";try{return new Date(t).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return t}}function Ht({tier:t,onTierChange:s}){const[a,r]=i.useState(null),[o,x]=i.useState(null),[c,n]=i.useState(!1),[d,m]=i.useState(""),[l,h]=i.useState(!1),[b,g]=i.useState(null),[j,N]=i.useState(!1),[p,u]=i.useState(!1),f=ge(),y=i.useCallback(async v=>{const A=(await chrome.storage.local.get("licenseToken")).licenseToken??null;if(r(A),!A){x(null);return}try{const I=await T({type:"LICENSE_VALIDATE_REQUEST",token:A,forceRefresh:(v==null?void 0:v.forceRefresh)===!0});x(I)}catch{x(null)}},[]);i.useEffect(()=>(y({forceRefresh:!0}),Je("LICENSE_CHANGED_EVENT",()=>{y()})),[y]);async function k(){if(d.trim()){h(!0),g(null);try{const v=await T({type:"LICENSE_SET_REQUEST",token:d.trim()}),S=await T({type:"LICENSE_VALIDATE_REQUEST",token:d.trim()});if(S.valid&&S.plan){const A=zt(S.plan);s(A);let I=`Activated as ${M(S.plan)}.`;v.seatClaim.ok?v.seatClaim.overCapacity&&(I=`Activated as ${M(S.plan)}. Note: this license is currently OVER its seat cap (${v.seatClaim.seatsUsed} of ${v.seatClaim.seatsTotal} seats). Release one or upgrade.`):v.seatClaim.reason==="cap-reached"?I=`Activated as ${M(S.plan)}, BUT this license is at its seat capacity (${v.seatClaim.seatsUsed} of ${v.seatClaim.seatsTotal} seats used). Release a seat from another device, or upgrade to a higher-seat plan. This device's seat won't be active until you do.`:v.seatClaim.reason==="network"&&(I=`Activated as ${M(S.plan)}. (Seat-tracking ping failed — retrying in the background.)`),g(I),v.seatClaim.ok&&!v.seatClaim.overCapacity?_.polite(I):_.assertive(I),m(""),n(!1),await y()}else{const A="Token did not validate. Check the value and try again.";g(A),_.assertive(A)}}catch(v){const S=v instanceof Error?v.message:String(v);g(S),_.assertive(S)}finally{h(!1)}}}async function F(){if(a)try{await navigator.clipboard.writeText(a),N(!0),setTimeout(()=>N(!1),2e3)}catch{}}async function R(){if(window.confirm(`Remove the active license token from this extension?
|
|
2
2
|
|
|
3
|
-
Your subscription stays active server-side — you can paste the same token back in any time. The extension will fall back to trial / free until then.`)){a&&await ze(a),await chrome.storage.local.remove("licenseToken"),r(null),x(null);try{const S=await T({type:"TIER_GET"});s(S.tier)}catch{s("free")}_.polite("License token removed.")}}const E=Ye[t],w=a!==null&&(o==null?void 0:o.valid)===!0;return e.jsxs("div",{className:"border border-slate-200 rounded p-3 bg-white space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-slate-500",children:"Current tier"}),e.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full bg-slate-100 text-slate-700",children:Gt[t]})]}),e.jsxs("ul",{className:"text-xs text-slate-600 space-y-1",children:[e.jsxs("li",{children:["Components:"," ",Number.isFinite(E.maxComponents)?E.maxComponents:"unlimited"]}),e.jsxs("li",{children:["Baselines:"," ",Number.isFinite(E.maxBaselines)?E.maxBaselines:"unlimited"]}),e.jsxs("li",{children:["State matrix: ",E.stateMatrix]}),e.jsxs("li",{children:["Storybook auto-iterate: ",E.storybookAutoIterate?"yes":"no"]}),e.jsxs("li",{children:["JSON export: ",E.exportJson?"yes":"no"]}),e.jsxs("li",{children:["SARIF / JUnit export: ",E.exportSarif?"yes":"no"]})]}),w&&o?e.jsx(Jt,{token:a,info:o,copied:j,onCopy:F,onRemove:R,onUseDifferent:()=>n(!0),onManageSubscription:async()=>{const v=await Pt({licenseToken:a});v.ok?window.open(v.url,"_blank","noopener,noreferrer"):(g(`Couldn't open billing portal: ${v.error}`),_.assertive("Could not open billing portal."))},onResumeSubscription:async()=>{const v=await $t({licenseToken:a});if(v.ok){const S=v.alreadyActive?"Subscription was already active — no change needed.":"Subscription resumed. Cancellation has been reversed.";g(S),_.polite(S),await y({forceRefresh:!0})}else g(`Couldn't resume subscription: ${v.error}`),_.assertive("Could not resume subscription.")},onRenew:()=>u(!0),message:b}):a?e.jsx(Yt,{token:a,onRemove:R,onUseDifferent:()=>n(!0)}):e.jsx(oe,{token:d,onTokenChange:m,submitting:l,message:b,onSubmit:k}),w&&c&&e.jsx(oe,{token:d,onTokenChange:m,submitting:l,message:b,onSubmit:k,replacing:!0,onCancel:()=>{n(!1),m(""),g(null)}}),!w&&t==="free"&&e.jsxs("div",{className:"border-t border-slate-100 pt-3 space-y-2",children:[e.jsxs("p",{className:"text-xs text-slate-600",children:[e.jsx("strong",{children:"Solo"}),": $",f.solo.monthlyUsd,"/mo (recurring) ·"," ","$",f.solo.yearlyUsd,"/yr (save"," ",Be(f.solo.monthlyUsd,f.solo.yearlyUsd),"%) ·"," ","$",f.solo.singleMonthUsd," single month (no recurring) · single user."]}),e.jsxs("p",{className:"text-xs text-slate-600",children:[e.jsx("strong",{children:"Team"}),": $",f.team.fiveSeatMonthlyUsd,"/mo for 5 seats ·"," ","$",f.team.fifteenSeatMonthlyUsd,"/mo for 15 seats."]}),e.jsx("button",{type:"button",onClick:()=>u(!0),className:"inline-block text-xs px-3 py-1 bg-brand-500 text-white rounded hover:bg-brand-600",children:"Upgrade →"})]}),e.jsx(Ke,{open:p,onClose:()=>u(!1)})]})}function Jt({token:t,info:s,copied:a,onCopy:r,onRemove:o,onUseDifferent:x,onManageSubscription:c,onResumeSubscription:n,onRenew:d,message:m}){const l=s.features,h=typeof(l==null?void 0:l.seatsUsed)=="number"?l.seatsUsed:null,b=typeof(l==null?void 0:l.seatsTotal)=="number"?l.seatsTotal:null,g=b!==null,j=h!==null&&b!==null&&h>b,N=h!==null&&b!==null&&h===b,p=s.plan?Kt.has(s.plan):!1,u=Vt(s.expiresAt),f=p&&u!==null&&u<=7,y=ge();return e.jsxs("div",{className:"border-t border-slate-100 pt-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-xs font-medium text-slate-700",children:"Active license"}),e.jsx("span",{className:s.cancelAtPeriodEnd?"text-[10px] px-1.5 py-0.5 rounded-full bg-amber-100 text-amber-900":"text-[10px] px-1.5 py-0.5 rounded-full bg-emerald-100 text-emerald-800",children:s.cancelAtPeriodEnd?"cancellation scheduled":s.status??"unknown"})]}),s.pastDueSince&&e.jsxs("div",{className:"bg-rose-50 border border-rose-200 rounded p-2 text-[11px] text-rose-900",children:[e.jsx("strong",{children:"Payment failed."})," Stripe couldn't charge your card. Access continues during the grace period (usually up to 7 days while Stripe retries), then this license will cancel automatically."," ",e.jsx("button",{type:"button",onClick:c,className:"font-medium underline-offset-2 hover:underline",children:"Update your card via the Stripe portal →"})]}),s.cancelAtPeriodEnd&&e.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded p-2 text-[11px] text-amber-900 space-y-1",children:[e.jsxs("p",{children:[e.jsx("strong",{children:"Cancellation scheduled."})," Your subscription was cancelled via Stripe. Access continues until ",e.jsx("strong",{children:re(s.expiresAt)}),", then this license stops working."]}),e.jsx("button",{type:"button",onClick:n,className:"text-[11px] font-medium underline-offset-2 hover:underline",children:"Resume subscription →"})]}),j&&e.jsxs("div",{className:"bg-rose-50 border border-rose-200 rounded p-2 text-[11px] text-rose-900",children:[e.jsx("strong",{children:"Over seat capacity."})," This license has"," ",e.jsx("strong",{children:h})," seats in use but the plan only includes"," ",e.jsx("strong",{children:b}),". New devices will be rejected. Release a seat from another device, or upgrade to a higher-seat plan via Manage subscription below."]}),N&&!j&&e.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded p-2 text-[11px] text-amber-900",children:[e.jsx("strong",{children:"At seat capacity."})," All ",e.jsx("strong",{children:b})," seats are in use. The next new device that tries to activate this license will be rejected until a seat is released."]}),e.jsxs("dl",{className:"text-xs text-slate-600 grid grid-cols-[max-content_1fr] gap-x-3 gap-y-1",children:[e.jsx("dt",{className:"text-slate-500",children:"Plan"}),e.jsx("dd",{children:M(s.plan)}),e.jsx("dt",{className:"text-slate-500",children:"Email"}),e.jsx("dd",{className:"truncate",children:s.email??"—"}),e.jsx("dt",{className:"text-slate-500",children:p?"Expires":"Renews / ends"}),e.jsxs("dd",{children:[re(s.expiresAt),u!==null&&u>=0&&u<=14?e.jsx("span",{className:f?"ml-2 text-[10px] text-amber-900 bg-amber-100 rounded px-1.5 py-0.5":"ml-2 text-[10px] text-slate-500",children:u===0?"today":u===1?"1 day left":`${u} days left`}):null]}),g?e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-slate-500",children:"Seats"}),e.jsx("dd",{children:h!==null?`${h} of ${b} used`:`${b} total`})]}):null]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[11px] font-medium text-slate-500 mb-1",children:"Token"}),e.jsxs("div",{className:"flex items-stretch gap-1",children:[e.jsx("code",{className:"flex-1 font-mono text-[11px] bg-slate-100 border border-slate-200 rounded px-2 py-1.5 select-all break-all",children:t}),e.jsx("button",{type:"button",onClick:r,className:"text-[11px] px-2 py-1.5 border border-slate-300 rounded bg-white hover:bg-slate-50 shrink-0",children:a?"Copied ✓":"Copy"})]})]}),e.jsx("div",{className:"pt-1 flex flex-wrap gap-2",children:p?e.jsx("button",{type:"button",onClick:d,className:f?"text-xs px-3 py-1.5 bg-amber-500 text-white rounded hover:bg-amber-600":"text-xs px-3 py-1.5 bg-brand-500 text-white rounded hover:bg-brand-600",title:"Buy another month — extends your existing license, no new token to copy",children:f?`Renew now — $${y.solo.singleMonthUsd} →`:`Buy another month — $${y.solo.singleMonthUsd} →`}):e.jsx("button",{type:"button",onClick:c,className:"text-xs px-3 py-1.5 bg-brand-500 text-white rounded hover:bg-brand-600",title:"Open Stripe's billing portal — change plan or seat count, update card, view invoices, cancel",children:"Manage subscription →"})}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 pt-1",children:[e.jsx("button",{type:"button",onClick:x,className:"text-[11px] text-brand-600 hover:underline",children:"Use a different token"}),e.jsx("span",{className:"text-slate-300","aria-hidden":"true",children:"·"}),e.jsx("button",{type:"button",onClick:o,className:"text-[11px] text-rose-700 hover:underline",children:"Remove license from this extension"})]}),m&&e.jsx("p",{className:"text-xs text-slate-600 pt-1",children:m})]})}function Yt({token:t,onRemove:s,onUseDifferent:a}){return e.jsxs("div",{className:"border-t border-rose-100 pt-3 space-y-2 bg-rose-50/40 -mx-3 px-3 pb-2 rounded-b",children:[e.jsxs("p",{className:"text-xs text-rose-800",children:[e.jsx("strong",{children:"License token rejected by the server."})," The token may have been revoked, the subscription canceled, or the network is down. Verify your subscription and try a different token — or remove this one and continue on the trial / free tier."]}),e.jsx("p",{className:"text-[11px] text-rose-700 font-mono break-all",children:t}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:a,className:"text-[11px] text-brand-600 hover:underline",children:"Use a different token"}),e.jsx("span",{className:"text-slate-300","aria-hidden":"true",children:"·"}),e.jsx("button",{type:"button",onClick:s,className:"text-[11px] text-rose-700 hover:underline",children:"Remove and continue without a license"})]})]})}function oe({token:t,onTokenChange:s,submitting:a,message:r,onSubmit:o,replacing:x,onCancel:c}){return e.jsxs("div",{className:"border-t border-slate-100 pt-3 space-y-2",children:[e.jsx("label",{htmlFor:"opt-license-token",className:"block text-xs font-medium",children:x?"Replace with a different token":"Activate license token"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{id:"opt-license-token",type:"text",value:t,onChange:n=>s(n.target.value),placeholder:"00000000-0000-0000-0000-000000000000",className:"flex-1 text-xs border border-slate-300 rounded px-2 py-1 font-mono"}),e.jsx("button",{onClick:o,disabled:a||!t.trim(),className:"text-xs px-3 py-1 bg-brand-500 text-white rounded disabled:opacity-50",children:a?"Validating…":x?"Replace":"Activate"}),x&&c&&e.jsx("button",{type:"button",onClick:c,className:"text-xs px-3 py-1 border border-slate-300 rounded text-slate-700 hover:bg-slate-50",children:"Cancel"})]}),r&&e.jsx("p",{className:"text-xs text-slate-600",children:r})]})}function zt(t){return t==="solo"||t==="solo-yearly"||t==="solo-single-month"?"solo":t==="team"||t==="team-15"||t==="team-yearly"||t==="team-15-yearly"?"team":"free"}const Wt=new Set(tt.map(t=>t.id));function qt({presets:t,onChange:s}){const[a,r]=i.useState({id:"",label:"",width:1024,height:768,deviceScaleFactor:1,mobile:!1});function o(n){n.preventDefault();const d=a.id.trim();!d||t.some(m=>m.id===d)||(s([...t,{...a,id:d,label:a.label.trim()||`${d} (${a.width}×${a.height})`}]),r({id:"",label:"",width:1024,height:768,deviceScaleFactor:1,mobile:!1}))}function x(n){s(t.filter(d=>d.id!==n))}function c(n,d){s(t.map(m=>m.id===n?{...m,...d}:m))}return e.jsxs("div",{className:"space-y-3 border border-slate-200 rounded p-3 bg-white",children:[t.length===0?e.jsx("p",{className:"text-xs text-slate-500 italic",children:"no breakpoints"}):e.jsx("ul",{className:"space-y-1.5",children:t.map(n=>{const d=Wt.has(n.id);return e.jsxs("li",{className:"grid grid-cols-[1fr_70px_70px_auto_auto] gap-2 items-center text-xs",children:[e.jsxs("span",{className:"font-medium truncate",title:n.id,children:[n.label,d&&e.jsx("span",{className:"text-slate-500 font-normal ml-1",children:"(default)"})]}),e.jsx("input",{type:"number",value:n.width,onChange:m=>c(n.id,{width:Number(m.target.value)||0}),className:"text-xs border border-slate-300 rounded px-1.5 py-1 w-full","aria-label":`Width for ${n.label}`,min:1}),e.jsx("input",{type:"number",value:n.height,onChange:m=>c(n.id,{height:Number(m.target.value)||0}),className:"text-xs border border-slate-300 rounded px-1.5 py-1 w-full","aria-label":`Height for ${n.label}`,min:1}),e.jsxs("label",{className:"flex items-center gap-1 text-slate-600",children:[e.jsx("input",{type:"checkbox",checked:n.mobile,onChange:m=>c(n.id,{mobile:m.target.checked})}),"mobile"]}),d?e.jsx("span",{className:"w-4","aria-hidden":"true"}):e.jsx("button",{onClick:()=>x(n.id),className:"text-slate-500 hover:text-red-600","aria-label":`Remove ${n.label}`,children:"×"})]},n.id)})}),e.jsxs("form",{onSubmit:o,className:"grid grid-cols-[1fr_1fr_70px_70px_auto] gap-2 items-end pt-3 border-t border-slate-100",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"bp-draft-id",className:"block text-xs text-slate-500 mb-1",children:"ID"}),e.jsx("input",{id:"bp-draft-id",type:"text",value:a.id,onChange:n=>r({...a,id:n.target.value}),placeholder:"laptop",className:"w-full text-xs border border-slate-300 rounded px-2 py-1"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"bp-draft-label",className:"block text-xs text-slate-500 mb-1",children:"Label"}),e.jsx("input",{id:"bp-draft-label",type:"text",value:a.label,onChange:n=>r({...a,label:n.target.value}),placeholder:"Laptop (1440×900)",className:"w-full text-xs border border-slate-300 rounded px-2 py-1"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"bp-draft-width",className:"block text-xs text-slate-500 mb-1",children:"W"}),e.jsx("input",{id:"bp-draft-width",type:"number",value:a.width,onChange:n=>r({...a,width:Number(n.target.value)||0}),min:1,className:"w-full text-xs border border-slate-300 rounded px-1.5 py-1"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"bp-draft-height",className:"block text-xs text-slate-500 mb-1",children:"H"}),e.jsx("input",{id:"bp-draft-height",type:"number",value:a.height,onChange:n=>r({...a,height:Number(n.target.value)||0}),min:1,className:"w-full text-xs border border-slate-300 rounded px-1.5 py-1"})]}),e.jsx("button",{type:"submit",disabled:!a.id.trim()||t.some(n=>n.id===a.id.trim()),className:"text-xs px-3 py-1 bg-brand-500 text-white rounded disabled:opacity-50",children:"Add"})]})]})}function Qt({stateMatrix:t,componentIdAliases:s,onImport:a}){const r=i.useRef(null),[o,x]=i.useState(null);function c(){const d={schemaVersion:1,exportedAt:new Date().toISOString(),stateMatrix:t,componentIdAliases:s},m=new Blob([JSON.stringify(d,null,2)],{type:"application/json"}),l=URL.createObjectURL(m),h=document.createElement("a");h.href=l,h.download=`wcag-auditor-settings-${new Date().toISOString().slice(0,10)}.json`,h.click(),URL.revokeObjectURL(l),x("Exported.")}async function n(d){var m,l;x(null);try{const h=await d.text(),b=JSON.parse(h);if(b.schemaVersion!==1)throw new Error(`Unsupported schemaVersion: ${b.schemaVersion}`);if(!((m=b.stateMatrix)!=null&&m.pseudoStates)||!((l=b.stateMatrix)!=null&&l.breakpointPresets))throw new Error("stateMatrix is malformed");await C({type:"SETTINGS_SET",key:"stateMatrix",value:b.stateMatrix}),await C({type:"SETTINGS_SET",key:"componentIdAliases",value:b.componentIdAliases??{}}),a({stateMatrix:b.stateMatrix,componentIdAliases:b.componentIdAliases??{}}),x("Imported.")}catch(h){x(`Import failed: ${h instanceof Error?h.message:String(h)}`)}}return e.jsxs("div",{className:"border border-slate-200 rounded p-3 bg-white space-y-2",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:c,className:"text-xs px-3 py-1 bg-slate-100 hover:bg-slate-200 rounded",children:"Export settings"}),e.jsx("button",{onClick:()=>{var d;return(d=r.current)==null?void 0:d.click()},className:"text-xs px-3 py-1 bg-slate-100 hover:bg-slate-200 rounded",children:"Import settings…"}),e.jsx("input",{ref:r,type:"file",accept:"application/json,.json",className:"hidden",onChange:d=>{var l;const m=(l=d.target.files)==null?void 0:l[0];m&&n(m),d.target.value=""}})]}),o&&e.jsx("p",{className:"text-xs text-slate-600",children:o})]})}function Xt(){const[t,s]=i.useState(null);i.useEffect(()=>{chrome.storage.local.get(Z).then(r=>s(r[Z]===!0))},[]);async function a(){const r=!t;s(r),await We(r)}return t===null?e.jsx("p",{className:"text-xs text-slate-500",children:"Loading…"}):e.jsx("div",{className:"border border-slate-200 rounded p-3 bg-white space-y-2",children:e.jsxs("label",{className:"flex items-start gap-2 text-xs cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:t,onChange:a,className:"mt-0.5"}),e.jsxs("span",{children:[e.jsx("span",{className:"font-medium",children:"Send anonymized crash reports"}),e.jsx("span",{className:"block text-slate-500 mt-0.5",children:"When the extension hits an unexpected error, send the error message + redacted stack trace + extension version. URLs, emails, and license tokens are stripped before sending. No audit data, page content, or browsing history is included."})]})]})})}function Zt(){const[t,s]=i.useState(null);i.useEffect(()=>{chrome.storage.local.get(K).then(r=>s(r[K]===!0))},[]);async function a(){const r=!t;s(r),await chrome.storage.local.set({[K]:r})}return t===null?e.jsx("p",{className:"text-xs text-slate-500",children:"Loading…"}):e.jsx("div",{className:"border border-slate-200 rounded p-3 bg-white space-y-2",children:e.jsxs("label",{className:"flex items-start gap-2 text-xs cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:t,onChange:a,className:"mt-0.5"}),e.jsxs("span",{children:[e.jsx("span",{className:"font-medium",children:"Skip the download confirmation"}),e.jsx("span",{className:"block text-slate-500 mt-0.5",children:"By default, generating a defense or evidence bundle pops up a small confirmation asking whether to download or preview. Enable this to skip the prompt and have the file land directly in your Downloads folder. Keep it off if you'd rather decide each time (recommended for non-technical users — surprise downloads can be alarming)."})]})]})})}const es={"deposition-packet":{name:"Deposition packet",description:"Court-grade HTML with VPS-anchored RFC 3161 timestamp. Use for active litigation / regulatory submission."},"defense-bundle":{name:"Defense bundle",description:"Locally anchored attorney-ready HTML. The everyday remediation-trail artifact — exec summary, findings, screenshots, VPAT, methodology. Recommended baseline."},"html-print":{name:"Printable HTML",description:"Simple print-ready HTML for sharing with stakeholders. No anchoring, no legal framing — just the findings."},"ai-prompt":{name:"AI fix prompt (markdown)",description:"Markdown prompt for Claude / Cursor / Copilot Chat. Includes fix recipes per violation + acknowledged-findings context. Use for dev handoff after each audit."}};function ts(){const[t,s]=i.useState(null);if(i.useEffect(()=>{let o=!1;return(async()=>{const x=await st();o||s(x)})(),()=>{o=!0}},[]),!t)return e.jsx("p",{className:"text-xs text-slate-500",children:"Loading…"});async function a(){const o={...t,enabled:!t.enabled};s(o),await ee(o)}async function r(o){const x=t.formats.includes(o);let c;x?(c=t.formats.filter(d=>d!==o),c.length===0&&t.enabled&&(c=t.formats)):c=[...t.formats,o];const n={...t,formats:c};s(n),await ee(n)}return e.jsxs("div",{className:"border border-slate-200 rounded p-3 bg-white space-y-3",children:[e.jsxs("label",{className:"flex items-start gap-2 text-xs cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:t.enabled,onChange:()=>void a(),className:"mt-0.5"}),e.jsxs("span",{children:[e.jsx("span",{className:"font-medium",children:"Auto-export every audit"}),e.jsxs("span",{className:"block text-slate-500 mt-0.5",children:["Each completed audit silently downloads the formats checked below. Same setting applies to both manual and scheduled audits. Scheduled audits land in ",e.jsx("span",{className:"font-mono",children:"Downloads/wcagcheckr/{domain}/"}),"; scheduled audits only fire while Chrome is running."]})]})]}),t.enabled&&e.jsxs("fieldset",{className:"pl-6 space-y-2",children:[e.jsx("legend",{className:"text-xs font-medium text-slate-700",children:"Formats to export"}),at.map(o=>{const x=t.formats.includes(o),c=es[o];return e.jsxs("label",{className:"flex items-start gap-2 text-xs cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:x,onChange:()=>void r(o),className:"mt-0.5"}),e.jsxs("span",{className:"leading-snug",children:[e.jsx("span",{className:"font-medium",children:c.name}),e.jsx("span",{className:"block text-slate-500 mt-0.5",children:c.description})]})]},o)})]})]})}function ss(){const[t,s]=i.useState(null),[a,r]=i.useState(!1);async function o(){const c=await chrome.storage.local.get(null),n=Object.keys(c).filter(d=>d.startsWith("auditCache:"));s(n.length)}i.useEffect(()=>{o()},[]);async function x(){r(!0);try{await nt(),await o()}finally{r(!1)}}return e.jsxs("div",{className:"border border-slate-200 rounded p-3 bg-white space-y-2",children:[e.jsxs("div",{className:"text-xs",children:[e.jsx("span",{className:"font-medium",children:"Audit cache"}),e.jsx("span",{className:"block text-slate-500 mt-0.5",children:"Repeat audits of the same component skip the state-matrix iteration when the DOM is unchanged from the last audit (10-50× faster). The fingerprint is DOM-only — if you change ONLY CSS, the cache won't notice and will return stale results. Clear it here when that happens."})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:x,disabled:a||(t??0)===0,className:"text-xs px-3 py-1 bg-slate-100 hover:bg-slate-200 disabled:opacity-50 disabled:cursor-not-allowed border border-slate-300 rounded",children:a?"Clearing…":"Clear audit cache"}),e.jsx("span",{className:"text-xs text-slate-500",children:t===null?"Loading…":t===0?"Cache is empty.":`${t} cached audit${t===1?"":"s"}.`})]})]})}const le="licenseToken";function ie(t){const s=Date.now()-new Date(t).getTime(),a=Math.floor(s/6e4);if(a<1)return"just now";if(a<60)return`${a} min ago`;const r=Math.floor(a/60);if(r<24)return`${r}h ago`;const o=Math.floor(r/24);return o<30?`${o}d ago`:new Date(t).toLocaleDateString()}function as(t){return t.slice(0,8)+"…"}function ns(t){return t?/Edg\//.test(t)?"Edge":/Chrome\//.test(t)?"Chrome":/Firefox\//.test(t)?"Firefox":/Safari\//.test(t)?"Safari":t.slice(0,30):"unknown"}function rs(){const[t,s]=i.useState(null),[a,r]=i.useState(null),[o,x]=i.useState(null),[c,n]=i.useState(0),[d,m]=i.useState(null),[l,h]=i.useState(!1),[b,g]=i.useState(null),j=i.useCallback(async()=>{h(!0),g(null);try{const u=(await chrome.storage.local.get(le))[le]??null;if(s(u),!u){r(null);return}const f=await qe(u);if(!f){g("Could not load seats — check network or license validity.");return}r(f.seats),x(f.seatsTotal),n(f.seatsUsed),m(await Qe())}finally{h(!1)}},[]);i.useEffect(()=>{j()},[j]);async function N(p){if(!t)return;const f=p===d?"Revoke THIS device? You will have to re-claim a seat on the next audit (if a seat is available).":"Revoke this seat? The device will be denied audits until it re-claims a seat (subject to the seat cap).";if(window.confirm(f)){h(!0);try{if(!await Xe(t,p)){g("Revoke failed — try again or check network.");return}await j()}finally{h(!1)}}}return t?o===null?e.jsx("div",{className:"text-xs text-slate-500",children:"This license has no seat cap (Solo / single-month / free / trial). Upgrade to a Team plan to see and manage seats here."}):e.jsxs("div",{className:"border border-slate-200 rounded p-3 bg-white space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"text-xs",children:[e.jsx("span",{className:"font-medium",children:"Team seats"}),e.jsxs("span",{className:"text-slate-500 ml-2",children:[c," of ",o," used",c>o&&e.jsx("span",{className:"ml-2 text-amber-700",children:"(over capacity — release to bring under limit)"})]})]}),e.jsx("button",{onClick:j,disabled:l,className:"text-xs px-2 py-0.5 border border-slate-300 rounded hover:bg-slate-50 disabled:opacity-50",children:l?"Loading…":"Refresh"})]}),b&&e.jsx("p",{className:"text-xs text-red-700",children:b}),a&&a.length>0?e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-slate-500",children:[e.jsx("th",{className:"font-normal py-1",children:"Device"}),e.jsx("th",{className:"font-normal py-1",children:"Browser"}),e.jsx("th",{className:"font-normal py-1",children:"Claimed"}),e.jsx("th",{className:"font-normal py-1",children:"Last active"}),e.jsx("th",{className:"font-normal py-1"})]})}),e.jsx("tbody",{children:a.map(p=>e.jsxs("tr",{className:"border-t border-slate-100",children:[e.jsxs("td",{className:"py-1",children:[e.jsx("code",{className:"text-[10px] text-slate-600",children:as(p.deviceId)}),p.deviceId===d&&e.jsx("span",{className:"ml-1 text-[10px] text-brand-700",children:"(this device)"})]}),e.jsx("td",{className:"py-1 text-slate-700",children:ns(p.userAgent)}),e.jsx("td",{className:"py-1 text-slate-500",children:ie(p.claimedAt)}),e.jsx("td",{className:"py-1 text-slate-500",children:ie(p.lastSeenAt)}),e.jsx("td",{className:"py-1 text-right",children:e.jsx("button",{onClick:()=>N(p.deviceId),disabled:l,className:"text-[11px] px-2 py-0.5 border border-slate-300 rounded hover:bg-red-50 hover:text-red-800 hover:border-red-300 disabled:opacity-50",children:"Revoke"})})]},p.deviceId))})]}):e.jsx("p",{className:"text-xs text-slate-500",children:"No seats claimed yet."})]}):e.jsx("div",{className:"text-xs text-slate-500",children:"Activate a Team license to manage seats here."})}const os=[{id:"use-our-button",description:"Use the design-system Button, not raw <button>.",impact:"moderate",selector:"button:not([data-component='Button']):not([data-component^='ds-'])",check:{type:"fail-on-match",message:"Replace raw <button> with the design-system Button component."},enabled:!0},{id:"no-inline-styles",description:"Inline style attribute escapes the design tokens.",impact:"minor",selector:"[style]",check:{type:"fail-on-match",message:"Move this style into a design-token-aware CSS class."},enabled:!0},{id:"cta-needs-testid",description:"Every call-to-action button must have data-testid for E2E.",impact:"serious",selector:'button.cta, [data-component="Button"][data-variant="primary"]',check:{type:"attribute-required",attribute:"data-testid",message:"Add a data-testid attribute so QA can target this element."},enabled:!1}];function ls(){const[t,s]=i.useState(""),[a,r]=i.useState([]),[o,x]=i.useState(!1),[c,n]=i.useState(null);i.useEffect(()=>{lt().then(l=>{s(l.length>0?JSON.stringify(l,null,2):""),x(!0)})},[]);function d(){if(t.trim().length===0){se([]),r([]),n(Date.now());return}let l;try{l=JSON.parse(t)}catch(g){r([`Invalid JSON: ${g instanceof Error?g.message:String(g)}`]);return}const{valid:h,errors:b}=it(l);if(b.length>0){r(b);return}r([]),se(h),n(Date.now()),s(JSON.stringify(h,null,2))}function m(){s(JSON.stringify(os,null,2)),r([])}return o?e.jsxs("div",{className:"space-y-2",children:[e.jsxs("p",{className:"text-xs text-slate-500",children:["Custom rules check your design-system contracts during every audit. Three check types supported:"," ",e.jsx("code",{className:"bg-slate-100 px-1 rounded",children:"fail-on-match"})," (every element matching the selector is a violation),"," ",e.jsx("code",{className:"bg-slate-100 px-1 rounded",children:"attribute-required"})," ","(the named attribute must be present), and"," ",e.jsx("code",{className:"bg-slate-100 px-1 rounded",children:"attribute-equals"})," ","(attribute must equal a specific value). Output appears in audit results alongside built-in WCAG rules."]}),e.jsx("textarea",{value:t,onChange:l=>s(l.target.value),rows:14,spellCheck:!1,placeholder:"[]",className:"w-full text-xs font-mono border border-slate-300 rounded p-2 resize-y"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:d,className:"text-xs px-3 py-1 bg-brand-500 text-white rounded hover:bg-brand-600",children:"Save"}),e.jsx("button",{onClick:m,className:"text-xs px-3 py-1 border border-slate-300 rounded hover:bg-slate-50",children:"Load example rules"}),c&&a.length===0&&e.jsxs("span",{className:"text-[11px] text-slate-500",children:["Saved at ",new Date(c).toLocaleTimeString(),"."]})]}),a.length>0&&e.jsx("div",{className:"border border-red-200 bg-red-50 rounded p-2 text-xs text-red-800 space-y-1",children:a.map((l,h)=>e.jsx("div",{children:l},h))})]}):e.jsx("div",{className:"text-xs text-slate-500",children:"Loading…"})}const ce="disabledRules";function is(){const[t,s]=i.useState(""),[a,r]=i.useState(!1),[o,x]=i.useState(null);i.useEffect(()=>{T({type:"SETTINGS_GET",key:ce}).then(n=>{const d=Array.isArray(n.data)?n.data:[];s(d.join(`
|
|
3
|
+
Your subscription stays active server-side — you can paste the same token back in any time. The extension will fall back to trial / free until then.`)){a&&await ze(a),await chrome.storage.local.remove("licenseToken"),r(null),x(null);try{const S=await T({type:"TIER_GET"});s(S.tier)}catch{s("free")}_.polite("License token removed.")}}const E=Ye[t],w=a!==null&&(o==null?void 0:o.valid)===!0;return e.jsxs("div",{className:"border border-slate-200 rounded p-3 bg-white space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-slate-500",children:"Current tier"}),e.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full bg-slate-100 text-slate-700",children:Gt[t]})]}),e.jsxs("ul",{className:"text-xs text-slate-600 space-y-1",children:[e.jsxs("li",{children:["Components:"," ",Number.isFinite(E.maxComponents)?E.maxComponents:"unlimited"]}),e.jsxs("li",{children:["Baselines:"," ",Number.isFinite(E.maxBaselines)?E.maxBaselines:"unlimited"]}),e.jsxs("li",{children:["State matrix: ",E.stateMatrix]}),e.jsxs("li",{children:["Storybook auto-iterate: ",E.storybookAutoIterate?"yes":"no"]}),e.jsxs("li",{children:["JSON export: ",E.exportJson?"yes":"no"]}),e.jsxs("li",{children:["SARIF / JUnit export: ",E.exportSarif?"yes":"no"]})]}),w&&o?e.jsx(Jt,{token:a,info:o,copied:j,onCopy:F,onRemove:R,onUseDifferent:()=>n(!0),onManageSubscription:async()=>{const v=await Ut({licenseToken:a});v.ok?window.open(v.url,"_blank","noopener,noreferrer"):(g(`Couldn't open billing portal: ${v.error}`),_.assertive("Could not open billing portal."))},onResumeSubscription:async()=>{const v=await $t({licenseToken:a});if(v.ok){const S=v.alreadyActive?"Subscription was already active — no change needed.":"Subscription resumed. Cancellation has been reversed.";g(S),_.polite(S),await y({forceRefresh:!0})}else g(`Couldn't resume subscription: ${v.error}`),_.assertive("Could not resume subscription.")},onRenew:()=>u(!0),message:b}):a?e.jsx(Yt,{token:a,onRemove:R,onUseDifferent:()=>n(!0)}):e.jsx(oe,{token:d,onTokenChange:m,submitting:l,message:b,onSubmit:k}),w&&c&&e.jsx(oe,{token:d,onTokenChange:m,submitting:l,message:b,onSubmit:k,replacing:!0,onCancel:()=>{n(!1),m(""),g(null)}}),!w&&t==="free"&&e.jsxs("div",{className:"border-t border-slate-100 pt-3 space-y-2",children:[e.jsxs("p",{className:"text-xs text-slate-600",children:[e.jsx("strong",{children:"Solo"}),": $",f.solo.monthlyUsd,"/mo (recurring) ·"," ","$",f.solo.yearlyUsd,"/yr (save"," ",Be(f.solo.monthlyUsd,f.solo.yearlyUsd),"%) ·"," ","$",f.solo.singleMonthUsd," single month (no recurring) · single user."]}),e.jsxs("p",{className:"text-xs text-slate-600",children:[e.jsx("strong",{children:"Team"}),": $",f.team.fiveSeatMonthlyUsd,"/mo for 5 seats ·"," ","$",f.team.fifteenSeatMonthlyUsd,"/mo for 15 seats."]}),e.jsx("button",{type:"button",onClick:()=>u(!0),className:"inline-block text-xs px-3 py-1 bg-brand-500 text-white rounded hover:bg-brand-600",children:"Upgrade →"})]}),e.jsx(Ke,{open:p,onClose:()=>u(!1)})]})}function Jt({token:t,info:s,copied:a,onCopy:r,onRemove:o,onUseDifferent:x,onManageSubscription:c,onResumeSubscription:n,onRenew:d,message:m}){const l=s.features,h=typeof(l==null?void 0:l.seatsUsed)=="number"?l.seatsUsed:null,b=typeof(l==null?void 0:l.seatsTotal)=="number"?l.seatsTotal:null,g=b!==null,j=h!==null&&b!==null&&h>b,N=h!==null&&b!==null&&h===b,p=s.plan?Kt.has(s.plan):!1,u=Vt(s.expiresAt),f=p&&u!==null&&u<=7,y=ge();return e.jsxs("div",{className:"border-t border-slate-100 pt-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-xs font-medium text-slate-700",children:"Active license"}),e.jsx("span",{className:s.cancelAtPeriodEnd?"text-[10px] px-1.5 py-0.5 rounded-full bg-amber-100 text-amber-900":"text-[10px] px-1.5 py-0.5 rounded-full bg-emerald-100 text-emerald-800",children:s.cancelAtPeriodEnd?"cancellation scheduled":s.status??"unknown"})]}),s.pastDueSince&&e.jsxs("div",{className:"bg-rose-50 border border-rose-200 rounded p-2 text-[11px] text-rose-900",children:[e.jsx("strong",{children:"Payment failed."})," Stripe couldn't charge your card. Access continues during the grace period (usually up to 7 days while Stripe retries), then this license will cancel automatically."," ",e.jsx("button",{type:"button",onClick:c,className:"font-medium underline-offset-2 hover:underline",children:"Update your card via the Stripe portal →"})]}),s.cancelAtPeriodEnd&&e.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded p-2 text-[11px] text-amber-900 space-y-1",children:[e.jsxs("p",{children:[e.jsx("strong",{children:"Cancellation scheduled."})," Your subscription was cancelled via Stripe. Access continues until ",e.jsx("strong",{children:re(s.expiresAt)}),", then this license stops working."]}),e.jsx("button",{type:"button",onClick:n,className:"text-[11px] font-medium underline-offset-2 hover:underline",children:"Resume subscription →"})]}),j&&e.jsxs("div",{className:"bg-rose-50 border border-rose-200 rounded p-2 text-[11px] text-rose-900",children:[e.jsx("strong",{children:"Over seat capacity."})," This license has"," ",e.jsx("strong",{children:h})," seats in use but the plan only includes"," ",e.jsx("strong",{children:b}),". New devices will be rejected. Release a seat from another device, or upgrade to a higher-seat plan via Manage subscription below."]}),N&&!j&&e.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded p-2 text-[11px] text-amber-900",children:[e.jsx("strong",{children:"At seat capacity."})," All ",e.jsx("strong",{children:b})," seats are in use. The next new device that tries to activate this license will be rejected until a seat is released."]}),e.jsxs("dl",{className:"text-xs text-slate-600 grid grid-cols-[max-content_1fr] gap-x-3 gap-y-1",children:[e.jsx("dt",{className:"text-slate-500",children:"Plan"}),e.jsx("dd",{children:M(s.plan)}),e.jsx("dt",{className:"text-slate-500",children:"Email"}),e.jsx("dd",{className:"truncate",children:s.email??"—"}),e.jsx("dt",{className:"text-slate-500",children:p?"Expires":"Renews / ends"}),e.jsxs("dd",{children:[re(s.expiresAt),u!==null&&u>=0&&u<=14?e.jsx("span",{className:f?"ml-2 text-[10px] text-amber-900 bg-amber-100 rounded px-1.5 py-0.5":"ml-2 text-[10px] text-slate-500",children:u===0?"today":u===1?"1 day left":`${u} days left`}):null]}),g?e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-slate-500",children:"Seats"}),e.jsx("dd",{children:h!==null?`${h} of ${b} used`:`${b} total`})]}):null]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[11px] font-medium text-slate-500 mb-1",children:"Token"}),e.jsxs("div",{className:"flex items-stretch gap-1",children:[e.jsx("code",{className:"flex-1 font-mono text-[11px] bg-slate-100 border border-slate-200 rounded px-2 py-1.5 select-all break-all",children:t}),e.jsx("button",{type:"button",onClick:r,className:"text-[11px] px-2 py-1.5 border border-slate-300 rounded bg-white hover:bg-slate-50 shrink-0",children:a?"Copied ✓":"Copy"})]})]}),e.jsx("div",{className:"pt-1 flex flex-wrap gap-2",children:p?e.jsx("button",{type:"button",onClick:d,className:f?"text-xs px-3 py-1.5 bg-amber-500 text-white rounded hover:bg-amber-600":"text-xs px-3 py-1.5 bg-brand-500 text-white rounded hover:bg-brand-600",title:"Buy another month — extends your existing license, no new token to copy",children:f?`Renew now — $${y.solo.singleMonthUsd} →`:`Buy another month — $${y.solo.singleMonthUsd} →`}):e.jsx("button",{type:"button",onClick:c,className:"text-xs px-3 py-1.5 bg-brand-500 text-white rounded hover:bg-brand-600",title:"Open Stripe's billing portal — change plan or seat count, update card, view invoices, cancel",children:"Manage subscription →"})}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 pt-1",children:[e.jsx("button",{type:"button",onClick:x,className:"text-[11px] text-brand-600 hover:underline",children:"Use a different token"}),e.jsx("span",{className:"text-slate-300","aria-hidden":"true",children:"·"}),e.jsx("button",{type:"button",onClick:o,className:"text-[11px] text-rose-700 hover:underline",children:"Remove license from this extension"})]}),m&&e.jsx("p",{className:"text-xs text-slate-600 pt-1",children:m})]})}function Yt({token:t,onRemove:s,onUseDifferent:a}){return e.jsxs("div",{className:"border-t border-rose-100 pt-3 space-y-2 bg-rose-50/40 -mx-3 px-3 pb-2 rounded-b",children:[e.jsxs("p",{className:"text-xs text-rose-800",children:[e.jsx("strong",{children:"License token rejected by the server."})," The token may have been revoked, the subscription canceled, or the network is down. Verify your subscription and try a different token — or remove this one and continue on the trial / free tier."]}),e.jsx("p",{className:"text-[11px] text-rose-700 font-mono break-all",children:t}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:a,className:"text-[11px] text-brand-600 hover:underline",children:"Use a different token"}),e.jsx("span",{className:"text-slate-300","aria-hidden":"true",children:"·"}),e.jsx("button",{type:"button",onClick:s,className:"text-[11px] text-rose-700 hover:underline",children:"Remove and continue without a license"})]})]})}function oe({token:t,onTokenChange:s,submitting:a,message:r,onSubmit:o,replacing:x,onCancel:c}){return e.jsxs("div",{className:"border-t border-slate-100 pt-3 space-y-2",children:[e.jsx("label",{htmlFor:"opt-license-token",className:"block text-xs font-medium",children:x?"Replace with a different token":"Activate license token"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{id:"opt-license-token",type:"text",value:t,onChange:n=>s(n.target.value),placeholder:"00000000-0000-0000-0000-000000000000",className:"flex-1 text-xs border border-slate-300 rounded px-2 py-1 font-mono"}),e.jsx("button",{onClick:o,disabled:a||!t.trim(),className:"text-xs px-3 py-1 bg-brand-500 text-white rounded disabled:opacity-50",children:a?"Validating…":x?"Replace":"Activate"}),x&&c&&e.jsx("button",{type:"button",onClick:c,className:"text-xs px-3 py-1 border border-slate-300 rounded text-slate-700 hover:bg-slate-50",children:"Cancel"})]}),r&&e.jsx("p",{className:"text-xs text-slate-600",children:r})]})}function zt(t){return t==="solo"||t==="solo-yearly"||t==="solo-single-month"?"solo":t==="team"||t==="team-15"||t==="team-yearly"||t==="team-15-yearly"?"team":"free"}const Wt=new Set(tt.map(t=>t.id));function qt({presets:t,onChange:s}){const[a,r]=i.useState({id:"",label:"",width:1024,height:768,deviceScaleFactor:1,mobile:!1});function o(n){n.preventDefault();const d=a.id.trim();!d||t.some(m=>m.id===d)||(s([...t,{...a,id:d,label:a.label.trim()||`${d} (${a.width}×${a.height})`}]),r({id:"",label:"",width:1024,height:768,deviceScaleFactor:1,mobile:!1}))}function x(n){s(t.filter(d=>d.id!==n))}function c(n,d){s(t.map(m=>m.id===n?{...m,...d}:m))}return e.jsxs("div",{className:"space-y-3 border border-slate-200 rounded p-3 bg-white",children:[t.length===0?e.jsx("p",{className:"text-xs text-slate-500 italic",children:"no breakpoints"}):e.jsx("ul",{className:"space-y-1.5",children:t.map(n=>{const d=Wt.has(n.id);return e.jsxs("li",{className:"grid grid-cols-[1fr_70px_70px_auto_auto] gap-2 items-center text-xs",children:[e.jsxs("span",{className:"font-medium truncate",title:n.id,children:[n.label,d&&e.jsx("span",{className:"text-slate-500 font-normal ml-1",children:"(default)"})]}),e.jsx("input",{type:"number",value:n.width,onChange:m=>c(n.id,{width:Number(m.target.value)||0}),className:"text-xs border border-slate-300 rounded px-1.5 py-1 w-full","aria-label":`Width for ${n.label}`,min:1}),e.jsx("input",{type:"number",value:n.height,onChange:m=>c(n.id,{height:Number(m.target.value)||0}),className:"text-xs border border-slate-300 rounded px-1.5 py-1 w-full","aria-label":`Height for ${n.label}`,min:1}),e.jsxs("label",{className:"flex items-center gap-1 text-slate-600",children:[e.jsx("input",{type:"checkbox",checked:n.mobile,onChange:m=>c(n.id,{mobile:m.target.checked})}),"mobile"]}),d?e.jsx("span",{className:"w-4","aria-hidden":"true"}):e.jsx("button",{onClick:()=>x(n.id),className:"text-slate-500 hover:text-red-600","aria-label":`Remove ${n.label}`,children:"×"})]},n.id)})}),e.jsxs("form",{onSubmit:o,className:"grid grid-cols-[1fr_1fr_70px_70px_auto] gap-2 items-end pt-3 border-t border-slate-100",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"bp-draft-id",className:"block text-xs text-slate-500 mb-1",children:"ID"}),e.jsx("input",{id:"bp-draft-id",type:"text",value:a.id,onChange:n=>r({...a,id:n.target.value}),placeholder:"laptop",className:"w-full text-xs border border-slate-300 rounded px-2 py-1"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"bp-draft-label",className:"block text-xs text-slate-500 mb-1",children:"Label"}),e.jsx("input",{id:"bp-draft-label",type:"text",value:a.label,onChange:n=>r({...a,label:n.target.value}),placeholder:"Laptop (1440×900)",className:"w-full text-xs border border-slate-300 rounded px-2 py-1"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"bp-draft-width",className:"block text-xs text-slate-500 mb-1",children:"W"}),e.jsx("input",{id:"bp-draft-width",type:"number",value:a.width,onChange:n=>r({...a,width:Number(n.target.value)||0}),min:1,className:"w-full text-xs border border-slate-300 rounded px-1.5 py-1"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"bp-draft-height",className:"block text-xs text-slate-500 mb-1",children:"H"}),e.jsx("input",{id:"bp-draft-height",type:"number",value:a.height,onChange:n=>r({...a,height:Number(n.target.value)||0}),min:1,className:"w-full text-xs border border-slate-300 rounded px-1.5 py-1"})]}),e.jsx("button",{type:"submit",disabled:!a.id.trim()||t.some(n=>n.id===a.id.trim()),className:"text-xs px-3 py-1 bg-brand-500 text-white rounded disabled:opacity-50",children:"Add"})]})]})}function Qt({stateMatrix:t,componentIdAliases:s,onImport:a}){const r=i.useRef(null),[o,x]=i.useState(null);function c(){const d={schemaVersion:1,exportedAt:new Date().toISOString(),stateMatrix:t,componentIdAliases:s},m=new Blob([JSON.stringify(d,null,2)],{type:"application/json"}),l=URL.createObjectURL(m),h=document.createElement("a");h.href=l,h.download=`wcag-auditor-settings-${new Date().toISOString().slice(0,10)}.json`,h.click(),URL.revokeObjectURL(l),x("Exported.")}async function n(d){var m,l;x(null);try{const h=await d.text(),b=JSON.parse(h);if(b.schemaVersion!==1)throw new Error(`Unsupported schemaVersion: ${b.schemaVersion}`);if(!((m=b.stateMatrix)!=null&&m.pseudoStates)||!((l=b.stateMatrix)!=null&&l.breakpointPresets))throw new Error("stateMatrix is malformed");await C({type:"SETTINGS_SET",key:"stateMatrix",value:b.stateMatrix}),await C({type:"SETTINGS_SET",key:"componentIdAliases",value:b.componentIdAliases??{}}),a({stateMatrix:b.stateMatrix,componentIdAliases:b.componentIdAliases??{}}),x("Imported.")}catch(h){x(`Import failed: ${h instanceof Error?h.message:String(h)}`)}}return e.jsxs("div",{className:"border border-slate-200 rounded p-3 bg-white space-y-2",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:c,className:"text-xs px-3 py-1 bg-slate-100 hover:bg-slate-200 rounded",children:"Export settings"}),e.jsx("button",{onClick:()=>{var d;return(d=r.current)==null?void 0:d.click()},className:"text-xs px-3 py-1 bg-slate-100 hover:bg-slate-200 rounded",children:"Import settings…"}),e.jsx("input",{ref:r,type:"file",accept:"application/json,.json",className:"hidden",onChange:d=>{var l;const m=(l=d.target.files)==null?void 0:l[0];m&&n(m),d.target.value=""}})]}),o&&e.jsx("p",{className:"text-xs text-slate-600",children:o})]})}function Xt(){const[t,s]=i.useState(null);i.useEffect(()=>{chrome.storage.local.get(Z).then(r=>s(r[Z]===!0))},[]);async function a(){const r=!t;s(r),await We(r)}return t===null?e.jsx("p",{className:"text-xs text-slate-500",children:"Loading…"}):e.jsx("div",{className:"border border-slate-200 rounded p-3 bg-white space-y-2",children:e.jsxs("label",{className:"flex items-start gap-2 text-xs cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:t,onChange:a,className:"mt-0.5"}),e.jsxs("span",{children:[e.jsx("span",{className:"font-medium",children:"Send anonymized crash reports"}),e.jsx("span",{className:"block text-slate-500 mt-0.5",children:"When the extension hits an unexpected error, send the error message + redacted stack trace + extension version. URLs, emails, and license tokens are stripped before sending. No audit data, page content, or browsing history is included."})]})]})})}function Zt(){const[t,s]=i.useState(null);i.useEffect(()=>{chrome.storage.local.get(K).then(r=>s(r[K]===!0))},[]);async function a(){const r=!t;s(r),await chrome.storage.local.set({[K]:r})}return t===null?e.jsx("p",{className:"text-xs text-slate-500",children:"Loading…"}):e.jsx("div",{className:"border border-slate-200 rounded p-3 bg-white space-y-2",children:e.jsxs("label",{className:"flex items-start gap-2 text-xs cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:t,onChange:a,className:"mt-0.5"}),e.jsxs("span",{children:[e.jsx("span",{className:"font-medium",children:"Skip the download confirmation"}),e.jsx("span",{className:"block text-slate-500 mt-0.5",children:"By default, generating a defense or evidence bundle pops up a small confirmation asking whether to download or preview. Enable this to skip the prompt and have the file land directly in your Downloads folder. Keep it off if you'd rather decide each time (recommended for non-technical users — surprise downloads can be alarming)."})]})]})})}const es={"deposition-packet":{name:"Deposition packet",description:"Court-grade HTML with VPS-anchored RFC 3161 timestamp. Use for active litigation / regulatory submission."},"defense-bundle":{name:"Defense bundle",description:"Locally anchored attorney-ready HTML. The everyday remediation-trail artifact — exec summary, findings, screenshots, VPAT, methodology. Recommended baseline."},"html-print":{name:"Printable HTML",description:"Simple print-ready HTML for sharing with stakeholders. No anchoring, no legal framing — just the findings."},"ai-prompt":{name:"AI fix prompt (markdown)",description:"Markdown prompt for Claude / Cursor / Copilot Chat. Includes fix recipes per violation + acknowledged-findings context. Use for dev handoff after each audit."}};function ts(){const[t,s]=i.useState(null);if(i.useEffect(()=>{let o=!1;return(async()=>{const x=await st();o||s(x)})(),()=>{o=!0}},[]),!t)return e.jsx("p",{className:"text-xs text-slate-500",children:"Loading…"});async function a(){const o={...t,enabled:!t.enabled};s(o),await ee(o)}async function r(o){const x=t.formats.includes(o);let c;x?(c=t.formats.filter(d=>d!==o),c.length===0&&t.enabled&&(c=t.formats)):c=[...t.formats,o];const n={...t,formats:c};s(n),await ee(n)}return e.jsxs("div",{className:"border border-slate-200 rounded p-3 bg-white space-y-3",children:[e.jsxs("label",{className:"flex items-start gap-2 text-xs cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:t.enabled,onChange:()=>void a(),className:"mt-0.5"}),e.jsxs("span",{children:[e.jsx("span",{className:"font-medium",children:"Auto-save an evidence pack after every audit"}),e.jsxs("span",{className:"block text-slate-500 mt-0.5",children:["Each recorded audit (manual or scheduled) bundles the documents checked below into a single zip and saves it to"," ",e.jsx("span",{className:"font-mono",children:"Downloads/wcagcheckr/{domain}/{page}/{date}.zip"}),", with a ",e.jsx("span",{className:"font-mono",children:"_index.html"}),' trail per domain. Nothing is uploaded — it stays on this machine. Uncheck "Record this run" before an audit to skip it; scheduled audits only fire while Chrome is running and the computer is awake.']})]})]}),t.enabled&&e.jsxs("fieldset",{className:"pl-6 space-y-2",children:[e.jsx("legend",{className:"text-xs font-medium text-slate-700",children:"Formats to export"}),at.map(o=>{const x=t.formats.includes(o),c=es[o];return e.jsxs("label",{className:"flex items-start gap-2 text-xs cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:x,onChange:()=>void r(o),className:"mt-0.5"}),e.jsxs("span",{className:"leading-snug",children:[e.jsx("span",{className:"font-medium",children:c.name}),e.jsx("span",{className:"block text-slate-500 mt-0.5",children:c.description})]})]},o)})]})]})}function ss(){const[t,s]=i.useState(null),[a,r]=i.useState(!1);async function o(){const c=await chrome.storage.local.get(null),n=Object.keys(c).filter(d=>d.startsWith("auditCache:"));s(n.length)}i.useEffect(()=>{o()},[]);async function x(){r(!0);try{await nt(),await o()}finally{r(!1)}}return e.jsxs("div",{className:"border border-slate-200 rounded p-3 bg-white space-y-2",children:[e.jsxs("div",{className:"text-xs",children:[e.jsx("span",{className:"font-medium",children:"Audit cache"}),e.jsx("span",{className:"block text-slate-500 mt-0.5",children:"Repeat audits of the same component skip the state-matrix iteration when the DOM is unchanged from the last audit (10-50× faster). The fingerprint is DOM-only — if you change ONLY CSS, the cache won't notice and will return stale results. Clear it here when that happens."})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:x,disabled:a||(t??0)===0,className:"text-xs px-3 py-1 bg-slate-100 hover:bg-slate-200 disabled:opacity-50 disabled:cursor-not-allowed border border-slate-300 rounded",children:a?"Clearing…":"Clear audit cache"}),e.jsx("span",{className:"text-xs text-slate-500",children:t===null?"Loading…":t===0?"Cache is empty.":`${t} cached audit${t===1?"":"s"}.`})]})]})}const le="licenseToken";function ie(t){const s=Date.now()-new Date(t).getTime(),a=Math.floor(s/6e4);if(a<1)return"just now";if(a<60)return`${a} min ago`;const r=Math.floor(a/60);if(r<24)return`${r}h ago`;const o=Math.floor(r/24);return o<30?`${o}d ago`:new Date(t).toLocaleDateString()}function as(t){return t.slice(0,8)+"…"}function ns(t){return t?/Edg\//.test(t)?"Edge":/Chrome\//.test(t)?"Chrome":/Firefox\//.test(t)?"Firefox":/Safari\//.test(t)?"Safari":t.slice(0,30):"unknown"}function rs(){const[t,s]=i.useState(null),[a,r]=i.useState(null),[o,x]=i.useState(null),[c,n]=i.useState(0),[d,m]=i.useState(null),[l,h]=i.useState(!1),[b,g]=i.useState(null),j=i.useCallback(async()=>{h(!0),g(null);try{const u=(await chrome.storage.local.get(le))[le]??null;if(s(u),!u){r(null);return}const f=await qe(u);if(!f){g("Could not load seats — check network or license validity.");return}r(f.seats),x(f.seatsTotal),n(f.seatsUsed),m(await Qe())}finally{h(!1)}},[]);i.useEffect(()=>{j()},[j]);async function N(p){if(!t)return;const f=p===d?"Revoke THIS device? You will have to re-claim a seat on the next audit (if a seat is available).":"Revoke this seat? The device will be denied audits until it re-claims a seat (subject to the seat cap).";if(window.confirm(f)){h(!0);try{if(!await Xe(t,p)){g("Revoke failed — try again or check network.");return}await j()}finally{h(!1)}}}return t?o===null?e.jsx("div",{className:"text-xs text-slate-500",children:"This license has no seat cap (Solo / single-month / free / trial). Upgrade to a Team plan to see and manage seats here."}):e.jsxs("div",{className:"border border-slate-200 rounded p-3 bg-white space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"text-xs",children:[e.jsx("span",{className:"font-medium",children:"Team seats"}),e.jsxs("span",{className:"text-slate-500 ml-2",children:[c," of ",o," used",c>o&&e.jsx("span",{className:"ml-2 text-amber-700",children:"(over capacity — release to bring under limit)"})]})]}),e.jsx("button",{onClick:j,disabled:l,className:"text-xs px-2 py-0.5 border border-slate-300 rounded hover:bg-slate-50 disabled:opacity-50",children:l?"Loading…":"Refresh"})]}),b&&e.jsx("p",{className:"text-xs text-red-700",children:b}),a&&a.length>0?e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-slate-500",children:[e.jsx("th",{className:"font-normal py-1",children:"Device"}),e.jsx("th",{className:"font-normal py-1",children:"Browser"}),e.jsx("th",{className:"font-normal py-1",children:"Claimed"}),e.jsx("th",{className:"font-normal py-1",children:"Last active"}),e.jsx("th",{className:"font-normal py-1"})]})}),e.jsx("tbody",{children:a.map(p=>e.jsxs("tr",{className:"border-t border-slate-100",children:[e.jsxs("td",{className:"py-1",children:[e.jsx("code",{className:"text-[10px] text-slate-600",children:as(p.deviceId)}),p.deviceId===d&&e.jsx("span",{className:"ml-1 text-[10px] text-brand-700",children:"(this device)"})]}),e.jsx("td",{className:"py-1 text-slate-700",children:ns(p.userAgent)}),e.jsx("td",{className:"py-1 text-slate-500",children:ie(p.claimedAt)}),e.jsx("td",{className:"py-1 text-slate-500",children:ie(p.lastSeenAt)}),e.jsx("td",{className:"py-1 text-right",children:e.jsx("button",{onClick:()=>N(p.deviceId),disabled:l,className:"text-[11px] px-2 py-0.5 border border-slate-300 rounded hover:bg-red-50 hover:text-red-800 hover:border-red-300 disabled:opacity-50",children:"Revoke"})})]},p.deviceId))})]}):e.jsx("p",{className:"text-xs text-slate-500",children:"No seats claimed yet."})]}):e.jsx("div",{className:"text-xs text-slate-500",children:"Activate a Team license to manage seats here."})}const os=[{id:"use-our-button",description:"Use the design-system Button, not raw <button>.",impact:"moderate",selector:"button:not([data-component='Button']):not([data-component^='ds-'])",check:{type:"fail-on-match",message:"Replace raw <button> with the design-system Button component."},enabled:!0},{id:"no-inline-styles",description:"Inline style attribute escapes the design tokens.",impact:"minor",selector:"[style]",check:{type:"fail-on-match",message:"Move this style into a design-token-aware CSS class."},enabled:!0},{id:"cta-needs-testid",description:"Every call-to-action button must have data-testid for E2E.",impact:"serious",selector:'button.cta, [data-component="Button"][data-variant="primary"]',check:{type:"attribute-required",attribute:"data-testid",message:"Add a data-testid attribute so QA can target this element."},enabled:!1}];function ls(){const[t,s]=i.useState(""),[a,r]=i.useState([]),[o,x]=i.useState(!1),[c,n]=i.useState(null);i.useEffect(()=>{lt().then(l=>{s(l.length>0?JSON.stringify(l,null,2):""),x(!0)})},[]);function d(){if(t.trim().length===0){se([]),r([]),n(Date.now());return}let l;try{l=JSON.parse(t)}catch(g){r([`Invalid JSON: ${g instanceof Error?g.message:String(g)}`]);return}const{valid:h,errors:b}=it(l);if(b.length>0){r(b);return}r([]),se(h),n(Date.now()),s(JSON.stringify(h,null,2))}function m(){s(JSON.stringify(os,null,2)),r([])}return o?e.jsxs("div",{className:"space-y-2",children:[e.jsxs("p",{className:"text-xs text-slate-500",children:["Custom rules check your design-system contracts during every audit. Three check types supported:"," ",e.jsx("code",{className:"bg-slate-100 px-1 rounded",children:"fail-on-match"})," (every element matching the selector is a violation),"," ",e.jsx("code",{className:"bg-slate-100 px-1 rounded",children:"attribute-required"})," ","(the named attribute must be present), and"," ",e.jsx("code",{className:"bg-slate-100 px-1 rounded",children:"attribute-equals"})," ","(attribute must equal a specific value). Output appears in audit results alongside built-in WCAG rules."]}),e.jsx("textarea",{value:t,onChange:l=>s(l.target.value),rows:14,spellCheck:!1,placeholder:"[]",className:"w-full text-xs font-mono border border-slate-300 rounded p-2 resize-y"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:d,className:"text-xs px-3 py-1 bg-brand-500 text-white rounded hover:bg-brand-600",children:"Save"}),e.jsx("button",{onClick:m,className:"text-xs px-3 py-1 border border-slate-300 rounded hover:bg-slate-50",children:"Load example rules"}),c&&a.length===0&&e.jsxs("span",{className:"text-[11px] text-slate-500",children:["Saved at ",new Date(c).toLocaleTimeString(),"."]})]}),a.length>0&&e.jsx("div",{className:"border border-red-200 bg-red-50 rounded p-2 text-xs text-red-800 space-y-1",children:a.map((l,h)=>e.jsx("div",{children:l},h))})]}):e.jsx("div",{className:"text-xs text-slate-500",children:"Loading…"})}const ce="disabledRules";function is(){const[t,s]=i.useState(""),[a,r]=i.useState(!1),[o,x]=i.useState(null);i.useEffect(()=>{T({type:"SETTINGS_GET",key:ce}).then(n=>{const d=Array.isArray(n.data)?n.data:[];s(d.join(`
|
|
4
4
|
`)),r(!0)})},[]);function c(n){const d=n.split(`
|
|
5
5
|
`).map(m=>m.trim()).filter(m=>m.length>0);C({type:"SETTINGS_SET",key:ce,value:d}),x(Date.now())}return a?e.jsxs("div",{className:"space-y-2",children:[e.jsxs("p",{className:"text-xs text-slate-500",children:["Rule IDs to skip during audits. One per line. Use exact axe-core rule IDs (e.g.,"," ",e.jsx("code",{className:"bg-slate-100 text-slate-700 px-1 rounded",children:"color-contrast"}),","," ",e.jsx("code",{className:"bg-slate-100 text-slate-700 px-1 rounded",children:"region"}),","," ",e.jsx("code",{className:"bg-slate-100 text-slate-700 px-1 rounded",children:"landmark-one-main"}),")."]}),e.jsx("textarea",{value:t,onChange:n=>s(n.target.value),onBlur:n=>c(n.target.value),rows:6,spellCheck:!1,placeholder:`region
|
|
6
|
-
landmark-one-main`,className:"w-full text-xs font-mono border border-slate-300 rounded p-2 resize-y"}),o&&e.jsxs("p",{className:"text-[11px] text-slate-500",children:["Saved at ",new Date(o).toLocaleTimeString(),"."]}),e.jsxs("p",{className:"text-[11px] text-slate-500",children:["Full rule list:"," ",e.jsx("a",{href:"https://github.com/dequelabs/axe-core/blob/develop/doc/rule-descriptions.md",target:"_blank",rel:"noreferrer",className:"text-brand-600 hover:underline",children:"axe-core/doc/rule-descriptions.md"})]})]}):e.jsx("div",{className:"text-xs text-slate-500",children:"Loading…"})}const de="githubRepoUrl",cs=/^https:\/\/github\.com\/[^/]+\/[^/]+\/?$/;function ds(){const[t,s]=i.useState(""),[a,r]=i.useState(!1),[o,x]=i.useState(null);i.useEffect(()=>{T({type:"SETTINGS_GET",key:de}).then(n=>{const d=typeof n.data=="string"?n.data:"";s(d),r(!0)})},[]);function c(n){const d=n.trim().replace(/\/$/,"");if(d.length>0&&!cs.test(d+"/")){x("Expected format: https://github.com/owner/repo");return}x(null),C({type:"SETTINGS_SET",key:de,value:d})}return a?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs text-slate-500",children:'Paste your repository URL to enable "File GitHub issue" buttons in the Delta view. Issues are opened in a new tab with title and body pre-filled — you confirm and submit on GitHub.'}),e.jsx("input",{type:"url",value:t,onChange:n=>s(n.target.value),onBlur:n=>c(n.target.value),placeholder:"https://github.com/owner/repo",className:"w-full text-xs font-mono border border-slate-300 rounded px-2 py-1.5"}),o&&e.jsx("p",{className:"text-[11px] text-rose-600",children:o})]}):e.jsx("div",{className:"text-xs text-slate-500",children:"Loading…"})}const ue="jiraInstanceUrl",us=/^https:\/\/[^/]+\.atlassian\.net\/?$/;function xs(){const[t,s]=i.useState(""),[a,r]=i.useState(!1),[o,x]=i.useState(null);i.useEffect(()=>{T({type:"SETTINGS_GET",key:ue}).then(n=>{const d=typeof n.data=="string"?n.data:"";s(d),r(!0)})},[]);function c(n){const d=n.trim().replace(/\/$/,"");if(d.length>0&&!us.test(d+"/")){x("Expected format: https://your-team.atlassian.net");return}x(null),C({type:"SETTINGS_SET",key:ue,value:d})}return a?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs text-slate-500",children:'Paste your Jira Cloud instance URL to enable "File Jira issue" in the Delta view. Issues open in a new tab pre-filled — you confirm and submit on Jira.'}),e.jsx("input",{type:"url",value:t,onChange:n=>s(n.target.value),onBlur:n=>c(n.target.value),placeholder:"https://your-team.atlassian.net",className:"w-full text-xs font-mono border border-slate-300 rounded px-2 py-1.5"}),o&&e.jsx("p",{className:"text-[11px] text-rose-600",children:o})]}):e.jsx("div",{className:"text-xs text-slate-500",children:"Loading…"})}const xe="azureDevOpsProjectUrl",ms=/^https?:\/\/[^/]+\/[^/]+\/[^/]+\/?$/;function hs(){const[t,s]=i.useState(""),[a,r]=i.useState(!1),[o,x]=i.useState(null);i.useEffect(()=>{T({type:"SETTINGS_GET",key:xe}).then(n=>{const d=typeof n.data=="string"?n.data:"";s(d),r(!0)})},[]);function c(n){const d=n.trim().replace(/\/$/,"");if(d.length>0&&!ms.test(d+"/")){x("Expected format: https://dev.azure.com/org/project");return}x(null),C({type:"SETTINGS_SET",key:xe,value:d})}return a?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs text-slate-500",children:'Paste your Azure DevOps project URL to enable "File Azure DevOps work item" buttons in the Delta view. The new-work-item form opens in a new tab with title and description pre-filled — you pick the work-item type and submit on Azure DevOps.'}),e.jsx("input",{type:"url",value:t,onChange:n=>s(n.target.value),onBlur:n=>c(n.target.value),placeholder:"https://dev.azure.com/myorg/myproject",className:"w-full text-xs font-mono border border-slate-300 rounded px-2 py-1.5"}),o&&e.jsx("p",{className:"text-[11px] text-rose-600",children:o})]}):e.jsx("div",{className:"text-xs text-slate-500",children:"Loading…"})}const me="gitlabProjectUrl",ps=/^https?:\/\/[^/]+\/[^/]+(\/[^/]+)+\/?$/;function fs(){const[t,s]=i.useState(""),[a,r]=i.useState(!1),[o,x]=i.useState(null);i.useEffect(()=>{T({type:"SETTINGS_GET",key:me}).then(n=>{const d=typeof n.data=="string"?n.data:"";s(d),r(!0)})},[]);function c(n){const d=n.trim().replace(/\/$/,"");if(d.length>0&&!ps.test(d+"/")){x("Expected format: https://gitlab.com/group/project (or self-hosted)");return}x(null),C({type:"SETTINGS_SET",key:me,value:d})}return a?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs text-slate-500",children:'Paste your GitLab project URL to enable "File GitLab issue" buttons in the Delta view. Issues are opened in a new tab with title and description pre-filled — you confirm and submit on GitLab.'}),e.jsx("input",{type:"url",value:t,onChange:n=>s(n.target.value),onBlur:n=>c(n.target.value),placeholder:"https://gitlab.com/group/project",className:"w-full text-xs font-mono border border-slate-300 rounded px-2 py-1.5"}),o&&e.jsx("p",{className:"text-[11px] text-rose-600",children:o})]}):e.jsx("div",{className:"text-xs text-slate-500",children:"Loading…"})}const he="cloudSyncEnabled",pe="cloudSyncEndpoint",bs="https://api.wcagcheckr.com";function gs(){const[t,s]=i.useState(!1),[a,r]=i.useState(bs),[o,x]=i.useState(!1),[c,n]=i.useState(!1),[d,m]=i.useState(null);i.useEffect(()=>{Promise.all([T({type:"SETTINGS_GET",key:he}),T({type:"SETTINGS_GET",key:pe})]).then(([g,j])=>{s(g.data===!0),typeof j.data=="string"&&j.data&&r(j.data),x(!0)})},[]);function l(g){s(g),C({type:"SETTINGS_SET",key:he,value:g})}function h(g){const j=g.trim().replace(/\/$/,"");r(j),C({type:"SETTINGS_SET",key:pe,value:j})}async function b(){n(!0),m(null);try{const g="To pull baselines now, reload the extension at chrome://extensions. The service worker pulls on every start.";m(g),_.polite(g)}finally{n(!1)}}return o?e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-xs text-slate-500",children:"Sync baselines across devices via your license. Disabled by default — local-first storage means the extension works fully offline. Cloud is mirror, not source of truth on the local machine."}),e.jsxs("label",{className:"flex items-center gap-2 text-xs",children:[e.jsx("input",{type:"checkbox",checked:t,onChange:g=>l(g.target.checked)}),e.jsx("span",{children:"Enable cloud sync"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-slate-500 block mb-1",children:"Sync endpoint"}),e.jsx("input",{type:"url",value:a,onChange:g=>r(g.target.value),onBlur:g=>h(g.target.value),disabled:!t,className:"w-full text-xs font-mono border border-slate-300 rounded px-2 py-1.5 disabled:bg-slate-50 disabled:text-slate-500"}),e.jsx("p",{className:"text-[11px] text-slate-500 mt-1",children:"Default points at the WCAG Auditor cloud-sync VPS. Replace with your own server URL if you self-host the baseline endpoints."})]}),e.jsx("button",{type:"button",onClick:b,disabled:!t||c,className:"text-xs px-3 py-1 border border-slate-300 rounded hover:bg-slate-50 disabled:opacity-50",children:c?"Pulling…":"Pull now"}),d&&e.jsx("p",{className:"text-[11px] text-slate-500",children:d})]}):e.jsx("div",{className:"text-xs text-slate-500",children:"Loading…"})}function ys(){const[t,s]=i.useState("owner"),[a,r]=i.useState(!1);i.useEffect(()=>{T({type:"SETTINGS_GET",key:"userMode"}).then(x=>{const c=x.data;(c==="owner"||c==="power"||c==="dev")&&s(c),r(!0)})},[]);function o(x){s(x),C({type:"SETTINGS_SET",key:"userMode",value:x}),chrome.storage.local.set({v2UiEnabled:x==="power"})}return a?e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-xs text-slate-500",children:"Sets your preferred default view. You can also flip between modes any time using the persona switcher pinned to the top of the side panel — your choice here is the one the extension opens to on next launch."}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsx(J,{active:t==="owner",icon:"🏪",label:"Owner",desc:"Focuses on the specific issues demand-letter mills flag, with plain-language fix recipes. Goal: get off the lawsuit-bot radar.",onClick:()=>o("owner")}),e.jsx(J,{active:t==="power",icon:"⚡",label:"Power user",desc:"Compliance verdict + full audit findings without granular surfaces. For people who want the answer, not the deep dive.",onClick:()=>o("power")}),e.jsx(J,{active:t==="dev",icon:"⚙️",label:"Dev",desc:"Everything — multi-state matrix, baselines + delta, all exports, all specialized views (forensic log, schedules, ax-tree, etc.).",onClick:()=>o("dev")})]})]}):e.jsx("div",{className:"text-xs text-slate-500",children:"Loading…"})}function J({active:t,icon:s,label:a,desc:r,onClick:o}){return e.jsx("button",{type:"button",onClick:o,className:`text-left rounded p-3 border transition-colors ${t?"border-brand-500 bg-brand-50 ring-2 ring-brand-500/30":"border-slate-300 bg-white hover:border-slate-400 hover:bg-slate-50"}`,children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-lg","aria-hidden":"true",children:s}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-xs",children:a}),e.jsx("div",{className:"text-[11px] text-slate-500 leading-snug mt-0.5",children:r})]})]})})}const Y="aiConfig";function vs(){const[t,s]=i.useState(V),[a,r]=i.useState(!1),[o,x]=i.useState(!1),[c,n]=i.useState(null),[d,m]=i.useState(null),[l,h]=i.useState(!1);async function b(){n(await rt(10))}i.useEffect(()=>{b()},[]);async function g(){h(!0),m(null);try{if(!t.apiKey){m({ok:!1,message:"No API key entered yet."});return}const u=await fetch("https://api.anthropic.com/v1/messages",{method:"POST",headers:{"x-api-key":t.apiKey,"anthropic-version":"2023-06-01","content-type":"application/json","anthropic-dangerous-direct-browser-access":"true"},body:JSON.stringify({model:t.model||"claude-haiku-4-5",max_tokens:5,messages:[{role:"user",content:"ok"}]})}),f=await u.json().catch(()=>null);if(!f){m({ok:!1,message:`Provider returned no JSON (HTTP ${u.status}).`});return}if("error"in f){m({ok:!1,message:`${f.error.type}: ${f.error.message}`});return}m({ok:!0,message:`Authenticated, account funded. Test call used ${f.usage.input_tokens}+${f.usage.output_tokens} tokens (~$0.0001).`})}catch(u){m({ok:!1,message:u instanceof Error?u.message:String(u)})}finally{h(!1)}}async function j(){typeof confirm=="function"&&!confirm("Clear the local AI usage log? Provider-side billing records are unaffected.")||(await ot(),await b())}i.useEffect(()=>{T({type:"SETTINGS_GET",key:Y}).then(u=>{const f=u.data;f&&s({...V,...f,enabledChecks:{...V.enabledChecks,...f.enabledChecks??{}}}),r(!0)})},[]);function N(u){const f={...t,...u};s(f),C({type:"SETTINGS_SET",key:Y,value:f})}function p(u){const f={...t,enabledChecks:{...t.enabledChecks,...u}};s(f),C({type:"SETTINGS_SET",key:Y,value:f})}return a?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{className:"text-xs text-slate-600 leading-snug",children:[e.jsx("strong",{children:"AI is optional."})," Audits run fine without it — axe-core, DOM analyzers, the state-matrix iteration, and the PDF structural pass all execute regardless of this setting. With AI enabled, the audit adds a semantic-quality layer that catches problems the structural checks can't see: alt-text that's present but generic (“image”, “figure 1”), headings that don't describe their section (“Section 1”), form labels that don't convey purpose (“Field 1”), color-only meaning, sensory-language instructions (“click the green button”), and similar judgments that need human-like reading."]}),e.jsxs("p",{className:"text-xs text-slate-600 leading-snug",children:[e.jsx("strong",{children:"You bring your own key"})," — Anthropic Claude today; OpenAI + Gemini are stubbed for later. The key is stored in ",e.jsx("code",{children:"chrome.storage.local"})," on this device only and is sent only to the provider you select. Per-audit cost is hard-capped below; at default settings, a typical audit costs ~$0.02–$0.10."]}),e.jsx("p",{className:"text-xs text-slate-500 italic leading-snug",children:"If you skip this, the side panel shows a clear “AI didn't run” banner after every audit listing what was skipped, so you always know what you're seeing versus what AI would have added."}),e.jsxs("label",{className:"flex items-center gap-2 text-xs",children:[e.jsx("input",{type:"checkbox",checked:t.enabled,onChange:u=>N({enabled:u.target.checked})}),e.jsx("span",{children:e.jsx("strong",{children:"Enable AI augmentation"})})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"ai-provider",className:"block text-xs text-slate-500 mb-1",children:"Provider"}),e.jsxs("select",{id:"ai-provider",value:t.provider,onChange:u=>N({provider:u.target.value}),disabled:!t.enabled,className:"text-xs border border-slate-300 rounded px-2 py-1.5",children:[e.jsx("option",{value:"anthropic",children:"Anthropic (Claude)"}),e.jsx("option",{value:"openai",children:"OpenAI (GPT) — coming soon"}),e.jsx("option",{value:"gemini",children:"Google (Gemini) — coming soon"})]})]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"ai-key",className:"block text-xs text-slate-500 mb-1",children:["API key",e.jsx("span",{className:"text-[10px] text-slate-400 ml-2",children:"stored locally; never sent anywhere except your chosen provider"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{id:"ai-key",type:o?"text":"password",value:t.apiKey,onChange:u=>N({apiKey:u.target.value.trim()}),disabled:!t.enabled,placeholder:"sk-ant-…",className:"flex-1 text-xs font-mono border border-slate-300 rounded px-2 py-1.5"}),e.jsx("button",{type:"button",onClick:()=>x(!o),className:"text-[11px] px-2 border border-slate-300 rounded hover:bg-slate-50",children:o?"Hide":"Show"})]})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"ai-model",className:"block text-xs text-slate-500 mb-1",children:"Model override (optional)"}),e.jsx("input",{id:"ai-model",type:"text",value:t.model??"",onChange:u=>N({model:u.target.value.trim()}),disabled:!t.enabled,placeholder:"claude-3-5-sonnet-20241022 (default)",className:"w-full text-xs font-mono border border-slate-300 rounded px-2 py-1.5"}),e.jsx("p",{className:"text-[10px] text-slate-500 mt-1",children:"Leave blank for provider default. Use a haiku-class model for cheap-fast checks."})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"ai-cap",className:"block text-xs text-slate-500 mb-1",children:"Per-audit cost cap (USD)"}),e.jsx("input",{id:"ai-cap",type:"number",step:.5,min:0,value:t.costCapUsd,onChange:u=>N({costCapUsd:Math.max(0,parseFloat(u.target.value)||0)}),disabled:!t.enabled,className:"w-32 text-xs border border-slate-300 rounded px-2 py-1.5"}),e.jsx("p",{className:"text-[10px] text-slate-500 mt-1",children:"Hard ceiling — once exceeded, remaining AI checks for the audit are skipped."})]}),e.jsxs("fieldset",{className:"border border-slate-200 rounded p-3",children:[e.jsx("legend",{className:"text-xs font-medium px-1",children:"Checks to run"}),e.jsxs("div",{className:"space-y-1.5 text-xs",children:[e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",checked:t.enabledChecks.altText,onChange:u=>p({altText:u.target.checked}),disabled:!t.enabled}),e.jsxs("span",{children:[e.jsx("strong",{children:"Alt text"})," — verify every image's alt accurately describes it (vision call, ~$0.005 each)"]})]}),e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",checked:t.enabledChecks.headings,onChange:u=>p({headings:u.target.checked}),disabled:!t.enabled}),e.jsxs("span",{children:[e.jsx("strong",{children:"Headings"})," — judge whether headings describe their sections (text-only, cheap)"]})]}),e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",checked:t.enabledChecks.sensory,onChange:u=>p({sensory:u.target.checked}),disabled:!t.enabled}),e.jsxs("span",{children:[e.jsx("strong",{children:"Sensory language"}),' — flag instructions like "click the round button" (text-only, cheap)']})]}),e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",checked:t.enabledChecks.aria,onChange:u=>p({aria:u.target.checked}),disabled:!t.enabled}),e.jsxs("span",{children:[e.jsx("strong",{children:"ARIA semantics"})," — verify role= attributes match element behavior (more expensive; opt-in)"]})]}),e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",checked:t.enabledChecks.imageOfText,onChange:u=>p({imageOfText:u.target.checked}),disabled:!t.enabled}),e.jsxs("span",{children:[e.jsx("strong",{children:"Images of text"})," (WCAG 1.4.5) — flag banner / share-card / infographic images that bake text into the raster (vision; capped to ",t.imageOfTextMaxImages," largest images / audit)"]})]}),e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",checked:t.enabledChecks.colorOnlyMeaning,onChange:u=>p({colorOnlyMeaning:u.target.checked}),disabled:!t.enabled}),e.jsxs("span",{children:[e.jsx("strong",{children:"Color-only meaning"})," (WCAG 1.4.1) — flag status indicators / icons / instructions where only color conveys meaning (vision call)"]})]}),e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",checked:t.enabledChecks.genericLinkText,onChange:u=>p({genericLinkText:u.target.checked}),disabled:!t.enabled}),e.jsxs("span",{children:[e.jsx("strong",{children:"Generic link text"}),` (WCAG 2.4.4) — flag "click here"-style links where surrounding context doesn't clarify the destination (text-only, cheap)`]})]}),e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",checked:t.enabledChecks.wallOfText,onChange:u=>p({wallOfText:u.target.checked}),disabled:!t.enabled}),e.jsxs("span",{children:[e.jsx("strong",{children:"Wall of text"})," (WCAG 3.1.5) — flag long-form content with no subheadings, lists, or paragraph breaks (text-only, cheap)"]})]}),e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",checked:t.enabledChecks.languageMismatch,onChange:u=>p({languageMismatch:u.target.checked}),disabled:!t.enabled}),e.jsxs("span",{children:[e.jsx("strong",{children:"Language mismatch"})," (WCAG 3.1.1 / 3.1.2) — flag content that doesn't match the declared ",e.jsx("code",{children:"lang"})," attribute (text-only, cheap)"]})]})]})]}),e.jsxs("fieldset",{className:"border border-slate-200 rounded p-3",children:[e.jsx("legend",{className:"text-xs font-medium px-1",children:"Connection test"}),e.jsx("p",{className:"text-[11px] text-slate-500 mb-2",children:"Fires a 5-token call to your provider to confirm the key authenticates and the account is funded. Costs ≈ $0.0001."}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button",onClick:()=>void g(),disabled:!t.apiKey||l,className:"text-xs px-3 py-1 border border-slate-300 rounded hover:bg-slate-50 disabled:opacity-50",children:l?"Testing…":"Test connection"}),d&&e.jsxs("span",{className:`text-[11px] ${d.ok?"text-emerald-700":"text-rose-700"}`,children:[d.ok?"✓ ":"✗ ",d.message]})]})]}),e.jsxs("fieldset",{className:"border border-slate-200 rounded p-3",children:[e.jsx("legend",{className:"text-xs font-medium px-1",children:"Local usage"}),e.jsxs("p",{className:"text-[11px] text-slate-500 mb-2",children:["Tracked locally per audit. Providers don't expose live balance via API, so check"," ",e.jsx("a",{href:"https://console.anthropic.com/settings/billing",target:"_blank",rel:"noopener noreferrer",className:"text-brand-700 underline",children:"console.anthropic.com → Plans & Billing"})," ","for your real balance."]}),c&&c.totalAudits===0&&e.jsx("p",{className:"text-[11px] text-slate-500 italic",children:"No AI-augmented audits recorded yet."}),c&&c.totalAudits>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"grid grid-cols-3 gap-2 text-xs",children:[e.jsxs("div",{className:"border border-slate-200 rounded p-2",children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wide text-slate-500",children:"All-time spent"}),e.jsxs("div",{className:"font-semibold text-slate-800",children:["$",c.totalSpentUsd.toFixed(4)]}),e.jsxs("div",{className:"text-[10px] text-slate-500",children:[c.totalAudits," audit",c.totalAudits===1?"":"s"]})]}),e.jsxs("div",{className:"border border-slate-200 rounded p-2",children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wide text-slate-500",children:"This month"}),e.jsxs("div",{className:"font-semibold text-slate-800",children:["$",c.spentThisMonthUsd.toFixed(4)]}),e.jsxs("div",{className:"text-[10px] text-slate-500",children:[c.auditsThisMonth," audit",c.auditsThisMonth===1?"":"s"]})]}),e.jsxs("div",{className:"border border-slate-200 rounded p-2",children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wide text-slate-500",children:"Avg / audit"}),e.jsx("div",{className:"font-semibold text-slate-800",children:c.averageCostUsd!=null?`$${c.averageCostUsd.toFixed(4)}`:"—"})]})]}),e.jsxs("details",{children:[e.jsx("summary",{className:"text-[11px] cursor-pointer text-slate-600",children:"By check type"}),e.jsx("ul",{className:"mt-1 text-[11px] text-slate-700",children:Object.entries(c.byCheck).map(([u,f])=>e.jsxs("li",{className:"flex items-center justify-between py-0.5",children:[e.jsx("code",{className:"font-mono",children:u}),e.jsxs("span",{children:["$",(f??0).toFixed(4)]})]},u))})]}),e.jsxs("details",{children:[e.jsx("summary",{className:"text-[11px] cursor-pointer text-slate-600",children:"Recent audits (last 10)"}),e.jsxs("table",{className:"mt-1 w-full text-[11px]",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-slate-500 text-left",children:[e.jsx("th",{className:"py-0.5 pr-2 font-medium",children:"When"}),e.jsx("th",{className:"py-0.5 pr-2 font-medium",children:"Target"}),e.jsx("th",{className:"py-0.5 pr-2 font-medium text-right",children:"Cost"}),e.jsx("th",{className:"py-0.5 font-medium text-right",children:"Findings"})]})}),e.jsx("tbody",{children:c.recent.map((u,f)=>e.jsxs("tr",{className:"border-t border-slate-100",children:[e.jsx("td",{className:"py-0.5 pr-2 text-slate-600",children:new Date(u.at).toLocaleDateString()}),e.jsx("td",{className:"py-0.5 pr-2 text-slate-700 truncate max-w-[180px]",title:u.pageUrl,children:u.pageUrl}),e.jsxs("td",{className:"py-0.5 pr-2 text-right font-mono",children:["$",u.totalCostUsd.toFixed(4),u.capExceeded&&e.jsx("span",{className:"text-amber-700 ml-1",title:"Cost cap exceeded",children:"⚠"}),u.failureReason&&e.jsx("span",{className:"text-red-700 ml-1",title:`AI failure: ${u.failureReason}`,children:"✗"})]}),e.jsx("td",{className:"py-0.5 text-right",children:u.findingsCount})]},f))})]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{type:"button",onClick:()=>void j(),className:"text-[11px] text-slate-500 hover:text-rose-600 underline-offset-2 hover:underline",children:"Clear local usage log"})})]})]})]}):e.jsx("div",{className:"text-xs text-slate-500",children:"Loading…"})}function js(){const[t,s]=i.useState(null),[a,r]=i.useState("free"),[,o]=i.useState(0);i.useEffect(()=>{T({type:"SETTINGS_GET_ALL"}).then(l=>{const h=l.data??{};s({stateMatrix:h.stateMatrix??te,componentIdAliases:h.componentIdAliases??{}})}),T({type:"TIER_GET"}).then(l=>r(l.tier)),Ze().then(()=>o(l=>l+1)).then(()=>et()).then(()=>o(l=>l+1)).catch(()=>{})},[]);function x(l){t&&(s({...t,stateMatrix:l}),C({type:"SETTINGS_SET",key:"stateMatrix",value:l}))}function c(l){if(!t)return;const h=new Set(l.map(g=>g.id)),b=t.stateMatrix.breakpoints.filter(g=>h.has(g));x({...t.stateMatrix,breakpointPresets:l,breakpoints:b.length>0?b:l[0]?[l[0].id]:[]})}function n(l){t&&(s({...t,componentIdAliases:l}),C({type:"SETTINGS_SET",key:"componentIdAliases",value:l}))}function d(){t&&(typeof confirm=="function"&&!confirm("Reset state matrix to defaults?")||x(te))}if(!t)return e.jsx("div",{className:"p-8 text-sm text-slate-500",children:"Loading…"});const m=a==="free";return e.jsxs("div",{className:"max-w-2xl mx-auto p-3 sm:p-6 space-y-6 text-sm",children:[e.jsxs("header",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-semibold",children:"Settings"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Changes are saved automatically. Close this tab to return to the audit panel."})]}),e.jsx("button",{type:"button",onClick:()=>{window.close()},className:"text-xs px-3 py-1.5 bg-brand-500 text-white rounded hover:bg-brand-600 shrink-0",children:"Done"})]}),e.jsx("main",{"aria-label":"Settings",children:e.jsxs(wt,{defaultValue:"audit",className:"space-y-4",children:[e.jsx(Tt,{className:"flex flex-wrap gap-1 border-b border-slate-200","aria-label":"Settings categories",children:[{value:"audit",label:"Audit"},{value:"integrations",label:"Integrations"},{value:"account",label:"Account"},{value:"advanced",label:"Advanced"}].map(l=>e.jsx(Ct,{value:l.value,className:"text-xs px-3 py-1.5 text-slate-600 hover:text-slate-900 data-[state=active]:text-brand-700 data-[state=active]:border-b-2 data-[state=active]:border-brand-500 -mb-px",children:l.label},l.value))}),e.jsxs($,{value:"audit",className:"space-y-8 pt-2",children:[e.jsxs("section",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"State matrix"}),e.jsx("button",{onClick:d,className:"text-xs text-slate-500 hover:text-slate-900",children:"Reset to defaults"})]}),e.jsx("p",{className:"text-xs text-slate-500",children:"Which states each audit covers. Larger matrix = more coverage but slower runs."}),m&&e.jsx("div",{className:"text-xs bg-amber-50 border border-amber-200 rounded p-2 text-amber-900",children:"Free tier audits the default state only — your matrix selections below will be ignored until you upgrade."}),e.jsx(Rt,{value:t.stateMatrix,onChange:x})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"Breakpoint presets"}),e.jsx("p",{className:"text-xs text-slate-500",children:"Customize widths/heights and add your own breakpoints. Toggle which ones audit under in the State matrix section above."}),e.jsx(qt,{presets:t.stateMatrix.breakpointPresets,onChange:c})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"Disabled rules"}),e.jsx(is,{})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"Component identity aliases"}),e.jsx("p",{className:"text-xs text-slate-500",children:"Map two component IDs to the same canonical ID — useful when the same component is identified differently across pages."}),e.jsx(_t,{value:t.componentIdAliases,onChange:n})]})]}),e.jsxs($,{value:"integrations",className:"space-y-8 pt-2",children:[e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"GitHub issue tracker"}),e.jsx(ds,{})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"Jira issue tracker"}),e.jsx(xs,{})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"Azure DevOps tracker"}),e.jsx(hs,{})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"GitLab issue tracker"}),e.jsx(fs,{})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"Cloud sync (baselines)"}),e.jsx(gs,{})]})]}),e.jsxs($,{value:"account",className:"space-y-8 pt-2",children:[e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"User mode"}),e.jsx(ys,{})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"License"}),e.jsx(Ht,{tier:a,onTierChange:r})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"Crash reporting"}),e.jsx(Xt,{})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"AI augmentation"}),e.jsx(vs,{})]})]}),e.jsxs($,{value:"advanced",className:"space-y-8 pt-2",children:[e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"Remediation trail"}),e.jsx("p",{className:"text-xs text-slate-500",children:"Build a defensible record by automatically saving every audit as a dated, anchored report. Useful for pre-litigation / demand-letter defense and for procurement evidence."}),e.jsx(ts,{})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"Report download behavior"}),e.jsx("p",{className:"text-xs text-slate-500",children:"Defense / evidence bundles default to a confirmation prompt before downloading. Power users who export many bundles can skip the prompt here."}),e.jsx(Zt,{})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"Performance"}),e.jsx(ss,{})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"Custom rules"}),e.jsx(ls,{})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"Team"}),e.jsx("p",{className:"text-xs text-slate-500",children:"For Team plans: see every device that's claimed a seat under this license, and revoke any of them. The license token itself authenticates this section — anyone with the token can manage seats."}),e.jsx(rs,{})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"Import / export"}),e.jsx("p",{className:"text-xs text-slate-500",children:"Share matrix + alias config with your team, or back up before major changes."}),e.jsx(Qt,{stateMatrix:t.stateMatrix,componentIdAliases:t.componentIdAliases,onImport:l=>s(l)})]})]})]})}),e.jsx(Ve,{})]})}const Ue=document.getElementById("root");if(!Ue)throw new Error("options: #root not found");He(Ue).render(e.jsx(D.StrictMode,{children:e.jsx(js,{})}));
|
|
6
|
+
landmark-one-main`,className:"w-full text-xs font-mono border border-slate-300 rounded p-2 resize-y"}),o&&e.jsxs("p",{className:"text-[11px] text-slate-500",children:["Saved at ",new Date(o).toLocaleTimeString(),"."]}),e.jsxs("p",{className:"text-[11px] text-slate-500",children:["Full rule list:"," ",e.jsx("a",{href:"https://github.com/dequelabs/axe-core/blob/develop/doc/rule-descriptions.md",target:"_blank",rel:"noreferrer",className:"text-brand-600 hover:underline",children:"axe-core/doc/rule-descriptions.md"})]})]}):e.jsx("div",{className:"text-xs text-slate-500",children:"Loading…"})}const de="githubRepoUrl",cs=/^https:\/\/github\.com\/[^/]+\/[^/]+\/?$/;function ds(){const[t,s]=i.useState(""),[a,r]=i.useState(!1),[o,x]=i.useState(null);i.useEffect(()=>{T({type:"SETTINGS_GET",key:de}).then(n=>{const d=typeof n.data=="string"?n.data:"";s(d),r(!0)})},[]);function c(n){const d=n.trim().replace(/\/$/,"");if(d.length>0&&!cs.test(d+"/")){x("Expected format: https://github.com/owner/repo");return}x(null),C({type:"SETTINGS_SET",key:de,value:d})}return a?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs text-slate-500",children:'Paste your repository URL to enable "File GitHub issue" buttons in the Delta view. Issues are opened in a new tab with title and body pre-filled — you confirm and submit on GitHub.'}),e.jsx("input",{type:"url",value:t,onChange:n=>s(n.target.value),onBlur:n=>c(n.target.value),placeholder:"https://github.com/owner/repo",className:"w-full text-xs font-mono border border-slate-300 rounded px-2 py-1.5"}),o&&e.jsx("p",{className:"text-[11px] text-rose-600",children:o})]}):e.jsx("div",{className:"text-xs text-slate-500",children:"Loading…"})}const ue="jiraInstanceUrl",us=/^https:\/\/[^/]+\.atlassian\.net\/?$/;function xs(){const[t,s]=i.useState(""),[a,r]=i.useState(!1),[o,x]=i.useState(null);i.useEffect(()=>{T({type:"SETTINGS_GET",key:ue}).then(n=>{const d=typeof n.data=="string"?n.data:"";s(d),r(!0)})},[]);function c(n){const d=n.trim().replace(/\/$/,"");if(d.length>0&&!us.test(d+"/")){x("Expected format: https://your-team.atlassian.net");return}x(null),C({type:"SETTINGS_SET",key:ue,value:d})}return a?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs text-slate-500",children:'Paste your Jira Cloud instance URL to enable "File Jira issue" in the Delta view. Issues open in a new tab pre-filled — you confirm and submit on Jira.'}),e.jsx("input",{type:"url",value:t,onChange:n=>s(n.target.value),onBlur:n=>c(n.target.value),placeholder:"https://your-team.atlassian.net",className:"w-full text-xs font-mono border border-slate-300 rounded px-2 py-1.5"}),o&&e.jsx("p",{className:"text-[11px] text-rose-600",children:o})]}):e.jsx("div",{className:"text-xs text-slate-500",children:"Loading…"})}const xe="azureDevOpsProjectUrl",ms=/^https?:\/\/[^/]+\/[^/]+\/[^/]+\/?$/;function hs(){const[t,s]=i.useState(""),[a,r]=i.useState(!1),[o,x]=i.useState(null);i.useEffect(()=>{T({type:"SETTINGS_GET",key:xe}).then(n=>{const d=typeof n.data=="string"?n.data:"";s(d),r(!0)})},[]);function c(n){const d=n.trim().replace(/\/$/,"");if(d.length>0&&!ms.test(d+"/")){x("Expected format: https://dev.azure.com/org/project");return}x(null),C({type:"SETTINGS_SET",key:xe,value:d})}return a?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs text-slate-500",children:'Paste your Azure DevOps project URL to enable "File Azure DevOps work item" buttons in the Delta view. The new-work-item form opens in a new tab with title and description pre-filled — you pick the work-item type and submit on Azure DevOps.'}),e.jsx("input",{type:"url",value:t,onChange:n=>s(n.target.value),onBlur:n=>c(n.target.value),placeholder:"https://dev.azure.com/myorg/myproject",className:"w-full text-xs font-mono border border-slate-300 rounded px-2 py-1.5"}),o&&e.jsx("p",{className:"text-[11px] text-rose-600",children:o})]}):e.jsx("div",{className:"text-xs text-slate-500",children:"Loading…"})}const me="gitlabProjectUrl",ps=/^https?:\/\/[^/]+\/[^/]+(\/[^/]+)+\/?$/;function fs(){const[t,s]=i.useState(""),[a,r]=i.useState(!1),[o,x]=i.useState(null);i.useEffect(()=>{T({type:"SETTINGS_GET",key:me}).then(n=>{const d=typeof n.data=="string"?n.data:"";s(d),r(!0)})},[]);function c(n){const d=n.trim().replace(/\/$/,"");if(d.length>0&&!ps.test(d+"/")){x("Expected format: https://gitlab.com/group/project (or self-hosted)");return}x(null),C({type:"SETTINGS_SET",key:me,value:d})}return a?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs text-slate-500",children:'Paste your GitLab project URL to enable "File GitLab issue" buttons in the Delta view. Issues are opened in a new tab with title and description pre-filled — you confirm and submit on GitLab.'}),e.jsx("input",{type:"url",value:t,onChange:n=>s(n.target.value),onBlur:n=>c(n.target.value),placeholder:"https://gitlab.com/group/project",className:"w-full text-xs font-mono border border-slate-300 rounded px-2 py-1.5"}),o&&e.jsx("p",{className:"text-[11px] text-rose-600",children:o})]}):e.jsx("div",{className:"text-xs text-slate-500",children:"Loading…"})}const he="cloudSyncEnabled",pe="cloudSyncEndpoint",bs="https://api.wcagcheckr.com";function gs(){const[t,s]=i.useState(!1),[a,r]=i.useState(bs),[o,x]=i.useState(!1),[c,n]=i.useState(!1),[d,m]=i.useState(null);i.useEffect(()=>{Promise.all([T({type:"SETTINGS_GET",key:he}),T({type:"SETTINGS_GET",key:pe})]).then(([g,j])=>{s(g.data===!0),typeof j.data=="string"&&j.data&&r(j.data),x(!0)})},[]);function l(g){s(g),C({type:"SETTINGS_SET",key:he,value:g})}function h(g){const j=g.trim().replace(/\/$/,"");r(j),C({type:"SETTINGS_SET",key:pe,value:j})}async function b(){n(!0),m(null);try{const g="To pull baselines now, reload the extension at chrome://extensions. The service worker pulls on every start.";m(g),_.polite(g)}finally{n(!1)}}return o?e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-xs text-slate-500",children:"Sync baselines across devices via your license. Disabled by default — local-first storage means the extension works fully offline. Cloud is mirror, not source of truth on the local machine."}),e.jsxs("label",{className:"flex items-center gap-2 text-xs",children:[e.jsx("input",{type:"checkbox",checked:t,onChange:g=>l(g.target.checked)}),e.jsx("span",{children:"Enable cloud sync"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-slate-500 block mb-1",children:"Sync endpoint"}),e.jsx("input",{type:"url",value:a,onChange:g=>r(g.target.value),onBlur:g=>h(g.target.value),disabled:!t,className:"w-full text-xs font-mono border border-slate-300 rounded px-2 py-1.5 disabled:bg-slate-50 disabled:text-slate-500"}),e.jsx("p",{className:"text-[11px] text-slate-500 mt-1",children:"Default points at the WCAG Auditor cloud-sync VPS. Replace with your own server URL if you self-host the baseline endpoints."})]}),e.jsx("button",{type:"button",onClick:b,disabled:!t||c,className:"text-xs px-3 py-1 border border-slate-300 rounded hover:bg-slate-50 disabled:opacity-50",children:c?"Pulling…":"Pull now"}),d&&e.jsx("p",{className:"text-[11px] text-slate-500",children:d})]}):e.jsx("div",{className:"text-xs text-slate-500",children:"Loading…"})}function ys(){const[t,s]=i.useState("owner"),[a,r]=i.useState(!1);i.useEffect(()=>{T({type:"SETTINGS_GET",key:"userMode"}).then(x=>{const c=x.data;(c==="owner"||c==="power"||c==="dev")&&s(c),r(!0)})},[]);function o(x){s(x),C({type:"SETTINGS_SET",key:"userMode",value:x}),chrome.storage.local.set({v2UiEnabled:x==="power"})}return a?e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-xs text-slate-500",children:"Sets your preferred default view. You can also flip between modes any time using the persona switcher pinned to the top of the side panel — your choice here is the one the extension opens to on next launch."}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsx(J,{active:t==="owner",icon:"🏪",label:"Owner",desc:"Focuses on the specific issues demand-letter mills flag, with plain-language fix recipes. Goal: get off the lawsuit-bot radar.",onClick:()=>o("owner")}),e.jsx(J,{active:t==="power",icon:"⚡",label:"Power user",desc:"Compliance verdict + full audit findings without granular surfaces. For people who want the answer, not the deep dive.",onClick:()=>o("power")}),e.jsx(J,{active:t==="dev",icon:"⚙️",label:"Dev",desc:"Everything — multi-state matrix, baselines + delta, all exports, all specialized views (forensic log, schedules, ax-tree, etc.).",onClick:()=>o("dev")})]})]}):e.jsx("div",{className:"text-xs text-slate-500",children:"Loading…"})}function J({active:t,icon:s,label:a,desc:r,onClick:o}){return e.jsx("button",{type:"button",onClick:o,className:`text-left rounded p-3 border transition-colors ${t?"border-brand-500 bg-brand-50 ring-2 ring-brand-500/30":"border-slate-300 bg-white hover:border-slate-400 hover:bg-slate-50"}`,children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-lg","aria-hidden":"true",children:s}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-xs",children:a}),e.jsx("div",{className:"text-[11px] text-slate-500 leading-snug mt-0.5",children:r})]})]})})}const Y="aiConfig";function vs(){const[t,s]=i.useState(V),[a,r]=i.useState(!1),[o,x]=i.useState(!1),[c,n]=i.useState(null),[d,m]=i.useState(null),[l,h]=i.useState(!1);async function b(){n(await rt(10))}i.useEffect(()=>{b()},[]);async function g(){h(!0),m(null);try{if(!t.apiKey){m({ok:!1,message:"No API key entered yet."});return}const u=await fetch("https://api.anthropic.com/v1/messages",{method:"POST",headers:{"x-api-key":t.apiKey,"anthropic-version":"2023-06-01","content-type":"application/json","anthropic-dangerous-direct-browser-access":"true"},body:JSON.stringify({model:t.model||"claude-haiku-4-5",max_tokens:5,messages:[{role:"user",content:"ok"}]})}),f=await u.json().catch(()=>null);if(!f){m({ok:!1,message:`Provider returned no JSON (HTTP ${u.status}).`});return}if("error"in f){m({ok:!1,message:`${f.error.type}: ${f.error.message}`});return}m({ok:!0,message:`Authenticated, account funded. Test call used ${f.usage.input_tokens}+${f.usage.output_tokens} tokens (~$0.0001).`})}catch(u){m({ok:!1,message:u instanceof Error?u.message:String(u)})}finally{h(!1)}}async function j(){typeof confirm=="function"&&!confirm("Clear the local AI usage log? Provider-side billing records are unaffected.")||(await ot(),await b())}i.useEffect(()=>{T({type:"SETTINGS_GET",key:Y}).then(u=>{const f=u.data;f&&s({...V,...f,enabledChecks:{...V.enabledChecks,...f.enabledChecks??{}}}),r(!0)})},[]);function N(u){const f={...t,...u};s(f),C({type:"SETTINGS_SET",key:Y,value:f})}function p(u){const f={...t,enabledChecks:{...t.enabledChecks,...u}};s(f),C({type:"SETTINGS_SET",key:Y,value:f})}return a?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{className:"text-xs text-slate-600 leading-snug",children:[e.jsx("strong",{children:"AI is optional."})," Audits run fine without it — axe-core, DOM analyzers, the state-matrix iteration, and the PDF structural pass all execute regardless of this setting. With AI enabled, the audit adds a semantic-quality layer that catches problems the structural checks can't see: alt-text that's present but generic (“image”, “figure 1”), headings that don't describe their section (“Section 1”), form labels that don't convey purpose (“Field 1”), color-only meaning, sensory-language instructions (“click the green button”), and similar judgments that need human-like reading."]}),e.jsxs("p",{className:"text-xs text-slate-600 leading-snug",children:[e.jsx("strong",{children:"You bring your own key"})," — Anthropic Claude today; OpenAI + Gemini are stubbed for later. The key is stored in ",e.jsx("code",{children:"chrome.storage.local"})," on this device only and is sent only to the provider you select. Per-audit cost is hard-capped below; at default settings, a typical audit costs ~$0.02–$0.10."]}),e.jsx("p",{className:"text-xs text-slate-500 italic leading-snug",children:"If you skip this, the side panel shows a clear “AI didn't run” banner after every audit listing what was skipped, so you always know what you're seeing versus what AI would have added."}),e.jsxs("label",{className:"flex items-center gap-2 text-xs",children:[e.jsx("input",{type:"checkbox",checked:t.enabled,onChange:u=>N({enabled:u.target.checked})}),e.jsx("span",{children:e.jsx("strong",{children:"Enable AI augmentation"})})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"ai-provider",className:"block text-xs text-slate-500 mb-1",children:"Provider"}),e.jsxs("select",{id:"ai-provider",value:t.provider,onChange:u=>N({provider:u.target.value}),disabled:!t.enabled,className:"text-xs border border-slate-300 rounded px-2 py-1.5",children:[e.jsx("option",{value:"anthropic",children:"Anthropic (Claude)"}),e.jsx("option",{value:"openai",children:"OpenAI (GPT) — coming soon"}),e.jsx("option",{value:"gemini",children:"Google (Gemini) — coming soon"})]})]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"ai-key",className:"block text-xs text-slate-500 mb-1",children:["API key",e.jsx("span",{className:"text-[10px] text-slate-400 ml-2",children:"stored locally; never sent anywhere except your chosen provider"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{id:"ai-key",type:o?"text":"password",value:t.apiKey,onChange:u=>N({apiKey:u.target.value.trim()}),disabled:!t.enabled,placeholder:"sk-ant-…",className:"flex-1 text-xs font-mono border border-slate-300 rounded px-2 py-1.5"}),e.jsx("button",{type:"button",onClick:()=>x(!o),className:"text-[11px] px-2 border border-slate-300 rounded hover:bg-slate-50",children:o?"Hide":"Show"})]})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"ai-model",className:"block text-xs text-slate-500 mb-1",children:"Model override (optional)"}),e.jsx("input",{id:"ai-model",type:"text",value:t.model??"",onChange:u=>N({model:u.target.value.trim()}),disabled:!t.enabled,placeholder:"claude-3-5-sonnet-20241022 (default)",className:"w-full text-xs font-mono border border-slate-300 rounded px-2 py-1.5"}),e.jsx("p",{className:"text-[10px] text-slate-500 mt-1",children:"Leave blank for provider default. Use a haiku-class model for cheap-fast checks."})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"ai-cap",className:"block text-xs text-slate-500 mb-1",children:"Per-audit cost cap (USD)"}),e.jsx("input",{id:"ai-cap",type:"number",step:.5,min:0,value:t.costCapUsd,onChange:u=>N({costCapUsd:Math.max(0,parseFloat(u.target.value)||0)}),disabled:!t.enabled,className:"w-32 text-xs border border-slate-300 rounded px-2 py-1.5"}),e.jsx("p",{className:"text-[10px] text-slate-500 mt-1",children:"Hard ceiling — once exceeded, remaining AI checks for the audit are skipped."})]}),e.jsxs("fieldset",{className:"border border-slate-200 rounded p-3",children:[e.jsx("legend",{className:"text-xs font-medium px-1",children:"Checks to run"}),e.jsxs("div",{className:"space-y-1.5 text-xs",children:[e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",checked:t.enabledChecks.altText,onChange:u=>p({altText:u.target.checked}),disabled:!t.enabled}),e.jsxs("span",{children:[e.jsx("strong",{children:"Alt text"})," — verify every image's alt accurately describes it (vision call, ~$0.005 each)"]})]}),e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",checked:t.enabledChecks.headings,onChange:u=>p({headings:u.target.checked}),disabled:!t.enabled}),e.jsxs("span",{children:[e.jsx("strong",{children:"Headings"})," — judge whether headings describe their sections (text-only, cheap)"]})]}),e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",checked:t.enabledChecks.sensory,onChange:u=>p({sensory:u.target.checked}),disabled:!t.enabled}),e.jsxs("span",{children:[e.jsx("strong",{children:"Sensory language"}),' — flag instructions like "click the round button" (text-only, cheap)']})]}),e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",checked:t.enabledChecks.aria,onChange:u=>p({aria:u.target.checked}),disabled:!t.enabled}),e.jsxs("span",{children:[e.jsx("strong",{children:"ARIA semantics"})," — verify role= attributes match element behavior (more expensive; opt-in)"]})]}),e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",checked:t.enabledChecks.imageOfText,onChange:u=>p({imageOfText:u.target.checked}),disabled:!t.enabled}),e.jsxs("span",{children:[e.jsx("strong",{children:"Images of text"})," (WCAG 1.4.5) — flag banner / share-card / infographic images that bake text into the raster (vision; capped to ",t.imageOfTextMaxImages," largest images / audit)"]})]}),e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",checked:t.enabledChecks.colorOnlyMeaning,onChange:u=>p({colorOnlyMeaning:u.target.checked}),disabled:!t.enabled}),e.jsxs("span",{children:[e.jsx("strong",{children:"Color-only meaning"})," (WCAG 1.4.1) — flag status indicators / icons / instructions where only color conveys meaning (vision call)"]})]}),e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",checked:t.enabledChecks.genericLinkText,onChange:u=>p({genericLinkText:u.target.checked}),disabled:!t.enabled}),e.jsxs("span",{children:[e.jsx("strong",{children:"Generic link text"}),` (WCAG 2.4.4) — flag "click here"-style links where surrounding context doesn't clarify the destination (text-only, cheap)`]})]}),e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",checked:t.enabledChecks.wallOfText,onChange:u=>p({wallOfText:u.target.checked}),disabled:!t.enabled}),e.jsxs("span",{children:[e.jsx("strong",{children:"Wall of text"})," (WCAG 3.1.5) — flag long-form content with no subheadings, lists, or paragraph breaks (text-only, cheap)"]})]}),e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",checked:t.enabledChecks.languageMismatch,onChange:u=>p({languageMismatch:u.target.checked}),disabled:!t.enabled}),e.jsxs("span",{children:[e.jsx("strong",{children:"Language mismatch"})," (WCAG 3.1.1 / 3.1.2) — flag content that doesn't match the declared ",e.jsx("code",{children:"lang"})," attribute (text-only, cheap)"]})]})]})]}),e.jsxs("fieldset",{className:"border border-slate-200 rounded p-3",children:[e.jsx("legend",{className:"text-xs font-medium px-1",children:"Connection test"}),e.jsx("p",{className:"text-[11px] text-slate-500 mb-2",children:"Fires a 5-token call to your provider to confirm the key authenticates and the account is funded. Costs ≈ $0.0001."}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button",onClick:()=>void g(),disabled:!t.apiKey||l,className:"text-xs px-3 py-1 border border-slate-300 rounded hover:bg-slate-50 disabled:opacity-50",children:l?"Testing…":"Test connection"}),d&&e.jsxs("span",{className:`text-[11px] ${d.ok?"text-emerald-700":"text-rose-700"}`,children:[d.ok?"✓ ":"✗ ",d.message]})]})]}),e.jsxs("fieldset",{className:"border border-slate-200 rounded p-3",children:[e.jsx("legend",{className:"text-xs font-medium px-1",children:"Local usage"}),e.jsxs("p",{className:"text-[11px] text-slate-500 mb-2",children:["Tracked locally per audit. Providers don't expose live balance via API, so check"," ",e.jsx("a",{href:"https://console.anthropic.com/settings/billing",target:"_blank",rel:"noopener noreferrer",className:"text-brand-700 underline",children:"console.anthropic.com → Plans & Billing"})," ","for your real balance."]}),c&&c.totalAudits===0&&e.jsx("p",{className:"text-[11px] text-slate-500 italic",children:"No AI-augmented audits recorded yet."}),c&&c.totalAudits>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"grid grid-cols-3 gap-2 text-xs",children:[e.jsxs("div",{className:"border border-slate-200 rounded p-2",children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wide text-slate-500",children:"All-time spent"}),e.jsxs("div",{className:"font-semibold text-slate-800",children:["$",c.totalSpentUsd.toFixed(4)]}),e.jsxs("div",{className:"text-[10px] text-slate-500",children:[c.totalAudits," audit",c.totalAudits===1?"":"s"]})]}),e.jsxs("div",{className:"border border-slate-200 rounded p-2",children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wide text-slate-500",children:"This month"}),e.jsxs("div",{className:"font-semibold text-slate-800",children:["$",c.spentThisMonthUsd.toFixed(4)]}),e.jsxs("div",{className:"text-[10px] text-slate-500",children:[c.auditsThisMonth," audit",c.auditsThisMonth===1?"":"s"]})]}),e.jsxs("div",{className:"border border-slate-200 rounded p-2",children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wide text-slate-500",children:"Avg / audit"}),e.jsx("div",{className:"font-semibold text-slate-800",children:c.averageCostUsd!=null?`$${c.averageCostUsd.toFixed(4)}`:"—"})]})]}),e.jsxs("details",{children:[e.jsx("summary",{className:"text-[11px] cursor-pointer text-slate-600",children:"By check type"}),e.jsx("ul",{className:"mt-1 text-[11px] text-slate-700",children:Object.entries(c.byCheck).map(([u,f])=>e.jsxs("li",{className:"flex items-center justify-between py-0.5",children:[e.jsx("code",{className:"font-mono",children:u}),e.jsxs("span",{children:["$",(f??0).toFixed(4)]})]},u))})]}),e.jsxs("details",{children:[e.jsx("summary",{className:"text-[11px] cursor-pointer text-slate-600",children:"Recent audits (last 10)"}),e.jsxs("table",{className:"mt-1 w-full text-[11px]",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-slate-500 text-left",children:[e.jsx("th",{className:"py-0.5 pr-2 font-medium",children:"When"}),e.jsx("th",{className:"py-0.5 pr-2 font-medium",children:"Target"}),e.jsx("th",{className:"py-0.5 pr-2 font-medium text-right",children:"Cost"}),e.jsx("th",{className:"py-0.5 font-medium text-right",children:"Findings"})]})}),e.jsx("tbody",{children:c.recent.map((u,f)=>e.jsxs("tr",{className:"border-t border-slate-100",children:[e.jsx("td",{className:"py-0.5 pr-2 text-slate-600",children:new Date(u.at).toLocaleDateString()}),e.jsx("td",{className:"py-0.5 pr-2 text-slate-700 truncate max-w-[180px]",title:u.pageUrl,children:u.pageUrl}),e.jsxs("td",{className:"py-0.5 pr-2 text-right font-mono",children:["$",u.totalCostUsd.toFixed(4),u.capExceeded&&e.jsx("span",{className:"text-amber-700 ml-1",title:"Cost cap exceeded",children:"⚠"}),u.failureReason&&e.jsx("span",{className:"text-red-700 ml-1",title:`AI failure: ${u.failureReason}`,children:"✗"})]}),e.jsx("td",{className:"py-0.5 text-right",children:u.findingsCount})]},f))})]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{type:"button",onClick:()=>void j(),className:"text-[11px] text-slate-500 hover:text-rose-600 underline-offset-2 hover:underline",children:"Clear local usage log"})})]})]})]}):e.jsx("div",{className:"text-xs text-slate-500",children:"Loading…"})}function js(){const[t,s]=i.useState(null),[a,r]=i.useState("free"),[,o]=i.useState(0);i.useEffect(()=>{T({type:"SETTINGS_GET_ALL"}).then(l=>{const h=l.data??{};s({stateMatrix:h.stateMatrix??te,componentIdAliases:h.componentIdAliases??{}})}),T({type:"TIER_GET"}).then(l=>r(l.tier)),Ze().then(()=>o(l=>l+1)).then(()=>et()).then(()=>o(l=>l+1)).catch(()=>{})},[]);function x(l){t&&(s({...t,stateMatrix:l}),C({type:"SETTINGS_SET",key:"stateMatrix",value:l}))}function c(l){if(!t)return;const h=new Set(l.map(g=>g.id)),b=t.stateMatrix.breakpoints.filter(g=>h.has(g));x({...t.stateMatrix,breakpointPresets:l,breakpoints:b.length>0?b:l[0]?[l[0].id]:[]})}function n(l){t&&(s({...t,componentIdAliases:l}),C({type:"SETTINGS_SET",key:"componentIdAliases",value:l}))}function d(){t&&(typeof confirm=="function"&&!confirm("Reset state matrix to defaults?")||x(te))}if(!t)return e.jsx("div",{className:"p-8 text-sm text-slate-500",children:"Loading…"});const m=a==="free";return e.jsxs("div",{className:"max-w-2xl mx-auto p-3 sm:p-6 space-y-6 text-sm",children:[e.jsxs("header",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-semibold",children:"Settings"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Changes are saved automatically. Close this tab to return to the audit panel."})]}),e.jsx("button",{type:"button",onClick:()=>{window.close()},className:"text-xs px-3 py-1.5 bg-brand-500 text-white rounded hover:bg-brand-600 shrink-0",children:"Done"})]}),e.jsx("main",{"aria-label":"Settings",children:e.jsxs(wt,{defaultValue:"audit",className:"space-y-4",children:[e.jsx(Tt,{className:"flex flex-wrap gap-1 border-b border-slate-200","aria-label":"Settings categories",children:[{value:"audit",label:"Audit"},{value:"integrations",label:"Integrations"},{value:"account",label:"Account"},{value:"advanced",label:"Advanced"}].map(l=>e.jsx(Ct,{value:l.value,className:"text-xs px-3 py-1.5 text-slate-600 hover:text-slate-900 data-[state=active]:text-brand-700 data-[state=active]:border-b-2 data-[state=active]:border-brand-500 -mb-px",children:l.label},l.value))}),e.jsxs($,{value:"audit",className:"space-y-8 pt-2",children:[e.jsxs("section",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"State matrix"}),e.jsx("button",{onClick:d,className:"text-xs text-slate-500 hover:text-slate-900",children:"Reset to defaults"})]}),e.jsx("p",{className:"text-xs text-slate-500",children:"Which states each audit covers. Larger matrix = more coverage but slower runs."}),m&&e.jsx("div",{className:"text-xs bg-amber-50 border border-amber-200 rounded p-2 text-amber-900",children:"Free tier audits the default state only — your matrix selections below will be ignored until you upgrade."}),e.jsx(Rt,{value:t.stateMatrix,onChange:x})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"Breakpoint presets"}),e.jsx("p",{className:"text-xs text-slate-500",children:"Customize widths/heights and add your own breakpoints. Toggle which ones audit under in the State matrix section above."}),e.jsx(qt,{presets:t.stateMatrix.breakpointPresets,onChange:c})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"Disabled rules"}),e.jsx(is,{})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"Component identity aliases"}),e.jsx("p",{className:"text-xs text-slate-500",children:"Map two component IDs to the same canonical ID — useful when the same component is identified differently across pages."}),e.jsx(_t,{value:t.componentIdAliases,onChange:n})]})]}),e.jsxs($,{value:"integrations",className:"space-y-8 pt-2",children:[e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"GitHub issue tracker"}),e.jsx(ds,{})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"Jira issue tracker"}),e.jsx(xs,{})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"Azure DevOps tracker"}),e.jsx(hs,{})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"GitLab issue tracker"}),e.jsx(fs,{})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"Cloud sync (baselines)"}),e.jsx(gs,{})]})]}),e.jsxs($,{value:"account",className:"space-y-8 pt-2",children:[e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"User mode"}),e.jsx(ys,{})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"License"}),e.jsx(Ht,{tier:a,onTierChange:r})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"Crash reporting"}),e.jsx(Xt,{})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"AI augmentation"}),e.jsx(vs,{})]})]}),e.jsxs($,{value:"advanced",className:"space-y-8 pt-2",children:[e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"Remediation trail"}),e.jsx("p",{className:"text-xs text-slate-500",children:"Build a defensible record by automatically saving every audit as a dated, anchored report. Useful for pre-litigation / demand-letter defense and for procurement evidence."}),e.jsx(ts,{})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"Report download behavior"}),e.jsx("p",{className:"text-xs text-slate-500",children:"Defense / evidence bundles default to a confirmation prompt before downloading. Power users who export many bundles can skip the prompt here."}),e.jsx(Zt,{})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"Performance"}),e.jsx(ss,{})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"Custom rules"}),e.jsx(ls,{})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"Team"}),e.jsx("p",{className:"text-xs text-slate-500",children:"For Team plans: see every device that's claimed a seat under this license, and revoke any of them. The license token itself authenticates this section — anyone with the token can manage seats."}),e.jsx(rs,{})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"Import / export"}),e.jsx("p",{className:"text-xs text-slate-500",children:"Share matrix + alias config with your team, or back up before major changes."}),e.jsx(Qt,{stateMatrix:t.stateMatrix,componentIdAliases:t.componentIdAliases,onImport:l=>s(l)})]})]})]})}),e.jsx(Ve,{})]})}const Pe=document.getElementById("root");if(!Pe)throw new Error("options: #root not found");He(Pe).render(e.jsx(D.StrictMode,{children:e.jsx(js,{})}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b1 as p,b2 as g,b3 as $,b4 as v}from"./scheduled-audit-runner-
|
|
1
|
+
import{b1 as p,b2 as g,b3 as $,b4 as v}from"./scheduled-audit-runner-Dek_J9pU.js";import{k as w,c as E,h as T}from"./crash-reporter-DAZnNefT.js";import"./preload-helper-D7HrI6pR.js";import"./diff-CECbooHD.js";import"./ai-usage-log-DVzy9AU1.js";const m=E("parallel-tab-flow");async function _(s){const n=performance.now(),a=p(s.matrix),o=Math.max(1,Math.min(s.parallelism??4,8)),i=[];for(let e=0;e<o;e++)i.push([]);a.forEach((e,b)=>{i[b%o].push(e)}),m.info(`parallel-tab audit starting: ${a.length} states across ${o} tabs (~${Math.ceil(a.length/o)} states/tab)`);const r=a.length;let t=0;a[0]&&w({type:"AUDIT_PROGRESS_EVENT",current:0,total:r,currentState:a[0]});const l=e=>{t++,w({type:"AUDIT_PROGRESS_EVENT",current:t,total:r,currentState:e})},d=i.map((e,b)=>e.length===0?Promise.resolve({results:[],failed:!1}):y(s.targetUrl,s.scope,e,b,s.cancel,l)),h=await Promise.all(d),c=[];let u=0,f=0;for(const e of h)e.failed?f++:u++,c.push(...e.results);return{results:c,parallelDurationMs:performance.now()-n,tabsCompleted:u,tabsFailed:f}}async function y(s,n,a,o,i,r){let t;const l=[];try{const d=await chrome.tabs.create({url:s,active:!1});if(!d.id)throw new Error("chrome.tabs.create returned no id");if(t=d.id,m.debug(`worker ${o}: opened tab ${t}`),await U(t),i.isCanceled())throw new Error("canceled");const h=await g(t,0);if(!h.ok)throw new Error(`content script unreachable: ${h.reason}`);for(let c=0;c<a.length&&!i.isCanceled();c++){const u=a[c];try{if(!(await $(t,u,n)).success){m.warn(`worker ${o} state ${c+1}/${a.length} drive failed`),r==null||r(u);continue}const e=await T(t,{type:"AUDIT_REQUEST",selector:n,currentState:u});e.success&&e.result&&l.push({...e.result,violations:e.result.violations})}catch(f){m.debug(`worker ${o} state ${c+1} error`,f)}finally{r==null||r(u)}}try{await v(t,n)}catch{}return{results:l,failed:!1}}catch(d){return m.warn(`worker ${o} failed`,d),{results:l,failed:!0}}finally{if(t!==void 0)try{await chrome.tabs.remove(t)}catch{}}}function U(s,n=3e4){return new Promise((a,o)=>{const i=setTimeout(()=>{chrome.tabs.onUpdated.removeListener(r),o(new Error(`tab ${s} load timed out after ${n}ms`))},n),r=(t,l)=>{t===s&&l.status==="complete"&&(clearTimeout(i),chrome.tabs.onUpdated.removeListener(r),a())};chrome.tabs.onUpdated.addListener(r),chrome.tabs.get(s).then(t=>{t.status==="complete"&&(clearTimeout(i),chrome.tabs.onUpdated.removeListener(r),a())})})}export{_ as runParallelTabAudit};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as t,n as i,o as e,aX as n}from"./scheduled-audit-runner-
|
|
1
|
+
import{m as t,n as i,o as e,aX as n}from"./scheduled-audit-runner-Dek_J9pU.js";import{c as o}from"./crash-reporter-DAZnNefT.js";const c=o("rubric-config-client"),f="wcagcheckr",u=`https://api.wcagcheckr.com/v1/products/${f}/rubrics`,h=1e4,s="rubric-config-refresh",d=60;async function R(){const r=await t();if(!r){e(null);return}if(i(r)==="expired"){c.warn("cached rubrics are expired (>7d); falling back to bundled defaults"),e(null);return}e(r.config)}async function g(){try{const r=await fetch(u,{signal:AbortSignal.timeout(h),headers:{accept:"application/json"}});if(!r.ok)throw new Error(`http ${r.status}`);const a=await r.json();await n({fetchedAt:Date.now(),config:a}),e(a),c.info("rubrics refreshed from server")}catch(r){c.warn("rubric refresh failed; keeping prior cache",r)}}function b(){chrome.alarms.create(s,{periodInMinutes:d}),chrome.alarms.onAlarm.addListener(r=>{r.name===s&&g()})}export{b as a,g as r,R as w};
|