@ctrl/dom 0.3.13 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/dist/aria/_chunks/aria-query.generated-B6BAyxT7.js +4 -0
  2. package/dist/aria/_chunks/aria-query.generated-DK1XMP7F.cjs +4 -0
  3. package/dist/aria/index.cjs +1 -1
  4. package/dist/aria/index.js +1 -1
  5. package/dist/aria/internal.cjs +1 -1
  6. package/dist/aria/internal.js +1 -1
  7. package/dist/aria/types/data/aria-query.generated.d.ts +1 -1
  8. package/dist/bridge/internal.js +1 -1
  9. package/dist/dom/_chunks/src-BISULkzm.js +50 -0
  10. package/dist/dom/index.js +1 -1
  11. package/dist/dom/internal.js +1 -1
  12. package/dist/dom/types/collections/iterator.d.ts +9 -0
  13. package/dist/dom/types/css/data/properties.d.ts +1 -1
  14. package/dist/dom/types/css/tokenizer.d.ts +8 -1
  15. package/dist/dom/types/css/values.d.ts +2 -2
  16. package/dist/dom/types/css/view.d.ts +0 -8
  17. package/dist/dom/types/events/Event.d.ts +13 -1
  18. package/dist/dom/types/events/handlers.d.ts +2 -0
  19. package/dist/dom/types/html/HTMLElement.d.ts +7 -5
  20. package/dist/dom/types/html/aria-reflection.d.ts +5 -0
  21. package/dist/dom/types/html/custom-elements.d.ts +0 -1
  22. package/dist/dom/types/html/elements.d.ts +0 -4
  23. package/dist/dom/types/html/forms/HTMLButtonElement.d.ts +2 -9
  24. package/dist/dom/types/html/forms/HTMLFieldSetElement.d.ts +0 -4
  25. package/dist/dom/types/html/forms/HTMLInputElement.d.ts +11 -30
  26. package/dist/dom/types/html/forms/HTMLOutputElement.d.ts +4 -13
  27. package/dist/dom/types/html/forms/HTMLSelectElement.d.ts +2 -3
  28. package/dist/dom/types/html/forms/HTMLTextAreaElement.d.ts +11 -11
  29. package/dist/dom/types/html/forms/collections.d.ts +5 -0
  30. package/dist/dom/types/html/forms/common.d.ts +7 -0
  31. package/dist/dom/types/html/forms/selection.d.ts +43 -0
  32. package/dist/dom/types/html/forms/validation.d.ts +7 -2
  33. package/dist/dom/types/html/shared.d.ts +4 -0
  34. package/dist/dom/types/html/svg-types.d.ts +1 -1
  35. package/dist/dom/types/internal.d.ts +2 -1
  36. package/dist/dom/types/nodes/Document.d.ts +1 -1
  37. package/dist/dom/types/nodes/Element.d.ts +16 -20
  38. package/dist/dom/types/nodes/Node.d.ts +1 -1
  39. package/dist/dom/types/nodes/attributes.d.ts +2 -0
  40. package/dist/dom/types/nodes/tree.d.ts +1 -1
  41. package/dist/dom/types/parser/entities-data.d.ts +3 -3
  42. package/dist/dom/types/parser/tokenizer.d.ts +1 -0
  43. package/dist/dom/types/parser/treebuilder.d.ts +7 -2
  44. package/dist/dom/types/selectors/parser.d.ts +0 -63
  45. package/dist/dom/types/serializer/index.d.ts +4 -1
  46. package/dist/dom/types/traversal/Range.d.ts +3 -0
  47. package/dist/dom/types/window/Window.d.ts +2 -2
  48. package/dist/dom/types/window/clock.d.ts +6 -2
  49. package/dist/dom/types/window/fallbacks.d.ts +0 -8
  50. package/dist/dom/types/window/hooks.d.ts +1 -2
  51. package/dist/dom/types/window/interfaces.d.ts +0 -2
  52. package/dist/dom/types/window/media.d.ts +1 -6
  53. package/dist/dom/types/window/xhr.d.ts +4 -0
  54. package/dist/jest-dom/_chunks/{matchers-DGsBvtWC.js → matchers-D7d49HIF.js} +7 -7
  55. package/dist/jest-dom/_chunks/{matchers-DJmRgUYG.cjs → matchers-lhGtjS66.cjs} +7 -7
  56. package/dist/jest-dom/index.cjs +1 -1
  57. package/dist/jest-dom/index.js +1 -1
  58. package/dist/jest-dom/jest-globals.cjs +1 -1
  59. package/dist/jest-dom/jest-globals.js +1 -1
  60. package/dist/jest-dom/matchers.cjs +1 -1
  61. package/dist/jest-dom/matchers.js +1 -1
  62. package/dist/jest-dom/vitest.cjs +1 -1
  63. package/dist/jest-dom/vitest.js +1 -1
  64. package/dist/testing-library/_chunks/{aria-snapshot-diff-DbtSqGLH.cjs → aria-snapshot-diff-DKpjI9CA.cjs} +3 -3
  65. package/dist/testing-library/_chunks/aria-snapshot-diff-DdhypD1z.js +16 -0
  66. package/dist/testing-library/agent.cjs +2 -2
  67. package/dist/testing-library/agent.js +7 -7
  68. package/dist/testing-library/index.cjs +4 -4
  69. package/dist/testing-library/index.js +8 -8
  70. package/dist/user-event/index.cjs +15 -15
  71. package/dist/user-event/index.js +16 -16
  72. package/dist/user-event/types/clipboard/copy.d.ts +6 -0
  73. package/dist/user-event/types/ctrl-dom.d.ts +17 -16
  74. package/dist/user-event/types/event/eventMap.d.ts +99 -99
  75. package/dist/user-event/types/setup/dtl.d.ts +0 -6
  76. package/dist/user-event/types/system/index.d.ts +1 -0
  77. package/package.json +1 -1
  78. package/dist/aria/_chunks/aria-query.generated-BNKXKFqd.cjs +0 -4
  79. package/dist/aria/_chunks/aria-query.generated-CU4-Yw6V.js +0 -4
  80. package/dist/dom/_chunks/src-Dgmm77XJ.js +0 -50
  81. package/dist/testing-library/_chunks/aria-snapshot-diff-VoXekyfV.js +0 -16
@@ -1,6 +1,6 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./_chunks/aria-snapshot-diff-DbtSqGLH.cjs");let t=require("@ctrl/dom/internal"),n=require("@ctrl/dom/aria");var AriaTemplateError=class extends Error{constructor(e,t,n,r=-1){super(`${e} (template line ${t+1}):\n\n${n}${r>=0?`\n${` `.repeat(r)}^`:``}`),this.name=`AriaTemplateError`}};function normalizeWhitespace(e){return e.replace(/[​­]/g,``).replace(/[\r\n\s\t]+/g,` `).trim()}function textValue(e){let t=null;if(e.length>1&&e.startsWith(`/`)&&e.endsWith(`/`))try{t=new RegExp(e.slice(1,-1))}catch{t=null}return{raw:e,normalized:normalizeWhitespace(e),regex:t}}const r=/* @__PURE__ */ new Set([`disabled`,`expanded`,`active`,`selected`,`busy`,`hidden`]);function parseAriaTemplate(e){let t=e.split(/\r?\n/),n=1/0;for(let e=0;e<t.length;e++){let r=t[e],i=r.trim();if(i===``||i.startsWith(`#`))continue;let a=r.length-r.trimStart().length;if(r.slice(0,a).includes(` `))throw new AriaTemplateError(`Tabs cannot be used for indentation`,e,r);a<n&&(n=a)}let r={kind:`role`,role:`fragment`,name:null,attrs:[],url:null,mode:null,children:[]};if(n===1/0)throw new AriaTemplateError(`The aria snapshot template is empty`,0,e);let i=[{indent:-1,node:r,line:-1}];for(let e=0;e<t.length;e++){let r=t[e],a=r.trim();if(a===``||a.startsWith(`#`))continue;let o=r.length-r.trimStart().length-n;if(a!==`-`&&!a.startsWith(`- `))throw new AriaTemplateError(`Aria snapshot must be a YAML sequence, elements starting with "-"`,e,r,o+n);for(;i[i.length-1].indent>=o;)i.pop();let s=i[i.length-1];if(s.node===null)throw new AriaTemplateError(`"- text:" on line ${s.line+1} cannot have children`,e,r,o+n);let c=a.slice(2).trimStart(),l=r.length-c.length,u=parseItem(c,s.node,e,r,l);u!==void 0&&i.push({indent:o,node:u,line:e})}return r.children.length===1&&(r.mode===null||r.mode===`contain`)&&r.url===null?r.children[0]:r}function parseItem(e,t,n,r,i){let fail=(e,t)=>{throw new AriaTemplateError(e,n,r,i+t)};if(e===``&&fail(`Empty sequence item`,0),e.startsWith(`/`)){let n=e.indexOf(`:`);n<0&&fail("Property should be written `/name: value`",e.length);let r=e.slice(1,n).trim(),i=parseScalar(e.slice(n+1),fail,n+1);r===`children`?(i!==`contain`&&i!==`equal`&&i!==`deep-equal`&&fail(`Value of "/children" should be "contain", "equal" or "deep-equal"`,n+1),t.mode=i):r===`url`&&(t.url=textValue(i));return}let a,o=null;try{if(e[0]===`"`||e[0]===`'`){let[n,r]=readQuoted(e,0,fail),i=e.slice(r).trimStart();if(i!==``&&i[0]!==`:`&&fail(`Unexpected input after the quoted key`,r),i!==``&&(o=i.slice(1)),n===`text`&&o!==null)return textItem(t,o,fail,e.length-o.length);a=new KeyParser(n).parse(!1)}else{if(/^text:(\s|$)/.test(e))return textItem(t,e.slice(5),fail,5);let n=new KeyParser(e);a=n.parse(!0),n.pos<e.length&&(o=e.slice(n.pos+1))}}catch(t){throw t instanceof KeyError&&fail(t.message,e[0]===`"`||e[0]===`'`?0:t.pos),t}return o!==null&&o.trim()!==``&&a.children.push({kind:`text`,text:textValue(parseScalar(o,fail,e.length-o.length))}),t.children.push(a),a}function textItem(e,t,n,r){return e.children.push({kind:`text`,text:textValue(parseScalar(t,n,r))}),null}function parseScalar(e,t,n){let r=e.length-e.trimStart().length,i=e.trim();if(i[0]===`"`||i[0]===`'`){let[e,a]=readQuoted(i,0,(e,i)=>t(e,n+r+i)),o=i.slice(a).trim();return o!==``&&!o.startsWith(`#`)&&t(`Unexpected input after the quoted value`,n+r+a),e}(i===`|`||i===`>`||i.startsWith(`|`)||i.startsWith(`>`))&&t(`Block scalars are not supported in aria snapshot templates`,n+r);let a=i.search(/\s#/);return a>=0?i.slice(0,a).trim():i}function readQuoted(e,t,n){let r=e[t],i=``;for(let n=t+1;n<e.length;n++){let t=e[n];if(r===`'`){if(t===`'`){if(e[n+1]===`'`){i+=`'`,n++;continue}return[i,n+1]}i+=t}else{if(t===`"`)return[i,n+1];if(t===`\\`){let t=e[++n];t===`n`?i+=`
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./_chunks/aria-snapshot-diff-DKpjI9CA.cjs");let t=require("@ctrl/dom/internal"),n=require("@ctrl/dom/aria");var AriaTemplateError=class extends Error{constructor(e,t,n,r=-1){super(`${e} (template line ${t+1}):\n\n${n}${r>=0?`\n${` `.repeat(r)}^`:``}`),this.name=`AriaTemplateError`}};function normalizeWhitespace(e){return e.replace(/[​­]/g,``).replace(/[\r\n\s\t]+/g,` `).trim()}function textValue(e){let t=null;if(e.length>1&&e.startsWith(`/`)&&e.endsWith(`/`))try{t=new RegExp(e.slice(1,-1))}catch{t=null}return{raw:e,normalized:normalizeWhitespace(e),regex:t}}const r=/* @__PURE__ */ new Set([`disabled`,`expanded`,`active`,`selected`,`busy`,`hidden`]);function parseAriaTemplate(e){let t=e.split(/\r?\n/),n=1/0;for(let e=0;e<t.length;e++){let r=t[e],i=r.trim();if(i===``||i.startsWith(`#`))continue;let a=r.length-r.trimStart().length;if(r.slice(0,a).includes(` `))throw new AriaTemplateError(`Tabs cannot be used for indentation`,e,r);a<n&&(n=a)}let r={kind:`role`,role:`fragment`,name:null,attrs:[],url:null,mode:null,children:[]};if(n===1/0)throw new AriaTemplateError(`The aria snapshot template is empty`,0,e);let i=[{indent:-1,node:r,line:-1}];for(let e=0;e<t.length;e++){let r=t[e],a=r.trim();if(a===``||a.startsWith(`#`))continue;let o=r.length-r.trimStart().length-n;if(a!==`-`&&!a.startsWith(`- `))throw new AriaTemplateError(`Aria snapshot must be a YAML sequence, elements starting with "-"`,e,r,o+n);for(;i[i.length-1].indent>=o;)i.pop();let s=i[i.length-1];if(s.node===null)throw new AriaTemplateError(`"- text:" on line ${s.line+1} cannot have children`,e,r,o+n);let c=a.slice(2).trimStart(),l=r.length-c.length,u=parseItem(c,s.node,e,r,l);u!==void 0&&i.push({indent:o,node:u,line:e})}return r.children.length===1&&(r.mode===null||r.mode===`contain`)&&r.url===null?r.children[0]:r}function parseItem(e,t,n,r,i){let fail=(e,t)=>{throw new AriaTemplateError(e,n,r,i+t)};if(e===``&&fail(`Empty sequence item`,0),e.startsWith(`/`)){let n=e.indexOf(`:`);n<0&&fail("Property should be written `/name: value`",e.length);let r=e.slice(1,n).trim(),i=parseScalar(e.slice(n+1),fail,n+1);r===`children`?(i!==`contain`&&i!==`equal`&&i!==`deep-equal`&&fail(`Value of "/children" should be "contain", "equal" or "deep-equal"`,n+1),t.mode=i):r===`url`&&(t.url=textValue(i));return}let a,o=null;try{if(e[0]===`"`||e[0]===`'`){let[n,r]=readQuoted(e,0,fail),i=e.slice(r).trimStart();if(i!==``&&i[0]!==`:`&&fail(`Unexpected input after the quoted key`,r),i!==``&&(o=i.slice(1)),n===`text`&&o!==null)return textItem(t,o,fail,e.length-o.length);a=new KeyParser(n).parse(!1)}else{if(/^text:(\s|$)/.test(e))return textItem(t,e.slice(5),fail,5);let n=new KeyParser(e);a=n.parse(!0),n.pos<e.length&&(o=e.slice(n.pos+1))}}catch(t){throw t instanceof KeyError&&fail(t.message,e[0]===`"`||e[0]===`'`?0:t.pos),t}return o!==null&&o.trim()!==``&&a.children.push({kind:`text`,text:textValue(parseScalar(o,fail,e.length-o.length))}),t.children.push(a),a}function textItem(e,t,n,r){return e.children.push({kind:`text`,text:textValue(parseScalar(t,n,r))}),null}function parseScalar(e,t,n){let r=e.length-e.trimStart().length,i=e.trim();if(i[0]===`"`||i[0]===`'`){let[e,a]=readQuoted(i,0,(e,i)=>t(e,n+r+i)),o=i.slice(a).trim();return o!==``&&!o.startsWith(`#`)&&t(`Unexpected input after the quoted value`,n+r+a),e}(i===`|`||i===`>`||i.startsWith(`|`)||i.startsWith(`>`))&&t(`Block scalars are not supported in aria snapshot templates`,n+r);let a=i.search(/\s#/);return a>=0?i.slice(0,a).trim():i}function readQuoted(e,t,n){let r=e[t],i=``;for(let n=t+1;n<e.length;n++){let t=e[n];if(r===`'`){if(t===`'`){if(e[n+1]===`'`){i+=`'`,n++;continue}return[i,n+1]}i+=t}else{if(t===`"`)return[i,n+1];if(t===`\\`){let t=e[++n];t===`n`?i+=`
2
2
  `:t===`t`?i+=` `:t===`u`?(i+=String.fromCharCode(parseInt(e.slice(n+1,n+5),16)),n+=4):i+=t??``}else i+=t}}return n(`Unterminated string`,e.length)}var KeyError=class extends Error{pos;constructor(e,t){super(e),this.pos=t}},KeyParser=class{pos=0;input;constructor(e){this.input=e}peek(){return this.input[this.pos]??``}eof(){return this.pos>=this.input.length}skipWhitespace(){for(;!this.eof()&&/\s/.test(this.peek());)this.pos++}atColon(){return this.peek()===`:`&&(this.pos+1>=this.input.length||/\s/.test(this.input[this.pos+1]))}readIdentifier(e){if(this.eof())throw new KeyError(`Unexpected end of input when expecting ${e}`,this.pos);let t=this.pos;for(;!this.eof()&&/[a-zA-Z]/.test(this.peek());)this.pos++;if(this.pos===t)throw new KeyError(`Expected ${e}`,this.pos);return this.input.slice(t,this.pos)}readString(){let e=``;for(;!this.eof();){let t=this.input[this.pos++];if(t===`\\`){let t=this.input[this.pos++]??``;t===`n`?e+=`
