aria-ease 7.0.1 → 7.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ComboboxComponentStrategy-DHZS4NW6.js +5 -0
- package/dist/MenuComponentStrategy-L3QXLC6S.js +5 -0
- package/dist/RelativeTargetResolver-PDJM3ZJI.js +1 -0
- package/dist/TabsComponentStrategy-LKV6D2B7.js +1 -0
- package/dist/chunk-WIWSYIGK.js +1 -0
- package/dist/cli.cjs +61 -61
- package/dist/cli.js +1 -1
- package/dist/contractTestRunnerPlaywright-2CEH3GPM.js +46 -0
- package/dist/contractTestRunnerPlaywright-RUKMUY5P.js +46 -0
- package/dist/index.cjs +41 -41
- package/dist/index.d.cts +35 -11
- package/dist/index.d.ts +35 -11
- package/dist/index.js +14 -14
- package/dist/src/utils/test/ComboboxComponentStrategy-5AWO63DA.js +5 -0
- package/dist/src/utils/test/MenuComponentStrategy-QHVBLUBR.js +5 -0
- package/dist/src/utils/test/RelativeTargetResolver-5SIQLWPN.js +1 -0
- package/dist/src/utils/test/TabsComponentStrategy-DTQQUCK2.js +1 -0
- package/dist/src/utils/test/chunk-WIWSYIGK.js +1 -0
- package/dist/src/utils/test/contractTestRunnerPlaywright-LUWM3RIL.js +46 -0
- package/dist/src/utils/test/dsl/index.cjs +1 -1
- package/dist/src/utils/test/dsl/index.d.cts +35 -11
- package/dist/src/utils/test/dsl/index.d.ts +35 -11
- package/dist/src/utils/test/dsl/index.js +1 -1
- package/dist/src/utils/test/index.cjs +36 -36
- package/dist/src/utils/test/index.js +1 -1
- package/dist/{test-VXSCSKV5.js → test-PCRWMQUO.js} +1 -1
- package/package.json +2 -2
- package/dist/ComboboxComponentStrategy-YSYLR2U5.js +0 -5
- package/dist/MenuComponentStrategy-C22BZEBH.js +0 -5
- package/dist/RelativeTargetResolver-T4P25J2M.js +0 -1
- package/dist/TabsComponentStrategy-ADEEFJXM.js +0 -1
- package/dist/chunk-BHNO4ZI3.js +0 -1
- package/dist/contractTestRunnerPlaywright-FOCQTM4L.js +0 -46
- package/dist/contractTestRunnerPlaywright-QPU6HZXG.js +0 -46
- package/dist/src/utils/test/ComboboxComponentStrategy-SICWLI27.js +0 -5
- package/dist/src/utils/test/MenuComponentStrategy-R4VPAHDE.js +0 -5
- package/dist/src/utils/test/RelativeTargetResolver-UQQMZHI6.js +0 -1
- package/dist/src/utils/test/TabsComponentStrategy-L2PYNEW6.js +0 -1
- package/dist/src/utils/test/chunk-BHNO4ZI3.js +0 -1
- package/dist/src/utils/test/contractTestRunnerPlaywright-YZCMF64Q.js +0 -46
package/dist/index.d.cts
CHANGED
|
@@ -195,10 +195,21 @@ declare function makeComboboxAccessible({ comboboxInputId, comboboxButtonId, lis
|
|
|
195
195
|
declare function makeTabsAccessible({ tabListId, tabsClass, tabPanelsClass, orientation, activateOnFocus, callback }: TabsConfig): AccessibilityInstance;
|
|
196
196
|
|
|
197
197
|
type StatePack = Record<string, {
|
|
198
|
-
setup?:
|
|
199
|
-
|
|
198
|
+
setup?: Array<{
|
|
199
|
+
when: string[];
|
|
200
|
+
steps: ((arg?: {
|
|
201
|
+
relativeTarget?: string | number;
|
|
202
|
+
}) => DynamicAction[]) | DynamicAction[];
|
|
203
|
+
}>;
|
|
204
|
+
assertion?: ((arg?: {
|
|
205
|
+
relativeTarget?: string | number;
|
|
206
|
+
}) => DynamicAssertion[] | DynamicAssertion) | DynamicAssertion[] | DynamicAssertion;
|
|
200
207
|
requires?: string[];
|
|
201
208
|
}>;
|
|
209
|
+
type RelativeState = {
|
|
210
|
+
type: string;
|
|
211
|
+
ref: string | number;
|
|
212
|
+
};
|
|
202
213
|
type Level = "required" | "recommended" | "optional";
|
|
203
214
|
type ContractMeta = {
|
|
204
215
|
id?: string;
|
|
@@ -229,9 +240,10 @@ type RelationshipInvariant = {
|
|
|
229
240
|
};
|
|
230
241
|
type StaticAssertion = {
|
|
231
242
|
target: string;
|
|
243
|
+
assertion: "toBeVisible" | "notToBeVisible" | "toHaveAttribute" | "toHaveValue" | "toHaveFocus" | "notToHaveFocus" | "toHaveRole";
|
|
232
244
|
attribute: string;
|
|
233
245
|
expectedValue?: string;
|
|
234
|
-
failureMessage
|
|
246
|
+
failureMessage?: string;
|
|
235
247
|
level: Level;
|
|
236
248
|
requires?: string;
|
|
237
249
|
setup?: DynamicAction[];
|
|
@@ -242,7 +254,7 @@ type DynamicAssertion = {
|
|
|
242
254
|
attribute?: string;
|
|
243
255
|
expectedValue?: string;
|
|
244
256
|
failureMessage?: string;
|
|
245
|
-
relativeTarget?: string;
|
|
257
|
+
relativeTarget?: string | number;
|
|
246
258
|
virtualId?: string;
|
|
247
259
|
selectorKey?: string;
|
|
248
260
|
level?: Level;
|
|
@@ -250,17 +262,18 @@ type DynamicAssertion = {
|
|
|
250
262
|
type DynamicAction = {
|
|
251
263
|
type: "focus";
|
|
252
264
|
target: string;
|
|
253
|
-
relativeTarget?: "first" | "last" | "next" | "previous";
|
|
265
|
+
relativeTarget?: "first" | "last" | "next" | "previous" | number;
|
|
254
266
|
virtualId?: string;
|
|
255
267
|
} | {
|
|
256
|
-
type: "click" | "keypress" | "type" | "hover";
|
|
268
|
+
type: "click" | "keypress" | "type" | "hover" | "focus";
|
|
257
269
|
target: string;
|
|
258
270
|
key?: string;
|
|
259
271
|
value?: string;
|
|
260
|
-
relativeTarget?: string;
|
|
272
|
+
relativeTarget?: string | number;
|
|
261
273
|
};
|
|
262
274
|
type DynamicTest = {
|
|
263
275
|
description: string;
|
|
276
|
+
orientation?: "vertical" | "horizontal";
|
|
264
277
|
level?: Level;
|
|
265
278
|
action: DynamicAction[];
|
|
266
279
|
assertions: DynamicAssertion[];
|
|
@@ -335,16 +348,27 @@ declare class DynamicTestBuilder {
|
|
|
335
348
|
private statePack;
|
|
336
349
|
private event;
|
|
337
350
|
private _as;
|
|
338
|
-
private
|
|
351
|
+
private _onTarget;
|
|
352
|
+
private _onRelativeTarget;
|
|
339
353
|
private _given;
|
|
340
354
|
private _then;
|
|
341
355
|
private _desc;
|
|
342
356
|
private _level;
|
|
357
|
+
private _orientation;
|
|
343
358
|
constructor(parent: ContractBuilder, statePack: StatePack, event: string);
|
|
344
359
|
as(actionType: string): this;
|
|
345
|
-
on(target: string): this;
|
|
346
|
-
given(states: string | string[]): this;
|
|
347
|
-
then(states: string | string[]): this;
|
|
360
|
+
on(target: string, relativeTarget?: string | number): this;
|
|
361
|
+
given(states: string | string[] | RelativeState | RelativeState[]): this;
|
|
362
|
+
then(states: string | string[] | RelativeState | RelativeState[]): this;
|
|
363
|
+
orientation(orientation: "vertical" | "horizontal"): this;
|
|
364
|
+
/**
|
|
365
|
+
* Normalize states to an array of string or resolved state keys from relative state objects.
|
|
366
|
+
*/
|
|
367
|
+
private _normalizeStates;
|
|
368
|
+
/**
|
|
369
|
+
* Find a generic state key in the state pack by type.
|
|
370
|
+
*/
|
|
371
|
+
private _findStateKeyByTypeAndRef;
|
|
348
372
|
describe(desc: string): this;
|
|
349
373
|
required(): ContractBuilder;
|
|
350
374
|
optional(): ContractBuilder;
|
package/dist/index.d.ts
CHANGED
|
@@ -195,10 +195,21 @@ declare function makeComboboxAccessible({ comboboxInputId, comboboxButtonId, lis
|
|
|
195
195
|
declare function makeTabsAccessible({ tabListId, tabsClass, tabPanelsClass, orientation, activateOnFocus, callback }: TabsConfig): AccessibilityInstance;
|
|
196
196
|
|
|
197
197
|
type StatePack = Record<string, {
|
|
198
|
-
setup?:
|
|
199
|
-
|
|
198
|
+
setup?: Array<{
|
|
199
|
+
when: string[];
|
|
200
|
+
steps: ((arg?: {
|
|
201
|
+
relativeTarget?: string | number;
|
|
202
|
+
}) => DynamicAction[]) | DynamicAction[];
|
|
203
|
+
}>;
|
|
204
|
+
assertion?: ((arg?: {
|
|
205
|
+
relativeTarget?: string | number;
|
|
206
|
+
}) => DynamicAssertion[] | DynamicAssertion) | DynamicAssertion[] | DynamicAssertion;
|
|
200
207
|
requires?: string[];
|
|
201
208
|
}>;
|
|
209
|
+
type RelativeState = {
|
|
210
|
+
type: string;
|
|
211
|
+
ref: string | number;
|
|
212
|
+
};
|
|
202
213
|
type Level = "required" | "recommended" | "optional";
|
|
203
214
|
type ContractMeta = {
|
|
204
215
|
id?: string;
|
|
@@ -229,9 +240,10 @@ type RelationshipInvariant = {
|
|
|
229
240
|
};
|
|
230
241
|
type StaticAssertion = {
|
|
231
242
|
target: string;
|
|
243
|
+
assertion: "toBeVisible" | "notToBeVisible" | "toHaveAttribute" | "toHaveValue" | "toHaveFocus" | "notToHaveFocus" | "toHaveRole";
|
|
232
244
|
attribute: string;
|
|
233
245
|
expectedValue?: string;
|
|
234
|
-
failureMessage
|
|
246
|
+
failureMessage?: string;
|
|
235
247
|
level: Level;
|
|
236
248
|
requires?: string;
|
|
237
249
|
setup?: DynamicAction[];
|
|
@@ -242,7 +254,7 @@ type DynamicAssertion = {
|
|
|
242
254
|
attribute?: string;
|
|
243
255
|
expectedValue?: string;
|
|
244
256
|
failureMessage?: string;
|
|
245
|
-
relativeTarget?: string;
|
|
257
|
+
relativeTarget?: string | number;
|
|
246
258
|
virtualId?: string;
|
|
247
259
|
selectorKey?: string;
|
|
248
260
|
level?: Level;
|
|
@@ -250,17 +262,18 @@ type DynamicAssertion = {
|
|
|
250
262
|
type DynamicAction = {
|
|
251
263
|
type: "focus";
|
|
252
264
|
target: string;
|
|
253
|
-
relativeTarget?: "first" | "last" | "next" | "previous";
|
|
265
|
+
relativeTarget?: "first" | "last" | "next" | "previous" | number;
|
|
254
266
|
virtualId?: string;
|
|
255
267
|
} | {
|
|
256
|
-
type: "click" | "keypress" | "type" | "hover";
|
|
268
|
+
type: "click" | "keypress" | "type" | "hover" | "focus";
|
|
257
269
|
target: string;
|
|
258
270
|
key?: string;
|
|
259
271
|
value?: string;
|
|
260
|
-
relativeTarget?: string;
|
|
272
|
+
relativeTarget?: string | number;
|
|
261
273
|
};
|
|
262
274
|
type DynamicTest = {
|
|
263
275
|
description: string;
|
|
276
|
+
orientation?: "vertical" | "horizontal";
|
|
264
277
|
level?: Level;
|
|
265
278
|
action: DynamicAction[];
|
|
266
279
|
assertions: DynamicAssertion[];
|
|
@@ -335,16 +348,27 @@ declare class DynamicTestBuilder {
|
|
|
335
348
|
private statePack;
|
|
336
349
|
private event;
|
|
337
350
|
private _as;
|
|
338
|
-
private
|
|
351
|
+
private _onTarget;
|
|
352
|
+
private _onRelativeTarget;
|
|
339
353
|
private _given;
|
|
340
354
|
private _then;
|
|
341
355
|
private _desc;
|
|
342
356
|
private _level;
|
|
357
|
+
private _orientation;
|
|
343
358
|
constructor(parent: ContractBuilder, statePack: StatePack, event: string);
|
|
344
359
|
as(actionType: string): this;
|
|
345
|
-
on(target: string): this;
|
|
346
|
-
given(states: string | string[]): this;
|
|
347
|
-
then(states: string | string[]): this;
|
|
360
|
+
on(target: string, relativeTarget?: string | number): this;
|
|
361
|
+
given(states: string | string[] | RelativeState | RelativeState[]): this;
|
|
362
|
+
then(states: string | string[] | RelativeState | RelativeState[]): this;
|
|
363
|
+
orientation(orientation: "vertical" | "horizontal"): this;
|
|
364
|
+
/**
|
|
365
|
+
* Normalize states to an array of string or resolved state keys from relative state objects.
|
|
366
|
+
*/
|
|
367
|
+
private _normalizeStates;
|
|
368
|
+
/**
|
|
369
|
+
* Find a generic state key in the state pack by type.
|
|
370
|
+
*/
|
|
371
|
+
private _findStateKeyByTypeAndRef;
|
|
348
372
|
describe(desc: string): this;
|
|
349
373
|
required(): ContractBuilder;
|
|
350
374
|
optional(): ContractBuilder;
|
package/dist/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import{b as U,d as V}from"./chunk-APUMBDOT.js";import"./chunk-CNU4N4AY.js";function Te({accordionId:r,triggersClass:t,panelsClass:m,allowMultipleOpen:i=!1,callback:a}){if(r==="")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 o=document.querySelector(`#${r}`);if(!o)return console.error(`[aria-ease] Element with id="${r}" not found. Make sure the accordion container exists before calling makeAccordionAccessible.`),{cleanup:()=>{}};if(t==="")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 e=Array.from(o.querySelectorAll(`.${t}`));if(e.length===0)return console.error(`[aria-ease] No elements with class="${t}" found. Make sure accordion triggers exist before calling makeAccordionAccessible.`),{cleanup:()=>{}};if(m==="")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 n=Array.from(o.querySelectorAll(`.${m}`));if(n.length===0)return console.error(`[aria-ease] No elements with class="${m}" found. Make sure accordion panels exist before calling makeAccordionAccessible.`),{cleanup:()=>{}};if(e.length!==n.length)return console.error(`[aria-ease] Accordion trigger/panel mismatch: found ${e.length} triggers but ${n.length} panels.`),{cleanup:()=>{}};let s=new WeakMap,u=new WeakMap;function f(){e.forEach((h,T)=>{let H=n[T];h.id||(h.id=`${r}-trigger-${T}`),H.id||(H.id=`${r}-panel-${T}`),h.setAttribute("aria-controls",H.id),h.setAttribute("aria-expanded","false"),(!i||e.length<=6)&&H.setAttribute("role","region"),H.setAttribute("aria-labelledby",h.id),H.style.display="none"})}function y(h){if(h<0||h>=e.length){console.error(`[aria-ease] Invalid accordion index: ${h}`);return}let T=e[h],H=n[h];if(T.setAttribute("aria-expanded","true"),H.style.display="block",a?.onExpand)try{a.onExpand(h)}catch(d){console.error("[aria-ease] Error in accordion onExpand callback:",d)}}function k(h){if(h<0||h>=e.length){console.error(`[aria-ease] Invalid accordion index: ${h}`);return}let T=e[h],H=n[h];if(T.setAttribute("aria-expanded","false"),H.style.display="none",a?.onCollapse)try{a.onCollapse(h)}catch(d){console.error("[aria-ease] Error in accordion onCollapse callback:",d)}}function L(h){e[h].getAttribute("aria-expanded")==="true"?k(h):(i||e.forEach((d,E)=>{E!==h&&k(E)}),y(h))}function $(h){return()=>{L(h)}}function S(h){return T=>{let{key:H}=T;switch(H){case"Enter":case" ":T.preventDefault(),L(h);break;case"ArrowDown":T.preventDefault();{let d=(h+1)%e.length;e[d].focus()}break;case"ArrowUp":T.preventDefault();{let d=(h-1+e.length)%e.length;e[d].focus()}break;case"Home":T.preventDefault(),e[0].focus();break;case"End":T.preventDefault(),e[e.length-1].focus();break}}}function c(){e.forEach((h,T)=>{let H=$(T),d=S(T);h.addEventListener("click",H),h.addEventListener("keydown",d),s.set(h,d),u.set(h,H)})}function l(){e.forEach(h=>{let T=s.get(h),H=u.get(h);T&&(h.removeEventListener("keydown",T),s.delete(h)),H&&(h.removeEventListener("click",H),u.delete(h))})}function A(){l(),e.forEach((h,T)=>{k(T)})}function C(){l();let h=Array.from(o.querySelectorAll(`.${t}`)),T=Array.from(o.querySelectorAll(`.${m}`));e.length=0,e.push(...h),n.length=0,n.push(...T),f(),c()}return f(),c(),{expandItem:y,collapseItem:k,toggleItem:L,cleanup:A,refresh:C}}function O(r){if(r.tagName!=="INPUT")return!1;let t=r.type;return["text","email","password","tel","number"].includes(t)}function N(r){return r.tagName==="TEXTAREA"}function z(r){return r.tagName==="BUTTON"||r.tagName==="INPUT"&&["button","submit","reset"].includes(r.type)}function ee(r){return r.tagName==="A"}function R(r,t,m){let i=r.length,a=(t+m+i)%i;r.item(a).focus()}function te(r){return r.getAttribute("data-custom-click")!==null&&r.getAttribute("data-custom-click")!==void 0}function W(r,t,m){let i=t.item(m);switch(r.key){case"ArrowUp":case"ArrowLeft":{(!O(i)&&!N(i)||(O(i)||N(i))&&i.selectionStart===0)&&(r.preventDefault(),R(t,m,-1));break}case"ArrowDown":case"ArrowRight":{if(!O(i)&&!N(i))r.preventDefault(),R(t,m,1);else if(O(i)||N(i)){let a=i.value;i.selectionStart===a.length&&(r.preventDefault(),R(t,m,1))}break}case"Escape":{r.preventDefault();break}case"Enter":case" ":{(!z(i)&&!ee(i)&&te(i)||z(i))&&(r.preventDefault(),i.click());break}case"Tab":break;default:break}}function Se({blockId:r,blockItemsClass:t}){if(r==="")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 m=document.querySelector(`#${r}`);if(!m)return console.error(`[aria-ease] Element with id="${r}" not found. Make sure the block element exists before calling makeBlockAccessible.`),{cleanup:()=>{}};if(t==="")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 i=null;function a(){return i||(i=m.querySelectorAll(`.${t}`)),i}let o=a();if(!o||o.length===0)return console.error(`[aria-ease] Element with class="${t}" not found. Make sure the block items exist before calling makeBlockAccessible.`),{cleanup:()=>{}};let e=new Map;o.forEach(u=>{if(!e.has(u)){let f=y=>{let k=m.querySelectorAll(`.${t}`),L=Array.prototype.indexOf.call(k,u);W(y,k,L)};u.addEventListener("keydown",f),e.set(u,f)}});function n(){o.forEach(u=>{let f=e.get(u);f&&(u.removeEventListener("keydown",f),e.delete(u))})}function s(){i=null}return{cleanup:n,refresh:s}}function $e({checkboxGroupId:r,checkboxesClass:t}){if(r==="")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 m=document.querySelector(`#${r}`);if(!m)return console.error(`[aria-ease] Element with id="${r}" not found. Make sure the checkbox group container exists before calling makeCheckboxAccessible.`),{cleanup:()=>{}};if(t==="")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 i=Array.from(m.querySelectorAll(`.${t}`));if(i.length===0)return console.error(`[aria-ease] No elements with class="${t}" found. Make sure checkboxes exist before calling makeCheckboxAccessible.`),{cleanup:()=>{}};let a=new WeakMap,o=new WeakMap;function e(){m.getAttribute("role")||m.setAttribute("role","group"),i.forEach(c=>{c.setAttribute("role","checkbox"),c.hasAttribute("aria-checked")||c.setAttribute("aria-checked","false"),c.hasAttribute("tabindex")||c.setAttribute("tabindex","0")})}function n(c){if(c<0||c>=i.length){console.error(`[aria-ease] Invalid checkbox index: ${c}`);return}let l=i[c],A=l.getAttribute("aria-checked")==="true";l.setAttribute("aria-checked",A?"false":"true")}function s(c,l){if(c<0||c>=i.length){console.error(`[aria-ease] Invalid checkbox index: ${c}`);return}i[c].setAttribute("aria-checked",l?"true":"false")}function u(c){return()=>{n(c)}}function f(c){return l=>{let{key:A}=l;switch(A){case" ":l.preventDefault(),n(c);break}}}function y(){i.forEach((c,l)=>{let A=u(l),C=f(l);c.addEventListener("click",A),c.addEventListener("keydown",C),a.set(c,C),o.set(c,A)})}function k(){i.forEach(c=>{let l=a.get(c),A=o.get(c);l&&(c.removeEventListener("keydown",l),a.delete(c)),A&&(c.removeEventListener("click",A),o.delete(c))})}function L(){k()}function $(){return i.map(c=>c.getAttribute("aria-checked")==="true")}function S(){return i.map((c,l)=>c.getAttribute("aria-checked")==="true"?l:-1).filter(c=>c!==-1)}return e(),y(),{toggleCheckbox:n,setCheckboxState:s,getCheckedStates:$,getCheckedIndices:S,cleanup:L}}function ne({menuId:r,menuItemsClass:t,triggerId:m,callback:i}){if(r==="")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 a=document.querySelector(`#${r}`);if(!a)return console.error(`[aria-ease] Element with id="${r}" not found. Make sure the menu element exists before calling makeMenuAccessible.`),{openMenu:()=>{},closeMenu:()=>{},cleanup:()=>{}};if(m==="")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 o=document.querySelector(`#${m}`);if(!o)return console.error(`[aria-ease] Element with id="${m}" not found. Make sure the trigger button element exists before calling makeMenuAccessible.`),{openMenu:()=>{},closeMenu:()=>{},cleanup:()=>{}};if(t==="")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(r))return console.error("[aria-ease] Invalid menuId: must be alphanumeric"),{openMenu:()=>{},closeMenu:()=>{},cleanup:()=>{}};o.setAttribute("aria-haspopup","true"),o.setAttribute("aria-controls",r),o.setAttribute("aria-expanded","false"),a.setAttribute("role","menu"),a.setAttribute("aria-labelledby",m);let e=new WeakMap,n=new Map,s=null,u=null;function f(){return s||(s=a.querySelectorAll(`.${t}`)),s}function y(){if(!u){let b=f();u=[];for(let g=0;g<b.length;g++){let x=b.item(g),D=C(x),P=x.getAttribute("aria-disabled")==="true";D||(x.hasAttribute("tabindex")||x.setAttribute("tabindex","-1"),P||u.push(x))}}return u}function k(b){return{length:b.length,item:x=>b[x],forEach:x=>{b.forEach(x)},[Symbol.iterator]:function*(){for(let x of b)yield x}}}function L(){f().forEach(g=>{g.setAttribute("role","menuitem");let x=g.getAttribute("data-submenu-id")??g.getAttribute("aria-controls"),D=g.hasAttribute("aria-haspopup")&&x;x&&(g.hasAttribute("data-submenu-id")||D)&&(g.setAttribute("aria-haspopup","menu"),g.setAttribute("aria-controls",x),g.hasAttribute("aria-expanded")||g.setAttribute("aria-expanded","false"))})}function $(b,g,x){let D=b.length,P=(g+x+D)%D;b.item(P).focus()}function S(b,g){b.length!==0&&b[g]?.focus()}function c(b){return b.hasAttribute("aria-controls")&&b.hasAttribute("aria-haspopup")&&b.getAttribute("role")==="menuitem"}function l(b){let g=b;for(;g&&g.getAttribute("role")==="menuitem";){let x=g.closest('[role="menu"]');if(!x)break;x.style.display="none",g.setAttribute("aria-expanded","false");let D=x.getAttribute("aria-labelledby");if(!D)break;let P=document.getElementById(D);if(!P)break;g=P}}L();function A(b,g,x){switch(b.key){case"ArrowLeft":{if(b.key==="ArrowLeft"&&o.getAttribute("role")==="menuitem"){b.preventDefault(),p();return}break}case"ArrowUp":{b.preventDefault(),$(k(y()),x,-1);break}case"ArrowRight":{if(b.key==="ArrowRight"&&c(g)){b.preventDefault();let D=g.getAttribute("aria-controls");if(D){T(D);return}}break}case"ArrowDown":{b.preventDefault(),$(k(y()),x,1);break}case"Home":{b.preventDefault(),S(y(),0);break}case"End":{b.preventDefault();let D=y();S(D,D.length-1);break}case"Escape":{b.preventDefault(),p(),o.focus(),H&&H(!1);break}case"Enter":case" ":{if(b.preventDefault(),c(g)){let D=g.getAttribute("aria-controls");if(D){T(D);return}}g.click(),p(),H&&H(!1);break}case"Tab":{p(),l(o),H&&H(!1);break}default:break}}function C(b){let g=b.parentElement;for(;g&&g!==a;){if(g.getAttribute("role")==="menu"||g.id&&a.querySelector(`[aria-controls="${g.id}"]`))return!0;g=g.parentElement}return!1}function h(b){o.setAttribute("aria-expanded",b?"true":"false")}function T(b){let g=n.get(b);if(!g){let x=a.querySelector(`[aria-controls="${b}"]`);if(!x){console.error(`[aria-ease] Submenu trigger with aria-controls="${b}" not found in menu "${r}".`);return}if(!x.id){let P=`trigger-${b}`;x.id=P,console.warn(`[aria-ease] Submenu trigger for "${b}" had no ID. Auto-generated ID: "${P}".`)}if(!document.querySelector(`#${b}`)){console.error(`[aria-ease] Submenu element with id="${b}" not found. Cannot create submenu instance.`);return}g=ne({menuId:b,menuItemsClass:t,triggerId:x.id,callback:i}),n.set(b,g)}g.openMenu()}function H(b){if(i?.onOpenChange)try{i.onOpenChange(b)}catch(g){console.error("[aria-ease] Error in menu onOpenChange callback:",g)}}function d(){y().forEach((g,x)=>{if(!e.has(g)){let D=P=>A(P,g,x);g.addEventListener("keydown",D),e.set(g,D)}})}function E(){y().forEach(g=>{let x=e.get(g);x&&(g.removeEventListener("keydown",x),e.delete(g))})}function w(){h(!0),a.style.display="block";let b=y();if(d(),b&&b.length>0&&b[0].focus(),i?.onOpenChange)try{i.onOpenChange(!0)}catch(g){console.error("[aria-ease] Error in menu onOpenChange callback:",g)}}function p(){if(n.forEach(b=>b.closeMenu()),h(!1),a.style.display="none",E(),o.focus(),i?.onOpenChange)try{i.onOpenChange(!1)}catch(b){console.error("[aria-ease] Error in menu onOpenChange callback:",b)}}function v(){o.getAttribute("aria-expanded")==="true"?p():w()}function M(b){if(!(o.getAttribute("aria-expanded")==="true"))return;let x=o.contains(b.target),D=a.contains(b.target);!x&&!D&&p()}o.addEventListener("click",v),document.addEventListener("click",M);function q(){E(),o.removeEventListener("click",v),document.removeEventListener("click",M),a.style.display="none",h(!1),n.forEach(b=>b.cleanup()),n.clear()}function I(){s=null,u=null}return{openMenu:w,closeMenu:p,cleanup:q,refresh:I}}function Pe({radioGroupId:r,radiosClass:t,defaultSelectedIndex:m=0}){if(r==="")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 i=document.querySelector(`#${r}`);if(!i)return console.error(`[aria-ease] Element with id="${r}" not found. Make sure the radio group container exists before calling makeRadioAccessible.`),{cleanup:()=>{}};if(t==="")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 a=Array.from(i.querySelectorAll(`.${t}`));if(a.length===0)return console.error(`[aria-ease] No elements with class="${t}" found. Make sure radio buttons exist before calling makeRadioAccessible.`),{cleanup:()=>{}};let o=new WeakMap,e=new WeakMap,n=m;function s(){i.getAttribute("role")||i.setAttribute("role","radiogroup"),a.forEach((c,l)=>{c.setAttribute("role","radio"),c.setAttribute("tabindex",l===n?"0":"-1"),l===n?c.setAttribute("aria-checked","true"):c.setAttribute("aria-checked","false")})}function u(c){if(c<0||c>=a.length){console.error(`[aria-ease] Invalid radio index: ${c}`);return}n>=0&&n<a.length&&(a[n].setAttribute("aria-checked","false"),a[n].setAttribute("tabindex","-1")),a[c].setAttribute("aria-checked","true"),a[c].setAttribute("tabindex","0"),a[c].focus(),n=c}function f(c){return()=>{u(c)}}function y(c){return l=>{let{key:A}=l,C=c;switch(A){case"ArrowDown":case"ArrowRight":l.preventDefault(),C=(c+1)%a.length,u(C);break;case"ArrowUp":case"ArrowLeft":l.preventDefault(),C=(c-1+a.length)%a.length,u(C);break;case" ":case"Enter":l.preventDefault(),u(c);break}}}function k(){a.forEach((c,l)=>{let A=f(l),C=y(l);c.addEventListener("click",A),c.addEventListener("keydown",C),o.set(c,C),e.set(c,A)})}function L(){a.forEach(c=>{let l=o.get(c),A=e.get(c);l&&(c.removeEventListener("keydown",l),o.delete(c)),A&&(c.removeEventListener("click",A),e.delete(c))})}function $(){L()}function S(){return n}return s(),k(),{selectRadio:u,getSelectedIndex:S,cleanup:$}}function Ne({toggleId:r,togglesClass:t,isSingleToggle:m=!0}){if(r==="")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 i=document.querySelector(`#${r}`);if(!i)return console.error(`[aria-ease] Element with id="${r}" not found. Make sure the toggle element exists before calling makeToggleAccessible.`),{cleanup:()=>{}};let a;if(m)a=[i];else{if(!t)return console.error("[aria-ease] togglesClass is required when isSingleToggle is false."),{cleanup:()=>{}};if(a=Array.from(i.querySelectorAll(`.${t}`)),a.length===0)return console.error(`[aria-ease] No elements with class="${t}" found. Make sure toggle buttons exist before calling makeToggleAccessible.`),{cleanup:()=>{}}}let o=new WeakMap,e=new WeakMap;function n(){a.forEach(l=>{l.tagName.toLowerCase()!=="button"&&!l.getAttribute("role")&&l.setAttribute("role","button"),l.hasAttribute("aria-pressed")||l.setAttribute("aria-pressed","false"),l.hasAttribute("tabindex")||l.setAttribute("tabindex","0")})}function s(l){if(l<0||l>=a.length){console.error(`[aria-ease] Invalid toggle index: ${l}`);return}let A=a[l],C=A.getAttribute("aria-pressed")==="true";A.setAttribute("aria-pressed",C?"false":"true")}function u(l,A){if(l<0||l>=a.length){console.error(`[aria-ease] Invalid toggle index: ${l}`);return}a[l].setAttribute("aria-pressed",A?"true":"false")}function f(l){return()=>{s(l)}}function y(l){return A=>{let{key:C}=A;switch(C){case"Enter":case" ":A.preventDefault(),s(l);break}}}function k(){a.forEach((l,A)=>{let C=f(A),h=y(A);l.addEventListener("click",C),l.addEventListener("keydown",h),o.set(l,h),e.set(l,C)})}function L(){a.forEach(l=>{let A=o.get(l),C=e.get(l);A&&(l.removeEventListener("keydown",A),o.delete(l)),C&&(l.removeEventListener("click",C),e.delete(l))})}function $(){L()}function S(){return a.map(l=>l.getAttribute("aria-pressed")==="true")}function c(){return a.map((l,A)=>l.getAttribute("aria-pressed")==="true"?A:-1).filter(l=>l!==-1)}return n(),k(),{toggleButton:s,setPressed:u,getPressedStates:S,getPressedIndices:c,cleanup:$}}function Fe({comboboxInputId:r,comboboxButtonId:t,listBoxId:m,listBoxItemsClass:i,callback:a}){if(r==="")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 o=document.getElementById(`${r}`);if(!o)return console.error(`[aria-ease] Element with id="${r}" not found. Make sure the combobox input element exists before calling makeComboboxAccessible.`),{cleanup:()=>{}};if(m==="")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 e=document.getElementById(`${m}`);if(!e)return console.error(`[aria-ease] Element with id="${m}" not found. Make sure the combobox listbox element exists before calling makeComboboxAccessible.`),{cleanup:()=>{}};if(i==="")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(i))return console.error(`[aria-ease] Listbox option(s) with class="${i}" not found. Make sure at least a combobox listbox option exists before calling makeComboboxAccessible.`),{cleanup:()=>{}};let s=t?document.getElementById(`${t}`):null,u=-1;o.setAttribute("role","combobox"),o.setAttribute("aria-autocomplete","list"),o.setAttribute("aria-controls",m),o.setAttribute("aria-expanded","false"),o.setAttribute("aria-haspopup","listbox"),e.setAttribute("role","listbox");let f=null;function y(){return f||(f=e.querySelectorAll(`.${i}`)),Array.from(f).filter(p=>!p.hidden&&p.style.display!=="none")}function k(){return o.getAttribute("aria-expanded")==="true"}function L(p){let v=y();if(p>=0&&p<v.length){let M=v[p],q=M.id||`${m}-option-${p}`;if(M.id||(M.id=q),o.setAttribute("aria-activedescendant",q),typeof M.scrollIntoView=="function"&&M.scrollIntoView({block:"nearest",behavior:"smooth"}),a?.onActiveDescendantChange)try{a.onActiveDescendantChange(q,M)}catch(I){console.error("[aria-ease] Error in combobox onActiveDescendantChange callback:",I)}}else o.setAttribute("aria-activedescendant","");u=p}function $(){if(o.setAttribute("aria-expanded","true"),e.style.display="block",a?.onOpenChange)try{a.onOpenChange(!0)}catch(p){console.error("[aria-ease] Error in combobox onOpenChange callback:",p)}}function S(){if(o.setAttribute("aria-expanded","false"),o.setAttribute("aria-activedescendant",""),e.style.display="none",u=-1,a?.onOpenChange)try{a.onOpenChange(!1)}catch(p){console.error("[aria-ease] Error in combobox onOpenChange callback:",p)}}function c(p){let v=p.textContent?.trim()||"";if(o.value=v,p.setAttribute("aria-selected","true"),S(),a?.onSelect)try{a.onSelect(p)}catch(M){console.error("[aria-ease] Error in combobox onSelect callback:",M)}}function l(p){let v=y(),M=k();switch(p.key){case"ArrowDown":if(p.preventDefault(),!M){$();return}if(v.length===0)return;{let q=u>=v.length-1?0:u+1;L(q)}break;case"ArrowUp":if(p.preventDefault(),!M)return;if(v.length>0){let q=u<=0?v.length-1:u-1;L(q)}break;case"Enter":M&&u>=0&&u<v.length&&(p.preventDefault(),c(v[u]));break;case"Escape":if(M)p.preventDefault(),S();else if(o.value&&(p.preventDefault(),o.value="",o.setAttribute("aria-activedescendant",""),y().forEach(I=>{I.getAttribute("aria-selected")==="true"&&I.setAttribute("aria-selected","false")}),a?.onClear))try{a.onClear()}catch(I){console.error("[aria-ease] Error in combobox onClear callback:",I)}break;case"Home":M&&v.length>0&&(p.preventDefault(),L(0));break;case"End":M&&v.length>0&&(p.preventDefault(),L(v.length-1));break;case"Tab":M&&u>=0&&u<v.length&&c(v[u]),M&&S();break}}function A(p){let v=p.target;if(v.classList.contains(i)){let q=y().indexOf(v);q>=0&&L(q)}}function C(p){let v=p.target;v.classList.contains(i)&&(p.preventDefault(),c(v))}function h(p){let v=p.target;!o.contains(v)&&!e.contains(v)&&(!s||!s.contains(v))&&S()}function T(){k()?S():($(),o.focus())}function H(p){(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),T())}o.addEventListener("keydown",l),e.addEventListener("mousemove",A),e.addEventListener("mousedown",C),document.addEventListener("mousedown",h),s&&(s.setAttribute("tabindex","-1"),s.setAttribute("aria-label","Toggle options"),s.addEventListener("click",T),s.addEventListener("keydown",H));function d(){let p=e.querySelectorAll(`.${i}`);if(p.length===0)return;let v=null;for(let M of p)if(M.getAttribute("aria-selected")==="true"){v=M.textContent?.trim()||null;break}!v&&o.value&&(v=o.value.trim()),p.forEach((M,q)=>{M.setAttribute("role","option");let I=M.textContent?.trim()||"";v&&I===v?M.setAttribute("aria-selected","true"):M.setAttribute("aria-selected","false");let b=M.getAttribute("id");if(!b||b===""){let g=`${m}-option-${q}`;M.id=g,M.setAttribute("id",g)}})}d();function E(){o.removeEventListener("keydown",l),e.removeEventListener("mousemove",A),e.removeEventListener("mousedown",C),document.removeEventListener("mousedown",h),s&&(s.removeEventListener("click",T),s.removeEventListener("keydown",H))}function w(){f=null,d(),u=-1,L(-1)}return{cleanup:E,refresh:w,openListbox:$,closeListbox:S}}function _e({tabListId:r,tabsClass:t,tabPanelsClass:m,orientation:i="horizontal",activateOnFocus:a=!0,callback:o}){if(r==="")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 e=document.querySelector(`#${r}`);if(!e)return console.error(`[aria-ease] Element with id="${r}" not found. Make sure the tab list container exists before calling makeTabsAccessible.`),{cleanup:()=>{}};if(t==="")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 n=Array.from(e.querySelectorAll(`.${t}`));if(n.length===0)return console.error(`[aria-ease] No elements with class="${t}" found. Make sure tab buttons exist before calling makeTabsAccessible.`),{cleanup:()=>{}};if(m==="")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 s=Array.from(document.querySelectorAll(`.${m}`));if(s.length===0)return console.error(`[aria-ease] No elements with class="${m}" found. Make sure tab panels exist before calling makeTabsAccessible.`),{cleanup:()=>{}};if(n.length!==s.length)return console.error(`[aria-ease] Tab/panel mismatch: found ${n.length} tabs but ${s.length} panels.`),{cleanup:()=>{}};let u=new WeakMap,f=new WeakMap,y=new WeakMap,k=0;function L(){e.setAttribute("role","tablist"),e.setAttribute("aria-orientation",i),n.forEach((d,E)=>{let w=s[E];d.id||(d.id=`${r}-tab-${E}`),w.id||(w.id=`${r}-panel-${E}`),d.setAttribute("role","tab"),d.setAttribute("aria-controls",w.id),d.setAttribute("aria-selected","false"),d.setAttribute("tabindex","-1"),w.setAttribute("role","tabpanel"),w.setAttribute("aria-labelledby",d.id),w.hidden=!0,w.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')||w.setAttribute("tabindex","0")}),$(0,!1)}function $(d,E=!0){if(d<0||d>=n.length){console.error(`[aria-ease] Invalid tab index: ${d}`);return}let w=k;n.forEach((M,q)=>{let I=s[q];M.setAttribute("aria-selected","false"),M.setAttribute("tabindex","-1"),I.hidden=!0});let p=n[d],v=s[d];if(p.setAttribute("aria-selected","true"),p.setAttribute("tabindex","0"),v.hidden=!1,E&&p.focus(),k=d,o?.onTabChange&&w!==d)try{o.onTabChange(d,w)}catch(M){console.error("[aria-ease] Error in tabs onTabChange callback:",M)}}function S(d){let E=n.findIndex(v=>v===document.activeElement),w=E!==-1?E:k,p=w;switch(d){case"first":p=0;break;case"last":p=n.length-1;break;case"next":p=(w+1)%n.length;break;case"prev":p=(w-1+n.length)%n.length;break}if(n[p].focus(),n[p].setAttribute("tabindex","0"),n[k].setAttribute("tabindex","-1"),a)$(p,!1);else{let v=k;n.forEach((M,q)=>{q===p?M.setAttribute("tabindex","0"):q!==v&&M.setAttribute("tabindex","-1")})}}function c(d){return()=>{$(d)}}function l(d){return E=>{let{key:w}=E,p=!1;if(i==="horizontal")switch(w){case"ArrowLeft":E.preventDefault(),S("prev"),p=!0;break;case"ArrowRight":E.preventDefault(),S("next"),p=!0;break}else switch(w){case"ArrowUp":E.preventDefault(),S("prev"),p=!0;break;case"ArrowDown":E.preventDefault(),S("next"),p=!0;break}if(!p)switch(w){case"Home":E.preventDefault(),S("first");break;case"End":E.preventDefault(),S("last");break;case" ":case"Enter":a||(E.preventDefault(),$(d));break;case"F10":if(E.shiftKey&&o?.onContextMenu){E.preventDefault();try{o.onContextMenu(d,n[d])}catch(v){console.error("[aria-ease] Error in tabs onContextMenu callback:",v)}}break}}}function A(d){return E=>{if(o?.onContextMenu){E.preventDefault();try{o.onContextMenu(d,n[d])}catch(w){console.error("[aria-ease] Error in tabs onContextMenu callback:",w)}}}}function C(){n.forEach((d,E)=>{let w=c(E),p=l(E),v=A(E);d.addEventListener("click",w),d.addEventListener("keydown",p),o?.onContextMenu&&(d.addEventListener("contextmenu",v),y.set(d,v)),u.set(d,p),f.set(d,w)})}function h(){n.forEach(d=>{let E=u.get(d),w=f.get(d),p=y.get(d);E&&(d.removeEventListener("keydown",E),u.delete(d)),w&&(d.removeEventListener("click",w),f.delete(d)),p&&(d.removeEventListener("contextmenu",p),y.delete(d))})}function T(){h(),n.forEach((d,E)=>{let w=s[E];d.removeAttribute("role"),d.removeAttribute("aria-selected"),d.removeAttribute("aria-controls"),d.removeAttribute("tabindex"),w.removeAttribute("role"),w.removeAttribute("aria-labelledby"),w.removeAttribute("tabindex"),w.hidden=!1}),e.removeAttribute("role"),e.removeAttribute("aria-orientation")}function H(){h();let d=Array.from(e.querySelectorAll(`.${t}`)),E=Array.from(document.querySelectorAll(`.${m}`));n.length=0,n.push(...d),s.length=0,s.push(...E),L(),C()}return L(),C(),{activateTab:$,cleanup:T,refresh:H}}var G={"popup.open":{setup:[{when:["keyboard","textInput"],steps:()=>[{type:"keypress",target:"input",key:"ArrowDown"}]},{when:["pointer"],steps:()=>[{type:"click",target:"button"}]}],assertion:re},"popup.closed":{setup:[{when:["keyboard"],steps:()=>[]},{when:["pointer"],steps:()=>[]}],assertion:[...se(),...J()]},"main.focused":{setup:[{when:["keyboard"],steps:()=>[{type:"focus",target:"main"}]}],assertion:ce},"main.notFocused":{setup:[{when:["keyboard"],steps:()=>[]}],assertion:le},"input.filled":{setup:[{when:["keyboard","textInput"],steps:()=>[{type:"type",target:"input",value:"test"}]}],assertion:ue},"input.notFilled":{setup:[{when:["keyboard","textInput"],steps:()=>[{type:"type",target:"input",value:""}]}],assertion:pe},"activeOption.first":{requires:["popup.open"],setup:[{when:["keyboard"],steps:()=>[{type:"keypress",target:"input",key:"ArrowDown"}]}],assertion:ie},"activeOption.last":{requires:["activeOption.first"],setup:[{when:["keyboard"],steps:()=>[{type:"keypress",target:"input",key:"ArrowUp"}]}],assertion:ae},"activeDescendant.notEmpty":{requires:[],setup:[{when:["keyboard"],steps:()=>[]}],assertion:oe},"activeDescendant.Empty":{requires:[],setup:[{when:["keyboard"],steps:()=>[]}],assertion:J},"selectedOption.first":{requires:["popup.open"],setup:[{when:["pointer"],steps:()=>[{type:"click",target:"relative",relativeTarget:"first"}]}],assertion:()=>j("first")},"selectedOption.last":{requires:["popup.open"],setup:[{when:["pointer"],steps:()=>[{type:"click",target:"relative",relativeTarget:"last"}]}],assertion:()=>j("last")}};function re(){return[{target:"popup",assertion:"toBeVisible",failureMessage:"Expected popup to be visible"},{target:"main",assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"true",failureMessage:"Expect combobox main to have aria-expanded='true'."}]}function se(){return[{target:"popup",assertion:"notToBeVisible",failureMessage:"Expected popup to be closed"},{target:"main",assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"false",failureMessage:"Expect combobox main to have aria-expanded='false'."}]}function ie(){return[{target:"main",assertion:"toHaveAttribute",attribute:"aria-activedescendant",expectedValue:{ref:"relative",relativeTarget:"first",property:"id"},failureMessage:"Expected aria-activedescendant on main to match the id of the first option."}]}function ae(){return[{target:"main",assertion:"toHaveAttribute",attribute:"aria-activedescendant",expectedValue:{ref:"relative",relativeTarget:"last",property:"id"},failureMessage:"Expected aria-activedescendant on main to match the id of the last option."}]}function oe(){return[{target:"main",assertion:"toHaveAttribute",attribute:"aria-activedescendant",expectedValue:"!empty",failureMessage:"Expected aria-activedescendant on main to not be empty."}]}function J(){return[{target:"main",assertion:"toHaveAttribute",attribute:"aria-activedescendant",expectedValue:"",failureMessage:"Expected aria-activedescendant on main to be empty."}]}function j(r){return[{target:"relative",relativeTarget:r,assertion:"toHaveAttribute",attribute:"aria-selected",expectedValue:"true",failureMessage:`Expected ${r} option to have aria-selected='true'.`}]}function ce(){return[{target:"main",assertion:"toHaveFocus",failureMessage:"Expected main to be focused."}]}function le(){return[{target:"main",assertion:"notToHaveFocus",failureMessage:"Expected main to not have focused."}]}function ue(){return[{target:"input",assertion:"toHaveValue",expectedValue:"test",failureMessage:"Expected input to have the value 'test'."}]}function pe(){return[{target:"input",assertion:"toHaveValue",expectedValue:"",failureMessage:"Expected input to have the value ''."}]}var X={"popup.open":{setup:[{when:["keyboard"],steps:()=>[{type:"keypress",target:"main",key:"Enter"}]},{when:["pointer"],steps:()=>[{type:"click",target:"main"}]}],assertion:de},"popup.closed":{setup:[{when:["keyboard"],steps:()=>[]},{when:["pointer"],steps:()=>[]}],assertion:fe},"main.focused":{setup:[{when:["keyboard"],steps:()=>[{type:"focus",target:"main"}]}],assertion:be},"main.notFocused":{setup:[{when:["keyboard"],steps:()=>[]}],assertion:me},"activeItem.first":{requires:["popup.open"],setup:[{when:["keyboard"],steps:()=>[]}],assertion:ge},"activeItem.last":{requires:["popup.open"],setup:[{when:["keyboard"],steps:()=>[{type:"keypress",target:"main",key:"ArrowUp"}]}],assertion:he},"submenu.open":{requires:["popup.open"],setup:[{when:["keyboard"],steps:()=>[{type:"keypress",target:"submenuTrigger",key:"ArrowRight"}]},{when:["pointer"],steps:()=>[{type:"click",target:"submenuTrigger"}]}],assertion:ye},"submenu.closed":{requires:["submenu.open"],setup:[{when:["keyboard"],steps:()=>[{type:"keypress",target:"submenuTrigger",key:"ArrowLeft"}]},{when:["pointer"],steps:()=>[{type:"click",target:"submenuTrigger"}]}],assertion:ve},"submenuTrigger.focused":{setup:[{when:["keyboard"],steps:()=>[{type:"focus",target:"submenuTrigger"}]}],assertion:Ae},"submenuTrigger.notFocused":{setup:[{when:["keyboard"],steps:()=>[]}],assertion:ke},"submenuActiveItem.first":{requires:["submenu.open"],setup:[{when:["keyboard"],steps:()=>[]},{when:["pointer"],steps:()=>[]}],assertion:Ee}};function de(){return[{target:"popup",assertion:"toBeVisible",failureMessage:"Expected popup to be visible"},{target:"main",assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"true",failureMessage:"Expect menu main to have aria-expanded='true'."}]}function fe(){return[{target:"popup",assertion:"notToBeVisible",failureMessage:"Expected popup to be closed"},{target:"main",assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"false",failureMessage:"Expect menu main to have aria-expanded='false'."}]}function be(){return[{target:"main",assertion:"toHaveFocus",failureMessage:"Expected menu main to be focused."}]}function me(){return[{target:"main",assertion:"notToHaveFocus",failureMessage:"Expected menu main to not have focused."}]}function ge(){return[{target:"relative",assertion:"toHaveFocus",expectedValue:"first",failureMessage:"First menu item should have focus."}]}function he(){return[{target:"relative",assertion:"toHaveFocus",expectedValue:"last",failureMessage:"Last menu item should have focus."}]}function ye(){return[{target:"submenu",assertion:"toBeVisible",failureMessage:"Expected submenu to be visible"},{target:"submenuTrigger",assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"true",failureMessage:"Expect submenu trigger to have aria-expanded='true'."}]}function ve(){return[{target:"submenu",assertion:"notToBeVisible",failureMessage:"Expected submenu to be closed"},{target:"submenuTrigger",assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"false",failureMessage:"Expect submenu trigger to have aria-expanded='false'."}]}function Ae(){return[{target:"submenuTrigger",assertion:"toHaveFocus",failureMessage:"Expected submenu trigger to be focused."}]}function ke(){return[{target:"submenuTrigger",assertion:"notToHaveFocus",failureMessage:"Expected submenu trigger to not have focused."}]}function Ee(){return[{target:"submenuItems",assertion:"toHaveFocus",failureMessage:"First interactive item in the submenu should have focus after Right Arrow open the submenu."}]}function Me(r,t){return t.some(m=>r.capabilities.includes(m))}function F(r,t){Array.isArray(r)&&r.length&&!r[0].when&&(r=[{when:["keyboard"],steps:()=>r}]);for(let m of r)if(Me(t,m.when))return m.steps(t);throw new Error(`No setup strategy matches capabilities: ${t.capabilities.join(", ")}`)}var we={combobox:G,menu:X},_=class{constructor(t){this.jsonContract=t}toJSON(){return this.jsonContract}},K=class{constructor(t){this.componentName=t;this.statePack=we[t]||{}}metaValue={};selectorsValue={};relationshipInvariants=[];staticAssertions=[];dynamicTests=[];statePack;meta(t){return this.metaValue=t,this}selectors(t){return this.selectorsValue=t,this}relationships(t){let m=this.statePack,i={capabilities:["keyboard"]},a=(e,n=new Set)=>{if(n.has(e))return[];n.add(e);let s=m[e];if(!s)return[];let u=[];if(Array.isArray(s.requires))for(let f of s.requires)u=u.concat(a(f,n));return s.setup&&(u=u.concat(F(s.setup,i))),u};return t({ariaReference:(e,n,s)=>({requires:u=>{let f=a(u,new Set);return{required:()=>this.relationshipInvariants.push({type:"aria-reference",from:e,attribute:n,to:s,level:"required",setup:f}),optional:()=>this.relationshipInvariants.push({type:"aria-reference",from:e,attribute:n,to:s,level:"optional",setup:f}),recommended:()=>this.relationshipInvariants.push({type:"aria-reference",from:e,attribute:n,to:s,level:"recommended",setup:f})}},required:()=>this.relationshipInvariants.push({type:"aria-reference",from:e,attribute:n,to:s,level:"required"}),optional:()=>this.relationshipInvariants.push({type:"aria-reference",from:e,attribute:n,to:s,level:"optional"}),recommended:()=>this.relationshipInvariants.push({type:"aria-reference",from:e,attribute:n,to:s,level:"recommended"})}),contains:(e,n)=>({requires:s=>{let u=a(s,new Set);return{required:()=>this.relationshipInvariants.push({type:"contains",parent:e,child:n,level:"required",setup:u}),optional:()=>this.relationshipInvariants.push({type:"contains",parent:e,child:n,level:"optional",setup:u}),recommended:()=>this.relationshipInvariants.push({type:"contains",parent:e,child:n,level:"recommended",setup:u})}},required:()=>this.relationshipInvariants.push({type:"contains",parent:e,child:n,level:"required"}),optional:()=>this.relationshipInvariants.push({type:"contains",parent:e,child:n,level:"optional"}),recommended:()=>this.relationshipInvariants.push({type:"contains",parent:e,child:n,level:"recommended"})})}),this}static(t){return t({target:i=>{let a=e=>{let n=this.statePack,s={capabilities:["keyboard"]},u=(f,y=new Set)=>{if(y.has(f))return[];y.add(f);let k=n[f];if(!k)return[];let L=[];if(Array.isArray(k.requires))for(let $ of k.requires)L=L.concat(u($,y));return k.setup&&(L=L.concat(F(k.setup,s))),L};return u(e,new Set)},o=(e,n,s)=>({required:()=>this.staticAssertions.push({target:i,attribute:e,expectedValue:n,failureMessage:"",level:"required",setup:s}),optional:()=>this.staticAssertions.push({target:i,attribute:e,expectedValue:n,failureMessage:"",level:"optional",setup:s}),recommended:()=>this.staticAssertions.push({target:i,attribute:e,expectedValue:n,failureMessage:"",level:"recommended",setup:s})});return{has:(e,n)=>({...o(e,n),requires:u=>{let f=a(u);return o(e,n,f)}})}}}),this}when(t){return new B(this,this.statePack,t)}addDynamicTest(t){this.dynamicTests.push(t)}build(){return{meta:this.metaValue,selectors:this.selectorsValue,relationships:this.relationshipInvariants.length?this.relationshipInvariants:void 0,static:this.staticAssertions.length?[{assertions:this.staticAssertions}]:[],dynamic:this.dynamicTests}}},B=class{constructor(t,m,i){this.parent=t;this.statePack=m;this.event=i}_as;_on;_given=[];_then=[];_desc="";_level="required";as(t){return this._as=t,this}on(t){return this._on=t,this}given(t){return this._given=Array.isArray(t)?t:[t],this}then(t){return this._then=Array.isArray(t)?t:[t],this}describe(t){return this._desc=t,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 i={capabilities:[{keypress:"keyboard",click:"pointer",type:"textInput",focus:"keyboard",hover:"pointer"}[this._as||"keyboard"]||this._as||"keyboard"]},a=(s,u=new Set)=>{if(u.has(s))return[];u.add(s);let f=this.statePack[s];if(!f)return[];let y=[];if(Array.isArray(f.requires))for(let k of f.requires)y=y.concat(a(k,u));return f.setup&&(y=y.concat(F(f.setup,i))),y},o=[];for(let s of this._given)o.push(...a(s));let e=[];for(let s of this._then){let u=this.statePack[s];if(u&&u.assertion!==void 0){let f=u.assertion;if(typeof f=="function")try{f=f()}catch(y){throw new Error(`Error calling assertion function for state '${s}': ${y.message}`)}Array.isArray(f)?e.push(...f):e.push(f)}}let n=[{type:this._as,target:this._on,key:this._as==="keypress"?this.event:void 0}];this.parent.addDynamicTest({description:this._desc||"",level:this._level,action:n,assertions:e,...o.length?{setup:o}:{}})}};function Xe(r,t){let m=new K(r);return t(m),new _(m.build())}import xe from"path";async function Q(r,t,m={}){if(!r||typeof r!="string")throw new Error("\u274C testUiComponent requires a valid componentName (string)");if(!t)throw new Error("\u274C testUiComponent requires a URL");if(t&&typeof t!="string")throw new Error("\u274C testUiComponent url parameter must be a string");let i={violations:[]};async function a(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 o=V(m.strictness),e={},n=typeof process<"u"?process.cwd():"";if(typeof process<"u"&&typeof process.cwd=="function")try{let{loadConfig:f}=await import("./configLoader-ZEJVXLX7.js"),y=await f(process.cwd());if(e=y.config,y.configPath&&(n=xe.dirname(y.configPath)),m.strictness===void 0){let k=e.test?.components?.find(L=>L?.name===r)?.strictness;o=V(k??e.test?.strictness)}}catch{m.strictness===void 0&&(o="balanced")}let s;try{if(t){let f=await a(t);if(f){console.log(`\u{1F3AD} Running Playwright tests on ${f}`);let{runContractTestsPlaywright:y}=await import("./contractTestRunnerPlaywright-QPU6HZXG.js");s=await y(r,f,o,e,n)}else throw new Error(`\u274C Dev server not running at ${t}
|
|
2
|
-
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(
|
|
3
|
-
\u274C ${
|
|
4
|
-
\u2705 ${
|
|
1
|
+
import{b as U,d as B}from"./chunk-APUMBDOT.js";import"./chunk-CNU4N4AY.js";function He({accordionId:e,triggersClass:t,panelsClass:m,allowMultipleOpen:i=!1,callback:o}){if(e==="")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 a=document.querySelector(`#${e}`);if(!a)return console.error(`[aria-ease] Element with id="${e}" not found. Make sure the accordion container exists before calling makeAccordionAccessible.`),{cleanup:()=>{}};if(t==="")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 n=Array.from(a.querySelectorAll(`.${t}`));if(n.length===0)return console.error(`[aria-ease] No elements with class="${t}" found. Make sure accordion triggers exist before calling makeAccordionAccessible.`),{cleanup:()=>{}};if(m==="")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 r=Array.from(a.querySelectorAll(`.${m}`));if(r.length===0)return console.error(`[aria-ease] No elements with class="${m}" found. Make sure accordion panels exist before calling makeAccordionAccessible.`),{cleanup:()=>{}};if(n.length!==r.length)return console.error(`[aria-ease] Accordion trigger/panel mismatch: found ${n.length} triggers but ${r.length} panels.`),{cleanup:()=>{}};let l=new WeakMap,s=new WeakMap;function p(){n.forEach((y,L)=>{let H=r[L];y.id||(y.id=`${e}-trigger-${L}`),H.id||(H.id=`${e}-panel-${L}`),y.setAttribute("aria-controls",H.id),y.setAttribute("aria-expanded","false"),(!i||n.length<=6)&&H.setAttribute("role","region"),H.setAttribute("aria-labelledby",y.id),H.style.display="none"})}function g(y){if(y<0||y>=n.length){console.error(`[aria-ease] Invalid accordion index: ${y}`);return}let L=n[y],H=r[y];if(L.setAttribute("aria-expanded","true"),H.style.display="block",o?.onExpand)try{o.onExpand(y)}catch(f){console.error("[aria-ease] Error in accordion onExpand callback:",f)}}function v(y){if(y<0||y>=n.length){console.error(`[aria-ease] Invalid accordion index: ${y}`);return}let L=n[y],H=r[y];if(L.setAttribute("aria-expanded","false"),H.style.display="none",o?.onCollapse)try{o.onCollapse(y)}catch(f){console.error("[aria-ease] Error in accordion onCollapse callback:",f)}}function x(y){n[y].getAttribute("aria-expanded")==="true"?v(y):(i||n.forEach((f,E)=>{E!==y&&v(E)}),g(y))}function C(y){return()=>{x(y)}}function D(y){return L=>{let{key:H}=L;switch(H){case"Enter":case" ":L.preventDefault(),x(y);break;case"ArrowDown":L.preventDefault();{let f=(y+1)%n.length;n[f].focus()}break;case"ArrowUp":L.preventDefault();{let f=(y-1+n.length)%n.length;n[f].focus()}break;case"Home":L.preventDefault(),n[0].focus();break;case"End":L.preventDefault(),n[n.length-1].focus();break}}}function c(){n.forEach((y,L)=>{let H=C(L),f=D(L);y.addEventListener("click",H),y.addEventListener("keydown",f),l.set(y,f),s.set(y,H)})}function u(){n.forEach(y=>{let L=l.get(y),H=s.get(y);L&&(y.removeEventListener("keydown",L),l.delete(y)),H&&(y.removeEventListener("click",H),s.delete(y))})}function k(){u(),n.forEach((y,L)=>{v(L)})}function S(){u();let y=Array.from(a.querySelectorAll(`.${t}`)),L=Array.from(a.querySelectorAll(`.${m}`));n.length=0,n.push(...y),r.length=0,r.push(...L),p(),c()}return p(),c(),{expandItem:g,collapseItem:v,toggleItem:x,cleanup:k,refresh:S}}function R(e){if(e.tagName!=="INPUT")return!1;let t=e.type;return["text","email","password","tel","number"].includes(t)}function O(e){return e.tagName==="TEXTAREA"}function z(e){return e.tagName==="BUTTON"||e.tagName==="INPUT"&&["button","submit","reset"].includes(e.type)}function ee(e){return e.tagName==="A"}function _(e,t,m){let i=e.length,o=(t+m+i)%i;e.item(o).focus()}function te(e){return e.getAttribute("data-custom-click")!==null&&e.getAttribute("data-custom-click")!==void 0}function W(e,t,m){let i=t.item(m);switch(e.key){case"ArrowUp":case"ArrowLeft":{(!R(i)&&!O(i)||(R(i)||O(i))&&i.selectionStart===0)&&(e.preventDefault(),_(t,m,-1));break}case"ArrowDown":case"ArrowRight":{if(!R(i)&&!O(i))e.preventDefault(),_(t,m,1);else if(R(i)||O(i)){let o=i.value;i.selectionStart===o.length&&(e.preventDefault(),_(t,m,1))}break}case"Escape":{e.preventDefault();break}case"Enter":case" ":{(!z(i)&&!ee(i)&&te(i)||z(i))&&(e.preventDefault(),i.click());break}case"Tab":break;default:break}}function $e({blockId:e,blockItemsClass:t}){if(e==="")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 m=document.querySelector(`#${e}`);if(!m)return console.error(`[aria-ease] Element with id="${e}" not found. Make sure the block element exists before calling makeBlockAccessible.`),{cleanup:()=>{}};if(t==="")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 i=null;function o(){return i||(i=m.querySelectorAll(`.${t}`)),i}let a=o();if(!a||a.length===0)return console.error(`[aria-ease] Element with class="${t}" not found. Make sure the block items exist before calling makeBlockAccessible.`),{cleanup:()=>{}};let n=new Map;a.forEach(s=>{if(!n.has(s)){let p=g=>{let v=m.querySelectorAll(`.${t}`),x=Array.prototype.indexOf.call(v,s);W(g,v,x)};s.addEventListener("keydown",p),n.set(s,p)}});function r(){a.forEach(s=>{let p=n.get(s);p&&(s.removeEventListener("keydown",p),n.delete(s))})}function l(){i=null}return{cleanup:r,refresh:l}}function Ie({checkboxGroupId:e,checkboxesClass:t}){if(e==="")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 m=document.querySelector(`#${e}`);if(!m)return console.error(`[aria-ease] Element with id="${e}" not found. Make sure the checkbox group container exists before calling makeCheckboxAccessible.`),{cleanup:()=>{}};if(t==="")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 i=Array.from(m.querySelectorAll(`.${t}`));if(i.length===0)return console.error(`[aria-ease] No elements with class="${t}" found. Make sure checkboxes exist before calling makeCheckboxAccessible.`),{cleanup:()=>{}};let o=new WeakMap,a=new WeakMap;function n(){m.getAttribute("role")||m.setAttribute("role","group"),i.forEach(c=>{c.setAttribute("role","checkbox"),c.hasAttribute("aria-checked")||c.setAttribute("aria-checked","false"),c.hasAttribute("tabindex")||c.setAttribute("tabindex","0")})}function r(c){if(c<0||c>=i.length){console.error(`[aria-ease] Invalid checkbox index: ${c}`);return}let u=i[c],k=u.getAttribute("aria-checked")==="true";u.setAttribute("aria-checked",k?"false":"true")}function l(c,u){if(c<0||c>=i.length){console.error(`[aria-ease] Invalid checkbox index: ${c}`);return}i[c].setAttribute("aria-checked",u?"true":"false")}function s(c){return()=>{r(c)}}function p(c){return u=>{let{key:k}=u;switch(k){case" ":u.preventDefault(),r(c);break}}}function g(){i.forEach((c,u)=>{let k=s(u),S=p(u);c.addEventListener("click",k),c.addEventListener("keydown",S),o.set(c,S),a.set(c,k)})}function v(){i.forEach(c=>{let u=o.get(c),k=a.get(c);u&&(c.removeEventListener("keydown",u),o.delete(c)),k&&(c.removeEventListener("click",k),a.delete(c))})}function x(){v()}function C(){return i.map(c=>c.getAttribute("aria-checked")==="true")}function D(){return i.map((c,u)=>c.getAttribute("aria-checked")==="true"?u:-1).filter(c=>c!==-1)}return n(),g(),{toggleCheckbox:r,setCheckboxState:l,getCheckedStates:C,getCheckedIndices:D,cleanup:x}}function ne({menuId:e,menuItemsClass:t,triggerId:m,callback:i}){if(e==="")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 o=document.querySelector(`#${e}`);if(!o)return console.error(`[aria-ease] Element with id="${e}" not found. Make sure the menu element exists before calling makeMenuAccessible.`),{openMenu:()=>{},closeMenu:()=>{},cleanup:()=>{}};if(m==="")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 a=document.querySelector(`#${m}`);if(!a)return console.error(`[aria-ease] Element with id="${m}" not found. Make sure the trigger button element exists before calling makeMenuAccessible.`),{openMenu:()=>{},closeMenu:()=>{},cleanup:()=>{}};if(t==="")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(e))return console.error("[aria-ease] Invalid menuId: must be alphanumeric"),{openMenu:()=>{},closeMenu:()=>{},cleanup:()=>{}};a.setAttribute("aria-haspopup","true"),a.setAttribute("aria-controls",e),a.setAttribute("aria-expanded","false"),o.setAttribute("role","menu"),o.setAttribute("aria-labelledby",m);let n=new WeakMap,r=new Map,l=null,s=null;function p(){return l||(l=o.querySelectorAll(`.${t}`)),l}function g(){if(!s){let b=p();s=[];for(let h=0;h<b.length;h++){let M=b.item(h),$=S(M),P=M.getAttribute("aria-disabled")==="true";$||(M.hasAttribute("tabindex")||M.setAttribute("tabindex","-1"),P||s.push(M))}}return s}function v(b){return{length:b.length,item:M=>b[M],forEach:M=>{b.forEach(M)},[Symbol.iterator]:function*(){for(let M of b)yield M}}}function x(){p().forEach(h=>{h.setAttribute("role","menuitem");let M=h.getAttribute("data-submenu-id")??h.getAttribute("aria-controls"),$=h.hasAttribute("aria-haspopup")&&M;M&&(h.hasAttribute("data-submenu-id")||$)&&(h.setAttribute("aria-haspopup","menu"),h.setAttribute("aria-controls",M),h.hasAttribute("aria-expanded")||h.setAttribute("aria-expanded","false"))})}function C(b,h,M){let $=b.length,P=(h+M+$)%$;b.item(P).focus()}function D(b,h){b.length!==0&&b[h]?.focus()}function c(b){return b.hasAttribute("aria-controls")&&b.hasAttribute("aria-haspopup")&&b.getAttribute("role")==="menuitem"}function u(b){let h=b;for(;h&&h.getAttribute("role")==="menuitem";){let M=h.closest('[role="menu"]');if(!M)break;M.style.display="none",h.setAttribute("aria-expanded","false");let $=M.getAttribute("aria-labelledby");if(!$)break;let P=document.getElementById($);if(!P)break;h=P}}x();function k(b,h,M){switch(b.key){case"ArrowLeft":{if(b.key==="ArrowLeft"&&a.getAttribute("role")==="menuitem"){b.preventDefault(),d();return}break}case"ArrowUp":{b.preventDefault(),C(v(g()),M,-1);break}case"ArrowRight":{if(b.key==="ArrowRight"&&c(h)){b.preventDefault();let $=h.getAttribute("aria-controls");if($){L($);return}}break}case"ArrowDown":{b.preventDefault(),C(v(g()),M,1);break}case"Home":{b.preventDefault(),D(g(),0);break}case"End":{b.preventDefault();let $=g();D($,$.length-1);break}case"Escape":{b.preventDefault(),d(),a.focus(),H&&H(!1);break}case"Enter":case" ":{if(b.preventDefault(),c(h)){let $=h.getAttribute("aria-controls");if($){L($);return}}h.click(),d(),H&&H(!1);break}case"Tab":{d(),u(a),H&&H(!1);break}default:break}}function S(b){let h=b.parentElement;for(;h&&h!==o;){if(h.getAttribute("role")==="menu"||h.id&&o.querySelector(`[aria-controls="${h.id}"]`))return!0;h=h.parentElement}return!1}function y(b){a.setAttribute("aria-expanded",b?"true":"false")}function L(b){let h=r.get(b);if(!h){let M=o.querySelector(`[aria-controls="${b}"]`);if(!M){console.error(`[aria-ease] Submenu trigger with aria-controls="${b}" not found in menu "${e}".`);return}if(!M.id){let P=`trigger-${b}`;M.id=P,console.warn(`[aria-ease] Submenu trigger for "${b}" had no ID. Auto-generated ID: "${P}".`)}if(!document.querySelector(`#${b}`)){console.error(`[aria-ease] Submenu element with id="${b}" not found. Cannot create submenu instance.`);return}h=ne({menuId:b,menuItemsClass:t,triggerId:M.id,callback:i}),r.set(b,h)}h.openMenu()}function H(b){if(i?.onOpenChange)try{i.onOpenChange(b)}catch(h){console.error("[aria-ease] Error in menu onOpenChange callback:",h)}}function f(){g().forEach((h,M)=>{if(!n.has(h)){let $=P=>k(P,h,M);h.addEventListener("keydown",$),n.set(h,$)}})}function E(){g().forEach(h=>{let M=n.get(h);M&&(h.removeEventListener("keydown",M),n.delete(h))})}function w(){y(!0),o.style.display="block";let b=g();if(f(),b&&b.length>0&&b[0].focus(),i?.onOpenChange)try{i.onOpenChange(!0)}catch(h){console.error("[aria-ease] Error in menu onOpenChange callback:",h)}}function d(){if(r.forEach(b=>b.closeMenu()),y(!1),o.style.display="none",E(),a.focus(),i?.onOpenChange)try{i.onOpenChange(!1)}catch(b){console.error("[aria-ease] Error in menu onOpenChange callback:",b)}}function A(){a.getAttribute("aria-expanded")==="true"?d():w()}function T(b){if(!(a.getAttribute("aria-expanded")==="true"))return;let M=a.contains(b.target),$=o.contains(b.target);!M&&!$&&d()}a.addEventListener("click",A),document.addEventListener("click",T);function q(){E(),a.removeEventListener("click",A),document.removeEventListener("click",T),o.style.display="none",y(!1),r.forEach(b=>b.cleanup()),r.clear()}function I(){l=null,s=null}return{openMenu:w,closeMenu:d,cleanup:q,refresh:I}}function Oe({radioGroupId:e,radiosClass:t,defaultSelectedIndex:m=0}){if(e==="")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 i=document.querySelector(`#${e}`);if(!i)return console.error(`[aria-ease] Element with id="${e}" not found. Make sure the radio group container exists before calling makeRadioAccessible.`),{cleanup:()=>{}};if(t==="")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 o=Array.from(i.querySelectorAll(`.${t}`));if(o.length===0)return console.error(`[aria-ease] No elements with class="${t}" found. Make sure radio buttons exist before calling makeRadioAccessible.`),{cleanup:()=>{}};let a=new WeakMap,n=new WeakMap,r=m;function l(){i.getAttribute("role")||i.setAttribute("role","radiogroup"),o.forEach((c,u)=>{c.setAttribute("role","radio"),c.setAttribute("tabindex",u===r?"0":"-1"),u===r?c.setAttribute("aria-checked","true"):c.setAttribute("aria-checked","false")})}function s(c){if(c<0||c>=o.length){console.error(`[aria-ease] Invalid radio index: ${c}`);return}r>=0&&r<o.length&&(o[r].setAttribute("aria-checked","false"),o[r].setAttribute("tabindex","-1")),o[c].setAttribute("aria-checked","true"),o[c].setAttribute("tabindex","0"),o[c].focus(),r=c}function p(c){return()=>{s(c)}}function g(c){return u=>{let{key:k}=u,S=c;switch(k){case"ArrowDown":case"ArrowRight":u.preventDefault(),S=(c+1)%o.length,s(S);break;case"ArrowUp":case"ArrowLeft":u.preventDefault(),S=(c-1+o.length)%o.length,s(S);break;case" ":case"Enter":u.preventDefault(),s(c);break}}}function v(){o.forEach((c,u)=>{let k=p(u),S=g(u);c.addEventListener("click",k),c.addEventListener("keydown",S),a.set(c,S),n.set(c,k)})}function x(){o.forEach(c=>{let u=a.get(c),k=n.get(c);u&&(c.removeEventListener("keydown",u),a.delete(c)),k&&(c.removeEventListener("click",k),n.delete(c))})}function C(){x()}function D(){return r}return l(),v(),{selectRadio:s,getSelectedIndex:D,cleanup:C}}function Ve({toggleId:e,togglesClass:t,isSingleToggle:m=!0}){if(e==="")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 i=document.querySelector(`#${e}`);if(!i)return console.error(`[aria-ease] Element with id="${e}" not found. Make sure the toggle element exists before calling makeToggleAccessible.`),{cleanup:()=>{}};let o;if(m)o=[i];else{if(!t)return console.error("[aria-ease] togglesClass is required when isSingleToggle is false."),{cleanup:()=>{}};if(o=Array.from(i.querySelectorAll(`.${t}`)),o.length===0)return console.error(`[aria-ease] No elements with class="${t}" found. Make sure toggle buttons exist before calling makeToggleAccessible.`),{cleanup:()=>{}}}let a=new WeakMap,n=new WeakMap;function r(){o.forEach(u=>{u.tagName.toLowerCase()!=="button"&&!u.getAttribute("role")&&u.setAttribute("role","button"),u.hasAttribute("aria-pressed")||u.setAttribute("aria-pressed","false"),u.hasAttribute("tabindex")||u.setAttribute("tabindex","0")})}function l(u){if(u<0||u>=o.length){console.error(`[aria-ease] Invalid toggle index: ${u}`);return}let k=o[u],S=k.getAttribute("aria-pressed")==="true";k.setAttribute("aria-pressed",S?"false":"true")}function s(u,k){if(u<0||u>=o.length){console.error(`[aria-ease] Invalid toggle index: ${u}`);return}o[u].setAttribute("aria-pressed",k?"true":"false")}function p(u){return()=>{l(u)}}function g(u){return k=>{let{key:S}=k;switch(S){case"Enter":case" ":k.preventDefault(),l(u);break}}}function v(){o.forEach((u,k)=>{let S=p(k),y=g(k);u.addEventListener("click",S),u.addEventListener("keydown",y),a.set(u,y),n.set(u,S)})}function x(){o.forEach(u=>{let k=a.get(u),S=n.get(u);k&&(u.removeEventListener("keydown",k),a.delete(u)),S&&(u.removeEventListener("click",S),n.delete(u))})}function C(){x()}function D(){return o.map(u=>u.getAttribute("aria-pressed")==="true")}function c(){return o.map((u,k)=>u.getAttribute("aria-pressed")==="true"?k:-1).filter(u=>u!==-1)}return r(),v(),{toggleButton:l,setPressed:s,getPressedStates:D,getPressedIndices:c,cleanup:C}}function Ne({comboboxInputId:e,comboboxButtonId:t,listBoxId:m,listBoxItemsClass:i,callback:o}){if(e==="")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 a=document.getElementById(`${e}`);if(!a)return console.error(`[aria-ease] Element with id="${e}" not found. Make sure the combobox input element exists before calling makeComboboxAccessible.`),{cleanup:()=>{}};if(m==="")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 n=document.getElementById(`${m}`);if(!n)return console.error(`[aria-ease] Element with id="${m}" not found. Make sure the combobox listbox element exists before calling makeComboboxAccessible.`),{cleanup:()=>{}};if(i==="")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(i))return console.error(`[aria-ease] Listbox option(s) with class="${i}" not found. Make sure at least a combobox listbox option exists before calling makeComboboxAccessible.`),{cleanup:()=>{}};let l=t?document.getElementById(`${t}`):null,s=-1;a.setAttribute("role","combobox"),a.setAttribute("aria-autocomplete","list"),a.setAttribute("aria-controls",m),a.setAttribute("aria-expanded","false"),a.setAttribute("aria-haspopup","listbox"),n.setAttribute("role","listbox");let p=null;function g(){return p||(p=n.querySelectorAll(`.${i}`)),Array.from(p).filter(d=>!d.hidden&&d.style.display!=="none")}function v(){return a.getAttribute("aria-expanded")==="true"}function x(d){let A=g();if(d>=0&&d<A.length){let T=A[d],q=T.id||`${m}-option-${d}`;if(T.id||(T.id=q),a.setAttribute("aria-activedescendant",q),typeof T.scrollIntoView=="function"&&T.scrollIntoView({block:"nearest",behavior:"smooth"}),o?.onActiveDescendantChange)try{o.onActiveDescendantChange(q,T)}catch(I){console.error("[aria-ease] Error in combobox onActiveDescendantChange callback:",I)}}else a.setAttribute("aria-activedescendant","");s=d}function C(){if(a.setAttribute("aria-expanded","true"),n.style.display="block",o?.onOpenChange)try{o.onOpenChange(!0)}catch(d){console.error("[aria-ease] Error in combobox onOpenChange callback:",d)}}function D(){if(a.setAttribute("aria-expanded","false"),a.setAttribute("aria-activedescendant",""),n.style.display="none",s=-1,o?.onOpenChange)try{o.onOpenChange(!1)}catch(d){console.error("[aria-ease] Error in combobox onOpenChange callback:",d)}}function c(d){let A=d.textContent?.trim()||"";if(a.value=A,d.setAttribute("aria-selected","true"),D(),o?.onSelect)try{o.onSelect(d)}catch(T){console.error("[aria-ease] Error in combobox onSelect callback:",T)}}function u(d){let A=g(),T=v();switch(d.key){case"ArrowDown":if(d.preventDefault(),!T){C();return}if(A.length===0)return;{let q=s>=A.length-1?0:s+1;x(q)}break;case"ArrowUp":if(d.preventDefault(),!T)return;if(A.length>0){let q=s<=0?A.length-1:s-1;x(q)}break;case"Enter":T&&s>=0&&s<A.length&&(d.preventDefault(),c(A[s]));break;case"Escape":if(T)d.preventDefault(),D();else if(a.value&&(d.preventDefault(),a.value="",a.setAttribute("aria-activedescendant",""),g().forEach(I=>{I.getAttribute("aria-selected")==="true"&&I.setAttribute("aria-selected","false")}),o?.onClear))try{o.onClear()}catch(I){console.error("[aria-ease] Error in combobox onClear callback:",I)}break;case"Home":T&&A.length>0&&(d.preventDefault(),x(0));break;case"End":T&&A.length>0&&(d.preventDefault(),x(A.length-1));break;case"Tab":T&&s>=0&&s<A.length&&c(A[s]),T&&D();break}}function k(d){let A=d.target;if(A.classList.contains(i)){let q=g().indexOf(A);q>=0&&x(q)}}function S(d){let A=d.target;A.classList.contains(i)&&(d.preventDefault(),c(A))}function y(d){let A=d.target;!a.contains(A)&&!n.contains(A)&&(!l||!l.contains(A))&&D()}function L(){v()?D():(C(),a.focus())}function H(d){(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),L())}a.addEventListener("keydown",u),n.addEventListener("mousemove",k),n.addEventListener("mousedown",S),document.addEventListener("mousedown",y),l&&(l.setAttribute("tabindex","-1"),l.setAttribute("aria-label","Toggle options"),l.addEventListener("click",L),l.addEventListener("keydown",H));function f(){let d=n.querySelectorAll(`.${i}`);if(d.length===0)return;let A=null;for(let T of d)if(T.getAttribute("aria-selected")==="true"){A=T.textContent?.trim()||null;break}!A&&a.value&&(A=a.value.trim()),d.forEach((T,q)=>{T.setAttribute("role","option");let I=T.textContent?.trim()||"";A&&I===A?T.setAttribute("aria-selected","true"):T.setAttribute("aria-selected","false");let b=T.getAttribute("id");if(!b||b===""){let h=`${m}-option-${q}`;T.id=h,T.setAttribute("id",h)}})}f();function E(){a.removeEventListener("keydown",u),n.removeEventListener("mousemove",k),n.removeEventListener("mousedown",S),document.removeEventListener("mousedown",y),l&&(l.removeEventListener("click",L),l.removeEventListener("keydown",H))}function w(){p=null,f(),s=-1,x(-1)}return{cleanup:E,refresh:w,openListbox:C,closeListbox:D}}function Fe({tabListId:e,tabsClass:t,tabPanelsClass:m,orientation:i="horizontal",activateOnFocus:o=!0,callback:a}){if(e==="")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 n=document.querySelector(`#${e}`);if(!n)return console.error(`[aria-ease] Element with id="${e}" not found. Make sure the tab list container exists before calling makeTabsAccessible.`),{cleanup:()=>{}};if(t==="")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 r=Array.from(n.querySelectorAll(`.${t}`));if(r.length===0)return console.error(`[aria-ease] No elements with class="${t}" found. Make sure tab buttons exist before calling makeTabsAccessible.`),{cleanup:()=>{}};if(m==="")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(`.${m}`));if(l.length===0)return console.error(`[aria-ease] No elements with class="${m}" found. Make sure tab panels exist before calling makeTabsAccessible.`),{cleanup:()=>{}};if(r.length!==l.length)return console.error(`[aria-ease] Tab/panel mismatch: found ${r.length} tabs but ${l.length} panels.`),{cleanup:()=>{}};let s=new WeakMap,p=new WeakMap,g=new WeakMap,v=0;function x(){n.setAttribute("role","tablist"),n.setAttribute("aria-orientation",i),r.forEach((f,E)=>{let w=l[E];f.id||(f.id=`${e}-tab-${E}`),w.id||(w.id=`${e}-panel-${E}`),f.setAttribute("role","tab"),f.setAttribute("aria-controls",w.id),f.setAttribute("aria-selected","false"),f.setAttribute("tabindex","-1"),w.setAttribute("role","tabpanel"),w.setAttribute("aria-labelledby",f.id),w.hidden=!0,w.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')||w.setAttribute("tabindex","0")}),C(0,!1)}function C(f,E=!0){if(f<0||f>=r.length){console.error(`[aria-ease] Invalid tab index: ${f}`);return}let w=v;r.forEach((T,q)=>{let I=l[q];T.setAttribute("aria-selected","false"),T.setAttribute("tabindex","-1"),I.hidden=!0});let d=r[f],A=l[f];if(d.setAttribute("aria-selected","true"),d.setAttribute("tabindex","0"),A.hidden=!1,E&&d.focus(),v=f,a?.onTabChange&&w!==f)try{a.onTabChange(f,w)}catch(T){console.error("[aria-ease] Error in tabs onTabChange callback:",T)}}function D(f){let E=r.findIndex(A=>A===document.activeElement),w=E!==-1?E:v,d=w;switch(f){case"first":d=0;break;case"last":d=r.length-1;break;case"next":d=(w+1)%r.length;break;case"prev":d=(w-1+r.length)%r.length;break}if(r[d].focus(),r[d].setAttribute("tabindex","0"),r[v].setAttribute("tabindex","-1"),o)C(d,!1);else{let A=v;r.forEach((T,q)=>{q===d?T.setAttribute("tabindex","0"):q!==A&&T.setAttribute("tabindex","-1")})}}function c(f){return()=>{C(f)}}function u(f){return E=>{let{key:w}=E,d=!1;if(i==="horizontal")switch(w){case"ArrowLeft":E.preventDefault(),D("prev"),d=!0;break;case"ArrowRight":E.preventDefault(),D("next"),d=!0;break}else switch(w){case"ArrowUp":E.preventDefault(),D("prev"),d=!0;break;case"ArrowDown":E.preventDefault(),D("next"),d=!0;break}if(!d)switch(w){case"Home":E.preventDefault(),D("first");break;case"End":E.preventDefault(),D("last");break;case" ":case"Enter":o||(E.preventDefault(),C(f));break;case"F10":if(E.shiftKey&&a?.onContextMenu){E.preventDefault();try{a.onContextMenu(f,r[f])}catch(A){console.error("[aria-ease] Error in tabs onContextMenu callback:",A)}}break}}}function k(f){return E=>{if(a?.onContextMenu){E.preventDefault();try{a.onContextMenu(f,r[f])}catch(w){console.error("[aria-ease] Error in tabs onContextMenu callback:",w)}}}}function S(){r.forEach((f,E)=>{let w=c(E),d=u(E),A=k(E);f.addEventListener("click",w),f.addEventListener("keydown",d),a?.onContextMenu&&(f.addEventListener("contextmenu",A),g.set(f,A)),s.set(f,d),p.set(f,w)})}function y(){r.forEach(f=>{let E=s.get(f),w=p.get(f),d=g.get(f);E&&(f.removeEventListener("keydown",E),s.delete(f)),w&&(f.removeEventListener("click",w),p.delete(f)),d&&(f.removeEventListener("contextmenu",d),g.delete(f))})}function L(){y(),r.forEach((f,E)=>{let w=l[E];f.removeAttribute("role"),f.removeAttribute("aria-selected"),f.removeAttribute("aria-controls"),f.removeAttribute("tabindex"),w.removeAttribute("role"),w.removeAttribute("aria-labelledby"),w.removeAttribute("tabindex"),w.hidden=!1}),n.removeAttribute("role"),n.removeAttribute("aria-orientation")}function H(){y();let f=Array.from(n.querySelectorAll(`.${t}`)),E=Array.from(document.querySelectorAll(`.${m}`));r.length=0,r.push(...f),l.length=0,l.push(...E),x(),S()}return x(),S(),{activateTab:C,cleanup:L,refresh:H}}var j={"comboboxpopup.open":{setup:[{when:["keyboard","textInput","pointer"],steps:()=>[{type:"keypress",target:"input",key:"ArrowDown"}]},{when:["pointer"],steps:()=>[{type:"click",target:"button"}]}],assertion:re},"comboboxpopup.closed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:[...ie(),...J()]},"main.focused":{setup:[{when:["keyboard","pointer"],steps:()=>[{type:"focus",target:"main"}]}],assertion:ce},"main.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:le},"input.filled":{setup:[{when:["keyboard","textInput","pointer"],steps:()=>[{type:"type",target:"input",value:"test"}]}],assertion:ue},"input.empty":{setup:[{when:["keyboard","textInput","pointer"],steps:()=>[{type:"type",target:"input",value:""}]}],assertion:pe},"option.active":{requires:["comboboxpopup.open"],setup:[{when:["keyboard","pointer"],steps:(e={})=>typeof e.relativeTarget=="number"?Array.from({length:e.relativeTarget},()=>({type:"keypress",target:"main",key:"ArrowDown"})):e.relativeTarget==="first"?[{type:"keypress",target:"main",key:"ArrowDown"}]:e.relativeTarget==="last"?[{type:"keypress",target:"main",key:"ArrowDown"},{type:"keypress",target:"main",key:"ArrowUp"}]:[]}],assertion:(e={})=>se(e.relativeTarget)},"activedescendant.set":{requires:[],setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:ae},"activedescendant.unset":{requires:[],setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:J},"option.selected":{requires:["comboboxpopup.open"],setup:[{when:["keyboard"],steps:(e={})=>[{type:"keypress",target:"relative",key:"Enter",relativeTargeta:e.relativeTarget}]},{when:["pointer"],steps:(e={})=>[{type:"click",target:"relative",relativeTargeta:e.relativeTarget}]}],assertion:(e={})=>oe(e.relativeTarget)}};function re(){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 ie(){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 se(e){return[{target:"main",assertion:"toHaveAttribute",attribute:"aria-activedescendant",expectedValue:{ref:"relative",relativeTarget:e,property:"id"},failureMessage:"Expected aria-activedescendant on main to match the id of the first relative item."}]}function ae(){return[{target:"main",assertion:"toHaveAttribute",attribute:"aria-activedescendant",expectedValue:"!empty",failureMessage:"Expected aria-activedescendant on main to not be empty."}]}function J(){return[{target:"main",assertion:"toHaveAttribute",attribute:"aria-activedescendant",expectedValue:"",failureMessage:"Expected aria-activedescendant on main to be empty."}]}function oe(e){return[{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-selected",expectedValue:"true",failureMessage:`Expected ${e} item to have aria-selected='true'.`}]}function ce(){return[{target:"main",assertion:"toHaveFocus",failureMessage:"Expected main to be focused."}]}function le(){return[{target:"main",assertion:"notToHaveFocus",failureMessage:"Expected main to not have focused."}]}function ue(){return[{target:"input",assertion:"toHaveValue",expectedValue:"test",failureMessage:"Expected input to have the value 'test'."}]}function pe(){return[{target:"input",assertion:"toHaveValue",expectedValue:"",failureMessage:"Expected input to have the value ''."}]}var G={"menupopup.open":{setup:[{when:["keyboard"],steps:()=>[{type:"keypress",target:"main",key:"Enter"}]},{when:["pointer"],steps:()=>[{type:"click",target:"main"}]}],assertion:de},"menupopup.closed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:fe},"main.focused":{setup:[{when:["keyboard","pointer"],steps:()=>[{type:"focus",target:"main"}]}],assertion:be},"main.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:me},"menuitem.focused":{requires:["menupopup.open"],setup:[{when:["keyboard"],steps:(e={})=>[{type:"focus",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>ge(e.relativeTarget)},"submenupopup.open":{requires:["menupopup.open"],setup:[{when:["keyboard"],steps:()=>[{type:"keypress",target:"submenuTrigger",key:"ArrowRight"}]},{when:["pointer"],steps:()=>[{type:"click",target:"submenuTrigger"}]}],assertion:he},"submenupopup.closed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:ye},"submenutrigger.focused":{setup:[{when:["keyboard","pointer"],steps:()=>[{type:"focus",target:"submenuTrigger"}]}],assertion:ve},"submenutrigger.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:Ae},"submenuitem.focused":{requires:["submenupopup.open"],setup:[{when:["keyboard"],steps:(e={})=>{let t=[{type:"focus",target:"submenuTrigger"},{type:"keypress",target:"submenuTrigger",key:"ArrowRight"}];return typeof e.relativeTarget=="number"&&(t=t.concat(Array.from({length:e.relativeTarget},()=>({type:"keypress",target:"submenuItems",key:"ArrowDown"})))),e.relativeTarget==="first"&&(t=t.concat({type:"keypress",target:"submenuItems",key:"ArrowDown"})),e.relativeTarget==="last"&&(t=t.concat({type:"keypress",target:"submenuItems",key:"ArrowUp"})),t}},{when:["pointer"],steps:(e={})=>[{type:"click",target:"submenuTrigger"},{type:"click",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>ke(e.relativeTarget)}};function de(){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 fe(){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 be(){return[{target:"main",assertion:"toHaveFocus",failureMessage:"Expected menu main to be focused."}]}function me(){return[{target:"main",assertion:"notToHaveFocus",failureMessage:"Expected menu main to not have focused."}]}function ge(e){return[{target:"relative",assertion:"toHaveFocus",expectedValue:e,failureMessage:`${e} menu item should have focus.`}]}function he(){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 ye(){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 ve(){return[{target:"submenuTrigger",assertion:"toHaveFocus",failureMessage:"Expected submenu trigger to be focused."}]}function Ae(){return[{target:"submenuTrigger",assertion:"notToHaveFocus",failureMessage:"Expected submenu trigger to not have focused."}]}function ke(e){return[{target:"relative",relativeTarget:e,assertion:"toHaveFocus",failureMessage:`Expected submenu item ${e} to have focus.`}]}var X={"tab.active":{setup:[{when:["keyboard"],steps:(e={})=>[{type:"keypress",target:"relative",relativeTarget:e.relativeTarget,key:"ArrowLeft"}]},{when:["pointer"],steps:(e={})=>[{type:"click",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>we(e.relativeTarget)},"tab.focused":{setup:[{when:["keyboard","pointer"],steps:(e={})=>[{type:"focus",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>Ee(e.relativeTarget)}};function Ee(e){return[{target:"relative",assertion:"toHaveFocus",relativeTarget:e,failureMessage:"Expected first tab to have focus."}]}function Te(e){return[{target:"relative",assertion:"toHaveAttribute",attribute:"aria-selected",expectedValue:"true",relativeTarget:e,failureMessage:`Expected ${e} tab to have tabindex='0'.`}]}function we(e){return[{target:"relative",assertion:"toHaveAttribute",attribute:"aria-selected",expectedValue:"true",relativeTarget:e,failureMessage:`Expected ${e} tab to have aria-selected='true'.`},{target:"panel",assertion:"toBeVisible",controlledBy:{target:"relative",relativeTarget:e},failureMessage:`Expected panel controlled by the ${e} tab to be visible.`},Te(e)]}function Me(e,t){return t.some(m=>e.capabilities.includes(m))}function V(e,t){Array.isArray(e)&&e.length&&!e[0].when&&(e=[{when:["keyboard"],steps:()=>e}]);for(let m of e)if(Me(t,m.when))return m.steps(t);throw new Error(`No setup strategy matches capabilities: ${t.capabilities.join(", ")}`)}var xe={combobox:j,menu:G,tabs:X},N=class{constructor(t){this.jsonContract=t}toJSON(){return this.jsonContract}},K=class{constructor(t){this.componentName=t;this.statePack=xe[t]||{}}metaValue={};selectorsValue={};relationshipInvariants=[];staticAssertions=[];dynamicTests=[];statePack;meta(t){return this.metaValue=t,this}selectors(t){return this.selectorsValue=t,this}relationships(t){let m=this.statePack,i={capabilities:["keyboard"]},o=(n,r=new Set)=>{if(r.has(n))return[];r.add(n);let l=m[n];if(!l)return[];let s=[];if(Array.isArray(l.requires))for(let p of l.requires)s=s.concat(o(p,r));return l.setup&&(s=s.concat(V(l.setup,i))),s};return t({ariaReference:(n,r,l)=>({requires:s=>{let p=o(s,new Set);return{required:()=>this.relationshipInvariants.push({type:"aria-reference",from:n,attribute:r,to:l,level:"required",setup:p}),optional:()=>this.relationshipInvariants.push({type:"aria-reference",from:n,attribute:r,to:l,level:"optional",setup:p}),recommended:()=>this.relationshipInvariants.push({type:"aria-reference",from:n,attribute:r,to:l,level:"recommended",setup:p})}},required:()=>this.relationshipInvariants.push({type:"aria-reference",from:n,attribute:r,to:l,level:"required"}),optional:()=>this.relationshipInvariants.push({type:"aria-reference",from:n,attribute:r,to:l,level:"optional"}),recommended:()=>this.relationshipInvariants.push({type:"aria-reference",from:n,attribute:r,to:l,level:"recommended"})}),contains:(n,r)=>({requires:l=>{let s=o(l,new Set);return{required:()=>this.relationshipInvariants.push({type:"contains",parent:n,child:r,level:"required",setup:s}),optional:()=>this.relationshipInvariants.push({type:"contains",parent:n,child:r,level:"optional",setup:s}),recommended:()=>this.relationshipInvariants.push({type:"contains",parent:n,child:r,level:"recommended",setup:s})}},required:()=>this.relationshipInvariants.push({type:"contains",parent:n,child:r,level:"required"}),optional:()=>this.relationshipInvariants.push({type:"contains",parent:n,child:r,level:"optional"}),recommended:()=>this.relationshipInvariants.push({type:"contains",parent:n,child:r,level:"recommended"})})}),this}static(t){return t({target:i=>{let o=r=>{let l=this.statePack,s={capabilities:["keyboard"]},p=(g,v=new Set)=>{if(v.has(g))return[];v.add(g);let x=l[g];if(!x)return[];let C=[];if(Array.isArray(x.requires))for(let D of x.requires)C=C.concat(p(D,v));return x.setup&&(C=C.concat(V(x.setup,s))),C};return p(r,new Set)},a=r=>r==="role"?"toHaveRole":"toHaveAttribute",n=(r,l,s)=>{let p=a(r);return{required:()=>this.staticAssertions.push({target:i,assertion:p,attribute:r,expectedValue:l,failureMessage:"",level:"required",setup:s}),optional:()=>this.staticAssertions.push({target:i,assertion:p,attribute:r,expectedValue:l,failureMessage:"",level:"optional",setup:s}),recommended:()=>this.staticAssertions.push({target:i,assertion:p,attribute:r,expectedValue:l,failureMessage:"",level:"recommended",setup:s})}};return{has:(r,l)=>({...n(r,l),requires:p=>{let g=o(p);return n(r,l,g)}})}}}),this}when(t){return new F(this,this.statePack,t)}addDynamicTest(t){this.dynamicTests.push(t)}build(){return{meta:this.metaValue,selectors:this.selectorsValue,relationships:this.relationshipInvariants.length?this.relationshipInvariants:void 0,static:this.staticAssertions.length?[{assertions:this.staticAssertions}]:[],dynamic:this.dynamicTests}}},F=class{constructor(t,m,i){this.parent=t;this.statePack=m;this.event=i}_as;_onTarget;_onRelativeTarget;_given=[];_then=[];_desc="";_level="required";_orientation;as(t){return this._as=t,this}on(t,m){return this._onTarget=t,this._onRelativeTarget=m,this}given(t){return this._given=this._normalizeStates(t),this}then(t){return this._then=this._normalizeStates(t),this}orientation(t){return this._orientation=t,this}_normalizeStates(t){return(Array.isArray(t)?t:[t]).flatMap(i=>typeof i=="string"?[i]:typeof i=="object"&&i!==null&&"type"in i&&"ref"in i?this._findStateKeyByTypeAndRef(i.type)?[{type:i.type,ref:i.ref}]:[]:[i])}_findStateKeyByTypeAndRef(t){if(Object.keys(this.statePack).includes(t))return t}describe(t){return this._desc=t,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 i={capabilities:[{keypress:"keyboard",click:"pointer",type:"textInput",focus:"keyboard",hover:"pointer"}[this._as||"keyboard"]||this._as||"keyboard"]},o=(s,p=new Set)=>{if(p.has(s))return[];p.add(s);let g=this.statePack[s];if(!g)return[];let v=[];if(Array.isArray(g.requires))for(let x of g.requires)v=v.concat(o(x,p));return g.setup&&(v=v.concat(V(g.setup,i))),v},a=[];for(let s of this._given)if(typeof s=="string")a.push(...o(s));else if(typeof s=="object"&&s!==null&&"type"in s&&"ref"in s){let p=this._findStateKeyByTypeAndRef(s.type);if(p){let g=this.statePack[p];if(g&&g.setup)for(let v of g.setup)typeof v.steps=="function"?a.push(...v.steps({relativeTarget:s.ref})):Array.isArray(v.steps)&&a.push(...v.steps)}}let n=new Set;a=a.filter(s=>{let p=JSON.stringify(s);return n.has(p)?!1:(n.add(p),!0)});let r=[];for(let s of this._then)if(typeof s=="string"){let p=this.statePack[s];if(p&&p.assertion!==void 0){let g=p.assertion;if(typeof g=="function")try{g=g()}catch(v){throw new Error(`Error calling assertion function for state '${s}': ${v.message}`)}Array.isArray(g)?r.push(...g):r.push(g)}}else if(typeof s=="object"&&s!==null&&"type"in s&&"ref"in s){let p=this._findStateKeyByTypeAndRef(s.type);if(p){let g=this.statePack[p];if(g&&g.assertion!==void 0){let v=g.assertion;if(typeof v=="function")try{v=v({relativeTarget:s.ref})}catch(x){throw new Error(`Error calling assertion function for state '${p}': ${x.message}`)}Array.isArray(v)?r.push(...v):r.push(v)}}}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:r,...a.length?{setup:a}:{}})}};function et(e,t){let m=new K(e);return t(m),new N(m.build())}import Le from"path";async function Q(e,t,m={}){if(!e||typeof e!="string")throw new Error("\u274C testUiComponent requires a valid componentName (string)");if(!t)throw new Error("\u274C testUiComponent requires a URL");if(t&&typeof t!="string")throw new Error("\u274C testUiComponent url parameter must be a string");let i={violations:[]};async function o(p){try{let g=await fetch(p,{method:"HEAD",signal:AbortSignal.timeout(1e3)});if(g.ok||g.status===304)return p}catch{return null}return null}let a=B(m.strictness),n={},r=typeof process<"u"?process.cwd():"";if(typeof process<"u"&&typeof process.cwd=="function")try{let{loadConfig:p}=await import("./configLoader-ZEJVXLX7.js"),g=await p(process.cwd());if(n=g.config,g.configPath&&(r=Le.dirname(g.configPath)),m.strictness===void 0){let v=n.test?.components?.find(x=>x?.name===e)?.strictness;a=B(v??n.test?.strictness)}}catch{m.strictness===void 0&&(a="balanced")}let l;try{if(t){let p=await o(t);if(p){console.log(`\u{1F3AD} Running Playwright tests on ${p}`);let{runContractTestsPlaywright:g}=await import("./contractTestRunnerPlaywright-RUKMUY5P.js");l=await g(e,p,a,n,r)}else throw new Error(`\u274C Dev server not running at ${t}
|
|
2
|
+
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(p){throw p instanceof Error?p:new Error(`\u274C Contract test execution failed: ${String(p)}`)}let s={violations:i.violations,raw:i,contract:l};if(l.failures.length>0&&t==="Playwright")throw new Error(`
|
|
3
|
+
\u274C ${l.failures.length} accessibility contract test${l.failures.length>1?"s":""} failed (Playwright mode)
|
|
4
|
+
\u2705 ${l.passes.length} test${l.passes.length>1?"s":""} passed
|
|
5
5
|
|
|
6
6
|
\u{1F4CB} Review the detailed test report above for specific failures.
|
|
7
|
-
\u{1F4A1} Contract tests validate ARIA attributes and keyboard interactions per W3C APG guidelines.`);if(i.violations.length>0){let
|
|
8
|
-
- ${
|
|
9
|
-
Impact: ${
|
|
10
|
-
Affected elements: ${
|
|
11
|
-
Help: ${
|
|
7
|
+
\u{1F4A1} Contract tests validate ARIA attributes and keyboard interactions per W3C APG guidelines.`);if(i.violations.length>0){let p=i.violations.length,g=i.violations.map(v=>`
|
|
8
|
+
- ${v.id}: ${v.description}
|
|
9
|
+
Impact: ${v.impact}
|
|
10
|
+
Affected elements: ${v.nodes.length}
|
|
11
|
+
Help: ${v.helpUrl}`).join(`
|
|
12
12
|
`);throw new Error(`
|
|
13
|
-
\u274C ${
|
|
14
|
-
${
|
|
13
|
+
\u274C ${p} axe accessibility violation${p>1?"s":""} detected
|
|
14
|
+
${g}
|
|
15
15
|
|
|
16
|
-
\u{1F4CB} Full details available in result.violations`)}return
|
|
17
|
-
`);let{exec:
|
|
16
|
+
\u{1F4CB} Full details available in result.violations`)}return s}var Y=async()=>({passes:[],failures:[],skipped:[]});typeof window>"u"&&(Y=async()=>{console.log(`\u{1F680} Running component accessibility tests...
|
|
17
|
+
`);let{exec:e}=await import("child_process"),t=(await import("chalk")).default;return new Promise((m,i)=>{e("npx vitest --run --reporter verbose",async(o,a,n)=>{if(console.log(a),n&&console.error(n),!o||o.code===0){try{let{displayBadgeInfo:l,promptAddBadge:s}=await import("./badgeHelper-IB5RTMAG.js");l("component"),await s("component",process.cwd()),console.log(t.dim(`
|
|
18
18
|
`+"\u2500".repeat(60))),console.log(t.cyan("\u{1F499} Found aria-ease helpful?")),console.log(t.white(" \u2022 Star us on GitHub: ")+t.blue.underline("https://github.com/aria-ease/aria-ease")),console.log(t.white(" \u2022 Share feedback: ")+t.blue.underline("https://github.com/aria-ease/aria-ease/discussions")),console.log(t.dim("\u2500".repeat(60)+`
|
|
19
|
-
`))}catch(
|
|
19
|
+
`))}catch(l){console.error("Warning: Could not display badge prompt:",l)}m({passes:[],failures:[],skipped:[]}),process.exit(0)}else{let l=o?.code||1;i(new Error(`Tests failed with code ${l}`)),process.exit(l)}})})});async function Z(){await U()}export{Z as cleanupTests,et as createContract,He as makeAccordionAccessible,$e as makeBlockAccessible,Ie as makeCheckboxAccessible,Ne as makeComboboxAccessible,ne as makeMenuAccessible,Oe as makeRadioAccessible,Fe as makeTabsAccessible,Ve as makeToggleAccessible,Q as testUiComponent};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import {expect}from'@playwright/test';var r=class{constructor(t,i,o=400,c=400){this.mainSelector=t;this.selectors=i;this.actionTimeoutMs=o;this.assertionTimeoutMs=c;}async resetState(t){if(!this.selectors.popup)return;let i=this.selectors.popup,o=t.locator(i).first();if(!await o.isVisible().catch(()=>false))return;let e=false,n=this.selectors.main;if(n&&(await t.locator(n).first().focus(),await t.keyboard.press("Escape"),e=await expect(o).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>true).catch(()=>false)),!e&&this.selectors.button&&(await t.locator(this.selectors.button).first().click({timeout:this.actionTimeoutMs}),e=await expect(o).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>true).catch(()=>false)),e||(await t.mouse.click(10,10),e=await expect(o).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>true).catch(()=>false)),!e)throw new Error(`\u274C FATAL: Cannot close combobox popup between tests. Popup remains visible after trying:
|
|
2
|
+
1. Escape key
|
|
3
|
+
2. Clicking button
|
|
4
|
+
3. Clicking outside
|
|
5
|
+
This indicates a problem with the combobox component's close functionality.`);this.selectors.input&&await t.locator(this.selectors.input).first().clear();}async shouldSkipTest(){return false}getMainSelector(){return this.mainSelector}};export{r as ComboboxComponentStrategy};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import {expect}from'@playwright/test';var c=class{constructor(e,r,i=400,o=400){this.mainSelector=e;this.selectors=r;this.actionTimeoutMs=i;this.assertionTimeoutMs=o;}async resetState(e){if(!this.selectors.popup)return;let r=this.selectors.popup,i=e.locator(r).first();if(!await i.isVisible().catch(()=>false))return;let s=false,t=this.selectors.main;if(t&&(await e.locator(t).first().focus(),await e.keyboard.press("Escape"),s=await expect(i).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>true).catch(()=>false)),!s&&this.selectors.main&&(await e.locator(this.selectors.main).first().click({timeout:this.actionTimeoutMs}),s=await expect(i).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>true).catch(()=>false)),s||(await e.mouse.click(10,10),s=await expect(i).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>true).catch(()=>false)),!s)throw new Error(`\u274C FATAL: Cannot close menu between tests. Menu remains visible after trying:
|
|
2
|
+
1. Escape key
|
|
3
|
+
2. Clicking trigger
|
|
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,r){if(!(e.action.some(t=>t.target==="submenu"||t.target==="submenuTrigger"||t.target==="submenuItems")||e.assertions.some(t=>t.target==="submenu"||t.target==="submenuTrigger"||t.target==="submenuItems")))return false;let o=this.selectors.submenuTrigger;return o?await r.locator(o).count()===0:true}getMainSelector(){return this.mainSelector}};export{c as MenuComponentStrategy};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{a as RelativeTargetResolver}from'./chunk-WIWSYIGK.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var o=class{constructor(t,e){this.mainSelector=t;this.selectors=e;}async resetState(){}async shouldSkipTest(t,e){if(t.orientation!==void 0&&this.selectors.tablist){let r=this.selectors.tablist,i=await e.locator(r).first().getAttribute("aria-orientation");if(t.orientation!==i)return true}return false}getMainSelector(){return this.mainSelector}};export{o as TabsComponentStrategy};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var a=class{static async resolve(t,n,r){let e=await t.locator(n).all();if(typeof r=="number")return e[r-1];switch(r){case "first":return e[0];case "second":return e[1];case "last":return e[e.length-1];case "next":{let s=(await t.evaluate(([c])=>Array.from(document.querySelectorAll(c)).indexOf(document.activeElement),[n])+1)%e.length;return e[s]}case "previous":{let s=(await t.evaluate(([c])=>Array.from(document.querySelectorAll(c)).indexOf(document.activeElement),[n])-1+e.length)%e.length;return e[s]}default:return null}}};export{a};
|