@yuktishaalaa/yuktai 3.0.16 → 4.0.0
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/index.js +1141 -33
- package/dist/index.mjs +26 -26
- package/dist/zip-generator-D5EXBBNS.mjs +1109 -0
- package/package.json +22 -29
package/dist/index.js
CHANGED
|
@@ -1,32 +1,1140 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var Lo=Object.create;var ve=Object.defineProperty;var Mo=Object.getOwnPropertyDescriptor;var Ro=Object.getOwnPropertyNames;var Po=Object.getPrototypeOf,No=Object.prototype.hasOwnProperty;var X=(e,t)=>()=>(e&&(t=e(e=0)),t);var se=(e,t)=>{for(var o in t)ve(e,o,{get:t[o],enumerable:!0})},st=(e,t,o,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Ro(t))!No.call(e,r)&&r!==o&&ve(e,r,{get:()=>t[r],enumerable:!(a=Mo(t,r))||a.enumerable});return e};var Ne=(e,t,o)=>(o=e!=null?Lo(Po(e)):{},st(t||!e||!e.__esModule?ve(o,"default",{value:e,enumerable:!0}):o,e)),zo=e=>st(ve({},"__esModule",{value:!0}),e);var g=X(()=>{});var zt={};se(zt,{askPage:()=>qe});function nn(){return new Promise(e=>{let t=setTimeout(e,1500),o=new MutationObserver(()=>{clearTimeout(t),t=setTimeout(()=>{o.disconnect(),e()},500)});o.observe(document.body,{childList:!0,subtree:!0})})}function an(){let e=[],t=document.querySelectorAll("*");for(let o of t){if(o.closest("[data-yuktai-panel]"))continue;let a=o.innerText?.trim();a&&a.length>30&&e.push(a);let r=o.getAttribute("aria-label");if(r&&r.length>10&&e.push(r),(o instanceof HTMLInputElement||o instanceof HTMLTextAreaElement)&&(o.placeholder&&e.push(o.placeholder),o.value&&e.push(o.value)),o instanceof HTMLButtonElement){let i=o.innerText||o.getAttribute("aria-label");i&&e.push(i)}}return e.join(" ").slice(0,3500)}async function qe(e){if(!e.trim())return{success:!1,answer:"",error:"Please type a question."};try{let t=window,o=t.LanguageModel||t.ai?.languageModel;if(!o)return{success:!1,answer:"",error:"Gemini Nano not available."};await nn();let a=an();if(!a||a.length<100)return{success:!1,answer:"",error:"Page content not readable."};let r;try{r=await o.create({systemPrompt:`Answer ONLY using page content.
|
|
2
2
|
Keep answer short (2\u20133 sentences).
|
|
3
|
-
If not found say: "I could not find that on this page."`,outputLanguage:"en"})}catch{
|
|
3
|
+
If not found say: "I could not find that on this page."`,outputLanguage:"en"})}catch{r=await o.create()}let i=`Page:
|
|
4
4
|
${a}
|
|
5
5
|
|
|
6
|
-
Q: ${e}`,
|
|
6
|
+
Q: ${e}`,n=await r.prompt(i);return r?.destroy&&r.destroy(),{success:!0,answer:n?.trim()||"No answer found."}}catch(t){return{success:!1,answer:"",error:t instanceof Error?t.message:"Error occurred"}}}var De=X(()=>{"use strict";g()});var Ue={};se(Ue,{askPageWithTransformers:()=>Ve,getModelLoadStatus:()=>ce,isTransformersSupported:()=>le});function Ot(){return typeof navigator>"u"?!1:/Android|iPhone|iPad|iPod|Mobile|Tablet/i.test(navigator.userAgent)}function rn(){if(Ot())return"wasm";try{if(typeof navigator<"u"&&"gpu"in navigator&&navigator.gpu!==void 0)return"webgpu"}catch{}return"wasm"}async function sn(){if(!je){if(ee){for(;ee;)await new Promise(e=>setTimeout(e,200));return}ee=!0;try{let{pipeline:e,env:t}=await import("@huggingface/transformers");t.allowRemoteModels=!0,t.allowLocalModels=!1,typeof window<"u"&&typeof caches<"u"&&(t.useWasmCache=!0);let o=rn(),a=Ot();console.log(`yuktai: Transformers.js \u2014 device: ${o}, mobile: ${a}`),Ht=await e("feature-extraction","Xenova/all-MiniLM-L6-v2",{device:o,dtype:a?"q4":"fp32"}),Ft=await e("text2text-generation","Xenova/flan-t5-small",{device:o,dtype:a?"q4":"fp32"}),je=!0,ee=!1,console.log("yuktai: Transformers.js models loaded \u2705")}catch(e){throw ee=!1,console.error("yuktai: Transformers.js model load failed",e),e}}}function ln(){return new Promise(e=>{let t=setTimeout(e,1500),o=new MutationObserver(()=>{clearTimeout(t),t=setTimeout(()=>{o.disconnect(),e()},500)});o.observe(document.body,{childList:!0,subtree:!0})})}function cn(){let e=[],t=new Set,o=document.querySelectorAll("p, h1, h2, h3, h4, h5, h6, li, td, th, label, figcaption, blockquote, span, a, button, div");for(let n of o){if(n.closest("[data-yuktai-panel]")||n.querySelector("p, h1, h2, h3, h4, li, td, div"))continue;let c=n.innerText?.trim();if(!c||c.length<15||t.has(c))continue;t.add(c),e.push(c);let p=n.getAttribute("aria-label")?.trim();p&&p.length>8&&!t.has(p)&&(t.add(p),e.push(p))}let a=document.title?.trim();a&&!t.has(a)&&e.unshift(a);let i=document.querySelector('meta[name="description"]')?.getAttribute("content")?.trim();return i&&!t.has(i)&&e.unshift(i),e.join(" ").slice(0,8e3)}function dn(e,t=150,o=30){if(typeof e!="string")try{e=String(e??"")}catch{return[]}let a=e.trim();if(!a)return[];let r=Math.min(o,Math.floor(t/2)),i=a.split(/\s+/),n=[],s=t-r;for(let c=0;c<i.length;c+=s){let p=i.slice(c,c+t).join(" ");p.trim().length>20&&n.push(p)}return n}function pn(e,t){let o=0,a=0,r=0;for(let i=0;i<e.length;i++)o+=e[i]*t[i],a+=e[i]*e[i],r+=t[i]*t[i];return o/(Math.sqrt(a)*Math.sqrt(r)+1e-8)}async function It(e){let t=await Ht(e,{pooling:"mean",normalize:!0}),o=t?.data??t;return Array.from(o)}async function un(e,t,o=3){let a=await It(e),r=await Promise.all(t.map(async i=>{let n=await It(i),s=pn(a,n);return{chunk:i,score:s}}));return r.sort((i,n)=>n.score-i.score),r.slice(0,o).map(i=>i.chunk)}async function Ve(e){if(!e.trim())return{success:!1,answer:"",error:"Please type a question."};try{await sn(),await ln();let t=cn();if(!t||t.length<50)return{success:!1,answer:"",error:"Not enough content on this page."};let o=dn(t);if(o.length===0)return{success:!1,answer:"",error:"Could not process page content."};let i=`Answer the question based on the context. Give a complete answer in 2-3 sentences.
|
|
7
7
|
|
|
8
|
-
Context: ${(await
|
|
8
|
+
Context: ${(await un(e,o,3)).join(" ").slice(0,1200)}
|
|
9
9
|
|
|
10
10
|
Question: ${e}
|
|
11
11
|
|
|
12
|
-
Answer:`,
|
|
12
|
+
Answer:`,s=(await Ft(i,{max_new_tokens:120,min_new_tokens:10}))?.[0]?.generated_text?.trim()||"";return s?{success:!0,answer:s}:{success:!0,answer:"I could not find a specific answer on this page."}}catch(t){console.error("yuktai: Transformers RAG error",t);let o=t instanceof Error?t.message:"";return o.includes("Out of memory")||o.includes("memory")?{success:!1,answer:"",error:"Not enough device memory. Try on a device with more RAM or use desktop Chrome with Gemini Nano."}:{success:!1,answer:"",error:o||"Transformers.js error."}}}function le(){try{return typeof WebAssembly<"u"&&typeof Worker<"u"}catch{return!1}}function ce(){return je?"ready":ee?"loading":"idle"}var Ht,Ft,ee,je,de=X(()=>{"use strict";g();Ht=null,Ft=null,ee=!1,je=!1});function $t(e,t){return e.replace(/\{\{SITE_NAME\}\}/g,t.SITE_NAME).replace(/\{\{THEME_COLOR\}\}/g,t.THEME_COLOR).replace(/\{\{TAGLINE\}\}/g,t.TAGLINE).replace(/\{\{YEAR\}\}/g,t.YEAR)}var Xe,_t,Bt,Gt,qt,Dt,jt,Vt,Ut,Yt,Kt,Xt,Zt,Jt,Qt,eo,to,oo,no,ao,ro,io,so,lo,co,po=X(()=>{"use strict";g();Xe={blue:"#1a73e8",green:"#0d9488",purple:"#7c3aed",red:"#dc2626",orange:"#ea580c",teal:"#0891b2",indigo:"#4f46e5",gray:"#374151"},_t=e=>`{
|
|
13
|
+
"name": "${e.toLowerCase().replace(/\s+/g,"-")}",
|
|
14
|
+
"version": "0.1.0",
|
|
15
|
+
"private": true,
|
|
16
|
+
"scripts": {
|
|
17
|
+
"dev": "next dev",
|
|
18
|
+
"build": "next build",
|
|
19
|
+
"start": "next start",
|
|
20
|
+
"lint": "next lint"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"next": "^16.0.0",
|
|
24
|
+
"react": "^19.0.0",
|
|
25
|
+
"react-dom": "^19.0.0"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@types/node": "^20.0.0",
|
|
29
|
+
"@types/react": "^19.0.0",
|
|
30
|
+
"@types/react-dom": "^19.0.0",
|
|
31
|
+
"autoprefixer": "^10.4.0",
|
|
32
|
+
"postcss": "^8.4.0",
|
|
33
|
+
"tailwindcss": "^3.4.0",
|
|
34
|
+
"typescript": "^5.0.0"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
`,Bt=`/** @type {import('next').NextConfig} */
|
|
38
|
+
const nextConfig = {
|
|
39
|
+
reactStrictMode: true,
|
|
40
|
+
images: { unoptimized: true },
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
module.exports = nextConfig
|
|
44
|
+
`,Gt=e=>`/** @type {import('tailwindcss').Config} */
|
|
45
|
+
module.exports = {
|
|
46
|
+
content: [
|
|
47
|
+
"./src/pages/**/*.{js,ts,jsx,tsx,mdx}",
|
|
48
|
+
"./src/components/**/*.{js,ts,jsx,tsx,mdx}",
|
|
49
|
+
"./src/app/**/*.{js,ts,jsx,tsx,mdx}",
|
|
50
|
+
],
|
|
51
|
+
theme: {
|
|
52
|
+
extend: {
|
|
53
|
+
colors: {
|
|
54
|
+
primary: "${e}",
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
plugins: [],
|
|
59
|
+
}
|
|
60
|
+
`,qt=e=>`@tailwind base;
|
|
61
|
+
@tailwind components;
|
|
62
|
+
@tailwind utilities;
|
|
63
|
+
|
|
64
|
+
:root {
|
|
65
|
+
--primary: ${e};
|
|
66
|
+
--primary-dark: ${e}dd;
|
|
67
|
+
--foreground: #0f172a;
|
|
68
|
+
--background: #ffffff;
|
|
69
|
+
--muted: #64748b;
|
|
70
|
+
--border: #e2e8f0;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
* {
|
|
74
|
+
box-sizing: border-box;
|
|
75
|
+
margin: 0;
|
|
76
|
+
padding: 0;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
body {
|
|
80
|
+
font-family: system-ui, -apple-system, sans-serif;
|
|
81
|
+
color: var(--foreground);
|
|
82
|
+
background: var(--background);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
a {
|
|
86
|
+
color: inherit;
|
|
87
|
+
text-decoration: none;
|
|
88
|
+
}
|
|
89
|
+
`,Dt=`import type { Metadata } from "next"
|
|
90
|
+
import "./globals.css"
|
|
91
|
+
import Navbar from "@/components/Navbar"
|
|
92
|
+
import Footer from "@/components/Footer"
|
|
93
|
+
|
|
94
|
+
export const metadata: Metadata = {
|
|
95
|
+
title: "{{SITE_NAME}}",
|
|
96
|
+
description: "{{TAGLINE}}",
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export default function RootLayout({
|
|
100
|
+
children,
|
|
101
|
+
}: {
|
|
102
|
+
children: React.ReactNode
|
|
103
|
+
}) {
|
|
104
|
+
return (
|
|
105
|
+
<html lang="en">
|
|
106
|
+
<body>
|
|
107
|
+
<Navbar />
|
|
108
|
+
<main>{children}</main>
|
|
109
|
+
<Footer />
|
|
110
|
+
</body>
|
|
111
|
+
</html>
|
|
112
|
+
)
|
|
113
|
+
}
|
|
114
|
+
`,jt=`"use client"
|
|
115
|
+
import Link from "next/link"
|
|
116
|
+
import { useState } from "react"
|
|
117
|
+
import styles from "./Navbar.module.css"
|
|
118
|
+
|
|
119
|
+
export default function Navbar() {
|
|
120
|
+
const [open, setOpen] = useState(false)
|
|
121
|
+
|
|
122
|
+
return (
|
|
123
|
+
<nav className={styles.navbar}>
|
|
124
|
+
<div className={styles.container}>
|
|
125
|
+
<Link href="/" className={styles.logo}>
|
|
126
|
+
{{SITE_NAME}}
|
|
127
|
+
</Link>
|
|
128
|
+
<button
|
|
129
|
+
className={styles.toggle}
|
|
130
|
+
onClick={() => setOpen(!open)}
|
|
131
|
+
aria-label="Toggle menu"
|
|
132
|
+
>
|
|
133
|
+
\u2630
|
|
134
|
+
</button>
|
|
135
|
+
<ul className={\`\${styles.links} \${open ? styles.open : ""}\`}>
|
|
136
|
+
<li><Link href="/">Home</Link></li>
|
|
137
|
+
<li><Link href="/about">About</Link></li>
|
|
138
|
+
<li><Link href="/services">Services</Link></li>
|
|
139
|
+
<li><Link href="/contact">Contact</Link></li>
|
|
140
|
+
</ul>
|
|
141
|
+
</div>
|
|
142
|
+
</nav>
|
|
143
|
+
)
|
|
144
|
+
}
|
|
145
|
+
`,Vt=`.navbar {
|
|
146
|
+
background: var(--primary);
|
|
147
|
+
color: white;
|
|
148
|
+
padding: 0 1rem;
|
|
149
|
+
position: sticky;
|
|
150
|
+
top: 0;
|
|
151
|
+
z-index: 100;
|
|
152
|
+
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.container {
|
|
156
|
+
max-width: 1200px;
|
|
157
|
+
margin: 0 auto;
|
|
158
|
+
display: flex;
|
|
159
|
+
align-items: center;
|
|
160
|
+
justify-content: space-between;
|
|
161
|
+
height: 64px;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.logo {
|
|
165
|
+
font-size: 1.25rem;
|
|
166
|
+
font-weight: 700;
|
|
167
|
+
color: white;
|
|
168
|
+
text-decoration: none;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.links {
|
|
172
|
+
display: flex;
|
|
173
|
+
list-style: none;
|
|
174
|
+
gap: 2rem;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.links a {
|
|
178
|
+
color: rgba(255,255,255,0.9);
|
|
179
|
+
text-decoration: none;
|
|
180
|
+
font-size: 0.95rem;
|
|
181
|
+
transition: color 0.2s;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.links a:hover {
|
|
185
|
+
color: white;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.toggle {
|
|
189
|
+
display: none;
|
|
190
|
+
background: none;
|
|
191
|
+
border: none;
|
|
192
|
+
color: white;
|
|
193
|
+
font-size: 1.5rem;
|
|
194
|
+
cursor: pointer;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
@media (max-width: 768px) {
|
|
198
|
+
.toggle { display: block; }
|
|
199
|
+
.links {
|
|
200
|
+
display: none;
|
|
201
|
+
position: absolute;
|
|
202
|
+
top: 64px;
|
|
203
|
+
left: 0;
|
|
204
|
+
right: 0;
|
|
205
|
+
background: var(--primary);
|
|
206
|
+
flex-direction: column;
|
|
207
|
+
padding: 1rem;
|
|
208
|
+
gap: 1rem;
|
|
209
|
+
}
|
|
210
|
+
.links.open { display: flex; }
|
|
211
|
+
}
|
|
212
|
+
`,Ut=`import styles from "./Footer.module.css"
|
|
213
|
+
|
|
214
|
+
export default function Footer() {
|
|
215
|
+
return (
|
|
216
|
+
<footer className={styles.footer}>
|
|
217
|
+
<div className={styles.container}>
|
|
218
|
+
<p className={styles.brand}>{{SITE_NAME}}</p>
|
|
219
|
+
<p className={styles.tagline}>{{TAGLINE}}</p>
|
|
220
|
+
<p className={styles.copy}>\xA9 {{YEAR}} {{SITE_NAME}}. All rights reserved.</p>
|
|
221
|
+
</div>
|
|
222
|
+
</footer>
|
|
223
|
+
)
|
|
224
|
+
}
|
|
225
|
+
`,Yt=`.footer {
|
|
226
|
+
background: #0f172a;
|
|
227
|
+
color: #94a3b8;
|
|
228
|
+
padding: 3rem 1rem;
|
|
229
|
+
margin-top: auto;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.container {
|
|
233
|
+
max-width: 1200px;
|
|
234
|
+
margin: 0 auto;
|
|
235
|
+
text-align: center;
|
|
236
|
+
display: flex;
|
|
237
|
+
flex-direction: column;
|
|
238
|
+
gap: 0.5rem;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.brand {
|
|
242
|
+
font-size: 1.25rem;
|
|
243
|
+
font-weight: 700;
|
|
244
|
+
color: white;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.tagline {
|
|
248
|
+
font-size: 0.9rem;
|
|
249
|
+
color: #64748b;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.copy {
|
|
253
|
+
font-size: 0.8rem;
|
|
254
|
+
color: #475569;
|
|
255
|
+
margin-top: 1rem;
|
|
256
|
+
}
|
|
257
|
+
`,Kt=`import styles from "./page.module.css"
|
|
258
|
+
import Link from "next/link"
|
|
259
|
+
|
|
260
|
+
export default function HomePage() {
|
|
261
|
+
return (
|
|
262
|
+
<div className={styles.page}>
|
|
263
|
+
|
|
264
|
+
{/* Hero */}
|
|
265
|
+
<section className={styles.hero}>
|
|
266
|
+
<div className={styles.heroContent}>
|
|
267
|
+
<h1 className={styles.heroTitle}>Welcome to {{SITE_NAME}}</h1>
|
|
268
|
+
<p className={styles.heroSubtitle}>{{TAGLINE}}</p>
|
|
269
|
+
<div className={styles.heroActions}>
|
|
270
|
+
<Link href="/contact" className={styles.btnPrimary}>Get Started</Link>
|
|
271
|
+
<Link href="/about" className={styles.btnSecondary}>Learn More</Link>
|
|
272
|
+
</div>
|
|
273
|
+
</div>
|
|
274
|
+
</section>
|
|
275
|
+
|
|
276
|
+
{/* Features */}
|
|
277
|
+
<section className={styles.features}>
|
|
278
|
+
<div className={styles.container}>
|
|
279
|
+
<h2 className={styles.sectionTitle}>Why Choose Us</h2>
|
|
280
|
+
<div className={styles.grid}>
|
|
281
|
+
{[
|
|
282
|
+
{ icon: "\u26A1", title: "Fast", desc: "Lightning fast performance on all devices" },
|
|
283
|
+
{ icon: "\u{1F512}", title: "Secure", desc: "Enterprise-grade security built in" },
|
|
284
|
+
{ icon: "\u{1F4F1}", title: "Responsive", desc: "Works perfectly on mobile and desktop" },
|
|
285
|
+
].map(f => (
|
|
286
|
+
<div key={f.title} className={styles.card}>
|
|
287
|
+
<span className={styles.icon}>{f.icon}</span>
|
|
288
|
+
<h3>{f.title}</h3>
|
|
289
|
+
<p>{f.desc}</p>
|
|
290
|
+
</div>
|
|
291
|
+
))}
|
|
292
|
+
</div>
|
|
293
|
+
</div>
|
|
294
|
+
</section>
|
|
295
|
+
|
|
296
|
+
{/* CTA */}
|
|
297
|
+
<section className={styles.cta}>
|
|
298
|
+
<div className={styles.container}>
|
|
299
|
+
<h2>Ready to get started?</h2>
|
|
300
|
+
<p>Join thousands of happy customers today.</p>
|
|
301
|
+
<Link href="/contact" className={styles.btnPrimary}>Contact Us</Link>
|
|
302
|
+
</div>
|
|
303
|
+
</section>
|
|
304
|
+
|
|
305
|
+
</div>
|
|
306
|
+
)
|
|
307
|
+
}
|
|
308
|
+
`,Xt=`.page { min-height: 100vh; }
|
|
309
|
+
|
|
310
|
+
.hero {
|
|
311
|
+
background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
|
|
312
|
+
color: white;
|
|
313
|
+
padding: 6rem 1rem;
|
|
314
|
+
text-align: center;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
.heroContent { max-width: 700px; margin: 0 auto; }
|
|
318
|
+
|
|
319
|
+
.heroTitle {
|
|
320
|
+
font-size: clamp(2rem, 5vw, 3.5rem);
|
|
321
|
+
font-weight: 800;
|
|
322
|
+
line-height: 1.1;
|
|
323
|
+
margin-bottom: 1.5rem;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
.heroSubtitle {
|
|
327
|
+
font-size: 1.25rem;
|
|
328
|
+
opacity: 0.9;
|
|
329
|
+
margin-bottom: 2.5rem;
|
|
330
|
+
line-height: 1.6;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.heroActions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
|
|
334
|
+
|
|
335
|
+
.btnPrimary {
|
|
336
|
+
background: white;
|
|
337
|
+
color: var(--primary);
|
|
338
|
+
padding: 0.875rem 2rem;
|
|
339
|
+
border-radius: 8px;
|
|
340
|
+
font-weight: 700;
|
|
341
|
+
font-size: 1rem;
|
|
342
|
+
transition: transform 0.2s;
|
|
343
|
+
display: inline-block;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
.btnPrimary:hover { transform: translateY(-2px); }
|
|
347
|
+
|
|
348
|
+
.btnSecondary {
|
|
349
|
+
background: rgba(255,255,255,0.15);
|
|
350
|
+
color: white;
|
|
351
|
+
padding: 0.875rem 2rem;
|
|
352
|
+
border-radius: 8px;
|
|
353
|
+
font-weight: 600;
|
|
354
|
+
font-size: 1rem;
|
|
355
|
+
border: 1px solid rgba(255,255,255,0.3);
|
|
356
|
+
transition: background 0.2s;
|
|
357
|
+
display: inline-block;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
.btnSecondary:hover { background: rgba(255,255,255,0.25); }
|
|
361
|
+
|
|
362
|
+
.features { padding: 5rem 1rem; background: #f8fafc; }
|
|
363
|
+
|
|
364
|
+
.container { max-width: 1200px; margin: 0 auto; }
|
|
365
|
+
|
|
366
|
+
.sectionTitle {
|
|
367
|
+
text-align: center;
|
|
368
|
+
font-size: 2rem;
|
|
369
|
+
font-weight: 700;
|
|
370
|
+
margin-bottom: 3rem;
|
|
371
|
+
color: #0f172a;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
.grid {
|
|
375
|
+
display: grid;
|
|
376
|
+
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
|
377
|
+
gap: 2rem;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
.card {
|
|
381
|
+
background: white;
|
|
382
|
+
padding: 2rem;
|
|
383
|
+
border-radius: 12px;
|
|
384
|
+
box-shadow: 0 1px 4px rgba(0,0,0,0.06);
|
|
385
|
+
text-align: center;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
.icon { font-size: 2.5rem; display: block; margin-bottom: 1rem; }
|
|
389
|
+
.card h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.5rem; }
|
|
390
|
+
.card p { color: #64748b; font-size: 0.9rem; line-height: 1.6; }
|
|
391
|
+
|
|
392
|
+
.cta {
|
|
393
|
+
background: var(--primary);
|
|
394
|
+
color: white;
|
|
395
|
+
padding: 5rem 1rem;
|
|
396
|
+
text-align: center;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
.cta h2 { font-size: 2rem; font-weight: 800; margin-bottom: 0.75rem; }
|
|
400
|
+
.cta p { font-size: 1.1rem; opacity: 0.85; margin-bottom: 2rem; }
|
|
401
|
+
`,Zt=`import styles from "./page.module.css"
|
|
402
|
+
|
|
403
|
+
export default function AboutPage() {
|
|
404
|
+
return (
|
|
405
|
+
<div className={styles.page}>
|
|
406
|
+
<section className={styles.hero}>
|
|
407
|
+
<h1>About {{SITE_NAME}}</h1>
|
|
408
|
+
<p>{{TAGLINE}}</p>
|
|
409
|
+
</section>
|
|
410
|
+
<section className={styles.content}>
|
|
411
|
+
<div className={styles.container}>
|
|
412
|
+
<div className={styles.grid}>
|
|
413
|
+
<div>
|
|
414
|
+
<h2>Our Story</h2>
|
|
415
|
+
<p>We started with a simple mission \u2014 to provide the best experience for our customers. Built on trust, quality, and dedication, {{SITE_NAME}} has grown to serve thousands of happy customers.</p>
|
|
416
|
+
<p>Our team of experts is committed to delivering excellence in everything we do. We believe in building long-term relationships with our clients.</p>
|
|
417
|
+
</div>
|
|
418
|
+
<div>
|
|
419
|
+
<h2>Our Values</h2>
|
|
420
|
+
<ul className={styles.list}>
|
|
421
|
+
<li>\u2705 Customer first approach</li>
|
|
422
|
+
<li>\u2705 Quality in everything</li>
|
|
423
|
+
<li>\u2705 Transparent communication</li>
|
|
424
|
+
<li>\u2705 Continuous improvement</li>
|
|
425
|
+
<li>\u2705 Community focus</li>
|
|
426
|
+
</ul>
|
|
427
|
+
</div>
|
|
428
|
+
</div>
|
|
429
|
+
<div className={styles.stats}>
|
|
430
|
+
{[
|
|
431
|
+
{ number: "1000+", label: "Happy Customers" },
|
|
432
|
+
{ number: "5+", label: "Years Experience" },
|
|
433
|
+
{ number: "50+", label: "Team Members" },
|
|
434
|
+
{ number: "99%", label: "Satisfaction Rate" },
|
|
435
|
+
].map(s => (
|
|
436
|
+
<div key={s.label} className={styles.stat}>
|
|
437
|
+
<span className={styles.number}>{s.number}</span>
|
|
438
|
+
<span className={styles.label}>{s.label}</span>
|
|
439
|
+
</div>
|
|
440
|
+
))}
|
|
441
|
+
</div>
|
|
442
|
+
</div>
|
|
443
|
+
</section>
|
|
444
|
+
</div>
|
|
445
|
+
)
|
|
446
|
+
}
|
|
447
|
+
`,Jt=`.page { min-height: 100vh; }
|
|
448
|
+
|
|
449
|
+
.hero {
|
|
450
|
+
background: var(--primary);
|
|
451
|
+
color: white;
|
|
452
|
+
padding: 5rem 1rem;
|
|
453
|
+
text-align: center;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
.hero h1 { font-size: 2.5rem; font-weight: 800; margin-bottom: 1rem; }
|
|
457
|
+
.hero p { font-size: 1.1rem; opacity: 0.85; }
|
|
458
|
+
|
|
459
|
+
.content { padding: 4rem 1rem; }
|
|
460
|
+
|
|
461
|
+
.container { max-width: 1100px; margin: 0 auto; }
|
|
462
|
+
|
|
463
|
+
.grid {
|
|
464
|
+
display: grid;
|
|
465
|
+
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
|
466
|
+
gap: 3rem;
|
|
467
|
+
margin-bottom: 4rem;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
.grid h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 1rem; color: var(--primary); }
|
|
471
|
+
.grid p { color: #475569; line-height: 1.7; margin-bottom: 1rem; }
|
|
472
|
+
|
|
473
|
+
.list { list-style: none; display: flex; flex-direction: column; gap: 0.75rem; }
|
|
474
|
+
.list li { color: #475569; font-size: 0.95rem; }
|
|
475
|
+
|
|
476
|
+
.stats {
|
|
477
|
+
display: grid;
|
|
478
|
+
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
|
|
479
|
+
gap: 1.5rem;
|
|
480
|
+
background: #f8fafc;
|
|
481
|
+
padding: 2.5rem;
|
|
482
|
+
border-radius: 16px;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
.stat { text-align: center; }
|
|
486
|
+
|
|
487
|
+
.number {
|
|
488
|
+
display: block;
|
|
489
|
+
font-size: 2rem;
|
|
490
|
+
font-weight: 800;
|
|
491
|
+
color: var(--primary);
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
.label { font-size: 0.85rem; color: #64748b; }
|
|
495
|
+
`,Qt=`"use client"
|
|
496
|
+
import { useState } from "react"
|
|
497
|
+
import styles from "./page.module.css"
|
|
498
|
+
|
|
499
|
+
export default function ContactPage() {
|
|
500
|
+
const [sent, setSent] = useState(false)
|
|
501
|
+
const [form, setForm] = useState({ name: "", email: "", message: "" })
|
|
502
|
+
|
|
503
|
+
const handleSubmit = (e: React.FormEvent) => {
|
|
504
|
+
e.preventDefault()
|
|
505
|
+
setSent(true)
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
return (
|
|
509
|
+
<div className={styles.page}>
|
|
510
|
+
<section className={styles.hero}>
|
|
511
|
+
<h1>Contact Us</h1>
|
|
512
|
+
<p>We would love to hear from you. Get in touch with our team.</p>
|
|
513
|
+
</section>
|
|
514
|
+
<section className={styles.content}>
|
|
515
|
+
<div className={styles.container}>
|
|
516
|
+
<div className={styles.grid}>
|
|
517
|
+
<div className={styles.info}>
|
|
518
|
+
<h2>Get in Touch</h2>
|
|
519
|
+
<div className={styles.detail}>
|
|
520
|
+
<span>\u{1F4CD}</span>
|
|
521
|
+
<div>
|
|
522
|
+
<strong>Address</strong>
|
|
523
|
+
<p>123 Business Street, City, State 400001</p>
|
|
524
|
+
</div>
|
|
525
|
+
</div>
|
|
526
|
+
<div className={styles.detail}>
|
|
527
|
+
<span>\u{1F4DE}</span>
|
|
528
|
+
<div>
|
|
529
|
+
<strong>Phone</strong>
|
|
530
|
+
<p>+91 98765 43210</p>
|
|
531
|
+
</div>
|
|
532
|
+
</div>
|
|
533
|
+
<div className={styles.detail}>
|
|
534
|
+
<span>\u2709\uFE0F</span>
|
|
535
|
+
<div>
|
|
536
|
+
<strong>Email</strong>
|
|
537
|
+
<p>hello@{{SITE_NAME_LOWER}}.com</p>
|
|
538
|
+
</div>
|
|
539
|
+
</div>
|
|
540
|
+
</div>
|
|
541
|
+
<div className={styles.formWrap}>
|
|
542
|
+
{sent ? (
|
|
543
|
+
<div className={styles.success}>
|
|
544
|
+
\u2705 Message sent! We will get back to you soon.
|
|
545
|
+
</div>
|
|
546
|
+
) : (
|
|
547
|
+
<form onSubmit={handleSubmit} className={styles.form}>
|
|
548
|
+
<div className={styles.field}>
|
|
549
|
+
<label htmlFor="name">Full Name</label>
|
|
550
|
+
<input
|
|
551
|
+
id="name" type="text" required
|
|
552
|
+
value={form.name}
|
|
553
|
+
onChange={e => setForm({ ...form, name: e.target.value })}
|
|
554
|
+
placeholder="Your name"
|
|
555
|
+
/>
|
|
556
|
+
</div>
|
|
557
|
+
<div className={styles.field}>
|
|
558
|
+
<label htmlFor="email">Email Address</label>
|
|
559
|
+
<input
|
|
560
|
+
id="email" type="email" required
|
|
561
|
+
value={form.email}
|
|
562
|
+
onChange={e => setForm({ ...form, email: e.target.value })}
|
|
563
|
+
placeholder="your@email.com"
|
|
564
|
+
/>
|
|
565
|
+
</div>
|
|
566
|
+
<div className={styles.field}>
|
|
567
|
+
<label htmlFor="message">Message</label>
|
|
568
|
+
<textarea
|
|
569
|
+
id="message" required rows={5}
|
|
570
|
+
value={form.message}
|
|
571
|
+
onChange={e => setForm({ ...form, message: e.target.value })}
|
|
572
|
+
placeholder="How can we help you?"
|
|
573
|
+
/>
|
|
574
|
+
</div>
|
|
575
|
+
<button type="submit" className={styles.btn}>Send Message</button>
|
|
576
|
+
</form>
|
|
577
|
+
)}
|
|
578
|
+
</div>
|
|
579
|
+
</div>
|
|
580
|
+
</div>
|
|
581
|
+
</section>
|
|
582
|
+
</div>
|
|
583
|
+
)
|
|
584
|
+
}
|
|
585
|
+
`,eo=`.page { min-height: 100vh; }
|
|
586
|
+
|
|
587
|
+
.hero {
|
|
588
|
+
background: var(--primary);
|
|
589
|
+
color: white;
|
|
590
|
+
padding: 5rem 1rem;
|
|
591
|
+
text-align: center;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
.hero h1 { font-size: 2.5rem; font-weight: 800; margin-bottom: 1rem; }
|
|
595
|
+
.hero p { font-size: 1.1rem; opacity: 0.85; }
|
|
596
|
+
|
|
597
|
+
.content { padding: 4rem 1rem; }
|
|
598
|
+
.container { max-width: 1100px; margin: 0 auto; }
|
|
599
|
+
|
|
600
|
+
.grid {
|
|
601
|
+
display: grid;
|
|
602
|
+
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
|
603
|
+
gap: 3rem;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
.info h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 2rem; color: var(--primary); }
|
|
607
|
+
|
|
608
|
+
.detail {
|
|
609
|
+
display: flex;
|
|
610
|
+
gap: 1rem;
|
|
611
|
+
margin-bottom: 1.5rem;
|
|
612
|
+
align-items: flex-start;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
.detail span { font-size: 1.5rem; }
|
|
616
|
+
.detail strong { display: block; font-weight: 600; margin-bottom: 0.25rem; }
|
|
617
|
+
.detail p { color: #64748b; font-size: 0.9rem; }
|
|
618
|
+
|
|
619
|
+
.form { display: flex; flex-direction: column; gap: 1.25rem; }
|
|
620
|
+
|
|
621
|
+
.field { display: flex; flex-direction: column; gap: 0.4rem; }
|
|
622
|
+
|
|
623
|
+
.field label { font-size: 0.875rem; font-weight: 600; color: #374151; }
|
|
624
|
+
|
|
625
|
+
.field input,
|
|
626
|
+
.field textarea {
|
|
627
|
+
padding: 0.75rem 1rem;
|
|
628
|
+
border: 1px solid #e2e8f0;
|
|
629
|
+
border-radius: 8px;
|
|
630
|
+
font-size: 0.95rem;
|
|
631
|
+
color: #0f172a;
|
|
632
|
+
font-family: inherit;
|
|
633
|
+
transition: border-color 0.2s;
|
|
634
|
+
outline: none;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
.field input:focus,
|
|
638
|
+
.field textarea:focus { border-color: var(--primary); }
|
|
639
|
+
|
|
640
|
+
.btn {
|
|
641
|
+
background: var(--primary);
|
|
642
|
+
color: white;
|
|
643
|
+
padding: 0.875rem 2rem;
|
|
644
|
+
border: none;
|
|
645
|
+
border-radius: 8px;
|
|
646
|
+
font-size: 1rem;
|
|
647
|
+
font-weight: 600;
|
|
648
|
+
cursor: pointer;
|
|
649
|
+
transition: opacity 0.2s;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
.btn:hover { opacity: 0.9; }
|
|
653
|
+
|
|
654
|
+
.success {
|
|
655
|
+
padding: 2rem;
|
|
656
|
+
background: #f0fdf4;
|
|
657
|
+
border: 1px solid #86efac;
|
|
658
|
+
border-radius: 12px;
|
|
659
|
+
color: #166534;
|
|
660
|
+
font-size: 1.1rem;
|
|
661
|
+
text-align: center;
|
|
662
|
+
}
|
|
663
|
+
`,to=`import styles from "./page.module.css"
|
|
664
|
+
|
|
665
|
+
const SERVICES = [
|
|
666
|
+
{ icon: "\u{1F680}", title: "Service One", desc: "Comprehensive solution designed to meet your business needs efficiently and effectively." },
|
|
667
|
+
{ icon: "\u{1F4A1}", title: "Service Two", desc: "Innovative approaches that help your business grow and stay ahead of the competition." },
|
|
668
|
+
{ icon: "\u{1F527}", title: "Service Three", desc: "Expert support and maintenance to ensure smooth operations at all times." },
|
|
669
|
+
{ icon: "\u{1F4CA}", title: "Service Four", desc: "Data-driven insights and analytics to help you make better business decisions." },
|
|
670
|
+
{ icon: "\u{1F91D}", title: "Service Five", desc: "Partnership programs designed to create mutual value and long-term success." },
|
|
671
|
+
{ icon: "\u{1F310}", title: "Service Six", desc: "Global reach with local expertise to serve customers worldwide." },
|
|
672
|
+
]
|
|
673
|
+
|
|
674
|
+
export default function ServicesPage() {
|
|
675
|
+
return (
|
|
676
|
+
<div className={styles.page}>
|
|
677
|
+
<section className={styles.hero}>
|
|
678
|
+
<h1>Our Services</h1>
|
|
679
|
+
<p>Everything you need to succeed \u2014 all in one place</p>
|
|
680
|
+
</section>
|
|
681
|
+
<section className={styles.content}>
|
|
682
|
+
<div className={styles.container}>
|
|
683
|
+
<div className={styles.grid}>
|
|
684
|
+
{SERVICES.map(s => (
|
|
685
|
+
<div key={s.title} className={styles.card}>
|
|
686
|
+
<span className={styles.icon}>{s.icon}</span>
|
|
687
|
+
<h3>{s.title}</h3>
|
|
688
|
+
<p>{s.desc}</p>
|
|
689
|
+
</div>
|
|
690
|
+
))}
|
|
691
|
+
</div>
|
|
692
|
+
</div>
|
|
693
|
+
</section>
|
|
694
|
+
</div>
|
|
695
|
+
)
|
|
696
|
+
}
|
|
697
|
+
`,oo=`.page { min-height: 100vh; }
|
|
698
|
+
|
|
699
|
+
.hero {
|
|
700
|
+
background: var(--primary);
|
|
701
|
+
color: white;
|
|
702
|
+
padding: 5rem 1rem;
|
|
703
|
+
text-align: center;
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
.hero h1 { font-size: 2.5rem; font-weight: 800; margin-bottom: 1rem; }
|
|
707
|
+
.hero p { font-size: 1.1rem; opacity: 0.85; }
|
|
708
|
+
|
|
709
|
+
.content { padding: 4rem 1rem; background: #f8fafc; }
|
|
710
|
+
.container { max-width: 1100px; margin: 0 auto; }
|
|
711
|
+
|
|
712
|
+
.grid {
|
|
713
|
+
display: grid;
|
|
714
|
+
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
|
|
715
|
+
gap: 1.5rem;
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
.card {
|
|
719
|
+
background: white;
|
|
720
|
+
padding: 2rem;
|
|
721
|
+
border-radius: 12px;
|
|
722
|
+
box-shadow: 0 1px 4px rgba(0,0,0,0.06);
|
|
723
|
+
transition: transform 0.2s, box-shadow 0.2s;
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
.card:hover {
|
|
727
|
+
transform: translateY(-4px);
|
|
728
|
+
box-shadow: 0 8px 24px rgba(0,0,0,0.1);
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
.icon { font-size: 2rem; display: block; margin-bottom: 1rem; }
|
|
732
|
+
|
|
733
|
+
.card h3 {
|
|
734
|
+
font-size: 1.1rem;
|
|
735
|
+
font-weight: 700;
|
|
736
|
+
margin-bottom: 0.5rem;
|
|
737
|
+
color: #0f172a;
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
.card p { color: #64748b; font-size: 0.9rem; line-height: 1.6; }
|
|
741
|
+
`,no=`import styles from "./page.module.css"
|
|
742
|
+
import Link from "next/link"
|
|
743
|
+
|
|
744
|
+
const PLANS = [
|
|
745
|
+
{
|
|
746
|
+
name: "Starter",
|
|
747
|
+
price: "\u20B9999",
|
|
748
|
+
period: "/month",
|
|
749
|
+
features: ["5 Users", "10GB Storage", "Email Support", "Basic Analytics"],
|
|
750
|
+
cta: "Get Started",
|
|
751
|
+
highlighted: false,
|
|
752
|
+
},
|
|
753
|
+
{
|
|
754
|
+
name: "Professional",
|
|
755
|
+
price: "\u20B92,999",
|
|
756
|
+
period: "/month",
|
|
757
|
+
features: ["25 Users", "50GB Storage", "Priority Support", "Advanced Analytics", "API Access"],
|
|
758
|
+
cta: "Start Free Trial",
|
|
759
|
+
highlighted: true,
|
|
760
|
+
},
|
|
761
|
+
{
|
|
762
|
+
name: "Enterprise",
|
|
763
|
+
price: "Custom",
|
|
764
|
+
period: "",
|
|
765
|
+
features: ["Unlimited Users", "Unlimited Storage", "24/7 Support", "Custom Analytics", "Dedicated Manager"],
|
|
766
|
+
cta: "Contact Sales",
|
|
767
|
+
highlighted: false,
|
|
768
|
+
},
|
|
769
|
+
]
|
|
770
|
+
|
|
771
|
+
export default function PricingPage() {
|
|
772
|
+
return (
|
|
773
|
+
<div className={styles.page}>
|
|
774
|
+
<section className={styles.hero}>
|
|
775
|
+
<h1>Simple Pricing</h1>
|
|
776
|
+
<p>No hidden fees. Cancel anytime.</p>
|
|
777
|
+
</section>
|
|
778
|
+
<section className={styles.content}>
|
|
779
|
+
<div className={styles.container}>
|
|
780
|
+
<div className={styles.grid}>
|
|
781
|
+
{PLANS.map(plan => (
|
|
782
|
+
<div
|
|
783
|
+
key={plan.name}
|
|
784
|
+
className={\`\${styles.card} \${plan.highlighted ? styles.highlighted : ""}\`}
|
|
785
|
+
>
|
|
786
|
+
{plan.highlighted && <span className={styles.badge}>Most Popular</span>}
|
|
787
|
+
<h3>{plan.name}</h3>
|
|
788
|
+
<div className={styles.price}>
|
|
789
|
+
<span className={styles.amount}>{plan.price}</span>
|
|
790
|
+
<span className={styles.period}>{plan.period}</span>
|
|
791
|
+
</div>
|
|
792
|
+
<ul className={styles.features}>
|
|
793
|
+
{plan.features.map(f => <li key={f}>\u2705 {f}</li>)}
|
|
794
|
+
</ul>
|
|
795
|
+
<Link href="/contact" className={styles.btn}>{plan.cta}</Link>
|
|
796
|
+
</div>
|
|
797
|
+
))}
|
|
798
|
+
</div>
|
|
799
|
+
</div>
|
|
800
|
+
</section>
|
|
801
|
+
</div>
|
|
802
|
+
)
|
|
803
|
+
}
|
|
804
|
+
`,ao=`.page { min-height: 100vh; }
|
|
805
|
+
|
|
806
|
+
.hero {
|
|
807
|
+
background: var(--primary);
|
|
808
|
+
color: white;
|
|
809
|
+
padding: 5rem 1rem;
|
|
810
|
+
text-align: center;
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
.hero h1 { font-size: 2.5rem; font-weight: 800; margin-bottom: 1rem; }
|
|
814
|
+
.hero p { font-size: 1.1rem; opacity: 0.85; }
|
|
815
|
+
|
|
816
|
+
.content { padding: 4rem 1rem; background: #f8fafc; }
|
|
817
|
+
.container { max-width: 1100px; margin: 0 auto; }
|
|
818
|
+
|
|
819
|
+
.grid {
|
|
820
|
+
display: grid;
|
|
821
|
+
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
|
|
822
|
+
gap: 1.5rem;
|
|
823
|
+
align-items: start;
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
.card {
|
|
827
|
+
background: white;
|
|
828
|
+
padding: 2rem;
|
|
829
|
+
border-radius: 16px;
|
|
830
|
+
box-shadow: 0 1px 4px rgba(0,0,0,0.06);
|
|
831
|
+
position: relative;
|
|
832
|
+
border: 2px solid transparent;
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
.highlighted {
|
|
836
|
+
border-color: var(--primary);
|
|
837
|
+
transform: scale(1.03);
|
|
838
|
+
box-shadow: 0 8px 32px rgba(0,0,0,0.12);
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
.badge {
|
|
842
|
+
position: absolute;
|
|
843
|
+
top: -12px;
|
|
844
|
+
left: 50%;
|
|
845
|
+
transform: translateX(-50%);
|
|
846
|
+
background: var(--primary);
|
|
847
|
+
color: white;
|
|
848
|
+
padding: 2px 16px;
|
|
849
|
+
border-radius: 99px;
|
|
850
|
+
font-size: 0.75rem;
|
|
851
|
+
font-weight: 700;
|
|
852
|
+
white-space: nowrap;
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
.card h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 1rem; color: #0f172a; }
|
|
856
|
+
|
|
857
|
+
.price { display: flex; align-items: baseline; gap: 0.25rem; margin-bottom: 1.5rem; }
|
|
858
|
+
|
|
859
|
+
.amount { font-size: 2rem; font-weight: 800; color: var(--primary); }
|
|
860
|
+
.period { font-size: 0.875rem; color: #64748b; }
|
|
861
|
+
|
|
862
|
+
.features { list-style: none; display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 2rem; }
|
|
863
|
+
.features li { font-size: 0.9rem; color: #475569; }
|
|
864
|
+
|
|
865
|
+
.btn {
|
|
866
|
+
display: block;
|
|
867
|
+
text-align: center;
|
|
868
|
+
background: var(--primary);
|
|
869
|
+
color: white;
|
|
870
|
+
padding: 0.75rem;
|
|
871
|
+
border-radius: 8px;
|
|
872
|
+
font-weight: 600;
|
|
873
|
+
font-size: 0.95rem;
|
|
874
|
+
transition: opacity 0.2s;
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
.btn:hover { opacity: 0.9; }
|
|
878
|
+
`,ro=`"use client"
|
|
879
|
+
import { useState } from "react"
|
|
880
|
+
import styles from "./page.module.css"
|
|
881
|
+
|
|
882
|
+
export default function AuthPage() {
|
|
883
|
+
const [mode, setMode] = useState<"login" | "register">("login")
|
|
884
|
+
const [form, setForm] = useState({ name: "", email: "", password: "" })
|
|
885
|
+
|
|
886
|
+
const handleSubmit = (e: React.FormEvent) => {
|
|
887
|
+
e.preventDefault()
|
|
888
|
+
alert(mode === "login" ? "Login successful!" : "Account created!")
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
return (
|
|
892
|
+
<div className={styles.page}>
|
|
893
|
+
<div className={styles.card}>
|
|
894
|
+
<h1 className={styles.title}>{{SITE_NAME}}</h1>
|
|
895
|
+
<div className={styles.tabs}>
|
|
896
|
+
<button
|
|
897
|
+
className={\`\${styles.tab} \${mode === "login" ? styles.active : ""}\`}
|
|
898
|
+
onClick={() => setMode("login")}
|
|
899
|
+
>
|
|
900
|
+
Login
|
|
901
|
+
</button>
|
|
902
|
+
<button
|
|
903
|
+
className={\`\${styles.tab} \${mode === "register" ? styles.active : ""}\`}
|
|
904
|
+
onClick={() => setMode("register")}
|
|
905
|
+
>
|
|
906
|
+
Register
|
|
907
|
+
</button>
|
|
908
|
+
</div>
|
|
909
|
+
<form onSubmit={handleSubmit} className={styles.form}>
|
|
910
|
+
{mode === "register" && (
|
|
911
|
+
<div className={styles.field}>
|
|
912
|
+
<label>Full Name</label>
|
|
913
|
+
<input
|
|
914
|
+
type="text" required placeholder="Your name"
|
|
915
|
+
value={form.name}
|
|
916
|
+
onChange={e => setForm({ ...form, name: e.target.value })}
|
|
917
|
+
/>
|
|
918
|
+
</div>
|
|
919
|
+
)}
|
|
920
|
+
<div className={styles.field}>
|
|
921
|
+
<label>Email</label>
|
|
922
|
+
<input
|
|
923
|
+
type="email" required placeholder="your@email.com"
|
|
924
|
+
value={form.email}
|
|
925
|
+
onChange={e => setForm({ ...form, email: e.target.value })}
|
|
926
|
+
/>
|
|
927
|
+
</div>
|
|
928
|
+
<div className={styles.field}>
|
|
929
|
+
<label>Password</label>
|
|
930
|
+
<input
|
|
931
|
+
type="password" required placeholder="\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022"
|
|
932
|
+
value={form.password}
|
|
933
|
+
onChange={e => setForm({ ...form, password: e.target.value })}
|
|
934
|
+
/>
|
|
935
|
+
</div>
|
|
936
|
+
<button type="submit" className={styles.btn}>
|
|
937
|
+
{mode === "login" ? "Sign In" : "Create Account"}
|
|
938
|
+
</button>
|
|
939
|
+
</form>
|
|
940
|
+
</div>
|
|
941
|
+
</div>
|
|
942
|
+
)
|
|
943
|
+
}
|
|
944
|
+
`,io=`.page {
|
|
945
|
+
min-height: 100vh;
|
|
946
|
+
display: flex;
|
|
947
|
+
align-items: center;
|
|
948
|
+
justify-content: center;
|
|
949
|
+
background: #f8fafc;
|
|
950
|
+
padding: 2rem;
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
.card {
|
|
954
|
+
background: white;
|
|
955
|
+
padding: 2.5rem;
|
|
956
|
+
border-radius: 16px;
|
|
957
|
+
box-shadow: 0 4px 24px rgba(0,0,0,0.08);
|
|
958
|
+
width: 100%;
|
|
959
|
+
max-width: 420px;
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
.title {
|
|
963
|
+
text-align: center;
|
|
964
|
+
font-size: 1.5rem;
|
|
965
|
+
font-weight: 800;
|
|
966
|
+
color: var(--primary);
|
|
967
|
+
margin-bottom: 1.5rem;
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
.tabs {
|
|
971
|
+
display: flex;
|
|
972
|
+
border-bottom: 2px solid #e2e8f0;
|
|
973
|
+
margin-bottom: 1.5rem;
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
.tab {
|
|
977
|
+
flex: 1;
|
|
978
|
+
padding: 0.75rem;
|
|
979
|
+
background: none;
|
|
980
|
+
border: none;
|
|
981
|
+
font-size: 0.95rem;
|
|
982
|
+
font-weight: 500;
|
|
983
|
+
color: #64748b;
|
|
984
|
+
cursor: pointer;
|
|
985
|
+
border-bottom: 2px solid transparent;
|
|
986
|
+
margin-bottom: -2px;
|
|
987
|
+
transition: all 0.2s;
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
.tab.active {
|
|
991
|
+
color: var(--primary);
|
|
992
|
+
border-bottom-color: var(--primary);
|
|
993
|
+
font-weight: 700;
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
.form { display: flex; flex-direction: column; gap: 1rem; }
|
|
997
|
+
|
|
998
|
+
.field { display: flex; flex-direction: column; gap: 0.4rem; }
|
|
999
|
+
.field label { font-size: 0.85rem; font-weight: 600; color: #374151; }
|
|
1000
|
+
|
|
1001
|
+
.field input {
|
|
1002
|
+
padding: 0.75rem 1rem;
|
|
1003
|
+
border: 1px solid #e2e8f0;
|
|
1004
|
+
border-radius: 8px;
|
|
1005
|
+
font-size: 0.95rem;
|
|
1006
|
+
outline: none;
|
|
1007
|
+
transition: border-color 0.2s;
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
.field input:focus { border-color: var(--primary); }
|
|
1011
|
+
|
|
1012
|
+
.btn {
|
|
1013
|
+
background: var(--primary);
|
|
1014
|
+
color: white;
|
|
1015
|
+
padding: 0.875rem;
|
|
1016
|
+
border: none;
|
|
1017
|
+
border-radius: 8px;
|
|
1018
|
+
font-size: 1rem;
|
|
1019
|
+
font-weight: 700;
|
|
1020
|
+
cursor: pointer;
|
|
1021
|
+
margin-top: 0.5rem;
|
|
1022
|
+
transition: opacity 0.2s;
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
.btn:hover { opacity: 0.9; }
|
|
1026
|
+
`,so=`import Link from "next/link"
|
|
1027
|
+
|
|
1028
|
+
export default function NotFound() {
|
|
1029
|
+
return (
|
|
1030
|
+
<div style={{ minHeight: "100vh", display: "flex", alignItems: "center", justifyContent: "center", textAlign: "center", padding: "2rem" }}>
|
|
1031
|
+
<div>
|
|
1032
|
+
<h1 style={{ fontSize: "6rem", fontWeight: 800, color: "var(--primary)", lineHeight: 1 }}>404</h1>
|
|
1033
|
+
<h2 style={{ fontSize: "1.5rem", fontWeight: 700, margin: "1rem 0 0.5rem" }}>Page Not Found</h2>
|
|
1034
|
+
<p style={{ color: "#64748b", marginBottom: "2rem" }}>The page you are looking for does not exist.</p>
|
|
1035
|
+
<Link href="/" style={{ background: "var(--primary)", color: "white", padding: "0.75rem 2rem", borderRadius: "8px", fontWeight: 600 }}>
|
|
1036
|
+
Go Home
|
|
1037
|
+
</Link>
|
|
1038
|
+
</div>
|
|
1039
|
+
</div>
|
|
1040
|
+
)
|
|
1041
|
+
}
|
|
1042
|
+
`,lo=`{
|
|
1043
|
+
"compilerOptions": {
|
|
1044
|
+
"target": "es5",
|
|
1045
|
+
"lib": ["dom", "dom.iterable", "esnext"],
|
|
1046
|
+
"allowJs": true,
|
|
1047
|
+
"skipLibCheck": true,
|
|
1048
|
+
"strict": true,
|
|
1049
|
+
"noEmit": true,
|
|
1050
|
+
"esModuleInterop": true,
|
|
1051
|
+
"module": "esnext",
|
|
1052
|
+
"moduleResolution": "bundler",
|
|
1053
|
+
"resolveJsonModule": true,
|
|
1054
|
+
"isolatedModules": true,
|
|
1055
|
+
"jsx": "preserve",
|
|
1056
|
+
"incremental": true,
|
|
1057
|
+
"plugins": [{ "name": "next" }],
|
|
1058
|
+
"paths": { "@/*": ["./src/*"] }
|
|
1059
|
+
},
|
|
1060
|
+
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
|
1061
|
+
"exclude": ["node_modules"]
|
|
1062
|
+
}
|
|
1063
|
+
`,co=e=>`# ${e}
|
|
1064
|
+
|
|
1065
|
+
Generated by **yuktai Vibe Coder** \u2014 open source AI plugin for Next.js.
|
|
1066
|
+
|
|
1067
|
+
## Getting Started
|
|
1068
|
+
|
|
1069
|
+
\`\`\`bash
|
|
1070
|
+
npm install
|
|
1071
|
+
npm run dev
|
|
1072
|
+
\`\`\`
|
|
1073
|
+
|
|
1074
|
+
Open [http://localhost:3000](http://localhost:3000)
|
|
1075
|
+
|
|
1076
|
+
## Tech Stack
|
|
1077
|
+
|
|
1078
|
+
- **Next.js 16** \u2014 React framework
|
|
1079
|
+
- **Tailwind CSS** \u2014 Utility-first styling
|
|
1080
|
+
- **CSS Modules** \u2014 Scoped component styles
|
|
1081
|
+
- **TypeScript** \u2014 Type safety
|
|
1082
|
+
|
|
1083
|
+
## Pages
|
|
1084
|
+
|
|
1085
|
+
All pages are in \`src/app/\` directory.
|
|
1086
|
+
Edit any page to customise content.
|
|
1087
|
+
|
|
1088
|
+
---
|
|
1089
|
+
|
|
1090
|
+
*Built with yuktai \u2014 aksharatantra.vercel.app*
|
|
1091
|
+
`});var uo={};se(uo,{generateZip:()=>Mn});function Ln(e,t){return{hotel:`Experience luxury and comfort at ${e}`,ecommerce:`Shop the best products at ${e}`,restaurant:`Delicious food crafted with love at ${e}`,portfolio:`Creative work and professional services by ${e}`,blog:`Insights, stories, and ideas from ${e}`,saas:`Powerful tools to grow your business \u2014 ${e}`,government:`Official services and information \u2014 ${e}`,healthcare:`Quality healthcare you can trust \u2014 ${e}`,education:`Learn, grow, and succeed with ${e}`,realestate:`Find your perfect property with ${e}`,landing:`The smarter way to get things done \u2014 ${e}`,generic:`Welcome to ${e} \u2014 your trusted partner`}[t]||`Welcome to ${e}`}async function Mn(e){let t=(await import("jszip")).default,o=new t,a=Xe[e.theme]||Xe.blue,r=Ln(e.siteName,e.websiteType),i=new Date().getFullYear().toString(),n={SITE_NAME:e.siteName,THEME_COLOR:a,TAGLINE:r,YEAR:i},s=b=>$t(b,n).replace(/\{\{SITE_NAME_LOWER\}\}/g,e.siteName.toLowerCase().replace(/\s+/g,""));o.file("package.json",_t(e.siteName)),o.file("next.config.js",Bt),o.file("tailwind.config.js",Gt(a)),o.file("tsconfig.json",lo),o.file("README.md",co(e.siteName)),o.file("postcss.config.js","module.exports = { plugins: { tailwindcss: {}, autoprefixer: {} } }"),o.file(".gitignore",`node_modules
|
|
1092
|
+
.next
|
|
1093
|
+
.env.local
|
|
1094
|
+
.DS_Store`),o.file("src/app/globals.css",qt(a)),o.file("src/app/layout.tsx",s(Dt)),o.file("src/app/not-found.tsx",so),o.file("src/components/Navbar.tsx",s(jt)),o.file("src/components/Navbar.module.css",Vt),o.file("src/components/Footer.tsx",s(Ut)),o.file("src/components/Footer.module.css",Yt);for(let b of e.pages)switch(b){case"home":o.file("src/app/page.tsx",s(Kt)),o.file("src/app/page.module.css",Xt);break;case"about":o.file("src/app/about/page.tsx",s(Zt)),o.file("src/app/about/page.module.css",Jt);break;case"contact":o.file("src/app/contact/page.tsx",s(Qt)),o.file("src/app/contact/page.module.css",eo);break;case"services":o.file("src/app/services/page.tsx",s(to)),o.file("src/app/services/page.module.css",oo);break;case"pricing":o.file("src/app/pricing/page.tsx",s(no)),o.file("src/app/pricing/page.module.css",ao);break;case"auth":o.file("src/app/auth/page.tsx",s(ro)),o.file("src/app/auth/page.module.css",io);break;default:o.file(`src/app/${b}/page.tsx`,Rn(b,e.siteName,a,n,s));break}let c=await o.generateAsync({type:"blob"}),p=URL.createObjectURL(c),h=document.createElement("a");h.href=p,h.download=`${e.siteName.toLowerCase().replace(/\s+/g,"-")}-nextjs.zip`,document.body.appendChild(h),h.click(),document.body.removeChild(h),URL.revokeObjectURL(p)}function Rn(e,t,o,a,r){let i=e.charAt(0).toUpperCase()+e.slice(1);return`import styles from "./page.module.css"
|
|
1095
|
+
|
|
1096
|
+
export default function ${i}Page() {
|
|
1097
|
+
return (
|
|
1098
|
+
<div style={{ minHeight: "100vh" }}>
|
|
1099
|
+
<section style={{
|
|
1100
|
+
background: "${o}",
|
|
1101
|
+
color: "white",
|
|
1102
|
+
padding: "5rem 1rem",
|
|
1103
|
+
textAlign: "center"
|
|
1104
|
+
}}>
|
|
1105
|
+
<h1 style={{ fontSize: "2.5rem", fontWeight: 800, marginBottom: "1rem" }}>
|
|
1106
|
+
${i}
|
|
1107
|
+
</h1>
|
|
1108
|
+
<p style={{ fontSize: "1.1rem", opacity: 0.85 }}>
|
|
1109
|
+
${t} \u2014 ${i} page
|
|
1110
|
+
</p>
|
|
1111
|
+
</section>
|
|
1112
|
+
<section style={{ padding: "4rem 1rem", maxWidth: "1100px", margin: "0 auto" }}>
|
|
1113
|
+
<p style={{ color: "#64748b", fontSize: "1rem", textAlign: "center" }}>
|
|
1114
|
+
This is the ${i} page. Edit this file to add your content.
|
|
1115
|
+
</p>
|
|
1116
|
+
</section>
|
|
1117
|
+
</div>
|
|
1118
|
+
)
|
|
1119
|
+
}
|
|
1120
|
+
`}var mo=X(()=>{"use strict";g();po()});var ho={};se(ho,{getPageText:()=>fo,highlightField:()=>bo,runAgent:()=>On,scanFormFields:()=>go,scrollToSection:()=>yo});function Y(e){try{let t=window.getComputedStyle(e);if(t.display==="none"||t.visibility==="hidden"||t.opacity==="0"||e.hidden)return!1;let o=e.getBoundingClientRect();return!(o.width===0&&o.height===0)}catch{return!0}}function fo(){let e=[],t=new Set,o=n=>{let s=n.trim();s&&s.length>10&&!t.has(s)&&(t.add(s),e.push(s))};document.title&&o(document.title);let a=['meta[name="description"]','meta[name="keywords"]','meta[property="og:title"]','meta[property="og:description"]','meta[name="twitter:title"]','meta[name="twitter:description"]'];for(let n of a){let s=document.querySelector(n)?.getAttribute("content");s&&o(s)}let r=["h1","h2","h3","h4","h5","h6","p","blockquote","q","pre","code","li","dt","dd","th","td","caption","a","b","strong","em","i","u","s","abbr","acronym","cite","dfn","mark","small","sub","sup","ins","del","bdi","bdo","article","section","aside","nav","header","footer","main","summary","details","figcaption","figure","address","time","output","label","legend","option","button","font","center","span","div","[role='heading']","[role='main']","[role='article']","[role='region']","[role='complementary']","[role='contentinfo']","[role='navigation']","[role='banner']","[role='listitem']","[role='cell']","[role='columnheader']","[role='rowheader']"],i=document.querySelectorAll(r.join(","));for(let n of i){if(n.closest("[data-yuktai-panel]")||!Y(n)||n.querySelector("p, h1, h2, h3, h4, h5, h6, li, td, th, div, article, section, blockquote, pre"))continue;let c=n.innerText?.trim();if(c&&c.length>10&&o(c),!c){let A=n.textContent?.trim();A&&A.length>10&&o(A)}let p=n.getAttribute("aria-label")?.trim();p&&p.length>5&&o(p);let h=n.getAttribute("aria-description")?.trim();h&&h.length>5&&o(h);let b=n.getAttribute("aria-valuetext")?.trim();b&&o(b);let $=n.getAttribute("title")?.trim();$&&$.length>5&&o($);let N=n.getAttribute("data-label")?.trim();N&&o(N);let G=n.getAttribute("data-title")?.trim();G&&o(G),n.querySelectorAll("img").forEach(A=>{let x=A.getAttribute("alt")?.trim();x&&x.length>5&&o(x);let z=A.getAttribute("title")?.trim();z&&z.length>5&&o(z)})}document.querySelectorAll("img").forEach(n=>{if(n.closest("[data-yuktai-panel]")||!Y(n))return;let s=n.getAttribute("alt")?.trim(),c=n.getAttribute("title")?.trim();s&&s.length>5&&o(s),c&&c.length>5&&o(c)}),document.querySelectorAll("input:not([type=hidden]), textarea").forEach(n=>{if(n.closest("[data-yuktai-panel]")||!Y(n))return;n.placeholder&&o(n.placeholder),n.value&&n.value.length>3&&o(n.value);let s=n.getAttribute("aria-label")?.trim();s&&o(s)}),document.querySelectorAll("select").forEach(n=>{n.closest("[data-yuktai-panel]")||Y(n)&&Array.from(n.options).forEach(s=>{s.text?.trim().length>3&&o(s.text.trim())})}),document.querySelectorAll("td, th").forEach(n=>{if(n.closest("[data-yuktai-panel]")||!Y(n))return;let s=n.innerText?.trim();s&&s.length>3&&o(s)});try{document.querySelectorAll("iframe").forEach(n=>{try{let s=n.contentDocument;if(!s)return;let c=s.body?.innerText?.trim();c&&c.length>20&&o(c.slice(0,500))}catch{}})}catch{}return document.querySelectorAll("a").forEach(n=>{if(n.closest("[data-yuktai-panel]")||!Y(n))return;let s=n.innerText?.trim();s&&s.length>3&&s.length<100&&o(s)}),e.join(" ").slice(0,5e3)}function In(e){let t=e.getAttribute("aria-label")?.trim();if(t)return t;let o=e.getAttribute("aria-labelledby");if(o){let c=document.getElementById(o);if(c)return c.innerText?.trim()||""}if(e.id){let c=document.querySelector(`label[for="${e.id}"]`);if(c)return c.innerText?.trim()||""}let a=e.closest("label");if(a){let c=a.cloneNode(!0);return c.querySelectorAll("input, select, textarea").forEach(p=>p.remove()),c.innerText?.trim()||""}if((e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&e.placeholder)return e.placeholder;if(e.name)return e.name.replace(/[_-]/g," ");let r=e.previousSibling;if(r?.nodeType===Node.TEXT_NODE){let c=r.textContent?.trim();if(c&&c.length>1)return c}let i=e.previousElementSibling;if(i){let c=i.innerText?.trim();if(c&&c.length>1&&c.length<60)return c}let n=e.closest("td, th");if(n){let c=n.previousElementSibling;if(c){let p=c.innerText?.trim();if(p&&p.length>1)return p}}let s=e.getAttribute("title")?.trim();return s||(e instanceof HTMLInputElement?e.type:"field")}function go(){let e=[],t=document.querySelectorAll(["input:not([type=hidden])","input:not([type=submit])","input:not([type=button])","input:not([type=reset])","input:not([type=image])","select","textarea","[contenteditable='true']","[role='textbox']","[role='combobox']","[role='spinbutton']","[role='searchbox']","[role='listbox']"].join(", "));for(let o of t){if(o.closest("[data-yuktai-panel]")||!Y(o))continue;if(o instanceof HTMLInputElement){let r=o.type.toLowerCase();if(["submit","button","reset","image"].includes(r))continue}let a=In(o);e.push({label:a,type:o instanceof HTMLInputElement?o.type:o.tagName.toLowerCase(),placeholder:(o instanceof HTMLInputElement||o instanceof HTMLTextAreaElement)&&o.placeholder||"",required:o.required||o.getAttribute("aria-required")==="true"||o.getAttribute("data-required")==="true",element:o})}return e}function bo(e,t=3e3){e.scrollIntoView({behavior:"smooth",block:"center"}),e.style.outline="3px solid #0d9488",e.style.outlineOffset="3px";try{e.focus()}catch{}setTimeout(()=>{e.style.outline="",e.style.outlineOffset=""},t)}function yo(e){let t=e.toLowerCase(),o=document.querySelectorAll("h1, h2, h3, h4, h5, h6, section, article, [id], [aria-label], [role='heading'], [role='region']");for(let a of o){if(a.closest("[data-yuktai-panel]")||!Y(a))continue;if((a.innerText||a.getAttribute("id")||a.getAttribute("aria-label")||a.getAttribute("name")||"").toLowerCase().includes(t))return a.scrollIntoView({behavior:"smooth",block:"center"}),a.style.outline="2px solid #0d9488",a.style.outlineOffset="4px",setTimeout(()=>{a.style.outline="",a.style.outlineOffset=""},2500),!0}return!1}async function Hn(e,t,o){let a=window,r=a.LanguageModel||a.ai?.languageModel;if(!r)throw new Error("Gemini Nano not available");let i=await r.create({systemPrompt:`You are a helpful web accessibility agent.
|
|
13
1121
|
Create a simple action plan to help a user complete a task on a webpage.
|
|
14
1122
|
Rules:
|
|
15
1123
|
- Maximum 5 steps
|
|
16
1124
|
- Short and clear \u2014 no jargon
|
|
17
1125
|
- If filling a form \u2014 list each field and what to enter
|
|
18
1126
|
- No markdown \u2014 no asterisks, no bold, no headers
|
|
19
|
-
- Number each step: 1. 2. 3.`}),
|
|
1127
|
+
- Number each step: 1. 2. 3.`}),s=`Page content: ${e}${o?`
|
|
20
1128
|
The page has form fields the user may need to fill.`:""}
|
|
21
1129
|
|
|
22
1130
|
User task: ${t}
|
|
23
1131
|
|
|
24
|
-
Action plan:`,
|
|
1132
|
+
Action plan:`,c=await i.prompt(s);return i.destroy(),c?.trim()||""}async function Fn(e,t){let{askPageWithTransformers:o}=await Promise.resolve().then(()=>(de(),Ue));return(await o(`How do I: ${t}`)).answer||"I could not create a plan for this task."}async function On(e,t,o){if(!e.trim())return{success:!1,steps:[],error:"Please tell me what you want to do."};if(!t)return{success:!1,steps:[],error:"No AI engine available on this device."};let a=[],r=(i,n="info")=>{let s={text:i,type:n};a.push(s),o(s)};try{r("\u{1F4D6} Reading page content...","info");let i=fo(),n=go(),s=n.length>0;i.length<50&&r("\u26A0\uFE0F Page content is very limited. This may be a static image page.","error"),r(s?`\u{1F4CB} Found ${n.length} form field${n.length!==1?"s":""} on this page`:"\u{1F4C4} No form fields found \u2014 this appears to be a content page","info"),r("\u{1F916} Creating action plan...","info");let c="";try{t==="gemini"?c=await Hn(i,e,s):c=await Fn(i,e)}catch{c=s?`1. Locate the form on this page
|
|
25
1133
|
2. Fill each required field
|
|
26
1134
|
3. Review your answers
|
|
27
1135
|
4. Submit the form`:`1. Read the page carefully
|
|
28
1136
|
2. Find the section relevant to your task
|
|
29
|
-
3. Follow the on-page instructions`}if(
|
|
1137
|
+
3. Follow the on-page instructions`}if(c&&(r("\u2705 Your action plan:","success"),c.split(/\n/).map(p=>p.replace(/\*\*/g,"").replace(/\*/g,"").trim()).filter(p=>p.length>5).slice(0,6).forEach(p=>r(` ${p}`,"action"))),s){let p=n[0];r(`\u{1F3AF} First field: "${p.label}"${p.required?" \u2605 required":""}`,"field"),bo(p.element),n.length>1&&r(`\u{1F4DD} All ${n.length} fields: ${n.map(h=>h.label).join(" \u2192 ")}`,"info")}else{let p=e.toLowerCase().split(/\s+/).filter(b=>b.length>3),h=!1;for(let b of p)if(yo(b)){r(`\u{1F3AF} Scrolled to relevant section: "${b}"`,"action"),h=!0;break}h||r("\u{1F4A1} Scroll through the page to find what you need.","info")}return r("\u2705 Ready. Follow the steps above. Ask me again if you need more help.","success"),{success:!0,steps:a}}catch(i){let n=i instanceof Error?i.message:"Agent error.";return r(`\u26A0\uFE0F ${n}`,"error"),{success:!1,steps:a,error:n}}}var xo=X(()=>{"use strict";g()});var Bn={};se(Bn,{Runtime:()=>K,YuktAI:()=>_n,YuktAIWrapper:()=>Me,aiPlugin:()=>ue,default:()=>Me,voicePlugin:()=>me,wcag:()=>P,wcagPlugin:()=>P});module.exports=zo(Bn);g();g();g();function lt(){let e=window;return e.Rewriter||e.ai?.rewriter||null}async function ze(){try{let e=lt();if(!e)return!1;if(typeof e.availability=="function"){let t=await e.availability();return t==="readily"||t==="available"||t==="downloadable"}return typeof e.capabilities=="function"?(await e.capabilities())?.available!=="no":typeof e.create=="function"}catch{return!1}}async function Io(e){if(!e||e.trim().length<20)return{success:!1,original:e,rewritten:e,error:"Text too short"};try{let t=lt();if(!t)throw new Error("Rewriter API not available");let o=await t.create({tone:"more-casual",format:"plain-text",length:"as-is",outputLanguage:"en"}),a=await o.rewrite(e,{context:"Rewrite this text in simple plain English. Use short sentences. Avoid jargon. Make it easy to understand for everyone."});return o.destroy(),{success:!0,original:e,rewritten:a.trim()}}catch(t){return{success:!1,original:e,rewritten:e,error:t instanceof Error?t.message:"Rewrite failed"}}}async function ct(){if(!await ze())return{fixed:0,error:"Chrome Built-in AI Rewriter not available. Enable via chrome://flags."};let t=document.querySelectorAll("p, h1, h2, h3, h4, h5, h6, li, blockquote, td, th, label, figcaption"),o=0;for(let a of t){let r=a.innerText?.trim();if(!r||r.length<20||a.closest("[data-yuktai-panel]"))continue;let i=await Io(r);i.success&&i.rewritten!==r&&(a.dataset.yuktaiOriginal=r,a.innerText=i.rewritten,o++)}return{fixed:o}}function dt(){let e=document.querySelectorAll("[data-yuktai-original]");for(let t of e){let o=t.dataset.yuktaiOriginal;o&&(t.innerText=o,delete t.dataset.yuktaiOriginal)}}g();var pt="yuktai-summary-box";function ut(){let e=window;return e.Summarizer||e.ai?.summarizer||null}async function Ie(){try{let e=ut();if(!e)return!1;if(typeof e.availability=="function"){let t=await e.availability();return t==="readily"||t==="available"||t==="downloadable"}return typeof e.capabilities=="function"?(await e.capabilities())?.available!=="no":typeof e.create=="function"}catch{return!1}}function Ho(){let e=document.querySelectorAll("p, h1, h2, h3, h4, h5, h6, li, blockquote, article, section"),t=[];for(let o of e){if(o.closest("[data-yuktai-panel]"))continue;let a=window.getComputedStyle(o);if(a.display==="none"||a.visibility==="hidden")continue;let r=o.innerText?.trim();r&&r.length>10&&t.push(r)}return t.join(" ").slice(0,5e3)}async function mt(){if(!await Ie())return{success:!1,summary:"",error:"Chrome Built-in AI Summarizer not available. Enable via chrome://flags."};let t=Ho();if(!t||t.length<100)return{success:!1,summary:"",error:"Not enough text on this page to summarise."};try{let o=ut();if(!o)throw new Error("Summarizer API not available");let a=await o.create({type:"tl;dr",format:"plain-text",length:"short",outputLanguage:"en"}),r=await a.summarize(t,{context:"Summarise this page in 2-3 simple sentences for a screen reader user who wants to know if this page is relevant to them."});return a.destroy(),Fo(r.trim()),{success:!0,summary:r.trim()}}catch(o){return{success:!1,summary:"",error:o instanceof Error?o.message:"Summary failed"}}}function Fo(e){we();let t=document.createElement("div");t.id=pt,t.setAttribute("data-yuktai-panel","true"),t.setAttribute("role","region"),t.setAttribute("aria-label","Page summary by yuktai"),t.style.cssText=`
|
|
30
1138
|
position: fixed;
|
|
31
1139
|
top: 0;
|
|
32
1140
|
left: 0;
|
|
@@ -43,11 +1151,11 @@ Action plan:`,d=await s.prompt(l);return s.destroy(),d?.trim()||""}async functio
|
|
|
43
1151
|
justify-content: space-between;
|
|
44
1152
|
gap: 12px;
|
|
45
1153
|
box-shadow: 0 2px 8px rgba(0,0,0,0.15);
|
|
46
|
-
`;let
|
|
1154
|
+
`;let o=document.createElement("p");o.style.cssText="margin: 0; flex: 1;",o.textContent=`\u{1F4CB} Page summary: ${e}`;let a=document.createElement("button");a.textContent="\xD7",a.setAttribute("aria-label","Close page summary"),a.style.cssText=`
|
|
47
1155
|
background: none; border: none; color: #ffffff;
|
|
48
1156
|
font-size: 20px; cursor: pointer; padding: 0 4px;
|
|
49
1157
|
line-height: 1; flex-shrink: 0;
|
|
50
|
-
`,a.addEventListener("click",
|
|
1158
|
+
`,a.addEventListener("click",we),t.appendChild(o),t.appendChild(a),document.body.prepend(t)}function we(){let e=document.getElementById(pt);e&&e.remove()}g();var Se=[{code:"en",label:"English"},{code:"hi",label:"Hindi"},{code:"es",label:"Spanish"},{code:"fr",label:"French"},{code:"de",label:"German"},{code:"it",label:"Italian"},{code:"pt",label:"Portuguese"},{code:"nl",label:"Dutch"},{code:"pl",label:"Polish"},{code:"ru",label:"Russian"},{code:"ja",label:"Japanese"},{code:"ko",label:"Korean"},{code:"zh",label:"Chinese"},{code:"ar",label:"Arabic"},{code:"tr",label:"Turkish"},{code:"vi",label:"Vietnamese"},{code:"bn",label:"Bengali"},{code:"id",label:"Indonesian"}],ke="en";function Oo(){let e=window;return e.Translator||e.translation||null}async function Wo(e){try{let t=window;if(!Oo())return!1;if(t.Translator&&typeof t.Translator.availability=="function")try{let a=await t.Translator.availability({sourceLanguage:"en",targetLanguage:e});return a==="readily"||a==="available"||a==="downloadable"||a==="after-download"}catch{}return t.Translator&&typeof t.Translator.canTranslate=="function"?await t.Translator.canTranslate({sourceLanguage:"en",targetLanguage:e})!=="no":t.translation&&typeof t.translation.canTranslate=="function"?await t.translation.canTranslate({sourceLanguage:"en",targetLanguage:e})!=="no":!1}catch{return!1}}async function $o(e){let t=window,o={sourceLanguage:"en",targetLanguage:e};if(t.Translator&&typeof t.Translator.create=="function")return await t.Translator.create(o);if(t.translation&&typeof t.translation.createTranslator=="function")return await t.translation.createTranslator(o);throw new Error("Translation API not available")}async function ft(e){if(e===ke)return{success:!0,language:e,fixed:0};if(e==="en")return He(),ke="en",{success:!0,language:"en",fixed:0};if(!await Wo(e))return{success:!1,language:e,fixed:0,error:`Translation to ${e} not available. Enable via chrome://flags.`};try{let o=await $o(e),a=document.querySelectorAll("p, h1, h2, h3, h4, h5, h6, li, blockquote, td, th, label, figcaption, span, a"),r=0;for(let i of a){if(i.closest("[data-yuktai-panel]")||i.children.length>0)continue;let n=i.innerText?.trim();if(!n||n.length<2)continue;i.dataset.yuktaiTranslationOriginal||(i.dataset.yuktaiTranslationOriginal=n);let s=await o.translate(n);s&&s!==n&&(i.innerText=s,r++)}return typeof o.destroy=="function"&&o.destroy(),ke=e,{success:!0,language:e,fixed:r}}catch(o){return{success:!1,language:e,fixed:0,error:o instanceof Error?o.message:"Translation failed"}}}function He(){let e=document.querySelectorAll("[data-yuktai-translation-original]");for(let t of e){let o=t.dataset.yuktaiTranslationOriginal;o&&(t.innerText=o,delete t.dataset.yuktaiTranslationOriginal)}ke="en"}g();var _o=[{phrases:["go to main","skip to main","main content"],action:"focus-main",label:"Jump to main content"},{phrases:["go to navigation","go to nav","open menu"],action:"focus-nav",label:"Jump to navigation"},{phrases:["go to search","search","find"],action:"focus-search",label:"Jump to search"},{phrases:["scroll down","page down","next"],action:"scroll-down",label:"Scroll down"},{phrases:["scroll up","page up","back up"],action:"scroll-up",label:"Scroll up"},{phrases:["go back","previous page"],action:"go-back",label:"Go back"},{phrases:["click","press","select"],action:"click-focused",label:"Click focused element"},{phrases:["next item","tab forward","tab"],action:"tab-forward",label:"Move to next element"},{phrases:["previous item","tab back","shift tab"],action:"tab-back",label:"Move to previous element"},{phrases:["stop listening","stop voice","quiet"],action:"stop-voice",label:"Stop voice control"}],O=null,Ae=!1,Z=null;function Fe(){return!!(window.SpeechRecognition||window.webkitSpeechRecognition)}function Bo(e){let t=e.toLowerCase().trim();for(let o of _o)for(let a of o.phrases)if(t.includes(a))return{action:o.action,label:o.label};return null}function Go(e){switch(e){case"focus-main":{let t=document.querySelector("main, [role='main'], #main");t&&(t.focus(),t.scrollIntoView({behavior:"smooth"}));break}case"focus-nav":{let t=document.querySelector("nav, [role='navigation']");t&&(t.focus(),t.scrollIntoView({behavior:"smooth"}));break}case"focus-search":{let t=document.querySelector("input[type='search'], input[role='searchbox'], [aria-label*='search' i]");t&&(t.focus(),t.scrollIntoView({behavior:"smooth"}));break}case"scroll-down":{window.scrollBy({top:400,behavior:"smooth"});break}case"scroll-up":{window.scrollBy({top:-400,behavior:"smooth"});break}case"go-back":{window.history.back();break}case"click-focused":{let t=document.activeElement;t&&t!==document.body&&t.click();break}case"tab-forward":{let t=gt(),o=t.indexOf(document.activeElement),a=t[o+1]||t[0];a&&a.focus();break}case"tab-back":{let t=gt(),o=t.indexOf(document.activeElement),a=t[o-1]||t[t.length-1];a&&a.focus();break}case"stop-voice":{Oe();break}}}function gt(){return Array.from(document.querySelectorAll('a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')).filter(e=>!e.closest("[data-yuktai-panel]"))}function bt(e){if(!Fe())return!1;if(Ae)return!0;e&&(Z=e);let t=window.SpeechRecognition||window.webkitSpeechRecognition;return O=new t,O.continuous=!0,O.interimResults=!1,O.lang="en-US",O.onresult=o=>{let a=o.results[o.results.length-1][0].transcript,r=Bo(a);if(r){Go(r.action);let i={success:!0,command:a,action:r.label};if(Z&&Z(i),r.action==="stop-voice")return}},O.onend=()=>{Ae&&O?.start()},O.onerror=o=>{o.error!=="no-speech"&&Z&&Z({success:!1,command:"",action:"",error:`Voice error: ${o.error}`})},O.start(),Ae=!0,qo(),!0}function Oe(){Ae=!1,O&&(O.stop(),O=null),Z=null,ht()}var yt="yuktai-voice-indicator";function qo(){ht();let e=document.createElement("div");e.id=yt,e.setAttribute("data-yuktai-panel","true"),e.setAttribute("aria-live","polite"),e.setAttribute("aria-label","yuktai voice control is listening"),e.style.cssText=`
|
|
51
1159
|
position: fixed;
|
|
52
1160
|
bottom: 80px;
|
|
53
1161
|
left: 50%;
|
|
@@ -77,7 +1185,7 @@ Action plan:`,d=await s.prompt(l);return s.destroy(),d?.trim()||""}async functio
|
|
|
77
1185
|
0%, 100% { opacity: 1; transform: scale(1); }
|
|
78
1186
|
50% { opacity: 0.4; transform: scale(0.7); }
|
|
79
1187
|
}
|
|
80
|
-
`,document.head.appendChild(a)}let
|
|
1188
|
+
`,document.head.appendChild(a)}let o=document.createElement("span");o.textContent="Listening for commands...",e.appendChild(t),e.appendChild(o),document.body.appendChild(e)}function ht(){let e=document.getElementById(yt);e&&e.remove()}g();var Do=["button:not([aria-label]):not([aria-labelledby])","a:not([aria-label]):not([aria-labelledby])","input:not([aria-label]):not([aria-labelledby]):not([id])","select:not([aria-label]):not([aria-labelledby])","textarea:not([aria-label]):not([aria-labelledby])","[role='button']:not([aria-label])","[role='link']:not([aria-label])","[role='checkbox']:not([aria-label])","[role='tab']:not([aria-label])"].join(", ");function xt(){let e=window;return e.Writer||e.ai?.writer||null}async function We(){try{let e=xt();if(!e)return!1;if(typeof e.availability=="function"){let t=await e.availability();return t==="readily"||t==="available"||t==="downloadable"}return typeof e.capabilities=="function"?(await e.capabilities())?.available!=="no":typeof e.create=="function"}catch{return!1}}function jo(e){let t=[],o=e.innerText?.trim();o&&t.push(`element text: "${o}"`);let a=e.placeholder?.trim();a&&t.push(`placeholder: "${a}"`);let r=e.getAttribute("name")?.trim();r&&t.push(`name: "${r}"`);let i=e.getAttribute("type")?.trim();i&&t.push(`type: "${i}"`);let n=e.id;if(n){let p=document.querySelector(`label[for="${n}"]`);p&&t.push(`label: "${p.innerText?.trim()}"`)}let s=e.parentElement?.innerText?.trim().slice(0,60);s&&t.push(`parent context: "${s}"`),t.push(`tag: ${e.tagName.toLowerCase()}`);let c=e.getAttribute("role");return c&&t.push(`role: ${c}`),t.join(". ")}async function Vo(e,t){let o=`
|
|
81
1189
|
Generate a short, clear aria-label for an HTML element.
|
|
82
1190
|
The label must be 2-6 words maximum.
|
|
83
1191
|
The label must describe what the element does or what it is.
|
|
@@ -88,7 +1196,7 @@ Action plan:`,d=await s.prompt(l);return s.destroy(),d?.trim()||""}async functio
|
|
|
88
1196
|
${t}
|
|
89
1197
|
|
|
90
1198
|
Output only the label. Nothing else.
|
|
91
|
-
`.trim();return(await e.write(
|
|
1199
|
+
`.trim();return(await e.write(o)).trim().replace(/^["']|["']$/g,"").replace(/\.$/,"").trim()}async function vt(){if(!await We())return{success:!1,fixed:0,elements:[],error:"Chrome Built-in AI Writer not available. Enable via chrome://flags."};let t=document.querySelectorAll(Do);if(t.length===0)return{success:!0,fixed:0,elements:[]};try{let o=xt();if(!o)throw new Error("Writer API not available");let a=await o.create({tone:"neutral",format:"plain-text",length:"short",outputLanguage:"en"}),r=0,i=[];for(let n of t){if(n.closest("[data-yuktai-panel]"))continue;let s=window.getComputedStyle(n);if(s.display==="none"||s.visibility==="hidden")continue;let c=jo(n),p=await Vo(a,c);p&&p.length>0&&(n.dataset.yuktaiLabelOriginal=n.getAttribute("aria-label")||"",n.setAttribute("aria-label",p),r++,i.push({tag:n.tagName.toLowerCase(),label:p}))}return a.destroy(),{success:!0,fixed:r,elements:i}}catch(o){return{success:!1,fixed:0,elements:[],error:o instanceof Error?o.message:"Label generation failed"}}}function wt(){let e=document.querySelectorAll("[data-yuktai-label-original]");for(let t of e){let o=t.dataset.yuktaiLabelOriginal;o?t.setAttribute("aria-label",o):t.removeAttribute("aria-label"),delete t.dataset.yuktaiLabelOriginal}}var Ce=null,kt=null;var St=null,$e=null,S=null,J=null,Te=null,_e=null,Q=null,Ee={deuteranopia:"yuktai-cb-d",protanopia:"yuktai-cb-p",tritanopia:"yuktai-cb-t"};var At=new Set(["input","select","textarea"]);var Be={nav:"navigation",header:"banner",footer:"contentinfo",main:"main",aside:"complementary"};function Ge(e,t="polite"){if(typeof window>"u"||!Q?.speechEnabled||!window.speechSynthesis)return;window.speechSynthesis.cancel();let o=new SpeechSynthesisUtterance(e);o.rate=1,o.pitch=1,o.volume=1;let a=window.speechSynthesis.getVoices();a.length>0&&(o.voice=a[0]),window.speechSynthesis.speak(o)}function Pt(e,t="info"){if(typeof document>"u")return;let a={success:{bg:"#0f9d58",border:"#0a7a44",icon:"\u2713"},error:{bg:"#d93025",border:"#b52a1c",icon:"\u2715"},warning:{bg:"#f29900",border:"#c67c00",icon:"\u26A0"},info:{bg:"#1a73e8",border:"#1557b0",icon:"\u2139"}}[t];S||(S=document.createElement("div"),S.setAttribute("role","alert"),S.setAttribute("aria-live","assertive"),S.setAttribute("aria-atomic","true"),S.style.cssText=`
|
|
92
1200
|
position: fixed;
|
|
93
1201
|
top: 80px;
|
|
94
1202
|
right: 16px;
|
|
@@ -107,14 +1215,14 @@ Action plan:`,d=await s.prompt(l);return s.destroy(),d?.trim()||""}async functio
|
|
|
107
1215
|
transition: transform 0.3s, opacity 0.3s;
|
|
108
1216
|
transform: translateX(120%);
|
|
109
1217
|
opacity: 0;
|
|
110
|
-
`,document.body.appendChild(
|
|
1218
|
+
`,document.body.appendChild(S)),S.style.background=a.bg,S.style.border=`1px solid ${a.border}`,S.style.color="#fff",S.innerHTML=`
|
|
111
1219
|
<span style="font-size:18px;font-weight:700">${a.icon}</span>
|
|
112
1220
|
<span style="flex:1;line-height:1.4">${e}</span>
|
|
113
1221
|
<button
|
|
114
1222
|
onclick="this.parentElement.style.transform='translateX(120%)';this.parentElement.style.opacity='0'"
|
|
115
1223
|
style="background:none;border:none;color:#fff;cursor:pointer;font-size:18px;padding:0;line-height:1"
|
|
116
1224
|
aria-label="Close notification">\xD7</button>
|
|
117
|
-
`,window.innerWidth<=480&&(
|
|
1225
|
+
`,window.innerWidth<=480&&(S.style.right="8px",S.style.left="8px",S.style.maxWidth="none",S.style.width="auto"),requestAnimationFrame(()=>{S&&(S.style.transform="translateX(0)",S.style.opacity="1")}),setTimeout(()=>{S&&(S.style.transform="translateX(120%)",S.style.opacity="0")},5e3)}function w(e,t="info",o=!0){Ce&&(Ce.textContent=e),Pt(e,t),o&&Ge(e,t==="error"?"assertive":"polite")}function Uo(){if(typeof document>"u"||St)return;let e=[{label:"Skip to main content",selector:"main,[role='main'],#main,#main-content"},{label:"Skip to navigation",selector:"nav,[role='navigation'],#nav,#navigation"},{label:"Skip to search",selector:"[role='search'],#search,input[type='search']"}],t=document.createElement("div");t.setAttribute("data-yuktai-skip-bar","true"),t.setAttribute("role","navigation"),t.setAttribute("aria-label","Skip links"),t.style.cssText=`
|
|
118
1226
|
position: fixed;
|
|
119
1227
|
top: 0;
|
|
120
1228
|
left: 0;
|
|
@@ -128,7 +1236,7 @@ Action plan:`,d=await s.prompt(l);return s.destroy(),d?.trim()||""}async functio
|
|
|
128
1236
|
transform: translateY(-100%);
|
|
129
1237
|
transition: transform 0.2s ease;
|
|
130
1238
|
font-family: system-ui, sans-serif;
|
|
131
|
-
`;let
|
|
1239
|
+
`;let o=!1;if(e.forEach(({label:r,selector:i})=>{let n=document.querySelector(i);if(!n)return;o=!0,n.getAttribute("tabindex")||n.setAttribute("tabindex","-1");let s=document.createElement("a");s.href="#",s.textContent=r,s.style.cssText=`
|
|
132
1240
|
color: #fff;
|
|
133
1241
|
background: #1a73e8;
|
|
134
1242
|
padding: 8px 14px;
|
|
@@ -139,7 +1247,7 @@ Action plan:`,d=await s.prompt(l);return s.destroy(),d?.trim()||""}async functio
|
|
|
139
1247
|
white-space: nowrap;
|
|
140
1248
|
border: 2px solid transparent;
|
|
141
1249
|
transition: background 0.15s, border-color 0.15s;
|
|
142
|
-
`,
|
|
1250
|
+
`,s.addEventListener("focus",()=>{t.style.transform="translateY(0)"}),s.addEventListener("blur",()=>{setTimeout(()=>{t.matches(":focus-within")||(t.style.transform="translateY(-100%)")},2e3)}),s.addEventListener("click",c=>{c.preventDefault(),n.focus(),n.scrollIntoView({behavior:"smooth",block:"start"}),w(`Jumped to ${r.replace("Skip to ","")}`,"info"),t.style.transform="translateY(-100%)"}),t.appendChild(s)}),!o)return;window.innerWidth<768&&(t.style.transform="translateY(0)",t.style.position="sticky"),window.addEventListener("resize",()=>{window.innerWidth<768&&(t.style.transform="translateY(0)")}),document.body.insertBefore(t,document.body.firstChild),St=t}function Yo(){if(typeof document>"u"||document.querySelector("[data-yuktai-focus-style]"))return;let e=document.createElement("style");e.setAttribute("data-yuktai-focus-style","true"),e.textContent=`
|
|
143
1251
|
|
|
144
1252
|
/* \u2500\u2500 Focus indicator \u2014 WCAG 2.4.11 minimum 2px solid \u2500\u2500 */
|
|
145
1253
|
[data-yuktai-a11y] *:focus-visible {
|
|
@@ -285,7 +1393,7 @@ Action plan:`,d=await s.prompt(l);return s.destroy(),d?.trim()||""}async functio
|
|
|
285
1393
|
width: auto !important;
|
|
286
1394
|
}
|
|
287
1395
|
}
|
|
288
|
-
`,document.head.appendChild(e),document.documentElement.setAttribute("data-yuktai-a11y","true")}function
|
|
1396
|
+
`,document.head.appendChild(e),document.documentElement.setAttribute("data-yuktai-a11y","true")}function Ko(){typeof document>"u"||document.querySelector("[data-yuktai-kb-init]")||(document.documentElement.setAttribute("data-yuktai-kb-init","true"),document.addEventListener("keydown",e=>{let t=document.activeElement;if(!t)return;let o=t.getAttribute("role")||"";if(e.key==="Escape"){let a=t.closest("[role='dialog'],[role='alertdialog']");if(a){a.style.display="none",w("Dialog closed","info");return}let r=t.closest("[role='menu'],[role='menubar']");r&&(r.style.display="none",w("Menu closed","info"))}if(o==="menuitem"||t.closest("[role='menu'],[role='menubar']")){let a=t.closest("[role='menu'],[role='menubar']");if(!a)return;let r=Array.from(a.querySelectorAll("[role='menuitem']:not([disabled])")),i=r.indexOf(t);e.key==="ArrowDown"||e.key==="ArrowRight"?(e.preventDefault(),r[(i+1)%r.length]?.focus()):e.key==="ArrowUp"||e.key==="ArrowLeft"?(e.preventDefault(),r[(i-1+r.length)%r.length]?.focus()):e.key==="Home"?(e.preventDefault(),r[0]?.focus()):e.key==="End"&&(e.preventDefault(),r[r.length-1]?.focus())}if(o==="tab"||t.closest("[role='tablist']")){let a=t.closest("[role='tablist']");if(!a)return;let r=Array.from(a.querySelectorAll("[role='tab']:not([disabled])")),i=r.indexOf(t);if(e.key==="ArrowRight"||e.key==="ArrowDown"){e.preventDefault();let n=r[(i+1)%r.length];n?.focus(),n?.click()}else if(e.key==="ArrowLeft"||e.key==="ArrowUp"){e.preventDefault();let n=r[(i-1+r.length)%r.length];n?.focus(),n?.click()}}if(o==="option"||t.closest("[role='listbox']")){let a=t.closest("[role='listbox']");if(!a)return;let r=Array.from(a.querySelectorAll("[role='option']:not([aria-disabled='true'])")),i=r.indexOf(t);e.key==="ArrowDown"?(e.preventDefault(),r[(i+1)%r.length]?.focus()):e.key==="ArrowUp"?(e.preventDefault(),r[(i-1+r.length)%r.length]?.focus()):(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),t.setAttribute("aria-selected","true"),r.forEach(n=>{n!==t&&n.setAttribute("aria-selected","false")}),w(`Selected: ${t.textContent?.trim()}`,"success"))}e.altKey&&e.key==="a"&&(e.preventDefault(),Xo()),e.key==="Tab"&&Q?.speechEnabled&&setTimeout(()=>{let a=document.activeElement;if(!a)return;let r=a.getAttribute("aria-label")||a.getAttribute("title")||a.textContent?.trim()||a.tagName.toLowerCase(),i=a.getAttribute("role")||a.tagName.toLowerCase();Ge(`${r}, ${i}`)},100)}))}function Le(e){let t=e.querySelectorAll('button:not([disabled]),a[href],input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"]),[role="button"]');if(t.length===0)return;let o=t[0],a=t[t.length-1];o.focus(),e.addEventListener("keydown",r=>{r.key==="Tab"&&(r.shiftKey?document.activeElement===o&&(r.preventDefault(),a.focus()):document.activeElement===a&&(r.preventDefault(),o.focus()))})}function Xo(){if(typeof document>"u")return;if(J){J.remove(),J=null;return}let e=document.createElement("div");e.setAttribute("role","dialog"),e.setAttribute("aria-label","Keyboard shortcuts"),e.setAttribute("aria-modal","true"),e.setAttribute("data-yuktai-cheatsheet","true"),e.style.cssText=`
|
|
289
1397
|
position: fixed;
|
|
290
1398
|
top: 50%;
|
|
291
1399
|
left: 50%;
|
|
@@ -309,18 +1417,18 @@ Action plan:`,d=await s.prompt(l);return s.destroy(),d?.trim()||""}async functio
|
|
|
309
1417
|
style="background:none;border:none;color:#aaa;cursor:pointer;font-size:20px;padding:0;line-height:1"
|
|
310
1418
|
aria-label="Close shortcuts">\xD7</button>
|
|
311
1419
|
</div>
|
|
312
|
-
${t.map(([a,
|
|
1420
|
+
${t.map(([a,r])=>`
|
|
313
1421
|
<div style="display:flex;justify-content:space-between;align-items:center;padding:6px 0;border-bottom:1px solid #2a2a4a">
|
|
314
1422
|
<kbd style="background:#2a2a4a;color:#74c0fc;padding:3px 8px;border-radius:4px;font-size:12px;font-family:monospace;border:1px solid #3a3a6a">${a}</kbd>
|
|
315
|
-
<span style="font-size:12px;color:#ccc;text-align:right;flex:1;margin-left:12px">${
|
|
1423
|
+
<span style="font-size:12px;color:#ccc;text-align:right;flex:1;margin-left:12px">${r}</span>
|
|
316
1424
|
</div>
|
|
317
1425
|
`).join("")}
|
|
318
|
-
`,e.querySelector("[data-yuktai-close]")?.addEventListener("click",()=>{e.remove(),
|
|
1426
|
+
`,e.querySelector("[data-yuktai-close]")?.addEventListener("click",()=>{e.remove(),J=null}),e.addEventListener("keydown",a=>{a.key==="Escape"&&(e.remove(),J=null)}),document.body.appendChild(e),J=e,Le(e),w("Keyboard shortcuts opened. Press Escape to close.","info")}function Zo(e){if(typeof document>"u"||!Q?.showAuditBadge||typeof window<"u"&&!window.location.hostname.includes("localhost")&&!window.location.hostname.includes("127.0.0.1"))return;$e&&$e.remove();let t=e.score,o=t>=90?"#0f9d58":t>=70?"#f29900":"#d93025",a=t>=90?"\u267F":t>=70?"\u26A0":"\u2715",r=document.createElement("button");r.setAttribute("aria-label",`Accessibility score: ${t} out of 100`),r.setAttribute("data-yuktai-badge","true"),r.style.cssText=`
|
|
319
1427
|
position: fixed;
|
|
320
1428
|
bottom: 16px;
|
|
321
1429
|
left: 16px;
|
|
322
1430
|
z-index: 999998;
|
|
323
|
-
background: ${
|
|
1431
|
+
background: ${o};
|
|
324
1432
|
color: #fff;
|
|
325
1433
|
border: none;
|
|
326
1434
|
border-radius: 20px;
|
|
@@ -334,7 +1442,7 @@ Action plan:`,d=await s.prompt(l);return s.destroy(),d?.trim()||""}async functio
|
|
|
334
1442
|
align-items: center;
|
|
335
1443
|
gap: 6px;
|
|
336
1444
|
transition: transform 0.15s;
|
|
337
|
-
`,
|
|
1445
|
+
`,r.innerHTML=`${a} ${t}/100 <span style="font-weight:400;opacity:0.85">${e.details.length} issues</span>`,r.addEventListener("click",()=>Jo(e)),document.body.appendChild(r),$e=r}function Jo(e){let t=document.querySelector("[data-yuktai-audit-details]");if(t){t.remove();return}let o=document.createElement("div");o.setAttribute("data-yuktai-audit-details","true"),o.setAttribute("role","dialog"),o.setAttribute("aria-label","Accessibility audit details"),o.style.cssText=`
|
|
338
1446
|
position: fixed;
|
|
339
1447
|
bottom: 56px;
|
|
340
1448
|
left: 16px;
|
|
@@ -351,22 +1459,22 @@ Action plan:`,d=await s.prompt(l);return s.destroy(),d?.trim()||""}async functio
|
|
|
351
1459
|
box-shadow: 0 8px 32px rgba(0,0,0,0.5);
|
|
352
1460
|
font-family: system-ui, sans-serif;
|
|
353
1461
|
font-size: 12px;
|
|
354
|
-
`;let a={critical:"#d93025",serious:"#f29900",moderate:"#1a73e8",minor:"#0f9d58"};
|
|
1462
|
+
`;let a={critical:"#d93025",serious:"#f29900",moderate:"#1a73e8",minor:"#0f9d58"};o.innerHTML=`
|
|
355
1463
|
<div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:12px">
|
|
356
1464
|
<strong style="font-size:14px;color:#74c0fc">Audit report</strong>
|
|
357
1465
|
<span style="color:#aaa">${e.fixed} fixed \xB7 ${e.renderTime}ms</span>
|
|
358
1466
|
</div>
|
|
359
|
-
${e.details.slice(0,20).map(
|
|
1467
|
+
${e.details.slice(0,20).map(r=>`
|
|
360
1468
|
<div style="padding:6px 0;border-bottom:1px solid #2a2a4a">
|
|
361
1469
|
<div style="display:flex;gap:6px;align-items:center">
|
|
362
|
-
<span style="background:${a[
|
|
363
|
-
<code style="color:#74c0fc"><${
|
|
1470
|
+
<span style="background:${a[r.severity]};color:#fff;padding:1px 6px;border-radius:4px;font-size:10px;font-weight:700;text-transform:uppercase">${r.severity}</span>
|
|
1471
|
+
<code style="color:#74c0fc"><${r.tag}></code>
|
|
364
1472
|
</div>
|
|
365
|
-
<div style="color:#ccc;margin-top:3px">${
|
|
1473
|
+
<div style="color:#ccc;margin-top:3px">${r.fix}</div>
|
|
366
1474
|
</div>
|
|
367
1475
|
`).join("")}
|
|
368
1476
|
${e.details.length>20?`<div style="color:#888;padding:8px 0;text-align:center">+${e.details.length-20} more issues</div>`:""}
|
|
369
|
-
`,
|
|
1477
|
+
`,o.addEventListener("keydown",r=>{r.key==="Escape"&&o.remove()}),document.body.appendChild(o),Le(o)}function Nt(e){typeof document>"u"||(_e&&clearTimeout(_e),_e=setTimeout(()=>{if(Te)return;let t=document.createElement("div");t.setAttribute("role","alertdialog"),t.setAttribute("aria-label","Session timeout warning"),t.setAttribute("aria-modal","true"),t.setAttribute("data-yuktai-timeout","true"),t.style.cssText=`
|
|
370
1478
|
position: fixed;
|
|
371
1479
|
top: 50%;
|
|
372
1480
|
left: 50%;
|
|
@@ -395,19 +1503,19 @@ Action plan:`,d=await s.prompt(l);return s.destroy(),d?.trim()||""}async functio
|
|
|
395
1503
|
No, sign out
|
|
396
1504
|
</button>
|
|
397
1505
|
</div>
|
|
398
|
-
`;let
|
|
1506
|
+
`;let o=t.querySelector("[data-yuktai-extend]"),a=t.querySelector("[data-yuktai-dismiss]");o?.addEventListener("click",()=>{t.remove(),Te=null,w("Session extended. You have more time.","success"),Q?.timeoutWarning&&Nt(Q.timeoutWarning)}),a?.addEventListener("click",()=>{t.remove(),Te=null}),document.body.appendChild(t),Te=t,Le(t),w("Warning: Your session will expire soon. Do you need more time?","warning")},e*1e3))}function Qo(e){if(typeof document>"u")return;let t=document.documentElement;if(t.toggleAttribute("data-yuktai-high-contrast",!!e.highContrast),t.toggleAttribute("data-yuktai-dark",!!e.darkMode),t.toggleAttribute("data-yuktai-reduce-motion",!!e.reduceMotion),t.toggleAttribute("data-yuktai-large-targets",!!e.largeTargets),t.toggleAttribute("data-yuktai-keyboard",!!e.keyboardHints),t.toggleAttribute("data-yuktai-dyslexia",!!e.dyslexiaFont),e.localFont?document.body.style.fontFamily=`"${e.localFont}", system-ui, sans-serif`:e.dyslexiaFont||(document.body.style.fontFamily=""),e.fontSizeMultiplier&&e.fontSizeMultiplier!==1?document.documentElement.style.fontSize=`${e.fontSizeMultiplier*100}%`:document.documentElement.style.fontSize="",e.colorBlindMode&&e.colorBlindMode!=="none"){let o=e.colorBlindMode==="achromatopsia"?"grayscale(100%)":`url(#${Ee[e.colorBlindMode]})`;document.body.style.filter=o}else document.body.style.filter=""}function en(e){try{let t=localStorage.getItem("yuktai-a11y-prefs");t&&Object.assign(e,JSON.parse(t))}catch{}}async function Tt(e){if(e){if(!await ze()){w("Plain English requires Chrome 127+","warning");return}w("Rewriting page in plain English...","info",!1);let o=await ct();w(o.error?`Plain English failed: ${o.error}`:`${o.fixed} sections rewritten in plain English`,o.error?"error":"success",!1)}else dt(),w("Original text restored","info",!1)}async function Et(e){if(e){if(!await Ie()){w("Page summariser requires Chrome 127+","warning");return}w("Generating page summary...","info",!1);let o=await mt();w(o.error?`Summary failed: ${o.error}`:"Page summary added at top",o.error?"error":"success",!1)}else we(),w("Page summary removed","info",!1)}async function Ct(e){if(e==="en"){He(),w("Page restored to English","info",!1);return}w(`Translating page to ${e}...`,"info",!1);let t=await ft(e);w(t.error?`Translation failed: ${t.error}`:`Page translated to ${e}`,t.error?"error":"success",!1)}async function Lt(e){if(e){if(!Fe()){w("Voice control not supported in this browser","warning");return}bt(t=>{t.success&&w(`Voice: ${t.action}`,"info",!1)}),w("Voice control started. Say a command.","success",!1)}else Oe(),w("Voice control stopped","info",!1)}async function Mt(e){if(e){if(!await We()){w("Smart labels requires Chrome 127+","warning");return}w("Generating smart labels...","info",!1);let o=await vt();w(o.error?`Smart labels failed: ${o.error}`:`${o.fixed} elements labelled`,o.error?"error":"success",!1)}else wt(),w("Smart labels removed","info",!1)}function tn(){if(typeof document>"u"||Ce)return;let e=document.createElement("div");e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true"),e.setAttribute("aria-relevant","text"),e.style.cssText="position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);",document.body.appendChild(e),Ce=e}function on(){if(typeof document>"u"||kt)return;let e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("aria-hidden","true"),e.style.cssText="position:absolute;width:0;height:0;overflow:hidden;",e.innerHTML=`
|
|
399
1507
|
<defs>
|
|
400
|
-
<filter id="${
|
|
1508
|
+
<filter id="${Ee.deuteranopia}">
|
|
401
1509
|
<feColorMatrix type="matrix"
|
|
402
1510
|
values="0.625 0.375 0 0 0 0.7 0.3 0 0 0 0 0.3 0.7 0 0 0 0 0 1 0"/>
|
|
403
1511
|
</filter>
|
|
404
|
-
<filter id="${
|
|
1512
|
+
<filter id="${Ee.protanopia}">
|
|
405
1513
|
<feColorMatrix type="matrix"
|
|
406
1514
|
values="0.567 0.433 0 0 0 0.558 0.442 0 0 0 0 0.242 0.758 0 0 0 0 0 1 0"/>
|
|
407
1515
|
</filter>
|
|
408
|
-
<filter id="${
|
|
1516
|
+
<filter id="${Ee.tritanopia}">
|
|
409
1517
|
<feColorMatrix type="matrix"
|
|
410
1518
|
values="0.95 0.05 0 0 0 0 0.433 0.567 0 0 0 0.475 0.525 0 0 0 0 0 1 0"/>
|
|
411
1519
|
</filter>
|
|
412
1520
|
</defs>
|
|
413
|
-
`,document.body.appendChild(e),bt=e}function St(e){let t={critical:20,serious:10,moderate:5,minor:2},n=e.details.reduce((a,i)=>a+(t[i.severity]||0),0);return Math.max(0,Math.min(100,100-n))}var M={name:"yuktai-a11y",version:"4.0.0",observer:null,async execute(e){if(!e.enabled)return this.stopObserver(),"yuktai: disabled.";J=e,hn(e),wn(),vn(),fn(),mn(),e.showSkipLinks!==!1&&pn(),e.showPreferencePanel,xn(e);let t=this.applyFixes(e);t.score=St(t),e.showAuditBadge&&bn(t),e.timeoutWarning&&Et(e.timeoutWarning),e.autoFix&&this.startObserver(e),e.plainEnglish&&await ht(!0),e.summarisePage&&await wt(!0),e.translateLanguage&&e.translateLanguage!=="en"&&await vt(e.translateLanguage),e.voiceControl&&await kt(!0),e.smartLabels&&await At(!0);let n=`${t.fixed} fixes applied. Score: ${t.score}/100.`;return x(n,t.score>=90?"success":"info",!1),`yuktai v4.0.0: ${n} Scanned ${t.scanned} elements in ${t.renderTime}ms.`},applyFixes(e){let t={fixed:0,scanned:0,renderTime:0,score:100,details:[]};if(typeof document>"u")return t;let n=performance.now(),a=document.querySelectorAll("*");t.scanned=a.length;let i=(s,o,l,d)=>{t.details.push({tag:s,fix:o,severity:l,element:d.outerHTML.slice(0,100)}),t.fixed++};return a.forEach(s=>{let o=s,l=o.tagName.toLowerCase();if(l==="html"&&!o.getAttribute("lang")&&(o.setAttribute("lang","en"),i(l,'lang="en" added',"critical",o)),l==="meta"){let p=o.getAttribute("name"),h=o.getAttribute("content")||"";p==="viewport"&&h.includes("user-scalable=no")&&(o.setAttribute("content",h.replace("user-scalable=no","user-scalable=yes")),i(l,"user-scalable=yes restored","serious",o)),p==="viewport"&&/maximum-scale=1(?:[^0-9]|$)/.test(h)&&(o.setAttribute("content",h.replace(/maximum-scale=1(?=[^0-9]|$)/,"maximum-scale=5")),i(l,"maximum-scale=5 restored","serious",o))}if(l==="main"&&!o.getAttribute("tabindex")&&(o.setAttribute("tabindex","-1"),o.getAttribute("id")||o.setAttribute("id","main-content")),l==="img"&&(o.hasAttribute("alt")||(o.setAttribute("alt",""),o.setAttribute("aria-hidden","true"),i(l,'alt="" aria-hidden="true"',"serious",o))),l==="svg"&&(!o.getAttribute("aria-hidden")&&!o.getAttribute("aria-label")&&!s.querySelector("title")&&(o.setAttribute("aria-hidden","true"),i(l,'aria-hidden="true" (decorative svg)',"minor",o)),o.getAttribute("focusable")||o.setAttribute("focusable","false")),l==="iframe"&&!o.getAttribute("title")&&!o.getAttribute("aria-label")&&(o.setAttribute("title","embedded content"),o.setAttribute("aria-label","embedded content"),i(l,"title + aria-label added","serious",o)),l==="button"){if(!o.innerText?.trim()&&!o.getAttribute("aria-label")){let p=o.getAttribute("title")||"button";o.setAttribute("aria-label",p),i(l,`aria-label="${p}" (empty button)`,"critical",o)}o.hasAttribute("disabled")&&!o.getAttribute("aria-disabled")&&(o.setAttribute("aria-disabled","true"),t.fixed++)}if(l==="a"){let p=o;!o.innerText?.trim()&&!o.getAttribute("aria-label")&&(o.setAttribute("aria-label",o.getAttribute("title")||"link"),i(l,"aria-label added (empty link)","critical",o)),p.target==="_blank"&&!p.rel?.includes("noopener")&&(p.rel="noopener noreferrer",t.fixed++)}if(xt.has(l)){let p=o;if(!o.getAttribute("aria-label")&&!o.getAttribute("aria-labelledby")){let h=o.getAttribute("placeholder")||o.getAttribute("name")||l;o.setAttribute("aria-label",h),i(l,`aria-label="${h}"`,"serious",o)}if(o.hasAttribute("required")&&!o.getAttribute("aria-required")&&(o.setAttribute("aria-required","true"),t.fixed++),l==="input"&&!p.autocomplete){let h=p.name||"";p.type==="email"||h.includes("email")?p.autocomplete="email":p.type==="tel"||h.includes("tel")?p.autocomplete="tel":p.type==="password"&&(p.autocomplete="current-password"),t.fixed++}}l==="th"&&!o.getAttribute("scope")&&(o.setAttribute("scope",o.closest("thead")?"col":"row"),i(l,"scope added to <th>","moderate",o)),Fe[l]&&!o.getAttribute("role")&&(o.setAttribute("role",Fe[l]),i(l,`role="${Fe[l]}"`,"minor",o));let d=o.getAttribute("role")||"";d==="tab"&&!o.getAttribute("aria-selected")&&(o.setAttribute("aria-selected","false"),t.fixed++),["alert","status","log"].includes(d)&&!o.getAttribute("aria-live")&&(o.setAttribute("aria-live",d==="alert"?"assertive":"polite"),i(l,`aria-live added on role=${d}`,"moderate",o)),d==="combobox"&&!o.getAttribute("aria-expanded")&&(o.setAttribute("aria-expanded","false"),i(l,'aria-expanded="false" on combobox',"serious",o)),(d==="checkbox"||d==="radio")&&!o.getAttribute("aria-checked")&&(o.setAttribute("aria-checked","false"),i(l,`aria-checked="false" on role=${d}`,"serious",o))}),t.renderTime=parseFloat((performance.now()-n).toFixed(2)),t},scan(){let e={fixed:0,scanned:0,renderTime:0,score:100,details:[]};if(typeof document>"u")return e;let t=performance.now(),n=document.querySelectorAll("*");e.scanned=n.length;let a=(i,s,o,l)=>e.details.push({tag:i,fix:s,severity:o,element:l.outerHTML.slice(0,100)});return n.forEach(i=>{let s=i,o=s.tagName.toLowerCase();(o==="a"||o==="button")&&!s.innerText?.trim()&&!s.getAttribute("aria-label")&&a(o,"needs aria-label (empty)","critical",s),o==="img"&&!s.hasAttribute("alt")&&a(o,"needs alt text","serious",s),xt.has(o)&&!s.getAttribute("aria-label")&&!s.getAttribute("aria-labelledby")&&a(o,"needs aria-label","serious",s),o==="iframe"&&!s.getAttribute("title")&&!s.getAttribute("aria-label")&&a(o,"iframe needs title","serious",s)}),e.fixed=e.details.length,e.score=St(e),e.renderTime=parseFloat((performance.now()-t).toFixed(2)),e},startObserver(e){this.observer||typeof document>"u"||(this.observer=new MutationObserver(()=>this.applyFixes(e)),this.observer.observe(document.body,{childList:!0,subtree:!0,attributes:!1}))},stopObserver(){this.observer?.disconnect(),this.observer=null},announce:x,speak:We,showVisualAlert:Tt,trapFocus:ke,handlePlainEnglish:ht,handleSummarisePage:wt,handleTranslate:vt,handleVoiceControl:kt,handleSmartLabels:At,SUPPORTED_LANGUAGES:ye};g();g();var m=tt(require("react"));g();var E=require("react");Be();re();var r=require("react/jsx-runtime"),Ge={highContrast:!1,reduceMotion:!1,autoFix:!0,dyslexiaFont:!1,fontScale:100,localFont:"",darkMode:!1,largeTargets:!1,speechEnabled:!1,colorBlindMode:"none",showAuditBadge:!1,timeoutWarning:void 0,plainEnglish:!1,summarisePage:!1,translateLanguage:"en",voiceControl:!1,smartLabels:!1},Q=[80,90,100,110,120,130],Pn=[{value:"none",label:"None"},{value:"deuteranopia",label:"Deuteranopia"},{value:"protanopia",label:"Protanopia"},{value:"tritanopia",label:"Tritanopia"},{value:"achromatopsia",label:"Greyscale"}],In=["Prompt API for Gemini Nano","Summarization API for Gemini Nano","Writer API for Gemini Nano","Rewriter API for Gemini Nano","Translation API"];function Hn(){let[e,t]=(0,E.useState)(typeof window<"u"?window.innerWidth:1024);return(0,E.useEffect)(()=>{let n=()=>t(window.innerWidth);return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),{isMobile:e<=480,isTablet:e>480&&e<=768}}function zn({checked:e,onChange:t,label:n,disabled:a=!1}){return(0,r.jsxs)("label",{"aria-label":n,style:{position:"relative",display:"inline-flex",width:"40px",height:"24px",cursor:a?"not-allowed":"pointer",flexShrink:0,opacity:a?.4:1},children:[(0,r.jsx)("input",{type:"checkbox",checked:e,disabled:a,onChange:i=>t(i.target.checked),style:{opacity:0,width:0,height:0,position:"absolute"}}),(0,r.jsx)("span",{style:{position:"absolute",inset:0,borderRadius:"99px",background:e?"#0d9488":"#cbd5e1",transition:"background 0.2s"}}),(0,r.jsx)("span",{style:{position:"absolute",top:"3px",left:e?"19px":"3px",width:"18px",height:"18px",background:"#fff",borderRadius:"50%",transition:"left 0.2s",boxShadow:"0 1px 3px rgba(0,0,0,0.2)",pointerEvents:"none"}})]})}function Z({label:e,color:t="#64748b",badge:n,concept:a}){return(0,r.jsxs)("div",{style:{margin:"10px 18px 4px"},children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,r.jsx)("p",{style:{margin:0,fontSize:"10px",fontWeight:600,color:t,letterSpacing:"0.06em",textTransform:"uppercase"},children:e}),n&&(0,r.jsx)("span",{style:{fontSize:"9px",fontWeight:500,padding:"1px 7px",borderRadius:"99px",background:"#f5f3ff",color:"#7c3aed",border:"0.5px solid #c4b5fd",whiteSpace:"nowrap"},children:n})]}),a&&(0,r.jsx)("p",{style:{margin:"2px 0 0",fontSize:"9px",color:"#94a3b8",fontStyle:"italic"},children:a})]})}function z({icon:e,label:t,desc:n,checked:a,onChange:i,disabled:s=!1,disabledReason:o,tip:l}){return(0,r.jsxs)("div",{title:s?o:l,style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 18px",gap:"12px"},children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"10px",flex:1,minWidth:0},children:[(0,r.jsx)("span",{"aria-hidden":"true",style:{width:"32px",height:"32px",borderRadius:"8px",background:s?"#f1f5f9":"#f0fdfa",color:s?"#94a3b8":"#0d9488",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"15px",flexShrink:0,fontWeight:700},children:e}),(0,r.jsxs)("div",{style:{minWidth:0},children:[(0,r.jsx)("p",{style:{margin:0,fontSize:"13px",fontWeight:500,color:s?"#94a3b8":"#0f172a",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t}),(0,r.jsx)("p",{style:{margin:0,fontSize:"10px",color:"#94a3b8"},children:s?o:n})]})]}),(0,r.jsx)(zn,{checked:a,onChange:i,label:`Toggle ${t}`,disabled:s})]})}function T(){return(0,r.jsx)("div",{style:{height:"1px",background:"#f1f5f9"}})}function se({steps:e}){return(0,r.jsxs)("div",{style:{margin:"0 18px 8px",padding:"8px 10px",background:"#f8fafc",borderRadius:"8px",border:"0.5px solid #e2e8f0"},children:[(0,r.jsx)("p",{style:{margin:"0 0 4px",fontSize:"9px",fontWeight:600,color:"#64748b",textTransform:"uppercase",letterSpacing:"0.05em"},children:"How to use"}),e.map((t,n)=>(0,r.jsxs)("p",{style:{margin:"0 0 2px",fontSize:"10px",color:"#475569"},children:[n+1,". ",t]},n))]})}var _e=(0,E.forwardRef)(({position:e,settings:t,report:n,isActive:a,aiSupported:i,voiceSupported:s,set:o,onApply:l,onReset:d,onClose:p},h)=>{let{isMobile:b,isTablet:q}=Hn(),[N,Y]=(0,E.useState)([]),[A,O]=(0,E.useState)(""),[$,C]=(0,E.useState)(""),[L,R]=(0,E.useState)(!1),[y,ee]=(0,E.useState)(null),[B,P]=(0,E.useState)("idle");(0,E.useEffect)(()=>{let c=window;!!(c.LanguageModel||c.ai?.languageModel)&&i?ee("gemini"):ae()&&ee("transformers")},[i]),(0,E.useEffect)(()=>{if(y!=="transformers")return;let c=setInterval(()=>{P(ie())},500);return()=>clearInterval(c)},[y]);let te=async()=>{if(!(!A.trim()||L)){if(!y){C("\u26A0\uFE0F No AI engine available on this device.");return}R(!0),C("");try{let c;y==="gemini"?c=await Ne(A):(P("loading"),c=await Oe(A),P("ready")),C(c.success&&c.answer?c.answer.replace(/\*\*(.*?)\*\*/g,"$1").replace(/\*(.*?)\*/g,"$1").replace(/#+\s/g,"").trim():"\u26A0\uFE0F "+(c.error||"No answer found on this page"))}catch{C("\u26A0\uFE0F Failed to get answer. Please try again.")}R(!1)}};(0,E.useEffect)(()=>{(async()=>{try{let F=window;if(!F.queryLocalFonts)return;let V=await F.queryLocalFonts(),W=[...new Set(V.map(oe=>oe.family))].sort();Y(W.slice(0,50))}catch{}})()},[]);let k=y==="gemini"?"Gemini Nano":y==="transformers"?"Transformers.js \xB7 All devices":"Detecting...",de=y==="transformers"&&B==="loading"?"Loading AI model... (first time only)":"...",ne=b?{position:"fixed",bottom:0,left:0,right:0,zIndex:9999,background:"#fff",border:"1px solid #e2e8f0",borderRadius:"16px 16px 0 0",boxShadow:"0 -8px 32px rgba(0,0,0,0.12)",maxHeight:"90vh",overflowY:"auto",fontFamily:"system-ui,-apple-system,sans-serif",width:"100%"}:{position:"fixed",bottom:"84px",[e]:"24px",zIndex:9999,width:q?"300px":"320px",maxWidth:"calc(100vw - 48px)",background:"#fff",border:"1px solid #e2e8f0",borderRadius:"16px",boxShadow:"0 8px 32px rgba(0,0,0,0.12)",maxHeight:"80vh",overflowY:"auto",fontFamily:"system-ui,-apple-system,sans-serif"};return(0,r.jsxs)("div",{ref:h,role:"dialog","aria-modal":"true","aria-label":"yuktai accessibility preferences","data-yuktai-panel":"true",style:ne,children:[(0,r.jsxs)("div",{style:{padding:"14px 18px 12px",borderBottom:"1px solid #f1f5f9",display:"flex",alignItems:"flex-start",justifyContent:"space-between",position:"sticky",top:0,background:"#fff",zIndex:1},children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"7px",marginBottom:"4px",flexWrap:"wrap"},children:[(0,r.jsx)("span",{style:{fontSize:"10px",fontWeight:700,padding:"2px 7px",borderRadius:"99px",background:"#f0fdfa",color:"#0d9488",letterSpacing:"0.05em",fontFamily:"monospace"},children:"@yuktishaalaa/yuktai"}),a&&(0,r.jsx)("span",{style:{fontSize:"10px",fontWeight:700,padding:"2px 7px",borderRadius:"99px",background:"#f0fdfa",color:"#0f766e",border:"1px solid #99f6e4"},children:"\u25CF ACTIVE"})]}),(0,r.jsx)("p",{style:{margin:"0 0 1px",fontSize:"15px",fontWeight:600,color:"#0f172a"},children:"Accessibility"}),(0,r.jsx)("p",{style:{margin:0,fontSize:"11px",color:"#64748b"},children:"WCAG 2.2 \xB7 Open source \xB7 Zero cost \xB7 All devices"})]}),(0,r.jsx)("button",{onClick:p,"aria-label":"Close accessibility panel",style:{background:"none",border:"none",cursor:"pointer",padding:"4px",color:"#94a3b8",fontSize:"20px",lineHeight:1,borderRadius:"6px",flexShrink:0,minWidth:b?"44px":"auto",minHeight:b?"44px":"auto",display:"flex",alignItems:"center",justifyContent:"center"},children:"\xD7"})]}),(0,r.jsx)(Z,{label:"\u267F Core Accessibility",concept:"Rule-based engine \u2014 works on all browsers and devices"}),(0,r.jsx)(se,{steps:["Toggle any feature on","Click Apply settings","Preferences saved automatically"]}),(0,r.jsx)(z,{icon:"\u{1F527}",label:"Auto-fix ARIA",desc:"Injects missing labels and roles automatically",checked:t.autoFix,onChange:c=>o("autoFix",c),tip:"Fixes aria-label, alt text, roles on every element"}),(0,r.jsx)(T,{}),(0,r.jsx)(z,{icon:"\u{1F50A}",label:"Speak on focus",desc:"Browser reads elements aloud as you tab",checked:t.speechEnabled,onChange:c=>o("speechEnabled",c),tip:"Uses browser SpeechSynthesis \u2014 no install needed"}),(0,r.jsx)(T,{}),(0,r.jsx)(z,{icon:"\u{1F399}\uFE0F",label:"Voice control",desc:"Say commands to navigate the page",checked:t.voiceControl,onChange:c=>o("voiceControl",c),disabled:!s,disabledReason:"Not supported in this browser",tip:'Say "scroll down", "go to main", "click"'}),(0,r.jsx)(T,{}),(0,r.jsx)(Z,{label:"\u{1F916} AI Features",color:"#7c3aed",badge:"Gemini Nano",concept:"Large Language Model running privately on your device \u2014 Chrome 127+ only"}),(0,r.jsx)("div",{style:{margin:"4px 18px 6px",padding:"8px 10px",background:i?"#f0fdfa":"#f5f3ff",borderRadius:"8px",border:`0.5px solid ${i?"#99f6e4":"#c4b5fd"}`,fontSize:"10px",color:i?"#0f766e":"#7c3aed",lineHeight:1.5},children:i?"\u2705 Gemini Nano detected \u2014 AI features ready. Runs privately on your device.":"\u2699\uFE0F AI features need one-time setup \u2014 see guide below."}),!i&&(0,r.jsxs)("div",{style:{margin:"0 18px 8px",padding:"10px 12px",background:"#fafafa",borderRadius:"8px",border:"0.5px solid #e2e8f0",fontSize:"11px",color:"#475569",lineHeight:1.7},children:[(0,r.jsx)("p",{style:{margin:"0 0 6px",fontWeight:600,color:"#0f172a",fontSize:"11px"},children:"\u{1F6E0} One-time setup \u2014 5 steps:"}),(0,r.jsxs)("p",{style:{margin:"0 0 3px"},children:["1. Open Chrome \u2192 ",(0,r.jsx)("code",{style:{background:"#f1f5f9",padding:"1px 5px",borderRadius:"4px",fontSize:"10px",color:"#0d9488",fontFamily:"monospace"},children:"chrome://flags"})]}),(0,r.jsx)("p",{style:{margin:"0 0 3px"},children:"2. Enable each flag:"}),(0,r.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:"2px",margin:"4px 0 6px 10px"},children:In.map(c=>(0,r.jsxs)("span",{style:{fontSize:"10px",color:"#7c3aed",fontFamily:"monospace"},children:["\u2192 ",c]},c))}),(0,r.jsxs)("p",{style:{margin:"0 0 3px"},children:["3. Click ",(0,r.jsx)("strong",{style:{color:"#0f172a"},children:"Relaunch"})]}),(0,r.jsxs)("p",{style:{margin:"0 0 3px"},children:["4. ",(0,r.jsx)("code",{style:{background:"#f1f5f9",padding:"1px 5px",borderRadius:"4px",fontSize:"10px",color:"#0d9488",fontFamily:"monospace"},children:"chrome://components"})," \u2192 Optimization Guide On Device Model \u2192 Check for update"]}),(0,r.jsx)("p",{style:{margin:"0"},children:"5. Refresh \u2014 AI features unlock automatically \u2705"})]}),(0,r.jsx)(z,{icon:"\u{1F4DD}",label:"Plain English mode",desc:"Rewrites complex text in simple language",checked:t.plainEnglish,onChange:c=>o("plainEnglish",c),disabled:!i,disabledReason:"Enable Gemini Nano \u2014 see setup above",tip:"AI concept: LLM text rewriting"}),(0,r.jsx)(T,{}),(0,r.jsx)(z,{icon:"\u{1F4CB}",label:"Summarise page",desc:"3-sentence summary appears at top",checked:t.summarisePage,onChange:c=>o("summarisePage",c),disabled:!i,disabledReason:"Enable Gemini Nano \u2014 see setup above",tip:"AI concept: Abstractive summarisation"}),(0,r.jsx)(T,{}),(0,r.jsx)(z,{icon:"\u{1F3F7}\uFE0F",label:"Smart aria-labels",desc:"AI generates meaningful labels for elements",checked:t.smartLabels,onChange:c=>o("smartLabels",c),disabled:!i,disabledReason:"Enable Gemini Nano \u2014 see setup above",tip:"AI concept: Context-aware label generation"}),(0,r.jsx)(T,{}),(0,r.jsx)(Z,{label:"\u{1F441}\uFE0F Visual",concept:"CSS filter-based \u2014 works on all browsers and devices"}),(0,r.jsx)(se,{steps:["Toggle any visual mode","Changes apply instantly","Works on mobile and desktop"]}),(0,r.jsx)(z,{icon:"\u25D1",label:"High contrast",desc:"Boosts contrast for low vision users",checked:t.highContrast,onChange:c=>o("highContrast",c),tip:"CSS filter: contrast()"}),(0,r.jsx)(T,{}),(0,r.jsx)(z,{icon:"\u{1F319}",label:"Dark mode",desc:"Inverts colours \u2014 easy on eyes at night",checked:t.darkMode,onChange:c=>o("darkMode",c),tip:"CSS filter: invert + hue-rotate"}),(0,r.jsx)(T,{}),(0,r.jsx)(z,{icon:"\u23F8\uFE0F",label:"Reduce motion",desc:"Disables all animations",checked:t.reduceMotion,onChange:c=>o("reduceMotion",c),tip:"WCAG 2.3.3 \u2014 vestibular disorders"}),(0,r.jsx)(T,{}),(0,r.jsx)(z,{icon:"\u{1F446}",label:"Large targets",desc:"44\xD744px minimum touch targets",checked:t.largeTargets,onChange:c=>o("largeTargets",c),tip:"WCAG 2.5.8 \u2014 motor impaired users"}),(0,r.jsx)(T,{}),(0,r.jsxs)("div",{style:{padding:"10px 18px"},children:[(0,r.jsx)("p",{style:{margin:"0 0 2px",fontSize:"12px",fontWeight:500,color:"#0f172a"},children:"\u{1F3A8} Colour blindness"}),(0,r.jsx)("p",{style:{margin:"0 0 8px",fontSize:"10px",color:"#94a3b8"},children:"SVG colour matrix filters \u2014 all devices"}),(0,r.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px"},children:Pn.map(c=>(0,r.jsx)("button",{onClick:()=>o("colorBlindMode",c.value),"aria-pressed":t.colorBlindMode===c.value,style:{padding:"4px 10px",borderRadius:"20px",fontSize:"11px",fontWeight:500,border:`1px solid ${t.colorBlindMode===c.value?"#0d9488":"#e2e8f0"}`,background:t.colorBlindMode===c.value?"#f0fdfa":"#fff",color:t.colorBlindMode===c.value?"#0d9488":"#64748b",cursor:"pointer",minHeight:b?"36px":"auto"},children:c.label},c.value))})]}),(0,r.jsx)(T,{}),(0,r.jsx)(Z,{label:"\u{1F524} Font",concept:"Browser Font API + CSS \u2014 Chrome 103+"}),(0,r.jsx)(se,{steps:["Toggle dyslexia font or pick from device","Adjust size with + / \u2212","Saved across visits"]}),(0,r.jsx)(z,{icon:"Aa",label:"Dyslexia-friendly font",desc:"Atkinson Hyperlegible \u2014 research-backed",checked:t.dyslexiaFont,onChange:c=>o("dyslexiaFont",c),tip:"By Braille Institute \u2014 free and open source"}),(0,r.jsx)(T,{}),(0,r.jsxs)("div",{style:{padding:"10px 18px"},children:[(0,r.jsx)("p",{style:{margin:"0 0 2px",fontSize:"12px",fontWeight:500,color:"#0f172a"},children:"\u{1F5A5}\uFE0F Local font"}),(0,r.jsx)("p",{style:{margin:"0 0 8px",fontSize:"10px",color:"#94a3b8"},children:"window.queryLocalFonts() \u2014 Chrome 103+"}),N.length>0?(0,r.jsxs)("select",{value:t.localFont,onChange:c=>o("localFont",c.target.value),"aria-label":"Choose a font from your device",style:{width:"100%",padding:"8px 10px",borderRadius:"8px",border:"1px solid #e2e8f0",fontSize:"13px",color:"#0f172a",background:"#fff",cursor:"pointer",height:b?"44px":"36px"},children:[(0,r.jsx)("option",{value:"",children:"System default"}),N.map(c=>(0,r.jsx)("option",{value:c,style:{fontFamily:c},children:c},c))]}):(0,r.jsx)("p",{style:{margin:0,fontSize:"11px",color:"#94a3b8"},children:"Allow font access when Chrome prompts you."})]}),(0,r.jsx)(T,{}),(0,r.jsxs)("div",{style:{padding:"10px 18px 14px"},children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"10px"},children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{style:{margin:0,fontSize:"12px",fontWeight:500,color:"#0f172a"},children:"\u{1F4CF} Text size"}),(0,r.jsx)("p",{style:{margin:0,fontSize:"10px",color:"#94a3b8"},children:"Scales all text on the page"})]}),(0,r.jsxs)("span",{style:{fontSize:"12px",fontWeight:600,color:"#0d9488",background:"#f0fdfa",padding:"2px 8px",borderRadius:"99px"},children:[t.fontScale,"%"]})]}),(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,r.jsx)("button",{onClick:()=>{let c=Q.indexOf(t.fontScale);c>0&&o("fontScale",Q[c-1])},disabled:t.fontScale<=80,"aria-label":"Decrease text size",style:{width:b?"44px":"30px",height:b?"44px":"30px",borderRadius:"8px",border:"1px solid #e2e8f0",background:"#fff",cursor:t.fontScale<=80?"not-allowed":"pointer",fontSize:"16px",color:t.fontScale<=80?"#cbd5e1":"#0f172a",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:"\u2212"}),(0,r.jsx)("div",{style:{flex:1,display:"flex",gap:"3px"},children:Q.map(c=>(0,r.jsx)("button",{onClick:()=>o("fontScale",c),"aria-label":`Set text size to ${c}%`,style:{flex:1,height:"6px",borderRadius:"99px",border:"none",cursor:"pointer",padding:0,background:c<=t.fontScale?"#0d9488":"#e2e8f0",transition:"background 0.15s"}},c))}),(0,r.jsx)("button",{onClick:()=>{let c=Q.indexOf(t.fontScale);c<Q.length-1&&o("fontScale",Q[c+1])},disabled:t.fontScale>=130,"aria-label":"Increase text size",style:{width:b?"44px":"30px",height:b?"44px":"30px",borderRadius:"8px",border:"1px solid #e2e8f0",background:"#fff",cursor:t.fontScale>=130?"not-allowed":"pointer",fontSize:"16px",color:t.fontScale>=130?"#cbd5e1":"#0f172a",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:"+"})]})]}),(0,r.jsx)(T,{}),(0,r.jsx)(Z,{label:"\u{1F310} Translate",color:"#7c3aed",badge:"Gemini Nano",concept:"Chrome Translation API \u2014 on device, no internet after setup"}),(0,r.jsx)(se,{steps:["Enable Gemini Nano first","Pick your language","Full page translates instantly"]}),(0,r.jsxs)("div",{style:{padding:"6px 18px 12px"},children:[(0,r.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px"},children:ye.slice(0,b?8:18).map(c=>(0,r.jsx)("button",{onClick:()=>o("translateLanguage",c.code),"aria-pressed":t.translateLanguage===c.code,disabled:!i,style:{padding:"4px 10px",borderRadius:"20px",fontSize:"11px",fontWeight:500,border:`1px solid ${t.translateLanguage===c.code?"#7c3aed":"#e2e8f0"}`,background:t.translateLanguage===c.code?"#f5f3ff":"#fff",color:t.translateLanguage===c.code?"#7c3aed":"#64748b",cursor:i?"pointer":"not-allowed",opacity:i?1:.5,minHeight:b?"36px":"auto"},children:c.label},c.code))}),!i&&(0,r.jsx)("p",{style:{margin:"6px 0 0",fontSize:"10px",color:"#94a3b8"},children:"Enable Gemini Nano using the setup guide above."})]}),(0,r.jsx)(T,{}),(0,r.jsx)(Z,{label:"\u{1F4AC} Ask This Page",color:"#0d9488",badge:k,concept:"RAG \u2014 Retrieval Augmented Generation. Works on all devices including mobile."}),(0,r.jsx)(se,{steps:["Type any question about this page","Press Ask or hit Enter",y==="transformers"?"Transformers.js answers \u2014 works on mobile, offline":"Gemini Nano reads page and answers privately","Zero cost. No data leaves your device."]}),(0,r.jsxs)("div",{style:{margin:"0 18px 8px",padding:"6px 10px",background:y==="gemini"?"#f0fdfa":y==="transformers"?"#f5f3ff":"#f8fafc",borderRadius:"8px",border:`0.5px solid ${y==="gemini"?"#99f6e4":y==="transformers"?"#c4b5fd":"#e2e8f0"}`,fontSize:"10px",color:y==="gemini"?"#0f766e":y==="transformers"?"#7c3aed":"#94a3b8"},children:[y==="gemini"&&"\u2705 Using Gemini Nano \u2014 on device, private, instant",y==="transformers"&&"\u2705 Using Transformers.js \u2014 works on mobile and all browsers",!y&&"\u23F3 Detecting AI engine...",y==="transformers"&&B==="loading"&&" \xB7 Loading model...",y==="transformers"&&B==="ready"&&" \xB7 Model ready \u2705"]}),(0,r.jsxs)("div",{style:{padding:"0 18px 14px"},children:[(0,r.jsxs)("div",{style:{display:"flex",gap:"6px",marginBottom:"8px"},children:[(0,r.jsx)("input",{type:"text",value:A,onChange:c=>O(c.target.value),onKeyDown:c=>{c.key==="Enter"&&te()},placeholder:"e.g. What does this page do?",disabled:L||!y,"aria-label":"Ask a question about this page",style:{flex:1,padding:"8px 10px",borderRadius:"8px",border:"1px solid #e2e8f0",fontSize:"12px",color:"#0f172a",background:y?"#fff":"#f8fafc",outline:"none",height:b?"44px":"36px"}}),(0,r.jsx)("button",{onClick:te,disabled:L||!A.trim()||!y,"aria-label":"Ask question",style:{padding:"8px 14px",borderRadius:"8px",border:"none",background:y&&A.trim()&&!L?"#0d9488":"#e2e8f0",color:y&&A.trim()&&!L?"#fff":"#94a3b8",fontSize:"12px",fontWeight:600,cursor:y&&A.trim()&&!L?"pointer":"not-allowed",flexShrink:0,height:b?"44px":"36px",minWidth:"52px",transition:"background 0.2s"},children:L?de:"Ask"})]}),$&&(0,r.jsxs)("div",{role:"status","aria-live":"polite",style:{padding:"10px 12px",background:"#f0fdfa",border:"1px solid #99f6e4",borderRadius:"8px",fontSize:"12px",color:"#0f766e",lineHeight:1.6,maxHeight:"180px",overflowY:"auto"},children:[(0,r.jsx)("strong",{style:{display:"block",marginBottom:"4px",fontSize:"11px",color:"#0d9488"},children:"\u{1F4AC} Answer"}),$,(0,r.jsx)("button",{onClick:()=>{C(""),O("")},style:{display:"block",marginTop:"6px",background:"none",border:"none",color:"#94a3b8",fontSize:"10px",cursor:"pointer",padding:0},children:"Clear"})]})]}),n&&(0,r.jsx)("div",{role:"status",style:{margin:"0 14px 10px",padding:"8px 12px",background:"#f0fdfa",border:"1px solid #99f6e4",borderRadius:"8px",fontSize:"12px",color:"#0f766e",fontWeight:500,fontFamily:"monospace"},children:n.fixed>0?`\u2713 ${n.fixed} fixes \xB7 ${n.scanned} nodes \xB7 ${n.renderTime}ms \xB7 Score: ${n.score}/100`:`\u2713 0 auto-fixes needed \xB7 ${n.scanned} nodes \xB7 ${n.renderTime}ms`}),(0,r.jsxs)("div",{style:{display:"flex",gap:"8px",padding:"12px 14px 14px",position:b?"sticky":"relative",bottom:b?0:"auto",background:"#fff",borderTop:"1px solid #f1f5f9"},children:[(0,r.jsx)("button",{onClick:d,style:{flex:1,padding:b?"12px 0":"8px 0",fontSize:"13px",fontWeight:500,borderRadius:"9px",border:"1px solid #e2e8f0",background:"#fff",color:"#64748b",cursor:"pointer"},children:"Reset"}),(0,r.jsx)("button",{onClick:l,style:{flex:2,padding:b?"12px 0":"8px 0",fontSize:"13px",fontWeight:600,borderRadius:"9px",border:"none",background:"#0d9488",color:"#fff",cursor:"pointer"},children:"Apply settings"})]})]})});_e.displayName="WidgetPanel";re();var f=require("react/jsx-runtime");async function Bn(){try{if(typeof window>"u")return!1;let e=window;if(e.LanguageModel)try{if(typeof e.LanguageModel.availability=="function"){let n=await e.LanguageModel.availability();if(n==="readily"||n==="available"||n==="downloadable")return!0}else return!0}catch{}if(e.Summarizer)try{let n=await e.Summarizer.availability?.();if(!n||n==="readily"||n==="available")return!0}catch{}if(e.Rewriter)try{let n=await e.Rewriter.availability?.();if(!n||n==="readily"||n==="available")return!0}catch{}if(e.Writer)try{let n=await e.Writer.availability?.();if(!n||n==="readily"||n==="available")return!0}catch{}let t=e.ai||globalThis.ai;if(t){if(t.languageModel?.availability)try{let n=await t.languageModel.availability();if(n==="readily"||n==="available")return!0}catch{}if(t.languageModel&&typeof t.languageModel.create=="function"||t.summarizer||t.rewriter||t.writer||t.languageModel)return!0}return!!(e.Translator||e.translation?.canTranslate)}catch{return!1}}function Ae({position:e="left",children:t,config:n={},showRag:a=!1,showAgent:i=!1}){let[s,o]=(0,m.useState)(!1),[l,d]=(0,m.useState)(Ge),[p,h]=(0,m.useState)(null),[b,q]=(0,m.useState)(!1),[N,Y]=(0,m.useState)(!1),[A,O]=(0,m.useState)(!1),$=m.default.useRef(null),[C,L]=(0,m.useState)(!1),[R,y]=(0,m.useState)(""),[ee,B]=(0,m.useState)(""),[P,te]=(0,m.useState)(!1),[k,de]=(0,m.useState)(null),[ne,c]=(0,m.useState)("idle"),[F,V]=(0,m.useState)(!1),[W,oe]=(0,m.useState)(""),[Bt,ue]=(0,m.useState)(""),[D,je]=(0,m.useState)(!1),[Ve,Se]=(0,m.useState)([]),[I,Ye]=(0,m.useState)(null),qt=24,Ke=84,Ue=a?144:84;(0,m.useEffect)(()=>{if(typeof window>"u")return;let u=window;!!(u.LanguageModel||u.ai?.languageModel)&&N?(de("gemini"),Ye("gemini")):ae()&&(de("transformers"),Ye("transformers"))},[N]),(0,m.useEffect)(()=>{if(k!=="transformers")return;let u=setInterval(()=>c(ie()),500);return()=>clearInterval(u)},[k]);let Je=(0,m.useCallback)(async()=>{if(!(!R.trim()||P)){if(!k){B("\u26A0\uFE0F No AI engine available.");return}te(!0),B("");try{let u;if(k==="gemini"){let{askPage:w}=await Promise.resolve().then(()=>(Be(),Lt));u=await w(R)}else{c("loading");let{askPageWithTransformers:w}=await Promise.resolve().then(()=>(re(),De));u=await w(R),c("ready")}B(u.success&&u.answer?u.answer.replace(/\*\*(.*?)\*\*/g,"$1").replace(/\*(.*?)\*/g,"$1").replace(/#+\s/g,"").trim():"\u26A0\uFE0F "+(u.error||"No answer found."))}catch{B("\u26A0\uFE0F Something went wrong.")}te(!1)}},[R,P,k]),Xe=(0,m.useCallback)(async()=>{if(!W.trim()||D)return;if(!I){ue("\u26A0\uFE0F No AI engine available.");return}je(!0),Se([]),ue("");let{runAgent:u}=await Promise.resolve().then(()=>(Wt(),Ft));await u(W,I,w=>{Se(G=>[...G,w.text])}),je(!1),ue("done")},[W,D,I]);(0,m.useEffect)(()=>{if(typeof window>"u")return;let w=setTimeout(async()=>{let G=window,jt=await Bn();Y(jt),O(!!(G.SpeechRecognition||G.webkitSpeechRecognition))},800);return()=>clearTimeout(w)},[]),(0,m.useEffect)(()=>{if(!(typeof window>"u"))try{let u=localStorage.getItem("yuktai-a11y-prefs");u&&d(w=>({...w,...JSON.parse(u)}))}catch{}},[]);let Qe=(0,m.useCallback)(async u=>{let w={enabled:!0,highContrast:u.highContrast,darkMode:u.darkMode,reduceMotion:u.reduceMotion,largeTargets:u.largeTargets,speechEnabled:u.speechEnabled,autoFix:u.autoFix,dyslexiaFont:u.dyslexiaFont,localFont:u.localFont,fontSizeMultiplier:u.fontScale/100,colorBlindMode:u.colorBlindMode,showAuditBadge:u.showAuditBadge,showSkipLinks:!0,showPreferencePanel:!1,plainEnglish:u.plainEnglish,summarisePage:u.summarisePage,translateLanguage:u.translateLanguage,voiceControl:u.voiceControl,smartLabels:u.smartLabels,...n};await M.execute(w),h(M.applyFixes(w)),q(!0)},[n]),Ot=(0,m.useCallback)(async()=>{try{localStorage.setItem("yuktai-a11y-prefs",JSON.stringify(l))}catch{}await Qe(l),o(!1)},[l,Qe]),Dt=(0,m.useCallback)(()=>{d(Ge);try{localStorage.removeItem("yuktai-a11y-prefs")}catch{}let u=document.documentElement;["data-yuktai-high-contrast","data-yuktai-dark","data-yuktai-reduce-motion","data-yuktai-large-targets","data-yuktai-keyboard","data-yuktai-dyslexia"].forEach(w=>u.removeAttribute(w)),document.body.style.filter="",document.body.style.fontFamily="",document.documentElement.style.fontSize="",h(null),q(!1)},[]),Gt=(0,m.useCallback)((u,w)=>{d(G=>({...G,[u]:w}))},[]);(0,m.useEffect)(()=>{let u=w=>{w.key==="Escape"&&(s&&o(!1),C&&L(!1),F&&V(!1))};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[s,C,F]),(0,m.useEffect)(()=>{s&&$.current&&M.trapFocus($.current)},[s]);let Te=(u,w,G)=>({position:"fixed",bottom:`${u}px`,[e]:"24px",zIndex:9998,width:"52px",height:"52px",borderRadius:"50%",background:w,color:"#fff",border:"none",cursor:"pointer",fontSize:"22px",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 4px 16px rgba(0,0,0,0.25)",transition:"transform 0.15s, background 0.2s"}),Ee=u=>{u.currentTarget.style.transform="scale(1.08)"},Le=u=>{u.currentTarget.style.transform="scale(1)"},Ze=k==="gemini"?"Gemini Nano \xB7 On device":k==="transformers"?"Transformers.js \xB7 All devices":"Detecting...",_t=k==="transformers"&&ne==="loading"?"Loading model...":"...";return(0,f.jsxs)(f.Fragment,{children:[t,i&&(0,f.jsx)("button",{style:Te(Ue,F?"#059669":"#10b981",F),"aria-label":"Open AI agent","aria-haspopup":"dialog","aria-expanded":F,title:"\u{1F916} AI Agent \u2014 guide me through this page",onClick:()=>{V(u=>!u),L(!1),o(!1)},onMouseEnter:Ee,onMouseLeave:Le,children:"\u{1F916}"}),i&&F&&(0,f.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":"yuktai AI Agent","data-yuktai-panel":"true",style:{position:"fixed",bottom:`${Ue+64}px`,[e]:"24px",zIndex:9999,width:"300px",maxWidth:"calc(100vw - 48px)",background:"#fff",border:"1px solid #e2e8f0",borderRadius:"16px",boxShadow:"0 8px 32px rgba(0,0,0,0.12)",fontFamily:"system-ui,-apple-system,sans-serif",padding:"14px",maxHeight:"70vh",overflowY:"auto"},children:[(0,f.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"10px"},children:[(0,f.jsxs)("div",{children:[(0,f.jsx)("p",{style:{margin:"0 0 2px",fontSize:"13px",fontWeight:600,color:"#0f172a"},children:"\u{1F916} AI Agent"}),(0,f.jsx)("p",{style:{margin:0,fontSize:"10px",color:"#10b981"},children:I==="gemini"?"Gemini Nano \xB7 On device":I==="transformers"?"Transformers.js \xB7 All devices":"Detecting..."})]}),(0,f.jsx)("button",{onClick:()=>V(!1),"aria-label":"Close agent panel",style:{background:"none",border:"none",cursor:"pointer",color:"#94a3b8",fontSize:"18px",lineHeight:1,padding:"2px"},children:"\xD7"})]}),(0,f.jsx)("p",{style:{margin:"0 0 8px",fontSize:"11px",color:"#64748b"},children:"Tell me what you want to do on this page. I will guide you step by step."}),(0,f.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px",marginBottom:"8px"},children:["Fill this form","Find contact info","What is this page?","Guide me to apply"].map(u=>(0,f.jsx)("button",{onClick:()=>oe(u),style:{padding:"3px 8px",borderRadius:"20px",fontSize:"10px",border:"1px solid #e2e8f0",background:"#f8fafc",color:"#64748b",cursor:"pointer"},children:u},u))}),(0,f.jsxs)("div",{style:{display:"flex",gap:"6px",marginBottom:"8px"},children:[(0,f.jsx)("input",{type:"text",value:W,onChange:u=>oe(u.target.value),onKeyDown:u=>{u.key==="Enter"&&Xe()},placeholder:"e.g. Help me fill this form",disabled:D||!I,"aria-label":"Tell the agent what to do",style:{flex:1,padding:"8px 10px",borderRadius:"8px",border:"1px solid #e2e8f0",fontSize:"12px",color:"#0f172a",background:I?"#fff":"#f8fafc",outline:"none",height:"36px"}}),(0,f.jsx)("button",{onClick:Xe,disabled:D||!W.trim()||!I,"aria-label":"Run agent",style:{padding:"8px 12px",borderRadius:"8px",border:"none",background:I&&W.trim()&&!D?"#10b981":"#e2e8f0",color:I&&W.trim()&&!D?"#fff":"#94a3b8",fontSize:"12px",fontWeight:600,cursor:I&&W.trim()&&!D?"pointer":"not-allowed",height:"36px",minWidth:"52px",transition:"background 0.2s"},children:D?"...":"Go"})]}),Ve.length>0&&(0,f.jsxs)("div",{style:{padding:"10px 12px",background:"#f0fdf4",border:"1px solid #86efac",borderRadius:"8px",fontSize:"11px",color:"#166534",lineHeight:1.7},children:[Ve.map((u,w)=>(0,f.jsx)("p",{style:{margin:"0 0 2px"},children:u},w)),Bt==="done"&&(0,f.jsx)("button",{onClick:()=>{Se([]),oe(""),ue("")},style:{display:"block",marginTop:"6px",background:"none",border:"none",color:"#94a3b8",fontSize:"10px",cursor:"pointer",padding:0},children:"Clear"})]}),!I&&(0,f.jsx)("p",{style:{margin:"4px 0 0",fontSize:"10px",color:"#94a3b8"},children:"Enable Gemini Nano via chrome://flags for best results."})]}),a&&(0,f.jsx)("button",{style:Te(Ke,C?"#7c3aed":"#6d28d9",C),"aria-label":"Ask a question about this page","aria-haspopup":"dialog","aria-expanded":C,title:`\u{1F4AC} Ask this page \xB7 ${Ze}`,onClick:()=>{L(u=>!u),o(!1),V(!1)},onMouseEnter:Ee,onMouseLeave:Le,children:"\u{1F4AC}"}),a&&C&&(0,f.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":"Ask this page","data-yuktai-panel":"true",style:{position:"fixed",bottom:`${Ke+64}px`,[e]:"24px",zIndex:9999,width:"300px",maxWidth:"calc(100vw - 48px)",background:"#fff",border:"1px solid #e2e8f0",borderRadius:"16px",boxShadow:"0 8px 32px rgba(0,0,0,0.12)",fontFamily:"system-ui,-apple-system,sans-serif",padding:"14px"},children:[(0,f.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"10px"},children:[(0,f.jsxs)("div",{children:[(0,f.jsx)("p",{style:{margin:"0 0 2px",fontSize:"13px",fontWeight:600,color:"#0f172a"},children:"\u{1F4AC} Ask this page"}),(0,f.jsx)("p",{style:{margin:0,fontSize:"10px",color:"#7c3aed"},children:Ze}),k==="transformers"&&ne==="loading"&&(0,f.jsx)("p",{style:{margin:"2px 0 0",fontSize:"9px",color:"#94a3b8"},children:"Downloading model \u2014 first time only"}),k==="transformers"&&ne==="ready"&&(0,f.jsx)("p",{style:{margin:"2px 0 0",fontSize:"9px",color:"#10b981"},children:"Model ready \u2705 \u2014 works offline"})]}),(0,f.jsx)("button",{onClick:()=>L(!1),"aria-label":"Close ask panel",style:{background:"none",border:"none",cursor:"pointer",color:"#94a3b8",fontSize:"18px",lineHeight:1,padding:"2px"},children:"\xD7"})]}),(0,f.jsxs)("div",{style:{display:"flex",gap:"6px",marginBottom:"8px"},children:[(0,f.jsx)("input",{type:"text",value:R,onChange:u=>y(u.target.value),onKeyDown:u=>{u.key==="Enter"&&Je()},placeholder:"e.g. What does this page do?",disabled:P||!k,"aria-label":"Ask a question about this page",style:{flex:1,padding:"8px 10px",borderRadius:"8px",border:"1px solid #e2e8f0",fontSize:"12px",color:"#0f172a",background:k?"#fff":"#f8fafc",outline:"none",height:"36px"}}),(0,f.jsx)("button",{onClick:Je,disabled:P||!R.trim()||!k,"aria-label":"Submit question",style:{padding:"8px 12px",borderRadius:"8px",border:"none",background:k&&R.trim()&&!P?"#7c3aed":"#e2e8f0",color:k&&R.trim()&&!P?"#fff":"#94a3b8",fontSize:"12px",fontWeight:600,cursor:k&&R.trim()&&!P?"pointer":"not-allowed",height:"36px",minWidth:"48px",transition:"background 0.2s"},children:P?_t:"Ask"})]}),ee&&(0,f.jsxs)("div",{style:{padding:"10px",background:"#f5f3ff",borderRadius:"8px",fontSize:"12px",color:"#4c1d95",lineHeight:1.6,maxHeight:"180px",overflowY:"auto"},children:[(0,f.jsx)("strong",{style:{display:"block",marginBottom:"4px",fontSize:"11px",color:"#7c3aed"},children:"\u{1F4AC} Answer"}),ee,(0,f.jsx)("button",{onClick:()=>{B(""),y("")},style:{display:"block",marginTop:"6px",background:"none",border:"none",color:"#94a3b8",fontSize:"10px",cursor:"pointer",padding:0},children:"Clear"})]}),!k&&(0,f.jsx)("p",{style:{margin:"4px 0 0",fontSize:"10px",color:"#94a3b8"},children:"Detecting AI engine..."})]}),(0,f.jsx)("button",{style:Te(qt,b?"#0d9488":"#1a73e8",s),"aria-label":"Open accessibility preferences","aria-haspopup":"dialog","aria-expanded":s,"data-yuktai-pref-toggle":"true",title:"\u267F Accessibility settings",onClick:()=>{o(u=>!u),L(!1),V(!1)},onMouseEnter:Ee,onMouseLeave:Le,children:"\u267F"}),s&&(0,f.jsx)(_e,{ref:$,position:e,settings:l,report:p,isActive:b,aiSupported:N,voiceSupported:A,set:Gt,onApply:Ot,onReset:Dt,onClose:()=>o(!1)})]})}g();var le={name:"ai.text",async execute(e){return`\u{1F916} YuktAI says: ${e}`}};g();var ce={name:"voice.text",async execute(e){return!e||e.trim()===""?"\u{1F3A4} No speech detected":`\u{1F3A4} You said: ${e}`}};g();var j=class{plugins=new Map;register(t,n){if(!n||typeof n.execute!="function")throw new Error(`Invalid plugin: ${t}`);this.plugins.set(t,n)}use(t){return this.plugins.get(t)}async run(t,n){try{let a=this.use(t);if(!a)throw new Error(`Plugin not found: ${t}`);return await a.execute(n)}catch(a){throw console.error(`[YuktAI Runtime Error in ${t}]:`,a),a}}getPlugins(){return Array.from(this.plugins.keys())}};function qn(){if(typeof globalThis>"u")return new j;if(!globalThis.__yuktai_runtime__){let e=new j;e.register(M.name,M),e.register(le.name,le),e.register(ce.name,ce),globalThis.__yuktai_runtime__=e}return globalThis.__yuktai_runtime__}var Nt=typeof window<"u"?qn():new j,On={wcagPlugin:M,list(){return Nt.getPlugins()},use(e){return Nt.use(e)},fix(e){return M.applyFixes({enabled:!0,autoFix:!0,...e})},scan(){return M.scan()}};
|
|
1521
|
+
`,document.body.appendChild(e),kt=e}function Rt(e){let t={critical:20,serious:10,moderate:5,minor:2},o=e.details.reduce((a,r)=>a+(t[r.severity]||0),0);return Math.max(0,Math.min(100,100-o))}var P={name:"yuktai-a11y",version:"4.0.0",observer:null,async execute(e){if(!e.enabled)return this.stopObserver(),"yuktai: disabled.";Q=e,en(e),tn(),on(),Yo(),Ko(),e.showSkipLinks!==!1&&Uo(),e.showPreferencePanel,Qo(e);let t=this.applyFixes(e);t.score=Rt(t),e.showAuditBadge&&Zo(t),e.timeoutWarning&&Nt(e.timeoutWarning),e.autoFix&&this.startObserver(e),e.plainEnglish&&await Tt(!0),e.summarisePage&&await Et(!0),e.translateLanguage&&e.translateLanguage!=="en"&&await Ct(e.translateLanguage),e.voiceControl&&await Lt(!0),e.smartLabels&&await Mt(!0);let o=`${t.fixed} fixes applied. Score: ${t.score}/100.`;return w(o,t.score>=90?"success":"info",!1),`yuktai v4.0.0: ${o} Scanned ${t.scanned} elements in ${t.renderTime}ms.`},applyFixes(e){let t={fixed:0,scanned:0,renderTime:0,score:100,details:[]};if(typeof document>"u")return t;let o=performance.now(),a=document.querySelectorAll("*");t.scanned=a.length;let r=(i,n,s,c)=>{t.details.push({tag:i,fix:n,severity:s,element:c.outerHTML.slice(0,100)}),t.fixed++};return a.forEach(i=>{let n=i,s=n.tagName.toLowerCase();if(s==="html"&&!n.getAttribute("lang")&&(n.setAttribute("lang","en"),r(s,'lang="en" added',"critical",n)),s==="meta"){let p=n.getAttribute("name"),h=n.getAttribute("content")||"";p==="viewport"&&h.includes("user-scalable=no")&&(n.setAttribute("content",h.replace("user-scalable=no","user-scalable=yes")),r(s,"user-scalable=yes restored","serious",n)),p==="viewport"&&/maximum-scale=1(?:[^0-9]|$)/.test(h)&&(n.setAttribute("content",h.replace(/maximum-scale=1(?=[^0-9]|$)/,"maximum-scale=5")),r(s,"maximum-scale=5 restored","serious",n))}if(s==="main"&&!n.getAttribute("tabindex")&&(n.setAttribute("tabindex","-1"),n.getAttribute("id")||n.setAttribute("id","main-content")),s==="img"&&(n.hasAttribute("alt")||(n.setAttribute("alt",""),n.setAttribute("aria-hidden","true"),r(s,'alt="" aria-hidden="true"',"serious",n))),s==="svg"&&(!n.getAttribute("aria-hidden")&&!n.getAttribute("aria-label")&&!i.querySelector("title")&&(n.setAttribute("aria-hidden","true"),r(s,'aria-hidden="true" (decorative svg)',"minor",n)),n.getAttribute("focusable")||n.setAttribute("focusable","false")),s==="iframe"&&!n.getAttribute("title")&&!n.getAttribute("aria-label")&&(n.setAttribute("title","embedded content"),n.setAttribute("aria-label","embedded content"),r(s,"title + aria-label added","serious",n)),s==="button"){if(!n.innerText?.trim()&&!n.getAttribute("aria-label")){let p=n.getAttribute("title")||"button";n.setAttribute("aria-label",p),r(s,`aria-label="${p}" (empty button)`,"critical",n)}n.hasAttribute("disabled")&&!n.getAttribute("aria-disabled")&&(n.setAttribute("aria-disabled","true"),t.fixed++)}if(s==="a"){let p=n;!n.innerText?.trim()&&!n.getAttribute("aria-label")&&(n.setAttribute("aria-label",n.getAttribute("title")||"link"),r(s,"aria-label added (empty link)","critical",n)),p.target==="_blank"&&!p.rel?.includes("noopener")&&(p.rel="noopener noreferrer",t.fixed++)}if(At.has(s)){let p=n;if(!n.getAttribute("aria-label")&&!n.getAttribute("aria-labelledby")){let h=n.getAttribute("placeholder")||n.getAttribute("name")||s;n.setAttribute("aria-label",h),r(s,`aria-label="${h}"`,"serious",n)}if(n.hasAttribute("required")&&!n.getAttribute("aria-required")&&(n.setAttribute("aria-required","true"),t.fixed++),s==="input"&&!p.autocomplete){let h=p.name||"";p.type==="email"||h.includes("email")?p.autocomplete="email":p.type==="tel"||h.includes("tel")?p.autocomplete="tel":p.type==="password"&&(p.autocomplete="current-password"),t.fixed++}}s==="th"&&!n.getAttribute("scope")&&(n.setAttribute("scope",n.closest("thead")?"col":"row"),r(s,"scope added to <th>","moderate",n)),Be[s]&&!n.getAttribute("role")&&(n.setAttribute("role",Be[s]),r(s,`role="${Be[s]}"`,"minor",n));let c=n.getAttribute("role")||"";c==="tab"&&!n.getAttribute("aria-selected")&&(n.setAttribute("aria-selected","false"),t.fixed++),["alert","status","log"].includes(c)&&!n.getAttribute("aria-live")&&(n.setAttribute("aria-live",c==="alert"?"assertive":"polite"),r(s,`aria-live added on role=${c}`,"moderate",n)),c==="combobox"&&!n.getAttribute("aria-expanded")&&(n.setAttribute("aria-expanded","false"),r(s,'aria-expanded="false" on combobox',"serious",n)),(c==="checkbox"||c==="radio")&&!n.getAttribute("aria-checked")&&(n.setAttribute("aria-checked","false"),r(s,`aria-checked="false" on role=${c}`,"serious",n))}),t.renderTime=parseFloat((performance.now()-o).toFixed(2)),t},scan(){let e={fixed:0,scanned:0,renderTime:0,score:100,details:[]};if(typeof document>"u")return e;let t=performance.now(),o=document.querySelectorAll("*");e.scanned=o.length;let a=(r,i,n,s)=>e.details.push({tag:r,fix:i,severity:n,element:s.outerHTML.slice(0,100)});return o.forEach(r=>{let i=r,n=i.tagName.toLowerCase();(n==="a"||n==="button")&&!i.innerText?.trim()&&!i.getAttribute("aria-label")&&a(n,"needs aria-label (empty)","critical",i),n==="img"&&!i.hasAttribute("alt")&&a(n,"needs alt text","serious",i),At.has(n)&&!i.getAttribute("aria-label")&&!i.getAttribute("aria-labelledby")&&a(n,"needs aria-label","serious",i),n==="iframe"&&!i.getAttribute("title")&&!i.getAttribute("aria-label")&&a(n,"iframe needs title","serious",i)}),e.fixed=e.details.length,e.score=Rt(e),e.renderTime=parseFloat((performance.now()-t).toFixed(2)),e},startObserver(e){this.observer||typeof document>"u"||(this.observer=new MutationObserver(()=>this.applyFixes(e)),this.observer.observe(document.body,{childList:!0,subtree:!0,attributes:!1}))},stopObserver(){this.observer?.disconnect(),this.observer=null},announce:w,speak:Ge,showVisualAlert:Pt,trapFocus:Le,handlePlainEnglish:Tt,handleSummarisePage:Et,handleTranslate:Ct,handleVoiceControl:Lt,handleSmartLabels:Mt,SUPPORTED_LANGUAGES:Se};g();g();var y=Ne(require("react"));g();var M=require("react");De();de();var l=require("react/jsx-runtime"),Ye={highContrast:!1,reduceMotion:!1,autoFix:!0,dyslexiaFont:!1,fontScale:100,localFont:"",darkMode:!1,largeTargets:!1,speechEnabled:!1,colorBlindMode:"none",showAuditBadge:!1,timeoutWarning:void 0,plainEnglish:!1,summarisePage:!1,translateLanguage:"en",voiceControl:!1,smartLabels:!1},te=[80,90,100,110,120,130],mn=[{value:"none",label:"None"},{value:"deuteranopia",label:"Deuteranopia"},{value:"protanopia",label:"Protanopia"},{value:"tritanopia",label:"Tritanopia"},{value:"achromatopsia",label:"Greyscale"}],fn=["Prompt API for Gemini Nano","Summarization API for Gemini Nano","Writer API for Gemini Nano","Rewriter API for Gemini Nano","Translation API"];function gn(){let[e,t]=(0,M.useState)(typeof window<"u"?window.innerWidth:1024);return(0,M.useEffect)(()=>{let o=()=>t(window.innerWidth);return window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[]),{isMobile:e<=480,isTablet:e>480&&e<=768}}function bn({checked:e,onChange:t,label:o,disabled:a=!1}){return(0,l.jsxs)("label",{"aria-label":o,style:{position:"relative",display:"inline-flex",width:"40px",height:"24px",cursor:a?"not-allowed":"pointer",flexShrink:0,opacity:a?.4:1},children:[(0,l.jsx)("input",{type:"checkbox",checked:e,disabled:a,onChange:r=>t(r.target.checked),style:{opacity:0,width:0,height:0,position:"absolute"}}),(0,l.jsx)("span",{style:{position:"absolute",inset:0,borderRadius:"99px",background:e?"#0d9488":"#cbd5e1",transition:"background 0.2s"}}),(0,l.jsx)("span",{style:{position:"absolute",top:"3px",left:e?"19px":"3px",width:"18px",height:"18px",background:"#fff",borderRadius:"50%",transition:"left 0.2s",boxShadow:"0 1px 3px rgba(0,0,0,0.2)",pointerEvents:"none"}})]})}function oe({label:e,color:t="#64748b",badge:o,concept:a}){return(0,l.jsxs)("div",{style:{margin:"10px 18px 4px"},children:[(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,l.jsx)("p",{style:{margin:0,fontSize:"10px",fontWeight:600,color:t,letterSpacing:"0.06em",textTransform:"uppercase"},children:e}),o&&(0,l.jsx)("span",{style:{fontSize:"9px",fontWeight:500,padding:"1px 7px",borderRadius:"99px",background:"#f5f3ff",color:"#7c3aed",border:"0.5px solid #c4b5fd",whiteSpace:"nowrap"},children:o})]}),a&&(0,l.jsx)("p",{style:{margin:"2px 0 0",fontSize:"9px",color:"#94a3b8",fontStyle:"italic"},children:a})]})}function W({icon:e,label:t,desc:o,checked:a,onChange:r,disabled:i=!1,disabledReason:n,tip:s}){return(0,l.jsxs)("div",{title:i?n:s,style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 18px",gap:"12px"},children:[(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"10px",flex:1,minWidth:0},children:[(0,l.jsx)("span",{"aria-hidden":"true",style:{width:"32px",height:"32px",borderRadius:"8px",background:i?"#f1f5f9":"#f0fdfa",color:i?"#94a3b8":"#0d9488",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"15px",flexShrink:0,fontWeight:700},children:e}),(0,l.jsxs)("div",{style:{minWidth:0},children:[(0,l.jsx)("p",{style:{margin:0,fontSize:"13px",fontWeight:500,color:i?"#94a3b8":"#0f172a",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t}),(0,l.jsx)("p",{style:{margin:0,fontSize:"10px",color:"#94a3b8"},children:i?n:o})]})]}),(0,l.jsx)(bn,{checked:a,onChange:r,label:`Toggle ${t}`,disabled:i})]})}function L(){return(0,l.jsx)("div",{style:{height:"1px",background:"#f1f5f9"}})}function pe({steps:e}){return(0,l.jsxs)("div",{style:{margin:"0 18px 8px",padding:"8px 10px",background:"#f8fafc",borderRadius:"8px",border:"0.5px solid #e2e8f0"},children:[(0,l.jsx)("p",{style:{margin:"0 0 4px",fontSize:"9px",fontWeight:600,color:"#64748b",textTransform:"uppercase",letterSpacing:"0.05em"},children:"How to use"}),e.map((t,o)=>(0,l.jsxs)("p",{style:{margin:"0 0 2px",fontSize:"10px",color:"#475569"},children:[o+1,". ",t]},o))]})}var Ke=(0,M.forwardRef)(({position:e,settings:t,report:o,isActive:a,aiSupported:r,voiceSupported:i,set:n,onApply:s,onReset:c,onClose:p},h)=>{let{isMobile:b,isTablet:$}=gn(),[N,G]=(0,M.useState)([]),[A,x]=(0,M.useState)(""),[z,R]=(0,M.useState)(""),[C,I]=(0,M.useState)(!1),[v,ne]=(0,M.useState)(null),[q,H]=(0,M.useState)("idle");(0,M.useEffect)(()=>{let d=window;!!(d.LanguageModel||d.ai?.languageModel)&&r?ne("gemini"):le()&&ne("transformers")},[r]),(0,M.useEffect)(()=>{if(v!=="transformers")return;let d=setInterval(()=>{H(ce())},500);return()=>clearInterval(d)},[v]);let ae=async()=>{if(!(!A.trim()||C)){if(!v){R("\u26A0\uFE0F No AI engine available on this device.");return}I(!0),R("");try{let d;v==="gemini"?d=await qe(A):(H("loading"),d=await Ve(A),H("ready")),R(d.success&&d.answer?d.answer.replace(/\*\*(.*?)\*\*/g,"$1").replace(/\*(.*?)\*/g,"$1").replace(/#+\s/g,"").trim():"\u26A0\uFE0F "+(d.error||"No answer found on this page"))}catch{R("\u26A0\uFE0F Failed to get answer. Please try again.")}I(!1)}};(0,M.useEffect)(()=>{(async()=>{try{let _=window;if(!_.queryLocalFonts)return;let j=await _.queryLocalFonts(),B=[...new Set(j.map(ie=>ie.family))].sort();G(B.slice(0,50))}catch{}})()},[]);let T=v==="gemini"?"Gemini Nano":v==="transformers"?"Transformers.js \xB7 All devices":"Detecting...",fe=v==="transformers"&&q==="loading"?"Loading AI model... (first time only)":"...",re=b?{position:"fixed",bottom:0,left:0,right:0,zIndex:9999,background:"#fff",border:"1px solid #e2e8f0",borderRadius:"16px 16px 0 0",boxShadow:"0 -8px 32px rgba(0,0,0,0.12)",maxHeight:"90vh",overflowY:"auto",fontFamily:"system-ui,-apple-system,sans-serif",width:"100%"}:{position:"fixed",bottom:"84px",[e]:"24px",zIndex:9999,width:$?"300px":"320px",maxWidth:"calc(100vw - 48px)",background:"#fff",border:"1px solid #e2e8f0",borderRadius:"16px",boxShadow:"0 8px 32px rgba(0,0,0,0.12)",maxHeight:"80vh",overflowY:"auto",fontFamily:"system-ui,-apple-system,sans-serif"};return(0,l.jsxs)("div",{ref:h,role:"dialog","aria-modal":"true","aria-label":"yuktai accessibility preferences","data-yuktai-panel":"true",style:re,children:[(0,l.jsxs)("div",{style:{padding:"14px 18px 12px",borderBottom:"1px solid #f1f5f9",display:"flex",alignItems:"flex-start",justifyContent:"space-between",position:"sticky",top:0,background:"#fff",zIndex:1},children:[(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"7px",marginBottom:"4px",flexWrap:"wrap"},children:[(0,l.jsx)("span",{style:{fontSize:"10px",fontWeight:700,padding:"2px 7px",borderRadius:"99px",background:"#f0fdfa",color:"#0d9488",letterSpacing:"0.05em",fontFamily:"monospace"},children:"@yuktishaalaa/yuktai"}),a&&(0,l.jsx)("span",{style:{fontSize:"10px",fontWeight:700,padding:"2px 7px",borderRadius:"99px",background:"#f0fdfa",color:"#0f766e",border:"1px solid #99f6e4"},children:"\u25CF ACTIVE"})]}),(0,l.jsx)("p",{style:{margin:"0 0 1px",fontSize:"15px",fontWeight:600,color:"#0f172a"},children:"Accessibility"}),(0,l.jsx)("p",{style:{margin:0,fontSize:"11px",color:"#64748b"},children:"WCAG 2.2 \xB7 Open source \xB7 Zero cost \xB7 All devices"})]}),(0,l.jsx)("button",{onClick:p,"aria-label":"Close accessibility panel",style:{background:"none",border:"none",cursor:"pointer",padding:"4px",color:"#94a3b8",fontSize:"20px",lineHeight:1,borderRadius:"6px",flexShrink:0,minWidth:b?"44px":"auto",minHeight:b?"44px":"auto",display:"flex",alignItems:"center",justifyContent:"center"},children:"\xD7"})]}),(0,l.jsx)(oe,{label:"\u267F Core Accessibility",concept:"Rule-based engine \u2014 works on all browsers and devices"}),(0,l.jsx)(pe,{steps:["Toggle any feature on","Click Apply settings","Preferences saved automatically"]}),(0,l.jsx)(W,{icon:"\u{1F527}",label:"Auto-fix ARIA",desc:"Injects missing labels and roles automatically",checked:t.autoFix,onChange:d=>n("autoFix",d),tip:"Fixes aria-label, alt text, roles on every element"}),(0,l.jsx)(L,{}),(0,l.jsx)(W,{icon:"\u{1F50A}",label:"Speak on focus",desc:"Browser reads elements aloud as you tab",checked:t.speechEnabled,onChange:d=>n("speechEnabled",d),tip:"Uses browser SpeechSynthesis \u2014 no install needed"}),(0,l.jsx)(L,{}),(0,l.jsx)(W,{icon:"\u{1F399}\uFE0F",label:"Voice control",desc:"Say commands to navigate the page",checked:t.voiceControl,onChange:d=>n("voiceControl",d),disabled:!i,disabledReason:"Not supported in this browser",tip:'Say "scroll down", "go to main", "click"'}),(0,l.jsx)(L,{}),(0,l.jsx)(oe,{label:"\u{1F916} AI Features",color:"#7c3aed",badge:"Gemini Nano",concept:"Large Language Model running privately on your device \u2014 Chrome 127+ only"}),(0,l.jsx)("div",{style:{margin:"4px 18px 6px",padding:"8px 10px",background:r?"#f0fdfa":"#f5f3ff",borderRadius:"8px",border:`0.5px solid ${r?"#99f6e4":"#c4b5fd"}`,fontSize:"10px",color:r?"#0f766e":"#7c3aed",lineHeight:1.5},children:r?"\u2705 Gemini Nano detected \u2014 AI features ready. Runs privately on your device.":"\u2699\uFE0F AI features need one-time setup \u2014 see guide below."}),!r&&(0,l.jsxs)("div",{style:{margin:"0 18px 8px",padding:"10px 12px",background:"#fafafa",borderRadius:"8px",border:"0.5px solid #e2e8f0",fontSize:"11px",color:"#475569",lineHeight:1.7},children:[(0,l.jsx)("p",{style:{margin:"0 0 6px",fontWeight:600,color:"#0f172a",fontSize:"11px"},children:"\u{1F6E0} One-time setup \u2014 5 steps:"}),(0,l.jsxs)("p",{style:{margin:"0 0 3px"},children:["1. Open Chrome \u2192 ",(0,l.jsx)("code",{style:{background:"#f1f5f9",padding:"1px 5px",borderRadius:"4px",fontSize:"10px",color:"#0d9488",fontFamily:"monospace"},children:"chrome://flags"})]}),(0,l.jsx)("p",{style:{margin:"0 0 3px"},children:"2. Enable each flag:"}),(0,l.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:"2px",margin:"4px 0 6px 10px"},children:fn.map(d=>(0,l.jsxs)("span",{style:{fontSize:"10px",color:"#7c3aed",fontFamily:"monospace"},children:["\u2192 ",d]},d))}),(0,l.jsxs)("p",{style:{margin:"0 0 3px"},children:["3. Click ",(0,l.jsx)("strong",{style:{color:"#0f172a"},children:"Relaunch"})]}),(0,l.jsxs)("p",{style:{margin:"0 0 3px"},children:["4. ",(0,l.jsx)("code",{style:{background:"#f1f5f9",padding:"1px 5px",borderRadius:"4px",fontSize:"10px",color:"#0d9488",fontFamily:"monospace"},children:"chrome://components"})," \u2192 Optimization Guide On Device Model \u2192 Check for update"]}),(0,l.jsx)("p",{style:{margin:"0"},children:"5. Refresh \u2014 AI features unlock automatically \u2705"})]}),(0,l.jsx)(W,{icon:"\u{1F4DD}",label:"Plain English mode",desc:"Rewrites complex text in simple language",checked:t.plainEnglish,onChange:d=>n("plainEnglish",d),disabled:!r,disabledReason:"Enable Gemini Nano \u2014 see setup above",tip:"AI concept: LLM text rewriting"}),(0,l.jsx)(L,{}),(0,l.jsx)(W,{icon:"\u{1F4CB}",label:"Summarise page",desc:"3-sentence summary appears at top",checked:t.summarisePage,onChange:d=>n("summarisePage",d),disabled:!r,disabledReason:"Enable Gemini Nano \u2014 see setup above",tip:"AI concept: Abstractive summarisation"}),(0,l.jsx)(L,{}),(0,l.jsx)(W,{icon:"\u{1F3F7}\uFE0F",label:"Smart aria-labels",desc:"AI generates meaningful labels for elements",checked:t.smartLabels,onChange:d=>n("smartLabels",d),disabled:!r,disabledReason:"Enable Gemini Nano \u2014 see setup above",tip:"AI concept: Context-aware label generation"}),(0,l.jsx)(L,{}),(0,l.jsx)(oe,{label:"\u{1F441}\uFE0F Visual",concept:"CSS filter-based \u2014 works on all browsers and devices"}),(0,l.jsx)(pe,{steps:["Toggle any visual mode","Changes apply instantly","Works on mobile and desktop"]}),(0,l.jsx)(W,{icon:"\u25D1",label:"High contrast",desc:"Boosts contrast for low vision users",checked:t.highContrast,onChange:d=>n("highContrast",d),tip:"CSS filter: contrast()"}),(0,l.jsx)(L,{}),(0,l.jsx)(W,{icon:"\u{1F319}",label:"Dark mode",desc:"Inverts colours \u2014 easy on eyes at night",checked:t.darkMode,onChange:d=>n("darkMode",d),tip:"CSS filter: invert + hue-rotate"}),(0,l.jsx)(L,{}),(0,l.jsx)(W,{icon:"\u23F8\uFE0F",label:"Reduce motion",desc:"Disables all animations",checked:t.reduceMotion,onChange:d=>n("reduceMotion",d),tip:"WCAG 2.3.3 \u2014 vestibular disorders"}),(0,l.jsx)(L,{}),(0,l.jsx)(W,{icon:"\u{1F446}",label:"Large targets",desc:"44\xD744px minimum touch targets",checked:t.largeTargets,onChange:d=>n("largeTargets",d),tip:"WCAG 2.5.8 \u2014 motor impaired users"}),(0,l.jsx)(L,{}),(0,l.jsxs)("div",{style:{padding:"10px 18px"},children:[(0,l.jsx)("p",{style:{margin:"0 0 2px",fontSize:"12px",fontWeight:500,color:"#0f172a"},children:"\u{1F3A8} Colour blindness"}),(0,l.jsx)("p",{style:{margin:"0 0 8px",fontSize:"10px",color:"#94a3b8"},children:"SVG colour matrix filters \u2014 all devices"}),(0,l.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px"},children:mn.map(d=>(0,l.jsx)("button",{onClick:()=>n("colorBlindMode",d.value),"aria-pressed":t.colorBlindMode===d.value,style:{padding:"4px 10px",borderRadius:"20px",fontSize:"11px",fontWeight:500,border:`1px solid ${t.colorBlindMode===d.value?"#0d9488":"#e2e8f0"}`,background:t.colorBlindMode===d.value?"#f0fdfa":"#fff",color:t.colorBlindMode===d.value?"#0d9488":"#64748b",cursor:"pointer",minHeight:b?"36px":"auto"},children:d.label},d.value))})]}),(0,l.jsx)(L,{}),(0,l.jsx)(oe,{label:"\u{1F524} Font",concept:"Browser Font API + CSS \u2014 Chrome 103+"}),(0,l.jsx)(pe,{steps:["Toggle dyslexia font or pick from device","Adjust size with + / \u2212","Saved across visits"]}),(0,l.jsx)(W,{icon:"Aa",label:"Dyslexia-friendly font",desc:"Atkinson Hyperlegible \u2014 research-backed",checked:t.dyslexiaFont,onChange:d=>n("dyslexiaFont",d),tip:"By Braille Institute \u2014 free and open source"}),(0,l.jsx)(L,{}),(0,l.jsxs)("div",{style:{padding:"10px 18px"},children:[(0,l.jsx)("p",{style:{margin:"0 0 2px",fontSize:"12px",fontWeight:500,color:"#0f172a"},children:"\u{1F5A5}\uFE0F Local font"}),(0,l.jsx)("p",{style:{margin:"0 0 8px",fontSize:"10px",color:"#94a3b8"},children:"window.queryLocalFonts() \u2014 Chrome 103+"}),N.length>0?(0,l.jsxs)("select",{value:t.localFont,onChange:d=>n("localFont",d.target.value),"aria-label":"Choose a font from your device",style:{width:"100%",padding:"8px 10px",borderRadius:"8px",border:"1px solid #e2e8f0",fontSize:"13px",color:"#0f172a",background:"#fff",cursor:"pointer",height:b?"44px":"36px"},children:[(0,l.jsx)("option",{value:"",children:"System default"}),N.map(d=>(0,l.jsx)("option",{value:d,style:{fontFamily:d},children:d},d))]}):(0,l.jsx)("p",{style:{margin:0,fontSize:"11px",color:"#94a3b8"},children:"Allow font access when Chrome prompts you."})]}),(0,l.jsx)(L,{}),(0,l.jsxs)("div",{style:{padding:"10px 18px 14px"},children:[(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"10px"},children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{style:{margin:0,fontSize:"12px",fontWeight:500,color:"#0f172a"},children:"\u{1F4CF} Text size"}),(0,l.jsx)("p",{style:{margin:0,fontSize:"10px",color:"#94a3b8"},children:"Scales all text on the page"})]}),(0,l.jsxs)("span",{style:{fontSize:"12px",fontWeight:600,color:"#0d9488",background:"#f0fdfa",padding:"2px 8px",borderRadius:"99px"},children:[t.fontScale,"%"]})]}),(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,l.jsx)("button",{onClick:()=>{let d=te.indexOf(t.fontScale);d>0&&n("fontScale",te[d-1])},disabled:t.fontScale<=80,"aria-label":"Decrease text size",style:{width:b?"44px":"30px",height:b?"44px":"30px",borderRadius:"8px",border:"1px solid #e2e8f0",background:"#fff",cursor:t.fontScale<=80?"not-allowed":"pointer",fontSize:"16px",color:t.fontScale<=80?"#cbd5e1":"#0f172a",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:"\u2212"}),(0,l.jsx)("div",{style:{flex:1,display:"flex",gap:"3px"},children:te.map(d=>(0,l.jsx)("button",{onClick:()=>n("fontScale",d),"aria-label":`Set text size to ${d}%`,style:{flex:1,height:"6px",borderRadius:"99px",border:"none",cursor:"pointer",padding:0,background:d<=t.fontScale?"#0d9488":"#e2e8f0",transition:"background 0.15s"}},d))}),(0,l.jsx)("button",{onClick:()=>{let d=te.indexOf(t.fontScale);d<te.length-1&&n("fontScale",te[d+1])},disabled:t.fontScale>=130,"aria-label":"Increase text size",style:{width:b?"44px":"30px",height:b?"44px":"30px",borderRadius:"8px",border:"1px solid #e2e8f0",background:"#fff",cursor:t.fontScale>=130?"not-allowed":"pointer",fontSize:"16px",color:t.fontScale>=130?"#cbd5e1":"#0f172a",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:"+"})]})]}),(0,l.jsx)(L,{}),(0,l.jsx)(oe,{label:"\u{1F310} Translate",color:"#7c3aed",badge:"Gemini Nano",concept:"Chrome Translation API \u2014 on device, no internet after setup"}),(0,l.jsx)(pe,{steps:["Enable Gemini Nano first","Pick your language","Full page translates instantly"]}),(0,l.jsxs)("div",{style:{padding:"6px 18px 12px"},children:[(0,l.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px"},children:Se.slice(0,b?8:18).map(d=>(0,l.jsx)("button",{onClick:()=>n("translateLanguage",d.code),"aria-pressed":t.translateLanguage===d.code,disabled:!r,style:{padding:"4px 10px",borderRadius:"20px",fontSize:"11px",fontWeight:500,border:`1px solid ${t.translateLanguage===d.code?"#7c3aed":"#e2e8f0"}`,background:t.translateLanguage===d.code?"#f5f3ff":"#fff",color:t.translateLanguage===d.code?"#7c3aed":"#64748b",cursor:r?"pointer":"not-allowed",opacity:r?1:.5,minHeight:b?"36px":"auto"},children:d.label},d.code))}),!r&&(0,l.jsx)("p",{style:{margin:"6px 0 0",fontSize:"10px",color:"#94a3b8"},children:"Enable Gemini Nano using the setup guide above."})]}),(0,l.jsx)(L,{}),(0,l.jsx)(oe,{label:"\u{1F4AC} Ask This Page",color:"#0d9488",badge:T,concept:"RAG \u2014 Retrieval Augmented Generation. Works on all devices including mobile."}),(0,l.jsx)(pe,{steps:["Type any question about this page","Press Ask or hit Enter",v==="transformers"?"Transformers.js answers \u2014 works on mobile, offline":"Gemini Nano reads page and answers privately","Zero cost. No data leaves your device."]}),(0,l.jsxs)("div",{style:{margin:"0 18px 8px",padding:"6px 10px",background:v==="gemini"?"#f0fdfa":v==="transformers"?"#f5f3ff":"#f8fafc",borderRadius:"8px",border:`0.5px solid ${v==="gemini"?"#99f6e4":v==="transformers"?"#c4b5fd":"#e2e8f0"}`,fontSize:"10px",color:v==="gemini"?"#0f766e":v==="transformers"?"#7c3aed":"#94a3b8"},children:[v==="gemini"&&"\u2705 Using Gemini Nano \u2014 on device, private, instant",v==="transformers"&&"\u2705 Using Transformers.js \u2014 works on mobile and all browsers",!v&&"\u23F3 Detecting AI engine...",v==="transformers"&&q==="loading"&&" \xB7 Loading model...",v==="transformers"&&q==="ready"&&" \xB7 Model ready \u2705"]}),(0,l.jsxs)("div",{style:{padding:"0 18px 14px"},children:[(0,l.jsxs)("div",{style:{display:"flex",gap:"6px",marginBottom:"8px"},children:[(0,l.jsx)("input",{type:"text",value:A,onChange:d=>x(d.target.value),onKeyDown:d=>{d.key==="Enter"&&ae()},placeholder:"e.g. What does this page do?",disabled:C||!v,"aria-label":"Ask a question about this page",style:{flex:1,padding:"8px 10px",borderRadius:"8px",border:"1px solid #e2e8f0",fontSize:"12px",color:"#0f172a",background:v?"#fff":"#f8fafc",outline:"none",height:b?"44px":"36px"}}),(0,l.jsx)("button",{onClick:ae,disabled:C||!A.trim()||!v,"aria-label":"Ask question",style:{padding:"8px 14px",borderRadius:"8px",border:"none",background:v&&A.trim()&&!C?"#0d9488":"#e2e8f0",color:v&&A.trim()&&!C?"#fff":"#94a3b8",fontSize:"12px",fontWeight:600,cursor:v&&A.trim()&&!C?"pointer":"not-allowed",flexShrink:0,height:b?"44px":"36px",minWidth:"52px",transition:"background 0.2s"},children:C?fe:"Ask"})]}),z&&(0,l.jsxs)("div",{role:"status","aria-live":"polite",style:{padding:"10px 12px",background:"#f0fdfa",border:"1px solid #99f6e4",borderRadius:"8px",fontSize:"12px",color:"#0f766e",lineHeight:1.6,maxHeight:"180px",overflowY:"auto"},children:[(0,l.jsx)("strong",{style:{display:"block",marginBottom:"4px",fontSize:"11px",color:"#0d9488"},children:"\u{1F4AC} Answer"}),z,(0,l.jsx)("button",{onClick:()=>{R(""),x("")},style:{display:"block",marginTop:"6px",background:"none",border:"none",color:"#94a3b8",fontSize:"10px",cursor:"pointer",padding:0},children:"Clear"})]})]}),o&&(0,l.jsx)("div",{role:"status",style:{margin:"0 14px 10px",padding:"8px 12px",background:"#f0fdfa",border:"1px solid #99f6e4",borderRadius:"8px",fontSize:"12px",color:"#0f766e",fontWeight:500,fontFamily:"monospace"},children:o.fixed>0?`\u2713 ${o.fixed} fixes \xB7 ${o.scanned} nodes \xB7 ${o.renderTime}ms \xB7 Score: ${o.score}/100`:`\u2713 0 auto-fixes needed \xB7 ${o.scanned} nodes \xB7 ${o.renderTime}ms`}),(0,l.jsxs)("div",{style:{display:"flex",gap:"8px",padding:"12px 14px 14px",position:b?"sticky":"relative",bottom:b?0:"auto",background:"#fff",borderTop:"1px solid #f1f5f9"},children:[(0,l.jsx)("button",{onClick:c,style:{flex:1,padding:b?"12px 0":"8px 0",fontSize:"13px",fontWeight:500,borderRadius:"9px",border:"1px solid #e2e8f0",background:"#fff",color:"#64748b",cursor:"pointer"},children:"Reset"}),(0,l.jsx)("button",{onClick:s,style:{flex:2,padding:b?"12px 0":"8px 0",fontSize:"13px",fontWeight:600,borderRadius:"9px",border:"none",background:"#0d9488",color:"#fff",cursor:"pointer"},children:"Apply settings"})]})]})});Ke.displayName="WidgetPanel";de();g();var D=require("react");g();var yn={hotel:["hotel","resort","motel","inn","accommodation","lodge","stay","room","booking","hospitality"],ecommerce:["shop","store","ecommerce","e-commerce","sell","product","cart","buy","marketplace","retail"],restaurant:["restaurant","food","cafe","cafeteria","menu","dining","eat","cuisine","bistro","takeaway","delivery"],portfolio:["portfolio","freelance","personal","designer","developer","creative","showcase","work","hire me"],blog:["blog","article","post","write","news","magazine","journal","content"],saas:["saas","dashboard","app","software","platform","tool","analytics","admin","manage","crm"],government:["government","govt","portal","citizen","scheme","welfare","municipal","public","official"],healthcare:["hospital","clinic","doctor","health","medical","patient","appointment","pharmacy"],education:["school","college","university","course","learn","education","student","lms","training"],realestate:["real estate","property","house","flat","apartment","rent","buy property","listing"],landing:["landing","startup","launch","product launch","coming soon","waitlist"],generic:[]},hn={hotel:["home","rooms","booking","about","contact"],ecommerce:["home","products","cart","checkout","about","contact"],restaurant:["home","menu","reservations","about","contact"],portfolio:["home","portfolio","about","contact"],blog:["home","blog","about","contact"],saas:["home","pricing","dashboard","auth","about","contact"],government:["home","services","about","contact","faq"],healthcare:["home","services","booking","team","about","contact"],education:["home","services","pricing","about","contact"],realestate:["home","products","about","contact"],landing:["home","pricing","about","contact"],generic:["home","about","services","contact"]},xn={home:["home","homepage","main","landing"],about:["about","who we are","our story","company"],contact:["contact","reach us","get in touch","location"],services:["service","what we offer","solution","offering"],pricing:["pricing","price","plan","subscription","cost","fee"],blog:["blog","article","news","post"],auth:["login","register","signup","sign up","sign in","auth","account"],dashboard:["dashboard","admin","panel","manage","analytics"],gallery:["gallery","photo","image","portfolio"],products:["product","shop","store","item","catalogue"],cart:["cart","basket","shopping cart"],checkout:["checkout","payment","pay","order"],rooms:["room","suite","accommodation","stay"],booking:["booking","reserve","reservation","schedule","appointment"],menu:["menu","food","dish","cuisine"],reservations:["reservation","table booking","book table"],portfolio:["portfolio","work","project","case study"],team:["team","staff","member","people","who we are"],faq:["faq","question","answer","help","support"],terms:["terms","condition","legal"],privacy:["privacy","policy","gdpr","data"]},vn={Authentication:["login","register","auth","signup","sign in","account"],Payment:["payment","stripe","pay","checkout","billing"],Search:["search","filter","find"],"Dark mode":["dark mode","dark theme","night mode"],"Multi-language":["multilingual","multi language","translation","i18n"],SEO:["seo","search engine","meta","google"],Analytics:["analytics","tracking","stats","dashboard"],Email:["email","newsletter","contact form","notification"],Map:["map","location","address","google maps"],"Social media":["social","instagram","facebook","twitter","share"],"Image gallery":["gallery","photo","image","carousel"],"Booking system":["booking","reservation","appointment","schedule"],"Shopping cart":["cart","basket","shop","ecommerce"],"Blog/CMS":["blog","cms","content","article","post"]},wn={blue:["blue","navy","sky","ocean","corporate"],green:["green","nature","eco","environment","health","fresh"],purple:["purple","violet","luxury","creative","royal"],red:["red","bold","energy","passion","food"],orange:["orange","warm","friendly","fun"],teal:["teal","turquoise","modern","tech"],indigo:["indigo","professional","trust","finance","bank"],gray:["gray","minimal","clean","simple","neutral"]},kn={hotel:"indigo",ecommerce:"blue",restaurant:"red",portfolio:"purple",blog:"gray",saas:"teal",government:"blue",healthcare:"green",education:"indigo",realestate:"orange",landing:"purple",generic:"blue"};function Sn(e){let t=[/(?:for|called|named|company|business|brand)\s+["']?([A-Z][a-zA-Z\s]{1,30})["']?/i,/["']([A-Z][a-zA-Z\s]{1,30})["']/,/^([A-Z][a-zA-Z]+(?:\s[A-Z][a-zA-Z]+)?)/m];for(let o of t){let a=e.match(o);if(a?.[1]){let r=a[1].trim();if(r.length>2&&r.length<40)return r}}return"My Business"}function An(e){let t=e.toLowerCase(),o="generic",a=0;for(let[r,i]of Object.entries(yn)){let n=0;for(let s of i)t.includes(s)&&n++;n>a&&(a=n,o=r)}return o}function Tn(e,t){let o=e.toLowerCase(),a=new Set(hn[t]);for(let[r,i]of Object.entries(xn))for(let n of i)if(o.includes(n)){a.add(r);break}return a.add("home"),a.add("contact"),Array.from(a)}function En(e){let t=e.toLowerCase(),o=[];for(let[a,r]of Object.entries(vn))for(let i of r)if(t.includes(i)){o.push(a);break}return o}function Cn(e,t){let o=e.toLowerCase();for(let[a,r]of Object.entries(wn))for(let i of r)if(o.includes(i))return a;return kn[t]}function Wt(e){let t=An(e),o=Tn(e,t),a=En(e),r=Cn(e,t);return{siteName:Sn(e),websiteType:t,pages:o,features:a,theme:r,description:e.slice(0,200)}}var m=require("react/jsx-runtime"),Pn=["Hotel booking website for Grand Palace Hotels with rooms, booking and payment","E-commerce store for organic food products with cart and checkout","Restaurant website for Spice Garden with menu and table reservations","Portfolio website for a freelance designer with gallery and contact","SaaS dashboard for project management with pricing and auth","Government portal for citizen services with FAQ and contact"],Nn={home:"\u{1F3E0}",about:"\u2139\uFE0F",contact:"\u{1F4EC}",services:"\u2699\uFE0F",pricing:"\u{1F4B0}",blog:"\u{1F4DD}",auth:"\u{1F510}",dashboard:"\u{1F4CA}",gallery:"\u{1F5BC}\uFE0F",products:"\u{1F6D2}",cart:"\u{1F6CD}\uFE0F",checkout:"\u{1F4B3}",rooms:"\u{1F6CF}\uFE0F",booking:"\u{1F4C5}",menu:"\u{1F37D}\uFE0F",reservations:"\u{1FA91}",portfolio:"\u{1F4BC}",team:"\u{1F465}",faq:"\u2753",terms:"\u{1F4C4}",privacy:"\u{1F512}"},zn={hotel:"\u{1F3E8}",ecommerce:"\u{1F6D2}",restaurant:"\u{1F37D}\uFE0F",portfolio:"\u{1F4BC}",blog:"\u{1F4DD}",saas:"\u26A1",government:"\u{1F3DB}\uFE0F",healthcare:"\u{1F3E5}",education:"\u{1F393}",realestate:"\u{1F3E0}",landing:"\u{1F680}",generic:"\u{1F310}"};function Ze({position:e,onClose:t}){let[o,a]=(0,D.useState)("input"),[r,i]=(0,D.useState)(""),[n,s]=(0,D.useState)(null),[c,p]=(0,D.useState)(0),[h,b]=(0,D.useState)(""),$=(0,D.useCallback)(()=>{if(!r.trim())return;let x=Wt(r);s(x),a("preview")},[r]),N=(0,D.useCallback)(async()=>{if(n){a("generating"),p(0),b("");try{let x=[{msg:"Parsing requirement...",pct:15},{msg:"Loading templates...",pct:30},{msg:"Generating pages...",pct:55},{msg:"Building components...",pct:70},{msg:"Creating styles...",pct:85},{msg:"Packaging ZIP...",pct:95}];for(let R of x)p(R.pct),await new Promise(C=>setTimeout(C,200));let{generateZip:z}=await Promise.resolve().then(()=>(mo(),uo));await z(n),p(100),a("done")}catch(x){b(x instanceof Error?x.message:"Generation failed. Please try again."),a("preview")}}},[n]),G=()=>{a("input"),i(""),s(null),p(0),b("")},A={position:"fixed",bottom:"204px",[e]:"24px",zIndex:9999,width:"340px",maxWidth:"calc(100vw - 48px)",background:"#fff",border:"1px solid #e2e8f0",borderRadius:"16px",boxShadow:"0 8px 32px rgba(0,0,0,0.14)",fontFamily:"system-ui,-apple-system,sans-serif",maxHeight:"75vh",overflowY:"auto"};return(0,m.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":"yuktai Vibe Coder","data-yuktai-panel":"true",style:A,children:[(0,m.jsxs)("div",{style:{padding:"14px 16px 12px",borderBottom:"1px solid #f1f5f9",display:"flex",alignItems:"flex-start",justifyContent:"space-between",position:"sticky",top:0,background:"#fff",zIndex:1},children:[(0,m.jsxs)("div",{children:[(0,m.jsx)("p",{style:{margin:"0 0 2px",fontSize:"13px",fontWeight:700,color:"#0f172a"},children:"\u26A1 Vibe Coder"}),(0,m.jsx)("p",{style:{margin:0,fontSize:"10px",color:"#64748b"},children:"Describe your website \u2192 Download Next.js ZIP"})]}),(0,m.jsx)("button",{onClick:t,"aria-label":"Close vibe coder",style:{background:"none",border:"none",cursor:"pointer",color:"#94a3b8",fontSize:"18px",padding:"2px"},children:"\xD7"})]}),o==="input"&&(0,m.jsxs)("div",{style:{padding:"14px 16px"},children:[(0,m.jsx)("p",{style:{margin:"0 0 10px",fontSize:"11px",color:"#64748b"},children:"Describe your business website in plain English. The plugin will generate a complete Next.js project for you."}),(0,m.jsx)("p",{style:{margin:"0 0 6px",fontSize:"10px",fontWeight:600,color:"#94a3b8",textTransform:"uppercase"},children:"Examples"}),(0,m.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:"4px",marginBottom:"12px"},children:Pn.slice(0,3).map(x=>(0,m.jsx)("button",{onClick:()=>i(x),style:{padding:"6px 10px",borderRadius:"8px",border:"1px solid #e2e8f0",background:"#f8fafc",color:"#475569",fontSize:"10px",cursor:"pointer",textAlign:"left",lineHeight:1.4},children:x},x))}),(0,m.jsx)("textarea",{value:r,onChange:x=>i(x.target.value),placeholder:"e.g. I need a hotel booking website with rooms, search, and payment for Grand Palace Hotels",rows:4,"aria-label":"Describe your website",style:{width:"100%",padding:"10px",borderRadius:"8px",border:"1px solid #e2e8f0",fontSize:"12px",color:"#0f172a",resize:"vertical",outline:"none",fontFamily:"inherit",lineHeight:1.5}}),(0,m.jsx)("button",{onClick:$,disabled:!r.trim(),style:{width:"100%",marginTop:"10px",padding:"10px",borderRadius:"8px",border:"none",background:r.trim()?"#f59e0b":"#e2e8f0",color:r.trim()?"#fff":"#94a3b8",fontSize:"13px",fontWeight:700,cursor:r.trim()?"pointer":"not-allowed",transition:"background 0.2s"},children:"Analyse Requirement \u2192"})]}),o==="preview"&&n&&(0,m.jsxs)("div",{style:{padding:"14px 16px"},children:[h&&(0,m.jsxs)("div",{style:{padding:"10px",background:"#fef2f2",border:"1px solid #fca5a5",borderRadius:"8px",marginBottom:"12px",fontSize:"11px",color:"#dc2626"},children:["\u26A0\uFE0F ",h]}),(0,m.jsxs)("div",{style:{background:"#f8fafc",borderRadius:"10px",padding:"12px",marginBottom:"12px"},children:[(0,m.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px"},children:[(0,m.jsx)("span",{style:{fontSize:"1.5rem"},children:zn[n.websiteType]||"\u{1F310}"}),(0,m.jsxs)("div",{children:[(0,m.jsx)("p",{style:{margin:0,fontSize:"13px",fontWeight:700,color:"#0f172a"},children:n.siteName}),(0,m.jsxs)("p",{style:{margin:0,fontSize:"10px",color:"#64748b",textTransform:"capitalize"},children:[n.websiteType," website \xB7 ",n.theme," theme"]})]})]}),(0,m.jsxs)("p",{style:{margin:"8px 0 6px",fontSize:"10px",fontWeight:600,color:"#94a3b8",textTransform:"uppercase"},children:["Pages to generate (",n.pages.length,")"]}),(0,m.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px"},children:n.pages.map(x=>(0,m.jsxs)("span",{style:{padding:"2px 8px",borderRadius:"99px",background:"#f0fdf4",border:"1px solid #86efac",fontSize:"10px",color:"#166534",fontWeight:500},children:[Nn[x]||"\u{1F4C4}"," ",x]},x))}),n.features.length>0&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("p",{style:{margin:"10px 0 6px",fontSize:"10px",fontWeight:600,color:"#94a3b8",textTransform:"uppercase"},children:"Detected features"}),(0,m.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px"},children:n.features.map(x=>(0,m.jsx)("span",{style:{padding:"2px 8px",borderRadius:"99px",background:"#f5f3ff",border:"1px solid #c4b5fd",fontSize:"10px",color:"#7c3aed",fontWeight:500},children:x},x))})]})]}),(0,m.jsxs)("div",{style:{margin:"0 0 12px",padding:"10px 12px",background:"#f0fdf4",borderRadius:"8px",border:"1px solid #86efac"},children:[(0,m.jsx)("p",{style:{margin:"0 0 4px",fontSize:"10px",fontWeight:700,color:"#166534"},children:"\u{1F4E6} What you get:"}),(0,m.jsxs)("p",{style:{margin:0,fontSize:"10px",color:"#166534",lineHeight:1.6},children:["\u2705 Complete Next.js 16 project",(0,m.jsx)("br",{}),"\u2705 Tailwind CSS + CSS Modules",(0,m.jsx)("br",{}),"\u2705 TypeScript configured",(0,m.jsx)("br",{}),"\u2705 Navbar + Footer components",(0,m.jsx)("br",{}),"\u2705 All ",n.pages.length," pages ready",(0,m.jsx)("br",{}),"\u2705 Mobile responsive",(0,m.jsx)("br",{}),"\u2705 npm run dev \u2192 works immediately"]})]}),(0,m.jsxs)("div",{style:{display:"flex",gap:"8px"},children:[(0,m.jsx)("button",{onClick:G,style:{flex:1,padding:"9px",borderRadius:"8px",border:"1px solid #e2e8f0",background:"#fff",color:"#64748b",fontSize:"12px",fontWeight:600,cursor:"pointer"},children:"\u2190 Edit"}),(0,m.jsx)("button",{onClick:N,style:{flex:2,padding:"9px",borderRadius:"8px",border:"none",background:"#f59e0b",color:"#fff",fontSize:"13px",fontWeight:700,cursor:"pointer"},children:"\u2B07\uFE0F Generate & Download ZIP"})]})]}),o==="generating"&&(0,m.jsxs)("div",{style:{padding:"2rem 16px",textAlign:"center"},children:[(0,m.jsx)("p",{style:{fontSize:"2rem",marginBottom:"1rem"},children:"\u26A1"}),(0,m.jsx)("p",{style:{fontSize:"13px",fontWeight:700,color:"#0f172a",marginBottom:"0.5rem"},children:"Generating your project..."}),(0,m.jsx)("p",{style:{fontSize:"11px",color:"#64748b",marginBottom:"1.5rem"},children:c<30?"Parsing requirement...":c<55?"Loading templates...":c<70?"Generating pages...":c<85?"Building components...":c<95?"Creating styles...":"Packaging ZIP..."}),(0,m.jsx)("div",{style:{height:"8px",background:"#e2e8f0",borderRadius:"99px",overflow:"hidden"},children:(0,m.jsx)("div",{style:{height:"100%",width:`${c}%`,background:"#f59e0b",borderRadius:"99px",transition:"width 0.3s ease"}})}),(0,m.jsxs)("p",{style:{marginTop:"0.5rem",fontSize:"10px",color:"#94a3b8"},children:[c,"%"]})]}),o==="done"&&n&&(0,m.jsxs)("div",{style:{padding:"2rem 16px",textAlign:"center"},children:[(0,m.jsx)("p",{style:{fontSize:"3rem",marginBottom:"0.75rem"},children:"\u2705"}),(0,m.jsxs)("p",{style:{fontSize:"14px",fontWeight:700,color:"#0f172a",marginBottom:"0.5rem"},children:[n.siteName," downloaded!"]}),(0,m.jsx)("p",{style:{fontSize:"11px",color:"#64748b",marginBottom:"1.5rem",lineHeight:1.6},children:"Your ZIP is downloading. Unzip it and run:"}),["npm install","npm run dev"].map(x=>(0,m.jsx)("div",{style:{background:"#0f172a",borderRadius:"8px",padding:"8px 12px",marginBottom:"6px",textAlign:"left"},children:(0,m.jsxs)("code",{style:{fontSize:"12px",color:"#a7f3d0",fontFamily:"monospace"},children:["$ ",x]})},x)),(0,m.jsx)("p",{style:{fontSize:"11px",color:"#10b981",margin:"1rem 0",fontWeight:600},children:"Then open http://localhost:3000 \u{1F680}"}),(0,m.jsxs)("div",{style:{display:"flex",gap:"8px"},children:[(0,m.jsx)("button",{onClick:G,style:{flex:1,padding:"9px",borderRadius:"8px",border:"1px solid #e2e8f0",background:"#fff",color:"#64748b",fontSize:"12px",fontWeight:600,cursor:"pointer"},children:"New Project"}),(0,m.jsx)("button",{onClick:N,style:{flex:1,padding:"9px",borderRadius:"8px",border:"none",background:"#f59e0b",color:"#fff",fontSize:"12px",fontWeight:700,cursor:"pointer"},children:"\u2B07\uFE0F Download Again"})]})]})]})}var f=require("react/jsx-runtime");async function Wn(){try{if(typeof window>"u")return!1;let e=window;if(e.LanguageModel)try{if(typeof e.LanguageModel.availability=="function"){let o=await e.LanguageModel.availability();if(o==="readily"||o==="available"||o==="downloadable")return!0}else return!0}catch{}if(e.Summarizer)try{let o=await e.Summarizer.availability?.();if(!o||o==="readily"||o==="available")return!0}catch{}if(e.Rewriter)try{let o=await e.Rewriter.availability?.();if(!o||o==="readily"||o==="available")return!0}catch{}if(e.Writer)try{let o=await e.Writer.availability?.();if(!o||o==="readily"||o==="available")return!0}catch{}let t=e.ai||globalThis.ai;if(t){if(t.languageModel?.availability)try{let o=await t.languageModel.availability();if(o==="readily"||o==="available")return!0}catch{}if(t.languageModel&&typeof t.languageModel.create=="function"||t.summarizer||t.rewriter||t.writer||t.languageModel)return!0}return!!(e.Translator||e.translation?.canTranslate)}catch{return!1}}function Me({position:e="left",children:t,config:o={},showRag:a=!1,showAgent:r=!1}){let[i,n]=(0,y.useState)(!1),[s,c]=(0,y.useState)(Ye),[p,h]=(0,y.useState)(null),[b,$]=(0,y.useState)(!1),[N,G]=(0,y.useState)(!1),[A,x]=(0,y.useState)(!1),z=y.default.useRef(null),[R,C]=(0,y.useState)(!1),[I,v]=(0,y.useState)(""),[ne,q]=(0,y.useState)(""),[H,ae]=(0,y.useState)(!1),[T,fe]=(0,y.useState)(null),[re,d]=(0,y.useState)("idle"),[_,j]=(0,y.useState)(!1),[B,ie]=(0,y.useState)(""),[wo,ge]=(0,y.useState)(""),[V,Je]=(0,y.useState)(!1),[Qe,Re]=(0,y.useState)([]),[F,et]=(0,y.useState)(null),ko=24,tt=84,ot=a?144:84,Gn=204,[be,Pe]=(0,y.useState)(!1);(0,y.useEffect)(()=>{if(typeof window>"u")return;let u=window;!!(u.LanguageModel||u.ai?.languageModel)&&N?(fe("gemini"),et("gemini")):le()&&(fe("transformers"),et("transformers"))},[N]),(0,y.useEffect)(()=>{if(T!=="transformers")return;let u=setInterval(()=>d(ce()),500);return()=>clearInterval(u)},[T]);let nt=(0,y.useCallback)(async()=>{if(!(!I.trim()||H)){if(!T){q("\u26A0\uFE0F No AI engine available.");return}ae(!0),q("");try{let u;if(T==="gemini"){let{askPage:k}=await Promise.resolve().then(()=>(De(),zt));u=await k(I)}else{d("loading");let{askPageWithTransformers:k}=await Promise.resolve().then(()=>(de(),Ue));u=await k(I),d("ready")}q(u.success&&u.answer?u.answer.replace(/\*\*(.*?)\*\*/g,"$1").replace(/\*(.*?)\*/g,"$1").replace(/#+\s/g,"").trim():"\u26A0\uFE0F "+(u.error||"No answer found."))}catch{q("\u26A0\uFE0F Something went wrong.")}ae(!1)}},[I,H,T]),at=(0,y.useCallback)(async()=>{if(!B.trim()||V)return;if(!F){ge("\u26A0\uFE0F No AI engine available.");return}Je(!0),Re([]),ge("");let{runAgent:u}=await Promise.resolve().then(()=>(xo(),ho));await u(B,F,k=>{Re(U=>[...U,k.text])}),Je(!1),ge("done")},[B,V,F]);(0,y.useEffect)(()=>{if(typeof window>"u")return;let k=setTimeout(async()=>{let U=window,Co=await Wn();G(Co),x(!!(U.SpeechRecognition||U.webkitSpeechRecognition))},800);return()=>clearTimeout(k)},[]),(0,y.useEffect)(()=>{if(!(typeof window>"u"))try{let u=localStorage.getItem("yuktai-a11y-prefs");u&&c(k=>({...k,...JSON.parse(u)}))}catch{}},[]);let rt=(0,y.useCallback)(async u=>{let k={enabled:!0,highContrast:u.highContrast,darkMode:u.darkMode,reduceMotion:u.reduceMotion,largeTargets:u.largeTargets,speechEnabled:u.speechEnabled,autoFix:u.autoFix,dyslexiaFont:u.dyslexiaFont,localFont:u.localFont,fontSizeMultiplier:u.fontScale/100,colorBlindMode:u.colorBlindMode,showAuditBadge:u.showAuditBadge,showSkipLinks:!0,showPreferencePanel:!1,plainEnglish:u.plainEnglish,summarisePage:u.summarisePage,translateLanguage:u.translateLanguage,voiceControl:u.voiceControl,smartLabels:u.smartLabels,...o};await P.execute(k),h(P.applyFixes(k)),$(!0)},[o]),So=(0,y.useCallback)(async()=>{try{localStorage.setItem("yuktai-a11y-prefs",JSON.stringify(s))}catch{}await rt(s),n(!1)},[s,rt]),Ao=(0,y.useCallback)(()=>{c(Ye);try{localStorage.removeItem("yuktai-a11y-prefs")}catch{}let u=document.documentElement;["data-yuktai-high-contrast","data-yuktai-dark","data-yuktai-reduce-motion","data-yuktai-large-targets","data-yuktai-keyboard","data-yuktai-dyslexia"].forEach(k=>u.removeAttribute(k)),document.body.style.filter="",document.body.style.fontFamily="",document.documentElement.style.fontSize="",h(null),$(!1)},[]),To=(0,y.useCallback)((u,k)=>{c(U=>({...U,[u]:k}))},[]);(0,y.useEffect)(()=>{let u=k=>{k.key==="Escape"&&(i&&n(!1),R&&C(!1),_&&j(!1),be&&Pe(!1))};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[i,R,_]),(0,y.useEffect)(()=>{i&&z.current&&P.trapFocus(z.current)},[i]);let ye=(u,k,U)=>({position:"fixed",bottom:`${u}px`,[e]:"24px",zIndex:9998,width:"52px",height:"52px",borderRadius:"50%",background:k,color:"#fff",border:"none",cursor:"pointer",fontSize:"22px",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 4px 16px rgba(0,0,0,0.25)",transition:"transform 0.15s, background 0.2s"}),he=u=>{u.currentTarget.style.transform="scale(1.08)"},xe=u=>{u.currentTarget.style.transform="scale(1)"},it=T==="gemini"?"Gemini Nano \xB7 On device":T==="transformers"?"Transformers.js \xB7 All devices":"Detecting...",Eo=T==="transformers"&&re==="loading"?"Loading model...":"...";return(0,f.jsxs)(f.Fragment,{children:[t,r&&(0,f.jsx)("button",{style:ye(204,be?"#d97706":"#f59e0b",be),"aria-label":"Open Vibe Coder",title:"\u26A1 Vibe Coder \u2014 Generate Next.js project",onClick:()=>{Pe(u=>!u),j(!1),C(!1),n(!1)},onMouseEnter:he,onMouseLeave:xe,children:"\u26A1"}),r&&be&&(0,f.jsx)(Ze,{position:e,onClose:()=>Pe(!1)}),r&&(0,f.jsx)("button",{style:ye(ot,_?"#059669":"#10b981",_),"aria-label":"Open AI agent","aria-haspopup":"dialog","aria-expanded":_,title:"\u{1F916} AI Agent \u2014 guide me through this page",onClick:()=>{j(u=>!u),C(!1),n(!1)},onMouseEnter:he,onMouseLeave:xe,children:"\u{1F916}"}),r&&_&&(0,f.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":"yuktai AI Agent","data-yuktai-panel":"true",style:{position:"fixed",bottom:`${ot+64}px`,[e]:"24px",zIndex:9999,width:"300px",maxWidth:"calc(100vw - 48px)",background:"#fff",border:"1px solid #e2e8f0",borderRadius:"16px",boxShadow:"0 8px 32px rgba(0,0,0,0.12)",fontFamily:"system-ui,-apple-system,sans-serif",padding:"14px",maxHeight:"70vh",overflowY:"auto"},children:[(0,f.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"10px"},children:[(0,f.jsxs)("div",{children:[(0,f.jsx)("p",{style:{margin:"0 0 2px",fontSize:"13px",fontWeight:600,color:"#0f172a"},children:"\u{1F916} AI Agent"}),(0,f.jsx)("p",{style:{margin:0,fontSize:"10px",color:"#10b981"},children:F==="gemini"?"Gemini Nano \xB7 On device":F==="transformers"?"Transformers.js \xB7 All devices":"Detecting..."})]}),(0,f.jsx)("button",{onClick:()=>j(!1),"aria-label":"Close agent panel",style:{background:"none",border:"none",cursor:"pointer",color:"#94a3b8",fontSize:"18px",lineHeight:1,padding:"2px"},children:"\xD7"})]}),(0,f.jsx)("p",{style:{margin:"0 0 8px",fontSize:"11px",color:"#64748b"},children:"Tell me what you want to do on this page. I will guide you step by step."}),(0,f.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px",marginBottom:"8px"},children:["Fill this form","Find contact info","What is this page?","Guide me to apply"].map(u=>(0,f.jsx)("button",{onClick:()=>ie(u),style:{padding:"3px 8px",borderRadius:"20px",fontSize:"10px",border:"1px solid #e2e8f0",background:"#f8fafc",color:"#64748b",cursor:"pointer"},children:u},u))}),(0,f.jsxs)("div",{style:{display:"flex",gap:"6px",marginBottom:"8px"},children:[(0,f.jsx)("input",{type:"text",value:B,onChange:u=>ie(u.target.value),onKeyDown:u=>{u.key==="Enter"&&at()},placeholder:"e.g. Help me fill this form",disabled:V||!F,"aria-label":"Tell the agent what to do",style:{flex:1,padding:"8px 10px",borderRadius:"8px",border:"1px solid #e2e8f0",fontSize:"12px",color:"#0f172a",background:F?"#fff":"#f8fafc",outline:"none",height:"36px"}}),(0,f.jsx)("button",{onClick:at,disabled:V||!B.trim()||!F,"aria-label":"Run agent",style:{padding:"8px 12px",borderRadius:"8px",border:"none",background:F&&B.trim()&&!V?"#10b981":"#e2e8f0",color:F&&B.trim()&&!V?"#fff":"#94a3b8",fontSize:"12px",fontWeight:600,cursor:F&&B.trim()&&!V?"pointer":"not-allowed",height:"36px",minWidth:"52px",transition:"background 0.2s"},children:V?"...":"Go"})]}),Qe.length>0&&(0,f.jsxs)("div",{style:{padding:"10px 12px",background:"#f0fdf4",border:"1px solid #86efac",borderRadius:"8px",fontSize:"11px",color:"#166534",lineHeight:1.7},children:[Qe.map((u,k)=>(0,f.jsx)("p",{style:{margin:"0 0 2px"},children:u},k)),wo==="done"&&(0,f.jsx)("button",{onClick:()=>{Re([]),ie(""),ge("")},style:{display:"block",marginTop:"6px",background:"none",border:"none",color:"#94a3b8",fontSize:"10px",cursor:"pointer",padding:0},children:"Clear"})]}),!F&&(0,f.jsx)("p",{style:{margin:"4px 0 0",fontSize:"10px",color:"#94a3b8"},children:"Enable Gemini Nano via chrome://flags for best results."})]}),a&&(0,f.jsx)("button",{style:ye(tt,R?"#7c3aed":"#6d28d9",R),"aria-label":"Ask a question about this page","aria-haspopup":"dialog","aria-expanded":R,title:`\u{1F4AC} Ask this page \xB7 ${it}`,onClick:()=>{C(u=>!u),n(!1),j(!1)},onMouseEnter:he,onMouseLeave:xe,children:"\u{1F4AC}"}),a&&R&&(0,f.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":"Ask this page","data-yuktai-panel":"true",style:{position:"fixed",bottom:`${tt+64}px`,[e]:"24px",zIndex:9999,width:"300px",maxWidth:"calc(100vw - 48px)",background:"#fff",border:"1px solid #e2e8f0",borderRadius:"16px",boxShadow:"0 8px 32px rgba(0,0,0,0.12)",fontFamily:"system-ui,-apple-system,sans-serif",padding:"14px"},children:[(0,f.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"10px"},children:[(0,f.jsxs)("div",{children:[(0,f.jsx)("p",{style:{margin:"0 0 2px",fontSize:"13px",fontWeight:600,color:"#0f172a"},children:"\u{1F4AC} Ask this page"}),(0,f.jsx)("p",{style:{margin:0,fontSize:"10px",color:"#7c3aed"},children:it}),T==="transformers"&&re==="loading"&&(0,f.jsx)("p",{style:{margin:"2px 0 0",fontSize:"9px",color:"#94a3b8"},children:"Downloading model \u2014 first time only"}),T==="transformers"&&re==="ready"&&(0,f.jsx)("p",{style:{margin:"2px 0 0",fontSize:"9px",color:"#10b981"},children:"Model ready \u2705 \u2014 works offline"})]}),(0,f.jsx)("button",{onClick:()=>C(!1),"aria-label":"Close ask panel",style:{background:"none",border:"none",cursor:"pointer",color:"#94a3b8",fontSize:"18px",lineHeight:1,padding:"2px"},children:"\xD7"})]}),(0,f.jsxs)("div",{style:{display:"flex",gap:"6px",marginBottom:"8px"},children:[(0,f.jsx)("input",{type:"text",value:I,onChange:u=>v(u.target.value),onKeyDown:u=>{u.key==="Enter"&&nt()},placeholder:"e.g. What does this page do?",disabled:H||!T,"aria-label":"Ask a question about this page",style:{flex:1,padding:"8px 10px",borderRadius:"8px",border:"1px solid #e2e8f0",fontSize:"12px",color:"#0f172a",background:T?"#fff":"#f8fafc",outline:"none",height:"36px"}}),(0,f.jsx)("button",{onClick:nt,disabled:H||!I.trim()||!T,"aria-label":"Submit question",style:{padding:"8px 12px",borderRadius:"8px",border:"none",background:T&&I.trim()&&!H?"#7c3aed":"#e2e8f0",color:T&&I.trim()&&!H?"#fff":"#94a3b8",fontSize:"12px",fontWeight:600,cursor:T&&I.trim()&&!H?"pointer":"not-allowed",height:"36px",minWidth:"48px",transition:"background 0.2s"},children:H?Eo:"Ask"})]}),ne&&(0,f.jsxs)("div",{style:{padding:"10px",background:"#f5f3ff",borderRadius:"8px",fontSize:"12px",color:"#4c1d95",lineHeight:1.6,maxHeight:"180px",overflowY:"auto"},children:[(0,f.jsx)("strong",{style:{display:"block",marginBottom:"4px",fontSize:"11px",color:"#7c3aed"},children:"\u{1F4AC} Answer"}),ne,(0,f.jsx)("button",{onClick:()=>{q(""),v("")},style:{display:"block",marginTop:"6px",background:"none",border:"none",color:"#94a3b8",fontSize:"10px",cursor:"pointer",padding:0},children:"Clear"})]}),!T&&(0,f.jsx)("p",{style:{margin:"4px 0 0",fontSize:"10px",color:"#94a3b8"},children:"Detecting AI engine..."})]}),(0,f.jsx)("button",{style:ye(ko,b?"#0d9488":"#1a73e8",i),"aria-label":"Open accessibility preferences","aria-haspopup":"dialog","aria-expanded":i,"data-yuktai-pref-toggle":"true",title:"\u267F Accessibility settings",onClick:()=>{n(u=>!u),C(!1),j(!1)},onMouseEnter:he,onMouseLeave:xe,children:"\u267F"}),i&&(0,f.jsx)(Ke,{ref:z,position:e,settings:s,report:p,isActive:b,aiSupported:N,voiceSupported:A,set:To,onApply:So,onReset:Ao,onClose:()=>n(!1)})]})}g();var ue={name:"ai.text",async execute(e){return`\u{1F916} YuktAI says: ${e}`}};g();var me={name:"voice.text",async execute(e){return!e||e.trim()===""?"\u{1F3A4} No speech detected":`\u{1F3A4} You said: ${e}`}};g();var K=class{plugins=new Map;register(t,o){if(!o||typeof o.execute!="function")throw new Error(`Invalid plugin: ${t}`);this.plugins.set(t,o)}use(t){return this.plugins.get(t)}async run(t,o){try{let a=this.use(t);if(!a)throw new Error(`Plugin not found: ${t}`);return await a.execute(o)}catch(a){throw console.error(`[YuktAI Runtime Error in ${t}]:`,a),a}}getPlugins(){return Array.from(this.plugins.keys())}};function $n(){if(typeof globalThis>"u")return new K;if(!globalThis.__yuktai_runtime__){let e=new K;e.register(P.name,P),e.register(ue.name,ue),e.register(me.name,me),globalThis.__yuktai_runtime__=e}return globalThis.__yuktai_runtime__}var vo=typeof window<"u"?$n():new K,_n={wcagPlugin:P,list(){return vo.getPlugins()},use(e){return vo.use(e)},fix(e){return P.applyFixes({enabled:!0,autoFix:!0,...e})},scan(){return P.scan()}};
|