diff --git a/.gitignore b/.gitignore index 79533bf5..97241f88 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ dist +!docs/dist dist-* cabal-dev *.o diff --git a/docs/.nojekyll b/docs/.nojekyll new file mode 100644 index 00000000..e69de29b diff --git a/docs/_snowpack/env.js b/docs/_snowpack/env.js new file mode 100644 index 00000000..6cb0af6a --- /dev/null +++ b/docs/_snowpack/env.js @@ -0,0 +1,3 @@ +export const MODE = "production"; +export const NODE_ENV = "production"; +export const SSR = false; \ No newline at end of file diff --git a/docs/_snowpack/link/strudel.js b/docs/_snowpack/link/strudel.js new file mode 100644 index 00000000..636f8060 --- /dev/null +++ b/docs/_snowpack/link/strudel.js @@ -0,0 +1,426 @@ +import Fraction from "../pkg/fractionjs.js"; +var removeUndefineds = function(xs) { + return xs.filter((x) => x != void 0); +}; +function flatten(arr) { + return [].concat(...arr); +} +var id = (a) => a; +Fraction.prototype.sam = function() { + return Fraction(Math.floor(this)); +}; +Fraction.prototype.nextSam = function() { + return this.sam().add(1); +}; +Fraction.prototype.wholeCycle = function() { + return new TimeSpan(this.sam(), this.nextSam()); +}; +Fraction.prototype.lt = function(other) { + return this.compare(other) < 0; +}; +Fraction.prototype.gt = function(other) { + return this.compare(other) > 0; +}; +Fraction.prototype.lte = function(other) { + return this.compare(other) <= 0; +}; +Fraction.prototype.gte = function(other) { + return this.compare(other) >= 0; +}; +Fraction.prototype.max = function(other) { + return this.gt(other) ? this : other; +}; +Fraction.prototype.min = function(other) { + return this.lt(other) ? this : other; +}; +Fraction.prototype.show = function() { + return this.n + "/" + this.d; +}; +class TimeSpan { + constructor(begin, end) { + this.begin = Fraction(begin); + this.end = Fraction(end); + } + get spanCycles() { + var spans = []; + var begin = this.begin; + var end = this.end; + var end_sam = end.sam(); + while (end.gt(begin)) { + if (begin.sam().equals(end_sam)) { + spans.push(new TimeSpan(begin, this.end)); + break; + } + var next_begin = begin.nextSam(); + spans.push(new TimeSpan(begin, next_begin)); + begin = next_begin; + } + return spans; + } + withTime(func_time) { + return new TimeSpan(func_time(this.begin), func_time(this.end)); + } + intersection(other) { + var intersect_begin = this.begin.max(other.begin); + var intersect_end = this.end.min(other.end); + if (intersect_begin.gt(intersect_end)) { + return void 0; + } + if (intersect_begin.equals(intersect_end)) { + if (intersect_begin.equals(this.end) && this.begin.lt(this.end)) { + return void 0; + } + if (intersect_begin.equals(other.end) && other.begin.lt(other.end)) { + return void 0; + } + } + return new TimeSpan(intersect_begin, intersect_end); + } + intersection_e(other) { + var result = this.intersection(other); + if (result == void 0) { + } + return result; + } + get midpoint() { + return this.begin.add(this.end.sub(this.begin).div(Fraction(2))); + } + equals(other) { + return this.begin.equals(other.begin) && this.end.equals(other.end); + } + show() { + return this.begin.show() + " -> " + this.end.show(); + } +} +class Hap { + constructor(whole, part, value) { + this.whole = whole; + this.part = part; + this.value = value; + } + withSpan(func) { + var whole = this.whole ? func(this.whole) : void 0; + return new Hap(whole, func(this.part), this.value); + } + withValue(func) { + return new Hap(this.whole, this.part, func(this.value)); + } + hasOnset() { + return this.whole != void 0 && this.whole.begin.equals(this.part.begin); + } + spanEquals(other) { + return this.whole == void 0 && other.whole == void 0 || this.whole.equals(other.whole); + } + equals(other) { + return this.spanEquals(other) && this.part.equals(other.part) && this.value === other.value; + } + show() { + return "(" + (this.whole == void 0 ? "~" : this.whole.show()) + ", " + this.part.show() + ", " + this.value + ")"; + } +} +class Pattern { + constructor(query2) { + this.query = query2; + } + _splitQueries() { + var pat = this; + var q = function(span) { + return flatten(span.spanCycles.map((subspan) => pat.query(subspan))); + }; + return new Pattern(q); + } + withQuerySpan(func) { + return new Pattern((span) => this.query(func(span))); + } + withQueryTime(func) { + return new Pattern((span) => this.query(span.withTime(func))); + } + withEventSpan(func) { + return new Pattern((span) => this.query(span).map((hap) => hap.withSpan(func))); + } + withEventTime(func) { + return this.withEventSpan((span) => span.withTime(func)); + } + withValue(func) { + return new Pattern((span) => this.query(span).map((hap) => hap.withValue(func))); + } + fmap(func) { + return this.withValue(func); + } + _filterEvents(event_test) { + return new Pattern((span) => this.query(span).filter(event_test)); + } + _filterValues(value_test) { + return new Pattern((span) => this.query(span).filter((hap) => value_test(hap.value))); + } + onsetsOnly() { + return this._filterEvents((hap) => hap.hasOnset()); + } + _appWhole(whole_func, pat_val) { + var pat_func = this; + query = function(span) { + var event_funcs = pat_func.query(span); + var event_vals = pat_val.query(span); + apply = function(event_func, event_val) { + var s = event_func.part.intersection(event_val.part); + if (s == void 0) { + return void 0; + } + return new Hap(whole_func(event_func.whole, event_val.whole), s, event_func.value(event_val.value)); + }; + return flatten(event_funcs.map((event_func) => removeUndefineds(event_vals.map((event_val) => apply(event_func, event_val))))); + }; + return new Pattern(query); + } + appBoth(pat_val) { + var whole_func = function(span_a, span_b) { + if (span_a == void 0 || span_B == void 0) { + return void 0; + } + return span_a.intersection_e(span_b); + }; + return this._appWhole(whole_func, pat_val); + } + appLeft(pat_val) { + var pat_func = this; + var query2 = function(span) { + var haps = []; + for (var hap_func of pat_func.query(span)) { + var event_vals = pat_val.query(hap_func.part); + for (var hap_val of event_vals) { + var new_whole = hap_func.whole; + var new_part = hap_func.part.intersection_e(hap_val.part); + var new_value = hap_func.value(hap_val.value); + var hap = new Hap(new_whole, new_part, new_value); + haps.push(hap); + } + } + return haps; + }; + return new Pattern(query2); + } + appRight(pat_val) { + var pat_func = this; + var query2 = function(span) { + var haps = []; + for (var hap_val of pat_val.query(span)) { + var hap_funcs = pat_func.query(hap_val.part); + for (var hap_func of hap_funcs) { + var new_whole = hap_val.whole; + var new_part = hap_func.part.intersection_e(hap_val.part); + var new_value = hap_func.value(hap_val.value); + var hap = new Hap(new_whole, new_part, new_value); + haps.push(hap); + } + } + return haps; + }; + return new Pattern(query2); + } + get firstCycle() { + return this.query(new TimeSpan(Fraction(0), Fraction(1))); + } + _opleft(other, func) { + return this.fmap(func).appLeft(reify(other)); + } + add(other) { + return this._opleft(other, (a) => (b) => a + b); + } + sub(other) { + return this._opleft(other, (a) => (b) => a - b); + } + union(other) { + return this._opleft(other, (a) => (b) => Object.assign({}, a, b)); + } + _bindWhole(choose_whole, func) { + var pat_val = this; + var query2 = function(span) { + var withWhole = function(a, b) { + return new Hap(choose_whole(a.whole, b.whole), b.part, b.value); + }; + var match = function(a) { + return func(a.value).query(a.part).map((b) => withWhole(a, b)); + }; + return flatten(pat_val.query(span).map(match)); + }; + return new Pattern(query2); + } + bind(func) { + var whole_func = function(a, b) { + if (a == void 0 || b == void 0) { + return void 0; + } + return a.intersection_e(b); + }; + return this._bindWhole(whole_func, func); + } + join() { + return this.bind(id); + } + innerBind(func) { + return this._bindWhole((a, _) => a, func); + } + innerJoin() { + return this.innerBind(id); + } + outerBind(func) { + return this._bindWhole((_, b) => b, func); + } + outerJoin() { + return this.outerBind(id); + } + _fast(factor) { + var fastQuery = this.withQueryTime((t) => t.mul(factor)); + return fastQuery.withEventTime((t) => t.div(factor)); + } + _slow(factor) { + return this._fast(1 / factor); + } + _early(offset) { + offset = Fraction(offset); + return this.withQueryTime((t) => t.add(offset)).withEventTime((t) => t.sub(offset)); + } + _late(offset) { + return this._early(0 - offset); + } + when(binary_pat, func) { + var true_pat = binary_pat._filterValues(id); + var false_pat = binary_pat._filterValues((val) => !val); + var with_pat = true_pat.fmap((_) => (y) => y).appRight(func(this)); + var without_pat = false_pat.fmap((_) => (y) => y).appRight(this); + return stack([with_pat, without_pat]); + } + off(time_pat, func) { + return stack([this, func(this._early(time_pat))]); + } + off(time_pat, func) { + return stack(this, func(this.early(time_pat))); + } + every(n, func) { + const pats = Array(n - 1).fill(this); + pats.unshift(this); + return slowcat(...pats); + } + append(other) { + return fastcat(...[this, other]); + } + rev() { + var pat = this; + var query2 = function(span) { + var cycle = span.begin.sam(); + var next_cycle = span.begin.nextSam(); + var reflect = function(to_reflect) { + var reflected = to_reflect.withTime((time) => cycle.add(next_cycle.sub(time))); + var tmp = reflected.begin; + reflected.begin = reflected.end; + reflected.end = tmp; + return reflected; + }; + var haps = pat.query(reflect(span)); + return haps.map((hap) => hap.withSpan(reflect)); + }; + return new Pattern(query2)._splitQueries(); + } + jux(func, by = 1) { + by /= 2; + var elem_or = function(dict, key, dflt) { + if (key in dict) { + return dict[key]; + } + return dflt; + }; + var left = this.withValue((val) => Object.assign({}, val, {pan: elem_or(val, "pan", 0.5) - by})); + var right = this.withValue((val) => Object.assign({}, val, {pan: elem_or(val, "pan", 0.5) + by})); + return stack([left, func(right)]); + } +} +function reify(thing) { + if (thing.constructor.name == "Pattern") { + return thing; + } + return pure(thing); +} +function pure(value) { + function query2(span) { + return span.spanCycles.map((subspan) => new Hap(Fraction(subspan.begin).wholeCycle(), subspan, value)); + } + return new Pattern(query2); +} +function steady(value) { + return new Pattern((span) => Hap(void 0, span, value)); +} +function stack(...pats) { + pats = pats.map(reify); + var query2 = function(span) { + return flatten(pats.map((pat) => pat.query(span))); + }; + return new Pattern(query2); +} +function slowcat(...pats) { + pats = pats.map(reify); + var query2 = function(span) { + var pat = pats[Math.floor(span.begin) % pats.length]; + return pat.query(span); + }; + return new Pattern(query2)._splitQueries(); +} +function fastcat(...pats) { + return slowcat(...pats)._fast(pats.length); +} +function cat(...pats) { + return fastcat(...pats); +} +function _sequenceCount(x) { + if (Array.isArray(x)) { + if (x.length == 0) { + return [silence(), 0]; + } + if (x.length == 1) { + return _sequenceCount(x[0]); + } + return [fastcat(...x.map((a) => _sequenceCount(a)[0])), x.length]; + } + return [reify(x), 1]; +} +function sequence(...xs) { + return _sequenceCount(xs)[0]; +} +function polymeter(steps = 0, ...args) { + var seqs = args.map(_sequenceCount); + if (seqs.length == 0) { + return silence(); + } + if (steps == 0) { + steps = seqs[0][1]; + } + var pats = []; + for (var seq of seqs) { + if (seq[1] == 0) { + next; + } + if (steps == seq[1]) { + pats.push(seq[0]); + } else { + pats.push(seq[0]._fast(Fraction(steps).div(Fraction(seq[1])))); + } + } + return stack(pats); +} +function silence() { + return new Pattern((_) => []); +} +export { + Fraction, + TimeSpan, + Hap, + Pattern, + pure, + reify, + stack, + slowcat, + fastcat, + cat, + sequence, + polymeter, + silence +}; diff --git a/docs/_snowpack/pkg/common/_commonjsHelpers-913f9c4a.js b/docs/_snowpack/pkg/common/_commonjsHelpers-913f9c4a.js new file mode 100644 index 00000000..673e6be4 --- /dev/null +++ b/docs/_snowpack/pkg/common/_commonjsHelpers-913f9c4a.js @@ -0,0 +1,19 @@ +function getDefaultExportFromCjs (x) { + return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; +} + +function createCommonjsModule(fn, basedir, module) { + return module = { + path: basedir, + exports: {}, + require: function (path, base) { + return commonjsRequire(path, (base === undefined || base === null) ? module.path : base); + } + }, fn(module, module.exports), module.exports; +} + +function commonjsRequire () { + throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs'); +} + +export { createCommonjsModule as c, getDefaultExportFromCjs as g }; diff --git a/docs/_snowpack/pkg/common/index-c9e50cb4.js b/docs/_snowpack/pkg/common/index-c9e50cb4.js new file mode 100644 index 00000000..5665ff62 --- /dev/null +++ b/docs/_snowpack/pkg/common/index-c9e50cb4.js @@ -0,0 +1,117 @@ +import { c as createCommonjsModule } from './_commonjsHelpers-913f9c4a.js'; + +/* +object-assign +(c) Sindre Sorhus +@license MIT +*/ +/* eslint-disable no-unused-vars */ +var getOwnPropertySymbols = Object.getOwnPropertySymbols; +var hasOwnProperty = Object.prototype.hasOwnProperty; +var propIsEnumerable = Object.prototype.propertyIsEnumerable; + +function toObject(val) { + if (val === null || val === undefined) { + throw new TypeError('Object.assign cannot be called with null or undefined'); + } + + return Object(val); +} + +function shouldUseNative() { + try { + if (!Object.assign) { + return false; + } + + // Detect buggy property enumeration order in older V8 versions. + + // https://bugs.chromium.org/p/v8/issues/detail?id=4118 + var test1 = new String('abc'); // eslint-disable-line no-new-wrappers + test1[5] = 'de'; + if (Object.getOwnPropertyNames(test1)[0] === '5') { + return false; + } + + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test2 = {}; + for (var i = 0; i < 10; i++) { + test2['_' + String.fromCharCode(i)] = i; + } + var order2 = Object.getOwnPropertyNames(test2).map(function (n) { + return test2[n]; + }); + if (order2.join('') !== '0123456789') { + return false; + } + + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test3 = {}; + 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { + test3[letter] = letter; + }); + if (Object.keys(Object.assign({}, test3)).join('') !== + 'abcdefghijklmnopqrst') { + return false; + } + + return true; + } catch (err) { + // We don't expect any of the above to throw, but better to be safe. + return false; + } +} + +var objectAssign = shouldUseNative() ? Object.assign : function (target, source) { + var from; + var to = toObject(target); + var symbols; + + for (var s = 1; s < arguments.length; s++) { + from = Object(arguments[s]); + + for (var key in from) { + if (hasOwnProperty.call(from, key)) { + to[key] = from[key]; + } + } + + if (getOwnPropertySymbols) { + symbols = getOwnPropertySymbols(from); + for (var i = 0; i < symbols.length; i++) { + if (propIsEnumerable.call(from, symbols[i])) { + to[symbols[i]] = from[symbols[i]]; + } + } + } + } + + return to; +}; + +var react_production_min = createCommonjsModule(function (module, exports) { +var n=60103,p=60106;exports.Fragment=60107;exports.StrictMode=60108;exports.Profiler=60114;var q=60109,r=60110,t=60112;exports.Suspense=60113;var u=60115,v=60116; +if("function"===typeof Symbol&&Symbol.for){var w=Symbol.for;n=w("react.element");p=w("react.portal");exports.Fragment=w("react.fragment");exports.StrictMode=w("react.strict_mode");exports.Profiler=w("react.profiler");q=w("react.provider");r=w("react.context");t=w("react.forward_ref");exports.Suspense=w("react.suspense");u=w("react.memo");v=w("react.lazy");}var x="function"===typeof Symbol&&Symbol.iterator; +function y(a){if(null===a||"object"!==typeof a)return null;a=x&&a[x]||a["@@iterator"];return "function"===typeof a?a:null}function z(a){for(var b="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=1;c , 1 => ] + * [ n => , d => ] + * + * Integer form + * - Single integer value + * + * Double form + * - Single double value + * + * String form + * 123.456 - a simple double + * 123/456 - a string fraction + * 123.'456' - a double with repeating decimal places + * 123.(456) - synonym + * 123.45'6' - a double with repeating last place + * 123.45(6) - synonym + * + * Example: + * + * var f = new Fraction("9.4'31'"); + * f.mul([-4, 3]).div(4.9); + * + */ + +(function(root) { + + // Maximum search depth for cyclic rational numbers. 2000 should be more than enough. + // Example: 1/7 = 0.(142857) has 6 repeating decimal places. + // If MAX_CYCLE_LEN gets reduced, long cycles will not be detected and toString() only gets the first 10 digits + var MAX_CYCLE_LEN = 2000; + + // Parsed data to avoid calling "new" all the time + var P = { + "s": 1, + "n": 0, + "d": 1 + }; + + function createError(name) { + + function errorConstructor() { + var temp = Error.apply(this, arguments); + temp['name'] = this['name'] = name; + this['stack'] = temp['stack']; + this['message'] = temp['message']; + } + + /** + * Error constructor + * + * @constructor + */ + function IntermediateInheritor() { } + IntermediateInheritor.prototype = Error.prototype; + errorConstructor.prototype = new IntermediateInheritor(); + + return errorConstructor; + } + + var DivisionByZero = Fraction['DivisionByZero'] = createError('DivisionByZero'); + var InvalidParameter = Fraction['InvalidParameter'] = createError('InvalidParameter'); + + function assign(n, s) { + + if (isNaN(n = parseInt(n, 10))) { + throwInvalidParam(); + } + return n * s; + } + + function throwInvalidParam() { + throw new InvalidParameter(); + } + + function factorize(num) { + + var factors = {}; + + var n = num; + var i = 2; + var s = 4; + + while (s <= n) { + + while (n % i === 0) { + n /= i; + factors[i] = (factors[i] || 0) + 1; + } + s += 1 + 2 * i++; + } + + if (n !== num) { + if (n > 1) + factors[n] = (factors[n] || 0) + 1; + } else { + factors[num] = (factors[num] || 0) + 1; + } + return factors; + } + + var parse = function(p1, p2) { + + var n = 0, d = 1, s = 1; + var v = 0, w = 0, x = 0, y = 1, z = 1; + + var A = 0, B = 1; + var C = 1, D = 1; + + var N = 10000000; + var M; + + if (p1 === undefined || p1 === null) ; else if (p2 !== undefined) { + n = p1; + d = p2; + s = n * d; + } else + switch (typeof p1) { + + case "object": + { + if ("d" in p1 && "n" in p1) { + n = p1["n"]; + d = p1["d"]; + if ("s" in p1) + n *= p1["s"]; + } else if (0 in p1) { + n = p1[0]; + if (1 in p1) + d = p1[1]; + } else { + throwInvalidParam(); + } + s = n * d; + break; + } + case "number": + { + if (p1 < 0) { + s = p1; + p1 = -p1; + } + + if (p1 % 1 === 0) { + n = p1; + } else if (p1 > 0) { // check for != 0, scale would become NaN (log(0)), which converges really slow + + if (p1 >= 1) { + z = Math.pow(10, Math.floor(1 + Math.log(p1) / Math.LN10)); + p1 /= z; + } + + // Using Farey Sequences + // http://www.johndcook.com/blog/2010/10/20/best-rational-approximation/ + + while (B <= N && D <= N) { + M = (A + C) / (B + D); + + if (p1 === M) { + if (B + D <= N) { + n = A + C; + d = B + D; + } else if (D > B) { + n = C; + d = D; + } else { + n = A; + d = B; + } + break; + + } else { + + if (p1 > M) { + A += C; + B += D; + } else { + C += A; + D += B; + } + + if (B > N) { + n = C; + d = D; + } else { + n = A; + d = B; + } + } + } + n *= z; + } else if (isNaN(p1) || isNaN(p2)) { + d = n = NaN; + } + break; + } + case "string": + { + B = p1.match(/\d+|./g); + + if (B === null) + throwInvalidParam(); + + if (B[A] === '-') {// Check for minus sign at the beginning + s = -1; + A++; + } else if (B[A] === '+') {// Check for plus sign at the beginning + A++; + } + + if (B.length === A + 1) { // Check if it's just a simple number "1234" + w = assign(B[A++], s); + } else if (B[A + 1] === '.' || B[A] === '.') { // Check if it's a decimal number + + if (B[A] !== '.') { // Handle 0.5 and .5 + v = assign(B[A++], s); + } + A++; + + // Check for decimal places + if (A + 1 === B.length || B[A + 1] === '(' && B[A + 3] === ')' || B[A + 1] === "'" && B[A + 3] === "'") { + w = assign(B[A], s); + y = Math.pow(10, B[A].length); + A++; + } + + // Check for repeating places + if (B[A] === '(' && B[A + 2] === ')' || B[A] === "'" && B[A + 2] === "'") { + x = assign(B[A + 1], s); + z = Math.pow(10, B[A + 1].length) - 1; + A += 3; + } + + } else if (B[A + 1] === '/' || B[A + 1] === ':') { // Check for a simple fraction "123/456" or "123:456" + w = assign(B[A], s); + y = assign(B[A + 2], 1); + A += 3; + } else if (B[A + 3] === '/' && B[A + 1] === ' ') { // Check for a complex fraction "123 1/2" + v = assign(B[A], s); + w = assign(B[A + 2], s); + y = assign(B[A + 4], 1); + A += 5; + } + + if (B.length <= A) { // Check for more tokens on the stack + d = y * z; + s = /* void */ + n = x + d * v + z * w; + break; + } + + /* Fall through on error */ + } + default: + throwInvalidParam(); + } + + if (d === 0) { + throw new DivisionByZero(); + } + + P["s"] = s < 0 ? -1 : 1; + P["n"] = Math.abs(n); + P["d"] = Math.abs(d); + }; + + function modpow(b, e, m) { + + var r = 1; + for (; e > 0; b = (b * b) % m, e >>= 1) { + + if (e & 1) { + r = (r * b) % m; + } + } + return r; + } + + + function cycleLen(n, d) { + + for (; d % 2 === 0; + d /= 2) { + } + + for (; d % 5 === 0; + d /= 5) { + } + + if (d === 1) // Catch non-cyclic numbers + return 0; + + // If we would like to compute really large numbers quicker, we could make use of Fermat's little theorem: + // 10^(d-1) % d == 1 + // However, we don't need such large numbers and MAX_CYCLE_LEN should be the capstone, + // as we want to translate the numbers to strings. + + var rem = 10 % d; + var t = 1; + + for (; rem !== 1; t++) { + rem = rem * 10 % d; + + if (t > MAX_CYCLE_LEN) + return 0; // Returning 0 here means that we don't print it as a cyclic number. It's likely that the answer is `d-1` + } + return t; + } + + + function cycleStart(n, d, len) { + + var rem1 = 1; + var rem2 = modpow(10, len, d); + + for (var t = 0; t < 300; t++) { // s < ~log10(Number.MAX_VALUE) + // Solve 10^s == 10^(s+t) (mod d) + + if (rem1 === rem2) + return t; + + rem1 = rem1 * 10 % d; + rem2 = rem2 * 10 % d; + } + return 0; + } + + function gcd(a, b) { + + if (!a) + return b; + if (!b) + return a; + + while (1) { + a %= b; + if (!a) + return b; + b %= a; + if (!b) + return a; + } + } + /** + * Module constructor + * + * @constructor + * @param {number|Fraction=} a + * @param {number=} b + */ + function Fraction(a, b) { + + if (!(this instanceof Fraction)) { + return new Fraction(a, b); + } + + parse(a, b); + + a = gcd(P["d"], P["n"]); // Abuse variable a + + this["s"] = P["s"]; + this["n"] = P["n"] / a; + this["d"] = P["d"] / a; + } + + Fraction.prototype = { + + "s": 1, + "n": 0, + "d": 1, + + /** + * Calculates the absolute value + * + * Ex: new Fraction(-4).abs() => 4 + **/ + "abs": function() { + + return new Fraction(this["n"], this["d"]); + }, + + /** + * Inverts the sign of the current fraction + * + * Ex: new Fraction(-4).neg() => 4 + **/ + "neg": function() { + + return new Fraction(-this["s"] * this["n"], this["d"]); + }, + + /** + * Adds two rational numbers + * + * Ex: new Fraction({n: 2, d: 3}).add("14.9") => 467 / 30 + **/ + "add": function(a, b) { + + parse(a, b); + return new Fraction( + this["s"] * this["n"] * P["d"] + P["s"] * this["d"] * P["n"], + this["d"] * P["d"] + ); + }, + + /** + * Subtracts two rational numbers + * + * Ex: new Fraction({n: 2, d: 3}).add("14.9") => -427 / 30 + **/ + "sub": function(a, b) { + + parse(a, b); + return new Fraction( + this["s"] * this["n"] * P["d"] - P["s"] * this["d"] * P["n"], + this["d"] * P["d"] + ); + }, + + /** + * Multiplies two rational numbers + * + * Ex: new Fraction("-17.(345)").mul(3) => 5776 / 111 + **/ + "mul": function(a, b) { + + parse(a, b); + return new Fraction( + this["s"] * P["s"] * this["n"] * P["n"], + this["d"] * P["d"] + ); + }, + + /** + * Divides two rational numbers + * + * Ex: new Fraction("-17.(345)").inverse().div(3) + **/ + "div": function(a, b) { + + parse(a, b); + return new Fraction( + this["s"] * P["s"] * this["n"] * P["d"], + this["d"] * P["n"] + ); + }, + + /** + * Clones the actual object + * + * Ex: new Fraction("-17.(345)").clone() + **/ + "clone": function() { + return new Fraction(this); + }, + + /** + * Calculates the modulo of two rational numbers - a more precise fmod + * + * Ex: new Fraction('4.(3)').mod([7, 8]) => (13/3) % (7/8) = (5/6) + **/ + "mod": function(a, b) { + + if (isNaN(this['n']) || isNaN(this['d'])) { + return new Fraction(NaN); + } + + if (a === undefined) { + return new Fraction(this["s"] * this["n"] % this["d"], 1); + } + + parse(a, b); + if (0 === P["n"] && 0 === this["d"]) { + Fraction(0, 0); // Throw DivisionByZero + } + + /* + * First silly attempt, kinda slow + * + return that["sub"]({ + "n": num["n"] * Math.floor((this.n / this.d) / (num.n / num.d)), + "d": num["d"], + "s": this["s"] + });*/ + + /* + * New attempt: a1 / b1 = a2 / b2 * q + r + * => b2 * a1 = a2 * b1 * q + b1 * b2 * r + * => (b2 * a1 % a2 * b1) / (b1 * b2) + */ + return new Fraction( + this["s"] * (P["d"] * this["n"]) % (P["n"] * this["d"]), + P["d"] * this["d"] + ); + }, + + /** + * Calculates the fractional gcd of two rational numbers + * + * Ex: new Fraction(5,8).gcd(3,7) => 1/56 + */ + "gcd": function(a, b) { + + parse(a, b); + + // gcd(a / b, c / d) = gcd(a, c) / lcm(b, d) + + return new Fraction(gcd(P["n"], this["n"]) * gcd(P["d"], this["d"]), P["d"] * this["d"]); + }, + + /** + * Calculates the fractional lcm of two rational numbers + * + * Ex: new Fraction(5,8).lcm(3,7) => 15 + */ + "lcm": function(a, b) { + + parse(a, b); + + // lcm(a / b, c / d) = lcm(a, c) / gcd(b, d) + + if (P["n"] === 0 && this["n"] === 0) { + return new Fraction; + } + return new Fraction(P["n"] * this["n"], gcd(P["n"], this["n"]) * gcd(P["d"], this["d"])); + }, + + /** + * Calculates the ceil of a rational number + * + * Ex: new Fraction('4.(3)').ceil() => (5 / 1) + **/ + "ceil": function(places) { + + places = Math.pow(10, places || 0); + + if (isNaN(this["n"]) || isNaN(this["d"])) { + return new Fraction(NaN); + } + return new Fraction(Math.ceil(places * this["s"] * this["n"] / this["d"]), places); + }, + + /** + * Calculates the floor of a rational number + * + * Ex: new Fraction('4.(3)').floor() => (4 / 1) + **/ + "floor": function(places) { + + places = Math.pow(10, places || 0); + + if (isNaN(this["n"]) || isNaN(this["d"])) { + return new Fraction(NaN); + } + return new Fraction(Math.floor(places * this["s"] * this["n"] / this["d"]), places); + }, + + /** + * Rounds a rational numbers + * + * Ex: new Fraction('4.(3)').round() => (4 / 1) + **/ + "round": function(places) { + + places = Math.pow(10, places || 0); + + if (isNaN(this["n"]) || isNaN(this["d"])) { + return new Fraction(NaN); + } + return new Fraction(Math.round(places * this["s"] * this["n"] / this["d"]), places); + }, + + /** + * Gets the inverse of the fraction, means numerator and denominator are exchanged + * + * Ex: new Fraction([-3, 4]).inverse() => -4 / 3 + **/ + "inverse": function() { + + return new Fraction(this["s"] * this["d"], this["n"]); + }, + + /** + * Calculates the fraction to some rational exponent, if possible + * + * Ex: new Fraction(-1,2).pow(-3) => -8 + */ + "pow": function(a, b) { + + parse(a, b); + + // Trivial case when exp is an integer + + if (P['d'] === 1) { + + if (P['s'] < 0) { + return new Fraction(Math.pow(this['s'] * this["d"], P['n']), Math.pow(this["n"], P['n'])); + } else { + return new Fraction(Math.pow(this['s'] * this["n"], P['n']), Math.pow(this["d"], P['n'])); + } + } + + // Negative roots become complex + // (-a/b)^(c/d) = x + // <=> (-1)^(c/d) * (a/b)^(c/d) = x + // <=> (cos(pi) + i*sin(pi))^(c/d) * (a/b)^(c/d) = x # rotate 1 by 180° + // <=> (cos(c*pi/d) + i*sin(c*pi/d)) * (a/b)^(c/d) = x # DeMoivre's formula in Q ( https://proofwiki.org/wiki/De_Moivre%27s_Formula/Rational_Index ) + // From which follows that only for c=0 the root is non-complex. c/d is a reduced fraction, so that sin(c/dpi)=0 occurs for d=1, which is handled by our trivial case. + if (this['s'] < 0) return null; + + // Now prime factor n and d + var N = factorize(this['n']); + var D = factorize(this['d']); + + // Exponentiate and take root for n and d individually + var n = 1; + var d = 1; + for (var k in N) { + if (k === '1') continue; + if (k === '0') { + n = 0; + break; + } + N[k]*= P['n']; + + if (N[k] % P['d'] === 0) { + N[k]/= P['d']; + } else return null; + n*= Math.pow(k, N[k]); + } + + for (var k in D) { + if (k === '1') continue; + D[k]*= P['n']; + + if (D[k] % P['d'] === 0) { + D[k]/= P['d']; + } else return null; + d*= Math.pow(k, D[k]); + } + + if (P['s'] < 0) { + return new Fraction(d, n); + } + return new Fraction(n, d); + }, + + /** + * Check if two rational numbers are the same + * + * Ex: new Fraction(19.6).equals([98, 5]); + **/ + "equals": function(a, b) { + + parse(a, b); + return this["s"] * this["n"] * P["d"] === P["s"] * P["n"] * this["d"]; // Same as compare() === 0 + }, + + /** + * Check if two rational numbers are the same + * + * Ex: new Fraction(19.6).equals([98, 5]); + **/ + "compare": function(a, b) { + + parse(a, b); + var t = (this["s"] * this["n"] * P["d"] - P["s"] * P["n"] * this["d"]); + return (0 < t) - (t < 0); + }, + + "simplify": function(eps) { + + // First naive implementation, needs improvement + + if (isNaN(this['n']) || isNaN(this['d'])) { + return this; + } + + var cont = this['abs']()['toContinued'](); + + eps = eps || 0.001; + + function rec(a) { + if (a.length === 1) + return new Fraction(a[0]); + return rec(a.slice(1))['inverse']()['add'](a[0]); + } + + for (var i = 0; i < cont.length; i++) { + var tmp = rec(cont.slice(0, i + 1)); + if (tmp['sub'](this['abs']())['abs']().valueOf() < eps) { + return tmp['mul'](this['s']); + } + } + return this; + }, + + /** + * Check if two rational numbers are divisible + * + * Ex: new Fraction(19.6).divisible(1.5); + */ + "divisible": function(a, b) { + + parse(a, b); + return !(!(P["n"] * this["d"]) || ((this["n"] * P["d"]) % (P["n"] * this["d"]))); + }, + + /** + * Returns a decimal representation of the fraction + * + * Ex: new Fraction("100.'91823'").valueOf() => 100.91823918239183 + **/ + 'valueOf': function() { + + return this["s"] * this["n"] / this["d"]; + }, + + /** + * Returns a string-fraction representation of a Fraction object + * + * Ex: new Fraction("1.'3'").toFraction() => "4 1/3" + **/ + 'toFraction': function(excludeWhole) { + + var whole, str = ""; + var n = this["n"]; + var d = this["d"]; + if (this["s"] < 0) { + str += '-'; + } + + if (d === 1) { + str += n; + } else { + + if (excludeWhole && (whole = Math.floor(n / d)) > 0) { + str += whole; + str += " "; + n %= d; + } + + str += n; + str += '/'; + str += d; + } + return str; + }, + + /** + * Returns a latex representation of a Fraction object + * + * Ex: new Fraction("1.'3'").toLatex() => "\frac{4}{3}" + **/ + 'toLatex': function(excludeWhole) { + + var whole, str = ""; + var n = this["n"]; + var d = this["d"]; + if (this["s"] < 0) { + str += '-'; + } + + if (d === 1) { + str += n; + } else { + + if (excludeWhole && (whole = Math.floor(n / d)) > 0) { + str += whole; + n %= d; + } + + str += "\\frac{"; + str += n; + str += '}{'; + str += d; + str += '}'; + } + return str; + }, + + /** + * Returns an array of continued fraction elements + * + * Ex: new Fraction("7/8").toContinued() => [0,1,7] + */ + 'toContinued': function() { + + var t; + var a = this['n']; + var b = this['d']; + var res = []; + + if (isNaN(a) || isNaN(b)) { + return res; + } + + do { + res.push(Math.floor(a / b)); + t = a % b; + a = b; + b = t; + } while (a !== 1); + + return res; + }, + + /** + * Creates a string representation of a fraction with all digits + * + * Ex: new Fraction("100.'91823'").toString() => "100.(91823)" + **/ + 'toString': function(dec) { + var N = this["n"]; + var D = this["d"]; + + if (isNaN(N) || isNaN(D)) { + return "NaN"; + } + + dec = dec || 15; // 15 = decimal places when no repetation + + var cycLen = cycleLen(N, D); // Cycle length + var cycOff = cycleStart(N, D, cycLen); // Cycle start + + var str = this['s'] === -1 ? "-" : ""; + + str += N / D | 0; + + N %= D; + N *= 10; + + if (N) + str += "."; + + if (cycLen) { + + for (var i = cycOff; i--;) { + str += N / D | 0; + N %= D; + N *= 10; + } + str += "("; + for (var i = cycLen; i--;) { + str += N / D | 0; + N %= D; + N *= 10; + } + str += ")"; + } else { + for (var i = dec; N && i--;) { + str += N / D | 0; + N %= D; + N *= 10; + } + } + return str; + } + }; + + { + Object.defineProperty(Fraction, "__esModule", { 'value': true }); + Fraction['default'] = Fraction; + Fraction['Fraction'] = Fraction; + module['exports'] = Fraction; + } + +})(); +}); + +var __pika_web_default_export_for_treeshaking__ = /*@__PURE__*/getDefaultExportFromCjs(fraction); + +export default __pika_web_default_export_for_treeshaking__; diff --git a/docs/_snowpack/pkg/import-map.json b/docs/_snowpack/pkg/import-map.json new file mode 100644 index 00000000..e4c35bfb --- /dev/null +++ b/docs/_snowpack/pkg/import-map.json @@ -0,0 +1,8 @@ +{ + "imports": { + "fraction.js": "./fractionjs.js", + "react": "./react.js", + "react-dom": "./react-dom.js", + "tone": "./tone.js" + } +} \ No newline at end of file diff --git a/docs/_snowpack/pkg/react-dom.js b/docs/_snowpack/pkg/react-dom.js new file mode 100644 index 00000000..9bf31488 --- /dev/null +++ b/docs/_snowpack/pkg/react-dom.js @@ -0,0 +1,355 @@ +import { c as createCommonjsModule } from './common/_commonjsHelpers-913f9c4a.js'; +import { r as react, o as objectAssign } from './common/index-c9e50cb4.js'; + +var scheduler_production_min = createCommonjsModule(function (module, exports) { +var f,g,h,k;if("object"===typeof performance&&"function"===typeof performance.now){var l=performance;exports.unstable_now=function(){return l.now()};}else {var p=Date,q=p.now();exports.unstable_now=function(){return p.now()-q};} +if("undefined"===typeof window||"function"!==typeof MessageChannel){var t=null,u=null,w=function(){if(null!==t)try{var a=exports.unstable_now();t(!0,a);t=null;}catch(b){throw setTimeout(w,0),b;}};f=function(a){null!==t?setTimeout(f,0,a):(t=a,setTimeout(w,0));};g=function(a,b){u=setTimeout(a,b);};h=function(){clearTimeout(u);};exports.unstable_shouldYield=function(){return !1};k=exports.unstable_forceFrameRate=function(){};}else {var x=window.setTimeout,y=window.clearTimeout;if("undefined"!==typeof console){var z= +window.cancelAnimationFrame;"function"!==typeof window.requestAnimationFrame&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills");"function"!==typeof z&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills");}var A=!1,B=null,C=-1,D=5,E=0;exports.unstable_shouldYield=function(){return exports.unstable_now()>= +E};k=function(){};exports.unstable_forceFrameRate=function(a){0>a||125>>1,e=a[d];if(void 0!==e&&0I(n,c))void 0!==r&&0>I(r,n)?(a[d]=r,a[v]=c,d=v):(a[d]=n,a[m]=c,d=m);else if(void 0!==r&&0>I(r,c))a[d]=r,a[v]=c,d=v;else break a}}return b}return null}function I(a,b){var c=a.sortIndex-b.sortIndex;return 0!==c?c:a.id-b.id}var L=[],M=[],N=1,O=null,P=3,Q=!1,R=!1,S=!1; +function T(a){for(var b=J(M);null!==b;){if(null===b.callback)K(M);else if(b.startTime<=a)K(M),b.sortIndex=b.expirationTime,H(L,b);else break;b=J(M);}}function U(a){S=!1;T(a);if(!R)if(null!==J(L))R=!0,f(V);else {var b=J(M);null!==b&&g(U,b.startTime-a);}} +function V(a,b){R=!1;S&&(S=!1,h());Q=!0;var c=P;try{T(b);for(O=J(L);null!==O&&(!(O.expirationTime>b)||a&&!exports.unstable_shouldYield());){var d=O.callback;if("function"===typeof d){O.callback=null;P=O.priorityLevel;var e=d(O.expirationTime<=b);b=exports.unstable_now();"function"===typeof e?O.callback=e:O===J(L)&&K(L);T(b);}else K(L);O=J(L);}if(null!==O)var m=!0;else {var n=J(M);null!==n&&g(U,n.startTime-b);m=!1;}return m}finally{O=null,P=c,Q=!1;}}var W=k;exports.unstable_IdlePriority=5; +exports.unstable_ImmediatePriority=1;exports.unstable_LowPriority=4;exports.unstable_NormalPriority=3;exports.unstable_Profiling=null;exports.unstable_UserBlockingPriority=2;exports.unstable_cancelCallback=function(a){a.callback=null;};exports.unstable_continueExecution=function(){R||Q||(R=!0,f(V));};exports.unstable_getCurrentPriorityLevel=function(){return P};exports.unstable_getFirstCallbackNode=function(){return J(L)}; +exports.unstable_next=function(a){switch(P){case 1:case 2:case 3:var b=3;break;default:b=P;}var c=P;P=b;try{return a()}finally{P=c;}};exports.unstable_pauseExecution=function(){};exports.unstable_requestPaint=W;exports.unstable_runWithPriority=function(a,b){switch(a){case 1:case 2:case 3:case 4:case 5:break;default:a=3;}var c=P;P=a;try{return b()}finally{P=c;}}; +exports.unstable_scheduleCallback=function(a,b,c){var d=exports.unstable_now();"object"===typeof c&&null!==c?(c=c.delay,c="number"===typeof c&&0d?(a.sortIndex=c,H(M,a),null===J(L)&&a===J(M)&&(S?h():S=!0,g(U,c-d))):(a.sortIndex=e,H(L,a),R||Q||(R=!0,f(V)));return a}; +exports.unstable_wrapCallback=function(a){var b=P;return function(){var c=P;P=b;try{return a.apply(this,arguments)}finally{P=c;}}}; +}); + +var scheduler = createCommonjsModule(function (module) { + +{ + module.exports = scheduler_production_min; +} +}); + +function y(a){for(var b="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=1;cb}return !1}function B(a,b,c,d,e,f,g){this.acceptsBooleans=2===b||3===b||4===b;this.attributeName=d;this.attributeNamespace=e;this.mustUseProperty=c;this.propertyName=a;this.type=b;this.sanitizeURL=f;this.removeEmptyString=g;}var D={}; +"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(a){D[a]=new B(a,0,!1,a,null,!1,!1);});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(a){var b=a[0];D[b]=new B(b,1,!1,a[1],null,!1,!1);});["contentEditable","draggable","spellCheck","value"].forEach(function(a){D[a]=new B(a,2,!1,a.toLowerCase(),null,!1,!1);}); +["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(a){D[a]=new B(a,2,!1,a,null,!1,!1);});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(a){D[a]=new B(a,3,!1,a.toLowerCase(),null,!1,!1);}); +["checked","multiple","muted","selected"].forEach(function(a){D[a]=new B(a,3,!0,a,null,!1,!1);});["capture","download"].forEach(function(a){D[a]=new B(a,4,!1,a,null,!1,!1);});["cols","rows","size","span"].forEach(function(a){D[a]=new B(a,6,!1,a,null,!1,!1);});["rowSpan","start"].forEach(function(a){D[a]=new B(a,5,!1,a.toLowerCase(),null,!1,!1);});var oa=/[\-:]([a-z])/g;function pa(a){return a[1].toUpperCase()} +"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(a){var b=a.replace(oa, +pa);D[b]=new B(b,1,!1,a,null,!1,!1);});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(a){var b=a.replace(oa,pa);D[b]=new B(b,1,!1,a,"http://www.w3.org/1999/xlink",!1,!1);});["xml:base","xml:lang","xml:space"].forEach(function(a){var b=a.replace(oa,pa);D[b]=new B(b,1,!1,a,"http://www.w3.org/XML/1998/namespace",!1,!1);});["tabIndex","crossOrigin"].forEach(function(a){D[a]=new B(a,1,!1,a.toLowerCase(),null,!1,!1);}); +D.xlinkHref=new B("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(a){D[a]=new B(a,1,!1,a.toLowerCase(),null,!0,!0);}); +function qa(a,b,c,d){var e=D.hasOwnProperty(b)?D[b]:null;var f=null!==e?0===e.type:d?!1:!(2h||e[g]!==f[h])return "\n"+e[g].replace(" at new "," at ");while(1<=g&&0<=h)}break}}}finally{Oa=!1,Error.prepareStackTrace=c;}return (a=a?a.displayName||a.name:"")?Na(a):""} +function Qa(a){switch(a.tag){case 5:return Na(a.type);case 16:return Na("Lazy");case 13:return Na("Suspense");case 19:return Na("SuspenseList");case 0:case 2:case 15:return a=Pa(a.type,!1),a;case 11:return a=Pa(a.type.render,!1),a;case 22:return a=Pa(a.type._render,!1),a;case 1:return a=Pa(a.type,!0),a;default:return ""}} +function Ra(a){if(null==a)return null;if("function"===typeof a)return a.displayName||a.name||null;if("string"===typeof a)return a;switch(a){case ua:return "Fragment";case ta:return "Portal";case xa:return "Profiler";case wa:return "StrictMode";case Ba:return "Suspense";case Ca:return "SuspenseList"}if("object"===typeof a)switch(a.$$typeof){case za:return (a.displayName||"Context")+".Consumer";case ya:return (a._context.displayName||"Context")+".Provider";case Aa:var b=a.render;b=b.displayName||b.name||""; +return a.displayName||(""!==b?"ForwardRef("+b+")":"ForwardRef");case Da:return Ra(a.type);case Fa:return Ra(a._render);case Ea:b=a._payload;a=a._init;try{return Ra(a(b))}catch(c){}}return null}function Sa(a){switch(typeof a){case "boolean":case "number":case "object":case "string":case "undefined":return a;default:return ""}}function Ta(a){var b=a.type;return (a=a.nodeName)&&"input"===a.toLowerCase()&&("checkbox"===b||"radio"===b)} +function Ua(a){var b=Ta(a)?"checked":"value",c=Object.getOwnPropertyDescriptor(a.constructor.prototype,b),d=""+a[b];if(!a.hasOwnProperty(b)&&"undefined"!==typeof c&&"function"===typeof c.get&&"function"===typeof c.set){var e=c.get,f=c.set;Object.defineProperty(a,b,{configurable:!0,get:function(){return e.call(this)},set:function(a){d=""+a;f.call(this,a);}});Object.defineProperty(a,b,{enumerable:c.enumerable});return {getValue:function(){return d},setValue:function(a){d=""+a;},stopTracking:function(){a._valueTracker= +null;delete a[b];}}}}function Va(a){a._valueTracker||(a._valueTracker=Ua(a));}function Wa(a){if(!a)return !1;var b=a._valueTracker;if(!b)return !0;var c=b.getValue();var d="";a&&(d=Ta(a)?a.checked?"true":"false":a.value);a=d;return a!==c?(b.setValue(a),!0):!1}function Xa(a){a=a||("undefined"!==typeof document?document:void 0);if("undefined"===typeof a)return null;try{return a.activeElement||a.body}catch(b){return a.body}} +function Ya(a,b){var c=b.checked;return objectAssign({},b,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=c?c:a._wrapperState.initialChecked})}function Za(a,b){var c=null==b.defaultValue?"":b.defaultValue,d=null!=b.checked?b.checked:b.defaultChecked;c=Sa(null!=b.value?b.value:c);a._wrapperState={initialChecked:d,initialValue:c,controlled:"checkbox"===b.type||"radio"===b.type?null!=b.checked:null!=b.value};}function $a(a,b){b=b.checked;null!=b&&qa(a,"checked",b,!1);} +function ab(a,b){$a(a,b);var c=Sa(b.value),d=b.type;if(null!=c)if("number"===d){if(0===c&&""===a.value||a.value!=c)a.value=""+c;}else a.value!==""+c&&(a.value=""+c);else if("submit"===d||"reset"===d){a.removeAttribute("value");return}b.hasOwnProperty("value")?bb(a,b.type,c):b.hasOwnProperty("defaultValue")&&bb(a,b.type,Sa(b.defaultValue));null==b.checked&&null!=b.defaultChecked&&(a.defaultChecked=!!b.defaultChecked);} +function cb(a,b,c){if(b.hasOwnProperty("value")||b.hasOwnProperty("defaultValue")){var d=b.type;if(!("submit"!==d&&"reset"!==d||void 0!==b.value&&null!==b.value))return;b=""+a._wrapperState.initialValue;c||b===a.value||(a.value=b);a.defaultValue=b;}c=a.name;""!==c&&(a.name="");a.defaultChecked=!!a._wrapperState.initialChecked;""!==c&&(a.name=c);} +function bb(a,b,c){if("number"!==b||Xa(a.ownerDocument)!==a)null==c?a.defaultValue=""+a._wrapperState.initialValue:a.defaultValue!==""+c&&(a.defaultValue=""+c);}function db(a){var b="";react.Children.forEach(a,function(a){null!=a&&(b+=a);});return b}function eb(a,b){a=objectAssign({children:void 0},b);if(b=db(b.children))a.children=b;return a} +function fb(a,b,c,d){a=a.options;if(b){b={};for(var e=0;e=c.length))throw Error(y(93));c=c[0];}b=c;}null==b&&(b="");c=b;}a._wrapperState={initialValue:Sa(c)};} +function ib(a,b){var c=Sa(b.value),d=Sa(b.defaultValue);null!=c&&(c=""+c,c!==a.value&&(a.value=c),null==b.defaultValue&&a.defaultValue!==c&&(a.defaultValue=c));null!=d&&(a.defaultValue=""+d);}function jb(a){var b=a.textContent;b===a._wrapperState.initialValue&&""!==b&&null!==b&&(a.value=b);}var kb={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"}; +function lb(a){switch(a){case "svg":return "http://www.w3.org/2000/svg";case "math":return "http://www.w3.org/1998/Math/MathML";default:return "http://www.w3.org/1999/xhtml"}}function mb(a,b){return null==a||"http://www.w3.org/1999/xhtml"===a?lb(b):"http://www.w3.org/2000/svg"===a&&"foreignObject"===b?"http://www.w3.org/1999/xhtml":a} +var nb,ob=function(a){return "undefined"!==typeof MSApp&&MSApp.execUnsafeLocalFunction?function(b,c,d,e){MSApp.execUnsafeLocalFunction(function(){return a(b,c,d,e)});}:a}(function(a,b){if(a.namespaceURI!==kb.svg||"innerHTML"in a)a.innerHTML=b;else {nb=nb||document.createElement("div");nb.innerHTML=""+b.valueOf().toString()+"";for(b=nb.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;b.firstChild;)a.appendChild(b.firstChild);}}); +function pb(a,b){if(b){var c=a.firstChild;if(c&&c===a.lastChild&&3===c.nodeType){c.nodeValue=b;return}}a.textContent=b;} +var qb={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0, +floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},rb=["Webkit","ms","Moz","O"];Object.keys(qb).forEach(function(a){rb.forEach(function(b){b=b+a.charAt(0).toUpperCase()+a.substring(1);qb[b]=qb[a];});});function sb(a,b,c){return null==b||"boolean"===typeof b||""===b?"":c||"number"!==typeof b||0===b||qb.hasOwnProperty(a)&&qb[a]?(""+b).trim():b+"px"} +function tb(a,b){a=a.style;for(var c in b)if(b.hasOwnProperty(c)){var d=0===c.indexOf("--"),e=sb(c,b[c],d);"float"===c&&(c="cssFloat");d?a.setProperty(c,e):a[c]=e;}}var ub=objectAssign({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0}); +function vb(a,b){if(b){if(ub[a]&&(null!=b.children||null!=b.dangerouslySetInnerHTML))throw Error(y(137,a));if(null!=b.dangerouslySetInnerHTML){if(null!=b.children)throw Error(y(60));if(!("object"===typeof b.dangerouslySetInnerHTML&&"__html"in b.dangerouslySetInnerHTML))throw Error(y(61));}if(null!=b.style&&"object"!==typeof b.style)throw Error(y(62));}} +function wb(a,b){if(-1===a.indexOf("-"))return "string"===typeof b.is;switch(a){case "annotation-xml":case "color-profile":case "font-face":case "font-face-src":case "font-face-uri":case "font-face-format":case "font-face-name":case "missing-glyph":return !1;default:return !0}}function xb(a){a=a.target||a.srcElement||window;a.correspondingUseElement&&(a=a.correspondingUseElement);return 3===a.nodeType?a.parentNode:a}var yb=null,zb=null,Ab=null; +function Bb(a){if(a=Cb(a)){if("function"!==typeof yb)throw Error(y(280));var b=a.stateNode;b&&(b=Db(b),yb(a.stateNode,a.type,b));}}function Eb(a){zb?Ab?Ab.push(a):Ab=[a]:zb=a;}function Fb(){if(zb){var a=zb,b=Ab;Ab=zb=null;Bb(a);if(b)for(a=0;ad?0:1<c;c++)b.push(a);return b} +function $c(a,b,c){a.pendingLanes|=b;var d=b-1;a.suspendedLanes&=d;a.pingedLanes&=d;a=a.eventTimes;b=31-Vc(b);a[b]=c;}var Vc=Math.clz32?Math.clz32:ad,bd=Math.log,cd=Math.LN2;function ad(a){return 0===a?32:31-(bd(a)/cd|0)|0}var dd=scheduler.unstable_UserBlockingPriority,ed=scheduler.unstable_runWithPriority,fd=!0;function gd(a,b,c,d){Kb||Ib();var e=hd,f=Kb;Kb=!0;try{Hb(e,a,b,c,d);}finally{(Kb=f)||Mb();}}function id(a,b,c,d){ed(dd,hd.bind(null,a,b,c,d));} +function hd(a,b,c,d){if(fd){var e;if((e=0===(b&4))&&0=be),ee=String.fromCharCode(32),fe=!1; +function ge(a,b){switch(a){case "keyup":return -1!==$d.indexOf(b.keyCode);case "keydown":return 229!==b.keyCode;case "keypress":case "mousedown":case "focusout":return !0;default:return !1}}function he(a){a=a.detail;return "object"===typeof a&&"data"in a?a.data:null}var ie=!1;function je(a,b){switch(a){case "compositionend":return he(b);case "keypress":if(32!==b.which)return null;fe=!0;return ee;case "textInput":return a=b.data,a===ee&&fe?null:a;default:return null}} +function ke(a,b){if(ie)return "compositionend"===a||!ae&&ge(a,b)?(a=nd(),md=ld=kd=null,ie=!1,a):null;switch(a){case "paste":return null;case "keypress":if(!(b.ctrlKey||b.altKey||b.metaKey)||b.ctrlKey&&b.altKey){if(b.char&&1=b)return {node:c,offset:b-a};a=d;}a:{for(;c;){if(c.nextSibling){c=c.nextSibling;break a}c=c.parentNode;}c=void 0;}c=Ke(c);}}function Me(a,b){return a&&b?a===b?!0:a&&3===a.nodeType?!1:b&&3===b.nodeType?Me(a,b.parentNode):"contains"in a?a.contains(b):a.compareDocumentPosition?!!(a.compareDocumentPosition(b)&16):!1:!1} +function Ne(){for(var a=window,b=Xa();b instanceof a.HTMLIFrameElement;){try{var c="string"===typeof b.contentWindow.location.href;}catch(d){c=!1;}if(c)a=b.contentWindow;else break;b=Xa(a.document);}return b}function Oe(a){var b=a&&a.nodeName&&a.nodeName.toLowerCase();return b&&("input"===b&&("text"===a.type||"search"===a.type||"tel"===a.type||"url"===a.type||"password"===a.type)||"textarea"===b||"true"===a.contentEditable)} +var Pe=fa&&"documentMode"in document&&11>=document.documentMode,Qe=null,Re=null,Se=null,Te=!1; +function Ue(a,b,c){var d=c.window===c?c.document:9===c.nodeType?c:c.ownerDocument;Te||null==Qe||Qe!==Xa(d)||(d=Qe,"selectionStart"in d&&Oe(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),Se&&Je(Se,d)||(Se=d,d=oe(Re,"onSelect"),0Af||(a.current=zf[Af],zf[Af]=null,Af--);}function I(a,b){Af++;zf[Af]=a.current;a.current=b;}var Cf={},M=Bf(Cf),N=Bf(!1),Df=Cf; +function Ef(a,b){var c=a.type.contextTypes;if(!c)return Cf;var d=a.stateNode;if(d&&d.__reactInternalMemoizedUnmaskedChildContext===b)return d.__reactInternalMemoizedMaskedChildContext;var e={},f;for(f in c)e[f]=b[f];d&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=b,a.__reactInternalMemoizedMaskedChildContext=e);return e}function Ff(a){a=a.childContextTypes;return null!==a&&void 0!==a}function Gf(){H(N);H(M);}function Hf(a,b,c){if(M.current!==Cf)throw Error(y(168));I(M,b);I(N,c);} +function If(a,b,c){var d=a.stateNode;a=b.childContextTypes;if("function"!==typeof d.getChildContext)return c;d=d.getChildContext();for(var e in d)if(!(e in a))throw Error(y(108,Ra(b)||"Unknown",e));return objectAssign({},c,d)}function Jf(a){a=(a=a.stateNode)&&a.__reactInternalMemoizedMergedChildContext||Cf;Df=M.current;I(M,a);I(N,N.current);return !0}function Kf(a,b,c){var d=a.stateNode;if(!d)throw Error(y(169));c?(a=If(a,b,Df),d.__reactInternalMemoizedMergedChildContext=a,H(N),H(M),I(M,a)):H(N);I(N,c);} +var Lf=null,Mf=null,Nf=scheduler.unstable_runWithPriority,Of=scheduler.unstable_scheduleCallback,Pf=scheduler.unstable_cancelCallback,Qf=scheduler.unstable_shouldYield,Rf=scheduler.unstable_requestPaint,Sf=scheduler.unstable_now,Tf=scheduler.unstable_getCurrentPriorityLevel,Uf=scheduler.unstable_ImmediatePriority,Vf=scheduler.unstable_UserBlockingPriority,Wf=scheduler.unstable_NormalPriority,Xf=scheduler.unstable_LowPriority,Yf=scheduler.unstable_IdlePriority,Zf={},$f=void 0!==Rf?Rf:function(){},ag=null,bg=null,cg=!1,dg=Sf(),O=1E4>dg?Sf:function(){return Sf()-dg}; +function eg(){switch(Tf()){case Uf:return 99;case Vf:return 98;case Wf:return 97;case Xf:return 96;case Yf:return 95;default:throw Error(y(332));}}function fg(a){switch(a){case 99:return Uf;case 98:return Vf;case 97:return Wf;case 96:return Xf;case 95:return Yf;default:throw Error(y(332));}}function gg(a,b){a=fg(a);return Nf(a,b)}function hg(a,b,c){a=fg(a);return Of(a,b,c)}function ig(){if(null!==bg){var a=bg;bg=null;Pf(a);}jg();} +function jg(){if(!cg&&null!==ag){cg=!0;var a=0;try{var b=ag;gg(99,function(){for(;az?(q=u,u=null):q=u.sibling;var n=p(e,u,h[z],k);if(null===n){null===u&&(u=q);break}a&&u&&null=== +n.alternate&&b(e,u);g=f(n,g,z);null===t?l=n:t.sibling=n;t=n;u=q;}if(z===h.length)return c(e,u),l;if(null===u){for(;zz?(q=u,u=null):q=u.sibling;var w=p(e,u,n.value,k);if(null===w){null===u&&(u=q);break}a&&u&&null===w.alternate&&b(e,u);g=f(w,g,z);null===t?l=w:t.sibling=w;t=w;u=q;}if(n.done)return c(e,u),l;if(null===u){for(;!n.done;z++,n=h.next())n=A(e,n.value,k),null!==n&&(g=f(n,g,z),null===t?l=n:t.sibling=n,t=n);return l}for(u=d(e,u);!n.done;z++,n=h.next())n=C(u,e,z,n.value,k),null!==n&&(a&&null!==n.alternate&& +u.delete(null===n.key?z:n.key),g=f(n,g,z),null===t?l=n:t.sibling=n,t=n);a&&u.forEach(function(a){return b(e,a)});return l}return function(a,d,f,h){var k="object"===typeof f&&null!==f&&f.type===ua&&null===f.key;k&&(f=f.props.children);var l="object"===typeof f&&null!==f;if(l)switch(f.$$typeof){case sa:a:{l=f.key;for(k=d;null!==k;){if(k.key===l){switch(k.tag){case 7:if(f.type===ua){c(a,k.sibling);d=e(k,f.props.children);d.return=a;a=d;break a}break;default:if(k.elementType===f.type){c(a,k.sibling); +d=e(k,f.props);d.ref=Qg(a,k,f);d.return=a;a=d;break a}}c(a,k);break}else b(a,k);k=k.sibling;}f.type===ua?(d=Xg(f.props.children,a.mode,h,f.key),d.return=a,a=d):(h=Vg(f.type,f.key,f.props,null,a.mode,h),h.ref=Qg(a,d,f),h.return=a,a=h);}return g(a);case ta:a:{for(k=f.key;null!==d;){if(d.key===k)if(4===d.tag&&d.stateNode.containerInfo===f.containerInfo&&d.stateNode.implementation===f.implementation){c(a,d.sibling);d=e(d,f.children||[]);d.return=a;a=d;break a}else {c(a,d);break}else b(a,d);d=d.sibling;}d= +Wg(f,a.mode,h);d.return=a;a=d;}return g(a)}if("string"===typeof f||"number"===typeof f)return f=""+f,null!==d&&6===d.tag?(c(a,d.sibling),d=e(d,f),d.return=a,a=d):(c(a,d),d=Ug(f,a.mode,h),d.return=a,a=d),g(a);if(Pg(f))return x(a,d,f,h);if(La(f))return w(a,d,f,h);l&&Rg(a,f);if("undefined"===typeof f&&!k)switch(a.tag){case 1:case 22:case 0:case 11:case 15:throw Error(y(152,Ra(a.type)||"Component"));}return c(a,d)}}var Yg=Sg(!0),Zg=Sg(!1),$g={},ah=Bf($g),bh=Bf($g),ch=Bf($g); +function dh(a){if(a===$g)throw Error(y(174));return a}function eh(a,b){I(ch,b);I(bh,a);I(ah,$g);a=b.nodeType;switch(a){case 9:case 11:b=(b=b.documentElement)?b.namespaceURI:mb(null,"");break;default:a=8===a?b.parentNode:b,b=a.namespaceURI||null,a=a.tagName,b=mb(b,a);}H(ah);I(ah,b);}function fh(){H(ah);H(bh);H(ch);}function gh(a){dh(ch.current);var b=dh(ah.current);var c=mb(b,a.type);b!==c&&(I(bh,a),I(ah,c));}function hh(a){bh.current===a&&(H(ah),H(bh));}var P=Bf(0); +function ih(a){for(var b=a;null!==b;){if(13===b.tag){var c=b.memoizedState;if(null!==c&&(c=c.dehydrated,null===c||"$?"===c.data||"$!"===c.data))return b}else if(19===b.tag&&void 0!==b.memoizedProps.revealOrder){if(0!==(b.flags&64))return b}else if(null!==b.child){b.child.return=b;b=b.child;continue}if(b===a)break;for(;null===b.sibling;){if(null===b.return||b.return===a)return null;b=b.return;}b.sibling.return=b.return;b=b.sibling;}return null}var jh=null,kh=null,lh=!1; +function mh(a,b){var c=nh(5,null,null,0);c.elementType="DELETED";c.type="DELETED";c.stateNode=b;c.return=a;c.flags=8;null!==a.lastEffect?(a.lastEffect.nextEffect=c,a.lastEffect=c):a.firstEffect=a.lastEffect=c;}function oh(a,b){switch(a.tag){case 5:var c=a.type;b=1!==b.nodeType||c.toLowerCase()!==b.nodeName.toLowerCase()?null:b;return null!==b?(a.stateNode=b,!0):!1;case 6:return b=""===a.pendingProps||3!==b.nodeType?null:b,null!==b?(a.stateNode=b,!0):!1;case 13:return !1;default:return !1}} +function ph(a){if(lh){var b=kh;if(b){var c=b;if(!oh(a,b)){b=rf(c.nextSibling);if(!b||!oh(a,b)){a.flags=a.flags&-1025|2;lh=!1;jh=a;return}mh(jh,c);}jh=a;kh=rf(b.firstChild);}else a.flags=a.flags&-1025|2,lh=!1,jh=a;}}function qh(a){for(a=a.return;null!==a&&5!==a.tag&&3!==a.tag&&13!==a.tag;)a=a.return;jh=a;} +function rh(a){if(a!==jh)return !1;if(!lh)return qh(a),lh=!0,!1;var b=a.type;if(5!==a.tag||"head"!==b&&"body"!==b&&!nf(b,a.memoizedProps))for(b=kh;b;)mh(a,b),b=rf(b.nextSibling);qh(a);if(13===a.tag){a=a.memoizedState;a=null!==a?a.dehydrated:null;if(!a)throw Error(y(317));a:{a=a.nextSibling;for(b=0;a;){if(8===a.nodeType){var c=a.data;if("/$"===c){if(0===b){kh=rf(a.nextSibling);break a}b--;}else "$"!==c&&"$!"!==c&&"$?"!==c||b++;}a=a.nextSibling;}kh=null;}}else kh=jh?rf(a.stateNode.nextSibling):null;return !0} +function sh(){kh=jh=null;lh=!1;}var th=[];function uh(){for(var a=0;af))throw Error(y(301));f+=1;T=S=null;b.updateQueue=null;vh.current=Fh;a=c(d,e);}while(zh)}vh.current=Gh;b=null!==S&&null!==S.next;xh=0;T=S=R=null;yh=!1;if(b)throw Error(y(300));return a}function Hh(){var a={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};null===T?R.memoizedState=T=a:T=T.next=a;return T} +function Ih(){if(null===S){var a=R.alternate;a=null!==a?a.memoizedState:null;}else a=S.next;var b=null===T?R.memoizedState:T.next;if(null!==b)T=b,S=a;else {if(null===a)throw Error(y(310));S=a;a={memoizedState:S.memoizedState,baseState:S.baseState,baseQueue:S.baseQueue,queue:S.queue,next:null};null===T?R.memoizedState=T=a:T=T.next=a;}return T}function Jh(a,b){return "function"===typeof b?b(a):b} +function Kh(a){var b=Ih(),c=b.queue;if(null===c)throw Error(y(311));c.lastRenderedReducer=a;var d=S,e=d.baseQueue,f=c.pending;if(null!==f){if(null!==e){var g=e.next;e.next=f.next;f.next=g;}d.baseQueue=e=f;c.pending=null;}if(null!==e){e=e.next;d=d.baseState;var h=g=f=null,k=e;do{var l=k.lane;if((xh&l)===l)null!==h&&(h=h.next={lane:0,action:k.action,eagerReducer:k.eagerReducer,eagerState:k.eagerState,next:null}),d=k.eagerReducer===a?k.eagerState:a(d,k.action);else {var n={lane:l,action:k.action,eagerReducer:k.eagerReducer, +eagerState:k.eagerState,next:null};null===h?(g=h=n,f=d):h=h.next=n;R.lanes|=l;Dg|=l;}k=k.next;}while(null!==k&&k!==e);null===h?f=d:h.next=g;He(d,b.memoizedState)||(ug=!0);b.memoizedState=d;b.baseState=f;b.baseQueue=h;c.lastRenderedState=d;}return [b.memoizedState,c.dispatch]} +function Lh(a){var b=Ih(),c=b.queue;if(null===c)throw Error(y(311));c.lastRenderedReducer=a;var d=c.dispatch,e=c.pending,f=b.memoizedState;if(null!==e){c.pending=null;var g=e=e.next;do f=a(f,g.action),g=g.next;while(g!==e);He(f,b.memoizedState)||(ug=!0);b.memoizedState=f;null===b.baseQueue&&(b.baseState=f);c.lastRenderedState=f;}return [f,d]} +function Mh(a,b,c){var d=b._getVersion;d=d(b._source);var e=b._workInProgressVersionPrimary;if(null!==e)a=e===d;else if(a=a.mutableReadLanes,a=(xh&a)===a)b._workInProgressVersionPrimary=d,th.push(b);if(a)return c(b._source);th.push(b);throw Error(y(350));} +function Nh(a,b,c,d){var e=U;if(null===e)throw Error(y(349));var f=b._getVersion,g=f(b._source),h=vh.current,k=h.useState(function(){return Mh(e,b,c)}),l=k[1],n=k[0];k=T;var A=a.memoizedState,p=A.refs,C=p.getSnapshot,x=A.source;A=A.subscribe;var w=R;a.memoizedState={refs:p,source:b,subscribe:d};h.useEffect(function(){p.getSnapshot=c;p.setSnapshot=l;var a=f(b._source);if(!He(g,a)){a=c(b._source);He(n,a)||(l(a),a=Ig(w),e.mutableReadLanes|=a&e.pendingLanes);a=e.mutableReadLanes;e.entangledLanes|=a;for(var d= +e.entanglements,h=a;0c?98:c,function(){a(!0);});gg(97\x3c/script>",a=a.removeChild(a.firstChild)):"string"===typeof d.is?a=g.createElement(c,{is:d.is}):(a=g.createElement(c),"select"===c&&(g=a,d.multiple?g.multiple=!0:d.size&&(g.size=d.size))):a=g.createElementNS(a,c);a[wf]=b;a[xf]=d;Bi(a,b,!1,!1);b.stateNode=a;g=wb(c,d);switch(c){case "dialog":G("cancel",a);G("close",a); +e=d;break;case "iframe":case "object":case "embed":G("load",a);e=d;break;case "video":case "audio":for(e=0;eJi&&(b.flags|=64,f=!0,Fi(d,!1),b.lanes=33554432);}else {if(!f)if(a=ih(g),null!==a){if(b.flags|=64,f=!0,c=a.updateQueue,null!==c&&(b.updateQueue=c,b.flags|=4),Fi(d,!0),null===d.tail&&"hidden"===d.tailMode&&!g.alternate&&!lh)return b=b.lastEffect=d.lastEffect,null!==b&&(b.nextEffect=null),null}else 2*O()-d.renderingStartTime>Ji&&1073741824!==c&&(b.flags|= +64,f=!0,Fi(d,!1),b.lanes=33554432);d.isBackwards?(g.sibling=b.child,b.child=g):(c=d.last,null!==c?c.sibling=g:b.child=g,d.last=g);}return null!==d.tail?(c=d.tail,d.rendering=c,d.tail=c.sibling,d.lastEffect=b.lastEffect,d.renderingStartTime=O(),c.sibling=null,b=P.current,I(P,f?b&1|2:b&1),c):null;case 23:case 24:return Ki(),null!==a&&null!==a.memoizedState!==(null!==b.memoizedState)&&"unstable-defer-without-hiding"!==d.mode&&(b.flags|=4),null}throw Error(y(156,b.tag));} +function Li(a){switch(a.tag){case 1:Ff(a.type)&&Gf();var b=a.flags;return b&4096?(a.flags=b&-4097|64,a):null;case 3:fh();H(N);H(M);uh();b=a.flags;if(0!==(b&64))throw Error(y(285));a.flags=b&-4097|64;return a;case 5:return hh(a),null;case 13:return H(P),b=a.flags,b&4096?(a.flags=b&-4097|64,a):null;case 19:return H(P),null;case 4:return fh(),null;case 10:return rg(a),null;case 23:case 24:return Ki(),null;default:return null}} +function Mi(a,b){try{var c="",d=b;do c+=Qa(d),d=d.return;while(d);var e=c;}catch(f){e="\nError generating stack: "+f.message+"\n"+f.stack;}return {value:a,source:b,stack:e}}function Ni(a,b){try{console.error(b.value);}catch(c){setTimeout(function(){throw c;});}}var Oi="function"===typeof WeakMap?WeakMap:Map;function Pi(a,b,c){c=zg(-1,c);c.tag=3;c.payload={element:null};var d=b.value;c.callback=function(){Qi||(Qi=!0,Ri=d);Ni(a,b);};return c} +function Si(a,b,c){c=zg(-1,c);c.tag=3;var d=a.type.getDerivedStateFromError;if("function"===typeof d){var e=b.value;c.payload=function(){Ni(a,b);return d(e)};}var f=a.stateNode;null!==f&&"function"===typeof f.componentDidCatch&&(c.callback=function(){"function"!==typeof d&&(null===Ti?Ti=new Set([this]):Ti.add(this),Ni(a,b));var c=b.stack;this.componentDidCatch(b.value,{componentStack:null!==c?c:""});});return c}var Ui="function"===typeof WeakSet?WeakSet:Set; +function Vi(a){var b=a.ref;if(null!==b)if("function"===typeof b)try{b(null);}catch(c){Wi(a,c);}else b.current=null;}function Xi(a,b){switch(b.tag){case 0:case 11:case 15:case 22:return;case 1:if(b.flags&256&&null!==a){var c=a.memoizedProps,d=a.memoizedState;a=b.stateNode;b=a.getSnapshotBeforeUpdate(b.elementType===b.type?c:lg(b.type,c),d);a.__reactInternalSnapshotBeforeUpdate=b;}return;case 3:b.flags&256&&qf(b.stateNode.containerInfo);return;case 5:case 6:case 4:case 17:return}throw Error(y(163));} +function Yi(a,b,c){switch(c.tag){case 0:case 11:case 15:case 22:b=c.updateQueue;b=null!==b?b.lastEffect:null;if(null!==b){a=b=b.next;do{if(3===(a.tag&3)){var d=a.create;a.destroy=d();}a=a.next;}while(a!==b)}b=c.updateQueue;b=null!==b?b.lastEffect:null;if(null!==b){a=b=b.next;do{var e=a;d=e.next;e=e.tag;0!==(e&4)&&0!==(e&1)&&(Zi(c,a),$i(c,a));a=d;}while(a!==b)}return;case 1:a=c.stateNode;c.flags&4&&(null===b?a.componentDidMount():(d=c.elementType===c.type?b.memoizedProps:lg(c.type,b.memoizedProps),a.componentDidUpdate(d, +b.memoizedState,a.__reactInternalSnapshotBeforeUpdate)));b=c.updateQueue;null!==b&&Eg(c,b,a);return;case 3:b=c.updateQueue;if(null!==b){a=null;if(null!==c.child)switch(c.child.tag){case 5:a=c.child.stateNode;break;case 1:a=c.child.stateNode;}Eg(c,b,a);}return;case 5:a=c.stateNode;null===b&&c.flags&4&&mf(c.type,c.memoizedProps)&&a.focus();return;case 6:return;case 4:return;case 12:return;case 13:null===c.memoizedState&&(c=c.alternate,null!==c&&(c=c.memoizedState,null!==c&&(c=c.dehydrated,null!==c&&Cc(c)))); +return;case 19:case 17:case 20:case 21:case 23:case 24:return}throw Error(y(163));} +function aj(a,b){for(var c=a;;){if(5===c.tag){var d=c.stateNode;if(b)d=d.style,"function"===typeof d.setProperty?d.setProperty("display","none","important"):d.display="none";else {d=c.stateNode;var e=c.memoizedProps.style;e=void 0!==e&&null!==e&&e.hasOwnProperty("display")?e.display:null;d.style.display=sb("display",e);}}else if(6===c.tag)c.stateNode.nodeValue=b?"":c.memoizedProps;else if((23!==c.tag&&24!==c.tag||null===c.memoizedState||c===a)&&null!==c.child){c.child.return=c;c=c.child;continue}if(c=== +a)break;for(;null===c.sibling;){if(null===c.return||c.return===a)return;c=c.return;}c.sibling.return=c.return;c=c.sibling;}} +function bj(a,b){if(Mf&&"function"===typeof Mf.onCommitFiberUnmount)try{Mf.onCommitFiberUnmount(Lf,b);}catch(f){}switch(b.tag){case 0:case 11:case 14:case 15:case 22:a=b.updateQueue;if(null!==a&&(a=a.lastEffect,null!==a)){var c=a=a.next;do{var d=c,e=d.destroy;d=d.tag;if(void 0!==e)if(0!==(d&4))Zi(b,c);else {d=b;try{e();}catch(f){Wi(d,f);}}c=c.next;}while(c!==a)}break;case 1:Vi(b);a=b.stateNode;if("function"===typeof a.componentWillUnmount)try{a.props=b.memoizedProps,a.state=b.memoizedState,a.componentWillUnmount();}catch(f){Wi(b, +f);}break;case 5:Vi(b);break;case 4:cj(a,b);}}function dj(a){a.alternate=null;a.child=null;a.dependencies=null;a.firstEffect=null;a.lastEffect=null;a.memoizedProps=null;a.memoizedState=null;a.pendingProps=null;a.return=null;a.updateQueue=null;}function ej(a){return 5===a.tag||3===a.tag||4===a.tag} +function fj(a){a:{for(var b=a.return;null!==b;){if(ej(b))break a;b=b.return;}throw Error(y(160));}var c=b;b=c.stateNode;switch(c.tag){case 5:var d=!1;break;case 3:b=b.containerInfo;d=!0;break;case 4:b=b.containerInfo;d=!0;break;default:throw Error(y(161));}c.flags&16&&(pb(b,""),c.flags&=-17);a:b:for(c=a;;){for(;null===c.sibling;){if(null===c.return||ej(c.return)){c=null;break a}c=c.return;}c.sibling.return=c.return;for(c=c.sibling;5!==c.tag&&6!==c.tag&&18!==c.tag;){if(c.flags&2)continue b;if(null=== +c.child||4===c.tag)continue b;else c.child.return=c,c=c.child;}if(!(c.flags&2)){c=c.stateNode;break a}}d?gj(a,c,b):hj(a,c,b);} +function gj(a,b,c){var d=a.tag,e=5===d||6===d;if(e)a=e?a.stateNode:a.stateNode.instance,b?8===c.nodeType?c.parentNode.insertBefore(a,b):c.insertBefore(a,b):(8===c.nodeType?(b=c.parentNode,b.insertBefore(a,c)):(b=c,b.appendChild(a)),c=c._reactRootContainer,null!==c&&void 0!==c||null!==b.onclick||(b.onclick=jf));else if(4!==d&&(a=a.child,null!==a))for(gj(a,b,c),a=a.sibling;null!==a;)gj(a,b,c),a=a.sibling;} +function hj(a,b,c){var d=a.tag,e=5===d||6===d;if(e)a=e?a.stateNode:a.stateNode.instance,b?c.insertBefore(a,b):c.appendChild(a);else if(4!==d&&(a=a.child,null!==a))for(hj(a,b,c),a=a.sibling;null!==a;)hj(a,b,c),a=a.sibling;} +function cj(a,b){for(var c=b,d=!1,e,f;;){if(!d){d=c.return;a:for(;;){if(null===d)throw Error(y(160));e=d.stateNode;switch(d.tag){case 5:f=!1;break a;case 3:e=e.containerInfo;f=!0;break a;case 4:e=e.containerInfo;f=!0;break a}d=d.return;}d=!0;}if(5===c.tag||6===c.tag){a:for(var g=a,h=c,k=h;;)if(bj(g,k),null!==k.child&&4!==k.tag)k.child.return=k,k=k.child;else {if(k===h)break a;for(;null===k.sibling;){if(null===k.return||k.return===h)break a;k=k.return;}k.sibling.return=k.return;k=k.sibling;}f?(g=e,h=c.stateNode, +8===g.nodeType?g.parentNode.removeChild(h):g.removeChild(h)):e.removeChild(c.stateNode);}else if(4===c.tag){if(null!==c.child){e=c.stateNode.containerInfo;f=!0;c.child.return=c;c=c.child;continue}}else if(bj(a,c),null!==c.child){c.child.return=c;c=c.child;continue}if(c===b)break;for(;null===c.sibling;){if(null===c.return||c.return===b)return;c=c.return;4===c.tag&&(d=!1);}c.sibling.return=c.return;c=c.sibling;}} +function ij(a,b){switch(b.tag){case 0:case 11:case 14:case 15:case 22:var c=b.updateQueue;c=null!==c?c.lastEffect:null;if(null!==c){var d=c=c.next;do 3===(d.tag&3)&&(a=d.destroy,d.destroy=void 0,void 0!==a&&a()),d=d.next;while(d!==c)}return;case 1:return;case 5:c=b.stateNode;if(null!=c){d=b.memoizedProps;var e=null!==a?a.memoizedProps:d;a=b.type;var f=b.updateQueue;b.updateQueue=null;if(null!==f){c[xf]=d;"input"===a&&"radio"===d.type&&null!=d.name&&$a(c,d);wb(a,e);b=wb(a,d);for(e=0;ee&&(e=g);c&=~f;}c=e;c=O()-c;c=(120>c?120:480>c?480:1080>c?1080:1920>c?1920:3E3>c?3E3:4320> +c?4320:1960*nj(c/1960))-c;if(10 component higher in the tree to provide a loading indicator or placeholder to display.");}5!==V&&(V=2);k=Mi(k,h);p= +g;do{switch(p.tag){case 3:f=k;p.flags|=4096;b&=-b;p.lanes|=b;var J=Pi(p,f,b);Bg(p,J);break a;case 1:f=k;var K=p.type,Q=p.stateNode;if(0===(p.flags&64)&&("function"===typeof K.getDerivedStateFromError||null!==Q&&"function"===typeof Q.componentDidCatch&&(null===Ti||!Ti.has(Q)))){p.flags|=4096;b&=-b;p.lanes|=b;var L=Si(p,f,b);Bg(p,L);break a}}p=p.return;}while(null!==p)}Zj(c);}catch(va){b=va;Y===c&&null!==c&&(Y=c=c.return);continue}break}while(1)} +function Pj(){var a=oj.current;oj.current=Gh;return null===a?Gh:a}function Tj(a,b){var c=X;X|=16;var d=Pj();U===a&&W===b||Qj(a,b);do try{ak();break}catch(e){Sj(a,e);}while(1);qg();X=c;oj.current=d;if(null!==Y)throw Error(y(261));U=null;W=0;return V}function ak(){for(;null!==Y;)bk(Y);}function Rj(){for(;null!==Y&&!Qf();)bk(Y);}function bk(a){var b=ck(a.alternate,a,qj);a.memoizedProps=a.pendingProps;null===b?Zj(a):Y=b;pj.current=null;} +function Zj(a){var b=a;do{var c=b.alternate;a=b.return;if(0===(b.flags&2048)){c=Gi(c,b,qj);if(null!==c){Y=c;return}c=b;if(24!==c.tag&&23!==c.tag||null===c.memoizedState||0!==(qj&1073741824)||0===(c.mode&4)){for(var d=0,e=c.child;null!==e;)d|=e.lanes|e.childLanes,e=e.sibling;c.childLanes=d;}null!==a&&0===(a.flags&2048)&&(null===a.firstEffect&&(a.firstEffect=b.firstEffect),null!==b.lastEffect&&(null!==a.lastEffect&&(a.lastEffect.nextEffect=b.firstEffect),a.lastEffect=b.lastEffect),1g&&(h=g,g=J,J=h),h=Le(t,J),f=Le(t,g),h&&f&&(1!==v.rangeCount||v.anchorNode!==h.node||v.anchorOffset!==h.offset||v.focusNode!==f.node||v.focusOffset!==f.offset)&&(q=q.createRange(),q.setStart(h.node,h.offset),v.removeAllRanges(),J>g?(v.addRange(q),v.extend(f.node,f.offset)):(q.setEnd(f.node,f.offset),v.addRange(q))))));q=[];for(v=t;v=v.parentNode;)1===v.nodeType&&q.push({element:v,left:v.scrollLeft,top:v.scrollTop});"function"===typeof t.focus&&t.focus();for(t= +0;tO()-jj?Qj(a,0):uj|=c);Mj(a,b);}function lj(a,b){var c=a.stateNode;null!==c&&c.delete(b);b=0;0===b&&(b=a.mode,0===(b&2)?b=1:0===(b&4)?b=99===eg()?1:2:(0===Gj&&(Gj=tj),b=Yc(62914560&~Gj),0===b&&(b=4194304)));c=Hg();a=Kj(a,b);null!==a&&($c(a,b,c),Mj(a,c));}var ck; +ck=function(a,b,c){var d=b.lanes;if(null!==a)if(a.memoizedProps!==b.pendingProps||N.current)ug=!0;else if(0!==(c&d))ug=0!==(a.flags&16384)?!0:!1;else {ug=!1;switch(b.tag){case 3:ri(b);sh();break;case 5:gh(b);break;case 1:Ff(b.type)&&Jf(b);break;case 4:eh(b,b.stateNode.containerInfo);break;case 10:d=b.memoizedProps.value;var e=b.type._context;I(mg,e._currentValue);e._currentValue=d;break;case 13:if(null!==b.memoizedState){if(0!==(c&b.child.childLanes))return ti(a,b,c);I(P,P.current&1);b=hi(a,b,c);return null!== +b?b.sibling:null}I(P,P.current&1);break;case 19:d=0!==(c&b.childLanes);if(0!==(a.flags&64)){if(d)return Ai(a,b,c);b.flags|=64;}e=b.memoizedState;null!==e&&(e.rendering=null,e.tail=null,e.lastEffect=null);I(P,P.current);if(d)break;else return null;case 23:case 24:return b.lanes=0,mi(a,b,c)}return hi(a,b,c)}else ug=!1;b.lanes=0;switch(b.tag){case 2:d=b.type;null!==a&&(a.alternate=null,b.alternate=null,b.flags|=2);a=b.pendingProps;e=Ef(b,M.current);tg(b,c);e=Ch(null,b,d,a,e,c);b.flags|=1;if("object"=== +typeof e&&null!==e&&"function"===typeof e.render&&void 0===e.$$typeof){b.tag=1;b.memoizedState=null;b.updateQueue=null;if(Ff(d)){var f=!0;Jf(b);}else f=!1;b.memoizedState=null!==e.state&&void 0!==e.state?e.state:null;xg(b);var g=d.getDerivedStateFromProps;"function"===typeof g&&Gg(b,d,g,a);e.updater=Kg;b.stateNode=e;e._reactInternals=b;Og(b,d,a,c);b=qi(null,b,d,!0,f,c);}else b.tag=0,fi(null,b,e,c),b=b.child;return b;case 16:e=b.elementType;a:{null!==a&&(a.alternate=null,b.alternate=null,b.flags|=2); +a=b.pendingProps;f=e._init;e=f(e._payload);b.type=e;f=b.tag=hk(e);a=lg(e,a);switch(f){case 0:b=li(null,b,e,a,c);break a;case 1:b=pi(null,b,e,a,c);break a;case 11:b=gi(null,b,e,a,c);break a;case 14:b=ii(null,b,e,lg(e.type,a),d,c);break a}throw Error(y(306,e,""));}return b;case 0:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:lg(d,e),li(a,b,d,e,c);case 1:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:lg(d,e),pi(a,b,d,e,c);case 3:ri(b);d=b.updateQueue;if(null===a||null===d)throw Error(y(282)); +d=b.pendingProps;e=b.memoizedState;e=null!==e?e.element:null;yg(a,b);Cg(b,d,null,c);d=b.memoizedState.element;if(d===e)sh(),b=hi(a,b,c);else {e=b.stateNode;if(f=e.hydrate)kh=rf(b.stateNode.containerInfo.firstChild),jh=b,f=lh=!0;if(f){a=e.mutableSourceEagerHydrationData;if(null!=a)for(e=0;e { + return { endTime, insertTime, type: 'exponentialRampToValue', value }; +}; + +const createExtendedLinearRampToValueAutomationEvent = (value, endTime, insertTime) => { + return { endTime, insertTime, type: 'linearRampToValue', value }; +}; + +const createSetValueAutomationEvent = (value, startTime) => { + return { startTime, type: 'setValue', value }; +}; + +const createSetValueCurveAutomationEvent = (values, startTime, duration) => { + return { duration, startTime, type: 'setValueCurve', values }; +}; + +const getTargetValueAtTime = (time, valueAtStartTime, { startTime, target, timeConstant }) => { + return target + (valueAtStartTime - target) * Math.exp((startTime - time) / timeConstant); +}; + +const isExponentialRampToValueAutomationEvent = (automationEvent) => { + return automationEvent.type === 'exponentialRampToValue'; +}; + +const isLinearRampToValueAutomationEvent = (automationEvent) => { + return automationEvent.type === 'linearRampToValue'; +}; + +const isAnyRampToValueAutomationEvent = (automationEvent) => { + return isExponentialRampToValueAutomationEvent(automationEvent) || isLinearRampToValueAutomationEvent(automationEvent); +}; + +const isSetValueAutomationEvent = (automationEvent) => { + return automationEvent.type === 'setValue'; +}; + +const isSetValueCurveAutomationEvent = (automationEvent) => { + return automationEvent.type === 'setValueCurve'; +}; + +const getValueOfAutomationEventAtIndexAtTime = (automationEvents, index, time, defaultValue) => { + const automationEvent = automationEvents[index]; + return automationEvent === undefined + ? defaultValue + : isAnyRampToValueAutomationEvent(automationEvent) || isSetValueAutomationEvent(automationEvent) + ? automationEvent.value + : isSetValueCurveAutomationEvent(automationEvent) + ? automationEvent.values[automationEvent.values.length - 1] + : getTargetValueAtTime(time, getValueOfAutomationEventAtIndexAtTime(automationEvents, index - 1, automationEvent.startTime, defaultValue), automationEvent); +}; + +const getEndTimeAndValueOfPreviousAutomationEvent = (automationEvents, index, currentAutomationEvent, nextAutomationEvent, defaultValue) => { + return currentAutomationEvent === undefined + ? [nextAutomationEvent.insertTime, defaultValue] + : isAnyRampToValueAutomationEvent(currentAutomationEvent) + ? [currentAutomationEvent.endTime, currentAutomationEvent.value] + : isSetValueAutomationEvent(currentAutomationEvent) + ? [currentAutomationEvent.startTime, currentAutomationEvent.value] + : isSetValueCurveAutomationEvent(currentAutomationEvent) + ? [ + currentAutomationEvent.startTime + currentAutomationEvent.duration, + currentAutomationEvent.values[currentAutomationEvent.values.length - 1] + ] + : [ + currentAutomationEvent.startTime, + getValueOfAutomationEventAtIndexAtTime(automationEvents, index - 1, currentAutomationEvent.startTime, defaultValue) + ]; +}; + +const isCancelAndHoldAutomationEvent = (automationEvent) => { + return automationEvent.type === 'cancelAndHold'; +}; + +const isCancelScheduledValuesAutomationEvent = (automationEvent) => { + return automationEvent.type === 'cancelScheduledValues'; +}; + +const getEventTime = (automationEvent) => { + if (isCancelAndHoldAutomationEvent(automationEvent) || isCancelScheduledValuesAutomationEvent(automationEvent)) { + return automationEvent.cancelTime; + } + if (isExponentialRampToValueAutomationEvent(automationEvent) || isLinearRampToValueAutomationEvent(automationEvent)) { + return automationEvent.endTime; + } + return automationEvent.startTime; +}; + +const getExponentialRampValueAtTime = (time, startTime, valueAtStartTime, { endTime, value }) => { + if (valueAtStartTime === value) { + return value; + } + if ((0 < valueAtStartTime && 0 < value) || (valueAtStartTime < 0 && value < 0)) { + return valueAtStartTime * (value / valueAtStartTime) ** ((time - startTime) / (endTime - startTime)); + } + return 0; +}; + +const getLinearRampValueAtTime = (time, startTime, valueAtStartTime, { endTime, value }) => { + return valueAtStartTime + ((time - startTime) / (endTime - startTime)) * (value - valueAtStartTime); +}; + +const interpolateValue = (values, theoreticIndex) => { + const lowerIndex = Math.floor(theoreticIndex); + const upperIndex = Math.ceil(theoreticIndex); + if (lowerIndex === upperIndex) { + return values[lowerIndex]; + } + return (1 - (theoreticIndex - lowerIndex)) * values[lowerIndex] + (1 - (upperIndex - theoreticIndex)) * values[upperIndex]; +}; + +const getValueCurveValueAtTime = (time, { duration, startTime, values }) => { + const theoreticIndex = ((time - startTime) / duration) * (values.length - 1); + return interpolateValue(values, theoreticIndex); +}; + +const isSetTargetAutomationEvent = (automationEvent) => { + return automationEvent.type === 'setTarget'; +}; + +class AutomationEventList { + constructor(defaultValue) { + this._automationEvents = []; + this._currenTime = 0; + this._defaultValue = defaultValue; + } + [Symbol.iterator]() { + return this._automationEvents[Symbol.iterator](); + } + add(automationEvent) { + const eventTime = getEventTime(automationEvent); + if (isCancelAndHoldAutomationEvent(automationEvent) || isCancelScheduledValuesAutomationEvent(automationEvent)) { + const index = this._automationEvents.findIndex((currentAutomationEvent) => { + if (isCancelScheduledValuesAutomationEvent(automationEvent) && isSetValueCurveAutomationEvent(currentAutomationEvent)) { + return currentAutomationEvent.startTime + currentAutomationEvent.duration >= eventTime; + } + return getEventTime(currentAutomationEvent) >= eventTime; + }); + const removedAutomationEvent = this._automationEvents[index]; + if (index !== -1) { + this._automationEvents = this._automationEvents.slice(0, index); + } + if (isCancelAndHoldAutomationEvent(automationEvent)) { + const lastAutomationEvent = this._automationEvents[this._automationEvents.length - 1]; + if (removedAutomationEvent !== undefined && isAnyRampToValueAutomationEvent(removedAutomationEvent)) { + if (isSetTargetAutomationEvent(lastAutomationEvent)) { + throw new Error('The internal list is malformed.'); + } + const startTime = isSetValueCurveAutomationEvent(lastAutomationEvent) + ? lastAutomationEvent.startTime + lastAutomationEvent.duration + : getEventTime(lastAutomationEvent); + const startValue = isSetValueCurveAutomationEvent(lastAutomationEvent) + ? lastAutomationEvent.values[lastAutomationEvent.values.length - 1] + : lastAutomationEvent.value; + const value = isExponentialRampToValueAutomationEvent(removedAutomationEvent) + ? getExponentialRampValueAtTime(eventTime, startTime, startValue, removedAutomationEvent) + : getLinearRampValueAtTime(eventTime, startTime, startValue, removedAutomationEvent); + const truncatedAutomationEvent = isExponentialRampToValueAutomationEvent(removedAutomationEvent) + ? createExtendedExponentialRampToValueAutomationEvent(value, eventTime, this._currenTime) + : createExtendedLinearRampToValueAutomationEvent(value, eventTime, this._currenTime); + this._automationEvents.push(truncatedAutomationEvent); + } + if (lastAutomationEvent !== undefined && isSetTargetAutomationEvent(lastAutomationEvent)) { + this._automationEvents.push(createSetValueAutomationEvent(this.getValue(eventTime), eventTime)); + } + if (lastAutomationEvent !== undefined && + isSetValueCurveAutomationEvent(lastAutomationEvent) && + lastAutomationEvent.startTime + lastAutomationEvent.duration > eventTime) { + this._automationEvents[this._automationEvents.length - 1] = createSetValueCurveAutomationEvent(new Float32Array([6, 7]), lastAutomationEvent.startTime, eventTime - lastAutomationEvent.startTime); + } + } + } + else { + const index = this._automationEvents.findIndex((currentAutomationEvent) => getEventTime(currentAutomationEvent) > eventTime); + const previousAutomationEvent = index === -1 ? this._automationEvents[this._automationEvents.length - 1] : this._automationEvents[index - 1]; + if (previousAutomationEvent !== undefined && + isSetValueCurveAutomationEvent(previousAutomationEvent) && + getEventTime(previousAutomationEvent) + previousAutomationEvent.duration > eventTime) { + return false; + } + const persistentAutomationEvent = isExponentialRampToValueAutomationEvent(automationEvent) + ? createExtendedExponentialRampToValueAutomationEvent(automationEvent.value, automationEvent.endTime, this._currenTime) + : isLinearRampToValueAutomationEvent(automationEvent) + ? createExtendedLinearRampToValueAutomationEvent(automationEvent.value, eventTime, this._currenTime) + : automationEvent; + if (index === -1) { + this._automationEvents.push(persistentAutomationEvent); + } + else { + if (isSetValueCurveAutomationEvent(automationEvent) && + eventTime + automationEvent.duration > getEventTime(this._automationEvents[index])) { + return false; + } + this._automationEvents.splice(index, 0, persistentAutomationEvent); + } + } + return true; + } + flush(time) { + const index = this._automationEvents.findIndex((currentAutomationEvent) => getEventTime(currentAutomationEvent) > time); + if (index > 1) { + const remainingAutomationEvents = this._automationEvents.slice(index - 1); + const firstRemainingAutomationEvent = remainingAutomationEvents[0]; + if (isSetTargetAutomationEvent(firstRemainingAutomationEvent)) { + remainingAutomationEvents.unshift(createSetValueAutomationEvent(getValueOfAutomationEventAtIndexAtTime(this._automationEvents, index - 2, firstRemainingAutomationEvent.startTime, this._defaultValue), firstRemainingAutomationEvent.startTime)); + } + this._automationEvents = remainingAutomationEvents; + } + } + getValue(time) { + if (this._automationEvents.length === 0) { + return this._defaultValue; + } + const indexOfNextEvent = this._automationEvents.findIndex((automationEvent) => getEventTime(automationEvent) > time); + const nextAutomationEvent = this._automationEvents[indexOfNextEvent]; + const indexOfCurrentEvent = (indexOfNextEvent === -1 ? this._automationEvents.length : indexOfNextEvent) - 1; + const currentAutomationEvent = this._automationEvents[indexOfCurrentEvent]; + if (currentAutomationEvent !== undefined && + isSetTargetAutomationEvent(currentAutomationEvent) && + (nextAutomationEvent === undefined || + !isAnyRampToValueAutomationEvent(nextAutomationEvent) || + nextAutomationEvent.insertTime > time)) { + return getTargetValueAtTime(time, getValueOfAutomationEventAtIndexAtTime(this._automationEvents, indexOfCurrentEvent - 1, currentAutomationEvent.startTime, this._defaultValue), currentAutomationEvent); + } + if (currentAutomationEvent !== undefined && + isSetValueAutomationEvent(currentAutomationEvent) && + (nextAutomationEvent === undefined || !isAnyRampToValueAutomationEvent(nextAutomationEvent))) { + return currentAutomationEvent.value; + } + if (currentAutomationEvent !== undefined && + isSetValueCurveAutomationEvent(currentAutomationEvent) && + (nextAutomationEvent === undefined || + !isAnyRampToValueAutomationEvent(nextAutomationEvent) || + currentAutomationEvent.startTime + currentAutomationEvent.duration > time)) { + if (time < currentAutomationEvent.startTime + currentAutomationEvent.duration) { + return getValueCurveValueAtTime(time, currentAutomationEvent); + } + return currentAutomationEvent.values[currentAutomationEvent.values.length - 1]; + } + if (currentAutomationEvent !== undefined && + isAnyRampToValueAutomationEvent(currentAutomationEvent) && + (nextAutomationEvent === undefined || !isAnyRampToValueAutomationEvent(nextAutomationEvent))) { + return currentAutomationEvent.value; + } + if (nextAutomationEvent !== undefined && isExponentialRampToValueAutomationEvent(nextAutomationEvent)) { + const [startTime, value] = getEndTimeAndValueOfPreviousAutomationEvent(this._automationEvents, indexOfCurrentEvent, currentAutomationEvent, nextAutomationEvent, this._defaultValue); + return getExponentialRampValueAtTime(time, startTime, value, nextAutomationEvent); + } + if (nextAutomationEvent !== undefined && isLinearRampToValueAutomationEvent(nextAutomationEvent)) { + const [startTime, value] = getEndTimeAndValueOfPreviousAutomationEvent(this._automationEvents, indexOfCurrentEvent, currentAutomationEvent, nextAutomationEvent, this._defaultValue); + return getLinearRampValueAtTime(time, startTime, value, nextAutomationEvent); + } + return this._defaultValue; + } +} + +const createCancelAndHoldAutomationEvent = (cancelTime) => { + return { cancelTime, type: 'cancelAndHold' }; +}; + +const createCancelScheduledValuesAutomationEvent = (cancelTime) => { + return { cancelTime, type: 'cancelScheduledValues' }; +}; + +const createExponentialRampToValueAutomationEvent = (value, endTime) => { + return { endTime, type: 'exponentialRampToValue', value }; +}; + +const createLinearRampToValueAutomationEvent = (value, endTime) => { + return { endTime, type: 'linearRampToValue', value }; +}; + +const createSetTargetAutomationEvent = (target, startTime, timeConstant) => { + return { startTime, target, timeConstant, type: 'setTarget' }; +}; + +const createAbortError = () => new DOMException('', 'AbortError'); + +const createAddActiveInputConnectionToAudioNode = (insertElementInSet) => { + return (activeInputs, source, [output, input, eventListener], ignoreDuplicates) => { + insertElementInSet(activeInputs[input], [source, output, eventListener], (activeInputConnection) => activeInputConnection[0] === source && activeInputConnection[1] === output, ignoreDuplicates); + }; +}; + +const createAddAudioNodeConnections = (audioNodeConnectionsStore) => { + return (audioNode, audioNodeRenderer, nativeAudioNode) => { + const activeInputs = []; + for (let i = 0; i < nativeAudioNode.numberOfInputs; i += 1) { + activeInputs.push(new Set()); + } + audioNodeConnectionsStore.set(audioNode, { + activeInputs, + outputs: new Set(), + passiveInputs: new WeakMap(), + renderer: audioNodeRenderer + }); + }; +}; + +const createAddAudioParamConnections = (audioParamConnectionsStore) => { + return (audioParam, audioParamRenderer) => { + audioParamConnectionsStore.set(audioParam, { activeInputs: new Set(), passiveInputs: new WeakMap(), renderer: audioParamRenderer }); + }; +}; + +const ACTIVE_AUDIO_NODE_STORE = new WeakSet(); +const AUDIO_NODE_CONNECTIONS_STORE = new WeakMap(); +const AUDIO_NODE_STORE = new WeakMap(); +const AUDIO_PARAM_CONNECTIONS_STORE = new WeakMap(); +const AUDIO_PARAM_STORE = new WeakMap(); +const CONTEXT_STORE = new WeakMap(); +const EVENT_LISTENERS = new WeakMap(); +const CYCLE_COUNTERS = new WeakMap(); +// This clunky name is borrowed from the spec. :-) +const NODE_NAME_TO_PROCESSOR_CONSTRUCTOR_MAPS = new WeakMap(); +const NODE_TO_PROCESSOR_MAPS = new WeakMap(); + +const handler = { + construct() { + return handler; + } +}; +const isConstructible = (constructible) => { + try { + const proxy = new Proxy(constructible, handler); + new proxy(); // tslint:disable-line:no-unused-expression + } + catch { + return false; + } + return true; +}; + +/* + * This massive regex tries to cover all the following cases. + * + * import './path'; + * import defaultImport from './path'; + * import { namedImport } from './path'; + * import { namedImport as renamendImport } from './path'; + * import * as namespaceImport from './path'; + * import defaultImport, { namedImport } from './path'; + * import defaultImport, { namedImport as renamendImport } from './path'; + * import defaultImport, * as namespaceImport from './path'; + */ +const IMPORT_STATEMENT_REGEX = /^import(?:(?:[\s]+[\w]+|(?:[\s]+[\w]+[\s]*,)?[\s]*\{[\s]*[\w]+(?:[\s]+as[\s]+[\w]+)?(?:[\s]*,[\s]*[\w]+(?:[\s]+as[\s]+[\w]+)?)*[\s]*}|(?:[\s]+[\w]+[\s]*,)?[\s]*\*[\s]+as[\s]+[\w]+)[\s]+from)?(?:[\s]*)("([^"\\]|\\.)+"|'([^'\\]|\\.)+')(?:[\s]*);?/; // tslint:disable-line:max-line-length +const splitImportStatements = (source, url) => { + const importStatements = []; + let sourceWithoutImportStatements = source.replace(/^[\s]+/, ''); + let result = sourceWithoutImportStatements.match(IMPORT_STATEMENT_REGEX); + while (result !== null) { + const unresolvedUrl = result[1].slice(1, -1); + const importStatementWithResolvedUrl = result[0] + .replace(/([\s]+)?;?$/, '') + .replace(unresolvedUrl, new URL(unresolvedUrl, url).toString()); + importStatements.push(importStatementWithResolvedUrl); + sourceWithoutImportStatements = sourceWithoutImportStatements.slice(result[0].length).replace(/^[\s]+/, ''); + result = sourceWithoutImportStatements.match(IMPORT_STATEMENT_REGEX); + } + return [importStatements.join(';'), sourceWithoutImportStatements]; +}; + +const verifyParameterDescriptors = (parameterDescriptors) => { + if (parameterDescriptors !== undefined && !Array.isArray(parameterDescriptors)) { + throw new TypeError('The parameterDescriptors property of given value for processorCtor is not an array.'); + } +}; +const verifyProcessorCtor = (processorCtor) => { + if (!isConstructible(processorCtor)) { + throw new TypeError('The given value for processorCtor should be a constructor.'); + } + if (processorCtor.prototype === null || typeof processorCtor.prototype !== 'object') { + throw new TypeError('The given value for processorCtor should have a prototype.'); + } +}; +const createAddAudioWorkletModule = (cacheTestResult, createNotSupportedError, evaluateSource, exposeCurrentFrameAndCurrentTime, fetchSource, getNativeContext, getOrCreateBackupOfflineAudioContext, isNativeOfflineAudioContext, nativeAudioWorkletNodeConstructor, ongoingRequests, resolvedRequests, testAudioWorkletProcessorPostMessageSupport, window) => { + let index = 0; + return (context, moduleURL, options = { credentials: 'omit' }) => { + const resolvedRequestsOfContext = resolvedRequests.get(context); + if (resolvedRequestsOfContext !== undefined && resolvedRequestsOfContext.has(moduleURL)) { + return Promise.resolve(); + } + const ongoingRequestsOfContext = ongoingRequests.get(context); + if (ongoingRequestsOfContext !== undefined) { + const promiseOfOngoingRequest = ongoingRequestsOfContext.get(moduleURL); + if (promiseOfOngoingRequest !== undefined) { + return promiseOfOngoingRequest; + } + } + const nativeContext = getNativeContext(context); + // Bug #59: Safari does not implement the audioWorklet property. + const promise = nativeContext.audioWorklet === undefined + ? fetchSource(moduleURL) + .then(([source, absoluteUrl]) => { + const [importStatements, sourceWithoutImportStatements] = splitImportStatements(source, absoluteUrl); + /* + * This is the unminified version of the code used below: + * + * ```js + * ${ importStatements }; + * ((a, b) => { + * (a[b] = a[b] || [ ]).push( + * (AudioWorkletProcessor, global, registerProcessor, sampleRate, self, window) => { + * ${ sourceWithoutImportStatements } + * } + * ); + * })(window, '_AWGS'); + * ``` + */ + // tslint:disable-next-line:max-line-length + const wrappedSource = `${importStatements};((a,b)=>{(a[b]=a[b]||[]).push((AudioWorkletProcessor,global,registerProcessor,sampleRate,self,window)=>{${sourceWithoutImportStatements} +})})(window,'_AWGS')`; + // @todo Evaluating the given source code is a possible security problem. + return evaluateSource(wrappedSource); + }) + .then(() => { + const evaluateAudioWorkletGlobalScope = window._AWGS.pop(); + if (evaluateAudioWorkletGlobalScope === undefined) { + // Bug #182 Chrome, Edge and Opera do throw an instance of a SyntaxError instead of a DOMException. + throw new SyntaxError(); + } + exposeCurrentFrameAndCurrentTime(nativeContext.currentTime, nativeContext.sampleRate, () => evaluateAudioWorkletGlobalScope(class AudioWorkletProcessor { + }, undefined, (name, processorCtor) => { + if (name.trim() === '') { + throw createNotSupportedError(); + } + const nodeNameToProcessorConstructorMap = NODE_NAME_TO_PROCESSOR_CONSTRUCTOR_MAPS.get(nativeContext); + if (nodeNameToProcessorConstructorMap !== undefined) { + if (nodeNameToProcessorConstructorMap.has(name)) { + throw createNotSupportedError(); + } + verifyProcessorCtor(processorCtor); + verifyParameterDescriptors(processorCtor.parameterDescriptors); + nodeNameToProcessorConstructorMap.set(name, processorCtor); + } + else { + verifyProcessorCtor(processorCtor); + verifyParameterDescriptors(processorCtor.parameterDescriptors); + NODE_NAME_TO_PROCESSOR_CONSTRUCTOR_MAPS.set(nativeContext, new Map([[name, processorCtor]])); + } + }, nativeContext.sampleRate, undefined, undefined)); + }) + : Promise.all([ + fetchSource(moduleURL), + Promise.resolve(cacheTestResult(testAudioWorkletProcessorPostMessageSupport, testAudioWorkletProcessorPostMessageSupport)) + ]).then(([[source, absoluteUrl], isSupportingPostMessage]) => { + const currentIndex = index + 1; + index = currentIndex; + const [importStatements, sourceWithoutImportStatements] = splitImportStatements(source, absoluteUrl); + /* + * Bug #179: Firefox does not allow to transfer any buffer which has been passed to the process() method as an argument. + * + * This is the unminified version of the code used below. + * + * ```js + * class extends AudioWorkletProcessor { + * + * __buffers = new WeakSet(); + * + * constructor () { + * super(); + * + * this.port.postMessage = ((postMessage) => { + * return (message, transferables) => { + * const filteredTransferables = (transferables) + * ? transferables.filter((transferable) => !this.__buffers.has(transferable)) + * : transferables; + * + * return postMessage.call(this.port, message, filteredTransferables); + * }; + * })(this.port.postMessage); + * } + * } + * ``` + */ + const patchedAudioWorkletProcessor = isSupportingPostMessage + ? 'AudioWorkletProcessor' + : 'class extends AudioWorkletProcessor {__b=new WeakSet();constructor(){super();(p=>p.postMessage=(q=>(m,t)=>q.call(p,m,t?t.filter(u=>!this.__b.has(u)):t))(p.postMessage))(this.port)}}'; + /* + * Bug #170: Chrome and Edge do call process() with an array with empty channelData for each input if no input is connected. + * + * Bug #179: Firefox does not allow to transfer any buffer which has been passed to the process() method as an argument. + * + * Bug #190: Safari doesn't throw an error when loading an unparsable module. + * + * This is the unminified version of the code used below: + * + * ```js + * `${ importStatements }; + * ((AudioWorkletProcessor, registerProcessor) => {${ sourceWithoutImportStatements } + * })( + * ${ patchedAudioWorkletProcessor }, + * (name, processorCtor) => registerProcessor(name, class extends processorCtor { + * + * __collectBuffers = (array) => { + * array.forEach((element) => this.__buffers.add(element.buffer)); + * }; + * + * process (inputs, outputs, parameters) { + * inputs.forEach(this.__collectBuffers); + * outputs.forEach(this.__collectBuffers); + * this.__collectBuffers(Object.values(parameters)); + * + * return super.process( + * (inputs.map((input) => input.some((channelData) => channelData.length === 0)) ? [ ] : input), + * outputs, + * parameters + * ); + * } + * + * }) + * ); + * + * registerProcessor(`__sac${currentIndex}`, class extends AudioWorkletProcessor{ + * + * process () { + * return false; + * } + * + * })` + * ``` + */ + const memberDefinition = isSupportingPostMessage ? '' : '__c = (a) => a.forEach(e=>this.__b.add(e.buffer));'; + const bufferRegistration = isSupportingPostMessage + ? '' + : 'i.forEach(this.__c);o.forEach(this.__c);this.__c(Object.values(p));'; + const wrappedSource = `${importStatements};((AudioWorkletProcessor,registerProcessor)=>{${sourceWithoutImportStatements} +})(${patchedAudioWorkletProcessor},(n,p)=>registerProcessor(n,class extends p{${memberDefinition}process(i,o,p){${bufferRegistration}return super.process(i.map(j=>j.some(k=>k.length===0)?[]:j),o,p)}}));registerProcessor('__sac${currentIndex}',class extends AudioWorkletProcessor{process(){return !1}})`; + const blob = new Blob([wrappedSource], { type: 'application/javascript; charset=utf-8' }); + const url = URL.createObjectURL(blob); + return nativeContext.audioWorklet + .addModule(url, options) + .then(() => { + if (isNativeOfflineAudioContext(nativeContext)) { + return nativeContext; + } + // Bug #186: Chrome, Edge and Opera do not allow to create an AudioWorkletNode on a closed AudioContext. + const backupOfflineAudioContext = getOrCreateBackupOfflineAudioContext(nativeContext); + return backupOfflineAudioContext.audioWorklet.addModule(url, options).then(() => backupOfflineAudioContext); + }) + .then((nativeContextOrBackupOfflineAudioContext) => { + if (nativeAudioWorkletNodeConstructor === null) { + throw new SyntaxError(); + } + try { + // Bug #190: Safari doesn't throw an error when loading an unparsable module. + new nativeAudioWorkletNodeConstructor(nativeContextOrBackupOfflineAudioContext, `__sac${currentIndex}`); // tslint:disable-line:no-unused-expression + } + catch { + throw new SyntaxError(); + } + }) + .finally(() => URL.revokeObjectURL(url)); + }); + if (ongoingRequestsOfContext === undefined) { + ongoingRequests.set(context, new Map([[moduleURL, promise]])); + } + else { + ongoingRequestsOfContext.set(moduleURL, promise); + } + promise + .then(() => { + const updatedResolvedRequestsOfContext = resolvedRequests.get(context); + if (updatedResolvedRequestsOfContext === undefined) { + resolvedRequests.set(context, new Set([moduleURL])); + } + else { + updatedResolvedRequestsOfContext.add(moduleURL); + } + }) + .finally(() => { + const updatedOngoingRequestsOfContext = ongoingRequests.get(context); + if (updatedOngoingRequestsOfContext !== undefined) { + updatedOngoingRequestsOfContext.delete(moduleURL); + } + }); + return promise; + }; +}; + +const getValueForKey = (map, key) => { + const value = map.get(key); + if (value === undefined) { + throw new Error('A value with the given key could not be found.'); + } + return value; +}; + +const pickElementFromSet = (set, predicate) => { + const matchingElements = Array.from(set).filter(predicate); + if (matchingElements.length > 1) { + throw Error('More than one element was found.'); + } + if (matchingElements.length === 0) { + throw Error('No element was found.'); + } + const [matchingElement] = matchingElements; + set.delete(matchingElement); + return matchingElement; +}; + +const deletePassiveInputConnectionToAudioNode = (passiveInputs, source, output, input) => { + const passiveInputConnections = getValueForKey(passiveInputs, source); + const matchingConnection = pickElementFromSet(passiveInputConnections, (passiveInputConnection) => passiveInputConnection[0] === output && passiveInputConnection[1] === input); + if (passiveInputConnections.size === 0) { + passiveInputs.delete(source); + } + return matchingConnection; +}; + +const getEventListenersOfAudioNode = (audioNode) => { + return getValueForKey(EVENT_LISTENERS, audioNode); +}; + +const setInternalStateToActive = (audioNode) => { + if (ACTIVE_AUDIO_NODE_STORE.has(audioNode)) { + throw new Error('The AudioNode is already stored.'); + } + ACTIVE_AUDIO_NODE_STORE.add(audioNode); + getEventListenersOfAudioNode(audioNode).forEach((eventListener) => eventListener(true)); +}; + +const isAudioWorkletNode = (audioNode) => { + return 'port' in audioNode; +}; + +const setInternalStateToPassive = (audioNode) => { + if (!ACTIVE_AUDIO_NODE_STORE.has(audioNode)) { + throw new Error('The AudioNode is not stored.'); + } + ACTIVE_AUDIO_NODE_STORE.delete(audioNode); + getEventListenersOfAudioNode(audioNode).forEach((eventListener) => eventListener(false)); +}; + +// Set the internalState of the audioNode to 'passive' if it is not an AudioWorkletNode and if it has no 'active' input connections. +const setInternalStateToPassiveWhenNecessary = (audioNode, activeInputs) => { + if (!isAudioWorkletNode(audioNode) && activeInputs.every((connections) => connections.size === 0)) { + setInternalStateToPassive(audioNode); + } +}; + +const createAddConnectionToAudioNode = (addActiveInputConnectionToAudioNode, addPassiveInputConnectionToAudioNode, connectNativeAudioNodeToNativeAudioNode, deleteActiveInputConnectionToAudioNode, disconnectNativeAudioNodeFromNativeAudioNode, getAudioNodeConnections, getAudioNodeTailTime, getEventListenersOfAudioNode, getNativeAudioNode, insertElementInSet, isActiveAudioNode, isPartOfACycle, isPassiveAudioNode) => { + const tailTimeTimeoutIds = new WeakMap(); + return (source, destination, output, input, isOffline) => { + const { activeInputs, passiveInputs } = getAudioNodeConnections(destination); + const { outputs } = getAudioNodeConnections(source); + const eventListeners = getEventListenersOfAudioNode(source); + const eventListener = (isActive) => { + const nativeDestinationAudioNode = getNativeAudioNode(destination); + const nativeSourceAudioNode = getNativeAudioNode(source); + if (isActive) { + const partialConnection = deletePassiveInputConnectionToAudioNode(passiveInputs, source, output, input); + addActiveInputConnectionToAudioNode(activeInputs, source, partialConnection, false); + if (!isOffline && !isPartOfACycle(source)) { + connectNativeAudioNodeToNativeAudioNode(nativeSourceAudioNode, nativeDestinationAudioNode, output, input); + } + if (isPassiveAudioNode(destination)) { + setInternalStateToActive(destination); + } + } + else { + const partialConnection = deleteActiveInputConnectionToAudioNode(activeInputs, source, output, input); + addPassiveInputConnectionToAudioNode(passiveInputs, input, partialConnection, false); + if (!isOffline && !isPartOfACycle(source)) { + disconnectNativeAudioNodeFromNativeAudioNode(nativeSourceAudioNode, nativeDestinationAudioNode, output, input); + } + const tailTime = getAudioNodeTailTime(destination); + if (tailTime === 0) { + if (isActiveAudioNode(destination)) { + setInternalStateToPassiveWhenNecessary(destination, activeInputs); + } + } + else { + const tailTimeTimeoutId = tailTimeTimeoutIds.get(destination); + if (tailTimeTimeoutId !== undefined) { + clearTimeout(tailTimeTimeoutId); + } + tailTimeTimeoutIds.set(destination, setTimeout(() => { + if (isActiveAudioNode(destination)) { + setInternalStateToPassiveWhenNecessary(destination, activeInputs); + } + }, tailTime * 1000)); + } + } + }; + if (insertElementInSet(outputs, [destination, output, input], (outputConnection) => outputConnection[0] === destination && outputConnection[1] === output && outputConnection[2] === input, true)) { + eventListeners.add(eventListener); + if (isActiveAudioNode(source)) { + addActiveInputConnectionToAudioNode(activeInputs, source, [output, input, eventListener], true); + } + else { + addPassiveInputConnectionToAudioNode(passiveInputs, input, [source, output, eventListener], true); + } + return true; + } + return false; + }; +}; + +const createAddPassiveInputConnectionToAudioNode = (insertElementInSet) => { + return (passiveInputs, input, [source, output, eventListener], ignoreDuplicates) => { + const passiveInputConnections = passiveInputs.get(source); + if (passiveInputConnections === undefined) { + passiveInputs.set(source, new Set([[output, input, eventListener]])); + } + else { + insertElementInSet(passiveInputConnections, [output, input, eventListener], (passiveInputConnection) => passiveInputConnection[0] === output && passiveInputConnection[1] === input, ignoreDuplicates); + } + }; +}; + +const createAddSilentConnection = (createNativeGainNode) => { + return (nativeContext, nativeAudioScheduledSourceNode) => { + const nativeGainNode = createNativeGainNode(nativeContext, { + channelCount: 1, + channelCountMode: 'explicit', + channelInterpretation: 'discrete', + gain: 0 + }); + nativeAudioScheduledSourceNode.connect(nativeGainNode).connect(nativeContext.destination); + const disconnect = () => { + nativeAudioScheduledSourceNode.removeEventListener('ended', disconnect); + nativeAudioScheduledSourceNode.disconnect(nativeGainNode); + nativeGainNode.disconnect(); + }; + nativeAudioScheduledSourceNode.addEventListener('ended', disconnect); + }; +}; + +const createAddUnrenderedAudioWorkletNode = (getUnrenderedAudioWorkletNodes) => { + return (nativeContext, audioWorkletNode) => { + getUnrenderedAudioWorkletNodes(nativeContext).add(audioWorkletNode); + }; +}; + +const DEFAULT_OPTIONS = { + channelCount: 2, + channelCountMode: 'max', + channelInterpretation: 'speakers', + fftSize: 2048, + maxDecibels: -30, + minDecibels: -100, + smoothingTimeConstant: 0.8 +}; +const createAnalyserNodeConstructor = (audionNodeConstructor, createAnalyserNodeRenderer, createIndexSizeError, createNativeAnalyserNode, getNativeContext, isNativeOfflineAudioContext) => { + return class AnalyserNode extends audionNodeConstructor { + constructor(context, options) { + const nativeContext = getNativeContext(context); + const mergedOptions = { ...DEFAULT_OPTIONS, ...options }; + const nativeAnalyserNode = createNativeAnalyserNode(nativeContext, mergedOptions); + const analyserNodeRenderer = ((isNativeOfflineAudioContext(nativeContext) ? createAnalyserNodeRenderer() : null)); + super(context, false, nativeAnalyserNode, analyserNodeRenderer); + this._nativeAnalyserNode = nativeAnalyserNode; + } + get fftSize() { + return this._nativeAnalyserNode.fftSize; + } + set fftSize(value) { + this._nativeAnalyserNode.fftSize = value; + } + get frequencyBinCount() { + return this._nativeAnalyserNode.frequencyBinCount; + } + get maxDecibels() { + return this._nativeAnalyserNode.maxDecibels; + } + set maxDecibels(value) { + // Bug #118: Safari does not throw an error if maxDecibels is not more than minDecibels. + const maxDecibels = this._nativeAnalyserNode.maxDecibels; + this._nativeAnalyserNode.maxDecibels = value; + if (!(value > this._nativeAnalyserNode.minDecibels)) { + this._nativeAnalyserNode.maxDecibels = maxDecibels; + throw createIndexSizeError(); + } + } + get minDecibels() { + return this._nativeAnalyserNode.minDecibels; + } + set minDecibels(value) { + // Bug #118: Safari does not throw an error if maxDecibels is not more than minDecibels. + const minDecibels = this._nativeAnalyserNode.minDecibels; + this._nativeAnalyserNode.minDecibels = value; + if (!(this._nativeAnalyserNode.maxDecibels > value)) { + this._nativeAnalyserNode.minDecibels = minDecibels; + throw createIndexSizeError(); + } + } + get smoothingTimeConstant() { + return this._nativeAnalyserNode.smoothingTimeConstant; + } + set smoothingTimeConstant(value) { + this._nativeAnalyserNode.smoothingTimeConstant = value; + } + getByteFrequencyData(array) { + this._nativeAnalyserNode.getByteFrequencyData(array); + } + getByteTimeDomainData(array) { + this._nativeAnalyserNode.getByteTimeDomainData(array); + } + getFloatFrequencyData(array) { + this._nativeAnalyserNode.getFloatFrequencyData(array); + } + getFloatTimeDomainData(array) { + this._nativeAnalyserNode.getFloatTimeDomainData(array); + } + }; +}; + +const isOwnedByContext = (nativeAudioNode, nativeContext) => { + return nativeAudioNode.context === nativeContext; +}; + +const createAnalyserNodeRendererFactory = (createNativeAnalyserNode, getNativeAudioNode, renderInputsOfAudioNode) => { + return () => { + const renderedNativeAnalyserNodes = new WeakMap(); + const createAnalyserNode = async (proxy, nativeOfflineAudioContext) => { + let nativeAnalyserNode = getNativeAudioNode(proxy); + // If the initially used nativeAnalyserNode was not constructed on the same OfflineAudioContext it needs to be created again. + const nativeAnalyserNodeIsOwnedByContext = isOwnedByContext(nativeAnalyserNode, nativeOfflineAudioContext); + if (!nativeAnalyserNodeIsOwnedByContext) { + const options = { + channelCount: nativeAnalyserNode.channelCount, + channelCountMode: nativeAnalyserNode.channelCountMode, + channelInterpretation: nativeAnalyserNode.channelInterpretation, + fftSize: nativeAnalyserNode.fftSize, + maxDecibels: nativeAnalyserNode.maxDecibels, + minDecibels: nativeAnalyserNode.minDecibels, + smoothingTimeConstant: nativeAnalyserNode.smoothingTimeConstant + }; + nativeAnalyserNode = createNativeAnalyserNode(nativeOfflineAudioContext, options); + } + renderedNativeAnalyserNodes.set(nativeOfflineAudioContext, nativeAnalyserNode); + await renderInputsOfAudioNode(proxy, nativeOfflineAudioContext, nativeAnalyserNode); + return nativeAnalyserNode; + }; + return { + render(proxy, nativeOfflineAudioContext) { + const renderedNativeAnalyserNode = renderedNativeAnalyserNodes.get(nativeOfflineAudioContext); + if (renderedNativeAnalyserNode !== undefined) { + return Promise.resolve(renderedNativeAnalyserNode); + } + return createAnalyserNode(proxy, nativeOfflineAudioContext); + } + }; + }; +}; + +const testAudioBufferCopyChannelMethodsOutOfBoundsSupport = (nativeAudioBuffer) => { + try { + nativeAudioBuffer.copyToChannel(new Float32Array(1), 0, -1); + } + catch { + return false; + } + return true; +}; + +const createIndexSizeError = () => new DOMException('', 'IndexSizeError'); + +const wrapAudioBufferGetChannelDataMethod = (audioBuffer) => { + audioBuffer.getChannelData = ((getChannelData) => { + return (channel) => { + try { + return getChannelData.call(audioBuffer, channel); + } + catch (err) { + if (err.code === 12) { + throw createIndexSizeError(); + } + throw err; + } + }; + })(audioBuffer.getChannelData); +}; + +const DEFAULT_OPTIONS$1 = { + numberOfChannels: 1 +}; +const createAudioBufferConstructor = (audioBufferStore, cacheTestResult, createNotSupportedError, nativeAudioBufferConstructor, nativeOfflineAudioContextConstructor, testNativeAudioBufferConstructorSupport, wrapAudioBufferCopyChannelMethods, wrapAudioBufferCopyChannelMethodsOutOfBounds) => { + let nativeOfflineAudioContext = null; + return class AudioBuffer { + constructor(options) { + if (nativeOfflineAudioContextConstructor === null) { + throw new Error('Missing the native OfflineAudioContext constructor.'); + } + const { length, numberOfChannels, sampleRate } = { ...DEFAULT_OPTIONS$1, ...options }; + if (nativeOfflineAudioContext === null) { + nativeOfflineAudioContext = new nativeOfflineAudioContextConstructor(1, 1, 44100); + } + /* + * Bug #99: Firefox does not throw a NotSupportedError when the numberOfChannels is zero. But it only does it when using the + * factory function. But since Firefox also supports the constructor everything should be fine. + */ + const audioBuffer = nativeAudioBufferConstructor !== null && + cacheTestResult(testNativeAudioBufferConstructorSupport, testNativeAudioBufferConstructorSupport) + ? new nativeAudioBufferConstructor({ length, numberOfChannels, sampleRate }) + : nativeOfflineAudioContext.createBuffer(numberOfChannels, length, sampleRate); + // Bug #99: Safari does not throw an error when the numberOfChannels is zero. + if (audioBuffer.numberOfChannels === 0) { + throw createNotSupportedError(); + } + // Bug #5: Safari does not support copyFromChannel() and copyToChannel(). + // Bug #100: Safari does throw a wrong error when calling getChannelData() with an out-of-bounds value. + if (typeof audioBuffer.copyFromChannel !== 'function') { + wrapAudioBufferCopyChannelMethods(audioBuffer); + wrapAudioBufferGetChannelDataMethod(audioBuffer); + // Bug #157: Firefox does not allow the bufferOffset to be out-of-bounds. + } + else if (!cacheTestResult(testAudioBufferCopyChannelMethodsOutOfBoundsSupport, () => testAudioBufferCopyChannelMethodsOutOfBoundsSupport(audioBuffer))) { + wrapAudioBufferCopyChannelMethodsOutOfBounds(audioBuffer); + } + audioBufferStore.add(audioBuffer); + /* + * This does violate all good pratices but it is necessary to allow this AudioBuffer to be used with native + * (Offline)AudioContexts. + */ + return audioBuffer; + } + static [Symbol.hasInstance](instance) { + return ((instance !== null && typeof instance === 'object' && Object.getPrototypeOf(instance) === AudioBuffer.prototype) || + audioBufferStore.has(instance)); + } + }; +}; + +const MOST_NEGATIVE_SINGLE_FLOAT = -3.4028234663852886e38; +const MOST_POSITIVE_SINGLE_FLOAT = -MOST_NEGATIVE_SINGLE_FLOAT; + +const isActiveAudioNode = (audioNode) => ACTIVE_AUDIO_NODE_STORE.has(audioNode); + +const DEFAULT_OPTIONS$2 = { + buffer: null, + channelCount: 2, + channelCountMode: 'max', + channelInterpretation: 'speakers', + // Bug #149: Safari does not yet support the detune AudioParam. + loop: false, + loopEnd: 0, + loopStart: 0, + playbackRate: 1 +}; +const createAudioBufferSourceNodeConstructor = (audioNodeConstructor, createAudioBufferSourceNodeRenderer, createAudioParam, createInvalidStateError, createNativeAudioBufferSourceNode, getNativeContext, isNativeOfflineAudioContext, wrapEventListener) => { + return class AudioBufferSourceNode extends audioNodeConstructor { + constructor(context, options) { + const nativeContext = getNativeContext(context); + const mergedOptions = { ...DEFAULT_OPTIONS$2, ...options }; + const nativeAudioBufferSourceNode = createNativeAudioBufferSourceNode(nativeContext, mergedOptions); + const isOffline = isNativeOfflineAudioContext(nativeContext); + const audioBufferSourceNodeRenderer = ((isOffline ? createAudioBufferSourceNodeRenderer() : null)); + super(context, false, nativeAudioBufferSourceNode, audioBufferSourceNodeRenderer); + this._audioBufferSourceNodeRenderer = audioBufferSourceNodeRenderer; + this._isBufferNullified = false; + this._isBufferSet = mergedOptions.buffer !== null; + this._nativeAudioBufferSourceNode = nativeAudioBufferSourceNode; + this._onended = null; + // Bug #73: Safari does not export the correct values for maxValue and minValue. + this._playbackRate = createAudioParam(this, isOffline, nativeAudioBufferSourceNode.playbackRate, MOST_POSITIVE_SINGLE_FLOAT, MOST_NEGATIVE_SINGLE_FLOAT); + } + get buffer() { + if (this._isBufferNullified) { + return null; + } + return this._nativeAudioBufferSourceNode.buffer; + } + set buffer(value) { + this._nativeAudioBufferSourceNode.buffer = value; + // Bug #72: Only Chrome, Edge & Opera do not allow to reassign the buffer yet. + if (value !== null) { + if (this._isBufferSet) { + throw createInvalidStateError(); + } + this._isBufferSet = true; + } + } + get loop() { + return this._nativeAudioBufferSourceNode.loop; + } + set loop(value) { + this._nativeAudioBufferSourceNode.loop = value; + } + get loopEnd() { + return this._nativeAudioBufferSourceNode.loopEnd; + } + set loopEnd(value) { + this._nativeAudioBufferSourceNode.loopEnd = value; + } + get loopStart() { + return this._nativeAudioBufferSourceNode.loopStart; + } + set loopStart(value) { + this._nativeAudioBufferSourceNode.loopStart = value; + } + get onended() { + return this._onended; + } + set onended(value) { + const wrappedListener = typeof value === 'function' ? wrapEventListener(this, value) : null; + this._nativeAudioBufferSourceNode.onended = wrappedListener; + const nativeOnEnded = this._nativeAudioBufferSourceNode.onended; + this._onended = nativeOnEnded !== null && nativeOnEnded === wrappedListener ? value : nativeOnEnded; + } + get playbackRate() { + return this._playbackRate; + } + start(when = 0, offset = 0, duration) { + this._nativeAudioBufferSourceNode.start(when, offset, duration); + if (this._audioBufferSourceNodeRenderer !== null) { + this._audioBufferSourceNodeRenderer.start = duration === undefined ? [when, offset] : [when, offset, duration]; + } + if (this.context.state !== 'closed') { + setInternalStateToActive(this); + const resetInternalStateToPassive = () => { + this._nativeAudioBufferSourceNode.removeEventListener('ended', resetInternalStateToPassive); + if (isActiveAudioNode(this)) { + setInternalStateToPassive(this); + } + }; + this._nativeAudioBufferSourceNode.addEventListener('ended', resetInternalStateToPassive); + } + } + stop(when = 0) { + this._nativeAudioBufferSourceNode.stop(when); + if (this._audioBufferSourceNodeRenderer !== null) { + this._audioBufferSourceNodeRenderer.stop = when; + } + } + }; +}; + +const createAudioBufferSourceNodeRendererFactory = (connectAudioParam, createNativeAudioBufferSourceNode, getNativeAudioNode, renderAutomation, renderInputsOfAudioNode) => { + return () => { + const renderedNativeAudioBufferSourceNodes = new WeakMap(); + let start = null; + let stop = null; + const createAudioBufferSourceNode = async (proxy, nativeOfflineAudioContext) => { + let nativeAudioBufferSourceNode = getNativeAudioNode(proxy); + /* + * If the initially used nativeAudioBufferSourceNode was not constructed on the same OfflineAudioContext it needs to be created + * again. + */ + const nativeAudioBufferSourceNodeIsOwnedByContext = isOwnedByContext(nativeAudioBufferSourceNode, nativeOfflineAudioContext); + if (!nativeAudioBufferSourceNodeIsOwnedByContext) { + const options = { + buffer: nativeAudioBufferSourceNode.buffer, + channelCount: nativeAudioBufferSourceNode.channelCount, + channelCountMode: nativeAudioBufferSourceNode.channelCountMode, + channelInterpretation: nativeAudioBufferSourceNode.channelInterpretation, + // Bug #149: Safari does not yet support the detune AudioParam. + loop: nativeAudioBufferSourceNode.loop, + loopEnd: nativeAudioBufferSourceNode.loopEnd, + loopStart: nativeAudioBufferSourceNode.loopStart, + playbackRate: nativeAudioBufferSourceNode.playbackRate.value + }; + nativeAudioBufferSourceNode = createNativeAudioBufferSourceNode(nativeOfflineAudioContext, options); + if (start !== null) { + nativeAudioBufferSourceNode.start(...start); + } + if (stop !== null) { + nativeAudioBufferSourceNode.stop(stop); + } + } + renderedNativeAudioBufferSourceNodes.set(nativeOfflineAudioContext, nativeAudioBufferSourceNode); + if (!nativeAudioBufferSourceNodeIsOwnedByContext) { + // Bug #149: Safari does not yet support the detune AudioParam. + await renderAutomation(nativeOfflineAudioContext, proxy.playbackRate, nativeAudioBufferSourceNode.playbackRate); + } + else { + // Bug #149: Safari does not yet support the detune AudioParam. + await connectAudioParam(nativeOfflineAudioContext, proxy.playbackRate, nativeAudioBufferSourceNode.playbackRate); + } + await renderInputsOfAudioNode(proxy, nativeOfflineAudioContext, nativeAudioBufferSourceNode); + return nativeAudioBufferSourceNode; + }; + return { + set start(value) { + start = value; + }, + set stop(value) { + stop = value; + }, + render(proxy, nativeOfflineAudioContext) { + const renderedNativeAudioBufferSourceNode = renderedNativeAudioBufferSourceNodes.get(nativeOfflineAudioContext); + if (renderedNativeAudioBufferSourceNode !== undefined) { + return Promise.resolve(renderedNativeAudioBufferSourceNode); + } + return createAudioBufferSourceNode(proxy, nativeOfflineAudioContext); + } + }; + }; +}; + +const isAudioBufferSourceNode = (audioNode) => { + return 'playbackRate' in audioNode; +}; + +const isBiquadFilterNode = (audioNode) => { + return 'frequency' in audioNode && 'gain' in audioNode; +}; + +const isConstantSourceNode = (audioNode) => { + return 'offset' in audioNode; +}; + +const isGainNode = (audioNode) => { + return !('frequency' in audioNode) && 'gain' in audioNode; +}; + +const isOscillatorNode = (audioNode) => { + return 'detune' in audioNode && 'frequency' in audioNode; +}; + +const isStereoPannerNode = (audioNode) => { + return 'pan' in audioNode; +}; + +const getAudioNodeConnections = (audioNode) => { + return getValueForKey(AUDIO_NODE_CONNECTIONS_STORE, audioNode); +}; + +const getAudioParamConnections = (audioParam) => { + return getValueForKey(AUDIO_PARAM_CONNECTIONS_STORE, audioParam); +}; + +const deactivateActiveAudioNodeInputConnections = (audioNode, trace) => { + const { activeInputs } = getAudioNodeConnections(audioNode); + activeInputs.forEach((connections) => connections.forEach(([source]) => { + if (!trace.includes(audioNode)) { + deactivateActiveAudioNodeInputConnections(source, [...trace, audioNode]); + } + })); + const audioParams = isAudioBufferSourceNode(audioNode) + ? [ + // Bug #149: Safari does not yet support the detune AudioParam. + audioNode.playbackRate + ] + : isAudioWorkletNode(audioNode) + ? Array.from(audioNode.parameters.values()) + : isBiquadFilterNode(audioNode) + ? [audioNode.Q, audioNode.detune, audioNode.frequency, audioNode.gain] + : isConstantSourceNode(audioNode) + ? [audioNode.offset] + : isGainNode(audioNode) + ? [audioNode.gain] + : isOscillatorNode(audioNode) + ? [audioNode.detune, audioNode.frequency] + : isStereoPannerNode(audioNode) + ? [audioNode.pan] + : []; + for (const audioParam of audioParams) { + const audioParamConnections = getAudioParamConnections(audioParam); + if (audioParamConnections !== undefined) { + audioParamConnections.activeInputs.forEach(([source]) => deactivateActiveAudioNodeInputConnections(source, trace)); + } + } + if (isActiveAudioNode(audioNode)) { + setInternalStateToPassive(audioNode); + } +}; + +const deactivateAudioGraph = (context) => { + deactivateActiveAudioNodeInputConnections(context.destination, []); +}; + +const isValidLatencyHint = (latencyHint) => { + return (latencyHint === undefined || + typeof latencyHint === 'number' || + (typeof latencyHint === 'string' && (latencyHint === 'balanced' || latencyHint === 'interactive' || latencyHint === 'playback'))); +}; + +const createAudioContextConstructor = (baseAudioContextConstructor, createInvalidStateError, createNotSupportedError, createUnknownError, mediaElementAudioSourceNodeConstructor, mediaStreamAudioDestinationNodeConstructor, mediaStreamAudioSourceNodeConstructor, mediaStreamTrackAudioSourceNodeConstructor, nativeAudioContextConstructor) => { + return class AudioContext extends baseAudioContextConstructor { + constructor(options = {}) { + if (nativeAudioContextConstructor === null) { + throw new Error('Missing the native AudioContext constructor.'); + } + let nativeAudioContext; + try { + nativeAudioContext = new nativeAudioContextConstructor(options); + } + catch (err) { + // Bug #192 Safari does throw a SyntaxError if the sampleRate is not supported. + if (err.code === 12 && err.message === 'sampleRate is not in range') { + throw createNotSupportedError(); + } + throw err; + } + // Bug #131 Safari returns null when there are four other AudioContexts running already. + if (nativeAudioContext === null) { + throw createUnknownError(); + } + // Bug #51 Only Chrome, Edge and Opera throw an error if the given latencyHint is invalid. + if (!isValidLatencyHint(options.latencyHint)) { + throw new TypeError(`The provided value '${options.latencyHint}' is not a valid enum value of type AudioContextLatencyCategory.`); + } + // Bug #150 Safari does not support setting the sampleRate. + if (options.sampleRate !== undefined && nativeAudioContext.sampleRate !== options.sampleRate) { + throw createNotSupportedError(); + } + super(nativeAudioContext, 2); + const { latencyHint } = options; + const { sampleRate } = nativeAudioContext; + // @todo The values for 'balanced', 'interactive' and 'playback' are just copied from Chrome's implementation. + this._baseLatency = + typeof nativeAudioContext.baseLatency === 'number' + ? nativeAudioContext.baseLatency + : latencyHint === 'balanced' + ? 512 / sampleRate + : latencyHint === 'interactive' || latencyHint === undefined + ? 256 / sampleRate + : latencyHint === 'playback' + ? 1024 / sampleRate + : /* + * @todo The min (256) and max (16384) values are taken from the allowed bufferSize values of a + * ScriptProcessorNode. + */ + (Math.max(2, Math.min(128, Math.round((latencyHint * sampleRate) / 128))) * 128) / sampleRate; + this._nativeAudioContext = nativeAudioContext; + // Bug #188: Safari will set the context's state to 'interrupted' in case the user switches tabs. + if (nativeAudioContextConstructor.name === 'webkitAudioContext') { + this._nativeGainNode = nativeAudioContext.createGain(); + this._nativeOscillatorNode = nativeAudioContext.createOscillator(); + this._nativeGainNode.gain.value = 1e-37; + this._nativeOscillatorNode.connect(this._nativeGainNode).connect(nativeAudioContext.destination); + this._nativeOscillatorNode.start(); + } + else { + this._nativeGainNode = null; + this._nativeOscillatorNode = null; + } + this._state = null; + /* + * Bug #34: Chrome, Edge and Opera pretend to be running right away, but fire an onstatechange event when the state actually + * changes to 'running'. + */ + if (nativeAudioContext.state === 'running') { + this._state = 'suspended'; + const revokeState = () => { + if (this._state === 'suspended') { + this._state = null; + } + nativeAudioContext.removeEventListener('statechange', revokeState); + }; + nativeAudioContext.addEventListener('statechange', revokeState); + } + } + get baseLatency() { + return this._baseLatency; + } + get state() { + return this._state !== null ? this._state : this._nativeAudioContext.state; + } + close() { + // Bug #35: Firefox does not throw an error if the AudioContext was closed before. + if (this.state === 'closed') { + return this._nativeAudioContext.close().then(() => { + throw createInvalidStateError(); + }); + } + // Bug #34: If the state was set to suspended before it should be revoked now. + if (this._state === 'suspended') { + this._state = null; + } + return this._nativeAudioContext.close().then(() => { + if (this._nativeGainNode !== null && this._nativeOscillatorNode !== null) { + this._nativeOscillatorNode.stop(); + this._nativeGainNode.disconnect(); + this._nativeOscillatorNode.disconnect(); + } + deactivateAudioGraph(this); + }); + } + createMediaElementSource(mediaElement) { + return new mediaElementAudioSourceNodeConstructor(this, { mediaElement }); + } + createMediaStreamDestination() { + return new mediaStreamAudioDestinationNodeConstructor(this); + } + createMediaStreamSource(mediaStream) { + return new mediaStreamAudioSourceNodeConstructor(this, { mediaStream }); + } + createMediaStreamTrackSource(mediaStreamTrack) { + return new mediaStreamTrackAudioSourceNodeConstructor(this, { mediaStreamTrack }); + } + resume() { + if (this._state === 'suspended') { + return new Promise((resolve, reject) => { + const resolvePromise = () => { + this._nativeAudioContext.removeEventListener('statechange', resolvePromise); + if (this._nativeAudioContext.state === 'running') { + resolve(); + } + else { + this.resume().then(resolve, reject); + } + }; + this._nativeAudioContext.addEventListener('statechange', resolvePromise); + }); + } + return this._nativeAudioContext.resume().catch((err) => { + // Bug #55: Chrome, Edge and Opera do throw an InvalidAccessError instead of an InvalidStateError. + // Bug #56: Safari invokes the catch handler but without an error. + if (err === undefined || err.code === 15) { + throw createInvalidStateError(); + } + throw err; + }); + } + suspend() { + return this._nativeAudioContext.suspend().catch((err) => { + // Bug #56: Safari invokes the catch handler but without an error. + if (err === undefined) { + throw createInvalidStateError(); + } + throw err; + }); + } + }; +}; + +const createAudioDestinationNodeConstructor = (audioNodeConstructor, createAudioDestinationNodeRenderer, createIndexSizeError, createInvalidStateError, createNativeAudioDestinationNode, getNativeContext, isNativeOfflineAudioContext, renderInputsOfAudioNode) => { + return class AudioDestinationNode extends audioNodeConstructor { + constructor(context, channelCount) { + const nativeContext = getNativeContext(context); + const isOffline = isNativeOfflineAudioContext(nativeContext); + const nativeAudioDestinationNode = createNativeAudioDestinationNode(nativeContext, channelCount, isOffline); + const audioDestinationNodeRenderer = ((isOffline ? createAudioDestinationNodeRenderer(renderInputsOfAudioNode) : null)); + super(context, false, nativeAudioDestinationNode, audioDestinationNodeRenderer); + this._isNodeOfNativeOfflineAudioContext = isOffline; + this._nativeAudioDestinationNode = nativeAudioDestinationNode; + } + get channelCount() { + return this._nativeAudioDestinationNode.channelCount; + } + set channelCount(value) { + // Bug #52: Chrome, Edge, Opera & Safari do not throw an exception at all. + // Bug #54: Firefox does throw an IndexSizeError. + if (this._isNodeOfNativeOfflineAudioContext) { + throw createInvalidStateError(); + } + // Bug #47: The AudioDestinationNode in Safari does not initialize the maxChannelCount property correctly. + if (value > this._nativeAudioDestinationNode.maxChannelCount) { + throw createIndexSizeError(); + } + this._nativeAudioDestinationNode.channelCount = value; + } + get channelCountMode() { + return this._nativeAudioDestinationNode.channelCountMode; + } + set channelCountMode(value) { + // Bug #53: No browser does throw an exception yet. + if (this._isNodeOfNativeOfflineAudioContext) { + throw createInvalidStateError(); + } + this._nativeAudioDestinationNode.channelCountMode = value; + } + get maxChannelCount() { + return this._nativeAudioDestinationNode.maxChannelCount; + } + }; +}; + +const createAudioDestinationNodeRenderer = (renderInputsOfAudioNode) => { + const renderedNativeAudioDestinationNodes = new WeakMap(); + const createAudioDestinationNode = async (proxy, nativeOfflineAudioContext) => { + const nativeAudioDestinationNode = nativeOfflineAudioContext.destination; + renderedNativeAudioDestinationNodes.set(nativeOfflineAudioContext, nativeAudioDestinationNode); + await renderInputsOfAudioNode(proxy, nativeOfflineAudioContext, nativeAudioDestinationNode); + return nativeAudioDestinationNode; + }; + return { + render(proxy, nativeOfflineAudioContext) { + const renderedNativeAudioDestinationNode = renderedNativeAudioDestinationNodes.get(nativeOfflineAudioContext); + if (renderedNativeAudioDestinationNode !== undefined) { + return Promise.resolve(renderedNativeAudioDestinationNode); + } + return createAudioDestinationNode(proxy, nativeOfflineAudioContext); + } + }; +}; + +const createAudioListenerFactory = (createAudioParam, createNativeChannelMergerNode, createNativeConstantSourceNode, createNativeScriptProcessorNode, createNotSupportedError, getFirstSample, isNativeOfflineAudioContext, overwriteAccessors) => { + return (context, nativeContext) => { + const nativeListener = nativeContext.listener; + // Bug #117: Only Chrome, Edge & Opera support the new interface already. + const createFakeAudioParams = () => { + const buffer = new Float32Array(1); + const channelMergerNode = createNativeChannelMergerNode(nativeContext, { + channelCount: 1, + channelCountMode: 'explicit', + channelInterpretation: 'speakers', + numberOfInputs: 9 + }); + const isOffline = isNativeOfflineAudioContext(nativeContext); + let isScriptProcessorNodeCreated = false; + let lastOrientation = [0, 0, -1, 0, 1, 0]; + let lastPosition = [0, 0, 0]; + const createScriptProcessorNode = () => { + if (isScriptProcessorNodeCreated) { + return; + } + isScriptProcessorNodeCreated = true; + const scriptProcessorNode = createNativeScriptProcessorNode(nativeContext, 256, 9, 0); + // tslint:disable-next-line:deprecation + scriptProcessorNode.onaudioprocess = ({ inputBuffer }) => { + const orientation = [ + getFirstSample(inputBuffer, buffer, 0), + getFirstSample(inputBuffer, buffer, 1), + getFirstSample(inputBuffer, buffer, 2), + getFirstSample(inputBuffer, buffer, 3), + getFirstSample(inputBuffer, buffer, 4), + getFirstSample(inputBuffer, buffer, 5) + ]; + if (orientation.some((value, index) => value !== lastOrientation[index])) { + nativeListener.setOrientation(...orientation); // tslint:disable-line:deprecation + lastOrientation = orientation; + } + const positon = [ + getFirstSample(inputBuffer, buffer, 6), + getFirstSample(inputBuffer, buffer, 7), + getFirstSample(inputBuffer, buffer, 8) + ]; + if (positon.some((value, index) => value !== lastPosition[index])) { + nativeListener.setPosition(...positon); // tslint:disable-line:deprecation + lastPosition = positon; + } + }; + channelMergerNode.connect(scriptProcessorNode); + }; + const createSetOrientation = (index) => (value) => { + if (value !== lastOrientation[index]) { + lastOrientation[index] = value; + nativeListener.setOrientation(...lastOrientation); // tslint:disable-line:deprecation + } + }; + const createSetPosition = (index) => (value) => { + if (value !== lastPosition[index]) { + lastPosition[index] = value; + nativeListener.setPosition(...lastPosition); // tslint:disable-line:deprecation + } + }; + const createFakeAudioParam = (input, initialValue, setValue) => { + const constantSourceNode = createNativeConstantSourceNode(nativeContext, { + channelCount: 1, + channelCountMode: 'explicit', + channelInterpretation: 'discrete', + offset: initialValue + }); + constantSourceNode.connect(channelMergerNode, 0, input); + // @todo This should be stopped when the context is closed. + constantSourceNode.start(); + Object.defineProperty(constantSourceNode.offset, 'defaultValue', { + get() { + return initialValue; + } + }); + /* + * Bug #62 & #74: Safari does not support ConstantSourceNodes and does not export the correct values for maxValue and + * minValue for GainNodes. + */ + const audioParam = createAudioParam({ context }, isOffline, constantSourceNode.offset, MOST_POSITIVE_SINGLE_FLOAT, MOST_NEGATIVE_SINGLE_FLOAT); + overwriteAccessors(audioParam, 'value', (get) => () => get.call(audioParam), (set) => (value) => { + try { + set.call(audioParam, value); + } + catch (err) { + if (err.code !== 9) { + throw err; + } + } + createScriptProcessorNode(); + if (isOffline) { + // Bug #117: Using setOrientation() and setPosition() doesn't work with an OfflineAudioContext. + setValue(value); + } + }); + audioParam.cancelAndHoldAtTime = ((cancelAndHoldAtTime) => { + if (isOffline) { + return () => { + throw createNotSupportedError(); + }; + } + return (...args) => { + const value = cancelAndHoldAtTime.apply(audioParam, args); + createScriptProcessorNode(); + return value; + }; + })(audioParam.cancelAndHoldAtTime); + audioParam.cancelScheduledValues = ((cancelScheduledValues) => { + if (isOffline) { + return () => { + throw createNotSupportedError(); + }; + } + return (...args) => { + const value = cancelScheduledValues.apply(audioParam, args); + createScriptProcessorNode(); + return value; + }; + })(audioParam.cancelScheduledValues); + audioParam.exponentialRampToValueAtTime = ((exponentialRampToValueAtTime) => { + if (isOffline) { + return () => { + throw createNotSupportedError(); + }; + } + return (...args) => { + const value = exponentialRampToValueAtTime.apply(audioParam, args); + createScriptProcessorNode(); + return value; + }; + })(audioParam.exponentialRampToValueAtTime); + audioParam.linearRampToValueAtTime = ((linearRampToValueAtTime) => { + if (isOffline) { + return () => { + throw createNotSupportedError(); + }; + } + return (...args) => { + const value = linearRampToValueAtTime.apply(audioParam, args); + createScriptProcessorNode(); + return value; + }; + })(audioParam.linearRampToValueAtTime); + audioParam.setTargetAtTime = ((setTargetAtTime) => { + if (isOffline) { + return () => { + throw createNotSupportedError(); + }; + } + return (...args) => { + const value = setTargetAtTime.apply(audioParam, args); + createScriptProcessorNode(); + return value; + }; + })(audioParam.setTargetAtTime); + audioParam.setValueAtTime = ((setValueAtTime) => { + if (isOffline) { + return () => { + throw createNotSupportedError(); + }; + } + return (...args) => { + const value = setValueAtTime.apply(audioParam, args); + createScriptProcessorNode(); + return value; + }; + })(audioParam.setValueAtTime); + audioParam.setValueCurveAtTime = ((setValueCurveAtTime) => { + if (isOffline) { + return () => { + throw createNotSupportedError(); + }; + } + return (...args) => { + const value = setValueCurveAtTime.apply(audioParam, args); + createScriptProcessorNode(); + return value; + }; + })(audioParam.setValueCurveAtTime); + return audioParam; + }; + return { + forwardX: createFakeAudioParam(0, 0, createSetOrientation(0)), + forwardY: createFakeAudioParam(1, 0, createSetOrientation(1)), + forwardZ: createFakeAudioParam(2, -1, createSetOrientation(2)), + positionX: createFakeAudioParam(6, 0, createSetPosition(0)), + positionY: createFakeAudioParam(7, 0, createSetPosition(1)), + positionZ: createFakeAudioParam(8, 0, createSetPosition(2)), + upX: createFakeAudioParam(3, 0, createSetOrientation(3)), + upY: createFakeAudioParam(4, 1, createSetOrientation(4)), + upZ: createFakeAudioParam(5, 0, createSetOrientation(5)) + }; + }; + const { forwardX, forwardY, forwardZ, positionX, positionY, positionZ, upX, upY, upZ } = nativeListener.forwardX === undefined ? createFakeAudioParams() : nativeListener; + return { + get forwardX() { + return forwardX; + }, + get forwardY() { + return forwardY; + }, + get forwardZ() { + return forwardZ; + }, + get positionX() { + return positionX; + }, + get positionY() { + return positionY; + }, + get positionZ() { + return positionZ; + }, + get upX() { + return upX; + }, + get upY() { + return upY; + }, + get upZ() { + return upZ; + } + }; + }; +}; + +const isAudioNode = (audioNodeOrAudioParam) => { + return 'context' in audioNodeOrAudioParam; +}; + +const isAudioNodeOutputConnection = (outputConnection) => { + return isAudioNode(outputConnection[0]); +}; + +const insertElementInSet = (set, element, predicate, ignoreDuplicates) => { + for (const lmnt of set) { + if (predicate(lmnt)) { + if (ignoreDuplicates) { + return false; + } + throw Error('The set contains at least one similar element.'); + } + } + set.add(element); + return true; +}; + +const addActiveInputConnectionToAudioParam = (activeInputs, source, [output, eventListener], ignoreDuplicates) => { + insertElementInSet(activeInputs, [source, output, eventListener], (activeInputConnection) => activeInputConnection[0] === source && activeInputConnection[1] === output, ignoreDuplicates); +}; + +const addPassiveInputConnectionToAudioParam = (passiveInputs, [source, output, eventListener], ignoreDuplicates) => { + const passiveInputConnections = passiveInputs.get(source); + if (passiveInputConnections === undefined) { + passiveInputs.set(source, new Set([[output, eventListener]])); + } + else { + insertElementInSet(passiveInputConnections, [output, eventListener], (passiveInputConnection) => passiveInputConnection[0] === output, ignoreDuplicates); + } +}; + +const isNativeAudioNodeFaker = (nativeAudioNodeOrNativeAudioNodeFaker) => { + return 'inputs' in nativeAudioNodeOrNativeAudioNodeFaker; +}; + +const connectNativeAudioNodeToNativeAudioNode = (nativeSourceAudioNode, nativeDestinationAudioNode, output, input) => { + if (isNativeAudioNodeFaker(nativeDestinationAudioNode)) { + const fakeNativeDestinationAudioNode = nativeDestinationAudioNode.inputs[input]; + nativeSourceAudioNode.connect(fakeNativeDestinationAudioNode, output, 0); + return [fakeNativeDestinationAudioNode, output, 0]; + } + nativeSourceAudioNode.connect(nativeDestinationAudioNode, output, input); + return [nativeDestinationAudioNode, output, input]; +}; + +const deleteActiveInputConnection = (activeInputConnections, source, output) => { + for (const activeInputConnection of activeInputConnections) { + if (activeInputConnection[0] === source && activeInputConnection[1] === output) { + activeInputConnections.delete(activeInputConnection); + return activeInputConnection; + } + } + return null; +}; + +const deleteActiveInputConnectionToAudioParam = (activeInputs, source, output) => { + return pickElementFromSet(activeInputs, (activeInputConnection) => activeInputConnection[0] === source && activeInputConnection[1] === output); +}; + +const deleteEventListenerOfAudioNode = (audioNode, eventListener) => { + const eventListeners = getEventListenersOfAudioNode(audioNode); + if (!eventListeners.delete(eventListener)) { + throw new Error('Missing the expected event listener.'); + } +}; + +const deletePassiveInputConnectionToAudioParam = (passiveInputs, source, output) => { + const passiveInputConnections = getValueForKey(passiveInputs, source); + const matchingConnection = pickElementFromSet(passiveInputConnections, (passiveInputConnection) => passiveInputConnection[0] === output); + if (passiveInputConnections.size === 0) { + passiveInputs.delete(source); + } + return matchingConnection; +}; + +const disconnectNativeAudioNodeFromNativeAudioNode = (nativeSourceAudioNode, nativeDestinationAudioNode, output, input) => { + if (isNativeAudioNodeFaker(nativeDestinationAudioNode)) { + nativeSourceAudioNode.disconnect(nativeDestinationAudioNode.inputs[input], output, 0); + } + else { + nativeSourceAudioNode.disconnect(nativeDestinationAudioNode, output, input); + } +}; + +const getNativeAudioNode = (audioNode) => { + return getValueForKey(AUDIO_NODE_STORE, audioNode); +}; + +const getNativeAudioParam = (audioParam) => { + return getValueForKey(AUDIO_PARAM_STORE, audioParam); +}; + +const isPartOfACycle = (audioNode) => { + return CYCLE_COUNTERS.has(audioNode); +}; + +const isPassiveAudioNode = (audioNode) => { + return !ACTIVE_AUDIO_NODE_STORE.has(audioNode); +}; + +const testAudioNodeDisconnectMethodSupport = (nativeAudioContext, nativeAudioWorkletNodeConstructor) => { + return new Promise((resolve) => { + /* + * This bug existed in Safari up until v14.0.2. Since AudioWorklets were not supported in Safari until v14.1 the presence of the + * constructor for an AudioWorkletNode can be used here to skip the test. + */ + if (nativeAudioWorkletNodeConstructor !== null) { + resolve(true); + } + else { + const analyzer = nativeAudioContext.createScriptProcessor(256, 1, 1); // tslint:disable-line deprecation + const dummy = nativeAudioContext.createGain(); + // Bug #95: Safari does not play one sample buffers. + const ones = nativeAudioContext.createBuffer(1, 2, 44100); + const channelData = ones.getChannelData(0); + channelData[0] = 1; + channelData[1] = 1; + const source = nativeAudioContext.createBufferSource(); + source.buffer = ones; + source.loop = true; + source.connect(analyzer).connect(nativeAudioContext.destination); + source.connect(dummy); + source.disconnect(dummy); + // tslint:disable-next-line:deprecation + analyzer.onaudioprocess = (event) => { + const chnnlDt = event.inputBuffer.getChannelData(0); // tslint:disable-line deprecation + if (Array.prototype.some.call(chnnlDt, (sample) => sample === 1)) { + resolve(true); + } + else { + resolve(false); + } + source.stop(); + analyzer.onaudioprocess = null; // tslint:disable-line:deprecation + source.disconnect(analyzer); + analyzer.disconnect(nativeAudioContext.destination); + }; + source.start(); + } + }); +}; + +const visitEachAudioNodeOnce = (cycles, visitor) => { + const counts = new Map(); + for (const cycle of cycles) { + for (const audioNode of cycle) { + const count = counts.get(audioNode); + counts.set(audioNode, count === undefined ? 1 : count + 1); + } + } + counts.forEach((count, audioNode) => visitor(audioNode, count)); +}; + +const isNativeAudioNode = (nativeAudioNodeOrAudioParam) => { + return 'context' in nativeAudioNodeOrAudioParam; +}; + +const wrapAudioNodeDisconnectMethod = (nativeAudioNode) => { + const connections = new Map(); + nativeAudioNode.connect = ((connect) => { + // tslint:disable-next-line:invalid-void no-inferrable-types + return (destination, output = 0, input = 0) => { + const returnValue = isNativeAudioNode(destination) ? connect(destination, output, input) : connect(destination, output); + // Save the new connection only if the calls to connect above didn't throw an error. + const connectionsToDestination = connections.get(destination); + if (connectionsToDestination === undefined) { + connections.set(destination, [{ input, output }]); + } + else { + if (connectionsToDestination.every((connection) => connection.input !== input || connection.output !== output)) { + connectionsToDestination.push({ input, output }); + } + } + return returnValue; + }; + })(nativeAudioNode.connect.bind(nativeAudioNode)); + nativeAudioNode.disconnect = ((disconnect) => { + return (destinationOrOutput, output, input) => { + disconnect.apply(nativeAudioNode); + if (destinationOrOutput === undefined) { + connections.clear(); + } + else if (typeof destinationOrOutput === 'number') { + for (const [destination, connectionsToDestination] of connections) { + const filteredConnections = connectionsToDestination.filter((connection) => connection.output !== destinationOrOutput); + if (filteredConnections.length === 0) { + connections.delete(destination); + } + else { + connections.set(destination, filteredConnections); + } + } + } + else if (connections.has(destinationOrOutput)) { + if (output === undefined) { + connections.delete(destinationOrOutput); + } + else { + const connectionsToDestination = connections.get(destinationOrOutput); + if (connectionsToDestination !== undefined) { + const filteredConnections = connectionsToDestination.filter((connection) => connection.output !== output && (connection.input !== input || input === undefined)); + if (filteredConnections.length === 0) { + connections.delete(destinationOrOutput); + } + else { + connections.set(destinationOrOutput, filteredConnections); + } + } + } + } + for (const [destination, connectionsToDestination] of connections) { + connectionsToDestination.forEach((connection) => { + if (isNativeAudioNode(destination)) { + nativeAudioNode.connect(destination, connection.output, connection.input); + } + else { + nativeAudioNode.connect(destination, connection.output); + } + }); + } + }; + })(nativeAudioNode.disconnect); +}; + +const addConnectionToAudioParamOfAudioContext = (source, destination, output, isOffline) => { + const { activeInputs, passiveInputs } = getAudioParamConnections(destination); + const { outputs } = getAudioNodeConnections(source); + const eventListeners = getEventListenersOfAudioNode(source); + const eventListener = (isActive) => { + const nativeAudioNode = getNativeAudioNode(source); + const nativeAudioParam = getNativeAudioParam(destination); + if (isActive) { + const partialConnection = deletePassiveInputConnectionToAudioParam(passiveInputs, source, output); + addActiveInputConnectionToAudioParam(activeInputs, source, partialConnection, false); + if (!isOffline && !isPartOfACycle(source)) { + nativeAudioNode.connect(nativeAudioParam, output); + } + } + else { + const partialConnection = deleteActiveInputConnectionToAudioParam(activeInputs, source, output); + addPassiveInputConnectionToAudioParam(passiveInputs, partialConnection, false); + if (!isOffline && !isPartOfACycle(source)) { + nativeAudioNode.disconnect(nativeAudioParam, output); + } + } + }; + if (insertElementInSet(outputs, [destination, output], (outputConnection) => outputConnection[0] === destination && outputConnection[1] === output, true)) { + eventListeners.add(eventListener); + if (isActiveAudioNode(source)) { + addActiveInputConnectionToAudioParam(activeInputs, source, [output, eventListener], true); + } + else { + addPassiveInputConnectionToAudioParam(passiveInputs, [source, output, eventListener], true); + } + return true; + } + return false; +}; +const deleteInputConnectionOfAudioNode = (source, destination, output, input) => { + const { activeInputs, passiveInputs } = getAudioNodeConnections(destination); + const activeInputConnection = deleteActiveInputConnection(activeInputs[input], source, output); + if (activeInputConnection === null) { + const passiveInputConnection = deletePassiveInputConnectionToAudioNode(passiveInputs, source, output, input); + return [passiveInputConnection[2], false]; + } + return [activeInputConnection[2], true]; +}; +const deleteInputConnectionOfAudioParam = (source, destination, output) => { + const { activeInputs, passiveInputs } = getAudioParamConnections(destination); + const activeInputConnection = deleteActiveInputConnection(activeInputs, source, output); + if (activeInputConnection === null) { + const passiveInputConnection = deletePassiveInputConnectionToAudioParam(passiveInputs, source, output); + return [passiveInputConnection[1], false]; + } + return [activeInputConnection[2], true]; +}; +const deleteInputsOfAudioNode = (source, isOffline, destination, output, input) => { + const [listener, isActive] = deleteInputConnectionOfAudioNode(source, destination, output, input); + if (listener !== null) { + deleteEventListenerOfAudioNode(source, listener); + if (isActive && !isOffline && !isPartOfACycle(source)) { + disconnectNativeAudioNodeFromNativeAudioNode(getNativeAudioNode(source), getNativeAudioNode(destination), output, input); + } + } + if (isActiveAudioNode(destination)) { + const { activeInputs } = getAudioNodeConnections(destination); + setInternalStateToPassiveWhenNecessary(destination, activeInputs); + } +}; +const deleteInputsOfAudioParam = (source, isOffline, destination, output) => { + const [listener, isActive] = deleteInputConnectionOfAudioParam(source, destination, output); + if (listener !== null) { + deleteEventListenerOfAudioNode(source, listener); + if (isActive && !isOffline && !isPartOfACycle(source)) { + getNativeAudioNode(source).disconnect(getNativeAudioParam(destination), output); + } + } +}; +const deleteAnyConnection = (source, isOffline) => { + const audioNodeConnectionsOfSource = getAudioNodeConnections(source); + const destinations = []; + for (const outputConnection of audioNodeConnectionsOfSource.outputs) { + if (isAudioNodeOutputConnection(outputConnection)) { + deleteInputsOfAudioNode(source, isOffline, ...outputConnection); + } + else { + deleteInputsOfAudioParam(source, isOffline, ...outputConnection); + } + destinations.push(outputConnection[0]); + } + audioNodeConnectionsOfSource.outputs.clear(); + return destinations; +}; +const deleteConnectionAtOutput = (source, isOffline, output) => { + const audioNodeConnectionsOfSource = getAudioNodeConnections(source); + const destinations = []; + for (const outputConnection of audioNodeConnectionsOfSource.outputs) { + if (outputConnection[1] === output) { + if (isAudioNodeOutputConnection(outputConnection)) { + deleteInputsOfAudioNode(source, isOffline, ...outputConnection); + } + else { + deleteInputsOfAudioParam(source, isOffline, ...outputConnection); + } + destinations.push(outputConnection[0]); + audioNodeConnectionsOfSource.outputs.delete(outputConnection); + } + } + return destinations; +}; +const deleteConnectionToDestination = (source, isOffline, destination, output, input) => { + const audioNodeConnectionsOfSource = getAudioNodeConnections(source); + return Array.from(audioNodeConnectionsOfSource.outputs) + .filter((outputConnection) => outputConnection[0] === destination && + (output === undefined || outputConnection[1] === output) && + (input === undefined || outputConnection[2] === input)) + .map((outputConnection) => { + if (isAudioNodeOutputConnection(outputConnection)) { + deleteInputsOfAudioNode(source, isOffline, ...outputConnection); + } + else { + deleteInputsOfAudioParam(source, isOffline, ...outputConnection); + } + audioNodeConnectionsOfSource.outputs.delete(outputConnection); + return outputConnection[0]; + }); +}; +const createAudioNodeConstructor = (addAudioNodeConnections, addConnectionToAudioNode, cacheTestResult, createIncrementCycleCounter, createIndexSizeError, createInvalidAccessError, createNotSupportedError, decrementCycleCounter, detectCycles, eventTargetConstructor, getNativeContext, isNativeAudioContext, isNativeAudioNode, isNativeAudioParam, isNativeOfflineAudioContext, nativeAudioWorkletNodeConstructor) => { + return class AudioNode extends eventTargetConstructor { + constructor(context, isActive, nativeAudioNode, audioNodeRenderer) { + super(nativeAudioNode); + this._context = context; + this._nativeAudioNode = nativeAudioNode; + const nativeContext = getNativeContext(context); + // Bug #12: Safari does not support to disconnect a specific destination. + if (isNativeAudioContext(nativeContext) && + true !== + cacheTestResult(testAudioNodeDisconnectMethodSupport, () => { + return testAudioNodeDisconnectMethodSupport(nativeContext, nativeAudioWorkletNodeConstructor); + })) { + wrapAudioNodeDisconnectMethod(nativeAudioNode); + } + AUDIO_NODE_STORE.set(this, nativeAudioNode); + EVENT_LISTENERS.set(this, new Set()); + if (context.state !== 'closed' && isActive) { + setInternalStateToActive(this); + } + addAudioNodeConnections(this, audioNodeRenderer, nativeAudioNode); + } + get channelCount() { + return this._nativeAudioNode.channelCount; + } + set channelCount(value) { + this._nativeAudioNode.channelCount = value; + } + get channelCountMode() { + return this._nativeAudioNode.channelCountMode; + } + set channelCountMode(value) { + this._nativeAudioNode.channelCountMode = value; + } + get channelInterpretation() { + return this._nativeAudioNode.channelInterpretation; + } + set channelInterpretation(value) { + this._nativeAudioNode.channelInterpretation = value; + } + get context() { + return this._context; + } + get numberOfInputs() { + return this._nativeAudioNode.numberOfInputs; + } + get numberOfOutputs() { + return this._nativeAudioNode.numberOfOutputs; + } + // tslint:disable-next-line:invalid-void + connect(destination, output = 0, input = 0) { + // Bug #174: Safari does expose a wrong numberOfOutputs for MediaStreamAudioDestinationNodes. + if (output < 0 || output >= this._nativeAudioNode.numberOfOutputs) { + throw createIndexSizeError(); + } + const nativeContext = getNativeContext(this._context); + const isOffline = isNativeOfflineAudioContext(nativeContext); + if (isNativeAudioNode(destination) || isNativeAudioParam(destination)) { + throw createInvalidAccessError(); + } + if (isAudioNode(destination)) { + const nativeDestinationAudioNode = getNativeAudioNode(destination); + try { + const connection = connectNativeAudioNodeToNativeAudioNode(this._nativeAudioNode, nativeDestinationAudioNode, output, input); + const isPassive = isPassiveAudioNode(this); + if (isOffline || isPassive) { + this._nativeAudioNode.disconnect(...connection); + } + if (this.context.state !== 'closed' && !isPassive && isPassiveAudioNode(destination)) { + setInternalStateToActive(destination); + } + } + catch (err) { + // Bug #41: Safari does not throw the correct exception so far. + if (err.code === 12) { + throw createInvalidAccessError(); + } + throw err; + } + const isNewConnectionToAudioNode = addConnectionToAudioNode(this, destination, output, input, isOffline); + // Bug #164: Only Firefox detects cycles so far. + if (isNewConnectionToAudioNode) { + const cycles = detectCycles([this], destination); + visitEachAudioNodeOnce(cycles, createIncrementCycleCounter(isOffline)); + } + return destination; + } + const nativeAudioParam = getNativeAudioParam(destination); + /* + * Bug #73, #147 & #153: Safari does not support to connect an input signal to the playbackRate AudioParam of an + * AudioBufferSourceNode. This can't be easily detected and that's why the outdated name property is used here to identify + * Safari. In addition to that the maxValue property is used to only detect the affected versions below v14.0.2. + */ + if (nativeAudioParam.name === 'playbackRate' && nativeAudioParam.maxValue === 1024) { + throw createNotSupportedError(); + } + try { + this._nativeAudioNode.connect(nativeAudioParam, output); + if (isOffline || isPassiveAudioNode(this)) { + this._nativeAudioNode.disconnect(nativeAudioParam, output); + } + } + catch (err) { + // Bug #58: Safari doesn't throw an InvalidAccessError yet. + if (err.code === 12) { + throw createInvalidAccessError(); + } + throw err; + } + const isNewConnectionToAudioParam = addConnectionToAudioParamOfAudioContext(this, destination, output, isOffline); + // Bug #164: Only Firefox detects cycles so far. + if (isNewConnectionToAudioParam) { + const cycles = detectCycles([this], destination); + visitEachAudioNodeOnce(cycles, createIncrementCycleCounter(isOffline)); + } + } + disconnect(destinationOrOutput, output, input) { + let destinations; + const nativeContext = getNativeContext(this._context); + const isOffline = isNativeOfflineAudioContext(nativeContext); + if (destinationOrOutput === undefined) { + destinations = deleteAnyConnection(this, isOffline); + } + else if (typeof destinationOrOutput === 'number') { + if (destinationOrOutput < 0 || destinationOrOutput >= this.numberOfOutputs) { + throw createIndexSizeError(); + } + destinations = deleteConnectionAtOutput(this, isOffline, destinationOrOutput); + } + else { + if (output !== undefined && (output < 0 || output >= this.numberOfOutputs)) { + throw createIndexSizeError(); + } + if (isAudioNode(destinationOrOutput) && input !== undefined && (input < 0 || input >= destinationOrOutput.numberOfInputs)) { + throw createIndexSizeError(); + } + destinations = deleteConnectionToDestination(this, isOffline, destinationOrOutput, output, input); + if (destinations.length === 0) { + throw createInvalidAccessError(); + } + } + // Bug #164: Only Firefox detects cycles so far. + for (const destination of destinations) { + const cycles = detectCycles([this], destination); + visitEachAudioNodeOnce(cycles, decrementCycleCounter); + } + } + }; +}; + +const createAudioParamFactory = (addAudioParamConnections, audioParamAudioNodeStore, audioParamStore, createAudioParamRenderer, createCancelAndHoldAutomationEvent, createCancelScheduledValuesAutomationEvent, createExponentialRampToValueAutomationEvent, createLinearRampToValueAutomationEvent, createSetTargetAutomationEvent, createSetValueAutomationEvent, createSetValueCurveAutomationEvent, nativeAudioContextConstructor, setValueAtTimeUntilPossible) => { + return (audioNode, isAudioParamOfOfflineAudioContext, nativeAudioParam, maxValue = null, minValue = null) => { + const automationEventList = new AutomationEventList(nativeAudioParam.defaultValue); + const audioParamRenderer = isAudioParamOfOfflineAudioContext ? createAudioParamRenderer(automationEventList) : null; + const audioParam = { + get defaultValue() { + return nativeAudioParam.defaultValue; + }, + get maxValue() { + return maxValue === null ? nativeAudioParam.maxValue : maxValue; + }, + get minValue() { + return minValue === null ? nativeAudioParam.minValue : minValue; + }, + get value() { + return nativeAudioParam.value; + }, + set value(value) { + nativeAudioParam.value = value; + // Bug #98: Firefox & Safari do not yet treat the value setter like a call to setValueAtTime(). + audioParam.setValueAtTime(value, audioNode.context.currentTime); + }, + cancelAndHoldAtTime(cancelTime) { + // Bug #28: Firefox & Safari do not yet implement cancelAndHoldAtTime(). + if (typeof nativeAudioParam.cancelAndHoldAtTime === 'function') { + if (audioParamRenderer === null) { + automationEventList.flush(audioNode.context.currentTime); + } + automationEventList.add(createCancelAndHoldAutomationEvent(cancelTime)); + nativeAudioParam.cancelAndHoldAtTime(cancelTime); + } + else { + const previousLastEvent = Array.from(automationEventList).pop(); + if (audioParamRenderer === null) { + automationEventList.flush(audioNode.context.currentTime); + } + automationEventList.add(createCancelAndHoldAutomationEvent(cancelTime)); + const currentLastEvent = Array.from(automationEventList).pop(); + nativeAudioParam.cancelScheduledValues(cancelTime); + if (previousLastEvent !== currentLastEvent && currentLastEvent !== undefined) { + if (currentLastEvent.type === 'exponentialRampToValue') { + nativeAudioParam.exponentialRampToValueAtTime(currentLastEvent.value, currentLastEvent.endTime); + } + else if (currentLastEvent.type === 'linearRampToValue') { + nativeAudioParam.linearRampToValueAtTime(currentLastEvent.value, currentLastEvent.endTime); + } + else if (currentLastEvent.type === 'setValue') { + nativeAudioParam.setValueAtTime(currentLastEvent.value, currentLastEvent.startTime); + } + else if (currentLastEvent.type === 'setValueCurve') { + nativeAudioParam.setValueCurveAtTime(currentLastEvent.values, currentLastEvent.startTime, currentLastEvent.duration); + } + } + } + return audioParam; + }, + cancelScheduledValues(cancelTime) { + if (audioParamRenderer === null) { + automationEventList.flush(audioNode.context.currentTime); + } + automationEventList.add(createCancelScheduledValuesAutomationEvent(cancelTime)); + nativeAudioParam.cancelScheduledValues(cancelTime); + return audioParam; + }, + exponentialRampToValueAtTime(value, endTime) { + // Bug #45: Safari does not throw an error yet. + if (value === 0) { + throw new RangeError(); + } + // Bug #187: Safari does not throw an error yet. + if (!Number.isFinite(endTime) || endTime < 0) { + throw new RangeError(); + } + if (audioParamRenderer === null) { + automationEventList.flush(audioNode.context.currentTime); + } + automationEventList.add(createExponentialRampToValueAutomationEvent(value, endTime)); + nativeAudioParam.exponentialRampToValueAtTime(value, endTime); + return audioParam; + }, + linearRampToValueAtTime(value, endTime) { + if (audioParamRenderer === null) { + automationEventList.flush(audioNode.context.currentTime); + } + automationEventList.add(createLinearRampToValueAutomationEvent(value, endTime)); + nativeAudioParam.linearRampToValueAtTime(value, endTime); + return audioParam; + }, + setTargetAtTime(target, startTime, timeConstant) { + if (audioParamRenderer === null) { + automationEventList.flush(audioNode.context.currentTime); + } + automationEventList.add(createSetTargetAutomationEvent(target, startTime, timeConstant)); + nativeAudioParam.setTargetAtTime(target, startTime, timeConstant); + return audioParam; + }, + setValueAtTime(value, startTime) { + if (audioParamRenderer === null) { + automationEventList.flush(audioNode.context.currentTime); + } + automationEventList.add(createSetValueAutomationEvent(value, startTime)); + nativeAudioParam.setValueAtTime(value, startTime); + return audioParam; + }, + setValueCurveAtTime(values, startTime, duration) { + // Bug 183: Safari only accepts a Float32Array. + const convertedValues = values instanceof Float32Array ? values : new Float32Array(values); + /* + * Bug #152: Safari does not correctly interpolate the values of the curve. + * @todo Unfortunately there is no way to test for this behavior in a synchronous fashion which is why testing for the + * existence of the webkitAudioContext is used as a workaround here. + */ + if (nativeAudioContextConstructor !== null && nativeAudioContextConstructor.name === 'webkitAudioContext') { + const endTime = startTime + duration; + const sampleRate = audioNode.context.sampleRate; + const firstSample = Math.ceil(startTime * sampleRate); + const lastSample = Math.floor(endTime * sampleRate); + const numberOfInterpolatedValues = lastSample - firstSample; + const interpolatedValues = new Float32Array(numberOfInterpolatedValues); + for (let i = 0; i < numberOfInterpolatedValues; i += 1) { + const theoreticIndex = ((convertedValues.length - 1) / duration) * ((firstSample + i) / sampleRate - startTime); + const lowerIndex = Math.floor(theoreticIndex); + const upperIndex = Math.ceil(theoreticIndex); + interpolatedValues[i] = + lowerIndex === upperIndex + ? convertedValues[lowerIndex] + : (1 - (theoreticIndex - lowerIndex)) * convertedValues[lowerIndex] + + (1 - (upperIndex - theoreticIndex)) * convertedValues[upperIndex]; + } + if (audioParamRenderer === null) { + automationEventList.flush(audioNode.context.currentTime); + } + automationEventList.add(createSetValueCurveAutomationEvent(interpolatedValues, startTime, duration)); + nativeAudioParam.setValueCurveAtTime(interpolatedValues, startTime, duration); + const timeOfLastSample = lastSample / sampleRate; + if (timeOfLastSample < endTime) { + setValueAtTimeUntilPossible(audioParam, interpolatedValues[interpolatedValues.length - 1], timeOfLastSample); + } + setValueAtTimeUntilPossible(audioParam, convertedValues[convertedValues.length - 1], endTime); + } + else { + if (audioParamRenderer === null) { + automationEventList.flush(audioNode.context.currentTime); + } + automationEventList.add(createSetValueCurveAutomationEvent(convertedValues, startTime, duration)); + nativeAudioParam.setValueCurveAtTime(convertedValues, startTime, duration); + } + return audioParam; + } + }; + audioParamStore.set(audioParam, nativeAudioParam); + audioParamAudioNodeStore.set(audioParam, audioNode); + addAudioParamConnections(audioParam, audioParamRenderer); + return audioParam; + }; +}; + +const createAudioParamRenderer = (automationEventList) => { + return { + replay(audioParam) { + for (const automationEvent of automationEventList) { + if (automationEvent.type === 'exponentialRampToValue') { + const { endTime, value } = automationEvent; + audioParam.exponentialRampToValueAtTime(value, endTime); + } + else if (automationEvent.type === 'linearRampToValue') { + const { endTime, value } = automationEvent; + audioParam.linearRampToValueAtTime(value, endTime); + } + else if (automationEvent.type === 'setTarget') { + const { startTime, target, timeConstant } = automationEvent; + audioParam.setTargetAtTime(target, startTime, timeConstant); + } + else if (automationEvent.type === 'setValue') { + const { startTime, value } = automationEvent; + audioParam.setValueAtTime(value, startTime); + } + else if (automationEvent.type === 'setValueCurve') { + const { duration, startTime, values } = automationEvent; + audioParam.setValueCurveAtTime(values, startTime, duration); + } + else { + throw new Error("Can't apply an unknown automation."); + } + } + } + }; +}; + +class ReadOnlyMap { + constructor(parameters) { + this._map = new Map(parameters); + } + get size() { + return this._map.size; + } + entries() { + return this._map.entries(); + } + forEach(callback, thisArg = null) { + return this._map.forEach((value, key) => callback.call(thisArg, value, key, this)); + } + get(name) { + return this._map.get(name); + } + has(name) { + return this._map.has(name); + } + keys() { + return this._map.keys(); + } + values() { + return this._map.values(); + } +} + +const DEFAULT_OPTIONS$3 = { + channelCount: 2, + // Bug #61: The channelCountMode should be 'max' according to the spec but is set to 'explicit' to achieve consistent behavior. + channelCountMode: 'explicit', + channelInterpretation: 'speakers', + numberOfInputs: 1, + numberOfOutputs: 1, + parameterData: {}, + processorOptions: {} +}; +const createAudioWorkletNodeConstructor = (addUnrenderedAudioWorkletNode, audioNodeConstructor, createAudioParam, createAudioWorkletNodeRenderer, createNativeAudioWorkletNode, getAudioNodeConnections, getBackupOfflineAudioContext, getNativeContext, isNativeOfflineAudioContext, nativeAudioWorkletNodeConstructor, sanitizeAudioWorkletNodeOptions, setActiveAudioWorkletNodeInputs, testAudioWorkletNodeOptionsClonability, wrapEventListener) => { + return class AudioWorkletNode extends audioNodeConstructor { + constructor(context, name, options) { + var _a; + const nativeContext = getNativeContext(context); + const isOffline = isNativeOfflineAudioContext(nativeContext); + const mergedOptions = sanitizeAudioWorkletNodeOptions({ ...DEFAULT_OPTIONS$3, ...options }); + // Bug #191: Safari doesn't throw an error if the options aren't clonable. + testAudioWorkletNodeOptionsClonability(mergedOptions); + const nodeNameToProcessorConstructorMap = NODE_NAME_TO_PROCESSOR_CONSTRUCTOR_MAPS.get(nativeContext); + const processorConstructor = nodeNameToProcessorConstructorMap === null || nodeNameToProcessorConstructorMap === void 0 ? void 0 : nodeNameToProcessorConstructorMap.get(name); + // Bug #186: Chrome, Edge and Opera do not allow to create an AudioWorkletNode on a closed AudioContext. + const nativeContextOrBackupOfflineAudioContext = isOffline || nativeContext.state !== 'closed' + ? nativeContext + : (_a = getBackupOfflineAudioContext(nativeContext)) !== null && _a !== void 0 ? _a : nativeContext; + const nativeAudioWorkletNode = createNativeAudioWorkletNode(nativeContextOrBackupOfflineAudioContext, isOffline ? null : context.baseLatency, nativeAudioWorkletNodeConstructor, name, processorConstructor, mergedOptions); + const audioWorkletNodeRenderer = ((isOffline ? createAudioWorkletNodeRenderer(name, mergedOptions, processorConstructor) : null)); + /* + * @todo Add a mechanism to switch an AudioWorkletNode to passive once the process() function of the AudioWorkletProcessor + * returns false. + */ + super(context, true, nativeAudioWorkletNode, audioWorkletNodeRenderer); + const parameters = []; + nativeAudioWorkletNode.parameters.forEach((nativeAudioParam, nm) => { + const audioParam = createAudioParam(this, isOffline, nativeAudioParam); + parameters.push([nm, audioParam]); + }); + this._nativeAudioWorkletNode = nativeAudioWorkletNode; + this._onprocessorerror = null; + this._parameters = new ReadOnlyMap(parameters); + /* + * Bug #86 & #87: Invoking the renderer of an AudioWorkletNode might be necessary if it has no direct or indirect connection to + * the destination. + */ + if (isOffline) { + addUnrenderedAudioWorkletNode(nativeContext, this); + } + const { activeInputs } = getAudioNodeConnections(this); + setActiveAudioWorkletNodeInputs(nativeAudioWorkletNode, activeInputs); + } + get onprocessorerror() { + return this._onprocessorerror; + } + set onprocessorerror(value) { + const wrappedListener = typeof value === 'function' ? wrapEventListener(this, value) : null; + this._nativeAudioWorkletNode.onprocessorerror = wrappedListener; + const nativeOnProcessorError = this._nativeAudioWorkletNode.onprocessorerror; + this._onprocessorerror = + nativeOnProcessorError !== null && nativeOnProcessorError === wrappedListener + ? value + : nativeOnProcessorError; + } + get parameters() { + if (this._parameters === null) { + // @todo The definition that TypeScript uses of the AudioParamMap is lacking many methods. + return this._nativeAudioWorkletNode.parameters; + } + return this._parameters; + } + get port() { + return this._nativeAudioWorkletNode.port; + } + }; +}; + +function copyFromChannel(audioBuffer, +// @todo There is currently no way to define something like { [ key: number | string ]: Float32Array } +parent, key, channelNumber, bufferOffset) { + if (typeof audioBuffer.copyFromChannel === 'function') { + // The byteLength will be 0 when the ArrayBuffer was transferred. + if (parent[key].byteLength === 0) { + parent[key] = new Float32Array(128); + } + audioBuffer.copyFromChannel(parent[key], channelNumber, bufferOffset); + // Bug #5: Safari does not support copyFromChannel(). + } + else { + const channelData = audioBuffer.getChannelData(channelNumber); + // The byteLength will be 0 when the ArrayBuffer was transferred. + if (parent[key].byteLength === 0) { + parent[key] = channelData.slice(bufferOffset, bufferOffset + 128); + } + else { + const slicedInput = new Float32Array(channelData.buffer, bufferOffset * Float32Array.BYTES_PER_ELEMENT, 128); + parent[key].set(slicedInput); + } + } +} + +const copyToChannel = (audioBuffer, parent, key, channelNumber, bufferOffset) => { + if (typeof audioBuffer.copyToChannel === 'function') { + // The byteLength will be 0 when the ArrayBuffer was transferred. + if (parent[key].byteLength !== 0) { + audioBuffer.copyToChannel(parent[key], channelNumber, bufferOffset); + } + // Bug #5: Safari does not support copyToChannel(). + } + else { + // The byteLength will be 0 when the ArrayBuffer was transferred. + if (parent[key].byteLength !== 0) { + audioBuffer.getChannelData(channelNumber).set(parent[key], bufferOffset); + } + } +}; + +const createNestedArrays = (x, y) => { + const arrays = []; + for (let i = 0; i < x; i += 1) { + const array = []; + const length = typeof y === 'number' ? y : y[i]; + for (let j = 0; j < length; j += 1) { + array.push(new Float32Array(128)); + } + arrays.push(array); + } + return arrays; +}; + +const getAudioWorkletProcessor = (nativeOfflineAudioContext, proxy) => { + const nodeToProcessorMap = getValueForKey(NODE_TO_PROCESSOR_MAPS, nativeOfflineAudioContext); + const nativeAudioWorkletNode = getNativeAudioNode(proxy); + return getValueForKey(nodeToProcessorMap, nativeAudioWorkletNode); +}; + +const processBuffer = async (proxy, renderedBuffer, nativeOfflineAudioContext, options, outputChannelCount, processorConstructor, exposeCurrentFrameAndCurrentTime) => { + // Ceil the length to the next full render quantum. + // Bug #17: Safari does not yet expose the length. + const length = renderedBuffer === null ? Math.ceil(proxy.context.length / 128) * 128 : renderedBuffer.length; + const numberOfInputChannels = options.channelCount * options.numberOfInputs; + const numberOfOutputChannels = outputChannelCount.reduce((sum, value) => sum + value, 0); + const processedBuffer = numberOfOutputChannels === 0 + ? null + : nativeOfflineAudioContext.createBuffer(numberOfOutputChannels, length, nativeOfflineAudioContext.sampleRate); + if (processorConstructor === undefined) { + throw new Error('Missing the processor constructor.'); + } + const audioNodeConnections = getAudioNodeConnections(proxy); + const audioWorkletProcessor = await getAudioWorkletProcessor(nativeOfflineAudioContext, proxy); + const inputs = createNestedArrays(options.numberOfInputs, options.channelCount); + const outputs = createNestedArrays(options.numberOfOutputs, outputChannelCount); + const parameters = Array.from(proxy.parameters.keys()).reduce((prmtrs, name) => ({ ...prmtrs, [name]: new Float32Array(128) }), {}); + for (let i = 0; i < length; i += 128) { + if (options.numberOfInputs > 0 && renderedBuffer !== null) { + for (let j = 0; j < options.numberOfInputs; j += 1) { + for (let k = 0; k < options.channelCount; k += 1) { + copyFromChannel(renderedBuffer, inputs[j], k, k, i); + } + } + } + if (processorConstructor.parameterDescriptors !== undefined && renderedBuffer !== null) { + processorConstructor.parameterDescriptors.forEach(({ name }, index) => { + copyFromChannel(renderedBuffer, parameters, name, numberOfInputChannels + index, i); + }); + } + for (let j = 0; j < options.numberOfInputs; j += 1) { + for (let k = 0; k < outputChannelCount[j]; k += 1) { + // The byteLength will be 0 when the ArrayBuffer was transferred. + if (outputs[j][k].byteLength === 0) { + outputs[j][k] = new Float32Array(128); + } + } + } + try { + const potentiallyEmptyInputs = inputs.map((input, index) => { + if (audioNodeConnections.activeInputs[index].size === 0) { + return []; + } + return input; + }); + const activeSourceFlag = exposeCurrentFrameAndCurrentTime(i / nativeOfflineAudioContext.sampleRate, nativeOfflineAudioContext.sampleRate, () => audioWorkletProcessor.process(potentiallyEmptyInputs, outputs, parameters)); + if (processedBuffer !== null) { + for (let j = 0, outputChannelSplitterNodeOutput = 0; j < options.numberOfOutputs; j += 1) { + for (let k = 0; k < outputChannelCount[j]; k += 1) { + copyToChannel(processedBuffer, outputs[j], k, outputChannelSplitterNodeOutput + k, i); + } + outputChannelSplitterNodeOutput += outputChannelCount[j]; + } + } + if (!activeSourceFlag) { + break; + } + } + catch (error) { + proxy.dispatchEvent(new ErrorEvent('processorerror', { + colno: error.colno, + filename: error.filename, + lineno: error.lineno, + message: error.message + })); + break; + } + } + return processedBuffer; +}; +const createAudioWorkletNodeRendererFactory = (connectAudioParam, connectMultipleOutputs, createNativeAudioBufferSourceNode, createNativeChannelMergerNode, createNativeChannelSplitterNode, createNativeConstantSourceNode, createNativeGainNode, deleteUnrenderedAudioWorkletNode, disconnectMultipleOutputs, exposeCurrentFrameAndCurrentTime, getNativeAudioNode, nativeAudioWorkletNodeConstructor, nativeOfflineAudioContextConstructor, renderAutomation, renderInputsOfAudioNode, renderNativeOfflineAudioContext) => { + return (name, options, processorConstructor) => { + const renderedNativeAudioNodes = new WeakMap(); + let processedBufferPromise = null; + const createAudioNode = async (proxy, nativeOfflineAudioContext) => { + let nativeAudioWorkletNode = getNativeAudioNode(proxy); + let nativeOutputNodes = null; + const nativeAudioWorkletNodeIsOwnedByContext = isOwnedByContext(nativeAudioWorkletNode, nativeOfflineAudioContext); + const outputChannelCount = Array.isArray(options.outputChannelCount) + ? options.outputChannelCount + : Array.from(options.outputChannelCount); + // Bug #61: Only Chrome, Edge, Firefox & Opera have an implementation of the AudioWorkletNode yet. + if (nativeAudioWorkletNodeConstructor === null) { + const numberOfOutputChannels = outputChannelCount.reduce((sum, value) => sum + value, 0); + const outputChannelSplitterNode = createNativeChannelSplitterNode(nativeOfflineAudioContext, { + channelCount: Math.max(1, numberOfOutputChannels), + channelCountMode: 'explicit', + channelInterpretation: 'discrete', + numberOfOutputs: Math.max(1, numberOfOutputChannels) + }); + const outputChannelMergerNodes = []; + for (let i = 0; i < proxy.numberOfOutputs; i += 1) { + outputChannelMergerNodes.push(createNativeChannelMergerNode(nativeOfflineAudioContext, { + channelCount: 1, + channelCountMode: 'explicit', + channelInterpretation: 'speakers', + numberOfInputs: outputChannelCount[i] + })); + } + const outputGainNode = createNativeGainNode(nativeOfflineAudioContext, { + channelCount: options.channelCount, + channelCountMode: options.channelCountMode, + channelInterpretation: options.channelInterpretation, + gain: 1 + }); + outputGainNode.connect = connectMultipleOutputs.bind(null, outputChannelMergerNodes); + outputGainNode.disconnect = disconnectMultipleOutputs.bind(null, outputChannelMergerNodes); + nativeOutputNodes = [outputChannelSplitterNode, outputChannelMergerNodes, outputGainNode]; + } + else if (!nativeAudioWorkletNodeIsOwnedByContext) { + nativeAudioWorkletNode = new nativeAudioWorkletNodeConstructor(nativeOfflineAudioContext, name); + } + renderedNativeAudioNodes.set(nativeOfflineAudioContext, nativeOutputNodes === null ? nativeAudioWorkletNode : nativeOutputNodes[2]); + if (nativeOutputNodes !== null) { + if (processedBufferPromise === null) { + if (processorConstructor === undefined) { + throw new Error('Missing the processor constructor.'); + } + if (nativeOfflineAudioContextConstructor === null) { + throw new Error('Missing the native OfflineAudioContext constructor.'); + } + // Bug #47: The AudioDestinationNode in Safari gets not initialized correctly. + const numberOfInputChannels = proxy.channelCount * proxy.numberOfInputs; + const numberOfParameters = processorConstructor.parameterDescriptors === undefined ? 0 : processorConstructor.parameterDescriptors.length; + const numberOfChannels = numberOfInputChannels + numberOfParameters; + const renderBuffer = async () => { + const partialOfflineAudioContext = new nativeOfflineAudioContextConstructor(numberOfChannels, + // Ceil the length to the next full render quantum. + // Bug #17: Safari does not yet expose the length. + Math.ceil(proxy.context.length / 128) * 128, nativeOfflineAudioContext.sampleRate); + const gainNodes = []; + const inputChannelSplitterNodes = []; + for (let i = 0; i < options.numberOfInputs; i += 1) { + gainNodes.push(createNativeGainNode(partialOfflineAudioContext, { + channelCount: options.channelCount, + channelCountMode: options.channelCountMode, + channelInterpretation: options.channelInterpretation, + gain: 1 + })); + inputChannelSplitterNodes.push(createNativeChannelSplitterNode(partialOfflineAudioContext, { + channelCount: options.channelCount, + channelCountMode: 'explicit', + channelInterpretation: 'discrete', + numberOfOutputs: options.channelCount + })); + } + const constantSourceNodes = await Promise.all(Array.from(proxy.parameters.values()).map(async (audioParam) => { + const constantSourceNode = createNativeConstantSourceNode(partialOfflineAudioContext, { + channelCount: 1, + channelCountMode: 'explicit', + channelInterpretation: 'discrete', + offset: audioParam.value + }); + await renderAutomation(partialOfflineAudioContext, audioParam, constantSourceNode.offset); + return constantSourceNode; + })); + const inputChannelMergerNode = createNativeChannelMergerNode(partialOfflineAudioContext, { + channelCount: 1, + channelCountMode: 'explicit', + channelInterpretation: 'speakers', + numberOfInputs: Math.max(1, numberOfInputChannels + numberOfParameters) + }); + for (let i = 0; i < options.numberOfInputs; i += 1) { + gainNodes[i].connect(inputChannelSplitterNodes[i]); + for (let j = 0; j < options.channelCount; j += 1) { + inputChannelSplitterNodes[i].connect(inputChannelMergerNode, j, i * options.channelCount + j); + } + } + for (const [index, constantSourceNode] of constantSourceNodes.entries()) { + constantSourceNode.connect(inputChannelMergerNode, 0, numberOfInputChannels + index); + constantSourceNode.start(0); + } + inputChannelMergerNode.connect(partialOfflineAudioContext.destination); + await Promise.all(gainNodes.map((gainNode) => renderInputsOfAudioNode(proxy, partialOfflineAudioContext, gainNode))); + return renderNativeOfflineAudioContext(partialOfflineAudioContext); + }; + processedBufferPromise = processBuffer(proxy, numberOfChannels === 0 ? null : await renderBuffer(), nativeOfflineAudioContext, options, outputChannelCount, processorConstructor, exposeCurrentFrameAndCurrentTime); + } + const processedBuffer = await processedBufferPromise; + const audioBufferSourceNode = createNativeAudioBufferSourceNode(nativeOfflineAudioContext, { + buffer: null, + channelCount: 2, + channelCountMode: 'max', + channelInterpretation: 'speakers', + loop: false, + loopEnd: 0, + loopStart: 0, + playbackRate: 1 + }); + const [outputChannelSplitterNode, outputChannelMergerNodes, outputGainNode] = nativeOutputNodes; + if (processedBuffer !== null) { + audioBufferSourceNode.buffer = processedBuffer; + audioBufferSourceNode.start(0); + } + audioBufferSourceNode.connect(outputChannelSplitterNode); + for (let i = 0, outputChannelSplitterNodeOutput = 0; i < proxy.numberOfOutputs; i += 1) { + const outputChannelMergerNode = outputChannelMergerNodes[i]; + for (let j = 0; j < outputChannelCount[i]; j += 1) { + outputChannelSplitterNode.connect(outputChannelMergerNode, outputChannelSplitterNodeOutput + j, j); + } + outputChannelSplitterNodeOutput += outputChannelCount[i]; + } + return outputGainNode; + } + if (!nativeAudioWorkletNodeIsOwnedByContext) { + for (const [nm, audioParam] of proxy.parameters.entries()) { + await renderAutomation(nativeOfflineAudioContext, audioParam, + // @todo The definition that TypeScript uses of the AudioParamMap is lacking many methods. + nativeAudioWorkletNode.parameters.get(nm)); + } + } + else { + for (const [nm, audioParam] of proxy.parameters.entries()) { + await connectAudioParam(nativeOfflineAudioContext, audioParam, + // @todo The definition that TypeScript uses of the AudioParamMap is lacking many methods. + nativeAudioWorkletNode.parameters.get(nm)); + } + } + await renderInputsOfAudioNode(proxy, nativeOfflineAudioContext, nativeAudioWorkletNode); + return nativeAudioWorkletNode; + }; + return { + render(proxy, nativeOfflineAudioContext) { + deleteUnrenderedAudioWorkletNode(nativeOfflineAudioContext, proxy); + const renderedNativeAudioWorkletNodeOrGainNode = renderedNativeAudioNodes.get(nativeOfflineAudioContext); + if (renderedNativeAudioWorkletNodeOrGainNode !== undefined) { + return Promise.resolve(renderedNativeAudioWorkletNodeOrGainNode); + } + return createAudioNode(proxy, nativeOfflineAudioContext); + } + }; + }; +}; + +const createBaseAudioContextConstructor = (addAudioWorkletModule, analyserNodeConstructor, audioBufferConstructor, audioBufferSourceNodeConstructor, biquadFilterNodeConstructor, channelMergerNodeConstructor, channelSplitterNodeConstructor, constantSourceNodeConstructor, convolverNodeConstructor, decodeAudioData, delayNodeConstructor, dynamicsCompressorNodeConstructor, gainNodeConstructor, iIRFilterNodeConstructor, minimalBaseAudioContextConstructor, oscillatorNodeConstructor, pannerNodeConstructor, periodicWaveConstructor, stereoPannerNodeConstructor, waveShaperNodeConstructor) => { + return class BaseAudioContext extends minimalBaseAudioContextConstructor { + constructor(_nativeContext, numberOfChannels) { + super(_nativeContext, numberOfChannels); + this._nativeContext = _nativeContext; + this._audioWorklet = + addAudioWorkletModule === undefined + ? undefined + : { + addModule: (moduleURL, options) => { + return addAudioWorkletModule(this, moduleURL, options); + } + }; + } + get audioWorklet() { + return this._audioWorklet; + } + createAnalyser() { + return new analyserNodeConstructor(this); + } + createBiquadFilter() { + return new biquadFilterNodeConstructor(this); + } + createBuffer(numberOfChannels, length, sampleRate) { + return new audioBufferConstructor({ length, numberOfChannels, sampleRate }); + } + createBufferSource() { + return new audioBufferSourceNodeConstructor(this); + } + createChannelMerger(numberOfInputs = 6) { + return new channelMergerNodeConstructor(this, { numberOfInputs }); + } + createChannelSplitter(numberOfOutputs = 6) { + return new channelSplitterNodeConstructor(this, { numberOfOutputs }); + } + createConstantSource() { + return new constantSourceNodeConstructor(this); + } + createConvolver() { + return new convolverNodeConstructor(this); + } + createDelay(maxDelayTime = 1) { + return new delayNodeConstructor(this, { maxDelayTime }); + } + createDynamicsCompressor() { + return new dynamicsCompressorNodeConstructor(this); + } + createGain() { + return new gainNodeConstructor(this); + } + createIIRFilter(feedforward, feedback) { + return new iIRFilterNodeConstructor(this, { feedback, feedforward }); + } + createOscillator() { + return new oscillatorNodeConstructor(this); + } + createPanner() { + return new pannerNodeConstructor(this); + } + createPeriodicWave(real, imag, constraints = { disableNormalization: false }) { + return new periodicWaveConstructor(this, { ...constraints, imag, real }); + } + createStereoPanner() { + return new stereoPannerNodeConstructor(this); + } + createWaveShaper() { + return new waveShaperNodeConstructor(this); + } + decodeAudioData(audioData, successCallback, errorCallback) { + return decodeAudioData(this._nativeContext, audioData).then((audioBuffer) => { + if (typeof successCallback === 'function') { + successCallback(audioBuffer); + } + return audioBuffer; + }, (err) => { + if (typeof errorCallback === 'function') { + errorCallback(err); + } + throw err; + }); + } + }; +}; + +const DEFAULT_OPTIONS$4 = { + Q: 1, + channelCount: 2, + channelCountMode: 'max', + channelInterpretation: 'speakers', + detune: 0, + frequency: 350, + gain: 0, + type: 'lowpass' +}; +const createBiquadFilterNodeConstructor = (audioNodeConstructor, createAudioParam, createBiquadFilterNodeRenderer, createInvalidAccessError, createNativeBiquadFilterNode, getNativeContext, isNativeOfflineAudioContext, setAudioNodeTailTime) => { + return class BiquadFilterNode extends audioNodeConstructor { + constructor(context, options) { + const nativeContext = getNativeContext(context); + const mergedOptions = { ...DEFAULT_OPTIONS$4, ...options }; + const nativeBiquadFilterNode = createNativeBiquadFilterNode(nativeContext, mergedOptions); + const isOffline = isNativeOfflineAudioContext(nativeContext); + const biquadFilterNodeRenderer = (isOffline ? createBiquadFilterNodeRenderer() : null); + super(context, false, nativeBiquadFilterNode, biquadFilterNodeRenderer); + // Bug #80: Safari does not export the correct values for maxValue and minValue. + this._Q = createAudioParam(this, isOffline, nativeBiquadFilterNode.Q, MOST_POSITIVE_SINGLE_FLOAT, MOST_NEGATIVE_SINGLE_FLOAT); + // Bug #78: Firefox & Safari do not export the correct values for maxValue and minValue. + this._detune = createAudioParam(this, isOffline, nativeBiquadFilterNode.detune, 1200 * Math.log2(MOST_POSITIVE_SINGLE_FLOAT), -1200 * Math.log2(MOST_POSITIVE_SINGLE_FLOAT)); + // Bug #77: Firefox & Safari do not export the correct value for minValue. + this._frequency = createAudioParam(this, isOffline, nativeBiquadFilterNode.frequency, context.sampleRate / 2, 0); + // Bug #79: Firefox & Safari do not export the correct values for maxValue and minValue. + this._gain = createAudioParam(this, isOffline, nativeBiquadFilterNode.gain, 40 * Math.log10(MOST_POSITIVE_SINGLE_FLOAT), MOST_NEGATIVE_SINGLE_FLOAT); + this._nativeBiquadFilterNode = nativeBiquadFilterNode; + // @todo Determine a meaningful tail-time instead of just using one second. + setAudioNodeTailTime(this, 1); + } + get detune() { + return this._detune; + } + get frequency() { + return this._frequency; + } + get gain() { + return this._gain; + } + get Q() { + return this._Q; + } + get type() { + return this._nativeBiquadFilterNode.type; + } + set type(value) { + this._nativeBiquadFilterNode.type = value; + } + getFrequencyResponse(frequencyHz, magResponse, phaseResponse) { + // Bug #189: Safari does throw an InvalidStateError. + try { + this._nativeBiquadFilterNode.getFrequencyResponse(frequencyHz, magResponse, phaseResponse); + } + catch (err) { + if (err.code === 11) { + throw createInvalidAccessError(); + } + throw err; + } + // Bug #68: Safari does not throw an error if the parameters differ in their length. + if (frequencyHz.length !== magResponse.length || magResponse.length !== phaseResponse.length) { + throw createInvalidAccessError(); + } + } + }; +}; + +const createBiquadFilterNodeRendererFactory = (connectAudioParam, createNativeBiquadFilterNode, getNativeAudioNode, renderAutomation, renderInputsOfAudioNode) => { + return () => { + const renderedNativeBiquadFilterNodes = new WeakMap(); + const createBiquadFilterNode = async (proxy, nativeOfflineAudioContext) => { + let nativeBiquadFilterNode = getNativeAudioNode(proxy); + /* + * If the initially used nativeBiquadFilterNode was not constructed on the same OfflineAudioContext it needs to be created + * again. + */ + const nativeBiquadFilterNodeIsOwnedByContext = isOwnedByContext(nativeBiquadFilterNode, nativeOfflineAudioContext); + if (!nativeBiquadFilterNodeIsOwnedByContext) { + const options = { + Q: nativeBiquadFilterNode.Q.value, + channelCount: nativeBiquadFilterNode.channelCount, + channelCountMode: nativeBiquadFilterNode.channelCountMode, + channelInterpretation: nativeBiquadFilterNode.channelInterpretation, + detune: nativeBiquadFilterNode.detune.value, + frequency: nativeBiquadFilterNode.frequency.value, + gain: nativeBiquadFilterNode.gain.value, + type: nativeBiquadFilterNode.type + }; + nativeBiquadFilterNode = createNativeBiquadFilterNode(nativeOfflineAudioContext, options); + } + renderedNativeBiquadFilterNodes.set(nativeOfflineAudioContext, nativeBiquadFilterNode); + if (!nativeBiquadFilterNodeIsOwnedByContext) { + await renderAutomation(nativeOfflineAudioContext, proxy.Q, nativeBiquadFilterNode.Q); + await renderAutomation(nativeOfflineAudioContext, proxy.detune, nativeBiquadFilterNode.detune); + await renderAutomation(nativeOfflineAudioContext, proxy.frequency, nativeBiquadFilterNode.frequency); + await renderAutomation(nativeOfflineAudioContext, proxy.gain, nativeBiquadFilterNode.gain); + } + else { + await connectAudioParam(nativeOfflineAudioContext, proxy.Q, nativeBiquadFilterNode.Q); + await connectAudioParam(nativeOfflineAudioContext, proxy.detune, nativeBiquadFilterNode.detune); + await connectAudioParam(nativeOfflineAudioContext, proxy.frequency, nativeBiquadFilterNode.frequency); + await connectAudioParam(nativeOfflineAudioContext, proxy.gain, nativeBiquadFilterNode.gain); + } + await renderInputsOfAudioNode(proxy, nativeOfflineAudioContext, nativeBiquadFilterNode); + return nativeBiquadFilterNode; + }; + return { + render(proxy, nativeOfflineAudioContext) { + const renderedNativeBiquadFilterNode = renderedNativeBiquadFilterNodes.get(nativeOfflineAudioContext); + if (renderedNativeBiquadFilterNode !== undefined) { + return Promise.resolve(renderedNativeBiquadFilterNode); + } + return createBiquadFilterNode(proxy, nativeOfflineAudioContext); + } + }; + }; +}; + +const createCacheTestResult = (ongoingTests, testResults) => { + return (tester, test) => { + const cachedTestResult = testResults.get(tester); + if (cachedTestResult !== undefined) { + return cachedTestResult; + } + const ongoingTest = ongoingTests.get(tester); + if (ongoingTest !== undefined) { + return ongoingTest; + } + try { + const synchronousTestResult = test(); + if (synchronousTestResult instanceof Promise) { + ongoingTests.set(tester, synchronousTestResult); + return synchronousTestResult + .catch(() => false) + .then((finalTestResult) => { + ongoingTests.delete(tester); + testResults.set(tester, finalTestResult); + return finalTestResult; + }); + } + testResults.set(tester, synchronousTestResult); + return synchronousTestResult; + } + catch { + testResults.set(tester, false); + return false; + } + }; +}; + +const DEFAULT_OPTIONS$5 = { + channelCount: 1, + channelCountMode: 'explicit', + channelInterpretation: 'speakers', + numberOfInputs: 6 +}; +const createChannelMergerNodeConstructor = (audioNodeConstructor, createChannelMergerNodeRenderer, createNativeChannelMergerNode, getNativeContext, isNativeOfflineAudioContext) => { + return class ChannelMergerNode extends audioNodeConstructor { + constructor(context, options) { + const nativeContext = getNativeContext(context); + const mergedOptions = { ...DEFAULT_OPTIONS$5, ...options }; + const nativeChannelMergerNode = createNativeChannelMergerNode(nativeContext, mergedOptions); + const channelMergerNodeRenderer = ((isNativeOfflineAudioContext(nativeContext) ? createChannelMergerNodeRenderer() : null)); + super(context, false, nativeChannelMergerNode, channelMergerNodeRenderer); + } + }; +}; + +const createChannelMergerNodeRendererFactory = (createNativeChannelMergerNode, getNativeAudioNode, renderInputsOfAudioNode) => { + return () => { + const renderedNativeAudioNodes = new WeakMap(); + const createAudioNode = async (proxy, nativeOfflineAudioContext) => { + let nativeAudioNode = getNativeAudioNode(proxy); + // If the initially used nativeAudioNode was not constructed on the same OfflineAudioContext it needs to be created again. + const nativeAudioNodeIsOwnedByContext = isOwnedByContext(nativeAudioNode, nativeOfflineAudioContext); + if (!nativeAudioNodeIsOwnedByContext) { + const options = { + channelCount: nativeAudioNode.channelCount, + channelCountMode: nativeAudioNode.channelCountMode, + channelInterpretation: nativeAudioNode.channelInterpretation, + numberOfInputs: nativeAudioNode.numberOfInputs + }; + nativeAudioNode = createNativeChannelMergerNode(nativeOfflineAudioContext, options); + } + renderedNativeAudioNodes.set(nativeOfflineAudioContext, nativeAudioNode); + await renderInputsOfAudioNode(proxy, nativeOfflineAudioContext, nativeAudioNode); + return nativeAudioNode; + }; + return { + render(proxy, nativeOfflineAudioContext) { + const renderedNativeAudioNode = renderedNativeAudioNodes.get(nativeOfflineAudioContext); + if (renderedNativeAudioNode !== undefined) { + return Promise.resolve(renderedNativeAudioNode); + } + return createAudioNode(proxy, nativeOfflineAudioContext); + } + }; + }; +}; + +const DEFAULT_OPTIONS$6 = { + channelCount: 6, + channelCountMode: 'explicit', + channelInterpretation: 'discrete', + numberOfOutputs: 6 +}; +const createChannelSplitterNodeConstructor = (audioNodeConstructor, createChannelSplitterNodeRenderer, createNativeChannelSplitterNode, getNativeContext, isNativeOfflineAudioContext, sanitizeChannelSplitterOptions) => { + return class ChannelSplitterNode extends audioNodeConstructor { + constructor(context, options) { + const nativeContext = getNativeContext(context); + const mergedOptions = sanitizeChannelSplitterOptions({ ...DEFAULT_OPTIONS$6, ...options }); + const nativeChannelSplitterNode = createNativeChannelSplitterNode(nativeContext, mergedOptions); + const channelSplitterNodeRenderer = ((isNativeOfflineAudioContext(nativeContext) ? createChannelSplitterNodeRenderer() : null)); + super(context, false, nativeChannelSplitterNode, channelSplitterNodeRenderer); + } + }; +}; + +const createChannelSplitterNodeRendererFactory = (createNativeChannelSplitterNode, getNativeAudioNode, renderInputsOfAudioNode) => { + return () => { + const renderedNativeAudioNodes = new WeakMap(); + const createAudioNode = async (proxy, nativeOfflineAudioContext) => { + let nativeAudioNode = getNativeAudioNode(proxy); + // If the initially used nativeAudioNode was not constructed on the same OfflineAudioContext it needs to be created again. + const nativeAudioNodeIsOwnedByContext = isOwnedByContext(nativeAudioNode, nativeOfflineAudioContext); + if (!nativeAudioNodeIsOwnedByContext) { + const options = { + channelCount: nativeAudioNode.channelCount, + channelCountMode: nativeAudioNode.channelCountMode, + channelInterpretation: nativeAudioNode.channelInterpretation, + numberOfOutputs: nativeAudioNode.numberOfOutputs + }; + nativeAudioNode = createNativeChannelSplitterNode(nativeOfflineAudioContext, options); + } + renderedNativeAudioNodes.set(nativeOfflineAudioContext, nativeAudioNode); + await renderInputsOfAudioNode(proxy, nativeOfflineAudioContext, nativeAudioNode); + return nativeAudioNode; + }; + return { + render(proxy, nativeOfflineAudioContext) { + const renderedNativeAudioNode = renderedNativeAudioNodes.get(nativeOfflineAudioContext); + if (renderedNativeAudioNode !== undefined) { + return Promise.resolve(renderedNativeAudioNode); + } + return createAudioNode(proxy, nativeOfflineAudioContext); + } + }; + }; +}; + +const createConnectAudioParam = (renderInputsOfAudioParam) => { + return (nativeOfflineAudioContext, audioParam, nativeAudioParam) => { + return renderInputsOfAudioParam(audioParam, nativeOfflineAudioContext, nativeAudioParam); + }; +}; + +const createConnectMultipleOutputs = (createIndexSizeError) => { + return (outputAudioNodes, destination, output = 0, input = 0) => { + const outputAudioNode = outputAudioNodes[output]; + if (outputAudioNode === undefined) { + throw createIndexSizeError(); + } + if (isNativeAudioNode(destination)) { + return outputAudioNode.connect(destination, 0, input); + } + return outputAudioNode.connect(destination, 0); + }; +}; + +const createConnectedNativeAudioBufferSourceNodeFactory = (createNativeAudioBufferSourceNode) => { + return (nativeContext, nativeAudioNode) => { + const nativeAudioBufferSourceNode = createNativeAudioBufferSourceNode(nativeContext, { + buffer: null, + channelCount: 2, + channelCountMode: 'max', + channelInterpretation: 'speakers', + loop: false, + loopEnd: 0, + loopStart: 0, + playbackRate: 1 + }); + const nativeAudioBuffer = nativeContext.createBuffer(1, 2, 44100); + nativeAudioBufferSourceNode.buffer = nativeAudioBuffer; + nativeAudioBufferSourceNode.loop = true; + nativeAudioBufferSourceNode.connect(nativeAudioNode); + nativeAudioBufferSourceNode.start(); + return () => { + nativeAudioBufferSourceNode.stop(); + nativeAudioBufferSourceNode.disconnect(nativeAudioNode); + }; + }; +}; + +const DEFAULT_OPTIONS$7 = { + channelCount: 2, + channelCountMode: 'max', + channelInterpretation: 'speakers', + offset: 1 +}; +const createConstantSourceNodeConstructor = (audioNodeConstructor, createAudioParam, createConstantSourceNodeRendererFactory, createNativeConstantSourceNode, getNativeContext, isNativeOfflineAudioContext, wrapEventListener) => { + return class ConstantSourceNode extends audioNodeConstructor { + constructor(context, options) { + const nativeContext = getNativeContext(context); + const mergedOptions = { ...DEFAULT_OPTIONS$7, ...options }; + const nativeConstantSourceNode = createNativeConstantSourceNode(nativeContext, mergedOptions); + const isOffline = isNativeOfflineAudioContext(nativeContext); + const constantSourceNodeRenderer = ((isOffline ? createConstantSourceNodeRendererFactory() : null)); + super(context, false, nativeConstantSourceNode, constantSourceNodeRenderer); + this._constantSourceNodeRenderer = constantSourceNodeRenderer; + this._nativeConstantSourceNode = nativeConstantSourceNode; + /* + * Bug #62 & #74: Safari does not support ConstantSourceNodes and does not export the correct values for maxValue and minValue + * for GainNodes. + */ + this._offset = createAudioParam(this, isOffline, nativeConstantSourceNode.offset, MOST_POSITIVE_SINGLE_FLOAT, MOST_NEGATIVE_SINGLE_FLOAT); + this._onended = null; + } + get offset() { + return this._offset; + } + get onended() { + return this._onended; + } + set onended(value) { + const wrappedListener = typeof value === 'function' ? wrapEventListener(this, value) : null; + this._nativeConstantSourceNode.onended = wrappedListener; + const nativeOnEnded = this._nativeConstantSourceNode.onended; + this._onended = nativeOnEnded !== null && nativeOnEnded === wrappedListener ? value : nativeOnEnded; + } + start(when = 0) { + this._nativeConstantSourceNode.start(when); + if (this._constantSourceNodeRenderer !== null) { + this._constantSourceNodeRenderer.start = when; + } + if (this.context.state !== 'closed') { + setInternalStateToActive(this); + const resetInternalStateToPassive = () => { + this._nativeConstantSourceNode.removeEventListener('ended', resetInternalStateToPassive); + if (isActiveAudioNode(this)) { + setInternalStateToPassive(this); + } + }; + this._nativeConstantSourceNode.addEventListener('ended', resetInternalStateToPassive); + } + } + stop(when = 0) { + this._nativeConstantSourceNode.stop(when); + if (this._constantSourceNodeRenderer !== null) { + this._constantSourceNodeRenderer.stop = when; + } + } + }; +}; + +const createConstantSourceNodeRendererFactory = (connectAudioParam, createNativeConstantSourceNode, getNativeAudioNode, renderAutomation, renderInputsOfAudioNode) => { + return () => { + const renderedNativeConstantSourceNodes = new WeakMap(); + let start = null; + let stop = null; + const createConstantSourceNode = async (proxy, nativeOfflineAudioContext) => { + let nativeConstantSourceNode = getNativeAudioNode(proxy); + /* + * If the initially used nativeConstantSourceNode was not constructed on the same OfflineAudioContext it needs to be created + * again. + */ + const nativeConstantSourceNodeIsOwnedByContext = isOwnedByContext(nativeConstantSourceNode, nativeOfflineAudioContext); + if (!nativeConstantSourceNodeIsOwnedByContext) { + const options = { + channelCount: nativeConstantSourceNode.channelCount, + channelCountMode: nativeConstantSourceNode.channelCountMode, + channelInterpretation: nativeConstantSourceNode.channelInterpretation, + offset: nativeConstantSourceNode.offset.value + }; + nativeConstantSourceNode = createNativeConstantSourceNode(nativeOfflineAudioContext, options); + if (start !== null) { + nativeConstantSourceNode.start(start); + } + if (stop !== null) { + nativeConstantSourceNode.stop(stop); + } + } + renderedNativeConstantSourceNodes.set(nativeOfflineAudioContext, nativeConstantSourceNode); + if (!nativeConstantSourceNodeIsOwnedByContext) { + await renderAutomation(nativeOfflineAudioContext, proxy.offset, nativeConstantSourceNode.offset); + } + else { + await connectAudioParam(nativeOfflineAudioContext, proxy.offset, nativeConstantSourceNode.offset); + } + await renderInputsOfAudioNode(proxy, nativeOfflineAudioContext, nativeConstantSourceNode); + return nativeConstantSourceNode; + }; + return { + set start(value) { + start = value; + }, + set stop(value) { + stop = value; + }, + render(proxy, nativeOfflineAudioContext) { + const renderedNativeConstantSourceNode = renderedNativeConstantSourceNodes.get(nativeOfflineAudioContext); + if (renderedNativeConstantSourceNode !== undefined) { + return Promise.resolve(renderedNativeConstantSourceNode); + } + return createConstantSourceNode(proxy, nativeOfflineAudioContext); + } + }; + }; +}; + +const createConvertNumberToUnsignedLong = (unit32Array) => { + return (value) => { + unit32Array[0] = value; + return unit32Array[0]; + }; +}; + +const DEFAULT_OPTIONS$8 = { + buffer: null, + channelCount: 2, + channelCountMode: 'clamped-max', + channelInterpretation: 'speakers', + disableNormalization: false +}; +const createConvolverNodeConstructor = (audioNodeConstructor, createConvolverNodeRenderer, createNativeConvolverNode, getNativeContext, isNativeOfflineAudioContext, setAudioNodeTailTime) => { + return class ConvolverNode extends audioNodeConstructor { + constructor(context, options) { + const nativeContext = getNativeContext(context); + const mergedOptions = { ...DEFAULT_OPTIONS$8, ...options }; + const nativeConvolverNode = createNativeConvolverNode(nativeContext, mergedOptions); + const isOffline = isNativeOfflineAudioContext(nativeContext); + const convolverNodeRenderer = (isOffline ? createConvolverNodeRenderer() : null); + super(context, false, nativeConvolverNode, convolverNodeRenderer); + this._isBufferNullified = false; + this._nativeConvolverNode = nativeConvolverNode; + if (mergedOptions.buffer !== null) { + setAudioNodeTailTime(this, mergedOptions.buffer.duration); + } + } + get buffer() { + if (this._isBufferNullified) { + return null; + } + return this._nativeConvolverNode.buffer; + } + set buffer(value) { + this._nativeConvolverNode.buffer = value; + // Bug #115: Safari does not allow to set the buffer to null. + if (value === null && this._nativeConvolverNode.buffer !== null) { + const nativeContext = this._nativeConvolverNode.context; + this._nativeConvolverNode.buffer = nativeContext.createBuffer(1, 1, 44100); + this._isBufferNullified = true; + setAudioNodeTailTime(this, 0); + } + else { + this._isBufferNullified = false; + setAudioNodeTailTime(this, this._nativeConvolverNode.buffer === null ? 0 : this._nativeConvolverNode.buffer.duration); + } + } + get normalize() { + return this._nativeConvolverNode.normalize; + } + set normalize(value) { + this._nativeConvolverNode.normalize = value; + } + }; +}; + +const createConvolverNodeRendererFactory = (createNativeConvolverNode, getNativeAudioNode, renderInputsOfAudioNode) => { + return () => { + const renderedNativeConvolverNodes = new WeakMap(); + const createConvolverNode = async (proxy, nativeOfflineAudioContext) => { + let nativeConvolverNode = getNativeAudioNode(proxy); + // If the initially used nativeConvolverNode was not constructed on the same OfflineAudioContext it needs to be created again. + const nativeConvolverNodeIsOwnedByContext = isOwnedByContext(nativeConvolverNode, nativeOfflineAudioContext); + if (!nativeConvolverNodeIsOwnedByContext) { + const options = { + buffer: nativeConvolverNode.buffer, + channelCount: nativeConvolverNode.channelCount, + channelCountMode: nativeConvolverNode.channelCountMode, + channelInterpretation: nativeConvolverNode.channelInterpretation, + disableNormalization: !nativeConvolverNode.normalize + }; + nativeConvolverNode = createNativeConvolverNode(nativeOfflineAudioContext, options); + } + renderedNativeConvolverNodes.set(nativeOfflineAudioContext, nativeConvolverNode); + if (isNativeAudioNodeFaker(nativeConvolverNode)) { + await renderInputsOfAudioNode(proxy, nativeOfflineAudioContext, nativeConvolverNode.inputs[0]); + } + else { + await renderInputsOfAudioNode(proxy, nativeOfflineAudioContext, nativeConvolverNode); + } + return nativeConvolverNode; + }; + return { + render(proxy, nativeOfflineAudioContext) { + const renderedNativeConvolverNode = renderedNativeConvolverNodes.get(nativeOfflineAudioContext); + if (renderedNativeConvolverNode !== undefined) { + return Promise.resolve(renderedNativeConvolverNode); + } + return createConvolverNode(proxy, nativeOfflineAudioContext); + } + }; + }; +}; + +const createCreateNativeOfflineAudioContext = (createNotSupportedError, nativeOfflineAudioContextConstructor) => { + return (numberOfChannels, length, sampleRate) => { + if (nativeOfflineAudioContextConstructor === null) { + throw new Error('Missing the native OfflineAudioContext constructor.'); + } + try { + return new nativeOfflineAudioContextConstructor(numberOfChannels, length, sampleRate); + } + catch (err) { + // Bug #143, #144 & #146: Safari throws a SyntaxError when numberOfChannels, length or sampleRate are invalid. + if (err.name === 'SyntaxError') { + throw createNotSupportedError(); + } + throw err; + } + }; +}; + +const createDataCloneError = () => new DOMException('', 'DataCloneError'); + +const detachArrayBuffer = (arrayBuffer) => { + const { port1, port2 } = new MessageChannel(); + return new Promise((resolve) => { + const closeAndResolve = () => { + port2.onmessage = null; + port1.close(); + port2.close(); + resolve(); + }; + port2.onmessage = () => closeAndResolve(); + try { + port1.postMessage(arrayBuffer, [arrayBuffer]); + } + finally { + closeAndResolve(); + } + }); +}; + +const createDecodeAudioData = (audioBufferStore, cacheTestResult, createDataCloneError, createEncodingError, detachedArrayBuffers, getNativeContext, isNativeContext, testAudioBufferCopyChannelMethodsOutOfBoundsSupport, testPromiseSupport, wrapAudioBufferCopyChannelMethods, wrapAudioBufferCopyChannelMethodsOutOfBounds) => { + return (anyContext, audioData) => { + const nativeContext = isNativeContext(anyContext) ? anyContext : getNativeContext(anyContext); + // Bug #43: Only Chrome, Edge and Opera do throw a DataCloneError. + if (detachedArrayBuffers.has(audioData)) { + const err = createDataCloneError(); + return Promise.reject(err); + } + // The audioData parameter maybe of a type which can't be added to a WeakSet. + try { + detachedArrayBuffers.add(audioData); + } + catch { + // Ignore errors. + } + // Bug #21: Safari does not support promises yet. + if (cacheTestResult(testPromiseSupport, () => testPromiseSupport(nativeContext))) { + return nativeContext.decodeAudioData(audioData).then((audioBuffer) => { + // Bug #133: Safari does neuter the ArrayBuffer. + detachArrayBuffer(audioData).catch(() => { + // Ignore errors. + }); + // Bug #157: Firefox does not allow the bufferOffset to be out-of-bounds. + if (!cacheTestResult(testAudioBufferCopyChannelMethodsOutOfBoundsSupport, () => testAudioBufferCopyChannelMethodsOutOfBoundsSupport(audioBuffer))) { + wrapAudioBufferCopyChannelMethodsOutOfBounds(audioBuffer); + } + audioBufferStore.add(audioBuffer); + return audioBuffer; + }); + } + // Bug #21: Safari does not return a Promise yet. + return new Promise((resolve, reject) => { + const complete = async () => { + // Bug #133: Safari does neuter the ArrayBuffer. + try { + await detachArrayBuffer(audioData); + } + catch { + // Ignore errors. + } + }; + const fail = (err) => { + reject(err); + complete(); + }; + // Bug #26: Safari throws a synchronous error. + try { + // Bug #1: Safari requires a successCallback. + nativeContext.decodeAudioData(audioData, (audioBuffer) => { + // Bug #5: Safari does not support copyFromChannel() and copyToChannel(). + // Bug #100: Safari does throw a wrong error when calling getChannelData() with an out-of-bounds value. + if (typeof audioBuffer.copyFromChannel !== 'function') { + wrapAudioBufferCopyChannelMethods(audioBuffer); + wrapAudioBufferGetChannelDataMethod(audioBuffer); + } + audioBufferStore.add(audioBuffer); + complete().then(() => resolve(audioBuffer)); + }, (err) => { + // Bug #4: Safari returns null instead of an error. + if (err === null) { + fail(createEncodingError()); + } + else { + fail(err); + } + }); + } + catch (err) { + fail(err); + } + }); + }; +}; + +const createDecrementCycleCounter = (connectNativeAudioNodeToNativeAudioNode, cycleCounters, getAudioNodeConnections, getNativeAudioNode, getNativeAudioParam, getNativeContext, isActiveAudioNode, isNativeOfflineAudioContext) => { + return (audioNode, count) => { + const cycleCounter = cycleCounters.get(audioNode); + if (cycleCounter === undefined) { + throw new Error('Missing the expected cycle count.'); + } + const nativeContext = getNativeContext(audioNode.context); + const isOffline = isNativeOfflineAudioContext(nativeContext); + if (cycleCounter === count) { + cycleCounters.delete(audioNode); + if (!isOffline && isActiveAudioNode(audioNode)) { + const nativeSourceAudioNode = getNativeAudioNode(audioNode); + const { outputs } = getAudioNodeConnections(audioNode); + for (const output of outputs) { + if (isAudioNodeOutputConnection(output)) { + const nativeDestinationAudioNode = getNativeAudioNode(output[0]); + connectNativeAudioNodeToNativeAudioNode(nativeSourceAudioNode, nativeDestinationAudioNode, output[1], output[2]); + } + else { + const nativeDestinationAudioParam = getNativeAudioParam(output[0]); + nativeSourceAudioNode.connect(nativeDestinationAudioParam, output[1]); + } + } + } + } + else { + cycleCounters.set(audioNode, cycleCounter - count); + } + }; +}; + +const DEFAULT_OPTIONS$9 = { + channelCount: 2, + channelCountMode: 'max', + channelInterpretation: 'speakers', + delayTime: 0, + maxDelayTime: 1 +}; +const createDelayNodeConstructor = (audioNodeConstructor, createAudioParam, createDelayNodeRenderer, createNativeDelayNode, getNativeContext, isNativeOfflineAudioContext, setAudioNodeTailTime) => { + return class DelayNode extends audioNodeConstructor { + constructor(context, options) { + const nativeContext = getNativeContext(context); + const mergedOptions = { ...DEFAULT_OPTIONS$9, ...options }; + const nativeDelayNode = createNativeDelayNode(nativeContext, mergedOptions); + const isOffline = isNativeOfflineAudioContext(nativeContext); + const delayNodeRenderer = (isOffline ? createDelayNodeRenderer(mergedOptions.maxDelayTime) : null); + super(context, false, nativeDelayNode, delayNodeRenderer); + this._delayTime = createAudioParam(this, isOffline, nativeDelayNode.delayTime); + setAudioNodeTailTime(this, mergedOptions.maxDelayTime); + } + get delayTime() { + return this._delayTime; + } + }; +}; + +const createDelayNodeRendererFactory = (connectAudioParam, createNativeDelayNode, getNativeAudioNode, renderAutomation, renderInputsOfAudioNode) => { + return (maxDelayTime) => { + const renderedNativeDelayNodes = new WeakMap(); + const createDelayNode = async (proxy, nativeOfflineAudioContext) => { + let nativeDelayNode = getNativeAudioNode(proxy); + // If the initially used nativeDelayNode was not constructed on the same OfflineAudioContext it needs to be created again. + const nativeDelayNodeIsOwnedByContext = isOwnedByContext(nativeDelayNode, nativeOfflineAudioContext); + if (!nativeDelayNodeIsOwnedByContext) { + const options = { + channelCount: nativeDelayNode.channelCount, + channelCountMode: nativeDelayNode.channelCountMode, + channelInterpretation: nativeDelayNode.channelInterpretation, + delayTime: nativeDelayNode.delayTime.value, + maxDelayTime + }; + nativeDelayNode = createNativeDelayNode(nativeOfflineAudioContext, options); + } + renderedNativeDelayNodes.set(nativeOfflineAudioContext, nativeDelayNode); + if (!nativeDelayNodeIsOwnedByContext) { + await renderAutomation(nativeOfflineAudioContext, proxy.delayTime, nativeDelayNode.delayTime); + } + else { + await connectAudioParam(nativeOfflineAudioContext, proxy.delayTime, nativeDelayNode.delayTime); + } + await renderInputsOfAudioNode(proxy, nativeOfflineAudioContext, nativeDelayNode); + return nativeDelayNode; + }; + return { + render(proxy, nativeOfflineAudioContext) { + const renderedNativeDelayNode = renderedNativeDelayNodes.get(nativeOfflineAudioContext); + if (renderedNativeDelayNode !== undefined) { + return Promise.resolve(renderedNativeDelayNode); + } + return createDelayNode(proxy, nativeOfflineAudioContext); + } + }; + }; +}; + +const createDeleteActiveInputConnectionToAudioNode = (pickElementFromSet) => { + return (activeInputs, source, output, input) => { + return pickElementFromSet(activeInputs[input], (activeInputConnection) => activeInputConnection[0] === source && activeInputConnection[1] === output); + }; +}; + +const createDeleteUnrenderedAudioWorkletNode = (getUnrenderedAudioWorkletNodes) => { + return (nativeContext, audioWorkletNode) => { + getUnrenderedAudioWorkletNodes(nativeContext).delete(audioWorkletNode); + }; +}; + +const isDelayNode = (audioNode) => { + return 'delayTime' in audioNode; +}; + +const createDetectCycles = (audioParamAudioNodeStore, getAudioNodeConnections, getValueForKey) => { + return function detectCycles(chain, nextLink) { + const audioNode = isAudioNode(nextLink) ? nextLink : getValueForKey(audioParamAudioNodeStore, nextLink); + if (isDelayNode(audioNode)) { + return []; + } + if (chain[0] === audioNode) { + return [chain]; + } + if (chain.includes(audioNode)) { + return []; + } + const { outputs } = getAudioNodeConnections(audioNode); + return Array.from(outputs) + .map((outputConnection) => detectCycles([...chain, audioNode], outputConnection[0])) + .reduce((mergedCycles, nestedCycles) => mergedCycles.concat(nestedCycles), []); + }; +}; + +const getOutputAudioNodeAtIndex = (createIndexSizeError, outputAudioNodes, output) => { + const outputAudioNode = outputAudioNodes[output]; + if (outputAudioNode === undefined) { + throw createIndexSizeError(); + } + return outputAudioNode; +}; +const createDisconnectMultipleOutputs = (createIndexSizeError) => { + return (outputAudioNodes, destinationOrOutput = undefined, output = undefined, input = 0) => { + if (destinationOrOutput === undefined) { + return outputAudioNodes.forEach((outputAudioNode) => outputAudioNode.disconnect()); + } + if (typeof destinationOrOutput === 'number') { + return getOutputAudioNodeAtIndex(createIndexSizeError, outputAudioNodes, destinationOrOutput).disconnect(); + } + if (isNativeAudioNode(destinationOrOutput)) { + if (output === undefined) { + return outputAudioNodes.forEach((outputAudioNode) => outputAudioNode.disconnect(destinationOrOutput)); + } + if (input === undefined) { + return getOutputAudioNodeAtIndex(createIndexSizeError, outputAudioNodes, output).disconnect(destinationOrOutput, 0); + } + return getOutputAudioNodeAtIndex(createIndexSizeError, outputAudioNodes, output).disconnect(destinationOrOutput, 0, input); + } + if (output === undefined) { + return outputAudioNodes.forEach((outputAudioNode) => outputAudioNode.disconnect(destinationOrOutput)); + } + return getOutputAudioNodeAtIndex(createIndexSizeError, outputAudioNodes, output).disconnect(destinationOrOutput, 0); + }; +}; + +const DEFAULT_OPTIONS$a = { + attack: 0.003, + channelCount: 2, + channelCountMode: 'clamped-max', + channelInterpretation: 'speakers', + knee: 30, + ratio: 12, + release: 0.25, + threshold: -24 +}; +const createDynamicsCompressorNodeConstructor = (audioNodeConstructor, createAudioParam, createDynamicsCompressorNodeRenderer, createNativeDynamicsCompressorNode, createNotSupportedError, getNativeContext, isNativeOfflineAudioContext, setAudioNodeTailTime) => { + return class DynamicsCompressorNode extends audioNodeConstructor { + constructor(context, options) { + const nativeContext = getNativeContext(context); + const mergedOptions = { ...DEFAULT_OPTIONS$a, ...options }; + const nativeDynamicsCompressorNode = createNativeDynamicsCompressorNode(nativeContext, mergedOptions); + const isOffline = isNativeOfflineAudioContext(nativeContext); + const dynamicsCompressorNodeRenderer = (isOffline ? createDynamicsCompressorNodeRenderer() : null); + super(context, false, nativeDynamicsCompressorNode, dynamicsCompressorNodeRenderer); + this._attack = createAudioParam(this, isOffline, nativeDynamicsCompressorNode.attack); + this._knee = createAudioParam(this, isOffline, nativeDynamicsCompressorNode.knee); + this._nativeDynamicsCompressorNode = nativeDynamicsCompressorNode; + this._ratio = createAudioParam(this, isOffline, nativeDynamicsCompressorNode.ratio); + this._release = createAudioParam(this, isOffline, nativeDynamicsCompressorNode.release); + this._threshold = createAudioParam(this, isOffline, nativeDynamicsCompressorNode.threshold); + setAudioNodeTailTime(this, 0.006); + } + get attack() { + return this._attack; + } + // Bug #108: Safari allows a channelCount of three and above which is why the getter and setter needs to be overwritten here. + get channelCount() { + return this._nativeDynamicsCompressorNode.channelCount; + } + set channelCount(value) { + const previousChannelCount = this._nativeDynamicsCompressorNode.channelCount; + this._nativeDynamicsCompressorNode.channelCount = value; + if (value > 2) { + this._nativeDynamicsCompressorNode.channelCount = previousChannelCount; + throw createNotSupportedError(); + } + } + /* + * Bug #109: Only Chrome, Firefox and Opera disallow a channelCountMode of 'max' yet which is why the getter and setter needs to be + * overwritten here. + */ + get channelCountMode() { + return this._nativeDynamicsCompressorNode.channelCountMode; + } + set channelCountMode(value) { + const previousChannelCount = this._nativeDynamicsCompressorNode.channelCountMode; + this._nativeDynamicsCompressorNode.channelCountMode = value; + if (value === 'max') { + this._nativeDynamicsCompressorNode.channelCountMode = previousChannelCount; + throw createNotSupportedError(); + } + } + get knee() { + return this._knee; + } + get ratio() { + return this._ratio; + } + get reduction() { + // Bug #111: Safari returns an AudioParam instead of a number. + if (typeof this._nativeDynamicsCompressorNode.reduction.value === 'number') { + return this._nativeDynamicsCompressorNode.reduction.value; + } + return this._nativeDynamicsCompressorNode.reduction; + } + get release() { + return this._release; + } + get threshold() { + return this._threshold; + } + }; +}; + +const createDynamicsCompressorNodeRendererFactory = (connectAudioParam, createNativeDynamicsCompressorNode, getNativeAudioNode, renderAutomation, renderInputsOfAudioNode) => { + return () => { + const renderedNativeDynamicsCompressorNodes = new WeakMap(); + const createDynamicsCompressorNode = async (proxy, nativeOfflineAudioContext) => { + let nativeDynamicsCompressorNode = getNativeAudioNode(proxy); + /* + * If the initially used nativeDynamicsCompressorNode was not constructed on the same OfflineAudioContext it needs to be + * created again. + */ + const nativeDynamicsCompressorNodeIsOwnedByContext = isOwnedByContext(nativeDynamicsCompressorNode, nativeOfflineAudioContext); + if (!nativeDynamicsCompressorNodeIsOwnedByContext) { + const options = { + attack: nativeDynamicsCompressorNode.attack.value, + channelCount: nativeDynamicsCompressorNode.channelCount, + channelCountMode: nativeDynamicsCompressorNode.channelCountMode, + channelInterpretation: nativeDynamicsCompressorNode.channelInterpretation, + knee: nativeDynamicsCompressorNode.knee.value, + ratio: nativeDynamicsCompressorNode.ratio.value, + release: nativeDynamicsCompressorNode.release.value, + threshold: nativeDynamicsCompressorNode.threshold.value + }; + nativeDynamicsCompressorNode = createNativeDynamicsCompressorNode(nativeOfflineAudioContext, options); + } + renderedNativeDynamicsCompressorNodes.set(nativeOfflineAudioContext, nativeDynamicsCompressorNode); + if (!nativeDynamicsCompressorNodeIsOwnedByContext) { + await renderAutomation(nativeOfflineAudioContext, proxy.attack, nativeDynamicsCompressorNode.attack); + await renderAutomation(nativeOfflineAudioContext, proxy.knee, nativeDynamicsCompressorNode.knee); + await renderAutomation(nativeOfflineAudioContext, proxy.ratio, nativeDynamicsCompressorNode.ratio); + await renderAutomation(nativeOfflineAudioContext, proxy.release, nativeDynamicsCompressorNode.release); + await renderAutomation(nativeOfflineAudioContext, proxy.threshold, nativeDynamicsCompressorNode.threshold); + } + else { + await connectAudioParam(nativeOfflineAudioContext, proxy.attack, nativeDynamicsCompressorNode.attack); + await connectAudioParam(nativeOfflineAudioContext, proxy.knee, nativeDynamicsCompressorNode.knee); + await connectAudioParam(nativeOfflineAudioContext, proxy.ratio, nativeDynamicsCompressorNode.ratio); + await connectAudioParam(nativeOfflineAudioContext, proxy.release, nativeDynamicsCompressorNode.release); + await connectAudioParam(nativeOfflineAudioContext, proxy.threshold, nativeDynamicsCompressorNode.threshold); + } + await renderInputsOfAudioNode(proxy, nativeOfflineAudioContext, nativeDynamicsCompressorNode); + return nativeDynamicsCompressorNode; + }; + return { + render(proxy, nativeOfflineAudioContext) { + const renderedNativeDynamicsCompressorNode = renderedNativeDynamicsCompressorNodes.get(nativeOfflineAudioContext); + if (renderedNativeDynamicsCompressorNode !== undefined) { + return Promise.resolve(renderedNativeDynamicsCompressorNode); + } + return createDynamicsCompressorNode(proxy, nativeOfflineAudioContext); + } + }; + }; +}; + +const createEncodingError = () => new DOMException('', 'EncodingError'); + +const createEvaluateSource = (window) => { + return (source) => new Promise((resolve, reject) => { + if (window === null) { + // Bug #182 Chrome, Edge and Opera do throw an instance of a SyntaxError instead of a DOMException. + reject(new SyntaxError()); + return; + } + const head = window.document.head; + if (head === null) { + // Bug #182 Chrome, Edge and Opera do throw an instance of a SyntaxError instead of a DOMException. + reject(new SyntaxError()); + } + else { + const script = window.document.createElement('script'); + // @todo Safari doesn't like URLs with a type of 'application/javascript; charset=utf-8'. + const blob = new Blob([source], { type: 'application/javascript' }); + const url = URL.createObjectURL(blob); + const originalOnErrorHandler = window.onerror; + const removeErrorEventListenerAndRevokeUrl = () => { + window.onerror = originalOnErrorHandler; + URL.revokeObjectURL(url); + }; + window.onerror = (message, src, lineno, colno, error) => { + // @todo Edge thinks the source is the one of the html document. + if (src === url || (src === window.location.href && lineno === 1 && colno === 1)) { + removeErrorEventListenerAndRevokeUrl(); + reject(error); + return false; + } + if (originalOnErrorHandler !== null) { + return originalOnErrorHandler(message, src, lineno, colno, error); + } + }; + script.onerror = () => { + removeErrorEventListenerAndRevokeUrl(); + // Bug #182 Chrome, Edge and Opera do throw an instance of a SyntaxError instead of a DOMException. + reject(new SyntaxError()); + }; + script.onload = () => { + removeErrorEventListenerAndRevokeUrl(); + resolve(); + }; + script.src = url; + script.type = 'module'; + head.appendChild(script); + } + }); +}; + +const createEventTargetConstructor = (wrapEventListener) => { + return class EventTarget { + constructor(_nativeEventTarget) { + this._nativeEventTarget = _nativeEventTarget; + this._listeners = new WeakMap(); + } + addEventListener(type, listener, options) { + if (listener !== null) { + let wrappedEventListener = this._listeners.get(listener); + if (wrappedEventListener === undefined) { + wrappedEventListener = wrapEventListener(this, listener); + if (typeof listener === 'function') { + this._listeners.set(listener, wrappedEventListener); + } + } + this._nativeEventTarget.addEventListener(type, wrappedEventListener, options); + } + } + dispatchEvent(event) { + return this._nativeEventTarget.dispatchEvent(event); + } + removeEventListener(type, listener, options) { + const wrappedEventListener = listener === null ? undefined : this._listeners.get(listener); + this._nativeEventTarget.removeEventListener(type, wrappedEventListener === undefined ? null : wrappedEventListener, options); + } + }; +}; + +const createExposeCurrentFrameAndCurrentTime = (window) => { + return (currentTime, sampleRate, fn) => { + Object.defineProperties(window, { + currentFrame: { + configurable: true, + get() { + return Math.round(currentTime * sampleRate); + } + }, + currentTime: { + configurable: true, + get() { + return currentTime; + } + } + }); + try { + return fn(); + } + finally { + if (window !== null) { + delete window.currentFrame; + delete window.currentTime; + } + } + }; +}; + +const createFetchSource = (createAbortError) => { + return async (url) => { + try { + const response = await fetch(url); + if (response.ok) { + return [await response.text(), response.url]; + } + } + catch { + // Ignore errors. + } // tslint:disable-line:no-empty + throw createAbortError(); + }; +}; + +const DEFAULT_OPTIONS$b = { + channelCount: 2, + channelCountMode: 'max', + channelInterpretation: 'speakers', + gain: 1 +}; +const createGainNodeConstructor = (audioNodeConstructor, createAudioParam, createGainNodeRenderer, createNativeGainNode, getNativeContext, isNativeOfflineAudioContext) => { + return class GainNode extends audioNodeConstructor { + constructor(context, options) { + const nativeContext = getNativeContext(context); + const mergedOptions = { ...DEFAULT_OPTIONS$b, ...options }; + const nativeGainNode = createNativeGainNode(nativeContext, mergedOptions); + const isOffline = isNativeOfflineAudioContext(nativeContext); + const gainNodeRenderer = (isOffline ? createGainNodeRenderer() : null); + super(context, false, nativeGainNode, gainNodeRenderer); + // Bug #74: Safari does not export the correct values for maxValue and minValue. + this._gain = createAudioParam(this, isOffline, nativeGainNode.gain, MOST_POSITIVE_SINGLE_FLOAT, MOST_NEGATIVE_SINGLE_FLOAT); + } + get gain() { + return this._gain; + } + }; +}; + +const createGainNodeRendererFactory = (connectAudioParam, createNativeGainNode, getNativeAudioNode, renderAutomation, renderInputsOfAudioNode) => { + return () => { + const renderedNativeGainNodes = new WeakMap(); + const createGainNode = async (proxy, nativeOfflineAudioContext) => { + let nativeGainNode = getNativeAudioNode(proxy); + // If the initially used nativeGainNode was not constructed on the same OfflineAudioContext it needs to be created again. + const nativeGainNodeIsOwnedByContext = isOwnedByContext(nativeGainNode, nativeOfflineAudioContext); + if (!nativeGainNodeIsOwnedByContext) { + const options = { + channelCount: nativeGainNode.channelCount, + channelCountMode: nativeGainNode.channelCountMode, + channelInterpretation: nativeGainNode.channelInterpretation, + gain: nativeGainNode.gain.value + }; + nativeGainNode = createNativeGainNode(nativeOfflineAudioContext, options); + } + renderedNativeGainNodes.set(nativeOfflineAudioContext, nativeGainNode); + if (!nativeGainNodeIsOwnedByContext) { + await renderAutomation(nativeOfflineAudioContext, proxy.gain, nativeGainNode.gain); + } + else { + await connectAudioParam(nativeOfflineAudioContext, proxy.gain, nativeGainNode.gain); + } + await renderInputsOfAudioNode(proxy, nativeOfflineAudioContext, nativeGainNode); + return nativeGainNode; + }; + return { + render(proxy, nativeOfflineAudioContext) { + const renderedNativeGainNode = renderedNativeGainNodes.get(nativeOfflineAudioContext); + if (renderedNativeGainNode !== undefined) { + return Promise.resolve(renderedNativeGainNode); + } + return createGainNode(proxy, nativeOfflineAudioContext); + } + }; + }; +}; + +const createGetActiveAudioWorkletNodeInputs = (activeAudioWorkletNodeInputsStore, getValueForKey) => { + return (nativeAudioWorkletNode) => getValueForKey(activeAudioWorkletNodeInputsStore, nativeAudioWorkletNode); +}; + +const createGetAudioNodeRenderer = (getAudioNodeConnections) => { + return (audioNode) => { + const audioNodeConnections = getAudioNodeConnections(audioNode); + if (audioNodeConnections.renderer === null) { + throw new Error('Missing the renderer of the given AudioNode in the audio graph.'); + } + return audioNodeConnections.renderer; + }; +}; + +const createGetAudioNodeTailTime = (audioNodeTailTimeStore) => { + return (audioNode) => { var _a; return (_a = audioNodeTailTimeStore.get(audioNode)) !== null && _a !== void 0 ? _a : 0; }; +}; + +const createGetAudioParamRenderer = (getAudioParamConnections) => { + return (audioParam) => { + const audioParamConnections = getAudioParamConnections(audioParam); + if (audioParamConnections.renderer === null) { + throw new Error('Missing the renderer of the given AudioParam in the audio graph.'); + } + return audioParamConnections.renderer; + }; +}; + +const createGetBackupOfflineAudioContext = (backupOfflineAudioContextStore) => { + return (nativeContext) => { + return backupOfflineAudioContextStore.get(nativeContext); + }; +}; + +const createInvalidStateError = () => new DOMException('', 'InvalidStateError'); + +const createGetNativeContext = (contextStore) => { + return (context) => { + const nativeContext = contextStore.get(context); + if (nativeContext === undefined) { + throw createInvalidStateError(); + } + return (nativeContext); + }; +}; + +const createGetOrCreateBackupOfflineAudioContext = (backupOfflineAudioContextStore, nativeOfflineAudioContextConstructor) => { + return (nativeContext) => { + let backupOfflineAudioContext = backupOfflineAudioContextStore.get(nativeContext); + if (backupOfflineAudioContext !== undefined) { + return backupOfflineAudioContext; + } + if (nativeOfflineAudioContextConstructor === null) { + throw new Error('Missing the native OfflineAudioContext constructor.'); + } + // Bug #141: Safari does not support creating an OfflineAudioContext with less than 44100 Hz. + backupOfflineAudioContext = new nativeOfflineAudioContextConstructor(1, 1, 44100); + backupOfflineAudioContextStore.set(nativeContext, backupOfflineAudioContext); + return backupOfflineAudioContext; + }; +}; + +const createGetUnrenderedAudioWorkletNodes = (unrenderedAudioWorkletNodeStore) => { + return (nativeContext) => { + const unrenderedAudioWorkletNodes = unrenderedAudioWorkletNodeStore.get(nativeContext); + if (unrenderedAudioWorkletNodes === undefined) { + throw new Error('The context has no set of AudioWorkletNodes.'); + } + return unrenderedAudioWorkletNodes; + }; +}; + +const createInvalidAccessError = () => new DOMException('', 'InvalidAccessError'); + +const wrapIIRFilterNodeGetFrequencyResponseMethod = (nativeIIRFilterNode) => { + nativeIIRFilterNode.getFrequencyResponse = ((getFrequencyResponse) => { + return (frequencyHz, magResponse, phaseResponse) => { + if (frequencyHz.length !== magResponse.length || magResponse.length !== phaseResponse.length) { + throw createInvalidAccessError(); + } + return getFrequencyResponse.call(nativeIIRFilterNode, frequencyHz, magResponse, phaseResponse); + }; + })(nativeIIRFilterNode.getFrequencyResponse); +}; + +const DEFAULT_OPTIONS$c = { + channelCount: 2, + channelCountMode: 'max', + channelInterpretation: 'speakers' +}; +const createIIRFilterNodeConstructor = (audioNodeConstructor, createNativeIIRFilterNode, createIIRFilterNodeRenderer, getNativeContext, isNativeOfflineAudioContext, setAudioNodeTailTime) => { + return class IIRFilterNode extends audioNodeConstructor { + constructor(context, options) { + const nativeContext = getNativeContext(context); + const isOffline = isNativeOfflineAudioContext(nativeContext); + const mergedOptions = { ...DEFAULT_OPTIONS$c, ...options }; + const nativeIIRFilterNode = createNativeIIRFilterNode(nativeContext, isOffline ? null : context.baseLatency, mergedOptions); + const iirFilterNodeRenderer = ((isOffline ? createIIRFilterNodeRenderer(mergedOptions.feedback, mergedOptions.feedforward) : null)); + super(context, false, nativeIIRFilterNode, iirFilterNodeRenderer); + // Bug #23 & #24: FirefoxDeveloper does not throw an InvalidAccessError. + // @todo Write a test which allows other browsers to remain unpatched. + wrapIIRFilterNodeGetFrequencyResponseMethod(nativeIIRFilterNode); + this._nativeIIRFilterNode = nativeIIRFilterNode; + // @todo Determine a meaningful tail-time instead of just using one second. + setAudioNodeTailTime(this, 1); + } + getFrequencyResponse(frequencyHz, magResponse, phaseResponse) { + return this._nativeIIRFilterNode.getFrequencyResponse(frequencyHz, magResponse, phaseResponse); + } + }; +}; + +// This implementation as shamelessly inspired by source code of +// tslint:disable-next-line:max-line-length +// {@link https://chromium.googlesource.com/chromium/src.git/+/master/third_party/WebKit/Source/platform/audio/IIRFilter.cpp|Chromium's IIRFilter}. +const filterBuffer = (feedback, feedbackLength, feedforward, feedforwardLength, minLength, xBuffer, yBuffer, bufferIndex, bufferLength, input, output) => { + const inputLength = input.length; + let i = bufferIndex; + for (let j = 0; j < inputLength; j += 1) { + let y = feedforward[0] * input[j]; + for (let k = 1; k < minLength; k += 1) { + const x = (i - k) & (bufferLength - 1); // tslint:disable-line:no-bitwise + y += feedforward[k] * xBuffer[x]; + y -= feedback[k] * yBuffer[x]; + } + for (let k = minLength; k < feedforwardLength; k += 1) { + y += feedforward[k] * xBuffer[(i - k) & (bufferLength - 1)]; // tslint:disable-line:no-bitwise + } + for (let k = minLength; k < feedbackLength; k += 1) { + y -= feedback[k] * yBuffer[(i - k) & (bufferLength - 1)]; // tslint:disable-line:no-bitwise + } + xBuffer[i] = input[j]; + yBuffer[i] = y; + i = (i + 1) & (bufferLength - 1); // tslint:disable-line:no-bitwise + output[j] = y; + } + return i; +}; + +const filterFullBuffer = (renderedBuffer, nativeOfflineAudioContext, feedback, feedforward) => { + const convertedFeedback = feedback instanceof Float64Array ? feedback : new Float64Array(feedback); + const convertedFeedforward = feedforward instanceof Float64Array ? feedforward : new Float64Array(feedforward); + const feedbackLength = convertedFeedback.length; + const feedforwardLength = convertedFeedforward.length; + const minLength = Math.min(feedbackLength, feedforwardLength); + if (convertedFeedback[0] !== 1) { + for (let i = 0; i < feedbackLength; i += 1) { + convertedFeedforward[i] /= convertedFeedback[0]; + } + for (let i = 1; i < feedforwardLength; i += 1) { + convertedFeedback[i] /= convertedFeedback[0]; + } + } + const bufferLength = 32; + const xBuffer = new Float32Array(bufferLength); + const yBuffer = new Float32Array(bufferLength); + const filteredBuffer = nativeOfflineAudioContext.createBuffer(renderedBuffer.numberOfChannels, renderedBuffer.length, renderedBuffer.sampleRate); + const numberOfChannels = renderedBuffer.numberOfChannels; + for (let i = 0; i < numberOfChannels; i += 1) { + const input = renderedBuffer.getChannelData(i); + const output = filteredBuffer.getChannelData(i); + xBuffer.fill(0); + yBuffer.fill(0); + filterBuffer(convertedFeedback, feedbackLength, convertedFeedforward, feedforwardLength, minLength, xBuffer, yBuffer, 0, bufferLength, input, output); + } + return filteredBuffer; +}; +const createIIRFilterNodeRendererFactory = (createNativeAudioBufferSourceNode, getNativeAudioNode, nativeOfflineAudioContextConstructor, renderInputsOfAudioNode, renderNativeOfflineAudioContext) => { + return (feedback, feedforward) => { + const renderedNativeAudioNodes = new WeakMap(); + let filteredBufferPromise = null; + const createAudioNode = async (proxy, nativeOfflineAudioContext) => { + let nativeAudioBufferSourceNode = null; + let nativeIIRFilterNode = getNativeAudioNode(proxy); + // If the initially used nativeIIRFilterNode was not constructed on the same OfflineAudioContext it needs to be created again. + const nativeIIRFilterNodeIsOwnedByContext = isOwnedByContext(nativeIIRFilterNode, nativeOfflineAudioContext); + // Bug #9: Safari does not support IIRFilterNodes. + if (nativeOfflineAudioContext.createIIRFilter === undefined) { + nativeAudioBufferSourceNode = createNativeAudioBufferSourceNode(nativeOfflineAudioContext, { + buffer: null, + channelCount: 2, + channelCountMode: 'max', + channelInterpretation: 'speakers', + loop: false, + loopEnd: 0, + loopStart: 0, + playbackRate: 1 + }); + } + else if (!nativeIIRFilterNodeIsOwnedByContext) { + // @todo TypeScript defines the parameters of createIIRFilter() as arrays of numbers. + nativeIIRFilterNode = nativeOfflineAudioContext.createIIRFilter(feedforward, feedback); + } + renderedNativeAudioNodes.set(nativeOfflineAudioContext, nativeAudioBufferSourceNode === null ? nativeIIRFilterNode : nativeAudioBufferSourceNode); + if (nativeAudioBufferSourceNode !== null) { + if (filteredBufferPromise === null) { + if (nativeOfflineAudioContextConstructor === null) { + throw new Error('Missing the native OfflineAudioContext constructor.'); + } + const partialOfflineAudioContext = new nativeOfflineAudioContextConstructor( + // Bug #47: The AudioDestinationNode in Safari gets not initialized correctly. + proxy.context.destination.channelCount, + // Bug #17: Safari does not yet expose the length. + proxy.context.length, nativeOfflineAudioContext.sampleRate); + filteredBufferPromise = (async () => { + await renderInputsOfAudioNode(proxy, partialOfflineAudioContext, partialOfflineAudioContext.destination); + const renderedBuffer = await renderNativeOfflineAudioContext(partialOfflineAudioContext); + return filterFullBuffer(renderedBuffer, nativeOfflineAudioContext, feedback, feedforward); + })(); + } + const filteredBuffer = await filteredBufferPromise; + nativeAudioBufferSourceNode.buffer = filteredBuffer; + nativeAudioBufferSourceNode.start(0); + return nativeAudioBufferSourceNode; + } + await renderInputsOfAudioNode(proxy, nativeOfflineAudioContext, nativeIIRFilterNode); + return nativeIIRFilterNode; + }; + return { + render(proxy, nativeOfflineAudioContext) { + const renderedNativeAudioNode = renderedNativeAudioNodes.get(nativeOfflineAudioContext); + if (renderedNativeAudioNode !== undefined) { + return Promise.resolve(renderedNativeAudioNode); + } + return createAudioNode(proxy, nativeOfflineAudioContext); + } + }; + }; +}; + +const createIncrementCycleCounterFactory = (cycleCounters, disconnectNativeAudioNodeFromNativeAudioNode, getAudioNodeConnections, getNativeAudioNode, getNativeAudioParam, isActiveAudioNode) => { + return (isOffline) => { + return (audioNode, count) => { + const cycleCounter = cycleCounters.get(audioNode); + if (cycleCounter === undefined) { + if (!isOffline && isActiveAudioNode(audioNode)) { + const nativeSourceAudioNode = getNativeAudioNode(audioNode); + const { outputs } = getAudioNodeConnections(audioNode); + for (const output of outputs) { + if (isAudioNodeOutputConnection(output)) { + const nativeDestinationAudioNode = getNativeAudioNode(output[0]); + disconnectNativeAudioNodeFromNativeAudioNode(nativeSourceAudioNode, nativeDestinationAudioNode, output[1], output[2]); + } + else { + const nativeDestinationAudioParam = getNativeAudioParam(output[0]); + nativeSourceAudioNode.disconnect(nativeDestinationAudioParam, output[1]); + } + } + } + cycleCounters.set(audioNode, count); + } + else { + cycleCounters.set(audioNode, cycleCounter + count); + } + }; + }; +}; + +const createIsAnyAudioContext = (contextStore, isNativeAudioContext) => { + return (anything) => { + const nativeContext = contextStore.get(anything); + return isNativeAudioContext(nativeContext) || isNativeAudioContext(anything); + }; +}; + +const createIsAnyAudioNode = (audioNodeStore, isNativeAudioNode) => { + return (anything) => audioNodeStore.has(anything) || isNativeAudioNode(anything); +}; + +const createIsAnyAudioParam = (audioParamStore, isNativeAudioParam) => { + return (anything) => audioParamStore.has(anything) || isNativeAudioParam(anything); +}; + +const createIsAnyOfflineAudioContext = (contextStore, isNativeOfflineAudioContext) => { + return (anything) => { + const nativeContext = contextStore.get(anything); + return isNativeOfflineAudioContext(nativeContext) || isNativeOfflineAudioContext(anything); + }; +}; + +const createIsNativeAudioContext = (nativeAudioContextConstructor) => { + return (anything) => { + return nativeAudioContextConstructor !== null && anything instanceof nativeAudioContextConstructor; + }; +}; + +const createIsNativeAudioNode = (window) => { + return (anything) => { + return window !== null && typeof window.AudioNode === 'function' && anything instanceof window.AudioNode; + }; +}; + +const createIsNativeAudioParam = (window) => { + return (anything) => { + return window !== null && typeof window.AudioParam === 'function' && anything instanceof window.AudioParam; + }; +}; + +const createIsNativeContext = (isNativeAudioContext, isNativeOfflineAudioContext) => { + return (anything) => { + return isNativeAudioContext(anything) || isNativeOfflineAudioContext(anything); + }; +}; + +const createIsNativeOfflineAudioContext = (nativeOfflineAudioContextConstructor) => { + return (anything) => { + return nativeOfflineAudioContextConstructor !== null && anything instanceof nativeOfflineAudioContextConstructor; + }; +}; + +const createIsSecureContext = (window) => window !== null && window.isSecureContext; + +const createIsSupportedPromise = async (cacheTestResult, testAudioBufferCopyChannelMethodsSubarraySupport, testAudioContextCloseMethodSupport, testAudioContextDecodeAudioDataMethodTypeErrorSupport, testAudioContextOptionsSupport, testAudioNodeConnectMethodSupport, testAudioWorkletProcessorNoOutputsSupport, testChannelMergerNodeChannelCountSupport, testConstantSourceNodeAccurateSchedulingSupport, testConvolverNodeBufferReassignabilitySupport, testConvolverNodeChannelCountSupport, testDomExceptionContrucorSupport, testIsSecureContextSupport, testMediaStreamAudioSourceNodeMediaStreamWithoutAudioTrackSupport, testStereoPannerNodeDefaultValueSupport, testTransferablesSupport) => { + if (cacheTestResult(testAudioBufferCopyChannelMethodsSubarraySupport, testAudioBufferCopyChannelMethodsSubarraySupport) && + cacheTestResult(testAudioContextCloseMethodSupport, testAudioContextCloseMethodSupport) && + cacheTestResult(testAudioContextOptionsSupport, testAudioContextOptionsSupport) && + cacheTestResult(testAudioNodeConnectMethodSupport, testAudioNodeConnectMethodSupport) && + cacheTestResult(testChannelMergerNodeChannelCountSupport, testChannelMergerNodeChannelCountSupport) && + cacheTestResult(testConstantSourceNodeAccurateSchedulingSupport, testConstantSourceNodeAccurateSchedulingSupport) && + cacheTestResult(testConvolverNodeBufferReassignabilitySupport, testConvolverNodeBufferReassignabilitySupport) && + cacheTestResult(testConvolverNodeChannelCountSupport, testConvolverNodeChannelCountSupport) && + cacheTestResult(testDomExceptionContrucorSupport, testDomExceptionContrucorSupport) && + cacheTestResult(testIsSecureContextSupport, testIsSecureContextSupport) && + cacheTestResult(testMediaStreamAudioSourceNodeMediaStreamWithoutAudioTrackSupport, testMediaStreamAudioSourceNodeMediaStreamWithoutAudioTrackSupport)) { + const results = await Promise.all([ + cacheTestResult(testAudioContextDecodeAudioDataMethodTypeErrorSupport, testAudioContextDecodeAudioDataMethodTypeErrorSupport), + cacheTestResult(testAudioWorkletProcessorNoOutputsSupport, testAudioWorkletProcessorNoOutputsSupport), + cacheTestResult(testStereoPannerNodeDefaultValueSupport, testStereoPannerNodeDefaultValueSupport), + cacheTestResult(testTransferablesSupport, testTransferablesSupport) + ]); + return results.every((result) => result); + } + return false; +}; + +const createMediaElementAudioSourceNodeConstructor = (audioNodeConstructor, createNativeMediaElementAudioSourceNode, getNativeContext, isNativeOfflineAudioContext) => { + return class MediaElementAudioSourceNode extends audioNodeConstructor { + constructor(context, options) { + const nativeContext = getNativeContext(context); + const nativeMediaElementAudioSourceNode = createNativeMediaElementAudioSourceNode(nativeContext, options); + // Bug #171: Safari allows to create a MediaElementAudioSourceNode with an OfflineAudioContext. + if (isNativeOfflineAudioContext(nativeContext)) { + throw TypeError(); + } + super(context, true, nativeMediaElementAudioSourceNode, null); + this._nativeMediaElementAudioSourceNode = nativeMediaElementAudioSourceNode; + } + get mediaElement() { + return this._nativeMediaElementAudioSourceNode.mediaElement; + } + }; +}; + +const DEFAULT_OPTIONS$d = { + channelCount: 2, + channelCountMode: 'explicit', + channelInterpretation: 'speakers' +}; +const createMediaStreamAudioDestinationNodeConstructor = (audioNodeConstructor, createNativeMediaStreamAudioDestinationNode, getNativeContext, isNativeOfflineAudioContext) => { + return class MediaStreamAudioDestinationNode extends audioNodeConstructor { + constructor(context, options) { + const nativeContext = getNativeContext(context); + // Bug #173: Safari allows to create a MediaStreamAudioDestinationNode with an OfflineAudioContext. + if (isNativeOfflineAudioContext(nativeContext)) { + throw new TypeError(); + } + const mergedOptions = { ...DEFAULT_OPTIONS$d, ...options }; + const nativeMediaStreamAudioDestinationNode = createNativeMediaStreamAudioDestinationNode(nativeContext, mergedOptions); + super(context, false, nativeMediaStreamAudioDestinationNode, null); + this._nativeMediaStreamAudioDestinationNode = nativeMediaStreamAudioDestinationNode; + } + get stream() { + return this._nativeMediaStreamAudioDestinationNode.stream; + } + }; +}; + +const createMediaStreamAudioSourceNodeConstructor = (audioNodeConstructor, createNativeMediaStreamAudioSourceNode, getNativeContext, isNativeOfflineAudioContext) => { + return class MediaStreamAudioSourceNode extends audioNodeConstructor { + constructor(context, options) { + const nativeContext = getNativeContext(context); + const nativeMediaStreamAudioSourceNode = createNativeMediaStreamAudioSourceNode(nativeContext, options); + // Bug #172: Safari allows to create a MediaStreamAudioSourceNode with an OfflineAudioContext. + if (isNativeOfflineAudioContext(nativeContext)) { + throw new TypeError(); + } + super(context, true, nativeMediaStreamAudioSourceNode, null); + this._nativeMediaStreamAudioSourceNode = nativeMediaStreamAudioSourceNode; + } + get mediaStream() { + return this._nativeMediaStreamAudioSourceNode.mediaStream; + } + }; +}; + +const createMediaStreamTrackAudioSourceNodeConstructor = (audioNodeConstructor, createNativeMediaStreamTrackAudioSourceNode, getNativeContext) => { + return class MediaStreamTrackAudioSourceNode extends audioNodeConstructor { + constructor(context, options) { + const nativeContext = getNativeContext(context); + const nativeMediaStreamTrackAudioSourceNode = createNativeMediaStreamTrackAudioSourceNode(nativeContext, options); + super(context, true, nativeMediaStreamTrackAudioSourceNode, null); + } + }; +}; + +const createMinimalBaseAudioContextConstructor = (audioDestinationNodeConstructor, createAudioListener, eventTargetConstructor, isNativeOfflineAudioContext, unrenderedAudioWorkletNodeStore, wrapEventListener) => { + return class MinimalBaseAudioContext extends eventTargetConstructor { + constructor(_nativeContext, numberOfChannels) { + super(_nativeContext); + this._nativeContext = _nativeContext; + CONTEXT_STORE.set(this, _nativeContext); + if (isNativeOfflineAudioContext(_nativeContext)) { + unrenderedAudioWorkletNodeStore.set(_nativeContext, new Set()); + } + this._destination = new audioDestinationNodeConstructor(this, numberOfChannels); + this._listener = createAudioListener(this, _nativeContext); + this._onstatechange = null; + } + get currentTime() { + return this._nativeContext.currentTime; + } + get destination() { + return this._destination; + } + get listener() { + return this._listener; + } + get onstatechange() { + return this._onstatechange; + } + set onstatechange(value) { + const wrappedListener = typeof value === 'function' ? wrapEventListener(this, value) : null; + this._nativeContext.onstatechange = wrappedListener; + const nativeOnStateChange = this._nativeContext.onstatechange; + this._onstatechange = nativeOnStateChange !== null && nativeOnStateChange === wrappedListener ? value : nativeOnStateChange; + } + get sampleRate() { + return this._nativeContext.sampleRate; + } + get state() { + return this._nativeContext.state; + } + }; +}; + +const testPromiseSupport = (nativeContext) => { + // This 12 numbers represent the 48 bytes of an empty WAVE file with a single sample. + const uint32Array = new Uint32Array([1179011410, 40, 1163280727, 544501094, 16, 131073, 44100, 176400, 1048580, 1635017060, 4, 0]); + try { + // Bug #1: Safari requires a successCallback. + const promise = nativeContext.decodeAudioData(uint32Array.buffer, () => { + // Ignore the success callback. + }); + if (promise === undefined) { + return false; + } + promise.catch(() => { + // Ignore rejected errors. + }); + return true; + } + catch { + // Ignore errors. + } + return false; +}; + +const createMonitorConnections = (insertElementInSet, isNativeAudioNode) => { + return (nativeAudioNode, whenConnected, whenDisconnected) => { + const connections = new Set(); + nativeAudioNode.connect = ((connect) => { + // tslint:disable-next-line:invalid-void no-inferrable-types + return (destination, output = 0, input = 0) => { + const wasDisconnected = connections.size === 0; + if (isNativeAudioNode(destination)) { + // @todo TypeScript cannot infer the overloaded signature with 3 arguments yet. + connect.call(nativeAudioNode, destination, output, input); + insertElementInSet(connections, [destination, output, input], (connection) => connection[0] === destination && connection[1] === output && connection[2] === input, true); + if (wasDisconnected) { + whenConnected(); + } + return destination; + } + connect.call(nativeAudioNode, destination, output); + insertElementInSet(connections, [destination, output], (connection) => connection[0] === destination && connection[1] === output, true); + if (wasDisconnected) { + whenConnected(); + } + return; + }; + })(nativeAudioNode.connect); + nativeAudioNode.disconnect = ((disconnect) => { + return (destinationOrOutput, output, input) => { + const wasConnected = connections.size > 0; + if (destinationOrOutput === undefined) { + disconnect.apply(nativeAudioNode); + connections.clear(); + } + else if (typeof destinationOrOutput === 'number') { + // @todo TypeScript cannot infer the overloaded signature with 1 argument yet. + disconnect.call(nativeAudioNode, destinationOrOutput); + for (const connection of connections) { + if (connection[1] === destinationOrOutput) { + connections.delete(connection); + } + } + } + else { + if (isNativeAudioNode(destinationOrOutput)) { + // @todo TypeScript cannot infer the overloaded signature with 3 arguments yet. + disconnect.call(nativeAudioNode, destinationOrOutput, output, input); + } + else { + // @todo TypeScript cannot infer the overloaded signature with 2 arguments yet. + disconnect.call(nativeAudioNode, destinationOrOutput, output); + } + for (const connection of connections) { + if (connection[0] === destinationOrOutput && + (output === undefined || connection[1] === output) && + (input === undefined || connection[2] === input)) { + connections.delete(connection); + } + } + } + const isDisconnected = connections.size === 0; + if (wasConnected && isDisconnected) { + whenDisconnected(); + } + }; + })(nativeAudioNode.disconnect); + return nativeAudioNode; + }; +}; + +const assignNativeAudioNodeOption = (nativeAudioNode, options, option) => { + const value = options[option]; + if (value !== undefined && value !== nativeAudioNode[option]) { + nativeAudioNode[option] = value; + } +}; + +const assignNativeAudioNodeOptions = (nativeAudioNode, options) => { + assignNativeAudioNodeOption(nativeAudioNode, options, 'channelCount'); + assignNativeAudioNodeOption(nativeAudioNode, options, 'channelCountMode'); + assignNativeAudioNodeOption(nativeAudioNode, options, 'channelInterpretation'); +}; + +const testAnalyserNodeGetFloatTimeDomainDataMethodSupport = (nativeAnalyserNode) => { + return typeof nativeAnalyserNode.getFloatTimeDomainData === 'function'; +}; + +const wrapAnalyserNodeGetFloatTimeDomainDataMethod = (nativeAnalyserNode) => { + nativeAnalyserNode.getFloatTimeDomainData = (array) => { + const byteTimeDomainData = new Uint8Array(array.length); + nativeAnalyserNode.getByteTimeDomainData(byteTimeDomainData); + const length = Math.max(byteTimeDomainData.length, nativeAnalyserNode.fftSize); + for (let i = 0; i < length; i += 1) { + array[i] = (byteTimeDomainData[i] - 128) * 0.0078125; + } + return array; + }; +}; + +const createNativeAnalyserNodeFactory = (cacheTestResult, createIndexSizeError) => { + return (nativeContext, options) => { + const nativeAnalyserNode = nativeContext.createAnalyser(); + // Bug #37: Firefox does not create an AnalyserNode with the default properties. + assignNativeAudioNodeOptions(nativeAnalyserNode, options); + // Bug #118: Safari does not throw an error if maxDecibels is not more than minDecibels. + if (!(options.maxDecibels > options.minDecibels)) { + throw createIndexSizeError(); + } + assignNativeAudioNodeOption(nativeAnalyserNode, options, 'fftSize'); + assignNativeAudioNodeOption(nativeAnalyserNode, options, 'maxDecibels'); + assignNativeAudioNodeOption(nativeAnalyserNode, options, 'minDecibels'); + assignNativeAudioNodeOption(nativeAnalyserNode, options, 'smoothingTimeConstant'); + // Bug #36: Safari does not support getFloatTimeDomainData() yet. + if (!cacheTestResult(testAnalyserNodeGetFloatTimeDomainDataMethodSupport, () => testAnalyserNodeGetFloatTimeDomainDataMethodSupport(nativeAnalyserNode))) { + wrapAnalyserNodeGetFloatTimeDomainDataMethod(nativeAnalyserNode); + } + return nativeAnalyserNode; + }; +}; + +const createNativeAudioBufferConstructor = (window) => { + if (window === null) { + return null; + } + if (window.hasOwnProperty('AudioBuffer')) { + return window.AudioBuffer; + } + return null; +}; + +const assignNativeAudioNodeAudioParamValue = (nativeAudioNode, options, audioParam) => { + const value = options[audioParam]; + if (value !== undefined && value !== nativeAudioNode[audioParam].value) { + nativeAudioNode[audioParam].value = value; + } +}; + +const wrapAudioBufferSourceNodeStartMethodConsecutiveCalls = (nativeAudioBufferSourceNode) => { + nativeAudioBufferSourceNode.start = ((start) => { + let isScheduled = false; + return (when = 0, offset = 0, duration) => { + if (isScheduled) { + throw createInvalidStateError(); + } + start.call(nativeAudioBufferSourceNode, when, offset, duration); + isScheduled = true; + }; + })(nativeAudioBufferSourceNode.start); +}; + +const wrapAudioScheduledSourceNodeStartMethodNegativeParameters = (nativeAudioScheduledSourceNode) => { + nativeAudioScheduledSourceNode.start = ((start) => { + return (when = 0, offset = 0, duration) => { + if ((typeof duration === 'number' && duration < 0) || offset < 0 || when < 0) { + throw new RangeError("The parameters can't be negative."); + } + // @todo TypeScript cannot infer the overloaded signature with 3 arguments yet. + start.call(nativeAudioScheduledSourceNode, when, offset, duration); + }; + })(nativeAudioScheduledSourceNode.start); +}; + +const wrapAudioScheduledSourceNodeStopMethodNegativeParameters = (nativeAudioScheduledSourceNode) => { + nativeAudioScheduledSourceNode.stop = ((stop) => { + return (when = 0) => { + if (when < 0) { + throw new RangeError("The parameter can't be negative."); + } + stop.call(nativeAudioScheduledSourceNode, when); + }; + })(nativeAudioScheduledSourceNode.stop); +}; + +const createNativeAudioBufferSourceNodeFactory = (addSilentConnection, cacheTestResult, testAudioBufferSourceNodeStartMethodConsecutiveCallsSupport, testAudioBufferSourceNodeStartMethodOffsetClampingSupport, testAudioBufferSourceNodeStopMethodNullifiedBufferSupport, testAudioScheduledSourceNodeStartMethodNegativeParametersSupport, testAudioScheduledSourceNodeStopMethodConsecutiveCallsSupport, testAudioScheduledSourceNodeStopMethodNegativeParametersSupport, wrapAudioBufferSourceNodeStartMethodOffsetClampling, wrapAudioBufferSourceNodeStopMethodNullifiedBuffer, wrapAudioScheduledSourceNodeStopMethodConsecutiveCalls) => { + return (nativeContext, options) => { + const nativeAudioBufferSourceNode = nativeContext.createBufferSource(); + assignNativeAudioNodeOptions(nativeAudioBufferSourceNode, options); + assignNativeAudioNodeAudioParamValue(nativeAudioBufferSourceNode, options, 'playbackRate'); + assignNativeAudioNodeOption(nativeAudioBufferSourceNode, options, 'buffer'); + // Bug #149: Safari does not yet support the detune AudioParam. + assignNativeAudioNodeOption(nativeAudioBufferSourceNode, options, 'loop'); + assignNativeAudioNodeOption(nativeAudioBufferSourceNode, options, 'loopEnd'); + assignNativeAudioNodeOption(nativeAudioBufferSourceNode, options, 'loopStart'); + // Bug #69: Safari does allow calls to start() of an already scheduled AudioBufferSourceNode. + if (!cacheTestResult(testAudioBufferSourceNodeStartMethodConsecutiveCallsSupport, () => testAudioBufferSourceNodeStartMethodConsecutiveCallsSupport(nativeContext))) { + wrapAudioBufferSourceNodeStartMethodConsecutiveCalls(nativeAudioBufferSourceNode); + } + // Bug #154 & #155: Safari does not handle offsets which are equal to or greater than the duration of the buffer. + if (!cacheTestResult(testAudioBufferSourceNodeStartMethodOffsetClampingSupport, () => testAudioBufferSourceNodeStartMethodOffsetClampingSupport(nativeContext))) { + wrapAudioBufferSourceNodeStartMethodOffsetClampling(nativeAudioBufferSourceNode); + } + // Bug #162: Safari does throw an error when stop() is called on an AudioBufferSourceNode which has no buffer assigned to it. + if (!cacheTestResult(testAudioBufferSourceNodeStopMethodNullifiedBufferSupport, () => testAudioBufferSourceNodeStopMethodNullifiedBufferSupport(nativeContext))) { + wrapAudioBufferSourceNodeStopMethodNullifiedBuffer(nativeAudioBufferSourceNode, nativeContext); + } + // Bug #44: Safari does not throw a RangeError yet. + if (!cacheTestResult(testAudioScheduledSourceNodeStartMethodNegativeParametersSupport, () => testAudioScheduledSourceNodeStartMethodNegativeParametersSupport(nativeContext))) { + wrapAudioScheduledSourceNodeStartMethodNegativeParameters(nativeAudioBufferSourceNode); + } + // Bug #19: Safari does not ignore calls to stop() of an already stopped AudioBufferSourceNode. + if (!cacheTestResult(testAudioScheduledSourceNodeStopMethodConsecutiveCallsSupport, () => testAudioScheduledSourceNodeStopMethodConsecutiveCallsSupport(nativeContext))) { + wrapAudioScheduledSourceNodeStopMethodConsecutiveCalls(nativeAudioBufferSourceNode, nativeContext); + } + // Bug #44: Only Firefox does not throw a RangeError yet. + if (!cacheTestResult(testAudioScheduledSourceNodeStopMethodNegativeParametersSupport, () => testAudioScheduledSourceNodeStopMethodNegativeParametersSupport(nativeContext))) { + wrapAudioScheduledSourceNodeStopMethodNegativeParameters(nativeAudioBufferSourceNode); + } + // Bug #175: Safari will not fire an ended event if the AudioBufferSourceNode is unconnected. + addSilentConnection(nativeContext, nativeAudioBufferSourceNode); + return nativeAudioBufferSourceNode; + }; +}; + +const createNativeAudioContextConstructor = (window) => { + if (window === null) { + return null; + } + if (window.hasOwnProperty('AudioContext')) { + return window.AudioContext; + } + return window.hasOwnProperty('webkitAudioContext') ? window.webkitAudioContext : null; +}; + +const createNativeAudioDestinationNodeFactory = (createNativeGainNode, overwriteAccessors) => { + return (nativeContext, channelCount, isNodeOfNativeOfflineAudioContext) => { + const nativeAudioDestinationNode = nativeContext.destination; + // Bug #132: Safari does not have the correct channelCount. + if (nativeAudioDestinationNode.channelCount !== channelCount) { + try { + nativeAudioDestinationNode.channelCount = channelCount; + } + catch { + // Bug #169: Safari throws an error on each attempt to change the channelCount. + } + } + // Bug #83: Safari does not have the correct channelCountMode. + if (isNodeOfNativeOfflineAudioContext && nativeAudioDestinationNode.channelCountMode !== 'explicit') { + nativeAudioDestinationNode.channelCountMode = 'explicit'; + } + // Bug #47: The AudioDestinationNode in Safari does not initialize the maxChannelCount property correctly. + if (nativeAudioDestinationNode.maxChannelCount === 0) { + Object.defineProperty(nativeAudioDestinationNode, 'maxChannelCount', { + value: channelCount + }); + } + // Bug #168: No browser does yet have an AudioDestinationNode with an output. + const gainNode = createNativeGainNode(nativeContext, { + channelCount, + channelCountMode: nativeAudioDestinationNode.channelCountMode, + channelInterpretation: nativeAudioDestinationNode.channelInterpretation, + gain: 1 + }); + overwriteAccessors(gainNode, 'channelCount', (get) => () => get.call(gainNode), (set) => (value) => { + set.call(gainNode, value); + try { + nativeAudioDestinationNode.channelCount = value; + } + catch (err) { + // Bug #169: Safari throws an error on each attempt to change the channelCount. + if (value > nativeAudioDestinationNode.maxChannelCount) { + throw err; + } + } + }); + overwriteAccessors(gainNode, 'channelCountMode', (get) => () => get.call(gainNode), (set) => (value) => { + set.call(gainNode, value); + nativeAudioDestinationNode.channelCountMode = value; + }); + overwriteAccessors(gainNode, 'channelInterpretation', (get) => () => get.call(gainNode), (set) => (value) => { + set.call(gainNode, value); + nativeAudioDestinationNode.channelInterpretation = value; + }); + Object.defineProperty(gainNode, 'maxChannelCount', { + get: () => nativeAudioDestinationNode.maxChannelCount + }); + // @todo This should be disconnected when the context is closed. + gainNode.connect(nativeAudioDestinationNode); + return gainNode; + }; +}; + +const createNativeAudioWorkletNodeConstructor = (window) => { + if (window === null) { + return null; + } + return window.hasOwnProperty('AudioWorkletNode') ? window.AudioWorkletNode : null; +}; + +const testClonabilityOfAudioWorkletNodeOptions = (audioWorkletNodeOptions) => { + const { port1 } = new MessageChannel(); + try { + // This will throw an error if the audioWorkletNodeOptions are not clonable. + port1.postMessage(audioWorkletNodeOptions); + } + finally { + port1.close(); + } +}; + +const createNativeAudioWorkletNodeFactory = (createInvalidStateError, createNativeAudioWorkletNodeFaker, createNativeGainNode, createNotSupportedError, monitorConnections) => { + return (nativeContext, baseLatency, nativeAudioWorkletNodeConstructor, name, processorConstructor, options) => { + if (nativeAudioWorkletNodeConstructor !== null) { + try { + const nativeAudioWorkletNode = new nativeAudioWorkletNodeConstructor(nativeContext, name, options); + const patchedEventListeners = new Map(); + let onprocessorerror = null; + Object.defineProperties(nativeAudioWorkletNode, { + /* + * Bug #61: Overwriting the property accessors for channelCount and channelCountMode is necessary as long as some + * browsers have no native implementation to achieve a consistent behavior. + */ + channelCount: { + get: () => options.channelCount, + set: () => { + throw createInvalidStateError(); + } + }, + channelCountMode: { + get: () => 'explicit', + set: () => { + throw createInvalidStateError(); + } + }, + // Bug #156: Chrome and Edge do not yet fire an ErrorEvent. + onprocessorerror: { + get: () => onprocessorerror, + set: (value) => { + if (typeof onprocessorerror === 'function') { + nativeAudioWorkletNode.removeEventListener('processorerror', onprocessorerror); + } + onprocessorerror = typeof value === 'function' ? value : null; + if (typeof onprocessorerror === 'function') { + nativeAudioWorkletNode.addEventListener('processorerror', onprocessorerror); + } + } + } + }); + nativeAudioWorkletNode.addEventListener = ((addEventListener) => { + return (...args) => { + if (args[0] === 'processorerror') { + const unpatchedEventListener = typeof args[1] === 'function' + ? args[1] + : typeof args[1] === 'object' && args[1] !== null && typeof args[1].handleEvent === 'function' + ? args[1].handleEvent + : null; + if (unpatchedEventListener !== null) { + const patchedEventListener = patchedEventListeners.get(args[1]); + if (patchedEventListener !== undefined) { + args[1] = patchedEventListener; + } + else { + args[1] = (event) => { + // Bug #178: Chrome, Edge and Opera do fire an event of type error. + if (event.type === 'error') { + Object.defineProperties(event, { + type: { value: 'processorerror' } + }); + unpatchedEventListener(event); + } + else { + unpatchedEventListener(new ErrorEvent(args[0], { ...event })); + } + }; + patchedEventListeners.set(unpatchedEventListener, args[1]); + } + } + } + // Bug #178: Chrome, Edge and Opera do fire an event of type error. + addEventListener.call(nativeAudioWorkletNode, 'error', args[1], args[2]); + return addEventListener.call(nativeAudioWorkletNode, ...args); + }; + })(nativeAudioWorkletNode.addEventListener); + nativeAudioWorkletNode.removeEventListener = ((removeEventListener) => { + return (...args) => { + if (args[0] === 'processorerror') { + const patchedEventListener = patchedEventListeners.get(args[1]); + if (patchedEventListener !== undefined) { + patchedEventListeners.delete(args[1]); + args[1] = patchedEventListener; + } + } + // Bug #178: Chrome, Edge and Opera do fire an event of type error. + removeEventListener.call(nativeAudioWorkletNode, 'error', args[1], args[2]); + return removeEventListener.call(nativeAudioWorkletNode, args[0], args[1], args[2]); + }; + })(nativeAudioWorkletNode.removeEventListener); + /* + * Bug #86: Chrome and Edge do not invoke the process() function if the corresponding AudioWorkletNode is unconnected but + * has an output. + */ + if (options.numberOfOutputs !== 0) { + const nativeGainNode = createNativeGainNode(nativeContext, { + channelCount: 1, + channelCountMode: 'explicit', + channelInterpretation: 'discrete', + gain: 0 + }); + nativeAudioWorkletNode.connect(nativeGainNode).connect(nativeContext.destination); + const whenConnected = () => nativeGainNode.disconnect(); + const whenDisconnected = () => nativeGainNode.connect(nativeContext.destination); + // @todo Disconnect the connection when the process() function of the AudioWorkletNode returns false. + return monitorConnections(nativeAudioWorkletNode, whenConnected, whenDisconnected); + } + return nativeAudioWorkletNode; + } + catch (err) { + // Bug #60: Chrome, Edge & Opera throw an InvalidStateError instead of a NotSupportedError. + if (err.code === 11) { + throw createNotSupportedError(); + } + throw err; + } + } + // Bug #61: Only Chrome & Opera have an implementation of the AudioWorkletNode yet. + if (processorConstructor === undefined) { + throw createNotSupportedError(); + } + testClonabilityOfAudioWorkletNodeOptions(options); + return createNativeAudioWorkletNodeFaker(nativeContext, baseLatency, processorConstructor, options); + }; +}; + +const computeBufferSize = (baseLatency, sampleRate) => { + if (baseLatency === null) { + return 512; + } + return Math.max(512, Math.min(16384, Math.pow(2, Math.round(Math.log2(baseLatency * sampleRate))))); +}; + +const cloneAudioWorkletNodeOptions = (audioWorkletNodeOptions) => { + return new Promise((resolve, reject) => { + const { port1, port2 } = new MessageChannel(); + port1.onmessage = ({ data }) => { + port1.close(); + port2.close(); + resolve(data); + }; + port1.onmessageerror = ({ data }) => { + port1.close(); + port2.close(); + reject(data); + }; + // This will throw an error if the audioWorkletNodeOptions are not clonable. + port2.postMessage(audioWorkletNodeOptions); + }); +}; + +const createAudioWorkletProcessorPromise = async (processorConstructor, audioWorkletNodeOptions) => { + const clonedAudioWorkletNodeOptions = await cloneAudioWorkletNodeOptions(audioWorkletNodeOptions); + return new processorConstructor(clonedAudioWorkletNodeOptions); +}; + +const createAudioWorkletProcessor = (nativeContext, nativeAudioWorkletNode, processorConstructor, audioWorkletNodeOptions) => { + let nodeToProcessorMap = NODE_TO_PROCESSOR_MAPS.get(nativeContext); + if (nodeToProcessorMap === undefined) { + nodeToProcessorMap = new WeakMap(); + NODE_TO_PROCESSOR_MAPS.set(nativeContext, nodeToProcessorMap); + } + const audioWorkletProcessorPromise = createAudioWorkletProcessorPromise(processorConstructor, audioWorkletNodeOptions); + nodeToProcessorMap.set(nativeAudioWorkletNode, audioWorkletProcessorPromise); + return audioWorkletProcessorPromise; +}; + +const createNativeAudioWorkletNodeFakerFactory = (connectMultipleOutputs, createIndexSizeError, createInvalidStateError, createNativeChannelMergerNode, createNativeChannelSplitterNode, createNativeConstantSourceNode, createNativeGainNode, createNativeScriptProcessorNode, createNotSupportedError, disconnectMultipleOutputs, exposeCurrentFrameAndCurrentTime, getActiveAudioWorkletNodeInputs, monitorConnections) => { + return (nativeContext, baseLatency, processorConstructor, options) => { + if (options.numberOfInputs === 0 && options.numberOfOutputs === 0) { + throw createNotSupportedError(); + } + const outputChannelCount = Array.isArray(options.outputChannelCount) + ? options.outputChannelCount + : Array.from(options.outputChannelCount); + // @todo Check if any of the channelCount values is greater than the implementation's maximum number of channels. + if (outputChannelCount.some((channelCount) => channelCount < 1)) { + throw createNotSupportedError(); + } + if (outputChannelCount.length !== options.numberOfOutputs) { + throw createIndexSizeError(); + } + // Bug #61: This is not part of the standard but required for the faker to work. + if (options.channelCountMode !== 'explicit') { + throw createNotSupportedError(); + } + const numberOfInputChannels = options.channelCount * options.numberOfInputs; + const numberOfOutputChannels = outputChannelCount.reduce((sum, value) => sum + value, 0); + const numberOfParameters = processorConstructor.parameterDescriptors === undefined ? 0 : processorConstructor.parameterDescriptors.length; + // Bug #61: This is not part of the standard but required for the faker to work. + if (numberOfInputChannels + numberOfParameters > 6 || numberOfOutputChannels > 6) { + throw createNotSupportedError(); + } + const messageChannel = new MessageChannel(); + const gainNodes = []; + const inputChannelSplitterNodes = []; + for (let i = 0; i < options.numberOfInputs; i += 1) { + gainNodes.push(createNativeGainNode(nativeContext, { + channelCount: options.channelCount, + channelCountMode: options.channelCountMode, + channelInterpretation: options.channelInterpretation, + gain: 1 + })); + inputChannelSplitterNodes.push(createNativeChannelSplitterNode(nativeContext, { + channelCount: options.channelCount, + channelCountMode: 'explicit', + channelInterpretation: 'discrete', + numberOfOutputs: options.channelCount + })); + } + const constantSourceNodes = []; + if (processorConstructor.parameterDescriptors !== undefined) { + for (const { defaultValue, maxValue, minValue, name } of processorConstructor.parameterDescriptors) { + const constantSourceNode = createNativeConstantSourceNode(nativeContext, { + channelCount: 1, + channelCountMode: 'explicit', + channelInterpretation: 'discrete', + offset: options.parameterData[name] !== undefined + ? options.parameterData[name] + : defaultValue === undefined + ? 0 + : defaultValue + }); + Object.defineProperties(constantSourceNode.offset, { + defaultValue: { + get: () => (defaultValue === undefined ? 0 : defaultValue) + }, + maxValue: { + get: () => (maxValue === undefined ? MOST_POSITIVE_SINGLE_FLOAT : maxValue) + }, + minValue: { + get: () => (minValue === undefined ? MOST_NEGATIVE_SINGLE_FLOAT : minValue) + } + }); + constantSourceNodes.push(constantSourceNode); + } + } + const inputChannelMergerNode = createNativeChannelMergerNode(nativeContext, { + channelCount: 1, + channelCountMode: 'explicit', + channelInterpretation: 'speakers', + numberOfInputs: Math.max(1, numberOfInputChannels + numberOfParameters) + }); + const bufferSize = computeBufferSize(baseLatency, nativeContext.sampleRate); + const scriptProcessorNode = createNativeScriptProcessorNode(nativeContext, bufferSize, numberOfInputChannels + numberOfParameters, + // Bug #87: Only Firefox will fire an AudioProcessingEvent if there is no connected output. + Math.max(1, numberOfOutputChannels)); + const outputChannelSplitterNode = createNativeChannelSplitterNode(nativeContext, { + channelCount: Math.max(1, numberOfOutputChannels), + channelCountMode: 'explicit', + channelInterpretation: 'discrete', + numberOfOutputs: Math.max(1, numberOfOutputChannels) + }); + const outputChannelMergerNodes = []; + for (let i = 0; i < options.numberOfOutputs; i += 1) { + outputChannelMergerNodes.push(createNativeChannelMergerNode(nativeContext, { + channelCount: 1, + channelCountMode: 'explicit', + channelInterpretation: 'speakers', + numberOfInputs: outputChannelCount[i] + })); + } + for (let i = 0; i < options.numberOfInputs; i += 1) { + gainNodes[i].connect(inputChannelSplitterNodes[i]); + for (let j = 0; j < options.channelCount; j += 1) { + inputChannelSplitterNodes[i].connect(inputChannelMergerNode, j, i * options.channelCount + j); + } + } + const parameterMap = new ReadOnlyMap(processorConstructor.parameterDescriptors === undefined + ? [] + : processorConstructor.parameterDescriptors.map(({ name }, index) => { + const constantSourceNode = constantSourceNodes[index]; + constantSourceNode.connect(inputChannelMergerNode, 0, numberOfInputChannels + index); + constantSourceNode.start(0); + return [name, constantSourceNode.offset]; + })); + inputChannelMergerNode.connect(scriptProcessorNode); + let channelInterpretation = options.channelInterpretation; + let onprocessorerror = null; + // Bug #87: Expose at least one output to make this node connectable. + const outputAudioNodes = options.numberOfOutputs === 0 ? [scriptProcessorNode] : outputChannelMergerNodes; + const nativeAudioWorkletNodeFaker = { + get bufferSize() { + return bufferSize; + }, + get channelCount() { + return options.channelCount; + }, + set channelCount(_) { + // Bug #61: This is not part of the standard but required for the faker to work. + throw createInvalidStateError(); + }, + get channelCountMode() { + return options.channelCountMode; + }, + set channelCountMode(_) { + // Bug #61: This is not part of the standard but required for the faker to work. + throw createInvalidStateError(); + }, + get channelInterpretation() { + return channelInterpretation; + }, + set channelInterpretation(value) { + for (const gainNode of gainNodes) { + gainNode.channelInterpretation = value; + } + channelInterpretation = value; + }, + get context() { + return scriptProcessorNode.context; + }, + get inputs() { + return gainNodes; + }, + get numberOfInputs() { + return options.numberOfInputs; + }, + get numberOfOutputs() { + return options.numberOfOutputs; + }, + get onprocessorerror() { + return onprocessorerror; + }, + set onprocessorerror(value) { + if (typeof onprocessorerror === 'function') { + nativeAudioWorkletNodeFaker.removeEventListener('processorerror', onprocessorerror); + } + onprocessorerror = typeof value === 'function' ? value : null; + if (typeof onprocessorerror === 'function') { + nativeAudioWorkletNodeFaker.addEventListener('processorerror', onprocessorerror); + } + }, + get parameters() { + return parameterMap; + }, + get port() { + return messageChannel.port2; + }, + addEventListener(...args) { + return scriptProcessorNode.addEventListener(args[0], args[1], args[2]); + }, + connect: connectMultipleOutputs.bind(null, outputAudioNodes), + disconnect: disconnectMultipleOutputs.bind(null, outputAudioNodes), + dispatchEvent(...args) { + return scriptProcessorNode.dispatchEvent(args[0]); + }, + removeEventListener(...args) { + return scriptProcessorNode.removeEventListener(args[0], args[1], args[2]); + } + }; + const patchedEventListeners = new Map(); + messageChannel.port1.addEventListener = ((addEventListener) => { + return (...args) => { + if (args[0] === 'message') { + const unpatchedEventListener = typeof args[1] === 'function' + ? args[1] + : typeof args[1] === 'object' && args[1] !== null && typeof args[1].handleEvent === 'function' + ? args[1].handleEvent + : null; + if (unpatchedEventListener !== null) { + const patchedEventListener = patchedEventListeners.get(args[1]); + if (patchedEventListener !== undefined) { + args[1] = patchedEventListener; + } + else { + args[1] = (event) => { + exposeCurrentFrameAndCurrentTime(nativeContext.currentTime, nativeContext.sampleRate, () => unpatchedEventListener(event)); + }; + patchedEventListeners.set(unpatchedEventListener, args[1]); + } + } + } + return addEventListener.call(messageChannel.port1, args[0], args[1], args[2]); + }; + })(messageChannel.port1.addEventListener); + messageChannel.port1.removeEventListener = ((removeEventListener) => { + return (...args) => { + if (args[0] === 'message') { + const patchedEventListener = patchedEventListeners.get(args[1]); + if (patchedEventListener !== undefined) { + patchedEventListeners.delete(args[1]); + args[1] = patchedEventListener; + } + } + return removeEventListener.call(messageChannel.port1, args[0], args[1], args[2]); + }; + })(messageChannel.port1.removeEventListener); + let onmessage = null; + Object.defineProperty(messageChannel.port1, 'onmessage', { + get: () => onmessage, + set: (value) => { + if (typeof onmessage === 'function') { + messageChannel.port1.removeEventListener('message', onmessage); + } + onmessage = typeof value === 'function' ? value : null; + if (typeof onmessage === 'function') { + messageChannel.port1.addEventListener('message', onmessage); + messageChannel.port1.start(); + } + } + }); + processorConstructor.prototype.port = messageChannel.port1; + let audioWorkletProcessor = null; + const audioWorkletProcessorPromise = createAudioWorkletProcessor(nativeContext, nativeAudioWorkletNodeFaker, processorConstructor, options); + audioWorkletProcessorPromise.then((dWrkltPrcssr) => (audioWorkletProcessor = dWrkltPrcssr)); + const inputs = createNestedArrays(options.numberOfInputs, options.channelCount); + const outputs = createNestedArrays(options.numberOfOutputs, outputChannelCount); + const parameters = processorConstructor.parameterDescriptors === undefined + ? [] + : processorConstructor.parameterDescriptors.reduce((prmtrs, { name }) => ({ ...prmtrs, [name]: new Float32Array(128) }), {}); + let isActive = true; + const disconnectOutputsGraph = () => { + if (options.numberOfOutputs > 0) { + scriptProcessorNode.disconnect(outputChannelSplitterNode); + } + for (let i = 0, outputChannelSplitterNodeOutput = 0; i < options.numberOfOutputs; i += 1) { + const outputChannelMergerNode = outputChannelMergerNodes[i]; + for (let j = 0; j < outputChannelCount[i]; j += 1) { + outputChannelSplitterNode.disconnect(outputChannelMergerNode, outputChannelSplitterNodeOutput + j, j); + } + outputChannelSplitterNodeOutput += outputChannelCount[i]; + } + }; + const activeInputIndexes = new Map(); + // tslint:disable-next-line:deprecation + scriptProcessorNode.onaudioprocess = ({ inputBuffer, outputBuffer }) => { + if (audioWorkletProcessor !== null) { + const activeInputs = getActiveAudioWorkletNodeInputs(nativeAudioWorkletNodeFaker); + for (let i = 0; i < bufferSize; i += 128) { + for (let j = 0; j < options.numberOfInputs; j += 1) { + for (let k = 0; k < options.channelCount; k += 1) { + copyFromChannel(inputBuffer, inputs[j], k, k, i); + } + } + if (processorConstructor.parameterDescriptors !== undefined) { + processorConstructor.parameterDescriptors.forEach(({ name }, index) => { + copyFromChannel(inputBuffer, parameters, name, numberOfInputChannels + index, i); + }); + } + for (let j = 0; j < options.numberOfInputs; j += 1) { + for (let k = 0; k < outputChannelCount[j]; k += 1) { + // The byteLength will be 0 when the ArrayBuffer was transferred. + if (outputs[j][k].byteLength === 0) { + outputs[j][k] = new Float32Array(128); + } + } + } + try { + const potentiallyEmptyInputs = inputs.map((input, index) => { + const activeInput = activeInputs[index]; + if (activeInput.size > 0) { + activeInputIndexes.set(index, bufferSize / 128); + return input; + } + const count = activeInputIndexes.get(index); + if (count === undefined) { + return []; + } + if (input.every((channelData) => channelData.every((sample) => sample === 0))) { + if (count === 1) { + activeInputIndexes.delete(index); + } + else { + activeInputIndexes.set(index, count - 1); + } + } + return input; + }); + const activeSourceFlag = exposeCurrentFrameAndCurrentTime(nativeContext.currentTime + i / nativeContext.sampleRate, nativeContext.sampleRate, () => audioWorkletProcessor.process(potentiallyEmptyInputs, outputs, parameters)); + isActive = activeSourceFlag; + for (let j = 0, outputChannelSplitterNodeOutput = 0; j < options.numberOfOutputs; j += 1) { + for (let k = 0; k < outputChannelCount[j]; k += 1) { + copyToChannel(outputBuffer, outputs[j], k, outputChannelSplitterNodeOutput + k, i); + } + outputChannelSplitterNodeOutput += outputChannelCount[j]; + } + } + catch (error) { + isActive = false; + nativeAudioWorkletNodeFaker.dispatchEvent(new ErrorEvent('processorerror', { + colno: error.colno, + filename: error.filename, + lineno: error.lineno, + message: error.message + })); + } + if (!isActive) { + for (let j = 0; j < options.numberOfInputs; j += 1) { + gainNodes[j].disconnect(inputChannelSplitterNodes[j]); + for (let k = 0; k < options.channelCount; k += 1) { + inputChannelSplitterNodes[i].disconnect(inputChannelMergerNode, k, j * options.channelCount + k); + } + } + if (processorConstructor.parameterDescriptors !== undefined) { + const length = processorConstructor.parameterDescriptors.length; + for (let j = 0; j < length; j += 1) { + const constantSourceNode = constantSourceNodes[j]; + constantSourceNode.disconnect(inputChannelMergerNode, 0, numberOfInputChannels + j); + constantSourceNode.stop(); + } + } + inputChannelMergerNode.disconnect(scriptProcessorNode); + scriptProcessorNode.onaudioprocess = null; // tslint:disable-line:deprecation + if (isConnected) { + disconnectOutputsGraph(); + } + else { + disconnectFakeGraph(); + } + break; + } + } + } + }; + let isConnected = false; + // Bug #87: Only Firefox will fire an AudioProcessingEvent if there is no connected output. + const nativeGainNode = createNativeGainNode(nativeContext, { + channelCount: 1, + channelCountMode: 'explicit', + channelInterpretation: 'discrete', + gain: 0 + }); + const connectFakeGraph = () => scriptProcessorNode.connect(nativeGainNode).connect(nativeContext.destination); + const disconnectFakeGraph = () => { + scriptProcessorNode.disconnect(nativeGainNode); + nativeGainNode.disconnect(); + }; + const whenConnected = () => { + if (isActive) { + disconnectFakeGraph(); + if (options.numberOfOutputs > 0) { + scriptProcessorNode.connect(outputChannelSplitterNode); + } + for (let i = 0, outputChannelSplitterNodeOutput = 0; i < options.numberOfOutputs; i += 1) { + const outputChannelMergerNode = outputChannelMergerNodes[i]; + for (let j = 0; j < outputChannelCount[i]; j += 1) { + outputChannelSplitterNode.connect(outputChannelMergerNode, outputChannelSplitterNodeOutput + j, j); + } + outputChannelSplitterNodeOutput += outputChannelCount[i]; + } + } + isConnected = true; + }; + const whenDisconnected = () => { + if (isActive) { + connectFakeGraph(); + disconnectOutputsGraph(); + } + isConnected = false; + }; + connectFakeGraph(); + return monitorConnections(nativeAudioWorkletNodeFaker, whenConnected, whenDisconnected); + }; +}; + +const createNativeBiquadFilterNode = (nativeContext, options) => { + const nativeBiquadFilterNode = nativeContext.createBiquadFilter(); + assignNativeAudioNodeOptions(nativeBiquadFilterNode, options); + assignNativeAudioNodeAudioParamValue(nativeBiquadFilterNode, options, 'Q'); + assignNativeAudioNodeAudioParamValue(nativeBiquadFilterNode, options, 'detune'); + assignNativeAudioNodeAudioParamValue(nativeBiquadFilterNode, options, 'frequency'); + assignNativeAudioNodeAudioParamValue(nativeBiquadFilterNode, options, 'gain'); + assignNativeAudioNodeOption(nativeBiquadFilterNode, options, 'type'); + return nativeBiquadFilterNode; +}; + +const createNativeChannelMergerNodeFactory = (nativeAudioContextConstructor, wrapChannelMergerNode) => { + return (nativeContext, options) => { + const nativeChannelMergerNode = nativeContext.createChannelMerger(options.numberOfInputs); + /* + * Bug #20: Safari requires a connection of any kind to treat the input signal correctly. + * @todo Unfortunately there is no way to test for this behavior in a synchronous fashion which is why testing for the existence of + * the webkitAudioContext is used as a workaround here. + */ + if (nativeAudioContextConstructor !== null && nativeAudioContextConstructor.name === 'webkitAudioContext') { + wrapChannelMergerNode(nativeContext, nativeChannelMergerNode); + } + assignNativeAudioNodeOptions(nativeChannelMergerNode, options); + return nativeChannelMergerNode; + }; +}; + +const wrapChannelSplitterNode = (channelSplitterNode) => { + const channelCount = channelSplitterNode.numberOfOutputs; + // Bug #97: Safari does not throw an error when attempting to change the channelCount to something other than its initial value. + Object.defineProperty(channelSplitterNode, 'channelCount', { + get: () => channelCount, + set: (value) => { + if (value !== channelCount) { + throw createInvalidStateError(); + } + } + }); + // Bug #30: Safari does not throw an error when attempting to change the channelCountMode to something other than explicit. + Object.defineProperty(channelSplitterNode, 'channelCountMode', { + get: () => 'explicit', + set: (value) => { + if (value !== 'explicit') { + throw createInvalidStateError(); + } + } + }); + // Bug #32: Safari does not throw an error when attempting to change the channelInterpretation to something other than discrete. + Object.defineProperty(channelSplitterNode, 'channelInterpretation', { + get: () => 'discrete', + set: (value) => { + if (value !== 'discrete') { + throw createInvalidStateError(); + } + } + }); +}; + +const createNativeChannelSplitterNode = (nativeContext, options) => { + const nativeChannelSplitterNode = nativeContext.createChannelSplitter(options.numberOfOutputs); + // Bug #96: Safari does not have the correct channelCount. + // Bug #29: Safari does not have the correct channelCountMode. + // Bug #31: Safari does not have the correct channelInterpretation. + assignNativeAudioNodeOptions(nativeChannelSplitterNode, options); + // Bug #29, #30, #31, #32, #96 & #97: Only Chrome, Edge, Firefox & Opera partially support the spec yet. + wrapChannelSplitterNode(nativeChannelSplitterNode); + return nativeChannelSplitterNode; +}; + +const createNativeConstantSourceNodeFactory = (addSilentConnection, cacheTestResult, createNativeConstantSourceNodeFaker, testAudioScheduledSourceNodeStartMethodNegativeParametersSupport, testAudioScheduledSourceNodeStopMethodNegativeParametersSupport) => { + return (nativeContext, options) => { + // Bug #62: Safari does not support ConstantSourceNodes. + if (nativeContext.createConstantSource === undefined) { + return createNativeConstantSourceNodeFaker(nativeContext, options); + } + const nativeConstantSourceNode = nativeContext.createConstantSource(); + assignNativeAudioNodeOptions(nativeConstantSourceNode, options); + assignNativeAudioNodeAudioParamValue(nativeConstantSourceNode, options, 'offset'); + // Bug #44: Safari does not throw a RangeError yet. + if (!cacheTestResult(testAudioScheduledSourceNodeStartMethodNegativeParametersSupport, () => testAudioScheduledSourceNodeStartMethodNegativeParametersSupport(nativeContext))) { + wrapAudioScheduledSourceNodeStartMethodNegativeParameters(nativeConstantSourceNode); + } + // Bug #44: Only Firefox does not throw a RangeError yet. + if (!cacheTestResult(testAudioScheduledSourceNodeStopMethodNegativeParametersSupport, () => testAudioScheduledSourceNodeStopMethodNegativeParametersSupport(nativeContext))) { + wrapAudioScheduledSourceNodeStopMethodNegativeParameters(nativeConstantSourceNode); + } + // Bug #175: Safari will not fire an ended event if the ConstantSourceNode is unconnected. + addSilentConnection(nativeContext, nativeConstantSourceNode); + return nativeConstantSourceNode; + }; +}; + +const interceptConnections = (original, interceptor) => { + original.connect = interceptor.connect.bind(interceptor); + original.disconnect = interceptor.disconnect.bind(interceptor); + return original; +}; + +const createNativeConstantSourceNodeFakerFactory = (addSilentConnection, createNativeAudioBufferSourceNode, createNativeGainNode, monitorConnections) => { + return (nativeContext, { offset, ...audioNodeOptions }) => { + const audioBuffer = nativeContext.createBuffer(1, 2, 44100); + const audioBufferSourceNode = createNativeAudioBufferSourceNode(nativeContext, { + buffer: null, + channelCount: 2, + channelCountMode: 'max', + channelInterpretation: 'speakers', + loop: false, + loopEnd: 0, + loopStart: 0, + playbackRate: 1 + }); + const gainNode = createNativeGainNode(nativeContext, { ...audioNodeOptions, gain: offset }); + // Bug #5: Safari does not support copyFromChannel() and copyToChannel(). + const channelData = audioBuffer.getChannelData(0); + // Bug #95: Safari does not play or loop one sample buffers. + channelData[0] = 1; + channelData[1] = 1; + audioBufferSourceNode.buffer = audioBuffer; + audioBufferSourceNode.loop = true; + const nativeConstantSourceNodeFaker = { + get bufferSize() { + return undefined; + }, + get channelCount() { + return gainNode.channelCount; + }, + set channelCount(value) { + gainNode.channelCount = value; + }, + get channelCountMode() { + return gainNode.channelCountMode; + }, + set channelCountMode(value) { + gainNode.channelCountMode = value; + }, + get channelInterpretation() { + return gainNode.channelInterpretation; + }, + set channelInterpretation(value) { + gainNode.channelInterpretation = value; + }, + get context() { + return gainNode.context; + }, + get inputs() { + return []; + }, + get numberOfInputs() { + return audioBufferSourceNode.numberOfInputs; + }, + get numberOfOutputs() { + return gainNode.numberOfOutputs; + }, + get offset() { + return gainNode.gain; + }, + get onended() { + return audioBufferSourceNode.onended; + }, + set onended(value) { + audioBufferSourceNode.onended = value; + }, + addEventListener(...args) { + return audioBufferSourceNode.addEventListener(args[0], args[1], args[2]); + }, + dispatchEvent(...args) { + return audioBufferSourceNode.dispatchEvent(args[0]); + }, + removeEventListener(...args) { + return audioBufferSourceNode.removeEventListener(args[0], args[1], args[2]); + }, + start(when = 0) { + audioBufferSourceNode.start.call(audioBufferSourceNode, when); + }, + stop(when = 0) { + audioBufferSourceNode.stop.call(audioBufferSourceNode, when); + } + }; + const whenConnected = () => audioBufferSourceNode.connect(gainNode); + const whenDisconnected = () => audioBufferSourceNode.disconnect(gainNode); + // Bug #175: Safari will not fire an ended event if the AudioBufferSourceNode is unconnected. + addSilentConnection(nativeContext, audioBufferSourceNode); + return monitorConnections(interceptConnections(nativeConstantSourceNodeFaker, gainNode), whenConnected, whenDisconnected); + }; +}; + +const createNativeConvolverNodeFactory = (createNotSupportedError, overwriteAccessors) => { + return (nativeContext, options) => { + const nativeConvolverNode = nativeContext.createConvolver(); + assignNativeAudioNodeOptions(nativeConvolverNode, options); + // The normalize property needs to be set before setting the buffer. + if (options.disableNormalization === nativeConvolverNode.normalize) { + nativeConvolverNode.normalize = !options.disableNormalization; + } + assignNativeAudioNodeOption(nativeConvolverNode, options, 'buffer'); + // Bug #113: Safari does allow to set the channelCount to a value larger than 2. + if (options.channelCount > 2) { + throw createNotSupportedError(); + } + overwriteAccessors(nativeConvolverNode, 'channelCount', (get) => () => get.call(nativeConvolverNode), (set) => (value) => { + if (value > 2) { + throw createNotSupportedError(); + } + return set.call(nativeConvolverNode, value); + }); + // Bug #114: Safari allows to set the channelCountMode to 'max'. + if (options.channelCountMode === 'max') { + throw createNotSupportedError(); + } + overwriteAccessors(nativeConvolverNode, 'channelCountMode', (get) => () => get.call(nativeConvolverNode), (set) => (value) => { + if (value === 'max') { + throw createNotSupportedError(); + } + return set.call(nativeConvolverNode, value); + }); + return nativeConvolverNode; + }; +}; + +const createNativeDelayNode = (nativeContext, options) => { + const nativeDelayNode = nativeContext.createDelay(options.maxDelayTime); + assignNativeAudioNodeOptions(nativeDelayNode, options); + assignNativeAudioNodeAudioParamValue(nativeDelayNode, options, 'delayTime'); + return nativeDelayNode; +}; + +const createNativeDynamicsCompressorNodeFactory = (createNotSupportedError) => { + return (nativeContext, options) => { + const nativeDynamicsCompressorNode = nativeContext.createDynamicsCompressor(); + assignNativeAudioNodeOptions(nativeDynamicsCompressorNode, options); + // Bug #108: Safari allows a channelCount of three and above. + if (options.channelCount > 2) { + throw createNotSupportedError(); + } + // Bug #109: Only Chrome, Firefox and Opera disallow a channelCountMode of 'max'. + if (options.channelCountMode === 'max') { + throw createNotSupportedError(); + } + assignNativeAudioNodeAudioParamValue(nativeDynamicsCompressorNode, options, 'attack'); + assignNativeAudioNodeAudioParamValue(nativeDynamicsCompressorNode, options, 'knee'); + assignNativeAudioNodeAudioParamValue(nativeDynamicsCompressorNode, options, 'ratio'); + assignNativeAudioNodeAudioParamValue(nativeDynamicsCompressorNode, options, 'release'); + assignNativeAudioNodeAudioParamValue(nativeDynamicsCompressorNode, options, 'threshold'); + return nativeDynamicsCompressorNode; + }; +}; + +const createNativeGainNode = (nativeContext, options) => { + const nativeGainNode = nativeContext.createGain(); + assignNativeAudioNodeOptions(nativeGainNode, options); + assignNativeAudioNodeAudioParamValue(nativeGainNode, options, 'gain'); + return nativeGainNode; +}; + +const createNativeIIRFilterNodeFactory = (createNativeIIRFilterNodeFaker) => { + return (nativeContext, baseLatency, options) => { + // Bug #9: Safari does not support IIRFilterNodes. + if (nativeContext.createIIRFilter === undefined) { + return createNativeIIRFilterNodeFaker(nativeContext, baseLatency, options); + } + // @todo TypeScript defines the parameters of createIIRFilter() as arrays of numbers. + const nativeIIRFilterNode = nativeContext.createIIRFilter(options.feedforward, options.feedback); + assignNativeAudioNodeOptions(nativeIIRFilterNode, options); + return nativeIIRFilterNode; + }; +}; + +function divide(a, b) { + const denominator = b[0] * b[0] + b[1] * b[1]; + return [(a[0] * b[0] + a[1] * b[1]) / denominator, (a[1] * b[0] - a[0] * b[1]) / denominator]; +} +function multiply(a, b) { + return [a[0] * b[0] - a[1] * b[1], a[0] * b[1] + a[1] * b[0]]; +} +function evaluatePolynomial(coefficient, z) { + let result = [0, 0]; + for (let i = coefficient.length - 1; i >= 0; i -= 1) { + result = multiply(result, z); + result[0] += coefficient[i]; + } + return result; +} +const createNativeIIRFilterNodeFakerFactory = (createInvalidAccessError, createInvalidStateError, createNativeScriptProcessorNode, createNotSupportedError) => { + return (nativeContext, baseLatency, { channelCount, channelCountMode, channelInterpretation, feedback, feedforward }) => { + const bufferSize = computeBufferSize(baseLatency, nativeContext.sampleRate); + const convertedFeedback = feedback instanceof Float64Array ? feedback : new Float64Array(feedback); + const convertedFeedforward = feedforward instanceof Float64Array ? feedforward : new Float64Array(feedforward); + const feedbackLength = convertedFeedback.length; + const feedforwardLength = convertedFeedforward.length; + const minLength = Math.min(feedbackLength, feedforwardLength); + if (feedbackLength === 0 || feedbackLength > 20) { + throw createNotSupportedError(); + } + if (convertedFeedback[0] === 0) { + throw createInvalidStateError(); + } + if (feedforwardLength === 0 || feedforwardLength > 20) { + throw createNotSupportedError(); + } + if (convertedFeedforward[0] === 0) { + throw createInvalidStateError(); + } + if (convertedFeedback[0] !== 1) { + for (let i = 0; i < feedforwardLength; i += 1) { + convertedFeedforward[i] /= convertedFeedback[0]; + } + for (let i = 1; i < feedbackLength; i += 1) { + convertedFeedback[i] /= convertedFeedback[0]; + } + } + const scriptProcessorNode = createNativeScriptProcessorNode(nativeContext, bufferSize, channelCount, channelCount); + scriptProcessorNode.channelCount = channelCount; + scriptProcessorNode.channelCountMode = channelCountMode; + scriptProcessorNode.channelInterpretation = channelInterpretation; + const bufferLength = 32; + const bufferIndexes = []; + const xBuffers = []; + const yBuffers = []; + for (let i = 0; i < channelCount; i += 1) { + bufferIndexes.push(0); + const xBuffer = new Float32Array(bufferLength); + const yBuffer = new Float32Array(bufferLength); + xBuffer.fill(0); + yBuffer.fill(0); + xBuffers.push(xBuffer); + yBuffers.push(yBuffer); + } + // tslint:disable-next-line:deprecation + scriptProcessorNode.onaudioprocess = (event) => { + const inputBuffer = event.inputBuffer; + const outputBuffer = event.outputBuffer; + const numberOfChannels = inputBuffer.numberOfChannels; + for (let i = 0; i < numberOfChannels; i += 1) { + const input = inputBuffer.getChannelData(i); + const output = outputBuffer.getChannelData(i); + bufferIndexes[i] = filterBuffer(convertedFeedback, feedbackLength, convertedFeedforward, feedforwardLength, minLength, xBuffers[i], yBuffers[i], bufferIndexes[i], bufferLength, input, output); + } + }; + const nyquist = nativeContext.sampleRate / 2; + const nativeIIRFilterNodeFaker = { + get bufferSize() { + return bufferSize; + }, + get channelCount() { + return scriptProcessorNode.channelCount; + }, + set channelCount(value) { + scriptProcessorNode.channelCount = value; + }, + get channelCountMode() { + return scriptProcessorNode.channelCountMode; + }, + set channelCountMode(value) { + scriptProcessorNode.channelCountMode = value; + }, + get channelInterpretation() { + return scriptProcessorNode.channelInterpretation; + }, + set channelInterpretation(value) { + scriptProcessorNode.channelInterpretation = value; + }, + get context() { + return scriptProcessorNode.context; + }, + get inputs() { + return [scriptProcessorNode]; + }, + get numberOfInputs() { + return scriptProcessorNode.numberOfInputs; + }, + get numberOfOutputs() { + return scriptProcessorNode.numberOfOutputs; + }, + addEventListener(...args) { + // @todo Dissallow adding an audioprocess listener. + return scriptProcessorNode.addEventListener(args[0], args[1], args[2]); + }, + dispatchEvent(...args) { + return scriptProcessorNode.dispatchEvent(args[0]); + }, + getFrequencyResponse(frequencyHz, magResponse, phaseResponse) { + if (frequencyHz.length !== magResponse.length || magResponse.length !== phaseResponse.length) { + throw createInvalidAccessError(); + } + const length = frequencyHz.length; + for (let i = 0; i < length; i += 1) { + const omega = -Math.PI * (frequencyHz[i] / nyquist); + const z = [Math.cos(omega), Math.sin(omega)]; + const numerator = evaluatePolynomial(convertedFeedforward, z); + const denominator = evaluatePolynomial(convertedFeedback, z); + const response = divide(numerator, denominator); + magResponse[i] = Math.sqrt(response[0] * response[0] + response[1] * response[1]); + phaseResponse[i] = Math.atan2(response[1], response[0]); + } + }, + removeEventListener(...args) { + return scriptProcessorNode.removeEventListener(args[0], args[1], args[2]); + } + }; + return interceptConnections(nativeIIRFilterNodeFaker, scriptProcessorNode); + }; +}; + +const createNativeMediaElementAudioSourceNode = (nativeAudioContext, options) => { + return nativeAudioContext.createMediaElementSource(options.mediaElement); +}; + +const createNativeMediaStreamAudioDestinationNode = (nativeAudioContext, options) => { + const nativeMediaStreamAudioDestinationNode = nativeAudioContext.createMediaStreamDestination(); + assignNativeAudioNodeOptions(nativeMediaStreamAudioDestinationNode, options); + // Bug #174: Safari does expose a wrong numberOfOutputs. + if (nativeMediaStreamAudioDestinationNode.numberOfOutputs === 1) { + Object.defineProperty(nativeMediaStreamAudioDestinationNode, 'numberOfOutputs', { get: () => 0 }); + } + return nativeMediaStreamAudioDestinationNode; +}; + +const createNativeMediaStreamAudioSourceNode = (nativeAudioContext, { mediaStream }) => { + const audioStreamTracks = mediaStream.getAudioTracks(); + /* + * Bug #151: Safari does not use the audio track as input anymore if it gets removed from the mediaStream after construction. + * Bug #159: Safari picks the first audio track if the MediaStream has more than one audio track. + */ + audioStreamTracks.sort((a, b) => (a.id < b.id ? -1 : a.id > b.id ? 1 : 0)); + const filteredAudioStreamTracks = audioStreamTracks.slice(0, 1); + const nativeMediaStreamAudioSourceNode = nativeAudioContext.createMediaStreamSource(new MediaStream(filteredAudioStreamTracks)); + /* + * Bug #151 & #159: The given mediaStream gets reconstructed before it gets passed to the native node which is why the accessor needs + * to be overwritten as it would otherwise expose the reconstructed version. + */ + Object.defineProperty(nativeMediaStreamAudioSourceNode, 'mediaStream', { value: mediaStream }); + return nativeMediaStreamAudioSourceNode; +}; + +const createNativeMediaStreamTrackAudioSourceNodeFactory = (createInvalidStateError, isNativeOfflineAudioContext) => { + return (nativeAudioContext, { mediaStreamTrack }) => { + // Bug #121: Only Firefox does yet support the MediaStreamTrackAudioSourceNode. + if (typeof nativeAudioContext.createMediaStreamTrackSource === 'function') { + return nativeAudioContext.createMediaStreamTrackSource(mediaStreamTrack); + } + const mediaStream = new MediaStream([mediaStreamTrack]); + const nativeMediaStreamAudioSourceNode = nativeAudioContext.createMediaStreamSource(mediaStream); + // Bug #120: Firefox does not throw an error if the mediaStream has no audio track. + if (mediaStreamTrack.kind !== 'audio') { + throw createInvalidStateError(); + } + // Bug #172: Safari allows to create a MediaStreamAudioSourceNode with an OfflineAudioContext. + if (isNativeOfflineAudioContext(nativeAudioContext)) { + throw new TypeError(); + } + return nativeMediaStreamAudioSourceNode; + }; +}; + +const createNativeOfflineAudioContextConstructor = (window) => { + if (window === null) { + return null; + } + if (window.hasOwnProperty('OfflineAudioContext')) { + return window.OfflineAudioContext; + } + return window.hasOwnProperty('webkitOfflineAudioContext') ? window.webkitOfflineAudioContext : null; +}; + +const createNativeOscillatorNodeFactory = (addSilentConnection, cacheTestResult, testAudioScheduledSourceNodeStartMethodNegativeParametersSupport, testAudioScheduledSourceNodeStopMethodConsecutiveCallsSupport, testAudioScheduledSourceNodeStopMethodNegativeParametersSupport, wrapAudioScheduledSourceNodeStopMethodConsecutiveCalls) => { + return (nativeContext, options) => { + const nativeOscillatorNode = nativeContext.createOscillator(); + assignNativeAudioNodeOptions(nativeOscillatorNode, options); + assignNativeAudioNodeAudioParamValue(nativeOscillatorNode, options, 'detune'); + assignNativeAudioNodeAudioParamValue(nativeOscillatorNode, options, 'frequency'); + if (options.periodicWave !== undefined) { + nativeOscillatorNode.setPeriodicWave(options.periodicWave); + } + else { + assignNativeAudioNodeOption(nativeOscillatorNode, options, 'type'); + } + // Bug #44: Only Chrome, Edge & Opera throw a RangeError yet. + if (!cacheTestResult(testAudioScheduledSourceNodeStartMethodNegativeParametersSupport, () => testAudioScheduledSourceNodeStartMethodNegativeParametersSupport(nativeContext))) { + wrapAudioScheduledSourceNodeStartMethodNegativeParameters(nativeOscillatorNode); + } + // Bug #19: Safari does not ignore calls to stop() of an already stopped AudioBufferSourceNode. + if (!cacheTestResult(testAudioScheduledSourceNodeStopMethodConsecutiveCallsSupport, () => testAudioScheduledSourceNodeStopMethodConsecutiveCallsSupport(nativeContext))) { + wrapAudioScheduledSourceNodeStopMethodConsecutiveCalls(nativeOscillatorNode, nativeContext); + } + // Bug #44: Only Firefox does not throw a RangeError yet. + if (!cacheTestResult(testAudioScheduledSourceNodeStopMethodNegativeParametersSupport, () => testAudioScheduledSourceNodeStopMethodNegativeParametersSupport(nativeContext))) { + wrapAudioScheduledSourceNodeStopMethodNegativeParameters(nativeOscillatorNode); + } + // Bug #175: Safari will not fire an ended event if the OscillatorNode is unconnected. + addSilentConnection(nativeContext, nativeOscillatorNode); + return nativeOscillatorNode; + }; +}; + +const createNativePannerNodeFactory = (createNativePannerNodeFaker) => { + return (nativeContext, options) => { + const nativePannerNode = nativeContext.createPanner(); + // Bug #124: Safari does not support modifying the orientation and the position with AudioParams. + if (nativePannerNode.orientationX === undefined) { + return createNativePannerNodeFaker(nativeContext, options); + } + assignNativeAudioNodeOptions(nativePannerNode, options); + assignNativeAudioNodeAudioParamValue(nativePannerNode, options, 'orientationX'); + assignNativeAudioNodeAudioParamValue(nativePannerNode, options, 'orientationY'); + assignNativeAudioNodeAudioParamValue(nativePannerNode, options, 'orientationZ'); + assignNativeAudioNodeAudioParamValue(nativePannerNode, options, 'positionX'); + assignNativeAudioNodeAudioParamValue(nativePannerNode, options, 'positionY'); + assignNativeAudioNodeAudioParamValue(nativePannerNode, options, 'positionZ'); + assignNativeAudioNodeOption(nativePannerNode, options, 'coneInnerAngle'); + assignNativeAudioNodeOption(nativePannerNode, options, 'coneOuterAngle'); + assignNativeAudioNodeOption(nativePannerNode, options, 'coneOuterGain'); + assignNativeAudioNodeOption(nativePannerNode, options, 'distanceModel'); + assignNativeAudioNodeOption(nativePannerNode, options, 'maxDistance'); + assignNativeAudioNodeOption(nativePannerNode, options, 'panningModel'); + assignNativeAudioNodeOption(nativePannerNode, options, 'refDistance'); + assignNativeAudioNodeOption(nativePannerNode, options, 'rolloffFactor'); + return nativePannerNode; + }; +}; + +const createNativePannerNodeFakerFactory = (connectNativeAudioNodeToNativeAudioNode, createInvalidStateError, createNativeChannelMergerNode, createNativeGainNode, createNativeScriptProcessorNode, createNativeWaveShaperNode, createNotSupportedError, disconnectNativeAudioNodeFromNativeAudioNode, getFirstSample, monitorConnections) => { + return (nativeContext, { coneInnerAngle, coneOuterAngle, coneOuterGain, distanceModel, maxDistance, orientationX, orientationY, orientationZ, panningModel, positionX, positionY, positionZ, refDistance, rolloffFactor, ...audioNodeOptions }) => { + const pannerNode = nativeContext.createPanner(); + // Bug #125: Safari does not throw an error yet. + if (audioNodeOptions.channelCount > 2) { + throw createNotSupportedError(); + } + // Bug #126: Safari does not throw an error yet. + if (audioNodeOptions.channelCountMode === 'max') { + throw createNotSupportedError(); + } + assignNativeAudioNodeOptions(pannerNode, audioNodeOptions); + const SINGLE_CHANNEL_OPTIONS = { + channelCount: 1, + channelCountMode: 'explicit', + channelInterpretation: 'discrete' + }; + const channelMergerNode = createNativeChannelMergerNode(nativeContext, { + ...SINGLE_CHANNEL_OPTIONS, + channelInterpretation: 'speakers', + numberOfInputs: 6 + }); + const inputGainNode = createNativeGainNode(nativeContext, { ...audioNodeOptions, gain: 1 }); + const orientationXGainNode = createNativeGainNode(nativeContext, { ...SINGLE_CHANNEL_OPTIONS, gain: 1 }); + const orientationYGainNode = createNativeGainNode(nativeContext, { ...SINGLE_CHANNEL_OPTIONS, gain: 0 }); + const orientationZGainNode = createNativeGainNode(nativeContext, { ...SINGLE_CHANNEL_OPTIONS, gain: 0 }); + const positionXGainNode = createNativeGainNode(nativeContext, { ...SINGLE_CHANNEL_OPTIONS, gain: 0 }); + const positionYGainNode = createNativeGainNode(nativeContext, { ...SINGLE_CHANNEL_OPTIONS, gain: 0 }); + const positionZGainNode = createNativeGainNode(nativeContext, { ...SINGLE_CHANNEL_OPTIONS, gain: 0 }); + const scriptProcessorNode = createNativeScriptProcessorNode(nativeContext, 256, 6, 1); + const waveShaperNode = createNativeWaveShaperNode(nativeContext, { + ...SINGLE_CHANNEL_OPTIONS, + curve: new Float32Array([1, 1]), + oversample: 'none' + }); + let lastOrientation = [orientationX, orientationY, orientationZ]; + let lastPosition = [positionX, positionY, positionZ]; + const buffer = new Float32Array(1); + // tslint:disable-next-line:deprecation + scriptProcessorNode.onaudioprocess = ({ inputBuffer }) => { + const orientation = [ + getFirstSample(inputBuffer, buffer, 0), + getFirstSample(inputBuffer, buffer, 1), + getFirstSample(inputBuffer, buffer, 2) + ]; + if (orientation.some((value, index) => value !== lastOrientation[index])) { + pannerNode.setOrientation(...orientation); // tslint:disable-line:deprecation + lastOrientation = orientation; + } + const positon = [ + getFirstSample(inputBuffer, buffer, 3), + getFirstSample(inputBuffer, buffer, 4), + getFirstSample(inputBuffer, buffer, 5) + ]; + if (positon.some((value, index) => value !== lastPosition[index])) { + pannerNode.setPosition(...positon); // tslint:disable-line:deprecation + lastPosition = positon; + } + }; + Object.defineProperty(orientationYGainNode.gain, 'defaultValue', { get: () => 0 }); + Object.defineProperty(orientationZGainNode.gain, 'defaultValue', { get: () => 0 }); + Object.defineProperty(positionXGainNode.gain, 'defaultValue', { get: () => 0 }); + Object.defineProperty(positionYGainNode.gain, 'defaultValue', { get: () => 0 }); + Object.defineProperty(positionZGainNode.gain, 'defaultValue', { get: () => 0 }); + const nativePannerNodeFaker = { + get bufferSize() { + return undefined; + }, + get channelCount() { + return pannerNode.channelCount; + }, + set channelCount(value) { + // Bug #125: Safari does not throw an error yet. + if (value > 2) { + throw createNotSupportedError(); + } + inputGainNode.channelCount = value; + pannerNode.channelCount = value; + }, + get channelCountMode() { + return pannerNode.channelCountMode; + }, + set channelCountMode(value) { + // Bug #126: Safari does not throw an error yet. + if (value === 'max') { + throw createNotSupportedError(); + } + inputGainNode.channelCountMode = value; + pannerNode.channelCountMode = value; + }, + get channelInterpretation() { + return pannerNode.channelInterpretation; + }, + set channelInterpretation(value) { + inputGainNode.channelInterpretation = value; + pannerNode.channelInterpretation = value; + }, + get coneInnerAngle() { + return pannerNode.coneInnerAngle; + }, + set coneInnerAngle(value) { + pannerNode.coneInnerAngle = value; + }, + get coneOuterAngle() { + return pannerNode.coneOuterAngle; + }, + set coneOuterAngle(value) { + pannerNode.coneOuterAngle = value; + }, + get coneOuterGain() { + return pannerNode.coneOuterGain; + }, + set coneOuterGain(value) { + // Bug #127: Safari does not throw an InvalidStateError yet. + if (value < 0 || value > 1) { + throw createInvalidStateError(); + } + pannerNode.coneOuterGain = value; + }, + get context() { + return pannerNode.context; + }, + get distanceModel() { + return pannerNode.distanceModel; + }, + set distanceModel(value) { + pannerNode.distanceModel = value; + }, + get inputs() { + return [inputGainNode]; + }, + get maxDistance() { + return pannerNode.maxDistance; + }, + set maxDistance(value) { + // Bug #128: Safari does not throw an error yet. + if (value < 0) { + throw new RangeError(); + } + pannerNode.maxDistance = value; + }, + get numberOfInputs() { + return pannerNode.numberOfInputs; + }, + get numberOfOutputs() { + return pannerNode.numberOfOutputs; + }, + get orientationX() { + return orientationXGainNode.gain; + }, + get orientationY() { + return orientationYGainNode.gain; + }, + get orientationZ() { + return orientationZGainNode.gain; + }, + get panningModel() { + return pannerNode.panningModel; + }, + set panningModel(value) { + pannerNode.panningModel = value; + }, + get positionX() { + return positionXGainNode.gain; + }, + get positionY() { + return positionYGainNode.gain; + }, + get positionZ() { + return positionZGainNode.gain; + }, + get refDistance() { + return pannerNode.refDistance; + }, + set refDistance(value) { + // Bug #129: Safari does not throw an error yet. + if (value < 0) { + throw new RangeError(); + } + pannerNode.refDistance = value; + }, + get rolloffFactor() { + return pannerNode.rolloffFactor; + }, + set rolloffFactor(value) { + // Bug #130: Safari does not throw an error yet. + if (value < 0) { + throw new RangeError(); + } + pannerNode.rolloffFactor = value; + }, + addEventListener(...args) { + return inputGainNode.addEventListener(args[0], args[1], args[2]); + }, + dispatchEvent(...args) { + return inputGainNode.dispatchEvent(args[0]); + }, + removeEventListener(...args) { + return inputGainNode.removeEventListener(args[0], args[1], args[2]); + } + }; + if (coneInnerAngle !== nativePannerNodeFaker.coneInnerAngle) { + nativePannerNodeFaker.coneInnerAngle = coneInnerAngle; + } + if (coneOuterAngle !== nativePannerNodeFaker.coneOuterAngle) { + nativePannerNodeFaker.coneOuterAngle = coneOuterAngle; + } + if (coneOuterGain !== nativePannerNodeFaker.coneOuterGain) { + nativePannerNodeFaker.coneOuterGain = coneOuterGain; + } + if (distanceModel !== nativePannerNodeFaker.distanceModel) { + nativePannerNodeFaker.distanceModel = distanceModel; + } + if (maxDistance !== nativePannerNodeFaker.maxDistance) { + nativePannerNodeFaker.maxDistance = maxDistance; + } + if (orientationX !== nativePannerNodeFaker.orientationX.value) { + nativePannerNodeFaker.orientationX.value = orientationX; + } + if (orientationY !== nativePannerNodeFaker.orientationY.value) { + nativePannerNodeFaker.orientationY.value = orientationY; + } + if (orientationZ !== nativePannerNodeFaker.orientationZ.value) { + nativePannerNodeFaker.orientationZ.value = orientationZ; + } + if (panningModel !== nativePannerNodeFaker.panningModel) { + nativePannerNodeFaker.panningModel = panningModel; + } + if (positionX !== nativePannerNodeFaker.positionX.value) { + nativePannerNodeFaker.positionX.value = positionX; + } + if (positionY !== nativePannerNodeFaker.positionY.value) { + nativePannerNodeFaker.positionY.value = positionY; + } + if (positionZ !== nativePannerNodeFaker.positionZ.value) { + nativePannerNodeFaker.positionZ.value = positionZ; + } + if (refDistance !== nativePannerNodeFaker.refDistance) { + nativePannerNodeFaker.refDistance = refDistance; + } + if (rolloffFactor !== nativePannerNodeFaker.rolloffFactor) { + nativePannerNodeFaker.rolloffFactor = rolloffFactor; + } + if (lastOrientation[0] !== 1 || lastOrientation[1] !== 0 || lastOrientation[2] !== 0) { + pannerNode.setOrientation(...lastOrientation); // tslint:disable-line:deprecation + } + if (lastPosition[0] !== 0 || lastPosition[1] !== 0 || lastPosition[2] !== 0) { + pannerNode.setPosition(...lastPosition); // tslint:disable-line:deprecation + } + const whenConnected = () => { + inputGainNode.connect(pannerNode); + // Bug #119: Safari does not fully support the WaveShaperNode. + connectNativeAudioNodeToNativeAudioNode(inputGainNode, waveShaperNode, 0, 0); + waveShaperNode.connect(orientationXGainNode).connect(channelMergerNode, 0, 0); + waveShaperNode.connect(orientationYGainNode).connect(channelMergerNode, 0, 1); + waveShaperNode.connect(orientationZGainNode).connect(channelMergerNode, 0, 2); + waveShaperNode.connect(positionXGainNode).connect(channelMergerNode, 0, 3); + waveShaperNode.connect(positionYGainNode).connect(channelMergerNode, 0, 4); + waveShaperNode.connect(positionZGainNode).connect(channelMergerNode, 0, 5); + channelMergerNode.connect(scriptProcessorNode).connect(nativeContext.destination); + }; + const whenDisconnected = () => { + inputGainNode.disconnect(pannerNode); + // Bug #119: Safari does not fully support the WaveShaperNode. + disconnectNativeAudioNodeFromNativeAudioNode(inputGainNode, waveShaperNode, 0, 0); + waveShaperNode.disconnect(orientationXGainNode); + orientationXGainNode.disconnect(channelMergerNode); + waveShaperNode.disconnect(orientationYGainNode); + orientationYGainNode.disconnect(channelMergerNode); + waveShaperNode.disconnect(orientationZGainNode); + orientationZGainNode.disconnect(channelMergerNode); + waveShaperNode.disconnect(positionXGainNode); + positionXGainNode.disconnect(channelMergerNode); + waveShaperNode.disconnect(positionYGainNode); + positionYGainNode.disconnect(channelMergerNode); + waveShaperNode.disconnect(positionZGainNode); + positionZGainNode.disconnect(channelMergerNode); + channelMergerNode.disconnect(scriptProcessorNode); + scriptProcessorNode.disconnect(nativeContext.destination); + }; + return monitorConnections(interceptConnections(nativePannerNodeFaker, pannerNode), whenConnected, whenDisconnected); + }; +}; + +const createNativePeriodicWaveFactory = (createIndexSizeError) => { + return (nativeContext, { disableNormalization, imag, real }) => { + // Bug #180: Safari does not allow to use ordinary arrays. + const convertedImag = imag instanceof Float32Array ? imag : new Float32Array(imag); + const convertedReal = real instanceof Float32Array ? real : new Float32Array(real); + const nativePeriodicWave = nativeContext.createPeriodicWave(convertedReal, convertedImag, { disableNormalization }); + // Bug #181: Safari does not throw an IndexSizeError so far if the given arrays have less than two values. + if (Array.from(imag).length < 2) { + throw createIndexSizeError(); + } + return nativePeriodicWave; + }; +}; + +const createNativeScriptProcessorNode = (nativeContext, bufferSize, numberOfInputChannels, numberOfOutputChannels) => { + return nativeContext.createScriptProcessor(bufferSize, numberOfInputChannels, numberOfOutputChannels); // tslint:disable-line deprecation +}; + +const createNativeStereoPannerNodeFactory = (createNativeStereoPannerNodeFaker, createNotSupportedError) => { + return (nativeContext, options) => { + const channelCountMode = options.channelCountMode; + /* + * Bug #105: The channelCountMode of 'clamped-max' should be supported. However it is not possible to write a polyfill for Safari + * which supports it and therefore it can't be supported at all. + */ + if (channelCountMode === 'clamped-max') { + throw createNotSupportedError(); + } + // Bug #105: Safari does not support the StereoPannerNode. + if (nativeContext.createStereoPanner === undefined) { + return createNativeStereoPannerNodeFaker(nativeContext, options); + } + const nativeStereoPannerNode = nativeContext.createStereoPanner(); + assignNativeAudioNodeOptions(nativeStereoPannerNode, options); + assignNativeAudioNodeAudioParamValue(nativeStereoPannerNode, options, 'pan'); + /* + * Bug #105: The channelCountMode of 'clamped-max' should be supported. However it is not possible to write a polyfill for Safari + * which supports it and therefore it can't be supported at all. + */ + Object.defineProperty(nativeStereoPannerNode, 'channelCountMode', { + get: () => channelCountMode, + set: (value) => { + if (value !== channelCountMode) { + throw createNotSupportedError(); + } + } + }); + return nativeStereoPannerNode; + }; +}; + +const createNativeStereoPannerNodeFakerFactory = (createNativeChannelMergerNode, createNativeChannelSplitterNode, createNativeGainNode, createNativeWaveShaperNode, createNotSupportedError, monitorConnections) => { + // The curve has a size of 14bit plus 1 value to have an exact representation for zero. This value has been determined experimentally. + const CURVE_SIZE = 16385; + const DC_CURVE = new Float32Array([1, 1]); + const HALF_PI = Math.PI / 2; + const SINGLE_CHANNEL_OPTIONS = { channelCount: 1, channelCountMode: 'explicit', channelInterpretation: 'discrete' }; + const SINGLE_CHANNEL_WAVE_SHAPER_OPTIONS = { ...SINGLE_CHANNEL_OPTIONS, oversample: 'none' }; + const buildInternalGraphForMono = (nativeContext, inputGainNode, panGainNode, channelMergerNode) => { + const leftWaveShaperCurve = new Float32Array(CURVE_SIZE); + const rightWaveShaperCurve = new Float32Array(CURVE_SIZE); + for (let i = 0; i < CURVE_SIZE; i += 1) { + const x = (i / (CURVE_SIZE - 1)) * HALF_PI; + leftWaveShaperCurve[i] = Math.cos(x); + rightWaveShaperCurve[i] = Math.sin(x); + } + const leftGainNode = createNativeGainNode(nativeContext, { ...SINGLE_CHANNEL_OPTIONS, gain: 0 }); + // Bug #119: Safari does not fully support the WaveShaperNode. + const leftWaveShaperNode = (createNativeWaveShaperNode(nativeContext, { ...SINGLE_CHANNEL_WAVE_SHAPER_OPTIONS, curve: leftWaveShaperCurve })); + // Bug #119: Safari does not fully support the WaveShaperNode. + const panWaveShaperNode = (createNativeWaveShaperNode(nativeContext, { ...SINGLE_CHANNEL_WAVE_SHAPER_OPTIONS, curve: DC_CURVE })); + const rightGainNode = createNativeGainNode(nativeContext, { ...SINGLE_CHANNEL_OPTIONS, gain: 0 }); + // Bug #119: Safari does not fully support the WaveShaperNode. + const rightWaveShaperNode = (createNativeWaveShaperNode(nativeContext, { ...SINGLE_CHANNEL_WAVE_SHAPER_OPTIONS, curve: rightWaveShaperCurve })); + return { + connectGraph() { + inputGainNode.connect(leftGainNode); + inputGainNode.connect(panWaveShaperNode.inputs === undefined ? panWaveShaperNode : panWaveShaperNode.inputs[0]); + inputGainNode.connect(rightGainNode); + panWaveShaperNode.connect(panGainNode); + panGainNode.connect(leftWaveShaperNode.inputs === undefined ? leftWaveShaperNode : leftWaveShaperNode.inputs[0]); + panGainNode.connect(rightWaveShaperNode.inputs === undefined ? rightWaveShaperNode : rightWaveShaperNode.inputs[0]); + leftWaveShaperNode.connect(leftGainNode.gain); + rightWaveShaperNode.connect(rightGainNode.gain); + leftGainNode.connect(channelMergerNode, 0, 0); + rightGainNode.connect(channelMergerNode, 0, 1); + }, + disconnectGraph() { + inputGainNode.disconnect(leftGainNode); + inputGainNode.disconnect(panWaveShaperNode.inputs === undefined ? panWaveShaperNode : panWaveShaperNode.inputs[0]); + inputGainNode.disconnect(rightGainNode); + panWaveShaperNode.disconnect(panGainNode); + panGainNode.disconnect(leftWaveShaperNode.inputs === undefined ? leftWaveShaperNode : leftWaveShaperNode.inputs[0]); + panGainNode.disconnect(rightWaveShaperNode.inputs === undefined ? rightWaveShaperNode : rightWaveShaperNode.inputs[0]); + leftWaveShaperNode.disconnect(leftGainNode.gain); + rightWaveShaperNode.disconnect(rightGainNode.gain); + leftGainNode.disconnect(channelMergerNode, 0, 0); + rightGainNode.disconnect(channelMergerNode, 0, 1); + } + }; + }; + const buildInternalGraphForStereo = (nativeContext, inputGainNode, panGainNode, channelMergerNode) => { + const leftInputForLeftOutputWaveShaperCurve = new Float32Array(CURVE_SIZE); + const leftInputForRightOutputWaveShaperCurve = new Float32Array(CURVE_SIZE); + const rightInputForLeftOutputWaveShaperCurve = new Float32Array(CURVE_SIZE); + const rightInputForRightOutputWaveShaperCurve = new Float32Array(CURVE_SIZE); + const centerIndex = Math.floor(CURVE_SIZE / 2); + for (let i = 0; i < CURVE_SIZE; i += 1) { + if (i > centerIndex) { + const x = ((i - centerIndex) / (CURVE_SIZE - 1 - centerIndex)) * HALF_PI; + leftInputForLeftOutputWaveShaperCurve[i] = Math.cos(x); + leftInputForRightOutputWaveShaperCurve[i] = Math.sin(x); + rightInputForLeftOutputWaveShaperCurve[i] = 0; + rightInputForRightOutputWaveShaperCurve[i] = 1; + } + else { + const x = (i / (CURVE_SIZE - 1 - centerIndex)) * HALF_PI; + leftInputForLeftOutputWaveShaperCurve[i] = 1; + leftInputForRightOutputWaveShaperCurve[i] = 0; + rightInputForLeftOutputWaveShaperCurve[i] = Math.cos(x); + rightInputForRightOutputWaveShaperCurve[i] = Math.sin(x); + } + } + const channelSplitterNode = createNativeChannelSplitterNode(nativeContext, { + channelCount: 2, + channelCountMode: 'explicit', + channelInterpretation: 'discrete', + numberOfOutputs: 2 + }); + const leftInputForLeftOutputGainNode = createNativeGainNode(nativeContext, { ...SINGLE_CHANNEL_OPTIONS, gain: 0 }); + // Bug #119: Safari does not fully support the WaveShaperNode. + const leftInputForLeftOutputWaveShaperNode = createNativeWaveShaperNode(nativeContext, { + ...SINGLE_CHANNEL_WAVE_SHAPER_OPTIONS, + curve: leftInputForLeftOutputWaveShaperCurve + }); + const leftInputForRightOutputGainNode = createNativeGainNode(nativeContext, { ...SINGLE_CHANNEL_OPTIONS, gain: 0 }); + // Bug #119: Safari does not fully support the WaveShaperNode. + const leftInputForRightOutputWaveShaperNode = createNativeWaveShaperNode(nativeContext, { + ...SINGLE_CHANNEL_WAVE_SHAPER_OPTIONS, + curve: leftInputForRightOutputWaveShaperCurve + }); + // Bug #119: Safari does not fully support the WaveShaperNode. + const panWaveShaperNode = (createNativeWaveShaperNode(nativeContext, { ...SINGLE_CHANNEL_WAVE_SHAPER_OPTIONS, curve: DC_CURVE })); + const rightInputForLeftOutputGainNode = createNativeGainNode(nativeContext, { ...SINGLE_CHANNEL_OPTIONS, gain: 0 }); + // Bug #119: Safari does not fully support the WaveShaperNode. + const rightInputForLeftOutputWaveShaperNode = createNativeWaveShaperNode(nativeContext, { + ...SINGLE_CHANNEL_WAVE_SHAPER_OPTIONS, + curve: rightInputForLeftOutputWaveShaperCurve + }); + const rightInputForRightOutputGainNode = createNativeGainNode(nativeContext, { ...SINGLE_CHANNEL_OPTIONS, gain: 0 }); + // Bug #119: Safari does not fully support the WaveShaperNode. + const rightInputForRightOutputWaveShaperNode = createNativeWaveShaperNode(nativeContext, { + ...SINGLE_CHANNEL_WAVE_SHAPER_OPTIONS, + curve: rightInputForRightOutputWaveShaperCurve + }); + return { + connectGraph() { + inputGainNode.connect(channelSplitterNode); + inputGainNode.connect(panWaveShaperNode.inputs === undefined ? panWaveShaperNode : panWaveShaperNode.inputs[0]); + channelSplitterNode.connect(leftInputForLeftOutputGainNode, 0); + channelSplitterNode.connect(leftInputForRightOutputGainNode, 0); + channelSplitterNode.connect(rightInputForLeftOutputGainNode, 1); + channelSplitterNode.connect(rightInputForRightOutputGainNode, 1); + panWaveShaperNode.connect(panGainNode); + panGainNode.connect(leftInputForLeftOutputWaveShaperNode.inputs === undefined + ? leftInputForLeftOutputWaveShaperNode + : leftInputForLeftOutputWaveShaperNode.inputs[0]); + panGainNode.connect(leftInputForRightOutputWaveShaperNode.inputs === undefined + ? leftInputForRightOutputWaveShaperNode + : leftInputForRightOutputWaveShaperNode.inputs[0]); + panGainNode.connect(rightInputForLeftOutputWaveShaperNode.inputs === undefined + ? rightInputForLeftOutputWaveShaperNode + : rightInputForLeftOutputWaveShaperNode.inputs[0]); + panGainNode.connect(rightInputForRightOutputWaveShaperNode.inputs === undefined + ? rightInputForRightOutputWaveShaperNode + : rightInputForRightOutputWaveShaperNode.inputs[0]); + leftInputForLeftOutputWaveShaperNode.connect(leftInputForLeftOutputGainNode.gain); + leftInputForRightOutputWaveShaperNode.connect(leftInputForRightOutputGainNode.gain); + rightInputForLeftOutputWaveShaperNode.connect(rightInputForLeftOutputGainNode.gain); + rightInputForRightOutputWaveShaperNode.connect(rightInputForRightOutputGainNode.gain); + leftInputForLeftOutputGainNode.connect(channelMergerNode, 0, 0); + rightInputForLeftOutputGainNode.connect(channelMergerNode, 0, 0); + leftInputForRightOutputGainNode.connect(channelMergerNode, 0, 1); + rightInputForRightOutputGainNode.connect(channelMergerNode, 0, 1); + }, + disconnectGraph() { + inputGainNode.disconnect(channelSplitterNode); + inputGainNode.disconnect(panWaveShaperNode.inputs === undefined ? panWaveShaperNode : panWaveShaperNode.inputs[0]); + channelSplitterNode.disconnect(leftInputForLeftOutputGainNode, 0); + channelSplitterNode.disconnect(leftInputForRightOutputGainNode, 0); + channelSplitterNode.disconnect(rightInputForLeftOutputGainNode, 1); + channelSplitterNode.disconnect(rightInputForRightOutputGainNode, 1); + panWaveShaperNode.disconnect(panGainNode); + panGainNode.disconnect(leftInputForLeftOutputWaveShaperNode.inputs === undefined + ? leftInputForLeftOutputWaveShaperNode + : leftInputForLeftOutputWaveShaperNode.inputs[0]); + panGainNode.disconnect(leftInputForRightOutputWaveShaperNode.inputs === undefined + ? leftInputForRightOutputWaveShaperNode + : leftInputForRightOutputWaveShaperNode.inputs[0]); + panGainNode.disconnect(rightInputForLeftOutputWaveShaperNode.inputs === undefined + ? rightInputForLeftOutputWaveShaperNode + : rightInputForLeftOutputWaveShaperNode.inputs[0]); + panGainNode.disconnect(rightInputForRightOutputWaveShaperNode.inputs === undefined + ? rightInputForRightOutputWaveShaperNode + : rightInputForRightOutputWaveShaperNode.inputs[0]); + leftInputForLeftOutputWaveShaperNode.disconnect(leftInputForLeftOutputGainNode.gain); + leftInputForRightOutputWaveShaperNode.disconnect(leftInputForRightOutputGainNode.gain); + rightInputForLeftOutputWaveShaperNode.disconnect(rightInputForLeftOutputGainNode.gain); + rightInputForRightOutputWaveShaperNode.disconnect(rightInputForRightOutputGainNode.gain); + leftInputForLeftOutputGainNode.disconnect(channelMergerNode, 0, 0); + rightInputForLeftOutputGainNode.disconnect(channelMergerNode, 0, 0); + leftInputForRightOutputGainNode.disconnect(channelMergerNode, 0, 1); + rightInputForRightOutputGainNode.disconnect(channelMergerNode, 0, 1); + } + }; + }; + const buildInternalGraph = (nativeContext, channelCount, inputGainNode, panGainNode, channelMergerNode) => { + if (channelCount === 1) { + return buildInternalGraphForMono(nativeContext, inputGainNode, panGainNode, channelMergerNode); + } + if (channelCount === 2) { + return buildInternalGraphForStereo(nativeContext, inputGainNode, panGainNode, channelMergerNode); + } + throw createNotSupportedError(); + }; + return (nativeContext, { channelCount, channelCountMode, pan, ...audioNodeOptions }) => { + if (channelCountMode === 'max') { + throw createNotSupportedError(); + } + const channelMergerNode = createNativeChannelMergerNode(nativeContext, { + ...audioNodeOptions, + channelCount: 1, + channelCountMode, + numberOfInputs: 2 + }); + const inputGainNode = createNativeGainNode(nativeContext, { ...audioNodeOptions, channelCount, channelCountMode, gain: 1 }); + const panGainNode = createNativeGainNode(nativeContext, { + channelCount: 1, + channelCountMode: 'explicit', + channelInterpretation: 'discrete', + gain: pan + }); + let { connectGraph, disconnectGraph } = buildInternalGraph(nativeContext, channelCount, inputGainNode, panGainNode, channelMergerNode); + Object.defineProperty(panGainNode.gain, 'defaultValue', { get: () => 0 }); + Object.defineProperty(panGainNode.gain, 'maxValue', { get: () => 1 }); + Object.defineProperty(panGainNode.gain, 'minValue', { get: () => -1 }); + const nativeStereoPannerNodeFakerFactory = { + get bufferSize() { + return undefined; + }, + get channelCount() { + return inputGainNode.channelCount; + }, + set channelCount(value) { + if (inputGainNode.channelCount !== value) { + if (isConnected) { + disconnectGraph(); + } + ({ connectGraph, disconnectGraph } = buildInternalGraph(nativeContext, value, inputGainNode, panGainNode, channelMergerNode)); + if (isConnected) { + connectGraph(); + } + } + inputGainNode.channelCount = value; + }, + get channelCountMode() { + return inputGainNode.channelCountMode; + }, + set channelCountMode(value) { + if (value === 'clamped-max' || value === 'max') { + throw createNotSupportedError(); + } + inputGainNode.channelCountMode = value; + }, + get channelInterpretation() { + return inputGainNode.channelInterpretation; + }, + set channelInterpretation(value) { + inputGainNode.channelInterpretation = value; + }, + get context() { + return inputGainNode.context; + }, + get inputs() { + return [inputGainNode]; + }, + get numberOfInputs() { + return inputGainNode.numberOfInputs; + }, + get numberOfOutputs() { + return inputGainNode.numberOfOutputs; + }, + get pan() { + return panGainNode.gain; + }, + addEventListener(...args) { + return inputGainNode.addEventListener(args[0], args[1], args[2]); + }, + dispatchEvent(...args) { + return inputGainNode.dispatchEvent(args[0]); + }, + removeEventListener(...args) { + return inputGainNode.removeEventListener(args[0], args[1], args[2]); + } + }; + let isConnected = false; + const whenConnected = () => { + connectGraph(); + isConnected = true; + }; + const whenDisconnected = () => { + disconnectGraph(); + isConnected = false; + }; + return monitorConnections(interceptConnections(nativeStereoPannerNodeFakerFactory, channelMergerNode), whenConnected, whenDisconnected); + }; +}; + +const createNativeWaveShaperNodeFactory = (createConnectedNativeAudioBufferSourceNode, createInvalidStateError, createNativeWaveShaperNodeFaker, isDCCurve, monitorConnections, nativeAudioContextConstructor, overwriteAccessors) => { + return (nativeContext, options) => { + const nativeWaveShaperNode = nativeContext.createWaveShaper(); + /* + * Bug #119: Safari does not correctly map the values. + * @todo Unfortunately there is no way to test for this behavior in a synchronous fashion which is why testing for the existence of + * the webkitAudioContext is used as a workaround here. Testing for the automationRate property is necessary because this workaround + * isn't necessary anymore since v14.0.2 of Safari. + */ + if (nativeAudioContextConstructor !== null && + nativeAudioContextConstructor.name === 'webkitAudioContext' && + nativeContext.createGain().gain.automationRate === undefined) { + return createNativeWaveShaperNodeFaker(nativeContext, options); + } + assignNativeAudioNodeOptions(nativeWaveShaperNode, options); + const curve = options.curve === null || options.curve instanceof Float32Array ? options.curve : new Float32Array(options.curve); + // Bug #104: Chrome, Edge and Opera will throw an InvalidAccessError when the curve has less than two samples. + if (curve !== null && curve.length < 2) { + throw createInvalidStateError(); + } + // Only values of type Float32Array can be assigned to the curve property. + assignNativeAudioNodeOption(nativeWaveShaperNode, { curve }, 'curve'); + assignNativeAudioNodeOption(nativeWaveShaperNode, options, 'oversample'); + let disconnectNativeAudioBufferSourceNode = null; + let isConnected = false; + overwriteAccessors(nativeWaveShaperNode, 'curve', (get) => () => get.call(nativeWaveShaperNode), (set) => (value) => { + set.call(nativeWaveShaperNode, value); + if (isConnected) { + if (isDCCurve(value) && disconnectNativeAudioBufferSourceNode === null) { + disconnectNativeAudioBufferSourceNode = createConnectedNativeAudioBufferSourceNode(nativeContext, nativeWaveShaperNode); + } + else if (!isDCCurve(value) && disconnectNativeAudioBufferSourceNode !== null) { + disconnectNativeAudioBufferSourceNode(); + disconnectNativeAudioBufferSourceNode = null; + } + } + return value; + }); + const whenConnected = () => { + isConnected = true; + if (isDCCurve(nativeWaveShaperNode.curve)) { + disconnectNativeAudioBufferSourceNode = createConnectedNativeAudioBufferSourceNode(nativeContext, nativeWaveShaperNode); + } + }; + const whenDisconnected = () => { + isConnected = false; + if (disconnectNativeAudioBufferSourceNode !== null) { + disconnectNativeAudioBufferSourceNode(); + disconnectNativeAudioBufferSourceNode = null; + } + }; + return monitorConnections(nativeWaveShaperNode, whenConnected, whenDisconnected); + }; +}; + +const createNativeWaveShaperNodeFakerFactory = (createConnectedNativeAudioBufferSourceNode, createInvalidStateError, createNativeGainNode, isDCCurve, monitorConnections) => { + return (nativeContext, { curve, oversample, ...audioNodeOptions }) => { + const negativeWaveShaperNode = nativeContext.createWaveShaper(); + const positiveWaveShaperNode = nativeContext.createWaveShaper(); + assignNativeAudioNodeOptions(negativeWaveShaperNode, audioNodeOptions); + assignNativeAudioNodeOptions(positiveWaveShaperNode, audioNodeOptions); + const inputGainNode = createNativeGainNode(nativeContext, { ...audioNodeOptions, gain: 1 }); + const invertGainNode = createNativeGainNode(nativeContext, { ...audioNodeOptions, gain: -1 }); + const outputGainNode = createNativeGainNode(nativeContext, { ...audioNodeOptions, gain: 1 }); + const revertGainNode = createNativeGainNode(nativeContext, { ...audioNodeOptions, gain: -1 }); + let disconnectNativeAudioBufferSourceNode = null; + let isConnected = false; + let unmodifiedCurve = null; + const nativeWaveShaperNodeFaker = { + get bufferSize() { + return undefined; + }, + get channelCount() { + return negativeWaveShaperNode.channelCount; + }, + set channelCount(value) { + inputGainNode.channelCount = value; + invertGainNode.channelCount = value; + negativeWaveShaperNode.channelCount = value; + outputGainNode.channelCount = value; + positiveWaveShaperNode.channelCount = value; + revertGainNode.channelCount = value; + }, + get channelCountMode() { + return negativeWaveShaperNode.channelCountMode; + }, + set channelCountMode(value) { + inputGainNode.channelCountMode = value; + invertGainNode.channelCountMode = value; + negativeWaveShaperNode.channelCountMode = value; + outputGainNode.channelCountMode = value; + positiveWaveShaperNode.channelCountMode = value; + revertGainNode.channelCountMode = value; + }, + get channelInterpretation() { + return negativeWaveShaperNode.channelInterpretation; + }, + set channelInterpretation(value) { + inputGainNode.channelInterpretation = value; + invertGainNode.channelInterpretation = value; + negativeWaveShaperNode.channelInterpretation = value; + outputGainNode.channelInterpretation = value; + positiveWaveShaperNode.channelInterpretation = value; + revertGainNode.channelInterpretation = value; + }, + get context() { + return negativeWaveShaperNode.context; + }, + get curve() { + return unmodifiedCurve; + }, + set curve(value) { + // Bug #102: Safari does not throw an InvalidStateError when the curve has less than two samples. + if (value !== null && value.length < 2) { + throw createInvalidStateError(); + } + if (value === null) { + negativeWaveShaperNode.curve = value; + positiveWaveShaperNode.curve = value; + } + else { + const curveLength = value.length; + const negativeCurve = new Float32Array(curveLength + 2 - (curveLength % 2)); + const positiveCurve = new Float32Array(curveLength + 2 - (curveLength % 2)); + negativeCurve[0] = value[0]; + positiveCurve[0] = -value[curveLength - 1]; + const length = Math.ceil((curveLength + 1) / 2); + const centerIndex = (curveLength + 1) / 2 - 1; + for (let i = 1; i < length; i += 1) { + const theoreticIndex = (i / length) * centerIndex; + const lowerIndex = Math.floor(theoreticIndex); + const upperIndex = Math.ceil(theoreticIndex); + negativeCurve[i] = + lowerIndex === upperIndex + ? value[lowerIndex] + : (1 - (theoreticIndex - lowerIndex)) * value[lowerIndex] + + (1 - (upperIndex - theoreticIndex)) * value[upperIndex]; + positiveCurve[i] = + lowerIndex === upperIndex + ? -value[curveLength - 1 - lowerIndex] + : -((1 - (theoreticIndex - lowerIndex)) * value[curveLength - 1 - lowerIndex]) - + (1 - (upperIndex - theoreticIndex)) * value[curveLength - 1 - upperIndex]; + } + negativeCurve[length] = curveLength % 2 === 1 ? value[length - 1] : (value[length - 2] + value[length - 1]) / 2; + negativeWaveShaperNode.curve = negativeCurve; + positiveWaveShaperNode.curve = positiveCurve; + } + unmodifiedCurve = value; + if (isConnected) { + if (isDCCurve(unmodifiedCurve) && disconnectNativeAudioBufferSourceNode === null) { + disconnectNativeAudioBufferSourceNode = createConnectedNativeAudioBufferSourceNode(nativeContext, inputGainNode); + } + else if (disconnectNativeAudioBufferSourceNode !== null) { + disconnectNativeAudioBufferSourceNode(); + disconnectNativeAudioBufferSourceNode = null; + } + } + }, + get inputs() { + return [inputGainNode]; + }, + get numberOfInputs() { + return negativeWaveShaperNode.numberOfInputs; + }, + get numberOfOutputs() { + return negativeWaveShaperNode.numberOfOutputs; + }, + get oversample() { + return negativeWaveShaperNode.oversample; + }, + set oversample(value) { + negativeWaveShaperNode.oversample = value; + positiveWaveShaperNode.oversample = value; + }, + addEventListener(...args) { + return inputGainNode.addEventListener(args[0], args[1], args[2]); + }, + dispatchEvent(...args) { + return inputGainNode.dispatchEvent(args[0]); + }, + removeEventListener(...args) { + return inputGainNode.removeEventListener(args[0], args[1], args[2]); + } + }; + if (curve !== null) { + // Only values of type Float32Array can be assigned to the curve property. + nativeWaveShaperNodeFaker.curve = curve instanceof Float32Array ? curve : new Float32Array(curve); + } + if (oversample !== nativeWaveShaperNodeFaker.oversample) { + nativeWaveShaperNodeFaker.oversample = oversample; + } + const whenConnected = () => { + inputGainNode.connect(negativeWaveShaperNode).connect(outputGainNode); + inputGainNode.connect(invertGainNode).connect(positiveWaveShaperNode).connect(revertGainNode).connect(outputGainNode); + isConnected = true; + if (isDCCurve(unmodifiedCurve)) { + disconnectNativeAudioBufferSourceNode = createConnectedNativeAudioBufferSourceNode(nativeContext, inputGainNode); + } + }; + const whenDisconnected = () => { + inputGainNode.disconnect(negativeWaveShaperNode); + negativeWaveShaperNode.disconnect(outputGainNode); + inputGainNode.disconnect(invertGainNode); + invertGainNode.disconnect(positiveWaveShaperNode); + positiveWaveShaperNode.disconnect(revertGainNode); + revertGainNode.disconnect(outputGainNode); + isConnected = false; + if (disconnectNativeAudioBufferSourceNode !== null) { + disconnectNativeAudioBufferSourceNode(); + disconnectNativeAudioBufferSourceNode = null; + } + }; + return monitorConnections(interceptConnections(nativeWaveShaperNodeFaker, outputGainNode), whenConnected, whenDisconnected); + }; +}; + +const createNotSupportedError = () => new DOMException('', 'NotSupportedError'); + +const DEFAULT_OPTIONS$e = { + numberOfChannels: 1 +}; +const createOfflineAudioContextConstructor = (baseAudioContextConstructor, cacheTestResult, createInvalidStateError, createNativeOfflineAudioContext, startRendering) => { + return class OfflineAudioContext extends baseAudioContextConstructor { + constructor(a, b, c) { + let options; + if (typeof a === 'number' && b !== undefined && c !== undefined) { + options = { length: b, numberOfChannels: a, sampleRate: c }; + } + else if (typeof a === 'object') { + options = a; + } + else { + throw new Error('The given parameters are not valid.'); + } + const { length, numberOfChannels, sampleRate } = { ...DEFAULT_OPTIONS$e, ...options }; + const nativeOfflineAudioContext = createNativeOfflineAudioContext(numberOfChannels, length, sampleRate); + // #21 Safari does not support promises and therefore would fire the statechange event before the promise can be resolved. + if (!cacheTestResult(testPromiseSupport, () => testPromiseSupport(nativeOfflineAudioContext))) { + nativeOfflineAudioContext.addEventListener('statechange', (() => { + let i = 0; + const delayStateChangeEvent = (event) => { + if (this._state === 'running') { + if (i > 0) { + nativeOfflineAudioContext.removeEventListener('statechange', delayStateChangeEvent); + event.stopImmediatePropagation(); + this._waitForThePromiseToSettle(event); + } + else { + i += 1; + } + } + }; + return delayStateChangeEvent; + })()); + } + super(nativeOfflineAudioContext, numberOfChannels); + this._length = length; + this._nativeOfflineAudioContext = nativeOfflineAudioContext; + this._state = null; + } + get length() { + // Bug #17: Safari does not yet expose the length. + if (this._nativeOfflineAudioContext.length === undefined) { + return this._length; + } + return this._nativeOfflineAudioContext.length; + } + get state() { + return this._state === null ? this._nativeOfflineAudioContext.state : this._state; + } + startRendering() { + /* + * Bug #9 & #59: It is theoretically possible that startRendering() will first render a partialOfflineAudioContext. Therefore + * the state of the nativeOfflineAudioContext might no transition to running immediately. + */ + if (this._state === 'running') { + return Promise.reject(createInvalidStateError()); + } + this._state = 'running'; + return startRendering(this.destination, this._nativeOfflineAudioContext).finally(() => { + this._state = null; + deactivateAudioGraph(this); + }); + } + _waitForThePromiseToSettle(event) { + if (this._state === null) { + this._nativeOfflineAudioContext.dispatchEvent(event); + } + else { + setTimeout(() => this._waitForThePromiseToSettle(event)); + } + } + }; +}; + +const DEFAULT_OPTIONS$f = { + channelCount: 2, + channelCountMode: 'max', + channelInterpretation: 'speakers', + detune: 0, + frequency: 440, + periodicWave: undefined, + type: 'sine' +}; +const createOscillatorNodeConstructor = (audioNodeConstructor, createAudioParam, createNativeOscillatorNode, createOscillatorNodeRenderer, getNativeContext, isNativeOfflineAudioContext, wrapEventListener) => { + return class OscillatorNode extends audioNodeConstructor { + constructor(context, options) { + const nativeContext = getNativeContext(context); + const mergedOptions = { ...DEFAULT_OPTIONS$f, ...options }; + const nativeOscillatorNode = createNativeOscillatorNode(nativeContext, mergedOptions); + const isOffline = isNativeOfflineAudioContext(nativeContext); + const oscillatorNodeRenderer = (isOffline ? createOscillatorNodeRenderer() : null); + const nyquist = context.sampleRate / 2; + super(context, false, nativeOscillatorNode, oscillatorNodeRenderer); + // Bug #81: Firefox & Safari do not export the correct values for maxValue and minValue. + this._detune = createAudioParam(this, isOffline, nativeOscillatorNode.detune, 153600, -153600); + // Bug #76: Safari does not export the correct values for maxValue and minValue. + this._frequency = createAudioParam(this, isOffline, nativeOscillatorNode.frequency, nyquist, -nyquist); + this._nativeOscillatorNode = nativeOscillatorNode; + this._onended = null; + this._oscillatorNodeRenderer = oscillatorNodeRenderer; + if (this._oscillatorNodeRenderer !== null && mergedOptions.periodicWave !== undefined) { + this._oscillatorNodeRenderer.periodicWave = + mergedOptions.periodicWave; + } + } + get detune() { + return this._detune; + } + get frequency() { + return this._frequency; + } + get onended() { + return this._onended; + } + set onended(value) { + const wrappedListener = typeof value === 'function' ? wrapEventListener(this, value) : null; + this._nativeOscillatorNode.onended = wrappedListener; + const nativeOnEnded = this._nativeOscillatorNode.onended; + this._onended = nativeOnEnded !== null && nativeOnEnded === wrappedListener ? value : nativeOnEnded; + } + get type() { + return this._nativeOscillatorNode.type; + } + set type(value) { + this._nativeOscillatorNode.type = value; + if (this._oscillatorNodeRenderer !== null) { + this._oscillatorNodeRenderer.periodicWave = null; + } + } + setPeriodicWave(periodicWave) { + this._nativeOscillatorNode.setPeriodicWave(periodicWave); + if (this._oscillatorNodeRenderer !== null) { + this._oscillatorNodeRenderer.periodicWave = periodicWave; + } + } + start(when = 0) { + this._nativeOscillatorNode.start(when); + if (this._oscillatorNodeRenderer !== null) { + this._oscillatorNodeRenderer.start = when; + } + if (this.context.state !== 'closed') { + setInternalStateToActive(this); + const resetInternalStateToPassive = () => { + this._nativeOscillatorNode.removeEventListener('ended', resetInternalStateToPassive); + if (isActiveAudioNode(this)) { + setInternalStateToPassive(this); + } + }; + this._nativeOscillatorNode.addEventListener('ended', resetInternalStateToPassive); + } + } + stop(when = 0) { + this._nativeOscillatorNode.stop(when); + if (this._oscillatorNodeRenderer !== null) { + this._oscillatorNodeRenderer.stop = when; + } + } + }; +}; + +const createOscillatorNodeRendererFactory = (connectAudioParam, createNativeOscillatorNode, getNativeAudioNode, renderAutomation, renderInputsOfAudioNode) => { + return () => { + const renderedNativeOscillatorNodes = new WeakMap(); + let periodicWave = null; + let start = null; + let stop = null; + const createOscillatorNode = async (proxy, nativeOfflineAudioContext) => { + let nativeOscillatorNode = getNativeAudioNode(proxy); + // If the initially used nativeOscillatorNode was not constructed on the same OfflineAudioContext it needs to be created again. + const nativeOscillatorNodeIsOwnedByContext = isOwnedByContext(nativeOscillatorNode, nativeOfflineAudioContext); + if (!nativeOscillatorNodeIsOwnedByContext) { + const options = { + channelCount: nativeOscillatorNode.channelCount, + channelCountMode: nativeOscillatorNode.channelCountMode, + channelInterpretation: nativeOscillatorNode.channelInterpretation, + detune: nativeOscillatorNode.detune.value, + frequency: nativeOscillatorNode.frequency.value, + periodicWave: periodicWave === null ? undefined : periodicWave, + type: nativeOscillatorNode.type + }; + nativeOscillatorNode = createNativeOscillatorNode(nativeOfflineAudioContext, options); + if (start !== null) { + nativeOscillatorNode.start(start); + } + if (stop !== null) { + nativeOscillatorNode.stop(stop); + } + } + renderedNativeOscillatorNodes.set(nativeOfflineAudioContext, nativeOscillatorNode); + if (!nativeOscillatorNodeIsOwnedByContext) { + await renderAutomation(nativeOfflineAudioContext, proxy.detune, nativeOscillatorNode.detune); + await renderAutomation(nativeOfflineAudioContext, proxy.frequency, nativeOscillatorNode.frequency); + } + else { + await connectAudioParam(nativeOfflineAudioContext, proxy.detune, nativeOscillatorNode.detune); + await connectAudioParam(nativeOfflineAudioContext, proxy.frequency, nativeOscillatorNode.frequency); + } + await renderInputsOfAudioNode(proxy, nativeOfflineAudioContext, nativeOscillatorNode); + return nativeOscillatorNode; + }; + return { + set periodicWave(value) { + periodicWave = value; + }, + set start(value) { + start = value; + }, + set stop(value) { + stop = value; + }, + render(proxy, nativeOfflineAudioContext) { + const renderedNativeOscillatorNode = renderedNativeOscillatorNodes.get(nativeOfflineAudioContext); + if (renderedNativeOscillatorNode !== undefined) { + return Promise.resolve(renderedNativeOscillatorNode); + } + return createOscillatorNode(proxy, nativeOfflineAudioContext); + } + }; + }; +}; + +const DEFAULT_OPTIONS$g = { + channelCount: 2, + channelCountMode: 'clamped-max', + channelInterpretation: 'speakers', + coneInnerAngle: 360, + coneOuterAngle: 360, + coneOuterGain: 0, + distanceModel: 'inverse', + maxDistance: 10000, + orientationX: 1, + orientationY: 0, + orientationZ: 0, + panningModel: 'equalpower', + positionX: 0, + positionY: 0, + positionZ: 0, + refDistance: 1, + rolloffFactor: 1 +}; +const createPannerNodeConstructor = (audioNodeConstructor, createAudioParam, createNativePannerNode, createPannerNodeRenderer, getNativeContext, isNativeOfflineAudioContext, setAudioNodeTailTime) => { + return class PannerNode extends audioNodeConstructor { + constructor(context, options) { + const nativeContext = getNativeContext(context); + const mergedOptions = { ...DEFAULT_OPTIONS$g, ...options }; + const nativePannerNode = createNativePannerNode(nativeContext, mergedOptions); + const isOffline = isNativeOfflineAudioContext(nativeContext); + const pannerNodeRenderer = (isOffline ? createPannerNodeRenderer() : null); + super(context, false, nativePannerNode, pannerNodeRenderer); + this._nativePannerNode = nativePannerNode; + // Bug #74: Safari does not export the correct values for maxValue and minValue. + this._orientationX = createAudioParam(this, isOffline, nativePannerNode.orientationX, MOST_POSITIVE_SINGLE_FLOAT, MOST_NEGATIVE_SINGLE_FLOAT); + this._orientationY = createAudioParam(this, isOffline, nativePannerNode.orientationY, MOST_POSITIVE_SINGLE_FLOAT, MOST_NEGATIVE_SINGLE_FLOAT); + this._orientationZ = createAudioParam(this, isOffline, nativePannerNode.orientationZ, MOST_POSITIVE_SINGLE_FLOAT, MOST_NEGATIVE_SINGLE_FLOAT); + this._positionX = createAudioParam(this, isOffline, nativePannerNode.positionX, MOST_POSITIVE_SINGLE_FLOAT, MOST_NEGATIVE_SINGLE_FLOAT); + this._positionY = createAudioParam(this, isOffline, nativePannerNode.positionY, MOST_POSITIVE_SINGLE_FLOAT, MOST_NEGATIVE_SINGLE_FLOAT); + this._positionZ = createAudioParam(this, isOffline, nativePannerNode.positionZ, MOST_POSITIVE_SINGLE_FLOAT, MOST_NEGATIVE_SINGLE_FLOAT); + // @todo Determine a meaningful tail-time instead of just using one second. + setAudioNodeTailTime(this, 1); + } + get coneInnerAngle() { + return this._nativePannerNode.coneInnerAngle; + } + set coneInnerAngle(value) { + this._nativePannerNode.coneInnerAngle = value; + } + get coneOuterAngle() { + return this._nativePannerNode.coneOuterAngle; + } + set coneOuterAngle(value) { + this._nativePannerNode.coneOuterAngle = value; + } + get coneOuterGain() { + return this._nativePannerNode.coneOuterGain; + } + set coneOuterGain(value) { + this._nativePannerNode.coneOuterGain = value; + } + get distanceModel() { + return this._nativePannerNode.distanceModel; + } + set distanceModel(value) { + this._nativePannerNode.distanceModel = value; + } + get maxDistance() { + return this._nativePannerNode.maxDistance; + } + set maxDistance(value) { + this._nativePannerNode.maxDistance = value; + } + get orientationX() { + return this._orientationX; + } + get orientationY() { + return this._orientationY; + } + get orientationZ() { + return this._orientationZ; + } + get panningModel() { + return this._nativePannerNode.panningModel; + } + set panningModel(value) { + this._nativePannerNode.panningModel = value; + } + get positionX() { + return this._positionX; + } + get positionY() { + return this._positionY; + } + get positionZ() { + return this._positionZ; + } + get refDistance() { + return this._nativePannerNode.refDistance; + } + set refDistance(value) { + this._nativePannerNode.refDistance = value; + } + get rolloffFactor() { + return this._nativePannerNode.rolloffFactor; + } + set rolloffFactor(value) { + this._nativePannerNode.rolloffFactor = value; + } + }; +}; + +const createPannerNodeRendererFactory = (connectAudioParam, createNativeChannelMergerNode, createNativeConstantSourceNode, createNativeGainNode, createNativePannerNode, getNativeAudioNode, nativeOfflineAudioContextConstructor, renderAutomation, renderInputsOfAudioNode, renderNativeOfflineAudioContext) => { + return () => { + const renderedNativeAudioNodes = new WeakMap(); + let renderedBufferPromise = null; + const createAudioNode = async (proxy, nativeOfflineAudioContext) => { + let nativeGainNode = null; + let nativePannerNode = getNativeAudioNode(proxy); + const commonAudioNodeOptions = { + channelCount: nativePannerNode.channelCount, + channelCountMode: nativePannerNode.channelCountMode, + channelInterpretation: nativePannerNode.channelInterpretation + }; + const commonNativePannerNodeOptions = { + ...commonAudioNodeOptions, + coneInnerAngle: nativePannerNode.coneInnerAngle, + coneOuterAngle: nativePannerNode.coneOuterAngle, + coneOuterGain: nativePannerNode.coneOuterGain, + distanceModel: nativePannerNode.distanceModel, + maxDistance: nativePannerNode.maxDistance, + panningModel: nativePannerNode.panningModel, + refDistance: nativePannerNode.refDistance, + rolloffFactor: nativePannerNode.rolloffFactor + }; + // If the initially used nativePannerNode was not constructed on the same OfflineAudioContext it needs to be created again. + const nativePannerNodeIsOwnedByContext = isOwnedByContext(nativePannerNode, nativeOfflineAudioContext); + // Bug #124: Safari does not support modifying the orientation and the position with AudioParams. + if ('bufferSize' in nativePannerNode) { + nativeGainNode = createNativeGainNode(nativeOfflineAudioContext, { ...commonAudioNodeOptions, gain: 1 }); + } + else if (!nativePannerNodeIsOwnedByContext) { + const options = { + ...commonNativePannerNodeOptions, + orientationX: nativePannerNode.orientationX.value, + orientationY: nativePannerNode.orientationY.value, + orientationZ: nativePannerNode.orientationZ.value, + positionX: nativePannerNode.positionX.value, + positionY: nativePannerNode.positionY.value, + positionZ: nativePannerNode.positionZ.value + }; + nativePannerNode = createNativePannerNode(nativeOfflineAudioContext, options); + } + renderedNativeAudioNodes.set(nativeOfflineAudioContext, nativeGainNode === null ? nativePannerNode : nativeGainNode); + if (nativeGainNode !== null) { + if (renderedBufferPromise === null) { + if (nativeOfflineAudioContextConstructor === null) { + throw new Error('Missing the native OfflineAudioContext constructor.'); + } + const partialOfflineAudioContext = new nativeOfflineAudioContextConstructor(6, + // Bug #17: Safari does not yet expose the length. + proxy.context.length, nativeOfflineAudioContext.sampleRate); + const nativeChannelMergerNode = createNativeChannelMergerNode(partialOfflineAudioContext, { + channelCount: 1, + channelCountMode: 'explicit', + channelInterpretation: 'speakers', + numberOfInputs: 6 + }); + nativeChannelMergerNode.connect(partialOfflineAudioContext.destination); + renderedBufferPromise = (async () => { + const nativeConstantSourceNodes = await Promise.all([ + proxy.orientationX, + proxy.orientationY, + proxy.orientationZ, + proxy.positionX, + proxy.positionY, + proxy.positionZ + ].map(async (audioParam, index) => { + const nativeConstantSourceNode = createNativeConstantSourceNode(partialOfflineAudioContext, { + channelCount: 1, + channelCountMode: 'explicit', + channelInterpretation: 'discrete', + offset: index === 0 ? 1 : 0 + }); + await renderAutomation(partialOfflineAudioContext, audioParam, nativeConstantSourceNode.offset); + return nativeConstantSourceNode; + })); + for (let i = 0; i < 6; i += 1) { + nativeConstantSourceNodes[i].connect(nativeChannelMergerNode, 0, i); + nativeConstantSourceNodes[i].start(0); + } + return renderNativeOfflineAudioContext(partialOfflineAudioContext); + })(); + } + const renderedBuffer = await renderedBufferPromise; + const inputGainNode = createNativeGainNode(nativeOfflineAudioContext, { ...commonAudioNodeOptions, gain: 1 }); + await renderInputsOfAudioNode(proxy, nativeOfflineAudioContext, inputGainNode); + const channelDatas = []; + for (let i = 0; i < renderedBuffer.numberOfChannels; i += 1) { + channelDatas.push(renderedBuffer.getChannelData(i)); + } + let lastOrientation = [channelDatas[0][0], channelDatas[1][0], channelDatas[2][0]]; + let lastPosition = [channelDatas[3][0], channelDatas[4][0], channelDatas[5][0]]; + let gateGainNode = createNativeGainNode(nativeOfflineAudioContext, { ...commonAudioNodeOptions, gain: 1 }); + let partialPannerNode = createNativePannerNode(nativeOfflineAudioContext, { + ...commonNativePannerNodeOptions, + orientationX: lastOrientation[0], + orientationY: lastOrientation[1], + orientationZ: lastOrientation[2], + positionX: lastPosition[0], + positionY: lastPosition[1], + positionZ: lastPosition[2] + }); + inputGainNode.connect(gateGainNode).connect(partialPannerNode.inputs[0]); + partialPannerNode.connect(nativeGainNode); + for (let i = 128; i < renderedBuffer.length; i += 128) { + const orientation = [channelDatas[0][i], channelDatas[1][i], channelDatas[2][i]]; + const positon = [channelDatas[3][i], channelDatas[4][i], channelDatas[5][i]]; + if (orientation.some((value, index) => value !== lastOrientation[index]) || + positon.some((value, index) => value !== lastPosition[index])) { + lastOrientation = orientation; + lastPosition = positon; + const currentTime = i / nativeOfflineAudioContext.sampleRate; + gateGainNode.gain.setValueAtTime(0, currentTime); + gateGainNode = createNativeGainNode(nativeOfflineAudioContext, { ...commonAudioNodeOptions, gain: 0 }); + partialPannerNode = createNativePannerNode(nativeOfflineAudioContext, { + ...commonNativePannerNodeOptions, + orientationX: lastOrientation[0], + orientationY: lastOrientation[1], + orientationZ: lastOrientation[2], + positionX: lastPosition[0], + positionY: lastPosition[1], + positionZ: lastPosition[2] + }); + gateGainNode.gain.setValueAtTime(1, currentTime); + inputGainNode.connect(gateGainNode).connect(partialPannerNode.inputs[0]); + partialPannerNode.connect(nativeGainNode); + } + } + return nativeGainNode; + } + if (!nativePannerNodeIsOwnedByContext) { + await renderAutomation(nativeOfflineAudioContext, proxy.orientationX, nativePannerNode.orientationX); + await renderAutomation(nativeOfflineAudioContext, proxy.orientationY, nativePannerNode.orientationY); + await renderAutomation(nativeOfflineAudioContext, proxy.orientationZ, nativePannerNode.orientationZ); + await renderAutomation(nativeOfflineAudioContext, proxy.positionX, nativePannerNode.positionX); + await renderAutomation(nativeOfflineAudioContext, proxy.positionY, nativePannerNode.positionY); + await renderAutomation(nativeOfflineAudioContext, proxy.positionZ, nativePannerNode.positionZ); + } + else { + await connectAudioParam(nativeOfflineAudioContext, proxy.orientationX, nativePannerNode.orientationX); + await connectAudioParam(nativeOfflineAudioContext, proxy.orientationY, nativePannerNode.orientationY); + await connectAudioParam(nativeOfflineAudioContext, proxy.orientationZ, nativePannerNode.orientationZ); + await connectAudioParam(nativeOfflineAudioContext, proxy.positionX, nativePannerNode.positionX); + await connectAudioParam(nativeOfflineAudioContext, proxy.positionY, nativePannerNode.positionY); + await connectAudioParam(nativeOfflineAudioContext, proxy.positionZ, nativePannerNode.positionZ); + } + if (isNativeAudioNodeFaker(nativePannerNode)) { + await renderInputsOfAudioNode(proxy, nativeOfflineAudioContext, nativePannerNode.inputs[0]); + } + else { + await renderInputsOfAudioNode(proxy, nativeOfflineAudioContext, nativePannerNode); + } + return nativePannerNode; + }; + return { + render(proxy, nativeOfflineAudioContext) { + const renderedNativeGainNodeOrNativePannerNode = renderedNativeAudioNodes.get(nativeOfflineAudioContext); + if (renderedNativeGainNodeOrNativePannerNode !== undefined) { + return Promise.resolve(renderedNativeGainNodeOrNativePannerNode); + } + return createAudioNode(proxy, nativeOfflineAudioContext); + } + }; + }; +}; + +const DEFAULT_OPTIONS$h = { + disableNormalization: false +}; +const createPeriodicWaveConstructor = (createNativePeriodicWave, getNativeContext, periodicWaveStore, sanitizePeriodicWaveOptions) => { + return class PeriodicWave { + constructor(context, options) { + const nativeContext = getNativeContext(context); + const mergedOptions = sanitizePeriodicWaveOptions({ ...DEFAULT_OPTIONS$h, ...options }); + const periodicWave = createNativePeriodicWave(nativeContext, mergedOptions); + periodicWaveStore.add(periodicWave); + // This does violate all good pratices but it is used here to simplify the handling of periodic waves. + return periodicWave; + } + static [Symbol.hasInstance](instance) { + return ((instance !== null && typeof instance === 'object' && Object.getPrototypeOf(instance) === PeriodicWave.prototype) || + periodicWaveStore.has(instance)); + } + }; +}; + +const createRenderAutomation = (getAudioParamRenderer, renderInputsOfAudioParam) => { + return (nativeOfflineAudioContext, audioParam, nativeAudioParam) => { + const audioParamRenderer = getAudioParamRenderer(audioParam); + audioParamRenderer.replay(nativeAudioParam); + return renderInputsOfAudioParam(audioParam, nativeOfflineAudioContext, nativeAudioParam); + }; +}; + +const createRenderInputsOfAudioNode = (getAudioNodeConnections, getAudioNodeRenderer, isPartOfACycle) => { + return async (audioNode, nativeOfflineAudioContext, nativeAudioNode) => { + const audioNodeConnections = getAudioNodeConnections(audioNode); + await Promise.all(audioNodeConnections.activeInputs + .map((connections, input) => Array.from(connections).map(async ([source, output]) => { + const audioNodeRenderer = getAudioNodeRenderer(source); + const renderedNativeAudioNode = await audioNodeRenderer.render(source, nativeOfflineAudioContext); + const destination = audioNode.context.destination; + if (!isPartOfACycle(source) && (audioNode !== destination || !isPartOfACycle(audioNode))) { + renderedNativeAudioNode.connect(nativeAudioNode, output, input); + } + })) + .reduce((allRenderingPromises, renderingPromises) => [...allRenderingPromises, ...renderingPromises], [])); + }; +}; + +const createRenderInputsOfAudioParam = (getAudioNodeRenderer, getAudioParamConnections, isPartOfACycle) => { + return async (audioParam, nativeOfflineAudioContext, nativeAudioParam) => { + const audioParamConnections = getAudioParamConnections(audioParam); + await Promise.all(Array.from(audioParamConnections.activeInputs).map(async ([source, output]) => { + const audioNodeRenderer = getAudioNodeRenderer(source); + const renderedNativeAudioNode = await audioNodeRenderer.render(source, nativeOfflineAudioContext); + if (!isPartOfACycle(source)) { + renderedNativeAudioNode.connect(nativeAudioParam, output); + } + })); + }; +}; + +const createRenderNativeOfflineAudioContext = (cacheTestResult, createNativeGainNode, createNativeScriptProcessorNode, testOfflineAudioContextCurrentTimeSupport) => { + return (nativeOfflineAudioContext) => { + // Bug #21: Safari does not support promises yet. + if (cacheTestResult(testPromiseSupport, () => testPromiseSupport(nativeOfflineAudioContext))) { + // Bug #158: Chrome and Edge do not advance currentTime if it is not accessed while rendering the audio. + return Promise.resolve(cacheTestResult(testOfflineAudioContextCurrentTimeSupport, testOfflineAudioContextCurrentTimeSupport)).then((isOfflineAudioContextCurrentTimeSupported) => { + if (!isOfflineAudioContextCurrentTimeSupported) { + const scriptProcessorNode = createNativeScriptProcessorNode(nativeOfflineAudioContext, 512, 0, 1); + nativeOfflineAudioContext.oncomplete = () => { + scriptProcessorNode.onaudioprocess = null; // tslint:disable-line:deprecation + scriptProcessorNode.disconnect(); + }; + scriptProcessorNode.onaudioprocess = () => nativeOfflineAudioContext.currentTime; // tslint:disable-line:deprecation + scriptProcessorNode.connect(nativeOfflineAudioContext.destination); + } + return nativeOfflineAudioContext.startRendering(); + }); + } + return new Promise((resolve) => { + // Bug #48: Safari does not render an OfflineAudioContext without any connected node. + const gainNode = createNativeGainNode(nativeOfflineAudioContext, { + channelCount: 1, + channelCountMode: 'explicit', + channelInterpretation: 'discrete', + gain: 0 + }); + nativeOfflineAudioContext.oncomplete = (event) => { + gainNode.disconnect(); + resolve(event.renderedBuffer); + }; + gainNode.connect(nativeOfflineAudioContext.destination); + nativeOfflineAudioContext.startRendering(); + }); + }; +}; + +const createSetActiveAudioWorkletNodeInputs = (activeAudioWorkletNodeInputsStore) => { + return (nativeAudioWorkletNode, activeInputs) => { + activeAudioWorkletNodeInputsStore.set(nativeAudioWorkletNode, activeInputs); + }; +}; + +const createSetAudioNodeTailTime = (audioNodeTailTimeStore) => { + return (audioNode, tailTime) => audioNodeTailTimeStore.set(audioNode, tailTime); +}; + +const createStartRendering = (audioBufferStore, cacheTestResult, getAudioNodeRenderer, getUnrenderedAudioWorkletNodes, renderNativeOfflineAudioContext, testAudioBufferCopyChannelMethodsOutOfBoundsSupport, wrapAudioBufferCopyChannelMethods, wrapAudioBufferCopyChannelMethodsOutOfBounds) => { + return (destination, nativeOfflineAudioContext) => getAudioNodeRenderer(destination) + .render(destination, nativeOfflineAudioContext) + /* + * Bug #86 & #87: Invoking the renderer of an AudioWorkletNode might be necessary if it has no direct or indirect connection to the + * destination. + */ + .then(() => Promise.all(Array.from(getUnrenderedAudioWorkletNodes(nativeOfflineAudioContext)).map((audioWorkletNode) => getAudioNodeRenderer(audioWorkletNode).render(audioWorkletNode, nativeOfflineAudioContext)))) + .then(() => renderNativeOfflineAudioContext(nativeOfflineAudioContext)) + .then((audioBuffer) => { + // Bug #5: Safari does not support copyFromChannel() and copyToChannel(). + // Bug #100: Safari does throw a wrong error when calling getChannelData() with an out-of-bounds value. + if (typeof audioBuffer.copyFromChannel !== 'function') { + wrapAudioBufferCopyChannelMethods(audioBuffer); + wrapAudioBufferGetChannelDataMethod(audioBuffer); + // Bug #157: Firefox does not allow the bufferOffset to be out-of-bounds. + } + else if (!cacheTestResult(testAudioBufferCopyChannelMethodsOutOfBoundsSupport, () => testAudioBufferCopyChannelMethodsOutOfBoundsSupport(audioBuffer))) { + wrapAudioBufferCopyChannelMethodsOutOfBounds(audioBuffer); + } + audioBufferStore.add(audioBuffer); + return audioBuffer; + }); +}; + +const DEFAULT_OPTIONS$i = { + channelCount: 2, + /* + * Bug #105: The channelCountMode should be 'clamped-max' according to the spec but is set to 'explicit' to achieve consistent + * behavior. + */ + channelCountMode: 'explicit', + channelInterpretation: 'speakers', + pan: 0 +}; +const createStereoPannerNodeConstructor = (audioNodeConstructor, createAudioParam, createNativeStereoPannerNode, createStereoPannerNodeRenderer, getNativeContext, isNativeOfflineAudioContext) => { + return class StereoPannerNode extends audioNodeConstructor { + constructor(context, options) { + const nativeContext = getNativeContext(context); + const mergedOptions = { ...DEFAULT_OPTIONS$i, ...options }; + const nativeStereoPannerNode = createNativeStereoPannerNode(nativeContext, mergedOptions); + const isOffline = isNativeOfflineAudioContext(nativeContext); + const stereoPannerNodeRenderer = (isOffline ? createStereoPannerNodeRenderer() : null); + super(context, false, nativeStereoPannerNode, stereoPannerNodeRenderer); + this._pan = createAudioParam(this, isOffline, nativeStereoPannerNode.pan); + } + get pan() { + return this._pan; + } + }; +}; + +const createStereoPannerNodeRendererFactory = (connectAudioParam, createNativeStereoPannerNode, getNativeAudioNode, renderAutomation, renderInputsOfAudioNode) => { + return () => { + const renderedNativeStereoPannerNodes = new WeakMap(); + const createStereoPannerNode = async (proxy, nativeOfflineAudioContext) => { + let nativeStereoPannerNode = getNativeAudioNode(proxy); + /* + * If the initially used nativeStereoPannerNode was not constructed on the same OfflineAudioContext it needs to be created + * again. + */ + const nativeStereoPannerNodeIsOwnedByContext = isOwnedByContext(nativeStereoPannerNode, nativeOfflineAudioContext); + if (!nativeStereoPannerNodeIsOwnedByContext) { + const options = { + channelCount: nativeStereoPannerNode.channelCount, + channelCountMode: nativeStereoPannerNode.channelCountMode, + channelInterpretation: nativeStereoPannerNode.channelInterpretation, + pan: nativeStereoPannerNode.pan.value + }; + nativeStereoPannerNode = createNativeStereoPannerNode(nativeOfflineAudioContext, options); + } + renderedNativeStereoPannerNodes.set(nativeOfflineAudioContext, nativeStereoPannerNode); + if (!nativeStereoPannerNodeIsOwnedByContext) { + await renderAutomation(nativeOfflineAudioContext, proxy.pan, nativeStereoPannerNode.pan); + } + else { + await connectAudioParam(nativeOfflineAudioContext, proxy.pan, nativeStereoPannerNode.pan); + } + if (isNativeAudioNodeFaker(nativeStereoPannerNode)) { + await renderInputsOfAudioNode(proxy, nativeOfflineAudioContext, nativeStereoPannerNode.inputs[0]); + } + else { + await renderInputsOfAudioNode(proxy, nativeOfflineAudioContext, nativeStereoPannerNode); + } + return nativeStereoPannerNode; + }; + return { + render(proxy, nativeOfflineAudioContext) { + const renderedNativeStereoPannerNode = renderedNativeStereoPannerNodes.get(nativeOfflineAudioContext); + if (renderedNativeStereoPannerNode !== undefined) { + return Promise.resolve(renderedNativeStereoPannerNode); + } + return createStereoPannerNode(proxy, nativeOfflineAudioContext); + } + }; + }; +}; + +// Bug #33: Safari exposes an AudioBuffer but it can't be used as a constructor. +const createTestAudioBufferConstructorSupport = (nativeAudioBufferConstructor) => { + return () => { + if (nativeAudioBufferConstructor === null) { + return false; + } + try { + new nativeAudioBufferConstructor({ length: 1, sampleRate: 44100 }); // tslint:disable-line:no-unused-expression + } + catch { + return false; + } + return true; + }; +}; + +/* + * Firefox up to version 67 didn't fully support the copyFromChannel() and copyToChannel() methods. Therefore testing one of those methods + * is enough to know if the other one is supported as well. + */ +const createTestAudioBufferCopyChannelMethodsSubarraySupport = (nativeOfflineAudioContextConstructor) => { + return () => { + if (nativeOfflineAudioContextConstructor === null) { + return false; + } + const nativeOfflineAudioContext = new nativeOfflineAudioContextConstructor(1, 1, 44100); + const nativeAudioBuffer = nativeOfflineAudioContext.createBuffer(1, 1, 44100); + // Bug #5: Safari does not support copyFromChannel() and copyToChannel(). + if (nativeAudioBuffer.copyToChannel === undefined) { + return true; + } + const source = new Float32Array(2); + try { + nativeAudioBuffer.copyFromChannel(source, 0, 0); + } + catch { + return false; + } + return true; + }; +}; + +const createTestAudioContextCloseMethodSupport = (nativeAudioContextConstructor) => { + return () => { + if (nativeAudioContextConstructor === null) { + return false; + } + // Try to check the prototype before constructing the AudioContext. + if (nativeAudioContextConstructor.prototype !== undefined && nativeAudioContextConstructor.prototype.close !== undefined) { + return true; + } + const audioContext = new nativeAudioContextConstructor(); + const isAudioContextClosable = audioContext.close !== undefined; + try { + audioContext.close(); + } + catch { + // Ignore errors. + } + return isAudioContextClosable; + }; +}; + +/** + * Edge up to version 14, Firefox up to version 52, Safari up to version 9 and maybe other browsers + * did not refuse to decode invalid parameters with a TypeError. + */ +const createTestAudioContextDecodeAudioDataMethodTypeErrorSupport = (nativeOfflineAudioContextConstructor) => { + return () => { + if (nativeOfflineAudioContextConstructor === null) { + return Promise.resolve(false); + } + const offlineAudioContext = new nativeOfflineAudioContextConstructor(1, 1, 44100); + // Bug #21: Safari does not support promises yet. + return new Promise((resolve) => { + let isPending = true; + const resolvePromise = (err) => { + if (isPending) { + isPending = false; + offlineAudioContext.startRendering(); + resolve(err instanceof TypeError); + } + }; + let promise; + // Bug #26: Safari throws a synchronous error. + try { + promise = offlineAudioContext + // Bug #1: Safari requires a successCallback. + .decodeAudioData(null, () => { + // Ignore the success callback. + }, resolvePromise); + } + catch (err) { + resolvePromise(err); + } + // Bug #21: Safari does not support promises yet. + if (promise !== undefined) { + // Bug #6: Chrome, Edge, Firefox and Opera do not call the errorCallback. + promise.catch(resolvePromise); + } + }); + }; +}; + +const createTestAudioContextOptionsSupport = (nativeAudioContextConstructor) => { + return () => { + if (nativeAudioContextConstructor === null) { + return false; + } + let audioContext; + try { + audioContext = new nativeAudioContextConstructor({ latencyHint: 'balanced' }); + } + catch { + return false; + } + audioContext.close(); + return true; + }; +}; + +// Safari up to version 12.0 (but not v12.1) didn't return the destination in case it was an AudioNode. +const createTestAudioNodeConnectMethodSupport = (nativeOfflineAudioContextConstructor) => { + return () => { + if (nativeOfflineAudioContextConstructor === null) { + return false; + } + const nativeOfflineAudioContext = new nativeOfflineAudioContextConstructor(1, 1, 44100); + const nativeGainNode = nativeOfflineAudioContext.createGain(); + const isSupported = nativeGainNode.connect(nativeGainNode) === nativeGainNode; + nativeGainNode.disconnect(nativeGainNode); + return isSupported; + }; +}; + +/** + * Chrome version 66 and 67 did not call the process() function of an AudioWorkletProcessor if it had no outputs. AudioWorklet support was + * enabled by default in version 66. + */ +const createTestAudioWorkletProcessorNoOutputsSupport = (nativeAudioWorkletNodeConstructor, nativeOfflineAudioContextConstructor) => { + return async () => { + // Bug #61: If there is no native AudioWorkletNode it gets faked and therefore it is no problem if the it doesn't exist. + if (nativeAudioWorkletNodeConstructor === null) { + return true; + } + if (nativeOfflineAudioContextConstructor === null) { + return false; + } + const blob = new Blob([ + 'let c,p;class A extends AudioWorkletProcessor{constructor(){super();this.port.onmessage=(e)=>{p=e.data;p.onmessage=()=>{p.postMessage(c);p.close()};this.port.postMessage(0)}}process(){c=1}}registerProcessor("a",A)' + ], { + type: 'application/javascript; charset=utf-8' + }); + const messageChannel = new MessageChannel(); + // Bug #141: Safari does not support creating an OfflineAudioContext with less than 44100 Hz. + const offlineAudioContext = new nativeOfflineAudioContextConstructor(1, 128, 44100); + const url = URL.createObjectURL(blob); + let isCallingProcess = false; + try { + await offlineAudioContext.audioWorklet.addModule(url); + const audioWorkletNode = new nativeAudioWorkletNodeConstructor(offlineAudioContext, 'a', { numberOfOutputs: 0 }); + const oscillator = offlineAudioContext.createOscillator(); + await new Promise((resolve) => { + audioWorkletNode.port.onmessage = () => resolve(); + audioWorkletNode.port.postMessage(messageChannel.port2, [messageChannel.port2]); + }); + audioWorkletNode.port.onmessage = () => (isCallingProcess = true); + oscillator.connect(audioWorkletNode); + oscillator.start(0); + await offlineAudioContext.startRendering(); + isCallingProcess = await new Promise((resolve) => { + messageChannel.port1.onmessage = ({ data }) => resolve(data === 1); + messageChannel.port1.postMessage(0); + }); + } + catch { + // Ignore errors. + } + finally { + messageChannel.port1.close(); + URL.revokeObjectURL(url); + } + return isCallingProcess; + }; +}; + +// Bug #179: Firefox does not allow to transfer any buffer which has been passed to the process() method as an argument. +const createTestAudioWorkletProcessorPostMessageSupport = (nativeAudioWorkletNodeConstructor, nativeOfflineAudioContextConstructor) => { + return async () => { + // Bug #61: If there is no native AudioWorkletNode it gets faked and therefore it is no problem if the it doesn't exist. + if (nativeAudioWorkletNodeConstructor === null) { + return true; + } + if (nativeOfflineAudioContextConstructor === null) { + return false; + } + const blob = new Blob(['class A extends AudioWorkletProcessor{process(i){this.port.postMessage(i,[i[0][0].buffer])}}registerProcessor("a",A)'], { + type: 'application/javascript; charset=utf-8' + }); + // Bug #141: Safari does not support creating an OfflineAudioContext with less than 44100 Hz. + const offlineAudioContext = new nativeOfflineAudioContextConstructor(1, 128, 44100); + const url = URL.createObjectURL(blob); + let isEmittingMessageEvents = false; + let isEmittingProcessorErrorEvents = false; + try { + await offlineAudioContext.audioWorklet.addModule(url); + const audioWorkletNode = new nativeAudioWorkletNodeConstructor(offlineAudioContext, 'a', { numberOfOutputs: 0 }); + const oscillator = offlineAudioContext.createOscillator(); + audioWorkletNode.port.onmessage = () => (isEmittingMessageEvents = true); + audioWorkletNode.onprocessorerror = () => (isEmittingProcessorErrorEvents = true); + oscillator.connect(audioWorkletNode); + oscillator.start(0); + await offlineAudioContext.startRendering(); + } + catch { + // Ignore errors. + } + finally { + URL.revokeObjectURL(url); + } + return isEmittingMessageEvents && !isEmittingProcessorErrorEvents; + }; +}; + +/** + * Firefox up to version 69 did not throw an error when setting a different channelCount or channelCountMode. + */ +const createTestChannelMergerNodeChannelCountSupport = (nativeOfflineAudioContextConstructor) => { + return () => { + if (nativeOfflineAudioContextConstructor === null) { + return false; + } + const offlineAudioContext = new nativeOfflineAudioContextConstructor(1, 1, 44100); + const nativeChannelMergerNode = offlineAudioContext.createChannelMerger(); + /** + * Bug #15: Safari does not return the default properties. It still needs to be patched. This test is supposed to test the support + * in other browsers. + */ + if (nativeChannelMergerNode.channelCountMode === 'max') { + return true; + } + try { + nativeChannelMergerNode.channelCount = 2; + } + catch { + return true; + } + return false; + }; +}; + +const createTestConstantSourceNodeAccurateSchedulingSupport = (nativeOfflineAudioContextConstructor) => { + return () => { + if (nativeOfflineAudioContextConstructor === null) { + return false; + } + const nativeOfflineAudioContext = new nativeOfflineAudioContextConstructor(1, 1, 44100); + // Bug #62: Safari does not support ConstantSourceNodes. + if (nativeOfflineAudioContext.createConstantSource === undefined) { + return true; + } + const nativeConstantSourceNode = nativeOfflineAudioContext.createConstantSource(); + /* + * @todo This is using bug #75 to detect bug #70. That works because both bugs were unique to + * the implementation of Firefox right now, but it could probably be done in a better way. + */ + return nativeConstantSourceNode.offset.maxValue !== Number.POSITIVE_INFINITY; + }; +}; + +// Opera up to version 57 did not allow to reassign the buffer of a ConvolverNode. +const createTestConvolverNodeBufferReassignabilitySupport = (nativeOfflineAudioContextConstructor) => { + return () => { + if (nativeOfflineAudioContextConstructor === null) { + return false; + } + const offlineAudioContext = new nativeOfflineAudioContextConstructor(1, 1, 44100); + const nativeConvolverNode = offlineAudioContext.createConvolver(); + nativeConvolverNode.buffer = offlineAudioContext.createBuffer(1, 1, offlineAudioContext.sampleRate); + try { + nativeConvolverNode.buffer = offlineAudioContext.createBuffer(1, 1, offlineAudioContext.sampleRate); + } + catch { + return false; + } + return true; + }; +}; + +// Chrome up to version v80, Edge up to version v80 and Opera up to version v67 did not allow to set the channelCount property of a ConvolverNode to 1. They also did not allow to set the channelCountMode to 'explicit'. +const createTestConvolverNodeChannelCountSupport = (nativeOfflineAudioContextConstructor) => { + return () => { + if (nativeOfflineAudioContextConstructor === null) { + return false; + } + const offlineAudioContext = new nativeOfflineAudioContextConstructor(1, 1, 44100); + const nativeConvolverNode = offlineAudioContext.createConvolver(); + try { + nativeConvolverNode.channelCount = 1; + } + catch { + return false; + } + return true; + }; +}; + +const createTestIsSecureContextSupport = (window) => { + return () => window !== null && window.hasOwnProperty('isSecureContext'); +}; + +// Firefox up to version 68 did not throw an error when creating a MediaStreamAudioSourceNode with a mediaStream that had no audio track. +const createTestMediaStreamAudioSourceNodeMediaStreamWithoutAudioTrackSupport = (nativeAudioContextConstructor) => { + return () => { + if (nativeAudioContextConstructor === null) { + return false; + } + const audioContext = new nativeAudioContextConstructor(); + try { + audioContext.createMediaStreamSource(new MediaStream()); + return false; + } + catch (err) { + return true; + } + finally { + audioContext.close(); + } + }; +}; + +const createTestOfflineAudioContextCurrentTimeSupport = (createNativeGainNode, nativeOfflineAudioContextConstructor) => { + return () => { + if (nativeOfflineAudioContextConstructor === null) { + return Promise.resolve(false); + } + const nativeOfflineAudioContext = new nativeOfflineAudioContextConstructor(1, 1, 44100); + // Bug #48: Safari does not render an OfflineAudioContext without any connected node. + const gainNode = createNativeGainNode(nativeOfflineAudioContext, { + channelCount: 1, + channelCountMode: 'explicit', + channelInterpretation: 'discrete', + gain: 0 + }); + // Bug #21: Safari does not support promises yet. + return new Promise((resolve) => { + nativeOfflineAudioContext.oncomplete = () => { + gainNode.disconnect(); + resolve(nativeOfflineAudioContext.currentTime !== 0); + }; + nativeOfflineAudioContext.startRendering(); + }); + }; +}; + +/** + * Firefox up to version 62 did not kick off the processing of the StereoPannerNode if the value of pan was zero. + */ +const createTestStereoPannerNodeDefaultValueSupport = (nativeOfflineAudioContextConstructor) => { + return () => { + if (nativeOfflineAudioContextConstructor === null) { + return Promise.resolve(false); + } + const nativeOfflineAudioContext = new nativeOfflineAudioContextConstructor(1, 1, 44100); + /* + * Bug #105: Safari does not support the StereoPannerNode. Therefore the returned value should normally be false but the faker does + * support the tested behaviour. + */ + if (nativeOfflineAudioContext.createStereoPanner === undefined) { + return Promise.resolve(true); + } + // Bug #62: Safari does not support ConstantSourceNodes. + if (nativeOfflineAudioContext.createConstantSource === undefined) { + return Promise.resolve(true); + } + const constantSourceNode = nativeOfflineAudioContext.createConstantSource(); + const stereoPanner = nativeOfflineAudioContext.createStereoPanner(); + constantSourceNode.channelCount = 1; + constantSourceNode.offset.value = 1; + stereoPanner.channelCount = 1; + constantSourceNode.start(); + constantSourceNode.connect(stereoPanner).connect(nativeOfflineAudioContext.destination); + return nativeOfflineAudioContext.startRendering().then((buffer) => buffer.getChannelData(0)[0] !== 1); + }; +}; + +const createUnknownError = () => new DOMException('', 'UnknownError'); + +const DEFAULT_OPTIONS$j = { + channelCount: 2, + channelCountMode: 'max', + channelInterpretation: 'speakers', + curve: null, + oversample: 'none' +}; +const createWaveShaperNodeConstructor = (audioNodeConstructor, createInvalidStateError, createNativeWaveShaperNode, createWaveShaperNodeRenderer, getNativeContext, isNativeOfflineAudioContext, setAudioNodeTailTime) => { + return class WaveShaperNode extends audioNodeConstructor { + constructor(context, options) { + const nativeContext = getNativeContext(context); + const mergedOptions = { ...DEFAULT_OPTIONS$j, ...options }; + const nativeWaveShaperNode = createNativeWaveShaperNode(nativeContext, mergedOptions); + const isOffline = isNativeOfflineAudioContext(nativeContext); + const waveShaperNodeRenderer = (isOffline ? createWaveShaperNodeRenderer() : null); + // @todo Add a mechanism to only switch a WaveShaperNode to active while it is connected. + super(context, true, nativeWaveShaperNode, waveShaperNodeRenderer); + this._isCurveNullified = false; + this._nativeWaveShaperNode = nativeWaveShaperNode; + // @todo Determine a meaningful tail-time instead of just using one second. + setAudioNodeTailTime(this, 1); + } + get curve() { + if (this._isCurveNullified) { + return null; + } + return this._nativeWaveShaperNode.curve; + } + set curve(value) { + // Bug #103: Safari does not allow to set the curve to null. + if (value === null) { + this._isCurveNullified = true; + this._nativeWaveShaperNode.curve = new Float32Array([0, 0]); + } + else { + // Bug #102: Safari does not throw an InvalidStateError when the curve has less than two samples. + // Bug #104: Chrome, Edge and Opera will throw an InvalidAccessError when the curve has less than two samples. + if (value.length < 2) { + throw createInvalidStateError(); + } + this._isCurveNullified = false; + this._nativeWaveShaperNode.curve = value; + } + } + get oversample() { + return this._nativeWaveShaperNode.oversample; + } + set oversample(value) { + this._nativeWaveShaperNode.oversample = value; + } + }; +}; + +const createWaveShaperNodeRendererFactory = (createNativeWaveShaperNode, getNativeAudioNode, renderInputsOfAudioNode) => { + return () => { + const renderedNativeWaveShaperNodes = new WeakMap(); + const createWaveShaperNode = async (proxy, nativeOfflineAudioContext) => { + let nativeWaveShaperNode = getNativeAudioNode(proxy); + // If the initially used nativeWaveShaperNode was not constructed on the same OfflineAudioContext it needs to be created again. + const nativeWaveShaperNodeIsOwnedByContext = isOwnedByContext(nativeWaveShaperNode, nativeOfflineAudioContext); + if (!nativeWaveShaperNodeIsOwnedByContext) { + const options = { + channelCount: nativeWaveShaperNode.channelCount, + channelCountMode: nativeWaveShaperNode.channelCountMode, + channelInterpretation: nativeWaveShaperNode.channelInterpretation, + curve: nativeWaveShaperNode.curve, + oversample: nativeWaveShaperNode.oversample + }; + nativeWaveShaperNode = createNativeWaveShaperNode(nativeOfflineAudioContext, options); + } + renderedNativeWaveShaperNodes.set(nativeOfflineAudioContext, nativeWaveShaperNode); + if (isNativeAudioNodeFaker(nativeWaveShaperNode)) { + await renderInputsOfAudioNode(proxy, nativeOfflineAudioContext, nativeWaveShaperNode.inputs[0]); + } + else { + await renderInputsOfAudioNode(proxy, nativeOfflineAudioContext, nativeWaveShaperNode); + } + return nativeWaveShaperNode; + }; + return { + render(proxy, nativeOfflineAudioContext) { + const renderedNativeWaveShaperNode = renderedNativeWaveShaperNodes.get(nativeOfflineAudioContext); + if (renderedNativeWaveShaperNode !== undefined) { + return Promise.resolve(renderedNativeWaveShaperNode); + } + return createWaveShaperNode(proxy, nativeOfflineAudioContext); + } + }; + }; +}; + +const createWindow = () => (typeof window === 'undefined' ? null : window); + +const createWrapAudioBufferCopyChannelMethods = (convertNumberToUnsignedLong, createIndexSizeError) => { + return (audioBuffer) => { + audioBuffer.copyFromChannel = (destination, channelNumberAsNumber, bufferOffsetAsNumber = 0) => { + const bufferOffset = convertNumberToUnsignedLong(bufferOffsetAsNumber); + const channelNumber = convertNumberToUnsignedLong(channelNumberAsNumber); + if (channelNumber >= audioBuffer.numberOfChannels) { + throw createIndexSizeError(); + } + const audioBufferLength = audioBuffer.length; + const channelData = audioBuffer.getChannelData(channelNumber); + const destinationLength = destination.length; + for (let i = bufferOffset < 0 ? -bufferOffset : 0; i + bufferOffset < audioBufferLength && i < destinationLength; i += 1) { + destination[i] = channelData[i + bufferOffset]; + } + }; + audioBuffer.copyToChannel = (source, channelNumberAsNumber, bufferOffsetAsNumber = 0) => { + const bufferOffset = convertNumberToUnsignedLong(bufferOffsetAsNumber); + const channelNumber = convertNumberToUnsignedLong(channelNumberAsNumber); + if (channelNumber >= audioBuffer.numberOfChannels) { + throw createIndexSizeError(); + } + const audioBufferLength = audioBuffer.length; + const channelData = audioBuffer.getChannelData(channelNumber); + const sourceLength = source.length; + for (let i = bufferOffset < 0 ? -bufferOffset : 0; i + bufferOffset < audioBufferLength && i < sourceLength; i += 1) { + channelData[i + bufferOffset] = source[i]; + } + }; + }; +}; + +const createWrapAudioBufferCopyChannelMethodsOutOfBounds = (convertNumberToUnsignedLong) => { + return (audioBuffer) => { + audioBuffer.copyFromChannel = ((copyFromChannel) => { + return (destination, channelNumberAsNumber, bufferOffsetAsNumber = 0) => { + const bufferOffset = convertNumberToUnsignedLong(bufferOffsetAsNumber); + const channelNumber = convertNumberToUnsignedLong(channelNumberAsNumber); + if (bufferOffset < audioBuffer.length) { + return copyFromChannel.call(audioBuffer, destination, channelNumber, bufferOffset); + } + }; + })(audioBuffer.copyFromChannel); + audioBuffer.copyToChannel = ((copyToChannel) => { + return (source, channelNumberAsNumber, bufferOffsetAsNumber = 0) => { + const bufferOffset = convertNumberToUnsignedLong(bufferOffsetAsNumber); + const channelNumber = convertNumberToUnsignedLong(channelNumberAsNumber); + if (bufferOffset < audioBuffer.length) { + return copyToChannel.call(audioBuffer, source, channelNumber, bufferOffset); + } + }; + })(audioBuffer.copyToChannel); + }; +}; + +const createWrapAudioBufferSourceNodeStopMethodNullifiedBuffer = (overwriteAccessors) => { + return (nativeAudioBufferSourceNode, nativeContext) => { + const nullifiedBuffer = nativeContext.createBuffer(1, 1, 44100); + if (nativeAudioBufferSourceNode.buffer === null) { + nativeAudioBufferSourceNode.buffer = nullifiedBuffer; + } + overwriteAccessors(nativeAudioBufferSourceNode, 'buffer', (get) => () => { + const value = get.call(nativeAudioBufferSourceNode); + return value === nullifiedBuffer ? null : value; + }, (set) => (value) => { + return set.call(nativeAudioBufferSourceNode, value === null ? nullifiedBuffer : value); + }); + }; +}; + +const createWrapChannelMergerNode = (createInvalidStateError, monitorConnections) => { + return (nativeContext, channelMergerNode) => { + // Bug #15: Safari does not return the default properties. + channelMergerNode.channelCount = 1; + channelMergerNode.channelCountMode = 'explicit'; + // Bug #16: Safari does not throw an error when setting a different channelCount or channelCountMode. + Object.defineProperty(channelMergerNode, 'channelCount', { + get: () => 1, + set: () => { + throw createInvalidStateError(); + } + }); + Object.defineProperty(channelMergerNode, 'channelCountMode', { + get: () => 'explicit', + set: () => { + throw createInvalidStateError(); + } + }); + // Bug #20: Safari requires a connection of any kind to treat the input signal correctly. + const audioBufferSourceNode = nativeContext.createBufferSource(); + const whenConnected = () => { + const length = channelMergerNode.numberOfInputs; + for (let i = 0; i < length; i += 1) { + audioBufferSourceNode.connect(channelMergerNode, 0, i); + } + }; + const whenDisconnected = () => audioBufferSourceNode.disconnect(channelMergerNode); + monitorConnections(channelMergerNode, whenConnected, whenDisconnected); + }; +}; + +const getFirstSample = (audioBuffer, buffer, channelNumber) => { + // Bug #5: Safari does not support copyFromChannel() and copyToChannel(). + if (audioBuffer.copyFromChannel === undefined) { + return audioBuffer.getChannelData(channelNumber)[0]; + } + audioBuffer.copyFromChannel(buffer, channelNumber); + return buffer[0]; +}; + +const isDCCurve = (curve) => { + if (curve === null) { + return false; + } + const length = curve.length; + if (length % 2 !== 0) { + return curve[Math.floor(length / 2)] !== 0; + } + return curve[length / 2 - 1] + curve[length / 2] !== 0; +}; + +const overwriteAccessors = (object, property, createGetter, createSetter) => { + let prototype = object; + while (!prototype.hasOwnProperty(property)) { + prototype = Object.getPrototypeOf(prototype); + } + const { get, set } = Object.getOwnPropertyDescriptor(prototype, property); + Object.defineProperty(object, property, { get: createGetter(get), set: createSetter(set) }); +}; + +const sanitizeAudioWorkletNodeOptions = (options) => { + return { + ...options, + outputChannelCount: options.outputChannelCount !== undefined + ? options.outputChannelCount + : options.numberOfInputs === 1 && options.numberOfOutputs === 1 + ? /* + * Bug #61: This should be the computedNumberOfChannels, but unfortunately that is almost impossible to fake. That's why + * the channelCountMode is required to be 'explicit' as long as there is not a native implementation in every browser. That + * makes sure the computedNumberOfChannels is equivilant to the channelCount which makes it much easier to compute. + */ + [options.channelCount] + : Array.from({ length: options.numberOfOutputs }, () => 1) + }; +}; + +const sanitizeChannelSplitterOptions = (options) => { + return { ...options, channelCount: options.numberOfOutputs }; +}; + +const sanitizePeriodicWaveOptions = (options) => { + const { imag, real } = options; + if (imag === undefined) { + if (real === undefined) { + return { ...options, imag: [0, 0], real: [0, 0] }; + } + return { ...options, imag: Array.from(real, () => 0), real }; + } + if (real === undefined) { + return { ...options, imag, real: Array.from(imag, () => 0) }; + } + return { ...options, imag, real }; +}; + +const setValueAtTimeUntilPossible = (audioParam, value, startTime) => { + try { + audioParam.setValueAtTime(value, startTime); + } + catch (err) { + if (err.code !== 9) { + throw err; + } + setValueAtTimeUntilPossible(audioParam, value, startTime + 1e-7); + } +}; + +const testAudioBufferSourceNodeStartMethodConsecutiveCallsSupport = (nativeContext) => { + const nativeAudioBufferSourceNode = nativeContext.createBufferSource(); + nativeAudioBufferSourceNode.start(); + try { + nativeAudioBufferSourceNode.start(); + } + catch { + return true; + } + return false; +}; + +const testAudioBufferSourceNodeStartMethodOffsetClampingSupport = (nativeContext) => { + const nativeAudioBufferSourceNode = nativeContext.createBufferSource(); + const nativeAudioBuffer = nativeContext.createBuffer(1, 1, 44100); + nativeAudioBufferSourceNode.buffer = nativeAudioBuffer; + try { + nativeAudioBufferSourceNode.start(0, 1); + } + catch { + return false; + } + return true; +}; + +const testAudioBufferSourceNodeStopMethodNullifiedBufferSupport = (nativeContext) => { + const nativeAudioBufferSourceNode = nativeContext.createBufferSource(); + nativeAudioBufferSourceNode.start(); + try { + nativeAudioBufferSourceNode.stop(); + } + catch { + return false; + } + return true; +}; + +const testAudioScheduledSourceNodeStartMethodNegativeParametersSupport = (nativeContext) => { + const nativeAudioBufferSourceNode = nativeContext.createOscillator(); + try { + nativeAudioBufferSourceNode.start(-1); + } + catch (err) { + return err instanceof RangeError; + } + return false; +}; + +const testAudioScheduledSourceNodeStopMethodConsecutiveCallsSupport = (nativeContext) => { + const nativeAudioBuffer = nativeContext.createBuffer(1, 1, 44100); + const nativeAudioBufferSourceNode = nativeContext.createBufferSource(); + nativeAudioBufferSourceNode.buffer = nativeAudioBuffer; + nativeAudioBufferSourceNode.start(); + nativeAudioBufferSourceNode.stop(); + try { + nativeAudioBufferSourceNode.stop(); + return true; + } + catch { + return false; + } +}; + +const testAudioScheduledSourceNodeStopMethodNegativeParametersSupport = (nativeContext) => { + const nativeAudioBufferSourceNode = nativeContext.createOscillator(); + try { + nativeAudioBufferSourceNode.stop(-1); + } + catch (err) { + return err instanceof RangeError; + } + return false; +}; + +const testAudioWorkletNodeOptionsClonability = (audioWorkletNodeOptions) => { + const { port1, port2 } = new MessageChannel(); + try { + // This will throw an error if the audioWorkletNodeOptions are not clonable. + port1.postMessage(audioWorkletNodeOptions); + } + finally { + port1.close(); + port2.close(); + } +}; + +/* + * Bug #122: Edge up to version v18 did not allow to construct a DOMException'. It also had a couple more bugs but since this is easy to + * test it's used here as a placeholder. + * + * Bug #27: Edge up to version v18 did reject an invalid arrayBuffer passed to decodeAudioData() with a DOMException. + * + * Bug #50: Edge up to version v18 did not allow to create AudioNodes on a closed context. + * + * Bug #57: Edge up to version v18 did not throw an error when assigning the type of an OscillatorNode to 'custom'. + * + * Bug #63: Edge up to version v18 did not expose the mediaElement property of a MediaElementAudioSourceNode. + * + * Bug #64: Edge up to version v18 did not support the MediaStreamAudioDestinationNode. + * + * Bug #71: Edge up to version v18 did not allow to set the buffer of an AudioBufferSourceNode to null. + * + * Bug #93: Edge up to version v18 did set the sampleRate of an AudioContext to zero when it was closed. + * + * Bug #101: Edge up to version v18 refused to execute decodeAudioData() on a closed context. + * + * Bug #106: Edge up to version v18 did not expose the maxValue and minValue properties of the pan AudioParam of a StereoPannerNode. + * + * Bug #110: Edge up to version v18 did not expose the maxValue and minValue properties of the attack, knee, ratio, release and threshold AudioParams of a DynamicsCompressorNode. + * + * Bug #123: Edge up to version v18 did not support HRTF as the panningModel for a PannerNode. + * + * Bug #145: Edge up to version v18 did throw an IndexSizeError when an OfflineAudioContext was created with a sampleRate of zero. + * + * Bug #161: Edge up to version v18 did not expose the maxValue and minValue properties of the delayTime AudioParam of a DelayNode. + */ +const testDomExceptionConstructorSupport = () => { + try { + new DOMException(); // tslint:disable-line:no-unused-expression + } + catch { + return false; + } + return true; +}; + +// Safari at version 11 did not support transferables. +const testTransferablesSupport = () => new Promise((resolve) => { + const arrayBuffer = new ArrayBuffer(0); + const { port1, port2 } = new MessageChannel(); + port1.onmessage = ({ data }) => resolve(data !== null); + port2.postMessage(arrayBuffer, [arrayBuffer]); +}); + +const wrapAudioBufferSourceNodeStartMethodOffsetClamping = (nativeAudioBufferSourceNode) => { + nativeAudioBufferSourceNode.start = ((start) => { + return (when = 0, offset = 0, duration) => { + const buffer = nativeAudioBufferSourceNode.buffer; + // Bug #154: Safari does not clamp the offset if it is equal to or greater than the duration of the buffer. + const clampedOffset = buffer === null ? offset : Math.min(buffer.duration, offset); + // Bug #155: Safari does not handle the offset correctly if it would cause the buffer to be not be played at all. + if (buffer !== null && clampedOffset > buffer.duration - 0.5 / nativeAudioBufferSourceNode.context.sampleRate) { + start.call(nativeAudioBufferSourceNode, when, 0, 0); + } + else { + start.call(nativeAudioBufferSourceNode, when, clampedOffset, duration); + } + }; + })(nativeAudioBufferSourceNode.start); +}; + +const wrapAudioScheduledSourceNodeStopMethodConsecutiveCalls = (nativeAudioScheduledSourceNode, nativeContext) => { + const nativeGainNode = nativeContext.createGain(); + nativeAudioScheduledSourceNode.connect(nativeGainNode); + const disconnectGainNode = ((disconnect) => { + return () => { + // @todo TypeScript cannot infer the overloaded signature with 1 argument yet. + disconnect.call(nativeAudioScheduledSourceNode, nativeGainNode); + nativeAudioScheduledSourceNode.removeEventListener('ended', disconnectGainNode); + }; + })(nativeAudioScheduledSourceNode.disconnect); + nativeAudioScheduledSourceNode.addEventListener('ended', disconnectGainNode); + interceptConnections(nativeAudioScheduledSourceNode, nativeGainNode); + nativeAudioScheduledSourceNode.stop = ((stop) => { + let isStopped = false; + return (when = 0) => { + if (isStopped) { + try { + stop.call(nativeAudioScheduledSourceNode, when); + } + catch { + nativeGainNode.gain.setValueAtTime(0, when); + } + } + else { + stop.call(nativeAudioScheduledSourceNode, when); + isStopped = true; + } + }; + })(nativeAudioScheduledSourceNode.stop); +}; + +const wrapEventListener = (target, eventListener) => { + return (event) => { + const descriptor = { value: target }; + Object.defineProperties(event, { + currentTarget: descriptor, + target: descriptor + }); + if (typeof eventListener === 'function') { + return eventListener.call(target, event); + } + return eventListener.handleEvent.call(target, event); + }; +}; + +const addActiveInputConnectionToAudioNode = createAddActiveInputConnectionToAudioNode(insertElementInSet); +const addPassiveInputConnectionToAudioNode = createAddPassiveInputConnectionToAudioNode(insertElementInSet); +const deleteActiveInputConnectionToAudioNode = createDeleteActiveInputConnectionToAudioNode(pickElementFromSet); +const audioNodeTailTimeStore = new WeakMap(); +const getAudioNodeTailTime = createGetAudioNodeTailTime(audioNodeTailTimeStore); +const cacheTestResult = createCacheTestResult(new Map(), new WeakMap()); +const window$1 = createWindow(); +const createNativeAnalyserNode = createNativeAnalyserNodeFactory(cacheTestResult, createIndexSizeError); +const getAudioNodeRenderer = createGetAudioNodeRenderer(getAudioNodeConnections); +const renderInputsOfAudioNode = createRenderInputsOfAudioNode(getAudioNodeConnections, getAudioNodeRenderer, isPartOfACycle); +const createAnalyserNodeRenderer = createAnalyserNodeRendererFactory(createNativeAnalyserNode, getNativeAudioNode, renderInputsOfAudioNode); +const getNativeContext = createGetNativeContext(CONTEXT_STORE); +const nativeOfflineAudioContextConstructor = createNativeOfflineAudioContextConstructor(window$1); +const isNativeOfflineAudioContext = createIsNativeOfflineAudioContext(nativeOfflineAudioContextConstructor); +const audioParamAudioNodeStore = new WeakMap(); +const eventTargetConstructor = createEventTargetConstructor(wrapEventListener); +const nativeAudioContextConstructor = createNativeAudioContextConstructor(window$1); +const isNativeAudioContext = createIsNativeAudioContext(nativeAudioContextConstructor); +const isNativeAudioNode$1 = createIsNativeAudioNode(window$1); +const isNativeAudioParam = createIsNativeAudioParam(window$1); +const nativeAudioWorkletNodeConstructor = createNativeAudioWorkletNodeConstructor(window$1); +const audioNodeConstructor = createAudioNodeConstructor(createAddAudioNodeConnections(AUDIO_NODE_CONNECTIONS_STORE), createAddConnectionToAudioNode(addActiveInputConnectionToAudioNode, addPassiveInputConnectionToAudioNode, connectNativeAudioNodeToNativeAudioNode, deleteActiveInputConnectionToAudioNode, disconnectNativeAudioNodeFromNativeAudioNode, getAudioNodeConnections, getAudioNodeTailTime, getEventListenersOfAudioNode, getNativeAudioNode, insertElementInSet, isActiveAudioNode, isPartOfACycle, isPassiveAudioNode), cacheTestResult, createIncrementCycleCounterFactory(CYCLE_COUNTERS, disconnectNativeAudioNodeFromNativeAudioNode, getAudioNodeConnections, getNativeAudioNode, getNativeAudioParam, isActiveAudioNode), createIndexSizeError, createInvalidAccessError, createNotSupportedError, createDecrementCycleCounter(connectNativeAudioNodeToNativeAudioNode, CYCLE_COUNTERS, getAudioNodeConnections, getNativeAudioNode, getNativeAudioParam, getNativeContext, isActiveAudioNode, isNativeOfflineAudioContext), createDetectCycles(audioParamAudioNodeStore, getAudioNodeConnections, getValueForKey), eventTargetConstructor, getNativeContext, isNativeAudioContext, isNativeAudioNode$1, isNativeAudioParam, isNativeOfflineAudioContext, nativeAudioWorkletNodeConstructor); +const analyserNodeConstructor = createAnalyserNodeConstructor(audioNodeConstructor, createAnalyserNodeRenderer, createIndexSizeError, createNativeAnalyserNode, getNativeContext, isNativeOfflineAudioContext); +const audioBufferStore = new WeakSet(); +const nativeAudioBufferConstructor = createNativeAudioBufferConstructor(window$1); +const convertNumberToUnsignedLong = createConvertNumberToUnsignedLong(new Uint32Array(1)); +const wrapAudioBufferCopyChannelMethods = createWrapAudioBufferCopyChannelMethods(convertNumberToUnsignedLong, createIndexSizeError); +const wrapAudioBufferCopyChannelMethodsOutOfBounds = createWrapAudioBufferCopyChannelMethodsOutOfBounds(convertNumberToUnsignedLong); +const audioBufferConstructor = createAudioBufferConstructor(audioBufferStore, cacheTestResult, createNotSupportedError, nativeAudioBufferConstructor, nativeOfflineAudioContextConstructor, createTestAudioBufferConstructorSupport(nativeAudioBufferConstructor), wrapAudioBufferCopyChannelMethods, wrapAudioBufferCopyChannelMethodsOutOfBounds); +const addSilentConnection = createAddSilentConnection(createNativeGainNode); +const renderInputsOfAudioParam = createRenderInputsOfAudioParam(getAudioNodeRenderer, getAudioParamConnections, isPartOfACycle); +const connectAudioParam = createConnectAudioParam(renderInputsOfAudioParam); +const createNativeAudioBufferSourceNode = createNativeAudioBufferSourceNodeFactory(addSilentConnection, cacheTestResult, testAudioBufferSourceNodeStartMethodConsecutiveCallsSupport, testAudioBufferSourceNodeStartMethodOffsetClampingSupport, testAudioBufferSourceNodeStopMethodNullifiedBufferSupport, testAudioScheduledSourceNodeStartMethodNegativeParametersSupport, testAudioScheduledSourceNodeStopMethodConsecutiveCallsSupport, testAudioScheduledSourceNodeStopMethodNegativeParametersSupport, wrapAudioBufferSourceNodeStartMethodOffsetClamping, createWrapAudioBufferSourceNodeStopMethodNullifiedBuffer(overwriteAccessors), wrapAudioScheduledSourceNodeStopMethodConsecutiveCalls); +const renderAutomation = createRenderAutomation(createGetAudioParamRenderer(getAudioParamConnections), renderInputsOfAudioParam); +const createAudioBufferSourceNodeRenderer = createAudioBufferSourceNodeRendererFactory(connectAudioParam, createNativeAudioBufferSourceNode, getNativeAudioNode, renderAutomation, renderInputsOfAudioNode); +const createAudioParam = createAudioParamFactory(createAddAudioParamConnections(AUDIO_PARAM_CONNECTIONS_STORE), audioParamAudioNodeStore, AUDIO_PARAM_STORE, createAudioParamRenderer, createCancelAndHoldAutomationEvent, createCancelScheduledValuesAutomationEvent, createExponentialRampToValueAutomationEvent, createLinearRampToValueAutomationEvent, createSetTargetAutomationEvent, createSetValueAutomationEvent, createSetValueCurveAutomationEvent, nativeAudioContextConstructor, setValueAtTimeUntilPossible); +const audioBufferSourceNodeConstructor = createAudioBufferSourceNodeConstructor(audioNodeConstructor, createAudioBufferSourceNodeRenderer, createAudioParam, createInvalidStateError, createNativeAudioBufferSourceNode, getNativeContext, isNativeOfflineAudioContext, wrapEventListener); +const audioDestinationNodeConstructor = createAudioDestinationNodeConstructor(audioNodeConstructor, createAudioDestinationNodeRenderer, createIndexSizeError, createInvalidStateError, createNativeAudioDestinationNodeFactory(createNativeGainNode, overwriteAccessors), getNativeContext, isNativeOfflineAudioContext, renderInputsOfAudioNode); +const createBiquadFilterNodeRenderer = createBiquadFilterNodeRendererFactory(connectAudioParam, createNativeBiquadFilterNode, getNativeAudioNode, renderAutomation, renderInputsOfAudioNode); +const setAudioNodeTailTime = createSetAudioNodeTailTime(audioNodeTailTimeStore); +const biquadFilterNodeConstructor = createBiquadFilterNodeConstructor(audioNodeConstructor, createAudioParam, createBiquadFilterNodeRenderer, createInvalidAccessError, createNativeBiquadFilterNode, getNativeContext, isNativeOfflineAudioContext, setAudioNodeTailTime); +const monitorConnections = createMonitorConnections(insertElementInSet, isNativeAudioNode$1); +const wrapChannelMergerNode = createWrapChannelMergerNode(createInvalidStateError, monitorConnections); +const createNativeChannelMergerNode = createNativeChannelMergerNodeFactory(nativeAudioContextConstructor, wrapChannelMergerNode); +const createChannelMergerNodeRenderer = createChannelMergerNodeRendererFactory(createNativeChannelMergerNode, getNativeAudioNode, renderInputsOfAudioNode); +const channelMergerNodeConstructor = createChannelMergerNodeConstructor(audioNodeConstructor, createChannelMergerNodeRenderer, createNativeChannelMergerNode, getNativeContext, isNativeOfflineAudioContext); +const createChannelSplitterNodeRenderer = createChannelSplitterNodeRendererFactory(createNativeChannelSplitterNode, getNativeAudioNode, renderInputsOfAudioNode); +const channelSplitterNodeConstructor = createChannelSplitterNodeConstructor(audioNodeConstructor, createChannelSplitterNodeRenderer, createNativeChannelSplitterNode, getNativeContext, isNativeOfflineAudioContext, sanitizeChannelSplitterOptions); +const createNativeConstantSourceNodeFaker = createNativeConstantSourceNodeFakerFactory(addSilentConnection, createNativeAudioBufferSourceNode, createNativeGainNode, monitorConnections); +const createNativeConstantSourceNode = createNativeConstantSourceNodeFactory(addSilentConnection, cacheTestResult, createNativeConstantSourceNodeFaker, testAudioScheduledSourceNodeStartMethodNegativeParametersSupport, testAudioScheduledSourceNodeStopMethodNegativeParametersSupport); +const createConstantSourceNodeRenderer = createConstantSourceNodeRendererFactory(connectAudioParam, createNativeConstantSourceNode, getNativeAudioNode, renderAutomation, renderInputsOfAudioNode); +const constantSourceNodeConstructor = createConstantSourceNodeConstructor(audioNodeConstructor, createAudioParam, createConstantSourceNodeRenderer, createNativeConstantSourceNode, getNativeContext, isNativeOfflineAudioContext, wrapEventListener); +const createNativeConvolverNode = createNativeConvolverNodeFactory(createNotSupportedError, overwriteAccessors); +const createConvolverNodeRenderer = createConvolverNodeRendererFactory(createNativeConvolverNode, getNativeAudioNode, renderInputsOfAudioNode); +const convolverNodeConstructor = createConvolverNodeConstructor(audioNodeConstructor, createConvolverNodeRenderer, createNativeConvolverNode, getNativeContext, isNativeOfflineAudioContext, setAudioNodeTailTime); +const createDelayNodeRenderer = createDelayNodeRendererFactory(connectAudioParam, createNativeDelayNode, getNativeAudioNode, renderAutomation, renderInputsOfAudioNode); +const delayNodeConstructor = createDelayNodeConstructor(audioNodeConstructor, createAudioParam, createDelayNodeRenderer, createNativeDelayNode, getNativeContext, isNativeOfflineAudioContext, setAudioNodeTailTime); +const createNativeDynamicsCompressorNode = createNativeDynamicsCompressorNodeFactory(createNotSupportedError); +const createDynamicsCompressorNodeRenderer = createDynamicsCompressorNodeRendererFactory(connectAudioParam, createNativeDynamicsCompressorNode, getNativeAudioNode, renderAutomation, renderInputsOfAudioNode); +const dynamicsCompressorNodeConstructor = createDynamicsCompressorNodeConstructor(audioNodeConstructor, createAudioParam, createDynamicsCompressorNodeRenderer, createNativeDynamicsCompressorNode, createNotSupportedError, getNativeContext, isNativeOfflineAudioContext, setAudioNodeTailTime); +const createGainNodeRenderer = createGainNodeRendererFactory(connectAudioParam, createNativeGainNode, getNativeAudioNode, renderAutomation, renderInputsOfAudioNode); +const gainNodeConstructor = createGainNodeConstructor(audioNodeConstructor, createAudioParam, createGainNodeRenderer, createNativeGainNode, getNativeContext, isNativeOfflineAudioContext); +const createNativeIIRFilterNodeFaker = createNativeIIRFilterNodeFakerFactory(createInvalidAccessError, createInvalidStateError, createNativeScriptProcessorNode, createNotSupportedError); +const renderNativeOfflineAudioContext = createRenderNativeOfflineAudioContext(cacheTestResult, createNativeGainNode, createNativeScriptProcessorNode, createTestOfflineAudioContextCurrentTimeSupport(createNativeGainNode, nativeOfflineAudioContextConstructor)); +const createIIRFilterNodeRenderer = createIIRFilterNodeRendererFactory(createNativeAudioBufferSourceNode, getNativeAudioNode, nativeOfflineAudioContextConstructor, renderInputsOfAudioNode, renderNativeOfflineAudioContext); +const createNativeIIRFilterNode = createNativeIIRFilterNodeFactory(createNativeIIRFilterNodeFaker); +const iIRFilterNodeConstructor = createIIRFilterNodeConstructor(audioNodeConstructor, createNativeIIRFilterNode, createIIRFilterNodeRenderer, getNativeContext, isNativeOfflineAudioContext, setAudioNodeTailTime); +const createAudioListener = createAudioListenerFactory(createAudioParam, createNativeChannelMergerNode, createNativeConstantSourceNode, createNativeScriptProcessorNode, createNotSupportedError, getFirstSample, isNativeOfflineAudioContext, overwriteAccessors); +const unrenderedAudioWorkletNodeStore = new WeakMap(); +const minimalBaseAudioContextConstructor = createMinimalBaseAudioContextConstructor(audioDestinationNodeConstructor, createAudioListener, eventTargetConstructor, isNativeOfflineAudioContext, unrenderedAudioWorkletNodeStore, wrapEventListener); +const createNativeOscillatorNode = createNativeOscillatorNodeFactory(addSilentConnection, cacheTestResult, testAudioScheduledSourceNodeStartMethodNegativeParametersSupport, testAudioScheduledSourceNodeStopMethodConsecutiveCallsSupport, testAudioScheduledSourceNodeStopMethodNegativeParametersSupport, wrapAudioScheduledSourceNodeStopMethodConsecutiveCalls); +const createOscillatorNodeRenderer = createOscillatorNodeRendererFactory(connectAudioParam, createNativeOscillatorNode, getNativeAudioNode, renderAutomation, renderInputsOfAudioNode); +const oscillatorNodeConstructor = createOscillatorNodeConstructor(audioNodeConstructor, createAudioParam, createNativeOscillatorNode, createOscillatorNodeRenderer, getNativeContext, isNativeOfflineAudioContext, wrapEventListener); +const createConnectedNativeAudioBufferSourceNode = createConnectedNativeAudioBufferSourceNodeFactory(createNativeAudioBufferSourceNode); +const createNativeWaveShaperNodeFaker = createNativeWaveShaperNodeFakerFactory(createConnectedNativeAudioBufferSourceNode, createInvalidStateError, createNativeGainNode, isDCCurve, monitorConnections); +const createNativeWaveShaperNode = createNativeWaveShaperNodeFactory(createConnectedNativeAudioBufferSourceNode, createInvalidStateError, createNativeWaveShaperNodeFaker, isDCCurve, monitorConnections, nativeAudioContextConstructor, overwriteAccessors); +const createNativePannerNodeFaker = createNativePannerNodeFakerFactory(connectNativeAudioNodeToNativeAudioNode, createInvalidStateError, createNativeChannelMergerNode, createNativeGainNode, createNativeScriptProcessorNode, createNativeWaveShaperNode, createNotSupportedError, disconnectNativeAudioNodeFromNativeAudioNode, getFirstSample, monitorConnections); +const createNativePannerNode = createNativePannerNodeFactory(createNativePannerNodeFaker); +const createPannerNodeRenderer = createPannerNodeRendererFactory(connectAudioParam, createNativeChannelMergerNode, createNativeConstantSourceNode, createNativeGainNode, createNativePannerNode, getNativeAudioNode, nativeOfflineAudioContextConstructor, renderAutomation, renderInputsOfAudioNode, renderNativeOfflineAudioContext); +const pannerNodeConstructor = createPannerNodeConstructor(audioNodeConstructor, createAudioParam, createNativePannerNode, createPannerNodeRenderer, getNativeContext, isNativeOfflineAudioContext, setAudioNodeTailTime); +const createNativePeriodicWave = createNativePeriodicWaveFactory(createIndexSizeError); +const periodicWaveConstructor = createPeriodicWaveConstructor(createNativePeriodicWave, getNativeContext, new WeakSet(), sanitizePeriodicWaveOptions); +const nativeStereoPannerNodeFakerFactory = createNativeStereoPannerNodeFakerFactory(createNativeChannelMergerNode, createNativeChannelSplitterNode, createNativeGainNode, createNativeWaveShaperNode, createNotSupportedError, monitorConnections); +const createNativeStereoPannerNode = createNativeStereoPannerNodeFactory(nativeStereoPannerNodeFakerFactory, createNotSupportedError); +const createStereoPannerNodeRenderer = createStereoPannerNodeRendererFactory(connectAudioParam, createNativeStereoPannerNode, getNativeAudioNode, renderAutomation, renderInputsOfAudioNode); +const stereoPannerNodeConstructor = createStereoPannerNodeConstructor(audioNodeConstructor, createAudioParam, createNativeStereoPannerNode, createStereoPannerNodeRenderer, getNativeContext, isNativeOfflineAudioContext); +const createWaveShaperNodeRenderer = createWaveShaperNodeRendererFactory(createNativeWaveShaperNode, getNativeAudioNode, renderInputsOfAudioNode); +const waveShaperNodeConstructor = createWaveShaperNodeConstructor(audioNodeConstructor, createInvalidStateError, createNativeWaveShaperNode, createWaveShaperNodeRenderer, getNativeContext, isNativeOfflineAudioContext, setAudioNodeTailTime); +const isSecureContext = createIsSecureContext(window$1); +const exposeCurrentFrameAndCurrentTime = createExposeCurrentFrameAndCurrentTime(window$1); +const backupOfflineAudioContextStore = new WeakMap(); +const getOrCreateBackupOfflineAudioContext = createGetOrCreateBackupOfflineAudioContext(backupOfflineAudioContextStore, nativeOfflineAudioContextConstructor); +// The addAudioWorkletModule() function is only available in a SecureContext. +const addAudioWorkletModule = isSecureContext + ? createAddAudioWorkletModule(cacheTestResult, createNotSupportedError, createEvaluateSource(window$1), exposeCurrentFrameAndCurrentTime, createFetchSource(createAbortError), getNativeContext, getOrCreateBackupOfflineAudioContext, isNativeOfflineAudioContext, nativeAudioWorkletNodeConstructor, new WeakMap(), new WeakMap(), createTestAudioWorkletProcessorPostMessageSupport(nativeAudioWorkletNodeConstructor, nativeOfflineAudioContextConstructor), + // @todo window is guaranteed to be defined because isSecureContext checks that as well. + window$1) + : undefined; +const isNativeContext = createIsNativeContext(isNativeAudioContext, isNativeOfflineAudioContext); +const decodeAudioData = createDecodeAudioData(audioBufferStore, cacheTestResult, createDataCloneError, createEncodingError, new WeakSet(), getNativeContext, isNativeContext, testAudioBufferCopyChannelMethodsOutOfBoundsSupport, testPromiseSupport, wrapAudioBufferCopyChannelMethods, wrapAudioBufferCopyChannelMethodsOutOfBounds); +const baseAudioContextConstructor = createBaseAudioContextConstructor(addAudioWorkletModule, analyserNodeConstructor, audioBufferConstructor, audioBufferSourceNodeConstructor, biquadFilterNodeConstructor, channelMergerNodeConstructor, channelSplitterNodeConstructor, constantSourceNodeConstructor, convolverNodeConstructor, decodeAudioData, delayNodeConstructor, dynamicsCompressorNodeConstructor, gainNodeConstructor, iIRFilterNodeConstructor, minimalBaseAudioContextConstructor, oscillatorNodeConstructor, pannerNodeConstructor, periodicWaveConstructor, stereoPannerNodeConstructor, waveShaperNodeConstructor); +const mediaElementAudioSourceNodeConstructor = createMediaElementAudioSourceNodeConstructor(audioNodeConstructor, createNativeMediaElementAudioSourceNode, getNativeContext, isNativeOfflineAudioContext); +const mediaStreamAudioDestinationNodeConstructor = createMediaStreamAudioDestinationNodeConstructor(audioNodeConstructor, createNativeMediaStreamAudioDestinationNode, getNativeContext, isNativeOfflineAudioContext); +const mediaStreamAudioSourceNodeConstructor = createMediaStreamAudioSourceNodeConstructor(audioNodeConstructor, createNativeMediaStreamAudioSourceNode, getNativeContext, isNativeOfflineAudioContext); +const createNativeMediaStreamTrackAudioSourceNode = createNativeMediaStreamTrackAudioSourceNodeFactory(createInvalidStateError, isNativeOfflineAudioContext); +const mediaStreamTrackAudioSourceNodeConstructor = createMediaStreamTrackAudioSourceNodeConstructor(audioNodeConstructor, createNativeMediaStreamTrackAudioSourceNode, getNativeContext); +const audioContextConstructor = createAudioContextConstructor(baseAudioContextConstructor, createInvalidStateError, createNotSupportedError, createUnknownError, mediaElementAudioSourceNodeConstructor, mediaStreamAudioDestinationNodeConstructor, mediaStreamAudioSourceNodeConstructor, mediaStreamTrackAudioSourceNodeConstructor, nativeAudioContextConstructor); +const getUnrenderedAudioWorkletNodes = createGetUnrenderedAudioWorkletNodes(unrenderedAudioWorkletNodeStore); +const addUnrenderedAudioWorkletNode = createAddUnrenderedAudioWorkletNode(getUnrenderedAudioWorkletNodes); +const connectMultipleOutputs = createConnectMultipleOutputs(createIndexSizeError); +const deleteUnrenderedAudioWorkletNode = createDeleteUnrenderedAudioWorkletNode(getUnrenderedAudioWorkletNodes); +const disconnectMultipleOutputs = createDisconnectMultipleOutputs(createIndexSizeError); +const activeAudioWorkletNodeInputsStore = new WeakMap(); +const getActiveAudioWorkletNodeInputs = createGetActiveAudioWorkletNodeInputs(activeAudioWorkletNodeInputsStore, getValueForKey); +const createNativeAudioWorkletNodeFaker = createNativeAudioWorkletNodeFakerFactory(connectMultipleOutputs, createIndexSizeError, createInvalidStateError, createNativeChannelMergerNode, createNativeChannelSplitterNode, createNativeConstantSourceNode, createNativeGainNode, createNativeScriptProcessorNode, createNotSupportedError, disconnectMultipleOutputs, exposeCurrentFrameAndCurrentTime, getActiveAudioWorkletNodeInputs, monitorConnections); +const createNativeAudioWorkletNode = createNativeAudioWorkletNodeFactory(createInvalidStateError, createNativeAudioWorkletNodeFaker, createNativeGainNode, createNotSupportedError, monitorConnections); +const createAudioWorkletNodeRenderer = createAudioWorkletNodeRendererFactory(connectAudioParam, connectMultipleOutputs, createNativeAudioBufferSourceNode, createNativeChannelMergerNode, createNativeChannelSplitterNode, createNativeConstantSourceNode, createNativeGainNode, deleteUnrenderedAudioWorkletNode, disconnectMultipleOutputs, exposeCurrentFrameAndCurrentTime, getNativeAudioNode, nativeAudioWorkletNodeConstructor, nativeOfflineAudioContextConstructor, renderAutomation, renderInputsOfAudioNode, renderNativeOfflineAudioContext); +const getBackupOfflineAudioContext = createGetBackupOfflineAudioContext(backupOfflineAudioContextStore); +const setActiveAudioWorkletNodeInputs = createSetActiveAudioWorkletNodeInputs(activeAudioWorkletNodeInputsStore); +// The AudioWorkletNode constructor is only available in a SecureContext. +const audioWorkletNodeConstructor = isSecureContext + ? createAudioWorkletNodeConstructor(addUnrenderedAudioWorkletNode, audioNodeConstructor, createAudioParam, createAudioWorkletNodeRenderer, createNativeAudioWorkletNode, getAudioNodeConnections, getBackupOfflineAudioContext, getNativeContext, isNativeOfflineAudioContext, nativeAudioWorkletNodeConstructor, sanitizeAudioWorkletNodeOptions, setActiveAudioWorkletNodeInputs, testAudioWorkletNodeOptionsClonability, wrapEventListener) + : undefined; +const createNativeOfflineAudioContext = createCreateNativeOfflineAudioContext(createNotSupportedError, nativeOfflineAudioContextConstructor); +const startRendering = createStartRendering(audioBufferStore, cacheTestResult, getAudioNodeRenderer, getUnrenderedAudioWorkletNodes, renderNativeOfflineAudioContext, testAudioBufferCopyChannelMethodsOutOfBoundsSupport, wrapAudioBufferCopyChannelMethods, wrapAudioBufferCopyChannelMethodsOutOfBounds); +const offlineAudioContextConstructor = createOfflineAudioContextConstructor(baseAudioContextConstructor, cacheTestResult, createInvalidStateError, createNativeOfflineAudioContext, startRendering); +const isAnyAudioContext = createIsAnyAudioContext(CONTEXT_STORE, isNativeAudioContext); +const isAnyAudioNode = createIsAnyAudioNode(AUDIO_NODE_STORE, isNativeAudioNode$1); +const isAnyAudioParam = createIsAnyAudioParam(AUDIO_PARAM_STORE, isNativeAudioParam); +const isAnyOfflineAudioContext = createIsAnyOfflineAudioContext(CONTEXT_STORE, isNativeOfflineAudioContext); +const isSupported = () => createIsSupportedPromise(cacheTestResult, createTestAudioBufferCopyChannelMethodsSubarraySupport(nativeOfflineAudioContextConstructor), createTestAudioContextCloseMethodSupport(nativeAudioContextConstructor), createTestAudioContextDecodeAudioDataMethodTypeErrorSupport(nativeOfflineAudioContextConstructor), createTestAudioContextOptionsSupport(nativeAudioContextConstructor), createTestAudioNodeConnectMethodSupport(nativeOfflineAudioContextConstructor), createTestAudioWorkletProcessorNoOutputsSupport(nativeAudioWorkletNodeConstructor, nativeOfflineAudioContextConstructor), createTestChannelMergerNodeChannelCountSupport(nativeOfflineAudioContextConstructor), createTestConstantSourceNodeAccurateSchedulingSupport(nativeOfflineAudioContextConstructor), createTestConvolverNodeBufferReassignabilitySupport(nativeOfflineAudioContextConstructor), createTestConvolverNodeChannelCountSupport(nativeOfflineAudioContextConstructor), testDomExceptionConstructorSupport, createTestIsSecureContextSupport(window$1), createTestMediaStreamAudioSourceNodeMediaStreamWithoutAudioTrackSupport(nativeAudioContextConstructor), createTestStereoPannerNodeDefaultValueSupport(nativeOfflineAudioContextConstructor), testTransferablesSupport); + +/** + * Assert that the statement is true, otherwise invoke the error. + * @param statement + * @param error The message which is passed into an Error + */ +function assert(statement, error) { + if (!statement) { + throw new Error(error); + } +} +/** + * Make sure that the given value is within the range + */ +function assertRange(value, gte, lte = Infinity) { + if (!(gte <= value && value <= lte)) { + throw new RangeError(`Value must be within [${gte}, ${lte}], got: ${value}`); + } +} +/** + * Make sure that the given value is within the range + */ +function assertContextRunning(context) { + // add a warning if the context is not started + if (!context.isOffline && context.state !== "running") { + warn("The AudioContext is \"suspended\". Invoke Tone.start() from a user action to start the audio."); + } +} +/** + * The default logger is the console + */ +let defaultLogger = console; +/** + * Set the logging interface + */ +function setLogger(logger) { + defaultLogger = logger; +} +/** + * Log anything + */ +function log(...args) { + defaultLogger.log(...args); +} +/** + * Warn anything + */ +function warn(...args) { + defaultLogger.warn(...args); +} + +var Debug = /*#__PURE__*/Object.freeze({ + __proto__: null, + assert: assert, + assertRange: assertRange, + assertContextRunning: assertContextRunning, + setLogger: setLogger, + log: log, + warn: warn +}); + +/** + * Test if the arg is undefined + */ +function isUndef(arg) { + return typeof arg === "undefined"; +} +/** + * Test if the arg is not undefined + */ +function isDefined(arg) { + return !isUndef(arg); +} +/** + * Test if the arg is a function + */ +function isFunction(arg) { + return typeof arg === "function"; +} +/** + * Test if the argument is a number. + */ +function isNumber(arg) { + return (typeof arg === "number"); +} +/** + * Test if the given argument is an object literal (i.e. `{}`); + */ +function isObject(arg) { + return (Object.prototype.toString.call(arg) === "[object Object]" && arg.constructor === Object); +} +/** + * Test if the argument is a boolean. + */ +function isBoolean(arg) { + return (typeof arg === "boolean"); +} +/** + * Test if the argument is an Array + */ +function isArray(arg) { + return (Array.isArray(arg)); +} +/** + * Test if the argument is a string. + */ +function isString(arg) { + return (typeof arg === "string"); +} +/** + * Test if the argument is in the form of a note in scientific pitch notation. + * e.g. "C4" + */ +function isNote(arg) { + return isString(arg) && /^([a-g]{1}(?:b|#|x|bb)?)(-?[0-9]+)/i.test(arg); +} + +/** + * Create a new AudioContext + */ +function createAudioContext(options) { + return new audioContextConstructor(options); +} +/** + * Create a new OfflineAudioContext + */ +function createOfflineAudioContext(channels, length, sampleRate) { + return new offlineAudioContextConstructor(channels, length, sampleRate); +} +/** + * A reference to the window object + * @hidden + */ +const theWindow = typeof self === "object" ? self : null; +/** + * If the browser has a window object which has an AudioContext + * @hidden + */ +const hasAudioContext = theWindow && + (theWindow.hasOwnProperty("AudioContext") || theWindow.hasOwnProperty("webkitAudioContext")); +function createAudioWorkletNode(context, name, options) { + assert(isDefined(audioWorkletNodeConstructor), "This node only works in a secure context (https or localhost)"); + // @ts-ignore + return new audioWorkletNodeConstructor(context, name, options); +} + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +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. +***************************************************************************** */ + +function __decorate(decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +} + +function __awaiter(thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +} + +/** + * A class which provides a reliable callback using either + * a Web Worker, or if that isn't supported, falls back to setTimeout. + */ +class Ticker { + constructor(callback, type, updateInterval) { + this._callback = callback; + this._type = type; + this._updateInterval = updateInterval; + // create the clock source for the first time + this._createClock(); + } + /** + * Generate a web worker + */ + _createWorker() { + const blob = new Blob([ + /* javascript */ ` + // the initial timeout time + let timeoutTime = ${(this._updateInterval * 1000).toFixed(1)}; + // onmessage callback + self.onmessage = function(msg){ + timeoutTime = parseInt(msg.data); + }; + // the tick function which posts a message + // and schedules a new tick + function tick(){ + setTimeout(tick, timeoutTime); + self.postMessage('tick'); + } + // call tick initially + tick(); + ` + ], { type: "text/javascript" }); + const blobUrl = URL.createObjectURL(blob); + const worker = new Worker(blobUrl); + worker.onmessage = this._callback.bind(this); + this._worker = worker; + } + /** + * Create a timeout loop + */ + _createTimeout() { + this._timeout = setTimeout(() => { + this._createTimeout(); + this._callback(); + }, this._updateInterval * 1000); + } + /** + * Create the clock source. + */ + _createClock() { + if (this._type === "worker") { + try { + this._createWorker(); + } + catch (e) { + // workers not supported, fallback to timeout + this._type = "timeout"; + this._createClock(); + } + } + else if (this._type === "timeout") { + this._createTimeout(); + } + } + /** + * Clean up the current clock source + */ + _disposeClock() { + if (this._timeout) { + clearTimeout(this._timeout); + this._timeout = 0; + } + if (this._worker) { + this._worker.terminate(); + this._worker.onmessage = null; + } + } + /** + * The rate in seconds the ticker will update + */ + get updateInterval() { + return this._updateInterval; + } + set updateInterval(interval) { + this._updateInterval = Math.max(interval, 128 / 44100); + if (this._type === "worker") { + this._worker.postMessage(Math.max(interval * 1000, 1)); + } + } + /** + * The type of the ticker, either a worker or a timeout + */ + get type() { + return this._type; + } + set type(type) { + this._disposeClock(); + this._type = type; + this._createClock(); + } + /** + * Clean up + */ + dispose() { + this._disposeClock(); + } +} + +/** + * Test if the given value is an instanceof AudioParam + */ +function isAudioParam(arg) { + return isAnyAudioParam(arg); +} +/** + * Test if the given value is an instanceof AudioNode + */ +function isAudioNode$1(arg) { + return isAnyAudioNode(arg); +} +/** + * Test if the arg is instanceof an OfflineAudioContext + */ +function isOfflineAudioContext(arg) { + return isAnyOfflineAudioContext(arg); +} +/** + * Test if the arg is an instanceof AudioContext + */ +function isAudioContext(arg) { + return isAnyAudioContext(arg); +} +/** + * Test if the arg is instanceof an AudioBuffer + */ +function isAudioBuffer(arg) { + return arg instanceof AudioBuffer; +} + +/** + * Some objects should not be merged + */ +function noCopy(key, arg) { + return key === "value" || isAudioParam(arg) || isAudioNode$1(arg) || isAudioBuffer(arg); +} +function deepMerge(target, ...sources) { + if (!sources.length) { + return target; + } + const source = sources.shift(); + if (isObject(target) && isObject(source)) { + for (const key in source) { + if (noCopy(key, source[key])) { + target[key] = source[key]; + } + else if (isObject(source[key])) { + if (!target[key]) { + Object.assign(target, { [key]: {} }); + } + deepMerge(target[key], source[key]); + } + else { + Object.assign(target, { [key]: source[key] }); + } + } + } + // @ts-ignore + return deepMerge(target, ...sources); +} +/** + * Returns true if the two arrays have the same value for each of the elements + */ +function deepEquals(arrayA, arrayB) { + return arrayA.length === arrayB.length && arrayA.every((element, index) => arrayB[index] === element); +} +/** + * Convert an args array into an object. + */ +function optionsFromArguments(defaults, argsArray, keys = [], objKey) { + const opts = {}; + const args = Array.from(argsArray); + // if the first argument is an object and has an object key + if (isObject(args[0]) && objKey && !Reflect.has(args[0], objKey)) { + // if it's not part of the defaults + const partOfDefaults = Object.keys(args[0]).some(key => Reflect.has(defaults, key)); + if (!partOfDefaults) { + // merge that key + deepMerge(opts, { [objKey]: args[0] }); + // remove the obj key from the keys + keys.splice(keys.indexOf(objKey), 1); + // shift the first argument off + args.shift(); + } + } + if (args.length === 1 && isObject(args[0])) { + deepMerge(opts, args[0]); + } + else { + for (let i = 0; i < keys.length; i++) { + if (isDefined(args[i])) { + opts[keys[i]] = args[i]; + } + } + } + return deepMerge(defaults, opts); +} +/** + * Return this instances default values by calling Constructor.getDefaults() + */ +function getDefaultsFromInstance(instance) { + return instance.constructor.getDefaults(); +} +/** + * Returns the fallback if the given object is undefined. + * Take an array of arguments and return a formatted options object. + */ +function defaultArg(given, fallback) { + if (isUndef(given)) { + return fallback; + } + else { + return given; + } +} +/** + * Remove all of the properties belonging to omit from obj. + */ +function omitFromObject(obj, omit) { + omit.forEach(prop => { + if (Reflect.has(obj, prop)) { + delete obj[prop]; + } + }); + return obj; +} + +/** + * Tone.js + * @author Yotam Mann + * @license http://opensource.org/licenses/MIT MIT License + * @copyright 2014-2019 Yotam Mann + */ +/** + * @class Tone is the base class of all other classes. + * @category Core + * @constructor + */ +class Tone { + constructor() { + //------------------------------------- + // DEBUGGING + //------------------------------------- + /** + * Set this debug flag to log all events that happen in this class. + */ + this.debug = false; + //------------------------------------- + // DISPOSING + //------------------------------------- + /** + * Indicates if the instance was disposed + */ + this._wasDisposed = false; + } + /** + * Returns all of the default options belonging to the class. + */ + static getDefaults() { + return {}; + } + /** + * Prints the outputs to the console log for debugging purposes. + * Prints the contents only if either the object has a property + * called `debug` set to true, or a variable called TONE_DEBUG_CLASS + * is set to the name of the class. + * @example + * const osc = new Tone.Oscillator(); + * // prints all logs originating from this oscillator + * osc.debug = true; + * // calls to start/stop will print in the console + * osc.start(); + */ + log(...args) { + // if the object is either set to debug = true + // or if there is a string on the Tone.global.with the class name + if (this.debug || (theWindow && this.toString() === theWindow.TONE_DEBUG_CLASS)) { + log(this, ...args); + } + } + /** + * disconnect and dispose. + */ + dispose() { + this._wasDisposed = true; + return this; + } + /** + * Indicates if the instance was disposed. 'Disposing' an + * instance means that all of the Web Audio nodes that were + * created for the instance are disconnected and freed for garbage collection. + */ + get disposed() { + return this._wasDisposed; + } + /** + * Convert the class to a string + * @example + * const osc = new Tone.Oscillator(); + * console.log(osc.toString()); + */ + toString() { + return this.name; + } +} +/** + * The version number semver + */ +Tone.version = version; + +/** + * The threshold for correctness for operators. Less than one sample even + * at very high sampling rates (e.g. `1e-6 < 1 / 192000`). + */ +const EPSILON = 1e-6; +/** + * Test if A is greater than B + */ +function GT(a, b) { + return a > b + EPSILON; +} +/** + * Test if A is greater than or equal to B + */ +function GTE(a, b) { + return GT(a, b) || EQ(a, b); +} +/** + * Test if A is less than B + */ +function LT(a, b) { + return a + EPSILON < b; +} +/** + * Test if A is less than B + */ +function EQ(a, b) { + return Math.abs(a - b) < EPSILON; +} +/** + * Clamp the value within the given range + */ +function clamp(value, min, max) { + return Math.max(Math.min(value, max), min); +} + +/** + * A Timeline class for scheduling and maintaining state + * along a timeline. All events must have a "time" property. + * Internally, events are stored in time order for fast + * retrieval. + */ +class Timeline extends Tone { + constructor() { + super(); + this.name = "Timeline"; + /** + * The array of scheduled timeline events + */ + this._timeline = []; + const options = optionsFromArguments(Timeline.getDefaults(), arguments, ["memory"]); + this.memory = options.memory; + this.increasing = options.increasing; + } + static getDefaults() { + return { + memory: Infinity, + increasing: false, + }; + } + /** + * The number of items in the timeline. + */ + get length() { + return this._timeline.length; + } + /** + * Insert an event object onto the timeline. Events must have a "time" attribute. + * @param event The event object to insert into the timeline. + */ + add(event) { + // the event needs to have a time attribute + assert(Reflect.has(event, "time"), "Timeline: events must have a time attribute"); + event.time = event.time.valueOf(); + if (this.increasing && this.length) { + const lastValue = this._timeline[this.length - 1]; + assert(GTE(event.time, lastValue.time), "The time must be greater than or equal to the last scheduled time"); + this._timeline.push(event); + } + else { + const index = this._search(event.time); + this._timeline.splice(index + 1, 0, event); + } + // if the length is more than the memory, remove the previous ones + if (this.length > this.memory) { + const diff = this.length - this.memory; + this._timeline.splice(0, diff); + } + return this; + } + /** + * Remove an event from the timeline. + * @param {Object} event The event object to remove from the list. + * @returns {Timeline} this + */ + remove(event) { + const index = this._timeline.indexOf(event); + if (index !== -1) { + this._timeline.splice(index, 1); + } + return this; + } + /** + * Get the nearest event whose time is less than or equal to the given time. + * @param time The time to query. + */ + get(time, param = "time") { + const index = this._search(time, param); + if (index !== -1) { + return this._timeline[index]; + } + else { + return null; + } + } + /** + * Return the first event in the timeline without removing it + * @returns {Object} The first event object + */ + peek() { + return this._timeline[0]; + } + /** + * Return the first event in the timeline and remove it + */ + shift() { + return this._timeline.shift(); + } + /** + * Get the event which is scheduled after the given time. + * @param time The time to query. + */ + getAfter(time, param = "time") { + const index = this._search(time, param); + if (index + 1 < this._timeline.length) { + return this._timeline[index + 1]; + } + else { + return null; + } + } + /** + * Get the event before the event at the given time. + * @param time The time to query. + */ + getBefore(time) { + const len = this._timeline.length; + // if it's after the last item, return the last item + if (len > 0 && this._timeline[len - 1].time < time) { + return this._timeline[len - 1]; + } + const index = this._search(time); + if (index - 1 >= 0) { + return this._timeline[index - 1]; + } + else { + return null; + } + } + /** + * Cancel events at and after the given time + * @param after The time to query. + */ + cancel(after) { + if (this._timeline.length > 1) { + let index = this._search(after); + if (index >= 0) { + if (EQ(this._timeline[index].time, after)) { + // get the first item with that time + for (let i = index; i >= 0; i--) { + if (EQ(this._timeline[i].time, after)) { + index = i; + } + else { + break; + } + } + this._timeline = this._timeline.slice(0, index); + } + else { + this._timeline = this._timeline.slice(0, index + 1); + } + } + else { + this._timeline = []; + } + } + else if (this._timeline.length === 1) { + // the first item's time + if (GTE(this._timeline[0].time, after)) { + this._timeline = []; + } + } + return this; + } + /** + * Cancel events before or equal to the given time. + * @param time The time to cancel before. + */ + cancelBefore(time) { + const index = this._search(time); + if (index >= 0) { + this._timeline = this._timeline.slice(index + 1); + } + return this; + } + /** + * Returns the previous event if there is one. null otherwise + * @param event The event to find the previous one of + * @return The event right before the given event + */ + previousEvent(event) { + const index = this._timeline.indexOf(event); + if (index > 0) { + return this._timeline[index - 1]; + } + else { + return null; + } + } + /** + * Does a binary search on the timeline array and returns the + * nearest event index whose time is after or equal to the given time. + * If a time is searched before the first index in the timeline, -1 is returned. + * If the time is after the end, the index of the last item is returned. + */ + _search(time, param = "time") { + if (this._timeline.length === 0) { + return -1; + } + let beginning = 0; + const len = this._timeline.length; + let end = len; + if (len > 0 && this._timeline[len - 1][param] <= time) { + return len - 1; + } + while (beginning < end) { + // calculate the midpoint for roughly equal partition + let midPoint = Math.floor(beginning + (end - beginning) / 2); + const event = this._timeline[midPoint]; + const nextEvent = this._timeline[midPoint + 1]; + if (EQ(event[param], time)) { + // choose the last one that has the same time + for (let i = midPoint; i < this._timeline.length; i++) { + const testEvent = this._timeline[i]; + if (EQ(testEvent[param], time)) { + midPoint = i; + } + else { + break; + } + } + return midPoint; + } + else if (LT(event[param], time) && GT(nextEvent[param], time)) { + return midPoint; + } + else if (GT(event[param], time)) { + // search lower + end = midPoint; + } + else { + // search upper + beginning = midPoint + 1; + } + } + return -1; + } + /** + * Internal iterator. Applies extra safety checks for + * removing items from the array. + */ + _iterate(callback, lowerBound = 0, upperBound = this._timeline.length - 1) { + this._timeline.slice(lowerBound, upperBound + 1).forEach(callback); + } + /** + * Iterate over everything in the array + * @param callback The callback to invoke with every item + */ + forEach(callback) { + this._iterate(callback); + return this; + } + /** + * Iterate over everything in the array at or before the given time. + * @param time The time to check if items are before + * @param callback The callback to invoke with every item + */ + forEachBefore(time, callback) { + // iterate over the items in reverse so that removing an item doesn't break things + const upperBound = this._search(time); + if (upperBound !== -1) { + this._iterate(callback, 0, upperBound); + } + return this; + } + /** + * Iterate over everything in the array after the given time. + * @param time The time to check if items are before + * @param callback The callback to invoke with every item + */ + forEachAfter(time, callback) { + // iterate over the items in reverse so that removing an item doesn't break things + const lowerBound = this._search(time); + this._iterate(callback, lowerBound + 1); + return this; + } + /** + * Iterate over everything in the array between the startTime and endTime. + * The timerange is inclusive of the startTime, but exclusive of the endTime. + * range = [startTime, endTime). + * @param startTime The time to check if items are before + * @param endTime The end of the test interval. + * @param callback The callback to invoke with every item + */ + forEachBetween(startTime, endTime, callback) { + let lowerBound = this._search(startTime); + let upperBound = this._search(endTime); + if (lowerBound !== -1 && upperBound !== -1) { + if (this._timeline[lowerBound].time !== startTime) { + lowerBound += 1; + } + // exclusive of the end time + if (this._timeline[upperBound].time === endTime) { + upperBound -= 1; + } + this._iterate(callback, lowerBound, upperBound); + } + else if (lowerBound === -1) { + this._iterate(callback, 0, upperBound); + } + return this; + } + /** + * Iterate over everything in the array at or after the given time. Similar to + * forEachAfter, but includes the item(s) at the given time. + * @param time The time to check if items are before + * @param callback The callback to invoke with every item + */ + forEachFrom(time, callback) { + // iterate over the items in reverse so that removing an item doesn't break things + let lowerBound = this._search(time); + // work backwards until the event time is less than time + while (lowerBound >= 0 && this._timeline[lowerBound].time >= time) { + lowerBound--; + } + this._iterate(callback, lowerBound + 1); + return this; + } + /** + * Iterate over everything in the array at the given time + * @param time The time to check if items are before + * @param callback The callback to invoke with every item + */ + forEachAtTime(time, callback) { + // iterate over the items in reverse so that removing an item doesn't break things + const upperBound = this._search(time); + if (upperBound !== -1 && EQ(this._timeline[upperBound].time, time)) { + let lowerBound = upperBound; + for (let i = upperBound; i >= 0; i--) { + if (EQ(this._timeline[i].time, time)) { + lowerBound = i; + } + else { + break; + } + } + this._iterate(event => { + callback(event); + }, lowerBound, upperBound); + } + return this; + } + /** + * Clean up. + */ + dispose() { + super.dispose(); + this._timeline = []; + return this; + } +} + +//------------------------------------- +// INITIALIZING NEW CONTEXT +//------------------------------------- +/** + * Array of callbacks to invoke when a new context is created + */ +const notifyNewContext = []; +/** + * Used internally to setup a new Context + */ +function onContextInit(cb) { + notifyNewContext.push(cb); +} +/** + * Invoke any classes which need to also be initialized when a new context is created. + */ +function initializeContext(ctx) { + // add any additional modules + notifyNewContext.forEach(cb => cb(ctx)); +} +/** + * Array of callbacks to invoke when a new context is created + */ +const notifyCloseContext = []; +/** + * Used internally to tear down a Context + */ +function onContextClose(cb) { + notifyCloseContext.push(cb); +} +function closeContext(ctx) { + // add any additional modules + notifyCloseContext.forEach(cb => cb(ctx)); +} + +/** + * Emitter gives classes which extend it + * the ability to listen for and emit events. + * Inspiration and reference from Jerome Etienne's [MicroEvent](https://github.com/jeromeetienne/microevent.js). + * MIT (c) 2011 Jerome Etienne. + * @category Core + */ +class Emitter extends Tone { + constructor() { + super(...arguments); + this.name = "Emitter"; + } + /** + * Bind a callback to a specific event. + * @param event The name of the event to listen for. + * @param callback The callback to invoke when the event is emitted + */ + on(event, callback) { + // split the event + const events = event.split(/\W+/); + events.forEach(eventName => { + if (isUndef(this._events)) { + this._events = {}; + } + if (!this._events.hasOwnProperty(eventName)) { + this._events[eventName] = []; + } + this._events[eventName].push(callback); + }); + return this; + } + /** + * Bind a callback which is only invoked once + * @param event The name of the event to listen for. + * @param callback The callback to invoke when the event is emitted + */ + once(event, callback) { + const boundCallback = (...args) => { + // invoke the callback + callback(...args); + // remove the event + this.off(event, boundCallback); + }; + this.on(event, boundCallback); + return this; + } + /** + * Remove the event listener. + * @param event The event to stop listening to. + * @param callback The callback which was bound to the event with Emitter.on. + * If no callback is given, all callbacks events are removed. + */ + off(event, callback) { + const events = event.split(/\W+/); + events.forEach(eventName => { + if (isUndef(this._events)) { + this._events = {}; + } + if (this._events.hasOwnProperty(event)) { + if (isUndef(callback)) { + this._events[event] = []; + } + else { + const eventList = this._events[event]; + for (let i = eventList.length - 1; i >= 0; i--) { + if (eventList[i] === callback) { + eventList.splice(i, 1); + } + } + } + } + }); + return this; + } + /** + * Invoke all of the callbacks bound to the event + * with any arguments passed in. + * @param event The name of the event. + * @param args The arguments to pass to the functions listening. + */ + emit(event, ...args) { + if (this._events) { + if (this._events.hasOwnProperty(event)) { + const eventList = this._events[event].slice(0); + for (let i = 0, len = eventList.length; i < len; i++) { + eventList[i].apply(this, args); + } + } + } + return this; + } + /** + * Add Emitter functions (on/off/emit) to the object + */ + static mixin(constr) { + // instance._events = {}; + ["on", "once", "off", "emit"].forEach(name => { + const property = Object.getOwnPropertyDescriptor(Emitter.prototype, name); + Object.defineProperty(constr.prototype, name, property); + }); + } + /** + * Clean up + */ + dispose() { + super.dispose(); + this._events = undefined; + return this; + } +} + +class BaseContext extends Emitter { + constructor() { + super(...arguments); + this.isOffline = false; + } + /* + * This is a placeholder so that JSON.stringify does not throw an error + * This matches what JSON.stringify(audioContext) returns on a native + * audioContext instance. + */ + toJSON() { + return {}; + } +} + +/** + * Wrapper around the native AudioContext. + * @category Core + */ +class Context extends BaseContext { + constructor() { + super(); + this.name = "Context"; + /** + * An object containing all of the constants AudioBufferSourceNodes + */ + this._constants = new Map(); + /** + * All of the setTimeout events. + */ + this._timeouts = new Timeline(); + /** + * The timeout id counter + */ + this._timeoutIds = 0; + /** + * Private indicator if the context has been initialized + */ + this._initialized = false; + /** + * Indicates if the context is an OfflineAudioContext or an AudioContext + */ + this.isOffline = false; + //-------------------------------------------- + // AUDIO WORKLET + //-------------------------------------------- + /** + * Maps a module name to promise of the addModule method + */ + this._workletModules = new Map(); + const options = optionsFromArguments(Context.getDefaults(), arguments, [ + "context", + ]); + if (options.context) { + this._context = options.context; + } + else { + this._context = createAudioContext({ + latencyHint: options.latencyHint, + }); + } + this._ticker = new Ticker(this.emit.bind(this, "tick"), options.clockSource, options.updateInterval); + this.on("tick", this._timeoutLoop.bind(this)); + // fwd events from the context + this._context.onstatechange = () => { + this.emit("statechange", this.state); + }; + this._setLatencyHint(options.latencyHint); + this.lookAhead = options.lookAhead; + } + static getDefaults() { + return { + clockSource: "worker", + latencyHint: "interactive", + lookAhead: 0.1, + updateInterval: 0.05, + }; + } + /** + * Finish setting up the context. **You usually do not need to do this manually.** + */ + initialize() { + if (!this._initialized) { + // add any additional modules + initializeContext(this); + this._initialized = true; + } + return this; + } + //--------------------------- + // BASE AUDIO CONTEXT METHODS + //--------------------------- + createAnalyser() { + return this._context.createAnalyser(); + } + createOscillator() { + return this._context.createOscillator(); + } + createBufferSource() { + return this._context.createBufferSource(); + } + createBiquadFilter() { + return this._context.createBiquadFilter(); + } + createBuffer(numberOfChannels, length, sampleRate) { + return this._context.createBuffer(numberOfChannels, length, sampleRate); + } + createChannelMerger(numberOfInputs) { + return this._context.createChannelMerger(numberOfInputs); + } + createChannelSplitter(numberOfOutputs) { + return this._context.createChannelSplitter(numberOfOutputs); + } + createConstantSource() { + return this._context.createConstantSource(); + } + createConvolver() { + return this._context.createConvolver(); + } + createDelay(maxDelayTime) { + return this._context.createDelay(maxDelayTime); + } + createDynamicsCompressor() { + return this._context.createDynamicsCompressor(); + } + createGain() { + return this._context.createGain(); + } + createIIRFilter(feedForward, feedback) { + // @ts-ignore + return this._context.createIIRFilter(feedForward, feedback); + } + createPanner() { + return this._context.createPanner(); + } + createPeriodicWave(real, imag, constraints) { + return this._context.createPeriodicWave(real, imag, constraints); + } + createStereoPanner() { + return this._context.createStereoPanner(); + } + createWaveShaper() { + return this._context.createWaveShaper(); + } + createMediaStreamSource(stream) { + assert(isAudioContext(this._context), "Not available if OfflineAudioContext"); + const context = this._context; + return context.createMediaStreamSource(stream); + } + createMediaElementSource(element) { + assert(isAudioContext(this._context), "Not available if OfflineAudioContext"); + const context = this._context; + return context.createMediaElementSource(element); + } + createMediaStreamDestination() { + assert(isAudioContext(this._context), "Not available if OfflineAudioContext"); + const context = this._context; + return context.createMediaStreamDestination(); + } + decodeAudioData(audioData) { + return this._context.decodeAudioData(audioData); + } + /** + * The current time in seconds of the AudioContext. + */ + get currentTime() { + return this._context.currentTime; + } + /** + * The current time in seconds of the AudioContext. + */ + get state() { + return this._context.state; + } + /** + * The current time in seconds of the AudioContext. + */ + get sampleRate() { + return this._context.sampleRate; + } + /** + * The listener + */ + get listener() { + this.initialize(); + return this._listener; + } + set listener(l) { + assert(!this._initialized, "The listener cannot be set after initialization."); + this._listener = l; + } + /** + * There is only one Transport per Context. It is created on initialization. + */ + get transport() { + this.initialize(); + return this._transport; + } + set transport(t) { + assert(!this._initialized, "The transport cannot be set after initialization."); + this._transport = t; + } + /** + * This is the Draw object for the context which is useful for synchronizing the draw frame with the Tone.js clock. + */ + get draw() { + this.initialize(); + return this._draw; + } + set draw(d) { + assert(!this._initialized, "Draw cannot be set after initialization."); + this._draw = d; + } + /** + * A reference to the Context's destination node. + */ + get destination() { + this.initialize(); + return this._destination; + } + set destination(d) { + assert(!this._initialized, "The destination cannot be set after initialization."); + this._destination = d; + } + /** + * Create an audio worklet node from a name and options. The module + * must first be loaded using [[addAudioWorkletModule]]. + */ + createAudioWorkletNode(name, options) { + return createAudioWorkletNode(this.rawContext, name, options); + } + /** + * Add an AudioWorkletProcessor module + * @param url The url of the module + * @param name The name of the module + */ + addAudioWorkletModule(url, name) { + return __awaiter(this, void 0, void 0, function* () { + assert(isDefined(this.rawContext.audioWorklet), "AudioWorkletNode is only available in a secure context (https or localhost)"); + if (!this._workletModules.has(name)) { + this._workletModules.set(name, this.rawContext.audioWorklet.addModule(url)); + } + yield this._workletModules.get(name); + }); + } + /** + * Returns a promise which resolves when all of the worklets have been loaded on this context + */ + workletsAreReady() { + return __awaiter(this, void 0, void 0, function* () { + const promises = []; + this._workletModules.forEach((promise) => promises.push(promise)); + yield Promise.all(promises); + }); + } + //--------------------------- + // TICKER + //--------------------------- + /** + * How often the interval callback is invoked. + * This number corresponds to how responsive the scheduling + * can be. context.updateInterval + context.lookAhead gives you the + * total latency between scheduling an event and hearing it. + */ + get updateInterval() { + return this._ticker.updateInterval; + } + set updateInterval(interval) { + this._ticker.updateInterval = interval; + } + /** + * What the source of the clock is, either "worker" (default), + * "timeout", or "offline" (none). + */ + get clockSource() { + return this._ticker.type; + } + set clockSource(type) { + this._ticker.type = type; + } + /** + * The type of playback, which affects tradeoffs between audio + * output latency and responsiveness. + * In addition to setting the value in seconds, the latencyHint also + * accepts the strings "interactive" (prioritizes low latency), + * "playback" (prioritizes sustained playback), "balanced" (balances + * latency and performance). + * @example + * // prioritize sustained playback + * const context = new Tone.Context({ latencyHint: "playback" }); + * // set this context as the global Context + * Tone.setContext(context); + * // the global context is gettable with Tone.getContext() + * console.log(Tone.getContext().latencyHint); + */ + get latencyHint() { + return this._latencyHint; + } + /** + * Update the lookAhead and updateInterval based on the latencyHint + */ + _setLatencyHint(hint) { + let lookAheadValue = 0; + this._latencyHint = hint; + if (isString(hint)) { + switch (hint) { + case "interactive": + lookAheadValue = 0.1; + break; + case "playback": + lookAheadValue = 0.5; + break; + case "balanced": + lookAheadValue = 0.25; + break; + } + } + this.lookAhead = lookAheadValue; + this.updateInterval = lookAheadValue / 2; + } + /** + * The unwrapped AudioContext or OfflineAudioContext + */ + get rawContext() { + return this._context; + } + /** + * The current audio context time plus a short [[lookAhead]]. + */ + now() { + return this._context.currentTime + this.lookAhead; + } + /** + * The current audio context time without the [[lookAhead]]. + * In most cases it is better to use [[now]] instead of [[immediate]] since + * with [[now]] the [[lookAhead]] is applied equally to _all_ components including internal components, + * to making sure that everything is scheduled in sync. Mixing [[now]] and [[immediate]] + * can cause some timing issues. If no lookAhead is desired, you can set the [[lookAhead]] to `0`. + */ + immediate() { + return this._context.currentTime; + } + /** + * Starts the audio context from a suspended state. This is required + * to initially start the AudioContext. See [[Tone.start]] + */ + resume() { + if (isAudioContext(this._context)) { + return this._context.resume(); + } + else { + return Promise.resolve(); + } + } + /** + * Close the context. Once closed, the context can no longer be used and + * any AudioNodes created from the context will be silent. + */ + close() { + return __awaiter(this, void 0, void 0, function* () { + if (isAudioContext(this._context)) { + yield this._context.close(); + } + if (this._initialized) { + closeContext(this); + } + }); + } + /** + * **Internal** Generate a looped buffer at some constant value. + */ + getConstant(val) { + if (this._constants.has(val)) { + return this._constants.get(val); + } + else { + const buffer = this._context.createBuffer(1, 128, this._context.sampleRate); + const arr = buffer.getChannelData(0); + for (let i = 0; i < arr.length; i++) { + arr[i] = val; + } + const constant = this._context.createBufferSource(); + constant.channelCount = 1; + constant.channelCountMode = "explicit"; + constant.buffer = buffer; + constant.loop = true; + constant.start(0); + this._constants.set(val, constant); + return constant; + } + } + /** + * Clean up. Also closes the audio context. + */ + dispose() { + super.dispose(); + this._ticker.dispose(); + this._timeouts.dispose(); + Object.keys(this._constants).map((val) => this._constants[val].disconnect()); + return this; + } + //--------------------------- + // TIMEOUTS + //--------------------------- + /** + * The private loop which keeps track of the context scheduled timeouts + * Is invoked from the clock source + */ + _timeoutLoop() { + const now = this.now(); + let firstEvent = this._timeouts.peek(); + while (this._timeouts.length && firstEvent && firstEvent.time <= now) { + // invoke the callback + firstEvent.callback(); + // shift the first event off + this._timeouts.shift(); + // get the next one + firstEvent = this._timeouts.peek(); + } + } + /** + * A setTimeout which is guaranteed by the clock source. + * Also runs in the offline context. + * @param fn The callback to invoke + * @param timeout The timeout in seconds + * @returns ID to use when invoking Context.clearTimeout + */ + setTimeout(fn, timeout) { + this._timeoutIds++; + const now = this.now(); + this._timeouts.add({ + callback: fn, + id: this._timeoutIds, + time: now + timeout, + }); + return this._timeoutIds; + } + /** + * Clears a previously scheduled timeout with Tone.context.setTimeout + * @param id The ID returned from setTimeout + */ + clearTimeout(id) { + this._timeouts.forEach((event) => { + if (event.id === id) { + this._timeouts.remove(event); + } + }); + return this; + } + /** + * Clear the function scheduled by [[setInterval]] + */ + clearInterval(id) { + return this.clearTimeout(id); + } + /** + * Adds a repeating event to the context's callback clock + */ + setInterval(fn, interval) { + const id = ++this._timeoutIds; + const intervalFn = () => { + const now = this.now(); + this._timeouts.add({ + callback: () => { + // invoke the callback + fn(); + // invoke the event to repeat it + intervalFn(); + }, + id, + time: now + interval, + }); + }; + // kick it off + intervalFn(); + return id; + } +} + +class DummyContext extends BaseContext { + constructor() { + super(...arguments); + this.lookAhead = 0; + this.latencyHint = 0; + this.isOffline = false; + } + //--------------------------- + // BASE AUDIO CONTEXT METHODS + //--------------------------- + createAnalyser() { + return {}; + } + createOscillator() { + return {}; + } + createBufferSource() { + return {}; + } + createBiquadFilter() { + return {}; + } + createBuffer(_numberOfChannels, _length, _sampleRate) { + return {}; + } + createChannelMerger(_numberOfInputs) { + return {}; + } + createChannelSplitter(_numberOfOutputs) { + return {}; + } + createConstantSource() { + return {}; + } + createConvolver() { + return {}; + } + createDelay(_maxDelayTime) { + return {}; + } + createDynamicsCompressor() { + return {}; + } + createGain() { + return {}; + } + createIIRFilter(_feedForward, _feedback) { + return {}; + } + createPanner() { + return {}; + } + createPeriodicWave(_real, _imag, _constraints) { + return {}; + } + createStereoPanner() { + return {}; + } + createWaveShaper() { + return {}; + } + createMediaStreamSource(_stream) { + return {}; + } + createMediaElementSource(_element) { + return {}; + } + createMediaStreamDestination() { + return {}; + } + decodeAudioData(_audioData) { + return Promise.resolve({}); + } + //--------------------------- + // TONE AUDIO CONTEXT METHODS + //--------------------------- + createAudioWorkletNode(_name, _options) { + return {}; + } + get rawContext() { + return {}; + } + addAudioWorkletModule(_url, _name) { + return __awaiter(this, void 0, void 0, function* () { + return Promise.resolve(); + }); + } + resume() { + return Promise.resolve(); + } + setTimeout(_fn, _timeout) { + return 0; + } + clearTimeout(_id) { + return this; + } + setInterval(_fn, _interval) { + return 0; + } + clearInterval(_id) { + return this; + } + getConstant(_val) { + return {}; + } + get currentTime() { + return 0; + } + get state() { + return {}; + } + get sampleRate() { + return 0; + } + get listener() { + return {}; + } + get transport() { + return {}; + } + get draw() { + return {}; + } + set draw(_d) { } + get destination() { + return {}; + } + set destination(_d) { } + now() { + return 0; + } + immediate() { + return 0; + } +} + +/** + * Make the property not writable using `defineProperty`. Internal use only. + */ +function readOnly(target, property) { + if (isArray(property)) { + property.forEach(str => readOnly(target, str)); + } + else { + Object.defineProperty(target, property, { + enumerable: true, + writable: false, + }); + } +} +/** + * Make an attribute writeable. Internal use only. + */ +function writable(target, property) { + if (isArray(property)) { + property.forEach(str => writable(target, str)); + } + else { + Object.defineProperty(target, property, { + writable: true, + }); + } +} +const noOp = () => { + // no operation here! +}; + +/** + * AudioBuffer loading and storage. ToneAudioBuffer is used internally by all + * classes that make requests for audio files such as Tone.Player, + * Tone.Sampler and Tone.Convolver. + * @example + * const buffer = new Tone.ToneAudioBuffer("https://tonejs.github.io/audio/casio/A1.mp3", () => { + * console.log("loaded"); + * }); + * @category Core + */ +class ToneAudioBuffer extends Tone { + constructor() { + super(); + this.name = "ToneAudioBuffer"; + /** + * Callback when the buffer is loaded. + */ + this.onload = noOp; + const options = optionsFromArguments(ToneAudioBuffer.getDefaults(), arguments, ["url", "onload", "onerror"]); + this.reverse = options.reverse; + this.onload = options.onload; + if (options.url && isAudioBuffer(options.url) || options.url instanceof ToneAudioBuffer) { + this.set(options.url); + } + else if (isString(options.url)) { + // initiate the download + this.load(options.url).catch(options.onerror); + } + } + static getDefaults() { + return { + onerror: noOp, + onload: noOp, + reverse: false, + }; + } + /** + * The sample rate of the AudioBuffer + */ + get sampleRate() { + if (this._buffer) { + return this._buffer.sampleRate; + } + else { + return getContext().sampleRate; + } + } + /** + * Pass in an AudioBuffer or ToneAudioBuffer to set the value of this buffer. + */ + set(buffer) { + if (buffer instanceof ToneAudioBuffer) { + // if it's loaded, set it + if (buffer.loaded) { + this._buffer = buffer.get(); + } + else { + // otherwise when it's loaded, invoke it's callback + buffer.onload = () => { + this.set(buffer); + this.onload(this); + }; + } + } + else { + this._buffer = buffer; + } + // reverse it initially + if (this._reversed) { + this._reverse(); + } + return this; + } + /** + * The audio buffer stored in the object. + */ + get() { + return this._buffer; + } + /** + * Makes an fetch request for the selected url then decodes the file as an audio buffer. + * Invokes the callback once the audio buffer loads. + * @param url The url of the buffer to load. filetype support depends on the browser. + * @returns A Promise which resolves with this ToneAudioBuffer + */ + load(url) { + return __awaiter(this, void 0, void 0, function* () { + const doneLoading = ToneAudioBuffer.load(url).then(audioBuffer => { + this.set(audioBuffer); + // invoke the onload method + this.onload(this); + }); + ToneAudioBuffer.downloads.push(doneLoading); + try { + yield doneLoading; + } + finally { + // remove the downloaded file + const index = ToneAudioBuffer.downloads.indexOf(doneLoading); + ToneAudioBuffer.downloads.splice(index, 1); + } + return this; + }); + } + /** + * clean up + */ + dispose() { + super.dispose(); + this._buffer = undefined; + return this; + } + /** + * Set the audio buffer from the array. + * To create a multichannel AudioBuffer, pass in a multidimensional array. + * @param array The array to fill the audio buffer + */ + fromArray(array) { + const isMultidimensional = isArray(array) && array[0].length > 0; + const channels = isMultidimensional ? array.length : 1; + const len = isMultidimensional ? array[0].length : array.length; + const context = getContext(); + const buffer = context.createBuffer(channels, len, context.sampleRate); + const multiChannelArray = !isMultidimensional && channels === 1 ? + [array] : array; + for (let c = 0; c < channels; c++) { + buffer.copyToChannel(multiChannelArray[c], c); + } + this._buffer = buffer; + return this; + } + /** + * Sums multiple channels into 1 channel + * @param chanNum Optionally only copy a single channel from the array. + */ + toMono(chanNum) { + if (isNumber(chanNum)) { + this.fromArray(this.toArray(chanNum)); + } + else { + let outputArray = new Float32Array(this.length); + const numChannels = this.numberOfChannels; + for (let channel = 0; channel < numChannels; channel++) { + const channelArray = this.toArray(channel); + for (let i = 0; i < channelArray.length; i++) { + outputArray[i] += channelArray[i]; + } + } + // divide by the number of channels + outputArray = outputArray.map(sample => sample / numChannels); + this.fromArray(outputArray); + } + return this; + } + /** + * Get the buffer as an array. Single channel buffers will return a 1-dimensional + * Float32Array, and multichannel buffers will return multidimensional arrays. + * @param channel Optionally only copy a single channel from the array. + */ + toArray(channel) { + if (isNumber(channel)) { + return this.getChannelData(channel); + } + else if (this.numberOfChannels === 1) { + return this.toArray(0); + } + else { + const ret = []; + for (let c = 0; c < this.numberOfChannels; c++) { + ret[c] = this.getChannelData(c); + } + return ret; + } + } + /** + * Returns the Float32Array representing the PCM audio data for the specific channel. + * @param channel The channel number to return + * @return The audio as a TypedArray + */ + getChannelData(channel) { + if (this._buffer) { + return this._buffer.getChannelData(channel); + } + else { + return new Float32Array(0); + } + } + /** + * Cut a subsection of the array and return a buffer of the + * subsection. Does not modify the original buffer + * @param start The time to start the slice + * @param end The end time to slice. If none is given will default to the end of the buffer + */ + slice(start, end = this.duration) { + const startSamples = Math.floor(start * this.sampleRate); + const endSamples = Math.floor(end * this.sampleRate); + assert(startSamples < endSamples, "The start time must be less than the end time"); + const length = endSamples - startSamples; + const retBuffer = getContext().createBuffer(this.numberOfChannels, length, this.sampleRate); + for (let channel = 0; channel < this.numberOfChannels; channel++) { + retBuffer.copyToChannel(this.getChannelData(channel).subarray(startSamples, endSamples), channel); + } + return new ToneAudioBuffer(retBuffer); + } + /** + * Reverse the buffer. + */ + _reverse() { + if (this.loaded) { + for (let i = 0; i < this.numberOfChannels; i++) { + this.getChannelData(i).reverse(); + } + } + return this; + } + /** + * If the buffer is loaded or not + */ + get loaded() { + return this.length > 0; + } + /** + * The duration of the buffer in seconds. + */ + get duration() { + if (this._buffer) { + return this._buffer.duration; + } + else { + return 0; + } + } + /** + * The length of the buffer in samples + */ + get length() { + if (this._buffer) { + return this._buffer.length; + } + else { + return 0; + } + } + /** + * The number of discrete audio channels. Returns 0 if no buffer is loaded. + */ + get numberOfChannels() { + if (this._buffer) { + return this._buffer.numberOfChannels; + } + else { + return 0; + } + } + /** + * Reverse the buffer. + */ + get reverse() { + return this._reversed; + } + set reverse(rev) { + if (this._reversed !== rev) { + this._reversed = rev; + this._reverse(); + } + } + /** + * Create a ToneAudioBuffer from the array. To create a multichannel AudioBuffer, + * pass in a multidimensional array. + * @param array The array to fill the audio buffer + * @return A ToneAudioBuffer created from the array + */ + static fromArray(array) { + return (new ToneAudioBuffer()).fromArray(array); + } + /** + * Creates a ToneAudioBuffer from a URL, returns a promise which resolves to a ToneAudioBuffer + * @param url The url to load. + * @return A promise which resolves to a ToneAudioBuffer + */ + static fromUrl(url) { + return __awaiter(this, void 0, void 0, function* () { + const buffer = new ToneAudioBuffer(); + return yield buffer.load(url); + }); + } + /** + * Loads a url using fetch and returns the AudioBuffer. + */ + static load(url) { + return __awaiter(this, void 0, void 0, function* () { + // test if the url contains multiple extensions + const matches = url.match(/\[([^\]\[]+\|.+)\]$/); + if (matches) { + const extensions = matches[1].split("|"); + let extension = extensions[0]; + for (const ext of extensions) { + if (ToneAudioBuffer.supportsType(ext)) { + extension = ext; + break; + } + } + url = url.replace(matches[0], extension); + } + // make sure there is a slash between the baseUrl and the url + const baseUrl = ToneAudioBuffer.baseUrl === "" || ToneAudioBuffer.baseUrl.endsWith("/") ? ToneAudioBuffer.baseUrl : ToneAudioBuffer.baseUrl + "/"; + const response = yield fetch(baseUrl + url); + if (!response.ok) { + throw new Error(`could not load url: ${url}`); + } + const arrayBuffer = yield response.arrayBuffer(); + const audioBuffer = yield getContext().decodeAudioData(arrayBuffer); + return audioBuffer; + }); + } + /** + * Checks a url's extension to see if the current browser can play that file type. + * @param url The url/extension to test + * @return If the file extension can be played + * @static + * @example + * Tone.ToneAudioBuffer.supportsType("wav"); // returns true + * Tone.ToneAudioBuffer.supportsType("path/to/file.wav"); // returns true + */ + static supportsType(url) { + const extensions = url.split("."); + const extension = extensions[extensions.length - 1]; + const response = document.createElement("audio").canPlayType("audio/" + extension); + return response !== ""; + } + /** + * Returns a Promise which resolves when all of the buffers have loaded + */ + static loaded() { + return __awaiter(this, void 0, void 0, function* () { + // this makes sure that the function is always async + yield Promise.resolve(); + while (ToneAudioBuffer.downloads.length) { + yield ToneAudioBuffer.downloads[0]; + } + }); + } +} +//------------------------------------- +// STATIC METHODS +//------------------------------------- +/** + * A path which is prefixed before every url. + */ +ToneAudioBuffer.baseUrl = ""; +/** + * All of the downloads + */ +ToneAudioBuffer.downloads = []; + +/** + * Wrapper around the OfflineAudioContext + * @category Core + * @example + * // generate a single channel, 0.5 second buffer + * const context = new Tone.OfflineContext(1, 0.5, 44100); + * const osc = new Tone.Oscillator({ context }); + * context.render().then(buffer => { + * console.log(buffer.numberOfChannels, buffer.duration); + * }); + */ +class OfflineContext extends Context { + constructor() { + super({ + clockSource: "offline", + context: isOfflineAudioContext(arguments[0]) ? + arguments[0] : createOfflineAudioContext(arguments[0], arguments[1] * arguments[2], arguments[2]), + lookAhead: 0, + updateInterval: isOfflineAudioContext(arguments[0]) ? + 128 / arguments[0].sampleRate : 128 / arguments[2], + }); + this.name = "OfflineContext"; + /** + * An artificial clock source + */ + this._currentTime = 0; + this.isOffline = true; + this._duration = isOfflineAudioContext(arguments[0]) ? + arguments[0].length / arguments[0].sampleRate : arguments[1]; + } + /** + * Override the now method to point to the internal clock time + */ + now() { + return this._currentTime; + } + /** + * Same as this.now() + */ + get currentTime() { + return this._currentTime; + } + /** + * Render just the clock portion of the audio context. + */ + _renderClock(asynchronous) { + return __awaiter(this, void 0, void 0, function* () { + let index = 0; + while (this._duration - this._currentTime >= 0) { + // invoke all the callbacks on that time + this.emit("tick"); + // increment the clock in block-sized chunks + this._currentTime += 128 / this.sampleRate; + // yield once a second of audio + index++; + const yieldEvery = Math.floor(this.sampleRate / 128); + if (asynchronous && index % yieldEvery === 0) { + yield new Promise(done => setTimeout(done, 1)); + } + } + }); + } + /** + * Render the output of the OfflineContext + * @param asynchronous If the clock should be rendered asynchronously, which will not block the main thread, but be slightly slower. + */ + render(asynchronous = true) { + return __awaiter(this, void 0, void 0, function* () { + yield this.workletsAreReady(); + yield this._renderClock(asynchronous); + const buffer = yield this._context.startRendering(); + return new ToneAudioBuffer(buffer); + }); + } + /** + * Close the context + */ + close() { + return Promise.resolve(); + } +} + +/** + * This dummy context is used to avoid throwing immediate errors when importing in Node.js + */ +const dummyContext = new DummyContext(); +/** + * The global audio context which is getable and assignable through + * getContext and setContext + */ +let globalContext = dummyContext; +/** + * Returns the default system-wide [[Context]] + * @category Core + */ +function getContext() { + if (globalContext === dummyContext && hasAudioContext) { + setContext(new Context()); + } + return globalContext; +} +/** + * Set the default audio context + * @category Core + */ +function setContext(context) { + if (isAudioContext(context)) { + globalContext = new Context(context); + } + else if (isOfflineAudioContext(context)) { + globalContext = new OfflineContext(context); + } + else { + globalContext = context; + } +} +/** + * Most browsers will not play _any_ audio until a user + * clicks something (like a play button). Invoke this method + * on a click or keypress event handler to start the audio context. + * More about the Autoplay policy + * [here](https://developers.google.com/web/updates/2017/09/autoplay-policy-changes#webaudio) + * @example + * document.querySelector("button").addEventListener("click", async () => { + * await Tone.start(); + * console.log("context started"); + * }); + * @category Core + */ +function start() { + return globalContext.resume(); +} +/** + * Log Tone.js + version in the console. + */ +if (theWindow && !theWindow.TONE_SILENCE_LOGGING) { + let prefix = "v"; + const printString = ` * Tone.js ${prefix}${version} * `; + // eslint-disable-next-line no-console + console.log(`%c${printString}`, "background: #000; color: #fff"); +} + +/** + * Equal power gain scale. Good for cross-fading. + * @param percent (0-1) + */ +/** + * Convert decibels into gain. + */ +function dbToGain(db) { + return Math.pow(10, db / 20); +} +/** + * Convert gain to decibels. + */ +function gainToDb(gain) { + return 20 * (Math.log(gain) / Math.LN10); +} +/** + * Convert an interval (in semitones) to a frequency ratio. + * @param interval the number of semitones above the base note + * @example + * Tone.intervalToFrequencyRatio(0); // 1 + * Tone.intervalToFrequencyRatio(12); // 2 + * Tone.intervalToFrequencyRatio(-12); // 0.5 + */ +function intervalToFrequencyRatio(interval) { + return Math.pow(2, (interval / 12)); +} +/** + * The Global [concert tuning pitch](https://en.wikipedia.org/wiki/Concert_pitch) which is used + * to generate all the other pitch values from notes. A4's values in Hertz. + */ +let A4 = 440; +function getA4() { + return A4; +} +function setA4(freq) { + A4 = freq; +} +/** + * Convert a frequency value to a MIDI note. + * @param frequency The value to frequency value to convert. + * @example + * Tone.ftom(440); // returns 69 + */ +function ftom(frequency) { + return Math.round(ftomf(frequency)); +} +/** + * Convert a frequency to a floating point midi value + */ +function ftomf(frequency) { + return 69 + 12 * Math.log2(frequency / A4); +} +/** + * Convert a MIDI note to frequency value. + * @param midi The midi number to convert. + * @return The corresponding frequency value + * @example + * Tone.mtof(69); // 440 + */ +function mtof(midi) { + return A4 * Math.pow(2, (midi - 69) / 12); +} + +/** + * TimeBase is a flexible encoding of time which can be evaluated to and from a string. + */ +class TimeBaseClass extends Tone { + /** + * @param context The context associated with the time value. Used to compute + * Transport and context-relative timing. + * @param value The time value as a number, string or object + * @param units Unit values + */ + constructor(context, value, units) { + super(); + /** + * The default units + */ + this.defaultUnits = "s"; + this._val = value; + this._units = units; + this.context = context; + this._expressions = this._getExpressions(); + } + /** + * All of the time encoding expressions + */ + _getExpressions() { + return { + hz: { + method: (value) => { + return this._frequencyToUnits(parseFloat(value)); + }, + regexp: /^(\d+(?:\.\d+)?)hz$/i, + }, + i: { + method: (value) => { + return this._ticksToUnits(parseInt(value, 10)); + }, + regexp: /^(\d+)i$/i, + }, + m: { + method: (value) => { + return this._beatsToUnits(parseInt(value, 10) * this._getTimeSignature()); + }, + regexp: /^(\d+)m$/i, + }, + n: { + method: (value, dot) => { + const numericValue = parseInt(value, 10); + const scalar = dot === "." ? 1.5 : 1; + if (numericValue === 1) { + return this._beatsToUnits(this._getTimeSignature()) * scalar; + } + else { + return this._beatsToUnits(4 / numericValue) * scalar; + } + }, + regexp: /^(\d+)n(\.?)$/i, + }, + number: { + method: (value) => { + return this._expressions[this.defaultUnits].method.call(this, value); + }, + regexp: /^(\d+(?:\.\d+)?)$/, + }, + s: { + method: (value) => { + return this._secondsToUnits(parseFloat(value)); + }, + regexp: /^(\d+(?:\.\d+)?)s$/, + }, + samples: { + method: (value) => { + return parseInt(value, 10) / this.context.sampleRate; + }, + regexp: /^(\d+)samples$/, + }, + t: { + method: (value) => { + const numericValue = parseInt(value, 10); + return this._beatsToUnits(8 / (Math.floor(numericValue) * 3)); + }, + regexp: /^(\d+)t$/i, + }, + tr: { + method: (m, q, s) => { + let total = 0; + if (m && m !== "0") { + total += this._beatsToUnits(this._getTimeSignature() * parseFloat(m)); + } + if (q && q !== "0") { + total += this._beatsToUnits(parseFloat(q)); + } + if (s && s !== "0") { + total += this._beatsToUnits(parseFloat(s) / 4); + } + return total; + }, + regexp: /^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?):?(\d+(?:\.\d+)?)?$/, + }, + }; + } + //------------------------------------- + // VALUE OF + //------------------------------------- + /** + * Evaluate the time value. Returns the time in seconds. + */ + valueOf() { + if (this._val instanceof TimeBaseClass) { + this.fromType(this._val); + } + if (isUndef(this._val)) { + return this._noArg(); + } + else if (isString(this._val) && isUndef(this._units)) { + for (const units in this._expressions) { + if (this._expressions[units].regexp.test(this._val.trim())) { + this._units = units; + break; + } + } + } + else if (isObject(this._val)) { + let total = 0; + for (const typeName in this._val) { + if (isDefined(this._val[typeName])) { + const quantity = this._val[typeName]; + // @ts-ignore + const time = (new this.constructor(this.context, typeName)).valueOf() * quantity; + total += time; + } + } + return total; + } + if (isDefined(this._units)) { + const expr = this._expressions[this._units]; + const matching = this._val.toString().trim().match(expr.regexp); + if (matching) { + return expr.method.apply(this, matching.slice(1)); + } + else { + return expr.method.call(this, this._val); + } + } + else if (isString(this._val)) { + return parseFloat(this._val); + } + else { + return this._val; + } + } + //------------------------------------- + // UNIT CONVERSIONS + //------------------------------------- + /** + * Returns the value of a frequency in the current units + */ + _frequencyToUnits(freq) { + return 1 / freq; + } + /** + * Return the value of the beats in the current units + */ + _beatsToUnits(beats) { + return (60 / this._getBpm()) * beats; + } + /** + * Returns the value of a second in the current units + */ + _secondsToUnits(seconds) { + return seconds; + } + /** + * Returns the value of a tick in the current time units + */ + _ticksToUnits(ticks) { + return (ticks * (this._beatsToUnits(1)) / this._getPPQ()); + } + /** + * With no arguments, return 'now' + */ + _noArg() { + return this._now(); + } + //------------------------------------- + // TEMPO CONVERSIONS + //------------------------------------- + /** + * Return the bpm + */ + _getBpm() { + return this.context.transport.bpm.value; + } + /** + * Return the timeSignature + */ + _getTimeSignature() { + return this.context.transport.timeSignature; + } + /** + * Return the PPQ or 192 if Transport is not available + */ + _getPPQ() { + return this.context.transport.PPQ; + } + //------------------------------------- + // CONVERSION INTERFACE + //------------------------------------- + /** + * Coerce a time type into this units type. + * @param type Any time type units + */ + fromType(type) { + this._units = undefined; + switch (this.defaultUnits) { + case "s": + this._val = type.toSeconds(); + break; + case "i": + this._val = type.toTicks(); + break; + case "hz": + this._val = type.toFrequency(); + break; + case "midi": + this._val = type.toMidi(); + break; + } + return this; + } + /** + * Return the value in hertz + */ + toFrequency() { + return 1 / this.toSeconds(); + } + /** + * Return the time in samples + */ + toSamples() { + return this.toSeconds() * this.context.sampleRate; + } + /** + * Return the time in milliseconds. + */ + toMilliseconds() { + return this.toSeconds() * 1000; + } +} + +/** + * TimeClass is a primitive type for encoding and decoding Time values. + * TimeClass can be passed into the parameter of any method which takes time as an argument. + * @param val The time value. + * @param units The units of the value. + * @example + * const time = Tone.Time("4n"); // a quarter note + * @category Unit + */ +class TimeClass extends TimeBaseClass { + constructor() { + super(...arguments); + this.name = "TimeClass"; + } + _getExpressions() { + return Object.assign(super._getExpressions(), { + now: { + method: (capture) => { + return this._now() + new this.constructor(this.context, capture).valueOf(); + }, + regexp: /^\+(.+)/, + }, + quantize: { + method: (capture) => { + const quantTo = new TimeClass(this.context, capture).valueOf(); + return this._secondsToUnits(this.context.transport.nextSubdivision(quantTo)); + }, + regexp: /^@(.+)/, + }, + }); + } + /** + * Quantize the time by the given subdivision. Optionally add a + * percentage which will move the time value towards the ideal + * quantized value by that percentage. + * @param subdiv The subdivision to quantize to + * @param percent Move the time value towards the quantized value by a percentage. + * @example + * Tone.Time(21).quantize(2); // returns 22 + * Tone.Time(0.6).quantize("4n", 0.5); // returns 0.55 + */ + quantize(subdiv, percent = 1) { + const subdivision = new this.constructor(this.context, subdiv).valueOf(); + const value = this.valueOf(); + const multiple = Math.round(value / subdivision); + const ideal = multiple * subdivision; + const diff = ideal - value; + return value + diff * percent; + } + //------------------------------------- + // CONVERSIONS + //------------------------------------- + /** + * Convert a Time to Notation. The notation values are will be the + * closest representation between 1m to 128th note. + * @return {Notation} + * @example + * // if the Transport is at 120bpm: + * Tone.Time(2).toNotation(); // returns "1m" + */ + toNotation() { + const time = this.toSeconds(); + const testNotations = ["1m"]; + for (let power = 1; power < 9; power++) { + const subdiv = Math.pow(2, power); + testNotations.push(subdiv + "n."); + testNotations.push(subdiv + "n"); + testNotations.push(subdiv + "t"); + } + testNotations.push("0"); + // find the closets notation representation + let closest = testNotations[0]; + let closestSeconds = new TimeClass(this.context, testNotations[0]).toSeconds(); + testNotations.forEach(notation => { + const notationSeconds = new TimeClass(this.context, notation).toSeconds(); + if (Math.abs(notationSeconds - time) < Math.abs(closestSeconds - time)) { + closest = notation; + closestSeconds = notationSeconds; + } + }); + return closest; + } + /** + * Return the time encoded as Bars:Beats:Sixteenths. + */ + toBarsBeatsSixteenths() { + const quarterTime = this._beatsToUnits(1); + let quarters = this.valueOf() / quarterTime; + quarters = parseFloat(quarters.toFixed(4)); + const measures = Math.floor(quarters / this._getTimeSignature()); + let sixteenths = (quarters % 1) * 4; + quarters = Math.floor(quarters) % this._getTimeSignature(); + const sixteenthString = sixteenths.toString(); + if (sixteenthString.length > 3) { + // the additional parseFloat removes insignificant trailing zeroes + sixteenths = parseFloat(parseFloat(sixteenthString).toFixed(3)); + } + const progress = [measures, quarters, sixteenths]; + return progress.join(":"); + } + /** + * Return the time in ticks. + */ + toTicks() { + const quarterTime = this._beatsToUnits(1); + const quarters = this.valueOf() / quarterTime; + return Math.round(quarters * this._getPPQ()); + } + /** + * Return the time in seconds. + */ + toSeconds() { + return this.valueOf(); + } + /** + * Return the value as a midi note. + */ + toMidi() { + return ftom(this.toFrequency()); + } + _now() { + return this.context.now(); + } +} +/** + * Create a TimeClass from a time string or number. The time is computed against the + * global Tone.Context. To use a specific context, use [[TimeClass]] + * @param value A value which represents time + * @param units The value's units if they can't be inferred by the value. + * @category Unit + * @example + * const time = Tone.Time("4n").toSeconds(); + * console.log(time); + * @example + * const note = Tone.Time(1).toNotation(); + * console.log(note); + * @example + * const freq = Tone.Time(0.5).toFrequency(); + * console.log(freq); + */ +function Time(value, units) { + return new TimeClass(getContext(), value, units); +} + +/** + * Frequency is a primitive type for encoding Frequency values. + * Eventually all time values are evaluated to hertz using the `valueOf` method. + * @example + * Tone.Frequency("C3"); // 261 + * Tone.Frequency(38, "midi"); + * Tone.Frequency("C3").transpose(4); + * @category Unit + */ +class FrequencyClass extends TimeClass { + constructor() { + super(...arguments); + this.name = "Frequency"; + this.defaultUnits = "hz"; + } + /** + * The [concert tuning pitch](https://en.wikipedia.org/wiki/Concert_pitch) which is used + * to generate all the other pitch values from notes. A4's values in Hertz. + */ + static get A4() { + return getA4(); + } + static set A4(freq) { + setA4(freq); + } + //------------------------------------- + // AUGMENT BASE EXPRESSIONS + //------------------------------------- + _getExpressions() { + return Object.assign({}, super._getExpressions(), { + midi: { + regexp: /^(\d+(?:\.\d+)?midi)/, + method(value) { + if (this.defaultUnits === "midi") { + return value; + } + else { + return FrequencyClass.mtof(value); + } + }, + }, + note: { + regexp: /^([a-g]{1}(?:b|#|x|bb)?)(-?[0-9]+)/i, + method(pitch, octave) { + const index = noteToScaleIndex[pitch.toLowerCase()]; + const noteNumber = index + (parseInt(octave, 10) + 1) * 12; + if (this.defaultUnits === "midi") { + return noteNumber; + } + else { + return FrequencyClass.mtof(noteNumber); + } + }, + }, + tr: { + regexp: /^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?):?(\d+(?:\.\d+)?)?/, + method(m, q, s) { + let total = 1; + if (m && m !== "0") { + total *= this._beatsToUnits(this._getTimeSignature() * parseFloat(m)); + } + if (q && q !== "0") { + total *= this._beatsToUnits(parseFloat(q)); + } + if (s && s !== "0") { + total *= this._beatsToUnits(parseFloat(s) / 4); + } + return total; + }, + }, + }); + } + //------------------------------------- + // EXPRESSIONS + //------------------------------------- + /** + * Transposes the frequency by the given number of semitones. + * @return A new transposed frequency + * @example + * Tone.Frequency("A4").transpose(3); // "C5" + */ + transpose(interval) { + return new FrequencyClass(this.context, this.valueOf() * intervalToFrequencyRatio(interval)); + } + /** + * Takes an array of semitone intervals and returns + * an array of frequencies transposed by those intervals. + * @return Returns an array of Frequencies + * @example + * Tone.Frequency("A4").harmonize([0, 3, 7]); // ["A4", "C5", "E5"] + */ + harmonize(intervals) { + return intervals.map(interval => { + return this.transpose(interval); + }); + } + //------------------------------------- + // UNIT CONVERSIONS + //------------------------------------- + /** + * Return the value of the frequency as a MIDI note + * @example + * Tone.Frequency("C4").toMidi(); // 60 + */ + toMidi() { + return ftom(this.valueOf()); + } + /** + * Return the value of the frequency in Scientific Pitch Notation + * @example + * Tone.Frequency(69, "midi").toNote(); // "A4" + */ + toNote() { + const freq = this.toFrequency(); + const log = Math.log2(freq / FrequencyClass.A4); + let noteNumber = Math.round(12 * log) + 57; + const octave = Math.floor(noteNumber / 12); + if (octave < 0) { + noteNumber += -12 * octave; + } + const noteName = scaleIndexToNote[noteNumber % 12]; + return noteName + octave.toString(); + } + /** + * Return the duration of one cycle in seconds. + */ + toSeconds() { + return 1 / super.toSeconds(); + } + /** + * Return the duration of one cycle in ticks + */ + toTicks() { + const quarterTime = this._beatsToUnits(1); + const quarters = this.valueOf() / quarterTime; + return Math.floor(quarters * this._getPPQ()); + } + //------------------------------------- + // UNIT CONVERSIONS HELPERS + //------------------------------------- + /** + * With no arguments, return 0 + */ + _noArg() { + return 0; + } + /** + * Returns the value of a frequency in the current units + */ + _frequencyToUnits(freq) { + return freq; + } + /** + * Returns the value of a tick in the current time units + */ + _ticksToUnits(ticks) { + return 1 / ((ticks * 60) / (this._getBpm() * this._getPPQ())); + } + /** + * Return the value of the beats in the current units + */ + _beatsToUnits(beats) { + return 1 / super._beatsToUnits(beats); + } + /** + * Returns the value of a second in the current units + */ + _secondsToUnits(seconds) { + return 1 / seconds; + } + /** + * Convert a MIDI note to frequency value. + * @param midi The midi number to convert. + * @return The corresponding frequency value + */ + static mtof(midi) { + return mtof(midi); + } + /** + * Convert a frequency value to a MIDI note. + * @param frequency The value to frequency value to convert. + */ + static ftom(frequency) { + return ftom(frequency); + } +} +//------------------------------------- +// FREQUENCY CONVERSIONS +//------------------------------------- +/** + * Note to scale index. + * @hidden + */ +const noteToScaleIndex = { + cbb: -2, cb: -1, c: 0, "c#": 1, cx: 2, + dbb: 0, db: 1, d: 2, "d#": 3, dx: 4, + ebb: 2, eb: 3, e: 4, "e#": 5, ex: 6, + fbb: 3, fb: 4, f: 5, "f#": 6, fx: 7, + gbb: 5, gb: 6, g: 7, "g#": 8, gx: 9, + abb: 7, ab: 8, a: 9, "a#": 10, ax: 11, + bbb: 9, bb: 10, b: 11, "b#": 12, bx: 13, +}; +/** + * scale index to note (sharps) + * @hidden + */ +const scaleIndexToNote = ["C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"]; +/** + * Convert a value into a FrequencyClass object. + * @category Unit + * @example + * const midi = Tone.Frequency("C3").toMidi(); + * console.log(midi); + * @example + * const hertz = Tone.Frequency(38, "midi").toFrequency(); + * console.log(hertz); + */ +function Frequency(value, units) { + return new FrequencyClass(getContext(), value, units); +} + +/** + * TransportTime is a the time along the Transport's + * timeline. It is similar to Tone.Time, but instead of evaluating + * against the AudioContext's clock, it is evaluated against + * the Transport's position. See [TransportTime wiki](https://github.com/Tonejs/Tone.js/wiki/TransportTime). + * @category Unit + */ +class TransportTimeClass extends TimeClass { + constructor() { + super(...arguments); + this.name = "TransportTime"; + } + /** + * Return the current time in whichever context is relevant + */ + _now() { + return this.context.transport.seconds; + } +} +/** + * TransportTime is a the time along the Transport's + * timeline. It is similar to [[Time]], but instead of evaluating + * against the AudioContext's clock, it is evaluated against + * the Transport's position. See [TransportTime wiki](https://github.com/Tonejs/Tone.js/wiki/TransportTime). + * @category Unit + */ +function TransportTime(value, units) { + return new TransportTimeClass(getContext(), value, units); +} + +/** + * The Base class for all nodes that have an AudioContext. + */ +class ToneWithContext extends Tone { + constructor() { + super(); + const options = optionsFromArguments(ToneWithContext.getDefaults(), arguments, ["context"]); + if (this.defaultContext) { + this.context = this.defaultContext; + } + else { + this.context = options.context; + } + } + static getDefaults() { + return { + context: getContext(), + }; + } + /** + * Return the current time of the Context clock plus the lookAhead. + * @example + * setInterval(() => { + * console.log(Tone.now()); + * }, 100); + */ + now() { + return this.context.currentTime + this.context.lookAhead; + } + /** + * Return the current time of the Context clock without any lookAhead. + * @example + * setInterval(() => { + * console.log(Tone.immediate()); + * }, 100); + */ + immediate() { + return this.context.currentTime; + } + /** + * The duration in seconds of one sample. + * @example + * console.log(Tone.Transport.sampleTime); + */ + get sampleTime() { + return 1 / this.context.sampleRate; + } + /** + * The number of seconds of 1 processing block (128 samples) + * @example + * console.log(Tone.Destination.blockTime); + */ + get blockTime() { + return 128 / this.context.sampleRate; + } + /** + * Convert the incoming time to seconds. + * This is calculated against the current [[Tone.Transport]] bpm + * @example + * const gain = new Tone.Gain(); + * setInterval(() => console.log(gain.toSeconds("4n")), 100); + * // ramp the tempo to 60 bpm over 30 seconds + * Tone.getTransport().bpm.rampTo(60, 30); + */ + toSeconds(time) { + return new TimeClass(this.context, time).toSeconds(); + } + /** + * Convert the input to a frequency number + * @example + * const gain = new Tone.Gain(); + * console.log(gain.toFrequency("4n")); + */ + toFrequency(freq) { + return new FrequencyClass(this.context, freq).toFrequency(); + } + /** + * Convert the input time into ticks + * @example + * const gain = new Tone.Gain(); + * console.log(gain.toTicks("4n")); + */ + toTicks(time) { + return new TransportTimeClass(this.context, time).toTicks(); + } + //------------------------------------- + // GET/SET + //------------------------------------- + /** + * Get a subset of the properties which are in the partial props + */ + _getPartialProperties(props) { + const options = this.get(); + // remove attributes from the prop that are not in the partial + Object.keys(options).forEach(name => { + if (isUndef(props[name])) { + delete options[name]; + } + }); + return options; + } + /** + * Get the object's attributes. + * @example + * const osc = new Tone.Oscillator(); + * console.log(osc.get()); + */ + get() { + const defaults = getDefaultsFromInstance(this); + Object.keys(defaults).forEach(attribute => { + if (Reflect.has(this, attribute)) { + const member = this[attribute]; + if (isDefined(member) && isDefined(member.value) && isDefined(member.setValueAtTime)) { + defaults[attribute] = member.value; + } + else if (member instanceof ToneWithContext) { + defaults[attribute] = member._getPartialProperties(defaults[attribute]); + // otherwise make sure it's a serializable type + } + else if (isArray(member) || isNumber(member) || isString(member) || isBoolean(member)) { + defaults[attribute] = member; + } + else { + // remove all undefined and unserializable attributes + delete defaults[attribute]; + } + } + }); + return defaults; + } + /** + * Set multiple properties at once with an object. + * @example + * const filter = new Tone.Filter().toDestination(); + * // set values using an object + * filter.set({ + * frequency: "C6", + * type: "highpass" + * }); + * const player = new Tone.Player("https://tonejs.github.io/audio/berklee/Analogsynth_octaves_highmid.mp3").connect(filter); + * player.autostart = true; + */ + set(props) { + Object.keys(props).forEach(attribute => { + if (Reflect.has(this, attribute) && isDefined(this[attribute])) { + if (this[attribute] && isDefined(this[attribute].value) && isDefined(this[attribute].setValueAtTime)) { + // small optimization + if (this[attribute].value !== props[attribute]) { + this[attribute].value = props[attribute]; + } + } + else if (this[attribute] instanceof ToneWithContext) { + this[attribute].set(props[attribute]); + } + else { + this[attribute] = props[attribute]; + } + } + }); + return this; + } +} + +/** + * A Timeline State. Provides the methods: `setStateAtTime("state", time)` and `getValueAtTime(time)` + * @param initial The initial state of the StateTimeline. Defaults to `undefined` + */ +class StateTimeline extends Timeline { + constructor(initial = "stopped") { + super(); + this.name = "StateTimeline"; + this._initial = initial; + this.setStateAtTime(this._initial, 0); + } + /** + * Returns the scheduled state scheduled before or at + * the given time. + * @param time The time to query. + * @return The name of the state input in setStateAtTime. + */ + getValueAtTime(time) { + const event = this.get(time); + if (event !== null) { + return event.state; + } + else { + return this._initial; + } + } + /** + * Add a state to the timeline. + * @param state The name of the state to set. + * @param time The time to query. + * @param options Any additional options that are needed in the timeline. + */ + setStateAtTime(state, time, options) { + assertRange(time, 0); + this.add(Object.assign({}, options, { + state, + time, + })); + return this; + } + /** + * Return the event before the time with the given state + * @param state The state to look for + * @param time When to check before + * @return The event with the given state before the time + */ + getLastState(state, time) { + // time = this.toSeconds(time); + const index = this._search(time); + for (let i = index; i >= 0; i--) { + const event = this._timeline[i]; + if (event.state === state) { + return event; + } + } + } + /** + * Return the event after the time with the given state + * @param state The state to look for + * @param time When to check from + * @return The event with the given state after the time + */ + getNextState(state, time) { + // time = this.toSeconds(time); + const index = this._search(time); + if (index !== -1) { + for (let i = index; i < this._timeline.length; i++) { + const event = this._timeline[i]; + if (event.state === state) { + return event; + } + } + } + } +} + +/** + * Param wraps the native Web Audio's AudioParam to provide + * additional unit conversion functionality. It also + * serves as a base-class for classes which have a single, + * automatable parameter. + * @category Core + */ +class Param extends ToneWithContext { + constructor() { + super(optionsFromArguments(Param.getDefaults(), arguments, ["param", "units", "convert"])); + this.name = "Param"; + this.overridden = false; + /** + * The minimum output value + */ + this._minOutput = 1e-7; + const options = optionsFromArguments(Param.getDefaults(), arguments, ["param", "units", "convert"]); + assert(isDefined(options.param) && + (isAudioParam(options.param) || options.param instanceof Param), "param must be an AudioParam"); + while (!isAudioParam(options.param)) { + options.param = options.param._param; + } + this._swappable = isDefined(options.swappable) ? options.swappable : false; + if (this._swappable) { + this.input = this.context.createGain(); + // initialize + this._param = options.param; + this.input.connect(this._param); + } + else { + this._param = this.input = options.param; + } + this._events = new Timeline(1000); + this._initialValue = this._param.defaultValue; + this.units = options.units; + this.convert = options.convert; + this._minValue = options.minValue; + this._maxValue = options.maxValue; + // if the value is defined, set it immediately + if (isDefined(options.value) && options.value !== this._toType(this._initialValue)) { + this.setValueAtTime(options.value, 0); + } + } + static getDefaults() { + return Object.assign(ToneWithContext.getDefaults(), { + convert: true, + units: "number", + }); + } + get value() { + const now = this.now(); + return this.getValueAtTime(now); + } + set value(value) { + this.cancelScheduledValues(this.now()); + this.setValueAtTime(value, this.now()); + } + get minValue() { + // if it's not the default minValue, return it + if (isDefined(this._minValue)) { + return this._minValue; + } + else if (this.units === "time" || this.units === "frequency" || + this.units === "normalRange" || this.units === "positive" || + this.units === "transportTime" || this.units === "ticks" || + this.units === "bpm" || this.units === "hertz" || this.units === "samples") { + return 0; + } + else if (this.units === "audioRange") { + return -1; + } + else if (this.units === "decibels") { + return -Infinity; + } + else { + return this._param.minValue; + } + } + get maxValue() { + if (isDefined(this._maxValue)) { + return this._maxValue; + } + else if (this.units === "normalRange" || + this.units === "audioRange") { + return 1; + } + else { + return this._param.maxValue; + } + } + /** + * Type guard based on the unit name + */ + _is(arg, type) { + return this.units === type; + } + /** + * Make sure the value is always in the defined range + */ + _assertRange(value) { + if (isDefined(this.maxValue) && isDefined(this.minValue)) { + assertRange(value, this._fromType(this.minValue), this._fromType(this.maxValue)); + } + return value; + } + /** + * Convert the given value from the type specified by Param.units + * into the destination value (such as Gain or Frequency). + */ + _fromType(val) { + if (this.convert && !this.overridden) { + if (this._is(val, "time")) { + return this.toSeconds(val); + } + else if (this._is(val, "decibels")) { + return dbToGain(val); + } + else if (this._is(val, "frequency")) { + return this.toFrequency(val); + } + else { + return val; + } + } + else if (this.overridden) { + // if it's overridden, should only schedule 0s + return 0; + } + else { + return val; + } + } + /** + * Convert the parameters value into the units specified by Param.units. + */ + _toType(val) { + if (this.convert && this.units === "decibels") { + return gainToDb(val); + } + else { + return val; + } + } + //------------------------------------- + // ABSTRACT PARAM INTERFACE + // all docs are generated from ParamInterface.ts + //------------------------------------- + setValueAtTime(value, time) { + const computedTime = this.toSeconds(time); + const numericValue = this._fromType(value); + assert(isFinite(numericValue) && isFinite(computedTime), `Invalid argument(s) to setValueAtTime: ${JSON.stringify(value)}, ${JSON.stringify(time)}`); + this._assertRange(numericValue); + this.log(this.units, "setValueAtTime", value, computedTime); + this._events.add({ + time: computedTime, + type: "setValueAtTime", + value: numericValue, + }); + this._param.setValueAtTime(numericValue, computedTime); + return this; + } + getValueAtTime(time) { + const computedTime = Math.max(this.toSeconds(time), 0); + const after = this._events.getAfter(computedTime); + const before = this._events.get(computedTime); + let value = this._initialValue; + // if it was set by + if (before === null) { + value = this._initialValue; + } + else if (before.type === "setTargetAtTime" && (after === null || after.type === "setValueAtTime")) { + const previous = this._events.getBefore(before.time); + let previousVal; + if (previous === null) { + previousVal = this._initialValue; + } + else { + previousVal = previous.value; + } + if (before.type === "setTargetAtTime") { + value = this._exponentialApproach(before.time, previousVal, before.value, before.constant, computedTime); + } + } + else if (after === null) { + value = before.value; + } + else if (after.type === "linearRampToValueAtTime" || after.type === "exponentialRampToValueAtTime") { + let beforeValue = before.value; + if (before.type === "setTargetAtTime") { + const previous = this._events.getBefore(before.time); + if (previous === null) { + beforeValue = this._initialValue; + } + else { + beforeValue = previous.value; + } + } + if (after.type === "linearRampToValueAtTime") { + value = this._linearInterpolate(before.time, beforeValue, after.time, after.value, computedTime); + } + else { + value = this._exponentialInterpolate(before.time, beforeValue, after.time, after.value, computedTime); + } + } + else { + value = before.value; + } + return this._toType(value); + } + setRampPoint(time) { + time = this.toSeconds(time); + let currentVal = this.getValueAtTime(time); + this.cancelAndHoldAtTime(time); + if (this._fromType(currentVal) === 0) { + currentVal = this._toType(this._minOutput); + } + this.setValueAtTime(currentVal, time); + return this; + } + linearRampToValueAtTime(value, endTime) { + const numericValue = this._fromType(value); + const computedTime = this.toSeconds(endTime); + assert(isFinite(numericValue) && isFinite(computedTime), `Invalid argument(s) to linearRampToValueAtTime: ${JSON.stringify(value)}, ${JSON.stringify(endTime)}`); + this._assertRange(numericValue); + this._events.add({ + time: computedTime, + type: "linearRampToValueAtTime", + value: numericValue, + }); + this.log(this.units, "linearRampToValueAtTime", value, computedTime); + this._param.linearRampToValueAtTime(numericValue, computedTime); + return this; + } + exponentialRampToValueAtTime(value, endTime) { + let numericValue = this._fromType(value); + // the value can't be 0 + numericValue = EQ(numericValue, 0) ? this._minOutput : numericValue; + this._assertRange(numericValue); + const computedTime = this.toSeconds(endTime); + assert(isFinite(numericValue) && isFinite(computedTime), `Invalid argument(s) to exponentialRampToValueAtTime: ${JSON.stringify(value)}, ${JSON.stringify(endTime)}`); + // store the event + this._events.add({ + time: computedTime, + type: "exponentialRampToValueAtTime", + value: numericValue, + }); + this.log(this.units, "exponentialRampToValueAtTime", value, computedTime); + this._param.exponentialRampToValueAtTime(numericValue, computedTime); + return this; + } + exponentialRampTo(value, rampTime, startTime) { + startTime = this.toSeconds(startTime); + this.setRampPoint(startTime); + this.exponentialRampToValueAtTime(value, startTime + this.toSeconds(rampTime)); + return this; + } + linearRampTo(value, rampTime, startTime) { + startTime = this.toSeconds(startTime); + this.setRampPoint(startTime); + this.linearRampToValueAtTime(value, startTime + this.toSeconds(rampTime)); + return this; + } + targetRampTo(value, rampTime, startTime) { + startTime = this.toSeconds(startTime); + this.setRampPoint(startTime); + this.exponentialApproachValueAtTime(value, startTime, rampTime); + return this; + } + exponentialApproachValueAtTime(value, time, rampTime) { + time = this.toSeconds(time); + rampTime = this.toSeconds(rampTime); + const timeConstant = Math.log(rampTime + 1) / Math.log(200); + this.setTargetAtTime(value, time, timeConstant); + // at 90% start a linear ramp to the final value + this.cancelAndHoldAtTime(time + rampTime * 0.9); + this.linearRampToValueAtTime(value, time + rampTime); + return this; + } + setTargetAtTime(value, startTime, timeConstant) { + const numericValue = this._fromType(value); + // The value will never be able to approach without timeConstant > 0. + assert(isFinite(timeConstant) && timeConstant > 0, "timeConstant must be a number greater than 0"); + const computedTime = this.toSeconds(startTime); + this._assertRange(numericValue); + assert(isFinite(numericValue) && isFinite(computedTime), `Invalid argument(s) to setTargetAtTime: ${JSON.stringify(value)}, ${JSON.stringify(startTime)}`); + this._events.add({ + constant: timeConstant, + time: computedTime, + type: "setTargetAtTime", + value: numericValue, + }); + this.log(this.units, "setTargetAtTime", value, computedTime, timeConstant); + this._param.setTargetAtTime(numericValue, computedTime, timeConstant); + return this; + } + setValueCurveAtTime(values, startTime, duration, scaling = 1) { + duration = this.toSeconds(duration); + startTime = this.toSeconds(startTime); + const startingValue = this._fromType(values[0]) * scaling; + this.setValueAtTime(this._toType(startingValue), startTime); + const segTime = duration / (values.length - 1); + for (let i = 1; i < values.length; i++) { + const numericValue = this._fromType(values[i]) * scaling; + this.linearRampToValueAtTime(this._toType(numericValue), startTime + i * segTime); + } + return this; + } + cancelScheduledValues(time) { + const computedTime = this.toSeconds(time); + assert(isFinite(computedTime), `Invalid argument to cancelScheduledValues: ${JSON.stringify(time)}`); + this._events.cancel(computedTime); + this._param.cancelScheduledValues(computedTime); + this.log(this.units, "cancelScheduledValues", computedTime); + return this; + } + cancelAndHoldAtTime(time) { + const computedTime = this.toSeconds(time); + const valueAtTime = this._fromType(this.getValueAtTime(computedTime)); + // remove the schedule events + assert(isFinite(computedTime), `Invalid argument to cancelAndHoldAtTime: ${JSON.stringify(time)}`); + this.log(this.units, "cancelAndHoldAtTime", computedTime, "value=" + valueAtTime); + // if there is an event at the given computedTime + // and that even is not a "set" + const before = this._events.get(computedTime); + const after = this._events.getAfter(computedTime); + if (before && EQ(before.time, computedTime)) { + // remove everything after + if (after) { + this._param.cancelScheduledValues(after.time); + this._events.cancel(after.time); + } + else { + this._param.cancelAndHoldAtTime(computedTime); + this._events.cancel(computedTime + this.sampleTime); + } + } + else if (after) { + this._param.cancelScheduledValues(after.time); + // cancel the next event(s) + this._events.cancel(after.time); + if (after.type === "linearRampToValueAtTime") { + this.linearRampToValueAtTime(this._toType(valueAtTime), computedTime); + } + else if (after.type === "exponentialRampToValueAtTime") { + this.exponentialRampToValueAtTime(this._toType(valueAtTime), computedTime); + } + } + // set the value at the given time + this._events.add({ + time: computedTime, + type: "setValueAtTime", + value: valueAtTime, + }); + this._param.setValueAtTime(valueAtTime, computedTime); + return this; + } + rampTo(value, rampTime = 0.1, startTime) { + if (this.units === "frequency" || this.units === "bpm" || this.units === "decibels") { + this.exponentialRampTo(value, rampTime, startTime); + } + else { + this.linearRampTo(value, rampTime, startTime); + } + return this; + } + /** + * Apply all of the previously scheduled events to the passed in Param or AudioParam. + * The applied values will start at the context's current time and schedule + * all of the events which are scheduled on this Param onto the passed in param. + */ + apply(param) { + const now = this.context.currentTime; + // set the param's value at the current time and schedule everything else + param.setValueAtTime(this.getValueAtTime(now), now); + // if the previous event was a curve, then set the rest of it + const previousEvent = this._events.get(now); + if (previousEvent && previousEvent.type === "setTargetAtTime") { + // approx it until the next event with linear ramps + const nextEvent = this._events.getAfter(previousEvent.time); + // or for 2 seconds if there is no event + const endTime = nextEvent ? nextEvent.time : now + 2; + const subdivisions = (endTime - now) / 10; + for (let i = now; i < endTime; i += subdivisions) { + param.linearRampToValueAtTime(this.getValueAtTime(i), i); + } + } + this._events.forEachAfter(this.context.currentTime, event => { + if (event.type === "cancelScheduledValues") { + param.cancelScheduledValues(event.time); + } + else if (event.type === "setTargetAtTime") { + param.setTargetAtTime(event.value, event.time, event.constant); + } + else { + param[event.type](event.value, event.time); + } + }); + return this; + } + /** + * Replace the Param's internal AudioParam. Will apply scheduled curves + * onto the parameter and replace the connections. + */ + setParam(param) { + assert(this._swappable, "The Param must be assigned as 'swappable' in the constructor"); + const input = this.input; + input.disconnect(this._param); + this.apply(param); + this._param = param; + input.connect(this._param); + return this; + } + dispose() { + super.dispose(); + this._events.dispose(); + return this; + } + get defaultValue() { + return this._toType(this._param.defaultValue); + } + //------------------------------------- + // AUTOMATION CURVE CALCULATIONS + // MIT License, copyright (c) 2014 Jordan Santell + //------------------------------------- + // Calculates the the value along the curve produced by setTargetAtTime + _exponentialApproach(t0, v0, v1, timeConstant, t) { + return v1 + (v0 - v1) * Math.exp(-(t - t0) / timeConstant); + } + // Calculates the the value along the curve produced by linearRampToValueAtTime + _linearInterpolate(t0, v0, t1, v1, t) { + return v0 + (v1 - v0) * ((t - t0) / (t1 - t0)); + } + // Calculates the the value along the curve produced by exponentialRampToValueAtTime + _exponentialInterpolate(t0, v0, t1, v1, t) { + return v0 * Math.pow(v1 / v0, (t - t0) / (t1 - t0)); + } +} + +/** + * ToneAudioNode is the base class for classes which process audio. + */ +class ToneAudioNode extends ToneWithContext { + constructor() { + super(...arguments); + /** + * The name of the class + */ + this.name = "ToneAudioNode"; + /** + * List all of the node that must be set to match the ChannelProperties + */ + this._internalChannels = []; + } + /** + * The number of inputs feeding into the AudioNode. + * For source nodes, this will be 0. + * @example + * const node = new Tone.Gain(); + * console.log(node.numberOfInputs); + */ + get numberOfInputs() { + if (isDefined(this.input)) { + if (isAudioParam(this.input) || this.input instanceof Param) { + return 1; + } + else { + return this.input.numberOfInputs; + } + } + else { + return 0; + } + } + /** + * The number of outputs of the AudioNode. + * @example + * const node = new Tone.Gain(); + * console.log(node.numberOfOutputs); + */ + get numberOfOutputs() { + if (isDefined(this.output)) { + return this.output.numberOfOutputs; + } + else { + return 0; + } + } + //------------------------------------- + // AUDIO PROPERTIES + //------------------------------------- + /** + * Used to decide which nodes to get/set properties on + */ + _isAudioNode(node) { + return isDefined(node) && (node instanceof ToneAudioNode || isAudioNode$1(node)); + } + /** + * Get all of the audio nodes (either internal or input/output) which together + * make up how the class node responds to channel input/output + */ + _getInternalNodes() { + const nodeList = this._internalChannels.slice(0); + if (this._isAudioNode(this.input)) { + nodeList.push(this.input); + } + if (this._isAudioNode(this.output)) { + if (this.input !== this.output) { + nodeList.push(this.output); + } + } + return nodeList; + } + /** + * Set the audio options for this node such as channelInterpretation + * channelCount, etc. + * @param options + */ + _setChannelProperties(options) { + const nodeList = this._getInternalNodes(); + nodeList.forEach(node => { + node.channelCount = options.channelCount; + node.channelCountMode = options.channelCountMode; + node.channelInterpretation = options.channelInterpretation; + }); + } + /** + * Get the current audio options for this node such as channelInterpretation + * channelCount, etc. + */ + _getChannelProperties() { + const nodeList = this._getInternalNodes(); + assert(nodeList.length > 0, "ToneAudioNode does not have any internal nodes"); + // use the first node to get properties + // they should all be the same + const node = nodeList[0]; + return { + channelCount: node.channelCount, + channelCountMode: node.channelCountMode, + channelInterpretation: node.channelInterpretation, + }; + } + /** + * channelCount is the number of channels used when up-mixing and down-mixing + * connections to any inputs to the node. The default value is 2 except for + * specific nodes where its value is specially determined. + */ + get channelCount() { + return this._getChannelProperties().channelCount; + } + set channelCount(channelCount) { + const props = this._getChannelProperties(); + // merge it with the other properties + this._setChannelProperties(Object.assign(props, { channelCount })); + } + /** + * channelCountMode determines how channels will be counted when up-mixing and + * down-mixing connections to any inputs to the node. + * The default value is "max". This attribute has no effect for nodes with no inputs. + * * "max" - computedNumberOfChannels is the maximum of the number of channels of all connections to an input. In this mode channelCount is ignored. + * * "clamped-max" - computedNumberOfChannels is determined as for "max" and then clamped to a maximum value of the given channelCount. + * * "explicit" - computedNumberOfChannels is the exact value as specified by the channelCount. + */ + get channelCountMode() { + return this._getChannelProperties().channelCountMode; + } + set channelCountMode(channelCountMode) { + const props = this._getChannelProperties(); + // merge it with the other properties + this._setChannelProperties(Object.assign(props, { channelCountMode })); + } + /** + * channelInterpretation determines how individual channels will be treated + * when up-mixing and down-mixing connections to any inputs to the node. + * The default value is "speakers". + */ + get channelInterpretation() { + return this._getChannelProperties().channelInterpretation; + } + set channelInterpretation(channelInterpretation) { + const props = this._getChannelProperties(); + // merge it with the other properties + this._setChannelProperties(Object.assign(props, { channelInterpretation })); + } + //------------------------------------- + // CONNECTIONS + //------------------------------------- + /** + * connect the output of a ToneAudioNode to an AudioParam, AudioNode, or ToneAudioNode + * @param destination The output to connect to + * @param outputNum The output to connect from + * @param inputNum The input to connect to + */ + connect(destination, outputNum = 0, inputNum = 0) { + connect(this, destination, outputNum, inputNum); + return this; + } + /** + * Connect the output to the context's destination node. + * @example + * const osc = new Tone.Oscillator("C2").start(); + * osc.toDestination(); + */ + toDestination() { + this.connect(this.context.destination); + return this; + } + /** + * Connect the output to the context's destination node. + * See [[toDestination]] + * @deprecated + */ + toMaster() { + warn("toMaster() has been renamed toDestination()"); + return this.toDestination(); + } + /** + * disconnect the output + */ + disconnect(destination, outputNum = 0, inputNum = 0) { + disconnect(this, destination, outputNum, inputNum); + return this; + } + /** + * Connect the output of this node to the rest of the nodes in series. + * @example + * const player = new Tone.Player("https://tonejs.github.io/audio/drum-samples/handdrum-loop.mp3"); + * player.autostart = true; + * const filter = new Tone.AutoFilter(4).start(); + * const distortion = new Tone.Distortion(0.5); + * // connect the player to the filter, distortion and then to the master output + * player.chain(filter, distortion, Tone.Destination); + */ + chain(...nodes) { + connectSeries(this, ...nodes); + return this; + } + /** + * connect the output of this node to the rest of the nodes in parallel. + * @example + * const player = new Tone.Player("https://tonejs.github.io/audio/drum-samples/conga-rhythm.mp3"); + * player.autostart = true; + * const pitchShift = new Tone.PitchShift(4).toDestination(); + * const filter = new Tone.Filter("G5").toDestination(); + * // connect a node to the pitch shift and filter in parallel + * player.fan(pitchShift, filter); + */ + fan(...nodes) { + nodes.forEach(node => this.connect(node)); + return this; + } + /** + * Dispose and disconnect + */ + dispose() { + super.dispose(); + if (isDefined(this.input)) { + if (this.input instanceof ToneAudioNode) { + this.input.dispose(); + } + else if (isAudioNode$1(this.input)) { + this.input.disconnect(); + } + } + if (isDefined(this.output)) { + if (this.output instanceof ToneAudioNode) { + this.output.dispose(); + } + else if (isAudioNode$1(this.output)) { + this.output.disconnect(); + } + } + this._internalChannels = []; + return this; + } +} +//------------------------------------- +// CONNECTIONS +//------------------------------------- +/** + * connect together all of the arguments in series + * @param nodes + */ +function connectSeries(...nodes) { + const first = nodes.shift(); + nodes.reduce((prev, current) => { + if (prev instanceof ToneAudioNode) { + prev.connect(current); + } + else if (isAudioNode$1(prev)) { + connect(prev, current); + } + return current; + }, first); +} +/** + * Connect two nodes together so that signal flows from the + * first node to the second. Optionally specify the input and output channels. + * @param srcNode The source node + * @param dstNode The destination node + * @param outputNumber The output channel of the srcNode + * @param inputNumber The input channel of the dstNode + */ +function connect(srcNode, dstNode, outputNumber = 0, inputNumber = 0) { + assert(isDefined(srcNode), "Cannot connect from undefined node"); + assert(isDefined(dstNode), "Cannot connect to undefined node"); + if (dstNode instanceof ToneAudioNode || isAudioNode$1(dstNode)) { + assert(dstNode.numberOfInputs > 0, "Cannot connect to node with no inputs"); + } + assert(srcNode.numberOfOutputs > 0, "Cannot connect from node with no outputs"); + // resolve the input of the dstNode + while ((dstNode instanceof ToneAudioNode || dstNode instanceof Param)) { + if (isDefined(dstNode.input)) { + dstNode = dstNode.input; + } + } + while (srcNode instanceof ToneAudioNode) { + if (isDefined(srcNode.output)) { + srcNode = srcNode.output; + } + } + // make the connection + if (isAudioParam(dstNode)) { + srcNode.connect(dstNode, outputNumber); + } + else { + srcNode.connect(dstNode, outputNumber, inputNumber); + } +} +/** + * Disconnect a node from all nodes or optionally include a destination node and input/output channels. + * @param srcNode The source node + * @param dstNode The destination node + * @param outputNumber The output channel of the srcNode + * @param inputNumber The input channel of the dstNode + */ +function disconnect(srcNode, dstNode, outputNumber = 0, inputNumber = 0) { + // resolve the destination node + if (isDefined(dstNode)) { + while (dstNode instanceof ToneAudioNode) { + dstNode = dstNode.input; + } + } + // resolve the src node + while (!(isAudioNode$1(srcNode))) { + if (isDefined(srcNode.output)) { + srcNode = srcNode.output; + } + } + if (isAudioParam(dstNode)) { + srcNode.disconnect(dstNode, outputNumber); + } + else if (isAudioNode$1(dstNode)) { + srcNode.disconnect(dstNode, outputNumber, inputNumber); + } + else { + srcNode.disconnect(); + } +} + +/** + * A thin wrapper around the Native Web Audio GainNode. + * The GainNode is a basic building block of the Web Audio + * API and is useful for routing audio and adjusting gains. + * @category Core + * @example + * return Tone.Offline(() => { + * const gainNode = new Tone.Gain(0).toDestination(); + * const osc = new Tone.Oscillator(30).connect(gainNode).start(); + * gainNode.gain.rampTo(1, 0.1); + * gainNode.gain.rampTo(0, 0.4, 0.2); + * }, 0.7, 1); + */ +class Gain extends ToneAudioNode { + constructor() { + super(optionsFromArguments(Gain.getDefaults(), arguments, ["gain", "units"])); + this.name = "Gain"; + /** + * The wrapped GainNode. + */ + this._gainNode = this.context.createGain(); + // input = output + this.input = this._gainNode; + this.output = this._gainNode; + const options = optionsFromArguments(Gain.getDefaults(), arguments, ["gain", "units"]); + this.gain = new Param({ + context: this.context, + convert: options.convert, + param: this._gainNode.gain, + units: options.units, + value: options.gain, + minValue: options.minValue, + maxValue: options.maxValue, + }); + readOnly(this, "gain"); + } + static getDefaults() { + return Object.assign(ToneAudioNode.getDefaults(), { + convert: true, + gain: 1, + units: "gain", + }); + } + /** + * Clean up. + */ + dispose() { + super.dispose(); + this._gainNode.disconnect(); + this.gain.dispose(); + return this; + } +} + +/** + * Base class for fire-and-forget nodes + */ +class OneShotSource extends ToneAudioNode { + constructor(options) { + super(options); + /** + * The callback to invoke after the + * source is done playing. + */ + this.onended = noOp; + /** + * The start time + */ + this._startTime = -1; + /** + * The stop time + */ + this._stopTime = -1; + /** + * The id of the timeout + */ + this._timeout = -1; + /** + * The public output node + */ + this.output = new Gain({ + context: this.context, + gain: 0, + }); + /** + * The output gain node. + */ + this._gainNode = this.output; + /** + * Get the playback state at the given time + */ + this.getStateAtTime = function (time) { + const computedTime = this.toSeconds(time); + if (this._startTime !== -1 && + computedTime >= this._startTime && + (this._stopTime === -1 || computedTime <= this._stopTime)) { + return "started"; + } + else { + return "stopped"; + } + }; + this._fadeIn = options.fadeIn; + this._fadeOut = options.fadeOut; + this._curve = options.curve; + this.onended = options.onended; + } + static getDefaults() { + return Object.assign(ToneAudioNode.getDefaults(), { + curve: "linear", + fadeIn: 0, + fadeOut: 0, + onended: noOp, + }); + } + /** + * Start the source at the given time + * @param time When to start the source + */ + _startGain(time, gain = 1) { + assert(this._startTime === -1, "Source cannot be started more than once"); + // apply a fade in envelope + const fadeInTime = this.toSeconds(this._fadeIn); + // record the start time + this._startTime = time + fadeInTime; + this._startTime = Math.max(this._startTime, this.context.currentTime); + // schedule the envelope + if (fadeInTime > 0) { + this._gainNode.gain.setValueAtTime(0, time); + if (this._curve === "linear") { + this._gainNode.gain.linearRampToValueAtTime(gain, time + fadeInTime); + } + else { + this._gainNode.gain.exponentialApproachValueAtTime(gain, time, fadeInTime); + } + } + else { + this._gainNode.gain.setValueAtTime(gain, time); + } + return this; + } + /** + * Stop the source node at the given time. + * @param time When to stop the source + */ + stop(time) { + this.log("stop", time); + this._stopGain(this.toSeconds(time)); + return this; + } + /** + * Stop the source at the given time + * @param time When to stop the source + */ + _stopGain(time) { + assert(this._startTime !== -1, "'start' must be called before 'stop'"); + // cancel the previous stop + this.cancelStop(); + // the fadeOut time + const fadeOutTime = this.toSeconds(this._fadeOut); + // schedule the stop callback + this._stopTime = this.toSeconds(time) + fadeOutTime; + this._stopTime = Math.max(this._stopTime, this.context.currentTime); + if (fadeOutTime > 0) { + // start the fade out curve at the given time + if (this._curve === "linear") { + this._gainNode.gain.linearRampTo(0, fadeOutTime, time); + } + else { + this._gainNode.gain.targetRampTo(0, fadeOutTime, time); + } + } + else { + // stop any ongoing ramps, and set the value to 0 + this._gainNode.gain.cancelAndHoldAtTime(time); + this._gainNode.gain.setValueAtTime(0, time); + } + this.context.clearTimeout(this._timeout); + this._timeout = this.context.setTimeout(() => { + // allow additional time for the exponential curve to fully decay + const additionalTail = this._curve === "exponential" ? fadeOutTime * 2 : 0; + this._stopSource(this.now() + additionalTail); + this._onended(); + }, this._stopTime - this.context.currentTime); + return this; + } + /** + * Invoke the onended callback + */ + _onended() { + if (this.onended !== noOp) { + this.onended(this); + // overwrite onended to make sure it only is called once + this.onended = noOp; + // dispose when it's ended to free up for garbage collection only in the online context + if (!this.context.isOffline) { + const disposeCallback = () => this.dispose(); + // @ts-ignore + if (typeof window.requestIdleCallback !== "undefined") { + // @ts-ignore + window.requestIdleCallback(disposeCallback); + } + else { + setTimeout(disposeCallback, 1000); + } + } + } + } + /** + * Get the playback state at the current time + */ + get state() { + return this.getStateAtTime(this.now()); + } + /** + * Cancel a scheduled stop event + */ + cancelStop() { + this.log("cancelStop"); + assert(this._startTime !== -1, "Source is not started"); + // cancel the stop envelope + this._gainNode.gain.cancelScheduledValues(this._startTime + this.sampleTime); + this.context.clearTimeout(this._timeout); + this._stopTime = -1; + return this; + } + dispose() { + super.dispose(); + this._gainNode.disconnect(); + return this; + } +} + +/** + * Wrapper around the native fire-and-forget ConstantSource. + * Adds the ability to reschedule the stop method. + * @category Signal + */ +class ToneConstantSource extends OneShotSource { + constructor() { + super(optionsFromArguments(ToneConstantSource.getDefaults(), arguments, ["offset"])); + this.name = "ToneConstantSource"; + /** + * The signal generator + */ + this._source = this.context.createConstantSource(); + const options = optionsFromArguments(ToneConstantSource.getDefaults(), arguments, ["offset"]); + connect(this._source, this._gainNode); + this.offset = new Param({ + context: this.context, + convert: options.convert, + param: this._source.offset, + units: options.units, + value: options.offset, + minValue: options.minValue, + maxValue: options.maxValue, + }); + } + static getDefaults() { + return Object.assign(OneShotSource.getDefaults(), { + convert: true, + offset: 1, + units: "number", + }); + } + /** + * Start the source node at the given time + * @param time When to start the source + */ + start(time) { + const computedTime = this.toSeconds(time); + this.log("start", computedTime); + this._startGain(computedTime); + this._source.start(computedTime); + return this; + } + _stopSource(time) { + this._source.stop(time); + } + dispose() { + super.dispose(); + if (this.state === "started") { + this.stop(); + } + this._source.disconnect(); + this.offset.dispose(); + return this; + } +} + +/** + * A signal is an audio-rate value. Tone.Signal is a core component of the library. + * Unlike a number, Signals can be scheduled with sample-level accuracy. Tone.Signal + * has all of the methods available to native Web Audio + * [AudioParam](http://webaudio.github.io/web-audio-api/#the-audioparam-interface) + * as well as additional conveniences. Read more about working with signals + * [here](https://github.com/Tonejs/Tone.js/wiki/Signals). + * + * @example + * const osc = new Tone.Oscillator().toDestination().start(); + * // a scheduleable signal which can be connected to control an AudioParam or another Signal + * const signal = new Tone.Signal({ + * value: "C4", + * units: "frequency" + * }).connect(osc.frequency); + * // the scheduled ramp controls the connected signal + * signal.rampTo("C2", 4, "+0.5"); + * @category Signal + */ +class Signal extends ToneAudioNode { + constructor() { + super(optionsFromArguments(Signal.getDefaults(), arguments, ["value", "units"])); + this.name = "Signal"; + /** + * Indicates if the value should be overridden on connection. + */ + this.override = true; + const options = optionsFromArguments(Signal.getDefaults(), arguments, ["value", "units"]); + this.output = this._constantSource = new ToneConstantSource({ + context: this.context, + convert: options.convert, + offset: options.value, + units: options.units, + minValue: options.minValue, + maxValue: options.maxValue, + }); + this._constantSource.start(0); + this.input = this._param = this._constantSource.offset; + } + static getDefaults() { + return Object.assign(ToneAudioNode.getDefaults(), { + convert: true, + units: "number", + value: 0, + }); + } + connect(destination, outputNum = 0, inputNum = 0) { + // start it only when connected to something + connectSignal(this, destination, outputNum, inputNum); + return this; + } + dispose() { + super.dispose(); + this._param.dispose(); + this._constantSource.dispose(); + return this; + } + //------------------------------------- + // ABSTRACT PARAM INTERFACE + // just a proxy for the ConstantSourceNode's offset AudioParam + // all docs are generated from AbstractParam.ts + //------------------------------------- + setValueAtTime(value, time) { + this._param.setValueAtTime(value, time); + return this; + } + getValueAtTime(time) { + return this._param.getValueAtTime(time); + } + setRampPoint(time) { + this._param.setRampPoint(time); + return this; + } + linearRampToValueAtTime(value, time) { + this._param.linearRampToValueAtTime(value, time); + return this; + } + exponentialRampToValueAtTime(value, time) { + this._param.exponentialRampToValueAtTime(value, time); + return this; + } + exponentialRampTo(value, rampTime, startTime) { + this._param.exponentialRampTo(value, rampTime, startTime); + return this; + } + linearRampTo(value, rampTime, startTime) { + this._param.linearRampTo(value, rampTime, startTime); + return this; + } + targetRampTo(value, rampTime, startTime) { + this._param.targetRampTo(value, rampTime, startTime); + return this; + } + exponentialApproachValueAtTime(value, time, rampTime) { + this._param.exponentialApproachValueAtTime(value, time, rampTime); + return this; + } + setTargetAtTime(value, startTime, timeConstant) { + this._param.setTargetAtTime(value, startTime, timeConstant); + return this; + } + setValueCurveAtTime(values, startTime, duration, scaling) { + this._param.setValueCurveAtTime(values, startTime, duration, scaling); + return this; + } + cancelScheduledValues(time) { + this._param.cancelScheduledValues(time); + return this; + } + cancelAndHoldAtTime(time) { + this._param.cancelAndHoldAtTime(time); + return this; + } + rampTo(value, rampTime, startTime) { + this._param.rampTo(value, rampTime, startTime); + return this; + } + get value() { + return this._param.value; + } + set value(value) { + this._param.value = value; + } + get convert() { + return this._param.convert; + } + set convert(convert) { + this._param.convert = convert; + } + get units() { + return this._param.units; + } + get overridden() { + return this._param.overridden; + } + set overridden(overridden) { + this._param.overridden = overridden; + } + get maxValue() { + return this._param.maxValue; + } + get minValue() { + return this._param.minValue; + } + /** + * See [[Param.apply]]. + */ + apply(param) { + this._param.apply(param); + return this; + } +} +/** + * When connecting from a signal, it's necessary to zero out the node destination + * node if that node is also a signal. If the destination is not 0, then the values + * will be summed. This method insures that the output of the destination signal will + * be the same as the source signal, making the destination signal a pass through node. + * @param signal The output signal to connect from + * @param destination the destination to connect to + * @param outputNum the optional output number + * @param inputNum the input number + */ +function connectSignal(signal, destination, outputNum, inputNum) { + if (destination instanceof Param || isAudioParam(destination) || + (destination instanceof Signal && destination.override)) { + // cancel changes + destination.cancelScheduledValues(0); + // reset the value + destination.setValueAtTime(0, 0); + // mark the value as overridden + if (destination instanceof Signal) { + destination.overridden = true; + } + } + connect(signal, destination, outputNum, inputNum); +} + +/** + * A Param class just for computing ticks. Similar to the [[Param]] class, + * but offers conversion to BPM values as well as ability to compute tick + * duration and elapsed ticks + */ +class TickParam extends Param { + constructor() { + super(optionsFromArguments(TickParam.getDefaults(), arguments, ["value"])); + this.name = "TickParam"; + /** + * The timeline which tracks all of the automations. + */ + this._events = new Timeline(Infinity); + /** + * The internal holder for the multiplier value + */ + this._multiplier = 1; + const options = optionsFromArguments(TickParam.getDefaults(), arguments, ["value"]); + // set the multiplier + this._multiplier = options.multiplier; + // clear the ticks from the beginning + this._events.cancel(0); + // set an initial event + this._events.add({ + ticks: 0, + time: 0, + type: "setValueAtTime", + value: this._fromType(options.value), + }); + this.setValueAtTime(options.value, 0); + } + static getDefaults() { + return Object.assign(Param.getDefaults(), { + multiplier: 1, + units: "hertz", + value: 1, + }); + } + setTargetAtTime(value, time, constant) { + // approximate it with multiple linear ramps + time = this.toSeconds(time); + this.setRampPoint(time); + const computedValue = this._fromType(value); + // start from previously scheduled value + const prevEvent = this._events.get(time); + const segments = Math.round(Math.max(1 / constant, 1)); + for (let i = 0; i <= segments; i++) { + const segTime = constant * i + time; + const rampVal = this._exponentialApproach(prevEvent.time, prevEvent.value, computedValue, constant, segTime); + this.linearRampToValueAtTime(this._toType(rampVal), segTime); + } + return this; + } + setValueAtTime(value, time) { + const computedTime = this.toSeconds(time); + super.setValueAtTime(value, time); + const event = this._events.get(computedTime); + const previousEvent = this._events.previousEvent(event); + const ticksUntilTime = this._getTicksUntilEvent(previousEvent, computedTime); + event.ticks = Math.max(ticksUntilTime, 0); + return this; + } + linearRampToValueAtTime(value, time) { + const computedTime = this.toSeconds(time); + super.linearRampToValueAtTime(value, time); + const event = this._events.get(computedTime); + const previousEvent = this._events.previousEvent(event); + const ticksUntilTime = this._getTicksUntilEvent(previousEvent, computedTime); + event.ticks = Math.max(ticksUntilTime, 0); + return this; + } + exponentialRampToValueAtTime(value, time) { + // aproximate it with multiple linear ramps + time = this.toSeconds(time); + const computedVal = this._fromType(value); + // start from previously scheduled value + const prevEvent = this._events.get(time); + // approx 10 segments per second + const segments = Math.round(Math.max((time - prevEvent.time) * 10, 1)); + const segmentDur = ((time - prevEvent.time) / segments); + for (let i = 0; i <= segments; i++) { + const segTime = segmentDur * i + prevEvent.time; + const rampVal = this._exponentialInterpolate(prevEvent.time, prevEvent.value, time, computedVal, segTime); + this.linearRampToValueAtTime(this._toType(rampVal), segTime); + } + return this; + } + /** + * Returns the tick value at the time. Takes into account + * any automation curves scheduled on the signal. + * @param event The time to get the tick count at + * @return The number of ticks which have elapsed at the time given any automations. + */ + _getTicksUntilEvent(event, time) { + if (event === null) { + event = { + ticks: 0, + time: 0, + type: "setValueAtTime", + value: 0, + }; + } + else if (isUndef(event.ticks)) { + const previousEvent = this._events.previousEvent(event); + event.ticks = this._getTicksUntilEvent(previousEvent, event.time); + } + const val0 = this._fromType(this.getValueAtTime(event.time)); + let val1 = this._fromType(this.getValueAtTime(time)); + // if it's right on the line, take the previous value + const onTheLineEvent = this._events.get(time); + if (onTheLineEvent && onTheLineEvent.time === time && onTheLineEvent.type === "setValueAtTime") { + val1 = this._fromType(this.getValueAtTime(time - this.sampleTime)); + } + return 0.5 * (time - event.time) * (val0 + val1) + event.ticks; + } + /** + * Returns the tick value at the time. Takes into account + * any automation curves scheduled on the signal. + * @param time The time to get the tick count at + * @return The number of ticks which have elapsed at the time given any automations. + */ + getTicksAtTime(time) { + const computedTime = this.toSeconds(time); + const event = this._events.get(computedTime); + return Math.max(this._getTicksUntilEvent(event, computedTime), 0); + } + /** + * Return the elapsed time of the number of ticks from the given time + * @param ticks The number of ticks to calculate + * @param time The time to get the next tick from + * @return The duration of the number of ticks from the given time in seconds + */ + getDurationOfTicks(ticks, time) { + const computedTime = this.toSeconds(time); + const currentTick = this.getTicksAtTime(time); + return this.getTimeOfTick(currentTick + ticks) - computedTime; + } + /** + * Given a tick, returns the time that tick occurs at. + * @return The time that the tick occurs. + */ + getTimeOfTick(tick) { + const before = this._events.get(tick, "ticks"); + const after = this._events.getAfter(tick, "ticks"); + if (before && before.ticks === tick) { + return before.time; + } + else if (before && after && + after.type === "linearRampToValueAtTime" && + before.value !== after.value) { + const val0 = this._fromType(this.getValueAtTime(before.time)); + const val1 = this._fromType(this.getValueAtTime(after.time)); + const delta = (val1 - val0) / (after.time - before.time); + const k = Math.sqrt(Math.pow(val0, 2) - 2 * delta * (before.ticks - tick)); + const sol1 = (-val0 + k) / delta; + const sol2 = (-val0 - k) / delta; + return (sol1 > 0 ? sol1 : sol2) + before.time; + } + else if (before) { + if (before.value === 0) { + return Infinity; + } + else { + return before.time + (tick - before.ticks) / before.value; + } + } + else { + return tick / this._initialValue; + } + } + /** + * Convert some number of ticks their the duration in seconds accounting + * for any automation curves starting at the given time. + * @param ticks The number of ticks to convert to seconds. + * @param when When along the automation timeline to convert the ticks. + * @return The duration in seconds of the ticks. + */ + ticksToTime(ticks, when) { + return this.getDurationOfTicks(ticks, when); + } + /** + * The inverse of [[ticksToTime]]. Convert a duration in + * seconds to the corresponding number of ticks accounting for any + * automation curves starting at the given time. + * @param duration The time interval to convert to ticks. + * @param when When along the automation timeline to convert the ticks. + * @return The duration in ticks. + */ + timeToTicks(duration, when) { + const computedTime = this.toSeconds(when); + const computedDuration = this.toSeconds(duration); + const startTicks = this.getTicksAtTime(computedTime); + const endTicks = this.getTicksAtTime(computedTime + computedDuration); + return endTicks - startTicks; + } + /** + * Convert from the type when the unit value is BPM + */ + _fromType(val) { + if (this.units === "bpm" && this.multiplier) { + return 1 / (60 / val / this.multiplier); + } + else { + return super._fromType(val); + } + } + /** + * Special case of type conversion where the units === "bpm" + */ + _toType(val) { + if (this.units === "bpm" && this.multiplier) { + return (val / this.multiplier) * 60; + } + else { + return super._toType(val); + } + } + /** + * A multiplier on the bpm value. Useful for setting a PPQ relative to the base frequency value. + */ + get multiplier() { + return this._multiplier; + } + set multiplier(m) { + // get and reset the current value with the new multiplier + // might be necessary to clear all the previous values + const currentVal = this.value; + this._multiplier = m; + this.cancelScheduledValues(0); + this.setValueAtTime(currentVal, 0); + } +} + +/** + * TickSignal extends Tone.Signal, but adds the capability + * to calculate the number of elapsed ticks. exponential and target curves + * are approximated with multiple linear ramps. + * + * Thank you Bruno Dias, H. Sofia Pinto, and David M. Matos, + * for your [WAC paper](https://smartech.gatech.edu/bitstream/handle/1853/54588/WAC2016-49.pdf) + * describing integrating timing functions for tempo calculations. + */ +class TickSignal extends Signal { + constructor() { + super(optionsFromArguments(TickSignal.getDefaults(), arguments, ["value"])); + this.name = "TickSignal"; + const options = optionsFromArguments(TickSignal.getDefaults(), arguments, ["value"]); + this.input = this._param = new TickParam({ + context: this.context, + convert: options.convert, + multiplier: options.multiplier, + param: this._constantSource.offset, + units: options.units, + value: options.value, + }); + } + static getDefaults() { + return Object.assign(Signal.getDefaults(), { + multiplier: 1, + units: "hertz", + value: 1, + }); + } + ticksToTime(ticks, when) { + return this._param.ticksToTime(ticks, when); + } + timeToTicks(duration, when) { + return this._param.timeToTicks(duration, when); + } + getTimeOfTick(tick) { + return this._param.getTimeOfTick(tick); + } + getDurationOfTicks(ticks, time) { + return this._param.getDurationOfTicks(ticks, time); + } + getTicksAtTime(time) { + return this._param.getTicksAtTime(time); + } + /** + * A multiplier on the bpm value. Useful for setting a PPQ relative to the base frequency value. + */ + get multiplier() { + return this._param.multiplier; + } + set multiplier(m) { + this._param.multiplier = m; + } + dispose() { + super.dispose(); + this._param.dispose(); + return this; + } +} + +/** + * Uses [TickSignal](TickSignal) to track elapsed ticks with complex automation curves. + */ +class TickSource extends ToneWithContext { + constructor() { + super(optionsFromArguments(TickSource.getDefaults(), arguments, ["frequency"])); + this.name = "TickSource"; + /** + * The state timeline + */ + this._state = new StateTimeline(); + /** + * The offset values of the ticks + */ + this._tickOffset = new Timeline(); + const options = optionsFromArguments(TickSource.getDefaults(), arguments, ["frequency"]); + this.frequency = new TickSignal({ + context: this.context, + units: options.units, + value: options.frequency, + }); + readOnly(this, "frequency"); + // set the initial state + this._state.setStateAtTime("stopped", 0); + // add the first event + this.setTicksAtTime(0, 0); + } + static getDefaults() { + return Object.assign({ + frequency: 1, + units: "hertz", + }, ToneWithContext.getDefaults()); + } + /** + * Returns the playback state of the source, either "started", "stopped" or "paused". + */ + get state() { + return this.getStateAtTime(this.now()); + } + /** + * Start the clock at the given time. Optionally pass in an offset + * of where to start the tick counter from. + * @param time The time the clock should start + * @param offset The number of ticks to start the source at + */ + start(time, offset) { + const computedTime = this.toSeconds(time); + if (this._state.getValueAtTime(computedTime) !== "started") { + this._state.setStateAtTime("started", computedTime); + if (isDefined(offset)) { + this.setTicksAtTime(offset, computedTime); + } + } + return this; + } + /** + * Stop the clock. Stopping the clock resets the tick counter to 0. + * @param time The time when the clock should stop. + */ + stop(time) { + const computedTime = this.toSeconds(time); + // cancel the previous stop + if (this._state.getValueAtTime(computedTime) === "stopped") { + const event = this._state.get(computedTime); + if (event && event.time > 0) { + this._tickOffset.cancel(event.time); + this._state.cancel(event.time); + } + } + this._state.cancel(computedTime); + this._state.setStateAtTime("stopped", computedTime); + this.setTicksAtTime(0, computedTime); + return this; + } + /** + * Pause the clock. Pausing does not reset the tick counter. + * @param time The time when the clock should stop. + */ + pause(time) { + const computedTime = this.toSeconds(time); + if (this._state.getValueAtTime(computedTime) === "started") { + this._state.setStateAtTime("paused", computedTime); + } + return this; + } + /** + * Cancel start/stop/pause and setTickAtTime events scheduled after the given time. + * @param time When to clear the events after + */ + cancel(time) { + time = this.toSeconds(time); + this._state.cancel(time); + this._tickOffset.cancel(time); + return this; + } + /** + * Get the elapsed ticks at the given time + * @param time When to get the tick value + * @return The number of ticks + */ + getTicksAtTime(time) { + const computedTime = this.toSeconds(time); + const stopEvent = this._state.getLastState("stopped", computedTime); + // this event allows forEachBetween to iterate until the current time + const tmpEvent = { state: "paused", time: computedTime }; + this._state.add(tmpEvent); + // keep track of the previous offset event + let lastState = stopEvent; + let elapsedTicks = 0; + // iterate through all the events since the last stop + this._state.forEachBetween(stopEvent.time, computedTime + this.sampleTime, e => { + let periodStartTime = lastState.time; + // if there is an offset event in this period use that + const offsetEvent = this._tickOffset.get(e.time); + if (offsetEvent && offsetEvent.time >= lastState.time) { + elapsedTicks = offsetEvent.ticks; + periodStartTime = offsetEvent.time; + } + if (lastState.state === "started" && e.state !== "started") { + elapsedTicks += this.frequency.getTicksAtTime(e.time) - this.frequency.getTicksAtTime(periodStartTime); + } + lastState = e; + }); + // remove the temporary event + this._state.remove(tmpEvent); + // return the ticks + return elapsedTicks; + } + /** + * The number of times the callback was invoked. Starts counting at 0 + * and increments after the callback was invoked. Returns -1 when stopped. + */ + get ticks() { + return this.getTicksAtTime(this.now()); + } + set ticks(t) { + this.setTicksAtTime(t, this.now()); + } + /** + * The time since ticks=0 that the TickSource has been running. Accounts + * for tempo curves + */ + get seconds() { + return this.getSecondsAtTime(this.now()); + } + set seconds(s) { + const now = this.now(); + const ticks = this.frequency.timeToTicks(s, now); + this.setTicksAtTime(ticks, now); + } + /** + * Return the elapsed seconds at the given time. + * @param time When to get the elapsed seconds + * @return The number of elapsed seconds + */ + getSecondsAtTime(time) { + time = this.toSeconds(time); + const stopEvent = this._state.getLastState("stopped", time); + // this event allows forEachBetween to iterate until the current time + const tmpEvent = { state: "paused", time }; + this._state.add(tmpEvent); + // keep track of the previous offset event + let lastState = stopEvent; + let elapsedSeconds = 0; + // iterate through all the events since the last stop + this._state.forEachBetween(stopEvent.time, time + this.sampleTime, e => { + let periodStartTime = lastState.time; + // if there is an offset event in this period use that + const offsetEvent = this._tickOffset.get(e.time); + if (offsetEvent && offsetEvent.time >= lastState.time) { + elapsedSeconds = offsetEvent.seconds; + periodStartTime = offsetEvent.time; + } + if (lastState.state === "started" && e.state !== "started") { + elapsedSeconds += e.time - periodStartTime; + } + lastState = e; + }); + // remove the temporary event + this._state.remove(tmpEvent); + // return the ticks + return elapsedSeconds; + } + /** + * Set the clock's ticks at the given time. + * @param ticks The tick value to set + * @param time When to set the tick value + */ + setTicksAtTime(ticks, time) { + time = this.toSeconds(time); + this._tickOffset.cancel(time); + this._tickOffset.add({ + seconds: this.frequency.getDurationOfTicks(ticks, time), + ticks, + time, + }); + return this; + } + /** + * Returns the scheduled state at the given time. + * @param time The time to query. + */ + getStateAtTime(time) { + time = this.toSeconds(time); + return this._state.getValueAtTime(time); + } + /** + * Get the time of the given tick. The second argument + * is when to test before. Since ticks can be set (with setTicksAtTime) + * there may be multiple times for a given tick value. + * @param tick The tick number. + * @param before When to measure the tick value from. + * @return The time of the tick + */ + getTimeOfTick(tick, before = this.now()) { + const offset = this._tickOffset.get(before); + const event = this._state.get(before); + const startTime = Math.max(offset.time, event.time); + const absoluteTicks = this.frequency.getTicksAtTime(startTime) + tick - offset.ticks; + return this.frequency.getTimeOfTick(absoluteTicks); + } + /** + * Invoke the callback event at all scheduled ticks between the + * start time and the end time + * @param startTime The beginning of the search range + * @param endTime The end of the search range + * @param callback The callback to invoke with each tick + */ + forEachTickBetween(startTime, endTime, callback) { + // only iterate through the sections where it is "started" + let lastStateEvent = this._state.get(startTime); + this._state.forEachBetween(startTime, endTime, event => { + if (lastStateEvent && lastStateEvent.state === "started" && event.state !== "started") { + this.forEachTickBetween(Math.max(lastStateEvent.time, startTime), event.time - this.sampleTime, callback); + } + lastStateEvent = event; + }); + let error = null; + if (lastStateEvent && lastStateEvent.state === "started") { + const maxStartTime = Math.max(lastStateEvent.time, startTime); + // figure out the difference between the frequency ticks and the + const startTicks = this.frequency.getTicksAtTime(maxStartTime); + const ticksAtStart = this.frequency.getTicksAtTime(lastStateEvent.time); + const diff = startTicks - ticksAtStart; + let offset = Math.ceil(diff) - diff; + // guard against floating point issues + offset = EQ(offset, 1) ? 0 : offset; + let nextTickTime = this.frequency.getTimeOfTick(startTicks + offset); + while (nextTickTime < endTime) { + try { + callback(nextTickTime, Math.round(this.getTicksAtTime(nextTickTime))); + } + catch (e) { + error = e; + break; + } + nextTickTime += this.frequency.getDurationOfTicks(1, nextTickTime); + } + } + if (error) { + throw error; + } + return this; + } + /** + * Clean up + */ + dispose() { + super.dispose(); + this._state.dispose(); + this._tickOffset.dispose(); + this.frequency.dispose(); + return this; + } +} + +/** + * A sample accurate clock which provides a callback at the given rate. + * While the callback is not sample-accurate (it is still susceptible to + * loose JS timing), the time passed in as the argument to the callback + * is precise. For most applications, it is better to use Tone.Transport + * instead of the Clock by itself since you can synchronize multiple callbacks. + * @example + * // the callback will be invoked approximately once a second + * // and will print the time exactly once a second apart. + * const clock = new Tone.Clock(time => { + * console.log(time); + * }, 1); + * clock.start(); + * @category Core + */ +class Clock extends ToneWithContext { + constructor() { + super(optionsFromArguments(Clock.getDefaults(), arguments, ["callback", "frequency"])); + this.name = "Clock"; + /** + * The callback function to invoke at the scheduled tick. + */ + this.callback = noOp; + /** + * The last time the loop callback was invoked + */ + this._lastUpdate = 0; + /** + * Keep track of the playback state + */ + this._state = new StateTimeline("stopped"); + /** + * Context bound reference to the _loop method + * This is necessary to remove the event in the end. + */ + this._boundLoop = this._loop.bind(this); + const options = optionsFromArguments(Clock.getDefaults(), arguments, ["callback", "frequency"]); + this.callback = options.callback; + this._tickSource = new TickSource({ + context: this.context, + frequency: options.frequency, + units: options.units, + }); + this._lastUpdate = 0; + this.frequency = this._tickSource.frequency; + readOnly(this, "frequency"); + // add an initial state + this._state.setStateAtTime("stopped", 0); + // bind a callback to the worker thread + this.context.on("tick", this._boundLoop); + } + static getDefaults() { + return Object.assign(ToneWithContext.getDefaults(), { + callback: noOp, + frequency: 1, + units: "hertz", + }); + } + /** + * Returns the playback state of the source, either "started", "stopped" or "paused". + */ + get state() { + return this._state.getValueAtTime(this.now()); + } + /** + * Start the clock at the given time. Optionally pass in an offset + * of where to start the tick counter from. + * @param time The time the clock should start + * @param offset Where the tick counter starts counting from. + */ + start(time, offset) { + // make sure the context is running + assertContextRunning(this.context); + // start the loop + const computedTime = this.toSeconds(time); + this.log("start", computedTime); + if (this._state.getValueAtTime(computedTime) !== "started") { + this._state.setStateAtTime("started", computedTime); + this._tickSource.start(computedTime, offset); + if (computedTime < this._lastUpdate) { + this.emit("start", computedTime, offset); + } + } + return this; + } + /** + * Stop the clock. Stopping the clock resets the tick counter to 0. + * @param time The time when the clock should stop. + * @example + * const clock = new Tone.Clock(time => { + * console.log(time); + * }, 1); + * clock.start(); + * // stop the clock after 10 seconds + * clock.stop("+10"); + */ + stop(time) { + const computedTime = this.toSeconds(time); + this.log("stop", computedTime); + this._state.cancel(computedTime); + this._state.setStateAtTime("stopped", computedTime); + this._tickSource.stop(computedTime); + if (computedTime < this._lastUpdate) { + this.emit("stop", computedTime); + } + return this; + } + /** + * Pause the clock. Pausing does not reset the tick counter. + * @param time The time when the clock should stop. + */ + pause(time) { + const computedTime = this.toSeconds(time); + if (this._state.getValueAtTime(computedTime) === "started") { + this._state.setStateAtTime("paused", computedTime); + this._tickSource.pause(computedTime); + if (computedTime < this._lastUpdate) { + this.emit("pause", computedTime); + } + } + return this; + } + /** + * The number of times the callback was invoked. Starts counting at 0 + * and increments after the callback was invoked. + */ + get ticks() { + return Math.ceil(this.getTicksAtTime(this.now())); + } + set ticks(t) { + this._tickSource.ticks = t; + } + /** + * The time since ticks=0 that the Clock has been running. Accounts for tempo curves + */ + get seconds() { + return this._tickSource.seconds; + } + set seconds(s) { + this._tickSource.seconds = s; + } + /** + * Return the elapsed seconds at the given time. + * @param time When to get the elapsed seconds + * @return The number of elapsed seconds + */ + getSecondsAtTime(time) { + return this._tickSource.getSecondsAtTime(time); + } + /** + * Set the clock's ticks at the given time. + * @param ticks The tick value to set + * @param time When to set the tick value + */ + setTicksAtTime(ticks, time) { + this._tickSource.setTicksAtTime(ticks, time); + return this; + } + /** + * Get the time of the given tick. The second argument + * is when to test before. Since ticks can be set (with setTicksAtTime) + * there may be multiple times for a given tick value. + * @param tick The tick number. + * @param before When to measure the tick value from. + * @return The time of the tick + */ + getTimeOfTick(tick, before = this.now()) { + return this._tickSource.getTimeOfTick(tick, before); + } + /** + * Get the clock's ticks at the given time. + * @param time When to get the tick value + * @return The tick value at the given time. + */ + getTicksAtTime(time) { + return this._tickSource.getTicksAtTime(time); + } + /** + * Get the time of the next tick + * @param offset The tick number. + */ + nextTickTime(offset, when) { + const computedTime = this.toSeconds(when); + const currentTick = this.getTicksAtTime(computedTime); + return this._tickSource.getTimeOfTick(currentTick + offset, computedTime); + } + /** + * The scheduling loop. + */ + _loop() { + const startTime = this._lastUpdate; + const endTime = this.now(); + this._lastUpdate = endTime; + this.log("loop", startTime, endTime); + if (startTime !== endTime) { + // the state change events + this._state.forEachBetween(startTime, endTime, e => { + switch (e.state) { + case "started": + const offset = this._tickSource.getTicksAtTime(e.time); + this.emit("start", e.time, offset); + break; + case "stopped": + if (e.time !== 0) { + this.emit("stop", e.time); + } + break; + case "paused": + this.emit("pause", e.time); + break; + } + }); + // the tick callbacks + this._tickSource.forEachTickBetween(startTime, endTime, (time, ticks) => { + this.callback(time, ticks); + }); + } + } + /** + * Returns the scheduled state at the given time. + * @param time The time to query. + * @return The name of the state input in setStateAtTime. + * @example + * const clock = new Tone.Clock(); + * clock.start("+0.1"); + * clock.getStateAtTime("+0.1"); // returns "started" + */ + getStateAtTime(time) { + const computedTime = this.toSeconds(time); + return this._state.getValueAtTime(computedTime); + } + /** + * Clean up + */ + dispose() { + super.dispose(); + this.context.off("tick", this._boundLoop); + this._tickSource.dispose(); + this._state.dispose(); + return this; + } +} +Emitter.mixin(Clock); + +/** + * Wrapper around Web Audio's native [DelayNode](http://webaudio.github.io/web-audio-api/#the-delaynode-interface). + * @category Core + * @example + * return Tone.Offline(() => { + * const delay = new Tone.Delay(0.1).toDestination(); + * // connect the signal to both the delay and the destination + * const pulse = new Tone.PulseOscillator().connect(delay).toDestination(); + * // start and stop the pulse + * pulse.start(0).stop(0.01); + * }, 0.5, 1); + */ +class Delay extends ToneAudioNode { + constructor() { + super(optionsFromArguments(Delay.getDefaults(), arguments, ["delayTime", "maxDelay"])); + this.name = "Delay"; + const options = optionsFromArguments(Delay.getDefaults(), arguments, ["delayTime", "maxDelay"]); + const maxDelayInSeconds = this.toSeconds(options.maxDelay); + this._maxDelay = Math.max(maxDelayInSeconds, this.toSeconds(options.delayTime)); + this._delayNode = this.input = this.output = this.context.createDelay(maxDelayInSeconds); + this.delayTime = new Param({ + context: this.context, + param: this._delayNode.delayTime, + units: "time", + value: options.delayTime, + minValue: 0, + maxValue: this.maxDelay, + }); + readOnly(this, "delayTime"); + } + static getDefaults() { + return Object.assign(ToneAudioNode.getDefaults(), { + delayTime: 0, + maxDelay: 1, + }); + } + /** + * The maximum delay time. This cannot be changed after + * the value is passed into the constructor. + */ + get maxDelay() { + return this._maxDelay; + } + /** + * Clean up. + */ + dispose() { + super.dispose(); + this._delayNode.disconnect(); + this.delayTime.dispose(); + return this; + } +} + +/** + * Generate a buffer by rendering all of the Tone.js code within the callback using the OfflineAudioContext. + * The OfflineAudioContext is capable of rendering much faster than real time in many cases. + * The callback function also passes in an offline instance of [[Context]] which can be used + * to schedule events along the Transport. + * @param callback All Tone.js nodes which are created and scheduled within this callback are recorded into the output Buffer. + * @param duration the amount of time to record for. + * @return The promise which is invoked with the ToneAudioBuffer of the recorded output. + * @example + * // render 2 seconds of the oscillator + * Tone.Offline(() => { + * // only nodes created in this callback will be recorded + * const oscillator = new Tone.Oscillator().toDestination().start(0); + * }, 2).then((buffer) => { + * // do something with the output buffer + * console.log(buffer); + * }); + * @example + * // can also schedule events along the Transport + * // using the passed in Offline Transport + * Tone.Offline(({ transport }) => { + * const osc = new Tone.Oscillator().toDestination(); + * transport.schedule(time => { + * osc.start(time).stop(time + 0.1); + * }, 1); + * // make sure to start the transport + * transport.start(0.2); + * }, 4).then((buffer) => { + * // do something with the output buffer + * console.log(buffer); + * }); + * @category Core + */ +function Offline(callback, duration, channels = 2, sampleRate = getContext().sampleRate) { + return __awaiter(this, void 0, void 0, function* () { + // set the OfflineAudioContext based on the current context + const originalContext = getContext(); + const context = new OfflineContext(channels, duration, sampleRate); + setContext(context); + // invoke the callback/scheduling + yield callback(context); + // then render the audio + const bufferPromise = context.render(); + // return the original AudioContext + setContext(originalContext); + // await the rendering + const buffer = yield bufferPromise; + // return the audio + return new ToneAudioBuffer(buffer); + }); +} + +/** + * A data structure for holding multiple buffers in a Map-like datastructure. + * + * @example + * const pianoSamples = new Tone.ToneAudioBuffers({ + * A1: "https://tonejs.github.io/audio/casio/A1.mp3", + * A2: "https://tonejs.github.io/audio/casio/A2.mp3", + * }, () => { + * const player = new Tone.Player().toDestination(); + * // play one of the samples when they all load + * player.buffer = pianoSamples.get("A2"); + * player.start(); + * }); + * @example + * // To pass in additional parameters in the second parameter + * const buffers = new Tone.ToneAudioBuffers({ + * urls: { + * A1: "A1.mp3", + * A2: "A2.mp3", + * }, + * onload: () => console.log("loaded"), + * baseUrl: "https://tonejs.github.io/audio/casio/" + * }); + * @category Core + */ +class ToneAudioBuffers extends Tone { + constructor() { + super(); + this.name = "ToneAudioBuffers"; + /** + * All of the buffers + */ + this._buffers = new Map(); + /** + * Keep track of the number of loaded buffers + */ + this._loadingCount = 0; + const options = optionsFromArguments(ToneAudioBuffers.getDefaults(), arguments, ["urls", "onload", "baseUrl"], "urls"); + this.baseUrl = options.baseUrl; + // add each one + Object.keys(options.urls).forEach(name => { + this._loadingCount++; + const url = options.urls[name]; + this.add(name, url, this._bufferLoaded.bind(this, options.onload), options.onerror); + }); + } + static getDefaults() { + return { + baseUrl: "", + onerror: noOp, + onload: noOp, + urls: {}, + }; + } + /** + * True if the buffers object has a buffer by that name. + * @param name The key or index of the buffer. + */ + has(name) { + return this._buffers.has(name.toString()); + } + /** + * Get a buffer by name. If an array was loaded, + * then use the array index. + * @param name The key or index of the buffer. + */ + get(name) { + assert(this.has(name), `ToneAudioBuffers has no buffer named: ${name}`); + return this._buffers.get(name.toString()); + } + /** + * A buffer was loaded. decrement the counter. + */ + _bufferLoaded(callback) { + this._loadingCount--; + if (this._loadingCount === 0 && callback) { + callback(); + } + } + /** + * If the buffers are loaded or not + */ + get loaded() { + return Array.from(this._buffers).every(([_, buffer]) => buffer.loaded); + } + /** + * Add a buffer by name and url to the Buffers + * @param name A unique name to give the buffer + * @param url Either the url of the bufer, or a buffer which will be added with the given name. + * @param callback The callback to invoke when the url is loaded. + * @param onerror Invoked if the buffer can't be loaded + */ + add(name, url, callback = noOp, onerror = noOp) { + if (isString(url)) { + this._buffers.set(name.toString(), new ToneAudioBuffer(this.baseUrl + url, callback, onerror)); + } + else { + this._buffers.set(name.toString(), new ToneAudioBuffer(url, callback, onerror)); + } + return this; + } + dispose() { + super.dispose(); + this._buffers.forEach(buffer => buffer.dispose()); + this._buffers.clear(); + return this; + } +} + +/** + * Midi is a primitive type for encoding Time values. + * Midi can be constructed with or without the `new` keyword. Midi can be passed + * into the parameter of any method which takes time as an argument. + * @category Unit + */ +class MidiClass extends FrequencyClass { + constructor() { + super(...arguments); + this.name = "MidiClass"; + this.defaultUnits = "midi"; + } + /** + * Returns the value of a frequency in the current units + */ + _frequencyToUnits(freq) { + return ftom(super._frequencyToUnits(freq)); + } + /** + * Returns the value of a tick in the current time units + */ + _ticksToUnits(ticks) { + return ftom(super._ticksToUnits(ticks)); + } + /** + * Return the value of the beats in the current units + */ + _beatsToUnits(beats) { + return ftom(super._beatsToUnits(beats)); + } + /** + * Returns the value of a second in the current units + */ + _secondsToUnits(seconds) { + return ftom(super._secondsToUnits(seconds)); + } + /** + * Return the value of the frequency as a MIDI note + * @example + * Tone.Midi(60).toMidi(); // 60 + */ + toMidi() { + return this.valueOf(); + } + /** + * Return the value of the frequency as a MIDI note + * @example + * Tone.Midi(60).toFrequency(); // 261.6255653005986 + */ + toFrequency() { + return mtof(this.toMidi()); + } + /** + * Transposes the frequency by the given number of semitones. + * @return A new transposed MidiClass + * @example + * Tone.Midi("A4").transpose(3); // "C5" + */ + transpose(interval) { + return new MidiClass(this.context, this.toMidi() + interval); + } +} +/** + * Convert a value into a FrequencyClass object. + * @category Unit + */ +function Midi(value, units) { + return new MidiClass(getContext(), value, units); +} + +/** + * Ticks is a primitive type for encoding Time values. + * Ticks can be constructed with or without the `new` keyword. Ticks can be passed + * into the parameter of any method which takes time as an argument. + * @example + * const t = Tone.Ticks("4n"); // a quarter note as ticks + * @category Unit + */ +class TicksClass extends TransportTimeClass { + constructor() { + super(...arguments); + this.name = "Ticks"; + this.defaultUnits = "i"; + } + /** + * Get the current time in the given units + */ + _now() { + return this.context.transport.ticks; + } + /** + * Return the value of the beats in the current units + */ + _beatsToUnits(beats) { + return this._getPPQ() * beats; + } + /** + * Returns the value of a second in the current units + */ + _secondsToUnits(seconds) { + return Math.floor(seconds / (60 / this._getBpm()) * this._getPPQ()); + } + /** + * Returns the value of a tick in the current time units + */ + _ticksToUnits(ticks) { + return ticks; + } + /** + * Return the time in ticks + */ + toTicks() { + return this.valueOf(); + } + /** + * Return the time in seconds + */ + toSeconds() { + return (this.valueOf() / this._getPPQ()) * (60 / this._getBpm()); + } +} +/** + * Convert a time representation to ticks + * @category Unit + */ +function Ticks(value, units) { + return new TicksClass(getContext(), value, units); +} + +/** + * Draw is useful for synchronizing visuals and audio events. + * Callbacks from Tone.Transport or any of the Tone.Event classes + * always happen _before_ the scheduled time and are not synchronized + * to the animation frame so they are not good for triggering tightly + * synchronized visuals and sound. Draw makes it easy to schedule + * callbacks using the AudioContext time and uses requestAnimationFrame. + * @example + * Tone.Transport.schedule((time) => { + * // use the time argument to schedule a callback with Draw + * Tone.Draw.schedule(() => { + * // do drawing or DOM manipulation here + * console.log(time); + * }, time); + * }, "+0.5"); + * Tone.Transport.start(); + * @category Core + */ +class Draw extends ToneWithContext { + constructor() { + super(...arguments); + this.name = "Draw"; + /** + * The duration after which events are not invoked. + */ + this.expiration = 0.25; + /** + * The amount of time before the scheduled time + * that the callback can be invoked. Default is + * half the time of an animation frame (0.008 seconds). + */ + this.anticipation = 0.008; + /** + * All of the events. + */ + this._events = new Timeline(); + /** + * The draw loop + */ + this._boundDrawLoop = this._drawLoop.bind(this); + /** + * The animation frame id + */ + this._animationFrame = -1; + } + /** + * Schedule a function at the given time to be invoked + * on the nearest animation frame. + * @param callback Callback is invoked at the given time. + * @param time The time relative to the AudioContext time to invoke the callback. + * @example + * Tone.Transport.scheduleRepeat(time => { + * Tone.Draw.schedule(() => console.log(time), time); + * }, 1); + * Tone.Transport.start(); + */ + schedule(callback, time) { + this._events.add({ + callback, + time: this.toSeconds(time), + }); + // start the draw loop on the first event + if (this._events.length === 1) { + this._animationFrame = requestAnimationFrame(this._boundDrawLoop); + } + return this; + } + /** + * Cancel events scheduled after the given time + * @param after Time after which scheduled events will be removed from the scheduling timeline. + */ + cancel(after) { + this._events.cancel(this.toSeconds(after)); + return this; + } + /** + * The draw loop + */ + _drawLoop() { + const now = this.context.currentTime; + while (this._events.length && this._events.peek().time - this.anticipation <= now) { + const event = this._events.shift(); + if (event && now - event.time <= this.expiration) { + event.callback(); + } + } + if (this._events.length > 0) { + this._animationFrame = requestAnimationFrame(this._boundDrawLoop); + } + } + dispose() { + super.dispose(); + this._events.dispose(); + cancelAnimationFrame(this._animationFrame); + return this; + } +} +//------------------------------------- +// INITIALIZATION +//------------------------------------- +onContextInit(context => { + context.draw = new Draw({ context }); +}); +onContextClose(context => { + context.draw.dispose(); +}); + +/** + * Similar to Tone.Timeline, but all events represent + * intervals with both "time" and "duration" times. The + * events are placed in a tree structure optimized + * for querying an intersection point with the timeline + * events. Internally uses an [Interval Tree](https://en.wikipedia.org/wiki/Interval_tree) + * to represent the data. + */ +class IntervalTimeline extends Tone { + constructor() { + super(...arguments); + this.name = "IntervalTimeline"; + /** + * The root node of the inteval tree + */ + this._root = null; + /** + * Keep track of the length of the timeline. + */ + this._length = 0; + } + /** + * The event to add to the timeline. All events must + * have a time and duration value + * @param event The event to add to the timeline + */ + add(event) { + assert(isDefined(event.time), "Events must have a time property"); + assert(isDefined(event.duration), "Events must have a duration parameter"); + event.time = event.time.valueOf(); + let node = new IntervalNode(event.time, event.time + event.duration, event); + if (this._root === null) { + this._root = node; + } + else { + this._root.insert(node); + } + this._length++; + // Restructure tree to be balanced + while (node !== null) { + node.updateHeight(); + node.updateMax(); + this._rebalance(node); + node = node.parent; + } + return this; + } + /** + * Remove an event from the timeline. + * @param event The event to remove from the timeline + */ + remove(event) { + if (this._root !== null) { + const results = []; + this._root.search(event.time, results); + for (const node of results) { + if (node.event === event) { + this._removeNode(node); + this._length--; + break; + } + } + } + return this; + } + /** + * The number of items in the timeline. + * @readOnly + */ + get length() { + return this._length; + } + /** + * Remove events whose time time is after the given time + * @param after The time to query. + */ + cancel(after) { + this.forEachFrom(after, event => this.remove(event)); + return this; + } + /** + * Set the root node as the given node + */ + _setRoot(node) { + this._root = node; + if (this._root !== null) { + this._root.parent = null; + } + } + /** + * Replace the references to the node in the node's parent + * with the replacement node. + */ + _replaceNodeInParent(node, replacement) { + if (node.parent !== null) { + if (node.isLeftChild()) { + node.parent.left = replacement; + } + else { + node.parent.right = replacement; + } + this._rebalance(node.parent); + } + else { + this._setRoot(replacement); + } + } + /** + * Remove the node from the tree and replace it with + * a successor which follows the schema. + */ + _removeNode(node) { + if (node.left === null && node.right === null) { + this._replaceNodeInParent(node, null); + } + else if (node.right === null) { + this._replaceNodeInParent(node, node.left); + } + else if (node.left === null) { + this._replaceNodeInParent(node, node.right); + } + else { + const balance = node.getBalance(); + let replacement; + let temp = null; + if (balance > 0) { + if (node.left.right === null) { + replacement = node.left; + replacement.right = node.right; + temp = replacement; + } + else { + replacement = node.left.right; + while (replacement.right !== null) { + replacement = replacement.right; + } + if (replacement.parent) { + replacement.parent.right = replacement.left; + temp = replacement.parent; + replacement.left = node.left; + replacement.right = node.right; + } + } + } + else if (node.right.left === null) { + replacement = node.right; + replacement.left = node.left; + temp = replacement; + } + else { + replacement = node.right.left; + while (replacement.left !== null) { + replacement = replacement.left; + } + if (replacement.parent) { + replacement.parent.left = replacement.right; + temp = replacement.parent; + replacement.left = node.left; + replacement.right = node.right; + } + } + if (node.parent !== null) { + if (node.isLeftChild()) { + node.parent.left = replacement; + } + else { + node.parent.right = replacement; + } + } + else { + this._setRoot(replacement); + } + if (temp) { + this._rebalance(temp); + } + } + node.dispose(); + } + /** + * Rotate the tree to the left + */ + _rotateLeft(node) { + const parent = node.parent; + const isLeftChild = node.isLeftChild(); + // Make node.right the new root of this sub tree (instead of node) + const pivotNode = node.right; + if (pivotNode) { + node.right = pivotNode.left; + pivotNode.left = node; + } + if (parent !== null) { + if (isLeftChild) { + parent.left = pivotNode; + } + else { + parent.right = pivotNode; + } + } + else { + this._setRoot(pivotNode); + } + } + /** + * Rotate the tree to the right + */ + _rotateRight(node) { + const parent = node.parent; + const isLeftChild = node.isLeftChild(); + // Make node.left the new root of this sub tree (instead of node) + const pivotNode = node.left; + if (pivotNode) { + node.left = pivotNode.right; + pivotNode.right = node; + } + if (parent !== null) { + if (isLeftChild) { + parent.left = pivotNode; + } + else { + parent.right = pivotNode; + } + } + else { + this._setRoot(pivotNode); + } + } + /** + * Balance the BST + */ + _rebalance(node) { + const balance = node.getBalance(); + if (balance > 1 && node.left) { + if (node.left.getBalance() < 0) { + this._rotateLeft(node.left); + } + else { + this._rotateRight(node); + } + } + else if (balance < -1 && node.right) { + if (node.right.getBalance() > 0) { + this._rotateRight(node.right); + } + else { + this._rotateLeft(node); + } + } + } + /** + * Get an event whose time and duration span the give time. Will + * return the match whose "time" value is closest to the given time. + * @return The event which spans the desired time + */ + get(time) { + if (this._root !== null) { + const results = []; + this._root.search(time, results); + if (results.length > 0) { + let max = results[0]; + for (let i = 1; i < results.length; i++) { + if (results[i].low > max.low) { + max = results[i]; + } + } + return max.event; + } + } + return null; + } + /** + * Iterate over everything in the timeline. + * @param callback The callback to invoke with every item + */ + forEach(callback) { + if (this._root !== null) { + const allNodes = []; + this._root.traverse(node => allNodes.push(node)); + allNodes.forEach(node => { + if (node.event) { + callback(node.event); + } + }); + } + return this; + } + /** + * Iterate over everything in the array in which the given time + * overlaps with the time and duration time of the event. + * @param time The time to check if items are overlapping + * @param callback The callback to invoke with every item + */ + forEachAtTime(time, callback) { + if (this._root !== null) { + const results = []; + this._root.search(time, results); + results.forEach(node => { + if (node.event) { + callback(node.event); + } + }); + } + return this; + } + /** + * Iterate over everything in the array in which the time is greater + * than or equal to the given time. + * @param time The time to check if items are before + * @param callback The callback to invoke with every item + */ + forEachFrom(time, callback) { + if (this._root !== null) { + const results = []; + this._root.searchAfter(time, results); + results.forEach(node => { + if (node.event) { + callback(node.event); + } + }); + } + return this; + } + /** + * Clean up + */ + dispose() { + super.dispose(); + if (this._root !== null) { + this._root.traverse(node => node.dispose()); + } + this._root = null; + return this; + } +} +//------------------------------------- +// INTERVAL NODE HELPER +//------------------------------------- +/** + * Represents a node in the binary search tree, with the addition + * of a "high" value which keeps track of the highest value of + * its children. + * References: + * https://brooknovak.wordpress.com/2013/12/07/augmented-interval-tree-in-c/ + * http://www.mif.vu.lt/~valdas/ALGORITMAI/LITERATURA/Cormen/Cormen.pdf + * @param low + * @param high + */ +class IntervalNode { + constructor(low, high, event) { + // the nodes to the left + this._left = null; + // the nodes to the right + this._right = null; + // the parent node + this.parent = null; + // the number of child nodes + this.height = 0; + this.event = event; + // the low value + this.low = low; + // the high value + this.high = high; + // the high value for this and all child nodes + this.max = this.high; + } + /** + * Insert a node into the correct spot in the tree + */ + insert(node) { + if (node.low <= this.low) { + if (this.left === null) { + this.left = node; + } + else { + this.left.insert(node); + } + } + else if (this.right === null) { + this.right = node; + } + else { + this.right.insert(node); + } + } + /** + * Search the tree for nodes which overlap + * with the given point + * @param point The point to query + * @param results The array to put the results + */ + search(point, results) { + // If p is to the right of the rightmost point of any interval + // in this node and all children, there won't be any matches. + if (point > this.max) { + return; + } + // Search left children + if (this.left !== null) { + this.left.search(point, results); + } + // Check this node + if (this.low <= point && this.high > point) { + results.push(this); + } + // If p is to the left of the time of this interval, + // then it can't be in any child to the right. + if (this.low > point) { + return; + } + // Search right children + if (this.right !== null) { + this.right.search(point, results); + } + } + /** + * Search the tree for nodes which are less + * than the given point + * @param point The point to query + * @param results The array to put the results + */ + searchAfter(point, results) { + // Check this node + if (this.low >= point) { + results.push(this); + if (this.left !== null) { + this.left.searchAfter(point, results); + } + } + // search the right side + if (this.right !== null) { + this.right.searchAfter(point, results); + } + } + /** + * Invoke the callback on this element and both it's branches + * @param {Function} callback + */ + traverse(callback) { + callback(this); + if (this.left !== null) { + this.left.traverse(callback); + } + if (this.right !== null) { + this.right.traverse(callback); + } + } + /** + * Update the height of the node + */ + updateHeight() { + if (this.left !== null && this.right !== null) { + this.height = Math.max(this.left.height, this.right.height) + 1; + } + else if (this.right !== null) { + this.height = this.right.height + 1; + } + else if (this.left !== null) { + this.height = this.left.height + 1; + } + else { + this.height = 0; + } + } + /** + * Update the height of the node + */ + updateMax() { + this.max = this.high; + if (this.left !== null) { + this.max = Math.max(this.max, this.left.max); + } + if (this.right !== null) { + this.max = Math.max(this.max, this.right.max); + } + } + /** + * The balance is how the leafs are distributed on the node + * @return Negative numbers are balanced to the right + */ + getBalance() { + let balance = 0; + if (this.left !== null && this.right !== null) { + balance = this.left.height - this.right.height; + } + else if (this.left !== null) { + balance = this.left.height + 1; + } + else if (this.right !== null) { + balance = -(this.right.height + 1); + } + return balance; + } + /** + * @returns true if this node is the left child of its parent + */ + isLeftChild() { + return this.parent !== null && this.parent.left === this; + } + /** + * get/set the left node + */ + get left() { + return this._left; + } + set left(node) { + this._left = node; + if (node !== null) { + node.parent = this; + } + this.updateHeight(); + this.updateMax(); + } + /** + * get/set the right node + */ + get right() { + return this._right; + } + set right(node) { + this._right = node; + if (node !== null) { + node.parent = this; + } + this.updateHeight(); + this.updateMax(); + } + /** + * null out references. + */ + dispose() { + this.parent = null; + this._left = null; + this._right = null; + this.event = null; + } +} + +var Units = /*#__PURE__*/Object.freeze({ + __proto__: null +}); + +/** + * Volume is a simple volume node, useful for creating a volume fader. + * + * @example + * const vol = new Tone.Volume(-12).toDestination(); + * const osc = new Tone.Oscillator().connect(vol).start(); + * @category Component + */ +class Volume extends ToneAudioNode { + constructor() { + super(optionsFromArguments(Volume.getDefaults(), arguments, ["volume"])); + this.name = "Volume"; + const options = optionsFromArguments(Volume.getDefaults(), arguments, ["volume"]); + this.input = this.output = new Gain({ + context: this.context, + gain: options.volume, + units: "decibels", + }); + this.volume = this.output.gain; + readOnly(this, "volume"); + this._unmutedVolume = options.volume; + // set the mute initially + this.mute = options.mute; + } + static getDefaults() { + return Object.assign(ToneAudioNode.getDefaults(), { + mute: false, + volume: 0, + }); + } + /** + * Mute the output. + * @example + * const vol = new Tone.Volume(-12).toDestination(); + * const osc = new Tone.Oscillator().connect(vol).start(); + * // mute the output + * vol.mute = true; + */ + get mute() { + return this.volume.value === -Infinity; + } + set mute(mute) { + if (!this.mute && mute) { + this._unmutedVolume = this.volume.value; + // maybe it should ramp here? + this.volume.value = -Infinity; + } + else if (this.mute && !mute) { + this.volume.value = this._unmutedVolume; + } + } + /** + * clean up + */ + dispose() { + super.dispose(); + this.input.dispose(); + this.volume.dispose(); + return this; + } +} + +/** + * A single master output which is connected to the + * AudioDestinationNode (aka your speakers). + * It provides useful conveniences such as the ability + * to set the volume and mute the entire application. + * It also gives you the ability to apply master effects to your application. + * + * @example + * const oscillator = new Tone.Oscillator().start(); + * // the audio will go from the oscillator to the speakers + * oscillator.connect(Tone.getDestination()); + * // a convenience for connecting to the master output is also provided: + * oscillator.toDestination(); + * @category Core + */ +class Destination extends ToneAudioNode { + constructor() { + super(optionsFromArguments(Destination.getDefaults(), arguments)); + this.name = "Destination"; + this.input = new Volume({ context: this.context }); + this.output = new Gain({ context: this.context }); + /** + * The volume of the master output in decibels. -Infinity is silent, and 0 is no change. + * @example + * const osc = new Tone.Oscillator().toDestination(); + * osc.start(); + * // ramp the volume down to silent over 10 seconds + * Tone.getDestination().volume.rampTo(-Infinity, 10); + */ + this.volume = this.input.volume; + const options = optionsFromArguments(Destination.getDefaults(), arguments); + connectSeries(this.input, this.output, this.context.rawContext.destination); + this.mute = options.mute; + this._internalChannels = [this.input, this.context.rawContext.destination, this.output]; + } + static getDefaults() { + return Object.assign(ToneAudioNode.getDefaults(), { + mute: false, + volume: 0, + }); + } + /** + * Mute the output. + * @example + * const oscillator = new Tone.Oscillator().start().toDestination(); + * setTimeout(() => { + * // mute the output + * Tone.Destination.mute = true; + * }, 1000); + */ + get mute() { + return this.input.mute; + } + set mute(mute) { + this.input.mute = mute; + } + /** + * Add a master effects chain. NOTE: this will disconnect any nodes which were previously + * chained in the master effects chain. + * @param args All arguments will be connected in a row and the Master will be routed through it. + * @example + * // route all audio through a filter and compressor + * const lowpass = new Tone.Filter(800, "lowpass"); + * const compressor = new Tone.Compressor(-18); + * Tone.Destination.chain(lowpass, compressor); + */ + chain(...args) { + this.input.disconnect(); + args.unshift(this.input); + args.push(this.output); + connectSeries(...args); + return this; + } + /** + * The maximum number of channels the system can output + * @example + * console.log(Tone.Destination.maxChannelCount); + */ + get maxChannelCount() { + return this.context.rawContext.destination.maxChannelCount; + } + /** + * Clean up + */ + dispose() { + super.dispose(); + this.volume.dispose(); + return this; + } +} +//------------------------------------- +// INITIALIZATION +//------------------------------------- +onContextInit(context => { + context.destination = new Destination({ context }); +}); +onContextClose(context => { + context.destination.dispose(); +}); + +/** + * Represents a single value which is gettable and settable in a timed way + */ +class TimelineValue extends Tone { + /** + * @param initialValue The value to return if there is no scheduled values + */ + constructor(initialValue) { + super(); + this.name = "TimelineValue"; + /** + * The timeline which stores the values + */ + this._timeline = new Timeline({ memory: 10 }); + this._initialValue = initialValue; + } + /** + * Set the value at the given time + */ + set(value, time) { + this._timeline.add({ + value, time + }); + return this; + } + /** + * Get the value at the given time + */ + get(time) { + const event = this._timeline.get(time); + if (event) { + return event.value; + } + else { + return this._initialValue; + } + } +} + +/** + * TransportEvent is an internal class used by [[Transport]] + * to schedule events. Do no invoke this class directly, it is + * handled from within Tone.Transport. + */ +class TransportEvent { + /** + * @param transport The transport object which the event belongs to + */ + constructor(transport, opts) { + /** + * The unique id of the event + */ + this.id = TransportEvent._eventId++; + const options = Object.assign(TransportEvent.getDefaults(), opts); + this.transport = transport; + this.callback = options.callback; + this._once = options.once; + this.time = options.time; + } + static getDefaults() { + return { + callback: noOp, + once: false, + time: 0, + }; + } + /** + * Invoke the event callback. + * @param time The AudioContext time in seconds of the event + */ + invoke(time) { + if (this.callback) { + this.callback(time); + if (this._once) { + this.transport.clear(this.id); + } + } + } + /** + * Clean up + */ + dispose() { + this.callback = undefined; + return this; + } +} +/** + * Current ID counter + */ +TransportEvent._eventId = 0; + +/** + * TransportRepeatEvent is an internal class used by Tone.Transport + * to schedule repeat events. This class should not be instantiated directly. + */ +class TransportRepeatEvent extends TransportEvent { + /** + * @param transport The transport object which the event belongs to + */ + constructor(transport, opts) { + super(transport, opts); + /** + * The ID of the current timeline event + */ + this._currentId = -1; + /** + * The ID of the next timeline event + */ + this._nextId = -1; + /** + * The time of the next event + */ + this._nextTick = this.time; + /** + * a reference to the bound start method + */ + this._boundRestart = this._restart.bind(this); + const options = Object.assign(TransportRepeatEvent.getDefaults(), opts); + this.duration = new TicksClass(transport.context, options.duration).valueOf(); + this._interval = new TicksClass(transport.context, options.interval).valueOf(); + this._nextTick = options.time; + this.transport.on("start", this._boundRestart); + this.transport.on("loopStart", this._boundRestart); + this.context = this.transport.context; + this._restart(); + } + static getDefaults() { + return Object.assign({}, TransportEvent.getDefaults(), { + duration: Infinity, + interval: 1, + once: false, + }); + } + /** + * Invoke the callback. Returns the tick time which + * the next event should be scheduled at. + * @param time The AudioContext time in seconds of the event + */ + invoke(time) { + // create more events if necessary + this._createEvents(time); + // call the super class + super.invoke(time); + } + /** + * Push more events onto the timeline to keep up with the position of the timeline + */ + _createEvents(time) { + // schedule the next event + const ticks = this.transport.getTicksAtTime(time); + if (ticks >= this.time && ticks >= this._nextTick && this._nextTick + this._interval < this.time + this.duration) { + this._nextTick += this._interval; + this._currentId = this._nextId; + this._nextId = this.transport.scheduleOnce(this.invoke.bind(this), new TicksClass(this.context, this._nextTick).toSeconds()); + } + } + /** + * Push more events onto the timeline to keep up with the position of the timeline + */ + _restart(time) { + this.transport.clear(this._currentId); + this.transport.clear(this._nextId); + this._nextTick = this.time; + const ticks = this.transport.getTicksAtTime(time); + if (ticks > this.time) { + this._nextTick = this.time + Math.ceil((ticks - this.time) / this._interval) * this._interval; + } + this._currentId = this.transport.scheduleOnce(this.invoke.bind(this), new TicksClass(this.context, this._nextTick).toSeconds()); + this._nextTick += this._interval; + this._nextId = this.transport.scheduleOnce(this.invoke.bind(this), new TicksClass(this.context, this._nextTick).toSeconds()); + } + /** + * Clean up + */ + dispose() { + super.dispose(); + this.transport.clear(this._currentId); + this.transport.clear(this._nextId); + this.transport.off("start", this._boundRestart); + this.transport.off("loopStart", this._boundRestart); + return this; + } +} + +/** + * Transport for timing musical events. + * Supports tempo curves and time changes. Unlike browser-based timing (setInterval, requestAnimationFrame) + * Transport timing events pass in the exact time of the scheduled event + * in the argument of the callback function. Pass that time value to the object + * you're scheduling.

+ * A single transport is created for you when the library is initialized. + *

+ * The transport emits the events: "start", "stop", "pause", and "loop" which are + * called with the time of that event as the argument. + * + * @example + * const osc = new Tone.Oscillator().toDestination(); + * // repeated event every 8th note + * Tone.Transport.scheduleRepeat((time) => { + * // use the callback time to schedule events + * osc.start(time).stop(time + 0.1); + * }, "8n"); + * // transport must be started before it starts invoking events + * Tone.Transport.start(); + * @category Core + */ +class Transport extends ToneWithContext { + constructor() { + super(optionsFromArguments(Transport.getDefaults(), arguments)); + this.name = "Transport"; + //------------------------------------- + // LOOPING + //------------------------------------- + /** + * If the transport loops or not. + */ + this._loop = new TimelineValue(false); + /** + * The loop start position in ticks + */ + this._loopStart = 0; + /** + * The loop end position in ticks + */ + this._loopEnd = 0; + //------------------------------------- + // TIMELINE EVENTS + //------------------------------------- + /** + * All the events in an object to keep track by ID + */ + this._scheduledEvents = {}; + /** + * The scheduled events. + */ + this._timeline = new Timeline(); + /** + * Repeated events + */ + this._repeatedEvents = new IntervalTimeline(); + /** + * All of the synced Signals + */ + this._syncedSignals = []; + /** + * The swing amount + */ + this._swingAmount = 0; + const options = optionsFromArguments(Transport.getDefaults(), arguments); + // CLOCK/TEMPO + this._ppq = options.ppq; + this._clock = new Clock({ + callback: this._processTick.bind(this), + context: this.context, + frequency: 0, + units: "bpm", + }); + this._bindClockEvents(); + this.bpm = this._clock.frequency; + this._clock.frequency.multiplier = options.ppq; + this.bpm.setValueAtTime(options.bpm, 0); + readOnly(this, "bpm"); + this._timeSignature = options.timeSignature; + // SWING + this._swingTicks = options.ppq / 2; // 8n + } + static getDefaults() { + return Object.assign(ToneWithContext.getDefaults(), { + bpm: 120, + loopEnd: "4m", + loopStart: 0, + ppq: 192, + swing: 0, + swingSubdivision: "8n", + timeSignature: 4, + }); + } + //------------------------------------- + // TICKS + //------------------------------------- + /** + * called on every tick + * @param tickTime clock relative tick time + */ + _processTick(tickTime, ticks) { + // do the loop test + if (this._loop.get(tickTime)) { + if (ticks >= this._loopEnd) { + this.emit("loopEnd", tickTime); + this._clock.setTicksAtTime(this._loopStart, tickTime); + ticks = this._loopStart; + this.emit("loopStart", tickTime, this._clock.getSecondsAtTime(tickTime)); + this.emit("loop", tickTime); + } + } + // handle swing + if (this._swingAmount > 0 && + ticks % this._ppq !== 0 && // not on a downbeat + ticks % (this._swingTicks * 2) !== 0) { + // add some swing + const progress = (ticks % (this._swingTicks * 2)) / (this._swingTicks * 2); + const amount = Math.sin((progress) * Math.PI) * this._swingAmount; + tickTime += new TicksClass(this.context, this._swingTicks * 2 / 3).toSeconds() * amount; + } + // invoke the timeline events scheduled on this tick + this._timeline.forEachAtTime(ticks, event => event.invoke(tickTime)); + } + //------------------------------------- + // SCHEDULABLE EVENTS + //------------------------------------- + /** + * Schedule an event along the timeline. + * @param callback The callback to be invoked at the time. + * @param time The time to invoke the callback at. + * @return The id of the event which can be used for canceling the event. + * @example + * // schedule an event on the 16th measure + * Tone.Transport.schedule((time) => { + * // invoked on measure 16 + * console.log("measure 16!"); + * }, "16:0:0"); + */ + schedule(callback, time) { + const event = new TransportEvent(this, { + callback, + time: new TransportTimeClass(this.context, time).toTicks(), + }); + return this._addEvent(event, this._timeline); + } + /** + * Schedule a repeated event along the timeline. The event will fire + * at the `interval` starting at the `startTime` and for the specified + * `duration`. + * @param callback The callback to invoke. + * @param interval The duration between successive callbacks. Must be a positive number. + * @param startTime When along the timeline the events should start being invoked. + * @param duration How long the event should repeat. + * @return The ID of the scheduled event. Use this to cancel the event. + * @example + * const osc = new Tone.Oscillator().toDestination().start(); + * // a callback invoked every eighth note after the first measure + * Tone.Transport.scheduleRepeat((time) => { + * osc.start(time).stop(time + 0.1); + * }, "8n", "1m"); + */ + scheduleRepeat(callback, interval, startTime, duration = Infinity) { + const event = new TransportRepeatEvent(this, { + callback, + duration: new TimeClass(this.context, duration).toTicks(), + interval: new TimeClass(this.context, interval).toTicks(), + time: new TransportTimeClass(this.context, startTime).toTicks(), + }); + // kick it off if the Transport is started + // @ts-ignore + return this._addEvent(event, this._repeatedEvents); + } + /** + * Schedule an event that will be removed after it is invoked. + * @param callback The callback to invoke once. + * @param time The time the callback should be invoked. + * @returns The ID of the scheduled event. + */ + scheduleOnce(callback, time) { + const event = new TransportEvent(this, { + callback, + once: true, + time: new TransportTimeClass(this.context, time).toTicks(), + }); + return this._addEvent(event, this._timeline); + } + /** + * Clear the passed in event id from the timeline + * @param eventId The id of the event. + */ + clear(eventId) { + if (this._scheduledEvents.hasOwnProperty(eventId)) { + const item = this._scheduledEvents[eventId.toString()]; + item.timeline.remove(item.event); + item.event.dispose(); + delete this._scheduledEvents[eventId.toString()]; + } + return this; + } + /** + * Add an event to the correct timeline. Keep track of the + * timeline it was added to. + * @returns the event id which was just added + */ + _addEvent(event, timeline) { + this._scheduledEvents[event.id.toString()] = { + event, + timeline, + }; + timeline.add(event); + return event.id; + } + /** + * Remove scheduled events from the timeline after + * the given time. Repeated events will be removed + * if their startTime is after the given time + * @param after Clear all events after this time. + */ + cancel(after = 0) { + const computedAfter = this.toTicks(after); + this._timeline.forEachFrom(computedAfter, event => this.clear(event.id)); + this._repeatedEvents.forEachFrom(computedAfter, event => this.clear(event.id)); + return this; + } + //------------------------------------- + // START/STOP/PAUSE + //------------------------------------- + /** + * Bind start/stop/pause events from the clock and emit them. + */ + _bindClockEvents() { + this._clock.on("start", (time, offset) => { + offset = new TicksClass(this.context, offset).toSeconds(); + this.emit("start", time, offset); + }); + this._clock.on("stop", (time) => { + this.emit("stop", time); + }); + this._clock.on("pause", (time) => { + this.emit("pause", time); + }); + } + /** + * Returns the playback state of the source, either "started", "stopped", or "paused" + */ + get state() { + return this._clock.getStateAtTime(this.now()); + } + /** + * Start the transport and all sources synced to the transport. + * @param time The time when the transport should start. + * @param offset The timeline offset to start the transport. + * @example + * // start the transport in one second starting at beginning of the 5th measure. + * Tone.Transport.start("+1", "4:0:0"); + */ + start(time, offset) { + let offsetTicks; + if (isDefined(offset)) { + offsetTicks = this.toTicks(offset); + } + // start the clock + this._clock.start(time, offsetTicks); + return this; + } + /** + * Stop the transport and all sources synced to the transport. + * @param time The time when the transport should stop. + * @example + * Tone.Transport.stop(); + */ + stop(time) { + this._clock.stop(time); + return this; + } + /** + * Pause the transport and all sources synced to the transport. + */ + pause(time) { + this._clock.pause(time); + return this; + } + /** + * Toggle the current state of the transport. If it is + * started, it will stop it, otherwise it will start the Transport. + * @param time The time of the event + */ + toggle(time) { + time = this.toSeconds(time); + if (this._clock.getStateAtTime(time) !== "started") { + this.start(time); + } + else { + this.stop(time); + } + return this; + } + //------------------------------------- + // SETTERS/GETTERS + //------------------------------------- + /** + * The time signature as just the numerator over 4. + * For example 4/4 would be just 4 and 6/8 would be 3. + * @example + * // common time + * Tone.Transport.timeSignature = 4; + * // 7/8 + * Tone.Transport.timeSignature = [7, 8]; + * // this will be reduced to a single number + * Tone.Transport.timeSignature; // returns 3.5 + */ + get timeSignature() { + return this._timeSignature; + } + set timeSignature(timeSig) { + if (isArray(timeSig)) { + timeSig = (timeSig[0] / timeSig[1]) * 4; + } + this._timeSignature = timeSig; + } + /** + * When the Transport.loop = true, this is the starting position of the loop. + */ + get loopStart() { + return new TimeClass(this.context, this._loopStart, "i").toSeconds(); + } + set loopStart(startPosition) { + this._loopStart = this.toTicks(startPosition); + } + /** + * When the Transport.loop = true, this is the ending position of the loop. + */ + get loopEnd() { + return new TimeClass(this.context, this._loopEnd, "i").toSeconds(); + } + set loopEnd(endPosition) { + this._loopEnd = this.toTicks(endPosition); + } + /** + * If the transport loops or not. + */ + get loop() { + return this._loop.get(this.now()); + } + set loop(loop) { + this._loop.set(loop, this.now()); + } + /** + * Set the loop start and stop at the same time. + * @example + * // loop over the first measure + * Tone.Transport.setLoopPoints(0, "1m"); + * Tone.Transport.loop = true; + */ + setLoopPoints(startPosition, endPosition) { + this.loopStart = startPosition; + this.loopEnd = endPosition; + return this; + } + /** + * The swing value. Between 0-1 where 1 equal to the note + half the subdivision. + */ + get swing() { + return this._swingAmount; + } + set swing(amount) { + // scale the values to a normal range + this._swingAmount = amount; + } + /** + * Set the subdivision which the swing will be applied to. + * The default value is an 8th note. Value must be less + * than a quarter note. + */ + get swingSubdivision() { + return new TicksClass(this.context, this._swingTicks).toNotation(); + } + set swingSubdivision(subdivision) { + this._swingTicks = this.toTicks(subdivision); + } + /** + * The Transport's position in Bars:Beats:Sixteenths. + * Setting the value will jump to that position right away. + */ + get position() { + const now = this.now(); + const ticks = this._clock.getTicksAtTime(now); + return new TicksClass(this.context, ticks).toBarsBeatsSixteenths(); + } + set position(progress) { + const ticks = this.toTicks(progress); + this.ticks = ticks; + } + /** + * The Transport's position in seconds + * Setting the value will jump to that position right away. + */ + get seconds() { + return this._clock.seconds; + } + set seconds(s) { + const now = this.now(); + const ticks = this._clock.frequency.timeToTicks(s, now); + this.ticks = ticks; + } + /** + * The Transport's loop position as a normalized value. Always + * returns 0 if the transport if loop is not true. + */ + get progress() { + if (this.loop) { + const now = this.now(); + const ticks = this._clock.getTicksAtTime(now); + return (ticks - this._loopStart) / (this._loopEnd - this._loopStart); + } + else { + return 0; + } + } + /** + * The transports current tick position. + */ + get ticks() { + return this._clock.ticks; + } + set ticks(t) { + if (this._clock.ticks !== t) { + const now = this.now(); + // stop everything synced to the transport + if (this.state === "started") { + const ticks = this._clock.getTicksAtTime(now); + // schedule to start on the next tick, #573 + const remainingTick = this._clock.frequency.getDurationOfTicks(Math.ceil(ticks) - ticks, now); + const time = now + remainingTick; + this.emit("stop", time); + this._clock.setTicksAtTime(t, time); + // restart it with the new time + this.emit("start", time, this._clock.getSecondsAtTime(time)); + } + else { + this._clock.setTicksAtTime(t, now); + } + } + } + /** + * Get the clock's ticks at the given time. + * @param time When to get the tick value + * @return The tick value at the given time. + */ + getTicksAtTime(time) { + return Math.round(this._clock.getTicksAtTime(time)); + } + /** + * Return the elapsed seconds at the given time. + * @param time When to get the elapsed seconds + * @return The number of elapsed seconds + */ + getSecondsAtTime(time) { + return this._clock.getSecondsAtTime(time); + } + /** + * Pulses Per Quarter note. This is the smallest resolution + * the Transport timing supports. This should be set once + * on initialization and not set again. Changing this value + * after other objects have been created can cause problems. + */ + get PPQ() { + return this._clock.frequency.multiplier; + } + set PPQ(ppq) { + this._clock.frequency.multiplier = ppq; + } + //------------------------------------- + // SYNCING + //------------------------------------- + /** + * Returns the time aligned to the next subdivision + * of the Transport. If the Transport is not started, + * it will return 0. + * Note: this will not work precisely during tempo ramps. + * @param subdivision The subdivision to quantize to + * @return The context time of the next subdivision. + * @example + * // the transport must be started, otherwise returns 0 + * Tone.Transport.start(); + * Tone.Transport.nextSubdivision("4n"); + */ + nextSubdivision(subdivision) { + subdivision = this.toTicks(subdivision); + if (this.state !== "started") { + // if the transport's not started, return 0 + return 0; + } + else { + const now = this.now(); + // the remainder of the current ticks and the subdivision + const transportPos = this.getTicksAtTime(now); + const remainingTicks = subdivision - transportPos % subdivision; + return this._clock.nextTickTime(remainingTicks, now); + } + } + /** + * Attaches the signal to the tempo control signal so that + * any changes in the tempo will change the signal in the same + * ratio. + * + * @param signal + * @param ratio Optionally pass in the ratio between the two signals. + * Otherwise it will be computed based on their current values. + */ + syncSignal(signal, ratio) { + if (!ratio) { + // get the sync ratio + const now = this.now(); + if (signal.getValueAtTime(now) !== 0) { + const bpm = this.bpm.getValueAtTime(now); + const computedFreq = 1 / (60 / bpm / this.PPQ); + ratio = signal.getValueAtTime(now) / computedFreq; + } + else { + ratio = 0; + } + } + const ratioSignal = new Gain(ratio); + // @ts-ignore + this.bpm.connect(ratioSignal); + // @ts-ignore + ratioSignal.connect(signal._param); + this._syncedSignals.push({ + initial: signal.value, + ratio: ratioSignal, + signal, + }); + signal.value = 0; + return this; + } + /** + * Unsyncs a previously synced signal from the transport's control. + * See Transport.syncSignal. + */ + unsyncSignal(signal) { + for (let i = this._syncedSignals.length - 1; i >= 0; i--) { + const syncedSignal = this._syncedSignals[i]; + if (syncedSignal.signal === signal) { + syncedSignal.ratio.dispose(); + syncedSignal.signal.value = syncedSignal.initial; + this._syncedSignals.splice(i, 1); + } + } + return this; + } + /** + * Clean up. + */ + dispose() { + super.dispose(); + this._clock.dispose(); + writable(this, "bpm"); + this._timeline.dispose(); + this._repeatedEvents.dispose(); + return this; + } +} +Emitter.mixin(Transport); +//------------------------------------- +// INITIALIZATION +//------------------------------------- +onContextInit(context => { + context.transport = new Transport({ context }); +}); +onContextClose(context => { + context.transport.dispose(); +}); + +/** + * Base class for sources. + * start/stop of this.context.transport. + * + * ``` + * // Multiple state change events can be chained together, + * // but must be set in the correct order and with ascending times + * // OK + * state.start().stop("+0.2"); + * // OK + * state.start().stop("+0.2").start("+0.4").stop("+0.7") + * // BAD + * state.stop("+0.2").start(); + * // BAD + * state.start("+0.3").stop("+0.2"); + * ``` + */ +class Source extends ToneAudioNode { + constructor(options) { + super(options); + /** + * Sources have no inputs + */ + this.input = undefined; + /** + * Keep track of the scheduled state. + */ + this._state = new StateTimeline("stopped"); + /** + * The synced `start` callback function from the transport + */ + this._synced = false; + /** + * Keep track of all of the scheduled event ids + */ + this._scheduled = []; + /** + * Placeholder functions for syncing/unsyncing to transport + */ + this._syncedStart = noOp; + this._syncedStop = noOp; + this._state.memory = 100; + this._state.increasing = true; + this._volume = this.output = new Volume({ + context: this.context, + mute: options.mute, + volume: options.volume, + }); + this.volume = this._volume.volume; + readOnly(this, "volume"); + this.onstop = options.onstop; + } + static getDefaults() { + return Object.assign(ToneAudioNode.getDefaults(), { + mute: false, + onstop: noOp, + volume: 0, + }); + } + /** + * Returns the playback state of the source, either "started" or "stopped". + * @example + * const player = new Tone.Player("https://tonejs.github.io/audio/berklee/ahntone_c3.mp3", () => { + * player.start(); + * console.log(player.state); + * }).toDestination(); + */ + get state() { + if (this._synced) { + if (this.context.transport.state === "started") { + return this._state.getValueAtTime(this.context.transport.seconds); + } + else { + return "stopped"; + } + } + else { + return this._state.getValueAtTime(this.now()); + } + } + /** + * Mute the output. + * @example + * const osc = new Tone.Oscillator().toDestination().start(); + * // mute the output + * osc.mute = true; + */ + get mute() { + return this._volume.mute; + } + set mute(mute) { + this._volume.mute = mute; + } + /** + * Ensure that the scheduled time is not before the current time. + * Should only be used when scheduled unsynced. + */ + _clampToCurrentTime(time) { + if (this._synced) { + return time; + } + else { + return Math.max(time, this.context.currentTime); + } + } + /** + * Start the source at the specified time. If no time is given, + * start the source now. + * @param time When the source should be started. + * @example + * const source = new Tone.Oscillator().toDestination(); + * source.start("+0.5"); // starts the source 0.5 seconds from now + */ + start(time, offset, duration) { + let computedTime = isUndef(time) && this._synced ? this.context.transport.seconds : this.toSeconds(time); + computedTime = this._clampToCurrentTime(computedTime); + // if it's started, stop it and restart it + if (!this._synced && this._state.getValueAtTime(computedTime) === "started") { + // time should be strictly greater than the previous start time + assert(GT(computedTime, this._state.get(computedTime).time), "Start time must be strictly greater than previous start time"); + this._state.cancel(computedTime); + this._state.setStateAtTime("started", computedTime); + this.log("restart", computedTime); + this.restart(computedTime, offset, duration); + } + else { + this.log("start", computedTime); + this._state.setStateAtTime("started", computedTime); + if (this._synced) { + // add the offset time to the event + const event = this._state.get(computedTime); + if (event) { + event.offset = this.toSeconds(defaultArg(offset, 0)); + event.duration = duration ? this.toSeconds(duration) : undefined; + } + const sched = this.context.transport.schedule(t => { + this._start(t, offset, duration); + }, computedTime); + this._scheduled.push(sched); + // if the transport is already started + // and the time is greater than where the transport is + if (this.context.transport.state === "started" && + this.context.transport.getSecondsAtTime(this.immediate()) > computedTime) { + this._syncedStart(this.now(), this.context.transport.seconds); + } + } + else { + assertContextRunning(this.context); + this._start(computedTime, offset, duration); + } + } + return this; + } + /** + * Stop the source at the specified time. If no time is given, + * stop the source now. + * @param time When the source should be stopped. + * @example + * const source = new Tone.Oscillator().toDestination(); + * source.start(); + * source.stop("+0.5"); // stops the source 0.5 seconds from now + */ + stop(time) { + let computedTime = isUndef(time) && this._synced ? this.context.transport.seconds : this.toSeconds(time); + computedTime = this._clampToCurrentTime(computedTime); + if (this._state.getValueAtTime(computedTime) === "started" || isDefined(this._state.getNextState("started", computedTime))) { + this.log("stop", computedTime); + if (!this._synced) { + this._stop(computedTime); + } + else { + const sched = this.context.transport.schedule(this._stop.bind(this), computedTime); + this._scheduled.push(sched); + } + this._state.cancel(computedTime); + this._state.setStateAtTime("stopped", computedTime); + } + return this; + } + /** + * Restart the source. + */ + restart(time, offset, duration) { + time = this.toSeconds(time); + if (this._state.getValueAtTime(time) === "started") { + this._state.cancel(time); + this._restart(time, offset, duration); + } + return this; + } + /** + * Sync the source to the Transport so that all subsequent + * calls to `start` and `stop` are synced to the TransportTime + * instead of the AudioContext time. + * + * @example + * const osc = new Tone.Oscillator().toDestination(); + * // sync the source so that it plays between 0 and 0.3 on the Transport's timeline + * osc.sync().start(0).stop(0.3); + * // start the transport. + * Tone.Transport.start(); + * // set it to loop once a second + * Tone.Transport.loop = true; + * Tone.Transport.loopEnd = 1; + */ + sync() { + if (!this._synced) { + this._synced = true; + this._syncedStart = (time, offset) => { + if (offset > 0) { + // get the playback state at that time + const stateEvent = this._state.get(offset); + // listen for start events which may occur in the middle of the sync'ed time + if (stateEvent && stateEvent.state === "started" && stateEvent.time !== offset) { + // get the offset + const startOffset = offset - this.toSeconds(stateEvent.time); + let duration; + if (stateEvent.duration) { + duration = this.toSeconds(stateEvent.duration) - startOffset; + } + this._start(time, this.toSeconds(stateEvent.offset) + startOffset, duration); + } + } + }; + this._syncedStop = time => { + const seconds = this.context.transport.getSecondsAtTime(Math.max(time - this.sampleTime, 0)); + if (this._state.getValueAtTime(seconds) === "started") { + this._stop(time); + } + }; + this.context.transport.on("start", this._syncedStart); + this.context.transport.on("loopStart", this._syncedStart); + this.context.transport.on("stop", this._syncedStop); + this.context.transport.on("pause", this._syncedStop); + this.context.transport.on("loopEnd", this._syncedStop); + } + return this; + } + /** + * Unsync the source to the Transport. See Source.sync + */ + unsync() { + if (this._synced) { + this.context.transport.off("stop", this._syncedStop); + this.context.transport.off("pause", this._syncedStop); + this.context.transport.off("loopEnd", this._syncedStop); + this.context.transport.off("start", this._syncedStart); + this.context.transport.off("loopStart", this._syncedStart); + } + this._synced = false; + // clear all of the scheduled ids + this._scheduled.forEach(id => this.context.transport.clear(id)); + this._scheduled = []; + this._state.cancel(0); + // stop it also + this._stop(0); + return this; + } + /** + * Clean up. + */ + dispose() { + super.dispose(); + this.onstop = noOp; + this.unsync(); + this._volume.dispose(); + this._state.dispose(); + return this; + } +} + +/** + * Wrapper around the native BufferSourceNode. + * @category Source + */ +class ToneBufferSource extends OneShotSource { + constructor() { + super(optionsFromArguments(ToneBufferSource.getDefaults(), arguments, ["url", "onload"])); + this.name = "ToneBufferSource"; + /** + * The oscillator + */ + this._source = this.context.createBufferSource(); + this._internalChannels = [this._source]; + /** + * indicators if the source has started/stopped + */ + this._sourceStarted = false; + this._sourceStopped = false; + const options = optionsFromArguments(ToneBufferSource.getDefaults(), arguments, ["url", "onload"]); + connect(this._source, this._gainNode); + this._source.onended = () => this._stopSource(); + /** + * The playbackRate of the buffer + */ + this.playbackRate = new Param({ + context: this.context, + param: this._source.playbackRate, + units: "positive", + value: options.playbackRate, + }); + // set some values initially + this.loop = options.loop; + this.loopStart = options.loopStart; + this.loopEnd = options.loopEnd; + this._buffer = new ToneAudioBuffer(options.url, options.onload, options.onerror); + this._internalChannels.push(this._source); + } + static getDefaults() { + return Object.assign(OneShotSource.getDefaults(), { + url: new ToneAudioBuffer(), + loop: false, + loopEnd: 0, + loopStart: 0, + onload: noOp, + onerror: noOp, + playbackRate: 1, + }); + } + /** + * The fadeIn time of the amplitude envelope. + */ + get fadeIn() { + return this._fadeIn; + } + set fadeIn(t) { + this._fadeIn = t; + } + /** + * The fadeOut time of the amplitude envelope. + */ + get fadeOut() { + return this._fadeOut; + } + set fadeOut(t) { + this._fadeOut = t; + } + /** + * The curve applied to the fades, either "linear" or "exponential" + */ + get curve() { + return this._curve; + } + set curve(t) { + this._curve = t; + } + /** + * Start the buffer + * @param time When the player should start. + * @param offset The offset from the beginning of the sample to start at. + * @param duration How long the sample should play. If no duration is given, it will default to the full length of the sample (minus any offset) + * @param gain The gain to play the buffer back at. + */ + start(time, offset, duration, gain = 1) { + assert(this.buffer.loaded, "buffer is either not set or not loaded"); + const computedTime = this.toSeconds(time); + // apply the gain envelope + this._startGain(computedTime, gain); + // if it's a loop the default offset is the loopstart point + if (this.loop) { + offset = defaultArg(offset, this.loopStart); + } + else { + // otherwise the default offset is 0 + offset = defaultArg(offset, 0); + } + // make sure the offset is not less than 0 + let computedOffset = Math.max(this.toSeconds(offset), 0); + // start the buffer source + if (this.loop) { + // modify the offset if it's greater than the loop time + const loopEnd = this.toSeconds(this.loopEnd) || this.buffer.duration; + const loopStart = this.toSeconds(this.loopStart); + const loopDuration = loopEnd - loopStart; + // move the offset back + if (GTE(computedOffset, loopEnd)) { + computedOffset = ((computedOffset - loopStart) % loopDuration) + loopStart; + } + // when the offset is very close to the duration, set it to 0 + if (EQ(computedOffset, this.buffer.duration)) { + computedOffset = 0; + } + } + // this.buffer.loaded would have return false if the AudioBuffer was undefined + this._source.buffer = this.buffer.get(); + this._source.loopEnd = this.toSeconds(this.loopEnd) || this.buffer.duration; + if (LT(computedOffset, this.buffer.duration)) { + this._sourceStarted = true; + this._source.start(computedTime, computedOffset); + } + // if a duration is given, schedule a stop + if (isDefined(duration)) { + let computedDur = this.toSeconds(duration); + // make sure it's never negative + computedDur = Math.max(computedDur, 0); + this.stop(computedTime + computedDur); + } + return this; + } + _stopSource(time) { + if (!this._sourceStopped && this._sourceStarted) { + this._sourceStopped = true; + this._source.stop(this.toSeconds(time)); + this._onended(); + } + } + /** + * If loop is true, the loop will start at this position. + */ + get loopStart() { + return this._source.loopStart; + } + set loopStart(loopStart) { + this._source.loopStart = this.toSeconds(loopStart); + } + /** + * If loop is true, the loop will end at this position. + */ + get loopEnd() { + return this._source.loopEnd; + } + set loopEnd(loopEnd) { + this._source.loopEnd = this.toSeconds(loopEnd); + } + /** + * The audio buffer belonging to the player. + */ + get buffer() { + return this._buffer; + } + set buffer(buffer) { + this._buffer.set(buffer); + } + /** + * If the buffer should loop once it's over. + */ + get loop() { + return this._source.loop; + } + set loop(loop) { + this._source.loop = loop; + if (this._sourceStarted) { + this.cancelStop(); + } + } + /** + * Clean up. + */ + dispose() { + super.dispose(); + this._source.onended = null; + this._source.disconnect(); + this._buffer.dispose(); + this.playbackRate.dispose(); + return this; + } +} + +/** + * Noise is a noise generator. It uses looped noise buffers to save on performance. + * Noise supports the noise types: "pink", "white", and "brown". Read more about + * colors of noise on [Wikipedia](https://en.wikipedia.org/wiki/Colors_of_noise). + * + * @example + * // initialize the noise and start + * const noise = new Tone.Noise("pink").start(); + * // make an autofilter to shape the noise + * const autoFilter = new Tone.AutoFilter({ + * frequency: "8n", + * baseFrequency: 200, + * octaves: 8 + * }).toDestination().start(); + * // connect the noise + * noise.connect(autoFilter); + * // start the autofilter LFO + * autoFilter.start(); + * @category Source + */ +class Noise extends Source { + constructor() { + super(optionsFromArguments(Noise.getDefaults(), arguments, ["type"])); + this.name = "Noise"; + /** + * Private reference to the source + */ + this._source = null; + const options = optionsFromArguments(Noise.getDefaults(), arguments, ["type"]); + this._playbackRate = options.playbackRate; + this.type = options.type; + this._fadeIn = options.fadeIn; + this._fadeOut = options.fadeOut; + } + static getDefaults() { + return Object.assign(Source.getDefaults(), { + fadeIn: 0, + fadeOut: 0, + playbackRate: 1, + type: "white", + }); + } + /** + * The type of the noise. Can be "white", "brown", or "pink". + * @example + * const noise = new Tone.Noise().toDestination().start(); + * noise.type = "brown"; + */ + get type() { + return this._type; + } + set type(type) { + assert(type in _noiseBuffers, "Noise: invalid type: " + type); + if (this._type !== type) { + this._type = type; + // if it's playing, stop and restart it + if (this.state === "started") { + const now = this.now(); + this._stop(now); + this._start(now); + } + } + } + /** + * The playback rate of the noise. Affects + * the "frequency" of the noise. + */ + get playbackRate() { + return this._playbackRate; + } + set playbackRate(rate) { + this._playbackRate = rate; + if (this._source) { + this._source.playbackRate.value = rate; + } + } + /** + * internal start method + */ + _start(time) { + const buffer = _noiseBuffers[this._type]; + this._source = new ToneBufferSource({ + url: buffer, + context: this.context, + fadeIn: this._fadeIn, + fadeOut: this._fadeOut, + loop: true, + onended: () => this.onstop(this), + playbackRate: this._playbackRate, + }).connect(this.output); + this._source.start(this.toSeconds(time), Math.random() * (buffer.duration - 0.001)); + } + /** + * internal stop method + */ + _stop(time) { + if (this._source) { + this._source.stop(this.toSeconds(time)); + this._source = null; + } + } + /** + * The fadeIn time of the amplitude envelope. + */ + get fadeIn() { + return this._fadeIn; + } + set fadeIn(time) { + this._fadeIn = time; + if (this._source) { + this._source.fadeIn = this._fadeIn; + } + } + /** + * The fadeOut time of the amplitude envelope. + */ + get fadeOut() { + return this._fadeOut; + } + set fadeOut(time) { + this._fadeOut = time; + if (this._source) { + this._source.fadeOut = this._fadeOut; + } + } + _restart(time) { + // TODO could be optimized by cancelling the buffer source 'stop' + this._stop(time); + this._start(time); + } + /** + * Clean up. + */ + dispose() { + super.dispose(); + if (this._source) { + this._source.disconnect(); + } + return this; + } +} +//-------------------- +// THE NOISE BUFFERS +//-------------------- +// Noise buffer stats +const BUFFER_LENGTH = 44100 * 5; +const NUM_CHANNELS = 2; +/** + * Cache the noise buffers + */ +const _noiseCache = { + brown: null, + pink: null, + white: null, +}; +/** + * The noise arrays. Generated on initialization. + * borrowed heavily from https://github.com/zacharydenton/noise.js + * (c) 2013 Zach Denton (MIT) + */ +const _noiseBuffers = { + get brown() { + if (!_noiseCache.brown) { + const buffer = []; + for (let channelNum = 0; channelNum < NUM_CHANNELS; channelNum++) { + const channel = new Float32Array(BUFFER_LENGTH); + buffer[channelNum] = channel; + let lastOut = 0.0; + for (let i = 0; i < BUFFER_LENGTH; i++) { + const white = Math.random() * 2 - 1; + channel[i] = (lastOut + (0.02 * white)) / 1.02; + lastOut = channel[i]; + channel[i] *= 3.5; // (roughly) compensate for gain + } + } + _noiseCache.brown = new ToneAudioBuffer().fromArray(buffer); + } + return _noiseCache.brown; + }, + get pink() { + if (!_noiseCache.pink) { + const buffer = []; + for (let channelNum = 0; channelNum < NUM_CHANNELS; channelNum++) { + const channel = new Float32Array(BUFFER_LENGTH); + buffer[channelNum] = channel; + let b0, b1, b2, b3, b4, b5, b6; + b0 = b1 = b2 = b3 = b4 = b5 = b6 = 0.0; + for (let i = 0; i < BUFFER_LENGTH; i++) { + const white = Math.random() * 2 - 1; + b0 = 0.99886 * b0 + white * 0.0555179; + b1 = 0.99332 * b1 + white * 0.0750759; + b2 = 0.96900 * b2 + white * 0.1538520; + b3 = 0.86650 * b3 + white * 0.3104856; + b4 = 0.55000 * b4 + white * 0.5329522; + b5 = -0.7616 * b5 - white * 0.0168980; + channel[i] = b0 + b1 + b2 + b3 + b4 + b5 + b6 + white * 0.5362; + channel[i] *= 0.11; // (roughly) compensate for gain + b6 = white * 0.115926; + } + } + _noiseCache.pink = new ToneAudioBuffer().fromArray(buffer); + } + return _noiseCache.pink; + }, + get white() { + if (!_noiseCache.white) { + const buffer = []; + for (let channelNum = 0; channelNum < NUM_CHANNELS; channelNum++) { + const channel = new Float32Array(BUFFER_LENGTH); + buffer[channelNum] = channel; + for (let i = 0; i < BUFFER_LENGTH; i++) { + channel[i] = Math.random() * 2 - 1; + } + } + _noiseCache.white = new ToneAudioBuffer().fromArray(buffer); + } + return _noiseCache.white; + }, +}; + +/** + * UserMedia uses MediaDevices.getUserMedia to open up and external microphone or audio input. + * Check [MediaDevices API Support](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia) + * to see which browsers are supported. Access to an external input + * is limited to secure (HTTPS) connections. + * @example + * const meter = new Tone.Meter(); + * const mic = new Tone.UserMedia().connect(meter); + * mic.open().then(() => { + * // promise resolves when input is available + * console.log("mic open"); + * // print the incoming mic levels in decibels + * setInterval(() => console.log(meter.getValue()), 100); + * }).catch(e => { + * // promise is rejected when the user doesn't have or allow mic access + * console.log("mic not open"); + * }); + * @category Source + */ +class UserMedia extends ToneAudioNode { + constructor() { + super(optionsFromArguments(UserMedia.getDefaults(), arguments, ["volume"])); + this.name = "UserMedia"; + const options = optionsFromArguments(UserMedia.getDefaults(), arguments, ["volume"]); + this._volume = this.output = new Volume({ + context: this.context, + volume: options.volume, + }); + this.volume = this._volume.volume; + readOnly(this, "volume"); + this.mute = options.mute; + } + static getDefaults() { + return Object.assign(ToneAudioNode.getDefaults(), { + mute: false, + volume: 0 + }); + } + /** + * Open the media stream. If a string is passed in, it is assumed + * to be the label or id of the stream, if a number is passed in, + * it is the input number of the stream. + * @param labelOrId The label or id of the audio input media device. + * With no argument, the default stream is opened. + * @return The promise is resolved when the stream is open. + */ + open(labelOrId) { + return __awaiter(this, void 0, void 0, function* () { + assert(UserMedia.supported, "UserMedia is not supported"); + // close the previous stream + if (this.state === "started") { + this.close(); + } + const devices = yield UserMedia.enumerateDevices(); + if (isNumber(labelOrId)) { + this._device = devices[labelOrId]; + } + else { + this._device = devices.find((device) => { + return device.label === labelOrId || device.deviceId === labelOrId; + }); + // didn't find a matching device + if (!this._device && devices.length > 0) { + this._device = devices[0]; + } + assert(isDefined(this._device), `No matching device ${labelOrId}`); + } + // do getUserMedia + const constraints = { + audio: { + echoCancellation: false, + sampleRate: this.context.sampleRate, + noiseSuppression: false, + mozNoiseSuppression: false, + } + }; + if (this._device) { + // @ts-ignore + constraints.audio.deviceId = this._device.deviceId; + } + const stream = yield navigator.mediaDevices.getUserMedia(constraints); + // start a new source only if the previous one is closed + if (!this._stream) { + this._stream = stream; + // Wrap a MediaStreamSourceNode around the live input stream. + const mediaStreamNode = this.context.createMediaStreamSource(stream); + // Connect the MediaStreamSourceNode to a gate gain node + connect(mediaStreamNode, this.output); + this._mediaStream = mediaStreamNode; + } + return this; + }); + } + /** + * Close the media stream + */ + close() { + if (this._stream && this._mediaStream) { + this._stream.getAudioTracks().forEach((track) => { + track.stop(); + }); + this._stream = undefined; + // remove the old media stream + this._mediaStream.disconnect(); + this._mediaStream = undefined; + } + this._device = undefined; + return this; + } + /** + * Returns a promise which resolves with the list of audio input devices available. + * @return The promise that is resolved with the devices + * @example + * Tone.UserMedia.enumerateDevices().then((devices) => { + * // print the device labels + * console.log(devices.map(device => device.label)); + * }); + */ + static enumerateDevices() { + return __awaiter(this, void 0, void 0, function* () { + const allDevices = yield navigator.mediaDevices.enumerateDevices(); + return allDevices.filter(device => { + return device.kind === "audioinput"; + }); + }); + } + /** + * Returns the playback state of the source, "started" when the microphone is open + * and "stopped" when the mic is closed. + */ + get state() { + return this._stream && this._stream.active ? "started" : "stopped"; + } + /** + * Returns an identifier for the represented device that is + * persisted across sessions. It is un-guessable by other applications and + * unique to the origin of the calling application. It is reset when the + * user clears cookies (for Private Browsing, a different identifier is + * used that is not persisted across sessions). Returns undefined when the + * device is not open. + */ + get deviceId() { + if (this._device) { + return this._device.deviceId; + } + else { + return undefined; + } + } + /** + * Returns a group identifier. Two devices have the + * same group identifier if they belong to the same physical device. + * Returns null when the device is not open. + */ + get groupId() { + if (this._device) { + return this._device.groupId; + } + else { + return undefined; + } + } + /** + * Returns a label describing this device (for example "Built-in Microphone"). + * Returns undefined when the device is not open or label is not available + * because of permissions. + */ + get label() { + if (this._device) { + return this._device.label; + } + else { + return undefined; + } + } + /** + * Mute the output. + * @example + * const mic = new Tone.UserMedia(); + * mic.open().then(() => { + * // promise resolves when input is available + * }); + * // mute the output + * mic.mute = true; + */ + get mute() { + return this._volume.mute; + } + set mute(mute) { + this._volume.mute = mute; + } + dispose() { + super.dispose(); + this.close(); + this._volume.dispose(); + this.volume.dispose(); + return this; + } + /** + * If getUserMedia is supported by the browser. + */ + static get supported() { + return isDefined(navigator.mediaDevices) && + isDefined(navigator.mediaDevices.getUserMedia); + } +} + +/** + * Render a segment of the oscillator to an offline context and return the results as an array + */ +function generateWaveform(instance, length) { + return __awaiter(this, void 0, void 0, function* () { + const duration = length / instance.context.sampleRate; + const context = new OfflineContext(1, duration, instance.context.sampleRate); + const clone = new instance.constructor(Object.assign(instance.get(), { + // should do 2 iterations + frequency: 2 / duration, + // zero out the detune + detune: 0, + context + })).toDestination(); + clone.start(0); + const buffer = yield context.render(); + return buffer.getChannelData(0); + }); +} + +/** + * Wrapper around the native fire-and-forget OscillatorNode. + * Adds the ability to reschedule the stop method. + * ***[[Oscillator]] is better for most use-cases*** + * @category Source + */ +class ToneOscillatorNode extends OneShotSource { + constructor() { + super(optionsFromArguments(ToneOscillatorNode.getDefaults(), arguments, ["frequency", "type"])); + this.name = "ToneOscillatorNode"; + /** + * The oscillator + */ + this._oscillator = this.context.createOscillator(); + this._internalChannels = [this._oscillator]; + const options = optionsFromArguments(ToneOscillatorNode.getDefaults(), arguments, ["frequency", "type"]); + connect(this._oscillator, this._gainNode); + this.type = options.type; + this.frequency = new Param({ + context: this.context, + param: this._oscillator.frequency, + units: "frequency", + value: options.frequency, + }); + this.detune = new Param({ + context: this.context, + param: this._oscillator.detune, + units: "cents", + value: options.detune, + }); + readOnly(this, ["frequency", "detune"]); + } + static getDefaults() { + return Object.assign(OneShotSource.getDefaults(), { + detune: 0, + frequency: 440, + type: "sine", + }); + } + /** + * Start the oscillator node at the given time + * @param time When to start the oscillator + */ + start(time) { + const computedTime = this.toSeconds(time); + this.log("start", computedTime); + this._startGain(computedTime); + this._oscillator.start(computedTime); + return this; + } + _stopSource(time) { + this._oscillator.stop(time); + } + /** + * Sets an arbitrary custom periodic waveform given a PeriodicWave. + * @param periodicWave PeriodicWave should be created with context.createPeriodicWave + */ + setPeriodicWave(periodicWave) { + this._oscillator.setPeriodicWave(periodicWave); + return this; + } + /** + * The oscillator type. Either 'sine', 'sawtooth', 'square', or 'triangle' + */ + get type() { + return this._oscillator.type; + } + set type(type) { + this._oscillator.type = type; + } + /** + * Clean up. + */ + dispose() { + super.dispose(); + if (this.state === "started") { + this.stop(); + } + this._oscillator.disconnect(); + this.frequency.dispose(); + this.detune.dispose(); + return this; + } +} + +/** + * Oscillator supports a number of features including + * phase rotation, multiple oscillator types (see Oscillator.type), + * and Transport syncing (see Oscillator.syncFrequency). + * + * @example + * // make and start a 440hz sine tone + * const osc = new Tone.Oscillator(440, "sine").toDestination().start(); + * @category Source + */ +class Oscillator extends Source { + constructor() { + super(optionsFromArguments(Oscillator.getDefaults(), arguments, ["frequency", "type"])); + this.name = "Oscillator"; + /** + * the main oscillator + */ + this._oscillator = null; + const options = optionsFromArguments(Oscillator.getDefaults(), arguments, ["frequency", "type"]); + this.frequency = new Signal({ + context: this.context, + units: "frequency", + value: options.frequency, + }); + readOnly(this, "frequency"); + this.detune = new Signal({ + context: this.context, + units: "cents", + value: options.detune, + }); + readOnly(this, "detune"); + this._partials = options.partials; + this._partialCount = options.partialCount; + this._type = options.type; + if (options.partialCount && options.type !== "custom") { + this._type = this.baseType + options.partialCount.toString(); + } + this.phase = options.phase; + } + static getDefaults() { + return Object.assign(Source.getDefaults(), { + detune: 0, + frequency: 440, + partialCount: 0, + partials: [], + phase: 0, + type: "sine", + }); + } + /** + * start the oscillator + */ + _start(time) { + const computedTime = this.toSeconds(time); + // new oscillator with previous values + const oscillator = new ToneOscillatorNode({ + context: this.context, + onended: () => this.onstop(this), + }); + this._oscillator = oscillator; + if (this._wave) { + this._oscillator.setPeriodicWave(this._wave); + } + else { + this._oscillator.type = this._type; + } + // connect the control signal to the oscillator frequency & detune + this._oscillator.connect(this.output); + this.frequency.connect(this._oscillator.frequency); + this.detune.connect(this._oscillator.detune); + // start the oscillator + this._oscillator.start(computedTime); + } + /** + * stop the oscillator + */ + _stop(time) { + const computedTime = this.toSeconds(time); + if (this._oscillator) { + this._oscillator.stop(computedTime); + } + } + /** + * Restart the oscillator. Does not stop the oscillator, but instead + * just cancels any scheduled 'stop' from being invoked. + */ + _restart(time) { + const computedTime = this.toSeconds(time); + this.log("restart", computedTime); + if (this._oscillator) { + this._oscillator.cancelStop(); + } + this._state.cancel(computedTime); + return this; + } + /** + * Sync the signal to the Transport's bpm. Any changes to the transports bpm, + * will also affect the oscillators frequency. + * @example + * const osc = new Tone.Oscillator().toDestination().start(); + * osc.frequency.value = 440; + * // the ratio between the bpm and the frequency will be maintained + * osc.syncFrequency(); + * // double the tempo + * Tone.Transport.bpm.value *= 2; + * // the frequency of the oscillator is doubled to 880 + */ + syncFrequency() { + this.context.transport.syncSignal(this.frequency); + return this; + } + /** + * Unsync the oscillator's frequency from the Transport. + * See Oscillator.syncFrequency + */ + unsyncFrequency() { + this.context.transport.unsyncSignal(this.frequency); + return this; + } + /** + * Get a cached periodic wave. Avoids having to recompute + * the oscillator values when they have already been computed + * with the same values. + */ + _getCachedPeriodicWave() { + if (this._type === "custom") { + const oscProps = Oscillator._periodicWaveCache.find(description => { + return description.phase === this._phase && + deepEquals(description.partials, this._partials); + }); + return oscProps; + } + else { + const oscProps = Oscillator._periodicWaveCache.find(description => { + return description.type === this._type && + description.phase === this._phase; + }); + this._partialCount = oscProps ? oscProps.partialCount : this._partialCount; + return oscProps; + } + } + get type() { + return this._type; + } + set type(type) { + this._type = type; + const isBasicType = ["sine", "square", "sawtooth", "triangle"].indexOf(type) !== -1; + if (this._phase === 0 && isBasicType) { + this._wave = undefined; + this._partialCount = 0; + // just go with the basic approach + if (this._oscillator !== null) { + // already tested that it's a basic type + this._oscillator.type = type; + } + } + else { + // first check if the value is cached + const cache = this._getCachedPeriodicWave(); + if (isDefined(cache)) { + const { partials, wave } = cache; + this._wave = wave; + this._partials = partials; + if (this._oscillator !== null) { + this._oscillator.setPeriodicWave(this._wave); + } + } + else { + const [real, imag] = this._getRealImaginary(type, this._phase); + const periodicWave = this.context.createPeriodicWave(real, imag); + this._wave = periodicWave; + if (this._oscillator !== null) { + this._oscillator.setPeriodicWave(this._wave); + } + // set the cache + Oscillator._periodicWaveCache.push({ + imag, + partialCount: this._partialCount, + partials: this._partials, + phase: this._phase, + real, + type: this._type, + wave: this._wave, + }); + if (Oscillator._periodicWaveCache.length > 100) { + Oscillator._periodicWaveCache.shift(); + } + } + } + } + get baseType() { + return this._type.replace(this.partialCount.toString(), ""); + } + set baseType(baseType) { + if (this.partialCount && this._type !== "custom" && baseType !== "custom") { + this.type = baseType + this.partialCount; + } + else { + this.type = baseType; + } + } + get partialCount() { + return this._partialCount; + } + set partialCount(p) { + assertRange(p, 0); + let type = this._type; + const partial = /^(sine|triangle|square|sawtooth)(\d+)$/.exec(this._type); + if (partial) { + type = partial[1]; + } + if (this._type !== "custom") { + if (p === 0) { + this.type = type; + } + else { + this.type = type + p.toString(); + } + } + else { + // extend or shorten the partials array + const fullPartials = new Float32Array(p); + // copy over the partials array + this._partials.forEach((v, i) => fullPartials[i] = v); + this._partials = Array.from(fullPartials); + this.type = this._type; + } + } + /** + * Returns the real and imaginary components based + * on the oscillator type. + * @returns [real: Float32Array, imaginary: Float32Array] + */ + _getRealImaginary(type, phase) { + const fftSize = 4096; + let periodicWaveSize = fftSize / 2; + const real = new Float32Array(periodicWaveSize); + const imag = new Float32Array(periodicWaveSize); + let partialCount = 1; + if (type === "custom") { + partialCount = this._partials.length + 1; + this._partialCount = this._partials.length; + periodicWaveSize = partialCount; + // if the partial count is 0, don't bother doing any computation + if (this._partials.length === 0) { + return [real, imag]; + } + } + else { + const partial = /^(sine|triangle|square|sawtooth)(\d+)$/.exec(type); + if (partial) { + partialCount = parseInt(partial[2], 10) + 1; + this._partialCount = parseInt(partial[2], 10); + type = partial[1]; + partialCount = Math.max(partialCount, 2); + periodicWaveSize = partialCount; + } + else { + this._partialCount = 0; + } + this._partials = []; + } + for (let n = 1; n < periodicWaveSize; ++n) { + const piFactor = 2 / (n * Math.PI); + let b; + switch (type) { + case "sine": + b = (n <= partialCount) ? 1 : 0; + this._partials[n - 1] = b; + break; + case "square": + b = (n & 1) ? 2 * piFactor : 0; + this._partials[n - 1] = b; + break; + case "sawtooth": + b = piFactor * ((n & 1) ? 1 : -1); + this._partials[n - 1] = b; + break; + case "triangle": + if (n & 1) { + b = 2 * (piFactor * piFactor) * ((((n - 1) >> 1) & 1) ? -1 : 1); + } + else { + b = 0; + } + this._partials[n - 1] = b; + break; + case "custom": + b = this._partials[n - 1]; + break; + default: + throw new TypeError("Oscillator: invalid type: " + type); + } + if (b !== 0) { + real[n] = -b * Math.sin(phase * n); + imag[n] = b * Math.cos(phase * n); + } + else { + real[n] = 0; + imag[n] = 0; + } + } + return [real, imag]; + } + /** + * Compute the inverse FFT for a given phase. + */ + _inverseFFT(real, imag, phase) { + let sum = 0; + const len = real.length; + for (let i = 0; i < len; i++) { + sum += real[i] * Math.cos(i * phase) + imag[i] * Math.sin(i * phase); + } + return sum; + } + /** + * Returns the initial value of the oscillator when stopped. + * E.g. a "sine" oscillator with phase = 90 would return an initial value of -1. + */ + getInitialValue() { + const [real, imag] = this._getRealImaginary(this._type, 0); + let maxValue = 0; + const twoPi = Math.PI * 2; + const testPositions = 32; + // check for peaks in 16 places + for (let i = 0; i < testPositions; i++) { + maxValue = Math.max(this._inverseFFT(real, imag, (i / testPositions) * twoPi), maxValue); + } + return clamp(-this._inverseFFT(real, imag, this._phase) / maxValue, -1, 1); + } + get partials() { + return this._partials.slice(0, this.partialCount); + } + set partials(partials) { + this._partials = partials; + this._partialCount = this._partials.length; + if (partials.length) { + this.type = "custom"; + } + } + get phase() { + return this._phase * (180 / Math.PI); + } + set phase(phase) { + this._phase = phase * Math.PI / 180; + // reset the type + this.type = this._type; + } + asArray(length = 1024) { + return __awaiter(this, void 0, void 0, function* () { + return generateWaveform(this, length); + }); + } + dispose() { + super.dispose(); + if (this._oscillator !== null) { + this._oscillator.dispose(); + } + this._wave = undefined; + this.frequency.dispose(); + this.detune.dispose(); + return this; + } +} +/** + * Cache the periodic waves to avoid having to redo computations + */ +Oscillator._periodicWaveCache = []; + +/** + * A signal operator has an input and output and modifies the signal. + */ +class SignalOperator extends ToneAudioNode { + constructor() { + super(Object.assign(optionsFromArguments(SignalOperator.getDefaults(), arguments, ["context"]))); + } + connect(destination, outputNum = 0, inputNum = 0) { + connectSignal(this, destination, outputNum, inputNum); + return this; + } +} + +/** + * Wraps the native Web Audio API + * [WaveShaperNode](http://webaudio.github.io/web-audio-api/#the-waveshapernode-interface). + * + * @example + * const osc = new Tone.Oscillator().toDestination().start(); + * // multiply the output of the signal by 2 using the waveshaper's function + * const timesTwo = new Tone.WaveShaper((val) => val * 2, 2048).connect(osc.frequency); + * const signal = new Tone.Signal(440).connect(timesTwo); + * @category Signal + */ +class WaveShaper extends SignalOperator { + constructor() { + super(Object.assign(optionsFromArguments(WaveShaper.getDefaults(), arguments, ["mapping", "length"]))); + this.name = "WaveShaper"; + /** + * the waveshaper node + */ + this._shaper = this.context.createWaveShaper(); + /** + * The input to the waveshaper node. + */ + this.input = this._shaper; + /** + * The output from the waveshaper node + */ + this.output = this._shaper; + const options = optionsFromArguments(WaveShaper.getDefaults(), arguments, ["mapping", "length"]); + if (isArray(options.mapping) || options.mapping instanceof Float32Array) { + this.curve = Float32Array.from(options.mapping); + } + else if (isFunction(options.mapping)) { + this.setMap(options.mapping, options.length); + } + } + static getDefaults() { + return Object.assign(Signal.getDefaults(), { + length: 1024, + }); + } + /** + * Uses a mapping function to set the value of the curve. + * @param mapping The function used to define the values. + * The mapping function take two arguments: + * the first is the value at the current position + * which goes from -1 to 1 over the number of elements + * in the curve array. The second argument is the array position. + * @example + * const shaper = new Tone.WaveShaper(); + * // map the input signal from [-1, 1] to [0, 10] + * shaper.setMap((val, index) => (val + 1) * 5); + */ + setMap(mapping, length = 1024) { + const array = new Float32Array(length); + for (let i = 0, len = length; i < len; i++) { + const normalized = (i / (len - 1)) * 2 - 1; + array[i] = mapping(normalized, i); + } + this.curve = array; + return this; + } + /** + * The array to set as the waveshaper curve. For linear curves + * array length does not make much difference, but for complex curves + * longer arrays will provide smoother interpolation. + */ + get curve() { + return this._shaper.curve; + } + set curve(mapping) { + this._shaper.curve = mapping; + } + /** + * Specifies what type of oversampling (if any) should be used when + * applying the shaping curve. Can either be "none", "2x" or "4x". + */ + get oversample() { + return this._shaper.oversample; + } + set oversample(oversampling) { + const isOverSampleType = ["none", "2x", "4x"].some(str => str.includes(oversampling)); + assert(isOverSampleType, "oversampling must be either 'none', '2x', or '4x'"); + this._shaper.oversample = oversampling; + } + /** + * Clean up. + */ + dispose() { + super.dispose(); + this._shaper.disconnect(); + return this; + } +} + +/** + * AudioToGain converts an input in AudioRange [-1,1] to NormalRange [0,1]. + * See [[GainToAudio]]. + * @category Signal + */ +class AudioToGain extends SignalOperator { + constructor() { + super(...arguments); + this.name = "AudioToGain"; + /** + * The node which converts the audio ranges + */ + this._norm = new WaveShaper({ + context: this.context, + mapping: x => (x + 1) / 2, + }); + /** + * The AudioRange input [-1, 1] + */ + this.input = this._norm; + /** + * The GainRange output [0, 1] + */ + this.output = this._norm; + } + /** + * clean up + */ + dispose() { + super.dispose(); + this._norm.dispose(); + return this; + } +} + +/** + * Multiply two incoming signals. Or, if a number is given in the constructor, + * multiplies the incoming signal by that value. + * + * @example + * // multiply two signals + * const mult = new Tone.Multiply(); + * const sigA = new Tone.Signal(3); + * const sigB = new Tone.Signal(4); + * sigA.connect(mult); + * sigB.connect(mult.factor); + * // output of mult is 12. + * @example + * // multiply a signal and a number + * const mult = new Tone.Multiply(10); + * const sig = new Tone.Signal(2).connect(mult); + * // the output of mult is 20. + * @category Signal + */ +class Multiply extends Signal { + constructor() { + super(Object.assign(optionsFromArguments(Multiply.getDefaults(), arguments, ["value"]))); + this.name = "Multiply"; + /** + * Indicates if the value should be overridden on connection + */ + this.override = false; + const options = optionsFromArguments(Multiply.getDefaults(), arguments, ["value"]); + this._mult = this.input = this.output = new Gain({ + context: this.context, + minValue: options.minValue, + maxValue: options.maxValue, + }); + this.factor = this._param = this._mult.gain; + this.factor.setValueAtTime(options.value, 0); + } + static getDefaults() { + return Object.assign(Signal.getDefaults(), { + value: 0, + }); + } + dispose() { + super.dispose(); + this._mult.dispose(); + return this; + } +} + +/** + * An amplitude modulated oscillator node. It is implemented with + * two oscillators, one which modulators the other's amplitude + * through a gain node. + * ``` + * +-------------+ +----------+ + * | Carrier Osc +>------> GainNode | + * +-------------+ | +--->Output + * +---> gain | + * +---------------+ | +----------+ + * | Modulator Osc +>---+ + * +---------------+ + * ``` + * @example + * return Tone.Offline(() => { + * const amOsc = new Tone.AMOscillator(30, "sine", "square").toDestination().start(); + * }, 0.2, 1); + * @category Source + */ +class AMOscillator extends Source { + constructor() { + super(optionsFromArguments(AMOscillator.getDefaults(), arguments, ["frequency", "type", "modulationType"])); + this.name = "AMOscillator"; + /** + * convert the -1,1 output to 0,1 + */ + this._modulationScale = new AudioToGain({ context: this.context }); + /** + * the node where the modulation happens + */ + this._modulationNode = new Gain({ + context: this.context, + }); + const options = optionsFromArguments(AMOscillator.getDefaults(), arguments, ["frequency", "type", "modulationType"]); + this._carrier = new Oscillator({ + context: this.context, + detune: options.detune, + frequency: options.frequency, + onstop: () => this.onstop(this), + phase: options.phase, + type: options.type, + }); + this.frequency = this._carrier.frequency, + this.detune = this._carrier.detune; + this._modulator = new Oscillator({ + context: this.context, + phase: options.phase, + type: options.modulationType, + }); + this.harmonicity = new Multiply({ + context: this.context, + units: "positive", + value: options.harmonicity, + }); + // connections + this.frequency.chain(this.harmonicity, this._modulator.frequency); + this._modulator.chain(this._modulationScale, this._modulationNode.gain); + this._carrier.chain(this._modulationNode, this.output); + readOnly(this, ["frequency", "detune", "harmonicity"]); + } + static getDefaults() { + return Object.assign(Oscillator.getDefaults(), { + harmonicity: 1, + modulationType: "square", + }); + } + /** + * start the oscillator + */ + _start(time) { + this._modulator.start(time); + this._carrier.start(time); + } + /** + * stop the oscillator + */ + _stop(time) { + this._modulator.stop(time); + this._carrier.stop(time); + } + _restart(time) { + this._modulator.restart(time); + this._carrier.restart(time); + } + /** + * The type of the carrier oscillator + */ + get type() { + return this._carrier.type; + } + set type(type) { + this._carrier.type = type; + } + get baseType() { + return this._carrier.baseType; + } + set baseType(baseType) { + this._carrier.baseType = baseType; + } + get partialCount() { + return this._carrier.partialCount; + } + set partialCount(partialCount) { + this._carrier.partialCount = partialCount; + } + /** + * The type of the modulator oscillator + */ + get modulationType() { + return this._modulator.type; + } + set modulationType(type) { + this._modulator.type = type; + } + get phase() { + return this._carrier.phase; + } + set phase(phase) { + this._carrier.phase = phase; + this._modulator.phase = phase; + } + get partials() { + return this._carrier.partials; + } + set partials(partials) { + this._carrier.partials = partials; + } + asArray(length = 1024) { + return __awaiter(this, void 0, void 0, function* () { + return generateWaveform(this, length); + }); + } + /** + * Clean up. + */ + dispose() { + super.dispose(); + this.frequency.dispose(); + this.detune.dispose(); + this.harmonicity.dispose(); + this._carrier.dispose(); + this._modulator.dispose(); + this._modulationNode.dispose(); + this._modulationScale.dispose(); + return this; + } +} + +/** + * FMOscillator implements a frequency modulation synthesis + * ``` + * +-------------+ + * +---------------+ +-------------+ | Carrier Osc | + * | Modulator Osc +>-------> GainNode | | +--->Output + * +---------------+ | +>----> frequency | + * +--> gain | +-------------+ + * | +-------------+ + * +-----------------+ | + * | modulationIndex +>--+ + * +-----------------+ + * ``` + * + * @example + * return Tone.Offline(() => { + * const fmOsc = new Tone.FMOscillator({ + * frequency: 200, + * type: "square", + * modulationType: "triangle", + * harmonicity: 0.2, + * modulationIndex: 3 + * }).toDestination().start(); + * }, 0.1, 1); + * @category Source + */ +class FMOscillator extends Source { + constructor() { + super(optionsFromArguments(FMOscillator.getDefaults(), arguments, ["frequency", "type", "modulationType"])); + this.name = "FMOscillator"; + /** + * the node where the modulation happens + */ + this._modulationNode = new Gain({ + context: this.context, + gain: 0, + }); + const options = optionsFromArguments(FMOscillator.getDefaults(), arguments, ["frequency", "type", "modulationType"]); + this._carrier = new Oscillator({ + context: this.context, + detune: options.detune, + frequency: 0, + onstop: () => this.onstop(this), + phase: options.phase, + type: options.type, + }); + this.detune = this._carrier.detune; + this.frequency = new Signal({ + context: this.context, + units: "frequency", + value: options.frequency, + }); + this._modulator = new Oscillator({ + context: this.context, + phase: options.phase, + type: options.modulationType, + }); + this.harmonicity = new Multiply({ + context: this.context, + units: "positive", + value: options.harmonicity, + }); + this.modulationIndex = new Multiply({ + context: this.context, + units: "positive", + value: options.modulationIndex, + }); + // connections + this.frequency.connect(this._carrier.frequency); + this.frequency.chain(this.harmonicity, this._modulator.frequency); + this.frequency.chain(this.modulationIndex, this._modulationNode); + this._modulator.connect(this._modulationNode.gain); + this._modulationNode.connect(this._carrier.frequency); + this._carrier.connect(this.output); + this.detune.connect(this._modulator.detune); + readOnly(this, ["modulationIndex", "frequency", "detune", "harmonicity"]); + } + static getDefaults() { + return Object.assign(Oscillator.getDefaults(), { + harmonicity: 1, + modulationIndex: 2, + modulationType: "square", + }); + } + /** + * start the oscillator + */ + _start(time) { + this._modulator.start(time); + this._carrier.start(time); + } + /** + * stop the oscillator + */ + _stop(time) { + this._modulator.stop(time); + this._carrier.stop(time); + } + _restart(time) { + this._modulator.restart(time); + this._carrier.restart(time); + return this; + } + get type() { + return this._carrier.type; + } + set type(type) { + this._carrier.type = type; + } + get baseType() { + return this._carrier.baseType; + } + set baseType(baseType) { + this._carrier.baseType = baseType; + } + get partialCount() { + return this._carrier.partialCount; + } + set partialCount(partialCount) { + this._carrier.partialCount = partialCount; + } + /** + * The type of the modulator oscillator + */ + get modulationType() { + return this._modulator.type; + } + set modulationType(type) { + this._modulator.type = type; + } + get phase() { + return this._carrier.phase; + } + set phase(phase) { + this._carrier.phase = phase; + this._modulator.phase = phase; + } + get partials() { + return this._carrier.partials; + } + set partials(partials) { + this._carrier.partials = partials; + } + asArray(length = 1024) { + return __awaiter(this, void 0, void 0, function* () { + return generateWaveform(this, length); + }); + } + /** + * Clean up. + */ + dispose() { + super.dispose(); + this.frequency.dispose(); + this.harmonicity.dispose(); + this._carrier.dispose(); + this._modulator.dispose(); + this._modulationNode.dispose(); + this.modulationIndex.dispose(); + return this; + } +} + +/** + * PulseOscillator is an oscillator with control over pulse width, + * also known as the duty cycle. At 50% duty cycle (width = 0) the wave is + * a square wave. + * [Read more](https://wigglewave.wordpress.com/2014/08/16/pulse-waveforms-and-harmonics/). + * ``` + * width = -0.25 width = 0.0 width = 0.25 + * + * +-----+ +-------+ + +-------+ +-+ + * | | | | | | | + * | | | | | | | + * +-+ +-------+ + +-------+ +-----+ + * + * + * width = -0.5 width = 0.5 + * + * +---+ +-------+ +---+ + * | | | | + * | | | | + * +---+ +-------+ +---+ + * + * + * width = -0.75 width = 0.75 + * + * +-+ +-------+ +-----+ + * | | | | + * | | | | + * +-----+ +-------+ +-+ + * ``` + * @example + * return Tone.Offline(() => { + * const pulse = new Tone.PulseOscillator(50, 0.4).toDestination().start(); + * }, 0.1, 1); + * @category Source + */ +class PulseOscillator extends Source { + constructor() { + super(optionsFromArguments(PulseOscillator.getDefaults(), arguments, ["frequency", "width"])); + this.name = "PulseOscillator"; + /** + * gate the width amount + */ + this._widthGate = new Gain({ + context: this.context, + gain: 0, + }); + /** + * Threshold the signal to turn it into a square + */ + this._thresh = new WaveShaper({ + context: this.context, + mapping: val => val <= 0 ? -1 : 1, + }); + const options = optionsFromArguments(PulseOscillator.getDefaults(), arguments, ["frequency", "width"]); + this.width = new Signal({ + context: this.context, + units: "audioRange", + value: options.width, + }); + this._triangle = new Oscillator({ + context: this.context, + detune: options.detune, + frequency: options.frequency, + onstop: () => this.onstop(this), + phase: options.phase, + type: "triangle", + }); + this.frequency = this._triangle.frequency; + this.detune = this._triangle.detune; + // connections + this._triangle.chain(this._thresh, this.output); + this.width.chain(this._widthGate, this._thresh); + readOnly(this, ["width", "frequency", "detune"]); + } + static getDefaults() { + return Object.assign(Source.getDefaults(), { + detune: 0, + frequency: 440, + phase: 0, + type: "pulse", + width: 0.2, + }); + } + /** + * start the oscillator + */ + _start(time) { + time = this.toSeconds(time); + this._triangle.start(time); + this._widthGate.gain.setValueAtTime(1, time); + } + /** + * stop the oscillator + */ + _stop(time) { + time = this.toSeconds(time); + this._triangle.stop(time); + // the width is still connected to the output. + // that needs to be stopped also + this._widthGate.gain.cancelScheduledValues(time); + this._widthGate.gain.setValueAtTime(0, time); + } + _restart(time) { + this._triangle.restart(time); + this._widthGate.gain.cancelScheduledValues(time); + this._widthGate.gain.setValueAtTime(1, time); + } + /** + * The phase of the oscillator in degrees. + */ + get phase() { + return this._triangle.phase; + } + set phase(phase) { + this._triangle.phase = phase; + } + /** + * The type of the oscillator. Always returns "pulse". + */ + get type() { + return "pulse"; + } + /** + * The baseType of the oscillator. Always returns "pulse". + */ + get baseType() { + return "pulse"; + } + /** + * The partials of the waveform. Cannot set partials for this waveform type + */ + get partials() { + return []; + } + /** + * No partials for this waveform type. + */ + get partialCount() { + return 0; + } + /** + * *Internal use* The carrier oscillator type is fed through the + * waveshaper node to create the pulse. Using different carrier oscillators + * changes oscillator's behavior. + */ + set carrierType(type) { + this._triangle.type = type; + } + asArray(length = 1024) { + return __awaiter(this, void 0, void 0, function* () { + return generateWaveform(this, length); + }); + } + /** + * Clean up method. + */ + dispose() { + super.dispose(); + this._triangle.dispose(); + this.width.dispose(); + this._widthGate.dispose(); + this._thresh.dispose(); + return this; + } +} + +/** + * FatOscillator is an array of oscillators with detune spread between the oscillators + * @example + * const fatOsc = new Tone.FatOscillator("Ab3", "sawtooth", 40).toDestination().start(); + * @category Source + */ +class FatOscillator extends Source { + constructor() { + super(optionsFromArguments(FatOscillator.getDefaults(), arguments, ["frequency", "type", "spread"])); + this.name = "FatOscillator"; + /** + * The array of oscillators + */ + this._oscillators = []; + const options = optionsFromArguments(FatOscillator.getDefaults(), arguments, ["frequency", "type", "spread"]); + this.frequency = new Signal({ + context: this.context, + units: "frequency", + value: options.frequency, + }); + this.detune = new Signal({ + context: this.context, + units: "cents", + value: options.detune, + }); + this._spread = options.spread; + this._type = options.type; + this._phase = options.phase; + this._partials = options.partials; + this._partialCount = options.partialCount; + // set the count initially + this.count = options.count; + readOnly(this, ["frequency", "detune"]); + } + static getDefaults() { + return Object.assign(Oscillator.getDefaults(), { + count: 3, + spread: 20, + type: "sawtooth", + }); + } + /** + * start the oscillator + */ + _start(time) { + time = this.toSeconds(time); + this._forEach(osc => osc.start(time)); + } + /** + * stop the oscillator + */ + _stop(time) { + time = this.toSeconds(time); + this._forEach(osc => osc.stop(time)); + } + _restart(time) { + this._forEach(osc => osc.restart(time)); + } + /** + * Iterate over all of the oscillators + */ + _forEach(iterator) { + for (let i = 0; i < this._oscillators.length; i++) { + iterator(this._oscillators[i], i); + } + } + /** + * The type of the oscillator + */ + get type() { + return this._type; + } + set type(type) { + this._type = type; + this._forEach(osc => osc.type = type); + } + /** + * The detune spread between the oscillators. If "count" is + * set to 3 oscillators and the "spread" is set to 40, + * the three oscillators would be detuned like this: [-20, 0, 20] + * for a total detune spread of 40 cents. + * @example + * const fatOsc = new Tone.FatOscillator().toDestination().start(); + * fatOsc.spread = 70; + */ + get spread() { + return this._spread; + } + set spread(spread) { + this._spread = spread; + if (this._oscillators.length > 1) { + const start = -spread / 2; + const step = spread / (this._oscillators.length - 1); + this._forEach((osc, i) => osc.detune.value = start + step * i); + } + } + /** + * The number of detuned oscillators. Must be an integer greater than 1. + * @example + * const fatOsc = new Tone.FatOscillator("C#3", "sawtooth").toDestination().start(); + * // use 4 sawtooth oscillators + * fatOsc.count = 4; + */ + get count() { + return this._oscillators.length; + } + set count(count) { + assertRange(count, 1); + if (this._oscillators.length !== count) { + // dispose the previous oscillators + this._forEach(osc => osc.dispose()); + this._oscillators = []; + for (let i = 0; i < count; i++) { + const osc = new Oscillator({ + context: this.context, + volume: -6 - count * 1.1, + type: this._type, + phase: this._phase + (i / count) * 360, + partialCount: this._partialCount, + onstop: i === 0 ? () => this.onstop(this) : noOp, + }); + if (this.type === "custom") { + osc.partials = this._partials; + } + this.frequency.connect(osc.frequency); + this.detune.connect(osc.detune); + osc.detune.overridden = false; + osc.connect(this.output); + this._oscillators[i] = osc; + } + // set the spread + this.spread = this._spread; + if (this.state === "started") { + this._forEach(osc => osc.start()); + } + } + } + get phase() { + return this._phase; + } + set phase(phase) { + this._phase = phase; + this._forEach((osc, i) => osc.phase = this._phase + (i / this.count) * 360); + } + get baseType() { + return this._oscillators[0].baseType; + } + set baseType(baseType) { + this._forEach(osc => osc.baseType = baseType); + this._type = this._oscillators[0].type; + } + get partials() { + return this._oscillators[0].partials; + } + set partials(partials) { + this._partials = partials; + this._partialCount = this._partials.length; + if (partials.length) { + this._type = "custom"; + this._forEach(osc => osc.partials = partials); + } + } + get partialCount() { + return this._oscillators[0].partialCount; + } + set partialCount(partialCount) { + this._partialCount = partialCount; + this._forEach(osc => osc.partialCount = partialCount); + this._type = this._oscillators[0].type; + } + asArray(length = 1024) { + return __awaiter(this, void 0, void 0, function* () { + return generateWaveform(this, length); + }); + } + /** + * Clean up. + */ + dispose() { + super.dispose(); + this.frequency.dispose(); + this.detune.dispose(); + this._forEach(osc => osc.dispose()); + return this; + } +} + +/** + * PWMOscillator modulates the width of a Tone.PulseOscillator + * at the modulationFrequency. This has the effect of continuously + * changing the timbre of the oscillator by altering the harmonics + * generated. + * @example + * return Tone.Offline(() => { + * const pwm = new Tone.PWMOscillator(60, 0.3).toDestination().start(); + * }, 0.1, 1); + * @category Source + */ +class PWMOscillator extends Source { + constructor() { + super(optionsFromArguments(PWMOscillator.getDefaults(), arguments, ["frequency", "modulationFrequency"])); + this.name = "PWMOscillator"; + this.sourceType = "pwm"; + /** + * Scale the oscillator so it doesn't go silent + * at the extreme values. + */ + this._scale = new Multiply({ + context: this.context, + value: 2, + }); + const options = optionsFromArguments(PWMOscillator.getDefaults(), arguments, ["frequency", "modulationFrequency"]); + this._pulse = new PulseOscillator({ + context: this.context, + frequency: options.modulationFrequency, + }); + // change the pulse oscillator type + this._pulse.carrierType = "sine"; + this.modulationFrequency = this._pulse.frequency; + this._modulator = new Oscillator({ + context: this.context, + detune: options.detune, + frequency: options.frequency, + onstop: () => this.onstop(this), + phase: options.phase, + }); + this.frequency = this._modulator.frequency; + this.detune = this._modulator.detune; + // connections + this._modulator.chain(this._scale, this._pulse.width); + this._pulse.connect(this.output); + readOnly(this, ["modulationFrequency", "frequency", "detune"]); + } + static getDefaults() { + return Object.assign(Source.getDefaults(), { + detune: 0, + frequency: 440, + modulationFrequency: 0.4, + phase: 0, + type: "pwm", + }); + } + /** + * start the oscillator + */ + _start(time) { + time = this.toSeconds(time); + this._modulator.start(time); + this._pulse.start(time); + } + /** + * stop the oscillator + */ + _stop(time) { + time = this.toSeconds(time); + this._modulator.stop(time); + this._pulse.stop(time); + } + /** + * restart the oscillator + */ + _restart(time) { + this._modulator.restart(time); + this._pulse.restart(time); + } + /** + * The type of the oscillator. Always returns "pwm". + */ + get type() { + return "pwm"; + } + /** + * The baseType of the oscillator. Always returns "pwm". + */ + get baseType() { + return "pwm"; + } + /** + * The partials of the waveform. Cannot set partials for this waveform type + */ + get partials() { + return []; + } + /** + * No partials for this waveform type. + */ + get partialCount() { + return 0; + } + /** + * The phase of the oscillator in degrees. + */ + get phase() { + return this._modulator.phase; + } + set phase(phase) { + this._modulator.phase = phase; + } + asArray(length = 1024) { + return __awaiter(this, void 0, void 0, function* () { + return generateWaveform(this, length); + }); + } + /** + * Clean up. + */ + dispose() { + super.dispose(); + this._pulse.dispose(); + this._scale.dispose(); + this._modulator.dispose(); + return this; + } +} + +const OmniOscillatorSourceMap = { + am: AMOscillator, + fat: FatOscillator, + fm: FMOscillator, + oscillator: Oscillator, + pulse: PulseOscillator, + pwm: PWMOscillator, +}; +/** + * OmniOscillator aggregates all of the oscillator types into one. + * @example + * return Tone.Offline(() => { + * const omniOsc = new Tone.OmniOscillator("C#4", "pwm").toDestination().start(); + * }, 0.1, 1); + * @category Source + */ +class OmniOscillator extends Source { + constructor() { + super(optionsFromArguments(OmniOscillator.getDefaults(), arguments, ["frequency", "type"])); + this.name = "OmniOscillator"; + const options = optionsFromArguments(OmniOscillator.getDefaults(), arguments, ["frequency", "type"]); + this.frequency = new Signal({ + context: this.context, + units: "frequency", + value: options.frequency, + }); + this.detune = new Signal({ + context: this.context, + units: "cents", + value: options.detune, + }); + readOnly(this, ["frequency", "detune"]); + // set the options + this.set(options); + } + static getDefaults() { + return Object.assign(Oscillator.getDefaults(), FMOscillator.getDefaults(), AMOscillator.getDefaults(), FatOscillator.getDefaults(), PulseOscillator.getDefaults(), PWMOscillator.getDefaults()); + } + /** + * start the oscillator + */ + _start(time) { + this._oscillator.start(time); + } + /** + * start the oscillator + */ + _stop(time) { + this._oscillator.stop(time); + } + _restart(time) { + this._oscillator.restart(time); + return this; + } + /** + * The type of the oscillator. Can be any of the basic types: sine, square, triangle, sawtooth. Or + * prefix the basic types with "fm", "am", or "fat" to use the FMOscillator, AMOscillator or FatOscillator + * types. The oscillator could also be set to "pwm" or "pulse". All of the parameters of the + * oscillator's class are accessible when the oscillator is set to that type, but throws an error + * when it's not. + * @example + * const omniOsc = new Tone.OmniOscillator().toDestination().start(); + * omniOsc.type = "pwm"; + * // modulationFrequency is parameter which is available + * // only when the type is "pwm". + * omniOsc.modulationFrequency.value = 0.5; + */ + get type() { + let prefix = ""; + if (["am", "fm", "fat"].some(p => this._sourceType === p)) { + prefix = this._sourceType; + } + return prefix + this._oscillator.type; + } + set type(type) { + if (type.substr(0, 2) === "fm") { + this._createNewOscillator("fm"); + this._oscillator = this._oscillator; + this._oscillator.type = type.substr(2); + } + else if (type.substr(0, 2) === "am") { + this._createNewOscillator("am"); + this._oscillator = this._oscillator; + this._oscillator.type = type.substr(2); + } + else if (type.substr(0, 3) === "fat") { + this._createNewOscillator("fat"); + this._oscillator = this._oscillator; + this._oscillator.type = type.substr(3); + } + else if (type === "pwm") { + this._createNewOscillator("pwm"); + this._oscillator = this._oscillator; + } + else if (type === "pulse") { + this._createNewOscillator("pulse"); + } + else { + this._createNewOscillator("oscillator"); + this._oscillator = this._oscillator; + this._oscillator.type = type; + } + } + /** + * The value is an empty array when the type is not "custom". + * This is not available on "pwm" and "pulse" oscillator types. + * See [[Oscillator.partials]] + */ + get partials() { + return this._oscillator.partials; + } + set partials(partials) { + if (!this._getOscType(this._oscillator, "pulse") && !this._getOscType(this._oscillator, "pwm")) { + this._oscillator.partials = partials; + } + } + get partialCount() { + return this._oscillator.partialCount; + } + set partialCount(partialCount) { + if (!this._getOscType(this._oscillator, "pulse") && !this._getOscType(this._oscillator, "pwm")) { + this._oscillator.partialCount = partialCount; + } + } + set(props) { + // make sure the type is set first + if (Reflect.has(props, "type") && props.type) { + this.type = props.type; + } + // then set the rest + super.set(props); + return this; + } + /** + * connect the oscillator to the frequency and detune signals + */ + _createNewOscillator(oscType) { + if (oscType !== this._sourceType) { + this._sourceType = oscType; + const OscConstructor = OmniOscillatorSourceMap[oscType]; + // short delay to avoid clicks on the change + const now = this.now(); + if (this._oscillator) { + const oldOsc = this._oscillator; + oldOsc.stop(now); + // dispose the old one + this.context.setTimeout(() => oldOsc.dispose(), this.blockTime); + } + this._oscillator = new OscConstructor({ + context: this.context, + }); + this.frequency.connect(this._oscillator.frequency); + this.detune.connect(this._oscillator.detune); + this._oscillator.connect(this.output); + this._oscillator.onstop = () => this.onstop(this); + if (this.state === "started") { + this._oscillator.start(now); + } + } + } + get phase() { + return this._oscillator.phase; + } + set phase(phase) { + this._oscillator.phase = phase; + } + /** + * The source type of the oscillator. + * @example + * const omniOsc = new Tone.OmniOscillator(440, "fmsquare"); + * console.log(omniOsc.sourceType); // 'fm' + */ + get sourceType() { + return this._sourceType; + } + set sourceType(sType) { + // the basetype defaults to sine + let baseType = "sine"; + if (this._oscillator.type !== "pwm" && this._oscillator.type !== "pulse") { + baseType = this._oscillator.type; + } + // set the type + if (sType === "fm") { + this.type = "fm" + baseType; + } + else if (sType === "am") { + this.type = "am" + baseType; + } + else if (sType === "fat") { + this.type = "fat" + baseType; + } + else if (sType === "oscillator") { + this.type = baseType; + } + else if (sType === "pulse") { + this.type = "pulse"; + } + else if (sType === "pwm") { + this.type = "pwm"; + } + } + _getOscType(osc, sourceType) { + return osc instanceof OmniOscillatorSourceMap[sourceType]; + } + /** + * The base type of the oscillator. See [[Oscillator.baseType]] + * @example + * const omniOsc = new Tone.OmniOscillator(440, "fmsquare4"); + * console.log(omniOsc.sourceType, omniOsc.baseType, omniOsc.partialCount); + */ + get baseType() { + return this._oscillator.baseType; + } + set baseType(baseType) { + if (!this._getOscType(this._oscillator, "pulse") && + !this._getOscType(this._oscillator, "pwm") && + baseType !== "pulse" && baseType !== "pwm") { + this._oscillator.baseType = baseType; + } + } + /** + * The width of the oscillator when sourceType === "pulse". + * See [[PWMOscillator.width]] + */ + get width() { + if (this._getOscType(this._oscillator, "pulse")) { + return this._oscillator.width; + } + else { + return undefined; + } + } + /** + * The number of detuned oscillators when sourceType === "fat". + * See [[FatOscillator.count]] + */ + get count() { + if (this._getOscType(this._oscillator, "fat")) { + return this._oscillator.count; + } + else { + return undefined; + } + } + set count(count) { + if (this._getOscType(this._oscillator, "fat") && isNumber(count)) { + this._oscillator.count = count; + } + } + /** + * The detune spread between the oscillators when sourceType === "fat". + * See [[FatOscillator.count]] + */ + get spread() { + if (this._getOscType(this._oscillator, "fat")) { + return this._oscillator.spread; + } + else { + return undefined; + } + } + set spread(spread) { + if (this._getOscType(this._oscillator, "fat") && isNumber(spread)) { + this._oscillator.spread = spread; + } + } + /** + * The type of the modulator oscillator. Only if the oscillator is set to "am" or "fm" types. + * See [[AMOscillator]] or [[FMOscillator]] + */ + get modulationType() { + if (this._getOscType(this._oscillator, "fm") || this._getOscType(this._oscillator, "am")) { + return this._oscillator.modulationType; + } + else { + return undefined; + } + } + set modulationType(mType) { + if ((this._getOscType(this._oscillator, "fm") || this._getOscType(this._oscillator, "am")) && isString(mType)) { + this._oscillator.modulationType = mType; + } + } + /** + * The modulation index when the sourceType === "fm" + * See [[FMOscillator]]. + */ + get modulationIndex() { + if (this._getOscType(this._oscillator, "fm")) { + return this._oscillator.modulationIndex; + } + else { + return undefined; + } + } + /** + * Harmonicity is the frequency ratio between the carrier and the modulator oscillators. + * See [[AMOscillator]] or [[FMOscillator]] + */ + get harmonicity() { + if (this._getOscType(this._oscillator, "fm") || this._getOscType(this._oscillator, "am")) { + return this._oscillator.harmonicity; + } + else { + return undefined; + } + } + /** + * The modulationFrequency Signal of the oscillator when sourceType === "pwm" + * see [[PWMOscillator]] + * @min 0.1 + * @max 5 + */ + get modulationFrequency() { + if (this._getOscType(this._oscillator, "pwm")) { + return this._oscillator.modulationFrequency; + } + else { + return undefined; + } + } + asArray(length = 1024) { + return __awaiter(this, void 0, void 0, function* () { + return generateWaveform(this, length); + }); + } + dispose() { + super.dispose(); + this.detune.dispose(); + this.frequency.dispose(); + this._oscillator.dispose(); + return this; + } +} + +/** + * Add a signal and a number or two signals. When no value is + * passed into the constructor, Tone.Add will sum input and `addend` + * If a value is passed into the constructor, the it will be added to the input. + * + * @example + * return Tone.Offline(() => { + * const add = new Tone.Add(2).toDestination(); + * add.addend.setValueAtTime(1, 0.2); + * const signal = new Tone.Signal(2); + * // add a signal and a scalar + * signal.connect(add); + * signal.setValueAtTime(1, 0.1); + * }, 0.5, 1); + * @category Signal + */ +class Add extends Signal { + constructor() { + super(Object.assign(optionsFromArguments(Add.getDefaults(), arguments, ["value"]))); + this.override = false; + this.name = "Add"; + /** + * the summing node + */ + this._sum = new Gain({ context: this.context }); + this.input = this._sum; + this.output = this._sum; + /** + * The value which is added to the input signal + */ + this.addend = this._param; + connectSeries(this._constantSource, this._sum); + } + static getDefaults() { + return Object.assign(Signal.getDefaults(), { + value: 0, + }); + } + dispose() { + super.dispose(); + this._sum.dispose(); + return this; + } +} + +/** + * Performs a linear scaling on an input signal. + * Scales a NormalRange input to between + * outputMin and outputMax. + * + * @example + * const scale = new Tone.Scale(50, 100); + * const signal = new Tone.Signal(0.5).connect(scale); + * // the output of scale equals 75 + * @category Signal + */ +class Scale extends SignalOperator { + constructor() { + super(Object.assign(optionsFromArguments(Scale.getDefaults(), arguments, ["min", "max"]))); + this.name = "Scale"; + const options = optionsFromArguments(Scale.getDefaults(), arguments, ["min", "max"]); + this._mult = this.input = new Multiply({ + context: this.context, + value: options.max - options.min, + }); + this._add = this.output = new Add({ + context: this.context, + value: options.min, + }); + this._min = options.min; + this._max = options.max; + this.input.connect(this.output); + } + static getDefaults() { + return Object.assign(SignalOperator.getDefaults(), { + max: 1, + min: 0, + }); + } + /** + * The minimum output value. This number is output when the value input value is 0. + */ + get min() { + return this._min; + } + set min(min) { + this._min = min; + this._setRange(); + } + /** + * The maximum output value. This number is output when the value input value is 1. + */ + get max() { + return this._max; + } + set max(max) { + this._max = max; + this._setRange(); + } + /** + * set the values + */ + _setRange() { + this._add.value = this._min; + this._mult.value = this._max - this._min; + } + dispose() { + super.dispose(); + this._add.dispose(); + this._mult.dispose(); + return this; + } +} + +/** + * Tone.Zero outputs 0's at audio-rate. The reason this has to be + * it's own class is that many browsers optimize out Tone.Signal + * with a value of 0 and will not process nodes further down the graph. + * @category Signal + */ +class Zero extends SignalOperator { + constructor() { + super(Object.assign(optionsFromArguments(Zero.getDefaults(), arguments))); + this.name = "Zero"; + /** + * The gain node which connects the constant source to the output + */ + this._gain = new Gain({ context: this.context }); + /** + * Only outputs 0 + */ + this.output = this._gain; + /** + * no input node + */ + this.input = undefined; + connect(this.context.getConstant(0), this._gain); + } + /** + * clean up + */ + dispose() { + super.dispose(); + disconnect(this.context.getConstant(0), this._gain); + return this; + } +} + +/** + * LFO stands for low frequency oscillator. LFO produces an output signal + * which can be attached to an AudioParam or Tone.Signal + * in order to modulate that parameter with an oscillator. The LFO can + * also be synced to the transport to start/stop and change when the tempo changes. + * @example + * return Tone.Offline(() => { + * const lfo = new Tone.LFO("4n", 400, 4000).start().toDestination(); + * }, 0.5, 1); + * @category Source + */ +class LFO extends ToneAudioNode { + constructor() { + super(optionsFromArguments(LFO.getDefaults(), arguments, ["frequency", "min", "max"])); + this.name = "LFO"; + /** + * The value that the LFO outputs when it's stopped + */ + this._stoppedValue = 0; + /** + * A private placeholder for the units + */ + this._units = "number"; + /** + * If the input value is converted using the [[units]] + */ + this.convert = true; + /** + * Private methods borrowed from Param + */ + // @ts-ignore + this._fromType = Param.prototype._fromType; + // @ts-ignore + this._toType = Param.prototype._toType; + // @ts-ignore + this._is = Param.prototype._is; + // @ts-ignore + this._clampValue = Param.prototype._clampValue; + const options = optionsFromArguments(LFO.getDefaults(), arguments, ["frequency", "min", "max"]); + this._oscillator = new Oscillator(options); + this.frequency = this._oscillator.frequency; + this._amplitudeGain = new Gain({ + context: this.context, + gain: options.amplitude, + units: "normalRange", + }); + this.amplitude = this._amplitudeGain.gain; + this._stoppedSignal = new Signal({ + context: this.context, + units: "audioRange", + value: 0, + }); + this._zeros = new Zero({ context: this.context }); + this._a2g = new AudioToGain({ context: this.context }); + this._scaler = this.output = new Scale({ + context: this.context, + max: options.max, + min: options.min, + }); + this.units = options.units; + this.min = options.min; + this.max = options.max; + // connect it up + this._oscillator.chain(this._amplitudeGain, this._a2g, this._scaler); + this._zeros.connect(this._a2g); + this._stoppedSignal.connect(this._a2g); + readOnly(this, ["amplitude", "frequency"]); + this.phase = options.phase; + } + static getDefaults() { + return Object.assign(Oscillator.getDefaults(), { + amplitude: 1, + frequency: "4n", + max: 1, + min: 0, + type: "sine", + units: "number", + }); + } + /** + * Start the LFO. + * @param time The time the LFO will start + */ + start(time) { + time = this.toSeconds(time); + this._stoppedSignal.setValueAtTime(0, time); + this._oscillator.start(time); + return this; + } + /** + * Stop the LFO. + * @param time The time the LFO will stop + */ + stop(time) { + time = this.toSeconds(time); + this._stoppedSignal.setValueAtTime(this._stoppedValue, time); + this._oscillator.stop(time); + return this; + } + /** + * Sync the start/stop/pause to the transport + * and the frequency to the bpm of the transport + * @example + * const lfo = new Tone.LFO("8n"); + * lfo.sync().start(0); + * // the rate of the LFO will always be an eighth note, even as the tempo changes + */ + sync() { + this._oscillator.sync(); + this._oscillator.syncFrequency(); + return this; + } + /** + * unsync the LFO from transport control + */ + unsync() { + this._oscillator.unsync(); + this._oscillator.unsyncFrequency(); + return this; + } + /** + * After the oscillator waveform is updated, reset the `_stoppedSignal` value to match the updated waveform + */ + _setStoppedValue() { + this._stoppedValue = this._oscillator.getInitialValue(); + this._stoppedSignal.value = this._stoppedValue; + } + /** + * The minimum output of the LFO. + */ + get min() { + return this._toType(this._scaler.min); + } + set min(min) { + min = this._fromType(min); + this._scaler.min = min; + } + /** + * The maximum output of the LFO. + */ + get max() { + return this._toType(this._scaler.max); + } + set max(max) { + max = this._fromType(max); + this._scaler.max = max; + } + /** + * The type of the oscillator: See [[Oscillator.type]] + */ + get type() { + return this._oscillator.type; + } + set type(type) { + this._oscillator.type = type; + this._setStoppedValue(); + } + /** + * The oscillator's partials array: See [[Oscillator.partials]] + */ + get partials() { + return this._oscillator.partials; + } + set partials(partials) { + this._oscillator.partials = partials; + this._setStoppedValue(); + } + /** + * The phase of the LFO. + */ + get phase() { + return this._oscillator.phase; + } + set phase(phase) { + this._oscillator.phase = phase; + this._setStoppedValue(); + } + /** + * The output units of the LFO. + */ + get units() { + return this._units; + } + set units(val) { + const currentMin = this.min; + const currentMax = this.max; + // convert the min and the max + this._units = val; + this.min = currentMin; + this.max = currentMax; + } + /** + * Returns the playback state of the source, either "started" or "stopped". + */ + get state() { + return this._oscillator.state; + } + /** + * @param node the destination to connect to + * @param outputNum the optional output number + * @param inputNum the input number + */ + connect(node, outputNum, inputNum) { + if (node instanceof Param || node instanceof Signal) { + this.convert = node.convert; + this.units = node.units; + } + connectSignal(this, node, outputNum, inputNum); + return this; + } + dispose() { + super.dispose(); + this._oscillator.dispose(); + this._stoppedSignal.dispose(); + this._zeros.dispose(); + this._scaler.dispose(); + this._a2g.dispose(); + this._amplitudeGain.dispose(); + this.amplitude.dispose(); + return this; + } +} + +/** + * Assert that the number is in the given range. + */ +function range(min, max = Infinity) { + const valueMap = new WeakMap(); + return function (target, propertyKey) { + Reflect.defineProperty(target, propertyKey, { + configurable: true, + enumerable: true, + get: function () { + return valueMap.get(this); + }, + set: function (newValue) { + assertRange(newValue, min, max); + valueMap.set(this, newValue); + } + }); + }; +} +/** + * Convert the time to seconds and assert that the time is in between the two + * values when being set. + */ +function timeRange(min, max = Infinity) { + const valueMap = new WeakMap(); + return function (target, propertyKey) { + Reflect.defineProperty(target, propertyKey, { + configurable: true, + enumerable: true, + get: function () { + return valueMap.get(this); + }, + set: function (newValue) { + assertRange(this.toSeconds(newValue), min, max); + valueMap.set(this, newValue); + } + }); + }; +} + +/** + * Player is an audio file player with start, loop, and stop functions. + * @example + * const player = new Tone.Player("https://tonejs.github.io/audio/berklee/gong_1.mp3").toDestination(); + * // play as soon as the buffer is loaded + * player.autostart = true; + * @category Source + */ +class Player extends Source { + constructor() { + super(optionsFromArguments(Player.getDefaults(), arguments, ["url", "onload"])); + this.name = "Player"; + /** + * All of the active buffer source nodes + */ + this._activeSources = new Set(); + const options = optionsFromArguments(Player.getDefaults(), arguments, ["url", "onload"]); + this._buffer = new ToneAudioBuffer({ + onload: this._onload.bind(this, options.onload), + onerror: options.onerror, + reverse: options.reverse, + url: options.url, + }); + this.autostart = options.autostart; + this._loop = options.loop; + this._loopStart = options.loopStart; + this._loopEnd = options.loopEnd; + this._playbackRate = options.playbackRate; + this.fadeIn = options.fadeIn; + this.fadeOut = options.fadeOut; + } + static getDefaults() { + return Object.assign(Source.getDefaults(), { + autostart: false, + fadeIn: 0, + fadeOut: 0, + loop: false, + loopEnd: 0, + loopStart: 0, + onload: noOp, + onerror: noOp, + playbackRate: 1, + reverse: false, + }); + } + /** + * Load the audio file as an audio buffer. + * Decodes the audio asynchronously and invokes + * the callback once the audio buffer loads. + * Note: this does not need to be called if a url + * was passed in to the constructor. Only use this + * if you want to manually load a new url. + * @param url The url of the buffer to load. Filetype support depends on the browser. + */ + load(url) { + return __awaiter(this, void 0, void 0, function* () { + yield this._buffer.load(url); + this._onload(); + return this; + }); + } + /** + * Internal callback when the buffer is loaded. + */ + _onload(callback = noOp) { + callback(); + if (this.autostart) { + this.start(); + } + } + /** + * Internal callback when the buffer is done playing. + */ + _onSourceEnd(source) { + // invoke the onstop function + this.onstop(this); + // delete the source from the active sources + this._activeSources.delete(source); + if (this._activeSources.size === 0 && !this._synced && + this._state.getValueAtTime(this.now()) === "started") { + // remove the 'implicitEnd' event and replace with an explicit end + this._state.cancel(this.now()); + this._state.setStateAtTime("stopped", this.now()); + } + } + /** + * Play the buffer at the given startTime. Optionally add an offset + * and/or duration which will play the buffer from a position + * within the buffer for the given duration. + * + * @param time When the player should start. + * @param offset The offset from the beginning of the sample to start at. + * @param duration How long the sample should play. If no duration is given, it will default to the full length of the sample (minus any offset) + */ + start(time, offset, duration) { + super.start(time, offset, duration); + return this; + } + /** + * Internal start method + */ + _start(startTime, offset, duration) { + // if it's a loop the default offset is the loopStart point + if (this._loop) { + offset = defaultArg(offset, this._loopStart); + } + else { + // otherwise the default offset is 0 + offset = defaultArg(offset, 0); + } + // compute the values in seconds + const computedOffset = this.toSeconds(offset); + // compute the duration which is either the passed in duration of the buffer.duration - offset + const origDuration = duration; + duration = defaultArg(duration, Math.max(this._buffer.duration - computedOffset, 0)); + let computedDuration = this.toSeconds(duration); + // scale it by the playback rate + computedDuration = computedDuration / this._playbackRate; + // get the start time + startTime = this.toSeconds(startTime); + // make the source + const source = new ToneBufferSource({ + url: this._buffer, + context: this.context, + fadeIn: this.fadeIn, + fadeOut: this.fadeOut, + loop: this._loop, + loopEnd: this._loopEnd, + loopStart: this._loopStart, + onended: this._onSourceEnd.bind(this), + playbackRate: this._playbackRate, + }).connect(this.output); + // set the looping properties + if (!this._loop && !this._synced) { + // cancel the previous stop + this._state.cancel(startTime + computedDuration); + // if it's not looping, set the state change at the end of the sample + this._state.setStateAtTime("stopped", startTime + computedDuration, { + implicitEnd: true, + }); + } + // add it to the array of active sources + this._activeSources.add(source); + // start it + if (this._loop && isUndef(origDuration)) { + source.start(startTime, computedOffset); + } + else { + // subtract the fade out time + source.start(startTime, computedOffset, computedDuration - this.toSeconds(this.fadeOut)); + } + } + /** + * Stop playback. + */ + _stop(time) { + const computedTime = this.toSeconds(time); + this._activeSources.forEach(source => source.stop(computedTime)); + } + /** + * Stop and then restart the player from the beginning (or offset) + * @param time When the player should start. + * @param offset The offset from the beginning of the sample to start at. + * @param duration How long the sample should play. If no duration is given, + * it will default to the full length of the sample (minus any offset) + */ + restart(time, offset, duration) { + super.restart(time, offset, duration); + return this; + } + _restart(time, offset, duration) { + this._stop(time); + this._start(time, offset, duration); + } + /** + * Seek to a specific time in the player's buffer. If the + * source is no longer playing at that time, it will stop. + * @param offset The time to seek to. + * @param when The time for the seek event to occur. + * @example + * const player = new Tone.Player("https://tonejs.github.io/audio/berklee/gurgling_theremin_1.mp3", () => { + * player.start(); + * // seek to the offset in 1 second from now + * player.seek(0.4, "+1"); + * }).toDestination(); + */ + seek(offset, when) { + const computedTime = this.toSeconds(when); + if (this._state.getValueAtTime(computedTime) === "started") { + const computedOffset = this.toSeconds(offset); + // if it's currently playing, stop it + this._stop(computedTime); + // restart it at the given time + this._start(computedTime, computedOffset); + } + return this; + } + /** + * Set the loop start and end. Will only loop if loop is set to true. + * @param loopStart The loop start time + * @param loopEnd The loop end time + * @example + * const player = new Tone.Player("https://tonejs.github.io/audio/berklee/malevoices_aa2_F3.mp3").toDestination(); + * // loop between the given points + * player.setLoopPoints(0.2, 0.3); + * player.loop = true; + * player.autostart = true; + */ + setLoopPoints(loopStart, loopEnd) { + this.loopStart = loopStart; + this.loopEnd = loopEnd; + return this; + } + /** + * If loop is true, the loop will start at this position. + */ + get loopStart() { + return this._loopStart; + } + set loopStart(loopStart) { + this._loopStart = loopStart; + if (this.buffer.loaded) { + assertRange(this.toSeconds(loopStart), 0, this.buffer.duration); + } + // get the current source + this._activeSources.forEach(source => { + source.loopStart = loopStart; + }); + } + /** + * If loop is true, the loop will end at this position. + */ + get loopEnd() { + return this._loopEnd; + } + set loopEnd(loopEnd) { + this._loopEnd = loopEnd; + if (this.buffer.loaded) { + assertRange(this.toSeconds(loopEnd), 0, this.buffer.duration); + } + // get the current source + this._activeSources.forEach(source => { + source.loopEnd = loopEnd; + }); + } + /** + * The audio buffer belonging to the player. + */ + get buffer() { + return this._buffer; + } + set buffer(buffer) { + this._buffer.set(buffer); + } + /** + * If the buffer should loop once it's over. + * @example + * const player = new Tone.Player("https://tonejs.github.io/audio/drum-samples/breakbeat.mp3").toDestination(); + * player.loop = true; + * player.autostart = true; + */ + get loop() { + return this._loop; + } + set loop(loop) { + // if no change, do nothing + if (this._loop === loop) { + return; + } + this._loop = loop; + // set the loop of all of the sources + this._activeSources.forEach(source => { + source.loop = loop; + }); + if (loop) { + // remove the next stopEvent + const stopEvent = this._state.getNextState("stopped", this.now()); + if (stopEvent) { + this._state.cancel(stopEvent.time); + } + } + } + /** + * Normal speed is 1. The pitch will change with the playback rate. + * @example + * const player = new Tone.Player("https://tonejs.github.io/audio/berklee/femalevoices_aa2_A5.mp3").toDestination(); + * // play at 1/4 speed + * player.playbackRate = 0.25; + * // play as soon as the buffer is loaded + * player.autostart = true; + */ + get playbackRate() { + return this._playbackRate; + } + set playbackRate(rate) { + this._playbackRate = rate; + const now = this.now(); + // cancel the stop event since it's at a different time now + const stopEvent = this._state.getNextState("stopped", now); + if (stopEvent && stopEvent.implicitEnd) { + this._state.cancel(stopEvent.time); + this._activeSources.forEach(source => source.cancelStop()); + } + // set all the sources + this._activeSources.forEach(source => { + source.playbackRate.setValueAtTime(rate, now); + }); + } + /** + * If the buffer should be reversed + * @example + * const player = new Tone.Player("https://tonejs.github.io/audio/berklee/chime_1.mp3").toDestination(); + * player.autostart = true; + * player.reverse = true; + */ + get reverse() { + return this._buffer.reverse; + } + set reverse(rev) { + this._buffer.reverse = rev; + } + /** + * If the buffer is loaded + */ + get loaded() { + return this._buffer.loaded; + } + dispose() { + super.dispose(); + // disconnect all of the players + this._activeSources.forEach(source => source.dispose()); + this._activeSources.clear(); + this._buffer.dispose(); + return this; + } +} +__decorate([ + timeRange(0) +], Player.prototype, "fadeIn", void 0); +__decorate([ + timeRange(0) +], Player.prototype, "fadeOut", void 0); + +/** + * Players combines multiple [[Player]] objects. + * @category Source + */ +class Players extends ToneAudioNode { + constructor() { + super(optionsFromArguments(Players.getDefaults(), arguments, ["urls", "onload"], "urls")); + this.name = "Players"; + /** + * Players has no input. + */ + this.input = undefined; + /** + * The container of all of the players + */ + this._players = new Map(); + const options = optionsFromArguments(Players.getDefaults(), arguments, ["urls", "onload"], "urls"); + /** + * The output volume node + */ + this._volume = this.output = new Volume({ + context: this.context, + volume: options.volume, + }); + this.volume = this._volume.volume; + readOnly(this, "volume"); + this._buffers = new ToneAudioBuffers({ + urls: options.urls, + onload: options.onload, + baseUrl: options.baseUrl, + onerror: options.onerror + }); + // mute initially + this.mute = options.mute; + this._fadeIn = options.fadeIn; + this._fadeOut = options.fadeOut; + } + static getDefaults() { + return Object.assign(Source.getDefaults(), { + baseUrl: "", + fadeIn: 0, + fadeOut: 0, + mute: false, + onload: noOp, + onerror: noOp, + urls: {}, + volume: 0, + }); + } + /** + * Mute the output. + */ + get mute() { + return this._volume.mute; + } + set mute(mute) { + this._volume.mute = mute; + } + /** + * The fadeIn time of the envelope applied to the source. + */ + get fadeIn() { + return this._fadeIn; + } + set fadeIn(fadeIn) { + this._fadeIn = fadeIn; + this._players.forEach(player => { + player.fadeIn = fadeIn; + }); + } + /** + * The fadeOut time of the each of the sources. + */ + get fadeOut() { + return this._fadeOut; + } + set fadeOut(fadeOut) { + this._fadeOut = fadeOut; + this._players.forEach(player => { + player.fadeOut = fadeOut; + }); + } + /** + * The state of the players object. Returns "started" if any of the players are playing. + */ + get state() { + const playing = Array.from(this._players).some(([_, player]) => player.state === "started"); + return playing ? "started" : "stopped"; + } + /** + * True if the buffers object has a buffer by that name. + * @param name The key or index of the buffer. + */ + has(name) { + return this._buffers.has(name); + } + /** + * Get a player by name. + * @param name The players name as defined in the constructor object or `add` method. + */ + player(name) { + assert(this.has(name), `No Player with the name ${name} exists on this object`); + if (!this._players.has(name)) { + const player = new Player({ + context: this.context, + fadeIn: this._fadeIn, + fadeOut: this._fadeOut, + url: this._buffers.get(name), + }).connect(this.output); + this._players.set(name, player); + } + return this._players.get(name); + } + /** + * If all the buffers are loaded or not + */ + get loaded() { + return this._buffers.loaded; + } + /** + * Add a player by name and url to the Players + * @param name A unique name to give the player + * @param url Either the url of the bufer or a buffer which will be added with the given name. + * @param callback The callback to invoke when the url is loaded. + */ + add(name, url, callback) { + assert(!this._buffers.has(name), "A buffer with that name already exists on this object"); + this._buffers.add(name, url, callback); + return this; + } + /** + * Stop all of the players at the given time + * @param time The time to stop all of the players. + */ + stopAll(time) { + this._players.forEach(player => player.stop(time)); + return this; + } + dispose() { + super.dispose(); + this._volume.dispose(); + this.volume.dispose(); + this._players.forEach(player => player.dispose()); + this._buffers.dispose(); + return this; + } +} + +/** + * GrainPlayer implements [granular synthesis](https://en.wikipedia.org/wiki/Granular_synthesis). + * Granular Synthesis enables you to adjust pitch and playback rate independently. The grainSize is the + * amount of time each small chunk of audio is played for and the overlap is the + * amount of crossfading transition time between successive grains. + * @category Source + */ +class GrainPlayer extends Source { + constructor() { + super(optionsFromArguments(GrainPlayer.getDefaults(), arguments, ["url", "onload"])); + this.name = "GrainPlayer"; + /** + * Internal loopStart value + */ + this._loopStart = 0; + /** + * Internal loopStart value + */ + this._loopEnd = 0; + /** + * All of the currently playing BufferSources + */ + this._activeSources = []; + const options = optionsFromArguments(GrainPlayer.getDefaults(), arguments, ["url", "onload"]); + this.buffer = new ToneAudioBuffer({ + onload: options.onload, + onerror: options.onerror, + reverse: options.reverse, + url: options.url, + }); + this._clock = new Clock({ + context: this.context, + callback: this._tick.bind(this), + frequency: 1 / options.grainSize + }); + this._playbackRate = options.playbackRate; + this._grainSize = options.grainSize; + this._overlap = options.overlap; + this.detune = options.detune; + // setup + this.overlap = options.overlap; + this.loop = options.loop; + this.playbackRate = options.playbackRate; + this.grainSize = options.grainSize; + this.loopStart = options.loopStart; + this.loopEnd = options.loopEnd; + this.reverse = options.reverse; + this._clock.on("stop", this._onstop.bind(this)); + } + static getDefaults() { + return Object.assign(Source.getDefaults(), { + onload: noOp, + onerror: noOp, + overlap: 0.1, + grainSize: 0.2, + playbackRate: 1, + detune: 0, + loop: false, + loopStart: 0, + loopEnd: 0, + reverse: false + }); + } + /** + * Internal start method + */ + _start(time, offset, duration) { + offset = defaultArg(offset, 0); + offset = this.toSeconds(offset); + time = this.toSeconds(time); + const grainSize = 1 / this._clock.frequency.getValueAtTime(time); + this._clock.start(time, offset / grainSize); + if (duration) { + this.stop(time + this.toSeconds(duration)); + } + } + /** + * Stop and then restart the player from the beginning (or offset) + * @param time When the player should start. + * @param offset The offset from the beginning of the sample to start at. + * @param duration How long the sample should play. If no duration is given, + * it will default to the full length of the sample (minus any offset) + */ + restart(time, offset, duration) { + super.restart(time, offset, duration); + return this; + } + _restart(time, offset, duration) { + this._stop(time); + this._start(time, offset, duration); + } + /** + * Internal stop method + */ + _stop(time) { + this._clock.stop(time); + } + /** + * Invoked when the clock is stopped + */ + _onstop(time) { + // stop the players + this._activeSources.forEach((source) => { + source.fadeOut = 0; + source.stop(time); + }); + this.onstop(this); + } + /** + * Invoked on each clock tick. scheduled a new grain at this time. + */ + _tick(time) { + // check if it should stop looping + const ticks = this._clock.getTicksAtTime(time); + const offset = ticks * this._grainSize; + this.log("offset", offset); + if (!this.loop && offset > this.buffer.duration) { + this.stop(time); + return; + } + // at the beginning of the file, the fade in should be 0 + const fadeIn = offset < this._overlap ? 0 : this._overlap; + // create a buffer source + const source = new ToneBufferSource({ + context: this.context, + url: this.buffer, + fadeIn: fadeIn, + fadeOut: this._overlap, + loop: this.loop, + loopStart: this._loopStart, + loopEnd: this._loopEnd, + // compute the playbackRate based on the detune + playbackRate: intervalToFrequencyRatio(this.detune / 100) + }).connect(this.output); + source.start(time, this._grainSize * ticks); + source.stop(time + this._grainSize / this.playbackRate); + // add it to the active sources + this._activeSources.push(source); + // remove it when it's done + source.onended = () => { + const index = this._activeSources.indexOf(source); + if (index !== -1) { + this._activeSources.splice(index, 1); + } + }; + } + /** + * The playback rate of the sample + */ + get playbackRate() { + return this._playbackRate; + } + set playbackRate(rate) { + assertRange(rate, 0.001); + this._playbackRate = rate; + this.grainSize = this._grainSize; + } + /** + * The loop start time. + */ + get loopStart() { + return this._loopStart; + } + set loopStart(time) { + if (this.buffer.loaded) { + assertRange(this.toSeconds(time), 0, this.buffer.duration); + } + this._loopStart = this.toSeconds(time); + } + /** + * The loop end time. + */ + get loopEnd() { + return this._loopEnd; + } + set loopEnd(time) { + if (this.buffer.loaded) { + assertRange(this.toSeconds(time), 0, this.buffer.duration); + } + this._loopEnd = this.toSeconds(time); + } + /** + * The direction the buffer should play in + */ + get reverse() { + return this.buffer.reverse; + } + set reverse(rev) { + this.buffer.reverse = rev; + } + /** + * The size of each chunk of audio that the + * buffer is chopped into and played back at. + */ + get grainSize() { + return this._grainSize; + } + set grainSize(size) { + this._grainSize = this.toSeconds(size); + this._clock.frequency.setValueAtTime(this._playbackRate / this._grainSize, this.now()); + } + /** + * The duration of the cross-fade between successive grains. + */ + get overlap() { + return this._overlap; + } + set overlap(time) { + const computedTime = this.toSeconds(time); + assertRange(computedTime, 0); + this._overlap = computedTime; + } + /** + * If all the buffer is loaded + */ + get loaded() { + return this.buffer.loaded; + } + dispose() { + super.dispose(); + this.buffer.dispose(); + this._clock.dispose(); + this._activeSources.forEach((source) => source.dispose()); + return this; + } +} + +/** + * Return the absolute value of an incoming signal. + * + * @example + * return Tone.Offline(() => { + * const abs = new Tone.Abs().toDestination(); + * const signal = new Tone.Signal(1); + * signal.rampTo(-1, 0.5); + * signal.connect(abs); + * }, 0.5, 1); + * @category Signal + */ +class Abs extends SignalOperator { + constructor() { + super(...arguments); + this.name = "Abs"; + /** + * The node which converts the audio ranges + */ + this._abs = new WaveShaper({ + context: this.context, + mapping: val => { + if (Math.abs(val) < 0.001) { + return 0; + } + else { + return Math.abs(val); + } + }, + }); + /** + * The AudioRange input [-1, 1] + */ + this.input = this._abs; + /** + * The output range [0, 1] + */ + this.output = this._abs; + } + /** + * clean up + */ + dispose() { + super.dispose(); + this._abs.dispose(); + return this; + } +} + +/** + * GainToAudio converts an input in NormalRange [0,1] to AudioRange [-1,1]. + * See [[AudioToGain]]. + * @category Signal + */ +class GainToAudio extends SignalOperator { + constructor() { + super(...arguments); + this.name = "GainToAudio"; + /** + * The node which converts the audio ranges + */ + this._norm = new WaveShaper({ + context: this.context, + mapping: x => Math.abs(x) * 2 - 1, + }); + /** + * The NormalRange input [0, 1] + */ + this.input = this._norm; + /** + * The AudioRange output [-1, 1] + */ + this.output = this._norm; + } + /** + * clean up + */ + dispose() { + super.dispose(); + this._norm.dispose(); + return this; + } +} + +/** + * Negate the incoming signal. i.e. an input signal of 10 will output -10 + * + * @example + * const neg = new Tone.Negate(); + * const sig = new Tone.Signal(-2).connect(neg); + * // output of neg is positive 2. + * @category Signal + */ +class Negate extends SignalOperator { + constructor() { + super(...arguments); + this.name = "Negate"; + /** + * negation is done by multiplying by -1 + */ + this._multiply = new Multiply({ + context: this.context, + value: -1, + }); + /** + * The input and output are equal to the multiply node + */ + this.input = this._multiply; + this.output = this._multiply; + } + /** + * clean up + * @returns {Negate} this + */ + dispose() { + super.dispose(); + this._multiply.dispose(); + return this; + } +} + +/** + * Subtract the signal connected to the input is subtracted from the signal connected + * The subtrahend. + * + * @example + * // subtract a scalar from a signal + * const sub = new Tone.Subtract(1); + * const sig = new Tone.Signal(4).connect(sub); + * // the output of sub is 3. + * @example + * // subtract two signals + * const sub = new Tone.Subtract(); + * const sigA = new Tone.Signal(10); + * const sigB = new Tone.Signal(2.5); + * sigA.connect(sub); + * sigB.connect(sub.subtrahend); + * // output of sub is 7.5 + * @category Signal + */ +class Subtract extends Signal { + constructor() { + super(Object.assign(optionsFromArguments(Subtract.getDefaults(), arguments, ["value"]))); + this.override = false; + this.name = "Subtract"; + /** + * the summing node + */ + this._sum = new Gain({ context: this.context }); + this.input = this._sum; + this.output = this._sum; + /** + * Negate the input of the second input before connecting it to the summing node. + */ + this._neg = new Negate({ context: this.context }); + /** + * The value which is subtracted from the main signal + */ + this.subtrahend = this._param; + connectSeries(this._constantSource, this._neg, this._sum); + } + static getDefaults() { + return Object.assign(Signal.getDefaults(), { + value: 0, + }); + } + dispose() { + super.dispose(); + this._neg.dispose(); + this._sum.dispose(); + return this; + } +} + +/** + * GreaterThanZero outputs 1 when the input is strictly greater than zero + * @example + * return Tone.Offline(() => { + * const gt0 = new Tone.GreaterThanZero().toDestination(); + * const sig = new Tone.Signal(0.5).connect(gt0); + * sig.setValueAtTime(-1, 0.05); + * }, 0.1, 1); + * @category Signal + */ +class GreaterThanZero extends SignalOperator { + constructor() { + super(Object.assign(optionsFromArguments(GreaterThanZero.getDefaults(), arguments))); + this.name = "GreaterThanZero"; + this._thresh = this.output = new WaveShaper({ + context: this.context, + length: 127, + mapping: (val) => { + if (val <= 0) { + return 0; + } + else { + return 1; + } + }, + }); + this._scale = this.input = new Multiply({ + context: this.context, + value: 10000 + }); + // connections + this._scale.connect(this._thresh); + } + dispose() { + super.dispose(); + this._scale.dispose(); + this._thresh.dispose(); + return this; + } +} + +/** + * Output 1 if the signal is greater than the value, otherwise outputs 0. + * can compare two signals or a signal and a number. + * + * @example + * return Tone.Offline(() => { + * const gt = new Tone.GreaterThan(2).toDestination(); + * const sig = new Tone.Signal(4).connect(gt); + * }, 0.1, 1); + * @category Signal + */ +class GreaterThan extends Signal { + constructor() { + super(Object.assign(optionsFromArguments(GreaterThan.getDefaults(), arguments, ["value"]))); + this.name = "GreaterThan"; + this.override = false; + const options = optionsFromArguments(GreaterThan.getDefaults(), arguments, ["value"]); + this._subtract = this.input = new Subtract({ + context: this.context, + value: options.value + }); + this._gtz = this.output = new GreaterThanZero({ context: this.context }); + this.comparator = this._param = this._subtract.subtrahend; + readOnly(this, "comparator"); + // connect + this._subtract.connect(this._gtz); + } + static getDefaults() { + return Object.assign(Signal.getDefaults(), { + value: 0, + }); + } + dispose() { + super.dispose(); + this._gtz.dispose(); + this._subtract.dispose(); + this.comparator.dispose(); + return this; + } +} + +/** + * Pow applies an exponent to the incoming signal. The incoming signal must be AudioRange [-1, 1] + * + * @example + * const pow = new Tone.Pow(2); + * const sig = new Tone.Signal(0.5).connect(pow); + * // output of pow is 0.25. + * @category Signal + */ +class Pow extends SignalOperator { + constructor() { + super(Object.assign(optionsFromArguments(Pow.getDefaults(), arguments, ["value"]))); + this.name = "Pow"; + const options = optionsFromArguments(Pow.getDefaults(), arguments, ["value"]); + this._exponentScaler = this.input = this.output = new WaveShaper({ + context: this.context, + mapping: this._expFunc(options.value), + length: 8192, + }); + this._exponent = options.value; + } + static getDefaults() { + return Object.assign(SignalOperator.getDefaults(), { + value: 1, + }); + } + /** + * the function which maps the waveshaper + * @param exponent exponent value + */ + _expFunc(exponent) { + return (val) => { + return Math.pow(Math.abs(val), exponent); + }; + } + /** + * The value of the exponent. + */ + get value() { + return this._exponent; + } + set value(exponent) { + this._exponent = exponent; + this._exponentScaler.setMap(this._expFunc(this._exponent)); + } + /** + * Clean up. + */ + dispose() { + super.dispose(); + this._exponentScaler.dispose(); + return this; + } +} + +/** + * Performs an exponential scaling on an input signal. + * Scales a NormalRange value [0,1] exponentially + * to the output range of outputMin to outputMax. + * @example + * const scaleExp = new Tone.ScaleExp(0, 100, 2); + * const signal = new Tone.Signal(0.5).connect(scaleExp); + * @category Signal + */ +class ScaleExp extends Scale { + constructor() { + super(Object.assign(optionsFromArguments(ScaleExp.getDefaults(), arguments, ["min", "max", "exponent"]))); + this.name = "ScaleExp"; + const options = optionsFromArguments(ScaleExp.getDefaults(), arguments, ["min", "max", "exponent"]); + this.input = this._exp = new Pow({ + context: this.context, + value: options.exponent, + }); + this._exp.connect(this._mult); + } + static getDefaults() { + return Object.assign(Scale.getDefaults(), { + exponent: 1, + }); + } + /** + * Instead of interpolating linearly between the [[min]] and + * [[max]] values, setting the exponent will interpolate between + * the two values with an exponential curve. + */ + get exponent() { + return this._exp.value; + } + set exponent(exp) { + this._exp.value = exp; + } + dispose() { + super.dispose(); + this._exp.dispose(); + return this; + } +} + +/** + * Adds the ability to synchronize the signal to the [[Transport]] + */ +class SyncedSignal extends Signal { + constructor() { + super(optionsFromArguments(Signal.getDefaults(), arguments, ["value", "units"])); + this.name = "SyncedSignal"; + /** + * Don't override when something is connected to the input + */ + this.override = false; + const options = optionsFromArguments(Signal.getDefaults(), arguments, ["value", "units"]); + this._lastVal = options.value; + this._synced = this.context.transport.scheduleRepeat(this._onTick.bind(this), "1i"); + this._syncedCallback = this._anchorValue.bind(this); + this.context.transport.on("start", this._syncedCallback); + this.context.transport.on("pause", this._syncedCallback); + this.context.transport.on("stop", this._syncedCallback); + // disconnect the constant source from the output and replace it with another one + this._constantSource.disconnect(); + this._constantSource.stop(0); + // create a new one + this._constantSource = this.output = new ToneConstantSource({ + context: this.context, + offset: options.value, + units: options.units, + }).start(0); + this.setValueAtTime(options.value, 0); + } + /** + * Callback which is invoked every tick. + */ + _onTick(time) { + const val = super.getValueAtTime(this.context.transport.seconds); + // approximate ramp curves with linear ramps + if (this._lastVal !== val) { + this._lastVal = val; + this._constantSource.offset.setValueAtTime(val, time); + } + } + /** + * Anchor the value at the start and stop of the Transport + */ + _anchorValue(time) { + const val = super.getValueAtTime(this.context.transport.seconds); + this._lastVal = val; + this._constantSource.offset.cancelAndHoldAtTime(time); + this._constantSource.offset.setValueAtTime(val, time); + } + getValueAtTime(time) { + const computedTime = new TransportTimeClass(this.context, time).toSeconds(); + return super.getValueAtTime(computedTime); + } + setValueAtTime(value, time) { + const computedTime = new TransportTimeClass(this.context, time).toSeconds(); + super.setValueAtTime(value, computedTime); + return this; + } + linearRampToValueAtTime(value, time) { + const computedTime = new TransportTimeClass(this.context, time).toSeconds(); + super.linearRampToValueAtTime(value, computedTime); + return this; + } + exponentialRampToValueAtTime(value, time) { + const computedTime = new TransportTimeClass(this.context, time).toSeconds(); + super.exponentialRampToValueAtTime(value, computedTime); + return this; + } + setTargetAtTime(value, startTime, timeConstant) { + const computedTime = new TransportTimeClass(this.context, startTime).toSeconds(); + super.setTargetAtTime(value, computedTime, timeConstant); + return this; + } + cancelScheduledValues(startTime) { + const computedTime = new TransportTimeClass(this.context, startTime).toSeconds(); + super.cancelScheduledValues(computedTime); + return this; + } + setValueCurveAtTime(values, startTime, duration, scaling) { + const computedTime = new TransportTimeClass(this.context, startTime).toSeconds(); + duration = this.toSeconds(duration); + super.setValueCurveAtTime(values, computedTime, duration, scaling); + return this; + } + cancelAndHoldAtTime(time) { + const computedTime = new TransportTimeClass(this.context, time).toSeconds(); + super.cancelAndHoldAtTime(computedTime); + return this; + } + setRampPoint(time) { + const computedTime = new TransportTimeClass(this.context, time).toSeconds(); + super.setRampPoint(computedTime); + return this; + } + exponentialRampTo(value, rampTime, startTime) { + const computedTime = new TransportTimeClass(this.context, startTime).toSeconds(); + super.exponentialRampTo(value, rampTime, computedTime); + return this; + } + linearRampTo(value, rampTime, startTime) { + const computedTime = new TransportTimeClass(this.context, startTime).toSeconds(); + super.linearRampTo(value, rampTime, computedTime); + return this; + } + targetRampTo(value, rampTime, startTime) { + const computedTime = new TransportTimeClass(this.context, startTime).toSeconds(); + super.targetRampTo(value, rampTime, computedTime); + return this; + } + dispose() { + super.dispose(); + this.context.transport.clear(this._synced); + this.context.transport.off("start", this._syncedCallback); + this.context.transport.off("pause", this._syncedCallback); + this.context.transport.off("stop", this._syncedCallback); + this._constantSource.dispose(); + return this; + } +} + +/** + * Envelope is an [ADSR](https://en.wikipedia.org/wiki/Synthesizer#ADSR_envelope) + * envelope generator. Envelope outputs a signal which + * can be connected to an AudioParam or Tone.Signal. + * ``` + * /\ + * / \ + * / \ + * / \ + * / \___________ + * / \ + * / \ + * / \ + * / \ + * ``` + * @example + * return Tone.Offline(() => { + * const env = new Tone.Envelope({ + * attack: 0.1, + * decay: 0.2, + * sustain: 0.5, + * release: 0.8, + * }).toDestination(); + * env.triggerAttackRelease(0.5); + * }, 1.5, 1); + * @category Component + */ +class Envelope extends ToneAudioNode { + constructor() { + super(optionsFromArguments(Envelope.getDefaults(), arguments, ["attack", "decay", "sustain", "release"])); + this.name = "Envelope"; + /** + * the signal which is output. + */ + this._sig = new Signal({ + context: this.context, + value: 0, + }); + /** + * The output signal of the envelope + */ + this.output = this._sig; + /** + * Envelope has no input + */ + this.input = undefined; + const options = optionsFromArguments(Envelope.getDefaults(), arguments, ["attack", "decay", "sustain", "release"]); + this.attack = options.attack; + this.decay = options.decay; + this.sustain = options.sustain; + this.release = options.release; + this.attackCurve = options.attackCurve; + this.releaseCurve = options.releaseCurve; + this.decayCurve = options.decayCurve; + } + static getDefaults() { + return Object.assign(ToneAudioNode.getDefaults(), { + attack: 0.01, + attackCurve: "linear", + decay: 0.1, + decayCurve: "exponential", + release: 1, + releaseCurve: "exponential", + sustain: 0.5, + }); + } + /** + * Read the current value of the envelope. Useful for + * synchronizing visual output to the envelope. + */ + get value() { + return this.getValueAtTime(this.now()); + } + /** + * Get the curve + * @param curve + * @param direction In/Out + * @return The curve name + */ + _getCurve(curve, direction) { + if (isString(curve)) { + return curve; + } + else { + // look up the name in the curves array + let curveName; + for (curveName in EnvelopeCurves) { + if (EnvelopeCurves[curveName][direction] === curve) { + return curveName; + } + } + // return the custom curve + return curve; + } + } + /** + * Assign a the curve to the given name using the direction + * @param name + * @param direction In/Out + * @param curve + */ + _setCurve(name, direction, curve) { + // check if it's a valid type + if (isString(curve) && Reflect.has(EnvelopeCurves, curve)) { + const curveDef = EnvelopeCurves[curve]; + if (isObject(curveDef)) { + if (name !== "_decayCurve") { + this[name] = curveDef[direction]; + } + } + else { + this[name] = curveDef; + } + } + else if (isArray(curve) && name !== "_decayCurve") { + this[name] = curve; + } + else { + throw new Error("Envelope: invalid curve: " + curve); + } + } + /** + * The shape of the attack. + * Can be any of these strings: + * * "linear" + * * "exponential" + * * "sine" + * * "cosine" + * * "bounce" + * * "ripple" + * * "step" + * + * Can also be an array which describes the curve. Values + * in the array are evenly subdivided and linearly + * interpolated over the duration of the attack. + * @example + * return Tone.Offline(() => { + * const env = new Tone.Envelope(0.4).toDestination(); + * env.attackCurve = "linear"; + * env.triggerAttack(); + * }, 1, 1); + */ + get attackCurve() { + return this._getCurve(this._attackCurve, "In"); + } + set attackCurve(curve) { + this._setCurve("_attackCurve", "In", curve); + } + /** + * The shape of the release. See the attack curve types. + * @example + * return Tone.Offline(() => { + * const env = new Tone.Envelope({ + * release: 0.8 + * }).toDestination(); + * env.triggerAttack(); + * // release curve could also be defined by an array + * env.releaseCurve = [1, 0.3, 0.4, 0.2, 0.7, 0]; + * env.triggerRelease(0.2); + * }, 1, 1); + */ + get releaseCurve() { + return this._getCurve(this._releaseCurve, "Out"); + } + set releaseCurve(curve) { + this._setCurve("_releaseCurve", "Out", curve); + } + /** + * The shape of the decay either "linear" or "exponential" + * @example + * return Tone.Offline(() => { + * const env = new Tone.Envelope({ + * sustain: 0.1, + * decay: 0.5 + * }).toDestination(); + * env.decayCurve = "linear"; + * env.triggerAttack(); + * }, 1, 1); + */ + get decayCurve() { + return this._decayCurve; + } + set decayCurve(curve) { + assert(["linear", "exponential"].some(c => c === curve), `Invalid envelope curve: ${curve}`); + this._decayCurve = curve; + } + /** + * Trigger the attack/decay portion of the ADSR envelope. + * @param time When the attack should start. + * @param velocity The velocity of the envelope scales the vales. + * number between 0-1 + * @example + * const env = new Tone.AmplitudeEnvelope().toDestination(); + * const osc = new Tone.Oscillator().connect(env).start(); + * // trigger the attack 0.5 seconds from now with a velocity of 0.2 + * env.triggerAttack("+0.5", 0.2); + */ + triggerAttack(time, velocity = 1) { + this.log("triggerAttack", time, velocity); + time = this.toSeconds(time); + const originalAttack = this.toSeconds(this.attack); + let attack = originalAttack; + const decay = this.toSeconds(this.decay); + // check if it's not a complete attack + const currentValue = this.getValueAtTime(time); + if (currentValue > 0) { + // subtract the current value from the attack time + const attackRate = 1 / attack; + const remainingDistance = 1 - currentValue; + // the attack is now the remaining time + attack = remainingDistance / attackRate; + } + // attack + if (attack < this.sampleTime) { + this._sig.cancelScheduledValues(time); + // case where the attack time is 0 should set instantly + this._sig.setValueAtTime(velocity, time); + } + else if (this._attackCurve === "linear") { + this._sig.linearRampTo(velocity, attack, time); + } + else if (this._attackCurve === "exponential") { + this._sig.targetRampTo(velocity, attack, time); + } + else { + this._sig.cancelAndHoldAtTime(time); + let curve = this._attackCurve; + // find the starting position in the curve + for (let i = 1; i < curve.length; i++) { + // the starting index is between the two values + if (curve[i - 1] <= currentValue && currentValue <= curve[i]) { + curve = this._attackCurve.slice(i); + // the first index is the current value + curve[0] = currentValue; + break; + } + } + this._sig.setValueCurveAtTime(curve, time, attack, velocity); + } + // decay + if (decay && this.sustain < 1) { + const decayValue = velocity * this.sustain; + const decayStart = time + attack; + this.log("decay", decayStart); + if (this._decayCurve === "linear") { + this._sig.linearRampToValueAtTime(decayValue, decay + decayStart); + } + else { + this._sig.exponentialApproachValueAtTime(decayValue, decayStart, decay); + } + } + return this; + } + /** + * Triggers the release of the envelope. + * @param time When the release portion of the envelope should start. + * @example + * const env = new Tone.AmplitudeEnvelope().toDestination(); + * const osc = new Tone.Oscillator({ + * type: "sawtooth" + * }).connect(env).start(); + * env.triggerAttack(); + * // trigger the release half a second after the attack + * env.triggerRelease("+0.5"); + */ + triggerRelease(time) { + this.log("triggerRelease", time); + time = this.toSeconds(time); + const currentValue = this.getValueAtTime(time); + if (currentValue > 0) { + const release = this.toSeconds(this.release); + if (release < this.sampleTime) { + this._sig.setValueAtTime(0, time); + } + else if (this._releaseCurve === "linear") { + this._sig.linearRampTo(0, release, time); + } + else if (this._releaseCurve === "exponential") { + this._sig.targetRampTo(0, release, time); + } + else { + assert(isArray(this._releaseCurve), "releaseCurve must be either 'linear', 'exponential' or an array"); + this._sig.cancelAndHoldAtTime(time); + this._sig.setValueCurveAtTime(this._releaseCurve, time, release, currentValue); + } + } + return this; + } + /** + * Get the scheduled value at the given time. This will + * return the unconverted (raw) value. + * @example + * const env = new Tone.Envelope(0.5, 1, 0.4, 2); + * env.triggerAttackRelease(2); + * setInterval(() => console.log(env.getValueAtTime(Tone.now())), 100); + */ + getValueAtTime(time) { + return this._sig.getValueAtTime(time); + } + /** + * triggerAttackRelease is shorthand for triggerAttack, then waiting + * some duration, then triggerRelease. + * @param duration The duration of the sustain. + * @param time When the attack should be triggered. + * @param velocity The velocity of the envelope. + * @example + * const env = new Tone.AmplitudeEnvelope().toDestination(); + * const osc = new Tone.Oscillator().connect(env).start(); + * // trigger the release 0.5 seconds after the attack + * env.triggerAttackRelease(0.5); + */ + triggerAttackRelease(duration, time, velocity = 1) { + time = this.toSeconds(time); + this.triggerAttack(time, velocity); + this.triggerRelease(time + this.toSeconds(duration)); + return this; + } + /** + * Cancels all scheduled envelope changes after the given time. + */ + cancel(after) { + this._sig.cancelScheduledValues(this.toSeconds(after)); + return this; + } + /** + * Connect the envelope to a destination node. + */ + connect(destination, outputNumber = 0, inputNumber = 0) { + connectSignal(this, destination, outputNumber, inputNumber); + return this; + } + /** + * Render the envelope curve to an array of the given length. + * Good for visualizing the envelope curve. Rescales the duration of the + * envelope to fit the length. + */ + asArray(length = 1024) { + return __awaiter(this, void 0, void 0, function* () { + const duration = length / this.context.sampleRate; + const context = new OfflineContext(1, duration, this.context.sampleRate); + // normalize the ADSR for the given duration with 20% sustain time + const attackPortion = this.toSeconds(this.attack) + this.toSeconds(this.decay); + const envelopeDuration = attackPortion + this.toSeconds(this.release); + const sustainTime = envelopeDuration * 0.1; + const totalDuration = envelopeDuration + sustainTime; + // @ts-ignore + const clone = new this.constructor(Object.assign(this.get(), { + attack: duration * this.toSeconds(this.attack) / totalDuration, + decay: duration * this.toSeconds(this.decay) / totalDuration, + release: duration * this.toSeconds(this.release) / totalDuration, + context + })); + clone._sig.toDestination(); + clone.triggerAttackRelease(duration * (attackPortion + sustainTime) / totalDuration, 0); + const buffer = yield context.render(); + return buffer.getChannelData(0); + }); + } + dispose() { + super.dispose(); + this._sig.dispose(); + return this; + } +} +__decorate([ + timeRange(0) +], Envelope.prototype, "attack", void 0); +__decorate([ + timeRange(0) +], Envelope.prototype, "decay", void 0); +__decorate([ + range(0, 1) +], Envelope.prototype, "sustain", void 0); +__decorate([ + timeRange(0) +], Envelope.prototype, "release", void 0); +/** + * Generate some complex envelope curves. + */ +const EnvelopeCurves = (() => { + const curveLen = 128; + let i; + let k; + // cosine curve + const cosineCurve = []; + for (i = 0; i < curveLen; i++) { + cosineCurve[i] = Math.sin((i / (curveLen - 1)) * (Math.PI / 2)); + } + // ripple curve + const rippleCurve = []; + const rippleCurveFreq = 6.4; + for (i = 0; i < curveLen - 1; i++) { + k = (i / (curveLen - 1)); + const sineWave = Math.sin(k * (Math.PI * 2) * rippleCurveFreq - Math.PI / 2) + 1; + rippleCurve[i] = sineWave / 10 + k * 0.83; + } + rippleCurve[curveLen - 1] = 1; + // stairs curve + const stairsCurve = []; + const steps = 5; + for (i = 0; i < curveLen; i++) { + stairsCurve[i] = Math.ceil((i / (curveLen - 1)) * steps) / steps; + } + // in-out easing curve + const sineCurve = []; + for (i = 0; i < curveLen; i++) { + k = i / (curveLen - 1); + sineCurve[i] = 0.5 * (1 - Math.cos(Math.PI * k)); + } + // a bounce curve + const bounceCurve = []; + for (i = 0; i < curveLen; i++) { + k = i / (curveLen - 1); + const freq = Math.pow(k, 3) * 4 + 0.2; + const val = Math.cos(freq * Math.PI * 2 * k); + bounceCurve[i] = Math.abs(val * (1 - k)); + } + /** + * Invert a value curve to make it work for the release + */ + function invertCurve(curve) { + const out = new Array(curve.length); + for (let j = 0; j < curve.length; j++) { + out[j] = 1 - curve[j]; + } + return out; + } + /** + * reverse the curve + */ + function reverseCurve(curve) { + return curve.slice(0).reverse(); + } + /** + * attack and release curve arrays + */ + return { + bounce: { + In: invertCurve(bounceCurve), + Out: bounceCurve, + }, + cosine: { + In: cosineCurve, + Out: reverseCurve(cosineCurve), + }, + exponential: "exponential", + linear: "linear", + ripple: { + In: rippleCurve, + Out: invertCurve(rippleCurve), + }, + sine: { + In: sineCurve, + Out: invertCurve(sineCurve), + }, + step: { + In: stairsCurve, + Out: invertCurve(stairsCurve), + }, + }; +})(); + +/** + * Base-class for all instruments + */ +class Instrument extends ToneAudioNode { + constructor() { + super(optionsFromArguments(Instrument.getDefaults(), arguments)); + /** + * Keep track of all events scheduled to the transport + * when the instrument is 'synced' + */ + this._scheduledEvents = []; + /** + * If the instrument is currently synced + */ + this._synced = false; + this._original_triggerAttack = this.triggerAttack; + this._original_triggerRelease = this.triggerRelease; + const options = optionsFromArguments(Instrument.getDefaults(), arguments); + this._volume = this.output = new Volume({ + context: this.context, + volume: options.volume, + }); + this.volume = this._volume.volume; + readOnly(this, "volume"); + } + static getDefaults() { + return Object.assign(ToneAudioNode.getDefaults(), { + volume: 0, + }); + } + /** + * Sync the instrument to the Transport. All subsequent calls of + * [[triggerAttack]] and [[triggerRelease]] will be scheduled along the transport. + * @example + * const fmSynth = new Tone.FMSynth().toDestination(); + * fmSynth.volume.value = -6; + * fmSynth.sync(); + * // schedule 3 notes when the transport first starts + * fmSynth.triggerAttackRelease("C4", "8n", 0); + * fmSynth.triggerAttackRelease("E4", "8n", "8n"); + * fmSynth.triggerAttackRelease("G4", "8n", "4n"); + * // start the transport to hear the notes + * Tone.Transport.start(); + */ + sync() { + if (this._syncState()) { + this._syncMethod("triggerAttack", 1); + this._syncMethod("triggerRelease", 0); + } + return this; + } + /** + * set _sync + */ + _syncState() { + let changed = false; + if (!this._synced) { + this._synced = true; + changed = true; + } + return changed; + } + /** + * Wrap the given method so that it can be synchronized + * @param method Which method to wrap and sync + * @param timePosition What position the time argument appears in + */ + _syncMethod(method, timePosition) { + const originalMethod = this["_original_" + method] = this[method]; + this[method] = (...args) => { + const time = args[timePosition]; + const id = this.context.transport.schedule((t) => { + args[timePosition] = t; + originalMethod.apply(this, args); + }, time); + this._scheduledEvents.push(id); + }; + } + /** + * Unsync the instrument from the Transport + */ + unsync() { + this._scheduledEvents.forEach(id => this.context.transport.clear(id)); + this._scheduledEvents = []; + if (this._synced) { + this._synced = false; + this.triggerAttack = this._original_triggerAttack; + this.triggerRelease = this._original_triggerRelease; + } + return this; + } + /** + * Trigger the attack and then the release after the duration. + * @param note The note to trigger. + * @param duration How long the note should be held for before + * triggering the release. This value must be greater than 0. + * @param time When the note should be triggered. + * @param velocity The velocity the note should be triggered at. + * @example + * const synth = new Tone.Synth().toDestination(); + * // trigger "C4" for the duration of an 8th note + * synth.triggerAttackRelease("C4", "8n"); + */ + triggerAttackRelease(note, duration, time, velocity) { + const computedTime = this.toSeconds(time); + const computedDuration = this.toSeconds(duration); + this.triggerAttack(note, computedTime, velocity); + this.triggerRelease(computedTime + computedDuration); + return this; + } + /** + * clean up + * @returns {Instrument} this + */ + dispose() { + super.dispose(); + this._volume.dispose(); + this.unsync(); + this._scheduledEvents = []; + return this; + } +} + +/** + * Abstract base class for other monophonic instruments to extend. + */ +class Monophonic extends Instrument { + constructor() { + super(optionsFromArguments(Monophonic.getDefaults(), arguments)); + const options = optionsFromArguments(Monophonic.getDefaults(), arguments); + this.portamento = options.portamento; + this.onsilence = options.onsilence; + } + static getDefaults() { + return Object.assign(Instrument.getDefaults(), { + detune: 0, + onsilence: noOp, + portamento: 0, + }); + } + /** + * Trigger the attack of the note optionally with a given velocity. + * @param note The note to trigger. + * @param time When the note should start. + * @param velocity The velocity scaler determines how "loud" the note will be triggered. + * @example + * const synth = new Tone.Synth().toDestination(); + * // trigger the note a half second from now at half velocity + * synth.triggerAttack("C4", "+0.5", 0.5); + */ + triggerAttack(note, time, velocity = 1) { + this.log("triggerAttack", note, time, velocity); + const seconds = this.toSeconds(time); + this._triggerEnvelopeAttack(seconds, velocity); + this.setNote(note, seconds); + return this; + } + /** + * Trigger the release portion of the envelope + * @param time If no time is given, the release happens immediatly + * @example + * const synth = new Tone.Synth().toDestination(); + * synth.triggerAttack("C4"); + * // trigger the release a second from now + * synth.triggerRelease("+1"); + */ + triggerRelease(time) { + this.log("triggerRelease", time); + const seconds = this.toSeconds(time); + this._triggerEnvelopeRelease(seconds); + return this; + } + /** + * Set the note at the given time. If no time is given, the note + * will set immediately. + * @param note The note to change to. + * @param time The time when the note should be set. + * @example + * const synth = new Tone.Synth().toDestination(); + * synth.triggerAttack("C4"); + * // change to F#6 in one quarter note from now. + * synth.setNote("F#6", "+4n"); + */ + setNote(note, time) { + const computedTime = this.toSeconds(time); + const computedFrequency = note instanceof FrequencyClass ? note.toFrequency() : note; + if (this.portamento > 0 && this.getLevelAtTime(computedTime) > 0.05) { + const portTime = this.toSeconds(this.portamento); + this.frequency.exponentialRampTo(computedFrequency, portTime, computedTime); + } + else { + this.frequency.setValueAtTime(computedFrequency, computedTime); + } + return this; + } +} +__decorate([ + timeRange(0) +], Monophonic.prototype, "portamento", void 0); + +/** + * AmplitudeEnvelope is a Tone.Envelope connected to a gain node. + * Unlike Tone.Envelope, which outputs the envelope's value, AmplitudeEnvelope accepts + * an audio signal as the input and will apply the envelope to the amplitude + * of the signal. + * Read more about ADSR Envelopes on [Wikipedia](https://en.wikipedia.org/wiki/Synthesizer#ADSR_envelope). + * + * @example + * return Tone.Offline(() => { + * const ampEnv = new Tone.AmplitudeEnvelope({ + * attack: 0.1, + * decay: 0.2, + * sustain: 1.0, + * release: 0.8 + * }).toDestination(); + * // create an oscillator and connect it + * const osc = new Tone.Oscillator().connect(ampEnv).start(); + * // trigger the envelopes attack and release "8t" apart + * ampEnv.triggerAttackRelease("8t"); + * }, 1.5, 1); + * @category Component + */ +class AmplitudeEnvelope extends Envelope { + constructor() { + super(optionsFromArguments(AmplitudeEnvelope.getDefaults(), arguments, ["attack", "decay", "sustain", "release"])); + this.name = "AmplitudeEnvelope"; + this._gainNode = new Gain({ + context: this.context, + gain: 0, + }); + this.output = this._gainNode; + this.input = this._gainNode; + this._sig.connect(this._gainNode.gain); + this.output = this._gainNode; + this.input = this._gainNode; + } + /** + * Clean up + */ + dispose() { + super.dispose(); + this._gainNode.dispose(); + return this; + } +} + +/** + * Synth is composed simply of a [[OmniOscillator]] routed through an [[AmplitudeEnvelope]]. + * ``` + * +----------------+ +-------------------+ + * | OmniOscillator +>--> AmplitudeEnvelope +>--> Output + * +----------------+ +-------------------+ + * ``` + * @example + * const synth = new Tone.Synth().toDestination(); + * synth.triggerAttackRelease("C4", "8n"); + * @category Instrument + */ +class Synth extends Monophonic { + constructor() { + super(optionsFromArguments(Synth.getDefaults(), arguments)); + this.name = "Synth"; + const options = optionsFromArguments(Synth.getDefaults(), arguments); + this.oscillator = new OmniOscillator(Object.assign({ + context: this.context, + detune: options.detune, + onstop: () => this.onsilence(this), + }, options.oscillator)); + this.frequency = this.oscillator.frequency; + this.detune = this.oscillator.detune; + this.envelope = new AmplitudeEnvelope(Object.assign({ + context: this.context, + }, options.envelope)); + // connect the oscillators to the output + this.oscillator.chain(this.envelope, this.output); + readOnly(this, ["oscillator", "frequency", "detune", "envelope"]); + } + static getDefaults() { + return Object.assign(Monophonic.getDefaults(), { + envelope: Object.assign(omitFromObject(Envelope.getDefaults(), Object.keys(ToneAudioNode.getDefaults())), { + attack: 0.005, + decay: 0.1, + release: 1, + sustain: 0.3, + }), + oscillator: Object.assign(omitFromObject(OmniOscillator.getDefaults(), [...Object.keys(Source.getDefaults()), "frequency", "detune"]), { + type: "triangle", + }), + }); + } + /** + * start the attack portion of the envelope + * @param time the time the attack should start + * @param velocity the velocity of the note (0-1) + */ + _triggerEnvelopeAttack(time, velocity) { + // the envelopes + this.envelope.triggerAttack(time, velocity); + this.oscillator.start(time); + // if there is no release portion, stop the oscillator + if (this.envelope.sustain === 0) { + const computedAttack = this.toSeconds(this.envelope.attack); + const computedDecay = this.toSeconds(this.envelope.decay); + this.oscillator.stop(time + computedAttack + computedDecay); + } + } + /** + * start the release portion of the envelope + * @param time the time the release should start + */ + _triggerEnvelopeRelease(time) { + this.envelope.triggerRelease(time); + this.oscillator.stop(time + this.toSeconds(this.envelope.release)); + } + getLevelAtTime(time) { + time = this.toSeconds(time); + return this.envelope.getValueAtTime(time); + } + /** + * clean up + */ + dispose() { + super.dispose(); + this.oscillator.dispose(); + this.envelope.dispose(); + return this; + } +} + +/** + * Base class for both AM and FM synths + */ +class ModulationSynth extends Monophonic { + constructor() { + super(optionsFromArguments(ModulationSynth.getDefaults(), arguments)); + this.name = "ModulationSynth"; + const options = optionsFromArguments(ModulationSynth.getDefaults(), arguments); + this._carrier = new Synth({ + context: this.context, + oscillator: options.oscillator, + envelope: options.envelope, + onsilence: () => this.onsilence(this), + volume: -10, + }); + this._modulator = new Synth({ + context: this.context, + oscillator: options.modulation, + envelope: options.modulationEnvelope, + volume: -10, + }); + this.oscillator = this._carrier.oscillator; + this.envelope = this._carrier.envelope; + this.modulation = this._modulator.oscillator; + this.modulationEnvelope = this._modulator.envelope; + this.frequency = new Signal({ + context: this.context, + units: "frequency", + }); + this.detune = new Signal({ + context: this.context, + value: options.detune, + units: "cents" + }); + this.harmonicity = new Multiply({ + context: this.context, + value: options.harmonicity, + minValue: 0, + }); + this._modulationNode = new Gain({ + context: this.context, + gain: 0, + }); + readOnly(this, ["frequency", "harmonicity", "oscillator", "envelope", "modulation", "modulationEnvelope", "detune"]); + } + static getDefaults() { + return Object.assign(Monophonic.getDefaults(), { + harmonicity: 3, + oscillator: Object.assign(omitFromObject(OmniOscillator.getDefaults(), [ + ...Object.keys(Source.getDefaults()), + "frequency", + "detune" + ]), { + type: "sine" + }), + envelope: Object.assign(omitFromObject(Envelope.getDefaults(), Object.keys(ToneAudioNode.getDefaults())), { + attack: 0.01, + decay: 0.01, + sustain: 1, + release: 0.5 + }), + modulation: Object.assign(omitFromObject(OmniOscillator.getDefaults(), [ + ...Object.keys(Source.getDefaults()), + "frequency", + "detune" + ]), { + type: "square" + }), + modulationEnvelope: Object.assign(omitFromObject(Envelope.getDefaults(), Object.keys(ToneAudioNode.getDefaults())), { + attack: 0.5, + decay: 0.0, + sustain: 1, + release: 0.5 + }) + }); + } + /** + * Trigger the attack portion of the note + */ + _triggerEnvelopeAttack(time, velocity) { + // @ts-ignore + this._carrier._triggerEnvelopeAttack(time, velocity); + // @ts-ignore + this._modulator._triggerEnvelopeAttack(time, velocity); + } + /** + * Trigger the release portion of the note + */ + _triggerEnvelopeRelease(time) { + // @ts-ignore + this._carrier._triggerEnvelopeRelease(time); + // @ts-ignore + this._modulator._triggerEnvelopeRelease(time); + return this; + } + getLevelAtTime(time) { + time = this.toSeconds(time); + return this.envelope.getValueAtTime(time); + } + dispose() { + super.dispose(); + this._carrier.dispose(); + this._modulator.dispose(); + this.frequency.dispose(); + this.detune.dispose(); + this.harmonicity.dispose(); + this._modulationNode.dispose(); + return this; + } +} + +/** + * AMSynth uses the output of one Tone.Synth to modulate the + * amplitude of another Tone.Synth. The harmonicity (the ratio between + * the two signals) affects the timbre of the output signal greatly. + * Read more about Amplitude Modulation Synthesis on + * [SoundOnSound](https://web.archive.org/web/20160404103653/http://www.soundonsound.com:80/sos/mar00/articles/synthsecrets.htm). + * + * @example + * const synth = new Tone.AMSynth().toDestination(); + * synth.triggerAttackRelease("C4", "4n"); + * + * @category Instrument + */ +class AMSynth extends ModulationSynth { + constructor() { + super(optionsFromArguments(AMSynth.getDefaults(), arguments)); + this.name = "AMSynth"; + this._modulationScale = new AudioToGain({ + context: this.context, + }); + // control the two voices frequency + this.frequency.connect(this._carrier.frequency); + this.frequency.chain(this.harmonicity, this._modulator.frequency); + this.detune.fan(this._carrier.detune, this._modulator.detune); + this._modulator.chain(this._modulationScale, this._modulationNode.gain); + this._carrier.chain(this._modulationNode, this.output); + } + dispose() { + super.dispose(); + this._modulationScale.dispose(); + return this; + } +} + +/** + * Thin wrapper around the native Web Audio [BiquadFilterNode](https://webaudio.github.io/web-audio-api/#biquadfilternode). + * BiquadFilter is similar to [[Filter]] but doesn't have the option to set the "rolloff" value. + * @category Component + */ +class BiquadFilter extends ToneAudioNode { + constructor() { + super(optionsFromArguments(BiquadFilter.getDefaults(), arguments, ["frequency", "type"])); + this.name = "BiquadFilter"; + const options = optionsFromArguments(BiquadFilter.getDefaults(), arguments, ["frequency", "type"]); + this._filter = this.context.createBiquadFilter(); + this.input = this.output = this._filter; + this.Q = new Param({ + context: this.context, + units: "number", + value: options.Q, + param: this._filter.Q, + }); + this.frequency = new Param({ + context: this.context, + units: "frequency", + value: options.frequency, + param: this._filter.frequency, + }); + this.detune = new Param({ + context: this.context, + units: "cents", + value: options.detune, + param: this._filter.detune, + }); + this.gain = new Param({ + context: this.context, + units: "decibels", + convert: false, + value: options.gain, + param: this._filter.gain, + }); + this.type = options.type; + } + static getDefaults() { + return Object.assign(ToneAudioNode.getDefaults(), { + Q: 1, + type: "lowpass", + frequency: 350, + detune: 0, + gain: 0, + }); + } + /** + * The type of this BiquadFilterNode. For a complete list of types and their attributes, see the + * [Web Audio API](https://webaudio.github.io/web-audio-api/#dom-biquadfiltertype-lowpass) + */ + get type() { + return this._filter.type; + } + set type(type) { + const types = ["lowpass", "highpass", "bandpass", + "lowshelf", "highshelf", "notch", "allpass", "peaking"]; + assert(types.indexOf(type) !== -1, `Invalid filter type: ${type}`); + this._filter.type = type; + } + /** + * Get the frequency response curve. This curve represents how the filter + * responses to frequencies between 20hz-20khz. + * @param len The number of values to return + * @return The frequency response curve between 20-20kHz + */ + getFrequencyResponse(len = 128) { + // start with all 1s + const freqValues = new Float32Array(len); + for (let i = 0; i < len; i++) { + const norm = Math.pow(i / len, 2); + const freq = norm * (20000 - 20) + 20; + freqValues[i] = freq; + } + const magValues = new Float32Array(len); + const phaseValues = new Float32Array(len); + // clone the filter to remove any connections which may be changing the value + const filterClone = this.context.createBiquadFilter(); + filterClone.type = this.type; + filterClone.Q.value = this.Q.value; + filterClone.frequency.value = this.frequency.value; + filterClone.gain.value = this.gain.value; + filterClone.getFrequencyResponse(freqValues, magValues, phaseValues); + return magValues; + } + dispose() { + super.dispose(); + this._filter.disconnect(); + this.Q.dispose(); + this.frequency.dispose(); + this.gain.dispose(); + this.detune.dispose(); + return this; + } +} + +/** + * Tone.Filter is a filter which allows for all of the same native methods + * as the [BiquadFilterNode](http://webaudio.github.io/web-audio-api/#the-biquadfilternode-interface). + * Tone.Filter has the added ability to set the filter rolloff at -12 + * (default), -24 and -48. + * @example + * const filter = new Tone.Filter(1500, "highpass").toDestination(); + * filter.frequency.rampTo(20000, 10); + * const noise = new Tone.Noise().connect(filter).start(); + * @category Component + */ +class Filter extends ToneAudioNode { + constructor() { + super(optionsFromArguments(Filter.getDefaults(), arguments, ["frequency", "type", "rolloff"])); + this.name = "Filter"; + this.input = new Gain({ context: this.context }); + this.output = new Gain({ context: this.context }); + this._filters = []; + const options = optionsFromArguments(Filter.getDefaults(), arguments, ["frequency", "type", "rolloff"]); + this._filters = []; + this.Q = new Signal({ + context: this.context, + units: "positive", + value: options.Q, + }); + this.frequency = new Signal({ + context: this.context, + units: "frequency", + value: options.frequency, + }); + this.detune = new Signal({ + context: this.context, + units: "cents", + value: options.detune, + }); + this.gain = new Signal({ + context: this.context, + units: "decibels", + convert: false, + value: options.gain, + }); + this._type = options.type; + this.rolloff = options.rolloff; + readOnly(this, ["detune", "frequency", "gain", "Q"]); + } + static getDefaults() { + return Object.assign(ToneAudioNode.getDefaults(), { + Q: 1, + detune: 0, + frequency: 350, + gain: 0, + rolloff: -12, + type: "lowpass", + }); + } + /** + * The type of the filter. Types: "lowpass", "highpass", + * "bandpass", "lowshelf", "highshelf", "notch", "allpass", or "peaking". + */ + get type() { + return this._type; + } + set type(type) { + const types = ["lowpass", "highpass", "bandpass", + "lowshelf", "highshelf", "notch", "allpass", "peaking"]; + assert(types.indexOf(type) !== -1, `Invalid filter type: ${type}`); + this._type = type; + this._filters.forEach(filter => filter.type = type); + } + /** + * The rolloff of the filter which is the drop in db + * per octave. Implemented internally by cascading filters. + * Only accepts the values -12, -24, -48 and -96. + */ + get rolloff() { + return this._rolloff; + } + set rolloff(rolloff) { + const rolloffNum = isNumber(rolloff) ? rolloff : parseInt(rolloff, 10); + const possibilities = [-12, -24, -48, -96]; + let cascadingCount = possibilities.indexOf(rolloffNum); + // check the rolloff is valid + assert(cascadingCount !== -1, `rolloff can only be ${possibilities.join(", ")}`); + cascadingCount += 1; + this._rolloff = rolloffNum; + this.input.disconnect(); + this._filters.forEach(filter => filter.disconnect()); + this._filters = new Array(cascadingCount); + for (let count = 0; count < cascadingCount; count++) { + const filter = new BiquadFilter({ + context: this.context, + }); + filter.type = this._type; + this.frequency.connect(filter.frequency); + this.detune.connect(filter.detune); + this.Q.connect(filter.Q); + this.gain.connect(filter.gain); + this._filters[count] = filter; + } + this._internalChannels = this._filters; + connectSeries(this.input, ...this._internalChannels, this.output); + } + /** + * Get the frequency response curve. This curve represents how the filter + * responses to frequencies between 20hz-20khz. + * @param len The number of values to return + * @return The frequency response curve between 20-20kHz + */ + getFrequencyResponse(len = 128) { + const filterClone = new BiquadFilter({ + frequency: this.frequency.value, + gain: this.gain.value, + Q: this.Q.value, + type: this._type, + detune: this.detune.value, + }); + // start with all 1s + const totalResponse = new Float32Array(len).map(() => 1); + this._filters.forEach(() => { + const response = filterClone.getFrequencyResponse(len); + response.forEach((val, i) => totalResponse[i] *= val); + }); + filterClone.dispose(); + return totalResponse; + } + /** + * Clean up. + */ + dispose() { + super.dispose(); + this._filters.forEach(filter => { + filter.dispose(); + }); + writable(this, ["detune", "frequency", "gain", "Q"]); + this.frequency.dispose(); + this.Q.dispose(); + this.detune.dispose(); + this.gain.dispose(); + return this; + } +} + +/** + * FrequencyEnvelope is an [[Envelope]] which ramps between [[baseFrequency]] + * and [[octaves]]. It can also have an optional [[exponent]] to adjust the curve + * which it ramps. + * @example + * const oscillator = new Tone.Oscillator().toDestination().start(); + * const freqEnv = new Tone.FrequencyEnvelope({ + * attack: 0.2, + * baseFrequency: "C2", + * octaves: 4 + * }); + * freqEnv.connect(oscillator.frequency); + * freqEnv.triggerAttack(); + * @category Component + */ +class FrequencyEnvelope extends Envelope { + constructor() { + super(optionsFromArguments(FrequencyEnvelope.getDefaults(), arguments, ["attack", "decay", "sustain", "release"])); + this.name = "FrequencyEnvelope"; + const options = optionsFromArguments(FrequencyEnvelope.getDefaults(), arguments, ["attack", "decay", "sustain", "release"]); + this._octaves = options.octaves; + this._baseFrequency = this.toFrequency(options.baseFrequency); + this._exponent = this.input = new Pow({ + context: this.context, + value: options.exponent + }); + this._scale = this.output = new Scale({ + context: this.context, + min: this._baseFrequency, + max: this._baseFrequency * Math.pow(2, this._octaves), + }); + this._sig.chain(this._exponent, this._scale); + } + static getDefaults() { + return Object.assign(Envelope.getDefaults(), { + baseFrequency: 200, + exponent: 1, + octaves: 4, + }); + } + /** + * The envelope's minimum output value. This is the value which it + * starts at. + */ + get baseFrequency() { + return this._baseFrequency; + } + set baseFrequency(min) { + const freq = this.toFrequency(min); + assertRange(freq, 0); + this._baseFrequency = freq; + this._scale.min = this._baseFrequency; + // update the max value when the min changes + this.octaves = this._octaves; + } + /** + * The number of octaves above the baseFrequency that the + * envelope will scale to. + */ + get octaves() { + return this._octaves; + } + set octaves(octaves) { + this._octaves = octaves; + this._scale.max = this._baseFrequency * Math.pow(2, octaves); + } + /** + * The envelope's exponent value. + */ + get exponent() { + return this._exponent.value; + } + set exponent(exponent) { + this._exponent.value = exponent; + } + /** + * Clean up + */ + dispose() { + super.dispose(); + this._exponent.dispose(); + this._scale.dispose(); + return this; + } +} + +/** + * MonoSynth is composed of one `oscillator`, one `filter`, and two `envelopes`. + * The amplitude of the Oscillator and the cutoff frequency of the + * Filter are controlled by Envelopes. + * + * @example + * const synth = new Tone.MonoSynth({ + * oscillator: { + * type: "square" + * }, + * envelope: { + * attack: 0.1 + * } + * }).toDestination(); + * synth.triggerAttackRelease("C4", "8n"); + * @category Instrument + */ +class MonoSynth extends Monophonic { + constructor() { + super(optionsFromArguments(MonoSynth.getDefaults(), arguments)); + this.name = "MonoSynth"; + const options = optionsFromArguments(MonoSynth.getDefaults(), arguments); + this.oscillator = new OmniOscillator(Object.assign(options.oscillator, { + context: this.context, + detune: options.detune, + onstop: () => this.onsilence(this), + })); + this.frequency = this.oscillator.frequency; + this.detune = this.oscillator.detune; + this.filter = new Filter(Object.assign(options.filter, { context: this.context })); + this.filterEnvelope = new FrequencyEnvelope(Object.assign(options.filterEnvelope, { context: this.context })); + this.envelope = new AmplitudeEnvelope(Object.assign(options.envelope, { context: this.context })); + // connect the oscillators to the output + this.oscillator.chain(this.filter, this.envelope, this.output); + // connect the filter envelope + this.filterEnvelope.connect(this.filter.frequency); + readOnly(this, ["oscillator", "frequency", "detune", "filter", "filterEnvelope", "envelope"]); + } + static getDefaults() { + return Object.assign(Monophonic.getDefaults(), { + envelope: Object.assign(omitFromObject(Envelope.getDefaults(), Object.keys(ToneAudioNode.getDefaults())), { + attack: 0.005, + decay: 0.1, + release: 1, + sustain: 0.9, + }), + filter: Object.assign(omitFromObject(Filter.getDefaults(), Object.keys(ToneAudioNode.getDefaults())), { + Q: 1, + rolloff: -12, + type: "lowpass", + }), + filterEnvelope: Object.assign(omitFromObject(FrequencyEnvelope.getDefaults(), Object.keys(ToneAudioNode.getDefaults())), { + attack: 0.6, + baseFrequency: 200, + decay: 0.2, + exponent: 2, + octaves: 3, + release: 2, + sustain: 0.5, + }), + oscillator: Object.assign(omitFromObject(OmniOscillator.getDefaults(), Object.keys(Source.getDefaults())), { + type: "sawtooth", + }), + }); + } + /** + * start the attack portion of the envelope + * @param time the time the attack should start + * @param velocity the velocity of the note (0-1) + */ + _triggerEnvelopeAttack(time, velocity = 1) { + this.envelope.triggerAttack(time, velocity); + this.filterEnvelope.triggerAttack(time); + this.oscillator.start(time); + if (this.envelope.sustain === 0) { + const computedAttack = this.toSeconds(this.envelope.attack); + const computedDecay = this.toSeconds(this.envelope.decay); + this.oscillator.stop(time + computedAttack + computedDecay); + } + } + /** + * start the release portion of the envelope + * @param time the time the release should start + */ + _triggerEnvelopeRelease(time) { + this.envelope.triggerRelease(time); + this.filterEnvelope.triggerRelease(time); + this.oscillator.stop(time + this.toSeconds(this.envelope.release)); + } + getLevelAtTime(time) { + time = this.toSeconds(time); + return this.envelope.getValueAtTime(time); + } + dispose() { + super.dispose(); + this.oscillator.dispose(); + this.envelope.dispose(); + this.filterEnvelope.dispose(); + this.filter.dispose(); + return this; + } +} + +/** + * DuoSynth is a monophonic synth composed of two [[MonoSynths]] run in parallel with control over the + * frequency ratio between the two voices and vibrato effect. + * @example + * const duoSynth = new Tone.DuoSynth().toDestination(); + * duoSynth.triggerAttackRelease("C4", "2n"); + * @category Instrument + */ +class DuoSynth extends Monophonic { + constructor() { + super(optionsFromArguments(DuoSynth.getDefaults(), arguments)); + this.name = "DuoSynth"; + const options = optionsFromArguments(DuoSynth.getDefaults(), arguments); + this.voice0 = new MonoSynth(Object.assign(options.voice0, { + context: this.context, + onsilence: () => this.onsilence(this) + })); + this.voice1 = new MonoSynth(Object.assign(options.voice1, { + context: this.context, + })); + this.harmonicity = new Multiply({ + context: this.context, + units: "positive", + value: options.harmonicity, + }); + this._vibrato = new LFO({ + frequency: options.vibratoRate, + context: this.context, + min: -50, + max: 50 + }); + // start the vibrato immediately + this._vibrato.start(); + this.vibratoRate = this._vibrato.frequency; + this._vibratoGain = new Gain({ + context: this.context, + units: "normalRange", + gain: options.vibratoAmount + }); + this.vibratoAmount = this._vibratoGain.gain; + this.frequency = new Signal({ + context: this.context, + units: "frequency", + value: 440 + }); + this.detune = new Signal({ + context: this.context, + units: "cents", + value: options.detune + }); + // control the two voices frequency + this.frequency.connect(this.voice0.frequency); + this.frequency.chain(this.harmonicity, this.voice1.frequency); + this._vibrato.connect(this._vibratoGain); + this._vibratoGain.fan(this.voice0.detune, this.voice1.detune); + this.detune.fan(this.voice0.detune, this.voice1.detune); + this.voice0.connect(this.output); + this.voice1.connect(this.output); + readOnly(this, ["voice0", "voice1", "frequency", "vibratoAmount", "vibratoRate"]); + } + getLevelAtTime(time) { + time = this.toSeconds(time); + return this.voice0.envelope.getValueAtTime(time) + this.voice1.envelope.getValueAtTime(time); + } + static getDefaults() { + return deepMerge(Monophonic.getDefaults(), { + vibratoAmount: 0.5, + vibratoRate: 5, + harmonicity: 1.5, + voice0: deepMerge(omitFromObject(MonoSynth.getDefaults(), Object.keys(Monophonic.getDefaults())), { + filterEnvelope: { + attack: 0.01, + decay: 0.0, + sustain: 1, + release: 0.5 + }, + envelope: { + attack: 0.01, + decay: 0.0, + sustain: 1, + release: 0.5 + } + }), + voice1: deepMerge(omitFromObject(MonoSynth.getDefaults(), Object.keys(Monophonic.getDefaults())), { + filterEnvelope: { + attack: 0.01, + decay: 0.0, + sustain: 1, + release: 0.5 + }, + envelope: { + attack: 0.01, + decay: 0.0, + sustain: 1, + release: 0.5 + } + }), + }); + } + /** + * Trigger the attack portion of the note + */ + _triggerEnvelopeAttack(time, velocity) { + // @ts-ignore + this.voice0._triggerEnvelopeAttack(time, velocity); + // @ts-ignore + this.voice1._triggerEnvelopeAttack(time, velocity); + } + /** + * Trigger the release portion of the note + */ + _triggerEnvelopeRelease(time) { + // @ts-ignore + this.voice0._triggerEnvelopeRelease(time); + // @ts-ignore + this.voice1._triggerEnvelopeRelease(time); + return this; + } + dispose() { + super.dispose(); + this.voice0.dispose(); + this.voice1.dispose(); + this.frequency.dispose(); + this.detune.dispose(); + this._vibrato.dispose(); + this.vibratoRate.dispose(); + this._vibratoGain.dispose(); + this.harmonicity.dispose(); + return this; + } +} + +/** + * FMSynth is composed of two Tone.Synths where one Tone.Synth modulates + * the frequency of a second Tone.Synth. A lot of spectral content + * can be explored using the modulationIndex parameter. Read more about + * frequency modulation synthesis on Sound On Sound: [Part 1](https://web.archive.org/web/20160403123704/http://www.soundonsound.com/sos/apr00/articles/synthsecrets.htm), [Part 2](https://web.archive.org/web/20160403115835/http://www.soundonsound.com/sos/may00/articles/synth.htm). + * + * @example + * const fmSynth = new Tone.FMSynth().toDestination(); + * fmSynth.triggerAttackRelease("C5", "4n"); + * + * @category Instrument + */ +class FMSynth extends ModulationSynth { + constructor() { + super(optionsFromArguments(FMSynth.getDefaults(), arguments)); + this.name = "FMSynth"; + const options = optionsFromArguments(FMSynth.getDefaults(), arguments); + this.modulationIndex = new Multiply({ + context: this.context, + value: options.modulationIndex, + }); + // control the two voices frequency + this.frequency.connect(this._carrier.frequency); + this.frequency.chain(this.harmonicity, this._modulator.frequency); + this.frequency.chain(this.modulationIndex, this._modulationNode); + this.detune.fan(this._carrier.detune, this._modulator.detune); + this._modulator.connect(this._modulationNode.gain); + this._modulationNode.connect(this._carrier.frequency); + this._carrier.connect(this.output); + } + static getDefaults() { + return Object.assign(ModulationSynth.getDefaults(), { + modulationIndex: 10, + }); + } + dispose() { + super.dispose(); + this.modulationIndex.dispose(); + return this; + } +} + +/** + * Inharmonic ratio of frequencies based on the Roland TR-808 + * Taken from https://ccrma.stanford.edu/papers/tr-808-cymbal-physically-informed-circuit-bendable-digital-model + */ +const inharmRatios = [1.0, 1.483, 1.932, 2.546, 2.630, 3.897]; +/** + * A highly inharmonic and spectrally complex source with a highpass filter + * and amplitude envelope which is good for making metallophone sounds. + * Based on CymbalSynth by [@polyrhythmatic](https://github.com/polyrhythmatic). + * Inspiration from [Sound on Sound](https://shorturl.at/rSZ12). + * @category Instrument + */ +class MetalSynth extends Monophonic { + constructor() { + super(optionsFromArguments(MetalSynth.getDefaults(), arguments)); + this.name = "MetalSynth"; + /** + * The array of FMOscillators + */ + this._oscillators = []; + /** + * The frequency multipliers + */ + this._freqMultipliers = []; + const options = optionsFromArguments(MetalSynth.getDefaults(), arguments); + this.detune = new Signal({ + context: this.context, + units: "cents", + value: options.detune, + }); + this.frequency = new Signal({ + context: this.context, + units: "frequency", + }); + this._amplitude = new Gain({ + context: this.context, + gain: 0, + }).connect(this.output); + this._highpass = new Filter({ + // Q: -3.0102999566398125, + Q: 0, + context: this.context, + type: "highpass", + }).connect(this._amplitude); + for (let i = 0; i < inharmRatios.length; i++) { + const osc = new FMOscillator({ + context: this.context, + harmonicity: options.harmonicity, + modulationIndex: options.modulationIndex, + modulationType: "square", + onstop: i === 0 ? () => this.onsilence(this) : noOp, + type: "square", + }); + osc.connect(this._highpass); + this._oscillators[i] = osc; + const mult = new Multiply({ + context: this.context, + value: inharmRatios[i], + }); + this._freqMultipliers[i] = mult; + this.frequency.chain(mult, osc.frequency); + this.detune.connect(osc.detune); + } + this._filterFreqScaler = new Scale({ + context: this.context, + max: 7000, + min: this.toFrequency(options.resonance), + }); + this.envelope = new Envelope({ + attack: options.envelope.attack, + attackCurve: "linear", + context: this.context, + decay: options.envelope.decay, + release: options.envelope.release, + sustain: 0, + }); + this.envelope.chain(this._filterFreqScaler, this._highpass.frequency); + this.envelope.connect(this._amplitude.gain); + // set the octaves + this._octaves = options.octaves; + this.octaves = options.octaves; + } + static getDefaults() { + return deepMerge(Monophonic.getDefaults(), { + envelope: Object.assign(omitFromObject(Envelope.getDefaults(), Object.keys(ToneAudioNode.getDefaults())), { + attack: 0.001, + decay: 1.4, + release: 0.2, + }), + harmonicity: 5.1, + modulationIndex: 32, + octaves: 1.5, + resonance: 4000, + }); + } + /** + * Trigger the attack. + * @param time When the attack should be triggered. + * @param velocity The velocity that the envelope should be triggered at. + */ + _triggerEnvelopeAttack(time, velocity = 1) { + this.envelope.triggerAttack(time, velocity); + this._oscillators.forEach(osc => osc.start(time)); + if (this.envelope.sustain === 0) { + this._oscillators.forEach(osc => { + osc.stop(time + this.toSeconds(this.envelope.attack) + this.toSeconds(this.envelope.decay)); + }); + } + return this; + } + /** + * Trigger the release of the envelope. + * @param time When the release should be triggered. + */ + _triggerEnvelopeRelease(time) { + this.envelope.triggerRelease(time); + this._oscillators.forEach(osc => osc.stop(time + this.toSeconds(this.envelope.release))); + return this; + } + getLevelAtTime(time) { + time = this.toSeconds(time); + return this.envelope.getValueAtTime(time); + } + /** + * The modulationIndex of the oscillators which make up the source. + * see [[FMOscillator.modulationIndex]] + * @min 1 + * @max 100 + */ + get modulationIndex() { + return this._oscillators[0].modulationIndex.value; + } + set modulationIndex(val) { + this._oscillators.forEach(osc => (osc.modulationIndex.value = val)); + } + /** + * The harmonicity of the oscillators which make up the source. + * see Tone.FMOscillator.harmonicity + * @min 0.1 + * @max 10 + */ + get harmonicity() { + return this._oscillators[0].harmonicity.value; + } + set harmonicity(val) { + this._oscillators.forEach(osc => (osc.harmonicity.value = val)); + } + /** + * The lower level of the highpass filter which is attached to the envelope. + * This value should be between [0, 7000] + * @min 0 + * @max 7000 + */ + get resonance() { + return this._filterFreqScaler.min; + } + set resonance(val) { + this._filterFreqScaler.min = this.toFrequency(val); + this.octaves = this._octaves; + } + /** + * The number of octaves above the "resonance" frequency + * that the filter ramps during the attack/decay envelope + * @min 0 + * @max 8 + */ + get octaves() { + return this._octaves; + } + set octaves(val) { + this._octaves = val; + this._filterFreqScaler.max = this._filterFreqScaler.min * Math.pow(2, val); + } + dispose() { + super.dispose(); + this._oscillators.forEach(osc => osc.dispose()); + this._freqMultipliers.forEach(freqMult => freqMult.dispose()); + this.frequency.dispose(); + this.detune.dispose(); + this._filterFreqScaler.dispose(); + this._amplitude.dispose(); + this.envelope.dispose(); + this._highpass.dispose(); + return this; + } +} + +/** + * MembraneSynth makes kick and tom sounds using a single oscillator + * with an amplitude envelope and frequency ramp. A Tone.OmniOscillator + * is routed through a Tone.AmplitudeEnvelope to the output. The drum + * quality of the sound comes from the frequency envelope applied + * during MembraneSynth.triggerAttack(note). The frequency envelope + * starts at note * .octaves and ramps to note + * over the duration of .pitchDecay. + * @example + * const synth = new Tone.MembraneSynth().toDestination(); + * synth.triggerAttackRelease("C2", "8n"); + * @category Instrument + */ +class MembraneSynth extends Synth { + constructor() { + super(optionsFromArguments(MembraneSynth.getDefaults(), arguments)); + this.name = "MembraneSynth"; + /** + * Portamento is ignored in this synth. use pitch decay instead. + */ + this.portamento = 0; + const options = optionsFromArguments(MembraneSynth.getDefaults(), arguments); + this.pitchDecay = options.pitchDecay; + this.octaves = options.octaves; + readOnly(this, ["oscillator", "envelope"]); + } + static getDefaults() { + return deepMerge(Monophonic.getDefaults(), Synth.getDefaults(), { + envelope: { + attack: 0.001, + attackCurve: "exponential", + decay: 0.4, + release: 1.4, + sustain: 0.01, + }, + octaves: 10, + oscillator: { + type: "sine", + }, + pitchDecay: 0.05, + }); + } + setNote(note, time) { + const seconds = this.toSeconds(time); + const hertz = this.toFrequency(note instanceof FrequencyClass ? note.toFrequency() : note); + const maxNote = hertz * this.octaves; + this.oscillator.frequency.setValueAtTime(maxNote, seconds); + this.oscillator.frequency.exponentialRampToValueAtTime(hertz, seconds + this.toSeconds(this.pitchDecay)); + return this; + } + dispose() { + super.dispose(); + return this; + } +} +__decorate([ + range(0) +], MembraneSynth.prototype, "octaves", void 0); +__decorate([ + timeRange(0) +], MembraneSynth.prototype, "pitchDecay", void 0); + +/** + * Tone.NoiseSynth is composed of [[Noise]] through an [[AmplitudeEnvelope]]. + * ``` + * +-------+ +-------------------+ + * | Noise +>--> AmplitudeEnvelope +>--> Output + * +-------+ +-------------------+ + * ``` + * @example + * const noiseSynth = new Tone.NoiseSynth().toDestination(); + * noiseSynth.triggerAttackRelease("8n", 0.05); + * @category Instrument + */ +class NoiseSynth extends Instrument { + constructor() { + super(optionsFromArguments(NoiseSynth.getDefaults(), arguments)); + this.name = "NoiseSynth"; + const options = optionsFromArguments(NoiseSynth.getDefaults(), arguments); + this.noise = new Noise(Object.assign({ + context: this.context, + }, options.noise)); + this.envelope = new AmplitudeEnvelope(Object.assign({ + context: this.context, + }, options.envelope)); + // connect the noise to the output + this.noise.chain(this.envelope, this.output); + } + static getDefaults() { + return Object.assign(Instrument.getDefaults(), { + envelope: Object.assign(omitFromObject(Envelope.getDefaults(), Object.keys(ToneAudioNode.getDefaults())), { + decay: 0.1, + sustain: 0.0, + }), + noise: Object.assign(omitFromObject(Noise.getDefaults(), Object.keys(Source.getDefaults())), { + type: "white", + }), + }); + } + /** + * Start the attack portion of the envelopes. Unlike other + * instruments, Tone.NoiseSynth doesn't have a note. + * @example + * const noiseSynth = new Tone.NoiseSynth().toDestination(); + * noiseSynth.triggerAttack(); + */ + triggerAttack(time, velocity = 1) { + time = this.toSeconds(time); + // the envelopes + this.envelope.triggerAttack(time, velocity); + // start the noise + this.noise.start(time); + if (this.envelope.sustain === 0) { + this.noise.stop(time + this.toSeconds(this.envelope.attack) + this.toSeconds(this.envelope.decay)); + } + return this; + } + /** + * Start the release portion of the envelopes. + */ + triggerRelease(time) { + time = this.toSeconds(time); + this.envelope.triggerRelease(time); + this.noise.stop(time + this.toSeconds(this.envelope.release)); + return this; + } + sync() { + if (this._syncState()) { + this._syncMethod("triggerAttack", 0); + this._syncMethod("triggerRelease", 0); + } + return this; + } + triggerAttackRelease(duration, time, velocity = 1) { + time = this.toSeconds(time); + duration = this.toSeconds(duration); + this.triggerAttack(time, velocity); + this.triggerRelease(time + duration); + return this; + } + dispose() { + super.dispose(); + this.noise.dispose(); + this.envelope.dispose(); + return this; + } +} + +/** + * All of the classes or functions which are loaded into the AudioWorkletGlobalScope + */ +const workletContext = new Set(); +/** + * Add a class to the AudioWorkletGlobalScope + */ +function addToWorklet(classOrFunction) { + workletContext.add(classOrFunction); +} +/** + * Register a processor in the AudioWorkletGlobalScope with the given name + */ +function registerProcessor(name, classDesc) { + const processor = /* javascript */ `registerProcessor("${name}", ${classDesc})`; + workletContext.add(processor); +} +/** + * Get all of the modules which have been registered to the AudioWorkletGlobalScope + */ +function getWorkletGlobalScope() { + return Array.from(workletContext).join("\n"); +} + +class ToneAudioWorklet extends ToneAudioNode { + constructor(options) { + super(options); + this.name = "ToneAudioWorklet"; + /** + * The constructor options for the node + */ + this.workletOptions = {}; + /** + * Callback which is invoked when there is an error in the processing + */ + this.onprocessorerror = noOp; + const blobUrl = URL.createObjectURL(new Blob([getWorkletGlobalScope()], { type: "text/javascript" })); + const name = this._audioWorkletName(); + this._dummyGain = this.context.createGain(); + this._dummyParam = this._dummyGain.gain; + // Register the processor + this.context.addAudioWorkletModule(blobUrl, name).then(() => { + // create the worklet when it's read + if (!this.disposed) { + this._worklet = this.context.createAudioWorkletNode(name, this.workletOptions); + this._worklet.onprocessorerror = this.onprocessorerror.bind(this); + this.onReady(this._worklet); + } + }); + } + dispose() { + super.dispose(); + this._dummyGain.disconnect(); + if (this._worklet) { + this._worklet.port.postMessage("dispose"); + this._worklet.disconnect(); + } + return this; + } +} + +const toneAudioWorkletProcessor = /* javascript */ ` + /** + * The base AudioWorkletProcessor for use in Tone.js. Works with the [[ToneAudioWorklet]]. + */ + class ToneAudioWorkletProcessor extends AudioWorkletProcessor { + + constructor(options) { + + super(options); + /** + * If the processor was disposed or not. Keep alive until it's disposed. + */ + this.disposed = false; + /** + * The number of samples in the processing block + */ + this.blockSize = 128; + /** + * the sample rate + */ + this.sampleRate = sampleRate; + + this.port.onmessage = (event) => { + // when it receives a dispose + if (event.data === "dispose") { + this.disposed = true; + } + }; + } + } +`; +addToWorklet(toneAudioWorkletProcessor); + +const singleIOProcess = /* javascript */ ` + /** + * Abstract class for a single input/output processor. + * has a 'generate' function which processes one sample at a time + */ + class SingleIOProcessor extends ToneAudioWorkletProcessor { + + constructor(options) { + super(Object.assign(options, { + numberOfInputs: 1, + numberOfOutputs: 1 + })); + /** + * Holds the name of the parameter and a single value of that + * parameter at the current sample + * @type { [name: string]: number } + */ + this.params = {} + } + + /** + * Generate an output sample from the input sample and parameters + * @abstract + * @param input number + * @param channel number + * @param parameters { [name: string]: number } + * @returns number + */ + generate(){} + + /** + * Update the private params object with the + * values of the parameters at the given index + * @param parameters { [name: string]: Float32Array }, + * @param index number + */ + updateParams(parameters, index) { + for (const paramName in parameters) { + const param = parameters[paramName]; + if (param.length > 1) { + this.params[paramName] = parameters[paramName][index]; + } else { + this.params[paramName] = parameters[paramName][0]; + } + } + } + + /** + * Process a single frame of the audio + * @param inputs Float32Array[][] + * @param outputs Float32Array[][] + */ + process(inputs, outputs, parameters) { + const input = inputs[0]; + const output = outputs[0]; + // get the parameter values + const channelCount = Math.max(input && input.length || 0, output.length); + for (let sample = 0; sample < this.blockSize; sample++) { + this.updateParams(parameters, sample); + for (let channel = 0; channel < channelCount; channel++) { + const inputSample = input && input.length ? input[channel][sample] : 0; + output[channel][sample] = this.generate(inputSample, channel, this.params); + } + } + return !this.disposed; + } + }; +`; +addToWorklet(singleIOProcess); + +const delayLine = /* javascript */ ` + /** + * A multichannel buffer for use within an AudioWorkletProcessor as a delay line + */ + class DelayLine { + + constructor(size, channels) { + this.buffer = []; + this.writeHead = [] + this.size = size; + + // create the empty channels + for (let i = 0; i < channels; i++) { + this.buffer[i] = new Float32Array(this.size); + this.writeHead[i] = 0; + } + } + + /** + * Push a value onto the end + * @param channel number + * @param value number + */ + push(channel, value) { + this.writeHead[channel] += 1; + if (this.writeHead[channel] > this.size) { + this.writeHead[channel] = 0; + } + this.buffer[channel][this.writeHead[channel]] = value; + } + + /** + * Get the recorded value of the channel given the delay + * @param channel number + * @param delay number delay samples + */ + get(channel, delay) { + let readHead = this.writeHead[channel] - Math.floor(delay); + if (readHead < 0) { + readHead += this.size; + } + return this.buffer[channel][readHead]; + } + } +`; +addToWorklet(delayLine); + +const workletName = "feedback-comb-filter"; +const feedbackCombFilter = /* javascript */ ` + class FeedbackCombFilterWorklet extends SingleIOProcessor { + + constructor(options) { + super(options); + this.delayLine = new DelayLine(this.sampleRate, options.channelCount || 2); + } + + static get parameterDescriptors() { + return [{ + name: "delayTime", + defaultValue: 0.1, + minValue: 0, + maxValue: 1, + automationRate: "k-rate" + }, { + name: "feedback", + defaultValue: 0.5, + minValue: 0, + maxValue: 0.9999, + automationRate: "k-rate" + }]; + } + + generate(input, channel, parameters) { + const delayedSample = this.delayLine.get(channel, parameters.delayTime * this.sampleRate); + this.delayLine.push(channel, input + delayedSample * parameters.feedback); + return delayedSample; + } + } +`; +registerProcessor(workletName, feedbackCombFilter); + +/** + * Comb filters are basic building blocks for physical modeling. Read more + * about comb filters on [CCRMA's website](https://ccrma.stanford.edu/~jos/pasp/Feedback_Comb_Filters.html). + * + * This comb filter is implemented with the AudioWorkletNode which allows it to have feedback delays less than the + * Web Audio processing block of 128 samples. There is a polyfill for browsers that don't yet support the + * AudioWorkletNode, but it will add some latency and have slower performance than the AudioWorkletNode. + * @category Component + */ +class FeedbackCombFilter extends ToneAudioWorklet { + constructor() { + super(optionsFromArguments(FeedbackCombFilter.getDefaults(), arguments, ["delayTime", "resonance"])); + this.name = "FeedbackCombFilter"; + const options = optionsFromArguments(FeedbackCombFilter.getDefaults(), arguments, ["delayTime", "resonance"]); + this.input = new Gain({ context: this.context }); + this.output = new Gain({ context: this.context }); + this.delayTime = new Param({ + context: this.context, + value: options.delayTime, + units: "time", + minValue: 0, + maxValue: 1, + param: this._dummyParam, + swappable: true, + }); + this.resonance = new Param({ + context: this.context, + value: options.resonance, + units: "normalRange", + param: this._dummyParam, + swappable: true, + }); + readOnly(this, ["resonance", "delayTime"]); + } + _audioWorkletName() { + return workletName; + } + /** + * The default parameters + */ + static getDefaults() { + return Object.assign(ToneAudioNode.getDefaults(), { + delayTime: 0.1, + resonance: 0.5, + }); + } + onReady(node) { + connectSeries(this.input, node, this.output); + const delayTime = node.parameters.get("delayTime"); + this.delayTime.setParam(delayTime); + const feedback = node.parameters.get("feedback"); + this.resonance.setParam(feedback); + } + dispose() { + super.dispose(); + this.input.dispose(); + this.output.dispose(); + this.delayTime.dispose(); + this.resonance.dispose(); + return this; + } +} + +/** + * A one pole filter with 6db-per-octave rolloff. Either "highpass" or "lowpass". + * Note that changing the type or frequency may result in a discontinuity which + * can sound like a click or pop. + * References: + * * http://www.earlevel.com/main/2012/12/15/a-one-pole-filter/ + * * http://www.dspguide.com/ch19/2.htm + * * https://github.com/vitaliy-bobrov/js-rocks/blob/master/src/app/audio/effects/one-pole-filters.ts + * @category Component + */ +class OnePoleFilter extends ToneAudioNode { + constructor() { + super(optionsFromArguments(OnePoleFilter.getDefaults(), arguments, ["frequency", "type"])); + this.name = "OnePoleFilter"; + const options = optionsFromArguments(OnePoleFilter.getDefaults(), arguments, ["frequency", "type"]); + this._frequency = options.frequency; + this._type = options.type; + this.input = new Gain({ context: this.context }); + this.output = new Gain({ context: this.context }); + this._createFilter(); + } + static getDefaults() { + return Object.assign(ToneAudioNode.getDefaults(), { + frequency: 880, + type: "lowpass" + }); + } + /** + * Create a filter and dispose the old one + */ + _createFilter() { + const oldFilter = this._filter; + const freq = this.toFrequency(this._frequency); + const t = 1 / (2 * Math.PI * freq); + if (this._type === "lowpass") { + const a0 = 1 / (t * this.context.sampleRate); + const b1 = a0 - 1; + this._filter = this.context.createIIRFilter([a0, 0], [1, b1]); + } + else { + const b1 = 1 / (t * this.context.sampleRate) - 1; + this._filter = this.context.createIIRFilter([1, -1], [1, b1]); + } + this.input.chain(this._filter, this.output); + if (oldFilter) { + // dispose it on the next block + this.context.setTimeout(() => { + if (!this.disposed) { + this.input.disconnect(oldFilter); + oldFilter.disconnect(); + } + }, this.blockTime); + } + } + /** + * The frequency value. + */ + get frequency() { + return this._frequency; + } + set frequency(fq) { + this._frequency = fq; + this._createFilter(); + } + /** + * The OnePole Filter type, either "highpass" or "lowpass" + */ + get type() { + return this._type; + } + set type(t) { + this._type = t; + this._createFilter(); + } + /** + * Get the frequency response curve. This curve represents how the filter + * responses to frequencies between 20hz-20khz. + * @param len The number of values to return + * @return The frequency response curve between 20-20kHz + */ + getFrequencyResponse(len = 128) { + const freqValues = new Float32Array(len); + for (let i = 0; i < len; i++) { + const norm = Math.pow(i / len, 2); + const freq = norm * (20000 - 20) + 20; + freqValues[i] = freq; + } + const magValues = new Float32Array(len); + const phaseValues = new Float32Array(len); + this._filter.getFrequencyResponse(freqValues, magValues, phaseValues); + return magValues; + } + dispose() { + super.dispose(); + this.input.dispose(); + this.output.dispose(); + this._filter.disconnect(); + return this; + } +} + +/** + * A lowpass feedback comb filter. It is similar to + * [[FeedbackCombFilter]], but includes a lowpass filter. + * @category Component + */ +class LowpassCombFilter extends ToneAudioNode { + constructor() { + super(optionsFromArguments(LowpassCombFilter.getDefaults(), arguments, ["delayTime", "resonance", "dampening"])); + this.name = "LowpassCombFilter"; + const options = optionsFromArguments(LowpassCombFilter.getDefaults(), arguments, ["delayTime", "resonance", "dampening"]); + this._combFilter = this.output = new FeedbackCombFilter({ + context: this.context, + delayTime: options.delayTime, + resonance: options.resonance, + }); + this.delayTime = this._combFilter.delayTime; + this.resonance = this._combFilter.resonance; + this._lowpass = this.input = new OnePoleFilter({ + context: this.context, + frequency: options.dampening, + type: "lowpass", + }); + // connections + this._lowpass.connect(this._combFilter); + } + static getDefaults() { + return Object.assign(ToneAudioNode.getDefaults(), { + dampening: 3000, + delayTime: 0.1, + resonance: 0.5, + }); + } + /** + * The dampening control of the feedback + */ + get dampening() { + return this._lowpass.frequency; + } + set dampening(fq) { + this._lowpass.frequency = fq; + } + dispose() { + super.dispose(); + this._combFilter.dispose(); + this._lowpass.dispose(); + return this; + } +} + +/** + * Karplus-String string synthesis. + * @example + * const plucky = new Tone.PluckSynth().toDestination(); + * plucky.triggerAttack("C4", "+0.5"); + * plucky.triggerAttack("C3", "+1"); + * plucky.triggerAttack("C2", "+1.5"); + * plucky.triggerAttack("C1", "+2"); + * @category Instrument + */ +class PluckSynth extends Instrument { + constructor() { + super(optionsFromArguments(PluckSynth.getDefaults(), arguments)); + this.name = "PluckSynth"; + const options = optionsFromArguments(PluckSynth.getDefaults(), arguments); + this._noise = new Noise({ + context: this.context, + type: "pink" + }); + this.attackNoise = options.attackNoise; + this._lfcf = new LowpassCombFilter({ + context: this.context, + dampening: options.dampening, + resonance: options.resonance, + }); + this.resonance = options.resonance; + this.release = options.release; + this._noise.connect(this._lfcf); + this._lfcf.connect(this.output); + } + static getDefaults() { + return deepMerge(Instrument.getDefaults(), { + attackNoise: 1, + dampening: 4000, + resonance: 0.7, + release: 1, + }); + } + /** + * The dampening control. i.e. the lowpass filter frequency of the comb filter + * @min 0 + * @max 7000 + */ + get dampening() { + return this._lfcf.dampening; + } + set dampening(fq) { + this._lfcf.dampening = fq; + } + triggerAttack(note, time) { + const freq = this.toFrequency(note); + time = this.toSeconds(time); + const delayAmount = 1 / freq; + this._lfcf.delayTime.setValueAtTime(delayAmount, time); + this._noise.start(time); + this._noise.stop(time + delayAmount * this.attackNoise); + this._lfcf.resonance.cancelScheduledValues(time); + this._lfcf.resonance.setValueAtTime(this.resonance, time); + return this; + } + /** + * Ramp down the [[resonance]] to 0 over the duration of the release time. + */ + triggerRelease(time) { + this._lfcf.resonance.linearRampTo(0, this.release, time); + return this; + } + dispose() { + super.dispose(); + this._noise.dispose(); + this._lfcf.dispose(); + return this; + } +} + +/** + * PolySynth handles voice creation and allocation for any + * instruments passed in as the second paramter. PolySynth is + * not a synthesizer by itself, it merely manages voices of + * one of the other types of synths, allowing any of the + * monophonic synthesizers to be polyphonic. + * + * @example + * const synth = new Tone.PolySynth().toDestination(); + * // set the attributes across all the voices using 'set' + * synth.set({ detune: -1200 }); + * // play a chord + * synth.triggerAttackRelease(["C4", "E4", "A4"], 1); + * @category Instrument + */ +class PolySynth extends Instrument { + constructor() { + super(optionsFromArguments(PolySynth.getDefaults(), arguments, ["voice", "options"])); + this.name = "PolySynth"; + /** + * The voices which are not currently in use + */ + this._availableVoices = []; + /** + * The currently active voices + */ + this._activeVoices = []; + /** + * All of the allocated voices for this synth. + */ + this._voices = []; + /** + * The GC timeout. Held so that it could be cancelled when the node is disposed. + */ + this._gcTimeout = -1; + /** + * A moving average of the number of active voices + */ + this._averageActiveVoices = 0; + const options = optionsFromArguments(PolySynth.getDefaults(), arguments, ["voice", "options"]); + // check against the old API (pre 14.3.0) + assert(!isNumber(options.voice), "DEPRECATED: The polyphony count is no longer the first argument."); + const defaults = options.voice.getDefaults(); + this.options = Object.assign(defaults, options.options); + this.voice = options.voice; + this.maxPolyphony = options.maxPolyphony; + // create the first voice + this._dummyVoice = this._getNextAvailableVoice(); + // remove it from the voices list + const index = this._voices.indexOf(this._dummyVoice); + this._voices.splice(index, 1); + // kick off the GC interval + this._gcTimeout = this.context.setInterval(this._collectGarbage.bind(this), 1); + } + static getDefaults() { + return Object.assign(Instrument.getDefaults(), { + maxPolyphony: 32, + options: {}, + voice: Synth, + }); + } + /** + * The number of active voices. + */ + get activeVoices() { + return this._activeVoices.length; + } + /** + * Invoked when the source is done making sound, so that it can be + * readded to the pool of available voices + */ + _makeVoiceAvailable(voice) { + this._availableVoices.push(voice); + // remove the midi note from 'active voices' + const activeVoiceIndex = this._activeVoices.findIndex((e) => e.voice === voice); + this._activeVoices.splice(activeVoiceIndex, 1); + } + /** + * Get an available voice from the pool of available voices. + * If one is not available and the maxPolyphony limit is reached, + * steal a voice, otherwise return null. + */ + _getNextAvailableVoice() { + // if there are available voices, return the first one + if (this._availableVoices.length) { + return this._availableVoices.shift(); + } + else if (this._voices.length < this.maxPolyphony) { + // otherwise if there is still more maxPolyphony, make a new voice + const voice = new this.voice(Object.assign(this.options, { + context: this.context, + onsilence: this._makeVoiceAvailable.bind(this), + })); + voice.connect(this.output); + this._voices.push(voice); + return voice; + } + else { + warn("Max polyphony exceeded. Note dropped."); + } + } + /** + * Occasionally check if there are any allocated voices which can be cleaned up. + */ + _collectGarbage() { + this._averageActiveVoices = Math.max(this._averageActiveVoices * 0.95, this.activeVoices); + if (this._availableVoices.length && this._voices.length > Math.ceil(this._averageActiveVoices + 1)) { + // take off an available note + const firstAvail = this._availableVoices.shift(); + const index = this._voices.indexOf(firstAvail); + this._voices.splice(index, 1); + if (!this.context.isOffline) { + firstAvail.dispose(); + } + } + } + /** + * Internal method which triggers the attack + */ + _triggerAttack(notes, time, velocity) { + notes.forEach(note => { + const midiNote = new MidiClass(this.context, note).toMidi(); + const voice = this._getNextAvailableVoice(); + if (voice) { + voice.triggerAttack(note, time, velocity); + this._activeVoices.push({ + midi: midiNote, voice, released: false, + }); + this.log("triggerAttack", note, time); + } + }); + } + /** + * Internal method which triggers the release + */ + _triggerRelease(notes, time) { + notes.forEach(note => { + const midiNote = new MidiClass(this.context, note).toMidi(); + const event = this._activeVoices.find(({ midi, released }) => midi === midiNote && !released); + if (event) { + // trigger release on that note + event.voice.triggerRelease(time); + // mark it as released + event.released = true; + this.log("triggerRelease", note, time); + } + }); + } + /** + * Schedule the attack/release events. If the time is in the future, then it should set a timeout + * to wait for just-in-time scheduling + */ + _scheduleEvent(type, notes, time, velocity) { + assert(!this.disposed, "Synth was already disposed"); + // if the notes are greater than this amount of time in the future, they should be scheduled with setTimeout + if (time <= this.now()) { + // do it immediately + if (type === "attack") { + this._triggerAttack(notes, time, velocity); + } + else { + this._triggerRelease(notes, time); + } + } + else { + // schedule it to start in the future + this.context.setTimeout(() => { + this._scheduleEvent(type, notes, time, velocity); + }, time - this.now()); + } + } + /** + * Trigger the attack portion of the note + * @param notes The notes to play. Accepts a single Frequency or an array of frequencies. + * @param time The start time of the note. + * @param velocity The velocity of the note. + * @example + * const synth = new Tone.PolySynth(Tone.FMSynth).toDestination(); + * // trigger a chord immediately with a velocity of 0.2 + * synth.triggerAttack(["Ab3", "C4", "F5"], Tone.now(), 0.2); + */ + triggerAttack(notes, time, velocity) { + if (!Array.isArray(notes)) { + notes = [notes]; + } + const computedTime = this.toSeconds(time); + this._scheduleEvent("attack", notes, computedTime, velocity); + return this; + } + /** + * Trigger the release of the note. Unlike monophonic instruments, + * a note (or array of notes) needs to be passed in as the first argument. + * @param notes The notes to play. Accepts a single Frequency or an array of frequencies. + * @param time When the release will be triggered. + * @example + * @example + * const poly = new Tone.PolySynth(Tone.AMSynth).toDestination(); + * poly.triggerAttack(["Ab3", "C4", "F5"]); + * // trigger the release of the given notes. + * poly.triggerRelease(["Ab3", "C4"], "+1"); + * poly.triggerRelease("F5", "+3"); + */ + triggerRelease(notes, time) { + if (!Array.isArray(notes)) { + notes = [notes]; + } + const computedTime = this.toSeconds(time); + this._scheduleEvent("release", notes, computedTime); + return this; + } + /** + * Trigger the attack and release after the specified duration + * @param notes The notes to play. Accepts a single Frequency or an array of frequencies. + * @param duration the duration of the note + * @param time if no time is given, defaults to now + * @param velocity the velocity of the attack (0-1) + * @example + * const poly = new Tone.PolySynth(Tone.AMSynth).toDestination(); + * // can pass in an array of durations as well + * poly.triggerAttackRelease(["Eb3", "G4", "Bb4", "D5"], [4, 3, 2, 1]); + */ + triggerAttackRelease(notes, duration, time, velocity) { + const computedTime = this.toSeconds(time); + this.triggerAttack(notes, computedTime, velocity); + if (isArray(duration)) { + assert(isArray(notes), "If the duration is an array, the notes must also be an array"); + notes = notes; + for (let i = 0; i < notes.length; i++) { + const d = duration[Math.min(i, duration.length - 1)]; + const durationSeconds = this.toSeconds(d); + assert(durationSeconds > 0, "The duration must be greater than 0"); + this.triggerRelease(notes[i], computedTime + durationSeconds); + } + } + else { + const durationSeconds = this.toSeconds(duration); + assert(durationSeconds > 0, "The duration must be greater than 0"); + this.triggerRelease(notes, computedTime + durationSeconds); + } + return this; + } + sync() { + if (this._syncState()) { + this._syncMethod("triggerAttack", 1); + this._syncMethod("triggerRelease", 1); + } + return this; + } + /** + * Set a member/attribute of the voices + * @example + * const poly = new Tone.PolySynth().toDestination(); + * // set all of the voices using an options object for the synth type + * poly.set({ + * envelope: { + * attack: 0.25 + * } + * }); + * poly.triggerAttackRelease("Bb3", 0.2); + */ + set(options) { + // remove options which are controlled by the PolySynth + const sanitizedOptions = omitFromObject(options, ["onsilence", "context"]); + // store all of the options + this.options = deepMerge(this.options, sanitizedOptions); + this._voices.forEach(voice => voice.set(sanitizedOptions)); + this._dummyVoice.set(sanitizedOptions); + return this; + } + get() { + return this._dummyVoice.get(); + } + /** + * Trigger the release portion of all the currently active voices immediately. + * Useful for silencing the synth. + */ + releaseAll(time) { + const computedTime = this.toSeconds(time); + this._activeVoices.forEach(({ voice }) => { + voice.triggerRelease(computedTime); + }); + return this; + } + dispose() { + super.dispose(); + this._dummyVoice.dispose(); + this._voices.forEach(v => v.dispose()); + this._activeVoices = []; + this._availableVoices = []; + this.context.clearInterval(this._gcTimeout); + return this; + } +} + +/** + * Pass in an object which maps the note's pitch or midi value to the url, + * then you can trigger the attack and release of that note like other instruments. + * By automatically repitching the samples, it is possible to play pitches which + * were not explicitly included which can save loading time. + * + * For sample or buffer playback where repitching is not necessary, + * use [[Player]]. + * @example + * const sampler = new Tone.Sampler({ + * urls: { + * A1: "A1.mp3", + * A2: "A2.mp3", + * }, + * baseUrl: "https://tonejs.github.io/audio/casio/", + * onload: () => { + * sampler.triggerAttackRelease(["C1", "E1", "G1", "B1"], 0.5); + * } + * }).toDestination(); + * @category Instrument + */ +class Sampler extends Instrument { + constructor() { + super(optionsFromArguments(Sampler.getDefaults(), arguments, ["urls", "onload", "baseUrl"], "urls")); + this.name = "Sampler"; + /** + * The object of all currently playing BufferSources + */ + this._activeSources = new Map(); + const options = optionsFromArguments(Sampler.getDefaults(), arguments, ["urls", "onload", "baseUrl"], "urls"); + const urlMap = {}; + Object.keys(options.urls).forEach((note) => { + const noteNumber = parseInt(note, 10); + assert(isNote(note) + || (isNumber(noteNumber) && isFinite(noteNumber)), `url key is neither a note or midi pitch: ${note}`); + if (isNote(note)) { + // convert the note name to MIDI + const mid = new FrequencyClass(this.context, note).toMidi(); + urlMap[mid] = options.urls[note]; + } + else if (isNumber(noteNumber) && isFinite(noteNumber)) { + // otherwise if it's numbers assume it's midi + urlMap[noteNumber] = options.urls[noteNumber]; + } + }); + this._buffers = new ToneAudioBuffers({ + urls: urlMap, + onload: options.onload, + baseUrl: options.baseUrl, + onerror: options.onerror, + }); + this.attack = options.attack; + this.release = options.release; + this.curve = options.curve; + // invoke the callback if it's already loaded + if (this._buffers.loaded) { + // invoke onload deferred + Promise.resolve().then(options.onload); + } + } + static getDefaults() { + return Object.assign(Instrument.getDefaults(), { + attack: 0, + baseUrl: "", + curve: "exponential", + onload: noOp, + onerror: noOp, + release: 0.1, + urls: {}, + }); + } + /** + * Returns the difference in steps between the given midi note at the closets sample. + */ + _findClosest(midi) { + // searches within 8 octaves of the given midi note + const MAX_INTERVAL = 96; + let interval = 0; + while (interval < MAX_INTERVAL) { + // check above and below + if (this._buffers.has(midi + interval)) { + return -interval; + } + else if (this._buffers.has(midi - interval)) { + return interval; + } + interval++; + } + throw new Error(`No available buffers for note: ${midi}`); + } + /** + * @param notes The note to play, or an array of notes. + * @param time When to play the note + * @param velocity The velocity to play the sample back. + */ + triggerAttack(notes, time, velocity = 1) { + this.log("triggerAttack", notes, time, velocity); + if (!Array.isArray(notes)) { + notes = [notes]; + } + notes.forEach(note => { + const midiFloat = ftomf(new FrequencyClass(this.context, note).toFrequency()); + const midi = Math.round(midiFloat); + const remainder = midiFloat - midi; + // find the closest note pitch + const difference = this._findClosest(midi); + const closestNote = midi - difference; + const buffer = this._buffers.get(closestNote); + const playbackRate = intervalToFrequencyRatio(difference + remainder); + // play that note + const source = new ToneBufferSource({ + url: buffer, + context: this.context, + curve: this.curve, + fadeIn: this.attack, + fadeOut: this.release, + playbackRate, + }).connect(this.output); + source.start(time, 0, buffer.duration / playbackRate, velocity); + // add it to the active sources + if (!isArray(this._activeSources.get(midi))) { + this._activeSources.set(midi, []); + } + this._activeSources.get(midi).push(source); + // remove it when it's done + source.onended = () => { + if (this._activeSources && this._activeSources.has(midi)) { + const sources = this._activeSources.get(midi); + const index = sources.indexOf(source); + if (index !== -1) { + sources.splice(index, 1); + } + } + }; + }); + return this; + } + /** + * @param notes The note to release, or an array of notes. + * @param time When to release the note. + */ + triggerRelease(notes, time) { + this.log("triggerRelease", notes, time); + if (!Array.isArray(notes)) { + notes = [notes]; + } + notes.forEach(note => { + const midi = new FrequencyClass(this.context, note).toMidi(); + // find the note + if (this._activeSources.has(midi) && this._activeSources.get(midi).length) { + const sources = this._activeSources.get(midi); + time = this.toSeconds(time); + sources.forEach(source => { + source.stop(time); + }); + this._activeSources.set(midi, []); + } + }); + return this; + } + /** + * Release all currently active notes. + * @param time When to release the notes. + */ + releaseAll(time) { + const computedTime = this.toSeconds(time); + this._activeSources.forEach(sources => { + while (sources.length) { + const source = sources.shift(); + source.stop(computedTime); + } + }); + return this; + } + sync() { + if (this._syncState()) { + this._syncMethod("triggerAttack", 1); + this._syncMethod("triggerRelease", 1); + } + return this; + } + /** + * Invoke the attack phase, then after the duration, invoke the release. + * @param notes The note to play and release, or an array of notes. + * @param duration The time the note should be held + * @param time When to start the attack + * @param velocity The velocity of the attack + */ + triggerAttackRelease(notes, duration, time, velocity = 1) { + const computedTime = this.toSeconds(time); + this.triggerAttack(notes, computedTime, velocity); + if (isArray(duration)) { + assert(isArray(notes), "notes must be an array when duration is array"); + notes.forEach((note, index) => { + const d = duration[Math.min(index, duration.length - 1)]; + this.triggerRelease(note, computedTime + this.toSeconds(d)); + }); + } + else { + this.triggerRelease(notes, computedTime + this.toSeconds(duration)); + } + return this; + } + /** + * Add a note to the sampler. + * @param note The buffer's pitch. + * @param url Either the url of the buffer, or a buffer which will be added with the given name. + * @param callback The callback to invoke when the url is loaded. + */ + add(note, url, callback) { + assert(isNote(note) || isFinite(note), `note must be a pitch or midi: ${note}`); + if (isNote(note)) { + // convert the note name to MIDI + const mid = new FrequencyClass(this.context, note).toMidi(); + this._buffers.add(mid, url, callback); + } + else { + // otherwise if it's numbers assume it's midi + this._buffers.add(note, url, callback); + } + return this; + } + /** + * If the buffers are loaded or not + */ + get loaded() { + return this._buffers.loaded; + } + /** + * Clean up + */ + dispose() { + super.dispose(); + this._buffers.dispose(); + this._activeSources.forEach(sources => { + sources.forEach(source => source.dispose()); + }); + this._activeSources.clear(); + return this; + } +} +__decorate([ + timeRange(0) +], Sampler.prototype, "attack", void 0); +__decorate([ + timeRange(0) +], Sampler.prototype, "release", void 0); + +/** + * ToneEvent abstracts away this.context.transport.schedule and provides a schedulable + * callback for a single or repeatable events along the timeline. + * + * @example + * const synth = new Tone.PolySynth().toDestination(); + * const chordEvent = new Tone.ToneEvent(((time, chord) => { + * // the chord as well as the exact time of the event + * // are passed in as arguments to the callback function + * synth.triggerAttackRelease(chord, 0.5, time); + * }), ["D4", "E4", "F4"]); + * // start the chord at the beginning of the transport timeline + * chordEvent.start(); + * // loop it every measure for 8 measures + * chordEvent.loop = 8; + * chordEvent.loopEnd = "1m"; + * @category Event + */ +class ToneEvent extends ToneWithContext { + constructor() { + super(optionsFromArguments(ToneEvent.getDefaults(), arguments, ["callback", "value"])); + this.name = "ToneEvent"; + /** + * Tracks the scheduled events + */ + this._state = new StateTimeline("stopped"); + /** + * A delay time from when the event is scheduled to start + */ + this._startOffset = 0; + const options = optionsFromArguments(ToneEvent.getDefaults(), arguments, ["callback", "value"]); + this._loop = options.loop; + this.callback = options.callback; + this.value = options.value; + this._loopStart = this.toTicks(options.loopStart); + this._loopEnd = this.toTicks(options.loopEnd); + this._playbackRate = options.playbackRate; + this._probability = options.probability; + this._humanize = options.humanize; + this.mute = options.mute; + this._playbackRate = options.playbackRate; + this._state.increasing = true; + // schedule the events for the first time + this._rescheduleEvents(); + } + static getDefaults() { + return Object.assign(ToneWithContext.getDefaults(), { + callback: noOp, + humanize: false, + loop: false, + loopEnd: "1m", + loopStart: 0, + mute: false, + playbackRate: 1, + probability: 1, + value: null, + }); + } + /** + * Reschedule all of the events along the timeline + * with the updated values. + * @param after Only reschedules events after the given time. + */ + _rescheduleEvents(after = -1) { + // if no argument is given, schedules all of the events + this._state.forEachFrom(after, event => { + let duration; + if (event.state === "started") { + if (event.id !== -1) { + this.context.transport.clear(event.id); + } + const startTick = event.time + Math.round(this.startOffset / this._playbackRate); + if (this._loop === true || isNumber(this._loop) && this._loop > 1) { + duration = Infinity; + if (isNumber(this._loop)) { + duration = (this._loop) * this._getLoopDuration(); + } + const nextEvent = this._state.getAfter(startTick); + if (nextEvent !== null) { + duration = Math.min(duration, nextEvent.time - startTick); + } + if (duration !== Infinity) { + // schedule a stop since it's finite duration + this._state.setStateAtTime("stopped", startTick + duration + 1, { id: -1 }); + duration = new TicksClass(this.context, duration); + } + const interval = new TicksClass(this.context, this._getLoopDuration()); + event.id = this.context.transport.scheduleRepeat(this._tick.bind(this), interval, new TicksClass(this.context, startTick), duration); + } + else { + event.id = this.context.transport.schedule(this._tick.bind(this), new TicksClass(this.context, startTick)); + } + } + }); + } + /** + * Returns the playback state of the note, either "started" or "stopped". + */ + get state() { + return this._state.getValueAtTime(this.context.transport.ticks); + } + /** + * The start from the scheduled start time. + */ + get startOffset() { + return this._startOffset; + } + set startOffset(offset) { + this._startOffset = offset; + } + /** + * The probability of the notes being triggered. + */ + get probability() { + return this._probability; + } + set probability(prob) { + this._probability = prob; + } + /** + * If set to true, will apply small random variation + * to the callback time. If the value is given as a time, it will randomize + * by that amount. + * @example + * const event = new Tone.ToneEvent(); + * event.humanize = true; + */ + get humanize() { + return this._humanize; + } + set humanize(variation) { + this._humanize = variation; + } + /** + * Start the note at the given time. + * @param time When the event should start. + */ + start(time) { + const ticks = this.toTicks(time); + if (this._state.getValueAtTime(ticks) === "stopped") { + this._state.add({ + id: -1, + state: "started", + time: ticks, + }); + this._rescheduleEvents(ticks); + } + return this; + } + /** + * Stop the Event at the given time. + * @param time When the event should stop. + */ + stop(time) { + this.cancel(time); + const ticks = this.toTicks(time); + if (this._state.getValueAtTime(ticks) === "started") { + this._state.setStateAtTime("stopped", ticks, { id: -1 }); + const previousEvent = this._state.getBefore(ticks); + let reschedulTime = ticks; + if (previousEvent !== null) { + reschedulTime = previousEvent.time; + } + this._rescheduleEvents(reschedulTime); + } + return this; + } + /** + * Cancel all scheduled events greater than or equal to the given time + * @param time The time after which events will be cancel. + */ + cancel(time) { + time = defaultArg(time, -Infinity); + const ticks = this.toTicks(time); + this._state.forEachFrom(ticks, event => { + this.context.transport.clear(event.id); + }); + this._state.cancel(ticks); + return this; + } + /** + * The callback function invoker. Also + * checks if the Event is done playing + * @param time The time of the event in seconds + */ + _tick(time) { + const ticks = this.context.transport.getTicksAtTime(time); + if (!this.mute && this._state.getValueAtTime(ticks) === "started") { + if (this.probability < 1 && Math.random() > this.probability) { + return; + } + if (this.humanize) { + let variation = 0.02; + if (!isBoolean(this.humanize)) { + variation = this.toSeconds(this.humanize); + } + time += (Math.random() * 2 - 1) * variation; + } + this.callback(time, this.value); + } + } + /** + * Get the duration of the loop. + */ + _getLoopDuration() { + return Math.round((this._loopEnd - this._loopStart) / this._playbackRate); + } + /** + * If the note should loop or not + * between ToneEvent.loopStart and + * ToneEvent.loopEnd. If set to true, + * the event will loop indefinitely, + * if set to a number greater than 1 + * it will play a specific number of + * times, if set to false, 0 or 1, the + * part will only play once. + */ + get loop() { + return this._loop; + } + set loop(loop) { + this._loop = loop; + this._rescheduleEvents(); + } + /** + * The playback rate of the note. Defaults to 1. + * @example + * const note = new Tone.ToneEvent(); + * note.loop = true; + * // repeat the note twice as fast + * note.playbackRate = 2; + */ + get playbackRate() { + return this._playbackRate; + } + set playbackRate(rate) { + this._playbackRate = rate; + this._rescheduleEvents(); + } + /** + * The loopEnd point is the time the event will loop + * if ToneEvent.loop is true. + */ + get loopEnd() { + return new TicksClass(this.context, this._loopEnd).toSeconds(); + } + set loopEnd(loopEnd) { + this._loopEnd = this.toTicks(loopEnd); + if (this._loop) { + this._rescheduleEvents(); + } + } + /** + * The time when the loop should start. + */ + get loopStart() { + return new TicksClass(this.context, this._loopStart).toSeconds(); + } + set loopStart(loopStart) { + this._loopStart = this.toTicks(loopStart); + if (this._loop) { + this._rescheduleEvents(); + } + } + /** + * The current progress of the loop interval. + * Returns 0 if the event is not started yet or + * it is not set to loop. + */ + get progress() { + if (this._loop) { + const ticks = this.context.transport.ticks; + const lastEvent = this._state.get(ticks); + if (lastEvent !== null && lastEvent.state === "started") { + const loopDuration = this._getLoopDuration(); + const progress = (ticks - lastEvent.time) % loopDuration; + return progress / loopDuration; + } + else { + return 0; + } + } + else { + return 0; + } + } + dispose() { + super.dispose(); + this.cancel(); + this._state.dispose(); + return this; + } +} + +/** + * Loop creates a looped callback at the + * specified interval. The callback can be + * started, stopped and scheduled along + * the Transport's timeline. + * @example + * const loop = new Tone.Loop((time) => { + * // triggered every eighth note. + * console.log(time); + * }, "8n").start(0); + * Tone.Transport.start(); + * @category Event + */ +class Loop extends ToneWithContext { + constructor() { + super(optionsFromArguments(Loop.getDefaults(), arguments, ["callback", "interval"])); + this.name = "Loop"; + const options = optionsFromArguments(Loop.getDefaults(), arguments, ["callback", "interval"]); + this._event = new ToneEvent({ + context: this.context, + callback: this._tick.bind(this), + loop: true, + loopEnd: options.interval, + playbackRate: options.playbackRate, + probability: options.probability + }); + this.callback = options.callback; + // set the iterations + this.iterations = options.iterations; + } + static getDefaults() { + return Object.assign(ToneWithContext.getDefaults(), { + interval: "4n", + callback: noOp, + playbackRate: 1, + iterations: Infinity, + probability: 1, + mute: false, + humanize: false + }); + } + /** + * Start the loop at the specified time along the Transport's timeline. + * @param time When to start the Loop. + */ + start(time) { + this._event.start(time); + return this; + } + /** + * Stop the loop at the given time. + * @param time When to stop the Loop. + */ + stop(time) { + this._event.stop(time); + return this; + } + /** + * Cancel all scheduled events greater than or equal to the given time + * @param time The time after which events will be cancel. + */ + cancel(time) { + this._event.cancel(time); + return this; + } + /** + * Internal function called when the notes should be called + * @param time The time the event occurs + */ + _tick(time) { + this.callback(time); + } + /** + * The state of the Loop, either started or stopped. + */ + get state() { + return this._event.state; + } + /** + * The progress of the loop as a value between 0-1. 0, when the loop is stopped or done iterating. + */ + get progress() { + return this._event.progress; + } + /** + * The time between successive callbacks. + * @example + * const loop = new Tone.Loop(); + * loop.interval = "8n"; // loop every 8n + */ + get interval() { + return this._event.loopEnd; + } + set interval(interval) { + this._event.loopEnd = interval; + } + /** + * The playback rate of the loop. The normal playback rate is 1 (no change). + * A `playbackRate` of 2 would be twice as fast. + */ + get playbackRate() { + return this._event.playbackRate; + } + set playbackRate(rate) { + this._event.playbackRate = rate; + } + /** + * Random variation +/-0.01s to the scheduled time. + * Or give it a time value which it will randomize by. + */ + get humanize() { + return this._event.humanize; + } + set humanize(variation) { + this._event.humanize = variation; + } + /** + * The probably of the callback being invoked. + */ + get probability() { + return this._event.probability; + } + set probability(prob) { + this._event.probability = prob; + } + /** + * Muting the Loop means that no callbacks are invoked. + */ + get mute() { + return this._event.mute; + } + set mute(mute) { + this._event.mute = mute; + } + /** + * The number of iterations of the loop. The default value is `Infinity` (loop forever). + */ + get iterations() { + if (this._event.loop === true) { + return Infinity; + } + else { + return this._event.loop; + } + } + set iterations(iters) { + if (iters === Infinity) { + this._event.loop = true; + } + else { + this._event.loop = iters; + } + } + dispose() { + super.dispose(); + this._event.dispose(); + return this; + } +} + +/** + * Part is a collection ToneEvents which can be started/stopped and looped as a single unit. + * + * @example + * const synth = new Tone.Synth().toDestination(); + * const part = new Tone.Part(((time, note) => { + * // the notes given as the second element in the array + * // will be passed in as the second argument + * synth.triggerAttackRelease(note, "8n", time); + * }), [[0, "C2"], ["0:2", "C3"], ["0:3:2", "G2"]]); + * Tone.Transport.start(); + * @example + * const synth = new Tone.Synth().toDestination(); + * // use an array of objects as long as the object has a "time" attribute + * const part = new Tone.Part(((time, value) => { + * // the value is an object which contains both the note and the velocity + * synth.triggerAttackRelease(value.note, "8n", time, value.velocity); + * }), [{ time: 0, note: "C3", velocity: 0.9 }, + * { time: "0:2", note: "C4", velocity: 0.5 } + * ]).start(0); + * Tone.Transport.start(); + * @category Event + */ +class Part extends ToneEvent { + constructor() { + super(optionsFromArguments(Part.getDefaults(), arguments, ["callback", "events"])); + this.name = "Part"; + /** + * Tracks the scheduled events + */ + this._state = new StateTimeline("stopped"); + /** + * The events that belong to this part + */ + this._events = new Set(); + const options = optionsFromArguments(Part.getDefaults(), arguments, ["callback", "events"]); + // make sure things are assigned in the right order + this._state.increasing = true; + // add the events + options.events.forEach(event => { + if (isArray(event)) { + this.add(event[0], event[1]); + } + else { + this.add(event); + } + }); + } + static getDefaults() { + return Object.assign(ToneEvent.getDefaults(), { + events: [], + }); + } + /** + * Start the part at the given time. + * @param time When to start the part. + * @param offset The offset from the start of the part to begin playing at. + */ + start(time, offset) { + const ticks = this.toTicks(time); + if (this._state.getValueAtTime(ticks) !== "started") { + offset = defaultArg(offset, this._loop ? this._loopStart : 0); + if (this._loop) { + offset = defaultArg(offset, this._loopStart); + } + else { + offset = defaultArg(offset, 0); + } + const computedOffset = this.toTicks(offset); + this._state.add({ + id: -1, + offset: computedOffset, + state: "started", + time: ticks, + }); + this._forEach(event => { + this._startNote(event, ticks, computedOffset); + }); + } + return this; + } + /** + * Start the event in the given event at the correct time given + * the ticks and offset and looping. + * @param event + * @param ticks + * @param offset + */ + _startNote(event, ticks, offset) { + ticks -= offset; + if (this._loop) { + if (event.startOffset >= this._loopStart && event.startOffset < this._loopEnd) { + if (event.startOffset < offset) { + // start it on the next loop + ticks += this._getLoopDuration(); + } + event.start(new TicksClass(this.context, ticks)); + } + else if (event.startOffset < this._loopStart && event.startOffset >= offset) { + event.loop = false; + event.start(new TicksClass(this.context, ticks)); + } + } + else if (event.startOffset >= offset) { + event.start(new TicksClass(this.context, ticks)); + } + } + get startOffset() { + return this._startOffset; + } + set startOffset(offset) { + this._startOffset = offset; + this._forEach(event => { + event.startOffset += this._startOffset; + }); + } + /** + * Stop the part at the given time. + * @param time When to stop the part. + */ + stop(time) { + const ticks = this.toTicks(time); + this._state.cancel(ticks); + this._state.setStateAtTime("stopped", ticks); + this._forEach(event => { + event.stop(time); + }); + return this; + } + /** + * Get/Set an Event's value at the given time. + * If a value is passed in and no event exists at + * the given time, one will be created with that value. + * If two events are at the same time, the first one will + * be returned. + * @example + * const part = new Tone.Part(); + * part.at("1m"); // returns the part at the first measure + * part.at("2m", "C2"); // set the value at "2m" to C2. + * // if an event didn't exist at that time, it will be created. + * @param time The time of the event to get or set. + * @param value If a value is passed in, the value of the event at the given time will be set to it. + */ + at(time, value) { + const timeInTicks = new TransportTimeClass(this.context, time).toTicks(); + const tickTime = new TicksClass(this.context, 1).toSeconds(); + const iterator = this._events.values(); + let result = iterator.next(); + while (!result.done) { + const event = result.value; + if (Math.abs(timeInTicks - event.startOffset) < tickTime) { + if (isDefined(value)) { + event.value = value; + } + return event; + } + result = iterator.next(); + } + // if there was no event at that time, create one + if (isDefined(value)) { + this.add(time, value); + // return the new event + return this.at(time); + } + else { + return null; + } + } + add(time, value) { + // extract the parameters + if (time instanceof Object && Reflect.has(time, "time")) { + value = time; + time = value.time; + } + const ticks = this.toTicks(time); + let event; + if (value instanceof ToneEvent) { + event = value; + event.callback = this._tick.bind(this); + } + else { + event = new ToneEvent({ + callback: this._tick.bind(this), + context: this.context, + value, + }); + } + // the start offset + event.startOffset = ticks; + // initialize the values + event.set({ + humanize: this.humanize, + loop: this.loop, + loopEnd: this.loopEnd, + loopStart: this.loopStart, + playbackRate: this.playbackRate, + probability: this.probability, + }); + this._events.add(event); + // start the note if it should be played right now + this._restartEvent(event); + return this; + } + /** + * Restart the given event + */ + _restartEvent(event) { + this._state.forEach((stateEvent) => { + if (stateEvent.state === "started") { + this._startNote(event, stateEvent.time, stateEvent.offset); + } + else { + // stop the note + event.stop(new TicksClass(this.context, stateEvent.time)); + } + }); + } + remove(time, value) { + // extract the parameters + if (isObject(time) && time.hasOwnProperty("time")) { + value = time; + time = value.time; + } + time = this.toTicks(time); + this._events.forEach(event => { + if (event.startOffset === time) { + if (isUndef(value) || (isDefined(value) && event.value === value)) { + this._events.delete(event); + event.dispose(); + } + } + }); + return this; + } + /** + * Remove all of the notes from the group. + */ + clear() { + this._forEach(event => event.dispose()); + this._events.clear(); + return this; + } + /** + * Cancel scheduled state change events: i.e. "start" and "stop". + * @param after The time after which to cancel the scheduled events. + */ + cancel(after) { + this._forEach(event => event.cancel(after)); + this._state.cancel(this.toTicks(after)); + return this; + } + /** + * Iterate over all of the events + */ + _forEach(callback) { + if (this._events) { + this._events.forEach(event => { + if (event instanceof Part) { + event._forEach(callback); + } + else { + callback(event); + } + }); + } + return this; + } + /** + * Set the attribute of all of the events + * @param attr the attribute to set + * @param value The value to set it to + */ + _setAll(attr, value) { + this._forEach(event => { + event[attr] = value; + }); + } + /** + * Internal tick method + * @param time The time of the event in seconds + */ + _tick(time, value) { + if (!this.mute) { + this.callback(time, value); + } + } + /** + * Determine if the event should be currently looping + * given the loop boundries of this Part. + * @param event The event to test + */ + _testLoopBoundries(event) { + if (this._loop && (event.startOffset < this._loopStart || event.startOffset >= this._loopEnd)) { + event.cancel(0); + } + else if (event.state === "stopped") { + // reschedule it if it's stopped + this._restartEvent(event); + } + } + get probability() { + return this._probability; + } + set probability(prob) { + this._probability = prob; + this._setAll("probability", prob); + } + get humanize() { + return this._humanize; + } + set humanize(variation) { + this._humanize = variation; + this._setAll("humanize", variation); + } + /** + * If the part should loop or not + * between Part.loopStart and + * Part.loopEnd. If set to true, + * the part will loop indefinitely, + * if set to a number greater than 1 + * it will play a specific number of + * times, if set to false, 0 or 1, the + * part will only play once. + * @example + * const part = new Tone.Part(); + * // loop the part 8 times + * part.loop = 8; + */ + get loop() { + return this._loop; + } + set loop(loop) { + this._loop = loop; + this._forEach(event => { + event.loopStart = this.loopStart; + event.loopEnd = this.loopEnd; + event.loop = loop; + this._testLoopBoundries(event); + }); + } + /** + * The loopEnd point determines when it will + * loop if Part.loop is true. + */ + get loopEnd() { + return new TicksClass(this.context, this._loopEnd).toSeconds(); + } + set loopEnd(loopEnd) { + this._loopEnd = this.toTicks(loopEnd); + if (this._loop) { + this._forEach(event => { + event.loopEnd = loopEnd; + this._testLoopBoundries(event); + }); + } + } + /** + * The loopStart point determines when it will + * loop if Part.loop is true. + */ + get loopStart() { + return new TicksClass(this.context, this._loopStart).toSeconds(); + } + set loopStart(loopStart) { + this._loopStart = this.toTicks(loopStart); + if (this._loop) { + this._forEach(event => { + event.loopStart = this.loopStart; + this._testLoopBoundries(event); + }); + } + } + /** + * The playback rate of the part + */ + get playbackRate() { + return this._playbackRate; + } + set playbackRate(rate) { + this._playbackRate = rate; + this._setAll("playbackRate", rate); + } + /** + * The number of scheduled notes in the part. + */ + get length() { + return this._events.size; + } + dispose() { + super.dispose(); + this.clear(); + return this; + } +} + +/** + * Start at the first value and go up to the last + */ +function* upPatternGen(values) { + let index = 0; + while (index < values.length) { + index = clampToArraySize(index, values); + yield values[index]; + index++; + } +} +/** + * Start at the last value and go down to 0 + */ +function* downPatternGen(values) { + let index = values.length - 1; + while (index >= 0) { + index = clampToArraySize(index, values); + yield values[index]; + index--; + } +} +/** + * Infinitely yield the generator + */ +function* infiniteGen(values, gen) { + while (true) { + yield* gen(values); + } +} +/** + * Make sure that the index is in the given range + */ +function clampToArraySize(index, values) { + return clamp(index, 0, values.length - 1); +} +/** + * Alternate between two generators + */ +function* alternatingGenerator(values, directionUp) { + let index = directionUp ? 0 : values.length - 1; + while (true) { + index = clampToArraySize(index, values); + yield values[index]; + if (directionUp) { + index++; + if (index >= values.length - 1) { + directionUp = false; + } + } + else { + index--; + if (index <= 0) { + directionUp = true; + } + } + } +} +/** + * Starting from the bottom move up 2, down 1 + */ +function* jumpUp(values) { + let index = 0; + let stepIndex = 0; + while (index < values.length) { + index = clampToArraySize(index, values); + yield values[index]; + stepIndex++; + index += (stepIndex % 2 ? 2 : -1); + } +} +/** + * Starting from the top move down 2, up 1 + */ +function* jumpDown(values) { + let index = values.length - 1; + let stepIndex = 0; + while (index >= 0) { + index = clampToArraySize(index, values); + yield values[index]; + stepIndex++; + index += (stepIndex % 2 ? -2 : 1); + } +} +/** + * Choose a random index each time + */ +function* randomGen(values) { + while (true) { + const randomIndex = Math.floor(Math.random() * values.length); + yield values[randomIndex]; + } +} +/** + * Randomly go through all of the values once before choosing a new random order + */ +function* randomOnce(values) { + // create an array of indices + const copy = []; + for (let i = 0; i < values.length; i++) { + copy.push(i); + } + while (copy.length > 0) { + // random choose an index, and then remove it so it's not chosen again + const randVal = copy.splice(Math.floor(copy.length * Math.random()), 1); + const index = clampToArraySize(randVal[0], values); + yield values[index]; + } +} +/** + * Randomly choose to walk up or down 1 index in the values array + */ +function* randomWalk(values) { + // randomly choose a starting index in the values array + let index = Math.floor(Math.random() * values.length); + while (true) { + if (index === 0) { + index++; // at bottom of array, so force upward step + } + else if (index === values.length - 1) { + index--; // at top of array, so force downward step + } + else if (Math.random() < 0.5) { // else choose random downward or upward step + index--; + } + else { + index++; + } + yield values[index]; + } +} +/** + * PatternGenerator returns a generator which will iterate over the given array + * of values and yield the items according to the passed in pattern + * @param values An array of values to iterate over + * @param pattern The name of the pattern use when iterating over + * @param index Where to start in the offset of the values array + */ +function* PatternGenerator(values, pattern = "up", index = 0) { + // safeguards + assert(values.length > 0, "The array must have more than one value in it"); + switch (pattern) { + case "up": + yield* infiniteGen(values, upPatternGen); + case "down": + yield* infiniteGen(values, downPatternGen); + case "upDown": + yield* alternatingGenerator(values, true); + case "downUp": + yield* alternatingGenerator(values, false); + case "alternateUp": + yield* infiniteGen(values, jumpUp); + case "alternateDown": + yield* infiniteGen(values, jumpDown); + case "random": + yield* randomGen(values); + case "randomOnce": + yield* infiniteGen(values, randomOnce); + case "randomWalk": + yield* randomWalk(values); + } +} + +/** + * Pattern arpeggiates between the given notes + * in a number of patterns. + * @example + * const pattern = new Tone.Pattern((time, note) => { + * // the order of the notes passed in depends on the pattern + * }, ["C2", "D4", "E5", "A6"], "upDown"); + * @category Event + */ +class Pattern extends Loop { + constructor() { + super(optionsFromArguments(Pattern.getDefaults(), arguments, ["callback", "values", "pattern"])); + this.name = "Pattern"; + const options = optionsFromArguments(Pattern.getDefaults(), arguments, ["callback", "values", "pattern"]); + this.callback = options.callback; + this._values = options.values; + this._pattern = PatternGenerator(options.values, options.pattern); + this._type = options.pattern; + } + static getDefaults() { + return Object.assign(Loop.getDefaults(), { + pattern: "up", + values: [], + callback: noOp, + }); + } + /** + * Internal function called when the notes should be called + */ + _tick(time) { + const value = this._pattern.next(); + this._value = value.value; + this.callback(time, this._value); + } + /** + * The array of events. + */ + get values() { + return this._values; + } + set values(val) { + this._values = val; + // reset the pattern + this.pattern = this._type; + } + /** + * The current value of the pattern. + */ + get value() { + return this._value; + } + /** + * The pattern type. See Tone.CtrlPattern for the full list of patterns. + */ + get pattern() { + return this._type; + } + set pattern(pattern) { + this._type = pattern; + this._pattern = PatternGenerator(this._values, this._type); + } +} + +/** + * A sequence is an alternate notation of a part. Instead + * of passing in an array of [time, event] pairs, pass + * in an array of events which will be spaced at the + * given subdivision. Sub-arrays will subdivide that beat + * by the number of items are in the array. + * Sequence notation inspiration from [Tidal](http://yaxu.org/tidal/) + * @example + * const synth = new Tone.Synth().toDestination(); + * const seq = new Tone.Sequence((time, note) => { + * synth.triggerAttackRelease(note, 0.1, time); + * // subdivisions are given as subarrays + * }, ["C4", ["E4", "D4", "E4"], "G4", ["A4", "G4"]]).start(0); + * Tone.Transport.start(); + * @category Event + */ +class Sequence extends ToneEvent { + constructor() { + super(optionsFromArguments(Sequence.getDefaults(), arguments, ["callback", "events", "subdivision"])); + this.name = "Sequence"; + /** + * The object responsible for scheduling all of the events + */ + this._part = new Part({ + callback: this._seqCallback.bind(this), + context: this.context, + }); + /** + * private reference to all of the sequence proxies + */ + this._events = []; + /** + * The proxied array + */ + this._eventsArray = []; + const options = optionsFromArguments(Sequence.getDefaults(), arguments, ["callback", "events", "subdivision"]); + this._subdivision = this.toTicks(options.subdivision); + this.events = options.events; + // set all of the values + this.loop = options.loop; + this.loopStart = options.loopStart; + this.loopEnd = options.loopEnd; + this.playbackRate = options.playbackRate; + this.probability = options.probability; + this.humanize = options.humanize; + this.mute = options.mute; + this.playbackRate = options.playbackRate; + } + static getDefaults() { + return Object.assign(omitFromObject(ToneEvent.getDefaults(), ["value"]), { + events: [], + loop: true, + loopEnd: 0, + loopStart: 0, + subdivision: "8n", + }); + } + /** + * The internal callback for when an event is invoked + */ + _seqCallback(time, value) { + if (value !== null) { + this.callback(time, value); + } + } + /** + * The sequence + */ + get events() { + return this._events; + } + set events(s) { + this.clear(); + this._eventsArray = s; + this._events = this._createSequence(this._eventsArray); + this._eventsUpdated(); + } + /** + * Start the part at the given time. + * @param time When to start the part. + * @param offset The offset index to start at + */ + start(time, offset) { + this._part.start(time, offset ? this._indexTime(offset) : offset); + return this; + } + /** + * Stop the part at the given time. + * @param time When to stop the part. + */ + stop(time) { + this._part.stop(time); + return this; + } + /** + * The subdivision of the sequence. This can only be + * set in the constructor. The subdivision is the + * interval between successive steps. + */ + get subdivision() { + return new TicksClass(this.context, this._subdivision).toSeconds(); + } + /** + * Create a sequence proxy which can be monitored to create subsequences + */ + _createSequence(array) { + return new Proxy(array, { + get: (target, property) => { + // property is index in this case + return target[property]; + }, + set: (target, property, value) => { + if (isString(property) && isFinite(parseInt(property, 10))) { + if (isArray(value)) { + target[property] = this._createSequence(value); + } + else { + target[property] = value; + } + } + else { + target[property] = value; + } + this._eventsUpdated(); + // return true to accept the changes + return true; + }, + }); + } + /** + * When the sequence has changed, all of the events need to be recreated + */ + _eventsUpdated() { + this._part.clear(); + this._rescheduleSequence(this._eventsArray, this._subdivision, this.startOffset); + // update the loopEnd + this.loopEnd = this.loopEnd; + } + /** + * reschedule all of the events that need to be rescheduled + */ + _rescheduleSequence(sequence, subdivision, startOffset) { + sequence.forEach((value, index) => { + const eventOffset = index * (subdivision) + startOffset; + if (isArray(value)) { + this._rescheduleSequence(value, subdivision / value.length, eventOffset); + } + else { + const startTime = new TicksClass(this.context, eventOffset, "i").toSeconds(); + this._part.add(startTime, value); + } + }); + } + /** + * Get the time of the index given the Sequence's subdivision + * @param index + * @return The time of that index + */ + _indexTime(index) { + return new TicksClass(this.context, index * (this._subdivision) + this.startOffset).toSeconds(); + } + /** + * Clear all of the events + */ + clear() { + this._part.clear(); + return this; + } + dispose() { + super.dispose(); + this._part.dispose(); + return this; + } + //------------------------------------- + // PROXY CALLS + //------------------------------------- + get loop() { + return this._part.loop; + } + set loop(l) { + this._part.loop = l; + } + /** + * The index at which the sequence should start looping + */ + get loopStart() { + return this._loopStart; + } + set loopStart(index) { + this._loopStart = index; + this._part.loopStart = this._indexTime(index); + } + /** + * The index at which the sequence should end looping + */ + get loopEnd() { + return this._loopEnd; + } + set loopEnd(index) { + this._loopEnd = index; + if (index === 0) { + this._part.loopEnd = this._indexTime(this._eventsArray.length); + } + else { + this._part.loopEnd = this._indexTime(index); + } + } + get startOffset() { + return this._part.startOffset; + } + set startOffset(start) { + this._part.startOffset = start; + } + get playbackRate() { + return this._part.playbackRate; + } + set playbackRate(rate) { + this._part.playbackRate = rate; + } + get probability() { + return this._part.probability; + } + set probability(prob) { + this._part.probability = prob; + } + get progress() { + return this._part.progress; + } + get humanize() { + return this._part.humanize; + } + set humanize(variation) { + this._part.humanize = variation; + } + /** + * The number of scheduled events + */ + get length() { + return this._part.length; + } +} + +/** + * Tone.Crossfade provides equal power fading between two inputs. + * More on crossfading technique [here](https://en.wikipedia.org/wiki/Fade_(audio_engineering)#Crossfading). + * ``` + * +---------+ + * +> input a +>--+ + * +-----------+ +---------------------+ | | | + * | 1s signal +>--> stereoPannerNode L +>----> gain | | + * +-----------+ | | +---------+ | + * +-> pan R +>-+ | +--------+ + * | +---------------------+ | +---> output +> + * +------+ | | +---------+ | +--------+ + * | fade +>----+ | +> input b +>--+ + * +------+ | | | + * +--> gain | + * +---------+ + * ``` + * @example + * const crossFade = new Tone.CrossFade().toDestination(); + * // connect two inputs Tone.to a/b + * const inputA = new Tone.Oscillator(440, "square").connect(crossFade.a).start(); + * const inputB = new Tone.Oscillator(440, "sine").connect(crossFade.b).start(); + * // use the fade to control the mix between the two + * crossFade.fade.value = 0.5; + * @category Component + */ +class CrossFade extends ToneAudioNode { + constructor() { + super(Object.assign(optionsFromArguments(CrossFade.getDefaults(), arguments, ["fade"]))); + this.name = "CrossFade"; + /** + * The crossfading is done by a StereoPannerNode + */ + this._panner = this.context.createStereoPanner(); + /** + * Split the output of the panner node into two values used to control the gains. + */ + this._split = this.context.createChannelSplitter(2); + /** + * Convert the fade value into an audio range value so it can be connected + * to the panner.pan AudioParam + */ + this._g2a = new GainToAudio({ context: this.context }); + /** + * The input which is at full level when fade = 0 + */ + this.a = new Gain({ + context: this.context, + gain: 0, + }); + /** + * The input which is at full level when fade = 1 + */ + this.b = new Gain({ + context: this.context, + gain: 0, + }); + /** + * The output is a mix between `a` and `b` at the ratio of `fade` + */ + this.output = new Gain({ context: this.context }); + this._internalChannels = [this.a, this.b]; + const options = optionsFromArguments(CrossFade.getDefaults(), arguments, ["fade"]); + this.fade = new Signal({ + context: this.context, + units: "normalRange", + value: options.fade, + }); + readOnly(this, "fade"); + this.context.getConstant(1).connect(this._panner); + this._panner.connect(this._split); + // this is necessary for standardized-audio-context + // doesn't make any difference for the native AudioContext + // https://github.com/chrisguttandin/standardized-audio-context/issues/647 + this._panner.channelCount = 1; + this._panner.channelCountMode = "explicit"; + connect(this._split, this.a.gain, 0); + connect(this._split, this.b.gain, 1); + this.fade.chain(this._g2a, this._panner.pan); + this.a.connect(this.output); + this.b.connect(this.output); + } + static getDefaults() { + return Object.assign(ToneAudioNode.getDefaults(), { + fade: 0.5, + }); + } + dispose() { + super.dispose(); + this.a.dispose(); + this.b.dispose(); + this.output.dispose(); + this.fade.dispose(); + this._g2a.dispose(); + this._panner.disconnect(); + this._split.disconnect(); + return this; + } +} + +/** + * Effect is the base class for effects. Connect the effect between + * the effectSend and effectReturn GainNodes, then control the amount of + * effect which goes to the output using the wet control. + */ +class Effect extends ToneAudioNode { + constructor(options) { + super(options); + this.name = "Effect"; + /** + * the drywet knob to control the amount of effect + */ + this._dryWet = new CrossFade({ context: this.context }); + /** + * The wet control is how much of the effected + * will pass through to the output. 1 = 100% effected + * signal, 0 = 100% dry signal. + */ + this.wet = this._dryWet.fade; + /** + * connect the effectSend to the input of hte effect + */ + this.effectSend = new Gain({ context: this.context }); + /** + * connect the output of the effect to the effectReturn + */ + this.effectReturn = new Gain({ context: this.context }); + /** + * The effect input node + */ + this.input = new Gain({ context: this.context }); + /** + * The effect output + */ + this.output = this._dryWet; + // connections + this.input.fan(this._dryWet.a, this.effectSend); + this.effectReturn.connect(this._dryWet.b); + this.wet.setValueAtTime(options.wet, 0); + this._internalChannels = [this.effectReturn, this.effectSend]; + readOnly(this, "wet"); + } + static getDefaults() { + return Object.assign(ToneAudioNode.getDefaults(), { + wet: 1, + }); + } + /** + * chains the effect in between the effectSend and effectReturn + */ + connectEffect(effect) { + // add it to the internal channels + this._internalChannels.push(effect); + this.effectSend.chain(effect, this.effectReturn); + return this; + } + dispose() { + super.dispose(); + this._dryWet.dispose(); + this.effectSend.dispose(); + this.effectReturn.dispose(); + this.wet.dispose(); + return this; + } +} + +/** + * Base class for LFO-based effects. + */ +class LFOEffect extends Effect { + constructor(options) { + super(options); + this.name = "LFOEffect"; + this._lfo = new LFO({ + context: this.context, + frequency: options.frequency, + amplitude: options.depth, + }); + this.depth = this._lfo.amplitude; + this.frequency = this._lfo.frequency; + this.type = options.type; + readOnly(this, ["frequency", "depth"]); + } + static getDefaults() { + return Object.assign(Effect.getDefaults(), { + frequency: 1, + type: "sine", + depth: 1, + }); + } + /** + * Start the effect. + */ + start(time) { + this._lfo.start(time); + return this; + } + /** + * Stop the lfo + */ + stop(time) { + this._lfo.stop(time); + return this; + } + /** + * Sync the filter to the transport. See [[LFO.sync]] + */ + sync() { + this._lfo.sync(); + return this; + } + /** + * Unsync the filter from the transport. + */ + unsync() { + this._lfo.unsync(); + return this; + } + /** + * The type of the LFO's oscillator: See [[Oscillator.type]] + * @example + * const autoFilter = new Tone.AutoFilter().start().toDestination(); + * const noise = new Tone.Noise().start().connect(autoFilter); + * autoFilter.type = "square"; + */ + get type() { + return this._lfo.type; + } + set type(type) { + this._lfo.type = type; + } + dispose() { + super.dispose(); + this._lfo.dispose(); + this.frequency.dispose(); + this.depth.dispose(); + return this; + } +} + +/** + * AutoFilter is a Tone.Filter with a Tone.LFO connected to the filter cutoff frequency. + * Setting the LFO rate and depth allows for control over the filter modulation rate + * and depth. + * + * @example + * // create an autofilter and start it's LFO + * const autoFilter = new Tone.AutoFilter("4n").toDestination().start(); + * // route an oscillator through the filter and start it + * const oscillator = new Tone.Oscillator().connect(autoFilter).start(); + * @category Effect + */ +class AutoFilter extends LFOEffect { + constructor() { + super(optionsFromArguments(AutoFilter.getDefaults(), arguments, ["frequency", "baseFrequency", "octaves"])); + this.name = "AutoFilter"; + const options = optionsFromArguments(AutoFilter.getDefaults(), arguments, ["frequency", "baseFrequency", "octaves"]); + this.filter = new Filter(Object.assign(options.filter, { + context: this.context, + })); + // connections + this.connectEffect(this.filter); + this._lfo.connect(this.filter.frequency); + this.octaves = options.octaves; + this.baseFrequency = options.baseFrequency; + } + static getDefaults() { + return Object.assign(LFOEffect.getDefaults(), { + baseFrequency: 200, + octaves: 2.6, + filter: { + type: "lowpass", + rolloff: -12, + Q: 1, + } + }); + } + /** + * The minimum value of the filter's cutoff frequency. + */ + get baseFrequency() { + return this._lfo.min; + } + set baseFrequency(freq) { + this._lfo.min = this.toFrequency(freq); + // and set the max + this.octaves = this._octaves; + } + /** + * The maximum value of the filter's cutoff frequency. + */ + get octaves() { + return this._octaves; + } + set octaves(oct) { + this._octaves = oct; + this._lfo.max = this._lfo.min * Math.pow(2, oct); + } + dispose() { + super.dispose(); + this.filter.dispose(); + return this; + } +} + +/** + * Panner is an equal power Left/Right Panner. It is a wrapper around the StereoPannerNode. + * @example + * return Tone.Offline(() => { + * // move the input signal from right to left + * const panner = new Tone.Panner(1).toDestination(); + * panner.pan.rampTo(-1, 0.5); + * const osc = new Tone.Oscillator(100).connect(panner).start(); + * }, 0.5, 2); + * @category Component + */ +class Panner extends ToneAudioNode { + constructor() { + super(Object.assign(optionsFromArguments(Panner.getDefaults(), arguments, ["pan"]))); + this.name = "Panner"; + /** + * the panner node + */ + this._panner = this.context.createStereoPanner(); + this.input = this._panner; + this.output = this._panner; + const options = optionsFromArguments(Panner.getDefaults(), arguments, ["pan"]); + this.pan = new Param({ + context: this.context, + param: this._panner.pan, + value: options.pan, + minValue: -1, + maxValue: 1, + }); + // this is necessary for standardized-audio-context + // doesn't make any difference for the native AudioContext + // https://github.com/chrisguttandin/standardized-audio-context/issues/647 + this._panner.channelCount = options.channelCount; + this._panner.channelCountMode = "explicit"; + // initial value + readOnly(this, "pan"); + } + static getDefaults() { + return Object.assign(ToneAudioNode.getDefaults(), { + pan: 0, + channelCount: 1, + }); + } + dispose() { + super.dispose(); + this._panner.disconnect(); + this.pan.dispose(); + return this; + } +} + +/** + * AutoPanner is a [[Panner]] with an [[LFO]] connected to the pan amount. + * [Related Reading](https://www.ableton.com/en/blog/autopan-chopper-effect-and-more-liveschool/). + * + * @example + * // create an autopanner and start it + * const autoPanner = new Tone.AutoPanner("4n").toDestination().start(); + * // route an oscillator through the panner and start it + * const oscillator = new Tone.Oscillator().connect(autoPanner).start(); + * @category Effect + */ +class AutoPanner extends LFOEffect { + constructor() { + super(optionsFromArguments(AutoPanner.getDefaults(), arguments, ["frequency"])); + this.name = "AutoPanner"; + const options = optionsFromArguments(AutoPanner.getDefaults(), arguments, ["frequency"]); + this._panner = new Panner({ + context: this.context, + channelCount: options.channelCount + }); + // connections + this.connectEffect(this._panner); + this._lfo.connect(this._panner.pan); + this._lfo.min = -1; + this._lfo.max = 1; + } + static getDefaults() { + return Object.assign(LFOEffect.getDefaults(), { + channelCount: 1 + }); + } + dispose() { + super.dispose(); + this._panner.dispose(); + return this; + } +} + +/** + * Follower is a simple envelope follower. + * It's implemented by applying a lowpass filter to the absolute value of the incoming signal. + * ``` + * +-----+ +---------------+ + * Input +--> Abs +----> OnePoleFilter +--> Output + * +-----+ +---------------+ + * ``` + * @category Component + */ +class Follower extends ToneAudioNode { + constructor() { + super(optionsFromArguments(Follower.getDefaults(), arguments, ["smoothing"])); + this.name = "Follower"; + const options = optionsFromArguments(Follower.getDefaults(), arguments, ["smoothing"]); + this._abs = this.input = new Abs({ context: this.context }); + this._lowpass = this.output = new OnePoleFilter({ + context: this.context, + frequency: 1 / this.toSeconds(options.smoothing), + type: "lowpass" + }); + this._abs.connect(this._lowpass); + this._smoothing = options.smoothing; + } + static getDefaults() { + return Object.assign(ToneAudioNode.getDefaults(), { + smoothing: 0.05 + }); + } + /** + * The amount of time it takes a value change to arrive at the updated value. + */ + get smoothing() { + return this._smoothing; + } + set smoothing(smoothing) { + this._smoothing = smoothing; + this._lowpass.frequency = 1 / this.toSeconds(this.smoothing); + } + dispose() { + super.dispose(); + this._abs.dispose(); + this._lowpass.dispose(); + return this; + } +} + +/** + * AutoWah connects a [[Follower]] to a [[Filter]]. + * The frequency of the filter, follows the input amplitude curve. + * Inspiration from [Tuna.js](https://github.com/Dinahmoe/tuna). + * + * @example + * const autoWah = new Tone.AutoWah(50, 6, -30).toDestination(); + * // initialize the synth and connect to autowah + * const synth = new Tone.Synth().connect(autoWah); + * // Q value influences the effect of the wah - default is 2 + * autoWah.Q.value = 6; + * // more audible on higher notes + * synth.triggerAttackRelease("C4", "8n"); + * @category Effect + */ +class AutoWah extends Effect { + constructor() { + super(optionsFromArguments(AutoWah.getDefaults(), arguments, ["baseFrequency", "octaves", "sensitivity"])); + this.name = "AutoWah"; + const options = optionsFromArguments(AutoWah.getDefaults(), arguments, ["baseFrequency", "octaves", "sensitivity"]); + this._follower = new Follower({ + context: this.context, + smoothing: options.follower, + }); + this._sweepRange = new ScaleExp({ + context: this.context, + min: 0, + max: 1, + exponent: 0.5, + }); + this._baseFrequency = this.toFrequency(options.baseFrequency); + this._octaves = options.octaves; + this._inputBoost = new Gain({ context: this.context }); + this._bandpass = new Filter({ + context: this.context, + rolloff: -48, + frequency: 0, + Q: options.Q, + }); + this._peaking = new Filter({ + context: this.context, + type: "peaking" + }); + this._peaking.gain.value = options.gain; + this.gain = this._peaking.gain; + this.Q = this._bandpass.Q; + // the control signal path + this.effectSend.chain(this._inputBoost, this._follower, this._sweepRange); + this._sweepRange.connect(this._bandpass.frequency); + this._sweepRange.connect(this._peaking.frequency); + // the filtered path + this.effectSend.chain(this._bandpass, this._peaking, this.effectReturn); + // set the initial value + this._setSweepRange(); + this.sensitivity = options.sensitivity; + readOnly(this, ["gain", "Q"]); + } + static getDefaults() { + return Object.assign(Effect.getDefaults(), { + baseFrequency: 100, + octaves: 6, + sensitivity: 0, + Q: 2, + gain: 2, + follower: 0.2, + }); + } + /** + * The number of octaves that the filter will sweep above the baseFrequency. + */ + get octaves() { + return this._octaves; + } + set octaves(octaves) { + this._octaves = octaves; + this._setSweepRange(); + } + /** + * The follower's smoothing time + */ + get follower() { + return this._follower.smoothing; + } + set follower(follower) { + this._follower.smoothing = follower; + } + /** + * The base frequency from which the sweep will start from. + */ + get baseFrequency() { + return this._baseFrequency; + } + set baseFrequency(baseFreq) { + this._baseFrequency = this.toFrequency(baseFreq); + this._setSweepRange(); + } + /** + * The sensitivity to control how responsive to the input signal the filter is. + */ + get sensitivity() { + return gainToDb(1 / this._inputBoost.gain.value); + } + set sensitivity(sensitivity) { + this._inputBoost.gain.value = 1 / dbToGain(sensitivity); + } + /** + * sets the sweep range of the scaler + */ + _setSweepRange() { + this._sweepRange.min = this._baseFrequency; + this._sweepRange.max = Math.min(this._baseFrequency * Math.pow(2, this._octaves), this.context.sampleRate / 2); + } + dispose() { + super.dispose(); + this._follower.dispose(); + this._sweepRange.dispose(); + this._bandpass.dispose(); + this._peaking.dispose(); + this._inputBoost.dispose(); + return this; + } +} + +const workletName$1 = "bit-crusher"; +const bitCrusherWorklet = /* javascript */ ` + class BitCrusherWorklet extends SingleIOProcessor { + + static get parameterDescriptors() { + return [{ + name: "bits", + defaultValue: 12, + minValue: 1, + maxValue: 16, + automationRate: 'k-rate' + }]; + } + + generate(input, _channel, parameters) { + const step = Math.pow(0.5, parameters.bits - 1); + const val = step * Math.floor(input / step + 0.5); + return val; + } + } +`; +registerProcessor(workletName$1, bitCrusherWorklet); + +/** + * BitCrusher down-samples the incoming signal to a different bit depth. + * Lowering the bit depth of the signal creates distortion. Read more about BitCrushing + * on [Wikipedia](https://en.wikipedia.org/wiki/Bitcrusher). + * @example + * // initialize crusher and route a synth through it + * const crusher = new Tone.BitCrusher(4).toDestination(); + * const synth = new Tone.Synth().connect(crusher); + * synth.triggerAttackRelease("C2", 2); + * + * @category Effect + */ +class BitCrusher extends Effect { + constructor() { + super(optionsFromArguments(BitCrusher.getDefaults(), arguments, ["bits"])); + this.name = "BitCrusher"; + const options = optionsFromArguments(BitCrusher.getDefaults(), arguments, ["bits"]); + this._bitCrusherWorklet = new BitCrusherWorklet({ + context: this.context, + bits: options.bits, + }); + // connect it up + this.connectEffect(this._bitCrusherWorklet); + this.bits = this._bitCrusherWorklet.bits; + } + static getDefaults() { + return Object.assign(Effect.getDefaults(), { + bits: 4, + }); + } + dispose() { + super.dispose(); + this._bitCrusherWorklet.dispose(); + return this; + } +} +/** + * Internal class which creates an AudioWorklet to do the bit crushing + */ +class BitCrusherWorklet extends ToneAudioWorklet { + constructor() { + super(optionsFromArguments(BitCrusherWorklet.getDefaults(), arguments)); + this.name = "BitCrusherWorklet"; + const options = optionsFromArguments(BitCrusherWorklet.getDefaults(), arguments); + this.input = new Gain({ context: this.context }); + this.output = new Gain({ context: this.context }); + this.bits = new Param({ + context: this.context, + value: options.bits, + units: "positive", + minValue: 1, + maxValue: 16, + param: this._dummyParam, + swappable: true, + }); + } + static getDefaults() { + return Object.assign(ToneAudioWorklet.getDefaults(), { + bits: 12, + }); + } + _audioWorkletName() { + return workletName$1; + } + onReady(node) { + connectSeries(this.input, node, this.output); + const bits = node.parameters.get("bits"); + this.bits.setParam(bits); + } + dispose() { + super.dispose(); + this.input.dispose(); + this.output.dispose(); + this.bits.dispose(); + return this; + } +} + +/** + * Chebyshev is a waveshaper which is good + * for making different types of distortion sounds. + * Note that odd orders sound very different from even ones, + * and order = 1 is no change. + * Read more at [music.columbia.edu](http://music.columbia.edu/cmc/musicandcomputers/chapter4/04_06.php). + * @example + * // create a new cheby + * const cheby = new Tone.Chebyshev(50).toDestination(); + * // create a monosynth connected to our cheby + * const synth = new Tone.MonoSynth().connect(cheby); + * synth.triggerAttackRelease("C2", 0.4); + * @category Effect + */ +class Chebyshev extends Effect { + constructor() { + super(optionsFromArguments(Chebyshev.getDefaults(), arguments, ["order"])); + this.name = "Chebyshev"; + const options = optionsFromArguments(Chebyshev.getDefaults(), arguments, ["order"]); + this._shaper = new WaveShaper({ + context: this.context, + length: 4096 + }); + this._order = options.order; + this.connectEffect(this._shaper); + this.order = options.order; + this.oversample = options.oversample; + } + static getDefaults() { + return Object.assign(Effect.getDefaults(), { + order: 1, + oversample: "none" + }); + } + /** + * get the coefficient for that degree + * @param x the x value + * @param degree + * @param memo memoize the computed value. this speeds up computation greatly. + */ + _getCoefficient(x, degree, memo) { + if (memo.has(degree)) { + return memo.get(degree); + } + else if (degree === 0) { + memo.set(degree, 0); + } + else if (degree === 1) { + memo.set(degree, x); + } + else { + memo.set(degree, 2 * x * this._getCoefficient(x, degree - 1, memo) - this._getCoefficient(x, degree - 2, memo)); + } + return memo.get(degree); + } + /** + * The order of the Chebyshev polynomial which creates the equation which is applied to the incoming + * signal through a Tone.WaveShaper. The equations are in the form: + * ``` + * order 2: 2x^2 + 1 + * order 3: 4x^3 + 3x + * ``` + * @min 1 + * @max 100 + */ + get order() { + return this._order; + } + set order(order) { + this._order = order; + this._shaper.setMap((x => { + return this._getCoefficient(x, order, new Map()); + })); + } + /** + * The oversampling of the effect. Can either be "none", "2x" or "4x". + */ + get oversample() { + return this._shaper.oversample; + } + set oversample(oversampling) { + this._shaper.oversample = oversampling; + } + dispose() { + super.dispose(); + this._shaper.dispose(); + return this; + } +} + +/** + * Split splits an incoming signal into the number of given channels. + * + * @example + * const split = new Tone.Split(); + * // stereoSignal.connect(split); + * @category Component + */ +class Split extends ToneAudioNode { + constructor() { + super(optionsFromArguments(Split.getDefaults(), arguments, ["channels"])); + this.name = "Split"; + const options = optionsFromArguments(Split.getDefaults(), arguments, ["channels"]); + this._splitter = this.input = this.output = this.context.createChannelSplitter(options.channels); + this._internalChannels = [this._splitter]; + } + static getDefaults() { + return Object.assign(ToneAudioNode.getDefaults(), { + channels: 2, + }); + } + dispose() { + super.dispose(); + this._splitter.disconnect(); + return this; + } +} + +/** + * Merge brings multiple mono input channels into a single multichannel output channel. + * + * @example + * const merge = new Tone.Merge().toDestination(); + * // routing a sine tone in the left channel + * const osc = new Tone.Oscillator().connect(merge, 0, 0).start(); + * // and noise in the right channel + * const noise = new Tone.Noise().connect(merge, 0, 1).start();; + * @category Component + */ +class Merge extends ToneAudioNode { + constructor() { + super(optionsFromArguments(Merge.getDefaults(), arguments, ["channels"])); + this.name = "Merge"; + const options = optionsFromArguments(Merge.getDefaults(), arguments, ["channels"]); + this._merger = this.output = this.input = this.context.createChannelMerger(options.channels); + } + static getDefaults() { + return Object.assign(ToneAudioNode.getDefaults(), { + channels: 2, + }); + } + dispose() { + super.dispose(); + this._merger.disconnect(); + return this; + } +} + +/** + * Base class for Stereo effects. + */ +class StereoEffect extends ToneAudioNode { + constructor(options) { + super(options); + this.name = "StereoEffect"; + this.input = new Gain({ context: this.context }); + // force mono sources to be stereo + this.input.channelCount = 2; + this.input.channelCountMode = "explicit"; + this._dryWet = this.output = new CrossFade({ + context: this.context, + fade: options.wet + }); + this.wet = this._dryWet.fade; + this._split = new Split({ context: this.context, channels: 2 }); + this._merge = new Merge({ context: this.context, channels: 2 }); + // connections + this.input.connect(this._split); + // dry wet connections + this.input.connect(this._dryWet.a); + this._merge.connect(this._dryWet.b); + readOnly(this, ["wet"]); + } + /** + * Connect the left part of the effect + */ + connectEffectLeft(...nodes) { + this._split.connect(nodes[0], 0, 0); + connectSeries(...nodes); + connect(nodes[nodes.length - 1], this._merge, 0, 0); + } + /** + * Connect the right part of the effect + */ + connectEffectRight(...nodes) { + this._split.connect(nodes[0], 1, 0); + connectSeries(...nodes); + connect(nodes[nodes.length - 1], this._merge, 0, 1); + } + static getDefaults() { + return Object.assign(ToneAudioNode.getDefaults(), { + wet: 1, + }); + } + dispose() { + super.dispose(); + this._dryWet.dispose(); + this._split.dispose(); + this._merge.dispose(); + return this; + } +} + +/** + * Base class for stereo feedback effects where the effectReturn is fed back into the same channel. + */ +class StereoFeedbackEffect extends StereoEffect { + constructor(options) { + super(options); + this.feedback = new Signal({ + context: this.context, + value: options.feedback, + units: "normalRange" + }); + this._feedbackL = new Gain({ context: this.context }); + this._feedbackR = new Gain({ context: this.context }); + this._feedbackSplit = new Split({ context: this.context, channels: 2 }); + this._feedbackMerge = new Merge({ context: this.context, channels: 2 }); + this._merge.connect(this._feedbackSplit); + this._feedbackMerge.connect(this._split); + // the left output connected to the left input + this._feedbackSplit.connect(this._feedbackL, 0, 0); + this._feedbackL.connect(this._feedbackMerge, 0, 0); + // the right output connected to the right input + this._feedbackSplit.connect(this._feedbackR, 1, 0); + this._feedbackR.connect(this._feedbackMerge, 0, 1); + // the feedback control + this.feedback.fan(this._feedbackL.gain, this._feedbackR.gain); + readOnly(this, ["feedback"]); + } + static getDefaults() { + return Object.assign(StereoEffect.getDefaults(), { + feedback: 0.5, + }); + } + dispose() { + super.dispose(); + this.feedback.dispose(); + this._feedbackL.dispose(); + this._feedbackR.dispose(); + this._feedbackSplit.dispose(); + this._feedbackMerge.dispose(); + return this; + } +} + +/** + * Chorus is a stereo chorus effect composed of a left and right delay with an [[LFO]] applied to the delayTime of each channel. + * When [[feedback]] is set to a value larger than 0, you also get Flanger-type effects. + * Inspiration from [Tuna.js](https://github.com/Dinahmoe/tuna/blob/master/tuna.js). + * Read more on the chorus effect on [SoundOnSound](http://www.soundonsound.com/sos/jun04/articles/synthsecrets.htm). + * + * @example + * const chorus = new Tone.Chorus(4, 2.5, 0.5).toDestination().start(); + * const synth = new Tone.PolySynth().connect(chorus); + * synth.triggerAttackRelease(["C3", "E3", "G3"], "8n"); + * + * @category Effect + */ +class Chorus extends StereoFeedbackEffect { + constructor() { + super(optionsFromArguments(Chorus.getDefaults(), arguments, ["frequency", "delayTime", "depth"])); + this.name = "Chorus"; + const options = optionsFromArguments(Chorus.getDefaults(), arguments, ["frequency", "delayTime", "depth"]); + this._depth = options.depth; + this._delayTime = options.delayTime / 1000; + this._lfoL = new LFO({ + context: this.context, + frequency: options.frequency, + min: 0, + max: 1, + }); + this._lfoR = new LFO({ + context: this.context, + frequency: options.frequency, + min: 0, + max: 1, + phase: 180 + }); + this._delayNodeL = new Delay({ context: this.context }); + this._delayNodeR = new Delay({ context: this.context }); + this.frequency = this._lfoL.frequency; + readOnly(this, ["frequency"]); + // have one LFO frequency control the other + this._lfoL.frequency.connect(this._lfoR.frequency); + // connections + this.connectEffectLeft(this._delayNodeL); + this.connectEffectRight(this._delayNodeR); + // lfo setup + this._lfoL.connect(this._delayNodeL.delayTime); + this._lfoR.connect(this._delayNodeR.delayTime); + // set the initial values + this.depth = this._depth; + this.type = options.type; + this.spread = options.spread; + } + static getDefaults() { + return Object.assign(StereoFeedbackEffect.getDefaults(), { + frequency: 1.5, + delayTime: 3.5, + depth: 0.7, + type: "sine", + spread: 180, + feedback: 0, + wet: 0.5, + }); + } + /** + * The depth of the effect. A depth of 1 makes the delayTime + * modulate between 0 and 2*delayTime (centered around the delayTime). + */ + get depth() { + return this._depth; + } + set depth(depth) { + this._depth = depth; + const deviation = this._delayTime * depth; + this._lfoL.min = Math.max(this._delayTime - deviation, 0); + this._lfoL.max = this._delayTime + deviation; + this._lfoR.min = Math.max(this._delayTime - deviation, 0); + this._lfoR.max = this._delayTime + deviation; + } + /** + * The delayTime in milliseconds of the chorus. A larger delayTime + * will give a more pronounced effect. Nominal range a delayTime + * is between 2 and 20ms. + */ + get delayTime() { + return this._delayTime * 1000; + } + set delayTime(delayTime) { + this._delayTime = delayTime / 1000; + this.depth = this._depth; + } + /** + * The oscillator type of the LFO. + */ + get type() { + return this._lfoL.type; + } + set type(type) { + this._lfoL.type = type; + this._lfoR.type = type; + } + /** + * Amount of stereo spread. When set to 0, both LFO's will be panned centrally. + * When set to 180, LFO's will be panned hard left and right respectively. + */ + get spread() { + return this._lfoR.phase - this._lfoL.phase; + } + set spread(spread) { + this._lfoL.phase = 90 - (spread / 2); + this._lfoR.phase = (spread / 2) + 90; + } + /** + * Start the effect. + */ + start(time) { + this._lfoL.start(time); + this._lfoR.start(time); + return this; + } + /** + * Stop the lfo + */ + stop(time) { + this._lfoL.stop(time); + this._lfoR.stop(time); + return this; + } + /** + * Sync the filter to the transport. See [[LFO.sync]] + */ + sync() { + this._lfoL.sync(); + this._lfoR.sync(); + return this; + } + /** + * Unsync the filter from the transport. + */ + unsync() { + this._lfoL.unsync(); + this._lfoR.unsync(); + return this; + } + dispose() { + super.dispose(); + this._lfoL.dispose(); + this._lfoR.dispose(); + this._delayNodeL.dispose(); + this._delayNodeR.dispose(); + this.frequency.dispose(); + return this; + } +} + +/** + * A simple distortion effect using Tone.WaveShaper. + * Algorithm from [this stackoverflow answer](http://stackoverflow.com/a/22313408). + * + * @example + * const dist = new Tone.Distortion(0.8).toDestination(); + * const fm = new Tone.FMSynth().connect(dist); + * fm.triggerAttackRelease("A1", "8n"); + * @category Effect + */ +class Distortion extends Effect { + constructor() { + super(optionsFromArguments(Distortion.getDefaults(), arguments, ["distortion"])); + this.name = "Distortion"; + const options = optionsFromArguments(Distortion.getDefaults(), arguments, ["distortion"]); + this._shaper = new WaveShaper({ + context: this.context, + length: 4096, + }); + this._distortion = options.distortion; + this.connectEffect(this._shaper); + this.distortion = options.distortion; + this.oversample = options.oversample; + } + static getDefaults() { + return Object.assign(Effect.getDefaults(), { + distortion: 0.4, + oversample: "none", + }); + } + /** + * The amount of distortion. Nominal range is between 0 and 1. + */ + get distortion() { + return this._distortion; + } + set distortion(amount) { + this._distortion = amount; + const k = amount * 100; + const deg = Math.PI / 180; + this._shaper.setMap((x) => { + if (Math.abs(x) < 0.001) { + // should output 0 when input is 0 + return 0; + } + else { + return (3 + k) * x * 20 * deg / (Math.PI + k * Math.abs(x)); + } + }); + } + /** + * The oversampling of the effect. Can either be "none", "2x" or "4x". + */ + get oversample() { + return this._shaper.oversample; + } + set oversample(oversampling) { + this._shaper.oversample = oversampling; + } + dispose() { + super.dispose(); + this._shaper.dispose(); + return this; + } +} + +/** + * FeedbackEffect provides a loop between an audio source and its own output. + * This is a base-class for feedback effects. + */ +class FeedbackEffect extends Effect { + constructor(options) { + super(options); + this.name = "FeedbackEffect"; + this._feedbackGain = new Gain({ + context: this.context, + gain: options.feedback, + units: "normalRange", + }); + this.feedback = this._feedbackGain.gain; + readOnly(this, "feedback"); + // the feedback loop + this.effectReturn.chain(this._feedbackGain, this.effectSend); + } + static getDefaults() { + return Object.assign(Effect.getDefaults(), { + feedback: 0.125, + }); + } + dispose() { + super.dispose(); + this._feedbackGain.dispose(); + this.feedback.dispose(); + return this; + } +} + +/** + * FeedbackDelay is a DelayNode in which part of output signal is fed back into the delay. + * + * @param delayTime The delay applied to the incoming signal. + * @param feedback The amount of the effected signal which is fed back through the delay. + * @example + * const feedbackDelay = new Tone.FeedbackDelay("8n", 0.5).toDestination(); + * const tom = new Tone.MembraneSynth({ + * octaves: 4, + * pitchDecay: 0.1 + * }).connect(feedbackDelay); + * tom.triggerAttackRelease("A2", "32n"); + * @category Effect + */ +class FeedbackDelay extends FeedbackEffect { + constructor() { + super(optionsFromArguments(FeedbackDelay.getDefaults(), arguments, ["delayTime", "feedback"])); + this.name = "FeedbackDelay"; + const options = optionsFromArguments(FeedbackDelay.getDefaults(), arguments, ["delayTime", "feedback"]); + this._delayNode = new Delay({ + context: this.context, + delayTime: options.delayTime, + maxDelay: options.maxDelay, + }); + this.delayTime = this._delayNode.delayTime; + // connect it up + this.connectEffect(this._delayNode); + readOnly(this, "delayTime"); + } + static getDefaults() { + return Object.assign(FeedbackEffect.getDefaults(), { + delayTime: 0.25, + maxDelay: 1, + }); + } + dispose() { + super.dispose(); + this._delayNode.dispose(); + this.delayTime.dispose(); + return this; + } +} + +/** + * PhaseShiftAllpass is an very efficient implementation of a Hilbert Transform + * using two Allpass filter banks whose outputs have a phase difference of 90°. + * Here the `offset90` phase is offset by +90° in relation to `output`. + * Coefficients and structure was developed by Olli Niemitalo. + * For more details see: http://yehar.com/blog/?p=368 + * @category Component + */ +class PhaseShiftAllpass extends ToneAudioNode { + constructor(options) { + super(options); + this.name = "PhaseShiftAllpass"; + this.input = new Gain({ context: this.context }); + /** + * The phase shifted output + */ + this.output = new Gain({ context: this.context }); + /** + * The PhaseShifted allpass output + */ + this.offset90 = new Gain({ context: this.context }); + const allpassBank1Values = [0.6923878, 0.9360654322959, 0.9882295226860, 0.9987488452737]; + const allpassBank2Values = [0.4021921162426, 0.8561710882420, 0.9722909545651, 0.9952884791278]; + this._bank0 = this._createAllPassFilterBank(allpassBank1Values); + this._bank1 = this._createAllPassFilterBank(allpassBank2Values); + this._oneSampleDelay = this.context.createIIRFilter([0.0, 1.0], [1.0, 0.0]); + // connect Allpass filter banks + connectSeries(this.input, ...this._bank0, this._oneSampleDelay, this.output); + connectSeries(this.input, ...this._bank1, this.offset90); + } + /** + * Create all of the IIR filters from an array of values using the coefficient calculation. + */ + _createAllPassFilterBank(bankValues) { + const nodes = bankValues.map(value => { + const coefficients = [[value * value, 0, -1], [1, 0, -(value * value)]]; + return this.context.createIIRFilter(coefficients[0], coefficients[1]); + }); + return nodes; + } + dispose() { + super.dispose(); + this.input.dispose(); + this.output.dispose(); + this.offset90.dispose(); + this._bank0.forEach(f => f.disconnect()); + this._bank1.forEach(f => f.disconnect()); + this._oneSampleDelay.disconnect(); + return this; + } +} + +/** + * FrequencyShifter can be used to shift all frequencies of a signal by a fixed amount. + * The amount can be changed at audio rate and the effect is applied in real time. + * The frequency shifting is implemented with a technique called single side band modulation using a ring modulator. + * Note: Contrary to pitch shifting, all frequencies are shifted by the same amount, + * destroying the harmonic relationship between them. This leads to the classic ring modulator timbre distortion. + * The algorithm will produces some aliasing towards the high end, especially if your source material + * contains a lot of high frequencies. Unfortunatelly the webaudio API does not support resampling + * buffers in real time, so it is not possible to fix it properly. Depending on the use case it might + * be an option to low pass filter your input before frequency shifting it to get ride of the aliasing. + * You can find a very detailed description of the algorithm here: https://larzeitlin.github.io/RMFS/ + * + * @example + * const input = new Tone.Oscillator(230, "sawtooth").start(); + * const shift = new Tone.FrequencyShifter(42).toDestination(); + * input.connect(shift); + * @category Effect + */ +class FrequencyShifter extends Effect { + constructor() { + super(optionsFromArguments(FrequencyShifter.getDefaults(), arguments, ["frequency"])); + this.name = "FrequencyShifter"; + const options = optionsFromArguments(FrequencyShifter.getDefaults(), arguments, ["frequency"]); + this.frequency = new Signal({ + context: this.context, + units: "frequency", + value: options.frequency, + minValue: -this.context.sampleRate / 2, + maxValue: this.context.sampleRate / 2, + }); + this._sine = new ToneOscillatorNode({ + context: this.context, + type: "sine", + }); + this._cosine = new Oscillator({ + context: this.context, + phase: -90, + type: "sine", + }); + this._sineMultiply = new Multiply({ context: this.context }); + this._cosineMultiply = new Multiply({ context: this.context }); + this._negate = new Negate({ context: this.context }); + this._add = new Add({ context: this.context }); + this._phaseShifter = new PhaseShiftAllpass({ context: this.context }); + this.effectSend.connect(this._phaseShifter); + // connect the carrier frequency signal to the two oscillators + this.frequency.fan(this._sine.frequency, this._cosine.frequency); + this._phaseShifter.offset90.connect(this._cosineMultiply); + this._cosine.connect(this._cosineMultiply.factor); + this._phaseShifter.connect(this._sineMultiply); + this._sine.connect(this._sineMultiply.factor); + this._sineMultiply.connect(this._negate); + this._cosineMultiply.connect(this._add); + this._negate.connect(this._add.addend); + this._add.connect(this.effectReturn); + // start the oscillators at the same time + const now = this.immediate(); + this._sine.start(now); + this._cosine.start(now); + } + static getDefaults() { + return Object.assign(Effect.getDefaults(), { + frequency: 0, + }); + } + dispose() { + super.dispose(); + this.frequency.dispose(); + this._add.dispose(); + this._cosine.dispose(); + this._cosineMultiply.dispose(); + this._negate.dispose(); + this._phaseShifter.dispose(); + this._sine.dispose(); + this._sineMultiply.dispose(); + return this; + } +} + +/** + * An array of comb filter delay values from Freeverb implementation + */ +const combFilterTunings = [1557 / 44100, 1617 / 44100, 1491 / 44100, 1422 / 44100, 1277 / 44100, 1356 / 44100, 1188 / 44100, 1116 / 44100]; +/** + * An array of allpass filter frequency values from Freeverb implementation + */ +const allpassFilterFrequencies = [225, 556, 441, 341]; +/** + * Freeverb is a reverb based on [Freeverb](https://ccrma.stanford.edu/~jos/pasp/Freeverb.html). + * Read more on reverb on [Sound On Sound](https://web.archive.org/web/20160404083902/http://www.soundonsound.com:80/sos/feb01/articles/synthsecrets.asp). + * Freeverb is now implemented with an AudioWorkletNode which may result on performance degradation on some platforms. Consider using [[Reverb]]. + * @example + * const freeverb = new Tone.Freeverb().toDestination(); + * freeverb.dampening = 1000; + * // routing synth through the reverb + * const synth = new Tone.NoiseSynth().connect(freeverb); + * synth.triggerAttackRelease(0.05); + * @category Effect + */ +class Freeverb extends StereoEffect { + constructor() { + super(optionsFromArguments(Freeverb.getDefaults(), arguments, ["roomSize", "dampening"])); + this.name = "Freeverb"; + /** + * the comb filters + */ + this._combFilters = []; + /** + * the allpass filters on the left + */ + this._allpassFiltersL = []; + /** + * the allpass filters on the right + */ + this._allpassFiltersR = []; + const options = optionsFromArguments(Freeverb.getDefaults(), arguments, ["roomSize", "dampening"]); + this.roomSize = new Signal({ + context: this.context, + value: options.roomSize, + units: "normalRange", + }); + // make the allpass filters on the right + this._allpassFiltersL = allpassFilterFrequencies.map(freq => { + const allpassL = this.context.createBiquadFilter(); + allpassL.type = "allpass"; + allpassL.frequency.value = freq; + return allpassL; + }); + // make the allpass filters on the left + this._allpassFiltersR = allpassFilterFrequencies.map(freq => { + const allpassR = this.context.createBiquadFilter(); + allpassR.type = "allpass"; + allpassR.frequency.value = freq; + return allpassR; + }); + // make the comb filters + this._combFilters = combFilterTunings.map((delayTime, index) => { + const lfpf = new LowpassCombFilter({ + context: this.context, + dampening: options.dampening, + delayTime, + }); + if (index < combFilterTunings.length / 2) { + this.connectEffectLeft(lfpf, ...this._allpassFiltersL); + } + else { + this.connectEffectRight(lfpf, ...this._allpassFiltersR); + } + this.roomSize.connect(lfpf.resonance); + return lfpf; + }); + readOnly(this, ["roomSize"]); + } + static getDefaults() { + return Object.assign(StereoEffect.getDefaults(), { + roomSize: 0.7, + dampening: 3000 + }); + } + /** + * The amount of dampening of the reverberant signal. + */ + get dampening() { + return this._combFilters[0].dampening; + } + set dampening(d) { + this._combFilters.forEach(c => c.dampening = d); + } + dispose() { + super.dispose(); + this._allpassFiltersL.forEach(al => al.disconnect()); + this._allpassFiltersR.forEach(ar => ar.disconnect()); + this._combFilters.forEach(cf => cf.dispose()); + this.roomSize.dispose(); + return this; + } +} + +/** + * an array of the comb filter delay time values + */ +const combFilterDelayTimes = [1687 / 25000, 1601 / 25000, 2053 / 25000, 2251 / 25000]; +/** + * the resonances of each of the comb filters + */ +const combFilterResonances = [0.773, 0.802, 0.753, 0.733]; +/** + * the allpass filter frequencies + */ +const allpassFilterFreqs = [347, 113, 37]; +/** + * JCReverb is a simple [Schroeder Reverberator](https://ccrma.stanford.edu/~jos/pasp/Schroeder_Reverberators.html) + * tuned by John Chowning in 1970. + * It is made up of three allpass filters and four [[FeedbackCombFilter]]. + * JCReverb is now implemented with an AudioWorkletNode which may result on performance degradation on some platforms. Consider using [[Reverb]]. + * @example + * const reverb = new Tone.JCReverb(0.4).toDestination(); + * const delay = new Tone.FeedbackDelay(0.5); + * // connecting the synth to reverb through delay + * const synth = new Tone.DuoSynth().chain(delay, reverb); + * synth.triggerAttackRelease("A4", "8n"); + * + * @category Effect + */ +class JCReverb extends StereoEffect { + constructor() { + super(optionsFromArguments(JCReverb.getDefaults(), arguments, ["roomSize"])); + this.name = "JCReverb"; + /** + * a series of allpass filters + */ + this._allpassFilters = []; + /** + * parallel feedback comb filters + */ + this._feedbackCombFilters = []; + const options = optionsFromArguments(JCReverb.getDefaults(), arguments, ["roomSize"]); + this.roomSize = new Signal({ + context: this.context, + value: options.roomSize, + units: "normalRange", + }); + this._scaleRoomSize = new Scale({ + context: this.context, + min: -0.733, + max: 0.197, + }); + // make the allpass filters + this._allpassFilters = allpassFilterFreqs.map(freq => { + const allpass = this.context.createBiquadFilter(); + allpass.type = "allpass"; + allpass.frequency.value = freq; + return allpass; + }); + // and the comb filters + this._feedbackCombFilters = combFilterDelayTimes.map((delayTime, index) => { + const fbcf = new FeedbackCombFilter({ + context: this.context, + delayTime, + }); + this._scaleRoomSize.connect(fbcf.resonance); + fbcf.resonance.value = combFilterResonances[index]; + if (index < combFilterDelayTimes.length / 2) { + this.connectEffectLeft(...this._allpassFilters, fbcf); + } + else { + this.connectEffectRight(...this._allpassFilters, fbcf); + } + return fbcf; + }); + // chain the allpass filters together + this.roomSize.connect(this._scaleRoomSize); + readOnly(this, ["roomSize"]); + } + static getDefaults() { + return Object.assign(StereoEffect.getDefaults(), { + roomSize: 0.5, + }); + } + dispose() { + super.dispose(); + this._allpassFilters.forEach(apf => apf.disconnect()); + this._feedbackCombFilters.forEach(fbcf => fbcf.dispose()); + this.roomSize.dispose(); + this._scaleRoomSize.dispose(); + return this; + } +} + +/** + * Just like a [[StereoFeedbackEffect]], but the feedback is routed from left to right + * and right to left instead of on the same channel. + * ``` + * +--------------------------------+ feedbackL <-----------------------------------+ + * | | + * +--> +-----> +----> +-----+ + * feedbackMerge +--> split (EFFECT) merge +--> feedbackSplit | | + * +--> +-----> +----> +---+ | + * | | + * +--------------------------------+ feedbackR <-------------------------------------+ + * ``` + */ +class StereoXFeedbackEffect extends StereoFeedbackEffect { + constructor(options) { + super(options); + // the left output connected to the right input + this._feedbackL.disconnect(); + this._feedbackL.connect(this._feedbackMerge, 0, 1); + // the left output connected to the right input + this._feedbackR.disconnect(); + this._feedbackR.connect(this._feedbackMerge, 0, 0); + readOnly(this, ["feedback"]); + } +} + +/** + * PingPongDelay is a feedback delay effect where the echo is heard + * first in one channel and next in the opposite channel. In a stereo + * system these are the right and left channels. + * PingPongDelay in more simplified terms is two Tone.FeedbackDelays + * with independent delay values. Each delay is routed to one channel + * (left or right), and the channel triggered second will always + * trigger at the same interval after the first. + * @example + * const pingPong = new Tone.PingPongDelay("4n", 0.2).toDestination(); + * const drum = new Tone.MembraneSynth().connect(pingPong); + * drum.triggerAttackRelease("C4", "32n"); + * @category Effect + */ +class PingPongDelay extends StereoXFeedbackEffect { + constructor() { + super(optionsFromArguments(PingPongDelay.getDefaults(), arguments, ["delayTime", "feedback"])); + this.name = "PingPongDelay"; + const options = optionsFromArguments(PingPongDelay.getDefaults(), arguments, ["delayTime", "feedback"]); + this._leftDelay = new Delay({ + context: this.context, + maxDelay: options.maxDelay, + }); + this._rightDelay = new Delay({ + context: this.context, + maxDelay: options.maxDelay + }); + this._rightPreDelay = new Delay({ + context: this.context, + maxDelay: options.maxDelay + }); + this.delayTime = new Signal({ + context: this.context, + units: "time", + value: options.delayTime, + }); + // connect it up + this.connectEffectLeft(this._leftDelay); + this.connectEffectRight(this._rightPreDelay, this._rightDelay); + this.delayTime.fan(this._leftDelay.delayTime, this._rightDelay.delayTime, this._rightPreDelay.delayTime); + // rearranged the feedback to be after the rightPreDelay + this._feedbackL.disconnect(); + this._feedbackL.connect(this._rightDelay); + readOnly(this, ["delayTime"]); + } + static getDefaults() { + return Object.assign(StereoXFeedbackEffect.getDefaults(), { + delayTime: 0.25, + maxDelay: 1 + }); + } + dispose() { + super.dispose(); + this._leftDelay.dispose(); + this._rightDelay.dispose(); + this._rightPreDelay.dispose(); + this.delayTime.dispose(); + return this; + } +} + +/** + * PitchShift does near-realtime pitch shifting to the incoming signal. + * The effect is achieved by speeding up or slowing down the delayTime + * of a DelayNode using a sawtooth wave. + * Algorithm found in [this pdf](http://dsp-book.narod.ru/soundproc.pdf). + * Additional reference by [Miller Pucket](http://msp.ucsd.edu/techniques/v0.11/book-html/node115.html). + * @category Effect + */ +class PitchShift extends FeedbackEffect { + constructor() { + super(optionsFromArguments(PitchShift.getDefaults(), arguments, ["pitch"])); + this.name = "PitchShift"; + const options = optionsFromArguments(PitchShift.getDefaults(), arguments, ["pitch"]); + this._frequency = new Signal({ context: this.context }); + this._delayA = new Delay({ + maxDelay: 1, + context: this.context + }); + this._lfoA = new LFO({ + context: this.context, + min: 0, + max: 0.1, + type: "sawtooth" + }).connect(this._delayA.delayTime); + this._delayB = new Delay({ + maxDelay: 1, + context: this.context + }); + this._lfoB = new LFO({ + context: this.context, + min: 0, + max: 0.1, + type: "sawtooth", + phase: 180 + }).connect(this._delayB.delayTime); + this._crossFade = new CrossFade({ context: this.context }); + this._crossFadeLFO = new LFO({ + context: this.context, + min: 0, + max: 1, + type: "triangle", + phase: 90 + }).connect(this._crossFade.fade); + this._feedbackDelay = new Delay({ + delayTime: options.delayTime, + context: this.context, + }); + this.delayTime = this._feedbackDelay.delayTime; + readOnly(this, "delayTime"); + this._pitch = options.pitch; + this._windowSize = options.windowSize; + // connect the two delay lines up + this._delayA.connect(this._crossFade.a); + this._delayB.connect(this._crossFade.b); + // connect the frequency + this._frequency.fan(this._lfoA.frequency, this._lfoB.frequency, this._crossFadeLFO.frequency); + // route the input + this.effectSend.fan(this._delayA, this._delayB); + this._crossFade.chain(this._feedbackDelay, this.effectReturn); + // start the LFOs at the same time + const now = this.now(); + this._lfoA.start(now); + this._lfoB.start(now); + this._crossFadeLFO.start(now); + // set the initial value + this.windowSize = this._windowSize; + } + static getDefaults() { + return Object.assign(FeedbackEffect.getDefaults(), { + pitch: 0, + windowSize: 0.1, + delayTime: 0, + feedback: 0 + }); + } + /** + * Repitch the incoming signal by some interval (measured in semi-tones). + * @example + * const pitchShift = new Tone.PitchShift().toDestination(); + * const osc = new Tone.Oscillator().connect(pitchShift).start().toDestination(); + * pitchShift.pitch = -12; // down one octave + * pitchShift.pitch = 7; // up a fifth + */ + get pitch() { + return this._pitch; + } + set pitch(interval) { + this._pitch = interval; + let factor = 0; + if (interval < 0) { + this._lfoA.min = 0; + this._lfoA.max = this._windowSize; + this._lfoB.min = 0; + this._lfoB.max = this._windowSize; + factor = intervalToFrequencyRatio(interval - 1) + 1; + } + else { + this._lfoA.min = this._windowSize; + this._lfoA.max = 0; + this._lfoB.min = this._windowSize; + this._lfoB.max = 0; + factor = intervalToFrequencyRatio(interval) - 1; + } + this._frequency.value = factor * (1.2 / this._windowSize); + } + /** + * The window size corresponds roughly to the sample length in a looping sampler. + * Smaller values are desirable for a less noticeable delay time of the pitch shifted + * signal, but larger values will result in smoother pitch shifting for larger intervals. + * A nominal range of 0.03 to 0.1 is recommended. + */ + get windowSize() { + return this._windowSize; + } + set windowSize(size) { + this._windowSize = this.toSeconds(size); + this.pitch = this._pitch; + } + dispose() { + super.dispose(); + this._frequency.dispose(); + this._delayA.dispose(); + this._delayB.dispose(); + this._lfoA.dispose(); + this._lfoB.dispose(); + this._crossFade.dispose(); + this._crossFadeLFO.dispose(); + this._feedbackDelay.dispose(); + return this; + } +} + +/** + * Phaser is a phaser effect. Phasers work by changing the phase + * of different frequency components of an incoming signal. Read more on + * [Wikipedia](https://en.wikipedia.org/wiki/Phaser_(effect)). + * Inspiration for this phaser comes from [Tuna.js](https://github.com/Dinahmoe/tuna/). + * @example + * const phaser = new Tone.Phaser({ + * frequency: 15, + * octaves: 5, + * baseFrequency: 1000 + * }).toDestination(); + * const synth = new Tone.FMSynth().connect(phaser); + * synth.triggerAttackRelease("E3", "2n"); + * @category Effect + */ +class Phaser extends StereoEffect { + constructor() { + super(optionsFromArguments(Phaser.getDefaults(), arguments, ["frequency", "octaves", "baseFrequency"])); + this.name = "Phaser"; + const options = optionsFromArguments(Phaser.getDefaults(), arguments, ["frequency", "octaves", "baseFrequency"]); + this._lfoL = new LFO({ + context: this.context, + frequency: options.frequency, + min: 0, + max: 1 + }); + this._lfoR = new LFO({ + context: this.context, + frequency: options.frequency, + min: 0, + max: 1, + phase: 180, + }); + this._baseFrequency = this.toFrequency(options.baseFrequency); + this._octaves = options.octaves; + this.Q = new Signal({ + context: this.context, + value: options.Q, + units: "positive", + }); + this._filtersL = this._makeFilters(options.stages, this._lfoL); + this._filtersR = this._makeFilters(options.stages, this._lfoR); + this.frequency = this._lfoL.frequency; + this.frequency.value = options.frequency; + // connect them up + this.connectEffectLeft(...this._filtersL); + this.connectEffectRight(...this._filtersR); + // control the frequency with one LFO + this._lfoL.frequency.connect(this._lfoR.frequency); + // set the options + this.baseFrequency = options.baseFrequency; + this.octaves = options.octaves; + // start the lfo + this._lfoL.start(); + this._lfoR.start(); + readOnly(this, ["frequency", "Q"]); + } + static getDefaults() { + return Object.assign(StereoEffect.getDefaults(), { + frequency: 0.5, + octaves: 3, + stages: 10, + Q: 10, + baseFrequency: 350, + }); + } + _makeFilters(stages, connectToFreq) { + const filters = []; + // make all the filters + for (let i = 0; i < stages; i++) { + const filter = this.context.createBiquadFilter(); + filter.type = "allpass"; + this.Q.connect(filter.Q); + connectToFreq.connect(filter.frequency); + filters.push(filter); + } + return filters; + } + /** + * The number of octaves the phase goes above the baseFrequency + */ + get octaves() { + return this._octaves; + } + set octaves(octaves) { + this._octaves = octaves; + const max = this._baseFrequency * Math.pow(2, octaves); + this._lfoL.max = max; + this._lfoR.max = max; + } + /** + * The the base frequency of the filters. + */ + get baseFrequency() { + return this._baseFrequency; + } + set baseFrequency(freq) { + this._baseFrequency = this.toFrequency(freq); + this._lfoL.min = this._baseFrequency; + this._lfoR.min = this._baseFrequency; + this.octaves = this._octaves; + } + dispose() { + super.dispose(); + this.Q.dispose(); + this._lfoL.dispose(); + this._lfoR.dispose(); + this._filtersL.forEach(f => f.disconnect()); + this._filtersR.forEach(f => f.disconnect()); + this.frequency.dispose(); + return this; + } +} + +/** + * Simple convolution created with decaying noise. + * Generates an Impulse Response Buffer + * with Tone.Offline then feeds the IR into ConvolverNode. + * The impulse response generation is async, so you have + * to wait until [[ready]] resolves before it will make a sound. + * + * Inspiration from [ReverbGen](https://github.com/adelespinasse/reverbGen). + * Copyright (c) 2014 Alan deLespinasse Apache 2.0 License. + * + * @category Effect + */ +class Reverb extends Effect { + constructor() { + super(optionsFromArguments(Reverb.getDefaults(), arguments, ["decay"])); + this.name = "Reverb"; + /** + * Convolver node + */ + this._convolver = this.context.createConvolver(); + /** + * Resolves when the reverb buffer is generated. Whenever either [[decay]] + * or [[preDelay]] are set, you have to wait until [[ready]] resolves + * before the IR is generated with the latest values. + */ + this.ready = Promise.resolve(); + const options = optionsFromArguments(Reverb.getDefaults(), arguments, ["decay"]); + this._decay = options.decay; + this._preDelay = options.preDelay; + this.generate(); + this.connectEffect(this._convolver); + } + static getDefaults() { + return Object.assign(Effect.getDefaults(), { + decay: 1.5, + preDelay: 0.01, + }); + } + /** + * The duration of the reverb. + */ + get decay() { + return this._decay; + } + set decay(time) { + time = this.toSeconds(time); + assertRange(time, 0.001); + this._decay = time; + this.generate(); + } + /** + * The amount of time before the reverb is fully ramped in. + */ + get preDelay() { + return this._preDelay; + } + set preDelay(time) { + time = this.toSeconds(time); + assertRange(time, 0); + this._preDelay = time; + this.generate(); + } + /** + * Generate the Impulse Response. Returns a promise while the IR is being generated. + * @return Promise which returns this object. + */ + generate() { + return __awaiter(this, void 0, void 0, function* () { + const previousReady = this.ready; + // create a noise burst which decays over the duration in each channel + const context = new OfflineContext(2, this._decay + this._preDelay, this.context.sampleRate); + const noiseL = new Noise({ context }); + const noiseR = new Noise({ context }); + const merge = new Merge({ context }); + noiseL.connect(merge, 0, 0); + noiseR.connect(merge, 0, 1); + const gainNode = new Gain({ context }).toDestination(); + merge.connect(gainNode); + noiseL.start(0); + noiseR.start(0); + // predelay + gainNode.gain.setValueAtTime(0, 0); + gainNode.gain.setValueAtTime(1, this._preDelay); + // decay + gainNode.gain.exponentialApproachValueAtTime(0, this._preDelay, this.decay); + // render the buffer + const renderPromise = context.render(); + this.ready = renderPromise.then(noOp); + // wait for the previous `ready` to resolve + yield previousReady; + // set the buffer + this._convolver.buffer = (yield renderPromise).get(); + return this; + }); + } + dispose() { + super.dispose(); + this._convolver.disconnect(); + return this; + } +} + +/** + * Mid/Side processing separates the the 'mid' signal (which comes out of both the left and the right channel) + * and the 'side' (which only comes out of the the side channels). + * ``` + * Mid = (Left+Right)/sqrt(2); // obtain mid-signal from left and right + * Side = (Left-Right)/sqrt(2); // obtain side-signal from left and right + * ``` + * @category Component + */ +class MidSideSplit extends ToneAudioNode { + constructor() { + super(optionsFromArguments(MidSideSplit.getDefaults(), arguments)); + this.name = "MidSideSplit"; + this._split = this.input = new Split({ + channels: 2, + context: this.context + }); + this._midAdd = new Add({ context: this.context }); + this.mid = new Multiply({ + context: this.context, + value: Math.SQRT1_2, + }); + this._sideSubtract = new Subtract({ context: this.context }); + this.side = new Multiply({ + context: this.context, + value: Math.SQRT1_2, + }); + this._split.connect(this._midAdd, 0); + this._split.connect(this._midAdd.addend, 1); + this._split.connect(this._sideSubtract, 0); + this._split.connect(this._sideSubtract.subtrahend, 1); + this._midAdd.connect(this.mid); + this._sideSubtract.connect(this.side); + } + dispose() { + super.dispose(); + this.mid.dispose(); + this.side.dispose(); + this._midAdd.dispose(); + this._sideSubtract.dispose(); + this._split.dispose(); + return this; + } +} + +/** + * MidSideMerge merges the mid and side signal after they've been separated by [[MidSideSplit]] + * ``` + * Mid = (Left+Right)/sqrt(2); // obtain mid-signal from left and right + * Side = (Left-Right)/sqrt(2); // obtain side-signal from left and right + * ``` + * @category Component + */ +class MidSideMerge extends ToneAudioNode { + constructor() { + super(optionsFromArguments(MidSideMerge.getDefaults(), arguments)); + this.name = "MidSideMerge"; + this.mid = new Gain({ context: this.context }); + this.side = new Gain({ context: this.context }); + this._left = new Add({ context: this.context }); + this._leftMult = new Multiply({ + context: this.context, + value: Math.SQRT1_2 + }); + this._right = new Subtract({ context: this.context }); + this._rightMult = new Multiply({ + context: this.context, + value: Math.SQRT1_2 + }); + this._merge = this.output = new Merge({ context: this.context }); + this.mid.fan(this._left); + this.side.connect(this._left.addend); + this.mid.connect(this._right); + this.side.connect(this._right.subtrahend); + this._left.connect(this._leftMult); + this._right.connect(this._rightMult); + this._leftMult.connect(this._merge, 0, 0); + this._rightMult.connect(this._merge, 0, 1); + } + dispose() { + super.dispose(); + this.mid.dispose(); + this.side.dispose(); + this._leftMult.dispose(); + this._rightMult.dispose(); + this._left.dispose(); + this._right.dispose(); + return this; + } +} + +/** + * Mid/Side processing separates the the 'mid' signal + * (which comes out of both the left and the right channel) + * and the 'side' (which only comes out of the the side channels) + * and effects them separately before being recombined. + * Applies a Mid/Side seperation and recombination. + * Algorithm found in [kvraudio forums](http://www.kvraudio.com/forum/viewtopic.php?t=212587). + * This is a base-class for Mid/Side Effects. + * @category Effect + */ +class MidSideEffect extends Effect { + constructor(options) { + super(options); + this.name = "MidSideEffect"; + this._midSideMerge = new MidSideMerge({ context: this.context }); + this._midSideSplit = new MidSideSplit({ context: this.context }); + this._midSend = this._midSideSplit.mid; + this._sideSend = this._midSideSplit.side; + this._midReturn = this._midSideMerge.mid; + this._sideReturn = this._midSideMerge.side; + // the connections + this.effectSend.connect(this._midSideSplit); + this._midSideMerge.connect(this.effectReturn); + } + /** + * Connect the mid chain of the effect + */ + connectEffectMid(...nodes) { + this._midSend.chain(...nodes, this._midReturn); + } + /** + * Connect the side chain of the effect + */ + connectEffectSide(...nodes) { + this._sideSend.chain(...nodes, this._sideReturn); + } + dispose() { + super.dispose(); + this._midSideSplit.dispose(); + this._midSideMerge.dispose(); + this._midSend.dispose(); + this._sideSend.dispose(); + this._midReturn.dispose(); + this._sideReturn.dispose(); + return this; + } +} + +/** + * Applies a width factor to the mid/side seperation. + * 0 is all mid and 1 is all side. + * Algorithm found in [kvraudio forums](http://www.kvraudio.com/forum/viewtopic.php?t=212587). + * ``` + * Mid *= 2*(1-width)
+ * Side *= 2*width + * ``` + * @category Effect + */ +class StereoWidener extends MidSideEffect { + constructor() { + super(optionsFromArguments(StereoWidener.getDefaults(), arguments, ["width"])); + this.name = "StereoWidener"; + const options = optionsFromArguments(StereoWidener.getDefaults(), arguments, ["width"]); + this.width = new Signal({ + context: this.context, + value: options.width, + units: "normalRange", + }); + readOnly(this, ["width"]); + this._twoTimesWidthMid = new Multiply({ + context: this.context, + value: 2, + }); + this._twoTimesWidthSide = new Multiply({ + context: this.context, + value: 2, + }); + this._midMult = new Multiply({ context: this.context }); + this._twoTimesWidthMid.connect(this._midMult.factor); + this.connectEffectMid(this._midMult); + this._oneMinusWidth = new Subtract({ context: this.context }); + this._oneMinusWidth.connect(this._twoTimesWidthMid); + connect(this.context.getConstant(1), this._oneMinusWidth); + this.width.connect(this._oneMinusWidth.subtrahend); + this._sideMult = new Multiply({ context: this.context }); + this.width.connect(this._twoTimesWidthSide); + this._twoTimesWidthSide.connect(this._sideMult.factor); + this.connectEffectSide(this._sideMult); + } + static getDefaults() { + return Object.assign(MidSideEffect.getDefaults(), { + width: 0.5, + }); + } + dispose() { + super.dispose(); + this.width.dispose(); + this._midMult.dispose(); + this._sideMult.dispose(); + this._twoTimesWidthMid.dispose(); + this._twoTimesWidthSide.dispose(); + this._oneMinusWidth.dispose(); + return this; + } +} + +/** + * Tremolo modulates the amplitude of an incoming signal using an [[LFO]]. + * The effect is a stereo effect where the modulation phase is inverted in each channel. + * + * @example + * // create a tremolo and start it's LFO + * const tremolo = new Tone.Tremolo(9, 0.75).toDestination().start(); + * // route an oscillator through the tremolo and start it + * const oscillator = new Tone.Oscillator().connect(tremolo).start(); + * + * @category Effect + */ +class Tremolo extends StereoEffect { + constructor() { + super(optionsFromArguments(Tremolo.getDefaults(), arguments, ["frequency", "depth"])); + this.name = "Tremolo"; + const options = optionsFromArguments(Tremolo.getDefaults(), arguments, ["frequency", "depth"]); + this._lfoL = new LFO({ + context: this.context, + type: options.type, + min: 1, + max: 0, + }); + this._lfoR = new LFO({ + context: this.context, + type: options.type, + min: 1, + max: 0, + }); + this._amplitudeL = new Gain({ context: this.context }); + this._amplitudeR = new Gain({ context: this.context }); + this.frequency = new Signal({ + context: this.context, + value: options.frequency, + units: "frequency", + }); + this.depth = new Signal({ + context: this.context, + value: options.depth, + units: "normalRange", + }); + readOnly(this, ["frequency", "depth"]); + this.connectEffectLeft(this._amplitudeL); + this.connectEffectRight(this._amplitudeR); + this._lfoL.connect(this._amplitudeL.gain); + this._lfoR.connect(this._amplitudeR.gain); + this.frequency.fan(this._lfoL.frequency, this._lfoR.frequency); + this.depth.fan(this._lfoR.amplitude, this._lfoL.amplitude); + this.spread = options.spread; + } + static getDefaults() { + return Object.assign(StereoEffect.getDefaults(), { + frequency: 10, + type: "sine", + depth: 0.5, + spread: 180, + }); + } + /** + * Start the tremolo. + */ + start(time) { + this._lfoL.start(time); + this._lfoR.start(time); + return this; + } + /** + * Stop the tremolo. + */ + stop(time) { + this._lfoL.stop(time); + this._lfoR.stop(time); + return this; + } + /** + * Sync the effect to the transport. + */ + sync() { + this._lfoL.sync(); + this._lfoR.sync(); + this.context.transport.syncSignal(this.frequency); + return this; + } + /** + * Unsync the filter from the transport + */ + unsync() { + this._lfoL.unsync(); + this._lfoR.unsync(); + this.context.transport.unsyncSignal(this.frequency); + return this; + } + /** + * The oscillator type. + */ + get type() { + return this._lfoL.type; + } + set type(type) { + this._lfoL.type = type; + this._lfoR.type = type; + } + /** + * Amount of stereo spread. When set to 0, both LFO's will be panned centrally. + * When set to 180, LFO's will be panned hard left and right respectively. + */ + get spread() { + return this._lfoR.phase - this._lfoL.phase; // 180 + } + set spread(spread) { + this._lfoL.phase = 90 - (spread / 2); + this._lfoR.phase = (spread / 2) + 90; + } + dispose() { + super.dispose(); + this._lfoL.dispose(); + this._lfoR.dispose(); + this._amplitudeL.dispose(); + this._amplitudeR.dispose(); + this.frequency.dispose(); + this.depth.dispose(); + return this; + } +} + +/** + * A Vibrato effect composed of a Tone.Delay and a Tone.LFO. The LFO + * modulates the delayTime of the delay, causing the pitch to rise and fall. + * @category Effect + */ +class Vibrato extends Effect { + constructor() { + super(optionsFromArguments(Vibrato.getDefaults(), arguments, ["frequency", "depth"])); + this.name = "Vibrato"; + const options = optionsFromArguments(Vibrato.getDefaults(), arguments, ["frequency", "depth"]); + this._delayNode = new Delay({ + context: this.context, + delayTime: 0, + maxDelay: options.maxDelay, + }); + this._lfo = new LFO({ + context: this.context, + type: options.type, + min: 0, + max: options.maxDelay, + frequency: options.frequency, + phase: -90 // offse the phase so the resting position is in the center + }).start().connect(this._delayNode.delayTime); + this.frequency = this._lfo.frequency; + this.depth = this._lfo.amplitude; + this.depth.value = options.depth; + readOnly(this, ["frequency", "depth"]); + this.effectSend.chain(this._delayNode, this.effectReturn); + } + static getDefaults() { + return Object.assign(Effect.getDefaults(), { + maxDelay: 0.005, + frequency: 5, + depth: 0.1, + type: "sine" + }); + } + /** + * Type of oscillator attached to the Vibrato. + */ + get type() { + return this._lfo.type; + } + set type(type) { + this._lfo.type = type; + } + dispose() { + super.dispose(); + this._delayNode.dispose(); + this._lfo.dispose(); + this.frequency.dispose(); + this.depth.dispose(); + return this; + } +} + +/** + * Wrapper around the native Web Audio's [AnalyserNode](http://webaudio.github.io/web-audio-api/#idl-def-AnalyserNode). + * Extracts FFT or Waveform data from the incoming signal. + * @category Component + */ +class Analyser extends ToneAudioNode { + constructor() { + super(optionsFromArguments(Analyser.getDefaults(), arguments, ["type", "size"])); + this.name = "Analyser"; + /** + * The analyser node. + */ + this._analysers = []; + /** + * The buffer that the FFT data is written to + */ + this._buffers = []; + const options = optionsFromArguments(Analyser.getDefaults(), arguments, ["type", "size"]); + this.input = this.output = this._gain = new Gain({ context: this.context }); + this._split = new Split({ + context: this.context, + channels: options.channels, + }); + this.input.connect(this._split); + assertRange(options.channels, 1); + // create the analysers + for (let channel = 0; channel < options.channels; channel++) { + this._analysers[channel] = this.context.createAnalyser(); + this._split.connect(this._analysers[channel], channel, 0); + } + // set the values initially + this.size = options.size; + this.type = options.type; + } + static getDefaults() { + return Object.assign(ToneAudioNode.getDefaults(), { + size: 1024, + smoothing: 0.8, + type: "fft", + channels: 1, + }); + } + /** + * Run the analysis given the current settings. If [[channels]] = 1, + * it will return a Float32Array. If [[channels]] > 1, it will + * return an array of Float32Arrays where each index in the array + * represents the analysis done on a channel. + */ + getValue() { + this._analysers.forEach((analyser, index) => { + const buffer = this._buffers[index]; + if (this._type === "fft") { + analyser.getFloatFrequencyData(buffer); + } + else if (this._type === "waveform") { + analyser.getFloatTimeDomainData(buffer); + } + }); + if (this.channels === 1) { + return this._buffers[0]; + } + else { + return this._buffers; + } + } + /** + * The size of analysis. This must be a power of two in the range 16 to 16384. + */ + get size() { + return this._analysers[0].frequencyBinCount; + } + set size(size) { + this._analysers.forEach((analyser, index) => { + analyser.fftSize = size * 2; + this._buffers[index] = new Float32Array(size); + }); + } + /** + * The number of channels the analyser does the analysis on. Channel + * separation is done using [[Split]] + */ + get channels() { + return this._analysers.length; + } + /** + * The analysis function returned by analyser.getValue(), either "fft" or "waveform". + */ + get type() { + return this._type; + } + set type(type) { + assert(type === "waveform" || type === "fft", `Analyser: invalid type: ${type}`); + this._type = type; + } + /** + * 0 represents no time averaging with the last analysis frame. + */ + get smoothing() { + return this._analysers[0].smoothingTimeConstant; + } + set smoothing(val) { + this._analysers.forEach(a => a.smoothingTimeConstant = val); + } + /** + * Clean up. + */ + dispose() { + super.dispose(); + this._analysers.forEach(a => a.disconnect()); + this._split.dispose(); + this._gain.dispose(); + return this; + } +} + +/** + * The base class for Metering classes. + */ +class MeterBase extends ToneAudioNode { + constructor() { + super(optionsFromArguments(MeterBase.getDefaults(), arguments)); + this.name = "MeterBase"; + this.input = this.output = this._analyser = new Analyser({ + context: this.context, + size: 256, + type: "waveform", + }); + } + dispose() { + super.dispose(); + this._analyser.dispose(); + return this; + } +} + +/** + * Meter gets the [RMS](https://en.wikipedia.org/wiki/Root_mean_square) + * of an input signal. It can also get the raw value of the input signal. + * + * @example + * const meter = new Tone.Meter(); + * const mic = new Tone.UserMedia(); + * mic.open(); + * // connect mic to the meter + * mic.connect(meter); + * // the current level of the mic + * setInterval(() => console.log(meter.getValue()), 100); + * @category Component + */ +class Meter extends MeterBase { + constructor() { + super(optionsFromArguments(Meter.getDefaults(), arguments, ["smoothing"])); + this.name = "Meter"; + /** + * The previous frame's value + */ + this._rms = 0; + const options = optionsFromArguments(Meter.getDefaults(), arguments, ["smoothing"]); + this.input = this.output = this._analyser = new Analyser({ + context: this.context, + size: 256, + type: "waveform", + channels: options.channels, + }); + this.smoothing = options.smoothing, + this.normalRange = options.normalRange; + } + static getDefaults() { + return Object.assign(MeterBase.getDefaults(), { + smoothing: 0.8, + normalRange: false, + channels: 1, + }); + } + /** + * Use [[getValue]] instead. For the previous getValue behavior, use DCMeter. + * @deprecated + */ + getLevel() { + warn("'getLevel' has been changed to 'getValue'"); + return this.getValue(); + } + /** + * Get the current value of the incoming signal. + * Output is in decibels when [[normalRange]] is `false`. + * If [[channels]] = 1, then the output is a single number + * representing the value of the input signal. When [[channels]] > 1, + * then each channel is returned as a value in a number array. + */ + getValue() { + const aValues = this._analyser.getValue(); + const channelValues = this.channels === 1 ? [aValues] : aValues; + const vals = channelValues.map(values => { + const totalSquared = values.reduce((total, current) => total + current * current, 0); + const rms = Math.sqrt(totalSquared / values.length); + // the rms can only fall at the rate of the smoothing + // but can jump up instantly + this._rms = Math.max(rms, this._rms * this.smoothing); + return this.normalRange ? this._rms : gainToDb(this._rms); + }); + if (this.channels === 1) { + return vals[0]; + } + else { + return vals; + } + } + /** + * The number of channels of analysis. + */ + get channels() { + return this._analyser.channels; + } + dispose() { + super.dispose(); + this._analyser.dispose(); + return this; + } +} + +/** + * Get the current frequency data of the connected audio source using a fast Fourier transform. + * @category Component + */ +class FFT extends MeterBase { + constructor() { + super(optionsFromArguments(FFT.getDefaults(), arguments, ["size"])); + this.name = "FFT"; + const options = optionsFromArguments(FFT.getDefaults(), arguments, ["size"]); + this.normalRange = options.normalRange; + this._analyser.type = "fft"; + this.size = options.size; + } + static getDefaults() { + return Object.assign(ToneAudioNode.getDefaults(), { + normalRange: false, + size: 1024, + smoothing: 0.8, + }); + } + /** + * Gets the current frequency data from the connected audio source. + * Returns the frequency data of length [[size]] as a Float32Array of decibel values. + */ + getValue() { + const values = this._analyser.getValue(); + return values.map(v => this.normalRange ? dbToGain(v) : v); + } + /** + * The size of analysis. This must be a power of two in the range 16 to 16384. + * Determines the size of the array returned by [[getValue]] (i.e. the number of + * frequency bins). Large FFT sizes may be costly to compute. + */ + get size() { + return this._analyser.size; + } + set size(size) { + this._analyser.size = size; + } + /** + * 0 represents no time averaging with the last analysis frame. + */ + get smoothing() { + return this._analyser.smoothing; + } + set smoothing(val) { + this._analyser.smoothing = val; + } + /** + * Returns the frequency value in hertz of each of the indices of the FFT's [[getValue]] response. + * @example + * const fft = new Tone.FFT(32); + * console.log([0, 1, 2, 3, 4].map(index => fft.getFrequencyOfIndex(index))); + */ + getFrequencyOfIndex(index) { + assert(0 <= index && index < this.size, `index must be greater than or equal to 0 and less than ${this.size}`); + return index * this.context.sampleRate / (this.size * 2); + } +} + +/** + * DCMeter gets the raw value of the input signal at the current time. + * + * @example + * const meter = new Tone.DCMeter(); + * const mic = new Tone.UserMedia(); + * mic.open(); + * // connect mic to the meter + * mic.connect(meter); + * // the current level of the mic + * const level = meter.getValue(); + * @category Component + */ +class DCMeter extends MeterBase { + constructor() { + super(optionsFromArguments(DCMeter.getDefaults(), arguments)); + this.name = "DCMeter"; + this._analyser.type = "waveform"; + this._analyser.size = 256; + } + /** + * Get the signal value of the incoming signal + */ + getValue() { + const value = this._analyser.getValue(); + return value[0]; + } +} + +/** + * Get the current waveform data of the connected audio source. + * @category Component + */ +class Waveform extends MeterBase { + constructor() { + super(optionsFromArguments(Waveform.getDefaults(), arguments, ["size"])); + this.name = "Waveform"; + const options = optionsFromArguments(Waveform.getDefaults(), arguments, ["size"]); + this._analyser.type = "waveform"; + this.size = options.size; + } + static getDefaults() { + return Object.assign(MeterBase.getDefaults(), { + size: 1024, + }); + } + /** + * Return the waveform for the current time as a Float32Array where each value in the array + * represents a sample in the waveform. + */ + getValue() { + return this._analyser.getValue(); + } + /** + * The size of analysis. This must be a power of two in the range 16 to 16384. + * Determines the size of the array returned by [[getValue]]. + */ + get size() { + return this._analyser.size; + } + set size(size) { + this._analyser.size = size; + } +} + +/** + * Solo lets you isolate a specific audio stream. When an instance is set to `solo=true`, + * it will mute all other instances of Solo. + * @example + * const soloA = new Tone.Solo().toDestination(); + * const oscA = new Tone.Oscillator("C4", "sawtooth").connect(soloA); + * const soloB = new Tone.Solo().toDestination(); + * const oscB = new Tone.Oscillator("E4", "square").connect(soloB); + * soloA.solo = true; + * // no audio will pass through soloB + * @category Component + */ +class Solo extends ToneAudioNode { + constructor() { + super(optionsFromArguments(Solo.getDefaults(), arguments, ["solo"])); + this.name = "Solo"; + const options = optionsFromArguments(Solo.getDefaults(), arguments, ["solo"]); + this.input = this.output = new Gain({ + context: this.context, + }); + if (!Solo._allSolos.has(this.context)) { + Solo._allSolos.set(this.context, new Set()); + } + Solo._allSolos.get(this.context).add(this); + // set initially + this.solo = options.solo; + } + static getDefaults() { + return Object.assign(ToneAudioNode.getDefaults(), { + solo: false, + }); + } + /** + * Isolates this instance and mutes all other instances of Solo. + * Only one instance can be soloed at a time. A soloed + * instance will report `solo=false` when another instance is soloed. + */ + get solo() { + return this._isSoloed(); + } + set solo(solo) { + if (solo) { + this._addSolo(); + } + else { + this._removeSolo(); + } + Solo._allSolos.get(this.context).forEach(instance => instance._updateSolo()); + } + /** + * If the current instance is muted, i.e. another instance is soloed + */ + get muted() { + return this.input.gain.value === 0; + } + /** + * Add this to the soloed array + */ + _addSolo() { + if (!Solo._soloed.has(this.context)) { + Solo._soloed.set(this.context, new Set()); + } + Solo._soloed.get(this.context).add(this); + } + /** + * Remove this from the soloed array + */ + _removeSolo() { + if (Solo._soloed.has(this.context)) { + Solo._soloed.get(this.context).delete(this); + } + } + /** + * Is this on the soloed array + */ + _isSoloed() { + return Solo._soloed.has(this.context) && Solo._soloed.get(this.context).has(this); + } + /** + * Returns true if no one is soloed + */ + _noSolos() { + // either does not have any soloed added + return !Solo._soloed.has(this.context) || + // or has a solo set but doesn't include any items + (Solo._soloed.has(this.context) && Solo._soloed.get(this.context).size === 0); + } + /** + * Solo the current instance and unsolo all other instances. + */ + _updateSolo() { + if (this._isSoloed()) { + this.input.gain.value = 1; + } + else if (this._noSolos()) { + // no one is soloed + this.input.gain.value = 1; + } + else { + this.input.gain.value = 0; + } + } + dispose() { + super.dispose(); + Solo._allSolos.get(this.context).delete(this); + this._removeSolo(); + return this; + } +} +/** + * Hold all of the solo'ed tracks belonging to a specific context + */ +Solo._allSolos = new Map(); +/** + * Hold the currently solo'ed instance(s) + */ +Solo._soloed = new Map(); + +/** + * PanVol is a Tone.Panner and Tone.Volume in one. + * @example + * // pan the incoming signal left and drop the volume + * const panVol = new Tone.PanVol(-0.25, -12).toDestination(); + * const osc = new Tone.Oscillator().connect(panVol).start(); + * @category Component + */ +class PanVol extends ToneAudioNode { + constructor() { + super(optionsFromArguments(PanVol.getDefaults(), arguments, ["pan", "volume"])); + this.name = "PanVol"; + const options = optionsFromArguments(PanVol.getDefaults(), arguments, ["pan", "volume"]); + this._panner = this.input = new Panner({ + context: this.context, + pan: options.pan, + channelCount: options.channelCount, + }); + this.pan = this._panner.pan; + this._volume = this.output = new Volume({ + context: this.context, + volume: options.volume, + }); + this.volume = this._volume.volume; + // connections + this._panner.connect(this._volume); + this.mute = options.mute; + readOnly(this, ["pan", "volume"]); + } + static getDefaults() { + return Object.assign(ToneAudioNode.getDefaults(), { + mute: false, + pan: 0, + volume: 0, + channelCount: 1, + }); + } + /** + * Mute/unmute the volume + */ + get mute() { + return this._volume.mute; + } + set mute(mute) { + this._volume.mute = mute; + } + dispose() { + super.dispose(); + this._panner.dispose(); + this.pan.dispose(); + this._volume.dispose(); + this.volume.dispose(); + return this; + } +} + +/** + * Channel provides a channel strip interface with volume, pan, solo and mute controls. + * See [[PanVol]] and [[Solo]] + * @example + * // pan the incoming signal left and drop the volume 12db + * const channel = new Tone.Channel(-0.25, -12); + * @category Component + */ +class Channel extends ToneAudioNode { + constructor() { + super(optionsFromArguments(Channel.getDefaults(), arguments, ["volume", "pan"])); + this.name = "Channel"; + const options = optionsFromArguments(Channel.getDefaults(), arguments, ["volume", "pan"]); + this._solo = this.input = new Solo({ + solo: options.solo, + context: this.context, + }); + this._panVol = this.output = new PanVol({ + context: this.context, + pan: options.pan, + volume: options.volume, + mute: options.mute, + channelCount: options.channelCount + }); + this.pan = this._panVol.pan; + this.volume = this._panVol.volume; + this._solo.connect(this._panVol); + readOnly(this, ["pan", "volume"]); + } + static getDefaults() { + return Object.assign(ToneAudioNode.getDefaults(), { + pan: 0, + volume: 0, + mute: false, + solo: false, + channelCount: 1, + }); + } + /** + * Solo/unsolo the channel. Soloing is only relative to other [[Channels]] and [[Solo]] instances + */ + get solo() { + return this._solo.solo; + } + set solo(solo) { + this._solo.solo = solo; + } + /** + * If the current instance is muted, i.e. another instance is soloed, + * or the channel is muted + */ + get muted() { + return this._solo.muted || this.mute; + } + /** + * Mute/unmute the volume + */ + get mute() { + return this._panVol.mute; + } + set mute(mute) { + this._panVol.mute = mute; + } + /** + * Get the gain node belonging to the bus name. Create it if + * it doesn't exist + * @param name The bus name + */ + _getBus(name) { + if (!Channel.buses.has(name)) { + Channel.buses.set(name, new Gain({ context: this.context })); + } + return Channel.buses.get(name); + } + /** + * Send audio to another channel using a string. `send` is a lot like + * [[connect]], except it uses a string instead of an object. This can + * be useful in large applications to decouple sections since [[send]] + * and [[receive]] can be invoked separately in order to connect an object + * @param name The channel name to send the audio + * @param volume The amount of the signal to send. + * Defaults to 0db, i.e. send the entire signal + * @returns Returns the gain node of this connection. + */ + send(name, volume = 0) { + const bus = this._getBus(name); + const sendKnob = new Gain({ + context: this.context, + units: "decibels", + gain: volume, + }); + this.connect(sendKnob); + sendKnob.connect(bus); + return sendKnob; + } + /** + * Receive audio from a channel which was connected with [[send]]. + * @param name The channel name to receive audio from. + */ + receive(name) { + const bus = this._getBus(name); + bus.connect(this); + return this; + } + dispose() { + super.dispose(); + this._panVol.dispose(); + this.pan.dispose(); + this.volume.dispose(); + this._solo.dispose(); + return this; + } +} +/** + * Store the send/receive channels by name. + */ +Channel.buses = new Map(); + +/** + * Mono coerces the incoming mono or stereo signal into a mono signal + * where both left and right channels have the same value. This can be useful + * for [stereo imaging](https://en.wikipedia.org/wiki/Stereo_imaging). + * @category Component + */ +class Mono extends ToneAudioNode { + constructor() { + super(optionsFromArguments(Mono.getDefaults(), arguments)); + this.name = "Mono"; + this.input = new Gain({ context: this.context }); + this._merge = this.output = new Merge({ + channels: 2, + context: this.context, + }); + this.input.connect(this._merge, 0, 0); + this.input.connect(this._merge, 0, 1); + } + dispose() { + super.dispose(); + this._merge.dispose(); + this.input.dispose(); + return this; + } +} + +/** + * Split the incoming signal into three bands (low, mid, high) + * with two crossover frequency controls. + * ``` + * +----------------------+ + * +-> input < lowFrequency +------------------> low + * | +----------------------+ + * | + * | +--------------------------------------+ + * input ---+-> lowFrequency < input < highFrequency +--> mid + * | +--------------------------------------+ + * | + * | +-----------------------+ + * +-> highFrequency < input +-----------------> high + * +-----------------------+ + * ``` + * @category Component + */ +class MultibandSplit extends ToneAudioNode { + constructor() { + super(optionsFromArguments(MultibandSplit.getDefaults(), arguments, ["lowFrequency", "highFrequency"])); + this.name = "MultibandSplit"; + /** + * the input + */ + this.input = new Gain({ context: this.context }); + /** + * no output node, use either low, mid or high outputs + */ + this.output = undefined; + /** + * The low band. + */ + this.low = new Filter({ + context: this.context, + frequency: 0, + type: "lowpass", + }); + /** + * the lower filter of the mid band + */ + this._lowMidFilter = new Filter({ + context: this.context, + frequency: 0, + type: "highpass", + }); + /** + * The mid band output. + */ + this.mid = new Filter({ + context: this.context, + frequency: 0, + type: "lowpass", + }); + /** + * The high band output. + */ + this.high = new Filter({ + context: this.context, + frequency: 0, + type: "highpass", + }); + this._internalChannels = [this.low, this.mid, this.high]; + const options = optionsFromArguments(MultibandSplit.getDefaults(), arguments, ["lowFrequency", "highFrequency"]); + this.lowFrequency = new Signal({ + context: this.context, + units: "frequency", + value: options.lowFrequency, + }); + this.highFrequency = new Signal({ + context: this.context, + units: "frequency", + value: options.highFrequency, + }); + this.Q = new Signal({ + context: this.context, + units: "positive", + value: options.Q, + }); + this.input.fan(this.low, this.high); + this.input.chain(this._lowMidFilter, this.mid); + // the frequency control signal + this.lowFrequency.fan(this.low.frequency, this._lowMidFilter.frequency); + this.highFrequency.fan(this.mid.frequency, this.high.frequency); + // the Q value + this.Q.connect(this.low.Q); + this.Q.connect(this._lowMidFilter.Q); + this.Q.connect(this.mid.Q); + this.Q.connect(this.high.Q); + readOnly(this, ["high", "mid", "low", "highFrequency", "lowFrequency"]); + } + static getDefaults() { + return Object.assign(ToneAudioNode.getDefaults(), { + Q: 1, + highFrequency: 2500, + lowFrequency: 400, + }); + } + /** + * Clean up. + */ + dispose() { + super.dispose(); + writable(this, ["high", "mid", "low", "highFrequency", "lowFrequency"]); + this.low.dispose(); + this._lowMidFilter.dispose(); + this.mid.dispose(); + this.high.dispose(); + this.lowFrequency.dispose(); + this.highFrequency.dispose(); + this.Q.dispose(); + return this; + } +} + +/** + * Tone.Listener is a thin wrapper around the AudioListener. Listener combined + * with [[Panner3D]] makes up the Web Audio API's 3D panning system. Panner3D allows you + * to place sounds in 3D and Listener allows you to navigate the 3D sound environment from + * a first-person perspective. There is only one listener per audio context. + */ +class Listener extends ToneAudioNode { + constructor() { + super(...arguments); + this.name = "Listener"; + this.positionX = new Param({ + context: this.context, + param: this.context.rawContext.listener.positionX, + }); + this.positionY = new Param({ + context: this.context, + param: this.context.rawContext.listener.positionY, + }); + this.positionZ = new Param({ + context: this.context, + param: this.context.rawContext.listener.positionZ, + }); + this.forwardX = new Param({ + context: this.context, + param: this.context.rawContext.listener.forwardX, + }); + this.forwardY = new Param({ + context: this.context, + param: this.context.rawContext.listener.forwardY, + }); + this.forwardZ = new Param({ + context: this.context, + param: this.context.rawContext.listener.forwardZ, + }); + this.upX = new Param({ + context: this.context, + param: this.context.rawContext.listener.upX, + }); + this.upY = new Param({ + context: this.context, + param: this.context.rawContext.listener.upY, + }); + this.upZ = new Param({ + context: this.context, + param: this.context.rawContext.listener.upZ, + }); + } + static getDefaults() { + return Object.assign(ToneAudioNode.getDefaults(), { + positionX: 0, + positionY: 0, + positionZ: 0, + forwardX: 0, + forwardY: 0, + forwardZ: -1, + upX: 0, + upY: 1, + upZ: 0, + }); + } + dispose() { + super.dispose(); + this.positionX.dispose(); + this.positionY.dispose(); + this.positionZ.dispose(); + this.forwardX.dispose(); + this.forwardY.dispose(); + this.forwardZ.dispose(); + this.upX.dispose(); + this.upY.dispose(); + this.upZ.dispose(); + return this; + } +} +//------------------------------------- +// INITIALIZATION +//------------------------------------- +onContextInit(context => { + context.listener = new Listener({ context }); +}); +onContextClose(context => { + context.listener.dispose(); +}); + +/** + * A spatialized panner node which supports equalpower or HRTF panning. + * @category Component + */ +class Panner3D extends ToneAudioNode { + constructor() { + super(optionsFromArguments(Panner3D.getDefaults(), arguments, ["positionX", "positionY", "positionZ"])); + this.name = "Panner3D"; + const options = optionsFromArguments(Panner3D.getDefaults(), arguments, ["positionX", "positionY", "positionZ"]); + this._panner = this.input = this.output = this.context.createPanner(); + // set some values + this.panningModel = options.panningModel; + this.maxDistance = options.maxDistance; + this.distanceModel = options.distanceModel; + this.coneOuterGain = options.coneOuterGain; + this.coneOuterAngle = options.coneOuterAngle; + this.coneInnerAngle = options.coneInnerAngle; + this.refDistance = options.refDistance; + this.rolloffFactor = options.rolloffFactor; + this.positionX = new Param({ + context: this.context, + param: this._panner.positionX, + value: options.positionX, + }); + this.positionY = new Param({ + context: this.context, + param: this._panner.positionY, + value: options.positionY, + }); + this.positionZ = new Param({ + context: this.context, + param: this._panner.positionZ, + value: options.positionZ, + }); + this.orientationX = new Param({ + context: this.context, + param: this._panner.orientationX, + value: options.orientationX, + }); + this.orientationY = new Param({ + context: this.context, + param: this._panner.orientationY, + value: options.orientationY, + }); + this.orientationZ = new Param({ + context: this.context, + param: this._panner.orientationZ, + value: options.orientationZ, + }); + } + static getDefaults() { + return Object.assign(ToneAudioNode.getDefaults(), { + coneInnerAngle: 360, + coneOuterAngle: 360, + coneOuterGain: 0, + distanceModel: "inverse", + maxDistance: 10000, + orientationX: 0, + orientationY: 0, + orientationZ: 0, + panningModel: "equalpower", + positionX: 0, + positionY: 0, + positionZ: 0, + refDistance: 1, + rolloffFactor: 1, + }); + } + /** + * Sets the position of the source in 3d space. + */ + setPosition(x, y, z) { + this.positionX.value = x; + this.positionY.value = y; + this.positionZ.value = z; + return this; + } + /** + * Sets the orientation of the source in 3d space. + */ + setOrientation(x, y, z) { + this.orientationX.value = x; + this.orientationY.value = y; + this.orientationZ.value = z; + return this; + } + /** + * The panning model. Either "equalpower" or "HRTF". + */ + get panningModel() { + return this._panner.panningModel; + } + set panningModel(val) { + this._panner.panningModel = val; + } + /** + * A reference distance for reducing volume as source move further from the listener + */ + get refDistance() { + return this._panner.refDistance; + } + set refDistance(val) { + this._panner.refDistance = val; + } + /** + * Describes how quickly the volume is reduced as source moves away from listener. + */ + get rolloffFactor() { + return this._panner.rolloffFactor; + } + set rolloffFactor(val) { + this._panner.rolloffFactor = val; + } + /** + * The distance model used by, "linear", "inverse", or "exponential". + */ + get distanceModel() { + return this._panner.distanceModel; + } + set distanceModel(val) { + this._panner.distanceModel = val; + } + /** + * The angle, in degrees, inside of which there will be no volume reduction + */ + get coneInnerAngle() { + return this._panner.coneInnerAngle; + } + set coneInnerAngle(val) { + this._panner.coneInnerAngle = val; + } + /** + * The angle, in degrees, outside of which the volume will be reduced + * to a constant value of coneOuterGain + */ + get coneOuterAngle() { + return this._panner.coneOuterAngle; + } + set coneOuterAngle(val) { + this._panner.coneOuterAngle = val; + } + /** + * The gain outside of the coneOuterAngle + */ + get coneOuterGain() { + return this._panner.coneOuterGain; + } + set coneOuterGain(val) { + this._panner.coneOuterGain = val; + } + /** + * The maximum distance between source and listener, + * after which the volume will not be reduced any further. + */ + get maxDistance() { + return this._panner.maxDistance; + } + set maxDistance(val) { + this._panner.maxDistance = val; + } + dispose() { + super.dispose(); + this._panner.disconnect(); + this.orientationX.dispose(); + this.orientationY.dispose(); + this.orientationZ.dispose(); + this.positionX.dispose(); + this.positionY.dispose(); + this.positionZ.dispose(); + return this; + } +} + +/** + * A wrapper around the MediaRecorder API. Unlike the rest of Tone.js, this module does not offer + * any sample-accurate scheduling because it is not a feature of the MediaRecorder API. + * This is only natively supported in Chrome and Firefox. + * For a cross-browser shim, install (audio-recorder-polyfill)[https://www.npmjs.com/package/audio-recorder-polyfill]. + * @example + * const recorder = new Tone.Recorder(); + * const synth = new Tone.Synth().connect(recorder); + * // start recording + * recorder.start(); + * // generate a few notes + * synth.triggerAttackRelease("C3", 0.5); + * synth.triggerAttackRelease("C4", 0.5, "+1"); + * synth.triggerAttackRelease("C5", 0.5, "+2"); + * // wait for the notes to end and stop the recording + * setTimeout(async () => { + * // the recorded audio is returned as a blob + * const recording = await recorder.stop(); + * // download the recording by creating an anchor element and blob url + * const url = URL.createObjectURL(recording); + * const anchor = document.createElement("a"); + * anchor.download = "recording.webm"; + * anchor.href = url; + * anchor.click(); + * }, 4000); + * @category Component + */ +class Recorder extends ToneAudioNode { + constructor() { + super(optionsFromArguments(Recorder.getDefaults(), arguments)); + this.name = "Recorder"; + const options = optionsFromArguments(Recorder.getDefaults(), arguments); + this.input = new Gain({ + context: this.context + }); + assert(Recorder.supported, "Media Recorder API is not available"); + this._stream = this.context.createMediaStreamDestination(); + this.input.connect(this._stream); + this._recorder = new MediaRecorder(this._stream.stream, { + mimeType: options.mimeType + }); + } + static getDefaults() { + return ToneAudioNode.getDefaults(); + } + /** + * The mime type is the format that the audio is encoded in. For Chrome + * that is typically webm encoded as "vorbis". + */ + get mimeType() { + return this._recorder.mimeType; + } + /** + * Test if your platform supports the Media Recorder API. If it's not available, + * try installing this (polyfill)[https://www.npmjs.com/package/audio-recorder-polyfill]. + */ + static get supported() { + return theWindow !== null && Reflect.has(theWindow, "MediaRecorder"); + } + /** + * Get the playback state of the Recorder, either "started", "stopped" or "paused" + */ + get state() { + if (this._recorder.state === "inactive") { + return "stopped"; + } + else if (this._recorder.state === "paused") { + return "paused"; + } + else { + return "started"; + } + } + /** + * Start the Recorder. Returns a promise which resolves + * when the recorder has started. + */ + start() { + return __awaiter(this, void 0, void 0, function* () { + assert(this.state !== "started", "Recorder is already started"); + const startPromise = new Promise(done => { + const handleStart = () => { + this._recorder.removeEventListener("start", handleStart, false); + done(); + }; + this._recorder.addEventListener("start", handleStart, false); + }); + this._recorder.start(); + return yield startPromise; + }); + } + /** + * Stop the recorder. Returns a promise with the recorded content until this point + * encoded as [[mimeType]] + */ + stop() { + return __awaiter(this, void 0, void 0, function* () { + assert(this.state !== "stopped", "Recorder is not started"); + const dataPromise = new Promise(done => { + const handleData = (e) => { + this._recorder.removeEventListener("dataavailable", handleData, false); + done(e.data); + }; + this._recorder.addEventListener("dataavailable", handleData, false); + }); + this._recorder.stop(); + return yield dataPromise; + }); + } + /** + * Pause the recorder + */ + pause() { + assert(this.state === "started", "Recorder must be started"); + this._recorder.pause(); + return this; + } + dispose() { + super.dispose(); + this.input.dispose(); + this._stream.disconnect(); + return this; + } +} + +/** + * Compressor is a thin wrapper around the Web Audio + * [DynamicsCompressorNode](http://webaudio.github.io/web-audio-api/#the-dynamicscompressornode-interface). + * Compression reduces the volume of loud sounds or amplifies quiet sounds + * by narrowing or "compressing" an audio signal's dynamic range. + * Read more on [Wikipedia](https://en.wikipedia.org/wiki/Dynamic_range_compression). + * @example + * const comp = new Tone.Compressor(-30, 3); + * @category Component + */ +class Compressor extends ToneAudioNode { + constructor() { + super(optionsFromArguments(Compressor.getDefaults(), arguments, ["threshold", "ratio"])); + this.name = "Compressor"; + /** + * the compressor node + */ + this._compressor = this.context.createDynamicsCompressor(); + this.input = this._compressor; + this.output = this._compressor; + const options = optionsFromArguments(Compressor.getDefaults(), arguments, ["threshold", "ratio"]); + this.threshold = new Param({ + minValue: this._compressor.threshold.minValue, + maxValue: this._compressor.threshold.maxValue, + context: this.context, + convert: false, + param: this._compressor.threshold, + units: "decibels", + value: options.threshold, + }); + this.attack = new Param({ + minValue: this._compressor.attack.minValue, + maxValue: this._compressor.attack.maxValue, + context: this.context, + param: this._compressor.attack, + units: "time", + value: options.attack, + }); + this.release = new Param({ + minValue: this._compressor.release.minValue, + maxValue: this._compressor.release.maxValue, + context: this.context, + param: this._compressor.release, + units: "time", + value: options.release, + }); + this.knee = new Param({ + minValue: this._compressor.knee.minValue, + maxValue: this._compressor.knee.maxValue, + context: this.context, + convert: false, + param: this._compressor.knee, + units: "decibels", + value: options.knee, + }); + this.ratio = new Param({ + minValue: this._compressor.ratio.minValue, + maxValue: this._compressor.ratio.maxValue, + context: this.context, + convert: false, + param: this._compressor.ratio, + units: "positive", + value: options.ratio, + }); + // set the defaults + readOnly(this, ["knee", "release", "attack", "ratio", "threshold"]); + } + static getDefaults() { + return Object.assign(ToneAudioNode.getDefaults(), { + attack: 0.003, + knee: 30, + ratio: 12, + release: 0.25, + threshold: -24, + }); + } + /** + * A read-only decibel value for metering purposes, representing the current amount of gain + * reduction that the compressor is applying to the signal. If fed no signal the value will be 0 (no gain reduction). + */ + get reduction() { + return this._compressor.reduction; + } + dispose() { + super.dispose(); + this._compressor.disconnect(); + this.attack.dispose(); + this.release.dispose(); + this.threshold.dispose(); + this.ratio.dispose(); + this.knee.dispose(); + return this; + } +} + +/** + * Gate only passes a signal through when the incoming + * signal exceeds a specified threshold. It uses [[Follower]] to follow the ampltiude + * of the incoming signal and compares it to the [[threshold]] value using [[GreaterThan]]. + * + * @example + * const gate = new Tone.Gate(-30, 0.2).toDestination(); + * const mic = new Tone.UserMedia().connect(gate); + * // the gate will only pass through the incoming + * // signal when it's louder than -30db + * @category Component + */ +class Gate extends ToneAudioNode { + constructor() { + super(Object.assign(optionsFromArguments(Gate.getDefaults(), arguments, ["threshold", "smoothing"]))); + this.name = "Gate"; + const options = optionsFromArguments(Gate.getDefaults(), arguments, ["threshold", "smoothing"]); + this._follower = new Follower({ + context: this.context, + smoothing: options.smoothing, + }); + this._gt = new GreaterThan({ + context: this.context, + value: dbToGain(options.threshold), + }); + this.input = new Gain({ context: this.context }); + this._gate = this.output = new Gain({ context: this.context }); + // connections + this.input.connect(this._gate); + // the control signal + this.input.chain(this._follower, this._gt, this._gate.gain); + } + static getDefaults() { + return Object.assign(ToneAudioNode.getDefaults(), { + smoothing: 0.1, + threshold: -40 + }); + } + /** + * The threshold of the gate in decibels + */ + get threshold() { + return gainToDb(this._gt.value); + } + set threshold(thresh) { + this._gt.value = dbToGain(thresh); + } + /** + * The attack/decay speed of the gate. See [[Follower.smoothing]] + */ + get smoothing() { + return this._follower.smoothing; + } + set smoothing(smoothingTime) { + this._follower.smoothing = smoothingTime; + } + dispose() { + super.dispose(); + this.input.dispose(); + this._follower.dispose(); + this._gt.dispose(); + this._gate.dispose(); + return this; + } +} + +/** + * Limiter will limit the loudness of an incoming signal. + * Under the hood it's composed of a [[Compressor]] with a fast attack + * and release and max compression ratio. + * + * @example + * const limiter = new Tone.Limiter(-20).toDestination(); + * const oscillator = new Tone.Oscillator().connect(limiter); + * oscillator.start(); + * @category Component + */ +class Limiter extends ToneAudioNode { + constructor() { + super(Object.assign(optionsFromArguments(Limiter.getDefaults(), arguments, ["threshold"]))); + this.name = "Limiter"; + const options = optionsFromArguments(Limiter.getDefaults(), arguments, ["threshold"]); + this._compressor = this.input = this.output = new Compressor({ + context: this.context, + ratio: 20, + attack: 0.003, + release: 0.01, + threshold: options.threshold + }); + this.threshold = this._compressor.threshold; + readOnly(this, "threshold"); + } + static getDefaults() { + return Object.assign(ToneAudioNode.getDefaults(), { + threshold: -12 + }); + } + /** + * A read-only decibel value for metering purposes, representing the current amount of gain + * reduction that the compressor is applying to the signal. + */ + get reduction() { + return this._compressor.reduction; + } + dispose() { + super.dispose(); + this._compressor.dispose(); + this.threshold.dispose(); + return this; + } +} + +/** + * MidSideCompressor applies two different compressors to the [[mid]] + * and [[side]] signal components of the input. See [[MidSideSplit]] and [[MidSideMerge]]. + * @category Component + */ +class MidSideCompressor extends ToneAudioNode { + constructor() { + super(Object.assign(optionsFromArguments(MidSideCompressor.getDefaults(), arguments))); + this.name = "MidSideCompressor"; + const options = optionsFromArguments(MidSideCompressor.getDefaults(), arguments); + this._midSideSplit = this.input = new MidSideSplit({ context: this.context }); + this._midSideMerge = this.output = new MidSideMerge({ context: this.context }); + this.mid = new Compressor(Object.assign(options.mid, { context: this.context })); + this.side = new Compressor(Object.assign(options.side, { context: this.context })); + this._midSideSplit.mid.chain(this.mid, this._midSideMerge.mid); + this._midSideSplit.side.chain(this.side, this._midSideMerge.side); + readOnly(this, ["mid", "side"]); + } + static getDefaults() { + return Object.assign(ToneAudioNode.getDefaults(), { + mid: { + ratio: 3, + threshold: -24, + release: 0.03, + attack: 0.02, + knee: 16 + }, + side: { + ratio: 6, + threshold: -30, + release: 0.25, + attack: 0.03, + knee: 10 + } + }); + } + dispose() { + super.dispose(); + this.mid.dispose(); + this.side.dispose(); + this._midSideSplit.dispose(); + this._midSideMerge.dispose(); + return this; + } +} + +/** + * A compressor with separate controls over low/mid/high dynamics. See [[Compressor]] and [[MultibandSplit]] + * + * @example + * const multiband = new Tone.MultibandCompressor({ + * lowFrequency: 200, + * highFrequency: 1300, + * low: { + * threshold: -12 + * } + * }); + * @category Component + */ +class MultibandCompressor extends ToneAudioNode { + constructor() { + super(Object.assign(optionsFromArguments(MultibandCompressor.getDefaults(), arguments))); + this.name = "MultibandCompressor"; + const options = optionsFromArguments(MultibandCompressor.getDefaults(), arguments); + this._splitter = this.input = new MultibandSplit({ + context: this.context, + lowFrequency: options.lowFrequency, + highFrequency: options.highFrequency + }); + this.lowFrequency = this._splitter.lowFrequency; + this.highFrequency = this._splitter.highFrequency; + this.output = new Gain({ context: this.context }); + this.low = new Compressor(Object.assign(options.low, { context: this.context })); + this.mid = new Compressor(Object.assign(options.mid, { context: this.context })); + this.high = new Compressor(Object.assign(options.high, { context: this.context })); + // connect the compressor + this._splitter.low.chain(this.low, this.output); + this._splitter.mid.chain(this.mid, this.output); + this._splitter.high.chain(this.high, this.output); + readOnly(this, ["high", "mid", "low", "highFrequency", "lowFrequency"]); + } + static getDefaults() { + return Object.assign(ToneAudioNode.getDefaults(), { + lowFrequency: 250, + highFrequency: 2000, + low: { + ratio: 6, + threshold: -30, + release: 0.25, + attack: 0.03, + knee: 10 + }, + mid: { + ratio: 3, + threshold: -24, + release: 0.03, + attack: 0.02, + knee: 16 + }, + high: { + ratio: 3, + threshold: -24, + release: 0.03, + attack: 0.02, + knee: 16 + }, + }); + } + dispose() { + super.dispose(); + this._splitter.dispose(); + this.low.dispose(); + this.mid.dispose(); + this.high.dispose(); + this.output.dispose(); + return this; + } +} + +/** + * EQ3 provides 3 equalizer bins: Low/Mid/High. + * @category Component + */ +class EQ3 extends ToneAudioNode { + constructor() { + super(optionsFromArguments(EQ3.getDefaults(), arguments, ["low", "mid", "high"])); + this.name = "EQ3"; + /** + * the output + */ + this.output = new Gain({ context: this.context }); + this._internalChannels = []; + const options = optionsFromArguments(EQ3.getDefaults(), arguments, ["low", "mid", "high"]); + this.input = this._multibandSplit = new MultibandSplit({ + context: this.context, + highFrequency: options.highFrequency, + lowFrequency: options.lowFrequency, + }); + this._lowGain = new Gain({ + context: this.context, + gain: options.low, + units: "decibels", + }); + this._midGain = new Gain({ + context: this.context, + gain: options.mid, + units: "decibels", + }); + this._highGain = new Gain({ + context: this.context, + gain: options.high, + units: "decibels", + }); + this.low = this._lowGain.gain; + this.mid = this._midGain.gain; + this.high = this._highGain.gain; + this.Q = this._multibandSplit.Q; + this.lowFrequency = this._multibandSplit.lowFrequency; + this.highFrequency = this._multibandSplit.highFrequency; + // the frequency bands + this._multibandSplit.low.chain(this._lowGain, this.output); + this._multibandSplit.mid.chain(this._midGain, this.output); + this._multibandSplit.high.chain(this._highGain, this.output); + readOnly(this, ["low", "mid", "high", "lowFrequency", "highFrequency"]); + this._internalChannels = [this._multibandSplit]; + } + static getDefaults() { + return Object.assign(ToneAudioNode.getDefaults(), { + high: 0, + highFrequency: 2500, + low: 0, + lowFrequency: 400, + mid: 0, + }); + } + /** + * Clean up. + */ + dispose() { + super.dispose(); + writable(this, ["low", "mid", "high", "lowFrequency", "highFrequency"]); + this._multibandSplit.dispose(); + this.lowFrequency.dispose(); + this.highFrequency.dispose(); + this._lowGain.dispose(); + this._midGain.dispose(); + this._highGain.dispose(); + this.low.dispose(); + this.mid.dispose(); + this.high.dispose(); + this.Q.dispose(); + return this; + } +} + +/** + * Convolver is a wrapper around the Native Web Audio + * [ConvolverNode](http://webaudio.github.io/web-audio-api/#the-convolvernode-interface). + * Convolution is useful for reverb and filter emulation. Read more about convolution reverb on + * [Wikipedia](https://en.wikipedia.org/wiki/Convolution_reverb). + * + * @example + * // initializing the convolver with an impulse response + * const convolver = new Tone.Convolver("./path/to/ir.wav").toDestination(); + * @category Component + */ +class Convolver extends ToneAudioNode { + constructor() { + super(optionsFromArguments(Convolver.getDefaults(), arguments, ["url", "onload"])); + this.name = "Convolver"; + /** + * The native ConvolverNode + */ + this._convolver = this.context.createConvolver(); + const options = optionsFromArguments(Convolver.getDefaults(), arguments, ["url", "onload"]); + this._buffer = new ToneAudioBuffer(options.url, buffer => { + this.buffer = buffer; + options.onload(); + }); + this.input = new Gain({ context: this.context }); + this.output = new Gain({ context: this.context }); + // set if it's already loaded, set it immediately + if (this._buffer.loaded) { + this.buffer = this._buffer; + } + // initially set normalization + this.normalize = options.normalize; + // connect it up + this.input.chain(this._convolver, this.output); + } + static getDefaults() { + return Object.assign(ToneAudioNode.getDefaults(), { + normalize: true, + onload: noOp, + }); + } + /** + * Load an impulse response url as an audio buffer. + * Decodes the audio asynchronously and invokes + * the callback once the audio buffer loads. + * @param url The url of the buffer to load. filetype support depends on the browser. + */ + load(url) { + return __awaiter(this, void 0, void 0, function* () { + this.buffer = yield this._buffer.load(url); + }); + } + /** + * The convolver's buffer + */ + get buffer() { + if (this._buffer.length) { + return this._buffer; + } + else { + return null; + } + } + set buffer(buffer) { + if (buffer) { + this._buffer.set(buffer); + } + // if it's already got a buffer, create a new one + if (this._convolver.buffer) { + // disconnect the old one + this.input.disconnect(); + this._convolver.disconnect(); + // create and connect a new one + this._convolver = this.context.createConvolver(); + this.input.chain(this._convolver, this.output); + } + const buff = this._buffer.get(); + this._convolver.buffer = buff ? buff : null; + } + /** + * The normalize property of the ConvolverNode interface is a boolean that + * controls whether the impulse response from the buffer will be scaled by + * an equal-power normalization when the buffer attribute is set, or not. + */ + get normalize() { + return this._convolver.normalize; + } + set normalize(norm) { + this._convolver.normalize = norm; + } + dispose() { + super.dispose(); + this._buffer.dispose(); + this._convolver.disconnect(); + return this; + } +} + +/** + * The current audio context time of the global [[Context]]. + * See [[Context.now]] + * @category Core + */ +function now() { + return getContext().now(); +} +/** + * The current audio context time of the global [[Context]] without the [[Context.lookAhead]] + * See [[Context.immediate]] + * @category Core + */ +function immediate() { + return getContext().immediate(); +} +/** + * The Transport object belonging to the global Tone.js Context. + * See [[Transport]] + * @category Core + */ +const Transport$1 = getContext().transport; +/** + * The Transport object belonging to the global Tone.js Context. + * See [[Transport]] + * @category Core + */ +function getTransport() { + return getContext().transport; +} +/** + * The Destination (output) belonging to the global Tone.js Context. + * See [[Destination]] + * @category Core + */ +const Destination$1 = getContext().destination; +/** + * @deprecated Use [[Destination]] + */ +const Master = getContext().destination; +/** + * The Destination (output) belonging to the global Tone.js Context. + * See [[Destination]] + * @category Core + */ +function getDestination() { + return getContext().destination; +} +/** + * The [[Listener]] belonging to the global Tone.js Context. + * @category Core + */ +const Listener$1 = getContext().listener; +/** + * The [[Listener]] belonging to the global Tone.js Context. + * @category Core + */ +function getListener() { + return getContext().listener; +} +/** + * Draw is used to synchronize the draw frame with the Transport's callbacks. + * See [[Draw]] + * @category Core + */ +const Draw$1 = getContext().draw; +/** + * Get the singleton attached to the global context. + * Draw is used to synchronize the draw frame with the Transport's callbacks. + * See [[Draw]] + * @category Core + */ +function getDraw() { + return getContext().draw; +} +/** + * A reference to the global context + * See [[Context]] + */ +const context = getContext(); +/** + * Promise which resolves when all of the loading promises are resolved. + * Alias for static [[ToneAudioBuffer.loaded]] method. + * @category Core + */ +function loaded() { + return ToneAudioBuffer.loaded(); +} +const Buffer = ToneAudioBuffer; +const Buffers = ToneAudioBuffers; +const BufferSource = ToneBufferSource; + +export { AMOscillator, AMSynth, Abs, Add, AmplitudeEnvelope, Analyser, AudioToGain, AutoFilter, AutoPanner, AutoWah, BaseContext, BiquadFilter, BitCrusher, Buffer, BufferSource, Buffers, Channel, Chebyshev, Chorus, Clock, Compressor, Context, Convolver, CrossFade, DCMeter, Delay, Destination$1 as Destination, Distortion, Draw$1 as Draw, DuoSynth, EQ3, Emitter, Envelope, FFT, FMOscillator, FMSynth, FatOscillator, FeedbackCombFilter, FeedbackDelay, Filter, Follower, Freeverb, Frequency, FrequencyClass, FrequencyEnvelope, FrequencyShifter, Gain, GainToAudio, Gate, GrainPlayer, GreaterThan, GreaterThanZero, IntervalTimeline, JCReverb, LFO, Limiter, Listener$1 as Listener, Loop, LowpassCombFilter, Master, MembraneSynth, Merge, MetalSynth, Meter, MidSideCompressor, MidSideMerge, MidSideSplit, Midi, MidiClass, Mono, MonoSynth, MultibandCompressor, MultibandSplit, Multiply, Negate, Noise, NoiseSynth, Offline, OfflineContext, OmniOscillator, OnePoleFilter, Oscillator, PWMOscillator, PanVol, Panner, Panner3D, Param, Part, Pattern, Phaser, PingPongDelay, PitchShift, Player, Players, PluckSynth, PolySynth, Pow, PulseOscillator, Recorder, Reverb, Sampler, Scale, ScaleExp, Sequence, Signal, Solo, Split, StateTimeline, StereoWidener, Subtract, SyncedSignal, Synth, Ticks, TicksClass, Time, TimeClass, Timeline, ToneAudioBuffer, ToneAudioBuffers, ToneAudioNode, ToneBufferSource, ToneEvent, ToneOscillatorNode, Transport$1 as Transport, TransportTime, TransportTimeClass, Tremolo, Units as Unit, UserMedia, Vibrato, Volume, WaveShaper, Waveform, Zero, connect, connectSeries, connectSignal, context, dbToGain, Debug as debug, defaultArg, disconnect, ftom, gainToDb, getContext, getDestination, getDraw, getListener, getTransport, immediate, intervalToFrequencyRatio, isArray, isBoolean, isDefined, isFunction, isNote, isNumber, isObject, isString, isUndef, loaded, mtof, now, optionsFromArguments, setContext, start, isSupported as supported, version }; diff --git a/docs/dist/App.js b/docs/dist/App.js new file mode 100644 index 00000000..4284e687 --- /dev/null +++ b/docs/dist/App.js @@ -0,0 +1,99 @@ +import React, {useCallback, useEffect, useLayoutEffect, useRef, useState} from "../_snowpack/pkg/react.js"; +import logo from "./logo.svg.proxy.js"; +import * as strudel from "../_snowpack/link/strudel.js"; +import cx from "./cx.js"; +import * as Tone from "../_snowpack/pkg/tone.js"; +import useCycle from "./useCycle.js"; +import {tetris} from "./tunes.js"; +const {Fraction, TimeSpan} = strudel; +const fr = (v) => new Fraction(v); +const ts = (start, end) => new TimeSpan(fr(start), fr(end)); +const parse = (code) => { + const {sequence, pure, reify, slowcat, fastcat, cat, stack, silence} = strudel; + return eval(code); +}; +const synth = new Tone.PolySynth().toDestination(); +synth.set({ + oscillator: {type: "triangle"}, + envelope: { + release: 0.01 + } +}); +function App() { + const [code, setCode] = useState(tetris); + const [log, setLog] = useState(""); + const logBox = useRef(); + const [error, setError] = useState(); + const [pattern, setPattern] = useState(); + const logCycle = (_events, cycle2) => { + if (_events.length) { + setLog((log2) => log2 + `${log2 ? "\n\n" : ""}# cycle ${cycle2} +` + _events.map((e) => e.show()).join("\n")); + } + }; + const cycle = useCycle({ + onEvent: useCallback((time, event) => { + synth.triggerAttackRelease(event.value, event.duration, time); + }, []), + onQuery: useCallback((span) => { + try { + return pattern?.query(span) || []; + } catch (err) { + setError(err); + return []; + } + }, [pattern]), + onSchedule: useCallback((_events, cycle2) => { + logCycle(_events, cycle2); + }, [pattern]), + ready: !!pattern + }); + useEffect(() => { + try { + const _pattern = parse(code); + setPattern(_pattern); + setError(void 0); + } catch (err) { + setError(err); + } + }, [code]); + useLayoutEffect(() => { + logBox.current.scrollTop = logBox.current?.scrollHeight; + }, [log]); + return /* @__PURE__ */ React.createElement("div", { + className: "h-[100vh] bg-slate-900 flex-row" + }, /* @__PURE__ */ React.createElement("header", { + className: "px-2 flex items-center space-x-2 border-b border-gray-200 bg-white" + }, /* @__PURE__ */ React.createElement("img", { + src: logo, + className: "Tidal-logo w-16 h-16", + alt: "logo" + }), /* @__PURE__ */ React.createElement("h1", { + className: "text-2xl" + }, "Strudel REPL")), /* @__PURE__ */ React.createElement("section", { + className: "grow p-2 text-gray-100" + }, /* @__PURE__ */ React.createElement("div", { + className: "relative" + }, /* @__PURE__ */ React.createElement("div", { + className: "absolute right-2 bottom-2 text-red-500" + }, error?.message), /* @__PURE__ */ React.createElement("textarea", { + className: cx("w-full h-64 bg-slate-600", error ? "focus:ring-red-500" : "focus:ring-slate-800"), + value: code, + onChange: (e) => { + setLog((log2) => log2 + `${log2 ? "\n\n" : ""}✏️ edit +${code} +${e.target.value}`); + setCode(e.target.value); + } + })), /* @__PURE__ */ React.createElement("textarea", { + className: "w-full h-64 bg-slate-600", + value: log, + readOnly: true, + ref: logBox, + style: {fontFamily: "monospace"} + }), /* @__PURE__ */ React.createElement("button", { + className: "w-full border border-gray-700 p-2 bg-slate-700 hover:bg-slate-500", + onClick: () => cycle.toggle() + }, cycle.started ? "pause" : "play"))); +} +export default App; diff --git a/docs/dist/cx.js b/docs/dist/cx.js new file mode 100644 index 00000000..1677e96e --- /dev/null +++ b/docs/dist/cx.js @@ -0,0 +1,3 @@ +export default function cx(...classes) { + return classes.filter(Boolean).join(" "); +} diff --git a/docs/dist/index.js b/docs/dist/index.js new file mode 100644 index 00000000..828bd19d --- /dev/null +++ b/docs/dist/index.js @@ -0,0 +1,10 @@ +import * as __SNOWPACK_ENV__ from '../_snowpack/env.js'; +import.meta.env = __SNOWPACK_ENV__; + +import React from "../_snowpack/pkg/react.js"; +import ReactDOM from "../_snowpack/pkg/react-dom.js"; +import App from "./App.js"; +ReactDOM.render(/* @__PURE__ */ React.createElement(React.StrictMode, null, /* @__PURE__ */ React.createElement(App, null)), document.getElementById("root")); +if (undefined /* [snowpack] import.meta.hot */ ) { + undefined /* [snowpack] import.meta.hot */ .accept(); +} diff --git a/docs/dist/logo.svg b/docs/dist/logo.svg new file mode 100644 index 00000000..209658c6 --- /dev/null +++ b/docs/dist/logo.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + Layer 1 + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/dist/logo.svg.proxy.js b/docs/dist/logo.svg.proxy.js new file mode 100644 index 00000000..73f6fe7f --- /dev/null +++ b/docs/dist/logo.svg.proxy.js @@ -0,0 +1 @@ +export default "/strudel/dist/logo.svg"; \ No newline at end of file diff --git a/docs/dist/tunes.js b/docs/dist/tunes.js new file mode 100644 index 00000000..e8b14702 --- /dev/null +++ b/docs/dist/tunes.js @@ -0,0 +1,26 @@ +export const tetris = `stack(sequence( + 'e5', sequence('b4', 'c5'), 'd5', sequence('c5', 'b4'), + 'a4', sequence('a4', 'c5'), 'e5', sequence('d5', 'c5'), + 'b4', sequence(silence(), 'c5'), 'd5', 'e5', + 'c5', 'a4', 'a4', silence(), + sequence(silence(), 'd5'), sequence(silence(), 'f5'), 'a5', sequence('g5', 'f5'), + 'e5', sequence(silence(), 'c5'), 'e5', sequence('d5', 'c5'), + 'b4', sequence('b4', 'c5'), 'd5', 'e5', + 'c5', 'a4', 'a4', silence()), + sequence( + 'e2', 'e3', 'e2', 'e3', 'e2', 'e3', 'e2', 'e3', + 'a2', 'a3', 'a2', 'a3', 'a2', 'a3', 'a2', 'a3', + 'g#2', 'g#3', 'g#2', 'g#3', 'e2', 'e3', 'e2', 'e3', + 'a2', 'a3', 'a2', 'a3', 'a2', 'a3', 'b1', 'c2', + 'd2', 'd3', 'd2', 'd3', 'd2', 'd3', 'd2', 'd3', + 'c2', 'c3', 'c2', 'c3', 'c2', 'c3', 'c2', 'c3', + 'b1', 'b2', 'b1', 'b2', 'e2', 'e3', 'e2', 'e3', + 'a1', 'a2', 'a1', 'a2', 'a1', 'a2', 'a1', 'a2', + ) +)._slow(16)`; +export const spanish = `slowcat( + stack('c4','eb4','g4'), + stack('bb3','d4','f4'), + stack('ab3','c4','eb4'), + stack('g3','b3','d4') + )`; diff --git a/docs/dist/useCycle.js b/docs/dist/useCycle.js new file mode 100644 index 00000000..68eeb90d --- /dev/null +++ b/docs/dist/useCycle.js @@ -0,0 +1,56 @@ +import {useEffect, useState} from "../_snowpack/pkg/react.js"; +import * as Tone from "../_snowpack/pkg/tone.js"; +import {TimeSpan} from "../_snowpack/link/strudel.js"; +function useCycle(props) { + const {onEvent, onQuery, onSchedule, ready = true} = props; + const [started, setStarted] = useState(false); + const cycleDuration = 1; + const activeCycle = () => Math.floor(Tone.Transport.seconds / cycleDuration); + const query = (cycle = activeCycle()) => { + const timespan = new TimeSpan(cycle, cycle + 1); + const _events = onQuery?.(timespan) || []; + onSchedule?.(_events, cycle); + schedule(_events, cycle); + }; + const schedule = (events, cycle = activeCycle()) => { + const timespan = new TimeSpan(cycle, cycle + 1); + const cancelFrom = timespan.begin.valueOf(); + Tone.Transport.cancel(cancelFrom); + const queryNextTime = (cycle + 1) * cycleDuration - 0.1; + const delta = queryNextTime - Tone.Transport.seconds; + if (delta < 0.2) { + query(cycle + 1); + } else { + Tone.Transport.schedule(() => { + query(cycle + 1); + }, queryNextTime); + } + events?.forEach((event) => { + Tone.Transport.schedule((time) => { + const toneEvent = { + time: event.part.begin.valueOf(), + duration: event.part.end.valueOf() - event.part.begin.valueOf(), + value: event.value + }; + onEvent(time, toneEvent); + }, event.part.begin.valueOf()); + }); + }; + useEffect(() => { + ready && query(); + }, [onEvent, onSchedule, onQuery]); + const start = async () => { + console.log("start"); + setStarted(true); + await Tone.start(); + Tone.Transport.start("+0.1"); + }; + const stop = () => { + console.log("stop"); + setStarted(false); + Tone.Transport.pause(); + }; + const toggle = () => started ? stop() : start(); + return {start, stop, onEvent, started, toggle, schedule, query, activeCycle}; +} +export default useCycle; diff --git a/docs/favicon.ico b/docs/favicon.ico new file mode 100644 index 00000000..7a9d261f Binary files /dev/null and b/docs/favicon.ico differ diff --git a/docs/global.css b/docs/global.css new file mode 100644 index 00000000..f11c005c --- /dev/null +++ b/docs/global.css @@ -0,0 +1,700 @@ +/* +! tailwindcss v3.0.18 | MIT License | https://tailwindcss.com +*//* +1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4) +2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116) +*/ + +*, +::before, +::after { + box-sizing: border-box; /* 1 */ + border-width: 0; /* 2 */ + border-style: solid; /* 2 */ + border-color: #e5e7eb; /* 2 */ +} + +::before, +::after { + --tw-content: ''; +} + +/* +1. Use a consistent sensible line-height in all browsers. +2. Prevent adjustments of font size after orientation changes in iOS. +3. Use a more readable tab size. +4. Use the user's configured `sans` font-family by default. +*/ + +html { + line-height: 1.5; /* 1 */ + -webkit-text-size-adjust: 100%; /* 2 */ + -moz-tab-size: 4; /* 3 */ + -o-tab-size: 4; + tab-size: 4; /* 3 */ + font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; /* 4 */ +} + +/* +1. Remove the margin in all browsers. +2. Inherit line-height from `html` so users can set them as a class directly on the `html` element. +*/ + +body { + margin: 0; /* 1 */ + line-height: inherit; /* 2 */ +} + +/* +1. Add the correct height in Firefox. +2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655) +3. Ensure horizontal rules are visible by default. +*/ + +hr { + height: 0; /* 1 */ + color: inherit; /* 2 */ + border-top-width: 1px; /* 3 */ +} + +/* +Add the correct text decoration in Chrome, Edge, and Safari. +*/ + +abbr:where([title]) { + -webkit-text-decoration: underline dotted; + text-decoration: underline dotted; +} + +/* +Remove the default font size and weight for headings. +*/ + +h1, +h2, +h3, +h4, +h5, +h6 { + font-size: inherit; + font-weight: inherit; +} + +/* +Reset links to optimize for opt-in styling instead of opt-out. +*/ + +a { + color: inherit; + text-decoration: inherit; +} + +/* +Add the correct font weight in Edge and Safari. +*/ + +b, +strong { + font-weight: bolder; +} + +/* +1. Use the user's configured `mono` font family by default. +2. Correct the odd `em` font sizing in all browsers. +*/ + +code, +kbd, +samp, +pre { + font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; /* 1 */ + font-size: 1em; /* 2 */ +} + +/* +Add the correct font size in all browsers. +*/ + +small { + font-size: 80%; +} + +/* +Prevent `sub` and `sup` elements from affecting the line height in all browsers. +*/ + +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sub { + bottom: -0.25em; +} + +sup { + top: -0.5em; +} + +/* +1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297) +2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016) +3. Remove gaps between table borders by default. +*/ + +table { + text-indent: 0; /* 1 */ + border-color: inherit; /* 2 */ + border-collapse: collapse; /* 3 */ +} + +/* +1. Change the font styles in all browsers. +2. Remove the margin in Firefox and Safari. +3. Remove default padding in all browsers. +*/ + +button, +input, +optgroup, +select, +textarea { + font-family: inherit; /* 1 */ + font-size: 100%; /* 1 */ + line-height: inherit; /* 1 */ + color: inherit; /* 1 */ + margin: 0; /* 2 */ + padding: 0; /* 3 */ +} + +/* +Remove the inheritance of text transform in Edge and Firefox. +*/ + +button, +select { + text-transform: none; +} + +/* +1. Correct the inability to style clickable types in iOS and Safari. +2. Remove default button styles. +*/ + +button, +[type='button'], +[type='reset'], +[type='submit'] { + -webkit-appearance: button; /* 1 */ + background-color: transparent; /* 2 */ + background-image: none; /* 2 */ +} + +/* +Use the modern Firefox focus style for all focusable elements. +*/ + +:-moz-focusring { + outline: auto; +} + +/* +Remove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737) +*/ + +:-moz-ui-invalid { + box-shadow: none; +} + +/* +Add the correct vertical alignment in Chrome and Firefox. +*/ + +progress { + vertical-align: baseline; +} + +/* +Correct the cursor style of increment and decrement buttons in Safari. +*/ + +::-webkit-inner-spin-button, +::-webkit-outer-spin-button { + height: auto; +} + +/* +1. Correct the odd appearance in Chrome and Safari. +2. Correct the outline style in Safari. +*/ + +[type='search'] { + -webkit-appearance: textfield; /* 1 */ + outline-offset: -2px; /* 2 */ +} + +/* +Remove the inner padding in Chrome and Safari on macOS. +*/ + +::-webkit-search-decoration { + -webkit-appearance: none; +} + +/* +1. Correct the inability to style clickable types in iOS and Safari. +2. Change font properties to `inherit` in Safari. +*/ + +::-webkit-file-upload-button { + -webkit-appearance: button; /* 1 */ + font: inherit; /* 2 */ +} + +/* +Add the correct display in Chrome and Safari. +*/ + +summary { + display: list-item; +} + +/* +Removes the default spacing and border for appropriate elements. +*/ + +blockquote, +dl, +dd, +h1, +h2, +h3, +h4, +h5, +h6, +hr, +figure, +p, +pre { + margin: 0; +} + +fieldset { + margin: 0; + padding: 0; +} + +legend { + padding: 0; +} + +ol, +ul, +menu { + list-style: none; + margin: 0; + padding: 0; +} + +/* +Prevent resizing textareas horizontally by default. +*/ + +textarea { + resize: vertical; +} + +/* +1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300) +2. Set the default placeholder color to the user's configured gray 400 color. +*/ + +input::-moz-placeholder, textarea::-moz-placeholder { + opacity: 1; /* 1 */ + color: #9ca3af; /* 2 */ +} + +input:-ms-input-placeholder, textarea:-ms-input-placeholder { + opacity: 1; /* 1 */ + color: #9ca3af; /* 2 */ +} + +input::placeholder, +textarea::placeholder { + opacity: 1; /* 1 */ + color: #9ca3af; /* 2 */ +} + +/* +Set the default cursor for buttons. +*/ + +button, +[role="button"] { + cursor: pointer; +} + +/* +Make sure disabled buttons don't get the pointer cursor. +*/ +:disabled { + cursor: default; +} + +/* +1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14) +2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210) + This can trigger a poorly considered lint error in some tools but is included by design. +*/ + +img, +svg, +video, +canvas, +audio, +iframe, +embed, +object { + display: block; /* 1 */ + vertical-align: middle; /* 2 */ +} + +/* +Constrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14) +*/ + +img, +video { + max-width: 100%; + height: auto; +} + +/* +Ensure the default browser behavior of the `hidden` attribute. +*/ + +[hidden] { + display: none; +} + +[type='text'],[type='email'],[type='url'],[type='password'],[type='number'],[type='date'],[type='datetime-local'],[type='month'],[type='search'],[type='tel'],[type='time'],[type='week'],[multiple],textarea,select { + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; + background-color: #fff; + border-color: #6b7280; + border-width: 1px; + border-radius: 0px; + padding-top: 0.5rem; + padding-right: 0.75rem; + padding-bottom: 0.5rem; + padding-left: 0.75rem; + font-size: 1rem; + line-height: 1.5rem; + --tw-shadow: 0 0 #0000; +} + +[type='text']:focus, [type='email']:focus, [type='url']:focus, [type='password']:focus, [type='number']:focus, [type='date']:focus, [type='datetime-local']:focus, [type='month']:focus, [type='search']:focus, [type='tel']:focus, [type='time']:focus, [type='week']:focus, [multiple]:focus, textarea:focus, select:focus { + outline: 2px solid transparent; + outline-offset: 2px; + --tw-ring-inset: var(--tw-empty,/*!*/ /*!*/); + --tw-ring-offset-width: 0px; + --tw-ring-offset-color: #fff; + --tw-ring-color: #2563eb; + --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); + --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color); + box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow); + border-color: #2563eb; +} + +input::-moz-placeholder, textarea::-moz-placeholder { + color: #6b7280; + opacity: 1; +} + +input:-ms-input-placeholder, textarea:-ms-input-placeholder { + color: #6b7280; + opacity: 1; +} + +input::placeholder,textarea::placeholder { + color: #6b7280; + opacity: 1; +} + +::-webkit-datetime-edit-fields-wrapper { + padding: 0; +} + +::-webkit-date-and-time-value { + min-height: 1.5em; +} + +select { + background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e"); + background-position: right 0.5rem center; + background-repeat: no-repeat; + background-size: 1.5em 1.5em; + padding-right: 2.5rem; + -webkit-print-color-adjust: exact; + color-adjust: exact; +} + +[multiple] { + background-image: initial; + background-position: initial; + background-repeat: unset; + background-size: initial; + padding-right: 0.75rem; + -webkit-print-color-adjust: unset; + color-adjust: unset; +} + +[type='checkbox'],[type='radio'] { + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; + padding: 0; + -webkit-print-color-adjust: exact; + color-adjust: exact; + display: inline-block; + vertical-align: middle; + background-origin: border-box; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + flex-shrink: 0; + height: 1rem; + width: 1rem; + color: #2563eb; + background-color: #fff; + border-color: #6b7280; + border-width: 1px; + --tw-shadow: 0 0 #0000; +} + +[type='checkbox'] { + border-radius: 0px; +} + +[type='radio'] { + border-radius: 100%; +} + +[type='checkbox']:focus,[type='radio']:focus { + outline: 2px solid transparent; + outline-offset: 2px; + --tw-ring-inset: var(--tw-empty,/*!*/ /*!*/); + --tw-ring-offset-width: 2px; + --tw-ring-offset-color: #fff; + --tw-ring-color: #2563eb; + --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); + --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color); + box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow); +} + +[type='checkbox']:checked,[type='radio']:checked { + border-color: transparent; + background-color: currentColor; + background-size: 100% 100%; + background-position: center; + background-repeat: no-repeat; +} + +[type='checkbox']:checked { + background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e"); +} + +[type='radio']:checked { + background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='8' cy='8' r='3'/%3e%3c/svg%3e"); +} + +[type='checkbox']:checked:hover,[type='checkbox']:checked:focus,[type='radio']:checked:hover,[type='radio']:checked:focus { + border-color: transparent; + background-color: currentColor; +} + +[type='checkbox']:indeterminate { + background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 16 16'%3e%3cpath stroke='white' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 8h8'/%3e%3c/svg%3e"); + border-color: transparent; + background-color: currentColor; + background-size: 100% 100%; + background-position: center; + background-repeat: no-repeat; +} + +[type='checkbox']:indeterminate:hover,[type='checkbox']:indeterminate:focus { + border-color: transparent; + background-color: currentColor; +} + +[type='file'] { + background: unset; + border-color: inherit; + border-width: 0; + border-radius: 0; + padding: 0; + font-size: unset; + line-height: inherit; +} + +[type='file']:focus { + outline: 1px auto -webkit-focus-ring-color; +} + +*, ::before, ::after { + --tw-translate-x: 0; + --tw-translate-y: 0; + --tw-rotate: 0; + --tw-skew-x: 0; + --tw-skew-y: 0; + --tw-scale-x: 1; + --tw-scale-y: 1; + --tw-pan-x: ; + --tw-pan-y: ; + --tw-pinch-zoom: ; + --tw-scroll-snap-strictness: proximity; + --tw-ordinal: ; + --tw-slashed-zero: ; + --tw-numeric-figure: ; + --tw-numeric-spacing: ; + --tw-numeric-fraction: ; + --tw-ring-inset: ; + --tw-ring-offset-width: 0px; + --tw-ring-offset-color: #fff; + --tw-ring-color: rgb(59 130 246 / 0.5); + --tw-ring-offset-shadow: 0 0 #0000; + --tw-ring-shadow: 0 0 #0000; + --tw-shadow: 0 0 #0000; + --tw-shadow-colored: 0 0 #0000; + --tw-blur: ; + --tw-brightness: ; + --tw-contrast: ; + --tw-grayscale: ; + --tw-hue-rotate: ; + --tw-invert: ; + --tw-saturate: ; + --tw-sepia: ; + --tw-drop-shadow: ; + --tw-backdrop-blur: ; + --tw-backdrop-brightness: ; + --tw-backdrop-contrast: ; + --tw-backdrop-grayscale: ; + --tw-backdrop-hue-rotate: ; + --tw-backdrop-invert: ; + --tw-backdrop-opacity: ; + --tw-backdrop-saturate: ; + --tw-backdrop-sepia: ; +} +.absolute { + position: absolute; +} +.relative { + position: relative; +} +.right-2 { + right: 0.5rem; +} +.bottom-2 { + bottom: 0.5rem; +} +.flex { + display: flex; +} +.h-\[100vh\] { + height: 100vh; +} +.h-16 { + height: 4rem; +} +.h-64 { + height: 16rem; +} +.w-16 { + width: 4rem; +} +.w-full { + width: 100%; +} +.grow { + flex-grow: 1; +} +.flex-row { + flex-direction: row; +} +.items-center { + align-items: center; +} +.space-x-2 > :not([hidden]) ~ :not([hidden]) { + --tw-space-x-reverse: 0; + margin-right: calc(0.5rem * var(--tw-space-x-reverse)); + margin-left: calc(0.5rem * calc(1 - var(--tw-space-x-reverse))); +} +.border { + border-width: 1px; +} +.border-b { + border-bottom-width: 1px; +} +.border-gray-200 { + --tw-border-opacity: 1; + border-color: rgb(229 231 235 / var(--tw-border-opacity)); +} +.border-gray-700 { + --tw-border-opacity: 1; + border-color: rgb(55 65 81 / var(--tw-border-opacity)); +} +.bg-slate-900 { + --tw-bg-opacity: 1; + background-color: rgb(15 23 42 / var(--tw-bg-opacity)); +} +.bg-white { + --tw-bg-opacity: 1; + background-color: rgb(255 255 255 / var(--tw-bg-opacity)); +} +.bg-slate-600 { + --tw-bg-opacity: 1; + background-color: rgb(71 85 105 / var(--tw-bg-opacity)); +} +.bg-slate-700 { + --tw-bg-opacity: 1; + background-color: rgb(51 65 85 / var(--tw-bg-opacity)); +} +.p-2 { + padding: 0.5rem; +} +.px-2 { + padding-left: 0.5rem; + padding-right: 0.5rem; +} +.text-2xl { + font-size: 1.5rem; + line-height: 2rem; +} +.text-gray-100 { + --tw-text-opacity: 1; + color: rgb(243 244 246 / var(--tw-text-opacity)); +} +.text-red-500 { + --tw-text-opacity: 1; + color: rgb(239 68 68 / var(--tw-text-opacity)); +} +.filter { + filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow); +} +.hover\:bg-slate-500:hover { + --tw-bg-opacity: 1; + background-color: rgb(100 116 139 / var(--tw-bg-opacity)); +} +.focus\:ring-red-500:focus { + --tw-ring-opacity: 1; + --tw-ring-color: rgb(239 68 68 / var(--tw-ring-opacity)); +} +.focus\:ring-slate-800:focus { + --tw-ring-opacity: 1; + --tw-ring-color: rgb(30 41 59 / var(--tw-ring-opacity)); +} diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 00000000..507724ce --- /dev/null +++ b/docs/index.html @@ -0,0 +1,16 @@ + + + + + + + + + Strudel REPL + + +
+ + + + diff --git a/repl/.gitignore b/repl/.gitignore new file mode 100644 index 00000000..a08cc243 --- /dev/null +++ b/repl/.gitignore @@ -0,0 +1,4 @@ +.snowpack +build +node_modules +.DS_Store \ No newline at end of file diff --git a/repl/README.md b/repl/README.md new file mode 100644 index 00000000..26408bc1 --- /dev/null +++ b/repl/README.md @@ -0,0 +1,25 @@ +# Strudel REPL + +> ✨ Bootstrapped with Create Snowpack App (CSA). + +## Available Scripts + +### npm start + +Runs the app in the development mode. +Open http://localhost:8080 to view it in the browser. + +The page will reload if you make edits. +You will also see any lint errors in the console. + +### npm run build + +Builds a static copy of your site to the `build/` folder. +Your app is ready to be deployed! + +**For the best production performance:** Add a build bundler plugin like "@snowpack/plugin-webpack" to your `snowpack.config.mjs` config file. + +### npm test + +Launches the application test runner. +Run with the `--watch` flag (`npm test -- --watch`) to run in interactive watch mode. diff --git a/repl/package-lock.json b/repl/package-lock.json new file mode 100644 index 00000000..6ffdd90a --- /dev/null +++ b/repl/package-lock.json @@ -0,0 +1,14882 @@ +{ + "name": "repl", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "dependencies": { + "react": "^17.0.2", + "react-dom": "^17.0.2", + "tone": "^14.7.77" + }, + "devDependencies": { + "@snowpack/plugin-dotenv": "^2.1.0", + "@snowpack/plugin-postcss": "^1.4.3", + "@snowpack/plugin-react-refresh": "^2.5.0", + "@snowpack/plugin-typescript": "^1.2.1", + "@snowpack/web-test-runner-plugin": "^0.2.2", + "@tailwindcss/forms": "^0.4.0", + "@testing-library/react": "^11.2.6", + "@types/chai": "^4.2.17", + "@types/mocha": "^8.2.2", + "@types/react": "^17.0.4", + "@types/react-dom": "^17.0.3", + "@types/snowpack-env": "^2.3.3", + "@web/test-runner": "^0.13.3", + "autoprefixer": "^10.4.2", + "chai": "^4.3.4", + "postcss": "^8.4.6", + "prettier": "^2.2.1", + "snowpack": "^3.3.7", + "tailwindcss": "^3.0.18", + "typescript": "^4.2.4" + } + }, + "node_modules/@ampproject/remapping": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.0.2.tgz", + "integrity": "sha512-sE8Gx+qSDMLoJvb3QarJJlDQK7SSY4rK3hxp4XsiANeFOmjU46ZI7Y9adAQRJrmbz8zbtZkp3mJTT+rGxtF0XA==", + "dev": true, + "dependencies": { + "@jridgewell/trace-mapping": "^0.2.2", + "sourcemap-codec": "1.4.8" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz", + "integrity": "sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==", + "dev": true, + "dependencies": { + "@babel/highlight": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/compat-data": { + "version": "7.17.0", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.17.0.tgz", + "integrity": "sha512-392byTlpGWXMv4FbyWw3sAZ/FrW/DrwqLGXpy0mbyNe9Taqv1mg9yON5/o0cnr8XYCkFTZbC1eV+c+LAROgrng==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/core": { + "version": "7.17.0", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.17.0.tgz", + "integrity": "sha512-x/5Ea+RO5MvF9ize5DeVICJoVrNv0Mi2RnIABrZEKYvPEpldXwauPkgvYA17cKa6WpU3LoYvYbuEMFtSNFsarA==", + "dev": true, + "dependencies": { + "@ampproject/remapping": "^2.0.0", + "@babel/code-frame": "^7.16.7", + "@babel/generator": "^7.17.0", + "@babel/helper-compilation-targets": "^7.16.7", + "@babel/helper-module-transforms": "^7.16.7", + "@babel/helpers": "^7.17.0", + "@babel/parser": "^7.17.0", + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.17.0", + "@babel/types": "^7.17.0", + "convert-source-map": "^1.7.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.1.2", + "semver": "^6.3.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@babel/generator": { + "version": "7.17.0", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.17.0.tgz", + "integrity": "sha512-I3Omiv6FGOC29dtlZhkfXO6pgkmukJSlT26QjVvS1DGZe/NzSVCPG41X0tS21oZkJYlovfj9qDWgKP+Cn4bXxw==", + "dev": true, + "dependencies": { + "@babel/types": "^7.17.0", + "jsesc": "^2.5.1", + "source-map": "^0.5.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.16.7.tgz", + "integrity": "sha512-mGojBwIWcwGD6rfqgRXVlVYmPAv7eOpIemUG3dGnDdCY4Pae70ROij3XmfrH6Fa1h1aiDylpglbZyktfzyo/hA==", + "dev": true, + "dependencies": { + "@babel/compat-data": "^7.16.4", + "@babel/helper-validator-option": "^7.16.7", + "browserslist": "^4.17.5", + "semver": "^6.3.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-environment-visitor": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.16.7.tgz", + "integrity": "sha512-SLLb0AAn6PkUeAfKJCCOl9e1R53pQlGAfc4y4XuMRZfqeMYLE0dM1LMhqbGAlGQY0lfw5/ohoYWAe9V1yibRag==", + "dev": true, + "dependencies": { + "@babel/types": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-function-name": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.16.7.tgz", + "integrity": "sha512-QfDfEnIUyyBSR3HtrtGECuZ6DAyCkYFp7GHl75vFtTnn6pjKeK0T1DB5lLkFvBea8MdaiUABx3osbgLyInoejA==", + "dev": true, + "dependencies": { + "@babel/helper-get-function-arity": "^7.16.7", + "@babel/template": "^7.16.7", + "@babel/types": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-get-function-arity": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.16.7.tgz", + "integrity": "sha512-flc+RLSOBXzNzVhcLu6ujeHUrD6tANAOU5ojrRx/as+tbzf8+stUCj7+IfRRoAbEZqj/ahXEMsjhOhgeZsrnTw==", + "dev": true, + "dependencies": { + "@babel/types": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-hoist-variables": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.16.7.tgz", + "integrity": "sha512-m04d/0Op34H5v7pbZw6pSKP7weA6lsMvfiIAMeIvkY/R4xQtBSMFEigu9QTZ2qB/9l22vsxtM8a+Q8CzD255fg==", + "dev": true, + "dependencies": { + "@babel/types": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-imports": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.16.7.tgz", + "integrity": "sha512-LVtS6TqjJHFc+nYeITRo6VLXve70xmq7wPhWTqDJusJEgGmkAACWwMiTNrvfoQo6hEhFwAIixNkvB0jPXDL8Wg==", + "dev": true, + "dependencies": { + "@babel/types": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-transforms": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.16.7.tgz", + "integrity": "sha512-gaqtLDxJEFCeQbYp9aLAefjhkKdjKcdh6DB7jniIGU3Pz52WAmP268zK0VgPz9hUNkMSYeH976K2/Y6yPadpng==", + "dev": true, + "dependencies": { + "@babel/helper-environment-visitor": "^7.16.7", + "@babel/helper-module-imports": "^7.16.7", + "@babel/helper-simple-access": "^7.16.7", + "@babel/helper-split-export-declaration": "^7.16.7", + "@babel/helper-validator-identifier": "^7.16.7", + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.16.7", + "@babel/types": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-plugin-utils": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.16.7.tgz", + "integrity": "sha512-Qg3Nk7ZxpgMrsox6HreY1ZNKdBq7K72tDSliA6dCl5f007jR4ne8iD5UzuNnCJH2xBf2BEEVGr+/OL6Gdp7RxA==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-simple-access": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.16.7.tgz", + "integrity": "sha512-ZIzHVyoeLMvXMN/vok/a4LWRy8G2v205mNP0XOuf9XRLyX5/u9CnVulUtDgUTama3lT+bf/UqucuZjqiGuTS1g==", + "dev": true, + "dependencies": { + "@babel/types": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-split-export-declaration": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.16.7.tgz", + "integrity": "sha512-xbWoy/PFoxSWazIToT9Sif+jJTlrMcndIsaOKvTA6u7QEo7ilkRZpjew18/W3c7nm8fXdUDXh02VXTbZ0pGDNw==", + "dev": true, + "dependencies": { + "@babel/types": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz", + "integrity": "sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-option": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.16.7.tgz", + "integrity": "sha512-TRtenOuRUVo9oIQGPC5G9DgK4743cdxvtOw0weQNpZXaS16SCBi5MNjZF8vba3ETURjZpTbVn7Vvcf2eAwFozQ==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helpers": { + "version": "7.17.0", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.17.0.tgz", + "integrity": "sha512-Xe/9NFxjPwELUvW2dsukcMZIp6XwPSbI4ojFBJuX5ramHuVE22SVcZIwqzdWo5uCgeTXW8qV97lMvSOjq+1+nQ==", + "dev": true, + "dependencies": { + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.17.0", + "@babel/types": "^7.17.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight": { + "version": "7.16.10", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.16.10.tgz", + "integrity": "sha512-5FnTQLSLswEj6IkgVw5KusNUUFY9ZGqe/TRFnP/BKYHYgfh7tc+C7mwiy95/yNP7Dh9x580Vv8r7u7ZfTBFxdw==", + "dev": true, + "dependencies": { + "@babel/helper-validator-identifier": "^7.16.7", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.17.0", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.17.0.tgz", + "integrity": "sha512-VKXSCQx5D8S04ej+Dqsr1CzYvvWgf20jIw2D+YhQCrIlr2UZGaDds23Y0xg75/skOxpLCRpUZvk/1EAVkGoDOw==", + "dev": true, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/plugin-syntax-class-properties": { + "version": "7.12.13", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz", + "integrity": "sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.12.13" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/runtime": { + "version": "7.17.0", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.17.0.tgz", + "integrity": "sha512-etcO/ohMNaNA2UBdaXBBSX/3aEzFMRrVfaPv8Ptc0k+cWpWW0QFiGZ2XnVqQZI1Cf734LbPGmqBKWESfW4x/dQ==", + "dependencies": { + "regenerator-runtime": "^0.13.4" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/runtime-corejs3": { + "version": "7.17.0", + "resolved": "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.17.0.tgz", + "integrity": "sha512-qeydncU80ravKzovVncW3EYaC1ji3GpntdPgNcJy9g7hHSY6KX+ne1cbV3ov7Zzm4F1z0+QreZPCuw1ynkmYNg==", + "dev": true, + "dependencies": { + "core-js-pure": "^3.20.2", + "regenerator-runtime": "^0.13.4" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/template": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.16.7.tgz", + "integrity": "sha512-I8j/x8kHUrbYRTUxXrrMbfCa7jxkE7tZre39x3kjr9hvI82cK1FfqLygotcWN5kdPGWcLdWMHpSBavse5tWw3w==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.16.7", + "@babel/parser": "^7.16.7", + "@babel/types": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.17.0", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.17.0.tgz", + "integrity": "sha512-fpFIXvqD6kC7c7PUNnZ0Z8cQXlarCLtCUpt2S1Dx7PjoRtCFffvOkHHSom+m5HIxMZn5bIBVb71lhabcmjEsqg==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.16.7", + "@babel/generator": "^7.17.0", + "@babel/helper-environment-visitor": "^7.16.7", + "@babel/helper-function-name": "^7.16.7", + "@babel/helper-hoist-variables": "^7.16.7", + "@babel/helper-split-export-declaration": "^7.16.7", + "@babel/parser": "^7.17.0", + "@babel/types": "^7.17.0", + "debug": "^4.1.0", + "globals": "^11.1.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/types": { + "version": "7.17.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.17.0.tgz", + "integrity": "sha512-TmKSNO4D5rzhL5bjWFcVHHLETzfQ/AmbKpKPOSjlP0WoHZ6L911fgoOKY4Alp/emzG4cHJdyN49zpgkbXFEHHw==", + "dev": true, + "dependencies": { + "@babel/helper-validator-identifier": "^7.16.7", + "to-fast-properties": "^2.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@gar/promisify": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@gar/promisify/-/promisify-1.1.2.tgz", + "integrity": "sha512-82cpyJyKRoQoRi+14ibCeGPu0CwypgtBAdBhq1WfvagpCZNKqwXbKwXllYSMG91DhmG4jt9gN8eP6lGOtozuaw==", + "dev": true + }, + "node_modules/@isaacs/string-locale-compare": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@isaacs/string-locale-compare/-/string-locale-compare-1.1.0.tgz", + "integrity": "sha512-SQ7Kzhh9+D+ZW9MA0zkYv3VXhIDNx+LzM6EJ+/65I3QY+enU6Itte7E5XX7EWrqLW2FN4n06GWzBnPoC3th2aQ==", + "dev": true + }, + "node_modules/@jest/types": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-26.6.2.tgz", + "integrity": "sha512-fC6QCp7Sc5sX6g8Tvbmj4XUTbyrik0akgRy03yjXbQaBWWNWGE7SGtJk98m0N8nzegD/7SggrUlivxo5ax4KWQ==", + "dev": true, + "dependencies": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^3.0.0", + "@types/node": "*", + "@types/yargs": "^15.0.0", + "chalk": "^4.0.0" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/@jest/types/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/@jest/types/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/@jest/types/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/@jest/types/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/@jest/types/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/types/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.0.4.tgz", + "integrity": "sha512-cz8HFjOFfUBtvN+NXYSFMHYRdxZMaEl0XypVrhzxBgadKIXhIkRd8aMeHhmF56Sl7SuS8OnUpQ73/k9LE4VnLg==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.2.6.tgz", + "integrity": "sha512-rVJf5dSMEBxnDEwtAT5x8+p6tZ+xU6Ocm+cR1MYL2gMsRi4MMzVf9Pvq6JaxIsEeKAyYmo2U+yPQN4QfdTfFnA==", + "dev": true, + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "sourcemap-codec": "1.4.8" + } + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@npmcli/arborist": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-2.10.0.tgz", + "integrity": "sha512-CLnD+zXG9oijEEzViimz8fbOoFVb7hoypiaf7p6giJhvYtrxLAyY3cZAMPIFQvsG731+02eMDp3LqVBNo7BaZA==", + "dev": true, + "dependencies": { + "@isaacs/string-locale-compare": "^1.0.1", + "@npmcli/installed-package-contents": "^1.0.7", + "@npmcli/map-workspaces": "^1.0.2", + "@npmcli/metavuln-calculator": "^1.1.0", + "@npmcli/move-file": "^1.1.0", + "@npmcli/name-from-folder": "^1.0.1", + "@npmcli/node-gyp": "^1.0.1", + "@npmcli/package-json": "^1.0.1", + "@npmcli/run-script": "^1.8.2", + "bin-links": "^2.2.1", + "cacache": "^15.0.3", + "common-ancestor-path": "^1.0.1", + "json-parse-even-better-errors": "^2.3.1", + "json-stringify-nice": "^1.1.4", + "mkdirp": "^1.0.4", + "mkdirp-infer-owner": "^2.0.0", + "npm-install-checks": "^4.0.0", + "npm-package-arg": "^8.1.5", + "npm-pick-manifest": "^6.1.0", + "npm-registry-fetch": "^11.0.0", + "pacote": "^11.3.5", + "parse-conflict-json": "^1.1.1", + "proc-log": "^1.0.0", + "promise-all-reject-late": "^1.0.0", + "promise-call-limit": "^1.0.1", + "read-package-json-fast": "^2.0.2", + "readdir-scoped-modules": "^1.1.0", + "rimraf": "^3.0.2", + "semver": "^7.3.5", + "ssri": "^8.0.1", + "treeverse": "^1.0.4", + "walk-up-path": "^1.0.0" + }, + "bin": { + "arborist": "bin/index.js" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/@npmcli/arborist/node_modules/semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@npmcli/fs": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-1.1.0.tgz", + "integrity": "sha512-VhP1qZLXcrXRIaPoqb4YA55JQxLNF3jNR4T55IdOJa3+IFJKNYHtPvtXx8slmeMavj37vCzCfrqQM1vWLsYKLA==", + "dev": true, + "dependencies": { + "@gar/promisify": "^1.0.1", + "semver": "^7.3.5" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16" + } + }, + "node_modules/@npmcli/fs/node_modules/semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@npmcli/git": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@npmcli/git/-/git-2.1.0.tgz", + "integrity": "sha512-/hBFX/QG1b+N7PZBFs0bi+evgRZcK9nWBxQKZkGoXUT5hJSwl5c4d7y8/hm+NQZRPhQ67RzFaj5UM9YeyKoryw==", + "dev": true, + "dependencies": { + "@npmcli/promise-spawn": "^1.3.2", + "lru-cache": "^6.0.0", + "mkdirp": "^1.0.4", + "npm-pick-manifest": "^6.1.1", + "promise-inflight": "^1.0.1", + "promise-retry": "^2.0.1", + "semver": "^7.3.5", + "which": "^2.0.2" + } + }, + "node_modules/@npmcli/git/node_modules/semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@npmcli/installed-package-contents": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/@npmcli/installed-package-contents/-/installed-package-contents-1.0.7.tgz", + "integrity": "sha512-9rufe0wnJusCQoLpV9ZPKIVP55itrM5BxOXs10DmdbRfgWtHy1LDyskbwRnBghuB0PrF7pNPOqREVtpz4HqzKw==", + "dev": true, + "dependencies": { + "npm-bundled": "^1.1.1", + "npm-normalize-package-bin": "^1.0.1" + }, + "bin": { + "installed-package-contents": "index.js" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/@npmcli/map-workspaces": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@npmcli/map-workspaces/-/map-workspaces-1.0.4.tgz", + "integrity": "sha512-wVR8QxhyXsFcD/cORtJwGQodeeaDf0OxcHie8ema4VgFeqwYkFsDPnSrIRSytX8xR6nKPAH89WnwTcaU608b/Q==", + "dev": true, + "dependencies": { + "@npmcli/name-from-folder": "^1.0.1", + "glob": "^7.1.6", + "minimatch": "^3.0.4", + "read-package-json-fast": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@npmcli/metavuln-calculator": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@npmcli/metavuln-calculator/-/metavuln-calculator-1.1.1.tgz", + "integrity": "sha512-9xe+ZZ1iGVaUovBVFI9h3qW+UuECUzhvZPxK9RaEA2mjU26o5D0JloGYWwLYvQELJNmBdQB6rrpuN8jni6LwzQ==", + "dev": true, + "dependencies": { + "cacache": "^15.0.5", + "pacote": "^11.1.11", + "semver": "^7.3.2" + } + }, + "node_modules/@npmcli/metavuln-calculator/node_modules/semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@npmcli/move-file": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@npmcli/move-file/-/move-file-1.1.2.tgz", + "integrity": "sha512-1SUf/Cg2GzGDyaf15aR9St9TWlb+XvbZXWpDx8YKs7MLzMH/BCeopv+y9vzrzgkfykCGuWOlSu3mZhj2+FQcrg==", + "dev": true, + "dependencies": { + "mkdirp": "^1.0.4", + "rimraf": "^3.0.2" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@npmcli/name-from-folder": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@npmcli/name-from-folder/-/name-from-folder-1.0.1.tgz", + "integrity": "sha512-qq3oEfcLFwNfEYOQ8HLimRGKlD8WSeGEdtUa7hmzpR8Sa7haL1KVQrvgO6wqMjhWFFVjgtrh1gIxDz+P8sjUaA==", + "dev": true + }, + "node_modules/@npmcli/node-gyp": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@npmcli/node-gyp/-/node-gyp-1.0.3.tgz", + "integrity": "sha512-fnkhw+fmX65kiLqk6E3BFLXNC26rUhK90zVwe2yncPliVT/Qos3xjhTLE59Df8KnPlcwIERXKVlU1bXoUQ+liA==", + "dev": true + }, + "node_modules/@npmcli/package-json": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@npmcli/package-json/-/package-json-1.0.1.tgz", + "integrity": "sha512-y6jnu76E9C23osz8gEMBayZmaZ69vFOIk8vR1FJL/wbEJ54+9aVG9rLTjQKSXfgYZEr50nw1txBBFfBZZe+bYg==", + "dev": true, + "dependencies": { + "json-parse-even-better-errors": "^2.3.1" + } + }, + "node_modules/@npmcli/promise-spawn": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@npmcli/promise-spawn/-/promise-spawn-1.3.2.tgz", + "integrity": "sha512-QyAGYo/Fbj4MXeGdJcFzZ+FkDkomfRBrPM+9QYJSg+PxgAUL+LU3FneQk37rKR2/zjqkCV1BLHccX98wRXG3Sg==", + "dev": true, + "dependencies": { + "infer-owner": "^1.0.4" + } + }, + "node_modules/@npmcli/run-script": { + "version": "1.8.6", + "resolved": "https://registry.npmjs.org/@npmcli/run-script/-/run-script-1.8.6.tgz", + "integrity": "sha512-e42bVZnC6VluBZBAFEr3YrdqSspG3bgilyg4nSLBJ7TRGNCzxHa92XAHxQBLYg0BmgwO4b2mf3h/l5EkEWRn3g==", + "dev": true, + "dependencies": { + "@npmcli/node-gyp": "^1.0.2", + "@npmcli/promise-spawn": "^1.3.2", + "node-gyp": "^7.1.0", + "read-package-json-fast": "^2.0.1" + } + }, + "node_modules/@rollup/plugin-commonjs": { + "version": "16.0.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-16.0.0.tgz", + "integrity": "sha512-LuNyypCP3msCGVQJ7ki8PqYdpjfEkE/xtFa5DqlF+7IBD0JsfMZ87C58heSwIMint58sAUZbt3ITqOmdQv/dXw==", + "dev": true, + "dependencies": { + "@rollup/pluginutils": "^3.1.0", + "commondir": "^1.0.1", + "estree-walker": "^2.0.1", + "glob": "^7.1.6", + "is-reference": "^1.2.1", + "magic-string": "^0.25.7", + "resolve": "^1.17.0" + }, + "engines": { + "node": ">= 8.0.0" + }, + "peerDependencies": { + "rollup": "^2.30.0" + } + }, + "node_modules/@rollup/plugin-commonjs/node_modules/estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "dev": true + }, + "node_modules/@rollup/plugin-inject": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@rollup/plugin-inject/-/plugin-inject-4.0.4.tgz", + "integrity": "sha512-4pbcU4J/nS+zuHk+c+OL3WtmEQhqxlZ9uqfjQMQDOHOPld7PsCd8k5LWs8h5wjwJN7MgnAn768F2sDxEP4eNFQ==", + "dev": true, + "dependencies": { + "@rollup/pluginutils": "^3.1.0", + "estree-walker": "^2.0.1", + "magic-string": "^0.25.7" + }, + "peerDependencies": { + "rollup": "^1.20.0 || ^2.0.0" + } + }, + "node_modules/@rollup/plugin-inject/node_modules/estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "dev": true + }, + "node_modules/@rollup/plugin-json": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-json/-/plugin-json-4.1.0.tgz", + "integrity": "sha512-yfLbTdNS6amI/2OpmbiBoW12vngr5NW2jCJVZSBEz+H5KfUJZ2M7sDjk0U6GOOdCWFVScShte29o9NezJ53TPw==", + "dev": true, + "dependencies": { + "@rollup/pluginutils": "^3.0.8" + }, + "peerDependencies": { + "rollup": "^1.20.0 || ^2.0.0" + } + }, + "node_modules/@rollup/plugin-node-resolve": { + "version": "11.2.1", + "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-11.2.1.tgz", + "integrity": "sha512-yc2n43jcqVyGE2sqV5/YCmocy9ArjVAP/BeXyTtADTBBX6V0e5UMqwO8CdQ0kzjb6zu5P1qMzsScCMRvE9OlVg==", + "dev": true, + "dependencies": { + "@rollup/pluginutils": "^3.1.0", + "@types/resolve": "1.17.1", + "builtin-modules": "^3.1.0", + "deepmerge": "^4.2.2", + "is-module": "^1.0.0", + "resolve": "^1.19.0" + }, + "engines": { + "node": ">= 10.0.0" + }, + "peerDependencies": { + "rollup": "^1.20.0||^2.0.0" + } + }, + "node_modules/@rollup/plugin-replace": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/@rollup/plugin-replace/-/plugin-replace-2.4.2.tgz", + "integrity": "sha512-IGcu+cydlUMZ5En85jxHH4qj2hta/11BHq95iHEyb2sbgiN0eCdzvUcHw5gt9pBL5lTi4JDYJ1acCoMGpTvEZg==", + "dev": true, + "dependencies": { + "@rollup/pluginutils": "^3.1.0", + "magic-string": "^0.25.7" + }, + "peerDependencies": { + "rollup": "^1.20.0 || ^2.0.0" + } + }, + "node_modules/@rollup/pluginutils": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.1.0.tgz", + "integrity": "sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==", + "dev": true, + "dependencies": { + "@types/estree": "0.0.39", + "estree-walker": "^1.0.1", + "picomatch": "^2.2.2" + }, + "engines": { + "node": ">= 8.0.0" + }, + "peerDependencies": { + "rollup": "^1.20.0||^2.0.0" + } + }, + "node_modules/@sindresorhus/is": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.4.0.tgz", + "integrity": "sha512-QppPM/8l3Mawvh4rn9CNEYIU9bxpXUCRMaX9yUpvBk1nMKusLKpfXGDEKExKaPhLzcn3lzil7pR6rnJ11HgeRQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/is?sponsor=1" + } + }, + "node_modules/@snowpack/plugin-dotenv": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@snowpack/plugin-dotenv/-/plugin-dotenv-2.2.0.tgz", + "integrity": "sha512-/gj91mHz9iPi7e393sibVfpm4jrG7hqZytgkfiscOIWJ8Y838D0jX1JFXu9IAThZz0IEKTLpb74d5A7pM00HVg==", + "dev": true, + "dependencies": { + "dotenv": "^8.2.0", + "dotenv-expand": "^5.1.0" + } + }, + "node_modules/@snowpack/plugin-postcss": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/@snowpack/plugin-postcss/-/plugin-postcss-1.4.3.tgz", + "integrity": "sha512-RJGYagse6Pi86Bqm8vPukhCwFVa92VIB81qP3PXPQ/ITQy5gVWDYi4oU+r1A6hsEZ9scUNZevfw6ISya+oiMNQ==", + "dev": true, + "dependencies": { + "minimatch": "^3.0.4", + "normalize-path": "^3.0.0", + "postcss-load-config": "^3.0.1", + "workerpool": "^6.1.2" + }, + "peerDependencies": { + "postcss": "*" + } + }, + "node_modules/@snowpack/plugin-react-refresh": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@snowpack/plugin-react-refresh/-/plugin-react-refresh-2.5.0.tgz", + "integrity": "sha512-3rYkwayAA+65IIYLXMEFqQwtBGbII9IidMJo1yXuj35kTEg9TdZrofoqcHaSts2sv2Nz0TD6v7BWRPdvCU0uIw==", + "dev": true, + "dependencies": { + "@babel/core": "^7.0.0", + "@babel/plugin-syntax-class-properties": "^7.10.0", + "react-refresh": "^0.9.0" + }, + "peerDependencies": { + "react": ">=16.9.0", + "react-dom": ">=16.9.0" + } + }, + "node_modules/@snowpack/plugin-typescript": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@snowpack/plugin-typescript/-/plugin-typescript-1.2.1.tgz", + "integrity": "sha512-wU+JNaMVkqGsqTaUY7TnEMhGt/3URTgA9dpMCtZX6wn/ceA7Gwlmue/sOLynf0OTNLygHPvjiQECQYkEi3LTtg==", + "dev": true, + "dependencies": { + "execa": "^5.0.0", + "npm-run-path": "^4.0.1" + }, + "peerDependencies": { + "typescript": "*" + } + }, + "node_modules/@snowpack/web-test-runner-plugin": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/@snowpack/web-test-runner-plugin/-/web-test-runner-plugin-0.2.2.tgz", + "integrity": "sha512-I7KC8BAcgRWZAg53w7Uq3UDY9hcn1ZGvmA+MjPqvgQXvKbwXfH0+T1nyPQmKUgYR1If99Vk4GnFscDZtaGbZCg==", + "dev": true, + "peerDependencies": { + "@web/test-runner": ">=0.10.0 <1.0.0", + "snowpack": "^3.0.0" + } + }, + "node_modules/@szmarczak/http-timer": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-4.0.6.tgz", + "integrity": "sha512-4BAffykYOgO+5nzBWYwE3W90sBgLJoUPRWWcL8wlyiM8IB8ipJz3UMJ9KXQd1RKQXpKp8Tutn80HZtWsu2u76w==", + "dev": true, + "dependencies": { + "defer-to-connect": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@tailwindcss/forms": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@tailwindcss/forms/-/forms-0.4.0.tgz", + "integrity": "sha512-DeaQBx6EgEeuZPQACvC+mKneJsD8am1uiJugjgQK1+/Vt+Ai0GpFBC2T2fqnUad71WgOxyrZPE6BG1VaI6YqfQ==", + "dev": true, + "dependencies": { + "mini-svg-data-uri": "^1.2.3" + }, + "peerDependencies": { + "tailwindcss": ">=3.0.0 || >= 3.0.0-alpha.1" + } + }, + "node_modules/@testing-library/dom": { + "version": "7.31.2", + "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-7.31.2.tgz", + "integrity": "sha512-3UqjCpey6HiTZT92vODYLPxTBWlM8ZOOjr3LX5F37/VRipW2M1kX6I/Cm4VXzteZqfGfagg8yXywpcOgQBlNsQ==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.10.4", + "@babel/runtime": "^7.12.5", + "@types/aria-query": "^4.2.0", + "aria-query": "^4.2.2", + "chalk": "^4.1.0", + "dom-accessibility-api": "^0.5.6", + "lz-string": "^1.4.4", + "pretty-format": "^26.6.2" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@testing-library/dom/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/@testing-library/dom/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/@testing-library/dom/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/@testing-library/dom/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/@testing-library/dom/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/@testing-library/dom/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@testing-library/react": { + "version": "11.2.7", + "resolved": "https://registry.npmjs.org/@testing-library/react/-/react-11.2.7.tgz", + "integrity": "sha512-tzRNp7pzd5QmbtXNG/mhdcl7Awfu/Iz1RaVHY75zTdOkmHCuzMhRL83gWHSgOAcjS3CCbyfwUHMZgRJb4kAfpA==", + "dev": true, + "dependencies": { + "@babel/runtime": "^7.12.5", + "@testing-library/dom": "^7.28.1" + }, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "react": "*", + "react-dom": "*" + } + }, + "node_modules/@tootallnate/once": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz", + "integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==", + "dev": true, + "engines": { + "node": ">= 6" + } + }, + "node_modules/@types/accepts": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/@types/accepts/-/accepts-1.3.5.tgz", + "integrity": "sha512-jOdnI/3qTpHABjM5cx1Hc0sKsPoYCp+DP/GJRGtDlPd7fiV9oXGGIcjW/ZOxLIvjGz8MA+uMZI9metHlgqbgwQ==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/aria-query": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-4.2.2.tgz", + "integrity": "sha512-HnYpAE1Y6kRyKM/XkEuiRQhTHvkzMBurTHnpFLYLBGPIylZNPs9jJcuOOYWxPLJCSEtmZT0Y8rHDokKN7rRTig==", + "dev": true + }, + "node_modules/@types/babel__code-frame": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/@types/babel__code-frame/-/babel__code-frame-7.0.3.tgz", + "integrity": "sha512-2TN6oiwtNjOezilFVl77zwdNPwQWaDBBCCWWxyo1ctiO3vAtd7H/aB/CBJdw9+kqq3+latD0SXoedIuHySSZWw==", + "dev": true + }, + "node_modules/@types/body-parser": { + "version": "1.19.2", + "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.2.tgz", + "integrity": "sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==", + "dev": true, + "dependencies": { + "@types/connect": "*", + "@types/node": "*" + } + }, + "node_modules/@types/cacheable-request": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.2.tgz", + "integrity": "sha512-B3xVo+dlKM6nnKTcmm5ZtY/OL8bOAOd2Olee9M1zft65ox50OzjEHW91sDiU9j6cvW8Ejg1/Qkf4xd2kugApUA==", + "dev": true, + "dependencies": { + "@types/http-cache-semantics": "*", + "@types/keyv": "*", + "@types/node": "*", + "@types/responselike": "*" + } + }, + "node_modules/@types/chai": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.0.tgz", + "integrity": "sha512-/ceqdqeRraGolFTcfoXNiqjyQhZzbINDngeoAq9GoHa8PPK1yNzTaxWjA6BFWp5Ua9JpXEMSS4s5i9tS0hOJtw==", + "dev": true + }, + "node_modules/@types/co-body": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@types/co-body/-/co-body-6.1.0.tgz", + "integrity": "sha512-3e0q2jyDAnx/DSZi0z2H0yoZ2wt5yRDZ+P7ymcMObvq0ufWRT4tsajyO+Q1VwVWiv9PRR4W3YEjEzBjeZlhF+w==", + "dev": true, + "dependencies": { + "@types/node": "*", + "@types/qs": "*" + } + }, + "node_modules/@types/command-line-args": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@types/command-line-args/-/command-line-args-5.2.0.tgz", + "integrity": "sha512-UuKzKpJJ/Ief6ufIaIzr3A/0XnluX7RvFgwkV89Yzvm77wCh1kFaFmqN8XEnGcN62EuHdedQjEMb8mYxFLGPyA==", + "dev": true + }, + "node_modules/@types/connect": { + "version": "3.4.35", + "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz", + "integrity": "sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/@types/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-0mPF08jn9zYI0n0Q/Pnz7C4kThdSt+6LD4amsrYDDpgBfrVWa3TcCOxKX1zkGgYniGagRv8heN2cbh+CAn+uuQ==", + "dev": true + }, + "node_modules/@types/convert-source-map": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/@types/convert-source-map/-/convert-source-map-1.5.2.tgz", + "integrity": "sha512-tHs++ZeXer40kCF2JpE51Hg7t4HPa18B1b1Dzy96S0eCw8QKECNMYMfwa1edK/x8yCN0r4e6ewvLcc5CsVGkdg==", + "dev": true + }, + "node_modules/@types/cookies": { + "version": "0.7.7", + "resolved": "https://registry.npmjs.org/@types/cookies/-/cookies-0.7.7.tgz", + "integrity": "sha512-h7BcvPUogWbKCzBR2lY4oqaZbO3jXZksexYJVFvkrFeLgbZjQkU4x8pRq6eg2MHXQhY0McQdqmmsxRWlVAHooA==", + "dev": true, + "dependencies": { + "@types/connect": "*", + "@types/express": "*", + "@types/keygrip": "*", + "@types/node": "*" + } + }, + "node_modules/@types/debounce": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@types/debounce/-/debounce-1.2.1.tgz", + "integrity": "sha512-epMsEE85fi4lfmJUH/89/iV/LI+F5CvNIvmgs5g5jYFPfhO2S/ae8WSsLOKWdwtoaZw9Q2IhJ4tQ5tFCcS/4HA==", + "dev": true + }, + "node_modules/@types/estree": { + "version": "0.0.39", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz", + "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==", + "dev": true + }, + "node_modules/@types/express": { + "version": "4.17.13", + "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.13.tgz", + "integrity": "sha512-6bSZTPaTIACxn48l50SR+axgrqm6qXFIxrdAKaG6PaJk3+zuUr35hBlgT7vOmJcum+OEaIBLtHV/qloEAFITeA==", + "dev": true, + "dependencies": { + "@types/body-parser": "*", + "@types/express-serve-static-core": "^4.17.18", + "@types/qs": "*", + "@types/serve-static": "*" + } + }, + "node_modules/@types/express-serve-static-core": { + "version": "4.17.28", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.28.tgz", + "integrity": "sha512-P1BJAEAW3E2DJUlkgq4tOL3RyMunoWXqbSCygWo5ZIWTjUgN1YnaXWW4VWl/oc8vs/XoYibEGBKP0uZyF4AHig==", + "dev": true, + "dependencies": { + "@types/node": "*", + "@types/qs": "*", + "@types/range-parser": "*" + } + }, + "node_modules/@types/http-assert": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@types/http-assert/-/http-assert-1.5.3.tgz", + "integrity": "sha512-FyAOrDuQmBi8/or3ns4rwPno7/9tJTijVW6aQQjK02+kOQ8zmoNg2XJtAuQhvQcy1ASJq38wirX5//9J1EqoUA==", + "dev": true + }, + "node_modules/@types/http-cache-semantics": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.1.tgz", + "integrity": "sha512-SZs7ekbP8CN0txVG2xVRH6EgKmEm31BOxA07vkFaETzZz1xh+cbt8BcI0slpymvwhx5dlFnQG2rTlPVQn+iRPQ==", + "dev": true + }, + "node_modules/@types/http-errors": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-1.8.2.tgz", + "integrity": "sha512-EqX+YQxINb+MeXaIqYDASb6U6FCHbWjkj4a1CKDBks3d/QiB2+PqBLyO72vLDgAO1wUI4O+9gweRcQK11bTL/w==", + "dev": true + }, + "node_modules/@types/istanbul-lib-coverage": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", + "integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==", + "dev": true + }, + "node_modules/@types/istanbul-lib-report": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", + "integrity": "sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg==", + "dev": true, + "dependencies": { + "@types/istanbul-lib-coverage": "*" + } + }, + "node_modules/@types/istanbul-reports": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz", + "integrity": "sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw==", + "dev": true, + "dependencies": { + "@types/istanbul-lib-report": "*" + } + }, + "node_modules/@types/keygrip": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@types/keygrip/-/keygrip-1.0.2.tgz", + "integrity": "sha512-GJhpTepz2udxGexqos8wgaBx4I/zWIDPh/KOGEwAqtuGDkOUJu5eFvwmdBX4AmB8Odsr+9pHCQqiAqDL/yKMKw==", + "dev": true + }, + "node_modules/@types/keyv": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/@types/keyv/-/keyv-3.1.3.tgz", + "integrity": "sha512-FXCJgyyN3ivVgRoml4h94G/p3kY+u/B86La+QptcqJaWtBWtmc6TtkNfS40n9bIvyLteHh7zXOtgbobORKPbDg==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/koa": { + "version": "2.13.4", + "resolved": "https://registry.npmjs.org/@types/koa/-/koa-2.13.4.tgz", + "integrity": "sha512-dfHYMfU+z/vKtQB7NUrthdAEiSvnLebvBjwHtfFmpZmB7em2N3WVQdHgnFq+xvyVgxW5jKDmjWfLD3lw4g4uTw==", + "dev": true, + "dependencies": { + "@types/accepts": "*", + "@types/content-disposition": "*", + "@types/cookies": "*", + "@types/http-assert": "*", + "@types/http-errors": "*", + "@types/keygrip": "*", + "@types/koa-compose": "*", + "@types/node": "*" + } + }, + "node_modules/@types/koa-compose": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/@types/koa-compose/-/koa-compose-3.2.5.tgz", + "integrity": "sha512-B8nG/OoE1ORZqCkBVsup/AKcvjdgoHnfi4pZMn5UwAPCbhk/96xyv284eBYW8JlQbQ7zDmnpFr68I/40mFoIBQ==", + "dev": true, + "dependencies": { + "@types/koa": "*" + } + }, + "node_modules/@types/mime": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.2.tgz", + "integrity": "sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw==", + "dev": true + }, + "node_modules/@types/mocha": { + "version": "8.2.3", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-8.2.3.tgz", + "integrity": "sha512-ekGvFhFgrc2zYQoX4JeZPmVzZxw6Dtllga7iGHzfbYIYkAMUx/sAFP2GdFpLff+vdHXu5fl7WX9AT+TtqYcsyw==", + "dev": true + }, + "node_modules/@types/node": { + "version": "17.0.14", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.14.tgz", + "integrity": "sha512-SbjLmERksKOGzWzPNuW7fJM7fk3YXVTFiZWB/Hs99gwhk+/dnrQRPBQjPW9aO+fi1tAffi9PrwFvsmOKmDTyng==", + "dev": true + }, + "node_modules/@types/parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==", + "dev": true + }, + "node_modules/@types/parse5": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/@types/parse5/-/parse5-6.0.3.tgz", + "integrity": "sha512-SuT16Q1K51EAVPz1K29DJ/sXjhSQ0zjvsypYJ6tlwVsRV9jwW5Adq2ch8Dq8kDBCkYnELS7N7VNCSB5nC56t/g==", + "dev": true + }, + "node_modules/@types/prop-types": { + "version": "15.7.4", + "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.4.tgz", + "integrity": "sha512-rZ5drC/jWjrArrS8BR6SIr4cWpW09RNTYt9AMZo3Jwwif+iacXAqgVjm0B0Bv/S1jhDXKHqRVNCbACkJ89RAnQ==", + "dev": true + }, + "node_modules/@types/qs": { + "version": "6.9.7", + "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz", + "integrity": "sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==", + "dev": true + }, + "node_modules/@types/range-parser": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.4.tgz", + "integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==", + "dev": true + }, + "node_modules/@types/react": { + "version": "17.0.39", + "resolved": "https://registry.npmjs.org/@types/react/-/react-17.0.39.tgz", + "integrity": "sha512-UVavlfAxDd/AgAacMa60Azl7ygyQNRwC/DsHZmKgNvPmRR5p70AJ5Q9EAmL2NWOJmeV+vVUI4IAP7GZrN8h8Ug==", + "dev": true, + "dependencies": { + "@types/prop-types": "*", + "@types/scheduler": "*", + "csstype": "^3.0.2" + } + }, + "node_modules/@types/react-dom": { + "version": "17.0.11", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-17.0.11.tgz", + "integrity": "sha512-f96K3k+24RaLGVu/Y2Ng3e1EbZ8/cVJvypZWd7cy0ofCBaf2lcM46xNhycMZ2xGwbBjRql7hOlZ+e2WlJ5MH3Q==", + "dev": true, + "dependencies": { + "@types/react": "*" + } + }, + "node_modules/@types/resolve": { + "version": "1.17.1", + "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.17.1.tgz", + "integrity": "sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/responselike": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@types/responselike/-/responselike-1.0.0.tgz", + "integrity": "sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/scheduler": { + "version": "0.16.2", + "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.2.tgz", + "integrity": "sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew==", + "dev": true + }, + "node_modules/@types/serve-static": { + "version": "1.13.10", + "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.13.10.tgz", + "integrity": "sha512-nCkHGI4w7ZgAdNkrEu0bv+4xNV/XDqW+DydknebMOQwkpDGx8G+HTlj7R7ABI8i8nKxVw0wtKPi1D+lPOkh4YQ==", + "dev": true, + "dependencies": { + "@types/mime": "^1", + "@types/node": "*" + } + }, + "node_modules/@types/snowpack-env": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/@types/snowpack-env/-/snowpack-env-2.3.4.tgz", + "integrity": "sha512-zYzMb2aMyzXW5VgOQHy+FgI8N5tLFb+tIsUqk35CIgSr9pT4pji2GR8BCOTMdniusVuRHIp/DaYQNQGYGLVZHQ==", + "dev": true + }, + "node_modules/@types/ws": { + "version": "7.4.7", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-7.4.7.tgz", + "integrity": "sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/yargs": { + "version": "15.0.14", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.14.tgz", + "integrity": "sha512-yEJzHoxf6SyQGhBhIYGXQDSCkJjB6HohDShto7m8vaKg9Yp0Yn8+71J9eakh2bnPg6BfsH9PRMhiRTZnd4eXGQ==", + "dev": true, + "dependencies": { + "@types/yargs-parser": "*" + } + }, + "node_modules/@types/yargs-parser": { + "version": "20.2.1", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-20.2.1.tgz", + "integrity": "sha512-7tFImggNeNBVMsn0vLrpn1H1uPrUBdnARPTpZoitY37ZrdJREzf7I16tMrlK3hen349gr1NYh8CmZQa7CTG6Aw==", + "dev": true + }, + "node_modules/@types/yauzl": { + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.9.2.tgz", + "integrity": "sha512-8uALY5LTvSuHgloDVUvWP3pIauILm+8/0pDMokuDYIoNsOkSwd5AiHBTSEJjKTDcZr5z8UpgOWZkxBF4iJftoA==", + "dev": true, + "optional": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@web/browser-logs": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/@web/browser-logs/-/browser-logs-0.2.5.tgz", + "integrity": "sha512-Qxo1wY/L7yILQqg0jjAaueh+tzdORXnZtxQgWH23SsTCunz9iq9FvsZa8Q5XlpjnZ3vLIsFEuEsCMqFeohJnEg==", + "dev": true, + "dependencies": { + "errorstacks": "^2.2.0" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/@web/config-loader": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@web/config-loader/-/config-loader-0.1.3.tgz", + "integrity": "sha512-XVKH79pk4d3EHRhofete8eAnqto1e8mCRAqPV00KLNFzCWSe8sWmLnqKCqkPNARC6nksMaGrATnA5sPDRllMpQ==", + "dev": true, + "dependencies": { + "semver": "^7.3.4" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/@web/config-loader/node_modules/semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@web/dev-server": { + "version": "0.1.29", + "resolved": "https://registry.npmjs.org/@web/dev-server/-/dev-server-0.1.29.tgz", + "integrity": "sha512-oDz6vC9JEDZd4ZTno+SV57zCpsQl9v5LOkGuWGyei5gx5xu8NVDvh2IgTugz6DhZnffsSE6Zi0ubs+AhonLnGA==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.12.11", + "@types/command-line-args": "^5.0.0", + "@web/config-loader": "^0.1.3", + "@web/dev-server-core": "^0.3.17", + "@web/dev-server-rollup": "^0.3.13", + "camelcase": "^6.2.0", + "command-line-args": "^5.1.1", + "command-line-usage": "^6.1.1", + "debounce": "^1.2.0", + "deepmerge": "^4.2.2", + "ip": "^1.1.5", + "nanocolors": "^0.2.1", + "open": "^8.0.2", + "portfinder": "^1.0.28" + }, + "bin": { + "wds": "dist/bin.js", + "web-dev-server": "dist/bin.js" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/@web/dev-server-core": { + "version": "0.3.17", + "resolved": "https://registry.npmjs.org/@web/dev-server-core/-/dev-server-core-0.3.17.tgz", + "integrity": "sha512-vN1dwQ8yDHGiAvCeUo9xFfjo+pFl8TW+pON7k9kfhbegrrB8CKhJDUxmHbZsyQUmjf/iX57/LhuWj1xGhRL8AA==", + "dev": true, + "dependencies": { + "@types/koa": "^2.11.6", + "@types/ws": "^7.4.0", + "@web/parse5-utils": "^1.2.0", + "chokidar": "^3.4.3", + "clone": "^2.1.2", + "es-module-lexer": "^0.9.0", + "get-stream": "^6.0.0", + "is-stream": "^2.0.0", + "isbinaryfile": "^4.0.6", + "koa": "^2.13.0", + "koa-etag": "^4.0.0", + "koa-send": "^5.0.1", + "koa-static": "^5.0.0", + "lru-cache": "^6.0.0", + "mime-types": "^2.1.27", + "parse5": "^6.0.1", + "picomatch": "^2.2.2", + "ws": "^7.4.2" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/@web/dev-server-rollup": { + "version": "0.3.15", + "resolved": "https://registry.npmjs.org/@web/dev-server-rollup/-/dev-server-rollup-0.3.15.tgz", + "integrity": "sha512-hhxvBmNIY19vXeocYB1IBOuhpVpy1L7jbwBarmvC0QJKZsgkxssNTzXJ8iga70c2+H0c/rBz1xUaKuAcov0uOA==", + "dev": true, + "dependencies": { + "@rollup/plugin-node-resolve": "^11.0.1", + "@web/dev-server-core": "^0.3.16", + "nanocolors": "^0.2.1", + "parse5": "^6.0.1", + "rollup": "^2.66.1", + "whatwg-url": "^11.0.0" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/@web/parse5-utils": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@web/parse5-utils/-/parse5-utils-1.3.0.tgz", + "integrity": "sha512-Pgkx3ECc8EgXSlS5EyrgzSOoUbM6P8OKS471HLAyvOBcP1NCBn0to4RN/OaKASGq8qa3j+lPX9H14uA5AHEnQg==", + "dev": true, + "dependencies": { + "@types/parse5": "^6.0.1", + "parse5": "^6.0.1" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/@web/test-runner": { + "version": "0.13.27", + "resolved": "https://registry.npmjs.org/@web/test-runner/-/test-runner-0.13.27.tgz", + "integrity": "sha512-yVhXK9sPJE2VQs1/KPTIeQvUxh+02OZkn+tgcr0+W8ovvrFD4ucF2X26cpeOTuD+Y67ERUi/EopIze3aelw6sg==", + "dev": true, + "dependencies": { + "@web/browser-logs": "^0.2.2", + "@web/config-loader": "^0.1.3", + "@web/dev-server": "^0.1.24", + "@web/test-runner-chrome": "^0.10.7", + "@web/test-runner-commands": "^0.6.0", + "@web/test-runner-core": "^0.10.22", + "@web/test-runner-mocha": "^0.7.5", + "camelcase": "^6.2.0", + "command-line-args": "^5.1.1", + "command-line-usage": "^6.1.1", + "convert-source-map": "^1.7.0", + "diff": "^5.0.0", + "globby": "^11.0.1", + "nanocolors": "^0.2.1", + "portfinder": "^1.0.28", + "source-map": "^0.7.3" + }, + "bin": { + "web-test-runner": "dist/bin.js", + "wtr": "dist/bin.js" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/@web/test-runner-chrome": { + "version": "0.10.7", + "resolved": "https://registry.npmjs.org/@web/test-runner-chrome/-/test-runner-chrome-0.10.7.tgz", + "integrity": "sha512-DKJVHhHh3e/b6/erfKOy0a4kGfZ47qMoQRgROxi9T4F9lavEY3E5/MQ7hapHFM2lBF4vDrm+EWjtBdOL8o42tw==", + "dev": true, + "dependencies": { + "@web/test-runner-core": "^0.10.20", + "@web/test-runner-coverage-v8": "^0.4.8", + "chrome-launcher": "^0.15.0", + "puppeteer-core": "^13.1.3" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/@web/test-runner-commands": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/@web/test-runner-commands/-/test-runner-commands-0.6.1.tgz", + "integrity": "sha512-P4aQqp0duumeGdGxQ8TwLnplkrXzpLqb47eSEEqBRS//C1H7s6VskaqEng+k0dbk+cSpEa4RuZGY/G5k8aTjTw==", + "dev": true, + "dependencies": { + "@web/test-runner-core": "^0.10.20", + "mkdirp": "^1.0.4" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/@web/test-runner-core": { + "version": "0.10.23", + "resolved": "https://registry.npmjs.org/@web/test-runner-core/-/test-runner-core-0.10.23.tgz", + "integrity": "sha512-02qig6GufCMdzGEXD1HT4uy1pxBhHeEZ0Yb4HqenbW2b2/8qPk983dYl1OmUwzFPPMIHcvCjpl9u5LxF464+Ng==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.12.11", + "@types/babel__code-frame": "^7.0.2", + "@types/co-body": "^6.1.0", + "@types/convert-source-map": "^1.5.1", + "@types/debounce": "^1.2.0", + "@types/istanbul-lib-coverage": "^2.0.3", + "@types/istanbul-reports": "^3.0.0", + "@web/browser-logs": "^0.2.1", + "@web/dev-server-core": "^0.3.16", + "chokidar": "^3.4.3", + "cli-cursor": "^3.1.0", + "co-body": "^6.1.0", + "convert-source-map": "^1.7.0", + "debounce": "^1.2.0", + "dependency-graph": "^0.11.0", + "globby": "^11.0.1", + "ip": "^1.1.5", + "istanbul-lib-coverage": "^3.0.0", + "istanbul-lib-report": "^3.0.0", + "istanbul-reports": "^3.0.2", + "log-update": "^4.0.0", + "nanocolors": "^0.2.1", + "nanoid": "^3.1.25", + "open": "^8.0.2", + "picomatch": "^2.2.2", + "source-map": "^0.7.3" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/@web/test-runner-core/node_modules/source-map": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", + "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@web/test-runner-coverage-v8": { + "version": "0.4.8", + "resolved": "https://registry.npmjs.org/@web/test-runner-coverage-v8/-/test-runner-coverage-v8-0.4.8.tgz", + "integrity": "sha512-Ib0AscR8Xf9E/V7rf3XOVQTe4vKIbwSTupxV1xGgzj3x4RKUuMUg9FLz9EigZ5iN0mOzZKDllyRS523hbdhDtA==", + "dev": true, + "dependencies": { + "@web/test-runner-core": "^0.10.20", + "istanbul-lib-coverage": "^3.0.0", + "picomatch": "^2.2.2", + "v8-to-istanbul": "^8.0.0" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/@web/test-runner-mocha": { + "version": "0.7.5", + "resolved": "https://registry.npmjs.org/@web/test-runner-mocha/-/test-runner-mocha-0.7.5.tgz", + "integrity": "sha512-12/OBq6efPCAvJpcz3XJs2OO5nHe7GtBibZ8Il1a0QtsGpRmuJ4/m1EF0Fj9f6KHg7JdpGo18A37oE+5hXjHwg==", + "dev": true, + "dependencies": { + "@types/mocha": "^8.2.0", + "@web/test-runner-core": "^0.10.20" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/@web/test-runner/node_modules/source-map": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", + "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", + "dev": true + }, + "node_modules/accepts": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "dev": true, + "dependencies": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/acorn": { + "version": "7.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", + "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-node": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/acorn-node/-/acorn-node-1.8.2.tgz", + "integrity": "sha512-8mt+fslDufLYntIoPAaIMUe/lrbrehIiwmR3t2k9LljIzoigEPF27eLk2hy8zSGzmR/ogr7zbRKINMo1u0yh5A==", + "dev": true, + "dependencies": { + "acorn": "^7.0.0", + "acorn-walk": "^7.0.0", + "xtend": "^4.0.2" + } + }, + "node_modules/acorn-walk": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-7.2.0.tgz", + "integrity": "sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/address": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/address/-/address-1.1.2.tgz", + "integrity": "sha512-aT6camzM4xEA54YVJYSqxz1kv4IHnQZRtThJJHhUMRExaU5spC7jX5ugSwTaTgJliIgs4VhZOk7htClvQ/LmRA==", + "dev": true, + "engines": { + "node": ">= 0.12.0" + } + }, + "node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "dev": true, + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/agentkeepalive": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.2.0.tgz", + "integrity": "sha512-0PhAp58jZNw13UJv7NVdTGb0ZcghHUb3DrZ046JiiJY/BOaTTpbwdHq2VObPCBV8M2GPh7sgrJ3AQ8Ey468LJw==", + "dev": true, + "dependencies": { + "debug": "^4.1.0", + "depd": "^1.1.2", + "humanize-ms": "^1.2.1" + }, + "engines": { + "node": ">= 8.0.0" + } + }, + "node_modules/agentkeepalive/node_modules/depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/aggregate-error": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", + "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", + "dev": true, + "dependencies": { + "clean-stack": "^2.0.0", + "indent-string": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-escapes": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", + "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", + "dev": true, + "dependencies": { + "type-fest": "^0.21.3" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/anymatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", + "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", + "dev": true, + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/aproba": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", + "dev": true + }, + "node_modules/are-we-there-yet": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.7.tgz", + "integrity": "sha512-nxwy40TuMiUGqMyRHgCSWZ9FM4VAoRP4xUYSTv5ImRog+h9yISPbVH7H8fASCIzYn9wlEv4zvFL7uKDMCFQm3g==", + "dev": true, + "dependencies": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" + } + }, + "node_modules/arg": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/arg/-/arg-5.0.1.tgz", + "integrity": "sha512-e0hDa9H2Z9AwFkk2qDlwhoMYE4eToKarchkQHovNdLTCYMHZHeRjI71crOh+dio4K6u1IcwubQqo79Ga4CyAQA==", + "dev": true + }, + "node_modules/aria-query": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-4.2.2.tgz", + "integrity": "sha512-o/HelwhuKpTj/frsOsbNLNgnNGVIFsVP/SW2BSF14gVl7kAfMOJ6/8wUAUvG1R1NHKrfG+2sHZTu0yauT1qBrA==", + "dev": true, + "dependencies": { + "@babel/runtime": "^7.10.2", + "@babel/runtime-corejs3": "^7.10.2" + }, + "engines": { + "node": ">=6.0" + } + }, + "node_modules/array-back": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/array-back/-/array-back-3.1.0.tgz", + "integrity": "sha512-TkuxA4UCOvxuDK6NZYXCalszEzj+TLszyASooky+i742l9TqsOdYCMJJupxRic61hwquNtppB3hgcuq9SVSH1Q==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/asap": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", + "integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=", + "dev": true + }, + "node_modules/asn1": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz", + "integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==", + "dev": true, + "dependencies": { + "safer-buffer": "~2.1.0" + } + }, + "node_modules/assert": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/assert/-/assert-1.5.0.tgz", + "integrity": "sha512-EDsgawzwoun2CZkCgtxJbv392v4nbk9XDD06zI+kQYoBM/3RBWLlEyJARDOmhAAosBjWACEkKL6S+lIZtcAubA==", + "dev": true, + "dependencies": { + "object-assign": "^4.1.1", + "util": "0.10.3" + } + }, + "node_modules/assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "dev": true, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/astral-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", + "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/async": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", + "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==", + "dev": true, + "dependencies": { + "lodash": "^4.17.14" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "dev": true + }, + "node_modules/automation-events": { + "version": "4.0.12", + "resolved": "https://registry.npmjs.org/automation-events/-/automation-events-4.0.12.tgz", + "integrity": "sha512-7tu7q/rw3vFuAwjBoarCGql3V0HkC5QAbZUYhOblxxkHzdLUTjVotm0iaIRwiCSqxMeoFK64LrgaSCuSZguvGA==", + "dependencies": { + "@babel/runtime": "^7.16.7", + "tslib": "^2.3.1" + }, + "engines": { + "node": ">=12.20.1" + } + }, + "node_modules/autoprefixer": { + "version": "10.4.2", + "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.2.tgz", + "integrity": "sha512-9fOPpHKuDW1w/0EKfRmVnxTDt8166MAnLI3mgZ1JCnhNtYWxcJ6Ud5CO/AVOZi/AvFa8DY9RTy3h3+tFBlrrdQ==", + "dev": true, + "dependencies": { + "browserslist": "^4.19.1", + "caniuse-lite": "^1.0.30001297", + "fraction.js": "^4.1.2", + "normalize-range": "^0.1.2", + "picocolors": "^1.0.0", + "postcss-value-parser": "^4.2.0" + }, + "bin": { + "autoprefixer": "bin/autoprefixer" + }, + "engines": { + "node": "^10 || ^12 || >=14" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + "peerDependencies": { + "postcss": "^8.1.0" + } + }, + "node_modules/aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/aws4": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz", + "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==", + "dev": true + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "dev": true, + "dependencies": { + "tweetnacl": "^0.14.3" + } + }, + "node_modules/big-integer": { + "version": "1.6.51", + "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.51.tgz", + "integrity": "sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg==", + "dev": true, + "engines": { + "node": ">=0.6" + } + }, + "node_modules/bin-links": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/bin-links/-/bin-links-2.3.0.tgz", + "integrity": "sha512-JzrOLHLwX2zMqKdyYZjkDgQGT+kHDkIhv2/IK2lJ00qLxV4TmFoHi8drDBb6H5Zrz1YfgHkai4e2MGPqnoUhqA==", + "dev": true, + "dependencies": { + "cmd-shim": "^4.0.1", + "mkdirp-infer-owner": "^2.0.0", + "npm-normalize-package-bin": "^1.0.0", + "read-cmd-shim": "^2.0.0", + "rimraf": "^3.0.0", + "write-file-atomic": "^3.0.3" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/bl": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "dev": true, + "dependencies": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "node_modules/bl/node_modules/readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/boolbase": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", + "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=", + "dev": true + }, + "node_modules/bplist-parser": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.1.1.tgz", + "integrity": "sha1-1g1dzCDLptx+HymbNdPh+V2vuuY=", + "dev": true, + "dependencies": { + "big-integer": "^1.6.7" + } + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/browserslist": { + "version": "4.19.1", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.19.1.tgz", + "integrity": "sha512-u2tbbG5PdKRTUoctO3NBD8FQ5HdPh1ZXPHzp1rwaa5jTc+RV9/+RlWiAIKmjRPQF+xbGM9Kklj5bZQFa2s/38A==", + "dev": true, + "dependencies": { + "caniuse-lite": "^1.0.30001286", + "electron-to-chromium": "^1.4.17", + "escalade": "^3.1.1", + "node-releases": "^2.0.1", + "picocolors": "^1.0.0" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + } + }, + "node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "node_modules/buffer-crc32": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", + "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/bufferutil": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.6.tgz", + "integrity": "sha512-jduaYOYtnio4aIAyc6UbvPCVcgq7nYpVnucyxr6eCYg/Woad9Hf/oxxBRDnGGjPfjUm6j5O/uBWhIu4iLebFaw==", + "dev": true, + "hasInstallScript": true, + "dependencies": { + "node-gyp-build": "^4.3.0" + }, + "engines": { + "node": ">=6.14.2" + } + }, + "node_modules/builtin-modules": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.2.0.tgz", + "integrity": "sha512-lGzLKcioL90C7wMczpkY0n/oART3MbBa8R9OFGE1rJxoVI86u4WAGfEk8Wjv10eKSyTHVGkSo3bvBylCEtk7LA==", + "dev": true, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/builtins": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/builtins/-/builtins-1.0.3.tgz", + "integrity": "sha1-y5T662HIaWRR2zZTThQi+U8K7og=", + "dev": true + }, + "node_modules/bytes": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.1.tgz", + "integrity": "sha512-dWe4nWO/ruEOY7HkUJ5gFt1DCFV9zPRoJr8pV0/ASQermOZjtq8jMjOprC0Kd10GLN+l7xaUPvxzJFWtxGu8Fg==", + "dev": true, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/cacache": { + "version": "15.3.0", + "resolved": "https://registry.npmjs.org/cacache/-/cacache-15.3.0.tgz", + "integrity": "sha512-VVdYzXEn+cnbXpFgWs5hTT7OScegHVmLhJIR8Ufqk3iFD6A6j5iSX1KuBTfNEv4tdJWE2PzA6IVFtcLC7fN9wQ==", + "dev": true, + "dependencies": { + "@npmcli/fs": "^1.0.0", + "@npmcli/move-file": "^1.0.1", + "chownr": "^2.0.0", + "fs-minipass": "^2.0.0", + "glob": "^7.1.4", + "infer-owner": "^1.0.4", + "lru-cache": "^6.0.0", + "minipass": "^3.1.1", + "minipass-collect": "^1.0.2", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.2", + "mkdirp": "^1.0.3", + "p-map": "^4.0.0", + "promise-inflight": "^1.0.1", + "rimraf": "^3.0.2", + "ssri": "^8.0.1", + "tar": "^6.0.2", + "unique-filename": "^1.1.1" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/cache-content-type": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/cache-content-type/-/cache-content-type-1.0.1.tgz", + "integrity": "sha512-IKufZ1o4Ut42YUrZSo8+qnMTrFuKkvyoLXUywKz9GJ5BrhOFGhLdkx9sG4KAnVvbY6kEcSFjLQul+DVmBm2bgA==", + "dev": true, + "dependencies": { + "mime-types": "^2.1.18", + "ylru": "^1.2.0" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/cacheable-lookup": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-5.0.4.tgz", + "integrity": "sha512-2/kNscPhpcxrOigMZzbiWF7dz8ilhb/nIHU3EyZiXWXpeq/au8qJ8VhdftMkty3n7Gj6HIGalQG8oiBNB3AJgA==", + "dev": true, + "engines": { + "node": ">=10.6.0" + } + }, + "node_modules/cacheable-request": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-7.0.2.tgz", + "integrity": "sha512-pouW8/FmiPQbuGpkXQ9BAPv/Mo5xDGANgSNXzTzJ8DrKGuXOssM4wIQRjfanNRh3Yu5cfYPvcorqbhg2KIJtew==", + "dev": true, + "dependencies": { + "clone-response": "^1.0.2", + "get-stream": "^5.1.0", + "http-cache-semantics": "^4.0.0", + "keyv": "^4.0.0", + "lowercase-keys": "^2.0.0", + "normalize-url": "^6.0.1", + "responselike": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cacheable-request/node_modules/get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "dev": true, + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cachedir": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/cachedir/-/cachedir-2.3.0.tgz", + "integrity": "sha512-A+Fezp4zxnit6FanDmv9EqXNAi3vt9DWp51/71UEhXukb7QUuvtv9344h91dyAxuTLoSYJFU299qzR3tzwPAhw==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/camelcase-css": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/camelcase-css/-/camelcase-css-2.0.1.tgz", + "integrity": "sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA==", + "dev": true, + "engines": { + "node": ">= 6" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001307", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001307.tgz", + "integrity": "sha512-+MXEMczJ4FuxJAUp0jvAl6Df0NI/OfW1RWEE61eSmzS7hw6lz4IKutbhbXendwq8BljfFuHtu26VWsg4afQ7Ng==", + "dev": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + } + }, + "node_modules/caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", + "dev": true + }, + "node_modules/chai": { + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.6.tgz", + "integrity": "sha512-bbcp3YfHCUzMOvKqsztczerVgBKSsEijCySNlHHbX3VG1nskvqjz5Rfso1gGwD6w6oOV3eI60pKuMOV5MV7p3Q==", + "dev": true, + "dependencies": { + "assertion-error": "^1.1.0", + "check-error": "^1.0.2", + "deep-eql": "^3.0.1", + "get-func-name": "^2.0.0", + "loupe": "^2.3.1", + "pathval": "^1.1.1", + "type-detect": "^4.0.5" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/check-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", + "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/cheerio": { + "version": "1.0.0-rc.10", + "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.10.tgz", + "integrity": "sha512-g0J0q/O6mW8z5zxQ3A8E8J1hUgp4SMOvEoW/x84OwyHKe/Zccz83PVT4y5Crcr530FV6NgmKI1qvGTKVl9XXVw==", + "dev": true, + "dependencies": { + "cheerio-select": "^1.5.0", + "dom-serializer": "^1.3.2", + "domhandler": "^4.2.0", + "htmlparser2": "^6.1.0", + "parse5": "^6.0.1", + "parse5-htmlparser2-tree-adapter": "^6.0.1", + "tslib": "^2.2.0" + }, + "engines": { + "node": ">= 6" + }, + "funding": { + "url": "https://github.com/cheeriojs/cheerio?sponsor=1" + } + }, + "node_modules/cheerio-select": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/cheerio-select/-/cheerio-select-1.5.0.tgz", + "integrity": "sha512-qocaHPv5ypefh6YNxvnbABM07KMxExbtbfuJoIie3iZXX1ERwYmJcIiRrr9H05ucQP1k28dav8rpdDgjQd8drg==", + "dev": true, + "dependencies": { + "css-select": "^4.1.3", + "css-what": "^5.0.1", + "domelementtype": "^2.2.0", + "domhandler": "^4.2.0", + "domutils": "^2.7.0" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, + "node_modules/chokidar": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/chownr": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", + "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/chrome-launcher": { + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/chrome-launcher/-/chrome-launcher-0.15.0.tgz", + "integrity": "sha512-ZQqX5kb9H0+jy1OqLnWampfocrtSZaGl7Ny3F9GRha85o4odbL8x55paUzh51UC7cEmZ5obp3H2Mm70uC2PpRA==", + "dev": true, + "dependencies": { + "@types/node": "*", + "escape-string-regexp": "^4.0.0", + "is-wsl": "^2.2.0", + "lighthouse-logger": "^1.0.0" + }, + "bin": { + "print-chrome-path": "bin/print-chrome-path.js" + }, + "engines": { + "node": ">=12.13.0" + } + }, + "node_modules/chrome-launcher/node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cjs-module-lexer": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.2.2.tgz", + "integrity": "sha512-cOU9usZw8/dXIXKtwa8pM0OTJQuJkxMN6w30csNRUerHfeQ5R6U3kkU/FtJeIf3M202OHfY2U8ccInBG7/xogA==", + "dev": true + }, + "node_modules/clean-stack": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", + "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/cli-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", + "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", + "dev": true, + "dependencies": { + "restore-cursor": "^3.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cli-spinners": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.6.1.tgz", + "integrity": "sha512-x/5fWmGMnbKQAaNwN+UZlV79qBLM9JFnJuJ03gIi5whrob0xV0ofNVHy9DhwGdsMJQc2OKv0oGmLzvaqvAVv+g==", + "dev": true, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/clone": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", + "integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=", + "dev": true, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/clone-response": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz", + "integrity": "sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=", + "dev": true, + "dependencies": { + "mimic-response": "^1.0.0" + } + }, + "node_modules/cmd-shim": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/cmd-shim/-/cmd-shim-4.1.0.tgz", + "integrity": "sha512-lb9L7EM4I/ZRVuljLPEtUJOP+xiQVknZ4ZMpMgEp4JzNldPb27HU03hi6K1/6CoIuit/Zm/LQXySErFeXxDprw==", + "dev": true, + "dependencies": { + "mkdirp-infer-owner": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", + "dev": true, + "engines": { + "iojs": ">= 1.0.0", + "node": ">= 0.12.0" + } + }, + "node_modules/co-body": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/co-body/-/co-body-6.1.0.tgz", + "integrity": "sha512-m7pOT6CdLN7FuXUcpuz/8lfQ/L77x8SchHCF4G0RBTJO20Wzmhn5Sp4/5WsKy8OSpifBSUrmg83qEqaDHdyFuQ==", + "dev": true, + "dependencies": { + "inflation": "^2.0.0", + "qs": "^6.5.2", + "raw-body": "^2.3.3", + "type-is": "^1.6.16" + } + }, + "node_modules/code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dev": true, + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/command-line-args": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/command-line-args/-/command-line-args-5.2.1.tgz", + "integrity": "sha512-H4UfQhZyakIjC74I9d34fGYDwk3XpSr17QhEd0Q3I9Xq1CETHo4Hcuo87WyWHpAF1aSLjLRf5lD9ZGX2qStUvg==", + "dev": true, + "dependencies": { + "array-back": "^3.1.0", + "find-replace": "^3.0.0", + "lodash.camelcase": "^4.3.0", + "typical": "^4.0.0" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/command-line-usage": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/command-line-usage/-/command-line-usage-6.1.1.tgz", + "integrity": "sha512-F59pEuAR9o1SF/bD0dQBDluhpT4jJQNWUHEuVBqpDmCUo6gPjCi+m9fCWnWZVR/oG6cMTUms4h+3NPl74wGXvA==", + "dev": true, + "dependencies": { + "array-back": "^4.0.1", + "chalk": "^2.4.2", + "table-layout": "^1.0.1", + "typical": "^5.2.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/command-line-usage/node_modules/array-back": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/array-back/-/array-back-4.0.2.tgz", + "integrity": "sha512-NbdMezxqf94cnNfWLL7V/im0Ub+Anbb0IoZhvzie8+4HJ4nMQuzHuy49FkGYCJK2yAloZ3meiB6AVMClbrI1vg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/command-line-usage/node_modules/typical": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/typical/-/typical-5.2.0.tgz", + "integrity": "sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/common-ancestor-path": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/common-ancestor-path/-/common-ancestor-path-1.0.1.tgz", + "integrity": "sha512-L3sHRo1pXXEqX8VU28kfgUY+YGsk09hPqZiZmLacNib6XNTCM8ubYeT7ryXQw8asB1sKgcU5lkB7ONug08aB8w==", + "dev": true + }, + "node_modules/commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", + "dev": true + }, + "node_modules/compressible": { + "version": "2.0.18", + "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.18.tgz", + "integrity": "sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg==", + "dev": true, + "dependencies": { + "mime-db": ">= 1.43.0 < 2" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "node_modules/console-control-strings": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", + "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", + "dev": true + }, + "node_modules/content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", + "dev": true, + "dependencies": { + "safe-buffer": "5.2.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/content-disposition/node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/content-type": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/convert-source-map": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.8.0.tgz", + "integrity": "sha512-+OQdjP49zViI/6i7nIJpA8rAl4sV/JdPfU9nZs3VqOwGIgizICvuN2ru6fMd+4llL0tar18UYJXfZ/TWtmhUjA==", + "dev": true, + "dependencies": { + "safe-buffer": "~5.1.1" + } + }, + "node_modules/cookies": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/cookies/-/cookies-0.8.0.tgz", + "integrity": "sha512-8aPsApQfebXnuI+537McwYsDtjVxGm8gTIzQI3FDW6t5t/DAhERxtnbEPN/8RX+uZthoz4eCOgloXaE5cYyNow==", + "dev": true, + "dependencies": { + "depd": "~2.0.0", + "keygrip": "~1.1.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/core-js-pure": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.21.0.tgz", + "integrity": "sha512-VaJUunCZLnxuDbo1rNOzwbet9E1K9joiXS5+DQMPtgxd24wfsZbJZMMfQLGYMlCUvSxLfsRUUhoOR2x28mFfeg==", + "dev": true, + "hasInstallScript": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/core-js" + } + }, + "node_modules/core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", + "dev": true + }, + "node_modules/cosmiconfig": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.0.1.tgz", + "integrity": "sha512-a1YWNUV2HwGimB7dU2s1wUMurNKjpx60HxBB6xUM8Re+2s1g1IIfJvFR0/iCF+XHdE0GMTKTuLR32UQff4TEyQ==", + "dev": true, + "dependencies": { + "@types/parse-json": "^4.0.0", + "import-fresh": "^3.2.1", + "parse-json": "^5.0.0", + "path-type": "^4.0.0", + "yaml": "^1.10.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/css-select": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-4.2.1.tgz", + "integrity": "sha512-/aUslKhzkTNCQUB2qTX84lVmfia9NyjP3WpDGtj/WxhwBzWBYUV3DgUpurHTme8UTPcPlAD1DJ+b0nN/t50zDQ==", + "dev": true, + "dependencies": { + "boolbase": "^1.0.0", + "css-what": "^5.1.0", + "domhandler": "^4.3.0", + "domutils": "^2.8.0", + "nth-check": "^2.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, + "node_modules/css-what": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/css-what/-/css-what-5.1.0.tgz", + "integrity": "sha512-arSMRWIIFY0hV8pIxZMEfmMI47Wj3R/aWpZDDxWYCPEiOMv6tfOrnpDtgxBYPEQD4V0Y/958+1TdC3iWTFcUPw==", + "dev": true, + "engines": { + "node": ">= 6" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, + "node_modules/cssesc": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", + "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", + "dev": true, + "bin": { + "cssesc": "bin/cssesc" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/csstype": { + "version": "3.0.10", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.10.tgz", + "integrity": "sha512-2u44ZG2OcNUO9HDp/Jl8C07x6pU/eTR3ncV91SiK3dhG9TWvRVsCoJw14Ckx5DgWkzGA3waZWO3d7pgqpUI/XA==", + "dev": true + }, + "node_modules/dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "dev": true, + "dependencies": { + "assert-plus": "^1.0.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/debounce": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/debounce/-/debounce-1.2.1.tgz", + "integrity": "sha512-XRRe6Glud4rd/ZGQfiV1ruXSfbvfJedlV9Y6zOlP+2K04vBYiJEte6stfFkCP03aMnY5tsipamumUjL14fofug==", + "dev": true + }, + "node_modules/debug": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", + "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/debuglog": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/debuglog/-/debuglog-1.0.1.tgz", + "integrity": "sha1-qiT/uaw9+aI1GDfPstJ5NgzXhJI=", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/decompress-response": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", + "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", + "dev": true, + "dependencies": { + "mimic-response": "^3.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/decompress-response/node_modules/mimic-response": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", + "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/deep-eql": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", + "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", + "dev": true, + "dependencies": { + "type-detect": "^4.0.0" + }, + "engines": { + "node": ">=0.12" + } + }, + "node_modules/deep-equal": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.0.1.tgz", + "integrity": "sha1-9dJgKStmDghO/0zbyfCK0yR0SLU=", + "dev": true + }, + "node_modules/deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "dev": true, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/deepmerge": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz", + "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/default-browser-id": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/default-browser-id/-/default-browser-id-2.0.0.tgz", + "integrity": "sha1-AezONxpx6F8VoXF354YwR+c9vn0=", + "dev": true, + "dependencies": { + "bplist-parser": "^0.1.0", + "pify": "^2.3.0", + "untildify": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/defer-to-connect": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz", + "integrity": "sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/define-lazy-prop": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz", + "integrity": "sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/defined": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/defined/-/defined-1.0.0.tgz", + "integrity": "sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM=", + "dev": true + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/delegates": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", + "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", + "dev": true + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "dev": true, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/dependency-graph": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/dependency-graph/-/dependency-graph-0.11.0.tgz", + "integrity": "sha512-JeMq7fEshyepOWDfcfHK06N3MhyPhz++vtqWhMT5O9A3K42rdsEDpfdVqjaqaAhsw6a+ZqeDvQVtD0hFHQWrzg==", + "dev": true, + "engines": { + "node": ">= 0.6.0" + } + }, + "node_modules/destroy": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.1.0.tgz", + "integrity": "sha512-R5QZrOXxSs0JDUIU/VANvRJlQVMts9C0L76HToQdPdlftfZCE7W6dyH0G4GZ5UW9fRqUOhAoCE2aGekuu+3HjQ==", + "dev": true, + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/detect-port": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/detect-port/-/detect-port-1.3.0.tgz", + "integrity": "sha512-E+B1gzkl2gqxt1IhUzwjrxBKRqx1UzC3WLONHinn8S3T6lwV/agVCyitiFOsGJ/eYuEUBvD71MZHy3Pv1G9doQ==", + "dev": true, + "dependencies": { + "address": "^1.0.1", + "debug": "^2.6.0" + }, + "bin": { + "detect": "bin/detect-port", + "detect-port": "bin/detect-port" + }, + "engines": { + "node": ">= 4.2.1" + } + }, + "node_modules/detect-port/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/detect-port/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "node_modules/detective": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/detective/-/detective-5.2.0.tgz", + "integrity": "sha512-6SsIx+nUUbuK0EthKjv0zrdnajCCXVYGmbYYiYjFVpzcjwEs/JMDZ8tPRG29J/HhN56t3GJp2cGSWDRjjot8Pg==", + "dev": true, + "dependencies": { + "acorn-node": "^1.6.1", + "defined": "^1.0.0", + "minimist": "^1.1.1" + }, + "bin": { + "detective": "bin/detective.js" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/devtools-protocol": { + "version": "0.0.948846", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.948846.tgz", + "integrity": "sha512-5fGyt9xmMqUl2VI7+rnUkKCiAQIpLns8sfQtTENy5L70ktbNw0Z3TFJ1JoFNYdx/jffz4YXU45VF75wKZD7sZQ==", + "dev": true + }, + "node_modules/dezalgo": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/dezalgo/-/dezalgo-1.0.3.tgz", + "integrity": "sha1-f3Qt4Gb8dIvI24IFad3c5Jvw1FY=", + "dev": true, + "dependencies": { + "asap": "^2.0.0", + "wrappy": "1" + } + }, + "node_modules/didyoumean": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz", + "integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==", + "dev": true + }, + "node_modules/diff": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", + "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "dependencies": { + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/dlv": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz", + "integrity": "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==", + "dev": true + }, + "node_modules/dom-accessibility-api": { + "version": "0.5.11", + "resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.11.tgz", + "integrity": "sha512-7X6GvzjYf4yTdRKuCVScV+aA9Fvh5r8WzWrXBH9w82ZWB/eYDMGCnazoC/YAqAzUJWHzLOnZqr46K3iEyUhUvw==", + "dev": true + }, + "node_modules/dom-serializer": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.3.2.tgz", + "integrity": "sha512-5c54Bk5Dw4qAxNOI1pFEizPSjVsx5+bpJKmL2kPn8JhBUq2q09tTCa3mjijun2NfK78NMouDYNMBkOrPZiS+ig==", + "dev": true, + "dependencies": { + "domelementtype": "^2.0.1", + "domhandler": "^4.2.0", + "entities": "^2.0.0" + }, + "funding": { + "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1" + } + }, + "node_modules/domelementtype": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.2.0.tgz", + "integrity": "sha512-DtBMo82pv1dFtUmHyr48beiuq792Sxohr+8Hm9zoxklYPfa6n0Z3Byjj2IV7bmr2IyqClnqEQhfgHJJ5QF0R5A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ] + }, + "node_modules/domhandler": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-4.3.0.tgz", + "integrity": "sha512-fC0aXNQXqKSFTr2wDNZDhsEYjCiYsDWl3D01kwt25hm1YIPyDGHvvi3rw+PLqHAl/m71MaiF7d5zvBr0p5UB2g==", + "dev": true, + "dependencies": { + "domelementtype": "^2.2.0" + }, + "engines": { + "node": ">= 4" + }, + "funding": { + "url": "https://github.com/fb55/domhandler?sponsor=1" + } + }, + "node_modules/domutils": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-2.8.0.tgz", + "integrity": "sha512-w96Cjofp72M5IIhpjgobBimYEfoPjx1Vx0BSX9P30WBdZW2WIKU0T1Bd0kz2eNZ9ikjKgHbEyKx8BB6H1L3h3A==", + "dev": true, + "dependencies": { + "dom-serializer": "^1.0.1", + "domelementtype": "^2.2.0", + "domhandler": "^4.2.0" + }, + "funding": { + "url": "https://github.com/fb55/domutils?sponsor=1" + } + }, + "node_modules/dotenv": { + "version": "8.6.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.6.0.tgz", + "integrity": "sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/dotenv-expand": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/dotenv-expand/-/dotenv-expand-5.1.0.tgz", + "integrity": "sha512-YXQl1DSa4/PQyRfgrv6aoNjhasp/p4qs9FjJ4q4cQk+8m4r6k4ZSiEyytKG8f8W9gi8WsQtIObNmKd+tMzNTmA==", + "dev": true + }, + "node_modules/ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "dev": true, + "dependencies": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=", + "dev": true + }, + "node_modules/electron-to-chromium": { + "version": "1.4.64", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.64.tgz", + "integrity": "sha512-8mec/99xgLUZCIZZq3wt61Tpxg55jnOSpxGYapE/1Ma9MpFEYYaz4QNYm0CM1rrnCo7i3FRHhbaWjeCLsveGjQ==", + "dev": true + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=", + "dev": true, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/encoding": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz", + "integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==", + "dev": true, + "optional": true, + "dependencies": { + "iconv-lite": "^0.6.2" + } + }, + "node_modules/encoding/node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "dev": true, + "optional": true, + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dev": true, + "dependencies": { + "once": "^1.4.0" + } + }, + "node_modules/entities": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz", + "integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==", + "dev": true, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/env-paths": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz", + "integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/err-code": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/err-code/-/err-code-2.0.3.tgz", + "integrity": "sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==", + "dev": true + }, + "node_modules/error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, + "node_modules/errorstacks": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/errorstacks/-/errorstacks-2.3.2.tgz", + "integrity": "sha512-cJp8qf5t2cXmVZJjZVrcU4ODFJeQOcUyjJEtPFtWO+3N6JPM6vCe4Sfv3cwIs/qS7gnUo/fvKX/mDCVQZq+P7A==", + "dev": true + }, + "node_modules/es-module-lexer": { + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-0.9.3.tgz", + "integrity": "sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ==", + "dev": true + }, + "node_modules/esbuild": { + "version": "0.9.7", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.9.7.tgz", + "integrity": "sha512-VtUf6aQ89VTmMLKrWHYG50uByMF4JQlVysb8dmg6cOgW8JnFCipmz7p+HNBl+RR3LLCuBxFGVauAe2wfnF9bLg==", + "dev": true, + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + } + }, + "node_modules/escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=", + "dev": true + }, + "node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/esinstall": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/esinstall/-/esinstall-1.1.7.tgz", + "integrity": "sha512-irDsrIF7fZ5BCQEAV5gmH+4nsK6JhnkI9C9VloXdmzJLbM1EcshPw8Ap95UUGc4ZJdzGeOrjV+jgKjQ/Z7Q3pg==", + "dev": true, + "dependencies": { + "@rollup/plugin-commonjs": "^16.0.0", + "@rollup/plugin-inject": "^4.0.2", + "@rollup/plugin-json": "^4.0.0", + "@rollup/plugin-node-resolve": "^10.0.0", + "@rollup/plugin-replace": "^2.4.2", + "builtin-modules": "^3.2.0", + "cjs-module-lexer": "^1.2.1", + "es-module-lexer": "^0.6.0", + "execa": "^5.1.1", + "is-valid-identifier": "^2.0.2", + "kleur": "^4.1.1", + "mkdirp": "^1.0.3", + "picomatch": "^2.3.0", + "resolve": "^1.20.0", + "rimraf": "^3.0.0", + "rollup": "~2.37.1", + "rollup-plugin-polyfill-node": "^0.6.2", + "slash": "~3.0.0", + "validate-npm-package-name": "^3.0.0", + "vm2": "^3.9.2" + } + }, + "node_modules/esinstall/node_modules/@rollup/plugin-node-resolve": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-10.0.0.tgz", + "integrity": "sha512-sNijGta8fqzwA1VwUEtTvWCx2E7qC70NMsDh4ZG13byAXYigBNZMxALhKUSycBks5gupJdq0lFrKumFrRZ8H3A==", + "dev": true, + "dependencies": { + "@rollup/pluginutils": "^3.1.0", + "@types/resolve": "1.17.1", + "builtin-modules": "^3.1.0", + "deepmerge": "^4.2.2", + "is-module": "^1.0.0", + "resolve": "^1.17.0" + }, + "engines": { + "node": ">= 10.0.0" + }, + "peerDependencies": { + "rollup": "^1.20.0||^2.0.0" + } + }, + "node_modules/esinstall/node_modules/es-module-lexer": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-0.6.0.tgz", + "integrity": "sha512-f8kcHX1ArhllUtb/wVSyvygoKCznIjnxhLxy7TCvIiMdT7fL4ZDTIKaadMe6eLvOXg6Wk02UeoFgUoZ2EKZZUA==", + "dev": true + }, + "node_modules/esinstall/node_modules/fsevents": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz", + "integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==", + "deprecated": "\"Please update to latest v2.3 or v2.2\"", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/esinstall/node_modules/rollup": { + "version": "2.37.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.37.1.tgz", + "integrity": "sha512-V3ojEeyGeSdrMSuhP3diBb06P+qV4gKQeanbDv+Qh/BZbhdZ7kHV0xAt8Yjk4GFshq/WjO7R4c7DFM20AwTFVQ==", + "dev": true, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=10.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.1.2" + } + }, + "node_modules/estree-walker": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz", + "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==", + "dev": true + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/eventemitter3": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", + "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", + "dev": true + }, + "node_modules/execa": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", + "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "dev": true + }, + "node_modules/extract-zip": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz", + "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==", + "dev": true, + "dependencies": { + "debug": "^4.1.1", + "get-stream": "^5.1.0", + "yauzl": "^2.10.0" + }, + "bin": { + "extract-zip": "cli.js" + }, + "engines": { + "node": ">= 10.17.0" + }, + "optionalDependencies": { + "@types/yauzl": "^2.9.1" + } + }, + "node_modules/extract-zip/node_modules/get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "dev": true, + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", + "dev": true, + "engines": [ + "node >=0.6.0" + ] + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "node_modules/fast-glob": { + "version": "3.2.11", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", + "integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "node_modules/fastq": { + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", + "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", + "dev": true, + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/fd-slicer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", + "integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=", + "dev": true, + "dependencies": { + "pend": "~1.2.0" + } + }, + "node_modules/fdir": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-5.2.0.tgz", + "integrity": "sha512-skyI2Laxtj9GYzmktPgY6DT8uswXq+VoxH26SskykvEhTSbi7tRM/787uZt/p8maxrQCJdzC90zX1btbxiJ6lw==", + "dev": true + }, + "node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-cache-dir": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.2.tgz", + "integrity": "sha512-wXZV5emFEjrridIgED11OoUKLxiYjAcqot/NJdAkOhlJ+vGzwhOAfcG5OX1jP+S0PcjEn8bdMJv+g2jwQ3Onig==", + "dev": true, + "dependencies": { + "commondir": "^1.0.1", + "make-dir": "^3.0.2", + "pkg-dir": "^4.1.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/avajs/find-cache-dir?sponsor=1" + } + }, + "node_modules/find-replace": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-replace/-/find-replace-3.0.0.tgz", + "integrity": "sha512-6Tb2myMioCAgv5kfvP5/PkZZ/ntTpVK39fHY7WkWBgvbeE+VHd/tZuZ4mrC+bxh4cfOZeYKVPaJIZtZXV7GNCQ==", + "dev": true, + "dependencies": { + "array-back": "^3.0.1" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/form-data": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "dev": true, + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 0.12" + } + }, + "node_modules/fraction.js": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.1.2.tgz", + "integrity": "sha512-o2RiJQ6DZaR/5+Si0qJUIy637QMRudSi9kU/FFzx9EZazrIdnBgpU+3sEWCxAVhH2RtxW2Oz+T4p2o8uOPVcgA==", + "dev": true, + "engines": { + "node": "*" + }, + "funding": { + "type": "patreon", + "url": "https://www.patreon.com/infusion" + } + }, + "node_modules/fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fs-constants": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", + "dev": true + }, + "node_modules/fs-minipass": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", + "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", + "dev": true, + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "node_modules/gauge": { + "version": "2.7.4", + "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", + "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", + "dev": true, + "dependencies": { + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" + } + }, + "node_modules/gauge/node_modules/ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/gauge/node_modules/strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "dependencies": { + "ansi-regex": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/generic-names": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/generic-names/-/generic-names-4.0.0.tgz", + "integrity": "sha512-ySFolZQfw9FoDb3ed9d80Cm9f0+r7qj+HJkWjeD9RBfpxEVTlVhol+gvaQB/78WbwYfbnNh8nWHHBSlg072y6A==", + "dev": true, + "dependencies": { + "loader-utils": "^3.2.0" + } + }, + "node_modules/gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/get-func-name": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", + "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/get-intrinsic": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", + "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "dev": true, + "dependencies": { + "assert-plus": "^1.0.0" + } + }, + "node_modules/glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/globby": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "dev": true, + "dependencies": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/got": { + "version": "11.8.3", + "resolved": "https://registry.npmjs.org/got/-/got-11.8.3.tgz", + "integrity": "sha512-7gtQ5KiPh1RtGS9/Jbv1ofDpBFuq42gyfEib+ejaRBJuj/3tQFeR5+gw57e4ipaU8c/rCjvX6fkQz2lyDlGAOg==", + "dev": true, + "dependencies": { + "@sindresorhus/is": "^4.0.0", + "@szmarczak/http-timer": "^4.0.5", + "@types/cacheable-request": "^6.0.1", + "@types/responselike": "^1.0.0", + "cacheable-lookup": "^5.0.3", + "cacheable-request": "^7.0.2", + "decompress-response": "^6.0.0", + "http2-wrapper": "^1.0.0-beta.5.2", + "lowercase-keys": "^2.0.0", + "p-cancelable": "^2.0.0", + "responselike": "^2.0.0" + }, + "engines": { + "node": ">=10.19.0" + }, + "funding": { + "url": "https://github.com/sindresorhus/got?sponsor=1" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.9", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz", + "integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==", + "dev": true + }, + "node_modules/har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/har-validator": { + "version": "5.1.5", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz", + "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==", + "deprecated": "this library is no longer supported", + "dev": true, + "dependencies": { + "ajv": "^6.12.3", + "har-schema": "^2.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/has-symbols": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", + "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", + "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", + "dev": true, + "dependencies": { + "has-symbols": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-unicode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", + "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", + "dev": true + }, + "node_modules/hosted-git-info": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.1.0.tgz", + "integrity": "sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", + "dev": true + }, + "node_modules/htmlparser2": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-6.1.0.tgz", + "integrity": "sha512-gyyPk6rgonLFEDGoeRgQNaEUvdJ4ktTmmUh/h2t7s+M8oPpIPxgNACWa+6ESR57kXstwqPiCut0V8NRpcwgU7A==", + "dev": true, + "funding": [ + "https://github.com/fb55/htmlparser2?sponsor=1", + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ], + "dependencies": { + "domelementtype": "^2.0.1", + "domhandler": "^4.0.0", + "domutils": "^2.5.2", + "entities": "^2.0.0" + } + }, + "node_modules/http-assert": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/http-assert/-/http-assert-1.5.0.tgz", + "integrity": "sha512-uPpH7OKX4H25hBmU6G1jWNaqJGpTXxey+YOUizJUAgu0AjLUeC8D73hTrhvDS5D+GJN1DN1+hhc/eF/wpxtp0w==", + "dev": true, + "dependencies": { + "deep-equal": "~1.0.1", + "http-errors": "~1.8.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/http-cache-semantics": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz", + "integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==", + "dev": true + }, + "node_modules/http-errors": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.8.1.tgz", + "integrity": "sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g==", + "dev": true, + "dependencies": { + "depd": "~1.1.2", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": ">= 1.5.0 < 2", + "toidentifier": "1.0.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/http-errors/node_modules/depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/http-proxy-agent": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz", + "integrity": "sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==", + "dev": true, + "dependencies": { + "@tootallnate/once": "1", + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "dev": true, + "dependencies": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + }, + "engines": { + "node": ">=0.8", + "npm": ">=1.3.7" + } + }, + "node_modules/http2-wrapper": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-1.0.3.tgz", + "integrity": "sha512-V+23sDMr12Wnz7iTcDeJr3O6AIxlnvT/bmaAAAP/Xda35C90p9599p0F1eHR/N1KILWSoWVAiOMFjBBXaXSMxg==", + "dev": true, + "dependencies": { + "quick-lru": "^5.1.1", + "resolve-alpn": "^1.0.0" + }, + "engines": { + "node": ">=10.19.0" + } + }, + "node_modules/httpie": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/httpie/-/httpie-1.1.2.tgz", + "integrity": "sha512-VQ82oXG95oY1fQw/XecHuvcFBA+lZQ9Vwj1RfLcO8a7HpDd4cc2ukwpJt+TUlFaLUAzZErylxWu6wclJ1rUhUQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/https-proxy-agent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz", + "integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==", + "dev": true, + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/human-signals": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", + "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", + "dev": true, + "engines": { + "node": ">=10.17.0" + } + }, + "node_modules/humanize-ms": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", + "integrity": "sha1-xG4xWaKT9riW2ikxbYtv6Lt5u+0=", + "dev": true, + "dependencies": { + "ms": "^2.0.0" + } + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/icss-replace-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/icss-replace-symbols/-/icss-replace-symbols-1.1.0.tgz", + "integrity": "sha1-Bupvg2ead0njhs/h/oEq5dsiPe0=", + "dev": true + }, + "node_modules/icss-utils": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/icss-utils/-/icss-utils-5.1.0.tgz", + "integrity": "sha512-soFhflCVWLfRNOPU3iv5Z9VUdT44xFRbzjLsEzSr5AQmgqPMTHdU3PMT1Cf1ssx8fLNJDA1juftYl+PUcv3MqA==", + "dev": true, + "engines": { + "node": "^10 || ^12 || >= 14" + }, + "peerDependencies": { + "postcss": "^8.1.0" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/ignore": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", + "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/ignore-walk": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.4.tgz", + "integrity": "sha512-PY6Ii8o1jMRA1z4F2hRkH/xN59ox43DavKvD3oDpfurRlOJyAHpifIwpbdv1n4jt4ov0jSpw3kQ4GhJnpBL6WQ==", + "dev": true, + "dependencies": { + "minimatch": "^3.0.4" + } + }, + "node_modules/import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/import-fresh/node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true, + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/indent-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", + "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/infer-owner": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/infer-owner/-/infer-owner-1.0.4.tgz", + "integrity": "sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A==", + "dev": true + }, + "node_modules/inflation": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/inflation/-/inflation-2.0.0.tgz", + "integrity": "sha1-i0F+R8KPklpFEz2RTKH9OJEH8w8=", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "node_modules/ip": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", + "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=", + "dev": true + }, + "node_modules/is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-core-module": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.1.tgz", + "integrity": "sha512-SdNCUs284hr40hFTFP6l0IfZ/RSrMXF3qgoRHd3/79unUTvrFO/JoXwkGm+5J/Oe3E/b5GsnG330uUNgRpu1PA==", + "dev": true, + "dependencies": { + "has": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-docker": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", + "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", + "dev": true, + "bin": { + "is-docker": "cli.js" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-generator-function": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", + "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", + "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-lambda": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-lambda/-/is-lambda-1.0.1.tgz", + "integrity": "sha1-PZh3iZ5qU+/AFgUEzeFfgubwYdU=", + "dev": true + }, + "node_modules/is-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", + "integrity": "sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE=", + "dev": true + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-plain-object": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", + "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-reference": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz", + "integrity": "sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==", + "dev": true, + "dependencies": { + "@types/estree": "*" + } + }, + "node_modules/is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", + "dev": true + }, + "node_modules/is-valid-identifier": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-valid-identifier/-/is-valid-identifier-2.0.2.tgz", + "integrity": "sha512-mpS5EGqXOwzXtKAg6I44jIAqeBfntFLxpAth1rrKbxtKyI6LPktyDYpHBI+tHlduhhX/SF26mFXmxQu995QVqg==", + "dev": true, + "dependencies": { + "assert": "^1.4.1" + } + }, + "node_modules/is-wsl": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", + "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", + "dev": true, + "dependencies": { + "is-docker": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "node_modules/isbinaryfile": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-4.0.8.tgz", + "integrity": "sha512-53h6XFniq77YdW+spoRrebh0mnmTxRPTlcuIArO57lmMdq4uBKFKaeTjnb92oYWrSn/LVL+LT+Hap2tFQj8V+w==", + "dev": true, + "engines": { + "node": ">= 8.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/gjtorikian/" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "node_modules/isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", + "dev": true + }, + "node_modules/istanbul-lib-coverage": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz", + "integrity": "sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-report": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", + "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==", + "dev": true, + "dependencies": { + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^3.0.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-report/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-report/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-reports": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.3.tgz", + "integrity": "sha512-x9LtDVtfm/t1GFiLl3NffC7hz+I1ragvgX1P/Lg1NlIagifZDKUkuuaAxH/qpwj2IuEfD8G2Bs/UKp+sZ/pKkg==", + "dev": true, + "dependencies": { + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + }, + "node_modules/jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "dev": true + }, + "node_modules/jsesc": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", + "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", + "dev": true, + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true + }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true + }, + "node_modules/json-schema": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz", + "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==", + "dev": true + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "node_modules/json-stringify-nice": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/json-stringify-nice/-/json-stringify-nice-1.1.4.tgz", + "integrity": "sha512-5Z5RFW63yxReJ7vANgW6eZFGWaQvnPE3WNmZoOJrSkGju2etKA2L5rrOa1sm877TVTFt57A80BH1bArcmlLfPw==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", + "dev": true + }, + "node_modules/json5": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz", + "integrity": "sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==", + "dev": true, + "dependencies": { + "minimist": "^1.2.5" + }, + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/jsonparse": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", + "integrity": "sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA=", + "dev": true, + "engines": [ + "node >= 0.2.0" + ] + }, + "node_modules/jsonschema": { + "version": "1.2.11", + "resolved": "https://registry.npmjs.org/jsonschema/-/jsonschema-1.2.11.tgz", + "integrity": "sha512-XNZHs3N1IOa3lPKm//npxMhOdaoPw+MvEV0NIgxcER83GTJcG13rehtWmpBCfEt8DrtYwIkMTs8bdXoYs4fvnQ==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/jsprim": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz", + "integrity": "sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==", + "dev": true, + "dependencies": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.4.0", + "verror": "1.10.0" + }, + "engines": { + "node": ">=0.6.0" + } + }, + "node_modules/just-diff": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/just-diff/-/just-diff-3.1.1.tgz", + "integrity": "sha512-sdMWKjRq8qWZEjDcVA6llnUT8RDEBIfOiGpYFPYa9u+2c39JCsejktSP7mj5eRid5EIvTzIpQ2kDOCw1Nq9BjQ==", + "dev": true + }, + "node_modules/just-diff-apply": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/just-diff-apply/-/just-diff-apply-3.1.2.tgz", + "integrity": "sha512-TCa7ZdxCeq6q3Rgms2JCRHTCfWAETPZ8SzYUbkYF6KR3I03sN29DaOIC+xyWboIcMvjAsD5iG2u/RWzHD8XpgQ==", + "dev": true + }, + "node_modules/keygrip": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/keygrip/-/keygrip-1.1.0.tgz", + "integrity": "sha512-iYSchDJ+liQ8iwbSI2QqsQOvqv58eJCEanyJPJi+Khyu8smkcKSFUCbPwzFcL7YVtZ6eONjqRX/38caJ7QjRAQ==", + "dev": true, + "dependencies": { + "tsscmp": "1.0.6" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/keyv": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.1.0.tgz", + "integrity": "sha512-YsY3wr6HabE11/sscee+3nZ03XjvkrPWGouAmJFBdZoK92wiOlJCzI5/sDEIKdJhdhHO144ei45U9gXfbu14Uw==", + "dev": true, + "dependencies": { + "json-buffer": "3.0.1" + } + }, + "node_modules/kleur": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.4.tgz", + "integrity": "sha512-8QADVssbrFjivHWQU7KkMgptGTl6WAcSdlbBPY4uNF+mWr6DGcKrvY2w4FQJoXch7+fKMjj0dRrL75vk3k23OA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/koa": { + "version": "2.13.4", + "resolved": "https://registry.npmjs.org/koa/-/koa-2.13.4.tgz", + "integrity": "sha512-43zkIKubNbnrULWlHdN5h1g3SEKXOEzoAlRsHOTFpnlDu8JlAOZSMJBLULusuXRequboiwJcj5vtYXKB3k7+2g==", + "dev": true, + "dependencies": { + "accepts": "^1.3.5", + "cache-content-type": "^1.0.0", + "content-disposition": "~0.5.2", + "content-type": "^1.0.4", + "cookies": "~0.8.0", + "debug": "^4.3.2", + "delegates": "^1.0.0", + "depd": "^2.0.0", + "destroy": "^1.0.4", + "encodeurl": "^1.0.2", + "escape-html": "^1.0.3", + "fresh": "~0.5.2", + "http-assert": "^1.3.0", + "http-errors": "^1.6.3", + "is-generator-function": "^1.0.7", + "koa-compose": "^4.1.0", + "koa-convert": "^2.0.0", + "on-finished": "^2.3.0", + "only": "~0.0.2", + "parseurl": "^1.3.2", + "statuses": "^1.5.0", + "type-is": "^1.6.16", + "vary": "^1.1.2" + }, + "engines": { + "node": "^4.8.4 || ^6.10.1 || ^7.10.1 || >= 8.1.4" + } + }, + "node_modules/koa-compose": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/koa-compose/-/koa-compose-4.1.0.tgz", + "integrity": "sha512-8ODW8TrDuMYvXRwra/Kh7/rJo9BtOfPc6qO8eAfC80CnCvSjSl0bkRM24X6/XBBEyj0v1nRUQ1LyOy3dbqOWXw==", + "dev": true + }, + "node_modules/koa-convert": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/koa-convert/-/koa-convert-2.0.0.tgz", + "integrity": "sha512-asOvN6bFlSnxewce2e/DK3p4tltyfC4VM7ZwuTuepI7dEQVcvpyFuBcEARu1+Hxg8DIwytce2n7jrZtRlPrARA==", + "dev": true, + "dependencies": { + "co": "^4.6.0", + "koa-compose": "^4.1.0" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/koa-etag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/koa-etag/-/koa-etag-4.0.0.tgz", + "integrity": "sha512-1cSdezCkBWlyuB9l6c/IFoe1ANCDdPBxkDkRiaIup40xpUub6U/wwRXoKBZw/O5BifX9OlqAjYnDyzM6+l+TAg==", + "dev": true, + "dependencies": { + "etag": "^1.8.1" + } + }, + "node_modules/koa-send": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/koa-send/-/koa-send-5.0.1.tgz", + "integrity": "sha512-tmcyQ/wXXuxpDxyNXv5yNNkdAMdFRqwtegBXUaowiQzUKqJehttS0x2j0eOZDQAyloAth5w6wwBImnFzkUz3pQ==", + "dev": true, + "dependencies": { + "debug": "^4.1.1", + "http-errors": "^1.7.3", + "resolve-path": "^1.4.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/koa-static": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/koa-static/-/koa-static-5.0.0.tgz", + "integrity": "sha512-UqyYyH5YEXaJrf9S8E23GoJFQZXkBVJ9zYYMPGz919MSX1KuvAcycIuS0ci150HCoPf4XQVhQ84Qf8xRPWxFaQ==", + "dev": true, + "dependencies": { + "debug": "^3.1.0", + "koa-send": "^5.0.0" + }, + "engines": { + "node": ">= 7.6.0" + } + }, + "node_modules/koa-static/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/lighthouse-logger": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/lighthouse-logger/-/lighthouse-logger-1.3.0.tgz", + "integrity": "sha512-BbqAKApLb9ywUli+0a+PcV04SyJ/N1q/8qgCNe6U97KbPCS1BTksEuHFLYdvc8DltuhfxIUBqDZsC0bBGtl3lA==", + "dev": true, + "dependencies": { + "debug": "^2.6.9", + "marky": "^1.2.2" + } + }, + "node_modules/lighthouse-logger/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/lighthouse-logger/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "node_modules/lilconfig": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.0.4.tgz", + "integrity": "sha512-bfTIN7lEsiooCocSISTWXkiWJkRqtL9wYtYy+8EK3Y41qh3mpwPU0ycTOgjdY9ErwXCc8QyrQp82bdL0Xkm9yA==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "dev": true + }, + "node_modules/loader-utils": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-3.2.0.tgz", + "integrity": "sha512-HVl9ZqccQihZ7JM85dco1MvO9G+ONvxoGa9rkhzFsneGLKSUg1gJf9bWzhRhcvm2qChhWpebQhP44qxjKIUCaQ==", + "dev": true, + "engines": { + "node": ">= 12.13.0" + } + }, + "node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true + }, + "node_modules/lodash.camelcase": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", + "integrity": "sha1-soqmKIorn8ZRA1x3EfZathkDMaY=", + "dev": true + }, + "node_modules/log-update": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/log-update/-/log-update-4.0.0.tgz", + "integrity": "sha512-9fkkDevMefjg0mmzWFBW8YkFP91OrizzkW3diF7CpG+S2EYdy4+TVfGwz1zeF8x7hCx1ovSPTOE9Ngib74qqUg==", + "dev": true, + "dependencies": { + "ansi-escapes": "^4.3.0", + "cli-cursor": "^3.1.0", + "slice-ansi": "^4.0.0", + "wrap-ansi": "^6.2.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "dependencies": { + "js-tokens": "^3.0.0 || ^4.0.0" + }, + "bin": { + "loose-envify": "cli.js" + } + }, + "node_modules/loupe": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.2.tgz", + "integrity": "sha512-QgVamnvj0jX1LMPlCAq0MK6hATORFtGqHoUKXTkwNe13BqlN6aePQCKnnTcFvdDYEEITcJ+gBl4mTW7YJtJbyQ==", + "dev": true, + "dependencies": { + "get-func-name": "^2.0.0" + } + }, + "node_modules/lowercase-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", + "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/lz-string": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.4.4.tgz", + "integrity": "sha1-wNjq82BZ9wV5bh40SBHPTEmNOiY=", + "dev": true, + "bin": { + "lz-string": "bin/bin.js" + } + }, + "node_modules/magic-string": { + "version": "0.25.7", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.7.tgz", + "integrity": "sha512-4CrMT5DOHTDk4HYDlzmwu4FVCcIYI8gauveasrdCu2IKIFOJ3f0v/8MDGJCDL9oD2ppz/Av1b0Nj345H9M+XIA==", + "dev": true, + "dependencies": { + "sourcemap-codec": "^1.4.4" + } + }, + "node_modules/make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "dev": true, + "dependencies": { + "semver": "^6.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/make-fetch-happen": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-9.1.0.tgz", + "integrity": "sha512-+zopwDy7DNknmwPQplem5lAZX/eCOzSvSNNcSKm5eVwTkOBzoktEfXsa9L23J/GIRhxRsaxzkPEhrJEpE2F4Gg==", + "dev": true, + "dependencies": { + "agentkeepalive": "^4.1.3", + "cacache": "^15.2.0", + "http-cache-semantics": "^4.1.0", + "http-proxy-agent": "^4.0.1", + "https-proxy-agent": "^5.0.0", + "is-lambda": "^1.0.1", + "lru-cache": "^6.0.0", + "minipass": "^3.1.3", + "minipass-collect": "^1.0.2", + "minipass-fetch": "^1.3.2", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.4", + "negotiator": "^0.6.2", + "promise-retry": "^2.0.1", + "socks-proxy-agent": "^6.0.0", + "ssri": "^8.0.0" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/marky": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/marky/-/marky-1.2.2.tgz", + "integrity": "sha512-k1dB2HNeaNyORco8ulVEhctyEGkKHb2YWAhDsxeFlW2nROIirsctBYzKwwS3Vza+sKTS1zO4Z+n9/+9WbGLIxQ==", + "dev": true + }, + "node_modules/media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/meriyah": { + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/meriyah/-/meriyah-3.1.6.tgz", + "integrity": "sha512-JDOSi6DIItDc33U5N52UdV6P8v+gn+fqZKfbAfHzdWApRQyQWdcvxPvAr9t01bI2rBxGvSrKRQSCg3SkZC1qeg==", + "dev": true, + "engines": { + "node": ">=10.4.0" + } + }, + "node_modules/micromatch": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz", + "integrity": "sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg==", + "dev": true, + "dependencies": { + "braces": "^3.0.1", + "picomatch": "^2.2.3" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/mime-db": { + "version": "1.51.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.51.0.tgz", + "integrity": "sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.34", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.34.tgz", + "integrity": "sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A==", + "dev": true, + "dependencies": { + "mime-db": "1.51.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/mini-svg-data-uri": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/mini-svg-data-uri/-/mini-svg-data-uri-1.4.3.tgz", + "integrity": "sha512-gSfqpMRC8IxghvMcxzzmMnWpXAChSA+vy4cia33RgerMS8Fex95akUyQZPbxJJmeBGiGmK7n/1OpUX8ksRjIdA==", + "dev": true, + "bin": { + "mini-svg-data-uri": "cli.js" + } + }, + "node_modules/minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "dev": true + }, + "node_modules/minipass": { + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.1.6.tgz", + "integrity": "sha512-rty5kpw9/z8SX9dmxblFA6edItUmwJgMeYDZRrwlIVN27i8gysGbznJwUggw2V/FVqFSDdWy040ZPS811DYAqQ==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/minipass-collect": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/minipass-collect/-/minipass-collect-1.0.2.tgz", + "integrity": "sha512-6T6lH0H8OG9kITm/Jm6tdooIbogG9e0tLgpY6mphXSm/A9u8Nq1ryBG+Qspiub9LjWlBPsPS3tWQ/Botq4FdxA==", + "dev": true, + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/minipass-fetch": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-1.4.1.tgz", + "integrity": "sha512-CGH1eblLq26Y15+Azk7ey4xh0J/XfJfrCox5LDJiKqI2Q2iwOLOKrlmIaODiSQS8d18jalF6y2K2ePUm0CmShw==", + "dev": true, + "dependencies": { + "minipass": "^3.1.0", + "minipass-sized": "^1.0.3", + "minizlib": "^2.0.0" + }, + "engines": { + "node": ">=8" + }, + "optionalDependencies": { + "encoding": "^0.1.12" + } + }, + "node_modules/minipass-flush": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/minipass-flush/-/minipass-flush-1.0.5.tgz", + "integrity": "sha512-JmQSYYpPUqX5Jyn1mXaRwOda1uQ8HP5KAT/oDSLCzt1BYRhQU0/hDtsB1ufZfEEzMZ9aAVmsBw8+FWsIXlClWw==", + "dev": true, + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/minipass-json-stream": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minipass-json-stream/-/minipass-json-stream-1.0.1.tgz", + "integrity": "sha512-ODqY18UZt/I8k+b7rl2AENgbWE8IDYam+undIJONvigAz8KR5GWblsFTEfQs0WODsjbSXWlm+JHEv8Gr6Tfdbg==", + "dev": true, + "dependencies": { + "jsonparse": "^1.3.1", + "minipass": "^3.0.0" + } + }, + "node_modules/minipass-pipeline": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/minipass-pipeline/-/minipass-pipeline-1.2.4.tgz", + "integrity": "sha512-xuIq7cIOt09RPRJ19gdi4b+RiNvDFYe5JH+ggNvBqGqpQXcru3PcRmOZuHBKWK1Txf9+cQ+HMVN4d6z46LZP7A==", + "dev": true, + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/minipass-sized": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/minipass-sized/-/minipass-sized-1.0.3.tgz", + "integrity": "sha512-MbkQQ2CTiBMlA2Dm/5cY+9SWFEN8pzzOXi6rlM5Xxq0Yqbda5ZQy9sU75a673FE9ZK0Zsbr6Y5iP6u9nktfg2g==", + "dev": true, + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/minizlib": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz", + "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", + "dev": true, + "dependencies": { + "minipass": "^3.0.0", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "dev": true, + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/mkdirp-classic": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", + "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==", + "dev": true + }, + "node_modules/mkdirp-infer-owner": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mkdirp-infer-owner/-/mkdirp-infer-owner-2.0.0.tgz", + "integrity": "sha512-sdqtiFt3lkOaYvTXSRIUjkIdPTcxgv5+fgqYE/5qgwdw12cOrAuzzgzvVExIkH/ul1oeHN3bCLOWSG3XOqbKKw==", + "dev": true, + "dependencies": { + "chownr": "^2.0.0", + "infer-owner": "^1.0.4", + "mkdirp": "^1.0.3" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/nanocolors": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/nanocolors/-/nanocolors-0.2.13.tgz", + "integrity": "sha512-0n3mSAQLPpGLV9ORXT5+C/D4mwew7Ebws69Hx4E2sgz2ZA5+32Q80B9tL8PbL7XHnRDiAxH/pnrUJ9a4fkTNTA==", + "dev": true + }, + "node_modules/nanoid": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.2.0.tgz", + "integrity": "sha512-fmsZYa9lpn69Ad5eDn7FMcnnSR+8R34W9qJEijxYhTbfOWzr22n1QxCMzXLK+ODyW2973V3Fux959iQoUxzUIA==", + "dev": true, + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/negotiator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/node-fetch": { + "version": "2.6.7", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", + "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "dev": true, + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/node-fetch/node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=", + "dev": true + }, + "node_modules/node-fetch/node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=", + "dev": true + }, + "node_modules/node-fetch/node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", + "dev": true, + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "node_modules/node-gyp": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-7.1.2.tgz", + "integrity": "sha512-CbpcIo7C3eMu3dL1c3d0xw449fHIGALIJsRP4DDPHpyiW8vcriNY7ubh9TE4zEKfSxscY7PjeFnshE7h75ynjQ==", + "dev": true, + "dependencies": { + "env-paths": "^2.2.0", + "glob": "^7.1.4", + "graceful-fs": "^4.2.3", + "nopt": "^5.0.0", + "npmlog": "^4.1.2", + "request": "^2.88.2", + "rimraf": "^3.0.2", + "semver": "^7.3.2", + "tar": "^6.0.2", + "which": "^2.0.2" + }, + "bin": { + "node-gyp": "bin/node-gyp.js" + }, + "engines": { + "node": ">= 10.12.0" + } + }, + "node_modules/node-gyp-build": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.3.0.tgz", + "integrity": "sha512-iWjXZvmboq0ja1pUGULQBexmxq8CV4xBhX7VDOTbL7ZR4FOowwY/VOtRxBN/yKxmdGoIp4j5ysNT4u3S2pDQ3Q==", + "dev": true, + "bin": { + "node-gyp-build": "bin.js", + "node-gyp-build-optional": "optional.js", + "node-gyp-build-test": "build-test.js" + } + }, + "node_modules/node-gyp/node_modules/semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/node-releases": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.1.tgz", + "integrity": "sha512-CqyzN6z7Q6aMeF/ktcMVTzhAHCEpf8SOarwpzpf8pNBY2k5/oM34UHldUwp8VKI7uxct2HxSRdJjBaZeESzcxA==", + "dev": true + }, + "node_modules/nopt": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz", + "integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==", + "dev": true, + "dependencies": { + "abbrev": "1" + }, + "bin": { + "nopt": "bin/nopt.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/normalize-range": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/normalize-range/-/normalize-range-0.1.2.tgz", + "integrity": "sha1-LRDAa9/TEuqXd2laTShDlFa3WUI=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/normalize-url": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-6.1.0.tgz", + "integrity": "sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/npm-bundled": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.1.2.tgz", + "integrity": "sha512-x5DHup0SuyQcmL3s7Rx/YQ8sbw/Hzg0rj48eN0dV7hf5cmQq5PXIeioroH3raV1QC1yh3uTYuMThvEQF3iKgGQ==", + "dev": true, + "dependencies": { + "npm-normalize-package-bin": "^1.0.1" + } + }, + "node_modules/npm-install-checks": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/npm-install-checks/-/npm-install-checks-4.0.0.tgz", + "integrity": "sha512-09OmyDkNLYwqKPOnbI8exiOZU2GVVmQp7tgez2BPi5OZC8M82elDAps7sxC4l//uSUtotWqoEIDwjRvWH4qz8w==", + "dev": true, + "dependencies": { + "semver": "^7.1.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/npm-install-checks/node_modules/semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/npm-normalize-package-bin": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/npm-normalize-package-bin/-/npm-normalize-package-bin-1.0.1.tgz", + "integrity": "sha512-EPfafl6JL5/rU+ot6P3gRSCpPDW5VmIzX959Ob1+ySFUuuYHWHekXpwdUZcKP5C+DS4GEtdJluwBjnsNDl+fSA==", + "dev": true + }, + "node_modules/npm-package-arg": { + "version": "8.1.5", + "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-8.1.5.tgz", + "integrity": "sha512-LhgZrg0n0VgvzVdSm1oiZworPbTxYHUJCgtsJW8mGvlDpxTM1vSJc3m5QZeUkhAHIzbz3VCHd/R4osi1L1Tg/Q==", + "dev": true, + "dependencies": { + "hosted-git-info": "^4.0.1", + "semver": "^7.3.4", + "validate-npm-package-name": "^3.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/npm-package-arg/node_modules/semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/npm-packlist": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-2.2.2.tgz", + "integrity": "sha512-Jt01acDvJRhJGthnUJVF/w6gumWOZxO7IkpY/lsX9//zqQgnF7OJaxgQXcerd4uQOLu7W5bkb4mChL9mdfm+Zg==", + "dev": true, + "dependencies": { + "glob": "^7.1.6", + "ignore-walk": "^3.0.3", + "npm-bundled": "^1.1.1", + "npm-normalize-package-bin": "^1.0.1" + }, + "bin": { + "npm-packlist": "bin/index.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/npm-pick-manifest": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/npm-pick-manifest/-/npm-pick-manifest-6.1.1.tgz", + "integrity": "sha512-dBsdBtORT84S8V8UTad1WlUyKIY9iMsAmqxHbLdeEeBNMLQDlDWWra3wYUx9EBEIiG/YwAy0XyNHDd2goAsfuA==", + "dev": true, + "dependencies": { + "npm-install-checks": "^4.0.0", + "npm-normalize-package-bin": "^1.0.1", + "npm-package-arg": "^8.1.2", + "semver": "^7.3.4" + } + }, + "node_modules/npm-pick-manifest/node_modules/semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/npm-registry-fetch": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/npm-registry-fetch/-/npm-registry-fetch-11.0.0.tgz", + "integrity": "sha512-jmlgSxoDNuhAtxUIG6pVwwtz840i994dL14FoNVZisrmZW5kWd63IUTNv1m/hyRSGSqWjCUp/YZlS1BJyNp9XA==", + "dev": true, + "dependencies": { + "make-fetch-happen": "^9.0.1", + "minipass": "^3.1.3", + "minipass-fetch": "^1.3.0", + "minipass-json-stream": "^1.0.1", + "minizlib": "^2.0.0", + "npm-package-arg": "^8.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dev": true, + "dependencies": { + "path-key": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npmlog": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", + "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", + "dev": true, + "dependencies": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + } + }, + "node_modules/nth-check": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.0.1.tgz", + "integrity": "sha512-it1vE95zF6dTT9lBsYbxvqh0Soy4SPowchj0UBGj/V6cTPnXXtQOPUbhZ6CmGzAD/rW22LQK6E96pcdJXk4A4w==", + "dev": true, + "dependencies": { + "boolbase": "^1.0.0" + }, + "funding": { + "url": "https://github.com/fb55/nth-check?sponsor=1" + } + }, + "node_modules/number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-hash": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/object-hash/-/object-hash-2.2.0.tgz", + "integrity": "sha512-gScRMn0bS5fH+IuwyIFgnh9zBdo4DV+6GhygmWM9HyNJSgS0hScp1f5vjtm7oIIOiT9trXrShAkLFSc2IqKNgw==", + "dev": true, + "engines": { + "node": ">= 6" + } + }, + "node_modules/object-inspect": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.0.tgz", + "integrity": "sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/on-finished": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", + "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", + "dev": true, + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/only": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/only/-/only-0.0.2.tgz", + "integrity": "sha1-Kv3oTQPlC5qO3EROMGEKcCle37Q=", + "dev": true + }, + "node_modules/open": { + "version": "8.4.0", + "resolved": "https://registry.npmjs.org/open/-/open-8.4.0.tgz", + "integrity": "sha512-XgFPPM+B28FtCCgSb9I+s9szOC1vZRSwgWsRUA5ylIxRTgKozqjOCrVOqGsYABPYK5qnfqClxZTFBa8PKt2v6Q==", + "dev": true, + "dependencies": { + "define-lazy-prop": "^2.0.0", + "is-docker": "^2.1.1", + "is-wsl": "^2.2.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/p-cancelable": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-2.1.1.tgz", + "integrity": "sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-finally": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-map": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz", + "integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==", + "dev": true, + "dependencies": { + "aggregate-error": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-queue": { + "version": "6.6.2", + "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-6.6.2.tgz", + "integrity": "sha512-RwFpb72c/BhQLEXIZ5K2e+AhgNVmIejGlTgiB9MzZ0e93GRvqZ7uSi0dvRF7/XIXDeNkra2fNHBxTyPDGySpjQ==", + "dev": true, + "dependencies": { + "eventemitter3": "^4.0.4", + "p-timeout": "^3.2.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-timeout": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-3.2.0.tgz", + "integrity": "sha512-rhIwUycgwwKcP9yTOOFK/AKsAopjjCakVqLHePO3CC6Mir1Z99xT+R63jZxAT5lFZLa2inS5h+ZS2GvR99/FBg==", + "dev": true, + "dependencies": { + "p-finally": "^1.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/pacote": { + "version": "11.3.5", + "resolved": "https://registry.npmjs.org/pacote/-/pacote-11.3.5.tgz", + "integrity": "sha512-fT375Yczn4zi+6Hkk2TBe1x1sP8FgFsEIZ2/iWaXY2r/NkhDJfxbcn5paz1+RTFCyNf+dPnaoBDJoAxXSU8Bkg==", + "dev": true, + "dependencies": { + "@npmcli/git": "^2.1.0", + "@npmcli/installed-package-contents": "^1.0.6", + "@npmcli/promise-spawn": "^1.2.0", + "@npmcli/run-script": "^1.8.2", + "cacache": "^15.0.5", + "chownr": "^2.0.0", + "fs-minipass": "^2.1.0", + "infer-owner": "^1.0.4", + "minipass": "^3.1.3", + "mkdirp": "^1.0.3", + "npm-package-arg": "^8.0.1", + "npm-packlist": "^2.1.4", + "npm-pick-manifest": "^6.0.0", + "npm-registry-fetch": "^11.0.0", + "promise-retry": "^2.0.1", + "read-package-json-fast": "^2.0.1", + "rimraf": "^3.0.2", + "ssri": "^8.0.1", + "tar": "^6.1.0" + }, + "bin": { + "pacote": "lib/bin.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/parse-conflict-json": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/parse-conflict-json/-/parse-conflict-json-1.1.1.tgz", + "integrity": "sha512-4gySviBiW5TRl7XHvp1agcS7SOe0KZOjC//71dzZVWJrY9hCrgtvl5v3SyIxCZ4fZF47TxD9nfzmxcx76xmbUw==", + "dev": true, + "dependencies": { + "json-parse-even-better-errors": "^2.3.0", + "just-diff": "^3.0.1", + "just-diff-apply": "^3.0.0" + } + }, + "node_modules/parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/parse5": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz", + "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==", + "dev": true + }, + "node_modules/parse5-htmlparser2-tree-adapter": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-6.0.1.tgz", + "integrity": "sha512-qPuWvbLgvDGilKc5BoicRovlT4MtYT6JfJyBOMDsKoiT+GiuP5qyrPCnR9HcPECIJJmZh5jRndyNThnhhb/vlA==", + "dev": true, + "dependencies": { + "parse5": "^6.0.1" + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "dev": true, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/pathval": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", + "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/pend": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", + "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", + "dev": true + }, + "node_modules/performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", + "dev": true + }, + "node_modules/periscopic": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/periscopic/-/periscopic-2.0.3.tgz", + "integrity": "sha512-FuCZe61mWxQOJAQFEfmt9FjzebRlcpFz8sFPbyaCKtdusPkMEbA9ey0eARnRav5zAhmXznhaQkKGFAPn7X9NUw==", + "dev": true, + "dependencies": { + "estree-walker": "^2.0.2", + "is-reference": "^1.1.4" + } + }, + "node_modules/periscopic/node_modules/estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "dev": true + }, + "node_modules/picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "dev": true + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/portfinder": { + "version": "1.0.28", + "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.28.tgz", + "integrity": "sha512-Se+2isanIcEqf2XMHjyUKskczxbPH7dQnlMjXX6+dybayyHvAf/TCgyMRlzf/B6QDhAEFOGes0pzRo3by4AbMA==", + "dev": true, + "dependencies": { + "async": "^2.6.2", + "debug": "^3.1.1", + "mkdirp": "^0.5.5" + }, + "engines": { + "node": ">= 0.12.0" + } + }, + "node_modules/portfinder/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/portfinder/node_modules/mkdirp": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "dev": true, + "dependencies": { + "minimist": "^1.2.5" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/postcss": { + "version": "8.4.6", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.6.tgz", + "integrity": "sha512-OovjwIzs9Te46vlEx7+uXB0PLijpwjXGKXjVGGPIGubGpq7uh5Xgf6D6FiJ/SzJMBosHDp6a2hiXOS97iBXcaA==", + "dev": true, + "dependencies": { + "nanoid": "^3.2.0", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.2" + }, + "engines": { + "node": "^10 || ^12 || >=14" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + } + }, + "node_modules/postcss-js": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/postcss-js/-/postcss-js-4.0.0.tgz", + "integrity": "sha512-77QESFBwgX4irogGVPgQ5s07vLvFqWr228qZY+w6lW599cRlK/HmnlivnnVUxkjHnCu4J16PDMHcH+e+2HbvTQ==", + "dev": true, + "dependencies": { + "camelcase-css": "^2.0.1" + }, + "engines": { + "node": "^12 || ^14 || >= 16" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + "peerDependencies": { + "postcss": "^8.3.3" + } + }, + "node_modules/postcss-load-config": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-3.1.1.tgz", + "integrity": "sha512-c/9XYboIbSEUZpiD1UQD0IKiUe8n9WHYV7YFe7X7J+ZwCsEKkUJSFWjS9hBU1RR9THR7jMXst8sxiqP0jjo2mg==", + "dev": true, + "dependencies": { + "lilconfig": "^2.0.4", + "yaml": "^1.10.2" + }, + "engines": { + "node": ">= 10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + "peerDependencies": { + "ts-node": ">=9.0.0" + }, + "peerDependenciesMeta": { + "ts-node": { + "optional": true + } + } + }, + "node_modules/postcss-modules": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/postcss-modules/-/postcss-modules-4.3.0.tgz", + "integrity": "sha512-zoUttLDSsbWDinJM9jH37o7hulLRyEgH6fZm2PchxN7AZ8rkdWiALyNhnQ7+jg7cX9f10m6y5VhHsrjO0Mf/DA==", + "dev": true, + "dependencies": { + "generic-names": "^4.0.0", + "icss-replace-symbols": "^1.1.0", + "lodash.camelcase": "^4.3.0", + "postcss-modules-extract-imports": "^3.0.0", + "postcss-modules-local-by-default": "^4.0.0", + "postcss-modules-scope": "^3.0.0", + "postcss-modules-values": "^4.0.0", + "string-hash": "^1.1.1" + }, + "peerDependencies": { + "postcss": "^8.0.0" + } + }, + "node_modules/postcss-modules-extract-imports": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/postcss-modules-extract-imports/-/postcss-modules-extract-imports-3.0.0.tgz", + "integrity": "sha512-bdHleFnP3kZ4NYDhuGlVK+CMrQ/pqUm8bx/oGL93K6gVwiclvX5x0n76fYMKuIGKzlABOy13zsvqjb0f92TEXw==", + "dev": true, + "engines": { + "node": "^10 || ^12 || >= 14" + }, + "peerDependencies": { + "postcss": "^8.1.0" + } + }, + "node_modules/postcss-modules-local-by-default": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/postcss-modules-local-by-default/-/postcss-modules-local-by-default-4.0.0.tgz", + "integrity": "sha512-sT7ihtmGSF9yhm6ggikHdV0hlziDTX7oFoXtuVWeDd3hHObNkcHRo9V3yg7vCAY7cONyxJC/XXCmmiHHcvX7bQ==", + "dev": true, + "dependencies": { + "icss-utils": "^5.0.0", + "postcss-selector-parser": "^6.0.2", + "postcss-value-parser": "^4.1.0" + }, + "engines": { + "node": "^10 || ^12 || >= 14" + }, + "peerDependencies": { + "postcss": "^8.1.0" + } + }, + "node_modules/postcss-modules-scope": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/postcss-modules-scope/-/postcss-modules-scope-3.0.0.tgz", + "integrity": "sha512-hncihwFA2yPath8oZ15PZqvWGkWf+XUfQgUGamS4LqoP1anQLOsOJw0vr7J7IwLpoY9fatA2qiGUGmuZL0Iqlg==", + "dev": true, + "dependencies": { + "postcss-selector-parser": "^6.0.4" + }, + "engines": { + "node": "^10 || ^12 || >= 14" + }, + "peerDependencies": { + "postcss": "^8.1.0" + } + }, + "node_modules/postcss-modules-values": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/postcss-modules-values/-/postcss-modules-values-4.0.0.tgz", + "integrity": "sha512-RDxHkAiEGI78gS2ofyvCsu7iycRv7oqw5xMWn9iMoR0N/7mf9D50ecQqUo5BZ9Zh2vH4bCUR/ktCqbB9m8vJjQ==", + "dev": true, + "dependencies": { + "icss-utils": "^5.0.0" + }, + "engines": { + "node": "^10 || ^12 || >= 14" + }, + "peerDependencies": { + "postcss": "^8.1.0" + } + }, + "node_modules/postcss-nested": { + "version": "5.0.6", + "resolved": "https://registry.npmjs.org/postcss-nested/-/postcss-nested-5.0.6.tgz", + "integrity": "sha512-rKqm2Fk0KbA8Vt3AdGN0FB9OBOMDVajMG6ZCf/GoHgdxUJ4sBFp0A/uMIRm+MJUdo33YXEtjqIz8u7DAp8B7DA==", + "dev": true, + "dependencies": { + "postcss-selector-parser": "^6.0.6" + }, + "engines": { + "node": ">=12.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + "peerDependencies": { + "postcss": "^8.2.14" + } + }, + "node_modules/postcss-selector-parser": { + "version": "6.0.9", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.9.tgz", + "integrity": "sha512-UO3SgnZOVTwu4kyLR22UQ1xZh086RyNZppb7lLAKBFK8a32ttG5i87Y/P3+2bRSjZNyJ1B7hfFNo273tKe9YxQ==", + "dev": true, + "dependencies": { + "cssesc": "^3.0.0", + "util-deprecate": "^1.0.2" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/postcss-value-parser": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", + "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==", + "dev": true + }, + "node_modules/prettier": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.5.1.tgz", + "integrity": "sha512-vBZcPRUR5MZJwoyi3ZoyQlc1rXeEck8KgeC9AwwOn+exuxLxq5toTRDTSaVrXHxelDMHy9zlicw8u66yxoSUFg==", + "dev": true, + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/pretty-format": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-26.6.2.tgz", + "integrity": "sha512-7AeGuCYNGmycyQbCqd/3PWH4eOoX/OiCa0uphp57NVTeAGdJGaAliecxwBDHYQCIvrW7aDBZCYeNTP/WX69mkg==", + "dev": true, + "dependencies": { + "@jest/types": "^26.6.2", + "ansi-regex": "^5.0.0", + "ansi-styles": "^4.0.0", + "react-is": "^17.0.1" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/pretty-format/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/pretty-format/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/pretty-format/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/proc-log": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/proc-log/-/proc-log-1.0.0.tgz", + "integrity": "sha512-aCk8AO51s+4JyuYGg3Q/a6gnrlDO09NpVWePtjp7xwphcoQ04x5WAfCyugcsbLooWcMJ87CLkD4+604IckEdhg==", + "dev": true + }, + "node_modules/process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "dev": true + }, + "node_modules/progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/promise-all-reject-late": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/promise-all-reject-late/-/promise-all-reject-late-1.0.1.tgz", + "integrity": "sha512-vuf0Lf0lOxyQREH7GDIOUMLS7kz+gs8i6B+Yi8dC68a2sychGrHTJYghMBD6k7eUcH0H5P73EckCA48xijWqXw==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/promise-call-limit": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/promise-call-limit/-/promise-call-limit-1.0.1.tgz", + "integrity": "sha512-3+hgaa19jzCGLuSCbieeRsu5C2joKfYn8pY6JAuXFRVfF4IO+L7UPpFWNTeWT9pM7uhskvbPPd/oEOktCn317Q==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/promise-inflight": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz", + "integrity": "sha1-mEcocL8igTL8vdhoEputEsPAKeM=", + "dev": true + }, + "node_modules/promise-retry": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/promise-retry/-/promise-retry-2.0.1.tgz", + "integrity": "sha512-y+WKFlBR8BGXnsNlIHFGPZmyDf3DFMoLhaflAnyZgV6rG6xu+JwesTo2Q9R6XwYmtmwAFCkAk3e35jEdoeh/3g==", + "dev": true, + "dependencies": { + "err-code": "^2.0.2", + "retry": "^0.12.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "dev": true + }, + "node_modules/psl": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", + "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==", + "dev": true + }, + "node_modules/pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "dev": true, + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "node_modules/punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/puppeteer-core": { + "version": "13.1.3", + "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-13.1.3.tgz", + "integrity": "sha512-96pzvVBzq5lUGt3L/QrIH3mxn3NfZylHeusNhq06xBAHPI0Upc0SC/9u7tXjL0oRnmcExeVRJivr1lj7Ah/yDQ==", + "dev": true, + "dependencies": { + "debug": "4.3.2", + "devtools-protocol": "0.0.948846", + "extract-zip": "2.0.1", + "https-proxy-agent": "5.0.0", + "node-fetch": "2.6.7", + "pkg-dir": "4.2.0", + "progress": "2.0.3", + "proxy-from-env": "1.1.0", + "rimraf": "3.0.2", + "tar-fs": "2.1.1", + "unbzip2-stream": "1.4.3", + "ws": "8.2.3" + }, + "engines": { + "node": ">=10.18.1" + } + }, + "node_modules/puppeteer-core/node_modules/debug": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/puppeteer-core/node_modules/ws": { + "version": "8.2.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.2.3.tgz", + "integrity": "sha512-wBuoj1BDpC6ZQ1B7DWQBYVLphPWkm8i9Y0/3YdHjHKHiohOJ1ws+3OccDWtH+PoC9DZD5WOTrJvNbWvjS6JWaA==", + "dev": true, + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/qs": { + "version": "6.10.3", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.3.tgz", + "integrity": "sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ==", + "dev": true, + "dependencies": { + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/quick-lru": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz", + "integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/raw-body": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.2.tgz", + "integrity": "sha512-RPMAFUJP19WIet/99ngh6Iv8fzAbqum4Li7AD6DtGaW2RpMB/11xDoalPiJMTbu6I3hkbMVkATvZrqb9EEqeeQ==", + "dev": true, + "dependencies": { + "bytes": "3.1.1", + "http-errors": "1.8.1", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/react": { + "version": "17.0.2", + "resolved": "https://registry.npmjs.org/react/-/react-17.0.2.tgz", + "integrity": "sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA==", + "dependencies": { + "loose-envify": "^1.1.0", + "object-assign": "^4.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-dom": { + "version": "17.0.2", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-17.0.2.tgz", + "integrity": "sha512-s4h96KtLDUQlsENhMn1ar8t2bEa+q/YAtj8pPPdIjPDGBDIVNsrD9aXNWqspUe6AzKCIG0C1HZZLqLV7qpOBGA==", + "dependencies": { + "loose-envify": "^1.1.0", + "object-assign": "^4.1.1", + "scheduler": "^0.20.2" + }, + "peerDependencies": { + "react": "17.0.2" + } + }, + "node_modules/react-is": { + "version": "17.0.2", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", + "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", + "dev": true + }, + "node_modules/react-refresh": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.9.0.tgz", + "integrity": "sha512-Gvzk7OZpiqKSkxsQvO/mbTN1poglhmAV7gR/DdIrRrSMXraRQQlfikRJOr3Nb9GTMPC5kof948Zy6jJZIFtDvQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/read-cmd-shim": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-cmd-shim/-/read-cmd-shim-2.0.0.tgz", + "integrity": "sha512-HJpV9bQpkl6KwjxlJcBoqu9Ba0PQg8TqSNIOrulGt54a0uup0HtevreFHzYzkm0lpnleRdNBzXznKrgxglEHQw==", + "dev": true + }, + "node_modules/read-package-json-fast": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/read-package-json-fast/-/read-package-json-fast-2.0.3.tgz", + "integrity": "sha512-W/BKtbL+dUjTuRL2vziuYhp76s5HZ9qQhd/dKfWIZveD0O40453QNyZhC0e63lqZrAQ4jiOapVoeJ7JrszenQQ==", + "dev": true, + "dependencies": { + "json-parse-even-better-errors": "^2.3.0", + "npm-normalize-package-bin": "^1.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "dev": true, + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/readdir-scoped-modules": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/readdir-scoped-modules/-/readdir-scoped-modules-1.1.0.tgz", + "integrity": "sha512-asaikDeqAQg7JifRsZn1NJZXo9E+VwlyCfbkZhwyISinqk5zNS6266HS5kah6P0SaQKGF6SkNnZVHUzHFYxYDw==", + "dev": true, + "dependencies": { + "debuglog": "^1.0.1", + "dezalgo": "^1.0.0", + "graceful-fs": "^4.1.2", + "once": "^1.3.0" + } + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/reduce-flatten": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/reduce-flatten/-/reduce-flatten-2.0.0.tgz", + "integrity": "sha512-EJ4UNY/U1t2P/2k6oqotuX2Cc3T6nxJwsM0N0asT7dhrtH1ltUxDn4NalSYmPE2rCkVpcf/X6R0wDwcFpzhd4w==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/regenerator-runtime": { + "version": "0.13.9", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz", + "integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA==" + }, + "node_modules/request": { + "version": "2.88.2", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", + "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", + "deprecated": "request has been deprecated, see https://github.com/request/request/issues/3142", + "dev": true, + "dependencies": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.3", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.5.0", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/request/node_modules/qs": { + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz", + "integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==", + "dev": true, + "engines": { + "node": ">=0.6" + } + }, + "node_modules/resolve": { + "version": "1.22.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.0.tgz", + "integrity": "sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw==", + "dev": true, + "dependencies": { + "is-core-module": "^2.8.1", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve-alpn": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/resolve-alpn/-/resolve-alpn-1.2.1.tgz", + "integrity": "sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==", + "dev": true + }, + "node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve-path": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/resolve-path/-/resolve-path-1.4.0.tgz", + "integrity": "sha1-xL2p9e+y/OZSR4c6s2u02DT+Fvc=", + "dev": true, + "dependencies": { + "http-errors": "~1.6.2", + "path-is-absolute": "1.0.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/resolve-path/node_modules/depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/resolve-path/node_modules/http-errors": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", + "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", + "dev": true, + "dependencies": { + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.0", + "statuses": ">= 1.4.0 < 2" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/resolve-path/node_modules/inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + }, + "node_modules/resolve-path/node_modules/setprototypeof": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", + "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==", + "dev": true + }, + "node_modules/responselike": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-2.0.0.tgz", + "integrity": "sha512-xH48u3FTB9VsZw7R+vvgaKeLKzT6jOogbQhEe/jewwnZgzPcnyWui2Av6JpoYZF/91uueC+lqhWqeURw5/qhCw==", + "dev": true, + "dependencies": { + "lowercase-keys": "^2.0.0" + } + }, + "node_modules/restore-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", + "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", + "dev": true, + "dependencies": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/retry": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", + "integrity": "sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs=", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true, + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/rollup": { + "version": "2.67.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.67.0.tgz", + "integrity": "sha512-W83AaERwvDiHwHEF/dfAfS3z1Be5wf7n+pO3ZAO5IQadCT2lBTr7WQ2MwZZe+nodbD+n3HtC4OCOAdsOPPcKZQ==", + "dev": true, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=10.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/rollup-plugin-polyfill-node": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/rollup-plugin-polyfill-node/-/rollup-plugin-polyfill-node-0.6.2.tgz", + "integrity": "sha512-gMCVuR0zsKq0jdBn8pSXN1Ejsc458k2QsFFvQdbHoM0Pot5hEnck+pBP/FDwFS6uAi77pD3rDTytsaUStsOMlA==", + "dev": true, + "dependencies": { + "@rollup/plugin-inject": "^4.0.0" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true + }, + "node_modules/scheduler": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.20.2.tgz", + "integrity": "sha512-2eWfGgAqqWFGqtdMmcL5zCMK1U8KlXv8SQFGglL3CEtd0aDVDWgeF/YoCmvln55m5zSk3J/20hTaSBeSObsQDQ==", + "dependencies": { + "loose-envify": "^1.1.0", + "object-assign": "^4.1.1" + } + }, + "node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "dev": true + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "dev": true + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, + "node_modules/skypack": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/skypack/-/skypack-0.3.2.tgz", + "integrity": "sha512-je1pix0QYER6iHuUGbgcafRJT5TI+EGUIBfzBLMqo3Wi22I2SzB9TVHQqwKCw8pzJMuHqhVTFEHc3Ey+ra25Sw==", + "dev": true, + "dependencies": { + "cacache": "^15.0.0", + "cachedir": "^2.3.0", + "esinstall": "^1.0.0", + "etag": "^1.8.1", + "find-up": "^5.0.0", + "got": "^11.1.4", + "kleur": "^4.1.0", + "mkdirp": "^1.0.3", + "p-queue": "^6.2.1", + "rimraf": "^3.0.0", + "rollup": "^2.23.0", + "validate-npm-package-name": "^3.0.0" + }, + "engines": { + "node": ">=10.19.0" + } + }, + "node_modules/skypack/node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/skypack/node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/skypack/node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/skypack/node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/slice-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", + "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/slice-ansi?sponsor=1" + } + }, + "node_modules/slice-ansi/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/slice-ansi/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/slice-ansi/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/smart-buffer": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", + "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", + "dev": true, + "engines": { + "node": ">= 6.0.0", + "npm": ">= 3.0.0" + } + }, + "node_modules/snowpack": { + "version": "3.8.8", + "resolved": "https://registry.npmjs.org/snowpack/-/snowpack-3.8.8.tgz", + "integrity": "sha512-Y/4V8FdzzYpwmJU2TgXRRFytz+GFSliWULK9J5O6C72KyK60w20JKqCdRtVs1S6BuobCedF5vSBD1Gvtm+gsJg==", + "dev": true, + "dependencies": { + "@npmcli/arborist": "^2.6.4", + "bufferutil": "^4.0.2", + "cachedir": "^2.3.0", + "cheerio": "1.0.0-rc.10", + "chokidar": "^3.4.0", + "cli-spinners": "^2.5.0", + "compressible": "^2.0.18", + "cosmiconfig": "^7.0.0", + "deepmerge": "^4.2.2", + "default-browser-id": "^2.0.0", + "detect-port": "^1.3.0", + "es-module-lexer": "^0.3.24", + "esbuild": "~0.9.0", + "esinstall": "^1.1.7", + "estree-walker": "^2.0.2", + "etag": "^1.8.1", + "execa": "^5.1.1", + "fdir": "^5.0.0", + "find-cache-dir": "^3.3.1", + "find-up": "^5.0.0", + "glob": "^7.1.7", + "httpie": "^1.1.2", + "is-plain-object": "^5.0.0", + "is-reference": "^1.2.1", + "isbinaryfile": "^4.0.6", + "jsonschema": "~1.2.5", + "kleur": "^4.1.1", + "magic-string": "^0.25.7", + "meriyah": "^3.1.6", + "mime-types": "^2.1.26", + "mkdirp": "^1.0.3", + "npm-run-path": "^4.0.1", + "open": "^8.2.1", + "pacote": "^11.3.4", + "periscopic": "^2.0.3", + "picomatch": "^2.3.0", + "postcss": "^8.3.5", + "postcss-modules": "^4.0.0", + "resolve": "^1.20.0", + "resolve-from": "^5.0.0", + "rimraf": "^3.0.0", + "rollup": "~2.37.1", + "signal-exit": "^3.0.3", + "skypack": "^0.3.2", + "slash": "~3.0.0", + "source-map": "^0.7.3", + "strip-ansi": "^6.0.0", + "strip-comments": "^2.0.1", + "utf-8-validate": "^5.0.3", + "ws": "^7.3.0", + "yargs-parser": "^20.0.0" + }, + "bin": { + "snowpack": "index.bin.js", + "sp": "index.bin.js" + }, + "engines": { + "node": ">=10.19.0" + }, + "optionalDependencies": { + "fsevents": "^2.3.2" + } + }, + "node_modules/snowpack/node_modules/es-module-lexer": { + "version": "0.3.26", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-0.3.26.tgz", + "integrity": "sha512-Va0Q/xqtrss45hWzP8CZJwzGSZJjDM5/MJRE3IXXnUCcVLElR9BRaE9F62BopysASyc4nM3uwhSW7FFB9nlWAA==", + "dev": true + }, + "node_modules/snowpack/node_modules/estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "dev": true + }, + "node_modules/snowpack/node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/snowpack/node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/snowpack/node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/snowpack/node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/snowpack/node_modules/rollup": { + "version": "2.37.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.37.1.tgz", + "integrity": "sha512-V3ojEeyGeSdrMSuhP3diBb06P+qV4gKQeanbDv+Qh/BZbhdZ7kHV0xAt8Yjk4GFshq/WjO7R4c7DFM20AwTFVQ==", + "dev": true, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=10.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.1.2" + } + }, + "node_modules/snowpack/node_modules/rollup/node_modules/fsevents": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz", + "integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==", + "deprecated": "\"Please update to latest v2.3 or v2.2\"", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/snowpack/node_modules/source-map": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", + "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/socks": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/socks/-/socks-2.6.1.tgz", + "integrity": "sha512-kLQ9N5ucj8uIcxrDwjm0Jsqk06xdpBjGNQtpXy4Q8/QY2k+fY7nZH8CARy+hkbG+SGAovmzzuauCpBlb8FrnBA==", + "dev": true, + "dependencies": { + "ip": "^1.1.5", + "smart-buffer": "^4.1.0" + }, + "engines": { + "node": ">= 10.13.0", + "npm": ">= 3.0.0" + } + }, + "node_modules/socks-proxy-agent": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-6.1.1.tgz", + "integrity": "sha512-t8J0kG3csjA4g6FTbsMOWws+7R7vuRC8aQ/wy3/1OWmsgwA68zs/+cExQ0koSitUDXqhufF/YJr9wtNMZHw5Ew==", + "dev": true, + "dependencies": { + "agent-base": "^6.0.2", + "debug": "^4.3.1", + "socks": "^2.6.1" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-js": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", + "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/sourcemap-codec": { + "version": "1.4.8", + "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", + "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", + "dev": true + }, + "node_modules/sshpk": { + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.17.0.tgz", + "integrity": "sha512-/9HIEs1ZXGhSPE8X6Ccm7Nam1z8KcoCqPdI7ecm1N33EzAetWahvQWVqLZtaZQ+IDKX4IyA2o0gBzqIMkAagHQ==", + "dev": true, + "dependencies": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + }, + "bin": { + "sshpk-conv": "bin/sshpk-conv", + "sshpk-sign": "bin/sshpk-sign", + "sshpk-verify": "bin/sshpk-verify" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ssri": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/ssri/-/ssri-8.0.1.tgz", + "integrity": "sha512-97qShzy1AiyxvPNIkLWoGua7xoQzzPjQ0HAH4B0rWKo7SZ6USuPcrUiAFrws0UH8RrbWmgq3LMTObhPIHbbBeQ==", + "dev": true, + "dependencies": { + "minipass": "^3.1.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/standardized-audio-context": { + "version": "25.3.20", + "resolved": "https://registry.npmjs.org/standardized-audio-context/-/standardized-audio-context-25.3.20.tgz", + "integrity": "sha512-c6eMQXmN7iDS7ROuSqOrHQhxpazerJSnRHEJiKD8YkruZBTt/a5E7zmk+KkStoi0dohFAod8wvwWxc7S1gmdig==", + "dependencies": { + "@babel/runtime": "^7.17.0", + "automation-events": "^4.0.12", + "tslib": "^2.3.1" + } + }, + "node_modules/statuses": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", + "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/string-hash": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/string-hash/-/string-hash-1.1.3.tgz", + "integrity": "sha1-6Kr8CsGFW0Zmkp7X3RJ1311sgRs=", + "dev": true + }, + "node_modules/string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "dependencies": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/string-width/node_modules/ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/string-width/node_modules/is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true, + "dependencies": { + "number-is-nan": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/string-width/node_modules/strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "dependencies": { + "ansi-regex": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-comments/-/strip-comments-2.0.1.tgz", + "integrity": "sha512-ZprKx+bBLXv067WTCALv8SSz5l2+XhpYCsVtSqlMnkAXMWDq+/ekVbl1ghqP9rUHTzv6sm/DwCOiYutU/yp1fw==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/table-layout": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/table-layout/-/table-layout-1.0.2.tgz", + "integrity": "sha512-qd/R7n5rQTRFi+Zf2sk5XVVd9UQl6ZkduPFC3S7WEGJAmetDTjY3qPN50eSKzwuzEyQKy5TN2TiZdkIjos2L6A==", + "dev": true, + "dependencies": { + "array-back": "^4.0.1", + "deep-extend": "~0.6.0", + "typical": "^5.2.0", + "wordwrapjs": "^4.0.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/table-layout/node_modules/array-back": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/array-back/-/array-back-4.0.2.tgz", + "integrity": "sha512-NbdMezxqf94cnNfWLL7V/im0Ub+Anbb0IoZhvzie8+4HJ4nMQuzHuy49FkGYCJK2yAloZ3meiB6AVMClbrI1vg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/table-layout/node_modules/typical": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/typical/-/typical-5.2.0.tgz", + "integrity": "sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/tailwindcss": { + "version": "3.0.18", + "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.0.18.tgz", + "integrity": "sha512-ihPTpEyA5ANgZbwKlgrbfnzOp9R5vDHFWmqxB1PT8NwOGCOFVVMl+Ps1cQQ369acaqqf1BEF77roCwK0lvNmTw==", + "dev": true, + "dependencies": { + "arg": "^5.0.1", + "chalk": "^4.1.2", + "chokidar": "^3.5.3", + "color-name": "^1.1.4", + "cosmiconfig": "^7.0.1", + "detective": "^5.2.0", + "didyoumean": "^1.2.2", + "dlv": "^1.1.3", + "fast-glob": "^3.2.11", + "glob-parent": "^6.0.2", + "is-glob": "^4.0.3", + "normalize-path": "^3.0.0", + "object-hash": "^2.2.0", + "postcss-js": "^4.0.0", + "postcss-load-config": "^3.1.0", + "postcss-nested": "5.0.6", + "postcss-selector-parser": "^6.0.9", + "postcss-value-parser": "^4.2.0", + "quick-lru": "^5.1.1", + "resolve": "^1.21.0" + }, + "bin": { + "tailwind": "lib/cli.js", + "tailwindcss": "lib/cli.js" + }, + "engines": { + "node": ">=12.13.0" + }, + "peerDependencies": { + "autoprefixer": "^10.0.2", + "postcss": "^8.0.9" + } + }, + "node_modules/tailwindcss/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/tailwindcss/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/tailwindcss/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/tailwindcss/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/tailwindcss/node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/tailwindcss/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/tailwindcss/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/tar": { + "version": "6.1.11", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.11.tgz", + "integrity": "sha512-an/KZQzQUkZCkuoAA64hM92X0Urb6VpRhAFllDzz44U2mcD5scmT3zBc4VgVpkugF580+DQn8eAFSyoQt0tznA==", + "dev": true, + "dependencies": { + "chownr": "^2.0.0", + "fs-minipass": "^2.0.0", + "minipass": "^3.0.0", + "minizlib": "^2.1.1", + "mkdirp": "^1.0.3", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/tar-fs": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz", + "integrity": "sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==", + "dev": true, + "dependencies": { + "chownr": "^1.1.1", + "mkdirp-classic": "^0.5.2", + "pump": "^3.0.0", + "tar-stream": "^2.1.4" + } + }, + "node_modules/tar-fs/node_modules/chownr": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", + "dev": true + }, + "node_modules/tar-stream": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", + "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", + "dev": true, + "dependencies": { + "bl": "^4.0.3", + "end-of-stream": "^1.4.1", + "fs-constants": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/tar-stream/node_modules/readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", + "dev": true + }, + "node_modules/to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "dev": true, + "engines": { + "node": ">=0.6" + } + }, + "node_modules/tone": { + "version": "14.7.77", + "resolved": "https://registry.npmjs.org/tone/-/tone-14.7.77.tgz", + "integrity": "sha512-tCfK73IkLHyzoKUvGq47gyDyxiKLFvKiVCOobynGgBB9Dl0NkxTM2p+eRJXyCYrjJwy9Y0XCMqD3uOYsYt2Fdg==", + "dependencies": { + "standardized-audio-context": "^25.1.8", + "tslib": "^2.0.1" + } + }, + "node_modules/tough-cookie": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", + "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", + "dev": true, + "dependencies": { + "psl": "^1.1.28", + "punycode": "^2.1.1" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/tr46": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz", + "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==", + "dev": true, + "dependencies": { + "punycode": "^2.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/treeverse": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/treeverse/-/treeverse-1.0.4.tgz", + "integrity": "sha512-whw60l7r+8ZU8Tu/Uc2yxtc4ZTZbR/PF3u1IPNKGQ6p8EICLb3Z2lAgoqw9bqYd8IkgnsaOcLzYHFckjqNsf0g==", + "dev": true + }, + "node_modules/tslib": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", + "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==" + }, + "node_modules/tsscmp": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/tsscmp/-/tsscmp-1.0.6.tgz", + "integrity": "sha512-LxhtAkPDTkVCMQjt2h6eBVY28KCjikZqZfMcC15YBeNjkgUpdCfBu5HoiOTDu86v6smE8yOjyEktJ8hlbANHQA==", + "dev": true, + "engines": { + "node": ">=0.6.x" + } + }, + "node_modules/tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "dev": true, + "dependencies": { + "safe-buffer": "^5.0.1" + }, + "engines": { + "node": "*" + } + }, + "node_modules/tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "dev": true + }, + "node_modules/type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/type-fest": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "dev": true, + "dependencies": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/typedarray-to-buffer": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "dev": true, + "dependencies": { + "is-typedarray": "^1.0.0" + } + }, + "node_modules/typescript": { + "version": "4.5.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz", + "integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/typical": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/typical/-/typical-4.0.0.tgz", + "integrity": "sha512-VAH4IvQ7BDFYglMd7BPRDfLgxZZX4O4TFcRDA6EN5X7erNJJq+McIEp8np9aVtxrCJ6qx4GTYVfOWNjcqwZgRw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/unbzip2-stream": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz", + "integrity": "sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg==", + "dev": true, + "dependencies": { + "buffer": "^5.2.1", + "through": "^2.3.8" + } + }, + "node_modules/unique-filename": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-1.1.1.tgz", + "integrity": "sha512-Vmp0jIp2ln35UTXuryvjzkjGdRyf9b2lTXuSYUiPmzRcl3FDtYqAwOnTJkAngD9SWhnoJzDbTKwaOrZ+STtxNQ==", + "dev": true, + "dependencies": { + "unique-slug": "^2.0.0" + } + }, + "node_modules/unique-slug": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-2.0.2.tgz", + "integrity": "sha512-zoWr9ObaxALD3DOPfjPSqxt4fnZiWblxHIgeWqW8x7UqDzEtHEQLzji2cuJYQFCU6KmoJikOYAZlrTHHebjx2w==", + "dev": true, + "dependencies": { + "imurmurhash": "^0.1.4" + } + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=", + "dev": true, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/untildify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/untildify/-/untildify-2.1.0.tgz", + "integrity": "sha1-F+soB5h/dpUunASF/DEdBqgmouA=", + "dev": true, + "dependencies": { + "os-homedir": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/utf-8-validate": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.8.tgz", + "integrity": "sha512-k4dW/Qja1BYDl2qD4tOMB9PFVha/UJtxTc1cXYOe3WwA/2m0Yn4qB7wLMpJyLJ/7DR0XnTut3HsCSzDT4ZvKgA==", + "dev": true, + "hasInstallScript": true, + "dependencies": { + "node-gyp-build": "^4.3.0" + }, + "engines": { + "node": ">=6.14.2" + } + }, + "node_modules/util": { + "version": "0.10.3", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", + "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", + "dev": true, + "dependencies": { + "inherits": "2.0.1" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true + }, + "node_modules/util/node_modules/inherits": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", + "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=", + "dev": true + }, + "node_modules/uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", + "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.", + "dev": true, + "bin": { + "uuid": "bin/uuid" + } + }, + "node_modules/v8-to-istanbul": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-8.1.1.tgz", + "integrity": "sha512-FGtKtv3xIpR6BYhvgH8MI/y78oT7d8Au3ww4QIxymrCtZEh5b8gCw2siywE+puhEmuWKDtmfrvF5UlB298ut3w==", + "dev": true, + "dependencies": { + "@types/istanbul-lib-coverage": "^2.0.1", + "convert-source-map": "^1.6.0", + "source-map": "^0.7.3" + }, + "engines": { + "node": ">=10.12.0" + } + }, + "node_modules/v8-to-istanbul/node_modules/source-map": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", + "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/validate-npm-package-name": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-3.0.0.tgz", + "integrity": "sha1-X6kS2B630MdK/BQN5zF/DKffQ34=", + "dev": true, + "dependencies": { + "builtins": "^1.0.3" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=", + "dev": true, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "dev": true, + "engines": [ + "node >=0.6.0" + ], + "dependencies": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "node_modules/verror/node_modules/core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true + }, + "node_modules/vm2": { + "version": "3.9.5", + "resolved": "https://registry.npmjs.org/vm2/-/vm2-3.9.5.tgz", + "integrity": "sha512-LuCAHZN75H9tdrAiLFf030oW7nJV5xwNMuk1ymOZwopmuK3d2H4L1Kv4+GFHgarKiLfXXLFU+7LDABHnwOkWng==", + "dev": true, + "bin": { + "vm2": "bin/vm2" + }, + "engines": { + "node": ">=6.0" + } + }, + "node_modules/walk-up-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/walk-up-path/-/walk-up-path-1.0.0.tgz", + "integrity": "sha512-hwj/qMDUEjCU5h0xr90KGCf0tg0/LgJbmOWgrWKYlcJZM7XvquvUJZ0G/HMGr7F7OQMOUuPHWP9JpriinkAlkg==", + "dev": true + }, + "node_modules/webidl-conversions": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", + "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", + "dev": true, + "engines": { + "node": ">=12" + } + }, + "node_modules/whatwg-url": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz", + "integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==", + "dev": true, + "dependencies": { + "tr46": "^3.0.0", + "webidl-conversions": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/wide-align": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz", + "integrity": "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==", + "dev": true, + "dependencies": { + "string-width": "^1.0.2 || 2 || 3 || 4" + } + }, + "node_modules/wordwrapjs": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/wordwrapjs/-/wordwrapjs-4.0.1.tgz", + "integrity": "sha512-kKlNACbvHrkpIw6oPeYDSmdCTu2hdMHoyXLTcUKala++lx5Y+wjJ/e474Jqv5abnVmwxw08DiTuHmw69lJGksA==", + "dev": true, + "dependencies": { + "reduce-flatten": "^2.0.0", + "typical": "^5.2.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/wordwrapjs/node_modules/typical": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/typical/-/typical-5.2.0.tgz", + "integrity": "sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/workerpool": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.0.tgz", + "integrity": "sha512-Rsk5qQHJ9eowMH28Jwhe8HEbmdYDX4lwoMWshiCXugjtHqMD9ZbiqSDLxcsfdqsETPzVUtX5s1Z5kStiIM6l4A==", + "dev": true + }, + "node_modules/wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/wrap-ansi/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/wrap-ansi/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "node_modules/write-file-atomic": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", + "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", + "dev": true, + "dependencies": { + "imurmurhash": "^0.1.4", + "is-typedarray": "^1.0.0", + "signal-exit": "^3.0.2", + "typedarray-to-buffer": "^3.1.5" + } + }, + "node_modules/ws": { + "version": "7.5.6", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.6.tgz", + "integrity": "sha512-6GLgCqo2cy2A2rjCNFlxQS6ZljG/coZfZXclldI8FB/1G3CCI36Zd8xy2HrFVACi8tfk5XrgLQEk+P0Tnz9UcA==", + "dev": true, + "engines": { + "node": ">=8.3.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "dev": true, + "engines": { + "node": ">=0.4" + } + }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "node_modules/yaml": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", + "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "dev": true, + "engines": { + "node": ">= 6" + } + }, + "node_modules/yargs-parser": { + "version": "20.2.9", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", + "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/yauzl": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", + "integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=", + "dev": true, + "dependencies": { + "buffer-crc32": "~0.2.3", + "fd-slicer": "~1.1.0" + } + }, + "node_modules/ylru": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ylru/-/ylru-1.2.1.tgz", + "integrity": "sha512-faQrqNMzcPCHGVC2aaOINk13K+aaBDUPjGWl0teOXywElLjyVAB6Oe2jj62jHYtwsU49jXhScYbvPENK+6zAvQ==", + "dev": true, + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + } + }, + "dependencies": { + "@ampproject/remapping": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.0.2.tgz", + "integrity": "sha512-sE8Gx+qSDMLoJvb3QarJJlDQK7SSY4rK3hxp4XsiANeFOmjU46ZI7Y9adAQRJrmbz8zbtZkp3mJTT+rGxtF0XA==", + "dev": true, + "requires": { + "@jridgewell/trace-mapping": "^0.2.2", + "sourcemap-codec": "1.4.8" + } + }, + "@babel/code-frame": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz", + "integrity": "sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==", + "dev": true, + "requires": { + "@babel/highlight": "^7.16.7" + } + }, + "@babel/compat-data": { + "version": "7.17.0", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.17.0.tgz", + "integrity": "sha512-392byTlpGWXMv4FbyWw3sAZ/FrW/DrwqLGXpy0mbyNe9Taqv1mg9yON5/o0cnr8XYCkFTZbC1eV+c+LAROgrng==", + "dev": true + }, + "@babel/core": { + "version": "7.17.0", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.17.0.tgz", + "integrity": "sha512-x/5Ea+RO5MvF9ize5DeVICJoVrNv0Mi2RnIABrZEKYvPEpldXwauPkgvYA17cKa6WpU3LoYvYbuEMFtSNFsarA==", + "dev": true, + "requires": { + "@ampproject/remapping": "^2.0.0", + "@babel/code-frame": "^7.16.7", + "@babel/generator": "^7.17.0", + "@babel/helper-compilation-targets": "^7.16.7", + "@babel/helper-module-transforms": "^7.16.7", + "@babel/helpers": "^7.17.0", + "@babel/parser": "^7.17.0", + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.17.0", + "@babel/types": "^7.17.0", + "convert-source-map": "^1.7.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.1.2", + "semver": "^6.3.0" + } + }, + "@babel/generator": { + "version": "7.17.0", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.17.0.tgz", + "integrity": "sha512-I3Omiv6FGOC29dtlZhkfXO6pgkmukJSlT26QjVvS1DGZe/NzSVCPG41X0tS21oZkJYlovfj9qDWgKP+Cn4bXxw==", + "dev": true, + "requires": { + "@babel/types": "^7.17.0", + "jsesc": "^2.5.1", + "source-map": "^0.5.0" + } + }, + "@babel/helper-compilation-targets": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.16.7.tgz", + "integrity": "sha512-mGojBwIWcwGD6rfqgRXVlVYmPAv7eOpIemUG3dGnDdCY4Pae70ROij3XmfrH6Fa1h1aiDylpglbZyktfzyo/hA==", + "dev": true, + "requires": { + "@babel/compat-data": "^7.16.4", + "@babel/helper-validator-option": "^7.16.7", + "browserslist": "^4.17.5", + "semver": "^6.3.0" + } + }, + "@babel/helper-environment-visitor": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.16.7.tgz", + "integrity": "sha512-SLLb0AAn6PkUeAfKJCCOl9e1R53pQlGAfc4y4XuMRZfqeMYLE0dM1LMhqbGAlGQY0lfw5/ohoYWAe9V1yibRag==", + "dev": true, + "requires": { + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-function-name": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.16.7.tgz", + "integrity": "sha512-QfDfEnIUyyBSR3HtrtGECuZ6DAyCkYFp7GHl75vFtTnn6pjKeK0T1DB5lLkFvBea8MdaiUABx3osbgLyInoejA==", + "dev": true, + "requires": { + "@babel/helper-get-function-arity": "^7.16.7", + "@babel/template": "^7.16.7", + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-get-function-arity": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.16.7.tgz", + "integrity": "sha512-flc+RLSOBXzNzVhcLu6ujeHUrD6tANAOU5ojrRx/as+tbzf8+stUCj7+IfRRoAbEZqj/ahXEMsjhOhgeZsrnTw==", + "dev": true, + "requires": { + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-hoist-variables": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.16.7.tgz", + "integrity": "sha512-m04d/0Op34H5v7pbZw6pSKP7weA6lsMvfiIAMeIvkY/R4xQtBSMFEigu9QTZ2qB/9l22vsxtM8a+Q8CzD255fg==", + "dev": true, + "requires": { + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-module-imports": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.16.7.tgz", + "integrity": "sha512-LVtS6TqjJHFc+nYeITRo6VLXve70xmq7wPhWTqDJusJEgGmkAACWwMiTNrvfoQo6hEhFwAIixNkvB0jPXDL8Wg==", + "dev": true, + "requires": { + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-module-transforms": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.16.7.tgz", + "integrity": "sha512-gaqtLDxJEFCeQbYp9aLAefjhkKdjKcdh6DB7jniIGU3Pz52WAmP268zK0VgPz9hUNkMSYeH976K2/Y6yPadpng==", + "dev": true, + "requires": { + "@babel/helper-environment-visitor": "^7.16.7", + "@babel/helper-module-imports": "^7.16.7", + "@babel/helper-simple-access": "^7.16.7", + "@babel/helper-split-export-declaration": "^7.16.7", + "@babel/helper-validator-identifier": "^7.16.7", + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.16.7", + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-plugin-utils": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.16.7.tgz", + "integrity": "sha512-Qg3Nk7ZxpgMrsox6HreY1ZNKdBq7K72tDSliA6dCl5f007jR4ne8iD5UzuNnCJH2xBf2BEEVGr+/OL6Gdp7RxA==", + "dev": true + }, + "@babel/helper-simple-access": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.16.7.tgz", + "integrity": "sha512-ZIzHVyoeLMvXMN/vok/a4LWRy8G2v205mNP0XOuf9XRLyX5/u9CnVulUtDgUTama3lT+bf/UqucuZjqiGuTS1g==", + "dev": true, + "requires": { + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-split-export-declaration": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.16.7.tgz", + "integrity": "sha512-xbWoy/PFoxSWazIToT9Sif+jJTlrMcndIsaOKvTA6u7QEo7ilkRZpjew18/W3c7nm8fXdUDXh02VXTbZ0pGDNw==", + "dev": true, + "requires": { + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-validator-identifier": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz", + "integrity": "sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw==", + "dev": true + }, + "@babel/helper-validator-option": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.16.7.tgz", + "integrity": "sha512-TRtenOuRUVo9oIQGPC5G9DgK4743cdxvtOw0weQNpZXaS16SCBi5MNjZF8vba3ETURjZpTbVn7Vvcf2eAwFozQ==", + "dev": true + }, + "@babel/helpers": { + "version": "7.17.0", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.17.0.tgz", + "integrity": "sha512-Xe/9NFxjPwELUvW2dsukcMZIp6XwPSbI4ojFBJuX5ramHuVE22SVcZIwqzdWo5uCgeTXW8qV97lMvSOjq+1+nQ==", + "dev": true, + "requires": { + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.17.0", + "@babel/types": "^7.17.0" + } + }, + "@babel/highlight": { + "version": "7.16.10", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.16.10.tgz", + "integrity": "sha512-5FnTQLSLswEj6IkgVw5KusNUUFY9ZGqe/TRFnP/BKYHYgfh7tc+C7mwiy95/yNP7Dh9x580Vv8r7u7ZfTBFxdw==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.16.7", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + } + }, + "@babel/parser": { + "version": "7.17.0", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.17.0.tgz", + "integrity": "sha512-VKXSCQx5D8S04ej+Dqsr1CzYvvWgf20jIw2D+YhQCrIlr2UZGaDds23Y0xg75/skOxpLCRpUZvk/1EAVkGoDOw==", + "dev": true + }, + "@babel/plugin-syntax-class-properties": { + "version": "7.12.13", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz", + "integrity": "sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.12.13" + } + }, + "@babel/runtime": { + "version": "7.17.0", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.17.0.tgz", + "integrity": "sha512-etcO/ohMNaNA2UBdaXBBSX/3aEzFMRrVfaPv8Ptc0k+cWpWW0QFiGZ2XnVqQZI1Cf734LbPGmqBKWESfW4x/dQ==", + "requires": { + "regenerator-runtime": "^0.13.4" + } + }, + "@babel/runtime-corejs3": { + "version": "7.17.0", + "resolved": "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.17.0.tgz", + "integrity": "sha512-qeydncU80ravKzovVncW3EYaC1ji3GpntdPgNcJy9g7hHSY6KX+ne1cbV3ov7Zzm4F1z0+QreZPCuw1ynkmYNg==", + "dev": true, + "requires": { + "core-js-pure": "^3.20.2", + "regenerator-runtime": "^0.13.4" + } + }, + "@babel/template": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.16.7.tgz", + "integrity": "sha512-I8j/x8kHUrbYRTUxXrrMbfCa7jxkE7tZre39x3kjr9hvI82cK1FfqLygotcWN5kdPGWcLdWMHpSBavse5tWw3w==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.16.7", + "@babel/parser": "^7.16.7", + "@babel/types": "^7.16.7" + } + }, + "@babel/traverse": { + "version": "7.17.0", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.17.0.tgz", + "integrity": "sha512-fpFIXvqD6kC7c7PUNnZ0Z8cQXlarCLtCUpt2S1Dx7PjoRtCFffvOkHHSom+m5HIxMZn5bIBVb71lhabcmjEsqg==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.16.7", + "@babel/generator": "^7.17.0", + "@babel/helper-environment-visitor": "^7.16.7", + "@babel/helper-function-name": "^7.16.7", + "@babel/helper-hoist-variables": "^7.16.7", + "@babel/helper-split-export-declaration": "^7.16.7", + "@babel/parser": "^7.17.0", + "@babel/types": "^7.17.0", + "debug": "^4.1.0", + "globals": "^11.1.0" + } + }, + "@babel/types": { + "version": "7.17.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.17.0.tgz", + "integrity": "sha512-TmKSNO4D5rzhL5bjWFcVHHLETzfQ/AmbKpKPOSjlP0WoHZ6L911fgoOKY4Alp/emzG4cHJdyN49zpgkbXFEHHw==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.16.7", + "to-fast-properties": "^2.0.0" + } + }, + "@gar/promisify": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@gar/promisify/-/promisify-1.1.2.tgz", + "integrity": "sha512-82cpyJyKRoQoRi+14ibCeGPu0CwypgtBAdBhq1WfvagpCZNKqwXbKwXllYSMG91DhmG4jt9gN8eP6lGOtozuaw==", + "dev": true + }, + "@isaacs/string-locale-compare": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@isaacs/string-locale-compare/-/string-locale-compare-1.1.0.tgz", + "integrity": "sha512-SQ7Kzhh9+D+ZW9MA0zkYv3VXhIDNx+LzM6EJ+/65I3QY+enU6Itte7E5XX7EWrqLW2FN4n06GWzBnPoC3th2aQ==", + "dev": true + }, + "@jest/types": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-26.6.2.tgz", + "integrity": "sha512-fC6QCp7Sc5sX6g8Tvbmj4XUTbyrik0akgRy03yjXbQaBWWNWGE7SGtJk98m0N8nzegD/7SggrUlivxo5ax4KWQ==", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^3.0.0", + "@types/node": "*", + "@types/yargs": "^15.0.0", + "chalk": "^4.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "@jridgewell/resolve-uri": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.0.4.tgz", + "integrity": "sha512-cz8HFjOFfUBtvN+NXYSFMHYRdxZMaEl0XypVrhzxBgadKIXhIkRd8aMeHhmF56Sl7SuS8OnUpQ73/k9LE4VnLg==", + "dev": true + }, + "@jridgewell/trace-mapping": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.2.6.tgz", + "integrity": "sha512-rVJf5dSMEBxnDEwtAT5x8+p6tZ+xU6Ocm+cR1MYL2gMsRi4MMzVf9Pvq6JaxIsEeKAyYmo2U+yPQN4QfdTfFnA==", + "dev": true, + "requires": { + "@jridgewell/resolve-uri": "^3.0.3", + "sourcemap-codec": "1.4.8" + } + }, + "@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + } + }, + "@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true + }, + "@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "requires": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + } + }, + "@npmcli/arborist": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-2.10.0.tgz", + "integrity": "sha512-CLnD+zXG9oijEEzViimz8fbOoFVb7hoypiaf7p6giJhvYtrxLAyY3cZAMPIFQvsG731+02eMDp3LqVBNo7BaZA==", + "dev": true, + "requires": { + "@isaacs/string-locale-compare": "^1.0.1", + "@npmcli/installed-package-contents": "^1.0.7", + "@npmcli/map-workspaces": "^1.0.2", + "@npmcli/metavuln-calculator": "^1.1.0", + "@npmcli/move-file": "^1.1.0", + "@npmcli/name-from-folder": "^1.0.1", + "@npmcli/node-gyp": "^1.0.1", + "@npmcli/package-json": "^1.0.1", + "@npmcli/run-script": "^1.8.2", + "bin-links": "^2.2.1", + "cacache": "^15.0.3", + "common-ancestor-path": "^1.0.1", + "json-parse-even-better-errors": "^2.3.1", + "json-stringify-nice": "^1.1.4", + "mkdirp": "^1.0.4", + "mkdirp-infer-owner": "^2.0.0", + "npm-install-checks": "^4.0.0", + "npm-package-arg": "^8.1.5", + "npm-pick-manifest": "^6.1.0", + "npm-registry-fetch": "^11.0.0", + "pacote": "^11.3.5", + "parse-conflict-json": "^1.1.1", + "proc-log": "^1.0.0", + "promise-all-reject-late": "^1.0.0", + "promise-call-limit": "^1.0.1", + "read-package-json-fast": "^2.0.2", + "readdir-scoped-modules": "^1.1.0", + "rimraf": "^3.0.2", + "semver": "^7.3.5", + "ssri": "^8.0.1", + "treeverse": "^1.0.4", + "walk-up-path": "^1.0.0" + }, + "dependencies": { + "semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + } + } + }, + "@npmcli/fs": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-1.1.0.tgz", + "integrity": "sha512-VhP1qZLXcrXRIaPoqb4YA55JQxLNF3jNR4T55IdOJa3+IFJKNYHtPvtXx8slmeMavj37vCzCfrqQM1vWLsYKLA==", + "dev": true, + "requires": { + "@gar/promisify": "^1.0.1", + "semver": "^7.3.5" + }, + "dependencies": { + "semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + } + } + }, + "@npmcli/git": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@npmcli/git/-/git-2.1.0.tgz", + "integrity": "sha512-/hBFX/QG1b+N7PZBFs0bi+evgRZcK9nWBxQKZkGoXUT5hJSwl5c4d7y8/hm+NQZRPhQ67RzFaj5UM9YeyKoryw==", + "dev": true, + "requires": { + "@npmcli/promise-spawn": "^1.3.2", + "lru-cache": "^6.0.0", + "mkdirp": "^1.0.4", + "npm-pick-manifest": "^6.1.1", + "promise-inflight": "^1.0.1", + "promise-retry": "^2.0.1", + "semver": "^7.3.5", + "which": "^2.0.2" + }, + "dependencies": { + "semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + } + } + }, + "@npmcli/installed-package-contents": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/@npmcli/installed-package-contents/-/installed-package-contents-1.0.7.tgz", + "integrity": "sha512-9rufe0wnJusCQoLpV9ZPKIVP55itrM5BxOXs10DmdbRfgWtHy1LDyskbwRnBghuB0PrF7pNPOqREVtpz4HqzKw==", + "dev": true, + "requires": { + "npm-bundled": "^1.1.1", + "npm-normalize-package-bin": "^1.0.1" + } + }, + "@npmcli/map-workspaces": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@npmcli/map-workspaces/-/map-workspaces-1.0.4.tgz", + "integrity": "sha512-wVR8QxhyXsFcD/cORtJwGQodeeaDf0OxcHie8ema4VgFeqwYkFsDPnSrIRSytX8xR6nKPAH89WnwTcaU608b/Q==", + "dev": true, + "requires": { + "@npmcli/name-from-folder": "^1.0.1", + "glob": "^7.1.6", + "minimatch": "^3.0.4", + "read-package-json-fast": "^2.0.1" + } + }, + "@npmcli/metavuln-calculator": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@npmcli/metavuln-calculator/-/metavuln-calculator-1.1.1.tgz", + "integrity": "sha512-9xe+ZZ1iGVaUovBVFI9h3qW+UuECUzhvZPxK9RaEA2mjU26o5D0JloGYWwLYvQELJNmBdQB6rrpuN8jni6LwzQ==", + "dev": true, + "requires": { + "cacache": "^15.0.5", + "pacote": "^11.1.11", + "semver": "^7.3.2" + }, + "dependencies": { + "semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + } + } + }, + "@npmcli/move-file": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@npmcli/move-file/-/move-file-1.1.2.tgz", + "integrity": "sha512-1SUf/Cg2GzGDyaf15aR9St9TWlb+XvbZXWpDx8YKs7MLzMH/BCeopv+y9vzrzgkfykCGuWOlSu3mZhj2+FQcrg==", + "dev": true, + "requires": { + "mkdirp": "^1.0.4", + "rimraf": "^3.0.2" + } + }, + "@npmcli/name-from-folder": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@npmcli/name-from-folder/-/name-from-folder-1.0.1.tgz", + "integrity": "sha512-qq3oEfcLFwNfEYOQ8HLimRGKlD8WSeGEdtUa7hmzpR8Sa7haL1KVQrvgO6wqMjhWFFVjgtrh1gIxDz+P8sjUaA==", + "dev": true + }, + "@npmcli/node-gyp": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@npmcli/node-gyp/-/node-gyp-1.0.3.tgz", + "integrity": "sha512-fnkhw+fmX65kiLqk6E3BFLXNC26rUhK90zVwe2yncPliVT/Qos3xjhTLE59Df8KnPlcwIERXKVlU1bXoUQ+liA==", + "dev": true + }, + "@npmcli/package-json": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@npmcli/package-json/-/package-json-1.0.1.tgz", + "integrity": "sha512-y6jnu76E9C23osz8gEMBayZmaZ69vFOIk8vR1FJL/wbEJ54+9aVG9rLTjQKSXfgYZEr50nw1txBBFfBZZe+bYg==", + "dev": true, + "requires": { + "json-parse-even-better-errors": "^2.3.1" + } + }, + "@npmcli/promise-spawn": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@npmcli/promise-spawn/-/promise-spawn-1.3.2.tgz", + "integrity": "sha512-QyAGYo/Fbj4MXeGdJcFzZ+FkDkomfRBrPM+9QYJSg+PxgAUL+LU3FneQk37rKR2/zjqkCV1BLHccX98wRXG3Sg==", + "dev": true, + "requires": { + "infer-owner": "^1.0.4" + } + }, + "@npmcli/run-script": { + "version": "1.8.6", + "resolved": "https://registry.npmjs.org/@npmcli/run-script/-/run-script-1.8.6.tgz", + "integrity": "sha512-e42bVZnC6VluBZBAFEr3YrdqSspG3bgilyg4nSLBJ7TRGNCzxHa92XAHxQBLYg0BmgwO4b2mf3h/l5EkEWRn3g==", + "dev": true, + "requires": { + "@npmcli/node-gyp": "^1.0.2", + "@npmcli/promise-spawn": "^1.3.2", + "node-gyp": "^7.1.0", + "read-package-json-fast": "^2.0.1" + } + }, + "@rollup/plugin-commonjs": { + "version": "16.0.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-16.0.0.tgz", + "integrity": "sha512-LuNyypCP3msCGVQJ7ki8PqYdpjfEkE/xtFa5DqlF+7IBD0JsfMZ87C58heSwIMint58sAUZbt3ITqOmdQv/dXw==", + "dev": true, + "requires": { + "@rollup/pluginutils": "^3.1.0", + "commondir": "^1.0.1", + "estree-walker": "^2.0.1", + "glob": "^7.1.6", + "is-reference": "^1.2.1", + "magic-string": "^0.25.7", + "resolve": "^1.17.0" + }, + "dependencies": { + "estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "dev": true + } + } + }, + "@rollup/plugin-inject": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@rollup/plugin-inject/-/plugin-inject-4.0.4.tgz", + "integrity": "sha512-4pbcU4J/nS+zuHk+c+OL3WtmEQhqxlZ9uqfjQMQDOHOPld7PsCd8k5LWs8h5wjwJN7MgnAn768F2sDxEP4eNFQ==", + "dev": true, + "requires": { + "@rollup/pluginutils": "^3.1.0", + "estree-walker": "^2.0.1", + "magic-string": "^0.25.7" + }, + "dependencies": { + "estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "dev": true + } + } + }, + "@rollup/plugin-json": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-json/-/plugin-json-4.1.0.tgz", + "integrity": "sha512-yfLbTdNS6amI/2OpmbiBoW12vngr5NW2jCJVZSBEz+H5KfUJZ2M7sDjk0U6GOOdCWFVScShte29o9NezJ53TPw==", + "dev": true, + "requires": { + "@rollup/pluginutils": "^3.0.8" + } + }, + "@rollup/plugin-node-resolve": { + "version": "11.2.1", + "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-11.2.1.tgz", + "integrity": "sha512-yc2n43jcqVyGE2sqV5/YCmocy9ArjVAP/BeXyTtADTBBX6V0e5UMqwO8CdQ0kzjb6zu5P1qMzsScCMRvE9OlVg==", + "dev": true, + "requires": { + "@rollup/pluginutils": "^3.1.0", + "@types/resolve": "1.17.1", + "builtin-modules": "^3.1.0", + "deepmerge": "^4.2.2", + "is-module": "^1.0.0", + "resolve": "^1.19.0" + } + }, + "@rollup/plugin-replace": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/@rollup/plugin-replace/-/plugin-replace-2.4.2.tgz", + "integrity": "sha512-IGcu+cydlUMZ5En85jxHH4qj2hta/11BHq95iHEyb2sbgiN0eCdzvUcHw5gt9pBL5lTi4JDYJ1acCoMGpTvEZg==", + "dev": true, + "requires": { + "@rollup/pluginutils": "^3.1.0", + "magic-string": "^0.25.7" + } + }, + "@rollup/pluginutils": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.1.0.tgz", + "integrity": "sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==", + "dev": true, + "requires": { + "@types/estree": "0.0.39", + "estree-walker": "^1.0.1", + "picomatch": "^2.2.2" + } + }, + "@sindresorhus/is": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.4.0.tgz", + "integrity": "sha512-QppPM/8l3Mawvh4rn9CNEYIU9bxpXUCRMaX9yUpvBk1nMKusLKpfXGDEKExKaPhLzcn3lzil7pR6rnJ11HgeRQ==", + "dev": true + }, + "@snowpack/plugin-dotenv": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@snowpack/plugin-dotenv/-/plugin-dotenv-2.2.0.tgz", + "integrity": "sha512-/gj91mHz9iPi7e393sibVfpm4jrG7hqZytgkfiscOIWJ8Y838D0jX1JFXu9IAThZz0IEKTLpb74d5A7pM00HVg==", + "dev": true, + "requires": { + "dotenv": "^8.2.0", + "dotenv-expand": "^5.1.0" + } + }, + "@snowpack/plugin-postcss": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/@snowpack/plugin-postcss/-/plugin-postcss-1.4.3.tgz", + "integrity": "sha512-RJGYagse6Pi86Bqm8vPukhCwFVa92VIB81qP3PXPQ/ITQy5gVWDYi4oU+r1A6hsEZ9scUNZevfw6ISya+oiMNQ==", + "dev": true, + "requires": { + "minimatch": "^3.0.4", + "normalize-path": "^3.0.0", + "postcss-load-config": "^3.0.1", + "workerpool": "^6.1.2" + } + }, + "@snowpack/plugin-react-refresh": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@snowpack/plugin-react-refresh/-/plugin-react-refresh-2.5.0.tgz", + "integrity": "sha512-3rYkwayAA+65IIYLXMEFqQwtBGbII9IidMJo1yXuj35kTEg9TdZrofoqcHaSts2sv2Nz0TD6v7BWRPdvCU0uIw==", + "dev": true, + "requires": { + "@babel/core": "^7.0.0", + "@babel/plugin-syntax-class-properties": "^7.10.0", + "react-refresh": "^0.9.0" + } + }, + "@snowpack/plugin-typescript": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@snowpack/plugin-typescript/-/plugin-typescript-1.2.1.tgz", + "integrity": "sha512-wU+JNaMVkqGsqTaUY7TnEMhGt/3URTgA9dpMCtZX6wn/ceA7Gwlmue/sOLynf0OTNLygHPvjiQECQYkEi3LTtg==", + "dev": true, + "requires": { + "execa": "^5.0.0", + "npm-run-path": "^4.0.1" + } + }, + "@snowpack/web-test-runner-plugin": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/@snowpack/web-test-runner-plugin/-/web-test-runner-plugin-0.2.2.tgz", + "integrity": "sha512-I7KC8BAcgRWZAg53w7Uq3UDY9hcn1ZGvmA+MjPqvgQXvKbwXfH0+T1nyPQmKUgYR1If99Vk4GnFscDZtaGbZCg==", + "dev": true, + "requires": {} + }, + "@szmarczak/http-timer": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-4.0.6.tgz", + "integrity": "sha512-4BAffykYOgO+5nzBWYwE3W90sBgLJoUPRWWcL8wlyiM8IB8ipJz3UMJ9KXQd1RKQXpKp8Tutn80HZtWsu2u76w==", + "dev": true, + "requires": { + "defer-to-connect": "^2.0.0" + } + }, + "@tailwindcss/forms": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@tailwindcss/forms/-/forms-0.4.0.tgz", + "integrity": "sha512-DeaQBx6EgEeuZPQACvC+mKneJsD8am1uiJugjgQK1+/Vt+Ai0GpFBC2T2fqnUad71WgOxyrZPE6BG1VaI6YqfQ==", + "dev": true, + "requires": { + "mini-svg-data-uri": "^1.2.3" + } + }, + "@testing-library/dom": { + "version": "7.31.2", + "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-7.31.2.tgz", + "integrity": "sha512-3UqjCpey6HiTZT92vODYLPxTBWlM8ZOOjr3LX5F37/VRipW2M1kX6I/Cm4VXzteZqfGfagg8yXywpcOgQBlNsQ==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.10.4", + "@babel/runtime": "^7.12.5", + "@types/aria-query": "^4.2.0", + "aria-query": "^4.2.2", + "chalk": "^4.1.0", + "dom-accessibility-api": "^0.5.6", + "lz-string": "^1.4.4", + "pretty-format": "^26.6.2" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "@testing-library/react": { + "version": "11.2.7", + "resolved": "https://registry.npmjs.org/@testing-library/react/-/react-11.2.7.tgz", + "integrity": "sha512-tzRNp7pzd5QmbtXNG/mhdcl7Awfu/Iz1RaVHY75zTdOkmHCuzMhRL83gWHSgOAcjS3CCbyfwUHMZgRJb4kAfpA==", + "dev": true, + "requires": { + "@babel/runtime": "^7.12.5", + "@testing-library/dom": "^7.28.1" + } + }, + "@tootallnate/once": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz", + "integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==", + "dev": true + }, + "@types/accepts": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/@types/accepts/-/accepts-1.3.5.tgz", + "integrity": "sha512-jOdnI/3qTpHABjM5cx1Hc0sKsPoYCp+DP/GJRGtDlPd7fiV9oXGGIcjW/ZOxLIvjGz8MA+uMZI9metHlgqbgwQ==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, + "@types/aria-query": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-4.2.2.tgz", + "integrity": "sha512-HnYpAE1Y6kRyKM/XkEuiRQhTHvkzMBurTHnpFLYLBGPIylZNPs9jJcuOOYWxPLJCSEtmZT0Y8rHDokKN7rRTig==", + "dev": true + }, + "@types/babel__code-frame": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/@types/babel__code-frame/-/babel__code-frame-7.0.3.tgz", + "integrity": "sha512-2TN6oiwtNjOezilFVl77zwdNPwQWaDBBCCWWxyo1ctiO3vAtd7H/aB/CBJdw9+kqq3+latD0SXoedIuHySSZWw==", + "dev": true + }, + "@types/body-parser": { + "version": "1.19.2", + "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.2.tgz", + "integrity": "sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==", + "dev": true, + "requires": { + "@types/connect": "*", + "@types/node": "*" + } + }, + "@types/cacheable-request": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.2.tgz", + "integrity": "sha512-B3xVo+dlKM6nnKTcmm5ZtY/OL8bOAOd2Olee9M1zft65ox50OzjEHW91sDiU9j6cvW8Ejg1/Qkf4xd2kugApUA==", + "dev": true, + "requires": { + "@types/http-cache-semantics": "*", + "@types/keyv": "*", + "@types/node": "*", + "@types/responselike": "*" + } + }, + "@types/chai": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.0.tgz", + "integrity": "sha512-/ceqdqeRraGolFTcfoXNiqjyQhZzbINDngeoAq9GoHa8PPK1yNzTaxWjA6BFWp5Ua9JpXEMSS4s5i9tS0hOJtw==", + "dev": true + }, + "@types/co-body": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@types/co-body/-/co-body-6.1.0.tgz", + "integrity": "sha512-3e0q2jyDAnx/DSZi0z2H0yoZ2wt5yRDZ+P7ymcMObvq0ufWRT4tsajyO+Q1VwVWiv9PRR4W3YEjEzBjeZlhF+w==", + "dev": true, + "requires": { + "@types/node": "*", + "@types/qs": "*" + } + }, + "@types/command-line-args": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@types/command-line-args/-/command-line-args-5.2.0.tgz", + "integrity": "sha512-UuKzKpJJ/Ief6ufIaIzr3A/0XnluX7RvFgwkV89Yzvm77wCh1kFaFmqN8XEnGcN62EuHdedQjEMb8mYxFLGPyA==", + "dev": true + }, + "@types/connect": { + "version": "3.4.35", + "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz", + "integrity": "sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, + "@types/content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/@types/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-0mPF08jn9zYI0n0Q/Pnz7C4kThdSt+6LD4amsrYDDpgBfrVWa3TcCOxKX1zkGgYniGagRv8heN2cbh+CAn+uuQ==", + "dev": true + }, + "@types/convert-source-map": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/@types/convert-source-map/-/convert-source-map-1.5.2.tgz", + "integrity": "sha512-tHs++ZeXer40kCF2JpE51Hg7t4HPa18B1b1Dzy96S0eCw8QKECNMYMfwa1edK/x8yCN0r4e6ewvLcc5CsVGkdg==", + "dev": true + }, + "@types/cookies": { + "version": "0.7.7", + "resolved": "https://registry.npmjs.org/@types/cookies/-/cookies-0.7.7.tgz", + "integrity": "sha512-h7BcvPUogWbKCzBR2lY4oqaZbO3jXZksexYJVFvkrFeLgbZjQkU4x8pRq6eg2MHXQhY0McQdqmmsxRWlVAHooA==", + "dev": true, + "requires": { + "@types/connect": "*", + "@types/express": "*", + "@types/keygrip": "*", + "@types/node": "*" + } + }, + "@types/debounce": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@types/debounce/-/debounce-1.2.1.tgz", + "integrity": "sha512-epMsEE85fi4lfmJUH/89/iV/LI+F5CvNIvmgs5g5jYFPfhO2S/ae8WSsLOKWdwtoaZw9Q2IhJ4tQ5tFCcS/4HA==", + "dev": true + }, + "@types/estree": { + "version": "0.0.39", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz", + "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==", + "dev": true + }, + "@types/express": { + "version": "4.17.13", + "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.13.tgz", + "integrity": "sha512-6bSZTPaTIACxn48l50SR+axgrqm6qXFIxrdAKaG6PaJk3+zuUr35hBlgT7vOmJcum+OEaIBLtHV/qloEAFITeA==", + "dev": true, + "requires": { + "@types/body-parser": "*", + "@types/express-serve-static-core": "^4.17.18", + "@types/qs": "*", + "@types/serve-static": "*" + } + }, + "@types/express-serve-static-core": { + "version": "4.17.28", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.28.tgz", + "integrity": "sha512-P1BJAEAW3E2DJUlkgq4tOL3RyMunoWXqbSCygWo5ZIWTjUgN1YnaXWW4VWl/oc8vs/XoYibEGBKP0uZyF4AHig==", + "dev": true, + "requires": { + "@types/node": "*", + "@types/qs": "*", + "@types/range-parser": "*" + } + }, + "@types/http-assert": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@types/http-assert/-/http-assert-1.5.3.tgz", + "integrity": "sha512-FyAOrDuQmBi8/or3ns4rwPno7/9tJTijVW6aQQjK02+kOQ8zmoNg2XJtAuQhvQcy1ASJq38wirX5//9J1EqoUA==", + "dev": true + }, + "@types/http-cache-semantics": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.1.tgz", + "integrity": "sha512-SZs7ekbP8CN0txVG2xVRH6EgKmEm31BOxA07vkFaETzZz1xh+cbt8BcI0slpymvwhx5dlFnQG2rTlPVQn+iRPQ==", + "dev": true + }, + "@types/http-errors": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-1.8.2.tgz", + "integrity": "sha512-EqX+YQxINb+MeXaIqYDASb6U6FCHbWjkj4a1CKDBks3d/QiB2+PqBLyO72vLDgAO1wUI4O+9gweRcQK11bTL/w==", + "dev": true + }, + "@types/istanbul-lib-coverage": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", + "integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==", + "dev": true + }, + "@types/istanbul-lib-report": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", + "integrity": "sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg==", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "*" + } + }, + "@types/istanbul-reports": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz", + "integrity": "sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw==", + "dev": true, + "requires": { + "@types/istanbul-lib-report": "*" + } + }, + "@types/keygrip": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@types/keygrip/-/keygrip-1.0.2.tgz", + "integrity": "sha512-GJhpTepz2udxGexqos8wgaBx4I/zWIDPh/KOGEwAqtuGDkOUJu5eFvwmdBX4AmB8Odsr+9pHCQqiAqDL/yKMKw==", + "dev": true + }, + "@types/keyv": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/@types/keyv/-/keyv-3.1.3.tgz", + "integrity": "sha512-FXCJgyyN3ivVgRoml4h94G/p3kY+u/B86La+QptcqJaWtBWtmc6TtkNfS40n9bIvyLteHh7zXOtgbobORKPbDg==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, + "@types/koa": { + "version": "2.13.4", + "resolved": "https://registry.npmjs.org/@types/koa/-/koa-2.13.4.tgz", + "integrity": "sha512-dfHYMfU+z/vKtQB7NUrthdAEiSvnLebvBjwHtfFmpZmB7em2N3WVQdHgnFq+xvyVgxW5jKDmjWfLD3lw4g4uTw==", + "dev": true, + "requires": { + "@types/accepts": "*", + "@types/content-disposition": "*", + "@types/cookies": "*", + "@types/http-assert": "*", + "@types/http-errors": "*", + "@types/keygrip": "*", + "@types/koa-compose": "*", + "@types/node": "*" + } + }, + "@types/koa-compose": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/@types/koa-compose/-/koa-compose-3.2.5.tgz", + "integrity": "sha512-B8nG/OoE1ORZqCkBVsup/AKcvjdgoHnfi4pZMn5UwAPCbhk/96xyv284eBYW8JlQbQ7zDmnpFr68I/40mFoIBQ==", + "dev": true, + "requires": { + "@types/koa": "*" + } + }, + "@types/mime": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.2.tgz", + "integrity": "sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw==", + "dev": true + }, + "@types/mocha": { + "version": "8.2.3", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-8.2.3.tgz", + "integrity": "sha512-ekGvFhFgrc2zYQoX4JeZPmVzZxw6Dtllga7iGHzfbYIYkAMUx/sAFP2GdFpLff+vdHXu5fl7WX9AT+TtqYcsyw==", + "dev": true + }, + "@types/node": { + "version": "17.0.14", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.14.tgz", + "integrity": "sha512-SbjLmERksKOGzWzPNuW7fJM7fk3YXVTFiZWB/Hs99gwhk+/dnrQRPBQjPW9aO+fi1tAffi9PrwFvsmOKmDTyng==", + "dev": true + }, + "@types/parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==", + "dev": true + }, + "@types/parse5": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/@types/parse5/-/parse5-6.0.3.tgz", + "integrity": "sha512-SuT16Q1K51EAVPz1K29DJ/sXjhSQ0zjvsypYJ6tlwVsRV9jwW5Adq2ch8Dq8kDBCkYnELS7N7VNCSB5nC56t/g==", + "dev": true + }, + "@types/prop-types": { + "version": "15.7.4", + "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.4.tgz", + "integrity": "sha512-rZ5drC/jWjrArrS8BR6SIr4cWpW09RNTYt9AMZo3Jwwif+iacXAqgVjm0B0Bv/S1jhDXKHqRVNCbACkJ89RAnQ==", + "dev": true + }, + "@types/qs": { + "version": "6.9.7", + "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz", + "integrity": "sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==", + "dev": true + }, + "@types/range-parser": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.4.tgz", + "integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==", + "dev": true + }, + "@types/react": { + "version": "17.0.39", + "resolved": "https://registry.npmjs.org/@types/react/-/react-17.0.39.tgz", + "integrity": "sha512-UVavlfAxDd/AgAacMa60Azl7ygyQNRwC/DsHZmKgNvPmRR5p70AJ5Q9EAmL2NWOJmeV+vVUI4IAP7GZrN8h8Ug==", + "dev": true, + "requires": { + "@types/prop-types": "*", + "@types/scheduler": "*", + "csstype": "^3.0.2" + } + }, + "@types/react-dom": { + "version": "17.0.11", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-17.0.11.tgz", + "integrity": "sha512-f96K3k+24RaLGVu/Y2Ng3e1EbZ8/cVJvypZWd7cy0ofCBaf2lcM46xNhycMZ2xGwbBjRql7hOlZ+e2WlJ5MH3Q==", + "dev": true, + "requires": { + "@types/react": "*" + } + }, + "@types/resolve": { + "version": "1.17.1", + "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.17.1.tgz", + "integrity": "sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, + "@types/responselike": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@types/responselike/-/responselike-1.0.0.tgz", + "integrity": "sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, + "@types/scheduler": { + "version": "0.16.2", + "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.2.tgz", + "integrity": "sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew==", + "dev": true + }, + "@types/serve-static": { + "version": "1.13.10", + "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.13.10.tgz", + "integrity": "sha512-nCkHGI4w7ZgAdNkrEu0bv+4xNV/XDqW+DydknebMOQwkpDGx8G+HTlj7R7ABI8i8nKxVw0wtKPi1D+lPOkh4YQ==", + "dev": true, + "requires": { + "@types/mime": "^1", + "@types/node": "*" + } + }, + "@types/snowpack-env": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/@types/snowpack-env/-/snowpack-env-2.3.4.tgz", + "integrity": "sha512-zYzMb2aMyzXW5VgOQHy+FgI8N5tLFb+tIsUqk35CIgSr9pT4pji2GR8BCOTMdniusVuRHIp/DaYQNQGYGLVZHQ==", + "dev": true + }, + "@types/ws": { + "version": "7.4.7", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-7.4.7.tgz", + "integrity": "sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, + "@types/yargs": { + "version": "15.0.14", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.14.tgz", + "integrity": "sha512-yEJzHoxf6SyQGhBhIYGXQDSCkJjB6HohDShto7m8vaKg9Yp0Yn8+71J9eakh2bnPg6BfsH9PRMhiRTZnd4eXGQ==", + "dev": true, + "requires": { + "@types/yargs-parser": "*" + } + }, + "@types/yargs-parser": { + "version": "20.2.1", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-20.2.1.tgz", + "integrity": "sha512-7tFImggNeNBVMsn0vLrpn1H1uPrUBdnARPTpZoitY37ZrdJREzf7I16tMrlK3hen349gr1NYh8CmZQa7CTG6Aw==", + "dev": true + }, + "@types/yauzl": { + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.9.2.tgz", + "integrity": "sha512-8uALY5LTvSuHgloDVUvWP3pIauILm+8/0pDMokuDYIoNsOkSwd5AiHBTSEJjKTDcZr5z8UpgOWZkxBF4iJftoA==", + "dev": true, + "optional": true, + "requires": { + "@types/node": "*" + } + }, + "@web/browser-logs": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/@web/browser-logs/-/browser-logs-0.2.5.tgz", + "integrity": "sha512-Qxo1wY/L7yILQqg0jjAaueh+tzdORXnZtxQgWH23SsTCunz9iq9FvsZa8Q5XlpjnZ3vLIsFEuEsCMqFeohJnEg==", + "dev": true, + "requires": { + "errorstacks": "^2.2.0" + } + }, + "@web/config-loader": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@web/config-loader/-/config-loader-0.1.3.tgz", + "integrity": "sha512-XVKH79pk4d3EHRhofete8eAnqto1e8mCRAqPV00KLNFzCWSe8sWmLnqKCqkPNARC6nksMaGrATnA5sPDRllMpQ==", + "dev": true, + "requires": { + "semver": "^7.3.4" + }, + "dependencies": { + "semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + } + } + }, + "@web/dev-server": { + "version": "0.1.29", + "resolved": "https://registry.npmjs.org/@web/dev-server/-/dev-server-0.1.29.tgz", + "integrity": "sha512-oDz6vC9JEDZd4ZTno+SV57zCpsQl9v5LOkGuWGyei5gx5xu8NVDvh2IgTugz6DhZnffsSE6Zi0ubs+AhonLnGA==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.12.11", + "@types/command-line-args": "^5.0.0", + "@web/config-loader": "^0.1.3", + "@web/dev-server-core": "^0.3.17", + "@web/dev-server-rollup": "^0.3.13", + "camelcase": "^6.2.0", + "command-line-args": "^5.1.1", + "command-line-usage": "^6.1.1", + "debounce": "^1.2.0", + "deepmerge": "^4.2.2", + "ip": "^1.1.5", + "nanocolors": "^0.2.1", + "open": "^8.0.2", + "portfinder": "^1.0.28" + } + }, + "@web/dev-server-core": { + "version": "0.3.17", + "resolved": "https://registry.npmjs.org/@web/dev-server-core/-/dev-server-core-0.3.17.tgz", + "integrity": "sha512-vN1dwQ8yDHGiAvCeUo9xFfjo+pFl8TW+pON7k9kfhbegrrB8CKhJDUxmHbZsyQUmjf/iX57/LhuWj1xGhRL8AA==", + "dev": true, + "requires": { + "@types/koa": "^2.11.6", + "@types/ws": "^7.4.0", + "@web/parse5-utils": "^1.2.0", + "chokidar": "^3.4.3", + "clone": "^2.1.2", + "es-module-lexer": "^0.9.0", + "get-stream": "^6.0.0", + "is-stream": "^2.0.0", + "isbinaryfile": "^4.0.6", + "koa": "^2.13.0", + "koa-etag": "^4.0.0", + "koa-send": "^5.0.1", + "koa-static": "^5.0.0", + "lru-cache": "^6.0.0", + "mime-types": "^2.1.27", + "parse5": "^6.0.1", + "picomatch": "^2.2.2", + "ws": "^7.4.2" + } + }, + "@web/dev-server-rollup": { + "version": "0.3.15", + "resolved": "https://registry.npmjs.org/@web/dev-server-rollup/-/dev-server-rollup-0.3.15.tgz", + "integrity": "sha512-hhxvBmNIY19vXeocYB1IBOuhpVpy1L7jbwBarmvC0QJKZsgkxssNTzXJ8iga70c2+H0c/rBz1xUaKuAcov0uOA==", + "dev": true, + "requires": { + "@rollup/plugin-node-resolve": "^11.0.1", + "@web/dev-server-core": "^0.3.16", + "nanocolors": "^0.2.1", + "parse5": "^6.0.1", + "rollup": "^2.66.1", + "whatwg-url": "^11.0.0" + } + }, + "@web/parse5-utils": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@web/parse5-utils/-/parse5-utils-1.3.0.tgz", + "integrity": "sha512-Pgkx3ECc8EgXSlS5EyrgzSOoUbM6P8OKS471HLAyvOBcP1NCBn0to4RN/OaKASGq8qa3j+lPX9H14uA5AHEnQg==", + "dev": true, + "requires": { + "@types/parse5": "^6.0.1", + "parse5": "^6.0.1" + } + }, + "@web/test-runner": { + "version": "0.13.27", + "resolved": "https://registry.npmjs.org/@web/test-runner/-/test-runner-0.13.27.tgz", + "integrity": "sha512-yVhXK9sPJE2VQs1/KPTIeQvUxh+02OZkn+tgcr0+W8ovvrFD4ucF2X26cpeOTuD+Y67ERUi/EopIze3aelw6sg==", + "dev": true, + "requires": { + "@web/browser-logs": "^0.2.2", + "@web/config-loader": "^0.1.3", + "@web/dev-server": "^0.1.24", + "@web/test-runner-chrome": "^0.10.7", + "@web/test-runner-commands": "^0.6.0", + "@web/test-runner-core": "^0.10.22", + "@web/test-runner-mocha": "^0.7.5", + "camelcase": "^6.2.0", + "command-line-args": "^5.1.1", + "command-line-usage": "^6.1.1", + "convert-source-map": "^1.7.0", + "diff": "^5.0.0", + "globby": "^11.0.1", + "nanocolors": "^0.2.1", + "portfinder": "^1.0.28", + "source-map": "^0.7.3" + }, + "dependencies": { + "source-map": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", + "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==", + "dev": true + } + } + }, + "@web/test-runner-chrome": { + "version": "0.10.7", + "resolved": "https://registry.npmjs.org/@web/test-runner-chrome/-/test-runner-chrome-0.10.7.tgz", + "integrity": "sha512-DKJVHhHh3e/b6/erfKOy0a4kGfZ47qMoQRgROxi9T4F9lavEY3E5/MQ7hapHFM2lBF4vDrm+EWjtBdOL8o42tw==", + "dev": true, + "requires": { + "@web/test-runner-core": "^0.10.20", + "@web/test-runner-coverage-v8": "^0.4.8", + "chrome-launcher": "^0.15.0", + "puppeteer-core": "^13.1.3" + } + }, + "@web/test-runner-commands": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/@web/test-runner-commands/-/test-runner-commands-0.6.1.tgz", + "integrity": "sha512-P4aQqp0duumeGdGxQ8TwLnplkrXzpLqb47eSEEqBRS//C1H7s6VskaqEng+k0dbk+cSpEa4RuZGY/G5k8aTjTw==", + "dev": true, + "requires": { + "@web/test-runner-core": "^0.10.20", + "mkdirp": "^1.0.4" + } + }, + "@web/test-runner-core": { + "version": "0.10.23", + "resolved": "https://registry.npmjs.org/@web/test-runner-core/-/test-runner-core-0.10.23.tgz", + "integrity": "sha512-02qig6GufCMdzGEXD1HT4uy1pxBhHeEZ0Yb4HqenbW2b2/8qPk983dYl1OmUwzFPPMIHcvCjpl9u5LxF464+Ng==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.12.11", + "@types/babel__code-frame": "^7.0.2", + "@types/co-body": "^6.1.0", + "@types/convert-source-map": "^1.5.1", + "@types/debounce": "^1.2.0", + "@types/istanbul-lib-coverage": "^2.0.3", + "@types/istanbul-reports": "^3.0.0", + "@web/browser-logs": "^0.2.1", + "@web/dev-server-core": "^0.3.16", + "chokidar": "^3.4.3", + "cli-cursor": "^3.1.0", + "co-body": "^6.1.0", + "convert-source-map": "^1.7.0", + "debounce": "^1.2.0", + "dependency-graph": "^0.11.0", + "globby": "^11.0.1", + "ip": "^1.1.5", + "istanbul-lib-coverage": "^3.0.0", + "istanbul-lib-report": "^3.0.0", + "istanbul-reports": "^3.0.2", + "log-update": "^4.0.0", + "nanocolors": "^0.2.1", + "nanoid": "^3.1.25", + "open": "^8.0.2", + "picomatch": "^2.2.2", + "source-map": "^0.7.3" + }, + "dependencies": { + "source-map": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", + "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==", + "dev": true + } + } + }, + "@web/test-runner-coverage-v8": { + "version": "0.4.8", + "resolved": "https://registry.npmjs.org/@web/test-runner-coverage-v8/-/test-runner-coverage-v8-0.4.8.tgz", + "integrity": "sha512-Ib0AscR8Xf9E/V7rf3XOVQTe4vKIbwSTupxV1xGgzj3x4RKUuMUg9FLz9EigZ5iN0mOzZKDllyRS523hbdhDtA==", + "dev": true, + "requires": { + "@web/test-runner-core": "^0.10.20", + "istanbul-lib-coverage": "^3.0.0", + "picomatch": "^2.2.2", + "v8-to-istanbul": "^8.0.0" + } + }, + "@web/test-runner-mocha": { + "version": "0.7.5", + "resolved": "https://registry.npmjs.org/@web/test-runner-mocha/-/test-runner-mocha-0.7.5.tgz", + "integrity": "sha512-12/OBq6efPCAvJpcz3XJs2OO5nHe7GtBibZ8Il1a0QtsGpRmuJ4/m1EF0Fj9f6KHg7JdpGo18A37oE+5hXjHwg==", + "dev": true, + "requires": { + "@types/mocha": "^8.2.0", + "@web/test-runner-core": "^0.10.20" + } + }, + "abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", + "dev": true + }, + "accepts": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "dev": true, + "requires": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + } + }, + "acorn": { + "version": "7.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", + "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", + "dev": true + }, + "acorn-node": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/acorn-node/-/acorn-node-1.8.2.tgz", + "integrity": "sha512-8mt+fslDufLYntIoPAaIMUe/lrbrehIiwmR3t2k9LljIzoigEPF27eLk2hy8zSGzmR/ogr7zbRKINMo1u0yh5A==", + "dev": true, + "requires": { + "acorn": "^7.0.0", + "acorn-walk": "^7.0.0", + "xtend": "^4.0.2" + } + }, + "acorn-walk": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-7.2.0.tgz", + "integrity": "sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==", + "dev": true + }, + "address": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/address/-/address-1.1.2.tgz", + "integrity": "sha512-aT6camzM4xEA54YVJYSqxz1kv4IHnQZRtThJJHhUMRExaU5spC7jX5ugSwTaTgJliIgs4VhZOk7htClvQ/LmRA==", + "dev": true + }, + "agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "dev": true, + "requires": { + "debug": "4" + } + }, + "agentkeepalive": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.2.0.tgz", + "integrity": "sha512-0PhAp58jZNw13UJv7NVdTGb0ZcghHUb3DrZ046JiiJY/BOaTTpbwdHq2VObPCBV8M2GPh7sgrJ3AQ8Ey468LJw==", + "dev": true, + "requires": { + "debug": "^4.1.0", + "depd": "^1.1.2", + "humanize-ms": "^1.2.1" + }, + "dependencies": { + "depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", + "dev": true + } + } + }, + "aggregate-error": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", + "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", + "dev": true, + "requires": { + "clean-stack": "^2.0.0", + "indent-string": "^4.0.0" + } + }, + "ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "ansi-escapes": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", + "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", + "dev": true, + "requires": { + "type-fest": "^0.21.3" + } + }, + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "anymatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", + "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", + "dev": true, + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, + "aproba": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", + "dev": true + }, + "are-we-there-yet": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.7.tgz", + "integrity": "sha512-nxwy40TuMiUGqMyRHgCSWZ9FM4VAoRP4xUYSTv5ImRog+h9yISPbVH7H8fASCIzYn9wlEv4zvFL7uKDMCFQm3g==", + "dev": true, + "requires": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" + } + }, + "arg": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/arg/-/arg-5.0.1.tgz", + "integrity": "sha512-e0hDa9H2Z9AwFkk2qDlwhoMYE4eToKarchkQHovNdLTCYMHZHeRjI71crOh+dio4K6u1IcwubQqo79Ga4CyAQA==", + "dev": true + }, + "aria-query": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-4.2.2.tgz", + "integrity": "sha512-o/HelwhuKpTj/frsOsbNLNgnNGVIFsVP/SW2BSF14gVl7kAfMOJ6/8wUAUvG1R1NHKrfG+2sHZTu0yauT1qBrA==", + "dev": true, + "requires": { + "@babel/runtime": "^7.10.2", + "@babel/runtime-corejs3": "^7.10.2" + } + }, + "array-back": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/array-back/-/array-back-3.1.0.tgz", + "integrity": "sha512-TkuxA4UCOvxuDK6NZYXCalszEzj+TLszyASooky+i742l9TqsOdYCMJJupxRic61hwquNtppB3hgcuq9SVSH1Q==", + "dev": true + }, + "array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true + }, + "asap": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", + "integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=", + "dev": true + }, + "asn1": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz", + "integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==", + "dev": true, + "requires": { + "safer-buffer": "~2.1.0" + } + }, + "assert": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/assert/-/assert-1.5.0.tgz", + "integrity": "sha512-EDsgawzwoun2CZkCgtxJbv392v4nbk9XDD06zI+kQYoBM/3RBWLlEyJARDOmhAAosBjWACEkKL6S+lIZtcAubA==", + "dev": true, + "requires": { + "object-assign": "^4.1.1", + "util": "0.10.3" + } + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "dev": true + }, + "assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "dev": true + }, + "astral-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", + "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", + "dev": true + }, + "async": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", + "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==", + "dev": true, + "requires": { + "lodash": "^4.17.14" + } + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "dev": true + }, + "automation-events": { + "version": "4.0.12", + "resolved": "https://registry.npmjs.org/automation-events/-/automation-events-4.0.12.tgz", + "integrity": "sha512-7tu7q/rw3vFuAwjBoarCGql3V0HkC5QAbZUYhOblxxkHzdLUTjVotm0iaIRwiCSqxMeoFK64LrgaSCuSZguvGA==", + "requires": { + "@babel/runtime": "^7.16.7", + "tslib": "^2.3.1" + } + }, + "autoprefixer": { + "version": "10.4.2", + "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.2.tgz", + "integrity": "sha512-9fOPpHKuDW1w/0EKfRmVnxTDt8166MAnLI3mgZ1JCnhNtYWxcJ6Ud5CO/AVOZi/AvFa8DY9RTy3h3+tFBlrrdQ==", + "dev": true, + "requires": { + "browserslist": "^4.19.1", + "caniuse-lite": "^1.0.30001297", + "fraction.js": "^4.1.2", + "normalize-range": "^0.1.2", + "picocolors": "^1.0.0", + "postcss-value-parser": "^4.2.0" + } + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", + "dev": true + }, + "aws4": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz", + "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==", + "dev": true + }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "dev": true + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "dev": true, + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "big-integer": { + "version": "1.6.51", + "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.51.tgz", + "integrity": "sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg==", + "dev": true + }, + "bin-links": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/bin-links/-/bin-links-2.3.0.tgz", + "integrity": "sha512-JzrOLHLwX2zMqKdyYZjkDgQGT+kHDkIhv2/IK2lJ00qLxV4TmFoHi8drDBb6H5Zrz1YfgHkai4e2MGPqnoUhqA==", + "dev": true, + "requires": { + "cmd-shim": "^4.0.1", + "mkdirp-infer-owner": "^2.0.0", + "npm-normalize-package-bin": "^1.0.0", + "read-cmd-shim": "^2.0.0", + "rimraf": "^3.0.0", + "write-file-atomic": "^3.0.3" + } + }, + "binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "dev": true + }, + "bl": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "dev": true, + "requires": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + }, + "dependencies": { + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + } + } + }, + "boolbase": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", + "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=", + "dev": true + }, + "bplist-parser": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.1.1.tgz", + "integrity": "sha1-1g1dzCDLptx+HymbNdPh+V2vuuY=", + "dev": true, + "requires": { + "big-integer": "^1.6.7" + } + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, + "browserslist": { + "version": "4.19.1", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.19.1.tgz", + "integrity": "sha512-u2tbbG5PdKRTUoctO3NBD8FQ5HdPh1ZXPHzp1rwaa5jTc+RV9/+RlWiAIKmjRPQF+xbGM9Kklj5bZQFa2s/38A==", + "dev": true, + "requires": { + "caniuse-lite": "^1.0.30001286", + "electron-to-chromium": "^1.4.17", + "escalade": "^3.1.1", + "node-releases": "^2.0.1", + "picocolors": "^1.0.0" + } + }, + "buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "dev": true, + "requires": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "buffer-crc32": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", + "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=", + "dev": true + }, + "bufferutil": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.6.tgz", + "integrity": "sha512-jduaYOYtnio4aIAyc6UbvPCVcgq7nYpVnucyxr6eCYg/Woad9Hf/oxxBRDnGGjPfjUm6j5O/uBWhIu4iLebFaw==", + "dev": true, + "requires": { + "node-gyp-build": "^4.3.0" + } + }, + "builtin-modules": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.2.0.tgz", + "integrity": "sha512-lGzLKcioL90C7wMczpkY0n/oART3MbBa8R9OFGE1rJxoVI86u4WAGfEk8Wjv10eKSyTHVGkSo3bvBylCEtk7LA==", + "dev": true + }, + "builtins": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/builtins/-/builtins-1.0.3.tgz", + "integrity": "sha1-y5T662HIaWRR2zZTThQi+U8K7og=", + "dev": true + }, + "bytes": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.1.tgz", + "integrity": "sha512-dWe4nWO/ruEOY7HkUJ5gFt1DCFV9zPRoJr8pV0/ASQermOZjtq8jMjOprC0Kd10GLN+l7xaUPvxzJFWtxGu8Fg==", + "dev": true + }, + "cacache": { + "version": "15.3.0", + "resolved": "https://registry.npmjs.org/cacache/-/cacache-15.3.0.tgz", + "integrity": "sha512-VVdYzXEn+cnbXpFgWs5hTT7OScegHVmLhJIR8Ufqk3iFD6A6j5iSX1KuBTfNEv4tdJWE2PzA6IVFtcLC7fN9wQ==", + "dev": true, + "requires": { + "@npmcli/fs": "^1.0.0", + "@npmcli/move-file": "^1.0.1", + "chownr": "^2.0.0", + "fs-minipass": "^2.0.0", + "glob": "^7.1.4", + "infer-owner": "^1.0.4", + "lru-cache": "^6.0.0", + "minipass": "^3.1.1", + "minipass-collect": "^1.0.2", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.2", + "mkdirp": "^1.0.3", + "p-map": "^4.0.0", + "promise-inflight": "^1.0.1", + "rimraf": "^3.0.2", + "ssri": "^8.0.1", + "tar": "^6.0.2", + "unique-filename": "^1.1.1" + } + }, + "cache-content-type": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/cache-content-type/-/cache-content-type-1.0.1.tgz", + "integrity": "sha512-IKufZ1o4Ut42YUrZSo8+qnMTrFuKkvyoLXUywKz9GJ5BrhOFGhLdkx9sG4KAnVvbY6kEcSFjLQul+DVmBm2bgA==", + "dev": true, + "requires": { + "mime-types": "^2.1.18", + "ylru": "^1.2.0" + } + }, + "cacheable-lookup": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-5.0.4.tgz", + "integrity": "sha512-2/kNscPhpcxrOigMZzbiWF7dz8ilhb/nIHU3EyZiXWXpeq/au8qJ8VhdftMkty3n7Gj6HIGalQG8oiBNB3AJgA==", + "dev": true + }, + "cacheable-request": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-7.0.2.tgz", + "integrity": "sha512-pouW8/FmiPQbuGpkXQ9BAPv/Mo5xDGANgSNXzTzJ8DrKGuXOssM4wIQRjfanNRh3Yu5cfYPvcorqbhg2KIJtew==", + "dev": true, + "requires": { + "clone-response": "^1.0.2", + "get-stream": "^5.1.0", + "http-cache-semantics": "^4.0.0", + "keyv": "^4.0.0", + "lowercase-keys": "^2.0.0", + "normalize-url": "^6.0.1", + "responselike": "^2.0.0" + }, + "dependencies": { + "get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + } + } + }, + "cachedir": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/cachedir/-/cachedir-2.3.0.tgz", + "integrity": "sha512-A+Fezp4zxnit6FanDmv9EqXNAi3vt9DWp51/71UEhXukb7QUuvtv9344h91dyAxuTLoSYJFU299qzR3tzwPAhw==", + "dev": true + }, + "call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dev": true, + "requires": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + } + }, + "callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true + }, + "camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "dev": true + }, + "camelcase-css": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/camelcase-css/-/camelcase-css-2.0.1.tgz", + "integrity": "sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA==", + "dev": true + }, + "caniuse-lite": { + "version": "1.0.30001307", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001307.tgz", + "integrity": "sha512-+MXEMczJ4FuxJAUp0jvAl6Df0NI/OfW1RWEE61eSmzS7hw6lz4IKutbhbXendwq8BljfFuHtu26VWsg4afQ7Ng==", + "dev": true + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", + "dev": true + }, + "chai": { + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.6.tgz", + "integrity": "sha512-bbcp3YfHCUzMOvKqsztczerVgBKSsEijCySNlHHbX3VG1nskvqjz5Rfso1gGwD6w6oOV3eI60pKuMOV5MV7p3Q==", + "dev": true, + "requires": { + "assertion-error": "^1.1.0", + "check-error": "^1.0.2", + "deep-eql": "^3.0.1", + "get-func-name": "^2.0.0", + "loupe": "^2.3.1", + "pathval": "^1.1.1", + "type-detect": "^4.0.5" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "check-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", + "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", + "dev": true + }, + "cheerio": { + "version": "1.0.0-rc.10", + "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.10.tgz", + "integrity": "sha512-g0J0q/O6mW8z5zxQ3A8E8J1hUgp4SMOvEoW/x84OwyHKe/Zccz83PVT4y5Crcr530FV6NgmKI1qvGTKVl9XXVw==", + "dev": true, + "requires": { + "cheerio-select": "^1.5.0", + "dom-serializer": "^1.3.2", + "domhandler": "^4.2.0", + "htmlparser2": "^6.1.0", + "parse5": "^6.0.1", + "parse5-htmlparser2-tree-adapter": "^6.0.1", + "tslib": "^2.2.0" + } + }, + "cheerio-select": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/cheerio-select/-/cheerio-select-1.5.0.tgz", + "integrity": "sha512-qocaHPv5ypefh6YNxvnbABM07KMxExbtbfuJoIie3iZXX1ERwYmJcIiRrr9H05ucQP1k28dav8rpdDgjQd8drg==", + "dev": true, + "requires": { + "css-select": "^4.1.3", + "css-what": "^5.0.1", + "domelementtype": "^2.2.0", + "domhandler": "^4.2.0", + "domutils": "^2.7.0" + } + }, + "chokidar": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "dev": true, + "requires": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "fsevents": "~2.3.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + } + }, + "chownr": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", + "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", + "dev": true + }, + "chrome-launcher": { + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/chrome-launcher/-/chrome-launcher-0.15.0.tgz", + "integrity": "sha512-ZQqX5kb9H0+jy1OqLnWampfocrtSZaGl7Ny3F9GRha85o4odbL8x55paUzh51UC7cEmZ5obp3H2Mm70uC2PpRA==", + "dev": true, + "requires": { + "@types/node": "*", + "escape-string-regexp": "^4.0.0", + "is-wsl": "^2.2.0", + "lighthouse-logger": "^1.0.0" + }, + "dependencies": { + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true + } + } + }, + "cjs-module-lexer": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.2.2.tgz", + "integrity": "sha512-cOU9usZw8/dXIXKtwa8pM0OTJQuJkxMN6w30csNRUerHfeQ5R6U3kkU/FtJeIf3M202OHfY2U8ccInBG7/xogA==", + "dev": true + }, + "clean-stack": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", + "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", + "dev": true + }, + "cli-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", + "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", + "dev": true, + "requires": { + "restore-cursor": "^3.1.0" + } + }, + "cli-spinners": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.6.1.tgz", + "integrity": "sha512-x/5fWmGMnbKQAaNwN+UZlV79qBLM9JFnJuJ03gIi5whrob0xV0ofNVHy9DhwGdsMJQc2OKv0oGmLzvaqvAVv+g==", + "dev": true + }, + "clone": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", + "integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=", + "dev": true + }, + "clone-response": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz", + "integrity": "sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=", + "dev": true, + "requires": { + "mimic-response": "^1.0.0" + } + }, + "cmd-shim": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/cmd-shim/-/cmd-shim-4.1.0.tgz", + "integrity": "sha512-lb9L7EM4I/ZRVuljLPEtUJOP+xiQVknZ4ZMpMgEp4JzNldPb27HU03hi6K1/6CoIuit/Zm/LQXySErFeXxDprw==", + "dev": true, + "requires": { + "mkdirp-infer-owner": "^2.0.0" + } + }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", + "dev": true + }, + "co-body": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/co-body/-/co-body-6.1.0.tgz", + "integrity": "sha512-m7pOT6CdLN7FuXUcpuz/8lfQ/L77x8SchHCF4G0RBTJO20Wzmhn5Sp4/5WsKy8OSpifBSUrmg83qEqaDHdyFuQ==", + "dev": true, + "requires": { + "inflation": "^2.0.0", + "qs": "^6.5.2", + "raw-body": "^2.3.3", + "type-is": "^1.6.16" + } + }, + "code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", + "dev": true + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dev": true, + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "command-line-args": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/command-line-args/-/command-line-args-5.2.1.tgz", + "integrity": "sha512-H4UfQhZyakIjC74I9d34fGYDwk3XpSr17QhEd0Q3I9Xq1CETHo4Hcuo87WyWHpAF1aSLjLRf5lD9ZGX2qStUvg==", + "dev": true, + "requires": { + "array-back": "^3.1.0", + "find-replace": "^3.0.0", + "lodash.camelcase": "^4.3.0", + "typical": "^4.0.0" + } + }, + "command-line-usage": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/command-line-usage/-/command-line-usage-6.1.1.tgz", + "integrity": "sha512-F59pEuAR9o1SF/bD0dQBDluhpT4jJQNWUHEuVBqpDmCUo6gPjCi+m9fCWnWZVR/oG6cMTUms4h+3NPl74wGXvA==", + "dev": true, + "requires": { + "array-back": "^4.0.1", + "chalk": "^2.4.2", + "table-layout": "^1.0.1", + "typical": "^5.2.0" + }, + "dependencies": { + "array-back": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/array-back/-/array-back-4.0.2.tgz", + "integrity": "sha512-NbdMezxqf94cnNfWLL7V/im0Ub+Anbb0IoZhvzie8+4HJ4nMQuzHuy49FkGYCJK2yAloZ3meiB6AVMClbrI1vg==", + "dev": true + }, + "typical": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/typical/-/typical-5.2.0.tgz", + "integrity": "sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg==", + "dev": true + } + } + }, + "common-ancestor-path": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/common-ancestor-path/-/common-ancestor-path-1.0.1.tgz", + "integrity": "sha512-L3sHRo1pXXEqX8VU28kfgUY+YGsk09hPqZiZmLacNib6XNTCM8ubYeT7ryXQw8asB1sKgcU5lkB7ONug08aB8w==", + "dev": true + }, + "commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", + "dev": true + }, + "compressible": { + "version": "2.0.18", + "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.18.tgz", + "integrity": "sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg==", + "dev": true, + "requires": { + "mime-db": ">= 1.43.0 < 2" + } + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "console-control-strings": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", + "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", + "dev": true + }, + "content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", + "dev": true, + "requires": { + "safe-buffer": "5.2.1" + }, + "dependencies": { + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true + } + } + }, + "content-type": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", + "dev": true + }, + "convert-source-map": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.8.0.tgz", + "integrity": "sha512-+OQdjP49zViI/6i7nIJpA8rAl4sV/JdPfU9nZs3VqOwGIgizICvuN2ru6fMd+4llL0tar18UYJXfZ/TWtmhUjA==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.1" + } + }, + "cookies": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/cookies/-/cookies-0.8.0.tgz", + "integrity": "sha512-8aPsApQfebXnuI+537McwYsDtjVxGm8gTIzQI3FDW6t5t/DAhERxtnbEPN/8RX+uZthoz4eCOgloXaE5cYyNow==", + "dev": true, + "requires": { + "depd": "~2.0.0", + "keygrip": "~1.1.0" + } + }, + "core-js-pure": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.21.0.tgz", + "integrity": "sha512-VaJUunCZLnxuDbo1rNOzwbet9E1K9joiXS5+DQMPtgxd24wfsZbJZMMfQLGYMlCUvSxLfsRUUhoOR2x28mFfeg==", + "dev": true + }, + "core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", + "dev": true + }, + "cosmiconfig": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.0.1.tgz", + "integrity": "sha512-a1YWNUV2HwGimB7dU2s1wUMurNKjpx60HxBB6xUM8Re+2s1g1IIfJvFR0/iCF+XHdE0GMTKTuLR32UQff4TEyQ==", + "dev": true, + "requires": { + "@types/parse-json": "^4.0.0", + "import-fresh": "^3.2.1", + "parse-json": "^5.0.0", + "path-type": "^4.0.0", + "yaml": "^1.10.0" + } + }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "css-select": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-4.2.1.tgz", + "integrity": "sha512-/aUslKhzkTNCQUB2qTX84lVmfia9NyjP3WpDGtj/WxhwBzWBYUV3DgUpurHTme8UTPcPlAD1DJ+b0nN/t50zDQ==", + "dev": true, + "requires": { + "boolbase": "^1.0.0", + "css-what": "^5.1.0", + "domhandler": "^4.3.0", + "domutils": "^2.8.0", + "nth-check": "^2.0.1" + } + }, + "css-what": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/css-what/-/css-what-5.1.0.tgz", + "integrity": "sha512-arSMRWIIFY0hV8pIxZMEfmMI47Wj3R/aWpZDDxWYCPEiOMv6tfOrnpDtgxBYPEQD4V0Y/958+1TdC3iWTFcUPw==", + "dev": true + }, + "cssesc": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", + "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", + "dev": true + }, + "csstype": { + "version": "3.0.10", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.10.tgz", + "integrity": "sha512-2u44ZG2OcNUO9HDp/Jl8C07x6pU/eTR3ncV91SiK3dhG9TWvRVsCoJw14Ckx5DgWkzGA3waZWO3d7pgqpUI/XA==", + "dev": true + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0" + } + }, + "debounce": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/debounce/-/debounce-1.2.1.tgz", + "integrity": "sha512-XRRe6Glud4rd/ZGQfiV1ruXSfbvfJedlV9Y6zOlP+2K04vBYiJEte6stfFkCP03aMnY5tsipamumUjL14fofug==", + "dev": true + }, + "debug": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", + "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "debuglog": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/debuglog/-/debuglog-1.0.1.tgz", + "integrity": "sha1-qiT/uaw9+aI1GDfPstJ5NgzXhJI=", + "dev": true + }, + "decompress-response": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", + "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", + "dev": true, + "requires": { + "mimic-response": "^3.1.0" + }, + "dependencies": { + "mimic-response": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", + "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", + "dev": true + } + } + }, + "deep-eql": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", + "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", + "dev": true, + "requires": { + "type-detect": "^4.0.0" + } + }, + "deep-equal": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.0.1.tgz", + "integrity": "sha1-9dJgKStmDghO/0zbyfCK0yR0SLU=", + "dev": true + }, + "deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "dev": true + }, + "deepmerge": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz", + "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==", + "dev": true + }, + "default-browser-id": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/default-browser-id/-/default-browser-id-2.0.0.tgz", + "integrity": "sha1-AezONxpx6F8VoXF354YwR+c9vn0=", + "dev": true, + "requires": { + "bplist-parser": "^0.1.0", + "pify": "^2.3.0", + "untildify": "^2.0.0" + } + }, + "defer-to-connect": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz", + "integrity": "sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg==", + "dev": true + }, + "define-lazy-prop": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz", + "integrity": "sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==", + "dev": true + }, + "defined": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/defined/-/defined-1.0.0.tgz", + "integrity": "sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM=", + "dev": true + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "dev": true + }, + "delegates": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", + "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", + "dev": true + }, + "depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "dev": true + }, + "dependency-graph": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/dependency-graph/-/dependency-graph-0.11.0.tgz", + "integrity": "sha512-JeMq7fEshyepOWDfcfHK06N3MhyPhz++vtqWhMT5O9A3K42rdsEDpfdVqjaqaAhsw6a+ZqeDvQVtD0hFHQWrzg==", + "dev": true + }, + "destroy": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.1.0.tgz", + "integrity": "sha512-R5QZrOXxSs0JDUIU/VANvRJlQVMts9C0L76HToQdPdlftfZCE7W6dyH0G4GZ5UW9fRqUOhAoCE2aGekuu+3HjQ==", + "dev": true + }, + "detect-port": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/detect-port/-/detect-port-1.3.0.tgz", + "integrity": "sha512-E+B1gzkl2gqxt1IhUzwjrxBKRqx1UzC3WLONHinn8S3T6lwV/agVCyitiFOsGJ/eYuEUBvD71MZHy3Pv1G9doQ==", + "dev": true, + "requires": { + "address": "^1.0.1", + "debug": "^2.6.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, + "detective": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/detective/-/detective-5.2.0.tgz", + "integrity": "sha512-6SsIx+nUUbuK0EthKjv0zrdnajCCXVYGmbYYiYjFVpzcjwEs/JMDZ8tPRG29J/HhN56t3GJp2cGSWDRjjot8Pg==", + "dev": true, + "requires": { + "acorn-node": "^1.6.1", + "defined": "^1.0.0", + "minimist": "^1.1.1" + } + }, + "devtools-protocol": { + "version": "0.0.948846", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.948846.tgz", + "integrity": "sha512-5fGyt9xmMqUl2VI7+rnUkKCiAQIpLns8sfQtTENy5L70ktbNw0Z3TFJ1JoFNYdx/jffz4YXU45VF75wKZD7sZQ==", + "dev": true + }, + "dezalgo": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/dezalgo/-/dezalgo-1.0.3.tgz", + "integrity": "sha1-f3Qt4Gb8dIvI24IFad3c5Jvw1FY=", + "dev": true, + "requires": { + "asap": "^2.0.0", + "wrappy": "1" + } + }, + "didyoumean": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz", + "integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==", + "dev": true + }, + "diff": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", + "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", + "dev": true + }, + "dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "requires": { + "path-type": "^4.0.0" + } + }, + "dlv": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz", + "integrity": "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==", + "dev": true + }, + "dom-accessibility-api": { + "version": "0.5.11", + "resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.11.tgz", + "integrity": "sha512-7X6GvzjYf4yTdRKuCVScV+aA9Fvh5r8WzWrXBH9w82ZWB/eYDMGCnazoC/YAqAzUJWHzLOnZqr46K3iEyUhUvw==", + "dev": true + }, + "dom-serializer": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.3.2.tgz", + "integrity": "sha512-5c54Bk5Dw4qAxNOI1pFEizPSjVsx5+bpJKmL2kPn8JhBUq2q09tTCa3mjijun2NfK78NMouDYNMBkOrPZiS+ig==", + "dev": true, + "requires": { + "domelementtype": "^2.0.1", + "domhandler": "^4.2.0", + "entities": "^2.0.0" + } + }, + "domelementtype": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.2.0.tgz", + "integrity": "sha512-DtBMo82pv1dFtUmHyr48beiuq792Sxohr+8Hm9zoxklYPfa6n0Z3Byjj2IV7bmr2IyqClnqEQhfgHJJ5QF0R5A==", + "dev": true + }, + "domhandler": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-4.3.0.tgz", + "integrity": "sha512-fC0aXNQXqKSFTr2wDNZDhsEYjCiYsDWl3D01kwt25hm1YIPyDGHvvi3rw+PLqHAl/m71MaiF7d5zvBr0p5UB2g==", + "dev": true, + "requires": { + "domelementtype": "^2.2.0" + } + }, + "domutils": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-2.8.0.tgz", + "integrity": "sha512-w96Cjofp72M5IIhpjgobBimYEfoPjx1Vx0BSX9P30WBdZW2WIKU0T1Bd0kz2eNZ9ikjKgHbEyKx8BB6H1L3h3A==", + "dev": true, + "requires": { + "dom-serializer": "^1.0.1", + "domelementtype": "^2.2.0", + "domhandler": "^4.2.0" + } + }, + "dotenv": { + "version": "8.6.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.6.0.tgz", + "integrity": "sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g==", + "dev": true + }, + "dotenv-expand": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/dotenv-expand/-/dotenv-expand-5.1.0.tgz", + "integrity": "sha512-YXQl1DSa4/PQyRfgrv6aoNjhasp/p4qs9FjJ4q4cQk+8m4r6k4ZSiEyytKG8f8W9gi8WsQtIObNmKd+tMzNTmA==", + "dev": true + }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "dev": true, + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=", + "dev": true + }, + "electron-to-chromium": { + "version": "1.4.64", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.64.tgz", + "integrity": "sha512-8mec/99xgLUZCIZZq3wt61Tpxg55jnOSpxGYapE/1Ma9MpFEYYaz4QNYm0CM1rrnCo7i3FRHhbaWjeCLsveGjQ==", + "dev": true + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=", + "dev": true + }, + "encoding": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz", + "integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==", + "dev": true, + "optional": true, + "requires": { + "iconv-lite": "^0.6.2" + }, + "dependencies": { + "iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "dev": true, + "optional": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + } + } + } + }, + "end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dev": true, + "requires": { + "once": "^1.4.0" + } + }, + "entities": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz", + "integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==", + "dev": true + }, + "env-paths": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz", + "integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==", + "dev": true + }, + "err-code": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/err-code/-/err-code-2.0.3.tgz", + "integrity": "sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==", + "dev": true + }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "requires": { + "is-arrayish": "^0.2.1" + } + }, + "errorstacks": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/errorstacks/-/errorstacks-2.3.2.tgz", + "integrity": "sha512-cJp8qf5t2cXmVZJjZVrcU4ODFJeQOcUyjJEtPFtWO+3N6JPM6vCe4Sfv3cwIs/qS7gnUo/fvKX/mDCVQZq+P7A==", + "dev": true + }, + "es-module-lexer": { + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-0.9.3.tgz", + "integrity": "sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ==", + "dev": true + }, + "esbuild": { + "version": "0.9.7", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.9.7.tgz", + "integrity": "sha512-VtUf6aQ89VTmMLKrWHYG50uByMF4JQlVysb8dmg6cOgW8JnFCipmz7p+HNBl+RR3LLCuBxFGVauAe2wfnF9bLg==", + "dev": true + }, + "escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true + }, + "escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "esinstall": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/esinstall/-/esinstall-1.1.7.tgz", + "integrity": "sha512-irDsrIF7fZ5BCQEAV5gmH+4nsK6JhnkI9C9VloXdmzJLbM1EcshPw8Ap95UUGc4ZJdzGeOrjV+jgKjQ/Z7Q3pg==", + "dev": true, + "requires": { + "@rollup/plugin-commonjs": "^16.0.0", + "@rollup/plugin-inject": "^4.0.2", + "@rollup/plugin-json": "^4.0.0", + "@rollup/plugin-node-resolve": "^10.0.0", + "@rollup/plugin-replace": "^2.4.2", + "builtin-modules": "^3.2.0", + "cjs-module-lexer": "^1.2.1", + "es-module-lexer": "^0.6.0", + "execa": "^5.1.1", + "is-valid-identifier": "^2.0.2", + "kleur": "^4.1.1", + "mkdirp": "^1.0.3", + "picomatch": "^2.3.0", + "resolve": "^1.20.0", + "rimraf": "^3.0.0", + "rollup": "~2.37.1", + "rollup-plugin-polyfill-node": "^0.6.2", + "slash": "~3.0.0", + "validate-npm-package-name": "^3.0.0", + "vm2": "^3.9.2" + }, + "dependencies": { + "@rollup/plugin-node-resolve": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-10.0.0.tgz", + "integrity": "sha512-sNijGta8fqzwA1VwUEtTvWCx2E7qC70NMsDh4ZG13byAXYigBNZMxALhKUSycBks5gupJdq0lFrKumFrRZ8H3A==", + "dev": true, + "requires": { + "@rollup/pluginutils": "^3.1.0", + "@types/resolve": "1.17.1", + "builtin-modules": "^3.1.0", + "deepmerge": "^4.2.2", + "is-module": "^1.0.0", + "resolve": "^1.17.0" + } + }, + "es-module-lexer": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-0.6.0.tgz", + "integrity": "sha512-f8kcHX1ArhllUtb/wVSyvygoKCznIjnxhLxy7TCvIiMdT7fL4ZDTIKaadMe6eLvOXg6Wk02UeoFgUoZ2EKZZUA==", + "dev": true + }, + "fsevents": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz", + "integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==", + "dev": true, + "optional": true + }, + "rollup": { + "version": "2.37.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.37.1.tgz", + "integrity": "sha512-V3ojEeyGeSdrMSuhP3diBb06P+qV4gKQeanbDv+Qh/BZbhdZ7kHV0xAt8Yjk4GFshq/WjO7R4c7DFM20AwTFVQ==", + "dev": true, + "requires": { + "fsevents": "~2.1.2" + } + } + } + }, + "estree-walker": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz", + "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==", + "dev": true + }, + "etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=", + "dev": true + }, + "eventemitter3": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", + "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", + "dev": true + }, + "execa": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", + "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "dev": true, + "requires": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" + } + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "dev": true + }, + "extract-zip": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz", + "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==", + "dev": true, + "requires": { + "@types/yauzl": "^2.9.1", + "debug": "^4.1.1", + "get-stream": "^5.1.0", + "yauzl": "^2.10.0" + }, + "dependencies": { + "get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + } + } + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", + "dev": true + }, + "fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "fast-glob": { + "version": "3.2.11", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", + "integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + } + }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "fastq": { + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", + "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", + "dev": true, + "requires": { + "reusify": "^1.0.4" + } + }, + "fd-slicer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", + "integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=", + "dev": true, + "requires": { + "pend": "~1.2.0" + } + }, + "fdir": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-5.2.0.tgz", + "integrity": "sha512-skyI2Laxtj9GYzmktPgY6DT8uswXq+VoxH26SskykvEhTSbi7tRM/787uZt/p8maxrQCJdzC90zX1btbxiJ6lw==", + "dev": true + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "find-cache-dir": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.2.tgz", + "integrity": "sha512-wXZV5emFEjrridIgED11OoUKLxiYjAcqot/NJdAkOhlJ+vGzwhOAfcG5OX1jP+S0PcjEn8bdMJv+g2jwQ3Onig==", + "dev": true, + "requires": { + "commondir": "^1.0.1", + "make-dir": "^3.0.2", + "pkg-dir": "^4.1.0" + } + }, + "find-replace": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-replace/-/find-replace-3.0.0.tgz", + "integrity": "sha512-6Tb2myMioCAgv5kfvP5/PkZZ/ntTpVK39fHY7WkWBgvbeE+VHd/tZuZ4mrC+bxh4cfOZeYKVPaJIZtZXV7GNCQ==", + "dev": true, + "requires": { + "array-back": "^3.0.1" + } + }, + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", + "dev": true + }, + "form-data": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "dev": true, + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + }, + "fraction.js": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.1.2.tgz", + "integrity": "sha512-o2RiJQ6DZaR/5+Si0qJUIy637QMRudSi9kU/FFzx9EZazrIdnBgpU+3sEWCxAVhH2RtxW2Oz+T4p2o8uOPVcgA==", + "dev": true + }, + "fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=", + "dev": true + }, + "fs-constants": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", + "dev": true + }, + "fs-minipass": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", + "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", + "dev": true, + "requires": { + "minipass": "^3.0.0" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "optional": true + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "gauge": { + "version": "2.7.4", + "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", + "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", + "dev": true, + "requires": { + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + } + } + }, + "generic-names": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/generic-names/-/generic-names-4.0.0.tgz", + "integrity": "sha512-ySFolZQfw9FoDb3ed9d80Cm9f0+r7qj+HJkWjeD9RBfpxEVTlVhol+gvaQB/78WbwYfbnNh8nWHHBSlg072y6A==", + "dev": true, + "requires": { + "loader-utils": "^3.2.0" + } + }, + "gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "dev": true + }, + "get-func-name": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", + "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", + "dev": true + }, + "get-intrinsic": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", + "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", + "dev": true, + "requires": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1" + } + }, + "get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0" + } + }, + "glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + }, + "globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true + }, + "globby": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "dev": true, + "requires": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" + } + }, + "got": { + "version": "11.8.3", + "resolved": "https://registry.npmjs.org/got/-/got-11.8.3.tgz", + "integrity": "sha512-7gtQ5KiPh1RtGS9/Jbv1ofDpBFuq42gyfEib+ejaRBJuj/3tQFeR5+gw57e4ipaU8c/rCjvX6fkQz2lyDlGAOg==", + "dev": true, + "requires": { + "@sindresorhus/is": "^4.0.0", + "@szmarczak/http-timer": "^4.0.5", + "@types/cacheable-request": "^6.0.1", + "@types/responselike": "^1.0.0", + "cacheable-lookup": "^5.0.3", + "cacheable-request": "^7.0.2", + "decompress-response": "^6.0.0", + "http2-wrapper": "^1.0.0-beta.5.2", + "lowercase-keys": "^2.0.0", + "p-cancelable": "^2.0.0", + "responselike": "^2.0.0" + } + }, + "graceful-fs": { + "version": "4.2.9", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz", + "integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==", + "dev": true + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", + "dev": true + }, + "har-validator": { + "version": "5.1.5", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz", + "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==", + "dev": true, + "requires": { + "ajv": "^6.12.3", + "har-schema": "^2.0.0" + } + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "has-symbols": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", + "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==", + "dev": true + }, + "has-tostringtag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", + "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", + "dev": true, + "requires": { + "has-symbols": "^1.0.2" + } + }, + "has-unicode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", + "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", + "dev": true + }, + "hosted-git-info": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.1.0.tgz", + "integrity": "sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", + "dev": true + }, + "htmlparser2": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-6.1.0.tgz", + "integrity": "sha512-gyyPk6rgonLFEDGoeRgQNaEUvdJ4ktTmmUh/h2t7s+M8oPpIPxgNACWa+6ESR57kXstwqPiCut0V8NRpcwgU7A==", + "dev": true, + "requires": { + "domelementtype": "^2.0.1", + "domhandler": "^4.0.0", + "domutils": "^2.5.2", + "entities": "^2.0.0" + } + }, + "http-assert": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/http-assert/-/http-assert-1.5.0.tgz", + "integrity": "sha512-uPpH7OKX4H25hBmU6G1jWNaqJGpTXxey+YOUizJUAgu0AjLUeC8D73hTrhvDS5D+GJN1DN1+hhc/eF/wpxtp0w==", + "dev": true, + "requires": { + "deep-equal": "~1.0.1", + "http-errors": "~1.8.0" + } + }, + "http-cache-semantics": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz", + "integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==", + "dev": true + }, + "http-errors": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.8.1.tgz", + "integrity": "sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g==", + "dev": true, + "requires": { + "depd": "~1.1.2", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": ">= 1.5.0 < 2", + "toidentifier": "1.0.1" + }, + "dependencies": { + "depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", + "dev": true + } + } + }, + "http-proxy-agent": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz", + "integrity": "sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==", + "dev": true, + "requires": { + "@tootallnate/once": "1", + "agent-base": "6", + "debug": "4" + } + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "http2-wrapper": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-1.0.3.tgz", + "integrity": "sha512-V+23sDMr12Wnz7iTcDeJr3O6AIxlnvT/bmaAAAP/Xda35C90p9599p0F1eHR/N1KILWSoWVAiOMFjBBXaXSMxg==", + "dev": true, + "requires": { + "quick-lru": "^5.1.1", + "resolve-alpn": "^1.0.0" + } + }, + "httpie": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/httpie/-/httpie-1.1.2.tgz", + "integrity": "sha512-VQ82oXG95oY1fQw/XecHuvcFBA+lZQ9Vwj1RfLcO8a7HpDd4cc2ukwpJt+TUlFaLUAzZErylxWu6wclJ1rUhUQ==", + "dev": true + }, + "https-proxy-agent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz", + "integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==", + "dev": true, + "requires": { + "agent-base": "6", + "debug": "4" + } + }, + "human-signals": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", + "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", + "dev": true + }, + "humanize-ms": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", + "integrity": "sha1-xG4xWaKT9riW2ikxbYtv6Lt5u+0=", + "dev": true, + "requires": { + "ms": "^2.0.0" + } + }, + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "icss-replace-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/icss-replace-symbols/-/icss-replace-symbols-1.1.0.tgz", + "integrity": "sha1-Bupvg2ead0njhs/h/oEq5dsiPe0=", + "dev": true + }, + "icss-utils": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/icss-utils/-/icss-utils-5.1.0.tgz", + "integrity": "sha512-soFhflCVWLfRNOPU3iv5Z9VUdT44xFRbzjLsEzSr5AQmgqPMTHdU3PMT1Cf1ssx8fLNJDA1juftYl+PUcv3MqA==", + "dev": true, + "requires": {} + }, + "ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true + }, + "ignore": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", + "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", + "dev": true + }, + "ignore-walk": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.4.tgz", + "integrity": "sha512-PY6Ii8o1jMRA1z4F2hRkH/xN59ox43DavKvD3oDpfurRlOJyAHpifIwpbdv1n4jt4ov0jSpw3kQ4GhJnpBL6WQ==", + "dev": true, + "requires": { + "minimatch": "^3.0.4" + } + }, + "import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "dependencies": { + "resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true + } + } + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, + "indent-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", + "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", + "dev": true + }, + "infer-owner": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/infer-owner/-/infer-owner-1.0.4.tgz", + "integrity": "sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A==", + "dev": true + }, + "inflation": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/inflation/-/inflation-2.0.0.tgz", + "integrity": "sha1-i0F+R8KPklpFEz2RTKH9OJEH8w8=", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "ip": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", + "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=", + "dev": true + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + }, + "is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "requires": { + "binary-extensions": "^2.0.0" + } + }, + "is-core-module": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.1.tgz", + "integrity": "sha512-SdNCUs284hr40hFTFP6l0IfZ/RSrMXF3qgoRHd3/79unUTvrFO/JoXwkGm+5J/Oe3E/b5GsnG330uUNgRpu1PA==", + "dev": true, + "requires": { + "has": "^1.0.3" + } + }, + "is-docker": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", + "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", + "dev": true + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "is-generator-function": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", + "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", + "dev": true, + "requires": { + "has-tostringtag": "^1.0.0" + } + }, + "is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-lambda": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-lambda/-/is-lambda-1.0.1.tgz", + "integrity": "sha1-PZh3iZ5qU+/AFgUEzeFfgubwYdU=", + "dev": true + }, + "is-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", + "integrity": "sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE=", + "dev": true + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, + "is-plain-object": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", + "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==", + "dev": true + }, + "is-reference": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz", + "integrity": "sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==", + "dev": true, + "requires": { + "@types/estree": "*" + } + }, + "is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "dev": true + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", + "dev": true + }, + "is-valid-identifier": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-valid-identifier/-/is-valid-identifier-2.0.2.tgz", + "integrity": "sha512-mpS5EGqXOwzXtKAg6I44jIAqeBfntFLxpAth1rrKbxtKyI6LPktyDYpHBI+tHlduhhX/SF26mFXmxQu995QVqg==", + "dev": true, + "requires": { + "assert": "^1.4.1" + } + }, + "is-wsl": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", + "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", + "dev": true, + "requires": { + "is-docker": "^2.0.0" + } + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "isbinaryfile": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-4.0.8.tgz", + "integrity": "sha512-53h6XFniq77YdW+spoRrebh0mnmTxRPTlcuIArO57lmMdq4uBKFKaeTjnb92oYWrSn/LVL+LT+Hap2tFQj8V+w==", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", + "dev": true + }, + "istanbul-lib-coverage": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz", + "integrity": "sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==", + "dev": true + }, + "istanbul-lib-report": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", + "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==", + "dev": true, + "requires": { + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^3.0.0", + "supports-color": "^7.1.0" + }, + "dependencies": { + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "istanbul-reports": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.3.tgz", + "integrity": "sha512-x9LtDVtfm/t1GFiLl3NffC7hz+I1ragvgX1P/Lg1NlIagifZDKUkuuaAxH/qpwj2IuEfD8G2Bs/UKp+sZ/pKkg==", + "dev": true, + "requires": { + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + } + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "dev": true + }, + "jsesc": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", + "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", + "dev": true + }, + "json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true + }, + "json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true + }, + "json-schema": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz", + "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==", + "dev": true + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "json-stringify-nice": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/json-stringify-nice/-/json-stringify-nice-1.1.4.tgz", + "integrity": "sha512-5Z5RFW63yxReJ7vANgW6eZFGWaQvnPE3WNmZoOJrSkGju2etKA2L5rrOa1sm877TVTFt57A80BH1bArcmlLfPw==", + "dev": true + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", + "dev": true + }, + "json5": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz", + "integrity": "sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + }, + "jsonparse": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", + "integrity": "sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA=", + "dev": true + }, + "jsonschema": { + "version": "1.2.11", + "resolved": "https://registry.npmjs.org/jsonschema/-/jsonschema-1.2.11.tgz", + "integrity": "sha512-XNZHs3N1IOa3lPKm//npxMhOdaoPw+MvEV0NIgxcER83GTJcG13rehtWmpBCfEt8DrtYwIkMTs8bdXoYs4fvnQ==", + "dev": true + }, + "jsprim": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz", + "integrity": "sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==", + "dev": true, + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.4.0", + "verror": "1.10.0" + } + }, + "just-diff": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/just-diff/-/just-diff-3.1.1.tgz", + "integrity": "sha512-sdMWKjRq8qWZEjDcVA6llnUT8RDEBIfOiGpYFPYa9u+2c39JCsejktSP7mj5eRid5EIvTzIpQ2kDOCw1Nq9BjQ==", + "dev": true + }, + "just-diff-apply": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/just-diff-apply/-/just-diff-apply-3.1.2.tgz", + "integrity": "sha512-TCa7ZdxCeq6q3Rgms2JCRHTCfWAETPZ8SzYUbkYF6KR3I03sN29DaOIC+xyWboIcMvjAsD5iG2u/RWzHD8XpgQ==", + "dev": true + }, + "keygrip": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/keygrip/-/keygrip-1.1.0.tgz", + "integrity": "sha512-iYSchDJ+liQ8iwbSI2QqsQOvqv58eJCEanyJPJi+Khyu8smkcKSFUCbPwzFcL7YVtZ6eONjqRX/38caJ7QjRAQ==", + "dev": true, + "requires": { + "tsscmp": "1.0.6" + } + }, + "keyv": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.1.0.tgz", + "integrity": "sha512-YsY3wr6HabE11/sscee+3nZ03XjvkrPWGouAmJFBdZoK92wiOlJCzI5/sDEIKdJhdhHO144ei45U9gXfbu14Uw==", + "dev": true, + "requires": { + "json-buffer": "3.0.1" + } + }, + "kleur": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.4.tgz", + "integrity": "sha512-8QADVssbrFjivHWQU7KkMgptGTl6WAcSdlbBPY4uNF+mWr6DGcKrvY2w4FQJoXch7+fKMjj0dRrL75vk3k23OA==", + "dev": true + }, + "koa": { + "version": "2.13.4", + "resolved": "https://registry.npmjs.org/koa/-/koa-2.13.4.tgz", + "integrity": "sha512-43zkIKubNbnrULWlHdN5h1g3SEKXOEzoAlRsHOTFpnlDu8JlAOZSMJBLULusuXRequboiwJcj5vtYXKB3k7+2g==", + "dev": true, + "requires": { + "accepts": "^1.3.5", + "cache-content-type": "^1.0.0", + "content-disposition": "~0.5.2", + "content-type": "^1.0.4", + "cookies": "~0.8.0", + "debug": "^4.3.2", + "delegates": "^1.0.0", + "depd": "^2.0.0", + "destroy": "^1.0.4", + "encodeurl": "^1.0.2", + "escape-html": "^1.0.3", + "fresh": "~0.5.2", + "http-assert": "^1.3.0", + "http-errors": "^1.6.3", + "is-generator-function": "^1.0.7", + "koa-compose": "^4.1.0", + "koa-convert": "^2.0.0", + "on-finished": "^2.3.0", + "only": "~0.0.2", + "parseurl": "^1.3.2", + "statuses": "^1.5.0", + "type-is": "^1.6.16", + "vary": "^1.1.2" + } + }, + "koa-compose": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/koa-compose/-/koa-compose-4.1.0.tgz", + "integrity": "sha512-8ODW8TrDuMYvXRwra/Kh7/rJo9BtOfPc6qO8eAfC80CnCvSjSl0bkRM24X6/XBBEyj0v1nRUQ1LyOy3dbqOWXw==", + "dev": true + }, + "koa-convert": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/koa-convert/-/koa-convert-2.0.0.tgz", + "integrity": "sha512-asOvN6bFlSnxewce2e/DK3p4tltyfC4VM7ZwuTuepI7dEQVcvpyFuBcEARu1+Hxg8DIwytce2n7jrZtRlPrARA==", + "dev": true, + "requires": { + "co": "^4.6.0", + "koa-compose": "^4.1.0" + } + }, + "koa-etag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/koa-etag/-/koa-etag-4.0.0.tgz", + "integrity": "sha512-1cSdezCkBWlyuB9l6c/IFoe1ANCDdPBxkDkRiaIup40xpUub6U/wwRXoKBZw/O5BifX9OlqAjYnDyzM6+l+TAg==", + "dev": true, + "requires": { + "etag": "^1.8.1" + } + }, + "koa-send": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/koa-send/-/koa-send-5.0.1.tgz", + "integrity": "sha512-tmcyQ/wXXuxpDxyNXv5yNNkdAMdFRqwtegBXUaowiQzUKqJehttS0x2j0eOZDQAyloAth5w6wwBImnFzkUz3pQ==", + "dev": true, + "requires": { + "debug": "^4.1.1", + "http-errors": "^1.7.3", + "resolve-path": "^1.4.0" + } + }, + "koa-static": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/koa-static/-/koa-static-5.0.0.tgz", + "integrity": "sha512-UqyYyH5YEXaJrf9S8E23GoJFQZXkBVJ9zYYMPGz919MSX1KuvAcycIuS0ci150HCoPf4XQVhQ84Qf8xRPWxFaQ==", + "dev": true, + "requires": { + "debug": "^3.1.0", + "koa-send": "^5.0.0" + }, + "dependencies": { + "debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + } + } + }, + "lighthouse-logger": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/lighthouse-logger/-/lighthouse-logger-1.3.0.tgz", + "integrity": "sha512-BbqAKApLb9ywUli+0a+PcV04SyJ/N1q/8qgCNe6U97KbPCS1BTksEuHFLYdvc8DltuhfxIUBqDZsC0bBGtl3lA==", + "dev": true, + "requires": { + "debug": "^2.6.9", + "marky": "^1.2.2" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, + "lilconfig": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.0.4.tgz", + "integrity": "sha512-bfTIN7lEsiooCocSISTWXkiWJkRqtL9wYtYy+8EK3Y41qh3mpwPU0ycTOgjdY9ErwXCc8QyrQp82bdL0Xkm9yA==", + "dev": true + }, + "lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "dev": true + }, + "loader-utils": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-3.2.0.tgz", + "integrity": "sha512-HVl9ZqccQihZ7JM85dco1MvO9G+ONvxoGa9rkhzFsneGLKSUg1gJf9bWzhRhcvm2qChhWpebQhP44qxjKIUCaQ==", + "dev": true + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, + "lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true + }, + "lodash.camelcase": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", + "integrity": "sha1-soqmKIorn8ZRA1x3EfZathkDMaY=", + "dev": true + }, + "log-update": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/log-update/-/log-update-4.0.0.tgz", + "integrity": "sha512-9fkkDevMefjg0mmzWFBW8YkFP91OrizzkW3diF7CpG+S2EYdy4+TVfGwz1zeF8x7hCx1ovSPTOE9Ngib74qqUg==", + "dev": true, + "requires": { + "ansi-escapes": "^4.3.0", + "cli-cursor": "^3.1.0", + "slice-ansi": "^4.0.0", + "wrap-ansi": "^6.2.0" + } + }, + "loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "requires": { + "js-tokens": "^3.0.0 || ^4.0.0" + } + }, + "loupe": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.2.tgz", + "integrity": "sha512-QgVamnvj0jX1LMPlCAq0MK6hATORFtGqHoUKXTkwNe13BqlN6aePQCKnnTcFvdDYEEITcJ+gBl4mTW7YJtJbyQ==", + "dev": true, + "requires": { + "get-func-name": "^2.0.0" + } + }, + "lowercase-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", + "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", + "dev": true + }, + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, + "lz-string": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.4.4.tgz", + "integrity": "sha1-wNjq82BZ9wV5bh40SBHPTEmNOiY=", + "dev": true + }, + "magic-string": { + "version": "0.25.7", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.7.tgz", + "integrity": "sha512-4CrMT5DOHTDk4HYDlzmwu4FVCcIYI8gauveasrdCu2IKIFOJ3f0v/8MDGJCDL9oD2ppz/Av1b0Nj345H9M+XIA==", + "dev": true, + "requires": { + "sourcemap-codec": "^1.4.4" + } + }, + "make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "dev": true, + "requires": { + "semver": "^6.0.0" + } + }, + "make-fetch-happen": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-9.1.0.tgz", + "integrity": "sha512-+zopwDy7DNknmwPQplem5lAZX/eCOzSvSNNcSKm5eVwTkOBzoktEfXsa9L23J/GIRhxRsaxzkPEhrJEpE2F4Gg==", + "dev": true, + "requires": { + "agentkeepalive": "^4.1.3", + "cacache": "^15.2.0", + "http-cache-semantics": "^4.1.0", + "http-proxy-agent": "^4.0.1", + "https-proxy-agent": "^5.0.0", + "is-lambda": "^1.0.1", + "lru-cache": "^6.0.0", + "minipass": "^3.1.3", + "minipass-collect": "^1.0.2", + "minipass-fetch": "^1.3.2", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.4", + "negotiator": "^0.6.2", + "promise-retry": "^2.0.1", + "socks-proxy-agent": "^6.0.0", + "ssri": "^8.0.0" + } + }, + "marky": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/marky/-/marky-1.2.2.tgz", + "integrity": "sha512-k1dB2HNeaNyORco8ulVEhctyEGkKHb2YWAhDsxeFlW2nROIirsctBYzKwwS3Vza+sKTS1zO4Z+n9/+9WbGLIxQ==", + "dev": true + }, + "media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=", + "dev": true + }, + "merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, + "merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true + }, + "meriyah": { + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/meriyah/-/meriyah-3.1.6.tgz", + "integrity": "sha512-JDOSi6DIItDc33U5N52UdV6P8v+gn+fqZKfbAfHzdWApRQyQWdcvxPvAr9t01bI2rBxGvSrKRQSCg3SkZC1qeg==", + "dev": true + }, + "micromatch": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz", + "integrity": "sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg==", + "dev": true, + "requires": { + "braces": "^3.0.1", + "picomatch": "^2.2.3" + } + }, + "mime-db": { + "version": "1.51.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.51.0.tgz", + "integrity": "sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g==", + "dev": true + }, + "mime-types": { + "version": "2.1.34", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.34.tgz", + "integrity": "sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A==", + "dev": true, + "requires": { + "mime-db": "1.51.0" + } + }, + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true + }, + "mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", + "dev": true + }, + "mini-svg-data-uri": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/mini-svg-data-uri/-/mini-svg-data-uri-1.4.3.tgz", + "integrity": "sha512-gSfqpMRC8IxghvMcxzzmMnWpXAChSA+vy4cia33RgerMS8Fex95akUyQZPbxJJmeBGiGmK7n/1OpUX8ksRjIdA==", + "dev": true + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "dev": true + }, + "minipass": { + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.1.6.tgz", + "integrity": "sha512-rty5kpw9/z8SX9dmxblFA6edItUmwJgMeYDZRrwlIVN27i8gysGbznJwUggw2V/FVqFSDdWy040ZPS811DYAqQ==", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, + "minipass-collect": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/minipass-collect/-/minipass-collect-1.0.2.tgz", + "integrity": "sha512-6T6lH0H8OG9kITm/Jm6tdooIbogG9e0tLgpY6mphXSm/A9u8Nq1ryBG+Qspiub9LjWlBPsPS3tWQ/Botq4FdxA==", + "dev": true, + "requires": { + "minipass": "^3.0.0" + } + }, + "minipass-fetch": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-1.4.1.tgz", + "integrity": "sha512-CGH1eblLq26Y15+Azk7ey4xh0J/XfJfrCox5LDJiKqI2Q2iwOLOKrlmIaODiSQS8d18jalF6y2K2ePUm0CmShw==", + "dev": true, + "requires": { + "encoding": "^0.1.12", + "minipass": "^3.1.0", + "minipass-sized": "^1.0.3", + "minizlib": "^2.0.0" + } + }, + "minipass-flush": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/minipass-flush/-/minipass-flush-1.0.5.tgz", + "integrity": "sha512-JmQSYYpPUqX5Jyn1mXaRwOda1uQ8HP5KAT/oDSLCzt1BYRhQU0/hDtsB1ufZfEEzMZ9aAVmsBw8+FWsIXlClWw==", + "dev": true, + "requires": { + "minipass": "^3.0.0" + } + }, + "minipass-json-stream": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minipass-json-stream/-/minipass-json-stream-1.0.1.tgz", + "integrity": "sha512-ODqY18UZt/I8k+b7rl2AENgbWE8IDYam+undIJONvigAz8KR5GWblsFTEfQs0WODsjbSXWlm+JHEv8Gr6Tfdbg==", + "dev": true, + "requires": { + "jsonparse": "^1.3.1", + "minipass": "^3.0.0" + } + }, + "minipass-pipeline": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/minipass-pipeline/-/minipass-pipeline-1.2.4.tgz", + "integrity": "sha512-xuIq7cIOt09RPRJ19gdi4b+RiNvDFYe5JH+ggNvBqGqpQXcru3PcRmOZuHBKWK1Txf9+cQ+HMVN4d6z46LZP7A==", + "dev": true, + "requires": { + "minipass": "^3.0.0" + } + }, + "minipass-sized": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/minipass-sized/-/minipass-sized-1.0.3.tgz", + "integrity": "sha512-MbkQQ2CTiBMlA2Dm/5cY+9SWFEN8pzzOXi6rlM5Xxq0Yqbda5ZQy9sU75a673FE9ZK0Zsbr6Y5iP6u9nktfg2g==", + "dev": true, + "requires": { + "minipass": "^3.0.0" + } + }, + "minizlib": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz", + "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", + "dev": true, + "requires": { + "minipass": "^3.0.0", + "yallist": "^4.0.0" + } + }, + "mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "dev": true + }, + "mkdirp-classic": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", + "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==", + "dev": true + }, + "mkdirp-infer-owner": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mkdirp-infer-owner/-/mkdirp-infer-owner-2.0.0.tgz", + "integrity": "sha512-sdqtiFt3lkOaYvTXSRIUjkIdPTcxgv5+fgqYE/5qgwdw12cOrAuzzgzvVExIkH/ul1oeHN3bCLOWSG3XOqbKKw==", + "dev": true, + "requires": { + "chownr": "^2.0.0", + "infer-owner": "^1.0.4", + "mkdirp": "^1.0.3" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "nanocolors": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/nanocolors/-/nanocolors-0.2.13.tgz", + "integrity": "sha512-0n3mSAQLPpGLV9ORXT5+C/D4mwew7Ebws69Hx4E2sgz2ZA5+32Q80B9tL8PbL7XHnRDiAxH/pnrUJ9a4fkTNTA==", + "dev": true + }, + "nanoid": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.2.0.tgz", + "integrity": "sha512-fmsZYa9lpn69Ad5eDn7FMcnnSR+8R34W9qJEijxYhTbfOWzr22n1QxCMzXLK+ODyW2973V3Fux959iQoUxzUIA==", + "dev": true + }, + "negotiator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "dev": true + }, + "node-fetch": { + "version": "2.6.7", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", + "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "dev": true, + "requires": { + "whatwg-url": "^5.0.0" + }, + "dependencies": { + "tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=", + "dev": true + }, + "webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=", + "dev": true + }, + "whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", + "dev": true, + "requires": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + } + } + }, + "node-gyp": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-7.1.2.tgz", + "integrity": "sha512-CbpcIo7C3eMu3dL1c3d0xw449fHIGALIJsRP4DDPHpyiW8vcriNY7ubh9TE4zEKfSxscY7PjeFnshE7h75ynjQ==", + "dev": true, + "requires": { + "env-paths": "^2.2.0", + "glob": "^7.1.4", + "graceful-fs": "^4.2.3", + "nopt": "^5.0.0", + "npmlog": "^4.1.2", + "request": "^2.88.2", + "rimraf": "^3.0.2", + "semver": "^7.3.2", + "tar": "^6.0.2", + "which": "^2.0.2" + }, + "dependencies": { + "semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + } + } + }, + "node-gyp-build": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.3.0.tgz", + "integrity": "sha512-iWjXZvmboq0ja1pUGULQBexmxq8CV4xBhX7VDOTbL7ZR4FOowwY/VOtRxBN/yKxmdGoIp4j5ysNT4u3S2pDQ3Q==", + "dev": true + }, + "node-releases": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.1.tgz", + "integrity": "sha512-CqyzN6z7Q6aMeF/ktcMVTzhAHCEpf8SOarwpzpf8pNBY2k5/oM34UHldUwp8VKI7uxct2HxSRdJjBaZeESzcxA==", + "dev": true + }, + "nopt": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz", + "integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==", + "dev": true, + "requires": { + "abbrev": "1" + } + }, + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true + }, + "normalize-range": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/normalize-range/-/normalize-range-0.1.2.tgz", + "integrity": "sha1-LRDAa9/TEuqXd2laTShDlFa3WUI=", + "dev": true + }, + "normalize-url": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-6.1.0.tgz", + "integrity": "sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A==", + "dev": true + }, + "npm-bundled": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.1.2.tgz", + "integrity": "sha512-x5DHup0SuyQcmL3s7Rx/YQ8sbw/Hzg0rj48eN0dV7hf5cmQq5PXIeioroH3raV1QC1yh3uTYuMThvEQF3iKgGQ==", + "dev": true, + "requires": { + "npm-normalize-package-bin": "^1.0.1" + } + }, + "npm-install-checks": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/npm-install-checks/-/npm-install-checks-4.0.0.tgz", + "integrity": "sha512-09OmyDkNLYwqKPOnbI8exiOZU2GVVmQp7tgez2BPi5OZC8M82elDAps7sxC4l//uSUtotWqoEIDwjRvWH4qz8w==", + "dev": true, + "requires": { + "semver": "^7.1.1" + }, + "dependencies": { + "semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + } + } + }, + "npm-normalize-package-bin": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/npm-normalize-package-bin/-/npm-normalize-package-bin-1.0.1.tgz", + "integrity": "sha512-EPfafl6JL5/rU+ot6P3gRSCpPDW5VmIzX959Ob1+ySFUuuYHWHekXpwdUZcKP5C+DS4GEtdJluwBjnsNDl+fSA==", + "dev": true + }, + "npm-package-arg": { + "version": "8.1.5", + "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-8.1.5.tgz", + "integrity": "sha512-LhgZrg0n0VgvzVdSm1oiZworPbTxYHUJCgtsJW8mGvlDpxTM1vSJc3m5QZeUkhAHIzbz3VCHd/R4osi1L1Tg/Q==", + "dev": true, + "requires": { + "hosted-git-info": "^4.0.1", + "semver": "^7.3.4", + "validate-npm-package-name": "^3.0.0" + }, + "dependencies": { + "semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + } + } + }, + "npm-packlist": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-2.2.2.tgz", + "integrity": "sha512-Jt01acDvJRhJGthnUJVF/w6gumWOZxO7IkpY/lsX9//zqQgnF7OJaxgQXcerd4uQOLu7W5bkb4mChL9mdfm+Zg==", + "dev": true, + "requires": { + "glob": "^7.1.6", + "ignore-walk": "^3.0.3", + "npm-bundled": "^1.1.1", + "npm-normalize-package-bin": "^1.0.1" + } + }, + "npm-pick-manifest": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/npm-pick-manifest/-/npm-pick-manifest-6.1.1.tgz", + "integrity": "sha512-dBsdBtORT84S8V8UTad1WlUyKIY9iMsAmqxHbLdeEeBNMLQDlDWWra3wYUx9EBEIiG/YwAy0XyNHDd2goAsfuA==", + "dev": true, + "requires": { + "npm-install-checks": "^4.0.0", + "npm-normalize-package-bin": "^1.0.1", + "npm-package-arg": "^8.1.2", + "semver": "^7.3.4" + }, + "dependencies": { + "semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + } + } + }, + "npm-registry-fetch": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/npm-registry-fetch/-/npm-registry-fetch-11.0.0.tgz", + "integrity": "sha512-jmlgSxoDNuhAtxUIG6pVwwtz840i994dL14FoNVZisrmZW5kWd63IUTNv1m/hyRSGSqWjCUp/YZlS1BJyNp9XA==", + "dev": true, + "requires": { + "make-fetch-happen": "^9.0.1", + "minipass": "^3.1.3", + "minipass-fetch": "^1.3.0", + "minipass-json-stream": "^1.0.1", + "minizlib": "^2.0.0", + "npm-package-arg": "^8.0.0" + } + }, + "npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dev": true, + "requires": { + "path-key": "^3.0.0" + } + }, + "npmlog": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", + "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", + "dev": true, + "requires": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + } + }, + "nth-check": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.0.1.tgz", + "integrity": "sha512-it1vE95zF6dTT9lBsYbxvqh0Soy4SPowchj0UBGj/V6cTPnXXtQOPUbhZ6CmGzAD/rW22LQK6E96pcdJXk4A4w==", + "dev": true, + "requires": { + "boolbase": "^1.0.0" + } + }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "dev": true + }, + "oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", + "dev": true + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + }, + "object-hash": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/object-hash/-/object-hash-2.2.0.tgz", + "integrity": "sha512-gScRMn0bS5fH+IuwyIFgnh9zBdo4DV+6GhygmWM9HyNJSgS0hScp1f5vjtm7oIIOiT9trXrShAkLFSc2IqKNgw==", + "dev": true + }, + "object-inspect": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.0.tgz", + "integrity": "sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g==", + "dev": true + }, + "on-finished": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", + "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", + "dev": true, + "requires": { + "ee-first": "1.1.1" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "requires": { + "mimic-fn": "^2.1.0" + } + }, + "only": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/only/-/only-0.0.2.tgz", + "integrity": "sha1-Kv3oTQPlC5qO3EROMGEKcCle37Q=", + "dev": true + }, + "open": { + "version": "8.4.0", + "resolved": "https://registry.npmjs.org/open/-/open-8.4.0.tgz", + "integrity": "sha512-XgFPPM+B28FtCCgSb9I+s9szOC1vZRSwgWsRUA5ylIxRTgKozqjOCrVOqGsYABPYK5qnfqClxZTFBa8PKt2v6Q==", + "dev": true, + "requires": { + "define-lazy-prop": "^2.0.0", + "is-docker": "^2.1.1", + "is-wsl": "^2.2.0" + } + }, + "os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", + "dev": true + }, + "p-cancelable": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-2.1.1.tgz", + "integrity": "sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg==", + "dev": true + }, + "p-finally": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", + "dev": true + }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + }, + "p-map": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz", + "integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==", + "dev": true, + "requires": { + "aggregate-error": "^3.0.0" + } + }, + "p-queue": { + "version": "6.6.2", + "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-6.6.2.tgz", + "integrity": "sha512-RwFpb72c/BhQLEXIZ5K2e+AhgNVmIejGlTgiB9MzZ0e93GRvqZ7uSi0dvRF7/XIXDeNkra2fNHBxTyPDGySpjQ==", + "dev": true, + "requires": { + "eventemitter3": "^4.0.4", + "p-timeout": "^3.2.0" + } + }, + "p-timeout": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-3.2.0.tgz", + "integrity": "sha512-rhIwUycgwwKcP9yTOOFK/AKsAopjjCakVqLHePO3CC6Mir1Z99xT+R63jZxAT5lFZLa2inS5h+ZS2GvR99/FBg==", + "dev": true, + "requires": { + "p-finally": "^1.0.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, + "pacote": { + "version": "11.3.5", + "resolved": "https://registry.npmjs.org/pacote/-/pacote-11.3.5.tgz", + "integrity": "sha512-fT375Yczn4zi+6Hkk2TBe1x1sP8FgFsEIZ2/iWaXY2r/NkhDJfxbcn5paz1+RTFCyNf+dPnaoBDJoAxXSU8Bkg==", + "dev": true, + "requires": { + "@npmcli/git": "^2.1.0", + "@npmcli/installed-package-contents": "^1.0.6", + "@npmcli/promise-spawn": "^1.2.0", + "@npmcli/run-script": "^1.8.2", + "cacache": "^15.0.5", + "chownr": "^2.0.0", + "fs-minipass": "^2.1.0", + "infer-owner": "^1.0.4", + "minipass": "^3.1.3", + "mkdirp": "^1.0.3", + "npm-package-arg": "^8.0.1", + "npm-packlist": "^2.1.4", + "npm-pick-manifest": "^6.0.0", + "npm-registry-fetch": "^11.0.0", + "promise-retry": "^2.0.1", + "read-package-json-fast": "^2.0.1", + "rimraf": "^3.0.2", + "ssri": "^8.0.1", + "tar": "^6.1.0" + } + }, + "parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "requires": { + "callsites": "^3.0.0" + } + }, + "parse-conflict-json": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/parse-conflict-json/-/parse-conflict-json-1.1.1.tgz", + "integrity": "sha512-4gySviBiW5TRl7XHvp1agcS7SOe0KZOjC//71dzZVWJrY9hCrgtvl5v3SyIxCZ4fZF47TxD9nfzmxcx76xmbUw==", + "dev": true, + "requires": { + "json-parse-even-better-errors": "^2.3.0", + "just-diff": "^3.0.1", + "just-diff-apply": "^3.0.0" + } + }, + "parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + } + }, + "parse5": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz", + "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==", + "dev": true + }, + "parse5-htmlparser2-tree-adapter": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-6.0.1.tgz", + "integrity": "sha512-qPuWvbLgvDGilKc5BoicRovlT4MtYT6JfJyBOMDsKoiT+GiuP5qyrPCnR9HcPECIJJmZh5jRndyNThnhhb/vlA==", + "dev": true, + "requires": { + "parse5": "^6.0.1" + } + }, + "parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "dev": true + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, + "path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true + }, + "pathval": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", + "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", + "dev": true + }, + "pend": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", + "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", + "dev": true + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", + "dev": true + }, + "periscopic": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/periscopic/-/periscopic-2.0.3.tgz", + "integrity": "sha512-FuCZe61mWxQOJAQFEfmt9FjzebRlcpFz8sFPbyaCKtdusPkMEbA9ey0eARnRav5zAhmXznhaQkKGFAPn7X9NUw==", + "dev": true, + "requires": { + "estree-walker": "^2.0.2", + "is-reference": "^1.1.4" + }, + "dependencies": { + "estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "dev": true + } + } + }, + "picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "dev": true + }, + "picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true + }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + }, + "pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "requires": { + "find-up": "^4.0.0" + } + }, + "portfinder": { + "version": "1.0.28", + "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.28.tgz", + "integrity": "sha512-Se+2isanIcEqf2XMHjyUKskczxbPH7dQnlMjXX6+dybayyHvAf/TCgyMRlzf/B6QDhAEFOGes0pzRo3by4AbMA==", + "dev": true, + "requires": { + "async": "^2.6.2", + "debug": "^3.1.1", + "mkdirp": "^0.5.5" + }, + "dependencies": { + "debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "mkdirp": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + } + } + }, + "postcss": { + "version": "8.4.6", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.6.tgz", + "integrity": "sha512-OovjwIzs9Te46vlEx7+uXB0PLijpwjXGKXjVGGPIGubGpq7uh5Xgf6D6FiJ/SzJMBosHDp6a2hiXOS97iBXcaA==", + "dev": true, + "requires": { + "nanoid": "^3.2.0", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.2" + } + }, + "postcss-js": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/postcss-js/-/postcss-js-4.0.0.tgz", + "integrity": "sha512-77QESFBwgX4irogGVPgQ5s07vLvFqWr228qZY+w6lW599cRlK/HmnlivnnVUxkjHnCu4J16PDMHcH+e+2HbvTQ==", + "dev": true, + "requires": { + "camelcase-css": "^2.0.1" + } + }, + "postcss-load-config": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-3.1.1.tgz", + "integrity": "sha512-c/9XYboIbSEUZpiD1UQD0IKiUe8n9WHYV7YFe7X7J+ZwCsEKkUJSFWjS9hBU1RR9THR7jMXst8sxiqP0jjo2mg==", + "dev": true, + "requires": { + "lilconfig": "^2.0.4", + "yaml": "^1.10.2" + } + }, + "postcss-modules": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/postcss-modules/-/postcss-modules-4.3.0.tgz", + "integrity": "sha512-zoUttLDSsbWDinJM9jH37o7hulLRyEgH6fZm2PchxN7AZ8rkdWiALyNhnQ7+jg7cX9f10m6y5VhHsrjO0Mf/DA==", + "dev": true, + "requires": { + "generic-names": "^4.0.0", + "icss-replace-symbols": "^1.1.0", + "lodash.camelcase": "^4.3.0", + "postcss-modules-extract-imports": "^3.0.0", + "postcss-modules-local-by-default": "^4.0.0", + "postcss-modules-scope": "^3.0.0", + "postcss-modules-values": "^4.0.0", + "string-hash": "^1.1.1" + } + }, + "postcss-modules-extract-imports": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/postcss-modules-extract-imports/-/postcss-modules-extract-imports-3.0.0.tgz", + "integrity": "sha512-bdHleFnP3kZ4NYDhuGlVK+CMrQ/pqUm8bx/oGL93K6gVwiclvX5x0n76fYMKuIGKzlABOy13zsvqjb0f92TEXw==", + "dev": true, + "requires": {} + }, + "postcss-modules-local-by-default": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/postcss-modules-local-by-default/-/postcss-modules-local-by-default-4.0.0.tgz", + "integrity": "sha512-sT7ihtmGSF9yhm6ggikHdV0hlziDTX7oFoXtuVWeDd3hHObNkcHRo9V3yg7vCAY7cONyxJC/XXCmmiHHcvX7bQ==", + "dev": true, + "requires": { + "icss-utils": "^5.0.0", + "postcss-selector-parser": "^6.0.2", + "postcss-value-parser": "^4.1.0" + } + }, + "postcss-modules-scope": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/postcss-modules-scope/-/postcss-modules-scope-3.0.0.tgz", + "integrity": "sha512-hncihwFA2yPath8oZ15PZqvWGkWf+XUfQgUGamS4LqoP1anQLOsOJw0vr7J7IwLpoY9fatA2qiGUGmuZL0Iqlg==", + "dev": true, + "requires": { + "postcss-selector-parser": "^6.0.4" + } + }, + "postcss-modules-values": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/postcss-modules-values/-/postcss-modules-values-4.0.0.tgz", + "integrity": "sha512-RDxHkAiEGI78gS2ofyvCsu7iycRv7oqw5xMWn9iMoR0N/7mf9D50ecQqUo5BZ9Zh2vH4bCUR/ktCqbB9m8vJjQ==", + "dev": true, + "requires": { + "icss-utils": "^5.0.0" + } + }, + "postcss-nested": { + "version": "5.0.6", + "resolved": "https://registry.npmjs.org/postcss-nested/-/postcss-nested-5.0.6.tgz", + "integrity": "sha512-rKqm2Fk0KbA8Vt3AdGN0FB9OBOMDVajMG6ZCf/GoHgdxUJ4sBFp0A/uMIRm+MJUdo33YXEtjqIz8u7DAp8B7DA==", + "dev": true, + "requires": { + "postcss-selector-parser": "^6.0.6" + } + }, + "postcss-selector-parser": { + "version": "6.0.9", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.9.tgz", + "integrity": "sha512-UO3SgnZOVTwu4kyLR22UQ1xZh086RyNZppb7lLAKBFK8a32ttG5i87Y/P3+2bRSjZNyJ1B7hfFNo273tKe9YxQ==", + "dev": true, + "requires": { + "cssesc": "^3.0.0", + "util-deprecate": "^1.0.2" + } + }, + "postcss-value-parser": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", + "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==", + "dev": true + }, + "prettier": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.5.1.tgz", + "integrity": "sha512-vBZcPRUR5MZJwoyi3ZoyQlc1rXeEck8KgeC9AwwOn+exuxLxq5toTRDTSaVrXHxelDMHy9zlicw8u66yxoSUFg==", + "dev": true + }, + "pretty-format": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-26.6.2.tgz", + "integrity": "sha512-7AeGuCYNGmycyQbCqd/3PWH4eOoX/OiCa0uphp57NVTeAGdJGaAliecxwBDHYQCIvrW7aDBZCYeNTP/WX69mkg==", + "dev": true, + "requires": { + "@jest/types": "^26.6.2", + "ansi-regex": "^5.0.0", + "ansi-styles": "^4.0.0", + "react-is": "^17.0.1" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + } + } + }, + "proc-log": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/proc-log/-/proc-log-1.0.0.tgz", + "integrity": "sha512-aCk8AO51s+4JyuYGg3Q/a6gnrlDO09NpVWePtjp7xwphcoQ04x5WAfCyugcsbLooWcMJ87CLkD4+604IckEdhg==", + "dev": true + }, + "process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "dev": true + }, + "progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "dev": true + }, + "promise-all-reject-late": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/promise-all-reject-late/-/promise-all-reject-late-1.0.1.tgz", + "integrity": "sha512-vuf0Lf0lOxyQREH7GDIOUMLS7kz+gs8i6B+Yi8dC68a2sychGrHTJYghMBD6k7eUcH0H5P73EckCA48xijWqXw==", + "dev": true + }, + "promise-call-limit": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/promise-call-limit/-/promise-call-limit-1.0.1.tgz", + "integrity": "sha512-3+hgaa19jzCGLuSCbieeRsu5C2joKfYn8pY6JAuXFRVfF4IO+L7UPpFWNTeWT9pM7uhskvbPPd/oEOktCn317Q==", + "dev": true + }, + "promise-inflight": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz", + "integrity": "sha1-mEcocL8igTL8vdhoEputEsPAKeM=", + "dev": true + }, + "promise-retry": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/promise-retry/-/promise-retry-2.0.1.tgz", + "integrity": "sha512-y+WKFlBR8BGXnsNlIHFGPZmyDf3DFMoLhaflAnyZgV6rG6xu+JwesTo2Q9R6XwYmtmwAFCkAk3e35jEdoeh/3g==", + "dev": true, + "requires": { + "err-code": "^2.0.2", + "retry": "^0.12.0" + } + }, + "proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "dev": true + }, + "psl": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", + "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==", + "dev": true + }, + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "dev": true, + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true + }, + "puppeteer-core": { + "version": "13.1.3", + "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-13.1.3.tgz", + "integrity": "sha512-96pzvVBzq5lUGt3L/QrIH3mxn3NfZylHeusNhq06xBAHPI0Upc0SC/9u7tXjL0oRnmcExeVRJivr1lj7Ah/yDQ==", + "dev": true, + "requires": { + "debug": "4.3.2", + "devtools-protocol": "0.0.948846", + "extract-zip": "2.0.1", + "https-proxy-agent": "5.0.0", + "node-fetch": "2.6.7", + "pkg-dir": "4.2.0", + "progress": "2.0.3", + "proxy-from-env": "1.1.0", + "rimraf": "3.0.2", + "tar-fs": "2.1.1", + "unbzip2-stream": "1.4.3", + "ws": "8.2.3" + }, + "dependencies": { + "debug": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ws": { + "version": "8.2.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.2.3.tgz", + "integrity": "sha512-wBuoj1BDpC6ZQ1B7DWQBYVLphPWkm8i9Y0/3YdHjHKHiohOJ1ws+3OccDWtH+PoC9DZD5WOTrJvNbWvjS6JWaA==", + "dev": true, + "requires": {} + } + } + }, + "qs": { + "version": "6.10.3", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.3.tgz", + "integrity": "sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ==", + "dev": true, + "requires": { + "side-channel": "^1.0.4" + } + }, + "queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true + }, + "quick-lru": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz", + "integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==", + "dev": true + }, + "raw-body": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.2.tgz", + "integrity": "sha512-RPMAFUJP19WIet/99ngh6Iv8fzAbqum4Li7AD6DtGaW2RpMB/11xDoalPiJMTbu6I3hkbMVkATvZrqb9EEqeeQ==", + "dev": true, + "requires": { + "bytes": "3.1.1", + "http-errors": "1.8.1", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + } + }, + "react": { + "version": "17.0.2", + "resolved": "https://registry.npmjs.org/react/-/react-17.0.2.tgz", + "integrity": "sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA==", + "requires": { + "loose-envify": "^1.1.0", + "object-assign": "^4.1.1" + } + }, + "react-dom": { + "version": "17.0.2", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-17.0.2.tgz", + "integrity": "sha512-s4h96KtLDUQlsENhMn1ar8t2bEa+q/YAtj8pPPdIjPDGBDIVNsrD9aXNWqspUe6AzKCIG0C1HZZLqLV7qpOBGA==", + "requires": { + "loose-envify": "^1.1.0", + "object-assign": "^4.1.1", + "scheduler": "^0.20.2" + } + }, + "react-is": { + "version": "17.0.2", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", + "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", + "dev": true + }, + "react-refresh": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.9.0.tgz", + "integrity": "sha512-Gvzk7OZpiqKSkxsQvO/mbTN1poglhmAV7gR/DdIrRrSMXraRQQlfikRJOr3Nb9GTMPC5kof948Zy6jJZIFtDvQ==", + "dev": true + }, + "read-cmd-shim": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-cmd-shim/-/read-cmd-shim-2.0.0.tgz", + "integrity": "sha512-HJpV9bQpkl6KwjxlJcBoqu9Ba0PQg8TqSNIOrulGt54a0uup0HtevreFHzYzkm0lpnleRdNBzXznKrgxglEHQw==", + "dev": true + }, + "read-package-json-fast": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/read-package-json-fast/-/read-package-json-fast-2.0.3.tgz", + "integrity": "sha512-W/BKtbL+dUjTuRL2vziuYhp76s5HZ9qQhd/dKfWIZveD0O40453QNyZhC0e63lqZrAQ4jiOapVoeJ7JrszenQQ==", + "dev": true, + "requires": { + "json-parse-even-better-errors": "^2.3.0", + "npm-normalize-package-bin": "^1.0.1" + } + }, + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "readdir-scoped-modules": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/readdir-scoped-modules/-/readdir-scoped-modules-1.1.0.tgz", + "integrity": "sha512-asaikDeqAQg7JifRsZn1NJZXo9E+VwlyCfbkZhwyISinqk5zNS6266HS5kah6P0SaQKGF6SkNnZVHUzHFYxYDw==", + "dev": true, + "requires": { + "debuglog": "^1.0.1", + "dezalgo": "^1.0.0", + "graceful-fs": "^4.1.2", + "once": "^1.3.0" + } + }, + "readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "requires": { + "picomatch": "^2.2.1" + } + }, + "reduce-flatten": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/reduce-flatten/-/reduce-flatten-2.0.0.tgz", + "integrity": "sha512-EJ4UNY/U1t2P/2k6oqotuX2Cc3T6nxJwsM0N0asT7dhrtH1ltUxDn4NalSYmPE2rCkVpcf/X6R0wDwcFpzhd4w==", + "dev": true + }, + "regenerator-runtime": { + "version": "0.13.9", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz", + "integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA==" + }, + "request": { + "version": "2.88.2", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", + "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", + "dev": true, + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.3", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.5.0", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + }, + "dependencies": { + "qs": { + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz", + "integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==", + "dev": true + } + } + }, + "resolve": { + "version": "1.22.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.0.tgz", + "integrity": "sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw==", + "dev": true, + "requires": { + "is-core-module": "^2.8.1", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + } + }, + "resolve-alpn": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/resolve-alpn/-/resolve-alpn-1.2.1.tgz", + "integrity": "sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==", + "dev": true + }, + "resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true + }, + "resolve-path": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/resolve-path/-/resolve-path-1.4.0.tgz", + "integrity": "sha1-xL2p9e+y/OZSR4c6s2u02DT+Fvc=", + "dev": true, + "requires": { + "http-errors": "~1.6.2", + "path-is-absolute": "1.0.1" + }, + "dependencies": { + "depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", + "dev": true + }, + "http-errors": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", + "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", + "dev": true, + "requires": { + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.0", + "statuses": ">= 1.4.0 < 2" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + }, + "setprototypeof": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", + "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==", + "dev": true + } + } + }, + "responselike": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-2.0.0.tgz", + "integrity": "sha512-xH48u3FTB9VsZw7R+vvgaKeLKzT6jOogbQhEe/jewwnZgzPcnyWui2Av6JpoYZF/91uueC+lqhWqeURw5/qhCw==", + "dev": true, + "requires": { + "lowercase-keys": "^2.0.0" + } + }, + "restore-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", + "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", + "dev": true, + "requires": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + } + }, + "retry": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", + "integrity": "sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs=", + "dev": true + }, + "reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true + }, + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "rollup": { + "version": "2.67.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.67.0.tgz", + "integrity": "sha512-W83AaERwvDiHwHEF/dfAfS3z1Be5wf7n+pO3ZAO5IQadCT2lBTr7WQ2MwZZe+nodbD+n3HtC4OCOAdsOPPcKZQ==", + "dev": true, + "requires": { + "fsevents": "~2.3.2" + } + }, + "rollup-plugin-polyfill-node": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/rollup-plugin-polyfill-node/-/rollup-plugin-polyfill-node-0.6.2.tgz", + "integrity": "sha512-gMCVuR0zsKq0jdBn8pSXN1Ejsc458k2QsFFvQdbHoM0Pot5hEnck+pBP/FDwFS6uAi77pD3rDTytsaUStsOMlA==", + "dev": true, + "requires": { + "@rollup/plugin-inject": "^4.0.0" + } + }, + "run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "requires": { + "queue-microtask": "^1.2.2" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true + }, + "scheduler": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.20.2.tgz", + "integrity": "sha512-2eWfGgAqqWFGqtdMmcL5zCMK1U8KlXv8SQFGglL3CEtd0aDVDWgeF/YoCmvln55m5zSk3J/20hTaSBeSObsQDQ==", + "requires": { + "loose-envify": "^1.1.0", + "object-assign": "^4.1.1" + } + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "dev": true + }, + "setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "dev": true + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, + "side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "dev": true, + "requires": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + } + }, + "signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, + "skypack": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/skypack/-/skypack-0.3.2.tgz", + "integrity": "sha512-je1pix0QYER6iHuUGbgcafRJT5TI+EGUIBfzBLMqo3Wi22I2SzB9TVHQqwKCw8pzJMuHqhVTFEHc3Ey+ra25Sw==", + "dev": true, + "requires": { + "cacache": "^15.0.0", + "cachedir": "^2.3.0", + "esinstall": "^1.0.0", + "etag": "^1.8.1", + "find-up": "^5.0.0", + "got": "^11.1.4", + "kleur": "^4.1.0", + "mkdirp": "^1.0.3", + "p-queue": "^6.2.1", + "rimraf": "^3.0.0", + "rollup": "^2.23.0", + "validate-npm-package-name": "^3.0.0" + }, + "dependencies": { + "find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "requires": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + } + }, + "locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "requires": { + "p-locate": "^5.0.0" + } + }, + "p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "requires": { + "yocto-queue": "^0.1.0" + } + }, + "p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "requires": { + "p-limit": "^3.0.2" + } + } + } + }, + "slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true + }, + "slice-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", + "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + } + } + }, + "smart-buffer": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", + "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", + "dev": true + }, + "snowpack": { + "version": "3.8.8", + "resolved": "https://registry.npmjs.org/snowpack/-/snowpack-3.8.8.tgz", + "integrity": "sha512-Y/4V8FdzzYpwmJU2TgXRRFytz+GFSliWULK9J5O6C72KyK60w20JKqCdRtVs1S6BuobCedF5vSBD1Gvtm+gsJg==", + "dev": true, + "requires": { + "@npmcli/arborist": "^2.6.4", + "bufferutil": "^4.0.2", + "cachedir": "^2.3.0", + "cheerio": "1.0.0-rc.10", + "chokidar": "^3.4.0", + "cli-spinners": "^2.5.0", + "compressible": "^2.0.18", + "cosmiconfig": "^7.0.0", + "deepmerge": "^4.2.2", + "default-browser-id": "^2.0.0", + "detect-port": "^1.3.0", + "es-module-lexer": "^0.3.24", + "esbuild": "~0.9.0", + "esinstall": "^1.1.7", + "estree-walker": "^2.0.2", + "etag": "^1.8.1", + "execa": "^5.1.1", + "fdir": "^5.0.0", + "find-cache-dir": "^3.3.1", + "find-up": "^5.0.0", + "fsevents": "^2.3.2", + "glob": "^7.1.7", + "httpie": "^1.1.2", + "is-plain-object": "^5.0.0", + "is-reference": "^1.2.1", + "isbinaryfile": "^4.0.6", + "jsonschema": "~1.2.5", + "kleur": "^4.1.1", + "magic-string": "^0.25.7", + "meriyah": "^3.1.6", + "mime-types": "^2.1.26", + "mkdirp": "^1.0.3", + "npm-run-path": "^4.0.1", + "open": "^8.2.1", + "pacote": "^11.3.4", + "periscopic": "^2.0.3", + "picomatch": "^2.3.0", + "postcss": "^8.3.5", + "postcss-modules": "^4.0.0", + "resolve": "^1.20.0", + "resolve-from": "^5.0.0", + "rimraf": "^3.0.0", + "rollup": "~2.37.1", + "signal-exit": "^3.0.3", + "skypack": "^0.3.2", + "slash": "~3.0.0", + "source-map": "^0.7.3", + "strip-ansi": "^6.0.0", + "strip-comments": "^2.0.1", + "utf-8-validate": "^5.0.3", + "ws": "^7.3.0", + "yargs-parser": "^20.0.0" + }, + "dependencies": { + "es-module-lexer": { + "version": "0.3.26", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-0.3.26.tgz", + "integrity": "sha512-Va0Q/xqtrss45hWzP8CZJwzGSZJjDM5/MJRE3IXXnUCcVLElR9BRaE9F62BopysASyc4nM3uwhSW7FFB9nlWAA==", + "dev": true + }, + "estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "dev": true + }, + "find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "requires": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + } + }, + "locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "requires": { + "p-locate": "^5.0.0" + } + }, + "p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "requires": { + "yocto-queue": "^0.1.0" + } + }, + "p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "requires": { + "p-limit": "^3.0.2" + } + }, + "rollup": { + "version": "2.37.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.37.1.tgz", + "integrity": "sha512-V3ojEeyGeSdrMSuhP3diBb06P+qV4gKQeanbDv+Qh/BZbhdZ7kHV0xAt8Yjk4GFshq/WjO7R4c7DFM20AwTFVQ==", + "dev": true, + "requires": { + "fsevents": "~2.1.2" + }, + "dependencies": { + "fsevents": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz", + "integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==", + "dev": true, + "optional": true + } + } + }, + "source-map": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", + "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==", + "dev": true + } + } + }, + "socks": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/socks/-/socks-2.6.1.tgz", + "integrity": "sha512-kLQ9N5ucj8uIcxrDwjm0Jsqk06xdpBjGNQtpXy4Q8/QY2k+fY7nZH8CARy+hkbG+SGAovmzzuauCpBlb8FrnBA==", + "dev": true, + "requires": { + "ip": "^1.1.5", + "smart-buffer": "^4.1.0" + } + }, + "socks-proxy-agent": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-6.1.1.tgz", + "integrity": "sha512-t8J0kG3csjA4g6FTbsMOWws+7R7vuRC8aQ/wy3/1OWmsgwA68zs/+cExQ0koSitUDXqhufF/YJr9wtNMZHw5Ew==", + "dev": true, + "requires": { + "agent-base": "^6.0.2", + "debug": "^4.3.1", + "socks": "^2.6.1" + } + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + }, + "source-map-js": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", + "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", + "dev": true + }, + "sourcemap-codec": { + "version": "1.4.8", + "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", + "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", + "dev": true + }, + "sshpk": { + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.17.0.tgz", + "integrity": "sha512-/9HIEs1ZXGhSPE8X6Ccm7Nam1z8KcoCqPdI7ecm1N33EzAetWahvQWVqLZtaZQ+IDKX4IyA2o0gBzqIMkAagHQ==", + "dev": true, + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, + "ssri": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/ssri/-/ssri-8.0.1.tgz", + "integrity": "sha512-97qShzy1AiyxvPNIkLWoGua7xoQzzPjQ0HAH4B0rWKo7SZ6USuPcrUiAFrws0UH8RrbWmgq3LMTObhPIHbbBeQ==", + "dev": true, + "requires": { + "minipass": "^3.1.1" + } + }, + "standardized-audio-context": { + "version": "25.3.20", + "resolved": "https://registry.npmjs.org/standardized-audio-context/-/standardized-audio-context-25.3.20.tgz", + "integrity": "sha512-c6eMQXmN7iDS7ROuSqOrHQhxpazerJSnRHEJiKD8YkruZBTt/a5E7zmk+KkStoi0dohFAod8wvwWxc7S1gmdig==", + "requires": { + "@babel/runtime": "^7.17.0", + "automation-events": "^4.0.12", + "tslib": "^2.3.1" + } + }, + "statuses": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", + "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=", + "dev": true + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "string-hash": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/string-hash/-/string-hash-1.1.3.tgz", + "integrity": "sha1-6Kr8CsGFW0Zmkp7X3RJ1311sgRs=", + "dev": true + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + } + } + }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1" + } + }, + "strip-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-comments/-/strip-comments-2.0.1.tgz", + "integrity": "sha512-ZprKx+bBLXv067WTCALv8SSz5l2+XhpYCsVtSqlMnkAXMWDq+/ekVbl1ghqP9rUHTzv6sm/DwCOiYutU/yp1fw==", + "dev": true + }, + "strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, + "supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true + }, + "table-layout": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/table-layout/-/table-layout-1.0.2.tgz", + "integrity": "sha512-qd/R7n5rQTRFi+Zf2sk5XVVd9UQl6ZkduPFC3S7WEGJAmetDTjY3qPN50eSKzwuzEyQKy5TN2TiZdkIjos2L6A==", + "dev": true, + "requires": { + "array-back": "^4.0.1", + "deep-extend": "~0.6.0", + "typical": "^5.2.0", + "wordwrapjs": "^4.0.0" + }, + "dependencies": { + "array-back": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/array-back/-/array-back-4.0.2.tgz", + "integrity": "sha512-NbdMezxqf94cnNfWLL7V/im0Ub+Anbb0IoZhvzie8+4HJ4nMQuzHuy49FkGYCJK2yAloZ3meiB6AVMClbrI1vg==", + "dev": true + }, + "typical": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/typical/-/typical-5.2.0.tgz", + "integrity": "sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg==", + "dev": true + } + } + }, + "tailwindcss": { + "version": "3.0.18", + "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.0.18.tgz", + "integrity": "sha512-ihPTpEyA5ANgZbwKlgrbfnzOp9R5vDHFWmqxB1PT8NwOGCOFVVMl+Ps1cQQ369acaqqf1BEF77roCwK0lvNmTw==", + "dev": true, + "requires": { + "arg": "^5.0.1", + "chalk": "^4.1.2", + "chokidar": "^3.5.3", + "color-name": "^1.1.4", + "cosmiconfig": "^7.0.1", + "detective": "^5.2.0", + "didyoumean": "^1.2.2", + "dlv": "^1.1.3", + "fast-glob": "^3.2.11", + "glob-parent": "^6.0.2", + "is-glob": "^4.0.3", + "normalize-path": "^3.0.0", + "object-hash": "^2.2.0", + "postcss-js": "^4.0.0", + "postcss-load-config": "^3.1.0", + "postcss-nested": "5.0.6", + "postcss-selector-parser": "^6.0.9", + "postcss-value-parser": "^4.2.0", + "quick-lru": "^5.1.1", + "resolve": "^1.21.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "requires": { + "is-glob": "^4.0.3" + } + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "tar": { + "version": "6.1.11", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.11.tgz", + "integrity": "sha512-an/KZQzQUkZCkuoAA64hM92X0Urb6VpRhAFllDzz44U2mcD5scmT3zBc4VgVpkugF580+DQn8eAFSyoQt0tznA==", + "dev": true, + "requires": { + "chownr": "^2.0.0", + "fs-minipass": "^2.0.0", + "minipass": "^3.0.0", + "minizlib": "^2.1.1", + "mkdirp": "^1.0.3", + "yallist": "^4.0.0" + } + }, + "tar-fs": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz", + "integrity": "sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==", + "dev": true, + "requires": { + "chownr": "^1.1.1", + "mkdirp-classic": "^0.5.2", + "pump": "^3.0.0", + "tar-stream": "^2.1.4" + }, + "dependencies": { + "chownr": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", + "dev": true + } + } + }, + "tar-stream": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", + "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", + "dev": true, + "requires": { + "bl": "^4.0.3", + "end-of-stream": "^1.4.1", + "fs-constants": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" + }, + "dependencies": { + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + } + } + }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", + "dev": true + }, + "to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", + "dev": true + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + }, + "toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "dev": true + }, + "tone": { + "version": "14.7.77", + "resolved": "https://registry.npmjs.org/tone/-/tone-14.7.77.tgz", + "integrity": "sha512-tCfK73IkLHyzoKUvGq47gyDyxiKLFvKiVCOobynGgBB9Dl0NkxTM2p+eRJXyCYrjJwy9Y0XCMqD3uOYsYt2Fdg==", + "requires": { + "standardized-audio-context": "^25.1.8", + "tslib": "^2.0.1" + } + }, + "tough-cookie": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", + "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", + "dev": true, + "requires": { + "psl": "^1.1.28", + "punycode": "^2.1.1" + } + }, + "tr46": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz", + "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==", + "dev": true, + "requires": { + "punycode": "^2.1.1" + } + }, + "treeverse": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/treeverse/-/treeverse-1.0.4.tgz", + "integrity": "sha512-whw60l7r+8ZU8Tu/Uc2yxtc4ZTZbR/PF3u1IPNKGQ6p8EICLb3Z2lAgoqw9bqYd8IkgnsaOcLzYHFckjqNsf0g==", + "dev": true + }, + "tslib": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", + "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==" + }, + "tsscmp": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/tsscmp/-/tsscmp-1.0.6.tgz", + "integrity": "sha512-LxhtAkPDTkVCMQjt2h6eBVY28KCjikZqZfMcC15YBeNjkgUpdCfBu5HoiOTDu86v6smE8yOjyEktJ8hlbANHQA==", + "dev": true + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "dev": true, + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "dev": true + }, + "type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true + }, + "type-fest": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", + "dev": true + }, + "type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "dev": true, + "requires": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + } + }, + "typedarray-to-buffer": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "dev": true, + "requires": { + "is-typedarray": "^1.0.0" + } + }, + "typescript": { + "version": "4.5.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz", + "integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==", + "dev": true + }, + "typical": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/typical/-/typical-4.0.0.tgz", + "integrity": "sha512-VAH4IvQ7BDFYglMd7BPRDfLgxZZX4O4TFcRDA6EN5X7erNJJq+McIEp8np9aVtxrCJ6qx4GTYVfOWNjcqwZgRw==", + "dev": true + }, + "unbzip2-stream": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz", + "integrity": "sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg==", + "dev": true, + "requires": { + "buffer": "^5.2.1", + "through": "^2.3.8" + } + }, + "unique-filename": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-1.1.1.tgz", + "integrity": "sha512-Vmp0jIp2ln35UTXuryvjzkjGdRyf9b2lTXuSYUiPmzRcl3FDtYqAwOnTJkAngD9SWhnoJzDbTKwaOrZ+STtxNQ==", + "dev": true, + "requires": { + "unique-slug": "^2.0.0" + } + }, + "unique-slug": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-2.0.2.tgz", + "integrity": "sha512-zoWr9ObaxALD3DOPfjPSqxt4fnZiWblxHIgeWqW8x7UqDzEtHEQLzji2cuJYQFCU6KmoJikOYAZlrTHHebjx2w==", + "dev": true, + "requires": { + "imurmurhash": "^0.1.4" + } + }, + "unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=", + "dev": true + }, + "untildify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/untildify/-/untildify-2.1.0.tgz", + "integrity": "sha1-F+soB5h/dpUunASF/DEdBqgmouA=", + "dev": true, + "requires": { + "os-homedir": "^1.0.0" + } + }, + "uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "requires": { + "punycode": "^2.1.0" + } + }, + "utf-8-validate": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.8.tgz", + "integrity": "sha512-k4dW/Qja1BYDl2qD4tOMB9PFVha/UJtxTc1cXYOe3WwA/2m0Yn4qB7wLMpJyLJ/7DR0XnTut3HsCSzDT4ZvKgA==", + "dev": true, + "requires": { + "node-gyp-build": "^4.3.0" + } + }, + "util": { + "version": "0.10.3", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", + "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", + "dev": true, + "requires": { + "inherits": "2.0.1" + }, + "dependencies": { + "inherits": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", + "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=", + "dev": true + } + } + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true + }, + "uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", + "dev": true + }, + "v8-to-istanbul": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-8.1.1.tgz", + "integrity": "sha512-FGtKtv3xIpR6BYhvgH8MI/y78oT7d8Au3ww4QIxymrCtZEh5b8gCw2siywE+puhEmuWKDtmfrvF5UlB298ut3w==", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "^2.0.1", + "convert-source-map": "^1.6.0", + "source-map": "^0.7.3" + }, + "dependencies": { + "source-map": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", + "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==", + "dev": true + } + } + }, + "validate-npm-package-name": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-3.0.0.tgz", + "integrity": "sha1-X6kS2B630MdK/BQN5zF/DKffQ34=", + "dev": true, + "requires": { + "builtins": "^1.0.3" + } + }, + "vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=", + "dev": true + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + }, + "dependencies": { + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true + } + } + }, + "vm2": { + "version": "3.9.5", + "resolved": "https://registry.npmjs.org/vm2/-/vm2-3.9.5.tgz", + "integrity": "sha512-LuCAHZN75H9tdrAiLFf030oW7nJV5xwNMuk1ymOZwopmuK3d2H4L1Kv4+GFHgarKiLfXXLFU+7LDABHnwOkWng==", + "dev": true + }, + "walk-up-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/walk-up-path/-/walk-up-path-1.0.0.tgz", + "integrity": "sha512-hwj/qMDUEjCU5h0xr90KGCf0tg0/LgJbmOWgrWKYlcJZM7XvquvUJZ0G/HMGr7F7OQMOUuPHWP9JpriinkAlkg==", + "dev": true + }, + "webidl-conversions": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", + "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", + "dev": true + }, + "whatwg-url": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz", + "integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==", + "dev": true, + "requires": { + "tr46": "^3.0.0", + "webidl-conversions": "^7.0.0" + } + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "wide-align": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz", + "integrity": "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==", + "dev": true, + "requires": { + "string-width": "^1.0.2 || 2 || 3 || 4" + } + }, + "wordwrapjs": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/wordwrapjs/-/wordwrapjs-4.0.1.tgz", + "integrity": "sha512-kKlNACbvHrkpIw6oPeYDSmdCTu2hdMHoyXLTcUKala++lx5Y+wjJ/e474Jqv5abnVmwxw08DiTuHmw69lJGksA==", + "dev": true, + "requires": { + "reduce-flatten": "^2.0.0", + "typical": "^5.2.0" + }, + "dependencies": { + "typical": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/typical/-/typical-5.2.0.tgz", + "integrity": "sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg==", + "dev": true + } + } + }, + "workerpool": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.0.tgz", + "integrity": "sha512-Rsk5qQHJ9eowMH28Jwhe8HEbmdYDX4lwoMWshiCXugjtHqMD9ZbiqSDLxcsfdqsETPzVUtX5s1Z5kStiIM6l4A==", + "dev": true + }, + "wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + } + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "write-file-atomic": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", + "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", + "dev": true, + "requires": { + "imurmurhash": "^0.1.4", + "is-typedarray": "^1.0.0", + "signal-exit": "^3.0.2", + "typedarray-to-buffer": "^3.1.5" + } + }, + "ws": { + "version": "7.5.6", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.6.tgz", + "integrity": "sha512-6GLgCqo2cy2A2rjCNFlxQS6ZljG/coZfZXclldI8FB/1G3CCI36Zd8xy2HrFVACi8tfk5XrgLQEk+P0Tnz9UcA==", + "dev": true, + "requires": {} + }, + "xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "dev": true + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "yaml": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", + "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "dev": true + }, + "yargs-parser": { + "version": "20.2.9", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", + "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", + "dev": true + }, + "yauzl": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", + "integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=", + "dev": true, + "requires": { + "buffer-crc32": "~0.2.3", + "fd-slicer": "~1.1.0" + } + }, + "ylru": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ylru/-/ylru-1.2.1.tgz", + "integrity": "sha512-faQrqNMzcPCHGVC2aaOINk13K+aaBDUPjGWl0teOXywElLjyVAB6Oe2jj62jHYtwsU49jXhScYbvPENK+6zAvQ==", + "dev": true + }, + "yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true + } + } +} diff --git a/repl/package.json b/repl/package.json new file mode 100644 index 00000000..eabaec9d --- /dev/null +++ b/repl/package.json @@ -0,0 +1,36 @@ +{ + "scripts": { + "start": "snowpack dev", + "build": "snowpack build && cp ./public/.nojekyll ../docs", + "test": "web-test-runner \"src/**/*.test.tsx\"", + "format": "prettier --write \"src/**/*.{js,jsx,ts,tsx}\"", + "lint": "prettier --check \"src/**/*.{js,jsx,ts,tsx}\"" + }, + "dependencies": { + "react": "^17.0.2", + "react-dom": "^17.0.2", + "tone": "^14.7.77" + }, + "devDependencies": { + "@snowpack/plugin-dotenv": "^2.1.0", + "@snowpack/plugin-postcss": "^1.4.3", + "@snowpack/plugin-react-refresh": "^2.5.0", + "@snowpack/plugin-typescript": "^1.2.1", + "@snowpack/web-test-runner-plugin": "^0.2.2", + "@tailwindcss/forms": "^0.4.0", + "@testing-library/react": "^11.2.6", + "@types/chai": "^4.2.17", + "@types/mocha": "^8.2.2", + "@types/react": "^17.0.4", + "@types/react-dom": "^17.0.3", + "@types/snowpack-env": "^2.3.3", + "@web/test-runner": "^0.13.3", + "autoprefixer": "^10.4.2", + "chai": "^4.3.4", + "postcss": "^8.4.6", + "prettier": "^2.2.1", + "snowpack": "^3.3.7", + "tailwindcss": "^3.0.18", + "typescript": "^4.2.4" + } +} diff --git a/repl/postcss.config.js b/repl/postcss.config.js new file mode 100644 index 00000000..63d74348 --- /dev/null +++ b/repl/postcss.config.js @@ -0,0 +1,8 @@ +// postcss.config.js +module.exports = { + plugins: { + tailwindcss: {}, + autoprefixer: {}, + // other plugins can go here, such as autoprefixer + }, +}; diff --git a/repl/public/.nojekyll b/repl/public/.nojekyll new file mode 100644 index 00000000..e69de29b diff --git a/repl/public/favicon.ico b/repl/public/favicon.ico new file mode 100644 index 00000000..7a9d261f Binary files /dev/null and b/repl/public/favicon.ico differ diff --git a/repl/public/global.css b/repl/public/global.css new file mode 100644 index 00000000..b5c61c95 --- /dev/null +++ b/repl/public/global.css @@ -0,0 +1,3 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; diff --git a/repl/public/index.html b/repl/public/index.html new file mode 100644 index 00000000..9d566483 --- /dev/null +++ b/repl/public/index.html @@ -0,0 +1,16 @@ + + + + + + + + + Strudel REPL + + +
+ + + + diff --git a/repl/snowpack.config.mjs b/repl/snowpack.config.mjs new file mode 100644 index 00000000..f33b19f6 --- /dev/null +++ b/repl/snowpack.config.mjs @@ -0,0 +1,40 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +export default { + workspaceRoot: '..', + mount: { + public: { url: '/', static: false }, + src: { url: '/dist' }, + }, + plugins: [ + '@snowpack/plugin-postcss', + '@snowpack/plugin-react-refresh', + '@snowpack/plugin-dotenv', + [ + '@snowpack/plugin-typescript', + { + /* Yarn PnP workaround: see https://www.npmjs.com/package/@snowpack/plugin-typescript */ + ...(process.versions.pnp ? { tsc: 'yarn pnpify tsc' } : {}), + }, + ], + ], + routes: [ + /* Enable an SPA Fallback in development: */ + // {"match": "routes", "src": ".*", "dest": "/index.html"}, + ], + optimize: { + /* Example: Bundle your final build: */ + // "bundle": true, + }, + packageOptions: { + /* ... */ + knownEntrypoints: ['fraction.js'], + }, + devOptions: { + tailwindConfig: './tailwind.config.js', + }, + buildOptions: { + /* ... */ + out: '../docs', + baseUrl: '/strudel', + }, +}; diff --git a/repl/src/App.tsx b/repl/src/App.tsx new file mode 100644 index 00000000..c2770173 --- /dev/null +++ b/repl/src/App.tsx @@ -0,0 +1,117 @@ +import React, { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react'; +import logo from './logo.svg'; +import * as strudel from '../../strudel.mjs'; +import cx from './cx'; +import * as Tone from 'tone'; +import useCycle from './useCycle'; +import type { Hap, Pattern } from './types'; +import { tetris } from './tunes'; + +const { Fraction, TimeSpan } = strudel; + +const fr = (v: number) => new Fraction(v); +const ts = (start: number, end: number) => new TimeSpan(fr(start), fr(end)); +const parse = (code: string): Pattern => { + const { sequence, pure, reify, slowcat, fastcat, cat, stack, silence } = strudel; // make available to eval + return eval(code); +}; + +const synth = new Tone.PolySynth().toDestination(); +synth.set({ + oscillator: { type: 'triangle' }, + envelope: { + release: 0.01, + }, +}); + +function App() { + const [code, setCode] = useState(tetris); + const [log, setLog] = useState(''); + const logBox = useRef(); + const [error, setError] = useState(); + const [pattern, setPattern] = useState(); + // logs events of cycle + const logCycle = (_events: any, cycle: any) => { + if (_events.length) { + setLog((log) => log + `${log ? '\n\n' : ''}# cycle ${cycle}\n` + _events.map((e: any) => e.show()).join('\n')); + } + }; + // cycle hook to control scheduling + const cycle = useCycle({ + onEvent: useCallback((time, event) => { + // console.log('event', event, time); + synth.triggerAttackRelease(event.value, event.duration, time); + }, []), + onQuery: useCallback( + (span) => { + try { + return pattern?.query(span) || []; + } catch (err: any) { + setError(err); + return []; + } + }, + [pattern] + ), + onSchedule: useCallback( + (_events, cycle) => { + // console.log('schedule', _events, cycle); + logCycle(_events, cycle); + }, + [pattern] + ), + ready: !!pattern, + }); + // parse pattern when code changes + useEffect(() => { + try { + const _pattern = parse(code); + setPattern(_pattern); + // cycle.query(cycle.activeCycle()); // reschedule active cycle + setError(undefined); + } catch (err: any) { + setError(err); + } + }, [code]); + // scroll log box to bottom when log changes + useLayoutEffect(() => { + logBox.current.scrollTop = logBox.current?.scrollHeight; + }, [log]); + + return ( +
+
+ logo +

Strudel REPL

+
+
+
+
{error?.message}
+