3
- `:t===`t`?e+=` `:t===`u`?(e+=String.fromCharCode(parseInt(this.input.slice(this.pos,this.pos+4),16)),this.pos+=4):e+=t}else if(t===`"`)return e;else e+=t}throw new KeyError(`Unterminated string`,this.pos)}readRegex(){let e=this.pos,t=``,n=!1,r=!1;for(;!this.eof();){let i=this.input[this.pos++];if(n)t+=i,n=!1;else if(i===`\\`)n=!0,t+=i;else if(i===`/`&&!r)try{return new RegExp(t)}catch(t){throw new KeyError(`Invalid regular expression: ${t.message}`,e)}else i===`[`?(r=!0,t+=i):i===`]`&&r?(t+=i,r=!1):t+=i}throw new KeyError(`Unterminated regex`,this.pos)}parse(e){this.skipWhitespace();let t=this.readIdentifier(`role`);this.skipWhitespace();let n=null;this.peek()===`"`?(this.pos++,n=normalizeWhitespace(this.readString())):this.peek()===`/`&&(this.pos++,n=this.readRegex());let r={kind:`role`,role:t,name:n===``?null:n,attrs:[],url:null,mode:null,children:[]};for(;this.skipWhitespace(),this.peek()===`[`;){this.pos++,this.skipWhitespace();let e=this.pos,t=this.readIdentifier(`attribute`);this.skipWhitespace();let n=``;if(this.peek()===`=`)for(this.pos++,this.skipWhitespace();this.peek()!==`]`&&!/\s/.test(this.peek())&&!this.eof();)n+=this.input[this.pos++];if(this.skipWhitespace(),this.peek()!==`]`)throw new KeyError(`Expected ]`,this.pos);this.pos++,r.attrs.push([t,checkAttribute(t,n||`true`,e)])}if(this.skipWhitespace(),e&&this.atColon())return r;if(!this.eof())throw new KeyError(e?`Unexpected input (a key ends with ":" and a space)`:`Unexpected input`,this.pos);return r}};function checkAttribute(e,t,n){if(e===`checked`||e===`pressed`){if(t!==`true`&&t!==`false`&&t!==`mixed`)throw new KeyError(`Value of "${e}" attribute must be a boolean or "mixed"`,n);return t}if(r.has(e)){if(t!==`true`&&t!==`false`)throw new KeyError(`Value of "${e}" attribute must be a boolean`,n);return t}if(e===`level`){if(Number.isNaN(Number(t)))throw new KeyError(`Value of "level" attribute must be a number`,n);return String(Number(t))}if(e===`current`)return t;throw new KeyError(`Unsupported attribute [${e}]`,n)}function toMatchNode(e){let t=[];e.value!==null&&e.value!==``&&t.push(normalizeWhitespace(e.value));for(let n=0;n<e.children.length;n++){let r=e.children[n];t.push(typeof r==`string`?normalizeWhitespace(r):toMatchNode(r))}let n=/* @__PURE__ */ new Map;for(let t=0;t<e.props.length;t++){let r=e.props[t].slice(1,-1),i=r.indexOf(`=`);i<0?n.set(r,`true`):n.set(r.slice(0,i),r.slice(i+1))}return{role:e.role,name:normalizeWhitespace(e.name),states:n,url:e.url,children:t,props:e.props}}function stateOf(e,t){let r=e.states.get(t);if(r!==void 0)return r;switch(t){case`checked`:return(0,n.roleSupportsProp)(e.role,`aria-checked`)?`false`:void 0;case`disabled`:case`selected`:case`active`:case`busy`:case`hidden`:case`current`:return`false`}}function attrsMatch(e,t){for(let n=0;n<t.attrs.length;n++){let[r,i]=t.attrs[n],a=stateOf(e,r);if(r===`current`&&i===`true`){if(a===void 0||a===`false`)return!1}else if(a!==i)return!1}return!0}function matchesName(e,t){return t===null?!0:e===``?!1:typeof t==`string`?e===t:t.test(e)}function matchesText(e,t){return t===null||t.normalized===``?!0:e?e===t.normalized||e===t.raw||t.regex!==null&&t.regex.test(e):!1}function headerMatches(e,t){return(t.role===`fragment`||t.role===e.role)&&attrsMatch(e,t)&&matchesName(e.name,t.name)&&matchesText(e.url,t.url)}function matchesNode(e,t,n){return typeof e==`string`?t.kind===`text`&&matchesText(e,t.text):t.kind!==`role`||!headerMatches(e,t)?!1:t.mode===`contain`?containsList(e.children,t.children):t.mode===`equal`?listEqual(e.children,t.children,!1):t.mode===`deep-equal`||n?listEqual(e.children,t.children,!0):containsList(e.children,t.children)}function listEqual(e,t,n){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(!matchesNode(e[r],t[r],n))return!1;return!0}function containsList(e,t){if(t.length>e.length)return!1;let n=0;for(let r=0;r<t.length;r++){for(;n<e.length&&!matchesNode(e[n],t[r],!1);)n++;if(n===e.length)return!1;n++}return!0}function matchesDeep(e,t){if(matchesNode(e,t,!1))return!0;if(typeof e==`string`)return!1;for(let n=0;n<e.children.length;n++)if(matchesDeep(e.children[n],t))return!0;return!1}function textRepr(t){return t.regex===null?e.S(t.normalized):t.raw}function templateKey(t){let n=t.role;typeof t.name==`string`?n+=` `+e.y(t.name):t.name!==null&&(n+=` /${t.name.source}/`);for(let e=0;e<t.attrs.length;e++)n+=t.attrs[e][1]===`true`?` [${t.attrs[e][0]}]`:` [${t.attrs[e][0]}=${t.attrs[e][1]}]`;return n}function receivedKey(t){let n=t.role;t.name!==``&&(n+=` `+e.y(e.x(t.name,100)));for(let e=0;e<t.props.length;e++)n+=` `+t.props[e];return n}function isInline(e){return e.url===null&&e.mode===null&&e.children.length===1&&e.children[0].kind===`text`}function renderTemplate(e,t,n){if(e.kind===`text`){n.push(`${t}- text: ${textRepr(e.text)}`);return}let r=templateKey(e);if(isInline(e)){n.push(`${t}- ${r}: ${textRepr(e.children[0].text)}`);return}if(e.children.length===0&&e.url===null&&e.mode===null){n.push(`${t}- ${r}`);return}n.push(`${t}- ${r}:`);let i=t+` `;e.url!==null&&n.push(`${i}- /url: ${textRepr(e.url)}`),e.mode!==null&&n.push(`${i}- /children: ${e.mode}`);for(let t=0;t<e.children.length;t++)renderTemplate(e.children[t],i,n)}var Scorer=class{memo=/* @__PURE__ */ new Map;score(e,t){if(e.kind===`text`)return typeof t==`string`?matchesText(t,e.text)?3:1:0;if(typeof t==`string`||e.role!==`fragment`&&e.role!==t.role)return 0;let n=this.memo.get(e);n===void 0&&this.memo.set(e,n=/* @__PURE__ */ new Map);let r=n.get(t);if(r!==void 0)return r;let i=2;return i+=e.name===null?1:matchesName(t.name,e.name)?2:0,attrsMatch(t,e)&&(i+=1),e.url!==null&&matchesText(t.url,e.url)&&(i+=1),i+=this.scoreList(e.children,t.children),n.set(t,i),i}scoreList(e,t){let n=this.align(e,t),r=0;for(let t=0;t<e.length;t++)n[t]!==null&&(r+=this.score(e[t],n[t]));return r}align(e,t){let n=[],r=0;for(let i=0;i<e.length;i++){let a=-1,o=0;for(let n=r;n<t.length;n++){let r=this.score(e[i],t[n]);r>o&&(a=n,o=r)}a<0?n.push(null):(n.push(t[a]),r=a+1)}return n}project(t,n,r,i){if(t.kind===`text`){let a=n;i.push(`${r}- text: ${matchesText(a,t.text)?textRepr(t.text):e.S(e.x(a,100))}`);return}let a=n,o=headerMatches(a,t)?templateKey(t):receivedKey(a),s=this.align(t.children,a.children);if(isInline(t)){let n=s[0],a=t.children[0].text;i.push(n===null?`${r}- ${o}`:`${r}- ${o}: ${matchesText(n,a)?textRepr(a):e.S(e.x(n,100))}`);return}if(t.children.length===0&&t.url===null&&t.mode===null){i.push(`${r}- ${o}`);return}i.push(`${r}- ${o}:`);let c=r+` `;t.url!==null&&i.push(`${c}- /url: ${matchesText(a.url,t.url)?textRepr(t.url):e.S(a.url??``)}`),t.mode!==null&&i.push(`${c}- /children: ${t.mode}`);for(let e=0;e<t.children.length;e++)s[e]!==null&&this.project(t.children[e],s[e],c,i)}};function forEachNode(e,t){t(e);for(let n=0;n<e.children.length;n++){let r=e.children[n];typeof r==`string`?t(r):forEachNode(r,t)}}function closestLines(e,t){let n=new Scorer,r=[];if(t.kind===`role`&&t.role===`fragment`){let i=null,a=0;if(forEachNode(e,e=>{if(typeof e==`string`)return;let r=n.scoreList(t.children,e.children);r>a&&(i=e,a=r)}),i!==null){let e=n.align(t.children,i.children);for(let i=0;i<t.children.length;i++)e[i]!==null&&n.project(t.children[i],e[i],``,r)}return r}let i=null,a=0;return forEachNode(e,e=>{let r=n.score(t,e);r>a&&(i=e,a=r)}),i!==null&&n.project(t,i,``,r),r}function pairChanges(e){let t=[];for(let n=0;n<e.length;){if(e[n].kind===`=`){t.push(e[n++]);continue}let r=n;for(;r<e.length&&e[r].kind===`-`;)r++;let i=r;for(;i<e.length&&e[i].kind===`+`;)i++;if(r-n===i-r)for(let i=0;i<r-n;i++)t.push(e[n+i],e[r+i]);else for(let r=n;r<i;r++)t.push(e[r]);n=i}return t}function matchAriaSnapshot(t,n){let r=parseAriaTemplate(n),i=e.d(t,{urls:!0}),a=[];for(let e=0;e<i.length;e++){let t=i[e];a.push(typeof t==`string`?normalizeWhitespace(t):toMatchNode(t))}let o={role:`fragment`,name:``,states:/* @__PURE__ */ new Map,url:null,children:a,props:[]},s=matchesDeep(o,r),expectedLines=()=>{let e=[];if(r.kind===`role`&&r.role===`fragment`){r.mode!==null&&e.push(`- /children: ${r.mode}`);for(let t=0;t<r.children.length;t++)renderTemplate(r.children[t],``,e)}else renderTemplate(r,``,e);return e};return{pass:s,expected:()=>expectedLines().join(`
3
+ `:t===`t`?e+=` `:t===`u`?(e+=String.fromCharCode(parseInt(this.input.slice(this.pos,this.pos+4),16)),this.pos+=4):e+=t}else if(t===`"`)return e;else e+=t}throw new KeyError(`Unterminated string`,this.pos)}readRegex(){let e=this.pos,t=``,n=!1,r=!1;for(;!this.eof();){let i=this.input[this.pos++];if(n)t+=i,n=!1;else if(i===`\\`)n=!0,t+=i;else if(i===`/`&&!r)try{return new RegExp(t)}catch(t){throw new KeyError(`Invalid regular expression: ${t.message}`,e)}else i===`[`?(r=!0,t+=i):i===`]`&&r?(t+=i,r=!1):t+=i}throw new KeyError(`Unterminated regex`,this.pos)}parse(e){this.skipWhitespace();let t=this.readIdentifier(`role`);this.skipWhitespace();let n=null;this.peek()===`"`?(this.pos++,n=normalizeWhitespace(this.readString())):this.peek()===`/`&&(this.pos++,n=this.readRegex());let r={kind:`role`,role:t,name:n===``?null:n,attrs:[],url:null,mode:null,children:[]};for(;this.skipWhitespace(),this.peek()===`[`;){this.pos++,this.skipWhitespace();let e=this.pos,t=this.readIdentifier(`attribute`);this.skipWhitespace();let n=``;if(this.peek()===`=`)for(this.pos++,this.skipWhitespace();this.peek()!==`]`&&!/\s/.test(this.peek())&&!this.eof();)n+=this.input[this.pos++];if(this.skipWhitespace(),this.peek()!==`]`)throw new KeyError(`Expected ]`,this.pos);this.pos++,r.attrs.push([t,checkAttribute(t,n||`true`,e)])}if(this.skipWhitespace(),e&&this.atColon())return r;if(!this.eof())throw new KeyError(e?`Unexpected input (a key ends with ":" and a space)`:`Unexpected input`,this.pos);return r}};function checkAttribute(e,t,n){if(e===`checked`||e===`pressed`){if(t!==`true`&&t!==`false`&&t!==`mixed`)throw new KeyError(`Value of "${e}" attribute must be a boolean or "mixed"`,n);return t}if(r.has(e)){if(t!==`true`&&t!==`false`)throw new KeyError(`Value of "${e}" attribute must be a boolean`,n);return t}if(e===`level`){if(Number.isNaN(Number(t)))throw new KeyError(`Value of "level" attribute must be a number`,n);return String(Number(t))}if(e===`current`)return t;throw new KeyError(`Unsupported attribute [${e}]`,n)}function toMatchNode(e){let t=[];e.value!==null&&e.value!==``&&t.push(normalizeWhitespace(e.value));for(let n=0;n<e.children.length;n++){let r=e.children[n];t.push(typeof r==`string`?normalizeWhitespace(r):toMatchNode(r))}let n=/* @__PURE__ */ new Map;for(let t=0;t<e.props.length;t++){let r=e.props[t].slice(1,-1),i=r.indexOf(`=`);i<0?n.set(r,`true`):n.set(r.slice(0,i),r.slice(i+1))}return{role:e.role,name:normalizeWhitespace(e.name),states:n,url:e.url,children:t,props:e.props}}function stateOf(e,t){let r=e.states.get(t);if(r!==void 0)return r;switch(t){case`checked`:return(0,n.roleSupportsProp)(e.role,`aria-checked`)?`false`:void 0;case`disabled`:case`selected`:case`active`:case`busy`:case`hidden`:case`current`:return`false`}}function attrsMatch(e,t){for(let n=0;n<t.attrs.length;n++){let[r,i]=t.attrs[n],a=stateOf(e,r);if(r===`current`&&i===`true`){if(a===void 0||a===`false`)return!1}else if(a!==i)return!1}return!0}function matchesName(e,t){return t===null?!0:e===``?!1:typeof t==`string`?e===t:t.test(e)}function matchesText(e,t){return t===null||t.normalized===``?!0:e?e===t.normalized||e===t.raw||t.regex!==null&&t.regex.test(e):!1}function headerMatches(e,t){return(t.role===`fragment`||t.role===e.role)&&attrsMatch(e,t)&&matchesName(e.name,t.name)&&matchesText(e.url,t.url)}function matchesNode(e,t,n){return typeof e==`string`?t.kind===`text`&&matchesText(e,t.text):t.kind!==`role`||!headerMatches(e,t)?!1:t.mode===`contain`?containsList(e.children,t.children):t.mode===`equal`?listEqual(e.children,t.children,!1):t.mode===`deep-equal`||n?listEqual(e.children,t.children,!0):containsList(e.children,t.children)}function listEqual(e,t,n){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(!matchesNode(e[r],t[r],n))return!1;return!0}function containsList(e,t){if(t.length>e.length)return!1;let n=0;for(let r=0;r<t.length;r++){for(;n<e.length&&!matchesNode(e[n],t[r],!1);)n++;if(n===e.length)return!1;n++}return!0}function matchesDeep(e,t){if(matchesNode(e,t,!1))return!0;if(typeof e==`string`)return!1;for(let n=0;n<e.children.length;n++)if(matchesDeep(e.children[n],t))return!0;return!1}function textRepr(t){return t.regex===null?e.S(t.normalized):t.raw}function templateKey(t){let n=t.role;typeof t.name==`string`?n+=` `+e.y(t.name):t.name!==null&&(n+=` /${t.name.source}/`);for(let e=0;e<t.attrs.length;e++)n+=t.attrs[e][1]===`true`?` [${t.attrs[e][0]}]`:` [${t.attrs[e][0]}=${t.attrs[e][1]}]`;return n}function isInline(e){return e.url===null&&e.mode===null&&e.children.length===1&&e.children[0].kind===`text`}function renderTemplate(e,t,n){if(e.kind===`text`){n.push(`${t}- text: ${textRepr(e.text)}`);return}let r=templateKey(e);if(isInline(e)){n.push(`${t}- ${r}: ${textRepr(e.children[0].text)}`);return}if(e.children.length===0&&e.url===null&&e.mode===null){n.push(`${t}- ${r}`);return}n.push(`${t}- ${r}:`);let i=t+` `;e.url!==null&&n.push(`${i}- /url: ${textRepr(e.url)}`),e.mode!==null&&n.push(`${i}- /children: ${e.mode}`);for(let t=0;t<e.children.length;t++)renderTemplate(e.children[t],i,n)}var Scorer=class{memo=/* @__PURE__ */ new Map;score(e,t){if(e.kind===`text`)return typeof t==`string`?matchesText(t,e.text)?3:1:0;if(typeof t==`string`||e.role!==`fragment`&&e.role!==t.role)return 0;let n=this.memo.get(e);n===void 0&&this.memo.set(e,n=/* @__PURE__ */ new Map);let r=n.get(t);if(r!==void 0)return r;let i=2;return i+=e.name===null?1:matchesName(t.name,e.name)?2:0,attrsMatch(t,e)&&(i+=1),e.url!==null&&matchesText(t.url,e.url)&&(i+=1),i+=this.scoreList(e.children,t.children),n.set(t,i),i}scoreList(e,t){let n=this.align(e,t),r=0;for(let t=0;t<e.length;t++)n[t]!==null&&(r+=this.score(e[t],n[t]));return r}align(e,t){let n=[],r=0;for(let i=0;i<e.length;i++){let a=-1,o=0;for(let n=r;n<t.length;n++){let r=this.score(e[i],t[n]);r>o&&(a=n,o=r)}a<0?n.push(null):(n.push(t[a]),r=a+1)}return n}project(t,n,r,i){if(t.kind===`text`){let a=n;i.push(`${r}- text: ${matchesText(a,t.text)?textRepr(t.text):e.S(e.x(a,100))}`);return}let a=n,o=headerMatches(a,t)?templateKey(t):e._(a,100),s=this.align(t.children,a.children);if(isInline(t)){let n=s[0],a=t.children[0].text;i.push(n===null?`${r}- ${o}`:`${r}- ${o}: ${matchesText(n,a)?textRepr(a):e.S(e.x(n,100))}`);return}if(t.children.length===0&&t.url===null&&t.mode===null){i.push(`${r}- ${o}`);return}i.push(`${r}- ${o}:`);let c=r+` `;t.url!==null&&i.push(`${c}- /url: ${matchesText(a.url,t.url)?textRepr(t.url):e.S(a.url??``)}`),t.mode!==null&&i.push(`${c}- /children: ${t.mode}`);for(let e=0;e<t.children.length;e++)s[e]!==null&&this.project(t.children[e],s[e],c,i)}};function forEachNode(e,t){t(e);for(let n=0;n<e.children.length;n++){let r=e.children[n];typeof r==`string`?t(r):forEachNode(r,t)}}function closestLines(e,t){let n=new Scorer,r=[];if(t.kind===`role`&&t.role===`fragment`){let i=null,a=0;if(forEachNode(e,e=>{if(typeof e==`string`)return;let r=n.scoreList(t.children,e.children);r>a&&(i=e,a=r)}),i!==null){let e=n.align(t.children,i.children);for(let i=0;i<t.children.length;i++)e[i]!==null&&n.project(t.children[i],e[i],``,r)}return r}let i=null,a=0;return forEachNode(e,e=>{let r=n.score(t,e);r>a&&(i=e,a=r)}),i!==null&&n.project(t,i,``,r),r}function pairChanges(e){let t=[];for(let n=0;n<e.length;){if(e[n].kind===`=`){t.push(e[n++]);continue}let r=n;for(;r<e.length&&e[r].kind===`-`;)r++;let i=r;for(;i<e.length&&e[i].kind===`+`;)i++;if(r-n===i-r)for(let i=0;i<r-n;i++)t.push(e[n+i],e[r+i]);else for(let r=n;r<i;r++)t.push(e[r]);n=i}return t}function matchAriaSnapshot(t,n){let r=parseAriaTemplate(n),i=e.d(t,{urls:!0}),a=[];for(let e=0;e<i.length;e++){let t=i[e];a.push(typeof t==`string`?normalizeWhitespace(t):toMatchNode(t))}let o={role:`fragment`,name:``,states:/* @__PURE__ */ new Map,url:null,children:a,props:[]},s=matchesDeep(o,r),expectedLines=()=>{let e=[];if(r.kind===`role`&&r.role===`fragment`){r.mode!==null&&e.push(`- /children: ${r.mode}`);for(let t=0;t<r.children.length;t++)renderTemplate(r.children[t],``,e)}else renderTemplate(r,``,e);return e};return{pass:s,expected:()=>expectedLines().join(`
4
4
  `),diff:()=>pairChanges(e.n(expectedLines(),closestLines(o,r))),received:()=>e.l(t,{collapseAfter:1/0,maxLines:e.m()??100})}}function resetFailureSnapshot(t){e.b(t)}function captureFailureSnapshot(n){let r=e.w(),i=n?.body;if(r===null||i==null||i[t.$impl]===void 0)return null;if(r===`compact`){let t=e.s(i,void 0,{format:`compact`});return{format:r,text:String(t),full:``,previous:void 0}}let a=e.g(n),{lines:o,empty:s}=e.u(i),c=s??o.join(`
5
5
  `);return{format:r,text:s??e.f(o,e.m()??100).join(`
6
6
  `),full:c,previous:a}}function formatFailureSnapshot(t,n){if(t.format===`compact`)return`DOM of <body> when the test failed (CTRL_DOM_DEBUG=compact):\n${t.text}`;if(n.includes(t.text))return`Accessibility snapshot of <body> when the test failed: the same as above.`;let r=`Accessibility snapshot of <body> when the test failed (CTRL_DOM_DEBUG=aria):\n${t.text}`;return t.previous!==void 0&&(t.previous===t.full?r+=`
