UNPKG

nemo-accessibility

Version:

nemo-accessibility is a nemo plugin aimed to run accessibility scans during nemo tests. nemo-accessibility plugin uses axe-core, htmlcode smiffer and chrome engines to run accessibility scans on a given page or on a given element on a page.

1,435 lines 528 kB
/*! aXe v3.0.3 * Copyright (c) 2018 Deque Systems, Inc. * * Your use of this Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This entire copyright notice must appear in every copy of this file you * distribute or in any file that contains substantial portions of this source * code. */ (function axeFunction(window) { var global = window; var document = window.document; 'use strict'; var _typeof = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ? function(obj) { return typeof obj; } : function(obj) { return obj && typeof Symbol === 'function' && obj.constructor === Symbol && obj !== Symbol.prototype ? 'symbol' : typeof obj; }; var axe = axe || {}; axe.version = '3.0.3'; if (typeof define === 'function' && define.amd) { define('axe-core', [], function() { 'use strict'; return axe; }); } if ((typeof module === 'undefined' ? 'undefined' : _typeof(module)) === 'object' && module.exports && typeof axeFunction.toString === 'function') { axe.source = '(' + axeFunction.toString() + ')(typeof window === "object" ? window : this);'; module.exports = axe; } if (typeof window.getComputedStyle === 'function') { window.axe = axe; } var commons; function SupportError(error) { this.name = 'SupportError'; this.cause = error.cause; this.message = '`' + error.cause + '` - feature unsupported in your environment.'; if (error.ruleId) { this.ruleId = error.ruleId; this.message += ' Skipping ' + this.ruleId + ' rule.'; } this.stack = new Error().stack; } SupportError.prototype = Object.create(Error.prototype); SupportError.prototype.constructor = SupportError; 'use strict'; axe.imports = {}; 'use strict'; var utils = axe.utils = {}; 'use strict'; var helpers = {}; 'use strict'; var _typeof = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ? function(obj) { return typeof obj; } : function(obj) { return obj && typeof Symbol === 'function' && obj.constructor === Symbol && obj !== Symbol.prototype ? 'symbol' : typeof obj; }; var _extends = Object.assign || function(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; function getDefaultConfiguration(audit) { 'use strict'; var config; if (audit) { config = axe.utils.clone(audit); config.commons = audit.commons; } else { config = {}; } config.reporter = config.reporter || null; config.rules = config.rules || []; config.checks = config.checks || []; config.data = _extends({ checks: {}, rules: {} }, config.data); return config; } function unpackToObject(collection, audit, method) { 'use strict'; var i, l; for (i = 0, l = collection.length; i < l; i++) { audit[method](collection[i]); } } function Audit(audit) { this.brand = 'axe'; this.application = 'axeAPI'; this.tagExclude = [ 'experimental' ]; this.defaultConfig = audit; this._init(); this._defaultLocale = null; } Audit.prototype._setDefaultLocale = function() { if (this._defaultLocale) { return; } var locale = { checks: {}, rules: {} }; var checkIDs = Object.keys(this.data.checks); for (var i = 0; i < checkIDs.length; i++) { var id = checkIDs[i]; var check = this.data.checks[id]; var _check$messages = check.messages, pass = _check$messages.pass, fail = _check$messages.fail, incomplete = _check$messages.incomplete; locale.checks[id] = { pass: pass, fail: fail, incomplete: incomplete }; } var ruleIDs = Object.keys(this.data.rules); for (var _i = 0; _i < ruleIDs.length; _i++) { var _id = ruleIDs[_i]; var rule = this.data.rules[_id]; var description = rule.description, help = rule.help; locale.rules[_id] = { description: description, help: help }; } this._defaultLocale = locale; }; Audit.prototype._resetLocale = function() { var defaultLocale = this._defaultLocale; if (!defaultLocale) { return; } this.applyLocale(defaultLocale); }; var mergeCheckLocale = function mergeCheckLocale(a, b) { var pass = b.pass, fail = b.fail; if (typeof pass === 'string') { pass = axe.imports.doT.compile(pass); } if (typeof fail === 'string') { fail = axe.imports.doT.compile(fail); } return _extends({}, a, { messages: { pass: pass || a.messages.pass, fail: fail || a.messages.fail, incomplete: _typeof(a.messages.incomplete) === 'object' ? _extends({}, a.messages.incomplete, b.incomplete) : b.incomplete } }); }; var mergeRuleLocale = function mergeRuleLocale(a, b) { var help = b.help, description = b.description; if (typeof help === 'string') { help = axe.imports.doT.compile(help); } if (typeof description === 'string') { description = axe.imports.doT.compile(description); } return _extends({}, a, { help: help || a.help, description: description || a.description }); }; Audit.prototype._applyCheckLocale = function(checks) { var keys = Object.keys(checks); for (var i = 0; i < keys.length; i++) { var id = keys[i]; if (!this.data.checks[id]) { throw new Error('Locale provided for unknown check: "' + id + '"'); } this.data.checks[id] = mergeCheckLocale(this.data.checks[id], checks[id]); } }; Audit.prototype._applyRuleLocale = function(rules) { var keys = Object.keys(rules); for (var i = 0; i < keys.length; i++) { var id = keys[i]; if (!this.data.rules[id]) { throw new Error('Locale provided for unknown rule: "' + id + '"'); } this.data.rules[id] = mergeRuleLocale(this.data.rules[id], rules[id]); } }; Audit.prototype.applyLocale = function(locale) { this._setDefaultLocale(); if (locale.checks) { this._applyCheckLocale(locale.checks); } if (locale.rules) { this._applyRuleLocale(locale.rules); } }; Audit.prototype._init = function() { var audit = getDefaultConfiguration(this.defaultConfig); axe.commons = commons = audit.commons; this.reporter = audit.reporter; this.commands = {}; this.rules = []; this.checks = {}; unpackToObject(audit.rules, this, 'addRule'); unpackToObject(audit.checks, this, 'addCheck'); this.data = {}; this.data.checks = audit.data && audit.data.checks || {}; this.data.rules = audit.data && audit.data.rules || {}; this.data.failureSummaries = audit.data && audit.data.failureSummaries || {}; this.data.incompleteFallbackMessage = audit.data && audit.data.incompleteFallbackMessage || ''; this._constructHelpUrls(); }; Audit.prototype.registerCommand = function(command) { 'use strict'; this.commands[command.id] = command.callback; }; Audit.prototype.addRule = function(spec) { 'use strict'; if (spec.metadata) { this.data.rules[spec.id] = spec.metadata; } var rule = this.getRule(spec.id); if (rule) { rule.configure(spec); } else { this.rules.push(new Rule(spec, this)); } }; Audit.prototype.addCheck = function(spec) { 'use strict'; var metadata = spec.metadata; if ((typeof metadata === 'undefined' ? 'undefined' : _typeof(metadata)) === 'object') { this.data.checks[spec.id] = metadata; if (_typeof(metadata.messages) === 'object') { Object.keys(metadata.messages).filter(function(prop) { return metadata.messages.hasOwnProperty(prop) && typeof metadata.messages[prop] === 'string'; }).forEach(function(prop) { if (metadata.messages[prop].indexOf('function') === 0) { metadata.messages[prop] = new Function('return ' + metadata.messages[prop] + ';')(); } }); } } if (this.checks[spec.id]) { this.checks[spec.id].configure(spec); } else { this.checks[spec.id] = new Check(spec); } }; function getRulesToRun(rules, context, options) { var base = { now: [], later: [] }; var splitRules = rules.reduce(function(out, rule) { if (!axe.utils.ruleShouldRun(rule, context, options)) { return out; } if (rule.preload) { out.later.push(rule); return out; } out.now.push(rule); return out; }, base); return splitRules; } function getDefferedRule(rule, context, options) { var markStart = void 0; var markEnd = void 0; if (options.performanceTimer) { markStart = 'mark_rule_start_' + rule.id; markEnd = 'mark_rule_end_' + rule.id; axe.utils.performanceTimer.mark(markStart); } return function(resolve, reject) { rule.run(context, options, function(ruleResult) { if (options.performanceTimer) { axe.utils.performanceTimer.mark(markEnd); axe.utils.performanceTimer.measure('rule_' + rule.id, markStart, markEnd); } resolve(ruleResult); }, function(err) { if (!options.debug) { var errResult = Object.assign(new RuleResult(rule), { result: axe.constants.CANTTELL, description: 'An error occured while running this rule', message: err.message, stack: err.stack, error: err }); resolve(errResult); } else { reject(err); } }); }; } Audit.prototype.run = function(context, options, resolve, reject) { 'use strict'; this.normalizeOptions(options); axe._selectCache = []; var allRulesToRun = getRulesToRun(this.rules, context, options); var runNowRules = allRulesToRun.now; var runLaterRules = allRulesToRun.later; var nowRulesQueue = axe.utils.queue(); runNowRules.forEach(function(rule) { nowRulesQueue.defer(getDefferedRule(rule, context, options)); }); var preloaderQueue = axe.utils.queue(); if (runLaterRules.length) { preloaderQueue.defer(function(res, rej) { axe.utils.preload(options).then(function(preloadResults) { var assets = preloadResults[0]; res(assets); }).catch(function(err) { console.warn('Couldn\'t load preload assets: ', err); var assets = undefined; res(assets); }); }); } var queueForNowRulesAndPreloader = axe.utils.queue(); queueForNowRulesAndPreloader.defer(nowRulesQueue); queueForNowRulesAndPreloader.defer(preloaderQueue); queueForNowRulesAndPreloader.then(function(nowRulesAndPreloaderResults) { var assetsFromQueue = nowRulesAndPreloaderResults.pop(); if (assetsFromQueue && assetsFromQueue.length) { var assets = assetsFromQueue[0]; if (assets) { context = _extends({}, context, assets); } } var nowRulesResults = nowRulesAndPreloaderResults[0]; if (!runLaterRules.length) { axe._selectCache = undefined; resolve(nowRulesResults.filter(function(result) { return !!result; })); return; } var laterRulesQueue = axe.utils.queue(); runLaterRules.forEach(function(rule) { var deferredRule = getDefferedRule(rule, context, options); laterRulesQueue.defer(deferredRule); }); laterRulesQueue.then(function(laterRuleResults) { axe._selectCache = undefined; resolve(nowRulesResults.concat(laterRuleResults).filter(function(result) { return !!result; })); }).catch(reject); }).catch(reject); }; Audit.prototype.after = function(results, options) { 'use strict'; var rules = this.rules; return results.map(function(ruleResult) { var rule = axe.utils.findBy(rules, 'id', ruleResult.id); if (!rule) { throw new Error('Result for unknown rule. You may be running mismatch aXe-core versions'); } return rule.after(ruleResult, options); }); }; Audit.prototype.getRule = function(ruleId) { return this.rules.find(function(rule) { return rule.id === ruleId; }); }; Audit.prototype.normalizeOptions = function(options) { 'use strict'; var audit = this; if (_typeof(options.runOnly) === 'object') { if (Array.isArray(options.runOnly)) { options.runOnly = { type: 'tag', values: options.runOnly }; } var only = options.runOnly; if (only.value && !only.values) { only.values = only.value; delete only.value; } if (!Array.isArray(only.values) || only.values.length === 0) { throw new Error('runOnly.values must be a non-empty array'); } if ([ 'rule', 'rules' ].includes(only.type)) { only.type = 'rule'; only.values.forEach(function(ruleId) { if (!audit.getRule(ruleId)) { throw new Error('unknown rule `' + ruleId + '` in options.runOnly'); } }); } else if ([ 'tag', 'tags', undefined ].includes(only.type)) { only.type = 'tag'; var unmatchedTags = audit.rules.reduce(function(unmatchedTags, rule) { return unmatchedTags.length ? unmatchedTags.filter(function(tag) { return !rule.tags.includes(tag); }) : unmatchedTags; }, only.values); if (unmatchedTags.length !== 0) { throw new Error('Could not find tags `' + unmatchedTags.join('`, `') + '`'); } } else { throw new Error('Unknown runOnly type \'' + only.type + '\''); } } if (_typeof(options.rules) === 'object') { Object.keys(options.rules).forEach(function(ruleId) { if (!audit.getRule(ruleId)) { throw new Error('unknown rule `' + ruleId + '` in options.rules'); } }); } return options; }; Audit.prototype.setBranding = function(branding) { 'use strict'; var previous = { brand: this.brand, application: this.application }; if (branding && branding.hasOwnProperty('brand') && branding.brand && typeof branding.brand === 'string') { this.brand = branding.brand; } if (branding && branding.hasOwnProperty('application') && branding.application && typeof branding.application === 'string') { this.application = branding.application; } this._constructHelpUrls(previous); }; function getHelpUrl(_ref, ruleId, version) { var brand = _ref.brand, application = _ref.application; return axe.constants.helpUrlBase + brand + '/' + (version || axe.version.substring(0, axe.version.lastIndexOf('.'))) + '/' + ruleId + '?application=' + application; } Audit.prototype._constructHelpUrls = function() { var _this = this; var previous = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; var version = (axe.version.match(/^[1-9][0-9]*\.[0-9]+/) || [ 'x.y' ])[0]; this.rules.forEach(function(rule) { if (!_this.data.rules[rule.id]) { _this.data.rules[rule.id] = {}; } var metaData = _this.data.rules[rule.id]; if (typeof metaData.helpUrl !== 'string' || previous && metaData.helpUrl === getHelpUrl(previous, rule.id, version)) { metaData.helpUrl = getHelpUrl(_this, rule.id, version); } }); }; Audit.prototype.resetRulesAndChecks = function() { 'use strict'; this._init(); this._resetLocale(); }; 'use strict'; function CheckResult(check) { 'use strict'; this.id = check.id; this.data = null; this.relatedNodes = []; this.result = null; } 'use strict'; function createExecutionContext(spec) { 'use strict'; if (typeof spec === 'string') { return new Function('return ' + spec + ';')(); } return spec; } function Check(spec) { if (spec) { this.id = spec.id; this.configure(spec); } } Check.prototype.enabled = true; Check.prototype.run = function(node, options, context, resolve, reject) { 'use strict'; options = options || {}; var enabled = options.hasOwnProperty('enabled') ? options.enabled : this.enabled, checkOptions = options.options || this.options; if (enabled) { var checkResult = new CheckResult(this); var checkHelper = axe.utils.checkHelper(checkResult, options, resolve, reject); var result; try { result = this.evaluate.call(checkHelper, node.actualNode, checkOptions, node, context); } catch (e) { reject(e); return; } if (!checkHelper.isAsync) { checkResult.result = result; setTimeout(function() { resolve(checkResult); }, 0); } } else { resolve(null); } }; Check.prototype.configure = function(spec) { var _this = this; [ 'options', 'enabled' ].filter(function(prop) { return spec.hasOwnProperty(prop); }).forEach(function(prop) { return _this[prop] = spec[prop]; }); [ 'evaluate', 'after' ].filter(function(prop) { return spec.hasOwnProperty(prop); }).forEach(function(prop) { return _this[prop] = createExecutionContext(spec[prop]); }); }; 'use strict'; var _typeof = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ? function(obj) { return typeof obj; } : function(obj) { return obj && typeof Symbol === 'function' && obj.constructor === Symbol && obj !== Symbol.prototype ? 'symbol' : typeof obj; }; function pushUniqueFrame(collection, frame) { 'use strict'; if (axe.utils.isHidden(frame)) { return; } var fr = axe.utils.findBy(collection, 'node', frame); if (!fr) { collection.push({ node: frame, include: [], exclude: [] }); } } function pushUniqueFrameSelector(context, type, selectorArray) { 'use strict'; context.frames = context.frames || []; var result, frame; var frames = document.querySelectorAll(selectorArray.shift()); frameloop: for (var i = 0, l = frames.length; i < l; i++) { frame = frames[i]; for (var j = 0, l2 = context.frames.length; j < l2; j++) { if (context.frames[j].node === frame) { context.frames[j][type].push(selectorArray); break frameloop; } } result = { node: frame, include: [], exclude: [] }; if (selectorArray) { result[type].push(selectorArray); } context.frames.push(result); } } function normalizeContext(context) { 'use strict'; if (context && (typeof context === 'undefined' ? 'undefined' : _typeof(context)) === 'object' || context instanceof NodeList) { if (context instanceof Node) { return { include: [ context ], exclude: [] }; } if (context.hasOwnProperty('include') || context.hasOwnProperty('exclude')) { return { include: context.include && +context.include.length ? context.include : [ document ], exclude: context.exclude || [] }; } if (context.length === +context.length) { return { include: context, exclude: [] }; } } if (typeof context === 'string') { return { include: [ context ], exclude: [] }; } return { include: [ document ], exclude: [] }; } function parseSelectorArray(context, type) { 'use strict'; var item, result = [], nodeList; for (var i = 0, l = context[type].length; i < l; i++) { item = context[type][i]; if (typeof item === 'string') { nodeList = Array.from(document.querySelectorAll(item)); result = result.concat(nodeList.map(function(node) { return axe.utils.getNodeFromTree(context.flatTree[0], node); })); break; } else if (item && item.length && !(item instanceof Node)) { if (item.length > 1) { pushUniqueFrameSelector(context, type, item); } else { nodeList = Array.from(document.querySelectorAll(item[0])); result = result.concat(nodeList.map(function(node) { return axe.utils.getNodeFromTree(context.flatTree[0], node); })); } } else if (item instanceof Node) { if (item.documentElement instanceof Node) { result.push(context.flatTree[0]); } else { result.push(axe.utils.getNodeFromTree(context.flatTree[0], item)); } } } return result.filter(function(r) { return r; }); } function validateContext(context) { 'use strict'; if (context.include.length === 0) { if (context.frames.length === 0) { var env = axe.utils.respondable.isInFrame() ? 'frame' : 'page'; return new Error('No elements found for include in ' + env + ' Context'); } context.frames.forEach(function(frame, i) { if (frame.include.length === 0) { return new Error('No elements found for include in Context of frame ' + i); } }); } } function getRootNode(_ref) { var include = _ref.include, exclude = _ref.exclude; var selectors = Array.from(include).concat(Array.from(exclude)); var localDocument = selectors.reduce(function(result, item) { if (result) { return result; } else if (item instanceof Element) { return item.ownerDocument; } else if (item instanceof Document) { return item; } }, null); return (localDocument || document).documentElement; } function Context(spec) { 'use strict'; var _this = this; this.frames = []; this.initiator = spec && typeof spec.initiator === 'boolean' ? spec.initiator : true; this.page = false; spec = normalizeContext(spec); this.flatTree = axe.utils.getFlattenedTree(getRootNode(spec)); this.exclude = spec.exclude; this.include = spec.include; this.include = parseSelectorArray(this, 'include'); this.exclude = parseSelectorArray(this, 'exclude'); axe.utils.select('frame, iframe', this).forEach(function(frame) { if (isNodeInContext(frame, _this)) { pushUniqueFrame(_this.frames, frame.actualNode); } }); if (this.include.length === 1 && this.include[0].actualNode === document.documentElement) { this.page = true; } var err = validateContext(this); if (err instanceof Error) { throw err; } if (!Array.isArray(this.include)) { this.include = Array.from(this.include); } this.include.sort(axe.utils.nodeSorter); } 'use strict'; function RuleResult(rule) { 'use strict'; this.id = rule.id; this.result = axe.constants.NA; this.pageLevel = rule.pageLevel; this.impact = null; this.nodes = []; } 'use strict'; function Rule(spec, parentAudit) { 'use strict'; this._audit = parentAudit; this.id = spec.id; this.selector = spec.selector || '*'; this.excludeHidden = typeof spec.excludeHidden === 'boolean' ? spec.excludeHidden : true; this.enabled = typeof spec.enabled === 'boolean' ? spec.enabled : true; this.pageLevel = typeof spec.pageLevel === 'boolean' ? spec.pageLevel : false; this.any = spec.any || []; this.all = spec.all || []; this.none = spec.none || []; this.tags = spec.tags || []; this.preload = spec.preload ? true : false; if (spec.matches) { this.matches = createExecutionContext(spec.matches); } } Rule.prototype.matches = function() { 'use strict'; return true; }; Rule.prototype.gather = function(context) { 'use strict'; var elements = axe.utils.select(this.selector, context); if (this.excludeHidden) { return elements.filter(function(element) { return !axe.utils.isHidden(element.actualNode); }); } return elements; }; Rule.prototype.runChecks = function(type, node, options, context, resolve, reject) { 'use strict'; var self = this; var checkQueue = axe.utils.queue(); this[type].forEach(function(c) { var check = self._audit.checks[c.id || c]; var option = axe.utils.getCheckOption(check, self.id, options); checkQueue.defer(function(res, rej) { check.run(node, option, context, res, rej); }); }); checkQueue.then(function(results) { results = results.filter(function(check) { return check; }); resolve({ type: type, results: results }); }).catch(reject); }; Rule.prototype.run = function(context, options, resolve, reject) { var _this = this; var q = axe.utils.queue(); var ruleResult = new RuleResult(this); var markStart = 'mark_runchecks_start_' + this.id; var markEnd = 'mark_runchecks_end_' + this.id; var nodes = void 0; try { nodes = this.gather(context).filter(function(node) { return _this.matches(node.actualNode, node); }); } catch (error) { reject(new SupportError({ cause: error, ruleId: this.id })); return; } if (options.performanceTimer) { axe.log('gather (', nodes.length, '):', axe.utils.performanceTimer.timeElapsed() + 'ms'); axe.utils.performanceTimer.mark(markStart); } nodes.forEach(function(node) { q.defer(function(resolveNode, rejectNode) { var checkQueue = axe.utils.queue(); [ 'any', 'all', 'none' ].forEach(function(type) { checkQueue.defer(function(res, rej) { _this.runChecks(type, node, options, context, res, rej); }); }); checkQueue.then(function(results) { if (results.length) { var hasResults = false, result = {}; results.forEach(function(r) { var res = r.results.filter(function(result) { return result; }); result[r.type] = res; if (res.length) { hasResults = true; } }); if (hasResults) { result.node = new axe.utils.DqElement(node.actualNode, options); ruleResult.nodes.push(result); } } resolveNode(); }).catch(function(err) { return rejectNode(err); }); }); }); if (options.performanceTimer) { axe.utils.performanceTimer.mark(markEnd); axe.utils.performanceTimer.measure('runchecks_' + this.id, markStart, markEnd); } q.then(function() { return resolve(ruleResult); }).catch(function(error) { return reject(error); }); }; function findAfterChecks(rule) { 'use strict'; return axe.utils.getAllChecks(rule).map(function(c) { var check = rule._audit.checks[c.id || c]; return check && typeof check.after === 'function' ? check : null; }).filter(Boolean); } function findCheckResults(nodes, checkID) { 'use strict'; var checkResults = []; nodes.forEach(function(nodeResult) { var checks = axe.utils.getAllChecks(nodeResult); checks.forEach(function(checkResult) { if (checkResult.id === checkID) { checkResults.push(checkResult); } }); }); return checkResults; } function filterChecks(checks) { 'use strict'; return checks.filter(function(check) { return check.filtered !== true; }); } function sanitizeNodes(result) { 'use strict'; var checkTypes = [ 'any', 'all', 'none' ]; var nodes = result.nodes.filter(function(detail) { var length = 0; checkTypes.forEach(function(type) { detail[type] = filterChecks(detail[type]); length += detail[type].length; }); return length > 0; }); if (result.pageLevel && nodes.length) { nodes = [ nodes.reduce(function(a, b) { if (a) { checkTypes.forEach(function(type) { a[type].push.apply(a[type], b[type]); }); return a; } }) ]; } return nodes; } Rule.prototype.after = function(result, options) { 'use strict'; var afterChecks = findAfterChecks(this); var ruleID = this.id; afterChecks.forEach(function(check) { var beforeResults = findCheckResults(result.nodes, check.id); var option = axe.utils.getCheckOption(check, ruleID, options); var afterResults = check.after(beforeResults, option); beforeResults.forEach(function(item) { if (afterResults.indexOf(item) === -1) { item.filtered = true; } }); }); result.nodes = sanitizeNodes(result); return result; }; Rule.prototype.configure = function(spec) { 'use strict'; if (spec.hasOwnProperty('selector')) { this.selector = spec.selector; } if (spec.hasOwnProperty('excludeHidden')) { this.excludeHidden = typeof spec.excludeHidden === 'boolean' ? spec.excludeHidden : true; } if (spec.hasOwnProperty('enabled')) { this.enabled = typeof spec.enabled === 'boolean' ? spec.enabled : true; } if (spec.hasOwnProperty('pageLevel')) { this.pageLevel = typeof spec.pageLevel === 'boolean' ? spec.pageLevel : false; } if (spec.hasOwnProperty('any')) { this.any = spec.any; } if (spec.hasOwnProperty('all')) { this.all = spec.all; } if (spec.hasOwnProperty('none')) { this.none = spec.none; } if (spec.hasOwnProperty('tags')) { this.tags = spec.tags; } if (spec.hasOwnProperty('matches')) { if (typeof spec.matches === 'string') { this.matches = new Function('return ' + spec.matches + ';')(); } else { this.matches = spec.matches; } } }; 'use strict'; (function(axe) { var definitions = [ { name: 'NA', value: 'inapplicable', priority: 0, group: 'inapplicable' }, { name: 'PASS', value: 'passed', priority: 1, group: 'passes' }, { name: 'CANTTELL', value: 'cantTell', priority: 2, group: 'incomplete' }, { name: 'FAIL', value: 'failed', priority: 3, group: 'violations' } ]; var constants = { helpUrlBase: 'https://dequeuniversity.com/rules/', results: [], resultGroups: [], resultGroupMap: {}, impact: Object.freeze([ 'minor', 'moderate', 'serious', 'critical' ]), preloadAssets: Object.freeze([ 'cssom' ]), preloadAssetsTimeout: 1e4 }; definitions.forEach(function(definition) { var name = definition.name; var value = definition.value; var priority = definition.priority; var group = definition.group; constants[name] = value; constants[name + '_PRIO'] = priority; constants[name + '_GROUP'] = group; constants.results[priority] = value; constants.resultGroups[priority] = group; constants.resultGroupMap[value] = group; }); Object.freeze(constants.results); Object.freeze(constants.resultGroups); Object.freeze(constants.resultGroupMap); Object.freeze(constants); Object.defineProperty(axe, 'constants', { value: constants, enumerable: true, configurable: false, writable: false }); })(axe); 'use strict'; var _typeof = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ? function(obj) { return typeof obj; } : function(obj) { return obj && typeof Symbol === 'function' && obj.constructor === Symbol && obj !== Symbol.prototype ? 'symbol' : typeof obj; }; axe.imports['axios'] = function() { return function(modules) { var installedModules = {}; function __webpack_require__(moduleId) { if (installedModules[moduleId]) { return installedModules[moduleId].exports; } var module = installedModules[moduleId] = { exports: {}, id: moduleId, loaded: false }; modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); module.loaded = true; return module.exports; } __webpack_require__.m = modules; __webpack_require__.c = installedModules; __webpack_require__.p = ''; return __webpack_require__(0); }([ function(module, exports, __webpack_require__) { module.exports = __webpack_require__(1); }, function(module, exports, __webpack_require__) { 'use strict'; var utils = __webpack_require__(2); var bind = __webpack_require__(3); var Axios = __webpack_require__(5); var defaults = __webpack_require__(6); function createInstance(defaultConfig) { var context = new Axios(defaultConfig); var instance = bind(Axios.prototype.request, context); utils.extend(instance, Axios.prototype, context); utils.extend(instance, context); return instance; } var axios = createInstance(defaults); axios.Axios = Axios; axios.create = function create(instanceConfig) { return createInstance(utils.merge(defaults, instanceConfig)); }; axios.Cancel = __webpack_require__(23); axios.CancelToken = __webpack_require__(24); axios.isCancel = __webpack_require__(20); axios.all = function all(promises) { return Promise.all(promises); }; axios.spread = __webpack_require__(25); module.exports = axios; module.exports.default = axios; }, function(module, exports, __webpack_require__) { 'use strict'; var bind = __webpack_require__(3); var isBuffer = __webpack_require__(4); var toString = Object.prototype.toString; function isArray(val) { return toString.call(val) === '[object Array]'; } function isArrayBuffer(val) { return toString.call(val) === '[object ArrayBuffer]'; } function isFormData(val) { return typeof FormData !== 'undefined' && val instanceof FormData; } function isArrayBufferView(val) { var result; if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) { result = ArrayBuffer.isView(val); } else { result = val && val.buffer && val.buffer instanceof ArrayBuffer; } return result; } function isString(val) { return typeof val === 'string'; } function isNumber(val) { return typeof val === 'number'; } function isUndefined(val) { return typeof val === 'undefined'; } function isObject(val) { return val !== null && (typeof val === 'undefined' ? 'undefined' : _typeof(val)) === 'object'; } function isDate(val) { return toString.call(val) === '[object Date]'; } function isFile(val) { return toString.call(val) === '[object File]'; } function isBlob(val) { return toString.call(val) === '[object Blob]'; } function isFunction(val) { return toString.call(val) === '[object Function]'; } function isStream(val) { return isObject(val) && isFunction(val.pipe); } function isURLSearchParams(val) { return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams; } function trim(str) { return str.replace(/^\s*/, '').replace(/\s*$/, ''); } function isStandardBrowserEnv() { if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') { return false; } return typeof window !== 'undefined' && typeof document !== 'undefined'; } function forEach(obj, fn) { if (obj === null || typeof obj === 'undefined') { return; } if ((typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) !== 'object') { obj = [ obj ]; } if (isArray(obj)) { for (var i = 0, l = obj.length; i < l; i++) { fn.call(null, obj[i], i, obj); } } else { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { fn.call(null, obj[key], key, obj); } } } } function merge() { var result = {}; function assignValue(val, key) { if (_typeof(result[key]) === 'object' && (typeof val === 'undefined' ? 'undefined' : _typeof(val)) === 'object') { result[key] = merge(result[key], val); } else { result[key] = val; } } for (var i = 0, l = arguments.length; i < l; i++) { forEach(arguments[i], assignValue); } return result; } function extend(a, b, thisArg) { forEach(b, function assignValue(val, key) { if (thisArg && typeof val === 'function') { a[key] = bind(val, thisArg); } else { a[key] = val; } }); return a; } module.exports = { isArray: isArray, isArrayBuffer: isArrayBuffer, isBuffer: isBuffer, isFormData: isFormData, isArrayBufferView: isArrayBufferView, isString: isString, isNumber: isNumber, isObject: isObject, isUndefined: isUndefined, isDate: isDate, isFile: isFile, isBlob: isBlob, isFunction: isFunction, isStream: isStream, isURLSearchParams: isURLSearchParams, isStandardBrowserEnv: isStandardBrowserEnv, forEach: forEach, merge: merge, extend: extend, trim: trim }; }, function(module, exports) { 'use strict'; module.exports = function bind(fn, thisArg) { return function wrap() { var args = new Array(arguments.length); for (var i = 0; i < args.length; i++) { args[i] = arguments[i]; } return fn.apply(thisArg, args); }; }; }, function(module, exports) { /*! * Determine if an object is a Buffer * * @author Feross Aboukhadijeh <https://feross.org> * @license MIT */ module.exports = function(obj) { return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer); }; function isBuffer(obj) { return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj); } function isSlowBuffer(obj) { return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0)); } }, function(module, exports, __webpack_require__) { 'use strict'; var defaults = __webpack_require__(6); var utils = __webpack_require__(2); var InterceptorManager = __webpack_require__(17); var dispatchRequest = __webpack_require__(18); function Axios(instanceConfig) { this.defaults = instanceConfig; this.interceptors = { request: new InterceptorManager(), response: new InterceptorManager() }; } Axios.prototype.request = function request(config) { if (typeof config === 'string') { config = utils.merge({ url: arguments[0] }, arguments[1]); } config = utils.merge(defaults, { method: 'get' }, this.defaults, config); config.method = config.method.toLowerCase(); var chain = [ dispatchRequest, undefined ]; var promise = Promise.resolve(config); this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { chain.unshift(interceptor.fulfilled, interceptor.rejected); }); this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { chain.push(interceptor.fulfilled, interceptor.rejected); }); while (chain.length) { promise = promise.then(chain.shift(), chain.shift()); } return promise; }; utils.forEach([ 'delete', 'get', 'head', 'options' ], function forEachMethodNoData(method) { Axios.prototype[method] = function(url, config) { return this.request(utils.merge(config || {}, { method: method, url: url })); }; }); utils.forEach([ 'post', 'put', 'patch' ], function forEachMethodWithData(method) { Axios.prototype[method] = function(url, data, config) { return this.request(utils.merge(config || {}, { method: method, url: url, data: data })); }; }); module.exports = Axios; }, function(module, exports, __webpack_require__) { 'use strict'; var utils = __webpack_require__(2); var normalizeHeaderName = __webpack_require__(7); var DEFAULT_CONTENT_TYPE = { 'Content-Type': 'application/x-www-form-urlencoded' }; function setContentTypeIfUnset(headers, value) { if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) { headers['Content-Type'] = value; } } function getDefaultAdapter() { var adapter; if (typeof XMLHttpRequest !== 'undefined') { adapter = __webpack_require__(8); } else if (typeof process !== 'undefined') { adapter = __webpack_require__(8); } return adapter; } var defaults = { adapter: getDefaultAdapter(), transformRequest: [ function transformRequest(data, headers) { normalizeHeaderName(headers, 'Content-Type'); if (utils.isFormData(data) || utils.isArrayBuffer(data) || utils.isBuffer(data) || utils.isStream(data) || utils.isFile(data) || utils.isBlob(data)) { return data; } if (utils.isArrayBufferView(data)) { return data.buffer; } if (utils.isURLSearchParams(data)) { setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8'); return data.toString(); } if (utils.isObject(data)) { setContentTypeIfUnset(headers, 'application/json;charset=utf-8'); return JSON.stringify(data); } return data; } ], transformResponse: [ function transformResponse(data) { if (typeof data === 'string') { try { data = JSON.parse(data); } catch (e) {} } return data; } ], timeout: 0, xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN', maxContentLength: -1, validateStatus: function validateStatus(status) { return status >= 200 && status < 300; } }; defaults.headers = { common: { Accept: 'application/json, text/plain, */*' } }; utils.forEach([ 'delete', 'get', 'head' ], function forEachMethodNoData(method) { defaults.headers[method] = {}; }); utils.forEach([ 'post', 'put', 'patch' ], function forEachMethodWithData(method) { defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE); }); module.exports = defaults; }, function(module, exports, __webpack_require__) { 'use strict'; var utils = __webpack_require__(2); module.exports = function normalizeHeaderName(headers, normalizedName) { utils.forEach(headers, function processHeader(value, name) { if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) { headers[normalizedName] = value; delete headers[name]; } }); }; }, function(module, exports, __webpack_require__) { 'use strict'; var utils = __webpack_require__(2); var settle = __webpack_require__(9); var buildURL = __webpack_require__(12); var parseHeaders = __webpack_require__(13); var isURLSameOrigin = __webpack_require__(14); var createError = __webpack_require__(10); var btoa = typeof window !== 'undefined' && window.btoa && window.btoa.bind(window) || __webpack_require__(15); module.exports = function xhrAdapter(config) { return new Promise(function dispatchXhrRequest(resolve, reject) { var requestData = config.data; var requestHeaders = config.headers; if (utils.isFormData(requestData)) { delete requestHeaders['Content-Type']; } var request = new XMLHttpRequest(); var loadEvent = 'onreadystatechange'; var xDomain = false; if ('production' !== 'test' && typeof window !== 'undefined' && window.XDomainRequest && !('withCredentials' in request) && !isURLSameOrigin(config.url)) { request = new window.XDomainRequest(); loadEvent = 'onload'; xDomain = true; request.onprogress = function handleProgress() {}; request.ontimeout = function handleTimeout() {}; } if (config.auth) { var username = config.auth.username || ''; var password = config.auth.password || ''; requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password); } request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true); request.timeout = config.timeout; request[loadEvent] = function handleLoad() { if (!request || request.readyState !== 4 && !xDomain) { return; } if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) { return; } var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null; var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response; var response = { data: responseData, status: request.status === 1223 ? 204 : request.status, statusText: request.status === 1223 ? 'No Content' : request.statusText, headers: responseHeaders, config: config, request: request }; settle(resolve, reject, response); request = null; }; request.onerror = function handleError() { reject(createError('Network Error', config, null, request)); request = null; }; request.ontimeout = function handleTimeout() { reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED', request)); request = null; }; if (utils.isStandardBrowserEnv()) { var cookies = __webpack_require__(16); var xsrfValue = (config.withCredentials || isURLSameOrigin(config.url)) && config.xsrfCookieName ? cookies.read(config.xsrfCookieName) : undefined; if (xsrfValue) { requestHeaders[config.xsrfHeaderName] = xsrfValue; } } if ('setRequestHeader' in request) { utils.forEach(requestHeaders, function setRequestHeader(val, key) { if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') { delete requestHeaders[key]; } else { request.setRequestHeader(key, val); } }); } if (config.withCredentials) { request.withCredentials = true; } if (config.responseType) { try { request.responseType = config.responseType; } catch (e) { if (config.responseType !== 'json') { throw e; } } } if (typeof config.onDownloadProgress === 'function') { request.addEventListener('progress', config.onDownloadProgress); } if (typeof config.onUploadProgress === 'function' && request.upload) { request.upload.addEventListener('progress', config.onUploadProgress); } if (config.cancelToken) { config.cancelToken.promise.then(function onCanceled(cancel) { if (!request) { return; } request.abort(); reject(cancel); request = null; }); } if (requestData === undefined) { requestData = null; } request.send(requestData); }); }; }, function(module, exports, __webpack_require__) { 'use strict'; var createError = __webpack_require__(10); module.exports = function settle(resolve, reject, response) { var validateStatus = response.config.validateStatus; if (!response.status || !validateStatus || validateStatus(response.status)) { resolve(response); } else { reject(createError('Request failed with status code ' + response.status, response.config, null, response.request, response)); } }; }, function(module, exports, __webpack_require__) { 'use strict'; var enhanceError = __webpack_require__(11); module.exports = function createError(message, config, code, request, response) { var error