aria-ease 7.3.0 → 7.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/CheckboxComponentStrategy-AZF2Y4MN.js +1 -0
  2. package/dist/RadioComponentStrategy-GKA5KOM5.js +1 -0
  3. package/dist/cli.cjs +30 -30
  4. package/dist/cli.js +1 -1
  5. package/dist/{contractTestRunnerPlaywright-SJIHHZ3Y.js → contractTestRunnerPlaywright-75NI6SN7.js} +5 -5
  6. package/dist/{contractTestRunnerPlaywright-IFI5BPGV.js → contractTestRunnerPlaywright-VLOD5IB3.js} +5 -5
  7. package/dist/index.cjs +39 -39
  8. package/dist/index.d.cts +24 -11
  9. package/dist/index.d.ts +24 -11
  10. package/dist/index.js +8 -8
  11. package/dist/src/{Types.d-DYfYR3Vc.d.cts → Types.d-D96FYkCN.d.cts} +22 -1
  12. package/dist/src/{Types.d-DYfYR3Vc.d.ts → Types.d-D96FYkCN.d.ts} +22 -1
  13. package/dist/src/accordion/index.d.cts +1 -1
  14. package/dist/src/accordion/index.d.ts +1 -1
  15. package/dist/src/block/index.d.cts +1 -1
  16. package/dist/src/block/index.d.ts +1 -1
  17. package/dist/src/checkbox/index.cjs +1 -1
  18. package/dist/src/checkbox/index.d.cts +2 -6
  19. package/dist/src/checkbox/index.d.ts +2 -6
  20. package/dist/src/checkbox/index.js +1 -1
  21. package/dist/src/combobox/index.d.cts +1 -1
  22. package/dist/src/combobox/index.d.ts +1 -1
  23. package/dist/src/menu/index.d.cts +1 -1
  24. package/dist/src/menu/index.d.ts +1 -1
  25. package/dist/src/radio/index.cjs +1 -1
  26. package/dist/src/radio/index.d.cts +3 -7
  27. package/dist/src/radio/index.d.ts +3 -7
  28. package/dist/src/radio/index.js +1 -1
  29. package/dist/src/tabs/index.d.cts +1 -1
  30. package/dist/src/tabs/index.d.ts +1 -1
  31. package/dist/src/toggle/index.d.cts +1 -1
  32. package/dist/src/toggle/index.d.ts +1 -1
  33. package/dist/src/utils/test/CheckboxComponentStrategy-ST2DWNYT.js +1 -0
  34. package/dist/src/utils/test/RadioComponentStrategy-TWMIMSYX.js +1 -0
  35. package/dist/src/utils/test/{contractTestRunnerPlaywright-Y7N2W6AK.js → contractTestRunnerPlaywright-FSZDW7IR.js} +5 -5
  36. package/dist/src/utils/test/dsl/index.cjs +1 -1
  37. package/dist/src/utils/test/dsl/index.js +1 -1
  38. package/dist/src/utils/test/index.cjs +28 -28
  39. package/dist/src/utils/test/index.js +1 -1
  40. package/dist/{test-2XAMHIKD.js → test-FURQN5KO.js} +1 -1
  41. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -1,47 +1,47 @@