@@ -1,11 +1,11 @@
1
- import{S as e,b as t,d as n,f as r,g as i,l as a,m as o,n as s,s as c,t as l,u,w as d,x as f,y as p}from"./_chunks/aria-snapshot-diff-VoXekyfV.js";import{$impl as m}from"../bridge/internal.js";import{roleSupportsProp as h}from"../aria/index.js";var AriaTemplateError=class extends Error{constructor(e,t,n,r=-1){super(`${e} (template line ${t+1}):\n\n${n}${r>=0?`\n${` `.repeat(r)}^`:``}`),this.name=`AriaTemplateError`}};function normalizeWhitespace(e){return e.replace(/[​­]/g,``).replace(/[\r\n\s\t]+/g,` `).trim()}function textValue(e){let t=null;if(e.length>1&&e.startsWith(`/`)&&e.endsWith(`/`))try{t=new RegExp(e.slice(1,-1))}catch{t=null}return{raw:e,normalized:normalizeWhitespace(e),regex:t}}const g=/* @__PURE__ */ new Set([`disabled`,`expanded`,`active`,`selected`,`busy`,`hidden`]);function parseAriaTemplate(e){let t=e.split(/\r?\n/),n=1/0;for(let e=0;e<t.length;e++){let r=t[e],i=r.trim();if(i===``||i.startsWith(`#`))continue;let a=r.length-r.trimStart().length;if(r.slice(0,a).includes(` `))throw new AriaTemplateError(`Tabs cannot be used for indentation`,e,r);a<n&&(n=a)}let r={kind:`role`,role:`fragment`,name:null,attrs:[],url:null,mode:null,children:[]};if(n===1/0)throw new AriaTemplateError(`The aria snapshot template is empty`,0,e);let i=[{indent:-1,node:r,line:-1}];for(let e=0;e<t.length;e++){let r=t[e],a=r.trim();if(a===``||a.startsWith(`#`))continue;let o=r.length-r.trimStart().length-n;if(a!==`-`&&!a.startsWith(`- `))throw new AriaTemplateError(`Aria snapshot must be a YAML sequence, elements starting with "-"`,e,r,o+n);for(;i[i.length-1].indent>=o;)i.pop();let s=i[i.length-1];if(s.node===null)throw new AriaTemplateError(`"- text:" on line ${s.line+1} cannot have children`,e,r,o+n);let c=a.slice(2).trimStart(),l=r.length-c.length,u=parseItem(c,s.node,e,r,l);u!==void 0&&i.push({indent:o,node:u,line:e})}return r.children.length===1&&(r.mode===null||r.mode===`contain`)&&r.url===null?r.children[0]:r}function parseItem(e,t,n,r,i){let fail=(e,t)=>{throw new AriaTemplateError(e,n,r,i+t)};if(e===``&&fail(`Empty sequence item`,0),e.startsWith(`/`)){let n=e.indexOf(`:`);n<0&&fail("Property should be written `/name: value`",e.length);let r=e.slice(1,n).trim(),i=parseScalar(e.slice(n+1),fail,n+1);r===`children`?(i!==`contain`&&i!==`equal`&&i!==`deep-equal`&&fail(`Value of "/children" should be "contain", "equal" or "deep-equal"`,n+1),t.mode=i):r===`url`&&(t.url=textValue(i));return}let a,o=null;try{if(e[0]===`"`||e[0]===`'`){let[n,r]=readQuoted(e,0,fail),i=e.slice(r).trimStart();if(i!==``&&i[0]!==`:`&&fail(`Unexpected input after the quoted key`,r),i!==``&&(o=i.slice(1)),n===`text`&&o!==null)return textItem(t,o,fail,e.length-o.length);a=new KeyParser(n).parse(!1)}else{if(/^text:(\s|$)/.test(e))return textItem(t,e.slice(5),fail,5);let n=new KeyParser(e);a=n.parse(!0),n.pos<e.length&&(o=e.slice(n.pos+1))}}catch(t){throw t instanceof KeyError&&fail(t.message,e[0]===`"`||e[0]===`'`?0:t.pos),t}return o!==null&&o.trim()!==``&&a.children.push({kind:`text`,text:textValue(parseScalar(o,fail,e.length-o.length))}),t.children.push(a),a}function textItem(e,t,n,r){return e.children.push({kind:`text`,text:textValue(parseScalar(t,n,r))}),null}function parseScalar(e,t,n){let r=e.length-e.trimStart().length,i=e.trim();if(i[0]===`"`||i[0]===`'`){let[e,a]=readQuoted(i,0,(e,i)=>t(e,n+r+i)),o=i.slice(a).trim();return o!==``&&!o.startsWith(`#`)&&t(`Unexpected input after the quoted value`,n+r+a),e}(i===`|`||i===`>`||i.startsWith(`|`)||i.startsWith(`>`))&&t(`Block scalars are not supported in aria snapshot templates`,n+r);let a=i.search(/\s#/);return a>=0?i.slice(0,a).trim():i}function readQuoted(e,t,n){let r=e[t],i=``;for(let n=t+1;n<e.length;n++){let t=e[n];if(r===`'`){if(t===`'`){if(e[n+1]===`'`){i+=`'`,n++;continue}return[i,n+1]}i+=t}else{if(t===`"`)return[i,n+1];if(t===`\\`){let t=e[++n];t===`n`?i+=`
1
+ import{S as e,_ as t,b as n,d as r,f as i,g as a,l as o,m as s,n as c,s as l,t as u,u as d,w as f,x as p,y as m}from"./_chunks/aria-snapshot-diff-DdhypD1z.js";import{$impl as h}from"../bridge/internal.js";import{roleSupportsProp as g}from"../aria/index.js";var AriaTemplateError=class extends Error{constructor(e,t,n,r=-1){super(`${e} (template line ${t+1}):\n\n${n}${r>=0?`\n${` `.repeat(r)}^`:``}`),this.name=`AriaTemplateError`}};function normalizeWhitespace(e){return e.replace(/[​­]/g,``).replace(/[\r\n\s\t]+/g,` `).trim()}function textValue(e){let t=null;if(e.length>1&&e.startsWith(`/`)&&e.endsWith(`/`))try{t=new RegExp(e.slice(1,-1))}catch{t=null}return{raw:e,normalized:normalizeWhitespace(e),regex:t}}const _=/* @__PURE__ */ new Set([`disabled`,`expanded`,`active`,`selected`,`busy`,`hidden`]);function parseAriaTemplate(e){let t=e.split(/\r?\n/),n=1/0;for(let e=0;e<t.length;e++){let r=t[e],i=r.trim();if(i===``||i.startsWith(`#`))continue;let a=r.length-r.trimStart().length;if(r.slice(0,a).includes(` `))throw new AriaTemplateError(`Tabs cannot be used for indentation`,e,r);a<n&&(n=a)}let r={kind:`role`,role:`fragment`,name:null,attrs:[],url:null,mode:null,children:[]};if(n===1/0)throw new AriaTemplateError(`The aria snapshot template is empty`,0,e);let i=[{indent:-1,node:r,line:-1}];for(let e=0;e<t.length;e++){let r=t[e],a=r.trim();if(a===``||a.startsWith(`#`))continue;let o=r.length-r.trimStart().length-n;if(a!==`-`&&!a.startsWith(`- `))throw new AriaTemplateError(`Aria snapshot must be a YAML sequence, elements starting with "-"`,e,r,o+n);for(;i[i.length-1].indent>=o;)i.pop();let s=i[i.length-1];if(s.node===null)throw new AriaTemplateError(`"- text:" on line ${s.line+1} cannot have children`,e,r,o+n);let c=a.slice(2).trimStart(),l=r.length-c.length,u=parseItem(c,s.node,e,r,l);u!==void 0&&i.push({indent:o,node:u,line:e})}return r.children.length===1&&(r.mode===null||r.mode===`contain`)&&r.url===null?r.children[0]:r}function parseItem(e,t,n,r,i){let fail=(e,t)=>{throw new AriaTemplateError(e,n,r,i+t)};if(e===``&&fail(`Empty sequence item`,0),e.startsWith(`/`)){let n=e.indexOf(`:`);n<0&&fail("Property should be written `/name: value`",e.length);let r=e.slice(1,n).trim(),i=parseScalar(e.slice(n+1),fail,n+1);r===`children`?(i!==`contain`&&i!==`equal`&&i!==`deep-equal`&&fail(`Value of "/children" should be "contain", "equal" or "deep-equal"`,n+1),t.mode=i):r===`url`&&(t.url=textValue(i));return}let a,o=null;try{if(e[0]===`"`||e[0]===`'`){let[n,r]=readQuoted(e,0,fail),i=e.slice(r).trimStart();if(i!==``&&i[0]!==`:`&&fail(`Unexpected input after the quoted key`,r),i!==``&&(o=i.slice(1)),n===`text`&&o!==null)return textItem(t,o,fail,e.length-o.length);a=new KeyParser(n).parse(!1)}else{if(/^text:(\s|$)/.test(e))return textItem(t,e.slice(5),fail,5);let n=new KeyParser(e);a=n.parse(!0),n.pos<e.length&&(o=e.slice(n.pos+1))}}catch(t){throw t instanceof KeyError&&fail(t.message,e[0]===`"`||e[0]===`'`?0:t.pos),t}return o!==null&&o.trim()!==``&&a.children.push({kind:`text`,text:textValue(parseScalar(o,fail,e.length-o.length))}),t.children.push(a),a}function textItem(e,t,n,r){return e.children.push({kind:`text`,text:textValue(parseScalar(t,n,r))}),null}function parseScalar(e,t,n){let r=e.length-e.trimStart().length,i=e.trim();if(i[0]===`"`||i[0]===`'`){let[e,a]=readQuoted(i,0,(e,i)=>t(e,n+r+i)),o=i.slice(a).trim();return o!==``&&!o.startsWith(`#`)&&t(`Unexpected input after the quoted value`,n+r+a),e}(i===`|`||i===`>`||i.startsWith(`|`)||i.startsWith(`>`))&&t(`Block scalars are not supported in aria snapshot templates`,n+r);let a=i.search(/\s#/);return a>=0?i.slice(0,a).trim():i}function readQuoted(e,t,n){let r=e[t],i=``;for(let n=t+1;n<e.length;n++){let t=e[n];if(r===`'`){if(t===`'`){if(e[n+1]===`'`){i+=`'`,n++;continue}return[i,n+1]}i+=t}else{if(t===`"`)return[i,n+1];if(t===`\\`){let t=e[++n];t===`n`?i+=`
2
2
  `:t===`t`?i+=` `:t===`u`?(i+=String.fromCharCode(parseInt(e.slice(n+1,n+5),16)),n+=4):i+=t??``}else i+=t}}return n(`Unterminated string`,e.length)}var KeyError=class extends Error{pos;constructor(e,t){super(e),this.pos=t}},KeyParser=class{pos=0;input;constructor(e){this.input=e}peek(){return this.input[this.pos]??``}eof(){return this.pos>=this.input.length}skipWhitespace(){for(;!this.eof()&&/\s/.test(this.peek());)this.pos++}atColon(){return this.peek()===`:`&&(this.pos+1>=this.input.length||/\s/.test(this.input[this.pos+1]))}readIdentifier(e){if(this.eof())throw new KeyError(`Unexpected end of input when expecting ${e}`,this.pos);let t=this.pos;for(;!this.eof()&&/[a-zA-Z]/.test(this.peek());)this.pos++;if(this.pos===t)throw new KeyError(`Expected ${e}`,this.pos);return this.input.slice(t,this.pos)}readString(){let e=``;for(;!this.eof();){let t=this.input[this.pos++];if(t===`\\`){let t=this.input[this.pos++]??``;t===`n`?e+=`
3
- `:t===`t`?e+=` `:t===`u`?(e+=String.fromCharCode(parseInt(this.input.slice(this.pos,this.pos+4),16)),this.pos+=4):e+=t}else if(t===`"`)return e;else e+=t}throw new KeyError(`Unterminated string`,this.pos)}readRegex(){let e=this.pos,t=``,n=!1,r=!1;for(;!this.eof();){let i=this.input[this.pos++];if(n)t+=i,n=!1;else if(i===`\\`)n=!0,t+=i;else if(i===`/`&&!r)try{return new RegExp(t)}catch(t){throw new KeyError(`Invalid regular expression: ${t.message}`,e)}else i===`[`?(r=!0,t+=i):i===`]`&&r?(t+=i,r=!1):t+=i}throw new KeyError(`Unterminated regex`,this.pos)}parse(e){this.skipWhitespace();let t=this.readIdentifier(`role`);this.skipWhitespace();let n=null;this.peek()===`"`?(this.pos++,n=normalizeWhitespace(this.readString())):this.peek()===`/`&&(this.pos++,n=this.readRegex());let r={kind:`role`,role:t,name:n===``?null:n,attrs:[],url:null,mode:null,children:[]};for(;this.skipWhitespace(),this.peek()===`[`;){this.pos++,this.skipWhitespace();let e=this.pos,t=this.readIdentifier(`attribute`);this.skipWhitespace();let n=``;if(this.peek()===`=`)for(this.pos++,this.skipWhitespace();this.peek()!==`]`&&!/\s/.test(this.peek())&&!this.eof();)n+=this.input[this.pos++];if(this.skipWhitespace(),this.peek()!==`]`)throw new KeyError(`Expected ]`,this.pos);this.pos++,r.attrs.push([t,checkAttribute(t,n||`true`,e)])}if(this.skipWhitespace(),e&&this.atColon())return r;if(!this.eof())throw new KeyError(e?`Unexpected input (a key ends with ":" and a space)`:`Unexpected input`,this.pos);return r}};function checkAttribute(e,t,n){if(e===`checked`||e===`pressed`){if(t!==`true`&&t!==`false`&&t!==`mixed`)throw new KeyError(`Value of "${e}" attribute must be a boolean or "mixed"`,n);return t}if(g.has(e)){if(t!==`true`&&t!==`false`)throw new KeyError(`Value of "${e}" attribute must be a boolean`,n);return t}if(e===`level`){if(Number.isNaN(Number(t)))throw new KeyError(`Value of "level" attribute must be a number`,n);return String(Number(t))}if(e===`current`)return t;throw new KeyError(`Unsupported attribute [${e}]`,n)}function toMatchNode(e){let t=[];e.value!==null&&e.value!==``&&t.push(normalizeWhitespace(e.value));for(let n=0;n<e.children.length;n++){let r=e.children[n];t.push(typeof r==`string`?normalizeWhitespace(r):toMatchNode(r))}let n=/* @__PURE__ */ new Map;for(let t=0;t<e.props.length;t++){let r=e.props[t].slice(1,-1),i=r.indexOf(`=`);i<0?n.set(r,`true`):n.set(r.slice(0,i),r.slice(i+1))}return{role:e.role,name:normalizeWhitespace(e.name),states:n,url:e.url,children:t,props:e.props}}function stateOf(e,t){let n=e.states.get(t);if(n!==void 0)return n;switch(t){case`checked`:return h(e.role,`aria-checked`)?`false`:void 0;case`disabled`:case`selected`:case`active`:case`busy`:case`hidden`:case`current`:return`false`}}function attrsMatch(e,t){for(let n=0;n<t.attrs.length;n++){let[r,i]=t.attrs[n],a=stateOf(e,r);if(r===`current`&&i===`true`){if(a===void 0||a===`false`)return!1}else if(a!==i)return!1}return!0}function matchesName(e,t){return t===null?!0:e===``?!1:typeof t==`string`?e===t:t.test(e)}function matchesText(e,t){return t===null||t.normalized===``?!0:e?e===t.normalized||e===t.raw||t.regex!==null&&t.regex.test(e):!1}function headerMatches(e,t){return(t.role===`fragment`||t.role===e.role)&&attrsMatch(e,t)&&matchesName(e.name,t.name)&&matchesText(e.url,t.url)}function matchesNode(e,t,n){return typeof e==`string`?t.kind===`text`&&matchesText(e,t.text):t.kind!==`role`||!headerMatches(e,t)?!1:t.mode===`contain`?containsList(e.children,t.children):t.mode===`equal`?listEqual(e.children,t.children,!1):t.mode===`deep-equal`||n?listEqual(e.children,t.children,!0):containsList(e.children,t.children)}function listEqual(e,t,n){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(!matchesNode(e[r],t[r],n))return!1;return!0}function containsList(e,t){if(t.length>e.length)return!1;let n=0;for(let r=0;r<t.length;r++){for(;n<e.length&&!matchesNode(e[n],t[r],!1);)n++;if(n===e.length)return!1;n++}return!0}function matchesDeep(e,t){if(matchesNode(e,t,!1))return!0;if(typeof e==`string`)return!1;for(let n=0;n<e.children.length;n++)if(matchesDeep(e.children[n],t))return!0;return!1}function textRepr(t){return t.regex===null?e(t.normalized):t.raw}function templateKey(e){let t=e.role;typeof e.name==`string`?t+=` `+p(e.name):e.name!==null&&(t+=` /${e.name.source}/`);for(let n=0;n<e.attrs.length;n++)t+=e.attrs[n][1]===`true`?` [${e.attrs[n][0]}]`:` [${e.attrs[n][0]}=${e.attrs[n][1]}]`;return t}function receivedKey(e){let t=e.role;e.name!==``&&(t+=` `+p(f(e.name,100)));for(let n=0;n<e.props.length;n++)t+=` `+e.props[n];return t}function isInline(e){return e.url===null&&e.mode===null&&e.children.length===1&&e.children[0].kind===`text`}function renderTemplate(e,t,n){if(e.kind===`text`){n.push(`${t}- text: ${textRepr(e.text)}`);return}let r=templateKey(e);if(isInline(e)){n.push(`${t}- ${r}: ${textRepr(e.children[0].text)}`);return}if(e.children.length===0&&e.url===null&&e.mode===null){n.push(`${t}- ${r}`);return}n.push(`${t}- ${r}:`);let i=t+` `;e.url!==null&&n.push(`${i}- /url: ${textRepr(e.url)}`),e.mode!==null&&n.push(`${i}- /children: ${e.mode}`);for(let t=0;t<e.children.length;t++)renderTemplate(e.children[t],i,n)}var Scorer=class{memo=/* @__PURE__ */ new Map;score(e,t){if(e.kind===`text`)return typeof t==`string`?matchesText(t,e.text)?3:1:0;if(typeof t==`string`||e.role!==`fragment`&&e.role!==t.role)return 0;let n=this.memo.get(e);n===void 0&&this.memo.set(e,n=/* @__PURE__ */ new Map);let r=n.get(t);if(r!==void 0)return r;let i=2;return i+=e.name===null?1:matchesName(t.name,e.name)?2:0,attrsMatch(t,e)&&(i+=1),e.url!==null&&matchesText(t.url,e.url)&&(i+=1),i+=this.scoreList(e.children,t.children),n.set(t,i),i}scoreList(e,t){let n=this.align(e,t),r=0;for(let t=0;t<e.length;t++)n[t]!==null&&(r+=this.score(e[t],n[t]));return r}align(e,t){let n=[],r=0;for(let i=0;i<e.length;i++){let a=-1,o=0;for(let n=r;n<t.length;n++){let r=this.score(e[i],t[n]);r>o&&(a=n,o=r)}a<0?n.push(null):(n.push(t[a]),r=a+1)}return n}project(t,n,r,i){if(t.kind===`text`){let a=n;i.push(`${r}- text: ${matchesText(a,t.text)?textRepr(t.text):e(f(a,100))}`);return}let a=n,o=headerMatches(a,t)?templateKey(t):receivedKey(a),s=this.align(t.children,a.children);if(isInline(t)){let n=s[0],a=t.children[0].text;i.push(n===null?`${r}- ${o}`:`${r}- ${o}: ${matchesText(n,a)?textRepr(a):e(f(n,100))}`);return}if(t.children.length===0&&t.url===null&&t.mode===null){i.push(`${r}- ${o}`);return}i.push(`${r}- ${o}:`);let c=r+` `;t.url!==null&&i.push(`${c}- /url: ${matchesText(a.url,t.url)?textRepr(t.url):e(a.url??``)}`),t.mode!==null&&i.push(`${c}- /children: ${t.mode}`);for(let e=0;e<t.children.length;e++)s[e]!==null&&this.project(t.children[e],s[e],c,i)}};function forEachNode(e,t){t(e);for(let n=0;n<e.children.length;n++){let r=e.children[n];typeof r==`string`?t(r):forEachNode(r,t)}}function closestLines(e,t){let n=new Scorer,r=[];if(t.kind===`role`&&t.role===`fragment`){let i=null,a=0;if(forEachNode(e,e=>{if(typeof e==`string`)return;let r=n.scoreList(t.children,e.children);r>a&&(i=e,a=r)}),i!==null){let e=n.align(t.children,i.children);for(let i=0;i<t.children.length;i++)e[i]!==null&&n.project(t.children[i],e[i],``,r)}return r}let i=null,a=0;return forEachNode(e,e=>{let r=n.score(t,e);r>a&&(i=e,a=r)}),i!==null&&n.project(t,i,``,r),r}function pairChanges(e){let t=[];for(let n=0;n<e.length;){if(e[n].kind===`=`){t.push(e[n++]);continue}let r=n;for(;r<e.length&&e[r].kind===`-`;)r++;let i=r;for(;i<e.length&&e[i].kind===`+`;)i++;if(r-n===i-r)for(let i=0;i<r-n;i++)t.push(e[n+i],e[r+i]);else for(let r=n;r<i;r++)t.push(e[r]);n=i}return t}function matchAriaSnapshot(e,t){let r=parseAriaTemplate(t),i=n(e,{urls:!0}),c=[];for(let e=0;e<i.length;e++){let t=i[e];c.push(typeof t==`string`?normalizeWhitespace(t):toMatchNode(t))}let l={role:`fragment`,name:``,states:/* @__PURE__ */ new Map,url:null,children:c,props:[]},u=matchesDeep(l,r),expectedLines=()=>{let e=[];if(r.kind===`role`&&r.role===`fragment`){r.mode!==null&&e.push(`- /children: ${r.mode}`);for(let t=0;t<r.children.length;t++)renderTemplate(r.children[t],``,e)}else renderTemplate(r,``,e);return e};return{pass:u,expected:()=>expectedLines().join(`
4
- `),diff:()=>pairChanges(s(expectedLines(),closestLines(l,r))),received:()=>a(e,{collapseAfter:1/0,maxLines:o()??100})}}function resetFailureSnapshot(e){t(e)}function captureFailureSnapshot(e){let t=d(),n=e?.body;if(t===null||n==null||n[m]===void 0)return null;if(t===`compact`){let e=c(n,void 0,{format:`compact`});return{format:t,text:String(e),full:``,previous:void 0}}let a=i(e),{lines:s,empty:l}=u(n),f=l??s.join(`
5
- `);return{format:t,text:l??r(s,o()??100).join(`
6
- `),full:f,previous:a}}function formatFailureSnapshot(e,t){if(e.format===`compact`)return`DOM of <body> when the test failed (CTRL_DOM_DEBUG=compact):\n${e.text}`;if(t.includes(e.text))return`Accessibility snapshot of <body> when the test failed: the same as above.`;let n=`Accessibility snapshot of <body> when the test failed (CTRL_DOM_DEBUG=aria):\n${e.text}`;return e.previous!==void 0&&(e.previous===e.full?n+=`
3
+ `:t===`t`?e+=` `:t===`u`?(e+=String.fromCharCode(parseInt(this.input.slice(this.pos,this.pos+4),16)),this.pos+=4):e+=t}else if(t===`"`)return e;else e+=t}throw new KeyError(`Unterminated string`,this.pos)}readRegex(){let e=this.pos,t=``,n=!1,r=!1;for(;!this.eof();){let i=this.input[this.pos++];if(n)t+=i,n=!1;else if(i===`\\`)n=!0,t+=i;else if(i===`/`&&!r)try{return new RegExp(t)}catch(t){throw new KeyError(`Invalid regular expression: ${t.message}`,e)}else i===`[`?(r=!0,t+=i):i===`]`&&r?(t+=i,r=!1):t+=i}throw new KeyError(`Unterminated regex`,this.pos)}parse(e){this.skipWhitespace();let t=this.readIdentifier(`role`);this.skipWhitespace();let n=null;this.peek()===`"`?(this.pos++,n=normalizeWhitespace(this.readString())):this.peek()===`/`&&(this.pos++,n=this.readRegex());let r={kind:`role`,role:t,name:n===``?null:n,attrs:[],url:null,mode:null,children:[]};for(;this.skipWhitespace(),this.peek()===`[`;){this.pos++,this.skipWhitespace();let e=this.pos,t=this.readIdentifier(`attribute`);this.skipWhitespace();let n=``;if(this.peek()===`=`)for(this.pos++,this.skipWhitespace();this.peek()!==`]`&&!/\s/.test(this.peek())&&!this.eof();)n+=this.input[this.pos++];if(this.skipWhitespace(),this.peek()!==`]`)throw new KeyError(`Expected ]`,this.pos);this.pos++,r.attrs.push([t,checkAttribute(t,n||`true`,e)])}if(this.skipWhitespace(),e&&this.atColon())return r;if(!this.eof())throw new KeyError(e?`Unexpected input (a key ends with ":" and a space)`:`Unexpected input`,this.pos);return r}};function checkAttribute(e,t,n){if(e===`checked`||e===`pressed`){if(t!==`true`&&t!==`false`&&t!==`mixed`)throw new KeyError(`Value of "${e}" attribute must be a boolean or "mixed"`,n);return t}if(_.has(e)){if(t!==`true`&&t!==`false`)throw new KeyError(`Value of "${e}" attribute must be a boolean`,n);return t}if(e===`level`){if(Number.isNaN(Number(t)))throw new KeyError(`Value of "level" attribute must be a number`,n);return String(Number(t))}if(e===`current`)return t;throw new KeyError(`Unsupported attribute [${e}]`,n)}function toMatchNode(e){let t=[];e.value!==null&&e.value!==``&&t.push(normalizeWhitespace(e.value));for(let n=0;n<e.children.length;n++){let r=e.children[n];t.push(typeof r==`string`?normalizeWhitespace(r):toMatchNode(r))}let n=/* @__PURE__ */ new Map;for(let t=0;t<e.props.length;t++){let r=e.props[t].slice(1,-1),i=r.indexOf(`=`);i<0?n.set(r,`true`):n.set(r.slice(0,i),r.slice(i+1))}return{role:e.role,name:normalizeWhitespace(e.name),states:n,url:e.url,children:t,props:e.props}}function stateOf(e,t){let n=e.states.get(t);if(n!==void 0)return n;switch(t){case`checked`:return g(e.role,`aria-checked`)?`false`:void 0;case`disabled`:case`selected`:case`active`:case`busy`:case`hidden`:case`current`:return`false`}}function attrsMatch(e,t){for(let n=0;n<t.attrs.length;n++){let[r,i]=t.attrs[n],a=stateOf(e,r);if(r===`current`&&i===`true`){if(a===void 0||a===`false`)return!1}else if(a!==i)return!1}return!0}function matchesName(e,t){return t===null?!0:e===``?!1:typeof t==`string`?e===t:t.test(e)}function matchesText(e,t){return t===null||t.normalized===``?!0:e?e===t.normalized||e===t.raw||t.regex!==null&&t.regex.test(e):!1}function headerMatches(e,t){return(t.role===`fragment`||t.role===e.role)&&attrsMatch(e,t)&&matchesName(e.name,t.name)&&matchesText(e.url,t.url)}function matchesNode(e,t,n){return typeof e==`string`?t.kind===`text`&&matchesText(e,t.text):t.kind!==`role`||!headerMatches(e,t)?!1:t.mode===`contain`?containsList(e.children,t.children):t.mode===`equal`?listEqual(e.children,t.children,!1):t.mode===`deep-equal`||n?listEqual(e.children,t.children,!0):containsList(e.children,t.children)}function listEqual(e,t,n){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(!matchesNode(e[r],t[r],n))return!1;return!0}function containsList(e,t){if(t.length>e.length)return!1;let n=0;for(let r=0;r<t.length;r++){for(;n<e.length&&!matchesNode(e[n],t[r],!1);)n++;if(n===e.length)return!1;n++}return!0}function matchesDeep(e,t){if(matchesNode(e,t,!1))return!0;if(typeof e==`string`)return!1;for(let n=0;n<e.children.length;n++)if(matchesDeep(e.children[n],t))return!0;return!1}function textRepr(t){return t.regex===null?e(t.normalized):t.raw}function templateKey(e){let t=e.role;typeof e.name==`string`?t+=` `+m(e.name):e.name!==null&&(t+=` /${e.name.source}/`);for(let n=0;n<e.attrs.length;n++)t+=e.attrs[n][1]===`true`?` [${e.attrs[n][0]}]`:` [${e.attrs[n][0]}=${e.attrs[n][1]}]`;return t}function isInline(e){return e.url===null&&e.mode===null&&e.children.length===1&&e.children[0].kind===`text`}function renderTemplate(e,t,n){if(e.kind===`text`){n.push(`${t}- text: ${textRepr(e.text)}`);return}let r=templateKey(e);if(isInline(e)){n.push(`${t}- ${r}: ${textRepr(e.children[0].text)}`);return}if(e.children.length===0&&e.url===null&&e.mode===null){n.push(`${t}- ${r}`);return}n.push(`${t}- ${r}:`);let i=t+` `;e.url!==null&&n.push(`${i}- /url: ${textRepr(e.url)}`),e.mode!==null&&n.push(`${i}- /children: ${e.mode}`);for(let t=0;t<e.children.length;t++)renderTemplate(e.children[t],i,n)}var Scorer=class{memo=/* @__PURE__ */ new Map;score(e,t){if(e.kind===`text`)return typeof t==`string`?matchesText(t,e.text)?3:1:0;if(typeof t==`string`||e.role!==`fragment`&&e.role!==t.role)return 0;let n=this.memo.get(e);n===void 0&&this.memo.set(e,n=/* @__PURE__ */ new Map);let r=n.get(t);if(r!==void 0)return r;let i=2;return i+=e.name===null?1:matchesName(t.name,e.name)?2:0,attrsMatch(t,e)&&(i+=1),e.url!==null&&matchesText(t.url,e.url)&&(i+=1),i+=this.scoreList(e.children,t.children),n.set(t,i),i}scoreList(e,t){let n=this.align(e,t),r=0;for(let t=0;t<e.length;t++)n[t]!==null&&(r+=this.score(e[t],n[t]));return r}align(e,t){let n=[],r=0;for(let i=0;i<e.length;i++){let a=-1,o=0;for(let n=r;n<t.length;n++){let r=this.score(e[i],t[n]);r>o&&(a=n,o=r)}a<0?n.push(null):(n.push(t[a]),r=a+1)}return n}project(n,r,i,a){if(n.kind===`text`){let t=r;a.push(`${i}- text: ${matchesText(t,n.text)?textRepr(n.text):e(p(t,100))}`);return}let o=r,s=headerMatches(o,n)?templateKey(n):t(o,100),c=this.align(n.children,o.children);if(isInline(n)){let t=c[0],r=n.children[0].text;a.push(t===null?`${i}- ${s}`:`${i}- ${s}: ${matchesText(t,r)?textRepr(r):e(p(t,100))}`);return}if(n.children.length===0&&n.url===null&&n.mode===null){a.push(`${i}- ${s}`);return}a.push(`${i}- ${s}:`);let l=i+` `;n.url!==null&&a.push(`${l}- /url: ${matchesText(o.url,n.url)?textRepr(n.url):e(o.url??``)}`),n.mode!==null&&a.push(`${l}- /children: ${n.mode}`);for(let e=0;e<n.children.length;e++)c[e]!==null&&this.project(n.children[e],c[e],l,a)}};function forEachNode(e,t){t(e);for(let n=0;n<e.children.length;n++){let r=e.children[n];typeof r==`string`?t(r):forEachNode(r,t)}}function closestLines(e,t){let n=new Scorer,r=[];if(t.kind===`role`&&t.role===`fragment`){let i=null,a=0;if(forEachNode(e,e=>{if(typeof e==`string`)return;let r=n.scoreList(t.children,e.children);r>a&&(i=e,a=r)}),i!==null){let e=n.align(t.children,i.children);for(let i=0;i<t.children.length;i++)e[i]!==null&&n.project(t.children[i],e[i],``,r)}return r}let i=null,a=0;return forEachNode(e,e=>{let r=n.score(t,e);r>a&&(i=e,a=r)}),i!==null&&n.project(t,i,``,r),r}function pairChanges(e){let t=[];for(let n=0;n<e.length;){if(e[n].kind===`=`){t.push(e[n++]);continue}let r=n;for(;r<e.length&&e[r].kind===`-`;)r++;let i=r;for(;i<e.length&&e[i].kind===`+`;)i++;if(r-n===i-r)for(let i=0;i<r-n;i++)t.push(e[n+i],e[r+i]);else for(let r=n;r<i;r++)t.push(e[r]);n=i}return t}function matchAriaSnapshot(e,t){let n=parseAriaTemplate(t),i=r(e,{urls:!0}),a=[];for(let e=0;e<i.length;e++){let t=i[e];a.push(typeof t==`string`?normalizeWhitespace(t):toMatchNode(t))}let l={role:`fragment`,name:``,states:/* @__PURE__ */ new Map,url:null,children:a,props:[]},u=matchesDeep(l,n),expectedLines=()=>{let e=[];if(n.kind===`role`&&n.role===`fragment`){n.mode!==null&&e.push(`- /children: ${n.mode}`);for(let t=0;t<n.children.length;t++)renderTemplate(n.children[t],``,e)}else renderTemplate(n,``,e);return e};return{pass:u,expected:()=>expectedLines().join(`
4
+ `),diff:()=>pairChanges(c(expectedLines(),closestLines(l,n))),received:()=>o(e,{collapseAfter:1/0,maxLines:s()??100})}}function resetFailureSnapshot(e){n(e)}function captureFailureSnapshot(e){let t=f(),n=e?.body;if(t===null||n==null||n[h]===void 0)return null;if(t===`compact`){let e=l(n,void 0,{format:`compact`});return{format:t,text:String(e),full:``,previous:void 0}}let r=a(e),{lines:o,empty:c}=d(n),u=c??o.join(`
5
+ `);return{format:t,text:c??i(o,s()??100).join(`
6
+ `),full:u,previous:r}}function formatFailureSnapshot(e,t){if(e.format===`compact`)return`DOM of <body> when the test failed (CTRL_DOM_DEBUG=compact):\n${e.text}`;if(t.includes(e.text))return`Accessibility snapshot of <body> when the test failed: the same as above.`;let n=`Accessibility snapshot of <body> when the test failed (CTRL_DOM_DEBUG=aria):\n${e.text}`;return e.previous!==void 0&&(e.previous===e.full?n+=`
7
7
 
