@yuktishaalaa/yuktai 4.4.1 → 4.6.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 CHANGED
@@ -1,15 +1,15 @@
1
- "use strict";var Zo=Object.create;var De=Object.defineProperty;var Jo=Object.getOwnPropertyDescriptor;var Qo=Object.getOwnPropertyNames;var en=Object.getPrototypeOf,tn=Object.prototype.hasOwnProperty;var fe=(e,t)=>()=>(e&&(t=e(e=0)),t);var ke=(e,t)=>{for(var o in t)De(e,o,{get:t[o],enumerable:!0})},Mt=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Qo(t))!tn.call(e,i)&&i!==o&&De(e,i,{get:()=>t[i],enumerable:!(r=Jo(t,i))||r.enumerable});return e};var qe=(e,t,o)=>(o=e!=null?Zo(en(e)):{},Mt(t||!e||!e.__esModule?De(o,"default",{value:e,enumerable:!0}):o,e)),on=e=>Mt(De({},"__esModule",{value:!0}),e);var m=fe(()=>{});var oo={};ke(oo,{askPage:()=>mt});function Cn(){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 Fn(){let e=[],t=document.querySelectorAll("*");for(let o of t){if(o.closest("[data-yuktai-panel]"))continue;let r=o.innerText?.trim();r&&r.length>30&&e.push(r);let i=o.getAttribute("aria-label");if(i&&i.length>10&&e.push(i),(o instanceof HTMLInputElement||o instanceof HTMLTextAreaElement)&&(o.placeholder&&e.push(o.placeholder),o.value&&e.push(o.value)),o instanceof HTMLButtonElement){let a=o.innerText||o.getAttribute("aria-label");a&&e.push(a)}}return e.join(" ").slice(0,3500)}async function mt(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 Cn();let r=Fn();if(!r||r.length<100)return{success:!1,answer:"",error:"Page content not readable."};let i;try{i=await o.create({systemPrompt:`Answer ONLY using page content.
1
+ "use strict";var un=Object.create;var Ie=Object.defineProperty;var pn=Object.getOwnPropertyDescriptor;var fn=Object.getOwnPropertyNames;var mn=Object.getPrototypeOf,gn=Object.prototype.hasOwnProperty;var ae=(e,t)=>()=>(e&&(t=e(e=0)),t);var me=(e,t)=>{for(var o in t)Ie(e,o,{get:t[o],enumerable:!0})},Gt=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of fn(t))!gn.call(e,i)&&i!==o&&Ie(e,i,{get:()=>t[i],enumerable:!(r=pn(t,i))||r.enumerable});return e};var Xe=(e,t,o)=>(o=e!=null?un(mn(e)):{},Gt(t||!e||!e.__esModule?Ie(o,"default",{value:e,enumerable:!0}):o,e)),bn=e=>Gt(Ie({},"__esModule",{value:!0}),e);var m=ae(()=>{});var co={};me(co,{askPage:()=>st});function Wn(){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 Bn(){let e=[],t=document.querySelectorAll("*");for(let o of t){if(o.closest("[data-yuktai-panel]"))continue;let r=o.innerText?.trim();r&&r.length>30&&e.push(r);let i=o.getAttribute("aria-label");if(i&&i.length>10&&e.push(i),(o instanceof HTMLInputElement||o instanceof HTMLTextAreaElement)&&(o.placeholder&&e.push(o.placeholder),o.value&&e.push(o.value)),o instanceof HTMLButtonElement){let s=o.innerText||o.getAttribute("aria-label");s&&e.push(s)}}return e.join(" ").slice(0,3500)}async function st(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 Wn();let r=Bn();if(!r||r.length<100)return{success:!1,answer:"",error:"Page content not readable."};let i;try{i=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{i=await o.create()}let a=`Page:
3
+ If not found say: "I could not find that on this page."`,outputLanguage:"en"})}catch{i=await o.create()}let s=`Page:
4
4
  ${r}
5
5
 
6
- Q: ${e}`,n=await i.prompt(a);return i?.destroy&&i.destroy(),{success:!0,answer:n?.trim()||"No answer found."}}catch(t){return{success:!1,answer:"",error:t instanceof Error?t.message:"Error occurred"}}}var ft=fe(()=>{"use strict";m()});var yt={};ke(yt,{askPageWithTransformers:()=>bt,getModelLoadStatus:()=>Ae,isTransformersSupported:()=>Se});function ao(){return typeof navigator>"u"?!1:/Android|iPhone|iPad|iPod|Mobile|Tablet/i.test(navigator.userAgent)}function Ln(){if(ao())return"wasm";try{if(typeof navigator<"u"&&"gpu"in navigator&&navigator.gpu!==void 0)return"webgpu"}catch{}return"wasm"}async function Mn(){if(!gt){if(he){for(;he;)await new Promise(e=>setTimeout(e,200));return}he=!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=Ln(),r=ao();console.log(`yuktai: Transformers.js \u2014 device: ${o}, mobile: ${r}`),ro=await e("feature-extraction","Xenova/all-MiniLM-L6-v2",{device:o,dtype:r?"q4":"fp32"}),io=await e("text2text-generation","Xenova/flan-t5-small",{device:o,dtype:r?"q4":"fp32"}),gt=!0,he=!1,console.log("yuktai: Transformers.js models loaded \u2705")}catch(e){throw he=!1,console.error("yuktai: Transformers.js model load failed",e),e}}}function Rn(){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 Pn(){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 r=document.title?.trim();r&&!t.has(r)&&e.unshift(r);let a=document.querySelector('meta[name="description"]')?.getAttribute("content")?.trim();return a&&!t.has(a)&&e.unshift(a),e.join(" ").slice(0,8e3)}function In(e,t=150,o=30){if(typeof e!="string")try{e=String(e??"")}catch{return[]}let r=e.trim();if(!r)return[];let i=Math.min(o,Math.floor(t/2)),a=r.split(/\s+/),n=[],s=t-i;for(let c=0;c<a.length;c+=s){let p=a.slice(c,c+t).join(" ");p.trim().length>20&&n.push(p)}return n}function zn(e,t){let o=0,r=0,i=0;for(let a=0;a<e.length;a++)o+=e[a]*t[a],r+=e[a]*e[a],i+=t[a]*t[a];return o/(Math.sqrt(r)*Math.sqrt(i)+1e-8)}async function no(e){let t=await ro(e,{pooling:"mean",normalize:!0}),o=t?.data??t;return Array.from(o)}async function Nn(e,t,o=3){let r=await no(e),i=await Promise.all(t.map(async a=>{let n=await no(a),s=zn(r,n);return{chunk:a,score:s}}));return i.sort((a,n)=>n.score-a.score),i.slice(0,o).map(a=>a.chunk)}async function bt(e){if(!e.trim())return{success:!1,answer:"",error:"Please type a question."};try{await Mn(),await Rn();let t=Pn();if(!t||t.length<50)return{success:!1,answer:"",error:"Not enough content on this page."};let o=In(t);if(o.length===0)return{success:!1,answer:"",error:"Could not process page content."};let a=`Answer the question based on the context. Give a complete answer in 2-3 sentences.
6
+ Q: ${e}`,n=await i.prompt(s);return i?.destroy&&i.destroy(),{success:!0,answer:n?.trim()||"No answer found."}}catch(t){return{success:!1,answer:"",error:t instanceof Error?t.message:"Error occurred"}}}var lt=ae(()=>{"use strict";m()});var ut={};me(ut,{askPageWithTransformers:()=>dt,getModelLoadStatus:()=>be,isTransformersSupported:()=>ge});function mo(){return typeof navigator>"u"?!1:/Android|iPhone|iPad|iPod|Mobile|Tablet/i.test(navigator.userAgent)}function _n(){if(mo())return"wasm";try{if(typeof navigator<"u"&&"gpu"in navigator&&navigator.gpu!==void 0)return"webgpu"}catch{}return"wasm"}async function Dn(){if(!ct){if(de){for(;de;)await new Promise(e=>setTimeout(e,200));return}de=!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=_n(),r=mo();console.log(`yuktai: Transformers.js \u2014 device: ${o}, mobile: ${r}`),po=await e("feature-extraction","Xenova/all-MiniLM-L6-v2",{device:o,dtype:r?"q4":"fp32"}),fo=await e("text2text-generation","Xenova/flan-t5-small",{device:o,dtype:r?"q4":"fp32"}),ct=!0,de=!1,console.log("yuktai: Transformers.js models loaded \u2705")}catch(e){throw de=!1,console.error("yuktai: Transformers.js model load failed",e),e}}}function qn(){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 jn(){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 l=n.innerText?.trim();if(!l||l.length<15||t.has(l))continue;t.add(l),e.push(l);let c=n.getAttribute("aria-label")?.trim();c&&c.length>8&&!t.has(c)&&(t.add(c),e.push(c))}let r=document.title?.trim();r&&!t.has(r)&&e.unshift(r);let s=document.querySelector('meta[name="description"]')?.getAttribute("content")?.trim();return s&&!t.has(s)&&e.unshift(s),e.join(" ").slice(0,8e3)}function Yn(e,t=150,o=30){if(typeof e!="string")try{e=String(e??"")}catch{return[]}let r=e.trim();if(!r)return[];let i=Math.min(o,Math.floor(t/2)),s=r.split(/\s+/),n=[],a=t-i;for(let l=0;l<s.length;l+=a){let c=s.slice(l,l+t).join(" ");c.trim().length>20&&n.push(c)}return n}function Vn(e,t){let o=0,r=0,i=0;for(let s=0;s<e.length;s++)o+=e[s]*t[s],r+=e[s]*e[s],i+=t[s]*t[s];return o/(Math.sqrt(r)*Math.sqrt(i)+1e-8)}async function uo(e){let t=await po(e,{pooling:"mean",normalize:!0}),o=t?.data??t;return Array.from(o)}async function Un(e,t,o=3){let r=await uo(e),i=await Promise.all(t.map(async s=>{let n=await uo(s),a=Vn(r,n);return{chunk:s,score:a}}));return i.sort((s,n)=>n.score-s.score),i.slice(0,o).map(s=>s.chunk)}async function dt(e){if(!e.trim())return{success:!1,answer:"",error:"Please type a question."};try{await Dn(),await qn();let t=jn();if(!t||t.length<50)return{success:!1,answer:"",error:"Not enough content on this page."};let o=Yn(t);if(o.length===0)return{success:!1,answer:"",error:"Could not process page content."};let s=`Answer the question based on the context. Give a complete answer in 2-3 sentences.
7
7
 
8
- Context: ${(await Nn(e,o,3)).join(" ").slice(0,1200)}
8
+ Context: ${(await Un(e,o,3)).join(" ").slice(0,1200)}
9
9
 
10
10
  Question: ${e}
11
11
 
12
- Answer:`,s=(await io(a,{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 Se(){try{return typeof WebAssembly<"u"&&typeof Worker<"u"}catch{return!1}}function Ae(){return gt?"ready":he?"loading":"idle"}var ro,io,he,gt,Te=fe(()=>{"use strict";m();ro=null,io=null,he=!1,gt=!1});function lo(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 vt,co,po,uo,mo,fo,go,bo,yo,ho,xo,vo,wo,ko,So,Ao,To,Eo,Co,Fo,Lo,Mo,Ro,Po,Io,zo=fe(()=>{"use strict";m();vt={blue:"#1a73e8",green:"#0d9488",purple:"#7c3aed",red:"#dc2626",orange:"#ea580c",teal:"#0891b2",indigo:"#4f46e5",gray:"#374151"},co=e=>`{
12
+ Answer:`,a=(await fo(s,{max_new_tokens:120,min_new_tokens:10}))?.[0]?.generated_text?.trim()||"";return a?{success:!0,answer:a}:{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 ge(){try{return typeof WebAssembly<"u"&&typeof Worker<"u"}catch{return!1}}function be(){return ct?"ready":de?"loading":"idle"}var po,fo,de,ct,ye=ae(()=>{"use strict";m();po=null,fo=null,de=!1,ct=!1});function bo(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 mt,yo,ho,xo,wo,vo,ko,So,To,Ao,Co,Eo,Lo,Ro,Io,Mo,Po,No,zo,Fo,$o,Go,Ho,Oo,Wo,Bo=ae(()=>{"use strict";m();mt={blue:"#1a73e8",green:"#0d9488",purple:"#7c3aed",red:"#dc2626",orange:"#ea580c",teal:"#0891b2",indigo:"#4f46e5",gray:"#374151"},yo=e=>`{
13
13
  "name": "${e.toLowerCase().replace(/\s+/g,"-")}",
14
14
  "version": "0.1.0",
15
15
  "private": true,
@@ -34,14 +34,14 @@ Answer:`,s=(await io(a,{max_new_tokens:120,min_new_tokens:10}))?.[0]?.generated_
34
34
  "typescript": "^5.0.0"
35
35
  }
36
36
  }
37
- `,po=`/** @type {import('next').NextConfig} */
37
+ `,ho=`/** @type {import('next').NextConfig} */
38
38
  const nextConfig = {
39
39
  reactStrictMode: true,
40
40
  images: { unoptimized: true },
41
41
  }
42
42
 
43
43
  module.exports = nextConfig
44
- `,uo=e=>`/** @type {import('tailwindcss').Config} */
44
+ `,xo=e=>`/** @type {import('tailwindcss').Config} */
45
45
  module.exports = {
46
46
  content: [
47
47
  "./src/pages/**/*.{js,ts,jsx,tsx,mdx}",
@@ -57,7 +57,7 @@ module.exports = {
57
57
  },
58
58
  plugins: [],
59
59
  }
60
- `,mo=e=>`@tailwind base;
60
+ `,wo=e=>`@tailwind base;
61
61
  @tailwind components;
62
62
  @tailwind utilities;
63
63
 
@@ -86,7 +86,7 @@ a {
86
86
  color: inherit;
87
87
  text-decoration: none;
88
88
  }
89
- `,fo=`import type { Metadata } from "next"
89
+ `,vo=`import type { Metadata } from "next"
90
90
  import "./globals.css"
91
91
  import Navbar from "@/components/Navbar"
92
92
  import Footer from "@/components/Footer"
@@ -111,7 +111,7 @@ export default function RootLayout({
111
111
  </html>
112
112
  )
113
113
  }
114
- `,go=`"use client"
114
+ `,ko=`"use client"
115
115
  import Link from "next/link"
116
116
  import { useState } from "react"
117
117
  import styles from "./Navbar.module.css"
@@ -142,7 +142,7 @@ export default function Navbar() {
142
142
  </nav>
143
143
  )
144
144
  }
145
- `,bo=`.navbar {
145
+ `,So=`.navbar {
146
146
  background: var(--primary);
147
147
  color: white;
148
148
  padding: 0 1rem;
@@ -209,7 +209,7 @@ export default function Navbar() {
209
209
  }
210
210
  .links.open { display: flex; }
211
211
  }
212
- `,yo=`import styles from "./Footer.module.css"
212
+ `,To=`import styles from "./Footer.module.css"
213
213
 
214
214
  export default function Footer() {
215
215
  return (
@@ -222,7 +222,7 @@ export default function Footer() {
222
222
  </footer>
223
223
  )
224
224
  }
225
- `,ho=`.footer {
225
+ `,Ao=`.footer {
226
226
  background: #0f172a;
227
227
  color: #94a3b8;
228
228
  padding: 3rem 1rem;
@@ -254,7 +254,7 @@ export default function Footer() {
254
254
  color: #475569;
255
255
  margin-top: 1rem;
256
256
  }
257
- `,xo=`import styles from "./page.module.css"
257
+ `,Co=`import styles from "./page.module.css"
258
258
  import Link from "next/link"
259
259
 
260
260
  export default function HomePage() {
@@ -305,7 +305,7 @@ export default function HomePage() {
305
305
  </div>
306
306
  )
307
307
  }
308
- `,vo=`.page { min-height: 100vh; }
308
+ `,Eo=`.page { min-height: 100vh; }
309
309
 
310
310
  .hero {
311
311
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
@@ -398,7 +398,7 @@ export default function HomePage() {
398
398
 
399
399
  .cta h2 { font-size: 2rem; font-weight: 800; margin-bottom: 0.75rem; }
400
400
  .cta p { font-size: 1.1rem; opacity: 0.85; margin-bottom: 2rem; }
401
- `,wo=`import styles from "./page.module.css"
401
+ `,Lo=`import styles from "./page.module.css"
402
402
 
403
403
  export default function AboutPage() {
404
404
  return (
@@ -444,7 +444,7 @@ export default function AboutPage() {
444
444
  </div>
445
445
  )
446
446
  }
447
- `,ko=`.page { min-height: 100vh; }
447
+ `,Ro=`.page { min-height: 100vh; }
448
448
 
449
449
  .hero {
450
450
  background: var(--primary);
@@ -492,7 +492,7 @@ export default function AboutPage() {
492
492
  }
493
493
 
494
494
  .label { font-size: 0.85rem; color: #64748b; }
495
- `,So=`"use client"
495
+ `,Io=`"use client"
496
496
  import { useState } from "react"
497
497
  import styles from "./page.module.css"
498
498
 
@@ -582,7 +582,7 @@ export default function ContactPage() {
582
582
  </div>
583
583
  )
584
584
  }
585
- `,Ao=`.page { min-height: 100vh; }
585
+ `,Mo=`.page { min-height: 100vh; }
586
586
 
587
587
  .hero {
588
588
  background: var(--primary);
@@ -660,7 +660,7 @@ export default function ContactPage() {
660
660
  font-size: 1.1rem;
661
661
  text-align: center;
662
662
  }
663
- `,To=`import styles from "./page.module.css"
663
+ `,Po=`import styles from "./page.module.css"
664
664
 
665
665
  const SERVICES = [
666
666
  { icon: "\u{1F680}", title: "Service One", desc: "Comprehensive solution designed to meet your business needs efficiently and effectively." },
@@ -694,7 +694,7 @@ export default function ServicesPage() {
694
694
  </div>
695
695
  )
696
696
  }
697
- `,Eo=`.page { min-height: 100vh; }
697
+ `,No=`.page { min-height: 100vh; }
698
698
 
699
699
  .hero {
700
700
  background: var(--primary);
@@ -738,7 +738,7 @@ export default function ServicesPage() {
738
738
  }
739
739
 
740
740
  .card p { color: #64748b; font-size: 0.9rem; line-height: 1.6; }
741
- `,Co=`import styles from "./page.module.css"
741
+ `,zo=`import styles from "./page.module.css"
742
742
  import Link from "next/link"
743
743
 
744
744
  const PLANS = [
@@ -875,7 +875,7 @@ export default function PricingPage() {
875
875
  }
876
876
 
877
877
  .btn:hover { opacity: 0.9; }
878
- `,Lo=`"use client"
878
+ `,$o=`"use client"
879
879
  import { useState } from "react"
880
880
  import styles from "./page.module.css"
881
881
 
@@ -941,7 +941,7 @@ export default function AuthPage() {
941
941
  </div>
942
942
  )
943
943
  }
944
- `,Mo=`.page {
944
+ `,Go=`.page {
945
945
  min-height: 100vh;
946
946
  display: flex;
947
947
  align-items: center;
@@ -1023,7 +1023,7 @@ export default function AuthPage() {
1023
1023
  }
1024
1024
 
1025
1025
  .btn:hover { opacity: 0.9; }
1026
- `,Ro=`import Link from "next/link"
1026
+ `,Ho=`import Link from "next/link"
1027
1027
 
1028
1028
  export default function NotFound() {
1029
1029
  return (
@@ -1039,7 +1039,7 @@ export default function NotFound() {
1039
1039
  </div>
1040
1040
  )
1041
1041
  }
1042
- `,Po=`{
1042
+ `,Oo=`{
1043
1043
  "compilerOptions": {
1044
1044
  "target": "es5",
1045
1045
  "lib": ["dom", "dom.iterable", "esnext"],
@@ -1060,7 +1060,7 @@ export default function NotFound() {
1060
1060
  "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
1061
1061
  "exclude": ["node_modules"]
1062
1062
  }
1063
- `,Io=e=>`# ${e}
1063
+ `,Wo=e=>`# ${e}
1064
1064
 
1065
1065
  Generated by **yuktai Vibe Coder** \u2014 open source AI plugin for Next.js.
1066
1066
 
@@ -1088,12 +1088,12 @@ Edit any page to customise content.
1088
1088
  ---
1089
1089
 
1090
1090
  *Built with yuktai \u2014 aksharatantra.vercel.app*
1091
- `});var No={};ke(No,{generateZip:()=>Jn});function Zn(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 Jn(e){let t=(await import("jszip")).default,o=new t,r=vt[e.theme]||vt.blue,i=Zn(e.siteName,e.websiteType),a=new Date().getFullYear().toString(),n={SITE_NAME:e.siteName,THEME_COLOR:r,TAGLINE:i,YEAR:a},s=y=>lo(y,n).replace(/\{\{SITE_NAME_LOWER\}\}/g,e.siteName.toLowerCase().replace(/\s+/g,""));o.file("package.json",co(e.siteName)),o.file("next.config.js",po),o.file("tailwind.config.js",uo(r)),o.file("tsconfig.json",Po),o.file("README.md",Io(e.siteName)),o.file("postcss.config.js","module.exports = { plugins: { tailwindcss: {}, autoprefixer: {} } }"),o.file(".gitignore",`node_modules
1091
+ `});var _o={};me(_o,{generateZip:()=>ur});function dr(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 ur(e){let t=(await import("jszip")).default,o=new t,r=mt[e.theme]||mt.blue,i=dr(e.siteName,e.websiteType),s=new Date().getFullYear().toString(),n={SITE_NAME:e.siteName,THEME_COLOR:r,TAGLINE:i,YEAR:s},a=u=>bo(u,n).replace(/\{\{SITE_NAME_LOWER\}\}/g,e.siteName.toLowerCase().replace(/\s+/g,""));o.file("package.json",yo(e.siteName)),o.file("next.config.js",ho),o.file("tailwind.config.js",xo(r)),o.file("tsconfig.json",Oo),o.file("README.md",Wo(e.siteName)),o.file("postcss.config.js","module.exports = { plugins: { tailwindcss: {}, autoprefixer: {} } }"),o.file(".gitignore",`node_modules
1092
1092
  .next
1093
1093
  .env.local
1094
- .DS_Store`),o.file("src/app/globals.css",mo(r)),o.file("src/app/layout.tsx",s(fo)),o.file("src/app/not-found.tsx",Ro),o.file("src/components/Navbar.tsx",s(go)),o.file("src/components/Navbar.module.css",bo),o.file("src/components/Footer.tsx",s(yo)),o.file("src/components/Footer.module.css",ho);for(let y of e.pages)switch(y){case"home":o.file("src/app/page.tsx",s(xo)),o.file("src/app/page.module.css",vo);break;case"about":o.file("src/app/about/page.tsx",s(wo)),o.file("src/app/about/page.module.css",ko);break;case"contact":o.file("src/app/contact/page.tsx",s(So)),o.file("src/app/contact/page.module.css",Ao);break;case"services":o.file("src/app/services/page.tsx",s(To)),o.file("src/app/services/page.module.css",Eo);break;case"pricing":o.file("src/app/pricing/page.tsx",s(Co)),o.file("src/app/pricing/page.module.css",Fo);break;case"auth":o.file("src/app/auth/page.tsx",s(Lo)),o.file("src/app/auth/page.module.css",Mo);break;default:o.file(`src/app/${y}/page.tsx`,Qn(y,e.siteName,r,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 Qn(e,t,o,r,i){let a=e.charAt(0).toUpperCase()+e.slice(1);return`import styles from "./page.module.css"
1094
+ .DS_Store`),o.file("src/app/globals.css",wo(r)),o.file("src/app/layout.tsx",a(vo)),o.file("src/app/not-found.tsx",Ho),o.file("src/components/Navbar.tsx",a(ko)),o.file("src/components/Navbar.module.css",So),o.file("src/components/Footer.tsx",a(To)),o.file("src/components/Footer.module.css",Ao);for(let u of e.pages)switch(u){case"home":o.file("src/app/page.tsx",a(Co)),o.file("src/app/page.module.css",Eo);break;case"about":o.file("src/app/about/page.tsx",a(Lo)),o.file("src/app/about/page.module.css",Ro);break;case"contact":o.file("src/app/contact/page.tsx",a(Io)),o.file("src/app/contact/page.module.css",Mo);break;case"services":o.file("src/app/services/page.tsx",a(Po)),o.file("src/app/services/page.module.css",No);break;case"pricing":o.file("src/app/pricing/page.tsx",a(zo)),o.file("src/app/pricing/page.module.css",Fo);break;case"auth":o.file("src/app/auth/page.tsx",a($o)),o.file("src/app/auth/page.module.css",Go);break;default:o.file(`src/app/${u}/page.tsx`,pr(u,e.siteName,r,n,a));break}let l=await o.generateAsync({type:"blob"}),c=URL.createObjectURL(l),p=document.createElement("a");p.href=c,p.download=`${e.siteName.toLowerCase().replace(/\s+/g,"-")}-nextjs.zip`,document.body.appendChild(p),p.click(),document.body.removeChild(p),URL.revokeObjectURL(c)}function pr(e,t,o,r,i){let s=e.charAt(0).toUpperCase()+e.slice(1);return`import styles from "./page.module.css"
1095
1095
 
1096
- export default function ${a}Page() {
1096
+ export default function ${s}Page() {
1097
1097
  return (
1098
1098
  <div style={{ minHeight: "100vh" }}>
1099
1099
  <section style={{
@@ -1103,38 +1103,38 @@ export default function ${a}Page() {
1103
1103
  textAlign: "center"
1104
1104
  }}>
1105
1105
  <h1 style={{ fontSize: "2.5rem", fontWeight: 800, marginBottom: "1rem" }}>
1106
- ${a}
1106
+ ${s}
1107
1107
  </h1>
1108
1108
  <p style={{ fontSize: "1.1rem", opacity: 0.85 }}>
1109
- ${t} \u2014 ${a} page
1109
+ ${t} \u2014 ${s} page
1110
1110
  </p>
1111
1111
  </section>
1112
1112
  <section style={{ padding: "4rem 1rem", maxWidth: "1100px", margin: "0 auto" }}>
1113
1113
  <p style={{ color: "#64748b", fontSize: "1rem", textAlign: "center" }}>
1114
- This is the ${a} page. Edit this file to add your content.
1114
+ This is the ${s} page. Edit this file to add your content.
1115
1115
  </p>
1116
1116
  </section>
1117
1117
  </div>
1118
1118
  )
1119
1119
  }
1120
- `}var Ho=fe(()=>{"use strict";m();zo()});var _o={};ke(_o,{getPageText:()=>Bo,highlightField:()=>Oo,runAgent:()=>ar,scanFormFields:()=>Wo,scrollToSection:()=>$o});function ce(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 Bo(){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 r=['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 r){let s=document.querySelector(n)?.getAttribute("content");s&&o(s)}let i=["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']"],a=document.querySelectorAll(i.join(","));for(let n of a){if(n.closest("[data-yuktai-panel]")||!ce(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 R=n.textContent?.trim();R&&R.length>10&&o(R)}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 y=n.getAttribute("aria-valuetext")?.trim();y&&o(y);let j=n.getAttribute("title")?.trim();j&&j.length>5&&o(j);let $=n.getAttribute("data-label")?.trim();$&&o($);let V=n.getAttribute("data-title")?.trim();V&&o(V),n.querySelectorAll("img").forEach(R=>{let w=R.getAttribute("alt")?.trim();w&&w.length>5&&o(w);let N=R.getAttribute("title")?.trim();N&&N.length>5&&o(N)})}document.querySelectorAll("img").forEach(n=>{if(n.closest("[data-yuktai-panel]")||!ce(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]")||!ce(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]")||ce(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]")||!ce(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]")||!ce(n))return;let s=n.innerText?.trim();s&&s.length>3&&s.length<100&&o(s)}),e.join(" ").slice(0,5e3)}function nr(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 r=e.closest("label");if(r){let c=r.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 i=e.previousSibling;if(i?.nodeType===Node.TEXT_NODE){let c=i.textContent?.trim();if(c&&c.length>1)return c}let a=e.previousElementSibling;if(a){let c=a.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 Wo(){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]")||!ce(o))continue;if(o instanceof HTMLInputElement){let i=o.type.toLowerCase();if(["submit","button","reset","image"].includes(i))continue}let r=nr(o);e.push({label:r,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 Oo(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 $o(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 r of o){if(r.closest("[data-yuktai-panel]")||!ce(r))continue;if((r.innerText||r.getAttribute("id")||r.getAttribute("aria-label")||r.getAttribute("name")||"").toLowerCase().includes(t))return r.scrollIntoView({behavior:"smooth",block:"center"}),r.style.outline="2px solid #0d9488",r.style.outlineOffset="4px",setTimeout(()=>{r.style.outline="",r.style.outlineOffset=""},2500),!0}return!1}async function rr(e,t,o){let r=window,i=r.LanguageModel||r.ai?.languageModel;if(!i)throw new Error("Gemini Nano not available");let a=await i.create({systemPrompt:`You are a helpful web accessibility agent.
1120
+ `}var Do=ae(()=>{"use strict";m();Bo()});var Uo={};me(Uo,{getPageText:()=>qo,highlightField:()=>Yo,runAgent:()=>xr,scanFormFields:()=>jo,scrollToSection:()=>Vo});function re(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 qo(){let e=[],t=new Set,o=n=>{let a=n.trim();a&&a.length>10&&!t.has(a)&&(t.add(a),e.push(a))};document.title&&o(document.title);let r=['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 r){let a=document.querySelector(n)?.getAttribute("content");a&&o(a)}let i=["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']"],s=document.querySelectorAll(i.join(","));for(let n of s){if(n.closest("[data-yuktai-panel]")||!re(n)||n.querySelector("p, h1, h2, h3, h4, h5, h6, li, td, th, div, article, section, blockquote, pre"))continue;let l=n.innerText?.trim();if(l&&l.length>10&&o(l),!l){let I=n.textContent?.trim();I&&I.length>10&&o(I)}let c=n.getAttribute("aria-label")?.trim();c&&c.length>5&&o(c);let p=n.getAttribute("aria-description")?.trim();p&&p.length>5&&o(p);let u=n.getAttribute("aria-valuetext")?.trim();u&&o(u);let E=n.getAttribute("title")?.trim();E&&E.length>5&&o(E);let L=n.getAttribute("data-label")?.trim();L&&o(L);let W=n.getAttribute("data-title")?.trim();W&&o(W),n.querySelectorAll("img").forEach(I=>{let v=I.getAttribute("alt")?.trim();v&&v.length>5&&o(v);let O=I.getAttribute("title")?.trim();O&&O.length>5&&o(O)})}document.querySelectorAll("img").forEach(n=>{if(n.closest("[data-yuktai-panel]")||!re(n))return;let a=n.getAttribute("alt")?.trim(),l=n.getAttribute("title")?.trim();a&&a.length>5&&o(a),l&&l.length>5&&o(l)}),document.querySelectorAll("input:not([type=hidden]), textarea").forEach(n=>{if(n.closest("[data-yuktai-panel]")||!re(n))return;n.placeholder&&o(n.placeholder),n.value&&n.value.length>3&&o(n.value);let a=n.getAttribute("aria-label")?.trim();a&&o(a)}),document.querySelectorAll("select").forEach(n=>{n.closest("[data-yuktai-panel]")||re(n)&&Array.from(n.options).forEach(a=>{a.text?.trim().length>3&&o(a.text.trim())})}),document.querySelectorAll("td, th").forEach(n=>{if(n.closest("[data-yuktai-panel]")||!re(n))return;let a=n.innerText?.trim();a&&a.length>3&&o(a)});try{document.querySelectorAll("iframe").forEach(n=>{try{let a=n.contentDocument;if(!a)return;let l=a.body?.innerText?.trim();l&&l.length>20&&o(l.slice(0,500))}catch{}})}catch{}return document.querySelectorAll("a").forEach(n=>{if(n.closest("[data-yuktai-panel]")||!re(n))return;let a=n.innerText?.trim();a&&a.length>3&&a.length<100&&o(a)}),e.join(" ").slice(0,5e3)}function br(e){let t=e.getAttribute("aria-label")?.trim();if(t)return t;let o=e.getAttribute("aria-labelledby");if(o){let l=document.getElementById(o);if(l)return l.innerText?.trim()||""}if(e.id){let l=document.querySelector(`label[for="${e.id}"]`);if(l)return l.innerText?.trim()||""}let r=e.closest("label");if(r){let l=r.cloneNode(!0);return l.querySelectorAll("input, select, textarea").forEach(c=>c.remove()),l.innerText?.trim()||""}if((e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&e.placeholder)return e.placeholder;if(e.name)return e.name.replace(/[_-]/g," ");let i=e.previousSibling;if(i?.nodeType===Node.TEXT_NODE){let l=i.textContent?.trim();if(l&&l.length>1)return l}let s=e.previousElementSibling;if(s){let l=s.innerText?.trim();if(l&&l.length>1&&l.length<60)return l}let n=e.closest("td, th");if(n){let l=n.previousElementSibling;if(l){let c=l.innerText?.trim();if(c&&c.length>1)return c}}let a=e.getAttribute("title")?.trim();return a||(e instanceof HTMLInputElement?e.type:"field")}function jo(){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]")||!re(o))continue;if(o instanceof HTMLInputElement){let i=o.type.toLowerCase();if(["submit","button","reset","image"].includes(i))continue}let r=br(o);e.push({label:r,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 Yo(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 Vo(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 r of o){if(r.closest("[data-yuktai-panel]")||!re(r))continue;if((r.innerText||r.getAttribute("id")||r.getAttribute("aria-label")||r.getAttribute("name")||"").toLowerCase().includes(t))return r.scrollIntoView({behavior:"smooth",block:"center"}),r.style.outline="2px solid #0d9488",r.style.outlineOffset="4px",setTimeout(()=>{r.style.outline="",r.style.outlineOffset=""},2500),!0}return!1}async function yr(e,t,o){let r=window,i=r.LanguageModel||r.ai?.languageModel;if(!i)throw new Error("Gemini Nano not available");let s=await i.create({systemPrompt:`You are a helpful web accessibility agent.
1121
1121
  Create a simple action plan to help a user complete a task on a webpage.
1122
1122
  Rules:
1123
1123
  - Maximum 5 steps
1124
1124
  - Short and clear \u2014 no jargon
1125
1125
  - If filling a form \u2014 list each field and what to enter
1126
1126
  - No markdown \u2014 no asterisks, no bold, no headers
1127
- - Number each step: 1. 2. 3.`}),s=`Page content: ${e}${o?`
1127
+ - Number each step: 1. 2. 3.`}),a=`Page content: ${e}${o?`
1128
1128
  The page has form fields the user may need to fill.`:""}
1129
1129
 
1130
1130
  User task: ${t}
1131
1131
 
1132
- Action plan:`,c=await a.prompt(s);return a.destroy(),c?.trim()||""}async function ir(e,t){let{askPageWithTransformers:o}=await Promise.resolve().then(()=>(Te(),yt));return(await o(`How do I: ${t}`)).answer||"I could not create a plan for this task."}async function ar(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 r=[],i=(a,n="info")=>{let s={text:a,type:n};r.push(s),o(s)};try{i("\u{1F4D6} Reading page content...","info");let a=Bo(),n=Wo(),s=n.length>0;a.length<50&&i("\u26A0\uFE0F Page content is very limited. This may be a static image page.","error"),i(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"),i("\u{1F916} Creating action plan...","info");let c="";try{t==="gemini"?c=await rr(a,e,s):c=await ir(a,e)}catch{c=s?`1. Locate the form on this page
1132
+ Action plan:`,l=await s.prompt(a);return s.destroy(),l?.trim()||""}async function hr(e,t){let{askPageWithTransformers:o}=await Promise.resolve().then(()=>(ye(),ut));return(await o(`How do I: ${t}`)).answer||"I could not create a plan for this task."}async function xr(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 r=[],i=(s,n="info")=>{let a={text:s,type:n};r.push(a),o(a)};try{i("\u{1F4D6} Reading page content...","info");let s=qo(),n=jo(),a=n.length>0;s.length<50&&i("\u26A0\uFE0F Page content is very limited. This may be a static image page.","error"),i(a?`\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"),i("\u{1F916} Creating action plan...","info");let l="";try{t==="gemini"?l=await yr(s,e,a):l=await hr(s,e)}catch{l=a?`1. Locate the form on this page
1133
1133
  2. Fill each required field
1134
1134
  3. Review your answers
1135
1135
  4. Submit the form`:`1. Read the page carefully
1136
1136
  2. Find the section relevant to your task
1137
- 3. Follow the on-page instructions`}if(c&&(i("\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=>i(` ${p}`,"action"))),s){let p=n[0];i(`\u{1F3AF} First field: "${p.label}"${p.required?" \u2605 required":""}`,"field"),Oo(p.element),n.length>1&&i(`\u{1F4DD} All ${n.length} fields: ${n.map(h=>h.label).join(" \u2192 ")}`,"info")}else{let p=e.toLowerCase().split(/\s+/).filter(y=>y.length>3),h=!1;for(let y of p)if($o(y)){i(`\u{1F3AF} Scrolled to relevant section: "${y}"`,"action"),h=!0;break}h||i("\u{1F4A1} Scroll through the page to find what you need.","info")}return i("\u2705 Ready. Follow the steps above. Ask me again if you need more help.","success"),{success:!0,steps:r}}catch(a){let n=a instanceof Error?a.message:"Agent error.";return i(`\u26A0\uFE0F ${n}`,"error"),{success:!1,steps:r,error:n}}}var Go=fe(()=>{"use strict";m()});var mr={};ke(mr,{CheckIcon:()=>Tt,ChevronLeftIcon:()=>Ne,ChevronRightIcon:()=>He,CloseIcon:()=>me,IconBase:()=>G,Runtime:()=>de,SearchIcon:()=>Me,SortDownIcon:()=>ze,SortUpIcon:()=>Pe,YuktAI:()=>ur,YuktAIWrapper:()=>Qe,YuktaiGrid:()=>qo,aiPlugin:()=>Ce,default:()=>Qe,useGrid:()=>et,voicePlugin:()=>Fe,wcag:()=>Q,wcagPlugin:()=>Q});module.exports=on(mr);m();m();m();function Rt(){let e=window;return e.Rewriter||e.ai?.rewriter||null}async function nt(){try{let e=Rt();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 nn(e){if(!e||e.trim().length<20)return{success:!1,original:e,rewritten:e,error:"Text too short"};try{let t=Rt();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"}),r=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:r.trim()}}catch(t){return{success:!1,original:e,rewritten:e,error:t instanceof Error?t.message:"Rewrite failed"}}}async function Pt(){if(!await nt())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 r of t){let i=r.innerText?.trim();if(!i||i.length<20||r.closest("[data-yuktai-panel]"))continue;let a=await nn(i);a.success&&a.rewritten!==i&&(r.dataset.yuktaiOriginal=i,r.innerText=a.rewritten,o++)}return{fixed:o}}function It(){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)}}m();var zt="yuktai-summary-box";function Nt(){let e=window;return e.Summarizer||e.ai?.summarizer||null}async function rt(){try{let e=Nt();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 rn(){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 r=window.getComputedStyle(o);if(r.display==="none"||r.visibility==="hidden")continue;let i=o.innerText?.trim();i&&i.length>10&&t.push(i)}return t.join(" ").slice(0,5e3)}async function Ht(){if(!await rt())return{success:!1,summary:"",error:"Chrome Built-in AI Summarizer not available. Enable via chrome://flags."};let t=rn();if(!t||t.length<100)return{success:!1,summary:"",error:"Not enough text on this page to summarise."};try{let o=Nt();if(!o)throw new Error("Summarizer API not available");let r=await o.create({type:"tl;dr",format:"plain-text",length:"short",outputLanguage:"en"}),i=await r.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 r.destroy(),an(i.trim()),{success:!0,summary:i.trim()}}catch(o){return{success:!1,summary:"",error:o instanceof Error?o.message:"Summary failed"}}}function an(e){je();let t=document.createElement("div");t.id=zt,t.setAttribute("data-yuktai-panel","true"),t.setAttribute("role","region"),t.setAttribute("aria-label","Page summary by yuktai"),t.style.cssText=`
1137
+ 3. Follow the on-page instructions`}if(l&&(i("\u2705 Your action plan:","success"),l.split(/\n/).map(c=>c.replace(/\*\*/g,"").replace(/\*/g,"").trim()).filter(c=>c.length>5).slice(0,6).forEach(c=>i(` ${c}`,"action"))),a){let c=n[0];i(`\u{1F3AF} First field: "${c.label}"${c.required?" \u2605 required":""}`,"field"),Yo(c.element),n.length>1&&i(`\u{1F4DD} All ${n.length} fields: ${n.map(p=>p.label).join(" \u2192 ")}`,"info")}else{let c=e.toLowerCase().split(/\s+/).filter(u=>u.length>3),p=!1;for(let u of c)if(Vo(u)){i(`\u{1F3AF} Scrolled to relevant section: "${u}"`,"action"),p=!0;break}p||i("\u{1F4A1} Scroll through the page to find what you need.","info")}return i("\u2705 Ready. Follow the steps above. Ask me again if you need more help.","success"),{success:!0,steps:r}}catch(s){let n=s instanceof Error?s.message:"Agent error.";return i(`\u26A0\uFE0F ${n}`,"error"),{success:!1,steps:r,error:n}}}var Ko=ae(()=>{"use strict";m()});var Nr={};me(Nr,{CheckIcon:()=>Ct,ChevronLeftIcon:()=>kt,ChevronRightIcon:()=>Tt,CloseIcon:()=>Et,IconBase:()=>j,Runtime:()=>ie,SearchIcon:()=>ht,SortDownIcon:()=>wt,SortUpIcon:()=>xt,YuktAI:()=>Pr,YuktAIWrapper:()=>Oe,YuktaiGrid:()=>Xo,YuktaiGridAI:()=>Jo,YuktaiGridAgent:()=>en,YuktaiGridWebMCP:()=>bt,aiPlugin:()=>xe,countGrid:()=>Be,default:()=>Oe,getColumns:()=>_e,getRow:()=>De,highlightRows:()=>qe,openRow:()=>Ye,searchGrid:()=>We,selectRow:()=>je,useGrid:()=>Zo,useYuktaiGridAgent:()=>yt,voicePlugin:()=>we,wcag:()=>U,wcagPlugin:()=>U});module.exports=bn(Nr);m();m();m();function Ht(){let e=window;return e.Rewriter||e.ai?.rewriter||null}async function Ze(){try{let e=Ht();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 yn(e){if(!e||e.trim().length<20)return{success:!1,original:e,rewritten:e,error:"Text too short"};try{let t=Ht();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"}),r=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:r.trim()}}catch(t){return{success:!1,original:e,rewritten:e,error:t instanceof Error?t.message:"Rewrite failed"}}}async function Ot(){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 r of t){let i=r.innerText?.trim();if(!i||i.length<20||r.closest("[data-yuktai-panel]"))continue;let s=await yn(i);s.success&&s.rewritten!==i&&(r.dataset.yuktaiOriginal=i,r.innerText=s.rewritten,o++)}return{fixed:o}}function Wt(){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)}}m();var Bt="yuktai-summary-box";function _t(){let e=window;return e.Summarizer||e.ai?.summarizer||null}async function Je(){try{let e=_t();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 hn(){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 r=window.getComputedStyle(o);if(r.display==="none"||r.visibility==="hidden")continue;let i=o.innerText?.trim();i&&i.length>10&&t.push(i)}return t.join(" ").slice(0,5e3)}async function Dt(){if(!await Je())return{success:!1,summary:"",error:"Chrome Built-in AI Summarizer not available. Enable via chrome://flags."};let t=hn();if(!t||t.length<100)return{success:!1,summary:"",error:"Not enough text on this page to summarise."};try{let o=_t();if(!o)throw new Error("Summarizer API not available");let r=await o.create({type:"tl;dr",format:"plain-text",length:"short",outputLanguage:"en"}),i=await r.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 r.destroy(),xn(i.trim()),{success:!0,summary:i.trim()}}catch(o){return{success:!1,summary:"",error:o instanceof Error?o.message:"Summary failed"}}}function xn(e){Me();let t=document.createElement("div");t.id=Bt,t.setAttribute("data-yuktai-panel","true"),t.setAttribute("role","region"),t.setAttribute("aria-label","Page summary by yuktai"),t.style.cssText=`
1138
1138
  position: fixed;
1139
1139
  top: 0;
1140
1140
  left: 0;
@@ -1155,7 +1155,7 @@ Action plan:`,c=await a.prompt(s);return a.destroy(),c?.trim()||""}async functio
1155
1155
  background: none; border: none; color: #ffffff;
1156
1156
  font-size: 20px; cursor: pointer; padding: 0 4px;
1157
1157
  line-height: 1; flex-shrink: 0;
1158
- `,r.addEventListener("click",je),t.appendChild(o),t.appendChild(r),document.body.prepend(t)}function je(){let e=document.getElementById(zt);e&&e.remove()}m();var Ue=[{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"}],Ve="en";function sn(){let e=window;return e.Translator||e.translation||null}async function ln(e){try{let t=window;if(!sn())return!1;if(t.Translator&&typeof t.Translator.availability=="function")try{let r=await t.Translator.availability({sourceLanguage:"en",targetLanguage:e});return r==="readily"||r==="available"||r==="downloadable"||r==="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 cn(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 Bt(e){if(e===Ve)return{success:!0,language:e,fixed:0};if(e==="en")return it(),Ve="en",{success:!0,language:"en",fixed:0};if(!await ln(e))return{success:!1,language:e,fixed:0,error:`Translation to ${e} not available. Enable via chrome://flags.`};try{let o=await cn(e),r=document.querySelectorAll("p, h1, h2, h3, h4, h5, h6, li, blockquote, td, th, label, figcaption, span, a"),i=0;for(let a of r){if(a.closest("[data-yuktai-panel]")||a.children.length>0)continue;let n=a.innerText?.trim();if(!n||n.length<2)continue;a.dataset.yuktaiTranslationOriginal||(a.dataset.yuktaiTranslationOriginal=n);let s=await o.translate(n);s&&s!==n&&(a.innerText=s,i++)}return typeof o.destroy=="function"&&o.destroy(),Ve=e,{success:!0,language:e,fixed:i}}catch(o){return{success:!1,language:e,fixed:0,error:o instanceof Error?o.message:"Translation failed"}}}function it(){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)}Ve="en"}m();var dn=[{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"}],oe=null,Ye=!1,ge=null;function at(){return!!(window.SpeechRecognition||window.webkitSpeechRecognition)}function pn(e){let t=e.toLowerCase().trim();for(let o of dn)for(let r of o.phrases)if(t.includes(r))return{action:o.action,label:o.label};return null}function un(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=Wt(),o=t.indexOf(document.activeElement),r=t[o+1]||t[0];r&&r.focus();break}case"tab-back":{let t=Wt(),o=t.indexOf(document.activeElement),r=t[o-1]||t[t.length-1];r&&r.focus();break}case"stop-voice":{st();break}}}function Wt(){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 Ot(e){if(!at())return!1;if(Ye)return!0;e&&(ge=e);let t=window.SpeechRecognition||window.webkitSpeechRecognition;return oe=new t,oe.continuous=!0,oe.interimResults=!1,oe.lang="en-US",oe.onresult=o=>{let r=o.results[o.results.length-1][0].transcript,i=pn(r);if(i){un(i.action);let a={success:!0,command:r,action:i.label};if(ge&&ge(a),i.action==="stop-voice")return}},oe.onend=()=>{Ye&&oe?.start()},oe.onerror=o=>{o.error!=="no-speech"&&ge&&ge({success:!1,command:"",action:"",error:`Voice error: ${o.error}`})},oe.start(),Ye=!0,mn(),!0}function st(){Ye=!1,oe&&(oe.stop(),oe=null),ge=null,_t()}var $t="yuktai-voice-indicator";function mn(){_t();let e=document.createElement("div");e.id=$t,e.setAttribute("data-yuktai-panel","true"),e.setAttribute("aria-live","polite"),e.setAttribute("aria-label","yuktai voice control is listening"),e.style.cssText=`
1158
+ `,r.addEventListener("click",Me),t.appendChild(o),t.appendChild(r),document.body.prepend(t)}function Me(){let e=document.getElementById(Bt);e&&e.remove()}m();var Ne=[{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"}],Pe="en";function wn(){let e=window;return e.Translator||e.translation||null}async function vn(e){try{let t=window;if(!wn())return!1;if(t.Translator&&typeof t.Translator.availability=="function")try{let r=await t.Translator.availability({sourceLanguage:"en",targetLanguage:e});return r==="readily"||r==="available"||r==="downloadable"||r==="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 kn(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 qt(e){if(e===Pe)return{success:!0,language:e,fixed:0};if(e==="en")return Qe(),Pe="en",{success:!0,language:"en",fixed:0};if(!await vn(e))return{success:!1,language:e,fixed:0,error:`Translation to ${e} not available. Enable via chrome://flags.`};try{let o=await kn(e),r=document.querySelectorAll("p, h1, h2, h3, h4, h5, h6, li, blockquote, td, th, label, figcaption, span, a"),i=0;for(let s of r){if(s.closest("[data-yuktai-panel]")||s.children.length>0)continue;let n=s.innerText?.trim();if(!n||n.length<2)continue;s.dataset.yuktaiTranslationOriginal||(s.dataset.yuktaiTranslationOriginal=n);let a=await o.translate(n);a&&a!==n&&(s.innerText=a,i++)}return typeof o.destroy=="function"&&o.destroy(),Pe=e,{success:!0,language:e,fixed:i}}catch(o){return{success:!1,language:e,fixed:0,error:o instanceof Error?o.message:"Translation failed"}}}function Qe(){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)}Pe="en"}m();var Sn=[{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"}],X=null,ze=!1,se=null;function et(){return!!(window.SpeechRecognition||window.webkitSpeechRecognition)}function Tn(e){let t=e.toLowerCase().trim();for(let o of Sn)for(let r of o.phrases)if(t.includes(r))return{action:o.action,label:o.label};return null}function An(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=jt(),o=t.indexOf(document.activeElement),r=t[o+1]||t[0];r&&r.focus();break}case"tab-back":{let t=jt(),o=t.indexOf(document.activeElement),r=t[o-1]||t[t.length-1];r&&r.focus();break}case"stop-voice":{tt();break}}}function jt(){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 Yt(e){if(!et())return!1;if(ze)return!0;e&&(se=e);let t=window.SpeechRecognition||window.webkitSpeechRecognition;return X=new t,X.continuous=!0,X.interimResults=!1,X.lang="en-US",X.onresult=o=>{let r=o.results[o.results.length-1][0].transcript,i=Tn(r);if(i){An(i.action);let s={success:!0,command:r,action:i.label};if(se&&se(s),i.action==="stop-voice")return}},X.onend=()=>{ze&&X?.start()},X.onerror=o=>{o.error!=="no-speech"&&se&&se({success:!1,command:"",action:"",error:`Voice error: ${o.error}`})},X.start(),ze=!0,Cn(),!0}function tt(){ze=!1,X&&(X.stop(),X=null),se=null,Ut()}var Vt="yuktai-voice-indicator";function Cn(){Ut();let e=document.createElement("div");e.id=Vt,e.setAttribute("data-yuktai-panel","true"),e.setAttribute("aria-live","polite"),e.setAttribute("aria-label","yuktai voice control is listening"),e.style.cssText=`
1159
1159
  position: fixed;
1160
1160
  bottom: 80px;
1161
1161
  left: 50%;
@@ -1185,7 +1185,7 @@ Action plan:`,c=await a.prompt(s);return a.destroy(),c?.trim()||""}async functio
1185
1185
  0%, 100% { opacity: 1; transform: scale(1); }
1186
1186
  50% { opacity: 0.4; transform: scale(0.7); }
1187
1187
  }
1188
- `,document.head.appendChild(r)}let o=document.createElement("span");o.textContent="Listening for commands...",e.appendChild(t),e.appendChild(o),document.body.appendChild(e)}function _t(){let e=document.getElementById($t);e&&e.remove()}m();var fn=["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 Gt(){let e=window;return e.Writer||e.ai?.writer||null}async function lt(){try{let e=Gt();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 gn(e){let t=[],o=e.innerText?.trim();o&&t.push(`element text: "${o}"`);let r=e.placeholder?.trim();r&&t.push(`placeholder: "${r}"`);let i=e.getAttribute("name")?.trim();i&&t.push(`name: "${i}"`);let a=e.getAttribute("type")?.trim();a&&t.push(`type: "${a}"`);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 bn(e,t){let o=`
1188
+ `,document.head.appendChild(r)}let o=document.createElement("span");o.textContent="Listening for commands...",e.appendChild(t),e.appendChild(o),document.body.appendChild(e)}function Ut(){let e=document.getElementById(Vt);e&&e.remove()}m();var En=["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 Kt(){let e=window;return e.Writer||e.ai?.writer||null}async function ot(){try{let e=Kt();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 Ln(e){let t=[],o=e.innerText?.trim();o&&t.push(`element text: "${o}"`);let r=e.placeholder?.trim();r&&t.push(`placeholder: "${r}"`);let i=e.getAttribute("name")?.trim();i&&t.push(`name: "${i}"`);let s=e.getAttribute("type")?.trim();s&&t.push(`type: "${s}"`);let n=e.id;if(n){let c=document.querySelector(`label[for="${n}"]`);c&&t.push(`label: "${c.innerText?.trim()}"`)}let a=e.parentElement?.innerText?.trim().slice(0,60);a&&t.push(`parent context: "${a}"`),t.push(`tag: ${e.tagName.toLowerCase()}`);let l=e.getAttribute("role");return l&&t.push(`role: ${l}`),t.join(". ")}async function Rn(e,t){let o=`
1189
1189
  Generate a short, clear aria-label for an HTML element.
1190
1190
  The label must be 2-6 words maximum.
1191
1191
  The label must describe what the element does or what it is.
@@ -1196,7 +1196,7 @@ Action plan:`,c=await a.prompt(s);return a.destroy(),c?.trim()||""}async functio
1196
1196
  ${t}
1197
1197
 
1198
1198
  Output only the label. Nothing else.
1199
- `.trim();return(await e.write(o)).trim().replace(/^["']|["']$/g,"").replace(/\.$/,"").trim()}async function Dt(){if(!await lt())return{success:!1,fixed:0,elements:[],error:"Chrome Built-in AI Writer not available. Enable via chrome://flags."};let t=document.querySelectorAll(fn);if(t.length===0)return{success:!0,fixed:0,elements:[]};try{let o=Gt();if(!o)throw new Error("Writer API not available");let r=await o.create({tone:"neutral",format:"plain-text",length:"short",outputLanguage:"en"}),i=0,a=[];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=gn(n),p=await bn(r,c);p&&p.length>0&&(n.dataset.yuktaiLabelOriginal=n.getAttribute("aria-label")||"",n.setAttribute("aria-label",p),i++,a.push({tag:n.tagName.toLowerCase(),label:p}))}return r.destroy(),{success:!0,fixed:i,elements:a}}catch(o){return{success:!1,fixed:0,elements:[],error:o instanceof Error?o.message:"Label generation failed"}}}function qt(){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 Ze=null,jt=null;var Vt=null,ct=null,H=null,be=null,Ke=null,dt=null,ye=null,Xe={deuteranopia:"yuktai-cb-d",protanopia:"yuktai-cb-p",tritanopia:"yuktai-cb-t"};var Ut=new Set(["input","select","textarea"]);var pt={nav:"navigation",header:"banner",footer:"contentinfo",main:"main",aside:"complementary"};function ut(e,t="polite"){if(typeof window>"u"||!ye?.speechEnabled||!window.speechSynthesis)return;window.speechSynthesis.cancel();let o=new SpeechSynthesisUtterance(e);o.rate=1,o.pitch=1,o.volume=1;let r=window.speechSynthesis.getVoices();r.length>0&&(o.voice=r[0]),window.speechSynthesis.speak(o)}function eo(e,t="info"){if(typeof document>"u")return;let r={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];H||(H=document.createElement("div"),H.setAttribute("role","alert"),H.setAttribute("aria-live","assertive"),H.setAttribute("aria-atomic","true"),H.style.cssText=`
1199
+ `.trim();return(await e.write(o)).trim().replace(/^["']|["']$/g,"").replace(/\.$/,"").trim()}async function Xt(){if(!await ot())return{success:!1,fixed:0,elements:[],error:"Chrome Built-in AI Writer not available. Enable via chrome://flags."};let t=document.querySelectorAll(En);if(t.length===0)return{success:!0,fixed:0,elements:[]};try{let o=Kt();if(!o)throw new Error("Writer API not available");let r=await o.create({tone:"neutral",format:"plain-text",length:"short",outputLanguage:"en"}),i=0,s=[];for(let n of t){if(n.closest("[data-yuktai-panel]"))continue;let a=window.getComputedStyle(n);if(a.display==="none"||a.visibility==="hidden")continue;let l=Ln(n),c=await Rn(r,l);c&&c.length>0&&(n.dataset.yuktaiLabelOriginal=n.getAttribute("aria-label")||"",n.setAttribute("aria-label",c),i++,s.push({tag:n.tagName.toLowerCase(),label:c}))}return r.destroy(),{success:!0,fixed:i,elements:s}}catch(o){return{success:!1,fixed:0,elements:[],error:o instanceof Error?o.message:"Label generation failed"}}}function Zt(){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 Ge=null,Jt=null;var Qt=null,nt=null,H=null,le=null,Fe=null,rt=null,ce=null,$e={deuteranopia:"yuktai-cb-d",protanopia:"yuktai-cb-p",tritanopia:"yuktai-cb-t"};var eo=new Set(["input","select","textarea"]);var it={nav:"navigation",header:"banner",footer:"contentinfo",main:"main",aside:"complementary"};function at(e,t="polite"){if(typeof window>"u"||!ce?.speechEnabled||!window.speechSynthesis)return;window.speechSynthesis.cancel();let o=new SpeechSynthesisUtterance(e);o.rate=1,o.pitch=1,o.volume=1;let r=window.speechSynthesis.getVoices();r.length>0&&(o.voice=r[0]),window.speechSynthesis.speak(o)}function so(e,t="info"){if(typeof document>"u")return;let r={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];H||(H=document.createElement("div"),H.setAttribute("role","alert"),H.setAttribute("aria-live","assertive"),H.setAttribute("aria-atomic","true"),H.style.cssText=`
1200
1200
  position: fixed;
1201
1201
  top: 80px;
1202
1202
  right: 16px;
@@ -1222,7 +1222,7 @@ Action plan:`,c=await a.prompt(s);return a.destroy(),c?.trim()||""}async functio
1222
1222
  onclick="this.parentElement.style.transform='translateX(120%)';this.parentElement.style.opacity='0'"
1223
1223
  style="background:none;border:none;color:#fff;cursor:pointer;font-size:18px;padding:0;line-height:1"
1224
1224
  aria-label="Close notification">\xD7</button>
1225
- `,window.innerWidth<=480&&(H.style.right="8px",H.style.left="8px",H.style.maxWidth="none",H.style.width="auto"),requestAnimationFrame(()=>{H&&(H.style.transform="translateX(0)",H.style.opacity="1")}),setTimeout(()=>{H&&(H.style.transform="translateX(120%)",H.style.opacity="0")},5e3)}function E(e,t="info",o=!0){Ze&&(Ze.textContent=e),eo(e,t),o&&ut(e,t==="error"?"assertive":"polite")}function yn(){if(typeof document>"u"||Vt)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=`
1225
+ `,window.innerWidth<=480&&(H.style.right="8px",H.style.left="8px",H.style.maxWidth="none",H.style.width="auto"),requestAnimationFrame(()=>{H&&(H.style.transform="translateX(0)",H.style.opacity="1")}),setTimeout(()=>{H&&(H.style.transform="translateX(120%)",H.style.opacity="0")},5e3)}function R(e,t="info",o=!0){Ge&&(Ge.textContent=e),so(e,t),o&&at(e,t==="error"?"assertive":"polite")}function In(){if(typeof document>"u"||Qt)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=`
1226
1226
  position: fixed;
1227
1227
  top: 0;
1228
1228
  left: 0;
@@ -1236,7 +1236,7 @@ Action plan:`,c=await a.prompt(s);return a.destroy(),c?.trim()||""}async functio
1236
1236
  transform: translateY(-100%);
1237
1237
  transition: transform 0.2s ease;
1238
1238
  font-family: system-ui, sans-serif;
1239
- `;let o=!1;if(e.forEach(({label:i,selector:a})=>{let n=document.querySelector(a);if(!n)return;o=!0,n.getAttribute("tabindex")||n.setAttribute("tabindex","-1");let s=document.createElement("a");s.href="#",s.textContent=i,s.style.cssText=`
1239
+ `;let o=!1;if(e.forEach(({label:i,selector:s})=>{let n=document.querySelector(s);if(!n)return;o=!0,n.getAttribute("tabindex")||n.setAttribute("tabindex","-1");let a=document.createElement("a");a.href="#",a.textContent=i,a.style.cssText=`
1240
1240
  color: #fff;
1241
1241
  background: #1a73e8;
1242
1242
  padding: 8px 14px;
@@ -1247,7 +1247,7 @@ Action plan:`,c=await a.prompt(s);return a.destroy(),c?.trim()||""}async functio
1247
1247
  white-space: nowrap;
1248
1248
  border: 2px solid transparent;
1249
1249
  transition: background 0.15s, border-color 0.15s;
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"}),E(`Jumped to ${i.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),Vt=t}function hn(){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=`
1250
+ `,a.addEventListener("focus",()=>{t.style.transform="translateY(0)"}),a.addEventListener("blur",()=>{setTimeout(()=>{t.matches(":focus-within")||(t.style.transform="translateY(-100%)")},2e3)}),a.addEventListener("click",l=>{l.preventDefault(),n.focus(),n.scrollIntoView({behavior:"smooth",block:"start"}),R(`Jumped to ${i.replace("Skip to ","")}`,"info"),t.style.transform="translateY(-100%)"}),t.appendChild(a)}),!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),Qt=t}function Mn(){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=`
1251
1251
 
1252
1252
  /* \u2500\u2500 Focus indicator \u2014 WCAG 2.4.11 minimum 2px solid \u2500\u2500 */
1253
1253
  [data-yuktai-a11y] *:focus-visible {
@@ -1393,7 +1393,7 @@ Action plan:`,c=await a.prompt(s);return a.destroy(),c?.trim()||""}async functio
1393
1393
  width: auto !important;
1394
1394
  }
1395
1395
  }
1396
- `,document.head.appendChild(e),document.documentElement.setAttribute("data-yuktai-a11y","true")}function xn(){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 r=t.closest("[role='dialog'],[role='alertdialog']");if(r){r.style.display="none",E("Dialog closed","info");return}let i=t.closest("[role='menu'],[role='menubar']");i&&(i.style.display="none",E("Menu closed","info"))}if(o==="menuitem"||t.closest("[role='menu'],[role='menubar']")){let r=t.closest("[role='menu'],[role='menubar']");if(!r)return;let i=Array.from(r.querySelectorAll("[role='menuitem']:not([disabled])")),a=i.indexOf(t);e.key==="ArrowDown"||e.key==="ArrowRight"?(e.preventDefault(),i[(a+1)%i.length]?.focus()):e.key==="ArrowUp"||e.key==="ArrowLeft"?(e.preventDefault(),i[(a-1+i.length)%i.length]?.focus()):e.key==="Home"?(e.preventDefault(),i[0]?.focus()):e.key==="End"&&(e.preventDefault(),i[i.length-1]?.focus())}if(o==="tab"||t.closest("[role='tablist']")){let r=t.closest("[role='tablist']");if(!r)return;let i=Array.from(r.querySelectorAll("[role='tab']:not([disabled])")),a=i.indexOf(t);if(e.key==="ArrowRight"||e.key==="ArrowDown"){e.preventDefault();let n=i[(a+1)%i.length];n?.focus(),n?.click()}else if(e.key==="ArrowLeft"||e.key==="ArrowUp"){e.preventDefault();let n=i[(a-1+i.length)%i.length];n?.focus(),n?.click()}}if(o==="option"||t.closest("[role='listbox']")){let r=t.closest("[role='listbox']");if(!r)return;let i=Array.from(r.querySelectorAll("[role='option']:not([aria-disabled='true'])")),a=i.indexOf(t);e.key==="ArrowDown"?(e.preventDefault(),i[(a+1)%i.length]?.focus()):e.key==="ArrowUp"?(e.preventDefault(),i[(a-1+i.length)%i.length]?.focus()):(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),t.setAttribute("aria-selected","true"),i.forEach(n=>{n!==t&&n.setAttribute("aria-selected","false")}),E(`Selected: ${t.textContent?.trim()}`,"success"))}e.altKey&&e.key==="a"&&(e.preventDefault(),vn()),e.key==="Tab"&&ye?.speechEnabled&&setTimeout(()=>{let r=document.activeElement;if(!r)return;let i=r.getAttribute("aria-label")||r.getAttribute("title")||r.textContent?.trim()||r.tagName.toLowerCase(),a=r.getAttribute("role")||r.tagName.toLowerCase();ut(`${i}, ${a}`)},100)}))}function Je(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],r=t[t.length-1];o.focus(),e.addEventListener("keydown",i=>{i.key==="Tab"&&(i.shiftKey?document.activeElement===o&&(i.preventDefault(),r.focus()):document.activeElement===r&&(i.preventDefault(),o.focus()))})}function vn(){if(typeof document>"u")return;if(be){be.remove(),be=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=`
1396
+ `,document.head.appendChild(e),document.documentElement.setAttribute("data-yuktai-a11y","true")}function Pn(){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 r=t.closest("[role='dialog'],[role='alertdialog']");if(r){r.style.display="none",R("Dialog closed","info");return}let i=t.closest("[role='menu'],[role='menubar']");i&&(i.style.display="none",R("Menu closed","info"))}if(o==="menuitem"||t.closest("[role='menu'],[role='menubar']")){let r=t.closest("[role='menu'],[role='menubar']");if(!r)return;let i=Array.from(r.querySelectorAll("[role='menuitem']:not([disabled])")),s=i.indexOf(t);e.key==="ArrowDown"||e.key==="ArrowRight"?(e.preventDefault(),i[(s+1)%i.length]?.focus()):e.key==="ArrowUp"||e.key==="ArrowLeft"?(e.preventDefault(),i[(s-1+i.length)%i.length]?.focus()):e.key==="Home"?(e.preventDefault(),i[0]?.focus()):e.key==="End"&&(e.preventDefault(),i[i.length-1]?.focus())}if(o==="tab"||t.closest("[role='tablist']")){let r=t.closest("[role='tablist']");if(!r)return;let i=Array.from(r.querySelectorAll("[role='tab']:not([disabled])")),s=i.indexOf(t);if(e.key==="ArrowRight"||e.key==="ArrowDown"){e.preventDefault();let n=i[(s+1)%i.length];n?.focus(),n?.click()}else if(e.key==="ArrowLeft"||e.key==="ArrowUp"){e.preventDefault();let n=i[(s-1+i.length)%i.length];n?.focus(),n?.click()}}if(o==="option"||t.closest("[role='listbox']")){let r=t.closest("[role='listbox']");if(!r)return;let i=Array.from(r.querySelectorAll("[role='option']:not([aria-disabled='true'])")),s=i.indexOf(t);e.key==="ArrowDown"?(e.preventDefault(),i[(s+1)%i.length]?.focus()):e.key==="ArrowUp"?(e.preventDefault(),i[(s-1+i.length)%i.length]?.focus()):(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),t.setAttribute("aria-selected","true"),i.forEach(n=>{n!==t&&n.setAttribute("aria-selected","false")}),R(`Selected: ${t.textContent?.trim()}`,"success"))}e.altKey&&e.key==="a"&&(e.preventDefault(),Nn()),e.key==="Tab"&&ce?.speechEnabled&&setTimeout(()=>{let r=document.activeElement;if(!r)return;let i=r.getAttribute("aria-label")||r.getAttribute("title")||r.textContent?.trim()||r.tagName.toLowerCase(),s=r.getAttribute("role")||r.tagName.toLowerCase();at(`${i}, ${s}`)},100)}))}function He(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],r=t[t.length-1];o.focus(),e.addEventListener("keydown",i=>{i.key==="Tab"&&(i.shiftKey?document.activeElement===o&&(i.preventDefault(),r.focus()):document.activeElement===r&&(i.preventDefault(),o.focus()))})}function Nn(){if(typeof document>"u")return;if(le){le.remove(),le=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=`
1397
1397
  position: fixed;
1398
1398
  top: 50%;
1399
1399
  left: 50%;
@@ -1423,7 +1423,7 @@ Action plan:`,c=await a.prompt(s);return a.destroy(),c?.trim()||""}async functio
1423
1423
  <span style="font-size:12px;color:#ccc;text-align:right;flex:1;margin-left:12px">${i}</span>
1424
1424
  </div>
1425
1425
  `).join("")}
1426
- `,e.querySelector("[data-yuktai-close]")?.addEventListener("click",()=>{e.remove(),be=null}),e.addEventListener("keydown",r=>{r.key==="Escape"&&(e.remove(),be=null)}),document.body.appendChild(e),be=e,Je(e),E("Keyboard shortcuts opened. Press Escape to close.","info")}function wn(e){if(typeof document>"u"||!ye?.showAuditBadge||typeof window<"u"&&!window.location.hostname.includes("localhost")&&!window.location.hostname.includes("127.0.0.1"))return;ct&&ct.remove();let t=e.score,o=t>=90?"#0f9d58":t>=70?"#f29900":"#d93025",r=t>=90?"\u267F":t>=70?"\u26A0":"\u2715",i=document.createElement("button");i.setAttribute("aria-label",`Accessibility score: ${t} out of 100`),i.setAttribute("data-yuktai-badge","true"),i.style.cssText=`
1426
+ `,e.querySelector("[data-yuktai-close]")?.addEventListener("click",()=>{e.remove(),le=null}),e.addEventListener("keydown",r=>{r.key==="Escape"&&(e.remove(),le=null)}),document.body.appendChild(e),le=e,He(e),R("Keyboard shortcuts opened. Press Escape to close.","info")}function zn(e){if(typeof document>"u"||!ce?.showAuditBadge||typeof window<"u"&&!window.location.hostname.includes("localhost")&&!window.location.hostname.includes("127.0.0.1"))return;nt&&nt.remove();let t=e.score,o=t>=90?"#0f9d58":t>=70?"#f29900":"#d93025",r=t>=90?"\u267F":t>=70?"\u26A0":"\u2715",i=document.createElement("button");i.setAttribute("aria-label",`Accessibility score: ${t} out of 100`),i.setAttribute("data-yuktai-badge","true"),i.style.cssText=`
1427
1427
  position: fixed;
1428
1428
  bottom: 16px;
1429
1429
  left: 16px;
@@ -1442,7 +1442,7 @@ Action plan:`,c=await a.prompt(s);return a.destroy(),c?.trim()||""}async functio
1442
1442
  align-items: center;
1443
1443
  gap: 6px;
1444
1444
  transition: transform 0.15s;
1445
- `,i.innerHTML=`${r} ${t}/100 <span style="font-weight:400;opacity:0.85">${e.details.length} issues</span>`,i.addEventListener("click",()=>kn(e)),document.body.appendChild(i),ct=i}function kn(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=`
1445
+ `,i.innerHTML=`${r} ${t}/100 <span style="font-weight:400;opacity:0.85">${e.details.length} issues</span>`,i.addEventListener("click",()=>Fn(e)),document.body.appendChild(i),nt=i}function Fn(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=`
1446
1446
  position: fixed;
1447
1447
  bottom: 56px;
1448
1448
  left: 16px;
@@ -1474,7 +1474,7 @@ Action plan:`,c=await a.prompt(s);return a.destroy(),c?.trim()||""}async functio
1474
1474
  </div>
1475
1475
  `).join("")}
1476
1476
  ${e.details.length>20?`<div style="color:#888;padding:8px 0;text-align:center">+${e.details.length-20} more issues</div>`:""}
1477
- `,o.addEventListener("keydown",i=>{i.key==="Escape"&&o.remove()}),document.body.appendChild(o),Je(o)}function to(e){typeof document>"u"||(dt&&clearTimeout(dt),dt=setTimeout(()=>{if(Ke)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=`
1477
+ `,o.addEventListener("keydown",i=>{i.key==="Escape"&&o.remove()}),document.body.appendChild(o),He(o)}function lo(e){typeof document>"u"||(rt&&clearTimeout(rt),rt=setTimeout(()=>{if(Fe)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=`
1478
1478
  position: fixed;
1479
1479
  top: 50%;
1480
1480
  left: 50%;
@@ -1503,19 +1503,29 @@ Action plan:`,c=await a.prompt(s);return a.destroy(),c?.trim()||""}async functio
1503
1503
  No, sign out
1504
1504
  </button>
1505
1505
  </div>
1506
- `;let o=t.querySelector("[data-yuktai-extend]"),r=t.querySelector("[data-yuktai-dismiss]");o?.addEventListener("click",()=>{t.remove(),Ke=null,E("Session extended. You have more time.","success"),ye?.timeoutWarning&&to(ye.timeoutWarning)}),r?.addEventListener("click",()=>{t.remove(),Ke=null}),document.body.appendChild(t),Ke=t,Je(t),E("Warning: Your session will expire soon. Do you need more time?","warning")},e*1e3))}function Sn(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(#${Xe[e.colorBlindMode]})`;document.body.style.filter=o}else document.body.style.filter=""}function An(e){try{let t=localStorage.getItem("yuktai-a11y-prefs");t&&Object.assign(e,JSON.parse(t))}catch{}}async function Yt(e){if(e){if(!await nt()){E("Plain English requires Chrome 127+","warning");return}E("Rewriting page in plain English...","info",!1);let o=await Pt();E(o.error?`Plain English failed: ${o.error}`:`${o.fixed} sections rewritten in plain English`,o.error?"error":"success",!1)}else It(),E("Original text restored","info",!1)}async function Kt(e){if(e){if(!await rt()){E("Page summariser requires Chrome 127+","warning");return}E("Generating page summary...","info",!1);let o=await Ht();E(o.error?`Summary failed: ${o.error}`:"Page summary added at top",o.error?"error":"success",!1)}else je(),E("Page summary removed","info",!1)}async function Xt(e){if(e==="en"){it(),E("Page restored to English","info",!1);return}E(`Translating page to ${e}...`,"info",!1);let t=await Bt(e);E(t.error?`Translation failed: ${t.error}`:`Page translated to ${e}`,t.error?"error":"success",!1)}async function Zt(e){if(e){if(!at()){E("Voice control not supported in this browser","warning");return}Ot(t=>{t.success&&E(`Voice: ${t.action}`,"info",!1)}),E("Voice control started. Say a command.","success",!1)}else st(),E("Voice control stopped","info",!1)}async function Jt(e){if(e){if(!await lt()){E("Smart labels requires Chrome 127+","warning");return}E("Generating smart labels...","info",!1);let o=await Dt();E(o.error?`Smart labels failed: ${o.error}`:`${o.fixed} elements labelled`,o.error?"error":"success",!1)}else qt(),E("Smart labels removed","info",!1)}function Tn(){if(typeof document>"u"||Ze)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),Ze=e}function En(){if(typeof document>"u"||jt)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=`
1506
+ `;let o=t.querySelector("[data-yuktai-extend]"),r=t.querySelector("[data-yuktai-dismiss]");o?.addEventListener("click",()=>{t.remove(),Fe=null,R("Session extended. You have more time.","success"),ce?.timeoutWarning&&lo(ce.timeoutWarning)}),r?.addEventListener("click",()=>{t.remove(),Fe=null}),document.body.appendChild(t),Fe=t,He(t),R("Warning: Your session will expire soon. Do you need more time?","warning")},e*1e3))}function $n(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(#${$e[e.colorBlindMode]})`;document.body.style.filter=o}else document.body.style.filter=""}function Gn(e){try{let t=localStorage.getItem("yuktai-a11y-prefs");t&&Object.assign(e,JSON.parse(t))}catch{}}async function to(e){if(e){if(!await Ze()){R("Plain English requires Chrome 127+","warning");return}R("Rewriting page in plain English...","info",!1);let o=await Ot();R(o.error?`Plain English failed: ${o.error}`:`${o.fixed} sections rewritten in plain English`,o.error?"error":"success",!1)}else Wt(),R("Original text restored","info",!1)}async function oo(e){if(e){if(!await Je()){R("Page summariser requires Chrome 127+","warning");return}R("Generating page summary...","info",!1);let o=await Dt();R(o.error?`Summary failed: ${o.error}`:"Page summary added at top",o.error?"error":"success",!1)}else Me(),R("Page summary removed","info",!1)}async function no(e){if(e==="en"){Qe(),R("Page restored to English","info",!1);return}R(`Translating page to ${e}...`,"info",!1);let t=await qt(e);R(t.error?`Translation failed: ${t.error}`:`Page translated to ${e}`,t.error?"error":"success",!1)}async function ro(e){if(e){if(!et()){R("Voice control not supported in this browser","warning");return}Yt(t=>{t.success&&R(`Voice: ${t.action}`,"info",!1)}),R("Voice control started. Say a command.","success",!1)}else tt(),R("Voice control stopped","info",!1)}async function io(e){if(e){if(!await ot()){R("Smart labels requires Chrome 127+","warning");return}R("Generating smart labels...","info",!1);let o=await Xt();R(o.error?`Smart labels failed: ${o.error}`:`${o.fixed} elements labelled`,o.error?"error":"success",!1)}else Zt(),R("Smart labels removed","info",!1)}function Hn(){if(typeof document>"u"||Ge)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),Ge=e}function On(){if(typeof document>"u"||Jt)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=`
1507
1507
  <defs>
1508
- <filter id="${Xe.deuteranopia}">
1508
+ <filter id="${$e.deuteranopia}">
1509
1509
  <feColorMatrix type="matrix"
1510
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"/>
1511
1511
  </filter>
1512
- <filter id="${Xe.protanopia}">
1512
+ <filter id="${$e.protanopia}">
1513
1513
  <feColorMatrix type="matrix"
1514
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"/>
1515
1515
  </filter>
1516
- <filter id="${Xe.tritanopia}">
1516
+ <filter id="${$e.tritanopia}">
1517
1517
  <feColorMatrix type="matrix"
1518
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"/>
1519
1519
  </filter>
1520
1520
  </defs>
1521
- `,document.body.appendChild(e),jt=e}function Qt(e){let t={critical:20,serious:10,moderate:5,minor:2},o=e.details.reduce((r,i)=>r+(t[i.severity]||0),0);return Math.max(0,Math.min(100,100-o))}var Q={name:"yuktai-a11y",version:"4.0.0",observer:null,async execute(e){if(!e.enabled)return this.stopObserver(),"yuktai: disabled.";ye=e,An(e),Tn(),En(),hn(),xn(),e.showSkipLinks!==!1&&yn(),e.showPreferencePanel,Sn(e);let t=this.applyFixes(e);t.score=Qt(t),e.showAuditBadge&&wn(t),e.timeoutWarning&&to(e.timeoutWarning),e.autoFix&&this.startObserver(e),e.plainEnglish&&await Yt(!0),e.summarisePage&&await Kt(!0),e.translateLanguage&&e.translateLanguage!=="en"&&await Xt(e.translateLanguage),e.voiceControl&&await Zt(!0),e.smartLabels&&await Jt(!0);let o=`${t.fixed} fixes applied. Score: ${t.score}/100.`;return E(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(),r=document.querySelectorAll("*");t.scanned=r.length;let i=(a,n,s,c)=>{t.details.push({tag:a,fix:n,severity:s,element:c.outerHTML.slice(0,100)}),t.fixed++};return r.forEach(a=>{let n=a,s=n.tagName.toLowerCase();if(s==="html"&&!n.getAttribute("lang")&&(n.setAttribute("lang","en"),i(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")),i(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")),i(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"),i(s,'alt="" aria-hidden="true"',"serious",n))),s==="svg"&&(!n.getAttribute("aria-hidden")&&!n.getAttribute("aria-label")&&!a.querySelector("title")&&(n.setAttribute("aria-hidden","true"),i(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"),i(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),i(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"),i(s,"aria-label added (empty link)","critical",n)),p.target==="_blank"&&!p.rel?.includes("noopener")&&(p.rel="noopener noreferrer",t.fixed++)}if(Ut.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),i(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"),i(s,"scope added to <th>","moderate",n)),pt[s]&&!n.getAttribute("role")&&(n.setAttribute("role",pt[s]),i(s,`role="${pt[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"),i(s,`aria-live added on role=${c}`,"moderate",n)),c==="combobox"&&!n.getAttribute("aria-expanded")&&(n.setAttribute("aria-expanded","false"),i(s,'aria-expanded="false" on combobox',"serious",n)),(c==="checkbox"||c==="radio")&&!n.getAttribute("aria-checked")&&(n.setAttribute("aria-checked","false"),i(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 r=(i,a,n,s)=>e.details.push({tag:i,fix:a,severity:n,element:s.outerHTML.slice(0,100)});return o.forEach(i=>{let a=i,n=a.tagName.toLowerCase();(n==="a"||n==="button")&&!a.innerText?.trim()&&!a.getAttribute("aria-label")&&r(n,"needs aria-label (empty)","critical",a),n==="img"&&!a.hasAttribute("alt")&&r(n,"needs alt text","serious",a),Ut.has(n)&&!a.getAttribute("aria-label")&&!a.getAttribute("aria-labelledby")&&r(n,"needs aria-label","serious",a),n==="iframe"&&!a.getAttribute("title")&&!a.getAttribute("aria-label")&&r(n,"iframe needs title","serious",a)}),e.fixed=e.details.length,e.score=Qt(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:E,speak:ut,showVisualAlert:eo,trapFocus:Je,handlePlainEnglish:Yt,handleSummarisePage:Kt,handleTranslate:Xt,handleVoiceControl:Zt,handleSmartLabels:Jt,SUPPORTED_LANGUAGES:Ue};m();m();var k=qe(require("react"));m();var q=require("react");ft();Te();var l=require("react/jsx-runtime"),ht={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},xe=[80,90,100,110,120,130],Hn=[{value:"none",label:"None"},{value:"deuteranopia",label:"Deuteranopia"},{value:"protanopia",label:"Protanopia"},{value:"tritanopia",label:"Tritanopia"},{value:"achromatopsia",label:"Greyscale"}],Bn=["Prompt API for Gemini Nano","Summarization API for Gemini Nano","Writer API for Gemini Nano","Rewriter API for Gemini Nano","Translation API"];function Wn(){let[e,t]=(0,q.useState)(typeof window<"u"?window.innerWidth:1024);return(0,q.useEffect)(()=>{let o=()=>t(window.innerWidth);return window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[]),{isMobile:e<=480,isTablet:e>480&&e<=768}}function On({checked:e,onChange:t,label:o,disabled:r=!1}){return(0,l.jsxs)("label",{"aria-label":o,style:{position:"relative",display:"inline-flex",width:"40px",height:"24px",cursor:r?"not-allowed":"pointer",flexShrink:0,opacity:r?.4:1},children:[(0,l.jsx)("input",{type:"checkbox",checked:e,disabled:r,onChange:i=>t(i.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 ve({label:e,color:t="#64748b",badge:o,concept:r}){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})]}),r&&(0,l.jsx)("p",{style:{margin:"2px 0 0",fontSize:"9px",color:"#94a3b8",fontStyle:"italic"},children:r})]})}function re({icon:e,label:t,desc:o,checked:r,onChange:i,disabled:a=!1,disabledReason:n,tip:s}){return(0,l.jsxs)("div",{title:a?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:a?"#f1f5f9":"#f0fdfa",color:a?"#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:a?"#94a3b8":"#0f172a",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t}),(0,l.jsx)("p",{style:{margin:0,fontSize:"10px",color:"#94a3b8"},children:a?n:o})]})]}),(0,l.jsx)(On,{checked:r,onChange:i,label:`Toggle ${t}`,disabled:a})]})}function D(){return(0,l.jsx)("div",{style:{height:"1px",background:"#f1f5f9"}})}function Ee({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 xt=(0,q.forwardRef)(({position:e,settings:t,report:o,isActive:r,aiSupported:i,voiceSupported:a,set:n,onApply:s,onReset:c,onClose:p},h)=>{let{isMobile:y,isTablet:j}=Wn(),[$,V]=(0,q.useState)([]),[R,w]=(0,q.useState)(""),[N,P]=(0,q.useState)(""),[I,B]=(0,q.useState)(!1),[S,F]=(0,q.useState)(null),[C,W]=(0,q.useState)("idle");(0,q.useEffect)(()=>{let d=window;!!(d.LanguageModel||d.ai?.languageModel)&&i?F("gemini"):Se()&&F("transformers")},[i]),(0,q.useEffect)(()=>{if(S!=="transformers")return;let d=setInterval(()=>{W(Ae())},500);return()=>clearInterval(d)},[S]);let L=async()=>{if(!(!R.trim()||I)){if(!S){P("\u26A0\uFE0F No AI engine available on this device.");return}B(!0),P("");try{let d;S==="gemini"?d=await mt(R):(W("loading"),d=await bt(R),W("ready")),P(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{P("\u26A0\uFE0F Failed to get answer. Please try again.")}B(!1)}};(0,q.useEffect)(()=>{(async()=>{try{let J=window;if(!J.queryLocalFonts)return;let U=await J.queryLocalFonts(),Y=[...new Set(U.map(se=>se.family))].sort();V(Y.slice(0,50))}catch{}})()},[]);let A=S==="gemini"?"Gemini Nano":S==="transformers"?"Transformers.js \xB7 All devices":"Detecting...",ie=S==="transformers"&&C==="loading"?"Loading AI model... (first time only)":"...",ne=y?{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:j?"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:ne,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"}),r&&(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:y?"44px":"auto",minHeight:y?"44px":"auto",display:"flex",alignItems:"center",justifyContent:"center"},children:"\xD7"})]}),(0,l.jsx)(ve,{label:"\u267F Core Accessibility",concept:"Rule-based engine \u2014 works on all browsers and devices"}),(0,l.jsx)(Ee,{steps:["Toggle any feature on","Click Apply settings","Preferences saved automatically"]}),(0,l.jsx)(re,{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)(D,{}),(0,l.jsx)(re,{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)(D,{}),(0,l.jsx)(re,{icon:"\u{1F399}\uFE0F",label:"Voice control",desc:"Say commands to navigate the page",checked:t.voiceControl,onChange:d=>n("voiceControl",d),disabled:!a,disabledReason:"Not supported in this browser",tip:'Say "scroll down", "go to main", "click"'}),(0,l.jsx)(D,{}),(0,l.jsx)(ve,{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: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,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:Bn.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)(re,{icon:"\u{1F4DD}",label:"Plain English mode",desc:"Rewrites complex text in simple language",checked:t.plainEnglish,onChange:d=>n("plainEnglish",d),disabled:!i,disabledReason:"Enable Gemini Nano \u2014 see setup above",tip:"AI concept: LLM text rewriting"}),(0,l.jsx)(D,{}),(0,l.jsx)(re,{icon:"\u{1F4CB}",label:"Summarise page",desc:"3-sentence summary appears at top",checked:t.summarisePage,onChange:d=>n("summarisePage",d),disabled:!i,disabledReason:"Enable Gemini Nano \u2014 see setup above",tip:"AI concept: Abstractive summarisation"}),(0,l.jsx)(D,{}),(0,l.jsx)(re,{icon:"\u{1F3F7}\uFE0F",label:"Smart aria-labels",desc:"AI generates meaningful labels for elements",checked:t.smartLabels,onChange:d=>n("smartLabels",d),disabled:!i,disabledReason:"Enable Gemini Nano \u2014 see setup above",tip:"AI concept: Context-aware label generation"}),(0,l.jsx)(D,{}),(0,l.jsx)(ve,{label:"\u{1F441}\uFE0F Visual",concept:"CSS filter-based \u2014 works on all browsers and devices"}),(0,l.jsx)(Ee,{steps:["Toggle any visual mode","Changes apply instantly","Works on mobile and desktop"]}),(0,l.jsx)(re,{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)(D,{}),(0,l.jsx)(re,{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)(D,{}),(0,l.jsx)(re,{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)(D,{}),(0,l.jsx)(re,{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)(D,{}),(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:Hn.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:y?"36px":"auto"},children:d.label},d.value))})]}),(0,l.jsx)(D,{}),(0,l.jsx)(ve,{label:"\u{1F524} Font",concept:"Browser Font API + CSS \u2014 Chrome 103+"}),(0,l.jsx)(Ee,{steps:["Toggle dyslexia font or pick from device","Adjust size with + / \u2212","Saved across visits"]}),(0,l.jsx)(re,{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)(D,{}),(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+"}),$.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:y?"44px":"36px"},children:[(0,l.jsx)("option",{value:"",children:"System default"}),$.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)(D,{}),(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=xe.indexOf(t.fontScale);d>0&&n("fontScale",xe[d-1])},disabled:t.fontScale<=80,"aria-label":"Decrease text size",style:{width:y?"44px":"30px",height:y?"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:xe.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=xe.indexOf(t.fontScale);d<xe.length-1&&n("fontScale",xe[d+1])},disabled:t.fontScale>=130,"aria-label":"Increase text size",style:{width:y?"44px":"30px",height:y?"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)(D,{}),(0,l.jsx)(ve,{label:"\u{1F310} Translate",color:"#7c3aed",badge:"Gemini Nano",concept:"Chrome Translation API \u2014 on device, no internet after setup"}),(0,l.jsx)(Ee,{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:Ue.slice(0,y?8:18).map(d=>(0,l.jsx)("button",{onClick:()=>n("translateLanguage",d.code),"aria-pressed":t.translateLanguage===d.code,disabled:!i,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:i?"pointer":"not-allowed",opacity:i?1:.5,minHeight:y?"36px":"auto"},children:d.label},d.code))}),!i&&(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)(D,{}),(0,l.jsx)(ve,{label:"\u{1F4AC} Ask This Page",color:"#0d9488",badge:A,concept:"RAG \u2014 Retrieval Augmented Generation. Works on all devices including mobile."}),(0,l.jsx)(Ee,{steps:["Type any question about this page","Press Ask or hit Enter",S==="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:S==="gemini"?"#f0fdfa":S==="transformers"?"#f5f3ff":"#f8fafc",borderRadius:"8px",border:`0.5px solid ${S==="gemini"?"#99f6e4":S==="transformers"?"#c4b5fd":"#e2e8f0"}`,fontSize:"10px",color:S==="gemini"?"#0f766e":S==="transformers"?"#7c3aed":"#94a3b8"},children:[S==="gemini"&&"\u2705 Using Gemini Nano \u2014 on device, private, instant",S==="transformers"&&"\u2705 Using Transformers.js \u2014 works on mobile and all browsers",!S&&"\u23F3 Detecting AI engine...",S==="transformers"&&C==="loading"&&" \xB7 Loading model...",S==="transformers"&&C==="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:R,onChange:d=>w(d.target.value),onKeyDown:d=>{d.key==="Enter"&&L()},placeholder:"e.g. What does this page do?",disabled:I||!S,"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:S?"#fff":"#f8fafc",outline:"none",height:y?"44px":"36px"}}),(0,l.jsx)("button",{onClick:L,disabled:I||!R.trim()||!S,"aria-label":"Ask question",style:{padding:"8px 14px",borderRadius:"8px",border:"none",background:S&&R.trim()&&!I?"#0d9488":"#e2e8f0",color:S&&R.trim()&&!I?"#fff":"#94a3b8",fontSize:"12px",fontWeight:600,cursor:S&&R.trim()&&!I?"pointer":"not-allowed",flexShrink:0,height:y?"44px":"36px",minWidth:"52px",transition:"background 0.2s"},children:I?ie:"Ask"})]}),N&&(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"}),N,(0,l.jsx)("button",{onClick:()=>{P(""),w("")},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:y?"sticky":"relative",bottom:y?0:"auto",background:"#fff",borderTop:"1px solid #f1f5f9"},children:[(0,l.jsx)("button",{onClick:c,style:{flex:1,padding:y?"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:y?"12px 0":"8px 0",fontSize:"13px",fontWeight:600,borderRadius:"9px",border:"none",background:"#0d9488",color:"#fff",cursor:"pointer"},children:"Apply settings"})]})]})});xt.displayName="WidgetPanel";Te();m();var ae=require("react");m();var $n={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:[]},_n={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"]},Gn={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"]},Dn={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"]},qn={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"]},jn={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 Vn(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 r=e.match(o);if(r?.[1]){let i=r[1].trim();if(i.length>2&&i.length<40)return i}}return"My Business"}function Un(e){let t=e.toLowerCase(),o="generic",r=0;for(let[i,a]of Object.entries($n)){let n=0;for(let s of a)t.includes(s)&&n++;n>r&&(r=n,o=i)}return o}function Yn(e,t){let o=e.toLowerCase(),r=new Set(_n[t]);for(let[i,a]of Object.entries(Gn))for(let n of a)if(o.includes(n)){r.add(i);break}return r.add("home"),r.add("contact"),Array.from(r)}function Kn(e){let t=e.toLowerCase(),o=[];for(let[r,i]of Object.entries(Dn))for(let a of i)if(t.includes(a)){o.push(r);break}return o}function Xn(e,t){let o=e.toLowerCase();for(let[r,i]of Object.entries(qn))for(let a of i)if(o.includes(a))return r;return jn[t]}function so(e){let t=Un(e),o=Yn(e,t),r=Kn(e),i=Xn(e,t);return{siteName:Vn(e),websiteType:t,pages:o,features:r,theme:i,description:e.slice(0,200)}}var g=require("react/jsx-runtime"),er=["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"],tr={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}"},or={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 wt({position:e,onClose:t}){let[o,r]=(0,ae.useState)("input"),[i,a]=(0,ae.useState)(""),[n,s]=(0,ae.useState)(null),[c,p]=(0,ae.useState)(0),[h,y]=(0,ae.useState)(""),j=(0,ae.useCallback)(()=>{if(!i.trim())return;let w=so(i);s(w),r("preview")},[i]),$=(0,ae.useCallback)(async()=>{if(n){r("generating"),p(0),y("");try{let w=[{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 P of w)p(P.pct),await new Promise(I=>setTimeout(I,200));let{generateZip:N}=await Promise.resolve().then(()=>(Ho(),No));await N(n),p(100),r("done")}catch(w){y(w instanceof Error?w.message:"Generation failed. Please try again."),r("preview")}}},[n]),V=()=>{r("input"),a(""),s(null),p(0),y("")},R={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,g.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":"yuktai Vibe Coder","data-yuktai-panel":"true",style:R,children:[(0,g.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,g.jsxs)("div",{children:[(0,g.jsx)("p",{style:{margin:"0 0 2px",fontSize:"13px",fontWeight:700,color:"#0f172a"},children:"\u26A1 Vibe Coder"}),(0,g.jsx)("p",{style:{margin:0,fontSize:"10px",color:"#64748b"},children:"Describe your website \u2192 Download Next.js ZIP"})]}),(0,g.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,g.jsxs)("div",{style:{padding:"14px 16px"},children:[(0,g.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,g.jsx)("p",{style:{margin:"0 0 6px",fontSize:"10px",fontWeight:600,color:"#94a3b8",textTransform:"uppercase"},children:"Examples"}),(0,g.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:"4px",marginBottom:"12px"},children:er.slice(0,3).map(w=>(0,g.jsx)("button",{onClick:()=>a(w),style:{padding:"6px 10px",borderRadius:"8px",border:"1px solid #e2e8f0",background:"#f8fafc",color:"#475569",fontSize:"10px",cursor:"pointer",textAlign:"left",lineHeight:1.4},children:w},w))}),(0,g.jsx)("textarea",{value:i,onChange:w=>a(w.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,g.jsx)("button",{onClick:j,disabled:!i.trim(),style:{width:"100%",marginTop:"10px",padding:"10px",borderRadius:"8px",border:"none",background:i.trim()?"#f59e0b":"#e2e8f0",color:i.trim()?"#fff":"#94a3b8",fontSize:"13px",fontWeight:700,cursor:i.trim()?"pointer":"not-allowed",transition:"background 0.2s"},children:"Analyse Requirement \u2192"})]}),o==="preview"&&n&&(0,g.jsxs)("div",{style:{padding:"14px 16px"},children:[h&&(0,g.jsxs)("div",{style:{padding:"10px",background:"#fef2f2",border:"1px solid #fca5a5",borderRadius:"8px",marginBottom:"12px",fontSize:"11px",color:"#dc2626"},children:["\u26A0\uFE0F ",h]}),(0,g.jsxs)("div",{style:{background:"#f8fafc",borderRadius:"10px",padding:"12px",marginBottom:"12px"},children:[(0,g.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px"},children:[(0,g.jsx)("span",{style:{fontSize:"1.5rem"},children:or[n.websiteType]||"\u{1F310}"}),(0,g.jsxs)("div",{children:[(0,g.jsx)("p",{style:{margin:0,fontSize:"13px",fontWeight:700,color:"#0f172a"},children:n.siteName}),(0,g.jsxs)("p",{style:{margin:0,fontSize:"10px",color:"#64748b",textTransform:"capitalize"},children:[n.websiteType," website \xB7 ",n.theme," theme"]})]})]}),(0,g.jsxs)("p",{style:{margin:"8px 0 6px",fontSize:"10px",fontWeight:600,color:"#94a3b8",textTransform:"uppercase"},children:["Pages to generate (",n.pages.length,")"]}),(0,g.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px"},children:n.pages.map(w=>(0,g.jsxs)("span",{style:{padding:"2px 8px",borderRadius:"99px",background:"#f0fdf4",border:"1px solid #86efac",fontSize:"10px",color:"#166534",fontWeight:500},children:[tr[w]||"\u{1F4C4}"," ",w]},w))}),n.features.length>0&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("p",{style:{margin:"10px 0 6px",fontSize:"10px",fontWeight:600,color:"#94a3b8",textTransform:"uppercase"},children:"Detected features"}),(0,g.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px"},children:n.features.map(w=>(0,g.jsx)("span",{style:{padding:"2px 8px",borderRadius:"99px",background:"#f5f3ff",border:"1px solid #c4b5fd",fontSize:"10px",color:"#7c3aed",fontWeight:500},children:w},w))})]})]}),(0,g.jsxs)("div",{style:{margin:"0 0 12px",padding:"10px 12px",background:"#f0fdf4",borderRadius:"8px",border:"1px solid #86efac"},children:[(0,g.jsx)("p",{style:{margin:"0 0 4px",fontSize:"10px",fontWeight:700,color:"#166534"},children:"\u{1F4E6} What you get:"}),(0,g.jsxs)("p",{style:{margin:0,fontSize:"10px",color:"#166534",lineHeight:1.6},children:["\u2705 Complete Next.js 16 project",(0,g.jsx)("br",{}),"\u2705 Tailwind CSS + CSS Modules",(0,g.jsx)("br",{}),"\u2705 TypeScript configured",(0,g.jsx)("br",{}),"\u2705 Navbar + Footer components",(0,g.jsx)("br",{}),"\u2705 All ",n.pages.length," pages ready",(0,g.jsx)("br",{}),"\u2705 Mobile responsive",(0,g.jsx)("br",{}),"\u2705 npm run dev \u2192 works immediately"]})]}),(0,g.jsxs)("div",{style:{display:"flex",gap:"8px"},children:[(0,g.jsx)("button",{onClick:V,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,g.jsx)("button",{onClick:$,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,g.jsxs)("div",{style:{padding:"2rem 16px",textAlign:"center"},children:[(0,g.jsx)("p",{style:{fontSize:"2rem",marginBottom:"1rem"},children:"\u26A1"}),(0,g.jsx)("p",{style:{fontSize:"13px",fontWeight:700,color:"#0f172a",marginBottom:"0.5rem"},children:"Generating your project..."}),(0,g.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,g.jsx)("div",{style:{height:"8px",background:"#e2e8f0",borderRadius:"99px",overflow:"hidden"},children:(0,g.jsx)("div",{style:{height:"100%",width:`${c}%`,background:"#f59e0b",borderRadius:"99px",transition:"width 0.3s ease"}})}),(0,g.jsxs)("p",{style:{marginTop:"0.5rem",fontSize:"10px",color:"#94a3b8"},children:[c,"%"]})]}),o==="done"&&n&&(0,g.jsxs)("div",{style:{padding:"2rem 16px",textAlign:"center"},children:[(0,g.jsx)("p",{style:{fontSize:"3rem",marginBottom:"0.75rem"},children:"\u2705"}),(0,g.jsxs)("p",{style:{fontSize:"14px",fontWeight:700,color:"#0f172a",marginBottom:"0.5rem"},children:[n.siteName," downloaded!"]}),(0,g.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(w=>(0,g.jsx)("div",{style:{background:"#0f172a",borderRadius:"8px",padding:"8px 12px",marginBottom:"6px",textAlign:"left"},children:(0,g.jsxs)("code",{style:{fontSize:"12px",color:"#a7f3d0",fontFamily:"monospace"},children:["$ ",w]})},w)),(0,g.jsx)("p",{style:{fontSize:"11px",color:"#10b981",margin:"1rem 0",fontWeight:600},children:"Then open http://localhost:3000 \u{1F680}"}),(0,g.jsxs)("div",{style:{display:"flex",gap:"8px"},children:[(0,g.jsx)("button",{onClick:V,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,g.jsx)("button",{onClick:$,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 x=require("react/jsx-runtime");async function sr(){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 Qe({position:e="left",children:t,config:o={},showRag:r=!1,showAgent:i=!1}){let[a,n]=(0,k.useState)(!1),[s,c]=(0,k.useState)(ht),[p,h]=(0,k.useState)(null),[y,j]=(0,k.useState)(!1),[$,V]=(0,k.useState)(!1),[R,w]=(0,k.useState)(!1),N=k.default.useRef(null),[P,I]=(0,k.useState)(!1),[B,S]=(0,k.useState)(""),[F,C]=(0,k.useState)(""),[W,L]=(0,k.useState)(!1),[A,ie]=(0,k.useState)(null),[ne,d]=(0,k.useState)("idle"),[J,U]=(0,k.useState)(!1),[Y,se]=(0,k.useState)(""),[tt,v]=(0,k.useState)(""),[ee,ue]=(0,k.useState)(!1),[We,we]=(0,k.useState)([]),[f,z]=(0,k.useState)(null),O=24,te=84,K=r?144:84,X=204,[Oe,ot]=(0,k.useState)(!1);(0,k.useEffect)(()=>{if(typeof window>"u")return;let u=window;!!(u.LanguageModel||u.ai?.languageModel)&&$?(ie("gemini"),z("gemini")):Se()&&(ie("transformers"),z("transformers"))},[$]),(0,k.useEffect)(()=>{if(A!=="transformers")return;let u=setInterval(()=>d(Ae()),500);return()=>clearInterval(u)},[A]);let Et=(0,k.useCallback)(async()=>{if(!(!B.trim()||W)){if(!A){C("\u26A0\uFE0F No AI engine available.");return}L(!0),C("");try{let u;if(A==="gemini"){let{askPage:M}=await Promise.resolve().then(()=>(ft(),oo));u=await M(B)}else{d("loading");let{askPageWithTransformers:M}=await Promise.resolve().then(()=>(Te(),yt));u=await M(B),d("ready")}C(u.success&&u.answer?u.answer.replace(/\*\*(.*?)\*\*/g,"$1").replace(/\*(.*?)\*/g,"$1").replace(/#+\s/g,"").trim():"\u26A0\uFE0F "+(u.error||"No answer found."))}catch{C("\u26A0\uFE0F Something went wrong.")}L(!1)}},[B,W,A]),Ct=(0,k.useCallback)(async()=>{if(!Y.trim()||ee)return;if(!f){v("\u26A0\uFE0F No AI engine available.");return}ue(!0),we([]),v("");let{runAgent:u}=await Promise.resolve().then(()=>(Go(),_o));await u(Y,f,M=>{we(le=>[...le,M.text])}),ue(!1),v("done")},[Y,ee,f]);(0,k.useEffect)(()=>{if(typeof window>"u")return;let M=setTimeout(async()=>{let le=window,Xo=await sr();V(Xo),w(!!(le.SpeechRecognition||le.webkitSpeechRecognition))},800);return()=>clearTimeout(M)},[]),(0,k.useEffect)(()=>{if(!(typeof window>"u"))try{let u=localStorage.getItem("yuktai-a11y-prefs");u&&c(M=>({...M,...JSON.parse(u)}))}catch{}},[]);let Ft=(0,k.useCallback)(async u=>{let M={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 Q.execute(M),h(Q.applyFixes(M)),j(!0)},[o]),Vo=(0,k.useCallback)(async()=>{try{localStorage.setItem("yuktai-a11y-prefs",JSON.stringify(s))}catch{}await Ft(s),n(!1)},[s,Ft]),Uo=(0,k.useCallback)(()=>{c(ht);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(M=>u.removeAttribute(M)),document.body.style.filter="",document.body.style.fontFamily="",document.documentElement.style.fontSize="",h(null),j(!1)},[]),Yo=(0,k.useCallback)((u,M)=>{c(le=>({...le,[u]:M}))},[]);(0,k.useEffect)(()=>{let u=M=>{M.key==="Escape"&&(a&&n(!1),P&&I(!1),J&&U(!1),Oe&&ot(!1))};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[a,P,J]),(0,k.useEffect)(()=>{a&&N.current&&Q.trapFocus(N.current)},[a]);let $e=(u,M,le)=>({position:"fixed",bottom:`${u}px`,[e]:"24px",zIndex:9998,width:"52px",height:"52px",borderRadius:"50%",background:M,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"}),_e=u=>{u.currentTarget.style.transform="scale(1.08)"},Ge=u=>{u.currentTarget.style.transform="scale(1)"},Lt=A==="gemini"?"Gemini Nano \xB7 On device":A==="transformers"?"Transformers.js \xB7 All devices":"Detecting...",Ko=A==="transformers"&&ne==="loading"?"Loading model...":"...";return(0,x.jsxs)(x.Fragment,{children:[t,i&&(0,x.jsx)("button",{style:$e(204,Oe?"#d97706":"#f59e0b",Oe),"aria-label":"Open Vibe Coder",title:"\u26A1 Vibe Coder \u2014 Generate Next.js project",onClick:()=>{ot(u=>!u),U(!1),I(!1),n(!1)},onMouseEnter:_e,onMouseLeave:Ge,children:"\u26A1"}),i&&Oe&&(0,x.jsx)(wt,{position:e,onClose:()=>ot(!1)}),i&&(0,x.jsx)("button",{style:$e(K,J?"#059669":"#10b981",J),"aria-label":"Open AI agent","aria-haspopup":"dialog","aria-expanded":J,title:"\u{1F916} AI Agent \u2014 guide me through this page",onClick:()=>{U(u=>!u),I(!1),n(!1)},onMouseEnter:_e,onMouseLeave:Ge,children:"\u{1F916}"}),i&&J&&(0,x.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":"yuktai AI Agent","data-yuktai-panel":"true",style:{position:"fixed",bottom:`${K+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,x.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"10px"},children:[(0,x.jsxs)("div",{children:[(0,x.jsx)("p",{style:{margin:"0 0 2px",fontSize:"13px",fontWeight:600,color:"#0f172a"},children:"\u{1F916} AI Agent"}),(0,x.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,x.jsx)("button",{onClick:()=>U(!1),"aria-label":"Close agent panel",style:{background:"none",border:"none",cursor:"pointer",color:"#94a3b8",fontSize:"18px",lineHeight:1,padding:"2px"},children:"\xD7"})]}),(0,x.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,x.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,x.jsx)("button",{onClick:()=>se(u),style:{padding:"3px 8px",borderRadius:"20px",fontSize:"10px",border:"1px solid #e2e8f0",background:"#f8fafc",color:"#64748b",cursor:"pointer"},children:u},u))}),(0,x.jsxs)("div",{style:{display:"flex",gap:"6px",marginBottom:"8px"},children:[(0,x.jsx)("input",{type:"text",value:Y,onChange:u=>se(u.target.value),onKeyDown:u=>{u.key==="Enter"&&Ct()},placeholder:"e.g. Help me fill this form",disabled:ee||!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,x.jsx)("button",{onClick:Ct,disabled:ee||!Y.trim()||!f,"aria-label":"Run agent",style:{padding:"8px 12px",borderRadius:"8px",border:"none",background:f&&Y.trim()&&!ee?"#10b981":"#e2e8f0",color:f&&Y.trim()&&!ee?"#fff":"#94a3b8",fontSize:"12px",fontWeight:600,cursor:f&&Y.trim()&&!ee?"pointer":"not-allowed",height:"36px",minWidth:"52px",transition:"background 0.2s"},children:ee?"...":"Go"})]}),We.length>0&&(0,x.jsxs)("div",{style:{padding:"10px 12px",background:"#f0fdf4",border:"1px solid #86efac",borderRadius:"8px",fontSize:"11px",color:"#166534",lineHeight:1.7},children:[We.map((u,M)=>(0,x.jsx)("p",{style:{margin:"0 0 2px"},children:u},M)),tt==="done"&&(0,x.jsx)("button",{onClick:()=>{we([]),se(""),v("")},style:{display:"block",marginTop:"6px",background:"none",border:"none",color:"#94a3b8",fontSize:"10px",cursor:"pointer",padding:0},children:"Clear"})]}),!f&&(0,x.jsx)("p",{style:{margin:"4px 0 0",fontSize:"10px",color:"#94a3b8"},children:"Enable Gemini Nano via chrome://flags for best results."})]}),r&&(0,x.jsx)("button",{style:$e(te,P?"#7c3aed":"#6d28d9",P),"aria-label":"Ask a question about this page","aria-haspopup":"dialog","aria-expanded":P,title:`\u{1F4AC} Ask this page \xB7 ${Lt}`,onClick:()=>{I(u=>!u),n(!1),U(!1)},onMouseEnter:_e,onMouseLeave:Ge,children:"\u{1F4AC}"}),r&&P&&(0,x.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":"Ask this page","data-yuktai-panel":"true",style:{position:"fixed",bottom:`${te+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,x.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"10px"},children:[(0,x.jsxs)("div",{children:[(0,x.jsx)("p",{style:{margin:"0 0 2px",fontSize:"13px",fontWeight:600,color:"#0f172a"},children:"\u{1F4AC} Ask this page"}),(0,x.jsx)("p",{style:{margin:0,fontSize:"10px",color:"#7c3aed"},children:Lt}),A==="transformers"&&ne==="loading"&&(0,x.jsx)("p",{style:{margin:"2px 0 0",fontSize:"9px",color:"#94a3b8"},children:"Downloading model \u2014 first time only"}),A==="transformers"&&ne==="ready"&&(0,x.jsx)("p",{style:{margin:"2px 0 0",fontSize:"9px",color:"#10b981"},children:"Model ready \u2705 \u2014 works offline"})]}),(0,x.jsx)("button",{onClick:()=>I(!1),"aria-label":"Close ask panel",style:{background:"none",border:"none",cursor:"pointer",color:"#94a3b8",fontSize:"18px",lineHeight:1,padding:"2px"},children:"\xD7"})]}),(0,x.jsxs)("div",{style:{display:"flex",gap:"6px",marginBottom:"8px"},children:[(0,x.jsx)("input",{type:"text",value:B,onChange:u=>S(u.target.value),onKeyDown:u=>{u.key==="Enter"&&Et()},placeholder:"e.g. What does this page do?",disabled:W||!A,"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:A?"#fff":"#f8fafc",outline:"none",height:"36px"}}),(0,x.jsx)("button",{onClick:Et,disabled:W||!B.trim()||!A,"aria-label":"Submit question",style:{padding:"8px 12px",borderRadius:"8px",border:"none",background:A&&B.trim()&&!W?"#7c3aed":"#e2e8f0",color:A&&B.trim()&&!W?"#fff":"#94a3b8",fontSize:"12px",fontWeight:600,cursor:A&&B.trim()&&!W?"pointer":"not-allowed",height:"36px",minWidth:"48px",transition:"background 0.2s"},children:W?Ko:"Ask"})]}),F&&(0,x.jsxs)("div",{style:{padding:"10px",background:"#f5f3ff",borderRadius:"8px",fontSize:"12px",color:"#4c1d95",lineHeight:1.6,maxHeight:"180px",overflowY:"auto"},children:[(0,x.jsx)("strong",{style:{display:"block",marginBottom:"4px",fontSize:"11px",color:"#7c3aed"},children:"\u{1F4AC} Answer"}),F,(0,x.jsx)("button",{onClick:()=>{C(""),S("")},style:{display:"block",marginTop:"6px",background:"none",border:"none",color:"#94a3b8",fontSize:"10px",cursor:"pointer",padding:0},children:"Clear"})]}),!A&&(0,x.jsx)("p",{style:{margin:"4px 0 0",fontSize:"10px",color:"#94a3b8"},children:"Detecting AI engine..."})]}),(0,x.jsx)("button",{style:$e(O,y?"#0d9488":"#1a73e8",a),"aria-label":"Open accessibility preferences","aria-haspopup":"dialog","aria-expanded":a,"data-yuktai-pref-toggle":"true",title:"\u267F Accessibility settings",onClick:()=>{n(u=>!u),I(!1),U(!1)},onMouseEnter:_e,onMouseLeave:Ge,children:"\u267F"}),a&&(0,x.jsx)(xt,{ref:N,position:e,settings:s,report:p,isActive:y,aiSupported:$,voiceSupported:R,set:Yo,onApply:Vo,onReset:Uo,onClose:()=>n(!1)})]})}m();var Ce={name:"ai.text",async execute(e){return`\u{1F916} YuktAI says: ${e}`}};m();var Fe={name:"voice.text",async execute(e){return!e||e.trim()===""?"\u{1F3A4} No speech detected":`\u{1F3A4} You said: ${e}`}};m();var de=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 r=this.use(t);if(!r)throw new Error(`Plugin not found: ${t}`);return await r.execute(o)}catch(r){throw console.error(`[YuktAI Runtime Error in ${t}]:`,r),r}}getPlugins(){return Array.from(this.plugins.keys())}};m();var pe=qe(require("react"));m();var _=require("react");function lr(e){return e===!1?Number.MAX_SAFE_INTEGER:e===!0||e===void 0?10:e.pageSize??10}function et(e){let{data:t,columns:o,pagination:r=!0,mobileBreakpoint:i=768}=e,[a,n]=(0,_.useState)(null),[s,c]=(0,_.useState)(""),[p,h]=(0,_.useState)(1),[y,j]=(0,_.useState)(lr(r)),[$,V]=(0,_.useState)(!1);(0,_.useEffect)(()=>{if(typeof window>"u")return;let F=()=>{V(window.innerWidth<i)};return F(),window.addEventListener("resize",F),()=>window.removeEventListener("resize",F)},[i]);let R=(0,_.useCallback)(F=>{n(C=>!C||C.key!==F?{key:F,direction:"asc"}:C.direction==="asc"?{key:F,direction:"desc"}:null),h(1)},[]),w=(0,_.useCallback)(()=>n(null),[]),N=(0,_.useMemo)(()=>{if(!s.trim())return t;let F=s.toLowerCase().trim();return t.filter(C=>o.some(W=>{let L=C[W.key];return L==null?!1:String(L).toLowerCase().includes(F)}))},[t,s,o]),P=(0,_.useMemo)(()=>{if(!a)return N;let F=[...N].sort((C,W)=>{let L=C[a.key],A=W[a.key];if(L===A)return 0;if(L==null)return 1;if(A==null)return-1;if(typeof L=="number"&&typeof A=="number")return L-A;if(L instanceof Date&&A instanceof Date)return L.getTime()-A.getTime();let ie=String(L),ne=String(A);return ie.localeCompare(ne,void 0,{sensitivity:"base",numeric:!0})});return a.direction==="desc"?F.reverse():F},[N,a]),I=Math.max(1,Math.ceil(P.length/y)),B=(0,_.useMemo)(()=>{if(r===!1)return P;let F=(p-1)*y;return P.slice(F,F+y)},[P,p,y,r]),S=(0,_.useCallback)(()=>{n(null),c(""),h(1)},[]);return(0,_.useEffect)(()=>{p>I&&h(I)},[p,I]),{displayedData:B,totalCount:t.length,filteredCount:P.length,sort:a,toggleSort:R,clearSort:w,searchQuery:s,setSearchQuery:c,page:p,pageSize:y,totalPages:I,setPage:h,setPageSize:j,isMobile:$,reset:S}}m();m();var Do=require("react/jsx-runtime");function G({size:e=20,color:t="currentColor",strokeWidth:o=2.5,label:r,children:i,...a}){return(0,Do.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!r?"true":void 0,"aria-label":r,role:r?"img":void 0,focusable:"false",...a,children:i})}var Le=require("react/jsx-runtime");function Me(e){return(0,Le.jsxs)(G,{...e,children:[(0,Le.jsx)("circle",{cx:"11",cy:"11",r:"7"}),(0,Le.jsx)("path",{d:"m20 20-4-4"})]})}m();var Re=require("react/jsx-runtime");function Pe(e){return(0,Re.jsxs)(G,{...e,children:[(0,Re.jsx)("path",{d:"M12 19V5"}),(0,Re.jsx)("path",{d:"m5 12 7-7 7 7"})]})}m();var Ie=require("react/jsx-runtime");function ze(e){return(0,Ie.jsxs)(G,{...e,children:[(0,Ie.jsx)("path",{d:"M12 5v14"}),(0,Ie.jsx)("path",{d:"m5 12 7 7 7-7"})]})}m();var kt=require("react/jsx-runtime");function Ne(e){return(0,kt.jsx)(G,{...e,children:(0,kt.jsx)("path",{d:"m15 18-6-6 6-6"})})}m();var St=require("react/jsx-runtime");function He(e){return(0,St.jsx)(G,{...e,children:(0,St.jsx)("path",{d:"m9 18 6-6-6-6"})})}m();var Be=require("react/jsx-runtime");function me(e){return(0,Be.jsxs)(G,{...e,children:[(0,Be.jsx)("path",{d:"M18 6 6 18"}),(0,Be.jsx)("path",{d:"m6 6 12 12"})]})}var b=require("react/jsx-runtime"),cr={default:{container:{background:"#FFFFFF",color:"#0F172A",fontFamily:"system-ui, -apple-system, sans-serif"},header:{background:"#F8FAFC",color:"#475569",borderBottom:"1px solid #E2E8F0"},row:{borderBottom:"1px solid #F1F5F9"},rowHover:{background:"#F8FAFC"},cell:{color:"#0F172A"},button:{background:"#FFFFFF",color:"#0F172A"},pageBtn:{background:"#FFFFFF",color:"#475569",border:"1px solid #E2E8F0"},pageBtnActive:{background:"#0D9488",color:"#FFFFFF",border:"1px solid #0D9488"},border:"#E2E8F0",accent:"#0D9488",muted:"#94A3B8"},"high-contrast":{container:{background:"#000000",color:"#FFFFFF",fontFamily:"system-ui, sans-serif",fontWeight:600},header:{background:"#000000",color:"#FFFF00",borderBottom:"2px solid #FFFFFF",fontWeight:700},row:{borderBottom:"1px solid #FFFFFF"},rowHover:{background:"#1A1A1A"},cell:{color:"#FFFFFF"},button:{background:"#000000",color:"#FFFFFF"},pageBtn:{background:"#000000",color:"#FFFFFF",border:"2px solid #FFFFFF"},pageBtnActive:{background:"#FFFF00",color:"#000000",border:"2px solid #FFFF00"},border:"#FFFFFF",accent:"#FFFF00",muted:"#CCCCCC"},dark:{container:{background:"#0F172A",color:"#F1F5F9",fontFamily:"system-ui, sans-serif"},header:{background:"#1E293B",color:"#94A3B8",borderBottom:"1px solid #334155"},row:{borderBottom:"1px solid #1E293B"},rowHover:{background:"#1E293B"},cell:{color:"#F1F5F9"},button:{background:"#1E293B",color:"#F1F5F9"},pageBtn:{background:"#1E293B",color:"#94A3B8",border:"1px solid #334155"},pageBtnActive:{background:"#14B8A6",color:"#0F172A",border:"1px solid #14B8A6"},border:"#334155",accent:"#14B8A6",muted:"#64748B"},"color-blind":{container:{background:"#FFFFFF",color:"#0F172A",fontFamily:"system-ui, sans-serif"},header:{background:"#F8FAFC",color:"#475569",borderBottom:"1px solid #E2E8F0"},row:{borderBottom:"1px solid #F1F5F9"},rowHover:{background:"#F8FAFC"},cell:{color:"#0F172A"},button:{background:"#FFFFFF",color:"#0F172A"},pageBtn:{background:"#FFFFFF",color:"#475569",border:"1px solid #E2E8F0"},pageBtnActive:{background:"#1F2937",color:"#FFFFFF",border:"1px solid #1F2937"},border:"#E2E8F0",accent:"#1F2937",muted:"#94A3B8"},dyslexia:{container:{background:"#FDF6E3",color:"#3D3424",fontFamily:"'Atkinson Hyperlegible', system-ui, sans-serif",letterSpacing:"0.3px",lineHeight:1.7},header:{background:"#FAF0D7",color:"#5C4F37",borderBottom:"1px solid #D7CFB8",letterSpacing:"0.5px"},row:{borderBottom:"1px solid #ECE0C2"},rowHover:{background:"#FAF0D7"},cell:{color:"#3D3424"},button:{background:"#FDF6E3",color:"#3D3424"},pageBtn:{background:"#FDF6E3",color:"#5C4F37",border:"1px solid #D7CFB8"},pageBtnActive:{background:"#92400E",color:"#FDF6E3",border:"1px solid #92400E"},border:"#D7CFB8",accent:"#92400E",muted:"#8B7960"}},Z={search:"Search...",clearSearch:"Clear search",noData:"No data to display",noResults:"No matching results",tryAgain:"Try a different search term",loading:"Loading...",rowsSelected:"rows selected",page:"Page",of:"of",showing:"Showing",to:"to",results:"results",first:"First page",last:"Last page",prev:"Previous page",next:"Next page"};function dr(e,t){return t<=7?Array.from({length:t},(o,r)=>r+1):e<=4?[1,2,3,4,5,"...",t]:e>=t-3?[1,"...",t-4,t-3,t-2,t-1,t]:[1,"...",e-1,e,e+1,"...",t]}function qo(e){let{data:t,columns:o,view:r="auto",mobileBreakpoint:i=768,theme:a="default",pagination:n=!0,search:s=!0,selectable:c=!1,selectedKeys:p=[],rowKey:h,loading:y=!1,empty:j,highlightIds:$=[],highlightColor:V="#FEF3C7",autoScrollToHighlight:R=!0,onSelectionChange:w,onRowClick:N,onSortChange:P,className:I}=e,[B,S]=(0,pe.useState)(p),F=pe.default.useMemo(()=>new Set($.map(String)),[$]),{displayedData:C,filteredCount:W,sort:L,toggleSort:A,searchQuery:ie,setSearchQuery:ne,page:d,pageSize:J,totalPages:U,setPage:Y,isMobile:se}=et({data:t,columns:o,pagination:n,mobileBreakpoint:i}),tt=r==="card"||r==="auto"&&se,v=cr[a],ee=o.filter(f=>!(se&&f.hiddenOnMobile)),ue=(0,pe.useCallback)((f,z)=>h&&f[h]!==void 0?String(f[h]):f.id!==void 0?String(f.id):String(z),[h]),We=(0,pe.useCallback)(f=>{A(f),P?.(L)},[A,P,L]),we=(0,pe.useCallback)(f=>{S(z=>{let O=z.includes(f)?z.filter(te=>te!==f):[...z,f];return w?.(O),O})},[w]);return y?(0,b.jsxs)("div",{role:"status","aria-live":"polite",style:{...v.container,padding:"3rem 2rem",textAlign:"center",borderRadius:8,border:`1px solid ${v.border}`},children:[(0,b.jsx)("div",{style:{display:"inline-block",width:32,height:32,border:`3px solid ${v.border}`,borderTopColor:v.accent,borderRadius:"50%",animation:"yuktai-spin 0.8s linear infinite",marginBottom:12}}),(0,b.jsx)("style",{children:"@keyframes yuktai-spin { to { transform: rotate(360deg); } }"}),(0,b.jsx)("div",{children:Z.loading})]}):t.length===0?(0,b.jsx)("div",{role:"status",style:{...v.container,padding:"3rem 2rem",textAlign:"center",borderRadius:8,border:`1px solid ${v.border}`},children:j??(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(me,{size:40,color:v.muted}),(0,b.jsx)("div",{style:{marginTop:8,fontSize:16,fontWeight:500},children:Z.noData})]})}):(0,b.jsxs)("div",{className:I,style:{...v.container,borderRadius:8,border:`1px solid ${v.border}`,overflow:"hidden"},"data-yuktai-grid":!0,"data-theme":a,children:[s&&(0,b.jsxs)("div",{style:{...v.header,padding:"12px 16px",display:"flex",gap:12,alignItems:"center"},children:[(0,b.jsxs)("div",{style:{flex:1,position:"relative",display:"flex",alignItems:"center"},children:[(0,b.jsx)("div",{style:{position:"absolute",left:12,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"none",color:v.muted},children:(0,b.jsx)(Me,{size:18})}),(0,b.jsx)("input",{type:"search",value:ie,onChange:f=>ne(f.target.value),placeholder:Z.search,"aria-label":Z.search,style:{flex:1,width:"100%",padding:"10px 12px 10px 40px",fontSize:14,border:`1px solid ${v.border}`,borderRadius:8,background:"transparent",color:"inherit",minHeight:44,outline:"none",transition:"border-color 0.15s"},onFocus:f=>f.currentTarget.style.borderColor=v.accent,onBlur:f=>f.currentTarget.style.borderColor=v.border}),ie&&(0,b.jsx)("button",{onClick:()=>ne(""),"aria-label":Z.clearSearch,style:{position:"absolute",right:8,background:"transparent",border:"none",cursor:"pointer",padding:4,display:"flex",alignItems:"center",color:v.muted,borderRadius:4},children:(0,b.jsx)(me,{size:16})})]}),c&&B.length>0&&(0,b.jsxs)("span",{style:{fontSize:13,color:"inherit",whiteSpace:"nowrap"},children:[B.length," ",Z.rowsSelected]})]}),C.length===0&&ie?(0,b.jsxs)("div",{style:{padding:"3rem 2rem",textAlign:"center",background:"transparent"},children:[(0,b.jsx)(me,{size:40,color:v.muted}),(0,b.jsx)("div",{style:{marginTop:8,fontSize:16,fontWeight:500},children:Z.noResults}),(0,b.jsx)("div",{style:{marginTop:4,fontSize:13,color:v.muted},children:Z.tryAgain}),(0,b.jsx)("button",{onClick:()=>ne(""),style:{marginTop:16,padding:"8px 16px",background:v.accent,color:"#FFFFFF",border:"none",borderRadius:6,cursor:"pointer",fontSize:13,fontWeight:500},children:Z.clearSearch})]}):tt?(0,b.jsx)("div",{role:"list",style:{padding:8},children:C.map((f,z)=>{let O=ue(f,z),te=F.has(O);return(0,b.jsx)("div",{role:"listitem","data-highlighted":te||void 0,onClick:()=>N?.(f,z),style:{padding:12,marginBottom:8,border:te?`2px solid ${v.accent}`:`1px solid ${v.border}`,borderRadius:8,background:te?V:"transparent",cursor:N?"pointer":"default",minHeight:44,transition:"background 0.3s ease, border-color 0.3s ease"},tabIndex:0,children:ee.map(K=>(0,b.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",padding:"4px 0",fontSize:13},children:[(0,b.jsxs)("span",{style:{fontWeight:500,opacity:.7},children:[K.label,":"]}),(0,b.jsx)("span",{style:v.cell,children:K.render?K.render(f[K.key],f,z):String(f[K.key]??"")})]},K.key))},O)})}):(0,b.jsx)("div",{style:{overflowX:"auto"},children:(0,b.jsxs)("table",{role:"grid",style:{width:"100%",borderCollapse:"collapse",fontSize:14},children:[(0,b.jsx)("thead",{children:(0,b.jsxs)("tr",{role:"row",children:[c&&(0,b.jsx)("th",{style:{...v.header,padding:"10px 14px",width:44},children:(0,b.jsx)("input",{type:"checkbox","aria-label":"Select all",checked:B.length===C.length&&C.length>0,onChange:f=>{f.target.checked?S(C.map((z,O)=>ue(z,O))):S([])},style:{minWidth:20,minHeight:20,cursor:"pointer"}})}),ee.map(f=>(0,b.jsx)("th",{role:"columnheader","aria-sort":L?.key===f.key?L.direction==="asc"?"ascending":"descending":"none",onClick:()=>f.sortable!==!1&&We(f.key),style:{...v.header,padding:"10px 14px",textAlign:f.align??"left",cursor:f.sortable!==!1?"pointer":"default",userSelect:"none",width:f.width,fontWeight:500,fontSize:12,textTransform:"uppercase",letterSpacing:"0.5px"},children:(0,b.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[f.label,L?.key===f.key&&(L.direction==="asc"?(0,b.jsx)(Pe,{size:14}):(0,b.jsx)(ze,{size:14}))]})},f.key))]})}),(0,b.jsx)("tbody",{children:C.map((f,z)=>{let O=ue(f,z),te=B.includes(O),K=F.has(O);return(0,b.jsxs)("tr",{role:"row","aria-selected":te,"data-highlighted":K||void 0,ref:K&&R&&z===C.findIndex(X=>F.has(ue(X,C.indexOf(X))))?X=>X?.scrollIntoView({behavior:"smooth",block:"center"}):void 0,onClick:()=>N?.(f,z),style:{...v.row,cursor:N?"pointer":"default",background:K?V:te?v.rowHover.background:"transparent",transition:"background 0.3s ease",boxShadow:K?`inset 3px 0 0 ${v.accent}`:void 0},children:[c&&(0,b.jsx)("td",{style:{padding:"10px 14px"},children:(0,b.jsx)("input",{type:"checkbox","aria-label":`Select row ${z+1}`,checked:te,onChange:()=>we(O),onClick:X=>X.stopPropagation(),style:{minWidth:20,minHeight:20,cursor:"pointer"}})}),ee.map(X=>(0,b.jsx)("td",{role:"gridcell",style:{...v.cell,padding:"12px 14px",textAlign:X.align??"left"},children:X.render?X.render(f[X.key],f,z):String(f[X.key]??"")},X.key))]},O)})})]})}),n!==!1&&U>1&&C.length>0&&(0,b.jsxs)("div",{style:{...v.header,padding:"12px 16px",display:"flex",justifyContent:"space-between",alignItems:"center",borderTop:`1px solid ${v.border}`,borderBottom:"none",fontSize:13,flexWrap:"wrap",gap:12},children:[(0,b.jsxs)("span",{style:{color:v.muted},children:[Z.showing," ",(0,b.jsxs)("strong",{style:{color:"inherit"},children:[(d-1)*J+1,"\u2013",Math.min(d*J,W)]})," ",Z.of," ",(0,b.jsx)("strong",{style:{color:"inherit"},children:W})]}),(0,b.jsxs)("div",{style:{display:"flex",gap:4,alignItems:"center",flexWrap:"wrap"},children:[(0,b.jsx)("button",{onClick:()=>Y(d-1),disabled:d===1,"aria-label":Z.prev,style:{...v.pageBtn,padding:"8px 12px",borderRadius:6,cursor:d===1?"not-allowed":"pointer",opacity:d===1?.4:1,minHeight:36,display:"inline-flex",alignItems:"center",justifyContent:"center",transition:"all 0.15s"},children:(0,b.jsx)(Ne,{size:16})}),dr(d,U).map((f,z)=>{if(f==="...")return(0,b.jsx)("span",{style:{padding:"0 4px",color:v.muted,minWidth:24,textAlign:"center"},children:"\u2026"},`ellipsis-${z}`);let O=f===d;return(0,b.jsx)("button",{onClick:()=>Y(f),"aria-label":`${Z.page} ${f}`,"aria-current":O?"page":void 0,style:{...O?v.pageBtnActive:v.pageBtn,minWidth:36,minHeight:36,padding:"8px 10px",borderRadius:6,cursor:"pointer",fontWeight:O?600:500,fontSize:13,transition:"all 0.15s"},children:f},f)}),(0,b.jsx)("button",{onClick:()=>Y(d+1),disabled:d===U,"aria-label":Z.next,style:{...v.pageBtn,padding:"8px 12px",borderRadius:6,cursor:d===U?"not-allowed":"pointer",opacity:d===U?.4:1,minHeight:36,display:"inline-flex",alignItems:"center",justifyContent:"center",transition:"all 0.15s"},children:(0,b.jsx)(He,{size:16})})]})]})]})}m();m();var At=require("react/jsx-runtime");function Tt(e){return(0,At.jsx)(G,{...e,children:(0,At.jsx)("path",{d:"M5 12.5 10 17.5 19.5 7"})})}function pr(){if(typeof globalThis>"u")return new de;if(!globalThis.__yuktai_runtime__){let e=new de;e.register(Q.name,Q),e.register(Ce.name,Ce),e.register(Fe.name,Fe),globalThis.__yuktai_runtime__=e}return globalThis.__yuktai_runtime__}var jo=typeof window<"u"?pr():new de,ur={wcagPlugin:Q,list(){return jo.getPlugins()},use(e){return jo.use(e)},fix(e){return Q.applyFixes({enabled:!0,autoFix:!0,...e})},scan(){return Q.scan()}};
1521
+ `,document.body.appendChild(e),Jt=e}function ao(e){let t={critical:20,serious:10,moderate:5,minor:2},o=e.details.reduce((r,i)=>r+(t[i.severity]||0),0);return Math.max(0,Math.min(100,100-o))}var U={name:"yuktai-a11y",version:"4.0.0",observer:null,async execute(e){if(!e.enabled)return this.stopObserver(),"yuktai: disabled.";ce=e,Gn(e),Hn(),On(),Mn(),Pn(),e.showSkipLinks!==!1&&In(),e.showPreferencePanel,$n(e);let t=this.applyFixes(e);t.score=ao(t),e.showAuditBadge&&zn(t),e.timeoutWarning&&lo(e.timeoutWarning),e.autoFix&&this.startObserver(e),e.plainEnglish&&await to(!0),e.summarisePage&&await oo(!0),e.translateLanguage&&e.translateLanguage!=="en"&&await no(e.translateLanguage),e.voiceControl&&await ro(!0),e.smartLabels&&await io(!0);let o=`${t.fixed} fixes applied. Score: ${t.score}/100.`;return R(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(),r=document.querySelectorAll("*");t.scanned=r.length;let i=(s,n,a,l)=>{t.details.push({tag:s,fix:n,severity:a,element:l.outerHTML.slice(0,100)}),t.fixed++};return r.forEach(s=>{let n=s,a=n.tagName.toLowerCase();if(a==="html"&&!n.getAttribute("lang")&&(n.setAttribute("lang","en"),i(a,'lang="en" added',"critical",n)),a==="meta"){let c=n.getAttribute("name"),p=n.getAttribute("content")||"";c==="viewport"&&p.includes("user-scalable=no")&&(n.setAttribute("content",p.replace("user-scalable=no","user-scalable=yes")),i(a,"user-scalable=yes restored","serious",n)),c==="viewport"&&/maximum-scale=1(?:[^0-9]|$)/.test(p)&&(n.setAttribute("content",p.replace(/maximum-scale=1(?=[^0-9]|$)/,"maximum-scale=5")),i(a,"maximum-scale=5 restored","serious",n))}if(a==="main"&&!n.getAttribute("tabindex")&&(n.setAttribute("tabindex","-1"),n.getAttribute("id")||n.setAttribute("id","main-content")),a==="img"&&(n.hasAttribute("alt")||(n.setAttribute("alt",""),n.setAttribute("aria-hidden","true"),i(a,'alt="" aria-hidden="true"',"serious",n))),a==="svg"&&(!n.getAttribute("aria-hidden")&&!n.getAttribute("aria-label")&&!s.querySelector("title")&&(n.setAttribute("aria-hidden","true"),i(a,'aria-hidden="true" (decorative svg)',"minor",n)),n.getAttribute("focusable")||n.setAttribute("focusable","false")),a==="iframe"&&!n.getAttribute("title")&&!n.getAttribute("aria-label")&&(n.setAttribute("title","embedded content"),n.setAttribute("aria-label","embedded content"),i(a,"title + aria-label added","serious",n)),a==="button"){if(!n.innerText?.trim()&&!n.getAttribute("aria-label")){let c=n.getAttribute("title")||"button";n.setAttribute("aria-label",c),i(a,`aria-label="${c}" (empty button)`,"critical",n)}n.hasAttribute("disabled")&&!n.getAttribute("aria-disabled")&&(n.setAttribute("aria-disabled","true"),t.fixed++)}if(a==="a"){let c=n;!n.innerText?.trim()&&!n.getAttribute("aria-label")&&(n.setAttribute("aria-label",n.getAttribute("title")||"link"),i(a,"aria-label added (empty link)","critical",n)),c.target==="_blank"&&!c.rel?.includes("noopener")&&(c.rel="noopener noreferrer",t.fixed++)}if(eo.has(a)){let c=n;if(!n.getAttribute("aria-label")&&!n.getAttribute("aria-labelledby")){let p=n.getAttribute("placeholder")||n.getAttribute("name")||a;n.setAttribute("aria-label",p),i(a,`aria-label="${p}"`,"serious",n)}if(n.hasAttribute("required")&&!n.getAttribute("aria-required")&&(n.setAttribute("aria-required","true"),t.fixed++),a==="input"&&!c.autocomplete){let p=c.name||"";c.type==="email"||p.includes("email")?c.autocomplete="email":c.type==="tel"||p.includes("tel")?c.autocomplete="tel":c.type==="password"&&(c.autocomplete="current-password"),t.fixed++}}a==="th"&&!n.getAttribute("scope")&&(n.setAttribute("scope",n.closest("thead")?"col":"row"),i(a,"scope added to <th>","moderate",n)),it[a]&&!n.getAttribute("role")&&(n.setAttribute("role",it[a]),i(a,`role="${it[a]}"`,"minor",n));let l=n.getAttribute("role")||"";l==="tab"&&!n.getAttribute("aria-selected")&&(n.setAttribute("aria-selected","false"),t.fixed++),["alert","status","log"].includes(l)&&!n.getAttribute("aria-live")&&(n.setAttribute("aria-live",l==="alert"?"assertive":"polite"),i(a,`aria-live added on role=${l}`,"moderate",n)),l==="combobox"&&!n.getAttribute("aria-expanded")&&(n.setAttribute("aria-expanded","false"),i(a,'aria-expanded="false" on combobox',"serious",n)),(l==="checkbox"||l==="radio")&&!n.getAttribute("aria-checked")&&(n.setAttribute("aria-checked","false"),i(a,`aria-checked="false" on role=${l}`,"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 r=(i,s,n,a)=>e.details.push({tag:i,fix:s,severity:n,element:a.outerHTML.slice(0,100)});return o.forEach(i=>{let s=i,n=s.tagName.toLowerCase();(n==="a"||n==="button")&&!s.innerText?.trim()&&!s.getAttribute("aria-label")&&r(n,"needs aria-label (empty)","critical",s),n==="img"&&!s.hasAttribute("alt")&&r(n,"needs alt text","serious",s),eo.has(n)&&!s.getAttribute("aria-label")&&!s.getAttribute("aria-labelledby")&&r(n,"needs aria-label","serious",s),n==="iframe"&&!s.getAttribute("title")&&!s.getAttribute("aria-label")&&r(n,"iframe needs title","serious",s)}),e.fixed=e.details.length,e.score=ao(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:R,speak:at,showVisualAlert:so,trapFocus:He,handlePlainEnglish:to,handleSummarisePage:oo,handleTranslate:no,handleVoiceControl:ro,handleSmartLabels:io,SUPPORTED_LANGUAGES:Ne};m();m();var T=Xe(require("react"));m();var V=require("react");lt();ye();var d=require("react/jsx-runtime"),pt={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},ue=[80,90,100,110,120,130],Kn=[{value:"none",label:"None"},{value:"deuteranopia",label:"Deuteranopia"},{value:"protanopia",label:"Protanopia"},{value:"tritanopia",label:"Tritanopia"},{value:"achromatopsia",label:"Greyscale"}],Xn=["Prompt API for Gemini Nano","Summarization API for Gemini Nano","Writer API for Gemini Nano","Rewriter API for Gemini Nano","Translation API"];function Zn(){let[e,t]=(0,V.useState)(typeof window<"u"?window.innerWidth:1024);return(0,V.useEffect)(()=>{let o=()=>t(window.innerWidth);return window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[]),{isMobile:e<=480,isTablet:e>480&&e<=768}}function Jn({checked:e,onChange:t,label:o,disabled:r=!1}){return(0,d.jsxs)("label",{"aria-label":o,style:{position:"relative",display:"inline-flex",width:"40px",height:"24px",cursor:r?"not-allowed":"pointer",flexShrink:0,opacity:r?.4:1},children:[(0,d.jsx)("input",{type:"checkbox",checked:e,disabled:r,onChange:i=>t(i.target.checked),style:{opacity:0,width:0,height:0,position:"absolute"}}),(0,d.jsx)("span",{style:{position:"absolute",inset:0,borderRadius:"99px",background:e?"#0d9488":"#cbd5e1",transition:"background 0.2s"}}),(0,d.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 pe({label:e,color:t="#64748b",badge:o,concept:r}){return(0,d.jsxs)("div",{style:{margin:"10px 18px 4px"},children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,d.jsx)("p",{style:{margin:0,fontSize:"10px",fontWeight:600,color:t,letterSpacing:"0.06em",textTransform:"uppercase"},children:e}),o&&(0,d.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})]}),r&&(0,d.jsx)("p",{style:{margin:"2px 0 0",fontSize:"9px",color:"#94a3b8",fontStyle:"italic"},children:r})]})}function Z({icon:e,label:t,desc:o,checked:r,onChange:i,disabled:s=!1,disabledReason:n,tip:a}){return(0,d.jsxs)("div",{title:s?n:a,style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 18px",gap:"12px"},children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"10px",flex:1,minWidth:0},children:[(0,d.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,d.jsxs)("div",{style:{minWidth:0},children:[(0,d.jsx)("p",{style:{margin:0,fontSize:"13px",fontWeight:500,color:s?"#94a3b8":"#0f172a",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t}),(0,d.jsx)("p",{style:{margin:0,fontSize:"10px",color:"#94a3b8"},children:s?n:o})]})]}),(0,d.jsx)(Jn,{checked:r,onChange:i,label:`Toggle ${t}`,disabled:s})]})}function Y(){return(0,d.jsx)("div",{style:{height:"1px",background:"#f1f5f9"}})}function he({steps:e}){return(0,d.jsxs)("div",{style:{margin:"0 18px 8px",padding:"8px 10px",background:"#f8fafc",borderRadius:"8px",border:"0.5px solid #e2e8f0"},children:[(0,d.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,d.jsxs)("p",{style:{margin:"0 0 2px",fontSize:"10px",color:"#475569"},children:[o+1,". ",t]},o))]})}var ft=(0,V.forwardRef)(({position:e,settings:t,report:o,isActive:r,aiSupported:i,voiceSupported:s,set:n,onApply:a,onReset:l,onClose:c},p)=>{let{isMobile:u,isTablet:E}=Zn(),[L,W]=(0,V.useState)([]),[I,v]=(0,V.useState)(""),[O,k]=(0,V.useState)(""),[b,$]=(0,V.useState)(!1),[S,N]=(0,V.useState)(null),[h,z]=(0,V.useState)("idle");(0,V.useEffect)(()=>{let f=window;!!(f.LanguageModel||f.ai?.languageModel)&&i?N("gemini"):ge()&&N("transformers")},[i]),(0,V.useEffect)(()=>{if(S!=="transformers")return;let f=setInterval(()=>{z(be())},500);return()=>clearInterval(f)},[S]);let A=async()=>{if(!(!I.trim()||b)){if(!S){k("\u26A0\uFE0F No AI engine available on this device.");return}$(!0),k("");try{let f;S==="gemini"?f=await st(I):(z("loading"),f=await dt(I),z("ready")),k(f.success&&f.answer?f.answer.replace(/\*\*(.*?)\*\*/g,"$1").replace(/\*(.*?)\*/g,"$1").replace(/#+\s/g,"").trim():"\u26A0\uFE0F "+(f.error||"No answer found on this page"))}catch{k("\u26A0\uFE0F Failed to get answer. Please try again.")}$(!1)}};(0,V.useEffect)(()=>{(async()=>{try{let J=window;if(!J.queryLocalFonts)return;let te=await J.queryLocalFonts(),Q=[...new Set(te.map(fe=>fe.family))].sort();W(Q.slice(0,50))}catch{}})()},[]);let x=S==="gemini"?"Gemini Nano":S==="transformers"?"Transformers.js \xB7 All devices":"Detecting...",G=S==="transformers"&&h==="loading"?"Loading AI model... (first time only)":"...",B=u?{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:E?"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,d.jsxs)("div",{ref:p,role:"dialog","aria-modal":"true","aria-label":"yuktai accessibility preferences","data-yuktai-panel":"true",style:B,children:[(0,d.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,d.jsxs)("div",{children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"7px",marginBottom:"4px",flexWrap:"wrap"},children:[(0,d.jsx)("span",{style:{fontSize:"10px",fontWeight:700,padding:"2px 7px",borderRadius:"99px",background:"#f0fdfa",color:"#0d9488",letterSpacing:"0.05em",fontFamily:"monospace"},children:"@yuktishaalaa/yuktai"}),r&&(0,d.jsx)("span",{style:{fontSize:"10px",fontWeight:700,padding:"2px 7px",borderRadius:"99px",background:"#f0fdfa",color:"#0f766e",border:"1px solid #99f6e4"},children:"\u25CF ACTIVE"})]}),(0,d.jsx)("p",{style:{margin:"0 0 1px",fontSize:"15px",fontWeight:600,color:"#0f172a"},children:"Accessibility"}),(0,d.jsx)("p",{style:{margin:0,fontSize:"11px",color:"#64748b"},children:"WCAG 2.2 \xB7 Open source \xB7 Zero cost \xB7 All devices"})]}),(0,d.jsx)("button",{onClick:c,"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:u?"44px":"auto",minHeight:u?"44px":"auto",display:"flex",alignItems:"center",justifyContent:"center"},children:"\xD7"})]}),(0,d.jsx)(pe,{label:"\u267F Core Accessibility",concept:"Rule-based engine \u2014 works on all browsers and devices"}),(0,d.jsx)(he,{steps:["Toggle any feature on","Click Apply settings","Preferences saved automatically"]}),(0,d.jsx)(Z,{icon:"\u{1F527}",label:"Auto-fix ARIA",desc:"Injects missing labels and roles automatically",checked:t.autoFix,onChange:f=>n("autoFix",f),tip:"Fixes aria-label, alt text, roles on every element"}),(0,d.jsx)(Y,{}),(0,d.jsx)(Z,{icon:"\u{1F50A}",label:"Speak on focus",desc:"Browser reads elements aloud as you tab",checked:t.speechEnabled,onChange:f=>n("speechEnabled",f),tip:"Uses browser SpeechSynthesis \u2014 no install needed"}),(0,d.jsx)(Y,{}),(0,d.jsx)(Z,{icon:"\u{1F399}\uFE0F",label:"Voice control",desc:"Say commands to navigate the page",checked:t.voiceControl,onChange:f=>n("voiceControl",f),disabled:!s,disabledReason:"Not supported in this browser",tip:'Say "scroll down", "go to main", "click"'}),(0,d.jsx)(Y,{}),(0,d.jsx)(pe,{label:"\u{1F916} AI Features",color:"#7c3aed",badge:"Gemini Nano",concept:"Large Language Model running privately on your device \u2014 Chrome 127+ only"}),(0,d.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,d.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,d.jsx)("p",{style:{margin:"0 0 6px",fontWeight:600,color:"#0f172a",fontSize:"11px"},children:"\u{1F6E0} One-time setup \u2014 5 steps:"}),(0,d.jsxs)("p",{style:{margin:"0 0 3px"},children:["1. Open Chrome \u2192 ",(0,d.jsx)("code",{style:{background:"#f1f5f9",padding:"1px 5px",borderRadius:"4px",fontSize:"10px",color:"#0d9488",fontFamily:"monospace"},children:"chrome://flags"})]}),(0,d.jsx)("p",{style:{margin:"0 0 3px"},children:"2. Enable each flag:"}),(0,d.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:"2px",margin:"4px 0 6px 10px"},children:Xn.map(f=>(0,d.jsxs)("span",{style:{fontSize:"10px",color:"#7c3aed",fontFamily:"monospace"},children:["\u2192 ",f]},f))}),(0,d.jsxs)("p",{style:{margin:"0 0 3px"},children:["3. Click ",(0,d.jsx)("strong",{style:{color:"#0f172a"},children:"Relaunch"})]}),(0,d.jsxs)("p",{style:{margin:"0 0 3px"},children:["4. ",(0,d.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,d.jsx)("p",{style:{margin:"0"},children:"5. Refresh \u2014 AI features unlock automatically \u2705"})]}),(0,d.jsx)(Z,{icon:"\u{1F4DD}",label:"Plain English mode",desc:"Rewrites complex text in simple language",checked:t.plainEnglish,onChange:f=>n("plainEnglish",f),disabled:!i,disabledReason:"Enable Gemini Nano \u2014 see setup above",tip:"AI concept: LLM text rewriting"}),(0,d.jsx)(Y,{}),(0,d.jsx)(Z,{icon:"\u{1F4CB}",label:"Summarise page",desc:"3-sentence summary appears at top",checked:t.summarisePage,onChange:f=>n("summarisePage",f),disabled:!i,disabledReason:"Enable Gemini Nano \u2014 see setup above",tip:"AI concept: Abstractive summarisation"}),(0,d.jsx)(Y,{}),(0,d.jsx)(Z,{icon:"\u{1F3F7}\uFE0F",label:"Smart aria-labels",desc:"AI generates meaningful labels for elements",checked:t.smartLabels,onChange:f=>n("smartLabels",f),disabled:!i,disabledReason:"Enable Gemini Nano \u2014 see setup above",tip:"AI concept: Context-aware label generation"}),(0,d.jsx)(Y,{}),(0,d.jsx)(pe,{label:"\u{1F441}\uFE0F Visual",concept:"CSS filter-based \u2014 works on all browsers and devices"}),(0,d.jsx)(he,{steps:["Toggle any visual mode","Changes apply instantly","Works on mobile and desktop"]}),(0,d.jsx)(Z,{icon:"\u25D1",label:"High contrast",desc:"Boosts contrast for low vision users",checked:t.highContrast,onChange:f=>n("highContrast",f),tip:"CSS filter: contrast()"}),(0,d.jsx)(Y,{}),(0,d.jsx)(Z,{icon:"\u{1F319}",label:"Dark mode",desc:"Inverts colours \u2014 easy on eyes at night",checked:t.darkMode,onChange:f=>n("darkMode",f),tip:"CSS filter: invert + hue-rotate"}),(0,d.jsx)(Y,{}),(0,d.jsx)(Z,{icon:"\u23F8\uFE0F",label:"Reduce motion",desc:"Disables all animations",checked:t.reduceMotion,onChange:f=>n("reduceMotion",f),tip:"WCAG 2.3.3 \u2014 vestibular disorders"}),(0,d.jsx)(Y,{}),(0,d.jsx)(Z,{icon:"\u{1F446}",label:"Large targets",desc:"44\xD744px minimum touch targets",checked:t.largeTargets,onChange:f=>n("largeTargets",f),tip:"WCAG 2.5.8 \u2014 motor impaired users"}),(0,d.jsx)(Y,{}),(0,d.jsxs)("div",{style:{padding:"10px 18px"},children:[(0,d.jsx)("p",{style:{margin:"0 0 2px",fontSize:"12px",fontWeight:500,color:"#0f172a"},children:"\u{1F3A8} Colour blindness"}),(0,d.jsx)("p",{style:{margin:"0 0 8px",fontSize:"10px",color:"#94a3b8"},children:"SVG colour matrix filters \u2014 all devices"}),(0,d.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px"},children:Kn.map(f=>(0,d.jsx)("button",{onClick:()=>n("colorBlindMode",f.value),"aria-pressed":t.colorBlindMode===f.value,style:{padding:"4px 10px",borderRadius:"20px",fontSize:"11px",fontWeight:500,border:`1px solid ${t.colorBlindMode===f.value?"#0d9488":"#e2e8f0"}`,background:t.colorBlindMode===f.value?"#f0fdfa":"#fff",color:t.colorBlindMode===f.value?"#0d9488":"#64748b",cursor:"pointer",minHeight:u?"36px":"auto"},children:f.label},f.value))})]}),(0,d.jsx)(Y,{}),(0,d.jsx)(pe,{label:"\u{1F524} Font",concept:"Browser Font API + CSS \u2014 Chrome 103+"}),(0,d.jsx)(he,{steps:["Toggle dyslexia font or pick from device","Adjust size with + / \u2212","Saved across visits"]}),(0,d.jsx)(Z,{icon:"Aa",label:"Dyslexia-friendly font",desc:"Atkinson Hyperlegible \u2014 research-backed",checked:t.dyslexiaFont,onChange:f=>n("dyslexiaFont",f),tip:"By Braille Institute \u2014 free and open source"}),(0,d.jsx)(Y,{}),(0,d.jsxs)("div",{style:{padding:"10px 18px"},children:[(0,d.jsx)("p",{style:{margin:"0 0 2px",fontSize:"12px",fontWeight:500,color:"#0f172a"},children:"\u{1F5A5}\uFE0F Local font"}),(0,d.jsx)("p",{style:{margin:"0 0 8px",fontSize:"10px",color:"#94a3b8"},children:"window.queryLocalFonts() \u2014 Chrome 103+"}),L.length>0?(0,d.jsxs)("select",{value:t.localFont,onChange:f=>n("localFont",f.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:u?"44px":"36px"},children:[(0,d.jsx)("option",{value:"",children:"System default"}),L.map(f=>(0,d.jsx)("option",{value:f,style:{fontFamily:f},children:f},f))]}):(0,d.jsx)("p",{style:{margin:0,fontSize:"11px",color:"#94a3b8"},children:"Allow font access when Chrome prompts you."})]}),(0,d.jsx)(Y,{}),(0,d.jsxs)("div",{style:{padding:"10px 18px 14px"},children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"10px"},children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{style:{margin:0,fontSize:"12px",fontWeight:500,color:"#0f172a"},children:"\u{1F4CF} Text size"}),(0,d.jsx)("p",{style:{margin:0,fontSize:"10px",color:"#94a3b8"},children:"Scales all text on the page"})]}),(0,d.jsxs)("span",{style:{fontSize:"12px",fontWeight:600,color:"#0d9488",background:"#f0fdfa",padding:"2px 8px",borderRadius:"99px"},children:[t.fontScale,"%"]})]}),(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,d.jsx)("button",{onClick:()=>{let f=ue.indexOf(t.fontScale);f>0&&n("fontScale",ue[f-1])},disabled:t.fontScale<=80,"aria-label":"Decrease text size",style:{width:u?"44px":"30px",height:u?"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,d.jsx)("div",{style:{flex:1,display:"flex",gap:"3px"},children:ue.map(f=>(0,d.jsx)("button",{onClick:()=>n("fontScale",f),"aria-label":`Set text size to ${f}%`,style:{flex:1,height:"6px",borderRadius:"99px",border:"none",cursor:"pointer",padding:0,background:f<=t.fontScale?"#0d9488":"#e2e8f0",transition:"background 0.15s"}},f))}),(0,d.jsx)("button",{onClick:()=>{let f=ue.indexOf(t.fontScale);f<ue.length-1&&n("fontScale",ue[f+1])},disabled:t.fontScale>=130,"aria-label":"Increase text size",style:{width:u?"44px":"30px",height:u?"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,d.jsx)(Y,{}),(0,d.jsx)(pe,{label:"\u{1F310} Translate",color:"#7c3aed",badge:"Gemini Nano",concept:"Chrome Translation API \u2014 on device, no internet after setup"}),(0,d.jsx)(he,{steps:["Enable Gemini Nano first","Pick your language","Full page translates instantly"]}),(0,d.jsxs)("div",{style:{padding:"6px 18px 12px"},children:[(0,d.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px"},children:Ne.slice(0,u?8:18).map(f=>(0,d.jsx)("button",{onClick:()=>n("translateLanguage",f.code),"aria-pressed":t.translateLanguage===f.code,disabled:!i,style:{padding:"4px 10px",borderRadius:"20px",fontSize:"11px",fontWeight:500,border:`1px solid ${t.translateLanguage===f.code?"#7c3aed":"#e2e8f0"}`,background:t.translateLanguage===f.code?"#f5f3ff":"#fff",color:t.translateLanguage===f.code?"#7c3aed":"#64748b",cursor:i?"pointer":"not-allowed",opacity:i?1:.5,minHeight:u?"36px":"auto"},children:f.label},f.code))}),!i&&(0,d.jsx)("p",{style:{margin:"6px 0 0",fontSize:"10px",color:"#94a3b8"},children:"Enable Gemini Nano using the setup guide above."})]}),(0,d.jsx)(Y,{}),(0,d.jsx)(pe,{label:"\u{1F4AC} Ask This Page",color:"#0d9488",badge:x,concept:"RAG \u2014 Retrieval Augmented Generation. Works on all devices including mobile."}),(0,d.jsx)(he,{steps:["Type any question about this page","Press Ask or hit Enter",S==="transformers"?"Transformers.js answers \u2014 works on mobile, offline":"Gemini Nano reads page and answers privately","Zero cost. No data leaves your device."]}),(0,d.jsxs)("div",{style:{margin:"0 18px 8px",padding:"6px 10px",background:S==="gemini"?"#f0fdfa":S==="transformers"?"#f5f3ff":"#f8fafc",borderRadius:"8px",border:`0.5px solid ${S==="gemini"?"#99f6e4":S==="transformers"?"#c4b5fd":"#e2e8f0"}`,fontSize:"10px",color:S==="gemini"?"#0f766e":S==="transformers"?"#7c3aed":"#94a3b8"},children:[S==="gemini"&&"\u2705 Using Gemini Nano \u2014 on device, private, instant",S==="transformers"&&"\u2705 Using Transformers.js \u2014 works on mobile and all browsers",!S&&"\u23F3 Detecting AI engine...",S==="transformers"&&h==="loading"&&" \xB7 Loading model...",S==="transformers"&&h==="ready"&&" \xB7 Model ready \u2705"]}),(0,d.jsxs)("div",{style:{padding:"0 18px 14px"},children:[(0,d.jsxs)("div",{style:{display:"flex",gap:"6px",marginBottom:"8px"},children:[(0,d.jsx)("input",{type:"text",value:I,onChange:f=>v(f.target.value),onKeyDown:f=>{f.key==="Enter"&&A()},placeholder:"e.g. What does this page do?",disabled:b||!S,"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:S?"#fff":"#f8fafc",outline:"none",height:u?"44px":"36px"}}),(0,d.jsx)("button",{onClick:A,disabled:b||!I.trim()||!S,"aria-label":"Ask question",style:{padding:"8px 14px",borderRadius:"8px",border:"none",background:S&&I.trim()&&!b?"#0d9488":"#e2e8f0",color:S&&I.trim()&&!b?"#fff":"#94a3b8",fontSize:"12px",fontWeight:600,cursor:S&&I.trim()&&!b?"pointer":"not-allowed",flexShrink:0,height:u?"44px":"36px",minWidth:"52px",transition:"background 0.2s"},children:b?G:"Ask"})]}),O&&(0,d.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,d.jsx)("strong",{style:{display:"block",marginBottom:"4px",fontSize:"11px",color:"#0d9488"},children:"\u{1F4AC} Answer"}),O,(0,d.jsx)("button",{onClick:()=>{k(""),v("")},style:{display:"block",marginTop:"6px",background:"none",border:"none",color:"#94a3b8",fontSize:"10px",cursor:"pointer",padding:0},children:"Clear"})]})]}),o&&(0,d.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,d.jsxs)("div",{style:{display:"flex",gap:"8px",padding:"12px 14px 14px",position:u?"sticky":"relative",bottom:u?0:"auto",background:"#fff",borderTop:"1px solid #f1f5f9"},children:[(0,d.jsx)("button",{onClick:l,style:{flex:1,padding:u?"12px 0":"8px 0",fontSize:"13px",fontWeight:500,borderRadius:"9px",border:"1px solid #e2e8f0",background:"#fff",color:"#64748b",cursor:"pointer"},children:"Reset"}),(0,d.jsx)("button",{onClick:a,style:{flex:2,padding:u?"12px 0":"8px 0",fontSize:"13px",fontWeight:600,borderRadius:"9px",border:"none",background:"#0d9488",color:"#fff",cursor:"pointer"},children:"Apply settings"})]})]})});ft.displayName="WidgetPanel";ye();m();var ee=require("react");m();var Qn={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:[]},er={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"]},tr={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"]},or={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"]},nr={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"]},rr={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 ir(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 r=e.match(o);if(r?.[1]){let i=r[1].trim();if(i.length>2&&i.length<40)return i}}return"My Business"}function ar(e){let t=e.toLowerCase(),o="generic",r=0;for(let[i,s]of Object.entries(Qn)){let n=0;for(let a of s)t.includes(a)&&n++;n>r&&(r=n,o=i)}return o}function sr(e,t){let o=e.toLowerCase(),r=new Set(er[t]);for(let[i,s]of Object.entries(tr))for(let n of s)if(o.includes(n)){r.add(i);break}return r.add("home"),r.add("contact"),Array.from(r)}function lr(e){let t=e.toLowerCase(),o=[];for(let[r,i]of Object.entries(or))for(let s of i)if(t.includes(s)){o.push(r);break}return o}function cr(e,t){let o=e.toLowerCase();for(let[r,i]of Object.entries(nr))for(let s of i)if(o.includes(s))return r;return rr[t]}function go(e){let t=ar(e),o=sr(e,t),r=lr(e),i=cr(e,t);return{siteName:ir(e),websiteType:t,pages:o,features:r,theme:i,description:e.slice(0,200)}}var y=require("react/jsx-runtime"),fr=["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"],mr={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}"},gr={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 gt({position:e,onClose:t}){let[o,r]=(0,ee.useState)("input"),[i,s]=(0,ee.useState)(""),[n,a]=(0,ee.useState)(null),[l,c]=(0,ee.useState)(0),[p,u]=(0,ee.useState)(""),E=(0,ee.useCallback)(()=>{if(!i.trim())return;let v=go(i);a(v),r("preview")},[i]),L=(0,ee.useCallback)(async()=>{if(n){r("generating"),c(0),u("");try{let v=[{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 k of v)c(k.pct),await new Promise(b=>setTimeout(b,200));let{generateZip:O}=await Promise.resolve().then(()=>(Do(),_o));await O(n),c(100),r("done")}catch(v){u(v instanceof Error?v.message:"Generation failed. Please try again."),r("preview")}}},[n]),W=()=>{r("input"),s(""),a(null),c(0),u("")},I={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,y.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":"yuktai Vibe Coder","data-yuktai-panel":"true",style:I,children:[(0,y.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,y.jsxs)("div",{children:[(0,y.jsx)("p",{style:{margin:"0 0 2px",fontSize:"13px",fontWeight:700,color:"#0f172a"},children:"\u26A1 Vibe Coder"}),(0,y.jsx)("p",{style:{margin:0,fontSize:"10px",color:"#64748b"},children:"Describe your website \u2192 Download Next.js ZIP"})]}),(0,y.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,y.jsxs)("div",{style:{padding:"14px 16px"},children:[(0,y.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,y.jsx)("p",{style:{margin:"0 0 6px",fontSize:"10px",fontWeight:600,color:"#94a3b8",textTransform:"uppercase"},children:"Examples"}),(0,y.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:"4px",marginBottom:"12px"},children:fr.slice(0,3).map(v=>(0,y.jsx)("button",{onClick:()=>s(v),style:{padding:"6px 10px",borderRadius:"8px",border:"1px solid #e2e8f0",background:"#f8fafc",color:"#475569",fontSize:"10px",cursor:"pointer",textAlign:"left",lineHeight:1.4},children:v},v))}),(0,y.jsx)("textarea",{value:i,onChange:v=>s(v.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,y.jsx)("button",{onClick:E,disabled:!i.trim(),style:{width:"100%",marginTop:"10px",padding:"10px",borderRadius:"8px",border:"none",background:i.trim()?"#f59e0b":"#e2e8f0",color:i.trim()?"#fff":"#94a3b8",fontSize:"13px",fontWeight:700,cursor:i.trim()?"pointer":"not-allowed",transition:"background 0.2s"},children:"Analyse Requirement \u2192"})]}),o==="preview"&&n&&(0,y.jsxs)("div",{style:{padding:"14px 16px"},children:[p&&(0,y.jsxs)("div",{style:{padding:"10px",background:"#fef2f2",border:"1px solid #fca5a5",borderRadius:"8px",marginBottom:"12px",fontSize:"11px",color:"#dc2626"},children:["\u26A0\uFE0F ",p]}),(0,y.jsxs)("div",{style:{background:"#f8fafc",borderRadius:"10px",padding:"12px",marginBottom:"12px"},children:[(0,y.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px"},children:[(0,y.jsx)("span",{style:{fontSize:"1.5rem"},children:gr[n.websiteType]||"\u{1F310}"}),(0,y.jsxs)("div",{children:[(0,y.jsx)("p",{style:{margin:0,fontSize:"13px",fontWeight:700,color:"#0f172a"},children:n.siteName}),(0,y.jsxs)("p",{style:{margin:0,fontSize:"10px",color:"#64748b",textTransform:"capitalize"},children:[n.websiteType," website \xB7 ",n.theme," theme"]})]})]}),(0,y.jsxs)("p",{style:{margin:"8px 0 6px",fontSize:"10px",fontWeight:600,color:"#94a3b8",textTransform:"uppercase"},children:["Pages to generate (",n.pages.length,")"]}),(0,y.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px"},children:n.pages.map(v=>(0,y.jsxs)("span",{style:{padding:"2px 8px",borderRadius:"99px",background:"#f0fdf4",border:"1px solid #86efac",fontSize:"10px",color:"#166534",fontWeight:500},children:[mr[v]||"\u{1F4C4}"," ",v]},v))}),n.features.length>0&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("p",{style:{margin:"10px 0 6px",fontSize:"10px",fontWeight:600,color:"#94a3b8",textTransform:"uppercase"},children:"Detected features"}),(0,y.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px"},children:n.features.map(v=>(0,y.jsx)("span",{style:{padding:"2px 8px",borderRadius:"99px",background:"#f5f3ff",border:"1px solid #c4b5fd",fontSize:"10px",color:"#7c3aed",fontWeight:500},children:v},v))})]})]}),(0,y.jsxs)("div",{style:{margin:"0 0 12px",padding:"10px 12px",background:"#f0fdf4",borderRadius:"8px",border:"1px solid #86efac"},children:[(0,y.jsx)("p",{style:{margin:"0 0 4px",fontSize:"10px",fontWeight:700,color:"#166534"},children:"\u{1F4E6} What you get:"}),(0,y.jsxs)("p",{style:{margin:0,fontSize:"10px",color:"#166534",lineHeight:1.6},children:["\u2705 Complete Next.js 16 project",(0,y.jsx)("br",{}),"\u2705 Tailwind CSS + CSS Modules",(0,y.jsx)("br",{}),"\u2705 TypeScript configured",(0,y.jsx)("br",{}),"\u2705 Navbar + Footer components",(0,y.jsx)("br",{}),"\u2705 All ",n.pages.length," pages ready",(0,y.jsx)("br",{}),"\u2705 Mobile responsive",(0,y.jsx)("br",{}),"\u2705 npm run dev \u2192 works immediately"]})]}),(0,y.jsxs)("div",{style:{display:"flex",gap:"8px"},children:[(0,y.jsx)("button",{onClick:W,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,y.jsx)("button",{onClick:L,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,y.jsxs)("div",{style:{padding:"2rem 16px",textAlign:"center"},children:[(0,y.jsx)("p",{style:{fontSize:"2rem",marginBottom:"1rem"},children:"\u26A1"}),(0,y.jsx)("p",{style:{fontSize:"13px",fontWeight:700,color:"#0f172a",marginBottom:"0.5rem"},children:"Generating your project..."}),(0,y.jsx)("p",{style:{fontSize:"11px",color:"#64748b",marginBottom:"1.5rem"},children:l<30?"Parsing requirement...":l<55?"Loading templates...":l<70?"Generating pages...":l<85?"Building components...":l<95?"Creating styles...":"Packaging ZIP..."}),(0,y.jsx)("div",{style:{height:"8px",background:"#e2e8f0",borderRadius:"99px",overflow:"hidden"},children:(0,y.jsx)("div",{style:{height:"100%",width:`${l}%`,background:"#f59e0b",borderRadius:"99px",transition:"width 0.3s ease"}})}),(0,y.jsxs)("p",{style:{marginTop:"0.5rem",fontSize:"10px",color:"#94a3b8"},children:[l,"%"]})]}),o==="done"&&n&&(0,y.jsxs)("div",{style:{padding:"2rem 16px",textAlign:"center"},children:[(0,y.jsx)("p",{style:{fontSize:"3rem",marginBottom:"0.75rem"},children:"\u2705"}),(0,y.jsxs)("p",{style:{fontSize:"14px",fontWeight:700,color:"#0f172a",marginBottom:"0.5rem"},children:[n.siteName," downloaded!"]}),(0,y.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(v=>(0,y.jsx)("div",{style:{background:"#0f172a",borderRadius:"8px",padding:"8px 12px",marginBottom:"6px",textAlign:"left"},children:(0,y.jsxs)("code",{style:{fontSize:"12px",color:"#a7f3d0",fontFamily:"monospace"},children:["$ ",v]})},v)),(0,y.jsx)("p",{style:{fontSize:"11px",color:"#10b981",margin:"1rem 0",fontWeight:600},children:"Then open http://localhost:3000 \u{1F680}"}),(0,y.jsxs)("div",{style:{display:"flex",gap:"8px"},children:[(0,y.jsx)("button",{onClick:W,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,y.jsx)("button",{onClick:L,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 w=require("react/jsx-runtime");async function wr(){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 Oe({position:e="left",children:t,config:o={},showRag:r=!1,showAgent:i=!1}){let[s,n]=(0,T.useState)(!1),[a,l]=(0,T.useState)(pt),[c,p]=(0,T.useState)(null),[u,E]=(0,T.useState)(!1),[L,W]=(0,T.useState)(!1),[I,v]=(0,T.useState)(!1),O=T.default.useRef(null),[k,b]=(0,T.useState)(!1),[$,S]=(0,T.useState)(""),[N,h]=(0,T.useState)(""),[z,A]=(0,T.useState)(!1),[x,G]=(0,T.useState)(null),[B,f]=(0,T.useState)("idle"),[J,te]=(0,T.useState)(!1),[Q,fe]=(0,T.useState)(""),[nn,Ae]=(0,T.useState)(""),[oe,Lt]=(0,T.useState)(!1),[Rt,Ue]=(0,T.useState)([]),[K,It]=(0,T.useState)(null),rn=24,Mt=84,Pt=r?144:84,zr=204,[Ce,Ke]=(0,T.useState)(!1);(0,T.useEffect)(()=>{if(typeof window>"u")return;let g=window;!!(g.LanguageModel||g.ai?.languageModel)&&L?(G("gemini"),It("gemini")):ge()&&(G("transformers"),It("transformers"))},[L]),(0,T.useEffect)(()=>{if(x!=="transformers")return;let g=setInterval(()=>f(be()),500);return()=>clearInterval(g)},[x]);let Nt=(0,T.useCallback)(async()=>{if(!(!$.trim()||z)){if(!x){h("\u26A0\uFE0F No AI engine available.");return}A(!0),h("");try{let g;if(x==="gemini"){let{askPage:F}=await Promise.resolve().then(()=>(lt(),co));g=await F($)}else{f("loading");let{askPageWithTransformers:F}=await Promise.resolve().then(()=>(ye(),ut));g=await F($),f("ready")}h(g.success&&g.answer?g.answer.replace(/\*\*(.*?)\*\*/g,"$1").replace(/\*(.*?)\*/g,"$1").replace(/#+\s/g,"").trim():"\u26A0\uFE0F "+(g.error||"No answer found."))}catch{h("\u26A0\uFE0F Something went wrong.")}A(!1)}},[$,z,x]),zt=(0,T.useCallback)(async()=>{if(!Q.trim()||oe)return;if(!K){Ae("\u26A0\uFE0F No AI engine available.");return}Lt(!0),Ue([]),Ae("");let{runAgent:g}=await Promise.resolve().then(()=>(Ko(),Uo));await g(Q,K,F=>{Ue(ne=>[...ne,F.text])}),Lt(!1),Ae("done")},[Q,oe,K]);(0,T.useEffect)(()=>{if(typeof window>"u")return;let F=setTimeout(async()=>{let ne=window,dn=await wr();W(dn),v(!!(ne.SpeechRecognition||ne.webkitSpeechRecognition))},800);return()=>clearTimeout(F)},[]),(0,T.useEffect)(()=>{if(!(typeof window>"u"))try{let g=localStorage.getItem("yuktai-a11y-prefs");g&&l(F=>({...F,...JSON.parse(g)}))}catch{}},[]);let Ft=(0,T.useCallback)(async g=>{let F={enabled:!0,highContrast:g.highContrast,darkMode:g.darkMode,reduceMotion:g.reduceMotion,largeTargets:g.largeTargets,speechEnabled:g.speechEnabled,autoFix:g.autoFix,dyslexiaFont:g.dyslexiaFont,localFont:g.localFont,fontSizeMultiplier:g.fontScale/100,colorBlindMode:g.colorBlindMode,showAuditBadge:g.showAuditBadge,showSkipLinks:!0,showPreferencePanel:!1,plainEnglish:g.plainEnglish,summarisePage:g.summarisePage,translateLanguage:g.translateLanguage,voiceControl:g.voiceControl,smartLabels:g.smartLabels,...o};await U.execute(F),p(U.applyFixes(F)),E(!0)},[o]),an=(0,T.useCallback)(async()=>{try{localStorage.setItem("yuktai-a11y-prefs",JSON.stringify(a))}catch{}await Ft(a),n(!1)},[a,Ft]),sn=(0,T.useCallback)(()=>{l(pt);try{localStorage.removeItem("yuktai-a11y-prefs")}catch{}let g=document.documentElement;["data-yuktai-high-contrast","data-yuktai-dark","data-yuktai-reduce-motion","data-yuktai-large-targets","data-yuktai-keyboard","data-yuktai-dyslexia"].forEach(F=>g.removeAttribute(F)),document.body.style.filter="",document.body.style.fontFamily="",document.documentElement.style.fontSize="",p(null),E(!1)},[]),ln=(0,T.useCallback)((g,F)=>{l(ne=>({...ne,[g]:F}))},[]);(0,T.useEffect)(()=>{let g=F=>{F.key==="Escape"&&(s&&n(!1),k&&b(!1),J&&te(!1),Ce&&Ke(!1))};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[s,k,J]),(0,T.useEffect)(()=>{s&&O.current&&U.trapFocus(O.current)},[s]);let Ee=(g,F,ne)=>({position:"fixed",bottom:`${g}px`,[e]:"24px",zIndex:9998,width:"52px",height:"52px",borderRadius:"50%",background:F,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"}),Le=g=>{g.currentTarget.style.transform="scale(1.08)"},Re=g=>{g.currentTarget.style.transform="scale(1)"},$t=x==="gemini"?"Gemini Nano \xB7 On device":x==="transformers"?"Transformers.js \xB7 All devices":"Detecting...",cn=x==="transformers"&&B==="loading"?"Loading model...":"...";return(0,w.jsxs)(w.Fragment,{children:[t,i&&(0,w.jsx)("button",{style:Ee(204,Ce?"#d97706":"#f59e0b",Ce),"aria-label":"Open Vibe Coder",title:"\u26A1 Vibe Coder \u2014 Generate Next.js project",onClick:()=>{Ke(g=>!g),te(!1),b(!1),n(!1)},onMouseEnter:Le,onMouseLeave:Re,children:"\u26A1"}),i&&Ce&&(0,w.jsx)(gt,{position:e,onClose:()=>Ke(!1)}),i&&(0,w.jsx)("button",{style:Ee(Pt,J?"#059669":"#10b981",J),"aria-label":"Open AI agent","aria-haspopup":"dialog","aria-expanded":J,title:"\u{1F916} AI Agent \u2014 guide me through this page",onClick:()=>{te(g=>!g),b(!1),n(!1)},onMouseEnter:Le,onMouseLeave:Re,children:"\u{1F916}"}),i&&J&&(0,w.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":"yuktai AI Agent","data-yuktai-panel":"true",style:{position:"fixed",bottom:`${Pt+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,w.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"10px"},children:[(0,w.jsxs)("div",{children:[(0,w.jsx)("p",{style:{margin:"0 0 2px",fontSize:"13px",fontWeight:600,color:"#0f172a"},children:"\u{1F916} AI Agent"}),(0,w.jsx)("p",{style:{margin:0,fontSize:"10px",color:"#10b981"},children:K==="gemini"?"Gemini Nano \xB7 On device":K==="transformers"?"Transformers.js \xB7 All devices":"Detecting..."})]}),(0,w.jsx)("button",{onClick:()=>te(!1),"aria-label":"Close agent panel",style:{background:"none",border:"none",cursor:"pointer",color:"#94a3b8",fontSize:"18px",lineHeight:1,padding:"2px"},children:"\xD7"})]}),(0,w.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,w.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(g=>(0,w.jsx)("button",{onClick:()=>fe(g),style:{padding:"3px 8px",borderRadius:"20px",fontSize:"10px",border:"1px solid #e2e8f0",background:"#f8fafc",color:"#64748b",cursor:"pointer"},children:g},g))}),(0,w.jsxs)("div",{style:{display:"flex",gap:"6px",marginBottom:"8px"},children:[(0,w.jsx)("input",{type:"text",value:Q,onChange:g=>fe(g.target.value),onKeyDown:g=>{g.key==="Enter"&&zt()},placeholder:"e.g. Help me fill this form",disabled:oe||!K,"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:K?"#fff":"#f8fafc",outline:"none",height:"36px"}}),(0,w.jsx)("button",{onClick:zt,disabled:oe||!Q.trim()||!K,"aria-label":"Run agent",style:{padding:"8px 12px",borderRadius:"8px",border:"none",background:K&&Q.trim()&&!oe?"#10b981":"#e2e8f0",color:K&&Q.trim()&&!oe?"#fff":"#94a3b8",fontSize:"12px",fontWeight:600,cursor:K&&Q.trim()&&!oe?"pointer":"not-allowed",height:"36px",minWidth:"52px",transition:"background 0.2s"},children:oe?"...":"Go"})]}),Rt.length>0&&(0,w.jsxs)("div",{style:{padding:"10px 12px",background:"#f0fdf4",border:"1px solid #86efac",borderRadius:"8px",fontSize:"11px",color:"#166534",lineHeight:1.7},children:[Rt.map((g,F)=>(0,w.jsx)("p",{style:{margin:"0 0 2px"},children:g},F)),nn==="done"&&(0,w.jsx)("button",{onClick:()=>{Ue([]),fe(""),Ae("")},style:{display:"block",marginTop:"6px",background:"none",border:"none",color:"#94a3b8",fontSize:"10px",cursor:"pointer",padding:0},children:"Clear"})]}),!K&&(0,w.jsx)("p",{style:{margin:"4px 0 0",fontSize:"10px",color:"#94a3b8"},children:"Enable Gemini Nano via chrome://flags for best results."})]}),r&&(0,w.jsx)("button",{style:Ee(Mt,k?"#7c3aed":"#6d28d9",k),"aria-label":"Ask a question about this page","aria-haspopup":"dialog","aria-expanded":k,title:`\u{1F4AC} Ask this page \xB7 ${$t}`,onClick:()=>{b(g=>!g),n(!1),te(!1)},onMouseEnter:Le,onMouseLeave:Re,children:"\u{1F4AC}"}),r&&k&&(0,w.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":"Ask this page","data-yuktai-panel":"true",style:{position:"fixed",bottom:`${Mt+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,w.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"10px"},children:[(0,w.jsxs)("div",{children:[(0,w.jsx)("p",{style:{margin:"0 0 2px",fontSize:"13px",fontWeight:600,color:"#0f172a"},children:"\u{1F4AC} Ask this page"}),(0,w.jsx)("p",{style:{margin:0,fontSize:"10px",color:"#7c3aed"},children:$t}),x==="transformers"&&B==="loading"&&(0,w.jsx)("p",{style:{margin:"2px 0 0",fontSize:"9px",color:"#94a3b8"},children:"Downloading model \u2014 first time only"}),x==="transformers"&&B==="ready"&&(0,w.jsx)("p",{style:{margin:"2px 0 0",fontSize:"9px",color:"#10b981"},children:"Model ready \u2705 \u2014 works offline"})]}),(0,w.jsx)("button",{onClick:()=>b(!1),"aria-label":"Close ask panel",style:{background:"none",border:"none",cursor:"pointer",color:"#94a3b8",fontSize:"18px",lineHeight:1,padding:"2px"},children:"\xD7"})]}),(0,w.jsxs)("div",{style:{display:"flex",gap:"6px",marginBottom:"8px"},children:[(0,w.jsx)("input",{type:"text",value:$,onChange:g=>S(g.target.value),onKeyDown:g=>{g.key==="Enter"&&Nt()},placeholder:"e.g. What does this page do?",disabled:z||!x,"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:x?"#fff":"#f8fafc",outline:"none",height:"36px"}}),(0,w.jsx)("button",{onClick:Nt,disabled:z||!$.trim()||!x,"aria-label":"Submit question",style:{padding:"8px 12px",borderRadius:"8px",border:"none",background:x&&$.trim()&&!z?"#7c3aed":"#e2e8f0",color:x&&$.trim()&&!z?"#fff":"#94a3b8",fontSize:"12px",fontWeight:600,cursor:x&&$.trim()&&!z?"pointer":"not-allowed",height:"36px",minWidth:"48px",transition:"background 0.2s"},children:z?cn:"Ask"})]}),N&&(0,w.jsxs)("div",{style:{padding:"10px",background:"#f5f3ff",borderRadius:"8px",fontSize:"12px",color:"#4c1d95",lineHeight:1.6,maxHeight:"180px",overflowY:"auto"},children:[(0,w.jsx)("strong",{style:{display:"block",marginBottom:"4px",fontSize:"11px",color:"#7c3aed"},children:"\u{1F4AC} Answer"}),N,(0,w.jsx)("button",{onClick:()=>{h(""),S("")},style:{display:"block",marginTop:"6px",background:"none",border:"none",color:"#94a3b8",fontSize:"10px",cursor:"pointer",padding:0},children:"Clear"})]}),!x&&(0,w.jsx)("p",{style:{margin:"4px 0 0",fontSize:"10px",color:"#94a3b8"},children:"Detecting AI engine..."})]}),(0,w.jsx)("button",{style:Ee(rn,u?"#0d9488":"#1a73e8",s),"aria-label":"Open accessibility preferences","aria-haspopup":"dialog","aria-expanded":s,"data-yuktai-pref-toggle":"true",title:"\u267F Accessibility settings",onClick:()=>{n(g=>!g),b(!1),te(!1)},onMouseEnter:Le,onMouseLeave:Re,children:"\u267F"}),s&&(0,w.jsx)(ft,{ref:O,position:e,settings:a,report:c,isActive:u,aiSupported:L,voiceSupported:I,set:ln,onApply:an,onReset:sn,onClose:()=>n(!1)})]})}m();var xe={name:"ai.text",async execute(e){return`\u{1F916} YuktAI says: ${e}`}};m();var we={name:"voice.text",async execute(e){return!e||e.trim()===""?"\u{1F3A4} No speech detected":`\u{1F3A4} You said: ${e}`}};m();var ie=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 r=this.use(t);if(!r)throw new Error(`Plugin not found: ${t}`);return await r.execute(o)}catch(r){throw console.error(`[YuktAI Runtime Error in ${t}]:`,r),r}}getPlugins(){return Array.from(this.plugins.keys())}};m();var _=require("react"),M=require("react/jsx-runtime");function vr(e){let t=e.toLowerCase().trim();if(/^(search|find|show|filter)/.test(t))return{type:"search",payload:t.replace(/^(search|find|show|filter)\s+(for\s+|by\s+)?/,"").trim()};if(/sort/.test(t)){let o=/desc|high|large|top/.test(t)?"desc":"asc";return{type:"sort",payload:{key:t.match(/(name|age|salary|role|email|date)/)?.[1],dir:o}}}return/^(who|what|which|how many|highest|lowest|max|min|average|avg|total|sum)/.test(t)?{type:"question",payload:e}:{type:"search",payload:e}}function kr(e,t,o){if(t.length===0)return"There is no data to analyze.";let r=e.toLowerCase();if(/how many|count|total/.test(r))return`There are ${t.length} rows in the grid.`;let i=o.filter(n=>n.type==="number"),s=o.find(n=>r.includes(n.label.toLowerCase())||r.includes(n.key.toLowerCase()));if(/highest|maximum|max|top|largest/.test(r)){let n=s??i[0];if(!n)return"I could not find a column to analyze.";let a=t.map(u=>({row:u,val:Number(u[n.key])})).filter(u=>!isNaN(u.val)).sort((u,E)=>E.val-u.val);if(a.length===0)return`No numeric data in ${n.label}.`;let l=a[0],c=o.find(u=>u.key==="name"||u.label.toLowerCase()==="name"),p=c?String(l.row[c.key]):`Row ${t.indexOf(l.row)+1}`;return`The highest ${n.label} is ${l.val.toLocaleString("en-IN")}, held by ${p}.`}if(/lowest|minimum|min|smallest|bottom/.test(r)){let n=s??i[0];if(!n)return"I could not find a column to analyze.";let a=t.map(u=>({row:u,val:Number(u[n.key])})).filter(u=>!isNaN(u.val)).sort((u,E)=>u.val-E.val);if(a.length===0)return`No numeric data in ${n.label}.`;let l=a[0],c=o.find(u=>u.key==="name"||u.label.toLowerCase()==="name"),p=c?String(l.row[c.key]):`Row ${t.indexOf(l.row)+1}`;return`The lowest ${n.label} is ${l.val.toLocaleString("en-IN")}, held by ${p}.`}if(/average|avg|mean/.test(r)){let n=s??i[0];if(!n)return"I could not find a column to analyze.";let a=t.map(c=>Number(c[n.key])).filter(c=>!isNaN(c));if(a.length===0)return`No numeric data in ${n.label}.`;let l=a.reduce((c,p)=>c+p,0)/a.length;return`The average ${n.label} is ${Math.round(l).toLocaleString("en-IN")}.`}if(/sum|total/.test(r)){let n=s??i[0];if(!n)return"I could not find a column to analyze.";let a=t.map(c=>Number(c[n.key])).filter(c=>!isNaN(c));if(a.length===0)return`No numeric data in ${n.label}.`;let l=a.reduce((c,p)=>c+p,0);return`The total ${n.label} is ${l.toLocaleString("en-IN")}.`}if(/who|where|which|whose/.test(r)){let n=r.match(/\b([a-z]{3,})\b/g)?.filter(p=>!["who","where","which","whose","is","the","has","have"].includes(p));if(!n)return"I need a name to look up.";let a=n.join(" "),l=t.find(p=>Object.values(p).some(u=>String(u).toLowerCase().includes(a.toLowerCase())));return l?o.map(p=>`${p.label}: ${l[p.key]}`).join(", "):`I could not find anyone matching "${a}".`}return"I understand you have a question. Try asking 'highest salary' or 'how many rows'."}function Sr(e="en-US"){let[t,o]=(0,_.useState)(!1),[r,i]=(0,_.useState)(""),[s,n]=(0,_.useState)(!0),a=(0,_.useRef)(null);(0,_.useEffect)(()=>{if(typeof window>"u")return;let p=window.SpeechRecognition||window.webkitSpeechRecognition;if(!p){n(!1);return}let u=new p;u.continuous=!1,u.interimResults=!1,u.lang=e,u.onresult=E=>{let L=E.results[0][0].transcript;i(L),o(!1)},u.onerror=()=>o(!1),u.onend=()=>o(!1),a.current=u},[e]);let l=(0,_.useCallback)(()=>{if(a.current){i(""),o(!0);try{a.current.start()}catch{o(!1)}}},[]),c=(0,_.useCallback)(()=>{a.current?.stop(),o(!1)},[]);return{listening:t,transcript:r,supported:s,start:l,stop:c}}function Tr(e,t="en-US"){if(typeof window>"u"||!window.speechSynthesis)return;window.speechSynthesis.cancel();let o=new SpeechSynthesisUtterance(e);o.lang=t,o.rate=1,o.pitch=1,window.speechSynthesis.speak(o)}function Xo({data:e,columns:t,onSearch:o,onSort:r,theme:i="light",language:s="en-US"}){let[n,a]=(0,_.useState)(!1),[l,c]=(0,_.useState)(""),[p,u]=(0,_.useState)([{role:"ai",text:"Hi! Ask me anything about your data \u2014 like 'highest salary' or 'how many rows'. You can also say 'search Sandeep' or 'sort age descending'.",time:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}]),E=(0,_.useRef)(null),{listening:L,transcript:W,supported:I,start:v,stop:O}=Sr(s),k=i==="dark",b={bg:k?"#0F172A":"#FFFFFF",surface:k?"#1E293B":"#F8FAFC",border:k?"#334155":"#E2E8F0",text:k?"#F1F5F9":"#0F172A",muted:k?"#94A3B8":"#64748B",accent:"#10B981",userMsg:k?"#334155":"#DBEAFE",aiMsg:k?"#1E293B":"#F0FDF4"};(0,_.useEffect)(()=>{E.current?.scrollIntoView({behavior:"smooth"})},[p]),(0,_.useEffect)(()=>{W&&$(W)},[W]);let $=h=>{if(!h.trim())return;let z=new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});u(G=>[...G,{role:"user",text:h,time:z}]),c("");let A=vr(h),x="";if(A.type==="search")o(A.payload),x=`Searching for "${A.payload}"...`;else if(A.type==="sort"&&r){let{key:G,dir:B}=A.payload;G?(r(G,B),x=`Sorted by ${G} (${B==="asc"?"ascending":"descending"}).`):x="Which column should I sort? Try 'sort by salary'."}else A.type==="question"&&(x=kr(A.payload,e,t));setTimeout(()=>{let G=new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});u(B=>[...B,{role:"ai",text:x,time:G}]),Tr(x,s)},400)},S=()=>$(l),N=["highest salary","how many rows","average age","search sandeep"];return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)("button",{onClick:()=>a(!n),"aria-label":n?"Close AI assistant":"Open AI assistant",style:{position:"fixed",bottom:24,right:24,zIndex:9998,width:56,height:56,borderRadius:28,background:b.accent,color:"#FFFFFF",border:"none",cursor:"pointer",boxShadow:"0 8px 20px rgba(16,185,129,0.3)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:20,transition:"transform 0.2s"},onMouseEnter:h=>h.currentTarget.style.transform="scale(1.1)",onMouseLeave:h=>h.currentTarget.style.transform="scale(1)",children:n?"\u2715":"\u{1F916}"}),n&&(0,M.jsxs)("div",{role:"dialog","aria-label":"AI Grid Assistant",style:{position:"fixed",bottom:90,right:24,width:360,maxWidth:"calc(100vw - 48px)",height:480,maxHeight:"70vh",background:b.bg,border:`1px solid ${b.border}`,borderRadius:16,boxShadow:"0 20px 40px rgba(0,0,0,0.15)",zIndex:9997,display:"flex",flexDirection:"column",overflow:"hidden",fontFamily:"system-ui, sans-serif"},children:[(0,M.jsxs)("div",{style:{padding:"14px 16px",background:b.accent,color:"#FFFFFF",display:"flex",alignItems:"center",gap:10},children:[(0,M.jsx)("span",{style:{fontSize:22},children:"\u{1F916}"}),(0,M.jsxs)("div",{style:{flex:1},children:[(0,M.jsx)("div",{style:{fontWeight:700,fontSize:15},children:"Grid AI Assistant"}),(0,M.jsx)("div",{style:{fontSize:11,opacity:.9},children:I?"Voice + Chat \xB7 Offline \xB7 Free":"Chat only (voice not supported)"})]}),(0,M.jsx)("button",{onClick:()=>a(!1),"aria-label":"Close",style:{background:"transparent",border:"none",color:"#FFFFFF",cursor:"pointer",fontSize:20,padding:4},children:"\u2715"})]}),(0,M.jsxs)("div",{style:{flex:1,overflowY:"auto",padding:12,display:"flex",flexDirection:"column",gap:8},children:[p.map((h,z)=>(0,M.jsxs)("div",{style:{alignSelf:h.role==="user"?"flex-end":"flex-start",maxWidth:"85%",padding:"8px 12px",borderRadius:12,background:h.role==="user"?b.userMsg:b.aiMsg,color:b.text,fontSize:13.5,lineHeight:1.5},children:[(0,M.jsx)("div",{children:h.text}),(0,M.jsx)("div",{style:{fontSize:10,opacity:.6,marginTop:4,textAlign:"right"},children:h.time})]},z)),L&&(0,M.jsx)("div",{style:{alignSelf:"flex-end",padding:"8px 12px",borderRadius:12,background:"#FEE2E2",color:"#991B1B",fontSize:13.5,fontStyle:"italic"},children:"\u{1F3A4} Listening..."}),(0,M.jsx)("div",{ref:E})]}),(0,M.jsx)("div",{style:{padding:"6px 12px",borderTop:`1px solid ${b.border}`,display:"flex",gap:6,overflowX:"auto",flexShrink:0},children:N.map(h=>(0,M.jsx)("button",{onClick:()=>$(h),style:{padding:"4px 10px",borderRadius:12,background:b.surface,border:`1px solid ${b.border}`,color:b.text,fontSize:11.5,cursor:"pointer",whiteSpace:"nowrap"},children:h},h))}),(0,M.jsxs)("div",{style:{padding:10,display:"flex",gap:6,borderTop:`1px solid ${b.border}`,background:b.surface},children:[(0,M.jsx)("input",{type:"text",value:l,onChange:h=>c(h.target.value),onKeyDown:h=>h.key==="Enter"&&S(),placeholder:"Ask or say a command...","aria-label":"Chat input",style:{flex:1,padding:"8px 12px",border:`1px solid ${b.border}`,borderRadius:8,background:b.bg,color:b.text,fontSize:13,outline:"none"}}),I&&(0,M.jsx)("button",{onClick:L?O:v,"aria-label":L?"Stop listening":"Start voice input",style:{width:36,height:36,borderRadius:8,background:L?"#EF4444":b.accent,color:"#FFFFFF",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",fontSize:16,flexShrink:0,animation:L?"yuktai-pulse 1s ease-in-out infinite":"none"},children:"\u{1F3A4}"}),(0,M.jsx)("button",{onClick:S,"aria-label":"Send",disabled:!l.trim(),style:{padding:"0 14px",background:l.trim()?b.accent:b.muted,color:"#FFFFFF",border:"none",borderRadius:8,cursor:l.trim()?"pointer":"not-allowed",fontSize:13,fontWeight:600,flexShrink:0},children:"Send"})]})]}),(0,M.jsx)("style",{children:`
1522
+ @keyframes yuktai-pulse {
1523
+ 0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
1524
+ 50% { transform: scale(1.1); box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
1525
+ }
1526
+ `})]})}m();var D=require("react");function Ar(e){return e===!1?Number.MAX_SAFE_INTEGER:e===!0||e===void 0?10:e.pageSize??10}function Zo(e){let{data:t,columns:o,pagination:r=!0,mobileBreakpoint:i=768}=e,[s,n]=(0,D.useState)(null),[a,l]=(0,D.useState)(""),[c,p]=(0,D.useState)(1),[u,E]=(0,D.useState)(Ar(r)),[L,W]=(0,D.useState)(!1);(0,D.useEffect)(()=>{if(typeof window>"u")return;let N=()=>{W(window.innerWidth<i)};return N(),window.addEventListener("resize",N),()=>window.removeEventListener("resize",N)},[i]);let I=(0,D.useCallback)(N=>{n(h=>!h||h.key!==N?{key:N,direction:"asc"}:h.direction==="asc"?{key:N,direction:"desc"}:null),p(1)},[]),v=(0,D.useCallback)(()=>n(null),[]),O=(0,D.useMemo)(()=>{if(!a.trim())return t;let N=a.toLowerCase().trim();return t.filter(h=>o.some(z=>{let A=h[z.key];return A==null?!1:String(A).toLowerCase().includes(N)}))},[t,a,o]),k=(0,D.useMemo)(()=>{if(!s)return O;let N=[...O].sort((h,z)=>{let A=h[s.key],x=z[s.key];if(A===x)return 0;if(A==null)return 1;if(x==null)return-1;if(typeof A=="number"&&typeof x=="number")return A-x;if(A instanceof Date&&x instanceof Date)return A.getTime()-x.getTime();let G=String(A),B=String(x);return G.localeCompare(B,void 0,{sensitivity:"base",numeric:!0})});return s.direction==="desc"?N.reverse():N},[O,s]),b=Math.max(1,Math.ceil(k.length/u)),$=(0,D.useMemo)(()=>{if(r===!1)return k;let N=(c-1)*u;return k.slice(N,N+u)},[k,c,u,r]),S=(0,D.useCallback)(()=>{n(null),l(""),p(1)},[]);return(0,D.useEffect)(()=>{c>b&&p(b)},[c,b]),{displayedData:$,totalCount:t.length,filteredCount:k.length,sort:s,toggleSort:I,clearSort:v,searchQuery:a,setSearchQuery:l,page:c,pageSize:u,totalPages:b,setPage:p,setPageSize:E,isMobile:L,reset:S}}m();var q=require("react"),P=require("react/jsx-runtime");function Cr(e){let t=e.toLowerCase().trim();if(/^(search|find|show|filter)/.test(t))return{type:"search",payload:t.replace(/^(search|find|show|filter)\s+(for\s+|by\s+)?/,"").trim()};if(/sort/.test(t)){let o=/desc|high|large|top/.test(t)?"desc":"asc";return{type:"sort",payload:{key:t.match(/(name|age|salary|role|email|date)/)?.[1],dir:o}}}return/^(who|what|which|how many|highest|lowest|max|min|average|avg|total|sum)/.test(t)?{type:"question",payload:e}:{type:"search",payload:e}}function Er(e,t,o){if(t.length===0)return"There is no data to analyze.";let r=e.toLowerCase();if(/how many|count|total/.test(r))return`There are ${t.length} rows in the grid.`;let i=o.filter(n=>n.type==="number"),s=o.find(n=>r.includes(n.label.toLowerCase())||r.includes(n.key.toLowerCase()));if(/highest|maximum|max|top|largest/.test(r)){let n=s??i[0];if(!n)return"I could not find a column to analyze.";let a=t.map(u=>({row:u,val:Number(u[n.key])})).filter(u=>!isNaN(u.val)).sort((u,E)=>E.val-u.val);if(a.length===0)return`No numeric data in ${n.label}.`;let l=a[0],c=o.find(u=>u.key==="name"||u.label.toLowerCase()==="name"),p=c?String(l.row[c.key]):`Row ${t.indexOf(l.row)+1}`;return`The highest ${n.label} is ${l.val.toLocaleString("en-IN")}, held by ${p}.`}if(/lowest|minimum|min|smallest|bottom/.test(r)){let n=s??i[0];if(!n)return"I could not find a column to analyze.";let a=t.map(u=>({row:u,val:Number(u[n.key])})).filter(u=>!isNaN(u.val)).sort((u,E)=>u.val-E.val);if(a.length===0)return`No numeric data in ${n.label}.`;let l=a[0],c=o.find(u=>u.key==="name"||u.label.toLowerCase()==="name"),p=c?String(l.row[c.key]):`Row ${t.indexOf(l.row)+1}`;return`The lowest ${n.label} is ${l.val.toLocaleString("en-IN")}, held by ${p}.`}if(/average|avg|mean/.test(r)){let n=s??i[0];if(!n)return"I could not find a column to analyze.";let a=t.map(c=>Number(c[n.key])).filter(c=>!isNaN(c));if(a.length===0)return`No numeric data in ${n.label}.`;let l=a.reduce((c,p)=>c+p,0)/a.length;return`The average ${n.label} is ${Math.round(l).toLocaleString("en-IN")}.`}if(/sum|total/.test(r)){let n=s??i[0];if(!n)return"I could not find a column to analyze.";let a=t.map(c=>Number(c[n.key])).filter(c=>!isNaN(c));if(a.length===0)return`No numeric data in ${n.label}.`;let l=a.reduce((c,p)=>c+p,0);return`The total ${n.label} is ${l.toLocaleString("en-IN")}.`}if(/who|where|which|whose/.test(r)){let n=r.match(/\b([a-z]{3,})\b/g)?.filter(p=>!["who","where","which","whose","is","the","has","have"].includes(p));if(!n)return"I need a name to look up.";let a=n.join(" "),l=t.find(p=>Object.values(p).some(u=>String(u).toLowerCase().includes(a.toLowerCase())));return l?o.map(p=>`${p.label}: ${l[p.key]}`).join(", "):`I could not find anyone matching "${a}".`}return"I understand you have a question. Try asking 'highest salary' or 'how many rows'."}function Lr(e="en-US"){let[t,o]=(0,q.useState)(!1),[r,i]=(0,q.useState)(""),[s,n]=(0,q.useState)(!0),a=(0,q.useRef)(null);(0,q.useEffect)(()=>{if(typeof window>"u")return;let p=window.SpeechRecognition||window.webkitSpeechRecognition;if(!p){n(!1);return}let u=new p;u.continuous=!1,u.interimResults=!1,u.lang=e,u.onresult=E=>{let L=E.results[0][0].transcript;i(L),o(!1)},u.onerror=()=>o(!1),u.onend=()=>o(!1),a.current=u},[e]);let l=(0,q.useCallback)(()=>{if(a.current){i(""),o(!0);try{a.current.start()}catch{o(!1)}}},[]),c=(0,q.useCallback)(()=>{a.current?.stop(),o(!1)},[]);return{listening:t,transcript:r,supported:s,start:l,stop:c}}function Rr(e,t="en-US"){if(typeof window>"u"||!window.speechSynthesis)return;window.speechSynthesis.cancel();let o=new SpeechSynthesisUtterance(e);o.lang=t,o.rate=1,o.pitch=1,window.speechSynthesis.speak(o)}function Ir({data:e,columns:t,onSearch:o,onSort:r,theme:i="light",language:s="en-US"}){let[n,a]=(0,q.useState)(!1),[l,c]=(0,q.useState)(""),[p,u]=(0,q.useState)([{role:"ai",text:"Hi! Ask me anything about your data \u2014 like 'highest salary' or 'how many rows'. You can also say 'search Sandeep' or 'sort age descending'.",time:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}]),E=(0,q.useRef)(null),{listening:L,transcript:W,supported:I,start:v,stop:O}=Lr(s),k=i==="dark",b={bg:k?"#0F172A":"#FFFFFF",surface:k?"#1E293B":"#F8FAFC",border:k?"#334155":"#E2E8F0",text:k?"#F1F5F9":"#0F172A",muted:k?"#94A3B8":"#64748B",accent:"#10B981",userMsg:k?"#334155":"#DBEAFE",aiMsg:k?"#1E293B":"#F0FDF4"};(0,q.useEffect)(()=>{E.current?.scrollIntoView({behavior:"smooth"})},[p]),(0,q.useEffect)(()=>{W&&$(W)},[W]);let $=h=>{if(!h.trim())return;let z=new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});u(G=>[...G,{role:"user",text:h,time:z}]),c("");let A=Cr(h),x="";if(A.type==="search")o(A.payload),x=`Searching for "${A.payload}"...`;else if(A.type==="sort"&&r){let{key:G,dir:B}=A.payload;G?(r(G,B),x=`Sorted by ${G} (${B==="asc"?"ascending":"descending"}).`):x="Which column should I sort? Try 'sort by salary'."}else A.type==="question"&&(x=Er(A.payload,e,t));setTimeout(()=>{let G=new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});u(B=>[...B,{role:"ai",text:x,time:G}]),Rr(x,s)},400)},S=()=>$(l),N=["highest salary","how many rows","average age","search sandeep"];return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)("button",{onClick:()=>a(!n),"aria-label":n?"Close AI assistant":"Open AI assistant",style:{position:"fixed",bottom:24,right:24,zIndex:9998,width:56,height:56,borderRadius:28,background:b.accent,color:"#FFFFFF",border:"none",cursor:"pointer",boxShadow:"0 8px 20px rgba(16,185,129,0.3)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:20,transition:"transform 0.2s"},onMouseEnter:h=>h.currentTarget.style.transform="scale(1.1)",onMouseLeave:h=>h.currentTarget.style.transform="scale(1)",children:n?"\u2715":"\u{1F916}"}),n&&(0,P.jsxs)("div",{role:"dialog","aria-label":"AI Grid Assistant",style:{position:"fixed",bottom:90,right:24,width:360,maxWidth:"calc(100vw - 48px)",height:480,maxHeight:"70vh",background:b.bg,border:`1px solid ${b.border}`,borderRadius:16,boxShadow:"0 20px 40px rgba(0,0,0,0.15)",zIndex:9997,display:"flex",flexDirection:"column",overflow:"hidden",fontFamily:"system-ui, sans-serif"},children:[(0,P.jsxs)("div",{style:{padding:"14px 16px",background:b.accent,color:"#FFFFFF",display:"flex",alignItems:"center",gap:10},children:[(0,P.jsx)("span",{style:{fontSize:22},children:"\u{1F916}"}),(0,P.jsxs)("div",{style:{flex:1},children:[(0,P.jsx)("div",{style:{fontWeight:700,fontSize:15},children:"Grid AI Assistant"}),(0,P.jsx)("div",{style:{fontSize:11,opacity:.9},children:I?"Voice + Chat \xB7 Offline \xB7 Free":"Chat only (voice not supported)"})]}),(0,P.jsx)("button",{onClick:()=>a(!1),"aria-label":"Close",style:{background:"transparent",border:"none",color:"#FFFFFF",cursor:"pointer",fontSize:20,padding:4},children:"\u2715"})]}),(0,P.jsxs)("div",{style:{flex:1,overflowY:"auto",padding:12,display:"flex",flexDirection:"column",gap:8},children:[p.map((h,z)=>(0,P.jsxs)("div",{style:{alignSelf:h.role==="user"?"flex-end":"flex-start",maxWidth:"85%",padding:"8px 12px",borderRadius:12,background:h.role==="user"?b.userMsg:b.aiMsg,color:b.text,fontSize:13.5,lineHeight:1.5},children:[(0,P.jsx)("div",{children:h.text}),(0,P.jsx)("div",{style:{fontSize:10,opacity:.6,marginTop:4,textAlign:"right"},children:h.time})]},z)),L&&(0,P.jsx)("div",{style:{alignSelf:"flex-end",padding:"8px 12px",borderRadius:12,background:"#FEE2E2",color:"#991B1B",fontSize:13.5,fontStyle:"italic"},children:"\u{1F3A4} Listening..."}),(0,P.jsx)("div",{ref:E})]}),(0,P.jsx)("div",{style:{padding:"6px 12px",borderTop:`1px solid ${b.border}`,display:"flex",gap:6,overflowX:"auto",flexShrink:0},children:N.map(h=>(0,P.jsx)("button",{onClick:()=>$(h),style:{padding:"4px 10px",borderRadius:12,background:b.surface,border:`1px solid ${b.border}`,color:b.text,fontSize:11.5,cursor:"pointer",whiteSpace:"nowrap"},children:h},h))}),(0,P.jsxs)("div",{style:{padding:10,display:"flex",gap:6,borderTop:`1px solid ${b.border}`,background:b.surface},children:[(0,P.jsx)("input",{type:"text",value:l,onChange:h=>c(h.target.value),onKeyDown:h=>h.key==="Enter"&&S(),placeholder:"Ask or say a command...","aria-label":"Chat input",style:{flex:1,padding:"8px 12px",border:`1px solid ${b.border}`,borderRadius:8,background:b.bg,color:b.text,fontSize:13,outline:"none"}}),I&&(0,P.jsx)("button",{onClick:L?O:v,"aria-label":L?"Stop listening":"Start voice input",style:{width:36,height:36,borderRadius:8,background:L?"#EF4444":b.accent,color:"#FFFFFF",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",fontSize:16,flexShrink:0,animation:L?"yuktai-pulse 1s ease-in-out infinite":"none"},children:"\u{1F3A4}"}),(0,P.jsx)("button",{onClick:S,"aria-label":"Send",disabled:!l.trim(),style:{padding:"0 14px",background:l.trim()?b.accent:b.muted,color:"#FFFFFF",border:"none",borderRadius:8,cursor:l.trim()?"pointer":"not-allowed",fontSize:13,fontWeight:600,flexShrink:0},children:"Send"})]})]}),(0,P.jsx)("style",{children:`
1527
+ @keyframes yuktai-pulse {
1528
+ 0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
1529
+ 50% { transform: scale(1.1); box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
1530
+ }
1531
+ `})]})}var Jo=Ir;m();var Qo=require("react");m();function We(e,t){let o=t.trim().toLowerCase(),r=e.data.filter(s=>e.columns.some(n=>String(s[n.key]??"").toLowerCase().includes(o))),i=r.map(s=>String(s.id??"")).filter(Boolean);return e.onHighlightRows?.(i),{success:!0,message:`${r.length} row(s) found.`,data:r}}function Be(e){return{success:!0,message:`${e.data.length} row(s).`,data:e.data.length}}function _e(e){return{success:!0,message:"Grid columns retrieved.",data:e.columns}}function De(e,t){let o=e.data.find(r=>String(r.id??"")===t);return o?{success:!0,message:"Row found.",data:o}:{success:!1,message:`Row "${t}" not found.`}}function qe(e,t){return e.onHighlightRows?.(t),{success:!0,message:`${t.length} row(s) highlighted.`,data:t}}function je(e,t){return e.onSelectRow?.(t),{success:!0,message:`Row "${t}" selected.`,data:t}}function Ye(e,t){return e.onOpenRow?.(t),{success:!0,message:`Row "${t}" opened.`,data:t}}function bt({data:e,columns:t,name:o="yuktai_grid",onSelectRow:r,onHighlightRows:i,onOpenRow:s}){return(0,Qo.useEffect)(()=>{let n=document.modelContext;if(!n)return;let a=new AbortController,l={data:e,columns:t,onSelectRow:r,onHighlightRows:i,onOpenRow:s};return(async()=>{await n.registerTool({name:`${o}_search`,title:"Search Grid",description:"Search the grid.",inputSchema:{type:"object",properties:{query:{type:"string"}},required:["query"]},execute:async({query:p})=>We(l,p)},{signal:a.signal}),await n.registerTool({name:`${o}_count`,title:"Count Grid",description:"Count grid rows.",inputSchema:{type:"object",properties:{}},execute:async()=>Be(l)},{signal:a.signal}),await n.registerTool({name:`${o}_columns`,title:"Get Grid Columns",description:"Get grid columns.",inputSchema:{type:"object",properties:{}},execute:async()=>_e(l)},{signal:a.signal}),await n.registerTool({name:`${o}_get_row`,title:"Get Grid Row",description:"Get a grid row by ID.",inputSchema:{type:"object",properties:{id:{type:"string"}},required:["id"]},execute:async({id:p})=>De(l,p)},{signal:a.signal}),await n.registerTool({name:`${o}_highlight`,title:"Highlight Grid Rows",description:"Highlight grid rows.",inputSchema:{type:"object",properties:{ids:{type:"array",items:{type:"string"}}},required:["ids"]},execute:async({ids:p})=>qe(l,p)},{signal:a.signal}),await n.registerTool({name:`${o}_select`,title:"Select Grid Row",description:"Select a grid row.",inputSchema:{type:"object",properties:{id:{type:"string"}},required:["id"]},execute:async({id:p})=>je(l,p)},{signal:a.signal}),await n.registerTool({name:`${o}_open`,title:"Open Grid Row",description:"Open a grid row.",inputSchema:{type:"object",properties:{id:{type:"string"}},required:["id"]},execute:async({id:p})=>Ye(l,p)},{signal:a.signal})})().catch(()=>{}),()=>{a.abort()}},[e,t,o,r,i,s]),null}m();var Ve=require("react");function yt({tools:e,onResult:t,onError:o}){let[r,i]=(0,Ve.useState)(!1),s=(0,Ve.useCallback)(async(n,a={})=>{let l=e.find(c=>c.name===n);if(!l){let c=new Error(`Tool "${n}" not found.`);throw o?.(c),c}i(!0);try{let c=await l.execute(a);return t?.(c),c}catch(c){let p=c instanceof Error?c:new Error(String(c));throw o?.(p),p}finally{i(!1)}},[e,t,o]);return{loading:r,tools:e,executeTool:s}}var en=yt;m();m();var tn=require("react/jsx-runtime");function j({size:e=20,color:t="currentColor",strokeWidth:o=2.5,label:r,children:i,...s}){return(0,tn.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!r?"true":void 0,"aria-label":r,role:r?"img":void 0,focusable:"false",...s,children:i})}m();var ve=require("react/jsx-runtime");function ht(e){return(0,ve.jsxs)(j,{...e,children:[(0,ve.jsx)("circle",{cx:"11",cy:"11",r:"7"}),(0,ve.jsx)("path",{d:"m20 20-4-4"})]})}m();var ke=require("react/jsx-runtime");function xt(e){return(0,ke.jsxs)(j,{...e,children:[(0,ke.jsx)("path",{d:"M12 19V5"}),(0,ke.jsx)("path",{d:"m5 12 7-7 7 7"})]})}m();var Se=require("react/jsx-runtime");function wt(e){return(0,Se.jsxs)(j,{...e,children:[(0,Se.jsx)("path",{d:"M12 5v14"}),(0,Se.jsx)("path",{d:"m5 12 7 7 7-7"})]})}m();var vt=require("react/jsx-runtime");function kt(e){return(0,vt.jsx)(j,{...e,children:(0,vt.jsx)("path",{d:"m15 18-6-6 6-6"})})}m();var St=require("react/jsx-runtime");function Tt(e){return(0,St.jsx)(j,{...e,children:(0,St.jsx)("path",{d:"m9 18 6-6-6-6"})})}m();var At=require("react/jsx-runtime");function Ct(e){return(0,At.jsx)(j,{...e,children:(0,At.jsx)("path",{d:"M5 12.5 10 17.5 19.5 7"})})}m();var Te=require("react/jsx-runtime");function Et(e){return(0,Te.jsxs)(j,{...e,children:[(0,Te.jsx)("path",{d:"M18 6 6 18"}),(0,Te.jsx)("path",{d:"m6 6 12 12"})]})}function Mr(){if(typeof globalThis>"u")return new ie;if(!globalThis.__yuktai_runtime__){let e=new ie;e.register(U.name,U),e.register(xe.name,xe),e.register(we.name,we),globalThis.__yuktai_runtime__=e}return globalThis.__yuktai_runtime__}var on=typeof window<"u"?Mr():new ie,Pr={wcagPlugin:U,list(){return on.getPlugins()},use(e){return on.use(e)},fix(e){return U.applyFixes({enabled:!0,autoFix:!0,...e})},scan(){return U.scan()}};