1import{K as b,M as g,Q as m,U as f,V as p,X as y,r as l,Y as v,Z as N,_ as w,a,j as e,L as k}from"./index-BrUw9o4P.js";import{c as S,r as C,u as O}from"./auth-middleware-DyQLFON2.js";var A=class extends b{#t;#r=void 0;#e;#s;constructor(t,i){super(),this.#t=t,this.setOptions(i),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){const i=this.options;this.options=this.#t.defaultMutationOptions(t),g(this.options,i)||this.#t.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#e,observer:this}),i?.mutationKey&&this.options.mutationKey&&m(i.mutationKey)!==m(this.options.mutationKey)?this.reset():this.#e?.state.status==="pending"&&this.#e.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#e?.removeObserver(this)}onMutationUpdate(t){this.#i(),this.#a(t)}getCurrentResult(){return this.#r}reset(){this.#e?.removeObserver(this),this.#e=void 0,this.#i(),this.#a()}mutate(t,i){return this.#s=i,this.#e?.removeObserver(this),this.#e=this.#t.getMutationCache().build(this.#t,this.options),this.#e.addObserver(this),this.#e.execute(t)}#i(){const t=this.#e?.state??f();this.#r={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#a(t){p.batch(()=>{if(this.#s&&this.hasListeners()){const i=this.#r.variables,o=this.#r.context,r={client:this.#t,meta:this.options.meta,mutationKey:this.options.mutationKey};if(t?.type==="success"){try{this.#s.onSuccess?.(t.data,i,o,r)}catch(n){Promise.reject(n)}try{this.#s.onSettled?.(t.data,null,i,o,r)}catch(n){Promise.reject(n)}}else if(t?.type==="error"){try{this.#s.onError?.(t.error,i,o,r)}catch(n){Promise.reject(n)}try{this.#s.onSettled?.(void 0,t.error,i,o,r)}catch(n){Promise.reject(n)}}}this.listeners.forEach(i=>{i(this.#r)})})}};function M(t,i){const o=y(),[r]=l.useState(()=>new A(o,t));l.useEffect(()=>{r.setOptions(t)},[r,t]);const n=l.useSyncExternalStore(l.useCallback(s=>r.subscribe(p.batchCalls(s)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),d=l.useCallback((s,h)=>{r.mutate(s,h).catch(v)},[r]);if(n.error&&N(r.options.throwOnError,[n.error]))throw n.error;return{...n,mutate:d,mutateAsync:n.mutate}}const R=S({method:"POST"}).middleware([C]).handler(w("324f1d7bc0555bd37dc286f179798c46a3447524fe0d38caa2de7058cd4ba0e6")),u={critical:"bg-destructive/10 text-destructive border-destructive/30",warning:"bg-amber-500/10 text-amber-700 border-amber-500/30",ok:"bg-emerald-500/10 text-emerald-700 border-emerald-500/30"};function j(){const t=O(R),{mutate:i,data:o,isPending:r,error:n}=M({mutationFn:()=>t({data:{}})}),d=o;return a("div",{className:"mx-auto max-w-5xl px-6 py-12",children:[a("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[a("div",{children:[e("h1",{className:"text-2xl font-semibold tracking-tight",children:"Hero readability & contrast"}),e("p",{className:"mt-1 text-sm text-muted-foreground",children:"Measures the homepage headline, subhead, CTAs and trust row against WCAG AA, then asks AI for concrete styling fixes. Wording is never changed."})]}),a("div",{className:"flex items-center gap-3",children:[e(k,{to:"/admin/leads",className:"text-sm text-muted-foreground hover:text-foreground",children:"Leads"}),e("button",{type:"button",onClick:()=>i(),disabled:r,className:"cursor-pointer rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground disabled:opacity-60",children:r?"Analyzingâ¦":"Run check"})]})]}),n?e("p",{className:"mt-6 rounded-md border border-destructive/30 bg-destructive/10 p-4 text-sm text-destructive",children:n.message||"The check could not run. Please try again."}):null,r?e("p",{className:"mt-8 text-sm text-muted-foreground",children:"Reviewing colours, sizes and weights. This can take up to a minute."}):null,d?a("div",{className:"mt-10 space-y-10",children:[a("section",{children:[e("h2",{className:"text-sm font-semibold uppercase tracking-wide text-muted-foreground",children:"Measured contrast"}),e("div",{className:"mt-3 overflow-x-auto rounded-lg border border-border",children:a("table",{className:"w-full text-sm",children:[e("thead",{className:"bg-muted/50 text-left",children:a("tr",{children:[e("th",{className:"px-3 py-2 font-medium",children:"Element"}),e("th",{className:"px-3 py-2 font-medium",children:"Colours"}),e("th",{className:"px-3 py-2 font-medium",children:"Size"}),e("th",{className:"px-3 py-2 font-medium",children:"Ratio"}),e("th",{className:"px-3 py-2 font-medium",children:"AA"})]})}),e("tbody",{children:d.measurements.map(s=>a("tr",{className:"border-t border-border align-top",children:[e("td",{className:"px-3 py-2",children:s.label}),a("td",{className:"px-3 py-2 font-mono text-xs text-muted-foreground",children:[s.fg," on ",s.bg]}),a("td",{className:"px-3 py-2 text-muted-foreground",children:[s.fontPx,"px / ",s.weight]}),a("td",{className:"px-3 py-2 tabular-nums",children:[s.ratio.toFixed(2),":1"]}),e("td",{className:"px-3 py-2",children:e("span",{className:`rounded-full border px-2 py-0.5 text-xs ${s.passesAA?u.ok:u.critical}`,children:s.passesAA?"Pass":"Fail"})})]},s.id))})]})})]}),a("section",{children:[e("h2",{className:"text-sm font-semibold uppercase tracking-wide text-muted-foreground",children:"Summary"}),e("p",{className:"mt-3 text-sm leading-relaxed",children:d.overall_summary})]}),a("section",{className:"space-y-6",children:[e("h2",{className:"text-sm font-semibold uppercase tracking-wide text-muted-foreground",children:"Suggested styling fixes"}),d.findings.map(s=>{const h=d.measurements.find(c=>c.id===s.sample_id);return a("article",{className:"rounded-lg border border-border p-5",children:[a("div",{className:"flex flex-wrap items-center gap-3",children:[e("h3",{className:"font-medium",children:h?.label??s.sample_id}),e("span",{className:`rounded-full border px-2 py-0.5 text-xs capitalize ${u[s.severity]??u.ok}`,children:s.severity})]}),e("p",{className:"mt-2 text-sm text-muted-foreground",children:s.issue}),s.fixes.length>0?e("ul",{className:"mt-4 space-y-4 list-none p-0",children:s.fixes.map((c,x)=>a("li",{className:"rounded-md bg-muted/40 p-4",children:[e("p",{className:"text-sm font-medium",children:c.change}),e("pre",{className:"mt-2 overflow-x-auto rounded bg-background p-3 text-xs",children:e("code",{children:c.css})}),e("p",{className:"mt-2 text-xs text-muted-foreground",children:c.rationale})]},x))}):null]},s.sample_id)})]})]}):null]})}export{j as component};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.