8
- Unchanged since the previous snapshot in this test.`:n+=`\n\nChanges since the previous snapshot in this test:\n${r(l(e.previous,e.full).split(`
8
+ Unchanged since the previous snapshot in this test.`:n+=`\n\nChanges since the previous snapshot in this test:\n${i(u(e.previous,e.full).split(`
9
9
  `),40).join(`
10
10
  `)}`),n}function appendToErrorMessage(e,t){if(typeof e!=`object`||!e)return!1;let n=e,r=typeof n.message==`string`?n.message:``,i;try{i=n.stack}catch{i=void 0}let a=r===``?t:`${r}\n\n${t}`;try{if(n.message=a,typeof i==`string`){let e=r===``?-1:i.indexOf(r);if(e>=0)n.stack=i.slice(0,e)+a+i.slice(e+r.length);else{let e=i.indexOf(`
11
- `);n.stack=e<0?`${i}\n\n${t}`:`${i.slice(0,e)}\n\n${t}${i.slice(e)}`}}}catch{return!1}return!0}export{AriaTemplateError,appendToErrorMessage,captureFailureSnapshot,d as envDebugFormat,formatFailureSnapshot,matchAriaSnapshot,parseAriaTemplate,resetFailureSnapshot};
11
+ `);n.stack=e<0?`${i}\n\n${t}`:`${i.slice(0,e)}\n\n${t}${i.slice(e)}`}}}catch{return!1}return!0}export{AriaTemplateError,appendToErrorMessage,captureFailureSnapshot,f as envDebugFormat,formatFailureSnapshot,matchAriaSnapshot,parseAriaTemplate,resetFailureSnapshot};
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./_chunks/aria-snapshot-diff-DbtSqGLH.cjs");let t=require("@ctrl/dom/internal"),n=require("@ctrl/dom/aria/internal"),r=require("@ctrl/dom/aria"),i=require("node:async_hooks");const a=/* @__PURE__ */ new Set([`button`,`input`,`meter`,`output`,`progress`,`select`,`textarea`]);function isLabelledNodeName(e){return e.prefix===null&&a.has(e.tag===0?(0,t.asciiLowercase)(e.name):e.name)}function buildIdMap(e){let n=/* @__PURE__ */ new Map;for(let r=e.first;r!==null;r=(0,t.nextInTree)(r,e))r.type===t.ELEMENT_NODE&&r.id!==``&&!n.has(r.id)&&n.set(r.id,r);return n}var LabelContext=class{container;containerIds;sameTree;labelMap;constructor(e,t=!1){this.container=e,this.containerIds=null,this.sameTree=t,this.labelMap=null}labelsOf(e){return this.sameTree?(this.labelMap??=(0,n.labelMapForTree)(this.container)).get(e)??o:(0,n.labelsOf)(e)??o}byIdInContainer(e){if(e===``)return null;if(this.containerIds===null){let n=(0,t.indexedDescendantById)(this.container,e);if(n!==void 0)return n;this.containerIds=buildIdMap(this.container)}return this.containerIds.get(e)??null}};const o=[];function getTextContent(e){let n=``;for(let r=e.first;r!==null;r=r.next)r.type===t.TEXT_NODE?n+=r.data:r.first===null||r.type===t.ELEMENT_NODE&&isLabelledNodeName(r)||(n+=getTextContent(r));return n}function getLabelContentImpl(e){if(e.tag===t.T.label&&e.ns===t.HTML_NS)return getTextContent(e);let n=e.node;return n.value||n.textContent}function labelledFormControl(n,r){for(let i=n.first;i!==null;i=(0,t.nextInTree)(i,n))if(i.type===t.ELEMENT_NODE&&a.has(i.name)&&(r===`*`||e.T(i,r)))return i}function getLabelsImpl(e,n,r=`*`){let i=(0,t.ariaAttr)(n,`aria-labelledby`);return i?i.split(` `).map(t=>{let n=e.byIdInContainer(t);return n?{content:getLabelContentImpl(n),formControl:null}:{content:``,formControl:null}}):e.labelsOf(n).map(e=>({content:getLabelContentImpl(e),formControl:labelledFormControl(e,r)}))}function assertNotNullOrUndefined(e){if(e==null)throw Error(`It looks like ${e} was passed instead of a matcher. Did you do something like getByText(${e})?`)}function fuzzyMatches(e,t,n,r){if(typeof e!=`string`)return!1;assertNotNullOrUndefined(n);let i=r(e);return typeof n==`string`||typeof n==`number`?i.toLowerCase().includes(n.toString().toLowerCase()):typeof n==`function`?n(i,t):matchRegExp(n,i)}function matches(e,t,n,r){if(typeof e!=`string`)return!1;assertNotNullOrUndefined(n);let i=r(e);return n instanceof Function?n(i,t):n instanceof RegExp?matchRegExp(n,i):i===String(n)}function isRegExpWhitespace(e){return e<=32?e===32||e>=9&&e<=13:e<160?!1:e===160||e===5760||e>=8192&&e<=8202||e===8232||e===8233||e===8239||e===8287||e===12288||e===65279}function changedByNormalizing(e,t,n){let r=e.length-1,i=!1;for(let a=0;a<=r;a++){let o=e.charCodeAt(a),s=isRegExpWhitespace(o);if(s&&(t&&(a===0||a===r)||n&&(i||o!==32)))return!0;i=s}return!1}const s=/\s+/g;function getDefaultNormalizer({trim:e=!0,collapseWhitespace:t=!0}={}){return n=>{if(!changedByNormalizing(n,e,t))return n;let r=n;return r=e?r.trim():r,r=t?r.replace(s,` `):r,r}}const c=getDefaultNormalizer();function textMatcher(e,t,n){if(!e)return(e,r)=>fuzzyMatches(e,r,t,n);if(n===c&&isPlainRegExp(t)){let e;return n=>typeof n==`string`?n.length===0?e??=t.test(``):t.test(c(n)):!1}if(n!==c||typeof t!=`string`&&typeof t!=`number`)return(e,r)=>matches(e,r,t,n);let r=String(t);if(changedByNormalizing(r,!0,!0))return()=>!1;let i=r.length,a=r.charCodeAt(0),o=r.charCodeAt(i-1);return e=>{if(typeof e!=`string`||e.length<i)return!1;if(i!==0){let t=e.charCodeAt(0);if(t!==a&&!isRegExpWhitespace(t))return!1;let n=e.charCodeAt(e.length-1);if(n!==o&&!isRegExpWhitespace(n))return!1}return c(e)===r}}function resolveNormalizer(e,t,n){if(!n)return e===void 0&&t===void 0?c:getDefaultNormalizer({trim:e,collapseWhitespace:t});if(e!==void 0||t!==void 0)throw Error(`trim and collapseWhitespace are not supported with a normalizer. If you want to use the default trim and collapseWhitespace logic in your normalizer, use "getDefaultNormalizer({trim, collapseWhitespace})" and compose that into your normalizer`);return n}function makeNormalizer({trim:e,collapseWhitespace:t,normalizer:n}){return resolveNormalizer(e,t,n)}const l=RegExp.prototype.exec;function isPlainRegExp(e){return e instanceof RegExp&&!e.global&&!e.sticky&&Object.getPrototypeOf(e)===RegExp.prototype&&!Object.hasOwn(e,`exec`)&&!Object.hasOwn(e,`test`)&&RegExp.prototype.exec===l&&RegExp.prototype.test===u}const u=RegExp.prototype.test;function matchRegExp(e,t){let n=e.test(t);return e.global&&e.lastIndex!==0&&(console.warn(`To match all elements we had to reset the lastIndex of the RegExp because the global flag is enabled. We encourage to remove the global flag from the RegExp.`),e.lastIndex=0),n}function isButtonLikeInput(e){if(e.tag!==t.T.input||e.ns!==t.HTML_NS)return!1;let n=(0,t.attr)(e,`type`);if(n===null)return!1;let r=(0,t.asciiLowercase)(n);return r===`submit`||r===`button`||r===`reset`}function getNodeTextImpl(e){if(isButtonLikeInput(e))return e.node.value;let n=e.first;if(n===null)return``;if(n===e.last)return n.type===t.TEXT_NODE?n.data:``;let r=``;for(let e=n;e!==null;e=e.next)e.type===t.TEXT_NODE&&(r+=e.data);return r}function getNodeText(n){let r=e.j(n);return r.type===t.ELEMENT_NODE?getNodeTextImpl(r):n.matches(`input[type=submit], input[type=button], input[type=reset]`)}const d={computedStyleSupportsPseudoElements:!0};function styleOverride(e){return(0,t.getComputedStyleOverride)(e)}function nameOptions(e,t){return t===null?e?d:void 0:{computedStyleSupportsPseudoElements:e,getComputedStyle:t}}const f={implicitRole(e){let t=(0,n.implicitRole)(e);return t===``?null:t},roleMatcher:n.tlRoleMatcher,roleSupportsProp(e,t){return typeof e==`string`&&(0,r.roleSupportsProp)(e,t)},computeAccessibleName(e,t,r){return(0,n.computeAccessibleNameImpl)(e,nameOptions(t,r),5)},computeAccessibleDescription(e,t,r){return(0,n.computeAccessibleDescriptionImpl)(e,nameOptions(t,r),5)},isInaccessible:n.isInaccessibleImpl,isInaccessibleWithStyle:n.isInaccessibleWithStyle,isSubtreeInaccessible:n.isSubtreeInaccessibleImpl};function parentElement(e){let n=e.parent;return n!==null&&n.type===t.ELEMENT_NODE?n:null}function isInaccessibleImpl$1(e){return f.isInaccessible(e)}e.N(isInaccessibleImpl$1,`isInaccessibleImpl`);function isInaccessibleChecked(e){let t=styleOverride(e);return t===null?f.isInaccessible(e):f.isInaccessibleWithStyle(e,t,null)}function isInaccessible(t,r={}){let i=e.j(t),a=r.isSubtreeInaccessible,o=styleOverride(i);if(a===void 0)return o===null?isInaccessibleImpl$1(i):f.isInaccessibleWithStyle(i,o,null);if(o===null?(0,n.isVisibilityHidden)(i):o(t).visibility===`hidden`)return!0;for(let e=i;e!==null;e=parentElement(e))if(a(e.node))return!0;return!1}function getImplicitAriaRolesImpl(e){let t=f.implicitRole(e);return t===null?[]:[t]}function getRoles(n,{hidden:r=!1}={}){let i=e.j(n),a={},o=r===!1?styleOverride(i):null,s=o===null?null:/* @__PURE__ */ new Map,visit=e=>{if(r!==!1||(o===null?isInaccessibleImpl$1(e):f.isInaccessibleWithStyle(e,o,s))===!1){let n=(0,t.attr)(e,`role`),r=n===null?getImplicitAriaRolesImpl(e):n.split(` `).slice(0,1);for(let t of r){let n=a[t];Array.isArray(n)?n.push(e.node):a[t]=[e.node]}}for(let n=e.first;n!==null;n=n.next)n.type===t.ELEMENT_NODE&&visit(n)};return visit(i),a}const p={format:`pretty`};function prettyRoles(t,{hidden:n,includeDescription:r}){let i=getRoles(t,{hidden:n}),a=e.i().computedStyleSupportsPseudoElements,o=styleOverride(e.j(t));return Object.entries(i).filter(([e])=>e!==`generic`).map(([t,n])=>{let i=`-`.repeat(50);return`${t}:\n\n${n.map(t=>{let n=e.j(t),i=`Name "${f.computeAccessibleName(n,a,o)}":\n`,s=e.s(t.cloneNode(!1),void 0,p);return r?`${i}${`Description "${f.computeAccessibleDescription(n,a,o)}":\n`}${s}`:`${i}${s}`}).join(`
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./_chunks/aria-snapshot-diff-DKpjI9CA.cjs");let t=require("@ctrl/dom/internal"),n=require("@ctrl/dom/aria/internal"),r=require("@ctrl/dom/aria"),i=require("node:async_hooks");const a=/* @__PURE__ */ new Set([`button`,`input`,`meter`,`output`,`progress`,`select`,`textarea`]);function isLabelledNodeName(e){return e.prefix===null&&a.has(e.tag===0?(0,t.asciiLowercase)(e.name):e.name)}function buildIdMap(e){let n=/* @__PURE__ */ new Map;for(let r=e.first;r!==null;r=(0,t.nextInTree)(r,e))r.type===t.ELEMENT_NODE&&r.id!==``&&!n.has(r.id)&&n.set(r.id,r);return n}var LabelContext=class{container;containerIds;sameTree;labelMap;constructor(e,t=!1){this.container=e,this.containerIds=null,this.sameTree=t,this.labelMap=null}labelsOf(e){return this.sameTree?(this.labelMap??=(0,n.labelMapForTree)(this.container)).get(e)??o:(0,n.labelsOf)(e)??o}byIdInContainer(e){if(e===``)return null;if(this.containerIds===null){let n=(0,t.indexedDescendantById)(this.container,e);if(n!==void 0)return n;this.containerIds=buildIdMap(this.container)}return this.containerIds.get(e)??null}};const o=[];function getTextContent(e){let n=``;for(let r=e.first;r!==null;r=r.next)r.type===t.TEXT_NODE?n+=r.data:r.first===null||r.type===t.ELEMENT_NODE&&isLabelledNodeName(r)||(n+=getTextContent(r));return n}function getLabelContentImpl(e){if(e.tag===t.T.label&&e.ns===t.HTML_NS)return getTextContent(e);let n=e.node;return n.value||n.textContent}function labelledFormControl(n,r){for(let i=n.first;i!==null;i=(0,t.nextInTree)(i,n))if(i.type===t.ELEMENT_NODE&&a.has(i.name)&&(r===`*`||e.T(i,r)))return i}function getLabelsImpl(e,n,r=`*`){let i=(0,t.ariaAttr)(n,`aria-labelledby`);return i?i.split(` `).map(t=>{let n=e.byIdInContainer(t);return n?{content:getLabelContentImpl(n),formControl:null}:{content:``,formControl:null}}):e.labelsOf(n).map(e=>({content:getLabelContentImpl(e),formControl:labelledFormControl(e,r)}))}function assertNotNullOrUndefined(e){if(e==null)throw Error(`It looks like ${e} was passed instead of a matcher. Did you do something like getByText(${e})?`)}function fuzzyMatches(e,t,n,r){if(typeof e!=`string`)return!1;assertNotNullOrUndefined(n);let i=r(e);return typeof n==`string`||typeof n==`number`?i.toLowerCase().includes(n.toString().toLowerCase()):typeof n==`function`?n(i,t):matchRegExp(n,i)}function matches(e,t,n,r){if(typeof e!=`string`)return!1;assertNotNullOrUndefined(n);let i=r(e);return n instanceof Function?n(i,t):n instanceof RegExp?matchRegExp(n,i):i===String(n)}function isRegExpWhitespace(e){return e<=32?e===32||e>=9&&e<=13:e<160?!1:e===160||e===5760||e>=8192&&e<=8202||e===8232||e===8233||e===8239||e===8287||e===12288||e===65279}function changedByNormalizing(e,t,n){let r=e.length-1,i=!1;for(let a=0;a<=r;a++){let o=e.charCodeAt(a),s=isRegExpWhitespace(o);if(s&&(t&&(a===0||a===r)||n&&(i||o!==32)))return!0;i=s}return!1}const s=/\s+/g;function getDefaultNormalizer({trim:e=!0,collapseWhitespace:t=!0}={}){return n=>{if(!changedByNormalizing(n,e,t))return n;let r=n;return r=e?r.trim():r,r=t?r.replace(s,` `):r,r}}const c=getDefaultNormalizer();function textMatcher(e,t,n){if(!e)return(e,r)=>fuzzyMatches(e,r,t,n);if(n===c&&isPlainRegExp(t)){let e;return n=>typeof n==`string`?n.length===0?e??=t.test(``):t.test(c(n)):!1}if(n!==c||typeof t!=`string`&&typeof t!=`number`)return(e,r)=>matches(e,r,t,n);let r=String(t);if(changedByNormalizing(r,!0,!0))return()=>!1;let i=r.length,a=r.charCodeAt(0),o=r.charCodeAt(i-1);return e=>{if(typeof e!=`string`||e.length<i)return!1;if(i!==0){let t=e.charCodeAt(0);if(t!==a&&!isRegExpWhitespace(t))return!1;let n=e.charCodeAt(e.length-1);if(n!==o&&!isRegExpWhitespace(n))return!1}return c(e)===r}}function resolveNormalizer(e,t,n){if(!n)return e===void 0&&t===void 0?c:getDefaultNormalizer({trim:e,collapseWhitespace:t});if(e!==void 0||t!==void 0)throw Error(`trim and collapseWhitespace are not supported with a normalizer. If you want to use the default trim and collapseWhitespace logic in your normalizer, use "getDefaultNormalizer({trim, collapseWhitespace})" and compose that into your normalizer`);return n}function makeNormalizer({trim:e,collapseWhitespace:t,normalizer:n}){return resolveNormalizer(e,t,n)}const l=RegExp.prototype.exec;function isPlainRegExp(e){return e instanceof RegExp&&!e.global&&!e.sticky&&Object.getPrototypeOf(e)===RegExp.prototype&&!Object.hasOwn(e,`exec`)&&!Object.hasOwn(e,`test`)&&RegExp.prototype.exec===l&&RegExp.prototype.test===u}const u=RegExp.prototype.test;function matchRegExp(e,t){let n=e.test(t);return e.global&&e.lastIndex!==0&&(console.warn(`To match all elements we had to reset the lastIndex of the RegExp because the global flag is enabled. We encourage to remove the global flag from the RegExp.`),e.lastIndex=0),n}function isButtonLikeInput(e){if(e.tag!==t.T.input||e.ns!==t.HTML_NS)return!1;let n=(0,t.attr)(e,`type`);if(n===null)return!1;let r=(0,t.asciiLowercase)(n);return r===`submit`||r===`button`||r===`reset`}function getNodeTextImpl(e){if(isButtonLikeInput(e))return e.node.value;let n=e.first;if(n===null)return``;if(n===e.last)return n.type===t.TEXT_NODE?n.data:``;let r=``;for(let e=n;e!==null;e=e.next)e.type===t.TEXT_NODE&&(r+=e.data);return r}function getNodeText(n){let r=e.j(n);return r.type===t.ELEMENT_NODE?getNodeTextImpl(r):n.matches(`input[type=submit], input[type=button], input[type=reset]`)}const d={computedStyleSupportsPseudoElements:!0};function styleOverride(e){return(0,t.getComputedStyleOverride)(e)}function nameOptions(e,t){return t===null?e?d:void 0:{computedStyleSupportsPseudoElements:e,getComputedStyle:t}}const f={implicitRole(e){let t=(0,n.implicitRole)(e);return t===``?null:t},roleMatcher:n.tlRoleMatcher,roleSupportsProp(e,t){return typeof e==`string`&&(0,r.roleSupportsProp)(e,t)},computeAccessibleName(e,t,r){return(0,n.computeAccessibleNameImpl)(e,nameOptions(t,r),5)},computeAccessibleDescription(e,t,r){return(0,n.computeAccessibleDescriptionImpl)(e,nameOptions(t,r),5)},isInaccessible:n.isInaccessibleImpl,isInaccessibleWithStyle:n.isInaccessibleWithStyle,isSubtreeInaccessible:n.isSubtreeInaccessibleImpl};function parentElement(e){let n=e.parent;return n!==null&&n.type===t.ELEMENT_NODE?n:null}function isInaccessibleImpl$1(e){return f.isInaccessible(e)}e.N(isInaccessibleImpl$1,`isInaccessibleImpl`);function isInaccessibleChecked(e){let t=styleOverride(e);return t===null?f.isInaccessible(e):f.isInaccessibleWithStyle(e,t,null)}function isInaccessible(t,r={}){let i=e.j(t),a=r.isSubtreeInaccessible,o=styleOverride(i);if(a===void 0)return o===null?isInaccessibleImpl$1(i):f.isInaccessibleWithStyle(i,o,null);if(o===null?(0,n.isVisibilityHidden)(i):o(t).visibility===`hidden`)return!0;for(let e=i;e!==null;e=parentElement(e))if(a(e.node))return!0;return!1}function getImplicitAriaRolesImpl(e){let t=f.implicitRole(e);return t===null?[]:[t]}function getRoles(n,{hidden:r=!1}={}){let i=e.j(n),a={},o=r===!1?styleOverride(i):null,s=o===null?null:/* @__PURE__ */ new Map,visit=e=>{if(r!==!1||(o===null?isInaccessibleImpl$1(e):f.isInaccessibleWithStyle(e,o,s))===!1){let n=(0,t.attr)(e,`role`),r=n===null?getImplicitAriaRolesImpl(e):n.split(` `).slice(0,1);for(let t of r){let n=a[t];Array.isArray(n)?n.push(e.node):a[t]=[e.node]}}for(let n=e.first;n!==null;n=n.next)n.type===t.ELEMENT_NODE&&visit(n)};return visit(i),a}const p={format:`pretty`};function prettyRoles(t,{hidden:n,includeDescription:r}){let i=getRoles(t,{hidden:n}),a=e.i().computedStyleSupportsPseudoElements,o=styleOverride(e.j(t));return Object.entries(i).filter(([e])=>e!==`generic`).map(([t,n])=>{let i=`-`.repeat(50);return`${t}:\n\n${n.map(t=>{let n=e.j(t),i=`Name "${f.computeAccessibleName(n,a,o)}":\n`,s=e.s(t.cloneNode(!1),void 0,p);return r?`${i}${`Description "${f.computeAccessibleDescription(n,a,o)}":\n`}${s}`:`${i}${s}`}).join(`
2
2
 
3
3
  `)}\n\n${i}`}).join(`
4
4
  `)}const logRoles=(e,{hidden:t=!1}={})=>console.log(prettyRoles(e,{hidden:t}));function checkBooleanAttribute(e,n){let r=(0,t.attr)(e,n);if(r===`true`)return!0;if(r===`false`)return!1}function computeAriaSelected(e){return e.tag===t.T.option&&e.ns===t.HTML_NS?e.node.selected:checkBooleanAttribute(e,`aria-selected`)}function computeAriaBusy(e){return(0,t.ariaAttr)(e,`aria-busy`)===`true`}function computeAriaChecked(e){let t=e.node;if(!(`indeterminate`in t&&t.indeterminate))return`checked`in t?t.checked:checkBooleanAttribute(e,`aria-checked`)}function computeAriaPressed(e){return checkBooleanAttribute(e,`aria-pressed`)}function computeAriaCurrent(e){return checkBooleanAttribute(e,`aria-current`)??(0,t.ariaAttr)(e,`aria-current`)??!1}function computeAriaExpanded(e){return checkBooleanAttribute(e,`aria-expanded`)}function computeHeadingLevelImpl(e){let n=(0,t.ariaAttr)(e,`aria-level`),r=n&&Number(n);if(r)return r;if(e.ns===t.HTML_NS)switch(e.tag){case t.T.h1:return 1;case t.T.h2:return 2;case t.T.h3:return 3;case t.T.h4:return 4;case t.T.h5:return 5;case t.T.h6:return 6}}function computeAriaValueNow(e){let n=(0,t.ariaAttr)(e,`aria-valuenow`);return n===null?void 0:+n}function computeAriaValueMax(e){let n=(0,t.ariaAttr)(e,`aria-valuemax`);return n===null?void 0:+n}function computeAriaValueMin(e){let n=(0,t.ariaAttr)(e,`aria-valuemin`);return n===null?void 0:+n}function computeAriaValueText(e){let n=(0,t.ariaAttr)(e,`aria-valuetext`);return n===null?void 0:n}const m=getDefaultNormalizer();function escapeRegExp(e){return e.replace(/[.*+\-?^${}()|[\]\\]/g,`\\$&`)}function getRegExpMatcher(e){return new RegExp(escapeRegExp(e.toLowerCase()),`i`)}function makeSuggestion(t,n,r,{variant:i,name:a}){let o=``,s={},c=[[`Role`,`TestId`].includes(t)?r:getRegExpMatcher(r)];a&&(s.name=getRegExpMatcher(a)),t===`Role`&&isInaccessibleChecked(e.j(n))&&(s.hidden=!0,o=`Element is inaccessible. This means that the element and all its children are invisible to screen readers.
@@ -15,7 +15,7 @@ ${t.toString()}
15
15
  `,n)}function makeGetAllQuery(t,n){return(r,...i)=>{let a=t(r,...i);if(!a.length)throw e.i().getElementError(n(r,...i),r);return a}}function makeFindQuery(e,n=`find`){return(r,i,a,o)=>{let find=t=>waitForInSpan(()=>e(r,i,a),{container:r,...o},t);return(0,t.tracing)()?(0,t.tracePromise)(g,(0,t.describeCall)(n,[i,a]),async e=>{let t=await find(e);return e.data.matches=matchCount(t),t}):find(null)}}const g=`testing-library.query`,matchCount=e=>Array.isArray(e)?e.length:+!!e;function traceQuery(e,n){return(r,...i)=>(0,t.tracing)()?(0,t.traceSync)(g,(0,t.describeCall)(e,i),e=>{let t=n(r,...i);return e.data.matches=matchCount(t),t}):n(r,...i)}const wrapSingleQueryWithSuggestion=(e,t,n)=>(r,...i)=>{let a=e(r,...i);if(a&&shouldSuggest(i)){let e=getSuggestedQuery(a,n);if(e&&!t.endsWith(e.queryName))throw getSuggestionError(e.toString(),r)}return a},wrapAllByQueryWithSuggestion=(e,t,n)=>(r,...i)=>{let a=e(r,...i);if(a.length&&shouldSuggest(i)){let e=[...new Set(a.map(e=>getSuggestedQuery(e,n)?.toString()))];if(e.length===1&&!t.endsWith(getSuggestedQuery(a[0],n).queryName))throw getSuggestionError(e[0],r)}return a};function buildQueries(e,t,n){let r=wrapSingleQueryWithSuggestion(makeSingleQuery(e,t),e.name,`query`),i=makeGetAllQuery(e,n),a=makeSingleQuery(i,t),o=wrapSingleQueryWithSuggestion(a,e.name,`get`),s=wrapAllByQueryWithSuggestion(i,e.name.replace(`query`,`get`),`getAll`),c=e.name.startsWith(`queryAll`)?e.name.slice(8):``,l=makeFindQuery(wrapAllByQueryWithSuggestion(i,e.name,`findAll`),`findAll${c}`),u=makeFindQuery(wrapSingleQueryWithSuggestion(a,e.name,`find`),`find${c}`);return[traceQuery(`query${c}`,r),traceQuery(`getAll${c}`,s),traceQuery(`get${c}`,o),l,u]}const _=/* @__PURE__ */ new Set([``,`generic`,`none`,`presentation`]),v=/* @__PURE__ */ e.N(e=>e,`identity`);function normalize(e){return e.replace(/\s+/g,` `).trim()}function similarity(e,t){let n=normalize(e).toLowerCase(),r=normalize(t).toLowerCase();if(n===``||r===``)return-1;if(n===r)return 0;if(n.includes(r)||r.includes(n))return 1;let i=r.split(` `);for(let e=0;e<i.length;e++)if(i[e].length>2&&n.includes(i[e]))return 2;return-1}function closeness(e,t,n,r,i=!0){if((i?matches:fuzzyMatches)(e,t,n,r))return 0;if(typeof n==`string`||typeof n==`number`){let t=similarity(r(e),String(n));return t===-1?-1:t+1}return-1}function line(t,n,r,i,a){let o={role:n,name:r,props:e.v(t,n,!1,i),value:null,url:null,children:[],element:t};return`- ${e._(o,80)} # ${a}`}function format(e,t){if(t.length===0)return``;t.sort((e,t)=>e.rank-t.rank);let n=t.slice(0,10).map(e=>e.line);return t.length>10&&n.push(`# … ${t.length-10} more`),`${e}:\n${n.join(`
16
16
  `)}`}function nameOf(e){return normalize((0,n.computeAccessibleNameImpl)(e,void 0,5))}function roleCandidates(r,i){let a=e.j(r),o=[],s=i.name;for(let r=a.first;r!==null;r=(0,t.nextInTree)(r,a)){if(r.type!==t.ELEMENT_NODE)continue;let a=(0,n.isInaccessibleImpl)(r),c=(0,n.tlRole)(r);if((0,n.tlRoleMatches)(r,i.role,i.queryFallbacks)){let t=nameOf(r),n=s===void 0?0:closeness(t,r.node,s,v),l=i.matchesState(r);n===0&&l?a&&!i.hidden&&o.push({line:line(r,c,t,!0,`hidden: ${e.h(r)} (or pass { hidden: true })`),rank:0}):n===0?o.push({line:line(r,c,t,a&&!i.hidden,`role and name match, state is not ${i.stateHint}`),rank:1}):(!a||i.hidden)&&o.push({line:line(r,c,t,!1,n>0?`similar name`:`same role, other name`),rank:n>0?2+n:10});continue}if(s===void 0)continue;if(!_.has(c)){let e=nameOf(r);if(e===``)continue;let t=closeness(e,r.node,s,v);t>=0&&o.push({line:line(r,c,e,a&&!i.hidden,`same name, role "${c}"`),rank:2+t});continue}let l=normalize(getNodeTextImpl(r));l!==``&&closeness(l,r.node,s,v)===0&&o.push({line:`- text: ${e.y(e.x(l,80))} # in ${e.p(r)}, which has no role: give it role="${i.role}" or use getByText`,rank:2})}return format(`Closest matches`,o)}function roleOrTag(t){let r=(0,n.tlRole)(t);return _.has(r)?e.p(t):r}function textCandidates(n,r,i,a,o,s){if(typeof r==`function`)return``;let c=e.j(n),l=[],u=[];for(let n=c.first;n!==null;n=(0,t.nextInTree)(n,c)){if(n.type!==t.ELEMENT_NODE||o&&typeof o==`string`&&e.T(n,o))continue;let c=getNodeTextImpl(n),d=c.trim()===``?-1:closeness(c,n.node,r,i,s);d===0?l.push({line:`- ${roleOrTag(n)}: ${e.y(e.x(i(c),80))} # matches, but not selector "${a}"`,rank:0}):d>0&&l.push({line:`- ${roleOrTag(n)}: ${e.y(e.x(i(c),80))} # similar text in ${e.p(n)}`,rank:1+d}),d!==0&&n.first!==null&&n.first!==n.last&&(s?matches:fuzzyMatches)(n.node.textContent,n.node,r,i)&&u.push(n)}for(let t=0;t<u.length;t++){let n=u[t],r=!1;for(let e=t+1;e<u.length&&!r;e++)isAncestor(n,u[e])&&(r=!0);r||l.push({line:`- ${roleOrTag(n)}: ${e.y(e.x(i(n.node.textContent),80))} # text split across child elements of ${e.p(n)}: use a function matcher or getByRole`,rank:0})}return format(`Closest matches`,l)}function isAncestor(e,t){for(let n=t.parent;n!==null;n=n.parent)if(n===e)return!0;return!1}const y=/* @__PURE__ */ new Set([`textbox`,`searchbox`,`combobox`,`listbox`,`checkbox`,`radio`,`switch`,`slider`,`spinbutton`]);function labelCandidates(r,i,a,o){if(typeof i==`function`)return``;let s=e.j(r),c=[];for(let r=s.first;r!==null;r=(0,t.nextInTree)(r,s)){if(r.type!==t.ELEMENT_NODE)continue;let s=(0,n.tlRole)(r);if(!y.has(s))continue;let l=nameOf(r),u=(0,n.isInaccessibleImpl)(r);if(l===``){let n=(0,t.attr)(r,`placeholder`),o=n?`no label, placeholder ${e.y(n)}: use getByPlaceholderText or add a <label>`:`no label: add a <label>, aria-label or aria-labelledby`;c.push({line:line(r,s,``,u,o),rank:n&&closeness(n,r.node,i,a)>=0?1:5});continue}let d=closeness(l,r.node,i,a,o);c.push({line:line(r,s,l,u,d>=0?`similar label`:`labelled control`),rank:d>=0?2+d:10})}return format(`Labelled form controls`,c)}function queryAllLabels(n){let r=e.j(n),i=[];for(let e=r.first;e!==null;e=(0,t.nextInTree)(e,r)){if(e.type!==t.ELEMENT_NODE||e.name!==`label`&&e.name!==`input`)continue;let n=getLabelContentImpl(e);n!==null&&i.push({node:e.node,textToMatch:n})}return i}function queryAllLabelsByText(e,t,{exact:n=!0,trim:r,collapseWhitespace:i,normalizer:a}={}){let o=textMatcher(n,t,makeNormalizer({collapseWhitespace:i,trim:r,normalizer:a}));return queryAllLabels(e).filter(({node:e,textToMatch:t})=>o(t,e)).map(({node:e})=>e)}function queryAllByLabelText(r,i,{selector:a=`*`,exact:o=!0,collapseWhitespace:s,trim:c,normalizer:l}=e.E){e.O(r);let u=textMatcher(o,i,resolveNormalizer(c,s,l)),d=e.j(r),f=new LabelContext(d,!0),p=[],m=null;for(let e=d.first;e!==null;e=(0,t.nextInTree)(e,d)){if(e.type!==t.ELEMENT_NODE)continue;(0,t.ariaAttr)(e,`aria-label`)!==null&&(m??=[]).push(e);let r=(0,t.ariaAttr)(e,`aria-labelledby`);(r!==null||(0,n.isLabelable)(e))&&collectLabelled(f,e,r,a,u,p)}if(m!==null)for(let e=0;e<m.length;e++){let n=m[e];u((0,t.ariaAttr)(n,`aria-label`),n.node)&&p.push(n.node)}let h=p.length>1?Array.from(new Set(p)):p;return a===`*`?h:h.filter(n=>e.T(n[t.$impl],a))}function collectLabelled(e,t,n,r,i,a){if(!n){let o=e.labelsOf(t);if(o.length===0&&n===null)return;if(o.length===1){let e=o[0],n=getLabelContentImpl(e),s=labelledFormControl(e,r);s&&i(n,s.node)&&a.push(s.node),i(n,t.node)&&a.push(t.node);return}}else if(!n.includes(` `)){let r=e.byIdInContainer(n);i(`${(r===null?``:getLabelContentImpl(r))||``}`,t.node)&&a.push(t.node);return}let o=getLabelsImpl(e,t,r);for(let e of o){if(!e.formControl)continue;let t=e.formControl.node;i(e.content,t)&&a.push(t)}let s=o.filter(e=>!!e.content).map(e=>e.content),c=t.node;i(s.join(` `),c)&&a.push(c),s.length>1&&s.forEach((e,t)=>{i(e,c)&&a.push(c);let n=[...s];n.splice(t,1),n.length>1&&i(n.join(` `),c)&&a.push(c)})}function getAllByLabelText(t,n,r){let i=queryAllByLabelText(t,n,r);if(!i.length){let i=queryAllLabelsByText(t,n,r);if(i.length){let r=i.map(e=>getTagNameOfElementAssociatedWithLabelViaFor(t,e)).filter(e=>!!e);throw r.length?e.i().getElementError(r.map(e=>`Found a label with the text of: ${n}, however the element associated with this label (<${e} />) is non-labellable [https://html.spec.whatwg.org/multipage/forms.html#category-label]. If you really need to label a <${e} />, you can use aria-label or aria-labelledby instead.`).join(`
17
17
 
18
- `),t):e.i().getElementError(`Found a label with the text of: ${n}, however no form control was found associated to that label. Make sure you're using the "for" attribute or "aria-labelledby" attribute correctly.`,t)}throw e.i().getElementError(withLabelCandidates(`Unable to find a label with the text of: ${n}`,t,n,r),t)}return i}function withLabelCandidates(t,n,r,i={}){if(e.w()===null)return t;let{exact:a=!0,trim:o,collapseWhitespace:s,normalizer:c}=i,l=labelCandidates(n,r,makeNormalizer({trim:o,collapseWhitespace:s,normalizer:c}),a);return l===``?t:`${t}\n\n${l}`}function getTagNameOfElementAssociatedWithLabelViaFor(t,n){let r=n.getAttribute(`for`);if(!r)return null;let i=new LabelContext(e.j(t)).byIdInContainer(r);return i?i.node.tagName.toLowerCase():null}const b=/* @__PURE__ */ e.N((e,t)=>`Found multiple elements with the text of: ${t}`,`getMultipleError`),x=wrapSingleQueryWithSuggestion(makeSingleQuery(queryAllByLabelText,b),queryAllByLabelText.name,`query`),S=makeSingleQuery(getAllByLabelText,b),C=makeFindQuery(wrapAllByQueryWithSuggestion(getAllByLabelText,getAllByLabelText.name,`findAll`)),w=makeFindQuery(wrapSingleQueryWithSuggestion(S,getAllByLabelText.name,`find`)),T=wrapAllByQueryWithSuggestion(getAllByLabelText,getAllByLabelText.name,`getAll`),E=wrapSingleQueryWithSuggestion(S,getAllByLabelText.name,`get`),ee=wrapAllByQueryWithSuggestion(queryAllByLabelText,queryAllByLabelText.name,`queryAll`);function queryAllByPlaceholderText(...t){return e.O(t[0]),queryAllByAttribute(`placeholder`,...t)}const te=/* @__PURE__ */ e.N((e,t)=>`Found multiple elements with the placeholder text of: ${t}`,`getMultipleError`),ne=/* @__PURE__ */ e.N((e,t)=>`Unable to find an element with the placeholder text of: ${t}`,`getMissingError`),re=wrapAllByQueryWithSuggestion(queryAllByPlaceholderText,queryAllByPlaceholderText.name,`queryAll`),[D,O,k,A,j]=buildQueries(queryAllByPlaceholderText,te,ne);function isScriptStyleIgnore(e){return e===`script, style`||e===`script,style`}function isScriptOrStyle(e){if((e.flags&t.F_HTML)!==0)return e.tag===t.T.script||e.tag===t.T.style;let n=e.name;return n===`script`||n===`style`}function isCandidate(t,n,r){return n!==`*`&&!e.T(t,n)?!1:r?isScriptStyleIgnore(r)?!isScriptOrStyle(t):!e.T(t,r):!0}function queryAllByText(n,r,{selector:i=`*`,exact:a=!0,collapseWhitespace:o,trim:s,ignore:c=e.i().defaultIgnore,normalizer:l}=e.E){e.O(n);let u=textMatcher(a,r,resolveNormalizer(s,o,l)),d=e.j(n),f=[];d.type===t.ELEMENT_NODE&&isCandidate(d,i,c)&&u(getNodeTextImpl(d),d.node)&&f.push(d.node);for(let e=d.first;e!==null;e=(0,t.nextInTree)(e,d))e.type===t.ELEMENT_NODE&&isCandidate(e,i,c)&&u(getNodeTextImpl(e),e.node)&&f.push(e.node);return f}const ie=/* @__PURE__ */ e.N((e,t)=>`Found multiple elements with the text: ${t}`,`getMultipleError`),ae=/* @__PURE__ */ e.N((t,n,r={})=>{let{collapseWhitespace:i,trim:a,normalizer:o,selector:s}=r,c=makeNormalizer({collapseWhitespace:i,trim:a,normalizer:o}),l=c(n.toString()),u=l!==n.toString(),d=(s??`*`)!==`*`,f=`Unable to find an element with the text: ${u?`${l} (normalized from '${n}')`:n}${d?`, which matches selector '${s}'`:``}. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.`;if(e.w()===null)return f;let{exact:p=!0,ignore:m=e.i().defaultIgnore}=r,h=textCandidates(t,n,c,s??`*`,m,p);return h===``?f:`${f}\n\n${h}`},`getMissingError`),M=wrapAllByQueryWithSuggestion(queryAllByText,queryAllByText.name,`queryAll`),[N,P,F,I,L]=buildQueries(queryAllByText,ie,ae);function queryAllByDisplayValue(n,r,{exact:i=!0,collapseWhitespace:a,trim:o,normalizer:s}={}){e.O(n);let c=textMatcher(i,r,makeNormalizer({collapseWhitespace:a,trim:o,normalizer:s})),l=e.j(n),u=[];for(let e=l.first;e!==null;e=(0,t.nextInTree)(e,l)){if(e.type!==t.ELEMENT_NODE)continue;let n=e.name;if(n!==`input`&&n!==`textarea`&&n!==`select`)continue;let r=e.node;if(e.tag===t.T.select&&e.ns===t.HTML_NS){let e=r.options,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(i.selected&&c(getNodeTextImpl(i[t.$impl]),i)){n=!0;break}}n&&u.push(r)}else c(r.value,r)&&u.push(r)}return u}const oe=/* @__PURE__ */ e.N((e,t)=>`Found multiple elements with the display value: ${t}.`,`getMultipleError`),se=/* @__PURE__ */ e.N((e,t)=>`Unable to find an element with the display value: ${t}.`,`getMissingError`),R=wrapAllByQueryWithSuggestion(queryAllByDisplayValue,queryAllByDisplayValue.name,`queryAll`),[z,B,V,H,U]=buildQueries(queryAllByDisplayValue,oe,se),ce=/^(img|input|area|.+-.+)$/i;function queryAllByAltText(t,n,r={}){return e.O(t),queryAllByAttribute(`alt`,t,n,r).filter(e=>ce.test(e.tagName))}const le=/* @__PURE__ */ e.N((e,t)=>`Found multiple elements with the alt text: ${t}`,`getMultipleError`),ue=/* @__PURE__ */ e.N((e,t)=>`Unable to find an element with the alt text: ${t}`,`getMissingError`),W=wrapAllByQueryWithSuggestion(queryAllByAltText,queryAllByAltText.name,`queryAll`),[G,K,q,de,J]=buildQueries(queryAllByAltText,le,ue);function isSvgTitle(e){let n=e.parent;return(0,t.asciiLowercase)(e.prefix===null?e.name:e.prefix+`:`+e.name)===`title`&&n!==null&&n.type===t.ELEMENT_NODE&&(0,t.asciiLowercase)(n.prefix===null?n.name:n.prefix+`:`+n.name)===`svg`}function queryAllByTitle(n,r,{exact:i=!0,collapseWhitespace:a,trim:o,normalizer:s}={}){e.O(n);let c=textMatcher(i,r,makeNormalizer({collapseWhitespace:a,trim:o,normalizer:s})),l=e.j(n),u=[];for(let e=l.first;e!==null;e=(0,t.nextInTree)(e,l)){if(e.type!==t.ELEMENT_NODE)continue;let n=e.attrs===null?null:(0,t.attr)(e,`title`),r=e.name===`title`&&e.parent!==null&&e.parent.type===t.ELEMENT_NODE&&e.parent.name===`svg`;(n!==null||r)&&(c(n,e.node)||isSvgTitle(e)&&c(getNodeTextImpl(e),e.node))&&u.push(e.node)}return u}const fe=/* @__PURE__ */ e.N((e,t)=>`Found multiple elements with the title: ${t}.`,`getMultipleError`),pe=/* @__PURE__ */ e.N((e,t)=>`Unable to find an element with the title: ${t}.`,`getMissingError`),Y=wrapAllByQueryWithSuggestion(queryAllByTitle,queryAllByTitle.name,`queryAll`),[me,he,ge,_e,ve]=buildQueries(queryAllByTitle,fe,pe),identity=e=>e;function assertSupported(e,t){if(!f.roleSupportsProp(e,t))throw Error(`"${t}" is not supported on role "${e}".`)}function queryAllByRole(n,r,{hidden:i=e.i().defaultHidden,name:a,description:o,queryFallbacks:s=!1,selected:c,busy:l,checked:u,pressed:d,current:p,level:m,expanded:h,value:{now:g,min:_,max:v,text:y}=e.E}=e.E){if(e.O(n),c!==void 0&&assertSupported(r,`aria-selected`),l!==void 0&&assertSupported(r,`aria-busy`),u!==void 0&&assertSupported(r,`aria-checked`),d!==void 0&&assertSupported(r,`aria-pressed`),p!==void 0&&assertSupported(r,`aria-current`),m!==void 0&&r!==`heading`)throw Error(`Role "${r}" cannot have "level" property.`);g!==void 0&&assertSupported(r,`aria-valuenow`),v!==void 0&&assertSupported(r,`aria-valuemax`),_!==void 0&&assertSupported(r,`aria-valuemin`),y!==void 0&&assertSupported(r,`aria-valuetext`),h!==void 0&&assertSupported(r,`aria-expanded`);let b={selected:c,busy:l,checked:u,pressed:d,current:p,level:m,expanded:h,valueNow:g,valueMin:_,valueMax:v,valueText:y},x=e.i().computedStyleSupportsPseudoElements,S=e.j(n),C=[],w=styleOverride(S),T=w!==null&&i===!1?/* @__PURE__ */ new Map:null,E=f.roleMatcher(r,s);for(let e=S.first;e!==null;e=(0,t.nextInTree)(e,S))e.type===t.ELEMENT_NODE&&E(e)&&matchesState(e,b)&&(i===!1&&(w===null?isInaccessibleImpl$1(e):f.isInaccessibleWithStyle(e,w,T))||(a===void 0||matches(f.computeAccessibleName(e,x,w),e.node,a,identity))&&(o===void 0||matches(f.computeAccessibleDescription(e,x,w),e.node,o,identity))&&C.push(e.node));return C}function matchesState(e,t){if(t.selected!==void 0)return t.selected===computeAriaSelected(e);if(t.busy!==void 0)return t.busy===computeAriaBusy(e);if(t.checked!==void 0)return t.checked===computeAriaChecked(e);if(t.pressed!==void 0)return t.pressed===computeAriaPressed(e);if(t.current!==void 0)return t.current===computeAriaCurrent(e);if(t.expanded!==void 0)return t.expanded===computeAriaExpanded(e);if(t.level!==void 0)return t.level===computeHeadingLevelImpl(e);if(t.valueNow!==void 0||t.valueMax!==void 0||t.valueMin!==void 0||t.valueText!==void 0){let n=!0;return t.valueNow!==void 0&&(n&&=t.valueNow===computeAriaValueNow(e)),t.valueMax!==void 0&&(n&&=t.valueMax===computeAriaValueMax(e)),t.valueMin!==void 0&&(n&&=t.valueMin===computeAriaValueMin(e)),t.valueText!==void 0&&(n&&=matches(computeAriaValueText(e)??null,e.node,t.valueText,identity)),n}return!0}const getNameHint=e=>{let t=``;return t=e===void 0?``:typeof e==`string`?` and name "${e}"`:` and name \`${e}\``,t},ye=/* @__PURE__ */ e.N((e,t,{name:n}={})=>`Found multiple elements with the role "${t}"${getNameHint(n)}`,`getMultipleError`),be=/* @__PURE__ */ e.N((t,n,r={})=>{let{hidden:i=e.i().defaultHidden,name:a,description:o}=r;if(e.w()!==null)return agentMissingError(t,n,r,i);if(e.i()._disableExpensiveErrorDiagnostics)return`Unable to find role="${n}"${getNameHint(a)}`;let s=``;Array.from(t.children).forEach(e=>{s+=prettyRoles(e,{hidden:i,includeDescription:o!==void 0})});let c;c=s.length===0?i===!1?"There are no accessible roles. But there might be some inaccessible roles. If you wish to access them, then set the `hidden` option to `true`. Learn more about this here: https://testing-library.com/docs/dom-testing-library/api-queries#byrole":`There are no available roles.`:`
18
+ `),t):e.i().getElementError(`Found a label with the text of: ${n}, however no form control was found associated to that label. Make sure you're using the "for" attribute or "aria-labelledby" attribute correctly.`,t)}throw e.i().getElementError(withLabelCandidates(`Unable to find a label with the text of: ${n}`,t,n,r),t)}return i}function withLabelCandidates(t,n,r,i={}){if(e.w()===null)return t;let{exact:a=!0,trim:o,collapseWhitespace:s,normalizer:c}=i,l=labelCandidates(n,r,makeNormalizer({trim:o,collapseWhitespace:s,normalizer:c}),a);return l===``?t:`${t}\n\n${l}`}function getTagNameOfElementAssociatedWithLabelViaFor(t,n){let r=n.getAttribute(`for`);if(!r)return null;let i=new LabelContext(e.j(t)).byIdInContainer(r);return i?i.node.tagName.toLowerCase():null}const b=/* @__PURE__ */ e.N((e,t)=>`Found multiple elements with the text of: ${t}`,`getMultipleError`),x=wrapSingleQueryWithSuggestion(makeSingleQuery(queryAllByLabelText,b),queryAllByLabelText.name,`query`),S=makeSingleQuery(getAllByLabelText,b),C=makeFindQuery(wrapAllByQueryWithSuggestion(getAllByLabelText,getAllByLabelText.name,`findAll`)),w=makeFindQuery(wrapSingleQueryWithSuggestion(S,getAllByLabelText.name,`find`)),T=wrapAllByQueryWithSuggestion(getAllByLabelText,getAllByLabelText.name,`getAll`),E=wrapSingleQueryWithSuggestion(S,getAllByLabelText.name,`get`),ee=wrapAllByQueryWithSuggestion(queryAllByLabelText,queryAllByLabelText.name,`queryAll`);function queryAllByPlaceholderText(...t){return e.O(t[0]),queryAllByAttribute(`placeholder`,...t)}const te=/* @__PURE__ */ e.N((e,t)=>`Found multiple elements with the placeholder text of: ${t}`,`getMultipleError`),ne=/* @__PURE__ */ e.N((e,t)=>`Unable to find an element with the placeholder text of: ${t}`,`getMissingError`),re=wrapAllByQueryWithSuggestion(queryAllByPlaceholderText,queryAllByPlaceholderText.name,`queryAll`),[ie,D,O,k,A]=buildQueries(queryAllByPlaceholderText,te,ne);function isScriptStyleIgnore(e){return e===`script, style`||e===`script,style`}function isScriptOrStyle(e){if((e.flags&t.F_HTML)!==0)return e.tag===t.T.script||e.tag===t.T.style;let n=e.name;return n===`script`||n===`style`}function isCandidate(t,n,r){return n!==`*`&&!e.T(t,n)?!1:r?isScriptStyleIgnore(r)?!isScriptOrStyle(t):!e.T(t,r):!0}function queryAllByText(n,r,{selector:i=`*`,exact:a=!0,collapseWhitespace:o,trim:s,ignore:c=e.i().defaultIgnore,normalizer:l}=e.E){e.O(n);let u=textMatcher(a,r,resolveNormalizer(s,o,l)),d=e.j(n),f=[];d.type===t.ELEMENT_NODE&&isCandidate(d,i,c)&&u(getNodeTextImpl(d),d.node)&&f.push(d.node);for(let e=d.first;e!==null;e=(0,t.nextInTree)(e,d))e.type===t.ELEMENT_NODE&&isCandidate(e,i,c)&&u(getNodeTextImpl(e),e.node)&&f.push(e.node);return f}const ae=/* @__PURE__ */ e.N((e,t)=>`Found multiple elements with the text: ${t}`,`getMultipleError`),oe=/* @__PURE__ */ e.N((t,n,r={})=>{let{collapseWhitespace:i,trim:a,normalizer:o,selector:s}=r,c=makeNormalizer({collapseWhitespace:i,trim:a,normalizer:o}),l=c(n.toString()),u=l!==n.toString(),d=(s??`*`)!==`*`,f=`Unable to find an element with the text: ${u?`${l} (normalized from '${n}')`:n}${d?`, which matches selector '${s}'`:``}. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.`;if(e.w()===null)return f;let{exact:p=!0,ignore:m=e.i().defaultIgnore}=r,h=textCandidates(t,n,c,s??`*`,m,p);return h===``?f:`${f}\n\n${h}`},`getMissingError`),j=wrapAllByQueryWithSuggestion(queryAllByText,queryAllByText.name,`queryAll`),[M,N,P,F,I]=buildQueries(queryAllByText,ae,oe);function queryAllByDisplayValue(n,r,{exact:i=!0,collapseWhitespace:a,trim:o,normalizer:s}={}){e.O(n);let c=textMatcher(i,r,makeNormalizer({collapseWhitespace:a,trim:o,normalizer:s})),l=e.j(n),u=[];for(let e=l.first;e!==null;e=(0,t.nextInTree)(e,l)){if(e.type!==t.ELEMENT_NODE)continue;let n=e.name;if(n!==`input`&&n!==`textarea`&&n!==`select`)continue;let r=e.node;if(e.tag===t.T.select&&e.ns===t.HTML_NS){let e=r.options,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(i.selected&&c(getNodeTextImpl(i[t.$impl]),i)){n=!0;break}}n&&u.push(r)}else c(r.value,r)&&u.push(r)}return u}const se=/* @__PURE__ */ e.N((e,t)=>`Found multiple elements with the display value: ${t}.`,`getMultipleError`),ce=/* @__PURE__ */ e.N((e,t)=>`Unable to find an element with the display value: ${t}.`,`getMissingError`),L=wrapAllByQueryWithSuggestion(queryAllByDisplayValue,queryAllByDisplayValue.name,`queryAll`),[R,z,B,V,H]=buildQueries(queryAllByDisplayValue,se,ce),le=/^(img|input|area|.+-.+)$/i;function queryAllByAltText(t,n,r={}){return e.O(t),queryAllByAttribute(`alt`,t,n,r).filter(e=>le.test(e.tagName))}const ue=/* @__PURE__ */ e.N((e,t)=>`Found multiple elements with the alt text: ${t}`,`getMultipleError`),de=/* @__PURE__ */ e.N((e,t)=>`Unable to find an element with the alt text: ${t}`,`getMissingError`),U=wrapAllByQueryWithSuggestion(queryAllByAltText,queryAllByAltText.name,`queryAll`),[W,G,K,q,fe]=buildQueries(queryAllByAltText,ue,de);function isSvgTitle(e){let n=e.parent;return(0,t.asciiLowercase)(e.prefix===null?e.name:e.prefix+`:`+e.name)===`title`&&n!==null&&n.type===t.ELEMENT_NODE&&(0,t.asciiLowercase)(n.prefix===null?n.name:n.prefix+`:`+n.name)===`svg`}function queryAllByTitle(n,r,{exact:i=!0,collapseWhitespace:a,trim:o,normalizer:s}={}){e.O(n);let c=textMatcher(i,r,makeNormalizer({collapseWhitespace:a,trim:o,normalizer:s})),l=e.j(n),u=[];for(let e=l.first;e!==null;e=(0,t.nextInTree)(e,l)){if(e.type!==t.ELEMENT_NODE)continue;let n=e.attrs===null?null:(0,t.attr)(e,`title`),r=e.name===`title`&&e.parent!==null&&e.parent.type===t.ELEMENT_NODE&&e.parent.name===`svg`;(n!==null||r)&&(c(n,e.node)||isSvgTitle(e)&&c(getNodeTextImpl(e),e.node))&&u.push(e.node)}return u}const pe=/* @__PURE__ */ e.N((e,t)=>`Found multiple elements with the title: ${t}.`,`getMultipleError`),me=/* @__PURE__ */ e.N((e,t)=>`Unable to find an element with the title: ${t}.`,`getMissingError`),J=wrapAllByQueryWithSuggestion(queryAllByTitle,queryAllByTitle.name,`queryAll`),[he,ge,_e,ve,ye]=buildQueries(queryAllByTitle,pe,me),identity=e=>e;function assertSupported(e,t){if(!f.roleSupportsProp(e,t))throw Error(`"${t}" is not supported on role "${e}".`)}function queryAllByRole(n,r,{hidden:i=e.i().defaultHidden,name:a,description:o,queryFallbacks:s=!1,selected:c,busy:l,checked:u,pressed:d,current:p,level:m,expanded:h,value:{now:g,min:_,max:v,text:y}=e.E}=e.E){if(e.O(n),c!==void 0&&assertSupported(r,`aria-selected`),l!==void 0&&assertSupported(r,`aria-busy`),u!==void 0&&assertSupported(r,`aria-checked`),d!==void 0&&assertSupported(r,`aria-pressed`),p!==void 0&&assertSupported(r,`aria-current`),m!==void 0&&r!==`heading`)throw Error(`Role "${r}" cannot have "level" property.`);g!==void 0&&assertSupported(r,`aria-valuenow`),v!==void 0&&assertSupported(r,`aria-valuemax`),_!==void 0&&assertSupported(r,`aria-valuemin`),y!==void 0&&assertSupported(r,`aria-valuetext`),h!==void 0&&assertSupported(r,`aria-expanded`);let b={selected:c,busy:l,checked:u,pressed:d,current:p,level:m,expanded:h,valueNow:g,valueMin:_,valueMax:v,valueText:y},x=e.i().computedStyleSupportsPseudoElements,S=e.j(n),C=[],w=styleOverride(S),T=w!==null&&i===!1?/* @__PURE__ */ new Map:null,E=f.roleMatcher(r,s);for(let e=S.first;e!==null;e=(0,t.nextInTree)(e,S))e.type===t.ELEMENT_NODE&&E(e)&&matchesState(e,b)&&(i===!1&&(w===null?isInaccessibleImpl$1(e):f.isInaccessibleWithStyle(e,w,T))||(a===void 0||matches(f.computeAccessibleName(e,x,w),e.node,a,identity))&&(o===void 0||matches(f.computeAccessibleDescription(e,x,w),e.node,o,identity))&&C.push(e.node));return C}function matchesState(e,t){if(t.selected!==void 0)return t.selected===computeAriaSelected(e);if(t.busy!==void 0)return t.busy===computeAriaBusy(e);if(t.checked!==void 0)return t.checked===computeAriaChecked(e);if(t.pressed!==void 0)return t.pressed===computeAriaPressed(e);if(t.current!==void 0)return t.current===computeAriaCurrent(e);if(t.expanded!==void 0)return t.expanded===computeAriaExpanded(e);if(t.level!==void 0)return t.level===computeHeadingLevelImpl(e);if(t.valueNow!==void 0||t.valueMax!==void 0||t.valueMin!==void 0||t.valueText!==void 0){let n=!0;return t.valueNow!==void 0&&(n&&=t.valueNow===computeAriaValueNow(e)),t.valueMax!==void 0&&(n&&=t.valueMax===computeAriaValueMax(e)),t.valueMin!==void 0&&(n&&=t.valueMin===computeAriaValueMin(e)),t.valueText!==void 0&&(n&&=matches(computeAriaValueText(e)??null,e.node,t.valueText,identity)),n}return!0}const getNameHint=e=>{let t=``;return t=e===void 0?``:typeof e==`string`?` and name "${e}"`:` and name \`${e}\``,t},be=/* @__PURE__ */ e.N((e,t,{name:n}={})=>`Found multiple elements with the role "${t}"${getNameHint(n)}`,`getMultipleError`),xe=/* @__PURE__ */ e.N((t,n,r={})=>{let{hidden:i=e.i().defaultHidden,name:a,description:o}=r;if(e.w()!==null)return agentMissingError(t,n,r,i);if(e.i()._disableExpensiveErrorDiagnostics)return`Unable to find role="${n}"${getNameHint(a)}`;let s=``;Array.from(t.children).forEach(e=>{s+=prettyRoles(e,{hidden:i,includeDescription:o!==void 0})});let c;c=s.length===0?i===!1?"There are no accessible roles. But there might be some inaccessible roles. If you wish to access them, then set the `hidden` option to `true`. Learn more about this here: https://testing-library.com/docs/dom-testing-library/api-queries#byrole":`There are no available roles.`:`
19
19
  Here are the ${i===!1?`accessible`:`available`} roles:
20
20
 
21
21
  ${s.replace(/\n/g,`
@@ -25,5 +25,5 @@ Here are the ${i===!1?`accessible`:`available`} roles:
25
25
  `.trim();let l=``;l=a===void 0?``:typeof a==`string`?` and name "${a}"`:` and name \`${a}\``;let u=``;return u=o===void 0?``:typeof o==`string`?` and description "${o}"`:` and description \`${o}\``,`
26
26
  Unable to find an ${i===!1?`accessible `:``}element with the role "${n}"${l}${u}
27
27
 
28
- ${c}`.trim()},`getMissingError`);function agentMissingError(e,t,n,r){let{name:i,description:a,queryFallbacks:o=!1,value:{now:s,min:c,max:l,text:u}={}}=n,{selected:d,busy:f,checked:p,pressed:m,current:h,level:g,expanded:_}=n,v={selected:d,busy:f,checked:p,pressed:m,current:h,level:g,expanded:_,valueNow:s,valueMin:c,valueMax:l,valueText:u},y=Object.entries({selected:d,busy:f,checked:p,pressed:m,current:h,level:g,expanded:_,value:n.value}).filter(([,e])=>e!==void 0).map(([e,t])=>`${e}: ${JSON.stringify(t)}`).join(`, `),b=a===void 0?``:typeof a==`string`?` and description "${a}"`:` and description \`${a}\``,x=`Unable to find an ${r===!1?`accessible `:``}element with the role "${t}"${getNameHint(i)}${b}`,S=roleCandidates(e,{role:String(t),name:i,hidden:r,queryFallbacks:o,matchesState:e=>matchesState(e,v),stateHint:`{ ${y} }`});return S===``?x:`${x}\n\n${S}`}const xe=wrapAllByQueryWithSuggestion(queryAllByRole,queryAllByRole.name,`queryAll`),[Se,Ce,we,Te,Ee]=buildQueries(queryAllByRole,ye,be),getTestIdAttribute=()=>e.i().testIdAttribute;function queryAllByTestId(...t){return e.O(t[0]),queryAllByAttribute(getTestIdAttribute(),...t)}const getMultipleError=(e,t)=>`Found multiple elements by: [${getTestIdAttribute()}="${t}"]`,getMissingError=(e,t)=>`Unable to find an element by: [${getTestIdAttribute()}="${t}"]`,De=wrapAllByQueryWithSuggestion(queryAllByTestId,queryAllByTestId.name,`queryAll`),[Oe,ke,Ae,X,je]=buildQueries(queryAllByTestId,getMultipleError,getMissingError),Z={findAllByLabelText:C,findByLabelText:w,getAllByLabelText:T,getByLabelText:E,queryAllByLabelText:ee,queryByLabelText:x,findAllByPlaceholderText:A,findByPlaceholderText:j,getAllByPlaceholderText:O,getByPlaceholderText:k,queryAllByPlaceholderText:re,queryByPlaceholderText:D,findAllByText:I,findByText:L,getAllByText:P,getByText:F,queryAllByText:M,queryByText:N,findAllByDisplayValue:H,findByDisplayValue:U,getAllByDisplayValue:B,getByDisplayValue:V,queryAllByDisplayValue:R,queryByDisplayValue:z,findAllByAltText:de,findByAltText:J,getAllByAltText:K,getByAltText:q,queryAllByAltText:W,queryByAltText:G,findAllByTitle:_e,findByTitle:ve,getAllByTitle:he,getByTitle:ge,queryAllByTitle:Y,queryByTitle:me,findAllByRole:Te,findByRole:Ee,getAllByRole:Ce,getByRole:we,queryAllByRole:xe,queryByRole:Se,findAllByTestId:X,findByTestId:je,getAllByTestId:ke,getByTestId:Ae,queryAllByTestId:De,queryByTestId:Oe};function getQueriesForElement(e,t=Z,n){if(n===void 0){if(t===Z&&hasDefaultKeys(t))return bindDefaultQueries(t,e);n={}}return Object.keys(t).reduce((n,r)=>(n[r]=t[r].bind(null,e),n),n)}const Me=/* @__PURE__ */ `findAllByLabelText.findByLabelText.getAllByLabelText.getByLabelText.queryAllByLabelText.queryByLabelText.findAllByPlaceholderText.findByPlaceholderText.getAllByPlaceholderText.getByPlaceholderText.queryAllByPlaceholderText.queryByPlaceholderText.findAllByText.findByText.getAllByText.getByText.queryAllByText.queryByText.findAllByDisplayValue.findByDisplayValue.getAllByDisplayValue.getByDisplayValue.queryAllByDisplayValue.queryByDisplayValue.findAllByAltText.findByAltText.getAllByAltText.getByAltText.queryAllByAltText.queryByAltText.findAllByTitle.findByTitle.getAllByTitle.getByTitle.queryAllByTitle.queryByTitle.findAllByRole.findByRole.getAllByRole.getByRole.queryAllByRole.queryByRole.findAllByTestId.findByTestId.getAllByTestId.getByTestId.queryAllByTestId.queryByTestId`.split(`.`);function hasDefaultKeys(e){let t=Object.keys(e);if(t.length!==Me.length)return!1;for(let e=0;e<t.length;e++)if(t[e]!==Me[e])return!1;return!0}function bindDefaultQueries(e,t){return{findAllByLabelText:e.findAllByLabelText.bind(null,t),findByLabelText:e.findByLabelText.bind(null,t),getAllByLabelText:e.getAllByLabelText.bind(null,t),getByLabelText:e.getByLabelText.bind(null,t),queryAllByLabelText:e.queryAllByLabelText.bind(null,t),queryByLabelText:e.queryByLabelText.bind(null,t),findAllByPlaceholderText:e.findAllByPlaceholderText.bind(null,t),findByPlaceholderText:e.findByPlaceholderText.bind(null,t),getAllByPlaceholderText:e.getAllByPlaceholderText.bind(null,t),getByPlaceholderText:e.getByPlaceholderText.bind(null,t),queryAllByPlaceholderText:e.queryAllByPlaceholderText.bind(null,t),queryByPlaceholderText:e.queryByPlaceholderText.bind(null,t),findAllByText:e.findAllByText.bind(null,t),findByText:e.findByText.bind(null,t),getAllByText:e.getAllByText.bind(null,t),getByText:e.getByText.bind(null,t),queryAllByText:e.queryAllByText.bind(null,t),queryByText:e.queryByText.bind(null,t),findAllByDisplayValue:e.findAllByDisplayValue.bind(null,t),findByDisplayValue:e.findByDisplayValue.bind(null,t),getAllByDisplayValue:e.getAllByDisplayValue.bind(null,t),getByDisplayValue:e.getByDisplayValue.bind(null,t),queryAllByDisplayValue:e.queryAllByDisplayValue.bind(null,t),queryByDisplayValue:e.queryByDisplayValue.bind(null,t),findAllByAltText:e.findAllByAltText.bind(null,t),findByAltText:e.findByAltText.bind(null,t),getAllByAltText:e.getAllByAltText.bind(null,t),getByAltText:e.getByAltText.bind(null,t),queryAllByAltText:e.queryAllByAltText.bind(null,t),queryByAltText:e.queryByAltText.bind(null,t),findAllByTitle:e.findAllByTitle.bind(null,t),findByTitle:e.findByTitle.bind(null,t),getAllByTitle:e.getAllByTitle.bind(null,t),getByTitle:e.getByTitle.bind(null,t),queryAllByTitle:e.queryAllByTitle.bind(null,t),queryByTitle:e.queryByTitle.bind(null,t),findAllByRole:e.findAllByRole.bind(null,t),findByRole:e.findByRole.bind(null,t),getAllByRole:e.getAllByRole.bind(null,t),getByRole:e.getByRole.bind(null,t),queryAllByRole:e.queryAllByRole.bind(null,t),queryByRole:e.queryByRole.bind(null,t),findAllByTestId:e.findAllByTestId.bind(null,t),findByTestId:e.findByTestId.bind(null,t),getAllByTestId:e.getAllByTestId.bind(null,t),getByTestId:e.getByTestId.bind(null,t),queryAllByTestId:e.queryAllByTestId.bind(null,t),queryByTestId:e.queryByTestId.bind(null,t)}}const isRemoved=e=>!e||Array.isArray(e)&&!e.length;function initialCheck(e){if(isRemoved(e))throw Error(`The element(s) given to waitForElementToBeRemoved are already removed. waitForElementToBeRemoved requires that the element(s) exist(s) before waiting for removal.`)}async function waitForElementToBeRemoved(callback,e){let t=/* @__PURE__ */ Error(`Timed out in waitForElementToBeRemoved.`);if(typeof callback!=`function`){initialCheck(callback);let e=(Array.isArray(callback)?callback:[callback]).map(e=>{let t=e.parentElement;if(t===null)return()=>null;for(;t.parentElement;)t=t.parentElement;return()=>t.contains(e)?e:null});callback=()=>e.map(e=>e()).filter(Boolean)}let n=callback;return initialCheck(n()),waitFor(()=>{let e;try{e=n()}catch(e){if(e.name===`TestingLibraryElementError`)return;throw e}if(!isRemoved(e))throw t},e)}const Ne={copy:{EventType:`ClipboardEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},cut:{EventType:`ClipboardEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},paste:{EventType:`ClipboardEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},compositionEnd:{EventType:`CompositionEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},compositionStart:{EventType:`CompositionEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},compositionUpdate:{EventType:`CompositionEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},keyDown:{EventType:`KeyboardEvent`,defaultInit:{bubbles:!0,cancelable:!0,charCode:0,composed:!0}},keyPress:{EventType:`KeyboardEvent`,defaultInit:{bubbles:!0,cancelable:!0,charCode:0,composed:!0}},keyUp:{EventType:`KeyboardEvent`,defaultInit:{bubbles:!0,cancelable:!0,charCode:0,composed:!0}},focus:{EventType:`FocusEvent`,defaultInit:{bubbles:!1,cancelable:!1,composed:!0}},blur:{EventType:`FocusEvent`,defaultInit:{bubbles:!1,cancelable:!1,composed:!0}},focusIn:{EventType:`FocusEvent`,defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},focusOut:{EventType:`FocusEvent`,defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},change:{EventType:`Event`,defaultInit:{bubbles:!0,cancelable:!1}},input:{EventType:`InputEvent`,defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},invalid:{EventType:`Event`,defaultInit:{bubbles:!1,cancelable:!0}},submit:{EventType:`Event`,defaultInit:{bubbles:!0,cancelable:!0}},reset:{EventType:`Event`,defaultInit:{bubbles:!0,cancelable:!0}},click:{EventType:`MouseEvent`,defaultInit:{bubbles:!0,cancelable:!0,button:0,composed:!0}},contextMenu:{EventType:`MouseEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},dblClick:{EventType:`MouseEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},drag:{EventType:`DragEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},dragEnd:{EventType:`DragEvent`,defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},dragEnter:{EventType:`DragEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},dragExit:{EventType:`DragEvent`,defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},dragLeave:{EventType:`DragEvent`,defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},dragOver:{EventType:`DragEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},dragStart:{EventType:`DragEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},drop:{EventType:`DragEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},mouseDown:{EventType:`MouseEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},mouseEnter:{EventType:`MouseEvent`,defaultInit:{bubbles:!1,cancelable:!1,composed:!0}},mouseLeave:{EventType:`MouseEvent`,defaultInit:{bubbles:!1,cancelable:!1,composed:!0}},mouseMove:{EventType:`MouseEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},mouseOut:{EventType:`MouseEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},mouseOver:{EventType:`MouseEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},mouseUp:{EventType:`MouseEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},select:{EventType:`Event`,defaultInit:{bubbles:!0,cancelable:!1}},touchCancel:{EventType:`TouchEvent`,defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},touchEnd:{EventType:`TouchEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},touchMove:{EventType:`TouchEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},touchStart:{EventType:`TouchEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},resize:{EventType:`UIEvent`,defaultInit:{bubbles:!1,cancelable:!1}},scroll:{EventType:`UIEvent`,defaultInit:{bubbles:!1,cancelable:!1}},wheel:{EventType:`WheelEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},abort:{EventType:`Event`,defaultInit:{bubbles:!1,cancelable:!1}},canPlay:{EventType:`Event`,defaultInit:{bubbles:!1,cancelable:!1}},canPlayThrough:{EventType:`Event`,defaultInit:{bubbles:!1,cancelable:!1}},durationChange:{EventType:`Event`,defaultInit:{bubbles:!1,cancelable:!1}},emptied:{EventType:`Event`,defaultInit:{bubbles:!1,cancelable:!1}},encrypted:{EventType:`Event`,defaultInit:{bubbles:!1,cancelable:!1}},ended:{EventType:`Event`,defaultInit:{bubbles:!1,cancelable:!1}},loadedData:{EventType:`Event`,defaultInit:{bubbles:!1,cancelable:!1}},loadedMetadata:{EventType:`Event`,defaultInit:{bubbles:!1,cancelable:!1}},loadStart:{EventType:`ProgressEvent`,defaultInit:{bubbles:!1,cancelable:!1}},pause:{EventType:`Event`,defaultInit:{bubbles:!1,cancelable:!1}},play:{EventType:`Event`,defaultInit:{bubbles:!1,cancelable:!1}},playing:{EventType:`Event`,defaultInit:{bubbles:!1,cancelable:!1}},progress:{EventType:`ProgressEvent`,defaultInit:{bubbles:!1,cancelable:!1}},rateChange:{EventType:`Event`,defaultInit:{bubbles:!1,cancelable:!1}},seeked:{EventType:`Event`,defaultInit:{bubbles:!1,cancelable:!1}},seeking:{EventType:`Event`,defaultInit:{bubbles:!1,cancelable:!1}},stalled:{EventType:`Event`,defaultInit:{bubbles:!1,cancelable:!1}},suspend:{EventType:`Event`,defaultInit:{bubbles:!1,cancelable:!1}},timeUpdate:{EventType:`Event`,defaultInit:{bubbles:!1,cancelable:!1}},volumeChange:{EventType:`Event`,defaultInit:{bubbles:!1,cancelable:!1}},waiting:{EventType:`Event`,defaultInit:{bubbles:!1,cancelable:!1}},load:{EventType:`Event`,defaultInit:{bubbles:!1,cancelable:!1}},error:{EventType:`Event`,defaultInit:{bubbles:!1,cancelable:!1}},animationStart:{EventType:`AnimationEvent`,defaultInit:{bubbles:!0,cancelable:!1}},animationEnd:{EventType:`AnimationEvent`,defaultInit:{bubbles:!0,cancelable:!1}},animationIteration:{EventType:`AnimationEvent`,defaultInit:{bubbles:!0,cancelable:!1}},transitionCancel:{EventType:`TransitionEvent`,defaultInit:{bubbles:!0,cancelable:!1}},transitionEnd:{EventType:`TransitionEvent`,defaultInit:{bubbles:!0,cancelable:!0}},transitionRun:{EventType:`TransitionEvent`,defaultInit:{bubbles:!0,cancelable:!1}},transitionStart:{EventType:`TransitionEvent`,defaultInit:{bubbles:!0,cancelable:!1}},pointerOver:{EventType:`PointerEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},pointerEnter:{EventType:`PointerEvent`,defaultInit:{bubbles:!1,cancelable:!1}},pointerDown:{EventType:`PointerEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},pointerMove:{EventType:`PointerEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},pointerUp:{EventType:`PointerEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},pointerCancel:{EventType:`PointerEvent`,defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},pointerOut:{EventType:`PointerEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},pointerLeave:{EventType:`PointerEvent`,defaultInit:{bubbles:!1,cancelable:!1}},gotPointerCapture:{EventType:`PointerEvent`,defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},lostPointerCapture:{EventType:`PointerEvent`,defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},popState:{EventType:`PopStateEvent`,defaultInit:{bubbles:!0,cancelable:!1}},offline:{EventType:`Event`,defaultInit:{bubbles:!1,cancelable:!1}},online:{EventType:`Event`,defaultInit:{bubbles:!1,cancelable:!1}},pageHide:{EventType:`PageTransitionEvent`,defaultInit:{bubbles:!0,cancelable:!0}},pageShow:{EventType:`PageTransitionEvent`,defaultInit:{bubbles:!0,cancelable:!0}}},Pe={doubleClick:`dblClick`};function fireEvent_(e,n){return(0,t.tracing)()&&n&&e?(0,t.traceSync)(`testing-library.fire_event`,`fireEvent.${n.type}(${(0,t.describeNode)(e)})`,()=>fireEventUntraced(e,n)):fireEventUntraced(e,n)}function fireEventUntraced(t,n){return e.i().eventWrapper(()=>{if(!n)throw Error(`Unable to fire an event - please provide an event object.`);if(!t)throw Error(`Unable to fire a "${n.type}" event - please provide a DOM element.`);return t.dispatchEvent(n)})}function createEvent_(t,n,r,{EventType:i=`Event`,defaultInit:a={}}={}){if(!n)throw Error(`Unable to fire a "${t}" event - please provide a DOM element.`);let o={...a,...r},{target:{value:s,files:c,...l}={}}=o;s!==void 0&&setNativeValue(n,s),c!==void 0&&Object.defineProperty(n,"files",{configurable:!0,enumerable:!0,writable:!0,value:c}),Object.assign(n,l);let u=e.A(n),d=u[i]||u.Event,f;if(typeof d==`function`)f=new d(t,o);else{f=u.document.createEvent(i);let{bubbles:e,cancelable:n,detail:r,...a}=o;f.initEvent(t,e,n,r),Object.keys(a).forEach(e=>{f[e]=a[e]})}return[`dataTransfer`,`clipboardData`].forEach(e=>{let t=o[e];typeof t==`object`&&(typeof u.DataTransfer==`function`?Object.defineProperty(f,e,{value:Object.getOwnPropertyNames(t).reduce((e,n)=>(Object.defineProperty(e,n,{value:t[n]}),e),new u.DataTransfer)}):Object.defineProperty(f,e,{value:t}))}),f}function setNativeValue(e,t){let{set:n}=Object.getOwnPropertyDescriptor(e,`value`)||{},r=Object.getPrototypeOf(e),{set:i}=Object.getOwnPropertyDescriptor(r,`value`)||{};if(i&&n!==i)i.call(e,t);else if(n)n.call(e,t);else throw Error(`The given element does not have a value setter`)}Object.defineProperty(fireEvent_,"name",{value:`fireEvent`}),Object.defineProperty(createEvent_,"name",{value:`createEvent`});const Q=fireEvent_,$=createEvent_;Object.keys(Ne).forEach(e=>{let{EventType:t,defaultInit:n}=Ne[e],r=e.toLowerCase();$[e]=(e,i)=>$(r,e,i,{EventType:t,defaultInit:n}),Q[e]=(t,n)=>Q(t,$[e](t,n))}),Object.keys(Pe).forEach(e=>{let t=Pe[e];Q[e]=(...e)=>Q[t](...e)});const Fe=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$`;var BitWriter=class{out=[];val=0;pos=0;write(e,t){for(let n=0;n<t;n++)this.val=this.val<<1|e&1,this.pos===5?(this.pos=0,this.out.push(Fe.charAt(this.val)),this.val=0):this.pos++,e>>=1}flush(){for(;;){if(this.val<<=1,this.pos===5){this.out.push(Fe.charAt(this.val));break}this.pos++}return this.out.join(``)}};function compressToEncodedURIComponent(e){if(e==null)return``;let t=/* @__PURE__ */ new Map,n=/* @__PURE__ */ new Set,r=new BitWriter,i=``,a=2,o=3,s=2,emit=e=>{if(n.has(e)){let t=e.charCodeAt(0);t<256?(r.write(0,s),r.write(t,8)):(r.write(1,s),r.write(t,16)),a--,a===0&&(a=2**s,s++),n.delete(e)}else r.write(t.get(e),s);a--,a===0&&(a=2**s,s++)};for(let r=0;r<e.length;r++){let a=e.charAt(r);t.has(a)||(t.set(a,o++),n.add(a));let s=i+a;t.has(s)?i=s:(emit(i),t.set(s,o++),i=a)}return i!==``&&emit(i),r.write(2,s),r.flush()}function unindent(e){return e.replace(/[ \t]*[\n][ \t]*/g,`
29
- `)}function encode(e){return compressToEncodedURIComponent(unindent(e))}function getPlaygroundUrl(e){return`https://testing-playground.com/#markup=${encode(e)}`}const debug=(t,n,r)=>Array.isArray(t)?t.forEach(t=>e.o(t,n,r)):e.o(t,n,r),logTestingPlaygroundURL=(t=e.k().body)=>{if(!t||!(`innerHTML`in t)){console.log(`The element you're providing isn't a valid DOM element.`);return}if(!t.innerHTML){console.log(`The provided element doesn't have any children.`);return}let n=getPlaygroundUrl(t.innerHTML);return console.log(`Open this URL in your browser\n\n${n}`),n},Ie={debug,logTestingPlaygroundURL,ariaSnapshot:e.l},Le=typeof document<`u`&&document.body?getQueriesForElement(document.body,Z,Ie):Object.keys(Z).reduce((e,t)=>(e[t]=()=>{throw TypeError(`For queries bound to document.body a global document has to be available... Learn more: https://testing-library.com/s/screen-global-error`)},e),Ie),Re={getElementError,wrapAllByQueryWithSuggestion,wrapSingleQueryWithSuggestion,getMultipleElementsFoundError,queryAllByAttribute,queryByAttribute,makeSingleQuery,makeGetAllQuery,makeFindQuery,buildQueries};exports.ariaSnapshot=e.l,exports.buildQueries=buildQueries,exports.configure=e.r,exports.createEvent=$,exports.diffAriaSnapshots=e.t,exports.findAllByAltText=de,exports.findAllByDisplayValue=H,exports.findAllByLabelText=C,exports.findAllByPlaceholderText=A,exports.findAllByRole=Te,exports.findAllByTestId=X,exports.findAllByText=I,exports.findAllByTitle=_e,exports.findByAltText=J,exports.findByDisplayValue=U,exports.findByLabelText=w,exports.findByPlaceholderText=j,exports.findByRole=Ee,exports.findByTestId=je,exports.findByText=L,exports.findByTitle=ve,exports.fireEvent=Q,exports.getAllByAltText=K,exports.getAllByDisplayValue=B,exports.getAllByLabelText=T,exports.getAllByPlaceholderText=O,exports.getAllByRole=Ce,exports.getAllByTestId=ke,exports.getAllByText=P,exports.getAllByTitle=he,exports.getByAltText=q,exports.getByDisplayValue=V,exports.getByLabelText=E,exports.getByPlaceholderText=k,exports.getByRole=we,exports.getByTestId=Ae,exports.getByText=F,exports.getByTitle=ge,exports.getConfig=e.i,exports.getDefaultNormalizer=getDefaultNormalizer,exports.getElementError=getElementError,exports.getMultipleElementsFoundError=getMultipleElementsFoundError,exports.getNodeText=getNodeText,exports.getQueriesForElement=getQueriesForElement,exports.within=getQueriesForElement,exports.getRoles=getRoles,exports.getSuggestedQuery=getSuggestedQuery,exports.isInaccessible=isInaccessible,exports.logDOM=e.o,exports.logRoles=logRoles,exports.makeFindQuery=makeFindQuery,exports.makeGetAllQuery=makeGetAllQuery,exports.makeSingleQuery=makeSingleQuery,exports.prettyDOM=e.s,exports.prettyFormat=e.c,exports.queries=Z,exports.queryAllByAltText=W,exports.queryAllByAttribute=queryAllByAttribute,exports.queryAllByDisplayValue=R,exports.queryAllByLabelText=ee,exports.queryAllByPlaceholderText=re,exports.queryAllByRole=xe,exports.queryAllByTestId=De,exports.queryAllByText=M,exports.queryAllByTitle=Y,exports.queryByAltText=G,exports.queryByAttribute=queryByAttribute,exports.queryByDisplayValue=z,exports.queryByLabelText=x,exports.queryByPlaceholderText=D,exports.queryByRole=Se,exports.queryByTestId=Oe,exports.queryByText=N,exports.queryByTitle=me,exports.queryHelpers=Re,exports.screen=Le,exports.waitFor=waitFor,exports.waitForElementToBeRemoved=waitForElementToBeRemoved,exports.wrapAllByQueryWithSuggestion=wrapAllByQueryWithSuggestion,exports.wrapSingleQueryWithSuggestion=wrapSingleQueryWithSuggestion;
28
+ ${c}`.trim()},`getMissingError`);function agentMissingError(e,t,n,r){let{name:i,description:a,queryFallbacks:o=!1,value:{now:s,min:c,max:l,text:u}={}}=n,{selected:d,busy:f,checked:p,pressed:m,current:h,level:g,expanded:_}=n,v={selected:d,busy:f,checked:p,pressed:m,current:h,level:g,expanded:_,valueNow:s,valueMin:c,valueMax:l,valueText:u},y=Object.entries({selected:d,busy:f,checked:p,pressed:m,current:h,level:g,expanded:_,value:n.value}).filter(([,e])=>e!==void 0).map(([e,t])=>`${e}: ${JSON.stringify(t)}`).join(`, `),b=a===void 0?``:typeof a==`string`?` and description "${a}"`:` and description \`${a}\``,x=`Unable to find an ${r===!1?`accessible `:``}element with the role "${t}"${getNameHint(i)}${b}`,S=roleCandidates(e,{role:String(t),name:i,hidden:r,queryFallbacks:o,matchesState:e=>matchesState(e,v),stateHint:`{ ${y} }`});return S===``?x:`${x}\n\n${S}`}const Se=wrapAllByQueryWithSuggestion(queryAllByRole,queryAllByRole.name,`queryAll`),[Ce,we,Te,Ee,De]=buildQueries(queryAllByRole,be,xe),getTestIdAttribute=()=>e.i().testIdAttribute;function queryAllByTestId(...t){return e.O(t[0]),queryAllByAttribute(getTestIdAttribute(),...t)}const getMultipleError=(e,t)=>`Found multiple elements by: [${getTestIdAttribute()}="${t}"]`,getMissingError=(e,t)=>`Unable to find an element by: [${getTestIdAttribute()}="${t}"]`,Oe=wrapAllByQueryWithSuggestion(queryAllByTestId,queryAllByTestId.name,`queryAll`),[ke,Ae,je,Y,Me]=buildQueries(queryAllByTestId,getMultipleError,getMissingError),X={findAllByLabelText:C,findByLabelText:w,getAllByLabelText:T,getByLabelText:E,queryAllByLabelText:ee,queryByLabelText:x,findAllByPlaceholderText:k,findByPlaceholderText:A,getAllByPlaceholderText:D,getByPlaceholderText:O,queryAllByPlaceholderText:re,queryByPlaceholderText:ie,findAllByText:F,findByText:I,getAllByText:N,getByText:P,queryAllByText:j,queryByText:M,findAllByDisplayValue:V,findByDisplayValue:H,getAllByDisplayValue:z,getByDisplayValue:B,queryAllByDisplayValue:L,queryByDisplayValue:R,findAllByAltText:q,findByAltText:fe,getAllByAltText:G,getByAltText:K,queryAllByAltText:U,queryByAltText:W,findAllByTitle:ve,findByTitle:ye,getAllByTitle:ge,getByTitle:_e,queryAllByTitle:J,queryByTitle:he,findAllByRole:Ee,findByRole:De,getAllByRole:we,getByRole:Te,queryAllByRole:Se,queryByRole:Ce,findAllByTestId:Y,findByTestId:Me,getAllByTestId:Ae,getByTestId:je,queryAllByTestId:Oe,queryByTestId:ke};function getQueriesForElement(e,t=X,n){if(n===void 0){if(t===X&&hasDefaultKeys(t))return bindDefaultQueries(t,e);n={}}return Object.keys(t).reduce((n,r)=>(n[r]=t[r].bind(null,e),n),n)}const Ne=/* @__PURE__ */ `findAllByLabelText.findByLabelText.getAllByLabelText.getByLabelText.queryAllByLabelText.queryByLabelText.findAllByPlaceholderText.findByPlaceholderText.getAllByPlaceholderText.getByPlaceholderText.queryAllByPlaceholderText.queryByPlaceholderText.findAllByText.findByText.getAllByText.getByText.queryAllByText.queryByText.findAllByDisplayValue.findByDisplayValue.getAllByDisplayValue.getByDisplayValue.queryAllByDisplayValue.queryByDisplayValue.findAllByAltText.findByAltText.getAllByAltText.getByAltText.queryAllByAltText.queryByAltText.findAllByTitle.findByTitle.getAllByTitle.getByTitle.queryAllByTitle.queryByTitle.findAllByRole.findByRole.getAllByRole.getByRole.queryAllByRole.queryByRole.findAllByTestId.findByTestId.getAllByTestId.getByTestId.queryAllByTestId.queryByTestId`.split(`.`);function hasDefaultKeys(e){let t=Object.keys(e);if(t.length!==Ne.length)return!1;for(let e=0;e<t.length;e++)if(t[e]!==Ne[e])return!1;return!0}function bindDefaultQueries(e,t){return{findAllByLabelText:e.findAllByLabelText.bind(null,t),findByLabelText:e.findByLabelText.bind(null,t),getAllByLabelText:e.getAllByLabelText.bind(null,t),getByLabelText:e.getByLabelText.bind(null,t),queryAllByLabelText:e.queryAllByLabelText.bind(null,t),queryByLabelText:e.queryByLabelText.bind(null,t),findAllByPlaceholderText:e.findAllByPlaceholderText.bind(null,t),findByPlaceholderText:e.findByPlaceholderText.bind(null,t),getAllByPlaceholderText:e.getAllByPlaceholderText.bind(null,t),getByPlaceholderText:e.getByPlaceholderText.bind(null,t),queryAllByPlaceholderText:e.queryAllByPlaceholderText.bind(null,t),queryByPlaceholderText:e.queryByPlaceholderText.bind(null,t),findAllByText:e.findAllByText.bind(null,t),findByText:e.findByText.bind(null,t),getAllByText:e.getAllByText.bind(null,t),getByText:e.getByText.bind(null,t),queryAllByText:e.queryAllByText.bind(null,t),queryByText:e.queryByText.bind(null,t),findAllByDisplayValue:e.findAllByDisplayValue.bind(null,t),findByDisplayValue:e.findByDisplayValue.bind(null,t),getAllByDisplayValue:e.getAllByDisplayValue.bind(null,t),getByDisplayValue:e.getByDisplayValue.bind(null,t),queryAllByDisplayValue:e.queryAllByDisplayValue.bind(null,t),queryByDisplayValue:e.queryByDisplayValue.bind(null,t),findAllByAltText:e.findAllByAltText.bind(null,t),findByAltText:e.findByAltText.bind(null,t),getAllByAltText:e.getAllByAltText.bind(null,t),getByAltText:e.getByAltText.bind(null,t),queryAllByAltText:e.queryAllByAltText.bind(null,t),queryByAltText:e.queryByAltText.bind(null,t),findAllByTitle:e.findAllByTitle.bind(null,t),findByTitle:e.findByTitle.bind(null,t),getAllByTitle:e.getAllByTitle.bind(null,t),getByTitle:e.getByTitle.bind(null,t),queryAllByTitle:e.queryAllByTitle.bind(null,t),queryByTitle:e.queryByTitle.bind(null,t),findAllByRole:e.findAllByRole.bind(null,t),findByRole:e.findByRole.bind(null,t),getAllByRole:e.getAllByRole.bind(null,t),getByRole:e.getByRole.bind(null,t),queryAllByRole:e.queryAllByRole.bind(null,t),queryByRole:e.queryByRole.bind(null,t),findAllByTestId:e.findAllByTestId.bind(null,t),findByTestId:e.findByTestId.bind(null,t),getAllByTestId:e.getAllByTestId.bind(null,t),getByTestId:e.getByTestId.bind(null,t),queryAllByTestId:e.queryAllByTestId.bind(null,t),queryByTestId:e.queryByTestId.bind(null,t)}}const isRemoved=e=>!e||Array.isArray(e)&&!e.length;function initialCheck(e){if(isRemoved(e))throw Error(`The element(s) given to waitForElementToBeRemoved are already removed. waitForElementToBeRemoved requires that the element(s) exist(s) before waiting for removal.`)}async function waitForElementToBeRemoved(callback,e){let t=/* @__PURE__ */ Error(`Timed out in waitForElementToBeRemoved.`);if(typeof callback!=`function`){initialCheck(callback);let e=(Array.isArray(callback)?callback:[callback]).map(e=>{let t=e.parentElement;if(t===null)return()=>null;for(;t.parentElement;)t=t.parentElement;return()=>t.contains(e)?e:null});callback=()=>e.map(e=>e()).filter(Boolean)}let n=callback;return initialCheck(n()),waitFor(()=>{let e;try{e=n()}catch(e){if(e.name===`TestingLibraryElementError`)return;throw e}if(!isRemoved(e))throw t},e)}const Pe=[[`ClipboardEvent`,7,`copy cut paste`],[`CompositionEvent`,7,`compositionEnd compositionStart compositionUpdate`],[`KeyboardEvent`,15,`keyDown keyPress keyUp`],[`FocusEvent`,4,`focus blur`],[`FocusEvent`,5,`focusIn focusOut`],[`Event`,1,`change`],[`InputEvent`,5,`input`],[`Event`,2,`invalid`],[`Event`,3,`submit reset`],[`MouseEvent`,23,`click`],[`MouseEvent`,7,`contextMenu dblClick`],[`DragEvent`,7,`drag`],[`DragEvent`,5,`dragEnd`],[`DragEvent`,7,`dragEnter`],[`DragEvent`,5,`dragExit dragLeave`],[`DragEvent`,7,`dragOver dragStart drop`],[`MouseEvent`,7,`mouseDown`],[`MouseEvent`,4,`mouseEnter mouseLeave`],[`MouseEvent`,7,`mouseMove mouseOut mouseOver mouseUp`],[`Event`,1,`select`],[`TouchEvent`,5,`touchCancel`],[`TouchEvent`,7,`touchEnd touchMove touchStart`],[`UIEvent`,0,`resize scroll`],[`WheelEvent`,7,`wheel`],[`Event`,0,`abort canPlay canPlayThrough durationChange emptied encrypted ended loadedData loadedMetadata`],[`ProgressEvent`,0,`loadStart`],[`Event`,0,`pause play playing`],[`ProgressEvent`,0,`progress`],[`Event`,0,`rateChange seeked seeking stalled suspend timeUpdate volumeChange waiting`],[`Event`,0,`load error`],[`AnimationEvent`,1,`animationStart animationEnd animationIteration`],[`TransitionEvent`,1,`transitionCancel`],[`TransitionEvent`,3,`transitionEnd`],[`TransitionEvent`,1,`transitionRun transitionStart`],[`PointerEvent`,7,`pointerOver`],[`PointerEvent`,0,`pointerEnter`],[`PointerEvent`,7,`pointerDown pointerMove pointerUp`],[`PointerEvent`,5,`pointerCancel`],[`PointerEvent`,7,`pointerOut`],[`PointerEvent`,0,`pointerLeave`],[`PointerEvent`,5,`gotPointerCapture lostPointerCapture`],[`PopStateEvent`,1,`popState`],[`Event`,0,`offline online`],[`PageTransitionEvent`,3,`pageHide pageShow`]],Z={};for(let[e,t,n]of Pe)for(let r of n.split(` `)){let n={bubbles:!!(t&1),cancelable:!!(t&2)};t&8&&(n.charCode=0),t&16&&(n.button=0),t&4&&(n.composed=!0),Z[r]={EventType:e,defaultInit:n}}const Fe={doubleClick:`dblClick`};function fireEvent_(e,n){return(0,t.tracing)()&&n&&e?(0,t.traceSync)(`testing-library.fire_event`,`fireEvent.${n.type}(${(0,t.describeNode)(e)})`,()=>fireEventUntraced(e,n)):fireEventUntraced(e,n)}function fireEventUntraced(t,n){return e.i().eventWrapper(()=>{if(!n)throw Error(`Unable to fire an event - please provide an event object.`);if(!t)throw Error(`Unable to fire a "${n.type}" event - please provide a DOM element.`);return t.dispatchEvent(n)})}function createEvent_(t,n,r,{EventType:i=`Event`,defaultInit:a={}}={}){if(!n)throw Error(`Unable to fire a "${t}" event - please provide a DOM element.`);let o={...a,...r},{target:{value:s,files:c,...l}={}}=o;s!==void 0&&setNativeValue(n,s),c!==void 0&&Object.defineProperty(n,"files",{configurable:!0,enumerable:!0,writable:!0,value:c}),Object.assign(n,l);let u=e.A(n),d=u[i]||u.Event,f;if(typeof d==`function`)f=new d(t,o);else{f=u.document.createEvent(i);let{bubbles:e,cancelable:n,detail:r,...a}=o;f.initEvent(t,e,n,r),Object.keys(a).forEach(e=>{f[e]=a[e]})}return[`dataTransfer`,`clipboardData`].forEach(e=>{let t=o[e];typeof t==`object`&&(typeof u.DataTransfer==`function`?Object.defineProperty(f,e,{value:Object.getOwnPropertyNames(t).reduce((e,n)=>(Object.defineProperty(e,n,{value:t[n]}),e),new u.DataTransfer)}):Object.defineProperty(f,e,{value:t}))}),f}function setNativeValue(e,t){let{set:n}=Object.getOwnPropertyDescriptor(e,`value`)||{},r=Object.getPrototypeOf(e),{set:i}=Object.getOwnPropertyDescriptor(r,`value`)||{};if(i&&n!==i)i.call(e,t);else if(n)n.call(e,t);else throw Error(`The given element does not have a value setter`)}Object.defineProperty(fireEvent_,"name",{value:`fireEvent`}),Object.defineProperty(createEvent_,"name",{value:`createEvent`});const Q=fireEvent_,$=createEvent_;Object.keys(Z).forEach(e=>{let{EventType:t,defaultInit:n}=Z[e],r=e.toLowerCase();$[e]=(e,i)=>$(r,e,i,{EventType:t,defaultInit:n}),Q[e]=(t,n)=>Q(t,$[e](t,n))}),Object.keys(Fe).forEach(e=>{let t=Fe[e];Q[e]=(...e)=>Q[t](...e)});const Ie=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$`;var BitWriter=class{out=[];val=0;pos=0;write(e,t){for(let n=0;n<t;n++)this.val=this.val<<1|e&1,this.pos===5?(this.pos=0,this.out.push(Ie.charAt(this.val)),this.val=0):this.pos++,e>>=1}flush(){for(;;){if(this.val<<=1,this.pos===5){this.out.push(Ie.charAt(this.val));break}this.pos++}return this.out.join(``)}};function compressToEncodedURIComponent(e){if(e==null)return``;let t=/* @__PURE__ */ new Map,n=/* @__PURE__ */ new Set,r=new BitWriter,i=``,a=2,o=3,s=2,emit=e=>{if(n.has(e)){let t=e.charCodeAt(0);t<256?(r.write(0,s),r.write(t,8)):(r.write(1,s),r.write(t,16)),a--,a===0&&(a=2**s,s++),n.delete(e)}else r.write(t.get(e),s);a--,a===0&&(a=2**s,s++)};for(let r=0;r<e.length;r++){let a=e.charAt(r);t.has(a)||(t.set(a,o++),n.add(a));let s=i+a;t.has(s)?i=s:(emit(i),t.set(s,o++),i=a)}return i!==``&&emit(i),r.write(2,s),r.flush()}function unindent(e){return e.replace(/[ \t]*[\n][ \t]*/g,`
29
+ `)}function encode(e){return compressToEncodedURIComponent(unindent(e))}function getPlaygroundUrl(e){return`https://testing-playground.com/#markup=${encode(e)}`}const debug=(t,n,r)=>Array.isArray(t)?t.forEach(t=>e.o(t,n,r)):e.o(t,n,r),logTestingPlaygroundURL=(t=e.k().body)=>{if(!t||!(`innerHTML`in t)){console.log(`The element you're providing isn't a valid DOM element.`);return}if(!t.innerHTML){console.log(`The provided element doesn't have any children.`);return}let n=getPlaygroundUrl(t.innerHTML);return console.log(`Open this URL in your browser\n\n${n}`),n},Le={debug,logTestingPlaygroundURL,ariaSnapshot:e.l},Re=typeof document<`u`&&document.body?getQueriesForElement(document.body,X,Le):Object.keys(X).reduce((e,t)=>(e[t]=()=>{throw TypeError(`For queries bound to document.body a global document has to be available... Learn more: https://testing-library.com/s/screen-global-error`)},e),Le),ze={getElementError,wrapAllByQueryWithSuggestion,wrapSingleQueryWithSuggestion,getMultipleElementsFoundError,queryAllByAttribute,queryByAttribute,makeSingleQuery,makeGetAllQuery,makeFindQuery,buildQueries};exports.ariaSnapshot=e.l,exports.buildQueries=buildQueries,exports.configure=e.r,exports.createEvent=$,exports.diffAriaSnapshots=e.t,exports.findAllByAltText=q,exports.findAllByDisplayValue=V,exports.findAllByLabelText=C,exports.findAllByPlaceholderText=k,exports.findAllByRole=Ee,exports.findAllByTestId=Y,exports.findAllByText=F,exports.findAllByTitle=ve,exports.findByAltText=fe,exports.findByDisplayValue=H,exports.findByLabelText=w,exports.findByPlaceholderText=A,exports.findByRole=De,exports.findByTestId=Me,exports.findByText=I,exports.findByTitle=ye,exports.fireEvent=Q,exports.getAllByAltText=G,exports.getAllByDisplayValue=z,exports.getAllByLabelText=T,exports.getAllByPlaceholderText=D,exports.getAllByRole=we,exports.getAllByTestId=Ae,exports.getAllByText=N,exports.getAllByTitle=ge,exports.getByAltText=K,exports.getByDisplayValue=B,exports.getByLabelText=E,exports.getByPlaceholderText=O,exports.getByRole=Te,exports.getByTestId=je,exports.getByText=P,exports.getByTitle=_e,exports.getConfig=e.i,exports.getDefaultNormalizer=getDefaultNormalizer,exports.getElementError=getElementError,exports.getMultipleElementsFoundError=getMultipleElementsFoundError,exports.getNodeText=getNodeText,exports.getQueriesForElement=getQueriesForElement,exports.within=getQueriesForElement,exports.getRoles=getRoles,exports.getSuggestedQuery=getSuggestedQuery,exports.isInaccessible=isInaccessible,exports.logDOM=e.o,exports.logRoles=logRoles,exports.makeFindQuery=makeFindQuery,exports.makeGetAllQuery=makeGetAllQuery,exports.makeSingleQuery=makeSingleQuery,exports.prettyDOM=e.s,exports.prettyFormat=e.c,exports.queries=X,exports.queryAllByAltText=U,exports.queryAllByAttribute=queryAllByAttribute,exports.queryAllByDisplayValue=L,exports.queryAllByLabelText=ee,exports.queryAllByPlaceholderText=re,exports.queryAllByRole=Se,exports.queryAllByTestId=Oe,exports.queryAllByText=j,exports.queryAllByTitle=J,exports.queryByAltText=W,exports.queryByAttribute=queryByAttribute,exports.queryByDisplayValue=R,exports.queryByLabelText=x,exports.queryByPlaceholderText=ie,exports.queryByRole=Ce,exports.queryByTestId=ke,exports.queryByText=M,exports.queryByTitle=he,exports.queryHelpers=ze,exports.screen=Re,exports.waitFor=waitFor,exports.waitForElementToBeRemoved=waitForElementToBeRemoved,exports.wrapAllByQueryWithSuggestion=wrapAllByQueryWithSuggestion,exports.wrapSingleQueryWithSuggestion=wrapSingleQueryWithSuggestion;