UNPKG

librecast-live

Version:

Live Streaming Video Platform with IPv6 Multicast

1,646 lines (1,376 loc) 248 kB
/*! * QUnit 2.17.2 * https://qunitjs.com/ * * Copyright OpenJS Foundation and other contributors * Released under the MIT license * https://jquery.org/license */ (function () { 'use strict'; // Support IE 9-10, Safari 7, PhantomJS: Partial Map fallback. // Used by html.js (via fuzzysort.js), and test.js. // // FIXME: This check is broken. This file is embedded in the qunit.js closure, // thus the Map var is hoisted in that scope, and starts undefined (not a function). var Map = typeof Map === "function" ? Map : function StringMap() { var store = Object.create( null ); var hasOwn = Object.prototype.hasOwnProperty; this.get = function( strKey ) { return store[ strKey ]; }; this.set = function( strKey, val ) { if ( !hasOwn.call( store, strKey ) ) { this.size++; } store[ strKey ] = val; return this; }; this.delete = function( strKey ) { if ( hasOwn.call( store, strKey ) ) { delete store[ strKey ]; this.size--; } }; this.forEach = function( callback ) { for ( var strKey in store ) { callback( store[ strKey ], strKey ); } }; this.clear = function() { store = Object.create( null ); this.size = 0; }; this.size = 0; }; function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function (obj) { return typeof obj; }; } else { _typeof = function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function () {}; return { s: F, n: function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function (e) { throw e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function () { it = it.call(o); }, n: function () { var step = it.next(); normalCompletion = step.done; return step; }, e: function (e) { didErr = true; err = e; }, f: function () { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } /* https://github.com/ungap/global-this/blob/v0.4.4/esm/index.js Copyright (c) 2020, Andrea Giammarchi, @WebReflection Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ------- Patches for use in QUnit: - 2021-02-25: Export as module only, don't change global scope as QUnit must not affect the host context (e.g. people may test their application intentionally with different or no polyfills and we must not affect that). */ var foundGlobalThis; (function (Object) { if ((typeof globalThis === "undefined" ? "undefined" : _typeof(globalThis)) === "object") { foundGlobalThis = globalThis; } else { var get = function get() { foundGlobalThis = this || self; delete Object.prototype._T_; }; this ? get() : (Object.defineProperty(Object.prototype, "_T_", { configurable: true, get: get }), _T_); } })(Object); var globalThis$1 = foundGlobalThis; var window$1 = globalThis$1.window; var self$1 = globalThis$1.self; var console$1 = globalThis$1.console; var setTimeout$1 = globalThis$1.setTimeout; var clearTimeout = globalThis$1.clearTimeout; var document = window$1 && window$1.document; var navigator = window$1 && window$1.navigator; var localSessionStorage = function () { var x = "qunit-test-string"; try { globalThis$1.sessionStorage.setItem(x, x); globalThis$1.sessionStorage.removeItem(x); return globalThis$1.sessionStorage; } catch (e) { return undefined; } }(); // Detect if the console object exists and no-op otherwise. // This allows support for IE 9, which doesn't have a console // object if the developer tools are not open. // Support: IE 9 // Function#bind is supported, but no console.log.bind(). // Support: SpiderMonkey (mozjs 68+) // The console object has a log method, but no warn method. var Logger = { warn: console$1 ? Function.prototype.bind.call(console$1.warn || console$1.log, console$1) : function () {} }; var toString = Object.prototype.toString; var hasOwn$1 = Object.prototype.hasOwnProperty; var now = Date.now || function () { return new Date().getTime(); }; var nativePerf = getNativePerf(); function getNativePerf() { if (window$1 && typeof window$1.performance !== "undefined" && typeof window$1.performance.mark === "function" && typeof window$1.performance.measure === "function") { return window$1.performance; } else { return undefined; } } var performance = { now: nativePerf ? nativePerf.now.bind(nativePerf) : now, measure: nativePerf ? function (comment, startMark, endMark) { // `performance.measure` may fail if the mark could not be found. // reasons a specific mark could not be found include: outside code invoking `performance.clearMarks()` try { nativePerf.measure(comment, startMark, endMark); } catch (ex) { Logger.warn("performance.measure could not be executed because of ", ex.message); } } : function () {}, mark: nativePerf ? nativePerf.mark.bind(nativePerf) : function () {} }; // Returns a new Array with the elements that are in a but not in b function diff(a, b) { var result = a.slice(); for (var i = 0; i < result.length; i++) { for (var j = 0; j < b.length; j++) { if (result[i] === b[j]) { result.splice(i, 1); i--; break; } } } return result; } /** * Determines whether an element exists in a given array or not. * * @method inArray * @param {any} elem * @param {Array} array * @return {boolean} */ function inArray(elem, array) { return array.indexOf(elem) !== -1; } /** * Makes a clone of an object using only Array or Object as base, * and copies over the own enumerable properties. * * @param {Object} obj * @return {Object} New object with only the own properties (recursively). */ function objectValues(obj) { var vals = is("array", obj) ? [] : {}; for (var key in obj) { if (hasOwn$1.call(obj, key)) { var val = obj[key]; vals[key] = val === Object(val) ? objectValues(val) : val; } } return vals; } function extend(a, b, undefOnly) { for (var prop in b) { if (hasOwn$1.call(b, prop)) { if (b[prop] === undefined) { delete a[prop]; } else if (!(undefOnly && typeof a[prop] !== "undefined")) { a[prop] = b[prop]; } } } return a; } function objectType(obj) { if (typeof obj === "undefined") { return "undefined"; } // Consider: typeof null === object if (obj === null) { return "null"; } var match = toString.call(obj).match(/^\[object\s(.*)\]$/); var type = match && match[1]; switch (type) { case "Number": if (isNaN(obj)) { return "nan"; } return "number"; case "String": case "Boolean": case "Array": case "Set": case "Map": case "Date": case "RegExp": case "Function": case "Symbol": return type.toLowerCase(); default: return _typeof(obj); } } // Safe object type checking function is(type, obj) { return objectType(obj) === type; } // Based on Java's String.hashCode, a simple but not // rigorously collision resistant hashing function function generateHash(module, testName) { var str = module + "\x1C" + testName; var hash = 0; for (var i = 0; i < str.length; i++) { hash = (hash << 5) - hash + str.charCodeAt(i); hash |= 0; } // Convert the possibly negative integer hash code into an 8 character hex string, which isn't // strictly necessary but increases user understanding that the id is a SHA-like hash var hex = (0x100000000 + hash).toString(16); if (hex.length < 8) { hex = "0000000" + hex; } return hex.slice(-8); } /** * Converts an error into a simple string for comparisons. * * @param {Error|any} error * @return {string} */ function errorString(error) { // Use String() instead of toString() to handle non-object values like undefined or null. var resultErrorString = String(error); // If the error wasn't a subclass of Error but something like // an object literal with name and message properties... if (resultErrorString.slice(0, 7) === "[object") { // Based on https://es5.github.io/#x15.11.4.4 return (error.name || "Error") + (error.message ? ": ".concat(error.message) : ""); } else { return resultErrorString; } } // Authors: Philippe Rathé <prathe@gmail.com>, David Chan <david@troi.org> var equiv = (function () { // Value pairs queued for comparison. Used for breadth-first processing order, recursion // detection and avoiding repeated comparison (see below for details). // Elements are { a: val, b: val }. var pairs = []; var getProto = Object.getPrototypeOf || function (obj) { return obj.__proto__; }; function useStrictEquality(a, b) { // This only gets called if a and b are not strict equal, and is used to compare on // the primitive values inside object wrappers. For example: // `var i = 1;` // `var j = new Number(1);` // Neither a nor b can be null, as a !== b and they have the same type. if (_typeof(a) === "object") { a = a.valueOf(); } if (_typeof(b) === "object") { b = b.valueOf(); } return a === b; } function compareConstructors(a, b) { var protoA = getProto(a); var protoB = getProto(b); // Comparing constructors is more strict than using `instanceof` if (a.constructor === b.constructor) { return true; } // Ref #851 // If the obj prototype descends from a null constructor, treat it // as a null prototype. if (protoA && protoA.constructor === null) { protoA = null; } if (protoB && protoB.constructor === null) { protoB = null; } // Allow objects with no prototype to be equivalent to // objects with Object as their constructor. if (protoA === null && protoB === Object.prototype || protoB === null && protoA === Object.prototype) { return true; } return false; } function getRegExpFlags(regexp) { return "flags" in regexp ? regexp.flags : regexp.toString().match(/[gimuy]*$/)[0]; } function isContainer(val) { return ["object", "array", "map", "set"].indexOf(objectType(val)) !== -1; } function breadthFirstCompareChild(a, b) { // If a is a container not reference-equal to b, postpone the comparison to the // end of the pairs queue -- unless (a, b) has been seen before, in which case skip // over the pair. if (a === b) { return true; } if (!isContainer(a)) { return typeEquiv(a, b); } if (pairs.every(function (pair) { return pair.a !== a || pair.b !== b; })) { // Not yet started comparing this pair pairs.push({ a: a, b: b }); } return true; } var callbacks = { "string": useStrictEquality, "boolean": useStrictEquality, "number": useStrictEquality, "null": useStrictEquality, "undefined": useStrictEquality, "symbol": useStrictEquality, "date": useStrictEquality, "nan": function nan() { return true; }, "regexp": function regexp(a, b) { return a.source === b.source && // Include flags in the comparison getRegExpFlags(a) === getRegExpFlags(b); }, // abort (identical references / instance methods were skipped earlier) "function": function _function() { return false; }, "array": function array(a, b) { var len = a.length; if (len !== b.length) { // Safe and faster return false; } for (var i = 0; i < len; i++) { // Compare non-containers; queue non-reference-equal containers if (!breadthFirstCompareChild(a[i], b[i])) { return false; } } return true; }, // Define sets a and b to be equivalent if for each element aVal in a, there // is some element bVal in b such that aVal and bVal are equivalent. Element // repetitions are not counted, so these are equivalent: // a = new Set( [ {}, [], [] ] ); // b = new Set( [ {}, {}, [] ] ); "set": function set(a, b) { if (a.size !== b.size) { // This optimization has certain quirks because of the lack of // repetition counting. For instance, adding the same // (reference-identical) element to two equivalent sets can // make them non-equivalent. return false; } var outerEq = true; a.forEach(function (aVal) { // Short-circuit if the result is already known. (Using for...of // with a break clause would be cleaner here, but it would cause // a syntax error on older JavaScript implementations even if // Set is unused) if (!outerEq) { return; } var innerEq = false; b.forEach(function (bVal) { // Likewise, short-circuit if the result is already known if (innerEq) { return; } // Swap out the global pairs list, as the nested call to // innerEquiv will clobber its contents var parentPairs = pairs; if (innerEquiv(bVal, aVal)) { innerEq = true; } // Replace the global pairs list pairs = parentPairs; }); if (!innerEq) { outerEq = false; } }); return outerEq; }, // Define maps a and b to be equivalent if for each key-value pair (aKey, aVal) // in a, there is some key-value pair (bKey, bVal) in b such that // [ aKey, aVal ] and [ bKey, bVal ] are equivalent. Key repetitions are not // counted, so these are equivalent: // a = new Map( [ [ {}, 1 ], [ {}, 1 ], [ [], 1 ] ] ); // b = new Map( [ [ {}, 1 ], [ [], 1 ], [ [], 1 ] ] ); "map": function map(a, b) { if (a.size !== b.size) { // This optimization has certain quirks because of the lack of // repetition counting. For instance, adding the same // (reference-identical) key-value pair to two equivalent maps // can make them non-equivalent. return false; } var outerEq = true; a.forEach(function (aVal, aKey) { // Short-circuit if the result is already known. (Using for...of // with a break clause would be cleaner here, but it would cause // a syntax error on older JavaScript implementations even if // Map is unused) if (!outerEq) { return; } var innerEq = false; b.forEach(function (bVal, bKey) { // Likewise, short-circuit if the result is already known if (innerEq) { return; } // Swap out the global pairs list, as the nested call to // innerEquiv will clobber its contents var parentPairs = pairs; if (innerEquiv([bVal, bKey], [aVal, aKey])) { innerEq = true; } // Replace the global pairs list pairs = parentPairs; }); if (!innerEq) { outerEq = false; } }); return outerEq; }, "object": function object(a, b) { if (compareConstructors(a, b) === false) { return false; } var aProperties = []; var bProperties = []; // Be strict: don't ensure hasOwnProperty and go deep for (var i in a) { // Collect a's properties aProperties.push(i); // Skip OOP methods that look the same if (a.constructor !== Object && typeof a.constructor !== "undefined" && typeof a[i] === "function" && typeof b[i] === "function" && a[i].toString() === b[i].toString()) { continue; } // Compare non-containers; queue non-reference-equal containers if (!breadthFirstCompareChild(a[i], b[i])) { return false; } } for (var _i in b) { // Collect b's properties bProperties.push(_i); } // Ensures identical properties name return typeEquiv(aProperties.sort(), bProperties.sort()); } }; function typeEquiv(a, b) { var type = objectType(a); // Callbacks for containers will append to the pairs queue to achieve breadth-first // search order. The pairs queue is also used to avoid reprocessing any pair of // containers that are reference-equal to a previously visited pair (a special case // this being recursion detection). // // Because of this approach, once typeEquiv returns a false value, it should not be // called again without clearing the pair queue else it may wrongly report a visited // pair as being equivalent. return objectType(b) === type && callbacks[type](a, b); } function innerEquiv(a, b) { // We're done when there's nothing more to compare if (arguments.length < 2) { return true; } // Clear the global pair queue and add the top-level values being compared pairs = [{ a: a, b: b }]; for (var i = 0; i < pairs.length; i++) { var pair = pairs[i]; // Perform type-specific comparison on any pairs that are not strictly // equal. For container types, that comparison will postpone comparison // of any sub-container pair to the end of the pair queue. This gives // breadth-first search order. It also avoids the reprocessing of // reference-equal siblings, cousins etc, which can have a significant speed // impact when comparing a container of small objects each of which has a // reference to the same (singleton) large object. if (pair.a !== pair.b && !typeEquiv(pair.a, pair.b)) { return false; } } // ...across all consecutive argument pairs return arguments.length === 2 || innerEquiv.apply(this, [].slice.call(arguments, 1)); } return function () { var result = innerEquiv.apply(void 0, arguments); // Release any retained objects pairs.length = 0; return result; }; })(); /** * Config object: Maintain internal state * Later exposed as QUnit.config * `config` initialized at top of scope */ var config = { // The queue of tests to run queue: [], stats: { all: 0, bad: 0, testCount: 0 }, // Block until document ready blocking: true, // whether or not to fail when there are zero tests // defaults to `true` failOnZeroTests: true, // By default, run previously failed tests first // very useful in combination with "Hide passed tests" checked reorder: true, // By default, modify document.title when suite is done altertitle: true, // HTML Reporter: collapse every test except the first failing test // If false, all failing tests will be expanded collapse: true, // By default, scroll to top of the page when suite is done scrolltop: true, // Depth up-to which object will be dumped maxDepth: 5, // When enabled, all tests must call expect() requireExpects: false, // Placeholder for user-configurable form-exposed URL parameters urlConfig: [], // Set of all modules. modules: [], // The first unnamed module currentModule: { name: "", tests: [], childModules: [], testsRun: 0, testsIgnored: 0, hooks: { before: [], beforeEach: [], afterEach: [], after: [] } }, callbacks: {}, // The storage module to use for reordering tests storage: localSessionStorage }; // take a predefined QUnit.config and extend the defaults var globalConfig = window$1 && window$1.QUnit && window$1.QUnit.config; // only extend the global config if there is no QUnit overload if (window$1 && window$1.QUnit && !window$1.QUnit.version) { extend(config, globalConfig); } // Push a loose unnamed module to the modules collection config.modules.push(config.currentModule); var dump = (function () { function quote(str) { return "\"" + str.toString().replace(/\\/g, "\\\\").replace(/"/g, "\\\"") + "\""; } function literal(o) { return o + ""; } function join(pre, arr, post) { var s = dump.separator(); var inner = dump.indent(1); if (arr.join) { arr = arr.join("," + s + inner); } if (!arr) { return pre + post; } var base = dump.indent(); return [pre, inner + arr, base + post].join(s); } function array(arr, stack) { if (dump.maxDepth && dump.depth > dump.maxDepth) { return "[object Array]"; } this.up(); var i = arr.length; var ret = new Array(i); while (i--) { ret[i] = this.parse(arr[i], undefined, stack); } this.down(); return join("[", ret, "]"); } function isArray(obj) { return (//Native Arrays toString.call(obj) === "[object Array]" || // NodeList objects typeof obj.length === "number" && obj.item !== undefined && (obj.length ? obj.item(0) === obj[0] : obj.item(0) === null && obj[0] === undefined) ); } var reName = /^function (\w+)/; var dump = { // The objType is used mostly internally, you can fix a (custom) type in advance parse: function parse(obj, objType, stack) { stack = stack || []; var objIndex = stack.indexOf(obj); if (objIndex !== -1) { return "recursion(".concat(objIndex - stack.length, ")"); } objType = objType || this.typeOf(obj); var parser = this.parsers[objType]; var parserType = _typeof(parser); if (parserType === "function") { stack.push(obj); var res = parser.call(this, obj, stack); stack.pop(); return res; } if (parserType === "string") { return parser; } return "[ERROR: Missing QUnit.dump formatter for type " + objType + "]"; }, typeOf: function typeOf(obj) { var type; if (obj === null) { type = "null"; } else if (typeof obj === "undefined") { type = "undefined"; } else if (is("regexp", obj)) { type = "regexp"; } else if (is("date", obj)) { type = "date"; } else if (is("function", obj)) { type = "function"; } else if (obj.setInterval !== undefined && obj.document !== undefined && obj.nodeType === undefined) { type = "window"; } else if (obj.nodeType === 9) { type = "document"; } else if (obj.nodeType) { type = "node"; } else if (isArray(obj)) { type = "array"; } else if (obj.constructor === Error.prototype.constructor) { type = "error"; } else { type = _typeof(obj); } return type; }, separator: function separator() { if (this.multiline) { return this.HTML ? "<br />" : "\n"; } else { return this.HTML ? "&#160;" : " "; } }, // Extra can be a number, shortcut for increasing-calling-decreasing indent: function indent(extra) { if (!this.multiline) { return ""; } var chr = this.indentChar; if (this.HTML) { chr = chr.replace(/\t/g, " ").replace(/ /g, "&#160;"); } return new Array(this.depth + (extra || 0)).join(chr); }, up: function up(a) { this.depth += a || 1; }, down: function down(a) { this.depth -= a || 1; }, setParser: function setParser(name, parser) { this.parsers[name] = parser; }, // The next 3 are exposed so you can use them quote: quote, literal: literal, join: join, depth: 1, maxDepth: config.maxDepth, // This is the list of parsers, to modify them, use dump.setParser parsers: { window: "[Window]", document: "[Document]", error: function error(_error) { return "Error(\"" + _error.message + "\")"; }, // This has been unused since QUnit 1.0.0. // @todo Deprecate and remove. unknown: "[Unknown]", "null": "null", "undefined": "undefined", "function": function _function(fn) { var ret = "function"; // Functions never have name in IE var name = "name" in fn ? fn.name : (reName.exec(fn) || [])[1]; if (name) { ret += " " + name; } ret += "("; ret = [ret, dump.parse(fn, "functionArgs"), "){"].join(""); return join(ret, dump.parse(fn, "functionCode"), "}"); }, array: array, nodelist: array, "arguments": array, object: function object(map, stack) { var ret = []; if (dump.maxDepth && dump.depth > dump.maxDepth) { return "[object Object]"; } dump.up(); var keys = []; for (var key in map) { keys.push(key); } // Some properties are not always enumerable on Error objects. var nonEnumerableProperties = ["message", "name"]; for (var i in nonEnumerableProperties) { var _key = nonEnumerableProperties[i]; if (_key in map && !inArray(_key, keys)) { keys.push(_key); } } keys.sort(); for (var _i = 0; _i < keys.length; _i++) { var _key2 = keys[_i]; var val = map[_key2]; ret.push(dump.parse(_key2, "key") + ": " + dump.parse(val, undefined, stack)); } dump.down(); return join("{", ret, "}"); }, node: function node(_node) { var open = dump.HTML ? "&lt;" : "<"; var close = dump.HTML ? "&gt;" : ">"; var tag = _node.nodeName.toLowerCase(); var ret = open + tag; var attrs = _node.attributes; if (attrs) { for (var i = 0, len = attrs.length; i < len; i++) { var val = attrs[i].nodeValue; // IE6 includes all attributes in .attributes, even ones not explicitly // set. Those have values like undefined, null, 0, false, "" or // "inherit". if (val && val !== "inherit") { ret += " " + attrs[i].nodeName + "=" + dump.parse(val, "attribute"); } } } ret += close; // Show content of TextNode or CDATASection if (_node.nodeType === 3 || _node.nodeType === 4) { ret += _node.nodeValue; } return ret + open + "/" + tag + close; }, // Function calls it internally, it's the arguments part of the function functionArgs: function functionArgs(fn) { var l = fn.length; if (!l) { return ""; } var args = new Array(l); while (l--) { // 97 is 'a' args[l] = String.fromCharCode(97 + l); } return " " + args.join(", ") + " "; }, // Object calls it internally, the key part of an item in a map key: quote, // Function calls it internally, it's the content of the function functionCode: "[code]", // Node calls it internally, it's a html attribute value attribute: quote, string: quote, date: quote, regexp: literal, number: literal, "boolean": literal, symbol: function symbol(sym) { return sym.toString(); } }, // If true, entities are escaped ( <, >, \t, space and \n ) HTML: false, // Indentation unit indentChar: " ", // If true, items in a collection, are separated by a \n, else just a space. multiline: true }; return dump; })(); var SuiteReport = /*#__PURE__*/function () { function SuiteReport(name, parentSuite) { _classCallCheck(this, SuiteReport); this.name = name; this.fullName = parentSuite ? parentSuite.fullName.concat(name) : []; // When an "error" event is emitted from onUncaughtException(), the // "runEnd" event should report the status as failed. // The "runEnd" event data is made by this class (as "globalSuite"). this.globalFailureCount = 0; this.tests = []; this.childSuites = []; if (parentSuite) { parentSuite.pushChildSuite(this); } } _createClass(SuiteReport, [{ key: "start", value: function start(recordTime) { if (recordTime) { this._startTime = performance.now(); var suiteLevel = this.fullName.length; performance.mark("qunit_suite_".concat(suiteLevel, "_start")); } return { name: this.name, fullName: this.fullName.slice(), tests: this.tests.map(function (test) { return test.start(); }), childSuites: this.childSuites.map(function (suite) { return suite.start(); }), testCounts: { total: this.getTestCounts().total } }; } }, { key: "end", value: function end(recordTime) { if (recordTime) { this._endTime = performance.now(); var suiteLevel = this.fullName.length; var suiteName = this.fullName.join(" – "); performance.mark("qunit_suite_".concat(suiteLevel, "_end")); performance.measure(suiteLevel === 0 ? "QUnit Test Run" : "QUnit Test Suite: ".concat(suiteName), "qunit_suite_".concat(suiteLevel, "_start"), "qunit_suite_".concat(suiteLevel, "_end")); } return { name: this.name, fullName: this.fullName.slice(), tests: this.tests.map(function (test) { return test.end(); }), childSuites: this.childSuites.map(function (suite) { return suite.end(); }), testCounts: this.getTestCounts(), runtime: this.getRuntime(), status: this.getStatus() }; } }, { key: "pushChildSuite", value: function pushChildSuite(suite) { this.childSuites.push(suite); } }, { key: "pushTest", value: function pushTest(test) { this.tests.push(test); } }, { key: "getRuntime", value: function getRuntime() { return this._endTime - this._startTime; } }, { key: "getTestCounts", value: function getTestCounts() { var counts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { passed: 0, failed: 0, skipped: 0, todo: 0, total: 0 }; counts.failed += this.globalFailureCount; counts.total += this.globalFailureCount; counts = this.tests.reduce(function (counts, test) { if (test.valid) { counts[test.getStatus()]++; counts.total++; } return counts; }, counts); return this.childSuites.reduce(function (counts, suite) { return suite.getTestCounts(counts); }, counts); } }, { key: "getStatus", value: function getStatus() { var _this$getTestCounts = this.getTestCounts(), total = _this$getTestCounts.total, failed = _this$getTestCounts.failed, skipped = _this$getTestCounts.skipped, todo = _this$getTestCounts.todo; if (failed) { return "failed"; } else { if (skipped === total) { return "skipped"; } else if (todo === total) { return "todo"; } else { return "passed"; } } } }]); return SuiteReport; }(); var moduleStack = []; function isParentModuleInQueue() { var modulesInQueue = config.modules.filter(function (module) { return !module.ignored; }).map(function (module) { return module.moduleId; }); return moduleStack.some(function (module) { return modulesInQueue.includes(module.moduleId); }); } function createModule(name, testEnvironment, modifiers) { var parentModule = moduleStack.length ? moduleStack.slice(-1)[0] : null; var moduleName = parentModule !== null ? [parentModule.name, name].join(" > ") : name; var parentSuite = parentModule ? parentModule.suiteReport : globalSuite; var skip = parentModule !== null && parentModule.skip || modifiers.skip; var todo = parentModule !== null && parentModule.todo || modifiers.todo; var module = { name: moduleName, parentModule: parentModule, tests: [], moduleId: generateHash(moduleName), testsRun: 0, testsIgnored: 0, childModules: [], suiteReport: new SuiteReport(name, parentSuite), // Pass along `skip` and `todo` properties from parent module, in case // there is one, to childs. And use own otherwise. // This property will be used to mark own tests and tests of child suites // as either `skipped` or `todo`. skip: skip, todo: skip ? false : todo, ignored: modifiers.ignored || false }; var env = {}; if (parentModule) { parentModule.childModules.push(module); extend(env, parentModule.testEnvironment); } extend(env, testEnvironment); module.testEnvironment = env; config.modules.push(module); return module; } function processModule(name, options, executeNow) { var modifiers = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; if (objectType(options) === "function") { executeNow = options; options = undefined; } var module = createModule(name, options, modifiers); // Move any hooks to a 'hooks' object var testEnvironment = module.testEnvironment; var hooks = module.hooks = {}; setHookFromEnvironment(hooks, testEnvironment, "before"); setHookFromEnvironment(hooks, testEnvironment, "beforeEach"); setHookFromEnvironment(hooks, testEnvironment, "afterEach"); setHookFromEnvironment(hooks, testEnvironment, "after"); var moduleFns = { before: setHookFunction(module, "before"), beforeEach: setHookFunction(module, "beforeEach"), afterEach: setHookFunction(module, "afterEach"), after: setHookFunction(module, "after") }; var prevModule = config.currentModule; config.currentModule = module; if (objectType(executeNow) === "function") { moduleStack.push(module); try { var cbReturnValue = executeNow.call(module.testEnvironment, moduleFns); if (cbReturnValue != null && objectType(cbReturnValue.then) === "function") { Logger.warn("Returning a promise from a module callback is not supported. " + "Instead, use hooks for async behavior. " + "This will become an error in QUnit 3.0."); } } finally { // If the module closure threw an uncaught error during the load phase, // we let this bubble up to global error handlers. But, not until after // we teardown internal state to ensure correct module nesting. // Ref https://github.com/qunitjs/qunit/issues/1478. moduleStack.pop(); config.currentModule = module.parentModule || prevModule; } } function setHookFromEnvironment(hooks, environment, name) { var potentialHook = environment[name]; hooks[name] = typeof potentialHook === "function" ? [potentialHook] : []; delete environment[name]; } function setHookFunction(module, hookName) { return function setHook(callback) { if (config.currentModule !== module) { Logger.warn("The `" + hookName + "` hook was called inside the wrong module (`" + config.currentModule.name + "`). " + "Instead, use hooks provided by the callback to the containing module (`" + module.name + "`). " + "This will become an error in QUnit 3.0."); } module.hooks[hookName].push(callback); }; } } var focused$1 = false; // indicates that the "only" filter was used function module$1(name, options, executeNow) { var ignored = focused$1 && !isParentModuleInQueue(); processModule(name, options, executeNow, { ignored: ignored }); } module$1.only = function () { if (!focused$1) { // Upon the first module.only() call, // delete any and all previously registered modules and tests. config.modules.length = 0; config.queue.length = 0; // Ignore any tests declared after this block within the same // module parent. https://github.com/qunitjs/qunit/issues/1645 config.currentModule.ignored = true; } focused$1 = true; processModule.apply(void 0, arguments); }; module$1.skip = function (name, options, executeNow) { if (focused$1) { return; } processModule(name, options, executeNow, { skip: true }); }; module$1.todo = function (name, options, executeNow) { if (focused$1) { return; } processModule(name, options, executeNow, { todo: true }); }; var LISTENERS = Object.create(null); var SUPPORTED_EVENTS = ["error", "runStart", "suiteStart", "testStart", "assertion", "testEnd", "suiteEnd", "runEnd"]; /** * Emits an event with the specified data to all currently registered listeners. * Callbacks will fire in the order in which they are registered (FIFO). This * function is not exposed publicly; it is used by QUnit internals to emit * logging events. * * @private * @method emit * @param {string} eventName * @param {Object} data * @return {void} */ function emit(eventName, data) { if (objectType(eventName) !== "string") { throw new TypeError("eventName must be a string when emitting an event"); } // Clone the callbacks in case one of them registers a new callback var originalCallbacks = LISTENERS[eventName]; var callbacks = originalCallbacks ? _toConsumableArray(originalCallbacks) : []; for (var i = 0; i < callbacks.length; i++) { callbacks[i](data); } } /** * Registers a callback as a listener to the specified event. * * @public * @method on * @param {string} eventName * @param {Function} callback * @return {void} */ function on(eventName, callback) { if (objectType(eventName) !== "string") { throw new TypeError("eventName must be a string when registering a listener"); } else if (!inArray(eventName, SUPPORTED_EVENTS)) { var events = SUPPORTED_EVENTS.join(", "); throw new Error("\"".concat(eventName, "\" is not a valid event; must be one of: ").concat(events, ".")); } else if (objectType(callback) !== "function") { throw new TypeError("callback must be a function when registering a listener"); } if (!LISTENERS[eventName]) { LISTENERS[eventName] = []; } // Don't register the same callback more than once if (!inArray(callback, LISTENERS[eventName])) { LISTENERS[eventName].push(callback); } } var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; function commonjsRequire (path) { throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.'); } var promisePolyfill = {exports: {}}; (function () { /** @suppress {undefinedVars} */ var globalNS = function () { // the only reliable means to get the global object is // `Function('return this')()` // However, this causes CSP violations in Chrome apps. if (typeof globalThis !== 'undefined') { return globalThis; } if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof commonjsGlobal !== 'undefined') { return commonjsGlobal; } throw new Error('unable to locate global object'); }(); // Expose the polyfill if Promise is undefined or set to a // non-function value. The latter can be due to a named HTMLElement // being exposed by browsers for legacy reasons. // https://github.com/taylorhakes/promise-polyfill/issues/114 if (typeof globalNS['Promise'] === 'function') { promisePolyfill.exports = globalNS['Promise']; return; } /** * @this {Promise} */ function finallyConstructor(callback) { var constructor = this.constructor; return this.then(function (value) { // @ts-ignore return constructor.resolve(callback()).then(function () { return value; }); }, function (reason) { // @ts-ignore return constructor.resolve(callback()).then(function () { // @ts-ignore return constructor.reject(reason); }); }); } function allSettled(arr) { var P = this; return new P(function (resolve, reject) { if (!(arr && typeof arr.length !== 'undefined')) { return reject(new TypeError(_typeof(arr) + ' ' + arr + ' is not iterable(cannot read property Symbol(Symbol.iterator))')); } var args = Array.prototype.slice.call(arr); if (args.length === 0) return resolve([]); var remaining = args.length; function res(i, val) { if (val && (_typeof(val) === 'object' || typeof val === 'function')) { var then = val.then; if (typeof then === 'function') { then.call(val, function (val) { res(i, val); }, function (e) { args[i] = { status: 'rejected', reason: e }; if (--remaining === 0) { resolve(args); } }); return; } } args[i] = { status: 'fulfilled', value: val }; if (--remaining === 0) { resolve(args); } } for (var i = 0; i < args.length; i++) { res(i, args[i]); } }); } // Store setTimeout reference so promise-polyfill will be unaffected by // other code modifying setTimeout (like sinon.useFakeTimers()) var setTimeoutFunc = setTimeout; function isArray(x) { return Boolean(x && typeof x.length !== 'undefined'); } function noop() {} // Polyfill for Function.prototype.bind function bind(fn, thisArg) { return function () { fn.apply(thisArg, arguments); }; } /** * @constructor * @param {Function} fn */ function Promise(fn) { if (!(this instanceof Promise)) throw new TypeError('Promises must be constructed via new'); if (typeof fn !== 'function') throw new TypeError('not a function'); /** @type {!number} */ this._state = 0; /** @type {!boolean} */ this._handled = false; /** @type {Promise|undefined} */ this._value = undefined; /** @type {!Array<!Function>} */ this._deferreds = []; doResolve(fn, this); } function handle(self, deferred) { while (self._state === 3) { self = self._value; } if (self._state === 0) { self._deferreds.push(deferred); return; } self._handled = true; Promise._immediateFn(function () { var cb = self._state === 1 ? deferred.onFulfilled : deferred.onRejected; if (cb === null) { (self._state === 1 ? resolve : reject)(deferred.promise, self._value); return; } var ret; try { ret = cb(self._value); } catch (e) { reject(deferred.promise, e); return; } resolve(deferred.promise, ret); }); } function resolve(self, newValue) { try { // Promise Resolution