{"version":3,"file":"accessible-description.js","names":["_accessibleNameAndDescription","require","_util","_typeof","o","Symbol","iterator","constructor","prototype","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","obj","key","value","_toPropertyKey","configurable","writable","arg","_toPrimitive","String","input","hint","prim","toPrimitive","undefined","res","call","TypeError","Number","computeAccessibleDescription","root","options","description","queryIdRefs","map","element","computeTextAlternative","compute","join","ariaDescription","getAttribute","title"],"sources":["../sources/accessible-description.ts"],"sourcesContent":["import {\n\tcomputeTextAlternative,\n\tComputeTextAlternativeOptions,\n} from \"./accessible-name-and-description\";\nimport { queryIdRefs } from \"./util\";\n\n/**\n * @param root\n * @param options\n * @returns\n */\nexport function computeAccessibleDescription(\n\troot: Element,\n\toptions: ComputeTextAlternativeOptions = {},\n): string {\n\tlet description = queryIdRefs(root, \"aria-describedby\")\n\t\t.map((element) => {\n\t\t\treturn computeTextAlternative(element, {\n\t\t\t\t...options,\n\t\t\t\tcompute: \"description\",\n\t\t\t});\n\t\t})\n\t\t.join(\" \");\n\n\t// TODO: Technically we need to make sure that node wasn't used for the accessible name\n\t// This causes `description_1.0_combobox-focusable-manual` to fail\n\n\t// https://w3c.github.io/aria/#aria-description\n\t// mentions that aria-description should only be calculated if aria-describedby didn't provide\n\t// a description\n\tif (description === \"\") {\n\t\tconst ariaDescription = root.getAttribute(\"aria-description\");\n\t\tdescription = ariaDescription === null ? \"\" : ariaDescription;\n\t}\n\n\t// https://www.w3.org/TR/html-aam-1.0/#accessible-name-and-description-computation\n\t// says for so many elements to use the `title` that we assume all elements are considered\n\tif (description === \"\") {\n\t\tconst title = root.getAttribute(\"title\");\n\t\tdescription = title === null ? \"\" : title;\n\t}\n\n\treturn description;\n}\n"],"mappings":";;;;AAAA,IAAAA,6BAAA,GAAAC,OAAA;AAIA,IAAAC,KAAA,GAAAD,OAAA;AAAq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