{"ast":null,"code":"/**\n * Partial implementation https://www.w3.org/TR/wai-aria-1.2/#tree_exclusion\n * which should only be used for elements with a non-presentational role i.e.\n * `role=\"none\"` and `role=\"presentation\"` will not be excluded.\n *\n * Implements aria-hidden semantics (i.e. parent overrides child)\n * Ignores \"Child Presentational: True\" characteristics\n *\n * @param element\n * @param options\n * @returns {boolean} true if excluded, otherwise false\n */\nexport function isInaccessible(element) {\n var _element$ownerDocumen;\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var _options$getComputedS = options.getComputedStyle,\n getComputedStyle = _options$getComputedS === void 0 ? (_element$ownerDocumen = element.ownerDocument.defaultView) === null || _element$ownerDocumen === void 0 ? void 0 : _element$ownerDocumen.getComputedStyle : _options$getComputedS,\n _options$isSubtreeIna = options.isSubtreeInaccessible,\n isSubtreeInaccessibleImpl = _options$isSubtreeIna === void 0 ? isSubtreeInaccessible : _options$isSubtreeIna;\n if (typeof getComputedStyle !== \"function\") {\n throw new TypeError(\"Owner document of the element needs to have an associated window.\");\n }\n // since visibility is inherited we can exit early\n if (getComputedStyle(element).visibility === \"hidden\") {\n return true;\n }\n var currentElement = element;\n while (currentElement) {\n if (isSubtreeInaccessibleImpl(currentElement, {\n getComputedStyle: getComputedStyle\n })) {\n return true;\n }\n currentElement = currentElement.parentElement;\n }\n return false;\n}\n/**\n *\n * @param element\n * @param options\n * @returns {boolean} - `true` if every child of the element is inaccessible\n */\nexport function isSubtreeInaccessible(element) {\n var _element$ownerDocumen2;\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var _options$getComputedS2 = options.getComputedStyle,\n getComputedStyle = _options$getComputedS2 === void 0 ? (_element$ownerDocumen2 = element.ownerDocument.defaultView) === null || _element$ownerDocumen2 === void 0 ? void 0 : _element$ownerDocumen2.getComputedStyle : _options$getComputedS2;\n if (typeof getComputedStyle !== \"function\") {\n throw new TypeError(\"Owner document of the element needs to have an associated window.\");\n }\n if (element.hidden === true) {\n return true;\n }\n if (element.getAttribute(\"aria-hidden\") === \"true\") {\n return true;\n }\n if (getComputedStyle(element).display === \"none\") {\n return true;\n }\n return false;\n}","map":{"version":3,"names":["isInaccessible","element","_element$ownerDocumen","options","arguments","length","undefined","_options$getComputedS","getComputedStyle","ownerDocument","defaultView","_options$isSubtreeIna","isSubtreeInaccessible","isSubtreeInaccessibleImpl","TypeError","visibility","currentElement","parentElement","_element$ownerDocumen2","_options$getComputedS2","hidden","getAttribute","display"],"sources":["/Users/max_liu/max_liu/company/tools_auto_pt/node_modules/dom-accessibility-api/sources/is-inaccessible.ts"],"sourcesContent":["export interface IsInaccessibleOptions {\n\tgetComputedStyle?: typeof window.getComputedStyle;\n\t/**\n\t * Can be used to return cached results from previous isSubtreeInaccessible calls.\n\t */\n\tisSubtreeInaccessible?: (element: Element) => boolean;\n}\n\n/**\n * Partial implementation https://www.w3.org/TR/wai-aria-1.2/#tree_exclusion\n * which should only be used for elements with a non-presentational role i.e.\n * `role=\"none\"` and `role=\"presentation\"` will not be excluded.\n *\n * Implements aria-hidden semantics (i.e. parent overrides child)\n * Ignores \"Child Presentational: True\" characteristics\n *\n * @param element\n * @param options\n * @returns {boolean} true if excluded, otherwise false\n */\nexport function isInaccessible(\n\telement: Element,\n\toptions: IsInaccessibleOptions = {}\n): boolean {\n\tconst {\n\t\tgetComputedStyle = element.ownerDocument.defaultView?.getComputedStyle,\n\t\tisSubtreeInaccessible: isSubtreeInaccessibleImpl = isSubtreeInaccessible,\n\t} = options;\n\tif (typeof getComputedStyle !== \"function\") {\n\t\tthrow new TypeError(\n\t\t\t\"Owner document of the element needs to have an associated window.\"\n\t\t);\n\t}\n\t// since visibility is inherited we can exit early\n\tif (getComputedStyle(element).visibility === \"hidden\") {\n\t\treturn true;\n\t}\n\n\tlet currentElement: Element | null = element;\n\twhile (currentElement) {\n\t\tif (isSubtreeInaccessibleImpl(currentElement, { getComputedStyle })) {\n\t\t\treturn true;\n\t\t}\n\n\t\tcurrentElement = currentElement.parentElement;\n\t}\n\n\treturn false;\n}\n\nexport interface IsSubtreeInaccessibleOptions {\n\tgetComputedStyle?: typeof window.getComputedStyle;\n}\n\n/**\n *\n * @param element\n * @param options\n * @returns {boolean} - `true` if every child of the element is inaccessible\n */\nexport function isSubtreeInaccessible(\n\telement: Element,\n\toptions: IsSubtreeInaccessibleOptions = {}\n): boolean {\n\tconst {\n\t\tgetComputedStyle = element.ownerDocument.defaultView?.getComputedStyle,\n\t} = options;\n\tif (typeof getComputedStyle !== \"function\") {\n\t\tthrow new TypeError(\n\t\t\t\"Owner document of the element needs to have an associated window.\"\n\t\t);\n\t}\n\n\tif ((element as HTMLElement).hidden === true) {\n\t\treturn true;\n\t}\n\n\tif (element.getAttribute(\"aria-hidden\") === \"true\") {\n\t\treturn true;\n\t}\n\n\tif (getComputedStyle(element).display === \"none\") {\n\t\treturn true;\n\t}\n\n\treturn false;\n}\n"],"mappings":"AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,cAAcA,CAC7BC,OAAgB,EAEN;EAAA,IAAAC,qBAAA;EAAA,IADVC,OAA8B,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAEnC,IAAAG,qBAAA,GAGIJ,OAAO,CAFVK,gBAAgB;IAAhBA,gBAAgB,GAAAD,qBAAA,eAAAL,qBAAA,GAAGD,OAAO,CAACQ,aAAa,CAACC,WAAW,cAAAR,qBAAA,uBAAjCA,qBAAA,CAAmCM,gBAAgB,GAAAD,qBAAA;IAAAI,qBAAA,GAEnER,OAAO,CADVS,qBAAqB;IAAEC,yBAAyB,GAAAF,qBAAA,cAAGC,qBAAqB,GAAAD,qBAAA;EAEzE,IAAI,OAAOH,gBAAgB,KAAK,UAAU,EAAE;IAC3C,MAAM,IAAIM,SAAS,CAClB,mEAAmE,CACnE;EACF;EACA;EACA,IAAIN,gBAAgB,CAACP,OAAO,CAAC,CA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