accented 1.2.6 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constants.d.ts +12 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +32 -0
- package/dist/constants.js.map +1 -1
- package/dist/elements/accented-trigger.js +1 -1
- package/dist/elements/accented-trigger.js.map +1 -1
- package/dist/scanner.d.ts.map +1 -1
- package/dist/scanner.js +79 -41
- package/dist/scanner.js.map +1 -1
- package/dist/utils/create-extended-element-with-issues.d.ts +3 -0
- package/dist/utils/create-extended-element-with-issues.d.ts.map +1 -0
- package/dist/utils/create-extended-element-with-issues.js +56 -0
- package/dist/utils/create-extended-element-with-issues.js.map +1 -0
- package/dist/utils/get-all-rules-from-axe-options.d.ts +3 -0
- package/dist/utils/get-all-rules-from-axe-options.d.ts.map +1 -0
- package/dist/utils/get-all-rules-from-axe-options.js +51 -0
- package/dist/utils/get-all-rules-from-axe-options.js.map +1 -0
- package/dist/utils/transform-violations.d.ts.map +1 -1
- package/dist/utils/transform-violations.js +2 -13
- package/dist/utils/transform-violations.js.map +1 -1
- package/dist/utils/update-elements-with-issues.d.ts +4 -3
- package/dist/utils/update-elements-with-issues.d.ts.map +1 -1
- package/dist/utils/update-elements-with-issues.js +36 -80
- package/dist/utils/update-elements-with-issues.js.map +1 -1
- package/package.json +5 -5
- package/src/constants.ts +34 -0
- package/src/elements/accented-trigger.ts +1 -1
- package/src/scanner.ts +91 -45
- package/src/utils/create-extended-element-with-issues.ts +67 -0
- package/src/utils/get-all-rules-from-axe-options.test.ts +169 -0
- package/src/utils/get-all-rules-from-axe-options.ts +54 -0
- package/src/utils/transform-violations.ts +2 -14
- package/src/utils/update-elements-with-issues.test.ts +223 -139
- package/src/utils/update-elements-with-issues.ts +76 -107
package/dist/constants.d.ts
CHANGED
|
@@ -3,4 +3,16 @@ export declare const accentedUrl = "https://accented.dev";
|
|
|
3
3
|
export declare const issuesUrl = "https://github.com/pomerantsev/accented/issues";
|
|
4
4
|
export declare const getAccentedElementNames: (name: string) => string[];
|
|
5
5
|
export declare const orderedImpacts: Array<Issue['impact']>;
|
|
6
|
+
/**
|
|
7
|
+
* axe-core rules whose pass/fail depends on the presence or absence of specific descendants
|
|
8
|
+
* (not just direct children). When any DOM mutation occurs, these rules must be re-evaluated
|
|
9
|
+
* against the full scan context, because the mutated node may be deep inside the element
|
|
10
|
+
* that the violation is reported on — and therefore outside the limited scan context.
|
|
11
|
+
*/
|
|
12
|
+
export declare const descendantDependentRules: Set<string>;
|
|
13
|
+
/**
|
|
14
|
+
* axe-core violations (their ids) that may be flagged by axe-core
|
|
15
|
+
* as false positives if an Accented trigger is a descendant of the element with the issue.
|
|
16
|
+
*/
|
|
17
|
+
export declare const violationsAffectedByAccentedTriggers: Set<string>;
|
|
6
18
|
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAErC,eAAO,MAAM,WAAW,yBAAyB,CAAC;AAClD,eAAO,MAAM,SAAS,mDAAmD,CAAC;AAC1E,eAAO,MAAM,uBAAuB,GAAI,MAAM,MAAM,aAA0C,CAAC;AAE/F,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAgD,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAErC,eAAO,MAAM,WAAW,yBAAyB,CAAC;AAClD,eAAO,MAAM,SAAS,mDAAmD,CAAC;AAC1E,eAAO,MAAM,uBAAuB,GAAI,MAAM,MAAM,aAA0C,CAAC;AAE/F,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAgD,CAAC;AAEnG;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,aAYnC,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,oCAAoC,aAQ/C,CAAC"}
|
package/dist/constants.js
CHANGED
|
@@ -2,4 +2,36 @@ export const accentedUrl = 'https://accented.dev';
|
|
|
2
2
|
export const issuesUrl = 'https://github.com/pomerantsev/accented/issues';
|
|
3
3
|
export const getAccentedElementNames = (name) => [`${name}-trigger`, `${name}-dialog`];
|
|
4
4
|
export const orderedImpacts = ['minor', 'moderate', 'serious', 'critical'];
|
|
5
|
+
/**
|
|
6
|
+
* axe-core rules whose pass/fail depends on the presence or absence of specific descendants
|
|
7
|
+
* (not just direct children). When any DOM mutation occurs, these rules must be re-evaluated
|
|
8
|
+
* against the full scan context, because the mutated node may be deep inside the element
|
|
9
|
+
* that the violation is reported on — and therefore outside the limited scan context.
|
|
10
|
+
*/
|
|
11
|
+
export const descendantDependentRules = new Set([
|
|
12
|
+
'aria-hidden-focus',
|
|
13
|
+
'aria-required-children',
|
|
14
|
+
'aria-text',
|
|
15
|
+
'document-title',
|
|
16
|
+
'landmark-no-duplicate-banner',
|
|
17
|
+
'landmark-no-duplicate-contentinfo',
|
|
18
|
+
'landmark-no-duplicate-main',
|
|
19
|
+
'landmark-one-main',
|
|
20
|
+
'nested-interactive',
|
|
21
|
+
'page-has-heading-one',
|
|
22
|
+
'scrollable-region-focusable',
|
|
23
|
+
]);
|
|
24
|
+
/**
|
|
25
|
+
* axe-core violations (their ids) that may be flagged by axe-core
|
|
26
|
+
* as false positives if an Accented trigger is a descendant of the element with the issue.
|
|
27
|
+
*/
|
|
28
|
+
export const violationsAffectedByAccentedTriggers = new Set([
|
|
29
|
+
'aria-hidden-focus',
|
|
30
|
+
'aria-text',
|
|
31
|
+
'definition-list',
|
|
32
|
+
'label-content-name-mismatch',
|
|
33
|
+
'list',
|
|
34
|
+
'nested-interactive',
|
|
35
|
+
'scrollable-region-focusable', // The Accented trigger might make the content grow such that scrolling is required.
|
|
36
|
+
]);
|
|
5
37
|
//# sourceMappingURL=constants.js.map
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAG,sBAAsB,CAAC;AAClD,MAAM,CAAC,MAAM,SAAS,GAAG,gDAAgD,CAAC;AAC1E,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,GAAG,IAAI,UAAU,EAAE,GAAG,IAAI,SAAS,CAAC,CAAC;AAE/F,MAAM,CAAC,MAAM,cAAc,GAA2B,CAAC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAG,sBAAsB,CAAC;AAClD,MAAM,CAAC,MAAM,SAAS,GAAG,gDAAgD,CAAC;AAC1E,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,GAAG,IAAI,UAAU,EAAE,GAAG,IAAI,SAAS,CAAC,CAAC;AAE/F,MAAM,CAAC,MAAM,cAAc,GAA2B,CAAC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;AAEnG;;;;;GAKG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,GAAG,CAAC;IAC9C,mBAAmB;IACnB,wBAAwB;IACxB,WAAW;IACX,gBAAgB;IAChB,8BAA8B;IAC9B,mCAAmC;IACnC,4BAA4B;IAC5B,mBAAmB;IACnB,oBAAoB;IACpB,sBAAsB;IACtB,6BAA6B;CAC9B,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,oCAAoC,GAAG,IAAI,GAAG,CAAC;IAC1D,mBAAmB;IACnB,WAAW;IACX,iBAAiB;IACjB,6BAA6B;IAC7B,MAAM;IACN,oBAAoB;IACpB,6BAA6B,EAAE,oFAAoF;CACpH,CAAC,CAAC"}
|
|
@@ -202,7 +202,7 @@ export const getAccentedTrigger = (name) => {
|
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
#setTransform() {
|
|
205
|
-
if (cssTransformsAffectAnchorPositioning()) {
|
|
205
|
+
if (supportsAnchorPositioning() && cssTransformsAffectAnchorPositioning()) {
|
|
206
206
|
return;
|
|
207
207
|
}
|
|
208
208
|
// We read and write values in separate animation frames to avoid layout thrashing.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accented-trigger.js","sourceRoot":"","sources":["../../src/elements/accented-trigger.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,EAAE,oCAAoC,EAAE,MAAM,4BAA4B,CAAC;AAClF,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AAUpF,0EAA0E;AAC1E,+FAA+F;AAC/F,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,IAAY,EAA4B,EAAE;IAC3E,MAAM,QAAQ,GAAG,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IAEpD,qHAAqH;IACrH,yFAAyF;IACzF,yFAAyF;IACzF,wCAAwC;IACxC,uGAAuG;IACvG,QAAQ,CAAC,SAAS,GAAG;;;;;;UAOb,yBAAyB,EAAE;QACzB,CAAC,CAAC;;;;;SAKL;QACG,CAAC,CAAC,EACN;;;;;;;;;;;;;;;;;;uBAkBe,cAAc;;;;;;;;;;;;kCAYH,IAAI;uBACf,IAAI;;;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,CAAC;YACvB,CAAC;QACH,CAAC;QAED,aAAa;YACX,IAAI,yBAAyB,EAAE,IAAI,oCAAoC,EAAE,EAAE,CAAC;gBAC1E,OAAO;YACT,CAAC;YACD,mFAAmF;YACnF,MAAM,CAAC,qBAAqB,CAAC,GAAG,EAAE;gBAChC,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;oBACjB,MAAM,SAAS,GAAG,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;oBACtF,IAAI,SAAS,KAAK,MAAM,EAAE,CAAC;wBACzB,MAAM,CAAC,qBAAqB,CAAC,GAAG,EAAE;4BAChC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,WAAW,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;wBAC9D,CAAC,CAAC,CAAC;oBACL,CAAC;gBACH,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC,CAAC"}
|
package/dist/scanner.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scanner.d.ts","sourceRoot":"","sources":["../src/scanner.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"scanner.d.ts","sourceRoot":"","sources":["../src/scanner.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAS1E,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,EAC5B,QAAQ,EAAE,QAAQ,cA4NnB"}
|
package/dist/scanner.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import axe from 'axe-core';
|
|
2
|
-
import { getAccentedElementNames, issuesUrl } from './constants.js';
|
|
2
|
+
import { descendantDependentRules, getAccentedElementNames, issuesUrl } from './constants.js';
|
|
3
3
|
import { logAndRethrow } from './log-and-rethrow.js';
|
|
4
4
|
import { elementsWithIssues, enabled, extendedElementsWithIssues } from './state.js';
|
|
5
5
|
import { TaskQueue } from './task-queue.js';
|
|
6
|
+
import { getAllRulesFromAxeOptions } from './utils/get-all-rules-from-axe-options.js';
|
|
6
7
|
import { getScanContext } from './utils/get-scan-context.js';
|
|
7
8
|
import { recalculatePositions } from './utils/recalculate-positions.js';
|
|
8
9
|
import { recalculateScrollableAncestors } from './utils/recalculate-scrollable-ancestors.js';
|
|
@@ -10,10 +11,59 @@ import { createShadowDOMAwareMutationObserver } from './utils/shadow-dom-aware-m
|
|
|
10
11
|
import { supportsAnchorPositioning } from './utils/supports-anchor-positioning.js';
|
|
11
12
|
import { updateElementsWithIssues } from './utils/update-elements-with-issues.js';
|
|
12
13
|
export function createScanner(name, context, axeOptions, throttle, callback) {
|
|
14
|
+
const allRules = getAllRulesFromAxeOptions(axeOptions);
|
|
15
|
+
/**
|
|
16
|
+
* Rules that only look at the element itself — safe to run
|
|
17
|
+
* against only the nodes affected by the current mutation.
|
|
18
|
+
*/
|
|
19
|
+
const limitedContextRules = new Set([...allRules].filter((rule) => !descendantDependentRules.has(rule)));
|
|
20
|
+
/**
|
|
21
|
+
* Rules whose pass/fail depends on descendants anywhere in the subtree.
|
|
22
|
+
* A mutation deep inside an element can change the outcome for the ancestor,
|
|
23
|
+
* so these must always run against the full scan context.
|
|
24
|
+
*/
|
|
25
|
+
const fullContextRules = new Set([...allRules].filter((rule) => descendantDependentRules.has(rule)));
|
|
26
|
+
/**
|
|
27
|
+
* Options shared by both axe.run() calls. The user's runOnly and rules are
|
|
28
|
+
* consumed by getAllRulesFromAxeOptions above and replaced by explicit rule
|
|
29
|
+
* sets, so they are not forwarded here.
|
|
30
|
+
*/
|
|
31
|
+
const baseAxeOptions = {
|
|
32
|
+
/**
|
|
33
|
+
* By default, axe-core doesn't include element refs
|
|
34
|
+
* in the violations array,
|
|
35
|
+
* and we need those element refs.
|
|
36
|
+
*/
|
|
37
|
+
elementRef: true,
|
|
38
|
+
/**
|
|
39
|
+
* Although axe-core can perform iframe scanning, I haven't succeeded in it,
|
|
40
|
+
* and the docs suggest that the axe-core script should be explicitly included
|
|
41
|
+
* in each of the iframed documents anyway.
|
|
42
|
+
* It seems preferable to disallow iframe scanning and not report issues in elements within iframes
|
|
43
|
+
* in the case that such issues are for some reason reported by axe-core.
|
|
44
|
+
* A consumer of Accented can instead scan the iframed document by calling Accented initialization from that document.
|
|
45
|
+
*/
|
|
46
|
+
iframes: false,
|
|
47
|
+
/**
|
|
48
|
+
* The `preload` docs are not clear to me,
|
|
49
|
+
* but when it's set to `true` by default,
|
|
50
|
+
* axe-core tries to fetch cross-origin CSS,
|
|
51
|
+
* which fails in the absence of CORS headers.
|
|
52
|
+
* I'm not sure why axe-core needs to preload
|
|
53
|
+
* those resources in the first place,
|
|
54
|
+
* so disabling it seems to be the safe option.
|
|
55
|
+
*/
|
|
56
|
+
preload: false,
|
|
57
|
+
/**
|
|
58
|
+
* We're only interested in violations,
|
|
59
|
+
* not in passes or incomplete results.
|
|
60
|
+
*/
|
|
61
|
+
resultTypes: ['violations'],
|
|
62
|
+
};
|
|
13
63
|
const axeRunningWindowProp = `__${name}_axe_running__`;
|
|
14
64
|
const win = window;
|
|
15
65
|
const taskQueue = new TaskQueue(async (nodes) => {
|
|
16
|
-
// We may see errors coming from axe-core when Accented is toggled off and on in
|
|
66
|
+
// We may see errors coming from axe-core when Accented is toggled off and on in quick succession,
|
|
17
67
|
// which I've seen happen with hot reloading of a React application.
|
|
18
68
|
// This window property serves as a circuit breaker for that particular case.
|
|
19
69
|
if (win[axeRunningWindowProp]) {
|
|
@@ -22,42 +72,29 @@ export function createScanner(name, context, axeOptions, throttle, callback) {
|
|
|
22
72
|
try {
|
|
23
73
|
performance.mark('scan-start');
|
|
24
74
|
win[axeRunningWindowProp] = true;
|
|
25
|
-
const
|
|
26
|
-
let
|
|
75
|
+
const limitedContext = getScanContext(nodes, context);
|
|
76
|
+
let limitedContextResult;
|
|
77
|
+
let fullContextResult;
|
|
27
78
|
try {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
* axe-core tries to fetch cross-origin CSS,
|
|
48
|
-
* which fails in the absence of CORS headers.
|
|
49
|
-
* I'm not sure why axe-core needs to preload
|
|
50
|
-
* those resources in the first place,
|
|
51
|
-
* so disabling it seems to be the safe option.
|
|
52
|
-
*/
|
|
53
|
-
preload: false,
|
|
54
|
-
/**
|
|
55
|
-
* We're only interested in violations,
|
|
56
|
-
* not in passes or incomplete results.
|
|
57
|
-
*/
|
|
58
|
-
resultTypes: ['violations'],
|
|
59
|
-
...axeOptions,
|
|
60
|
-
});
|
|
79
|
+
// Run the scan against the limited context (only the mutated
|
|
80
|
+
// nodes, filtered to those within the user-provided context). Skip if no
|
|
81
|
+
// limited-context rules are active.
|
|
82
|
+
limitedContextResult =
|
|
83
|
+
limitedContextRules.size > 0
|
|
84
|
+
? await axe.run(limitedContext, {
|
|
85
|
+
...baseAxeOptions,
|
|
86
|
+
runOnly: { type: 'rule', values: [...limitedContextRules] },
|
|
87
|
+
})
|
|
88
|
+
: undefined;
|
|
89
|
+
// Run the supplemental scan against the full context so that ancestor-
|
|
90
|
+
// dependent rules always see the complete DOM. Skip if none are active.
|
|
91
|
+
fullContextResult =
|
|
92
|
+
fullContextRules.size > 0
|
|
93
|
+
? await axe.run(context, {
|
|
94
|
+
...baseAxeOptions,
|
|
95
|
+
runOnly: { type: 'rule', values: [...fullContextRules] },
|
|
96
|
+
})
|
|
97
|
+
: undefined;
|
|
61
98
|
}
|
|
62
99
|
catch (error) {
|
|
63
100
|
console.error(`Accented: axe-core (the accessibility testing engine) threw an error. Check the \`axeOptions\` property (https://accented.dev/api#axeoptions) that you’re passing to Accented. If you still think it’s a bug in Accented, file an issue at ${issuesUrl}.\n`, error);
|
|
@@ -65,14 +102,15 @@ export function createScanner(name, context, axeOptions, throttle, callback) {
|
|
|
65
102
|
win[axeRunningWindowProp] = false;
|
|
66
103
|
const scanMeasure = performance.measure('scan', 'scan-start');
|
|
67
104
|
const scanDuration = Math.round(scanMeasure.duration);
|
|
68
|
-
if (!enabled.value || !
|
|
105
|
+
if (!enabled.value || (!limitedContextResult && !fullContextResult)) {
|
|
69
106
|
return;
|
|
70
107
|
}
|
|
71
108
|
performance.mark('dom-update-start');
|
|
72
109
|
updateElementsWithIssues({
|
|
73
110
|
extendedElementsWithIssues,
|
|
74
|
-
|
|
75
|
-
|
|
111
|
+
limitedContext,
|
|
112
|
+
limitedContextViolations: limitedContextResult?.violations ?? [],
|
|
113
|
+
fullContextViolations: fullContextResult?.violations ?? [],
|
|
76
114
|
name,
|
|
77
115
|
});
|
|
78
116
|
const domUpdateMeasure = performance.measure('dom-update', 'dom-update-start');
|
|
@@ -81,7 +119,7 @@ export function createScanner(name, context, axeOptions, throttle, callback) {
|
|
|
81
119
|
// Assuming that the {include, exclude} shape of the context object will be used less often
|
|
82
120
|
// than other variants, we'll output just the `include` array in case nothing is excluded
|
|
83
121
|
// in the scan.
|
|
84
|
-
scanContext:
|
|
122
|
+
scanContext: limitedContext.exclude.length > 0 ? limitedContext : limitedContext.include,
|
|
85
123
|
elementsWithIssues: elementsWithIssues.value,
|
|
86
124
|
performance: {
|
|
87
125
|
totalBlockingTime: scanDuration + domUpdateDuration,
|
package/dist/scanner.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scanner.js","sourceRoot":"","sources":["../src/scanner.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,EAAE,uBAAuB,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"scanner.js","sourceRoot":"","sources":["../src/scanner.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC9F,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AACrF,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,yBAAyB,EAAE,MAAM,2CAA2C,CAAC;AACtF,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,8BAA8B,EAAE,MAAM,6CAA6C,CAAC;AAC7F,OAAO,EAAE,oCAAoC,EAAE,MAAM,+CAA+C,CAAC;AACrG,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAElF,MAAM,UAAU,aAAa,CAC3B,IAAY,EACZ,OAAgB,EAChB,UAAsB,EACtB,QAA4B,EAC5B,QAAkB;IAElB,MAAM,QAAQ,GAAG,yBAAyB,CAAC,UAAU,CAAC,CAAC;IAEvD;;;OAGG;IACH,MAAM,mBAAmB,GAAG,IAAI,GAAG,CACjC,CAAC,GAAG,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,wBAAwB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CACpE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,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,aAAa,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,gBAAgB,CAAC,OAAO,CAAC,QAAQ,EAAE;QACjC,OAAO,EAAE,IAAI;QACb,SAAS,EAAE,IAAI;QACf,UAAU,EAAE,IAAI;QAChB,aAAa,EAAE,IAAI;KACpB,CAAC,CAAC;IAEH,OAAO,GAAG,EAAE;QACV,gBAAgB,CAAC,UAAU,EAAE,CAAC;IAChC,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ElementWithIssues, ExtendedElementWithIssues } from '../types.ts';
|
|
2
|
+
export declare function createExtendedElementWithIssues(elementWithIssues: ElementWithIssues, name: string): ExtendedElementWithIssues;
|
|
3
|
+
//# sourceMappingURL=create-extended-element-with-issues.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-extended-element-with-issues.d.ts","sourceRoot":"","sources":["../../src/utils/create-extended-element-with-issues.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAyBhF,wBAAgB,+BAA+B,CAC7C,iBAAiB,EAAE,iBAAiB,EACpC,IAAI,EAAE,MAAM,GACX,yBAAyB,CAmC3B"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { signal } from '@preact/signals-core';
|
|
2
|
+
import { isSvgElement } from './dom-helpers.js';
|
|
3
|
+
import { getElementPosition } from './get-element-position.js';
|
|
4
|
+
import { getParent } from './get-parent.js';
|
|
5
|
+
import { getScrollableAncestors } from './get-scrollable-ancestors.js';
|
|
6
|
+
import { supportsAnchorPositioning } from './supports-anchor-positioning.js';
|
|
7
|
+
function shouldSkipRender(element) {
|
|
8
|
+
// Skip rendering if the element is inside an SVG:
|
|
9
|
+
// https://github.com/pomerantsev/accented/issues/62
|
|
10
|
+
const parent = getParent(element);
|
|
11
|
+
const isInsideSvg = Boolean(parent && isSvgElement(parent));
|
|
12
|
+
// Some issues, such as meta-viewport, are on <head> descendants,
|
|
13
|
+
// but since <head> is never rendered, we don't want to output anything
|
|
14
|
+
// for those in the DOM.
|
|
15
|
+
// We're not anticipating the use of shadow DOM in <head>,
|
|
16
|
+
// so the use of .closest() should be fine.
|
|
17
|
+
const isInsideHead = element.closest('head') !== null;
|
|
18
|
+
return isInsideSvg || isInsideHead;
|
|
19
|
+
}
|
|
20
|
+
let count = 0;
|
|
21
|
+
export function createExtendedElementWithIssues(elementWithIssues, name) {
|
|
22
|
+
const id = count++;
|
|
23
|
+
const trigger = document.createElement(`${name}-trigger`);
|
|
24
|
+
const elementZIndex = Number.parseInt(getComputedStyle(elementWithIssues.element).zIndex, 10);
|
|
25
|
+
if (!Number.isNaN(elementZIndex)) {
|
|
26
|
+
trigger.style.setProperty('z-index', (elementZIndex + 1).toString(), 'important');
|
|
27
|
+
}
|
|
28
|
+
trigger.style.setProperty('position-anchor', `--${name}-anchor-${id}`, 'important');
|
|
29
|
+
trigger.dataset.id = id.toString();
|
|
30
|
+
const accentedDialog = document.createElement(`${name}-dialog`);
|
|
31
|
+
trigger.dialog = accentedDialog;
|
|
32
|
+
const position = getElementPosition(elementWithIssues.element);
|
|
33
|
+
trigger.position = signal(position);
|
|
34
|
+
trigger.visible = signal(true);
|
|
35
|
+
trigger.element = elementWithIssues.element;
|
|
36
|
+
const scrollableAncestors = supportsAnchorPositioning()
|
|
37
|
+
? new Set()
|
|
38
|
+
: getScrollableAncestors(elementWithIssues.element);
|
|
39
|
+
const issues = signal(elementWithIssues.issues);
|
|
40
|
+
accentedDialog.issues = issues;
|
|
41
|
+
accentedDialog.element = elementWithIssues.element;
|
|
42
|
+
return {
|
|
43
|
+
id,
|
|
44
|
+
element: elementWithIssues.element,
|
|
45
|
+
skipRender: shouldSkipRender(elementWithIssues.element),
|
|
46
|
+
rootNode: elementWithIssues.rootNode,
|
|
47
|
+
visible: trigger.visible,
|
|
48
|
+
position: trigger.position,
|
|
49
|
+
scrollableAncestors: signal(scrollableAncestors),
|
|
50
|
+
anchorNameValue: elementWithIssues.element.style.getPropertyValue('anchor-name') ||
|
|
51
|
+
getComputedStyle(elementWithIssues.element).getPropertyValue('anchor-name'),
|
|
52
|
+
trigger,
|
|
53
|
+
issues,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=create-extended-element-with-issues.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-extended-element-with-issues.js","sourceRoot":"","sources":["../../src/utils/create-extended-element-with-issues.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAI9C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAE7E,SAAS,gBAAgB,CAAC,OAAgB;IACxC,kDAAkD;IAClD,oDAAoD;IACpD,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;IAClC,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC;IAE5D,iEAAiE;IACjE,uEAAuE;IACvE,wBAAwB;IACxB,0DAA0D;IAC1D,2CAA2C;IAC3C,MAAM,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;IAEtD,OAAO,WAAW,IAAI,YAAY,CAAC;AACrC,CAAC;AAED,IAAI,KAAK,GAAG,CAAC,CAAC;AAEd,MAAM,UAAU,+BAA+B,CAC7C,iBAAoC,EACpC,IAAY;I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D,cAAc,CAAC,MAAM,GAAG,MAAM,CAAC;IAC/B,cAAc,CAAC,OAAO,GAAG,iBAAiB,CAAC,OAAO,CAAC;IACnD,OAAO;QACL,EAAE;QACF,OAAO,EAAE,iBAAiB,CAAC,OAAO;QAClC,UAAU,EAAE,gBAAgB,CAAC,iBAAiB,CAAC,OAAO,CAAC;QACvD,QAAQ,EAAE,iBAAiB,CAAC,QAAQ;QACpC,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,mBAAmB,EAAE,MAAM,CAAC,mBAAmB,CAAC;QAChD,eAAe,EACb,iBAAiB,CAAC,OAAO,CAAC,KAAK,CAAC,gBAAgB,CAAC,aAAa,CAAC;YAC/D,gBAAgB,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,gBAAgB,CAAC,aAAa,CAAC;QAC7E,OAAO;QACP,MAAM;KACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-all-rules-from-axe-options.d.ts","sourceRoot":"","sources":["../../src/utils/get-all-rules-from-axe-options.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AA6B9C,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,UAAU,GAAG,GAAG,CAAC,MAAM,CAAC,CAiB7E"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/* Adapts two axe-core behaviors:
|
|
2
|
+
- shorthand string/array runOnly normalization from normalizeOptions:
|
|
3
|
+
https://github.com/dequelabs/axe-core/blob/9261d074b60527a84f4dce5a64a6d5a5843a0772/lib/core/base/audit.js#L408-L428
|
|
4
|
+
- which rules to include for a given runOnly/rules combination, from ruleShouldRun (lines 65–80,
|
|
5
|
+
omitting the rule.pageLevel check — axe applies that itself when we call axe.run):
|
|
6
|
+
https://github.com/dequelabs/axe-core/blob/9261d074b60527a84f4dce5a64a6d5a5843a0772/lib/core/utils/rule-should-run.js */
|
|
7
|
+
import axe from 'axe-core';
|
|
8
|
+
function getRuleIds(tags) {
|
|
9
|
+
return new Set(axe.getRules(tags).map((r) => r.ruleId));
|
|
10
|
+
}
|
|
11
|
+
function applyOverrides(ruleSet, rules) {
|
|
12
|
+
if (!rules)
|
|
13
|
+
return ruleSet;
|
|
14
|
+
for (const [ruleId, ruleConfig] of Object.entries(rules)) {
|
|
15
|
+
if (ruleConfig.enabled === false)
|
|
16
|
+
ruleSet.delete(ruleId);
|
|
17
|
+
else if (ruleConfig.enabled === true)
|
|
18
|
+
ruleSet.add(ruleId);
|
|
19
|
+
}
|
|
20
|
+
return ruleSet;
|
|
21
|
+
}
|
|
22
|
+
// Normalizes the string/array shorthands of runOnly into the { type, values } object form.
|
|
23
|
+
function normalizeRunOnly(runOnly, allRuleIds) {
|
|
24
|
+
if (typeof runOnly !== 'string' && !Array.isArray(runOnly))
|
|
25
|
+
return runOnly;
|
|
26
|
+
const values = typeof runOnly === 'string' ? [runOnly] : runOnly;
|
|
27
|
+
const isRulePath = values.every((v) => allRuleIds.has(v));
|
|
28
|
+
const isTagPath = values.every((v) => !allRuleIds.has(v));
|
|
29
|
+
if (!isRulePath && !isTagPath)
|
|
30
|
+
throw new Error(`runOnly mixes rule IDs and tag values: ${values.join(', ')}`);
|
|
31
|
+
return { type: isRulePath ? 'rule' : 'tag', values };
|
|
32
|
+
}
|
|
33
|
+
export function getAllRulesFromAxeOptions(axeOptions) {
|
|
34
|
+
const allRuleIds = getRuleIds();
|
|
35
|
+
const { rules, runOnly } = axeOptions;
|
|
36
|
+
if (runOnly === undefined) {
|
|
37
|
+
// axe.getRules() includes rules disabled by default; axe skips them via rule.enabled !== false.
|
|
38
|
+
// Replicate that here using the internal _audit.rules, which exposes the enabled flag.
|
|
39
|
+
// @ts-expect-error: _audit is an undocumented internal axe-core API not present in its type definitions
|
|
40
|
+
for (const rule of axe._audit.rules) {
|
|
41
|
+
if (rule.enabled === false)
|
|
42
|
+
allRuleIds.delete(rule.id);
|
|
43
|
+
}
|
|
44
|
+
return applyOverrides(allRuleIds, rules);
|
|
45
|
+
}
|
|
46
|
+
const { type, values } = normalizeRunOnly(runOnly, allRuleIds);
|
|
47
|
+
if (type === 'rule' || type === 'rules')
|
|
48
|
+
return new Set(values);
|
|
49
|
+
return applyOverrides(getRuleIds(values), rules);
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=get-all-rules-from-axe-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-all-rules-from-axe-options.js","sourceRoot":"","sources":["../../src/utils/get-all-rules-from-axe-options.ts"],"names":[],"mappings":"AAAA;;;;;6HAK6H;AAC7H,OAAO,GAAG,MAAM,UAAU,CAAC;AAG3B,SAAS,UAAU,CAAC,IAAoB;IACtC,OAAO,IAAI,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAC1D,CAAC;AAED,SAAS,cAAc,CAAC,OAAoB,EAAE,KAA0B;IACtE,IAAI,CAAC,KAAK;QAAE,OAAO,OAAO,CAAC;IAC3B,KAAK,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzD,IAAI,UAAU,CAAC,OAAO,KAAK,KAAK;YAAE,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;aACpD,IAAI,UAAU,CAAC,OAAO,KAAK,IAAI;YAAE,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC5D,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,2FAA2F;AAC3F,SAAS,gBAAgB,CACvB,OAAkD,EAClD,UAAuB;IAEvB,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,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,CAAC;IAC/D,IAAI,IAAI,KAAK,MAAM,IAAI,IAAI,KAAK,OAAO;QAAE,OAAO,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;IAChE,OAAO,cAAc,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,CAAC;AACnD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform-violations.d.ts","sourceRoot":"","sources":["../../src/utils/transform-violations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,OAAO,KAAK,EAAE,iBAAiB,EAAS,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"transform-violations.d.ts","sourceRoot":"","sources":["../../src/utils/transform-violations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,OAAO,KAAK,EAAE,iBAAiB,EAAS,MAAM,aAAa,CAAC;AAa5D,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,OAAO,UAAU,CAAC,UAAU,EAAE,IAAI,EAAE,MAAM,uBAsDzF"}
|
|
@@ -1,17 +1,6 @@
|
|
|
1
|
-
import { issuesUrl, orderedImpacts } from '../constants.js';
|
|
2
|
-
// This is a list of axe-core violations (their ids) that may be flagged by axe-core
|
|
3
|
-
// as false positives if an Accented trigger is a descendant of the element with the issue.
|
|
4
|
-
const violationsAffectedByAccentedTriggers = [
|
|
5
|
-
'aria-hidden-focus',
|
|
6
|
-
'aria-text',
|
|
7
|
-
'definition-list',
|
|
8
|
-
'label-content-name-mismatch',
|
|
9
|
-
'list',
|
|
10
|
-
'nested-interactive',
|
|
11
|
-
'scrollable-region-focusable', // The Accented trigger might make the content grow such that scrolling is required.
|
|
12
|
-
];
|
|
1
|
+
import { issuesUrl, orderedImpacts, violationsAffectedByAccentedTriggers } from '../constants.js';
|
|
13
2
|
function maybeCausedByAccented(violationId, element, name) {
|
|
14
|
-
return (violationsAffectedByAccentedTriggers.
|
|
3
|
+
return (violationsAffectedByAccentedTriggers.has(violationId) &&
|
|
15
4
|
Boolean(element.querySelector(`${name}-trigger`)));
|
|
16
5
|
}
|
|
17
6
|
function impactCompare(a, b) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform-violations.js","sourceRoot":"","sources":["../../src/utils/transform-violations.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"transform-violations.js","sourceRoot":"","sources":["../../src/utils/transform-violations.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,oCAAoC,EAAE,MAAM,iBAAiB,CAAC;AAGlG,SAAS,qBAAqB,CAAC,WAAmB,EAAE,OAAoB,EAAE,IAAY;IACpF,OAAO,CACL,oCAAoC,CAAC,GAAG,CAAC,WAAW,CAAC;QACrD,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,GAAG,IAAI,UAAU,CAAC,CAAC,CAClD,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CAAC,CAAkB,EAAE,CAAkB;IAC3D,OAAO,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAC/D,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,UAAwC,EAAE,IAAY;IACxF,MAAM,kBAAkB,GAA6B,EAAE,CAAC;IAExD,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,KAAK,MAAM,IAAI,IAAI,SAAS,CAAC,KAAK,EAAE,CAAC;YACnC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;YAEjC,4EAA4E;YAC5E,8EAA8E;YAC9E,2CAA2C;YAC3C,mGAAmG;YACnG,yEAAyE;YACzE,sHAAsH;YACtH,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,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AAa,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACxE,CAAC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,kBAAkB,CAAC;AAC5B,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { Signal } from '@preact/signals-core';
|
|
2
2
|
import type { AxeResults } from 'axe-core';
|
|
3
3
|
import type { ExtendedElementWithIssues, ScanContext } from '../types.ts';
|
|
4
|
-
export declare function updateElementsWithIssues({ extendedElementsWithIssues,
|
|
4
|
+
export declare function updateElementsWithIssues({ extendedElementsWithIssues, limitedContext, limitedContextViolations, fullContextViolations, name, }: {
|
|
5
5
|
extendedElementsWithIssues: Signal<Array<ExtendedElementWithIssues>>;
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
limitedContext: ScanContext;
|
|
7
|
+
limitedContextViolations: AxeResults['violations'];
|
|
8
|
+
fullContextViolations: AxeResults['violations'];
|
|
8
9
|
name: string;
|
|
9
10
|
}): void;
|
|
10
11
|
//# sourceMappingURL=update-elements-with-issues.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-elements-with-issues.d.ts","sourceRoot":"","sources":["../../src/utils/update-elements-with-issues.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"update-elements-with-issues.d.ts","sourceRoot":"","sources":["../../src/utils/update-elements-with-issues.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,OAAO,KAAK,EAGV,yBAAyB,EAEzB,WAAW,EACZ,MAAM,aAAa,CAAC;AA+BrB,wBAAgB,wBAAwB,CAAC,EACvC,0BAA0B,EAC1B,cAAc,EACd,wBAAwB,EACxB,qBAAqB,EACrB,IAAI,GACL,EAAE;IACD,0BAA0B,EAAE,MAAM,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC,CAAC;IACrE,cAAc,EAAE,WAAW,CAAC;IAC5B,wBAAwB,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC;IACnD,qBAAqB,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC;IAChD,IAAI,EAAE,MAAM,CAAC;CACd,QAuDA"}
|