aria-ease 7.8.1 → 7.8.2
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/README.md +3 -3
- package/dist/AccordionComponentStrategy-PGBPZ5AV.js +1 -0
- package/dist/CheckboxComponentStrategy-C4AE24NT.js +1 -0
- package/dist/ComboboxComponentStrategy-AAYXTWW2.js +5 -0
- package/dist/MenuComponentStrategy-XPVKRFYX.js +5 -0
- package/dist/RadioComponentStrategy-ATVI5I3L.js +1 -0
- package/dist/ToggleComponentStrategy-H737DAFU.js +1 -0
- package/dist/cli.cjs +32 -32
- package/dist/cli.js +1 -1
- package/dist/{contractTestRunnerPlaywright-CHCVW7VO.js → contractTestRunnerPlaywright-2KC3RAV5.js} +2 -2
- package/dist/{contractTestRunnerPlaywright-FECB4HSX.js → contractTestRunnerPlaywright-OZOFEW66.js} +2 -2
- package/dist/index.cjs +8 -8
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/src/{Types.d-BjBTlIzl.d.cts → Types.d-DO31Kt2y.d.cts} +2 -2
- package/dist/src/{Types.d-BjBTlIzl.d.ts → Types.d-DO31Kt2y.d.ts} +2 -2
- package/dist/src/accordion/index.d.cts +1 -1
- package/dist/src/accordion/index.d.ts +1 -1
- package/dist/src/block/index.d.cts +1 -1
- package/dist/src/block/index.d.ts +1 -1
- package/dist/src/checkbox/index.d.cts +1 -1
- package/dist/src/checkbox/index.d.ts +1 -1
- package/dist/src/combobox/index.cjs +1 -1
- package/dist/src/combobox/index.d.cts +1 -1
- package/dist/src/combobox/index.d.ts +1 -1
- package/dist/src/combobox/index.js +1 -1
- package/dist/src/menu/index.d.cts +1 -1
- package/dist/src/menu/index.d.ts +1 -1
- package/dist/src/radio/index.d.cts +1 -1
- package/dist/src/radio/index.d.ts +1 -1
- package/dist/src/tabs/index.d.cts +1 -1
- package/dist/src/tabs/index.d.ts +1 -1
- package/dist/src/toggle/index.d.cts +1 -1
- package/dist/src/toggle/index.d.ts +1 -1
- package/dist/src/utils/test/AccordionComponentStrategy-3GGMDTRW.js +1 -0
- package/dist/src/utils/test/CheckboxComponentStrategy-VVOJGXVS.js +1 -0
- package/dist/src/utils/test/ComboboxComponentStrategy-27RZ5MBQ.js +5 -0
- package/dist/src/utils/test/MenuComponentStrategy-C7WC6OXZ.js +5 -0
- package/dist/src/utils/test/RadioComponentStrategy-4KONDPM2.js +1 -0
- package/dist/src/utils/test/ToggleComponentStrategy-DKEYKK47.js +1 -0
- package/dist/src/utils/test/{contractTestRunnerPlaywright-7ERFIHCM.js → contractTestRunnerPlaywright-GM4W4SKJ.js} +2 -2
- package/dist/src/utils/test/dsl/index.cjs +1 -1
- package/dist/src/utils/test/dsl/index.js +1 -1
- package/dist/src/utils/test/index.cjs +4 -4
- package/dist/src/utils/test/index.js +1 -1
- package/dist/{test-CMD6E5YF.js → test-6TU4J43V.js} +1 -1
- package/package.json +1 -1
- package/dist/AccordionComponentStrategy-T5YODP3A.js +0 -1
- package/dist/CheckboxComponentStrategy-AZF2Y4MN.js +0 -1
- package/dist/ComboboxComponentStrategy-DHZS4NW6.js +0 -5
- package/dist/MenuComponentStrategy-L3QXLC6S.js +0 -5
- package/dist/RadioComponentStrategy-GKA5KOM5.js +0 -1
- package/dist/ToggleComponentStrategy-TMRNXFSL.js +0 -1
- package/dist/src/utils/test/AccordionComponentStrategy-S35ZYITU.js +0 -1
- package/dist/src/utils/test/CheckboxComponentStrategy-ST2DWNYT.js +0 -1
- package/dist/src/utils/test/ComboboxComponentStrategy-5AWO63DA.js +0 -5
- package/dist/src/utils/test/MenuComponentStrategy-QHVBLUBR.js +0 -5
- package/dist/src/utils/test/RadioComponentStrategy-TWMIMSYX.js +0 -1
- package/dist/src/utils/test/ToggleComponentStrategy-UOGYK2U4.js +0 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as z,d as B}from"./chunk-APUMBDOT.js";import"./chunk-CNU4N4AY.js";function Xe({accordionId:e,triggersClass:t,panelsClass:m,allowMultipleOpen:l=!1,callback:d}){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 n=document.querySelector(`#${e}`);if(!n)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 a=Array.from(n.querySelectorAll(`.${t}`));if(a.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 o=Array.from(n.querySelectorAll(`.${m}`));if(o.length===0)return console.error(`[aria-ease] No elements with class="${m}" found. Make sure accordion panels exist before calling makeAccordionAccessible.`),{cleanup:()=>{}};if(a.length!==o.length)return console.error(`[aria-ease] Accordion trigger/panel mismatch: found ${a.length} triggers but ${o.length} panels.`),{cleanup:()=>{}};let c=new WeakMap,s=new WeakMap;function u(){a.forEach((i,T)=>{let C=o[T];i.id||(i.id=`${e}-trigger-${T}`),C.id||(C.id=`${e}-panel-${T}`),i.setAttribute("aria-controls",C.id),i.setAttribute("aria-expanded","false"),(!l||a.length<=6)&&C.setAttribute("role","region"),C.setAttribute("aria-labelledby",i.id),C.style.display="none"})}function v(i){if(i<0||i>=a.length){console.error(`[aria-ease] Invalid accordion index: ${i}`);return}let T=a[i],C=o[i];if(T.setAttribute("aria-expanded","true"),C.style.display="block",d?.onExpandedChange)try{d.onExpandedChange(i,!0)}catch(f){console.error("[aria-ease] Error in accordion onExpandedChange callback:",f)}}function y(i){if(i<0||i>=a.length){console.error(`[aria-ease] Invalid accordion index: ${i}`);return}let T=a[i],C=o[i];if(T.setAttribute("aria-expanded","false"),C.style.display="none",d?.onExpandedChange)try{d.onExpandedChange(i,!1)}catch(f){console.error("[aria-ease] Error in accordion onExpandedChange callback:",f)}}function E(i){a[i].getAttribute("aria-expanded")==="true"?y(i):(l||a.forEach((f,x)=>{x!==i&&y(x)}),v(i))}function S(i){return()=>{E(i)}}function H(i){return T=>{let{key:C}=T;switch(C){case"Enter":case" ":T.preventDefault(),E(i);break;case"ArrowDown":T.preventDefault();{let f=(i+1)%a.length;a[f].focus()}break;case"ArrowUp":T.preventDefault();{let f=(i-1+a.length)%a.length;a[f].focus()}break;case"Home":T.preventDefault(),a[0].focus();break;case"End":T.preventDefault(),a[a.length-1].focus();break}}}function q(){a.forEach((i,T)=>{let C=S(T),f=H(T);i.addEventListener("click",C),i.addEventListener("keydown",f),c.set(i,f),s.set(i,C)})}function k(){a.forEach(i=>{let T=c.get(i),C=s.get(i);T&&(i.removeEventListener("keydown",T),c.delete(i)),C&&(i.removeEventListener("click",C),s.delete(i))})}function r(){k(),a.forEach((i,T)=>{y(T)})}function b(){k();let i=Array.from(n.querySelectorAll(`.${t}`)),T=Array.from(n.querySelectorAll(`.${m}`));a.length=0,a.push(...i),o.length=0,o.push(...T),u(),q()}return u(),q(),{expandItem:v,collapseItem:y,toggleItem:E,cleanup:r,refresh:b}}function _(e){if(e.tagName!=="INPUT")return!1;let t=e.type;return["text","email","password","tel","number"].includes(t)}function V(e){return e.tagName==="TEXTAREA"}function W(e){return e.tagName==="BUTTON"||e.tagName==="INPUT"&&["button","submit","reset"].includes(e.type)}function ie(e){return e.tagName==="A"}function O(e,t,m){let l=e.length,d=(t+m+l)%l;e.item(d).focus()}function se(e){return e.getAttribute("data-custom-click")!==null&&e.getAttribute("data-custom-click")!==void 0}function j(e,t,m){let l=t.item(m);switch(e.key){case"ArrowUp":case"ArrowLeft":{(!_(l)&&!V(l)||(_(l)||V(l))&&l.selectionStart===0)&&(e.preventDefault(),O(t,m,-1));break}case"ArrowDown":case"ArrowRight":{if(!_(l)&&!V(l))e.preventDefault(),O(t,m,1);else if(_(l)||V(l)){let d=l.value;l.selectionStart===d.length&&(e.preventDefault(),O(t,m,1))}break}case"Escape":{e.preventDefault();break}case"Enter":case" ":{(!W(l)&&!ie(l)&&se(l)||W(l))&&(e.preventDefault(),l.click());break}case"Tab":break;default:break}}function et({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 l=null;function d(){return l||(l=m.querySelectorAll(`.${t}`)),l}let n=d();if(!n||n.length===0)return console.error(`[aria-ease] Element with class="${t}" not found. Make sure the block items exist before calling makeBlockAccessible.`),{cleanup:()=>{}};let a=new Map;n.forEach(s=>{if(!a.has(s)){let u=v=>{let y=m.querySelectorAll(`.${t}`),E=Array.prototype.indexOf.call(y,s);j(v,y,E)};s.addEventListener("keydown",u),a.set(s,u)}});function o(){n.forEach(s=>{let u=a.get(s);u&&(s.removeEventListener("keydown",u),a.delete(s))})}function c(){l=null}return{cleanup:o,refresh:c}}function rt({checkboxGroupId:e,checkboxesClass:t,callback:m}){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 l=document.querySelector(`#${e}`);if(!l)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 d=Array.from(l.querySelectorAll(`.${t}`));if(d.length===0)return console.error(`[aria-ease] No elements with class="${t}" found. Make sure checkboxes exist before calling makeCheckboxAccessible.`),{cleanup:()=>{}};let n=new WeakMap,a=new WeakMap;function o(){l.getAttribute("role")||l.setAttribute("role","group"),d.forEach(r=>{r.setAttribute("role","checkbox");let b=r.checked;r.setAttribute("aria-checked",b?"true":"false"),r.hasAttribute("tabindex")||r.setAttribute("tabindex","0")})}function c(r,b){if(m?.onCheckedChange)try{m.onCheckedChange(r,b)}catch(i){console.error("[aria-ease] Error in checkbox onCheckedChange callback:",i)}}function s(r){if(r<0||r>=d.length){console.error(`[aria-ease] Invalid checkbox index: ${r}`);return}let b=d[r],i=!b.checked;b.checked=i,b.setAttribute("aria-checked",i?"true":"false"),c(r,i)}function u(r,b){if(r<0||r>=d.length){console.error(`[aria-ease] Invalid checkbox index: ${r}`);return}let i=d[r];i.checked=b,i.setAttribute("aria-checked",b?"true":"false"),c(r,b)}function v(r){return()=>{let b=d[r];if("checked"in b&&typeof b.checked=="boolean")setTimeout(()=>{let i=b.checked;b.setAttribute("aria-checked",i?"true":"false"),c(r,i)},0);else{let i=b.getAttribute("aria-checked")==="true";b.setAttribute("aria-checked",i?"false":"true"),c(r,!i)}}}function y(r){return b=>{let{key:i}=b;switch(i){case" ":case"Spacebar":b.preventDefault(),s(r);break}}}function E(){d.forEach((r,b)=>{let i=v(b),T=y(b);r.addEventListener("click",i),r.addEventListener("keydown",T),n.set(r,T),a.set(r,i)})}function S(){d.forEach(r=>{let b=n.get(r),i=a.get(r);b&&(r.removeEventListener("keydown",b),n.delete(r)),i&&(r.removeEventListener("click",i),a.delete(r))})}function H(){S()}function q(){return d.map(r=>r.getAttribute("aria-checked")==="true")}function k(){return d.map((r,b)=>r.getAttribute("aria-checked")==="true"?b:-1).filter(r=>r!==-1)}return o(),E(),{toggleCheckbox:s,setCheckboxState:u,getCheckedStates:q,getCheckedIndices:k,cleanup:H}}function oe({menuId:e,menuItemsClass:t,triggerId:m,callback:l}){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 d=document.querySelector(`#${e}`);if(!d)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 n=document.querySelector(`#${m}`);if(!n)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:()=>{}};n.setAttribute("aria-haspopup","true"),n.setAttribute("aria-controls",e),n.setAttribute("aria-expanded","false"),d.setAttribute("role","menu"),d.setAttribute("aria-labelledby",m);let a=new WeakMap,o=new Map,c=null,s=null;function u(){return c||(c=d.querySelectorAll(`.${t}`)),c}function v(){if(!s){let g=u();s=[];for(let h=0;h<g.length;h++){let L=g.item(h),$=b(L),R=L.getAttribute("aria-disabled")==="true";$||(L.hasAttribute("tabindex")||L.setAttribute("tabindex","-1"),R||s.push(L))}}return s}function y(g){return{length:g.length,item:L=>g[L],forEach:L=>{g.forEach(L)},[Symbol.iterator]:function*(){for(let L of g)yield L}}}function E(){u().forEach(h=>{h.setAttribute("role","menuitem");let L=h.getAttribute("data-submenu-id")??h.getAttribute("aria-controls"),$=h.hasAttribute("aria-haspopup")&&L;L&&(h.hasAttribute("data-submenu-id")||$)&&(h.setAttribute("aria-haspopup","menu"),h.setAttribute("aria-controls",L),h.hasAttribute("aria-expanded")||h.setAttribute("aria-expanded","false"))})}function S(g,h,L){let $=g.length,R=(h+L+$)%$;g.item(R).focus()}function H(g,h){g.length!==0&&g[h]?.focus()}function q(g){return g.hasAttribute("aria-controls")&&g.hasAttribute("aria-haspopup")&&g.getAttribute("role")==="menuitem"}function k(g){let h=g;for(;h&&h.getAttribute("role")==="menuitem";){let L=h.closest('[role="menu"]');if(!L)break;L.style.display="none",h.setAttribute("aria-expanded","false");let $=L.getAttribute("aria-labelledby");if(!$)break;let R=document.getElementById($);if(!R)break;h=R}}E();function r(g,h,L){switch(g.key){case"ArrowLeft":{if(g.key==="ArrowLeft"&&n.getAttribute("role")==="menuitem"){g.preventDefault(),p();return}break}case"ArrowUp":{g.preventDefault(),S(y(v()),L,-1);break}case"ArrowRight":{if(g.key==="ArrowRight"&&q(h)){g.preventDefault();let $=h.getAttribute("aria-controls");if($){T($);return}}break}case"ArrowDown":{g.preventDefault(),S(y(v()),L,1);break}case"Home":{g.preventDefault(),H(v(),0);break}case"End":{g.preventDefault();let $=v();H($,$.length-1);break}case"Escape":{g.preventDefault(),p(),n.focus(),C&&C(!1);break}case"Enter":case" ":{if(g.preventDefault(),q(h)){let $=h.getAttribute("aria-controls");if($){T($);return}}h.click(),p(),C&&C(!1);break}case"Tab":{p(),k(n),C&&C(!1);break}default:break}}function b(g){let h=g.parentElement;for(;h&&h!==d;){if(h.getAttribute("role")==="menu"||h.id&&d.querySelector(`[aria-controls="${h.id}"]`))return!0;h=h.parentElement}return!1}function i(g){n.setAttribute("aria-expanded",g?"true":"false")}function T(g){let h=o.get(g);if(!h){let L=d.querySelector(`[aria-controls="${g}"]`);if(!L){console.error(`[aria-ease] Submenu trigger with aria-controls="${g}" not found in menu "${e}".`);return}if(!L.id){let R=`trigger-${g}`;L.id=R,console.warn(`[aria-ease] Submenu trigger for "${g}" had no ID. Auto-generated ID: "${R}".`)}if(!document.querySelector(`#${g}`)){console.error(`[aria-ease] Submenu element with id="${g}" not found. Cannot create submenu instance.`);return}h=oe({menuId:g,menuItemsClass:t,triggerId:L.id,callback:l}),o.set(g,h)}h.openMenu()}function C(g){if(l?.onExpandedChange)try{l.onExpandedChange(g)}catch(h){console.error("[aria-ease] Error in menu onExpandedChange callback:",h)}}function f(){v().forEach((h,L)=>{if(!a.has(h)){let $=R=>r(R,h,L);h.addEventListener("keydown",$),a.set(h,$)}})}function x(){v().forEach(h=>{let L=a.get(h);L&&(h.removeEventListener("keydown",L),a.delete(h))})}function w(){i(!0),d.style.display="block";let g=v();if(f(),g&&g.length>0&&g[0].focus(),l?.onExpandedChange)try{l.onExpandedChange(!0)}catch(h){console.error("[aria-ease] Error in menu onExpandedChange callback:",h)}}function p(){if(o.forEach(g=>g.closeMenu()),i(!1),d.style.display="none",x(),n.focus(),l?.onExpandedChange)try{l.onExpandedChange(!1)}catch(g){console.error("[aria-ease] Error in menu onExpandedChange callback:",g)}}function A(){n.getAttribute("aria-expanded")==="true"?p():w()}function M(g){if(!(n.getAttribute("aria-expanded")==="true"))return;let L=n.contains(g.target),$=d.contains(g.target);!L&&!$&&p()}n.addEventListener("click",A),document.addEventListener("click",M);function I(){x(),n.removeEventListener("click",A),document.removeEventListener("click",M),d.style.display="none",i(!1),o.forEach(g=>g.cleanup()),o.clear()}function P(){c=null,s=null}return{openMenu:w,closeMenu:p,cleanup:I,refresh:P}}function it({radioGroupId:e,radiosClass:t,defaultSelectedIndex:m,callback:l}){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 d=document.querySelector(`#${e}`);if(!d)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 n=Array.from(d.querySelectorAll(`.${t}`));if(n.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,o=new WeakMap,c;m&&(c=m);function s(){d.getAttribute("role")||d.setAttribute("role","radiogroup"),n.forEach((k,r)=>{k.setAttribute("role","radio"),k.setAttribute("tabindex","0");let b=r===c;k.setAttribute("aria-checked",b?"true":"false"),k.checked!==void 0&&(k.checked=b)})}function u(k){if(k<0||k>=n.length){console.error(`[aria-ease] Invalid radio index: ${k}`);return}if(c>=0&&c<n.length&&(n[c].setAttribute("aria-checked","false"),n[c].checked!==void 0&&(n[c].checked=!1)),n[k].setAttribute("aria-checked","true"),n[k].checked!==void 0&&(n[k].checked=!0),n[k].focus(),l?.onValueChange)try{l.onValueChange(k,n[k].getAttribute("value"))}catch(r){console.error("[aria-ease] Error in radio onValueChange callback:",r)}c=k}function v(k){return()=>{let r=n[k];"checked"in r&&typeof r.checked=="boolean"?setTimeout(()=>{u(k)},0):u(k)}}function y(k){return r=>{let{key:b}=r,i=k;switch(b){case"ArrowDown":case"ArrowRight":r.preventDefault(),i=(k+1)%n.length,u(i);break;case"ArrowUp":case"ArrowLeft":r.preventDefault(),i=(k-1+n.length)%n.length,u(i);break;case" ":case"Enter":r.preventDefault(),u(k);break}}}function E(){n.forEach((k,r)=>{let b=v(r),i=y(r);k.addEventListener("click",b),k.addEventListener("keydown",i),a.set(k,i),o.set(k,b)})}function S(){n.forEach(k=>{let r=a.get(k),b=o.get(k);r&&(k.removeEventListener("keydown",r),a.delete(k)),b&&(k.removeEventListener("click",b),o.delete(k))})}function H(){S()}function q(){return c}return s(),E(),{selectRadio:u,getSelectedIndex:q,cleanup:H}}function ot({toggleId:e,togglesClass:t,isSingleToggle:m=!0,callback:l}){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 d=document.querySelector(`#${e}`);if(!d)return console.error(`[aria-ease] Element with id="${e}" not found. Make sure the toggle element exists before calling makeToggleAccessible.`),{cleanup:()=>{}};let n;if(m)n=[d];else{if(!t)return console.error("[aria-ease] togglesClass is required when isSingleToggle is false."),{cleanup:()=>{}};if(n=Array.from(d.querySelectorAll(`.${t}`)),n.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,o=new WeakMap;function c(){n.forEach(r=>{r.tagName.toLowerCase()!=="button"&&!r.getAttribute("role")&&r.setAttribute("role","button"),r.hasAttribute("aria-pressed")||r.setAttribute("aria-pressed","false"),r.hasAttribute("tabindex")||r.setAttribute("tabindex","0")})}function s(r){if(r<0||r>=n.length){console.error(`[aria-ease] Invalid toggle index: ${r}`);return}let i=n[r].getAttribute("aria-pressed")==="true";u(r,!i)}function u(r,b){if(r<0||r>=n.length){console.error(`[aria-ease] Invalid toggle index: ${r}`);return}if(n[r].setAttribute("aria-pressed",b?"true":"false"),l?.onPressedChange)try{l.onPressedChange(r,b)}catch(i){console.error("[aria-ease] Error in checkbox onPressedChange callback:",i)}}function v(r){return()=>{s(r)}}function y(r){return b=>{let{key:i}=b;switch(i){case"Enter":case" ":b.preventDefault(),s(r);break}}}function E(){n.forEach((r,b)=>{let i=v(b),T=y(b);r.addEventListener("click",i),r.addEventListener("keydown",T),a.set(r,T),o.set(r,i)})}function S(){n.forEach(r=>{let b=a.get(r),i=o.get(r);b&&(r.removeEventListener("keydown",b),a.delete(r)),i&&(r.removeEventListener("click",i),o.delete(r))})}function H(){S()}function q(){return n.map(r=>r.getAttribute("aria-pressed")==="true")}function k(){return n.map((r,b)=>r.getAttribute("aria-pressed")==="true"?b:-1).filter(r=>r!==-1)}return c(),E(),{toggleButton:s,setPressed:u,getPressedStates:q,getPressedIndices:k,cleanup:H}}function lt({comboboxInputId:e,comboboxButtonId:t,listBoxId:m,listBoxItemsClass:l,callback:d}){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 n=document.getElementById(`${e}`);if(!n)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 a=document.getElementById(`${m}`);if(!a)return console.error(`[aria-ease] Element with id="${m}" not found. Make sure the combobox listbox element exists before calling makeComboboxAccessible.`),{cleanup:()=>{}};if(l==="")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(l))return console.error(`[aria-ease] Listbox option(s) with class="${l}" not found. Make sure at least a combobox listbox option exists before calling makeComboboxAccessible.`),{cleanup:()=>{}};let c=t?document.getElementById(`${t}`):null,s=-1;n.setAttribute("role","combobox"),n.setAttribute("aria-autocomplete","list"),n.setAttribute("aria-controls",m),n.setAttribute("aria-expanded","false"),n.setAttribute("aria-haspopup","listbox"),a.setAttribute("role","listbox");let u=null;function v(){return u||(u=a.querySelectorAll(`.${l}`)),Array.from(u).filter(p=>!p.hidden&&p.style.display!=="none")}function y(){return n.getAttribute("aria-expanded")==="true"}function E(p){let A=v();if(p>=0&&p<A.length){let M=A[p],I=M.id||`${m}-option-${p}`;if(M.id||(M.id=I),n.setAttribute("aria-activedescendant",I),typeof M.scrollIntoView=="function"&&M.scrollIntoView({block:"nearest",behavior:"smooth"}),d?.onActiveDescendantChange)try{d.onActiveDescendantChange(I,M)}catch(P){console.error("[aria-ease] Error in combobox onActiveDescendantChange callback:",P)}}else n.setAttribute("aria-activedescendant","");s=p}function S(){if(n.setAttribute("aria-expanded","true"),a.style.display="block",d?.onExpandedChange)try{d.onExpandedChange(!0)}catch(p){console.error("[aria-ease] Error in combobox onExpandedChange callback:",p)}}function H(){if(n.setAttribute("aria-expanded","false"),n.setAttribute("aria-activedescendant",""),a.style.display="none",s=-1,d?.onExpandedChange)try{d.onExpandedChange(!1)}catch(p){console.error("[aria-ease] Error in combobox onExpandedChange callback:",p)}}function q(p){let A=p.textContent?.trim()||"";if(n.value=A,p.setAttribute("aria-selected","true"),H(),d?.onSelect)try{d.onSelect(p)}catch(M){console.error("[aria-ease] Error in combobox onSelect callback:",M)}}function k(p){let A=v(),M=y();switch(p.key){case"ArrowDown":if(p.preventDefault(),!M){S();return}if(A.length===0)return;{let I=s>=A.length-1?0:s+1;E(I)}break;case"ArrowUp":if(p.preventDefault(),!M)return;if(A.length>0){let I=s<=0?A.length-1:s-1;E(I)}break;case"Enter":M&&s>=0&&s<A.length&&(p.preventDefault(),q(A[s]));break;case"Escape":if(M)p.preventDefault(),H();else if(n.value&&(p.preventDefault(),n.value="",n.setAttribute("aria-activedescendant",""),v().forEach(P=>{P.getAttribute("aria-selected")==="true"&&P.setAttribute("aria-selected","false")}),d?.onClear))try{d.onClear()}catch(P){console.error("[aria-ease] Error in combobox onClear callback:",P)}break;case"Home":M&&A.length>0&&(p.preventDefault(),E(0));break;case"End":M&&A.length>0&&(p.preventDefault(),E(A.length-1));break;case"Tab":M&&s>=0&&s<A.length&&q(A[s]),M&&H();break}}function r(p){let A=p.target;if(A.classList.contains(l)){let I=v().indexOf(A);I>=0&&E(I)}}function b(p){let A=p.target;A.classList.contains(l)&&(p.preventDefault(),q(A))}function i(p){let A=p.target;!n.contains(A)&&!a.contains(A)&&(!c||!c.contains(A))&&H()}function T(){y()?H():(S(),n.focus())}function C(p){(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),T())}n.addEventListener("keydown",k),a.addEventListener("mousemove",r),a.addEventListener("mousedown",b),document.addEventListener("mousedown",i),c&&(c.setAttribute("tabindex","-1"),c.setAttribute("aria-label","Toggle options"),c.addEventListener("click",T),c.addEventListener("keydown",C));function f(){let p=a.querySelectorAll(`.${l}`);if(p.length===0)return;let A=null;for(let M of p)if(M.getAttribute("aria-selected")==="true"){A=M.textContent?.trim()||null;break}!A&&n.value&&(A=n.value.trim()),p.forEach((M,I)=>{M.setAttribute("role","option");let P=M.textContent?.trim()||"";A&&P===A?M.setAttribute("aria-selected","true"):M.setAttribute("aria-selected","false");let g=M.getAttribute("id");if(!g||g===""){let h=`${m}-option-${I}`;M.id=h,M.setAttribute("id",h)}})}f();function x(){n.removeEventListener("keydown",k),a.removeEventListener("mousemove",r),a.removeEventListener("mousedown",b),document.removeEventListener("mousedown",i),c&&(c.removeEventListener("click",T),c.removeEventListener("keydown",C))}function w(){u=null,f(),s=-1,E(-1)}return{cleanup:x,refresh:w,openListbox:S,closeListbox:H}}function dt({tabListId:e,tabsClass:t,tabPanelsClass:m,orientation:l="horizontal",activateOnFocus:d=!0,callback:n}){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 a=document.querySelector(`#${e}`);if(!a)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 o=Array.from(a.querySelectorAll(`.${t}`));if(o.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 c=Array.from(document.querySelectorAll(`.${m}`));if(c.length===0)return console.error(`[aria-ease] No elements with class="${m}" found. Make sure tab panels exist before calling makeTabsAccessible.`),{cleanup:()=>{}};if(o.length!==c.length)return console.error(`[aria-ease] Tab/panel mismatch: found ${o.length} tabs but ${c.length} panels.`),{cleanup:()=>{}};let s=new WeakMap,u=new WeakMap,v=new WeakMap,y=0;function E(){a.setAttribute("role","tablist"),a.setAttribute("aria-orientation",l),o.forEach((f,x)=>{let w=c[x];f.id||(f.id=`${e}-tab-${x}`),w.id||(w.id=`${e}-panel-${x}`),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")}),S(0,!1)}function S(f,x=!0){if(f<0||f>=o.length){console.error(`[aria-ease] Invalid tab index: ${f}`);return}o.forEach((A,M)=>{let I=c[M];A.setAttribute("aria-selected","false"),A.setAttribute("tabindex","-1"),I.hidden=!0});let w=o[f],p=c[f];if(w.setAttribute("aria-selected","true"),w.setAttribute("tabindex","0"),p.hidden=!1,x&&w.focus(),y=f,n?.onSelectedChange)try{n.onSelectedChange(f,!0)}catch(A){console.error("[aria-ease] Error in tabs onSelectedChange callback:",A)}}function H(f){let x=o.findIndex(A=>A===document.activeElement),w=x!==-1?x:y,p=w;switch(f){case"first":p=0;break;case"last":p=o.length-1;break;case"next":p=(w+1)%o.length;break;case"prev":p=(w-1+o.length)%o.length;break}if(o[p].focus(),o[p].setAttribute("tabindex","0"),o[y].setAttribute("tabindex","-1"),d)S(p,!1);else{let A=y;o.forEach((M,I)=>{I===p?M.setAttribute("tabindex","0"):I!==A&&M.setAttribute("tabindex","-1")})}}function q(f){return()=>{S(f)}}function k(f){return x=>{let{key:w}=x,p=!1;if(l==="horizontal")switch(w){case"ArrowLeft":x.preventDefault(),H("prev"),p=!0;break;case"ArrowRight":x.preventDefault(),H("next"),p=!0;break}else switch(w){case"ArrowUp":x.preventDefault(),H("prev"),p=!0;break;case"ArrowDown":x.preventDefault(),H("next"),p=!0;break}if(!p)switch(w){case"Home":x.preventDefault(),H("first");break;case"End":x.preventDefault(),H("last");break;case" ":case"Enter":d||(x.preventDefault(),S(f));break;case"F10":if(x.shiftKey&&n?.onContextMenu){x.preventDefault();try{n.onContextMenu(f,o[f])}catch(A){console.error("[aria-ease] Error in tabs onContextMenu callback:",A)}}break}}}function r(f){return x=>{if(n?.onContextMenu){x.preventDefault();try{n.onContextMenu(f,o[f])}catch(w){console.error("[aria-ease] Error in tabs onContextMenu callback:",w)}}}}function b(){o.forEach((f,x)=>{let w=q(x),p=k(x),A=r(x);f.addEventListener("click",w),f.addEventListener("keydown",p),n?.onContextMenu&&(f.addEventListener("contextmenu",A),v.set(f,A)),s.set(f,p),u.set(f,w)})}function i(){o.forEach(f=>{let x=s.get(f),w=u.get(f),p=v.get(f);x&&(f.removeEventListener("keydown",x),s.delete(f)),w&&(f.removeEventListener("click",w),u.delete(f)),p&&(f.removeEventListener("contextmenu",p),v.delete(f))})}function T(){i(),o.forEach((f,x)=>{let w=c[x];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}),a.removeAttribute("role"),a.removeAttribute("aria-orientation")}function C(){i();let f=Array.from(a.querySelectorAll(`.${t}`)),x=Array.from(document.querySelectorAll(`.${m}`));o.length=0,o.push(...f),c.length=0,c.push(...x),E(),b()}return E(),b(),{activateTab:S,cleanup:T,refresh:C}}function D(e,t){return t==="first"?`first ${e}`:t==="last"?`last ${e}`:t==="next"?`next ${e}`:t==="previous"?`previous ${e}`:typeof t=="number"?`${e} at index ${t}`:`${t} ${e}`}var G={"comboboxpopup.open":{setup:[{when:["keyboard","textInput","pointer"],steps:()=>[{type:"keypress",target:"input",key:"ArrowDown"}]},{when:["pointer"],steps:()=>[{type:"click",target:"button"}]}],assertion:ce},"comboboxpopup.closed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:[...le(),...J()]},"main.focused":{setup:[{when:["keyboard","pointer"],steps:()=>[{type:"focus",target:"main"}]}],assertion:fe},"main.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:ge},"input.filled":{setup:[{when:["keyboard","textInput","pointer"],steps:()=>[{type:"type",target:"input",value:"test"}]}],assertion:be},"input.empty":{setup:[{when:["keyboard","textInput","pointer"],steps:()=>[{type:"type",target:"input",value:""}]}],assertion:me},"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={})=>ue(e.relativeTarget)},"activedescendant.set":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:de},"activedescendant.unset":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:J},"option.selected":{requires:["comboboxpopup.open"],setup:[{when:["keyboard"],steps:(e={})=>[{type:"keypress",target:"relative",key:"Enter",relativeTarget:e.relativeTarget}]},{when:["pointer"],steps:(e={})=>[{type:"click",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>pe(e.relativeTarget)}};function ce(){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 le(){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 ue(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 de(){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 pe(e){return[{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-selected",expectedValue:"true",failureMessage:`Expected ${D("option",e)} to have aria-selected='true'.`}]}function fe(){return[{target:"main",assertion:"toHaveFocus",failureMessage:"Expected main to be focused."}]}function ge(){return[{target:"main",assertion:"notToHaveFocus",failureMessage:"Expected main to not have focused."}]}function be(){return[{target:"input",assertion:"toHaveValue",expectedValue:"test",failureMessage:"Expected input to have the value 'test'."}]}function me(){return[{target:"input",assertion:"toHaveValue",expectedValue:"",failureMessage:"Expected input to have the value ''."}]}var X={"menupopup.open":{setup:[{when:["keyboard"],steps:()=>[{type:"keypress",target:"main",key:"Enter"}]},{when:["pointer"],steps:()=>[{type:"click",target:"main"}]}],assertion:he},"menupopup.closed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:ve},"main.focused":{setup:[{when:["keyboard","pointer"],steps:()=>[{type:"focus",target:"main"}]}],assertion:ye},"main.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:ke},"menuitem.focused":{requires:["menupopup.open"],setup:[{when:["keyboard"],steps:(e={})=>[{type:"focus",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>Ae(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:Ee},"submenupopup.closed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:Te},"submenutrigger.focused":{setup:[{when:["keyboard","pointer"],steps:()=>[{type:"focus",target:"submenuTrigger"}]}],assertion:xe},"submenutrigger.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:we},"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={})=>Me(e.relativeTarget)}};function he(){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 ve(){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 ye(){return[{target:"main",assertion:"toHaveFocus",failureMessage:"Expected menu main to be focused."}]}function ke(){return[{target:"main",assertion:"notToHaveFocus",failureMessage:"Expected menu main to not have focused."}]}function Ae(e){return[{target:"relative",assertion:"toHaveFocus",expectedValue:e,failureMessage:`${e} menu item should have focus.`}]}function Ee(){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 Te(){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 xe(){return[{target:"submenuTrigger",assertion:"toHaveFocus",failureMessage:"Expected submenu trigger to be focused."}]}function we(){return[{target:"submenuTrigger",assertion:"notToHaveFocus",failureMessage:"Expected submenu trigger to not have focused."}]}function Me(e){return[{target:"relative",relativeTarget:e,assertion:"toHaveFocus",failureMessage:`Expected submenu item ${e} to have focus.`}]}var Q={"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={})=>Se(e.relativeTarget)},"tab.focused":{setup:[{when:["keyboard","pointer"],steps:(e={})=>[{type:"focus",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>Le(e.relativeTarget)},"tab.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(e={})=>He(e.relativeTarget)}};function Le(e){return[{target:"relative",assertion:"toHaveFocus",relativeTarget:e,failureMessage:`Expected ${D("tab",e)} to have focus.`}]}function He(e){return[{target:"relative",assertion:"toHaveFocus",relativeTarget:e,failureMessage:`Expected ${D("tab",e)} not to have focus.`}]}function Ce(e){return[{target:"relative",assertion:"toHaveAttribute",attribute:"aria-selected",expectedValue:"true",relativeTarget:e,failureMessage:`Expected ${D("tab",e)} to have tabindex='0'.`}]}function Se(e){return[{target:"relative",assertion:"toHaveAttribute",attribute:"aria-selected",expectedValue:"true",relativeTarget:e,failureMessage:`Expected ${D("tab",e)} to have aria-selected='true'.`},{target:"panel",assertion:"toBeVisible",controlledBy:{target:"relative",relativeTarget:e},failureMessage:`Expected panel controlled by the ${D("tab",e)} to be visible.`},Ce(e)]}var Y={"panel.expanded":{setup:[{when:["keyboard"],steps:e=>[{type:"keypress",target:"relative",relativeTarget:e.relativeTarget,key:"Enter"}]},{when:["pointer"],steps:e=>[{type:"click",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>$e(e.relativeTarget)},"panel.collapsed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(e={})=>De(e.relativeTarget)},"trigger.focused":{setup:[{when:["keyboard","pointer"],steps:e=>[{type:"focus",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>Ie(e.relativeTarget)},"trigger.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(e={})=>qe(e.relativeTarget)}};function $e(e){return[{target:"panel",assertion:"toBeVisible",controlledBy:{target:"relative",relativeTarget:e},failureMessage:`Expected panel controlled by the ${e} trigger to be visible.`},{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"true",failureMessage:"Expected trigger to have aria-expanded='true' when panel expands."}]}function De(e){return[{target:"panel",assertion:"notToBeVisible",controlledBy:{target:"relative",relativeTarget:e},failureMessage:`Expected panel controlled by the ${e} trigger not to be visible.`},{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"false",failureMessage:"Expected trigger to have aria-expanded='false' when panel collapses."}]}function Ie(e){return[{target:"relative",assertion:"toHaveFocus",relativeTarget:e,failureMessage:`Expected ${D("trigger",e)} to have focus.`}]}function qe(e){return[{target:"relative",assertion:"toHaveFocus",relativeTarget:e,failureMessage:`Expected ${D("trigger",e)} not to have focus.`}]}var Z={"radio.checked":{setup:[{when:["keyboard"],steps:e=>[{type:"keypress",target:"relative",relativeTarget:e.relativeTarget,key:"Space"}]},{when:["pointer"],steps:e=>[{type:"click",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>Re(e.relativeTarget)},"radio.unchecked":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(e={})=>Pe(e.relativeTarget)},"radio.focused":{setup:[{when:["keyboard","pointer"],steps:e=>[{type:"focus",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>_e(e.relativeTarget)},"radio.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(e={})=>Ve(e.relativeTarget)}};function Re(e){return[{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-checked",expectedValue:"true",failureMessage:"Expected radio to have aria-checked='true' when checked."}]}function Pe(e){return[{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-checked",expectedValue:"false",failureMessage:"Expected radio to have aria-checked='false' when unchecked."}]}function _e(e){return[{target:"relative",assertion:"toHaveFocus",relativeTarget:e,failureMessage:`Expected ${D("radio",e)} to have focus.`}]}function Ve(e){return[{target:"relative",assertion:"toHaveFocus",relativeTarget:e,failureMessage:`Expected ${D("radio",e)} not to have focus.`}]}var ee={"checkbox.checked":{setup:[{when:["keyboard"],steps:e=>[{type:"keypress",target:"relative",relativeTarget:e.relativeTarget,key:"Space"}]},{when:["pointer"],steps:e=>[{type:"click",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>Oe(e.relativeTarget)},"checkbox.unchecked":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(e={})=>Be(e.relativeTarget)},"checkbox.focused":{setup:[{when:["keyboard","pointer"],steps:e=>[{type:"focus",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>Fe(e.relativeTarget)},"checkbox.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(e={})=>Ne(e.relativeTarget)}};function Oe(e){return[{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-checked",expectedValue:"true",failureMessage:"Expected checkbox to have aria-checked='true' when checked."}]}function Be(e){return[{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-checked",expectedValue:"false",failureMessage:"Expected checkbox to have aria-checked='false' when unchecked."}]}function Fe(e){return[{target:"relative",assertion:"toHaveFocus",relativeTarget:e,failureMessage:`Expected ${D("checkbox",e)} to have focus.`}]}function Ne(e){return[{target:"relative",assertion:"toHaveFocus",relativeTarget:e,failureMessage:`Expected ${D("checkbox",e)} not to have focus.`}]}var te={"toggle.pressed":{setup:[{when:["keyboard"],steps:e=>[{type:"keypress",target:"relative",relativeTarget:e.relativeTarget,key:"Enter"}]},{when:["pointer"],steps:e=>[{type:"click",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>Ke(e.relativeTarget)},"toggle.unpressed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(e={})=>Ue(e.relativeTarget)},"toggle.focused":{setup:[{when:["keyboard","pointer"],steps:e=>[{type:"focus",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>ze(e.relativeTarget)},"toggle.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(e={})=>We(e.relativeTarget)}};function Ke(e){return[{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-pressed",expectedValue:"true",failureMessage:"Expected toggle to have aria-pressed='true' when pressed."}]}function Ue(e){return[{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-pressed",expectedValue:"false",failureMessage:"Expected toggle to have aria-pressed='false' when unpressed."}]}function ze(e){return[{target:"relative",assertion:"toHaveFocus",relativeTarget:e,failureMessage:`Expected ${D("toggle",e)} to have focus.`}]}function We(e){return[{target:"relative",assertion:"notToHaveFocus",relativeTarget:e,failureMessage:`Expected ${D("toggle",e)} not to have focus.`}]}function je(e,t){return t.some(m=>e.capabilities.includes(m))}function F(e,t){Array.isArray(e)&&e.length&&!e[0].when&&(e=[{when:["keyboard"],steps:()=>e}]);for(let m of e)if(je(t,m.when))return m.steps(t);throw new Error(`No setup strategy matches capabilities: ${t.capabilities.join(", ")}`)}var Je={combobox:G,menu:X,tabs:Q,accordion:Y,radio:Z,checkbox:ee,toggle:te},N=class{constructor(t){this.jsonContract=t}toJSON(){return this.jsonContract}},K=class{constructor(t){this.componentName=t;this.statePack=Je[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,l={capabilities:["keyboard"]},d=(a,o=new Set)=>{if(o.has(a))return[];o.add(a);let c=m[a];if(!c)return[];let s=[];if(Array.isArray(c.requires))for(let u of c.requires)s=s.concat(d(u,o));return c.setup&&(s=s.concat(F(c.setup,l))),s};return t({ariaReference:(a,o,c)=>({requires:s=>{let u=d(s,new Set);return{required:()=>this.relationshipInvariants.push({type:"aria-reference",from:a,attribute:o,to:c,level:"required",setup:u}),optional:()=>this.relationshipInvariants.push({type:"aria-reference",from:a,attribute:o,to:c,level:"optional",setup:u}),recommended:()=>this.relationshipInvariants.push({type:"aria-reference",from:a,attribute:o,to:c,level:"recommended",setup:u})}},required:()=>this.relationshipInvariants.push({type:"aria-reference",from:a,attribute:o,to:c,level:"required"}),optional:()=>this.relationshipInvariants.push({type:"aria-reference",from:a,attribute:o,to:c,level:"optional"}),recommended:()=>this.relationshipInvariants.push({type:"aria-reference",from:a,attribute:o,to:c,level:"recommended"})}),contains:(a,o)=>({requires:c=>{let s=d(c,new Set);return{required:()=>this.relationshipInvariants.push({type:"contains",parent:a,child:o,level:"required",setup:s}),optional:()=>this.relationshipInvariants.push({type:"contains",parent:a,child:o,level:"optional",setup:s}),recommended:()=>this.relationshipInvariants.push({type:"contains",parent:a,child:o,level:"recommended",setup:s})}},required:()=>this.relationshipInvariants.push({type:"contains",parent:a,child:o,level:"required"}),optional:()=>this.relationshipInvariants.push({type:"contains",parent:a,child:o,level:"optional"}),recommended:()=>this.relationshipInvariants.push({type:"contains",parent:a,child:o,level:"recommended"})})}),this}static(t){return t({target:l=>{let d=o=>{let c=this.statePack,s={capabilities:["keyboard"]},u=(v,y=new Set)=>{if(y.has(v))return[];y.add(v);let E=c[v];if(!E)return[];let S=[];if(Array.isArray(E.requires))for(let H of E.requires)S=S.concat(u(H,y));return E.setup&&(S=S.concat(F(E.setup,s))),S};return u(o,new Set)},n=o=>o==="role"?"toHaveRole":"toHaveAttribute",a=(o,c,s)=>{let u=n(o);return{required:()=>this.staticAssertions.push({target:l,assertion:u,attribute:o,expectedValue:c,failureMessage:"",level:"required",setup:s}),optional:()=>this.staticAssertions.push({target:l,assertion:u,attribute:o,expectedValue:c,failureMessage:"",level:"optional",setup:s}),recommended:()=>this.staticAssertions.push({target:l,assertion:u,attribute:o,expectedValue:c,failureMessage:"",level:"recommended",setup:s})}};return{has:(o,c)=>({...a(o,c),requires:u=>{let v=d(u);return a(o,c,v)}})}}}),this}when(t){return new U(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?this.staticAssertions:[],dynamic:this.dynamicTests}}},U=class{constructor(t,m,l){this.parent=t;this.statePack=m;this.event=l}_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(l=>typeof l=="string"?[l]:typeof l=="object"&&l!==null&&"type"in l&&"ref"in l?this._findStateKeyByTypeAndRef(l.type)?[{type:l.type,ref:l.ref}]:[]:[l])}_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 l={capabilities:[{keypress:"keyboard",click:"pointer",type:"textInput",focus:"keyboard",hover:"pointer"}[this._as||"keyboard"]||this._as||"keyboard"]},d=(s,u=new Set,v)=>{if(u.has(s))return[];u.add(s);let y=this.statePack[s];if(!y)return[];let E=[];if(Array.isArray(y.requires))for(let S of y.requires)E=E.concat(d(S,u,v));if(y.setup){let S=y.setup.filter(H=>H.when.some(q=>l.capabilities.includes(q)));for(let H of S)typeof H.steps=="function"?E=E.concat(H.steps({relativeTarget:v})):E=E.concat(H.steps)}return E},n=[];for(let s of this._given)typeof s=="string"?n=n.concat(d(s,new Set)):typeof s=="object"&&s.type&&(n=n.concat(d(s.type,new Set,s.ref)));let a=new Set;n=n.filter(s=>{let u=[s.type,s.target,s.relativeTarget].join(":");return a.has(u)?!1:(a.add(u),!0)});let o=[];for(let s of this._then)if(typeof s=="string"){let u=this.statePack[s];if(u&&u.assertion!==void 0){let v=u.assertion;if(typeof v=="function")try{v=v()}catch(y){throw new Error(`Error calling assertion function for state '${s}': ${y.message}`)}Array.isArray(v)?o.push(...v):o.push(v)}}else if(typeof s=="object"&&s!==null&&"type"in s&&"ref"in s){let u=this._findStateKeyByTypeAndRef(s.type);if(u){let v=this.statePack[u];if(v&&v.assertion!==void 0){let y=v.assertion;if(typeof y=="function")try{y=y({relativeTarget:s.ref})}catch(E){throw new Error(`Error calling assertion function for state '${u}': ${E.message}`)}Array.isArray(y)?o.push(...y):o.push(y)}}}let c=[{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:c,assertions:o,...n.length?{setup:n}:{}})}};function _t(e,t){let m=new K(e);return t(m),new N(m.build())}import Ge from"path";async function re(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 l={violations:[]};async function d(u){try{let v=await fetch(u,{method:"HEAD",signal:AbortSignal.timeout(1e3)});if(v.ok||v.status===304)return u}catch{return null}return null}let n=B(m.strictness),a={},o=typeof process<"u"?process.cwd():"";if(typeof process<"u"&&typeof process.cwd=="function")try{let{loadConfig:u}=await import("./configLoader-ZEJVXLX7.js"),v=await u(process.cwd());if(a=v.config,v.configPath&&(o=Ge.dirname(v.configPath)),m.strictness===void 0){let y=a.test?.components?.find(E=>E?.name===e)?.strictness;n=B(y??a.test?.strictness)}}catch{m.strictness===void 0&&(n="balanced")}let c;try{if(t){let u=await d(t);if(u){console.log(`\u{1F3AD} Running Playwright tests on ${u}`);let{runContractTestsPlaywright:v}=await import("./contractTestRunnerPlaywright-CHCVW7VO.js");c=await v(e,u,n,a,o)}else throw new Error(`\u274C Dev server not running at ${t}
|
|
1
|
+
import{b as z,d as O}from"./chunk-APUMBDOT.js";import"./chunk-CNU4N4AY.js";function Xe({accordionId:e,triggersClass:t,panelsClass:m,allowMultipleOpen:l=!1,callback:d}){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 n=document.querySelector(`#${e}`);if(!n)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 a=Array.from(n.querySelectorAll(`.${t}`));if(a.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 o=Array.from(n.querySelectorAll(`.${m}`));if(o.length===0)return console.error(`[aria-ease] No elements with class="${m}" found. Make sure accordion panels exist before calling makeAccordionAccessible.`),{cleanup:()=>{}};if(a.length!==o.length)return console.error(`[aria-ease] Accordion trigger/panel mismatch: found ${a.length} triggers but ${o.length} panels.`),{cleanup:()=>{}};let c=new WeakMap,s=new WeakMap;function u(){a.forEach((i,T)=>{let C=o[T];i.id||(i.id=`${e}-trigger-${T}`),C.id||(C.id=`${e}-panel-${T}`),i.setAttribute("aria-controls",C.id),i.setAttribute("aria-expanded","false"),(!l||a.length<=6)&&C.setAttribute("role","region"),C.setAttribute("aria-labelledby",i.id),C.style.display="none"})}function v(i){if(i<0||i>=a.length){console.error(`[aria-ease] Invalid accordion index: ${i}`);return}let T=a[i],C=o[i];if(T.setAttribute("aria-expanded","true"),C.style.display="block",d?.onExpandedChange)try{d.onExpandedChange(i,!0)}catch(f){console.error("[aria-ease] Error in accordion onExpandedChange callback:",f)}}function y(i){if(i<0||i>=a.length){console.error(`[aria-ease] Invalid accordion index: ${i}`);return}let T=a[i],C=o[i];if(T.setAttribute("aria-expanded","false"),C.style.display="none",d?.onExpandedChange)try{d.onExpandedChange(i,!1)}catch(f){console.error("[aria-ease] Error in accordion onExpandedChange callback:",f)}}function E(i){a[i].getAttribute("aria-expanded")==="true"?y(i):(l||a.forEach((f,x)=>{x!==i&&y(x)}),v(i))}function S(i){return()=>{E(i)}}function H(i){return T=>{let{key:C}=T;switch(C){case"Enter":case" ":T.preventDefault(),E(i);break;case"ArrowDown":T.preventDefault();{let f=(i+1)%a.length;a[f].focus()}break;case"ArrowUp":T.preventDefault();{let f=(i-1+a.length)%a.length;a[f].focus()}break;case"Home":T.preventDefault(),a[0].focus();break;case"End":T.preventDefault(),a[a.length-1].focus();break}}}function q(){a.forEach((i,T)=>{let C=S(T),f=H(T);i.addEventListener("click",C),i.addEventListener("keydown",f),c.set(i,f),s.set(i,C)})}function k(){a.forEach(i=>{let T=c.get(i),C=s.get(i);T&&(i.removeEventListener("keydown",T),c.delete(i)),C&&(i.removeEventListener("click",C),s.delete(i))})}function r(){k(),a.forEach((i,T)=>{y(T)})}function b(){k();let i=Array.from(n.querySelectorAll(`.${t}`)),T=Array.from(n.querySelectorAll(`.${m}`));a.length=0,a.push(...i),o.length=0,o.push(...T),u(),q()}return u(),q(),{expandItem:v,collapseItem:y,toggleItem:E,cleanup:r,refresh:b}}function _(e){if(e.tagName!=="INPUT")return!1;let t=e.type;return["text","email","password","tel","number"].includes(t)}function V(e){return e.tagName==="TEXTAREA"}function W(e){return e.tagName==="BUTTON"||e.tagName==="INPUT"&&["button","submit","reset"].includes(e.type)}function ie(e){return e.tagName==="A"}function B(e,t,m){let l=e.length,d=(t+m+l)%l;e.item(d).focus()}function se(e){return e.getAttribute("data-custom-click")!==null&&e.getAttribute("data-custom-click")!==void 0}function j(e,t,m){let l=t.item(m);switch(e.key){case"ArrowUp":case"ArrowLeft":{(!_(l)&&!V(l)||(_(l)||V(l))&&l.selectionStart===0)&&(e.preventDefault(),B(t,m,-1));break}case"ArrowDown":case"ArrowRight":{if(!_(l)&&!V(l))e.preventDefault(),B(t,m,1);else if(_(l)||V(l)){let d=l.value;l.selectionStart===d.length&&(e.preventDefault(),B(t,m,1))}break}case"Escape":{e.preventDefault();break}case"Enter":case" ":{(!W(l)&&!ie(l)&&se(l)||W(l))&&(e.preventDefault(),l.click());break}case"Tab":break;default:break}}function et({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 l=null;function d(){return l||(l=m.querySelectorAll(`.${t}`)),l}let n=d();if(!n||n.length===0)return console.error(`[aria-ease] Element with class="${t}" not found. Make sure the block items exist before calling makeBlockAccessible.`),{cleanup:()=>{}};let a=new Map;n.forEach(s=>{if(!a.has(s)){let u=v=>{let y=m.querySelectorAll(`.${t}`),E=Array.prototype.indexOf.call(y,s);j(v,y,E)};s.addEventListener("keydown",u),a.set(s,u)}});function o(){n.forEach(s=>{let u=a.get(s);u&&(s.removeEventListener("keydown",u),a.delete(s))})}function c(){l=null}return{cleanup:o,refresh:c}}function rt({checkboxGroupId:e,checkboxesClass:t,callback:m}){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 l=document.querySelector(`#${e}`);if(!l)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 d=Array.from(l.querySelectorAll(`.${t}`));if(d.length===0)return console.error(`[aria-ease] No elements with class="${t}" found. Make sure checkboxes exist before calling makeCheckboxAccessible.`),{cleanup:()=>{}};let n=new WeakMap,a=new WeakMap;function o(){l.getAttribute("role")||l.setAttribute("role","group"),d.forEach(r=>{r.setAttribute("role","checkbox");let b=r.checked;r.setAttribute("aria-checked",b?"true":"false"),r.hasAttribute("tabindex")||r.setAttribute("tabindex","0")})}function c(r,b){if(m?.onCheckedChange)try{m.onCheckedChange(r,b)}catch(i){console.error("[aria-ease] Error in checkbox onCheckedChange callback:",i)}}function s(r){if(r<0||r>=d.length){console.error(`[aria-ease] Invalid checkbox index: ${r}`);return}let b=d[r],i=!b.checked;b.checked=i,b.setAttribute("aria-checked",i?"true":"false"),c(r,i)}function u(r,b){if(r<0||r>=d.length){console.error(`[aria-ease] Invalid checkbox index: ${r}`);return}let i=d[r];i.checked=b,i.setAttribute("aria-checked",b?"true":"false"),c(r,b)}function v(r){return()=>{let b=d[r];if("checked"in b&&typeof b.checked=="boolean")setTimeout(()=>{let i=b.checked;b.setAttribute("aria-checked",i?"true":"false"),c(r,i)},0);else{let i=b.getAttribute("aria-checked")==="true";b.setAttribute("aria-checked",i?"false":"true"),c(r,!i)}}}function y(r){return b=>{let{key:i}=b;switch(i){case" ":case"Spacebar":b.preventDefault(),s(r);break}}}function E(){d.forEach((r,b)=>{let i=v(b),T=y(b);r.addEventListener("click",i),r.addEventListener("keydown",T),n.set(r,T),a.set(r,i)})}function S(){d.forEach(r=>{let b=n.get(r),i=a.get(r);b&&(r.removeEventListener("keydown",b),n.delete(r)),i&&(r.removeEventListener("click",i),a.delete(r))})}function H(){S()}function q(){return d.map(r=>r.getAttribute("aria-checked")==="true")}function k(){return d.map((r,b)=>r.getAttribute("aria-checked")==="true"?b:-1).filter(r=>r!==-1)}return o(),E(),{toggleCheckbox:s,setCheckboxState:u,getCheckedStates:q,getCheckedIndices:k,cleanup:H}}function oe({menuId:e,menuItemsClass:t,triggerId:m,callback:l}){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 d=document.querySelector(`#${e}`);if(!d)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 n=document.querySelector(`#${m}`);if(!n)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:()=>{}};n.setAttribute("aria-haspopup","true"),n.setAttribute("aria-controls",e),n.setAttribute("aria-expanded","false"),d.setAttribute("role","menu"),d.setAttribute("aria-labelledby",m);let a=new WeakMap,o=new Map,c=null,s=null;function u(){return c||(c=d.querySelectorAll(`.${t}`)),c}function v(){if(!s){let g=u();s=[];for(let h=0;h<g.length;h++){let w=g.item(h),$=b(w),R=w.getAttribute("aria-disabled")==="true";$||(w.hasAttribute("tabindex")||w.setAttribute("tabindex","-1"),R||s.push(w))}}return s}function y(g){return{length:g.length,item:w=>g[w],forEach:w=>{g.forEach(w)},[Symbol.iterator]:function*(){for(let w of g)yield w}}}function E(){u().forEach(h=>{h.setAttribute("role","menuitem");let w=h.getAttribute("data-submenu-id")??h.getAttribute("aria-controls"),$=h.hasAttribute("aria-haspopup")&&w;w&&(h.hasAttribute("data-submenu-id")||$)&&(h.setAttribute("aria-haspopup","menu"),h.setAttribute("aria-controls",w),h.hasAttribute("aria-expanded")||h.setAttribute("aria-expanded","false"))})}function S(g,h,w){let $=g.length,R=(h+w+$)%$;g.item(R).focus()}function H(g,h){g.length!==0&&g[h]?.focus()}function q(g){return g.hasAttribute("aria-controls")&&g.hasAttribute("aria-haspopup")&&g.getAttribute("role")==="menuitem"}function k(g){let h=g;for(;h&&h.getAttribute("role")==="menuitem";){let w=h.closest('[role="menu"]');if(!w)break;w.style.display="none",h.setAttribute("aria-expanded","false");let $=w.getAttribute("aria-labelledby");if(!$)break;let R=document.getElementById($);if(!R)break;h=R}}E();function r(g,h,w){switch(g.key){case"ArrowLeft":{if(g.key==="ArrowLeft"&&n.getAttribute("role")==="menuitem"){g.preventDefault(),p();return}break}case"ArrowUp":{g.preventDefault(),S(y(v()),w,-1);break}case"ArrowRight":{if(g.key==="ArrowRight"&&q(h)){g.preventDefault();let $=h.getAttribute("aria-controls");if($){T($);return}}break}case"ArrowDown":{g.preventDefault(),S(y(v()),w,1);break}case"Home":{g.preventDefault(),H(v(),0);break}case"End":{g.preventDefault();let $=v();H($,$.length-1);break}case"Escape":{g.preventDefault(),p(),n.focus(),C&&C(!1);break}case"Enter":case" ":{if(g.preventDefault(),q(h)){let $=h.getAttribute("aria-controls");if($){T($);return}}h.click(),p(),C&&C(!1);break}case"Tab":{p(),k(n),C&&C(!1);break}default:break}}function b(g){let h=g.parentElement;for(;h&&h!==d;){if(h.getAttribute("role")==="menu"||h.id&&d.querySelector(`[aria-controls="${h.id}"]`))return!0;h=h.parentElement}return!1}function i(g){n.setAttribute("aria-expanded",g?"true":"false")}function T(g){let h=o.get(g);if(!h){let w=d.querySelector(`[aria-controls="${g}"]`);if(!w){console.error(`[aria-ease] Submenu trigger with aria-controls="${g}" not found in menu "${e}".`);return}if(!w.id){let R=`trigger-${g}`;w.id=R,console.warn(`[aria-ease] Submenu trigger for "${g}" had no ID. Auto-generated ID: "${R}".`)}if(!document.querySelector(`#${g}`)){console.error(`[aria-ease] Submenu element with id="${g}" not found. Cannot create submenu instance.`);return}h=oe({menuId:g,menuItemsClass:t,triggerId:w.id,callback:l}),o.set(g,h)}h.openMenu()}function C(g){if(l?.onExpandedChange)try{l.onExpandedChange(g)}catch(h){console.error("[aria-ease] Error in menu onExpandedChange callback:",h)}}function f(){v().forEach((h,w)=>{if(!a.has(h)){let $=R=>r(R,h,w);h.addEventListener("keydown",$),a.set(h,$)}})}function x(){v().forEach(h=>{let w=a.get(h);w&&(h.removeEventListener("keydown",w),a.delete(h))})}function M(){i(!0),d.style.display="block";let g=v();if(f(),g&&g.length>0&&g[0].focus(),l?.onExpandedChange)try{l.onExpandedChange(!0)}catch(h){console.error("[aria-ease] Error in menu onExpandedChange callback:",h)}}function p(){if(o.forEach(g=>g.closeMenu()),i(!1),d.style.display="none",x(),n.focus(),l?.onExpandedChange)try{l.onExpandedChange(!1)}catch(g){console.error("[aria-ease] Error in menu onExpandedChange callback:",g)}}function A(){n.getAttribute("aria-expanded")==="true"?p():M()}function L(g){if(!(n.getAttribute("aria-expanded")==="true"))return;let w=n.contains(g.target),$=d.contains(g.target);!w&&!$&&p()}n.addEventListener("click",A),document.addEventListener("click",L);function I(){x(),n.removeEventListener("click",A),document.removeEventListener("click",L),d.style.display="none",i(!1),o.forEach(g=>g.cleanup()),o.clear()}function P(){c=null,s=null}return{openMenu:M,closeMenu:p,cleanup:I,refresh:P}}function it({radioGroupId:e,radiosClass:t,defaultSelectedIndex:m,callback:l}){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 d=document.querySelector(`#${e}`);if(!d)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 n=Array.from(d.querySelectorAll(`.${t}`));if(n.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,o=new WeakMap,c;m&&(c=m);function s(){d.getAttribute("role")||d.setAttribute("role","radiogroup"),n.forEach((k,r)=>{k.setAttribute("role","radio"),k.setAttribute("tabindex","0");let b=r===c;k.setAttribute("aria-checked",b?"true":"false"),k.checked!==void 0&&(k.checked=b)})}function u(k){if(k<0||k>=n.length){console.error(`[aria-ease] Invalid radio index: ${k}`);return}if(c>=0&&c<n.length&&(n[c].setAttribute("aria-checked","false"),n[c].checked!==void 0&&(n[c].checked=!1)),n[k].setAttribute("aria-checked","true"),n[k].checked!==void 0&&(n[k].checked=!0),n[k].focus(),l?.onValueChange)try{l.onValueChange(k,n[k].getAttribute("value"))}catch(r){console.error("[aria-ease] Error in radio onValueChange callback:",r)}c=k}function v(k){return()=>{let r=n[k];"checked"in r&&typeof r.checked=="boolean"?setTimeout(()=>{u(k)},0):u(k)}}function y(k){return r=>{let{key:b}=r,i=k;switch(b){case"ArrowDown":case"ArrowRight":r.preventDefault(),i=(k+1)%n.length,u(i);break;case"ArrowUp":case"ArrowLeft":r.preventDefault(),i=(k-1+n.length)%n.length,u(i);break;case" ":case"Enter":r.preventDefault(),u(k);break}}}function E(){n.forEach((k,r)=>{let b=v(r),i=y(r);k.addEventListener("click",b),k.addEventListener("keydown",i),a.set(k,i),o.set(k,b)})}function S(){n.forEach(k=>{let r=a.get(k),b=o.get(k);r&&(k.removeEventListener("keydown",r),a.delete(k)),b&&(k.removeEventListener("click",b),o.delete(k))})}function H(){S()}function q(){return c}return s(),E(),{selectRadio:u,getSelectedIndex:q,cleanup:H}}function ot({toggleId:e,togglesClass:t,isSingleToggle:m=!0,callback:l}){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 d=document.querySelector(`#${e}`);if(!d)return console.error(`[aria-ease] Element with id="${e}" not found. Make sure the toggle element exists before calling makeToggleAccessible.`),{cleanup:()=>{}};let n;if(m)n=[d];else{if(!t)return console.error("[aria-ease] togglesClass is required when isSingleToggle is false."),{cleanup:()=>{}};if(n=Array.from(d.querySelectorAll(`.${t}`)),n.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,o=new WeakMap;function c(){n.forEach(r=>{r.tagName.toLowerCase()!=="button"&&!r.getAttribute("role")&&r.setAttribute("role","button"),r.hasAttribute("aria-pressed")||r.setAttribute("aria-pressed","false"),r.hasAttribute("tabindex")||r.setAttribute("tabindex","0")})}function s(r){if(r<0||r>=n.length){console.error(`[aria-ease] Invalid toggle index: ${r}`);return}let i=n[r].getAttribute("aria-pressed")==="true";u(r,!i)}function u(r,b){if(r<0||r>=n.length){console.error(`[aria-ease] Invalid toggle index: ${r}`);return}if(n[r].setAttribute("aria-pressed",b?"true":"false"),l?.onPressedChange)try{l.onPressedChange(r,b)}catch(i){console.error("[aria-ease] Error in checkbox onPressedChange callback:",i)}}function v(r){return()=>{s(r)}}function y(r){return b=>{let{key:i}=b;switch(i){case"Enter":case" ":b.preventDefault(),s(r);break}}}function E(){n.forEach((r,b)=>{let i=v(b),T=y(b);r.addEventListener("click",i),r.addEventListener("keydown",T),a.set(r,T),o.set(r,i)})}function S(){n.forEach(r=>{let b=a.get(r),i=o.get(r);b&&(r.removeEventListener("keydown",b),a.delete(r)),i&&(r.removeEventListener("click",i),o.delete(r))})}function H(){S()}function q(){return n.map(r=>r.getAttribute("aria-pressed")==="true")}function k(){return n.map((r,b)=>r.getAttribute("aria-pressed")==="true"?b:-1).filter(r=>r!==-1)}return c(),E(),{toggleButton:s,setPressed:u,getPressedStates:q,getPressedIndices:k,cleanup:H}}function lt({comboboxInputId:e,comboboxButtonId:t,listBoxId:m,listBoxItemsClass:l,callback:d}){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 n=document.getElementById(`${e}`);if(!n)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 a=document.getElementById(`${m}`);if(!a)return console.error(`[aria-ease] Element with id="${m}" not found. Make sure the combobox listbox element exists before calling makeComboboxAccessible.`),{cleanup:()=>{}};if(l==="")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(l))return console.error(`[aria-ease] Listbox option(s) with class="${l}" not found. Make sure at least a combobox listbox option exists before calling makeComboboxAccessible.`),{cleanup:()=>{}};let c=t?document.getElementById(`${t}`):null,s=-1;n.setAttribute("role","combobox"),n.setAttribute("aria-autocomplete","list"),n.setAttribute("aria-controls",m),n.setAttribute("aria-expanded","false"),n.setAttribute("aria-haspopup","listbox"),a.setAttribute("role","listbox");let u=null;function v(){return u||(u=a.querySelectorAll(`.${l}`)),Array.from(u).filter(p=>!p.hidden&&p.style.display!=="none")}function y(){return n.getAttribute("aria-expanded")==="true"}function E(p){let A=v();if(p>=0&&p<A.length){let L=A[p],I=L.id||`${m}-option-${p}`;if(L.id||(L.id=I),n.setAttribute("aria-activedescendant",I),typeof L.scrollIntoView=="function"&&L.scrollIntoView({block:"nearest",behavior:"smooth"}),d?.onActiveDescendantChange)try{d.onActiveDescendantChange(I,L)}catch(P){console.error("[aria-ease] Error in combobox onActiveDescendantChange callback:",P)}}else n.setAttribute("aria-activedescendant","");s=p}function S(){if(n.setAttribute("aria-expanded","true"),a.style.display="block",d?.onExpandedChange)try{d.onExpandedChange(!0)}catch(p){console.error("[aria-ease] Error in combobox onExpandedChange callback:",p)}}function H(){if(n.setAttribute("aria-expanded","false"),n.setAttribute("aria-activedescendant",""),a.style.display="none",s=-1,d?.onExpandedChange)try{d.onExpandedChange(!1)}catch(p){console.error("[aria-ease] Error in combobox onExpandedChange callback:",p)}}function q(p){if(p.setAttribute("aria-selected","true"),H(),d?.onSelect)try{d.onSelect(p)}catch(A){console.error("[aria-ease] Error in combobox onSelect callback:",A)}}function k(p){let A=v(),L=y();switch(p.key){case"ArrowDown":if(p.preventDefault(),!L){S();return}if(A.length===0)return;{let I=s>=A.length-1?0:s+1;E(I)}break;case"ArrowUp":if(p.preventDefault(),!L)return;if(A.length>0){let I=s<=0?A.length-1:s-1;E(I)}break;case"Enter":L&&s>=0&&s<A.length&&(p.preventDefault(),q(A[s]));break;case"Escape":if(L)p.preventDefault(),H();else if(n.value&&(p.preventDefault(),n.value="",n.setAttribute("aria-activedescendant",""),v().forEach(P=>{P.getAttribute("aria-selected")==="true"&&P.setAttribute("aria-selected","false")}),d?.onClear))try{d.onClear()}catch(P){console.error("[aria-ease] Error in combobox onClear callback:",P)}break;case"Home":L&&A.length>0&&(p.preventDefault(),E(0));break;case"End":L&&A.length>0&&(p.preventDefault(),E(A.length-1));break;case"Tab":L&&s>=0&&s<A.length&&q(A[s]),L&&H();break}}function r(p){let A=p.target;if(A.classList.contains(l)){let I=v().indexOf(A);I>=0&&E(I)}}function b(p){let A=p.target;A.classList.contains(l)&&(p.preventDefault(),q(A))}function i(p){let A=p.target;!n.contains(A)&&!a.contains(A)&&(!c||!c.contains(A))&&H()}function T(){y()?H():(S(),n.focus())}function C(p){(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),T())}n.addEventListener("keydown",k),a.addEventListener("mousemove",r),a.addEventListener("mousedown",b),document.addEventListener("mousedown",i),c&&(c.setAttribute("tabindex","-1"),c.setAttribute("aria-label","Toggle options"),c.addEventListener("click",T),c.addEventListener("keydown",C));function f(){let p=a.querySelectorAll(`.${l}`);if(p.length===0)return;let A=null;for(let L of p)if(L.getAttribute("aria-selected")==="true"){A=L.textContent?.trim()||null;break}!A&&n.value&&(A=n.value.trim()),p.forEach((L,I)=>{L.setAttribute("role","option");let P=L.textContent?.trim()||"";A&&P===A?L.setAttribute("aria-selected","true"):L.setAttribute("aria-selected","false");let g=L.getAttribute("id");if(!g||g===""){let h=`${m}-option-${I}`;L.id=h,L.setAttribute("id",h)}})}f();function x(){n.removeEventListener("keydown",k),a.removeEventListener("mousemove",r),a.removeEventListener("mousedown",b),document.removeEventListener("mousedown",i),c&&(c.removeEventListener("click",T),c.removeEventListener("keydown",C))}function M(){u=null,f(),s=-1,E(-1)}return{cleanup:x,refresh:M,openListBox:S,closeListBox:H}}function dt({tabListId:e,tabsClass:t,tabPanelsClass:m,orientation:l="horizontal",activateOnFocus:d=!0,callback:n}){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 a=document.querySelector(`#${e}`);if(!a)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 o=Array.from(a.querySelectorAll(`.${t}`));if(o.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 c=Array.from(document.querySelectorAll(`.${m}`));if(c.length===0)return console.error(`[aria-ease] No elements with class="${m}" found. Make sure tab panels exist before calling makeTabsAccessible.`),{cleanup:()=>{}};if(o.length!==c.length)return console.error(`[aria-ease] Tab/panel mismatch: found ${o.length} tabs but ${c.length} panels.`),{cleanup:()=>{}};let s=new WeakMap,u=new WeakMap,v=new WeakMap,y=0;function E(){a.setAttribute("role","tablist"),a.setAttribute("aria-orientation",l),o.forEach((f,x)=>{let M=c[x];f.id||(f.id=`${e}-tab-${x}`),M.id||(M.id=`${e}-panel-${x}`),f.setAttribute("role","tab"),f.setAttribute("aria-controls",M.id),f.setAttribute("aria-selected","false"),f.setAttribute("tabindex","-1"),M.setAttribute("role","tabpanel"),M.setAttribute("aria-labelledby",f.id),M.hidden=!0,M.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')||M.setAttribute("tabindex","0")}),S(0,!1)}function S(f,x=!0){if(f<0||f>=o.length){console.error(`[aria-ease] Invalid tab index: ${f}`);return}o.forEach((A,L)=>{let I=c[L];A.setAttribute("aria-selected","false"),A.setAttribute("tabindex","-1"),I.hidden=!0});let M=o[f],p=c[f];if(M.setAttribute("aria-selected","true"),M.setAttribute("tabindex","0"),p.hidden=!1,x&&M.focus(),y=f,n?.onSelectedChange)try{n.onSelectedChange(f,!0)}catch(A){console.error("[aria-ease] Error in tabs onSelectedChange callback:",A)}}function H(f){let x=o.findIndex(A=>A===document.activeElement),M=x!==-1?x:y,p=M;switch(f){case"first":p=0;break;case"last":p=o.length-1;break;case"next":p=(M+1)%o.length;break;case"prev":p=(M-1+o.length)%o.length;break}if(o[p].focus(),o[p].setAttribute("tabindex","0"),o[y].setAttribute("tabindex","-1"),d)S(p,!1);else{let A=y;o.forEach((L,I)=>{I===p?L.setAttribute("tabindex","0"):I!==A&&L.setAttribute("tabindex","-1")})}}function q(f){return()=>{S(f)}}function k(f){return x=>{let{key:M}=x,p=!1;if(l==="horizontal")switch(M){case"ArrowLeft":x.preventDefault(),H("prev"),p=!0;break;case"ArrowRight":x.preventDefault(),H("next"),p=!0;break}else switch(M){case"ArrowUp":x.preventDefault(),H("prev"),p=!0;break;case"ArrowDown":x.preventDefault(),H("next"),p=!0;break}if(!p)switch(M){case"Home":x.preventDefault(),H("first");break;case"End":x.preventDefault(),H("last");break;case" ":case"Enter":d||(x.preventDefault(),S(f));break;case"F10":if(x.shiftKey&&n?.onContextMenu){x.preventDefault();try{n.onContextMenu(f,o[f])}catch(A){console.error("[aria-ease] Error in tabs onContextMenu callback:",A)}}break}}}function r(f){return x=>{if(n?.onContextMenu){x.preventDefault();try{n.onContextMenu(f,o[f])}catch(M){console.error("[aria-ease] Error in tabs onContextMenu callback:",M)}}}}function b(){o.forEach((f,x)=>{let M=q(x),p=k(x),A=r(x);f.addEventListener("click",M),f.addEventListener("keydown",p),n?.onContextMenu&&(f.addEventListener("contextmenu",A),v.set(f,A)),s.set(f,p),u.set(f,M)})}function i(){o.forEach(f=>{let x=s.get(f),M=u.get(f),p=v.get(f);x&&(f.removeEventListener("keydown",x),s.delete(f)),M&&(f.removeEventListener("click",M),u.delete(f)),p&&(f.removeEventListener("contextmenu",p),v.delete(f))})}function T(){i(),o.forEach((f,x)=>{let M=c[x];f.removeAttribute("role"),f.removeAttribute("aria-selected"),f.removeAttribute("aria-controls"),f.removeAttribute("tabindex"),M.removeAttribute("role"),M.removeAttribute("aria-labelledby"),M.removeAttribute("tabindex"),M.hidden=!1}),a.removeAttribute("role"),a.removeAttribute("aria-orientation")}function C(){i();let f=Array.from(a.querySelectorAll(`.${t}`)),x=Array.from(document.querySelectorAll(`.${m}`));o.length=0,o.push(...f),c.length=0,c.push(...x),E(),b()}return E(),b(),{activateTab:S,cleanup:T,refresh:C}}function D(e,t){return t==="first"?`first ${e}`:t==="last"?`last ${e}`:t==="next"?`next ${e}`:t==="previous"?`previous ${e}`:typeof t=="number"?`${e} at index ${t}`:`${t} ${e}`}var G={"comboboxpopup.open":{setup:[{when:["keyboard","textInput"],steps:()=>[{type:"keypress",target:"input",key:"ArrowDown"}]},{when:["pointer"],steps:()=>[{type:"click",target:"button"}]}],assertion:ce},"comboboxpopup.closed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:[...le(),...J()]},"main.focused":{setup:[{when:["keyboard","pointer"],steps:()=>[{type:"focus",target:"main"}]}],assertion:fe},"main.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:ge},"input.filled":{setup:[{when:["keyboard","textInput","pointer"],steps:()=>[{type:"type",target:"input",value:"test"}]}],assertion:be},"input.empty":{setup:[{when:["keyboard","textInput","pointer"],steps:()=>[{type:"type",target:"input",value:""}]}],assertion:me},"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={})=>ue(e.relativeTarget)},"activedescendant.set":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:de},"activedescendant.unset":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:J},"option.selected":{requires:["comboboxpopup.open"],setup:[{when:["keyboard"],steps:(e={})=>[{type:"keypress",target:"relative",key:"Enter",relativeTarget:e.relativeTarget}]},{when:["pointer"],steps:(e={})=>[{type:"click",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>pe(e.relativeTarget)}};function ce(){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 le(){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 ue(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 de(){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 pe(e){return[{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-selected",expectedValue:"true",failureMessage:`Expected ${D("option",e)} to have aria-selected='true'.`}]}function fe(){return[{target:"main",assertion:"toHaveFocus",failureMessage:"Expected main to be focused."}]}function ge(){return[{target:"main",assertion:"notToHaveFocus",failureMessage:"Expected main to not have focused."}]}function be(){return[{target:"input",assertion:"toHaveValue",expectedValue:"test",failureMessage:"Expected input to have the value 'test'."}]}function me(){return[{target:"input",assertion:"toHaveValue",expectedValue:"",failureMessage:"Expected input to have the value ''."}]}var X={"menupopup.open":{setup:[{when:["keyboard"],steps:()=>[{type:"keypress",target:"main",key:"Enter"}]},{when:["pointer"],steps:()=>[{type:"click",target:"main"}]}],assertion:he},"menupopup.closed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:ve},"main.focused":{setup:[{when:["keyboard","pointer"],steps:()=>[{type:"focus",target:"main"}]}],assertion:ye},"main.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:ke},"menuitem.focused":{requires:["menupopup.open"],setup:[{when:["keyboard"],steps:(e={})=>[{type:"focus",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>Ae(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:Ee},"submenupopup.closed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:Te},"submenutrigger.focused":{setup:[{when:["keyboard","pointer"],steps:()=>[{type:"focus",target:"submenuTrigger"}]}],assertion:xe},"submenutrigger.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:Me},"submenuitem.focused":{requires:["submenupopup.open"],setup:[{when:["keyboard","pointer"],steps:(e={})=>{let t=[];return typeof e.relativeTarget=="number"&&e.relativeTarget>1&&(t=t.concat(Array.from({length:e.relativeTarget-1},()=>({type:"keypress",target:"submenuItems",key:"ArrowDown"})))),e.relativeTarget==="last"&&(t=t.concat({type:"keypress",target:"submenuItems",key:"ArrowUp"})),t}}],assertion:(e={})=>we(e.relativeTarget)}};function he(){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 ve(){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 ye(){return[{target:"main",assertion:"toHaveFocus",failureMessage:"Expected menu main to be focused."}]}function ke(){return[{target:"main",assertion:"notToHaveFocus",failureMessage:"Expected menu main to not have focused."}]}function Ae(e){return[{target:"relative",assertion:"toHaveFocus",expectedValue:e,failureMessage:`${e} menu item should have focus.`}]}function Ee(){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 Te(){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 xe(){return[{target:"submenuTrigger",assertion:"toHaveFocus",failureMessage:"Expected submenu trigger to be focused."}]}function Me(){return[{target:"submenuTrigger",assertion:"notToHaveFocus",failureMessage:"Expected submenu trigger to not have focused."}]}function we(e){return[{target:"relative",relativeTarget:e,assertion:"toHaveFocus",failureMessage:`Expected submenu item ${e} to have focus.`}]}var Q={"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={})=>Se(e.relativeTarget)},"tab.focused":{setup:[{when:["keyboard","pointer"],steps:(e={})=>[{type:"focus",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>Le(e.relativeTarget)},"tab.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(e={})=>He(e.relativeTarget)}};function Le(e){return[{target:"relative",assertion:"toHaveFocus",relativeTarget:e,failureMessage:`Expected ${D("tab",e)} to have focus.`}]}function He(e){return[{target:"relative",assertion:"toHaveFocus",relativeTarget:e,failureMessage:`Expected ${D("tab",e)} not to have focus.`}]}function Ce(e){return[{target:"relative",assertion:"toHaveAttribute",attribute:"aria-selected",expectedValue:"true",relativeTarget:e,failureMessage:`Expected ${D("tab",e)} to have tabindex='0'.`}]}function Se(e){return[{target:"relative",assertion:"toHaveAttribute",attribute:"aria-selected",expectedValue:"true",relativeTarget:e,failureMessage:`Expected ${D("tab",e)} to have aria-selected='true'.`},{target:"panel",assertion:"toBeVisible",controlledBy:{target:"relative",relativeTarget:e},failureMessage:`Expected panel controlled by the ${D("tab",e)} to be visible.`},Ce(e)]}var Y={"panel.expanded":{setup:[{when:["keyboard"],steps:e=>[{type:"keypress",target:"relative",relativeTarget:e.relativeTarget,key:"Enter"}]},{when:["pointer"],steps:e=>[{type:"click",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>$e(e.relativeTarget)},"panel.collapsed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(e={})=>De(e.relativeTarget)},"trigger.focused":{setup:[{when:["keyboard","pointer"],steps:e=>[{type:"focus",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>Ie(e.relativeTarget)},"trigger.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(e={})=>qe(e.relativeTarget)}};function $e(e){return[{target:"panel",assertion:"toBeVisible",controlledBy:{target:"relative",relativeTarget:e},failureMessage:`Expected panel controlled by the ${e} trigger to be visible.`},{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"true",failureMessage:"Expected trigger to have aria-expanded='true' when panel expands."}]}function De(e){return[{target:"panel",assertion:"notToBeVisible",controlledBy:{target:"relative",relativeTarget:e},failureMessage:`Expected panel controlled by the ${e} trigger not to be visible.`},{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"false",failureMessage:"Expected trigger to have aria-expanded='false' when panel collapses."}]}function Ie(e){return[{target:"relative",assertion:"toHaveFocus",relativeTarget:e,failureMessage:`Expected ${D("trigger",e)} to have focus.`}]}function qe(e){return[{target:"relative",assertion:"toHaveFocus",relativeTarget:e,failureMessage:`Expected ${D("trigger",e)} not to have focus.`}]}var Z={"radio.checked":{setup:[{when:["keyboard"],steps:e=>[{type:"keypress",target:"relative",relativeTarget:e.relativeTarget,key:"Space"}]},{when:["pointer"],steps:e=>[{type:"click",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>Re(e.relativeTarget)},"radio.unchecked":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(e={})=>Pe(e.relativeTarget)},"radio.focused":{setup:[{when:["keyboard","pointer"],steps:e=>[{type:"focus",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>_e(e.relativeTarget)},"radio.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(e={})=>Ve(e.relativeTarget)}};function Re(e){return[{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-checked",expectedValue:"true",failureMessage:"Expected radio to have aria-checked='true' when checked."}]}function Pe(e){return[{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-checked",expectedValue:"false",failureMessage:"Expected radio to have aria-checked='false' when unchecked."}]}function _e(e){return[{target:"relative",assertion:"toHaveFocus",relativeTarget:e,failureMessage:`Expected ${D("radio",e)} to have focus.`}]}function Ve(e){return[{target:"relative",assertion:"toHaveFocus",relativeTarget:e,failureMessage:`Expected ${D("radio",e)} not to have focus.`}]}var ee={"checkbox.checked":{setup:[{when:["keyboard"],steps:e=>[{type:"keypress",target:"relative",relativeTarget:e.relativeTarget,key:"Space"}]},{when:["pointer"],steps:e=>[{type:"click",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>Be(e.relativeTarget)},"checkbox.unchecked":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(e={})=>Oe(e.relativeTarget)},"checkbox.focused":{setup:[{when:["keyboard","pointer"],steps:e=>[{type:"focus",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>Fe(e.relativeTarget)},"checkbox.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(e={})=>Ne(e.relativeTarget)}};function Be(e){return[{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-checked",expectedValue:"true",failureMessage:"Expected checkbox to have aria-checked='true' when checked."}]}function Oe(e){return[{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-checked",expectedValue:"false",failureMessage:"Expected checkbox to have aria-checked='false' when unchecked."}]}function Fe(e){return[{target:"relative",assertion:"toHaveFocus",relativeTarget:e,failureMessage:`Expected ${D("checkbox",e)} to have focus.`}]}function Ne(e){return[{target:"relative",assertion:"toHaveFocus",relativeTarget:e,failureMessage:`Expected ${D("checkbox",e)} not to have focus.`}]}var te={"toggle.pressed":{setup:[{when:["keyboard"],steps:e=>[{type:"keypress",target:"relative",relativeTarget:e.relativeTarget,key:"Enter"}]},{when:["pointer"],steps:e=>[{type:"click",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>Ke(e.relativeTarget)},"toggle.unpressed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(e={})=>Ue(e.relativeTarget)},"toggle.focused":{setup:[{when:["keyboard","pointer"],steps:e=>[{type:"focus",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>ze(e.relativeTarget)},"toggle.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(e={})=>We(e.relativeTarget)}};function Ke(e){return[{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-pressed",expectedValue:"true",failureMessage:"Expected toggle to have aria-pressed='true' when pressed."}]}function Ue(e){return[{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-pressed",expectedValue:"false",failureMessage:"Expected toggle to have aria-pressed='false' when unpressed."}]}function ze(e){return[{target:"relative",assertion:"toHaveFocus",relativeTarget:e,failureMessage:`Expected ${D("toggle",e)} to have focus.`}]}function We(e){return[{target:"relative",assertion:"notToHaveFocus",relativeTarget:e,failureMessage:`Expected ${D("toggle",e)} not to have focus.`}]}function je(e,t){return t.some(m=>e.capabilities.includes(m))}function F(e,t){Array.isArray(e)&&e.length&&!e[0].when&&(e=[{when:["keyboard"],steps:()=>e}]);for(let m of e)if(je(t,m.when))return m.steps(t);throw new Error(`No setup strategy matches capabilities: ${t.capabilities.join(", ")}`)}var Je={combobox:G,menu:X,tabs:Q,accordion:Y,radio:Z,checkbox:ee,toggle:te},N=class{constructor(t){this.jsonContract=t}toJSON(){return this.jsonContract}},K=class{constructor(t){this.componentName=t;this.statePack=Je[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,l={capabilities:["keyboard"]},d=(a,o=new Set)=>{if(o.has(a))return[];o.add(a);let c=m[a];if(!c)return[];let s=[];if(Array.isArray(c.requires))for(let u of c.requires)s=s.concat(d(u,o));return c.setup&&(s=s.concat(F(c.setup,l))),s};return t({ariaReference:(a,o,c)=>({requires:s=>{let u=d(s,new Set);return{required:()=>this.relationshipInvariants.push({type:"aria-reference",from:a,attribute:o,to:c,level:"required",setup:u}),optional:()=>this.relationshipInvariants.push({type:"aria-reference",from:a,attribute:o,to:c,level:"optional",setup:u}),recommended:()=>this.relationshipInvariants.push({type:"aria-reference",from:a,attribute:o,to:c,level:"recommended",setup:u})}},required:()=>this.relationshipInvariants.push({type:"aria-reference",from:a,attribute:o,to:c,level:"required"}),optional:()=>this.relationshipInvariants.push({type:"aria-reference",from:a,attribute:o,to:c,level:"optional"}),recommended:()=>this.relationshipInvariants.push({type:"aria-reference",from:a,attribute:o,to:c,level:"recommended"})}),contains:(a,o)=>({requires:c=>{let s=d(c,new Set);return{required:()=>this.relationshipInvariants.push({type:"contains",parent:a,child:o,level:"required",setup:s}),optional:()=>this.relationshipInvariants.push({type:"contains",parent:a,child:o,level:"optional",setup:s}),recommended:()=>this.relationshipInvariants.push({type:"contains",parent:a,child:o,level:"recommended",setup:s})}},required:()=>this.relationshipInvariants.push({type:"contains",parent:a,child:o,level:"required"}),optional:()=>this.relationshipInvariants.push({type:"contains",parent:a,child:o,level:"optional"}),recommended:()=>this.relationshipInvariants.push({type:"contains",parent:a,child:o,level:"recommended"})})}),this}static(t){return t({target:l=>{let d=o=>{let c=this.statePack,s={capabilities:["keyboard"]},u=(v,y=new Set)=>{if(y.has(v))return[];y.add(v);let E=c[v];if(!E)return[];let S=[];if(Array.isArray(E.requires))for(let H of E.requires)S=S.concat(u(H,y));return E.setup&&(S=S.concat(F(E.setup,s))),S};return u(o,new Set)},n=o=>o==="role"?"toHaveRole":"toHaveAttribute",a=(o,c,s)=>{let u=n(o);return{required:()=>this.staticAssertions.push({target:l,assertion:u,attribute:o,expectedValue:c,failureMessage:"",level:"required",setup:s}),optional:()=>this.staticAssertions.push({target:l,assertion:u,attribute:o,expectedValue:c,failureMessage:"",level:"optional",setup:s}),recommended:()=>this.staticAssertions.push({target:l,assertion:u,attribute:o,expectedValue:c,failureMessage:"",level:"recommended",setup:s})}};return{has:(o,c)=>({...a(o,c),requires:u=>{let v=d(u);return a(o,c,v)}})}}}),this}when(t){return new U(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?this.staticAssertions:[],dynamic:this.dynamicTests}}},U=class{constructor(t,m,l){this.parent=t;this.statePack=m;this.event=l}_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(l=>typeof l=="string"?[l]:typeof l=="object"&&l!==null&&"type"in l&&"ref"in l?this._findStateKeyByTypeAndRef(l.type)?[{type:l.type,ref:l.ref}]:[]:[l])}_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 l={capabilities:[{keypress:"keyboard",click:"pointer",type:"textInput",focus:"keyboard",hover:"pointer"}[this._as||"keyboard"]||this._as||"keyboard"]},d=(s,u=new Set,v)=>{if(u.has(s))return[];u.add(s);let y=this.statePack[s];if(!y)return[];let E=[];if(Array.isArray(y.requires))for(let S of y.requires)E=E.concat(d(S,u,v));if(y.setup){let S=y.setup.filter(H=>H.when.some(q=>l.capabilities.includes(q)));for(let H of S)typeof H.steps=="function"?E=E.concat(H.steps({relativeTarget:v})):E=E.concat(H.steps)}return E},n=[];for(let s of this._given)typeof s=="string"?n=n.concat(d(s,new Set)):typeof s=="object"&&s.type&&(n=n.concat(d(s.type,new Set,s.ref)));let a=new Set;n=n.filter(s=>{let u=[s.type,s.target,s.relativeTarget].join(":");return a.has(u)?!1:(a.add(u),!0)});let o=[];for(let s of this._then)if(typeof s=="string"){let u=this.statePack[s];if(u&&u.assertion!==void 0){let v=u.assertion;if(typeof v=="function")try{v=v()}catch(y){throw new Error(`Error calling assertion function for state '${s}': ${y.message}`)}Array.isArray(v)?o.push(...v):o.push(v)}}else if(typeof s=="object"&&s!==null&&"type"in s&&"ref"in s){let u=this._findStateKeyByTypeAndRef(s.type);if(u){let v=this.statePack[u];if(v&&v.assertion!==void 0){let y=v.assertion;if(typeof y=="function")try{y=y({relativeTarget:s.ref})}catch(E){throw new Error(`Error calling assertion function for state '${u}': ${E.message}`)}Array.isArray(y)?o.push(...y):o.push(y)}}}let c=[{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:c,assertions:o,...n.length?{setup:n}:{}})}};function _t(e,t){let m=new K(e);return t(m),new N(m.build())}import Ge from"path";async function re(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 l={violations:[]};async function d(u){try{let v=await fetch(u,{method:"HEAD",signal:AbortSignal.timeout(1e3)});if(v.ok||v.status===304)return u}catch{return null}return null}let n=O(m.strictness),a={},o=typeof process<"u"?process.cwd():"";if(typeof process<"u"&&typeof process.cwd=="function")try{let{loadConfig:u}=await import("./configLoader-ZEJVXLX7.js"),v=await u(process.cwd());if(a=v.config,v.configPath&&(o=Ge.dirname(v.configPath)),m.strictness===void 0){let y=a.test?.components?.find(E=>E?.name===e)?.strictness;n=O(y??a.test?.strictness)}}catch{m.strictness===void 0&&(n="balanced")}let c;try{if(t){let u=await d(t);if(u){console.log(`\u{1F3AD} Running Playwright tests on ${u}`);let{runContractTestsPlaywright:v}=await import("./contractTestRunnerPlaywright-OZOFEW66.js");c=await v(e,u,n,a,o)}else throw new Error(`\u274C Dev server not running at ${t}
|
|
2
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(u){throw u instanceof Error?u:new Error(`\u274C Contract test execution failed: ${String(u)}`)}let s={violations:l.violations,raw:l,contract:c};if(c.failures.length>0&&t==="Playwright")throw new Error(`
|
|
3
3
|
\u274C ${c.failures.length} accessibility contract test${c.failures.length>1?"s":""} failed (Playwright mode)
|
|
4
4
|
\u2705 ${c.passes.length} test${c.passes.length>1?"s":""} passed
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as AccordionConfig, a as AccessibilityInstance } from '../Types.d-
|
|
1
|
+
import { A as AccordionConfig, a as AccessibilityInstance } from '../Types.d-DO31Kt2y.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Makes an accordion accessible by managing ARIA attributes, keyboard interaction, and state.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as AccordionConfig, a as AccessibilityInstance } from '../Types.d-
|
|
1
|
+
import { A as AccordionConfig, a as AccessibilityInstance } from '../Types.d-DO31Kt2y.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Makes an accordion accessible by managing ARIA attributes, keyboard interaction, and state.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as CheckboxConfig, a as AccessibilityInstance } from '../Types.d-
|
|
1
|
+
import { C as CheckboxConfig, a as AccessibilityInstance } from '../Types.d-DO31Kt2y.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Makes a checkbox group accessible by managing ARIA attributes and keyboard interaction.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as CheckboxConfig, a as AccessibilityInstance } from '../Types.d-
|
|
1
|
+
import { C as CheckboxConfig, a as AccessibilityInstance } from '../Types.d-DO31Kt2y.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Makes a checkbox group accessible by managing ARIA attributes and keyboard interaction.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';function $({comboboxInputId:h,comboboxButtonId:x,listBoxId:b,listBoxItemsClass:u,callback:s}){if(h==="")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(`${h}`);if(!o)return console.error(`[aria-ease] Element with id="${h}" not found. Make sure the combobox input element exists before calling makeComboboxAccessible.`),{cleanup:()=>{}};if(b==="")return console.error("[aria-ease] 'listBoxId' should not be an empty string. Provide an id to the combobox listbox element that exists before calling makeComboboxAccessible."),{cleanup:()=>{}};let a=document.getElementById(`${b}`);if(!a)return console.error(`[aria-ease] Element with id="${b}" not found. Make sure the combobox listbox element exists before calling makeComboboxAccessible.`),{cleanup:()=>{}};if(u==="")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(u))return console.error(`[aria-ease] Listbox option(s) with class="${u}" not found. Make sure at least a combobox listbox option exists before calling makeComboboxAccessible.`),{cleanup:()=>{}};let l=x?document.getElementById(`${x}`):null,r=-1;o.setAttribute("role","combobox"),o.setAttribute("aria-autocomplete","list"),o.setAttribute("aria-controls",b),o.setAttribute("aria-expanded","false"),o.setAttribute("aria-haspopup","listbox"),a.setAttribute("role","listbox");let m=null;function p(){return m||(m=a.querySelectorAll(`.${u}`)),Array.from(m).filter(e=>!e.hidden&&e.style.display!=="none")}function A(){return o.getAttribute("aria-expanded")==="true"}function d(e){let t=p();if(e>=0&&e<t.length){let n=t[e],i=n.id||`${b}-option-${e}`;if(n.id||(n.id=i),o.setAttribute("aria-activedescendant",i),typeof n.scrollIntoView=="function"&&n.scrollIntoView({block:"nearest",behavior:"smooth"}),s?.onActiveDescendantChange)try{s.onActiveDescendantChange(i,n);}catch(c){console.error("[aria-ease] Error in combobox onActiveDescendantChange callback:",c);}}else o.setAttribute("aria-activedescendant","");r=e;}function
|
|
1
|
+
'use strict';function $({comboboxInputId:h,comboboxButtonId:x,listBoxId:b,listBoxItemsClass:u,callback:s}){if(h==="")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(`${h}`);if(!o)return console.error(`[aria-ease] Element with id="${h}" not found. Make sure the combobox input element exists before calling makeComboboxAccessible.`),{cleanup:()=>{}};if(b==="")return console.error("[aria-ease] 'listBoxId' should not be an empty string. Provide an id to the combobox listbox element that exists before calling makeComboboxAccessible."),{cleanup:()=>{}};let a=document.getElementById(`${b}`);if(!a)return console.error(`[aria-ease] Element with id="${b}" not found. Make sure the combobox listbox element exists before calling makeComboboxAccessible.`),{cleanup:()=>{}};if(u==="")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(u))return console.error(`[aria-ease] Listbox option(s) with class="${u}" not found. Make sure at least a combobox listbox option exists before calling makeComboboxAccessible.`),{cleanup:()=>{}};let l=x?document.getElementById(`${x}`):null,r=-1;o.setAttribute("role","combobox"),o.setAttribute("aria-autocomplete","list"),o.setAttribute("aria-controls",b),o.setAttribute("aria-expanded","false"),o.setAttribute("aria-haspopup","listbox"),a.setAttribute("role","listbox");let m=null;function p(){return m||(m=a.querySelectorAll(`.${u}`)),Array.from(m).filter(e=>!e.hidden&&e.style.display!=="none")}function A(){return o.getAttribute("aria-expanded")==="true"}function d(e){let t=p();if(e>=0&&e<t.length){let n=t[e],i=n.id||`${b}-option-${e}`;if(n.id||(n.id=i),o.setAttribute("aria-activedescendant",i),typeof n.scrollIntoView=="function"&&n.scrollIntoView({block:"nearest",behavior:"smooth"}),s?.onActiveDescendantChange)try{s.onActiveDescendantChange(i,n);}catch(c){console.error("[aria-ease] Error in combobox onActiveDescendantChange callback:",c);}}else o.setAttribute("aria-activedescendant","");r=e;}function E(){if(o.setAttribute("aria-expanded","true"),a.style.display="block",s?.onExpandedChange)try{s.onExpandedChange(!0);}catch(e){console.error("[aria-ease] Error in combobox onExpandedChange callback:",e);}}function f(){if(o.setAttribute("aria-expanded","false"),o.setAttribute("aria-activedescendant",""),a.style.display="none",r=-1,s?.onExpandedChange)try{s.onExpandedChange(!1);}catch(e){console.error("[aria-ease] Error in combobox onExpandedChange callback:",e);}}function v(e){if(e.setAttribute("aria-selected","true"),f(),s?.onSelect)try{s.onSelect(e);}catch(t){console.error("[aria-ease] Error in combobox onSelect callback:",t);}}function L(e){let t=p(),n=A();switch(e.key){case "ArrowDown":if(e.preventDefault(),!n){E();return}if(t.length===0)return;{let i=r>=t.length-1?0:r+1;d(i);}break;case "ArrowUp":if(e.preventDefault(),!n)return;if(t.length>0){let i=r<=0?t.length-1:r-1;d(i);}break;case "Enter":n&&r>=0&&r<t.length&&(e.preventDefault(),v(t[r]));break;case "Escape":if(n)e.preventDefault(),f();else if(o.value&&(e.preventDefault(),o.value="",o.setAttribute("aria-activedescendant",""),p().forEach(c=>{c.getAttribute("aria-selected")==="true"&&c.setAttribute("aria-selected","false");}),s?.onClear))try{s.onClear();}catch(c){console.error("[aria-ease] Error in combobox onClear callback:",c);}break;case "Home":n&&t.length>0&&(e.preventDefault(),d(0));break;case "End":n&&t.length>0&&(e.preventDefault(),d(t.length-1));break;case "Tab":n&&r>=0&&r<t.length&&v(t[r]),n&&f();break}}function y(e){let t=e.target;if(t.classList.contains(u)){let i=p().indexOf(t);i>=0&&d(i);}}function k(e){let t=e.target;t.classList.contains(u)&&(e.preventDefault(),v(t));}function w(e){let t=e.target;!o.contains(t)&&!a.contains(t)&&(!l||!l.contains(t))&&f();}function g(){A()?f():(E(),o.focus());}function C(e){(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),g());}o.addEventListener("keydown",L),a.addEventListener("mousemove",y),a.addEventListener("mousedown",k),document.addEventListener("mousedown",w),l&&(l.setAttribute("tabindex","-1"),l.setAttribute("aria-label","Toggle options"),l.addEventListener("click",g),l.addEventListener("keydown",C));function M(){let e=a.querySelectorAll(`.${u}`);if(e.length===0)return;let t=null;for(let n of e)if(n.getAttribute("aria-selected")==="true"){t=n.textContent?.trim()||null;break}!t&&o.value&&(t=o.value.trim()),e.forEach((n,i)=>{n.setAttribute("role","option");let c=n.textContent?.trim()||"";t&&c===t?n.setAttribute("aria-selected","true"):n.setAttribute("aria-selected","false");let D=n.getAttribute("id");if(!D||D===""){let T=`${b}-option-${i}`;n.id=T,n.setAttribute("id",T);}});}M();function H(){o.removeEventListener("keydown",L),a.removeEventListener("mousemove",y),a.removeEventListener("mousedown",k),document.removeEventListener("mousedown",w),l&&(l.removeEventListener("click",g),l.removeEventListener("keydown",C));}function I(){m=null,M(),r=-1,d(-1);}return {cleanup:H,refresh:I,openListBox:E,closeListBox:f}}exports.makeComboboxAccessible=$;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as ComboboxConfig, a as AccessibilityInstance } from '../Types.d-
|
|
1
|
+
import { b as ComboboxConfig, a as AccessibilityInstance } from '../Types.d-DO31Kt2y.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Makes a Combobox accessible by adding appropriate ARIA attributes, keyboard interactions and focus management.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as ComboboxConfig, a as AccessibilityInstance } from '../Types.d-
|
|
1
|
+
import { b as ComboboxConfig, a as AccessibilityInstance } from '../Types.d-DO31Kt2y.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Makes a Combobox accessible by adding appropriate ARIA attributes, keyboard interactions and focus management.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function $({comboboxInputId:h,comboboxButtonId:x,listBoxId:b,listBoxItemsClass:u,callback:s}){if(h==="")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(`${h}`);if(!o)return console.error(`[aria-ease] Element with id="${h}" not found. Make sure the combobox input element exists before calling makeComboboxAccessible.`),{cleanup:()=>{}};if(b==="")return console.error("[aria-ease] 'listBoxId' should not be an empty string. Provide an id to the combobox listbox element that exists before calling makeComboboxAccessible."),{cleanup:()=>{}};let a=document.getElementById(`${b}`);if(!a)return console.error(`[aria-ease] Element with id="${b}" not found. Make sure the combobox listbox element exists before calling makeComboboxAccessible.`),{cleanup:()=>{}};if(u==="")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(u))return console.error(`[aria-ease] Listbox option(s) with class="${u}" not found. Make sure at least a combobox listbox option exists before calling makeComboboxAccessible.`),{cleanup:()=>{}};let l=x?document.getElementById(`${x}`):null,r=-1;o.setAttribute("role","combobox"),o.setAttribute("aria-autocomplete","list"),o.setAttribute("aria-controls",b),o.setAttribute("aria-expanded","false"),o.setAttribute("aria-haspopup","listbox"),a.setAttribute("role","listbox");let m=null;function p(){return m||(m=a.querySelectorAll(`.${u}`)),Array.from(m).filter(e=>!e.hidden&&e.style.display!=="none")}function A(){return o.getAttribute("aria-expanded")==="true"}function d(e){let t=p();if(e>=0&&e<t.length){let n=t[e],i=n.id||`${b}-option-${e}`;if(n.id||(n.id=i),o.setAttribute("aria-activedescendant",i),typeof n.scrollIntoView=="function"&&n.scrollIntoView({block:"nearest",behavior:"smooth"}),s?.onActiveDescendantChange)try{s.onActiveDescendantChange(i,n);}catch(c){console.error("[aria-ease] Error in combobox onActiveDescendantChange callback:",c);}}else o.setAttribute("aria-activedescendant","");r=e;}function
|
|
1
|
+
function $({comboboxInputId:h,comboboxButtonId:x,listBoxId:b,listBoxItemsClass:u,callback:s}){if(h==="")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(`${h}`);if(!o)return console.error(`[aria-ease] Element with id="${h}" not found. Make sure the combobox input element exists before calling makeComboboxAccessible.`),{cleanup:()=>{}};if(b==="")return console.error("[aria-ease] 'listBoxId' should not be an empty string. Provide an id to the combobox listbox element that exists before calling makeComboboxAccessible."),{cleanup:()=>{}};let a=document.getElementById(`${b}`);if(!a)return console.error(`[aria-ease] Element with id="${b}" not found. Make sure the combobox listbox element exists before calling makeComboboxAccessible.`),{cleanup:()=>{}};if(u==="")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(u))return console.error(`[aria-ease] Listbox option(s) with class="${u}" not found. Make sure at least a combobox listbox option exists before calling makeComboboxAccessible.`),{cleanup:()=>{}};let l=x?document.getElementById(`${x}`):null,r=-1;o.setAttribute("role","combobox"),o.setAttribute("aria-autocomplete","list"),o.setAttribute("aria-controls",b),o.setAttribute("aria-expanded","false"),o.setAttribute("aria-haspopup","listbox"),a.setAttribute("role","listbox");let m=null;function p(){return m||(m=a.querySelectorAll(`.${u}`)),Array.from(m).filter(e=>!e.hidden&&e.style.display!=="none")}function A(){return o.getAttribute("aria-expanded")==="true"}function d(e){let t=p();if(e>=0&&e<t.length){let n=t[e],i=n.id||`${b}-option-${e}`;if(n.id||(n.id=i),o.setAttribute("aria-activedescendant",i),typeof n.scrollIntoView=="function"&&n.scrollIntoView({block:"nearest",behavior:"smooth"}),s?.onActiveDescendantChange)try{s.onActiveDescendantChange(i,n);}catch(c){console.error("[aria-ease] Error in combobox onActiveDescendantChange callback:",c);}}else o.setAttribute("aria-activedescendant","");r=e;}function E(){if(o.setAttribute("aria-expanded","true"),a.style.display="block",s?.onExpandedChange)try{s.onExpandedChange(!0);}catch(e){console.error("[aria-ease] Error in combobox onExpandedChange callback:",e);}}function f(){if(o.setAttribute("aria-expanded","false"),o.setAttribute("aria-activedescendant",""),a.style.display="none",r=-1,s?.onExpandedChange)try{s.onExpandedChange(!1);}catch(e){console.error("[aria-ease] Error in combobox onExpandedChange callback:",e);}}function v(e){if(e.setAttribute("aria-selected","true"),f(),s?.onSelect)try{s.onSelect(e);}catch(t){console.error("[aria-ease] Error in combobox onSelect callback:",t);}}function L(e){let t=p(),n=A();switch(e.key){case "ArrowDown":if(e.preventDefault(),!n){E();return}if(t.length===0)return;{let i=r>=t.length-1?0:r+1;d(i);}break;case "ArrowUp":if(e.preventDefault(),!n)return;if(t.length>0){let i=r<=0?t.length-1:r-1;d(i);}break;case "Enter":n&&r>=0&&r<t.length&&(e.preventDefault(),v(t[r]));break;case "Escape":if(n)e.preventDefault(),f();else if(o.value&&(e.preventDefault(),o.value="",o.setAttribute("aria-activedescendant",""),p().forEach(c=>{c.getAttribute("aria-selected")==="true"&&c.setAttribute("aria-selected","false");}),s?.onClear))try{s.onClear();}catch(c){console.error("[aria-ease] Error in combobox onClear callback:",c);}break;case "Home":n&&t.length>0&&(e.preventDefault(),d(0));break;case "End":n&&t.length>0&&(e.preventDefault(),d(t.length-1));break;case "Tab":n&&r>=0&&r<t.length&&v(t[r]),n&&f();break}}function y(e){let t=e.target;if(t.classList.contains(u)){let i=p().indexOf(t);i>=0&&d(i);}}function k(e){let t=e.target;t.classList.contains(u)&&(e.preventDefault(),v(t));}function w(e){let t=e.target;!o.contains(t)&&!a.contains(t)&&(!l||!l.contains(t))&&f();}function g(){A()?f():(E(),o.focus());}function C(e){(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),g());}o.addEventListener("keydown",L),a.addEventListener("mousemove",y),a.addEventListener("mousedown",k),document.addEventListener("mousedown",w),l&&(l.setAttribute("tabindex","-1"),l.setAttribute("aria-label","Toggle options"),l.addEventListener("click",g),l.addEventListener("keydown",C));function M(){let e=a.querySelectorAll(`.${u}`);if(e.length===0)return;let t=null;for(let n of e)if(n.getAttribute("aria-selected")==="true"){t=n.textContent?.trim()||null;break}!t&&o.value&&(t=o.value.trim()),e.forEach((n,i)=>{n.setAttribute("role","option");let c=n.textContent?.trim()||"";t&&c===t?n.setAttribute("aria-selected","true"):n.setAttribute("aria-selected","false");let D=n.getAttribute("id");if(!D||D===""){let T=`${b}-option-${i}`;n.id=T,n.setAttribute("id",T);}});}M();function H(){o.removeEventListener("keydown",L),a.removeEventListener("mousemove",y),a.removeEventListener("mousedown",k),document.removeEventListener("mousedown",w),l&&(l.removeEventListener("click",g),l.removeEventListener("keydown",C));}function I(){m=null,M(),r=-1,d(-1);}return {cleanup:H,refresh:I,openListBox:E,closeListBox:f}}export{$ as makeComboboxAccessible};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { M as MenuConfig, a as AccessibilityInstance } from '../Types.d-
|
|
1
|
+
import { M as MenuConfig, a as AccessibilityInstance } from '../Types.d-DO31Kt2y.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Adds keyboard interaction to toggle menu. The menu traps focus and can be interacted with using the keyboard. The first interactive item of the menu has focus when menu open.
|
package/dist/src/menu/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { M as MenuConfig, a as AccessibilityInstance } from '../Types.d-
|
|
1
|
+
import { M as MenuConfig, a as AccessibilityInstance } from '../Types.d-DO31Kt2y.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Adds keyboard interaction to toggle menu. The menu traps focus and can be interacted with using the keyboard. The first interactive item of the menu has focus when menu open.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as RadioConfig, a as AccessibilityInstance } from '../Types.d-
|
|
1
|
+
import { R as RadioConfig, a as AccessibilityInstance } from '../Types.d-DO31Kt2y.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Makes a radio group accessible by managing ARIA attributes, keyboard interaction, and state.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as RadioConfig, a as AccessibilityInstance } from '../Types.d-
|
|
1
|
+
import { R as RadioConfig, a as AccessibilityInstance } from '../Types.d-DO31Kt2y.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Makes a radio group accessible by managing ARIA attributes, keyboard interaction, and state.
|
package/dist/src/tabs/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as ToggleConfig, a as AccessibilityInstance } from '../Types.d-
|
|
1
|
+
import { c as ToggleConfig, a as AccessibilityInstance } from '../Types.d-DO31Kt2y.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Makes a toggle button accessible by managing ARIA attributes and keyboard interactions.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as ToggleConfig, a as AccessibilityInstance } from '../Types.d-
|
|
1
|
+
import { c as ToggleConfig, a as AccessibilityInstance } from '../Types.d-DO31Kt2y.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Makes a toggle button accessible by managing ARIA attributes and keyboard interactions.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {expect}from'@playwright/test';var a=class{constructor(t,e,o,i){this.mainSelector=t;this.selectors=e;this.actionTimeoutMs=o;this.assertionTimeoutMs=i;}async resetState(t){if(!this.selectors.panel||!this.selectors.trigger)return;let e=this.selectors.trigger,o=this.selectors.panel;if(!e||!o)return;let i=await t.locator(e).all();for(let r of i){let n=await r.getAttribute("aria-expanded")==="true",s=await r.getAttribute("aria-controls");if(n&&s){await r.click({timeout:this.actionTimeoutMs});let c=t.locator(`#${s}`);await expect(c).toBeHidden({timeout:this.assertionTimeoutMs}).catch(()=>{});}}}async shouldSkipTest(){return false}getMainSelector(){return this.mainSelector}};export{a as AccordionComponentStrategy};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {expect}from'@playwright/test';var s=class{constructor(e,o,r,t){this.mainSelector=e;this.selectors=o;this.actionTimeoutMs=r;this.assertionTimeoutMs=t;}async resetState(e){if(!this.selectors.checkbox||!this.selectors.relative)return;let o=this.selectors.checkbox;if(!o)return;let r=await e.locator(o).all();for(let t of r)if(await t.getAttribute("aria-checked")==="true"){await t.click({timeout:this.actionTimeoutMs});let i=e.locator(`#${t}`);await expect(i).toHaveAttribute("aria-checked","false",{timeout:this.assertionTimeoutMs}).catch(()=>{});}}async shouldSkipTest(){return false}getMainSelector(){return this.mainSelector}};export{s as CheckboxComponentStrategy};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import {expect}from'@playwright/test';var r=class{constructor(t,i,o,c){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,o){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
|
+
import {expect}from'@playwright/test';var i=class{constructor(e,o,r,t){this.mainSelector=e;this.selectors=o;this.actionTimeoutMs=r;this.assertionTimeoutMs=t;}async resetState(e){if(!this.selectors.radio||!this.selectors.relative)return;let o=this.selectors.radio;if(!o)return;let r=await e.locator(o).all();for(let t of r)if(await t.getAttribute("aria-checked")==="true"){await t.evaluate(s=>s.setAttribute("aria-checked","false"),{timeout:this.actionTimeoutMs});let a=e.locator(`#${t}`);await expect(a).toHaveAttribute("aria-checked","false",{timeout:this.assertionTimeoutMs}).catch(()=>{});}}async shouldSkipTest(){return false}getMainSelector(){return this.mainSelector}};export{i as RadioComponentStrategy};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {expect}from'@playwright/test';var s=class{constructor(e,o,r,t){this.mainSelector=e;this.selectors=o;this.actionTimeoutMs=r;this.assertionTimeoutMs=t;}async resetState(e){if(!this.selectors.toggle||!this.selectors.relative)return;let o=this.selectors.toggle;if(!o)return;let r=await e.locator(o).all();for(let t of r)if(await t.getAttribute("aria-pressed")==="true"){await t.click({timeout:this.actionTimeoutMs});let i=e.locator(`#${t}`);await expect(i).toHaveAttribute("aria-pressed","false",{timeout:this.assertionTimeoutMs}).catch(()=>{});}}async shouldSkipTest(){return false}getMainSelector(){return this.mainSelector}};export{s as ToggleComponentStrategy};
|