1
- "use strict";var jt=Object.create;var Ae=Object.defineProperty;var Kt=Object.getOwnPropertyDescriptor;var Wt=Object.getOwnPropertyNames;var zt=Object.getPrototypeOf,Jt=Object.prototype.hasOwnProperty;var Q=(s,e)=>()=>(s&&(e=s(s=0)),e);var ce=(s,e)=>{for(var t in e)Ae(s,t,{get:e[t],enumerable:!0})},Te=(s,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Wt(e))!Jt.call(s,n)&&n!==t&&Ae(s,n,{get:()=>e[n],enumerable:!(r=Kt(e,n))||r.enumerable});return s},Ee=(s,e,t)=>(Te(s,e,"default"),t&&Te(t,e,"default")),ne=(s,e,t)=>(t=s!=null?jt(zt(s)):{},Te(e||!s||!s.__esModule?Ae(t,"default",{value:s,enumerable:!0}):t,s)),Gt=s=>Te(Ae({},"__esModule",{value:!0}),s);async function Hr(){return de||(de=await dt.chromium.launch({headless:!0,args:["--disable-extensions","--disable-blink-features=AutomationControlled"]})),de}async function Pr(){return ge||(ge=await(await Hr()).newContext({permissions:[],ignoreHTTPSErrors:!0})),ge}async function gt(){return await(await Pr()).newPage()}async function mt(){ge&&(await ge.close(),ge=null),de&&(await de.close(),de=null)}var dt,de,ge,Ne=Q(()=>{"use strict";dt=require("playwright"),de=null,ge=null});function pe(s){return s==="required"||s==="recommended"||s==="optional"?s:Ir}function ye(s){return s==="minimal"||s==="balanced"||s==="strict"||s==="paranoid"?s:"balanced"}function ht(s,e){return{minimal:{required:"error",recommended:"ignore",optional:"ignore"},balanced:{required:"error",recommended:"warning",optional:"ignore"},strict:{required:"error",recommended:"error",optional:"warning"},paranoid:{required:"error",recommended:"error",optional:"error"}}[e][s]}var Ir,je=Q(()=>{"use strict";Ir="required"});var bt={};ce(bt,{loadConfig:()=>Vr});function Dr(s){let e=[];if(!s||typeof s!="object")return e.push("Config must be an object"),{valid:!1,errors:e};let t=s;if(t.audit!==void 0){if(typeof t.audit!="object"||t.audit===null)e.push("audit must be an object");else if(t.audit.urls!==void 0&&(Array.isArray(t.audit.urls)?t.audit.urls.some(r=>typeof r!="string")&&e.push("audit.urls must contain only strings"):e.push("audit.urls must be an array")),t.audit.output!==void 0)if(typeof t.audit.output!="object")e.push("audit.output must be an object");else{let r=t.audit.output;r.format!==void 0&&(["json","csv","html","all"].includes(r.format)||e.push("audit.output.format must be one of: json, csv, html, all")),r.out!==void 0&&typeof r.out!="string"&&e.push("audit.output.out must be a string")}}if(t.test!==void 0)if(typeof t.test!="object"||t.test===null)e.push("test must be an object");else{t.test.disableTimeouts!==void 0&&typeof t.test.disableTimeouts!="boolean"&&e.push("test.disableTimeouts must be a boolean when provided");let r=["actionTimeoutMs","assertionTimeoutMs","navigationTimeoutMs","componentReadyTimeoutMs"];for(let n of r){let i=t.test[n];i!==void 0&&(typeof i!="number"||!Number.isFinite(i)||i<0)&&e.push(`test.${n} must be a non-negative number when provided`)}t.test.components!==void 0&&(Array.isArray(t.test.components)?t.test.components.forEach((n,i)=>{if(typeof n!="object"||n===null)e.push(`test.components[${i}] must be an object`);else{typeof n.name!="string"&&e.push(`test.components[${i}].name must be a string`),n.contractPath!==void 0&&typeof n.contractPath!="string"&&e.push(`test.components[${i}].contractPath must be a string when provided`),n.strategyPath!==void 0&&typeof n.strategyPath!="string"&&e.push(`test.components[${i}].strategyPath must be a string when provided`),n.strictness!==void 0&&!["minimal","balanced","strict","paranoid"].includes(n.strictness)&&e.push(`test.components[${i}].strictness must be one of: minimal, balanced, strict, paranoid`),n.disableTimeouts!==void 0&&typeof n.disableTimeouts!="boolean"&&e.push(`test.components[${i}].disableTimeouts must be a boolean when provided`);let a=["actionTimeoutMs","assertionTimeoutMs","navigationTimeoutMs","componentReadyTimeoutMs"];for(let o of a){let u=n[o];u!==void 0&&(typeof u!="number"||!Number.isFinite(u)||u<0)&&e.push(`test.components[${i}].${o} must be a non-negative number when provided`)}}}):e.push("test.components must be an array")),t.test.strictness!==void 0&&(["minimal","balanced","strict","paranoid"].includes(t.test.strictness)||e.push("test.strictness must be one of: minimal, balanced, strict, paranoid"))}return t.contracts!==void 0&&(Array.isArray(t.contracts)?t.contracts.forEach((r,n)=>{typeof r!="object"||r===null?e.push(`contracts[${n}] must be an object`):(typeof r.src!="string"&&e.push(`contracts[${n}].src is required and must be a string`),r.out!==void 0&&typeof r.out!="string"&&e.push(`contracts[${n}].out must be a string`))}):e.push("contracts must be an array")),{valid:e.length===0,errors:e}}async function Br(s){try{let e=Ke.default.extname(s);if(e===".json"){let t=await We.default.readFile(s,"utf-8");return JSON.parse(t)}else if([".js",".mjs",".cjs",".ts"].includes(e)){let t=await import(s);return t.default||t}return null}catch{return null}}async function Vr(s=process.cwd()){let e=["ariaease.config.js","ariaease.config.mjs","ariaease.config.cjs","ariaease.config.json","ariaease.config.ts"],t=null,r=null,n=[];for(let i of e){let a=Ke.default.resolve(s,i);if(await We.default.pathExists(a)){if(r=a,t=await Br(a),t===null){n.push(`Found config at ${i} but failed to load it. Check for syntax errors.`);continue}let o=Dr(t);if(!o.valid){n.push(`Config validation failed in ${i}:`),n.push(...o.errors.map(u=>` - ${u}`)),t=null;continue}break}}return{config:t||{},configPath:t?r:null,errors:n}}var Ke,We,yt=Q(()=>{"use strict";Ke=ne(require("path"),1),We=ne(require("fs-extra"),1)});var X={};ce(X,{default:()=>vt.default});var vt,ve=Q(()=>{"use strict";Ee(X,require("playwright/test"));vt=ne(require("playwright/test"),1)});var wt={};ce(wt,{MenuComponentStrategy:()=>ze});var ze,kt=Q(()=>{"use strict";ve();ze=class{constructor(e,t,r=400,n=400){this.mainSelector=e;this.selectors=t;this.actionTimeoutMs=r;this.assertionTimeoutMs=n}async resetState(e){if(!this.selectors.popup)return;let t=this.selectors.popup,r=e.locator(t).first();if(!await r.isVisible().catch(()=>!1))return;let i=!1,a=this.selectors.main;if(a&&(await e.locator(a).first().focus(),await e.keyboard.press("Escape"),i=await(0,X.expect)(r).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>!0).catch(()=>!1)),!i&&this.selectors.main&&(await e.locator(this.selectors.main).first().click({timeout:this.actionTimeoutMs}),i=await(0,X.expect)(r).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>!0).catch(()=>!1)),i||(await e.mouse.click(10,10),i=await(0,X.expect)(r).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>!0).catch(()=>!1)),!i)throw new Error(`\u274C FATAL: Cannot close menu between tests. Menu remains visible after trying:
1
+ "use strict";var Zt=Object.create;var Ee=Object.defineProperty;var er=Object.getOwnPropertyDescriptor;var tr=Object.getOwnPropertyNames;var rr=Object.getPrototypeOf,sr=Object.prototype.hasOwnProperty;var Y=(t,e)=>()=>(t&&(e=t(t=0)),e);var oe=(t,e)=>{for(var r in e)Ee(t,r,{get:e[r],enumerable:!0})},Ae=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of tr(e))!sr.call(t,n)&&n!==r&&Ee(t,n,{get:()=>e[n],enumerable:!(s=er(e,n))||s.enumerable});return t},Se=(t,e,r)=>(Ae(t,e,"default"),r&&Ae(r,e,"default")),ne=(t,e,r)=>(r=t!=null?Zt(rr(t)):{},Ae(e||!t||!t.__esModule?Ee(r,"default",{value:t,enumerable:!0}):r,t)),nr=t=>Ae(Ee({},"__esModule",{value:!0}),t);async function zr(){return me||(me=await yt.chromium.launch({headless:!0,args:["--disable-extensions","--disable-blink-features=AutomationControlled"]})),me}async function Jr(){return he||(he=await(await zr()).newContext({permissions:[],ignoreHTTPSErrors:!0})),he}async function vt(){return await(await Jr()).newPage()}async function wt(){he&&(await he.close(),he=null),me&&(await me.close(),me=null)}var yt,me,he,je=Y(()=>{"use strict";yt=require("playwright"),me=null,he=null});function fe(t){return t==="required"||t==="recommended"||t==="optional"?t:Xr}function we(t){return t==="minimal"||t==="balanced"||t==="strict"||t==="paranoid"?t:"balanced"}function kt(t,e){return{minimal:{required:"error",recommended:"ignore",optional:"ignore"},balanced:{required:"error",recommended:"warning",optional:"ignore"},strict:{required:"error",recommended:"error",optional:"warning"},paranoid:{required:"error",recommended:"error",optional:"error"}}[e][t]}var Xr,Ke=Y(()=>{"use strict";Xr="required"});var Tt={};oe(Tt,{loadConfig:()=>Qr});function Gr(t){let e=[];if(!t||typeof t!="object")return e.push("Config must be an object"),{valid:!1,errors:e};let r=t;if(r.audit!==void 0){if(typeof r.audit!="object"||r.audit===null)e.push("audit must be an object");else if(r.audit.urls!==void 0&&(Array.isArray(r.audit.urls)?r.audit.urls.some(s=>typeof s!="string")&&e.push("audit.urls must contain only strings"):e.push("audit.urls must be an array")),r.audit.output!==void 0)if(typeof r.audit.output!="object")e.push("audit.output must be an object");else{let s=r.audit.output;s.format!==void 0&&(["json","csv","html","all"].includes(s.format)||e.push("audit.output.format must be one of: json, csv, html, all")),s.out!==void 0&&typeof s.out!="string"&&e.push("audit.output.out must be a string")}}if(r.test!==void 0)if(typeof r.test!="object"||r.test===null)e.push("test must be an object");else{r.test.disableTimeouts!==void 0&&typeof r.test.disableTimeouts!="boolean"&&e.push("test.disableTimeouts must be a boolean when provided");let s=["actionTimeoutMs","assertionTimeoutMs","navigationTimeoutMs","componentReadyTimeoutMs"];for(let n of s){let i=r.test[n];i!==void 0&&(typeof i!="number"||!Number.isFinite(i)||i<0)&&e.push(`test.${n} must be a non-negative number when provided`)}r.test.components!==void 0&&(Array.isArray(r.test.components)?r.test.components.forEach((n,i)=>{if(typeof n!="object"||n===null)e.push(`test.components[${i}] must be an object`);else{typeof n.name!="string"&&e.push(`test.components[${i}].name must be a string`),n.contractPath!==void 0&&typeof n.contractPath!="string"&&e.push(`test.components[${i}].contractPath must be a string when provided`),n.strategyPath!==void 0&&typeof n.strategyPath!="string"&&e.push(`test.components[${i}].strategyPath must be a string when provided`),n.strictness!==void 0&&!["minimal","balanced","strict","paranoid"].includes(n.strictness)&&e.push(`test.components[${i}].strictness must be one of: minimal, balanced, strict, paranoid`),n.disableTimeouts!==void 0&&typeof n.disableTimeouts!="boolean"&&e.push(`test.components[${i}].disableTimeouts must be a boolean when provided`);let a=["actionTimeoutMs","assertionTimeoutMs","navigationTimeoutMs","componentReadyTimeoutMs"];for(let o of a){let l=n[o];l!==void 0&&(typeof l!="number"||!Number.isFinite(l)||l<0)&&e.push(`test.components[${i}].${o} must be a non-negative number when provided`)}}}):e.push("test.components must be an array")),r.test.strictness!==void 0&&(["minimal","balanced","strict","paranoid"].includes(r.test.strictness)||e.push("test.strictness must be one of: minimal, balanced, strict, paranoid"))}return r.contracts!==void 0&&(Array.isArray(r.contracts)?r.contracts.forEach((s,n)=>{typeof s!="object"||s===null?e.push(`contracts[${n}] must be an object`):(typeof s.src!="string"&&e.push(`contracts[${n}].src is required and must be a string`),s.out!==void 0&&typeof s.out!="string"&&e.push(`contracts[${n}].out must be a string`))}):e.push("contracts must be an array")),{valid:e.length===0,errors:e}}async function Yr(t){try{let e=We.default.extname(t);if(e===".json"){let r=await ze.default.readFile(t,"utf-8");return JSON.parse(r)}else if([".js",".mjs",".cjs",".ts"].includes(e)){let r=await import(t);return r.default||r}return null}catch{return null}}async function Qr(t=process.cwd()){let e=["ariaease.config.js","ariaease.config.mjs","ariaease.config.cjs","ariaease.config.json","ariaease.config.ts"],r=null,s=null,n=[];for(let i of e){let a=We.default.resolve(t,i);if(await ze.default.pathExists(a)){if(s=a,r=await Yr(a),r===null){n.push(`Found config at ${i} but failed to load it. Check for syntax errors.`);continue}let o=Gr(r);if(!o.valid){n.push(`Config validation failed in ${i}:`),n.push(...o.errors.map(l=>` - ${l}`)),r=null;continue}break}}return{config:r||{},configPath:r?s:null,errors:n}}var We,ze,At=Y(()=>{"use strict";We=ne(require("path"),1),ze=ne(require("fs-extra"),1)});var J={};oe(J,{default:()=>Et.default});var Et,de=Y(()=>{"use strict";Se(J,require("playwright/test"));Et=ne(require("playwright/test"),1)});var St={};oe(St,{MenuComponentStrategy:()=>Je});var Je,Mt=Y(()=>{"use strict";de();Je=class{constructor(e,r,s=400,n=400){this.mainSelector=e;this.selectors=r;this.actionTimeoutMs=s;this.assertionTimeoutMs=n}async resetState(e){if(!this.selectors.popup)return;let r=this.selectors.popup,s=e.locator(r).first();if(!await s.isVisible().catch(()=>!1))return;let i=!1,a=this.selectors.main;if(a&&(await e.locator(a).first().focus(),await e.keyboard.press("Escape"),i=await(0,J.expect)(s).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>!0).catch(()=>!1)),!i&&this.selectors.main&&(await e.locator(this.selectors.main).first().click({timeout:this.actionTimeoutMs}),i=await(0,J.expect)(s).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>!0).catch(()=>!1)),i||(await e.mouse.click(10,10),i=await(0,J.expect)(s).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>!0).catch(()=>!1)),!i)throw new Error(`\u274C FATAL: Cannot close menu between tests. Menu remains visible after trying:
2
2
  1. Escape key
3
3
  2. Clicking trigger
4
4
  3. Clicking outside
5
- This indicates a problem with the menu component's close functionality.`);this.selectors.input&&await e.locator(this.selectors.input).first().clear(),this.selectors.main&&await e.locator(this.selectors.main).first().focus()}async shouldSkipTest(e,t){if(!(e.action.some(a=>a.target==="submenu"||a.target==="submenuTrigger"||a.target==="submenuItems")||e.assertions.some(a=>a.target==="submenu"||a.target==="submenuTrigger"||a.target==="submenuItems")))return!1;let n=this.selectors.submenuTrigger;return n?await t.locator(n).count()===0:!0}getMainSelector(){return this.mainSelector}}});var Tt={};ce(Tt,{AccordionComponentStrategy:()=>Je});var Je,At=Q(()=>{"use strict";ve();Je=class{constructor(e,t,r=400,n=400){this.mainSelector=e;this.selectors=t;this.actionTimeoutMs=r;this.assertionTimeoutMs=n}async resetState(e){if(!this.selectors.panel||!this.selectors.trigger)return;let t=this.selectors.trigger,r=this.selectors.panel;if(!t||!r)return;let n=await e.locator(t).all();for(let i of n){let a=await i.getAttribute("aria-expanded")==="true",o=await i.getAttribute("aria-controls");if(a&&o){await i.click({timeout:this.actionTimeoutMs});let u=e.locator(`#${o}`);await(0,X.expect)(u).toBeHidden({timeout:this.assertionTimeoutMs}).catch(()=>{})}}}async shouldSkipTest(){return!1}getMainSelector(){return this.mainSelector}}});var Et={};ce(Et,{ComboboxComponentStrategy:()=>Ge});var Ge,Mt=Q(()=>{"use strict";ve();Ge=class{constructor(e,t,r=400,n=400){this.mainSelector=e;this.selectors=t;this.actionTimeoutMs=r;this.assertionTimeoutMs=n}async resetState(e){if(!this.selectors.popup)return;let t=this.selectors.popup,r=e.locator(t).first();if(!await r.isVisible().catch(()=>!1))return;let i=!1,a=this.selectors.main;if(a&&(await e.locator(a).first().focus(),await e.keyboard.press("Escape"),i=await(0,X.expect)(r).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>!0).catch(()=>!1)),!i&&this.selectors.button&&(await e.locator(this.selectors.button).first().click({timeout:this.actionTimeoutMs}),i=await(0,X.expect)(r).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>!0).catch(()=>!1)),i||(await e.mouse.click(10,10),i=await(0,X.expect)(r).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>!0).catch(()=>!1)),!i)throw new Error(`\u274C FATAL: Cannot close combobox popup between tests. Popup remains visible after trying:
5
+ This indicates a problem with the menu component's close functionality.`);this.selectors.input&&await e.locator(this.selectors.input).first().clear(),this.selectors.main&&await e.locator(this.selectors.main).first().focus()}async shouldSkipTest(e,r){if(!(e.action.some(a=>a.target==="submenu"||a.target==="submenuTrigger"||a.target==="submenuItems")||e.assertions.some(a=>a.target==="submenu"||a.target==="submenuTrigger"||a.target==="submenuItems")))return!1;let n=this.selectors.submenuTrigger;return n?await r.locator(n).count()===0:!0}getMainSelector(){return this.mainSelector}}});var xt={};oe(xt,{AccordionComponentStrategy:()=>Xe});var Xe,Ct=Y(()=>{"use strict";de();Xe=class{constructor(e,r,s=400,n=400){this.mainSelector=e;this.selectors=r;this.actionTimeoutMs=s;this.assertionTimeoutMs=n}async resetState(e){if(!this.selectors.panel||!this.selectors.trigger)return;let r=this.selectors.trigger,s=this.selectors.panel;if(!r||!s)return;let n=await e.locator(r).all();for(let i of n){let a=await i.getAttribute("aria-expanded")==="true",o=await i.getAttribute("aria-controls");if(a&&o){await i.click({timeout:this.actionTimeoutMs});let l=e.locator(`#${o}`);await(0,J.expect)(l).toBeHidden({timeout:this.assertionTimeoutMs}).catch(()=>{})}}}async shouldSkipTest(){return!1}getMainSelector(){return this.mainSelector}}});var $t={};oe($t,{ComboboxComponentStrategy:()=>Ge});var Ge,Lt=Y(()=>{"use strict";de();Ge=class{constructor(e,r,s=400,n=400){this.mainSelector=e;this.selectors=r;this.actionTimeoutMs=s;this.assertionTimeoutMs=n}async resetState(e){if(!this.selectors.popup)return;let r=this.selectors.popup,s=e.locator(r).first();if(!await s.isVisible().catch(()=>!1))return;let i=!1,a=this.selectors.main;if(a&&(await e.locator(a).first().focus(),await e.keyboard.press("Escape"),i=await(0,J.expect)(s).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>!0).catch(()=>!1)),!i&&this.selectors.button&&(await e.locator(this.selectors.button).first().click({timeout:this.actionTimeoutMs}),i=await(0,J.expect)(s).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>!0).catch(()=>!1)),i||(await e.mouse.click(10,10),i=await(0,J.expect)(s).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>!0).catch(()=>!1)),!i)throw new Error(`\u274C FATAL: Cannot close combobox popup between tests. Popup remains visible after trying:
6
6
  1. Escape key
7
7
  2. Clicking button
8
8
  3. Clicking outside
9
- This indicates a problem with the combobox component's close functionality.`);this.selectors.input&&await e.locator(this.selectors.input).first().clear()}async shouldSkipTest(){return!1}getMainSelector(){return this.mainSelector}}});var St={};ce(St,{TabsComponentStrategy:()=>Xe});var Xe,xt=Q(()=>{"use strict";Xe=class{constructor(e,t){this.mainSelector=e;this.selectors=t}async resetState(){}async shouldSkipTest(e,t){if(e.orientation!==void 0&&this.selectors.tablist){let r=this.selectors.tablist,i=await t.locator(r).first().getAttribute("aria-orientation");if(e.orientation!==i)return!0}return!1}getMainSelector(){return this.mainSelector}}});var Ye,$t,Ce,Ct=Q(()=>{"use strict";Ye=ne(require("path"),1),$t=require("url"),Ce=class{builtInStrategies=new Map;constructor(){this.registerBuiltInStrategies()}registerBuiltInStrategies(){this.builtInStrategies.set("menu",()=>Promise.resolve().then(()=>(kt(),wt)).then(e=>e.MenuComponentStrategy)),this.builtInStrategies.set("accordion",()=>Promise.resolve().then(()=>(At(),Tt)).then(e=>e.AccordionComponentStrategy)),this.builtInStrategies.set("combobox",()=>Promise.resolve().then(()=>(Mt(),Et)).then(e=>e.ComboboxComponentStrategy)),this.builtInStrategies.set("tabs",()=>Promise.resolve().then(()=>(xt(),St)).then(e=>e.TabsComponentStrategy))}async loadStrategy(e,t,r){try{if(t)try{let i=Ye.default.isAbsolute(t)?t:Ye.default.resolve(r||process.cwd(),t),a=await import((0,$t.pathToFileURL)(i).href),o=a.default||a;if(!o)throw new Error(`No default export found in ${t}`);return o}catch(i){throw new Error(`Failed to load custom strategy from ${t}: ${i instanceof Error?i.message:String(i)}`)}let n=this.builtInStrategies.get(e);return n?n():null}catch(n){throw new Error(`Strategy loading failed for ${e}: ${n instanceof Error?n.message:String(n)}`)}}has(e,t){return!!t||this.builtInStrategies.has(e)}}});var Le,Re,qr,He,Lt=Q(()=>{"use strict";Le=require("fs"),Re=ne(require("path"),1);Ct();qr={},He=class{static strategyRegistry=new Ce;static isComponentConfig(e){return typeof e=="object"&&e!==null}static async detect(e,t,r=400,n=400,i){let a=this.isComponentConfig(t)?t:void 0,o=a?.contractPath;if(!o)throw new Error(`Contract path not found for component: ${e}`);let u=(()=>{if(Re.default.isAbsolute(o))return o;if(i){let N=Re.default.resolve(i,o);try{return(0,Le.readFileSync)(N,"utf-8"),N}catch{}}let q=Re.default.resolve(process.cwd(),o);try{return(0,Le.readFileSync)(q,"utf-8"),q}catch{return new URL(o,qr.url).pathname}})(),l=(0,Le.readFileSync)(u,"utf-8"),b=JSON.parse(l).selectors,w=await this.strategyRegistry.loadStrategy(e,a?.strategyPath,i);if(!w)return null;let H=b.main;return e==="tabs"?new w(H,b):new w(H,b,r,n)}}});var Pe,Rt=Q(()=>{"use strict";Pe=class{startTime=0;componentName="";staticPasses=0;staticFailures=0;staticWarnings=0;dynamicResults=[];totalTests=0;skipped=0;warnings=0;isPlaywright=!1;isCustomContract=!1;apgUrl="https://www.w3.org/WAI/ARIA/apg/";hasPrintedStaticSection=!1;hasPrintedDynamicSection=!1;constructor(e=!1,t=!1){this.isPlaywright=e,this.isCustomContract=t}log(e){process.stderr.write(e+`
10
- `)}start(e,t,r){this.startTime=Date.now(),this.componentName=e,this.totalTests=t,this.hasPrintedStaticSection=!1,this.hasPrintedDynamicSection=!1,r&&(this.apgUrl=r);let n="Playwright (Real Browser)";this.log(`
9
+ This indicates a problem with the combobox component's close functionality.`);this.selectors.input&&await e.locator(this.selectors.input).first().clear()}async shouldSkipTest(){return!1}getMainSelector(){return this.mainSelector}}});var Rt={};oe(Rt,{TabsComponentStrategy:()=>Ye});var Ye,Ht=Y(()=>{"use strict";Ye=class{constructor(e,r){this.mainSelector=e;this.selectors=r}async resetState(){}async shouldSkipTest(e,r){if(e.orientation!==void 0&&this.selectors.tablist){let s=this.selectors.tablist,i=await r.locator(s).first().getAttribute("aria-orientation");if(e.orientation!==i)return!0}return!1}getMainSelector(){return this.mainSelector}}});var Pt={};oe(Pt,{RadioComponentStrategy:()=>Qe});var Qe,It=Y(()=>{"use strict";de();Qe=class{constructor(e,r,s=400,n=400){this.mainSelector=e;this.selectors=r;this.actionTimeoutMs=s;this.assertionTimeoutMs=n}async resetState(e){if(!this.selectors.radio||!this.selectors.relative)return;let r=this.selectors.radio;if(!r)return;let s=await e.locator(r).all();for(let n of s)if(await n.getAttribute("aria-checked")==="true"){await n.evaluate(o=>o.setAttribute("aria-checked","false"),{timeout:this.actionTimeoutMs});let a=e.locator(`#${n}`);await(0,J.expect)(a).toHaveAttribute("aria-checked","false",{timeout:this.assertionTimeoutMs}).catch(()=>{})}}async shouldSkipTest(){return!1}getMainSelector(){return this.mainSelector}}});var Dt={};oe(Dt,{CheckboxComponentStrategy:()=>Ze});var Ze,Bt=Y(()=>{"use strict";de();Ze=class{constructor(e,r,s=400,n=400){this.mainSelector=e;this.selectors=r;this.actionTimeoutMs=s;this.assertionTimeoutMs=n}async resetState(e){if(!this.selectors.checkbox||!this.selectors.relative)return;let r=this.selectors.checkbox;if(!r)return;let s=await e.locator(r).all();for(let n of s)if(await n.getAttribute("aria-checked")==="true"){await n.click({timeout:this.actionTimeoutMs});let a=e.locator(`#${n}`);await(0,J.expect)(a).toHaveAttribute("aria-checked","false",{timeout:this.assertionTimeoutMs}).catch(()=>{})}}async shouldSkipTest(){return!1}getMainSelector(){return this.mainSelector}}});var et,Vt,Le,qt=Y(()=>{"use strict";et=ne(require("path"),1),Vt=require("url"),Le=class{builtInStrategies=new Map;constructor(){this.registerBuiltInStrategies()}registerBuiltInStrategies(){this.builtInStrategies.set("menu",()=>Promise.resolve().then(()=>(Mt(),St)).then(e=>e.MenuComponentStrategy)),this.builtInStrategies.set("accordion",()=>Promise.resolve().then(()=>(Ct(),xt)).then(e=>e.AccordionComponentStrategy)),this.builtInStrategies.set("combobox",()=>Promise.resolve().then(()=>(Lt(),$t)).then(e=>e.ComboboxComponentStrategy)),this.builtInStrategies.set("tabs",()=>Promise.resolve().then(()=>(Ht(),Rt)).then(e=>e.TabsComponentStrategy)),this.builtInStrategies.set("radio",()=>Promise.resolve().then(()=>(It(),Pt)).then(e=>e.RadioComponentStrategy)),this.builtInStrategies.set("checkbox",()=>Promise.resolve().then(()=>(Bt(),Dt)).then(e=>e.CheckboxComponentStrategy))}async loadStrategy(e,r,s){try{if(r)try{let i=et.default.isAbsolute(r)?r:et.default.resolve(s||process.cwd(),r),a=await import((0,Vt.pathToFileURL)(i).href),o=a.default||a;if(!o)throw new Error(`No default export found in ${r}`);return o}catch(i){throw new Error(`Failed to load custom strategy from ${r}: ${i instanceof Error?i.message:String(i)}`)}let n=this.builtInStrategies.get(e);return n?n():null}catch(n){throw new Error(`Strategy loading failed for ${e}: ${n instanceof Error?n.message:String(n)}`)}}has(e,r){return!!r||this.builtInStrategies.has(e)}}});var Re,He,Zr,Pe,Ft=Y(()=>{"use strict";Re=require("fs"),He=ne(require("path"),1);qt();Zr={},Pe=class{static strategyRegistry=new Le;static isComponentConfig(e){return typeof e=="object"&&e!==null}static async detect(e,r,s=400,n=400,i){let a=this.isComponentConfig(r)?r:void 0,o=a?.contractPath;if(!o)throw new Error(`Contract path not found for component: ${e}`);let l=(()=>{if(He.default.isAbsolute(o))return o;if(i){let U=He.default.resolve(i,o);try{return(0,Re.readFileSync)(U,"utf-8"),U}catch{}}let q=He.default.resolve(process.cwd(),o);try{return(0,Re.readFileSync)(q,"utf-8"),q}catch{return new URL(o,Zr.url).pathname}})(),u=(0,Re.readFileSync)(l,"utf-8"),y=JSON.parse(u).selectors,T=await this.strategyRegistry.loadStrategy(e,a?.strategyPath,i);if(!T)return null;let H=y.main;return e==="tabs"?new T(H,y):new T(H,y,s,n)}}});var Ie,Ot=Y(()=>{"use strict";Ie=class{startTime=0;componentName="";staticPasses=0;staticFailures=0;staticWarnings=0;dynamicResults=[];totalTests=0;skipped=0;warnings=0;isPlaywright=!1;isCustomContract=!1;apgUrl="https://www.w3.org/WAI/ARIA/apg/";hasPrintedStaticSection=!1;hasPrintedDynamicSection=!1;constructor(e=!1,r=!1){this.isPlaywright=e,this.isCustomContract=r}log(e){process.stderr.write(e+`
10
+ `)}start(e,r,s){this.startTime=Date.now(),this.componentName=e,this.totalTests=r,this.hasPrintedStaticSection=!1,this.hasPrintedDynamicSection=!1,s&&(this.apgUrl=s);let n="Playwright (Real Browser)";this.log(`
11
11
  ${"\u2550".repeat(60)}`),this.log(`\u{1F50D} Testing ${e.charAt(0).toUpperCase()+e.slice(1)} Component - ${n}`),this.log(`${"\u2550".repeat(60)}
12
- `)}reportStatic(e,t,r=0){this.staticPasses=e,this.staticFailures=t,this.staticWarnings=r}reportStaticTest(e,t,r,n){this.hasPrintedStaticSection||(this.log(`${"\u2500".repeat(60)}`),this.log("\u{1F9EA} Static Assertions"),this.log(`${"\u2500".repeat(60)}`),this.hasPrintedStaticSection=!0);let i=t==="pass"?"\u2713":t==="warn"?"\u26A0":t==="skip"?"\u25CB":"\u2717";this.log(` ${i} ${e}`),n&&this.log(` \u21B3 level=${n}`),(t==="fail"||t==="warn"||t==="skip")&&r&&this.log(` \u21B3 ${r}`)}reportTest(e,t,r){this.hasPrintedDynamicSection||(this.log(""),this.log(`${"\u2500".repeat(60)}`),this.log("\u2328\uFE0F Dynamic Interaction Tests"),this.log(`${"\u2500".repeat(60)}`),this.hasPrintedDynamicSection=!0);let n={description:e.description,status:t,failureMessage:r,level:e.level};t==="skip"&&(n.skipReason="Requires real browser (addEventListener events)"),this.dynamicResults.push(n);let i={pass:"\u2713",fail:"\u2717",warn:"\u26A0",skip:"\u25CB"},a=e.level?`[${e.level.toUpperCase()}] `:"";this.log(` ${i[t]} ${a}${e.description}`),t==="skip"&&!this.isPlaywright&&this.log(" \u21B3 Skipped (runs only in Playwright)"),t==="fail"&&r&&this.log(` \u21B3 ${r}`),t==="warn"&&r&&this.log(` \u21B3 ${r}`),t==="skip"&&r&&this.log(` \u21B3 ${r}`)}reportFailures(e){e.length!==0&&(this.log(`
12
+ `)}reportStatic(e,r,s=0){this.staticPasses=e,this.staticFailures=r,this.staticWarnings=s}reportStaticTest(e,r,s,n){this.hasPrintedStaticSection||(this.log(`${"\u2500".repeat(60)}`),this.log("\u{1F9EA} Static Assertions"),this.log(`${"\u2500".repeat(60)}`),this.hasPrintedStaticSection=!0);let i=r==="pass"?"\u2713":r==="warn"?"\u26A0":r==="skip"?"\u25CB":"\u2717";this.log(` ${i} ${e}`),n&&this.log(` \u21B3 level=${n}`),(r==="fail"||r==="warn"||r==="skip")&&s&&this.log(` \u21B3 ${s}`)}reportTest(e,r,s){this.hasPrintedDynamicSection||(this.log(""),this.log(`${"\u2500".repeat(60)}`),this.log("\u2328\uFE0F Dynamic Interaction Tests"),this.log(`${"\u2500".repeat(60)}`),this.hasPrintedDynamicSection=!0);let n={description:e.description,status:r,failureMessage:s,level:e.level};r==="skip"&&(n.skipReason="Requires real browser (addEventListener events)"),this.dynamicResults.push(n);let i={pass:"\u2713",fail:"\u2717",warn:"\u26A0",skip:"\u25CB"},a=e.level?`[${e.level.toUpperCase()}] `:"";this.log(` ${i[r]} ${a}${e.description}`),r==="skip"&&!this.isPlaywright&&this.log(" \u21B3 Skipped (runs only in Playwright)"),r==="fail"&&s&&this.log(` \u21B3 ${s}`),r==="warn"&&s&&this.log(` \u21B3 ${s}`),r==="skip"&&s&&this.log(` \u21B3 ${s}`)}reportFailures(e){e.length!==0&&(this.log(`
13
13
  ${"\u2500".repeat(60)}`),this.log(`\u274C Failures (${e.length}):
14
- `),e.forEach((t,r)=>{this.log(`${r+1}. ${t}`),t.includes("aria-")?this.log(" \u{1F4A1} Add the missing ARIA attribute to improve screen reader support"):t.includes("focus")?this.log(" \u{1F4A1} Check keyboard event handlers and focus management"):t.includes("visible")&&this.log(" \u{1F4A1} Verify display/visibility styles and state management"),this.log("")}))}reportWarnings(){let e=this.dynamicResults.filter(t=>t.status==="warn");e.length===0&&this.staticWarnings===0||(this.log(`
14
+ `),e.forEach((r,s)=>{this.log(`${s+1}. ${r}`),r.includes("aria-")?this.log(" \u{1F4A1} Add the missing ARIA attribute to improve screen reader support"):r.includes("focus")?this.log(" \u{1F4A1} Check keyboard event handlers and focus management"):r.includes("visible")&&this.log(" \u{1F4A1} Verify display/visibility styles and state management"),this.log("")}))}reportWarnings(){let e=this.dynamicResults.filter(r=>r.status==="warn");e.length===0&&this.staticWarnings===0||(this.log(`
15
15
  ${"\u2500".repeat(60)}`),this.log(`\u26A0\uFE0F Warnings (${this.staticWarnings+e.length}):
16
16
  `),this.log(`These checks are failing but treated as warnings under the active strictness mode.
17
- `),e.forEach((t,r)=>{this.log(`${r+1}. ${t.description}`),t.failureMessage&&this.log(` \u21B3 ${t.failureMessage}`),t.level&&this.log(` \u21B3 level=${t.level}`)}),this.apgUrl&&this.log(`
17
+ `),e.forEach((r,s)=>{this.log(`${s+1}. ${r.description}`),r.failureMessage&&this.log(` \u21B3 ${r.failureMessage}`),r.level&&this.log(` \u21B3 level=${r.level}`)}),this.apgUrl&&this.log(`
18
18
  Reference: ${this.apgUrl}
19
- `))}reportSkipped(){if(this.skipped===0||this.isPlaywright)return;let e=this.dynamicResults.filter(t=>t.status==="skip");this.log(`
19
+ `))}reportSkipped(){if(this.skipped===0||this.isPlaywright)return;let e=this.dynamicResults.filter(r=>r.status==="skip");this.log(`
20
20
  ${"\u2500".repeat(60)}`),this.log(`\u2139\uFE0F Skipped Tests (${this.skipped}):
21
21
  `),this.log("These tests use native keyboard events via addEventListener,"),this.log(`which only run in Playwright (real browser).
22
- `),e.forEach((t,r)=>{this.log(`${r+1}. ${t.description}`)}),this.log(`
22
+ `),e.forEach((r,s)=>{this.log(`${s+1}. ${r.description}`)}),this.log(`
23
23
  \u{1F4A1} Run with Playwright for full validation:`),this.log(` testUiComponent('${this.componentName}', null, 'http://localhost:5173/test-harness?component=component_name')
24
- `)}summary(e){let t=Date.now()-this.startTime,r=this.dynamicResults.filter(f=>f.status==="pass").length,n=this.dynamicResults.filter(f=>f.status==="fail").length,i=this.dynamicResults.filter(f=>f.status==="warn").length;this.skipped=this.dynamicResults.filter(f=>f.status==="skip").length,this.warnings=this.staticWarnings+i;let a=this.staticPasses+r,o=this.staticFailures+n,u=a+o+this.warnings,l=()=>{let f=`${this.componentName.charAt(0).toUpperCase()}${this.componentName.slice(1)}`;return this.isCustomContract?`${f} component validates against your custom accessibility policy \u2713`:`${f} component meets Aria-Ease baseline WAI-ARIA expectations \u2713`};return e.length>0&&this.reportFailures(e),this.reportWarnings(),this.reportSkipped(),this.log(`
24
+ `)}summary(e){let r=Date.now()-this.startTime,s=this.dynamicResults.filter(f=>f.status==="pass").length,n=this.dynamicResults.filter(f=>f.status==="fail").length,i=this.dynamicResults.filter(f=>f.status==="warn").length;this.skipped=this.dynamicResults.filter(f=>f.status==="skip").length,this.warnings=this.staticWarnings+i;let a=this.staticPasses+s,o=this.staticFailures+n,l=a+o+this.warnings,u=()=>{let f=`${this.componentName.charAt(0).toUpperCase()}${this.componentName.slice(1)}`;return this.isCustomContract?`${f} component validates against your custom accessibility policy \u2713`:`${f} component meets Aria-Ease baseline WAI-ARIA expectations \u2713`};return e.length>0&&this.reportFailures(e),this.reportWarnings(),this.reportSkipped(),this.log(`
25
25
  ${"\u2550".repeat(60)}`),this.log(`\u{1F4CA} Summary
26
- `),o===0&&this.skipped===0&&this.warnings===0?(this.log(`\u2705 All ${u} tests passed!`),this.log(` ${l()}`)):o===0?(this.log(`\u2705 ${a}/${u} tests passed`),this.skipped>0&&this.log(`\u25CB ${this.skipped} tests skipped`),this.warnings>0&&this.log(`\u26A0\uFE0F ${this.warnings} warning${this.warnings>1?"s":""}`),this.log(` ${l()}`)):(this.log(`\u274C ${o} test${o>1?"s":""} failed`),this.log(`\u2705 ${a} test${a>1?"s":""} passed`),this.warnings>0&&this.log(`\u26A0\uFE0F ${this.warnings} warning${this.warnings>1?"s":""}`),this.skipped>0&&this.log(`\u25CB ${this.skipped} test${this.skipped>1?"s":""} skipped`)),this.log(`\u23F1\uFE0F Duration: ${t}ms`),this.log(`${"\u2550".repeat(60)}
26
+ `),o===0&&this.skipped===0&&this.warnings===0?(this.log(`\u2705 All ${l} tests passed!`),this.log(` ${u()}`)):o===0?(this.log(`\u2705 ${a}/${l} tests passed`),this.skipped>0&&this.log(`\u25CB ${this.skipped} tests skipped`),this.warnings>0&&this.log(`\u26A0\uFE0F ${this.warnings} warning${this.warnings>1?"s":""}`),this.log(` ${u()}`)):(this.log(`\u274C ${o} test${o>1?"s":""} failed`),this.log(`\u2705 ${a} test${a>1?"s":""} passed`),this.warnings>0&&this.log(`\u26A0\uFE0F ${this.warnings} warning${this.warnings>1?"s":""}`),this.skipped>0&&this.log(`\u25CB ${this.skipped} test${this.skipped>1?"s":""} skipped`)),this.log(`\u23F1\uFE0F Duration: ${r}ms`),this.log(`${"\u2550".repeat(60)}
27
27
  `),o>0?(this.log("\u{1F527} Next Steps:"),this.log(" 1. Review the failures above"),this.log(" 2. Fix ARIA attributes and keyboard handlers"),this.log(` 3. Re-run tests to verify fixes
28
28
  `)):!this.isPlaywright&&this.skipped>0&&this.log(`\u2728 Optional: Run Playwright tests for complete validation
29
- `),{passes:a,failures:o,skipped:this.skipped,duration:t}}error(e,t){this.log(`
30
- \u274C Error: ${e}`),t&&this.log(` Context: ${t}`),this.log("")}}});var Ht={};ce(Ht,{RelativeTargetResolver:()=>oe});var oe,Ie=Q(()=>{"use strict";oe=class{static async resolve(e,t,r){let n=await e.locator(t).all();if(typeof r=="number")return n[r-1];switch(r){case"first":return n[0];case"second":return n[1];case"last":return n[n.length-1];case"next":{let a=(await e.evaluate(([o])=>Array.from(document.querySelectorAll(o)).indexOf(document.activeElement),[t])+1)%n.length;return n[a]}case"previous":{let a=(await e.evaluate(([o])=>Array.from(document.querySelectorAll(o)).indexOf(document.activeElement),[t])-1+n.length)%n.length;return n[a]}default:return null}}}});var me,Pt=Q(()=>{"use strict";Ie();me=class{constructor(e,t,r=400){this.page=e;this.selectors=t;this.timeoutMs=r}isBrowserClosedError(e){return e instanceof Error&&e.message.includes("Target page, context or browser has been closed")}async focus(e,t,r){try{if(e==="virtual"&&r){let i=this.selectors.main;if(!i)return{success:!1,error:"Main selector not defined for virtual focus."};let a=this.page.locator(i).first();return await a.count()?(await a.evaluate((u,l)=>{u.setAttribute("aria-activedescendant",l)},r),{success:!0}):{success:!1,error:"Main element not found for virtual focus."}}if(e==="relative"&&t){let i=this.selectors.relative;if(!i)return{success:!1,error:"Relative selector not defined for focus action."};let a=await oe.resolve(this.page,i,t);return a?(await a.focus({timeout:this.timeoutMs}),{success:!0}):{success:!1,error:`Could not resolve relative target ${t} for focus.`}}let n=this.selectors[e];return n?(await this.page.locator(n).first().focus({timeout:this.timeoutMs}),{success:!0}):{success:!1,error:`Selector for focus target ${e} not found.`}}catch(n){return this.isBrowserClosedError(n)?{success:!1,error:"CRITICAL: Browser/page closed during test execution. Remaining actions skipped.",shouldBreak:!0}:{success:!1,error:`Failed to focus ${e}: ${n instanceof Error?n.message:String(n)}`}}}async type(e,t){try{let r=this.selectors[e];return r?(await this.page.locator(r).first().fill(t,{timeout:this.timeoutMs}),{success:!0}):{success:!1,error:`Selector for type target ${e} not found.`}}catch(r){return this.isBrowserClosedError(r)?{success:!1,error:"CRITICAL: Browser/page closed during test execution. Remaining actions skipped.",shouldBreak:!0}:{success:!1,error:`Failed to type into ${e}: ${r instanceof Error?r.message:String(r)}`}}}async click(e,t){try{if(e==="document")return await this.page.mouse.click(10,10),{success:!0};if(e==="relative"&&t){let n=this.selectors.relative;if(!n)return{success:!1,error:"Relative selector not defined for click action."};let i=await oe.resolve(this.page,n,t);return i?(await i.click({timeout:this.timeoutMs}),{success:!0}):{success:!1,error:`Could not resolve relative target ${t} for click.`}}let r=this.selectors[e];return r?(await this.page.locator(r).first().click({timeout:this.timeoutMs}),{success:!0}):{success:!1,error:`Selector for action target ${e} not found.`}}catch(r){return this.isBrowserClosedError(r)?{success:!1,error:"CRITICAL: Browser/page closed during test execution. Remaining actions skipped.",shouldBreak:!0}:{success:!1,error:`Failed to click ${e}: ${r instanceof Error?r.message:String(r)}`}}}async keypress(e,t,r){try{let i={Space:"Space",Enter:"Enter",Escape:"Escape","Arrow Up":"ArrowUp","Arrow Down":"ArrowDown","Arrow Left":"ArrowLeft","Arrow Right":"ArrowRight",Home:"Home",End:"End",Tab:"Tab"}[t]||t;if(i==="Space"?i=" ":i.includes(" ")&&(i=i.replace(/ /g,"")),e==="relative"){if(r==null)return{success:!1,error:"relativeTarget must be provided for relative keypress."};let l=this.selectors.relative;if(!l)return{success:!1,error:"Relative selector not defined for keypress action."};let f=await oe.resolve(this.page,l,r);return f?(await f.press(i,{timeout:this.timeoutMs}),{success:!0}):{success:!1,error:`Could not resolve relative target ${r} for keypress.`}}let a=this.selectors[e];if(!a)return{success:!1,error:`Selector for keypress target ${e} not found.`};let o=this.page.locator(a).first();return await o.count()===0?{success:!1,error:`${e} element not found.`,shouldBreak:!0}:(await o.press(i,{timeout:this.timeoutMs}),{success:!0})}catch(n){return this.isBrowserClosedError(n)?{success:!1,error:"CRITICAL: Browser/page closed during test execution. Remaining actions skipped.",shouldBreak:!0}:{success:!1,error:`Failed to press ${t} on ${e}: ${n instanceof Error?n.message:String(n)}`}}}async hover(e,t){try{if(e==="relative"&&t){let n=this.selectors.relative;if(!n)return{success:!1,error:"Relative selector not defined for hover action."};let i=await oe.resolve(this.page,n,t);return i?(await i.hover({timeout:this.timeoutMs}),{success:!0}):{success:!1,error:`Could not resolve relative target ${t} for hover.`}}let r=this.selectors[e];return r?(await this.page.locator(r).first().hover({timeout:this.timeoutMs}),{success:!0}):{success:!1,error:`Selector for hover target ${e} not found.`}}catch(r){return this.isBrowserClosedError(r)?{success:!1,error:"CRITICAL: Browser/page closed during test execution. Remaining actions skipped.",shouldBreak:!0}:{success:!1,error:`Failed to hover ${e}: ${r instanceof Error?r.message:String(r)}`}}}}});var we,It=Q(()=>{"use strict";ve();Ie();we=class{constructor(e,t,r=400){this.page=e;this.selectors=t;this.timeoutMs=r}async resolveTarget(e,t,r){try{if(e==="relative"){let i=r?this.selectors[r]:this.selectors.relative;if(!i)return{target:null,error:"Relative selector is not defined in the contract."};if(!t)return{target:null,error:"Relative target or expected value is not defined."};let a=await oe.resolve(this.page,i,t);return a?{target:a}:{target:null,error:`Target ${e} not found.`}}let n=this.selectors[e];return n?{target:this.page.locator(n).first()}:{target:null,error:`Selector for assertion target ${e} not found.`}}catch(n){return{target:null,error:`Failed to resolve target ${e}: ${n instanceof Error?n.message:String(n)}`}}}async validateVisibility(e,t,r,n,i){try{return r?(await(0,X.expect)(e).toBeVisible({timeout:this.timeoutMs}),{success:!0,passMessage:`${t} is visible as expected. Test: "${i}".`}):(await(0,X.expect)(e).toBeHidden({timeout:this.timeoutMs}),{success:!0,passMessage:`${t} is not visible as expected. Test: "${i}".`})}catch{let a=this.selectors[t]||"",o=await this.page.evaluate(u=>{let l=u?document.querySelector(u):null;if(!l)return"element not found";let f=window.getComputedStyle(l);return`display:${f.display}, visibility:${f.visibility}, opacity:${f.opacity}`},a);return r?{success:!1,failMessage:`${n} (actual: ${o})`}:{success:!1,failMessage:`${n} ${t} is still visible (actual: ${o}).`}}}async validateAttribute(e,t,r,n,i,a){if(n==="!empty"){let l=await e.getAttribute(r);return l&&l.trim()!==""?{success:!0,passMessage:`${t} has non-empty "${r}". Test: "${a}".`}:{success:!1,failMessage:`${i} ${t} "${r}" should not be empty, found "${l}".`}}if(typeof n!="string")throw console.error("[AssertionRunner] expectedValue is not a string:",n),new Error(`AssertionRunner: expectedValue for attribute assertion must be a string, but got: ${JSON.stringify(n)}`);let o=n.split(" | ").map(l=>l.trim()),u=await e.getAttribute(r);return u!==null&&o.includes(u)?{success:!0,passMessage:`${t} has expected "${r}". Test: "${a}".`}:{success:!1,failMessage:`${i} ${t} "${r}" should be "${n}", found "${u}".`}}async validateValue(e,t,r,n,i){let a=await e.inputValue().catch(()=>"");return r==="!empty"?a&&a.trim()!==""?{success:!0,passMessage:`${t} has non-empty value. Test: "${i}".`}:{success:!1,failMessage:`${n} ${t} value should not be empty, found "${a}".`}:r===""?a===""?{success:!0,passMessage:`${t} has empty value. Test: "${i}".`}:{success:!1,failMessage:`${n} ${t} value should be empty, found "${a}".`}:a===r?{success:!0,passMessage:`${t} has expected value. Test: "${i}".`}:{success:!1,failMessage:`${n} ${t} value should be "${r}", found "${a}".`}}async validateFocus(e,t,r,n,i){try{return r?(await(0,X.expect)(e).toBeFocused({timeout:this.timeoutMs}),{success:!0,passMessage:`${t} has focus as expected. Test: "${i}".`}):(await(0,X.expect)(e).not.toBeFocused({timeout:this.timeoutMs}),{success:!0,passMessage:`${t} does not have focus as expected. Test: "${i}".`})}catch{let a=await this.page.evaluate(()=>{let o=document.activeElement;return o?`${o.tagName}#${o.id||"no-id"}.${o.className||"no-class"}`:"no element focused"});return{success:!1,failMessage:`${n} (actual focus: ${a})`}}}async validateRole(e,t,r,n,i){let a=await e.getAttribute("role");return a===r?{success:!0,passMessage:`${t} has role "${r}". Test: "${i}".`}:{success:!1,failMessage:`${n} Expected role "${r}", found "${a}".`}}async validate(e,t){if(this.page.isClosed())return{success:!1,failMessage:"CRITICAL: Browser/page closed before completing all tests. Increase test timeout or reduce test complexity."};let r=null,n;if(e.controlledBy){let i=e.controlledBy,a=this.selectors[i.target];if(!a)return{success:!1,failMessage:`Selector for controlledBy.target '${i.target}' not found.`,target:null};let o=null;if(i.relativeTarget?o=await oe.resolve(this.page,a,i.relativeTarget):o=this.page.locator(a).first(),!o)return{success:!1,failMessage:"Controlling element for controlledBy not found.",target:null};let u=i.attribute||"aria-controls",l=await o.getAttribute(u);if(!l)return{success:!1,failMessage:`Controlling element does not have attribute '${u}'.`,target:null};if(r=this.page.locator(`#${l}`),!r||await r.count()===0)return{success:!1,failMessage:`Controlled element with id '${l}' not found.`,target:null}}else{let i=await this.resolveTarget(e.target,e.relativeTarget||e.expectedValue,e.selectorKey);if(r=i.target,n=i.error,n||!r)return{success:!1,failMessage:n||`Target ${e.target} not found.`,target:null}}if(e.target==="input"&&e.attribute==="aria-activedescendant"&&e.expectedValue==="!empty"&&e.relativeTarget&&e.selectorKey){let i=await oe.resolve(this.page,this.selectors[e.selectorKey],e.relativeTarget),a=i?await i.getAttribute("id"):null,o=await r.getAttribute("aria-activedescendant");return a&&o===a?{success:!0,passMessage:`input[aria-activedescendant] matches id of ${e.relativeTarget}(${e.selectorKey}). Test: "${t}".`}:{success:!1,failMessage:`input[aria-activedescendant] should match id of ${e.relativeTarget}(${e.selectorKey}), found "${o}".`}}switch(e.assertion){case"toBeVisible":return this.validateVisibility(r,e.target,!0,e.failureMessage||"",t);case"notToBeVisible":return this.validateVisibility(r,e.target,!1,e.failureMessage||"",t);case"toHaveAttribute":return e.attribute&&e.expectedValue!==void 0?this.validateAttribute(r,e.target,e.attribute,e.expectedValue,e.failureMessage||"",t):{success:!1,failMessage:"Missing attribute or expectedValue for toHaveAttribute assertion"};case"toHaveValue":return e.expectedValue!==void 0?this.validateValue(r,e.target,e.expectedValue,e.failureMessage||"",t):{success:!1,failMessage:"Missing expectedValue for toHaveValue assertion"};case"toHaveFocus":return this.validateFocus(r,e.target,!0,e.failureMessage||"",t);case"notToHaveFocus":return this.validateFocus(r,e.target,!1,e.failureMessage||"",t);case"toHaveRole":return e.expectedValue!==void 0?this.validateRole(r,e.target,e.expectedValue,e.failureMessage||"",t):{success:!1,failMessage:"Missing expectedValue for toHaveRole assertion"};default:return{success:!1,failMessage:`Unknown assertion type: ${e.assertion}`}}}}});var Dt={};ce(Dt,{runContractTestsPlaywright:()=>Fr});async function Fr(s,e,t,r,n){let i=r?.test?.components?.find(p=>p.name===s),a=!!i?.contractPath,o=new Pe(!0,a),u={actionTimeoutMs:400,assertionTimeoutMs:400,navigationTimeoutMs:3e4,componentReadyTimeoutMs:5e3},l=r?.test?.disableTimeouts===!0,b=i?.disableTimeouts===!0||l,w=(p,y,C)=>{if(b)return 0;let B=p??y;return typeof B!="number"||!Number.isFinite(B)||B<0?C:B},H=w(i?.actionTimeoutMs,r?.test?.actionTimeoutMs,u.actionTimeoutMs),q=w(i?.assertionTimeoutMs,r?.test?.assertionTimeoutMs,u.assertionTimeoutMs),N=w(i?.navigationTimeoutMs,r?.test?.navigationTimeoutMs,u.navigationTimeoutMs),d=w(i?.componentReadyTimeoutMs,r?.test?.componentReadyTimeoutMs,u.componentReadyTimeoutMs),m=ye(t),$=i?.contractPath;if(!$)throw new Error(`Contract path not found for component: ${s}`);let O=(()=>{if(Be.default.isAbsolute($))return $;if(n){let y=Be.default.resolve(n,$);try{return(0,De.readFileSync)(y,"utf-8"),y}catch{}}let p=Be.default.resolve(process.cwd(),$);try{return(0,De.readFileSync)(p,"utf-8"),p}catch{return new URL($,Or.url).pathname}})(),E=(0,De.readFileSync)(O,"utf-8"),k=JSON.parse(E),F=(k.relationships?.length||0)+(k.static.length||0)+k.dynamic.length,v=k.meta?.source?.apg,x=[],L=[],g=[],T=[],h=null,D=(p,y)=>{let C=pe(y),B=ht(C,m);if(B==="error")return x.push(p),{status:"fail",level:C,detail:p};if(B==="warning")return L.push(p),{status:"warn",level:C,detail:p};let G=`${p} (ignored by strictness=${m}, level=${C})`;return T.push(G),{status:"skip",level:C,detail:G}};try{if(h=await gt(),e){try{await h.goto(e,{waitUntil:"domcontentloaded",timeout:N})}catch(c){throw new Error(`Failed to navigate to ${e}. Ensure dev server is running and accessible. Original error: ${c instanceof Error?c.message:String(c)}`)}await h.addStyleTag({content:"* { transition: none !important; animation: none !important; }"})}let p=await He.detect(s,i,H,q,n);if(!p)throw new Error(`Unsupported component: ${s}`);let y=p.getMainSelector();if(!y)throw new Error(`CRITICAL: No selector found in contract for ${s}`);try{await h.locator(y).first().waitFor({state:"attached",timeout:d})}catch(c){throw new Error(`
29
+ `),{passes:a,failures:o,skipped:this.skipped,duration:r}}error(e,r){this.log(`
30
+ \u274C Error: ${e}`),r&&this.log(` Context: ${r}`),this.log("")}}});var _t={};oe(_t,{RelativeTargetResolver:()=>ce});var ce,De=Y(()=>{"use strict";ce=class{static async resolve(e,r,s){let n=await e.locator(r).all();if(typeof s=="number")return n[s-1];switch(s){case"first":return n[0];case"second":return n[1];case"last":return n[n.length-1];case"next":{let a=(await e.evaluate(([o])=>Array.from(document.querySelectorAll(o)).indexOf(document.activeElement),[r])+1)%n.length;return n[a]}case"previous":{let a=(await e.evaluate(([o])=>Array.from(document.querySelectorAll(o)).indexOf(document.activeElement),[r])-1+n.length)%n.length;return n[a]}default:return null}}}});var be,Ut=Y(()=>{"use strict";De();be=class{constructor(e,r,s=400){this.page=e;this.selectors=r;this.timeoutMs=s}isBrowserClosedError(e){return e instanceof Error&&e.message.includes("Target page, context or browser has been closed")}async focus(e,r,s){try{if(e==="virtual"&&s){let i=this.selectors.main;if(!i)return{success:!1,error:"Main selector not defined for virtual focus."};let a=this.page.locator(i).first();return await a.count()?(await a.evaluate((l,u)=>{l.setAttribute("aria-activedescendant",u)},s),{success:!0}):{success:!1,error:"Main element not found for virtual focus."}}if(e==="relative"&&r){let i=this.selectors.relative;if(!i)return{success:!1,error:"Relative selector not defined for focus action."};let a=await ce.resolve(this.page,i,r);return a?(await a.focus({timeout:this.timeoutMs}),{success:!0}):{success:!1,error:`Could not resolve relative target ${r} for focus.`}}let n=this.selectors[e];return n?(await this.page.locator(n).first().focus({timeout:this.timeoutMs}),{success:!0}):{success:!1,error:`Selector for focus target ${e} not found.`}}catch(n){return this.isBrowserClosedError(n)?{success:!1,error:"CRITICAL: Browser/page closed during test execution. Remaining actions skipped.",shouldBreak:!0}:{success:!1,error:`Failed to focus ${e}: ${n instanceof Error?n.message:String(n)}`}}}async type(e,r){try{let s=this.selectors[e];return s?(await this.page.locator(s).first().fill(r,{timeout:this.timeoutMs}),{success:!0}):{success:!1,error:`Selector for type target ${e} not found.`}}catch(s){return this.isBrowserClosedError(s)?{success:!1,error:"CRITICAL: Browser/page closed during test execution. Remaining actions skipped.",shouldBreak:!0}:{success:!1,error:`Failed to type into ${e}: ${s instanceof Error?s.message:String(s)}`}}}async click(e,r){try{if(e==="document")return await this.page.mouse.click(10,10),{success:!0};if(e==="relative"&&r){let n=this.selectors.relative;if(!n)return{success:!1,error:"Relative selector not defined for click action."};let i=await ce.resolve(this.page,n,r);return i?(await i.click({timeout:this.timeoutMs}),{success:!0}):{success:!1,error:`Could not resolve relative target ${r} for click.`}}let s=this.selectors[e];return s?(await this.page.locator(s).first().click({timeout:this.timeoutMs}),{success:!0}):{success:!1,error:`Selector for action target ${e} not found.`}}catch(s){return this.isBrowserClosedError(s)?{success:!1,error:"CRITICAL: Browser/page closed during test execution. Remaining actions skipped.",shouldBreak:!0}:{success:!1,error:`Failed to click ${e}: ${s instanceof Error?s.message:String(s)}`}}}async keypress(e,r,s){try{let i={Space:"Space",Enter:"Enter",Escape:"Escape","Arrow Up":"ArrowUp","Arrow Down":"ArrowDown","Arrow Left":"ArrowLeft","Arrow Right":"ArrowRight",Home:"Home",End:"End",Tab:"Tab"}[r]||r;if(i==="Space"?i=" ":i.includes(" ")&&(i=i.replace(/ /g,"")),e==="relative"){if(s==null)return{success:!1,error:"relativeTarget must be provided for relative keypress."};let u=this.selectors.relative;if(!u)return{success:!1,error:"Relative selector not defined for keypress action."};let f=await ce.resolve(this.page,u,s);return f?(await f.press(i,{timeout:this.timeoutMs}),{success:!0}):{success:!1,error:`Could not resolve relative target ${s} for keypress.`}}let a=this.selectors[e];if(!a)return{success:!1,error:`Selector for keypress target ${e} not found.`};let o=this.page.locator(a).first();return await o.count()===0?{success:!1,error:`${e} element not found.`,shouldBreak:!0}:(await o.press(i,{timeout:this.timeoutMs}),{success:!0})}catch(n){return this.isBrowserClosedError(n)?{success:!1,error:"CRITICAL: Browser/page closed during test execution. Remaining actions skipped.",shouldBreak:!0}:{success:!1,error:`Failed to press ${r} on ${e}: ${n instanceof Error?n.message:String(n)}`}}}async hover(e,r){try{if(e==="relative"&&r){let n=this.selectors.relative;if(!n)return{success:!1,error:"Relative selector not defined for hover action."};let i=await ce.resolve(this.page,n,r);return i?(await i.hover({timeout:this.timeoutMs}),{success:!0}):{success:!1,error:`Could not resolve relative target ${r} for hover.`}}let s=this.selectors[e];return s?(await this.page.locator(s).first().hover({timeout:this.timeoutMs}),{success:!0}):{success:!1,error:`Selector for hover target ${e} not found.`}}catch(s){return this.isBrowserClosedError(s)?{success:!1,error:"CRITICAL: Browser/page closed during test execution. Remaining actions skipped.",shouldBreak:!0}:{success:!1,error:`Failed to hover ${e}: ${s instanceof Error?s.message:String(s)}`}}}}});var ke,Nt=Y(()=>{"use strict";de();De();ke=class{constructor(e,r,s=400){this.page=e;this.selectors=r;this.timeoutMs=s}async resolveTarget(e,r,s){try{if(e==="relative"){let i=s?this.selectors[s]:this.selectors.relative;if(!i)return{target:null,error:"Relative selector is not defined in the contract."};if(!r)return{target:null,error:"Relative target or expected value is not defined."};let a=await ce.resolve(this.page,i,r);return a?{target:a}:{target:null,error:`Target ${e} not found.`}}let n=this.selectors[e];return n?{target:this.page.locator(n).first()}:{target:null,error:`Selector for assertion target ${e} not found.`}}catch(n){return{target:null,error:`Failed to resolve target ${e}: ${n instanceof Error?n.message:String(n)}`}}}async validateVisibility(e,r,s,n,i){try{return s?(await(0,J.expect)(e).toBeVisible({timeout:this.timeoutMs}),{success:!0,passMessage:`${r} is visible as expected. Test: "${i}".`}):(await(0,J.expect)(e).toBeHidden({timeout:this.timeoutMs}),{success:!0,passMessage:`${r} is not visible as expected. Test: "${i}".`})}catch{let a=this.selectors[r]||"",o=await this.page.evaluate(l=>{let u=l?document.querySelector(l):null;if(!u)return"element not found";let f=window.getComputedStyle(u);return`display:${f.display}, visibility:${f.visibility}, opacity:${f.opacity}`},a);return s?{success:!1,failMessage:`${n} (actual: ${o})`}:{success:!1,failMessage:`${n} ${r} is still visible (actual: ${o}).`}}}async validateAttribute(e,r,s,n,i,a){if(n==="!empty"){let u=await e.getAttribute(s);return u&&u.trim()!==""?{success:!0,passMessage:`${r} has non-empty "${s}". Test: "${a}".`}:{success:!1,failMessage:`${i} ${r} "${s}" should not be empty, found "${u}".`}}if(typeof n!="string")throw console.error("[AssertionRunner] expectedValue is not a string:",n),new Error(`AssertionRunner: expectedValue for attribute assertion must be a string, but got: ${JSON.stringify(n)}`);let o=n.split(" | ").map(u=>u.trim()),l=await e.getAttribute(s);return l!==null&&o.includes(l)?{success:!0,passMessage:`${r} has expected "${s}". Test: "${a}".`}:{success:!1,failMessage:`${i} ${r} "${s}" should be "${n}", found "${l}".`}}async validateValue(e,r,s,n,i){let a=await e.inputValue().catch(()=>"");return s==="!empty"?a&&a.trim()!==""?{success:!0,passMessage:`${r} has non-empty value. Test: "${i}".`}:{success:!1,failMessage:`${n} ${r} value should not be empty, found "${a}".`}:s===""?a===""?{success:!0,passMessage:`${r} has empty value. Test: "${i}".`}:{success:!1,failMessage:`${n} ${r} value should be empty, found "${a}".`}:a===s?{success:!0,passMessage:`${r} has expected value. Test: "${i}".`}:{success:!1,failMessage:`${n} ${r} value should be "${s}", found "${a}".`}}async validateFocus(e,r,s,n,i){try{return s?(await(0,J.expect)(e).toBeFocused({timeout:this.timeoutMs}),{success:!0,passMessage:`${r} has focus as expected. Test: "${i}".`}):(await(0,J.expect)(e).not.toBeFocused({timeout:this.timeoutMs}),{success:!0,passMessage:`${r} does not have focus as expected. Test: "${i}".`})}catch{let a=await this.page.evaluate(()=>{let o=document.activeElement;return o?`${o.tagName}#${o.id||"no-id"}.${o.className||"no-class"}`:"no element focused"});return{success:!1,failMessage:`${n} (actual focus: ${a})`}}}async validateRole(e,r,s,n,i){let a=await e.getAttribute("role");return a===s?{success:!0,passMessage:`${r} has role "${s}". Test: "${i}".`}:{success:!1,failMessage:`${n} Expected role "${s}", found "${a}".`}}async validate(e,r){if(this.page.isClosed())return{success:!1,failMessage:"CRITICAL: Browser/page closed before completing all tests. Increase test timeout or reduce test complexity."};let s=null,n;if(e.controlledBy){let i=e.controlledBy,a=this.selectors[i.target];if(!a)return{success:!1,failMessage:`Selector for controlledBy.target '${i.target}' not found.`,target:null};let o=null;if(i.relativeTarget?o=await ce.resolve(this.page,a,i.relativeTarget):o=this.page.locator(a).first(),!o)return{success:!1,failMessage:"Controlling element for controlledBy not found.",target:null};let l=i.attribute||"aria-controls",u=await o.getAttribute(l);if(!u)return{success:!1,failMessage:`Controlling element does not have attribute '${l}'.`,target:null};if(s=this.page.locator(`#${u}`),!s||await s.count()===0)return{success:!1,failMessage:`Controlled element with id '${u}' not found.`,target:null}}else{let i=await this.resolveTarget(e.target,e.relativeTarget||e.expectedValue,e.selectorKey);if(s=i.target,n=i.error,n||!s)return{success:!1,failMessage:n||`Target ${e.target} not found.`,target:null}}if(e.target==="input"&&e.attribute==="aria-activedescendant"&&e.expectedValue==="!empty"&&e.relativeTarget&&e.selectorKey){let i=await ce.resolve(this.page,this.selectors[e.selectorKey],e.relativeTarget),a=i?await i.getAttribute("id"):null,o=await s.getAttribute("aria-activedescendant");return a&&o===a?{success:!0,passMessage:`input[aria-activedescendant] matches id of ${e.relativeTarget}(${e.selectorKey}). Test: "${r}".`}:{success:!1,failMessage:`input[aria-activedescendant] should match id of ${e.relativeTarget}(${e.selectorKey}), found "${o}".`}}switch(e.assertion){case"toBeVisible":return this.validateVisibility(s,e.target,!0,e.failureMessage||"",r);case"notToBeVisible":return this.validateVisibility(s,e.target,!1,e.failureMessage||"",r);case"toHaveAttribute":return e.attribute&&e.expectedValue!==void 0?this.validateAttribute(s,e.target,e.attribute,e.expectedValue,e.failureMessage||"",r):{success:!1,failMessage:"Missing attribute or expectedValue for toHaveAttribute assertion"};case"toHaveValue":return e.expectedValue!==void 0?this.validateValue(s,e.target,e.expectedValue,e.failureMessage||"",r):{success:!1,failMessage:"Missing expectedValue for toHaveValue assertion"};case"toHaveFocus":return this.validateFocus(s,e.target,!0,e.failureMessage||"",r);case"notToHaveFocus":return this.validateFocus(s,e.target,!1,e.failureMessage||"",r);case"toHaveRole":return e.expectedValue!==void 0?this.validateRole(s,e.target,e.expectedValue,e.failureMessage||"",r):{success:!1,failMessage:"Missing expectedValue for toHaveRole assertion"};default:return{success:!1,failMessage:`Unknown assertion type: ${e.assertion}`}}}}});var jt={};oe(jt,{runContractTestsPlaywright:()=>es});async function es(t,e,r,s,n){let i=s?.test?.components?.find(p=>p.name===t),a=!!i?.contractPath,o=new Ie(!0,a),l={actionTimeoutMs:400,assertionTimeoutMs:400,navigationTimeoutMs:3e4,componentReadyTimeoutMs:5e3},u=s?.test?.disableTimeouts===!0,y=i?.disableTimeouts===!0||u,T=(p,v,$)=>{if(y)return 0;let B=p??v;return typeof B!="number"||!Number.isFinite(B)||B<0?$:B},H=T(i?.actionTimeoutMs,s?.test?.actionTimeoutMs,l.actionTimeoutMs),q=T(i?.assertionTimeoutMs,s?.test?.assertionTimeoutMs,l.assertionTimeoutMs),U=T(i?.navigationTimeoutMs,s?.test?.navigationTimeoutMs,l.navigationTimeoutMs),G=T(i?.componentReadyTimeoutMs,s?.test?.componentReadyTimeoutMs,l.componentReadyTimeoutMs),g=we(r),d=i?.contractPath;if(!d)throw new Error(`Contract path not found for component: ${t}`);let C=(()=>{if(Ve.default.isAbsolute(d))return d;if(n){let v=Ve.default.resolve(n,d);try{return(0,Be.readFileSync)(v,"utf-8"),v}catch{}}let p=Ve.default.resolve(process.cwd(),d);try{return(0,Be.readFileSync)(p,"utf-8"),p}catch{return new URL(d,ts.url).pathname}})(),h=(0,Be.readFileSync)(C,"utf-8"),k=JSON.parse(h),F=(k.relationships?.length||0)+(k.static.length||0)+k.dynamic.length,w=k.meta?.source?.apg,x=[],L=[],m=[],A=[],b=null,D=(p,v)=>{let $=fe(v),B=kt($,g);if(B==="error")return x.push(p),{status:"fail",level:$,detail:p};if(B==="warning")return L.push(p),{status:"warn",level:$,detail:p};let X=`${p} (ignored by strictness=${g}, level=${$})`;return A.push(X),{status:"skip",level:$,detail:X}};try{if(b=await vt(),e){try{await b.goto(e,{waitUntil:"domcontentloaded",timeout:U})}catch(c){throw new Error(`Failed to navigate to ${e}. Ensure dev server is running and accessible. Original error: ${c instanceof Error?c.message:String(c)}`)}await b.addStyleTag({content:"* { transition: none !important; animation: none !important; }"})}let p=await Pe.detect(t,i,H,q,n);if(!p)throw new Error(`Unsupported component: ${t}`);let v=p.getMainSelector();if(!v)throw new Error(`CRITICAL: No selector found in contract for ${t}`);try{await b.locator(v).first().waitFor({state:"attached",timeout:G})}catch(c){throw new Error(`
31
31
  \u274C CRITICAL: Component not found on page!
32
32
  This usually means:
33
33
  - The component didn't render
34
34
  - The URL is incorrect
35
- - The component selector '${y}' in the contract is wrong
36
- - Original error: ${c}`)}o.start(s,F,v),s==="menu"&&k.selectors.main&&await h.locator(k.selectors.main).first().waitFor({state:"visible",timeout:d}).catch(()=>{});let C=s==="menu"&&k.selectors.submenuTrigger?await h.locator(k.selectors.submenuTrigger).count()>0:!1,B=c=>c.type==="aria-reference"&&[c.from,c.to].some(R=>["submenu","submenuTrigger","submenuItems"].includes(R||""))||c.type==="contains"&&[c.parent,c.child].some(R=>["submenu","submenuTrigger","submenuItems"].includes(R||"")),G=0,ee=0,te=0;for(let c of k.relationships||[]){if(p&&typeof p.resetState=="function")try{await p.resetState(h)}catch(I){L.push(`Warning: resetState failed before relationship test: ${I instanceof Error?I.message:String(I)}`)}let R=pe(c.level);if(Array.isArray(c.setup)&&c.setup.length>0){let j=function(S){return V.includes(S)};var Z=j;let I=new me(h,k.selectors,H),z=c.type==="aria-reference"?`${c.from}.${c.attribute} references ${c.to}`:`${c.parent} contains ${c.child}`,V=["focus","type","click","keypress","hover"],_=S=>({...S,type:j(S.type)?S.type:"click"}),K=c.setup.map(_),J=await qe(K,I,p,h,z,["submenu","submenuTrigger","submenuItems"]);if(J.skip){T.push(J.message||"Setup action skipped"),o.reportStaticTest(z,"skip",J.message,R);continue}if(!J.success){let S=`Relationship setup failed: ${J.error}`,M=D(S,c.level);M.status==="fail"&&(ee+=1),M.status==="warn"&&(te+=1),o.reportStaticTest(z,M.status,M.detail,M.level);continue}}if(s==="menu"&&!C&&B(c)){let z=c.type==="aria-reference"?`${c.from}.${c.attribute} references ${c.to}`:`${c.parent} contains ${c.child}`,V="Skipping submenu relationship assertion: no submenu capability detected in rendered component.";T.push(V),o.reportStaticTest(z,"skip",V,R);continue}if(c.type==="aria-reference"){let I=`${c.from}.${c.attribute} references ${c.to}`,z=k.selectors[c.from],V=k.selectors[c.to];if(!z||!V){let P=D(`Relationship selector missing: from="${c.from}" or to="${c.to}" not found in selectors.`,c.level);P.status==="fail"&&(ee+=1),P.status==="warn"&&(te+=1),o.reportStaticTest(I,P.status,P.detail,P.level);continue}let j=h.locator(z).first(),_=h.locator(V).first(),K=await j.count()>0,J=await _.count()>0;if(!K||!J){if(s==="menu"&&B(c)){let re="Skipping submenu relationship assertion in static phase: submenu elements are not present until submenu is opened.";T.push(re),o.reportStaticTest(I,"skip",re,R);continue}let P=D(`Relationship target not found: ${K?c.to:c.from}.`,c.level);P.status==="fail"&&(ee+=1),P.status==="warn"&&(te+=1),o.reportStaticTest(I,P.status,P.detail,P.level);continue}let S=await j.getAttribute(c.attribute),M=await _.getAttribute("id");if(!M){let P=D(`Relationship target "${c.to}" must have an id for ${c.attribute} validation.`,c.level);P.status==="fail"&&(ee+=1),P.status==="warn"&&(te+=1),o.reportStaticTest(I,P.status,P.detail,P.level);continue}if(!(S||"").split(/\s+/).filter(Boolean).includes(M)){let P=D(`Expected ${c.from} ${c.attribute} to reference id "${M}", found "${S||""}".`,c.level);P.status==="fail"&&(ee+=1),P.status==="warn"&&(te+=1),o.reportStaticTest(I,P.status,P.detail,P.level);continue}g.push(`Relationship valid: ${c.from}.${c.attribute} -> ${c.to} (id=${M}).`),G+=1,o.reportStaticTest(I,"pass",void 0,R);continue}if(c.type==="contains"){let I=`${c.parent} contains ${c.child}`,z=k.selectors[c.parent],V=k.selectors[c.child];if(!z||!V){let S=D(`Relationship selector missing: parent="${c.parent}" or child="${c.child}" not found in selectors.`,c.level);S.status==="fail"&&(ee+=1),S.status==="warn"&&(te+=1),o.reportStaticTest(I,S.status,S.detail,S.level);continue}let j=h.locator(z).first();if(!(await j.count()>0)){if(s==="menu"&&B(c)){let M="Skipping submenu relationship assertion in static phase: submenu container is not present until submenu is opened.";T.push(M),o.reportStaticTest(I,"skip",M,R);continue}let S=D(`Relationship parent target not found: ${c.parent}.`,c.level);S.status==="fail"&&(ee+=1),S.status==="warn"&&(te+=1),o.reportStaticTest(I,S.status,S.detail,S.level);continue}if(await j.locator(V).count()<1){if(s==="menu"&&B(c)){let M="Skipping submenu relationship assertion in static phase: submenu descendants are not present until submenu is opened.";T.push(M),o.reportStaticTest(I,"skip",M,R);continue}let S=D(`Expected ${c.parent} to contain descendant matching selector for ${c.child}.`,c.level);S.status==="fail"&&(ee+=1),S.status==="warn"&&(te+=1),o.reportStaticTest(I,S.status,S.detail,S.level);continue}g.push(`Relationship valid: ${c.parent} contains ${c.child}.`),G+=1,o.reportStaticTest(I,"pass",void 0,R)}}async function tt(c,R,I,z={}){if(!c||typeof c!="object"||!("ref"in c))return c;let V;if(c.ref==="relative"){if(!c.relativeTarget||!z.relativeBaseSelector)return;let j=I.locator(z.relativeBaseSelector),_=await j.count(),K=0;if(c.relativeTarget==="first"?K=0:c.relativeTarget==="second"?K=1:c.relativeTarget==="last"?K=_-1:isNaN(Number(c.relativeTarget))?K=0:K=Number(c.relativeTarget),K<0||K>=_)return;let J=j.nth(K);return await rt(J,c.property||c.attribute)}else{if(V=R[c.ref],!V)throw new Error(`Selector for ref '${c.ref}' not found in contract selectors.`);let j=I.locator(V).first();return await rt(j,c.property||c.attribute)}}async function rt(c,R){if(c)return!R||R==="id"?await c.getAttribute("id")??void 0:R==="class"?await c.getAttribute("class")??void 0:R==="textContent"?await c.evaluate(I=>I.textContent??void 0):R.startsWith("aria-")?await c.getAttribute(R)??void 0:R.endsWith("*")?await c.evaluate(z=>{let V=[];for(let j of Array.from(z.attributes))j.name.startsWith("aria-")&&V.push(`${j.name}=${j.value}`);return V.join(";")}):await c.getAttribute(R)??void 0}let Nt=new we(h,k.selectors,q);async function qe(c,R,I,z,V,j=[]){if(!Array.isArray(c)||c.length===0)return{success:!0};I&&typeof I.resetState=="function"&&await I.resetState(z);for(let _ of c){let K={success:!0};try{if(_.type==="focus")_.target==="relative"&&_.relativeTarget?K=await R.focus("relative",_.relativeTarget):K=await R.focus(_.target);else if(_.type==="type"&&_.value)K=await R.type(_.target,_.value);else if(_.type==="click")K=await R.click(_.target,_.relativeTarget);else if(_.type==="keypress"&&_.key)K=await R.keypress(_.target,_.key,_.relativeTarget);else if(_.type==="hover")K=await R.hover(_.target,_.relativeTarget);else continue}catch(J){K={success:!1,error:J instanceof Error?J.message:String(J)}}if(!K.success){let J=K.error||"Setup action failed";return j.some(M=>V.includes(M)||J.includes(M))?{success:!1,skip:!0,message:`Skipping test - capability not present: ${J}`}:{success:!1,error:J}}}return{success:!0}}for(let c of k.static||[]){if(p&&typeof p.resetState=="function")try{await p.resetState(h)}catch(S){L.push(`Warning: resetState failed before static test: ${S instanceof Error?S.message:String(S)}`)}if(c.target==="relative")continue;let R=`${c.target}${c.attribute?` (${c.attribute})`:""}`,I=pe(c.level);if(s==="menu"&&c.target==="submenuTrigger"&&!C){let S=`Skipping submenu static assertion for ${c.target}: no submenu capability detected in rendered component.`;T.push(S),o.reportStaticTest(R,"skip",S,I);continue}let z=[];if(c.target||z.push("target"),c.attribute||z.push("attribute"),typeof c.expectedValue>"u"&&z.push("expectedValue"),z.length>0){let S=`${c.target||""}${c.attribute?` (${c.attribute})`:""}`,M=`Static assertion missing required field(s): ${z.join(", ")}`,U=D(M,c.level);U.status==="fail"&&(ee+=1),U.status==="warn"&&(te+=1),o.reportStaticTest(S,U.status,U.detail,U.level);continue}if(Array.isArray(c.setup)&&c.setup.length>0){let U=function(A){return M.includes(A)};var Z=U;let S=new me(h,k.selectors,H),M=["focus","type","click","keypress","hover"],ie=A=>({...A,type:U(A.type)?A.type:"click"}),P=c.setup.map(ie),re=await qe(P,S,p,h,R,["submenu","submenuTrigger","submenuItems"]);if(re.skip){T.push(re.message||"Setup action skipped"),o.reportStaticTest(R,"skip",re.message,I);continue}if(!re.success){let A=`Static setup failed: ${re.error}`,W=D(A,c.level);W.status==="fail"&&(ee+=1),W.status==="warn"&&(te+=1),o.reportStaticTest(R,W.status,W.detail,W.level);continue}}let V=k.selectors[c.target];if(!V){let S=`Selector for target ${c.target} not found.`,M=D(S,c.level);M.status==="fail"&&(ee+=1),M.status==="warn"&&(te+=1),o.reportStaticTest(R,M.status,M.detail,M.level);continue}let j=h.locator(V).first();if(!(await j.count()>0)){let S=`Target ${c.target} not found.`,M=D(S,c.level);M.status==="fail"&&(ee+=1),M.status==="warn"&&(te+=1),o.reportStaticTest(R,M.status,M.detail,M.level);continue}let K=(S,M,U)=>{let ie=new RegExp(`\\[${M}(?:=["']?([^\\]"']+)["']?)?\\]`),P=S.match(ie);if(!P)return!1;if(!U)return!0;let re=P[1];return re?U.split(" | ").includes(re):!1},J=c.expectedValue;if(c.expectedValue&&typeof c.expectedValue=="object"&&"ref"in c.expectedValue){let S={},M=c.relativeTarget;if(c.expectedValue.ref==="relative"&&c.target==="relative"&&M){let U=k.selectors[M];if(!U)throw new Error(`Selector for relativeTarget '${M}' not found in contract selectors.`);S.relativeBaseSelector=U}else if(c.expectedValue.ref==="relative"&&M){let U=k.selectors[M];if(!U)throw new Error(`Selector for relativeTarget '${M}' not found in contract selectors.`);S.relativeBaseSelector=U}J=await tt(c.expectedValue,k.selectors,h,S)}if(c.expectedValue)if(K(V,c.attribute,typeof J=="string"?J:void 0))g.push(`${c.attribute}="${J}" on ${c.target} verified by selector (already present in: ${V}).`),G+=1,o.reportStaticTest(R,"pass",void 0,I);else{let S=J??"",M=await Nt.validateAttribute(j,c.target,c.attribute,S,c.failureMessage,"Static ARIA Test");if(M.success&&M.passMessage)g.push(M.passMessage),G+=1,o.reportStaticTest(R,"pass",void 0,I);else if(!M.success&&M.failMessage){let U=D(M.failMessage,c.level);U.status==="fail"&&(ee+=1),U.status==="warn"&&(te+=1),o.reportStaticTest(R,U.status,U.detail,U.level)}}else{let S=c.attribute.split(" | "),M=!1,U=!0;for(let ie of S){let P=ie.trim();if(K(V,P)){g.push(`${P} on ${c.target} verified by selector (already present in: ${V}).`),M=!0;continue}if(U=!1,await j.getAttribute(P)!==null){M=!0;break}}if(!M&&!U){let ie=c.failureMessage+` None of the attributes "${c.attribute}" are present.`,P=D(ie,c.level);P.status==="fail"&&(ee+=1),P.status==="warn"&&(te+=1),o.reportStaticTest(R,P.status,P.detail,P.level)}else!U&&M?(g.push(`At least one of the attributes "${c.attribute}" exists on the element.`),G+=1,o.reportStaticTest(R,"pass",void 0,I)):(G+=1,o.reportStaticTest(R,"pass",void 0,I))}}for(let c of k.dynamic||[]){if(!c.assertions||c.assertions.length===0){let A="Skipping test - no assertions found for this dynamic test.";T.push(A),o.reportTest({description:c.description,level:pe(c.level)},"skip",A);continue}if(!h||h.isClosed()){console.warn(`
35
+ - The component selector '${v}' in the contract is wrong
36
+ - Original error: ${c}`)}o.start(t,F,w),t==="menu"&&k.selectors.main&&await b.locator(k.selectors.main).first().waitFor({state:"visible",timeout:G}).catch(()=>{});let $=t==="menu"&&k.selectors.submenuTrigger?await b.locator(k.selectors.submenuTrigger).count()>0:!1,B=c=>c.type==="aria-reference"&&[c.from,c.to].some(R=>["submenu","submenuTrigger","submenuItems"].includes(R||""))||c.type==="contains"&&[c.parent,c.child].some(R=>["submenu","submenuTrigger","submenuItems"].includes(R||"")),X=0,ee=0,te=0;for(let c of k.relationships||[]){if(p&&typeof p.resetState=="function")try{await p.resetState(b)}catch(I){L.push(`Warning: resetState failed before relationship test: ${I instanceof Error?I.message:String(I)}`)}let R=fe(c.level);if(Array.isArray(c.setup)&&c.setup.length>0){let N=function(M){return V.includes(M)};var Z=N;let I=new be(b,k.selectors,H),W=c.type==="aria-reference"?`${c.from}.${c.attribute} references ${c.to}`:`${c.parent} contains ${c.child}`,V=["focus","type","click","keypress","hover"],O=M=>({...M,type:N(M.type)?M.type:"click"}),j=c.setup.map(O),z=await Fe(j,I,p,b,W,["submenu","submenuTrigger","submenuItems"]);if(z.skip){A.push(z.message||"Setup action skipped"),o.reportStaticTest(W,"skip",z.message,R);continue}if(!z.success){let M=`Relationship setup failed: ${z.error}`,S=D(M,c.level);S.status==="fail"&&(ee+=1),S.status==="warn"&&(te+=1),o.reportStaticTest(W,S.status,S.detail,S.level);continue}}if(t==="menu"&&!$&&B(c)){let W=c.type==="aria-reference"?`${c.from}.${c.attribute} references ${c.to}`:`${c.parent} contains ${c.child}`,V="Skipping submenu relationship assertion: no submenu capability detected in rendered component.";A.push(V),o.reportStaticTest(W,"skip",V,R);continue}if(c.type==="aria-reference"){let I=`${c.from}.${c.attribute} references ${c.to}`,W=k.selectors[c.from],V=k.selectors[c.to];if(!W||!V){let P=D(`Relationship selector missing: from="${c.from}" or to="${c.to}" not found in selectors.`,c.level);P.status==="fail"&&(ee+=1),P.status==="warn"&&(te+=1),o.reportStaticTest(I,P.status,P.detail,P.level);continue}let N=b.locator(W).first(),O=b.locator(V).first(),j=await N.count()>0,z=await O.count()>0;if(!j||!z){if(t==="menu"&&B(c)){let re="Skipping submenu relationship assertion in static phase: submenu elements are not present until submenu is opened.";A.push(re),o.reportStaticTest(I,"skip",re,R);continue}let P=D(`Relationship target not found: ${j?c.to:c.from}.`,c.level);P.status==="fail"&&(ee+=1),P.status==="warn"&&(te+=1),o.reportStaticTest(I,P.status,P.detail,P.level);continue}let M=await N.getAttribute(c.attribute),S=await O.getAttribute("id");if(!S){let P=D(`Relationship target "${c.to}" must have an id for ${c.attribute} validation.`,c.level);P.status==="fail"&&(ee+=1),P.status==="warn"&&(te+=1),o.reportStaticTest(I,P.status,P.detail,P.level);continue}if(!(M||"").split(/\s+/).filter(Boolean).includes(S)){let P=D(`Expected ${c.from} ${c.attribute} to reference id "${S}", found "${M||""}".`,c.level);P.status==="fail"&&(ee+=1),P.status==="warn"&&(te+=1),o.reportStaticTest(I,P.status,P.detail,P.level);continue}m.push(`Relationship valid: ${c.from}.${c.attribute} -> ${c.to} (id=${S}).`),X+=1,o.reportStaticTest(I,"pass",void 0,R);continue}if(c.type==="contains"){let I=`${c.parent} contains ${c.child}`,W=k.selectors[c.parent],V=k.selectors[c.child];if(!W||!V){let M=D(`Relationship selector missing: parent="${c.parent}" or child="${c.child}" not found in selectors.`,c.level);M.status==="fail"&&(ee+=1),M.status==="warn"&&(te+=1),o.reportStaticTest(I,M.status,M.detail,M.level);continue}let N=b.locator(W).first();if(!(await N.count()>0)){if(t==="menu"&&B(c)){let S="Skipping submenu relationship assertion in static phase: submenu container is not present until submenu is opened.";A.push(S),o.reportStaticTest(I,"skip",S,R);continue}let M=D(`Relationship parent target not found: ${c.parent}.`,c.level);M.status==="fail"&&(ee+=1),M.status==="warn"&&(te+=1),o.reportStaticTest(I,M.status,M.detail,M.level);continue}if(await N.locator(V).count()<1){if(t==="menu"&&B(c)){let S="Skipping submenu relationship assertion in static phase: submenu descendants are not present until submenu is opened.";A.push(S),o.reportStaticTest(I,"skip",S,R);continue}let M=D(`Expected ${c.parent} to contain descendant matching selector for ${c.child}.`,c.level);M.status==="fail"&&(ee+=1),M.status==="warn"&&(te+=1),o.reportStaticTest(I,M.status,M.detail,M.level);continue}m.push(`Relationship valid: ${c.parent} contains ${c.child}.`),X+=1,o.reportStaticTest(I,"pass",void 0,R)}}async function nt(c,R,I,W={}){if(!c||typeof c!="object"||!("ref"in c))return c;let V;if(c.ref==="relative"){if(!c.relativeTarget||!W.relativeBaseSelector)return;let N=I.locator(W.relativeBaseSelector),O=await N.count(),j=0;if(c.relativeTarget==="first"?j=0:c.relativeTarget==="second"?j=1:c.relativeTarget==="last"?j=O-1:isNaN(Number(c.relativeTarget))?j=0:j=Number(c.relativeTarget),j<0||j>=O)return;let z=N.nth(j);return await it(z,c.property||c.attribute)}else{if(V=R[c.ref],!V)throw new Error(`Selector for ref '${c.ref}' not found in contract selectors.`);let N=I.locator(V).first();return await it(N,c.property||c.attribute)}}async function it(c,R){if(c)return!R||R==="id"?await c.getAttribute("id")??void 0:R==="class"?await c.getAttribute("class")??void 0:R==="textContent"?await c.evaluate(I=>I.textContent??void 0):R.startsWith("aria-")?await c.getAttribute(R)??void 0:R.endsWith("*")?await c.evaluate(W=>{let V=[];for(let N of Array.from(W.attributes))N.name.startsWith("aria-")&&V.push(`${N.name}=${N.value}`);return V.join(";")}):await c.getAttribute(R)??void 0}let Qt=new ke(b,k.selectors,q);async function Fe(c,R,I,W,V,N=[]){if(!Array.isArray(c)||c.length===0)return{success:!0};I&&typeof I.resetState=="function"&&await I.resetState(W);for(let O of c){let j={success:!0};try{if(O.type==="focus")O.target==="relative"&&O.relativeTarget?j=await R.focus("relative",O.relativeTarget):j=await R.focus(O.target);else if(O.type==="type"&&O.value)j=await R.type(O.target,O.value);else if(O.type==="click")j=await R.click(O.target,O.relativeTarget);else if(O.type==="keypress"&&O.key)j=await R.keypress(O.target,O.key,O.relativeTarget);else if(O.type==="hover")j=await R.hover(O.target,O.relativeTarget);else continue}catch(z){j={success:!1,error:z instanceof Error?z.message:String(z)}}if(!j.success){let z=j.error||"Setup action failed";return N.some(S=>V.includes(S)||z.includes(S))?{success:!1,skip:!0,message:`Skipping test - capability not present: ${z}`}:{success:!1,error:z}}}return{success:!0}}for(let c of k.static||[]){if(p&&typeof p.resetState=="function")try{await p.resetState(b)}catch(M){L.push(`Warning: resetState failed before static test: ${M instanceof Error?M.message:String(M)}`)}if(c.target==="relative")continue;let R=`${c.target}${c.attribute?` (${c.attribute})`:""}`,I=fe(c.level);if(t==="menu"&&c.target==="submenuTrigger"&&!$){let M=`Skipping submenu static assertion for ${c.target}: no submenu capability detected in rendered component.`;A.push(M),o.reportStaticTest(R,"skip",M,I);continue}let W=[];if(c.target||W.push("target"),c.attribute||W.push("attribute"),typeof c.expectedValue>"u"&&W.push("expectedValue"),W.length>0){let M=`${c.target||""}${c.attribute?` (${c.attribute})`:""}`,S=`Static assertion missing required field(s): ${W.join(", ")}`,_=D(S,c.level);_.status==="fail"&&(ee+=1),_.status==="warn"&&(te+=1),o.reportStaticTest(M,_.status,_.detail,_.level);continue}if(Array.isArray(c.setup)&&c.setup.length>0){let _=function(E){return S.includes(E)};var Z=_;let M=new be(b,k.selectors,H),S=["focus","type","click","keypress","hover"],ie=E=>({...E,type:_(E.type)?E.type:"click"}),P=c.setup.map(ie),re=await Fe(P,M,p,b,R,["submenu","submenuTrigger","submenuItems"]);if(re.skip){A.push(re.message||"Setup action skipped"),o.reportStaticTest(R,"skip",re.message,I);continue}if(!re.success){let E=`Static setup failed: ${re.error}`,K=D(E,c.level);K.status==="fail"&&(ee+=1),K.status==="warn"&&(te+=1),o.reportStaticTest(R,K.status,K.detail,K.level);continue}}let V=k.selectors[c.target];if(!V){let M=`Selector for target ${c.target} not found.`,S=D(M,c.level);S.status==="fail"&&(ee+=1),S.status==="warn"&&(te+=1),o.reportStaticTest(R,S.status,S.detail,S.level);continue}let N=b.locator(V).first();if(!(await N.count()>0)){let M=`Target ${c.target} not found.`,S=D(M,c.level);S.status==="fail"&&(ee+=1),S.status==="warn"&&(te+=1),o.reportStaticTest(R,S.status,S.detail,S.level);continue}let j=(M,S,_)=>{let ie=new RegExp(`\\[${S}(?:=["']?([^\\]"']+)["']?)?\\]`),P=M.match(ie);if(!P)return!1;if(!_)return!0;let re=P[1];return re?_.split(" | ").includes(re):!1},z=c.expectedValue;if(c.expectedValue&&typeof c.expectedValue=="object"&&"ref"in c.expectedValue){let M={},S=c.relativeTarget;if(c.expectedValue.ref==="relative"&&c.target==="relative"&&S){let _=k.selectors[S];if(!_)throw new Error(`Selector for relativeTarget '${S}' not found in contract selectors.`);M.relativeBaseSelector=_}else if(c.expectedValue.ref==="relative"&&S){let _=k.selectors[S];if(!_)throw new Error(`Selector for relativeTarget '${S}' not found in contract selectors.`);M.relativeBaseSelector=_}z=await nt(c.expectedValue,k.selectors,b,M)}if(c.expectedValue)if(j(V,c.attribute,typeof z=="string"?z:void 0))m.push(`${c.attribute}="${z}" on ${c.target} verified by selector (already present in: ${V}).`),X+=1,o.reportStaticTest(R,"pass",void 0,I);else{let M=z??"",S=await Qt.validateAttribute(N,c.target,c.attribute,M,c.failureMessage,"Static ARIA Test");if(S.success&&S.passMessage)m.push(S.passMessage),X+=1,o.reportStaticTest(R,"pass",void 0,I);else if(!S.success&&S.failMessage){let _=D(S.failMessage,c.level);_.status==="fail"&&(ee+=1),_.status==="warn"&&(te+=1),o.reportStaticTest(R,_.status,_.detail,_.level)}}else{let M=c.attribute.split(" | "),S=!1,_=!0;for(let ie of M){let P=ie.trim();if(j(V,P)){m.push(`${P} on ${c.target} verified by selector (already present in: ${V}).`),S=!0;continue}if(_=!1,await N.getAttribute(P)!==null){S=!0;break}}if(!S&&!_){let ie=c.failureMessage+` None of the attributes "${c.attribute}" are present.`,P=D(ie,c.level);P.status==="fail"&&(ee+=1),P.status==="warn"&&(te+=1),o.reportStaticTest(R,P.status,P.detail,P.level)}else!_&&S?(m.push(`At least one of the attributes "${c.attribute}" exists on the element.`),X+=1,o.reportStaticTest(R,"pass",void 0,I)):(X+=1,o.reportStaticTest(R,"pass",void 0,I))}}for(let c of k.dynamic||[]){if(!c.assertions||c.assertions.length===0){let E="Skipping test - no assertions found for this dynamic test.";A.push(E),o.reportTest({description:c.description,level:fe(c.level)},"skip",E);continue}if(!b||b.isClosed()){console.warn(`
37
37
  \u26A0\uFE0F Browser closed - skipping remaining ${k.dynamic.length-k.dynamic.indexOf(c)} tests
38
- `),x.push(`CRITICAL: Browser/page closed before completing all tests. ${k.dynamic.length-k.dynamic.indexOf(c)} tests skipped.`);break}try{await p.resetState(h)}catch(A){let W=A instanceof Error?A.message:String(A);throw o.error(W),A}let{setup:R=[],action:I,assertions:z}=c,V=pe(c.level),j=new me(h,k.selectors,H);if(Array.isArray(R)&&R.length>0){let W=function(se){return A.includes(se)};var Z=W;let A=["focus","type","click","keypress","hover"],fe=se=>({...se,type:W(se.type)?se.type:"click"}),Fe=R.map(fe),ae=await qe(Fe,j,p,h,c.description,["submenu","submenuTrigger","submenuItems"]);if(ae.skip){T.push(ae.message||"Setup action skipped"),o.reportTest({description:c.description,level:V},"skip",ae.message);continue}if(!ae.success){let se=D(`Setup failed: ${ae.error}`,c.level);o.reportTest({description:c.description,level:V},se.status,se.detail);continue}}let _=x.length,K=L.length,J=T.length;if(await p.shouldSkipTest(c,h)){let A="Skipping test - component-specific conditions not met";T.push(A),o.reportTest({description:c.description,level:V},"skip",A);continue}let M=new we(h,k.selectors,q),U=!1,ie=null;for(let A of I){if(!h||h.isClosed()){x.push("CRITICAL: Browser/page closed during test execution. Remaining actions skipped."),U=!0;break}let W;if(A.type==="focus")A.target==="relative"&&A.relativeTarget?W=await j.focus("relative",A.relativeTarget):W=await j.focus(A.target);else if(A.type==="type"&&A.value)W=await j.type(A.target,A.value);else if(A.type==="click")W=await j.click(A.target,A.relativeTarget);else if(A.type==="keypress"&&A.key)W=await j.keypress(A.target,A.key,A.relativeTarget);else if(A.type==="hover")W=await j.hover(A.target,A.relativeTarget);else continue;if(!W.success){if(W.error){let fe=D(W.error,c.level);ie={status:fe.status,detail:fe.detail}}U=!0;break}}if(U){o.reportTest({description:c.description,level:V},ie?.status||"fail",ie?.detail||x[x.length-1]);continue}for(let A of z){let W;if(A.expectedValue&&typeof A.expectedValue=="object"&&"ref"in A.expectedValue)if(A.expectedValue.ref==="relative"){let{RelativeTargetResolver:le}=await Promise.resolve().then(()=>(Ie(),Ht)),se=k.selectors.relative;if(!se)throw new Error("Relative selector not defined in contract selectors.");let be=A.relativeTarget||"first",ue=await le.resolve(h,se,be);if(!ue)throw new Error(`Could not resolve relative target '${be}' for expectedValue.`);let nt=A.expectedValue.property||A.expectedValue.attribute||"id";if(nt==="textContent")W=await ue.evaluate(ke=>ke.textContent??void 0);else{let ke=await ue.getAttribute(nt);W=ke===null?void 0:ke}}else W=await tt(A.expectedValue,k.selectors,h,{});else typeof A.expectedValue=="string"||typeof A.expectedValue>"u"?W=A.expectedValue:W="";let fe={...A,expectedValue:W},Fe=W??"",ae=await M.validate({...fe,expectedValue:Fe},c.description);if(ae.success&&ae.passMessage)g.push(ae.passMessage);else if(!ae.success&&ae.failMessage){let le=[];if(A.target||le.push("target"),A.assertion||le.push("assertion"),["toHaveAttribute","toHaveValue","toHaveRole"].includes(A.assertion)&&(typeof A.attribute>"u"&&A.assertion==="toHaveAttribute"&&le.push("attribute"),typeof A.expectedValue>"u"&&le.push("expectedValue")),le.length>0){let se=pe(A.level||c.level),be=`Dynamic assertion missing required field(s): ${le.join(", ")}`,ue=D(be,se);if(ue.status==="skip")continue;x.push(be),o.reportTest({description:c.description,level:se},ue.status,ue.detail);continue}}}let P=x.length,re=L.length,st=T.length;P>_?o.reportTest({description:c.description,level:V},"fail",x[x.length-1]):re>K?o.reportTest({description:c.description,level:V},"warn",L[L.length-1]):st>J?o.reportTest({description:c.description,level:V},"skip",T[T.length-1]):o.reportTest({description:c.description,level:V},"pass")}o.reportStatic(G,ee,te),o.summary(x)}catch(p){if(p instanceof Error)throw p.message.includes("Executable doesn't exist")||p.message.includes("browserType.launch")?new Error(`
38
+ `),x.push(`CRITICAL: Browser/page closed before completing all tests. ${k.dynamic.length-k.dynamic.indexOf(c)} tests skipped.`);break}try{await p.resetState(b)}catch(E){let K=E instanceof Error?E.message:String(E);throw o.error(K),E}let{setup:R=[],action:I,assertions:W}=c,V=fe(c.level),N=new be(b,k.selectors,H);if(Array.isArray(R)&&R.length>0){let K=function(se){return E.includes(se)};var Z=K;let E=["focus","type","click","keypress","hover"],ge=se=>({...se,type:K(se.type)?se.type:"click"}),Oe=R.map(ge),le=await Fe(Oe,N,p,b,c.description,["submenu","submenuTrigger","submenuItems"]);if(le.skip){A.push(le.message||"Setup action skipped"),o.reportTest({description:c.description,level:V},"skip",le.message);continue}if(!le.success){let se=D(`Setup failed: ${le.error}`,c.level);o.reportTest({description:c.description,level:V},se.status,se.detail);continue}}let O=x.length,j=L.length,z=A.length;if(await p.shouldSkipTest(c,b)){let E="Skipping test - component-specific conditions not met";A.push(E),o.reportTest({description:c.description,level:V},"skip",E);continue}let S=new ke(b,k.selectors,q),_=!1,ie=null;for(let E of I){if(!b||b.isClosed()){x.push("CRITICAL: Browser/page closed during test execution. Remaining actions skipped."),_=!0;break}let K;if(E.type==="focus")E.target==="relative"&&E.relativeTarget?K=await N.focus("relative",E.relativeTarget):K=await N.focus(E.target);else if(E.type==="type"&&E.value)K=await N.type(E.target,E.value);else if(E.type==="click")K=await N.click(E.target,E.relativeTarget);else if(E.type==="keypress"&&E.key)K=await N.keypress(E.target,E.key,E.relativeTarget);else if(E.type==="hover")K=await N.hover(E.target,E.relativeTarget);else continue;if(!K.success){if(K.error){let ge=D(K.error,c.level);ie={status:ge.status,detail:ge.detail}}_=!0;break}}if(_){o.reportTest({description:c.description,level:V},ie?.status||"fail",ie?.detail||x[x.length-1]);continue}for(let E of W){let K;if(E.expectedValue&&typeof E.expectedValue=="object"&&"ref"in E.expectedValue)if(E.expectedValue.ref==="relative"){let{RelativeTargetResolver:ue}=await Promise.resolve().then(()=>(De(),_t)),se=k.selectors.relative;if(!se)throw new Error("Relative selector not defined in contract selectors.");let ve=E.relativeTarget||"first",pe=await ue.resolve(b,se,ve);if(!pe)throw new Error(`Could not resolve relative target '${ve}' for expectedValue.`);let at=E.expectedValue.property||E.expectedValue.attribute||"id";if(at==="textContent")K=await pe.evaluate(Te=>Te.textContent??void 0);else{let Te=await pe.getAttribute(at);K=Te===null?void 0:Te}}else K=await nt(E.expectedValue,k.selectors,b,{});else typeof E.expectedValue=="string"||typeof E.expectedValue>"u"?K=E.expectedValue:K="";let ge={...E,expectedValue:K},Oe=K??"",le=await S.validate({...ge,expectedValue:Oe},c.description);if(le.success&&le.passMessage)m.push(le.passMessage);else if(!le.success&&le.failMessage){let ue=[];if(E.target||ue.push("target"),E.assertion||ue.push("assertion"),["toHaveAttribute","toHaveValue","toHaveRole"].includes(E.assertion)&&(typeof E.attribute>"u"&&E.assertion==="toHaveAttribute"&&ue.push("attribute"),typeof E.expectedValue>"u"&&ue.push("expectedValue")),ue.length>0){let se=fe(E.level||c.level),ve=`Dynamic assertion missing required field(s): ${ue.join(", ")}`,pe=D(ve,se);if(pe.status==="skip")continue;x.push(ve),o.reportTest({description:c.description,level:se},pe.status,pe.detail);continue}}}let P=x.length,re=L.length,ot=A.length;P>O?o.reportTest({description:c.description,level:V},"fail",x[x.length-1]):re>j?o.reportTest({description:c.description,level:V},"warn",L[L.length-1]):ot>z?o.reportTest({description:c.description,level:V},"skip",A[A.length-1]):o.reportTest({description:c.description,level:V},"pass")}o.reportStatic(X,ee,te),o.summary(x)}catch(p){if(p instanceof Error)throw p.message.includes("Executable doesn't exist")||p.message.includes("browserType.launch")?new Error(`
39
39
  \u274C CRITICAL: Playwright browsers not found!
40
40
  \u{1F4E6} Run: npx playwright install chromium`):p.message.includes("net::ERR_CONNECTION_REFUSED")||p.message.includes("NS_ERROR_CONNECTION_REFUSED")?new Error(`
41
41
  \u274C CRITICAL: Cannot connect to dev server!
42
42
  Make sure your dev server is running at ${e}`):p.message.includes("Timeout")&&p.message.includes("waitFor")?new Error(`
43
43
  \u274C CRITICAL: Component not found on page!
44
- The component selector could not be found within ${d}ms.
44
+ The component selector could not be found within ${G}ms.
45
45
  This usually means:
46
46
  - The component didn't render
47
47
  - The URL is incorrect
@@ -51,32 +51,32 @@ This usually means:
51
51
  This usually means:
52
52
  - The test timeout was too short
53
53
  - The browser crashed
54
- - An external process killed the browser`):p}finally{h&&await h.close()}return{passes:g,failures:x,skipped:T,warnings:L}}var De,Be,Or,Bt=Q(()=>{"use strict";De=require("fs"),Be=ne(require("path"),1);Ne();Lt();Rt();Pt();It();je();Or={}});var Ft={};ce(Ft,{BADGE_CONFIGS:()=>Qe,displayAllBadges:()=>jr,displayBadgeInfo:()=>_r,getBadgeMarkdown:()=>he,promptAddBadge:()=>Ur});function he(s){let e=Qe[s];return`[![${e.label}](${e.markdownUrl})](https://github.com/aria-ease/aria-ease)`}function _r(s){let e=he(s);console.log(Y.default.cyan(`
55
- \u{1F3C5} Show your accessibility commitment!`)),console.log(Y.default.white(` Add this badge to your README.md:
56
- `)),console.log(Y.default.green(" "+e)),console.log(Y.default.dim(`
54
+ - An external process killed the browser`):p}finally{b&&await b.close()}return{passes:m,failures:x,skipped:A,warnings:L}}var Be,Ve,ts,Kt=Y(()=>{"use strict";Be=require("fs"),Ve=ne(require("path"),1);je();Ft();Ot();Ut();Nt();Ke();ts={}});var Jt={};oe(Jt,{BADGE_CONFIGS:()=>tt,displayAllBadges:()=>is,displayBadgeInfo:()=>rs,getBadgeMarkdown:()=>ye,promptAddBadge:()=>ss});function ye(t){let e=tt[t];return`[![${e.label}](${e.markdownUrl})](https://github.com/aria-ease/aria-ease)`}function rs(t){let e=ye(t);console.log(Q.default.cyan(`
55
+ \u{1F3C5} Show your accessibility commitment!`)),console.log(Q.default.white(` Add this badge to your README.md:
56
+ `)),console.log(Q.default.green(" "+e)),console.log(Q.default.dim(`
57
57
  This helps others discover accessibility tools and shows you care!
58
- `))}async function Ur(s,e=process.cwd()){let t=Vt.default.join(e,"README.md");if(!await Ve.default.pathExists(t)){console.log(Y.default.yellow(" \u2139\uFE0F No README.md found in current directory"));return}let n=await Ve.default.readFile(t,"utf-8"),i=he(s);if(n.includes(i)||n.includes(Qe[s].fileName)){console.log(Y.default.gray(" \u2713 Badge already in README.md"));return}let a=qt.default.createInterface({input:process.stdin,output:process.stdout}),o=await new Promise(u=>{a.question(Y.default.cyan(" Add badge to README.md now? (y/n): "),l=>{a.close(),u(l.toLowerCase().trim())})});o==="y"||o==="yes"?(await Nr(t,n,i),console.log(Y.default.green(" \u2713 Badge added to README.md!"))):console.log(Y.default.gray(" Skipped. You can add it manually anytime."))}async function Nr(s,e,t){let r=e.split(`
59
- `),n=0;for(let i=0;i<r.length;i++){let a=r[i].trim();if(a.startsWith("[![")||a.startsWith("[!")){n=i+1;continue}if(n>0&&!a.startsWith("[![")&&!a.startsWith("[!")&&a.length>0)break;if(n===0&&a.startsWith("#")){n=i+2;break}}n===0&&(n=1),r.splice(n,0,t),await Ve.default.writeFile(s,r.join(`
60
- `),"utf-8")}function jr(){console.log(Y.default.cyan(`
61
- \u{1F4CD} Available badges:`)),console.log(Y.default.white(`
62
- For audits:`)),console.log(Y.default.green(" "+he("audit"))),console.log(Y.default.white(`
63
- For component testing:`)),console.log(Y.default.green(" "+he("component"))),console.log(Y.default.white(`
64
- For both (verified):`)),console.log(Y.default.green(" "+he("verified"))),console.log("")}var Ve,Vt,Y,qt,Qe,Ot=Q(()=>{"use strict";Ve=ne(require("fs-extra"),1),Vt=ne(require("path"),1),Y=ne(require("chalk"),1),qt=ne(require("readline"),1),Qe={audit:{type:"audit",fileName:"audited-by-aria-ease.svg",label:"Audited by aria-ease",markdownUrl:"https://cdn.jsdelivr.net/gh/aria-ease/aria-ease@main/badges/audited-by-aria-ease.svg"},component:{type:"component",fileName:"components-tested-aria-ease.svg",label:"Components tested: aria-ease",markdownUrl:"https://cdn.jsdelivr.net/gh/aria-ease/aria-ease@main/badges/components-tested-aria-ease.svg"},verified:{type:"verified",fileName:"verified-by-aria-ease.svg",label:"Verified by aria-ease",markdownUrl:"https://cdn.jsdelivr.net/gh/aria-ease/aria-ease@main/badges/verified-by-aria-ease.svg"}}});var Kr={};ce(Kr,{cleanupTests:()=>et,createContract:()=>Rr,makeAccordionAccessible:()=>Xt,makeBlockAccessible:()=>Zt,makeCheckboxAccessible:()=>er,makeComboboxAccessible:()=>sr,makeMenuAccessible:()=>at,makeRadioAccessible:()=>tr,makeTabsAccessible:()=>nr,makeToggleAccessible:()=>rr,testUiComponent:()=>Ze});module.exports=Gt(Kr);function Xt({accordionId:s,triggersClass:e,panelsClass:t,allowMultipleOpen:r=!1,callback:n}){if(s==="")return console.error("[aria-ease] 'accordionId' should not be an empty string. Provide an id to the accordion container element that exists before calling makeAccordionAccessible."),{cleanup:()=>{}};let i=document.querySelector(`#${s}`);if(!i)return console.error(`[aria-ease] Element with id="${s}" not found. Make sure the accordion container exists before calling makeAccordionAccessible.`),{cleanup:()=>{}};if(e==="")return console.error("[aria-ease] 'triggersClass' should not be an empty string. Provide a class name that exists on the accordion trigger elements before calling makeAccordionAccessible."),{cleanup:()=>{}};let a=Array.from(i.querySelectorAll(`.${e}`));if(a.length===0)return console.error(`[aria-ease] No elements with class="${e}" found. Make sure accordion triggers exist before calling makeAccordionAccessible.`),{cleanup:()=>{}};if(t==="")return console.error("[aria-ease] 'panelsClass' should not be an empty string. Provide a class name that exists on the accordion panel elements before calling makeAccordionAccessible."),{cleanup:()=>{}};let o=Array.from(i.querySelectorAll(`.${t}`));if(o.length===0)return console.error(`[aria-ease] No elements with class="${t}" found. Make sure accordion panels exist before calling makeAccordionAccessible.`),{cleanup:()=>{}};if(a.length!==o.length)return console.error(`[aria-ease] Accordion trigger/panel mismatch: found ${a.length} triggers but ${o.length} panels.`),{cleanup:()=>{}};let u=new WeakMap,l=new WeakMap;function f(){a.forEach((E,k)=>{let F=o[k];E.id||(E.id=`${s}-trigger-${k}`),F.id||(F.id=`${s}-panel-${k}`),E.setAttribute("aria-controls",F.id),E.setAttribute("aria-expanded","false"),(!r||a.length<=6)&&F.setAttribute("role","region"),F.setAttribute("aria-labelledby",E.id),F.style.display="none"})}function b(E){if(E<0||E>=a.length){console.error(`[aria-ease] Invalid accordion index: ${E}`);return}let k=a[E],F=o[E];if(k.setAttribute("aria-expanded","true"),F.style.display="block",n?.onExpand)try{n.onExpand(E)}catch(v){console.error("[aria-ease] Error in accordion onExpand callback:",v)}}function w(E){if(E<0||E>=a.length){console.error(`[aria-ease] Invalid accordion index: ${E}`);return}let k=a[E],F=o[E];if(k.setAttribute("aria-expanded","false"),F.style.display="none",n?.onCollapse)try{n.onCollapse(E)}catch(v){console.error("[aria-ease] Error in accordion onCollapse callback:",v)}}function H(E){a[E].getAttribute("aria-expanded")==="true"?w(E):(r||a.forEach((v,x)=>{x!==E&&w(x)}),b(E))}function q(E){return()=>{H(E)}}function N(E){return k=>{let{key:F}=k;switch(F){case"Enter":case" ":k.preventDefault(),H(E);break;case"ArrowDown":k.preventDefault();{let v=(E+1)%a.length;a[v].focus()}break;case"ArrowUp":k.preventDefault();{let v=(E-1+a.length)%a.length;a[v].focus()}break;case"Home":k.preventDefault(),a[0].focus();break;case"End":k.preventDefault(),a[a.length-1].focus();break}}}function d(){a.forEach((E,k)=>{let F=q(k),v=N(k);E.addEventListener("click",F),E.addEventListener("keydown",v),u.set(E,v),l.set(E,F)})}function m(){a.forEach(E=>{let k=u.get(E),F=l.get(E);k&&(E.removeEventListener("keydown",k),u.delete(E)),F&&(E.removeEventListener("click",F),l.delete(E))})}function $(){m(),a.forEach((E,k)=>{w(k)})}function O(){m();let E=Array.from(i.querySelectorAll(`.${e}`)),k=Array.from(i.querySelectorAll(`.${t}`));a.length=0,a.push(...E),o.length=0,o.push(...k),f(),d()}return f(),d(),{expandItem:b,collapseItem:w,toggleItem:H,cleanup:$,refresh:O}}function Me(s){if(s.tagName!=="INPUT")return!1;let e=s.type;return["text","email","password","tel","number"].includes(e)}function Se(s){return s.tagName==="TEXTAREA"}function it(s){return s.tagName==="BUTTON"||s.tagName==="INPUT"&&["button","submit","reset"].includes(s.type)}function Yt(s){return s.tagName==="A"}function xe(s,e,t){let r=s.length,n=(e+t+r)%r;s.item(n).focus()}function Qt(s){return s.getAttribute("data-custom-click")!==null&&s.getAttribute("data-custom-click")!==void 0}function ot(s,e,t){let r=e.item(t);switch(s.key){case"ArrowUp":case"ArrowLeft":{(!Me(r)&&!Se(r)||(Me(r)||Se(r))&&r.selectionStart===0)&&(s.preventDefault(),xe(e,t,-1));break}case"ArrowDown":case"ArrowRight":{if(!Me(r)&&!Se(r))s.preventDefault(),xe(e,t,1);else if(Me(r)||Se(r)){let n=r.value;r.selectionStart===n.length&&(s.preventDefault(),xe(e,t,1))}break}case"Escape":{s.preventDefault();break}case"Enter":case" ":{(!it(r)&&!Yt(r)&&Qt(r)||it(r))&&(s.preventDefault(),r.click());break}case"Tab":break;default:break}}function Zt({blockId:s,blockItemsClass:e}){if(s==="")return console.error("[aria-ease] 'blockId' should not be an empty string. Provide an id to the block container element that exists before calling makeBlockAccessible."),{cleanup:()=>{}};let t=document.querySelector(`#${s}`);if(!t)return console.error(`[aria-ease] Element with id="${s}" not found. Make sure the block element exists before calling makeBlockAccessible.`),{cleanup:()=>{}};if(e==="")return console.error("[aria-ease] 'blockItemsClass' should not be an empty string. Provide a class name that exists on the block item elements before calling makeBlockAccessible."),{cleanup:()=>{}};let r=null;function n(){return r||(r=t.querySelectorAll(`.${e}`)),r}let i=n();if(!i||i.length===0)return console.error(`[aria-ease] Element with class="${e}" not found. Make sure the block items exist before calling makeBlockAccessible.`),{cleanup:()=>{}};let a=new Map;i.forEach(l=>{if(!a.has(l)){let f=b=>{let w=t.querySelectorAll(`.${e}`),H=Array.prototype.indexOf.call(w,l);ot(b,w,H)};l.addEventListener("keydown",f),a.set(l,f)}});function o(){i.forEach(l=>{let f=a.get(l);f&&(l.removeEventListener("keydown",f),a.delete(l))})}function u(){r=null}return{cleanup:o,refresh:u}}function er({checkboxGroupId:s,checkboxesClass:e}){if(s==="")return console.error("[aria-ease] 'checkboxGroupId' should not be an empty string. Provide an id to the checkbox group container element that exists before calling makeCheckboxAccessible."),{cleanup:()=>{}};let t=document.querySelector(`#${s}`);if(!t)return console.error(`[aria-ease] Element with id="${s}" not found. Make sure the checkbox group container exists before calling makeCheckboxAccessible.`),{cleanup:()=>{}};if(e==="")return console.error("[aria-ease] 'checkboxesClass' should not be an empty string. Provide a class name that exists on the checkbox elements before calling makeCheckboxAccessible."),{cleanup:()=>{}};let r=Array.from(t.querySelectorAll(`.${e}`));if(r.length===0)return console.error(`[aria-ease] No elements with class="${e}" found. Make sure checkboxes exist before calling makeCheckboxAccessible.`),{cleanup:()=>{}};let n=new WeakMap,i=new WeakMap;function a(){t.getAttribute("role")||t.setAttribute("role","group"),r.forEach(d=>{d.setAttribute("role","checkbox"),d.hasAttribute("aria-checked")||d.setAttribute("aria-checked","false"),d.hasAttribute("tabindex")||d.setAttribute("tabindex","0")})}function o(d){if(d<0||d>=r.length){console.error(`[aria-ease] Invalid checkbox index: ${d}`);return}let m=r[d],$=m.getAttribute("aria-checked")==="true";m.setAttribute("aria-checked",$?"false":"true")}function u(d,m){if(d<0||d>=r.length){console.error(`[aria-ease] Invalid checkbox index: ${d}`);return}r[d].setAttribute("aria-checked",m?"true":"false")}function l(d){return()=>{o(d)}}function f(d){return m=>{let{key:$}=m;switch($){case" ":m.preventDefault(),o(d);break}}}function b(){r.forEach((d,m)=>{let $=l(m),O=f(m);d.addEventListener("click",$),d.addEventListener("keydown",O),n.set(d,O),i.set(d,$)})}function w(){r.forEach(d=>{let m=n.get(d),$=i.get(d);m&&(d.removeEventListener("keydown",m),n.delete(d)),$&&(d.removeEventListener("click",$),i.delete(d))})}function H(){w()}function q(){return r.map(d=>d.getAttribute("aria-checked")==="true")}function N(){return r.map((d,m)=>d.getAttribute("aria-checked")==="true"?m:-1).filter(d=>d!==-1)}return a(),b(),{toggleCheckbox:o,setCheckboxState:u,getCheckedStates:q,getCheckedIndices:N,cleanup:H}}function at({menuId:s,menuItemsClass:e,triggerId:t,callback:r}){if(s==="")return console.error("[aria-ease] 'menuId' should not be an empty string. Provide an id of the menu element before calling makeMenuAccessible."),{openMenu:()=>{},closeMenu:()=>{},cleanup:()=>{}};let n=document.querySelector(`#${s}`);if(!n)return console.error(`[aria-ease] Element with id="${s}" not found. Make sure the menu element exists before calling makeMenuAccessible.`),{openMenu:()=>{},closeMenu:()=>{},cleanup:()=>{}};if(t==="")return console.error("[aria-ease] 'triggerId' should not be an empty string. Provide an id of the trigger button element before calling makeMenuAccessible."),{openMenu:()=>{},closeMenu:()=>{},cleanup:()=>{}};let i=document.querySelector(`#${t}`);if(!i)return console.error(`[aria-ease] Element with id="${t}" not found. Make sure the trigger button element exists before calling makeMenuAccessible.`),{openMenu:()=>{},closeMenu:()=>{},cleanup:()=>{}};if(e==="")return console.error("[aria-ease] 'menuItemsClass' should not be an empty string. Provide a class name to at least a menu item that exists before calling makeMenuAccessible."),{openMenu:()=>{},closeMenu:()=>{},cleanup:()=>{}};if(!/^[\w-]+$/.test(s))return console.error("[aria-ease] Invalid menuId: must be alphanumeric"),{openMenu:()=>{},closeMenu:()=>{},cleanup:()=>{}};i.setAttribute("aria-haspopup","true"),i.setAttribute("aria-controls",s),i.setAttribute("aria-expanded","false"),n.setAttribute("role","menu"),n.setAttribute("aria-labelledby",t);let a=new WeakMap,o=new Map,u=null,l=null;function f(){return u||(u=n.querySelectorAll(`.${e}`)),u}function b(){if(!l){let p=f();l=[];for(let y=0;y<p.length;y++){let C=p.item(y),B=O(C),G=C.getAttribute("aria-disabled")==="true";B||(C.hasAttribute("tabindex")||C.setAttribute("tabindex","-1"),G||l.push(C))}}return l}function w(p){return{length:p.length,item:C=>p[C],forEach:C=>{p.forEach(C)},[Symbol.iterator]:function*(){for(let C of p)yield C}}}function H(){f().forEach(y=>{y.setAttribute("role","menuitem");let C=y.getAttribute("data-submenu-id")??y.getAttribute("aria-controls"),B=y.hasAttribute("aria-haspopup")&&C;C&&(y.hasAttribute("data-submenu-id")||B)&&(y.setAttribute("aria-haspopup","menu"),y.setAttribute("aria-controls",C),y.hasAttribute("aria-expanded")||y.setAttribute("aria-expanded","false"))})}function q(p,y,C){let B=p.length,G=(y+C+B)%B;p.item(G).focus()}function N(p,y){p.length!==0&&p[y]?.focus()}function d(p){return p.hasAttribute("aria-controls")&&p.hasAttribute("aria-haspopup")&&p.getAttribute("role")==="menuitem"}function m(p){let y=p;for(;y&&y.getAttribute("role")==="menuitem";){let C=y.closest('[role="menu"]');if(!C)break;C.style.display="none",y.setAttribute("aria-expanded","false");let B=C.getAttribute("aria-labelledby");if(!B)break;let G=document.getElementById(B);if(!G)break;y=G}}H();function $(p,y,C){switch(p.key){case"ArrowLeft":{if(p.key==="ArrowLeft"&&i.getAttribute("role")==="menuitem"){p.preventDefault(),g();return}break}case"ArrowUp":{p.preventDefault(),q(w(b()),C,-1);break}case"ArrowRight":{if(p.key==="ArrowRight"&&d(y)){p.preventDefault();let B=y.getAttribute("aria-controls");if(B){k(B);return}}break}case"ArrowDown":{p.preventDefault(),q(w(b()),C,1);break}case"Home":{p.preventDefault(),N(b(),0);break}case"End":{p.preventDefault();let B=b();N(B,B.length-1);break}case"Escape":{p.preventDefault(),g(),i.focus(),F&&F(!1);break}case"Enter":case" ":{if(p.preventDefault(),d(y)){let B=y.getAttribute("aria-controls");if(B){k(B);return}}y.click(),g(),F&&F(!1);break}case"Tab":{g(),m(i),F&&F(!1);break}default:break}}function O(p){let y=p.parentElement;for(;y&&y!==n;){if(y.getAttribute("role")==="menu"||y.id&&n.querySelector(`[aria-controls="${y.id}"]`))return!0;y=y.parentElement}return!1}function E(p){i.setAttribute("aria-expanded",p?"true":"false")}function k(p){let y=o.get(p);if(!y){let C=n.querySelector(`[aria-controls="${p}"]`);if(!C){console.error(`[aria-ease] Submenu trigger with aria-controls="${p}" not found in menu "${s}".`);return}if(!C.id){let G=`trigger-${p}`;C.id=G,console.warn(`[aria-ease] Submenu trigger for "${p}" had no ID. Auto-generated ID: "${G}".`)}if(!document.querySelector(`#${p}`)){console.error(`[aria-ease] Submenu element with id="${p}" not found. Cannot create submenu instance.`);return}y=at({menuId:p,menuItemsClass:e,triggerId:C.id,callback:r}),o.set(p,y)}y.openMenu()}function F(p){if(r?.onOpenChange)try{r.onOpenChange(p)}catch(y){console.error("[aria-ease] Error in menu onOpenChange callback:",y)}}function v(){b().forEach((y,C)=>{if(!a.has(y)){let B=G=>$(G,y,C);y.addEventListener("keydown",B),a.set(y,B)}})}function x(){b().forEach(y=>{let C=a.get(y);C&&(y.removeEventListener("keydown",C),a.delete(y))})}function L(){E(!0),n.style.display="block";let p=b();if(v(),p&&p.length>0&&p[0].focus(),r?.onOpenChange)try{r.onOpenChange(!0)}catch(y){console.error("[aria-ease] Error in menu onOpenChange callback:",y)}}function g(){if(o.forEach(p=>p.closeMenu()),E(!1),n.style.display="none",x(),i.focus(),r?.onOpenChange)try{r.onOpenChange(!1)}catch(p){console.error("[aria-ease] Error in menu onOpenChange callback:",p)}}function T(){i.getAttribute("aria-expanded")==="true"?g():L()}function h(p){if(!(i.getAttribute("aria-expanded")==="true"))return;let C=i.contains(p.target),B=n.contains(p.target);!C&&!B&&g()}i.addEventListener("click",T),document.addEventListener("click",h);function D(){x(),i.removeEventListener("click",T),document.removeEventListener("click",h),n.style.display="none",E(!1),o.forEach(p=>p.cleanup()),o.clear()}function Z(){u=null,l=null}return{openMenu:L,closeMenu:g,cleanup:D,refresh:Z}}function tr({radioGroupId:s,radiosClass:e,defaultSelectedIndex:t=0}){if(s==="")return console.error("[aria-ease] 'radioGroupId' should not be an empty string. Provide an id to the radio group container element that exists before calling makeRadioAccessible."),{cleanup:()=>{}};let r=document.querySelector(`#${s}`);if(!r)return console.error(`[aria-ease] Element with id="${s}" not found. Make sure the radio group container exists before calling makeRadioAccessible.`),{cleanup:()=>{}};if(e==="")return console.error("[aria-ease] 'radiosClass' should not be an empty string. Provide a class name that exists on the radio button elements before calling makeRadioAccessible."),{cleanup:()=>{}};let n=Array.from(r.querySelectorAll(`.${e}`));if(n.length===0)return console.error(`[aria-ease] No elements with class="${e}" found. Make sure radio buttons exist before calling makeRadioAccessible.`),{cleanup:()=>{}};let i=new WeakMap,a=new WeakMap,o=t;function u(){r.getAttribute("role")||r.setAttribute("role","radiogroup"),n.forEach((d,m)=>{d.setAttribute("role","radio"),d.setAttribute("tabindex",m===o?"0":"-1"),m===o?d.setAttribute("aria-checked","true"):d.setAttribute("aria-checked","false")})}function l(d){if(d<0||d>=n.length){console.error(`[aria-ease] Invalid radio index: ${d}`);return}o>=0&&o<n.length&&(n[o].setAttribute("aria-checked","false"),n[o].setAttribute("tabindex","-1")),n[d].setAttribute("aria-checked","true"),n[d].setAttribute("tabindex","0"),n[d].focus(),o=d}function f(d){return()=>{l(d)}}function b(d){return m=>{let{key:$}=m,O=d;switch($){case"ArrowDown":case"ArrowRight":m.preventDefault(),O=(d+1)%n.length,l(O);break;case"ArrowUp":case"ArrowLeft":m.preventDefault(),O=(d-1+n.length)%n.length,l(O);break;case" ":case"Enter":m.preventDefault(),l(d);break}}}function w(){n.forEach((d,m)=>{let $=f(m),O=b(m);d.addEventListener("click",$),d.addEventListener("keydown",O),i.set(d,O),a.set(d,$)})}function H(){n.forEach(d=>{let m=i.get(d),$=a.get(d);m&&(d.removeEventListener("keydown",m),i.delete(d)),$&&(d.removeEventListener("click",$),a.delete(d))})}function q(){H()}function N(){return o}return u(),w(),{selectRadio:l,getSelectedIndex:N,cleanup:q}}function rr({toggleId:s,togglesClass:e,isSingleToggle:t=!0}){if(s==="")return console.error("[aria-ease] 'toggleId' should not be an empty string. Provide an id to the toggle element or toggle container before calling makeToggleAccessible."),{cleanup:()=>{}};let r=document.querySelector(`#${s}`);if(!r)return console.error(`[aria-ease] Element with id="${s}" not found. Make sure the toggle element exists before calling makeToggleAccessible.`),{cleanup:()=>{}};let n;if(t)n=[r];else{if(!e)return console.error("[aria-ease] togglesClass is required when isSingleToggle is false."),{cleanup:()=>{}};if(n=Array.from(r.querySelectorAll(`.${e}`)),n.length===0)return console.error(`[aria-ease] No elements with class="${e}" found. Make sure toggle buttons exist before calling makeToggleAccessible.`),{cleanup:()=>{}}}let i=new WeakMap,a=new WeakMap;function o(){n.forEach(m=>{m.tagName.toLowerCase()!=="button"&&!m.getAttribute("role")&&m.setAttribute("role","button"),m.hasAttribute("aria-pressed")||m.setAttribute("aria-pressed","false"),m.hasAttribute("tabindex")||m.setAttribute("tabindex","0")})}function u(m){if(m<0||m>=n.length){console.error(`[aria-ease] Invalid toggle index: ${m}`);return}let $=n[m],O=$.getAttribute("aria-pressed")==="true";$.setAttribute("aria-pressed",O?"false":"true")}function l(m,$){if(m<0||m>=n.length){console.error(`[aria-ease] Invalid toggle index: ${m}`);return}n[m].setAttribute("aria-pressed",$?"true":"false")}function f(m){return()=>{u(m)}}function b(m){return $=>{let{key:O}=$;switch(O){case"Enter":case" ":$.preventDefault(),u(m);break}}}function w(){n.forEach((m,$)=>{let O=f($),E=b($);m.addEventListener("click",O),m.addEventListener("keydown",E),i.set(m,E),a.set(m,O)})}function H(){n.forEach(m=>{let $=i.get(m),O=a.get(m);$&&(m.removeEventListener("keydown",$),i.delete(m)),O&&(m.removeEventListener("click",O),a.delete(m))})}function q(){H()}function N(){return n.map(m=>m.getAttribute("aria-pressed")==="true")}function d(){return n.map((m,$)=>m.getAttribute("aria-pressed")==="true"?$:-1).filter(m=>m!==-1)}return o(),w(),{toggleButton:u,setPressed:l,getPressedStates:N,getPressedIndices:d,cleanup:q}}function sr({comboboxInputId:s,comboboxButtonId:e,listBoxId:t,listBoxItemsClass:r,callback:n}){if(s==="")return console.error("[aria-ease] 'comboboxInputId' should not be an empty string. Provide an id to the combobox input element that exists before calling makeComboboxAccessible."),{cleanup:()=>{}};let i=document.getElementById(`${s}`);if(!i)return console.error(`[aria-ease] Element with id="${s}" not found. Make sure the combobox input element exists before calling makeComboboxAccessible.`),{cleanup:()=>{}};if(t==="")return console.error("[aria-ease] 'listBoxId' should not be an empty string. Provide an id to the combobox listbox element that exists before calling makeComboboxAccessible."),{cleanup:()=>{}};let a=document.getElementById(`${t}`);if(!a)return console.error(`[aria-ease] Element with id="${t}" not found. Make sure the combobox listbox element exists before calling makeComboboxAccessible.`),{cleanup:()=>{}};if(r==="")return console.error("[aria-ease] 'listboxItemsClass' class should not be an empty string. Provide a class name to at least a listbox option that exists before calling makeComboboxAccessible."),{cleanup:()=>{}};if(!document.querySelectorAll(r))return console.error(`[aria-ease] Listbox option(s) with class="${r}" not found. Make sure at least a combobox listbox option exists before calling makeComboboxAccessible.`),{cleanup:()=>{}};let u=e?document.getElementById(`${e}`):null,l=-1;i.setAttribute("role","combobox"),i.setAttribute("aria-autocomplete","list"),i.setAttribute("aria-controls",t),i.setAttribute("aria-expanded","false"),i.setAttribute("aria-haspopup","listbox"),a.setAttribute("role","listbox");let f=null;function b(){return f||(f=a.querySelectorAll(`.${r}`)),Array.from(f).filter(g=>!g.hidden&&g.style.display!=="none")}function w(){return i.getAttribute("aria-expanded")==="true"}function H(g){let T=b();if(g>=0&&g<T.length){let h=T[g],D=h.id||`${t}-option-${g}`;if(h.id||(h.id=D),i.setAttribute("aria-activedescendant",D),typeof h.scrollIntoView=="function"&&h.scrollIntoView({block:"nearest",behavior:"smooth"}),n?.onActiveDescendantChange)try{n.onActiveDescendantChange(D,h)}catch(Z){console.error("[aria-ease] Error in combobox onActiveDescendantChange callback:",Z)}}else i.setAttribute("aria-activedescendant","");l=g}function q(){if(i.setAttribute("aria-expanded","true"),a.style.display="block",n?.onOpenChange)try{n.onOpenChange(!0)}catch(g){console.error("[aria-ease] Error in combobox onOpenChange callback:",g)}}function N(){if(i.setAttribute("aria-expanded","false"),i.setAttribute("aria-activedescendant",""),a.style.display="none",l=-1,n?.onOpenChange)try{n.onOpenChange(!1)}catch(g){console.error("[aria-ease] Error in combobox onOpenChange callback:",g)}}function d(g){let T=g.textContent?.trim()||"";if(i.value=T,g.setAttribute("aria-selected","true"),N(),n?.onSelect)try{n.onSelect(g)}catch(h){console.error("[aria-ease] Error in combobox onSelect callback:",h)}}function m(g){let T=b(),h=w();switch(g.key){case"ArrowDown":if(g.preventDefault(),!h){q();return}if(T.length===0)return;{let D=l>=T.length-1?0:l+1;H(D)}break;case"ArrowUp":if(g.preventDefault(),!h)return;if(T.length>0){let D=l<=0?T.length-1:l-1;H(D)}break;case"Enter":h&&l>=0&&l<T.length&&(g.preventDefault(),d(T[l]));break;case"Escape":if(h)g.preventDefault(),N();else if(i.value&&(g.preventDefault(),i.value="",i.setAttribute("aria-activedescendant",""),b().forEach(Z=>{Z.getAttribute("aria-selected")==="true"&&Z.setAttribute("aria-selected","false")}),n?.onClear))try{n.onClear()}catch(Z){console.error("[aria-ease] Error in combobox onClear callback:",Z)}break;case"Home":h&&T.length>0&&(g.preventDefault(),H(0));break;case"End":h&&T.length>0&&(g.preventDefault(),H(T.length-1));break;case"Tab":h&&l>=0&&l<T.length&&d(T[l]),h&&N();break}}function $(g){let T=g.target;if(T.classList.contains(r)){let D=b().indexOf(T);D>=0&&H(D)}}function O(g){let T=g.target;T.classList.contains(r)&&(g.preventDefault(),d(T))}function E(g){let T=g.target;!i.contains(T)&&!a.contains(T)&&(!u||!u.contains(T))&&N()}function k(){w()?N():(q(),i.focus())}function F(g){(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),k())}i.addEventListener("keydown",m),a.addEventListener("mousemove",$),a.addEventListener("mousedown",O),document.addEventListener("mousedown",E),u&&(u.setAttribute("tabindex","-1"),u.setAttribute("aria-label","Toggle options"),u.addEventListener("click",k),u.addEventListener("keydown",F));function v(){let g=a.querySelectorAll(`.${r}`);if(g.length===0)return;let T=null;for(let h of g)if(h.getAttribute("aria-selected")==="true"){T=h.textContent?.trim()||null;break}!T&&i.value&&(T=i.value.trim()),g.forEach((h,D)=>{h.setAttribute("role","option");let Z=h.textContent?.trim()||"";T&&Z===T?h.setAttribute("aria-selected","true"):h.setAttribute("aria-selected","false");let p=h.getAttribute("id");if(!p||p===""){let y=`${t}-option-${D}`;h.id=y,h.setAttribute("id",y)}})}v();function x(){i.removeEventListener("keydown",m),a.removeEventListener("mousemove",$),a.removeEventListener("mousedown",O),document.removeEventListener("mousedown",E),u&&(u.removeEventListener("click",k),u.removeEventListener("keydown",F))}function L(){f=null,v(),l=-1,H(-1)}return{cleanup:x,refresh:L,openListbox:q,closeListbox:N}}function nr({tabListId:s,tabsClass:e,tabPanelsClass:t,orientation:r="horizontal",activateOnFocus:n=!0,callback:i}){if(s==="")return console.error("[aria-ease] 'tabListId' should not be an empty string. Provide an id to the tab list container element that exists before calling makeTabsAccessible."),{cleanup:()=>{}};let a=document.querySelector(`#${s}`);if(!a)return console.error(`[aria-ease] Element with id="${s}" not found. Make sure the tab list container exists before calling makeTabsAccessible.`),{cleanup:()=>{}};if(e==="")return console.error("[aria-ease] 'tabsClass' should not be an empty string. Provide a class name that exists on the tab button elements before calling makeTabsAccessible."),{cleanup:()=>{}};let o=Array.from(a.querySelectorAll(`.${e}`));if(o.length===0)return console.error(`[aria-ease] No elements with class="${e}" found. Make sure tab buttons exist before calling makeTabsAccessible.`),{cleanup:()=>{}};if(t==="")return console.error("[aria-ease] 'tabPanelsClass' should not be an empty string. Provide a class name that exists on the tab panel elements before calling makeTabsAccessible."),{cleanup:()=>{}};let u=Array.from(document.querySelectorAll(`.${t}`));if(u.length===0)return console.error(`[aria-ease] No elements with class="${t}" found. Make sure tab panels exist before calling makeTabsAccessible.`),{cleanup:()=>{}};if(o.length!==u.length)return console.error(`[aria-ease] Tab/panel mismatch: found ${o.length} tabs but ${u.length} panels.`),{cleanup:()=>{}};let l=new WeakMap,f=new WeakMap,b=new WeakMap,w=0;function H(){a.setAttribute("role","tablist"),a.setAttribute("aria-orientation",r),o.forEach((v,x)=>{let L=u[x];v.id||(v.id=`${s}-tab-${x}`),L.id||(L.id=`${s}-panel-${x}`),v.setAttribute("role","tab"),v.setAttribute("aria-controls",L.id),v.setAttribute("aria-selected","false"),v.setAttribute("tabindex","-1"),L.setAttribute("role","tabpanel"),L.setAttribute("aria-labelledby",v.id),L.hidden=!0,L.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')||L.setAttribute("tabindex","0")}),q(0,!1)}function q(v,x=!0){if(v<0||v>=o.length){console.error(`[aria-ease] Invalid tab index: ${v}`);return}let L=w;o.forEach((h,D)=>{let Z=u[D];h.setAttribute("aria-selected","false"),h.setAttribute("tabindex","-1"),Z.hidden=!0});let g=o[v],T=u[v];if(g.setAttribute("aria-selected","true"),g.setAttribute("tabindex","0"),T.hidden=!1,x&&g.focus(),w=v,i?.onTabChange&&L!==v)try{i.onTabChange(v,L)}catch(h){console.error("[aria-ease] Error in tabs onTabChange callback:",h)}}function N(v){let x=o.findIndex(T=>T===document.activeElement),L=x!==-1?x:w,g=L;switch(v){case"first":g=0;break;case"last":g=o.length-1;break;case"next":g=(L+1)%o.length;break;case"prev":g=(L-1+o.length)%o.length;break}if(o[g].focus(),o[g].setAttribute("tabindex","0"),o[w].setAttribute("tabindex","-1"),n)q(g,!1);else{let T=w;o.forEach((h,D)=>{D===g?h.setAttribute("tabindex","0"):D!==T&&h.setAttribute("tabindex","-1")})}}function d(v){return()=>{q(v)}}function m(v){return x=>{let{key:L}=x,g=!1;if(r==="horizontal")switch(L){case"ArrowLeft":x.preventDefault(),N("prev"),g=!0;break;case"ArrowRight":x.preventDefault(),N("next"),g=!0;break}else switch(L){case"ArrowUp":x.preventDefault(),N("prev"),g=!0;break;case"ArrowDown":x.preventDefault(),N("next"),g=!0;break}if(!g)switch(L){case"Home":x.preventDefault(),N("first");break;case"End":x.preventDefault(),N("last");break;case" ":case"Enter":n||(x.preventDefault(),q(v));break;case"F10":if(x.shiftKey&&i?.onContextMenu){x.preventDefault();try{i.onContextMenu(v,o[v])}catch(T){console.error("[aria-ease] Error in tabs onContextMenu callback:",T)}}break}}}function $(v){return x=>{if(i?.onContextMenu){x.preventDefault();try{i.onContextMenu(v,o[v])}catch(L){console.error("[aria-ease] Error in tabs onContextMenu callback:",L)}}}}function O(){o.forEach((v,x)=>{let L=d(x),g=m(x),T=$(x);v.addEventListener("click",L),v.addEventListener("keydown",g),i?.onContextMenu&&(v.addEventListener("contextmenu",T),b.set(v,T)),l.set(v,g),f.set(v,L)})}function E(){o.forEach(v=>{let x=l.get(v),L=f.get(v),g=b.get(v);x&&(v.removeEventListener("keydown",x),l.delete(v)),L&&(v.removeEventListener("click",L),f.delete(v)),g&&(v.removeEventListener("contextmenu",g),b.delete(v))})}function k(){E(),o.forEach((v,x)=>{let L=u[x];v.removeAttribute("role"),v.removeAttribute("aria-selected"),v.removeAttribute("aria-controls"),v.removeAttribute("tabindex"),L.removeAttribute("role"),L.removeAttribute("aria-labelledby"),L.removeAttribute("tabindex"),L.hidden=!1}),a.removeAttribute("role"),a.removeAttribute("aria-orientation")}function F(){E();let v=Array.from(a.querySelectorAll(`.${e}`)),x=Array.from(document.querySelectorAll(`.${t}`));o.length=0,o.push(...v),u.length=0,u.push(...x),H(),O()}return H(),O(),{activateTab:q,cleanup:k,refresh:F}}var lt={"comboboxpopup.open":{setup:[{when:["keyboard","textInput","pointer"],steps:()=>[{type:"keypress",target:"input",key:"ArrowDown"}]},{when:["pointer"],steps:()=>[{type:"click",target:"button"}]}],assertion:ir},"comboboxpopup.closed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:[...or(),...ct()]},"main.focused":{setup:[{when:["keyboard","pointer"],steps:()=>[{type:"focus",target:"main"}]}],assertion:ur},"main.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:pr},"input.filled":{setup:[{when:["keyboard","textInput","pointer"],steps:()=>[{type:"type",target:"input",value:"test"}]}],assertion:fr},"input.empty":{setup:[{when:["keyboard","textInput","pointer"],steps:()=>[{type:"type",target:"input",value:""}]}],assertion:dr},"option.active":{requires:["comboboxpopup.open"],setup:[{when:["keyboard","pointer"],steps:(s={})=>typeof s.relativeTarget=="number"?Array.from({length:s.relativeTarget},()=>({type:"keypress",target:"main",key:"ArrowDown"})):s.relativeTarget==="first"?[{type:"keypress",target:"main",key:"ArrowDown"}]:s.relativeTarget==="last"?[{type:"keypress",target:"main",key:"ArrowDown"},{type:"keypress",target:"main",key:"ArrowUp"}]:[]}],assertion:(s={})=>ar(s.relativeTarget)},"activedescendant.set":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:cr},"activedescendant.unset":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:ct},"option.selected":{requires:["comboboxpopup.open"],setup:[{when:["keyboard"],steps:(s={})=>[{type:"keypress",target:"relative",key:"Enter",relativeTarget:s.relativeTarget}]},{when:["pointer"],steps:(s={})=>[{type:"click",target:"relative",relativeTarget:s.relativeTarget}]}],assertion:(s={})=>lr(s.relativeTarget)}};function ir(){return[{target:"popup",assertion:"toBeVisible",failureMessage:"Expected popup to be visible"},{target:"main",assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"true",failureMessage:"Expected combobox main to have aria-expanded='true'."}]}function or(){return[{target:"popup",assertion:"notToBeVisible",failureMessage:"Expected popup to be closed"},{target:"main",assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"false",failureMessage:"Expected combobox main to have aria-expanded='false'."}]}function ar(s){return[{target:"main",assertion:"toHaveAttribute",attribute:"aria-activedescendant",expectedValue:{ref:"relative",relativeTarget:s,property:"id"},failureMessage:"Expected aria-activedescendant on main to match the id of the first relative item."}]}function cr(){return[{target:"main",assertion:"toHaveAttribute",attribute:"aria-activedescendant",expectedValue:"!empty",failureMessage:"Expected aria-activedescendant on main to not be empty."}]}function ct(){return[{target:"main",assertion:"toHaveAttribute",attribute:"aria-activedescendant",expectedValue:"",failureMessage:"Expected aria-activedescendant on main to be empty."}]}function lr(s){return[{target:"relative",relativeTarget:s,assertion:"toHaveAttribute",attribute:"aria-selected",expectedValue:"true",failureMessage:`Expected ${s} item to have aria-selected='true'.`}]}function ur(){return[{target:"main",assertion:"toHaveFocus",failureMessage:"Expected main to be focused."}]}function pr(){return[{target:"main",assertion:"notToHaveFocus",failureMessage:"Expected main to not have focused."}]}function fr(){return[{target:"input",assertion:"toHaveValue",expectedValue:"test",failureMessage:"Expected input to have the value 'test'."}]}function dr(){return[{target:"input",assertion:"toHaveValue",expectedValue:"",failureMessage:"Expected input to have the value ''."}]}var ut={"menupopup.open":{setup:[{when:["keyboard"],steps:()=>[{type:"keypress",target:"main",key:"Enter"}]},{when:["pointer"],steps:()=>[{type:"click",target:"main"}]}],assertion:gr},"menupopup.closed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:mr},"main.focused":{setup:[{when:["keyboard","pointer"],steps:()=>[{type:"focus",target:"main"}]}],assertion:hr},"main.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:br},"menuitem.focused":{requires:["menupopup.open"],setup:[{when:["keyboard"],steps:(s={})=>[{type:"focus",target:"relative",relativeTarget:s.relativeTarget}]}],assertion:(s={})=>yr(s.relativeTarget)},"submenupopup.open":{requires:["menupopup.open"],setup:[{when:["keyboard"],steps:()=>[{type:"keypress",target:"submenuTrigger",key:"ArrowRight"}]},{when:["pointer"],steps:()=>[{type:"click",target:"submenuTrigger"}]}],assertion:vr},"submenupopup.closed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:wr},"submenutrigger.focused":{setup:[{when:["keyboard","pointer"],steps:()=>[{type:"focus",target:"submenuTrigger"}]}],assertion:kr},"submenutrigger.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:Tr},"submenuitem.focused":{requires:["submenupopup.open"],setup:[{when:["keyboard"],steps:(s={})=>{let e=[{type:"focus",target:"submenuTrigger"},{type:"keypress",target:"submenuTrigger",key:"ArrowRight"}];return typeof s.relativeTarget=="number"&&(e=e.concat(Array.from({length:s.relativeTarget},()=>({type:"keypress",target:"submenuItems",key:"ArrowDown"})))),s.relativeTarget==="first"&&(e=e.concat({type:"keypress",target:"submenuItems",key:"ArrowDown"})),s.relativeTarget==="last"&&(e=e.concat({type:"keypress",target:"submenuItems",key:"ArrowUp"})),e}},{when:["pointer"],steps:(s={})=>[{type:"click",target:"submenuTrigger"},{type:"click",target:"relative",relativeTarget:s.relativeTarget}]}],assertion:(s={})=>Ar(s.relativeTarget)}};function gr(){return[{target:"popup",assertion:"toBeVisible",failureMessage:"Expected popup to be visible"},{target:"main",assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"true",failureMessage:"Expected menu main to have aria-expanded='true'."}]}function mr(){return[{target:"popup",assertion:"notToBeVisible",failureMessage:"Expected popup to be closed"},{target:"main",assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"false",failureMessage:"Expected menu main to have aria-expanded='false'."}]}function hr(){return[{target:"main",assertion:"toHaveFocus",failureMessage:"Expected menu main to be focused."}]}function br(){return[{target:"main",assertion:"notToHaveFocus",failureMessage:"Expected menu main to not have focused."}]}function yr(s){return[{target:"relative",assertion:"toHaveFocus",expectedValue:s,failureMessage:`${s} menu item should have focus.`}]}function vr(){return[{target:"submenu",assertion:"toBeVisible",failureMessage:"Expected submenu to be visible"},{target:"submenuTrigger",assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"true",failureMessage:"Expected submenu trigger to have aria-expanded='true'."}]}function wr(){return[{target:"submenu",assertion:"notToBeVisible",failureMessage:"Expected submenu to be closed"},{target:"submenuTrigger",assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"false",failureMessage:"Expected submenu trigger to have aria-expanded='false'."}]}function kr(){return[{target:"submenuTrigger",assertion:"toHaveFocus",failureMessage:"Expected submenu trigger to be focused."}]}function Tr(){return[{target:"submenuTrigger",assertion:"notToHaveFocus",failureMessage:"Expected submenu trigger to not have focused."}]}function Ar(s){return[{target:"relative",relativeTarget:s,assertion:"toHaveFocus",failureMessage:`Expected submenu item ${s} to have focus.`}]}var pt={"tab.active":{setup:[{when:["keyboard"],steps:(s={})=>[{type:"keypress",target:"relative",relativeTarget:s.relativeTarget,key:"ArrowLeft"}]},{when:["pointer"],steps:(s={})=>[{type:"click",target:"relative",relativeTarget:s.relativeTarget}]}],assertion:(s={})=>Sr(s.relativeTarget)},"tab.focused":{setup:[{when:["keyboard","pointer"],steps:(s={})=>[{type:"focus",target:"relative",relativeTarget:s.relativeTarget}]}],assertion:(s={})=>Er(s.relativeTarget)}};function Er(s){return[{target:"relative",assertion:"toHaveFocus",relativeTarget:s,failureMessage:"Expected first tab to have focus."}]}function Mr(s){return[{target:"relative",assertion:"toHaveAttribute",attribute:"aria-selected",expectedValue:"true",relativeTarget:s,failureMessage:`Expected ${s} tab to have tabindex='0'.`}]}function Sr(s){return[{target:"relative",assertion:"toHaveAttribute",attribute:"aria-selected",expectedValue:"true",relativeTarget:s,failureMessage:`Expected ${s} tab to have aria-selected='true'.`},{target:"panel",assertion:"toBeVisible",controlledBy:{target:"relative",relativeTarget:s},failureMessage:`Expected panel controlled by the ${s} tab to be visible.`},Mr(s)]}var ft={"panel.expanded":{setup:[{when:["keyboard","pointer"],steps:s=>[{type:"keypress",target:"relative",relativeTarget:s.relativeTarget,key:"Enter"}]},{when:["pointer"],steps:s=>[{type:"click",target:"relative",relativeTarget:s.relativeTarget}]}],assertion:(s={})=>xr(s.relativeTarget)},"panel.collapsed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(s={})=>$r(s.relativeTarget)}};function xr(s){return[{target:"panel",assertion:"toBeVisible",controlledBy:{target:"relative",relativeTarget:s},failureMessage:`Expected panel controlled by the ${s} trigger to be visible.`},{target:"relative",relativeTarget:s,assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"true",failureMessage:"Expected trigger to have aria-expanded='true' when panel expands."}]}function $r(s){return[{target:"panel",assertion:"notToBeVisible",controlledBy:{target:"relative",relativeTarget:s},failureMessage:`Expected panel controlled by the ${s} trigger not to be visible.`},{target:"relative",relativeTarget:s,assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"false",failureMessage:"Expected trigger to have aria-expanded='false' when panel collapses."}]}function Cr(s,e){return e.some(t=>s.capabilities.includes(t))}function $e(s,e){Array.isArray(s)&&s.length&&!s[0].when&&(s=[{when:["keyboard"],steps:()=>s}]);for(let t of s)if(Cr(e,t.when))return t.steps(e);throw new Error(`No setup strategy matches capabilities: ${e.capabilities.join(", ")}`)}var Lr={combobox:lt,menu:ut,tabs:pt,accordion:ft},Oe=class{constructor(e){this.jsonContract=e}toJSON(){return this.jsonContract}},_e=class{constructor(e){this.componentName=e;this.statePack=Lr[e]||{}}metaValue={};selectorsValue={};relationshipInvariants=[];staticAssertions=[];dynamicTests=[];statePack;meta(e){return this.metaValue=e,this}selectors(e){return this.selectorsValue=e,this}relationships(e){let t=this.statePack,r={capabilities:["keyboard"]},n=(a,o=new Set)=>{if(o.has(a))return[];o.add(a);let u=t[a];if(!u)return[];let l=[];if(Array.isArray(u.requires))for(let f of u.requires)l=l.concat(n(f,o));return u.setup&&(l=l.concat($e(u.setup,r))),l};return e({ariaReference:(a,o,u)=>({requires:l=>{let f=n(l,new Set);return{required:()=>this.relationshipInvariants.push({type:"aria-reference",from:a,attribute:o,to:u,level:"required",setup:f}),optional:()=>this.relationshipInvariants.push({type:"aria-reference",from:a,attribute:o,to:u,level:"optional",setup:f}),recommended:()=>this.relationshipInvariants.push({type:"aria-reference",from:a,attribute:o,to:u,level:"recommended",setup:f})}},required:()=>this.relationshipInvariants.push({type:"aria-reference",from:a,attribute:o,to:u,level:"required"}),optional:()=>this.relationshipInvariants.push({type:"aria-reference",from:a,attribute:o,to:u,level:"optional"}),recommended:()=>this.relationshipInvariants.push({type:"aria-reference",from:a,attribute:o,to:u,level:"recommended"})}),contains:(a,o)=>({requires:u=>{let l=n(u,new Set);return{required:()=>this.relationshipInvariants.push({type:"contains",parent:a,child:o,level:"required",setup:l}),optional:()=>this.relationshipInvariants.push({type:"contains",parent:a,child:o,level:"optional",setup:l}),recommended:()=>this.relationshipInvariants.push({type:"contains",parent:a,child:o,level:"recommended",setup:l})}},required:()=>this.relationshipInvariants.push({type:"contains",parent:a,child:o,level:"required"}),optional:()=>this.relationshipInvariants.push({type:"contains",parent:a,child:o,level:"optional"}),recommended:()=>this.relationshipInvariants.push({type:"contains",parent:a,child:o,level:"recommended"})})}),this}static(e){return e({target:r=>{let n=o=>{let u=this.statePack,l={capabilities:["keyboard"]},f=(b,w=new Set)=>{if(w.has(b))return[];w.add(b);let H=u[b];if(!H)return[];let q=[];if(Array.isArray(H.requires))for(let N of H.requires)q=q.concat(f(N,w));return H.setup&&(q=q.concat($e(H.setup,l))),q};return f(o,new Set)},i=o=>o==="role"?"toHaveRole":"toHaveAttribute",a=(o,u,l)=>{let f=i(o);return{required:()=>this.staticAssertions.push({target:r,assertion:f,attribute:o,expectedValue:u,failureMessage:"",level:"required",setup:l}),optional:()=>this.staticAssertions.push({target:r,assertion:f,attribute:o,expectedValue:u,failureMessage:"",level:"optional",setup:l}),recommended:()=>this.staticAssertions.push({target:r,assertion:f,attribute:o,expectedValue:u,failureMessage:"",level:"recommended",setup:l})}};return{has:(o,u)=>({...a(o,u),requires:f=>{let b=n(f);return a(o,u,b)}})}}}),this}when(e){return new Ue(this,this.statePack,e)}addDynamicTest(e){this.dynamicTests.push(e)}build(){return{meta:this.metaValue,selectors:this.selectorsValue,relationships:this.relationshipInvariants.length?this.relationshipInvariants:void 0,static:this.staticAssertions.length?this.staticAssertions:[],dynamic:this.dynamicTests}}},Ue=class{constructor(e,t,r){this.parent=e;this.statePack=t;this.event=r}_as;_onTarget;_onRelativeTarget;_given=[];_then=[];_desc="";_level="required";_orientation;as(e){return this._as=e,this}on(e,t){return this._onTarget=e,this._onRelativeTarget=t,this}given(e){return this._given=this._normalizeStates(e),this}then(e){return this._then=this._normalizeStates(e),this}orientation(e){return this._orientation=e,this}_normalizeStates(e){return(Array.isArray(e)?e:[e]).flatMap(r=>typeof r=="string"?[r]:typeof r=="object"&&r!==null&&"type"in r&&"ref"in r?this._findStateKeyByTypeAndRef(r.type)?[{type:r.type,ref:r.ref}]:[]:[r])}_findStateKeyByTypeAndRef(e){if(Object.keys(this.statePack).includes(e))return e}describe(e){return this._desc=e,this}required(){return this._level="required",this._finalize(),this.parent}optional(){return this._level="optional",this._finalize(),this.parent}recommended(){return this._level="recommended",this._finalize(),this.parent}_finalize(){let r={capabilities:[{keypress:"keyboard",click:"pointer",type:"textInput",focus:"keyboard",hover:"pointer"}[this._as||"keyboard"]||this._as||"keyboard"]},n=(l,f=new Set)=>{if(f.has(l))return[];f.add(l);let b=this.statePack[l];if(!b)return[];let w=[];if(Array.isArray(b.requires))for(let H of b.requires)w=w.concat(n(H,f));return b.setup&&(w=w.concat($e(b.setup,r))),w},i=[];for(let l of this._given)if(typeof l=="string")i.push(...n(l));else if(typeof l=="object"&&l!==null&&"type"in l&&"ref"in l){let f=this._findStateKeyByTypeAndRef(l.type);if(f){let b=this.statePack[f];if(b&&b.setup)for(let w of b.setup)typeof w.steps=="function"?i.push(...w.steps({relativeTarget:l.ref})):Array.isArray(w.steps)&&i.push(...w.steps)}}let a=new Set;i=i.filter(l=>{let f=JSON.stringify(l);return a.has(f)?!1:(a.add(f),!0)});let o=[];for(let l of this._then)if(typeof l=="string"){let f=this.statePack[l];if(f&&f.assertion!==void 0){let b=f.assertion;if(typeof b=="function")try{b=b()}catch(w){throw new Error(`Error calling assertion function for state '${l}': ${w.message}`)}Array.isArray(b)?o.push(...b):o.push(b)}}else if(typeof l=="object"&&l!==null&&"type"in l&&"ref"in l){let f=this._findStateKeyByTypeAndRef(l.type);if(f){let b=this.statePack[f];if(b&&b.assertion!==void 0){let w=b.assertion;if(typeof w=="function")try{w=w({relativeTarget:l.ref})}catch(H){throw new Error(`Error calling assertion function for state '${f}': ${H.message}`)}Array.isArray(w)?o.push(...w):o.push(w)}}}let u=[{type:this._as,target:this._onTarget,key:this._as==="keypress"?this.event:void 0,relativeTarget:this._onRelativeTarget}];this.parent.addDynamicTest({description:this._desc||"",level:this._level,orientation:this._orientation||"horizontal",action:u,assertions:o,...i.length?{setup:i}:{}})}};function Rr(s,e){let t=new _e(s);return e(t),new Oe(t.build())}Ne();je();var _t=ne(require("path"),1);async function Ze(s,e,t={}){if(!s||typeof s!="string")throw new Error("\u274C testUiComponent requires a valid componentName (string)");if(!e)throw new Error("\u274C testUiComponent requires a URL");if(e&&typeof e!="string")throw new Error("\u274C testUiComponent url parameter must be a string");let r={violations:[]};async function n(f){try{let b=await fetch(f,{method:"HEAD",signal:AbortSignal.timeout(1e3)});if(b.ok||b.status===304)return f}catch{return null}return null}let i=ye(t.strictness),a={},o=typeof process<"u"?process.cwd():"";if(typeof process<"u"&&typeof process.cwd=="function")try{let{loadConfig:f}=await Promise.resolve().then(()=>(yt(),bt)),b=await f(process.cwd());if(a=b.config,b.configPath&&(o=_t.default.dirname(b.configPath)),t.strictness===void 0){let w=a.test?.components?.find(H=>H?.name===s)?.strictness;i=ye(w??a.test?.strictness)}}catch{t.strictness===void 0&&(i="balanced")}let u;try{if(e){let f=await n(e);if(f){console.log(`\u{1F3AD} Running Playwright tests on ${f}`);let{runContractTestsPlaywright:b}=await Promise.resolve().then(()=>(Bt(),Dt));u=await b(s,f,i,a,o)}else throw new Error(`\u274C Dev server not running at ${e}
65
- Please start your dev server and try again.`)}else throw new Error("\u274C URL is required for component testing. Please provide a URL to run full accessibility tests with testUiComponent.")}catch(f){throw f instanceof Error?f:new Error(`\u274C Contract test execution failed: ${String(f)}`)}let l={violations:r.violations,raw:r,contract:u};if(u.failures.length>0&&e==="Playwright")throw new Error(`
66
- \u274C ${u.failures.length} accessibility contract test${u.failures.length>1?"s":""} failed (Playwright mode)
67
- \u2705 ${u.passes.length} test${u.passes.length>1?"s":""} passed
58
+ `))}async function ss(t,e=process.cwd()){let r=Wt.default.join(e,"README.md");if(!await qe.default.pathExists(r)){console.log(Q.default.yellow(" \u2139\uFE0F No README.md found in current directory"));return}let n=await qe.default.readFile(r,"utf-8"),i=ye(t);if(n.includes(i)||n.includes(tt[t].fileName)){console.log(Q.default.gray(" \u2713 Badge already in README.md"));return}let a=zt.default.createInterface({input:process.stdin,output:process.stdout}),o=await new Promise(l=>{a.question(Q.default.cyan(" Add badge to README.md now? (y/n): "),u=>{a.close(),l(u.toLowerCase().trim())})});o==="y"||o==="yes"?(await ns(r,n,i),console.log(Q.default.green(" \u2713 Badge added to README.md!"))):console.log(Q.default.gray(" Skipped. You can add it manually anytime."))}async function ns(t,e,r){let s=e.split(`
59
+ `),n=0;for(let i=0;i<s.length;i++){let a=s[i].trim();if(a.startsWith("[![")||a.startsWith("[!")){n=i+1;continue}if(n>0&&!a.startsWith("[![")&&!a.startsWith("[!")&&a.length>0)break;if(n===0&&a.startsWith("#")){n=i+2;break}}n===0&&(n=1),s.splice(n,0,r),await qe.default.writeFile(t,s.join(`
60
+ `),"utf-8")}function is(){console.log(Q.default.cyan(`
61
+ \u{1F4CD} Available badges:`)),console.log(Q.default.white(`
62
+ For audits:`)),console.log(Q.default.green(" "+ye("audit"))),console.log(Q.default.white(`
63
+ For component testing:`)),console.log(Q.default.green(" "+ye("component"))),console.log(Q.default.white(`
64
+ For both (verified):`)),console.log(Q.default.green(" "+ye("verified"))),console.log("")}var qe,Wt,Q,zt,tt,Xt=Y(()=>{"use strict";qe=ne(require("fs-extra"),1),Wt=ne(require("path"),1),Q=ne(require("chalk"),1),zt=ne(require("readline"),1),tt={audit:{type:"audit",fileName:"audited-by-aria-ease.svg",label:"Audited by aria-ease",markdownUrl:"https://cdn.jsdelivr.net/gh/aria-ease/aria-ease@main/badges/audited-by-aria-ease.svg"},component:{type:"component",fileName:"components-tested-aria-ease.svg",label:"Components tested: aria-ease",markdownUrl:"https://cdn.jsdelivr.net/gh/aria-ease/aria-ease@main/badges/components-tested-aria-ease.svg"},verified:{type:"verified",fileName:"verified-by-aria-ease.svg",label:"Verified by aria-ease",markdownUrl:"https://cdn.jsdelivr.net/gh/aria-ease/aria-ease@main/badges/verified-by-aria-ease.svg"}}});var os={};oe(os,{cleanupTests:()=>st,createContract:()=>Wr,makeAccordionAccessible:()=>ir,makeBlockAccessible:()=>cr,makeCheckboxAccessible:()=>lr,makeComboboxAccessible:()=>fr,makeMenuAccessible:()=>ut,makeRadioAccessible:()=>ur,makeTabsAccessible:()=>dr,makeToggleAccessible:()=>pr,testUiComponent:()=>rt});module.exports=nr(os);function ir({accordionId:t,triggersClass:e,panelsClass:r,allowMultipleOpen:s=!1,callback:n}){if(t==="")return console.error("[aria-ease] 'accordionId' should not be an empty string. Provide an id to the accordion container element that exists before calling makeAccordionAccessible."),{cleanup:()=>{}};let i=document.querySelector(`#${t}`);if(!i)return console.error(`[aria-ease] Element with id="${t}" not found. Make sure the accordion container exists before calling makeAccordionAccessible.`),{cleanup:()=>{}};if(e==="")return console.error("[aria-ease] 'triggersClass' should not be an empty string. Provide a class name that exists on the accordion trigger elements before calling makeAccordionAccessible."),{cleanup:()=>{}};let a=Array.from(i.querySelectorAll(`.${e}`));if(a.length===0)return console.error(`[aria-ease] No elements with class="${e}" found. Make sure accordion triggers exist before calling makeAccordionAccessible.`),{cleanup:()=>{}};if(r==="")return console.error("[aria-ease] 'panelsClass' should not be an empty string. Provide a class name that exists on the accordion panel elements before calling makeAccordionAccessible."),{cleanup:()=>{}};let o=Array.from(i.querySelectorAll(`.${r}`));if(o.length===0)return console.error(`[aria-ease] No elements with class="${r}" found. Make sure accordion panels exist before calling makeAccordionAccessible.`),{cleanup:()=>{}};if(a.length!==o.length)return console.error(`[aria-ease] Accordion trigger/panel mismatch: found ${a.length} triggers but ${o.length} panels.`),{cleanup:()=>{}};let l=new WeakMap,u=new WeakMap;function f(){a.forEach((h,k)=>{let F=o[k];h.id||(h.id=`${t}-trigger-${k}`),F.id||(F.id=`${t}-panel-${k}`),h.setAttribute("aria-controls",F.id),h.setAttribute("aria-expanded","false"),(!s||a.length<=6)&&F.setAttribute("role","region"),F.setAttribute("aria-labelledby",h.id),F.style.display="none"})}function y(h){if(h<0||h>=a.length){console.error(`[aria-ease] Invalid accordion index: ${h}`);return}let k=a[h],F=o[h];if(k.setAttribute("aria-expanded","true"),F.style.display="block",n?.onExpand)try{n.onExpand(h)}catch(w){console.error("[aria-ease] Error in accordion onExpand callback:",w)}}function T(h){if(h<0||h>=a.length){console.error(`[aria-ease] Invalid accordion index: ${h}`);return}let k=a[h],F=o[h];if(k.setAttribute("aria-expanded","false"),F.style.display="none",n?.onCollapse)try{n.onCollapse(h)}catch(w){console.error("[aria-ease] Error in accordion onCollapse callback:",w)}}function H(h){a[h].getAttribute("aria-expanded")==="true"?T(h):(s||a.forEach((w,x)=>{x!==h&&T(x)}),y(h))}function q(h){return()=>{H(h)}}function U(h){return k=>{let{key:F}=k;switch(F){case"Enter":case" ":k.preventDefault(),H(h);break;case"ArrowDown":k.preventDefault();{let w=(h+1)%a.length;a[w].focus()}break;case"ArrowUp":k.preventDefault();{let w=(h-1+a.length)%a.length;a[w].focus()}break;case"Home":k.preventDefault(),a[0].focus();break;case"End":k.preventDefault(),a[a.length-1].focus();break}}}function G(){a.forEach((h,k)=>{let F=q(k),w=U(k);h.addEventListener("click",F),h.addEventListener("keydown",w),l.set(h,w),u.set(h,F)})}function g(){a.forEach(h=>{let k=l.get(h),F=u.get(h);k&&(h.removeEventListener("keydown",k),l.delete(h)),F&&(h.removeEventListener("click",F),u.delete(h))})}function d(){g(),a.forEach((h,k)=>{T(k)})}function C(){g();let h=Array.from(i.querySelectorAll(`.${e}`)),k=Array.from(i.querySelectorAll(`.${r}`));a.length=0,a.push(...h),o.length=0,o.push(...k),f(),G()}return f(),G(),{expandItem:y,collapseItem:T,toggleItem:H,cleanup:d,refresh:C}}function Me(t){if(t.tagName!=="INPUT")return!1;let e=t.type;return["text","email","password","tel","number"].includes(e)}function xe(t){return t.tagName==="TEXTAREA"}function ct(t){return t.tagName==="BUTTON"||t.tagName==="INPUT"&&["button","submit","reset"].includes(t.type)}function or(t){return t.tagName==="A"}function Ce(t,e,r){let s=t.length,n=(e+r+s)%s;t.item(n).focus()}function ar(t){return t.getAttribute("data-custom-click")!==null&&t.getAttribute("data-custom-click")!==void 0}function lt(t,e,r){let s=e.item(r);switch(t.key){case"ArrowUp":case"ArrowLeft":{(!Me(s)&&!xe(s)||(Me(s)||xe(s))&&s.selectionStart===0)&&(t.preventDefault(),Ce(e,r,-1));break}case"ArrowDown":case"ArrowRight":{if(!Me(s)&&!xe(s))t.preventDefault(),Ce(e,r,1);else if(Me(s)||xe(s)){let n=s.value;s.selectionStart===n.length&&(t.preventDefault(),Ce(e,r,1))}break}case"Escape":{t.preventDefault();break}case"Enter":case" ":{(!ct(s)&&!or(s)&&ar(s)||ct(s))&&(t.preventDefault(),s.click());break}case"Tab":break;default:break}}function cr({blockId:t,blockItemsClass:e}){if(t==="")return console.error("[aria-ease] 'blockId' should not be an empty string. Provide an id to the block container element that exists before calling makeBlockAccessible."),{cleanup:()=>{}};let r=document.querySelector(`#${t}`);if(!r)return console.error(`[aria-ease] Element with id="${t}" not found. Make sure the block element exists before calling makeBlockAccessible.`),{cleanup:()=>{}};if(e==="")return console.error("[aria-ease] 'blockItemsClass' should not be an empty string. Provide a class name that exists on the block item elements before calling makeBlockAccessible."),{cleanup:()=>{}};let s=null;function n(){return s||(s=r.querySelectorAll(`.${e}`)),s}let i=n();if(!i||i.length===0)return console.error(`[aria-ease] Element with class="${e}" not found. Make sure the block items exist before calling makeBlockAccessible.`),{cleanup:()=>{}};let a=new Map;i.forEach(u=>{if(!a.has(u)){let f=y=>{let T=r.querySelectorAll(`.${e}`),H=Array.prototype.indexOf.call(T,u);lt(y,T,H)};u.addEventListener("keydown",f),a.set(u,f)}});function o(){i.forEach(u=>{let f=a.get(u);f&&(u.removeEventListener("keydown",f),a.delete(u))})}function l(){s=null}return{cleanup:o,refresh:l}}function lr({checkboxGroupId:t,checkboxesClass:e,callback:r}){if(t==="")return console.error("[aria-ease] 'checkboxGroupId' should not be an empty string. Provide an id to the checkbox group container element that exists before calling makeCheckboxAccessible."),{cleanup:()=>{}};let s=document.querySelector(`#${t}`);if(!s)return console.error(`[aria-ease] Element with id="${t}" not found. Make sure the checkbox group container exists before calling makeCheckboxAccessible.`),{cleanup:()=>{}};if(e==="")return console.error("[aria-ease] 'checkboxesClass' should not be an empty string. Provide a class name that exists on the checkbox elements before calling makeCheckboxAccessible."),{cleanup:()=>{}};let n=Array.from(s.querySelectorAll(`.${e}`));if(n.length===0)return console.error(`[aria-ease] No elements with class="${e}" found. Make sure checkboxes exist before calling makeCheckboxAccessible.`),{cleanup:()=>{}};let i=new WeakMap,a=new WeakMap;function o(){s.getAttribute("role")||s.setAttribute("role","group"),n.forEach(d=>{d.setAttribute("role","checkbox"),d.hasAttribute("aria-checked")||d.setAttribute("aria-checked","false"),d.hasAttribute("tabindex")||d.setAttribute("tabindex","0")})}function l(d,C){if(r?.onCheck)try{r.onCheck(d,C)}catch(h){console.error("[aria-ease] Error in checkbox onCheck callback:",h)}}function u(d){if(d<0||d>=n.length){console.error(`[aria-ease] Invalid checkbox index: ${d}`);return}let C=n[d],h=C.getAttribute("aria-checked")==="true";C.setAttribute("aria-checked",h?"false":"true"),l(d,h)}function f(d,C){if(d<0||d>=n.length){console.error(`[aria-ease] Invalid checkbox index: ${d}`);return}n[d].setAttribute("aria-checked",C?"true":"false"),l(d,C)}function y(d){return()=>{u(d)}}function T(d){return C=>{let{key:h}=C;switch(h){case" ":C.preventDefault(),u(d);break}}}function H(){n.forEach((d,C)=>{let h=y(C),k=T(C);d.addEventListener("click",h),d.addEventListener("keydown",k),i.set(d,k),a.set(d,h)})}function q(){n.forEach(d=>{let C=i.get(d),h=a.get(d);C&&(d.removeEventListener("keydown",C),i.delete(d)),h&&(d.removeEventListener("click",h),a.delete(d))})}function U(){q()}function G(){return n.map(d=>d.getAttribute("aria-checked")==="true")}function g(){return n.map((d,C)=>d.getAttribute("aria-checked")==="true"?C:-1).filter(d=>d!==-1)}return o(),H(),{toggleCheckbox:u,setCheckboxState:f,getCheckedStates:G,getCheckedIndices:g,cleanup:U}}function ut({menuId:t,menuItemsClass:e,triggerId:r,callback:s}){if(t==="")return console.error("[aria-ease] 'menuId' should not be an empty string. Provide an id of the menu element before calling makeMenuAccessible."),{openMenu:()=>{},closeMenu:()=>{},cleanup:()=>{}};let n=document.querySelector(`#${t}`);if(!n)return console.error(`[aria-ease] Element with id="${t}" not found. Make sure the menu element exists before calling makeMenuAccessible.`),{openMenu:()=>{},closeMenu:()=>{},cleanup:()=>{}};if(r==="")return console.error("[aria-ease] 'triggerId' should not be an empty string. Provide an id of the trigger button element before calling makeMenuAccessible."),{openMenu:()=>{},closeMenu:()=>{},cleanup:()=>{}};let i=document.querySelector(`#${r}`);if(!i)return console.error(`[aria-ease] Element with id="${r}" not found. Make sure the trigger button element exists before calling makeMenuAccessible.`),{openMenu:()=>{},closeMenu:()=>{},cleanup:()=>{}};if(e==="")return console.error("[aria-ease] 'menuItemsClass' should not be an empty string. Provide a class name to at least a menu item that exists before calling makeMenuAccessible."),{openMenu:()=>{},closeMenu:()=>{},cleanup:()=>{}};if(!/^[\w-]+$/.test(t))return console.error("[aria-ease] Invalid menuId: must be alphanumeric"),{openMenu:()=>{},closeMenu:()=>{},cleanup:()=>{}};i.setAttribute("aria-haspopup","true"),i.setAttribute("aria-controls",t),i.setAttribute("aria-expanded","false"),n.setAttribute("role","menu"),n.setAttribute("aria-labelledby",r);let a=new WeakMap,o=new Map,l=null,u=null;function f(){return l||(l=n.querySelectorAll(`.${e}`)),l}function y(){if(!u){let p=f();u=[];for(let v=0;v<p.length;v++){let $=p.item(v),B=C($),X=$.getAttribute("aria-disabled")==="true";B||($.hasAttribute("tabindex")||$.setAttribute("tabindex","-1"),X||u.push($))}}return u}function T(p){return{length:p.length,item:$=>p[$],forEach:$=>{p.forEach($)},[Symbol.iterator]:function*(){for(let $ of p)yield $}}}function H(){f().forEach(v=>{v.setAttribute("role","menuitem");let $=v.getAttribute("data-submenu-id")??v.getAttribute("aria-controls"),B=v.hasAttribute("aria-haspopup")&&$;$&&(v.hasAttribute("data-submenu-id")||B)&&(v.setAttribute("aria-haspopup","menu"),v.setAttribute("aria-controls",$),v.hasAttribute("aria-expanded")||v.setAttribute("aria-expanded","false"))})}function q(p,v,$){let B=p.length,X=(v+$+B)%B;p.item(X).focus()}function U(p,v){p.length!==0&&p[v]?.focus()}function G(p){return p.hasAttribute("aria-controls")&&p.hasAttribute("aria-haspopup")&&p.getAttribute("role")==="menuitem"}function g(p){let v=p;for(;v&&v.getAttribute("role")==="menuitem";){let $=v.closest('[role="menu"]');if(!$)break;$.style.display="none",v.setAttribute("aria-expanded","false");let B=$.getAttribute("aria-labelledby");if(!B)break;let X=document.getElementById(B);if(!X)break;v=X}}H();function d(p,v,$){switch(p.key){case"ArrowLeft":{if(p.key==="ArrowLeft"&&i.getAttribute("role")==="menuitem"){p.preventDefault(),m();return}break}case"ArrowUp":{p.preventDefault(),q(T(y()),$,-1);break}case"ArrowRight":{if(p.key==="ArrowRight"&&G(v)){p.preventDefault();let B=v.getAttribute("aria-controls");if(B){k(B);return}}break}case"ArrowDown":{p.preventDefault(),q(T(y()),$,1);break}case"Home":{p.preventDefault(),U(y(),0);break}case"End":{p.preventDefault();let B=y();U(B,B.length-1);break}case"Escape":{p.preventDefault(),m(),i.focus(),F&&F(!1);break}case"Enter":case" ":{if(p.preventDefault(),G(v)){let B=v.getAttribute("aria-controls");if(B){k(B);return}}v.click(),m(),F&&F(!1);break}case"Tab":{m(),g(i),F&&F(!1);break}default:break}}function C(p){let v=p.parentElement;for(;v&&v!==n;){if(v.getAttribute("role")==="menu"||v.id&&n.querySelector(`[aria-controls="${v.id}"]`))return!0;v=v.parentElement}return!1}function h(p){i.setAttribute("aria-expanded",p?"true":"false")}function k(p){let v=o.get(p);if(!v){let $=n.querySelector(`[aria-controls="${p}"]`);if(!$){console.error(`[aria-ease] Submenu trigger with aria-controls="${p}" not found in menu "${t}".`);return}if(!$.id){let X=`trigger-${p}`;$.id=X,console.warn(`[aria-ease] Submenu trigger for "${p}" had no ID. Auto-generated ID: "${X}".`)}if(!document.querySelector(`#${p}`)){console.error(`[aria-ease] Submenu element with id="${p}" not found. Cannot create submenu instance.`);return}v=ut({menuId:p,menuItemsClass:e,triggerId:$.id,callback:s}),o.set(p,v)}v.openMenu()}function F(p){if(s?.onOpenChange)try{s.onOpenChange(p)}catch(v){console.error("[aria-ease] Error in menu onOpenChange callback:",v)}}function w(){y().forEach((v,$)=>{if(!a.has(v)){let B=X=>d(X,v,$);v.addEventListener("keydown",B),a.set(v,B)}})}function x(){y().forEach(v=>{let $=a.get(v);$&&(v.removeEventListener("keydown",$),a.delete(v))})}function L(){h(!0),n.style.display="block";let p=y();if(w(),p&&p.length>0&&p[0].focus(),s?.onOpenChange)try{s.onOpenChange(!0)}catch(v){console.error("[aria-ease] Error in menu onOpenChange callback:",v)}}function m(){if(o.forEach(p=>p.closeMenu()),h(!1),n.style.display="none",x(),i.focus(),s?.onOpenChange)try{s.onOpenChange(!1)}catch(p){console.error("[aria-ease] Error in menu onOpenChange callback:",p)}}function A(){i.getAttribute("aria-expanded")==="true"?m():L()}function b(p){if(!(i.getAttribute("aria-expanded")==="true"))return;let $=i.contains(p.target),B=n.contains(p.target);!$&&!B&&m()}i.addEventListener("click",A),document.addEventListener("click",b);function D(){x(),i.removeEventListener("click",A),document.removeEventListener("click",b),n.style.display="none",h(!1),o.forEach(p=>p.cleanup()),o.clear()}function Z(){l=null,u=null}return{openMenu:L,closeMenu:m,cleanup:D,refresh:Z}}function ur({radioGroupId:t,radiosClass:e,defaultSelectedIndex:r,callback:s}){if(t==="")return console.error("[aria-ease] 'radioGroupId' should not be an empty string. Provide an id to the radio group container element that exists before calling makeRadioAccessible."),{cleanup:()=>{}};let n=document.querySelector(`#${t}`);if(!n)return console.error(`[aria-ease] Element with id="${t}" not found. Make sure the radio group container exists before calling makeRadioAccessible.`),{cleanup:()=>{}};if(e==="")return console.error("[aria-ease] 'radiosClass' should not be an empty string. Provide a class name that exists on the radio button elements before calling makeRadioAccessible."),{cleanup:()=>{}};let i=Array.from(n.querySelectorAll(`.${e}`));if(i.length===0)return console.error(`[aria-ease] No elements with class="${e}" found. Make sure radio buttons exist before calling makeRadioAccessible.`),{cleanup:()=>{}};let a=new WeakMap,o=new WeakMap,l;r&&(l=r);function u(){n.getAttribute("role")||n.setAttribute("role","radiogroup"),i.forEach((g,d)=>{g.setAttribute("role","radio"),g.setAttribute("tabindex","0"),d===l?g.setAttribute("aria-checked","true"):g.setAttribute("aria-checked","false")})}function f(g){if(g<0||g>=i.length){console.error(`[aria-ease] Invalid radio index: ${g}`);return}if(l>=0&&l<i.length&&i[l].setAttribute("aria-checked","false"),i[g].setAttribute("aria-checked","true"),i[g].focus(),s?.onCheck)try{s.onCheck(g)}catch(d){console.error("[aria-ease] Error in radio onCheck callback:",d)}l=g}function y(g){return()=>{f(g)}}function T(g){return d=>{let{key:C}=d,h=g;switch(C){case"ArrowDown":case"ArrowRight":d.preventDefault(),h=(g+1)%i.length,f(h);break;case"ArrowUp":case"ArrowLeft":d.preventDefault(),h=(g-1+i.length)%i.length,f(h);break;case" ":case"Enter":d.preventDefault(),f(g);break}}}function H(){i.forEach((g,d)=>{let C=y(d),h=T(d);g.addEventListener("click",C),g.addEventListener("keydown",h),a.set(g,h),o.set(g,C)})}function q(){i.forEach(g=>{let d=a.get(g),C=o.get(g);d&&(g.removeEventListener("keydown",d),a.delete(g)),C&&(g.removeEventListener("click",C),o.delete(g))})}function U(){q()}function G(){return l}return u(),H(),{selectRadio:f,getSelectedIndex:G,cleanup:U}}function pr({toggleId:t,togglesClass:e,isSingleToggle:r=!0}){if(t==="")return console.error("[aria-ease] 'toggleId' should not be an empty string. Provide an id to the toggle element or toggle container before calling makeToggleAccessible."),{cleanup:()=>{}};let s=document.querySelector(`#${t}`);if(!s)return console.error(`[aria-ease] Element with id="${t}" not found. Make sure the toggle element exists before calling makeToggleAccessible.`),{cleanup:()=>{}};let n;if(r)n=[s];else{if(!e)return console.error("[aria-ease] togglesClass is required when isSingleToggle is false."),{cleanup:()=>{}};if(n=Array.from(s.querySelectorAll(`.${e}`)),n.length===0)return console.error(`[aria-ease] No elements with class="${e}" found. Make sure toggle buttons exist before calling makeToggleAccessible.`),{cleanup:()=>{}}}let i=new WeakMap,a=new WeakMap;function o(){n.forEach(g=>{g.tagName.toLowerCase()!=="button"&&!g.getAttribute("role")&&g.setAttribute("role","button"),g.hasAttribute("aria-pressed")||g.setAttribute("aria-pressed","false"),g.hasAttribute("tabindex")||g.setAttribute("tabindex","0")})}function l(g){if(g<0||g>=n.length){console.error(`[aria-ease] Invalid toggle index: ${g}`);return}let d=n[g],C=d.getAttribute("aria-pressed")==="true";d.setAttribute("aria-pressed",C?"false":"true")}function u(g,d){if(g<0||g>=n.length){console.error(`[aria-ease] Invalid toggle index: ${g}`);return}n[g].setAttribute("aria-pressed",d?"true":"false")}function f(g){return()=>{l(g)}}function y(g){return d=>{let{key:C}=d;switch(C){case"Enter":case" ":d.preventDefault(),l(g);break}}}function T(){n.forEach((g,d)=>{let C=f(d),h=y(d);g.addEventListener("click",C),g.addEventListener("keydown",h),i.set(g,h),a.set(g,C)})}function H(){n.forEach(g=>{let d=i.get(g),C=a.get(g);d&&(g.removeEventListener("keydown",d),i.delete(g)),C&&(g.removeEventListener("click",C),a.delete(g))})}function q(){H()}function U(){return n.map(g=>g.getAttribute("aria-pressed")==="true")}function G(){return n.map((g,d)=>g.getAttribute("aria-pressed")==="true"?d:-1).filter(g=>g!==-1)}return o(),T(),{toggleButton:l,setPressed:u,getPressedStates:U,getPressedIndices:G,cleanup:q}}function fr({comboboxInputId:t,comboboxButtonId:e,listBoxId:r,listBoxItemsClass:s,callback:n}){if(t==="")return console.error("[aria-ease] 'comboboxInputId' should not be an empty string. Provide an id to the combobox input element that exists before calling makeComboboxAccessible."),{cleanup:()=>{}};let i=document.getElementById(`${t}`);if(!i)return console.error(`[aria-ease] Element with id="${t}" not found. Make sure the combobox input element exists before calling makeComboboxAccessible.`),{cleanup:()=>{}};if(r==="")return console.error("[aria-ease] 'listBoxId' should not be an empty string. Provide an id to the combobox listbox element that exists before calling makeComboboxAccessible."),{cleanup:()=>{}};let a=document.getElementById(`${r}`);if(!a)return console.error(`[aria-ease] Element with id="${r}" not found. Make sure the combobox listbox element exists before calling makeComboboxAccessible.`),{cleanup:()=>{}};if(s==="")return console.error("[aria-ease] 'listboxItemsClass' class should not be an empty string. Provide a class name to at least a listbox option that exists before calling makeComboboxAccessible."),{cleanup:()=>{}};if(!document.querySelectorAll(s))return console.error(`[aria-ease] Listbox option(s) with class="${s}" not found. Make sure at least a combobox listbox option exists before calling makeComboboxAccessible.`),{cleanup:()=>{}};let l=e?document.getElementById(`${e}`):null,u=-1;i.setAttribute("role","combobox"),i.setAttribute("aria-autocomplete","list"),i.setAttribute("aria-controls",r),i.setAttribute("aria-expanded","false"),i.setAttribute("aria-haspopup","listbox"),a.setAttribute("role","listbox");let f=null;function y(){return f||(f=a.querySelectorAll(`.${s}`)),Array.from(f).filter(m=>!m.hidden&&m.style.display!=="none")}function T(){return i.getAttribute("aria-expanded")==="true"}function H(m){let A=y();if(m>=0&&m<A.length){let b=A[m],D=b.id||`${r}-option-${m}`;if(b.id||(b.id=D),i.setAttribute("aria-activedescendant",D),typeof b.scrollIntoView=="function"&&b.scrollIntoView({block:"nearest",behavior:"smooth"}),n?.onActiveDescendantChange)try{n.onActiveDescendantChange(D,b)}catch(Z){console.error("[aria-ease] Error in combobox onActiveDescendantChange callback:",Z)}}else i.setAttribute("aria-activedescendant","");u=m}function q(){if(i.setAttribute("aria-expanded","true"),a.style.display="block",n?.onOpenChange)try{n.onOpenChange(!0)}catch(m){console.error("[aria-ease] Error in combobox onOpenChange callback:",m)}}function U(){if(i.setAttribute("aria-expanded","false"),i.setAttribute("aria-activedescendant",""),a.style.display="none",u=-1,n?.onOpenChange)try{n.onOpenChange(!1)}catch(m){console.error("[aria-ease] Error in combobox onOpenChange callback:",m)}}function G(m){let A=m.textContent?.trim()||"";if(i.value=A,m.setAttribute("aria-selected","true"),U(),n?.onSelect)try{n.onSelect(m)}catch(b){console.error("[aria-ease] Error in combobox onSelect callback:",b)}}function g(m){let A=y(),b=T();switch(m.key){case"ArrowDown":if(m.preventDefault(),!b){q();return}if(A.length===0)return;{let D=u>=A.length-1?0:u+1;H(D)}break;case"ArrowUp":if(m.preventDefault(),!b)return;if(A.length>0){let D=u<=0?A.length-1:u-1;H(D)}break;case"Enter":b&&u>=0&&u<A.length&&(m.preventDefault(),G(A[u]));break;case"Escape":if(b)m.preventDefault(),U();else if(i.value&&(m.preventDefault(),i.value="",i.setAttribute("aria-activedescendant",""),y().forEach(Z=>{Z.getAttribute("aria-selected")==="true"&&Z.setAttribute("aria-selected","false")}),n?.onClear))try{n.onClear()}catch(Z){console.error("[aria-ease] Error in combobox onClear callback:",Z)}break;case"Home":b&&A.length>0&&(m.preventDefault(),H(0));break;case"End":b&&A.length>0&&(m.preventDefault(),H(A.length-1));break;case"Tab":b&&u>=0&&u<A.length&&G(A[u]),b&&U();break}}function d(m){let A=m.target;if(A.classList.contains(s)){let D=y().indexOf(A);D>=0&&H(D)}}function C(m){let A=m.target;A.classList.contains(s)&&(m.preventDefault(),G(A))}function h(m){let A=m.target;!i.contains(A)&&!a.contains(A)&&(!l||!l.contains(A))&&U()}function k(){T()?U():(q(),i.focus())}function F(m){(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),k())}i.addEventListener("keydown",g),a.addEventListener("mousemove",d),a.addEventListener("mousedown",C),document.addEventListener("mousedown",h),l&&(l.setAttribute("tabindex","-1"),l.setAttribute("aria-label","Toggle options"),l.addEventListener("click",k),l.addEventListener("keydown",F));function w(){let m=a.querySelectorAll(`.${s}`);if(m.length===0)return;let A=null;for(let b of m)if(b.getAttribute("aria-selected")==="true"){A=b.textContent?.trim()||null;break}!A&&i.value&&(A=i.value.trim()),m.forEach((b,D)=>{b.setAttribute("role","option");let Z=b.textContent?.trim()||"";A&&Z===A?b.setAttribute("aria-selected","true"):b.setAttribute("aria-selected","false");let p=b.getAttribute("id");if(!p||p===""){let v=`${r}-option-${D}`;b.id=v,b.setAttribute("id",v)}})}w();function x(){i.removeEventListener("keydown",g),a.removeEventListener("mousemove",d),a.removeEventListener("mousedown",C),document.removeEventListener("mousedown",h),l&&(l.removeEventListener("click",k),l.removeEventListener("keydown",F))}function L(){f=null,w(),u=-1,H(-1)}return{cleanup:x,refresh:L,openListbox:q,closeListbox:U}}function dr({tabListId:t,tabsClass:e,tabPanelsClass:r,orientation:s="horizontal",activateOnFocus:n=!0,callback:i}){if(t==="")return console.error("[aria-ease] 'tabListId' should not be an empty string. Provide an id to the tab list container element that exists before calling makeTabsAccessible."),{cleanup:()=>{}};let a=document.querySelector(`#${t}`);if(!a)return console.error(`[aria-ease] Element with id="${t}" not found. Make sure the tab list container exists before calling makeTabsAccessible.`),{cleanup:()=>{}};if(e==="")return console.error("[aria-ease] 'tabsClass' should not be an empty string. Provide a class name that exists on the tab button elements before calling makeTabsAccessible."),{cleanup:()=>{}};let o=Array.from(a.querySelectorAll(`.${e}`));if(o.length===0)return console.error(`[aria-ease] No elements with class="${e}" found. Make sure tab buttons exist before calling makeTabsAccessible.`),{cleanup:()=>{}};if(r==="")return console.error("[aria-ease] 'tabPanelsClass' should not be an empty string. Provide a class name that exists on the tab panel elements before calling makeTabsAccessible."),{cleanup:()=>{}};let l=Array.from(document.querySelectorAll(`.${r}`));if(l.length===0)return console.error(`[aria-ease] No elements with class="${r}" found. Make sure tab panels exist before calling makeTabsAccessible.`),{cleanup:()=>{}};if(o.length!==l.length)return console.error(`[aria-ease] Tab/panel mismatch: found ${o.length} tabs but ${l.length} panels.`),{cleanup:()=>{}};let u=new WeakMap,f=new WeakMap,y=new WeakMap,T=0;function H(){a.setAttribute("role","tablist"),a.setAttribute("aria-orientation",s),o.forEach((w,x)=>{let L=l[x];w.id||(w.id=`${t}-tab-${x}`),L.id||(L.id=`${t}-panel-${x}`),w.setAttribute("role","tab"),w.setAttribute("aria-controls",L.id),w.setAttribute("aria-selected","false"),w.setAttribute("tabindex","-1"),L.setAttribute("role","tabpanel"),L.setAttribute("aria-labelledby",w.id),L.hidden=!0,L.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')||L.setAttribute("tabindex","0")}),q(0,!1)}function q(w,x=!0){if(w<0||w>=o.length){console.error(`[aria-ease] Invalid tab index: ${w}`);return}let L=T;o.forEach((b,D)=>{let Z=l[D];b.setAttribute("aria-selected","false"),b.setAttribute("tabindex","-1"),Z.hidden=!0});let m=o[w],A=l[w];if(m.setAttribute("aria-selected","true"),m.setAttribute("tabindex","0"),A.hidden=!1,x&&m.focus(),T=w,i?.onTabChange&&L!==w)try{i.onTabChange(w,L)}catch(b){console.error("[aria-ease] Error in tabs onTabChange callback:",b)}}function U(w){let x=o.findIndex(A=>A===document.activeElement),L=x!==-1?x:T,m=L;switch(w){case"first":m=0;break;case"last":m=o.length-1;break;case"next":m=(L+1)%o.length;break;case"prev":m=(L-1+o.length)%o.length;break}if(o[m].focus(),o[m].setAttribute("tabindex","0"),o[T].setAttribute("tabindex","-1"),n)q(m,!1);else{let A=T;o.forEach((b,D)=>{D===m?b.setAttribute("tabindex","0"):D!==A&&b.setAttribute("tabindex","-1")})}}function G(w){return()=>{q(w)}}function g(w){return x=>{let{key:L}=x,m=!1;if(s==="horizontal")switch(L){case"ArrowLeft":x.preventDefault(),U("prev"),m=!0;break;case"ArrowRight":x.preventDefault(),U("next"),m=!0;break}else switch(L){case"ArrowUp":x.preventDefault(),U("prev"),m=!0;break;case"ArrowDown":x.preventDefault(),U("next"),m=!0;break}if(!m)switch(L){case"Home":x.preventDefault(),U("first");break;case"End":x.preventDefault(),U("last");break;case" ":case"Enter":n||(x.preventDefault(),q(w));break;case"F10":if(x.shiftKey&&i?.onContextMenu){x.preventDefault();try{i.onContextMenu(w,o[w])}catch(A){console.error("[aria-ease] Error in tabs onContextMenu callback:",A)}}break}}}function d(w){return x=>{if(i?.onContextMenu){x.preventDefault();try{i.onContextMenu(w,o[w])}catch(L){console.error("[aria-ease] Error in tabs onContextMenu callback:",L)}}}}function C(){o.forEach((w,x)=>{let L=G(x),m=g(x),A=d(x);w.addEventListener("click",L),w.addEventListener("keydown",m),i?.onContextMenu&&(w.addEventListener("contextmenu",A),y.set(w,A)),u.set(w,m),f.set(w,L)})}function h(){o.forEach(w=>{let x=u.get(w),L=f.get(w),m=y.get(w);x&&(w.removeEventListener("keydown",x),u.delete(w)),L&&(w.removeEventListener("click",L),f.delete(w)),m&&(w.removeEventListener("contextmenu",m),y.delete(w))})}function k(){h(),o.forEach((w,x)=>{let L=l[x];w.removeAttribute("role"),w.removeAttribute("aria-selected"),w.removeAttribute("aria-controls"),w.removeAttribute("tabindex"),L.removeAttribute("role"),L.removeAttribute("aria-labelledby"),L.removeAttribute("tabindex"),L.hidden=!1}),a.removeAttribute("role"),a.removeAttribute("aria-orientation")}function F(){h();let w=Array.from(a.querySelectorAll(`.${e}`)),x=Array.from(document.querySelectorAll(`.${r}`));o.length=0,o.push(...w),l.length=0,l.push(...x),H(),C()}return H(),C(),{activateTab:q,cleanup:k,refresh:F}}function ae(t,e){return e==="first"?`first ${t}`:e==="last"?`last ${t}`:e==="next"?`next ${t}`:e==="previous"?`previous ${t}`:typeof e=="number"?`${t} at index ${e}`:`${e} ${t}`}var ft={"comboboxpopup.open":{setup:[{when:["keyboard","textInput","pointer"],steps:()=>[{type:"keypress",target:"input",key:"ArrowDown"}]},{when:["pointer"],steps:()=>[{type:"click",target:"button"}]}],assertion:gr},"comboboxpopup.closed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:[...mr(),...pt()]},"main.focused":{setup:[{when:["keyboard","pointer"],steps:()=>[{type:"focus",target:"main"}]}],assertion:vr},"main.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:wr},"input.filled":{setup:[{when:["keyboard","textInput","pointer"],steps:()=>[{type:"type",target:"input",value:"test"}]}],assertion:kr},"input.empty":{setup:[{when:["keyboard","textInput","pointer"],steps:()=>[{type:"type",target:"input",value:""}]}],assertion:Tr},"option.active":{requires:["comboboxpopup.open"],setup:[{when:["keyboard","pointer"],steps:(t={})=>typeof t.relativeTarget=="number"?Array.from({length:t.relativeTarget},()=>({type:"keypress",target:"main",key:"ArrowDown"})):t.relativeTarget==="first"?[{type:"keypress",target:"main",key:"ArrowDown"}]:t.relativeTarget==="last"?[{type:"keypress",target:"main",key:"ArrowDown"},{type:"keypress",target:"main",key:"ArrowUp"}]:[]}],assertion:(t={})=>hr(t.relativeTarget)},"activedescendant.set":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:br},"activedescendant.unset":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:pt},"option.selected":{requires:["comboboxpopup.open"],setup:[{when:["keyboard"],steps:(t={})=>[{type:"keypress",target:"relative",key:"Enter",relativeTarget:t.relativeTarget}]},{when:["pointer"],steps:(t={})=>[{type:"click",target:"relative",relativeTarget:t.relativeTarget}]}],assertion:(t={})=>yr(t.relativeTarget)}};function gr(){return[{target:"popup",assertion:"toBeVisible",failureMessage:"Expected popup to be visible"},{target:"main",assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"true",failureMessage:"Expected combobox main to have aria-expanded='true'."}]}function mr(){return[{target:"popup",assertion:"notToBeVisible",failureMessage:"Expected popup to be closed"},{target:"main",assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"false",failureMessage:"Expected combobox main to have aria-expanded='false'."}]}function hr(t){return[{target:"main",assertion:"toHaveAttribute",attribute:"aria-activedescendant",expectedValue:{ref:"relative",relativeTarget:t,property:"id"},failureMessage:"Expected aria-activedescendant on main to match the id of the first relative item."}]}function br(){return[{target:"main",assertion:"toHaveAttribute",attribute:"aria-activedescendant",expectedValue:"!empty",failureMessage:"Expected aria-activedescendant on main to not be empty."}]}function pt(){return[{target:"main",assertion:"toHaveAttribute",attribute:"aria-activedescendant",expectedValue:"",failureMessage:"Expected aria-activedescendant on main to be empty."}]}function yr(t){return[{target:"relative",relativeTarget:t,assertion:"toHaveAttribute",attribute:"aria-selected",expectedValue:"true",failureMessage:`Expected ${ae("option",t)} to have aria-selected='true'.`}]}function vr(){return[{target:"main",assertion:"toHaveFocus",failureMessage:"Expected main to be focused."}]}function wr(){return[{target:"main",assertion:"notToHaveFocus",failureMessage:"Expected main to not have focused."}]}function kr(){return[{target:"input",assertion:"toHaveValue",expectedValue:"test",failureMessage:"Expected input to have the value 'test'."}]}function Tr(){return[{target:"input",assertion:"toHaveValue",expectedValue:"",failureMessage:"Expected input to have the value ''."}]}var dt={"menupopup.open":{setup:[{when:["keyboard"],steps:()=>[{type:"keypress",target:"main",key:"Enter"}]},{when:["pointer"],steps:()=>[{type:"click",target:"main"}]}],assertion:Ar},"menupopup.closed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:Er},"main.focused":{setup:[{when:["keyboard","pointer"],steps:()=>[{type:"focus",target:"main"}]}],assertion:Sr},"main.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:Mr},"menuitem.focused":{requires:["menupopup.open"],setup:[{when:["keyboard"],steps:(t={})=>[{type:"focus",target:"relative",relativeTarget:t.relativeTarget}]}],assertion:(t={})=>xr(t.relativeTarget)},"submenupopup.open":{requires:["menupopup.open"],setup:[{when:["keyboard"],steps:()=>[{type:"keypress",target:"submenuTrigger",key:"ArrowRight"}]},{when:["pointer"],steps:()=>[{type:"click",target:"submenuTrigger"}]}],assertion:Cr},"submenupopup.closed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:$r},"submenutrigger.focused":{setup:[{when:["keyboard","pointer"],steps:()=>[{type:"focus",target:"submenuTrigger"}]}],assertion:Lr},"submenutrigger.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:Rr},"submenuitem.focused":{requires:["submenupopup.open"],setup:[{when:["keyboard"],steps:(t={})=>{let e=[{type:"focus",target:"submenuTrigger"},{type:"keypress",target:"submenuTrigger",key:"ArrowRight"}];return typeof t.relativeTarget=="number"&&(e=e.concat(Array.from({length:t.relativeTarget},()=>({type:"keypress",target:"submenuItems",key:"ArrowDown"})))),t.relativeTarget==="first"&&(e=e.concat({type:"keypress",target:"submenuItems",key:"ArrowDown"})),t.relativeTarget==="last"&&(e=e.concat({type:"keypress",target:"submenuItems",key:"ArrowUp"})),e}},{when:["pointer"],steps:(t={})=>[{type:"click",target:"submenuTrigger"},{type:"click",target:"relative",relativeTarget:t.relativeTarget}]}],assertion:(t={})=>Hr(t.relativeTarget)}};function Ar(){return[{target:"popup",assertion:"toBeVisible",failureMessage:"Expected popup to be visible"},{target:"main",assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"true",failureMessage:"Expected menu main to have aria-expanded='true'."}]}function Er(){return[{target:"popup",assertion:"notToBeVisible",failureMessage:"Expected popup to be closed"},{target:"main",assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"false",failureMessage:"Expected menu main to have aria-expanded='false'."}]}function Sr(){return[{target:"main",assertion:"toHaveFocus",failureMessage:"Expected menu main to be focused."}]}function Mr(){return[{target:"main",assertion:"notToHaveFocus",failureMessage:"Expected menu main to not have focused."}]}function xr(t){return[{target:"relative",assertion:"toHaveFocus",expectedValue:t,failureMessage:`${t} menu item should have focus.`}]}function Cr(){return[{target:"submenu",assertion:"toBeVisible",failureMessage:"Expected submenu to be visible"},{target:"submenuTrigger",assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"true",failureMessage:"Expected submenu trigger to have aria-expanded='true'."}]}function $r(){return[{target:"submenu",assertion:"notToBeVisible",failureMessage:"Expected submenu to be closed"},{target:"submenuTrigger",assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"false",failureMessage:"Expected submenu trigger to have aria-expanded='false'."}]}function Lr(){return[{target:"submenuTrigger",assertion:"toHaveFocus",failureMessage:"Expected submenu trigger to be focused."}]}function Rr(){return[{target:"submenuTrigger",assertion:"notToHaveFocus",failureMessage:"Expected submenu trigger to not have focused."}]}function Hr(t){return[{target:"relative",relativeTarget:t,assertion:"toHaveFocus",failureMessage:`Expected submenu item ${t} to have focus.`}]}var gt={"tab.active":{setup:[{when:["keyboard"],steps:(t={})=>[{type:"keypress",target:"relative",relativeTarget:t.relativeTarget,key:"ArrowLeft"}]},{when:["pointer"],steps:(t={})=>[{type:"click",target:"relative",relativeTarget:t.relativeTarget}]}],assertion:(t={})=>Dr(t.relativeTarget)},"tab.focused":{setup:[{when:["keyboard","pointer"],steps:(t={})=>[{type:"focus",target:"relative",relativeTarget:t.relativeTarget}]}],assertion:(t={})=>Pr(t.relativeTarget)}};function Pr(t){return[{target:"relative",assertion:"toHaveFocus",relativeTarget:t,failureMessage:`Expected ${ae("tab",t)} to have focus.`}]}function Ir(t){return[{target:"relative",assertion:"toHaveAttribute",attribute:"aria-selected",expectedValue:"true",relativeTarget:t,failureMessage:`Expected ${ae("tab",t)} to have tabindex='0'.`}]}function Dr(t){return[{target:"relative",assertion:"toHaveAttribute",attribute:"aria-selected",expectedValue:"true",relativeTarget:t,failureMessage:`Expected ${ae("tab",t)} to have aria-selected='true'.`},{target:"panel",assertion:"toBeVisible",controlledBy:{target:"relative",relativeTarget:t},failureMessage:`Expected panel controlled by the ${ae("tab",t)} to be visible.`},Ir(t)]}var mt={"panel.expanded":{setup:[{when:["keyboard","pointer"],steps:t=>[{type:"keypress",target:"relative",relativeTarget:t.relativeTarget,key:"Enter"}]},{when:["pointer"],steps:t=>[{type:"click",target:"relative",relativeTarget:t.relativeTarget}]}],assertion:(t={})=>Br(t.relativeTarget)},"panel.collapsed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(t={})=>Vr(t.relativeTarget)}};function Br(t){return[{target:"panel",assertion:"toBeVisible",controlledBy:{target:"relative",relativeTarget:t},failureMessage:`Expected panel controlled by the ${t} trigger to be visible.`},{target:"relative",relativeTarget:t,assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"true",failureMessage:"Expected trigger to have aria-expanded='true' when panel expands."}]}function Vr(t){return[{target:"panel",assertion:"notToBeVisible",controlledBy:{target:"relative",relativeTarget:t},failureMessage:`Expected panel controlled by the ${t} trigger not to be visible.`},{target:"relative",relativeTarget:t,assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"false",failureMessage:"Expected trigger to have aria-expanded='false' when panel collapses."}]}var ht={"radio.checked":{setup:[{when:["keyboard"],steps:t=>[{type:"keypress",target:"relative",relativeTarget:t.relativeTarget,key:"Space"}]},{when:["pointer"],steps:t=>[{type:"click",target:"relative",relativeTarget:t.relativeTarget}]}],assertion:(t={})=>qr(t.relativeTarget)},"radio.unchecked":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(t={})=>Fr(t.relativeTarget)},"radio.focused":{setup:[{when:["keyboard","pointer"],steps:t=>[{type:"focus",target:"relative",relativeTarget:t.relativeTarget}]}],assertion:(t={})=>Or(t.relativeTarget)}};function qr(t){return[{target:"relative",relativeTarget:t,assertion:"toHaveAttribute",attribute:"aria-checked",expectedValue:"true",failureMessage:"Expected radio to have aria-checked='true' when checked."}]}function Fr(t){return[{target:"relative",relativeTarget:t,assertion:"toHaveAttribute",attribute:"aria-checked",expectedValue:"false",failureMessage:"Expected radio to have aria-checked='false' when unchecked."}]}function Or(t){return[{target:"relative",assertion:"toHaveFocus",relativeTarget:t,failureMessage:`Expected ${ae("radio",t)} to have focus.`}]}var bt={"checkbox.checked":{setup:[{when:["keyboard"],steps:t=>[{type:"keypress",target:"relative",relativeTarget:t.relativeTarget,key:"Space"}]},{when:["pointer"],steps:t=>[{type:"click",target:"relative",relativeTarget:t.relativeTarget}]}],assertion:(t={})=>_r(t.relativeTarget)},"checkbox.unchecked":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(t={})=>Ur(t.relativeTarget)},"checkbox.focused":{setup:[{when:["keyboard","pointer"],steps:t=>[{type:"focus",target:"relative",relativeTarget:t.relativeTarget}]}],assertion:(t={})=>Nr(t.relativeTarget)}};function _r(t){return[{target:"relative",relativeTarget:t,assertion:"toHaveAttribute",attribute:"aria-checked",expectedValue:"true",failureMessage:"Expected checkbox to have aria-checked='true' when checked."}]}function Ur(t){return[{target:"relative",relativeTarget:t,assertion:"toHaveAttribute",attribute:"aria-checked",expectedValue:"false",failureMessage:"Expected checkbox to have aria-checked='false' when unchecked."}]}function Nr(t){return[{target:"relative",assertion:"toHaveFocus",relativeTarget:t,failureMessage:`Expected ${ae("checkbox",t)} to have focus.`}]}function jr(t,e){return e.some(r=>t.capabilities.includes(r))}function $e(t,e){Array.isArray(t)&&t.length&&!t[0].when&&(t=[{when:["keyboard"],steps:()=>t}]);for(let r of t)if(jr(e,r.when))return r.steps(e);throw new Error(`No setup strategy matches capabilities: ${e.capabilities.join(", ")}`)}var Kr={combobox:ft,menu:dt,tabs:gt,accordion:mt,radio:ht,checkbox:bt},_e=class{constructor(e){this.jsonContract=e}toJSON(){return this.jsonContract}},Ue=class{constructor(e){this.componentName=e;this.statePack=Kr[e]||{}}metaValue={};selectorsValue={};relationshipInvariants=[];staticAssertions=[];dynamicTests=[];statePack;meta(e){return this.metaValue=e,this}selectors(e){return this.selectorsValue=e,this}relationships(e){let r=this.statePack,s={capabilities:["keyboard"]},n=(a,o=new Set)=>{if(o.has(a))return[];o.add(a);let l=r[a];if(!l)return[];let u=[];if(Array.isArray(l.requires))for(let f of l.requires)u=u.concat(n(f,o));return l.setup&&(u=u.concat($e(l.setup,s))),u};return e({ariaReference:(a,o,l)=>({requires:u=>{let f=n(u,new Set);return{required:()=>this.relationshipInvariants.push({type:"aria-reference",from:a,attribute:o,to:l,level:"required",setup:f}),optional:()=>this.relationshipInvariants.push({type:"aria-reference",from:a,attribute:o,to:l,level:"optional",setup:f}),recommended:()=>this.relationshipInvariants.push({type:"aria-reference",from:a,attribute:o,to:l,level:"recommended",setup:f})}},required:()=>this.relationshipInvariants.push({type:"aria-reference",from:a,attribute:o,to:l,level:"required"}),optional:()=>this.relationshipInvariants.push({type:"aria-reference",from:a,attribute:o,to:l,level:"optional"}),recommended:()=>this.relationshipInvariants.push({type:"aria-reference",from:a,attribute:o,to:l,level:"recommended"})}),contains:(a,o)=>({requires:l=>{let u=n(l,new Set);return{required:()=>this.relationshipInvariants.push({type:"contains",parent:a,child:o,level:"required",setup:u}),optional:()=>this.relationshipInvariants.push({type:"contains",parent:a,child:o,level:"optional",setup:u}),recommended:()=>this.relationshipInvariants.push({type:"contains",parent:a,child:o,level:"recommended",setup:u})}},required:()=>this.relationshipInvariants.push({type:"contains",parent:a,child:o,level:"required"}),optional:()=>this.relationshipInvariants.push({type:"contains",parent:a,child:o,level:"optional"}),recommended:()=>this.relationshipInvariants.push({type:"contains",parent:a,child:o,level:"recommended"})})}),this}static(e){return e({target:s=>{let n=o=>{let l=this.statePack,u={capabilities:["keyboard"]},f=(y,T=new Set)=>{if(T.has(y))return[];T.add(y);let H=l[y];if(!H)return[];let q=[];if(Array.isArray(H.requires))for(let U of H.requires)q=q.concat(f(U,T));return H.setup&&(q=q.concat($e(H.setup,u))),q};return f(o,new Set)},i=o=>o==="role"?"toHaveRole":"toHaveAttribute",a=(o,l,u)=>{let f=i(o);return{required:()=>this.staticAssertions.push({target:s,assertion:f,attribute:o,expectedValue:l,failureMessage:"",level:"required",setup:u}),optional:()=>this.staticAssertions.push({target:s,assertion:f,attribute:o,expectedValue:l,failureMessage:"",level:"optional",setup:u}),recommended:()=>this.staticAssertions.push({target:s,assertion:f,attribute:o,expectedValue:l,failureMessage:"",level:"recommended",setup:u})}};return{has:(o,l)=>({...a(o,l),requires:f=>{let y=n(f);return a(o,l,y)}})}}}),this}when(e){return new Ne(this,this.statePack,e)}addDynamicTest(e){this.dynamicTests.push(e)}build(){return{meta:this.metaValue,selectors:this.selectorsValue,relationships:this.relationshipInvariants.length?this.relationshipInvariants:void 0,static:this.staticAssertions.length?this.staticAssertions:[],dynamic:this.dynamicTests}}},Ne=class{constructor(e,r,s){this.parent=e;this.statePack=r;this.event=s}_as;_onTarget;_onRelativeTarget;_given=[];_then=[];_desc="";_level="required";_orientation;as(e){return this._as=e,this}on(e,r){return this._onTarget=e,this._onRelativeTarget=r,this}given(e){return this._given=this._normalizeStates(e),this}then(e){return this._then=this._normalizeStates(e),this}orientation(e){return this._orientation=e,this}_normalizeStates(e){return(Array.isArray(e)?e:[e]).flatMap(s=>typeof s=="string"?[s]:typeof s=="object"&&s!==null&&"type"in s&&"ref"in s?this._findStateKeyByTypeAndRef(s.type)?[{type:s.type,ref:s.ref}]:[]:[s])}_findStateKeyByTypeAndRef(e){if(Object.keys(this.statePack).includes(e))return e}describe(e){return this._desc=e,this}required(){return this._level="required",this._finalize(),this.parent}optional(){return this._level="optional",this._finalize(),this.parent}recommended(){return this._level="recommended",this._finalize(),this.parent}_finalize(){let s={capabilities:[{keypress:"keyboard",click:"pointer",type:"textInput",focus:"keyboard",hover:"pointer"}[this._as||"keyboard"]||this._as||"keyboard"]},n=(u,f=new Set)=>{if(f.has(u))return[];f.add(u);let y=this.statePack[u];if(!y)return[];let T=[];if(Array.isArray(y.requires))for(let H of y.requires)T=T.concat(n(H,f));return y.setup&&(T=T.concat($e(y.setup,s))),T},i=[];for(let u of this._given)if(typeof u=="string")i.push(...n(u));else if(typeof u=="object"&&u!==null&&"type"in u&&"ref"in u){let f=this._findStateKeyByTypeAndRef(u.type);if(f){let y=this.statePack[f];if(y&&y.setup)for(let T of y.setup)typeof T.steps=="function"?i.push(...T.steps({relativeTarget:u.ref})):Array.isArray(T.steps)&&i.push(...T.steps)}}let a=new Set;i=i.filter(u=>{let f=JSON.stringify(u);return a.has(f)?!1:(a.add(f),!0)});let o=[];for(let u of this._then)if(typeof u=="string"){let f=this.statePack[u];if(f&&f.assertion!==void 0){let y=f.assertion;if(typeof y=="function")try{y=y()}catch(T){throw new Error(`Error calling assertion function for state '${u}': ${T.message}`)}Array.isArray(y)?o.push(...y):o.push(y)}}else if(typeof u=="object"&&u!==null&&"type"in u&&"ref"in u){let f=this._findStateKeyByTypeAndRef(u.type);if(f){let y=this.statePack[f];if(y&&y.assertion!==void 0){let T=y.assertion;if(typeof T=="function")try{T=T({relativeTarget:u.ref})}catch(H){throw new Error(`Error calling assertion function for state '${f}': ${H.message}`)}Array.isArray(T)?o.push(...T):o.push(T)}}}let l=[{type:this._as,target:this._onTarget,key:this._as==="keypress"?this.event:void 0,relativeTarget:this._onRelativeTarget}];this.parent.addDynamicTest({description:this._desc||"",level:this._level,orientation:this._orientation||"horizontal",action:l,assertions:o,...i.length?{setup:i}:{}})}};function Wr(t,e){let r=new Ue(t);return e(r),new _e(r.build())}je();Ke();var Gt=ne(require("path"),1);async function rt(t,e,r={}){if(!t||typeof t!="string")throw new Error("\u274C testUiComponent requires a valid componentName (string)");if(!e)throw new Error("\u274C testUiComponent requires a URL");if(e&&typeof e!="string")throw new Error("\u274C testUiComponent url parameter must be a string");let s={violations:[]};async function n(f){try{let y=await fetch(f,{method:"HEAD",signal:AbortSignal.timeout(1e3)});if(y.ok||y.status===304)return f}catch{return null}return null}let i=we(r.strictness),a={},o=typeof process<"u"?process.cwd():"";if(typeof process<"u"&&typeof process.cwd=="function")try{let{loadConfig:f}=await Promise.resolve().then(()=>(At(),Tt)),y=await f(process.cwd());if(a=y.config,y.configPath&&(o=Gt.default.dirname(y.configPath)),r.strictness===void 0){let T=a.test?.components?.find(H=>H?.name===t)?.strictness;i=we(T??a.test?.strictness)}}catch{r.strictness===void 0&&(i="balanced")}let l;try{if(e){let f=await n(e);if(f){console.log(`\u{1F3AD} Running Playwright tests on ${f}`);let{runContractTestsPlaywright:y}=await Promise.resolve().then(()=>(Kt(),jt));l=await y(t,f,i,a,o)}else throw new Error(`\u274C Dev server not running at ${e}
65
+ Please start your dev server and try again.`)}else throw new Error("\u274C URL is required for component testing. Please provide a URL to run full accessibility tests with testUiComponent.")}catch(f){throw f instanceof Error?f:new Error(`\u274C Contract test execution failed: ${String(f)}`)}let u={violations:s.violations,raw:s,contract:l};if(l.failures.length>0&&e==="Playwright")throw new Error(`
66
+ \u274C ${l.failures.length} accessibility contract test${l.failures.length>1?"s":""} failed (Playwright mode)
67
+ \u2705 ${l.passes.length} test${l.passes.length>1?"s":""} passed
68
68
 
69
69
  \u{1F4CB} Review the detailed test report above for specific failures.
70
- \u{1F4A1} Contract tests validate ARIA attributes and keyboard interactions per W3C APG guidelines.`);if(r.violations.length>0){let f=r.violations.length,b=r.violations.map(w=>`
71
- - ${w.id}: ${w.description}
72
- Impact: ${w.impact}
73
- Affected elements: ${w.nodes.length}
74
- Help: ${w.helpUrl}`).join(`
70
+ \u{1F4A1} Contract tests validate ARIA attributes and keyboard interactions per W3C APG guidelines.`);if(s.violations.length>0){let f=s.violations.length,y=s.violations.map(T=>`
71
+ - ${T.id}: ${T.description}
72
+ Impact: ${T.impact}
73
+ Affected elements: ${T.nodes.length}
74
+ Help: ${T.helpUrl}`).join(`
75
75
  `);throw new Error(`
76
76
  \u274C ${f} axe accessibility violation${f>1?"s":""} detected
77
- ${b}
77
+ ${y}
78
78
 
79
- \u{1F4CB} Full details available in result.violations`)}return l}var Ut=async()=>({passes:[],failures:[],skipped:[]});typeof window>"u"&&(Ut=async()=>{console.log(`\u{1F680} Running component accessibility tests...
80
- `);let{exec:s}=await import("child_process"),e=(await import("chalk")).default;return new Promise((t,r)=>{s("npx vitest --run --reporter verbose",async(n,i,a)=>{if(console.log(i),a&&console.error(a),!n||n.code===0){try{let{displayBadgeInfo:u,promptAddBadge:l}=await Promise.resolve().then(()=>(Ot(),Ft));u("component"),await l("component",process.cwd()),console.log(e.dim(`
79
+ \u{1F4CB} Full details available in result.violations`)}return u}var Yt=async()=>({passes:[],failures:[],skipped:[]});typeof window>"u"&&(Yt=async()=>{console.log(`\u{1F680} Running component accessibility tests...
80
+ `);let{exec:t}=await import("child_process"),e=(await import("chalk")).default;return new Promise((r,s)=>{t("npx vitest --run --reporter verbose",async(n,i,a)=>{if(console.log(i),a&&console.error(a),!n||n.code===0){try{let{displayBadgeInfo:l,promptAddBadge:u}=await Promise.resolve().then(()=>(Xt(),Jt));l("component"),await u("component",process.cwd()),console.log(e.dim(`
81
81
  `+"\u2500".repeat(60))),console.log(e.cyan("\u{1F499} Found aria-ease helpful?")),console.log(e.white(" \u2022 Star us on GitHub: ")+e.blue.underline("https://github.com/aria-ease/aria-ease")),console.log(e.white(" \u2022 Share feedback: ")+e.blue.underline("https://github.com/aria-ease/aria-ease/discussions")),console.log(e.dim("\u2500".repeat(60)+`
82
- `))}catch(u){console.error("Warning: Could not display badge prompt:",u)}t({passes:[],failures:[],skipped:[]}),process.exit(0)}else{let u=n?.code||1;r(new Error(`Tests failed with code ${u}`)),process.exit(u)}})})});async function et(){await mt()}0&&(module.exports={cleanupTests,createContract,makeAccordionAccessible,makeBlockAccessible,makeCheckboxAccessible,makeComboboxAccessible,makeMenuAccessible,makeRadioAccessible,makeTabsAccessible,makeToggleAccessible,testUiComponent});
82
+ `))}catch(l){console.error("Warning: Could not display badge prompt:",l)}r({passes:[],failures:[],skipped:[]}),process.exit(0)}else{let l=n?.code||1;s(new Error(`Tests failed with code ${l}`)),process.exit(l)}})})});async function st(){await wt()}0&&(module.exports={cleanupTests,createContract,makeAccordionAccessible,makeBlockAccessible,makeCheckboxAccessible,makeComboboxAccessible,makeMenuAccessible,makeRadioAccessible,makeTabsAccessible,makeToggleAccessible,testUiComponent});