@yuktishaalaa/yuktai 4.1.2 → 4.1.4

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 Xo=Object.create;var He=Object.defineProperty;var Zo=Object.getOwnPropertyDescriptor;var Jo=Object.getOwnPropertyNames;var Qo=Object.getPrototypeOf,en=Object.prototype.hasOwnProperty;var ce=(e,t)=>()=>(e&&(t=e(e=0)),t);var ye=(e,t)=>{for(var o in t)He(e,o,{get:t[o],enumerable:!0})},Lt=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Jo(t))!en.call(e,a)&&a!==o&&He(e,a,{get:()=>t[a],enumerable:!(r=Zo(t,a))||r.enumerable});return e};var Ke=(e,t,o)=>(o=e!=null?Xo(Qo(e)):{},Lt(t||!e||!e.__esModule?He(o,"default",{value:e,enumerable:!0}):o,e)),tn=e=>Lt(He({},"__esModule",{value:!0}),e);var m=ce(()=>{});var eo={};ye(eo,{askPage:()=>it});function En(){return new Promise(e=>{let t=setTimeout(e,1500),o=new MutationObserver(()=>{clearTimeout(t),t=setTimeout(()=>{o.disconnect(),e()},500)});o.observe(document.body,{childList:!0,subtree:!0})})}function Cn(){let e=[],t=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 a=o.getAttribute("aria-label");if(a&&a.length>10&&e.push(a),(o instanceof HTMLInputElement||o instanceof HTMLTextAreaElement)&&(o.placeholder&&e.push(o.placeholder),o.value&&e.push(o.value)),o instanceof HTMLButtonElement){let i=o.innerText||o.getAttribute("aria-label");i&&e.push(i)}}return e.join(" ").slice(0,3500)}async function it(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 En();let r=Cn();if(!r||r.length<100)return{success:!1,answer:"",error:"Page content not readable."};let a;try{a=await o.create({systemPrompt:`Answer ONLY using page content.
1
+ "use strict";var Xo=Object.create;var We=Object.defineProperty;var Zo=Object.getOwnPropertyDescriptor;var Jo=Object.getOwnPropertyNames;var Qo=Object.getPrototypeOf,en=Object.prototype.hasOwnProperty;var de=(e,t)=>()=>(e&&(t=e(e=0)),t);var he=(e,t)=>{for(var o in t)We(e,o,{get:t[o],enumerable:!0})},Ft=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Jo(t))!en.call(e,a)&&a!==o&&We(e,a,{get:()=>t[a],enumerable:!(r=Zo(t,a))||r.enumerable});return e};var Ze=(e,t,o)=>(o=e!=null?Xo(Qo(e)):{},Ft(t||!e||!e.__esModule?We(o,"default",{value:e,enumerable:!0}):o,e)),tn=e=>Ft(We({},"__esModule",{value:!0}),e);var m=de(()=>{});var eo={};he(eo,{askPage:()=>lt});function En(){return new Promise(e=>{let t=setTimeout(e,1500),o=new MutationObserver(()=>{clearTimeout(t),t=setTimeout(()=>{o.disconnect(),e()},500)});o.observe(document.body,{childList:!0,subtree:!0})})}function Cn(){let e=[],t=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 a=o.getAttribute("aria-label");if(a&&a.length>10&&e.push(a),(o instanceof HTMLInputElement||o instanceof HTMLTextAreaElement)&&(o.placeholder&&e.push(o.placeholder),o.value&&e.push(o.value)),o instanceof HTMLButtonElement){let i=o.innerText||o.getAttribute("aria-label");i&&e.push(i)}}return e.join(" ").slice(0,3500)}async function lt(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 En();let r=Cn();if(!r||r.length<100)return{success:!1,answer:"",error:"Page content not readable."};let a;try{a=await o.create({systemPrompt:`Answer ONLY using page content.
2
2
  Keep answer short (2\u20133 sentences).
3
3
  If not found say: "I could not find that on this page."`,outputLanguage:"en"})}catch{a=await o.create()}let i=`Page:
4
4
  ${r}
5
5
 
6
- Q: ${e}`,n=await a.prompt(i);return a?.destroy&&a.destroy(),{success:!0,answer:n?.trim()||"No answer found."}}catch(t){return{success:!1,answer:"",error:t instanceof Error?t.message:"Error occurred"}}}var st=ce(()=>{"use strict";m()});var dt={};ye(dt,{askPageWithTransformers:()=>ct,getModelLoadStatus:()=>xe,isTransformersSupported:()=>he});function ro(){return typeof navigator>"u"?!1:/Android|iPhone|iPad|iPod|Mobile|Tablet/i.test(navigator.userAgent)}function Ln(){if(ro())return"wasm";try{if(typeof navigator<"u"&&"gpu"in navigator&&navigator.gpu!==void 0)return"webgpu"}catch{}return"wasm"}async function Mn(){if(!lt){if(me){for(;me;)await new Promise(e=>setTimeout(e,200));return}me=!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=ro();console.log(`yuktai: Transformers.js \u2014 device: ${o}, mobile: ${r}`),oo=await e("feature-extraction","Xenova/all-MiniLM-L6-v2",{device:o,dtype:r?"q4":"fp32"}),no=await e("text2text-generation","Xenova/flan-t5-small",{device:o,dtype:r?"q4":"fp32"}),lt=!0,me=!1,console.log("yuktai: Transformers.js models loaded \u2705")}catch(e){throw me=!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 i=document.querySelector('meta[name="description"]')?.getAttribute("content")?.trim();return i&&!t.has(i)&&e.unshift(i),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 a=Math.min(o,Math.floor(t/2)),i=r.split(/\s+/),n=[],s=t-a;for(let c=0;c<i.length;c+=s){let p=i.slice(c,c+t).join(" ");p.trim().length>20&&n.push(p)}return n}function Fn(e,t){let o=0,r=0,a=0;for(let i=0;i<e.length;i++)o+=e[i]*t[i],r+=e[i]*e[i],a+=t[i]*t[i];return o/(Math.sqrt(r)*Math.sqrt(a)+1e-8)}async function to(e){let t=await oo(e,{pooling:"mean",normalize:!0}),o=t?.data??t;return Array.from(o)}async function Nn(e,t,o=3){let r=await to(e),a=await Promise.all(t.map(async i=>{let n=await to(i),s=Fn(r,n);return{chunk:i,score:s}}));return a.sort((i,n)=>n.score-i.score),a.slice(0,o).map(i=>i.chunk)}async function ct(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 i=`Answer the question based on the context. Give a complete answer in 2-3 sentences.
6
+ Q: ${e}`,n=await a.prompt(i);return a?.destroy&&a.destroy(),{success:!0,answer:n?.trim()||"No answer found."}}catch(t){return{success:!1,answer:"",error:t instanceof Error?t.message:"Error occurred"}}}var ct=de(()=>{"use strict";m()});var ut={};he(ut,{askPageWithTransformers:()=>pt,getModelLoadStatus:()=>ve,isTransformersSupported:()=>xe});function ro(){return typeof navigator>"u"?!1:/Android|iPhone|iPad|iPod|Mobile|Tablet/i.test(navigator.userAgent)}function Fn(){if(ro())return"wasm";try{if(typeof navigator<"u"&&"gpu"in navigator&&navigator.gpu!==void 0)return"webgpu"}catch{}return"wasm"}async function Ln(){if(!dt){if(fe){for(;fe;)await new Promise(e=>setTimeout(e,200));return}fe=!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=Fn(),r=ro();console.log(`yuktai: Transformers.js \u2014 device: ${o}, mobile: ${r}`),oo=await e("feature-extraction","Xenova/all-MiniLM-L6-v2",{device:o,dtype:r?"q4":"fp32"}),no=await e("text2text-generation","Xenova/flan-t5-small",{device:o,dtype:r?"q4":"fp32"}),dt=!0,fe=!1,console.log("yuktai: Transformers.js models loaded \u2705")}catch(e){throw fe=!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 Mn(){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 i=document.querySelector('meta[name="description"]')?.getAttribute("content")?.trim();return i&&!t.has(i)&&e.unshift(i),e.join(" ").slice(0,8e3)}function Pn(e,t=150,o=30){if(typeof e!="string")try{e=String(e??"")}catch{return[]}let r=e.trim();if(!r)return[];let a=Math.min(o,Math.floor(t/2)),i=r.split(/\s+/),n=[],s=t-a;for(let c=0;c<i.length;c+=s){let p=i.slice(c,c+t).join(" ");p.trim().length>20&&n.push(p)}return n}function In(e,t){let o=0,r=0,a=0;for(let i=0;i<e.length;i++)o+=e[i]*t[i],r+=e[i]*e[i],a+=t[i]*t[i];return o/(Math.sqrt(r)*Math.sqrt(a)+1e-8)}async function to(e){let t=await oo(e,{pooling:"mean",normalize:!0}),o=t?.data??t;return Array.from(o)}async function zn(e,t,o=3){let r=await to(e),a=await Promise.all(t.map(async i=>{let n=await to(i),s=In(r,n);return{chunk:i,score:s}}));return a.sort((i,n)=>n.score-i.score),a.slice(0,o).map(i=>i.chunk)}async function pt(e){if(!e.trim())return{success:!1,answer:"",error:"Please type a question."};try{await Ln(),await Rn();let t=Mn();if(!t||t.length<50)return{success:!1,answer:"",error:"Not enough content on this page."};let o=Pn(t);if(o.length===0)return{success:!1,answer:"",error:"Could not process page content."};let i=`Answer the question based on the context. Give a complete answer in 2-3 sentences.
7
7
 
8
- Context: ${(await Nn(e,o,3)).join(" ").slice(0,1200)}
8
+ Context: ${(await zn(e,o,3)).join(" ").slice(0,1200)}
9
9
 
10
10
  Question: ${e}
11
11
 
12
- Answer:`,s=(await no(i,{max_new_tokens:120,min_new_tokens:10}))?.[0]?.generated_text?.trim()||"";return s?{success:!0,answer:s}:{success:!0,answer:"I could not find a specific answer on this page."}}catch(t){console.error("yuktai: Transformers RAG error",t);let o=t instanceof Error?t.message:"";return o.includes("Out of memory")||o.includes("memory")?{success:!1,answer:"",error:"Not enough device memory. Try on a device with more RAM or use desktop Chrome with Gemini Nano."}:{success:!1,answer:"",error:o||"Transformers.js error."}}}function he(){try{return typeof WebAssembly<"u"&&typeof Worker<"u"}catch{return!1}}function xe(){return lt?"ready":me?"loading":"idle"}var oo,no,me,lt,ve=ce(()=>{"use strict";m();oo=null,no=null,me=!1,lt=!1});function io(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,so,lo,co,po,uo,mo,fo,go,bo,yo,ho,xo,vo,wo,ko,So,Ao,To,Eo,Co,Lo,Mo,Ro,Po,Io=ce(()=>{"use strict";m();mt={blue:"#1a73e8",green:"#0d9488",purple:"#7c3aed",red:"#dc2626",orange:"#ea580c",teal:"#0891b2",indigo:"#4f46e5",gray:"#374151"},so=e=>`{
12
+ Answer:`,s=(await no(i,{max_new_tokens:120,min_new_tokens:10}))?.[0]?.generated_text?.trim()||"";return s?{success:!0,answer:s}:{success:!0,answer:"I could not find a specific answer on this page."}}catch(t){console.error("yuktai: Transformers RAG error",t);let o=t instanceof Error?t.message:"";return o.includes("Out of memory")||o.includes("memory")?{success:!1,answer:"",error:"Not enough device memory. Try on a device with more RAM or use desktop Chrome with Gemini Nano."}:{success:!1,answer:"",error:o||"Transformers.js error."}}}function xe(){try{return typeof WebAssembly<"u"&&typeof Worker<"u"}catch{return!1}}function ve(){return dt?"ready":fe?"loading":"idle"}var oo,no,fe,dt,we=de(()=>{"use strict";m();oo=null,no=null,fe=!1,dt=!1});function io(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 gt,so,lo,co,po,uo,mo,fo,go,bo,yo,ho,xo,vo,wo,ko,So,Ao,To,Eo,Co,Fo,Lo,Ro,Mo,Po=de(()=>{"use strict";m();gt={blue:"#1a73e8",green:"#0d9488",purple:"#7c3aed",red:"#dc2626",orange:"#ea580c",teal:"#0891b2",indigo:"#4f46e5",gray:"#374151"},so=e=>`{
13
13
  "name": "${e.toLowerCase().replace(/\s+/g,"-")}",
14
14
  "version": "0.1.0",
15
15
  "private": true,
@@ -941,7 +941,7 @@ export default function AuthPage() {
941
941
  </div>
942
942
  )
943
943
  }
944
- `,Lo=`.page {
944
+ `,Fo=`.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
- `,Mo=`import Link from "next/link"
1026
+ `,Lo=`import Link from "next/link"
1027
1027
 
1028
1028
  export default function NotFound() {
1029
1029
  return (
@@ -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
- `,Po=e=>`# ${e}
1063
+ `,Mo=e=>`# ${e}
1064
1064
 
1065
1065
  Generated by **yuktai Vibe Coder** \u2014 open source AI plugin for Next.js.
1066
1066
 
@@ -1088,10 +1088,10 @@ Edit any page to customise content.
1088
1088
  ---
1089
1089
 
1090
1090
  *Built with yuktai \u2014 aksharatantra.vercel.app*
1091
- `});var Fo={};ye(Fo,{generateZip:()=>Zn});function Xn(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 Zn(e){let t=(await import("jszip")).default,o=new t,r=mt[e.theme]||mt.blue,a=Xn(e.siteName,e.websiteType),i=new Date().getFullYear().toString(),n={SITE_NAME:e.siteName,THEME_COLOR:r,TAGLINE:a,YEAR:i},s=b=>io(b,n).replace(/\{\{SITE_NAME_LOWER\}\}/g,e.siteName.toLowerCase().replace(/\s+/g,""));o.file("package.json",so(e.siteName)),o.file("next.config.js",lo),o.file("tailwind.config.js",co(r)),o.file("tsconfig.json",Ro),o.file("README.md",Po(e.siteName)),o.file("postcss.config.js","module.exports = { plugins: { tailwindcss: {}, autoprefixer: {} } }"),o.file(".gitignore",`node_modules
1091
+ `});var Io={};he(Io,{generateZip:()=>Zn});function Xn(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 Zn(e){let t=(await import("jszip")).default,o=new t,r=gt[e.theme]||gt.blue,a=Xn(e.siteName,e.websiteType),i=new Date().getFullYear().toString(),n={SITE_NAME:e.siteName,THEME_COLOR:r,TAGLINE:a,YEAR:i},s=y=>io(y,n).replace(/\{\{SITE_NAME_LOWER\}\}/g,e.siteName.toLowerCase().replace(/\s+/g,""));o.file("package.json",so(e.siteName)),o.file("next.config.js",lo),o.file("tailwind.config.js",co(r)),o.file("tsconfig.json",Ro),o.file("README.md",Mo(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",po(r)),o.file("src/app/layout.tsx",s(uo)),o.file("src/app/not-found.tsx",Mo),o.file("src/components/Navbar.tsx",s(mo)),o.file("src/components/Navbar.module.css",fo),o.file("src/components/Footer.tsx",s(go)),o.file("src/components/Footer.module.css",bo);for(let b of e.pages)switch(b){case"home":o.file("src/app/page.tsx",s(yo)),o.file("src/app/page.module.css",ho);break;case"about":o.file("src/app/about/page.tsx",s(xo)),o.file("src/app/about/page.module.css",vo);break;case"contact":o.file("src/app/contact/page.tsx",s(wo)),o.file("src/app/contact/page.module.css",ko);break;case"services":o.file("src/app/services/page.tsx",s(So)),o.file("src/app/services/page.module.css",Ao);break;case"pricing":o.file("src/app/pricing/page.tsx",s(To)),o.file("src/app/pricing/page.module.css",Eo);break;case"auth":o.file("src/app/auth/page.tsx",s(Co)),o.file("src/app/auth/page.module.css",Lo);break;default:o.file(`src/app/${b}/page.tsx`,Jn(b,e.siteName,r,n,s));break}let c=await o.generateAsync({type:"blob"}),p=URL.createObjectURL(c),y=document.createElement("a");y.href=p,y.download=`${e.siteName.toLowerCase().replace(/\s+/g,"-")}-nextjs.zip`,document.body.appendChild(y),y.click(),document.body.removeChild(y),URL.revokeObjectURL(p)}function Jn(e,t,o,r,a){let i=e.charAt(0).toUpperCase()+e.slice(1);return`import styles from "./page.module.css"
1094
+ .DS_Store`),o.file("src/app/globals.css",po(r)),o.file("src/app/layout.tsx",s(uo)),o.file("src/app/not-found.tsx",Lo),o.file("src/components/Navbar.tsx",s(mo)),o.file("src/components/Navbar.module.css",fo),o.file("src/components/Footer.tsx",s(go)),o.file("src/components/Footer.module.css",bo);for(let y of e.pages)switch(y){case"home":o.file("src/app/page.tsx",s(yo)),o.file("src/app/page.module.css",ho);break;case"about":o.file("src/app/about/page.tsx",s(xo)),o.file("src/app/about/page.module.css",vo);break;case"contact":o.file("src/app/contact/page.tsx",s(wo)),o.file("src/app/contact/page.module.css",ko);break;case"services":o.file("src/app/services/page.tsx",s(So)),o.file("src/app/services/page.module.css",Ao);break;case"pricing":o.file("src/app/pricing/page.tsx",s(To)),o.file("src/app/pricing/page.module.css",Eo);break;case"auth":o.file("src/app/auth/page.tsx",s(Co)),o.file("src/app/auth/page.module.css",Fo);break;default:o.file(`src/app/${y}/page.tsx`,Jn(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 Jn(e,t,o,r,a){let i=e.charAt(0).toUpperCase()+e.slice(1);return`import styles from "./page.module.css"
1095
1095
 
1096
1096
  export default function ${i}Page() {
1097
1097
  return (
@@ -1117,7 +1117,7 @@ export default function ${i}Page() {
1117
1117
  </div>
1118
1118
  )
1119
1119
  }
1120
- `}var No=ce(()=>{"use strict";m();Io()});var Oo={};ye(Oo,{getPageText:()=>zo,highlightField:()=>Wo,runAgent:()=>ar,scanFormFields:()=>Ho,scrollToSection:()=>Bo});function ie(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 zo(){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 a=["h1","h2","h3","h4","h5","h6","p","blockquote","q","pre","code","li","dt","dd","th","td","caption","a","b","strong","em","i","u","s","abbr","acronym","cite","dfn","mark","small","sub","sup","ins","del","bdi","bdo","article","section","aside","nav","header","footer","main","summary","details","figcaption","figure","address","time","output","label","legend","option","button","font","center","span","div","[role='heading']","[role='main']","[role='article']","[role='region']","[role='complementary']","[role='contentinfo']","[role='navigation']","[role='banner']","[role='listitem']","[role='cell']","[role='columnheader']","[role='rowheader']"],i=document.querySelectorAll(a.join(","));for(let n of i){if(n.closest("[data-yuktai-panel]")||!ie(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 M=n.textContent?.trim();M&&M.length>10&&o(M)}let p=n.getAttribute("aria-label")?.trim();p&&p.length>5&&o(p);let y=n.getAttribute("aria-description")?.trim();y&&y.length>5&&o(y);let b=n.getAttribute("aria-valuetext")?.trim();b&&o(b);let U=n.getAttribute("title")?.trim();U&&U.length>5&&o(U);let O=n.getAttribute("data-label")?.trim();O&&o(O);let D=n.getAttribute("data-title")?.trim();D&&o(D),n.querySelectorAll("img").forEach(M=>{let k=M.getAttribute("alt")?.trim();k&&k.length>5&&o(k);let F=M.getAttribute("title")?.trim();F&&F.length>5&&o(F)})}document.querySelectorAll("img").forEach(n=>{if(n.closest("[data-yuktai-panel]")||!ie(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]")||!ie(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]")||ie(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]")||!ie(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]")||!ie(n))return;let s=n.innerText?.trim();s&&s.length>3&&s.length<100&&o(s)}),e.join(" ").slice(0,5e3)}function or(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 a=e.previousSibling;if(a?.nodeType===Node.TEXT_NODE){let c=a.textContent?.trim();if(c&&c.length>1)return c}let i=e.previousElementSibling;if(i){let c=i.innerText?.trim();if(c&&c.length>1&&c.length<60)return c}let n=e.closest("td, th");if(n){let c=n.previousElementSibling;if(c){let p=c.innerText?.trim();if(p&&p.length>1)return p}}let s=e.getAttribute("title")?.trim();return s||(e instanceof HTMLInputElement?e.type:"field")}function Ho(){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]")||!ie(o))continue;if(o instanceof HTMLInputElement){let a=o.type.toLowerCase();if(["submit","button","reset","image"].includes(a))continue}let r=or(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 Wo(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 Bo(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]")||!ie(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 nr(e,t,o){let r=window,a=r.LanguageModel||r.ai?.languageModel;if(!a)throw new Error("Gemini Nano not available");let i=await a.create({systemPrompt:`You are a helpful web accessibility agent.
1120
+ `}var zo=de(()=>{"use strict";m();Po()});var Oo={};he(Oo,{getPageText:()=>No,highlightField:()=>Bo,runAgent:()=>ar,scanFormFields:()=>Ho,scrollToSection:()=>Wo});function ie(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 No(){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 a=["h1","h2","h3","h4","h5","h6","p","blockquote","q","pre","code","li","dt","dd","th","td","caption","a","b","strong","em","i","u","s","abbr","acronym","cite","dfn","mark","small","sub","sup","ins","del","bdi","bdo","article","section","aside","nav","header","footer","main","summary","details","figcaption","figure","address","time","output","label","legend","option","button","font","center","span","div","[role='heading']","[role='main']","[role='article']","[role='region']","[role='complementary']","[role='contentinfo']","[role='navigation']","[role='banner']","[role='listitem']","[role='cell']","[role='columnheader']","[role='rowheader']"],i=document.querySelectorAll(a.join(","));for(let n of i){if(n.closest("[data-yuktai-panel]")||!ie(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 L=n.textContent?.trim();L&&L.length>10&&o(L)}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 Y=n.getAttribute("title")?.trim();Y&&Y.length>5&&o(Y);let O=n.getAttribute("data-label")?.trim();O&&o(O);let q=n.getAttribute("data-title")?.trim();q&&o(q),n.querySelectorAll("img").forEach(L=>{let S=L.getAttribute("alt")?.trim();S&&S.length>5&&o(S);let I=L.getAttribute("title")?.trim();I&&I.length>5&&o(I)})}document.querySelectorAll("img").forEach(n=>{if(n.closest("[data-yuktai-panel]")||!ie(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]")||!ie(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]")||ie(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]")||!ie(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]")||!ie(n))return;let s=n.innerText?.trim();s&&s.length>3&&s.length<100&&o(s)}),e.join(" ").slice(0,5e3)}function or(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 a=e.previousSibling;if(a?.nodeType===Node.TEXT_NODE){let c=a.textContent?.trim();if(c&&c.length>1)return c}let i=e.previousElementSibling;if(i){let c=i.innerText?.trim();if(c&&c.length>1&&c.length<60)return c}let n=e.closest("td, th");if(n){let c=n.previousElementSibling;if(c){let p=c.innerText?.trim();if(p&&p.length>1)return p}}let s=e.getAttribute("title")?.trim();return s||(e instanceof HTMLInputElement?e.type:"field")}function Ho(){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]")||!ie(o))continue;if(o instanceof HTMLInputElement){let a=o.type.toLowerCase();if(["submit","button","reset","image"].includes(a))continue}let r=or(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 Bo(e,t=3e3){e.scrollIntoView({behavior:"smooth",block:"center"}),e.style.outline="3px solid #0d9488",e.style.outlineOffset="3px";try{e.focus()}catch{}setTimeout(()=>{e.style.outline="",e.style.outlineOffset=""},t)}function Wo(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]")||!ie(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 nr(e,t,o){let r=window,a=r.LanguageModel||r.ai?.languageModel;if(!a)throw new Error("Gemini Nano not available");let i=await a.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
@@ -1129,12 +1129,12 @@ 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 i.prompt(s);return i.destroy(),c?.trim()||""}async function rr(e,t){let{askPageWithTransformers:o}=await Promise.resolve().then(()=>(ve(),dt));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=[],a=(i,n="info")=>{let s={text:i,type:n};r.push(s),o(s)};try{a("\u{1F4D6} Reading page content...","info");let i=zo(),n=Ho(),s=n.length>0;i.length<50&&a("\u26A0\uFE0F Page content is very limited. This may be a static image page.","error"),a(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"),a("\u{1F916} Creating action plan...","info");let c="";try{t==="gemini"?c=await nr(i,e,s):c=await rr(i,e)}catch{c=s?`1. Locate the form on this page
1132
+ Action plan:`,c=await i.prompt(s);return i.destroy(),c?.trim()||""}async function rr(e,t){let{askPageWithTransformers:o}=await Promise.resolve().then(()=>(we(),ut));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=[],a=(i,n="info")=>{let s={text:i,type:n};r.push(s),o(s)};try{a("\u{1F4D6} Reading page content...","info");let i=No(),n=Ho(),s=n.length>0;i.length<50&&a("\u26A0\uFE0F Page content is very limited. This may be a static image page.","error"),a(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"),a("\u{1F916} Creating action plan...","info");let c="";try{t==="gemini"?c=await nr(i,e,s):c=await rr(i,e)}catch{c=s?`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&&(a("\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=>a(` ${p}`,"action"))),s){let p=n[0];a(`\u{1F3AF} First field: "${p.label}"${p.required?" \u2605 required":""}`,"field"),Wo(p.element),n.length>1&&a(`\u{1F4DD} All ${n.length} fields: ${n.map(y=>y.label).join(" \u2192 ")}`,"info")}else{let p=e.toLowerCase().split(/\s+/).filter(b=>b.length>3),y=!1;for(let b of p)if(Bo(b)){a(`\u{1F3AF} Scrolled to relevant section: "${b}"`,"action"),y=!0;break}y||a("\u{1F4A1} Scroll through the page to find what you need.","info")}return a("\u2705 Ready. Follow the steps above. Ask me again if you need more help.","success"),{success:!0,steps:r}}catch(i){let n=i instanceof Error?i.message:"Agent error.";return a(`\u26A0\uFE0F ${n}`,"error"),{success:!1,steps:r,error:n}}}var $o=ce(()=>{"use strict";m()});var pr={};ye(pr,{CheckIcon:()=>xt,ChevronLeftIcon:()=>Le,ChevronRightIcon:()=>Me,CloseIcon:()=>vt,IconBase:()=>G,Runtime:()=>se,SearchIcon:()=>yt,SortDownIcon:()=>Ce,SortUpIcon:()=>Te,YuktAI:()=>dr,YuktAIWrapper:()=>je,YuktaiGrid:()=>Go,aiPlugin:()=>ke,default:()=>je,useGrid:()=>Ve,voicePlugin:()=>Se,wcag:()=>X,wcagPlugin:()=>X});module.exports=tn(pr);m();m();m();function Mt(){let e=window;return e.Rewriter||e.ai?.rewriter||null}async function Xe(){try{let e=Mt();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 on(e){if(!e||e.trim().length<20)return{success:!1,original:e,rewritten:e,error:"Text too short"};try{let t=Mt();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 Rt(){if(!await Xe())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 a=r.innerText?.trim();if(!a||a.length<20||r.closest("[data-yuktai-panel]"))continue;let i=await on(a);i.success&&i.rewritten!==a&&(r.dataset.yuktaiOriginal=a,r.innerText=i.rewritten,o++)}return{fixed:o}}function Pt(){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 It="yuktai-summary-box";function Ft(){let e=window;return e.Summarizer||e.ai?.summarizer||null}async function Ze(){try{let e=Ft();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 nn(){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 a=o.innerText?.trim();a&&a.length>10&&t.push(a)}return t.join(" ").slice(0,5e3)}async function Nt(){if(!await Ze())return{success:!1,summary:"",error:"Chrome Built-in AI Summarizer not available. Enable via chrome://flags."};let t=nn();if(!t||t.length<100)return{success:!1,summary:"",error:"Not enough text on this page to summarise."};try{let o=Ft();if(!o)throw new Error("Summarizer API not available");let r=await o.create({type:"tl;dr",format:"plain-text",length:"short",outputLanguage:"en"}),a=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(),rn(a.trim()),{success:!0,summary:a.trim()}}catch(o){return{success:!1,summary:"",error:o instanceof Error?o.message:"Summary failed"}}}function rn(e){We();let t=document.createElement("div");t.id=It,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(c&&(a("\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=>a(` ${p}`,"action"))),s){let p=n[0];a(`\u{1F3AF} First field: "${p.label}"${p.required?" \u2605 required":""}`,"field"),Bo(p.element),n.length>1&&a(`\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(Wo(y)){a(`\u{1F3AF} Scrolled to relevant section: "${y}"`,"action"),h=!0;break}h||a("\u{1F4A1} Scroll through the page to find what you need.","info")}return a("\u2705 Ready. Follow the steps above. Ask me again if you need more help.","success"),{success:!0,steps:r}}catch(i){let n=i instanceof Error?i.message:"Agent error.";return a(`\u26A0\uFE0F ${n}`,"error"),{success:!1,steps:r,error:n}}}var $o=de(()=>{"use strict";m()});var ur={};he(ur,{CheckIcon:()=>vt,ChevronLeftIcon:()=>Me,ChevronRightIcon:()=>Pe,CloseIcon:()=>le,IconBase:()=>D,Runtime:()=>se,SearchIcon:()=>Ee,SortDownIcon:()=>Re,SortUpIcon:()=>Fe,YuktAI:()=>pr,YuktAIWrapper:()=>Ue,YuktaiGrid:()=>Go,aiPlugin:()=>Se,default:()=>Ue,useGrid:()=>Ye,voicePlugin:()=>Ae,wcag:()=>Z,wcagPlugin:()=>Z});module.exports=tn(ur);m();m();m();function Lt(){let e=window;return e.Rewriter||e.ai?.rewriter||null}async function Je(){try{let e=Lt();if(!e)return!1;if(typeof e.availability=="function"){let t=await e.availability();return t==="readily"||t==="available"||t==="downloadable"}return typeof e.capabilities=="function"?(await e.capabilities())?.available!=="no":typeof e.create=="function"}catch{return!1}}async function on(e){if(!e||e.trim().length<20)return{success:!1,original:e,rewritten:e,error:"Text too short"};try{let t=Lt();if(!t)throw new Error("Rewriter API not available");let o=await t.create({tone:"more-casual",format:"plain-text",length:"as-is",outputLanguage:"en"}),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 Rt(){if(!await Je())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 a=r.innerText?.trim();if(!a||a.length<20||r.closest("[data-yuktai-panel]"))continue;let i=await on(a);i.success&&i.rewritten!==a&&(r.dataset.yuktaiOriginal=a,r.innerText=i.rewritten,o++)}return{fixed:o}}function Mt(){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 Pt="yuktai-summary-box";function It(){let e=window;return e.Summarizer||e.ai?.summarizer||null}async function Qe(){try{let e=It();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 nn(){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 a=o.innerText?.trim();a&&a.length>10&&t.push(a)}return t.join(" ").slice(0,5e3)}async function zt(){if(!await Qe())return{success:!1,summary:"",error:"Chrome Built-in AI Summarizer not available. Enable via chrome://flags."};let t=nn();if(!t||t.length<100)return{success:!1,summary:"",error:"Not enough text on this page to summarise."};try{let o=It();if(!o)throw new Error("Summarizer API not available");let r=await o.create({type:"tl;dr",format:"plain-text",length:"short",outputLanguage:"en"}),a=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(),rn(a.trim()),{success:!0,summary:a.trim()}}catch(o){return{success:!1,summary:"",error:o instanceof Error?o.message:"Summary failed"}}}function rn(e){Oe();let t=document.createElement("div");t.id=Pt,t.setAttribute("data-yuktai-panel","true"),t.setAttribute("role","region"),t.setAttribute("aria-label","Page summary by yuktai"),t.style.cssText=`
1138
1138
  position: fixed;
1139
1139
  top: 0;
1140
1140
  left: 0;
@@ -1155,7 +1155,7 @@ Action plan:`,c=await i.prompt(s);return i.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",We),t.appendChild(o),t.appendChild(r),document.body.prepend(t)}function We(){let e=document.getElementById(It);e&&e.remove()}m();var Oe=[{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"}],Be="en";function an(){let e=window;return e.Translator||e.translation||null}async function sn(e){try{let t=window;if(!an())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 ln(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 zt(e){if(e===Be)return{success:!0,language:e,fixed:0};if(e==="en")return Je(),Be="en",{success:!0,language:"en",fixed:0};if(!await sn(e))return{success:!1,language:e,fixed:0,error:`Translation to ${e} not available. Enable via chrome://flags.`};try{let o=await ln(e),r=document.querySelectorAll("p, h1, h2, h3, h4, h5, h6, li, blockquote, td, th, label, figcaption, span, a"),a=0;for(let i of r){if(i.closest("[data-yuktai-panel]")||i.children.length>0)continue;let n=i.innerText?.trim();if(!n||n.length<2)continue;i.dataset.yuktaiTranslationOriginal||(i.dataset.yuktaiTranslationOriginal=n);let s=await o.translate(n);s&&s!==n&&(i.innerText=s,a++)}return typeof o.destroy=="function"&&o.destroy(),Be=e,{success:!0,language:e,fixed:a}}catch(o){return{success:!1,language:e,fixed:0,error:o instanceof Error?o.message:"Translation failed"}}}function Je(){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)}Be="en"}m();var cn=[{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"}],ee=null,$e=!1,de=null;function Qe(){return!!(window.SpeechRecognition||window.webkitSpeechRecognition)}function dn(e){let t=e.toLowerCase().trim();for(let o of cn)for(let r of o.phrases)if(t.includes(r))return{action:o.action,label:o.label};return null}function pn(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=Ht(),o=t.indexOf(document.activeElement),r=t[o+1]||t[0];r&&r.focus();break}case"tab-back":{let t=Ht(),o=t.indexOf(document.activeElement),r=t[o-1]||t[t.length-1];r&&r.focus();break}case"stop-voice":{et();break}}}function Ht(){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 Wt(e){if(!Qe())return!1;if($e)return!0;e&&(de=e);let t=window.SpeechRecognition||window.webkitSpeechRecognition;return ee=new t,ee.continuous=!0,ee.interimResults=!1,ee.lang="en-US",ee.onresult=o=>{let r=o.results[o.results.length-1][0].transcript,a=dn(r);if(a){pn(a.action);let i={success:!0,command:r,action:a.label};if(de&&de(i),a.action==="stop-voice")return}},ee.onend=()=>{$e&&ee?.start()},ee.onerror=o=>{o.error!=="no-speech"&&de&&de({success:!1,command:"",action:"",error:`Voice error: ${o.error}`})},ee.start(),$e=!0,un(),!0}function et(){$e=!1,ee&&(ee.stop(),ee=null),de=null,Ot()}var Bt="yuktai-voice-indicator";function un(){Ot();let e=document.createElement("div");e.id=Bt,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",Oe),t.appendChild(o),t.appendChild(r),document.body.prepend(t)}function Oe(){let e=document.getElementById(Pt);e&&e.remove()}m();var _e=[{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"}],$e="en";function an(){let e=window;return e.Translator||e.translation||null}async function sn(e){try{let t=window;if(!an())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 ln(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 Nt(e){if(e===$e)return{success:!0,language:e,fixed:0};if(e==="en")return et(),$e="en",{success:!0,language:"en",fixed:0};if(!await sn(e))return{success:!1,language:e,fixed:0,error:`Translation to ${e} not available. Enable via chrome://flags.`};try{let o=await ln(e),r=document.querySelectorAll("p, h1, h2, h3, h4, h5, h6, li, blockquote, td, th, label, figcaption, span, a"),a=0;for(let i of r){if(i.closest("[data-yuktai-panel]")||i.children.length>0)continue;let n=i.innerText?.trim();if(!n||n.length<2)continue;i.dataset.yuktaiTranslationOriginal||(i.dataset.yuktaiTranslationOriginal=n);let s=await o.translate(n);s&&s!==n&&(i.innerText=s,a++)}return typeof o.destroy=="function"&&o.destroy(),$e=e,{success:!0,language:e,fixed:a}}catch(o){return{success:!1,language:e,fixed:0,error:o instanceof Error?o.message:"Translation failed"}}}function et(){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)}$e="en"}m();var cn=[{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"}],ee=null,Ge=!1,pe=null;function tt(){return!!(window.SpeechRecognition||window.webkitSpeechRecognition)}function dn(e){let t=e.toLowerCase().trim();for(let o of cn)for(let r of o.phrases)if(t.includes(r))return{action:o.action,label:o.label};return null}function pn(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=Ht(),o=t.indexOf(document.activeElement),r=t[o+1]||t[0];r&&r.focus();break}case"tab-back":{let t=Ht(),o=t.indexOf(document.activeElement),r=t[o-1]||t[t.length-1];r&&r.focus();break}case"stop-voice":{ot();break}}}function Ht(){return Array.from(document.querySelectorAll('a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')).filter(e=>!e.closest("[data-yuktai-panel]"))}function Bt(e){if(!tt())return!1;if(Ge)return!0;e&&(pe=e);let t=window.SpeechRecognition||window.webkitSpeechRecognition;return ee=new t,ee.continuous=!0,ee.interimResults=!1,ee.lang="en-US",ee.onresult=o=>{let r=o.results[o.results.length-1][0].transcript,a=dn(r);if(a){pn(a.action);let i={success:!0,command:r,action:a.label};if(pe&&pe(i),a.action==="stop-voice")return}},ee.onend=()=>{Ge&&ee?.start()},ee.onerror=o=>{o.error!=="no-speech"&&pe&&pe({success:!1,command:"",action:"",error:`Voice error: ${o.error}`})},ee.start(),Ge=!0,un(),!0}function ot(){Ge=!1,ee&&(ee.stop(),ee=null),pe=null,Ot()}var Wt="yuktai-voice-indicator";function un(){Ot();let e=document.createElement("div");e.id=Wt,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 i.prompt(s);return i.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 Ot(){let e=document.getElementById(Bt);e&&e.remove()}m();var mn=["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 $t(){let e=window;return e.Writer||e.ai?.writer||null}async function tt(){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 fn(e){let t=[],o=e.innerText?.trim();o&&t.push(`element text: "${o}"`);let r=e.placeholder?.trim();r&&t.push(`placeholder: "${r}"`);let a=e.getAttribute("name")?.trim();a&&t.push(`name: "${a}"`);let i=e.getAttribute("type")?.trim();i&&t.push(`type: "${i}"`);let n=e.id;if(n){let p=document.querySelector(`label[for="${n}"]`);p&&t.push(`label: "${p.innerText?.trim()}"`)}let s=e.parentElement?.innerText?.trim().slice(0,60);s&&t.push(`parent context: "${s}"`),t.push(`tag: ${e.tagName.toLowerCase()}`);let c=e.getAttribute("role");return c&&t.push(`role: ${c}`),t.join(". ")}async function gn(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 Ot(){let e=document.getElementById(Wt);e&&e.remove()}m();var mn=["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 $t(){let e=window;return e.Writer||e.ai?.writer||null}async function nt(){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 fn(e){let t=[],o=e.innerText?.trim();o&&t.push(`element text: "${o}"`);let r=e.placeholder?.trim();r&&t.push(`placeholder: "${r}"`);let a=e.getAttribute("name")?.trim();a&&t.push(`name: "${a}"`);let i=e.getAttribute("type")?.trim();i&&t.push(`type: "${i}"`);let n=e.id;if(n){let p=document.querySelector(`label[for="${n}"]`);p&&t.push(`label: "${p.innerText?.trim()}"`)}let s=e.parentElement?.innerText?.trim().slice(0,60);s&&t.push(`parent context: "${s}"`),t.push(`tag: ${e.tagName.toLowerCase()}`);let c=e.getAttribute("role");return c&&t.push(`role: ${c}`),t.join(". ")}async function gn(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 i.prompt(s);return i.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 _t(){if(!await tt())return{success:!1,fixed:0,elements:[],error:"Chrome Built-in AI Writer not available. Enable via chrome://flags."};let t=document.querySelectorAll(mn);if(t.length===0)return{success:!0,fixed:0,elements:[]};try{let o=$t();if(!o)throw new Error("Writer API not available");let r=await o.create({tone:"neutral",format:"plain-text",length:"short",outputLanguage:"en"}),a=0,i=[];for(let n of t){if(n.closest("[data-yuktai-panel]"))continue;let s=window.getComputedStyle(n);if(s.display==="none"||s.visibility==="hidden")continue;let c=fn(n),p=await gn(r,c);p&&p.length>0&&(n.dataset.yuktaiLabelOriginal=n.getAttribute("aria-label")||"",n.setAttribute("aria-label",p),a++,i.push({tag:n.tagName.toLowerCase(),label:p}))}return r.destroy(),{success:!0,fixed:a,elements:i}}catch(o){return{success:!1,fixed:0,elements:[],error:o instanceof Error?o.message:"Label generation failed"}}}function Gt(){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 De=null,Dt=null;var qt=null,ot=null,z=null,pe=null,_e=null,nt=null,ue=null,Ge={deuteranopia:"yuktai-cb-d",protanopia:"yuktai-cb-p",tritanopia:"yuktai-cb-t"};var jt=new Set(["input","select","textarea"]);var rt={nav:"navigation",header:"banner",footer:"contentinfo",main:"main",aside:"complementary"};function at(e,t="polite"){if(typeof window>"u"||!ue?.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 Jt(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];z||(z=document.createElement("div"),z.setAttribute("role","alert"),z.setAttribute("aria-live","assertive"),z.setAttribute("aria-atomic","true"),z.style.cssText=`
1199
+ `.trim();return(await e.write(o)).trim().replace(/^["']|["']$/g,"").replace(/\.$/,"").trim()}async function _t(){if(!await nt())return{success:!1,fixed:0,elements:[],error:"Chrome Built-in AI Writer not available. Enable via chrome://flags."};let t=document.querySelectorAll(mn);if(t.length===0)return{success:!0,fixed:0,elements:[]};try{let o=$t();if(!o)throw new Error("Writer API not available");let r=await o.create({tone:"neutral",format:"plain-text",length:"short",outputLanguage:"en"}),a=0,i=[];for(let n of t){if(n.closest("[data-yuktai-panel]"))continue;let s=window.getComputedStyle(n);if(s.display==="none"||s.visibility==="hidden")continue;let c=fn(n),p=await gn(r,c);p&&p.length>0&&(n.dataset.yuktaiLabelOriginal=n.getAttribute("aria-label")||"",n.setAttribute("aria-label",p),a++,i.push({tag:n.tagName.toLowerCase(),label:p}))}return r.destroy(),{success:!0,fixed:a,elements:i}}catch(o){return{success:!1,fixed:0,elements:[],error:o instanceof Error?o.message:"Label generation failed"}}}function Gt(){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 je=null,Dt=null;var qt=null,rt=null,B=null,ue=null,De=null,at=null,me=null,qe={deuteranopia:"yuktai-cb-d",protanopia:"yuktai-cb-p",tritanopia:"yuktai-cb-t"};var jt=new Set(["input","select","textarea"]);var it={nav:"navigation",header:"banner",footer:"contentinfo",main:"main",aside:"complementary"};function st(e,t="polite"){if(typeof window>"u"||!me?.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 Jt(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];B||(B=document.createElement("div"),B.setAttribute("role","alert"),B.setAttribute("aria-live","assertive"),B.setAttribute("aria-atomic","true"),B.style.cssText=`
1200
1200
  position: fixed;
1201
1201
  top: 80px;
1202
1202
  right: 16px;
@@ -1215,14 +1215,14 @@ Action plan:`,c=await i.prompt(s);return i.destroy(),c?.trim()||""}async functio
1215
1215
  transition: transform 0.3s, opacity 0.3s;
1216
1216
  transform: translateX(120%);
1217
1217
  opacity: 0;
1218
- `,document.body.appendChild(z)),z.style.background=r.bg,z.style.border=`1px solid ${r.border}`,z.style.color="#fff",z.innerHTML=`
1218
+ `,document.body.appendChild(B)),B.style.background=r.bg,B.style.border=`1px solid ${r.border}`,B.style.color="#fff",B.innerHTML=`
1219
1219
  <span style="font-size:18px;font-weight:700">${r.icon}</span>
1220
1220
  <span style="flex:1;line-height:1.4">${e}</span>
1221
1221
  <button
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&&(z.style.right="8px",z.style.left="8px",z.style.maxWidth="none",z.style.width="auto"),requestAnimationFrame(()=>{z&&(z.style.transform="translateX(0)",z.style.opacity="1")}),setTimeout(()=>{z&&(z.style.transform="translateX(120%)",z.style.opacity="0")},5e3)}function C(e,t="info",o=!0){De&&(De.textContent=e),Jt(e,t),o&&at(e,t==="error"?"assertive":"polite")}function bn(){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=`
1225
+ `,window.innerWidth<=480&&(B.style.right="8px",B.style.left="8px",B.style.maxWidth="none",B.style.width="auto"),requestAnimationFrame(()=>{B&&(B.style.transform="translateX(0)",B.style.opacity="1")}),setTimeout(()=>{B&&(B.style.transform="translateX(120%)",B.style.opacity="0")},5e3)}function F(e,t="info",o=!0){je&&(je.textContent=e),Jt(e,t),o&&st(e,t==="error"?"assertive":"polite")}function bn(){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;
@@ -1247,7 +1247,7 @@ Action plan:`,c=await i.prompt(s);return i.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"}),C(`Jumped to ${a.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),qt=t}function yn(){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
+ `,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"}),F(`Jumped to ${a.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),qt=t}function yn(){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 i.prompt(s);return i.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 hn(){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",C("Dialog closed","info");return}let a=t.closest("[role='menu'],[role='menubar']");a&&(a.style.display="none",C("Menu closed","info"))}if(o==="menuitem"||t.closest("[role='menu'],[role='menubar']")){let r=t.closest("[role='menu'],[role='menubar']");if(!r)return;let a=Array.from(r.querySelectorAll("[role='menuitem']:not([disabled])")),i=a.indexOf(t);e.key==="ArrowDown"||e.key==="ArrowRight"?(e.preventDefault(),a[(i+1)%a.length]?.focus()):e.key==="ArrowUp"||e.key==="ArrowLeft"?(e.preventDefault(),a[(i-1+a.length)%a.length]?.focus()):e.key==="Home"?(e.preventDefault(),a[0]?.focus()):e.key==="End"&&(e.preventDefault(),a[a.length-1]?.focus())}if(o==="tab"||t.closest("[role='tablist']")){let r=t.closest("[role='tablist']");if(!r)return;let a=Array.from(r.querySelectorAll("[role='tab']:not([disabled])")),i=a.indexOf(t);if(e.key==="ArrowRight"||e.key==="ArrowDown"){e.preventDefault();let n=a[(i+1)%a.length];n?.focus(),n?.click()}else if(e.key==="ArrowLeft"||e.key==="ArrowUp"){e.preventDefault();let n=a[(i-1+a.length)%a.length];n?.focus(),n?.click()}}if(o==="option"||t.closest("[role='listbox']")){let r=t.closest("[role='listbox']");if(!r)return;let a=Array.from(r.querySelectorAll("[role='option']:not([aria-disabled='true'])")),i=a.indexOf(t);e.key==="ArrowDown"?(e.preventDefault(),a[(i+1)%a.length]?.focus()):e.key==="ArrowUp"?(e.preventDefault(),a[(i-1+a.length)%a.length]?.focus()):(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),t.setAttribute("aria-selected","true"),a.forEach(n=>{n!==t&&n.setAttribute("aria-selected","false")}),C(`Selected: ${t.textContent?.trim()}`,"success"))}e.altKey&&e.key==="a"&&(e.preventDefault(),xn()),e.key==="Tab"&&ue?.speechEnabled&&setTimeout(()=>{let r=document.activeElement;if(!r)return;let a=r.getAttribute("aria-label")||r.getAttribute("title")||r.textContent?.trim()||r.tagName.toLowerCase(),i=r.getAttribute("role")||r.tagName.toLowerCase();at(`${a}, ${i}`)},100)}))}function qe(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",a=>{a.key==="Tab"&&(a.shiftKey?document.activeElement===o&&(a.preventDefault(),r.focus()):document.activeElement===r&&(a.preventDefault(),o.focus()))})}function xn(){if(typeof document>"u")return;if(pe){pe.remove(),pe=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 hn(){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",F("Dialog closed","info");return}let a=t.closest("[role='menu'],[role='menubar']");a&&(a.style.display="none",F("Menu closed","info"))}if(o==="menuitem"||t.closest("[role='menu'],[role='menubar']")){let r=t.closest("[role='menu'],[role='menubar']");if(!r)return;let a=Array.from(r.querySelectorAll("[role='menuitem']:not([disabled])")),i=a.indexOf(t);e.key==="ArrowDown"||e.key==="ArrowRight"?(e.preventDefault(),a[(i+1)%a.length]?.focus()):e.key==="ArrowUp"||e.key==="ArrowLeft"?(e.preventDefault(),a[(i-1+a.length)%a.length]?.focus()):e.key==="Home"?(e.preventDefault(),a[0]?.focus()):e.key==="End"&&(e.preventDefault(),a[a.length-1]?.focus())}if(o==="tab"||t.closest("[role='tablist']")){let r=t.closest("[role='tablist']");if(!r)return;let a=Array.from(r.querySelectorAll("[role='tab']:not([disabled])")),i=a.indexOf(t);if(e.key==="ArrowRight"||e.key==="ArrowDown"){e.preventDefault();let n=a[(i+1)%a.length];n?.focus(),n?.click()}else if(e.key==="ArrowLeft"||e.key==="ArrowUp"){e.preventDefault();let n=a[(i-1+a.length)%a.length];n?.focus(),n?.click()}}if(o==="option"||t.closest("[role='listbox']")){let r=t.closest("[role='listbox']");if(!r)return;let a=Array.from(r.querySelectorAll("[role='option']:not([aria-disabled='true'])")),i=a.indexOf(t);e.key==="ArrowDown"?(e.preventDefault(),a[(i+1)%a.length]?.focus()):e.key==="ArrowUp"?(e.preventDefault(),a[(i-1+a.length)%a.length]?.focus()):(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),t.setAttribute("aria-selected","true"),a.forEach(n=>{n!==t&&n.setAttribute("aria-selected","false")}),F(`Selected: ${t.textContent?.trim()}`,"success"))}e.altKey&&e.key==="a"&&(e.preventDefault(),xn()),e.key==="Tab"&&me?.speechEnabled&&setTimeout(()=>{let r=document.activeElement;if(!r)return;let a=r.getAttribute("aria-label")||r.getAttribute("title")||r.textContent?.trim()||r.tagName.toLowerCase(),i=r.getAttribute("role")||r.tagName.toLowerCase();st(`${a}, ${i}`)},100)}))}function Ve(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",a=>{a.key==="Tab"&&(a.shiftKey?document.activeElement===o&&(a.preventDefault(),r.focus()):document.activeElement===r&&(a.preventDefault(),o.focus()))})}function xn(){if(typeof document>"u")return;if(ue){ue.remove(),ue=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 i.prompt(s);return i.destroy(),c?.trim()||""}async functio
1423
1423
  <span style="font-size:12px;color:#ccc;text-align:right;flex:1;margin-left:12px">${a}</span>
1424
1424
  </div>
1425
1425
  `).join("")}
1426
- `,e.querySelector("[data-yuktai-close]")?.addEventListener("click",()=>{e.remove(),pe=null}),e.addEventListener("keydown",r=>{r.key==="Escape"&&(e.remove(),pe=null)}),document.body.appendChild(e),pe=e,qe(e),C("Keyboard shortcuts opened. Press Escape to close.","info")}function vn(e){if(typeof document>"u"||!ue?.showAuditBadge||typeof window<"u"&&!window.location.hostname.includes("localhost")&&!window.location.hostname.includes("127.0.0.1"))return;ot&&ot.remove();let t=e.score,o=t>=90?"#0f9d58":t>=70?"#f29900":"#d93025",r=t>=90?"\u267F":t>=70?"\u26A0":"\u2715",a=document.createElement("button");a.setAttribute("aria-label",`Accessibility score: ${t} out of 100`),a.setAttribute("data-yuktai-badge","true"),a.style.cssText=`
1426
+ `,e.querySelector("[data-yuktai-close]")?.addEventListener("click",()=>{e.remove(),ue=null}),e.addEventListener("keydown",r=>{r.key==="Escape"&&(e.remove(),ue=null)}),document.body.appendChild(e),ue=e,Ve(e),F("Keyboard shortcuts opened. Press Escape to close.","info")}function vn(e){if(typeof document>"u"||!me?.showAuditBadge||typeof window<"u"&&!window.location.hostname.includes("localhost")&&!window.location.hostname.includes("127.0.0.1"))return;rt&&rt.remove();let t=e.score,o=t>=90?"#0f9d58":t>=70?"#f29900":"#d93025",r=t>=90?"\u267F":t>=70?"\u26A0":"\u2715",a=document.createElement("button");a.setAttribute("aria-label",`Accessibility score: ${t} out of 100`),a.setAttribute("data-yuktai-badge","true"),a.style.cssText=`
1427
1427
  position: fixed;
1428
1428
  bottom: 16px;
1429
1429
  left: 16px;
@@ -1442,7 +1442,7 @@ Action plan:`,c=await i.prompt(s);return i.destroy(),c?.trim()||""}async functio
1442
1442
  align-items: center;
1443
1443
  gap: 6px;
1444
1444
  transition: transform 0.15s;
1445
- `,a.innerHTML=`${r} ${t}/100 <span style="font-weight:400;opacity:0.85">${e.details.length} issues</span>`,a.addEventListener("click",()=>wn(e)),document.body.appendChild(a),ot=a}function wn(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
+ `,a.innerHTML=`${r} ${t}/100 <span style="font-weight:400;opacity:0.85">${e.details.length} issues</span>`,a.addEventListener("click",()=>wn(e)),document.body.appendChild(a),rt=a}function wn(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 i.prompt(s);return i.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",a=>{a.key==="Escape"&&o.remove()}),document.body.appendChild(o),qe(o)}function Qt(e){typeof document>"u"||(nt&&clearTimeout(nt),nt=setTimeout(()=>{if(_e)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",a=>{a.key==="Escape"&&o.remove()}),document.body.appendChild(o),Ve(o)}function Qt(e){typeof document>"u"||(at&&clearTimeout(at),at=setTimeout(()=>{if(De)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,19 @@ Action plan:`,c=await i.prompt(s);return i.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(),_e=null,C("Session extended. You have more time.","success"),ue?.timeoutWarning&&Qt(ue.timeoutWarning)}),r?.addEventListener("click",()=>{t.remove(),_e=null}),document.body.appendChild(t),_e=t,qe(t),C("Warning: Your session will expire soon. Do you need more time?","warning")},e*1e3))}function kn(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(#${Ge[e.colorBlindMode]})`;document.body.style.filter=o}else document.body.style.filter=""}function Sn(e){try{let t=localStorage.getItem("yuktai-a11y-prefs");t&&Object.assign(e,JSON.parse(t))}catch{}}async function Vt(e){if(e){if(!await Xe()){C("Plain English requires Chrome 127+","warning");return}C("Rewriting page in plain English...","info",!1);let o=await Rt();C(o.error?`Plain English failed: ${o.error}`:`${o.fixed} sections rewritten in plain English`,o.error?"error":"success",!1)}else Pt(),C("Original text restored","info",!1)}async function Ut(e){if(e){if(!await Ze()){C("Page summariser requires Chrome 127+","warning");return}C("Generating page summary...","info",!1);let o=await Nt();C(o.error?`Summary failed: ${o.error}`:"Page summary added at top",o.error?"error":"success",!1)}else We(),C("Page summary removed","info",!1)}async function Yt(e){if(e==="en"){Je(),C("Page restored to English","info",!1);return}C(`Translating page to ${e}...`,"info",!1);let t=await zt(e);C(t.error?`Translation failed: ${t.error}`:`Page translated to ${e}`,t.error?"error":"success",!1)}async function Kt(e){if(e){if(!Qe()){C("Voice control not supported in this browser","warning");return}Wt(t=>{t.success&&C(`Voice: ${t.action}`,"info",!1)}),C("Voice control started. Say a command.","success",!1)}else et(),C("Voice control stopped","info",!1)}async function Xt(e){if(e){if(!await tt()){C("Smart labels requires Chrome 127+","warning");return}C("Generating smart labels...","info",!1);let o=await _t();C(o.error?`Smart labels failed: ${o.error}`:`${o.fixed} elements labelled`,o.error?"error":"success",!1)}else Gt(),C("Smart labels removed","info",!1)}function An(){if(typeof document>"u"||De)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),De=e}function Tn(){if(typeof document>"u"||Dt)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(),De=null,F("Session extended. You have more time.","success"),me?.timeoutWarning&&Qt(me.timeoutWarning)}),r?.addEventListener("click",()=>{t.remove(),De=null}),document.body.appendChild(t),De=t,Ve(t),F("Warning: Your session will expire soon. Do you need more time?","warning")},e*1e3))}function kn(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(#${qe[e.colorBlindMode]})`;document.body.style.filter=o}else document.body.style.filter=""}function Sn(e){try{let t=localStorage.getItem("yuktai-a11y-prefs");t&&Object.assign(e,JSON.parse(t))}catch{}}async function Vt(e){if(e){if(!await Je()){F("Plain English requires Chrome 127+","warning");return}F("Rewriting page in plain English...","info",!1);let o=await Rt();F(o.error?`Plain English failed: ${o.error}`:`${o.fixed} sections rewritten in plain English`,o.error?"error":"success",!1)}else Mt(),F("Original text restored","info",!1)}async function Ut(e){if(e){if(!await Qe()){F("Page summariser requires Chrome 127+","warning");return}F("Generating page summary...","info",!1);let o=await zt();F(o.error?`Summary failed: ${o.error}`:"Page summary added at top",o.error?"error":"success",!1)}else Oe(),F("Page summary removed","info",!1)}async function Yt(e){if(e==="en"){et(),F("Page restored to English","info",!1);return}F(`Translating page to ${e}...`,"info",!1);let t=await Nt(e);F(t.error?`Translation failed: ${t.error}`:`Page translated to ${e}`,t.error?"error":"success",!1)}async function Kt(e){if(e){if(!tt()){F("Voice control not supported in this browser","warning");return}Bt(t=>{t.success&&F(`Voice: ${t.action}`,"info",!1)}),F("Voice control started. Say a command.","success",!1)}else ot(),F("Voice control stopped","info",!1)}async function Xt(e){if(e){if(!await nt()){F("Smart labels requires Chrome 127+","warning");return}F("Generating smart labels...","info",!1);let o=await _t();F(o.error?`Smart labels failed: ${o.error}`:`${o.fixed} elements labelled`,o.error?"error":"success",!1)}else Gt(),F("Smart labels removed","info",!1)}function An(){if(typeof document>"u"||je)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),je=e}function Tn(){if(typeof document>"u"||Dt)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="${Ge.deuteranopia}">
1508
+ <filter id="${qe.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="${Ge.protanopia}">
1512
+ <filter id="${qe.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="${Ge.tritanopia}">
1516
+ <filter id="${qe.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),Dt=e}function Zt(e){let t={critical:20,serious:10,moderate:5,minor:2},o=e.details.reduce((r,a)=>r+(t[a.severity]||0),0);return Math.max(0,Math.min(100,100-o))}var X={name:"yuktai-a11y",version:"4.0.0",observer:null,async execute(e){if(!e.enabled)return this.stopObserver(),"yuktai: disabled.";ue=e,Sn(e),An(),Tn(),yn(),hn(),e.showSkipLinks!==!1&&bn(),e.showPreferencePanel,kn(e);let t=this.applyFixes(e);t.score=Zt(t),e.showAuditBadge&&vn(t),e.timeoutWarning&&Qt(e.timeoutWarning),e.autoFix&&this.startObserver(e),e.plainEnglish&&await Vt(!0),e.summarisePage&&await Ut(!0),e.translateLanguage&&e.translateLanguage!=="en"&&await Yt(e.translateLanguage),e.voiceControl&&await Kt(!0),e.smartLabels&&await Xt(!0);let o=`${t.fixed} fixes applied. Score: ${t.score}/100.`;return C(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 a=(i,n,s,c)=>{t.details.push({tag:i,fix:n,severity:s,element:c.outerHTML.slice(0,100)}),t.fixed++};return r.forEach(i=>{let n=i,s=n.tagName.toLowerCase();if(s==="html"&&!n.getAttribute("lang")&&(n.setAttribute("lang","en"),a(s,'lang="en" added',"critical",n)),s==="meta"){let p=n.getAttribute("name"),y=n.getAttribute("content")||"";p==="viewport"&&y.includes("user-scalable=no")&&(n.setAttribute("content",y.replace("user-scalable=no","user-scalable=yes")),a(s,"user-scalable=yes restored","serious",n)),p==="viewport"&&/maximum-scale=1(?:[^0-9]|$)/.test(y)&&(n.setAttribute("content",y.replace(/maximum-scale=1(?=[^0-9]|$)/,"maximum-scale=5")),a(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"),a(s,'alt="" aria-hidden="true"',"serious",n))),s==="svg"&&(!n.getAttribute("aria-hidden")&&!n.getAttribute("aria-label")&&!i.querySelector("title")&&(n.setAttribute("aria-hidden","true"),a(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"),a(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),a(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"),a(s,"aria-label added (empty link)","critical",n)),p.target==="_blank"&&!p.rel?.includes("noopener")&&(p.rel="noopener noreferrer",t.fixed++)}if(jt.has(s)){let p=n;if(!n.getAttribute("aria-label")&&!n.getAttribute("aria-labelledby")){let y=n.getAttribute("placeholder")||n.getAttribute("name")||s;n.setAttribute("aria-label",y),a(s,`aria-label="${y}"`,"serious",n)}if(n.hasAttribute("required")&&!n.getAttribute("aria-required")&&(n.setAttribute("aria-required","true"),t.fixed++),s==="input"&&!p.autocomplete){let y=p.name||"";p.type==="email"||y.includes("email")?p.autocomplete="email":p.type==="tel"||y.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"),a(s,"scope added to <th>","moderate",n)),rt[s]&&!n.getAttribute("role")&&(n.setAttribute("role",rt[s]),a(s,`role="${rt[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"),a(s,`aria-live added on role=${c}`,"moderate",n)),c==="combobox"&&!n.getAttribute("aria-expanded")&&(n.setAttribute("aria-expanded","false"),a(s,'aria-expanded="false" on combobox',"serious",n)),(c==="checkbox"||c==="radio")&&!n.getAttribute("aria-checked")&&(n.setAttribute("aria-checked","false"),a(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=(a,i,n,s)=>e.details.push({tag:a,fix:i,severity:n,element:s.outerHTML.slice(0,100)});return o.forEach(a=>{let i=a,n=i.tagName.toLowerCase();(n==="a"||n==="button")&&!i.innerText?.trim()&&!i.getAttribute("aria-label")&&r(n,"needs aria-label (empty)","critical",i),n==="img"&&!i.hasAttribute("alt")&&r(n,"needs alt text","serious",i),jt.has(n)&&!i.getAttribute("aria-label")&&!i.getAttribute("aria-labelledby")&&r(n,"needs aria-label","serious",i),n==="iframe"&&!i.getAttribute("title")&&!i.getAttribute("aria-label")&&r(n,"iframe needs title","serious",i)}),e.fixed=e.details.length,e.score=Zt(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:C,speak:at,showVisualAlert:Jt,trapFocus:qe,handlePlainEnglish:Vt,handleSummarisePage:Ut,handleTranslate:Yt,handleVoiceControl:Kt,handleSmartLabels:Xt,SUPPORTED_LANGUAGES:Oe};m();m();var v=Ke(require("react"));m();var V=require("react");st();ve();var l=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},fe=[80,90,100,110,120,130],zn=[{value:"none",label:"None"},{value:"deuteranopia",label:"Deuteranopia"},{value:"protanopia",label:"Protanopia"},{value:"tritanopia",label:"Tritanopia"},{value:"achromatopsia",label:"Greyscale"}],Hn=["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,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 Bn({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:a=>t(a.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 ge({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 te({icon:e,label:t,desc:o,checked:r,onChange:a,disabled:i=!1,disabledReason:n,tip:s}){return(0,l.jsxs)("div",{title:i?n:s,style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 18px",gap:"12px"},children:[(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"10px",flex:1,minWidth:0},children:[(0,l.jsx)("span",{"aria-hidden":"true",style:{width:"32px",height:"32px",borderRadius:"8px",background:i?"#f1f5f9":"#f0fdfa",color:i?"#94a3b8":"#0d9488",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"15px",flexShrink:0,fontWeight:700},children:e}),(0,l.jsxs)("div",{style:{minWidth:0},children:[(0,l.jsx)("p",{style:{margin:0,fontSize:"13px",fontWeight:500,color:i?"#94a3b8":"#0f172a",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t}),(0,l.jsx)("p",{style:{margin:0,fontSize:"10px",color:"#94a3b8"},children:i?n:o})]})]}),(0,l.jsx)(Bn,{checked:r,onChange:a,label:`Toggle ${t}`,disabled:i})]})}function j(){return(0,l.jsx)("div",{style:{height:"1px",background:"#f1f5f9"}})}function we({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 ut=(0,V.forwardRef)(({position:e,settings:t,report:o,isActive:r,aiSupported:a,voiceSupported:i,set:n,onApply:s,onReset:c,onClose:p},y)=>{let{isMobile:b,isTablet:U}=Wn(),[O,D]=(0,V.useState)([]),[M,k]=(0,V.useState)(""),[F,R]=(0,V.useState)(""),[L,$]=(0,V.useState)(!1),[x,P]=(0,V.useState)(null),[H,B]=(0,V.useState)("idle");(0,V.useEffect)(()=>{let d=window;!!(d.LanguageModel||d.ai?.languageModel)&&a?P("gemini"):he()&&P("transformers")},[a]),(0,V.useEffect)(()=>{if(x!=="transformers")return;let d=setInterval(()=>{B(xe())},500);return()=>clearInterval(d)},[x]);let A=async()=>{if(!(!M.trim()||L)){if(!x){R("\u26A0\uFE0F No AI engine available on this device.");return}$(!0),R("");try{let d;x==="gemini"?d=await it(M):(B("loading"),d=await ct(M),B("ready")),R(d.success&&d.answer?d.answer.replace(/\*\*(.*?)\*\*/g,"$1").replace(/\*(.*?)\*/g,"$1").replace(/#+\s/g,"").trim():"\u26A0\uFE0F "+(d.error||"No answer found on this page"))}catch{R("\u26A0\uFE0F Failed to get answer. Please try again.")}$(!1)}};(0,V.useEffect)(()=>{(async()=>{try{let Q=window;if(!Q.queryLocalFonts)return;let T=await Q.queryLocalFonts(),Y=[...new Set(T.map(ne=>ne.family))].sort();D(Y.slice(0,50))}catch{}})()},[]);let S=x==="gemini"?"Gemini Nano":x==="transformers"?"Transformers.js \xB7 All devices":"Detecting...",J=x==="transformers"&&H==="loading"?"Loading AI model... (first time only)":"...",oe=b?{position:"fixed",bottom:0,left:0,right:0,zIndex:9999,background:"#fff",border:"1px solid #e2e8f0",borderRadius:"16px 16px 0 0",boxShadow:"0 -8px 32px rgba(0,0,0,0.12)",maxHeight:"90vh",overflowY:"auto",fontFamily:"system-ui,-apple-system,sans-serif",width:"100%"}:{position:"fixed",bottom:"84px",[e]:"24px",zIndex:9999,width:U?"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:y,role:"dialog","aria-modal":"true","aria-label":"yuktai accessibility preferences","data-yuktai-panel":"true",style:oe,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:b?"44px":"auto",minHeight:b?"44px":"auto",display:"flex",alignItems:"center",justifyContent:"center"},children:"\xD7"})]}),(0,l.jsx)(ge,{label:"\u267F Core Accessibility",concept:"Rule-based engine \u2014 works on all browsers and devices"}),(0,l.jsx)(we,{steps:["Toggle any feature on","Click Apply settings","Preferences saved automatically"]}),(0,l.jsx)(te,{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)(j,{}),(0,l.jsx)(te,{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)(j,{}),(0,l.jsx)(te,{icon:"\u{1F399}\uFE0F",label:"Voice control",desc:"Say commands to navigate the page",checked:t.voiceControl,onChange:d=>n("voiceControl",d),disabled:!i,disabledReason:"Not supported in this browser",tip:'Say "scroll down", "go to main", "click"'}),(0,l.jsx)(j,{}),(0,l.jsx)(ge,{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:a?"#f0fdfa":"#f5f3ff",borderRadius:"8px",border:`0.5px solid ${a?"#99f6e4":"#c4b5fd"}`,fontSize:"10px",color:a?"#0f766e":"#7c3aed",lineHeight:1.5},children:a?"\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."}),!a&&(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:Hn.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)(te,{icon:"\u{1F4DD}",label:"Plain English mode",desc:"Rewrites complex text in simple language",checked:t.plainEnglish,onChange:d=>n("plainEnglish",d),disabled:!a,disabledReason:"Enable Gemini Nano \u2014 see setup above",tip:"AI concept: LLM text rewriting"}),(0,l.jsx)(j,{}),(0,l.jsx)(te,{icon:"\u{1F4CB}",label:"Summarise page",desc:"3-sentence summary appears at top",checked:t.summarisePage,onChange:d=>n("summarisePage",d),disabled:!a,disabledReason:"Enable Gemini Nano \u2014 see setup above",tip:"AI concept: Abstractive summarisation"}),(0,l.jsx)(j,{}),(0,l.jsx)(te,{icon:"\u{1F3F7}\uFE0F",label:"Smart aria-labels",desc:"AI generates meaningful labels for elements",checked:t.smartLabels,onChange:d=>n("smartLabels",d),disabled:!a,disabledReason:"Enable Gemini Nano \u2014 see setup above",tip:"AI concept: Context-aware label generation"}),(0,l.jsx)(j,{}),(0,l.jsx)(ge,{label:"\u{1F441}\uFE0F Visual",concept:"CSS filter-based \u2014 works on all browsers and devices"}),(0,l.jsx)(we,{steps:["Toggle any visual mode","Changes apply instantly","Works on mobile and desktop"]}),(0,l.jsx)(te,{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)(j,{}),(0,l.jsx)(te,{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)(j,{}),(0,l.jsx)(te,{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)(j,{}),(0,l.jsx)(te,{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)(j,{}),(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:zn.map(d=>(0,l.jsx)("button",{onClick:()=>n("colorBlindMode",d.value),"aria-pressed":t.colorBlindMode===d.value,style:{padding:"4px 10px",borderRadius:"20px",fontSize:"11px",fontWeight:500,border:`1px solid ${t.colorBlindMode===d.value?"#0d9488":"#e2e8f0"}`,background:t.colorBlindMode===d.value?"#f0fdfa":"#fff",color:t.colorBlindMode===d.value?"#0d9488":"#64748b",cursor:"pointer",minHeight:b?"36px":"auto"},children:d.label},d.value))})]}),(0,l.jsx)(j,{}),(0,l.jsx)(ge,{label:"\u{1F524} Font",concept:"Browser Font API + CSS \u2014 Chrome 103+"}),(0,l.jsx)(we,{steps:["Toggle dyslexia font or pick from device","Adjust size with + / \u2212","Saved across visits"]}),(0,l.jsx)(te,{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)(j,{}),(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+"}),O.length>0?(0,l.jsxs)("select",{value:t.localFont,onChange:d=>n("localFont",d.target.value),"aria-label":"Choose a font from your device",style:{width:"100%",padding:"8px 10px",borderRadius:"8px",border:"1px solid #e2e8f0",fontSize:"13px",color:"#0f172a",background:"#fff",cursor:"pointer",height:b?"44px":"36px"},children:[(0,l.jsx)("option",{value:"",children:"System default"}),O.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)(j,{}),(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=fe.indexOf(t.fontScale);d>0&&n("fontScale",fe[d-1])},disabled:t.fontScale<=80,"aria-label":"Decrease text size",style:{width:b?"44px":"30px",height:b?"44px":"30px",borderRadius:"8px",border:"1px solid #e2e8f0",background:"#fff",cursor:t.fontScale<=80?"not-allowed":"pointer",fontSize:"16px",color:t.fontScale<=80?"#cbd5e1":"#0f172a",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:"\u2212"}),(0,l.jsx)("div",{style:{flex:1,display:"flex",gap:"3px"},children:fe.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=fe.indexOf(t.fontScale);d<fe.length-1&&n("fontScale",fe[d+1])},disabled:t.fontScale>=130,"aria-label":"Increase text size",style:{width:b?"44px":"30px",height:b?"44px":"30px",borderRadius:"8px",border:"1px solid #e2e8f0",background:"#fff",cursor:t.fontScale>=130?"not-allowed":"pointer",fontSize:"16px",color:t.fontScale>=130?"#cbd5e1":"#0f172a",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:"+"})]})]}),(0,l.jsx)(j,{}),(0,l.jsx)(ge,{label:"\u{1F310} Translate",color:"#7c3aed",badge:"Gemini Nano",concept:"Chrome Translation API \u2014 on device, no internet after setup"}),(0,l.jsx)(we,{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:Oe.slice(0,b?8:18).map(d=>(0,l.jsx)("button",{onClick:()=>n("translateLanguage",d.code),"aria-pressed":t.translateLanguage===d.code,disabled:!a,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:a?"pointer":"not-allowed",opacity:a?1:.5,minHeight:b?"36px":"auto"},children:d.label},d.code))}),!a&&(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)(j,{}),(0,l.jsx)(ge,{label:"\u{1F4AC} Ask This Page",color:"#0d9488",badge:S,concept:"RAG \u2014 Retrieval Augmented Generation. Works on all devices including mobile."}),(0,l.jsx)(we,{steps:["Type any question about this page","Press Ask or hit Enter",x==="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:x==="gemini"?"#f0fdfa":x==="transformers"?"#f5f3ff":"#f8fafc",borderRadius:"8px",border:`0.5px solid ${x==="gemini"?"#99f6e4":x==="transformers"?"#c4b5fd":"#e2e8f0"}`,fontSize:"10px",color:x==="gemini"?"#0f766e":x==="transformers"?"#7c3aed":"#94a3b8"},children:[x==="gemini"&&"\u2705 Using Gemini Nano \u2014 on device, private, instant",x==="transformers"&&"\u2705 Using Transformers.js \u2014 works on mobile and all browsers",!x&&"\u23F3 Detecting AI engine...",x==="transformers"&&H==="loading"&&" \xB7 Loading model...",x==="transformers"&&H==="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:M,onChange:d=>k(d.target.value),onKeyDown:d=>{d.key==="Enter"&&A()},placeholder:"e.g. What does this page do?",disabled:L||!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:b?"44px":"36px"}}),(0,l.jsx)("button",{onClick:A,disabled:L||!M.trim()||!x,"aria-label":"Ask question",style:{padding:"8px 14px",borderRadius:"8px",border:"none",background:x&&M.trim()&&!L?"#0d9488":"#e2e8f0",color:x&&M.trim()&&!L?"#fff":"#94a3b8",fontSize:"12px",fontWeight:600,cursor:x&&M.trim()&&!L?"pointer":"not-allowed",flexShrink:0,height:b?"44px":"36px",minWidth:"52px",transition:"background 0.2s"},children:L?J:"Ask"})]}),F&&(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"}),F,(0,l.jsx)("button",{onClick:()=>{R(""),k("")},style:{display:"block",marginTop:"6px",background:"none",border:"none",color:"#94a3b8",fontSize:"10px",cursor:"pointer",padding:0},children:"Clear"})]})]}),o&&(0,l.jsx)("div",{role:"status",style:{margin:"0 14px 10px",padding:"8px 12px",background:"#f0fdfa",border:"1px solid #99f6e4",borderRadius:"8px",fontSize:"12px",color:"#0f766e",fontWeight:500,fontFamily:"monospace"},children:o.fixed>0?`\u2713 ${o.fixed} fixes \xB7 ${o.scanned} nodes \xB7 ${o.renderTime}ms \xB7 Score: ${o.score}/100`:`\u2713 0 auto-fixes needed \xB7 ${o.scanned} nodes \xB7 ${o.renderTime}ms`}),(0,l.jsxs)("div",{style:{display:"flex",gap:"8px",padding:"12px 14px 14px",position:b?"sticky":"relative",bottom:b?0:"auto",background:"#fff",borderTop:"1px solid #f1f5f9"},children:[(0,l.jsx)("button",{onClick:c,style:{flex:1,padding:b?"12px 0":"8px 0",fontSize:"13px",fontWeight:500,borderRadius:"9px",border:"1px solid #e2e8f0",background:"#fff",color:"#64748b",cursor:"pointer"},children:"Reset"}),(0,l.jsx)("button",{onClick:s,style:{flex:2,padding:b?"12px 0":"8px 0",fontSize:"13px",fontWeight:600,borderRadius:"9px",border:"none",background:"#0d9488",color:"#fff",cursor:"pointer"},children:"Apply settings"})]})]})});ut.displayName="WidgetPanel";ve();m();var re=require("react");m();var On={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"]},_n={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"]},Gn={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"]},Dn={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"]},qn={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 jn(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 a=r[1].trim();if(a.length>2&&a.length<40)return a}}return"My Business"}function Vn(e){let t=e.toLowerCase(),o="generic",r=0;for(let[a,i]of Object.entries(On)){let n=0;for(let s of i)t.includes(s)&&n++;n>r&&(r=n,o=a)}return o}function Un(e,t){let o=e.toLowerCase(),r=new Set($n[t]);for(let[a,i]of Object.entries(_n))for(let n of i)if(o.includes(n)){r.add(a);break}return r.add("home"),r.add("contact"),Array.from(r)}function Yn(e){let t=e.toLowerCase(),o=[];for(let[r,a]of Object.entries(Gn))for(let i of a)if(t.includes(i)){o.push(r);break}return o}function Kn(e,t){let o=e.toLowerCase();for(let[r,a]of Object.entries(Dn))for(let i of a)if(o.includes(i))return r;return qn[t]}function ao(e){let t=Vn(e),o=Un(e,t),r=Yn(e),a=Kn(e,t);return{siteName:jn(e),websiteType:t,pages:o,features:r,theme:a,description:e.slice(0,200)}}var f=require("react/jsx-runtime"),Qn=["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"],er={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}"},tr={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 ft({position:e,onClose:t}){let[o,r]=(0,re.useState)("input"),[a,i]=(0,re.useState)(""),[n,s]=(0,re.useState)(null),[c,p]=(0,re.useState)(0),[y,b]=(0,re.useState)(""),U=(0,re.useCallback)(()=>{if(!a.trim())return;let k=ao(a);s(k),r("preview")},[a]),O=(0,re.useCallback)(async()=>{if(n){r("generating"),p(0),b("");try{let k=[{msg:"Parsing requirement...",pct:15},{msg:"Loading templates...",pct:30},{msg:"Generating pages...",pct:55},{msg:"Building components...",pct:70},{msg:"Creating styles...",pct:85},{msg:"Packaging ZIP...",pct:95}];for(let R of k)p(R.pct),await new Promise(L=>setTimeout(L,200));let{generateZip:F}=await Promise.resolve().then(()=>(No(),Fo));await F(n),p(100),r("done")}catch(k){b(k instanceof Error?k.message:"Generation failed. Please try again."),r("preview")}}},[n]),D=()=>{r("input"),i(""),s(null),p(0),b("")},M={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,f.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":"yuktai Vibe Coder","data-yuktai-panel":"true",style:M,children:[(0,f.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,f.jsxs)("div",{children:[(0,f.jsx)("p",{style:{margin:"0 0 2px",fontSize:"13px",fontWeight:700,color:"#0f172a"},children:"\u26A1 Vibe Coder"}),(0,f.jsx)("p",{style:{margin:0,fontSize:"10px",color:"#64748b"},children:"Describe your website \u2192 Download Next.js ZIP"})]}),(0,f.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,f.jsxs)("div",{style:{padding:"14px 16px"},children:[(0,f.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,f.jsx)("p",{style:{margin:"0 0 6px",fontSize:"10px",fontWeight:600,color:"#94a3b8",textTransform:"uppercase"},children:"Examples"}),(0,f.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:"4px",marginBottom:"12px"},children:Qn.slice(0,3).map(k=>(0,f.jsx)("button",{onClick:()=>i(k),style:{padding:"6px 10px",borderRadius:"8px",border:"1px solid #e2e8f0",background:"#f8fafc",color:"#475569",fontSize:"10px",cursor:"pointer",textAlign:"left",lineHeight:1.4},children:k},k))}),(0,f.jsx)("textarea",{value:a,onChange:k=>i(k.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,f.jsx)("button",{onClick:U,disabled:!a.trim(),style:{width:"100%",marginTop:"10px",padding:"10px",borderRadius:"8px",border:"none",background:a.trim()?"#f59e0b":"#e2e8f0",color:a.trim()?"#fff":"#94a3b8",fontSize:"13px",fontWeight:700,cursor:a.trim()?"pointer":"not-allowed",transition:"background 0.2s"},children:"Analyse Requirement \u2192"})]}),o==="preview"&&n&&(0,f.jsxs)("div",{style:{padding:"14px 16px"},children:[y&&(0,f.jsxs)("div",{style:{padding:"10px",background:"#fef2f2",border:"1px solid #fca5a5",borderRadius:"8px",marginBottom:"12px",fontSize:"11px",color:"#dc2626"},children:["\u26A0\uFE0F ",y]}),(0,f.jsxs)("div",{style:{background:"#f8fafc",borderRadius:"10px",padding:"12px",marginBottom:"12px"},children:[(0,f.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px"},children:[(0,f.jsx)("span",{style:{fontSize:"1.5rem"},children:tr[n.websiteType]||"\u{1F310}"}),(0,f.jsxs)("div",{children:[(0,f.jsx)("p",{style:{margin:0,fontSize:"13px",fontWeight:700,color:"#0f172a"},children:n.siteName}),(0,f.jsxs)("p",{style:{margin:0,fontSize:"10px",color:"#64748b",textTransform:"capitalize"},children:[n.websiteType," website \xB7 ",n.theme," theme"]})]})]}),(0,f.jsxs)("p",{style:{margin:"8px 0 6px",fontSize:"10px",fontWeight:600,color:"#94a3b8",textTransform:"uppercase"},children:["Pages to generate (",n.pages.length,")"]}),(0,f.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px"},children:n.pages.map(k=>(0,f.jsxs)("span",{style:{padding:"2px 8px",borderRadius:"99px",background:"#f0fdf4",border:"1px solid #86efac",fontSize:"10px",color:"#166534",fontWeight:500},children:[er[k]||"\u{1F4C4}"," ",k]},k))}),n.features.length>0&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("p",{style:{margin:"10px 0 6px",fontSize:"10px",fontWeight:600,color:"#94a3b8",textTransform:"uppercase"},children:"Detected features"}),(0,f.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px"},children:n.features.map(k=>(0,f.jsx)("span",{style:{padding:"2px 8px",borderRadius:"99px",background:"#f5f3ff",border:"1px solid #c4b5fd",fontSize:"10px",color:"#7c3aed",fontWeight:500},children:k},k))})]})]}),(0,f.jsxs)("div",{style:{margin:"0 0 12px",padding:"10px 12px",background:"#f0fdf4",borderRadius:"8px",border:"1px solid #86efac"},children:[(0,f.jsx)("p",{style:{margin:"0 0 4px",fontSize:"10px",fontWeight:700,color:"#166534"},children:"\u{1F4E6} What you get:"}),(0,f.jsxs)("p",{style:{margin:0,fontSize:"10px",color:"#166534",lineHeight:1.6},children:["\u2705 Complete Next.js 16 project",(0,f.jsx)("br",{}),"\u2705 Tailwind CSS + CSS Modules",(0,f.jsx)("br",{}),"\u2705 TypeScript configured",(0,f.jsx)("br",{}),"\u2705 Navbar + Footer components",(0,f.jsx)("br",{}),"\u2705 All ",n.pages.length," pages ready",(0,f.jsx)("br",{}),"\u2705 Mobile responsive",(0,f.jsx)("br",{}),"\u2705 npm run dev \u2192 works immediately"]})]}),(0,f.jsxs)("div",{style:{display:"flex",gap:"8px"},children:[(0,f.jsx)("button",{onClick:D,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,f.jsx)("button",{onClick:O,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,f.jsxs)("div",{style:{padding:"2rem 16px",textAlign:"center"},children:[(0,f.jsx)("p",{style:{fontSize:"2rem",marginBottom:"1rem"},children:"\u26A1"}),(0,f.jsx)("p",{style:{fontSize:"13px",fontWeight:700,color:"#0f172a",marginBottom:"0.5rem"},children:"Generating your project..."}),(0,f.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,f.jsx)("div",{style:{height:"8px",background:"#e2e8f0",borderRadius:"99px",overflow:"hidden"},children:(0,f.jsx)("div",{style:{height:"100%",width:`${c}%`,background:"#f59e0b",borderRadius:"99px",transition:"width 0.3s ease"}})}),(0,f.jsxs)("p",{style:{marginTop:"0.5rem",fontSize:"10px",color:"#94a3b8"},children:[c,"%"]})]}),o==="done"&&n&&(0,f.jsxs)("div",{style:{padding:"2rem 16px",textAlign:"center"},children:[(0,f.jsx)("p",{style:{fontSize:"3rem",marginBottom:"0.75rem"},children:"\u2705"}),(0,f.jsxs)("p",{style:{fontSize:"14px",fontWeight:700,color:"#0f172a",marginBottom:"0.5rem"},children:[n.siteName," downloaded!"]}),(0,f.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(k=>(0,f.jsx)("div",{style:{background:"#0f172a",borderRadius:"8px",padding:"8px 12px",marginBottom:"6px",textAlign:"left"},children:(0,f.jsxs)("code",{style:{fontSize:"12px",color:"#a7f3d0",fontFamily:"monospace"},children:["$ ",k]})},k)),(0,f.jsx)("p",{style:{fontSize:"11px",color:"#10b981",margin:"1rem 0",fontWeight:600},children:"Then open http://localhost:3000 \u{1F680}"}),(0,f.jsxs)("div",{style:{display:"flex",gap:"8px"},children:[(0,f.jsx)("button",{onClick:D,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,f.jsx)("button",{onClick:O,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 h=require("react/jsx-runtime");async function ir(){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 je({position:e="left",children:t,config:o={},showRag:r=!1,showAgent:a=!1}){let[i,n]=(0,v.useState)(!1),[s,c]=(0,v.useState)(pt),[p,y]=(0,v.useState)(null),[b,U]=(0,v.useState)(!1),[O,D]=(0,v.useState)(!1),[M,k]=(0,v.useState)(!1),F=v.default.useRef(null),[R,L]=(0,v.useState)(!1),[$,x]=(0,v.useState)(""),[P,H]=(0,v.useState)(""),[B,A]=(0,v.useState)(!1),[S,J]=(0,v.useState)(null),[oe,d]=(0,v.useState)("idle"),[Q,T]=(0,v.useState)(!1),[Y,ne]=(0,v.useState)(""),[Ue,le]=(0,v.useState)(""),[g,W]=(0,v.useState)(!1),[K,q]=(0,v.useState)([]),[N,wt]=(0,v.useState)(null),qo=24,kt=84,St=r?144:84,ur=204,[Ie,Ye]=(0,v.useState)(!1);(0,v.useEffect)(()=>{if(typeof window>"u")return;let u=window;!!(u.LanguageModel||u.ai?.languageModel)&&O?(J("gemini"),wt("gemini")):he()&&(J("transformers"),wt("transformers"))},[O]),(0,v.useEffect)(()=>{if(S!=="transformers")return;let u=setInterval(()=>d(xe()),500);return()=>clearInterval(u)},[S]);let At=(0,v.useCallback)(async()=>{if(!(!$.trim()||B)){if(!S){H("\u26A0\uFE0F No AI engine available.");return}A(!0),H("");try{let u;if(S==="gemini"){let{askPage:I}=await Promise.resolve().then(()=>(st(),eo));u=await I($)}else{d("loading");let{askPageWithTransformers:I}=await Promise.resolve().then(()=>(ve(),dt));u=await I($),d("ready")}H(u.success&&u.answer?u.answer.replace(/\*\*(.*?)\*\*/g,"$1").replace(/\*(.*?)\*/g,"$1").replace(/#+\s/g,"").trim():"\u26A0\uFE0F "+(u.error||"No answer found."))}catch{H("\u26A0\uFE0F Something went wrong.")}A(!1)}},[$,B,S]),Tt=(0,v.useCallback)(async()=>{if(!Y.trim()||g)return;if(!N){le("\u26A0\uFE0F No AI engine available.");return}W(!0),q([]),le("");let{runAgent:u}=await Promise.resolve().then(()=>($o(),Oo));await u(Y,N,I=>{q(ae=>[...ae,I.text])}),W(!1),le("done")},[Y,g,N]);(0,v.useEffect)(()=>{if(typeof window>"u")return;let I=setTimeout(async()=>{let ae=window,Ko=await ir();D(Ko),k(!!(ae.SpeechRecognition||ae.webkitSpeechRecognition))},800);return()=>clearTimeout(I)},[]),(0,v.useEffect)(()=>{if(!(typeof window>"u"))try{let u=localStorage.getItem("yuktai-a11y-prefs");u&&c(I=>({...I,...JSON.parse(u)}))}catch{}},[]);let Et=(0,v.useCallback)(async u=>{let I={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 X.execute(I),y(X.applyFixes(I)),U(!0)},[o]),jo=(0,v.useCallback)(async()=>{try{localStorage.setItem("yuktai-a11y-prefs",JSON.stringify(s))}catch{}await Et(s),n(!1)},[s,Et]),Vo=(0,v.useCallback)(()=>{c(pt);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(I=>u.removeAttribute(I)),document.body.style.filter="",document.body.style.fontFamily="",document.documentElement.style.fontSize="",y(null),U(!1)},[]),Uo=(0,v.useCallback)((u,I)=>{c(ae=>({...ae,[u]:I}))},[]);(0,v.useEffect)(()=>{let u=I=>{I.key==="Escape"&&(i&&n(!1),R&&L(!1),Q&&T(!1),Ie&&Ye(!1))};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[i,R,Q]),(0,v.useEffect)(()=>{i&&F.current&&X.trapFocus(F.current)},[i]);let Fe=(u,I,ae)=>({position:"fixed",bottom:`${u}px`,[e]:"24px",zIndex:9998,width:"52px",height:"52px",borderRadius:"50%",background:I,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"}),Ne=u=>{u.currentTarget.style.transform="scale(1.08)"},ze=u=>{u.currentTarget.style.transform="scale(1)"},Ct=S==="gemini"?"Gemini Nano \xB7 On device":S==="transformers"?"Transformers.js \xB7 All devices":"Detecting...",Yo=S==="transformers"&&oe==="loading"?"Loading model...":"...";return(0,h.jsxs)(h.Fragment,{children:[t,a&&(0,h.jsx)("button",{style:Fe(204,Ie?"#d97706":"#f59e0b",Ie),"aria-label":"Open Vibe Coder",title:"\u26A1 Vibe Coder \u2014 Generate Next.js project",onClick:()=>{Ye(u=>!u),T(!1),L(!1),n(!1)},onMouseEnter:Ne,onMouseLeave:ze,children:"\u26A1"}),a&&Ie&&(0,h.jsx)(ft,{position:e,onClose:()=>Ye(!1)}),a&&(0,h.jsx)("button",{style:Fe(St,Q?"#059669":"#10b981",Q),"aria-label":"Open AI agent","aria-haspopup":"dialog","aria-expanded":Q,title:"\u{1F916} AI Agent \u2014 guide me through this page",onClick:()=>{T(u=>!u),L(!1),n(!1)},onMouseEnter:Ne,onMouseLeave:ze,children:"\u{1F916}"}),a&&Q&&(0,h.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":"yuktai AI Agent","data-yuktai-panel":"true",style:{position:"fixed",bottom:`${St+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,h.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"10px"},children:[(0,h.jsxs)("div",{children:[(0,h.jsx)("p",{style:{margin:"0 0 2px",fontSize:"13px",fontWeight:600,color:"#0f172a"},children:"\u{1F916} AI Agent"}),(0,h.jsx)("p",{style:{margin:0,fontSize:"10px",color:"#10b981"},children:N==="gemini"?"Gemini Nano \xB7 On device":N==="transformers"?"Transformers.js \xB7 All devices":"Detecting..."})]}),(0,h.jsx)("button",{onClick:()=>T(!1),"aria-label":"Close agent panel",style:{background:"none",border:"none",cursor:"pointer",color:"#94a3b8",fontSize:"18px",lineHeight:1,padding:"2px"},children:"\xD7"})]}),(0,h.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,h.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,h.jsx)("button",{onClick:()=>ne(u),style:{padding:"3px 8px",borderRadius:"20px",fontSize:"10px",border:"1px solid #e2e8f0",background:"#f8fafc",color:"#64748b",cursor:"pointer"},children:u},u))}),(0,h.jsxs)("div",{style:{display:"flex",gap:"6px",marginBottom:"8px"},children:[(0,h.jsx)("input",{type:"text",value:Y,onChange:u=>ne(u.target.value),onKeyDown:u=>{u.key==="Enter"&&Tt()},placeholder:"e.g. Help me fill this form",disabled:g||!N,"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:N?"#fff":"#f8fafc",outline:"none",height:"36px"}}),(0,h.jsx)("button",{onClick:Tt,disabled:g||!Y.trim()||!N,"aria-label":"Run agent",style:{padding:"8px 12px",borderRadius:"8px",border:"none",background:N&&Y.trim()&&!g?"#10b981":"#e2e8f0",color:N&&Y.trim()&&!g?"#fff":"#94a3b8",fontSize:"12px",fontWeight:600,cursor:N&&Y.trim()&&!g?"pointer":"not-allowed",height:"36px",minWidth:"52px",transition:"background 0.2s"},children:g?"...":"Go"})]}),K.length>0&&(0,h.jsxs)("div",{style:{padding:"10px 12px",background:"#f0fdf4",border:"1px solid #86efac",borderRadius:"8px",fontSize:"11px",color:"#166534",lineHeight:1.7},children:[K.map((u,I)=>(0,h.jsx)("p",{style:{margin:"0 0 2px"},children:u},I)),Ue==="done"&&(0,h.jsx)("button",{onClick:()=>{q([]),ne(""),le("")},style:{display:"block",marginTop:"6px",background:"none",border:"none",color:"#94a3b8",fontSize:"10px",cursor:"pointer",padding:0},children:"Clear"})]}),!N&&(0,h.jsx)("p",{style:{margin:"4px 0 0",fontSize:"10px",color:"#94a3b8"},children:"Enable Gemini Nano via chrome://flags for best results."})]}),r&&(0,h.jsx)("button",{style:Fe(kt,R?"#7c3aed":"#6d28d9",R),"aria-label":"Ask a question about this page","aria-haspopup":"dialog","aria-expanded":R,title:`\u{1F4AC} Ask this page \xB7 ${Ct}`,onClick:()=>{L(u=>!u),n(!1),T(!1)},onMouseEnter:Ne,onMouseLeave:ze,children:"\u{1F4AC}"}),r&&R&&(0,h.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":"Ask this page","data-yuktai-panel":"true",style:{position:"fixed",bottom:`${kt+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,h.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"10px"},children:[(0,h.jsxs)("div",{children:[(0,h.jsx)("p",{style:{margin:"0 0 2px",fontSize:"13px",fontWeight:600,color:"#0f172a"},children:"\u{1F4AC} Ask this page"}),(0,h.jsx)("p",{style:{margin:0,fontSize:"10px",color:"#7c3aed"},children:Ct}),S==="transformers"&&oe==="loading"&&(0,h.jsx)("p",{style:{margin:"2px 0 0",fontSize:"9px",color:"#94a3b8"},children:"Downloading model \u2014 first time only"}),S==="transformers"&&oe==="ready"&&(0,h.jsx)("p",{style:{margin:"2px 0 0",fontSize:"9px",color:"#10b981"},children:"Model ready \u2705 \u2014 works offline"})]}),(0,h.jsx)("button",{onClick:()=>L(!1),"aria-label":"Close ask panel",style:{background:"none",border:"none",cursor:"pointer",color:"#94a3b8",fontSize:"18px",lineHeight:1,padding:"2px"},children:"\xD7"})]}),(0,h.jsxs)("div",{style:{display:"flex",gap:"6px",marginBottom:"8px"},children:[(0,h.jsx)("input",{type:"text",value:$,onChange:u=>x(u.target.value),onKeyDown:u=>{u.key==="Enter"&&At()},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:"36px"}}),(0,h.jsx)("button",{onClick:At,disabled:B||!$.trim()||!S,"aria-label":"Submit question",style:{padding:"8px 12px",borderRadius:"8px",border:"none",background:S&&$.trim()&&!B?"#7c3aed":"#e2e8f0",color:S&&$.trim()&&!B?"#fff":"#94a3b8",fontSize:"12px",fontWeight:600,cursor:S&&$.trim()&&!B?"pointer":"not-allowed",height:"36px",minWidth:"48px",transition:"background 0.2s"},children:B?Yo:"Ask"})]}),P&&(0,h.jsxs)("div",{style:{padding:"10px",background:"#f5f3ff",borderRadius:"8px",fontSize:"12px",color:"#4c1d95",lineHeight:1.6,maxHeight:"180px",overflowY:"auto"},children:[(0,h.jsx)("strong",{style:{display:"block",marginBottom:"4px",fontSize:"11px",color:"#7c3aed"},children:"\u{1F4AC} Answer"}),P,(0,h.jsx)("button",{onClick:()=>{H(""),x("")},style:{display:"block",marginTop:"6px",background:"none",border:"none",color:"#94a3b8",fontSize:"10px",cursor:"pointer",padding:0},children:"Clear"})]}),!S&&(0,h.jsx)("p",{style:{margin:"4px 0 0",fontSize:"10px",color:"#94a3b8"},children:"Detecting AI engine..."})]}),(0,h.jsx)("button",{style:Fe(qo,b?"#0d9488":"#1a73e8",i),"aria-label":"Open accessibility preferences","aria-haspopup":"dialog","aria-expanded":i,"data-yuktai-pref-toggle":"true",title:"\u267F Accessibility settings",onClick:()=>{n(u=>!u),L(!1),T(!1)},onMouseEnter:Ne,onMouseLeave:ze,children:"\u267F"}),i&&(0,h.jsx)(ut,{ref:F,position:e,settings:s,report:p,isActive:b,aiSupported:O,voiceSupported:M,set:Uo,onApply:jo,onReset:Vo,onClose:()=>n(!1)})]})}m();var ke={name:"ai.text",async execute(e){return`\u{1F916} YuktAI says: ${e}`}};m();var Se={name:"voice.text",async execute(e){return!e||e.trim()===""?"\u{1F3A4} No speech detected":`\u{1F3A4} You said: ${e}`}};m();var se=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 be=require("react");m();var _=require("react");function sr(e){return e===!1?Number.MAX_SAFE_INTEGER:e===!0||e===void 0?10:e.pageSize??10}function Ve(e){let{data:t,columns:o,pagination:r=!0,mobileBreakpoint:a=768}=e,[i,n]=(0,_.useState)(null),[s,c]=(0,_.useState)(""),[p,y]=(0,_.useState)(1),[b,U]=(0,_.useState)(sr(r)),[O,D]=(0,_.useState)(!1);(0,_.useEffect)(()=>{if(typeof window>"u")return;let P=()=>{D(window.innerWidth<a)};return P(),window.addEventListener("resize",P),()=>window.removeEventListener("resize",P)},[a]);let M=(0,_.useCallback)(P=>{n(H=>!H||H.key!==P?{key:P,direction:"asc"}:H.direction==="asc"?{key:P,direction:"desc"}:null),y(1)},[]),k=(0,_.useCallback)(()=>n(null),[]),F=(0,_.useMemo)(()=>{if(!s.trim())return t;let P=s.toLowerCase().trim();return t.filter(H=>o.some(B=>{let A=H[B.key];return A==null?!1:String(A).toLowerCase().includes(P)}))},[t,s,o]),R=(0,_.useMemo)(()=>{if(!i)return F;let P=[...F].sort((H,B)=>{let A=H[i.key],S=B[i.key];if(A===S)return 0;if(A==null)return 1;if(S==null)return-1;if(typeof A=="number"&&typeof S=="number")return A-S;if(A instanceof Date&&S instanceof Date)return A.getTime()-S.getTime();let J=String(A),oe=String(S);return J.localeCompare(oe,void 0,{sensitivity:"base",numeric:!0})});return i.direction==="desc"?P.reverse():P},[F,i]),L=Math.max(1,Math.ceil(R.length/b)),$=(0,_.useMemo)(()=>{if(r===!1)return R;let P=(p-1)*b;return R.slice(P,P+b)},[R,p,b,r]),x=(0,_.useCallback)(()=>{n(null),c(""),y(1)},[]);return(0,_.useEffect)(()=>{p>L&&y(L)},[p,L]),{displayedData:$,totalCount:t.length,filteredCount:R.length,sort:i,toggleSort:M,clearSort:k,searchQuery:s,setSearchQuery:c,page:p,pageSize:b,totalPages:L,setPage:y,setPageSize:U,isMobile:O,reset:x}}m();m();var _o=require("react/jsx-runtime");function G({size:e=20,color:t="currentColor",strokeWidth:o=2.5,label:r,children:a,...i}){return(0,_o.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",...i,children:a})}var Ae=require("react/jsx-runtime");function Te(e){return(0,Ae.jsxs)(G,{...e,children:[(0,Ae.jsx)("path",{d:"M12 19V5"}),(0,Ae.jsx)("path",{d:"m5 12 7-7 7 7"})]})}m();var Ee=require("react/jsx-runtime");function Ce(e){return(0,Ee.jsxs)(G,{...e,children:[(0,Ee.jsx)("path",{d:"M12 5v14"}),(0,Ee.jsx)("path",{d:"m5 12 7 7 7-7"})]})}m();var gt=require("react/jsx-runtime");function Le(e){return(0,gt.jsx)(G,{...e,children:(0,gt.jsx)("path",{d:"m15 18-6-6 6-6"})})}m();var bt=require("react/jsx-runtime");function Me(e){return(0,bt.jsx)(G,{...e,children:(0,bt.jsx)("path",{d:"m9 18 6-6-6-6"})})}var w=require("react/jsx-runtime"),lr={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:"#0D9488",color:"#FFFFFF"},border:"#E2E8F0"},"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:"#FFFF00",color:"#000000",border:"2px solid #FFFFFF"},border:"#FFFFFF"},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:"#14B8A6",color:"#0F172A"},border:"#334155"},"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:"#1F2937",color:"#FFFFFF"},border:"#E2E8F0"},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:"#92400E",color:"#FDF6E3"},border:"#D7CFB8"}},Z={search:"Search...",noData:"No data to display",loading:"Loading...",rowsSelected:"rows selected",page:"Page",of:"of",showing:"Showing",to:"to",results:"results",prev:"Previous",next:"Next"};function Go(e){let{data:t,columns:o,view:r="auto",mobileBreakpoint:a=768,theme:i="default",pagination:n=!0,search:s=!0,selectable:c=!1,selectedKeys:p=[],rowKey:y,loading:b=!1,empty:U,onSelectionChange:O,onRowClick:D,onSortChange:M,className:k}=e,[F,R]=(0,be.useState)(p),{displayedData:L,filteredCount:$,sort:x,toggleSort:P,searchQuery:H,setSearchQuery:B,page:A,pageSize:S,totalPages:J,setPage:oe,isMobile:d}=Ve({data:t,columns:o,pagination:n,mobileBreakpoint:a}),Q=r==="card"||r==="auto"&&d,T=lr[i],Y=o.filter(g=>!(d&&g.hiddenOnMobile)),ne=(0,be.useCallback)((g,W)=>y&&g[y]!==void 0?String(g[y]):g.id!==void 0?String(g.id):String(W),[y]),Ue=(0,be.useCallback)(g=>{P(g),M?.(x)},[P,M,x]),le=(0,be.useCallback)(g=>{R(W=>{let K=W.includes(g)?W.filter(q=>q!==g):[...W,g];return O?.(K),K})},[O]);return b?(0,w.jsx)("div",{role:"status","aria-live":"polite",style:{...T.container,padding:"2rem",textAlign:"center",borderRadius:8,border:`1px solid ${T.border}`},children:Z.loading}):t.length===0?(0,w.jsx)("div",{role:"status",style:{...T.container,padding:"2rem",textAlign:"center",borderRadius:8,border:`1px solid ${T.border}`},children:U??Z.noData}):(0,w.jsxs)("div",{className:k,style:{...T.container,borderRadius:8,border:`1px solid ${T.border}`,overflow:"hidden"},"data-yuktai-grid":!0,"data-theme":i,children:[s&&(0,w.jsxs)("div",{style:{...T.header,padding:"12px 16px",display:"flex",gap:12,alignItems:"center"},children:[(0,w.jsx)("input",{type:"search",value:H,onChange:g=>B(g.target.value),placeholder:Z.search,"aria-label":Z.search,style:{flex:1,padding:"8px 12px",fontSize:14,border:`1px solid ${T.border}`,borderRadius:6,background:"transparent",color:"inherit",minHeight:44}}),c&&F.length>0&&(0,w.jsxs)("span",{style:{fontSize:13,color:"inherit"},children:[F.length," ",Z.rowsSelected]})]}),Q?(0,w.jsx)("div",{role:"list",style:{padding:8},children:L.map((g,W)=>{let K=ne(g,W);return(0,w.jsx)("div",{role:"listitem",onClick:()=>D?.(g,W),style:{padding:12,marginBottom:8,border:`1px solid ${T.border}`,borderRadius:8,background:"transparent",cursor:D?"pointer":"default",minHeight:44},tabIndex:0,children:Y.map(q=>(0,w.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",padding:"4px 0",fontSize:13},children:[(0,w.jsxs)("span",{style:{fontWeight:500,opacity:.7},children:[q.label,":"]}),(0,w.jsx)("span",{style:T.cell,children:q.render?q.render(g[q.key],g,W):String(g[q.key]??"")})]},q.key))},K)})}):(0,w.jsx)("div",{style:{overflowX:"auto"},children:(0,w.jsxs)("table",{role:"grid",style:{width:"100%",borderCollapse:"collapse",fontSize:14},children:[(0,w.jsx)("thead",{children:(0,w.jsxs)("tr",{role:"row",children:[c&&(0,w.jsx)("th",{style:{...T.header,padding:"10px 14px",width:44},children:(0,w.jsx)("input",{type:"checkbox","aria-label":"Select all",checked:F.length===L.length&&L.length>0,onChange:g=>{g.target.checked?R(L.map((W,K)=>ne(W,K))):R([])},style:{minWidth:20,minHeight:20,cursor:"pointer"}})}),Y.map(g=>(0,w.jsx)("th",{role:"columnheader","aria-sort":x?.key===g.key?x.direction==="asc"?"ascending":"descending":"none",onClick:()=>g.sortable!==!1&&Ue(g.key),style:{...T.header,padding:"10px 14px",textAlign:g.align??"left",cursor:g.sortable!==!1?"pointer":"default",userSelect:"none",width:g.width,fontWeight:500,fontSize:12,textTransform:"uppercase",letterSpacing:"0.5px"},children:(0,w.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[g.label,x?.key===g.key&&(x.direction==="asc"?(0,w.jsx)(Te,{size:14}):(0,w.jsx)(Ce,{size:14}))]})},g.key))]})}),(0,w.jsx)("tbody",{children:L.map((g,W)=>{let K=ne(g,W),q=F.includes(K);return(0,w.jsxs)("tr",{role:"row","aria-selected":q,onClick:()=>D?.(g,W),style:{...T.row,cursor:D?"pointer":"default",background:q?T.rowHover.background:"transparent"},children:[c&&(0,w.jsx)("td",{style:{padding:"10px 14px"},children:(0,w.jsx)("input",{type:"checkbox","aria-label":`Select row ${W+1}`,checked:q,onChange:()=>le(K),onClick:N=>N.stopPropagation(),style:{minWidth:20,minHeight:20,cursor:"pointer"}})}),Y.map(N=>(0,w.jsx)("td",{role:"gridcell",style:{...T.cell,padding:"10px 14px",textAlign:N.align??"left"},children:N.render?N.render(g[N.key],g,W):String(g[N.key]??"")},N.key))]},K)})})]})}),n!==!1&&J>1&&(0,w.jsxs)("div",{style:{...T.header,padding:"10px 14px",display:"flex",justifyContent:"space-between",alignItems:"center",borderTop:`1px solid ${T.border}`,borderBottom:"none",fontSize:13,flexWrap:"wrap",gap:8},children:[(0,w.jsxs)("span",{children:[Z.showing," ",(A-1)*S+1," ",Z.to," ",Math.min(A*S,$)," ",Z.of," ",$," ",Z.results]}),(0,w.jsxs)("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[(0,w.jsx)("button",{onClick:()=>oe(A-1),disabled:A===1,"aria-label":Z.prev,style:{...T.button,padding:"6px 12px",border:`1px solid ${T.border}`,borderRadius:4,cursor:A===1?"not-allowed":"pointer",opacity:A===1?.5:1,minHeight:44,minWidth:44,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:(0,w.jsx)(Le,{size:18})}),(0,w.jsxs)("span",{style:{padding:"0 8px"},children:[Z.page," ",A," ",Z.of," ",J]}),(0,w.jsx)("button",{onClick:()=>oe(A+1),disabled:A===J,"aria-label":Z.next,style:{...T.button,padding:"6px 12px",border:`1px solid ${T.border}`,borderRadius:4,cursor:A===J?"not-allowed":"pointer",opacity:A===J?.5:1,minHeight:44,minWidth:44,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:(0,w.jsx)(Me,{size:18})})]})]})]})}m();m();var Re=require("react/jsx-runtime");function yt(e){return(0,Re.jsxs)(G,{...e,children:[(0,Re.jsx)("circle",{cx:"11",cy:"11",r:"7"}),(0,Re.jsx)("path",{d:"m20 20-4-4"})]})}m();var ht=require("react/jsx-runtime");function xt(e){return(0,ht.jsx)(G,{...e,children:(0,ht.jsx)("path",{d:"M5 12.5 10 17.5 19.5 7"})})}m();var Pe=require("react/jsx-runtime");function vt(e){return(0,Pe.jsxs)(G,{...e,children:[(0,Pe.jsx)("path",{d:"M18 6 6 18"}),(0,Pe.jsx)("path",{d:"m6 6 12 12"})]})}function cr(){if(typeof globalThis>"u")return new se;if(!globalThis.__yuktai_runtime__){let e=new se;e.register(X.name,X),e.register(ke.name,ke),e.register(Se.name,Se),globalThis.__yuktai_runtime__=e}return globalThis.__yuktai_runtime__}var Do=typeof window<"u"?cr():new se,dr={wcagPlugin:X,list(){return Do.getPlugins()},use(e){return Do.use(e)},fix(e){return X.applyFixes({enabled:!0,autoFix:!0,...e})},scan(){return X.scan()}};
1521
+ `,document.body.appendChild(e),Dt=e}function Zt(e){let t={critical:20,serious:10,moderate:5,minor:2},o=e.details.reduce((r,a)=>r+(t[a.severity]||0),0);return Math.max(0,Math.min(100,100-o))}var Z={name:"yuktai-a11y",version:"4.0.0",observer:null,async execute(e){if(!e.enabled)return this.stopObserver(),"yuktai: disabled.";me=e,Sn(e),An(),Tn(),yn(),hn(),e.showSkipLinks!==!1&&bn(),e.showPreferencePanel,kn(e);let t=this.applyFixes(e);t.score=Zt(t),e.showAuditBadge&&vn(t),e.timeoutWarning&&Qt(e.timeoutWarning),e.autoFix&&this.startObserver(e),e.plainEnglish&&await Vt(!0),e.summarisePage&&await Ut(!0),e.translateLanguage&&e.translateLanguage!=="en"&&await Yt(e.translateLanguage),e.voiceControl&&await Kt(!0),e.smartLabels&&await Xt(!0);let o=`${t.fixed} fixes applied. Score: ${t.score}/100.`;return F(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 a=(i,n,s,c)=>{t.details.push({tag:i,fix:n,severity:s,element:c.outerHTML.slice(0,100)}),t.fixed++};return r.forEach(i=>{let n=i,s=n.tagName.toLowerCase();if(s==="html"&&!n.getAttribute("lang")&&(n.setAttribute("lang","en"),a(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")),a(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")),a(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"),a(s,'alt="" aria-hidden="true"',"serious",n))),s==="svg"&&(!n.getAttribute("aria-hidden")&&!n.getAttribute("aria-label")&&!i.querySelector("title")&&(n.setAttribute("aria-hidden","true"),a(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"),a(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),a(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"),a(s,"aria-label added (empty link)","critical",n)),p.target==="_blank"&&!p.rel?.includes("noopener")&&(p.rel="noopener noreferrer",t.fixed++)}if(jt.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),a(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"),a(s,"scope added to <th>","moderate",n)),it[s]&&!n.getAttribute("role")&&(n.setAttribute("role",it[s]),a(s,`role="${it[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"),a(s,`aria-live added on role=${c}`,"moderate",n)),c==="combobox"&&!n.getAttribute("aria-expanded")&&(n.setAttribute("aria-expanded","false"),a(s,'aria-expanded="false" on combobox',"serious",n)),(c==="checkbox"||c==="radio")&&!n.getAttribute("aria-checked")&&(n.setAttribute("aria-checked","false"),a(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=(a,i,n,s)=>e.details.push({tag:a,fix:i,severity:n,element:s.outerHTML.slice(0,100)});return o.forEach(a=>{let i=a,n=i.tagName.toLowerCase();(n==="a"||n==="button")&&!i.innerText?.trim()&&!i.getAttribute("aria-label")&&r(n,"needs aria-label (empty)","critical",i),n==="img"&&!i.hasAttribute("alt")&&r(n,"needs alt text","serious",i),jt.has(n)&&!i.getAttribute("aria-label")&&!i.getAttribute("aria-labelledby")&&r(n,"needs aria-label","serious",i),n==="iframe"&&!i.getAttribute("title")&&!i.getAttribute("aria-label")&&r(n,"iframe needs title","serious",i)}),e.fixed=e.details.length,e.score=Zt(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:F,speak:st,showVisualAlert:Jt,trapFocus:Ve,handlePlainEnglish:Vt,handleSummarisePage:Ut,handleTranslate:Yt,handleVoiceControl:Kt,handleSmartLabels:Xt,SUPPORTED_LANGUAGES:_e};m();m();var k=Ze(require("react"));m();var U=require("react");ct();we();var l=require("react/jsx-runtime"),mt={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},ge=[80,90,100,110,120,130],Nn=[{value:"none",label:"None"},{value:"deuteranopia",label:"Deuteranopia"},{value:"protanopia",label:"Protanopia"},{value:"tritanopia",label:"Tritanopia"},{value:"achromatopsia",label:"Greyscale"}],Hn=["Prompt API for Gemini Nano","Summarization API for Gemini Nano","Writer API for Gemini Nano","Rewriter API for Gemini Nano","Translation API"];function Bn(){let[e,t]=(0,U.useState)(typeof window<"u"?window.innerWidth:1024);return(0,U.useEffect)(()=>{let o=()=>t(window.innerWidth);return window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[]),{isMobile:e<=480,isTablet:e>480&&e<=768}}function Wn({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:a=>t(a.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 be({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 oe({icon:e,label:t,desc:o,checked:r,onChange:a,disabled:i=!1,disabledReason:n,tip:s}){return(0,l.jsxs)("div",{title:i?n:s,style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 18px",gap:"12px"},children:[(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"10px",flex:1,minWidth:0},children:[(0,l.jsx)("span",{"aria-hidden":"true",style:{width:"32px",height:"32px",borderRadius:"8px",background:i?"#f1f5f9":"#f0fdfa",color:i?"#94a3b8":"#0d9488",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"15px",flexShrink:0,fontWeight:700},children:e}),(0,l.jsxs)("div",{style:{minWidth:0},children:[(0,l.jsx)("p",{style:{margin:0,fontSize:"13px",fontWeight:500,color:i?"#94a3b8":"#0f172a",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t}),(0,l.jsx)("p",{style:{margin:0,fontSize:"10px",color:"#94a3b8"},children:i?n:o})]})]}),(0,l.jsx)(Wn,{checked:r,onChange:a,label:`Toggle ${t}`,disabled:i})]})}function V(){return(0,l.jsx)("div",{style:{height:"1px",background:"#f1f5f9"}})}function ke({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 ft=(0,U.forwardRef)(({position:e,settings:t,report:o,isActive:r,aiSupported:a,voiceSupported:i,set:n,onApply:s,onReset:c,onClose:p},h)=>{let{isMobile:y,isTablet:Y}=Bn(),[O,q]=(0,U.useState)([]),[L,S]=(0,U.useState)(""),[I,R]=(0,U.useState)(""),[C,$]=(0,U.useState)(!1),[w,M]=(0,U.useState)(null),[z,W]=(0,U.useState)("idle");(0,U.useEffect)(()=>{let d=window;!!(d.LanguageModel||d.ai?.languageModel)&&a?M("gemini"):xe()&&M("transformers")},[a]),(0,U.useEffect)(()=>{if(w!=="transformers")return;let d=setInterval(()=>{W(ve())},500);return()=>clearInterval(d)},[w]);let A=async()=>{if(!(!L.trim()||C)){if(!w){R("\u26A0\uFE0F No AI engine available on this device.");return}$(!0),R("");try{let d;w==="gemini"?d=await lt(L):(W("loading"),d=await pt(L),W("ready")),R(d.success&&d.answer?d.answer.replace(/\*\*(.*?)\*\*/g,"$1").replace(/\*(.*?)\*/g,"$1").replace(/#+\s/g,"").trim():"\u26A0\uFE0F "+(d.error||"No answer found on this page"))}catch{R("\u26A0\uFE0F Failed to get answer. Please try again.")}$(!1)}};(0,U.useEffect)(()=>{(async()=>{try{let Q=window;if(!Q.queryLocalFonts)return;let x=await Q.queryLocalFonts(),K=[...new Set(x.map(ne=>ne.family))].sort();q(K.slice(0,50))}catch{}})()},[]);let T=w==="gemini"?"Gemini Nano":w==="transformers"?"Transformers.js \xB7 All devices":"Detecting...",J=w==="transformers"&&z==="loading"?"Loading AI model... (first time only)":"...",te=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:Y?"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:te,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)(be,{label:"\u267F Core Accessibility",concept:"Rule-based engine \u2014 works on all browsers and devices"}),(0,l.jsx)(ke,{steps:["Toggle any feature on","Click Apply settings","Preferences saved automatically"]}),(0,l.jsx)(oe,{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)(V,{}),(0,l.jsx)(oe,{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)(V,{}),(0,l.jsx)(oe,{icon:"\u{1F399}\uFE0F",label:"Voice control",desc:"Say commands to navigate the page",checked:t.voiceControl,onChange:d=>n("voiceControl",d),disabled:!i,disabledReason:"Not supported in this browser",tip:'Say "scroll down", "go to main", "click"'}),(0,l.jsx)(V,{}),(0,l.jsx)(be,{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:a?"#f0fdfa":"#f5f3ff",borderRadius:"8px",border:`0.5px solid ${a?"#99f6e4":"#c4b5fd"}`,fontSize:"10px",color:a?"#0f766e":"#7c3aed",lineHeight:1.5},children:a?"\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."}),!a&&(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:Hn.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)(oe,{icon:"\u{1F4DD}",label:"Plain English mode",desc:"Rewrites complex text in simple language",checked:t.plainEnglish,onChange:d=>n("plainEnglish",d),disabled:!a,disabledReason:"Enable Gemini Nano \u2014 see setup above",tip:"AI concept: LLM text rewriting"}),(0,l.jsx)(V,{}),(0,l.jsx)(oe,{icon:"\u{1F4CB}",label:"Summarise page",desc:"3-sentence summary appears at top",checked:t.summarisePage,onChange:d=>n("summarisePage",d),disabled:!a,disabledReason:"Enable Gemini Nano \u2014 see setup above",tip:"AI concept: Abstractive summarisation"}),(0,l.jsx)(V,{}),(0,l.jsx)(oe,{icon:"\u{1F3F7}\uFE0F",label:"Smart aria-labels",desc:"AI generates meaningful labels for elements",checked:t.smartLabels,onChange:d=>n("smartLabels",d),disabled:!a,disabledReason:"Enable Gemini Nano \u2014 see setup above",tip:"AI concept: Context-aware label generation"}),(0,l.jsx)(V,{}),(0,l.jsx)(be,{label:"\u{1F441}\uFE0F Visual",concept:"CSS filter-based \u2014 works on all browsers and devices"}),(0,l.jsx)(ke,{steps:["Toggle any visual mode","Changes apply instantly","Works on mobile and desktop"]}),(0,l.jsx)(oe,{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)(V,{}),(0,l.jsx)(oe,{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)(V,{}),(0,l.jsx)(oe,{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)(V,{}),(0,l.jsx)(oe,{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)(V,{}),(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:Nn.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)(V,{}),(0,l.jsx)(be,{label:"\u{1F524} Font",concept:"Browser Font API + CSS \u2014 Chrome 103+"}),(0,l.jsx)(ke,{steps:["Toggle dyslexia font or pick from device","Adjust size with + / \u2212","Saved across visits"]}),(0,l.jsx)(oe,{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)(V,{}),(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+"}),O.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"}),O.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)(V,{}),(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=ge.indexOf(t.fontScale);d>0&&n("fontScale",ge[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:ge.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=ge.indexOf(t.fontScale);d<ge.length-1&&n("fontScale",ge[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)(V,{}),(0,l.jsx)(be,{label:"\u{1F310} Translate",color:"#7c3aed",badge:"Gemini Nano",concept:"Chrome Translation API \u2014 on device, no internet after setup"}),(0,l.jsx)(ke,{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:_e.slice(0,y?8:18).map(d=>(0,l.jsx)("button",{onClick:()=>n("translateLanguage",d.code),"aria-pressed":t.translateLanguage===d.code,disabled:!a,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:a?"pointer":"not-allowed",opacity:a?1:.5,minHeight:y?"36px":"auto"},children:d.label},d.code))}),!a&&(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)(V,{}),(0,l.jsx)(be,{label:"\u{1F4AC} Ask This Page",color:"#0d9488",badge:T,concept:"RAG \u2014 Retrieval Augmented Generation. Works on all devices including mobile."}),(0,l.jsx)(ke,{steps:["Type any question about this page","Press Ask or hit Enter",w==="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:w==="gemini"?"#f0fdfa":w==="transformers"?"#f5f3ff":"#f8fafc",borderRadius:"8px",border:`0.5px solid ${w==="gemini"?"#99f6e4":w==="transformers"?"#c4b5fd":"#e2e8f0"}`,fontSize:"10px",color:w==="gemini"?"#0f766e":w==="transformers"?"#7c3aed":"#94a3b8"},children:[w==="gemini"&&"\u2705 Using Gemini Nano \u2014 on device, private, instant",w==="transformers"&&"\u2705 Using Transformers.js \u2014 works on mobile and all browsers",!w&&"\u23F3 Detecting AI engine...",w==="transformers"&&z==="loading"&&" \xB7 Loading model...",w==="transformers"&&z==="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:L,onChange:d=>S(d.target.value),onKeyDown:d=>{d.key==="Enter"&&A()},placeholder:"e.g. What does this page do?",disabled:C||!w,"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:w?"#fff":"#f8fafc",outline:"none",height:y?"44px":"36px"}}),(0,l.jsx)("button",{onClick:A,disabled:C||!L.trim()||!w,"aria-label":"Ask question",style:{padding:"8px 14px",borderRadius:"8px",border:"none",background:w&&L.trim()&&!C?"#0d9488":"#e2e8f0",color:w&&L.trim()&&!C?"#fff":"#94a3b8",fontSize:"12px",fontWeight:600,cursor:w&&L.trim()&&!C?"pointer":"not-allowed",flexShrink:0,height:y?"44px":"36px",minWidth:"52px",transition:"background 0.2s"},children:C?J:"Ask"})]}),I&&(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"}),I,(0,l.jsx)("button",{onClick:()=>{R(""),S("")},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"})]})]})});ft.displayName="WidgetPanel";we();m();var re=require("react");m();var On={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"]},_n={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"]},Gn={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"]},Dn={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"]},qn={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 jn(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 a=r[1].trim();if(a.length>2&&a.length<40)return a}}return"My Business"}function Vn(e){let t=e.toLowerCase(),o="generic",r=0;for(let[a,i]of Object.entries(On)){let n=0;for(let s of i)t.includes(s)&&n++;n>r&&(r=n,o=a)}return o}function Un(e,t){let o=e.toLowerCase(),r=new Set($n[t]);for(let[a,i]of Object.entries(_n))for(let n of i)if(o.includes(n)){r.add(a);break}return r.add("home"),r.add("contact"),Array.from(r)}function Yn(e){let t=e.toLowerCase(),o=[];for(let[r,a]of Object.entries(Gn))for(let i of a)if(t.includes(i)){o.push(r);break}return o}function Kn(e,t){let o=e.toLowerCase();for(let[r,a]of Object.entries(Dn))for(let i of a)if(o.includes(i))return r;return qn[t]}function ao(e){let t=Vn(e),o=Un(e,t),r=Yn(e),a=Kn(e,t);return{siteName:jn(e),websiteType:t,pages:o,features:r,theme:a,description:e.slice(0,200)}}var f=require("react/jsx-runtime"),Qn=["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"],er={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}"},tr={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 bt({position:e,onClose:t}){let[o,r]=(0,re.useState)("input"),[a,i]=(0,re.useState)(""),[n,s]=(0,re.useState)(null),[c,p]=(0,re.useState)(0),[h,y]=(0,re.useState)(""),Y=(0,re.useCallback)(()=>{if(!a.trim())return;let S=ao(a);s(S),r("preview")},[a]),O=(0,re.useCallback)(async()=>{if(n){r("generating"),p(0),y("");try{let S=[{msg:"Parsing requirement...",pct:15},{msg:"Loading templates...",pct:30},{msg:"Generating pages...",pct:55},{msg:"Building components...",pct:70},{msg:"Creating styles...",pct:85},{msg:"Packaging ZIP...",pct:95}];for(let R of S)p(R.pct),await new Promise(C=>setTimeout(C,200));let{generateZip:I}=await Promise.resolve().then(()=>(zo(),Io));await I(n),p(100),r("done")}catch(S){y(S instanceof Error?S.message:"Generation failed. Please try again."),r("preview")}}},[n]),q=()=>{r("input"),i(""),s(null),p(0),y("")},L={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,f.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":"yuktai Vibe Coder","data-yuktai-panel":"true",style:L,children:[(0,f.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,f.jsxs)("div",{children:[(0,f.jsx)("p",{style:{margin:"0 0 2px",fontSize:"13px",fontWeight:700,color:"#0f172a"},children:"\u26A1 Vibe Coder"}),(0,f.jsx)("p",{style:{margin:0,fontSize:"10px",color:"#64748b"},children:"Describe your website \u2192 Download Next.js ZIP"})]}),(0,f.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,f.jsxs)("div",{style:{padding:"14px 16px"},children:[(0,f.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,f.jsx)("p",{style:{margin:"0 0 6px",fontSize:"10px",fontWeight:600,color:"#94a3b8",textTransform:"uppercase"},children:"Examples"}),(0,f.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:"4px",marginBottom:"12px"},children:Qn.slice(0,3).map(S=>(0,f.jsx)("button",{onClick:()=>i(S),style:{padding:"6px 10px",borderRadius:"8px",border:"1px solid #e2e8f0",background:"#f8fafc",color:"#475569",fontSize:"10px",cursor:"pointer",textAlign:"left",lineHeight:1.4},children:S},S))}),(0,f.jsx)("textarea",{value:a,onChange:S=>i(S.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,f.jsx)("button",{onClick:Y,disabled:!a.trim(),style:{width:"100%",marginTop:"10px",padding:"10px",borderRadius:"8px",border:"none",background:a.trim()?"#f59e0b":"#e2e8f0",color:a.trim()?"#fff":"#94a3b8",fontSize:"13px",fontWeight:700,cursor:a.trim()?"pointer":"not-allowed",transition:"background 0.2s"},children:"Analyse Requirement \u2192"})]}),o==="preview"&&n&&(0,f.jsxs)("div",{style:{padding:"14px 16px"},children:[h&&(0,f.jsxs)("div",{style:{padding:"10px",background:"#fef2f2",border:"1px solid #fca5a5",borderRadius:"8px",marginBottom:"12px",fontSize:"11px",color:"#dc2626"},children:["\u26A0\uFE0F ",h]}),(0,f.jsxs)("div",{style:{background:"#f8fafc",borderRadius:"10px",padding:"12px",marginBottom:"12px"},children:[(0,f.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px"},children:[(0,f.jsx)("span",{style:{fontSize:"1.5rem"},children:tr[n.websiteType]||"\u{1F310}"}),(0,f.jsxs)("div",{children:[(0,f.jsx)("p",{style:{margin:0,fontSize:"13px",fontWeight:700,color:"#0f172a"},children:n.siteName}),(0,f.jsxs)("p",{style:{margin:0,fontSize:"10px",color:"#64748b",textTransform:"capitalize"},children:[n.websiteType," website \xB7 ",n.theme," theme"]})]})]}),(0,f.jsxs)("p",{style:{margin:"8px 0 6px",fontSize:"10px",fontWeight:600,color:"#94a3b8",textTransform:"uppercase"},children:["Pages to generate (",n.pages.length,")"]}),(0,f.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px"},children:n.pages.map(S=>(0,f.jsxs)("span",{style:{padding:"2px 8px",borderRadius:"99px",background:"#f0fdf4",border:"1px solid #86efac",fontSize:"10px",color:"#166534",fontWeight:500},children:[er[S]||"\u{1F4C4}"," ",S]},S))}),n.features.length>0&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("p",{style:{margin:"10px 0 6px",fontSize:"10px",fontWeight:600,color:"#94a3b8",textTransform:"uppercase"},children:"Detected features"}),(0,f.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px"},children:n.features.map(S=>(0,f.jsx)("span",{style:{padding:"2px 8px",borderRadius:"99px",background:"#f5f3ff",border:"1px solid #c4b5fd",fontSize:"10px",color:"#7c3aed",fontWeight:500},children:S},S))})]})]}),(0,f.jsxs)("div",{style:{margin:"0 0 12px",padding:"10px 12px",background:"#f0fdf4",borderRadius:"8px",border:"1px solid #86efac"},children:[(0,f.jsx)("p",{style:{margin:"0 0 4px",fontSize:"10px",fontWeight:700,color:"#166534"},children:"\u{1F4E6} What you get:"}),(0,f.jsxs)("p",{style:{margin:0,fontSize:"10px",color:"#166534",lineHeight:1.6},children:["\u2705 Complete Next.js 16 project",(0,f.jsx)("br",{}),"\u2705 Tailwind CSS + CSS Modules",(0,f.jsx)("br",{}),"\u2705 TypeScript configured",(0,f.jsx)("br",{}),"\u2705 Navbar + Footer components",(0,f.jsx)("br",{}),"\u2705 All ",n.pages.length," pages ready",(0,f.jsx)("br",{}),"\u2705 Mobile responsive",(0,f.jsx)("br",{}),"\u2705 npm run dev \u2192 works immediately"]})]}),(0,f.jsxs)("div",{style:{display:"flex",gap:"8px"},children:[(0,f.jsx)("button",{onClick:q,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,f.jsx)("button",{onClick:O,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,f.jsxs)("div",{style:{padding:"2rem 16px",textAlign:"center"},children:[(0,f.jsx)("p",{style:{fontSize:"2rem",marginBottom:"1rem"},children:"\u26A1"}),(0,f.jsx)("p",{style:{fontSize:"13px",fontWeight:700,color:"#0f172a",marginBottom:"0.5rem"},children:"Generating your project..."}),(0,f.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,f.jsx)("div",{style:{height:"8px",background:"#e2e8f0",borderRadius:"99px",overflow:"hidden"},children:(0,f.jsx)("div",{style:{height:"100%",width:`${c}%`,background:"#f59e0b",borderRadius:"99px",transition:"width 0.3s ease"}})}),(0,f.jsxs)("p",{style:{marginTop:"0.5rem",fontSize:"10px",color:"#94a3b8"},children:[c,"%"]})]}),o==="done"&&n&&(0,f.jsxs)("div",{style:{padding:"2rem 16px",textAlign:"center"},children:[(0,f.jsx)("p",{style:{fontSize:"3rem",marginBottom:"0.75rem"},children:"\u2705"}),(0,f.jsxs)("p",{style:{fontSize:"14px",fontWeight:700,color:"#0f172a",marginBottom:"0.5rem"},children:[n.siteName," downloaded!"]}),(0,f.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(S=>(0,f.jsx)("div",{style:{background:"#0f172a",borderRadius:"8px",padding:"8px 12px",marginBottom:"6px",textAlign:"left"},children:(0,f.jsxs)("code",{style:{fontSize:"12px",color:"#a7f3d0",fontFamily:"monospace"},children:["$ ",S]})},S)),(0,f.jsx)("p",{style:{fontSize:"11px",color:"#10b981",margin:"1rem 0",fontWeight:600},children:"Then open http://localhost:3000 \u{1F680}"}),(0,f.jsxs)("div",{style:{display:"flex",gap:"8px"},children:[(0,f.jsx)("button",{onClick:q,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,f.jsx)("button",{onClick:O,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 v=require("react/jsx-runtime");async function ir(){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 Ue({position:e="left",children:t,config:o={},showRag:r=!1,showAgent:a=!1}){let[i,n]=(0,k.useState)(!1),[s,c]=(0,k.useState)(mt),[p,h]=(0,k.useState)(null),[y,Y]=(0,k.useState)(!1),[O,q]=(0,k.useState)(!1),[L,S]=(0,k.useState)(!1),I=k.default.useRef(null),[R,C]=(0,k.useState)(!1),[$,w]=(0,k.useState)(""),[M,z]=(0,k.useState)(""),[W,A]=(0,k.useState)(!1),[T,J]=(0,k.useState)(null),[te,d]=(0,k.useState)("idle"),[Q,x]=(0,k.useState)(!1),[K,ne]=(0,k.useState)(""),[Ke,ce]=(0,k.useState)(""),[g,N]=(0,k.useState)(!1),[_,j]=(0,k.useState)([]),[H,wt]=(0,k.useState)(null),qo=24,kt=84,St=r?144:84,mr=204,[ze,Xe]=(0,k.useState)(!1);(0,k.useEffect)(()=>{if(typeof window>"u")return;let u=window;!!(u.LanguageModel||u.ai?.languageModel)&&O?(J("gemini"),wt("gemini")):xe()&&(J("transformers"),wt("transformers"))},[O]),(0,k.useEffect)(()=>{if(T!=="transformers")return;let u=setInterval(()=>d(ve()),500);return()=>clearInterval(u)},[T]);let At=(0,k.useCallback)(async()=>{if(!(!$.trim()||W)){if(!T){z("\u26A0\uFE0F No AI engine available.");return}A(!0),z("");try{let u;if(T==="gemini"){let{askPage:P}=await Promise.resolve().then(()=>(ct(),eo));u=await P($)}else{d("loading");let{askPageWithTransformers:P}=await Promise.resolve().then(()=>(we(),ut));u=await P($),d("ready")}z(u.success&&u.answer?u.answer.replace(/\*\*(.*?)\*\*/g,"$1").replace(/\*(.*?)\*/g,"$1").replace(/#+\s/g,"").trim():"\u26A0\uFE0F "+(u.error||"No answer found."))}catch{z("\u26A0\uFE0F Something went wrong.")}A(!1)}},[$,W,T]),Tt=(0,k.useCallback)(async()=>{if(!K.trim()||g)return;if(!H){ce("\u26A0\uFE0F No AI engine available.");return}N(!0),j([]),ce("");let{runAgent:u}=await Promise.resolve().then(()=>($o(),Oo));await u(K,H,P=>{j(ae=>[...ae,P.text])}),N(!1),ce("done")},[K,g,H]);(0,k.useEffect)(()=>{if(typeof window>"u")return;let P=setTimeout(async()=>{let ae=window,Ko=await ir();q(Ko),S(!!(ae.SpeechRecognition||ae.webkitSpeechRecognition))},800);return()=>clearTimeout(P)},[]),(0,k.useEffect)(()=>{if(!(typeof window>"u"))try{let u=localStorage.getItem("yuktai-a11y-prefs");u&&c(P=>({...P,...JSON.parse(u)}))}catch{}},[]);let Et=(0,k.useCallback)(async u=>{let P={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 Z.execute(P),h(Z.applyFixes(P)),Y(!0)},[o]),jo=(0,k.useCallback)(async()=>{try{localStorage.setItem("yuktai-a11y-prefs",JSON.stringify(s))}catch{}await Et(s),n(!1)},[s,Et]),Vo=(0,k.useCallback)(()=>{c(mt);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(P=>u.removeAttribute(P)),document.body.style.filter="",document.body.style.fontFamily="",document.documentElement.style.fontSize="",h(null),Y(!1)},[]),Uo=(0,k.useCallback)((u,P)=>{c(ae=>({...ae,[u]:P}))},[]);(0,k.useEffect)(()=>{let u=P=>{P.key==="Escape"&&(i&&n(!1),R&&C(!1),Q&&x(!1),ze&&Xe(!1))};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[i,R,Q]),(0,k.useEffect)(()=>{i&&I.current&&Z.trapFocus(I.current)},[i]);let Ne=(u,P,ae)=>({position:"fixed",bottom:`${u}px`,[e]:"24px",zIndex:9998,width:"52px",height:"52px",borderRadius:"50%",background:P,color:"#fff",border:"none",cursor:"pointer",fontSize:"22px",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 4px 16px rgba(0,0,0,0.25)",transition:"transform 0.15s, background 0.2s"}),He=u=>{u.currentTarget.style.transform="scale(1.08)"},Be=u=>{u.currentTarget.style.transform="scale(1)"},Ct=T==="gemini"?"Gemini Nano \xB7 On device":T==="transformers"?"Transformers.js \xB7 All devices":"Detecting...",Yo=T==="transformers"&&te==="loading"?"Loading model...":"...";return(0,v.jsxs)(v.Fragment,{children:[t,a&&(0,v.jsx)("button",{style:Ne(204,ze?"#d97706":"#f59e0b",ze),"aria-label":"Open Vibe Coder",title:"\u26A1 Vibe Coder \u2014 Generate Next.js project",onClick:()=>{Xe(u=>!u),x(!1),C(!1),n(!1)},onMouseEnter:He,onMouseLeave:Be,children:"\u26A1"}),a&&ze&&(0,v.jsx)(bt,{position:e,onClose:()=>Xe(!1)}),a&&(0,v.jsx)("button",{style:Ne(St,Q?"#059669":"#10b981",Q),"aria-label":"Open AI agent","aria-haspopup":"dialog","aria-expanded":Q,title:"\u{1F916} AI Agent \u2014 guide me through this page",onClick:()=>{x(u=>!u),C(!1),n(!1)},onMouseEnter:He,onMouseLeave:Be,children:"\u{1F916}"}),a&&Q&&(0,v.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":"yuktai AI Agent","data-yuktai-panel":"true",style:{position:"fixed",bottom:`${St+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,v.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"10px"},children:[(0,v.jsxs)("div",{children:[(0,v.jsx)("p",{style:{margin:"0 0 2px",fontSize:"13px",fontWeight:600,color:"#0f172a"},children:"\u{1F916} AI Agent"}),(0,v.jsx)("p",{style:{margin:0,fontSize:"10px",color:"#10b981"},children:H==="gemini"?"Gemini Nano \xB7 On device":H==="transformers"?"Transformers.js \xB7 All devices":"Detecting..."})]}),(0,v.jsx)("button",{onClick:()=>x(!1),"aria-label":"Close agent panel",style:{background:"none",border:"none",cursor:"pointer",color:"#94a3b8",fontSize:"18px",lineHeight:1,padding:"2px"},children:"\xD7"})]}),(0,v.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,v.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,v.jsx)("button",{onClick:()=>ne(u),style:{padding:"3px 8px",borderRadius:"20px",fontSize:"10px",border:"1px solid #e2e8f0",background:"#f8fafc",color:"#64748b",cursor:"pointer"},children:u},u))}),(0,v.jsxs)("div",{style:{display:"flex",gap:"6px",marginBottom:"8px"},children:[(0,v.jsx)("input",{type:"text",value:K,onChange:u=>ne(u.target.value),onKeyDown:u=>{u.key==="Enter"&&Tt()},placeholder:"e.g. Help me fill this form",disabled:g||!H,"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:H?"#fff":"#f8fafc",outline:"none",height:"36px"}}),(0,v.jsx)("button",{onClick:Tt,disabled:g||!K.trim()||!H,"aria-label":"Run agent",style:{padding:"8px 12px",borderRadius:"8px",border:"none",background:H&&K.trim()&&!g?"#10b981":"#e2e8f0",color:H&&K.trim()&&!g?"#fff":"#94a3b8",fontSize:"12px",fontWeight:600,cursor:H&&K.trim()&&!g?"pointer":"not-allowed",height:"36px",minWidth:"52px",transition:"background 0.2s"},children:g?"...":"Go"})]}),_.length>0&&(0,v.jsxs)("div",{style:{padding:"10px 12px",background:"#f0fdf4",border:"1px solid #86efac",borderRadius:"8px",fontSize:"11px",color:"#166534",lineHeight:1.7},children:[_.map((u,P)=>(0,v.jsx)("p",{style:{margin:"0 0 2px"},children:u},P)),Ke==="done"&&(0,v.jsx)("button",{onClick:()=>{j([]),ne(""),ce("")},style:{display:"block",marginTop:"6px",background:"none",border:"none",color:"#94a3b8",fontSize:"10px",cursor:"pointer",padding:0},children:"Clear"})]}),!H&&(0,v.jsx)("p",{style:{margin:"4px 0 0",fontSize:"10px",color:"#94a3b8"},children:"Enable Gemini Nano via chrome://flags for best results."})]}),r&&(0,v.jsx)("button",{style:Ne(kt,R?"#7c3aed":"#6d28d9",R),"aria-label":"Ask a question about this page","aria-haspopup":"dialog","aria-expanded":R,title:`\u{1F4AC} Ask this page \xB7 ${Ct}`,onClick:()=>{C(u=>!u),n(!1),x(!1)},onMouseEnter:He,onMouseLeave:Be,children:"\u{1F4AC}"}),r&&R&&(0,v.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":"Ask this page","data-yuktai-panel":"true",style:{position:"fixed",bottom:`${kt+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,v.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"10px"},children:[(0,v.jsxs)("div",{children:[(0,v.jsx)("p",{style:{margin:"0 0 2px",fontSize:"13px",fontWeight:600,color:"#0f172a"},children:"\u{1F4AC} Ask this page"}),(0,v.jsx)("p",{style:{margin:0,fontSize:"10px",color:"#7c3aed"},children:Ct}),T==="transformers"&&te==="loading"&&(0,v.jsx)("p",{style:{margin:"2px 0 0",fontSize:"9px",color:"#94a3b8"},children:"Downloading model \u2014 first time only"}),T==="transformers"&&te==="ready"&&(0,v.jsx)("p",{style:{margin:"2px 0 0",fontSize:"9px",color:"#10b981"},children:"Model ready \u2705 \u2014 works offline"})]}),(0,v.jsx)("button",{onClick:()=>C(!1),"aria-label":"Close ask panel",style:{background:"none",border:"none",cursor:"pointer",color:"#94a3b8",fontSize:"18px",lineHeight:1,padding:"2px"},children:"\xD7"})]}),(0,v.jsxs)("div",{style:{display:"flex",gap:"6px",marginBottom:"8px"},children:[(0,v.jsx)("input",{type:"text",value:$,onChange:u=>w(u.target.value),onKeyDown:u=>{u.key==="Enter"&&At()},placeholder:"e.g. What does this page do?",disabled:W||!T,"aria-label":"Ask a question about this page",style:{flex:1,padding:"8px 10px",borderRadius:"8px",border:"1px solid #e2e8f0",fontSize:"12px",color:"#0f172a",background:T?"#fff":"#f8fafc",outline:"none",height:"36px"}}),(0,v.jsx)("button",{onClick:At,disabled:W||!$.trim()||!T,"aria-label":"Submit question",style:{padding:"8px 12px",borderRadius:"8px",border:"none",background:T&&$.trim()&&!W?"#7c3aed":"#e2e8f0",color:T&&$.trim()&&!W?"#fff":"#94a3b8",fontSize:"12px",fontWeight:600,cursor:T&&$.trim()&&!W?"pointer":"not-allowed",height:"36px",minWidth:"48px",transition:"background 0.2s"},children:W?Yo:"Ask"})]}),M&&(0,v.jsxs)("div",{style:{padding:"10px",background:"#f5f3ff",borderRadius:"8px",fontSize:"12px",color:"#4c1d95",lineHeight:1.6,maxHeight:"180px",overflowY:"auto"},children:[(0,v.jsx)("strong",{style:{display:"block",marginBottom:"4px",fontSize:"11px",color:"#7c3aed"},children:"\u{1F4AC} Answer"}),M,(0,v.jsx)("button",{onClick:()=>{z(""),w("")},style:{display:"block",marginTop:"6px",background:"none",border:"none",color:"#94a3b8",fontSize:"10px",cursor:"pointer",padding:0},children:"Clear"})]}),!T&&(0,v.jsx)("p",{style:{margin:"4px 0 0",fontSize:"10px",color:"#94a3b8"},children:"Detecting AI engine..."})]}),(0,v.jsx)("button",{style:Ne(qo,y?"#0d9488":"#1a73e8",i),"aria-label":"Open accessibility preferences","aria-haspopup":"dialog","aria-expanded":i,"data-yuktai-pref-toggle":"true",title:"\u267F Accessibility settings",onClick:()=>{n(u=>!u),C(!1),x(!1)},onMouseEnter:He,onMouseLeave:Be,children:"\u267F"}),i&&(0,v.jsx)(ft,{ref:I,position:e,settings:s,report:p,isActive:y,aiSupported:O,voiceSupported:L,set:Uo,onApply:jo,onReset:Vo,onClose:()=>n(!1)})]})}m();var Se={name:"ai.text",async execute(e){return`\u{1F916} YuktAI says: ${e}`}};m();var Ae={name:"voice.text",async execute(e){return!e||e.trim()===""?"\u{1F3A4} No speech detected":`\u{1F3A4} You said: ${e}`}};m();var se=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 ye=require("react");m();var G=require("react");function sr(e){return e===!1?Number.MAX_SAFE_INTEGER:e===!0||e===void 0?10:e.pageSize??10}function Ye(e){let{data:t,columns:o,pagination:r=!0,mobileBreakpoint:a=768}=e,[i,n]=(0,G.useState)(null),[s,c]=(0,G.useState)(""),[p,h]=(0,G.useState)(1),[y,Y]=(0,G.useState)(sr(r)),[O,q]=(0,G.useState)(!1);(0,G.useEffect)(()=>{if(typeof window>"u")return;let M=()=>{q(window.innerWidth<a)};return M(),window.addEventListener("resize",M),()=>window.removeEventListener("resize",M)},[a]);let L=(0,G.useCallback)(M=>{n(z=>!z||z.key!==M?{key:M,direction:"asc"}:z.direction==="asc"?{key:M,direction:"desc"}:null),h(1)},[]),S=(0,G.useCallback)(()=>n(null),[]),I=(0,G.useMemo)(()=>{if(!s.trim())return t;let M=s.toLowerCase().trim();return t.filter(z=>o.some(W=>{let A=z[W.key];return A==null?!1:String(A).toLowerCase().includes(M)}))},[t,s,o]),R=(0,G.useMemo)(()=>{if(!i)return I;let M=[...I].sort((z,W)=>{let A=z[i.key],T=W[i.key];if(A===T)return 0;if(A==null)return 1;if(T==null)return-1;if(typeof A=="number"&&typeof T=="number")return A-T;if(A instanceof Date&&T instanceof Date)return A.getTime()-T.getTime();let J=String(A),te=String(T);return J.localeCompare(te,void 0,{sensitivity:"base",numeric:!0})});return i.direction==="desc"?M.reverse():M},[I,i]),C=Math.max(1,Math.ceil(R.length/y)),$=(0,G.useMemo)(()=>{if(r===!1)return R;let M=(p-1)*y;return R.slice(M,M+y)},[R,p,y,r]),w=(0,G.useCallback)(()=>{n(null),c(""),h(1)},[]);return(0,G.useEffect)(()=>{p>C&&h(C)},[p,C]),{displayedData:$,totalCount:t.length,filteredCount:R.length,sort:i,toggleSort:L,clearSort:S,searchQuery:s,setSearchQuery:c,page:p,pageSize:y,totalPages:C,setPage:h,setPageSize:Y,isMobile:O,reset:w}}m();m();var _o=require("react/jsx-runtime");function D({size:e=20,color:t="currentColor",strokeWidth:o=2.5,label:r,children:a,...i}){return(0,_o.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",...i,children:a})}var Te=require("react/jsx-runtime");function Ee(e){return(0,Te.jsxs)(D,{...e,children:[(0,Te.jsx)("circle",{cx:"11",cy:"11",r:"7"}),(0,Te.jsx)("path",{d:"m20 20-4-4"})]})}m();var Ce=require("react/jsx-runtime");function Fe(e){return(0,Ce.jsxs)(D,{...e,children:[(0,Ce.jsx)("path",{d:"M12 19V5"}),(0,Ce.jsx)("path",{d:"m5 12 7-7 7 7"})]})}m();var Le=require("react/jsx-runtime");function Re(e){return(0,Le.jsxs)(D,{...e,children:[(0,Le.jsx)("path",{d:"M12 5v14"}),(0,Le.jsx)("path",{d:"m5 12 7 7 7-7"})]})}m();var yt=require("react/jsx-runtime");function Me(e){return(0,yt.jsx)(D,{...e,children:(0,yt.jsx)("path",{d:"m15 18-6-6 6-6"})})}m();var ht=require("react/jsx-runtime");function Pe(e){return(0,ht.jsx)(D,{...e,children:(0,ht.jsx)("path",{d:"m9 18 6-6-6-6"})})}m();var Ie=require("react/jsx-runtime");function le(e){return(0,Ie.jsxs)(D,{...e,children:[(0,Ie.jsx)("path",{d:"M18 6 6 18"}),(0,Ie.jsx)("path",{d:"m6 6 12 12"})]})}var b=require("react/jsx-runtime"),lr={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"}},X={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 cr(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 Go(e){let{data:t,columns:o,view:r="auto",mobileBreakpoint:a=768,theme:i="default",pagination:n=!0,search:s=!0,selectable:c=!1,selectedKeys:p=[],rowKey:h,loading:y=!1,empty:Y,onSelectionChange:O,onRowClick:q,onSortChange:L,className:S}=e,[I,R]=(0,ye.useState)(p),{displayedData:C,filteredCount:$,sort:w,toggleSort:M,searchQuery:z,setSearchQuery:W,page:A,pageSize:T,totalPages:J,setPage:te,isMobile:d}=Ye({data:t,columns:o,pagination:n,mobileBreakpoint:a}),Q=r==="card"||r==="auto"&&d,x=lr[i],K=o.filter(g=>!(d&&g.hiddenOnMobile)),ne=(0,ye.useCallback)((g,N)=>h&&g[h]!==void 0?String(g[h]):g.id!==void 0?String(g.id):String(N),[h]),Ke=(0,ye.useCallback)(g=>{M(g),L?.(w)},[M,L,w]),ce=(0,ye.useCallback)(g=>{R(N=>{let _=N.includes(g)?N.filter(j=>j!==g):[...N,g];return O?.(_),_})},[O]);return y?(0,b.jsxs)("div",{role:"status","aria-live":"polite",style:{...x.container,padding:"3rem 2rem",textAlign:"center",borderRadius:8,border:`1px solid ${x.border}`},children:[(0,b.jsx)("div",{style:{display:"inline-block",width:32,height:32,border:`3px solid ${x.border}`,borderTopColor:x.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:X.loading})]}):t.length===0?(0,b.jsx)("div",{role:"status",style:{...x.container,padding:"3rem 2rem",textAlign:"center",borderRadius:8,border:`1px solid ${x.border}`},children:Y??(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(le,{size:40,color:x.muted}),(0,b.jsx)("div",{style:{marginTop:8,fontSize:16,fontWeight:500},children:X.noData})]})}):(0,b.jsxs)("div",{className:S,style:{...x.container,borderRadius:8,border:`1px solid ${x.border}`,overflow:"hidden"},"data-yuktai-grid":!0,"data-theme":i,children:[s&&(0,b.jsxs)("div",{style:{...x.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:x.muted},children:(0,b.jsx)(Ee,{size:18})}),(0,b.jsx)("input",{type:"search",value:z,onChange:g=>W(g.target.value),placeholder:X.search,"aria-label":X.search,style:{flex:1,width:"100%",padding:"10px 12px 10px 40px",fontSize:14,border:`1px solid ${x.border}`,borderRadius:8,background:"transparent",color:"inherit",minHeight:44,outline:"none",transition:"border-color 0.15s"},onFocus:g=>g.currentTarget.style.borderColor=x.accent,onBlur:g=>g.currentTarget.style.borderColor=x.border}),z&&(0,b.jsx)("button",{onClick:()=>W(""),"aria-label":X.clearSearch,style:{position:"absolute",right:8,background:"transparent",border:"none",cursor:"pointer",padding:4,display:"flex",alignItems:"center",color:x.muted,borderRadius:4},children:(0,b.jsx)(le,{size:16})})]}),c&&I.length>0&&(0,b.jsxs)("span",{style:{fontSize:13,color:"inherit",whiteSpace:"nowrap"},children:[I.length," ",X.rowsSelected]})]}),C.length===0&&z?(0,b.jsxs)("div",{style:{padding:"3rem 2rem",textAlign:"center",background:"transparent"},children:[(0,b.jsx)(le,{size:40,color:x.muted}),(0,b.jsx)("div",{style:{marginTop:8,fontSize:16,fontWeight:500},children:X.noResults}),(0,b.jsx)("div",{style:{marginTop:4,fontSize:13,color:x.muted},children:X.tryAgain}),(0,b.jsx)("button",{onClick:()=>W(""),style:{marginTop:16,padding:"8px 16px",background:x.accent,color:"#FFFFFF",border:"none",borderRadius:6,cursor:"pointer",fontSize:13,fontWeight:500},children:X.clearSearch})]}):Q?(0,b.jsx)("div",{role:"list",style:{padding:8},children:C.map((g,N)=>{let _=ne(g,N);return(0,b.jsx)("div",{role:"listitem",onClick:()=>q?.(g,N),style:{padding:12,marginBottom:8,border:`1px solid ${x.border}`,borderRadius:8,background:"transparent",cursor:q?"pointer":"default",minHeight:44},tabIndex:0,children:K.map(j=>(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:[j.label,":"]}),(0,b.jsx)("span",{style:x.cell,children:j.render?j.render(g[j.key],g,N):String(g[j.key]??"")})]},j.key))},_)})}):(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:{...x.header,padding:"10px 14px",width:44},children:(0,b.jsx)("input",{type:"checkbox","aria-label":"Select all",checked:I.length===C.length&&C.length>0,onChange:g=>{g.target.checked?R(C.map((N,_)=>ne(N,_))):R([])},style:{minWidth:20,minHeight:20,cursor:"pointer"}})}),K.map(g=>(0,b.jsx)("th",{role:"columnheader","aria-sort":w?.key===g.key?w.direction==="asc"?"ascending":"descending":"none",onClick:()=>g.sortable!==!1&&Ke(g.key),style:{...x.header,padding:"10px 14px",textAlign:g.align??"left",cursor:g.sortable!==!1?"pointer":"default",userSelect:"none",width:g.width,fontWeight:500,fontSize:12,textTransform:"uppercase",letterSpacing:"0.5px"},children:(0,b.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[g.label,w?.key===g.key&&(w.direction==="asc"?(0,b.jsx)(Fe,{size:14}):(0,b.jsx)(Re,{size:14}))]})},g.key))]})}),(0,b.jsx)("tbody",{children:C.map((g,N)=>{let _=ne(g,N),j=I.includes(_);return(0,b.jsxs)("tr",{role:"row","aria-selected":j,onClick:()=>q?.(g,N),style:{...x.row,cursor:q?"pointer":"default",background:j?x.rowHover.background:"transparent"},children:[c&&(0,b.jsx)("td",{style:{padding:"10px 14px"},children:(0,b.jsx)("input",{type:"checkbox","aria-label":`Select row ${N+1}`,checked:j,onChange:()=>ce(_),onClick:H=>H.stopPropagation(),style:{minWidth:20,minHeight:20,cursor:"pointer"}})}),K.map(H=>(0,b.jsx)("td",{role:"gridcell",style:{...x.cell,padding:"12px 14px",textAlign:H.align??"left"},children:H.render?H.render(g[H.key],g,N):String(g[H.key]??"")},H.key))]},_)})})]})}),n!==!1&&J>1&&C.length>0&&(0,b.jsxs)("div",{style:{...x.header,padding:"12px 16px",display:"flex",justifyContent:"space-between",alignItems:"center",borderTop:`1px solid ${x.border}`,borderBottom:"none",fontSize:13,flexWrap:"wrap",gap:12},children:[(0,b.jsxs)("span",{style:{color:x.muted},children:[X.showing," ",(0,b.jsxs)("strong",{style:{color:"inherit"},children:[(A-1)*T+1,"\u2013",Math.min(A*T,$)]})," ",X.of," ",(0,b.jsx)("strong",{style:{color:"inherit"},children:$})]}),(0,b.jsxs)("div",{style:{display:"flex",gap:4,alignItems:"center",flexWrap:"wrap"},children:[(0,b.jsx)("button",{onClick:()=>te(A-1),disabled:A===1,"aria-label":X.prev,style:{...x.pageBtn,padding:"8px 12px",borderRadius:6,cursor:A===1?"not-allowed":"pointer",opacity:A===1?.4:1,minHeight:36,display:"inline-flex",alignItems:"center",justifyContent:"center",transition:"all 0.15s"},children:(0,b.jsx)(Me,{size:16})}),cr(A,J).map((g,N)=>{if(g==="...")return(0,b.jsx)("span",{style:{padding:"0 4px",color:x.muted,minWidth:24,textAlign:"center"},children:"\u2026"},`ellipsis-${N}`);let _=g===A;return(0,b.jsx)("button",{onClick:()=>te(g),"aria-label":`${X.page} ${g}`,"aria-current":_?"page":void 0,style:{..._?x.pageBtnActive:x.pageBtn,minWidth:36,minHeight:36,padding:"8px 10px",borderRadius:6,cursor:"pointer",fontWeight:_?600:500,fontSize:13,transition:"all 0.15s"},children:g},g)}),(0,b.jsx)("button",{onClick:()=>te(A+1),disabled:A===J,"aria-label":X.next,style:{...x.pageBtn,padding:"8px 12px",borderRadius:6,cursor:A===J?"not-allowed":"pointer",opacity:A===J?.4:1,minHeight:36,display:"inline-flex",alignItems:"center",justifyContent:"center",transition:"all 0.15s"},children:(0,b.jsx)(Pe,{size:16})})]})]})]})}m();m();var xt=require("react/jsx-runtime");function vt(e){return(0,xt.jsx)(D,{...e,children:(0,xt.jsx)("path",{d:"M5 12.5 10 17.5 19.5 7"})})}function dr(){if(typeof globalThis>"u")return new se;if(!globalThis.__yuktai_runtime__){let e=new se;e.register(Z.name,Z),e.register(Se.name,Se),e.register(Ae.name,Ae),globalThis.__yuktai_runtime__=e}return globalThis.__yuktai_runtime__}var Do=typeof window<"u"?dr():new se,pr={wcagPlugin:Z,list(){return Do.getPlugins()},use(e){return Do.use(e)},fix(e){return Z.applyFixes({enabled:!0,autoFix:!0,...e})},scan(){return Z.scan()}};